>>1,ue=D[K];if(0>>1;Ki(X,W))_ei(ge,X)?(D[K]=ge,D[_e]=W,K=_e):(D[K]=X,D[Q]=W,K=Q);else if(_ei(ge,W))D[K]=ge,D[_e]=W,K=_e;else break e}}return F}function i(D,F){var W=D.sortIndex-F.sortIndex;return W!==0?W:D.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,f=null,d=3,p=!1,h=!1,v=!1,S=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(D){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=D)r(u),F.sortIndex=F.expirationTime,e(a,F);else break;F=n(u)}}function w(D){if(v=!1,g(D),!h)if(n(a)!==null)h=!0,he(x);else{var F=n(u);F!==null&&De(w,F.startTime-D)}}function x(D,F){h=!1,v&&(v=!1,m(k),k=-1),p=!0;var W=d;try{for(g(F),f=n(a);f!==null&&(!(f.expirationTime>F)||D&&!J());){var K=f.callback;if(typeof K=="function"){f.callback=null,d=f.priorityLevel;var ue=K(f.expirationTime<=F);F=t.unstable_now(),typeof ue=="function"?f.callback=ue:f===n(a)&&r(a),g(F)}else r(a);f=n(a)}if(f!==null)var P=!0;else{var Q=n(u);Q!==null&&De(w,Q.startTime-F),P=!1}return P}finally{f=null,d=W,p=!1}}var C=!1,O=null,k=-1,I=5,M=-1;function J(){return!(t.unstable_now()-MD||125K?(D.sortIndex=W,e(u,D),n(a)===null&&D===n(u)&&(v?(m(k),k=-1):v=!0,De(w,W-K))):(D.sortIndex=ue,e(a,D),h||p||(h=!0,he(x))),D},t.unstable_shouldYield=J,t.unstable_wrapCallback=function(D){var F=d;return function(){var W=d;d=F;try{return D.apply(this,arguments)}finally{d=W}}}})(nw);tw.exports=nw;var Hz=tw.exports;/**
- * @license React
- * react-dom.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var rw=H,Ft=Hz;function _(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hd=Object.prototype.hasOwnProperty,Gz=/^[: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]*$/,Ly={},Fy={};function Kz(t){return hd.call(Fy,t)?!0:hd.call(Ly,t)?!1:Gz.test(t)?Fy[t]=!0:(Ly[t]=!0,!1)}function qz(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Yz(t,e,n,r){if(e===null||typeof e>"u"||qz(t,e,n,r))return!0;if(r)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 St(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Je={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Je[t]=new St(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Je[e]=new St(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Je[t]=new St(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Je[t]=new St(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){Je[t]=new St(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Je[t]=new St(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Je[t]=new St(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Je[t]=new St(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Je[t]=new St(t,5,!1,t.toLowerCase(),null,!1,!1)});var ch=/[\-:]([a-z])/g;function fh(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(ch,fh);Je[e]=new St(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(ch,fh);Je[e]=new St(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(ch,fh);Je[e]=new St(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Je[t]=new St(t,1,!1,t.toLowerCase(),null,!1,!1)});Je.xlinkHref=new St("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Je[t]=new St(t,1,!1,t.toLowerCase(),null,!0,!0)});function dh(t,e,n,r){var i=Je.hasOwnProperty(e)?Je[e]:null;(i!==null?i.type!==0:r||!(2l||i[s]!==o[l]){var a=`
-`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{rf=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?as(t):""}function Jz(t){switch(t.tag){case 5:return as(t.type);case 16:return as("Lazy");case 13:return as("Suspense");case 19:return as("SuspenseList");case 0:case 2:case 15:return t=of(t.type,!1),t;case 11:return t=of(t.type.render,!1),t;case 1:return t=of(t.type,!0),t;default:return""}}function vd(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 Bi:return"Fragment";case Fi:return"Portal";case md:return"Profiler";case ph:return"StrictMode";case gd:return"Suspense";case yd:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case sw:return(t.displayName||"Context")+".Consumer";case ow:return(t._context.displayName||"Context")+".Provider";case hh:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case mh:return e=t.displayName||null,e!==null?e:vd(t.type)||"Memo";case er:e=t._payload,t=t._init;try{return vd(t(e))}catch{}}return null}function Qz(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 vd(e);case 8:return e===ph?"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 Ar(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function aw(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Xz(t){var e=aw(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function jl(t){t._valueTracker||(t._valueTracker=Xz(t))}function uw(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=aw(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function La(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 Sd(t,e){var n=e.checked;return ke({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function zy(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ar(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function cw(t,e){e=e.checked,e!=null&&dh(t,"checked",e,!1)}function wd(t,e){cw(t,e);var n=Ar(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Ed(t,e.type,n):e.hasOwnProperty("defaultValue")&&Ed(t,e.type,Ar(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function jy(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="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 Ed(t,e,n){(e!=="number"||La(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var us=Array.isArray;function Qi(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Ul.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Fs(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ss={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},Zz=["Webkit","ms","Moz","O"];Object.keys(Ss).forEach(function(t){Zz.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ss[e]=Ss[t]})});function hw(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ss.hasOwnProperty(t)&&Ss[t]?(""+e).trim():e+"px"}function mw(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=hw(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var e4=ke({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 xd(t,e){if(e){if(e4[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(_(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(_(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(_(61))}if(e.style!=null&&typeof e.style!="object")throw Error(_(62))}}function Od(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 Td=null;function gh(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var kd=null,Xi=null,Zi=null;function Wy(t){if(t=El(t)){if(typeof kd!="function")throw Error(_(280));var e=t.stateNode;e&&(e=Wu(e),kd(t.stateNode,t.type,e))}}function gw(t){Xi?Zi?Zi.push(t):Zi=[t]:Xi=t}function yw(){if(Xi){var t=Xi,e=Zi;if(Zi=Xi=null,Wy(t),e)for(t=0;t>>=0,t===0?32:31-(f4(t)/d4|0)|0}var Vl=64,Wl=4194304;function cs(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 ja(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var l=s&~i;l!==0?r=cs(l):(o&=s,o!==0&&(r=cs(o)))}else s=n&~i,s!==0?r=cs(s):o!==0&&(r=cs(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Sl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-ln(e),t[e]=n}function g4(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 r=t.eventTimes;for(t=t.expirationTimes;0=Es),Zy=" ",ev=!1;function Lw(t,e){switch(t){case"keyup":return W4.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fw(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var zi=!1;function G4(t,e){switch(t){case"compositionend":return Fw(e);case"keypress":return e.which!==32?null:(ev=!0,Zy);case"textInput":return t=e.data,t===Zy&&ev?null:t;default:return null}}function K4(t,e){if(zi)return t==="compositionend"||!xh&&Lw(t,e)?(t=Dw(),ma=Eh=ur=null,zi=!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)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=iv(n)}}function Uw(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Uw(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Vw(){for(var t=window,e=La();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=La(t.document)}return e}function Oh(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 n6(t){var e=Vw(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Uw(n.ownerDocument.documentElement,n)){if(r!==null&&Oh(n)){if(e=r.start,t=r.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 i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=ov(n,o);var s=ov(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.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=document.documentMode,ji=null,Pd=null,bs=null,$d=!1;function sv(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$d||ji==null||ji!==La(r)||(r=ji,"selectionStart"in r&&Oh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),bs&&Ws(bs,r)||(bs=r,r=Wa(Pd,"onSelect"),0Wi||(t.current=zd[Wi],zd[Wi]=null,Wi--)}function Se(t,e){Wi++,zd[Wi]=t.current,t.current=e}var _r={},lt=$r(_r),Ot=$r(!1),ai=_r;function ho(t,e){var n=t.type.contextTypes;if(!n)return _r;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Tt(t){return t=t.childContextTypes,t!=null}function Ga(){Ce(Ot),Ce(lt)}function pv(t,e,n){if(lt.current!==_r)throw Error(_(168));Se(lt,e),Se(Ot,n)}function Xw(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(_(108,Qz(t)||"Unknown",i));return ke({},n,r)}function Ka(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||_r,ai=lt.current,Se(lt,t),Se(Ot,Ot.current),!0}function hv(t,e,n){var r=t.stateNode;if(!r)throw Error(_(169));n?(t=Xw(t,e,ai),r.__reactInternalMemoizedMergedChildContext=t,Ce(Ot),Ce(lt),Se(lt,t)):Ce(Ot),Se(Ot,n)}var Ln=null,Hu=!1,Sf=!1;function Zw(t){Ln===null?Ln=[t]:Ln.push(t)}function h6(t){Hu=!0,Zw(t)}function Dr(){if(!Sf&&Ln!==null){Sf=!0;var t=0,e=fe;try{var n=Ln;for(fe=1;t>=s,i-=s,Bn=1<<32-ln(e)+i|n<k?(I=O,O=null):I=O.sibling;var M=d(m,O,g[k],w);if(M===null){O===null&&(O=I);break}t&&O&&M.alternate===null&&e(m,O),y=o(M,y,k),C===null?x=M:C.sibling=M,C=M,O=I}if(k===g.length)return n(m,O),be&&Ur(m,k),x;if(O===null){for(;kk?(I=O,O=null):I=O.sibling;var J=d(m,O,M.value,w);if(J===null){O===null&&(O=I);break}t&&O&&J.alternate===null&&e(m,O),y=o(J,y,k),C===null?x=J:C.sibling=J,C=J,O=I}if(M.done)return n(m,O),be&&Ur(m,k),x;if(O===null){for(;!M.done;k++,M=g.next())M=f(m,M.value,w),M!==null&&(y=o(M,y,k),C===null?x=M:C.sibling=M,C=M);return be&&Ur(m,k),x}for(O=r(m,O);!M.done;k++,M=g.next())M=p(O,m,k,M.value,w),M!==null&&(t&&M.alternate!==null&&O.delete(M.key===null?k:M.key),y=o(M,y,k),C===null?x=M:C.sibling=M,C=M);return t&&O.forEach(function(T){return e(m,T)}),be&&Ur(m,k),x}function S(m,y,g,w){if(typeof g=="object"&&g!==null&&g.type===Bi&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case zl:e:{for(var x=g.key,C=y;C!==null;){if(C.key===x){if(x=g.type,x===Bi){if(C.tag===7){n(m,C.sibling),y=i(C,g.props.children),y.return=m,m=y;break e}}else if(C.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===er&&Ev(x)===C.type){n(m,C.sibling),y=i(C,g.props),y.ref=rs(m,C,g),y.return=m,m=y;break e}n(m,C);break}else e(m,C);C=C.sibling}g.type===Bi?(y=ti(g.props.children,m.mode,w,g.key),y.return=m,m=y):(w=ba(g.type,g.key,g.props,null,m.mode,w),w.ref=rs(m,y,g),w.return=m,m=w)}return s(m);case Fi:e:{for(C=g.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){n(m,y.sibling),y=i(y,g.children||[]),y.return=m,m=y;break e}else{n(m,y);break}else e(m,y);y=y.sibling}y=kf(g,m.mode,w),y.return=m,m=y}return s(m);case er:return C=g._init,S(m,y,C(g._payload),w)}if(us(g))return h(m,y,g,w);if(Xo(g))return v(m,y,g,w);Ql(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,y!==null&&y.tag===6?(n(m,y.sibling),y=i(y,g),y.return=m,m=y):(n(m,y),y=Tf(g,m.mode,w),y.return=m,m=y),s(m)):n(m,y)}return S}var go=lE(!0),aE=lE(!1),Cl={},xn=$r(Cl),qs=$r(Cl),Ys=$r(Cl);function Yr(t){if(t===Cl)throw Error(_(174));return t}function $h(t,e){switch(Se(Ys,e),Se(qs,t),Se(xn,Cl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:bd(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=bd(e,t)}Ce(xn),Se(xn,e)}function yo(){Ce(xn),Ce(qs),Ce(Ys)}function uE(t){Yr(Ys.current);var e=Yr(xn.current),n=bd(e,t.type);e!==n&&(Se(qs,t),Se(xn,n))}function Dh(t){qs.current===t&&(Ce(xn),Ce(qs))}var Oe=$r(0);function Za(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 wf=[];function Rh(){for(var t=0;tn?n:4,t(!0);var r=Ef.transition;Ef.transition={};try{t(!1),e()}finally{fe=n,Ef.transition=r}}function OE(){return Yt().memoizedState}function v6(t,e,n){var r=wr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},TE(t))kE(e,n);else if(n=rE(t,e,n,r),n!==null){var i=dt();an(n,t,r,i),AE(n,e,r)}}function S6(t,e,n){var r=wr(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(TE(t))kE(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,n);if(i.hasEagerState=!0,i.eagerState=l,cn(l,s)){var a=e.interleaved;a===null?(i.next=i,Ih(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=rE(t,e,i,r),n!==null&&(i=dt(),an(n,t,r,i),AE(n,e,r))}}function TE(t){var e=t.alternate;return t===Te||e!==null&&e===Te}function kE(t,e){xs=eu=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function AE(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vh(t,n)}}var tu={readContext:qt,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},w6={readContext:qt,useCallback:function(t,e){return gn().memoizedState=[t,e===void 0?null:e],t},useContext:qt,useEffect:bv,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Sa(4194308,4,wE.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Sa(4194308,4,t,e)},useInsertionEffect:function(t,e){return Sa(4,2,t,e)},useMemo:function(t,e){var n=gn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=gn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=v6.bind(null,Te,t),[r.memoizedState,t]},useRef:function(t){var e=gn();return t={current:t},e.memoizedState=t},useState:Cv,useDebugValue:jh,useDeferredValue:function(t){return gn().memoizedState=t},useTransition:function(){var t=Cv(!1),e=t[0];return t=y6.bind(null,t[1]),gn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Te,i=gn();if(be){if(n===void 0)throw Error(_(407));n=n()}else{if(n=e(),je===null)throw Error(_(349));ci&30||dE(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,bv(hE.bind(null,r,o,t),[t]),r.flags|=2048,Xs(9,pE.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=gn(),e=je.identifierPrefix;if(be){var n=zn,r=Bn;n=(r&~(1<<32-ln(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Js++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[wn]=e,t[Ks]=r,LE(t,e,!1,!1),e.stateNode=t;e:{switch(s=Od(n,r),n){case"dialog":we("cancel",t),we("close",t),i=r;break;case"iframe":case"object":case"embed":we("load",t),i=r;break;case"video":case"audio":for(i=0;iSo&&(e.flags|=128,r=!0,is(o,!1),e.lanes=4194304)}else{if(!r)if(t=Za(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),is(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!be)return et(e),null}else 2*Ne()-o.renderingStartTime>So&&n!==1073741824&&(e.flags|=128,r=!0,is(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Ne(),e.sibling=null,n=Oe.current,Se(Oe,r?n&1|2:n&1),e):(et(e),null);case 22:case 23:return Kh(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Mt&1073741824&&(et(e),e.subtreeFlags&6&&(e.flags|=8192)):et(e),null;case 24:return null;case 25:return null}throw Error(_(156,e.tag))}function A6(t,e){switch(kh(e),e.tag){case 1:return Tt(e.type)&&Ga(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return yo(),Ce(Ot),Ce(lt),Rh(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Dh(e),null;case 13:if(Ce(Oe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(_(340));mo()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ce(Oe),null;case 4:return yo(),null;case 10:return Mh(e.type._context),null;case 22:case 23:return Kh(),null;case 24:return null;default:return null}}var Zl=!1,rt=!1,_6=typeof WeakSet=="function"?WeakSet:Set,L=null;function qi(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ae(t,e,r)}else n.current=null}function Xd(t,e,n){try{n()}catch(r){Ae(t,e,r)}}var Iv=!1;function N6(t,e){if(Dd=Ua,t=Vw(),Oh(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,l=-1,a=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=s+i),f!==o||r!==0&&f.nodeType!==3||(a=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)d=f,f=p;for(;;){if(f===t)break t;if(d===n&&++u===i&&(l=s),d===o&&++c===r&&(a=s),(p=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=p}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rd={focusedElem:t,selectionRange:n},Ua=!1,L=e;L!==null;)if(e=L,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,L=t;else for(;L!==null;){e=L;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var v=h.memoizedProps,S=h.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?v:en(e.type,v),S);m.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var g=e.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(_(163))}}catch(w){Ae(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,L=t;break}L=e.return}return h=Iv,Iv=!1,h}function Os(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Xd(e,n,o)}i=i.next}while(i!==r)}}function qu(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 r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Zd(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 zE(t){var e=t.alternate;e!==null&&(t.alternate=null,zE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[wn],delete e[Ks],delete e[Bd],delete e[d6],delete e[p6])),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 jE(t){return t.tag===5||t.tag===3||t.tag===4}function Pv(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||jE(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 ep(t,e,n){var r=t.tag;if(r===5||r===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=Ha));else if(r!==4&&(t=t.child,t!==null))for(ep(t,e,n),t=t.sibling;t!==null;)ep(t,e,n),t=t.sibling}function tp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(tp(t,e,n),t=t.sibling;t!==null;)tp(t,e,n),t=t.sibling}var Ge=null,tn=!1;function Qn(t,e,n){for(n=n.child;n!==null;)UE(t,e,n),n=n.sibling}function UE(t,e,n){if(bn&&typeof bn.onCommitFiberUnmount=="function")try{bn.onCommitFiberUnmount(zu,n)}catch{}switch(n.tag){case 5:rt||qi(n,e);case 6:var r=Ge,i=tn;Ge=null,Qn(t,e,n),Ge=r,tn=i,Ge!==null&&(tn?(t=Ge,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ge.removeChild(n.stateNode));break;case 18:Ge!==null&&(tn?(t=Ge,n=n.stateNode,t.nodeType===8?vf(t.parentNode,n):t.nodeType===1&&vf(t,n),Us(t)):vf(Ge,n.stateNode));break;case 4:r=Ge,i=tn,Ge=n.stateNode.containerInfo,tn=!0,Qn(t,e,n),Ge=r,tn=i;break;case 0:case 11:case 14:case 15:if(!rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Xd(n,e,s),i=i.next}while(i!==r)}Qn(t,e,n);break;case 1:if(!rt&&(qi(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Ae(n,e,l)}Qn(t,e,n);break;case 21:Qn(t,e,n);break;case 22:n.mode&1?(rt=(r=rt)||n.memoizedState!==null,Qn(t,e,n),rt=r):Qn(t,e,n);break;default:Qn(t,e,n)}}function $v(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new _6),e.forEach(function(r){var i=B6.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Xt(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*I6(r/1960))-r,10t?16:t,cr===null)var r=!1;else{if(t=cr,cr=null,iu=0,oe&6)throw Error(_(331));var i=oe;for(oe|=4,L=t.current;L!==null;){var o=L,s=o.child;if(L.flags&16){var l=o.deletions;if(l!==null){for(var a=0;aNe()-Hh?ei(t,0):Wh|=n),kt(t,e)}function JE(t,e){e===0&&(t.mode&1?(e=Wl,Wl<<=1,!(Wl&130023424)&&(Wl=4194304)):e=1);var n=dt();t=Gn(t,e),t!==null&&(Sl(t,e,n),kt(t,n))}function F6(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),JE(t,n)}function B6(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(_(314))}r!==null&&r.delete(e),JE(t,n)}var QE;QE=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ot.current)xt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return xt=!1,T6(t,e,n);xt=!!(t.flags&131072)}else xt=!1,be&&e.flags&1048576&&eE(e,Ya,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;wa(t,e),t=e.pendingProps;var i=ho(e,lt.current);to(e,n),i=Fh(null,e,r,t,i,n);var o=Bh();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Tt(r)?(o=!0,Ka(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ph(e),i.updater=Gu,e.stateNode=i,i._reactInternals=e,Hd(e,r,t,n),e=qd(null,e,r,!0,o,n)):(e.tag=0,be&&o&&Th(e),ut(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(wa(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=j6(r),t=en(r,t),i){case 0:e=Kd(null,e,r,t,n);break e;case 1:e=_v(null,e,r,t,n);break e;case 11:e=kv(null,e,r,t,n);break e;case 14:e=Av(null,e,r,en(r.type,t),n);break e}throw Error(_(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:en(r,i),Kd(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:en(r,i),_v(t,e,r,i,n);case 3:e:{if($E(e),t===null)throw Error(_(387));r=e.pendingProps,o=e.memoizedState,i=o.element,iE(t,e),Xa(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=vo(Error(_(423)),e),e=Nv(t,e,r,n,i);break e}else if(r!==i){i=vo(Error(_(424)),e),e=Nv(t,e,r,n,i);break e}else for(Pt=yr(e.stateNode.containerInfo.firstChild),$t=e,be=!0,nn=null,n=aE(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mo(),r===i){e=Kn(t,e,n);break e}ut(t,e,r,n)}e=e.child}return e;case 5:return uE(e),t===null&&Ud(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Ld(r,i)?s=null:o!==null&&Ld(r,o)&&(e.flags|=32),PE(t,e),ut(t,e,s,n),e.child;case 6:return t===null&&Ud(e),null;case 13:return DE(t,e,n);case 4:return $h(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=go(e,null,r,n):ut(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:en(r,i),kv(t,e,r,i,n);case 7:return ut(t,e,e.pendingProps,n),e.child;case 8:return ut(t,e,e.pendingProps.children,n),e.child;case 12:return ut(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Se(Ja,r._currentValue),r._currentValue=s,o!==null)if(cn(o.value,s)){if(o.children===i.children&&!Ot.current){e=Kn(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=Un(-1,n&-n),a.tag=2;var u=o.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}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Vd(o.return,n,e),l.lanes|=n;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(_(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Vd(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ut(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,to(e,n),i=qt(i),r=r(i),e.flags|=1,ut(t,e,r,n),e.child;case 14:return r=e.type,i=en(r,e.pendingProps),i=en(r.type,i),Av(t,e,r,i,n);case 15:return ME(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:en(r,i),wa(t,e),e.tag=1,Tt(r)?(t=!0,Ka(e)):t=!1,to(e,n),sE(e,r,i),Hd(e,r,i,n),qd(null,e,r,!0,t,n);case 19:return RE(t,e,n);case 22:return IE(t,e,n)}throw Error(_(156,e.tag))};function XE(t,e){return xw(t,e)}function z6(t,e,n,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ht(t,e,n,r){return new z6(t,e,n,r)}function Yh(t){return t=t.prototype,!(!t||!t.isReactComponent)}function j6(t){if(typeof t=="function")return Yh(t)?1:0;if(t!=null){if(t=t.$$typeof,t===hh)return 11;if(t===mh)return 14}return 2}function Er(t,e){var n=t.alternate;return n===null?(n=Ht(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 ba(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")Yh(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Bi:return ti(n.children,i,o,e);case ph:s=8,i|=8;break;case md:return t=Ht(12,n,e,i|2),t.elementType=md,t.lanes=o,t;case gd:return t=Ht(13,n,e,i),t.elementType=gd,t.lanes=o,t;case yd:return t=Ht(19,n,e,i),t.elementType=yd,t.lanes=o,t;case lw:return Ju(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ow:s=10;break e;case sw:s=9;break e;case hh:s=11;break e;case mh:s=14;break e;case er:s=16,r=null;break e}throw Error(_(130,t==null?t:typeof t,""))}return e=Ht(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function ti(t,e,n,r){return t=Ht(7,t,r,e),t.lanes=n,t}function Ju(t,e,n,r){return t=Ht(22,t,r,e),t.elementType=lw,t.lanes=n,t.stateNode={isHidden:!1},t}function Tf(t,e,n){return t=Ht(6,t,null,e),t.lanes=n,t}function kf(t,e,n){return e=Ht(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function U6(t,e,n,r,i){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=lf(0),this.expirationTimes=lf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Jh(t,e,n,r,i,o,s,l,a){return t=new U6(t,e,n,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Ht(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ph(o),t}function V6(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nC)}catch(t){console.error(t)}}nC(),ew.exports=Bt;var rC=ew.exports,q6,Uv=rC;q6=Uv.createRoot,Uv.hydrateRoot;var iC={exports:{}},oC={};/**
- * @license React
- * use-sync-external-store-shim.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var wo=H;function Y6(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var J6=typeof Object.is=="function"?Object.is:Y6,Q6=wo.useState,X6=wo.useEffect,Z6=wo.useLayoutEffect,ej=wo.useDebugValue;function tj(t,e){var n=e(),r=Q6({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return Z6(function(){i.value=n,i.getSnapshot=e,Af(i)&&o({inst:i})},[t,n,e]),X6(function(){return Af(i)&&o({inst:i}),t(function(){Af(i)&&o({inst:i})})},[t]),ej(n),n}function Af(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!J6(t,n)}catch{return!0}}function nj(t,e){return e()}var rj=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?nj:tj;oC.useSyncExternalStore=wo.useSyncExternalStore!==void 0?wo.useSyncExternalStore:rj;iC.exports=oC;var sC=iC.exports,lC={exports:{}},aC={};/**
- * @license React
- * use-sync-external-store-shim/with-selector.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var tc=H,ij=sC;function oj(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var sj=typeof Object.is=="function"?Object.is:oj,lj=ij.useSyncExternalStore,aj=tc.useRef,uj=tc.useEffect,cj=tc.useMemo,fj=tc.useDebugValue;aC.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=aj(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=cj(function(){function a(p){if(!u){if(u=!0,c=p,p=r(p),i!==void 0&&s.hasValue){var h=s.value;if(i(h,p))return f=h}return f=p}if(h=f,sj(c,p))return h;var v=r(p);return i!==void 0&&i(h,v)?h:(c=p,f=v)}var u=!1,c,f,d=n===void 0?null:n;return[function(){return a(e())},d===null?void 0:function(){return a(d())}]},[e,n,r,i]);var l=lj(t,o[0],o[1]);return uj(function(){s.hasValue=!0,s.value=l},[l]),fj(l),l};lC.exports=aC;var dj=lC.exports;function pj(t){t()}let uC=pj;const hj=t=>uC=t,mj=()=>uC,Vv=Symbol.for("react-redux-context"),Wv=typeof globalThis<"u"?globalThis:{};function gj(){var t;if(!H.createContext)return{};const e=(t=Wv[Vv])!=null?t:Wv[Vv]=new Map;let n=e.get(H.createContext);return n||(n=H.createContext(null),e.set(H.createContext,n)),n}const el=gj();function cC(t=el){return function(){return H.useContext(t)}}const yj=cC(),fC=()=>{throw new Error("uSES not initialized!")};let dC=fC;const vj=t=>{dC=t},Sj=(t,e)=>t===e;function wj(t=el){const e=t===el?yj:cC(t);return function(r,i={}){const{equalityFn:o=Sj,stabilityCheck:s=void 0,noopCheck:l=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:a,subscription:u,getServerState:c,stabilityCheck:f,noopCheck:d}=e();H.useRef(!0);const p=H.useCallback({[r.name](v){return r(v)}}[r.name],[r,f,s]),h=dC(u.addNestedSub,a.getState,c||a.getState,p,o);return H.useDebugValue(h),h}}const sY=wj();function ro(){return ro=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}var hC={exports:{}},de={};/** @license React v16.13.1
- * react-is.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Ve=typeof Symbol=="function"&&Symbol.for,em=Ve?Symbol.for("react.element"):60103,tm=Ve?Symbol.for("react.portal"):60106,nc=Ve?Symbol.for("react.fragment"):60107,rc=Ve?Symbol.for("react.strict_mode"):60108,ic=Ve?Symbol.for("react.profiler"):60114,oc=Ve?Symbol.for("react.provider"):60109,sc=Ve?Symbol.for("react.context"):60110,nm=Ve?Symbol.for("react.async_mode"):60111,lc=Ve?Symbol.for("react.concurrent_mode"):60111,ac=Ve?Symbol.for("react.forward_ref"):60112,uc=Ve?Symbol.for("react.suspense"):60113,Ej=Ve?Symbol.for("react.suspense_list"):60120,cc=Ve?Symbol.for("react.memo"):60115,fc=Ve?Symbol.for("react.lazy"):60116,Cj=Ve?Symbol.for("react.block"):60121,bj=Ve?Symbol.for("react.fundamental"):60117,xj=Ve?Symbol.for("react.responder"):60118,Oj=Ve?Symbol.for("react.scope"):60119;function jt(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case em:switch(t=t.type,t){case nm:case lc:case nc:case ic:case rc:case uc:return t;default:switch(t=t&&t.$$typeof,t){case sc:case ac:case fc:case cc:case oc:return t;default:return e}}case tm:return e}}}function mC(t){return jt(t)===lc}de.AsyncMode=nm;de.ConcurrentMode=lc;de.ContextConsumer=sc;de.ContextProvider=oc;de.Element=em;de.ForwardRef=ac;de.Fragment=nc;de.Lazy=fc;de.Memo=cc;de.Portal=tm;de.Profiler=ic;de.StrictMode=rc;de.Suspense=uc;de.isAsyncMode=function(t){return mC(t)||jt(t)===nm};de.isConcurrentMode=mC;de.isContextConsumer=function(t){return jt(t)===sc};de.isContextProvider=function(t){return jt(t)===oc};de.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===em};de.isForwardRef=function(t){return jt(t)===ac};de.isFragment=function(t){return jt(t)===nc};de.isLazy=function(t){return jt(t)===fc};de.isMemo=function(t){return jt(t)===cc};de.isPortal=function(t){return jt(t)===tm};de.isProfiler=function(t){return jt(t)===ic};de.isStrictMode=function(t){return jt(t)===rc};de.isSuspense=function(t){return jt(t)===uc};de.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===nc||t===lc||t===ic||t===rc||t===uc||t===Ej||typeof t=="object"&&t!==null&&(t.$$typeof===fc||t.$$typeof===cc||t.$$typeof===oc||t.$$typeof===sc||t.$$typeof===ac||t.$$typeof===bj||t.$$typeof===xj||t.$$typeof===Oj||t.$$typeof===Cj)};de.typeOf=jt;hC.exports=de;var Tj=hC.exports,rm=Tj,kj={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Aj={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},_j={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},gC={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},im={};im[rm.ForwardRef]=_j;im[rm.Memo]=gC;function Hv(t){return rm.isMemo(t)?gC:im[t.$$typeof]||kj}var Nj=Object.defineProperty,Mj=Object.getOwnPropertyNames,Gv=Object.getOwnPropertySymbols,Ij=Object.getOwnPropertyDescriptor,Pj=Object.getPrototypeOf,Kv=Object.prototype;function yC(t,e,n){if(typeof e!="string"){if(Kv){var r=Pj(e);r&&r!==Kv&&yC(t,r,n)}var i=Mj(e);Gv&&(i=i.concat(Gv(e)));for(var o=Hv(t),s=Hv(e),l=0;le(i(...o)))}return n}function sp(t){return function(n){const r=t(n);function i(){return r}return i.dependsOnOwnProps=!1,i}}function Yv(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function wC(t,e){return function(r,{displayName:i}){const o=function(l,a){return o.dependsOnOwnProps?o.mapToProps(l,a):o.mapToProps(l,void 0)};return o.dependsOnOwnProps=!0,o.mapToProps=function(l,a){o.mapToProps=t,o.dependsOnOwnProps=Yv(t);let u=o(l,a);return typeof u=="function"&&(o.mapToProps=u,o.dependsOnOwnProps=Yv(u),u=o(l,a)),u},o}}function lm(t,e){return(n,r)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${r.wrappedComponentName}.`)}}function Uj(t){return t&&typeof t=="object"?sp(e=>jj(t,e)):t?typeof t=="function"?wC(t):lm(t,"mapDispatchToProps"):sp(e=>({dispatch:e}))}function Vj(t){return t?typeof t=="function"?wC(t):lm(t,"mapStateToProps"):sp(()=>({}))}function Wj(t,e,n){return ro({},n,t,e)}function Hj(t){return function(n,{displayName:r,areMergedPropsEqual:i}){let o=!1,s;return function(a,u,c){const f=t(a,u,c);return o?i(f,s)||(s=f):(o=!0,s=f),s}}}function Gj(t){return t?typeof t=="function"?Hj(t):lm(t,"mergeProps"):()=>Wj}function Kj(){const t=mj();let e=null,n=null;return{clear(){e=null,n=null},notify(){t(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=e;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:e=o,function(){!i||e===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}const Jv={notify(){},get:()=>[]};function EC(t,e){let n,r=Jv,i=0,o=!1;function s(v){c();const S=r.subscribe(v);let m=!1;return()=>{m||(m=!0,S(),f())}}function l(){r.notify()}function a(){h.onStateChange&&h.onStateChange()}function u(){return o}function c(){i++,n||(n=e?e.addNestedSub(a):t.subscribe(a),r=Kj())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Jv)}function d(){o||(o=!0,c())}function p(){o&&(o=!1,f())}const h={addNestedSub:s,notifyNestedSubs:l,handleChangeWrapper:a,isSubscribed:u,trySubscribe:d,tryUnsubscribe:p,getListeners:()=>r};return h}const qj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",lu=qj?H.useLayoutEffect:H.useEffect;function Qv(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function _f(t,e){if(Qv(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i{CC=t},Qj=[null,null];function Xj(t,e,n){lu(()=>t(...e),n)}function Zj(t,e,n,r,i,o){t.current=r,n.current=!1,i.current&&(i.current=null,o())}function eU(t,e,n,r,i,o,s,l,a,u,c){if(!t)return()=>{};let f=!1,d=null;const p=()=>{if(f||!l.current)return;const v=e.getState();let S,m;try{S=r(v,i.current)}catch(y){m=y,d=y}m||(d=null),S===o.current?s.current||u():(o.current=S,a.current=S,s.current=!0,c())};return n.onStateChange=p,n.trySubscribe(),p(),()=>{if(f=!0,n.tryUnsubscribe(),n.onStateChange=null,d)throw d}}function tU(t,e){return t===e}function lY(t,e,n,{pure:r,areStatesEqual:i=tU,areOwnPropsEqual:o=_f,areStatePropsEqual:s=_f,areMergedPropsEqual:l=_f,forwardRef:a=!1,context:u=el}={}){const c=u,f=Vj(t),d=Uj(e),p=Gj(n),h=!!t;return S=>{const m=S.displayName||S.name||"Component",y=`Connect(${m})`,g={shouldHandleStateChanges:h,displayName:y,wrappedComponentName:m,WrappedComponent:S,initMapStateToProps:f,initMapDispatchToProps:d,initMergeProps:p,areStatesEqual:i,areStatePropsEqual:s,areOwnPropsEqual:o,areMergedPropsEqual:l};function w(O){const[k,I,M]=H.useMemo(()=>{const{reactReduxForwardedRef:wt}=O,_n=pC(O,Yj);return[O.context,wt,_n]},[O]),J=H.useMemo(()=>k&&k.Consumer&&Lj.isContextConsumer(H.createElement(k.Consumer,null))?k:c,[k,c]),T=H.useContext(J),B=!!O.store&&!!O.store.getState&&!!O.store.dispatch,G=!!T&&!!T.store,q=B?O.store:T.store,he=G?T.getServerState:q.getState,De=H.useMemo(()=>zj(q.dispatch,g),[q]),[D,F]=H.useMemo(()=>{if(!h)return Qj;const wt=EC(q,B?void 0:T.subscription),_n=wt.notifyNestedSubs.bind(wt);return[wt,_n]},[q,B,T]),W=H.useMemo(()=>B?T:ro({},T,{subscription:D}),[B,T,D]),K=H.useRef(),ue=H.useRef(M),P=H.useRef(),Q=H.useRef(!1);H.useRef(!1);const X=H.useRef(!1),_e=H.useRef();lu(()=>(X.current=!0,()=>{X.current=!1}),[]);const ge=H.useMemo(()=>()=>P.current&&M===ue.current?P.current:De(q.getState(),M),[q,M]),An=H.useMemo(()=>_n=>D?eU(h,q,D,De,ue,K,Q,X,P,F,_n):()=>{},[D]);Xj(Zj,[ue,K,Q,M,P,F]);let pn;try{pn=CC(An,ge,he?()=>De(he(),M):ge)}catch(wt){throw _e.current&&(wt.message+=`
-The error may be correlated with this previous error:
-${_e.current.stack}
-
-`),wt}lu(()=>{_e.current=void 0,P.current=void 0,K.current=pn});const _t=H.useMemo(()=>H.createElement(S,ro({},pn,{ref:I})),[I,S,pn]);return H.useMemo(()=>h?H.createElement(J.Provider,{value:W},_t):_t,[J,_t,W])}const C=H.memo(w);if(C.WrappedComponent=S,C.displayName=w.displayName=y,a){const k=H.forwardRef(function(M,J){return H.createElement(C,ro({},M,{reactReduxForwardedRef:J}))});return k.displayName=y,k.WrappedComponent=S,qv(k,S)}return qv(C,S)}}function aY({store:t,context:e,children:n,serverState:r,stabilityCheck:i="once",noopCheck:o="once"}){const s=H.useMemo(()=>{const u=EC(t);return{store:t,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[t,r,i,o]),l=H.useMemo(()=>t.getState(),[t]);lu(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),l!==t.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,l]);const a=e||el;return H.createElement(a.Provider,{value:s},n)}vj(dj.useSyncExternalStoreWithSelector);Jj(sC.useSyncExternalStore);hj(rC.unstable_batchedUpdates);var bC={exports:{}},nU="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",rU=nU,iU=rU;function xC(){}function OC(){}OC.resetWarningCache=xC;var oU=function(){function t(r,i,o,s,l,a){if(a!==iU){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:OC,resetWarningCache:xC};return n.PropTypes=n,n};bC.exports=oU();var sU=bC.exports;const uY=xe(sU);function TC(t){return Fu.sanitize(t,{ALLOWED_TAGS:["#text"],KEEP_CONTENT:!0})}function bl(t,e){return t.reduce((n,r)=>n?r(n):null,e)}var lU=gi,aU=yt,uU=kn,cU="[object String]";function fU(t){return typeof t=="string"||!aU(t)&&uU(t)&&lU(t)==cU}var dU=fU;const Eo=xe(dU),kC=t=>{if(!Array.isArray(t))throw new TypeError("customFilters should be given as an array");if(t.some(e=>typeof e!="function"))throw new TypeError("The given filter is not a function");return!0};var pU=uS;function hU(t,e,n,r){return pU(t,function(i,o,s){e(r,n(i),o,s)}),r}var mU=hU,gU=mU;function yU(t,e){return function(n,r){return gU(n,t,e(r),{})}}var vU=yU,SU=E0,wU=vU,EU=fl,CU=Object.prototype,bU=CU.toString,xU=wU(function(t,e,n){e!=null&&typeof e.toString!="function"&&(e=bU.call(e)),t[e]=n},SU(EU)),OU=xU;const AC=xe(OU);function TU(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var _C=TU;const io=xe(_C);function kU(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r1),o}),GU(t,YU(t),n),r&&(n=VU(n,JU|QU|XU,KU));for(var i=e.length;i--;)WU(n,e[i]);return n}),e5=ZU;const lp=xe(e5),A={AFlat:"Ab",A:"A",ASharp:"A#",BFlat:"Bb",B:"B",C:"C",CSharp:"C#",DFlat:"Db",D:"D",DSharp:"D#",EFlat:"Eb",E:"E",F:"F",FSharp:"F#",GFlat:"Gb",G:"G",GSharp:"G#"},ap={Ab:A.AFlat,A:A.A,"A#":A.ASharp,Bb:A.BFlat,B:A.B,"B#":A.C,Cb:A.B,C:A.C,"C#":A.CSharp,Db:A.DFlat,D:A.D,"D#":A.DSharp,Eb:A.EFlat,E:A.E,"E#":A.F,Fb:A.E,F:A.F,"F#":A.FSharp,Gb:A.GFlat,G:A.G,"G#":A.GSharp},Xv={Lab:A.AFlat,La:A.A,"La#":A.ASharp,Sib:A.BFlat,Si:A.B,"Si#":A.C,Dob:A.B,Do:A.C,"Do#":A.CSharp,Reb:A.DFlat,Réb:A.DFlat,Re:A.D,Ré:A.D,"Re#":A.DSharp,"Ré#":A.DSharp,Mib:A.EFlat,Mi:A.E,"Mi#":A.F,Fab:A.E,Fa:A.F,"Fa#":A.FSharp,Solb:A.GFlat,Sol:A.G,"Sol#":A.GSharp},Zv={...lp(ap,["Bb","B","B#"]),As:A.AFlat,Ais:A.ASharp,Hb:A.BFlat,Hes:A.BFlat,H:A.B,His:A.C,"H#":A.C,Ces:A.B,Cis:A.CSharp,Des:A.DFlat,Dis:A.DSharp,Es:A.EFlat,Eis:A.F,Fes:A.E,Fis:A.FSharp,Ges:A.GFlat,Gis:A.GSharp};function am(t){let e;return Object.keys(t).reduce((n,r)=>(r.match(/.[b|#]$/)&&(e=r.replace("#","♯").replace("b","♭"),n[e]=t[r]),n),{})}const NC={...ap,...am(ap)},MC={...Xv,...am(Xv)},IC={...Zv,...am(Zv)},up={...NC,...MC,...IC};Object.keys(up).sort((t,e)=>e.length-t.length);const t5=Object.keys(NC).sort((t,e)=>e.length-t.length),n5=Object.keys(MC).sort((t,e)=>e.length-t.length),r5=Object.keys(IC).sort((t,e)=>e.length-t.length),i5=[{name:"english",notes:t5},{name:"german",notes:r5},{name:"latin",notes:n5}],tl=[A.A,A.ASharp,A.B,A.C,A.CSharp,A.D,A.DSharp,A.E,A.F,A.FSharp,A.G,A.GSharp],o5=[A.A,A.BFlat,A.B,A.C,A.DFlat,A.D,A.EFlat,A.E,A.F,A.GFlat,A.G,A.AFlat],PC={[A.CSharp]:A.DFlat,[A.DSharp]:A.EFlat,[A.FSharp]:A.GFlat,[A.GSharp]:A.AFlat,[A.ASharp]:A.BFlat},nl=AC(PC),s5=[...Object.values(A),...Object.values(A).map(t=>t+"m")];class l5 extends Error{constructor(){super("The given symbol is not a valid string"),this.name="InvalidInput"}}class a5 extends Error{constructor(){super("An unexpected error happened. Maybe a custom filter returned null instead of throwing an exception?"),this.name="UnexpectedError"}}class um extends Error{constructor(e,n,r){super(e),this.name=r,this.chord=n}}class $C extends um{constructor(e){const n=`"${e.input.symbol}" does not seems to be a chord`;super(n,e,"NoSymbolFound")}}class u5 extends um{constructor(e,n){const r=`The chord descriptor "${e.input.descriptor}" contains unknown or duplicated modifiers: "${n}"`;super(r,e,"InvalidModifier")}}class c5 extends um{constructor(e,n){const r=`"${e.input.symbol}" describes a chord with an invalid intervals combo: `+n.join(" and ");super(r,e,"InvalidIntervals")}}function xl(t,e){const n=Lp(e)?e:[e];return Rs(t,n)}function ae(t,e){return fm(t,e,"oneOf")}function cm(t,e){return fm(t,e,"all")}function Cr(t,e){return fm(t,e,"none")}function fm(t,e,n){return(Lp(e)?e:[e])[n==="oneOf"?"some":"every"](o=>n==="none"?!t.includes(o):t.includes(o))}const f5=[["2","3"],["2","9"],["3","b3"],["4","11"],["5","b5"],["5","#5"],["b6","#5"],["b6","6"],["b6","13"],["6","13"],["b7","bb7"],["7","b7"],["9","b9"],["9","#9"],["11","#11"],["13","b13"]];function d5(t){const e=t.normalized.intervals,n=f5.find(r=>cm(e,r));if(n)throw new c5(t,n);return t}function DC(t){const{rootNote:e,bassNote:n,descriptor:r,chordChanges:i}=t.formatted;let o=e;return r&&(o+=r),i&&i.length&&(o+="("+i.join(",")+")"),n&&(o+="/"+n),t.formatted.symbol=o,t}const R={ma:"major",ma6:"major6",ma7:"major7",dom7:"dominant7",mi:"minor",mi6:"minor6",mi7:"minor7",miMa7:"minorMajor7",aug:"augmented",dim:"diminished",dim7:"diminished7",power:"power",bass:"bass"},RC=[R.mi,R.mi6,R.mi7,R.miMa7,R.dim,R.dim7],p5={[R.ma]:()=>"",[R.ma6]:t=>t.normalized.intervals.includes("9")?"69":"6",[R.ma7]:t=>"ma"+na(t),[R.dom7]:t=>t.normalized.intents.alt?"7alt":na(t),[R.mi]:()=>"mi",[R.mi6]:t=>t.normalized.intervals.includes("9")?"mi69":"mi6",[R.mi7]:t=>"mi"+na(t),[R.miMa7]:t=>"miMa"+na(t),[R.aug]:()=>"+",[R.dim]:()=>"dim",[R.dim7]:()=>"dim7",[R.power]:()=>"5",[R.bass]:()=>" bass"},au={add:"add",add7:"Ma7",omit:"omit",sus:"sus"};function LC(t){return t.formatted={rootNote:t.normalized.rootNote,bassNote:t.normalized.bassNote,descriptor:h5(t),chordChanges:m5(t)},t}function h5(t){let e=p5[t.normalized.quality](t);return t.normalized.isSuspended&&(e+=au.sus),e}function na(t){const e=t.normalized.extensions;let n=e[e.length-1];return n==="11"&&t.normalized.intents.major&&(n=Cr(t.normalized.alterations,["b9","#9"])?"9":"7"),n||"7"}function m5(t){const e=v5(t.normalized.omits);if(g5(t))return e;const n=y5(t.normalized.quality,t.normalized.adds);return[...t.normalized.alterations,...n,...e]}function g5(t){return t.normalized.intents.alt&&t.normalized.quality===R.dom7}function y5(t,e){return e.filter(n=>!([R.ma6,R.mi6].includes(t)&&n==="9")).map((n,r)=>{let i="";return r===0&&(i+=au.add,["b","#"].includes(n[0])&&(i+=" ")),i+=n==="7"?au.add7:n,i})}function v5(t){return t.map((e,n)=>{let r="";return n===0&&(r+=au.omit),r+=e==="b3"?"3":e,r})}const Ni={flat:"♭",sharp:"♯"},S5={major:{0:"I",2:"II",3:`${Ni.flat}III`,4:"III",5:"IV",7:"V",8:`${Ni.flat}VI`,9:"VI",10:`${Ni.flat}VII`,11:"VII"},minor:{0:"I",2:"II",3:"III",4:`${Ni.sharp}III`,5:"IV",7:"V",8:"VI",9:`${Ni.sharp}VI`,10:"VII",11:`${Ni.sharp}VII`}},te={sup2:"²",sup4:"⁴",sup5:"⁵",sup6:"⁶",sup7:"⁷",sub3:"₃",sub4:"₄",sub5:"₅",flat:"♭",sharp:"♯"},ra={major:["I","ii","iii","IV","V","vi","vii°"],dom7:["IΔ",`ii${te.sup7}`,`iii${te.sup7}`,"IVΔ",`V${te.sup7}`,`vi${te.sup7}`,"viiø"],minor:["i","ii°","III","iv","v","VI","VII"],minor7:[`i${te.sup7}`,"iiø","IIIΔ",`iv${te.sup7}`,`v${te.sup7}`,"VIΔ","VIIΔ"]},ia={borrowedFromMinor:["i","ii°",`${te.flat}III`,"iv","v",`${te.flat}VI`,`${te.flat}VII`],borrowedFromMinor7:[`i${te.sup7}`,"iiø",`${te.flat}IIIΔ`,`iv${te.sup7}`,`v${te.sup7}`,`${te.flat}VIΔ`,`${te.flat}VIIΔ`],borrowedFromMajor:["I","ii",`${te.sharp}iii`,"IV","V",`${te.sharp}vi`,`${te.sharp}vii°`],borrowedFromDom7:["IΔ",`ii${te.sup7}`,`${te.sharp}iii${te.sup7}`,"IVΔ",`V${te.sup7}`,`${te.sharp}vi${te.sup7}`,`${te.sharp}viiø`]};function w5(t="",e){let n,r,i;t||(t=e.normalized.rootNote);const o=t.indexOf("m")>-1?"minor":"major",s=RC.includes(e.normalized.quality)?"minor":"major";n=E5(t,o,e,s);const l=T5(e),a=b5[e.normalized.quality](e,l);return r=`${n}${a}`,x5(o,r)?i="diatonic":O5(o,r)?i="borrowed":(i="unknown",n="?",r=`${n}${a}`),r+=l,e.numeral={symbol:r,degree:n,descriptor:a,inversion:l,type:i,thirdQuality:s},e}function E5(t,e,n,r){const i=t.replace("m",""),o=C5(i,n.normalized.rootNote),s=S5[e][o]||"?";return r==="minor"?s.toLowerCase():s}function C5(t,e){const n=tl.indexOf(nl[t]||t);return(tl.indexOf(nl[e]||e)-n+12)%12}const b5={[R.ma]:()=>"",[R.ma6]:()=>"",[R.ma7]:()=>"Δ",[R.dom7]:(t,e)=>e===""?`${te.sup7}`:"",[R.mi]:()=>"",[R.mi6]:()=>"",[R.mi7]:(t,e)=>t.normalized.intervals.includes("b5")?"ø":e===""?`${te.sup7}`:"",[R.miMa7]:()=>"mΔ",[R.aug]:()=>"+",[R.dim]:()=>"°",[R.dim7]:(t,e)=>e===""?`°${te.sup7}`:"°",[R.power]:()=>"",[R.bass]:()=>""};function x5(t,e){return t==="major"?ra.major.includes(e)||ra.dom7.includes(e):ra.minor.includes(e)||ra.minor7.includes(e)}function O5(t,e){return t==="major"?ia.borrowedFromMinor.includes(e)||ia.borrowedFromMinor7.includes(e):ia.borrowedFromMajor.includes(e)||ia.borrowedFromDom7.includes(e)}function T5(t){let e="";return t.normalized.bassNote&&(k5(t)?e=e1(t)?`${te.sup6}${te.sub5}`:`${te.sup6}`:A5(t)?e=e1(t)?`${te.sup4}${te.sub3}`:`${te.sup6}${te.sub4}`:_5(t)&&(e="²")),e}function e1(t){return[R.ma7,R.mi7,R.miMa7,R.dom7,R.dim7].includes(t.normalized.quality)}function k5(t){return br(t,"b3")||br(t,"3")}function A5(t){return br(t,"b5")||br(t,"5")||br(t,"#5")}function _5(t){return br(t,"bb7")||br(t,"b7")||br(t,"7")}function br(t,e){const n=t.normalized.intervals.indexOf(e);if(n===-1)return!1;const r=nl[t.normalized.bassNote]||t.normalized.bassNote,i=nl[t.normalized.notes[n]]||t.normalized.notes[n];return r===i}function N5(t){const e=[M5,I5,P5,$5];return t.input.descriptor&&(t.input.parsableDescriptor=bl(e,t.input.descriptor)),t}function M5(t){return t.replace(/[A-LN-Za-z]+/g,e=>e.toLowerCase()).replace("oMit","omit").replace("diM","dim").replace("augMented","augmented")}function I5(t){return t.replace(/ /g,"")}function P5(t){return t.replace(/(7?dim)(alt|add)/g,"$1 $2").replace(/([m|M])(alt|add)/g,"$1 $2").replace(/i(no[35])/g,"i $1").replace(/([b♭#♯]9)6/g,"$1 6").replace(/(9\/?6)/g," $1").replaceAll("+5","#5").replaceAll("-5","b5")}function $5(t){let e,n,r;return t.replace(/\((.*?)\)/g,(i,o)=>(e=[],n="",o.split(",").forEach(s=>{r=!0,s.startsWith("add")?n="add":s.startsWith("omit")?n="omit":s.startsWith("no")?n="no":r=!1,r?e.push(s):e.push(n+s)})," "+e.join(" ")+" "))}function D5(t={},e){return{input:{symbol:e},normalized:{},formatted:{},parserConfiguration:ie(t)}}const R5={C:"flat",D:"sharp",E:"sharp",F:"flat",G:"sharp",A:"sharp",B:"sharp",Cm:"flat",Dm:"flat",Em:"sharp",Fm:"flat",Gm:"flat",Am:"flat",Bm:"sharp"};function L5(t){return t.indexOf("#")>-1?"sharp":t.indexOf("b")>-1?"flat":R5[t]}function dm(t){const e=t.normalized.rootNote,n=t.normalized.semitones,r=t.normalized.quality;let i=e;RC.includes(r)&&(i+="m");const o=L5(i)==="sharp"?tl:o5,s=o.indexOf(e),l=[...o.slice(s),...o.slice(0,s),...o.slice(s),...o.slice(0,s)];return t.normalized.notes=n.map(a=>l[a]),t}function F5(t){return t.normalized.rootNote=up[t.input.rootNote],t.input.bassNote&&(t.normalized.bassNote=up[t.input.bassNote]),t}var B5=Qp,z5=4;function j5(t){return B5(t,z5)}var U5=j5;const pm=xe(U5);var V5=Lu,W5=vi,H5=Lo;function G5(t){return function(e,n,r){var i=Object(e);if(!W5(e)){var o=V5(n);e=H5(e),n=function(l){return o(i[l],l,i)}}var s=t(e,n,r);return s>-1?i[o?e[s]:s]:void 0}}var K5=G5;function q5(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o-1}var hm=L8;function F8(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=X8){var u=e?null:J8(t);if(u)return Q8(u);s=!1,i=Y8,a=new G8}else a=e?[]:l;e:for(;++r=cV&&(o=uV,s=!1,e=new iV(e));e:for(;++il.qualityIntervals.length-s.qualityIntervals.length);return T8(o,s=>cm(i,s.qualityIntervals))}function CV(t,e,n,r){const i=[bV.bind(null,r),xV.bind(null,n,e.normalized.intents.major),OV.bind(null,e.normalized.intents.alt),jC];return bl(i,pm(t))}function bV(t,e){const n=pm(e);return t.includes("3")?n.push("3"):t.includes("b3")&&n.push("b3"),n}function xV(t,e,n){if(t){const r=VC(n,"4");return r.push(e?"3":"b3"),r}return n}function OV(t,e){if(t){const n=VC(e,"b5","#5");return n.push("5"),n}return e}function TV(t,e){const n=[];return kV(e)&&(AV(t,e)?n.push("9","11","13"):_V(t,e)?n.push("9","13"):NV(t)?n.push("9","11"):MV(t)&&n.push("9")),n}function kV(t){return[R.ma7,R.dom7,R.mi7,R.miMa7].includes(t)}function HC(t){return[R.mi7,R.miMa7].includes(t)}function AV(t,e){return HC(e)&&ae(t,"13")&&ae(t,["11","#11"])&&ae(t,["b9","9","#9"])}function _V(t,e){return!HC(e)&&ae(t,"13")&&ae(t,["b9","9","#9"])}function NV(t){return ae(t,"11")&&ae(t,["b9","9","#9"])}function MV(t){return t.includes("9")}function IV(t,e,n){const r=[],i=[];return t.filter(o=>o!=="5"&&o!=="4").forEach(o=>{e.includes(o)||(PV(n,o)?i.push(o):r.push(o))}),$V(t)&&r.push("3"),{adds:i1(r),alterations:i1(i)}}function PV(t,e){return{[R.ma]:["b5","#5","#11","b13"],[R.ma6]:["b5","#5","#11","b13"],[R.ma7]:["b5","#5","#11","b13"],[R.dom7]:["b5","#5","b9","#9","#11","b13"],[R.mi]:["b5","#5","#11","b13"],[R.mi6]:["b5","#5","#11","b13"],[R.mi7]:["b5","#5","#11","b13"],[R.miMa7]:["b5","#5","#11","b13"],[R.aug]:[],[R.dim]:[],[R.dim7]:[]}[t].includes(e)}function $V(t){return cm(t,["3","4"])}function i1(t){return t.sort((e,n)=>{const r=Number.parseInt(e.replace(/[b#]/,"")),i=Number.parseInt(n.replace(/[b#]/,""));return r-i})}function DV(t,e){const{symbol:n}=e.input,r=t.join("|"),i=new RegExp("^("+r+")(.*?)(/("+r+"))?$"),o=n.match(i);if(o&&o[1])return e.input.rootNote=o[1],o[2]&&(e.input.descriptor=o[2]),o[4]&&(e.input.bassNote=o[4]),e;throw new $C(e)}const b={ma:"ma",mi:"mi",dim:"dim",halfDim:"halfDim",aug:"aug",seventh:"seventh",sus:"sus",sus2:"sus2",ninth:"ninth",eleventh:"eleventh",thirteenth:"thirteenth",fifthFlat:"b5",fifthSharp:"#5",ninthFlat:"b9",ninthSharp:"#9",eleventhSharp:"#11",thirteenthFlat:"b13",add3:"add3",add4:"add4",addb6:"addb6",add6:"add6",add69:"add69",add7:"add7",add9:"add9",add11:"add11",add13:"add13",bass:"bass",omit3:"omit3",omit5:"omit5",power:"power",alt:"alt"},gm={"^":[b.ma,b.add7],Δ:[b.ma,b.add7],M:b.ma,Ma:b.ma,Maj:b.ma,Major:b.ma,ma:b.ma,maj:b.ma,major:b.ma},RV=KC(gm,b.add7,t=>t+"7"),LV=KC(gm,b.add7,t=>"add"+t+"7"),GC={...gm,...RV,"-":b.mi,m:b.mi,Mi:b.mi,Min:b.mi,Minor:b.mi,mi:b.mi,min:b.mi,minor:b.mi,"°":b.dim,o:b.dim,0:b.dim,dim:b.dim,"dim.":b.dim,diminished:b.dim,Ø:b.halfDim,ø:b.halfDim,h:b.halfDim,"+":b.aug,aug:b.aug,augmented:b.aug,7:b.seventh,4:b.sus,sus:b.sus,sus4:b.sus,suspended:b.sus,suspended4:b.sus,sus2:b.sus2,suspended2:b.sus2,9:b.ninth,11:b.eleventh,13:b.thirteenth,b3:b.mi,b5:b.fifthFlat,"♭5":b.fifthFlat,"#5":b.fifthSharp,"♯5":b.fifthSharp,b9:b.ninthFlat,"♭9":b.ninthFlat,addb9:b.ninthFlat,"add♭9":b.ninthFlat,"#9":b.ninthSharp,"♯9":b.ninthSharp,"add#9":b.ninthSharp,"add♯9":b.ninthSharp,"#11":b.eleventhSharp,"♯11":b.eleventhSharp,"add#11":b.eleventhSharp,b13:b.thirteenthFlat,"♭13":b.thirteenthFlat,addb13:b.thirteenthFlat,"add♭13":b.thirteenthFlat,...LV,2:b.add9,add2:b.add9,add3:b.add3,add4:b.add4,addb6:b.addb6,b6:b.addb6,6:b.add6,add6:b.add6,"6/9":b.add69,69:b.add69,96:b.add69,"9/6":b.add69,add9:b.add9,add11:b.add11,add13:b.add13,bass:b.bass,omit3:b.omit3,no3:b.omit3,omit5:b.omit5,no5:b.omit5,5:b.power,alt:b.alt,"alt.":b.alt,altered:b.alt};function KC(t,e,n){return Object.keys(t).map(n).reduce((r,i)=>(r[i]=e,r),{})}const FV=Object.keys(GC).sort((t,e)=>e.length-t.length),uu={1:0,2:2,b3:3,3:4,4:5,b5:6,5:7,"#5":8,b6:8,6:9,bb7:9,b7:10,7:11,b9:13,9:14,"#9":15,11:17,"#11":18,b13:20,13:21};function BV(t,e){let n=[];return e.input.parsableDescriptor&&(n=zV(e)),e.input.modifiers=n,e.normalized.intervals=jV(n,t),e.normalized.semitones=QV(e.normalized.intervals),e.normalized.intents=XV(n),e}function zV(t){const{parsableDescriptor:e}=t.input,n=[],r=new RegExp(FV.map(JV).join("|"),"g"),i=e.match(r);let o=e,s;if(i&&i.forEach(l=>{s=GC[l],Array.isArray(s)||(s=[s]),s.forEach(a=>{n.includes(a)||(n.push(a),o=o.replace(l,""))})}),n.length===0)throw new $C(t);if(o.trim().length>0)throw new u5(t,o);return n}function jV(t,e){return t.includes(b.power)?["1","5"]:t.includes(b.bass)?["1"]:jC(["1",...UV(t),...VV(t),...WV(t,e),...HV(t),...GV(t),...KV(t,e),...qV(t,e),...YV(t,e)]).sort((n,r)=>uu[n]-uu[r])}function UV(t){const e=[];return t.includes(b.omit3)?[]:(ae(t,[b.sus,b.sus2])||(ym(t)?t.includes(b.eleventh)||e.push("3"):e.push("b3")),t.includes(b.add3)&&e.push("3"),e)}function VV(t){const e=[];return ae(t,[b.sus,b.add4])&&e.push("4"),e}function WV(t,e){const n=[];return t.includes(b.omit5)?[]:((ae(t,[b.dim,b.halfDim,b.fifthFlat])||Co(t,e,"b5"))&&n.push("b5"),(ae(t,[b.aug,b.fifthSharp])||Co(t,e,"#5"))&&n.push("#5"),!n.length&&!t.includes(b.thirteenthFlat)&&n.push("5"),n)}function HV(t){const e=[];return ae(t,[b.addb6])&&e.push("b6"),ae(t,[b.add6,b.add69])&&!qC(t)&&!ae(t,[b.halfDim])&&e.push("6"),e}function GV(t){const e=[];return ae(t,[b.alt])&&e.push("b7"),ae(t,[b.seventh,b.halfDim])?t.includes(b.dim)?e.push("bb7"):t.includes(b.halfDim)?e.push("b7"):e.push(o1(t)):ae(t,[b.ninth,b.eleventh,b.thirteenth])&&e.push(o1(t)),t.includes(b.add7)&&e.push("7"),e}function o1(t){return t.includes(b.ma)?"7":"b7"}function KV(t,e){const n=[];return ae(t,[b.add69,b.ninth,b.eleventh,b.thirteenth])&&Cr(t,[b.ninthFlat,b.ninthSharp])&&n.push("9"),ae(t,[b.sus2,b.add9])&&n.push("9"),(ae(t,[b.ninthFlat])||Co(t,e,"b9"))&&n.push("b9"),(ae(t,[b.ninthSharp])||Co(t,e,"#9"))&&n.push("#9"),n}function qV(t,e){const n=[];return(ae(t,[b.thirteenth])&&!ym(t)||ae(t,[b.eleventh,b.add11]))&&n.push("11"),(ae(t,[b.eleventhSharp])||Co(t,e,"#11"))&&n.push("#11"),n}function YV(t,e){const n=[];return(ae(t,[b.add13,b.thirteenth])||ae(t,[b.add6,b.add69])&&qC(t)||ae(t,[b.add6,b.add69])&&ae(t,[b.halfDim]))&&n.push("13"),(ae(t,[b.thirteenthFlat])||Co(t,e,"b13"))&&n.push("b13"),n}function Co(t,e,n){return t.includes(b.alt)&&e.includes(n)}function ym(t){return Cr(t,[b.mi,b.dim,b.dim7,b.halfDim])}function qC(t){return ae(t,[b.seventh,b.ninth,b.eleventh,b.thirteenth])}function JV(t){return t.replace(/[.\-*+?^${}()|[\]\\]/g,"\\$&")}function QV(t){return t.map(e=>uu[e]).sort((e,n)=>e-n)}function XV(t){return{major:ym(t),eleventh:t.includes(b.eleventh),alt:t.includes(b.alt)}}function Cc(t={}){const e=["b5","#5","b9","#9","#11","b13"],n=["english","german","latin"],{notationSystems:r=ie(n),altIntervals:i=ie(e),customFilters:o=[],key:s=""}=t;return ZV(i,e),e9(r,n),kC(o),t9(s),l;function l(a){const u=[];if(!n9(a)){const h=new l5;u.push(cp(h))}const c=ie(i5).filter(h=>r.includes(h.name));let f,d,p;if(!u.length)for(;c.length&&!f;){p=c.shift(),d=[D5.bind(null,t),DV.bind(null,p.notes),N5,BV.bind(null,i),d5,F5,WC,LC,DC,dm,w5.bind(null,s),...o];try{f=bl(d,a),f?f.input.notationSystem=p.name:u.push(r9(p.name))}catch(h){u.push(cp(h,p.name))}}return f||{error:u}}}function ZV(t,e){YC("altIntervals",t,e,!0)}function e9(t,e){YC("notationSystems",t,e)}function YC(t,e,n,r){if(!Array.isArray(e))throw new TypeError(`'${t}' should be an array`);if(!r&&e.length===0)throw new TypeError(`'${t}' cannot be empty`);e.forEach(i=>{if(!n.includes(i))throw new TypeError(`'${i}' is not a valid value for ${t}`)})}function t9(t){if(t!==""&&(!Eo(t)||!s5.includes(t)))throw new TypeError(`'${t}' is not a valid value for key`)}function n9(t){return typeof t=="string"&&t.length>0}function r9(t){const e=new a5;return cp(e,t)}function cp(t,e){return{type:t.name,chord:t.chord,message:t.message,notationSystem:e}}const In={sus2:"sus2",add2:"2",omit:"no",ma:"M",mi:"m",dim:"°",aug7:"7+",eleventh:"11"};function i9(t){let e,n=t.formatted.chordChanges;return o9(t)?(e=In.sus2,n=[]):s9(t)?(e=In.add2,n=[]):l9(t)?(e=In.aug7,n=[]):(e=t.formatted.descriptor.replace("mi",In.mi).replace(/[m|M]a/,In.ma).replace("dim",In.dim),a9(t)&&(e=e.replace(/7sus|9sus/,In.eleventh))),n=n.map(r=>r.replace(/[m|M]a/,In.ma).replace("omit",In.omit)),{...t,formatted:{...t.formatted,descriptor:e,chordChanges:n}}}function o9(t){return xl(t.normalized.intervals,["1","5","9"])}function s9(t){return xl(t.normalized.intervals,["1","3","5","9"])}function l9(t){return xl(t.normalized.intervals,["1","3","#5","b7"])}function a9(t){return t.normalized.intents.eleventh}var u9=UC,c9=Kp,f9=Ao,s1=Mu,d9=f9(function(t,e){return s1(t)?u9(t,c9(e,1,s1,!0)):[]}),p9=d9;const h9=xe(p9);function m9(t="none",e){if(t==="none")return e;const n={max:["4","b5","#5","6","bb7","b7","7","b9","9","#9","11","#11","b13","13"],core:["4","b9","9","#9","11","#11","b13","13"]},r=h9(e.normalized.intervals,n[t]);return Cr(r,["b3","3"])&&r.push(e.normalized.intents.major?"3":"b3"),Cr(r,["b5","5","#5"])&&r.push("5"),e.normalized.intervals=r,e.normalized.semitones=r.map(o=>uu[o]),e.normalized.intents.eleventh=!1,e.normalized.intents.alt=!1,t==="max"&&delete e.normalized.bassNote,bl([WC,LC,dm],e)}function g9(t,e,n){const{rootNote:r,bassNote:i}=n.normalized,o=a1(r);if(n.normalized.rootNote=l1(o,t,e),n.formatted.rootNote=n.normalized.rootNote,i){const s=a1(i);n.normalized.bassNote=l1(s,t,e),n.formatted.bassNote=n.normalized.bassNote}return dm(n)}function l1(t,e,n){const i=tl.indexOf(t)+e,o=Math.floor(i/12),s=i-o*12,l=tl[s];return n==="flat"&&PC[l]||l}function a1(t){return nl[t]||t}const fp={german:{Ab:"As",A:"A","A#":"Ais",Bb:"Hes",B:"H",C:"C","C#":"Cis",Db:"Des",D:"D","D#":"Dis",Eb:"Es",E:"E",F:"F","F#":"Fis",Gb:"Ges",G:"G","G#":"Gis"},latin:{Ab:"Lab",A:"La","A#":"La#",Bb:"Sib",B:"Si",C:"Do","C#":"Do#",Db:"Reb",D:"Re","D#":"Re#",Eb:"Mib",E:"Mi",F:"Fa","F#":"Fa#",Gb:"Solb",G:"Sol","G#":"Sol#"}},y9=Object.keys(fp);function v9(t="english",e){const n=t==="auto"?e.input.notationSystem:t;return n==="english"?e:y9.includes(n)?(e.formatted.rootNote=fp[n][e.formatted.rootNote],e.formatted.bassNote&&(e.formatted.bassNote=fp[n][e.formatted.bassNote]),e):null}function JC(t){return t&&t.formatted&&t.formatted.symbol?t.formatted.symbol:null}function S9(t){delete t.parserConfiguration.notationSystems;const e=ie(t),n=JC(t),i=Cc(t.parserConfiguration)(n);return e.input=i.input,e}function QC({accidental:t="original",customFilters:e=[],notationSystem:n="english",printer:r="text",simplify:i="none",transposeValue:o=0,useShortNamings:s=!1}={}){kC(e);const l=[];return["max","core"].includes(i)&&l.push(m9.bind(null,i)),(t!=="original"||o!==0)&&l.push(g9.bind(null,o,t)),s&&l.push(i9),l.push(v9.bind(null,n),DC,...e),a;function a(u){if(!w9(u))return null;const c=bl(l,ie(u));return r==="raw"?S9(c):JC(c)}}const w9=t=>t&&typeof t=="object"&&!t.error&&t.input,XC=/([^\s]+)/g,dp=/\[([^\]]*)]/g,ZC=t=>{const e=t.trim().match(XC);return e?e.every(tb):!1},eb=t=>{const e=t.trim().match(dp);return e?e.map(n=>n.replace(/[[\]]/g,"")).every(tb):!1};function tb(t){return!Cc()(t).error}const nb=(t,e)=>{for(;t.length&&e(t[0]);)t.shift();for(;t.length&&e(t[t.length-1]);)t.pop();return t},E9={adlib:"a","ad-lib":"a","ad.lib.":"a",bridge:"b",chorus:"c",intro:"i",introduction:"i",outro:"o",prechorus:"p","pre-chorus":"p","pre chorus":"p",solo:"s",interlude:"u",verse:"v"},rb=t=>{let e="#";const n="(.*?)",r="([\\s]+[0-9]{1,2})?",i="([\\s]+[x][0-9]{1,2})?",o=new RegExp(`^${n}${r}${i}$`),[,s,,l]=t.trim().match(o),a=s.trim().toLowerCase();return e+=E9[a]||s.trim(),l&&(e+=" "+l.trim()),e},ct={EMPTY:"empty",DIRECTIVE:"directive",COMMENT:"comment",LYRICS:"lyrics",CHORDS_LYRICS:"chordsLyrics",SECTION_START:"sectionStart",SECTION_CLOSE:"sectionClose",SECTION_REPEAT:"sectionRepeat"},C9=["chorus","verse","bridge","comment","comment_italic","comment_bold","c","ci","cb"],b9=["start_of_chorus","start_of_verse","start_of_bridge","start_of_part","soc","sov","sob","sop"],x9=["end_of_chorus","end_of_verse","end_of_bridge","end_of_part","eoc","eov","eob","sop"],O9={chorus:"c",verse:"v",bridge:"b",start_of_chorus:"c",start_of_verse:"v",start_of_bridge:"b",start_of_part:"v",soc:"c",sov:"v",sob:"b",sop:"v",c:"c",ci:"c",cb:"c",comment:"c",comment_italic:"c",comment_bold:"c"},T9=t=>{const e=[],n=t.map(i=>k9(i)).filter(i=>P9(i)),r=$9(n);return r.forEach((i,o)=>{e.push(i.label),i.allLines.forEach(s=>{e.push(s)}),o{const e={content:t};if(A9(t))e.type=ct.COMMENT;else if(_9(t))e.type=ct.EMPTY;else if(N9(t)){const[n,r]=M9(t);e.key=n,e.value=r,b9.includes(n)?e.type=ct.SECTION_START:x9.includes(n)?e.type=ct.SECTION_CLOSE:C9.includes(n)?e.type=ct.SECTION_REPEAT:e.type=ct.DIRECTIVE}else if(eb(t)){e.type=ct.CHORDS_LYRICS;const[n,r]=I9(t);e.chords=n,e.lyrics=r}else e.type=ct.LYRICS;return e},A9=t=>{const e=/^#.*$/;return t.trim().match(e)!==null},_9=t=>t.trim()==="",ib=/^{([^:]+):?(.*)?}$/,N9=t=>t.trim().match(ib)!==null,M9=t=>{const e=t.trim().match(ib),n=e[1].trim(),r=e[2]?e[2].trim():void 0;return[n,r]},I9=t=>{const n=t.trim().match(dp).map(i=>i.replace("[","").replace("]","")).join(" "),r=t.replace(dp,"_");return[n,r]},P9=t=>![ct.COMMENT,ct.DIRECTIVE].includes(t.type),$9=t=>{let e=[],n;const r=()=>{n&&(e.push(n),n=void 0)},i=o=>{n={label:o?D9(o):"#v",allLines:[]}};return t.forEach(o=>{o.type===ct.SECTION_START?(r(),i(o)):o.type===ct.SECTION_CLOSE?r():o.type===ct.SECTION_REPEAT?(r(),i(o),r()):o.type===ct.EMPTY?n&&n.allLines.push(o.content):(n||i(),o.type===ct.CHORDS_LYRICS?(n.allLines.push(o.chords),n.allLines.push(o.lyrics)):n.allLines.push(o.content))}),r(),e.map(o=>(o.allLines=nb(o.allLines,s=>s===""),o))},D9=t=>{let e;return t.value?e=rb(t.value):e="#"+O9[t.key],e},R9=t=>{let n=0;return t.replace(/\t/g,(i,o)=>{let s=4-(o+n)%4;return n+=s-1," ".repeat(s)}).length},ni=(t,e,n)=>(n>t.length&&(t+=" ".repeat(n-t.length)),t.slice(0,n)+e+t.slice(n)),L9=t=>{const e=[];let n=[];return t.forEach(r=>{ZC(r)?(e.push(z9(r)),n=j9(r)):(F9(r)?e.push(B9(r)):n.length&&r.trim()!==""?e.push(W9(r,n)):e.push(r),n=[])}),e.join(`
-`)},ob=/^\[([^\]]+)]$/,F9=t=>{const e=t.trim().match(ob);return e!==null&&e[1].trim()!==""},B9=t=>{const e=t.trim().match(ob)[1];return rb(e)};function z9(t){return t.match(XC).join(" ")}function j9(t){const e=[];let n=0;const r=t.match(/([\s])+/g)||[],i=t.match(/([^\s])+/g);return U9(t)||r.unshift(""),V9(t)&&r.pop(),r.forEach((o,s)=>{const l=R9(" ".repeat(n)+o);e.push(l),n=l+i[s].length}),e}const U9=t=>sb(t.charAt(0)),V9=t=>sb(t.charAt(t.length-1)),sb=t=>t.match(/[\s]/),W9=(t,e)=>{const n="_";let r=t,i=0;return e.forEach(o=>{const s=Math.min(o+i,r.length+1);r=ni(r,n,s),i+=n.length}),r.replace(/[\s]+/g," ").trim()},Wr={AUTO:"auto",CP:"chordPro",COL:"chordsOverLyrics"},cY=(t,{inputFormat:e=Wr.AUTO}={})=>{H9(e);const n=G9(t);let r=e;e===Wr.AUTO&&(r=K9(n)?Wr.CP:Wr.COL);let i;switch(r){case Wr.CP:i=T9;break;case Wr.COL:i=L9;break}return i(n)},H9=t=>{if(!Object.values(Wr).includes(t))throw new Error("unknown input format: "+t)},G9=t=>TC(t).replace(/\r\n/g,`
-`).replace(/\n\r/g,`
-`).replace(/\r/g,`
-`).replace(/\[\/?ch]/g,"").replace(/\[\/?tab]/g,"").split(`
-`),K9=t=>{const e=t.filter(eb),n=t.filter(ZC);return e.length>n.length};function q9(t){return Fu.sanitize(t)}function lb(t){return Fu.sanitize(t,{ALLOWED_TAGS:["#text"],KEEP_CONTENT:!0})}const V={CHORD:"chord",EMPTY_LINE:"emptyLine",KEY_DECLARATION:"keyDeclaration",LYRIC:"lyric",SECTION_LABEL:"sectionLabel",TIME_SIGNATURE:"timeSignature"};var Y9=J0,ab=/[\\^$.*+?()[\]{}|]/g,J9=RegExp(ab.source);function Q9(t){return t=Y9(t),t&&J9.test(t)?t.replace(ab,"\\$&"):t}var X9=Q9;const Nr=xe(X9);function Yn(t){return t.replace(/\t+/g," ").replace(/ +/g," ").trim()}const Z9=["2/2","3/2","4/2","2/4","3/4","4/4","5/4","6/4","7/4","9/4","10/4","3/8","4/8","5/8","6/8","7/8","9/8","12/8"];function rl(t){return Z9.includes(t)}function cu(t){if(!rl(t))throw new TypeError("Expected time signature string, received: "+t);const e=t.split("/"),n=Number.parseInt(e[0],10),r=Number.parseInt(e[1],10);let i=n;return r===2?i=n*2:r===8&&(i=n/3),{string:t,count:n,value:r,beatCount:i}}const ce={barRepeat:"%",chordBeatCount:".",chordLineRepeat:"%",chordPositionMarker:"_",lyricLine:":",keyDeclarationPrefix:"key ",noChord:"NC",sectionLabel:"#",subBeatOpener:"[",subBeatCloser:"]"},ub=cu("4/4");function eW(t){return!Cc()(t).error}const tW=new RegExp(Nr(ce.chordBeatCount)+"*$","g"),nW=new RegExp("^"+Nr(ce.barRepeat)+"+$");function rW(t=""){return Yn(cb(t)).split(" ").every((e,n,r)=>{const i=fb(e);return eW(i)||e.match(nW)&&n>0||i===ce.noChord||rl(e)&&r.length>1})}const cb=t=>t.replaceAll("add ","add"),fb=t=>oW(iW(t)),iW=t=>t.replace(tW,""),oW=t=>{let e=t;return t.startsWith(ce.subBeatOpener)&&(e=e.substring(ce.subBeatOpener.length)),t.endsWith(ce.subBeatCloser)&&(e=e.substring(0,e.length-ce.subBeatCloser.length)),e};function sW(t){const e=Yn(t);return e===ce.chordLineRepeat||e===ce.chordLineRepeat.repeat(2)}function u1(t){return Yn(t)===""}const db=new RegExp("^"+Nr(ce.sectionLabel)+"([a-zA-Z]+)([1-9])?( x[1-9][0-9]?)?$");function fu(t){return Yn(t).match(db)!==null}function lW(t,e={}){return Cc({key:e.string})(t)}var aW=dn,uW=aW.isFinite;function cW(t){return typeof t=="number"&&uW(t)}var fW=cW;const oo=xe(fW);class dW extends Error{constructor({string:e,duration:n,currentBeatCount:r,beatCount:i}={}){if(!e||!Eo(e))throw new TypeError("InvalidBeatCountException cannot be created without chord string, received: "+e);if(!n||!oo(n))throw new TypeError("InvalidBeatCountException cannot be created without chord duration, received: "+n);if(!r||!oo(r))throw new TypeError("InvalidBeatCountException cannot be created without currentBeatCount, received: "+r);if(!i||!oo(i))throw new TypeError("InvalidBeatCountException cannot be created without beatCount, received: "+i);super(),this.name="InvalidBeatCountException",this.string=e,this.duration=n,this.currentBeatCount=r,this.beatCount=i}}class pW extends Error{constructor({string:e}={}){if(!e||!Eo(e))throw new TypeError("InvalidChordRepetitionException cannot be created without chord string, received: "+e);super(),this.name="InvalidChordRepetitionException",this.string=e}}class As extends Error{constructor({chordLine:e,symbol:n,position:r}={}){if(!e||!Eo(e))throw new TypeError("InvalidSubBeatGroupException cannot be created without a chordLine, received: "+e);if(!n||!Eo(n))throw new TypeError("InvalidSubBeatGroupException cannot be created without symbol, received: "+n);if(!oo(r))throw new TypeError("InvalidSubBeatGroupException cannot be created without symbol position, received: "+r);super(),this.name="InvalidSubBeatGroupException",this.chordLine=e,this.symbol=n,this.position=r}}class hW extends Error{constructor({string:e}={}){if(!e||!Eo(e))throw new TypeError("InvalidBarRepeatException cannot be created without chord string, received: "+e);super(),this.name="InvalidBarRepeatException",this.string=e}}const mW=new RegExp(Nr(ce.chordBeatCount),"g"),gW=new RegExp("^"+Nr(ce.barRepeat)+"+$");function yW(t,{timeSignature:e=ub,originalKey:n={}}={}){let{beatCount:r}=e;const i=[],o={allChords:[]},s={};let l=ie(o),a={},u,c=0,f,d=!1,p=0,h=!1;MW(t);const v=Yn(cb(t)).split(" ");return v.forEach((C,O)=>{C.match(gW)?S(C):rl(C)?m(C):(y(C),xW(c,r)?x():OW(a,c,r,v.length===O+1))}),NW(i,s),{allBars:i,originalKey:n};function S(C){if(c===0&&f&&Rs(e,f.timeSignature)){const O=ie(f);O.isRepeated=!0;for(let k=0;k4)throw new As({chordLine:t,symbol:C,position:0})}function x(){l.timeSignature=e,l.lineHadTimeSignatureChange=h,l.hasUnevenChordsDurations=_W(l);const C=ie(l);l.isRepeated=Rs(l,f),i.push(ie(l)),f=C,l=ie(o),c=0}}function vW(t,e){if(SW(e))throw new As({chordLine:t,symbol:e,position:0})}function SW(t){return t.indexOf(ce.chordBeatCount)>-1}function wW(t){return t===ce.noChord}function EW(t,e,n){return n?0:(t.match(mW)||[]).length||e}function CW(t,e){if(t.allChords.length>0){const n=t.allChords[t.allChords.length-1];if(Rs(n.model,e.model)&&!bW(n,e))throw new pW({string:e.string})}}function bW(t,e){return e.string.startsWith(ce.subBeatOpener)||t.string.endsWith(ce.subBeatCloser)&&!e.model.isInSubBeatGroup}function xW(t,e){return t===e}function OW(t,e,n,r){if(TW(e,n,r))throw new dW({string:t.string,duration:t.duration,currentBeatCount:e,beatCount:n})}function TW(t,e,n){return kW(t,e)||AW(t,e,n)}function kW(t,e){return t>e}function AW(t,e,n){return n&&tn.duration!==e)}function NW(t,e){let n=-1,r=0,i="";t.forEach((o,s)=>{o.allChords.forEach(l=>{if(l.isInSubBeatGroup){const a=s+l.beat;a!==i&&(n++,r=0);const u=(1/e[n]).toPrecision(2);l.duration=Number.parseFloat(u),l.isFirstOfSubBeat=r===0,l.isLastOfSubBeat=r===e[n]-1,i=a,r++}})})}function MW(t){const e={};let n=!1,r;const i=new RegExp(Nr(ce.subBeatOpener)+"|"+Nr(ce.subBeatCloser),"g");for(;r=i.exec(t);){const o=r[0];if(e.chordLine=t,e.symbol=o,e.position=i.lastIndex-1,r[0]===ce.subBeatOpener){if(n)throw new As(e);n=!0}else{if(!n)throw new As(e);n=!1}}if(n)throw new As(e)}const sr="A,A#,B,C,C#,D,D#,E,F,F#,G,G#".split(","),IW="Ab,Bb,Db,Eb,Gb".split(","),c1=[...sr,...IW],PW=[...c1,...c1.map(t=>t+"m")],du={Ab:"G#",Bb:"A#",Db:"C#",Eb:"D#",Gb:"F#"},$W=AC(du);function DW(t){return PW.includes(t)}function vm(t){return["G","Em","D","Bm","A","F#m","E","C#m","B","G#m","F#","D#m","C#","A#m","G#","D#","A#"].includes(t)?"sharp":"flat"}function f1(t,e,n){const r={"G#":"Ab","D#":"Eb","A#":"Bb",Dbm:"C#m",Gbm:"F#m"};let i;if(e===0&&n==="auto")i=t.string;else{const s=n==="auto"?e<0?"flat":"sharp":n;i=RW(t.string,e,s)}const o=n==="auto"&&r[i]?r[i]:i;return{string:o,accidental:vm(o)}}function RW(t,e,n){const r=t.endsWith("m"),i=t.replace("m",""),o=du[i]||i;let l=sr.indexOf(o)+e;l<0?l+=sr.length:l>=sr.length&&(l-=sr.length);const a=sr[l],u=n==="flat"&&$W[a]||a;return r?u+"m":u}function LW(t){const e=FW(t);return e?{string:e,accidental:vm(e)}:void 0}function FW(t){const e=BW(t);if(e.length===0)return;if(e.length===1)return e[0].keyString;const n=e.find(i=>i.isLast===!0);if(n)return n.keyString;const r=e.find(i=>i.isFirst===!0);return r?r.keyString:e[0].keyString}function BW(t){let e=0,n=[];const r=[];return ie(t).map(i=>(i.keyString=zW(i),i)).forEach(i=>{const o=zC(r,s=>s.keyString===i.keyString);o===-1?r.push(i):(r[o].duration+=i.duration,i.isLast&&(r[o].isLast=!0))}),r.map(i=>(i.isLast&&(i.duration*=1.25),i.isFirst&&(i.duration*=1.25),i)).forEach(i=>{i.duration>e?(n=[i],e=i.duration):i.duration===e&&n.push(i)}),n}function zW(t){const e=ie(t.model),n=["major","major6","major7","dominant7","augmented","power","bass"];let r=e.formatted.rootNote;return n.includes(e.normalized.quality)||(r+="m"),r}function jW(t,e){return!t||!e?0:UW(t.replace("m",""),e.replace("m",""))}function UW(t,e){const n=du[t]||t,r=du[e]||e,i=sr.indexOf(n),o=sr.indexOf(r);if(i===-1||o===-1)return 0;const s=o-i;return s<0?s+12:s}const pb=new RegExp("^"+Nr(ce.keyDeclarationPrefix)+"([ABCDEFG].*)$");function pp(t){const e=Yn(t).match(pb);return e===null?!1:DW(e[1])}function VW(t){if(!pp(t))throw new TypeError("Expected key declaration, received: "+t);const n=Yn(t).match(pb)[1];return{string:n,accidental:vm(n)}}function WW(t){const e=t.startsWith(ce.lyricLine)?t.substring(1):t,n=new RegExp(ce.chordPositionMarker,"g"),r=e.replace(n,""),i=[];let o=e,s;for(;(s=o.indexOf(ce.chordPositionMarker))!==-1;)i.includes(s)||i.push(s),o=o.replace(ce.chordPositionMarker,"");return{lyrics:r,chordPositions:i}}function HW(t){if(!fu(t))throw new TypeError("Expected section identifier string, received: "+t);const e=Yn(t).match(db);return{string:t,label:e[1],copyIndex:e[2]?Number.parseInt(e[2]):1,multiplyTimes:e[3]?Number.parseInt(e[3].replace(" x","")):0}}function GW(t,e){const n=ie(t);return n.forEach(r=>{r.type===V.CHORD&&r.model.allBars.forEach(i=>{i.allChords.forEach(o=>{e(o)})})}),n}function d1(t,e){const n=ie(t);return n.allBars.forEach((r,i)=>{r.allChords.forEach((o,s)=>{e(o,s,i)})}),n}function Mf(t,e,n){const r=[],i={};let o=!1,s="";for(t.forEach(l=>{l.type===V.SECTION_LABEL?(s=l.model.label,i[s]?i[s]++:i[s]=1,o=l.id===e+n):o&&r.push(l)});io(r)&&(io(r).type===V.KEY_DECLARATION||io(r).type===V.TIME_SIGNATURE);)r.pop();return r}const KW="4/4";function qW(){const t=[],e={};let n=cu(KW),r,i,o={};const s=2;let l=[],a,u=[],c=0,f=!1,d=!1;function p(T){return n=cu(T),{string:T,type:V.TIME_SIGNATURE,model:n}}function h(T){return o=VW(T),{string:T,type:V.KEY_DECLARATION,model:ie(o)}}function v(T,B,G){r=HW(T),x(r.label),i=C(r.label);const q={string:T,type:V.SECTION_LABEL,model:r,index:i.count,indexWithoutMultiply:i.withoutMultiply,id:r.label+i.count};return d=M(B,G)&&i.count>1,d&&(q.isFromSectionCopy=!0),f=r.multiplyTimes>0,a=ie(q),u=i.count>1?Mf(t,r.label,1):[],c=0,q}function S(T){return{string:T,type:V.EMPTY_LINE}}function m(T){let B;try{const G=yW(T,{timeSignature:n,originalKey:o});B={string:T,type:V.CHORD,model:G},y(B)}catch{B=w(T)}return B}function y(T){l.length>=s&&l.shift(),l.push(T)}function g(T){const B=Yn(T),G=-B.length,q=G<-1?G+1:void 0;return l.length>=B.length?{...ie(...l.slice(G,q)),isFromChordLineRepeater:!0}:w(T)}function w(T){return{string:T,type:V.LYRIC,model:WW(T)}}function x(T,B=!1){e[T]?(e[T].count++,B||e[T].withoutMultiply++):e[T]={count:1,withoutMultiply:1}}function C(T){return e[T]}function O(T){if(u.length&&T.type!==V.SECTION_LABEL){let B=u[c],G;for(;k(B,T);)B.type===V.CHORD&&y(ie(B)),G={...ie(B),isFromAutoRepeatChords:!0},t.push(G),c++,B=u[c];c++}}function k(T,B){const G=[V.LYRIC,V.EMPTY_LINE];return T&&!G.includes(T.type)&&T.type!==B.type&&B.type!==V.EMPTY_LINE}function I(){if(d){const T=Mf(t,r.label,r.copyIndex).map(B=>({...ie(B),isFromSectionCopy:!0}));if(!T.length)return;QW(T)&&T.pop(),t.push(...ie(T)),d=!1}}function M(T,B){const G=B.slice(T+1);let q=G.findIndex(De=>fu(De));return q===0?!0:G.slice(0,q!==-1?q:void 0).filter(De=>!(rl(De)||pp(De)||u1(De))).length===0}function J(T,B){if(f&&YW(T,B)){const G=Mf(t,r.label,i.count).map(he=>({...ie(he),isFromSectionMultiply:!0}));let q;for(let he=1;he{T=t[q+1],JW(G,T)?(B=0,G.model.hasPositionedChords=!0,G.model=d1(G.model,he=>{he.isPositioned=B{he.isPositioned=!1}))})}}}function YW(t,e){const n=e[t+1];return typeof n>"u"||fu(n)}function JW(t,e){return t.type===V.CHORD&&e&&e.type===V.LYRIC&&e.model.chordPositions.length>0}function QW(t){return t[t.length-1].type===V.EMPTY_LINE}function XW(t){const e=[];let n;return GW(t,r=>{r.model!==ce.noChord&&(n=zC(e,i=>Rs(lp(i.model,["numeral"]),lp(r.model,["numeral"]))),n===-1?(e.push({model:ie(r.model),occurrences:1,duration:r.duration}),n=e.length-1):(e[n].occurrences++,e[n].duration+=r.duration))}),e.length&&(e[0].isFirst=!0,e[n].isLast=!0),e}function ZW(t,e){const n={auto:void 0,explicit:[]};if(t.forEach(r=>{r.type===V.KEY_DECLARATION&&n.explicit.push(ie(r.model))}),n.explicit.length===0){const r=LW(e);r&&(n.auto=r)}return n}function fY(t){const e=Lp(t)?t:t.split(`
-`),n=qW();e.map(q9).map(lb).forEach(n.addLine),n.flagPositionedChords();const r=n.asArray(),i=XW(r),o=ZW(r,i);return{allLines:r,allChords:i,allKeys:o}}const re={barRepeat:"%",barSeparator:"|",chordBeat:".",chordLineOffsetSpacer:" ",emptyBeatSpaces:1,keyDeclarationPrefix:"key: ",lyricsSpacer:" ",noChordSymbol:"NC",spacesAfterDefault:2,spacesAfterSubBeatDefault:1,spacesAfterTimeSignature:1,subBeatGroupOpener:"[",subBeatGroupCloser:"]"};function hb(t,e,{shouldPrintSubBeatDelimiters:n=!0,symbolType:r="chord"}={}){const i=t.allChords.filter(o=>o.beat===e);switch(i.length){case 0:return"";case 1:return hp(t,i[0],{shouldPrintSubBeatDelimiters:n,symbolType:r});default:return i.reduce((o,s,l)=>{const a=l>0?" ".repeat(re.spacesAfterSubBeatDefault):"";return o+a+hp(t,s,{shouldPrintSubBeatDelimiters:n,symbolType:r})},"")}}function hp(t,e,{shouldPrintSubBeatDelimiters:n,symbolType:r="chord"}){const o=r==="chord"||e.model===re.barRepeat||e.model===re.noChordSymbol?e.symbol:e.model.numeral.symbol;if(e.isInSubBeatGroup)return n&&e.isFirstOfSubBeat?re.subBeatGroupOpener+o:n&&e.isLastOfSubBeat?o+re.subBeatGroupCloser:o;{const s=t.shouldPrintChordsDuration?re.chordBeat.repeat(e.duration):"";return o+s}}function e7(t,{shouldAlignChordsWithLyrics:e,shouldPrintSubBeatDelimiters:n=!0,symbolType:r="chord"}){const i=[];return t.filter(o=>o.type===V.CHORD).filter(o=>!e(o)).forEach(o=>{o.model.allBars.filter(s=>!s.lineHadTimeSignatureChange).forEach((s,l)=>{if(!i[l]){i[l]={};for(let a=1;a<=s.timeSignature.beatCount;a++)i[l][a]=0}s.allChords.filter(a=>!a.isInSubBeatGroup||a.isLastOfSubBeat).forEach(a=>{const u=hb(s,a.beat,{shouldPrintSubBeatDelimiters:n,symbolType:r});i[l][a.beat]=Math.max(i[l][a.beat],u.length)})})}),i}function t7(t){const e=ie(t);return e.allBars.forEach(n=>{mb(n)}),e}function mb(t){t.allChords.forEach(e=>{e.spacesAfter=e.isInSubBeatGroup&&!e.isLastOfSubBeat?re.spacesAfterSubBeatDefault:re.spacesAfterDefault,e.spacesWithin=0})}function n7(t,e,{shouldPrintBarSeparators:n=!0,shouldPrintSubBeatDelimiters:r=!0,symbolType:i="chord"}){const o=ie(t);return o.allBars.forEach((s,l)=>{s.lineHadTimeSignatureChange?mb(s):s.allChords.forEach(a=>{const u=hb(s,a.beat,{shouldPrintSubBeatDelimiters:r,symbolType:i});a.isInSubBeatGroup&&!a.isLastOfSubBeat?(a.spacesWithin=0,a.spacesAfter=re.spacesAfterSubBeatDefault):(a.spacesWithin=e[l][a.beat]-u.length,a.spacesAfter=0),r7(s,a)&&(a.spacesAfter=re.spacesAfterDefault+i7(s,a,e[l])),o7(s,a,n)&&(a.spacesAfter=re.spacesAfterDefault)})}),o}const r7=(t,e)=>(!e.isInSubBeatGroup||e.isLastOfSubBeat)&&!gb(t,e),i7=(t,e,n)=>{let r=0;for(let i=e.beat+1;ie.beat===t.timeSignature.beatCount,o7=(t,e,n)=>!n&&gb(t,e)&&(!e.isInSubBeatGroup||e.isLastOfSubBeat),If=1;function s7(t,e,{shouldPrintBarSeparators:n=!0,shouldPrintSubBeatDelimiters:r=!0,shouldPrintInlineTimeSignatures:i=!0,symbolType:o="chord"}={}){if(l7(e))return{chordLine:t,lyricsLine:e};const s=ie(t),l=ie(e),a=l.chordPositions.map((m,y,g)=>l.lyrics.substring(m,g[y+1]));let u="",c="",f,d;if(s.allBars.forEach((m,y)=>{m.allChords.forEach((g,w,x)=>{if(d=a.shift(),d){u=w===0&&i&&m.shouldPrintBarTimeSignature?m.timeSignature.string+re.spacesAfterTimeSignature:"";const C=y===0&&w===0&&l.chordPositions[0]===0;f=p(m,g,C),d=h(C,g.isFirstOfSubBeat);const O=w===x.length-1,k=x[w+1]&&x[w+1].isFirstOfSubBeat;if(d.length-f.length>0){const I=a.length===0;g.spacesAfter=v(O,I,k)}else g.spacesAfter=If,d+=re.lyricsSpacer.repeat(S(O,k));c+=d}else g.spacesAfter=If;g.spacesWithin=0})}),a7(l)){const m=l.chordPositions[0];s.offset=m,n&&s.offset--,c=l.lyrics.substring(0,m)+c}return a.length&&(c+=a.join("")),l.lyrics=u7(c),{chordLine:s,lyricsLine:l};function p(m,y,g){let w=u+hp(m,y,{shouldPrintSubBeatDelimiters:y.isLastOfSubBeat&&r,symbolType:o});return g&&(r&&y.isFirstOfSubBeat&&(w=re.subBeatGroupOpener+w),n&&(w=re.barSeparator+w)),w}function h(m,y){let g=d;if(c7(g))g=re.lyricsSpacer.repeat(f.length-1)+g;else{if(m){let w=0;n&&w++,r&&y&&w++,g=re.lyricsSpacer.repeat(w)+g}u.length&&(g=" ".repeat(u.length)+g)}return g}function v(m,y,g){let w=d.length-f.length;return(m&&n&&!y||!m&&r&&g)&&(w>1?w-=1:d+=re.lyricsSpacer),w}function S(m,y){let g=f.length-d.length+If;return(m&&n||y)&&g++,g}}const l7=t=>t.chordPositions.length===0,a7=t=>t.chordPositions[0]>0,u7=t=>{const e=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;return t.replace(e,"")},c7=t=>t.indexOf(" ")===0,f7=({chordLineOffset:t,chordLine:e,symbolType:n})=>{const r=["cmChordLine"];return n==="roman"&&r.push("cmChordLine-romanNumeral"),`${t?`${t}`:""}${e}`},d7=({chordSymbol:t,chordDuration:e,subBeatGroupOpener:n,subBeatGroupCloser:r,numeralType:i})=>{const o=n?`${n}`:"",s=r?`${r}`:"",l=["cmChordSymbol"];return i&&l.push("cmRomanNumeral",`cmRomanNumeral-${i}`),`${o}${t}${e?`${e}`:""}${s}`};function p7(t,{shouldPrintChordsDuration:e=!1,shouldPrintSubBeatOpener:n=!1,shouldPrintSubBeatCloser:r=!1,symbolType:i="chord"}){const o=i==="chord"||t.model===re.barRepeat||t.model===re.noChordSymbol,s=o?t.symbol:t.model.numeral.symbol;return d7({chordSymbol:s,chordDuration:e?re.chordBeat.repeat(t.duration):!1,subBeatGroupOpener:n?re.subBeatGroupOpener:"",subBeatGroupCloser:r?re.subBeatGroupCloser:"",numeralType:o?"":t.model.numeral.type})}const h7=({timeSignature:t})=>`${t}`;function yb(t){return h7({timeSignature:t.string})}const m7=({barContent:t})=>`${t}`,p1=" ",g7=0,y7=2;function v7(t,e=!1,{shouldPrintBarSeparators:n=!0,shouldPrintSubBeatDelimiters:r=!0,shouldPrintTimeSignature:i=!1,symbolType:o="chord"}={}){let s=0,l=0,a="";return i&&(a+=yb(t.timeSignature)+" ".repeat(re.spacesAfterTimeSignature)),a+=t.allChords.reduce((u,c,f)=>{s=oo(c.spacesWithin)?c.spacesWithin:g7,l=oo(c.spacesAfter)?c.spacesAfter:y7,u+=p7(c,{shouldPrintChordsDuration:c.isInSubBeatGroup?!1:t.shouldPrintChordsDuration,shouldPrintSubBeatOpener:r&&c.isFirstOfSubBeat,shouldPrintSubBeatCloser:r&&c.isLastOfSubBeat,symbolType:o}),d()&&(u+=p1.repeat(s)+p1.repeat(l));function d(){const p=S7(t,f)&&e;return!p||p&&n}return u},""),m7({barContent:a})}function S7(t,e){return!t.allChords[e+1]}const w7=({barSeparator:t})=>`${t}`;function E7(t,{shouldPrintBarSeparators:e=!0,shouldPrintSubBeatDelimiters:n=!0,shouldPrintInlineTimeSignatures:r=!0,symbolType:i="chord"}={}){const o=t.allBars.map((u,c)=>{const f=!t.allBars[c+1],d=r&&u.shouldPrintBarTimeSignature;return v7(u,f,{shouldPrintBarSeparators:e,shouldPrintSubBeatDelimiters:n,shouldPrintTimeSignature:d,symbolType:i})}),s=e?w7({barSeparator:re.barSeparator}):"",l=s+o.join(s)+s,a=re.chordLineOffsetSpacer.repeat(t.offset||0);return f7({chordLineOffset:a,chordLine:l,symbolType:i})}const C7=({chordLyricsPairs:t})=>{let e='';return t.forEach(n=>{e+=`${n.chords||" "}${n.lyrics}`}),e+="",e};var b7=$u,x7=hm,O7=mm,T7=Si,k7=Po,h1=Du,A7=Math.min;function _7(t,e,n){for(var r=n?O7:x7,i=t[0].length,o=t.length,s=o,l=Array(o),a=1/0,u=[];s--;){var c=t[s];s&&e&&(c=T7(c,k7(e))),a=A7(c.length,a),l[s]=!n&&(e||i>=120&&c.length>=120)?new b7(s&&c):void 0}c=t[0];var f=-1,d=l[0];e:for(;++f{if(r.nodeType===Node.TEXT_NODE){const i=r.textContent;for(const o of i)e.push(_s(o,n.i)),n.i++}else U7.includes(r.classList.value)?(e.push(_s(r.textContent,n.i,r.outerHTML)),n.i+=r.textContent.length):vb(r,e,n)})}function _s(t,e,n){return{text:t,textIndex:e,html:n}}function H7(t){const e=[],n=lb(t);let r="";return Array.from(n).forEach((i,o)=>{i===" "?(r&&(e.push(_s(r,o-r.length)),r=""),e.push(_s(" ",o))):r+=i}),e.push(_s(r,n.length-r.length)),e}function G7(t,e){const n=m1(t),r=m1(e),i=z7(n,r);let o,s;io(n)>io(r)?(s=n,o=r):(s=r,o=n);const l=s.filter(a=>a>io(o));return l.length&&i.push(...l),i.shift(),i}function m1(t){const e=t.map(r=>r.textIndex),n=t.reduce((r,i)=>r+i.text,"").length;return e.push(n),e}function K7(t,e,n){const r=[];return t.forEach(i=>{let o="",s="";for(;e.length&&e[0].textIndex' ';function Y7(){return q7()}const J7=({keyDeclarationPrefix:t,key:e})=>`${t}${e}`;function Q7(t){return J7({keyDeclarationPrefix:re.keyDeclarationPrefix,key:t.symbol})}const X7=({line:t,lineClasses:e,shouldOpenSection:n,sectionWrapperClasses:r,shouldClosePriorSection:i,shouldCloseFinalSection:o})=>{let s="";return i&&(s+=""),n&&(s+=`"),s};function Z7(t,{isFromAutoRepeatChords:e=!1,isFromChordLineRepeater:n=!1,isFromSectionCopy:r=!1,isFromSectionMultiply:i=!1,shouldOpenSection:o=!1,shouldClosePriorSection:s=!1,shouldCloseFinalSection:l=!1,sectionWrapperClasses:a=[]}={}){const u=["cmLine"];return e&&u.push("cmLine--isFromAutoRepeatChords"),n&&u.push("cmLine--isFromChordLineRepeater"),r&&u.push("cmLine--isFromSectionCopy"),i&&u.push("cmLine--isFromSectionMultiply"),X7({line:t,lineClasses:u.join(" "),shouldOpenSection:o,sectionWrapperClasses:a.join(" "),shouldClosePriorSection:s,shouldCloseFinalSection:l})}const eH=({lyricLine:t})=>`${t}`;function tH(t,{alignChordsWithLyrics:e=!1,chartType:n="all"}={}){const r=nH(e,n)?t.model.lyrics.trim():t.model.lyrics;return eH({lyricLine:r})}const nH=(t,e)=>!t||e==="lyrics",rH=({label:t,multiplier:e})=>`${t}${e?` ${e}`:""}`;function iH(t){return rH(t.model.rendered)}const oH=({song:t})=>`${t}
`,g1={a:"adlib",b:"bridge",c:"chorus",i:"intro",o:"outro",p:"pre-chorus",s:"solo",u:"interlude",v:"verse"};function sH(t,{expandSectionMultiply:e}){const n=lH(t);return t.forEach(r=>{if(r.type===V.SECTION_LABEL){const{model:i,index:o,indexWithoutMultiply:s}=r,l=g1[i.label]?g1[i.label]:i.label;let a=l[0].toUpperCase()+l.substring(1),u;n[i.label]>1&&(a+=" ",a+=e?o:s),!e&&i.multiplyTimes&&(u="x"+i.multiplyTimes),r.model.rendered={label:a,multiplier:u}}}),t}function lH(t){const e={};return t.filter(n=>n.type===V.SECTION_LABEL).forEach(n=>{e[n.model.label]?e[n.model.label]++:e[n.model.label]=1}),e}const aH=QC();function uH(t,e=aH){switch(t){case ce.noChord:return re.noChordSymbol;case re.barRepeat:return re.barRepeat;default:return e(t)}}function cH(t,e,{transposeValue:n,accidentalsType:r,chordSymbolRenderer:i,simplifyChords:o,useShortNamings:s}){let l,a;e&&(l=f1(e,n,r));let u=d();function c(p){if(p.type===V.KEY_DECLARATION)l=f1(p.model,n,r),p.symbol=l.string,a||(a=l);else if(p.type===V.CHORD){let h=0;f(p)&&(h=jW(a&&a.string,l&&l.string)),u=d(h),p.model.allBars.forEach(v=>{v.allChords.forEach(S=>{S.symbol=uH(S.model,u)})})}return p}function f(p){const h=l&&p.model.originalKey&&p.model.originalKey.string===l.string;return(p.isFromAutoRepeatChords||p.isFromSectionCopy||p.isFromChordLineRepeater)&&!h}function d(p){if(typeof i=="function")return i;const h=r==="auto"?l?l.accidental:"sharp":r;return QC({simplify:o,useShortNamings:s,transposeValue:n+p,accidental:h})}return t.map(c)}const fH=(t,{alignChordsWithLyrics:e})=>(t.type===V.CHORD&&t.model.allBars.forEach(n=>{dH(t,n,e)&&(n.allChords=[{string:re.barRepeat,model:re.barRepeat,symbol:re.barRepeat,duration:n.timeSignature.beatCount,beat:1}],n.shouldPrintChordsDuration=!1)}),t),dH=(t,e,n)=>e.isRepeated&&!pH(t,e,n),pH=(t,e,n)=>n&&t.model.hasPositionedChords&&e.allChords.length>1&&e.allChords.some(r=>r.isPositioned);function dY(t,{accidentalsType:e="auto",alignBars:n=!0,alignChordsWithLyrics:r=!0,autoRepeatChords:i=!0,chartType:o="all",chordSymbolRenderer:s=!1,customRenderer:l=!1,expandSectionCopy:a=!0,expandSectionMultiply:u=!1,printChordsDuration:c="uneven",printBarSeparators:f="always",printSubBeatDelimiters:d=!0,printInlineTimeSignatures:p=!0,simplifyChords:h="none",symbolType:v="chord",transposeValue:S=0,useShortNamings:m=!0,wrapChordLyricLines:y=!1}={}){let{allLines:g,allKeys:w}=t,x=!1,C=ub.string,O;g=cH(g,w.auto,{transposeValue:S,accidentalsType:e,chordSymbolRenderer:s,simplifyChords:h,useShortNamings:m}).map(J).map(T).filter(G).map(P=>fH(P,{alignChordsWithLyrics:r}));const k=e7(g,{shouldAlignChordsWithLyrics:W,shouldPrintSubBeatDelimiters:d,symbolType:v});g=sH(g,{expandSectionMultiply:u}),g.forEach(D);const I=F();if(l)return l(g,I,{alignChordsWithLyrics:r,alignBars:n});return oH({song:I.join("")});function M(P){return["cmSection","cmSection-"+P.model.rendered.label.replace(/[\d\s]/gi,"")]}function J(P){return P.type===V.CHORD&&P.model.allBars.forEach(Q=>{Q.shouldPrintChordsDuration=B(Q)}),P}function T(P){return P.type===V.TIME_SIGNATURE?C=P.string:P.type===V.CHORD&&P.model.allBars.forEach((Q,X)=>{Q.shouldPrintBarTimeSignature=X===0&&Q.timeSignature.string!==C||X>0&&Q.timeSignature.string!==O,O=Q.timeSignature.string}),P}function B(P){return P.allChords.length>1&&(c==="uneven"&&P.hasUnevenChordsDurations||c==="always")}function G(P){return q(P)&&!De(P)}function q(P){const Q=!i&&(P.isFromAutoRepeatChords||P.type===V.CHORD&&P.isFromSectionCopy),X=P.isFromSectionMultiply&&!u,_e=P.type!==V.SECTION_LABEL&&P.isFromSectionCopy&&!a;return!X&&!Q&&!_e}function he(P){return g.length-1===P}function De(P){if(o==="chordsFirstLyricLine"){if(P.type===V.SECTION_LABEL)return x=!0,!1;if(x&&P.type===V.LYRIC)return x=!1,!1}return["chords","chordsFirstLyricLine"].includes(o)&&P.type===V.LYRIC||o==="lyrics"&&P.type===V.CHORD}function D(P,Q){if(P.type===V.CHORD){let X=n&&!W(P)?n7(P.model,k,{shouldPrintBarSeparators:ue(P.model),shouldPrintSubBeatDelimiters:d,symbolType:v}):t7(P.model);const _e=g[Q+1];if(W(P)){const{chordLine:ge,lyricsLine:An}=s7(X,_e.model,{shouldPrintBarSeparators:ue(P.model),shouldPrintSubBeatDelimiters:d,shouldPrintInlineTimeSignatures:p,symbolType:v});g[Q+1].model=An,X=ge}g[Q].model=X}}function F(){let P=!1,Q;return g.map((X,_e)=>{let ge,An=!1,pn=[],_t;return X.type===V.CHORD?(ge=E7(X.model,{symbolType:v,shouldPrintBarSeparators:ue(X.model),shouldPrintSubBeatDelimiters:d,shouldPrintInlineTimeSignatures:p}),K(X,g[_e+1])&&(Q=ge,ge=!1)):X.type===V.EMPTY_LINE?ge=Y7():X.type===V.SECTION_LABEL?(An=!0,_t=P,P=!0,pn=M(X),ge=iH(X)):X.type===V.TIME_SIGNATURE?ge=yb(X):X.type===V.KEY_DECLARATION?ge=Q7(X):(ge=tH(X,{alignChordsWithLyrics:r,chartType:o}),Q&&(ge=V7(Q,ge),Q="")),ge&&Z7(ge,{isFromSectionMultiply:X.isFromSectionMultiply,isFromAutoRepeatChords:X.isFromAutoRepeatChords,isFromChordLineRepeater:X.isFromChordLineRepeater,isFromSectionCopy:X.isFromSectionCopy,shouldOpenSection:An,shouldClosePriorSection:_t,shouldCloseFinalSection:he(_e)&&P,sectionWrapperClasses:pn})}).filter(Boolean)}function W(P){return o==="all"&&r&&P.model.hasPositionedChords}function K(P,Q){return Q&&Q.type===V.LYRIC&&y&&W(P)}function ue(P){return f==="always"||f==="grids"&&!P.hasPositionedChords}}const pY=(t={})=>hH.bind(null,t),hH=({showBarSeparators:t=!0},e,n,{alignBars:r,alignChordsWithLyrics:i})=>{const o=[];let s;return mH(e).forEach((l,a)=>{l.sectionLine&&(l.allLines.length>0?(a>0&&o.push(""),o.push(gH(l.sectionLine))):o.push(Eb(wb(l.sectionLine.model.rendered)))),l.allLines.forEach((u,c,f)=>{switch(u.type){case V.CHORD:vH(f,c)?s=u:o.push(SH(u));break;case V.LYRIC:o.push(wH(u,s,{showBarSeparators:t,alignChordsWithLyrics:i,alignBars:r})),s=void 0;break;case V.EMPTY_LINE:o.push(""),s=void 0;break}}),l.sectionLine&&l.allLines.length>0&&o.push(yH(l.sectionLine))}),o.join(`
-`)},mH=t=>{const e=[];let n;const r=()=>{n&&(e.push(n),n=void 0)},i=o=>{n={sectionLine:o,allLines:[]}};return t.forEach(o=>{o.type===V.SECTION_LABEL?(r(),i(o)):(n||i(),n.allLines.push(o))}),r(),e.map(o=>(o.allLines=nb(o.allLines,s=>s.type===V.EMPTY_LINE),o))};function gH(t){return`{start_of_${Sb(t.model.label)}: ${wb(t.model.rendered)}}`}function yH(t){return`{end_of_${Sb(t.model.label)}}`}function Sb(t){switch(t){case"b":case"bridge":return"bridge";case"c":case"chorus":return"chorus";default:case"v":case"verse":return"verse"}}function wb({label:t,multiplier:e}){return e?`${t} ${e}`:t}function Eb(t){return`{c:${t}}`}function vH(t,e){const n=t[e+1];return n&&n.type===V.LYRIC}function SH(t){let e="";return t.model.allBars.map(n=>{e+="|",n.allChords.map(r=>{e+=r.symbol+" ".repeat(r.spacesWithin+r.spacesAfter)})}),e+="|",Eb(e.trim())}function wH(t,e,{alignChordsWithLyrics:n,alignBars:r,showBarSeparators:i}){let o=t.string.trim();return e&&e.type===V.CHORD&&(e.model.hasPositionedChords&&n?o=EH(o,e,{showBarSeparators:i}):o=CH(o,e,{showBarSeparators:i,alignBars:r})),o}const EH=(t,e,{showBarSeparators:n})=>{let r=t;return e.model.allBars.map(i=>{i.allChords.map((o,s)=>{let[l]=Cb(i,o);if(s===0&&n){const a=r.indexOf("_");a>-1?r=ni(r,"[|] ",a):r=ni(r,"[|]",r.length+1)}r.indexOf("_")>-1?r=r.replace("_",l):r=ni(r,l,r.length+1)})}),r=r.replace(/_/g,"").trim(),n&&(r+=" [|]"),r},CH=(t,e,{showBarSeparators:n,alignBars:r})=>{let i=t.replace(/_/g,""),o=0;return e.model.allBars.map(s=>{s.allChords.map((l,a)=>{let[u,c]=Cb(s,l);a===0&&n&&(i=ni(i,"[|]",o),o+=5),i=ni(i,u,o);const f=r&&!s.allChords[a+1]?1:0;o+=u.length+c.length+l.spacesAfter+l.spacesWithin+f})}),n&&(i=ni(i,"[|]",o)),i},Cb=(t,e)=>{const n=t.shouldPrintChordsDuration?e.symbol+".".repeat(e.duration):e.symbol;return[`[${n}]`,n]},hY=()=>bH.bind(null),bH=(t,e)=>e.map((n,r)=>{const i=t[r],o=TC(n);return i.type===V.SECTION_LABEL?`[${o}]`:i.type===V.CHORD?xH(i,o):o.replace(" ","")}).join(`
-`),xH=(t,e)=>{const n=/([^\s.|]+)/g;return e.replace(n,"[ch]$1[/ch]")};/**
- * filesize
- *
- * @copyright 2023 Jason Mulligan
- * @license BSD-3-Clause
- * @version 10.1.0
- */const OH="array",TH="bit",y1="bits",kH="byte",v1="bytes",Mi="",AH="exponent",_H="function",S1="iec",NH="Invalid number",MH="Invalid rounding method",Pf="jedec",IH="object",w1=".",PH="round",$H="s",DH="si",RH="kbit",LH="kB",FH=" ",BH="string",zH="0",$f={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function mY(t,{bits:e=!1,pad:n=!1,base:r=-1,round:i=2,locale:o=Mi,localeOptions:s={},separator:l=Mi,spacer:a=FH,symbols:u={},standard:c=Mi,output:f=BH,fullform:d=!1,fullforms:p=[],exponent:h=-1,roundingMethod:v=PH,precision:S=0}={}){let m=h,y=Number(t),g=[],w=0,x=Mi;c===DH?(r=10,c=Pf):c===S1||c===Pf?r=2:r===2?c=S1:(r=10,c=Pf);const C=r===10?1e3:1024,O=d===!0,k=y<0,I=Math[v];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(NH);if(typeof I!==_H)throw new TypeError(MH);if(k&&(y=-y),(m===-1||isNaN(m))&&(m=Math.floor(Math.log(y)/Math.log(C)),m<0&&(m=0)),m>8&&(S>0&&(S+=8-m),m=8),f===AH)return m;if(y===0)g[0]=0,x=g[1]=$f.symbol[c][e?y1:v1][m];else{w=y/(r===2?Math.pow(2,m*10):Math.pow(1e3,m)),e&&(w=w*8,w>=C&&m<8&&(w=w/C,m++));const M=Math.pow(10,m>0?i:0);g[0]=I(w*M)/M,g[0]===C&&m<8&&h===-1&&(g[0]=1,m++),x=g[1]=r===10&&m===1?e?RH:LH:$f.symbol[c][e?y1:v1][m]}if(k&&(g[0]=-g[0]),S>0&&(g[0]=g[0].toPrecision(S)),g[1]=u[g[1]]||g[1],o===!0?g[0]=g[0].toLocaleString():o.length>0?g[0]=g[0].toLocaleString(o,s):l.length>0&&(g[0]=g[0].toString().replace(w1,l)),n&&Number.isInteger(g[0])===!1&&i>0){const M=l||w1,J=g[0].toString().split(M),T=J[1]||Mi,B=T.length,G=i-B;g[0]=`${J[0]}${M}${T.padEnd(B+G,zH)}`}return O&&(g[1]=p[m]?p[m]:$f.fullform[c][m]+(e?TH:kH)+(g[0]===1?Mi:$H)),f===OH?g:f===IH?{value:g[0],symbol:g[1],exponent:m,unit:x}:g.join(a)}var bb={exports:{}};(function(t,e){(function(n,r){r()})(Sn,function(){function n(u,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(u.type)?new Blob(["\uFEFF",u],{type:u.type}):u}function r(u,c,f){var d=new XMLHttpRequest;d.open("GET",u),d.responseType="blob",d.onload=function(){a(d.response,c,f)},d.onerror=function(){console.error("could not download file")},d.send()}function i(u){var c=new XMLHttpRequest;c.open("HEAD",u,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function o(u){try{u.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),u.dispatchEvent(c)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof Sn=="object"&&Sn.global===Sn?Sn:void 0,l=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(u,c,f){var d=s.URL||s.webkitURL,p=document.createElement("a");c=c||u.name||"download",p.download=c,p.rel="noopener",typeof u=="string"?(p.href=u,p.origin===location.origin?o(p):i(p.href)?r(u,c,f):o(p,p.target="_blank")):(p.href=d.createObjectURL(u),setTimeout(function(){d.revokeObjectURL(p.href)},4e4),setTimeout(function(){o(p)},0))}:"msSaveOrOpenBlob"in navigator?function(u,c,f){if(c=c||u.name||"download",typeof u!="string")navigator.msSaveOrOpenBlob(n(u,f),c);else if(i(u))r(u,c,f);else{var d=document.createElement("a");d.href=u,d.target="_blank",setTimeout(function(){o(d)})}}:function(u,c,f,d){if(d=d||open("","_blank"),d&&(d.document.title=d.document.body.innerText="downloading..."),typeof u=="string")return r(u,c,f);var p=u.type==="application/octet-stream",h=/constructor/i.test(s.HTMLElement)||s.safari,v=/CriOS\/[\d]+/.test(navigator.userAgent);if((v||p&&h||l)&&typeof FileReader<"u"){var S=new FileReader;S.onloadend=function(){var g=S.result;g=v?g:g.replace(/^data:[^;]*;/,"data:attachment/file;"),d?d.location.href=g:location=g,d=null},S.readAsDataURL(u)}else{var m=s.URL||s.webkitURL,y=m.createObjectURL(u);d?d.location=y:location.href=y,d=null,setTimeout(function(){m.revokeObjectURL(y)},4e4)}});s.saveAs=a.saveAs=a,t.exports=a})})(bb);var gY=bb.exports;const yY=()=>t=>(t.formatted.symbol=t.formatted.symbol.replace(/[() ]/g,"").replace("mM","mMaj").replace("°","dim"),t);/*! *****************************************************************************
-Copyright (c) Microsoft Corporation. All rights reserved.
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at http://www.apache.org/licenses/LICENSE-2.0
-
-THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
-WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
-MERCHANTABLITY OR NON-INFRINGEMENT.
-
-See the Apache Version 2.0 License for specific language governing permissions
-and limitations under the License.
-***************************************************************************** */var mp=function(){return mp=Object.assign||function(e){for(var n,r=1,i=arguments.length;r0||t.deltaX<0?"X":t.deltaY>0||t.deltaY<0?"Y":(t.deltaY>0||t.deltaY<0)&&(t.deltaX>0||t.deltaX<0)?"XY":null},VH=H.forwardRef(function(t,e){var n=t.children,r=t.group,i=r===void 0?"default":r,o=t.scroll,s=o===void 0?"two-way":o,l=t.selfLockAxis,a=l===void 0?null:l,u=t.onScroll,c=u===void 0?function(){}:u,f=H.useContext(xb),d=f.registerNode,p=f.unregisterNode,h=f.onScroll,v=n.ref,S=v!=null&&e!=null;S&&console.warn(`scroll-sync-react:
-WARNING: ref used on both ScrollSyncNode and its direct child.
-Using the ref from the ScrollSyncNode component.`);var m=v&&!e?v:H.useRef(null);H.useEffect(function(){typeof e=="function"&&e(m.current)},[]);var y=function(x){var C=UH(x);(a==="X"&&C==="X"||a==="Y"&&C==="Y"||a==="XY"&&(C==="XY"||C==="X"||C==="Y"))&&x.preventDefault()};H.useEffect(function(){var x,C={node:m.current,scroll:s};return C&&d(C,Br(i)),(x=m.current)===null||x===void 0||x.addEventListener("wheel",y,{passive:!1}),function(){var O;p(C,Br(i)),(O=m.current)===null||O===void 0||O.removeEventListener("wheel",y)}},[]),H.useEffect(function(){var x={node:m.current,scroll:s};return p(x,Br(i)),d(x,Br(i)),function(){return p(x,Br(i))}},[s,i]);var g=s==="syncer-only",w=s==="two-way";return Ra.cloneElement(n,{ref:m,onScroll:function(x){typeof n.props.onScroll=="function"&&n.props.onScroll(x),x.persist(),(g||w)&&(h(x,Br(i)),c(x))},onWheel:function(x){typeof n.props.onWheel=="function"&&n.props.onWheel(x),x.persist(),(g||w)&&(h(x,Br(i)),c(x))}})});VH.displayName="ScrollSyncNode";function Ke(t){this.content=t}Ke.prototype={constructor:Ke,find:function(t){for(var e=0;e>1}};Ke.from=function(t){if(t instanceof Ke)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ke(e)};function Ob(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Ob(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Tb(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let u=0,c=Math.min(s.text.length,l.text.length);for(;ue&&r(a,i+l,o||null,s)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,n-c),r,i+c)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);oe)for(let o=0,s=0;se&&((sn)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=a}return new $(r,i)}cutByIndex(e,n){return e==n?$.empty:e==0&&n==this.content.length?this:new $(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new $(i,o)}addToStart(e){return new $([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new $(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?oa(r+1,s):oa(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return $.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new $(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return $.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}}se.none=[];class hu extends Error{}class z{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ab(this.content,e+this.openStart,n);return r&&new z(r,this.openStart,this.openEnd)}removeBetween(e,n){return new z(kb(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return z.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new z($.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new z(e,r,i)}}z.empty=new z($.empty,0,0);function kb(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(kb(o.content,e-i-1,n-i-1)))}function Ab(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Ab(s.content,e-o-1,n);return l&&t.replaceChild(i,s.copy(l))}function WH(t,e,n){if(n.openStart>t.depth)throw new hu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new hu("Inconsistent open depths");return _b(t,e,n,0)}function _b(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ns(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(ri(t.nodeAfter,r),o++));for(let l=o;li&&gp(t,e,i+1),s=r.depth>i&&gp(n,r,i+1),l=[];return Ns(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(Nb(o,s),ri(ii(o,Mb(t,e,n,r,i+1)),l)):(o&&ri(ii(o,mu(t,e,i+1)),l),Ns(e,n,i,l),s&&ri(ii(s,mu(n,r,i+1)),l)),Ns(r,null,i,l),new $(l)}function mu(t,e,n){let r=[];if(Ns(null,t,n,r),t.depth>n){let i=gp(t,e,n+1);ri(ii(i,mu(t,e,n+1)),r)}return Ns(e,null,n,r),new $(r)}function HH(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy($.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class il{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new KH(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),u=o-a;if(r.push(s,l,i+a),!u||(s=s.child(l),s.isText))break;o=u-1,i+=a+1}return new il(n,r,o)}static resolveCached(e,n){for(let i=0;ie&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ib(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=$.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;an.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=$.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};oi.prototype.text=void 0;class gu extends oi{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ib(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new gu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new gu(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ib(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class pi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new YH(e,n);if(r.next==null)return pi.empty;let i=Pb(r);r.next&&r.err("Unexpected trailing text");let o=nG(tG(i));return rG(o,r),o}matchType(e){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return o}).join(`
-`)}}pi.empty=new pi(!0);class YH{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Pb(t){let e=[];do e.push(JH(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function JH(t){let e=[];do e.push(QH(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function QH(t){let e=eG(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=XH(t,e);else break;return e}function E1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function XH(t,e){let n=E1(t),r=n;return t.eat(",")&&(t.next!="}"?r=E1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function ZH(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.groups.indexOf(e)>-1&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function eG(t){if(t.eat("(")){let e=Pb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=ZH(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function tG(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(o(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=o(s.exprs[a],l);if(a==s.exprs.length-1)return u;i(u,l=n())}else if(s.type=="star"){let a=n();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let u=0;u{t[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c{u||i.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new pi(r.indexOf(t.length-1)>-1);for(let s=0;s-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[o]=new Fb(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class iG{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class bc{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Lb(i.attrs),this.excluded=null;let o=Db(this.attrs);this.instance=o?new se(this,o):null}create(e=null){return!e&&this.instance?this.instance:new se(this,Rb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new bc(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n-1}}class vY{constructor(e){this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ke.from(e.nodes),n.marks=Ke.from(e.marks||{}),this.nodes=b1.compile(this.spec.nodes,this),this.marks=bc.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;o.contentMatch=r[s]||(r[s]=pi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet=l=="_"?null:l?x1(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:x1(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof b1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new gu(r,r.defaultAttrs,e,se.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return oi.fromJSON(this,e)}markFromJSON(e){return se.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function x1(t,e){let n=[];for(let r=0;r-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class ol{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new T1(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new T1(this,n,!0);return r.addAll(e,n.from,n.to),z.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s{r(s=k1(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=k1(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ol(e,ol.schemaRules(e)))}}const Bb={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},oG={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},zb={ol:!0,ul:!0},yu=1,vu=2,Ms=4;function O1(t,e,n){return e!=null?(e?yu:0)|(e==="full"?vu:0):t&&t.whitespace=="pre"?yu|vu:n&~Ms}class sa{constructor(e,n,r,i,o,s,l){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=l,this.content=[],this.activeMarks=se.none,this.stashMarks=[],this.match=s||(l&Ms?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore($.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&yu)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=$.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore($.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;nthis.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,o,o.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
-`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=se.none,r=se.none;for(let i=0;i{s.clearMark(l)&&(r=l.addToSet(r))}):n=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(n),s.consuming===!1)o=s;else break}return[n,r]}addElementByRule(e,n,r){let i,o,s;n.node?(o=this.parser.schema.nodes[n.node],o.isLeaf?this.insertNode(o.create(n.attrs))||this.leafFallback(e):i=this.enter(o,n.attrs||null,n.preserveWhitespace)):(s=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(s));let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=r==null?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o);this.findAtPoint(e,i)}findPlace(e){let n,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],s=o.findWrapping(e);if(s&&(!n||n.length>s.length)&&(n=s,r=o,!s.length)||o.solid)break}if(!n)return!1;this.sync(r);for(let i=0;ithis.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let c=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=cG(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let s=i.popFromStashMark(e);s&&i.type&&i.type.allowsMarkType(s.type)&&(i.activeMarks=s.addToSet(i.activeMarks))}if(i==n)break}}}function sG(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&zb.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function lG(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function aG(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=e.exec(t);)r.push(n[1],n[2].trim());return r}function k1(t){let e={};for(let n in t)e[n]=t[n];return e}function uG(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=l=>{o.push(l);for(let a=0;a{if(o.length||s.marks.length){let l=0,a=0;for(;l=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&jn.renderSpec(Ff(r),i(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let i=n[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let s,l=r?e.createElementNS(r,i):e.createElement(i),a=n[1],u=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){u=2;for(let c in a)if(a[c]!=null){let f=c.indexOf(" ");f>0?l.setAttributeNS(c.slice(0,f),c.slice(f+1),a[c]):l.setAttribute(c,a[c])}}for(let c=u;cu)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:d,contentDOM:p}=jn.renderSpec(e,f,r);if(l.appendChild(d),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:l,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new jn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=A1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return A1(e.marks)}}function A1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ff(t){return t.document||window.document}const jb=65535,Ub=Math.pow(2,16);function fG(t,e){return t+e*Ub}function _1(t){return t&jb}function dG(t){return(t-(t&jb))/Ub}const Vb=1,Wb=2,xa=4,Hb=8;class vp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Hb)>0}get deletedBefore(){return(this.delInfo&(Vb|xa))>0}get deletedAfter(){return(this.delInfo&(Wb|xa))>0}get deletedAcross(){return(this.delInfo&xa)>0}}class It{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&It.empty)return It.empty}recover(e){let n=0,r=_1(e);if(!this.inverted)for(let i=0;ie)break;let u=this.ranges[l+o],c=this.ranges[l+s],f=a+u;if(e<=f){let d=u?e==a?-1:e==f?1:n:n,p=a+i+(d<0?0:c);if(r)return p;let h=e==(n<0?a:f)?null:fG(l/3,e-a),v=e==a?Wb:e==f?Vb:xa;return(n<0?e!=a:e!=f)&&(v|=Hb),new vp(p,v,h)}i+=c-u}return r?e+i:new vp(e+i,0,null)}touches(e,n){let r=0,i=_1(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;le)break;let u=this.ranges[l+o],c=a+u;if(e<=c&&l==i*3)return!0;r+=this.ranges[l+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new so;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ro&&a!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Ie.fromReplace(e,this.from,this.to,o)}invert(){return new Cn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fr(n.pos,r.pos,this.mark)}merge(e){return e instanceof fr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new fr(n.from,n.to,e.markFromJSON(n.mark))}}at.jsonID("addMark",fr);class Cn extends at{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new z(Sm(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ie.fromReplace(e,this.from,this.to,r)}invert(){return new fr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Cn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Cn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Cn(n.from,n.to,e.markFromJSON(n.mark))}}at.jsonID("removeMark",Cn);class dr extends at{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ie.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ie.fromReplace(e,this.pos,this.pos+1,new z($.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new Dt(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Dt(n.from,n.to,n.gapFrom,n.gapTo,z.fromJSON(e,n.slice),n.insert,!!n.structure)}}at.jsonID("replaceAround",Dt);function Sp(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function pG(t,e,n,r){let i=[],o=[],s,l;t.doc.nodesBetween(e,n,(a,u,c)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let d=Math.max(u,e),p=Math.min(u+a.nodeSize,n),h=r.addToSet(f);for(let v=0;vt.step(a)),o.forEach(a=>t.step(a))}function hG(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof bc){let u=s.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,n);for(let c=0;ct.step(new Cn(s.from,s.to,s.style)))}function mG(t,e,n,r=n.contentMatch){let i=t.doc.nodeAt(e),o=[],s=e+1;for(let l=0;l=0;l--)t.step(o[l])}function gG(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function wm(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),s=t.$to.indexAfter(r);if(rn;h--)v||r.index(h)>0?(v=!0,c=$.from(r.node(h).copy(c)),f++):a--;let d=$.empty,p=0;for(let h=o,v=!1;h>n;h--)v||i.after(h+1)=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=$.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Dt(i,o,i,o,new z(r,0,0),n.length,!0))}function SG(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,i)&&wG(t.doc,t.mapping.slice(o).map(l),r)){t.clearIncompatible(t.mapping.slice(o).map(l,1),r);let a=t.mapping.slice(o),u=a.map(l,1),c=a.map(l+s.nodeSize,1);return t.step(new Dt(u,c,u+1,c-1,new z($.from(r.create(i,null,s.marks)),0,0),1,!0)),!1}})}function wG(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function EG(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Dt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new z($.from(s),0,0),1,!0))}function Oa(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>o;u--,c--){let f=i.node(u),d=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),h=r&&r[c+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let v=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!v.type.validContent(p))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function CG(t,e,n=1,r){let i=t.doc.resolve(e),o=$.empty,s=$.empty;for(let l=i.depth,a=i.depth-n,u=n-1;l>a;l--,u--){o=$.from(i.node(l).copy(o));let c=r&&r[u];s=$.from(c?c.type.create(c.attrs,s):i.node(l).copy(s))}t.step(new it(e,e,new z(o.append(s),n,n),!0))}function Gb(t,e){let n=t.resolve(e),r=n.index();return bG(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function bG(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function xG(t,e,n){let r=new it(e-n,e+n,z.empty,!0);t.step(r)}function OG(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),u=r.node(s),c=!1;if(o==1)c=u.canReplace(a,a,i);else{let f=u.contentMatchAt(a).findWrapping(i.firstChild.type);c=f&&u.canReplaceWith(a,a,f[0])}if(c)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Em(t,e,n=e,r=z.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Kb(i,o,r)?new it(e,n,r):new kG(i,o,r).fit()}function Kb(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class kG{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=$.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=$.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new z(o,s,l);return e>-1?new Dt(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new it(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=zf(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],c,f=null;if(n==1&&(s?u.matchType(s.type)||(f=u.fillBefore($.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:c};if(o&&u.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=zf(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new z(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=zf(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new z(ds(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new z(ds(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let v=0;v1||a==0||v.content.size)&&(f=S,c.push(qb(v.mark(d.allowedMarks(v.marks)),u==1?a:0,u==l.childCount?p:-1)))}let h=u==l.childCount;h||(p=-1),this.placed=ps(this.placed,n,$.from(c)),this.frontier[n].match=f,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,S=l;v1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n=0;l--){let{match:a,type:u}=this.frontier[l],c=jf(e,l,u,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ps(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ps(this.placed,this.depth,$.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore($.empty,!0);n.childCount&&(this.placed=ps(this.placed,this.frontier.length,n))}}function ds(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ds(t.firstChild.content,e-1,n)))}function ps(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ps(t.lastChild.content,e-1,n)))}function zf(t,e){for(let n=0;n1&&(r=r.replaceChild(0,qb(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore($.empty,!0)))),t.copy(r)}function jf(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!AG(n,o.content,s)?l:null}function AG(t,e,n){for(let r=n;r0;d--,p--){let h=i.node(d).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(d)>-1?l=d:i.before(d)==p&&s.splice(1,0,-d)}let a=s.indexOf(l),u=[],c=r.openStart;for(let d=r.content,p=0;;p++){let h=d.firstChild;if(u.push(h),p==r.openStart)break;d=h.content}for(let d=c-1;d>=0;d--){let p=u[d],h=_G(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(l)-1)))c=d;else if(h||!p.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+c+1)%(r.openStart+1),h=u[p];if(h)for(let v=0;v=0&&(t.replace(e,n,r),!(t.steps.length>f));d--){let p=s[d];p<0||(e=i.before(p),n=o.after(p))}}function Yb(t,e,n,r,i){if(er){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore($.empty,!0))}return t}function MG(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=OG(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new z($.from(r),0,0))}function IG(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Jb(r,i);for(let s=0;s0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}function Jb(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class lo extends at{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ie.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Ie.fromReplace(e,this.pos,this.pos+1,new z($.from(i),0,n.isLeaf?0:1))}getMap(){return It.empty}invert(e){return new lo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new lo(n.pos,n.attr,n.value)}}at.jsonID("attr",lo);class sl extends at{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Ie.ok(r)}getMap(){return It.empty}invert(e){return new sl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new sl(n.attr,n.value)}}at.jsonID("docAttr",sl);let xo=class extends Error{};xo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};xo.prototype=Object.create(Error.prototype);xo.prototype.constructor=xo;xo.prototype.name="TransformError";class PG{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new so}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new xo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=z.empty){let i=Em(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new z($.from(r),0,0))}delete(e,n){return this.replace(e,n,z.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return NG(this,e,n,r),this}replaceRangeWith(e,n,r){return MG(this,e,n,r),this}deleteRange(e,n){return IG(this,e,n),this}lift(e,n){return yG(this,e,n),this}join(e,n=1){return xG(this,e,n),this}wrap(e,n){return vG(this,e,n),this}setBlockType(e,n=e,r,i=null){return SG(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return EG(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new lo(e,n,r)),this}setDocAttribute(e,n){return this.step(new sl(e,n)),this}addNodeMark(e,n){return this.step(new dr(e,n)),this}removeNodeMark(e,n){if(!(n instanceof se)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new bo(e,n)),this}split(e,n=1,r){return CG(this,e,n,r),this}addMark(e,n,r){return pG(this,e,n,r),this}removeMark(e,n,r){return hG(this,e,n,r),this}clearIncompatible(e,n,r){return mG(this,e,n,r),this}}const Uf=Object.create(null);class le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new $G(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;o--){let s=n<0?Ri(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Ri(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Rt(e.node(0))}static atStart(e){return Ri(e,e,0,0,1)||new Rt(e)}static atEnd(e){return Ri(e,e,e.content.size,e.childCount,-1)||new Rt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Uf[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Uf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Uf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return me.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class $G{constructor(e,n){this.$from=e,this.$to=n}}let N1=!1;function M1(t){!N1&&!t.parent.inlineContent&&(N1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class me extends le{constructor(e,n=e){M1(e),M1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return le.near(r);let i=e.resolve(n.map(this.anchor));return new me(i.parent.inlineContent?i:r,r)}replace(e,n=z.empty){if(super.replace(e,n),n==z.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof me&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new xc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new me(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=le.findFrom(n,r,!0)||le.findFrom(n,-r,!0);if(o)n=o.$head;else return le.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?s=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&Y.isSelectable(l))return Y.create(t,n-(i<0?l.nodeSize:0))}else{let a=Ri(t,l,n+i,i<0?l.childCount:0,i,o);if(a)return a}n+=l.nodeSize*i}return null}function I1(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=c)}),t.setSelection(le.near(t.doc.resolve(s),n))}const P1=1,la=2,$1=4;class RG extends PG{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=la,this}ensureMarks(e){return se.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&la)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~la,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||se.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(le.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=$1,this}get scrolledIntoView(){return(this.updated&$1)>0}}function D1(t,e){return!e||!t?t:t.bind(e)}class hs{constructor(e,n,r){this.name=e,this.init=D1(n.init,r),this.apply=D1(n.apply,r)}}const LG=[new hs("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new hs("selection",{init(t,e){return t.selection||le.atStart(e.doc)},apply(t){return t.selection}}),new hs("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new hs("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Vf{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=LG.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new hs(r.key,r.spec.state,r))})}}class ms{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Vf(e.schema,e.plugins),o=new ms(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=oi.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=le.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[s.name]=u.fromJSON.call(a,e,n[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function Qb(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Qb(i,e,{})),n[r]=i}return n}class Xb{constructor(e){this.spec=e,this.props={},e.props&&Qb(e.props,this,this.props),this.key=e.key?e.key.key:Zb("plugin")}getState(e){return e[this.key]}}const Wf=Object.create(null);function Zb(t){return t in Wf?t+"$"+ ++Wf[t]:(Wf[t]=0,t+"$")}class ex{constructor(e="key"){this.key=Zb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ft=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ll=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let R1=null;const Dn=function(t,e,n){let r=R1||(R1=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},hi=function(t,e,n,r){return n&&(L1(t,e,n,r,-1)||L1(t,e,n,r,1))},FG=/^(img|br|input|textarea|hr)$/i;function L1(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:En(t))){let o=t.parentNode;if(!o||o.nodeType!=1||bm(t)||FG.test(t.nodeName)||t.contentEditable=="false")return!1;e=ft(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?En(t):0}else return!1}}function En(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function BG(t,e,n){for(let r=e==0,i=e==En(t);r||i;){if(t==n)return!0;let o=ft(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==En(t)}}function bm(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Oc=function(t){return t.focusNode&&hi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Gr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function zG(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function jG(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const On=typeof navigator<"u"?navigator:null,F1=typeof document<"u"?document:null,Rr=On&&On.userAgent||"",wp=/Edge\/(\d+)/.exec(Rr),tx=/MSIE \d/.exec(Rr),Ep=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rr),At=!!(tx||Ep||wp),xr=tx?document.documentMode:Ep?+Ep[1]:wp?+wp[1]:0,fn=!At&&/gecko\/(\d+)/i.test(Rr);fn&&+(/Firefox\/(\d+)/.exec(Rr)||[0,0])[1];const Cp=!At&&/Chrome\/(\d+)/.exec(Rr),ot=!!Cp,UG=Cp?+Cp[1]:0,ht=!At&&!!On&&/Apple Computer/.test(On.vendor),Oo=ht&&(/Mobile\/\w+/.test(Rr)||!!On&&On.maxTouchPoints>2),Ut=Oo||(On?/Mac/.test(On.platform):!1),VG=On?/Win/.test(On.platform):!1,rn=/Android \d/.test(Rr),Ol=!!F1&&"webkitFontSmoothing"in F1.documentElement.style,WG=Ol?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function HG(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Pn(t,e){return typeof t=="number"?t:t[e]}function GG(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function B1(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=ll(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,u=a?HG(o):GG(l),c=0,f=0;if(e.topu.bottom-Pn(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Pn(i,"top")-u.top:e.bottom-u.bottom+Pn(i,"bottom")),e.leftu.right-Pn(r,"right")&&(c=e.right-u.right+Pn(i,"right")),c||f)if(a)o.defaultView.scrollBy(c,f);else{let d=l.scrollLeft,p=l.scrollTop;f&&(l.scrollTop+=f),c&&(l.scrollLeft+=c);let h=l.scrollLeft-d,v=l.scrollTop-p;e={left:e.left-h,top:e.top-v,right:e.right-h,bottom:e.bottom-v}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function KG(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:nx(t.dom)}}function nx(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ll(r));return e}function qG({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;rx(n,r==0?0:r-e)}function rx(t,e){for(let n=0;n=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let v=h.left>e.left?h.left-e.left:h.right=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=c,u={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(o=f+1)}}return!n&&a&&(n=a,i=u,r=0),n&&n.nodeType==3?JG(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:ix(n,i)}function JG(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function xm(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function QG(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function ZG(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let l=t.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!s||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!s&&(s=!0,a.left>r.left||a.top>r.top?i=l.posBefore:(a.right-1?i:t.docView.posFromDOM(e,n,-1)}function ox(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let u;Ol&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=ZG(t,r,i,e))}l==null&&(l=XG(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function z1(t){return t.top=0&&i==r.nodeValue.length?(a--,c=1):n<0?a--:u++,ls(Xn(Dn(r,a,u),c),c<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==En(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Hf(a.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==En(r))){let a=r.childNodes[i-1],u=a.nodeType==3?Dn(a,En(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return ls(Xn(u,1),!1)}if(o==null&&i=0)}function ls(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Hf(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function lx(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function nK(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return lx(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=sx(t,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Dn(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const rK=/[\u0590-\u08ac]/;function iK(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return!rK.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:s:lx(t,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:v}=t.domSelectionRange(),S=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&u==v;try{l.collapse(c,f),a&&(a!=c||u!=f)&&l.extend&&l.extend(a,u)}catch{}return d!=null&&(l.caretBidiLevel=d),S})}let j1=null,U1=null,V1=!1;function oK(t,e,n){return j1==e&&U1==n?V1:(j1=e,U1=n,V1=n=="up"||n=="down"?nK(t,e,n):iK(t,e,n))}const Kt=0,W1=1,Jr=2,Tn=3;class Tl{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Kt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nft(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof ux){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof ax&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?ft(o.dom)+1:0}}else{let o,s=!0;for(;o=r=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,c);e=s;for(let f=l;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=ft(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;cp&&sn){let p=l;l=a,a=p}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let l=r+o.border,a=s-o.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?Jr:W1,e==l&&n==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Tn:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Jr:Tn}r=s}this.dirty=Jr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Jr:W1;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Kt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class sK extends Tl{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class mi extends Tl{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=jn.renderSpec(document,n.type.spec.toDOM(n,r))),new mi(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&Tn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Tn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Kt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=Op(o,0,e,r));for(let l=0;l{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),c=u&&u.dom,f=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=jn.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=dx(c,r,n),u?a=new lK(e,n,r,i,c,f||null,d,u,o,s+1):n.isText?new Tc(e,n,r,i,c,d,o):new Or(e,n,r,i,c,f||null,d,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>$.empty)}return e}matchesNode(e,n,r){return this.dirty==Kt&&e.eq(this.node)&&xp(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new uK(this,s&&s.node,e);dK(this.node,this.innerDeco,(u,c,f)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!f&&a.syncToMarks(c==this.node.childCount?se.none:this.node.child(c).marks,r,e),a.placeWidget(u,e,i)},(u,c,f,d)=>{a.syncToMarks(u.marks,r,e);let p;a.findNodeMatch(u,c,f,d)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(u,c,f,p,e)||a.updateNextNode(u,c,f,e,d,i)||a.addNode(u,c,f,e,i),i+=u.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Jr)&&(s&&this.protectLocalComposition(e,s),cx(this.contentDOM,this.children,e),Oo&&pK(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof me)||rn+this.node.content.size)return null;let o=e.domSelectionRange(),s=hK(o.focusNode,o.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,a=mK(this.node.content,l,r-n,i-n);return a<0?null:{node:s,pos:a,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new sK(this,o,n,i);e.input.compositionNodes.push(s),this.children=Op(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Tn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Kt}updateOuterDeco(e){if(xp(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=fx(this.dom,this.nodeDOM,bp(this.outerDeco,this.node,n),bp(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function H1(t,e,n,r,i){dx(r,e,t);let o=new Or(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Tc extends Or{constructor(e,n,r,i,o,s,l){super(e,n,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Tn||this.dirty!=Kt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Kt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Kt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Tc(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Tn)}get domAtom(){return!1}}class ux extends Tl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Kt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class lK extends Or{constructor(e,n,r,i,o,s,l,a,u,c){super(e,n,r,i,o,s,l,u,c),this.spec=a}update(e,n,r,i){if(this.dirty==Tn)return!1;if(this.spec.update){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function cx(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o>1,s=Math.min(o,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=mi.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof mi)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function fK(t,e){return t.type.side-e.type.side}function dK(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let u=0;uo;)l.push(i[s++]);let h=o+d.nodeSize;if(d.isText){let S=h;s!S.inline):l.slice();r(d,v,e.forChild(o,d),p),o=h}}function pK(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function hK(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=En(t)}else if(t.nodeType==1&&e=n){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l=0&&u+e.length+l>=n)return l+u;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Op(t,e,n,r,i){let o=[];for(let s=0,l=0;s=n||c<=e?o.push(a):(un&&o.push(a.slice(n-u,a.size,r)))}return o}function Om(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,u;if(Oc(n)){for(a=l;i&&!i.node;)i=i.parent;let c=i.node;if(i&&c.isAtom&&Y.isSelectable(c)&&i.parent&&!(c.isInline&&BG(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;u=new Y(s==f?l:r.resolve(f))}}else{let c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null;a=r.resolve(c)}if(!u){let c=e=="pointer"||t.state.selection.head{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!px(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function yK(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,ft(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&At&&xr<=11&&(r.disabled=!0,r.disabled=!1)}function hx(t,e){if(e instanceof Y){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(J1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else J1(t)}function J1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Tm(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||me.between(e,n,r)}function Q1(t){return t.editable&&!t.hasFocus()?!1:mx(t)}function mx(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function vK(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return hi(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Tp(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&le.findFrom(o,e)}function nr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function X1(t,e,n){let r=t.state.selection;if(r instanceof me)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return nr(t,new me(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Tp(t.state,e);return i&&i instanceof Y?nr(t,i):!1}else if(!(Ut&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Y.isSelectable(o)?nr(t,new Y(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Ol?nr(t,new me(t.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return nr(t,new me(e>0?r.$to:r.$from));{let i=Tp(t.state,e);return i?nr(t,i):!1}}}function Su(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ps(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Pi(t,e){return e<0?SK(t):wK(t)}function SK(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(fn&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Ps(l,-1))i=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(gx(n))break;{let l=n.previousSibling;for(;l&&Ps(l,-1);)i=n.parentNode,o=ft(l),l=l.previousSibling;if(l)n=l,r=Su(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?kp(t,n,r):i&&kp(t,i,o)}function wK(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Su(n),o,s;for(;;)if(r{t.state==i&&Vn(t)},50)}function Z1(t,e){let n=t.state.doc.resolve(e);if(!(ot||VG)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s1)return o.lefti.top&&s1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function e0(t,e,n){let r=t.state.selection;if(r instanceof me&&!r.empty||n.indexOf("s")>-1||Ut&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Tp(t.state,e);if(s&&s instanceof Y)return nr(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Rt?le.near(s,e):le.findFrom(s,e);return l?nr(t,l):!1}return!1}function t0(t,e){if(!(t.state.selection instanceof me))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function n0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function bK(t){if(!ht||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;n0(t,r,"true"),setTimeout(()=>n0(t,r,"false"),20)}return!1}function xK(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function OK(t,e){let n=e.keyCode,r=xK(e);if(n==8||Ut&&n==72&&r=="c")return t0(t,-1)||Pi(t,-1);if(n==46&&!e.shiftKey||Ut&&n==68&&r=="c")return t0(t,1)||Pi(t,1);if(n==13||n==27)return!0;if(n==37||Ut&&n==66&&r=="c"){let i=n==37?Z1(t,t.state.selection.from)=="ltr"?-1:1:-1;return X1(t,i,r)||Pi(t,i)}else if(n==39||Ut&&n==70&&r=="c"){let i=n==39?Z1(t,t.state.selection.from)=="ltr"?1:-1:1;return X1(t,i,r)||Pi(t,i)}else{if(n==38||Ut&&n==80&&r=="c")return e0(t,-1,r)||Pi(t,-1);if(n==40||Ut&&n==78&&r=="c")return bK(t)||e0(t,1,r)||Pi(t,1);if(r==(Ut?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function yx(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||jn.fromSchema(t.state.schema),l=bx(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let u=a.firstChild,c,f=0;for(;u&&u.nodeType==1&&(c=Cx[u.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let h=l.createElement(c[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
-
-`);return{dom:a,text:d}}function vx(t,e,n,r,i){let o=i.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=e&&(r||o||!n);if(a){if(t.someProp("transformPastedText",d=>{e=d(e,o||r,t)}),o)return e?new z($.from(t.state.schema.text(e.replace(/\r\n?/g,`
-`))),0,0):z.empty;let f=t.someProp("clipboardTextParser",d=>d(e,i,r,t));if(f)l=f;else{let d=i.marks(),{schema:p}=t.state,h=jn.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let S=s.appendChild(document.createElement("p"));v&&S.appendChild(h.serializeNode(p.text(v,d)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=AK(n),Ol&&_K(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||ol.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!TK.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)l=NK(r0(l,+c[1],+c[2]),c[4]);else if(l=z.maxOpen(kK(l.content,i),!0),l.openStart||l.openEnd){let f=0,d=0;for(let p=l.content.firstChild;f{l=f(l,t)}),l}const TK=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function kK(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),u;if(!a)return s=null;if(u=s.length&&o.length&&wx(a,o,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=Ex(s[s.length-1],o.length));let c=Sx(l,a);s.push(c),i=i.matchType(c.type),o=a}}),s)return $.from(s)}return t}function Sx(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,$.from(t));return t}function wx(t,e,n,r,i){if(i1&&(o=0),i=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore($.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function r0(t,e,n){return e]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=bx().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Cx[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>""+o+">").reverse().join("")),n.innerHTML=t,i)for(let o=0;o=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=$.from(a.create(r[l+1],i)),o++,s++}return new z(i,o,s)}const mt={},gt={},MK={touchstart:!0,touchmove:!0};class IK{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function PK(t){for(let e in mt){let n=mt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{DK(t,r)&&!km(t,r)&&(t.editable||!(r.type in gt))&&n(t,r)},MK[e]?{passive:!0}:void 0)}ht&&t.dom.addEventListener("input",()=>null),_p(t)}function pr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function $K(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function _p(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>km(t,r))})}function km(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function DK(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function RK(t,e){!km(t,e)&&mt[e.type]&&(t.editable||!(e.type in gt))&&mt[e.type](t,e)}gt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Ox(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(rn&&ot&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Oo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Gr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||OK(t,n)?n.preventDefault():pr(t,"key")};gt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};gt.keypress=(t,e)=>{let n=e;if(Ox(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ut&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof me)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function kc(t){return{left:t.clientX,top:t.clientY}}function LK(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Am(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,l=>s>o.depth?l(t,n,o.nodeAfter,o.before(s),i,!0):l(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function ao(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function FK(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(ao(t,new Y(n),"pointer"),!0):!1}function BK(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Y&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(Y.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(ao(t,Y.create(t.state.doc,i),"pointer"),!0):!1}function zK(t,e,n,r,i){return Am(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?BK(t,n):FK(t,n))}function jK(t,e,n,r){return Am(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function UK(t,e,n,r){return Am(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||VK(t,n,r)}function VK(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ao(t,me.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)ao(t,me.create(r,l+1,l+1+s.content.size),"pointer");else if(Y.isSelectable(s))ao(t,Y.create(r,l),"pointer");else continue;return!0}}function _m(t){return wu(t)}const xx=Ut?"metaKey":"ctrlKey";mt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=_m(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&LK(n,t.input.lastClick)&&!n[xx]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(kc(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new WK(t,s,n,!!r)):(o=="doubleClick"?jK:UK)(t,s.pos,s.inside,n)?n.preventDefault():pr(t,"pointer"))};class WK{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[xx],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a?a.dom:null;let{selection:u}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof Y&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&fn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),pr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Vn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(kc(e))),this.updateAllowDefault(e),this.allowDefault||!n?pr(this.view,"pointer"):zK(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ht&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ao(this.view,le.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):pr(this.view,"pointer")}move(e){this.updateAllowDefault(e),pr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}mt.touchstart=t=>{t.input.lastTouch=Date.now(),_m(t),pr(t,"pointer")};mt.touchmove=t=>{t.input.lastTouch=Date.now(),pr(t,"pointer")};mt.contextmenu=t=>_m(t);function Ox(t,e){return t.composing?!0:ht&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const HK=rn?5e3:-1;gt.compositionstart=gt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),wu(t,!0),t.markCursor=null;else if(wu(t),fn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){t.domSelection().collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}Tx(t,HK)};gt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Tx(t,20))};function Tx(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>wu(t),e))}function kx(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=GK());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function GK(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function wu(t,e=!1){if(!(rn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),kx(t),e||t.docView&&t.docView.dirty){let n=Om(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function KK(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const al=At&&xr<15||Oo&&WG<604;mt.copy=gt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=al?null:n.clipboardData,s=r.content(),{dom:l,text:a}=yx(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):KK(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function qK(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function YK(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ul(t,r.value,null,i,e):ul(t,r.textContent,r.innerHTML,i,e)},50)}function ul(t,e,n,r,i){let o=vx(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,o||z.empty)))return!0;if(!o)return!1;let s=qK(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ax(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}gt.paste=(t,e)=>{let n=e;if(t.composing&&!rn)return;let r=al?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ul(t,Ax(r),r.getData("text/html"),i,n)?n.preventDefault():YK(t,n)};class _x{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Nx=Ut?"altKey":"ctrlKey";mt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(kc(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Y?i.to-1:i.to))){if(r&&r.mightDrag)s=Y.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let c=t.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=t.docView&&(s=Y.create(t.state.doc,c.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:u}=yx(t,l);n.dataTransfer.clearData(),n.dataTransfer.setData(al?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",al||n.dataTransfer.setData("text/plain",u),t.dragging=new _x(l,!n[Nx],s)};mt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};gt.dragover=gt.dragenter=(t,e)=>e.preventDefault();gt.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(kc(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",h=>{s=h(s,t)}):s=vx(t,Ax(n.dataTransfer),al?null:n.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!n[Nx]);if(t.someProp("handleDrop",h=>h(t,n,s||z.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?TG(t.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let u=t.state.tr;if(l){let{node:h}=r;h?h.replace(u):u.deleteSelection()}let c=u.mapping.map(a),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=u.doc;if(f?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(d))return;let p=u.doc.resolve(c);if(f&&Y.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Y(p));else{let h=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((v,S,m,y)=>h=y),u.setSelection(Tm(t,p,u.doc.resolve(h)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};mt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Vn(t)},20))};mt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};mt.beforeinput=(t,e)=>{if(ot&&rn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Gr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in gt)mt[t]=gt[t];function cl(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Eu{constructor(e,n){this.toDOM=e,this.spec=n||si,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new sn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Eu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&cl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Tr{constructor(e,n){this.attrs=e,this.spec=n||si}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new sn(o,s,this)}valid(e,n){return n.from=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;se){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,i+l,o)}}map(e,n,r){return this==nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||si)}mapInner(e,n,r,i,o){let s;for(let l=0;l{let u=a+r,c;if(c=Ix(n,l,u)){for(i||(i=this.children.slice());ol&&f.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+n.content.size;for(let l=0;lo&&a.type instanceof Tr){let u=Math.max(o,a.from)-o,c=Math.min(s,a.to)-o;ui.map(e,n,si));return lr.from(r)}forChild(e,n){if(n.isLeaf)return ze.empty;let r=[];for(let i=0;in instanceof ze)?e:e.reduce((n,r)=>n.concat(r instanceof ze?r:r.members),[]))}}}function JK(t,e,n,r,i,o,s){let l=t.slice();for(let u=0,c=o;u{let S=v-h-(p-d);for(let m=0;my+c-f)continue;let g=l[m]+c-f;p>=g?l[m+1]=d<=g?-2:-1:d>=c&&S&&(l[m]+=S,l[m+1]+=S)}f+=S}),c=n.maps[u].map(c,-1)}let a=!1;for(let u=0;u=r.content.size){a=!0;continue}let d=n.map(t[u+1]+o,-1),p=d-i,{index:h,offset:v}=r.content.findIndex(f),S=r.maybeChild(h);if(S&&v==f&&v+S.nodeSize==p){let m=l[u+2].mapInner(n,S,c+1,t[u]+o+1,s);m!=nt?(l[u]=f,l[u+1]=p,l[u+2]=m):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=QK(l,t,e,n,i,o,s),c=Cu(u,r,0,s);e=c.local;for(let f=0;fn&&s.to{let u=Ix(t,l,a+n);if(u){o=!0;let c=Cu(u,l,n+a+1,r);c!=nt&&i.push(a,a+l.nodeSize,c)}});let s=Mx(o?Px(t):t,-n).sort(li);for(let l=0;l0;)e++;t.splice(e,0,n)}function Kf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=nt&&e.push(r)}),t.cursorWrapper&&e.push(ze.create(t.state.doc,[t.cursorWrapper.deco])),lr.from(e)}const XK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ZK=At&&xr<=11;class eq{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class tq{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new eq,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),ZK&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,XK)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Q1(this.view)){if(this.suppressingSelectionUpdates)return Vn(this.view);if(At&&xr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&hi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=ll(o))n.add(o);for(let o=e.anchorNode;o;o=ll(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Q1(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let c=0;c1){let c=a.filter(f=>f.nodeName=="BR");if(c.length==2){let f=c[0],d=c[1];f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}}let u=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,s),nq(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Vn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;ci;S--){let m=r.childNodes[S-1],y=m.pmViewDesc;if(m.nodeName=="BR"&&!y){o=S;break}if(!y||y.size)break}let f=t.state.doc,d=t.someProp("domParser")||ol.fromSchema(t.state.schema),p=f.resolve(s),h=null,v=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:oq,context:p});if(u&&u[0].pos!=null){let S=u[0].pos,m=u[1]&&u[1].pos;m==null&&(m=S),h={anchor:S+s,head:m+s}}return{doc:v,sel:h,from:s,to:l}}function oq(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ht&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||ht&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const sq=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function lq(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=Om(t,I);if(M&&!t.state.selection.eq(M)){if(ot&&rn&&t.input.lastKeyCode===13&&Date.now()-100T(t,Gr(13,"Enter"))))return;let J=t.state.tr.setSelection(M);I=="pointer"?J.setMeta("pointer",!0):I=="key"&&J.scrollIntoView(),o&&J.setMeta("composition",o),t.dispatch(J)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,u=iq(t,e,n),c=t.state.doc,f=c.slice(u.from,u.to),d,p;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||rn)&&i.some(I=>I.nodeType==1&&!sq.test(I.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",I=>I(t,Gr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof me&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let I=a0(t,t.state.doc,u.sel);if(I&&!I.eq(t.state.selection)){let M=t.state.tr.setSelection(I);o&&M.setMeta("composition",o),t.dispatch(M)}}return}if(ot&&t.cursorWrapper&&u.sel&&u.sel.anchor==t.cursorWrapper.deco.from&&u.sel.head==u.sel.anchor){let I=h.endB-h.start;u.sel={anchor:u.sel.anchor+I,head:u.sel.anchor+I}}t.input.domChangeCount++,t.state.selection.fromt.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?h.start=t.state.selection.from:h.endA=t.state.selection.to-2&&t.state.selection.to<=u.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),At&&xr<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>u.from&&u.doc.textBetween(h.start-u.from-1,h.start-u.from+1)==" "&&(h.start--,h.endA--,h.endB--);let v=u.doc.resolveNoCache(h.start-u.from),S=u.doc.resolveNoCache(h.endB-u.from),m=c.resolve(h.start),y=v.sameParent(S)&&v.parent.inlineContent&&m.end()>=h.endA,g;if((Oo&&t.input.lastIOSEnter>Date.now()-225&&(!y||i.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!y&&v.posI(t,Gr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&uq(c,h.start,h.endA,v,S)&&t.someProp("handleKeyDown",I=>I(t,Gr(8,"Backspace")))){rn&&ot&&t.domObserver.suppressSelectionUpdates();return}ot&&rn&&h.endB==h.start&&(t.input.lastAndroidDelete=Date.now()),rn&&!y&&v.start()!=S.start()&&S.parentOffset==0&&v.depth==S.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==h.endA&&(h.endB-=2,S=u.doc.resolveNoCache(h.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,Gr(13,"Enter"))})},20));let w=h.start,x=h.endA,C,O,k;if(y){if(v.pos==S.pos)At&&xr<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Vn(t),20)),C=t.state.tr.delete(w,x),O=c.resolve(h.start).marksAcross(c.resolve(h.endA));else if(h.endA==h.endB&&(k=aq(v.parent.content.cut(v.parentOffset,S.parentOffset),m.parent.content.cut(m.parentOffset,h.endA-m.start()))))C=t.state.tr,k.type=="add"?C.addMark(w,x,k.mark):C.removeMark(w,x,k.mark);else if(v.parent.child(v.index()).isText&&v.index()==S.index()-(S.textOffset?0:1)){let I=v.parent.textBetween(v.parentOffset,S.parentOffset);if(t.someProp("handleTextInput",M=>M(t,w,x,I)))return;C=t.state.tr.insertText(I,w,x)}}if(C||(C=t.state.tr.replace(w,x,u.doc.slice(h.start-u.from,h.endB-u.from))),u.sel){let I=a0(t,C.doc,u.sel);I&&!(ot&&rn&&t.composing&&I.empty&&(h.start!=h.endB||t.input.lastAndroidDeletee.content.size?null:Tm(t,e.resolve(n.anchor),e.resolve(n.head))}function aq(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,l,a;for(let c=0;cc.mark(l.addToSet(c.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=c=>c.mark(l.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||qf(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function cq(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s=s?o-r:0;o-=a,o&&o=l?o-r:0;o-=a,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class SY{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new IK,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(h0),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=d0(this),f0(this),this.nodeViews=p0(this),this.docView=H1(this.state.doc,c0(this),Kf(this),this.dom,this),this.domObserver=new tq(this,(r,i,o,s)=>lq(this,r,i,o,s)),this.domObserver.start(),PK(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&_p(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(h0),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(kx(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=p0(this);dq(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&_p(this),this.editable=d0(this),f0(this);let a=Kf(this),u=c0(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,u,a);(f||!e.selection.eq(i.selection))&&(s=!0);let d=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&KG(this);if(s){this.domObserver.stop();let p=f&&(At||ot)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&fq(i.selection,e.selection);if(f){let h=ot?this.trackWrites=this.domSelectionRange().focusNode:null;(o||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=H1(e.doc,u,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&vK(this))?Vn(this,p):(hx(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&qG(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Y){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&B1(this,n.getBoundingClientRect(),e)}else B1(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new _x(e.slice,e.move,i<0?void 0:Y.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return eK(this,e)}coordsAtPos(e,n=1){return sx(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return oK(this,n||this.state,e)}pasteHTML(e,n){return ul(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ul(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&($K(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Kf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return RK(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return ht&&this.root.nodeType===11&&zG(this.dom.ownerDocument)==this.dom?rq(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function c0(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[sn.node(0,t.state.doc.content.size,e)]}function f0(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:sn.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function d0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function fq(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function p0(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function dq(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function h0(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Mr={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:"'"},bu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pq=typeof navigator<"u"&&/Mac/.test(navigator.platform),hq=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qe=0;qe<10;qe++)Mr[48+qe]=Mr[96+qe]=String(qe);for(var qe=1;qe<=24;qe++)Mr[qe+111]="F"+qe;for(var qe=65;qe<=90;qe++)Mr[qe]=String.fromCharCode(qe+32),bu[qe]=String.fromCharCode(qe);for(var Yf in Mr)bu.hasOwnProperty(Yf)||(bu[Yf]=Mr[Yf]);function mq(t){var e=pq&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||hq&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?bu:Mr)[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}const gq=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function yq(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let l=0;l127)&&(o=Mr[r.keyCode])&&o!=i){let l=e[Jf(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const $x=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function wq(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Eq=(t,e,n)=>{let r=wq(t,n);if(!r)return!1;let i=Dx(r);if(!i){let s=r.blockRange(),l=s&&wm(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&Lx(t,i,e))return!0;if(r.parent.content.size==0&&(To(o,"end")||Y.isSelectable(o))){let s=Em(t.doc,r.before(),r.after(),z.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=Dx(r)}let s=o&&o.nodeBefore;return!s||!Y.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Y.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Dx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function bq(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=bq(t,n);if(!r)return!1;let i=Rx(r);if(!i)return!1;let o=i.nodeAfter;if(Lx(t,i,e))return!0;if(r.parent.content.size==0&&(To(o,"start")||Y.isSelectable(o))){let s=Em(t.doc,r.before(),r.after(),z.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
-`).scrollIntoView()),!0)};function Im(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Im(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(le.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Aq=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Rt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Im(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Oa(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&wm(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Nq(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Y&&e.selection.node.isBlock)return!r.parentOffset||!Oa(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let o=i.parentOffset==i.parent.content.size,s=e.tr;(e.selection instanceof me||e.selection instanceof Rt)&&s.deleteSelection();let l=r.depth==0?null:Im(r.node(-1).contentMatchAt(r.indexAfter(-1))),a=t&&t(i.parent,o),u=a?[a]:o&&l?[{type:l}]:void 0,c=Oa(s.doc,s.mapping.map(r.pos),1,u);if(!u&&!c&&Oa(s.doc,s.mapping.map(r.pos),1,l?[{type:l}]:void 0)&&(l&&(u=[{type:l}]),c=!0),c&&(s.split(s.mapping.map(r.pos),1,u),!o&&!r.parentOffset&&r.parent.type!=l)){let f=s.mapping.map(r.before()),d=s.doc.resolve(f);l&&r.node(-1).canReplaceWith(d.index(),d.index()+1,l)&&s.setNodeMarkup(s.mapping.map(r.before()),l)}n(s.scrollIntoView())}return!0}}const Mq=Nq(),Iq=(t,e)=>(e&&e(t.tr.setSelection(new Rt(t.doc))),!0);function Pq(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Gb(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Lx(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o,s;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(Pq(t,e,n))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(s=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&s.matchType(o[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,d=$.empty;for(let v=o.length-1;v>=0;v--)d=$.from(o[v].create(null,d));d=$.from(r.copy(d));let p=t.tr.step(new Dt(e.pos-1,f,e.pos,f,new z(d,1,0),o.length,!0)),h=f+2*o.length;Gb(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}let a=le.findFrom(e,1),u=a&&a.$from.blockRange(a.$to),c=u&&wm(u);if(c!=null&&c>=e.depth)return n&&n(t.tr.lift(u,c).scrollIntoView()),!0;if(l&&To(i,"start",!0)&&To(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let p=i,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let v=$.empty;for(let m=d.length-1;m>=0;m--)v=$.from(d[m].copy(v));let S=t.tr.step(new Dt(e.pos-d.length,e.pos+i.nodeSize,e.pos+h,e.pos+i.nodeSize-h,new z(v,d.length,0),0,!0));n(S.scrollIntoView())}return!0}}return!1}function Fx(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(me.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const $q=Fx(-1),Dq=Fx(1);function Pm(...t){return function(e,n,r){for(let i=0;i=n?Ue.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ue.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ue.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ue.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};Ue.from=function(e){return e instanceof Ue?e:e&&e.length?new zx(e):Ue.empty};var zx=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=xu)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=xu)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ue);Ue.empty=new zx([]);var Lq=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ue);const Fq=500;class on{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,u=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,c.push(f);return}if(i){c.push(new yn(f.map));let p=f.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],u.push(new yn(h,void 0,void 0,u.length+c.length))),o--,h&&i.appendMap(h,o)}else s.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(o)):f.selection,a=new on(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let c=0;czq&&(l=Bq(l,u),s-=u),new on(l.append(o),s)}remapping(e,n){let r=new so;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new on(this.items.append(e.map(n=>new yn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(d=>{d.selection&&l--},i);let a=n;this.items.forEach(d=>{let p=o.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(d.step){let v=e.steps[p].invert(e.docs[p]),S=d.selection&&d.selection.map(o.slice(a+1,p));S&&l++,r.push(new yn(h,v,S))}else r.push(new yn(h))},i);let u=[];for(let d=n;dFq&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let f=new yn(u.invert(),a,c),d,p=i.length-1;(d=i.length&&i[p].merge(f))?i[p]=d:i.push(f)}}else s.map&&r--},this.items.length,0),new on(Ue.from(i.reverse()),o)}}on.empty=new on(Ue.empty,0);function Bq(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class yn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new yn(n.getMap().invert(),n,this.selection)}}}class rr{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const zq=20;function jq(t,e,n,r){let i=n.getMeta(kr),o;if(i)return i.historyState;n.getMeta(Vq)&&(t=new rr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(kr))return s.getMeta(kr).redo?new rr(t.done.addTransform(n,void 0,r,Ta(e)),t.undone,g0(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new rr(t.done,t.undone.addTransform(n,void 0,r,Ta(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Uq(n,t.prevRanges)),u=s?Xf(t.prevRanges,n.mapping):g0(n.mapping.maps[n.steps.length-1]);return new rr(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Ta(e)),on.empty,u,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new rr(t.done.rebased(n,o),t.undone.rebased(n,o),Xf(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new rr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Xf(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Uq(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function g0(t){let e=[];return t.forEach((n,r,i,o)=>e.push(i,o)),e}function Xf(t,e){if(!t)return null;let n=[];for(let r=0;r{let n=kr.getState(t);return!n||n.done.eventCount==0?!1:(e&&jx(n,t,e,!1),!0)},Hq=(t,e)=>{let n=kr.getState(t);return!n||n.undone.eventCount==0?!1:(e&&jx(n,t,e,!0),!0)};export{yY as A,pY as B,fY as C,dY as D,CY as E,gY as F,wY as G,Wq as H,Hq as I,EY as J,ms as K,ol as L,SY as M,jH as N,VH as O,uY as P,h9 as Q,Ra as R,vY as S,nY as U,Qq as _,Xq as a,Rs as b,eY as c,Zq as d,ie as e,Jq as f,Yq as g,Kq as h,kM as i,Gq as j,Up as k,oY as l,q6 as m,aY as n,rY as o,Fu as p,iY as q,H as r,mY as s,qq as t,sY as u,tY as v,cY as w,lY as x,hY as y,QC as z};
diff --git a/packages/chord-chart-studio/build/assets/vendor-BWYuIjsn.js b/packages/chord-chart-studio/build/assets/vendor-BWYuIjsn.js
new file mode 100644
index 00000000..cad176af
--- /dev/null
+++ b/packages/chord-chart-studio/build/assets/vendor-BWYuIjsn.js
@@ -0,0 +1,142 @@
+var Tn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function o$(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}function s$(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var XS=s$;function l$(t){return t}var Rl=l$,a$=XS,by=Math.max;function u$(t,e,n){return e=by(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=by(r.length-e,0),s=Array(o);++i0){if(++e>=gk)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var bk=Sk,wk=mk,Ek=bk,Ck=Ek(wk),ob=Ck,xk=Rl,Tk=ZS,Ok=ob;function $k(t,e){return Ok(Tk(t,e,xk),t+"")}var qo=$k;function kk(){this.__data__=[],this.size=0}var Ak=kk;function Pk(t,e){return t===e||t!==t&&e!==e}var Ll=Pk,_k=Ll;function Mk(t,e){for(var n=t.length;n--;)if(_k(t[n][0],e))return n;return-1}var cc=Mk,Nk=cc,Ik=Array.prototype,Dk=Ik.splice;function Rk(t){var e=this.__data__,n=Nk(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Dk.call(e,n,1),--this.size,!0}var Lk=Rk,Fk=cc;function Bk(t){var e=this.__data__,n=Fk(e,t);return n<0?void 0:e[n][1]}var zk=Bk,jk=cc;function Uk(t){return jk(this.__data__,t)>-1}var Wk=Uk,Vk=cc;function Hk(t,e){var n=this.__data__,r=Vk(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var Kk=Hk,Gk=Ak,qk=Lk,Yk=zk,Jk=Wk,Qk=Kk;function Yo(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=r_}var qh=i_,o_=zh,s_=qh;function l_(t){return t!=null&&s_(t.length)&&!o_(t)}var Ni=l_,a_=Ni,u_=In;function c_(t){return u_(t)&&a_(t)}var gc=c_,su={exports:{}};function f_(){return!1}var d_=f_;su.exports;(function(t,e){var n=vn,r=d_,i=e&&!e.nodeType&&e,o=i&&!0&&t&&!t.nodeType&&t,s=o&&o.exports===i,l=s?n.Buffer:void 0,a=l?l.isBuffer:void 0,u=a||r;t.exports=u})(su,su.exports);var yc=su.exports,p_=_i,h_=Hh,m_=In,g_="[object Object]",y_=Function.prototype,v_=Object.prototype,mb=y_.toString,S_=v_.hasOwnProperty,b_=mb.call(Object);function w_(t){if(!m_(t)||p_(t)!=g_)return!1;var e=h_(t);if(e===null)return!0;var n=S_.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&mb.call(n)==b_}var gb=w_,E_=_i,C_=qh,x_=In,T_="[object Arguments]",O_="[object Array]",$_="[object Boolean]",k_="[object Date]",A_="[object Error]",P_="[object Function]",__="[object Map]",M_="[object Number]",N_="[object Object]",I_="[object RegExp]",D_="[object Set]",R_="[object String]",L_="[object WeakMap]",F_="[object ArrayBuffer]",B_="[object DataView]",z_="[object Float32Array]",j_="[object Float64Array]",U_="[object Int8Array]",W_="[object Int16Array]",V_="[object Int32Array]",H_="[object Uint8Array]",K_="[object Uint8ClampedArray]",G_="[object Uint16Array]",q_="[object Uint32Array]",we={};we[z_]=we[j_]=we[U_]=we[W_]=we[V_]=we[H_]=we[K_]=we[G_]=we[q_]=!0;we[T_]=we[O_]=we[F_]=we[$_]=we[B_]=we[k_]=we[A_]=we[P_]=we[__]=we[M_]=we[N_]=we[I_]=we[D_]=we[R_]=we[L_]=!1;function Y_(t){return x_(t)&&C_(t.length)&&!!we[E_(t)]}var J_=Y_;function Q_(t){return function(e){return t(e)}}var Zo=Q_,lu={exports:{}};lu.exports;(function(t,e){var n=tb,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,l=function(){try{var a=i&&i.require&&i.require("util").types;return a||s&&s.binding&&s.binding("util")}catch{}}();t.exports=l})(lu,lu.exports);var Yh=lu.exports,X_=J_,Z_=Zo,My=Yh,Ny=My&&My.isTypedArray,eM=Ny?Z_(Ny):X_,Jh=eM;function tM(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var yb=tM,nM=Wh,rM=Ll,iM=Object.prototype,oM=iM.hasOwnProperty;function sM(t,e,n){var r=t[e];(!(oM.call(t,e)&&rM(r,n))||n===void 0&&!(e in t))&&nM(t,e,n)}var Qh=sM,lM=Qh,aM=Wh;function uM(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o-1&&t%1==0&&t1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&mN(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++rMath.random().toString(36).substring(7).split("").join("."),AN={INIT:`@@redux/INIT${$f()}`,REPLACE:`@@redux/REPLACE${$f()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$f()}`},au=AN;function Xh(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Cb(t,e,n){if(typeof t!="function")throw new Error(Ke(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Ke(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ke(1));return n(Cb)(t,e)}let r=t,i=e,o=new Map,s=o,l=0,a=!1;function u(){s===o&&(s=new Map,o.forEach((S,m)=>{s.set(m,S)}))}function c(){if(a)throw new Error(Ke(3));return i}function f(S){if(typeof S!="function")throw new Error(Ke(4));if(a)throw new Error(Ke(5));let m=!0;u();const y=l++;return s.set(y,S),function(){if(m){if(a)throw new Error(Ke(6));m=!1,u(),s.delete(y),o=null}}}function d(S){if(!Xh(S))throw new Error(Ke(7));if(typeof S.type>"u")throw new Error(Ke(8));if(typeof S.type!="string")throw new Error(Ke(17));if(a)throw new Error(Ke(9));try{a=!0,i=r(i,S)}finally{a=!1}return(o=s).forEach(y=>{y()}),S}function p(S){if(typeof S!="function")throw new Error(Ke(10));r=S,d({type:au.REPLACE})}function h(){const S=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(Ke(11));function y(){const w=m;w.next&&w.next(c())}return y(),{unsubscribe:S(y)}},[By](){return this}}}return d({type:au.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:p,[By]:h}}function PN(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:au.INIT})>"u")throw new Error(Ke(12));if(typeof n(void 0,{type:au.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ke(13))})}function _N(t){const e=Object.keys(t),n={};for(let o=0;o"u")throw l&&l.type,new Error(Ke(14));u[f]=h,a=a||h!==p}return a=a||r.length!==Object.keys(s).length,a?u:s}}function uu(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function MN(...t){return e=>(n,r)=>{const i=e(n,r);let o=()=>{throw new Error(Ke(15))};const s={getState:i.getState,dispatch:(a,...u)=>o(a,...u)},l=t.map(a=>a(s));return o=uu(...l)(i.dispatch),{...i,dispatch:o}}}function NN(t){return Xh(t)&&"type"in t&&typeof t.type=="string"}var xb=Symbol.for("immer-nothing"),zy=Symbol.for("immer-draftable"),Ft=Symbol.for("immer-state");function cn(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Ao=Object.getPrototypeOf;function Si(t){return!!t&&!!t[Ft]}function bi(t){var e;return t?Tb(t)||Array.isArray(t)||!!t[zy]||!!((e=t.constructor)!=null&&e[zy])||bc(t)||wc(t):!1}var IN=Object.prototype.constructor.toString();function Tb(t){if(!t||typeof t!="object")return!1;const e=Ao(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===IN}function cu(t,e){Sc(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function Sc(t){const e=t[Ft];return e?e.type_:Array.isArray(t)?1:bc(t)?2:wc(t)?3:0}function Qd(t,e){return Sc(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Ob(t,e,n){const r=Sc(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function DN(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function bc(t){return t instanceof Map}function wc(t){return t instanceof Set}function Yr(t){return t.copy_||t.base_}function Xd(t,e){if(bc(t))return new Map(t);if(wc(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);if(!e&&Tb(t))return Ao(t)?{...t}:Object.assign(Object.create(null),t);const n=Object.getOwnPropertyDescriptors(t);delete n[Ft];let r=Reflect.ownKeys(n);for(let i=0;i1&&(t.set=t.add=t.clear=t.delete=RN),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>Zh(r,!0))),t}function RN(){cn(2)}function Ec(t){return Object.isFrozen(t)}var LN={};function wi(t){const e=LN[t];return e||cn(0,t),e}var rl;function $b(){return rl}function FN(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function jy(t,e){e&&(wi("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Zd(t){ep(t),t.drafts_.forEach(BN),t.drafts_=null}function ep(t){t===rl&&(rl=t.parent_)}function Uy(t){return rl=FN(rl,t)}function BN(t){const e=t[Ft];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Wy(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ft].modified_&&(Zd(e),cn(4)),bi(t)&&(t=fu(e,t),e.parent_||du(e,t)),e.patches_&&wi("Patches").generateReplacementPatches_(n[Ft].base_,t,e.patches_,e.inversePatches_)):t=fu(e,n,[]),Zd(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==xb?t:void 0}function fu(t,e,n){if(Ec(e))return e;const r=e[Ft];if(!r)return cu(e,(i,o)=>Vy(t,r,e,i,o,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return du(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),cu(o,(l,a)=>Vy(t,r,i,l,a,n,s)),du(t,i,!1),n&&t.patches_&&wi("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function Vy(t,e,n,r,i,o,s){if(Si(i)){const l=o&&e&&e.type_!==3&&!Qd(e.assigned_,r)?o.concat(r):void 0,a=fu(t,i,l);if(Ob(n,r,a),Si(a))t.canAutoFreeze_=!1;else return}else s&&n.add(i);if(bi(i)&&!Ec(i)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;fu(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&du(t,i)}}function du(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Zh(e,n)}function zN(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:$b(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=em;n&&(i=[r],o=il);const{revoke:s,proxy:l}=Proxy.revocable(i,o);return r.draft_=l,r.revoke_=s,l}var em={get(t,e){if(e===Ft)return t;const n=Yr(t);if(!Qd(n,e))return jN(t,n,e);const r=n[e];return t.finalized_||!bi(r)?r:r===kf(t.base_,e)?(Af(t),t.copy_[e]=np(r,t)):r},has(t,e){return e in Yr(t)},ownKeys(t){return Reflect.ownKeys(Yr(t))},set(t,e,n){const r=kb(Yr(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=kf(Yr(t),e),o=i==null?void 0:i[Ft];if(o&&o.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(DN(n,i)&&(n!==void 0||Qd(t.base_,e)))return!0;Af(t),tp(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return kf(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Af(t),tp(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Yr(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){cn(11)},getPrototypeOf(t){return Ao(t.base_)},setPrototypeOf(){cn(12)}},il={};cu(em,(t,e)=>{il[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});il.deleteProperty=function(t,e){return il.set.call(this,t,e,void 0)};il.set=function(t,e,n){return em.set.call(this,t[0],e,n,t[0])};function kf(t,e){const n=t[Ft];return(n?Yr(n):t)[e]}function jN(t,e,n){var i;const r=kb(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function kb(t,e){if(!(e in t))return;let n=Ao(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Ao(n)}}function tp(t){t.modified_||(t.modified_=!0,t.parent_&&tp(t.parent_))}function Af(t){t.copy_||(t.copy_=Xd(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var UN=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const o=n;n=e;const s=this;return function(a=o,...u){return s.produce(a,c=>n.call(this,c,...u))}}typeof n!="function"&&cn(6),r!==void 0&&typeof r!="function"&&cn(7);let i;if(bi(e)){const o=Uy(this),s=np(e,void 0);let l=!0;try{i=n(s),l=!1}finally{l?Zd(o):ep(o)}return jy(o,r),Wy(i,o)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===xb&&(i=void 0),this.autoFreeze_&&Zh(i,!0),r){const o=[],s=[];wi("Patches").generateReplacementPatches_(e,i,o,s),r(o,s)}return i}else cn(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(s,...l)=>this.produceWithPatches(s,a=>e(a,...l));let r,i;return[this.produce(e,n,(s,l)=>{r=s,i=l}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){bi(t)||cn(8),Si(t)&&(t=Ab(t));const e=Uy(this),n=np(t,void 0);return n[Ft].isManual_=!0,ep(e),n}finishDraft(t,e){const n=t&&t[Ft];(!n||!n.isManual_)&&cn(9);const{scope_:r}=n;return jy(r,e),Wy(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=wi("Patches").applyPatches_;return Si(t)?r(t,e):this.produce(t,i=>r(i,e))}};function np(t,e){const n=bc(t)?wi("MapSet").proxyMap_(t,e):wc(t)?wi("MapSet").proxySet_(t,e):zN(t,e);return(e?e.scope_:$b()).drafts_.push(n),n}function Ab(t){return Si(t)||cn(10,t),Pb(t)}function Pb(t){if(!bi(t)||Ec(t))return t;const e=t[Ft];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=Xd(t,e.scope_.immer_.useStrictShallowCopy_)}else n=Xd(t,!0);return cu(n,(r,i)=>{Ob(n,r,Pb(i))}),e&&(e.finalized_=!1),n}var Bt=new UN;Bt.produce;Bt.produceWithPatches.bind(Bt);Bt.setAutoFreeze.bind(Bt);Bt.setUseStrictShallowCopy.bind(Bt);Bt.applyPatches.bind(Bt);Bt.createDraft.bind(Bt);Bt.finishDraft.bind(Bt);function WN(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function VN(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function HN(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Hy=t=>Array.isArray(t)?t:[t];function KN(t){const e=Array.isArray(t[0])?t[0]:t;return HN(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function GN(t,e){const n=[],{length:r}=t;for(let i=0;i{n=ra(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function _b(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let o=0,s=0,l,a={},u=i.pop();typeof u=="object"&&(a=u,u=i.pop()),WN(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const c={...n,...a},{memoize:f,memoizeOptions:d=[],argsMemoize:p=tm,argsMemoizeOptions:h=[],devModeChecks:v={}}=c,S=Hy(d),m=Hy(h),y=KN(i),g=f(function(){return o++,u.apply(null,arguments)},...S),w=p(function(){s++;const x=GN(y,arguments);return l=g.apply(null,x),l},...m);return Object.assign(w,{resultFunc:u,memoizedResultFunc:g,dependencies:y,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>l,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:f,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var QN=_b(tm),XN=Object.assign((t,e=QN)=>{VN(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(o=>t[o]);return e(r,(...o)=>o.reduce((s,l,a)=>(s[n[a]]=l,s),{}))},{withTypes:()=>XN});function Mb(t){return({dispatch:n,getState:r})=>i=>o=>typeof o=="function"?o(n,r,t):i(o)}var ZN=Mb(),eI=Mb,tI=(...t)=>{const e=_b(...t),n=Object.assign((...r)=>{const i=e(...r),o=(s,...l)=>i(Si(s)?Ab(s):s,...l);return Object.assign(o,i),o},{withTypes:()=>n});return n};tI(tm);var nI=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?uu:uu.apply(null,arguments)};function Cc(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(Bl(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>NN(r)&&r.type===t,n}var Nb=class As extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,As.prototype)}static get[Symbol.species](){return As}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new As(...e[0].concat(this)):new As(...e.concat(this))}};function rI(t){return typeof t=="boolean"}var iI=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=e??{};let s=new Nb;return n&&(rI(n)?s.push(ZN):s.push(eI(n.extraArgument))),s},oI="RTK_autoBatch",Ib=t=>e=>{setTimeout(e,t)},sI=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Ib(10),lI=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,o=!1,s=!1;const l=new Set,a=t.type==="tick"?queueMicrotask:t.type==="raf"?sI:t.type==="callback"?t.queueNotification:Ib(t.timeout),u=()=>{s=!1,o&&(o=!1,l.forEach(c=>c()))};return Object.assign({},r,{subscribe(c){const f=()=>i&&c(),d=r.subscribe(f);return l.add(c),()=>{d(),l.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[oI]),o=!i,o&&(s||(s=!0,a(u))),r.dispatch(c)}finally{i=!0}}})},aI=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Nb(t);return r&&i.push(lI(typeof r=="object"?r:void 0)),i},uI=!0;function GX(t){const e=iI(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:o=void 0,enhancers:s=void 0}=t||{};let l;if(typeof n=="function")l=n;else if(Xh(n))l=_N(n);else throw new Error(Bl(1));let a;typeof r=="function"?a=r(e):a=e();let u=uu;i&&(u=nI({trace:!uI,...typeof i=="object"&&i}));const c=MN(...a),f=aI(c);let d=typeof s=="function"?s(f):f();const p=u(...d);return Cb(l,o,p)}var cI="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",fI=(t=21)=>{let e="",n=t;for(;n--;)e+=cI[Math.random()*64|0];return e},dI=(t,e)=>{if(typeof t!="function")throw new Error(Bl(32))},nm="listenerMiddleware",pI=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:o}=t;if(e)i=Cc(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(Bl(21));return dI(o),{predicate:i,type:e,effect:o}},hI=Object.assign(t=>{const{type:e,predicate:n,effect:r}=pI(t);return{id:fI(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Bl(22))}}},{withTypes:()=>hI}),mI=Object.assign(Cc(`${nm}/add`),{withTypes:()=>mI});Cc(`${nm}/removeAll`);var gI=Object.assign(Cc(`${nm}/remove`),{withTypes:()=>gI});function Bl(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Db={},rm={};Object.defineProperty(rm,"__esModule",{value:!0});rm.default=vI;function yI(){return"@@is-valid-redux-reducer/"+Math.random().toString(36).substring(7).split("").join("\\")}function vI(t){var e=arguments.length<=1||arguments[1]===void 0?!1:arguments[1];if(typeof t!="function"){if(e)throw new Error("Reducer must be a function.");return!1}var n=t(void 0,{type:yI()});if(typeof n>"u"){if(e)throw new Error("Reducer must return the initial state if the state is undefined.");return!1}return!0}Object.defineProperty(Db,"__esModule",{value:!0});var qX=Db.default=EI,SI=rm,bI=wI(SI);function wI(t){return t&&t.__esModule?t:{default:t}}function EI(t){var e=Object.keys(t),n=void 0;try{for(var r=0;r"u"?{}:Object.assign({},i);function u(c,f,d){for(var p=0;p"u"?u(function(c){},o,void 0):typeof s>"u"?u(function(c){return i[c]},o,i):u(function(c){return i[c]},o,s),l?a:i}}var CI=_i,xI=In,TI="[object Symbol]";function OI(t){return typeof t=="symbol"||xI(t)&&CI(t)==TI}var zl=OI,$I=vt,kI=zl,AI=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,PI=/^\w*$/;function _I(t,e){if($I(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||kI(t)?!0:PI.test(t)||!AI.test(t)||e!=null&&t in Object(e)}var im=_I,Rb=Uh,MI="Expected a function";function om(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(MI);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(om.Cache||Rb),n}om.Cache=Rb;var NI=om,II=NI,DI=500;function RI(t){var e=II(t,function(r){return n.size===DI&&n.clear(),r}),n=e.cache;return e}var LI=RI,FI=LI,BI=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zI=/\\(\\)?/g,jI=FI(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(BI,function(n,r,i,o){e.push(i?o.replace(zI,"$1"):r||n)}),e}),UI=jI;function WI(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n0&&n(l)?e>1?zb(l,e-1,n,r,i):jD(i,l):r||(i[i.length]=l)}return i}var lm=zb,WD=lm;function VD(t){var e=t==null?0:t.length;return e?WD(t,1):[]}var HD=VD,KD=HD,GD=ZS,qD=ob;function YD(t){return qD(GD(t,void 0,KD),t+"")}var jb=YD,JD=DD,QD=jb,XD=QD(function(t,e){return t==null?{}:JD(t,e)}),ZD=XD;const YX=xe(ZD);var eR="__lodash_hash_undefined__";function tR(t){return this.__data__.set(t,eR),this}var nR=tR;function rR(t){return this.__data__.has(t)}var iR=rR,oR=Uh,sR=nR,lR=iR;function pu(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new oR;++el))return!1;var u=o.get(t),c=o.get(e);if(u&&c)return u==e&&c==t;var f=-1,d=!0,p=n&mR?new fR:void 0;for(o.set(t,e),o.set(e,t);++fe||o&&s&&a&&!l&&!u||r&&s&&a||!n&&a||!i)return 1;if(!r&&!o&&!u&&t