@get-enlace/ui 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var iC=Object.defineProperty;var rC=(t,e,n)=>e in t?iC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Hm=(t,e,n)=>rC(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function vv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var wv={exports:{}},rc={},xv={exports:{}},se={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Al=Symbol.for("react.element"),sC=Symbol.for("react.portal"),oC=Symbol.for("react.fragment"),lC=Symbol.for("react.strict_mode"),aC=Symbol.for("react.profiler"),uC=Symbol.for("react.provider"),cC=Symbol.for("react.context"),hC=Symbol.for("react.forward_ref"),fC=Symbol.for("react.suspense"),dC=Symbol.for("react.memo"),pC=Symbol.for("react.lazy"),Wm=Symbol.iterator;function mC(t){return t===null||typeof t!="object"?null:(t=Wm&&t[Wm]||t["@@iterator"],typeof t=="function"?t:null)}var Sv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},kv=Object.assign,bv={};function Ws(t,e,n){this.props=t,this.context=e,this.refs=bv,this.updater=n||Sv}Ws.prototype.isReactComponent={};Ws.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Ws.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Cv(){}Cv.prototype=Ws.prototype;function Xd(t,e,n){this.props=t,this.context=e,this.refs=bv,this.updater=n||Sv}var Gd=Xd.prototype=new Cv;Gd.constructor=Xd;kv(Gd,Ws.prototype);Gd.isPureReactComponent=!0;var Um=Array.isArray,Ev=Object.prototype.hasOwnProperty,Jd={current:null},Av={key:!0,ref:!0,__self:!0,__source:!0};function Nv(t,e,n){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Ev.call(e,i)&&!Av.hasOwnProperty(i)&&(r[i]=e[i]);var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){for(var a=Array(l),u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}if(t&&t.defaultProps)for(i in l=t.defaultProps,l)r[i]===void 0&&(r[i]=l[i]);return{$$typeof:Al,type:t,key:s,ref:o,props:r,_owner:Jd.current}}function gC(t,e){return{$$typeof:Al,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Zd(t){return typeof t=="object"&&t!==null&&t.$$typeof===Al}function yC(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Km=/\/+/g;function Wc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?yC(""+t.key):e.toString(36)}function Ra(t,e,n,i,r){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Al:case sC:o=!0}}if(o)return o=t,r=r(o),t=i===""?"."+Wc(o,0):i,Um(r)?(n="",t!=null&&(n=t.replace(Km,"$&/")+"/"),Ra(r,e,n,"",function(u){return u})):r!=null&&(Zd(r)&&(r=gC(r,n+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Km,"$&/")+"/")+t)),e.push(r)),1;if(o=0,i=i===""?".":i+":",Um(t))for(var l=0;l<t.length;l++){s=t[l];var a=i+Wc(s,l);o+=Ra(s,e,n,a,r)}else if(a=mC(t),typeof a=="function")for(t=a.call(t),l=0;!(s=t.next()).done;)s=s.value,a=i+Wc(s,l++),o+=Ra(s,e,n,a,r);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function jl(t,e,n){if(t==null)return t;var i=[],r=0;return Ra(t,i,"","",function(s){return e.call(n,s,r++)}),i}function vC(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var ct={current:null},Ia={transition:null},wC={ReactCurrentDispatcher:ct,ReactCurrentBatchConfig:Ia,ReactCurrentOwner:Jd};function _v(){throw Error("act(...) is not supported in production builds of React.")}se.Children={map:jl,forEach:function(t,e,n){jl(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return jl(t,function(){e++}),e},toArray:function(t){return jl(t,function(e){return e})||[]},only:function(t){if(!Zd(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};se.Component=Ws;se.Fragment=oC;se.Profiler=aC;se.PureComponent=Xd;se.StrictMode=lC;se.Suspense=fC;se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wC;se.act=_v;se.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=kv({},t.props),r=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Jd.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(a in e)Ev.call(e,a)&&!Av.hasOwnProperty(a)&&(i[a]=e[a]===void 0&&l!==void 0?l[a]:e[a])}var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){l=Array(a);for(var u=0;u<a;u++)l[u]=arguments[u+2];i.children=l}return{$$typeof:Al,type:t.type,key:r,ref:s,props:i,_owner:o}};se.createContext=function(t){return t={$$typeof:cC,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:uC,_context:t},t.Consumer=t};se.createElement=Nv;se.createFactory=function(t){var e=Nv.bind(null,t);return e.type=t,e};se.createRef=function(){return{current:null}};se.forwardRef=function(t){return{$$typeof:hC,render:t}};se.isValidElement=Zd;se.lazy=function(t){return{$$typeof:pC,_payload:{_status:-1,_result:t},_init:vC}};se.memo=function(t,e){return{$$typeof:dC,type:t,compare:e===void 0?null:e}};se.startTransition=function(t){var e=Ia.transition;Ia.transition={};try{t()}finally{Ia.transition=e}};se.unstable_act=_v;se.useCallback=function(t,e){return ct.current.useCallback(t,e)};se.useContext=function(t){return ct.current.useContext(t)};se.useDebugValue=function(){};se.useDeferredValue=function(t){return ct.current.useDeferredValue(t)};se.useEffect=function(t,e){return ct.current.useEffect(t,e)};se.useId=function(){return ct.current.useId()};se.useImperativeHandle=function(t,e,n){return ct.current.useImperativeHandle(t,e,n)};se.useInsertionEffect=function(t,e){return ct.current.useInsertionEffect(t,e)};se.useLayoutEffect=function(t,e){return ct.current.useLayoutEffect(t,e)};se.useMemo=function(t,e){return ct.current.useMemo(t,e)};se.useReducer=function(t,e,n){return ct.current.useReducer(t,e,n)};se.useRef=function(t){return ct.current.useRef(t)};se.useState=function(t){return ct.current.useState(t)};se.useSyncExternalStore=function(t,e,n){return ct.current.useSyncExternalStore(t,e,n)};se.useTransition=function(){return ct.current.useTransition()};se.version="18.3.1";xv.exports=se;var M=xv.exports;const F=vv(M);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var xC=M,SC=Symbol.for("react.element"),kC=Symbol.for("react.fragment"),bC=Object.prototype.hasOwnProperty,CC=xC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,EC={key:!0,ref:!0,__self:!0,__source:!0};function Tv(t,e,n){var i,r={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)bC.call(e,i)&&!EC.hasOwnProperty(i)&&(r[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:SC,type:t,key:s,ref:o,props:r,_owner:CC.current}}rc.Fragment=kC;rc.jsx=Tv;rc.jsxs=Tv;wv.exports=rc;var b=wv.exports,Qh={},Mv={exports:{}},Rt={},Ov={exports:{}},Pv={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(t){function e(R,N){var T=R.length;R.push(N);e:for(;0<T;){var z=T-1>>>1,$=R[z];if(0<r($,N))R[z]=N,R[T]=$,T=z;else break e}}function n(R){return R.length===0?null:R[0]}function i(R){if(R.length===0)return null;var N=R[0],T=R.pop();if(T!==N){R[0]=T;e:for(var z=0,$=R.length,W=$>>>1;z<W;){var U=2*(z+1)-1,Q=R[U],te=U+1,ne=R[te];if(0>r(Q,T))te<$&&0>r(ne,Q)?(R[z]=ne,R[te]=T,z=te):(R[z]=Q,R[U]=T,z=U);else if(te<$&&0>r(ne,T))R[z]=ne,R[te]=T,z=te;else break e}}return N}function r(R,N){var T=R.sortIndex-N.sortIndex;return T!==0?T:R.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,h=null,f=3,d=!1,p=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(R){for(var N=n(u);N!==null;){if(N.callback===null)i(u);else if(N.startTime<=R)i(u),N.sortIndex=N.expirationTime,e(a,N);else break;N=n(u)}}function w(R){if(y=!1,v(R),!p)if(n(a)!==null)p=!0,O(k);else{var N=n(u);N!==null&&j(w,N.startTime-R)}}function k(R,N){p=!1,y&&(y=!1,m(_),_=-1),d=!0;var T=f;try{for(v(N),h=n(a);h!==null&&(!(h.expirationTime>N)||R&&!B());){var z=h.callback;if(typeof z=="function"){h.callback=null,f=h.priorityLevel;var $=z(h.expirationTime<=N);N=t.unstable_now(),typeof $=="function"?h.callback=$:h===n(a)&&i(a),v(N)}else i(a);h=n(a)}if(h!==null)var W=!0;else{var U=n(u);U!==null&&j(w,U.startTime-N),W=!1}return W}finally{h=null,f=T,d=!1}}var C=!1,E=null,_=-1,D=5,L=-1;function B(){return!(t.unstable_now()-L<D)}function P(){if(E!==null){var R=t.unstable_now();L=R;var N=!0;try{N=E(!0,R)}finally{N?A():(C=!1,E=null)}}else C=!1}var A;if(typeof g=="function")A=function(){g(P)};else if(typeof MessageChannel<"u"){var S=new MessageChannel,I=S.port2;S.port1.onmessage=P,A=function(){I.postMessage(null)}}else A=function(){x(P,0)};function O(R){E=R,C||(C=!0,A())}function j(R,N){_=x(function(){R(t.unstable_now())},N)}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(R){R.callback=null},t.unstable_continueExecution=function(){p||d||(p=!0,O(k))},t.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(a)},t.unstable_next=function(R){switch(f){case 1:case 2:case 3:var N=3;break;default:N=f}var T=f;f=N;try{return R()}finally{f=T}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(R,N){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var T=f;f=R;try{return N()}finally{f=T}},t.unstable_scheduleCallback=function(R,N,T){var z=t.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?z+T:z):T=z,R){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=T+$,R={id:c++,callback:N,priorityLevel:R,startTime:T,expirationTime:$,sortIndex:-1},T>z?(R.sortIndex=T,e(u,R),n(a)===null&&R===n(u)&&(y?(m(_),_=-1):y=!0,j(w,T-z))):(R.sortIndex=$,e(a,R),p||d||(p=!0,O(k))),R},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(R){var N=f;return function(){var T=f;f=N;try{return R.apply(this,arguments)}finally{f=T}}}})(Pv);Ov.exports=Pv;var AC=Ov.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var NC=M,Ot=AC;function H(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Rv=new Set,Wo={};function _r(t,e){Cs(t,e),Cs(t+"Capture",e)}function Cs(t,e){for(Wo[t]=e,t=0;t<e.length;t++)Rv.add(e[t])}var Zn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xh=Object.prototype.hasOwnProperty,_C=/^[: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]*$/,qm={},Ym={};function TC(t){return Xh.call(Ym,t)?!0:Xh.call(qm,t)?!1:_C.test(t)?Ym[t]=!0:(qm[t]=!0,!1)}function MC(t,e,n,i){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function OC(t,e,n,i){if(e===null||typeof e>"u"||MC(t,e,n,i))return!0;if(i)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ht(t,e,n,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Qe[t]=new ht(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Qe[e]=new ht(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Qe[t]=new ht(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Qe[t]=new ht(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Qe[t]=new ht(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Qe[t]=new ht(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Qe[t]=new ht(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Qe[t]=new ht(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Qe[t]=new ht(t,5,!1,t.toLowerCase(),null,!1,!1)});var ep=/[\-:]([a-z])/g;function tp(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ep,tp);Qe[e]=new ht(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ep,tp);Qe[e]=new ht(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ep,tp);Qe[e]=new ht(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Qe[t]=new ht(t,1,!1,t.toLowerCase(),null,!1,!1)});Qe.xlinkHref=new ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Qe[t]=new ht(t,1,!1,t.toLowerCase(),null,!0,!0)});function np(t,e,n,i){var r=Qe.hasOwnProperty(e)?Qe[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(OC(e,n,r,i)&&(n=null),i||r===null?TC(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):r.mustUseProperty?t[r.propertyName]=n===null?r.type===3?!1:"":n:(e=r.attributeName,i=r.attributeNamespace,n===null?t.removeAttribute(e):(r=r.type,n=r===3||r===4&&n===!0?"":""+n,i?t.setAttributeNS(i,e,n):t.setAttribute(e,n))))}var oi=NC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vl=Symbol.for("react.element"),Wr=Symbol.for("react.portal"),Ur=Symbol.for("react.fragment"),ip=Symbol.for("react.strict_mode"),Gh=Symbol.for("react.profiler"),Iv=Symbol.for("react.provider"),Dv=Symbol.for("react.context"),rp=Symbol.for("react.forward_ref"),Jh=Symbol.for("react.suspense"),Zh=Symbol.for("react.suspense_list"),sp=Symbol.for("react.memo"),ci=Symbol.for("react.lazy"),Lv=Symbol.for("react.offscreen"),Qm=Symbol.iterator;function Js(t){return t===null||typeof t!="object"?null:(t=Qm&&t[Qm]||t["@@iterator"],typeof t=="function"?t:null)}var be=Object.assign,Uc;function vo(t){if(Uc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Uc=e&&e[1]||""}return`
|
|
34
|
+
`+Uc+t}var Kc=!1;function qc(t,e){if(!t||Kc)return"";Kc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var i=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){i=u}t.call(e.prototype)}else{try{throw Error()}catch(u){i=u}t()}}catch(u){if(u&&i&&typeof u.stack=="string"){for(var r=u.stack.split(`
|
|
35
|
+
`),s=i.stack.split(`
|
|
36
|
+
`),o=r.length-1,l=s.length-1;1<=o&&0<=l&&r[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(r[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||r[o]!==s[l]){var a=`
|
|
37
|
+
`+r[o].replace(" at new "," at ");return t.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{Kc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?vo(t):""}function PC(t){switch(t.tag){case 5:return vo(t.type);case 16:return vo("Lazy");case 13:return vo("Suspense");case 19:return vo("SuspenseList");case 0:case 2:case 15:return t=qc(t.type,!1),t;case 11:return t=qc(t.type.render,!1),t;case 1:return t=qc(t.type,!0),t;default:return""}}function ef(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Ur:return"Fragment";case Wr:return"Portal";case Gh:return"Profiler";case ip:return"StrictMode";case Jh:return"Suspense";case Zh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Dv:return(t.displayName||"Context")+".Consumer";case Iv:return(t._context.displayName||"Context")+".Provider";case rp:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case sp:return e=t.displayName||null,e!==null?e:ef(t.type)||"Memo";case ci:e=t._payload,t=t._init;try{return ef(t(e))}catch{}}return null}function RC(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ef(e);case 8:return e===ip?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Di(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Bv(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function IC(t){var e=Bv(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Hl(t){t._valueTracker||(t._valueTracker=IC(t))}function zv(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Bv(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function nu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function tf(t,e){var n=e.checked;return be({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Xm(t,e){var n=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;n=Di(e.value!=null?e.value:n),t._wrapperState={initialChecked:i,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function $v(t,e){e=e.checked,e!=null&&np(t,"checked",e,!1)}function nf(t,e){$v(t,e);var n=Di(e.value),i=e.type;if(n!=null)i==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(i==="submit"||i==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?rf(t,e.type,n):e.hasOwnProperty("defaultValue")&&rf(t,e.type,Di(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Gm(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function rf(t,e,n){(e!=="number"||nu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var wo=Array.isArray;function ls(t,e,n,i){if(t=t.options,e){e={};for(var r=0;r<n.length;r++)e["$"+n[r]]=!0;for(n=0;n<t.length;n++)r=e.hasOwnProperty("$"+t[n].value),t[n].selected!==r&&(t[n].selected=r),r&&i&&(t[n].defaultSelected=!0)}else{for(n=""+Di(n),e=null,r=0;r<t.length;r++){if(t[r].value===n){t[r].selected=!0,i&&(t[r].defaultSelected=!0);return}e!==null||t[r].disabled||(e=t[r])}e!==null&&(e.selected=!0)}}function sf(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(H(91));return be({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Jm(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(H(92));if(wo(n)){if(1<n.length)throw Error(H(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Di(n)}}function Fv(t,e){var n=Di(e.value),i=Di(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),i!=null&&(t.defaultValue=""+i)}function Zm(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function jv(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function of(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?jv(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Wl,Vv=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,i,r){MSApp.execUnsafeLocalFunction(function(){return t(e,n,i,r)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Wl=Wl||document.createElement("div"),Wl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Wl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Uo(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var To={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},DC=["Webkit","ms","Moz","O"];Object.keys(To).forEach(function(t){DC.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),To[e]=To[t]})});function Hv(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||To.hasOwnProperty(t)&&To[t]?(""+e).trim():e+"px"}function Wv(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var i=n.indexOf("--")===0,r=Hv(n,e[n],i);n==="float"&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}var LC=be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lf(t,e){if(e){if(LC[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(H(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(H(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(H(61))}if(e.style!=null&&typeof e.style!="object")throw Error(H(62))}}function af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 uf=null;function op(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var cf=null,as=null,us=null;function eg(t){if(t=Tl(t)){if(typeof cf!="function")throw Error(H(280));var e=t.stateNode;e&&(e=uc(e),cf(t.stateNode,t.type,e))}}function Uv(t){as?us?us.push(t):us=[t]:as=t}function Kv(){if(as){var t=as,e=us;if(us=as=null,eg(t),e)for(t=0;t<e.length;t++)eg(e[t])}}function qv(t,e){return t(e)}function Yv(){}var Yc=!1;function Qv(t,e,n){if(Yc)return t(e,n);Yc=!0;try{return qv(t,e,n)}finally{Yc=!1,(as!==null||us!==null)&&(Yv(),Kv())}}function Ko(t,e){var n=t.stateNode;if(n===null)return null;var i=uc(n);if(i===null)return null;n=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(t=t.type,i=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!i;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(H(231,e,typeof n));return n}var hf=!1;if(Zn)try{var Zs={};Object.defineProperty(Zs,"passive",{get:function(){hf=!0}}),window.addEventListener("test",Zs,Zs),window.removeEventListener("test",Zs,Zs)}catch{hf=!1}function BC(t,e,n,i,r,s,o,l,a){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(c){this.onError(c)}}var Mo=!1,iu=null,ru=!1,ff=null,zC={onError:function(t){Mo=!0,iu=t}};function $C(t,e,n,i,r,s,o,l,a){Mo=!1,iu=null,BC.apply(zC,arguments)}function FC(t,e,n,i,r,s,o,l,a){if($C.apply(this,arguments),Mo){if(Mo){var u=iu;Mo=!1,iu=null}else throw Error(H(198));ru||(ru=!0,ff=u)}}function Tr(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function Xv(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function tg(t){if(Tr(t)!==t)throw Error(H(188))}function jC(t){var e=t.alternate;if(!e){if(e=Tr(t),e===null)throw Error(H(188));return e!==t?null:t}for(var n=t,i=e;;){var r=n.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){n=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===n)return tg(r),t;if(s===i)return tg(r),e;s=s.sibling}throw Error(H(188))}if(n.return!==i.return)n=r,i=s;else{for(var o=!1,l=r.child;l;){if(l===n){o=!0,n=r,i=s;break}if(l===i){o=!0,i=r,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,i=r;break}if(l===i){o=!0,i=s,n=r;break}l=l.sibling}if(!o)throw Error(H(189))}}if(n.alternate!==i)throw Error(H(190))}if(n.tag!==3)throw Error(H(188));return n.stateNode.current===n?t:e}function Gv(t){return t=jC(t),t!==null?Jv(t):null}function Jv(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Jv(t);if(e!==null)return e;t=t.sibling}return null}var Zv=Ot.unstable_scheduleCallback,ng=Ot.unstable_cancelCallback,VC=Ot.unstable_shouldYield,HC=Ot.unstable_requestPaint,Re=Ot.unstable_now,WC=Ot.unstable_getCurrentPriorityLevel,lp=Ot.unstable_ImmediatePriority,e1=Ot.unstable_UserBlockingPriority,su=Ot.unstable_NormalPriority,UC=Ot.unstable_LowPriority,t1=Ot.unstable_IdlePriority,sc=null,Rn=null;function KC(t){if(Rn&&typeof Rn.onCommitFiberRoot=="function")try{Rn.onCommitFiberRoot(sc,t,void 0,(t.current.flags&128)===128)}catch{}}var hn=Math.clz32?Math.clz32:QC,qC=Math.log,YC=Math.LN2;function QC(t){return t>>>=0,t===0?32:31-(qC(t)/YC|0)|0}var Ul=64,Kl=4194304;function xo(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function ou(t,e){var n=t.pendingLanes;if(n===0)return 0;var i=0,r=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~r;l!==0?i=xo(l):(s&=o,s!==0&&(i=xo(s)))}else o=n&~r,o!==0?i=xo(o):s!==0&&(i=xo(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=i;0<e;)n=31-hn(e),r=1<<n,i|=t[n],e&=~r;return i}function XC(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function GC(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,r=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-hn(s),l=1<<o,a=r[o];a===-1?(!(l&n)||l&i)&&(r[o]=XC(l,e)):a<=e&&(t.expiredLanes|=l),s&=~l}}function df(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function n1(){var t=Ul;return Ul<<=1,!(Ul&4194240)&&(Ul=64),t}function Qc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Nl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-hn(e),t[e]=n}function JC(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var i=t.eventTimes;for(t=t.expirationTimes;0<n;){var r=31-hn(n),s=1<<r;e[r]=0,i[r]=-1,t[r]=-1,n&=~s}}function ap(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-hn(n),r=1<<i;r&e|t[i]&e&&(t[i]|=e),n&=~r}}var ce=0;function i1(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var r1,up,s1,o1,l1,pf=!1,ql=[],Ei=null,Ai=null,Ni=null,qo=new Map,Yo=new Map,gi=[],ZC="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ig(t,e){switch(t){case"focusin":case"focusout":Ei=null;break;case"dragenter":case"dragleave":Ai=null;break;case"mouseover":case"mouseout":Ni=null;break;case"pointerover":case"pointerout":qo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yo.delete(e.pointerId)}}function eo(t,e,n,i,r,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Tl(e),e!==null&&up(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),t)}function e2(t,e,n,i,r){switch(e){case"focusin":return Ei=eo(Ei,t,e,n,i,r),!0;case"dragenter":return Ai=eo(Ai,t,e,n,i,r),!0;case"mouseover":return Ni=eo(Ni,t,e,n,i,r),!0;case"pointerover":var s=r.pointerId;return qo.set(s,eo(qo.get(s)||null,t,e,n,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Yo.set(s,eo(Yo.get(s)||null,t,e,n,i,r)),!0}return!1}function a1(t){var e=or(t.target);if(e!==null){var n=Tr(e);if(n!==null){if(e=n.tag,e===13){if(e=Xv(n),e!==null){t.blockedOn=e,l1(t.priority,function(){s1(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Da(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=mf(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);uf=i,n.target.dispatchEvent(i),uf=null}else return e=Tl(n),e!==null&&up(e),t.blockedOn=n,!1;e.shift()}return!0}function rg(t,e,n){Da(t)&&n.delete(e)}function t2(){pf=!1,Ei!==null&&Da(Ei)&&(Ei=null),Ai!==null&&Da(Ai)&&(Ai=null),Ni!==null&&Da(Ni)&&(Ni=null),qo.forEach(rg),Yo.forEach(rg)}function to(t,e){t.blockedOn===e&&(t.blockedOn=null,pf||(pf=!0,Ot.unstable_scheduleCallback(Ot.unstable_NormalPriority,t2)))}function Qo(t){function e(r){return to(r,t)}if(0<ql.length){to(ql[0],t);for(var n=1;n<ql.length;n++){var i=ql[n];i.blockedOn===t&&(i.blockedOn=null)}}for(Ei!==null&&to(Ei,t),Ai!==null&&to(Ai,t),Ni!==null&&to(Ni,t),qo.forEach(e),Yo.forEach(e),n=0;n<gi.length;n++)i=gi[n],i.blockedOn===t&&(i.blockedOn=null);for(;0<gi.length&&(n=gi[0],n.blockedOn===null);)a1(n),n.blockedOn===null&&gi.shift()}var cs=oi.ReactCurrentBatchConfig,lu=!0;function n2(t,e,n,i){var r=ce,s=cs.transition;cs.transition=null;try{ce=1,cp(t,e,n,i)}finally{ce=r,cs.transition=s}}function i2(t,e,n,i){var r=ce,s=cs.transition;cs.transition=null;try{ce=4,cp(t,e,n,i)}finally{ce=r,cs.transition=s}}function cp(t,e,n,i){if(lu){var r=mf(t,e,n,i);if(r===null)sh(t,e,i,au,n),ig(t,i);else if(e2(r,t,e,n,i))i.stopPropagation();else if(ig(t,i),e&4&&-1<ZC.indexOf(t)){for(;r!==null;){var s=Tl(r);if(s!==null&&r1(s),s=mf(t,e,n,i),s===null&&sh(t,e,i,au,n),s===r)break;r=s}r!==null&&i.stopPropagation()}else sh(t,e,i,null,n)}}var au=null;function mf(t,e,n,i){if(au=null,t=op(i),t=or(t),t!==null)if(e=Tr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Xv(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return au=t,null}function u1(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(WC()){case lp:return 1;case e1:return 4;case su:case UC:return 16;case t1:return 536870912;default:return 16}default:return 16}}var Si=null,hp=null,La=null;function c1(){if(La)return La;var t,e=hp,n=e.length,i,r="value"in Si?Si.value:Si.textContent,s=r.length;for(t=0;t<n&&e[t]===r[t];t++);var o=n-t;for(i=1;i<=o&&e[n-i]===r[s-i];i++);return La=r.slice(t,1<i?1-i:void 0)}function Ba(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Yl(){return!0}function sg(){return!1}function It(t){function e(n,i,r,s,o){this._reactName=n,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Yl:sg,this.isPropagationStopped=sg,this}return be(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Yl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),e}var Us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fp=It(Us),_l=be({},Us,{view:0,detail:0}),r2=It(_l),Xc,Gc,no,oc=be({},_l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dp,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==no&&(no&&t.type==="mousemove"?(Xc=t.screenX-no.screenX,Gc=t.screenY-no.screenY):Gc=Xc=0,no=t),Xc)},movementY:function(t){return"movementY"in t?t.movementY:Gc}}),og=It(oc),s2=be({},oc,{dataTransfer:0}),o2=It(s2),l2=be({},_l,{relatedTarget:0}),Jc=It(l2),a2=be({},Us,{animationName:0,elapsedTime:0,pseudoElement:0}),u2=It(a2),c2=be({},Us,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),h2=It(c2),f2=be({},Us,{data:0}),lg=It(f2),d2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p2={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"},m2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g2(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=m2[t])?!!e[t]:!1}function dp(){return g2}var y2=be({},_l,{key:function(t){if(t.key){var e=d2[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ba(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?p2[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dp,charCode:function(t){return t.type==="keypress"?Ba(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ba(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),v2=It(y2),w2=be({},oc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ag=It(w2),x2=be({},_l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dp}),S2=It(x2),k2=be({},Us,{propertyName:0,elapsedTime:0,pseudoElement:0}),b2=It(k2),C2=be({},oc,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),E2=It(C2),A2=[9,13,27,32],pp=Zn&&"CompositionEvent"in window,Oo=null;Zn&&"documentMode"in document&&(Oo=document.documentMode);var N2=Zn&&"TextEvent"in window&&!Oo,h1=Zn&&(!pp||Oo&&8<Oo&&11>=Oo),ug=" ",cg=!1;function f1(t,e){switch(t){case"keyup":return A2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function d1(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Kr=!1;function _2(t,e){switch(t){case"compositionend":return d1(e);case"keypress":return e.which!==32?null:(cg=!0,ug);case"textInput":return t=e.data,t===ug&&cg?null:t;default:return null}}function T2(t,e){if(Kr)return t==="compositionend"||!pp&&f1(t,e)?(t=c1(),La=hp=Si=null,Kr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return h1&&e.locale!=="ko"?null:e.data;default:return null}}var M2={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 hg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!M2[t.type]:e==="textarea"}function p1(t,e,n,i){Uv(i),e=uu(e,"onChange"),0<e.length&&(n=new fp("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var Po=null,Xo=null;function O2(t){E1(t,0)}function lc(t){var e=Qr(t);if(zv(e))return t}function P2(t,e){if(t==="change")return e}var m1=!1;if(Zn){var Zc;if(Zn){var eh="oninput"in document;if(!eh){var fg=document.createElement("div");fg.setAttribute("oninput","return;"),eh=typeof fg.oninput=="function"}Zc=eh}else Zc=!1;m1=Zc&&(!document.documentMode||9<document.documentMode)}function dg(){Po&&(Po.detachEvent("onpropertychange",g1),Xo=Po=null)}function g1(t){if(t.propertyName==="value"&&lc(Xo)){var e=[];p1(e,Xo,t,op(t)),Qv(O2,e)}}function R2(t,e,n){t==="focusin"?(dg(),Po=e,Xo=n,Po.attachEvent("onpropertychange",g1)):t==="focusout"&&dg()}function I2(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return lc(Xo)}function D2(t,e){if(t==="click")return lc(e)}function L2(t,e){if(t==="input"||t==="change")return lc(e)}function B2(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var pn=typeof Object.is=="function"?Object.is:B2;function Go(t,e){if(pn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!Xh.call(e,r)||!pn(t[r],e[r]))return!1}return!0}function pg(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function mg(t,e){var n=pg(t);t=0;for(var i;n;){if(n.nodeType===3){if(i=t+n.textContent.length,t<=e&&i>=e)return{node:n,offset:e-t};t=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=pg(n)}}function y1(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?y1(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function v1(){for(var t=window,e=nu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=nu(t.document)}return e}function mp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function z2(t){var e=v1(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&y1(n.ownerDocument.documentElement,n)){if(i!==null&&mp(n)){if(e=i.start,t=i.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=n.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!t.extend&&s>i&&(r=i,i=s,s=r),r=mg(n,s);var o=mg(n,i);r&&o&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),s>i?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var $2=Zn&&"documentMode"in document&&11>=document.documentMode,qr=null,gf=null,Ro=null,yf=!1;function gg(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yf||qr==null||qr!==nu(i)||(i=qr,"selectionStart"in i&&mp(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ro&&Go(Ro,i)||(Ro=i,i=uu(gf,"onSelect"),0<i.length&&(e=new fp("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=qr)))}function Ql(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Yr={animationend:Ql("Animation","AnimationEnd"),animationiteration:Ql("Animation","AnimationIteration"),animationstart:Ql("Animation","AnimationStart"),transitionend:Ql("Transition","TransitionEnd")},th={},w1={};Zn&&(w1=document.createElement("div").style,"AnimationEvent"in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),"TransitionEvent"in window||delete Yr.transitionend.transition);function ac(t){if(th[t])return th[t];if(!Yr[t])return t;var e=Yr[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in w1)return th[t]=e[n];return t}var x1=ac("animationend"),S1=ac("animationiteration"),k1=ac("animationstart"),b1=ac("transitionend"),C1=new Map,yg="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Vi(t,e){C1.set(t,e),_r(e,[t])}for(var nh=0;nh<yg.length;nh++){var ih=yg[nh],F2=ih.toLowerCase(),j2=ih[0].toUpperCase()+ih.slice(1);Vi(F2,"on"+j2)}Vi(x1,"onAnimationEnd");Vi(S1,"onAnimationIteration");Vi(k1,"onAnimationStart");Vi("dblclick","onDoubleClick");Vi("focusin","onFocus");Vi("focusout","onBlur");Vi(b1,"onTransitionEnd");Cs("onMouseEnter",["mouseout","mouseover"]);Cs("onMouseLeave",["mouseout","mouseover"]);Cs("onPointerEnter",["pointerout","pointerover"]);Cs("onPointerLeave",["pointerout","pointerover"]);_r("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));_r("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));_r("onBeforeInput",["compositionend","keypress","textInput","paste"]);_r("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));_r("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));_r("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var So="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(" "),V2=new Set("cancel close invalid load scroll toggle".split(" ").concat(So));function vg(t,e,n){var i=t.type||"unknown-event";t.currentTarget=n,FC(i,e,void 0,t),t.currentTarget=null}function E1(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var i=t[n],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var l=i[o],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==s&&r.isPropagationStopped())break e;vg(r,l,u),s=a}else for(o=0;o<i.length;o++){if(l=i[o],a=l.instance,u=l.currentTarget,l=l.listener,a!==s&&r.isPropagationStopped())break e;vg(r,l,u),s=a}}}if(ru)throw t=ff,ru=!1,ff=null,t}function ve(t,e){var n=e[kf];n===void 0&&(n=e[kf]=new Set);var i=t+"__bubble";n.has(i)||(A1(e,t,2,!1),n.add(i))}function rh(t,e,n){var i=0;e&&(i|=4),A1(n,t,i,e)}var Xl="_reactListening"+Math.random().toString(36).slice(2);function Jo(t){if(!t[Xl]){t[Xl]=!0,Rv.forEach(function(n){n!=="selectionchange"&&(V2.has(n)||rh(n,!1,t),rh(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Xl]||(e[Xl]=!0,rh("selectionchange",!1,e))}}function A1(t,e,n,i){switch(u1(e)){case 1:var r=n2;break;case 4:r=i2;break;default:r=cp}n=r.bind(null,e,n,t),r=void 0,!hf||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?t.addEventListener(e,n,{capture:!0,passive:r}):t.addEventListener(e,n,!0):r!==void 0?t.addEventListener(e,n,{passive:r}):t.addEventListener(e,n,!1)}function sh(t,e,n,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var l=i.stateNode.containerInfo;if(l===r||l.nodeType===8&&l.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===r||a.nodeType===8&&a.parentNode===r))return;o=o.return}for(;l!==null;){if(o=or(l),o===null)return;if(a=o.tag,a===5||a===6){i=s=o;continue e}l=l.parentNode}}i=i.return}Qv(function(){var u=s,c=op(n),h=[];e:{var f=C1.get(t);if(f!==void 0){var d=fp,p=t;switch(t){case"keypress":if(Ba(n)===0)break e;case"keydown":case"keyup":d=v2;break;case"focusin":p="focus",d=Jc;break;case"focusout":p="blur",d=Jc;break;case"beforeblur":case"afterblur":d=Jc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":d=og;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":d=o2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":d=S2;break;case x1:case S1:case k1:d=u2;break;case b1:d=b2;break;case"scroll":d=r2;break;case"wheel":d=E2;break;case"copy":case"cut":case"paste":d=h2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":d=ag}var y=(e&4)!==0,x=!y&&t==="scroll",m=y?f!==null?f+"Capture":null:f;y=[];for(var g=u,v;g!==null;){v=g;var w=v.stateNode;if(v.tag===5&&w!==null&&(v=w,m!==null&&(w=Ko(g,m),w!=null&&y.push(Zo(g,w,v)))),x)break;g=g.return}0<y.length&&(f=new d(f,p,null,n,c),h.push({event:f,listeners:y}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",d=t==="mouseout"||t==="pointerout",f&&n!==uf&&(p=n.relatedTarget||n.fromElement)&&(or(p)||p[ei]))break e;if((d||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,d?(p=n.relatedTarget||n.toElement,d=u,p=p?or(p):null,p!==null&&(x=Tr(p),p!==x||p.tag!==5&&p.tag!==6)&&(p=null)):(d=null,p=u),d!==p)){if(y=og,w="onMouseLeave",m="onMouseEnter",g="mouse",(t==="pointerout"||t==="pointerover")&&(y=ag,w="onPointerLeave",m="onPointerEnter",g="pointer"),x=d==null?f:Qr(d),v=p==null?f:Qr(p),f=new y(w,g+"leave",d,n,c),f.target=x,f.relatedTarget=v,w=null,or(c)===u&&(y=new y(m,g+"enter",p,n,c),y.target=v,y.relatedTarget=x,w=y),x=w,d&&p)t:{for(y=d,m=p,g=0,v=y;v;v=Lr(v))g++;for(v=0,w=m;w;w=Lr(w))v++;for(;0<g-v;)y=Lr(y),g--;for(;0<v-g;)m=Lr(m),v--;for(;g--;){if(y===m||m!==null&&y===m.alternate)break t;y=Lr(y),m=Lr(m)}y=null}else y=null;d!==null&&wg(h,f,d,y,!1),p!==null&&x!==null&&wg(h,x,p,y,!0)}}e:{if(f=u?Qr(u):window,d=f.nodeName&&f.nodeName.toLowerCase(),d==="select"||d==="input"&&f.type==="file")var k=P2;else if(hg(f))if(m1)k=L2;else{k=I2;var C=R2}else(d=f.nodeName)&&d.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=D2);if(k&&(k=k(t,u))){p1(h,k,n,c);break e}C&&C(t,f,u),t==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&rf(f,"number",f.value)}switch(C=u?Qr(u):window,t){case"focusin":(hg(C)||C.contentEditable==="true")&&(qr=C,gf=u,Ro=null);break;case"focusout":Ro=gf=qr=null;break;case"mousedown":yf=!0;break;case"contextmenu":case"mouseup":case"dragend":yf=!1,gg(h,n,c);break;case"selectionchange":if($2)break;case"keydown":case"keyup":gg(h,n,c)}var E;if(pp)e:{switch(t){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else Kr?f1(t,n)&&(_="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(_="onCompositionStart");_&&(h1&&n.locale!=="ko"&&(Kr||_!=="onCompositionStart"?_==="onCompositionEnd"&&Kr&&(E=c1()):(Si=c,hp="value"in Si?Si.value:Si.textContent,Kr=!0)),C=uu(u,_),0<C.length&&(_=new lg(_,t,null,n,c),h.push({event:_,listeners:C}),E?_.data=E:(E=d1(n),E!==null&&(_.data=E)))),(E=N2?_2(t,n):T2(t,n))&&(u=uu(u,"onBeforeInput"),0<u.length&&(c=new lg("onBeforeInput","beforeinput",null,n,c),h.push({event:c,listeners:u}),c.data=E))}E1(h,e)})}function Zo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function uu(t,e){for(var n=e+"Capture",i=[];t!==null;){var r=t,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=Ko(t,n),s!=null&&i.unshift(Zo(t,s,r)),s=Ko(t,e),s!=null&&i.push(Zo(t,s,r))),t=t.return}return i}function Lr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function wg(t,e,n,i,r){for(var s=e._reactName,o=[];n!==null&&n!==i;){var l=n,a=l.alternate,u=l.stateNode;if(a!==null&&a===i)break;l.tag===5&&u!==null&&(l=u,r?(a=Ko(n,s),a!=null&&o.unshift(Zo(n,a,l))):r||(a=Ko(n,s),a!=null&&o.push(Zo(n,a,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var H2=/\r\n?/g,W2=/\u0000|\uFFFD/g;function xg(t){return(typeof t=="string"?t:""+t).replace(H2,`
|
|
38
|
+
`).replace(W2,"")}function Gl(t,e,n){if(e=xg(e),xg(t)!==e&&n)throw Error(H(425))}function cu(){}var vf=null,wf=null;function xf(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Sf=typeof setTimeout=="function"?setTimeout:void 0,U2=typeof clearTimeout=="function"?clearTimeout:void 0,Sg=typeof Promise=="function"?Promise:void 0,K2=typeof queueMicrotask=="function"?queueMicrotask:typeof Sg<"u"?function(t){return Sg.resolve(null).then(t).catch(q2)}:Sf;function q2(t){setTimeout(function(){throw t})}function oh(t,e){var n=e,i=0;do{var r=n.nextSibling;if(t.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(i===0){t.removeChild(r),Qo(e);return}i--}else n!=="$"&&n!=="$?"&&n!=="$!"||i++;n=r}while(n);Qo(e)}function _i(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function kg(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Ks=Math.random().toString(36).slice(2),_n="__reactFiber$"+Ks,el="__reactProps$"+Ks,ei="__reactContainer$"+Ks,kf="__reactEvents$"+Ks,Y2="__reactListeners$"+Ks,Q2="__reactHandles$"+Ks;function or(t){var e=t[_n];if(e)return e;for(var n=t.parentNode;n;){if(e=n[ei]||n[_n]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=kg(t);t!==null;){if(n=t[_n])return n;t=kg(t)}return e}t=n,n=t.parentNode}return null}function Tl(t){return t=t[_n]||t[ei],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Qr(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(H(33))}function uc(t){return t[el]||null}var bf=[],Xr=-1;function Hi(t){return{current:t}}function we(t){0>Xr||(t.current=bf[Xr],bf[Xr]=null,Xr--)}function pe(t,e){Xr++,bf[Xr]=t.current,t.current=e}var Li={},nt=Hi(Li),wt=Hi(!1),yr=Li;function Es(t,e){var n=t.type.contextTypes;if(!n)return Li;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in n)r[s]=e[s];return i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function xt(t){return t=t.childContextTypes,t!=null}function hu(){we(wt),we(nt)}function bg(t,e,n){if(nt.current!==Li)throw Error(H(168));pe(nt,e),pe(wt,n)}function N1(t,e,n){var i=t.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return n;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(H(108,RC(t)||"Unknown",r));return be({},n,i)}function fu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Li,yr=nt.current,pe(nt,t),pe(wt,wt.current),!0}function Cg(t,e,n){var i=t.stateNode;if(!i)throw Error(H(169));n?(t=N1(t,e,yr),i.__reactInternalMemoizedMergedChildContext=t,we(wt),we(nt),pe(nt,t)):we(wt),pe(wt,n)}var Wn=null,cc=!1,lh=!1;function _1(t){Wn===null?Wn=[t]:Wn.push(t)}function X2(t){cc=!0,_1(t)}function Wi(){if(!lh&&Wn!==null){lh=!0;var t=0,e=ce;try{var n=Wn;for(ce=1;t<n.length;t++){var i=n[t];do i=i(!0);while(i!==null)}Wn=null,cc=!1}catch(r){throw Wn!==null&&(Wn=Wn.slice(t+1)),Zv(lp,Wi),r}finally{ce=e,lh=!1}}return null}var Gr=[],Jr=0,du=null,pu=0,Bt=[],zt=0,vr=null,qn=1,Yn="";function er(t,e){Gr[Jr++]=pu,Gr[Jr++]=du,du=t,pu=e}function T1(t,e,n){Bt[zt++]=qn,Bt[zt++]=Yn,Bt[zt++]=vr,vr=t;var i=qn;t=Yn;var r=32-hn(i)-1;i&=~(1<<r),n+=1;var s=32-hn(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,qn=1<<32-hn(e)+r|n<<r|i,Yn=s+t}else qn=1<<s|n<<r|i,Yn=t}function gp(t){t.return!==null&&(er(t,1),T1(t,1,0))}function yp(t){for(;t===du;)du=Gr[--Jr],Gr[Jr]=null,pu=Gr[--Jr],Gr[Jr]=null;for(;t===vr;)vr=Bt[--zt],Bt[zt]=null,Yn=Bt[--zt],Bt[zt]=null,qn=Bt[--zt],Bt[zt]=null}var Mt=null,_t=null,xe=!1,sn=null;function M1(t,e){var n=Ft(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Eg(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Mt=t,_t=_i(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Mt=t,_t=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=vr!==null?{id:qn,overflow:Yn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Ft(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Mt=t,_t=null,!0):!1;default:return!1}}function Cf(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Ef(t){if(xe){var e=_t;if(e){var n=e;if(!Eg(t,e)){if(Cf(t))throw Error(H(418));e=_i(n.nextSibling);var i=Mt;e&&Eg(t,e)?M1(i,n):(t.flags=t.flags&-4097|2,xe=!1,Mt=t)}}else{if(Cf(t))throw Error(H(418));t.flags=t.flags&-4097|2,xe=!1,Mt=t}}}function Ag(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Mt=t}function Jl(t){if(t!==Mt)return!1;if(!xe)return Ag(t),xe=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!xf(t.type,t.memoizedProps)),e&&(e=_t)){if(Cf(t))throw O1(),Error(H(418));for(;e;)M1(t,e),e=_i(e.nextSibling)}if(Ag(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(H(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){_t=_i(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}_t=null}}else _t=Mt?_i(t.stateNode.nextSibling):null;return!0}function O1(){for(var t=_t;t;)t=_i(t.nextSibling)}function As(){_t=Mt=null,xe=!1}function vp(t){sn===null?sn=[t]:sn.push(t)}var G2=oi.ReactCurrentBatchConfig;function io(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(H(309));var i=n.stateNode}if(!i)throw Error(H(147,t));var r=i,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var l=r.refs;o===null?delete l[s]:l[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(H(284));if(!n._owner)throw Error(H(290,t))}return t}function Zl(t,e){throw t=Object.prototype.toString.call(e),Error(H(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Ng(t){var e=t._init;return e(t._payload)}function P1(t){function e(m,g){if(t){var v=m.deletions;v===null?(m.deletions=[g],m.flags|=16):v.push(g)}}function n(m,g){if(!t)return null;for(;g!==null;)e(m,g),g=g.sibling;return null}function i(m,g){for(m=new Map;g!==null;)g.key!==null?m.set(g.key,g):m.set(g.index,g),g=g.sibling;return m}function r(m,g){return m=Pi(m,g),m.index=0,m.sibling=null,m}function s(m,g,v){return m.index=v,t?(v=m.alternate,v!==null?(v=v.index,v<g?(m.flags|=2,g):v):(m.flags|=2,g)):(m.flags|=1048576,g)}function o(m){return t&&m.alternate===null&&(m.flags|=2),m}function l(m,g,v,w){return g===null||g.tag!==6?(g=ph(v,m.mode,w),g.return=m,g):(g=r(g,v),g.return=m,g)}function a(m,g,v,w){var k=v.type;return k===Ur?c(m,g,v.props.children,w,v.key):g!==null&&(g.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===ci&&Ng(k)===g.type)?(w=r(g,v.props),w.ref=io(m,g,v),w.return=m,w):(w=Wa(v.type,v.key,v.props,null,m.mode,w),w.ref=io(m,g,v),w.return=m,w)}function u(m,g,v,w){return g===null||g.tag!==4||g.stateNode.containerInfo!==v.containerInfo||g.stateNode.implementation!==v.implementation?(g=mh(v,m.mode,w),g.return=m,g):(g=r(g,v.children||[]),g.return=m,g)}function c(m,g,v,w,k){return g===null||g.tag!==7?(g=dr(v,m.mode,w,k),g.return=m,g):(g=r(g,v),g.return=m,g)}function h(m,g,v){if(typeof g=="string"&&g!==""||typeof g=="number")return g=ph(""+g,m.mode,v),g.return=m,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Vl:return v=Wa(g.type,g.key,g.props,null,m.mode,v),v.ref=io(m,null,g),v.return=m,v;case Wr:return g=mh(g,m.mode,v),g.return=m,g;case ci:var w=g._init;return h(m,w(g._payload),v)}if(wo(g)||Js(g))return g=dr(g,m.mode,v,null),g.return=m,g;Zl(m,g)}return null}function f(m,g,v,w){var k=g!==null?g.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return k!==null?null:l(m,g,""+v,w);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Vl:return v.key===k?a(m,g,v,w):null;case Wr:return v.key===k?u(m,g,v,w):null;case ci:return k=v._init,f(m,g,k(v._payload),w)}if(wo(v)||Js(v))return k!==null?null:c(m,g,v,w,null);Zl(m,v)}return null}function d(m,g,v,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return m=m.get(v)||null,l(g,m,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Vl:return m=m.get(w.key===null?v:w.key)||null,a(g,m,w,k);case Wr:return m=m.get(w.key===null?v:w.key)||null,u(g,m,w,k);case ci:var C=w._init;return d(m,g,v,C(w._payload),k)}if(wo(w)||Js(w))return m=m.get(v)||null,c(g,m,w,k,null);Zl(g,w)}return null}function p(m,g,v,w){for(var k=null,C=null,E=g,_=g=0,D=null;E!==null&&_<v.length;_++){E.index>_?(D=E,E=null):D=E.sibling;var L=f(m,E,v[_],w);if(L===null){E===null&&(E=D);break}t&&E&&L.alternate===null&&e(m,E),g=s(L,g,_),C===null?k=L:C.sibling=L,C=L,E=D}if(_===v.length)return n(m,E),xe&&er(m,_),k;if(E===null){for(;_<v.length;_++)E=h(m,v[_],w),E!==null&&(g=s(E,g,_),C===null?k=E:C.sibling=E,C=E);return xe&&er(m,_),k}for(E=i(m,E);_<v.length;_++)D=d(E,m,_,v[_],w),D!==null&&(t&&D.alternate!==null&&E.delete(D.key===null?_:D.key),g=s(D,g,_),C===null?k=D:C.sibling=D,C=D);return t&&E.forEach(function(B){return e(m,B)}),xe&&er(m,_),k}function y(m,g,v,w){var k=Js(v);if(typeof k!="function")throw Error(H(150));if(v=k.call(v),v==null)throw Error(H(151));for(var C=k=null,E=g,_=g=0,D=null,L=v.next();E!==null&&!L.done;_++,L=v.next()){E.index>_?(D=E,E=null):D=E.sibling;var B=f(m,E,L.value,w);if(B===null){E===null&&(E=D);break}t&&E&&B.alternate===null&&e(m,E),g=s(B,g,_),C===null?k=B:C.sibling=B,C=B,E=D}if(L.done)return n(m,E),xe&&er(m,_),k;if(E===null){for(;!L.done;_++,L=v.next())L=h(m,L.value,w),L!==null&&(g=s(L,g,_),C===null?k=L:C.sibling=L,C=L);return xe&&er(m,_),k}for(E=i(m,E);!L.done;_++,L=v.next())L=d(E,m,_,L.value,w),L!==null&&(t&&L.alternate!==null&&E.delete(L.key===null?_:L.key),g=s(L,g,_),C===null?k=L:C.sibling=L,C=L);return t&&E.forEach(function(P){return e(m,P)}),xe&&er(m,_),k}function x(m,g,v,w){if(typeof v=="object"&&v!==null&&v.type===Ur&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Vl:e:{for(var k=v.key,C=g;C!==null;){if(C.key===k){if(k=v.type,k===Ur){if(C.tag===7){n(m,C.sibling),g=r(C,v.props.children),g.return=m,m=g;break e}}else if(C.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===ci&&Ng(k)===C.type){n(m,C.sibling),g=r(C,v.props),g.ref=io(m,C,v),g.return=m,m=g;break e}n(m,C);break}else e(m,C);C=C.sibling}v.type===Ur?(g=dr(v.props.children,m.mode,w,v.key),g.return=m,m=g):(w=Wa(v.type,v.key,v.props,null,m.mode,w),w.ref=io(m,g,v),w.return=m,m=w)}return o(m);case Wr:e:{for(C=v.key;g!==null;){if(g.key===C)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(m,g.sibling),g=r(g,v.children||[]),g.return=m,m=g;break e}else{n(m,g);break}else e(m,g);g=g.sibling}g=mh(v,m.mode,w),g.return=m,m=g}return o(m);case ci:return C=v._init,x(m,g,C(v._payload),w)}if(wo(v))return p(m,g,v,w);if(Js(v))return y(m,g,v,w);Zl(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(n(m,g.sibling),g=r(g,v),g.return=m,m=g):(n(m,g),g=ph(v,m.mode,w),g.return=m,m=g),o(m)):n(m,g)}return x}var Ns=P1(!0),R1=P1(!1),mu=Hi(null),gu=null,Zr=null,wp=null;function xp(){wp=Zr=gu=null}function Sp(t){var e=mu.current;we(mu),t._currentValue=e}function Af(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function hs(t,e){gu=t,wp=Zr=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(gt=!0),t.firstContext=null)}function Yt(t){var e=t._currentValue;if(wp!==t)if(t={context:t,memoizedValue:e,next:null},Zr===null){if(gu===null)throw Error(H(308));Zr=t,gu.dependencies={lanes:0,firstContext:t}}else Zr=Zr.next=t;return e}var lr=null;function kp(t){lr===null?lr=[t]:lr.push(t)}function I1(t,e,n,i){var r=e.interleaved;return r===null?(n.next=n,kp(e)):(n.next=r.next,r.next=n),e.interleaved=n,ti(t,i)}function ti(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var hi=!1;function bp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function D1(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Gn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ti(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,le&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,ti(t,n)}return r=i.interleaved,r===null?(e.next=e,kp(i)):(e.next=r.next,r.next=e),i.interleaved=e,ti(t,n)}function za(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,ap(t,n)}}function _g(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?r=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?r=s=e:s=s.next=e}else r=s=e;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function yu(t,e,n,i){var r=t.updateQueue;hi=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,l=r.shared.pending;if(l!==null){r.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?s=u:o.next=u,o=a;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(s!==null){var h=r.baseState;o=0,c=u=a=null,l=s;do{var f=l.lane,d=l.eventTime;if((i&f)===f){c!==null&&(c=c.next={eventTime:d,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,y=l;switch(f=e,d=n,y.tag){case 1:if(p=y.payload,typeof p=="function"){h=p.call(d,h,f);break e}h=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=y.payload,f=typeof p=="function"?p.call(d,h,f):p,f==null)break e;h=be({},h,f);break e;case 2:hi=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=r.effects,f===null?r.effects=[l]:f.push(l))}else d={eventTime:d,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=d,a=h):c=c.next=d,o|=f;if(l=l.next,l===null){if(l=r.shared.pending,l===null)break;f=l,l=f.next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}while(!0);if(c===null&&(a=h),r.baseState=a,r.firstBaseUpdate=u,r.lastBaseUpdate=c,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);xr|=o,t.lanes=o,t.memoizedState=h}}function Tg(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var i=t[e],r=i.callback;if(r!==null){if(i.callback=null,i=n,typeof r!="function")throw Error(H(191,r));r.call(i)}}}var Ml={},In=Hi(Ml),tl=Hi(Ml),nl=Hi(Ml);function ar(t){if(t===Ml)throw Error(H(174));return t}function Cp(t,e){switch(pe(nl,e),pe(tl,t),pe(In,Ml),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:of(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=of(e,t)}we(In),pe(In,e)}function _s(){we(In),we(tl),we(nl)}function L1(t){ar(nl.current);var e=ar(In.current),n=of(e,t.type);e!==n&&(pe(tl,t),pe(In,n))}function Ep(t){tl.current===t&&(we(In),we(tl))}var Se=Hi(0);function vu(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var ah=[];function Ap(){for(var t=0;t<ah.length;t++)ah[t]._workInProgressVersionPrimary=null;ah.length=0}var $a=oi.ReactCurrentDispatcher,uh=oi.ReactCurrentBatchConfig,wr=0,ke=null,Be=null,je=null,wu=!1,Io=!1,il=0,J2=0;function Ge(){throw Error(H(321))}function Np(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!pn(t[n],e[n]))return!1;return!0}function _p(t,e,n,i,r,s){if(wr=s,ke=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,$a.current=t===null||t.memoizedState===null?nE:iE,t=n(i,r),Io){s=0;do{if(Io=!1,il=0,25<=s)throw Error(H(301));s+=1,je=Be=null,e.updateQueue=null,$a.current=rE,t=n(i,r)}while(Io)}if($a.current=xu,e=Be!==null&&Be.next!==null,wr=0,je=Be=ke=null,wu=!1,e)throw Error(H(300));return t}function Tp(){var t=il!==0;return il=0,t}function An(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return je===null?ke.memoizedState=je=t:je=je.next=t,je}function Qt(){if(Be===null){var t=ke.alternate;t=t!==null?t.memoizedState:null}else t=Be.next;var e=je===null?ke.memoizedState:je.next;if(e!==null)je=e,Be=t;else{if(t===null)throw Error(H(310));Be=t,t={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},je===null?ke.memoizedState=je=t:je=je.next=t}return je}function rl(t,e){return typeof e=="function"?e(t):e}function ch(t){var e=Qt(),n=e.queue;if(n===null)throw Error(H(311));n.lastRenderedReducer=t;var i=Be,r=i.baseQueue,s=n.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,n.pending=null}if(r!==null){s=r.next,i=i.baseState;var l=o=null,a=null,u=s;do{var c=u.lane;if((wr&c)===c)a!==null&&(a=a.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:t(i,u.action);else{var h={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};a===null?(l=a=h,o=i):a=a.next=h,ke.lanes|=c,xr|=c}u=u.next}while(u!==null&&u!==s);a===null?o=i:a.next=l,pn(i,e.memoizedState)||(gt=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=a,n.lastRenderedState=i}if(t=n.interleaved,t!==null){r=t;do s=r.lane,ke.lanes|=s,xr|=s,r=r.next;while(r!==t)}else r===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function hh(t){var e=Qt(),n=e.queue;if(n===null)throw Error(H(311));n.lastRenderedReducer=t;var i=n.dispatch,r=n.pending,s=e.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do s=t(s,o.action),o=o.next;while(o!==r);pn(s,e.memoizedState)||(gt=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,i]}function B1(){}function z1(t,e){var n=ke,i=Qt(),r=e(),s=!pn(i.memoizedState,r);if(s&&(i.memoizedState=r,gt=!0),i=i.queue,Mp(j1.bind(null,n,i,t),[t]),i.getSnapshot!==e||s||je!==null&&je.memoizedState.tag&1){if(n.flags|=2048,sl(9,F1.bind(null,n,i,r,e),void 0,null),He===null)throw Error(H(349));wr&30||$1(n,e,r)}return r}function $1(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ke.updateQueue,e===null?(e={lastEffect:null,stores:null},ke.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function F1(t,e,n,i){e.value=n,e.getSnapshot=i,V1(e)&&H1(t)}function j1(t,e,n){return n(function(){V1(e)&&H1(t)})}function V1(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!pn(t,n)}catch{return!0}}function H1(t){var e=ti(t,1);e!==null&&fn(e,t,1,-1)}function Mg(t){var e=An();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:rl,lastRenderedState:t},e.queue=t,t=t.dispatch=tE.bind(null,ke,t),[e.memoizedState,t]}function sl(t,e,n,i){return t={tag:t,create:e,destroy:n,deps:i,next:null},e=ke.updateQueue,e===null?(e={lastEffect:null,stores:null},ke.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(i=n.next,n.next=t,t.next=i,e.lastEffect=t)),t}function W1(){return Qt().memoizedState}function Fa(t,e,n,i){var r=An();ke.flags|=t,r.memoizedState=sl(1|e,n,void 0,i===void 0?null:i)}function hc(t,e,n,i){var r=Qt();i=i===void 0?null:i;var s=void 0;if(Be!==null){var o=Be.memoizedState;if(s=o.destroy,i!==null&&Np(i,o.deps)){r.memoizedState=sl(e,n,s,i);return}}ke.flags|=t,r.memoizedState=sl(1|e,n,s,i)}function Og(t,e){return Fa(8390656,8,t,e)}function Mp(t,e){return hc(2048,8,t,e)}function U1(t,e){return hc(4,2,t,e)}function K1(t,e){return hc(4,4,t,e)}function q1(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Y1(t,e,n){return n=n!=null?n.concat([t]):null,hc(4,4,q1.bind(null,e,t),n)}function Op(){}function Q1(t,e){var n=Qt();e=e===void 0?null:e;var i=n.memoizedState;return i!==null&&e!==null&&Np(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function X1(t,e){var n=Qt();e=e===void 0?null:e;var i=n.memoizedState;return i!==null&&e!==null&&Np(e,i[1])?i[0]:(t=t(),n.memoizedState=[t,e],t)}function G1(t,e,n){return wr&21?(pn(n,e)||(n=n1(),ke.lanes|=n,xr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,gt=!0),t.memoizedState=n)}function Z2(t,e){var n=ce;ce=n!==0&&4>n?n:4,t(!0);var i=uh.transition;uh.transition={};try{t(!1),e()}finally{ce=n,uh.transition=i}}function J1(){return Qt().memoizedState}function eE(t,e,n){var i=Oi(t);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},Z1(t))ew(e,n);else if(n=I1(t,e,n,i),n!==null){var r=lt();fn(n,t,i,r),tw(n,e,i)}}function tE(t,e,n){var i=Oi(t),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(Z1(t))ew(e,r);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(r.hasEagerState=!0,r.eagerState=l,pn(l,o)){var a=e.interleaved;a===null?(r.next=r,kp(e)):(r.next=a.next,a.next=r),e.interleaved=r;return}}catch{}finally{}n=I1(t,e,r,i),n!==null&&(r=lt(),fn(n,t,i,r),tw(n,e,i))}}function Z1(t){var e=t.alternate;return t===ke||e!==null&&e===ke}function ew(t,e){Io=wu=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function tw(t,e,n){if(n&4194240){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,ap(t,n)}}var xu={readContext:Yt,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useInsertionEffect:Ge,useLayoutEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useMutableSource:Ge,useSyncExternalStore:Ge,useId:Ge,unstable_isNewReconciler:!1},nE={readContext:Yt,useCallback:function(t,e){return An().memoizedState=[t,e===void 0?null:e],t},useContext:Yt,useEffect:Og,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Fa(4194308,4,q1.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Fa(4194308,4,t,e)},useInsertionEffect:function(t,e){return Fa(4,2,t,e)},useMemo:function(t,e){var n=An();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=An();return e=n!==void 0?n(e):e,i.memoizedState=i.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},i.queue=t,t=t.dispatch=eE.bind(null,ke,t),[i.memoizedState,t]},useRef:function(t){var e=An();return t={current:t},e.memoizedState=t},useState:Mg,useDebugValue:Op,useDeferredValue:function(t){return An().memoizedState=t},useTransition:function(){var t=Mg(!1),e=t[0];return t=Z2.bind(null,t[1]),An().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var i=ke,r=An();if(xe){if(n===void 0)throw Error(H(407));n=n()}else{if(n=e(),He===null)throw Error(H(349));wr&30||$1(i,e,n)}r.memoizedState=n;var s={value:n,getSnapshot:e};return r.queue=s,Og(j1.bind(null,i,s,t),[t]),i.flags|=2048,sl(9,F1.bind(null,i,s,n,e),void 0,null),n},useId:function(){var t=An(),e=He.identifierPrefix;if(xe){var n=Yn,i=qn;n=(i&~(1<<32-hn(i)-1)).toString(32)+n,e=":"+e+"R"+n,n=il++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=J2++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},iE={readContext:Yt,useCallback:Q1,useContext:Yt,useEffect:Mp,useImperativeHandle:Y1,useInsertionEffect:U1,useLayoutEffect:K1,useMemo:X1,useReducer:ch,useRef:W1,useState:function(){return ch(rl)},useDebugValue:Op,useDeferredValue:function(t){var e=Qt();return G1(e,Be.memoizedState,t)},useTransition:function(){var t=ch(rl)[0],e=Qt().memoizedState;return[t,e]},useMutableSource:B1,useSyncExternalStore:z1,useId:J1,unstable_isNewReconciler:!1},rE={readContext:Yt,useCallback:Q1,useContext:Yt,useEffect:Mp,useImperativeHandle:Y1,useInsertionEffect:U1,useLayoutEffect:K1,useMemo:X1,useReducer:hh,useRef:W1,useState:function(){return hh(rl)},useDebugValue:Op,useDeferredValue:function(t){var e=Qt();return Be===null?e.memoizedState=t:G1(e,Be.memoizedState,t)},useTransition:function(){var t=hh(rl)[0],e=Qt().memoizedState;return[t,e]},useMutableSource:B1,useSyncExternalStore:z1,useId:J1,unstable_isNewReconciler:!1};function nn(t,e){if(t&&t.defaultProps){e=be({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Nf(t,e,n,i){e=t.memoizedState,n=n(i,e),n=n==null?e:be({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var fc={isMounted:function(t){return(t=t._reactInternals)?Tr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var i=lt(),r=Oi(t),s=Gn(i,r);s.payload=e,n!=null&&(s.callback=n),e=Ti(t,s,r),e!==null&&(fn(e,t,r,i),za(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=lt(),r=Oi(t),s=Gn(i,r);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=Ti(t,s,r),e!==null&&(fn(e,t,r,i),za(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=lt(),i=Oi(t),r=Gn(n,i);r.tag=2,e!=null&&(r.callback=e),e=Ti(t,r,i),e!==null&&(fn(e,t,i,n),za(e,t,i))}};function Pg(t,e,n,i,r,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!Go(n,i)||!Go(r,s):!0}function nw(t,e,n){var i=!1,r=Li,s=e.contextType;return typeof s=="object"&&s!==null?s=Yt(s):(r=xt(e)?yr:nt.current,i=e.contextTypes,s=(i=i!=null)?Es(t,r):Li),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=fc,t.stateNode=e,e._reactInternals=t,i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=s),e}function Rg(t,e,n,i){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&fc.enqueueReplaceState(e,e.state,null)}function _f(t,e,n,i){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs={},bp(t);var s=e.contextType;typeof s=="object"&&s!==null?r.context=Yt(s):(s=xt(e)?yr:nt.current,r.context=Es(t,s)),r.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(Nf(t,e,s,n),r.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&fc.enqueueReplaceState(r,r.state,null),yu(t,n,r,i),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308)}function Ts(t,e){try{var n="",i=e;do n+=PC(i),i=i.return;while(i);var r=n}catch(s){r=`
|
|
39
|
+
Error generating stack: `+s.message+`
|
|
40
|
+
`+s.stack}return{value:t,source:e,stack:r,digest:null}}function fh(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Tf(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var sE=typeof WeakMap=="function"?WeakMap:Map;function iw(t,e,n){n=Gn(-1,n),n.tag=3,n.payload={element:null};var i=e.value;return n.callback=function(){ku||(ku=!0,$f=i),Tf(t,e)},n}function rw(t,e,n){n=Gn(-1,n),n.tag=3;var i=t.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;n.payload=function(){return i(r)},n.callback=function(){Tf(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Tf(t,e),typeof i!="function"&&(Mi===null?Mi=new Set([this]):Mi.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function Ig(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new sE;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(n)||(r.add(n),t=wE.bind(null,t,e,n),e.then(t,t))}function Dg(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Lg(t,e,n,i,r){return t.mode&1?(t.flags|=65536,t.lanes=r,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Gn(-1,1),e.tag=2,Ti(n,e,1))),n.lanes|=1),t)}var oE=oi.ReactCurrentOwner,gt=!1;function st(t,e,n,i){e.child=t===null?R1(e,null,n,i):Ns(e,t.child,n,i)}function Bg(t,e,n,i,r){n=n.render;var s=e.ref;return hs(e,r),i=_p(t,e,n,i,s,r),n=Tp(),t!==null&&!gt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,ni(t,e,r)):(xe&&n&&gp(e),e.flags|=1,st(t,e,i,r),e.child)}function zg(t,e,n,i,r){if(t===null){var s=n.type;return typeof s=="function"&&!$p(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,sw(t,e,s,i,r)):(t=Wa(n.type,null,i,e,e.mode,r),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&r)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Go,n(o,i)&&t.ref===e.ref)return ni(t,e,r)}return e.flags|=1,t=Pi(s,i),t.ref=e.ref,t.return=e,e.child=t}function sw(t,e,n,i,r){if(t!==null){var s=t.memoizedProps;if(Go(s,i)&&t.ref===e.ref)if(gt=!1,e.pendingProps=i=s,(t.lanes&r)!==0)t.flags&131072&&(gt=!0);else return e.lanes=t.lanes,ni(t,e,r)}return Mf(t,e,n,i,r)}function ow(t,e,n){var i=e.pendingProps,r=i.children,s=t!==null?t.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},pe(ts,Et),Et|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,pe(ts,Et),Et|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:n,pe(ts,Et),Et|=i}else s!==null?(i=s.baseLanes|n,e.memoizedState=null):i=n,pe(ts,Et),Et|=i;return st(t,e,r,n),e.child}function lw(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Mf(t,e,n,i,r){var s=xt(n)?yr:nt.current;return s=Es(e,s),hs(e,r),n=_p(t,e,n,i,s,r),i=Tp(),t!==null&&!gt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,ni(t,e,r)):(xe&&i&&gp(e),e.flags|=1,st(t,e,n,r),e.child)}function $g(t,e,n,i,r){if(xt(n)){var s=!0;fu(e)}else s=!1;if(hs(e,r),e.stateNode===null)ja(t,e),nw(e,n,i),_f(e,n,i,r),i=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var a=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Yt(u):(u=xt(n)?yr:nt.current,u=Es(e,u));var c=n.getDerivedStateFromProps,h=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==i||a!==u)&&Rg(e,o,i,u),hi=!1;var f=e.memoizedState;o.state=f,yu(e,i,o,r),a=e.memoizedState,l!==i||f!==a||wt.current||hi?(typeof c=="function"&&(Nf(e,n,c,i),a=e.memoizedState),(l=hi||Pg(e,n,l,i,f,a,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=a),o.props=i,o.state=a,o.context=u,i=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,D1(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:nn(e.type,l),o.props=u,h=e.pendingProps,f=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Yt(a):(a=xt(n)?yr:nt.current,a=Es(e,a));var d=n.getDerivedStateFromProps;(c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==a)&&Rg(e,o,i,a),hi=!1,f=e.memoizedState,o.state=f,yu(e,i,o,r);var p=e.memoizedState;l!==h||f!==p||wt.current||hi?(typeof d=="function"&&(Nf(e,n,d,i),p=e.memoizedState),(u=hi||Pg(e,n,u,i,f,p,a)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,p,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,p,a)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=p),o.props=i,o.state=p,o.context=a,i=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),i=!1)}return Of(t,e,n,i,s,r)}function Of(t,e,n,i,r,s){lw(t,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&Cg(e,n,!1),ni(t,e,s);i=e.stateNode,oE.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,t!==null&&o?(e.child=Ns(e,t.child,null,s),e.child=Ns(e,null,l,s)):st(t,e,l,s),e.memoizedState=i.state,r&&Cg(e,n,!0),e.child}function aw(t){var e=t.stateNode;e.pendingContext?bg(t,e.pendingContext,e.pendingContext!==e.context):e.context&&bg(t,e.context,!1),Cp(t,e.containerInfo)}function Fg(t,e,n,i,r){return As(),vp(r),e.flags|=256,st(t,e,n,i),e.child}var Pf={dehydrated:null,treeContext:null,retryLane:0};function Rf(t){return{baseLanes:t,cachePool:null,transitions:null}}function uw(t,e,n){var i=e.pendingProps,r=Se.current,s=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(r&2)!==0),l?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(r|=1),pe(Se,r&1),t===null)return Ef(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,t=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=mc(o,i,0,null),t=dr(t,i,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Rf(n),e.memoizedState=Pf,t):Pp(e,o));if(r=t.memoizedState,r!==null&&(l=r.dehydrated,l!==null))return lE(t,e,o,i,l,r,n);if(s){s=i.fallback,o=e.mode,r=t.child,l=r.sibling;var a={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=a,e.deletions=null):(i=Pi(r,a),i.subtreeFlags=r.subtreeFlags&14680064),l!==null?s=Pi(l,s):(s=dr(s,o,n,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=t.child.memoizedState,o=o===null?Rf(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=Pf,i}return s=t.child,t=s.sibling,i=Pi(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=n),i.return=e,i.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=i,e.memoizedState=null,i}function Pp(t,e){return e=mc({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ea(t,e,n,i){return i!==null&&vp(i),Ns(e,t.child,null,n),t=Pp(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function lE(t,e,n,i,r,s,o){if(n)return e.flags&256?(e.flags&=-257,i=fh(Error(H(422))),ea(t,e,o,i)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=mc({mode:"visible",children:i.children},r,0,null),s=dr(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Ns(e,t.child,null,o),e.child.memoizedState=Rf(o),e.memoizedState=Pf,s);if(!(e.mode&1))return ea(t,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var l=i.dgst;return i=l,s=Error(H(419)),i=fh(s,i,void 0),ea(t,e,o,i)}if(l=(o&t.childLanes)!==0,gt||l){if(i=He,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,ti(t,r),fn(i,t,r,-1))}return zp(),i=fh(Error(H(421))),ea(t,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=t.child,e=xE.bind(null,t),r._reactRetry=e,null):(t=s.treeContext,_t=_i(r.nextSibling),Mt=e,xe=!0,sn=null,t!==null&&(Bt[zt++]=qn,Bt[zt++]=Yn,Bt[zt++]=vr,qn=t.id,Yn=t.overflow,vr=e),e=Pp(e,i.children),e.flags|=4096,e)}function jg(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),Af(t.return,e,n)}function dh(t,e,n,i,r){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r)}function cw(t,e,n){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(st(t,e,i.children,n),i=Se.current,i&2)i=i&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&jg(t,n,e);else if(t.tag===19)jg(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}i&=1}if(pe(Se,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(n=e.child,r=null;n!==null;)t=n.alternate,t!==null&&vu(t)===null&&(r=n),n=n.sibling;n=r,n===null?(r=e.child,e.child=null):(r=n.sibling,n.sibling=null),dh(e,!1,r,n,s);break;case"backwards":for(n=null,r=e.child,e.child=null;r!==null;){if(t=r.alternate,t!==null&&vu(t)===null){e.child=r;break}t=r.sibling,r.sibling=n,n=r,r=t}dh(e,!0,n,null,s);break;case"together":dh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ja(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function ni(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),xr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(H(153));if(e.child!==null){for(t=e.child,n=Pi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Pi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function aE(t,e,n){switch(e.tag){case 3:aw(e),As();break;case 5:L1(e);break;case 1:xt(e.type)&&fu(e);break;case 4:Cp(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;pe(mu,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(pe(Se,Se.current&1),e.flags|=128,null):n&e.child.childLanes?uw(t,e,n):(pe(Se,Se.current&1),t=ni(t,e,n),t!==null?t.sibling:null);pe(Se,Se.current&1);break;case 19:if(i=(n&e.childLanes)!==0,t.flags&128){if(i)return cw(t,e,n);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),pe(Se,Se.current),i)break;return null;case 22:case 23:return e.lanes=0,ow(t,e,n)}return ni(t,e,n)}var hw,If,fw,dw;hw=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};If=function(){};fw=function(t,e,n,i){var r=t.memoizedProps;if(r!==i){t=e.stateNode,ar(In.current);var s=null;switch(n){case"input":r=tf(t,r),i=tf(t,i),s=[];break;case"select":r=be({},r,{value:void 0}),i=be({},i,{value:void 0}),s=[];break;case"textarea":r=sf(t,r),i=sf(t,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(t.onclick=cu)}lf(n,i);var o;n=null;for(u in r)if(!i.hasOwnProperty(u)&&r.hasOwnProperty(u)&&r[u]!=null)if(u==="style"){var l=r[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Wo.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in i){var a=i[u];if(l=r!=null?r[u]:void 0,i.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(s||(s=[]),s.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Wo.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&ve("scroll",t),s||l===a||(s=[])):(s=s||[]).push(u,a))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};dw=function(t,e,n,i){n!==i&&(e.flags|=4)};function ro(t,e){if(!xe)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:i.sibling=null}}function Je(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,i=0;if(e)for(var r=t.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=t,r=r.sibling;else for(r=t.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=t,r=r.sibling;return t.subtreeFlags|=i,t.childLanes=n,e}function uE(t,e,n){var i=e.pendingProps;switch(yp(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(e),null;case 1:return xt(e.type)&&hu(),Je(e),null;case 3:return i=e.stateNode,_s(),we(wt),we(nt),Ap(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(Jl(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,sn!==null&&(Vf(sn),sn=null))),If(t,e),Je(e),null;case 5:Ep(e);var r=ar(nl.current);if(n=e.type,t!==null&&e.stateNode!=null)fw(t,e,n,i,r),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(H(166));return Je(e),null}if(t=ar(In.current),Jl(e)){i=e.stateNode,n=e.type;var s=e.memoizedProps;switch(i[_n]=e,i[el]=s,t=(e.mode&1)!==0,n){case"dialog":ve("cancel",i),ve("close",i);break;case"iframe":case"object":case"embed":ve("load",i);break;case"video":case"audio":for(r=0;r<So.length;r++)ve(So[r],i);break;case"source":ve("error",i);break;case"img":case"image":case"link":ve("error",i),ve("load",i);break;case"details":ve("toggle",i);break;case"input":Xm(i,s),ve("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},ve("invalid",i);break;case"textarea":Jm(i,s),ve("invalid",i)}lf(n,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?i.textContent!==l&&(s.suppressHydrationWarning!==!0&&Gl(i.textContent,l,t),r=["children",l]):typeof l=="number"&&i.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Gl(i.textContent,l,t),r=["children",""+l]):Wo.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ve("scroll",i)}switch(n){case"input":Hl(i),Gm(i,s,!0);break;case"textarea":Hl(i),Zm(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=cu)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=jv(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof i.is=="string"?t=o.createElement(n,{is:i.is}):(t=o.createElement(n),n==="select"&&(o=t,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):t=o.createElementNS(t,n),t[_n]=e,t[el]=i,hw(t,e,!1,!1),e.stateNode=t;e:{switch(o=af(n,i),n){case"dialog":ve("cancel",t),ve("close",t),r=i;break;case"iframe":case"object":case"embed":ve("load",t),r=i;break;case"video":case"audio":for(r=0;r<So.length;r++)ve(So[r],t);r=i;break;case"source":ve("error",t),r=i;break;case"img":case"image":case"link":ve("error",t),ve("load",t),r=i;break;case"details":ve("toggle",t),r=i;break;case"input":Xm(t,i),r=tf(t,i),ve("invalid",t);break;case"option":r=i;break;case"select":t._wrapperState={wasMultiple:!!i.multiple},r=be({},i,{value:void 0}),ve("invalid",t);break;case"textarea":Jm(t,i),r=sf(t,i),ve("invalid",t);break;default:r=i}lf(n,r),l=r;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?Wv(t,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Vv(t,a)):s==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Uo(t,a):typeof a=="number"&&Uo(t,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Wo.hasOwnProperty(s)?a!=null&&s==="onScroll"&&ve("scroll",t):a!=null&&np(t,s,a,o))}switch(n){case"input":Hl(t),Gm(t,i,!1);break;case"textarea":Hl(t),Zm(t);break;case"option":i.value!=null&&t.setAttribute("value",""+Di(i.value));break;case"select":t.multiple=!!i.multiple,s=i.value,s!=null?ls(t,!!i.multiple,s,!1):i.defaultValue!=null&&ls(t,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(t.onclick=cu)}switch(n){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Je(e),null;case 6:if(t&&e.stateNode!=null)dw(t,e,t.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(H(166));if(n=ar(nl.current),ar(In.current),Jl(e)){if(i=e.stateNode,n=e.memoizedProps,i[_n]=e,(s=i.nodeValue!==n)&&(t=Mt,t!==null))switch(t.tag){case 3:Gl(i.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Gl(i.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[_n]=e,e.stateNode=i}return Je(e),null;case 13:if(we(Se),i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(xe&&_t!==null&&e.mode&1&&!(e.flags&128))O1(),As(),e.flags|=98560,s=!1;else if(s=Jl(e),i!==null&&i.dehydrated!==null){if(t===null){if(!s)throw Error(H(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(H(317));s[_n]=e}else As(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Je(e),s=!1}else sn!==null&&(Vf(sn),sn=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(i=i!==null,i!==(t!==null&&t.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(t===null||Se.current&1?$e===0&&($e=3):zp())),e.updateQueue!==null&&(e.flags|=4),Je(e),null);case 4:return _s(),If(t,e),t===null&&Jo(e.stateNode.containerInfo),Je(e),null;case 10:return Sp(e.type._context),Je(e),null;case 17:return xt(e.type)&&hu(),Je(e),null;case 19:if(we(Se),s=e.memoizedState,s===null)return Je(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)ro(s,!1);else{if($e!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=vu(t),o!==null){for(e.flags|=128,ro(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=n,n=e.child;n!==null;)s=n,t=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,t=o.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return pe(Se,Se.current&1|2),e.child}t=t.sibling}s.tail!==null&&Re()>Ms&&(e.flags|=128,i=!0,ro(s,!1),e.lanes=4194304)}else{if(!i)if(t=vu(o),t!==null){if(e.flags|=128,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),ro(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xe)return Je(e),null}else 2*Re()-s.renderingStartTime>Ms&&n!==1073741824&&(e.flags|=128,i=!0,ro(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Re(),e.sibling=null,n=Se.current,pe(Se,i?n&1|2:n&1),e):(Je(e),null);case 22:case 23:return Bp(),i=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Et&1073741824&&(Je(e),e.subtreeFlags&6&&(e.flags|=8192)):Je(e),null;case 24:return null;case 25:return null}throw Error(H(156,e.tag))}function cE(t,e){switch(yp(e),e.tag){case 1:return xt(e.type)&&hu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return _s(),we(wt),we(nt),Ap(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Ep(e),null;case 13:if(we(Se),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(H(340));As()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return we(Se),null;case 4:return _s(),null;case 10:return Sp(e.type._context),null;case 22:case 23:return Bp(),null;case 24:return null;default:return null}}var ta=!1,et=!1,hE=typeof WeakSet=="function"?WeakSet:Set,Y=null;function es(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(i){Ae(t,e,i)}else n.current=null}function Df(t,e,n){try{n()}catch(i){Ae(t,e,i)}}var Vg=!1;function fE(t,e){if(vf=lu,t=v1(),mp(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,h=t,f=null;t:for(;;){for(var d;h!==n||r!==0&&h.nodeType!==3||(l=o+r),h!==s||i!==0&&h.nodeType!==3||(a=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(d=h.firstChild)!==null;)f=h,h=d;for(;;){if(h===t)break t;if(f===n&&++u===r&&(l=o),f===s&&++c===i&&(a=o),(d=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=d}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(wf={focusedElem:t,selectionRange:n},lu=!1,Y=e;Y!==null;)if(e=Y,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Y=t;else for(;Y!==null;){e=Y;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,x=p.memoizedState,m=e.stateNode,g=m.getSnapshotBeforeUpdate(e.elementType===e.type?y:nn(e.type,y),x);m.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(H(163))}}catch(w){Ae(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,Y=t;break}Y=e.return}return p=Vg,Vg=!1,p}function Do(t,e,n){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,s!==void 0&&Df(e,n,s)}r=r.next}while(r!==i)}}function dc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var i=n.create;n.destroy=i()}n=n.next}while(n!==e)}}function Lf(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function pw(t){var e=t.alternate;e!==null&&(t.alternate=null,pw(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[_n],delete e[el],delete e[kf],delete e[Y2],delete e[Q2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function mw(t){return t.tag===5||t.tag===3||t.tag===4}function Hg(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||mw(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Bf(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=cu));else if(i!==4&&(t=t.child,t!==null))for(Bf(t,e,n),t=t.sibling;t!==null;)Bf(t,e,n),t=t.sibling}function zf(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(t=t.child,t!==null))for(zf(t,e,n),t=t.sibling;t!==null;)zf(t,e,n),t=t.sibling}var Ue=null,rn=!1;function ai(t,e,n){for(n=n.child;n!==null;)gw(t,e,n),n=n.sibling}function gw(t,e,n){if(Rn&&typeof Rn.onCommitFiberUnmount=="function")try{Rn.onCommitFiberUnmount(sc,n)}catch{}switch(n.tag){case 5:et||es(n,e);case 6:var i=Ue,r=rn;Ue=null,ai(t,e,n),Ue=i,rn=r,Ue!==null&&(rn?(t=Ue,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ue.removeChild(n.stateNode));break;case 18:Ue!==null&&(rn?(t=Ue,n=n.stateNode,t.nodeType===8?oh(t.parentNode,n):t.nodeType===1&&oh(t,n),Qo(t)):oh(Ue,n.stateNode));break;case 4:i=Ue,r=rn,Ue=n.stateNode.containerInfo,rn=!0,ai(t,e,n),Ue=i,rn=r;break;case 0:case 11:case 14:case 15:if(!et&&(i=n.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Df(n,e,o),r=r.next}while(r!==i)}ai(t,e,n);break;case 1:if(!et&&(es(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(l){Ae(n,e,l)}ai(t,e,n);break;case 21:ai(t,e,n);break;case 22:n.mode&1?(et=(i=et)||n.memoizedState!==null,ai(t,e,n),et=i):ai(t,e,n);break;default:ai(t,e,n)}}function Wg(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new hE),e.forEach(function(i){var r=SE.bind(null,t,i);n.has(i)||(n.add(i),i.then(r,r))})}}function tn(t,e){var n=e.deletions;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i];try{var s=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ue=l.stateNode,rn=!1;break e;case 3:Ue=l.stateNode.containerInfo,rn=!0;break e;case 4:Ue=l.stateNode.containerInfo,rn=!0;break e}l=l.return}if(Ue===null)throw Error(H(160));gw(s,o,r),Ue=null,rn=!1;var a=r.alternate;a!==null&&(a.return=null),r.return=null}catch(u){Ae(r,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)yw(e,t),e=e.sibling}function yw(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(tn(e,t),Sn(t),i&4){try{Do(3,t,t.return),dc(3,t)}catch(y){Ae(t,t.return,y)}try{Do(5,t,t.return)}catch(y){Ae(t,t.return,y)}}break;case 1:tn(e,t),Sn(t),i&512&&n!==null&&es(n,n.return);break;case 5:if(tn(e,t),Sn(t),i&512&&n!==null&&es(n,n.return),t.flags&32){var r=t.stateNode;try{Uo(r,"")}catch(y){Ae(t,t.return,y)}}if(i&4&&(r=t.stateNode,r!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,l=t.type,a=t.updateQueue;if(t.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&$v(r,s),af(l,o);var u=af(l,s);for(o=0;o<a.length;o+=2){var c=a[o],h=a[o+1];c==="style"?Wv(r,h):c==="dangerouslySetInnerHTML"?Vv(r,h):c==="children"?Uo(r,h):np(r,c,h,u)}switch(l){case"input":nf(r,s);break;case"textarea":Fv(r,s);break;case"select":var f=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var d=s.value;d!=null?ls(r,!!s.multiple,d,!1):f!==!!s.multiple&&(s.defaultValue!=null?ls(r,!!s.multiple,s.defaultValue,!0):ls(r,!!s.multiple,s.multiple?[]:"",!1))}r[el]=s}catch(y){Ae(t,t.return,y)}}break;case 6:if(tn(e,t),Sn(t),i&4){if(t.stateNode===null)throw Error(H(162));r=t.stateNode,s=t.memoizedProps;try{r.nodeValue=s}catch(y){Ae(t,t.return,y)}}break;case 3:if(tn(e,t),Sn(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Qo(e.containerInfo)}catch(y){Ae(t,t.return,y)}break;case 4:tn(e,t),Sn(t);break;case 13:tn(e,t),Sn(t),r=t.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(Dp=Re())),i&4&&Wg(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(et=(u=et)||c,tn(e,t),et=u):tn(e,t),Sn(t),i&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!c&&t.mode&1)for(Y=t,c=t.child;c!==null;){for(h=Y=c;Y!==null;){switch(f=Y,d=f.child,f.tag){case 0:case 11:case 14:case 15:Do(4,f,f.return);break;case 1:es(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){i=f,n=f.return;try{e=i,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(y){Ae(i,n,y)}}break;case 5:es(f,f.return);break;case 22:if(f.memoizedState!==null){Kg(h);continue}}d!==null?(d.return=f,Y=d):Kg(h)}c=c.sibling}e:for(c=null,h=t;;){if(h.tag===5){if(c===null){c=h;try{r=h.stateNode,u?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=h.stateNode,a=h.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=Hv("display",o))}catch(y){Ae(t,t.return,y)}}}else if(h.tag===6){if(c===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(y){Ae(t,t.return,y)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;c===h&&(c=null),h=h.return}c===h&&(c=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:tn(e,t),Sn(t),i&4&&Wg(t);break;case 21:break;default:tn(e,t),Sn(t)}}function Sn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(mw(n)){var i=n;break e}n=n.return}throw Error(H(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(Uo(r,""),i.flags&=-33);var s=Hg(t);zf(t,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,l=Hg(t);Bf(t,l,o);break;default:throw Error(H(161))}}catch(a){Ae(t,t.return,a)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function dE(t,e,n){Y=t,vw(t)}function vw(t,e,n){for(var i=(t.mode&1)!==0;Y!==null;){var r=Y,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||ta;if(!o){var l=r.alternate,a=l!==null&&l.memoizedState!==null||et;l=ta;var u=et;if(ta=o,(et=a)&&!u)for(Y=r;Y!==null;)o=Y,a=o.child,o.tag===22&&o.memoizedState!==null?qg(r):a!==null?(a.return=o,Y=a):qg(r);for(;s!==null;)Y=s,vw(s),s=s.sibling;Y=r,ta=l,et=u}Ug(t)}else r.subtreeFlags&8772&&s!==null?(s.return=r,Y=s):Ug(t)}}function Ug(t){for(;Y!==null;){var e=Y;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:et||dc(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!et)if(n===null)i.componentDidMount();else{var r=e.elementType===e.type?n.memoizedProps:nn(e.type,n.memoizedProps);i.componentDidUpdate(r,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&Tg(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}Tg(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var a=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var h=c.dehydrated;h!==null&&Qo(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(H(163))}et||e.flags&512&&Lf(e)}catch(f){Ae(e,e.return,f)}}if(e===t){Y=null;break}if(n=e.sibling,n!==null){n.return=e.return,Y=n;break}Y=e.return}}function Kg(t){for(;Y!==null;){var e=Y;if(e===t){Y=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Y=n;break}Y=e.return}}function qg(t){for(;Y!==null;){var e=Y;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{dc(4,e)}catch(a){Ae(e,n,a)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(a){Ae(e,r,a)}}var s=e.return;try{Lf(e)}catch(a){Ae(e,s,a)}break;case 5:var o=e.return;try{Lf(e)}catch(a){Ae(e,o,a)}}}catch(a){Ae(e,e.return,a)}if(e===t){Y=null;break}var l=e.sibling;if(l!==null){l.return=e.return,Y=l;break}Y=e.return}}var pE=Math.ceil,Su=oi.ReactCurrentDispatcher,Rp=oi.ReactCurrentOwner,Ut=oi.ReactCurrentBatchConfig,le=0,He=null,De=null,Ye=0,Et=0,ts=Hi(0),$e=0,ol=null,xr=0,pc=0,Ip=0,Lo=null,dt=null,Dp=0,Ms=1/0,Hn=null,ku=!1,$f=null,Mi=null,na=!1,ki=null,bu=0,Bo=0,Ff=null,Va=-1,Ha=0;function lt(){return le&6?Re():Va!==-1?Va:Va=Re()}function Oi(t){return t.mode&1?le&2&&Ye!==0?Ye&-Ye:G2.transition!==null?(Ha===0&&(Ha=n1()),Ha):(t=ce,t!==0||(t=window.event,t=t===void 0?16:u1(t.type)),t):1}function fn(t,e,n,i){if(50<Bo)throw Bo=0,Ff=null,Error(H(185));Nl(t,n,i),(!(le&2)||t!==He)&&(t===He&&(!(le&2)&&(pc|=n),$e===4&&yi(t,Ye)),St(t,i),n===1&&le===0&&!(e.mode&1)&&(Ms=Re()+500,cc&&Wi()))}function St(t,e){var n=t.callbackNode;GC(t,e);var i=ou(t,t===He?Ye:0);if(i===0)n!==null&&ng(n),t.callbackNode=null,t.callbackPriority=0;else if(e=i&-i,t.callbackPriority!==e){if(n!=null&&ng(n),e===1)t.tag===0?X2(Yg.bind(null,t)):_1(Yg.bind(null,t)),K2(function(){!(le&6)&&Wi()}),n=null;else{switch(i1(i)){case 1:n=lp;break;case 4:n=e1;break;case 16:n=su;break;case 536870912:n=t1;break;default:n=su}n=Aw(n,ww.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function ww(t,e){if(Va=-1,Ha=0,le&6)throw Error(H(327));var n=t.callbackNode;if(fs()&&t.callbackNode!==n)return null;var i=ou(t,t===He?Ye:0);if(i===0)return null;if(i&30||i&t.expiredLanes||e)e=Cu(t,i);else{e=i;var r=le;le|=2;var s=Sw();(He!==t||Ye!==e)&&(Hn=null,Ms=Re()+500,fr(t,e));do try{yE();break}catch(l){xw(t,l)}while(!0);xp(),Su.current=s,le=r,De!==null?e=0:(He=null,Ye=0,e=$e)}if(e!==0){if(e===2&&(r=df(t),r!==0&&(i=r,e=jf(t,r))),e===1)throw n=ol,fr(t,0),yi(t,i),St(t,Re()),n;if(e===6)yi(t,i);else{if(r=t.current.alternate,!(i&30)&&!mE(r)&&(e=Cu(t,i),e===2&&(s=df(t),s!==0&&(i=s,e=jf(t,s))),e===1))throw n=ol,fr(t,0),yi(t,i),St(t,Re()),n;switch(t.finishedWork=r,t.finishedLanes=i,e){case 0:case 1:throw Error(H(345));case 2:tr(t,dt,Hn);break;case 3:if(yi(t,i),(i&130023424)===i&&(e=Dp+500-Re(),10<e)){if(ou(t,0)!==0)break;if(r=t.suspendedLanes,(r&i)!==i){lt(),t.pingedLanes|=t.suspendedLanes&r;break}t.timeoutHandle=Sf(tr.bind(null,t,dt,Hn),e);break}tr(t,dt,Hn);break;case 4:if(yi(t,i),(i&4194240)===i)break;for(e=t.eventTimes,r=-1;0<i;){var o=31-hn(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=Re()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*pE(i/1960))-i,10<i){t.timeoutHandle=Sf(tr.bind(null,t,dt,Hn),i);break}tr(t,dt,Hn);break;case 5:tr(t,dt,Hn);break;default:throw Error(H(329))}}}return St(t,Re()),t.callbackNode===n?ww.bind(null,t):null}function jf(t,e){var n=Lo;return t.current.memoizedState.isDehydrated&&(fr(t,e).flags|=256),t=Cu(t,e),t!==2&&(e=dt,dt=n,e!==null&&Vf(e)),t}function Vf(t){dt===null?dt=t:dt.push.apply(dt,t)}function mE(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var i=0;i<n.length;i++){var r=n[i],s=r.getSnapshot;r=r.value;try{if(!pn(s(),r))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function yi(t,e){for(e&=~Ip,e&=~pc,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-hn(e),i=1<<n;t[n]=-1,e&=~i}}function Yg(t){if(le&6)throw Error(H(327));fs();var e=ou(t,0);if(!(e&1))return St(t,Re()),null;var n=Cu(t,e);if(t.tag!==0&&n===2){var i=df(t);i!==0&&(e=i,n=jf(t,i))}if(n===1)throw n=ol,fr(t,0),yi(t,e),St(t,Re()),n;if(n===6)throw Error(H(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,tr(t,dt,Hn),St(t,Re()),null}function Lp(t,e){var n=le;le|=1;try{return t(e)}finally{le=n,le===0&&(Ms=Re()+500,cc&&Wi())}}function Sr(t){ki!==null&&ki.tag===0&&!(le&6)&&fs();var e=le;le|=1;var n=Ut.transition,i=ce;try{if(Ut.transition=null,ce=1,t)return t()}finally{ce=i,Ut.transition=n,le=e,!(le&6)&&Wi()}}function Bp(){Et=ts.current,we(ts)}function fr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,U2(n)),De!==null)for(n=De.return;n!==null;){var i=n;switch(yp(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&hu();break;case 3:_s(),we(wt),we(nt),Ap();break;case 5:Ep(i);break;case 4:_s();break;case 13:we(Se);break;case 19:we(Se);break;case 10:Sp(i.type._context);break;case 22:case 23:Bp()}n=n.return}if(He=t,De=t=Pi(t.current,null),Ye=Et=e,$e=0,ol=null,Ip=pc=xr=0,dt=Lo=null,lr!==null){for(e=0;e<lr.length;e++)if(n=lr[e],i=n.interleaved,i!==null){n.interleaved=null;var r=i.next,s=n.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}n.pending=i}lr=null}return t}function xw(t,e){do{var n=De;try{if(xp(),$a.current=xu,wu){for(var i=ke.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}wu=!1}if(wr=0,je=Be=ke=null,Io=!1,il=0,Rp.current=null,n===null||n.return===null){$e=1,ol=e,De=null;break}e:{var s=t,o=n.return,l=n,a=e;if(e=Ye,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=a,c=l,h=c.tag;if(!(c.mode&1)&&(h===0||h===11||h===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var d=Dg(o);if(d!==null){d.flags&=-257,Lg(d,o,l,s,e),d.mode&1&&Ig(s,u,e),e=d,a=u;var p=e.updateQueue;if(p===null){var y=new Set;y.add(a),e.updateQueue=y}else p.add(a);break e}else{if(!(e&1)){Ig(s,u,e),zp();break e}a=Error(H(426))}}else if(xe&&l.mode&1){var x=Dg(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Lg(x,o,l,s,e),vp(Ts(a,l));break e}}s=a=Ts(a,l),$e!==4&&($e=2),Lo===null?Lo=[s]:Lo.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var m=iw(s,a,e);_g(s,m);break e;case 1:l=a;var g=s.type,v=s.stateNode;if(!(s.flags&128)&&(typeof g.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Mi===null||!Mi.has(v)))){s.flags|=65536,e&=-e,s.lanes|=e;var w=rw(s,l,e);_g(s,w);break e}}s=s.return}while(s!==null)}bw(n)}catch(k){e=k,De===n&&n!==null&&(De=n=n.return);continue}break}while(!0)}function Sw(){var t=Su.current;return Su.current=xu,t===null?xu:t}function zp(){($e===0||$e===3||$e===2)&&($e=4),He===null||!(xr&268435455)&&!(pc&268435455)||yi(He,Ye)}function Cu(t,e){var n=le;le|=2;var i=Sw();(He!==t||Ye!==e)&&(Hn=null,fr(t,e));do try{gE();break}catch(r){xw(t,r)}while(!0);if(xp(),le=n,Su.current=i,De!==null)throw Error(H(261));return He=null,Ye=0,$e}function gE(){for(;De!==null;)kw(De)}function yE(){for(;De!==null&&!VC();)kw(De)}function kw(t){var e=Ew(t.alternate,t,Et);t.memoizedProps=t.pendingProps,e===null?bw(t):De=e,Rp.current=null}function bw(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=cE(n,e),n!==null){n.flags&=32767,De=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{$e=6,De=null;return}}else if(n=uE(n,e,Et),n!==null){De=n;return}if(e=e.sibling,e!==null){De=e;return}De=e=t}while(e!==null);$e===0&&($e=5)}function tr(t,e,n){var i=ce,r=Ut.transition;try{Ut.transition=null,ce=1,vE(t,e,n,i)}finally{Ut.transition=r,ce=i}return null}function vE(t,e,n,i){do fs();while(ki!==null);if(le&6)throw Error(H(327));n=t.finishedWork;var r=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(H(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(JC(t,s),t===He&&(De=He=null,Ye=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||na||(na=!0,Aw(su,function(){return fs(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Ut.transition,Ut.transition=null;var o=ce;ce=1;var l=le;le|=4,Rp.current=null,fE(t,n),yw(n,t),z2(wf),lu=!!vf,wf=vf=null,t.current=n,dE(n),HC(),le=l,ce=o,Ut.transition=s}else t.current=n;if(na&&(na=!1,ki=t,bu=r),s=t.pendingLanes,s===0&&(Mi=null),KC(n.stateNode),St(t,Re()),e!==null)for(i=t.onRecoverableError,n=0;n<e.length;n++)r=e[n],i(r.value,{componentStack:r.stack,digest:r.digest});if(ku)throw ku=!1,t=$f,$f=null,t;return bu&1&&t.tag!==0&&fs(),s=t.pendingLanes,s&1?t===Ff?Bo++:(Bo=0,Ff=t):Bo=0,Wi(),null}function fs(){if(ki!==null){var t=i1(bu),e=Ut.transition,n=ce;try{if(Ut.transition=null,ce=16>t?16:t,ki===null)var i=!1;else{if(t=ki,ki=null,bu=0,le&6)throw Error(H(331));var r=le;for(le|=4,Y=t.current;Y!==null;){var s=Y,o=s.child;if(Y.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var u=l[a];for(Y=u;Y!==null;){var c=Y;switch(c.tag){case 0:case 11:case 15:Do(8,c,s)}var h=c.child;if(h!==null)h.return=c,Y=h;else for(;Y!==null;){c=Y;var f=c.sibling,d=c.return;if(pw(c),c===u){Y=null;break}if(f!==null){f.return=d,Y=f;break}Y=d}}}var p=s.alternate;if(p!==null){var y=p.child;if(y!==null){p.child=null;do{var x=y.sibling;y.sibling=null,y=x}while(y!==null)}}Y=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Y=o;else e:for(;Y!==null;){if(s=Y,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Do(9,s,s.return)}var m=s.sibling;if(m!==null){m.return=s.return,Y=m;break e}Y=s.return}}var g=t.current;for(Y=g;Y!==null;){o=Y;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,Y=v;else e:for(o=g;Y!==null;){if(l=Y,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:dc(9,l)}}catch(k){Ae(l,l.return,k)}if(l===o){Y=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,Y=w;break e}Y=l.return}}if(le=r,Wi(),Rn&&typeof Rn.onPostCommitFiberRoot=="function")try{Rn.onPostCommitFiberRoot(sc,t)}catch{}i=!0}return i}finally{ce=n,Ut.transition=e}}return!1}function Qg(t,e,n){e=Ts(n,e),e=iw(t,e,1),t=Ti(t,e,1),e=lt(),t!==null&&(Nl(t,1,e),St(t,e))}function Ae(t,e,n){if(t.tag===3)Qg(t,t,n);else for(;e!==null;){if(e.tag===3){Qg(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Mi===null||!Mi.has(i))){t=Ts(n,t),t=rw(e,t,1),e=Ti(e,t,1),t=lt(),e!==null&&(Nl(e,1,t),St(e,t));break}}e=e.return}}function wE(t,e,n){var i=t.pingCache;i!==null&&i.delete(e),e=lt(),t.pingedLanes|=t.suspendedLanes&n,He===t&&(Ye&n)===n&&($e===4||$e===3&&(Ye&130023424)===Ye&&500>Re()-Dp?fr(t,0):Ip|=n),St(t,e)}function Cw(t,e){e===0&&(t.mode&1?(e=Kl,Kl<<=1,!(Kl&130023424)&&(Kl=4194304)):e=1);var n=lt();t=ti(t,e),t!==null&&(Nl(t,e,n),St(t,n))}function xE(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Cw(t,n)}function SE(t,e){var n=0;switch(t.tag){case 13:var i=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=t.stateNode;break;default:throw Error(H(314))}i!==null&&i.delete(e),Cw(t,n)}var Ew;Ew=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||wt.current)gt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return gt=!1,aE(t,e,n);gt=!!(t.flags&131072)}else gt=!1,xe&&e.flags&1048576&&T1(e,pu,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;ja(t,e),t=e.pendingProps;var r=Es(e,nt.current);hs(e,n),r=_p(null,e,i,t,r,n);var s=Tp();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,xt(i)?(s=!0,fu(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,bp(e),r.updater=fc,e.stateNode=r,r._reactInternals=e,_f(e,i,t,n),e=Of(null,e,i,!0,s,n)):(e.tag=0,xe&&s&&gp(e),st(null,e,r,n),e=e.child),e;case 16:i=e.elementType;e:{switch(ja(t,e),t=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=bE(i),t=nn(i,t),r){case 0:e=Mf(null,e,i,t,n);break e;case 1:e=$g(null,e,i,t,n);break e;case 11:e=Bg(null,e,i,t,n);break e;case 14:e=zg(null,e,i,nn(i.type,t),n);break e}throw Error(H(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:nn(i,r),Mf(t,e,i,r,n);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:nn(i,r),$g(t,e,i,r,n);case 3:e:{if(aw(e),t===null)throw Error(H(387));i=e.pendingProps,s=e.memoizedState,r=s.element,D1(t,e),yu(e,i,null,n);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Ts(Error(H(423)),e),e=Fg(t,e,i,n,r);break e}else if(i!==r){r=Ts(Error(H(424)),e),e=Fg(t,e,i,n,r);break e}else for(_t=_i(e.stateNode.containerInfo.firstChild),Mt=e,xe=!0,sn=null,n=R1(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(As(),i===r){e=ni(t,e,n);break e}st(t,e,i,n)}e=e.child}return e;case 5:return L1(e),t===null&&Ef(e),i=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,o=r.children,xf(i,r)?o=null:s!==null&&xf(i,s)&&(e.flags|=32),lw(t,e),st(t,e,o,n),e.child;case 6:return t===null&&Ef(e),null;case 13:return uw(t,e,n);case 4:return Cp(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Ns(e,null,i,n):st(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:nn(i,r),Bg(t,e,i,r,n);case 7:return st(t,e,e.pendingProps,n),e.child;case 8:return st(t,e,e.pendingProps.children,n),e.child;case 12:return st(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,pe(mu,i._currentValue),i._currentValue=o,s!==null)if(pn(s.value,o)){if(s.children===r.children&&!wt.current){e=ni(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===i){if(s.tag===1){a=Gn(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Af(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(H(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Af(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}st(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,hs(e,n),r=Yt(r),i=i(r),e.flags|=1,st(t,e,i,n),e.child;case 14:return i=e.type,r=nn(i,e.pendingProps),r=nn(i.type,r),zg(t,e,i,r,n);case 15:return sw(t,e,e.type,e.pendingProps,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:nn(i,r),ja(t,e),e.tag=1,xt(i)?(t=!0,fu(e)):t=!1,hs(e,n),nw(e,i,r),_f(e,i,r,n),Of(null,e,i,!0,t,n);case 19:return cw(t,e,n);case 22:return ow(t,e,n)}throw Error(H(156,e.tag))};function Aw(t,e){return Zv(t,e)}function kE(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ft(t,e,n,i){return new kE(t,e,n,i)}function $p(t){return t=t.prototype,!(!t||!t.isReactComponent)}function bE(t){if(typeof t=="function")return $p(t)?1:0;if(t!=null){if(t=t.$$typeof,t===rp)return 11;if(t===sp)return 14}return 2}function Pi(t,e){var n=t.alternate;return n===null?(n=Ft(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wa(t,e,n,i,r,s){var o=2;if(i=t,typeof t=="function")$p(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Ur:return dr(n.children,r,s,e);case ip:o=8,r|=8;break;case Gh:return t=Ft(12,n,e,r|2),t.elementType=Gh,t.lanes=s,t;case Jh:return t=Ft(13,n,e,r),t.elementType=Jh,t.lanes=s,t;case Zh:return t=Ft(19,n,e,r),t.elementType=Zh,t.lanes=s,t;case Lv:return mc(n,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Iv:o=10;break e;case Dv:o=9;break e;case rp:o=11;break e;case sp:o=14;break e;case ci:o=16,i=null;break e}throw Error(H(130,t==null?t:typeof t,""))}return e=Ft(o,n,e,r),e.elementType=t,e.type=i,e.lanes=s,e}function dr(t,e,n,i){return t=Ft(7,t,i,e),t.lanes=n,t}function mc(t,e,n,i){return t=Ft(22,t,i,e),t.elementType=Lv,t.lanes=n,t.stateNode={isHidden:!1},t}function ph(t,e,n){return t=Ft(6,t,null,e),t.lanes=n,t}function mh(t,e,n){return e=Ft(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function CE(t,e,n,i,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qc(0),this.expirationTimes=Qc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qc(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Fp(t,e,n,i,r,s,o,l,a){return t=new CE(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Ft(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bp(s),t}function EE(t,e,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wr,key:i==null?null:""+i,children:t,containerInfo:e,implementation:n}}function Nw(t){if(!t)return Li;t=t._reactInternals;e:{if(Tr(t)!==t||t.tag!==1)throw Error(H(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(xt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(H(171))}if(t.tag===1){var n=t.type;if(xt(n))return N1(t,n,e)}return e}function _w(t,e,n,i,r,s,o,l,a){return t=Fp(n,i,!0,t,r,s,o,l,a),t.context=Nw(null),n=t.current,i=lt(),r=Oi(n),s=Gn(i,r),s.callback=e??null,Ti(n,s,r),t.current.lanes=r,Nl(t,r,i),St(t,i),t}function gc(t,e,n,i){var r=e.current,s=lt(),o=Oi(r);return n=Nw(n),e.context===null?e.context=n:e.pendingContext=n,e=Gn(s,o),e.payload={element:t},i=i===void 0?null:i,i!==null&&(e.callback=i),t=Ti(r,e,o),t!==null&&(fn(t,r,o,s),za(t,r,o)),o}function Eu(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Xg(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function jp(t,e){Xg(t,e),(t=t.alternate)&&Xg(t,e)}function AE(){return null}var Tw=typeof reportError=="function"?reportError:function(t){console.error(t)};function Vp(t){this._internalRoot=t}yc.prototype.render=Vp.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(H(409));gc(t,e,null,null)};yc.prototype.unmount=Vp.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Sr(function(){gc(null,t,null,null)}),e[ei]=null}};function yc(t){this._internalRoot=t}yc.prototype.unstable_scheduleHydration=function(t){if(t){var e=o1();t={blockedOn:null,target:t,priority:e};for(var n=0;n<gi.length&&e!==0&&e<gi[n].priority;n++);gi.splice(n,0,t),n===0&&a1(t)}};function Hp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function vc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Gg(){}function NE(t,e,n,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var u=Eu(o);s.call(u)}}var o=_w(e,i,t,0,null,!1,!1,"",Gg);return t._reactRootContainer=o,t[ei]=o.current,Jo(t.nodeType===8?t.parentNode:t),Sr(),o}for(;r=t.lastChild;)t.removeChild(r);if(typeof i=="function"){var l=i;i=function(){var u=Eu(a);l.call(u)}}var a=Fp(t,0,!1,null,null,!1,!1,"",Gg);return t._reactRootContainer=a,t[ei]=a.current,Jo(t.nodeType===8?t.parentNode:t),Sr(function(){gc(e,a,n,i)}),a}function wc(t,e,n,i,r){var s=n._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var l=r;r=function(){var a=Eu(o);l.call(a)}}gc(e,o,t,r)}else o=NE(n,e,t,r,i);return Eu(o)}r1=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=xo(e.pendingLanes);n!==0&&(ap(e,n|1),St(e,Re()),!(le&6)&&(Ms=Re()+500,Wi()))}break;case 13:Sr(function(){var i=ti(t,1);if(i!==null){var r=lt();fn(i,t,1,r)}}),jp(t,1)}};up=function(t){if(t.tag===13){var e=ti(t,134217728);if(e!==null){var n=lt();fn(e,t,134217728,n)}jp(t,134217728)}};s1=function(t){if(t.tag===13){var e=Oi(t),n=ti(t,e);if(n!==null){var i=lt();fn(n,t,e,i)}jp(t,e)}};o1=function(){return ce};l1=function(t,e){var n=ce;try{return ce=t,e()}finally{ce=n}};cf=function(t,e,n){switch(e){case"input":if(nf(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var r=uc(i);if(!r)throw Error(H(90));zv(i),nf(i,r)}}}break;case"textarea":Fv(t,n);break;case"select":e=n.value,e!=null&&ls(t,!!n.multiple,e,!1)}};qv=Lp;Yv=Sr;var _E={usingClientEntryPoint:!1,Events:[Tl,Qr,uc,Uv,Kv,Lp]},so={findFiberByHostInstance:or,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},TE={bundleType:so.bundleType,version:so.version,rendererPackageName:so.rendererPackageName,rendererConfig:so.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:oi.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Gv(t),t===null?null:t.stateNode},findFiberByHostInstance:so.findFiberByHostInstance||AE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ia=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ia.isDisabled&&ia.supportsFiber)try{sc=ia.inject(TE),Rn=ia}catch{}}Rt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_E;Rt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Hp(e))throw Error(H(200));return EE(t,e,null,n)};Rt.createRoot=function(t,e){if(!Hp(t))throw Error(H(299));var n=!1,i="",r=Tw;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Fp(t,1,!1,null,null,n,!1,i,r),t[ei]=e.current,Jo(t.nodeType===8?t.parentNode:t),new Vp(e)};Rt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(H(188)):(t=Object.keys(t).join(","),Error(H(268,t)));return t=Gv(e),t=t===null?null:t.stateNode,t};Rt.flushSync=function(t){return Sr(t)};Rt.hydrate=function(t,e,n){if(!vc(e))throw Error(H(200));return wc(null,t,e,!0,n)};Rt.hydrateRoot=function(t,e,n){if(!Hp(t))throw Error(H(405));var i=n!=null&&n.hydratedSources||null,r=!1,s="",o=Tw;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=_w(e,null,t,1,n??null,r,!1,s,o),t[ei]=e.current,Jo(t),i)for(t=0;t<i.length;t++)n=i[t],r=n._getVersion,r=r(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,r]:e.mutableSourceEagerHydrationData.push(n,r);return new yc(e)};Rt.render=function(t,e,n){if(!vc(e))throw Error(H(200));return wc(null,t,e,!1,n)};Rt.unmountComponentAtNode=function(t){if(!vc(t))throw Error(H(40));return t._reactRootContainer?(Sr(function(){wc(null,null,t,!1,function(){t._reactRootContainer=null,t[ei]=null})}),!0):!1};Rt.unstable_batchedUpdates=Lp;Rt.unstable_renderSubtreeIntoContainer=function(t,e,n,i){if(!vc(n))throw Error(H(200));if(t==null||t._reactInternals===void 0)throw Error(H(38));return wc(t,e,n,!1,i)};Rt.version="18.3.1-next-f1338f8080-20240426";function Mw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mw)}catch(t){console.error(t)}}Mw(),Mv.exports=Rt;var ME=Mv.exports,Jg=ME;Qh.createRoot=Jg.createRoot,Qh.hydrateRoot=Jg.hydrateRoot;const OE={},Zg=t=>{let e;const n=new Set,i=(c,h)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const d=e;e=h??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(p=>p(e,d))}},r=()=>e,a={setState:i,getState:r,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(OE?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=e=t(i,r,a);return a},Ow=t=>t?Zg(t):Zg;var Pw={exports:{}},Rw={},Iw={exports:{}},Dw={};/**
|
|
41
|
+
* @license React
|
|
42
|
+
* use-sync-external-store-shim.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/var Os=M;function PE(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var RE=typeof Object.is=="function"?Object.is:PE,IE=Os.useState,DE=Os.useEffect,LE=Os.useLayoutEffect,BE=Os.useDebugValue;function zE(t,e){var n=e(),i=IE({inst:{value:n,getSnapshot:e}}),r=i[0].inst,s=i[1];return LE(function(){r.value=n,r.getSnapshot=e,gh(r)&&s({inst:r})},[t,n,e]),DE(function(){return gh(r)&&s({inst:r}),t(function(){gh(r)&&s({inst:r})})},[t]),BE(n),n}function gh(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!RE(t,n)}catch{return!0}}function $E(t,e){return e()}var FE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?$E:zE;Dw.useSyncExternalStore=Os.useSyncExternalStore!==void 0?Os.useSyncExternalStore:FE;Iw.exports=Dw;var jE=Iw.exports;/**
|
|
49
|
+
* @license React
|
|
50
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/var xc=M,VE=jE;function HE(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var WE=typeof Object.is=="function"?Object.is:HE,UE=VE.useSyncExternalStore,KE=xc.useRef,qE=xc.useEffect,YE=xc.useMemo,QE=xc.useDebugValue;Rw.useSyncExternalStoreWithSelector=function(t,e,n,i,r){var s=KE(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=YE(function(){function a(d){if(!u){if(u=!0,c=d,d=i(d),r!==void 0&&o.hasValue){var p=o.value;if(r(p,d))return h=p}return h=d}if(p=h,WE(c,d))return p;var y=i(d);return r!==void 0&&r(p,y)?(c=d,p):(c=d,h=y)}var u=!1,c,h,f=n===void 0?null:n;return[function(){return a(e())},f===null?void 0:function(){return a(f())}]},[e,n,i,r]);var l=UE(t,s[0],s[1]);return qE(function(){o.hasValue=!0,o.value=l},[l]),QE(l),l};Pw.exports=Rw;var XE=Pw.exports;const Lw=vv(XE),Bw={},{useDebugValue:GE}=F,{useSyncExternalStoreWithSelector:JE}=Lw;let e0=!1;const ZE=t=>t;function eA(t,e=ZE,n){(Bw?"production":void 0)!=="production"&&n&&!e0&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),e0=!0);const i=JE(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return GE(i),i}const t0=t=>{(Bw?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Ow(t):t,n=(i,r)=>eA(e,i,r);return Object.assign(n,e),n},tA=t=>t?t0(t):t0,nA="api";async function iA(){const t=await fetch(`${nA}/spec`);if(!t.ok)throw new Error(`Failed to load spec: ${t.status}`);return t.json()}const rA=["get","post","put","patch","delete"];function sA(t){var i,r,s;const e=[],n=t.paths??{};for(const[o,l]of Object.entries(n)){const a=l.parameters??[];for(const u of rA){const c=l[u];if(!c)continue;const h=[...a,...c.parameters??[]].map(p=>({name:p.name,in:p.in,required:!!p.required,schema:ds(t,p.schema)??{}})),f=ds(t,((s=(r=(i=c.requestBody)==null?void 0:i.content)==null?void 0:r["application/json"])==null?void 0:s.schema)??null),d=ds(t,oA(c.responses));e.push({id:`${u.toUpperCase()} ${o}`,method:u,path:o,summary:c.summary,operationId:c.operationId,parameters:h,requestBodySchema:f,responseSchema:d})}}return e}function oA(t){var n,i,r;if(!t)return null;const e=Object.keys(t).find(s=>/^2\d\d$/.test(s));return e?((r=(i=(n=t[e])==null?void 0:n.content)==null?void 0:i["application/json"])==null?void 0:r.schema)??null:null}function ds(t,e,n=new Set){if(!e||typeof e!="object")return e??null;if(typeof e.$ref=="string"){if(n.has(e.$ref))return{};const i=lA(t,e.$ref);return i?ds(t,i,new Set(n).add(e.$ref)):e}if(e.type==="array"&&e.items)return{...e,items:ds(t,e.items,n)};if(e.properties){const i={};for(const[r,s]of Object.entries(e.properties))i[r]=ds(t,s,n);return{...e,properties:i}}return e}function lA(t,e){if(e.startsWith("#/"))return e.slice(2).split("/").reduce((n,i)=>n==null?void 0:n[i],t)}function aA(t){return btoa(unescape(encodeURIComponent(t)))}const n0=new Map,yh=new Map,uA=3e4,cA=300;async function hA(t,e){const n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(e).toString()});if(!n.ok)throw new Error(`OAuth2 token request to ${t} failed with status ${n.status}`);const i=await n.json().catch(()=>null);if(!(i!=null&&i.access_token))throw new Error(`OAuth2 token response from ${t} had no access_token`);const r=typeof i.expires_in=="number"?i.expires_in:cA;return{accessToken:i.access_token,expiresInSeconds:r}}async function i0(t,e,n){const i=n0.get(t);if(i&&i.expiresAt>Date.now()+uA)return i.accessToken;const r=yh.get(t);if(r)return r;const s=(async()=>{const{accessToken:o,expiresInSeconds:l}=await hA(e,n);return n0.set(t,{accessToken:o,expiresAt:Date.now()+l*1e3}),o})();return yh.set(t,s),s.finally(()=>yh.delete(t)).catch(()=>{}),s}async function fA(t){switch(t.type){case"bearer":return{headers:{Authorization:`Bearer ${t.token}`}};case"basic":return{headers:{Authorization:`Basic ${aA(`${t.username}:${t.password}`)}`}};case"apiKey":return t.in==="query"?{query:{[t.paramName]:t.key}}:{headers:{[t.paramName]:t.key}};case"oauth2_clientCredentials":{const e={grant_type:"client_credentials",client_id:t.clientId,client_secret:t.clientSecret};return t.scope&&(e.scope=t.scope),{headers:{Authorization:`Bearer ${await i0(t.id,t.tokenUrl,e)}`}}}case"oauth2_password":{const e={grant_type:"password",username:t.username,password:t.password};return t.clientId&&(e.client_id=t.clientId),t.clientSecret&&(e.client_secret=t.clientSecret),t.scope&&(e.scope=t.scope),{headers:{Authorization:`Bearer ${await i0(t.id,t.tokenUrl,e)}`}}}case"popup_login":return{credentials:"include"}}}function Ol(){return/\{\{enlace:([a-zA-Z0-9_-]+)\}\}/g}function zw(t){return`{{enlace:${t}}}`}function dA(t,e,n){return t[e-1]==='"'&&t[n]==='"'}function $w(t,e){if(!e)return t;const n=e.trim().replace(/^\$\.?/,"");return Up(t,n)}function Fw(t,e){const n=e.toLowerCase();for(const[i,r]of Object.entries(t))if(i.toLowerCase()===n)return r}function Hf(t,e){const n=e.get(t.sourceNodeId);if(!n||!n.response)throw new Error(`Body tag references node "${t.sourceNodeId}", which has no captured response yet.`);switch(t.type){case"response_body":return $w(n.response.body,t.jsonPath);case"response_raw":return n.response.body;case"response_header":{const i=t.headerName??"",r=Fw(n.response.headers,i);if(r===void 0)throw new Error(`Body tag references header "${i}" on node "${t.sourceNodeId}", but the response has no such header.`);return r}}}function pA(t){return t.includes("{{enlace:")}function mA(t,e,n){if(!pA(t))return t;const i=[...t.matchAll(Ol())],r=l=>{const a=e[l];if(!a)throw new Error(`Body references unknown tag "${l}".`);return a};if(i.length===1&&i[0][0]===t)return Hf(r(i[0][1]),n);let s="",o=0;for(const l of i){const a=l.index??0,u=Hf(r(l[1]),n);s+=t.slice(o,a)+String(u),o=a+l[0].length}return s+t.slice(o)}function Wf(t,e,n){return typeof t=="string"?mA(t,e,n):Array.isArray(t)?t.map(i=>Wf(i,e,n)):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).map(([i,r])=>[i,Wf(r,e,n)])):t}function gA(t){return JSON.stringify(String(t)).slice(1,-1)}function yA(t,e){const n=t.template;let i="",r=0;for(const s of n.matchAll(Ol())){const o=s.index??0,l=o+s[0].length,a=s[1],u=t.tags[a];if(!u)throw new Error(`Body references unknown tag "${a}".`);const c=Hf(u,e),h=dA(n,o,l),f=h?o-1:o,d=h?l+1:l,p=h?JSON.stringify(c):gA(c);i+=n.slice(r,f)+p,r=d}return i+=n.slice(r),JSON.parse(i)}function Wp(t,e){const n=new Map(t.map(r=>[r.id,r])),i=new Map;for(const r of t)i.set(r.id,new Set);for(const{fromNodeId:r,toNodeId:s}of e)n.has(r)&&i.has(s)&&i.get(s).add(r);for(const r of t)for(const s of Object.values(r.fieldValues))s.source==="mapped"&&n.has(s.fromNodeId)&&i.get(r.id).add(s.fromNodeId);return i}function vA(t,e,n){const i=Wp(t,e),r=new Set,s=[...i.get(n)??[]];for(;s.length>0;){const o=s.shift();r.has(o)||(r.add(o),s.push(...i.get(o)??[]))}return r}class wA extends Error{constructor(e){super(`Workflow has a cyclic dependency involving nodes: ${e.join(", ")}`),this.nodeIds=e,this.name="CyclicWorkflowError"}}function xA(t,e=[]){const n=Wp(t,e),i=new Set(t.map(s=>s.id)),r=[];for(;i.size>0;){const s=t.filter(o=>i.has(o.id)&&[...n.get(o.id)].every(l=>!i.has(l)));if(s.length===0)throw new wA([...i]);r.push(s);for(const o of s)i.delete(o.id)}return r}function Up(t,e){if(!e)return;const n=e.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);let i=t;for(const r of n){if(i==null)return;i=i[r]}return i}function ll(t,e,n){const i=e.split(".").filter(Boolean);let r=t;i.forEach((s,o)=>{o===i.length-1?r[s]=n:(r[s]=r[s]??{},r=r[s])})}function SA(t,e){var i;if(t.source==="static")return t.value;const n=e.get(t.fromNodeId);return Up((i=n==null?void 0:n.response)==null?void 0:i.body,t.fromResponseFieldPath)}async function kA(t,e,n,i,r){var x;let s=e.path;const o=new URLSearchParams,l={"Content-Type":"application/json"},a={},u=(x=t.rawBody)==null?void 0:x.tags;for(const[m,g]of Object.entries(t.fieldValues)){let v=SA(g,n);u&&Object.keys(u).length>0&&(v=Wf(v,u,n));const[w,...k]=m.split("."),C=k.join(".");w==="path"?s=s.replace(`{${C}}`,encodeURIComponent(String(v??""))):w==="query"?v!==void 0&&o.set(C,String(v)):w==="header"?v!==void 0&&(l[C]=String(v)):w==="body"&&ll(a,C,v)}const c=[];let h;if(t.credentialId){const m=i.get(t.credentialId);if(m){const g=await fA(m);Object.assign(l,g.headers);for(const[v,w]of Object.entries(g.query??{}))o.set(v,w),c.push(v);h=g.credentials}}const f=o.toString(),d=`${r}${s}${f?`?${f}`:""}`,p=t.bodyMode==="raw"&&t.rawBody?yA(t.rawBody,n):Object.keys(a).length>0?a:void 0,y=!!e.requestBodySchema&&p!==void 0;return{method:e.method.toUpperCase(),url:d,headers:l,body:y?p:void 0,redactQueryParams:c.length>0?c:void 0,credentials:h}}async function bA(t,e,n,i,r){const s=new Date().toISOString();let o;try{o=await kA(t,e,n,i,r)}catch(a){return{nodeId:t.id,request:{method:e.method.toUpperCase(),url:`${r}${e.path}`,headers:{}},timestampStart:s,timestampEnd:new Date().toISOString(),error:a instanceof Error?a.message:String(a)}}const l={nodeId:t.id,request:o,timestampStart:s,timestampEnd:""};try{const a=await fetch(o.url,{method:o.method,headers:o.headers,body:o.body!==void 0?JSON.stringify(o.body):void 0,credentials:o.credentials}),u={};a.headers.forEach((f,d)=>u[d]=f);const h=(a.headers.get("content-type")??"").includes("application/json")?await a.json().catch(()=>null):await a.text();l.response={status:a.status,headers:u,body:h},l.timestampEnd=new Date().toISOString(),a.status>=400&&(l.error=`Request failed with status ${a.status}`)}catch(a){l.timestampEnd=new Date().toISOString(),l.error=a instanceof Error?a.message:String(a)}return l}async function CA(t,e,n,i){const{nodes:r,connections:s}=t;xA(r,s);const o=Wp(r,s),l=new Map(r.map(v=>[v.id,"pending"])),a=new Map,u=[],c=(v,w,k)=>{var C;return(C=i.onEvent)==null?void 0:C.call(i,{nodeId:v,status:w,step:k})},h=v=>[...o.get(v)].every(w=>l.get(w)==="completed");let f=!1,d=0,p=null,y=null;const x=()=>{y==null||y(),y=null},m=()=>new Promise(v=>y=v);function g(){for(const v of r){if(p)return;if(l.get(v.id)!=="pending"||f||!h(v.id))continue;const w=e.get(v.operationId);if(!w){p=new Error(`Unknown operation "${v.operationId}" referenced by node ${v.id}`),x();return}l.set(v.id,"in-flight"),d++,c(v.id,"in-flight"),bA(v,w,a,n,i.baseUrl).then(k=>{u.push(k),a.set(k.nodeId,k);const C=k.error?"failed":"completed";l.set(v.id,C),k.error&&(f=!0),d--,c(v.id,C,k),x()})}}for(g();d>0&&(await m(),!p);)g();if(p)throw p;return{steps:u}}function EA(t){var i;const e=((i=t==null?void 0:t.components)==null?void 0:i.securitySchemes)??{},n=[];for(const[r,s]of Object.entries(e)){const o=AA(r,s);o&&n.push({schemeName:r,description:s==null?void 0:s.description,template:o})}return n}function AA(t,e){if(!e||typeof e!="object")return null;if(e.type==="http"&&e.scheme==="bearer")return Br(t,{name:t,type:"bearer",token:""});if(e.type==="http"&&e.scheme==="basic")return Br(t,{name:t,type:"basic",username:"",password:""});if(e.type==="apiKey"&&(e.in==="header"||e.in==="query"))return Br(t,{name:t,type:"apiKey",paramName:e.name??"",in:e.in,key:""});if(e.type==="apiKey"&&e.in==="cookie")return Br(t,{name:t,type:"popup_login",loginUrl:""});if(e.type==="oauth2"){const n=e.flows??{};return n.clientCredentials?Br(t,{name:t,type:"oauth2_clientCredentials",tokenUrl:n.clientCredentials.tokenUrl??"",clientId:"",clientSecret:"",scope:r0(n.clientCredentials.scopes)}):n.password?Br(t,{name:t,type:"oauth2_password",tokenUrl:n.password.tokenUrl??"",username:"",password:"",clientId:"",clientSecret:"",scope:r0(n.password.scopes)}):null}return null}function Br(t,e){return{...e,fromSecurityScheme:t}}function r0(t){return t?Object.keys(t).join(" "):""}function Au(){return crypto.randomUUID()}function NA(t){return{x:80+t%4*220,y:80+Math.floor(t/4)*140}}function _A(t){var n;const e=t.servers??[];return e.length===0||!((n=e[0])!=null&&n.url)?null:(e.length>1&&console.warn(`enlace: spec declares ${e.length} servers; defaulting to the first (${e[0].url}).`),e[0].url)}const Mr=tA((t,e)=>({operations:[],baseUrl:null,nodes:[],connections:[],nodePositions:{},credentials:[],declaredCredentials:[],selectedNodeId:null,runResult:null,stepStatusByNodeId:{},isRunning:!1,error:null,loadOperations:async()=>{try{const n=await iA(),i=sA(n),r=_A(n),s=EA(n);t({operations:i,baseUrl:r,declaredCredentials:s,error:r?null:"Could not determine a target base URL — add a `servers` entry to the OpenAPI spec."})}catch(n){t({error:n instanceof Error?n.message:String(n)})}},addNode:(n,i)=>{const r=Au(),s={id:r,operationId:n,credentialId:null,fieldValues:{}};return t(o=>({nodes:[...o.nodes,s],nodePositions:{...o.nodePositions,[r]:i??NA(o.nodes.length)},selectedNodeId:r})),r},updateNodePosition:(n,i)=>t(r=>({nodePositions:{...r.nodePositions,[n]:i}})),removeNode:n=>t(i=>{const r={...i.nodePositions};return delete r[n],{nodes:i.nodes.filter(o=>o.id!==n).map(o=>{const l={...o.fieldValues};let a=!1;for(const[u,c]of Object.entries(l))c.source==="mapped"&&c.fromNodeId===n&&(l[u]={source:"static",value:""},a=!0);return a?{...o,fieldValues:l}:o}),nodePositions:r,connections:i.connections.filter(o=>o.fromNodeId!==n&&o.toNodeId!==n),selectedNodeId:i.selectedNodeId===n?null:i.selectedNodeId}}),selectNode:n=>t({selectedNodeId:n}),setCredential:(n,i)=>t(r=>({nodes:r.nodes.map(s=>s.id===n?{...s,credentialId:i}:s)})),setFieldValue:(n,i,r)=>t(s=>({nodes:s.nodes.map(o=>o.id===n?{...o,fieldValues:{...o.fieldValues,[i]:r}}:o)})),mergeFieldValues:(n,i)=>t(r=>({nodes:r.nodes.map(s=>s.id===n?{...s,fieldValues:{...s.fieldValues,...i}}:s)})),setBodyMode:(n,i)=>t(r=>({nodes:r.nodes.map(s=>s.id===n?{...s,bodyMode:i}:s)})),setRawBody:(n,i)=>t(r=>({nodes:r.nodes.map(s=>s.id===n?{...s,rawBody:i}:s)})),connectNodes:(n,i)=>t(r=>n===i||r.connections.some(o=>o.fromNodeId===n&&o.toNodeId===i)?r:{connections:[...r.connections,{fromNodeId:n,toNodeId:i}]}),disconnectNodes:(n,i)=>t(r=>({connections:r.connections.filter(s=>!(s.fromNodeId===n&&s.toNodeId===i))})),addCredential:n=>{const i={...n,id:Au()};t(r=>({credentials:[...r.credentials,i]}))},updateCredential:(n,i)=>{const r={...i,id:n};t(s=>({credentials:s.credentials.map(o=>o.id===n?r:o)}))},removeCredential:n=>t(i=>({credentials:i.credentials.filter(r=>r.id!==n),nodes:i.nodes.map(r=>r.credentialId===n?{...r,credentialId:null}:r)})),run:async()=>{const{nodes:n}=e();t({isRunning:!0,error:null,runResult:{steps:[]},stepStatusByNodeId:n.reduce((i,r)=>(i[r.id]="pending",i),{})});try{const{connections:i,operations:r,credentials:s,baseUrl:o}=e();if(!o)throw new Error("Could not determine a target base URL — add a `servers` entry to the OpenAPI spec.");const l=new Map(r.map(c=>[c.id,c])),a=new Map(s.map(c=>[c.id,c])),u=await CA({nodes:n,connections:i},l,a,{baseUrl:o,onEvent:c=>{t(h=>{var f;return{stepStatusByNodeId:{...h.stepStatusByNodeId,[c.nodeId]:c.status},runResult:c.step?{steps:[...((f=h.runResult)==null?void 0:f.steps)??[],c.step]}:h.runResult}})}});t({runResult:u})}catch(i){t({error:i instanceof Error?i.message:String(i)})}finally{t({isRunning:!1})}}}));function TA({operations:t}){const[e,n]=M.useState(""),i=e.trim().toLowerCase(),r=i?t.filter(s=>{var o;return(o=s.operationId)==null?void 0:o.toLowerCase().includes(i)}):t;return b.jsxs("aside",{className:"operation-list",children:[b.jsx("h2",{children:"Operations"}),b.jsx("div",{className:"operation-list__search",children:b.jsx("input",{type:"text",placeholder:"Search by operationId…","aria-label":"Search operations by operationId",value:e,onChange:s=>n(s.target.value)})}),i&&r.length===0?b.jsxs("p",{className:"operation-list__empty",children:['No operations match "',e,'".']}):b.jsx("ul",{children:r.map(s=>b.jsx("li",{draggable:!0,onDragStart:o=>o.dataTransfer.setData("text/operation-id",s.id),children:b.jsxs("fieldset",{className:`operation-list__item operation-list__item--${s.method}`,children:[s.operationId&&b.jsx("legend",{className:"operation-list__operation-id",children:s.operationId}),b.jsx("span",{className:`method-badge method-badge--${s.method}`,children:s.method.toUpperCase()}),b.jsx("span",{className:"operation-list__path",children:s.path})]})},s.id))})]})}function ft(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,i;n<t.length;n++)(i=ft(t[n]))!==""&&(e+=(e&&" ")+i);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:MA}=F,{useSyncExternalStoreWithSelector:OA}=Lw,PA=t=>t;function jw(t,e=PA,n){const i=OA(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return MA(i),i}const s0=(t,e)=>{const n=Ow(t),i=(r,s=e)=>jw(n,r,s);return Object.assign(i,n),i},RA=(t,e)=>t?s0(t,e):s0;function it(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[i,r]of t)if(!Object.is(r,e.get(i)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||!Object.is(t[i],e[i]))return!1;return!0}var IA={value:()=>{}};function Sc(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new Ua(n)}function Ua(t){this._=t}function DA(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Ua.prototype=Sc.prototype={constructor:Ua,on:function(t,e){var n=this._,i=DA(t+"",n),r,s=-1,o=i.length;if(arguments.length<2){for(;++s<o;)if((r=(t=i[s]).type)&&(r=LA(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(r=(t=i[s]).type)n[r]=o0(n[r],t.name,e);else if(e==null)for(r in n)n[r]=o0(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Ua(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,s;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],i=0,r=s.length;i<r;++i)s[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)}};function LA(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function o0(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=IA,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var Uf="http://www.w3.org/1999/xhtml";const l0={svg:"http://www.w3.org/2000/svg",xhtml:Uf,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kc(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),l0.hasOwnProperty(e)?{space:l0[e],local:t}:t}function BA(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Uf&&e.documentElement.namespaceURI===Uf?e.createElement(t):e.createElementNS(n,t)}}function zA(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Vw(t){var e=kc(t);return(e.local?zA:BA)(e)}function $A(){}function Kp(t){return t==null?$A:function(){return this.querySelector(t)}}function FA(t){typeof t!="function"&&(t=Kp(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s=e[r],o=s.length,l=i[r]=new Array(o),a,u,c=0;c<o;++c)(a=s[c])&&(u=t.call(a,a.__data__,c,s))&&("__data__"in a&&(u.__data__=a.__data__),l[c]=u);return new Pt(i,this._parents)}function jA(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function VA(){return[]}function Hw(t){return t==null?VA:function(){return this.querySelectorAll(t)}}function HA(t){return function(){return jA(t.apply(this,arguments))}}function WA(t){typeof t=="function"?t=HA(t):t=Hw(t);for(var e=this._groups,n=e.length,i=[],r=[],s=0;s<n;++s)for(var o=e[s],l=o.length,a,u=0;u<l;++u)(a=o[u])&&(i.push(t.call(a,a.__data__,u,o)),r.push(a));return new Pt(i,r)}function Ww(t){return function(){return this.matches(t)}}function Uw(t){return function(e){return e.matches(t)}}var UA=Array.prototype.find;function KA(t){return function(){return UA.call(this.children,t)}}function qA(){return this.firstElementChild}function YA(t){return this.select(t==null?qA:KA(typeof t=="function"?t:Uw(t)))}var QA=Array.prototype.filter;function XA(){return Array.from(this.children)}function GA(t){return function(){return QA.call(this.children,t)}}function JA(t){return this.selectAll(t==null?XA:GA(typeof t=="function"?t:Uw(t)))}function ZA(t){typeof t!="function"&&(t=Ww(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s=e[r],o=s.length,l=i[r]=[],a,u=0;u<o;++u)(a=s[u])&&t.call(a,a.__data__,u,s)&&l.push(a);return new Pt(i,this._parents)}function Kw(t){return new Array(t.length)}function eN(){return new Pt(this._enter||this._groups.map(Kw),this._parents)}function Nu(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Nu.prototype={constructor:Nu,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function tN(t){return function(){return t}}function nN(t,e,n,i,r,s){for(var o=0,l,a=e.length,u=s.length;o<u;++o)(l=e[o])?(l.__data__=s[o],i[o]=l):n[o]=new Nu(t,s[o]);for(;o<a;++o)(l=e[o])&&(r[o]=l)}function iN(t,e,n,i,r,s,o){var l,a,u=new Map,c=e.length,h=s.length,f=new Array(c),d;for(l=0;l<c;++l)(a=e[l])&&(f[l]=d=o.call(a,a.__data__,l,e)+"",u.has(d)?r[l]=a:u.set(d,a));for(l=0;l<h;++l)d=o.call(t,s[l],l,s)+"",(a=u.get(d))?(i[l]=a,a.__data__=s[l],u.delete(d)):n[l]=new Nu(t,s[l]);for(l=0;l<c;++l)(a=e[l])&&u.get(f[l])===a&&(r[l]=a)}function rN(t){return t.__data__}function sN(t,e){if(!arguments.length)return Array.from(this,rN);var n=e?iN:nN,i=this._parents,r=this._groups;typeof t!="function"&&(t=tN(t));for(var s=r.length,o=new Array(s),l=new Array(s),a=new Array(s),u=0;u<s;++u){var c=i[u],h=r[u],f=h.length,d=oN(t.call(c,c&&c.__data__,u,i)),p=d.length,y=l[u]=new Array(p),x=o[u]=new Array(p),m=a[u]=new Array(f);n(c,h,y,x,m,d,e);for(var g=0,v=0,w,k;g<p;++g)if(w=y[g]){for(g>=v&&(v=g+1);!(k=x[v])&&++v<p;);w._next=k||null}}return o=new Pt(o,i),o._enter=l,o._exit=a,o}function oN(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function lN(){return new Pt(this._exit||this._groups.map(Kw),this._parents)}function aN(t,e,n){var i=this.enter(),r=this,s=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?s.remove():n(s),i&&r?i.merge(r).order():r}function uN(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,s=i.length,o=Math.min(r,s),l=new Array(r),a=0;a<o;++a)for(var u=n[a],c=i[a],h=u.length,f=l[a]=new Array(h),d,p=0;p<h;++p)(d=u[p]||c[p])&&(f[p]=d);for(;a<r;++a)l[a]=n[a];return new Pt(l,this._parents)}function cN(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,s=i[r],o;--r>=0;)(o=i[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function hN(t){t||(t=fN);function e(h,f){return h&&f?t(h.__data__,f.__data__):!h-!f}for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o=n[s],l=o.length,a=r[s]=new Array(l),u,c=0;c<l;++c)(u=o[c])&&(a[c]=u);a.sort(e)}return new Pt(r,this._parents).order()}function fN(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function dN(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function pN(){return Array.from(this)}function mN(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null}function gN(){let t=0;for(const e of this)++t;return t}function yN(){return!this.node()}function vN(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],s=0,o=r.length,l;s<o;++s)(l=r[s])&&t.call(l,l.__data__,s,r);return this}function wN(t){return function(){this.removeAttribute(t)}}function xN(t){return function(){this.removeAttributeNS(t.space,t.local)}}function SN(t,e){return function(){this.setAttribute(t,e)}}function kN(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function bN(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function CN(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function EN(t,e){var n=kc(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?xN:wN:typeof e=="function"?n.local?CN:bN:n.local?kN:SN)(n,e))}function qw(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function AN(t){return function(){this.style.removeProperty(t)}}function NN(t,e,n){return function(){this.style.setProperty(t,e,n)}}function _N(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function TN(t,e,n){return arguments.length>1?this.each((e==null?AN:typeof e=="function"?_N:NN)(t,e,n??"")):Ps(this.node(),t)}function Ps(t,e){return t.style.getPropertyValue(e)||qw(t).getComputedStyle(t,null).getPropertyValue(e)}function MN(t){return function(){delete this[t]}}function ON(t,e){return function(){this[t]=e}}function PN(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function RN(t,e){return arguments.length>1?this.each((e==null?MN:typeof e=="function"?PN:ON)(t,e)):this.node()[t]}function Yw(t){return t.trim().split(/^|\s+/)}function qp(t){return t.classList||new Qw(t)}function Qw(t){this._node=t,this._names=Yw(t.getAttribute("class")||"")}Qw.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Xw(t,e){for(var n=qp(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function Gw(t,e){for(var n=qp(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function IN(t){return function(){Xw(this,t)}}function DN(t){return function(){Gw(this,t)}}function LN(t,e){return function(){(e.apply(this,arguments)?Xw:Gw)(this,t)}}function BN(t,e){var n=Yw(t+"");if(arguments.length<2){for(var i=qp(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?LN:e?IN:DN)(n,e))}function zN(){this.textContent=""}function $N(t){return function(){this.textContent=t}}function FN(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function jN(t){return arguments.length?this.each(t==null?zN:(typeof t=="function"?FN:$N)(t)):this.node().textContent}function VN(){this.innerHTML=""}function HN(t){return function(){this.innerHTML=t}}function WN(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function UN(t){return arguments.length?this.each(t==null?VN:(typeof t=="function"?WN:HN)(t)):this.node().innerHTML}function KN(){this.nextSibling&&this.parentNode.appendChild(this)}function qN(){return this.each(KN)}function YN(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function QN(){return this.each(YN)}function XN(t){var e=typeof t=="function"?t:Vw(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function GN(){return null}function JN(t,e){var n=typeof t=="function"?t:Vw(t),i=e==null?GN:typeof e=="function"?e:Kp(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function ZN(){var t=this.parentNode;t&&t.removeChild(this)}function e_(){return this.each(ZN)}function t_(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function n_(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function i_(t){return this.select(t?n_:t_)}function r_(t){return arguments.length?this.property("__data__",t):this.node().__data__}function s_(t){return function(e){t.call(this,e,this.__data__)}}function o_(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function l_(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,s;n<r;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++i]=s;++i?e.length=i:delete this.__on}}}function a_(t,e,n){return function(){var i=this.__on,r,s=s_(e);if(i){for(var o=0,l=i.length;o<l;++o)if((r=i[o]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=e;return}}this.addEventListener(t.type,s,n),r={type:t.type,name:t.name,value:e,listener:s,options:n},i?i.push(r):this.__on=[r]}}function u_(t,e,n){var i=o_(t+""),r,s=i.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var a=0,u=l.length,c;a<u;++a)for(r=0,c=l[a];r<s;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value}return}for(l=e?a_:l_,r=0;r<s;++r)this.each(l(i[r],e,n));return this}function Jw(t,e,n){var i=qw(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function c_(t,e){return function(){return Jw(this,t,e)}}function h_(t,e){return function(){return Jw(this,t,e.apply(this,arguments))}}function f_(t,e){return this.each((typeof e=="function"?h_:c_)(t,e))}function*d_(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,s=i.length,o;r<s;++r)(o=i[r])&&(yield o)}var Zw=[null];function Pt(t,e){this._groups=t,this._parents=e}function Pl(){return new Pt([[document.documentElement]],Zw)}function p_(){return this}Pt.prototype=Pl.prototype={constructor:Pt,select:FA,selectAll:WA,selectChild:YA,selectChildren:JA,filter:ZA,data:sN,enter:eN,exit:lN,join:aN,merge:uN,selection:p_,order:cN,sort:hN,call:dN,nodes:pN,node:mN,size:gN,empty:yN,each:vN,attr:EN,style:TN,property:RN,classed:BN,text:jN,html:UN,raise:qN,lower:QN,append:XN,insert:JN,remove:e_,clone:i_,datum:r_,on:u_,dispatch:f_,[Symbol.iterator]:d_};function on(t){return typeof t=="string"?new Pt([[document.querySelector(t)]],[document.documentElement]):new Pt([[t]],Zw)}function m_(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Nn(t,e){if(t=m_(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const g_={passive:!1},al={capture:!0,passive:!1};function vh(t){t.stopImmediatePropagation()}function ps(t){t.preventDefault(),t.stopImmediatePropagation()}function ex(t){var e=t.document.documentElement,n=on(t).on("dragstart.drag",ps,al);"onselectstart"in e?n.on("selectstart.drag",ps,al):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function tx(t,e){var n=t.document.documentElement,i=on(t).on("dragstart.drag",null);e&&(i.on("click.drag",ps,al),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ra=t=>()=>t;function Kf(t,{sourceEvent:e,subject:n,target:i,identifier:r,active:s,x:o,y:l,dx:a,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}Kf.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function y_(t){return!t.ctrlKey&&!t.button}function v_(){return this.parentNode}function w_(t,e){return e??{x:t.x,y:t.y}}function x_(){return navigator.maxTouchPoints||"ontouchstart"in this}function S_(){var t=y_,e=v_,n=w_,i=x_,r={},s=Sc("start","drag","end"),o=0,l,a,u,c,h=0;function f(w){w.on("mousedown.drag",d).filter(i).on("touchstart.drag",x).on("touchmove.drag",m,g_).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(w,k){if(!(c||!t.call(this,w,k))){var C=v(this,e.call(this,w,k),w,k,"mouse");C&&(on(w.view).on("mousemove.drag",p,al).on("mouseup.drag",y,al),ex(w.view),vh(w),u=!1,l=w.clientX,a=w.clientY,C("start",w))}}function p(w){if(ps(w),!u){var k=w.clientX-l,C=w.clientY-a;u=k*k+C*C>h}r.mouse("drag",w)}function y(w){on(w.view).on("mousemove.drag mouseup.drag",null),tx(w.view,u),ps(w),r.mouse("end",w)}function x(w,k){if(t.call(this,w,k)){var C=w.changedTouches,E=e.call(this,w,k),_=C.length,D,L;for(D=0;D<_;++D)(L=v(this,E,w,k,C[D].identifier,C[D]))&&(vh(w),L("start",w,C[D]))}}function m(w){var k=w.changedTouches,C=k.length,E,_;for(E=0;E<C;++E)(_=r[k[E].identifier])&&(ps(w),_("drag",w,k[E]))}function g(w){var k=w.changedTouches,C=k.length,E,_;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),E=0;E<C;++E)(_=r[k[E].identifier])&&(vh(w),_("end",w,k[E]))}function v(w,k,C,E,_,D){var L=s.copy(),B=Nn(D||C,k),P,A,S;if((S=n.call(w,new Kf("beforestart",{sourceEvent:C,target:f,identifier:_,active:o,x:B[0],y:B[1],dx:0,dy:0,dispatch:L}),E))!=null)return P=S.x-B[0]||0,A=S.y-B[1]||0,function I(O,j,R){var N=B,T;switch(O){case"start":r[_]=I,T=o++;break;case"end":delete r[_],--o;case"drag":B=Nn(R||j,k),T=o;break}L.call(O,w,new Kf(O,{sourceEvent:j,subject:S,target:f,identifier:_,active:T,x:B[0]+P,y:B[1]+A,dx:B[0]-N[0],dy:B[1]-N[1],dispatch:L}),E)}}return f.filter=function(w){return arguments.length?(t=typeof w=="function"?w:ra(!!w),f):t},f.container=function(w){return arguments.length?(e=typeof w=="function"?w:ra(w),f):e},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:ra(w),f):n},f.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:ra(!!w),f):i},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(h=(w=+w)*w,f):Math.sqrt(h)},f}function Yp(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function nx(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Rl(){}var ul=.7,_u=1/ul,ms="\\s*([+-]?\\d+)\\s*",cl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",k_=/^#([0-9a-f]{3,8})$/,b_=new RegExp(`^rgb\\(${ms},${ms},${ms}\\)$`),C_=new RegExp(`^rgb\\(${Dn},${Dn},${Dn}\\)$`),E_=new RegExp(`^rgba\\(${ms},${ms},${ms},${cl}\\)$`),A_=new RegExp(`^rgba\\(${Dn},${Dn},${Dn},${cl}\\)$`),N_=new RegExp(`^hsl\\(${cl},${Dn},${Dn}\\)$`),__=new RegExp(`^hsla\\(${cl},${Dn},${Dn},${cl}\\)$`),a0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Yp(Rl,hl,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:u0,formatHex:u0,formatHex8:T_,formatHsl:M_,formatRgb:c0,toString:c0});function u0(){return this.rgb().formatHex()}function T_(){return this.rgb().formatHex8()}function M_(){return ix(this).formatHsl()}function c0(){return this.rgb().formatRgb()}function hl(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=k_.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?h0(e):n===3?new yt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?sa(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?sa(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=b_.exec(t))?new yt(e[1],e[2],e[3],1):(e=C_.exec(t))?new yt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=E_.exec(t))?sa(e[1],e[2],e[3],e[4]):(e=A_.exec(t))?sa(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=N_.exec(t))?p0(e[1],e[2]/100,e[3]/100,1):(e=__.exec(t))?p0(e[1],e[2]/100,e[3]/100,e[4]):a0.hasOwnProperty(t)?h0(a0[t]):t==="transparent"?new yt(NaN,NaN,NaN,0):null}function h0(t){return new yt(t>>16&255,t>>8&255,t&255,1)}function sa(t,e,n,i){return i<=0&&(t=e=n=NaN),new yt(t,e,n,i)}function O_(t){return t instanceof Rl||(t=hl(t)),t?(t=t.rgb(),new yt(t.r,t.g,t.b,t.opacity)):new yt}function qf(t,e,n,i){return arguments.length===1?O_(t):new yt(t,e,n,i??1)}function yt(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}Yp(yt,qf,nx(Rl,{brighter(t){return t=t==null?_u:Math.pow(_u,t),new yt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ul:Math.pow(ul,t),new yt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new yt(pr(this.r),pr(this.g),pr(this.b),Tu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:f0,formatHex:f0,formatHex8:P_,formatRgb:d0,toString:d0}));function f0(){return`#${ur(this.r)}${ur(this.g)}${ur(this.b)}`}function P_(){return`#${ur(this.r)}${ur(this.g)}${ur(this.b)}${ur((isNaN(this.opacity)?1:this.opacity)*255)}`}function d0(){const t=Tu(this.opacity);return`${t===1?"rgb(":"rgba("}${pr(this.r)}, ${pr(this.g)}, ${pr(this.b)}${t===1?")":`, ${t})`}`}function Tu(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function pr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ur(t){return t=pr(t),(t<16?"0":"")+t.toString(16)}function p0(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ln(t,e,n,i)}function ix(t){if(t instanceof ln)return new ln(t.h,t.s,t.l,t.opacity);if(t instanceof Rl||(t=hl(t)),!t)return new ln;if(t instanceof ln)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),s=Math.max(e,n,i),o=NaN,l=s-r,a=(s+r)/2;return l?(e===s?o=(n-i)/l+(n<i)*6:n===s?o=(i-e)/l+2:o=(e-n)/l+4,l/=a<.5?s+r:2-s-r,o*=60):l=a>0&&a<1?0:o,new ln(o,l,a,t.opacity)}function R_(t,e,n,i){return arguments.length===1?ix(t):new ln(t,e,n,i??1)}function ln(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}Yp(ln,R_,nx(Rl,{brighter(t){return t=t==null?_u:Math.pow(_u,t),new ln(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ul:Math.pow(ul,t),new ln(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new yt(wh(t>=240?t-240:t+120,r,i),wh(t,r,i),wh(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new ln(m0(this.h),oa(this.s),oa(this.l),Tu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Tu(this.opacity);return`${t===1?"hsl(":"hsla("}${m0(this.h)}, ${oa(this.s)*100}%, ${oa(this.l)*100}%${t===1?")":`, ${t})`}`}}));function m0(t){return t=(t||0)%360,t<0?t+360:t}function oa(t){return Math.max(0,Math.min(1,t||0))}function wh(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const rx=t=>()=>t;function I_(t,e){return function(n){return t+n*e}}function D_(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function L_(t){return(t=+t)==1?sx:function(e,n){return n-e?D_(e,n,t):rx(isNaN(e)?n:e)}}function sx(t,e){var n=e-t;return n?I_(t,n):rx(isNaN(t)?e:t)}const g0=function t(e){var n=L_(e);function i(r,s){var o=n((r=qf(r)).r,(s=qf(s)).r),l=n(r.g,s.g),a=n(r.b,s.b),u=sx(r.opacity,s.opacity);return function(c){return r.r=o(c),r.g=l(c),r.b=a(c),r.opacity=u(c),r+""}}return i.gamma=t,i}(1);function fi(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Yf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xh=new RegExp(Yf.source,"g");function B_(t){return function(){return t}}function z_(t){return function(e){return t(e)+""}}function $_(t,e){var n=Yf.lastIndex=xh.lastIndex=0,i,r,s,o=-1,l=[],a=[];for(t=t+"",e=e+"";(i=Yf.exec(t))&&(r=xh.exec(e));)(s=r.index)>n&&(s=e.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(i=i[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,a.push({i:o,x:fi(i,r)})),n=xh.lastIndex;return n<e.length&&(s=e.slice(n),l[o]?l[o]+=s:l[++o]=s),l.length<2?a[0]?z_(a[0].x):B_(e):(e=a.length,function(u){for(var c=0,h;c<e;++c)l[(h=a[c]).i]=h.x(u);return l.join("")})}var y0=180/Math.PI,Qf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ox(t,e,n,i,r,s){var o,l,a;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(a=t*n+e*i)&&(n-=t*a,i-=e*a),(l=Math.sqrt(n*n+i*i))&&(n/=l,i/=l,a/=l),t*i<e*n&&(t=-t,e=-e,a=-a,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(e,t)*y0,skewX:Math.atan(a)*y0,scaleX:o,scaleY:l}}var la;function F_(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Qf:ox(e.a,e.b,e.c,e.d,e.e,e.f)}function j_(t){return t==null||(la||(la=document.createElementNS("http://www.w3.org/2000/svg","g")),la.setAttribute("transform",t),!(t=la.transform.baseVal.consolidate()))?Qf:(t=t.matrix,ox(t.a,t.b,t.c,t.d,t.e,t.f))}function lx(t,e,n,i){function r(u){return u.length?u.pop()+" ":""}function s(u,c,h,f,d,p){if(u!==h||c!==f){var y=d.push("translate(",null,e,null,n);p.push({i:y-4,x:fi(u,h)},{i:y-2,x:fi(c,f)})}else(h||f)&&d.push("translate("+h+e+f+n)}function o(u,c,h,f){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),f.push({i:h.push(r(h)+"rotate(",null,i)-2,x:fi(u,c)})):c&&h.push(r(h)+"rotate("+c+i)}function l(u,c,h,f){u!==c?f.push({i:h.push(r(h)+"skewX(",null,i)-2,x:fi(u,c)}):c&&h.push(r(h)+"skewX("+c+i)}function a(u,c,h,f,d,p){if(u!==h||c!==f){var y=d.push(r(d)+"scale(",null,",",null,")");p.push({i:y-4,x:fi(u,h)},{i:y-2,x:fi(c,f)})}else(h!==1||f!==1)&&d.push(r(d)+"scale("+h+","+f+")")}return function(u,c){var h=[],f=[];return u=t(u),c=t(c),s(u.translateX,u.translateY,c.translateX,c.translateY,h,f),o(u.rotate,c.rotate,h,f),l(u.skewX,c.skewX,h,f),a(u.scaleX,u.scaleY,c.scaleX,c.scaleY,h,f),u=c=null,function(d){for(var p=-1,y=f.length,x;++p<y;)h[(x=f[p]).i]=x.x(d);return h.join("")}}}var V_=lx(F_,"px, ","px)","deg)"),H_=lx(j_,", ",")",")"),W_=1e-12;function v0(t){return((t=Math.exp(t))+1/t)/2}function U_(t){return((t=Math.exp(t))-1/t)/2}function K_(t){return((t=Math.exp(2*t))-1)/(t+1)}const q_=function t(e,n,i){function r(s,o){var l=s[0],a=s[1],u=s[2],c=o[0],h=o[1],f=o[2],d=c-l,p=h-a,y=d*d+p*p,x,m;if(y<W_)m=Math.log(f/u)/e,x=function(E){return[l+E*d,a+E*p,u*Math.exp(e*E*m)]};else{var g=Math.sqrt(y),v=(f*f-u*u+i*y)/(2*u*n*g),w=(f*f-u*u-i*y)/(2*f*n*g),k=Math.log(Math.sqrt(v*v+1)-v),C=Math.log(Math.sqrt(w*w+1)-w);m=(C-k)/e,x=function(E){var _=E*m,D=v0(k),L=u/(n*g)*(D*K_(e*_+k)-U_(k));return[l+L*d,a+L*p,u*D/v0(e*_+k)]}}return x.duration=m*1e3*e/Math.SQRT2,x}return r.rho=function(s){var o=Math.max(.001,+s),l=o*o,a=l*l;return t(o,l,a)},r}(Math.SQRT2,2,4);var Rs=0,ko=0,oo=0,ax=1e3,Mu,bo,Ou=0,kr=0,bc=0,fl=typeof performance=="object"&&performance.now?performance:Date,ux=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Qp(){return kr||(ux(Y_),kr=fl.now()+bc)}function Y_(){kr=0}function Pu(){this._call=this._time=this._next=null}Pu.prototype=cx.prototype={constructor:Pu,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Qp():+n)+(e==null?0:+e),!this._next&&bo!==this&&(bo?bo._next=this:Mu=this,bo=this),this._call=t,this._time=n,Xf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xf())}};function cx(t,e,n){var i=new Pu;return i.restart(t,e,n),i}function Q_(){Qp(),++Rs;for(var t=Mu,e;t;)(e=kr-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rs}function w0(){kr=(Ou=fl.now())+bc,Rs=ko=0;try{Q_()}finally{Rs=0,G_(),kr=0}}function X_(){var t=fl.now(),e=t-Ou;e>ax&&(bc-=e,Ou=t)}function G_(){for(var t,e=Mu,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Mu=n);bo=t,Xf(i)}function Xf(t){if(!Rs){ko&&(ko=clearTimeout(ko));var e=t-kr;e>24?(t<1/0&&(ko=setTimeout(w0,t-fl.now()-bc)),oo&&(oo=clearInterval(oo))):(oo||(Ou=fl.now(),oo=setInterval(X_,ax)),Rs=1,ux(w0))}}function x0(t,e,n){var i=new Pu;return e=e==null?0:+e,i.restart(r=>{i.stop(),t(r+e)},e,n),i}var J_=Sc("start","end","cancel","interrupt"),Z_=[],hx=0,S0=1,Gf=2,Ka=3,k0=4,Jf=5,qa=6;function Cc(t,e,n,i,r,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;eT(t,n,{name:e,index:i,group:r,on:J_,tween:Z_,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:hx})}function Xp(t,e){var n=gn(t,e);if(n.state>hx)throw new Error("too late; already scheduled");return n}function zn(t,e){var n=gn(t,e);if(n.state>Ka)throw new Error("too late; already running");return n}function gn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function eT(t,e,n){var i=t.__transition,r;i[e]=n,n.timer=cx(s,0,n.time);function s(u){n.state=S0,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var c,h,f,d;if(n.state!==S0)return a();for(c in i)if(d=i[c],d.name===n.name){if(d.state===Ka)return x0(o);d.state===k0?(d.state=qa,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=qa,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(x0(function(){n.state===Ka&&(n.state=k0,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Gf,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Gf){for(n.state=Ka,r=new Array(f=n.tween.length),c=0,h=-1;c<f;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++h]=d);r.length=h+1}}function l(u){for(var c=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(a),n.state=Jf,1),h=-1,f=r.length;++h<f;)r[h].call(t,c);n.state===Jf&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){n.state=qa,n.timer.stop(),delete i[e];for(var u in i)return;delete t.__transition}}function Ya(t,e){var n=t.__transition,i,r,s=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((i=n[o]).name!==e){s=!1;continue}r=i.state>Gf&&i.state<Jf,i.state=qa,i.timer.stop(),i.on.call(r?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[o]}s&&delete t.__transition}}function tT(t){return this.each(function(){Ya(this,t)})}function nT(t,e){var n,i;return function(){var r=zn(this,t),s=r.tween;if(s!==n){i=n=s;for(var o=0,l=i.length;o<l;++o)if(i[o].name===e){i=i.slice(),i.splice(o,1);break}}r.tween=i}}function iT(t,e,n){var i,r;if(typeof n!="function")throw new Error;return function(){var s=zn(this,t),o=s.tween;if(o!==i){r=(i=o).slice();for(var l={name:e,value:n},a=0,u=r.length;a<u;++a)if(r[a].name===e){r[a]=l;break}a===u&&r.push(l)}s.tween=r}}function rT(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=gn(this.node(),n).tween,r=0,s=i.length,o;r<s;++r)if((o=i[r]).name===t)return o.value;return null}return this.each((e==null?nT:iT)(n,t,e))}function Gp(t,e,n){var i=t._id;return t.each(function(){var r=zn(this,i);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return gn(r,i).value[e]}}function fx(t,e){var n;return(typeof e=="number"?fi:e instanceof hl?g0:(n=hl(e))?(e=n,g0):$_)(t,e)}function sT(t){return function(){this.removeAttribute(t)}}function oT(t){return function(){this.removeAttributeNS(t.space,t.local)}}function lT(t,e,n){var i,r=n+"",s;return function(){var o=this.getAttribute(t);return o===r?null:o===i?s:s=e(i=o,n)}}function aT(t,e,n){var i,r=n+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===r?null:o===i?s:s=e(i=o,n)}}function uT(t,e,n){var i,r,s;return function(){var o,l=n(this),a;return l==null?void this.removeAttribute(t):(o=this.getAttribute(t),a=l+"",o===a?null:o===i&&a===r?s:(r=a,s=e(i=o,l)))}}function cT(t,e,n){var i,r,s;return function(){var o,l=n(this),a;return l==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),a=l+"",o===a?null:o===i&&a===r?s:(r=a,s=e(i=o,l)))}}function hT(t,e){var n=kc(t),i=n==="transform"?H_:fx;return this.attrTween(t,typeof e=="function"?(n.local?cT:uT)(n,i,Gp(this,"attr."+t,e)):e==null?(n.local?oT:sT)(n):(n.local?aT:lT)(n,i,e))}function fT(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function dT(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function pT(t,e){var n,i;function r(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&dT(t,s)),n}return r._value=e,r}function mT(t,e){var n,i;function r(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&fT(t,s)),n}return r._value=e,r}function gT(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=kc(t);return this.tween(n,(i.local?pT:mT)(i,e))}function yT(t,e){return function(){Xp(this,t).delay=+e.apply(this,arguments)}}function vT(t,e){return e=+e,function(){Xp(this,t).delay=e}}function wT(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?yT:vT)(e,t)):gn(this.node(),e).delay}function xT(t,e){return function(){zn(this,t).duration=+e.apply(this,arguments)}}function ST(t,e){return e=+e,function(){zn(this,t).duration=e}}function kT(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?xT:ST)(e,t)):gn(this.node(),e).duration}function bT(t,e){if(typeof e!="function")throw new Error;return function(){zn(this,t).ease=e}}function CT(t){var e=this._id;return arguments.length?this.each(bT(e,t)):gn(this.node(),e).ease}function ET(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;zn(this,t).ease=n}}function AT(t){if(typeof t!="function")throw new Error;return this.each(ET(this._id,t))}function NT(t){typeof t!="function"&&(t=Ww(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s=e[r],o=s.length,l=i[r]=[],a,u=0;u<o;++u)(a=s[u])&&t.call(a,a.__data__,u,s)&&l.push(a);return new ii(i,this._parents,this._name,this._id)}function _T(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,s=Math.min(i,r),o=new Array(i),l=0;l<s;++l)for(var a=e[l],u=n[l],c=a.length,h=o[l]=new Array(c),f,d=0;d<c;++d)(f=a[d]||u[d])&&(h[d]=f);for(;l<i;++l)o[l]=e[l];return new ii(o,this._parents,this._name,this._id)}function TT(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function MT(t,e,n){var i,r,s=TT(e)?Xp:zn;return function(){var o=s(this,t),l=o.on;l!==i&&(r=(i=l).copy()).on(e,n),o.on=r}}function OT(t,e){var n=this._id;return arguments.length<2?gn(this.node(),n).on.on(t):this.each(MT(n,t,e))}function PT(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function RT(){return this.on("end.remove",PT(this._id))}function IT(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Kp(t));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o<r;++o)for(var l=i[o],a=l.length,u=s[o]=new Array(a),c,h,f=0;f<a;++f)(c=l[f])&&(h=t.call(c,c.__data__,f,l))&&("__data__"in c&&(h.__data__=c.__data__),u[f]=h,Cc(u[f],e,n,f,u,gn(c,n)));return new ii(s,this._parents,e,n)}function DT(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Hw(t));for(var i=this._groups,r=i.length,s=[],o=[],l=0;l<r;++l)for(var a=i[l],u=a.length,c,h=0;h<u;++h)if(c=a[h]){for(var f=t.call(c,c.__data__,h,a),d,p=gn(c,n),y=0,x=f.length;y<x;++y)(d=f[y])&&Cc(d,e,n,y,f,p);s.push(f),o.push(c)}return new ii(s,o,e,n)}var LT=Pl.prototype.constructor;function BT(){return new LT(this._groups,this._parents)}function zT(t,e){var n,i,r;return function(){var s=Ps(this,t),o=(this.style.removeProperty(t),Ps(this,t));return s===o?null:s===n&&o===i?r:r=e(n=s,i=o)}}function dx(t){return function(){this.style.removeProperty(t)}}function $T(t,e,n){var i,r=n+"",s;return function(){var o=Ps(this,t);return o===r?null:o===i?s:s=e(i=o,n)}}function FT(t,e,n){var i,r,s;return function(){var o=Ps(this,t),l=n(this),a=l+"";return l==null&&(a=l=(this.style.removeProperty(t),Ps(this,t))),o===a?null:o===i&&a===r?s:(r=a,s=e(i=o,l))}}function jT(t,e){var n,i,r,s="style."+e,o="end."+s,l;return function(){var a=zn(this,t),u=a.on,c=a.value[s]==null?l||(l=dx(e)):void 0;(u!==n||r!==c)&&(i=(n=u).copy()).on(o,r=c),a.on=i}}function VT(t,e,n){var i=(t+="")=="transform"?V_:fx;return e==null?this.styleTween(t,zT(t,i)).on("end.style."+t,dx(t)):typeof e=="function"?this.styleTween(t,FT(t,i,Gp(this,"style."+t,e))).each(jT(this._id,t)):this.styleTween(t,$T(t,i,e),n).on("end.style."+t,null)}function HT(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function WT(t,e,n){var i,r;function s(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&HT(t,o,n)),i}return s._value=e,s}function UT(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,WT(t,e,n??""))}function KT(t){return function(){this.textContent=t}}function qT(t){return function(){var e=t(this);this.textContent=e??""}}function YT(t){return this.tween("text",typeof t=="function"?qT(Gp(this,"text",t)):KT(t==null?"":t+""))}function QT(t){return function(e){this.textContent=t.call(this,e)}}function XT(t){var e,n;function i(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&QT(r)),e}return i._value=t,i}function GT(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,XT(t))}function JT(){for(var t=this._name,e=this._id,n=px(),i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],l=o.length,a,u=0;u<l;++u)if(a=o[u]){var c=gn(a,e);Cc(a,t,n,u,o,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new ii(i,this._parents,t,n)}function ZT(){var t,e,n=this,i=n._id,r=n.size();return new Promise(function(s,o){var l={value:o},a={value:function(){--r===0&&s()}};n.each(function(){var u=zn(this,i),c=u.on;c!==t&&(e=(t=c).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(a)),u.on=e}),r===0&&s()})}var eM=0;function ii(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function px(){return++eM}var Vn=Pl.prototype;ii.prototype={constructor:ii,select:IT,selectAll:DT,selectChild:Vn.selectChild,selectChildren:Vn.selectChildren,filter:NT,merge:_T,selection:BT,transition:JT,call:Vn.call,nodes:Vn.nodes,node:Vn.node,size:Vn.size,empty:Vn.empty,each:Vn.each,on:OT,attr:hT,attrTween:gT,style:VT,styleTween:UT,text:YT,textTween:GT,remove:RT,tween:rT,delay:wT,duration:kT,ease:CT,easeVarying:AT,end:ZT,[Symbol.iterator]:Vn[Symbol.iterator]};function tM(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var nM={time:null,delay:0,duration:250,ease:tM};function iM(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function rM(t){var e,n;t instanceof ii?(e=t._id,t=t._name):(e=px(),(n=nM).time=Qp(),t=t==null?null:t+"");for(var i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],l=o.length,a,u=0;u<l;++u)(a=o[u])&&Cc(a,t,e,u,o,n||iM(a,e));return new ii(i,this._parents,t,e)}Pl.prototype.interrupt=tT;Pl.prototype.transition=rM;const aa=t=>()=>t;function sM(t,{sourceEvent:e,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function Qn(t,e,n){this.k=t,this.x=e,this.y=n}Qn.prototype={constructor:Qn,scale:function(t){return t===1?this:new Qn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Qn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ri=new Qn(1,0,0);Qn.prototype;function Sh(t){t.stopImmediatePropagation()}function lo(t){t.preventDefault(),t.stopImmediatePropagation()}function oM(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function lM(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function b0(){return this.__zoom||Ri}function aM(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function uM(){return navigator.maxTouchPoints||"ontouchstart"in this}function cM(t,e,n){var i=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function hM(){var t=oM,e=lM,n=cM,i=aM,r=uM,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,a=q_,u=Sc("start","zoom","end"),c,h,f,d=500,p=150,y=0,x=10;function m(S){S.property("__zoom",b0).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",L).filter(r).on("touchstart.zoom",B).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",A).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(S,I,O,j){var R=S.selection?S.selection():S;R.property("__zoom",b0),S!==R?k(S,I,O,j):R.interrupt().each(function(){C(this,arguments).event(j).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(S,I,O,j){m.scaleTo(S,function(){var R=this.__zoom.k,N=typeof I=="function"?I.apply(this,arguments):I;return R*N},O,j)},m.scaleTo=function(S,I,O,j){m.transform(S,function(){var R=e.apply(this,arguments),N=this.__zoom,T=O==null?w(R):typeof O=="function"?O.apply(this,arguments):O,z=N.invert(T),$=typeof I=="function"?I.apply(this,arguments):I;return n(v(g(N,$),T,z),R,o)},O,j)},m.translateBy=function(S,I,O,j){m.transform(S,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof O=="function"?O.apply(this,arguments):O),e.apply(this,arguments),o)},null,j)},m.translateTo=function(S,I,O,j,R){m.transform(S,function(){var N=e.apply(this,arguments),T=this.__zoom,z=j==null?w(N):typeof j=="function"?j.apply(this,arguments):j;return n(Ri.translate(z[0],z[1]).scale(T.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof O=="function"?-O.apply(this,arguments):-O),N,o)},j,R)};function g(S,I){return I=Math.max(s[0],Math.min(s[1],I)),I===S.k?S:new Qn(I,S.x,S.y)}function v(S,I,O){var j=I[0]-O[0]*S.k,R=I[1]-O[1]*S.k;return j===S.x&&R===S.y?S:new Qn(S.k,j,R)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function k(S,I,O,j){S.on("start.zoom",function(){C(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(j).end()}).tween("zoom",function(){var R=this,N=arguments,T=C(R,N).event(j),z=e.apply(R,N),$=O==null?w(z):typeof O=="function"?O.apply(R,N):O,W=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),U=R.__zoom,Q=typeof I=="function"?I.apply(R,N):I,te=a(U.invert($).concat(W/U.k),Q.invert($).concat(W/Q.k));return function(ne){if(ne===1)ne=Q;else{var he=te(ne),Ee=W/he[2];ne=new Qn(Ee,$[0]-he[0]*Ee,$[1]-he[1]*Ee)}T.zoom(null,ne)}})}function C(S,I,O){return!O&&S.__zooming||new E(S,I)}function E(S,I){this.that=S,this.args=I,this.active=0,this.sourceEvent=null,this.extent=e.apply(S,I),this.taps=0}E.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,I){return this.mouse&&S!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var I=on(this.that).datum();u.call(S,this.that,new sM(S,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),I)}};function _(S,...I){if(!t.apply(this,arguments))return;var O=C(this,I).event(S),j=this.__zoom,R=Math.max(s[0],Math.min(s[1],j.k*Math.pow(2,i.apply(this,arguments)))),N=Nn(S);if(O.wheel)(O.mouse[0][0]!==N[0]||O.mouse[0][1]!==N[1])&&(O.mouse[1]=j.invert(O.mouse[0]=N)),clearTimeout(O.wheel);else{if(j.k===R)return;O.mouse=[N,j.invert(N)],Ya(this),O.start()}lo(S),O.wheel=setTimeout(T,p),O.zoom("mouse",n(v(g(j,R),O.mouse[0],O.mouse[1]),O.extent,o));function T(){O.wheel=null,O.end()}}function D(S,...I){if(f||!t.apply(this,arguments))return;var O=S.currentTarget,j=C(this,I,!0).event(S),R=on(S.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",W,!0),N=Nn(S,O),T=S.clientX,z=S.clientY;ex(S.view),Sh(S),j.mouse=[N,this.__zoom.invert(N)],Ya(this),j.start();function $(U){if(lo(U),!j.moved){var Q=U.clientX-T,te=U.clientY-z;j.moved=Q*Q+te*te>y}j.event(U).zoom("mouse",n(v(j.that.__zoom,j.mouse[0]=Nn(U,O),j.mouse[1]),j.extent,o))}function W(U){R.on("mousemove.zoom mouseup.zoom",null),tx(U.view,j.moved),lo(U),j.event(U).end()}}function L(S,...I){if(t.apply(this,arguments)){var O=this.__zoom,j=Nn(S.changedTouches?S.changedTouches[0]:S,this),R=O.invert(j),N=O.k*(S.shiftKey?.5:2),T=n(v(g(O,N),j,R),e.apply(this,I),o);lo(S),l>0?on(this).transition().duration(l).call(k,T,j,S):on(this).call(m.transform,T,j,S)}}function B(S,...I){if(t.apply(this,arguments)){var O=S.touches,j=O.length,R=C(this,I,S.changedTouches.length===j).event(S),N,T,z,$;for(Sh(S),T=0;T<j;++T)z=O[T],$=Nn(z,this),$=[$,this.__zoom.invert($),z.identifier],R.touch0?!R.touch1&&R.touch0[2]!==$[2]&&(R.touch1=$,R.taps=0):(R.touch0=$,N=!0,R.taps=1+!!c);c&&(c=clearTimeout(c)),N&&(R.taps<2&&(h=$[0],c=setTimeout(function(){c=null},d)),Ya(this),R.start())}}function P(S,...I){if(this.__zooming){var O=C(this,I).event(S),j=S.changedTouches,R=j.length,N,T,z,$;for(lo(S),N=0;N<R;++N)T=j[N],z=Nn(T,this),O.touch0&&O.touch0[2]===T.identifier?O.touch0[0]=z:O.touch1&&O.touch1[2]===T.identifier&&(O.touch1[0]=z);if(T=O.that.__zoom,O.touch1){var W=O.touch0[0],U=O.touch0[1],Q=O.touch1[0],te=O.touch1[1],ne=(ne=Q[0]-W[0])*ne+(ne=Q[1]-W[1])*ne,he=(he=te[0]-U[0])*he+(he=te[1]-U[1])*he;T=g(T,Math.sqrt(ne/he)),z=[(W[0]+Q[0])/2,(W[1]+Q[1])/2],$=[(U[0]+te[0])/2,(U[1]+te[1])/2]}else if(O.touch0)z=O.touch0[0],$=O.touch0[1];else return;O.zoom("touch",n(v(T,z,$),O.extent,o))}}function A(S,...I){if(this.__zooming){var O=C(this,I).event(S),j=S.changedTouches,R=j.length,N,T;for(Sh(S),f&&clearTimeout(f),f=setTimeout(function(){f=null},d),N=0;N<R;++N)T=j[N],O.touch0&&O.touch0[2]===T.identifier?delete O.touch0:O.touch1&&O.touch1[2]===T.identifier&&delete O.touch1;if(O.touch1&&!O.touch0&&(O.touch0=O.touch1,delete O.touch1),O.touch0)O.touch0[1]=this.__zoom.invert(O.touch0[0]);else if(O.end(),O.taps===2&&(T=Nn(T,this),Math.hypot(h[0]-T[0],h[1]-T[1])<x)){var z=on(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return m.wheelDelta=function(S){return arguments.length?(i=typeof S=="function"?S:aa(+S),m):i},m.filter=function(S){return arguments.length?(t=typeof S=="function"?S:aa(!!S),m):t},m.touchable=function(S){return arguments.length?(r=typeof S=="function"?S:aa(!!S),m):r},m.extent=function(S){return arguments.length?(e=typeof S=="function"?S:aa([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),m):e},m.scaleExtent=function(S){return arguments.length?(s[0]=+S[0],s[1]=+S[1],m):[s[0],s[1]]},m.translateExtent=function(S){return arguments.length?(o[0][0]=+S[0][0],o[1][0]=+S[1][0],o[0][1]=+S[0][1],o[1][1]=+S[1][1],m):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},m.constrain=function(S){return arguments.length?(n=S,m):n},m.duration=function(S){return arguments.length?(l=+S,m):l},m.interpolate=function(S){return arguments.length?(a=S,m):a},m.on=function(){var S=u.on.apply(u,arguments);return S===u?m:S},m.clickDistance=function(S){return arguments.length?(y=(S=+S)*S,m):Math.sqrt(y)},m.tapDistance=function(S){return arguments.length?(x=+S,m):x},m}const Ec=M.createContext(null),fM=Ec.Provider,ri={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},mx=ri.error001();function Ce(t,e){const n=M.useContext(Ec);if(n===null)throw new Error(mx);return jw(n,t,e)}const We=()=>{const t=M.useContext(Ec);if(t===null)throw new Error(mx);return M.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},dM=t=>t.userSelectionActive?"none":"all";function gx({position:t,children:e,className:n,style:i,...r}){const s=Ce(dM),o=`${t}`.split("-");return F.createElement("div",{className:ft(["react-flow__panel",n,...o]),style:{...i,pointerEvents:s},...r},e)}function pM({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:F.createElement(gx,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},F.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const mM=({x:t,y:e,label:n,labelStyle:i={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:a,className:u,...c})=>{const h=M.useRef(null),[f,d]=M.useState({x:0,y:0,width:0,height:0}),p=ft(["react-flow__edge-textwrapper",u]);return M.useEffect(()=>{if(h.current){const y=h.current.getBBox();d({x:y.x,y:y.y,width:y.width,height:y.height})}},[n]),typeof n>"u"||!n?null:F.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c},r&&F.createElement("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),F.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:i},n),a)};var gM=M.memo(mM);const Jp=t=>({width:t.offsetWidth,height:t.offsetHeight}),Is=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Zp=(t={x:0,y:0},e)=>({x:Is(t.x,e[0][0],e[1][0]),y:Is(t.y,e[0][1],e[1][1])}),C0=(t,e,n)=>t<e?Is(Math.abs(t-e),1,50)/50:t>n?-Is(Math.abs(t-n),1,50)/50:0,yx=(t,e)=>{const n=C0(t.x,35,e.width-35)*20,i=C0(t.y,35,e.height-35)*20;return[n,i]},vx=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},yM=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),em=({x:t,y:e,width:n,height:i})=>({x:t,y:e,x2:t+n,y2:e+i}),vM=({x:t,y:e,x2:n,y2:i})=>({x:t,y:e,width:n-t,height:i-e}),E0=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Zf=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),i=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*i)},wM=t=>jt(t.width)&&jt(t.height)&&jt(t.x)&&jt(t.y),jt=t=>!isNaN(t)&&isFinite(t),_e=Symbol.for("internals"),wx=["Enter"," ","Escape"],xM=(t,e)=>{},SM=t=>"nativeEvent"in t;function ed(t){var r,s;const e=SM(t)?t.nativeEvent:t,n=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const xx=t=>"clientX"in t,Ii=(t,e)=>{var s,o;const n=xx(t),i=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(o=t.touches)==null?void 0:o[0].clientY;return{x:i-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Ru=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Il=({id:t,path:e,labelX:n,labelY:i,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:f,interactionWidth:d=20})=>F.createElement(F.Fragment,null,F.createElement("path",{id:t,style:c,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),d&&F.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}),r&&jt(n)&&jt(i)?F.createElement(gM,{x:n,y:i,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u}):null);Il.displayName="BaseEdge";function ao(t,e,n){return n===void 0?n:i=>{const r=e().edges.find(s=>s.id===t);r&&n(i,{...r})}}function Sx({sourceX:t,sourceY:e,targetX:n,targetY:i}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,o=Math.abs(i-e)/2,l=i<e?i+o:i-o;return[s,l,r,o]}function kx({sourceX:t,sourceY:e,targetX:n,targetY:i,sourceControlX:r,sourceControlY:s,targetControlX:o,targetControlY:l}){const a=t*.125+r*.375+o*.375+n*.125,u=e*.125+s*.375+l*.375+i*.125,c=Math.abs(a-t),h=Math.abs(u-e);return[a,u,c,h]}var br;(function(t){t.Strict="strict",t.Loose="loose"})(br||(br={}));var cr;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(cr||(cr={}));var dl;(function(t){t.Partial="partial",t.Full="full"})(dl||(dl={}));var vi;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(vi||(vi={}));var pl;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(pl||(pl={}));var G;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(G||(G={}));function A0({pos:t,x1:e,y1:n,x2:i,y2:r}){return t===G.Left||t===G.Right?[.5*(e+i),n]:[e,.5*(n+r)]}function bx({sourceX:t,sourceY:e,sourcePosition:n=G.Bottom,targetX:i,targetY:r,targetPosition:s=G.Top}){const[o,l]=A0({pos:n,x1:t,y1:e,x2:i,y2:r}),[a,u]=A0({pos:s,x1:i,y1:r,x2:t,y2:e}),[c,h,f,d]=kx({sourceX:t,sourceY:e,targetX:i,targetY:r,sourceControlX:o,sourceControlY:l,targetControlX:a,targetControlY:u});return[`M${t},${e} C${o},${l} ${a},${u} ${i},${r}`,c,h,f,d]}const tm=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:i,sourcePosition:r=G.Bottom,targetPosition:s=G.Top,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:d,markerStart:p,interactionWidth:y})=>{const[x,m,g]=bx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:i,targetPosition:s});return F.createElement(Il,{path:x,labelX:m,labelY:g,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:d,markerStart:p,interactionWidth:y})});tm.displayName="SimpleBezierEdge";const N0={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},kM=({source:t,sourcePosition:e=G.Bottom,target:n})=>e===G.Left||e===G.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},_0=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function bM({source:t,sourcePosition:e=G.Bottom,target:n,targetPosition:i=G.Top,center:r,offset:s}){const o=N0[e],l=N0[i],a={x:t.x+o.x*s,y:t.y+o.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},c=kM({source:a,sourcePosition:e,target:u}),h=c.x!==0?"x":"y",f=c[h];let d=[],p,y;const x={x:0,y:0},m={x:0,y:0},[g,v,w,k]=Sx({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(o[h]*l[h]===-1){p=r.x??g,y=r.y??v;const E=[{x:p,y:a.y},{x:p,y:u.y}],_=[{x:a.x,y},{x:u.x,y}];o[h]===f?d=h==="x"?E:_:d=h==="x"?_:E}else{const E=[{x:a.x,y:u.y}],_=[{x:u.x,y:a.y}];if(h==="x"?d=o.x===f?_:E:d=o.y===f?E:_,e===i){const A=Math.abs(t[h]-n[h]);if(A<=s){const S=Math.min(s-1,s-A);o[h]===f?x[h]=(a[h]>t[h]?-1:1)*S:m[h]=(u[h]>n[h]?-1:1)*S}}if(e!==i){const A=h==="x"?"y":"x",S=o[h]===l[A],I=a[A]>u[A],O=a[A]<u[A];(o[h]===1&&(!S&&I||S&&O)||o[h]!==1&&(!S&&O||S&&I))&&(d=h==="x"?E:_)}const D={x:a.x+x.x,y:a.y+x.y},L={x:u.x+m.x,y:u.y+m.y},B=Math.max(Math.abs(D.x-d[0].x),Math.abs(L.x-d[0].x)),P=Math.max(Math.abs(D.y-d[0].y),Math.abs(L.y-d[0].y));B>=P?(p=(D.x+L.x)/2,y=d[0].y):(p=d[0].x,y=(D.y+L.y)/2)}return[[t,{x:a.x+x.x,y:a.y+x.y},...d,{x:u.x+m.x,y:u.y+m.y},n],p,y,w,k]}function CM(t,e,n,i){const r=Math.min(_0(t,e)/2,_0(e,n)/2,i),{x:s,y:o}=e;if(t.x===s&&s===n.x||t.y===o&&o===n.y)return`L${s} ${o}`;if(t.y===o){const u=t.x<n.x?-1:1,c=t.y<n.y?1:-1;return`L ${s+r*u},${o}Q ${s},${o} ${s},${o+r*c}`}const l=t.x<n.x?1:-1,a=t.y<n.y?-1:1;return`L ${s},${o+r*a}Q ${s},${o} ${s+r*l},${o}`}function td({sourceX:t,sourceY:e,sourcePosition:n=G.Bottom,targetX:i,targetY:r,targetPosition:s=G.Top,borderRadius:o=5,centerX:l,centerY:a,offset:u=20}){const[c,h,f,d,p]=bM({source:{x:t,y:e},sourcePosition:n,target:{x:i,y:r},targetPosition:s,center:{x:l,y:a},offset:u});return[c.reduce((x,m,g)=>{let v="";return g>0&&g<c.length-1?v=CM(c[g-1],m,c[g+1],o):v=`${g===0?"M":"L"}${m.x} ${m.y}`,x+=v,x},""),h,f,d,p]}const Ac=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:i,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,sourcePosition:h=G.Bottom,targetPosition:f=G.Top,markerEnd:d,markerStart:p,pathOptions:y,interactionWidth:x})=>{const[m,g,v]=td({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:i,targetPosition:f,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset});return F.createElement(Il,{path:m,labelX:g,labelY:v,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:p,interactionWidth:x})});Ac.displayName="SmoothStepEdge";const nm=M.memo(t=>{var e;return F.createElement(Ac,{...t,pathOptions:M.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});nm.displayName="StepEdge";function EM({sourceX:t,sourceY:e,targetX:n,targetY:i}){const[r,s,o,l]=Sx({sourceX:t,sourceY:e,targetX:n,targetY:i});return[`M ${t},${e}L ${n},${i}`,r,s,o,l]}const im=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:i,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:f,interactionWidth:d})=>{const[p,y,x]=EM({sourceX:t,sourceY:e,targetX:n,targetY:i});return F.createElement(Il,{path:p,labelX:y,labelY:x,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:f,interactionWidth:d})});im.displayName="StraightEdge";function ua(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function T0({pos:t,x1:e,y1:n,x2:i,y2:r,c:s}){switch(t){case G.Left:return[e-ua(e-i,s),n];case G.Right:return[e+ua(i-e,s),n];case G.Top:return[e,n-ua(n-r,s)];case G.Bottom:return[e,n+ua(r-n,s)]}}function Cx({sourceX:t,sourceY:e,sourcePosition:n=G.Bottom,targetX:i,targetY:r,targetPosition:s=G.Top,curvature:o=.25}){const[l,a]=T0({pos:n,x1:t,y1:e,x2:i,y2:r,c:o}),[u,c]=T0({pos:s,x1:i,y1:r,x2:t,y2:e,c:o}),[h,f,d,p]=kx({sourceX:t,sourceY:e,targetX:i,targetY:r,sourceControlX:l,sourceControlY:a,targetControlX:u,targetControlY:c});return[`M${t},${e} C${l},${a} ${u},${c} ${i},${r}`,h,f,d,p]}const Iu=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:i,sourcePosition:r=G.Bottom,targetPosition:s=G.Top,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:d,markerStart:p,pathOptions:y,interactionWidth:x})=>{const[m,g,v]=Cx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:i,targetPosition:s,curvature:y==null?void 0:y.curvature});return F.createElement(Il,{path:m,labelX:g,labelY:v,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:d,markerStart:p,interactionWidth:x})});Iu.displayName="BezierEdge";const rm=M.createContext(null),AM=rm.Provider;rm.Consumer;const NM=()=>M.useContext(rm),_M=t=>"id"in t&&"source"in t&&"target"in t,TM=({source:t,sourceHandle:e,target:n,targetHandle:i})=>`reactflow__edge-${t}${e||""}-${n}${i||""}`,nd=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("&")}`,MM=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),OM=(t,e)=>{if(!t.source||!t.target)return e;let n;return _M(t)?n={...t}:n={...t,id:TM(t)},MM(n,e)?e:e.concat(n)},id=({x:t,y:e},[n,i,r],s,[o,l])=>{const a={x:(t-n)/r,y:(e-i)/r};return s?{x:o*Math.round(a.x/o),y:l*Math.round(a.y/l)}:a},Ex=({x:t,y:e},[n,i,r])=>({x:t*r+n,y:e*r+i}),gs=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],i=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-i};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-i}:r}},sm=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((i,r)=>{const{x:s,y:o}=gs(r,e).positionAbsolute;return yM(i,em({x:s,y:o,width:r.width||0,height:r.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return vM(n)},Ax=(t,e,[n,i,r]=[0,0,1],s=!1,o=!1,l=[0,0])=>{const a={x:(e.x-n)/r,y:(e.y-i)/r,width:e.width/r,height:e.height/r},u=[];return t.forEach(c=>{const{width:h,height:f,selectable:d=!0,hidden:p=!1}=c;if(o&&!d||p)return!1;const{positionAbsolute:y}=gs(c,l),x={x:y.x,y:y.y,width:h||0,height:f||0},m=Zf(a,x),g=typeof h>"u"||typeof f>"u"||h===null||f===null,v=s&&m>0,w=(h||0)*(f||0);(g||v||m>=w||c.dragging)&&u.push(c)}),u},Nx=(t,e)=>{const n=t.map(i=>i.id);return e.filter(i=>n.includes(i.source)||n.includes(i.target))},_x=(t,e,n,i,r,s=.1)=>{const o=e/(t.width*(1+s)),l=n/(t.height*(1+s)),a=Math.min(o,l),u=Is(a,i,r),c=t.x+t.width/2,h=t.y+t.height/2,f=e/2-c*u,d=n/2-h*u;return{x:f,y:d,zoom:u}},nr=(t,e=0)=>t.transition().duration(e);function M0(t,e,n,i){return(e[n]||[]).reduce((r,s)=>{var o,l;return`${t.id}-${s.id}-${n}`!==i&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((o=t.positionAbsolute)==null?void 0:o.x)??0)+s.x+s.width/2,y:(((l=t.positionAbsolute)==null?void 0:l.y)??0)+s.y+s.height/2}),r},[])}function PM(t,e,n,i,r,s){const{x:o,y:l}=Ii(t),u=e.elementsFromPoint(o,l).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const y=om(void 0,u),x=u.getAttribute("data-handleid"),m=s({nodeId:p,id:x,type:y});if(m){const g=r.find(v=>v.nodeId===p&&v.type===y&&v.id===x);return{handle:{id:x,type:y,nodeId:p,x:(g==null?void 0:g.x)||n.x,y:(g==null?void 0:g.y)||n.y},validHandleResult:m}}}}let c=[],h=1/0;if(r.forEach(p=>{const y=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(y<=i){const x=s(p);y<=h&&(y<h?c=[{handle:p,validHandleResult:x}]:y===h&&c.push({handle:p,validHandleResult:x}),h=y)}}),!c.length)return{handle:null,validHandleResult:Tx()};if(c.length===1)return c[0];const f=c.some(({validHandleResult:p})=>p.isValid),d=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:y})=>d?p.type==="target":f?y.isValid:!0)||c[0]}const RM={source:null,target:null,sourceHandle:null,targetHandle:null},Tx=()=>({handleDomNode:null,isValid:!1,connection:RM,endHandle:null});function Mx(t,e,n,i,r,s,o){const l=r==="target",a=o.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),u={...Tx(),handleDomNode:a};if(a){const c=om(void 0,a),h=a.getAttribute("data-nodeid"),f=a.getAttribute("data-handleid"),d=a.classList.contains("connectable"),p=a.classList.contains("connectableend"),y={source:l?h:n,sourceHandle:l?f:i,target:l?n:h,targetHandle:l?i:f};u.connection=y,d&&p&&(e===br.Strict?l&&c==="source"||!l&&c==="target":h!==n||f!==i)&&(u.endHandle={nodeId:h,handleId:f,type:c},u.isValid=s(y))}return u}function IM({nodes:t,nodeId:e,handleId:n,handleType:i}){return t.reduce((r,s)=>{if(s[_e]){const{handleBounds:o}=s[_e];let l=[],a=[];o&&(l=M0(s,o,"source",`${e}-${n}-${i}`),a=M0(s,o,"target",`${e}-${n}-${i}`)),r.push(...l,...a)}return r},[])}function om(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function kh(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function DM(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Ox({event:t,handleId:e,nodeId:n,onConnect:i,isTarget:r,getState:s,setState:o,isValidConnection:l,edgeUpdaterType:a,onReconnectEnd:u}){const c=vx(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:d,connectionRadius:p,onConnectStart:y,panBy:x,getNodes:m,cancelConnection:g}=s();let v=0,w;const{x:k,y:C}=Ii(t),E=c==null?void 0:c.elementFromPoint(k,C),_=om(a,E),D=f==null?void 0:f.getBoundingClientRect();if(!D||!_)return;let L,B=Ii(t,D),P=!1,A=null,S=!1,I=null;const O=IM({nodes:m(),nodeId:n,handleId:e,handleType:_}),j=()=>{if(!d)return;const[T,z]=yx(B,D);x({x:T,y:z}),v=requestAnimationFrame(j)};o({connectionPosition:B,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:_,connectionStartHandle:{nodeId:n,handleId:e,type:_},connectionEndHandle:null}),y==null||y(t,{nodeId:n,handleId:e,handleType:_});function R(T){const{transform:z}=s();B=Ii(T,D);const{handle:$,validHandleResult:W}=PM(T,c,id(B,z,!1,[1,1]),p,O,U=>Mx(U,h,n,e,r?"target":"source",l,c));if(w=$,P||(j(),P=!0),I=W.handleDomNode,A=W.connection,S=W.isValid,o({connectionPosition:w&&S?Ex({x:w.x,y:w.y},z):B,connectionStatus:DM(!!w,S),connectionEndHandle:W.endHandle}),!w&&!S&&!I)return kh(L);A.source!==A.target&&I&&(kh(L),L=I,I.classList.add("connecting","react-flow__handle-connecting"),I.classList.toggle("valid",S),I.classList.toggle("react-flow__handle-valid",S))}function N(T){var z,$;(w||I)&&A&&S&&(i==null||i(A)),($=(z=s()).onConnectEnd)==null||$.call(z,T),a&&(u==null||u(T)),kh(L),g(),cancelAnimationFrame(v),P=!1,S=!1,A=null,I=null,c.removeEventListener("mousemove",R),c.removeEventListener("mouseup",N),c.removeEventListener("touchmove",R),c.removeEventListener("touchend",N)}c.addEventListener("mousemove",R),c.addEventListener("mouseup",N),c.addEventListener("touchmove",R),c.addEventListener("touchend",N)}const O0=()=>!0,LM=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),BM=(t,e,n)=>i=>{const{connectionStartHandle:r,connectionEndHandle:s,connectionClickStartHandle:o}=i;return{connecting:(r==null?void 0:r.nodeId)===t&&(r==null?void 0:r.handleId)===e&&(r==null?void 0:r.type)===n||(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.handleId)===e&&(s==null?void 0:s.type)===n,clickConnecting:(o==null?void 0:o.nodeId)===t&&(o==null?void 0:o.handleId)===e&&(o==null?void 0:o.type)===n}},Px=M.forwardRef(({type:t="source",position:e=G.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:o,onConnect:l,children:a,className:u,onMouseDown:c,onTouchStart:h,...f},d)=>{var D,L;const p=o||null,y=t==="target",x=We(),m=NM(),{connectOnClick:g,noPanClassName:v}=Ce(LM,it),{connecting:w,clickConnecting:k}=Ce(BM(m,p,t),it);m||(L=(D=x.getState()).onError)==null||L.call(D,"010",ri.error010());const C=B=>{const{defaultEdgeOptions:P,onConnect:A,hasDefaultEdges:S}=x.getState(),I={...P,...B};if(S){const{edges:O,setEdges:j}=x.getState();j(OM(I,O))}A==null||A(I),l==null||l(I)},E=B=>{if(!m)return;const P=xx(B);r&&(P&&B.button===0||!P)&&Ox({event:B,handleId:p,nodeId:m,onConnect:C,isTarget:y,getState:x.getState,setState:x.setState,isValidConnection:n||x.getState().isValidConnection||O0}),P?c==null||c(B):h==null||h(B)},_=B=>{const{onClickConnectStart:P,onClickConnectEnd:A,connectionClickStartHandle:S,connectionMode:I,isValidConnection:O}=x.getState();if(!m||!S&&!r)return;if(!S){P==null||P(B,{nodeId:m,handleId:p,handleType:t}),x.setState({connectionClickStartHandle:{nodeId:m,type:t,handleId:p}});return}const j=vx(B.target),R=n||O||O0,{connection:N,isValid:T}=Mx({nodeId:m,id:p,type:t},I,S.nodeId,S.handleId||null,S.type,R,j);T&&C(N),A==null||A(B),x.setState({connectionClickStartHandle:null})};return F.createElement("div",{"data-handleid":p,"data-nodeid":m,"data-handlepos":e,"data-id":`${m}-${p}-${t}`,className:ft(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,u,{source:!y,target:y,connectable:i,connectablestart:r,connectableend:s,connecting:k,connectionindicator:i&&(r&&!w||s&&w)}]),onMouseDown:E,onTouchStart:E,onClick:g?_:void 0,ref:d,...f},a)});Px.displayName="Handle";var Ds=M.memo(Px);const Rx=({data:t,isConnectable:e,targetPosition:n=G.Top,sourcePosition:i=G.Bottom})=>F.createElement(F.Fragment,null,F.createElement(Ds,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,F.createElement(Ds,{type:"source",position:i,isConnectable:e}));Rx.displayName="DefaultNode";var rd=M.memo(Rx);const Ix=({data:t,isConnectable:e,sourcePosition:n=G.Bottom})=>F.createElement(F.Fragment,null,t==null?void 0:t.label,F.createElement(Ds,{type:"source",position:n,isConnectable:e}));Ix.displayName="InputNode";var Dx=M.memo(Ix);const Lx=({data:t,isConnectable:e,targetPosition:n=G.Top})=>F.createElement(F.Fragment,null,F.createElement(Ds,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Lx.displayName="OutputNode";var Bx=M.memo(Lx);const lm=()=>null;lm.displayName="GroupNode";const zM=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),ca=t=>t.id;function $M(t,e){return it(t.selectedNodes.map(ca),e.selectedNodes.map(ca))&&it(t.selectedEdges.map(ca),e.selectedEdges.map(ca))}const zx=M.memo(({onSelectionChange:t})=>{const e=We(),{selectedNodes:n,selectedEdges:i}=Ce(zM,$M);return M.useEffect(()=>{const r={nodes:n,edges:i};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,i,t]),null});zx.displayName="SelectionListener";const FM=t=>!!t.onSelectionChange;function jM({onSelectionChange:t}){const e=Ce(FM);return t||e?F.createElement(zx,{onSelectionChange:t}):null}const VM=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function zr(t,e){M.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function ie(t,e,n){M.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const HM=({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,onConnect:r,onConnectStart:s,onConnectEnd:o,onClickConnectStart:l,onClickConnectEnd:a,nodesDraggable:u,nodesConnectable:c,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:d,elevateNodesOnSelect:p,minZoom:y,maxZoom:x,nodeExtent:m,onNodesChange:g,onEdgesChange:v,elementsSelectable:w,connectionMode:k,snapGrid:C,snapToGrid:E,translateExtent:_,connectOnClick:D,defaultEdgeOptions:L,fitView:B,fitViewOptions:P,onNodesDelete:A,onEdgesDelete:S,onNodeDrag:I,onNodeDragStart:O,onNodeDragStop:j,onSelectionDrag:R,onSelectionDragStart:N,onSelectionDragStop:T,noPanClassName:z,nodeOrigin:$,rfId:W,autoPanOnConnect:U,autoPanOnNodeDrag:Q,onError:te,connectionRadius:ne,isValidConnection:he,nodeDragThreshold:Ee})=>{const{setNodes:ge,setEdges:Jt,setDefaultNodesAndEdges:Dt,setMinZoom:Zt,setMaxZoom:Lt,setTranslateExtent:Le,setNodeExtent:wn,reset:ye}=Ce(VM,it),J=We();return M.useEffect(()=>{const bt=i==null?void 0:i.map(Ki=>({...Ki,...L}));return Dt(n,bt),()=>{ye()}},[]),ie("defaultEdgeOptions",L,J.setState),ie("connectionMode",k,J.setState),ie("onConnect",r,J.setState),ie("onConnectStart",s,J.setState),ie("onConnectEnd",o,J.setState),ie("onClickConnectStart",l,J.setState),ie("onClickConnectEnd",a,J.setState),ie("nodesDraggable",u,J.setState),ie("nodesConnectable",c,J.setState),ie("nodesFocusable",h,J.setState),ie("edgesFocusable",f,J.setState),ie("edgesUpdatable",d,J.setState),ie("elementsSelectable",w,J.setState),ie("elevateNodesOnSelect",p,J.setState),ie("snapToGrid",E,J.setState),ie("snapGrid",C,J.setState),ie("onNodesChange",g,J.setState),ie("onEdgesChange",v,J.setState),ie("connectOnClick",D,J.setState),ie("fitViewOnInit",B,J.setState),ie("fitViewOnInitOptions",P,J.setState),ie("onNodesDelete",A,J.setState),ie("onEdgesDelete",S,J.setState),ie("onNodeDrag",I,J.setState),ie("onNodeDragStart",O,J.setState),ie("onNodeDragStop",j,J.setState),ie("onSelectionDrag",R,J.setState),ie("onSelectionDragStart",N,J.setState),ie("onSelectionDragStop",T,J.setState),ie("noPanClassName",z,J.setState),ie("nodeOrigin",$,J.setState),ie("rfId",W,J.setState),ie("autoPanOnConnect",U,J.setState),ie("autoPanOnNodeDrag",Q,J.setState),ie("onError",te,J.setState),ie("connectionRadius",ne,J.setState),ie("isValidConnection",he,J.setState),ie("nodeDragThreshold",Ee,J.setState),zr(t,ge),zr(e,Jt),zr(y,Zt),zr(x,Lt),zr(_,Le),zr(m,wn),null},P0={display:"none"},WM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$x="react-flow__node-desc",Fx="react-flow__edge-desc",UM="react-flow__aria-live",KM=t=>t.ariaLiveMessage;function qM({rfId:t}){const e=Ce(KM);return F.createElement("div",{id:`${UM}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:WM},e)}function YM({rfId:t,disableKeyboardA11y:e}){return F.createElement(F.Fragment,null,F.createElement("div",{id:`${$x}-${t}`,style:P0},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),F.createElement("div",{id:`${Fx}-${t}`,style:P0},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&F.createElement(qM,{rfId:t}))}var ml=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,i]=M.useState(!1),r=M.useRef(!1),s=M.useRef(new Set([])),[o,l]=M.useMemo(()=>{if(t!==null){const u=(Array.isArray(t)?t:[t]).filter(h=>typeof h=="string").map(h=>h.split("+")),c=u.reduce((h,f)=>h.concat(...f),[]);return[u,c]}return[[],[]]},[t]);return M.useEffect(()=>{const a=typeof document<"u"?document:null,u=(e==null?void 0:e.target)||a;if(t!==null){const c=d=>{if(r.current=d.ctrlKey||d.metaKey||d.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&ed(d))return!1;const y=I0(d.code,l);s.current.add(d[y]),R0(o,s.current,!1)&&(d.preventDefault(),i(!0))},h=d=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&ed(d))return!1;const y=I0(d.code,l);R0(o,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(d[y]),d.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),i(!1)};return u==null||u.addEventListener("keydown",c),u==null||u.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{u==null||u.removeEventListener("keydown",c),u==null||u.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,i]),n};function R0(t,e,n){return t.filter(i=>n||i.length===e.size).some(i=>i.every(r=>e.has(r)))}function I0(t,e){return e.includes(t)?"code":"key"}function jx(t,e,n,i){var l,a;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),o=gs(s,i);return jx(s,e,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((l=s[_e])==null?void 0:l.z)??0)>(n.z??0)?((a=s[_e])==null?void 0:a.z)??0:n.z??0},i)}function Vx(t,e,n){t.forEach(i=>{var s;const r=i.parentNode||i.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[i.id]){const{x:o,y:l,z:a}=jx(i,t,{...i.position,z:((s=i[_e])==null?void 0:s.z)??0},e);i.positionAbsolute={x:o,y:l},i[_e].z=a,n!=null&&n[i.id]&&(i[_e].isParent=!0)}})}function bh(t,e,n,i){const r=new Map,s={},o=i?1e3:0;return t.forEach(l=>{var d;const a=(jt(l.zIndex)?l.zIndex:0)+(l.selected?o:0),u=e.get(l.id),c={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},h=l.parentNode||l.parentId;h&&(s[h]=!0);const f=(u==null?void 0:u.type)&&(u==null?void 0:u.type)!==l.type;Object.defineProperty(c,_e,{enumerable:!1,value:{handleBounds:f||(d=u==null?void 0:u[_e])==null?void 0:d.handleBounds,z:a}}),r.set(l.id,c)}),Vx(r,n,s),r}function Hx(t,e={}){const{getNodes:n,width:i,height:r,minZoom:s,maxZoom:o,d3Zoom:l,d3Selection:a,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:h}=t(),f=e.initial&&!u&&c;if(l&&a&&(f||!e.initial)){const p=n().filter(x=>{var g;const m=e.includeHiddenNodes?x.width&&x.height:!x.hidden;return(g=e.nodes)!=null&&g.length?m&&e.nodes.some(v=>v.id===x.id):m}),y=p.every(x=>x.width&&x.height);if(p.length>0&&y){const x=sm(p,h),{x:m,y:g,zoom:v}=_x(x,i,r,e.minZoom??s,e.maxZoom??o,e.padding??.1),w=Ri.translate(m,g).scale(v);return typeof e.duration=="number"&&e.duration>0?l.transform(nr(a,e.duration),w):l.transform(a,w),!0}}return!1}function QM(t,e){return t.forEach(n=>{const i=e.get(n.id);i&&e.set(i.id,{...i,[_e]:i[_e],selected:n.selected})}),new Map(e)}function XM(t,e){return e.map(n=>{const i=t.find(r=>r.id===n.id);return i&&(n.selected=i.selected),n})}function ha({changedNodes:t,changedEdges:e,get:n,set:i}){const{nodeInternals:r,edges:s,onNodesChange:o,onEdgesChange:l,hasDefaultNodes:a,hasDefaultEdges:u}=n();t!=null&&t.length&&(a&&i({nodeInternals:QM(t,r)}),o==null||o(t)),e!=null&&e.length&&(u&&i({edges:XM(e,s)}),l==null||l(e))}const $r=()=>{},GM={zoomIn:$r,zoomOut:$r,zoomTo:$r,getZoom:()=>1,setViewport:$r,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:$r,fitBounds:$r,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},JM=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),ZM=()=>{const t=We(),{d3Zoom:e,d3Selection:n}=Ce(JM,it);return M.useMemo(()=>n&&e?{zoomIn:r=>e.scaleBy(nr(n,r==null?void 0:r.duration),1.2),zoomOut:r=>e.scaleBy(nr(n,r==null?void 0:r.duration),1/1.2),zoomTo:(r,s)=>e.scaleTo(nr(n,s==null?void 0:s.duration),r),getZoom:()=>t.getState().transform[2],setViewport:(r,s)=>{const[o,l,a]=t.getState().transform,u=Ri.translate(r.x??o,r.y??l).scale(r.zoom??a);e.transform(nr(n,s==null?void 0:s.duration),u)},getViewport:()=>{const[r,s,o]=t.getState().transform;return{x:r,y:s,zoom:o}},fitView:r=>Hx(t.getState,r),setCenter:(r,s,o)=>{const{width:l,height:a,maxZoom:u}=t.getState(),c=typeof(o==null?void 0:o.zoom)<"u"?o.zoom:u,h=l/2-r*c,f=a/2-s*c,d=Ri.translate(h,f).scale(c);e.transform(nr(n,o==null?void 0:o.duration),d)},fitBounds:(r,s)=>{const{width:o,height:l,minZoom:a,maxZoom:u}=t.getState(),{x:c,y:h,zoom:f}=_x(r,o,l,a,u,(s==null?void 0:s.padding)??.1),d=Ri.translate(c,h).scale(f);e.transform(nr(n,s==null?void 0:s.duration),d)},project:r=>{const{transform:s,snapToGrid:o,snapGrid:l}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),id(r,s,o,l)},screenToFlowPosition:r=>{const{transform:s,snapToGrid:o,snapGrid:l,domNode:a}=t.getState();if(!a)return r;const{x:u,y:c}=a.getBoundingClientRect(),h={x:r.x-u,y:r.y-c};return id(h,s,o,l)},flowToScreenPosition:r=>{const{transform:s,domNode:o}=t.getState();if(!o)return r;const{x:l,y:a}=o.getBoundingClientRect(),u=Ex(r,s);return{x:u.x+l,y:u.y+a}},viewportInitialized:!0}:GM,[e,n])};function Nc(){const t=ZM(),e=We(),n=M.useCallback(()=>e.getState().getNodes().map(y=>({...y})),[]),i=M.useCallback(y=>e.getState().nodeInternals.get(y),[]),r=M.useCallback(()=>{const{edges:y=[]}=e.getState();return y.map(x=>({...x}))},[]),s=M.useCallback(y=>{const{edges:x=[]}=e.getState();return x.find(m=>m.id===y)},[]),o=M.useCallback(y=>{const{getNodes:x,setNodes:m,hasDefaultNodes:g,onNodesChange:v}=e.getState(),w=x(),k=typeof y=="function"?y(w):y;if(g)m(k);else if(v){const C=k.length===0?w.map(E=>({type:"remove",id:E.id})):k.map(E=>({item:E,type:"reset"}));v(C)}},[]),l=M.useCallback(y=>{const{edges:x=[],setEdges:m,hasDefaultEdges:g,onEdgesChange:v}=e.getState(),w=typeof y=="function"?y(x):y;if(g)m(w);else if(v){const k=w.length===0?x.map(C=>({type:"remove",id:C.id})):w.map(C=>({item:C,type:"reset"}));v(k)}},[]),a=M.useCallback(y=>{const x=Array.isArray(y)?y:[y],{getNodes:m,setNodes:g,hasDefaultNodes:v,onNodesChange:w}=e.getState();if(v){const C=[...m(),...x];g(C)}else if(w){const k=x.map(C=>({item:C,type:"add"}));w(k)}},[]),u=M.useCallback(y=>{const x=Array.isArray(y)?y:[y],{edges:m=[],setEdges:g,hasDefaultEdges:v,onEdgesChange:w}=e.getState();if(v)g([...m,...x]);else if(w){const k=x.map(C=>({item:C,type:"add"}));w(k)}},[]),c=M.useCallback(()=>{const{getNodes:y,edges:x=[],transform:m}=e.getState(),[g,v,w]=m;return{nodes:y().map(k=>({...k})),edges:x.map(k=>({...k})),viewport:{x:g,y:v,zoom:w}}},[]),h=M.useCallback(({nodes:y,edges:x})=>{const{nodeInternals:m,getNodes:g,edges:v,hasDefaultNodes:w,hasDefaultEdges:k,onNodesDelete:C,onEdgesDelete:E,onNodesChange:_,onEdgesChange:D}=e.getState(),L=(y||[]).map(I=>I.id),B=(x||[]).map(I=>I.id),P=g().reduce((I,O)=>{const j=O.parentNode||O.parentId,R=!L.includes(O.id)&&j&&I.find(T=>T.id===j);return(typeof O.deletable=="boolean"?O.deletable:!0)&&(L.includes(O.id)||R)&&I.push(O),I},[]),A=v.filter(I=>typeof I.deletable=="boolean"?I.deletable:!0),S=A.filter(I=>B.includes(I.id));if(P||S){const I=Nx(P,A),O=[...S,...I],j=O.reduce((R,N)=>(R.includes(N.id)||R.push(N.id),R),[]);if((k||w)&&(k&&e.setState({edges:v.filter(R=>!j.includes(R.id))}),w&&(P.forEach(R=>{m.delete(R.id)}),e.setState({nodeInternals:new Map(m)}))),j.length>0&&(E==null||E(O),D&&D(j.map(R=>({id:R,type:"remove"})))),P.length>0&&(C==null||C(P),_)){const R=P.map(N=>({id:N.id,type:"remove"}));_(R)}}},[]),f=M.useCallback(y=>{const x=wM(y),m=x?null:e.getState().nodeInternals.get(y.id);return!x&&!m?[null,null,x]:[x?y:E0(m),m,x]},[]),d=M.useCallback((y,x=!0,m)=>{const[g,v,w]=f(y);return g?(m||e.getState().getNodes()).filter(k=>{if(!w&&(k.id===v.id||!k.positionAbsolute))return!1;const C=E0(k),E=Zf(C,g);return x&&E>0||E>=g.width*g.height}):[]},[]),p=M.useCallback((y,x,m=!0)=>{const[g]=f(y);if(!g)return!1;const v=Zf(g,x);return m&&v>0||v>=g.width*g.height},[]);return M.useMemo(()=>({...t,getNodes:n,getNode:i,getEdges:r,getEdge:s,setNodes:o,setEdges:l,addNodes:a,addEdges:u,toObject:c,deleteElements:h,getIntersectingNodes:d,isNodeIntersecting:p}),[t,n,i,r,s,o,l,a,u,c,h,d,p])}const eO={actInsideInputWithModifier:!1};var tO=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=We(),{deleteElements:i}=Nc(),r=ml(t,eO),s=ml(e);M.useEffect(()=>{if(r){const{edges:o,getNodes:l}=n.getState(),a=l().filter(c=>c.selected),u=o.filter(c=>c.selected);i({nodes:a,edges:u}),n.setState({nodesSelectionActive:!1})}},[r]),M.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])};function nO(t){const e=We();M.useEffect(()=>{let n;const i=()=>{var s,o;if(!t.current)return;const r=Jp(t.current);(r.height===0||r.width===0)&&((o=(s=e.getState()).onError)==null||o.call(s,"004",ri.error004())),e.setState({width:r.width||500,height:r.height||500})};return i(),window.addEventListener("resize",i),t.current&&(n=new ResizeObserver(()=>i()),n.observe(t.current)),()=>{window.removeEventListener("resize",i),n&&t.current&&n.unobserve(t.current)}},[])}const am={position:"absolute",width:"100%",height:"100%",top:0,left:0},iO=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,fa=t=>({x:t.x,y:t.y,zoom:t.k}),Fr=(t,e)=>t.target.closest(`.${e}`),D0=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),L0=t=>{const e=t.ctrlKey&&Ru()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},rO=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),sO=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:i,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:o=!1,panOnScrollSpeed:l=.5,panOnScrollMode:a=cr.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:h=!0,defaultViewport:f,translateExtent:d,minZoom:p,maxZoom:y,zoomActivationKeyCode:x,preventScrolling:m=!0,children:g,noWheelClassName:v,noPanClassName:w})=>{const k=M.useRef(),C=We(),E=M.useRef(!1),_=M.useRef(!1),D=M.useRef(null),L=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:B,d3Selection:P,d3ZoomHandler:A,userSelectionActive:S}=Ce(rO,it),I=ml(x),O=M.useRef(0),j=M.useRef(!1),R=M.useRef();return nO(D),M.useEffect(()=>{if(D.current){const N=D.current.getBoundingClientRect(),T=hM().scaleExtent([p,y]).translateExtent(d),z=on(D.current).call(T),$=Ri.translate(f.x,f.y).scale(Is(f.zoom,p,y)),W=[[0,0],[N.width,N.height]],U=T.constrain()($,W,d);T.transform(z,U),T.wheelDelta(L0),C.setState({d3Zoom:T,d3Selection:z,d3ZoomHandler:z.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:D.current.closest(".react-flow")})}},[]),M.useEffect(()=>{P&&B&&(o&&!I&&!S?P.on("wheel.zoom",N=>{if(Fr(N,v))return!1;N.preventDefault(),N.stopImmediatePropagation();const T=P.property("__zoom").k||1;if(N.ctrlKey&&s){const he=Nn(N),Ee=L0(N),ge=T*Math.pow(2,Ee);B.scaleTo(P,ge,he,N);return}const z=N.deltaMode===1?20:1;let $=a===cr.Vertical?0:N.deltaX*z,W=a===cr.Horizontal?0:N.deltaY*z;!Ru()&&N.shiftKey&&a!==cr.Vertical&&($=N.deltaY*z,W=0),B.translateBy(P,-($/T)*l,-(W/T)*l,{internal:!0});const U=fa(P.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:te,onViewportChangeEnd:ne}=C.getState();clearTimeout(R.current),j.current||(j.current=!0,e==null||e(N,U),Q==null||Q(U)),j.current&&(t==null||t(N,U),te==null||te(U),R.current=setTimeout(()=>{n==null||n(N,U),ne==null||ne(U),j.current=!1},150))},{passive:!1}):typeof A<"u"&&P.on("wheel.zoom",function(N,T){if(!m&&N.type==="wheel"&&!N.ctrlKey||Fr(N,v))return null;N.preventDefault(),A.call(this,N,T)},{passive:!1}))},[S,o,a,P,B,A,I,s,m,v,e,t,n]),M.useEffect(()=>{B&&B.on("start",N=>{var $,W;if(!N.sourceEvent||N.sourceEvent.internal)return null;O.current=($=N.sourceEvent)==null?void 0:$.button;const{onViewportChangeStart:T}=C.getState(),z=fa(N.transform);E.current=!0,L.current=z,((W=N.sourceEvent)==null?void 0:W.type)==="mousedown"&&C.setState({paneDragging:!0}),T==null||T(z),e==null||e(N.sourceEvent,z)})},[B,e]),M.useEffect(()=>{B&&(S&&!E.current?B.on("zoom",null):S||B.on("zoom",N=>{var z;const{onViewportChange:T}=C.getState();if(C.setState({transform:[N.transform.x,N.transform.y,N.transform.k]}),_.current=!!(i&&D0(h,O.current??0)),(t||T)&&!((z=N.sourceEvent)!=null&&z.internal)){const $=fa(N.transform);T==null||T($),t==null||t(N.sourceEvent,$)}}))},[S,B,t,h,i]),M.useEffect(()=>{B&&B.on("end",N=>{if(!N.sourceEvent||N.sourceEvent.internal)return null;const{onViewportChangeEnd:T}=C.getState();if(E.current=!1,C.setState({paneDragging:!1}),i&&D0(h,O.current??0)&&!_.current&&i(N.sourceEvent),_.current=!1,(n||T)&&iO(L.current,N.transform)){const z=fa(N.transform);L.current=z,clearTimeout(k.current),k.current=setTimeout(()=>{T==null||T(z),n==null||n(N.sourceEvent,z)},o?150:0)}})},[B,o,h,n,i]),M.useEffect(()=>{B&&B.filter(N=>{const T=I||r,z=s&&N.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&N.button===1&&N.type==="mousedown"&&(Fr(N,"react-flow__node")||Fr(N,"react-flow__edge")))return!0;if(!h&&!T&&!o&&!u&&!s||S||!u&&N.type==="dblclick"||Fr(N,v)&&N.type==="wheel"||Fr(N,w)&&(N.type!=="wheel"||o&&N.type==="wheel"&&!I)||!s&&N.ctrlKey&&N.type==="wheel"||!T&&!o&&!z&&N.type==="wheel"||!h&&(N.type==="mousedown"||N.type==="touchstart")||Array.isArray(h)&&!h.includes(N.button)&&N.type==="mousedown")return!1;const $=Array.isArray(h)&&h.includes(N.button)||!N.button||N.button<=1;return(!N.ctrlKey||N.type==="wheel")&&$})},[S,B,r,s,o,u,h,c,I]),F.createElement("div",{className:"react-flow__renderer",ref:D,style:am},g)},oO=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function lO(){const{userSelectionActive:t,userSelectionRect:e}=Ce(oO,it);return t&&e?F.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function B0(t,e){const n=e.parentNode||e.parentId,i=t.find(r=>r.id===n);if(i){const r=e.position.x+e.width-i.width,s=e.position.y+e.height-i.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,r>0&&(i.style.width+=r),s>0&&(i.style.height+=s),e.position.x<0){const o=Math.abs(e.position.x);i.position.x=i.position.x-o,i.style.width+=o,e.position.x=0}if(e.position.y<0){const o=Math.abs(e.position.y);i.position.y=i.position.y-o,i.style.height+=o,e.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function aO(t,e){if(t.some(i=>i.type==="reset"))return t.filter(i=>i.type==="reset").map(i=>i.item);const n=t.filter(i=>i.type==="add").map(i=>i.item);return e.reduce((i,r)=>{const s=t.filter(l=>l.id===r.id);if(s.length===0)return i.push(r),i;const o={...r};for(const l of s)if(l)switch(l.type){case"select":{o.selected=l.selected;break}case"position":{typeof l.position<"u"&&(o.position=l.position),typeof l.positionAbsolute<"u"&&(o.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(o.dragging=l.dragging),o.expandParent&&B0(i,o);break}case"dimensions":{typeof l.dimensions<"u"&&(o.width=l.dimensions.width,o.height=l.dimensions.height),typeof l.updateStyle<"u"&&(o.style={...o.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(o.resizing=l.resizing),o.expandParent&&B0(i,o);break}case"remove":return i}return i.push(o),i},n)}function uO(t,e){return aO(t,e)}const di=(t,e)=>({id:t,type:"select",selected:e});function ns(t,e){return t.reduce((n,i)=>{const r=e.includes(i.id);return!i.selected&&r?(i.selected=!0,n.push(di(i.id,!0))):i.selected&&!r&&(i.selected=!1,n.push(di(i.id,!1))),n},[])}const Ch=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},cO=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Wx=M.memo(({isSelecting:t,selectionMode:e=dl.Full,panOnDrag:n,onSelectionStart:i,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:o,onPaneScroll:l,onPaneMouseEnter:a,onPaneMouseMove:u,onPaneMouseLeave:c,children:h})=>{const f=M.useRef(null),d=We(),p=M.useRef(0),y=M.useRef(0),x=M.useRef(),{userSelectionActive:m,elementsSelectable:g,dragging:v}=Ce(cO,it),w=()=>{d.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,y.current=0},k=A=>{s==null||s(A),d.getState().resetSelectedElements(),d.setState({nodesSelectionActive:!1})},C=A=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){A.preventDefault();return}o==null||o(A)},E=l?A=>l(A):void 0,_=A=>{const{resetSelectedElements:S,domNode:I}=d.getState();if(x.current=I==null?void 0:I.getBoundingClientRect(),!g||!t||A.button!==0||A.target!==f.current||!x.current)return;const{x:O,y:j}=Ii(A,x.current);S(),d.setState({userSelectionRect:{width:0,height:0,startX:O,startY:j,x:O,y:j}}),i==null||i(A)},D=A=>{const{userSelectionRect:S,nodeInternals:I,edges:O,transform:j,onNodesChange:R,onEdgesChange:N,nodeOrigin:T,getNodes:z}=d.getState();if(!t||!x.current||!S)return;d.setState({userSelectionActive:!0,nodesSelectionActive:!1});const $=Ii(A,x.current),W=S.startX??0,U=S.startY??0,Q={...S,x:$.x<W?$.x:W,y:$.y<U?$.y:U,width:Math.abs($.x-W),height:Math.abs($.y-U)},te=z(),ne=Ax(I,Q,j,e===dl.Partial,!0,T),he=Nx(ne,O).map(ge=>ge.id),Ee=ne.map(ge=>ge.id);if(p.current!==Ee.length){p.current=Ee.length;const ge=ns(te,Ee);ge.length&&(R==null||R(ge))}if(y.current!==he.length){y.current=he.length;const ge=ns(O,he);ge.length&&(N==null||N(ge))}d.setState({userSelectionRect:Q})},L=A=>{if(A.button!==0)return;const{userSelectionRect:S}=d.getState();!m&&S&&A.target===f.current&&(k==null||k(A)),d.setState({nodesSelectionActive:p.current>0}),w(),r==null||r(A)},B=A=>{m&&(d.setState({nodesSelectionActive:p.current>0}),r==null||r(A)),w()},P=g&&(t||m);return F.createElement("div",{className:ft(["react-flow__pane",{dragging:v,selection:t}]),onClick:P?void 0:Ch(k,f),onContextMenu:Ch(C,f),onWheel:Ch(E,f),onMouseEnter:P?void 0:a,onMouseDown:P?_:void 0,onMouseMove:P?D:u,onMouseUp:P?L:void 0,onMouseLeave:P?B:c,ref:f,style:am},h,F.createElement(lO,null))});Wx.displayName="Pane";function Ux(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const i=e.get(n);return i?i.selected?!0:Ux(i,e):!1}function z0(t,e,n){let i=t;do{if(i!=null&&i.matches(e))return!0;if(i===n.current)return!1;i=i.parentElement}while(i);return!1}function hO(t,e,n,i){return Array.from(t.values()).filter(r=>(r.selected||r.id===i)&&(!r.parentNode||r.parentId||!Ux(r,t))&&(r.draggable||e&&typeof r.draggable>"u")).map(r=>{var s,o;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((o=r.positionAbsolute)==null?void 0:o.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function fO(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function Kx(t,e,n,i,r=[0,0],s){const o=fO(t,t.extent||i);let l=o;const a=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(a&&t.width&&t.height){const h=n.get(a),{x:f,y:d}=gs(h,r).positionAbsolute;l=h&&jt(f)&&jt(d)&&jt(h.width)&&jt(h.height)?[[f+t.width*r[0],d+t.height*r[1]],[f+h.width-t.width+t.width*r[0],d+h.height-t.height+t.height*r[1]]]:l}else s==null||s("005",ri.error005()),l=o;else if(t.extent&&a&&t.extent!=="parent"){const h=n.get(a),{x:f,y:d}=gs(h,r).positionAbsolute;l=[[t.extent[0][0]+f,t.extent[0][1]+d],[t.extent[1][0]+f,t.extent[1][1]+d]]}let u={x:0,y:0};if(a){const h=n.get(a);u=gs(h,r).positionAbsolute}const c=l&&l!=="parent"?Zp(e,l):e;return{position:{x:c.x-u.x,y:c.y-u.y},positionAbsolute:c}}function Eh({nodeId:t,dragItems:e,nodeInternals:n}){const i=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?i.find(r=>r.id===t):i[0],i]}const $0=(t,e,n,i)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),o=e.getBoundingClientRect(),l={x:o.width*i[0],y:o.height*i[1]};return s.map(a=>{const u=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(u.left-o.left-l.x)/n,y:(u.top-o.top-l.y)/n,...Jp(a)}})};function uo(t,e,n){return n===void 0?n:i=>{const r=e().nodeInternals.get(t);r&&n(i,{...r})}}function sd({id:t,store:e,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:o,nodeInternals:l,onError:a}=e.getState(),u=l.get(t);if(!u){a==null||a("012",ri.error012(t));return}e.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var c;return(c=i==null?void 0:i.current)==null?void 0:c.blur()})):r([t])}function dO(){const t=We();return M.useCallback(({sourceEvent:n})=>{const{transform:i,snapGrid:r,snapToGrid:s}=t.getState(),o=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,a={x:(o-i[0])/i[2],y:(l-i[1])/i[2]};return{xSnapped:s?r[0]*Math.round(a.x/r[0]):a.x,ySnapped:s?r[1]*Math.round(a.y/r[1]):a.y,...a}},[])}function Ah(t){return(e,n,i)=>t==null?void 0:t(e,i)}function qx({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,selectNodesOnDrag:o}){const l=We(),[a,u]=M.useState(!1),c=M.useRef([]),h=M.useRef({x:null,y:null}),f=M.useRef(0),d=M.useRef(null),p=M.useRef({x:0,y:0}),y=M.useRef(null),x=M.useRef(!1),m=M.useRef(!1),g=M.useRef(!1),v=dO();return M.useEffect(()=>{if(t!=null&&t.current){const w=on(t.current),k=({x:_,y:D})=>{const{nodeInternals:L,onNodeDrag:B,onSelectionDrag:P,updateNodePositions:A,nodeExtent:S,snapGrid:I,snapToGrid:O,nodeOrigin:j,onError:R}=l.getState();h.current={x:_,y:D};let N=!1,T={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&S){const $=sm(c.current,j);T=em($)}if(c.current=c.current.map($=>{const W={x:_-$.distance.x,y:D-$.distance.y};O&&(W.x=I[0]*Math.round(W.x/I[0]),W.y=I[1]*Math.round(W.y/I[1]));const U=[[S[0][0],S[0][1]],[S[1][0],S[1][1]]];c.current.length>1&&S&&!$.extent&&(U[0][0]=$.positionAbsolute.x-T.x+S[0][0],U[1][0]=$.positionAbsolute.x+($.width??0)-T.x2+S[1][0],U[0][1]=$.positionAbsolute.y-T.y+S[0][1],U[1][1]=$.positionAbsolute.y+($.height??0)-T.y2+S[1][1]);const Q=Kx($,W,L,U,j,R);return N=N||$.position.x!==Q.position.x||$.position.y!==Q.position.y,$.position=Q.position,$.positionAbsolute=Q.positionAbsolute,$}),!N)return;A(c.current,!0,!0),u(!0);const z=r?B:Ah(P);if(z&&y.current){const[$,W]=Eh({nodeId:r,dragItems:c.current,nodeInternals:L});z(y.current,$,W)}},C=()=>{if(!d.current)return;const[_,D]=yx(p.current,d.current);if(_!==0||D!==0){const{transform:L,panBy:B}=l.getState();h.current.x=(h.current.x??0)-_/L[2],h.current.y=(h.current.y??0)-D/L[2],B({x:_,y:D})&&k(h.current)}f.current=requestAnimationFrame(C)},E=_=>{var j;const{nodeInternals:D,multiSelectionActive:L,nodesDraggable:B,unselectNodesAndEdges:P,onNodeDragStart:A,onSelectionDragStart:S}=l.getState();m.current=!0;const I=r?A:Ah(S);(!o||!s)&&!L&&r&&((j=D.get(r))!=null&&j.selected||P()),r&&s&&o&&sd({id:r,store:l,nodeRef:t});const O=v(_);if(h.current=O,c.current=hO(D,B,O,r),I&&c.current){const[R,N]=Eh({nodeId:r,dragItems:c.current,nodeInternals:D});I(_.sourceEvent,R,N)}};if(e)w.on(".drag",null);else{const _=S_().on("start",D=>{const{domNode:L,nodeDragThreshold:B}=l.getState();B===0&&E(D),g.current=!1;const P=v(D);h.current=P,d.current=(L==null?void 0:L.getBoundingClientRect())||null,p.current=Ii(D.sourceEvent,d.current)}).on("drag",D=>{var A,S;const L=v(D),{autoPanOnNodeDrag:B,nodeDragThreshold:P}=l.getState();if(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1&&(g.current=!0),!g.current){if(!x.current&&m.current&&B&&(x.current=!0,C()),!m.current){const I=L.xSnapped-(((A=h==null?void 0:h.current)==null?void 0:A.x)??0),O=L.ySnapped-(((S=h==null?void 0:h.current)==null?void 0:S.y)??0);Math.sqrt(I*I+O*O)>P&&E(D)}(h.current.x!==L.xSnapped||h.current.y!==L.ySnapped)&&c.current&&m.current&&(y.current=D.sourceEvent,p.current=Ii(D.sourceEvent,d.current),k(L))}}).on("end",D=>{if(!(!m.current||g.current)&&(u(!1),x.current=!1,m.current=!1,cancelAnimationFrame(f.current),c.current)){const{updateNodePositions:L,nodeInternals:B,onNodeDragStop:P,onSelectionDragStop:A}=l.getState(),S=r?P:Ah(A);if(L(c.current,!1,!1),S){const[I,O]=Eh({nodeId:r,dragItems:c.current,nodeInternals:B});S(D.sourceEvent,I,O)}}}).filter(D=>{const L=D.target;return!D.button&&(!n||!z0(L,`.${n}`,t))&&(!i||z0(L,i,t))});return w.call(_),()=>{w.on(".drag",null)}}}},[t,e,n,i,s,l,r,o,v]),a}function Yx(){const t=We();return M.useCallback(n=>{const{nodeInternals:i,nodeExtent:r,updateNodePositions:s,getNodes:o,snapToGrid:l,snapGrid:a,onError:u,nodesDraggable:c}=t.getState(),h=o().filter(g=>g.selected&&(g.draggable||c&&typeof g.draggable>"u")),f=l?a[0]:5,d=l?a[1]:5,p=n.isShiftPressed?4:1,y=n.x*f*p,x=n.y*d*p,m=h.map(g=>{if(g.positionAbsolute){const v={x:g.positionAbsolute.x+y,y:g.positionAbsolute.y+x};l&&(v.x=a[0]*Math.round(v.x/a[0]),v.y=a[1]*Math.round(v.y/a[1]));const{positionAbsolute:w,position:k}=Kx(g,v,i,r,void 0,u);g.position=k,g.positionAbsolute=w}return g});s(m,!0,!1)},[])}const ys={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var co=t=>{const e=({id:n,type:i,data:r,xPos:s,yPos:o,xPosOrigin:l,yPosOrigin:a,selected:u,onClick:c,onMouseEnter:h,onMouseMove:f,onMouseLeave:d,onContextMenu:p,onDoubleClick:y,style:x,className:m,isDraggable:g,isSelectable:v,isConnectable:w,isFocusable:k,selectNodesOnDrag:C,sourcePosition:E,targetPosition:_,hidden:D,resizeObserver:L,dragHandle:B,zIndex:P,isParent:A,noDragClassName:S,noPanClassName:I,initialized:O,disableKeyboardA11y:j,ariaLabel:R,rfId:N,hasHandleBounds:T})=>{const z=We(),$=M.useRef(null),W=M.useRef(null),U=M.useRef(E),Q=M.useRef(_),te=M.useRef(i),ne=v||g||c||h||f||d,he=Yx(),Ee=uo(n,z.getState,h),ge=uo(n,z.getState,f),Jt=uo(n,z.getState,d),Dt=uo(n,z.getState,p),Zt=uo(n,z.getState,y),Lt=ye=>{const{nodeDragThreshold:J}=z.getState();if(v&&(!C||!g||J>0)&&sd({id:n,store:z,nodeRef:$}),c){const bt=z.getState().nodeInternals.get(n);bt&&c(ye,{...bt})}},Le=ye=>{if(!ed(ye)&&!j)if(wx.includes(ye.key)&&v){const J=ye.key==="Escape";sd({id:n,store:z,unselect:J,nodeRef:$})}else g&&u&&Object.prototype.hasOwnProperty.call(ys,ye.key)&&(z.setState({ariaLiveMessage:`Moved selected node ${ye.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~o}`}),he({x:ys[ye.key].x,y:ys[ye.key].y,isShiftPressed:ye.shiftKey}))};M.useEffect(()=>()=>{W.current&&(L==null||L.unobserve(W.current),W.current=null)},[]),M.useEffect(()=>{if($.current&&!D){const ye=$.current;(!O||!T||W.current!==ye)&&(W.current&&(L==null||L.unobserve(W.current)),L==null||L.observe(ye),W.current=ye)}},[D,O,T]),M.useEffect(()=>{const ye=te.current!==i,J=U.current!==E,bt=Q.current!==_;$.current&&(ye||J||bt)&&(ye&&(te.current=i),J&&(U.current=E),bt&&(Q.current=_),z.getState().updateNodeDimensions([{id:n,nodeElement:$.current,forceUpdate:!0}]))},[n,i,E,_]);const wn=qx({nodeRef:$,disabled:D||!g,noDragClassName:S,handleSelector:B,nodeId:n,isSelectable:v,selectNodesOnDrag:C});return D?null:F.createElement("div",{className:ft(["react-flow__node",`react-flow__node-${i}`,{[I]:g},m,{selected:u,selectable:v,parent:A,dragging:wn}]),ref:$,style:{zIndex:P,transform:`translate(${l}px,${a}px)`,pointerEvents:ne?"all":"none",visibility:O?"visible":"hidden",...x},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Ee,onMouseMove:ge,onMouseLeave:Jt,onContextMenu:Dt,onClick:Lt,onDoubleClick:Zt,onKeyDown:k?Le:void 0,tabIndex:k?0:void 0,role:k?"button":void 0,"aria-describedby":j?void 0:`${$x}-${N}`,"aria-label":R},F.createElement(AM,{value:n},F.createElement(t,{id:n,data:r,type:i,xPos:s,yPos:o,selected:u,isConnectable:w,sourcePosition:E,targetPosition:_,dragging:wn,dragHandle:B,zIndex:P})))};return e.displayName="NodeWrapper",M.memo(e)};const pO=t=>{const e=t.getNodes().filter(n=>n.selected);return{...sm(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function mO({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const i=We(),{width:r,height:s,x:o,y:l,transformString:a,userSelectionActive:u}=Ce(pO,it),c=Yx(),h=M.useRef(null);if(M.useEffect(()=>{var p;n||(p=h.current)==null||p.focus({preventScroll:!0})},[n]),qx({nodeRef:h}),u||!r||!s)return null;const f=t?p=>{const y=i.getState().getNodes().filter(x=>x.selected);t(p,y)}:void 0,d=p=>{Object.prototype.hasOwnProperty.call(ys,p.key)&&c({x:ys[p.key].x,y:ys[p.key].y,isShiftPressed:p.shiftKey})};return F.createElement("div",{className:ft(["react-flow__nodesselection","react-flow__container",e]),style:{transform:a}},F.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:r,height:s,top:l,left:o}}))}var gO=M.memo(mO);const yO=t=>t.nodesSelectionActive,Qx=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:o,deleteKeyCode:l,onMove:a,onMoveStart:u,onMoveEnd:c,selectionKeyCode:h,selectionOnDrag:f,selectionMode:d,onSelectionStart:p,onSelectionEnd:y,multiSelectionKeyCode:x,panActivationKeyCode:m,zoomActivationKeyCode:g,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:k,panOnScroll:C,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:D,panOnDrag:L,defaultViewport:B,translateExtent:P,minZoom:A,maxZoom:S,preventScrolling:I,onSelectionContextMenu:O,noWheelClassName:j,noPanClassName:R,disableKeyboardA11y:N})=>{const T=Ce(yO),z=ml(h),$=ml(m),W=$||L,U=$||C,Q=z||f&&W!==!0;return tO({deleteKeyCode:l,multiSelectionKeyCode:x}),F.createElement(sO,{onMove:a,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:k,panOnScroll:U,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:D,panOnDrag:!z&&W,defaultViewport:B,translateExtent:P,minZoom:A,maxZoom:S,zoomActivationKeyCode:g,preventScrolling:I,noWheelClassName:j,noPanClassName:R},F.createElement(Wx,{onSelectionStart:p,onSelectionEnd:y,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:W,isSelecting:!!Q,selectionMode:d},t,T&&F.createElement(gO,{onSelectionContextMenu:O,noPanClassName:R,disableKeyboardA11y:N})))};Qx.displayName="FlowRenderer";var vO=M.memo(Qx);function wO(t){return Ce(M.useCallback(n=>t?Ax(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function xO(t){const e={input:co(t.input||Dx),default:co(t.default||rd),output:co(t.output||Bx),group:co(t.group||lm)},n={},i=Object.keys(t).filter(r=>!["input","default","output","group"].includes(r)).reduce((r,s)=>(r[s]=co(t[s]||rd),r),n);return{...e,...i}}const SO=({x:t,y:e,width:n,height:i,origin:r})=>!n||!i?{x:t,y:e}:r[0]<0||r[1]<0||r[0]>1||r[1]>1?{x:t,y:e}:{x:t-n*r[0],y:e-i*r[1]},kO=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Xx=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,updateNodeDimensions:s,onError:o}=Ce(kO,it),l=wO(t.onlyRenderVisibleElements),a=M.useRef(),u=M.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(h=>{const f=h.map(d=>({id:d.target.getAttribute("data-id"),nodeElement:d.target,forceUpdate:!0}));s(f)});return a.current=c,c},[]);return M.useEffect(()=>()=>{var c;(c=a==null?void 0:a.current)==null||c.disconnect()},[]),F.createElement("div",{className:"react-flow__nodes",style:am},l.map(c=>{var k,C,E;let h=c.type||"default";t.nodeTypes[h]||(o==null||o("003",ri.error003(h)),h="default");const f=t.nodeTypes[h]||t.nodeTypes.default,d=!!(c.draggable||e&&typeof c.draggable>"u"),p=!!(c.selectable||r&&typeof c.selectable>"u"),y=!!(c.connectable||n&&typeof c.connectable>"u"),x=!!(c.focusable||i&&typeof c.focusable>"u"),m=t.nodeExtent?Zp(c.positionAbsolute,t.nodeExtent):c.positionAbsolute,g=(m==null?void 0:m.x)??0,v=(m==null?void 0:m.y)??0,w=SO({x:g,y:v,width:c.width??0,height:c.height??0,origin:t.nodeOrigin});return F.createElement(f,{key:c.id,id:c.id,className:c.className,style:c.style,type:h,data:c.data,sourcePosition:c.sourcePosition||G.Bottom,targetPosition:c.targetPosition||G.Top,hidden:c.hidden,xPos:g,yPos:v,xPosOrigin:w.x,yPosOrigin:w.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!c.selected,isDraggable:d,isSelectable:p,isConnectable:y,isFocusable:x,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((k=c[_e])==null?void 0:k.z)??0,isParent:!!((C=c[_e])!=null&&C.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!c.width&&!!c.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!((E=c[_e])!=null&&E.handleBounds)})}))};Xx.displayName="NodeRenderer";var bO=M.memo(Xx);const CO=(t,e,n)=>n===G.Left?t-e:n===G.Right?t+e:t,EO=(t,e,n)=>n===G.Top?t-e:n===G.Bottom?t+e:t,F0="react-flow__edgeupdater",j0=({position:t,centerX:e,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:o,type:l})=>F.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:o,className:ft([F0,`${F0}-${l}`]),cx:CO(e,i,t),cy:EO(n,i,t),r:i,stroke:"transparent",fill:"transparent"}),AO=()=>!0;var jr=t=>{const e=({id:n,className:i,type:r,data:s,onClick:o,onEdgeDoubleClick:l,selected:a,animated:u,label:c,labelStyle:h,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:y,style:x,source:m,target:g,sourceX:v,sourceY:w,targetX:k,targetY:C,sourcePosition:E,targetPosition:_,elementsSelectable:D,hidden:L,sourceHandleId:B,targetHandleId:P,onContextMenu:A,onMouseEnter:S,onMouseMove:I,onMouseLeave:O,reconnectRadius:j,onReconnect:R,onReconnectStart:N,onReconnectEnd:T,markerEnd:z,markerStart:$,rfId:W,ariaLabel:U,isFocusable:Q,isReconnectable:te,pathOptions:ne,interactionWidth:he,disableKeyboardA11y:Ee})=>{const ge=M.useRef(null),[Jt,Dt]=M.useState(!1),[Zt,Lt]=M.useState(!1),Le=We(),wn=M.useMemo(()=>`url('#${nd($,W)}')`,[$,W]),ye=M.useMemo(()=>`url('#${nd(z,W)}')`,[z,W]);if(L)return null;const J=Xe=>{var xn;const{edges:en,addSelectedEdges:Qi,unselectNodesAndEdges:Xi,multiSelectionActive:Gi}=Le.getState(),jn=en.find(Xs=>Xs.id===n);jn&&(D&&(Le.setState({nodesSelectionActive:!1}),jn.selected&&Gi?(Xi({nodes:[],edges:[jn]}),(xn=ge.current)==null||xn.blur()):Qi([n])),o&&o(Xe,jn))},bt=ao(n,Le.getState,l),Ki=ao(n,Le.getState,A),Ys=ao(n,Le.getState,S),Or=ao(n,Le.getState,I),Pr=ao(n,Le.getState,O),Fn=(Xe,en)=>{if(Xe.button!==0)return;const{edges:Qi,isValidConnection:Xi}=Le.getState(),Gi=en?g:m,jn=(en?P:B)||null,xn=en?"target":"source",Xs=Xi||AO,jc=en,Gs=Qi.find(Ji=>Ji.id===n);Lt(!0),N==null||N(Xe,Gs,xn);const Vc=Ji=>{Lt(!1),T==null||T(Ji,Gs,xn)};Ox({event:Xe,handleId:jn,nodeId:Gi,onConnect:Ji=>R==null?void 0:R(Gs,Ji),isTarget:jc,getState:Le.getState,setState:Le.setState,isValidConnection:Xs,edgeUpdaterType:xn,onReconnectEnd:Vc})},Rr=Xe=>Fn(Xe,!0),qi=Xe=>Fn(Xe,!1),Yi=()=>Dt(!0),Ir=()=>Dt(!1),Dr=!D&&!o,Qs=Xe=>{var en;if(!Ee&&wx.includes(Xe.key)&&D){const{unselectNodesAndEdges:Qi,addSelectedEdges:Xi,edges:Gi}=Le.getState();Xe.key==="Escape"?((en=ge.current)==null||en.blur(),Qi({edges:[Gi.find(xn=>xn.id===n)]})):Xi([n])}};return F.createElement("g",{className:ft(["react-flow__edge",`react-flow__edge-${r}`,i,{selected:a,animated:u,inactive:Dr,updating:Jt}]),onClick:J,onDoubleClick:bt,onContextMenu:Ki,onMouseEnter:Ys,onMouseMove:Or,onMouseLeave:Pr,onKeyDown:Q?Qs:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${m} to ${g}`,"aria-describedby":Q?`${Fx}-${W}`:void 0,ref:ge},!Zt&&F.createElement(t,{id:n,source:m,target:g,selected:a,animated:u,label:c,labelStyle:h,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:y,data:s,style:x,sourceX:v,sourceY:w,targetX:k,targetY:C,sourcePosition:E,targetPosition:_,sourceHandleId:B,targetHandleId:P,markerStart:wn,markerEnd:ye,pathOptions:ne,interactionWidth:he}),te&&F.createElement(F.Fragment,null,(te==="source"||te===!0)&&F.createElement(j0,{position:E,centerX:v,centerY:w,radius:j,onMouseDown:Rr,onMouseEnter:Yi,onMouseOut:Ir,type:"source"}),(te==="target"||te===!0)&&F.createElement(j0,{position:_,centerX:k,centerY:C,radius:j,onMouseDown:qi,onMouseEnter:Yi,onMouseOut:Ir,type:"target"})))};return e.displayName="EdgeWrapper",M.memo(e)};function NO(t){const e={default:jr(t.default||Iu),straight:jr(t.bezier||im),step:jr(t.step||nm),smoothstep:jr(t.step||Ac),simplebezier:jr(t.simplebezier||tm)},n={},i=Object.keys(t).filter(r=>!["default","bezier"].includes(r)).reduce((r,s)=>(r[s]=jr(t[s]||Iu),r),n);return{...e,...i}}function V0(t,e,n=null){const i=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,o=(n==null?void 0:n.height)||e.height;switch(t){case G.Top:return{x:i+s/2,y:r};case G.Right:return{x:i+s,y:r+o/2};case G.Bottom:return{x:i+s/2,y:r+o};case G.Left:return{x:i,y:r+o/2}}}function H0(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const _O=(t,e,n,i,r,s)=>{const o=V0(n,t,e),l=V0(s,i,r);return{sourceX:o.x,sourceY:o.y,targetX:l.x,targetY:l.y}};function TO({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:i,targetWidth:r,targetHeight:s,width:o,height:l,transform:a}){const u={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+r),y2:Math.max(t.y+i,e.y+s)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=em({x:(0-a[0])/a[2],y:(0-a[1])/a[2],width:o/a[2],height:l/a[2]}),h=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(h*f)>0}function W0(t){var i,r,s,o,l;const e=((i=t==null?void 0:t[_e])==null?void 0:i.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&typeof((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)<"u"&&typeof((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)<"u";return[{x:((o=t==null?void 0:t.positionAbsolute)==null?void 0:o.x)||0,y:((l=t==null?void 0:t.positionAbsolute)==null?void 0:l.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const MO=[{level:0,isMaxLevel:!0,edges:[]}];function OO(t,e,n=!1){let i=-1;const r=t.reduce((o,l)=>{var c,h;const a=jt(l.zIndex);let u=a?l.zIndex:0;if(n){const f=e.get(l.target),d=e.get(l.source),p=l.selected||(f==null?void 0:f.selected)||(d==null?void 0:d.selected),y=Math.max(((c=d==null?void 0:d[_e])==null?void 0:c.z)||0,((h=f==null?void 0:f[_e])==null?void 0:h.z)||0,1e3);u=(a?l.zIndex:0)+(p?y:0)}return o[u]?o[u].push(l):o[u]=[l],i=u>i?u:i,o},{}),s=Object.entries(r).map(([o,l])=>{const a=+o;return{edges:l,level:a,isMaxLevel:a===i}});return s.length===0?MO:s}function PO(t,e,n){const i=Ce(M.useCallback(r=>t?r.edges.filter(s=>{const o=e.get(s.source),l=e.get(s.target);return(o==null?void 0:o.width)&&(o==null?void 0:o.height)&&(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&TO({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:l.width,targetHeight:l.height,width:r.width,height:r.height,transform:r.transform})}):r.edges,[t,e]));return OO(i,e,n)}const RO=({color:t="none",strokeWidth:e=1})=>F.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),IO=({color:t="none",strokeWidth:e=1})=>F.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),U0={[pl.Arrow]:RO,[pl.ArrowClosed]:IO};function DO(t){const e=We();return M.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(U0,t)?U0[t]:((s=(r=e.getState()).onError)==null||s.call(r,"009",ri.error009(t)),null)},[t])}const LO=({id:t,type:e,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const a=DO(e);return a?F.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${i}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0"},F.createElement(a,{color:n,strokeWidth:o})):null},BO=({defaultColor:t,rfId:e})=>n=>{const i=[];return n.edges.reduce((r,s)=>([s.markerStart,s.markerEnd].forEach(o=>{if(o&&typeof o=="object"){const l=nd(o,e);i.includes(l)||(r.push({id:l,color:o.color||t,...o}),i.push(l))}}),r),[]).sort((r,s)=>r.id.localeCompare(s.id))},Gx=({defaultColor:t,rfId:e})=>{const n=Ce(M.useCallback(BO({defaultColor:t,rfId:e}),[t,e]),(i,r)=>!(i.length!==r.length||i.some((s,o)=>s.id!==r[o].id)));return F.createElement("defs",null,n.map(i=>F.createElement(LO,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};Gx.displayName="MarkerDefinitions";var zO=M.memo(Gx);const $O=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),Jx=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:i,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:a,onEdgeMouseLeave:u,onEdgeClick:c,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:d,onReconnectEnd:p,reconnectRadius:y,children:x,disableKeyboardA11y:m})=>{const{edgesFocusable:g,edgesUpdatable:v,elementsSelectable:w,width:k,height:C,connectionMode:E,nodeInternals:_,onError:D}=Ce($O,it),L=PO(e,_,n);return k?F.createElement(F.Fragment,null,L.map(({level:B,edges:P,isMaxLevel:A})=>F.createElement("svg",{key:B,style:{zIndex:B},width:k,height:C,className:"react-flow__edges react-flow__container"},A&&F.createElement(zO,{defaultColor:t,rfId:i}),F.createElement("g",null,P.map(S=>{const[I,O,j]=W0(_.get(S.source)),[R,N,T]=W0(_.get(S.target));if(!j||!T)return null;let z=S.type||"default";r[z]||(D==null||D("011",ri.error011(z)),z="default");const $=r[z]||r.default,W=E===br.Strict?N.target:(N.target??[]).concat(N.source??[]),U=H0(O.source,S.sourceHandle),Q=H0(W,S.targetHandle),te=(U==null?void 0:U.position)||G.Bottom,ne=(Q==null?void 0:Q.position)||G.Top,he=!!(S.focusable||g&&typeof S.focusable>"u"),Ee=S.reconnectable||S.updatable,ge=typeof f<"u"&&(Ee||v&&typeof Ee>"u");if(!U||!Q)return D==null||D("008",ri.error008(U,S)),null;const{sourceX:Jt,sourceY:Dt,targetX:Zt,targetY:Lt}=_O(I,U,te,R,Q,ne);return F.createElement($,{key:S.id,id:S.id,className:ft([S.className,s]),type:z,data:S.data,selected:!!S.selected,animated:!!S.animated,hidden:!!S.hidden,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,style:S.style,source:S.source,target:S.target,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerEnd:S.markerEnd,markerStart:S.markerStart,sourceX:Jt,sourceY:Dt,targetX:Zt,targetY:Lt,sourcePosition:te,targetPosition:ne,elementsSelectable:w,onContextMenu:o,onMouseEnter:l,onMouseMove:a,onMouseLeave:u,onClick:c,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:d,onReconnectEnd:p,reconnectRadius:y,rfId:i,ariaLabel:S.ariaLabel,isFocusable:he,isReconnectable:ge,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth,disableKeyboardA11y:m})})))),x):null};Jx.displayName="EdgeRenderer";var FO=M.memo(Jx);const jO=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function VO({children:t}){const e=Ce(jO);return F.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function HO(t){const e=Nc(),n=M.useRef(!1);M.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const WO={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top},Zx=({nodeId:t,handleType:e,style:n,type:i=vi.Bezier,CustomComponent:r,connectionStatus:s})=>{var C,E,_;const{fromNode:o,handleId:l,toX:a,toY:u,connectionMode:c}=Ce(M.useCallback(D=>({fromNode:D.nodeInternals.get(t),handleId:D.connectionHandleId,toX:(D.connectionPosition.x-D.transform[0])/D.transform[2],toY:(D.connectionPosition.y-D.transform[1])/D.transform[2],connectionMode:D.connectionMode}),[t]),it),h=(C=o==null?void 0:o[_e])==null?void 0:C.handleBounds;let f=h==null?void 0:h[e];if(c===br.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!o||!f)return null;const d=l?f.find(D=>D.id===l):f[0],p=d?d.x+d.width/2:(o.width??0)/2,y=d?d.y+d.height/2:o.height??0,x=(((E=o.positionAbsolute)==null?void 0:E.x)??0)+p,m=(((_=o.positionAbsolute)==null?void 0:_.y)??0)+y,g=d==null?void 0:d.position,v=g?WO[g]:null;if(!g||!v)return null;if(r)return F.createElement(r,{connectionLineType:i,connectionLineStyle:n,fromNode:o,fromHandle:d,fromX:x,fromY:m,toX:a,toY:u,fromPosition:g,toPosition:v,connectionStatus:s});let w="";const k={sourceX:x,sourceY:m,sourcePosition:g,targetX:a,targetY:u,targetPosition:v};return i===vi.Bezier?[w]=Cx(k):i===vi.Step?[w]=td({...k,borderRadius:0}):i===vi.SmoothStep?[w]=td(k):i===vi.SimpleBezier?[w]=bx(k):w=`M${x},${m} ${a},${u}`,F.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};Zx.displayName="ConnectionLine";const UO=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function KO({containerStyle:t,style:e,type:n,component:i}){const{nodeId:r,handleType:s,nodesConnectable:o,width:l,height:a,connectionStatus:u}=Ce(UO,it);return!(r&&s&&l&&o)?null:F.createElement("svg",{style:t,width:l,height:a,className:"react-flow__edges react-flow__connectionline react-flow__container"},F.createElement("g",{className:ft(["react-flow__connection",u])},F.createElement(Zx,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:i,connectionStatus:u})))}function K0(t,e){return M.useRef(null),We(),M.useMemo(()=>e(t),[t])}const eS=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:i,onMoveEnd:r,onInit:s,onNodeClick:o,onEdgeClick:l,onNodeDoubleClick:a,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:d,onSelectionContextMenu:p,onSelectionStart:y,onSelectionEnd:x,connectionLineType:m,connectionLineStyle:g,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:k,selectionOnDrag:C,selectionMode:E,multiSelectionKeyCode:_,panActivationKeyCode:D,zoomActivationKeyCode:L,deleteKeyCode:B,onlyRenderVisibleElements:P,elementsSelectable:A,selectNodesOnDrag:S,defaultViewport:I,translateExtent:O,minZoom:j,maxZoom:R,preventScrolling:N,defaultMarkerColor:T,zoomOnScroll:z,zoomOnPinch:$,panOnScroll:W,panOnScrollSpeed:U,panOnScrollMode:Q,zoomOnDoubleClick:te,panOnDrag:ne,onPaneClick:he,onPaneMouseEnter:Ee,onPaneMouseMove:ge,onPaneMouseLeave:Jt,onPaneScroll:Dt,onPaneContextMenu:Zt,onEdgeContextMenu:Lt,onEdgeMouseEnter:Le,onEdgeMouseMove:wn,onEdgeMouseLeave:ye,onReconnect:J,onReconnectStart:bt,onReconnectEnd:Ki,reconnectRadius:Ys,noDragClassName:Or,noWheelClassName:Pr,noPanClassName:Fn,elevateEdgesOnSelect:Rr,disableKeyboardA11y:qi,nodeOrigin:Yi,nodeExtent:Ir,rfId:Dr})=>{const Qs=K0(t,xO),Xe=K0(e,NO);return HO(s),F.createElement(vO,{onPaneClick:he,onPaneMouseEnter:Ee,onPaneMouseMove:ge,onPaneMouseLeave:Jt,onPaneContextMenu:Zt,onPaneScroll:Dt,deleteKeyCode:B,selectionKeyCode:k,selectionOnDrag:C,selectionMode:E,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:_,panActivationKeyCode:D,zoomActivationKeyCode:L,elementsSelectable:A,onMove:n,onMoveStart:i,onMoveEnd:r,zoomOnScroll:z,zoomOnPinch:$,zoomOnDoubleClick:te,panOnScroll:W,panOnScrollSpeed:U,panOnScrollMode:Q,panOnDrag:ne,defaultViewport:I,translateExtent:O,minZoom:j,maxZoom:R,onSelectionContextMenu:p,preventScrolling:N,noDragClassName:Or,noWheelClassName:Pr,noPanClassName:Fn,disableKeyboardA11y:qi},F.createElement(VO,null,F.createElement(FO,{edgeTypes:Xe,onEdgeClick:l,onEdgeDoubleClick:u,onlyRenderVisibleElements:P,onEdgeContextMenu:Lt,onEdgeMouseEnter:Le,onEdgeMouseMove:wn,onEdgeMouseLeave:ye,onReconnect:J,onReconnectStart:bt,onReconnectEnd:Ki,reconnectRadius:Ys,defaultMarkerColor:T,noPanClassName:Fn,elevateEdgesOnSelect:!!Rr,disableKeyboardA11y:qi,rfId:Dr},F.createElement(KO,{style:g,type:m,component:v,containerStyle:w})),F.createElement("div",{className:"react-flow__edgelabel-renderer"}),F.createElement(bO,{nodeTypes:Qs,onNodeClick:o,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:d,selectNodesOnDrag:S,onlyRenderVisibleElements:P,noPanClassName:Fn,noDragClassName:Or,disableKeyboardA11y:qi,nodeOrigin:Yi,nodeExtent:Ir,rfId:Dr})))};eS.displayName="GraphView";var qO=M.memo(eS);const od=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ui={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:od,nodeExtent:od,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:br.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:xM,isValidConnection:void 0},YO=()=>RA((t,e)=>({...ui,setNodes:n=>{const{nodeInternals:i,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:bh(n,i,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:i={}}=e();t({edges:n.map(r=>({...i,...r}))})},setDefaultNodesAndEdges:(n,i)=>{const r=typeof n<"u",s=typeof i<"u",o=r?bh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:o,edges:s?i:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:i,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:o,fitViewOnInitOptions:l,domNode:a,nodeOrigin:u}=e(),c=a==null?void 0:a.querySelector(".react-flow__viewport");if(!c)return;const h=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(h.transform),d=n.reduce((y,x)=>{const m=r.get(x.id);if(m!=null&&m.hidden)r.set(m.id,{...m,[_e]:{...m[_e],handleBounds:void 0}});else if(m){const g=Jp(x.nodeElement);!!(g.width&&g.height&&(m.width!==g.width||m.height!==g.height||x.forceUpdate))&&(r.set(m.id,{...m,[_e]:{...m[_e],handleBounds:{source:$0(".source",x.nodeElement,f,u),target:$0(".target",x.nodeElement,f,u)}},...g}),y.push({id:m.id,type:"dimensions",dimensions:g}))}return y},[]);Vx(r,u);const p=o||s&&!o&&Hx(e,{initial:!0,...l});t({nodeInternals:new Map(r),fitViewOnInitDone:p}),(d==null?void 0:d.length)>0&&(i==null||i(d))},updateNodePositions:(n,i=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),o=n.map(l=>{const a={id:l.id,type:"position",dragging:r};return i&&(a.positionAbsolute=l.positionAbsolute,a.position=l.position),a});s(o)},triggerNodeChanges:n=>{const{onNodesChange:i,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:o,getNodes:l,elevateNodesOnSelect:a}=e();if(n!=null&&n.length){if(s){const u=uO(n,l()),c=bh(u,r,o,a);t({nodeInternals:c})}i==null||i(n)}},addSelectedNodes:n=>{const{multiSelectionActive:i,edges:r,getNodes:s}=e();let o,l=null;i?o=n.map(a=>di(a,!0)):(o=ns(s(),n),l=ns(r,[])),ha({changedNodes:o,changedEdges:l,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:i,edges:r,getNodes:s}=e();let o,l=null;i?o=n.map(a=>di(a,!0)):(o=ns(r,n),l=ns(s(),[])),ha({changedNodes:l,changedEdges:o,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:i}={})=>{const{edges:r,getNodes:s}=e(),o=n||s(),l=i||r,a=o.map(c=>(c.selected=!1,di(c.id,!1))),u=l.map(c=>di(c.id,!1));ha({changedNodes:a,changedEdges:u,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:i,maxZoom:r}=e();i==null||i.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:i,minZoom:r}=e();i==null||i.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var i;(i=e().d3Zoom)==null||i.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:i}=e(),s=i().filter(l=>l.selected).map(l=>di(l.id,!1)),o=n.filter(l=>l.selected).map(l=>di(l.id,!1));ha({changedNodes:s,changedEdges:o,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:i}=e();i.forEach(r=>{r.positionAbsolute=Zp(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(i)})},panBy:n=>{const{transform:i,width:r,height:s,d3Zoom:o,d3Selection:l,translateExtent:a}=e();if(!o||!l||!n.x&&!n.y)return!1;const u=Ri.translate(i[0]+n.x,i[1]+n.y).scale(i[2]),c=[[0,0],[r,s]],h=o==null?void 0:o.constrain()(u,c,a);return o.transform(l,h),i[0]!==h.x||i[1]!==h.y||i[2]!==h.k},cancelConnection:()=>t({connectionNodeId:ui.connectionNodeId,connectionHandleId:ui.connectionHandleId,connectionHandleType:ui.connectionHandleType,connectionStatus:ui.connectionStatus,connectionStartHandle:ui.connectionStartHandle,connectionEndHandle:ui.connectionEndHandle}),reset:()=>t({...ui})}),Object.is),um=({children:t})=>{const e=M.useRef(null);return e.current||(e.current=YO()),F.createElement(fM,{value:e.current},t)};um.displayName="ReactFlowProvider";const tS=({children:t})=>M.useContext(Ec)?F.createElement(F.Fragment,null,t):F.createElement(um,null,t);tS.displayName="ReactFlowWrapper";const QO={input:Dx,default:rd,output:Bx,group:lm},XO={default:Iu,straight:im,step:nm,smoothstep:Ac,simplebezier:tm},GO=[0,0],JO=[15,15],ZO={x:0,y:0,zoom:1},eP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},nS=M.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s=QO,edgeTypes:o=XO,onNodeClick:l,onEdgeClick:a,onInit:u,onMove:c,onMoveStart:h,onMoveEnd:f,onConnect:d,onConnectStart:p,onConnectEnd:y,onClickConnectStart:x,onClickConnectEnd:m,onNodeMouseEnter:g,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:C,onNodeDragStart:E,onNodeDrag:_,onNodeDragStop:D,onNodesDelete:L,onEdgesDelete:B,onSelectionChange:P,onSelectionDragStart:A,onSelectionDrag:S,onSelectionDragStop:I,onSelectionContextMenu:O,onSelectionStart:j,onSelectionEnd:R,connectionMode:N=br.Strict,connectionLineType:T=vi.Bezier,connectionLineStyle:z,connectionLineComponent:$,connectionLineContainerStyle:W,deleteKeyCode:U="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:te=!1,selectionMode:ne=dl.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:Ee=Ru()?"Meta":"Control",zoomActivationKeyCode:ge=Ru()?"Meta":"Control",snapToGrid:Jt=!1,snapGrid:Dt=JO,onlyRenderVisibleElements:Zt=!1,selectNodesOnDrag:Lt=!0,nodesDraggable:Le,nodesConnectable:wn,nodesFocusable:ye,nodeOrigin:J=GO,edgesFocusable:bt,edgesUpdatable:Ki,elementsSelectable:Ys,defaultViewport:Or=ZO,minZoom:Pr=.5,maxZoom:Fn=2,translateExtent:Rr=od,preventScrolling:qi=!0,nodeExtent:Yi,defaultMarkerColor:Ir="#b1b1b7",zoomOnScroll:Dr=!0,zoomOnPinch:Qs=!0,panOnScroll:Xe=!1,panOnScrollSpeed:en=.5,panOnScrollMode:Qi=cr.Free,zoomOnDoubleClick:Xi=!0,panOnDrag:Gi=!0,onPaneClick:jn,onPaneMouseEnter:xn,onPaneMouseMove:Xs,onPaneMouseLeave:jc,onPaneScroll:Gs,onPaneContextMenu:Vc,children:$m,onEdgeContextMenu:Ji,onEdgeDoubleClick:Cb,onEdgeMouseEnter:Eb,onEdgeMouseMove:Ab,onEdgeMouseLeave:Nb,onEdgeUpdate:_b,onEdgeUpdateStart:Tb,onEdgeUpdateEnd:Mb,onReconnect:Ob,onReconnectStart:Pb,onReconnectEnd:Rb,reconnectRadius:Ib=10,edgeUpdaterRadius:Db=10,onNodesChange:Lb,onEdgesChange:Bb,noDragClassName:zb="nodrag",noWheelClassName:$b="nowheel",noPanClassName:Fm="nopan",fitView:Fb=!1,fitViewOptions:jb,connectOnClick:Vb=!0,attributionPosition:Hb,proOptions:Wb,defaultEdgeOptions:Ub,elevateNodesOnSelect:Kb=!0,elevateEdgesOnSelect:qb=!1,disableKeyboardA11y:jm=!1,autoPanOnConnect:Yb=!0,autoPanOnNodeDrag:Qb=!0,connectionRadius:Xb=20,isValidConnection:Gb,onError:Jb,style:Zb,id:Vm,nodeDragThreshold:eC,...tC},nC)=>{const Hc=Vm||"1";return F.createElement("div",{...tC,style:{...Zb,...eP},ref:nC,className:ft(["react-flow",r]),"data-testid":"rf__wrapper",id:Vm},F.createElement(tS,null,F.createElement(qO,{onInit:u,onMove:c,onMoveStart:h,onMoveEnd:f,onNodeClick:l,onEdgeClick:a,onNodeMouseEnter:g,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:o,connectionLineType:T,connectionLineStyle:z,connectionLineComponent:$,connectionLineContainerStyle:W,selectionKeyCode:Q,selectionOnDrag:te,selectionMode:ne,deleteKeyCode:U,multiSelectionKeyCode:Ee,panActivationKeyCode:he,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Zt,selectNodesOnDrag:Lt,defaultViewport:Or,translateExtent:Rr,minZoom:Pr,maxZoom:Fn,preventScrolling:qi,zoomOnScroll:Dr,zoomOnPinch:Qs,zoomOnDoubleClick:Xi,panOnScroll:Xe,panOnScrollSpeed:en,panOnScrollMode:Qi,panOnDrag:Gi,onPaneClick:jn,onPaneMouseEnter:xn,onPaneMouseMove:Xs,onPaneMouseLeave:jc,onPaneScroll:Gs,onPaneContextMenu:Vc,onSelectionContextMenu:O,onSelectionStart:j,onSelectionEnd:R,onEdgeContextMenu:Ji,onEdgeDoubleClick:Cb,onEdgeMouseEnter:Eb,onEdgeMouseMove:Ab,onEdgeMouseLeave:Nb,onReconnect:Ob??_b,onReconnectStart:Pb??Tb,onReconnectEnd:Rb??Mb,reconnectRadius:Ib??Db,defaultMarkerColor:Ir,noDragClassName:zb,noWheelClassName:$b,noPanClassName:Fm,elevateEdgesOnSelect:qb,rfId:Hc,disableKeyboardA11y:jm,nodeOrigin:J,nodeExtent:Yi}),F.createElement(HM,{nodes:t,edges:e,defaultNodes:n,defaultEdges:i,onConnect:d,onConnectStart:p,onConnectEnd:y,onClickConnectStart:x,onClickConnectEnd:m,nodesDraggable:Le,nodesConnectable:wn,nodesFocusable:ye,edgesFocusable:bt,edgesUpdatable:Ki,elementsSelectable:Ys,elevateNodesOnSelect:Kb,minZoom:Pr,maxZoom:Fn,nodeExtent:Yi,onNodesChange:Lb,onEdgesChange:Bb,snapToGrid:Jt,snapGrid:Dt,connectionMode:N,translateExtent:Rr,connectOnClick:Vb,defaultEdgeOptions:Ub,fitView:Fb,fitViewOptions:jb,onNodesDelete:L,onEdgesDelete:B,onNodeDragStart:E,onNodeDrag:_,onNodeDragStop:D,onSelectionDrag:S,onSelectionDragStart:A,onSelectionDragStop:I,noPanClassName:Fm,nodeOrigin:J,rfId:Hc,autoPanOnConnect:Yb,autoPanOnNodeDrag:Qb,onError:Jb,connectionRadius:Xb,isValidConnection:Gb,nodeDragThreshold:eC}),F.createElement(jM,{onSelectionChange:P}),$m,F.createElement(pM,{proOptions:Wb,position:Hb}),F.createElement(YM,{rfId:Hc,disableKeyboardA11y:jm})))});nS.displayName="ReactFlow";function tP(){return F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},F.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function nP(){return F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},F.createElement("path",{d:"M0 0h32v4.2H0z"}))}function iP(){return F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},F.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function rP(){return F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},F.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function sP(){return F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},F.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Co=({children:t,className:e,...n})=>F.createElement("button",{type:"button",className:ft(["react-flow__controls-button",e]),...n},t);Co.displayName="ControlButton";const oP=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),iS=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:o,onFitView:l,onInteractiveChange:a,className:u,children:c,position:h="bottom-left"})=>{const f=We(),[d,p]=M.useState(!1),{isInteractive:y,minZoomReached:x,maxZoomReached:m}=Ce(oP,it),{zoomIn:g,zoomOut:v,fitView:w}=Nc();if(M.useEffect(()=>{p(!0)},[]),!d)return null;const k=()=>{g(),s==null||s()},C=()=>{v(),o==null||o()},E=()=>{w(r),l==null||l()},_=()=>{f.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),a==null||a(!y)};return F.createElement(gx,{className:ft(["react-flow__controls",u]),position:h,style:t,"data-testid":"rf__controls"},e&&F.createElement(F.Fragment,null,F.createElement(Co,{onClick:k,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:m},F.createElement(tP,null)),F.createElement(Co,{onClick:C,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},F.createElement(nP,null))),n&&F.createElement(Co,{className:"react-flow__controls-fitview",onClick:E,title:"fit view","aria-label":"fit view"},F.createElement(iP,null)),i&&F.createElement(Co,{className:"react-flow__controls-interactive",onClick:_,title:"toggle interactivity","aria-label":"toggle interactivity"},y?F.createElement(sP,null):F.createElement(rP,null)),c)};iS.displayName="Controls";var lP=M.memo(iS),dn;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(dn||(dn={}));function aP({color:t,dimensions:e,lineWidth:n}){return F.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function uP({color:t,radius:e}){return F.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const cP={[dn.Dots]:"#91919a",[dn.Lines]:"#eee",[dn.Cross]:"#e2e2e2"},hP={[dn.Dots]:1,[dn.Lines]:1,[dn.Cross]:6},fP=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function rS({id:t,variant:e=dn.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=2,color:o,style:l,className:a}){const u=M.useRef(null),{transform:c,patternId:h}=Ce(fP,it),f=o||cP[e],d=i||hP[e],p=e===dn.Dots,y=e===dn.Cross,x=Array.isArray(n)?n:[n,n],m=[x[0]*c[2]||1,x[1]*c[2]||1],g=d*c[2],v=y?[g,g]:m,w=p?[g/s,g/s]:[v[0]/s,v[1]/s];return F.createElement("svg",{className:ft(["react-flow__background",a]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:u,"data-testid":"rf__background"},F.createElement("pattern",{id:h+t,x:c[0]%m[0],y:c[1]%m[1],width:m[0],height:m[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},p?F.createElement(uP,{color:f,radius:g/s}):F.createElement(aP,{dimensions:v,color:f,lineWidth:r})),F.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}rS.displayName="Background";var dP=M.memo(rS);function pP(t,e){const n=e.get(t.operationId);return(n==null?void 0:n.operationId)??(n==null?void 0:n.id)??t.operationId}function sS(t,e){const n=t.map(o=>pP(o,e)),i=new Map;for(const o of n)i.set(o,(i.get(o)??0)+1);const r=new Map,s=new Map;return t.forEach((o,l)=>{const a=n[l];if((i.get(a)??0)<2){s.set(o.id,a);return}const u=(r.get(a)??0)+1;r.set(a,u),s.set(o.id,`${a} #${u}`)}),s}function mP({data:t}){const{node:e,operation:n,selected:i,isRunning:r,label:s}=t,o=Mr(u=>u.removeNode),l=(n==null?void 0:n.method)??"get",a=!!(n!=null&&n.operationId)||s!==void 0&&/#\d+$/.test(s);return b.jsxs("fieldset",{className:`workflow-node workflow-node--${l}${i?" workflow-node--selected":""}${r?" workflow-node--running":""}`,children:[a&&b.jsx("legend",{className:"workflow-node__operation-id",children:s}),b.jsx(Ds,{type:"target",position:G.Left,title:"Drop here to connect — sets run order, not data"}),b.jsx("button",{type:"button",className:"workflow-node__remove-btn",onMouseDown:u=>u.stopPropagation(),onClick:u=>{u.stopPropagation(),o(e.id)},title:"Remove this node","aria-label":"Remove this node",children:"×"}),b.jsxs("div",{className:"workflow-node__header",children:[b.jsx("span",{className:`method-badge method-badge--${l}`,children:l.toUpperCase()}),b.jsx("span",{className:"workflow-node__path",children:(n==null?void 0:n.path)??"Unknown operation"})]}),(n==null?void 0:n.summary)&&b.jsx("div",{className:"workflow-node__summary",title:n.summary,children:n.summary}),b.jsx(Ds,{type:"source",position:G.Right,title:"Drag to connect — sets run order, not data"})]})}const gP={workflowNode:mP};function yP(){return b.jsx(um,{children:b.jsx(vP,{})})}function vP(){const{nodes:t,nodePositions:e,connections:n,operations:i,selectedNodeId:r,stepStatusByNodeId:s,addNode:o,updateNodePosition:l,selectNode:a,connectNodes:u,disconnectNodes:c,removeNode:h}=Mr(),{screenToFlowPosition:f,fitView:d,getViewport:p}=Nc(),y=M.useRef(null),x=M.useRef(t.length),[m,g]=M.useState(null),v=M.useCallback(P=>{var A;(A=y.current)==null||A.style.setProperty("--rf-zoom",String(P.zoom))},[]);M.useEffect(()=>{v(p())},[p,v]);const w=M.useMemo(()=>{const P=new Map(i.map(A=>[A.id,A]));return sS(t,P)},[t,i]),k=M.useMemo(()=>t.map(P=>({id:P.id,type:"workflowNode",position:e[P.id]??{x:80,y:80},data:{node:P,operation:i.find(A=>A.id===P.operationId),selected:P.id===r,isRunning:s[P.id]==="in-flight",label:w.get(P.id)}})),[t,e,i,r,s,w]),C=M.useMemo(()=>{const P=n.map(A=>({id:`conn-${A.fromNodeId}->${A.toNodeId}`,source:A.fromNodeId,target:A.toNodeId,className:"edge-connection",markerEnd:{type:pl.ArrowClosed,color:"#9aa0a6"},data:{fromNodeId:A.fromNodeId,toNodeId:A.toNodeId}}));for(const A of t)for(const S of Object.values(A.fieldValues))S.source==="mapped"&&P.push({id:`map-${S.fromNodeId}->${A.id}-${P.length}`,source:S.fromNodeId,target:A.id,className:"edge-mapping",animated:!0});return P.map(A=>({...A,selected:A.id===m}))},[t,n,m]),E=M.useCallback(P=>{P.preventDefault();const A=P.dataTransfer.getData("text/operation-id");if(!A)return;const S=f({x:P.clientX,y:P.clientY});o(A,S)},[o,f]),_=M.useCallback(P=>{P.source&&P.target&&u(P.source,P.target)},[u]),D=M.useCallback(P=>{for(const A of P)A.type==="position"&&A.position?l(A.id,A.position):A.type==="remove"&&h(A.id)},[l,h]),L=M.useCallback(P=>{for(const A of P)if(A.type==="select")g(A.selected?A.id:null),A.selected&&a(null);else if(A.type==="remove"){const S=C.find(I=>I.id===A.id);S!=null&&S.data&&c(S.data.fromNodeId,S.data.toNodeId)}},[C,c,a]),B=M.useCallback(()=>{const P=y.current;if(!P||t.length===0)return;const A=P.getBoundingClientRect();[...P.querySelectorAll(".react-flow__node")].some(O=>{const j=O.getBoundingClientRect();return j.left<A.left||j.top<A.top||j.right>A.right||j.bottom>A.bottom})&&d({padding:.2,duration:300})},[t.length,d]);return M.useEffect(()=>{if(x.current===t.length)return;x.current=t.length;const P=requestAnimationFrame(B);return()=>cancelAnimationFrame(P)},[t.length,B]),M.useEffect(()=>{const P=y.current;if(!P)return;let A=0;const S=new ResizeObserver(()=>{cancelAnimationFrame(A),A=requestAnimationFrame(B)});return S.observe(P),()=>{S.disconnect(),cancelAnimationFrame(A)}},[B]),b.jsx("div",{className:"canvas",ref:y,onDrop:E,onDragOver:P=>P.preventDefault(),children:b.jsxs(nS,{nodes:k,edges:C,nodeTypes:gP,onNodeClick:(P,A)=>{a(A.id),g(null)},onPaneClick:()=>{a(null),g(null)},onConnect:_,onNodesChange:D,onEdgesChange:L,onMove:(P,A)=>v(A),fitView:!0,fitViewOptions:{padding:.2},children:[b.jsx(dP,{color:"#3a3d42",gap:16}),b.jsx(lP,{})]})})}function Nh(t,e){if(e==="integer"||e==="number"){if(t.trim()==="")return t;const n=Number(t);return Number.isNaN(n)?t:n}if(e==="boolean")return t==="true"?!0:t==="false"?!1:t;if(e==="array"){if(t.trim()==="")return t;try{return JSON.parse(t)}catch{return t}}return t}const wP="Unrecognized schema shape (e.g. oneOf/anyOf/allOf) — not supported yet.",xP=new Set(["string","integer","number","boolean"]);function Cr(t){return(t==null?void 0:t.type)==="array"}function Ls(t){return!Cr(t)&&!!t&&(t.type==="object"||!!t.properties)}function Eo(t){var e;return(e=t==null?void 0:t.enum)!=null&&e.length?t.enum[0]:(t==null?void 0:t.type)==="integer"||(t==null?void 0:t.type)==="number"?0:(t==null?void 0:t.type)==="boolean"?!0:"string"}function SP(t){if(Ls(t)){const e={};for(const[n,i]of Object.entries(t.properties??{}))e[n]=Cr(i)?[]:Ls(i)?{}:Eo(i);return JSON.stringify([e])}return Cr(t)?JSON.stringify([[Eo(t.items)]]):JSON.stringify([Eo(t),Eo(t)])}function oS(t,e,n){return{path:t,required:e,supported:!0,type:"array",reason:SP(n.items)}}function cm(t,e){const n=[],i=(t==null?void 0:t.properties)??{},r=(t==null?void 0:t.required)??[];for(const[s,o]of Object.entries(i)){const l=e?`${e}.${s}`:s,a=r.includes(s);if(Ls(o)){n.push(...cm(o,l));continue}if(Cr(o)){n.push(oS(l,a,o));continue}const u=xP.has(o==null?void 0:o.type)||!!(o!=null&&o.enum);n.push(u?{path:l,required:a,supported:!0,type:o==null?void 0:o.type,enum:o==null?void 0:o.enum}:{path:l,required:a,supported:!1,reason:wP})}return n}function lS(t){return[...t.parameters.map(n=>{var r,s;const i=`${n.in}.${n.name}`;return Cr(n.schema)?oS(i,n.required,n.schema):{path:i,required:n.required,supported:!0,type:(r=n.schema)==null?void 0:r.type,enum:(s=n.schema)==null?void 0:s.enum}}),...cm(t.requestBodySchema,"body")]}function kP(t){return cm(t.responseSchema,"")}function bP(t,e){if(!t||!e||t===e)return!0;const n=new Set(["integer","number"]);return n.has(t)&&n.has(e)}function CP(t){const e={type:"object",properties:{},required:[]};for(const n of t)Object.assign(e.properties,n.properties??{}),e.required.push(...n.required??[]),n.type&&!e.type&&(e.type=n.type);return e}function EP(t){var e,n;return((e=t.oneOf)==null?void 0:e[0])??((n=t.anyOf)==null?void 0:n[0])}function Ao(t){var n;if(!t)return null;if((n=t.allOf)!=null&&n.length)return Ao(CP(t.allOf));const e=EP(t);if(e)return Ao(e);if(Cr(t))return[Ao(t.items)];if(Ls(t)){const i={};for(const[r,s]of Object.entries(t.properties??{}))i[r]=Ao(s);return i}return Eo(t)}function ld(t){var e,n,i;if(!t)return!1;if((e=t.oneOf)!=null&&e.length||(n=t.anyOf)!=null&&n.length||(i=t.allOf)!=null&&i.length)return!0;if(Cr(t)){const r=t.items;return Ls(r)?!0:ld(r)}return Ls(t)?Object.values(t.properties??{}).some(ld):!1}const AP=/"__ENLACE_RAW_TAG__([a-zA-Z0-9_-]+)__"/g,NP=t=>`__ENLACE_RAW_TAG__${t}__`;function aS(t){return lS(t).filter(e=>e.supported&&e.path.startsWith("body.")).map(e=>e.path.slice(5))}function _P(t,e){const n=Ao(t.requestBodySchema),i=typeof n=="object"&&n!==null?n:{},r={};for(const o of aS(t)){const l=e[`body.${o}`];if(l)if(l.source==="static")ll(i,o,l.value);else{const a=Au();r[a]={id:a,type:"response_body",sourceNodeId:l.fromNodeId,jsonPath:l.fromResponseFieldPath||void 0},ll(i,o,NP(a))}}return{template:JSON.stringify(i,null,2).replace(AP,(o,l)=>`"${zw(l)}"`),tags:r}}function ad(t,e){if(t===e)return!0;if(typeof t!=typeof e||t===null||e===null)return!1;if(Array.isArray(t)||Array.isArray(e))return!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length?!1:t.every((n,i)=>ad(n,e[i]));if(typeof t=="object"){const n=Object.keys(t),i=Object.keys(e);return n.length!==i.length?!1:n.every(r=>ad(t[r],e[r]))}return!1}function TP(t,e){let n;try{n=JSON.parse(t.template)}catch(u){return{fieldValues:{},lossy:!1,parseError:u instanceof Error?u.message:String(u)}}const i={},r={},s=new Set;for(const u of aS(e)){const c=Up(n,u),h=typeof c=="string"?c.match(/^\{\{enlace:([a-zA-Z0-9_-]+)\}\}$/):null,f=h?t.tags[h[1]]:void 0;f&&f.type==="response_body"?(i[`body.${u}`]={source:"mapped",fromNodeId:f.sourceNodeId,fromResponseFieldPath:f.jsonPath??""},s.add(f.id),ll(r,u,c)):(i[`body.${u}`]={source:"static",value:c},ll(r,u,c))}const a=[...new Set([...t.template.matchAll(Ol())].map(u=>u[1]))].some(u=>!s.has(u))||!ad(r,n);return{fieldValues:i,lossy:a}}let ud=[],uS=[];(()=>{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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?uS:ud).push(n=n+t[e])})();function MP(t){if(t<768)return!1;for(let e=0,n=ud.length;;){let i=e+n>>1;if(t<ud[i])n=i;else if(t>=uS[i])e=i+1;else return!0;if(e==n)return!1}}function q0(t){return t>=127462&&t<=127487}const Y0=8205;function OP(t,e,n=!0,i=!0){return(n?cS:PP)(t,e,i)}function cS(t,e,n){if(e==t.length)return e;e&&hS(t.charCodeAt(e))&&fS(t.charCodeAt(e-1))&&e--;let i=_h(t,e);for(e+=Q0(i);e<t.length;){let r=_h(t,e);if(i==Y0||r==Y0||n&&MP(r))e+=Q0(r),i=r;else if(q0(r)){let s=0,o=e-2;for(;o>=0&&q0(_h(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function PP(t,e,n){for(;e>1;){let i=cS(t,e-2,n);if(i<e)return i;e--}return 0}function _h(t,e){let n=t.charCodeAt(e);if(!fS(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return hS(i)?(n-55296<<10)+(i-56320)+65536:n}function hS(t){return t>=56320&&t<57344}function fS(t){return t>=55296&&t<56320}function Q0(t){return t<65536?1:2}class oe{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,n,i){[e,n]=Bs(this,e,n);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(n,this.length,r,1),Tn.from(r,this.length-(n-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Bs(this,e,n);let i=[];return this.decompose(e,n,i,0),Tn.from(i,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new zo(this),s=new zo(e);for(let o=n,l=n;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new zo(this,e)}iterRange(e,n=this.length){return new dS(this,e,n)}iterLines(e,n){let i;if(e==null)i=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new pS(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?oe.empty:e.length<=32?new Pe(e):Tn.from(Pe.split(e,[]))}}class Pe extends oe{constructor(e,n=RP(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((n?i:l)>=e)return new IP(r,l,i,o);r=l+1,i++}}decompose(e,n,i,r){let s=e<=0&&n>=this.length?this:new Pe(X0(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=Qa(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new Pe(l,o.length+s.length));else{let a=l.length>>1;i.push(new Pe(l.slice(0,a)),new Pe(l.slice(a)))}}else i.push(s)}replace(e,n,i){if(!(i instanceof Pe))return super.replace(e,n,i);[e,n]=Bs(this,e,n);let r=Qa(this.text,Qa(i.text,X0(this.text,0,e)),n),s=this.length+i.length-(n-e);return r.length<=32?new Pe(r,s):Tn.from(Pe.split(r,[]),s)}sliceString(e,n=this.length,i=`
|
|
57
|
+
`){[e,n]=Bs(this,e,n);let r="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&n>s&&(r+=l.slice(Math.max(0,e-s),n-s)),s=a+1}return r}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(n.push(new Pe(i,r)),i=[],r=-1);return r>-1&&n.push(new Pe(i,r)),n}}class Tn extends oe{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,n,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,i,r);r=l+1,i=a+1}}decompose(e,n,i,r){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&n>=o){let u=r&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?i.push(l):l.decompose(e-o,n-o,i,u)}o=a+1}}replace(e,n,i){if([e,n]=Bs(this,e,n),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&n<=l){let a=o.replace(e-s,n-s,i),u=this.lines-o.lines+a.lines;if(a.lines<u>>4&&a.lines>u>>6){let c=this.children.slice();return c[r]=a,new Tn(c,this.length-(n-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,i)}sliceString(e,n=this.length,i=`
|
|
58
|
+
`){[e,n]=Bs(this,e,n);let r="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&n>o&&(r+=l.sliceString(e-o,n-o,i)),o=a+1}return r}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Tn))return 0;let i=0,[r,s,o,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=n,s+=n){if(r==o||s==l)return i;let a=this.children[r],u=e.children[s];if(a!=u)return i+a.scanIdentical(u,n);i+=a.length+1}}static from(e,n=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new Pe(d,n)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,u=-1,c=[];function h(d){let p;if(d.lines>s&&d instanceof Tn)for(let y of d.children)h(y);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof Pe&&a&&(p=c[c.length-1])instanceof Pe&&d.lines+p.lines<=32?(a+=d.lines,u+=d.length+1,c[c.length-1]=new Pe(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&f(),a+=d.lines,u+=d.length+1,c.push(d))}function f(){a!=0&&(l.push(c.length==1?c[0]:Tn.from(c,u)),u=-1,a=c.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new Tn(l,n)}}oe.empty=new Pe([""],0);function RP(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Qa(t,e,n=0,i=1e9){for(let r=0,s=0,o=!0;s<t.length&&r<=i;s++){let l=t[s],a=r+l.length;a>=n&&(a>i&&(l=l.slice(0,i-r)),r<n&&(l=l.slice(n-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function X0(t,e,n){return Qa(t,[""],e,n)}class zo{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Pe?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof Pe?r.text.length:r.children.length;if(o==(n>0?l:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[i]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
59
|
+
`,this;e--}else if(r instanceof Pe){let a=r.text[o+(n<0?-1:0)];if(this.offsets[i]+=n,a.length>Math.max(0,e))return this.value=e==0?a:n>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(n<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(n>0?1:(a instanceof Pe?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class dS{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new zo(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*n,this.value=r.length<=i?r:n<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class pS{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:r}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(oe.prototype[Symbol.iterator]=function(){return this.iter()},zo.prototype[Symbol.iterator]=dS.prototype[Symbol.iterator]=pS.prototype[Symbol.iterator]=function(){return this});class IP{constructor(e,n,i,r){this.from=e,this.to=n,this.number=i,this.text=r}get length(){return this.to-this.from}}function Bs(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function tt(t,e,n=!0,i=!0){return OP(t,e,n,i)}function DP(t){return t>=56320&&t<57344}function LP(t){return t>=55296&&t<56320}function ir(t,e){let n=t.charCodeAt(e);if(!LP(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return DP(i)?(n-55296<<10)+(i-56320)+65536:n}function BP(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Vr(t){return t<65536?1:2}const cd=/\r\n?|\n/;var Nt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Nt||(Nt={}));class Ln{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n+1];e+=i<0?this.sections[n]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,i=0,r=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,n=!1){hd(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new Ln(e)}composeDesc(e){return this.empty?e:e.empty?this:mS(this,e)}mapDesc(e,n=!1){return e.empty?this:fd(this,e,n)}mapPos(e,n=-1,i=Nt.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],u=r+l;if(a<0){if(u>e)return s+(e-r);s+=l}else{if(i!=Nt.Simple&&u>=e&&(i==Nt.TrackDel&&r<e&&u>e||i==Nt.TrackBefore&&r<e||i==Nt.TrackAfter&&u>e))return null;if(u>e||u==e&&n<0&&!l)return e==r||n<0?s:s+a;s+=a}r=u}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,n=e){for(let i=0,r=0;i<this.sections.length&&r<=n;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=n&&l>=e)return r<e&&l>n?"cover":!0;r=l}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ln(e)}static create(e){return new Ln(e)}}class ze extends Ln{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return hd(this,(n,i,r,s,o)=>e=e.replace(r,r+(i-n),o),!1),e}mapDesc(e,n=!1){return fd(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let r=0,s=0;r<n.length;r+=2){let o=n[r],l=n[r+1];if(l>=0){n[r]=l,n[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(oe.empty);i.push(o?e.slice(s,s+o):oe.empty)}s+=o}return new ze(n,i)}compose(e){return this.empty?e:e.empty?this:mS(this,e,!0)}map(e,n=!1){return e.empty?this:fd(this,e,n,!0)}iterChanges(e,n=!1){hd(this,e,n)}get desc(){return Ln.create(this.sections)}filter(e){let n=[],i=[],r=[],s=new gl(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);Ze(r,c,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Ze(n,c,h),h>0&&bi(i,n,s.text),s.forward(c),l+=c}let u=e[o++];for(;l<u;){if(s.done)break e;let c=Math.min(s.len,u-l);Ze(n,c,-1),Ze(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new ze(n,i),filtered:Ln.create(r)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n],r=this.sections[n+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<n&&Ze(r,n-o,-1);let h=new ze(r,s);l=l?l.compose(h.map(l)):h,r=[],s=[],o=0}function u(c){if(Array.isArray(c))for(let h of c)u(h);else if(c instanceof ze){if(c.length!=n)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${n})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:h,to:f=h,insert:d}=c;if(h>f||h<0||f>n)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${n})`);let p=d?typeof d=="string"?oe.of(d.split(i||cd)):d:oe.empty,y=p.length;if(h==f&&y==0)return;h<o&&a(),h>o&&Ze(r,h-o,-1),Ze(r,f-h,y),bi(s,r,p),o=f}}return u(e),a(!l),l}static empty(e){return new ze(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;i.length<r;)i.push(oe.empty);i[r]=oe.of(s.slice(1)),n.push(s[0],i[r].length)}}}return new ze(n,i)}static createSet(e,n){return new ze(e,n)}}function Ze(t,e,n,i=!1){if(e==0&&n<=0)return;let r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:r>=0&&e==0&&t[r]==0?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function bi(t,e,n){if(n.length==0)return;let i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(oe.empty);t.push(n)}}function hd(t,e,n){let i=t.inserted;for(let r=0,s=0,o=0;o<t.sections.length;){let l=t.sections[o++],a=t.sections[o++];if(a<0)r+=l,s+=l;else{let u=r,c=s,h=oe.empty;for(;u+=l,c+=a,a&&i&&(h=h.append(i[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(r,u,s,c,h),r=u,s=c}}}function fd(t,e,n,i=!1){let r=[],s=i?[]:null,o=new gl(t),l=new gl(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);Ze(r,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!n))){let u=l.len;for(Ze(r,l.ins,-1);u;){let c=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=c&&(Ze(r,0,o.ins),s&&bi(s,r,o.text),a=o.i),o.forward(c),u-=c}l.next()}else if(o.ins>=0){let u=0,c=o.len;for(;c;)if(l.ins==-1){let h=Math.min(c,l.len);u+=h,c-=h,l.forward(h)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;Ze(r,u,a<o.i?o.ins:0),s&&a<o.i&&bi(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?ze.createSet(r,s):Ln.create(r);throw new Error("Mismatched change set lengths")}}}function mS(t,e,n=!1){let i=[],r=n?[]:null,s=new gl(t),o=new gl(e);for(let l=!1;;){if(s.done&&o.done)return r?ze.createSet(i,r):Ln.create(i);if(s.ins==0)Ze(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)Ze(i,0,o.ins,l),r&&bi(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),u=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;Ze(i,a,c,l),r&&c&&bi(r,i,o.text)}else o.ins==-1?(Ze(i,s.off?0:s.len,a,l),r&&bi(r,i,s.textBit(a))):(Ze(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&bi(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>u),s.forward2(a),o.forward(a)}}}}class gl{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,n=this.i-2>>1;return n>=e.length?oe.empty:e[n]}textBit(e){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!e?oe.empty:n[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class wi{constructor(e,n,i,r){this.from=e,this.to=n,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,n=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,n):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new wi(i,r,this.flags,this.goalColumn)}extend(e,n=e,i=0){if(e<=this.anchor&&n>=this.anchor)return V.range(e,n,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return V.range(this.anchor,r,void 0,void 0,i)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!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 V.range(e.anchor,e.head)}static create(e,n,i,r){return new wi(e,n,i,r)}}class V{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:V.create(this.ranges.map(i=>i.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new V([this.main],0)}addRange(e,n=!0){return V.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let i=this.ranges.slice();return i[n]=e,V.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new V(e.ranges.map(n=>wi.fromJSON(n)),e.main)}static single(e,n=e){return new V([V.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return V.normalized(e.slice(),n);i=s.to}return new V(e,n)}static cursor(e,n=0,i,r){return wi.create(e,e,(n==0?0:n<0?8:16)|(i==null?7:Math.min(6,i)),r)}static range(e,n,i,r,s){let o=r==null?7:Math.min(6,r);return!s&&e!=n&&(s=n<e?1:-1),s&&(o|=s<0?8:16),n<e?wi.create(n,e,o|32,i):wi.create(e,n,o,i)}static undirectionalRange(e,n){return wi.create(e,n,64,void 0)}static normalized(e,n=0){let i=e[n];e.sort((r,s)=>r.from-s.from),n=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=n&&n--,e.splice(--r,2,s.anchor>s.head?V.range(a,l):V.range(l,a))}}return new V(e,n)}}function gS(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let hm=0;class Z{constructor(e,n,i,r,s){this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=hm++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Z(e.combine||(n=>n),e.compareInput||((n,i)=>n===i),e.compare||(e.combine?(n,i)=>n===i:fm),!!e.static,e.enables)}of(e){return new Xa([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xa(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xa(e,this,2,n)}from(e,n){return n||(n=i=>i),this.compute([e],i=>n(i.field(e)))}}function fm(t,e){return t==e||t.length==e.length&&t.every((n,i)=>n===e[i])}class Xa{constructor(e,n,i,r){this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=hm++}dynamicSlot(e){var n;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,u=!1,c=[];for(let h of this.dependencies)h=="doc"?a=!0:h=="selection"?u=!0:((n=e[h.id])!==null&&n!==void 0?n:1)&1||c.push(e[h.id]);return{create(h){return h.values[o]=i(h),1},update(h,f){if(a&&f.docChanged||u&&(f.docChanged||f.selection)||dd(h,c)){let d=i(h);if(l?!G0(d,h.values[o],r):!r(d,h.values[o]))return h.values[o]=d,1}return 0},reconfigure:(h,f)=>{let d,p=f.config.address[s];if(p!=null){let y=Lu(f,p);if(this.dependencies.every(x=>x instanceof Z?f.facet(x)===h.facet(x):x instanceof li?f.field(x,!1)==h.field(x,!1):!0)||(l?G0(d=i(h),y,r):r(d=i(h),y)))return h.values[o]=y,0}else d=i(h);return h.values[o]=d,1}}}get extension(){return this}}function G0(t,e,n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function dd(t,e){let n=!1;for(let i of e)$o(t,i)&1&&(n=!0);return n}function zP(t,e,n){let i=n.map(a=>t[a.id]),r=n.map(a=>a.type),s=i.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let c=0;c<i.length;c++){let h=Lu(a,i[c]);if(r[c]==2)for(let f of h)u.push(f);else u.push(h)}return e.combine(u)}return{create(a){for(let u of i)$o(a,u);return a.values[o]=l(a),1},update(a,u){if(!dd(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,u){let c=dd(a,i),h=u.config.facets[e.id],f=u.facet(e);if(h&&!c&&fm(n,h))return a.values[o]=f,0;let d=l(a);return e.compare(d,f)?(a.values[o]=f,0):(a.values[o]=d,1)}}}const da=Z.define({static:!0});class li{constructor(e,n,i,r,s){this.id=e,this.createF=n,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let n=new li(hm++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(da).find(i=>i.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,r)=>{let s=i.values[n],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[n]=o,1)},reconfigure:(i,r)=>{let s=i.facet(da),o=r.facet(da),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[n]=l.create(i),1):r.config.address[this.id]!=null?(i.values[n]=r.field(this),0):(i.values[n]=this.create(i),1)}}}init(e){return[this,da.of({field:this,create:e})]}get extension(){return this}}const sr={lowest:4,low:3,default:2,high:1,highest:0};function ho(t){return e=>new yS(e,t)}const Dl={highest:ho(sr.highest),high:ho(sr.high),default:ho(sr.default),low:ho(sr.low),lowest:ho(sr.lowest)};class yS{constructor(e,n){this.inner=e,this.prec=n}get extension(){return this}}class _c{of(e){return new pd(this,e)}reconfigure(e){return _c.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class pd{constructor(e,n){this.compartment=e,this.inner=n}get extension(){return this}}class Du{constructor(e,n,i,r,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,i){let r=[],s=Object.create(null),o=new Map;for(let f of $P(e,n,o))f instanceof li?r.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],u=[];for(let f of r)l[f.id]=u.length<<1,u.push(d=>f.slot(d));let c=i==null?void 0:i.config.facets;for(let f in s){let d=s[f],p=d[0].facet,y=c&&c[f]||[];if(d.every(x=>x.type==0))if(l[p.id]=a.length<<1|1,fm(y,d))a.push(i.facet(p));else{let x=p.combine(d.map(m=>m.value));a.push(i&&p.compare(x,i.facet(p))?i.facet(p):x)}else{for(let x of d)x.type==0?(l[x.id]=a.length<<1|1,a.push(x.value)):(l[x.id]=u.length<<1,u.push(m=>x.dynamicSlot(m)));l[p.id]=u.length<<1,u.push(x=>zP(x,p,d))}}let h=u.map(f=>f(l));return new Du(e,o,h,l,a,s)}}function $P(t,e,n){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let u=i[a].indexOf(o);u>-1&&i[a].splice(u,1),o instanceof pd&&n.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof pd){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof yS)s(o.inner,o.prec);else if(o instanceof li)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Xa)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,sr.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(t,sr.default),i.reduce((o,l)=>o.concat(l))}function $o(t,e){if(e&1)return 2;let n=e>>1,i=t.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function Lu(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const vS=Z.define(),md=Z.define({combine:t=>t.some(e=>e),static:!0}),wS=Z.define({combine:t=>t.length?t[0]:void 0,static:!0}),xS=Z.define(),SS=Z.define(),kS=Z.define(),bS=Z.define({combine:t=>t.length?t[0]:!1});class $n{constructor(e,n){this.type=e,this.value=n}static define(){return new FP}}class FP{of(e){return new $n(this,e)}}class jP{constructor(e){this.map=e}of(e){return new me(this,e)}}class me{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new me(this.type,n)}is(e){return this.type==e}static define(e={}){return new jP(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(n);s&&i.push(s)}return i}}me.reconfigure=me.define();me.appendConfig=me.define();class Fe{constructor(e,n,i,r,s,o){this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&gS(i,n.newLength),s.some(l=>l.type==Fe.time)||(this.annotations=s.concat(Fe.time.of(Date.now())))}static create(e,n,i,r,s,o){return new Fe(e,n,i,r,s,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 n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Fe.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Fe.time=$n.define();Fe.userEvent=$n.define();Fe.addToHistory=$n.define();Fe.remote=$n.define();function VP(t,e){let n=[];for(let i=0,r=0;;){let s,o;if(i<t.length&&(r==e.length||e[r]>=t[i]))s=t[i++],o=t[i++];else if(r<e.length)s=e[r++],o=e[r++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function CS(t,e,n){var i;let r,s,o;return n?(r=e.changes,s=ze.empty(e.changes.length),o=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=t.selection)===null||i===void 0?void 0:i.map(r),effects:me.mapEffects(t.effects,r).concat(me.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function gd(t,e,n){let i=e.selection,r=vs(e.annotations);return e.userEvent&&(r=r.concat(Fe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ze?e.changes:ze.of(e.changes||[],n,t.facet(wS)),selection:i&&(i instanceof V?i:V.single(i.anchor,i.head)),effects:vs(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function ES(t,e,n){let i=gd(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;i=CS(i,gd(t,e[s],o?i.changes.newLength:t.doc.length),o)}let r=Fe.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return WP(n?HP(r):r)}function HP(t){let e=t.startState,n=!0;for(let r of e.facet(xS)){let s=r(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:VP(n,s))}if(n!==!0){let r,s;if(n===!1)s=t.changes.invertedDesc,r=ze.empty(e.doc.length);else{let o=t.changes.filter(n);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Fe.create(e,r,t.selection&&t.selection.map(s),me.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let i=e.facet(SS);for(let r=i.length-1;r>=0;r--){let s=i[r](t);s instanceof Fe?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Fe?t=s[0]:t=ES(e,vs(s),!1)}return t}function WP(t){let e=t.startState,n=e.facet(kS),i=t;for(let r=n.length-1;r>=0;r--){let s=n[r](t);s&&Object.keys(s).length&&(i=CS(i,gd(e,s,t.changes.newLength),!0))}return i==t?t:Fe.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}const UP=[];function vs(t){return t==null?UP:Array.isArray(t)?t:[t]}var Xn=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Xn||(Xn={}));const KP=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let yd;try{yd=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function qP(t){if(yd)return yd.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||KP.test(n)))return!0}return!1}function YP(t){return e=>{if(!/\S/.test(e))return Xn.Space;if(qP(e))return Xn.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Xn.Word;return Xn.Other}}class ae{constructor(e,n,i,r,s,o){this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)$o(this,l<<1);this.computeSlot=null}field(e,n=!0){let i=this.config.address[e.id];if(i==null){if(n)throw new RangeError("Field is not present in this state");return}return $o(this,i),Lu(this,i)}update(...e){return ES(this,e,!0)}applyTransaction(e){let n=this.config,{base:i,compartments:r}=n;for(let l of e.effects)l.is(_c.reconfigure)?(n&&(r=new Map,n.compartments.forEach((a,u)=>r.set(u,a)),n=null),r.set(l.value.compartment,l.value.extension)):l.is(me.reconfigure)?(n=null,i=l.value):l.is(me.appendConfig)&&(n=null,i=vs(i).concat(l.value));let s;n?s=e.startState.values.slice():(n=Du.resolve(i,r,this),s=new ae(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(md)?e.newSelection:e.newSelection.asSingle();new ae(n,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:V.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,i=e(n.ranges[0]),r=this.changes(i.changes),s=[i.range],o=vs(i.effects);for(let l=1;l<n.ranges.length;l++){let a=e(n.ranges[l]),u=this.changes(a.changes),c=u.map(r);for(let f=0;f<l;f++)s[f]=s[f].map(c);let h=r.mapDesc(u,!0);s.push(a.range.map(h)),r=r.compose(c),o=me.mapEffects(o,c).concat(me.mapEffects(vs(a.effects),h))}return{changes:r,selection:V.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof ze?e:ze.of(e,this.doc.length,this.facet(ae.lineSeparator))}toText(e){return oe.of(e.split(this.facet(ae.lineSeparator)||cd))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:($o(this,n),Lu(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof li&&this.config.address[r.id]!=null&&(n[i]=r.spec.toJSON(this.field(e[i]),this))}return n}static fromJSON(e,n={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return ae.create({doc:e.doc,selection:V.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(e={}){let n=Du.resolve(e.extensions||[],new Map),i=e.doc instanceof oe?e.doc:oe.of((e.doc||"").split(n.staticFacet(ae.lineSeparator)||cd)),r=e.selection?e.selection instanceof V?e.selection:V.single(e.selection.anchor,e.selection.head):V.single(0);return gS(r,i.length),n.staticFacet(md)||(r=r.asSingle()),new ae(n,i,r,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(ae.tabSize)}get lineBreak(){return this.facet(ae.lineSeparator)||`
|
|
60
|
+
`}get readOnly(){return this.facet(bS)}phrase(e,...n){for(let i of this.facet(ae.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>n.length?i:n[s-1]})),e}languageDataAt(e,n,i=-1){let r=[];for(let s of this.facet(vS))for(let o of s(this,n,i))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return YP(n.length?n[0]:"")}wordAt(e){let{text:n,from:i,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=tt(n,o,!1);if(s(n.slice(a,o))!=Xn.Word)break;o=a}for(;l<r;){let a=tt(n,l);if(s(n.slice(l,a))!=Xn.Word)break;l=a}return o==l?null:V.range(o+i,l+i)}}ae.allowMultipleSelections=md;ae.tabSize=Z.define({combine:t=>t.length?t[0]:4});ae.lineSeparator=wS;ae.readOnly=bS;ae.phrases=Z.define({compare(t,e){let n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every(r=>t[r]==e[r])}});ae.languageData=vS;ae.changeFilter=xS;ae.transactionFilter=SS;ae.transactionExtender=kS;_c.reconfigure=me.define();function AS(t,e,n={}){let i={};for(let r of t)for(let s of Object.keys(r)){let o=r[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))i[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}class Bi{eq(e){return this==e}range(e,n=e){return vd.create(e,n,this)}}Bi.prototype.startSide=Bi.prototype.endSide=0;Bi.prototype.point=!1;Bi.prototype.mapMode=Nt.TrackDel;function dm(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let vd=class NS{constructor(e,n,i){this.from=e,this.to=n,this.value=i}static create(e,n,i){return new NS(e,n,i)}};function wd(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class pm{constructor(e,n,i,r){this.from=e,this.to=n,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,n,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+1}}between(e,n,i,r){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,n){let i=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let u=this.value[a],c=this.from[a]+e,h=this.to[a]+e,f,d;if(c==h){let p=n.mapPos(c,u.startSide,u.mapMode);if(p==null||(f=d=p,u.startSide!=u.endSide&&(d=n.mapPos(c,u.endSide),d<f)))continue}else if(f=n.mapPos(c,u.startSide),d=n.mapPos(h,u.endSide),f>d||f==d&&u.startSide>0&&u.endSide<=0)continue;(d-f||u.endSide-u.startSide)<0||(o<0&&(o=f),u.point&&(l=Math.max(l,d-f)),i.push(u),r.push(f-o),s.push(d-o))}return{mapped:i.length?new pm(r,s,i,l):null,pos:o}}}class ue{constructor(e,n,i,r){this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=r}static create(e,n,i,r){return new ue(e,n,i,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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(i&&(n=n.slice().sort(wd)),this.isEmpty)return n.length?ue.of(n):this;let l=new _S(this,null,-1).goto(0),a=0,u=[],c=new yl;for(;l.value||a<n.length;)if(a<n.length&&(l.from-n[a].from||l.startSide-n[a].value.startSide)>=0){let h=n[a++];c.addInner(h.from,h.to,h.value)||u.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==n.length||this.chunkEnd(l.chunkIndex)<n[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||u.push(vd.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!u.length?ue.empty:this.nextLayer.update({add:u,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],i=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],u=e.touchesRange(l,l+a.length);if(u===!1)r=Math.max(r,a.maxPoint),n.push(a),i.push(e.mapPos(l));else if(u===!0){let{mapped:c,pos:h}=a.map(l,e);c&&(r=Math.max(r,c.maxPoint),n.push(c),i.push(h))}}let s=this.nextLayer.map(e);return n.length==0?s:new ue(i,n,s||ue.empty,r)}between(e,n,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(n>=s&&e<=s+o.length&&o.between(s,e-s,n-s,i)===!1)return}this.nextLayer.between(e,n,i)}}iter(e=0){return vl.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return vl.from(e).goto(n)}static compare(e,n,i,r,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=J0(o,l,i),u=new fo(o,a,s),c=new fo(l,a,s);i.iterGaps((h,f,d)=>Z0(u,h,c,f,d,r)),i.empty&&i.length==0&&Z0(u,0,c,0,0,r)}static eq(e,n,i=0,r){r==null&&(r=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=J0(s,o),a=new fo(s,l,0).goto(i),u=new fo(o,l,0).goto(i);for(;;){if(a.to!=u.to||!xd(a.active,u.active)||a.point&&(!u.point||!dm(a.point,u.point)))return!1;if(a.to>r)return!0;a.next(),u.next()}}static spans(e,n,i,r,s=-1){let o=new fo(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),h=o.pointFrom<n?c.length+1:o.point.startSide<0?c.length:Math.min(c.length,a);r.point(l,u,o.point,c,h,o.pointRank),a=Math.min(o.openEnd(u),c.length)}else u>l&&(r.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,n=!1){let i=new yl;for(let r of e instanceof vd?[e]:n?QP(e):e)i.add(r.from,r.to,r.value);return i.finish()}static join(e){if(!e.length)return ue.empty;let n=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let r=e[i];r!=ue.empty;r=r.nextLayer)n=new ue(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}ue.empty=new ue([],[],null,-1);function QP(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let i=t[n];if(wd(e,i)>0)return t.slice().sort(wd);e=i}return t}ue.empty.nextLayer=ue.empty;class yl{finishChunk(e){this.chunks.push(new pm(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,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new yl)).add(e,n,i)}addInner(e,n,i){let r=e-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||i.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(n-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=n,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let i=n.value.length-1;return this.last=n.value[i],this.lastFrom=n.from[i]+e,this.lastTo=n.to[i]+e,!0}finish(){return this.finishInner(ue.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ue.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function J0(t,e,n){let i=new Map;for(let s of t)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&i.set(s.chunk[o],s.chunkPos[o]);let r=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let l=i.get(s.chunk[o]);l!=null&&(n?n.mapPos(l):l)==s.chunkPos[o]&&!(n!=null&&n.touchesRange(l,l+s.chunk[o].length))&&r.add(s.chunk[o])}return r}class _S{constructor(e,n,i,r=0){this.layer=e,this.skip=n,this.minPoint=i,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,i){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++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!i||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!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],n=this.layer.chunk[this.chunkIndex],i=e+n.from[this.rangeIndex];if(this.from=i,this.to=e+n.to[this.rangeIndex],this.value=n.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 vl{constructor(e){this.heap=e}static from(e,n=null,i=-1){let r=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&r.push(new _S(o,n,i,s));return r.length==1?r[0]:new vl(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let i of this.heap)i.goto(e,n);for(let i=this.heap.length>>1;i>=0;i--)Th(this.heap,i);return this.next(),this}forward(e,n){for(let i of this.heap)i.forward(e,n);for(let i=this.heap.length>>1;i>=0;i--)Th(this.heap,i);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Th(this.heap,0)}}}function Th(t,e){for(let n=t[e];;){let i=(e<<1)+1;if(i>=t.length)break;let r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}class fo{constructor(e,n,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=vl.from(e,n,i)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){pa(this.active,e),pa(this.activeTo,e),pa(this.activeRank,e),this.minActive=ey(this.active,this.activeTo)}addActive(e){let n=0,{value:i,to:r,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||r-this.activeTo[n])>0;)n++;ma(this.active,n,i),ma(this.activeTo,n,r),ma(this.activeRank,n,s),e&&ma(e,n,this.cursor.from),this.minActive=ey(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let i=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),i&&pa(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let r=i.length-1;r>=0&&i[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&n.push(this.active[i]);return n.reverse()}openEnd(e){let n=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)n++;return n}}function Z0(t,e,n,i,r,s){t.goto(e),n.goto(i);let o=i+r,l=i,a=i-e,u=!!s.boundChange;for(let c=!1;;){let h=t.to+a-n.to,f=h||t.endSide-n.endSide,d=f<0?t.to+a:n.to,p=Math.min(d,o);if(t.point||n.point?(t.point&&n.point&&dm(t.point,n.point)&&xd(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,p,t.point,n.point),c=!1):(c&&s.boundChange(l),p>l&&!xd(t.active,n.active)&&s.compareRange(l,p,t.active,n.active),u&&p<o&&(h||t.openEnd(d)!=n.openEnd(d))&&(c=!0)),d>o)break;l=d,f<=0&&t.next(),f>=0&&n.next()}}function xd(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!dm(t[n],e[n]))return!1;return!0}function pa(t,e){for(let n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function ma(t,e,n){for(let i=t.length-1;i>=e;i--)t[i+1]=t[i];t[e]=n}function ey(t,e){let n=-1,i=1e9;for(let r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}function Tc(t,e,n=t.length){let i=0;for(let r=0;r<n&&r<t.length;)t.charCodeAt(r)==9?(i+=e-i%e,r++):(i++,r=tt(t,r));return i}function XP(t,e,n,i){for(let r=0,s=0;;){if(s>=e)return r;if(r==t.length)break;s+=t.charCodeAt(r)==9?n-s%n:1,r=tt(t,r)}return t.length}const Sd="ͼ",ty=typeof Symbol>"u"?"__"+Sd:Symbol.for(Sd),kd=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ny=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class zi{constructor(e,n){this.rules=[];let{finish:i}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let c=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(y=>o.map(x=>y.replace(/&/,x))).reduce((y,x)=>y.concat(x)),p,a);else if(p&&typeof p=="object"){if(!h)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(r(d),p,c,f)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(c.length||f)&&a.push((i&&!h&&!u?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(r(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
61
|
+
`)}static newName(){let e=ny[ty]||1;return ny[ty]=e+1,Sd+e.toString(36)}static mount(e,n,i){let r=e[kd],s=i&&i.nonce;r?s&&r.setNonce(s):r=new GP(e,s),r.mount(Array.isArray(n)?n:[n],e)}}let iy=new Map;class GP{constructor(e,n){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=iy.get(i);if(s)return e[kd]=s;this.sheet=new r.CSSStyleSheet,iy.set(i,this)}else this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[kd]=this}mount(e,n){let i=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),i)for(let u=0;u<l.rules.length;u++)i.insertRule(l.rules[u],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(i)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
|
62
|
+
`;this.styleTag.textContent=o;let l=n.head||n;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var $i={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:"'"},wl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},JP=typeof navigator<"u"&&/Mac/.test(navigator.platform),ZP=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qe=0;qe<10;qe++)$i[48+qe]=$i[96+qe]=String(qe);for(var qe=1;qe<=24;qe++)$i[qe+111]="F"+qe;for(var qe=65;qe<=90;qe++)$i[qe]=String.fromCharCode(qe+32),wl[qe]=String.fromCharCode(qe);for(var Mh in $i)wl.hasOwnProperty(Mh)||(wl[Mh]=$i[Mh]);function eR(t){var e=JP&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ZP&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?wl:$i)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}let ot=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},bd=typeof document<"u"?document:{documentElement:{style:{}}};const Cd=/Edge\/(\d+)/.exec(ot.userAgent),TS=/MSIE \d/.test(ot.userAgent),Ed=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ot.userAgent),Mc=!!(TS||Ed||Cd),ry=!Mc&&/gecko\/(\d+)/i.test(ot.userAgent),Oh=!Mc&&/Chrome\/(\d+)/.exec(ot.userAgent),sy="webkitFontSmoothing"in bd.documentElement.style,Ad=!Mc&&/Apple Computer/.test(ot.vendor),oy=Ad&&(/Mobile\/\w+/.test(ot.userAgent)||ot.maxTouchPoints>2);var q={mac:oy||/Mac/.test(ot.platform),windows:/Win/.test(ot.platform),linux:/Linux|X11/.test(ot.platform),ie:Mc,ie_version:TS?bd.documentMode||6:Ed?+Ed[1]:Cd?+Cd[1]:0,gecko:ry,gecko_version:ry?+(/Firefox\/(\d+)/.exec(ot.userAgent)||[0,0])[1]:0,chrome:!!Oh,chrome_version:Oh?+Oh[1]:0,ios:oy,android:/Android\b/.test(ot.userAgent),webkit:sy,webkit_version:sy?+(/\bAppleWebKit\/(\d+)/.exec(ot.userAgent)||[0,0])[1]:0,safari:Ad,safari_version:Ad?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ot.userAgent)||[0,0])[1]:0,tabSize:bd.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function mm(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const Bu=Object.create(null);function gm(t,e,n){if(t==e)return!0;t||(t=Bu),e||(e=Bu);let i=Object.keys(t),r=Object.keys(e);if(i.length-0!=r.length-0)return!1;for(let s of i)if(s!=n&&(r.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function tR(t,e){for(let n=t.attributes.length-1;n>=0;n--){let i=t.attributes[n].name;e[i]==null&&t.removeAttribute(i)}for(let n in e){let i=e[n];n=="style"?t.style.cssText=i:t.getAttribute(n)!=i&&t.setAttribute(n,i)}}function ly(t,e,n){let i=!1;if(e)for(let r in e)n&&r in n||(i=!0,r=="style"?t.style.cssText="":t.removeAttribute(r));if(n)for(let r in n)e&&e[r]==n[r]||(i=!0,r=="style"?t.style.cssText=n[r]:t.setAttribute(r,n[r]));return i}function nR(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let i=t.attributes[n];e[i.name]=i.value}return e}class Ll{eq(e){return!1}updateDOM(e,n,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,n,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Kt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Kt||(Kt={}));class Me extends Bi{constructor(e,n,i,r){super(),this.startSide=e,this.endSide=n,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Bl(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return n+=i&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Er(e,n,n,i,e.widget||null,!1)}static replace(e){let n=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=MS(e,n);i=(s?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new Er(e,i,r,n,e.widget||null,!0)}static line(e){return new zl(e)}static set(e,n=!1){return ue.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Me.none=ue.empty;class Bl extends Me{constructor(e){let{start:n,end:i}=MS(e);super(n?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?mm(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Bu}eq(e){return this==e||e instanceof Bl&&this.tagName==e.tagName&&gm(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}Bl.prototype.point=!1;class zl extends Me{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof zl&&this.spec.class==e.spec.class&&gm(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}zl.prototype.mapMode=Nt.TrackBefore;zl.prototype.point=!0;class Er extends Me{constructor(e,n,i,r,s,o){super(n,i,s,e),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Nt.TrackBefore:Nt.TrackAfter:Nt.TrackDel}get type(){return this.startSide!=this.endSide?Kt.WidgetRange:this.startSide<=0?Kt.WidgetBefore:Kt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Er&&iR(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Er.prototype.point=!0;function MS(t,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=t;return n==null&&(n=t.inclusive),i==null&&(i=t.inclusive),{start:n??e,end:i??e}}function iR(t,e){return t==e||!!(t&&e&&t.compare(e))}function ws(t,e,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}class xl extends Bi{constructor(e,n,i){super(),this.tagName=e,this.attributes=n,this.rank=i}eq(e){return e==this||e instanceof xl&&this.tagName==e.tagName&&gm(this.attributes,e.attributes)}static create(e){return new xl(e.tagName,e.attributes||Bu,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return ue.of(e,n)}}xl.prototype.startSide=xl.prototype.endSide=-1;function Sl(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Nd(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Fo(t,e){if(!e.anchorNode)return!1;try{return Nd(t,e.anchorNode)}catch{return!1}}function Ga(t){return t.nodeType==3?kl(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function jo(t,e,n,i){return n?ay(t,e,n,i,-1)||ay(t,e,n,i,1):!1}function Fi(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function zu(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function ay(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:si(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Fi(t)+(r<0?0:1),t=s}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?si(t):0}else return!1}}function si(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $u(t,e){let{left:n,right:i}=t;if(n==i)return t;let r=e?n:i;return{left:r,right:r,top:t.top,bottom:t.bottom}}function rR(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 OS(t,e){let n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function sR(t,e,n,i,r,s,o,l){let a=t.ownerDocument,u=a.defaultView||window;for(let c=t,h=!1;c&&!h;)if(c.nodeType==1){let f,d=c==a.body,p=1,y=1;if(d)f=rR(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(h=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let g=c.getBoundingClientRect();({scaleX:p,scaleY:y}=OS(c,g)),f={left:g.left,right:g.left+c.clientWidth*p,top:g.top,bottom:g.top+c.clientHeight*y}}let x=0,m=0;if(r=="nearest")e.top<f.top+o?(m=e.top-(f.top+o),n>0&&e.bottom>f.bottom+m&&(m=e.bottom-f.bottom+o)):e.bottom>f.bottom-o&&(m=e.bottom-f.bottom+o,n<0&&e.top-m<f.top&&(m=e.top-(f.top+o)));else{let g=e.bottom-e.top,v=f.bottom-f.top;m=(r=="center"&&g<=v?e.top+g/2-v/2:r=="start"||r=="center"&&n<0?e.top-o:e.bottom-v+o)-f.top}if(i=="nearest"?e.left<f.left+s?(x=e.left-(f.left+s),n>0&&e.right>f.right+x&&(x=e.right-f.right+s)):e.right>f.right-s&&(x=e.right-f.right+s,n<0&&e.left<f.left+x&&(x=e.left-(f.left+s))):x=(i=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:i=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,x||m)if(d)u.scrollBy(x,m);else{let g=0,v=0;if(m){let w=c.scrollTop;c.scrollTop+=m/y,v=(c.scrollTop-w)*y}if(x){let w=c.scrollLeft;c.scrollLeft+=x/p,g=(c.scrollLeft-w)*p}e={left:e.left-g,top:e.top-v,right:e.right-g,bottom:e.bottom-v},g&&Math.abs(g-x)<1&&(i="nearest"),v&&Math.abs(v-m)<1&&(r="nearest")}if(d)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function PS(t,e=!0){let n=t.ownerDocument,i=null,r=null;for(let s=t.parentNode;s&&!(s==n.body||(!e||i)&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),e&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:i,y:r}}class oR{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:n,focusNode:i}=e;this.set(n,Math.min(e.anchorOffset,n?si(n):0),i,Math.min(e.focusOffset,i?si(i):0))}set(e,n,i,r){this.anchorNode=e,this.anchorOffset=n,this.focusNode=i,this.focusOffset=r}}function RS(t){let e=[];for(let n=t;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&e.push({node:n,left:n.scrollLeft,top:n.scrollTop});return e}function IS(t,e=!0){for(let{node:n,left:i,top:r}of t)e&&n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}let rr=null;q.safari&&q.safari_version>=26&&(rr=!1);function DS(t){if(t.setActive)return t.setActive();if(rr)return t.focus(rr);let e=RS(t);t.focus(rr==null?{get preventScroll(){return rr={preventScroll:!0},!0}}:void 0),rr||(rr=!1,IS(e))}let uy;function kl(t,e,n=e){let i=uy||(uy=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function xs(t,e,n,i){let r={key:e,code:e,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function lR(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function aR(t,e){let n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,si(n));;)if(i){if(n.nodeType!=1)return!1;let r=n.childNodes[i-1];r.contentEditable=="false"?i--:(n=r,i=si(n))}else{if(n==t)return!0;i=Fi(n),n=n.parentNode}}function LS(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function BS(t,e){for(let n=t,i=e;;){if(n.nodeType==3&&i>0)return{node:n,offset:i};if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=si(n)}else if(n.parentNode&&!zu(n))i=Fi(n),n=n.parentNode;else return null}}function zS(t,e){for(let n=t,i=e;;){if(n.nodeType==3&&i<n.nodeValue.length)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[i],i=0}else if(n.parentNode&&!zu(n))i=Fi(n)+1,n=n.parentNode;else return null}}class un{constructor(e,n,i=!0){this.node=e,this.offset=n,this.precise=i}static before(e,n){return new un(e.parentNode,Fi(e),n)}static after(e,n){return new un(e.parentNode,Fi(e)+1,n)}}var Te=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Te||(Te={}));const Ar=Te.LTR,ym=Te.RTL;function $S(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const uR=$S("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),cR=$S("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),_d=Object.create(null),kn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);_d[e]=n,_d[n]=-e}function FS(t){return t<=247?uR[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?cR[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const hR=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class On{get dir(){return this.level%2?ym:Ar}constructor(e,n,i){this.from=e,this.to=n,this.level=i}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,i,r){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=n&&l.to>=n){if(l.level==i)return o;(s<0||(r!=0?r<0?l.from<n:l.to>n:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function jS(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!jS(i.inner,r.inner))return!1}return!0}const fe=[];function fR(t,e,n,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:e,l=s<i.length?i[s].from:n,a=s?256:r;for(let u=o,c=a,h=a;u<l;u++){let f=FS(t.charCodeAt(u));f==512?f=c:f==8&&h==4&&(f=16),fe[u]=f==4?2:f,f&7&&(h=f),c=f}for(let u=o,c=a,h=a;u<l;u++){let f=fe[u];if(f==128)u<l-1&&c==fe[u+1]&&c&24?f=fe[u]=c:fe[u]=256;else if(f==64){let d=u+1;for(;d<l&&fe[d]==64;)d++;let p=u&&c==8||d<n&&fe[d]==8?h==1?1:8:256;for(let y=u;y<d;y++)fe[y]=p;u=d-1}else f==8&&h==1&&(fe[u]=1);c=f,f&7&&(h=f)}}}function dR(t,e,n,i,r){let s=r==1?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let u=o?i[o-1].to:e,c=o<i.length?i[o].from:n;for(let h=u,f,d,p;h<c;h++)if(d=_d[f=t.charCodeAt(h)])if(d<0){for(let y=l-3;y>=0;y-=3)if(kn[y+1]==-d){let x=kn[y+2],m=x&2?r:x&4?x&1?s:r:0;m&&(fe[h]=fe[kn[y]]=m),l=y;break}}else{if(kn.length==189)break;kn[l++]=h,kn[l++]=f,kn[l++]=a}else if((p=fe[h])==2||p==1){let y=p==r;a=y?0:1;for(let x=l-3;x>=0;x-=3){let m=kn[x+2];if(m&2)break;if(y)kn[x+2]|=2;else{if(m&4)break;kn[x+2]|=4}}}}}function pR(t,e,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:t,l=r<n.length?n[r].from:e;for(let a=o;a<l;){let u=fe[a];if(u==256){let c=a+1;for(;;)if(c==l){if(r==n.length)break;c=n[r++].to,l=r<n.length?n[r].from:e}else if(fe[c]==256)c++;else break;let h=s==1,f=(c<e?fe[c]:i)==1,d=h==f?h?1:2:i;for(let p=c,y=r,x=y?n[y-1].to:t;p>a;)p==x&&(p=n[--y].from,x=y?n[y-1].to:t),fe[--p]=d;a=c}else s=u,a++}}}function Td(t,e,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=e,u=0;a<n;){let c=!0,h=!1;if(u==s.length||a<s[u].from){let y=fe[a];y!=l&&(c=!1,h=y==16)}let f=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(u<s.length&&p==s[u].from){if(h)break e;let y=s[u];if(!c)for(let x=y.to,m=u+1;;){if(x==n)break e;if(m<s.length&&s[m].from==x)x=s[m++].to;else{if(fe[x]==l)break e;break}}if(u++,f)f.push(y);else{y.from>a&&o.push(new On(a,y.from,d));let x=y.direction==Ar!=!(d%2);Md(t,x?i+1:i,r,y.inner,y.from,y.to,o),a=y.to}p=y.to}else{if(p==n||(c?fe[p]!=l:fe[p]==l))break;p++}f?Td(t,a,p,i+1,r,f,o):a<p&&o.push(new On(a,p,d)),a=p}else for(let a=n,u=s.length;a>e;){let c=!0,h=!1;if(!u||a>s[u-1].to){let y=fe[a-1];y!=l&&(c=!1,h=y==16)}let f=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(u&&p==s[u-1].to){if(h)break e;let y=s[--u];if(!c)for(let x=y.from,m=u;;){if(x==e)break e;if(m&&s[m-1].to==x)x=s[--m].from;else{if(fe[x-1]==l)break e;break}}if(f)f.push(y);else{y.to<a&&o.push(new On(y.to,a,d));let x=y.direction==Ar!=!(d%2);Md(t,x?i+1:i,r,y.inner,y.from,y.to,o),a=y.from}p=y.from}else{if(p==e||(c?fe[p-1]!=l:fe[p-1]==l))break;p--}f?Td(t,p,a,i+1,r,f,o):p<a&&o.push(new On(p,a,d)),a=p}}function Md(t,e,n,i,r,s,o){let l=e%2?2:1;fR(t,r,s,i,l),dR(t,r,s,i,l),pR(r,s,i,l),Td(t,r,s,e,n,i,o)}function mR(t,e,n){if(!t)return[new On(0,0,e==ym?1:0)];if(e==Ar&&!n.length&&!hR.test(t))return VS(t.length);if(n.length)for(;t.length>fe.length;)fe[fe.length]=256;let i=[],r=e==Ar?0:1;return Md(t,r,r,n,0,t.length,i),i}function VS(t){return[new On(0,t,0)]}let HS="";function gR(t,e,n,i,r){var s;let o=i.head-t.from,l=On.find(e,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),a=e[l],u=a.side(r,n);if(o==u){let f=l+=r?1:-1;if(f<0||f>=e.length)return null;a=e[l=f],o=a.side(!r,n),u=a.side(r,n)}let c=tt(t.text,o,a.forward(r,n));(c<a.from||c>a.to)&&(c=u),HS=t.text.slice(Math.min(o,c),Math.max(o,c));let h=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return h&&c==u&&h.level+(r?0:1)<a.level?V.cursor(h.side(!r,n)+t.from,h.forward(r,n)?1:-1,h.level):V.cursor(c+t.from,a.forward(r,n)?-1:1,a.level)}function yR(t,e,n){for(let i=e;i<n;i++){let r=FS(t.charCodeAt(i));if(r==1)return Ar;if(r==2||r==4)return ym}return Ar}const WS=Z.define(),US=Z.define(),KS=Z.define(),qS=Z.define(),Od=Z.define(),YS=Z.define(),QS=Z.define(),vm=Z.define(),wm=Z.define(),XS=Z.define({combine:t=>t.some(e=>e)}),vR=Z.define({combine:t=>t.some(e=>e)}),GS=Z.define();class Ss{constructor(e,n,i,r,s,o=!1){this.range=e,this.y=n,this.x=i,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Ss(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 Ss(V.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ga=me.define({map:(t,e)=>t.map(e)}),JS=me.define();function Tt(t,e,n){let i=t.facet(qS);i.length?i[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Kn=Z.define({combine:t=>t.length?t[0]:!0});let wR=0;const is=Z.define({combine(t){return t.filter((e,n)=>{for(let i=0;i<n;i++)if(t[i].plugin==e.plugin)return!1;return!0})}});class Bn{constructor(e,n,i,r,s){this.id=e,this.create=n,this.domEventHandlers=i,this.domEventObservers=r,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(is.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(is.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:i,eventObservers:r,provide:s,decorations:o}=n||{};return new Bn(wR++,e,i,r,l=>{let a=[];return o&&a.push(Oc.of(u=>{let c=u.plugin(l);return c?o(c):Me.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return Bn.define((i,r)=>new e(i,r),n)}}class Ph{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 n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(i){if(Tt(n.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Tt(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(i){Tt(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const ZS=Z.define(),xm=Z.define(),Oc=Z.define(),ek=Z.define(),Sm=Z.define(),$l=Z.define(),tk=Z.define();function cy(t,e){let n=t.state.facet(tk);if(!n.length)return n;let i=n.map(s=>s instanceof Function?s(t):s),r=[];return ue.spans(i,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,c=o-e.from,h=r;for(let f=l.length-1;f>=0;f--,a--){let d=l[f].spec.bidiIsolate,p;if(d==null&&(d=yR(e.text,u,c)),a>0&&h.length&&(p=h[h.length-1]).to==u&&p.direction==d)p.to=c,h=p.inner;else{let y={from:u,to:c,direction:d,inner:[]};h.push(y),h=y.inner}}}}),r}const nk=Z.define();function km(t){let e=0,n=0,i=0,r=0;for(let s of t.state.facet(nk)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:n,top:i,bottom:r}}const No=Z.define();class Vt{constructor(e,n,i,r){this.fromA=e,this.toA=n,this.fromB=i,this.toB=r}join(e){return new Vt(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 n=e.length,i=this;for(;n>0;n--){let r=e[n-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),e.splice(n-1,1)}}return e.splice(n,0,i),e}static extendWithRanges(e,n){if(n.length==0)return e;let i=[];for(let r=0,s=0,o=0;;){let l=r<e.length?e[r].fromB:1e9,a=s<n.length?n[s]:1e9,u=Math.min(l,a);if(u==1e9)break;let c=u+o,h=u,f=c;for(;;)if(s<n.length&&n[s]<=h){let d=n[s+1];s+=2,h=Math.max(h,d);for(let p=r;p<e.length&&e[p].fromB<=h;p++)o=e[p].toA-e[p].toB;f=Math.max(f,d+o)}else if(r<e.length&&e[r].fromB<=h){let d=e[r++];h=Math.max(h,d.toB),f=Math.max(f,d.toA),o=d.toA-d.toB}else break;i.push(new Vt(c,f,u,h))}return i}}class Fu{constructor(e,n,i){this.view=e,this.state=n,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ze.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let r=[];this.changes.iterChangedRanges((s,o,l,a)=>r.push(new Vt(s,o,l,a))),this.changedRanges=r}static create(e,n,i){return new Fu(e,n,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const xR=[];class Oe{constructor(e,n,i=0){this.dom=e,this.length=n,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return xR}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 n=this.domAttrs;n&&tR(this.dom,n)}}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,n=this.posAtStart){let i=n;for(let r of this.children){if(r==e)return i;i+=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,n,i){return null}domPosFor(e,n){let i=Fi(this.dom),r=this.length?e>0:n>0;return new un(this.parent.dom,i+(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 Rc)return e;return null}static get(e){return e.cmTile}}class Pc extends Oe{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 n=this.dom,i=null,r,s=(e==null?void 0:e.node)==n?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,r=i?i.nextSibling:n.firstChild,s&&r!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;r&&r!=l.dom;)r=hy(r);else n.insertBefore(l.dom,r);i=l.dom}for(r=i?i.nextSibling:n.firstChild,s&&r&&(s.written=!0);r;)r=hy(r);this.length=o}}function hy(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Rc extends Pc{constructor(e,n){super(n),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 n=Oe.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],i=this,r=0,s=0;;)if(r==i.children.length){if(!n.length)return;i=i.parent,i.breakAfter&&s++,r=n.pop()}else{let o=i.children[r++];if(o instanceof Jn)n.push(r),i=o,r=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,n){let i,r=-1,s,o=-1;if(this.blockTiles((l,a)=>{let u=a+l.length;if(e>=a&&e<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(a<e||e==u&&(n<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,r=e-a),(u>e||e==a&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!i&&!s)throw new Error("No tile at position "+e);return i&&n<0||!s?{tile:i,offset:r}:{tile:s,offset:o}}}class Jn extends Pc{constructor(e,n){super(e),this.wrapper=n}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,n){let i=new Jn(n||document.createElement(e.tagName),e);return n||(i.flags|=4),i}}class zs extends Pc{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,i){let r=new zs(n||document.createElement("div"),e);return(!n||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,n,i){let r=null,s=-1,o=null,l=-1;function a(c,h){for(let f=0,d=0;f<c.children.length&&d<=h;f++){let p=c.children[f],y=d+p.length;y>=h&&(p.isComposite()?a(p,h-d):(!o||o.isHidden&&(n>0&&!(o.flags&32)||i&&kR(o,p)))&&(y>h||p.flags&32&&n<=1)?(o=p,l=h-d):(d<h||p.flags&16&&!p.isHidden&&n>=-1)&&(r=p,s=h-d)),d=y}}a(this,e);let u=(n<0?r:o)||r||o;return u?{tile:u,offset:u==r?s:l}:null}coordsIn(e,n,i){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n,i):SR(this)}domIn(e,n){let i=this.resolveInline(e,n);if(i){let{tile:r,offset:s}=i;if(this.dom.contains(r.dom))return r.isText()?new un(r.dom,Math.min(r.dom.nodeValue.length,s)):r.domPosFor(s,r.flags&16?1:r.flags&32?-1:n);let o=i.tile.parent,l=!1;for(let a of o.children){if(l)return new un(a.dom,0);a==i.tile&&(l=!0)}}return new un(this.dom,0)}}function SR(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Ga(e);return n[n.length-1]||null}function kR(t,e){let n=t.coordsIn(0,1),i=e.coordsIn(0,1);return n&&i&&i.top<n.bottom}class mt extends Pc{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let i=new mt(n||document.createElement(e.tagName),e);return n||(i.flags|=4),i}}class hr extends Oe{constructor(e,n){super(e,n.length),this.text=n}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,n,i){let r=this.dom.nodeValue.length;e>r&&(e=r);let s=e,o=e,l=0;e==0&&n<0||e==r&&n>=0?q.chrome||q.gecko||(e?(s--,l=1):o<r&&(o++,l=-1)):n<0?s--:o<r&&o++;let a=kl(this.dom,s,o).getClientRects();if(!a.length)return null;let u=a[(l?l<0:n>=0)?0:a.length-1];return q.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(a,c=>c.width)||u),i==null?u:$u(u,(l?l>0:n<0)==i)}static of(e,n){let i=new hr(n||document.createTextNode(e),e);return n||(i.flags|=2),i}}class Nr extends Oe{constructor(e,n,i,r){super(e,n,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,i){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;if(i)return $u(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top<o.bottom);a+=l?-1:1);return $u(o,!l)}}get overrideDOMText(){if(!this.length)return oe.empty;let{root:e}=this;if(!e)return oe.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,i,r,s){return s||(s=e.toDOM(n),e.editable||(s.contentEditable="false")),new Nr(s,i,e,r)}}class ju extends Oe{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!0}get overrideDOMText(){return oe.empty}coordsIn(e,n,i){let r=this.dom.getBoundingClientRect();return i==null?r:$u(r,n>0==i)}}class bR{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,i){let{tile:r,index:s,beforeBreak:o,parents:l}=this;for(;e||n>0;)if(r.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(s==r.children.length){if(!e&&!l.length)break;i&&i.leave(r),o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++}else{let a=r.children[s],u=a.breakAfter;(n>0?a.length<=e:a.length<e)&&(!i||i.skip(a,0,a.length)!==!1||!a.isComposite)?(o=!!u,s++,e-=a.length):(l.push({tile:r,index:s}),r=a,s=0,i&&a.isComposite()&&i.enter(a))}else{let a=r.length;if(s<a&&e){let u=Math.min(e,a-s);i&&i.skip(r,s,s+u),e-=u,s+=u}if(s==a)o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++;else if(!e)break}return this.tile=r,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class CR{constructor(e,n,i,r){this.from=e,this.to=n,this.wrapper=i,this.rank=r}}class ER{constructor(e,n,i){this.cache=e,this.root=n,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,i,r){var s;this.flushBuffer();let o=this.ensureMarks(n,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+e.length<512){this.cache.reused.set(l,2);let a=o.children[o.children.length-1]=new hr(l.dom,l.text+e);a.parent=o}else o.append(r||hr.of(e,(s=this.cache.find(hr))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let i=this.curLine;i.dom!=n.line.dom&&(i.setDOM(this.cache.reused.has(n.line)?Rh(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let r=i;for(let l=n.marks.length-1;l>=0;l--){let a=n.marks[l],u=r.lastChild;if(u instanceof mt&&u.mark.eq(a.mark))u.dom!=a.dom&&u.setDOM(Rh(a.dom)),r=u;else{if(this.cache.reused.get(a)){let h=Oe.get(a.dom);h&&h.setDOM(Rh(a.dom))}let c=mt.of(a.mark,a.dom);r.append(c),r=c}this.cache.reused.set(a,2)}let s=Oe.get(e.text);s&&this.cache.reused.set(s,2);let o=new hr(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,r.append(o)}addInlineWidget(e,n,i){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let s=this.ensureMarks(n,i);!r&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,i){this.flushBuffer(),this.ensureMarks(n,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var i;e||(e=ik);let r=zs.start(e,n||((i=this.cache.find(zs))===null||i===void 0?void 0:i.dom),!!n);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,n){var i;let r=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(n>0&&(l=r.lastChild)&&l instanceof mt&&l.mark.eq(o))r=l,n--;else{let a=mt.of(o,(i=this.cache.find(mt,u=>u.mark.eq(o)))===null||i===void 0?void 0:i.dom);r.append(a),r=a,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!fy(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(q.ios&&fy(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Ih,0,32)||new Nr(Ih.toDOM(),0,Ih,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 n=e.rank*102+e.value.rank,i=new CR(e.from,e.to,e.value,n),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let i of this.wrappers){let r=n.lastChild;if(i.from<this.pos&&r instanceof Jn&&r.wrapper.eq(i.wrapper))n=r;else{let s=Jn.of(i.wrapper,(e=this.cache.find(Jn,o=>o.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),i=this.cache.find(ju,void 0,1);return i&&(i.flags=n),i||new ju(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class AR{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:s,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 l=this.textOff=Math.min(e,r.length);return s?null:r.slice(0,l)}let n=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,n);return this.textOff=n,i}}const Vu=[Nr,zs,hr,mt,ju,Jn,Rc];for(let t=0;t<Vu.length;t++)Vu[t].bucket=t;class NR{constructor(e){this.view=e,this.buckets=Vu.map(()=>[]),this.index=Vu.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,i=this.buckets[n];i.length<6?i.push(e):i[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,i=2){let r=e.bucket,s=this.buckets[r],o=this.index[r];for(let l=0;l<s.length;l++){let a=(l+o)%s.length,u=s[a];if((!n||n(u))&&!this.reused.has(u))return s.splice(a,1),a<o&&this.index[r]--,this.reused.set(u,i),u}return null}findWidget(e,n,i){let r=this.buckets[0];if(r.length)for(let s=0,o=0;;s++){if(s==r.length){if(o)return null;o=1,s=0}let l=r[s];if(!this.reused.has(l)&&(o==0?l.widget.compare(e):l.widget.constructor==e.constructor&&e.updateDOM(l.dom,this.view,l.widget)))return r.splice(s,1),s<this.index[0]&&this.index[0]--,l.widget==e&&l.length==n&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new Nr(l.dom,n,e,l.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class _R{constructor(e,n,i,r,s){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new NR(e),this.text=new AR(e.state.doc),this.builder=new ER(this.cache,new Rc(e,e.contentDOM),ue.iter(i)),this.cache.reused.set(n,2),this.old=new bR(n),this.reuseWalker={skip:(o,l,a)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let i=n&&this.getCompositionContext(n.text);for(let r=0,s=0,o=0;;){let l=o<e.length?e[o++]:null,a=l?l.fromA:this.old.root.length;if(a>r){let u=a-r;this.preserve(u,!o,!l),r=a,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(s,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,i),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,l.toA),this.emit(n.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(s,l.toB)),s=l.toB,r=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,i){let r=OR(this.old),s=this.openMarks;this.old.advance(e,i?1:-1,{skip:(o,l,a)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let u=a>0||l<o.length?Nr.of(o.widget,this.view,a-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);u.flags&256?(u.flags&=-2,this.builder.addBlockWidget(u)):(this.builder.ensureLine(null),this.builder.addInlineWidget(u,r,s),s=r.length)}else if(o.isText())this.builder.ensureLine(null),!l&&a==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,r,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,a),r,s)),s=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof ju)this.cache.add(o);else if(o instanceof mt)this.builder.ensureLine(null),this.builder.addMark(o,r,s),this.cache.reused.set(o,1),s=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 mt&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=s=0):o instanceof mt&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let i=null,r=this.builder,s=-1,o=ue.spans(this.decorations,e,n,{point:(l,a,u,c,h,f)=>{if(u instanceof Er){if(this.disallowBlockEffectsFor[f]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,h>c.length)r.continueWidget(a-l);else{let d=u.widget||(u.block?$s.block:$s.inline),p=TR(u),y=this.cache.findWidget(d,a-l,p)||Nr.of(d,this.view,a-l,p);u.block?(u.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(y)):(r.ensureLine(i),r.addInlineWidget(y,c,h))}i=null}else i=MR(i,u);a>l&&this.text.skip(a-l)},span:(l,a,u,c)=>{for(let h=l;h<a;){let f=this.text.next(Math.min(512,a-h));f==null?(r.addLineStartIfNotCovered(i),r.addBreak(),h++):(r.ensureLine(i),r.addText(f,u,h==l?c:u.length),h+=f.length),i=null}s=u.length}});s>-1&&(this.openWidget=o>s),this.openWidget||r.addLineStartIfNotCovered(i),this.openMarks=o}forward(e,n,i=1){n-e<=10?this.old.advance(n-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let n=[],i=null;for(let r=e.parentNode;;r=r.parentNode){let s=Oe.get(r);if(r==this.view.contentDOM)break;s instanceof mt?n.push(s):s!=null&&s.isLine()?i=s:s instanceof Jn||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new zs(r,ik):i||n.push(mt.of(new Bl({tagName:r.nodeName.toLowerCase(),attributes:nR(r)}),r)))}return{line:i,marks:n}}}function fy(t,e){let n=i=>{for(let r of i.children)if((e?r.isText():r.length)||n(r))return!0;return!1};return n(t)}function TR(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const ik={class:"cm-line"};function MR(t,e){let n=e.spec.attributes,i=e.spec.class;return!n&&!i||(t||(t={class:"cm-line"}),n&&mm(n,t),i&&(t.class+=" "+i)),t}function OR(t){let e=[];for(let n=t.parents.length;n>1;n--){let i=n==t.parents.length?t.tile:t.parents[n].tile;i instanceof mt&&e.push(i.mark)}return e}function Rh(t){let e=Oe.get(t);return e&&e.setDOM(t.cloneNode()),t}class $s extends Ll{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}}$s.inline=new $s("span");$s.block=new $s("div");const Ih=new class extends Ll{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class dy{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Me.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 Rc(e,e.contentDOM),this.updateInner([new Vt(0,0,0,e.state.doc.length)],null)}update(e){var n;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:h})=>h<this.minWidthFrom||c>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&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!FR(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let s=r>-1?RR(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:h}=this.hasComposition;i=new Vt(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(q.ie||q.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=LR(o,this.decorations,e.changes);a.length&&(i=Vt.extendWithRanges(i,a));let u=zR(l,this.blockWrappers,e.changes);return u.length&&(i=Vt.extendWithRanges(i,u)),s&&!i.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(i=s.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(n||e.length){let o=this.tile,l=new _R(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Oe.get(n.text)&&l.cache.reused.set(Oe.get(n.text),2),this.tile=l.run(e,n),Pd(o,l.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 s=q.chrome||q.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||i.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.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 s of this.tile.children)s.isWidget()&&s.widget instanceof Dh&&r.push(s.dom);i.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let i of n.effects)i.is(JS)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,r=this.view.root.activeElement,s=r==i,o=!s&&!(this.view.state.facet(Kn)||i.tabIndex>-1)&&Fo(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(s||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,u,c;if(a.empty?c=u=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),u=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),q.gecko&&a.empty&&!this.hasComposition&&PR(u)){let f=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(f,u.node.childNodes[u.offset]||null)),u=c=new un(f,0),l=!0}let h=this.view.observer.selectionRange;(l||!h.focusNode||(!jo(u.node,u.offset,h.anchorNode,h.anchorOffset)||!jo(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,a))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&i.contains(h.focusNode)&&$R(h.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let f=Sl(this.view.root);if(f)if(a.empty){if(q.gecko){let d=IR(u.node,u.offset);if(d&&d!=3){let p=(d==1?BS:zS)(u.node,u.offset);p&&(u=new un(p.node,p.offset))}}f.collapse(u.node,u.offset),a.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=a.bidiLevel)}else if(f.extend){f.collapse(u.node,u.offset);try{f.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([u,c]=[c,u]),d.setEnd(c.node,c.offset),d.setStart(u.node,u.offset),f.removeAllRanges(),f.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(u,c)),this.impreciseAnchor=u.precise?null:new un(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new un(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&jo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,i=Sl(e.root),{anchorNode:r,anchorOffset:s}=e.observer.selectionRange;if(!i||!n.empty||!n.assoc||!i.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let a=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!a||!u||a.bottom>u.top)return;let c=this.domAtPos(n.head+n.assoc,n.assoc);i.collapse(c.node,c.offset),i.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&i.collapse(r,s)}posFromDOM(e,n){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let s;if(e==i.dom)s=i.dom.childNodes[n];else{let o=si(e)==0?0:n==0?-1:1;for(;;){let l=e.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==i.dom.firstChild)return r;for(;s&&!Oe.get(s);)s=s.nextSibling;if(!s)return r+i.length;for(let o=0,l=r;;o++){let a=i.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return i.isText()?e==i.dom?r+n:r+(n?i.length:0):r}domAtPos(e,n){let{tile:i,offset:r}=this.tile.resolveBlock(e,n);return i.isWidget()?i.domPosFor(r,n):i.domIn(r,n)}inlineDOMNearPos(e,n){let i,r=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((u,c)=>{if(u.isWidget()){if(u.flags&32&&c>=e)return!0;u.flags&16&&(s=!0)}else{let h=c+u.length;if(c<=e&&(i=u,r=e-c,s=h<e),h>=e&&!o&&(o=u,l=e-c,a=c>e),c>e&&o)return!0}}),!i&&!o?this.domAtPos(e,n):(s&&o?i=null:a&&i&&(o=null),i&&n<0||!o?i.domIn(r,n):o.domIn(l,n))}coordsAt(e,n,i){let{tile:r,offset:s}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof Dh?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n,i)}lineAt(e,n){let{tile:i}=this.tile.resolveBlock(e,n);return i.isLine()?i:null}coordsForChar(e){let{tile:n,offset:i}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function r(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=r(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&o<s.length){let l=tt(s.text,o);if(l==o)return null;let a=kl(s.dom,o,l).getClientRects();for(let u=0;u<a.length;u++){let c=a[u];if(u==a.length-1||c.top<c.bottom&&c.left<c.right)return c}}return null}return r(n,i)}measureVisibleLineHeights(e){let n=[],{from:i,to:r}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Te.LTR,u=0,c=(h,f,d)=>{for(let p=0;p<h.children.length&&!(f>r);p++){let y=h.children[p],x=f+y.length,m=y.dom.getBoundingClientRect(),{height:g}=m;if(d&&!p&&(u+=m.top-d.top),y instanceof Jn)x>i&&c(y,f,m);else if(f>=i&&(u>0&&n.push(-u),n.push(g+u),u=0,o)){let v=y.dom.lastChild,w=v?Ga(v):[];if(w.length){let k=w[w.length-1],C=a?k.right-m.left:m.right-k.left;C>l&&(l=C,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=x)}}d&&p==h.children.length-1&&(u+=d.bottom-m.bottom),f=x+y.breakAfter}};return c(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Te.RTL:Te.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let c=Ga(u.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let n=document.createElement("div"),i,r,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=Ga(n.firstChild)[0];i=n.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,s=o&&o.height?o.height:i,n.remove()}),{lineHeight:i,charWidth:r,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let i=0,r=0;;r++){let s=r==n.viewports.length?null:n.viewports[r],o=s?s.from-1:this.view.state.doc.length;if(o>i){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(i).top)/this.view.scaleY;e.push(Me.replace({widget:new Dh(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return Me.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Oc).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,r=this.view.state.facet(Sm).map((s,o)=>{let l=typeof s=="function";return l&&(i=!0),l?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[e++]=i,n.push(ue.join(r))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(ek).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(GS))try{if(u(this.view,e.range,e))return!0}catch(c){Tt(this.view.state,c,"scroll handler")}let{range:n}=e,i=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),r;if(!i)return;!n.empty&&(r=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let s=km(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(sR(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==Te.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(n.head,1);if(u){let c=RS(u.dom);u.dom.scrollIntoView({block:"nearest"}),IS(c,!1)}}}lineHasWidget(e){let n=i=>i.isWidget()||i.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){Pd(this.tile)}}function Pd(t,e){let n=e==null?void 0:e.get(t);if(n!=1){n==null&&t.destroy();for(let i of t.children)Pd(i,e)}}function PR(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 rk(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let i=BS(n.focusNode,n.focusOffset),r=zS(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let l=Oe.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)s=r;else if(t.docView.lastCompositionAfterCursor){let a=Oe.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(s=r)}}if(t.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function RR(t,e,n){let i=rk(t,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc;return{range:new Vt(a.mapPos(s),a.mapPos(o),s,o),text:r}}function IR(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 DR=class{constructor(){this.changes=[]}compareRange(e,n){ws(e,n,this.changes)}comparePoint(e,n){ws(e,n,this.changes)}boundChange(e){ws(e,e,this.changes)}};function LR(t,e,n){let i=new DR;return ue.compare(t,e,n,i),i.changes}class BR{constructor(){this.changes=[]}compareRange(e,n){ws(e,n,this.changes)}comparePoint(){}boundChange(e){ws(e,e,this.changes)}}function zR(t,e,n){let i=new BR;return ue.compare(t,e,n,i),i.changes}function $R(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function FR(t,e){let n=!1;return e&&t.iterChangedRanges((i,r)=>{i<e.to&&r>e.from&&(n=!0)}),n}class Dh extends Ll{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 jR(t,e,n=1){let i=t.charCategorizer(e),r=t.doc.lineAt(e),s=e-r.from;if(r.length==0)return V.cursor(e);s==0?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=tt(r.text,s,!1):l=tt(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let u=tt(r.text,o,!1);if(i(r.text.slice(u,o))!=a)break;o=u}for(;l<r.length;){let u=tt(r.text,l);if(i(r.text.slice(l,u))!=a)break;l=u}return V.undirectionalRange(o+r.from,l+r.from)}function VR(t,e,n,i,r){let s=Math.round((i-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((r-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+XP(o,s,t.state.tabSize)}function HR(t,e,n){let i=t.lineBlockAt(e);if(Array.isArray(i.type)){let r;for(let s of i.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!r||s.type==Kt.Text&&(r.type!=s.type||(n<0?s.from<e:s.to>e)))&&(r=s)}}return r||i}return i}function WR(t,e,n,i){let r=HR(t,e.head,e.assoc||-1),s=!i||r.type!=Kt.Text||!(t.lineWrapping||r.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),l=t.textDirectionAt(r.from),a=t.posAtCoords({x:n==(l==Te.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return V.cursor(a,n?-1:1)}return V.cursor(n?r.to:r.from,n?-1:1)}function py(t,e,n,i){let r=t.state.doc.lineAt(e.head),s=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let l=e,a=null;;){let u=gR(r,s,o,l,n),c=HS;if(!u){if(r.number==(n?t.state.doc.lines:1))return l;c=`
|
|
63
|
+
`,r=t.state.doc.line(r.number+(n?1:-1)),s=t.bidiSpans(r),u=t.visualLineSide(r,!n)}if(a){if(!a(c))return l}else{if(!i)return u;a=i(c)}l=u}}function UR(t,e,n){let i=t.state.charCategorizer(e),r=i(n);return s=>{let o=i(s);return r==Xn.Space&&(r=o),r==o}}function KR(t,e,n,i){let r=e.head,s=n?1:-1;if(r==(n?t.state.doc.length:0))return V.cursor(r,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),c=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let p=t.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-p.from))),l=(s<0?p.top:p.bottom)+c}let h=a.left+o,f=t.viewState.heightOracle.textHeight>>1,d=i??f;for(let p=0;;p+=f){let y=l+(d+p)*s,x=Rd(t,{x:h,y},!1,s);if(n?y>a.bottom:y<a.top)return V.cursor(x.pos,x.assoc);let m=t.coordsAtPos(x.pos,x.assoc),g=m?(m.top+m.bottom)/2:0;if(!m||(n?g>l:g<l))return V.cursor(x.pos,x.assoc,void 0,o)}}function Vo(t,e,n){for(;;){let i=0;for(let r of t)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=i||n||(e-s<o-e?-1:1);e=a<0?s:o,i=a}});if(!i)return e}}function sk(t,e){let n=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],s=null;if(r.empty){let o=Vo(t,r.from,0);o!=r.from&&(s=V.cursor(o,-1))}else{let o=Vo(t,r.from,-1),l=Vo(t,r.to,1);(o!=r.from||l!=r.to)&&(r.undirectional?s=V.undirectionalRange(r.from,r.to):s=V.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(n||(n=e.ranges.slice()),n[i]=s)}return n?V.create(n,e.mainIndex):e}function Lh(t,e,n){let i=Vo(t.state.facet($l).map(r=>r(t)),n.from,e.head>n.from?-1:1);return i==n.from?n:V.cursor(i,i<n.from?1:-1)}class Mn{constructor(e,n){this.pos=e,this.assoc=n}}function Rd(t,e,n,i){let r=t.contentDOM.getBoundingClientRect(),s=r.top+t.viewState.paddingTop,{x:o,y:l}=e,a=l-s,u;for(;;){if(a<0)return new Mn(0,1);if(a>t.viewState.docHeight)return new Mn(t.state.doc.length,-1);if(u=t.elementAtHeight(a),i==null)break;if(u.type==Kt.Text){if(i<0?u.to<t.viewport.from:u.from>t.viewport.to)break;let f=t.docView.coordsAt(i<0?u.from:u.to,i>0?-1:1);if(f&&(i<0?f.top<=a+s:f.bottom>=a+s))break}let h=t.viewState.heightOracle.textHeight/2;a=i>0?u.bottom+h:u.top-h}if(t.viewport.from>=u.to||t.viewport.to<=u.from){if(n)return null;if(u.type==Kt.Text){let h=VR(t,r,u,o,l);return new Mn(h,h==u.from?1:-1)}}if(u.type!=Kt.Text)return a<(u.top+u.bottom)/2?new Mn(u.from,1):new Mn(u.to,-1);let c=t.docView.lineAt(u.from,2);return(!c||c.length!=u.length)&&(c=t.docView.lineAt(u.from,-2)),new qR(t,o,l,t.textDirectionAt(u.from)).scanTile(c,u.from)}class qR{constructor(e,n,i,r){this.view=e,this.x=n,this.y=i,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,n){let{line:i,spans:r}=this.bidiSpansAt(e);return r[On.find(r,e-i.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:i,spans:r}=this.bidiSpansAt(e);return r[On.find(r,e-i.from,-1,n)].dir}bidiIn(e,n){let{spans:i,line:r}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from<n)}scan(e,n,i=!1){let r=0,s=e.length-1,o=new Set,l=this.bidiIn(e[0],e[s]),a,u,c=-1,h=1e9,f;e:for(;r<s;){let p=s-r,y=r+s>>1;t:if(o.has(y)){for(let g=1;g<p;g++){let v=y+g;if(v>=s&&(v-=p),!o.has(v)){y=v;break t}}break e}o.add(y);let x=n(y),m=0;if(x)for(let g=0;g<x.length;g++){let v=x[g];if(!(v.width==0&&x.length>1))if(v.bottom<this.y)(!a||a.bottom<v.bottom)&&(a=v),m=1;else if(v.top>this.y)(!u||u.top>v.top)&&(u=v),m=-1;else{let w=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,k=Math.abs(w);k<h&&(c=y,h=k,f=v),w&&(m=w<0==(this.baseDir==Te.LTR)?-1:1)}}m==-1&&(!l||this.baseDirAt(e[y],1))?s=y:m==1&&(!l||this.baseDirAt(e[y+1],-1))&&(r=y+1)}if(!f){if(!u&&!a)return{i:e[0],after:!1};let p=a&&(!u||this.y-a.bottom<u.top-this.y)?a:u;return this.y=(p.top+p.bottom)/2,this.scan(e,n,!0)}if(h&&!i){let{top:p,bottom:y}=f;if(a&&a.bottom>(p+p+y)/3)return this.y=a.bottom-1,this.scan(e,n,!0);if(u&&u.top<(p+y+y)/3)return this.y=u.top+1,this.scan(e,n,!0)}let d=(l?this.dirAt(e[c],1):this.baseDir)==Te.LTR;return{i:c,after:this.x>(f.left+f.right)/2==d}}scanText(e,n){let i=[];for(let s=0;s<e.length;s=tt(e.text,s))i.push(n+s);i.push(n+e.length);let r=this.scan(i,s=>{let o=i[s]-n,l=i[s+1]-n;return kl(e.dom,o,l).getClientRects()});return r.after?new Mn(i[r.i+1],-1):new Mn(i[r.i],1)}scanTile(e,n){if(!e.length)return new Mn(n,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let i=[n];for(let l=0,a=n;l<e.children.length;l++)i.push(a+=e.children[l].length);let r=this.scan(i,l=>{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:kl(a.dom,0,a.length)).getClientRects()}),s=e.children[r.i],o=i[r.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):r.after?new Mn(i[r.i+1],-1):new Mn(o,1)}}const Hr="";class YR{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(ae.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Hr}readRange(e,n){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r);let s=this.text.length;this.readNode(r);let o=Oe.get(r),l=r.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=Oe.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:zu(r))||zu(l)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!XR(l,n)&&this.lineBreak(),r=l}return this.findPointBefore(i,n),this}readTextNode(e){let n=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,n.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=r.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(i,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=s+o}}readNode(e){let n=Oe.get(e),i=n&&n.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.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,n){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==n&&(i.pos=this.text.length)}findPointInside(e,n){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(QR(e,i.node,i.offset)?n:0))}}function QR(t,e,n){for(;;){if(!e||n<si(e))return!1;if(e==t)return!0;n=Fi(e)+1,e=e.parentNode}}function XR(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let i=Oe.get(t);if(!(i!=null&&i.isWidget()))return!1;i&&(n||(n=[])).push(i)}if(n)for(let i of n){let r=i.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class my{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class GR{constructor(e,n,i,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=ok(e.docView.tile,n,i,0))){let a=s||o?[]:ZR(e),u=new YR(a,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=eI(a,this.bounds.from)}else{let a=e.observer.selectionRange,u=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Nd(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Nd(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((q.ios||q.chrome)&&u!=c&&Math.min(u,c)<=l.main.from&&Math.max(u,c)>=l.main.to&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(u,c),d=Math.max(u,c),p=h.from-f,y=h.to-d;(p==0||p==1||f==0)&&(y==0||y==-1||d==e.state.doc.length)&&(u=0,c=e.state.doc.length)}if(e.inputState.composing>-1&&l.ranges.length>1)this.newSel=l.replaceRange(V.range(c,u));else if(e.lineWrapping&&c==u&&!(l.main.empty&&l.main.head==u)&&e.inputState.lastTouchTime>Date.now()-100){let f=e.coordsAtPos(u,-1),d=0;f&&(d=e.inputState.lastTouchY<=f.bottom?-1:1),this.newSel=V.create([V.cursor(u,d)])}else this.newSel=V.single(c,u)}}}function ok(t,e,n,i){if(t.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let a=0,u=i,c=i;a<t.children.length;a++){let h=t.children[a],f=u+h.length;if(u<e&&f>n)return ok(h,e,n,u);if(f>=e&&r==-1&&(r=a,s=u),u>n&&h.dom.parentNode==t.dom){o=a,l=c;break}c=f,u=f+h.breakAfter}return{from:s,to:l<0?i+t.length:l,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:i,to:i+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function lk(t,e){let n,{newSel:i}=e,{state:r}=t,s=r.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,u=s.from,c=null;(o===8||q.android&&e.text.length<a-l)&&(u=s.to,c="end");let h=r.doc.sliceString(l,a,Hr),f,d;!s.empty&&s.from>=l&&s.to<=a&&(e.typeOver||h!=e.text)&&h.slice(0,s.from-l)==e.text.slice(0,s.from-l)&&h.slice(s.to-l)==e.text.slice(f=e.text.length-(h.length-(s.to-l)))?n={from:s.from,to:s.to,insert:oe.of(e.text.slice(s.from-l,f).split(Hr))}:(d=ak(h,e.text,u-l,c))&&(q.chrome&&o==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==Hr+Hr&&d.toB--,n={from:l+d.from,to:l+d.toA,insert:oe.of(e.text.slice(d.from,d.toB).split(Hr))})}else i&&(!t.hasFocus&&r.facet(Kn)||Hu(i,s))&&(i=null);if(!n&&!i)return!1;if((q.mac||q.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(i&&n.insert.length==2&&(i=V.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:oe.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:r.toText(t.inputState.insertingText)}:q.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
|
|
64
|
+
`&&t.lineWrapping&&(i&&(i=V.single(i.main.anchor-1,i.main.head-1)),n={from:s.from,to:s.to,insert:oe.of([" "])}),n)return bm(t,n,i,o);if(i&&!Hu(i,s)){let l=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=sk(r.facet($l).map(u=>u(t)),i))),t.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function bm(t,e,n,i=-1){if(q.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(q.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&&xs(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&xs(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&xs(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=JR(t,e,n));return t.state.facet(YS).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function JR(t,e,n){let i,r=t.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,u=a<0?s.from:s.to,c=Vo(r.facet($l).map(h=>h(t)),u,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:V.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",u=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let a=r.changes(e),u=n&&n.main.to<=a.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),h,f=n&&rk(t,n.main.head);if(f){let p=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-p}}else h=t.state.doc.lineAt(s.head);let d=s.to-e.to;i=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:u||p.map(a)};let y=p.to-d,x=y-c.length;if(t.state.sliceDoc(x,y)!=c||y>=h.from&&x<=h.to)return{range:p};let m=r.changes({from:x,to:y,insert:e.insert}),g=p.to-s.to;return{changes:m,range:u?V.range(Math.max(0,u.anchor+g),Math.max(0,u.head+g)):p.map(m)}})}else i={changes:a,selection:u&&r.selection.replaceRange(u)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function ak(t,e,n,i){let r=Math.min(t.length,e.length),s=0;for(;s<r&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o<s&&t.length<e.length){let a=n<=s&&n>=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=n<=s&&n>=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function ZR(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new my(n,i)),(r!=n||s!=i)&&e.push(new my(r,s))),e}function eI(t,e){if(t.length==0)return null;let n=t[0].pos,i=t.length==2?t[1].pos:n;return n>-1&&i>-1?V.single(n+e,i+e):null}function Hu(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class tI{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&yI(e.contentDOM.ownerDocument)}handleEvent(e){!cI(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,n){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,n);for(let r of i.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=iI(e),i=this.handlers,r=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=i[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!n[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=n}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&&ck.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(uk.some(n=>n.keyCode==e.keyCode)&&!e.ctrlKey||rI.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&q.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&nI(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,xs(this.view.contentDOM,n.key,n.keyCode,n.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:q.safari&&!q.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 nI(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function gy(t,e){return(n,i)=>{try{return e.call(t,i,n)}catch(r){Tt(n.state,r)}}}function iI(t){let e=Object.create(null);function n(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of t){let r=i.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&n(l).handlers.push(gy(i.value,a))}if(o)for(let l in o){let a=o[l];a&&n(l).observers.push(gy(i.value,a))}}for(let i in mn)n(i).handlers.push(mn[i]);for(let i in ut)n(i).observers.push(ut[i]);return e}const uk=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],rI="dthko",ck=[16,17,18,20,91,92,224,225],ya=6;function va(t){return Math.max(0,t)*.7+8}function sI(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class oI{constructor(e,n,i,r){this.view=e,this.startEvent=n,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=PS(e.contentDOM),this.atoms=e.state.facet($l).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(ae.allowMultipleSelections)&&lI(e,n),this.dragging=uI(e,n)&&dk(n)==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&&sI(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=km(this.view);e.clientX-a.left<=r+ya?n=-va(r-e.clientX):e.clientX+a.right>=o-ya&&(n=va(e.clientX-o)),e.clientY-a.top<=s+ya?i=-va(s-e.clientY):e.clientY+a.bottom>=l-ya&&(i=va(e.clientY-l)),this.setScrollSpeed(n,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,i=sk(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function lI(t,e){let n=t.state.facet(WS);return n.length?n[0](e):q.mac?e.metaKey:e.ctrlKey}function aI(t,e){let n=t.state.facet(US);return n.length?n[0](e):q.mac?!e.altKey:!e.ctrlKey}function uI(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let i=Sl(t.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s<r.length;s++){let o=r[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function cI(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,i;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=Oe.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const mn=Object.create(null),ut=Object.create(null),hk=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function hI(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),fk(t,n.value)},50)}function Ic(t,e,n){for(let i of t.facet(e))n=i(n,t);return n}function fk(t,e){e=Ic(t.state,vm,e);let{state:n}=t,i,r=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(Id!=null&&n.selection.ranges.every(a=>a.empty)&&Id==s.toString()){let a=-1;i=n.changeByRange(u=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let h=n.toText((o?s.line(r++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:h},range:V.cursor(u.from+h.length)}})}else o?i=n.changeByRange(a=>{let u=s.line(r++);return{changes:{from:a.from,to:a.to,insert:u.text},range:V.cursor(a.from+u.length)}}):i=n.replaceSelection(s);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ut.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,q.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};ut.wheel=ut.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};mn.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);ut.touchstart=(t,e)=>{let n=t.inputState,i=e.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),i&&(n.lastTouchX=i.clientX,n.lastTouchY=i.clientY),n.setSelectionOrigin("select.pointer")};ut.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};ut.touchend=(t,e)=>{t.inputState.touchActive=!1};mn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of t.state.facet(KS))if(n=i(t,e),n)break;if(!n&&e.button==0&&(n=dI(t,e)),n){let i=!t.hasFocus;t.inputState.startMouseSelection(new oI(t,e,n,i)),i&&t.observer.ignore(()=>{DS(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function yy(t,e,n,i){if(i==1)return V.cursor(e,n);if(i==2)return jR(t.state,e,n);{let r=t.docView.lineAt(e,n),s=t.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return l<t.state.doc.length&&l==s.to&&l++,V.undirectionalRange(o,l)}}const fI=q.ie&&q.ie_version<=11;let vy=null,wy=0,xy=0;function dk(t){if(!fI)return t.detail;let e=vy,n=xy;return vy=t,xy=Date.now(),wy=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(wy+1)%3:1}function dI(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=dk(e),r=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),r=r.map(s.changes))},get(s,o,l){let a=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,c=yy(t,a.pos,a.assoc,i);if(n.pos!=a.pos&&!o){let h=yy(t,n.pos,n.assoc,i),f=Math.min(h.from,c.from),d=Math.max(h.to,c.to);c=f<c.from?V.range(f,d,c.assoc):V.range(d,f,c.assoc)}return o?r.replaceRange(r.main.extend(c.from,c.to,c.assoc)):l&&i==1&&r.ranges.length>1&&(u=pI(r,a.pos))?u:l?r.addRange(c):V.create([c])}}}function pI(t,e){for(let n=0;n<t.ranges.length;n++){let{from:i,to:r}=t.ranges[n];if(i<=e&&r>=e)return V.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}mn.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let r=t.docView.tile.nearest(e.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=n.to||o<=n.from)&&(n=V.undirectionalRange(s,o))}}let{inputState:i}=t;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Ic(t.state,wm,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};mn.dragend=t=>(t.inputState.draggedContent=null,!1);function Sy(t,e,n,i){if(n=Ic(t.state,vm,n),!n)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=i&&s&&aI(t,e)?{from:s.from,to:s.to}:null,l={from:r,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}mn.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&Sy(t,e,i.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Sy(t,e,i,!0),!0}return!1};mn.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=hk?null:e.clipboardData;return n?(fk(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(hI(t),!1)};function mI(t,e){let n=t.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),t.focus()},50)}function gI(t){let e=[],n=[],i=!1;for(let r of t.selection.ranges)r.empty||(e.push(t.sliceDoc(r.from,r.to)),n.push(r));if(!e.length){let r=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>r&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),r=o.number}i=!0}return{text:Ic(t,wm,e.join(t.lineBreak)),ranges:n,linewise:i}}let Id=null;mn.copy=mn.cut=(t,e)=>{if(!Fo(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=gI(t.state);if(!n&&!r)return!1;Id=r?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=hk?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(mI(t,n),!1)};const pk=$n.define();function mk(t,e){let n=[];for(let i of t.facet(QS)){let r=i(t,e);r&&n.push(r)}return n.length?t.update({effects:n,annotations:pk.of(!0)}):null}function gk(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=mk(t.state,e);n?t.dispatch(n):t.update([])}},10)}ut.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),gk(t)};ut.blur=t=>{t.observer.clearSelectionRange(),gk(t)};ut.compositionstart=ut.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};ut.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,q.chrome&&q.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};ut.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};mn.beforeinput=(t,e)=>{var n,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=t.posAtDOM(l.startContainer,l.startOffset),u=t.posAtDOM(l.endContainer,l.endOffset);return bm(t,{from:a,to:u,insert:t.state.toText(s)},null),!0}}let r;if(q.chrome&&q.android&&(r=uk.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return q.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),q.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>ut.compositionend(t,e),20),!1};const ky=new Set;function yI(t){ky.has(t)||(ky.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const by=["pre-wrap","normal","pre-line","break-spaces"];let Fs=!1;function Cy(){Fs=!1}class vI{constructor(e){this.lineWrapping=e,this.doc=oe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let i=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((n-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return by.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let i=0;i<e.length;i++){let r=e[i];r<0?i++:this.heightSamples[Math.floor(r*10)]||(n=!0,this.heightSamples[Math.floor(r*10)]=!0)}return n}refresh(e,n,i,r,s,o){let l=by.indexOf(e)>-1,a=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=i,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let u=0;u<o.length;u++){let c=o[u];c<0?u++:this.heightSamples[Math.floor(c*10)]=!0}}return a}}class wI{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class an{constructor(e,n,i,r,s){this.from=e,this.length=n,this.top=i,this.height=r,this._content=s}get type(){return typeof this._content=="number"?Kt.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 Er?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new an(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var de=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(de||(de={}));const Ja=.001;class at{constructor(e,n,i=2){this.length=e,this.height=n,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ja&&(Fs=!0),this.height=e)}replace(e,n,i){return at.of(i)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,i,r){let s=this,o=i.doc;for(let l=r.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:h}=r[l],f=s.lineAt(a,de.ByPosNoHeight,i.setDoc(n),0,0),d=f.to>=u?f:s.lineAt(u,de.ByPosNoHeight,i,0,0);for(h+=d.to-u,u=d.to;l>0&&f.from<=r[l-1].toA;)a=r[l-1].fromA,c=r[l-1].fromB,l--,a<f.from&&(f=s.lineAt(a,de.ByPosNoHeight,i,0,0));c+=f.from-a,a=f.from;let p=Cm.build(i.setDoc(o),e,c,h);s=Wu(s,s.replace(a,u,p))}return s.updateHeight(i,0)}static empty(){return new At(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,i=e.length,r=0,s=0;for(;;)if(n==i)if(r>s*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),i+=1+l.break,r-=l.size}else if(s>r*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(r<s){let l=e[n++];l&&(r+=l.size)}else{let l=e[--i];l&&(s+=l.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,i++),new SI(at.of(e.slice(0,n)),o,at.of(e.slice(i)))}}function Wu(t,e){return t==e?t:(t.constructor!=e.constructor&&(Fs=!0),e)}at.prototype.size=1;const xI=Me.replace({});class yk extends at{constructor(e,n,i){super(e,n),this.deco=i,this.spaceAbove=0}mainBlock(e,n){return new an(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,i,r){return this.spaceAbove&&e<i+this.spaceAbove?new an(r,0,i,this.spaceAbove,xI):this.mainBlock(i,r)}lineAt(e,n,i,r,s){let o=this.mainBlock(r,s);return this.spaceAbove?this.blockAt(0,i,r,s).join(o):o}forEachLine(e,n,i,r,s,o){e<=s+this.length&&n>=s&&o(this.lineAt(0,de.ByPos,i,r,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,i=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class At extends yk{constructor(e,n,i){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,n){return new an(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,i){let r=i[0];return i.length==1&&(r instanceof At||r instanceof Ke&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Ke?r=new At(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):at.of(i)}updateHeight(e,n=0,i=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ke extends at{constructor(e){super(e,0)}heightMetrics(e,n){let i=e.doc.lineAt(n).number,r=e.doc.lineAt(n+this.length).number,s=r-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:r,perLine:o,perChar:l}}blockAt(e,n,i,r){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),c=n.doc.lineAt(u),h=l+c.length*a,f=Math.max(i,e-h/2);return new an(c.from,c.length,f,h,0)}else{let u=Math.max(0,Math.min(o-s,Math.floor((e-i)/l))),{from:c,length:h}=n.doc.line(s+u);return new an(c,h,i+l*u,l,0)}}lineAt(e,n,i,r,s){if(n==de.ByHeight)return this.blockAt(e,i,r,s);if(n==de.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(e);return new an(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,s),u=i.doc.lineAt(e),c=l+u.length*a,h=u.number-o,f=r+l*h+a*(u.from-s-h);return new an(u.from,u.length,Math.max(r,Math.min(f,r+this.height-c)),c,0)}forEachLine(e,n,i,r,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:l,perLine:a,perChar:u}=this.heightMetrics(i,s);for(let c=e,h=r;c<=n;){let f=i.doc.lineAt(c);if(c==e){let p=f.number-l;h+=a*p+u*(e-s-p)}let d=a+u*f.length;o(new an(f.from,f.length,h,d,0)),h+=d,c=f.to+1}}replace(e,n,i){let r=this.length-n;if(r>0){let s=i[i.length-1];s instanceof Ke?i[i.length-1]=new Ke(s.length+r):i.push(null,new Ke(r-1))}if(e>0){let s=i[0];s instanceof Ke?i[0]=new Ke(e+s.length):i.unshift(new Ke(e-1),null)}return at.of(i)}decomposeLeft(e,n){n.push(new Ke(e-1),null)}decomposeRight(e,n){n.push(null,new Ke(this.length-e-1))}updateHeight(e,n=0,i=!1,r){let s=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],l=Math.max(n,r.from),a=-1;for(r.from>n&&o.push(new Ke(r.from-n-1).updateHeight(e,n));l<=s&&r.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let h=r.heights[r.index++],f=0;h<0&&(f=-h,h=r.heights[r.index++]),a==-1?a=h:Math.abs(h-a)>=Ja&&(a=-2);let d=new At(c,h,f);d.outdated=!1,o.push(d),l+=c+1}l<=s&&o.push(null,new Ke(s-l).updateHeight(e,l));let u=at.of(o);return(a<0||Math.abs(u.height-this.height)>=Ja||Math.abs(a-this.heightMetrics(e,n).perLine)>=Ja)&&(Fs=!0),Wu(this,u)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class SI extends at{constructor(e,n,i){super(e.length+n+i.length,e.height+i.height,n|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,n,i,r){let s=i+this.left.height;return e<s?this.left.blockAt(e,n,i,r):this.right.blockAt(e,n,s,r+this.left.length+this.break)}lineAt(e,n,i,r,s){let o=r+this.left.height,l=s+this.left.length+this.break,a=n==de.ByHeight?e<o:e<l,u=a?this.left.lineAt(e,n,i,r,s):this.right.lineAt(e,n,i,o,l);if(this.break||(a?u.to<l:u.from>l))return u;let c=n==de.ByPosNoHeight?de.ByPosNoHeight:de.ByPos;return a?u.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,r,s).join(u)}forEachLine(e,n,i,r,s,o){let l=r+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,n,i,r,s,o),n>=a&&this.right.forEachLine(e,n,i,l,a,o);else{let u=this.lineAt(a,de.ByPos,i,r,s);e<u.from&&this.left.forEachLine(e,u.from-1,i,r,s,o),u.to>=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,i,l,a,o)}}replace(e,n,i){let r=this.left.length+this.break;if(n<r)return this.balanced(this.left.replace(e,n,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,n-r,i));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of i)s.push(l);if(e>0&&Ey(s,o-1),n<this.length){let l=s.length;this.decomposeRight(n,s),Ey(s,l)}return at.of(s)}decomposeLeft(e,n){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(i++,e>=i&&n.push(null)),e>i&&this.right.decomposeLeft(e-i,n)}decomposeRight(e,n){let i=this.left.length,r=i+this.break;if(e>=r)return this.right.decomposeRight(e-r,n);e<i&&this.left.decomposeRight(e,n),this.break&&e<r&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?at.of(this.break?[e,null,n]:[e,n]):(this.left=Wu(this.left,e),this.right=Wu(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,i=!1,r){let{left:s,right:o}=this,l=n+s.length+this.break,a=null;return r&&r.from<=n+s.length&&r.more?a=s=s.updateHeight(e,n,i,r):s.updateHeight(e,n,i),r&&r.from<=l+o.length&&r.more?a=o=o.updateHeight(e,l,i,r):o.updateHeight(e,l,i),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ey(t,e){let n,i;t[e]==null&&(n=t[e-1])instanceof Ke&&(i=t[e+1])instanceof Ke&&t.splice(e-1,3,new Ke(n.length+1+i.length))}const kI=5;class Cm{constructor(e,n){this.pos=e,this.oracle=n,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,n){if(this.lineStart>-1){let i=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof At?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new At(i-this.pos,-1,0)),this.writtenTo=i,n>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,i){if(e<n||i.heightRelevant){let r=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=n-e;i.block?this.addBlock(new yk(o,r,i)):(o||s||r>=kI)&&this.addLineDeco(r,s,o)}else n>e&&this.span(e,n);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:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,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 At(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let i=new Ke(n-e);return this.oracle.doc.lineAt(e).to==n&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof At)return e;let n=new At(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=n,this.writtenTo=this.pos=this.pos+i}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof At)&&!this.isCovered?this.nodes.push(new At(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let r of this.nodes)r instanceof At&&r.updateHeight(this.oracle,i),i+=r?r.length:1;return this.nodes}static build(e,n,i,r){let s=new Cm(i,e);return ue.spans(n,i,r,s,0),s.finish(i)}}function bI(t,e,n){let i=new CI;return ue.compare(t,e,n,i,0),i.changes}class CI{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,i,r){(e<n||i&&i.heightRelevant||r&&r.heightRelevant)&&ws(e,n,this.changes,5)}}function EI(t,e){let n=t.getBoundingClientRect(),i=t.ownerDocument,r=i.defaultView||window,s=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let u=t.parentNode;u&&u!=i.body;)if(u.nodeType==1){let c=u,h=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&h.overflow!="visible"){let f=c.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),l=Math.max(l,f.top),a=Math.min(u==t.parentNode?r.innerHeight:a,f.bottom)}u=h.position=="absolute"||h.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function AI(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function NI(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Bh{constructor(e,n,i,r){this.from=e,this.to=n,this.size=i,this.displaySize=r}static same(e,n){if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++){let r=e[i],s=n[i];if(r.from!=s.from||r.to!=s.to||r.size!=s.size)return!1}return!0}draw(e,n){return Me.replace({widget:new _I(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class _I extends Ll{constructor(e,n){super(),this.size=e,this.vertical=n}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 Ay{constructor(e,n){this.view=e,this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ny,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Te.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=n.facet(xm).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new vI(i),this.stateDeco=_y(n),this.heightMap=at.empty().applyChanges(this.stateDeco,oe.empty,this.heightOracle.setDoc(n.doc),[new Vt(0,0,0,n.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Me.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let i=0;i<=1;i++){let r=i?n.head:n.anchor;if(!e.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);e.push(new wa(s,o))}}return this.viewports=e.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ny:new Em(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(_o(e,this.scaler))})}update(e,n=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=_y(this.state);let r=e.changedRanges,s=Vt.extendWithRanges(r,bI(i,this.stateDeco,e?e.changes:ze.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Cy(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Fs)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<a.from||n.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(u||!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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(vR)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,i=window.getComputedStyle(n),r=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Te.RTL:Te.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0;if(l.width&&l.height){let{scaleX:k,scaleY:C}=OS(n,l);(k>.005&&Math.abs(this.scaleX-k)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=k,this.scaleY=C,u|=16,o=a=!0)}let h=(parseInt(i.paddingTop)||0)*this.scaleY,f=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let d=PS(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=LS(this.scrollParent||e.win);let y=(this.printing?NI:EI)(n,this.paddingTop),x=y.top-this.pixelViewport.top,m=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget&&!AI(e.dom))return 0;let v=l.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),a){let k=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(k)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:C,charWidth:E,textHeight:_}=e.docView.measureTextSize();o=C>0&&r.refresh(s,C,E,_,Math.max(5,v/E),k),o&&(e.docView.minWidth=0,u|=16)}x>0&&m>0?c=Math.max(x,m):x<0&&m<0&&(c=Math.min(x,m)),Cy();for(let C of this.viewports){let E=C.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?at.empty().applyChanges(this.stateDeco,oe.empty,this.heightOracle,[new Vt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new wI(C.from,E))}Fs&&(u|=2)}let w=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),u|=this.updateForViewport()),(u&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new wa(r.lineAt(o-i*1e3,de.ByHeight,s,0,0).from,r.lineAt(l+(1-i)*1e3,de.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(u<a.from||u>a.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(u,de.ByPos,s,0,0),f;n.y=="center"?f=(h.top+h.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u<a.from?f=h.top:f=h.bottom-c,a=new wa(r.lineAt(f-1e3/2,de.ByHeight,s,0,0).from,r.lineAt(f+c+1e3/2,de.ByHeight,s,0,0).to)}}return a}mapViewport(e,n){let i=n.mapPos(e.from,-1),r=n.mapPos(e.to,1);return new wa(this.heightMap.lineAt(i,de.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,de.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},i=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,de.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,de.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||r<=o-Math.max(10,Math.min(-i,250)))&&(n==this.state.doc.length||s>=l+Math.max(10,Math.min(i,250)))&&r>o-2*1e3&&s<l+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let i=[];for(let r of e)n.touchesRange(r.from,r.to)||i.push(new Bh(n.mapPos(r.from),n.mapPos(r.to),r.size,r.displaySize));return i}ensureLineGaps(e,n){let i=this.heightOracle.lineWrapping,r=i?1e4:2e3,s=r>>1,o=r<<1;if(this.defaultTextDirection!=Te.LTR&&!i)return[];let l=[],a=(c,h,f,d)=>{if(h-c<s)return;let p=this.state.selection.main,y=[p.from];p.empty||y.push(p.to);for(let m of y)if(m>c&&m<h){a(c,m-10,f,d),a(m+10,h,f,d);return}let x=MI(e,m=>m.from>=f.from&&m.to<=f.to&&Math.abs(m.from-c)<s&&Math.abs(m.to-h)<s&&!y.some(g=>m.from<g&&m.to>g));if(!x){if(h<f.to&&n&&i&&n.visibleRanges.some(v=>v.from<=h&&v.to>=h)){let v=n.moveToLineBoundary(V.cursor(h),!1,!0).head;v>c&&(h=v)}let m=this.gapSize(f,c,h,d),g=i||m<2e6?m:2e6;x=new Bh(c,h,m,g)}l.push(x)},u=c=>{if(c.length<o||c.type!=Kt.Text)return;let h=TI(c.from,c.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(i){let y=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,m;if(f!=null){let g=Sa(h,f),v=((this.visibleBottom-this.visibleTop)/2+y)/c.height;x=g-v,m=g+v}else x=(this.visibleTop-c.top-y)/c.height,m=(this.visibleBottom-c.top+y)/c.height;d=xa(h,x),p=xa(h,m)}else{let y=h.total*this.heightOracle.charWidth,x=r*this.heightOracle.charWidth,m=0;if(y>2e6)for(let C of e)C.from>=c.from&&C.from<c.to&&C.size!=C.displaySize&&C.from*this.heightOracle.charWidth+m<this.pixelViewport.left&&(m=C.size-C.displaySize);let g=this.pixelViewport.left+m,v=this.pixelViewport.right+m,w,k;if(f!=null){let C=Sa(h,f),E=((v-g)/2+x)/y;w=C-E,k=C+E}else w=(g-x)/y,k=(v+x)/y;d=xa(h,w),p=xa(h,k)}d>c.from&&a(c.from,d,c,h),p<c.to&&a(p,c.to,c,h)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(u):u(c);return l}gapSize(e,n,i,r){let s=Sa(r,i)-Sa(r,n);return this.heightOracle.lineWrapping?e.height*s:r.total*this.heightOracle.charWidth*s}updateLineGaps(e){Bh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Me.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let i=[];ue.spans(n,this.viewport.from,this.viewport.to,{span(s,o){i.push({from:s,to:o})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let s=0;s<i.length&&!(r&8);s++){let o=this.visibleRanges[s],l=i[s];(o.from!=l.from||o.to!=l.to)&&(r|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(r|=8))}return this.visibleRanges=i,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||_o(this.heightMap.lineAt(e,de.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(n=>n.top<=e&&n.bottom>=e)||_o(this.heightMap.lineAt(this.scaler.fromDOM(e),de.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return _o(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 wa{constructor(e,n){this.from=e,this.to=n}}function TI(t,e,n){let i=[],r=t,s=0;return ue.spans(n,t,e,{span(){},point(o,l){o>r&&(i.push({from:r,to:o}),s+=o-r),r=l}},20),r<e&&(i.push({from:r,to:e}),s+=e-r),{total:s,ranges:i}}function xa({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let i=Math.floor(t*n);for(let r=0;;r++){let{from:s,to:o}=e[r],l=o-s;if(i<=l)return s+i;i-=l}}function Sa(t,e){let n=0;for(let{from:i,to:r}of t.ranges){if(e<=r){n+=e-i;break}n+=r-i}return n/t.total}function MI(t,e){for(let n of t)if(e(n))return n}const Ny={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function _y(t){let e=t.facet(Oc).filter(i=>typeof i!="function"),n=t.facet(Sm).filter(i=>typeof i!="function");return n.length&&e.push(ue.join(n)),e}class Em{constructor(e,n,i){let r=0,s=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let u=n.lineAt(l,de.ByPos,e,0,0).top,c=n.lineAt(a,de.ByPos,e,0,0).bottom;return r+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let n=0,i=0,r=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.top)return r+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,r=s.domBottom}}fromDOM(e){for(let n=0,i=0,r=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.domTop)return i+(e-r)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,r=s.domBottom}}eq(e){return e instanceof Em?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,i)=>n.from==e.viewports[i].from&&n.to==e.viewports[i].to):!1}}function _o(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new an(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map(r=>_o(r,e)):t._content)}const ka=Z.define({combine:t=>t.join(" ")}),Dd=Z.define({combine:t=>t.indexOf(!0)>-1}),Ld=zi.newName(),vk=zi.newName(),wk=zi.newName(),xk={"&light":"."+vk,"&dark":"."+wk};function Bd(t,e,n){return new zi(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return t;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):t+" "+i}})}const OI=Bd("."+Ld,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"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"}},xk),PI={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zh=q.ie&&q.ie_version<=11;class RI{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new oR,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(n=>{for(let i of n)this.queue.push(i);(q.ie&&q.ie_version<=11||q.ios&&e.composing)&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new DI(e),e.state.facet(Kn)&&(e.contentDOM.editContext=this.editContext.editContext)),zh&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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 n;((n=this.view.docView)===null||n===void 0?void 0:n.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(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.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(n=>{n.length>0&&n[n.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((n,i)=>n!=e[i]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Kn)?i.root.activeElement!=this.dom:!Fo(this.dom,r))return;let s=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!i.state.selection.main.empty&&r.focusNode&&jo(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Sl(e.root);if(!n)return!1;let i=q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&II(this.view,n)||n;if(!i||this.selectionRange.eq(i))return!1;let r=Fo(this.dom,i);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&aR(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let i=this.dom;i;)if(i.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=n)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,PI),zh&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),zh&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var i;if(!this.delayedAndroidKey){let r=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&xs(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,i=-1,r=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:i}=o:(n=Math.min(o.from,n),i=Math.max(o.to,i)))}return{from:n,to:i,typeOver:r}}readChange(){let{from:e,to:n,typeOver:i}=this.processRecords(),r=this.selectionChanged&&Fo(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 s=new GR(this.view,e,n,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let i=this.view.state,r=lk(this.view,n);return this.view.state==i&&(n.domChanged||n.newSel&&!Hu(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let i=Ty(n,e.previousSibling||e.target.previousSibling,-1),r=Ty(n,e.nextSibling||e.target.nextSibling,1);return{from:i?n.posAfter(i):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.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(Kn)!=e.state.facet(Kn)&&(e.view.contentDOM.editContext=e.state.facet(Kn)?this.editContext.editContext:null))}destroy(){var e,n,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.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 Ty(t,e,n){for(;e;){let i=Oe.get(e);if(i&&i.parent==t)return i;let r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function My(t,e){let n=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return jo(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}function II(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return My(t,r)}let n=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),n?My(t,n):null}class DI{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let r=e.state.selection.main,{anchor:s,head:o}=r,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let u=a-l>i.text.length;l==this.from&&s<this.from?l=s:a==this.to&&s>this.to&&(a=s);let c=ak(e.state.sliceDoc(l,a),i.text,(u?r.from:r.to)-l,u?"end":null);if(!c){let f=V.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Hu(f,r)||e.dispatch({selection:f,userEvent:"select"});return}let h={from:c.from+l,to:c.toA+l,insert:oe.of(i.text.slice(c.from,c.toB).split(`
|
|
65
|
+
`))};if((q.mac||q.android)&&h.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:l,to:a,insert:oe.of([i.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);bm(e,h,V.single(this.toEditorPos(i.selectionStart,f),this.toEditorPos(i.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(n.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}n.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(a<u){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(Me.mark({attributes:{style:c}}).range(a,u))}}}e.dispatch({effects:JS.of(Me.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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)n.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=Sl(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,u)=>{if(i)return;let c=u.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(u)){r=this.pendingContextChange=null,n+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+u.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=c}n+=c}),r&&!i&&this.revertPending(e.state),!i}update(e){let n=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+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 n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ee{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 n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(s=>i(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||lR(e.parent)||document,this.viewState=new Ay(this,e.state||ae.create(e)),e.scrollTo&&e.scrollTo.is(ga)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(is).map(r=>new Ph(r));for(let r of this.plugins)r.update(this);this.observer=new RI(this),this.inputState=new tI(this),this.inputState.ensureHandlers(this.plugins),this.docView=new dy(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Fe?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,i=!1,r,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(f=>f.annotation(pk))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=mk(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(ae.phrases)!=this.state.facet(ae.phrases))return this.setState(s);r=Fu.create(this,s,e),r.flags|=l;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection,{x:p,y}=this.state.facet(ee.cursorScrollMargin);h=new Ss(d.empty?d:V.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",y,p)}for(let d of f.effects)d.is(ga)&&(h=d.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=Uu.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(No)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(ka)!=r.state.facet(ka)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(Od))try{f(r)}catch(d){Tt(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!lk(this,c)&&u.force&&xs(this.contentDOM,u.key,u.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 n=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Ay(this,e),this.plugins=e.facet(is).map(i=>new Ph(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new dy(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(is),i=e.state.facet(is);if(n!=i){let r=[];for(let s of i){let o=n.indexOf(s);if(o<0)r.push(new Ph(s));else{let l=this.plugins[o];l.mustUpdate=e,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.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);n!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(i){Tt(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,i=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(LS(i||this.win))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(r);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];a&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(d=>{try{return d.read(this)}catch(p){return Tt(this.state,p),Oy}}),h=Fu.create(this,this.state,[]),f=!1;h.flags|=a,n?n.flags|=a:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let d=0;d<u.length;d++)if(c[d]!=Oy)try{let p=u[d];p.write&&p.write(c[d],this)}catch(p){Tt(this.state,p)}if(f&&this.docView.updateSelection(!0),!h.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 p=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o)/this.scaleY;if((p>1||p<-1)&&!(q.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+p,i?s<0?i.scrollTop=i.scrollHeight:i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(Od))l(n)}get themeClasses(){return Ld+" "+(this.state.facet(Dd)?wk:vk)+" "+this.state.facet(ka)}updateAttrs(){let e=Py(this,ZS,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Kn)?"true":"false",class:"cm-content",style:`${q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Py(this,xm,n);let i=this.observer.ignore(()=>{let r=ly(this.contentDOM,this.contentAttrs,n),s=ly(this.dom,this.editorAttrs,e);return r||s});return this.editorAttrs=e,this.contentAttrs=n,i}showAnnouncements(e){let n=!0;for(let i of e)for(let r of i.effects)if(r.is(ee.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(No);let e=this.state.facet(ee.cspNonce);zi.mount(this.root,this.styleModules.concat(OI).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 n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(i=>i.plugin==e)||null),n&&n.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,n,i){return Lh(this,e,py(this,e,n,i))}moveByGroup(e,n){return Lh(this,e,py(this,e,n,i=>UR(this,e.head,i)))}visualLineSide(e,n){let i=this.bidiSpans(e),r=this.textDirectionAt(e.from),s=i[n?i.length-1:0];return V.cursor(s.side(n,r)+e.from,s.forward(!n,r)?1:-1)}moveToLineBoundary(e,n,i=!0){return WR(this,e,n,i)}moveVertically(e,n,i){return Lh(this,e,KR(this,e,n,i))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let i=Rd(this,e,n);return i&&i.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),Rd(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let i=this.state.doc.lineAt(e),r=this.bidiSpans(i),s=r[On.find(r,e-i.from,-1,n)];return this.docView.coordsAt(e,n,s.dir==Te.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(XS)||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>LI)return VS(e.length);let n=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||jS(s.isolates,i=cy(this,e))))return s.order;i||(i=cy(this,e));let r=mR(e.text,n,i);return this.bidiCache.push(new Uu(e.from,e.to,n,i,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{DS(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,n={}){var i,r,s,o;return ga.of(new Ss(typeof e=="number"?V.cursor(e):e,(i=n.y)!==null&&i!==void 0?i:"nearest",(r=n.x)!==null&&r!==void 0?r:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return ga.of(new Ss(V.cursor(i.from),"start","start",i.top-e,n,!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 Bn.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Bn.define(()=>({}),{eventObservers:e})}static theme(e,n){let i=zi.newName(),r=[ka.of(i),No.of(Bd(`.${i}`,e))];return n&&n.dark&&r.push(Dd.of(!0)),r}static baseTheme(e){return Dl.lowest(No.of(Bd("."+Ld,e,xk)))}static findFromDOM(e){var n;let i=e.querySelector(".cm-content"),r=i&&Oe.get(i)||Oe.get(e);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}ee.styleModule=No;ee.inputHandler=YS;ee.clipboardInputFilter=vm;ee.clipboardOutputFilter=wm;ee.scrollHandler=GS;ee.focusChangeEffect=QS;ee.perLineTextDirection=XS;ee.exceptionSink=qS;ee.updateListener=Od;ee.editable=Kn;ee.mouseSelectionStyle=KS;ee.dragMovesSelection=US;ee.clickAddsSelectionRange=WS;ee.decorations=Oc;ee.blockWrappers=ek;ee.outerDecorations=Sm;ee.atomicRanges=$l;ee.bidiIsolatedRanges=tk;ee.cursorScrollMargin=Z.define({combine:t=>{let e=5,n=5;for(let i of t)typeof i=="number"?e=n=i:{x:e,y:n}=i;return{x:e,y:n}}});ee.scrollMargins=nk;ee.darkTheme=Dd;ee.cspNonce=Z.define({combine:t=>t.length?t[0]:""});ee.contentAttributes=xm;ee.editorAttributes=ZS;ee.lineWrapping=ee.contentAttributes.of({class:"cm-lineWrapping"});ee.announce=me.define();const LI=4096,Oy={};class Uu{constructor(e,n,i,r,s,o){this.from=e,this.to=n,this.dir=i,this.isolates=r,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let i=[],r=e.length?e[e.length-1].dir:Te.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==r&&!n.touchesRange(o.from,o.to)&&i.push(new Uu(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function Py(t,e,n){for(let i=t.state.facet(e),r=i.length-1;r>=0;r--){let s=i[r],o=typeof s=="function"?s(t):s;o&&mm(o,n)}return n}const BI=q.mac?"mac":q.windows?"win":q.linux?"linux":"key";function zI(t,e){const n=t.split(/-(?!$)/);let i=n[n.length-1];i=="Space"&&(i=" ");let r,s,o,l;for(let a=0;a<n.length-1;++a){const u=n[a];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))s=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(i="Alt-"+i),s&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function ba(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const $I=Dl.default(ee.domEventHandlers({keydown(t,e){return HI(FI(e.state),t,e,"editor")}})),Am=Z.define({enables:$I}),Ry=new WeakMap;function FI(t){let e=t.facet(Am),n=Ry.get(e);return n||Ry.set(e,n=VI(e.reduce((i,r)=>i.concat(r),[]))),n}let xi=null;const jI=4e3;function VI(t,e=BI){let n=Object.create(null),i=Object.create(null),r=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,c)=>{var h,f;let d=n[o]||(n[o]=Object.create(null)),p=l.split(/ (?!$)/).map(m=>zI(m,e));for(let m=1;m<p.length;m++){let g=p.slice(0,m).join(" ");r(g,!0),d[g]||(d[g]={preventDefault:!0,stopPropagation:!1,run:[v=>{let w=xi={view:v,prefix:g,scope:o};return setTimeout(()=>{xi==w&&(xi=null)},jI),!0}]})}let y=p.join(" ");r(y,!1);let x=d[y]||(d[y]={preventDefault:!1,stopPropagation:!1,run:((f=(h=d._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});a&&x.run.push(a),u&&(x.preventDefault=!0),c&&(x.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in c)c[f].run.push(d=>h(d,zd))}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}let zd=null;function HI(t,e,n,i){zd=e;let r=eR(e),s=ir(r,0),o=Vr(s)==r.length&&r!=" ",l="",a=!1,u=!1,c=!1;xi&&xi.view==n&&xi.scope==i&&(l=xi.prefix+" ",ck.indexOf(e.keyCode)<0&&(u=!0,xi=null));let h=new Set,f=x=>{if(x){for(let m of x.run)if(!h.has(m)&&(h.add(m),m(n)))return x.stopPropagation&&(c=!0),!0;x.preventDefault&&(x.stopPropagation&&(c=!0),u=!0)}return!1},d=t[i],p,y;return d&&(f(d[l+ba(r,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(q.windows&&e.ctrlKey&&e.altKey)&&!(q.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=$i[e.keyCode])&&p!=r?(f(d[l+ba(p,e,!0)])||e.shiftKey&&(y=wl[e.keyCode])!=r&&y!=p&&f(d[l+ba(y,e,!1)]))&&(a=!0):o&&e.shiftKey&&f(d[l+ba(r,e,!0)])&&(a=!0),!a&&f(d._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),zd=null,a}const Ca="-10000px";class WI{constructor(e,n,i,r){this.facet=n,this.createTooltipView=i,this.removeTooltipView=r,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=i(o,s))}update(e,n){var i;let r=e.state.facet(this.facet),s=r.filter(a=>a);if(r===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;a<s.length;a++){let u=s[a],c=-1;if(u){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==u.create&&(c=h)}if(c<0)o[a]=this.createTooltipView(u,a?o[a-1]:null),l&&(l[a]=!!u.above);else{let h=o[a]=this.tooltipViews[c];l&&(l[a]=n[c]),h.update&&h.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(i=a.destroy)===null||i===void 0||i.call(a));return n&&(l.forEach((a,u)=>n[u]=a),n.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=o,!0}}function UI(t={}){return Za.of(t)}function KI(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Za=Z.define({combine:t=>{var e,n,i;return{position:q.ios?"absolute":((e=t.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((i=t.find(r=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||KI}}}),Iy=new WeakMap,Sk=Bn.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(Za);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 WI(t,kk,(n,i)=>this.createTooltip(n,i),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.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 n=e||t.geometryChanged,i=t.state.facet(Za);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),i=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=Ca,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(t=i.destroy)===null||t===void 0||t.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(q.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=km(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Za).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=t,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:c}=u,h=t.pos[l],f=t.size[l];if(!h||a.clip!==!1&&(h.bottom<=Math.max(n.top,i.top)||h.top>=Math.min(n.bottom,i.bottom)||h.right<Math.max(n.left,i.left)-.1||h.left>Math.min(n.right,i.right)+.1)){c.style.top=Ca;continue}let d=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,y=f.right-f.left,x=(e=Iy.get(u))!==null&&e!==void 0?e:f.bottom-f.top,m=u.offset||YI,g=this.view.textDirection==Te.LTR,v=f.width>i.right-i.left?g?i.left:i.right-f.width:g?Math.max(i.left,Math.min(h.left-(d?14:0)+m.x,i.right-y)):Math.min(Math.max(i.left,h.left-y+(d?14:0)-m.x),i.right-y),w=this.above[l];!a.strictSide&&(w?h.top-x-p-m.y<i.top:h.bottom+x+p+m.y>i.bottom)&&w==i.bottom-h.bottom>h.top-i.top&&(w=this.above[l]=!w);let k=(w?h.top-i.top:i.bottom-h.bottom)-p;if(k<x&&u.resize!==!1){if(k<this.view.defaultLineHeight){c.style.top=Ca;continue}Iy.set(u,x),c.style.height=(x=k)/s+"px"}else c.style.height&&(c.style.height="");let C=w?h.top-x-p-m.y:h.bottom+p+m.y,E=v+y;if(u.overlap!==!0)for(let _ of o)_.left<E&&_.right>v&&_.top<C+x&&_.bottom>C&&(C=w?_.top-x-2-p:_.bottom+p+2);if(this.position=="absolute"?(c.style.top=(C-t.parent.top)/s+"px",Dy(c,(v-t.parent.left)/r)):(c.style.top=C/s+"px",Dy(c,v/r)),d){let _=h.left+(g?m.x:-m.x)-(v+14-7);d.style.left=_/r+"px"}u.overlap!==!0&&o.push({left:v,top:C,right:E,bottom:C+x}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),u.positioned&&u.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=Ca}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Dy(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const qI=ee.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:`${7*2}px`,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"}}}),YI={x:0,y:0},kk=Z.define({enables:[Sk,qI]});function bk(t,e){let n=t.plugin(Sk);if(!n)return null;let i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}class js extends Bi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}js.prototype.elementClass="";js.prototype.toDOM=void 0;js.prototype.mapMode=Nt.TrackBefore;js.prototype.startSide=js.prototype.endSide=-1;js.prototype.point=!0;const Ck=1024;let QI=0;class $h{constructor(e,n){this.from=e,this.to=n}}class re{constructor(e={}){this.id=QI++,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=kt.match(e)),n=>{let i=e(n);return i===void 0?null:[this,i]}}}re.closedBy=new re({deserialize:t=>t.split(" ")});re.openedBy=new re({deserialize:t=>t.split(" ")});re.group=new re({deserialize:t=>t.split(" ")});re.isolate=new re({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});re.contextHash=new re({perNode:!0});re.lookAhead=new re({perNode:!0});re.mounted=new re({perNode:!0});class Ho{constructor(e,n,i,r=!1){this.tree=e,this.overlay=n,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[re.mounted.id]}}const XI=Object.create(null);class kt{constructor(e,n,i,r=0){this.name=e,this.props=n,this.id=i,this.flags=r}static define(e){let n=e.props&&e.props.length?Object.create(null):XI,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new kt(e.name||"",n,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[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 n=this.prop(re.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let i in e)for(let r of i.split(" "))n[r]=e[i];return i=>{for(let r=i.prop(re.group),s=-1;s<(r?r.length:0);s++){let o=n[s<0?i.name:r[s]];if(o)return o}}}}kt.none=new kt("",Object.create(null),0,8);class Nm{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let i of this.types){let r=null;for(let s of e){let o=s(i);if(o){r||(r=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in r&&(l=a.combine(r[a.id],l)),r[a.id]=l}}n.push(r?new kt(i.name,r,i.id,i.flags):i)}return new Nm(n)}}const Ea=new WeakMap,Ly=new WeakMap;var Ne;(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"})(Ne||(Ne={}));class Ie{constructor(e,n,i,r,s){if(this.type=e,this.children=n,this.positions=i,this.length=r,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Ho.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let i of this.children){let r=i.toString();r&&(n&&(n+=","),n+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Fd(this.topNode,e)}cursorAt(e,n=0,i=0){let r=Ea.get(this)||this.topNode,s=new Fd(r);return s.moveTo(e,n),Ea.set(this,s._tree),s}get topNode(){return new qt(this,0,0,null)}resolve(e,n=0){let i=bl(Ea.get(this)||this.topNode,e,n,!1);return Ea.set(this,i),i}resolveInner(e,n=0){let i=bl(Ly.get(this)||this.topNode,e,n,!0);return Ly.set(this,i),i}resolveStack(e,n=0){return ZI(this,e,n)}iterate(e){let{enter:n,leave:i,from:r=0,to:s=this.length}=e,o=e.mode||0,l=(o&Ne.IncludeAnonymous)>0;for(let a=this.cursor(o|Ne.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||n(a)!==!1)){if(a.firstChild())continue;u=!0}for(;u&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;u=!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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Mm(kt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,i,r)=>new Ie(this.type,n,i,r,this.propValues),e.makeTree||((n,i,r)=>new Ie(kt.none,n,i,r)))}static build(e){return eD(e)}}Ie.empty=new Ie(kt.none,[],[],0);class _m{constructor(e,n){this.buffer=e,this.index=n}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 _m(this.buffer,this.index)}}class ji{constructor(e,n,i){this.buffer=e,this.length=n,this.set=i}get type(){return kt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],i=this.buffer[e+3],r=this.set.types[n],s=r.name;if(/\W/.test(s)&&!r.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,i,r,s){let{buffer:o}=this,l=-1;for(let a=e;a!=n&&!(Ek(s,r,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,n,i){let r=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l<n;){s[a++]=r[l++],s[a++]=r[l++]-i;let u=s[a++]=r[l++]-i;s[a++]=r[l++]-e,o=Math.max(o,u)}return new ji(s,o,this.set)}}function Ek(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function bl(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!i&&t instanceof qt&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=i?0:Ne.IgnoreOverlays;if(i)for(let o=t,l=o.parent;l;o=l,l=o.parent)o instanceof qt&&o.index<0&&((r=l.enter(e,n,s))===null||r===void 0?void 0:r.from)!=o.from&&(t=l);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class Ak{cursor(e=0){return new Fd(this,e)}getChild(e,n=null,i=null){let r=By(this,e,n,i);return r.length?r[0]:null}getChildren(e,n=null,i=null){return By(this,e,n,i)}resolve(e,n=0){return bl(this,e,n,!1)}resolveInner(e,n=0){return bl(this,e,n,!0)}matchContext(e){return $d(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),i=this;for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(i=n,n=r.prevSibling):n=r}return i}get node(){return this}get next(){return this.parent}}class qt extends Ak{constructor(e,n,i,r){super(),this._tree=e,this.from=n,this.index=i,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,n,i,r,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,u=n>0?l.length:-1;e!=u;e+=n){let c=l[e],h=a[e]+o.from,f;if(!(!(s&Ne.EnterBracketed&&c instanceof Ie&&(f=Ho.get(c))&&!f.overlay&&f.bracketed&&i>=h&&i<=h+c.length)&&!Ek(r,i,h,h+c.length))){if(c instanceof ji){if(s&Ne.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,n,i-h,r);if(d>-1)return new Ci(new GI(o,c,e,h),null,d)}else if(s&Ne.IncludeAnonymous||!c.type.isAnonymous||Tm(c)){let d;if(!(s&Ne.IgnoreMounts)&&(d=Ho.get(c))&&!d.overlay)return new qt(d.tree,h,e,o);let p=new qt(c,h,e,o);return s&Ne.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?c.children.length-1:0,n,i,r,s)}}}if(s&Ne.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<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,n,i=0){let r;if(!(i&Ne.IgnoreOverlays)&&(r=Ho.get(this._tree))&&r.overlay){let s=e-this.from,o=i&Ne.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((n>0||o?l<=s:l<s)&&(n<0||o?a>=s:a>s))return new qt(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function By(t,e,n,i){let r=t.cursor(),s=[];if(!r.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function $d(t,e,n=e.length-1){for(let i=t;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}class GI{constructor(e,n,i,r){this.parent=e,this.buffer=n,this.index=i,this.start=r}}class Ci extends Ak{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,n,i){super(),this.context=e,this._parent=n,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,n,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,i);return s<0?null:new Ci(this.context,this,s)}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,n,i=0){if(i&Ne.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new Ci(this.context,this,s)}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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ci(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Ci(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];e.push(i.slice(r,s,o)),n.push(0)}return new Ie(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Nk(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let i=n instanceof qt&&n.index<0?null:n.parent,r=t.slice();return i?r[e]=i:r.splice(e,1),new JI(r,n)}class JI{constructor(e,n){this.heads=e,this.node=n}get next(){return Nk(this.heads)}}function ZI(t,e,n){let i=t.resolveInner(e,n),r=null;for(let s=i instanceof qt?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(r||(r=[i])).push(o.resolve(e,n)),s=o}else{let o=Ho.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new qt(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(bl(l,e,n,!1))}}return r?Nk(r):i}class Fd{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Ne.EnterBracketed,e instanceof qt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof qt?(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,n,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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,n,i=this.mode){return this.buffer?i&Ne.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ne.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ne.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:n}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(i<0?n.buffer.length:n.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,i,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:i}=r)}else({index:n,_parent:i}=this._tree);for(;i;{index:n,_parent:i}=i)if(n>-1)for(let s=n+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&Ne.IncludeAnonymous||l instanceof ji||!l.type.isAnonymous||Tm(l))return!1}return!0}move(e,n){if(n&&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,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,i=0;if(e&&e.context==this.buffer)e:for(let r=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r<this.stack.length;r++)n=new Ci(this.buffer,n,this.stack[r]);return this.bufferNode=new Ci(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let i=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&n&&n(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(e){if(!this.buffer)return $d(this.node.parent,e);let{buffer:n}=this.buffer,{types:i}=n.set;for(let r=e.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return $d(this._tree,e,r);let o=i[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Tm(t){return t.children.some(e=>e instanceof ji||!e.type.isAnonymous||Tm(e))}function eD(t){var e;let{buffer:n,nodeSet:i,maxBufferLength:r=Ck,reused:s=[],minRepeatType:o=i.types.length}=t,l=Array.isArray(n)?new _m(n,n.length):n,a=i.types,u=0,c=0;function h(k,C,E,_,D,L){let{id:B,start:P,end:A,size:S}=l,I=c,O=u;if(S<0)if(l.next(),S==-1){let z=s[B];E.push(z),_.push(P-k);return}else if(S==-3){u=B;return}else if(S==-4){c=B;return}else throw new RangeError(`Unrecognized record size: ${S}`);let j=a[B],R,N,T=P-k;if(A-P<=r&&(N=x(l.pos-C,D))){let z=new Uint16Array(N.size-N.skip),$=l.pos-N.size,W=z.length;for(;l.pos>$;)W=m(N.start,z,W);R=new ji(z,A-N.start,i),T=N.start-k}else{let z=l.pos-S;l.next();let $=[],W=[],U=B>=o?B:-1,Q=0,te=A;for(;l.pos>z;)U>=0&&l.id==U&&l.size>=0?(l.end<=te-r&&(p($,W,P,Q,l.end,te,U,I,O),Q=$.length,te=l.end),l.next()):L>2500?f(P,z,$,W):h(P,z,$,W,U,L+1);if(U>=0&&Q>0&&Q<$.length&&p($,W,P,Q,P,te,U,I,O),$.reverse(),W.reverse(),U>-1&&Q>0){let ne=d(j,O);R=Mm(j,$,W,0,$.length,0,A-P,ne,ne)}else R=y(j,$,W,A-P,I-A,O)}E.push(R),_.push(T)}function f(k,C,E,_){let D=[],L=0,B=-1;for(;l.pos>C;){let{id:P,start:A,end:S,size:I}=l;if(I>4)l.next();else{if(B>-1&&A<B)break;B<0&&(B=S-r),D.push(P,A,S),L++,l.next()}}if(L){let P=new Uint16Array(L*4),A=D[D.length-2];for(let S=D.length-3,I=0;S>=0;S-=3)P[I++]=D[S],P[I++]=D[S+1]-A,P[I++]=D[S+2]-A,P[I++]=I;E.push(new ji(P,D[2]-A,i)),_.push(A-k)}}function d(k,C){return(E,_,D)=>{let L=0,B=E.length-1,P,A;if(B>=0&&(P=E[B])instanceof Ie){if(!B&&P.type==k&&P.length==D)return P;(A=P.prop(re.lookAhead))&&(L=_[B]+P.length+A)}return y(k,E,_,D,L,C)}}function p(k,C,E,_,D,L,B,P,A){let S=[],I=[];for(;k.length>_;)S.push(k.pop()),I.push(C.pop()+E-D);k.push(y(i.types[B],S,I,L-D,P-L,A)),C.push(D-E)}function y(k,C,E,_,D,L,B){if(L){let P=[re.contextHash,L];B=B?[P].concat(B):[P]}if(D>25){let P=[re.lookAhead,D];B=B?[P].concat(B):[P]}return new Ie(k,C,E,_,B)}function x(k,C){let E=l.fork(),_=0,D=0,L=0,B=E.end-r,P={size:0,start:0,skip:0};e:for(let A=E.pos-k;E.pos>A;){let S=E.size;if(E.id==C&&S>=0){P.size=_,P.start=D,P.skip=L,L+=4,_+=4,E.next();continue}let I=E.pos-S;if(S<0||I<A||E.start<B)break;let O=E.id>=o?4:0,j=E.start;for(E.next();E.pos>I;){if(E.size<0)if(E.size==-3||E.size==-4)O+=4;else break e;else E.id>=o&&(O+=4);E.next()}D=j,_+=S,L+=O}return(C<0||_==k)&&(P.size=_,P.start=D,P.skip=L),P.size>4?P:void 0}function m(k,C,E){let{id:_,start:D,end:L,size:B}=l;if(l.next(),B>=0&&_<o){let P=E;if(B>4){let A=l.pos-(B-4);for(;l.pos>A;)E=m(k,C,E)}C[--E]=P,C[--E]=L-k,C[--E]=D-k,C[--E]=_}else B==-3?u=_:B==-4&&(c=_);return E}let g=[],v=[];for(;l.pos>0;)h(t.start||0,t.bufferStart||0,g,v,-1,0);let w=(e=t.length)!==null&&e!==void 0?e:g.length?v[0]+g[0].length:0;return new Ie(a[t.topID],g.reverse(),v.reverse(),w)}const zy=new WeakMap;function eu(t,e){if(!t.isAnonymous||e instanceof ji||e.type!=t)return 1;let n=zy.get(e);if(n==null){n=1;for(let i of e.children){if(i.type!=t||!(i instanceof Ie)){n=1;break}n+=eu(t,i)}zy.set(e,n)}return n}function Mm(t,e,n,i,r,s,o,l,a){let u=0;for(let p=i;p<r;p++)u+=eu(t,e[p]);let c=Math.ceil(u*1.5/8),h=[],f=[];function d(p,y,x,m,g){for(let v=x;v<m;){let w=v,k=y[v],C=eu(t,p[v]);for(v++;v<m;v++){let E=eu(t,p[v]);if(C+E>=c)break;C+=E}if(v==w+1){if(C>c){let E=p[w];d(E.children,E.positions,0,E.children.length,y[w]+g);continue}h.push(p[w])}else{let E=y[v-1]+p[v-1].length-k;h.push(Mm(t,p,y,w,v,k,E,null,a))}f.push(k+g-s)}}return d(e,n,i,r,0),(l||a)(h,f,o)}class mr{constructor(e,n,i,r,s=!1,o=!1){this.from=e,this.to=n,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],i=!1){let r=[new mr(0,e.length,e,0,!1,i)];for(let s of n)s.to>e.length&&r.push(s);return r}static applyChanges(e,n,i=128){if(!n.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let c=l<n.length?n[l]:null,h=c?c.fromA:1e9;if(h-a>=i)for(;o&&o.from<h;){let f=o;if(a>=f.from||h<=f.to||u){let d=Math.max(f.from,a)-u,p=Math.min(f.to,h)-u;f=d>=p?null:new mr(d,p,f.tree,f.offset+u,l>0,!!c)}if(f&&r.push(f),o.to>h)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,u=c.toA-c.toB}return r}}class _k{startParse(e,n,i){return typeof e=="string"&&(e=new tD(e)),i=i?i.length?i.map(r=>new $h(r.from,r.to)):[new $h(0,0)]:[new $h(0,e.length)],this.createParse(e,n||[],i)}parse(e,n,i){let r=this.startParse(e,n,i);for(;;){let s=r.advance();if(s)return s}}}class tD{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new re({perNode:!0});var $y={};class Ku{constructor(e,n,i,r,s,o,l,a,u,c=0,h){this.p=e,this.stack=n,this.state=i,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,i=0){let r=e.parser.context;return new Ku(e,[],n,i,i,0,[],0,r?new Fy(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let i=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=s.dynamicPrecedence(r);if(l&&(this.score+=l),i==0){r<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,r,!0),this.reducePos),r<s.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let a=this.stack.length-(i-1)*3-(e&262144?6:0),u=a?this.stack[a-2]:this.p.ranges[0].from;r<s.minRepeatTerm&&u==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-u;c>=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=u,this.p.lastBigReductionSize=c));let h=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-h;if(r<s.minRepeatTerm||e&131072){let d=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,u,d,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=s.getGoto(d,r,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(r,u)}storeNode(e,n,i,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==i)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,n,i,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)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]=n,this.buffer[o+2]=i,this.buffer[o+3]=r}}shift(e,n,i,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(n,i),n<=this.p.parser.maxNode&&this.buffer.push(n,i,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>i||n<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(n,i),n<=o.maxNode&&this.buffer.push(n,i,r,4)}}apply(e,n,i,r){e&65536?this.reduce(e):this.shift(e,n,i,r)}useNode(e,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(n,r),this.buffer.push(i,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,n=e.buffer.length;for(n&&e.buffer[n-4]==0&&(n-=4);n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let i=e.buffer.slice(n),r=e.bufferBase+n;for(;e&&r==e.bufferBase;)e=e.parent;return new Ku(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,i?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new nD(this);;){let i=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(i==0)return!1;if(!(i&65536))return!0;n.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let r=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&r.push(n[s],o);if(this.stack.length<120)for(let s=0;r.length<8&&s<n.length;s+=2){let o=n[s+1];r.some((l,a)=>a&1&&l==o)||r.push(n[s],o)}n=r}let i=[];for(let r=0;r<n.length&&i.length<4;r+=2){let s=n[r+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[r],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let i=n>>19,r=n&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],i=(r,s)=>{if(!n.includes(r))return n.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(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 n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}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 n=new Fy(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}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 Fy{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class nD{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class qu{constructor(e,n,i){this.stack=e,this.pos=n,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new qu(e,n,n-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 qu(this.stack,this.pos,this.index)}}function Aa(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let i=0,r=0;i<t.length;){let s=0;for(;;){let o=t.charCodeAt(i++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[r++]=s:n=new e(s)}return n}class tu{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const jy=new tu;class iD{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=jy,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let i=this.range,r=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!r)return null;let o=this.ranges[--r];s-=i.from-o.to,i=o}for(;n<0?s>i.to:s>=i.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,i,r;if(n>=0&&n<this.chunk.length)i=this.pos+e,r=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(e,n=0){let i=n?this.resolveOffset(n,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>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,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=jy,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,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let i="";for(let r of this.ranges){if(r.from>=n)break;r.to>e&&(i+=this.input.read(Math.max(r.from,e),Math.min(r.to,n)))}return i}}class ks{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:i}=n.p;rD(this.data,e,n,this.id,i.data,i.tokenPrecTable)}}ks.prototype.contextual=ks.prototype.fallback=ks.prototype.extend=!1;ks.prototype.fallback=ks.prototype.extend=!1;function rD(t,e,n,i,r,s){let o=0,l=1<<i,{dialect:a}=n.p.parser;e:for(;l&t[o];){let u=t[o+1];for(let d=o+3;d<u;d+=2)if((t[d+1]&l)>0){let p=t[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||sD(p,e.token.value,r,s))){e.acceptToken(p);break}}let c=e.next,h=0,f=t[o+2];if(e.next<0&&f>h&&t[u+f*3-3]==65535){o=t[u+f*3-1];continue e}for(;h<f;){let d=h+f>>1,p=u+d+(d<<1),y=t[p],x=t[p+1]||65536;if(c<y)f=d;else if(c>=x)h=d+1;else{o=t[p+2],e.advance();continue e}}break}}function Vy(t,e,n){for(let i=e,r;(r=t[i])!=65535;i++)if(r==n)return i-e;return-1}function sD(t,e,n,i){let r=Vy(n,i,e);return r<0||Vy(n,i,t)<r}const Ct=typeof process<"u"&&$y&&/\bparse\b/.test($y.LOG);let Fh=null;function Hy(t,e,n){let i=t.cursor(Ne.IncludeAnonymous);for(i.moveTo(e);;)if(!(n<0?i.childBefore(e):i.childAfter(e)))for(;;){if((n<0?i.to<e:i.from>e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:t.length}}class oD{constructor(e,n){this.fragments=e,this.nodeSet=n,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?Hy(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Hy(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 n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let i=this.trees[n],r=this.index[n];if(r==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[r],o=this.start[n]+i.positions[r];if(o>e)return this.nextStart=o,null;if(s instanceof Ie){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(re.lookAhead);if(!a||l+a<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class lD{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new tu)}getActions(e){let n=0,i=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;u<s.length;u++){if(!(1<<u&o))continue;let c=s[u],h=this.tokens[u];if(!(i&&!c.fallback)&&((c.contextual||h.start!=e.pos||h.mask!=o||h.context!=l)&&(this.updateCachedToken(h,c,e),h.mask=o,h.context=l),h.lookAhead>h.end+25&&(a=Math.max(h.lookAhead,a)),h.value!=0)){let f=n;if(h.extended>-1&&(n=this.addActions(e,h.extended,h.end,n)),n=this.addActions(e,h.value,h.end,n),!c.extend&&(i=h,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new tu,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,n=this.addActions(e,i.value,i.end,n)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new tu,{pos:i,p:r}=e;return n.start=i,n.end=Math.min(i+1,r.stream.end),n.value=i==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(e,n,i){let r=this.stream.clipPos(i.pos);if(n.token(this.stream.reset(r,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let l=s.specializers[o](this.stream.read(e.start,e.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,n,i,r){for(let s=0;s<r;s+=3)if(this.actions[s]==e)return r;return this.actions[r++]=e,this.actions[r++]=n,this.actions[r++]=i,r}addActions(e,n,i,r){let{state:s}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let u=o.stateSlot(s,a?2:1);;u+=3){if(l[u]==65535)if(l[u+1]==1)u=Un(l,u+2);else{r==0&&l[u+1]==2&&(r=this.putAction(Un(l,u+2),n,i,r));break}l[u]==n&&(r=this.putAction(Un(l,u+1),n,i,r))}return r}}class aD{constructor(e,n,i,r){this.parser=e,this.input=n,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 iD(n,r),this.tokens=new lD(e,this.stream),this.topTerm=e.top[1];let{from:s}=r[0];this.stacks=[Ku.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new oD(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,i=this.stacks=[],r,s;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 l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>n)i.push(l);else{if(this.advanceStack(l,i,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!i.length){let o=r&&cD(r);if(o)return Ct&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ct&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,i);if(o)return Ct&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let a=o+1;a<i.length;a++){let u=i[a];if(l.sameState(u)||l.buffer.length>500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[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,n,i){let r=e.pos,{parser:s}=this,o=Ct?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?e.curContext.hash:0;for(let h=this.fragments.nodeAt(r);h;){let f=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(f>-1&&h.length&&(!u||(h.prop(re.contextHash)||0)==c))return e.useNode(h,f),Ct&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof Ie)||h.children.length==0||h.positions[0]>0)break;let d=h.children[0];if(d instanceof Ie&&h.positions[0]==0)h=d;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Ct&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;u<a.length;){let c=a[u++],h=a[u++],f=a[u++],d=u==a.length||!i,p=d?e:e.split(),y=this.tokens.mainToken;if(p.apply(c,h,y?y.start:p.pos,f),Ct&&console.log(o+this.stackID(p)+` (via ${c&65536?`reduce of ${s.getName(c&65535)}`:"shift"} for ${s.getName(h)} @ ${r}${p==e?"":", split"})`),d)return!0;p.pos>r?n.push(p):i.push(p)}return!1}advanceFully(e,n){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Wy(e,n),!0}}runRecovery(e,n,i){let r=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=n[o<<1],u=n[(o<<1)+1],c=Ct?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Ct&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let h=l.split(),f=c;for(let d=0;d<10&&h.forceReduce()&&(Ct&&console.log(f+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,i));d++)Ct&&(f=this.stackID(h)+" -> ");for(let d of l.recoverByInsert(a))Ct&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),Ct&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Wy(l,i)):(!r||r.score<h.score)&&(r=h)}return r}stackToTree(e){return e.close(),Ie.build({buffer:qu.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 n=(Fh||(Fh=new WeakMap)).get(e);return n||Fh.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function Wy(t,e){for(let n=0;n<e.length;n++){let i=e[n];if(i.pos==t.pos&&i.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class uD{constructor(e,n,i){this.source=e,this.flags=n,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class Yu extends _k{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;l<e.repeatNodeCount;l++)n.push("");let i=Object.keys(e.topRules).map(l=>e.topRules[l][1]),r=[];for(let l=0;l<n.length;l++)r.push([]);function s(l,a,u){r[l].push([a,a.deserialize(String(u))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=re[a]);for(let u=1;u<l.length;){let c=l[u++];if(c>=0)s(c,a,l[u++]);else{let h=l[u+-c];for(let f=-c;f>0;f--)s(l[u++],a,h);u++}}}this.nodeSet=new Nm(n.map((l,a)=>kt.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Ck;let o=Aa(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(Uy),this.states=Aa(e.states,Uint32Array),this.data=Aa(e.stateData),this.goto=Aa(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new ks(o,l):l),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,n,i){let r=new aD(this,e,n,i);for(let s of this.wrappers)r=s(r,e,n,i);return r}getGoto(e,n,i=!1){let r=this.goto;if(n>=r[0])return-1;for(let s=r[n+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&i)return a;for(let u=s+(o>>1);s<u;s++)if(r[s]==e)return a;if(l)return-1}}hasAction(e,n){let i=this.data;for(let r=0;r<2;r++)for(let s=this.stateSlot(e,r?2:1),o;;s+=3){if((o=i[s])==65535)if(i[s+1]==1)o=i[s=Un(i,s+2)];else{if(i[s+1]==2)return Un(i,s+2);break}if(o==n||o==0)return Un(i,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,i=>i==n?!0:null)}allActions(e,n){let i=this.stateSlot(e,4),r=i?n(i):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Un(this.data,s+2);else break;r=n(Un(this.data,s+1))}return r}nextStates(e){let n=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Un(this.data,i+2);else break;if(!(this.data[i+2]&1)){let r=this.data[i+1];n.some((s,o)=>o&1&&s==r)||n.push(this.data[i],r)}}return n}configure(e){let n=Object.assign(Object.create(Yu.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=i}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(i=>{let r=e.tokenizers.find(s=>s.from==i);return r?r.to:i})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((i,r)=>{let s=e.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return n.specializers[r]=Uy(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}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 n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),i=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(i[o]=!0)}let r=null;for(let s=0;s<n.length;s++)if(!i[s])for(let o=this.dialects[n[s]],l;(l=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[l]=1;return new uD(e,i,r)}static deserialize(e){return new Yu(e)}}function Un(t,e){return t[e]|t[e+1]<<16}function cD(t){let e=null;for(let n of t){let i=n.p.stoppedAt;(n.pos==n.p.stream.end||i!=null&&n.pos>i)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function Uy(t){if(t.external){let e=t.extend?1:0;return(n,i)=>t.external(n,i)<<1|e}return t.get}let hD=0;class $t{constructor(e,n,i,r){this.name=e,this.set=n,this.base=i,this.modified=r,this.id=hD++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let i=typeof e=="string"?e:"?";if(e instanceof $t&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new $t(i,[],null,[]);if(r.set.push(r),n)for(let s of n.set)r.set.push(s);return r}static defineModifier(e){let n=new Qu(e);return i=>i.modified.indexOf(n)>-1?i:Qu.get(i.base||i,i.modified.concat(n).sort((r,s)=>r.id-s.id))}}let fD=0;class Qu{constructor(e){this.name=e,this.instances=[],this.id=fD++}static get(e,n){if(!n.length)return e;let i=n[0].instances.find(l=>l.base==e&&dD(n,l.modified));if(i)return i;let r=[],s=new $t(e.name,r,e,n);for(let l of n)l.instances.push(s);let o=pD(n);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Qu.get(l,a));return s}}function dD(t,e){return t.length==e.length&&t.every((n,i)=>n==e[i])}function pD(t){let e=[[]];for(let n=0;n<t.length;n++)for(let i=0,r=e.length;i<r;i++)e.push(e[i].concat(t[n]));return e.sort((n,i)=>i.length-n.length)}function Tk(t){let e=Object.create(null);for(let n in t){let i=t[n];Array.isArray(i)||(i=[i]);for(let r of n.split(" "))if(r){let s=[],o=2,l=r;for(let h=0;;){if(l=="..."&&h>0&&h+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==r.length)break;let d=r[h++];if(h==r.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+r);l=r.slice(h)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+r);let c=new Cl(i,o,a>0?s.slice(0,a):null);e[u]=c.sort(e[u])}}return Mk.add(e)}const Mk=new re({combine(t,e){let n,i,r;for(;t||e;){if(!t||e&&t.depth>=e.depth?(r=e,e=e.next):(r=t,t=t.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let s=new Cl(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});class Cl{constructor(e,n,i,r){this.tags=e,this.mode=n,this.context=i,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}}Cl.empty=new Cl([],2,null);function Ok(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:i,all:r=null}=e||{};return{style:s=>{let o=r;for(let l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:i}}function mD(t,e){let n=null;for(let i of t){let r=i.style(e);r&&(n=n?n+" "+r:r)}return n}function gD(t,e,n,i=0,r=t.length){let s=new yD(i,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),i,r,"",s.highlighters),s.flush(r)}class yD{constructor(e,n,i){this.at=e,this.highlighters=n,this.span=i,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,i,r,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=n)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let u=r,c=vD(e)||Cl.empty,h=mD(s,c.tags);if(h&&(u&&(u+=" "),u+=h,c.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(n,l),u),c.opaque)return;let f=e.tree&&e.tree.prop(re.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+l,1),p=this.highlighters.filter(x=>!x.scope||x.scope(f.tree.type)),y=e.firstChild();for(let x=0,m=l;;x++){let g=x<f.overlay.length?f.overlay[x]:null,v=g?g.from+l:a,w=Math.max(n,m),k=Math.min(i,v);if(w<k&&y)for(;e.from<k&&(this.highlightRange(e,w,k,r,s),this.startSpan(Math.min(k,e.to),u),!(e.to>=v||!e.nextSibling())););if(!g||v>i)break;m=g.to+l,m>n&&(this.highlightRange(d.cursor(),Math.max(n,g.from+l),Math.min(i,m),"",p),this.startSpan(Math.min(i,m),u))}y&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=n)){if(e.from>=i)break;this.highlightRange(e,n,i,r,s),this.startSpan(Math.min(i,e.to),u)}while(e.nextSibling());e.parent()}}}function vD(t){let e=t.type.prop(Mk);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const K=$t.define,Na=K(),pi=K(),Ky=K(pi),qy=K(pi),mi=K(),_a=K(mi),jh=K(mi),En=K(),Zi=K(En),bn=K(),Cn=K(),jd=K(),po=K(jd),Ta=K(),X={comment:Na,lineComment:K(Na),blockComment:K(Na),docComment:K(Na),name:pi,variableName:K(pi),typeName:Ky,tagName:K(Ky),propertyName:qy,attributeName:K(qy),className:K(pi),labelName:K(pi),namespace:K(pi),macroName:K(pi),literal:mi,string:_a,docString:K(_a),character:K(_a),attributeValue:K(_a),number:jh,integer:K(jh),float:K(jh),bool:K(mi),regexp:K(mi),escape:K(mi),color:K(mi),url:K(mi),keyword:bn,self:K(bn),null:K(bn),atom:K(bn),unit:K(bn),modifier:K(bn),operatorKeyword:K(bn),controlKeyword:K(bn),definitionKeyword:K(bn),moduleKeyword:K(bn),operator:Cn,derefOperator:K(Cn),arithmeticOperator:K(Cn),logicOperator:K(Cn),bitwiseOperator:K(Cn),compareOperator:K(Cn),updateOperator:K(Cn),definitionOperator:K(Cn),typeOperator:K(Cn),controlOperator:K(Cn),punctuation:jd,separator:K(jd),bracket:po,angleBracket:K(po),squareBracket:K(po),paren:K(po),brace:K(po),content:En,heading:Zi,heading1:K(Zi),heading2:K(Zi),heading3:K(Zi),heading4:K(Zi),heading5:K(Zi),heading6:K(Zi),contentSeparator:K(En),list:K(En),quote:K(En),emphasis:K(En),strong:K(En),link:K(En),monospace:K(En),strikethrough:K(En),inserted:K(),deleted:K(),changed:K(),invalid:K(),meta:Ta,documentMeta:K(Ta),annotation:K(Ta),processingInstruction:K(Ta),definition:$t.defineModifier("definition"),constant:$t.defineModifier("constant"),function:$t.defineModifier("function"),standard:$t.defineModifier("standard"),local:$t.defineModifier("local"),special:$t.defineModifier("special")};for(let t in X){let e=X[t];e instanceof $t&&(e.name=t)}Ok([{tag:X.link,class:"tok-link"},{tag:X.heading,class:"tok-heading"},{tag:X.emphasis,class:"tok-emphasis"},{tag:X.strong,class:"tok-strong"},{tag:X.keyword,class:"tok-keyword"},{tag:X.atom,class:"tok-atom"},{tag:X.bool,class:"tok-bool"},{tag:X.url,class:"tok-url"},{tag:X.labelName,class:"tok-labelName"},{tag:X.inserted,class:"tok-inserted"},{tag:X.deleted,class:"tok-deleted"},{tag:X.literal,class:"tok-literal"},{tag:X.string,class:"tok-string"},{tag:X.number,class:"tok-number"},{tag:[X.regexp,X.escape,X.special(X.string)],class:"tok-string2"},{tag:X.variableName,class:"tok-variableName"},{tag:X.local(X.variableName),class:"tok-variableName tok-local"},{tag:X.definition(X.variableName),class:"tok-variableName tok-definition"},{tag:X.special(X.variableName),class:"tok-variableName2"},{tag:X.definition(X.propertyName),class:"tok-propertyName tok-definition"},{tag:X.typeName,class:"tok-typeName"},{tag:X.namespace,class:"tok-namespace"},{tag:X.className,class:"tok-className"},{tag:X.macroName,class:"tok-macroName"},{tag:X.propertyName,class:"tok-propertyName"},{tag:X.operator,class:"tok-operator"},{tag:X.comment,class:"tok-comment"},{tag:X.meta,class:"tok-meta"},{tag:X.invalid,class:"tok-invalid"},{tag:X.punctuation,class:"tok-punctuation"}]);const wD=Tk({String:X.string,Number:X.number,"True False":X.bool,PropertyName:X.propertyName,Null:X.null,", :":X.separator,"[ ]":X.squareBracket,"{ }":X.brace}),xD=Yu.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:[wD],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});var Vh;const rs=new re;function SD(t){return Z.define({combine:t?e=>e.concat(t):void 0})}const kD=new re;class cn{constructor(e,n,i=[],r=""){this.data=e,this.name=r,ae.prototype.hasOwnProperty("tree")||Object.defineProperty(ae.prototype,"tree",{get(){return Xt(this)}}),this.parser=n,this.extension=[Hs.of(this),ae.languageData.of((s,o,l)=>{let a=Yy(s,o,l),u=a.type.prop(rs);if(!u)return[];let c=s.facet(u),h=a.type.prop(kD);if(h){let f=a.resolve(o-a.from,l);for(let d of h)if(d.test(f,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,n,i=-1){return Yy(e,n,i).type.prop(rs)==this.data}findRegions(e){let n=e.facet(Hs);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let i=[],r=(s,o)=>{if(s.prop(rs)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(re.mounted);if(l){if(l.tree.prop(rs)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let a=i.length;if(r(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a<s.children.length;a++){let u=s.children[a];u instanceof Ie&&r(u,s.positions[a]+o)}};return r(Xt(e),0),i}get allowsNesting(){return!0}}cn.setState=me.define();function Yy(t,e,n){let i=t.facet(Hs),r=Xt(t).topNode;if(!i||i.allowsNesting)for(let s=r;s;s=s.enter(e,n,Ne.ExcludeBuffers|Ne.EnterBracketed))s.type.isTop&&(r=s);return r}class Xu extends cn{constructor(e,n,i){super(e,n,[],i),this.parser=n}static define(e){let n=SD(e.languageData);return new Xu(n,e.parser.configure({props:[rs.add(i=>i.isTop?n:void 0)]}),e.name)}configure(e,n){return new Xu(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xt(t){let e=t.field(cn.state,!1);return e?e.tree:Ie.empty}class bD{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,n){let i=this.cursorPos-this.string.length;return e<i||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-i,n-i)}}let mo=null;class Gu{constructor(e,n,i=[],r,s,o,l,a){this.parser=e,this.state=n,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,i){return new Gu(e,n,[],Ie.empty,0,i,[],null)}startParse(){return this.parser.startParse(new bD(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ie.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(mr.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(mr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=mo;mo=this;try{return e()}finally{mo=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=Qy(e,n.from,n.to);return e}changes(e,n){let{fragments:i,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((u,c,h,f)=>a.push({fromA:u,toA:c,fromB:h,toB:f})),i=mr.applyChanges(i,a),r=Ie.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),h=e.mapPos(u.to,-1);c<h&&l.push({from:c,to:h})}}}return new Gu(this.parser,n,i,r,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:r,to:s}=this.skipped[i];r<e.to&&s>e.from&&(this.fragments=Qy(this.fragments,r,s),this.skipped.splice(i--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends _k{createParse(n,i,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let a=mo;if(a){for(let u of r)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Ie(kt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return mo}}function Qy(t,e,n){return mr.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Vs{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new Vs(n)}static init(e){let n=Math.min(3e3,e.doc.length),i=Gu.create(e.facet(Hs).parser,e,{from:0,to:n});return i.work(20,n)||i.takeTree(),new Vs(i)}}cn.state=li.define({create:Vs.init,update(t,e){for(let n of e.effects)if(n.is(cn.setState))return n.value;return e.startState.facet(Hs)!=e.state.facet(Hs)?Vs.init(e.state):t.apply(e)}});let Pk=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Pk=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Hh=typeof navigator<"u"&&(!((Vh=navigator.scheduling)===null||Vh===void 0)&&Vh.isInputPending)?()=>navigator.scheduling.isInputPending():null,CD=Bn.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 n=this.view.state.field(cn.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(cn.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Pk(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,s=i.field(cn.state);if(s.tree==s.context.tree&&s.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Hh?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<r&&i.doc.length>r+1e3,a=s.context.work(()=>Hh&&Hh()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:cn.setState.of(new Vs(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Tt(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Hs=Z.define({combine(t){return t.length?t[0]:null},enables:t=>[cn.state,CD,ee.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class ED{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const AD=Z.define(),Om=Z.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Ju(t){let e=t.facet(Om);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Zu(t,e){let n="",i=t.tabSize,r=t.facet(Om)[0];if(r==" "){for(;e>=i;)n+=" ",e-=i;r=" "}for(let s=0;s<e;s++)n+=r;return n}function Rk(t,e){t instanceof ae&&(t=new Dc(t));for(let i of t.state.facet(AD)){let r=i(t,e);if(r!==void 0)return r}let n=Xt(t.state);return n.length>=e?ND(t,n,e):null}class Dc{constructor(e,n={}){this.state=e,this.options=n,this.unit=Ju(e)}lineAt(e,n=1){let i=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=i.from&&r<=i.to?s&&r==e?{text:"",from:e}:(n<0?r<e:r<=e)?{text:i.text.slice(r-i.from),from:r}:{text:i.text.slice(0,r-i.from),from:i.from}:i}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:r}=this.lineAt(e,n);return i.slice(e-r,Math.min(i.length,e+100-r))}column(e,n=1){let{text:i,from:r}=this.lineAt(e,n),s=this.countColumn(i,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(s+=o-this.countColumn(i,i.search(/\S|$/))),s}countColumn(e,n=e.length){return Tc(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:i,from:r}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ik=new re;function ND(t,e,n){let i=e.resolveStack(n),r=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let s=[];for(let o=r;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)i={node:s[o],next:i}}return Dk(i,t,n)}function Dk(t,e,n){for(let i=t;i;i=i.next){let r=TD(i.node);if(r)return r(Pm.create(e,n,i))}return 0}function _D(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function TD(t){let e=t.type.prop(Ik);if(e)return e;let n=t.firstChild,i;if(n&&(i=n.type.prop(re.closedBy))){let r=t.lastChild,s=r&&i.indexOf(r.name)>-1;return o=>RD(o,!0,1,void 0,s&&!_D(o)?r.from:void 0)}return t.parent==null?MD:null}function MD(){return 0}class Pm extends Dc{constructor(e,n,i){super(e.state,e.options),this.base=e,this.pos=n,this.context=i}get node(){return this.context.node}static create(e,n,i){return new Pm(e,n,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(n.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(OD(i,e))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}continue(){return Dk(this.context.next,this.base,this.pos)}}function OD(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function PD(t){let e=t.node,n=e.childAfter(e.from),i=e.lastChild;if(!n)return null;let r=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function RD(t,e,n,i,r){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==t.pos+o,a=PD(t);return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}function Xy({except:t,units:e=1}={}){return n=>{let i=t&&t.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const ID=new re;function DD(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}class Lc{constructor(e,n){this.specs=e;let i;function r(l){let a=zi.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const s=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof cn?l=>l.prop(rs)==o.data:o?l=>l==o:void 0,this.style=Ok(e.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new zi(i):null,this.themeType=n.themeType}static define(e,n){return new Lc(e,n||{})}}const Vd=Z.define(),LD=Z.define({combine(t){return t.length?[t[0]]:null}});function Wh(t){let e=t.facet(Vd);return e.length?e:t.facet(LD)}function BD(t,e){let n=[$D],i;return t instanceof Lc&&(t.module&&n.push(ee.styleModule.of(t.module)),i=t.themeType),i?n.push(Vd.computeN([ee.darkTheme],r=>r.facet(ee.darkTheme)==(i=="dark")?[t]:[])):n.push(Vd.of(t)),n}class zD{constructor(e){this.markCache=Object.create(null),this.tree=Xt(e.state),this.decorations=this.buildDeco(e,Wh(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Xt(e.state),i=Wh(e.state),r=i!=Wh(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!r&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return Me.none;let i=new yl;for(let{from:r,to:s}of e.visibleRanges)gD(this.tree,n,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=Me.mark({class:a})))},r,s);return i.finish()}}const $D=Dl.high(Bn.fromClass(zD,{decorations:t=>t.decorations})),FD=1e4,jD="()[]{}",VD=new re;function Hd(t,e,n){let i=t.prop(e<0?re.openedBy:re.closedBy);if(i)return i;if(t.name.length==1){let r=n.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[n[r+e]]}return null}function Wd(t){let e=t.type.prop(VD);return e?e(t.node):t}function ss(t,e,n,i={}){let r=i.maxScanDistance||FD,s=i.brackets||jD,o=Xt(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=Hd(a.type,n,s);if(u&&a.from<a.to){let c=Wd(a);if(c&&(n>0?e>=c.from&&e<c.to:e>c.from&&e<=c.to))return HD(t,e,n,a,c,u,s)}}return WD(t,e,n,o,l.type,r,s)}function HD(t,e,n,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},u=0,c=l==null?void 0:l.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do if(n<0?c.to<=i.from:c.from>=i.to){if(u==0&&s.indexOf(c.type.name)>-1&&c.from<c.to){let h=Wd(c);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Hd(c.type,n,o))u++;else if(Hd(c.type,-n,o)){if(u==0){let h=Wd(c);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}u--}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function WD(t,e,n,i,r,s,o){if(n<0?!e:e==t.doc.length)return null;let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),h=0;for(let f=0;!c.next().done&&f<=s;){let d=c.value;n<0&&(f+=d.length);let p=e+f*n;for(let y=n>0?0:d.length-1,x=n>0?d.length:-1;y!=x;y+=n){let m=o.indexOf(d[y]);if(!(m<0||i.resolveInner(p+y,1).type!=r))if(m%2==0==n>0)h++;else{if(h==1)return{start:u,end:{from:p+y,to:p+y+1},matched:m>>1==a>>1};h--}}n>0&&(f+=d.length)}return c.done?{start:u,matched:!1}:null}const UD=Object.create(null),Gy=[kt.none],Jy=[],Zy=Object.create(null),KD=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"]])KD[t]=qD(UD,e);function Uh(t,e){Jy.indexOf(t)>-1||(Jy.push(t),console.warn(e))}function qD(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let c=t[u]||X[u];c?typeof c=="function"?a.length?a=a.map(c):Uh(u,`Modifier ${u} used at start of tag`):a.length?Uh(u,`Tag ${u} used as modifier`):a=Array.isArray(c)?c:[c]:Uh(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+n.map(l=>l.id),s=Zy[r];if(s)return s.id;let o=Zy[r]=kt.define({id:Gy.length,name:i,props:[Tk({[i]:n})]});return Gy.push(o),o.id}Te.RTL,Te.LTR;const YD=Xu.define({name:"json",parser:xD.configure({props:[Ik.add({Object:Xy({except:/^\s*\}/}),Array:Xy({except:/^\s*\]/})}),ID.add({"Object Array":DD})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function QD(){return new ED(YD)}class Lk{constructor(e,n,i,r){this.state=e,this.pos=n,this.explicit=i,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Xt(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),i=Math.max(n.from,this.pos-250),r=n.text.slice(i-n.from,this.pos-n.from),s=r.search(Bk(e,!1));return s<0?null:{from:i+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function ev(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function XD(t){let e=Object.create(null),n=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let s=1;s<r.length;s++)n[r[s]]=!0}let i=ev(e)+ev(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function GD(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[n,i]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:XD(e);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:e,validFor:n}:null}}class tv{constructor(e,n,i,r){this.completion=e,this.source=n,this.match=i,this.score=r}}function gr(t){return t.selection.main.from}function Bk(t,e){var n;let{source:i}=t,r=e&&i[0]!="^",s=i[i.length-1]!="$";return!r&&!s?t:new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const zk=$n.define();function JD(t,e,n,i){let{main:r}=t.selection,s=n-r.from,o=i-r.from;return{...t.changeByRange(l=>{if(l!=r&&n!=i&&t.sliceDoc(l.from+s,l.from+o)!=t.sliceDoc(n,i))return{range:l};let a=t.toText(e);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:V.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const nv=new WeakMap;function ZD(t){if(!Array.isArray(t))return t;let e=nv.get(t);return e||nv.set(t,e=GD(t)),e}const ec=me.define(),El=me.define();class e3{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let i=ir(e,n),r=Vr(i);this.chars.push(i);let s=e.slice(n,n+r),o=s.toUpperCase();this.folded.push(ir(o==s?s.toLowerCase():o,0)),n+=r}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:i,any:r,precise:s,byWord:o}=this;if(n.length==1){let g=ir(e,0),v=Vr(g),w=v==e.length?0:-100;if(g!=n[0])if(g==i[0])w+=-200;else return null;return this.ret(w,[0,v])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=n.length,u=0;if(l<0){for(let g=0,v=Math.min(e.length,200);g<v&&u<a;){let w=ir(e,g);(w==n[u]||w==i[u])&&(r[u++]=g),g+=Vr(w)}if(u<a)return null}let c=0,h=0,f=!1,d=0,p=-1,y=-1,x=/[a-z]/.test(e),m=!0;for(let g=0,v=Math.min(e.length,200),w=0;g<v&&h<a;){let k=ir(e,g);l<0&&(c<a&&k==n[c]&&(s[c++]=g),d<a&&(k==n[d]||k==i[d]?(d==0&&(p=g),y=g+1,d++):d=0));let C,E=k<255?k>=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(C=BP(k))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!g||E==1&&x||w==0&&E!=0)&&(n[h]==k||i[h]==k&&(f=!0)?o[h++]=g:o.length&&(m=!1)),w=E,g+=Vr(k)}return h==a&&o[0]==0&&m?this.result(-100+(f?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,y]):h==a?this.result(-100+(f?-200:0)+-700+(m?0:-1100),o,e):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,n,i){let r=[],s=0;for(let o of n){let l=o+(this.astral?Vr(ir(i,o)):1);s&&r[s-1]==o?r[s-1]=l:(r[s++]=o,r[s++]=l)}return this.ret(e-i.length,r)}}class t3{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),i=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,n.length],this.score=i+(e.length==this.pattern.length?0:-100),this)}}const Ve=Z.define({combine(t){return AS(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:n3,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>i=>iv(e(i),n(i)),optionClass:(e,n)=>i=>iv(e(i),n(i)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function iv(t,e){return t?e?t+" "+e:t:e}function n3(t,e,n,i,r,s){let o=t.textDirection==Te.RTL,l=o,a=!1,u="top",c,h,f=e.left-r.left,d=r.right-e.right,p=i.right-i.left,y=i.bottom-i.top;if(l&&f<Math.min(p,d)?l=!1:!l&&d<Math.min(p,f)&&(l=!0),p<=(l?f:d))c=Math.max(r.top,Math.min(n.top,r.bottom-y))-e.top,h=Math.min(400,l?f:d);else{a=!0,h=Math.min(400,(o?e.right:r.right-e.left)-30);let g=r.bottom-e.bottom;g>=y||g>e.top?c=n.bottom-e.top:(u="bottom",c=e.bottom-n.top)}let x=(e.bottom-e.top)/s.offsetHeight,m=(e.right-e.left)/s.offsetWidth;return{style:`${u}: ${c/x}px; max-width: ${h/m}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}const Rm=me.define();function i3(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),n.type&&i.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(n,i,r,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let u=0;u<s.length;){let c=s[u++],h=s[u++];c>a&&o.appendChild(document.createTextNode(l.slice(a,c)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(l.slice(c,h))),f.className="cm-completionMatchedText",a=h}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),o},position:50},{render(n){if(!n.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),e.sort((n,i)=>n.position-i.position).map(n=>n.render)}function Kh(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/n);return{from:r*n,to:(r+1)*n}}let i=Math.ceil((t-e)/n);return{from:t-i*n,to:t-(i-1)*n}}class r3{constructor(e,n,i){this.view=e,this.stateField=n,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let r=e.state.field(n),{options:s,selected:o}=r.open,l=e.state.facet(Ve);this.optionContent=i3(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Kh(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:u}=e.state.field(n).open;for(let c=a.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]<u.length){this.applyCompletion(e,u[+h[1]]),a.preventDefault();return}if(a.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&a.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&a.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:Rm.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(Ve).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:El.of(null)})}),this.showOptions(s,r.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let i=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=r){let{options:s,selected:o,disabled:l}=i.open;(!r.open||r.open.options!=s)&&(this.range=Kh(s.length,o,e.state.facet(Ve).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),l!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of n.split(" "))i&&this.dom.classList.add(i);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Kh(n.options.length,n.selected,this.view.state.facet(Ve).maxRenderedOptions),this.showOptions(n.options,e.id));let i=this.updateSelectedOption(n.selected);if(i){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:s}=r;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(r);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,r)}).catch(l=>Tt(this.view.state,l,"completion info")):(this.addInfoPane(o,r),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:s}=e;i.appendChild(r),this.infoDestroy=s||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let i=this.list.firstChild,r=this.range.from;i;i=i.nextSibling,r++)i.nodeName!="LI"||!i.id?r--:r==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),n=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return n&&o3(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(s.bottom,n.bottom)-10||r.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(Ve).positionInfo(this.view,n,r,i,s,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,n,i){const r=document.createElement("ul");r.id=n,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 s=null;for(let o=i.from;o<i.to;o++){let{completion:l,match:a}=e[o],{section:u}=l;if(u){let f=typeof u=="string"?u:u.name;if(f!=s&&(o>i.from||i.from==0))if(s=f,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let d=r.appendChild(document.createElement("completion-section"));d.textContent=f}}const c=r.appendChild(document.createElement("li"));c.id=n+"-"+o,c.setAttribute("role","option");let h=this.optionClass(l);h&&(c.className=h);for(let f of this.optionContent){let d=f(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&r.classList.add("cm-completionListIncompleteTop"),i.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 s3(t,e){return n=>new r3(n,t,e)}function o3(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.height/t.offsetHeight;i.top<n.top?t.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/r)}function rv(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function l3(t,e){let n=[],i=null,r=null,s=c=>{n.push(c);let{section:h}=c.completion;if(h){i||(i=[]);let f=typeof h=="string"?h:h.name;i.some(d=>d.name==f)||i.push(typeof h=="string"?{name:f}:h)}},o=e.facet(Ve);for(let c of t)if(c.hasResult()){let h=c.result.getMatch;if(c.result.filter===!1)for(let f of c.result.options)s(new tv(f,c.source,h?h(f):[],1e9-n.length));else{let f=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new t3(f):new e3(f);for(let y of c.result.options)if(d=p.match(y.label)){let x=y.displayLabel?h?h(y,d.matched):[]:d.matched,m=d.score+(y.boost||0);if(s(new tv(y,c.source,x,m)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:g}=y.section;r||(r=Object.create(null)),r[g]=Math.max(m,r[g]||-1e9)}}}}if(i){let c=Object.create(null),h=0,f=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?r[p.name]-r[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.name<p.name?-1:1);for(let d of i.sort(f))h-=1e5,c[d.name]=h;for(let d of n){let{section:p}=d.completion;p&&(d.score+=c[typeof p=="string"?p:p.name])}}let l=[],a=null,u=o.compareCompletions;for(let c of n.sort((h,f)=>f.score-h.score||u(h.completion,f.completion))){let h=c.completion;!a||a.label!=h.label||a.detail!=h.detail||a.type!=null&&h.type!=null&&a.type!=h.type||a.apply!=h.apply||a.boost!=h.boost?l.push(c):rv(c.completion)>rv(a)&&(l[l.length-1]=c),a=c.completion}return l}class os{constructor(e,n,i,r,s,o){this.options=e,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new os(this.options,sv(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,i,r,s,o){if(r&&!o&&e.some(u=>u.isPending))return r.setDisabled();let l=l3(e,n);if(!l.length)return r&&e.some(u=>u.isPending)?r.setDisabled():null;let a=n.facet(Ve).selectOnOpen?0:-1;if(r&&r.selected!=a&&r.selected!=-1){let u=r.options[r.selected].completion;for(let c=0;c<l.length;c++)if(l[c].completion==u){a=c;break}}return new os(l,sv(i,a),{pos:e.reduce((u,c)=>c.hasResult()?Math.min(u,c.from):u,1e8),create:d3,above:s.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new os(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new os(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class tc{constructor(e,n,i){this.active=e,this.id=n,this.open=i}static start(){return new tc(h3,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,i=n.facet(Ve),s=(i.override||n.languageDataAt("autocomplete",gr(n)).map(ZD)).map(a=>(this.active.find(c=>c.source==a)||new Ht(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));s.length==this.active.length&&s.every((a,u)=>a==this.active[u])&&(s=this.active);let o=this.open,l=e.effects.some(a=>a.is(Im));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!a3(s,this.active)||l?o=os.build(s,n,this.id,o,i,l):o&&o.disabled&&!s.some(a=>a.isPending)&&(o=null),!o&&s.every(a=>!a.isPending)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new Ht(a.source,0):a));for(let a of e.effects)a.is(Rm)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new tc(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?u3:c3}}function a3(t,e){if(t==e)return!0;for(let n=0,i=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;i<e.length&&!e[i].hasResult();)i++;let r=n==t.length,s=i==e.length;if(r||s)return r==s;if(t[n++].result!=e[i++].result)return!1}}const u3={"aria-autocomplete":"list"},c3={};function sv(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const h3=[];function $k(t,e){if(t.isUserEvent("input.complete")){let i=t.annotation(zk);if(i&&e.activateOnCompletion(i))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ht{constructor(e,n,i=!1){this.source=e,this.state=n,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let i=$k(e,n),r=this;(i&8||i&16&&this.touches(e))&&(r=new Ht(r.source,0)),i&4&&r.state==0&&(r=new Ht(this.source,1)),r=r.updateFor(e,i);for(let s of e.effects)if(s.is(ec))r=new Ht(r.source,1,s.value);else if(s.is(El))r=new Ht(r.source,0);else if(s.is(Im))for(let o of s.value)o.source==r.source&&(r=o);return r}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gr(e.state))}}class bs extends Ht{constructor(e,n,i,r,s,o){super(e,3,n),this.limit=i,this.result=r,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,n){var i;if(!(n&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=gr(e.state);if(l>o||!r||n&2&&(gr(e.startState)==this.from||l<this.limit))return new Ht(this.source,n&4?1:0);let a=e.changes.mapPos(this.limit);return f3(r.validFor,e.state,s,o)?new bs(this.source,this.explicit,a,r,s,o):r.update&&(r=r.update(r,s,o,new Lk(e.state,l,!1)))?new bs(this.source,this.explicit,a,r,r.from,(i=r.to)!==null&&i!==void 0?i:gr(e.state)):new Ht(this.source,1,this.explicit)}map(e){if(e.empty)return this;let n=this.result.map?this.result.map(this.result,e):this.result;return n?new bs(this.source,this.explicit,e.mapPos(this.limit),n,e.mapPos(this.from),e.mapPos(this.to,1)):new Ht(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function f3(t,e,n,i){if(!t)return!1;let r=e.sliceDoc(n,i);return typeof t=="function"?t(r,n,i,e):Bk(t,!0).test(r)}const Im=me.define({map(t,e){return t.map(n=>n.map(e))}}),pt=li.define({create(){return tc.start()},update(t,e){return t.update(e)},provide:t=>[kk.from(t,e=>e.tooltip),ee.contentAttributes.from(t,e=>e.attrs)]});function Dm(t,e){const n=e.completion.apply||e.completion.label;let i=t.state.field(pt).active.find(r=>r.source==e.source);return i instanceof bs?(typeof n=="string"?t.dispatch({...JD(t.state,n,i.from,i.to),annotations:zk.of(e.completion)}):n(t,e.completion,i.from,i.to),!0):!1}const d3=s3(pt,Dm);function Ma(t,e="option"){return n=>{let i=n.state.field(pt,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Ve).interactionDelay)return!1;let r=1,s;e=="page"&&(s=bk(n,i.open.tooltip))&&(r=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+r*(t?1:-1):t?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),n.dispatch({effects:Rm.of(l)}),!0}}const p3=t=>{let e=t.state.field(pt,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Ve).interactionDelay?!1:Dm(t,e.open.options[e.open.selected])},qh=t=>t.state.field(pt,!1)?(t.dispatch({effects:ec.of(!0)}),!0):!1,m3=t=>{let e=t.state.field(pt,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:El.of(null)}),!0)};class g3{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const y3=50,v3=1e3,w3=Bn.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(pt).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(pt),n=t.state.facet(Ve);if(!t.selectionSet&&!t.docChanged&&t.startState.field(pt)==e)return;let i=t.transactions.some(s=>{let o=$k(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(i||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>y3&&Date.now()-o.time>v3){for(let l of o.context.abortListeners)try{l()}catch(a){Tt(this.view.state,a)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(ec)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(pt);for(let n of e.active)n.isPending&&!this.running.some(i=>i.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ve).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gr(e),i=new Lk(e,n,t.explicit,this.view),r=new g3(t,i);this.running.push(r),Promise.resolve(t.source(i)).then(s=>{r.context.aborted||(r.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:El.of(null)}),Tt(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ve).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Ve),i=this.view.state.field(pt);for(let r=0;r<this.running.length;r++){let s=this.running[r];if(s.done===void 0)continue;if(this.running.splice(r--,1),s.done){let l=gr(s.updates.length?s.updates[0].startState:this.view.state),a=Math.min(l,s.done.from+(s.active.explicit?0:1)),u=new bs(s.active.source,s.active.explicit,a,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:l);for(let c of s.updates)u=u.update(c,n);if(u.hasResult()){e.push(u);continue}}let o=i.active.find(l=>l.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new Ht(s.active.source,0);for(let a of s.updates)l=l.update(a,n);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Im.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(pt,!1);if(e&&e.tooltip&&this.view.state.facet(Ve).closeOnBlur){let n=e.open&&bk(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:El.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ec.of(!1)}),20),this.composing=0}}}),x3=typeof navigator=="object"&&/Win/.test(navigator.platform),S3=Dl.highest(ee.domEventHandlers({keydown(t,e){let n=e.state.field(pt,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(x3&&t.altKey)||t.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(o=>o.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&Dm(e,i),!1}})),k3=ee.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Fk=new class extends Bi{};Fk.startSide=1;Fk.endSide=-1;function b3(t={}){return[S3,pt,Ve.of(t),w3,E3,k3]}const C3=[{key:"Ctrl-Space",run:qh},{mac:"Alt-`",run:qh},{mac:"Alt-i",run:qh},{key:"Escape",run:m3},{key:"ArrowDown",run:Ma(!0)},{key:"ArrowUp",run:Ma(!1)},{key:"PageDown",run:Ma(!0,"page")},{key:"PageUp",run:Ma(!1,"page")},{key:"Enter",run:p3}],E3=Dl.highest(Am.computeN([Ve],t=>t.facet(Ve).defaultKeymap?[C3]:[])),A3=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),i=Bm(t.state,n.from);return i.line?N3(t):i.block?T3(t):!1};function Lm(t,e){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=t(e,n);return r?(i(n.update(r)),!0):!1}}const N3=Lm(P3,0),_3=Lm(jk,0),T3=Lm((t,e)=>jk(t,e,O3(e)),0);function Bm(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const go=50;function M3(t,{open:e,close:n},i,r){let s=t.sliceDoc(i-go,i),o=t.sliceDoc(r,r+go),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,h;r-i<=2*go?c=h=t.sliceDoc(i,r):(c=t.sliceDoc(i,i+go),h=t.sliceDoc(r-go,r));let f=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-n.length;return c.slice(f,f+e.length)==e&&h.slice(p,p+n.length)==n?{open:{pos:i+f+e.length,margin:/\s/.test(c.charAt(f+e.length))?1:0},close:{pos:r-d-n.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function O3(t){let e=[];for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),r=n.to<=i.to?i:t.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function jk(t,e,n=e.selection.ranges){let i=n.map(s=>Bm(e,s.from).block);if(!i.every(s=>s))return null;let r=n.map((s,o)=>M3(e,i[o],s.from,s.to));if(t!=2&&!r.every(s=>s))return{changes:e.changes(n.map((s,o)=>r[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(t!=1&&r.some(s=>s)){let s=[];for(let o=0,l;o<r.length;o++)if(l=r[o]){let a=i[o],{open:u,close:c}=l;s.push({from:u.pos-a.open.length,to:u.pos+u.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:s}}return null}function P3(t,e,n=e.selection.ranges){let i=[],r=-1;e:for(let{from:s,to:o}of n){let l=i.length,a=1e9,u;for(let c=s;c<=o;){let h=e.doc.lineAt(c);if(u==null&&(u=Bm(e,h.from).line,!u))continue e;if(h.from>r&&(s==o||o>h.from)){r=h.from;let f=/^\s*/.exec(h.text)[0].length,d=f==h.length,p=h.text.slice(f,f+u.length)==u?f:-1;f<h.text.length&&f<a&&(a=f),i.push({line:h,comment:p,token:u,indent:f,empty:d,single:!1})}c=h.to+1}if(a<1e9)for(let c=l;c<i.length;c++)i[c].indent<i[c].line.text.length&&(i[c].indent=a);i.length==l+1&&(i[l].single=!0)}if(t!=2&&i.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:c,single:h}of i)(h||!c)&&s.push({from:l.from+u,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let u=o.from+l,c=u+a.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const Ud=$n.define(),R3=$n.define(),I3=Z.define(),Vk=Z.define({combine(t){return AS(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(i,r)=>e(i,r)||n(i,r)})}}),Hk=li.define({create(){return Pn.empty},update(t,e){let n=e.state.facet(Vk),i=e.annotation(Ud);if(i){let a=vt.fromTransaction(e,i.selection),u=i.side,c=u==0?t.undone:t.done;return a?c=nc(c,c.length,n.minDepth,a):c=Kk(c,e.startState.selection),new Pn(u==0?i.rest:c,u==0?c:i.rest)}let r=e.annotation(R3);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(Fe.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=vt.fromTransaction(e),o=e.annotation(Fe.time),l=e.annotation(Fe.userEvent);return s?t=t.addChanges(s,o,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,n.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 Pn(t.done.map(vt.fromJSON),t.undone.map(vt.fromJSON))}});function D3(t={}){return[Hk,Vk.of(t),ee.domEventHandlers({beforeinput(e,n){let i=e.inputType=="historyUndo"?Wk:e.inputType=="historyRedo"?Kd:null;return i?(e.preventDefault(),i(n)):!1}})]}function Bc(t,e){return function({state:n,dispatch:i}){if(!e&&n.readOnly)return!1;let r=n.field(Hk,!1);if(!r)return!1;let s=r.pop(t,n,e);return s?(i(s),!0):!1}}const Wk=Bc(0,!1),Kd=Bc(1,!1),L3=Bc(0,!0),B3=Bc(1,!0);class vt{constructor(e,n,i,r,s){this.changes=e,this.effects=n,this.mapped=i,this.startSelection=r,this.selectionsAfter=s}setSelAfter(e){return new vt(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new vt(e.changes&&ze.fromJSON(e.changes),[],e.mapped&&Ln.fromJSON(e.mapped),e.startSelection&&V.fromJSON(e.startSelection),e.selectionsAfter.map(V.fromJSON))}static fromTransaction(e,n){let i=Wt;for(let r of e.startState.facet(I3)){let s=r(e);s.length&&(i=i.concat(s))}return!i.length&&e.changes.empty?null:new vt(e.changes.invert(e.startState.doc),i,void 0,n||e.startState.selection,Wt)}static selection(e){return new vt(void 0,Wt,void 0,void 0,e)}}function nc(t,e,n,i){let r=e+1>n+20?e-n-1:0,s=t.slice(r,e);return s.push(i),s}function z3(t,e){let n=[],i=!1;return t.iterChangedRanges((r,s)=>n.push(r,s)),e.iterChangedRanges((r,s,o,l)=>{for(let a=0;a<n.length;){let u=n[a++],c=n[a++];l>=u&&o<=c&&(i=!0)}}),i}function $3(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,i)=>n.empty!=e.ranges[i].empty).length===0}function Uk(t,e){return t.length?e.length?t.concat(e):t:e}const Wt=[],F3=200;function Kk(t,e){if(t.length){let n=t[t.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-F3));return i.length&&i[i.length-1].eq(e)?t:(i.push(e),nc(t,t.length-1,1e9,n.setSelAfter(i)))}else return[vt.selection([e])]}function j3(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Yh(t,e){if(!t.length)return t;let n=t.length,i=Wt;for(;n;){let r=V3(t[n-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let s=t.slice(0,n);return s[n-1]=r,s}else e=r.mapped,n--,i=r.selectionsAfter}return i.length?[vt.selection(i)]:Wt}function V3(t,e,n){let i=Uk(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):Wt,n);if(!t.changes)return vt.selection(i);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new vt(r,me.mapEffects(t.effects,e),o,t.startSelection.map(s),i)}const H3=/^(input\.type|delete)($|\.)/;class Pn{constructor(e,n,i=0,r=void 0){this.done=e,this.undone=n,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new Pn(this.done,this.undone):this}addChanges(e,n,i,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||H3.test(i))&&(!l.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(s,z3(l.changes,e.changes))||i=="input.type.compose")?o=nc(o,o.length-1,r.minDepth,new vt(e.changes.compose(l.changes),Uk(me.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Wt)):o=nc(o,o.length,r.minDepth,e),new Pn(o,Wt,n,i)}addSelection(e,n,i,r){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Wt;return s.length>0&&n-this.prevTime<r&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&$3(s[s.length-1],e)?this:new Pn(Kk(this.done,e),this.undone,n,i)}addMapping(e){return new Pn(Yh(this.done,e),Yh(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,i){let r=e==0?this.done:this.undone;if(r.length==0)return null;let s=r[r.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):n.selection);if(i&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Ud.of({side:e,rest:j3(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=r.length==1?Wt:r.slice(0,r.length-1);return s.mapped&&(l=Yh(l,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Ud.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Pn.empty=new Pn(Wt,Wt);const W3=[{key:"Mod-z",run:Wk,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Kd,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Kd,preventDefault:!0},{key:"Mod-u",run:L3,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:B3,preventDefault:!0}];function qs(t,e){return V.create(t.ranges.map(e),t.mainIndex)}function yn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function vn({state:t,dispatch:e},n){let i=qs(t.selection,n);return i.eq(t.selection,!0)?!1:(e(yn(t,i)),!0)}function zc(t,e){return V.cursor(e?t.to:t.from)}function qk(t,e){return vn(t,n=>n.empty?t.moveByChar(n,e):zc(n,e))}function rt(t){return t.textDirectionAt(t.state.selection.main.head)==Te.LTR}const Yk=t=>qk(t,!rt(t)),Qk=t=>qk(t,rt(t));function Xk(t,e){return vn(t,n=>n.empty?t.moveByGroup(n,e):zc(n,e))}const U3=t=>Xk(t,!rt(t)),K3=t=>Xk(t,rt(t));function q3(t,e,n){if(e.type.prop(n))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function $c(t,e,n){let i=Xt(t).resolveInner(e.head),r=n?re.closedBy:re.openedBy;for(let a=e.head;;){let u=n?i.childAfter(a):i.childBefore(a);if(!u)break;q3(t,u,r)?i=u:a=n?u.to:u.from}let s=i.type.prop(r),o,l;return s&&(o=n?ss(t,i.from,1):ss(t,i.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?i.to:i.from,V.cursor(l,n?-1:1)}const Y3=t=>vn(t,e=>$c(t.state,e,!rt(t))),Q3=t=>vn(t,e=>$c(t.state,e,rt(t)));function Gk(t,e){return vn(t,n=>{if(!n.empty)return zc(n,e);let i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)})}const Jk=t=>Gk(t,!1),Zk=t=>Gk(t,!0);function eb(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,i=0,r;if(e){for(let s of t.state.facet(ee.scrollMargins)){let o=s(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(i=Math.max(o==null?void 0:o.bottom,i))}r=t.scrollDOM.clientHeight-n-i}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:i,selfScroll:e,height:Math.max(t.defaultLineHeight,r-5)}}function tb(t,e){let n=eb(t),{state:i}=t,r=qs(i.selection,o=>o.empty?t.moveVertically(o,e,n.height):zc(o,e));if(r.eq(i.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(i.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottom<u&&(s=ee.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-a}))}return t.dispatch(yn(i,r),{effects:s}),!0}const ov=t=>tb(t,!1),qd=t=>tb(t,!0);function Ui(t,e,n){let i=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?i.to:i.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==i.from&&i.length){let s=/^\s*/.exec(t.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;s&&e.head!=i.from+s&&(r=V.cursor(i.from+s))}return r}const X3=t=>vn(t,e=>Ui(t,e,!0)),G3=t=>vn(t,e=>Ui(t,e,!1)),J3=t=>vn(t,e=>Ui(t,e,!rt(t))),Z3=t=>vn(t,e=>Ui(t,e,rt(t))),eL=t=>vn(t,e=>V.cursor(t.lineBlockAt(e.head).from,1)),tL=t=>vn(t,e=>V.cursor(t.lineBlockAt(e.head).to,-1));function nL(t,e,n){let i=!1,r=qs(t.selection,s=>{let o=ss(t,s.head,-1)||ss(t,s.head,1)||s.head>0&&ss(t,s.head-1,1)||s.head<t.doc.length&&ss(t,s.head+1,-1);if(!o||!o.end)return s;i=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return V.cursor(l)});return i?(e(yn(t,r)),!0):!1}const iL=({state:t,dispatch:e})=>nL(t,e);function Gt(t,e,n){let i=qs(t.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=e&&(r=V.range(r.head,r.anchor));let s=n(r);return V.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return i.eq(t.state.selection)?!1:(t.dispatch(yn(t.state,i)),!0)}function nb(t,e){return Gt(t,e,n=>t.moveByChar(n,e))}const ib=t=>nb(t,!rt(t)),rb=t=>nb(t,rt(t));function sb(t,e){return Gt(t,e,n=>t.moveByGroup(n,e))}const rL=t=>sb(t,!rt(t)),sL=t=>sb(t,rt(t)),oL=t=>{let e=!rt(t);return Gt(t,e,n=>$c(t.state,n,e))},lL=t=>{let e=rt(t);return Gt(t,e,n=>$c(t.state,n,e))};function ob(t,e){return Gt(t,e,n=>t.moveVertically(n,e))}const lb=t=>ob(t,!1),ab=t=>ob(t,!0);function ub(t,e){return Gt(t,e,n=>t.moveVertically(n,e,eb(t).height))}const lv=t=>ub(t,!1),av=t=>ub(t,!0),aL=t=>Gt(t,!0,e=>Ui(t,e,!0)),uL=t=>Gt(t,!1,e=>Ui(t,e,!1)),cL=t=>{let e=!rt(t);return Gt(t,e,n=>Ui(t,n,e))},hL=t=>{let e=rt(t);return Gt(t,e,n=>Ui(t,n,e))},fL=t=>Gt(t,!1,e=>V.cursor(t.lineBlockAt(e.head).from)),dL=t=>Gt(t,!0,e=>V.cursor(t.lineBlockAt(e.head).to)),uv=({state:t,dispatch:e})=>(e(yn(t,{anchor:0})),!0),cv=({state:t,dispatch:e})=>(e(yn(t,{anchor:t.doc.length})),!0),hv=({state:t,dispatch:e})=>(e(yn(t,{anchor:t.selection.main.anchor,head:0})),!0),fv=({state:t,dispatch:e})=>(e(yn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),pL=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),mL=({state:t,dispatch:e})=>{let n=Fc(t).map(({from:i,to:r})=>V.undirectionalRange(i,Math.min(r+1,t.doc.length)));return e(t.update({selection:V.create(n),userEvent:"select"})),!0},gL=({state:t,dispatch:e})=>{let n=qs(t.selection,i=>{let r=Xt(t),s=r.resolveStack(i.from,1);if(i.empty){let o=r.resolveStack(i.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return V.undirectionalRange(l.from,l.to)}return i});return n.eq(t.selection)?!1:(e(yn(t,n)),!0)};function cb(t,e){let{state:n}=t,i=n.selection,r=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let l=s;;){let a=t.moveVertically(l,e);if(a.head<o.from||a.head>o.to){r.some(u=>u.head==a.head)||r.push(a);break}else{if(a.head==l.head)break;l=a}}}return r.length==i.ranges.length?!1:(t.dispatch(yn(n,V.create(r,r.length-1))),!0)}const yL=t=>cb(t,!1),vL=t=>cb(t,!0),wL=({state:t,dispatch:e})=>{let n=t.selection,i=null;return n.ranges.length>1?i=V.create([n.main]):n.main.empty||(i=V.create([V.cursor(n.main.head)])),i?(e(yn(t,i)),!0):!1};function Fl(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:i}=t,r=i.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(n="delete.backward",a=Oa(t,a,!1)):a>o&&(n="delete.forward",a=Oa(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Oa(t,o,!1),l=Oa(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:V.cursor(o,o<s.head?-1:1)}});return r.changes.empty?!1:(t.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?ee.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Oa(t,e,n){if(t instanceof ee)for(let i of t.state.facet(ee.atomicRanges).map(r=>r(t)))i.between(e,e,(r,s)=>{r<e&&s>e&&(e=n?s:r)});return e}const hb=(t,e,n)=>Fl(t,i=>{let r=i.from,{state:s}=t,o=s.doc.lineAt(r),l,a;if(n&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,r-o.from))){if(l[l.length-1]==" ")return r-1;let u=Tc(l,s.tabSize),c=u%Ju(s)||Ju(s);for(let h=0;h<c&&l[l.length-1-h]==" ";h++)r--;a=r}else a=tt(o.text,r-o.from,e,e)+o.from,a==r&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,r-o.from))&&(a=tt(o.text,a-o.from,!1,!1)+o.from);return a}),Yd=t=>hb(t,!1,!0),fb=t=>hb(t,!0,!1),db=(t,e)=>Fl(t,n=>{let i=n.head,{state:r}=t,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let l=null;;){if(i==(e?s.to:s.from)){i==n.head&&s.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let a=tt(s.text,i-s.from,e)+s.from,u=s.text.slice(Math.min(i,a)-s.from,Math.max(i,a)-s.from),c=o(u);if(l!=null&&c!=l)break;(u!=" "||i!=n.head)&&(l=c),i=a}return i}),pb=t=>db(t,!1),xL=t=>db(t,!0),SL=t=>Fl(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),kL=t=>Fl(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),bL=t=>Fl(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),CL=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:oe.of(["",""])},range:V.cursor(i.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},EL=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(i=>{if(!i.empty||i.from==0||i.from==t.doc.length)return{range:i};let r=i.from,s=t.doc.lineAt(r),o=r==s.from?r-1:tt(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:tt(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(r,l).append(t.doc.slice(o,r))},range:V.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Fc(t){let e=[],n=-1;for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),s=t.doc.lineAt(i.to);if(!i.empty&&i.to==s.from&&(s=t.doc.lineAt(i.to-1)),n>=r.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(i)}else e.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return e}function mb(t,e,n){if(t.readOnly)return!1;let i=[],r=[];for(let s of Fc(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){i.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)r.push(V.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{i.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)r.push(V.range(a.anchor-l,a.head-l))}}return i.length?(e(t.update({changes:i,scrollIntoView:!0,selection:V.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const AL=({state:t,dispatch:e})=>mb(t,e,!1),NL=({state:t,dispatch:e})=>mb(t,e,!0);function gb(t,e,n){if(t.readOnly)return!1;let i=[];for(let s of Fc(t))n?i.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):i.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let r=t.changes(i);return e(t.update({changes:r,selection:t.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const _L=({state:t,dispatch:e})=>gb(t,e,!1),TL=({state:t,dispatch:e})=>gb(t,e,!0),ML=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Fc(e).map(({from:r,to:s})=>(r>0?r--:s<e.doc.length&&s++,{from:r,to:s}))),i=qs(e.selection,r=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(r.head),l=t.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,s)}).map(n);return t.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function OL(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Xt(t).resolveInner(e),i=n.childBefore(e),r=n.childAfter(e),s;return i&&r&&i.to<=e&&r.from>=e&&(s=i.type.prop(re.closedBy))&&s.indexOf(r.name)>-1&&t.doc.lineAt(i.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const dv=yb(!1),PL=yb(!0);function yb(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:s,to:o}=r,l=e.doc.lineAt(s),a=!t&&s==o&&OL(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new Dc(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=Rk(u,s);for(c==null&&(c=Tc(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let h=["",Zu(e,c)];return a&&h.push(Zu(e,u.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:oe.of(h)},range:V.cursor(s+1+h[1].length)}});return n(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function zm(t,e){let n=-1;return t.changeByRange(i=>{let r=[];for(let o=i.from;o<=i.to;){let l=t.doc.lineAt(o);l.number>n&&(i.empty||i.to>l.from)&&(e(l,r,i),n=l.number),o=l.to+1}let s=t.changes(r);return{changes:r,range:V.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const RL=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),i=new Dc(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),r=zm(t,(s,o,l)=>{let a=Rk(i,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],c=Zu(t,a);(u!=c||l.from<s.from+u.length)&&(n[s.from]=a,o.push({from:s.from,to:s.from+u.length,insert:c}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},IL=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(zm(t,(n,i)=>{i.push({from:n.from,insert:t.facet(Om)})}),{userEvent:"input.indent"})),!0),DL=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(zm(t,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let s=Tc(r,t.tabSize),o=0,l=Zu(t,Math.max(0,s-Ju(t)));for(;o<r.length&&o<l.length&&r.charCodeAt(o)==l.charCodeAt(o);)o++;i.push({from:n.from+o,to:n.from+r.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),LL=t=>(t.setTabFocusMode(),!0),BL=[{key:"Ctrl-b",run:Yk,shift:ib,preventDefault:!0},{key:"Ctrl-f",run:Qk,shift:rb},{key:"Ctrl-p",run:Jk,shift:lb},{key:"Ctrl-n",run:Zk,shift:ab},{key:"Ctrl-a",run:eL,shift:fL},{key:"Ctrl-e",run:tL,shift:dL},{key:"Ctrl-d",run:fb},{key:"Ctrl-h",run:Yd},{key:"Ctrl-k",run:SL},{key:"Ctrl-Alt-h",run:pb},{key:"Ctrl-o",run:CL},{key:"Ctrl-t",run:EL},{key:"Ctrl-v",run:qd}],zL=[{key:"ArrowLeft",run:Yk,shift:ib,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:U3,shift:rL,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:J3,shift:cL,preventDefault:!0},{key:"ArrowRight",run:Qk,shift:rb,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:K3,shift:sL,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Z3,shift:hL,preventDefault:!0},{key:"ArrowUp",run:Jk,shift:lb,preventDefault:!0},{mac:"Cmd-ArrowUp",run:uv,shift:hv},{mac:"Ctrl-ArrowUp",run:ov,shift:lv},{key:"ArrowDown",run:Zk,shift:ab,preventDefault:!0},{mac:"Cmd-ArrowDown",run:cv,shift:fv},{mac:"Ctrl-ArrowDown",run:qd,shift:av},{key:"PageUp",run:ov,shift:lv},{key:"PageDown",run:qd,shift:av},{key:"Home",run:G3,shift:uL,preventDefault:!0},{key:"Mod-Home",run:uv,shift:hv},{key:"End",run:X3,shift:aL,preventDefault:!0},{key:"Mod-End",run:cv,shift:fv},{key:"Enter",run:dv,shift:dv},{key:"Mod-a",run:pL},{key:"Backspace",run:Yd,shift:Yd,preventDefault:!0},{key:"Delete",run:fb,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:pb,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:xL,preventDefault:!0},{mac:"Mod-Backspace",run:kL,preventDefault:!0},{mac:"Mod-Delete",run:bL,preventDefault:!0}].concat(BL.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),$L=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Y3,shift:oL},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Q3,shift:lL},{key:"Alt-ArrowUp",run:AL},{key:"Shift-Alt-ArrowUp",run:_L},{key:"Alt-ArrowDown",run:NL},{key:"Shift-Alt-ArrowDown",run:TL},{key:"Mod-Alt-ArrowUp",run:yL},{key:"Mod-Alt-ArrowDown",run:vL},{key:"Escape",run:wL},{key:"Mod-Enter",run:PL},{key:"Alt-l",mac:"Ctrl-l",run:mL},{key:"Mod-i",run:gL,preventDefault:!0},{key:"Mod-[",run:DL},{key:"Mod-]",run:IL},{key:"Mod-Alt-\\",run:RL},{key:"Shift-Mod-k",run:ML},{key:"Shift-Mod-\\",run:iL},{key:"Mod-/",run:A3},{key:"Alt-A",mac:"Ctrl-A",run:_3},{key:"Ctrl-m",mac:"Shift-Alt-m",run:LL}].concat(zL);function vb({title:t,onClose:e,children:n,headerExtra:i}){return M.useEffect(()=>{const r=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e]),b.jsx("div",{className:"modal__backdrop",onClick:e,children:b.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":t,onClick:r=>r.stopPropagation(),children:[b.jsxs("div",{className:"modal__header",children:[b.jsx("span",{className:"modal__title",children:t}),i,b.jsx("button",{type:"button",className:"modal__close",onClick:e,"aria-label":"Close",children:"×"})]}),b.jsx("div",{className:"modal__body",children:n})]})})}const pv={response_body:"Response → Body Attribute",response_raw:"Response → Raw Body",response_header:"Response → Header"};function mv({ancestorNodes:t,nodeLabels:e,initialType:n,initialTag:i,onConfirm:r,onDelete:s,onCancel:o}){var w;const l=Mr(k=>k.runResult),[a,u]=M.useState((i==null?void 0:i.type)??n),c=i?t.some(k=>k.id===i.sourceNodeId):!0,[h,f]=M.useState(i?c?i.sourceNodeId:"":((w=t[0])==null?void 0:w.id)??""),[d,p]=M.useState((i==null?void 0:i.jsonPath)??""),[y,x]=M.useState((i==null?void 0:i.headerName)??""),m=!!h&&(a!=="response_header"||y.trim().length>0);function g(){if(!h)return"Select a request first.";const k=l==null?void 0:l.steps.find(E=>E.nodeId===h);if(!k||!k.response)return"No prior run captured for this node yet — run the chain once to preview.";if(a==="response_header"){const E=Fw(k.response.headers,y);return E===void 0?`(no "${y}" header in the last response)`:E}const C=a==="response_raw"?k.response.body:$w(k.response.body,d);return JSON.stringify(C,null,2)??"undefined"}function v(){if(!m)return;const k={id:(i==null?void 0:i.id)??Au(),type:a,sourceNodeId:h,jsonPath:a==="response_body"&&d.trim()||void 0,headerName:a==="response_header"?y.trim():void 0};r(k)}return b.jsxs(vb,{title:i?"Edit mapping":"Insert response mapping",onClose:o,children:[b.jsxs("label",{className:"tag-config-modal__field",children:["Map",b.jsx("select",{value:a,onChange:k=>u(k.target.value),children:Object.keys(pv).map(k=>b.jsx("option",{value:k,children:pv[k]},k))})]}),b.jsxs("label",{className:"tag-config-modal__field",children:["Request",t.length===0?b.jsx("p",{className:"node-inspector__hint",children:"No upstream nodes reachable from here yet — connect this node from another on the canvas first."}):b.jsxs("select",{value:h,onChange:k=>f(k.target.value),children:[b.jsx("option",{value:"",disabled:!0,children:i&&!c?"-- Original request no longer exists — pick a new one --":"-- Select request --"}),t.map(k=>b.jsx("option",{value:k.id,children:e.get(k.id)},k.id))]})]}),a==="response_body"&&b.jsxs("label",{className:"tag-config-modal__field",children:["Filter (JSONPath)",b.jsx("input",{type:"text",placeholder:"e.g. $.items[0].id (blank = whole body)",value:d,onChange:k=>p(k.target.value)})]}),a==="response_header"&&b.jsxs("label",{className:"tag-config-modal__field",children:["Header name",b.jsx("input",{type:"text",placeholder:"e.g. x-trace-id",value:y,onChange:k=>x(k.target.value)})]}),b.jsxs("div",{className:"tag-config-modal__preview",children:[b.jsx("span",{className:"tag-config-modal__preview-label",children:"Live Preview"}),b.jsx("pre",{children:g()})]}),b.jsxs("div",{className:"tag-config-modal__actions",children:[i&&s&&b.jsx("button",{type:"button",className:"tag-config-modal__delete",onClick:s,children:"Remove mapping"}),b.jsx("button",{type:"button",onClick:o,children:"Cancel"}),b.jsx("button",{type:"button",disabled:!m,onClick:v,children:i?"Save":"Insert"})]})]})}const FL=Lc.define([{tag:X.propertyName,color:"var(--color-get)"},{tag:X.string,color:"var(--color-post)"},{tag:[X.number,X.bool],color:"var(--color-put)"},{tag:X.null,color:"var(--color-popup)"},{tag:[X.separator,X.squareBracket,X.brace],color:"var(--color-text-muted)"}]),Pa=$n.define(),wb=me.define();function jL(t,e,n){const i=e.has(t.sourceNodeId)?n.get(t.sourceNodeId):"(missing)";return t.type==="response_header"?`${i} → header ${t.headerName??""}`:t.type==="response_raw"?`${i} → raw body`:`${i} → ${t.jsonPath||"body"}`}class gv extends Ll{constructor(e,n,i,r){super(),this.tagId=e,this.label=n,this.broken=i,this.onClick=r}eq(e){return e.tagId===this.tagId&&e.label===this.label&&e.broken===this.broken}toDOM(){const e=document.createElement("span");return e.className=this.broken?"tag-chip tag-chip--broken":"tag-chip",e.textContent=this.label,this.onClick?(e.title=this.broken?"This mapping's source node no longer exists — click to fix or remove it":"Click to edit this mapping",e.addEventListener("mousedown",n=>n.preventDefault()),e.addEventListener("click",n=>{n.stopPropagation(),this.onClick(this.tagId)})):(e.title="Unrecognized tag reference — no mapping is configured for this",e.style.cursor="default"),e}ignoreEvent(){return!0}}function yv(t,e){const n=[];for(const i of t.matchAll(Ol())){const r=i[1],s=e.tags[r],o=i.index??0,l=o+i[0].length;if(!s){n.push(Me.replace({widget:new gv(r,"Unrecognized tag",!0,null)}).range(o,l));continue}const a=!e.nodesById.has(s.sourceNodeId),u=jL(s,e.nodesById,e.nodeLabels);n.push(Me.replace({widget:new gv(r,u,a,e.onClickChip)}).range(o,l))}return Me.set(n)}function VL(t){return Bn.fromClass(class{constructor(e){Hm(this,"decorations");this.decorations=yv(e.state.doc.toString(),t.current)}update(e){const n=e.transactions.some(i=>i.effects.some(r=>r.is(wb)));(e.docChanged||n)&&(this.decorations=yv(e.state.doc.toString(),t.current))}},{decorations:e=>e.decorations})}function HL(t){return e=>{const n=e.matchBefore(/\{\{\w*/);return!n||Xt(e.state).resolveInner(n.from,-1).name!=="String"?null:{from:n.from,to:n.to,filter:!1,options:[{label:"Response → Map from...",apply:(r,s,o,l)=>t("response_body",o,l)}]}}}function WL(t){return[QD(),BD(FL),D3(),Am.of([...$L,...W3]),b3({override:[HL(t)]}),ee.lineWrapping,ee.theme({},{dark:!0}),UI({parent:document.body})]}function UL({rawBody:t,onChange:e,ancestorNodes:n,nodeLabels:i}){const r=M.useRef(null),s=M.useRef(null),o=M.useRef(null),l=M.useRef({rawBody:t,onChange:e});l.current={rawBody:t,onChange:e};const[a,u]=M.useState(null),[c,h]=M.useState(null),f=new Map(n.map(g=>[g.id,g]));o.current={tags:t.tags,nodesById:f,nodeLabels:i,onClickChip:g=>h(g)},M.useEffect(()=>{if(!r.current)return;const g=ee.updateListener.of(C=>{if(!C.docChanged||C.transactions.some(L=>L.annotation(Pa)))return;const E=C.state.doc.toString(),_=new Set([...E.matchAll(Ol())].map(L=>L[1])),D=Object.fromEntries(Object.entries(l.current.rawBody.tags).filter(([L])=>_.has(L)));l.current.onChange({template:E,tags:D})}),v=VL(o),w=[...WL((C,E,_)=>u({type:C,from:E,to:_})),v,ee.atomicRanges.of(C=>{var E;return((E=C.plugin(v))==null?void 0:E.decorations)??Me.none}),g],k=new ee({doc:l.current.rawBody.template,extensions:w,parent:r.current});return s.current=k,()=>k.destroy()},[]),M.useEffect(()=>{const g=s.current;g&&g.state.doc.toString()!==t.template&&g.dispatch({changes:{from:0,to:g.state.doc.length,insert:t.template},annotations:Pa.of(!0)})},[t.template]),M.useEffect(()=>{var g;(g=s.current)==null||g.dispatch({effects:wb.of()})},[t.tags]);function d(g){const v=s.current;if(!v||!a)return;const w=v.state.doc.length,k=Math.min(a.from,w),C=Math.min(Math.max(a.to,k),w);v.dispatch({changes:{from:k,to:C,insert:zw(g.id)},annotations:Pa.of(!0)}),e({template:v.state.doc.toString(),tags:{...t.tags,[g.id]:g}}),u(null)}function p(g,v){const w=new RegExp(`\\{\\{enlace:${v}\\}\\}`).exec(g);return w?{from:w.index,to:w.index+w[0].length}:null}function y(g){e({template:t.template,tags:{...t.tags,[g.id]:g}}),h(null)}function x(){const g=s.current;if(!g||!c)return;const v=p(g.state.doc.toString(),c);v&&g.dispatch({changes:{from:v.from,to:v.to,insert:""},annotations:Pa.of(!0)});const w={...t.tags};delete w[c],e({template:g.state.doc.toString(),tags:w}),h(null)}const m=c?t.tags[c]:void 0;return b.jsxs("div",{className:"raw-body-editor",children:[b.jsxs("div",{className:"raw-body-editor__hint",children:["Type ",b.jsx("code",{children:"{{"})," inside a string to map a value from an upstream response."]}),b.jsx("div",{className:"raw-body-editor__codemirror",ref:r}),a&&b.jsx(mv,{ancestorNodes:n,nodeLabels:i,initialType:a.type,onConfirm:d,onCancel:()=>u(null)}),m&&b.jsx(mv,{ancestorNodes:n,nodeLabels:i,initialType:m.type,initialTag:m,onConfirm:y,onDelete:x,onCancel:()=>h(null)})]})}function KL({onCollapse:t}){const{nodes:e,connections:n,operations:i,selectedNodeId:r,credentials:s,setCredential:o,setFieldValue:l,mergeFieldValues:a,setBodyMode:u,setRawBody:c}=Mr(),h=e.find(A=>A.id===r),f=i.find(A=>A.id===(h==null?void 0:h.operationId)),d=M.useMemo(()=>new Map(i.map(A=>[A.id,A])),[i]),p=M.useMemo(()=>f?lS(f):[],[f]),y=M.useMemo(()=>p.filter(A=>!A.path.startsWith("body.")),[p]),x=M.useMemo(()=>p.filter(A=>A.path.startsWith("body.")),[p]),[m,g]=M.useState(null),[v,w]=M.useState(null),k=M.useMemo(()=>{if(!h)return[];const A=vA(e,n,h.id);return e.filter(S=>A.has(S.id))},[e,n,h]),C=M.useMemo(()=>sS(e,d),[e,d]),E=b.jsx("button",{type:"button",className:"pane-collapse-btn",onClick:t,title:"Hide inspector","aria-label":"Hide inspector",children:"›"});if(!h||!f)return b.jsxs("aside",{className:"node-inspector node-inspector--empty",children:[b.jsxs("div",{className:"node-inspector__topbar",children:[b.jsx("span",{children:"Inspector"}),E]}),b.jsx("p",{children:"Select a node to configure it."})]});const _=h.bodyMode??"form";function D(){!h||!f||(g(null),c(h.id,_P(f,h.fieldValues)),u(h.id,"raw"))}function L(){if(!h||!f)return;if(g(null),!h.rawBody){u(h.id,"form");return}const A=TP(h.rawBody,f);if(A.parseError){g(`Can't switch to Form view — the Raw JSON isn't valid: ${A.parseError}`);return}if(A.lossy){w(A.fieldValues);return}a(h.id,A.fieldValues),u(h.id,"form")}function B(){!h||!v||(a(h.id,v),u(h.id,"form"),w(null))}function P(A){const S=h.fieldValues[A.path],I=(S==null?void 0:S.source)==="mapped",O=!A.supported,j=I?k.find(T=>T.id===S.fromNodeId):void 0,R=j?i.find(T=>T.id===j.operationId):void 0,N=R?kP(R):[];return b.jsxs("div",{className:`node-inspector__field${O?" node-inspector__field--disabled":""}`,title:A.reason,children:[b.jsxs("label",{children:[A.path,A.required?" *":"",A.type?` (${A.type})`:"",O?" (unsupported)":""]}),b.jsx("div",{className:"node-inspector__field-row",children:b.jsxs("select",{disabled:O,value:I?"mapped":"static",onChange:T=>{T.target.value==="static"?l(h.id,A.path,{source:"static",value:""}):k[0]&&l(h.id,A.path,{source:"mapped",fromNodeId:k[0].id,fromResponseFieldPath:""})},children:[b.jsx("option",{value:"static",children:"Static value"}),b.jsx("option",{value:"mapped",disabled:k.length===0,children:"Map from..."})]})}),!I&&b.jsx("div",{className:"node-inspector__field-row",children:A.type==="array"?b.jsx("textarea",{rows:3,disabled:O,placeholder:A.reason,title:A.reason,value:(S==null?void 0:S.source)==="static"?typeof S.value=="string"?S.value:JSON.stringify(S.value,null,2):"",onChange:T=>l(h.id,A.path,{source:"static",value:Nh(T.target.value,A.type)})}):A.enum?b.jsxs("select",{disabled:O,value:(S==null?void 0:S.source)==="static"?String(S.value??""):"",onChange:T=>l(h.id,A.path,{source:"static",value:Nh(T.target.value,A.type)}),children:[b.jsx("option",{value:"",children:"Select..."}),A.enum.map(T=>b.jsx("option",{value:String(T),children:String(T)},String(T)))]}):b.jsx("input",{type:"text",disabled:O,value:(S==null?void 0:S.source)==="static"?String(S.value??""):"",onChange:T=>l(h.id,A.path,{source:"static",value:Nh(T.target.value,A.type)})})}),I&&b.jsxs("div",{className:"node-inspector__field-row node-inspector__field-row--mapped",children:[b.jsx("select",{disabled:O,value:S.fromNodeId,onChange:T=>l(h.id,A.path,{...S,fromNodeId:T.target.value}),children:k.map(T=>b.jsx("option",{value:T.id,children:C.get(T.id)},T.id))}),b.jsxs("select",{disabled:O,value:S.fromResponseFieldPath,onChange:T=>l(h.id,A.path,{...S,fromResponseFieldPath:T.target.value}),children:[b.jsx("option",{value:"",children:"Select field..."}),N.map(T=>{const z=T.supported&&!bP(A.type,T.type),$=!T.supported||z,W=T.supported?z?`Type mismatch: "${A.path}" expects ${A.type}, this field is ${T.type}.`:void 0:T.reason;return b.jsxs("option",{value:T.path,disabled:$,title:W,children:[T.path,T.supported?z?" (type mismatch)":"":" (unsupported)"]},T.path)})]})]})]},A.path)}return b.jsxs("aside",{className:"node-inspector",children:[b.jsxs("div",{className:"node-inspector__topbar",children:[b.jsx("span",{children:"Inspector"}),E]}),b.jsx("h2",{children:f.id}),b.jsxs("label",{className:"node-inspector__field",children:["Credential",b.jsxs("select",{value:h.credentialId??"",onChange:A=>o(h.id,A.target.value||null),children:[b.jsx("option",{value:"",children:"None"}),s.map(A=>b.jsx("option",{value:A.id,children:A.name},A.id))]})]}),b.jsx("h3",{children:"Request fields"}),k.length===0&&(y.length>0||_==="form")&&b.jsx("p",{className:"node-inspector__hint",children:'Connect this node from another on the canvas (drag box to box) to enable "Map from...".'}),y.map(P),f.requestBodySchema&&b.jsxs("div",{className:"node-inspector__body",children:[b.jsxs("div",{className:"node-inspector__body-header",children:[b.jsx("span",{className:"node-inspector__body-title",children:"Body"}),b.jsxs("label",{className:"body-mode-switch",children:[b.jsx("span",{className:"body-mode-switch__label",children:_==="raw"?"Raw JSON":"Form"}),b.jsx("input",{type:"checkbox",checked:_==="raw",onChange:A=>A.target.checked?D():L(),"aria-label":_==="raw"?"Switch to Form view":"Switch to Raw JSON view"}),b.jsx("span",{className:"body-mode-switch__track",children:b.jsx("span",{className:"body-mode-switch__thumb"})})]})]}),_==="form"&&ld(f.requestBodySchema)?b.jsxs("p",{className:"node-inspector__banner",children:["This body has a shape the form can't fully represent (arrays of objects or polymorphic fields)."," ",b.jsx("button",{type:"button",onClick:D,children:"Switch to Raw JSON"})]}):_==="form"&&b.jsx("p",{className:"node-inspector__hint",children:"Switch to Raw JSON to write the body directly and map values into any nested field."}),m&&b.jsx("p",{className:"node-inspector__error",children:m}),_==="form"?x.map(P):h.rawBody?b.jsx(UL,{rawBody:h.rawBody,onChange:A=>c(h.id,A),ancestorNodes:k,nodeLabels:C}):null]}),v&&b.jsxs(vb,{title:"Switch to Form view?",onClose:()=>w(null),children:[b.jsx("p",{children:"Switching to Form view may lose custom JSON structure — continue?"}),b.jsxs("div",{className:"tag-config-modal__actions",children:[b.jsx("button",{type:"button",onClick:()=>w(null),children:"Cancel"}),b.jsx("button",{type:"button",onClick:B,children:"Switch anyway"})]})]})]})}function xb(t,e){if(!e||e.length===0)return t;try{const n=new URL(t);for(const i of e)n.searchParams.has(i)&&n.searchParams.set(i,"[redacted]");return n.toString()}catch{return t}}function qL(t){return{...t,url:xb(t.url,t.redactQueryParams),headers:Object.fromEntries(Object.entries(t.headers).map(([e,n])=>e.toLowerCase()==="authorization"?[e,"[redacted]"]:[e,n]))}}function YL(t){if(t==null)return null;if(typeof t=="string")return t;try{return JSON.stringify(t,null,2)}catch{return String(t)}}function Sb({headers:t}){const e=Object.entries(t);return b.jsxs("details",{className:"debug-headers",children:[b.jsxs("summary",{className:"debug-headers__summary",children:["Headers (",e.length,")"]}),e.length===0?b.jsx("p",{className:"debug-headers__empty",children:"None"}):b.jsx("table",{className:"debug-headers__table",children:b.jsx("tbody",{children:e.map(([n,i])=>b.jsxs("tr",{children:[b.jsx("th",{children:n}),b.jsx("td",{children:i})]},n))})})]})}function kb({value:t}){const e=YL(t);return b.jsxs("div",{className:"debug-body",children:[b.jsx("div",{className:"debug-body__label",children:"Body"}),e===null?b.jsx("p",{className:"debug-body__empty",children:"No body"}):b.jsx("pre",{className:"debug-body__pre",children:e})]})}function QL({request:t}){return b.jsxs("div",{className:"debug-step__panel",children:[b.jsxs("div",{className:"debug-step__panel-title",children:["Request",t.credentials==="include"&&b.jsx("span",{className:"debug-step__credentials-chip",children:"credentials: include"})]}),b.jsx(Sb,{headers:t.headers}),b.jsx(kb,{value:t.body})]})}function XL({response:t,error:e}){return t?b.jsxs("div",{className:"debug-step__panel",children:[b.jsxs("div",{className:"debug-step__panel-title",children:["Response",b.jsx("span",{className:`status-badge ${t.status<400?"status-badge--ok":"status-badge--error"}`,children:t.status})]}),b.jsx(Sb,{headers:t.headers}),b.jsx(kb,{value:t.body})]}):b.jsxs("div",{className:"debug-step__panel",children:[b.jsx("div",{className:"debug-step__panel-title",children:"Response"}),b.jsx("p",{className:"debug-step__panel-empty",children:e??"No response"})]})}function GL({collapsed:t,onToggleCollapsed:e}){const{runResult:n,isRunning:i,error:r}=Mr();return b.jsxs("div",{className:`debug-pane${t?" debug-pane--collapsed":""}`,children:[b.jsxs("div",{className:"debug-pane__header",children:[b.jsxs("button",{type:"button",className:"debug-pane__toggle",onClick:e,"aria-label":t?"Show run output":"Hide run output",children:[b.jsx("span",{className:"debug-pane__toggle-chevron","aria-hidden":"true",children:t?"▲":"▼"}),"Run output"]}),n&&b.jsxs("span",{className:"debug-pane__count",children:[n.steps.length," call(s)"]})]}),!t&&b.jsxs("div",{className:"debug-pane__body",children:[i&&b.jsx("p",{className:"debug-pane__status debug-pane__status--running",children:"Running…"}),!i&&r&&b.jsx("p",{className:"debug-pane__status debug-pane__status--error",children:r}),!i&&!r&&!n&&b.jsx("p",{className:"debug-pane__status",children:"Run the workflow to see each step's request and response."}),!r&&(n==null?void 0:n.steps.map(s=>{var l;const o=!s.error;return b.jsxs("details",{className:"debug-step",children:[b.jsxs("summary",{className:"debug-step__summary",children:[b.jsx("span",{className:"debug-step__chevron","aria-hidden":"true",children:"▶"}),b.jsx("span",{className:`method-badge method-badge--${s.request.method.toLowerCase()}`,children:s.request.method}),b.jsx("span",{className:"debug-step__url",children:xb(s.request.url,s.request.redactQueryParams)}),b.jsx("span",{className:`status-badge ${o?"status-badge--ok":"status-badge--error"}`,children:((l=s.response)==null?void 0:l.status)??"ERROR"}),s.error&&b.jsx("span",{className:"debug-step__error",children:s.error})]}),b.jsxs("div",{className:"debug-step__panels",children:[b.jsx(QL,{request:qL(s.request)}),b.jsx(XL,{response:s.response,error:s.error})]})]},s.nodeId)}))]})]})}const ic={bearer:"Bearer token",basic:"Basic auth",apiKey:"API key",oauth2_clientCredentials:"OAuth2 (client credentials)",oauth2_password:"OAuth2 (password) · Legacy",popup_login:"Popup login (session cookie)"};function Qd(t,e){switch(t){case"bearer":return{name:e,type:t,token:""};case"basic":return{name:e,type:t,username:"",password:""};case"apiKey":return{name:e,type:t,paramName:"",in:"header",key:""};case"oauth2_clientCredentials":return{name:e,type:t,tokenUrl:"",clientId:"",clientSecret:"",scope:""};case"oauth2_password":return{name:e,type:t,tokenUrl:"",username:"",password:"",clientId:"",clientSecret:"",scope:""};case"popup_login":return{name:e,type:t,loginUrl:""}}}function JL(t){if(!t.name)return!1;switch(t.type){case"bearer":return!!t.token;case"basic":return!!(t.username&&t.password);case"apiKey":return!!(t.paramName&&t.key);case"oauth2_clientCredentials":return!!(t.tokenUrl&&t.clientId&&t.clientSecret);case"oauth2_password":return!!(t.tokenUrl&&t.username&&t.password);case"popup_login":return!!t.loginUrl}}function yo(t){return t?`••••${t.slice(-4)}`:""}function bb(t){window.open(t,"_blank","width=520,height=680")}function ZL(t){const{id:e,...n}=t;return n}function eB(t){switch(t.type){case"bearer":return yo(t.token);case"basic":return`${t.username} / ${yo(t.password)}`;case"apiKey":return`${t.paramName} (${t.in}) · ${yo(t.key)}`;case"oauth2_clientCredentials":return`${t.clientId} · ${yo(t.clientSecret)}`;case"oauth2_password":return`${t.username} · ${yo(t.password)}`;case"popup_login":return"Session cookie — no stored secret, relies on your browser being logged in"}}function tB({credential:t,usageCount:e,onEdit:n,onDelete:i}){return b.jsxs("li",{className:`credential-card credential-card--${t.type}`,children:[b.jsxs("div",{className:"credential-card__header",children:[b.jsx("span",{className:`credential-badge credential-badge--${t.type}`,children:ic[t.type]}),b.jsxs("div",{className:"credential-card__actions",children:[t.type==="popup_login"&&b.jsx("button",{type:"button",className:"credential-card__login",onClick:()=>bb(t.loginUrl),"aria-label":`Log in for ${t.name}`,title:"Opens the login page in a popup — complete login there, then re-run your nodes.",children:"Log in"}),b.jsx("button",{type:"button",className:"credential-card__edit",onClick:()=>n(t),"aria-label":`Edit ${t.name}`,children:"Edit"}),b.jsx("button",{type:"button",className:"credential-card__delete",onClick:()=>i(t.id),"aria-label":`Delete ${t.name}`,children:"Delete"})]})]}),b.jsx("div",{className:"credential-card__name",children:t.name}),b.jsx("div",{className:"credential-card__preview",children:eB(t)}),t.fromSecurityScheme&&b.jsxs("div",{className:"credential-card__source",children:["From spec: ",b.jsx("code",{children:t.fromSecurityScheme})]}),e>0&&b.jsxs("div",{className:"credential-card__usage",children:["Used by ",e," node",e===1?"":"s"," — deleting clears it from"," ",e===1?"that node":"those nodes","."]})]})}function nB({draft:t,setDraft:e}){return b.jsxs("label",{className:"credentials-panel__field",children:["Token",b.jsx("input",{placeholder:"bearer token",type:"password",value:t.token,onChange:n=>e({...t,token:n.target.value})})]})}function iB({draft:t,setDraft:e}){return b.jsxs(b.Fragment,{children:[b.jsxs("label",{className:"credentials-panel__field",children:["Username",b.jsx("input",{placeholder:"username",value:t.username,onChange:n=>e({...t,username:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Password",b.jsx("input",{placeholder:"password",type:"password",value:t.password,onChange:n=>e({...t,password:n.target.value})})]})]})}function rB({draft:t,setDraft:e}){return b.jsxs(b.Fragment,{children:[b.jsxs("label",{className:"credentials-panel__field",children:["Header/query param name",b.jsx("input",{placeholder:"e.g. X-API-Key",value:t.paramName,onChange:n=>e({...t,paramName:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Sent in",b.jsxs("select",{value:t.in,onChange:n=>e({...t,in:n.target.value}),children:[b.jsx("option",{value:"header",children:"Header"}),b.jsx("option",{value:"query",children:"Query param"})]})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Key value",b.jsx("input",{placeholder:"key value",type:"password",value:t.key,onChange:n=>e({...t,key:n.target.value})})]})]})}function sB({draft:t,setDraft:e}){return b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"credentials-panel__warning",children:"Only use test/sandbox credentials here. This value is visible to anyone with access to this browser, per Enlace's pre-prod trust model."}),b.jsxs("label",{className:"credentials-panel__field",children:["Token URL",b.jsx("input",{placeholder:"https://auth.example.com/oauth/token",value:t.tokenUrl,onChange:n=>e({...t,tokenUrl:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Client ID",b.jsx("input",{placeholder:"client id",value:t.clientId,onChange:n=>e({...t,clientId:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Client secret",b.jsx("input",{placeholder:"client secret",type:"password",value:t.clientSecret,onChange:n=>e({...t,clientSecret:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Scope (optional)",b.jsx("input",{placeholder:"scope",value:t.scope??"",onChange:n=>e({...t,scope:n.target.value})})]})]})}function oB({draft:t,setDraft:e}){return b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"credentials-panel__warning",children:"Legacy grant type — deprecated in general OAuth2 guidance. Only use test/sandbox credentials here. This value is visible to anyone with access to this browser, per Enlace's pre-prod trust model."}),b.jsxs("label",{className:"credentials-panel__field",children:["Token URL",b.jsx("input",{placeholder:"https://auth.example.com/oauth/token",value:t.tokenUrl,onChange:n=>e({...t,tokenUrl:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Username",b.jsx("input",{placeholder:"resource owner username",value:t.username,onChange:n=>e({...t,username:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Password",b.jsx("input",{placeholder:"resource owner password",type:"password",value:t.password,onChange:n=>e({...t,password:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Client ID (optional)",b.jsx("input",{placeholder:"client id",value:t.clientId??"",onChange:n=>e({...t,clientId:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Client secret (optional)",b.jsx("input",{placeholder:"client secret",type:"password",value:t.clientSecret??"",onChange:n=>e({...t,clientSecret:n.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Scope (optional)",b.jsx("input",{placeholder:"scope",value:t.scope??"",onChange:n=>e({...t,scope:n.target.value})})]})]})}function lB({draft:t,setDraft:e}){return b.jsxs(b.Fragment,{children:[b.jsxs("label",{className:"credentials-panel__field",children:["Login URL",b.jsx("input",{placeholder:"https://your-app.example.com/auth/login",value:t.loginUrl,onChange:n=>e({...t,loginUrl:n.target.value})})]}),b.jsx("button",{type:"button",className:"btn btn--secondary credentials-panel__login-btn",disabled:!t.loginUrl,onClick:()=>bb(t.loginUrl),children:"Log in…"}),b.jsx("p",{className:"credentials-panel__hint",children:`This credential doesn't add anything to your requests itself — no header, no query param. It's a trigger: click "Log in…" above to complete a real login for the target (e.g. a GitHub/Google/SSO-style login backed by your app's own session) in a popup Enlace never sees. Once you're logged in, this browser already holds the session cookie, and future requests carry it automatically — as long as the target's server allows credentialed requests from this origin; that's the target's own CORS setting, not something Enlace can change.`})]})}function aB({draft:t,setDraft:e,editingId:n,onCancel:i,onSave:r}){const s=M.useRef(null);return M.useEffect(()=>{var o;(o=s.current)==null||o.focus()},[]),b.jsxs("div",{className:"credentials-drawer__form",children:[t.fromSecurityScheme&&b.jsx("p",{className:"credentials-panel__spec-banner",children:n?b.jsxs(b.Fragment,{children:["Originally configured from the spec's ",b.jsxs("code",{children:["securitySchemes.",t.fromSecurityScheme]}),"."]}):b.jsxs(b.Fragment,{children:["This credential is declared in the spec's ",b.jsxs("code",{children:["securitySchemes.",t.fromSecurityScheme]})," — fill in the secret value(s) below."]})}),b.jsxs("label",{className:"credentials-panel__field",children:["Name",b.jsx("input",{ref:s,placeholder:"name",value:t.name,onChange:o=>e({...t,name:o.target.value})})]}),b.jsxs("label",{className:"credentials-panel__field",children:["Type",b.jsx("select",{value:t.type,onChange:o=>e(Qd(o.target.value,t.name)),children:Object.keys(ic).map(o=>b.jsx("option",{value:o,children:ic[o]},o))})]}),t.type==="bearer"&&b.jsx(nB,{draft:t,setDraft:e}),t.type==="basic"&&b.jsx(iB,{draft:t,setDraft:e}),t.type==="apiKey"&&b.jsx(rB,{draft:t,setDraft:e}),t.type==="oauth2_clientCredentials"&&b.jsx(sB,{draft:t,setDraft:e}),t.type==="oauth2_password"&&b.jsx(oB,{draft:t,setDraft:e}),t.type==="popup_login"&&b.jsx(lB,{draft:t,setDraft:e}),b.jsxs("div",{className:"credentials-drawer__form-actions",children:[b.jsx("button",{type:"button",className:"btn btn--secondary",onClick:i,children:"Cancel"}),b.jsx("button",{type:"button",className:"btn btn--authorize",disabled:!JL(t),onClick:r,children:n?"Save changes":"Save"})]})]})}function uB({entries:t,onConfigure:e}){return t.length===0?null:b.jsxs("div",{className:"credentials-drawer__declared",children:[b.jsx("h3",{children:"Declared in spec"}),b.jsx("ul",{className:"credentials-drawer__declared-list",children:t.map(n=>b.jsxs("li",{className:"declared-credential",children:[b.jsxs("div",{className:"declared-credential__info",children:[b.jsx("div",{className:"declared-credential__name",children:b.jsx("code",{children:n.schemeName})}),b.jsxs("div",{className:"declared-credential__type",children:[ic[n.template.type],n.description?` — ${n.description}`:""]})]}),b.jsx("button",{type:"button",className:"btn btn--secondary",onClick:()=>e(n),children:"Configure"})]},n.schemeName))})]})}function cB(){const{credentials:t,declaredCredentials:e,nodes:n,addCredential:i,updateCredential:r,removeCredential:s}=Mr(),[o,l]=M.useState(!1),[a,u]=M.useState(!1),[c,h]=M.useState(null),[f,d]=M.useState(()=>Qd("bearer","")),p=()=>{u(!1),h(null),d(Qd("bearer",""))},y=()=>{l(!1),p()},x=k=>{d(k.template),u(!0)},m=k=>{d(ZL(k)),h(k.id),u(!0)},g=()=>{c?r(c,f):i(f),p()};M.useEffect(()=>{if(!o)return;const k=C=>{C.key==="Escape"&&y()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);const v=new Set(t.map(k=>k.fromSecurityScheme).filter(Boolean)),w=e.filter(k=>!v.has(k.schemeName));return b.jsxs(b.Fragment,{children:[b.jsxs("button",{type:"button",className:"credentials-trigger",onClick:()=>l(!0),children:[b.jsx("span",{className:"credentials-trigger__count",children:t.length}),"credential",t.length===1?"":"s"]}),o&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"credentials-drawer__backdrop",onClick:y}),b.jsxs("aside",{className:"credentials-drawer",children:[b.jsxs("div",{className:"credentials-drawer__header",children:[b.jsx("h2",{children:"Credentials"}),b.jsx("button",{type:"button",className:"pane-collapse-btn",onClick:y,title:"Close","aria-label":"Close credentials",children:"✕"})]}),b.jsxs("div",{className:"credentials-drawer__body",children:[t.length===0&&!a&&b.jsx("p",{className:"credentials-drawer__empty",children:`No credentials yet. Add one, then attach it to a node from the inspector's "Credential" dropdown.`}),t.length>0&&b.jsx("ul",{className:"credentials-drawer__list",children:t.map(k=>b.jsx(tB,{credential:k,usageCount:n.filter(C=>C.credentialId===k.id).length,onEdit:m,onDelete:s},k.id))}),!a&&b.jsx(uB,{entries:w,onConfigure:x}),a?b.jsx(aB,{draft:f,setDraft:d,editingId:c,onCancel:p,onSave:g}):b.jsx("button",{type:"button",className:"credentials-drawer__add-btn",onClick:()=>u(!0),children:"+ New credential"})]})]})]})]})}function hB(){const{operations:t,loadOperations:e,run:n,isRunning:i}=Mr(),[r,s]=M.useState(!0),[o,l]=M.useState(!0);return M.useEffect(()=>{e()},[e]),b.jsxs("div",{className:"app",children:[b.jsxs("header",{className:"app__header",children:[b.jsxs("h1",{className:"app__title",children:[b.jsx("img",{src:"./favicon.svg",alt:"",className:"app__logo"}),"Enlace"]}),b.jsx(cB,{}),b.jsx("button",{className:"btn btn--execute",onClick:n,disabled:i,children:i?"Running…":"Run"})]}),b.jsxs("div",{className:`app__body${r?"":" app__body--inspector-collapsed"}`,children:[b.jsx(TA,{operations:t}),b.jsx(yP,{}),r?b.jsx(KL,{onCollapse:()=>s(!1)}):b.jsx("button",{type:"button",className:"pane-strip pane-strip--right",onClick:()=>s(!0),title:"Show inspector","aria-label":"Show inspector",children:"‹"})]}),b.jsx(GL,{collapsed:!o,onToggleCollapsed:()=>l(a=>!a)})]})}Qh.createRoot(document.getElementById("root")).render(b.jsx(F.StrictMode,{children:b.jsx(hB,{})}));
|