"use strict";(globalThis.webpackChunkacademy_blocks=globalThis.webpackChunkacademy_blocks||[]).push([[82],{47404(t,e,i){i.d(e,{Ar:()=>h,Bc:()=>xt,Gw:()=>ct,OO:()=>Ct,et:()=>l,wm:()=>gt,yU:()=>At});var n=i(31638),s=i(36898),r=i(15874);class o{constructor(t,e,i,n){this.state=t,this.pos=e,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let e=(0,r.mv)(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(f(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e,i){"abort"==t&&this.abortListeners&&(this.abortListeners.push(e),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function a(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function l(t){let e=t.map(t=>"string"==typeof t?{label:t}:t),[i,n]=e.every(t=>/^\w+$/.test(t.label))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}function h(t,e){return i=>{for(let e=(0,r.mv)(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return e(i)}}class c{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function u(t){return t.selection.main.from}function f(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const d=n.YH.define();function O(t,e,i,s){let{main:r}=t.selection,o=i-r.from,a=s-r.from;return{...t.changeByRange(l=>{if(l!=r&&i!=s&&t.sliceDoc(l.from+o,l.from+a)!=t.sliceDoc(i,s))return{range:l};let h=t.toText(e);return{changes:{from:l.from+o,to:s==r.from?l.to:l.from+a,insert:h},range:n.OF.cursor(l.from+o+h.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const p=new WeakMap;function g(t){if(!Array.isArray(t))return t;let e=p.get(t);return e||p.set(t,e=l(t)),e}const m=n.Pe.define(),v=n.Pe.define();class w{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&h<=57||h>=97&&h<=122?2:h>=65&&h<=90?1:0:(w=(0,n.MK)(h))!=w.toLowerCase()?1:w!=w.toUpperCase()?2:0;(!s||1==b&&g||0==v&&0!=b)&&(e[u]==h||i[u]==h&&(f=!0)?o[u++]=s:o.length&&(m=!1)),v=b,s+=(0,n.Fh)(h)}return u==l&&0==o[0]&&m?this.result((f?-200:0)-100,o,t):d==l&&0==O?this.ret(-200-t.length+(p==t.length?0:-100),[0,p]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):d==l?this.ret(-900-t.length,[O,p]):u==l?this.result((f?-200:0)-100-700+(m?0:-1100),o,t):2==e.length?null:this.result((s[0]?-700:0)-200-1100,s,t)}result(t,e,i){let s=[],r=0;for(let t of e){let e=t+(this.astral?(0,n.Fh)((0,n.vS)(i,t)):1);r&&s[r-1]==t?s[r-1]=e:(s[r++]=t,s[r++]=e)}return this.ret(t-i.length,s)}}class b{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length(0,n.QR)(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:S,filterStrict:!1,compareCompletions:(t,e)=>(t.sortText||t.label).localeCompare(e.sortText||e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>x(t(i),e(i)),optionClass:(t,e)=>i=>x(t(i),e(i)),addToOptions:(t,e)=>t.concat(e),filterStrict:(t,e)=>t||e})});function x(t,e){return t?e?t+" "+e:t:e}function S(t,e,i,n,r,o){let a,l,h=t.textDirection==s.OP.RTL,c=h,u=!1,f="top",d=e.left-r.left,O=r.right-e.right,p=n.right-n.left,g=n.bottom-n.top;if(c&&d=g||t>e.top?a=i.bottom-e.top:(f="bottom",a=e.bottom-i.top)}return{style:`${f}: ${a/((e.bottom-e.top)/o.offsetHeight)}px; max-width: ${l/((e.right-e.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(u?h?"left-narrow":"right-narrow":c?"left":"right")}}const Q=n.Pe.define();function k(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class ${constructor(t,e,i){this.view=t,this.stateField=e,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let n=t.state.field(e),{options:s,selected:r}=n.open,o=t.state.facet(y);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map(t=>"cm-completionIcon-"+t)),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i,n){let s=document.createElement("span");s.className="cm-completionLabel";let r=t.displayLabel||t.label,o=0;for(let t=0;to&&s.appendChild(document.createTextNode(r.slice(o,e)));let a=s.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(r.slice(e,i))),a.className="cm-completionMatchedText",o=i}return ot.position-e.position).map(t=>t.render)}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=k(s.length,r,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",i=>{let{options:n}=t.state.field(e).open;for(let e,s=i.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(e=/-(\d+)$/.exec(s.id))&&+e[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=e&&(t.dispatch({effects:Q.of(e)}),i.preventDefault())}}),this.dom.addEventListener("focusout",e=>{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(y).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:v.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let i=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=n){let{options:s,selected:r,disabled:o}=i.open;n.open&&n.open.options==s||(this.range=k(s.length,r,t.state.facet(y).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),o!=(null===(e=n.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;(e.selected>-1&&e.selected=this.range.to)&&(this.range=k(e.options.length,e.selected,this.view.state.facet(y).maxRenderedOptions),this.showOptions(e.options,t.id));let i=this.updateSelectedOption(e.selected);if(i){this.destroyInfo();let{completion:n}=e.options[e.selected],{info:r}=n;if(!r)return;let o="string"==typeof r?document.createTextNode(r):r(n);if(!o)return;"then"in o?o.then(e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e,n)}).catch(t=>(0,s.c_)(this.view.state,t,"completion info")):(this.addInfoPane(o,n),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,e){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=t.nodeType)i.appendChild(t),this.infoDestroy=null;else{let{dom:e,destroy:n}=t;i.appendChild(e),this.infoDestroy=n||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby")):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect(),s=i.height/t.offsetHeight;n.topi.bottom&&(t.scrollTop+=(n.bottom-i.bottom)/s)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:t.clientWidth,bottom:t.clientHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottom{t.target==n&&t.preventDefault()});let s=null;for(let r=i.from;ri.from||0==i.from)&&(s=t,"string"!=typeof l&&l.header?n.appendChild(l.header(l)):n.appendChild(document.createElement("completion-section")).textContent=t)}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,this.view,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.tonew $(i,t,e)}function Z(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}class T{constructor(t,e,i,n,s,r){this.options=t,this.attrs=e,this.tooltip=i,this.timestamp=n,this.selected=s,this.disabled=r}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new T(this.options,R(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s,r){if(n&&!r&&t.some(t=>t.isPending))return n.setDisabled();let o=function(t,e){let i=[],n=null,s=null,r=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some(e=>e.name==t)||n.push("string"==typeof e?{name:t}:e)}},o=e.facet(y);for(let n of t)if(n.hasResult()){let t=n.result.getMatch;if(!1===n.result.filter)for(let e of n.result.options)r(new c(e,n.source,t?t(e):[],1e9-i.length));else{let i,a=e.sliceDoc(n.from,n.to),l=o.filterStrict?new b(a):new w(a);for(let e of n.result.options)if(i=l.match(e.label)){let o=e.displayLabel?t?t(e,i.matched):[]:i.matched,a=i.score+(e.boost||0);if(r(new c(e,n.source,o,a)),"object"==typeof e.section&&"dynamic"===e.section.rank){let{name:t}=e.section;s||(s=Object.create(null)),s[t]=Math.max(a,s[t]||-1e9)}}}}if(n){let t=Object.create(null),e=0,r=(t,e)=>("dynamic"===t.rank&&"dynamic"===e.rank?s[e.name]-s[t.name]:0)||("number"==typeof t.rank?t.rank:1e9)-("number"==typeof e.rank?e.rank:1e9)||(t.namee.score-t.score||h(t.completion,e.completion))){let e=t.completion;!l||l.label!=e.label||l.detail!=e.detail||null!=l.type&&null!=e.type&&l.type!=e.type||l.apply!=e.apply||l.boost!=e.boost?a.push(t):Z(t.completion)>Z(l)&&(a[a.length-1]=t),l=t.completion}return a}(t,e);if(!o.length)return n&&t.some(t=>t.isPending)?n.setDisabled():null;let a=e.facet(y).selectOnOpen?0:-1;if(n&&n.selected!=a&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t,1e8),create:D,above:s.aboveCursor},n?n.timestamp:Date.now(),a,!1)}map(t){return new T(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new T(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class A{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new A(X,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(y),n=(i.override||e.languageDataAt("autocomplete",u(e)).map(g)).map(e=>(this.active.find(t=>t.source==e)||new z(e,this.active.some(t=>0!=t.state)?1:0)).update(t,i));n.length==this.active.length&&n.every((t,e)=>t==this.active[e])&&(n=this.active);let s=this.open,r=t.effects.some(t=>t.is(L));s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;it.isPending)&&(s=null),!s&&n.every(t=>!t.isPending)&&n.some(t=>t.hasResult())&&(n=n.map(t=>t.hasResult()?new z(t.source,0):t));for(let e of t.effects)e.is(Q)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new A(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?C:M}}const C={"aria-autocomplete":"list"},M={};function R(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const X=[];function _(t,e){if(t.isUserEvent("input.complete")){let i=t.annotation(d);if(i&&e.activateOnCompletion(i))return 12}let i=t.isUserEvent("input.type");return i&&e.activateOnTyping?5:i?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class z{constructor(t,e,i=!1){this.source=t,this.state=e,this.explicit=i}hasResult(){return!1}get isPending(){return 1==this.state}update(t,e){let i=_(t,e),n=this;(8&i||16&i&&this.touches(t))&&(n=new z(n.source,0)),4&i&&0==n.state&&(n=new z(this.source,1)),n=n.updateFor(t,i);for(let e of t.effects)if(e.is(m))n=new z(n.source,1,e.value);else if(e.is(v))n=new z(n.source,0);else if(e.is(L))for(let t of e.value)t.source==n.source&&(n=t);return n}updateFor(t,e){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(u(t.state))}}class Y extends z{constructor(t,e,i,n,s,r){super(t,3,e),this.limit=i,this.result=n,this.from=s,this.to=r}hasResult(){return!0}updateFor(t,e){var i;if(!(3&e))return this.map(t.changes);let n=this.result;n.map&&!t.changes.empty&&(n=n.map(n,t.changes));let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),a=u(t.state);if(a>r||!n||2&e&&(u(t.startState)==this.from||at.map(t=>t.map(e))}),E=n.sU.define({create:()=>A.start(),update:(t,e)=>t.update(e),provide:t=>[s.DK.from(t,t=>t.tooltip),s.Lz.contentAttributes.from(t,t=>t.attrs)]});function W(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(E).active.find(t=>t.source==e.source);return n instanceof Y&&("string"==typeof i?t.dispatch({...O(t.state,i,n.from,n.to),annotations:d.of(e.completion)}):i(t,e.completion,n.from,n.to),!0)}const D=P(E,W);function q(t,e="option"){return i=>{let n=i.state.field(E,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+o*(t?1:-1):t?0:a-1;return l<0?l="page"==e?0:a-1:l>=a&&(l="page"==e?a-1:0),i.dispatch({effects:Q.of(l)}),!0}}const j=t=>!!t.state.field(E,!1)&&(t.dispatch({effects:m.of(!0)}),!0);class V{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const B=s.Z9.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(E).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(E),i=t.state.facet(y);if(!t.selectionSet&&!t.docChanged&&t.startState.field(E)==e)return;let n=t.transactions.some(t=>{let e=_(t,i);return 8&e||(t.selection||t.docChanged)&&!(3&e)});for(let e=0;e50&&Date.now()-i.time>1e3){for(let t of i.context.abortListeners)try{t()}catch(t){(0,s.c_)(this.view.state,t)}i.context.abortListeners=null,this.running.splice(e--,1)}else i.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(t=>t.effects.some(t=>t.is(m)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(t=>t.isPending&&!this.running.some(e=>e.active.source==t.source))?setTimeout(()=>this.startUpdate(),r):-1,0!=this.composing)for(let e of t.transactions)e.isUserEvent("input.type")?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(E);for(let t of e.active)t.isPending&&!this.running.some(e=>e.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(y).updateSyncTime))}startQuery(t){let{state:e}=this.view,i=u(e),n=new o(e,i,t.explicit,this.view),r=new V(t,n);this.running.push(r),Promise.resolve(t.source(n)).then(t=>{r.context.aborted||(r.done=t||null,this.scheduleAccept())},t=>{this.view.dispatch({effects:v.of(null)}),(0,s.c_)(this.view.state,t)})}scheduleAccept(){this.running.every(t=>void 0!==t.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(y).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(y),n=this.view.state.field(E);for(let s=0;st.source==r.active.source);if(o&&o.isPending)if(null==r.done){let t=new z(r.active.source,0);for(let e of r.updates)t=t.update(e,i);t.isPending||e.push(t)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:L.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(E,!1);if(e&&e.tooltip&&this.view.state.facet(y).closeOnBlur){let i=e.open&&(0,s.Eg)(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:v.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:m.of(!1)}),20),this.composing=0}}}),I="object"==typeof navigator&&/Win/.test(navigator.platform),N=n.Nb.highest(s.Lz.domEventHandlers({keydown(t,e){let i=e.state.field(E,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&(!I||!t.altKey)||t.metaKey)return!1;let n=i.open.options[i.open.selected],s=i.active.find(t=>t.source==n.source),r=n.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(t.key)>-1&&W(e,n),!1}})),G=s.Lz.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class U{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class F{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,n.iR.TrackDel),i=t.mapPos(this.to,1,n.iR.TrackDel);return null==e||null==i?null:new F(this.field,e,i)}}class H{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),o=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=o,a=/^\t*/.exec(s)[0].length;for(let e=0;enew F(t.field,n[t.line]+t.from,n[t.line]+t.to));return{text:i,ranges:a}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1,l=o.replace(/\\[{}]/g,t=>t[1]);for(let e=0;e=a&&t.field++}for(let t of s)if(t.line==n.length&&t.from>e.index){let i=e[2]?3+(e[1]||"").length:2;t.from-=i,t.to-=i}s.push(new U(a,n.length,e.index,e.index+l.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}r=r.replace(/\\([{}])/g,(t,e,i)=>{for(let t of s)t.line==n.length&&t.from>i&&(t.from--,t.to--);return e}),n.push(r)}return new H(n,s)}}let K=s.NZ.widget({widget:new class extends s.xO{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),J=s.NZ.mark({class:"cm-snippetField"});class tt{constructor(t,e){this.ranges=t,this.active=e,this.deco=s.NZ.set(t.map(t=>(t.from==t.to?K:J).range(t.from,t.to)),!0)}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new tt(e,this.active)}selectionInsideField(t){return t.ranges.every(t=>this.ranges.some(e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))}}const et=n.Pe.define({map:(t,e)=>t&&t.map(e)}),it=n.Pe.define(),nt=n.sU.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(et))return i.value;if(i.is(it)&&t)return new tt(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>s.Lz.decorations.from(t,t=>t?t.deco:s.NZ.none)});function st(t,e){return n.OF.create(t.filter(t=>t.field==e).map(t=>n.OF.range(t.from,t.to)))}function rt(t){let e=H.parse(t);return(t,i,s,r)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),{main:l}=t.state.selection,h={changes:{from:s,to:r==l.from?l.to:r,insert:n.EY.of(o)},scrollIntoView:!0,annotations:i?[d.of(i),n.ZX.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=st(a,0)),a.some(t=>t.field>0)){let e=new tt(a,0),i=h.effects=[et.of(e)];void 0===t.state.field(nt,!1)&&i.push(n.Pe.appendConfig.of([nt,ht,ut,G]))}t.dispatch(t.state.update(h))}}function ot(t){return({state:e,dispatch:i})=>{let n=e.field(nt,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some(e=>e.field==s+t);return i(e.update({selection:st(n.ranges,s),effects:et.of(r?null:new tt(n.ranges,s)),scrollIntoView:!0})),!0}}const at=[{key:"Tab",run:ot(1),shift:ot(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(nt,!1)&&(e(t.update({effects:et.of(null)})),!0)}],lt=n.sj.define({combine:t=>t.length?t[0]:at}),ht=n.Nb.highest(s.w4.compute([lt],t=>t.facet(lt)));function ct(t,e){return{...e,apply:rt(t)}}const ut=s.Lz.domEventHandlers({mousedown(t,e){let i,n=e.state.field(nt,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find(t=>t.from<=i&&t.to>=i);return!(!s||s.field==n.active||(e.dispatch({selection:st(n.ranges,s.field),effects:et.of(n.ranges.some(t=>t.field>s.field)?new tt(n.ranges,s.field):null),scrollIntoView:!0}),0))}}),ft={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},dt=n.Pe.define({map(t,e){let i=e.mapPos(t,-1,n.iR.TrackAfter);return null==i?void 0:i}}),Ot=new class extends n.FB{};Ot.startSide=1,Ot.endSide=-1;const pt=n.sU.define({create:()=>n.om.empty,update(t,e){if(t=t.map(e.changes),e.selection){let i=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:t=>t>=i.from&&t<=i.to})}for(let i of e.effects)i.is(dt)&&(t=t.update({add:[Ot.range(i.value,i.value+1)]}));return t}});function gt(){return[yt,pt]}const mt="()[]{}<>«»»«[]{}";function vt(t){for(let e=0;e<16;e+=2)if(mt.charCodeAt(e)==t)return mt.charAt(e+1);return(0,n.MK)(t<128?t:t+1)}function wt(t,e){return t.languageDataAt("closeBrackets",e)[0]||ft}const bt="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),yt=s.Lz.inputHandler.of((t,e,i,s)=>{if((bt?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(s.length>2||2==s.length&&1==(0,n.Fh)((0,n.vS)(s,0))||e!=r.from||i!=r.to)return!1;let o=function(t,e){let i=wt(t,t.selection.main.head),s=i.brackets||ft.brackets;for(let r of s){let o=vt((0,n.vS)(r,0));if(e==r)return o==r?Pt(t,r,s.indexOf(r+r+r)>-1,i):kt(t,r,o,i.before||ft.before);if(e==o&&St(t,t.selection.main.from))return $t(t,0,o)}return null}(t.state,s);return!!o&&(t.dispatch(o),!0)}),xt=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=wt(t,t.selection.main.head).brackets||ft.brackets,s=null,r=t.changeByRange(e=>{if(e.empty){let s=function(t,e){let i=t.sliceString(e-2,e);return(0,n.Fh)((0,n.vS)(i,0))==i.length?i:i.slice(1)}(t.doc,e.head);for(let r of i)if(r==s&&Qt(t.doc,e.head)==vt((0,n.vS)(r,0)))return{changes:{from:e.head-r.length,to:e.head+r.length},range:n.OF.cursor(e.head-r.length)}}return{range:s=e}});return s||e(t.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s}}];function St(t,e){let i=!1;return t.field(pt).between(0,t.doc.length,t=>{t==e&&(i=!0)}),i}function Qt(t,e){let i=t.sliceString(e,e+2);return i.slice(0,(0,n.Fh)((0,n.vS)(i,0)))}function kt(t,e,i,s){let r=null,o=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:i,from:o.to}],effects:dt.of(o.to+e.length),range:n.OF.range(o.anchor+e.length,o.head+e.length)};let a=Qt(t.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:e+i,from:o.head},effects:dt.of(o.head+e.length),range:n.OF.cursor(o.head+e.length)}:{range:r=o}});return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function $t(t,e,i){let s=null,r=t.changeByRange(e=>e.empty&&Qt(t.doc,e.head)==i?{changes:{from:e.head,to:e.head+i.length,insert:i},range:n.OF.cursor(e.head+i.length)}:s={range:e});return s?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Pt(t,e,i,s){let o=s.stringPrefixes||ft.stringPrefixes,a=null,l=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:dt.of(s.to+e.length),range:n.OF.range(s.anchor+e.length,s.head+e.length)};let l,h=s.head,c=Qt(t.doc,h);if(c==e){if(Zt(t,h))return{changes:{insert:e+e,from:h},effects:dt.of(h+e.length),range:n.OF.cursor(h+e.length)};if(St(t,h)){let s=i&&t.sliceDoc(h,h+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:h,to:h+s.length,insert:s},range:n.OF.cursor(h+s.length)}}}else{if(i&&t.sliceDoc(h-2*e.length,h)==e+e&&(l=Tt(t,h-2*e.length,o))>-1&&Zt(t,l))return{changes:{insert:e+e+e+e,from:h},effects:dt.of(h+e.length),range:n.OF.cursor(h+e.length)};if(t.charCategorizer(h)(c)!=n.Je.Word&&Tt(t,h,o)>-1&&!function(t,e,i,n){let s=(0,r.mv)(t).resolveInner(e,-1),o=n.reduce((t,e)=>Math.max(t,e.length),0);for(let r=0;r<5;r++){let r=t.sliceDoc(s.from,Math.min(s.to,s.from+i.length+o)),a=r.indexOf(i);if(!a||a>-1&&n.indexOf(r.slice(0,a))>-1){let e=s.firstChild;for(;e&&e.from==s.from&&e.to-e.from>i.length+a;){if(t.sliceDoc(e.to-i.length,e.to)==i)return!1;e=e.firstChild}return!0}let l=s.to==e&&s.parent;if(!l)break;s=l}return!1}(t,h,e,o))return{changes:{insert:e+e,from:h},effects:dt.of(h+e.length),range:n.OF.cursor(h+e.length)}}return{range:a=s}});return a?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function Zt(t,e){let i=(0,r.mv)(t).resolveInner(e+1);return i.parent&&i.from==e}function Tt(t,e,i){let s=t.charCategorizer(e);if(s(t.sliceDoc(e-1,e))!=n.Je.Word)return e;for(let r of i){let i=e-r.length;if(t.sliceDoc(i,e)==r&&s(t.sliceDoc(i-1,i))!=n.Je.Word)return i}return-1}function At(t={}){return[N,E,y.of(t),B,Mt,G]}const Ct=[{key:"Ctrl-Space",run:j},{mac:"Alt-`",run:j},{mac:"Alt-i",run:j},{key:"Escape",run:t=>{let e=t.state.field(E,!1);return!(!e||!e.active.some(t=>0!=t.state)||(t.dispatch({effects:v.of(null)}),0))}},{key:"ArrowDown",run:q(!0)},{key:"ArrowUp",run:q(!1)},{key:"PageDown",run:q(!0,"page")},{key:"PageUp",run:q(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(E,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.facet(y).defaultKeymap?[Ct]:[]))},87967(t,e,i){i.d(e,{javascript:()=>dt});var n=i(90365);class s{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new s(t,[],e,i,i,0,[],0,n?new r(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=this.reducePos=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(n,l)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&(0!=this.buffer[s-4]||this.buffer[s-1]<0)){let t=!1;for(let e=s;e>0&&this.buffer[e-2]>i;e-=4)if(this.buffer[e-1]>=0){t=!0;break}if(t)for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4)}this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i,n){if(131072&t)this.pushState(65535&t,this.pos);else if(262144&t)this.pos=n,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,n,4);else{let s=t,{parser:r}=this.p;this.pos=n;let o=r.stateFlag(s,1);!o&&(n>i||e<=r.maxNode)&&(this.reducePos=n),this.pushState(s,o?i:Math.min(i,this.reducePos)),this.shiftContext(e,i),e<=r.maxNode&&this.buffer.push(e,i,n,4)}}apply(t,e,i,n){65536&t?this.reduce(t):this.shift(t,e,i,n)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new o(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(!(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n)||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&e,s=this.stack.length-3*i;if(s<0||t.getGoto(this.stack[s],n,!1)<0){let t=this.findForcedReduction();if(null==t)return!1;e=t}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],i=(n,s)=>{if(!e.includes(n))return e.push(n),t.allActions(n,e=>{if(393216&e);else if(65536&e){let i=(e>>19)-s;if(i>1){let n=65535&e,s=this.stack.length-3*i;if(s>=0&&t.getGoto(this.stack[s],n,!1)>=0)return i<<19|65536|n}}else{let t=i(e,s+1);if(null!=t)return t}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e0&&this.emitLookAhead()}}class r{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class o{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class a{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new a(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new a(this.stack,this.pos,this.index)}}function l(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class h{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const c=new h;class u{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=c,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=c,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class f{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;p(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}f.prototype.contextual=f.prototype.fallback=f.prototype.extend=!1;class d{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?l(t):t}token(t,e){let i=t.pos,n=0;for(;;){let i=t.next<0,s=t.resolveOffset(1,1);if(p(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(null==this.elseToken)return;if(i||n++,null==s)break;t.reset(s,t.token)}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}d.prototype.contextual=f.prototype.fallback=f.prototype.extend=!1;class O{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function p(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||m(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function g(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function m(t,e,i,n){let s=g(i,n,e);return s<0||g(i,n,t)e)&&!s.type.isError)return i<0?Math.max(0,Math.min(s.to-1,e-25)):Math.min(t.length,Math.max(s.from+1,e+25));if(i<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return i<0?0:t.length}}class y{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?b(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?b(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(r instanceof n.PH){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+r.length}}}class x{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(t=>new h)}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new h,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new h,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){1&s?t.extended=s>>1:t.value=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new y(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return v&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort((t,e)=>e.score-t.score);s.length>t;)s.pop();s.some(t=>t.reducePos>n)&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&(s.sort((t,e)=>e.score-t.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&s>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let a=this.fragments.nodeAt(s);a;){let s=this.parser.nodeSet.types[a.type.id]==a.type?r.getGoto(t.state,a.type.id):-1;if(s>-1&&a.length&&(!e||(a.prop(n.uY.contextHash)||0)==i))return t.useNode(a,s),v&&console.log(o+this.stackID(t)+` (via reuse of ${r.getName(a.type.id)})`),!0;if(!(a instanceof n.PH)||0==a.children.length||a.positions[0]>0)break;let l=a.children[0];if(!(l instanceof n.PH&&0==a.positions[0]))break;a=l}}let a=r.stateSlot(t.state,4);if(a>0)return t.reduce(a),v&&console.log(o+this.stackID(t)+` (via always-reduce ${r.getName(65535&a)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let n=0;ns?e.push(f):i.push(f)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Q(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),v&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;t<10&&c.forceReduce()&&(v&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,i));t++)v&&(u=this.stackID(c)+" -> ");for(let t of o.recoverByInsert(a))v&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),v&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Q(o,i)):(!n||n.scoret;class P extends n.iX{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1]),s=[];for(let t=0;t=0)r(n,t,e[i++]);else{let s=e[i+-n];for(let o=-n;o>0;o--)r(e[i++],t,s);i++}}}this.nodeSet=new n.fI(e.map((e,r)=>n.Z6.define({name:r>=this.minRepeatTerm?void 0:e,id:r,props:s[r],top:i.indexOf(r)>-1,error:0==r,skipped:t.skippedNodes&&t.skippedNodes.indexOf(r)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=n.cF;let o=l(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new f(o,t):t),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new S(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){return!!this.allActions(t,t=>t==e||null)}allActions(t,e){let i=this.stateSlot(t,4),n=i?e(i):void 0;for(let i=this.stateSlot(t,1);null==n;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=Z(this.data,i+2)}n=e(Z(this.data,i+1))}return n}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=Z(this.data,i+2)}if(!(1&this.data[i+2])){let t=this.data[i+1];e.some((e,i)=>1&i&&e==t)||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(P.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(e=>{let i=t.tokenizers.find(t=>t.from==e);return i?i.to:e})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((i,n)=>{let s=t.specializers.find(t=>t.from==i.external);if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=T(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map(()=>!1);if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}var A=i(43720);const C=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],M=new class{constructor(t){this.start=t.start,this.shift=t.shift||$,this.reduce=t.reduce||$,this.reuse=t.reuse||$,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}({start:!1,shift:(t,e)=>5==e||6==e||320==e?t:321==e,strict:!1}),R=new O((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&t.acceptToken(318)},{contextual:!0,fallback:!0}),X=new O((t,e)=>{let i,{next:n}=t;C.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&(125==n||59==n||-1==n||e.context||t.acceptToken(316))},{contextual:!0}),_=new O((t,e)=>{91!=t.next||e.context||t.acceptToken(317)},{contextual:!0}),z=new O((t,e)=>{let{next:i}=t;if(43==i||45==i){if(t.advance(),i==t.next){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}else 63==i&&46==t.peek(1)&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(3))},{contextual:!0});function Y(t,e){return t>=65&&t<=90||t>=97&&t<=122||95==t||t>=192||!e&&t>=48&&t<=57}const L=new O((t,e)=>{if(60!=t.next||!e.dialectEnabled(0))return;if(t.advance(),47==t.next)return;let i=0;for(;C.indexOf(t.next)>-1;)t.advance(),i++;if(Y(t.next,!0)){for(t.advance(),i++;Y(t.next,!1);)t.advance(),i++;for(;C.indexOf(t.next)>-1;)t.advance(),i++;if(44==t.next)return;for(let e=0;;e++){if(7==e){if(!Y(t.next,!0))return;break}if(t.next!="extends".charCodeAt(e))break;t.advance(),i++}}t.acceptToken(4,-i)}),E=(0,A.pn)({"get set async static":A._A.modifier,"for while do if else switch try catch finally return throw break continue default case defer":A._A.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":A._A.operatorKeyword,"let var const using function class extends":A._A.definitionKeyword,"import export from":A._A.moduleKeyword,"with debugger new":A._A.keyword,TemplateString:A._A.special(A._A.string),super:A._A.atom,BooleanLiteral:A._A.bool,this:A._A.self,null:A._A.null,Star:A._A.modifier,VariableName:A._A.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":A._A.function(A._A.variableName),VariableDefinition:A._A.definition(A._A.variableName),Label:A._A.labelName,PropertyName:A._A.propertyName,PrivatePropertyName:A._A.special(A._A.propertyName),"CallExpression/MemberExpression/PropertyName":A._A.function(A._A.propertyName),"FunctionDeclaration/VariableDefinition":A._A.function(A._A.definition(A._A.variableName)),"ClassDeclaration/VariableDefinition":A._A.definition(A._A.className),"NewExpression/VariableName":A._A.className,PropertyDefinition:A._A.definition(A._A.propertyName),PrivatePropertyDefinition:A._A.definition(A._A.special(A._A.propertyName)),UpdateOp:A._A.updateOperator,"LineComment Hashbang":A._A.lineComment,BlockComment:A._A.blockComment,Number:A._A.number,String:A._A.string,Escape:A._A.escape,ArithOp:A._A.arithmeticOperator,LogicOp:A._A.logicOperator,BitOp:A._A.bitwiseOperator,CompareOp:A._A.compareOperator,RegExp:A._A.regexp,Equals:A._A.definitionOperator,Arrow:A._A.function(A._A.punctuation),": Spread":A._A.punctuation,"( )":A._A.paren,"[ ]":A._A.squareBracket,"{ }":A._A.brace,"InterpolationStart InterpolationEnd":A._A.special(A._A.brace),".":A._A.derefOperator,", ;":A._A.separator,"@":A._A.meta,TypeName:A._A.typeName,TypeDefinition:A._A.definition(A._A.typeName),"type enum interface implements namespace module declare":A._A.definitionKeyword,"abstract global Privacy readonly override":A._A.modifier,"is keyof unique infer asserts":A._A.operatorKeyword,JSXAttributeValue:A._A.attributeValue,JSXText:A._A.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":A._A.angleBracket,"JSXIdentifier JSXNameSpacedName":A._A.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":A._A.attributeName,"JSXBuiltin/JSXIdentifier":A._A.standard(A._A.tagName)}),W={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},D={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},q={__proto__:null,"<":193},j=P.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#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[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:M,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[E],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(r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!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[X,_,z,L,2,3,4,5,6,7,8,9,10,11,12,13,14,R,new d("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new d("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:t=>W[t]||-1},{term:343,get:t=>D[t]||-1},{term:95,get:t=>q[t]||-1}],tokenPrec:15201});var V=i(15874),B=i(31638),I=i(36898),N=i(47404);const G=[(0,N.Gw)("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),(0,N.Gw)("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),(0,N.Gw)("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),(0,N.Gw)("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),(0,N.Gw)("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),(0,N.Gw)("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),(0,N.Gw)("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),(0,N.Gw)("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),(0,N.Gw)("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),(0,N.Gw)('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),(0,N.Gw)('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],U=G.concat([(0,N.Gw)("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),(0,N.Gw)("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),(0,N.Gw)("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),F=new n.RY,H=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function K(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const J=["FunctionDeclaration"],tt={FunctionDeclaration:K("function"),ClassDeclaration:K("class"),ClassExpression:()=>!0,EnumDeclaration:K("constant"),TypeAliasDeclaration:K("type"),NamespaceDeclaration:K("namespace"),VariableDefinition(t,e){t.matchContext(J)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function et(t,e){let i=F.get(e);if(i)return i;let s=[],r=!0;function o(e,i){let n=t.sliceString(e.from,e.to);s.push({label:n,type:i})}return e.cursor(n.Qj.IncludeAnonymous).iterate(e=>{if(r)r=!1;else if(e.name){let t=tt[e.name];if(t&&t(e,o)||H.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of et(t,e.node))s.push(i);return!1}}),F.set(e,s),s}const it=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,nt=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function st(t){let e=(0,V.mv)(t.state).resolveInner(t.pos,-1);if(nt.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&it.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)H.has(i.name)&&(n=n.concat(et(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:it}}const rt=V.bj.define({name:"javascript",parser:j.configure({props:[V.Oh.add({IfStatement:(0,V.mz)({except:/^\s*({|else\b)/}),TryStatement:(0,V.mz)({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:V._Y,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:(0,V.Ay)({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":(0,V.mz)({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),V.b_.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":V.yd,BlockComment:t=>({from:t.from+2,to:t.to-2}),JSXElement(t){let e=t.firstChild;if(!e||"JSXSelfClosingTag"==e.name)return null;let i=t.lastChild;return{from:e.to,to:i.type.isError?t.to:i.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let i=null===(e=t.firstChild)||void 0===e?void 0:e.nextSibling,n=t.lastChild;return!i||i.type.isError?null:{from:i.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),ot={test:t=>/^JSX/.test(t.name),facet:(0,V.p9)({commentTokens:{block:{open:"{/*",close:"*/}"}}})},at=rt.configure({dialect:"ts"},"typescript"),lt=rt.configure({dialect:"jsx",props:[V.Q0.add(t=>t.isTop?[ot]:void 0)]}),ht=rt.configure({dialect:"jsx ts",props:[V.Q0.add(t=>t.isTop?[ot]:void 0)]},"typescript");let ct=t=>({label:t,type:"keyword"});const ut="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(ct),ft=ut.concat(["declare","implements","private","protected","public"].map(ct));function dt(t={}){let e=t.jsx?t.typescript?ht:lt:t.typescript?at:rt,i=t.typescript?U.concat(ft):G.concat(ut);return new V.Yy(e,[rt.data.of({autocomplete:(0,N.Ar)(nt,(0,N.et)(i))}),rt.data.of({autocomplete:st}),t.jsx?gt:[]])}function Ot(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const pt="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),gt=I.Lz.inputHandler.of((t,e,i,n,s)=>{if((pt?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!rt.isActiveAt(t.state,e,-1))return!1;let r=s(),{state:o}=r,a=o.changeByRange(t=>{var e;let i,{head:s}=t,r=(0,V.mv)(o).resolveInner(s-1,-1);if("JSXStartTag"==r.name&&(r=r.parent),o.doc.sliceString(s-1,s)!=n||"JSXAttributeValue"==r.name&&r.to>s);else{if(">"==n&&"JSXFragmentTag"==r.name)return{range:t,changes:{from:s,insert:""}};if("/"==n&&"JSXStartCloseTag"==r.name){let t=r.parent,n=t.parent;if(n&&t.from==s-2&&((i=Ot(o.doc,n.firstChild,s))||"JSXFragmentTag"==(null===(e=n.firstChild)||void 0===e?void 0:e.name))){let t=`${i}>`;return{range:B.OF.cursor(s+t.length,-1),changes:{from:s,insert:t}}}}else if(">"==n){let e=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if("JSXEscape"==t.name||!t.parent)return null;t=t.parent}}(r);if(e&&"JSXOpenTag"==e.name&&!/^\/?>|^<\//.test(o.doc.sliceString(s,s+2))&&(i=Ot(o.doc,e,s)))return{range:t,changes:{from:s,insert:``}}}}return{range:t}});return!a.changes.empty&&(t.dispatch([r,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})},15874(t,e,i){i.d(e,{Ay:()=>L,EI:()=>T,KB:()=>C,Lv:()=>dt,Oh:()=>M,Q0:()=>u,SG:()=>Ct,WD:()=>q,Xt:()=>P,Yy:()=>k,Zt:()=>xt,_Y:()=>W,_v:()=>A,b_:()=>V,bj:()=>O,cr:()=>pt,f7:()=>st,jU:()=>_t,mv:()=>p,mz:()=>D,p9:()=>c,tp:()=>Z,y9:()=>wt,yd:()=>B});var n,s=i(90365),r=i(31638),o=i(36898),a=i(43720),l=i(97417);const h=new s.uY;function c(t){return r.sj.define({combine:t?e=>e.concat(t):void 0})}const u=new s.uY;class f{constructor(t,e,i=[],n=""){this.data=t,this.name=n,r.$t.prototype.hasOwnProperty("tree")||Object.defineProperty(r.$t.prototype,"tree",{get(){return p(this)}}),this.parser=e,this.extension=[Q.of(this),r.$t.languageData.of((t,e,i)=>{let n=d(t,e,i),s=n.type.prop(h);if(!s)return[];let r=t.facet(s),o=n.type.prop(u);if(o){let s=n.resolve(e-n.from,i);for(let e of o)if(e.test(s,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(r)}}return r})].concat(i)}isActiveAt(t,e,i=-1){return d(t,e,i).type.prop(h)==this.data}findRegions(t){let e=t.facet(Q);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(h)==this.data)return void i.push({from:e,to:e+t.length});let r=t.prop(s.uY.mounted);if(r){if(r.tree.prop(h)==this.data){if(r.overlay)for(let t of r.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(r.overlay){let t=i.length;if(n(r.tree,r.overlay[0].from+e),i.length>t)return}}for(let i=0;it.isTop?e:void 0)]}),t.name)}configure(t,e){return new O(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function p(t){let e=t.field(f.state,!1);return e?e.tree:s.PH.empty}class g{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let m=null;class v{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new v(t,e,[],s.PH.empty,0,i,[],null)}startParse(){return this.parser.startParse(new g(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=s.PH.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(s.rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=m;m=this;try{return t()}finally{m=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=w(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,i,n,s)=>e.push({fromA:t,toA:i,fromB:n,toB:s})),i=s.rr.applyChanges(i,e),n=s.PH.empty,r=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);it.from&&(this.fragments=w(this.fragments,i,n),this.skipped.splice(e--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends s.iX{createParse(e,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let e=m;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=o,new s.PH(s.Z6.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return m}}function w(t,e,i){return s.rr.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class b{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new b(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=v.create(t.facet(Q).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new b(i)}}f.state=r.sU.define({create:b.init,update(t,e){for(let t of e.effects)if(t.is(f.setState))return t.value;return e.startState.facet(Q)!=e.state.facet(Q)?b.init(e.state):t.apply(e)}});let y=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(y=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const x="undefined"!=typeof navigator&&(null===(n=navigator.scheduling)||void 0===n?void 0:n.isInputPending)?()=>navigator.scheduling.isInputPending():null,S=o.Z9.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(f.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(f.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=y(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work(()=>x&&x()||Date.now()>r,n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:f.setState.of(new b(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(t=>(0,o.c_)(this.view.state,t)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Q=r.sj.define({combine:t=>t.length?t[0]:null,enables:t=>[f.state,S,o.Lz.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class k{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const $=r.sj.define(),P=r.sj.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Z(t){let e=t.facet(P);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function T(t,e){let i="",n=t.tabSize,s=t.facet(P)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=e?function(t,e,i){let n=e.resolveStack(i),s=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(s!=n.node){let t=[];for(let e=s;e&&!(e.fromn.node.to||e.from==n.node.from&&e.type==n.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return R(n,t,i)}(t,i,e):null}class C{constructor(t,e={}){this.state=t,this.options=e,this.unit=Z(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return null!=n&&n>=i.from&&n<=i.to?s&&n==t?{text:"",from:t}:(e<0?n-1&&(s+=r-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,e=t.length){return(0,r.y$)(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let t=s(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const M=new s.uY;function R(t,e,i){for(let n=t;n;n=n.next){let t=X(n.node);if(t)return t(z.create(e,i,n))}return 0}function X(t){let e=t.type.prop(M);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(s.uY.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>E(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?_:null}function _(){return 0}class z extends C{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.context=i}get node(){return this.context.node}static create(t,e,i){return new z(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(e.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Y(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return R(this.context.next,this.base,this.pos)}}function Y(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function L({closing:t,align:e=!0,units:i=1}){return n=>E(n,e,i,t)}function E(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,r=t.state.doc.lineAt(i.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let t=i.to;;){let s=e.childAfter(t);if(!s||s==n)return null;if(!s.type.isSkipped){if(s.from>=o)return null;let t=/^ */.exec(r.text.slice(i.to-r.from))[0].length;return{from:i.from,to:i.to+t}}t=s.to}}(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*i)}const W=t=>t.baseIndent;function D({except:t,units:e=1}={}){return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function q(){return r.$t.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some(t=>t.test(r)))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=A(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=T(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t})}const j=r.sj.define(),V=new s.uY;function B(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&o.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function G(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const U=r.Pe.define({map:G}),F=r.Pe.define({map:G});function H(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some(t=>t.from<=i&&t.to>=i)||e.push(t.lineBlockAt(i));return e}const K=r.sU.define({create:()=>o.NZ.none,update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((e,i)=>t=J(t,e,i)),t=t.map(e.changes);for(let i of e.effects)if(i.is(U)&&!et(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(ot),s=n?o.NZ.replace({widget:new ct(n(e.state,i.value))}):ht;t=t.update({add:[s.range(i.value.from,i.value.to)]})}else i.is(F)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));return e.selection&&(t=J(t,e.selection.main.head)),t},provide:t=>o.Lz.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,(t,e)=>{i.push(t,e)}),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{te&&(n=!0)}),n?t.update({filterFrom:e,filterTo:i,filter:(t,n)=>t>=i||n<=e}):t}function tt(t,e,i){var n;let s=null;return null===(n=t.field(K,!1))||void 0===n||n.between(e,i,(t,e)=>{(!s||s.from>t)&&(s={from:t,to:e})}),s}function et(t,e,i){let n=!1;return t.between(e,e,(t,s)=>{t==e&&s==i&&(n=!0)}),n}function it(t,e){return t.field(K,!1)?e:e.concat(r.Pe.appendConfig.of(at()))}function nt(t,e,i=!0){let n=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return o.Lz.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${s}.`)}const st=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:t=>{for(let e of H(t)){let i=N(t.state,e.from,e.to);if(i)return t.dispatch({effects:it(t.state,[U.of(i),nt(t,i)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:t=>{if(!t.state.field(K,!1))return!1;let e=[];for(let i of H(t)){let n=tt(t.state,i.from,i.to);n&&e.push(F.of(n),nt(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0}},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,i=[];for(let n=0;n{let e=t.state.field(K,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(t,e)=>{i.push(F.of({from:t,to:e}))}),t.dispatch({effects:i}),!0}}],rt={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},ot=r.sj.define({combine:t=>(0,r.QR)(t,rt)});function at(t){let e=[K,Ot];return t&&e.push(ot.of(t)),e}function lt(t,e){let{state:i}=t,n=i.facet(ot),s=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=tt(t.state,i.from,i.to);n&&t.dispatch({effects:F.of(n)}),e.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,s,e);let r=document.createElement("span");return r.textContent=n.placeholderText,r.setAttribute("aria-label",i.phrase("folded code")),r.title=i.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const ht=o.NZ.replace({widget:new class extends o.xO{toDOM(t){return lt(t,null)}}});class ct extends o.xO{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return lt(t,this.value)}}const ut={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class ft extends o.wJ{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function dt(t={}){let e={...ut,...t},i=new ft(e,!0),n=new ft(e,!1),s=o.Z9.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Q)!=t.state.facet(Q)||t.startState.field(K,!1)!=t.state.field(K,!1)||p(t.startState)!=p(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new r.vB;for(let s of t.viewportLineBlocks){let r=tt(t.state,s.from,s.to)?n:N(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:a}=e;return[s,(0,o.cU)({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||r.om.empty},initialSpacer:()=>new ft(e,!1),domEventHandlers:{...a,click:(t,e,i)=>{if(a.click&&a.click(t,e,i))return!0;let n=tt(t.state,e.from,e.to);if(n)return t.dispatch({effects:F.of(n)}),!0;let s=N(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:U.of(s)}),!0)}}}),at()]}const Ot=o.Lz.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class pt{constructor(t,e){let i;function n(t){let e=l.G.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof f?t=>t.prop(h)==r.data:r?t=>t==r:void 0,this.style=(0,a.az)(t.map(t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))})),{all:s}).style,this.module=i?new l.G(i):null,this.themeType=e.themeType}static define(t,e){return new pt(t,e||{})}}const gt=r.sj.define(),mt=r.sj.define({combine:t=>t.length?[t[0]]:null});function vt(t){let e=t.facet(gt);return e.length?e:t.facet(mt)}function wt(t,e){let i,n=[yt];return t instanceof pt&&(t.module&&n.push(o.Lz.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(mt.of(t)):i?n.push(gt.computeN([o.Lz.darkTheme],e=>e.facet(o.Lz.darkTheme)==("dark"==i)?[t]:[])):n.push(gt.of(t)),n}class bt{constructor(t){this.markCache=Object.create(null),this.tree=p(t.state),this.decorations=this.buildDeco(t,vt(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=p(t.state),i=vt(t.state),n=i!=vt(t.startState),{viewport:s}=t.view,r=t.changes.mapPos(this.decoratedTo,1);e.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=r):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return o.NZ.none;let i=new r.vB;for(let{from:n,to:s}of t.visibleRanges)(0,a.DM)(this.tree,e,(t,e,n)=>{i.add(t,e,this.markCache[n]||(this.markCache[n]=o.NZ.mark({class:n})))},n,s);return i.finish()}}const yt=r.Nb.high(o.Z9.fromClass(bt,{decorations:t=>t.decorations})),xt=pt.define([{tag:a._A.meta,color:"#404740"},{tag:a._A.link,textDecoration:"underline"},{tag:a._A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a._A.emphasis,fontStyle:"italic"},{tag:a._A.strong,fontWeight:"bold"},{tag:a._A.strikethrough,textDecoration:"line-through"},{tag:a._A.keyword,color:"#708"},{tag:[a._A.atom,a._A.bool,a._A.url,a._A.contentSeparator,a._A.labelName],color:"#219"},{tag:[a._A.literal,a._A.inserted],color:"#164"},{tag:[a._A.string,a._A.deleted],color:"#a11"},{tag:[a._A.regexp,a._A.escape,a._A.special(a._A.string)],color:"#e40"},{tag:a._A.definition(a._A.variableName),color:"#00f"},{tag:a._A.local(a._A.variableName),color:"#30a"},{tag:[a._A.typeName,a._A.namespace],color:"#085"},{tag:a._A.className,color:"#167"},{tag:[a._A.special(a._A.variableName),a._A.macroName],color:"#256"},{tag:a._A.definition(a._A.propertyName),color:"#00c"},{tag:a._A.comment,color:"#940"},{tag:a._A.invalid,color:"#f00"}]),St=o.Lz.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Qt="()[]{}",kt=r.sj.define({combine:t=>(0,r.QR)(t,{afterCursor:!0,brackets:Qt,maxScanDistance:1e4,renderMatch:Zt})}),$t=o.NZ.mark({class:"cm-matchingBracket"}),Pt=o.NZ.mark({class:"cm-nonmatchingBracket"});function Zt(t){let e=[],i=t.matched?$t:Pt;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}function Tt(t){let e=[],i=t.facet(kt);for(let n of t.selection.ranges){if(!n.empty)continue;let s=_t(t,n.head,-1,i)||n.head>0&&_t(t,n.head-1,1,i)||i.afterCursor&&(_t(t,n.head,1,i)||n.headt.decorations}),St];function Ct(t={}){return[kt.of(t),At]}const Mt=new s.uY;function Rt(t,e,i){let n=t.prop(e<0?s.uY.openedBy:s.uY.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function Xt(t){let e=t.type.prop(Mt);return e?e(t.node):t}function _t(t,e,i,n={}){let s=n.maxScanDistance||1e4,r=n.brackets||Qt,o=p(t),a=o.resolveInner(e,i);for(let t=a;t;t=t.parent){let n=Rt(t.type,i,r);if(n&&t.from0?e>=s.from&&es.from&&e<=s.to))return zt(0,0,i,t,s,n,r)}}return function(t,e,i,n,s,r,o){if(i<0?!e:e==t.doc.length)return null;let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=i>0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=r;){let r=c.value;i<0&&(t+=r.length);let a=e+t*i;for(let t=i>0?0:r.length-1,e=i>0?r.length:-1;t!=e;t+=i){let e=o.indexOf(r[t]);if(!(e<0||n.resolveInner(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zt(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==h&&r.indexOf(c.type.name)>-1&&c.from-1||(Et.push(t),console.warn(e))}function jt(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||a._A[i];n?"function"==typeof n?e.length?e=e.map(n):qt(i,`Modifier ${i} used at start of tag`):e.length?qt(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:qt(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(t=>t.id),o=Wt[r];if(o)return o.id;let l=Wt[r]=s.Z6.define({id:Lt.length,name:n,props:[(0,a.pn)({[n]:i})]});return Lt.push(l),l.id}o.OP.RTL,o.OP.LTR},31638(t,e,i){i.d(e,{YH:()=>ut,UJ:()=>ft,Gu:()=>A,VR:()=>C,Je:()=>xt,xx:()=>J,OF:()=>E,$t:()=>kt,sj:()=>q,N1:()=>x,iR:()=>T,Nb:()=>H,Q6:()=>Tt,om:()=>Mt,vB:()=>Rt,FB:()=>Pt,yn:()=>L,Pe:()=>Ot,DA:()=>dt,sU:()=>U,EY:()=>O,ZX:()=>pt,vS:()=>k,Fh:()=>P,QR:()=>$t,y$:()=>Vt,zK:()=>Q,kn:()=>Bt,MK:()=>$});let n=[],s=[];function r(t){if(t<768)return!1;for(let e=0,i=n.length;;){let r=e+i>>1;if(t=s[r]))return!0;e=r+1}if(e==i)return!1}}function o(t){return t>=127462&&t<=127487}function a(t,e,i=!0,n=!0){return(i?l:h)(t,e,n)}function l(t,e,i){if(e==t.length)return e;e&&u(t.charCodeAt(e))&&f(t.charCodeAt(e-1))&&e--;let n=c(t,e);for(e+=d(n);e=0&&o(c(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function h(t,e,i){for(;e>0;){let n=l(t,e-2,i);if(n=56320&&t<57344}function f(t){return t>=55296&&t<56320}function d(t){return t<65536?1:2}(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let e=0,i=0;ethis.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=S(this,t,e);let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),g.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=S(this,t,e);let i=[];return this.decompose(t,e,i,0),g.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new w(this),s=new w(t);for(let t=e,r=e;;){if(n.next(t),s.next(t),t=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(r+=n.value.length,n.done||r>=i)return!0}}iter(t=1){return new w(this,t)}iterRange(t,e=this.length){return new b(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new y(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new p(t):g.from(p.split(t,[])):O.empty}}class p extends O{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.text[s],o=n+r.length;if((e?i:o)>=t)return new x(n,o,i,r);n=o+1,i++}}decompose(t,e,i,n){let s=t<=0&&e>=this.length?this:new p(v(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&n){let t=i.pop(),e=m(s.text,t.text.slice(),0,s.length);if(e.length<=32)i.push(new p(e,t.length+s.length));else{let t=e.length>>1;i.push(new p(e.slice(0,t)),new p(e.slice(t)))}}else i.push(s)}replace(t,e,i){if(!(i instanceof p))return super.replace(t,e,i);[t,e]=S(this,t,e);let n=m(this.text,m(i.text,v(this.text,0,t)),e),s=this.length+i.length-(e-t);return n.length<=32?new p(n,s):g.from(p.split(n,[]),s)}sliceString(t,e=this.length,i="\n"){[t,e]=S(this,t,e);let n="";for(let s=0,r=0;s<=e&&rt&&r&&(n+=i),ts&&(n+=o.slice(Math.max(0,t-s),e-s)),s=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let s of t)i.push(s),n+=s.length+1,32==i.length&&(e.push(new p(i,n)),i=[],n=-1);return n>-1&&e.push(new p(i,n)),e}}class g extends O{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.children[s],o=n+r.length,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,i){if([t,e]=S(this,t,e),i.lines=s&&e<=o){let a=r.replace(t-s,e-s,i),l=this.lines-r.lines+a.lines;if(a.lines>4&&a.lines>l>>6){let s=this.children.slice();return s[n]=a,new g(s,this.length-(e-t)+i.length)}return super.replace(s,o,a)}s=o+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i="\n"){[t,e]=S(this,t,e);let n="";for(let s=0,r=0;st&&s&&(n+=i),tr&&(n+=o.sliceString(t-r,e-r,i)),r=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof g))return 0;let i=0,[n,s,r,o]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,s+=e){if(n==r||s==o)return i;let a=this.children[n],l=t.children[s];if(a!=l)return i+a.scanIdentical(l,e);i+=a.length+1}}static from(t,e=t.reduce((t,e)=>t+e.length+1,-1)){let i=0;for(let e of t)i+=e.lines;if(i<32){let i=[];for(let e of t)e.flatten(i);return new p(i,e)}let n=Math.max(32,i>>5),s=n<<1,r=n>>1,o=[],a=0,l=-1,h=[];function c(t){let e;if(t.lines>s&&t instanceof g)for(let e of t.children)c(e);else t.lines>r&&(a>r||!a)?(u(),o.push(t)):t instanceof p&&a&&(e=h[h.length-1])instanceof p&&t.lines+e.lines<=32?(a+=t.lines,l+=t.length+1,h[h.length-1]=new p(e.text.concat(t.text),e.length+1+t.length)):(a+t.lines>n&&u(),a+=t.lines,l+=t.length+1,h.push(t))}function u(){0!=a&&(o.push(1==h.length?h[0]:g.from(h,l)),l=-1,a=h.length=0)}for(let e of t)c(e);return u(),1==o.length?o[0]:new g(o,e)}}function m(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.slice(0,n-s)),s0?1:(t instanceof p?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],r=s>>1,o=n instanceof p?n.text.length:n.children.length;if(r==(e>0?o:0)){if(0==i)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(e>0?0:1)){if(this.offsets[i]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(n instanceof p){let s=n.text[r+(e<0?-1:0)];if(this.offsets[i]+=e,s.length>Math.max(0,t))return this.value=0==t?s:e>0?s.slice(t):s.slice(0,s.length-t),this;t-=s.length}else{let s=n.children[r+(e<0?-1:0)];t>s.length?(t-=s.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(s),this.offsets.push(e>0?1:(s instanceof p?s.text.length:s.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class b{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new w(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class y{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(O.prototype[Symbol.iterator]=function(){return this.iter()},w.prototype[Symbol.iterator]=b.prototype[Symbol.iterator]=y.prototype[Symbol.iterator]=function(){return this});class x{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}function S(t,e,i){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,i))]}function Q(t,e,i=!0,n=!0){return a(t,e,i,n)}function k(t,e){let i=t.charCodeAt(e);if(!((n=i)>=55296&&n<56320&&e+1!=t.length))return i;var n;let s=t.charCodeAt(e+1);return function(t){return t>=56320&&t<57344}(s)?s-56320+(i-55296<<10)+65536:i}function $(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function P(t){return t<65536?1:2}const Z=/\r\n?|\n/;var T=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(T||(T={}));class A{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=T.Simple&&l>=t&&(i==T.TrackDel&&nt||i==T.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let i=0,n=0;i=0&&n<=e&&s>=t)return!(ne)||"cover";n=s}return!1}toString(){let t="";for(let e=0;e=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(t=>"number"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeDesc");return new A(t)}static create(t){return new A(t)}}class C extends A{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return X(this,(e,i,n,s,r)=>t=t.replace(n,n+(i-e),r),!1),t}mapDesc(t,e=!1){return _(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let n=0,s=0;n=0){e[n]=o,e[n+1]=r;let a=n>>1;for(;i.length0&&R(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(t,e,i){let n=[],s=[],r=0,o=null;function a(t=!1){if(!t&&!n.length)return;ro||t<0||o>e)throw new RangeError(`Invalid change range ${t} to ${o} (in doc of length ${e})`);let c=h?"string"==typeof h?O.of(h.split(i||Z)):h:O.empty,u=c.length;if(t==o&&0==u)return;tr&&M(n,t-r,-1),M(n,o-t,u),R(s,n,c),r=o}}(t),a(!o),o}static empty(t){return new C(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let n=0;ne&&"string"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)e.push(s[0],0);else{for(;i.length=0&&i<=0&&i==t[s+1]?t[s]+=e:s>=0&&0==e&&0==t[s]?t[s+1]+=i:n?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function R(t,e,i){if(0==i.length)return;let n=e.length-2>>1;if(n>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(s,h,r,c,u),s=h,r=c}}}function _(t,e,i,n=!1){let s=[],r=n?[]:null,o=new Y(t),a=new Y(e);for(let t=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);M(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?C.createSet(s,r):A.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else M(n,0,o.ins,t),s&&R(s,n,o.text),o.next()}}class Y{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?O.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?O.empty:e[i].slice(this.off,null==t?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class L{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let t=7&this.flags;return 7==t?null:t}get goalColumn(){let t=this.flags>>6;return 16777215==t?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new L(i,n,this.flags)}extend(t,e=t,i=0){if(t<=this.anchor&&e>=this.anchor)return E.range(t,e,void 0,void 0,i);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return E.range(this.anchor,n,void 0,void 0,i)}eq(t,e=!1){return!(this.anchor!=t.anchor||this.head!=t.head||this.goalColumn!=t.goalColumn||e&&this.empty&&this.assoc!=t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return E.range(t.anchor,t.head)}static create(t,e,i){return new L(t,e,i)}}class E{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:E.create(this.ranges.map(i=>i.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;it.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new E(t.ranges.map(t=>L.fromJSON(t)),t.main)}static single(t,e=t){return new E([E.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;nt.from-e.from),e=t.indexOf(i);for(let i=1;in.head?E.range(o,r):E.range(r,o))}}return new E(t,e)}}function W(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let D=0;class q{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=D++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}get reader(){return this}static define(t={}){return new q(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:j),!!t.static,t.enables)}of(t){return new V([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new V(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new V(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],i=>e(i.field(t)))}}function j(t,e){return t==e||t.length==e.length&&t.every((t,i)=>t===e[i])}class V{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=D++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!0:1&(null!==(e=t[i.id])&&void 0!==e?e:1)||h.push(t[i.id]);return{create:t=>(t.values[r]=i(t),1),update(t,e){if(a&&e.docChanged||l&&(e.docChanged||e.selection)||I(t,h)){let e=i(t);if(o?!B(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=nt(e,l);if(this.dependencies.every(i=>i instanceof q?e.facet(i)===t.facet(i):!(i instanceof U)||e.field(i,!1)==t.field(i,!1))||(o?B(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function B(t,e,i){if(t.length!=e.length)return!1;for(let n=0;nt[e.id]),s=i.map(t=>t.type),r=n.filter(t=>!(1&t)),o=t[e.id]>>1;function a(t){let i=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(G).find(t=>t.field==this);return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,i)=>{let n=t.values[e],s=this.updateF(n,i);return this.compareF(n,s)?0:(t.values[e]=s,1)},reconfigure:(t,i)=>{let n,s=t.facet(G),r=i.facet(G);return(n=s.find(t=>t.field==this))&&n!=r.find(t=>t.field==this)?(t.values[e]=n.create(t),1):null!=i.config.address[this.id]?(t.values[e]=i.field(this),0):(t.values[e]=this.create(t),1)}}}init(t){return[this,G.of({field:this,create:t})]}get extension(){return this}}function F(t){return e=>new K(e,t)}const H={highest:F(0),high:F(1),default:F(2),low:F(3),lowest:F(4)};class K{constructor(t,e){this.inner=t,this.prec=e}}class J{of(t){return new tt(this,t)}reconfigure(t){return J.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class tt{constructor(t,e){this.compartment=t,this.inner=e}}class et{constructor(t,e,i,n,s,r){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=r,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,i){let n=[],s=Object.create(null),r=new Map;for(let i of function(t,e,i){let n=[[],[],[],[],[]],s=new Map;return function t(r,o){let a=s.get(r);if(null!=a){if(a<=o)return;let t=n[a].indexOf(r);t>-1&&n[a].splice(t,1),r instanceof tt&&i.delete(r.compartment)}if(s.set(r,o),Array.isArray(r))for(let e of r)t(e,o);else if(r instanceof tt){if(i.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(r.compartment)||r.inner;i.set(r.compartment,n),t(n,o)}else if(r instanceof K)t(r.inner,r.prec);else if(r instanceof U)n[o].push(r),r.provides&&t(r.provides,o);else if(r instanceof V)n[o].push(r),r.facet.extensions&&t(r.facet.extensions,2);else{let e=r.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,2),n.reduce((t,e)=>t.concat(e))}(t,e,r))i instanceof U?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.push(e=>t.slot(e));let h=null==i?void 0:i.config.facets;for(let t in s){let e=s[t],n=e[0].facet,r=h&&h[t]||[];if(e.every(t=>0==t.type))if(o[n.id]=a.length<<1|1,j(r,e))a.push(i.facet(n));else{let t=n.combine(e.map(t=>t.value));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push(e=>t.dynamicSlot(e)));o[n.id]=l.length<<1,l.push(t=>N(t,n,e))}}let c=l.map(t=>t(o));return new et(t,r,c,o,a,s)}}function it(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let s=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|s}function nt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const st=q.define(),rt=q.define({combine:t=>t.some(t=>t),static:!0}),ot=q.define({combine:t=>t.length?t[0]:void 0,static:!0}),at=q.define(),lt=q.define(),ht=q.define(),ct=q.define({combine:t=>!!t.length&&t[0]});class ut{constructor(t,e){this.type=t,this.value=e}static define(){return new ft}}class ft{of(t){return new ut(this,t)}}class dt{constructor(t){this.map=t}of(t){return new Ot(this,t)}}class Ot{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new Ot(this.type,e)}is(t){return this.type==t}static define(t={}){return new dt(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}Ot.reconfigure=Ot.define(),Ot.appendConfig=Ot.define();class pt{constructor(t,e,i,n,s,r){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,i&&W(i,e.newLength),s.some(t=>t.type==pt.time)||(this.annotations=s.concat(pt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new pt(t,e,i,n,s,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(pt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function gt(t,e){let i=[];for(let n=0,s=0;;){let r,o;if(n=t[n]))r=t[n++],o=t[n++];else{if(!(s=0;s--){let r=i[s](t);r&&Object.keys(r).length&&(n=mt(n,vt(e,r,t.changes.newLength),!0))}return n==t?t:pt.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let n of e.facet(at)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:gt(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=C.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=pt.create(e,n,t.selection&&t.selection.map(s),Ot.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(lt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof pt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof pt?s[0]:wt(e,yt(s),!1)}return t}(s):s)}pt.time=ut.define(),pt.userEvent=ut.define(),pt.addToHistory=ut.define(),pt.remote=ut.define();const bt=[];function yt(t){return null==t?bt:Array.isArray(t)?t:[t]}var xt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(xt||(xt={}));const St=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qt;try{Qt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class kt{constructor(t,e,i,n,s,r){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let t=0;ts.set(e,t)),i=null),s.set(e.value.compartment,e.value.extension)):e.is(Ot.reconfigure)?(i=null,n=e.value):e.is(Ot.appendConfig)&&(i=null,n=yt(n).concat(e.value));i?e=t.startState.values.slice():(i=et.resolve(n,s,this),e=new kt(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(t,e)=>e.reconfigure(t,this),null).values);let r=t.startState.facet(rt)?t.newSelection:t.newSelection.asSingle();new kt(i,t.newDoc,r,e,(e,i)=>i.update(e,t),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:E.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),s=[i.range],r=yt(i.effects);for(let i=1;is.spec.fromJSON(r,t)))}return kt.create({doc:t.doc,selection:E.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=et.resolve(t.extensions||[],new Map),i=t.doc instanceof O?t.doc:O.of((t.doc||"").split(e.staticFacet(kt.lineSeparator)||Z)),n=t.selection?t.selection instanceof E?t.selection:E.single(t.selection.anchor,t.selection.head):E.single(0);return W(n,i.length),e.staticFacet(rt)||(n=n.asSingle()),new kt(e,i,n,e.dynamicSlots.map(()=>null),(t,e)=>e.create(t),null)}get tabSize(){return this.facet(kt.tabSize)}get lineBreak(){return this.facet(kt.lineSeparator)||"\n"}get readOnly(){return this.facet(ct)}phrase(t,...e){for(let e of this.facet(kt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(t,i)=>{if("$"==i)return"$";let n=+(i||1);return!n||n>e.length?t:e[n-1]})),t}languageDataAt(t,e,i=-1){let n=[];for(let s of this.facet(st))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){let e=this.languageDataAt("wordChars",t);return i=e.length?e[0]:"",t=>{if(!/\S/.test(t))return xt.Space;if(function(t){if(Qt)return Qt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||St.test(i)))return!0}return!1}(t))return xt.Word;for(let e=0;e-1)return xt.Word;return xt.Other};var i}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),r=t-i,o=t-i;for(;r>0;){let t=Q(e,r,!1);if(s(e.slice(t,r))!=xt.Word)break;r=t}for(;ot.length?t[0]:4}),kt.lineSeparator=ot,kt.readOnly=ct,kt.phrases=q.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(i=>t[i]==e[i])}}),kt.languageData=st,kt.changeFilter=at,kt.transactionFilter=lt,kt.transactionExtender=ht,J.reconfigure=Ot.define();class Pt{eq(t){return this==t}range(t,e=t){return Tt.create(t,e,this)}}function Zt(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}Pt.prototype.startSide=Pt.prototype.endSide=0,Pt.prototype.point=!1,Pt.prototype.mapMode=T.TrackDel;class Tt{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new Tt(t,e,i)}}function At(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let s=i?this.to:this.from;for(let r=n,o=s.length;;){if(r==o)return r;let n=r+o>>1,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=0?o=n:r=n+1}}between(t,e,i,n){for(let s=this.findIndex(e,-1e9,!0),r=this.findIndex(i,1e9,!1,s);sh||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class Mt{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new Mt(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:s=this.length}=t,r=t.filter;if(0==e.length&&!r)return this;if(i&&(e=e.slice().sort(At)),this.isEmpty)return e.length?Mt.of(e):this;let o=new _t(this,null,-1).goto(0),a=0,l=[],h=new Rt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.push(t)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||so.to||s=s&&t<=s+r.length&&!1===r.between(s,t-s,e-s,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return zt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return zt.from(t).goto(e)}static compare(t,e,i,n,s=-1){let r=t.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s),o=e.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s),a=Xt(r,o,i),l=new Lt(r,a,s),h=new Lt(o,a,s);i.iterGaps((t,e,i)=>Et(l,t,h,e,i,n)),i.empty&&0==i.length&&Et(l,0,h,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let s=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0),r=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0);if(s.length!=r.length)return!1;if(!s.length)return!0;let o=Xt(s,r),a=new Lt(s,o,0).goto(i),l=new Lt(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Wt(a.active,l.active)||a.point&&(!l.point||!Zt(a.point,l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Lt(t,null,s).goto(e),o=e,a=r.openStart;for(;;){let t=Math.min(r.to,i);if(r.point){let i=r.activeForPoint(r.to),s=r.pointFromo&&(n.span(o,t,r.active,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Rt;for(let n of t instanceof Tt?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(At);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}static join(t){if(!t.length)return Mt.empty;let e=t[t.length-1];for(let i=t.length-2;i>=0;i--)for(let n=t[i];n!=Mt.empty;n=n.nextLayer)e=new Mt(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}}Mt.empty=new Mt([],[],null,-1),Mt.empty.nextLayer=Mt.empty;class Rt{finishChunk(t){this.chunks.push(new Ct(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Rt)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(Mt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Xt(t,e,i){let n=new Map;for(let e of t)for(let t=0;t=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&n.push(new _t(r,e,i,s));return 1==n.length?n[0]:new zt(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)Yt(this.heap,t);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)Yt(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Yt(this.heap,0)}}}function Yt(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let s=t[n];if(n+1=0&&(s=t[n+1],n++),i.compare(s)<0)break;t[n]=i,t[e]=s,e=n}}class Lt{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=zt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=jt(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:s}=this.cursor;for(;e0;)e++;qt(this.active,e,i),qt(this.activeTo,e,n),qt(this.activeRank,e,s),t&&qt(t,e,this.cursor.from),this.minActive=jt(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Dt(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&i[e]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function Et(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e,h=!!r.boundChange;for(let e=!1;;){let n=t.to+l-i.to,s=n||t.endSide-i.endSide,c=s<0?t.to+l:i.to,u=Math.min(c,o);if(t.point||i.point?(t.point&&i.point&&Zt(t.point,i.point)&&Wt(t.activeForPoint(t.to),i.activeForPoint(i.to))||r.comparePoint(a,u,t.point,i.point),e=!1):(e&&r.boundChange(a),u>a&&!Wt(t.active,i.active)&&r.compareRange(a,u,t.active,i.active),h&&uo)break;a=c,s<=0&&t.next(),s>=0&&i.next()}}function Wt(t,e){if(t.length!=e.length)return!1;for(let i=0;i=e;i--)t[i+1]=t[i];t[e]=i}function jt(t,e){let i=-1,n=1e9;for(let s=0;s=e)return n;if(n==t.length)break;s+=9==t.charCodeAt(n)?i-s%i:1,n=Q(t,n)}return!0===n?-1:t.length}},36898(t,e,i){i.d(e,{tF:()=>mt,uF:()=>Mi,_B:()=>A,l_:()=>Y,NZ:()=>C,OP:()=>at,Lz:()=>vn,wJ:()=>er,dT:()=>Jn,Ip:()=>Rn,Z9:()=>It,X3:()=>oe,xO:()=>T,rU:()=>Rr,vo:()=>Ds,HJ:()=>ys,VH:()=>Dn,A:()=>Hn,rC:()=>Hs,$G:()=>qn,ld:()=>Bs,Eg:()=>Ls,cU:()=>or,EV:()=>ir,QO:()=>nr,Hm:()=>lr,n6:()=>Es,dz:()=>us,Wu:()=>kr,N$:()=>rs,wu:()=>Mr,Yq:()=>Ar,Ux:()=>Ys,w4:()=>$n,qd:()=>En,pK:()=>pr,qy:()=>gr,$K:()=>yr,c_:()=>qt,C3:()=>Vs,qf:()=>ps,D4:()=>vs,Pq:()=>qs,TS:()=>Tn,BE:()=>cs,ui:()=>Fs,S7:()=>Us,DK:()=>Ms,vX:()=>Qs});for(var n=i(31638),s=i(97417),r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},a="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),l="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),h=0;h<10;h++)r[48+h]=r[96+h]=String(h);for(h=1;h<=24;h++)r[h+111]="F"+h;for(h=65;h<=90;h++)r[h]=String.fromCharCode(h+32),o[h]=String.fromCharCode(h);for(var c in r)o.hasOwnProperty(c)||(o[c]=r[c]);var u=i(93748);let f="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},d="undefined"!=typeof document?document:{documentElement:{style:{}}};const O=/Edge\/(\d+)/.exec(f.userAgent),p=/MSIE \d/.test(f.userAgent),g=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(f.userAgent),m=!!(p||g||O),v=!m&&/gecko\/(\d+)/i.test(f.userAgent),w=!m&&/Chrome\/(\d+)/.exec(f.userAgent),b="webkitFontSmoothing"in d.documentElement.style,y=!m&&/Apple Computer/.test(f.vendor),x=y&&(/Mobile\/\w+/.test(f.userAgent)||f.maxTouchPoints>2);var S={mac:x||/Mac/.test(f.platform),windows:/Win/.test(f.platform),linux:/Linux|X11/.test(f.platform),ie:m,ie_version:p?d.documentMode||6:g?+g[1]:O?+O[1]:0,gecko:v,gecko_version:v?+(/Firefox\/(\d+)/.exec(f.userAgent)||[0,0])[1]:0,chrome:!!w,chrome_version:w?+w[1]:0,ios:x,android:/Android\b/.test(f.userAgent),webkit:b,webkit_version:b?+(/\bAppleWebKit\/(\d+)/.exec(f.userAgent)||[0,0])[1]:0,safari:y,safari_version:y?+(/\bVersion\/(\d+(\.\d+)?)/.exec(f.userAgent)||[0,0])[1]:0,tabSize:null!=d.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function Q(t,e){for(let i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}const k=Object.create(null);function $(t,e,i){if(t==e)return!0;t||(t=k),e||(e=k);let n=Object.keys(t),s=Object.keys(e);if(n.length-(i&&n.indexOf(i)>-1?1:0)!=s.length-(i&&s.indexOf(i)>-1?1:0))return!1;for(let r of n)if(r!=i&&(-1==s.indexOf(r)||t[r]!==e[r]))return!1;return!0}function P(t,e,i){let n=!1;if(e)for(let s in e)i&&s in i||(n=!0,"style"==s?t.style.cssText="":t.removeAttribute(s));if(i)for(let s in i)e&&e[s]==i[s]||(n=!0,"style"==s?t.style.cssText=i[s]:t.setAttribute(s,i[s]));return n}function Z(t){let e=Object.create(null);for(let i=0;i0?3e8:-4e8:e>0?1e8:-1e8,new X(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:s,end:r}=_(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new X(t,e,i,n,t.widget||null,!0)}static line(t){return new R(t)}static set(t,e=!1){return n.om.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}C.none=n.om.empty;class M extends C{constructor(t){let{start:e,end:i}=_(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?Q(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||k}eq(t){return this==t||t instanceof M&&this.tagName==t.tagName&&$(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}M.prototype.point=!1;class R extends C{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof R&&this.spec.class==t.spec.class&&$(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}R.prototype.mapMode=n.iR.TrackBefore,R.prototype.point=!0;class X extends C{constructor(t,e,i,s,r,o){super(e,i,r,t),this.block=s,this.isReplace=o,this.mapMode=s?e<=0?n.iR.TrackBefore:n.iR.TrackAfter:n.iR.TrackDel}get type(){return this.startSide!=this.endSide?A.WidgetRange:this.startSide<=0?A.WidgetBefore:A.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof X&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function _(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function z(t,e,i,n=0){let s=i.length-1;s>=0&&i[s]+n>=t?i[s]=Math.max(i[s],e):i.push(t,e)}X.prototype.point=!0;class Y extends n.FB{constructor(t,e){super(),this.tagName=t,this.attributes=e}eq(t){return t==this||t instanceof Y&&this.tagName==t.tagName&&$(this.attributes,t.attributes)}static create(t){return new Y(t.tagName,t.attributes||k)}static set(t,e=!1){return n.om.of(t,e)}}function L(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function E(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function W(t,e){if(!e.anchorNode)return!1;try{return E(t,e.anchorNode)}catch(t){return!1}}function D(t){return 3==t.nodeType?et(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function q(t,e,i,n){return!!i&&(B(t,e,i,n,-1)||B(t,e,i,n,1))}function j(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function V(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function B(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:I(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=j(t)+(s<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(s<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=s<0?I(t):0}}}function I(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function N(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function G(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function U(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function F(t,e=!0){let i=t.ownerDocument,n=null,s=null;for(let r=t.parentNode;r&&r!=i.body&&(e&&!n||!s);)if(1==r.nodeType)!s&&r.scrollHeight>r.clientHeight&&(s=r),e&&!n&&r.scrollWidth>r.clientWidth&&(n=r),r=r.assignedSlot||r.parentNode;else{if(11!=r.nodeType)break;r=r.host}return{x:n,y:s}}Y.prototype.startSide=Y.prototype.endSide=-1;class H{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?I(e):0),i,Math.min(t.focusOffset,i?I(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let K,J=null;function tt(t){if(t.setActive)return t.setActive();if(J)return t.focus(J);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==J?{get preventScroll(){return J={preventScroll:!0},!0}}:void 0),!J){J=!1;for(let t=0;tMath.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function st(t,e){for(let i=t,n=e;;){if(3==i.nodeType&&n>0)return{node:i,offset:n};if(1==i.nodeType&&n>0){if("false"==i.contentEditable)return null;i=i.childNodes[n-1],n=I(i)}else{if(!i.parentNode||V(i))return null;n=j(i),i=i.parentNode}}}function rt(t,e){for(let i=t,n=e;;){if(3==i.nodeType&&n=26&&(J=!1);class ot{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new ot(t.parentNode,j(t),e)}static after(t,e){return new ot(t.parentNode,j(t)+1,e)}}var at=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(at||(at={}));const lt=at.LTR,ht=at.RTL;function ct(t){let e=[];for(let i=0;i=e){if(o.level==i)return r;(s<0||(0!=n?n<0?o.frome:t[s].level>o.level))&&(s=r)}}if(s<0)throw new RangeError("Index out of range");return s}}function vt(t,e){if(t.length!=e.length)return!1;for(let i=0;il&&o.push(new mt(l,O.from,f)),yt(t,O.direction==lt!=!(f%2)?n+1:n,s,O.inner,O.from,O.to,o),l=O.to),d=O.to}else{if(d==i||(e?wt[d]!=a:wt[d]==a))break;d++}u?bt(t,l,d,n+1,s,u,o):le;){let i=!0,c=!1;if(!h||l>r[h-1].to){let t=wt[l-1];t!=a&&(i=!1,c=16==t)}let u=i||1!=a?null:[],f=i?n:n+1,d=l;t:for(;;)if(h&&d==r[h-1].to){if(c)break t;let O=r[--h];if(!i)for(let t=O.from,i=h;;){if(t==e)break t;if(!i||r[i-1].to!=t){if(wt[t-1]==a)break t;break}t=r[--i].from}u?u.push(O):(O.to=0;t-=3)if(Ot[t+1]==-i){let e=Ot[t+2],i=2&e?s:4&e?1&e?r:s:0;i&&(wt[o]=wt[Ot[t]]=i),a=t;break}}else{if(189==Ot.length)break;Ot[a++]=o,Ot[a++]=e,Ot[a++]=l}else if(2==(n=wt[o])||1==n){let t=n==s;l=t?0:1;for(let e=a-3;e>=0;e-=3){let i=Ot[e+2];if(2&i)break;if(t)Ot[e+2]|=2;else{if(4&i)break;Ot[e+2]|=4}}}}}(t,s,r,n,a),function(t,e,i,n){for(let s=0,r=n;s<=i.length;s++){let o=s?i[s-1].to:t,a=sl;)e==r&&(e=i[--n].from,r=n?i[n-1].to:t),wt[--e]=c;l=o}else r=o,l++}}}(s,r,n,a),bt(t,s,r,e,i,n,o)}function xt(t,e,i){if(!t)return[new mt(0,0,e==ht?1:0)];if(e==lt&&!i.length&&!gt.test(t))return St(t.length);if(i.length)for(;t.length>wt.length;)wt[wt.length]=256;let n=[],s=e==lt?0:1;return yt(t,s,s,i,0,t.length,n),n}function St(t){return[new mt(0,t,0)]}let Qt="";function kt(t,e,i,s,r){var o;let a=s.head-t.from,l=mt.find(e,a,null!==(o=s.bidiLevel)&&void 0!==o?o:-1,s.assoc),h=e[l],c=h.side(r,i);if(a==c){let t=l+=r?1:-1;if(t<0||t>=e.length)return null;h=e[l=t],a=h.side(!r,i),c=h.side(r,i)}let u=(0,n.zK)(t.text,a,h.forward(r,i));(uh.to)&&(u=c),Qt=t.text.slice(Math.min(a,u),Math.max(a,u));let f=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return f&&u==c&&f.level+(r?0:1)t.some(t=>t)}),Yt=n.sj.define({combine:t=>t.some(t=>t)}),Lt=n.sj.define();class Et{constructor(t,e,i,n,s,r=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=s,this.isSnapshot=r}map(t){return t.empty?this:new Et(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Et(n.OF.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Wt=n.Pe.define({map:(t,e)=>t.map(e)}),Dt=n.Pe.define();function qt(t,e,i){let n=t.facet(At);n.length?n[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const jt=n.sj.define({combine:t=>!t.length||t[0]});let Vt=0;const Bt=n.sj.define({combine:t=>t.filter((e,i)=>{for(let n=0;n{let e=[];return r&&e.push(Ft.of(e=>{let i=e.plugin(t);return i?r(i):C.none})),s&&e.push(s(t)),e})}static fromClass(t,e){return It.define((e,i)=>new t(e,i),e)}}class Nt{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(qt(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){qt(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){qt(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Gt=n.sj.define(),Ut=n.sj.define(),Ft=n.sj.define(),Ht=n.sj.define(),Kt=n.sj.define(),Jt=n.sj.define(),te=n.sj.define();function ee(t,e){let i=t.state.facet(te);if(!i.length)return i;let s=i.map(e=>e instanceof Function?e(t):e),r=[];return n.om.spans(s,e.from,e.to,{point(){},span(t,i,n,s){let o=t-e.from,a=i-e.from,l=r;for(let t=n.length-1;t>=0;t--,s--){let i,r=n[t].spec.bidiIsolate;if(null==r&&(r=$t(e.text,o,a)),s>0&&l.length&&(i=l[l.length-1]).to==o&&i.direction==r)i.to=a,l=i.inner;else{let t={from:o,to:a,direction:r,inner:[]};l.push(t),l=t.inner}}}}),r}const ie=n.sj.define();function ne(t){let e=0,i=0,n=0,s=0;for(let r of t.state.facet(ie)){let o=r(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(i=Math.max(i,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(s=Math.max(s,o.bottom)))}return{left:e,right:i,top:n,bottom:s}}const se=n.sj.define();class re{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new re(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toAs.push(new re(t,e,i,n))),this.changedRanges=s}static create(t,e,i){return new oe(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}const ae=[];class le{constructor(t,e,i=0){this.dom=t,this.length=e,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return ae}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,4&this.flags){this.flags&=-5;let t=this.domAttrs;t&&function(t,e){for(let i=t.attributes.length-1;i>=0;i--){let n=t.attributes[i].name;null==e[n]&&t.removeAttribute(n)}for(let i in e){let n=e[i];"style"==i?t.style.cssText=n:t.getAttribute(i)!=n&&t.setAttribute(i,n)}}(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let i=e;for(let e of this.children){if(e==t)return i;i+=e.length+e.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e){return null}domPosFor(t,e){let i=j(this.dom),n=this.length?t>0:e>0;return new ot(this.parent.dom,i+(n?1:0),0==t||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof ue)return t;return null}static get(t){return t.cmTile}}class he extends le{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(2&this.flags)return;super.sync(t);let e,i=this.dom,n=null,s=(null==t?void 0:t.node)==i?t:null,r=0;for(let o of this.children){if(o.sync(t),r+=o.length+o.breakAfter,e=n?n.nextSibling:i.firstChild,s&&e!=o.dom&&(s.written=!0),o.dom.parentNode==i)for(;e&&e!=o.dom;)e=ce(e);else i.insertBefore(o.dom,e);n=o.dom}for(e=n?n.nextSibling:i.firstChild,s&&e&&(s.written=!0);e;)e=ce(e);this.length=r}}function ce(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ue extends he{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=le.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],i=this,n=0,s=0;;)if(n==i.children.length){if(!e.length)return;i=i.parent,i.breakAfter&&s++,n=e.pop()}else{let r=i.children[n++];if(r instanceof fe)e.push(n),i=r,n=0;else{let e=s+r.length,i=t(r,s);if(void 0!==i)return i;s=e+r.breakAfter}}}resolveBlock(t,e){let i,n,s=-1,r=-1;if(this.blockTiles((o,a)=>{let l=a+o.length;if(t>=a&&t<=l){if(o.isWidget()&&e>=-1&&e<=1){if(32&o.flags)return!0;16&o.flags&&(i=void 0)}(at||t==a&&(e>1?o.length:o.covers(-1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=t-a)}}),!i&&!n)throw new Error("No tile at position "+t);return i&&e<0||!n?{tile:i,offset:s}:{tile:n,offset:r}}}class fe extends he{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return!!this.children.length&&(t<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(t,e){let i=new fe(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}}class de extends he{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(t,e,i){let n=new de(e||document.createElement("div"),t);return e&&i||(n.flags|=4),n}get domAttrs(){return this.attrs}resolveInline(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(a,l){for(let h=0,c=0;h=l&&(u.isComposite()?t(u,l-c):(!r||r.isHidden&&(e>0||i&&Oe(r,u)))&&(f>l||32&u.flags)?(r=u,o=l-c):(ci&&(t=i);let n=t,s=t,r=0;0==t&&e<0||t==i&&e>=0?S.chrome||S.gecko||(t?(n--,r=1):s=0)?0:o.length-1];return S.safari&&!r&&0==a.width&&(a=Array.prototype.find.call(o,t=>t.width)||a),r?N(a,r<0):a||null}static of(t,e){let i=new ge(e||document.createTextNode(t),t);return e||(i.flags|=2),i}}class me extends le{constructor(t,e,i,n){super(t,e,n),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return!(48&this.flags)&&(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,i){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;if(i)return N(this.dom.getBoundingClientRect(),this.length?0==t:e<=0);{let e=this.dom.getClientRects(),i=null;if(!e.length)return null;let n=!!(16&this.flags)||!(32&this.flags)&&t>0;for(let s=n?e.length-1:0;i=e[s],!(t>0?0==s:s==e.length-1||i.top0;)if(n.isComposite())if(r){if(!t)break;i&&i.break(),t--,r=!1}else if(s==n.children.length){if(!t&&!o.length)break;i&&i.leave(n),r=!!n.breakAfter,({tile:n,index:s}=o.pop()),s++}else{let a=n.children[s],l=a.breakAfter;!(e>0?a.length<=t:a.length=0;t--){let i=e.marks[t],s=n.lastChild;if(s instanceof pe&&s.mark.eq(i.mark))s.dom!=i.dom&&s.setDOM(Ze(i.dom)),n=s;else{if(this.cache.reused.get(i)){let t=le.get(i.dom);t&&t.setDOM(Ze(i.dom))}let t=pe.of(i.mark,i.dom);n.append(t),n=t}this.cache.reused.set(i,2)}let s=le.get(t.text);s&&this.cache.reused.set(s,2);let r=new ge(t.text,t.text.nodeValue);r.flags|=8,n.append(r)}addInlineWidget(t,e,i){let n=this.afterWidget&&48&t.flags&&(48&this.afterWidget.flags)==(48&t.flags);n||this.flushBuffer();let s=this.ensureMarks(e,i);n||16&t.flags||s.append(this.getBuffer(1)),s.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,i){this.flushBuffer(),this.ensureMarks(e,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){(this.afterWidget||this.lastBlock).length+=t,this.pos+=t}addLineStart(t,e){var i;t||(t=Pe);let n=de.start(t,e||(null===(i=this.cache.find(de))||void 0===i?void 0:i.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var i;let n=this.curLine;for(let s=t.length-1;s>=0;s--){let r,o=t[s];if(e>0&&(r=n.lastChild)&&r instanceof pe&&r.mark.eq(o))n=r,e--;else{let t=pe.of(o,null===(i=this.cache.find(pe,t=>t.mark.eq(o)))||void 0===i?void 0:i.dom);n.append(t),n=t,e=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;t&&$e(this.curLine,!1)&&("BR"==t.dom.nodeName||!t.isWidget()||S.ios&&$e(this.curLine,!0))||this.curLine.append(this.cache.findWidget(Ae,0,32)||new me(Ae.toDOM(),0,Ae,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to=this.pos){let e=new be(t.from,t.to,t.value,t.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-e.rank||this.wrappers[i-1].to-e.to)<0;)i--;this.wrappers.splice(i,0,e)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let i of this.wrappers){let n=e.lastChild;if(i.fromt.wrapper.eq(i.wrapper)))||void 0===t?void 0:t.dom);e.append(n),e=n}}return e}blockPosCovered(){let t=this.lastBlock;return null!=t&&!t.breakAfter&&(!t.isWidget()||(160&t.flags)>0)}getBuffer(t){let e=2|(t<0?16:32),i=this.cache.find(ve,void 0,1);return i&&(i.flags=e),i||new ve(e)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class xe{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skipCount);if(this.skipCount=0,n)throw new Error("Ran out of text content when drawing inline views");this.text=e;let s=this.textOff=Math.min(t,e.length);return i?null:e.slice(0,s)}let e=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,e);return this.textOff=e,i}}const Se=[me,de,ge,pe,ve,fe,ue];for(let t=0;t[]),this.index=Se.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,i=this.buckets[e];i.length<6?i.push(t):i[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,i=2){let n=t.bucket,s=this.buckets[n],r=this.index[n];for(let t=s.length-1;t>=0;t--){let o=(t+r)%s.length,a=s[o];if((!e||e(a))&&!this.reused.has(a))return s.splice(o,1),o{if(this.cache.add(t),t.isComposite())return!1},enter:t=>this.cache.add(t),leave:()=>{},break:()=>{}}}run(t,e){let i=e&&this.getCompositionContext(e.text);for(let n=0,s=0,r=0;;){let o=rn){let t=a-n;this.preserve(t,!r,!o),n=a,s+=t}if(!o)break;e&&o.fromA<=e.range.fromA&&o.toA>=e.range.toA?(this.forward(o.fromA,e.range.fromA,e.range.fromA1;i--){let n=i==t.parents.length?t.tile:t.parents[i].tile;n instanceof pe&&e.push(n.mark)}return e}(this.old),s=this.openMarks;this.old.advance(t,i?1:-1,{skip:(t,e,i)=>{if(t.isWidget())if(this.openWidget)this.builder.continueWidget(i-e);else{let r=i>0||e{t.isLine()?this.builder.addLineStart(t.attrs,this.cache.maybeReuse(t)):(this.cache.add(t),t instanceof pe&&n.unshift(t.mark)),this.openWidget=!1},leave:t=>{t.isLine()?n.length&&(n.length=s=0):t instanceof pe&&(n.shift(),s=Math.min(s,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let i=null,s=this.builder,r=0,o=n.om.spans(this.decorations,t,e,{point:(t,e,n,o,a,l)=>{if(n instanceof X){if(this.disallowBlockEffectsFor[l]){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.view.state.doc.lineAt(t).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=o.length,a>o.length)s.continueWidget(e-t);else{let r=n.widget||(n.block?Te.block:Te.inline),l=function(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}(n),h=this.cache.findWidget(r,e-t,l)||me.of(r,this.view,e-t,l);n.block?(n.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(h)):(s.ensureLine(i),s.addInlineWidget(h,o,a))}i=null}else i=function(t,e){let i=e.spec.attributes,n=e.spec.class;return i||n?(t||(t={class:"cm-line"}),i&&Q(i,t),n&&(t.class+=" "+n),t):t}(i,n);e>t&&this.text.skip(e-t)},span:(t,e,n,r)=>{for(let o=t;or,this.openMarks=o}forward(t,e,i=1){e-t<=10?this.old.advance(e-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let e=[],i=null;for(let n=t.parentNode;;n=n.parentNode){let t=le.get(n);if(n==this.view.contentDOM)break;t instanceof pe?e.push(t):(null==t?void 0:t.isLine())?i=t:t instanceof fe||("DIV"!=n.nodeName||i||n==this.view.contentDOM?i||e.push(pe.of(new M({tagName:n.nodeName.toLowerCase(),attributes:Z(n)}),n)):i=new de(n,Pe))}return{line:i,marks:e}}}function $e(t,e){let i=t=>{for(let n of t.children)if((e?n.isText():n.length)||i(n))return!0;return!1};return i(t)}const Pe={class:"cm-line"};function Ze(t){let e=le.get(t);return e&&e.setDOM(t.cloneNode()),t}class Te extends T{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Te.inline=new Te("span"),Te.block=new Te("div");const Ae=new class extends T{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Ce{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=C.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new ue(t,t.contentDOM),this.updateInner([new re(0,0,0,t.state.doc.length)],null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:t,toA:e})=>ethis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?s=this.domChanged.newSel.head:function(t,e){let i=!1;return e&&t.iterChangedRanges((t,n)=>{te.from&&(i=!0)}),i}(t.changes,this.hasComposition)||t.selectionSet||(s=t.state.selection.main.head));let r=s>-1?function(t,e,i){let n=Re(t,i);if(!n)return null;let{node:s,from:r,to:o}=n,a=s.nodeValue;if(/[\n\r]/.test(a))return null;if(t.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc;return{range:new re(l.mapPos(r),l.mapPos(o),r,o),text:s}}(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:e,to:n}=this.hasComposition;i=new re(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(S.ie||S.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=function(t,e,i){let s=new Xe;return n.om.compare(t,e,i,s),s.changes}(o,this.decorations,t.changes);l.length&&(i=re.extendWithRanges(i,l));let h=function(t,e,i){let s=new _e;return n.om.compare(t,e,i,s),s.changes}(a,this.blockWrappers,t.changes);return h.length&&(i=re.extendWithRanges(i,h)),r&&!i.some(t=>t.fromA<=r.range.fromA&&t.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),!(2&this.tile.flags&&0==i.length||(this.updateInner(i,r),t.transactions.length&&(this.lastUpdate=Date.now()),0))}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(e||t.length){let i=this.tile,n=new ke(this.view,i,this.blockWrappers,this.decorations,this.dynamicDecorationMap);e&&le.get(e.text)&&n.cache.reused.set(le.get(e.text),2),this.tile=n.run(t,e),Me(i,n.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=S.chrome||S.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(n),!n||!n.written&&i.selectionRange.focusNode==n.node&&this.tile.dom.contains(n.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to-1)&&W(i,this.view.observer.selectionRange)&&!(n&&i.contains(n));if(!(s||e||r))return;let o=this.forceSelection;this.forceSelection=!1;let a,l,h=this.view.state.selection.main;if(h.empty?l=a=this.inlineDOMNearPos(h.anchor,h.assoc||1):(l=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),a=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),S.gecko&&h.empty&&!this.hasComposition&&1==(c=a).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null)),a=l=new ot(t,0),o=!0}var c;let u=this.view.observer.selectionRange;!o&&u.focusNode&&(q(a.node,a.offset,u.anchorNode,u.anchorOffset)&&q(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,h))||(this.view.observer.ignore(()=>{S.android&&S.chrome&&i.contains(u.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(u.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let t=L(this.view.root);if(t)if(h.empty){if(S.gecko){let t=(e=a.node,s=a.offset,1!=e.nodeType?0:(s&&"false"==e.childNodes[s-1].contentEditable?1:0)|(sh.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}var e,s;r&&this.view.root.activeElement==i&&(i.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ot(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new ot(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&q(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=L(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=this.lineAt(e.head,e.assoc);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.top)return;let h=this.domAtPos(e.head+e.assoc,e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,s)}posFromDOM(t,e){let i=this.tile.nearest(t);if(!i)return 2&this.tile.dom.compareDocumentPosition(t)?0:this.view.state.doc.length;let n=i.posAtStart;if(!i.isComposite())return i.isText()?t==i.dom?n+e:n+(e?i.length:0):n;{let s;if(t==i.dom)s=i.dom.childNodes[e];else{let n=0==I(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==i.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}s=n<0?t:t.nextSibling}if(s==i.dom.firstChild)return n;for(;s&&!le.get(s);)s=s.nextSibling;if(!s)return n+i.length;for(let t=0,e=n;;t++){let n=i.children[t];if(n.dom==s)return e;e+=n.length+n.breakAfter}}}domAtPos(t,e){let{tile:i,offset:n}=this.tile.resolveBlock(t,e);return i.isWidget()?i.domPosFor(t,e):i.domIn(n,e)}inlineDOMNearPos(t,e){let i,n,s=-1,r=!1,o=-1,a=!1;return this.tile.blockTiles((e,l)=>{if(e.isWidget()){if(32&e.flags&&l>=t)return!0;16&e.flags&&(r=!0)}else{let h=l+e.length;if(l<=t&&(i=e,s=t-l,r=h=t&&!n&&(n=e,o=t-l,a=l>t),l>t&&n)return!0}}),i||n?(r&&n?i=null:a&&i&&(n=null),i&&e<0||!n?i.domIn(s,e):n.domIn(o,e)):this.domAtPos(t,e)}coordsAt(t,e){let{tile:i,offset:n}=this.tile.resolveBlock(t,e);return i.isWidget()?i.widget instanceof ze?null:i.coordsInWidget(n,e,!0):i.coordsIn(n,e)}lineAt(t,e){let{tile:i}=this.tile.resolveBlock(t,e);return i.isLine()?i:null}coordsForChar(t){let{tile:e,offset:i}=this.tile.resolveBlock(t,1);return e.isLine()?function t(e,i){if(e.isComposite())for(let n of e.children){if(n.length>=i){let e=t(n,i);if(e)return e}if((i-=n.length)<0)break}else if(e.isText()&&iMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==at.LTR,l=0,h=(t,c,u)=>{for(let f=0;fn);f++){let n=t.children[f],d=c+n.length,O=n.dom.getBoundingClientRect(),{height:p}=O;if(u&&!f&&(l+=O.top-u.top),n instanceof fe)d>i&&h(n,c,O);else if(c>=i&&(l>0&&e.push(-l),e.push(p+l),l=0,r)){let t=n.dom.lastChild,e=t?D(t):[];if(e.length){let t=e[e.length-1],i=a?t.right-O.left:O.right-t.left;i>o&&(o=i,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=d)}}u&&f==t.children.length-1&&(l+=u.bottom-O.bottom),c=d+n.breakAfter}};return h(this.tile,0,null),e}textDirectionAt(t){let{tile:e}=this.tile.resolveBlock(t,1);return"rtl"==getComputedStyle(e.dom).direction?at.RTL:at.LTR}measureTextSize(){let t=this.tile.blockTiles(t=>{if(t.isLine()&&t.children.length&&t.length<=20){let e,i=0;for(let n of t.children){if(!n.isText()||/[^ -~]/.test(n.text))return;let t=D(n.dom);if(1!=t.length)return;i+=t[0].width,e=t[0].height}if(i)return{lineHeight:t.dom.getBoundingClientRect().height,charWidth:i/t.length,textHeight:e}}});if(t)return t;let e,i,n,s=document.createElement("div");return s.className="cm-line",s.style.width="99999px",s.style.position="absolute",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(s);let t=D(s.firstChild)[0];e=s.getBoundingClientRect().height,i=t&&t.width?t.width/27:7,n=t&&t.height?t.height:e,s.remove()}),{lineHeight:e,charWidth:i,textHeight:n}}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],r=s?s.from-1:this.view.state.doc.length;if(r>i){let n=(e.lineBlockAt(r).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(C.replace({widget:new ze(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return C.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Ft).map(e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e),i=!1,s=this.view.state.facet(Kt).map((t,e)=>{let n="function"==typeof t;return n&&(i=!0),n?t(this.view):t});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(n.om.join(s))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t"function"==typeof t?t(this.view):t)}scrollIntoView(t){var e;if(t.isSnapshot){let e=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=e.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin)}for(let e of this.view.state.facet(Lt))try{if(e(this.view,t.range,t))return!0}catch(t){qt(this.view.state,t,"scroll handler")}let i,{range:n}=t,s=this.coordsAt(n.head,null!==(e=n.assoc)&&void 0!==e?e:n.empty?0:n.head>n.anchor?-1:1);if(!s)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(s={left:Math.min(s.left,i.left),top:Math.min(s.top,i.top),right:Math.max(s.right,i.right),bottom:Math.max(s.bottom,i.bottom)});let r=ne(this.view),o={left:s.left-r.left,top:s.top-r.top,right:s.right+r.right,bottom:s.bottom+r.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,f=c==l.body,d=1,O=1;if(f)t=G(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:d,scaleY:O}=U(c,e)),t={left:e.left,right:e.left+c.clientWidth*d,top:e.top,bottom:e.top+c.clientHeight*O}}let p=0,g=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+g&&(g=e.bottom-t.bottom+o)):e.bottom>t.bottom-o&&(g=e.bottom-t.bottom+o,i<0&&e.top-g0&&e.right>t.right+p&&(p=e.right-t.right+r)):e.right>t.right-r&&(p=e.right-t.right+r,i<0&&e.leftt.bottom||e.leftt.right)&&(e={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)}),c=c.assignedSlot||c.parentNode}else{if(11!=c.nodeType)break;c=c.host}}(this.view.scrollDOM,o,n.head1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottomt.isWidget()||t.children.some(e);return e(this.tile.resolveBlock(t,1).tile)}destroy(){Me(this.tile)}}function Me(t,e){let i=null==e?void 0:e.get(t);if(1!=i){null==i&&t.destroy();for(let i of t.children)Me(i,e)}}function Re(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let n=st(i.focusNode,i.focusOffset),s=rt(i.focusNode,i.focusOffset),r=n||s;if(s&&n&&s.node!=n.node){let e=le.get(s.node);if(!e||e.isText()&&e.text!=s.node.nodeValue)r=s;else if(t.docView.lastCompositionAfterCursor){let t=le.get(n.node);!t||t.isText()&&t.text!=n.node.nodeValue||(r=s)}}if(t.docView.lastCompositionAfterCursor=r!=n,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}let Xe=class{constructor(){this.changes=[]}compareRange(t,e){z(t,e,this.changes)}comparePoint(t,e){z(t,e,this.changes)}boundChange(t){z(t,t,this.changes)}};class _e{constructor(){this.changes=[]}compareRange(t,e){z(t,e,this.changes)}comparePoint(){}boundChange(t){z(t,t,this.changes)}}class ze extends T{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Ye(t,e,i){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let t;for(let s of n.type){if(s.from>e)break;if(!(s.toe)return s;t&&(s.type!=A.Text||t.type==s.type&&!(i<0?s.frome))||(t=s)}}return t||n}return n}function Le(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=kt(s,r,o,a,i),h=Qt;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=t.visualLineSide(s,!i)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function Ee(t,e,i){for(;;){let n=0;for(let s of t)s.between(e-1,e+1,(t,s,r)=>{if(e>t&&ee(t)),i.from,e.head>i.from?-1:1);return s==i.from?i:n.OF.cursor(s,st.viewState.docHeight)return new qe(t.state.doc.length,-1);if(r=t.elementAtHeight(c),null==s)break;if(r.type==A.Text){if(s<0?r.tot.viewport.to)break;let e=t.docView.coordsAt(s<0?r.from:r.to,s>0?-1:1);if(e&&(s<0?e.top<=c+a:e.bottom>=c+a))break}let e=t.viewState.heightOracle.textHeight/2;c=s>0?r.bottom+e:r.top-e}if(t.viewport.from>=r.to||t.viewport.to<=r.from){if(i)return null;if(r.type==A.Text){let e=function(t,e,i,s,r){let o=Math.round((s-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;o+=Math.floor((r-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(i.from,i.to);return i.from+(0,n.kn)(a,o,t.state.tabSize)}(t,o,r,l,h);return new qe(e,e==r.from?1:-1)}}if(r.type!=A.Text)return c<(r.top+r.bottom)/2?new qe(r.from,1):new qe(r.to,-1);let u=t.docView.lineAt(r.from,2);return u&&u.length==r.length||(u=t.docView.lineAt(r.from,-2)),new Ve(t,l,h,t.textDirectionAt(r.from)).scanTile(u,r.from)}class Ve{constructor(t,e,i,n){this.view=t,this.x=e,this.y=i,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from>1;e:if(a.has(f)){let t=r+Math.floor(Math.random()*u);for(let e=0;e1)){if(a.bottomthis.y)(!n||n.top>a.top)&&(n=a),u=-1;else{let t=a.left>this.x?this.x-a.left:a.rights.top)return this.y=i.bottom-1,this.scan(t,e);if(n&&n.top(s.left+s.right)/2==u}}scanText(t,e){let i=[];for(let s=0;s{let s=i[n]-e,r=i[n+1]-e;return et(t.dom,s,r).getClientRects()});return s.after?new qe(i[s.i+1],-1):new qe(i[s.i],1)}scanTile(t,e){if(!t.length)return new qe(e,1);if(1==t.children.length){let i=t.children[0];if(i.isText())return this.scanText(i,e);if(i.isComposite())return this.scanTile(i,e)}let i=[e];for(let n=0,s=e;n{let i=t.children[e];return 48&i.flags?null:(1==i.dom.nodeType?i.dom:et(i.dom,0,i.length)).getClientRects()}),s=t.children[n.i],r=i[n.i];return s.isText()?this.scanText(s,r):s.isComposite()?this.scanTile(s,r):n.after?new qe(i[n.i+1],-1):new qe(r,1)}}const Be="￿";class Ie{constructor(t,e){this.points=t,this.view=e,this.text="",this.lineSeparator=e.state.facet(n.$t.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Be}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let s=le.get(n),r=n.nextSibling;if(r==e){(null==s?void 0:s.breakAfter)&&!r&&i!=this.view.contentDOM&&this.lineBreak();break}let o=le.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:V(n))||V(r)&&("BR"!=n.nodeName||(null==s?void 0:s.isWidget()))&&this.text.length>t)&&!Ge(r,e)&&this.lineBreak(),n=r}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s,r=-1,o=1;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(s=n.exec(e))&&(r=s.index,o=s[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);i=r+o}}readNode(t){let e=le.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(Ne(t,i.node,i.offset)?e:0))}}function Ne(t,e,i){for(;;){if(!e||i-1;let{impreciseHead:r,impreciseAnchor:o}=t.docView,a=t.state.selection;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=He(t.docView.tile,e,i,0))){let e=r||o?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:r}=t.observer.selectionRange;return i&&(e.push(new Ue(i,n)),s==i&&r==n||e.push(new Ue(s,r))),e}(t),i=new Ie(e,t);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?n.OF.single(i+e,s+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=r&&r.node==e.focusNode&&r.offset==e.focusOffset||!E(t.contentDOM,e.focusNode)?a.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),s=o&&o.node==e.anchorNode&&o.offset==e.anchorOffset||!E(t.contentDOM,e.anchorNode)?a.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),l=t.viewport;if((S.ios||S.chrome)&&a.main.empty&&i!=s&&(l.from>0||l.to-1&&a.ranges.length>1)this.newSel=a.replaceRange(n.OF.range(s,i));else if(t.lineWrapping&&s==i&&(!a.main.empty||a.main.head!=i)&&t.inputState.lastTouchTime>Date.now()-100){let e=t.coordsAtPos(i,-1),s=0;e&&(s=t.inputState.lastTouchY<=e.bottom?-1:1),this.newSel=n.OF.create([n.OF.cursor(i,s)])}else this.newSel=n.OF.single(s,i)}}}function He(t,e,i,n){if(t.isComposite()){let s=-1,r=-1,o=-1,a=-1;for(let l=0,h=n,c=n;li)return He(n,e,i,h);if(u>=e&&-1==s&&(s=l,r=h),h>i&&n.dom.parentNode==t.dom){o=l,a=c;break}c=u,h=u+n.breakAfter}return{from:r,to:a<0?n+t.length:a,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o=0?t.children[o].dom:null}}return t.isText()?{from:n,to:n+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function Ke(t,e){let i,{newSel:s}=e,{state:r}=t,o=r.selection.main,a=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:t,to:s}=e.bounds,l=o.from,h=null;(8===a||S.android&&e.text.length=t&&o.to<=s&&(e.typeOver||f!=e.text)&&f.slice(0,o.from-t)==e.text.slice(0,o.from-t)&&f.slice(o.to-t)==e.text.slice(c=e.text.length-(f.length-(o.to-t)))?i={from:o.from,to:o.to,insert:n.EY.of(e.text.slice(o.from-t,c).split(Be))}:(u=ti(f,e.text,l-t,h))&&(S.chrome&&13==a&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Be+Be&&u.toB--,i={from:t+u.from,to:t+u.toA,insert:n.EY.of(e.text.slice(u.from,u.toB).split(Be))})}else s&&(!t.hasFocus&&r.facet(jt)||ei(s,o))&&(s=null);if(!i&&!s)return!1;if((S.mac||S.android)&&i&&i.from==i.to&&i.from==o.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(s&&2==i.insert.length&&(s=n.OF.single(s.main.anchor-1,s.main.head-1)),i={from:i.from,to:i.to,insert:n.EY.of([i.insert.toString().replace("."," ")])}):r.doc.lineAt(o.from).toDate.now()-50?i={from:o.from,to:o.to,insert:r.toText(t.inputState.insertingText)}:S.chrome&&i&&i.from==i.to&&i.from==o.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(s&&(s=n.OF.single(s.main.anchor-1,s.main.head-1)),i={from:o.from,to:o.to,insert:n.EY.of([" "])}),i)return Je(t,i,s,a);if(s&&!ei(s,o)){let e=!1,i="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),i=t.inputState.lastSelectionOrigin,"select.pointer"==i&&(s=We(r.facet(Jt).map(e=>e(t)),s))),t.dispatch({selection:s,scrollIntoView:e,userEvent:i}),!0}return!1}function Je(t,e,i,s=-1){if(S.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(S.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&" "==t.state.sliceDoc(e.from,r.from))&&1==e.insert.length&&2==e.insert.lines&&it(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&0==e.insert.length||8==s&&e.insert.lengthr.head)&&it(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&0==e.insert.length&&it(t.contentDOM,"Delete",46)))return!0;let o,a=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l=()=>o||(o=function(t,e,i){let s,r=t.state,o=r.selection.main,a=-1;if(e.from==e.to&&e.fromo.to){let i=e.frome(t)),n,i);e.from==s&&(a=s)}if(a>-1)s={changes:e,selection:n.OF.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=o.frome.to?r.sliceDoc(e.to,o.to):"";s=r.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+n))}else{let a=r.changes(e),l=i&&i.main.to<=a.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let h,c=t.state.sliceDoc(e.from,e.to),u=i&&Re(t,i.main.head);if(u){let t=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-t}}else h=t.state.doc.lineAt(o.head);let f=o.to-e.to;s=r.changeByRange(i=>{if(i.from==o.from&&i.to==o.to)return{changes:a,range:l||i.map(a)};let s=i.to-f,u=s-c.length;if(t.state.sliceDoc(u,s)!=c||s>=h.from&&u<=h.to)return{range:i};let d=r.changes({from:u,to:s,insert:e.insert}),O=i.to-o.to;return{changes:d,range:l?n.OF.range(Math.max(0,l.anchor+O),Math.max(0,l.head+O)):i.map(d)}})}else s={changes:a,selection:l&&r.selection.replaceRange(l)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),r.update(s,{userEvent:l,scrollIntoView:!0})}(t,e,i));return t.state.facet(Mt).some(i=>i(t,e.from,e.to,a,l))||t.dispatch(l()),!0}function ti(t,e,i,n){let s=Math.min(t.length,e.length),r=0;for(;r0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;return"end"==n&&(i-=o+Math.max(0,r-Math.min(o,a))-r),o=o?r-i:0,a=r+(a-o),o=r):a=a?r-i:0,o=r+(o-a),a=r),{from:r,toA:o,toB:a}}function ei(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class ii{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,S.safari&&t.contentDOM.addEventListener("input",()=>null),S.gecko&&function(t){$i.has(t)||($i.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=le.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t)))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=si(t),i=this.handlers,n=this.view.contentDOM;for(let t in e)if("scroll"!=t){let s=!e[t].handlers.length,r=i[t];r&&s!=!r.handlers.length&&(n.removeEventListener(t,this.handleEvent),r=null),r||n.addEventListener(t,this.handleEvent,{passive:s})}for(let t in i)"scroll"==t||e[t]||n.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&ai.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),S.android&&S.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!S.ios||t.synthetic||t.altKey||t.metaKey||t.shiftKey||!((e=ri.find(e=>e.keyCode==t.keyCode))&&!t.ctrlKey||oi.indexOf(t.key)>-1&&t.ctrlKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from0||!!(S.safari&&!S.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ni(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(t){qt(i.state,t)}}}function si(t){let e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec,n=t&&t.plugin.domEventHandlers,s=t&&t.plugin.domEventObservers;if(n)for(let t in n){let s=n[t];s&&i(t).handlers.push(ni(e.value,s))}if(s)for(let t in s){let n=s[t];n&&i(t).observers.push(ni(e.value,n))}}for(let t in ci)i(t).handlers.push(ci[t]);for(let t in ui)i(t).observers.push(ui[t]);return e}const ri=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],oi="dthko",ai=[16,17,18,20,91,92,224,225];function li(t){return.7*Math.max(0,t)+8}class hi{constructor(t,e,i,s){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=F(t.contentDOM),this.atoms=t.state.facet(Jt).map(e=>e(t));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(n.$t.allowMultipleSelections)&&function(t,e){let i=t.state.facet(Pt);return i.length?i[0](e):S.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=L(t.root);if(!n||0==n.rangeCount)return!0;let s=n.getRangeAt(0).getClientRects();for(let t=0;t=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(t,e)||1!=bi(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(e=this.startEvent,i=t,Math.max(Math.abs(e.clientX-i.clientX),Math.abs(e.clientY-i.clientY))<10))return;var e,i;this.select(this.lastEvent=t);let n=0,s=0,r=0,o=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:l}=this.scrollParents.y.getBoundingClientRect());let h=ne(this.view);t.clientX-h.left<=r+6?n=-li(r-t.clientX):t.clientX+h.right>=a-6&&(n=li(t.clientX-a)),t.clientY-h.top<=o+6?s=-li(o-t.clientY):t.clientY+h.bottom>=l-6&&(s=li(t.clientY-l)),this.setScrollSpeed(n,s)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),!1===this.dragging&&this.select(this.lastEvent)}select(t){let{view:e}=this,i=We(this.atoms,this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}const ci=Object.create(null),ui=Object.create(null),fi=S.ie&&S.ie_version<15||S.ios&&S.webkit_version<604;function di(t,e,i){for(let n of t.facet(e))i=n(i,t);return i}function Oi(t,e){e=di(t.state,Xt,e);let i,{state:s}=t,r=1,o=s.toText(e),a=o.lines==s.selection.ranges.length;if(null!=xi&&s.selection.ranges.every(t=>t.empty)&&xi==o.toString()){let t=-1;i=s.changeByRange(i=>{let l=s.doc.lineAt(i.from);if(l.from==t)return{range:i};t=l.from;let h=s.toText((a?o.line(r++).text:e)+s.lineBreak);return{changes:{from:l.from,insert:h},range:n.OF.cursor(i.from+h.length)}})}else i=a?s.changeByRange(t=>{let e=o.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:n.OF.cursor(t.from+e.length)}}):s.replaceSelection(o);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function pi(t,e,i,s){if(1==s)return n.OF.cursor(e,i);if(2==s)return function(t,e,i=1){let s=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(0==r.length)return n.OF.cursor(e);0==o?i=1:o==r.length&&(i=-1);let a=o,l=o;i<0?a=(0,n.zK)(r.text,o,!1):l=(0,n.zK)(r.text,o);let h=s(r.text.slice(a,l));for(;a>0;){let t=(0,n.zK)(r.text,a,!1);if(s(r.text.slice(t,a))!=h)break;a=t}for(;l{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},ui.wheel=ui.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()},ci.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),ui.touchstart=(t,e)=>{let i=t.inputState,n=e.targetTouches[0];i.lastTouchTime=Date.now(),n&&(i.lastTouchX=n.clientX,i.lastTouchY=n.clientY),i.setSelectionOrigin("select.pointer")},ui.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},ci.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(Tt))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),s=bi(e),r=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes))},get(e,o,a){let l,h=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),c=pi(t,h.pos,h.assoc,s);if(i.pos!=h.pos&&!o){let e=pi(t,i.pos,i.assoc,s),r=Math.min(e.from,c.from),o=Math.max(e.to,c.to);c=r1&&(l=function(t,e){for(let i=0;i=e)return n.OF.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(r,h.pos))?l:a?r.addRange(c):n.OF.create([c])}}}(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new hi(t,e,i,n)),n&&t.observer.ignore(()=>{tt(t.contentDOM);let e=t.root.activeElement;e&&!e.contains(t.contentDOM)&&e.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),!1===s.dragging}else t.inputState.setSelectionOrigin("select.pointer");return!1};const gi=S.ie&&S.ie_version<=11;let mi=null,vi=0,wi=0;function bi(t){if(!gi)return t.detail;let e=mi,i=wi;return mi=t,wi=Date.now(),vi=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(vi+1)%3:1}function yi(t,e,i,n){if(!(i=di(t.state,Xt,i)))return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=t.inputState,o=n&&r&&function(t,e){let i=t.state.facet(Zt);return i.length?i[0](e):S.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:r.from,to:r.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}ci.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let s=t.docView.tile.nearest(e.target);if(s&&s.isWidget()){let t=s.posAtStart,e=t+s.length;(t>=i.to||e<=i.from)&&(i=n.OF.range(t,e))}}let{inputState:s}=t;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",di(t.state,_t,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1},ci.dragend=t=>(t.inputState.draggedContent=null,!1),ci.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),s=0,r=()=>{++s==i.length&&yi(t,e,n.filter(t=>null!=t).join(t.state.lineBreak),!1)};for(let t=0;t{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),r()},e.readAsText(i[t])}return!0}{let i=e.dataTransfer.getData("Text");if(i)return yi(t,e,i,!0),!0}return!1},ci.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=fi?null:e.clipboardData;return i?(Oi(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),Oi(t,i.value)},50)}(t),!1)};let xi=null;ci.copy=ci.cut=(t,e)=>{if(!W(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:n,linewise:s}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let r=t.doc.lineAt(n);r.number>s&&(e.push(r.text),i.push({from:r.from,to:Math.min(t.doc.length,r.to+1)})),s=r.number}n=!0}return{text:di(t,_t,e.join(t.lineBreak)),ranges:i,linewise:n}}(t.state);if(!i&&!s)return!1;xi=s?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=fi?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",i),!0):(function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}(t,i),!1)};const Si=n.YH.define();function Qi(t,e){let i=[];for(let n of t.facet(Rt)){let s=n(t,e);s&&i.push(s)}return i.length?t.update({effects:i,annotations:Si.of(!0)}):null}function ki(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=Qi(t.state,e);i?t.dispatch(i):t.update([])}},10)}ui.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),ki(t)},ui.blur=t=>{t.observer.clearSelectionRange(),ki(t)},ui.compositionstart=ui.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},ui.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,S.chrome&&S.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},ui.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},ci.beforeinput=(t,e)=>{var i,n;if("insertText"!=e.inputType&&"insertCompositionText"!=e.inputType||(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),"insertReplacementText"==e.inputType&&t.observer.editContext){let n=null===(i=e.dataTransfer)||void 0===i?void 0:i.getData("text/plain"),s=e.getTargetRanges();if(n&&s.length){let e=s[0],i=t.posAtDOM(e.startContainer,e.startOffset),r=t.posAtDOM(e.endContainer,e.endOffset);return Je(t,{from:i,to:r,insert:t.state.toText(n)},null),!0}}let s;if(S.chrome&&S.android&&(s=ri.find(t=>t.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){let e=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout(()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return S.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),S.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(()=>ui.compositionend(t,e),20),!1};const $i=new Set,Pi=["pre-wrap","normal","pre-line","break-spaces"];let Zi=!1;function Ti(){Zi=!1}class Ai{constructor(t){this.lineWrapping=t,this.doc=n.EY.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Pi.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=o||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=s,a){this.heightSamples={};for(let t=0;t0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Xi&&(Zi=!0),this.height=t)}replace(t,e,i){return _i.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let s=this,r=i.doc;for(let o=n.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Ri.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=l?u:s.lineAt(l,Ri.ByPosNoHeight,i,0,0);for(c+=f.to-l,l=f.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*s){let s=t[e-1];s.break?t.splice(--e,1,s.left,null,s.right):t.splice(--e,1,s.left,s.right),i+=1+s.break,n-=s.size}else{if(!(s>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,s-=e.size}}else if(n=s&&r(this.lineAt(0,Ri.ByPos,i,n,s))}setMeasuredHeight(t){let e=t.heights[t.index++];e<0?(this.spaceAbove=-e,e=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(e)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setMeasuredHeight(n),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ei extends Li{constructor(t,e,i){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(t,e){return new Mi(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Ei||n instanceof Wi&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Wi?n=new Ei(n.length,this.height,this.spaceAbove):n.height=this.height,this.outdated||(n.outdated=!1),n):_i.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setMeasuredHeight(n):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Wi extends _i{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,r=s-n+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*r);i=e/r,this.length>r+1&&(o=(this.height-e)/(this.length-r-1))}else i=this.height/r;return{firstLine:n,lastLine:s,perLine:i,perChar:o}}blockAt(t,e,i,n){let{firstLine:s,lastLine:r,perLine:o,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let s=n+(t0){let t=i[i.length-1];t instanceof Wi?i[i.length-1]=new Wi(t.length+n):i.push(null,new Wi(n-1))}if(t>0){let e=i[0];e instanceof Wi?i[0]=new Wi(t+e.length):i.unshift(new Wi(t-1),null)}return _i.of(i)}decomposeLeft(t,e){e.push(new Wi(t-1),null)}decomposeRight(t,e){e.push(null,new Wi(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],r=Math.max(e,n.from),o=-1;for(n.from>e&&i.push(new Wi(n.from-e-1).updateHeight(t,e));r<=s&&n.more;){let e=t.doc.lineAt(r).length;i.length&&i.push(null);let s=n.heights[n.index++],a=0;s<0&&(a=-s,s=n.heights[n.index++]),-1==o?o=s:Math.abs(s-o)>=Xi&&(o=-2);let l=new Ei(e,s,a);l.outdated=!1,i.push(l),r+=e+1}r<=s&&i.push(null,new Wi(s-r).updateHeight(t,r));let a=_i.of(i);return(o<0||Math.abs(a.height-this.height)>=Xi||Math.abs(o-this.heightMetrics(t,e).perLine)>=Xi)&&(Zi=!0),zi(this,a)}return(i||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Di extends _i{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let s=i+this.left.height;return to))return l;let h=e==Ri.ByPosNoHeight?Ri.ByPosNoHeight:Ri.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Ri.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,r)}}replace(t,e,i){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let s=[];t>0&&this.decomposeLeft(t,s);let r=s.length;for(let t of i)s.push(t);if(t>0&&qi(s,r-1),e=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?_i.of(this.break?[t,null,e]:[t,e]):(this.left=zi(this.left,t),this.right=zi(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:s,right:r}=this,o=e+s.length+this.break,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function qi(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Wi&&(n=t[e+1])instanceof Wi&&t.splice(e-1,3,new Wi(i.length+1+n.length))}class ji{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Ei?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Ei(t-this.pos,-1,0)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(n,s,r)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ei(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let i=new Wi(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ei)return t;let e=new Ei(0,-1,0);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Ei||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();r=Math.max(r,n.left),o=Math.min(o,n.right),a=Math.max(a,n.top),l=Math.min(e==t.parentNode?s.innerHeight:l,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:r-i.left,right:Math.max(r,o)-i.left,top:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function Ii(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Ni{constructor(t,e,i,n){this.from=t,this.to=e,this.size=i,this.displaySize=n}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class);this.heightOracle=new Ai(i),this.stateDeco=tn(e),this.heightMap=_i.empty().applyChanges(this.stateDeco,n.EY.empty,this.heightOracle.setDoc(e.doc),[new re(0,0,0,e.doc.length)]);for(let t=0;t<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());t++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=C.set(this.lineGaps.map(t=>t.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some(({from:t,to:e})=>n>=t&&n<=e)){let{from:e,to:i}=this.lineBlockAt(n);t.push(new Fi(e,i))}}return this.viewports=t.sort((t,e)=>t.from-e.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ji:new en(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(nn(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=tn(this.state);let s=t.changedRanges,r=re.extendWithRanges(s,function(t,e,i){let s=new Vi;return n.om.compare(t,e,i,s,0),s.changes}(i,this.stateDeco,t?t.changes:n.VR.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Ti(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Zi)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let h=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(h||!t.changes.empty||2&t.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Yt)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?at.RTL:at.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||"refresh"===this.mustMeasureContent,a=e.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0;if(a.width&&a.height){let{scaleX:t,scaleY:i}=U(e,a);(t>.005&&Math.abs(this.scaleX-t)>.005||i>.005&&Math.abs(this.scaleY-i)>.005)&&(this.scaleX=t,this.scaleY=i,h|=16,o=l=!0)}let u=(parseInt(i.paddingTop)||0)*this.scaleY,f=(parseInt(i.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==f||(this.paddingTop=u,this.paddingBottom=f,h|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=16);let d=F(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let O=this.getScrollOffset();this.scrollOffset!=O&&(this.scrollAnchorHeight=-1,this.scrollOffset=O),this.scrolledToBottom=nt(this.scrollParent||t.win);let p=(this.printing?Ii:Bi)(e,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(t){let e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView||window;return e.left0&&e.top0}(t.dom))return 0;let w=a.width;if(this.contentDOMWidth==w&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,h|=16),l){let e=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(e)&&(o=!0),o||s.lineWrapping&&Math.abs(w-this.contentDOMWidth)>s.charWidth){let{lineHeight:i,charWidth:n,textHeight:a}=t.docView.measureTextSize();o=i>0&&s.refresh(r,i,n,a,Math.max(5,w/n),e),o&&(t.docView.minWidth=0,h|=16)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),Ti();for(let i of this.viewports){let r=i.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(i);this.heightMap=(o?_i.empty().applyChanges(this.stateDeco,n.EY.empty,this.heightOracle,[new re(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Ci(i.from,r))}Zi&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(2&h&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(2&h||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:r,visibleBottom:o}=this,a=new Fi(n.lineAt(r-1e3*i,Ri.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Ri.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Ri.ByPos,s,0,0);i="center"==e.y?(o.top+o.bottom)/2-r/2:"start"==e.y||"nearest"==e.y&&t=o+Math.max(10,Math.min(i,250)))&&n>r-2e3&&s>1,o=s<<1;if(this.defaultTextDirection!=at.LTR&&!i)return[];let a=[],l=(s,o,h,c)=>{if(o-ss&&tt.from>=h.from&&t.to<=h.to&&Math.abs(t.from-s)t.frome));if(!d){if(ot.from<=o&&t.to>=o)){let t=e.moveToLineBoundary(n.OF.cursor(o),!1,!0).head;t>s&&(o=t)}let t=this.gapSize(h,s,o,c);d=new Ni(s,o,t,i||t<2e6?t:2e6)}a.push(d)},h=e=>{if(e.lengthr&&(s.push({from:r,to:t}),o+=t-r),r=e}},20),r2e6)for(let i of t)i.from>=e.from&&i.frome.from&&l(e.from,a,e,r),ht.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let i=[];n.om.spans(e,this.viewport.from,this.viewport.to,{span(t,e){i.push({from:t,to:e})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let e=0;e=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||nn(this.heightMap.lineAt(t,Ri.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||nn(this.heightMap.lineAt(this.scaler.fromDOM(t),Ri.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return nn(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Fi{constructor(t,e){this.from=t,this.to=e}}function Hi({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:s}=e[t],r=s-i;if(n<=r)return i+n;n-=r}}function Ki(t,e){let i=0;for(let{from:n,to:s}of t.ranges){if(e<=s){i+=e-n;break}i+=s-n}return i/t.total}const Ji={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}};function tn(t){let e=t.facet(Ft).filter(t=>"function"!=typeof t),i=t.facet(Kt).filter(t=>"function"!=typeof t);return i.length&&e.push(n.om.join(i)),e}class en{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map(({from:i,to:s})=>{let r=e.lineAt(i,Ri.ByPos,t,0,0).top,o=e.lineAt(s,Ri.ByPos,t,0,0).bottom;return n+=o-r,{from:i,to:s,top:r,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let t of this.viewports)t.domTop=r+(t.top-s)*this.scale,r=t.domBottom=t.domTop+(t.bottom-t.top),s=t.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let s=ee.from==t.viewports[i].from&&e.to==t.viewports[i].to)}}function nn(t,e){if(1==e.scale)return t;let i=e.toDOM(t.top),n=e.toDOM(t.bottom);return new Mi(t.from,t.length,i,n-i,Array.isArray(t._content)?t._content.map(t=>nn(t,e)):t._content)}const sn=n.sj.define({combine:t=>t.join(" ")}),rn=n.sj.define({combine:t=>t.indexOf(!0)>-1}),on=s.G.newName(),an=s.G.newName(),ln=s.G.newName(),hn={"&light":"."+an,"&dark":"."+ln};function cn(t,e,i){return new s.G(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]}):t+" "+e})}const un=cn("."+on,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},hn),fn={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},dn=S.ie&&S.ie_version<=11;class On{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new H,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let t of e)this.queue.push(t);(S.ie&&S.ie_version<=11||S.ios&&t.composing)&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!S.android||!1===t.constructor.EDIT_CONTEXT||S.chrome&&S.chrome_version<126||(this.editContext=new mn(t),t.state.facet(jt)&&(t.contentDOM.editContext=this.editContext.editContext)),dn&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){("change"!=t.type&&t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(jt)?i.root.activeElement!=this.dom:!W(this.dom,n))return;let s=n.anchorNode&&i.docView.tile.nearest(n.anchorNode);s&&s.isWidget()&&s.widget.ignoreEvent(t)?e||(this.selectionChanged=!1):(S.ie&&S.ie_version<=11||S.android&&S.chrome)&&!i.state.selection.main.empty&&n.focusNode&&q(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=L(t.root);if(!e)return!1;let i=S.safari&&11==t.root.nodeType&&t.root.activeElement==this.dom&&function(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return gn(t,i)}let i=null;function n(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),i?gn(t,i):null}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let n=W(this.dom,i);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&it(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let s of t){let t=this.readMutation(s);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&W(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Fe(this.view,t,e,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=Ke(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!ei(this.view.state.selection,e.newSel.main))&&this.view.update([]),n}readMutation(t){let e=this.view.docView.tile.nearest(t.target);if(!e||e.isWidget())return null;if(e.markDirty("attributes"==t.type),"childList"==t.type){let i=pn(e,t.previousSibling||t.target.previousSibling,-1),n=pn(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(jt)!=t.state.facet(jt)&&(t.view.contentDOM.editContext=t.state.facet(jt)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function pn(t,e,i){for(;e;){let n=le.get(e);if(n&&n.parent==t)return n;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}function gn(t,e){let i=e.startContainer,n=e.startOffset,s=e.endContainer,r=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return q(o.node,o.offset,s,r)&&([i,n,s,r]=[s,r,i,n]),{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:r}}class mn{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let s=t.state.selection.main,{anchor:r,head:o}=s,a=this.toEditorPos(i.updateRangeStart),l=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:a,drifted:!1});let h=l-a>i.text.length;a==this.from&&rthis.to&&(l=r);let c=ti(t.state.sliceDoc(a,l),i.text,(h?s.from:s.to)-a,h?"end":null);if(!c){let e=n.OF.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));return void(ei(e,s)||t.dispatch({selection:e,userEvent:"select"}))}let u={from:c.from+a,to:c.toA+a,insert:n.EY.of(i.text.slice(c.from,c.toB).split("\n"))};if((S.mac||S.android)&&u.from==o-1&&/^\. ?$/.test(i.text)&&"off"==t.contentDOM.getAttribute("autocorrect")&&(u={from:a,to:l,insert:n.EY.of([i.text.replace("."," ")])}),this.pendingContextChange=u,!t.state.readOnly){let e=this.to-this.from+(u.to-u.from+u.insert.length);Je(t,u,n.OF.single(this.toEditorPos(i.selectionStart,e),this.toEditorPos(i.selectionEnd,e)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),u.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(e.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],s=null;for(let e=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);e{let i=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,n=t.underlineThickness;if(!/none/i.test(e)&&!/none/i.test(n)){let s=this.toEditorPos(t.rangeStart),r=this.toEditorPos(t.rangeEnd);if(s{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:e}=this.composing;this.composing=null,e&&this.reset(t.state)}};for(let t in this.handlers)e.addEventListener(t,this.handlers[t]);this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=L(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,n=this.pendingContextChange;return t.changes.iterChanges((s,r,o,a,l)=>{if(i)return;let h=l.length-(r-s);if(n&&r>=n.to){if(n.from==s&&n.to==r&&n.insert.eq(l))return n=this.pendingContextChange=null,e+=h,void(this.to+=h);n=null,this.revertPending(t.state)}if(s+=e,(r+=e)<=this.from)this.from+=h,this.to+=h;else if(sthis.to||this.to-this.from+l.length>3e4)return void(i=!0);this.editContext.updateText(this.toContextPos(s),this.toContextPos(r),l.toString()),this.to+=h}e+=h}),n&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(t=>!t.isUserEvent("input.type")&&t.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):this.applyEdits(t)&&this.rangeIsValid(t.state)?(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state):(this.pendingContextChange=null,this.reset(t.state)),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),n=this.toContextPos(e.head);this.editContext.selectionStart==i&&this.editContext.selectionEnd==n||this.editContext.updateSelection(i,n)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to3e4)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class vn{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(t=>t.forEach(t=>i(t,this)))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new Ui(this,t.state||n.$t.create(t)),t.scrollTo&&t.scrollTo.is(Wt)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Bt).map(t=>new Nt(t));for(let t of this.plugins)t.update(this);this.observer=new On(this),this.inputState=new ii(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ce(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(e=document.fonts)||void 0===e?void 0:e.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let e=1==t.length&&t[0]instanceof n.ZX?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,s=!1,r=this.state;for(let e of t){if(e.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let o=this.hasFocus,a=0,l=null;t.some(t=>t.annotation(Si))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Qi(r,o),l||(a=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(n.$t.phrases)!=this.state.facet(n.$t.phrases))return this.setState(r);e=oe.create(this,r,t),e.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(u&&(u=u.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection,{x:i,y:s}=this.state.facet(vn.cursorScrollMargin);u=new Et(t.empty?t:n.OF.cursor(t.head,t.head>t.anchor?-1:1),"nearest","nearest",s,i)}for(let t of e.effects)t.is(Wt)&&(u=t.value.clip(this.state))}this.viewState.update(e,u),this.bidiCache=yn.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(se)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some(t=>t.isUserEvent("select.pointer")))}finally{this.updateState=0}if(e.startState.facet(sn)!=e.state.facet(sn)&&(this.viewState.mustMeasureContent=!0),(i||s||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!e.empty)for(let t of this.state.facet(Ct))try{t(e)}catch(t){qt(this.state,t,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Ke(this,c)&&h.force&&it(this.contentDOM,h.key,h.keyCode)})}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new Ui(this,t),this.plugins=t.facet(Bt).map(t=>new Nt(t)),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new Ce(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Bt),i=t.state.facet(Bt);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Nt(s));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.viewState.scrollParent,n=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:r}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(r<0)if(nt(i||this.win))s=-1,r=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);s=t.from,r=t.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(t=>{try{return t.read(this)}catch(t){return qt(this.state,t),bn}}),h=oe.create(this,this.state,[]),c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h),c&&this.docViewUpdate());for(let t=0;t1||t<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n+=t,i?i.scrollTop+=t:this.win.scrollBy(0,t),r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(Ct))t(e)}get themeClasses(){return on+" "+(this.state.facet(rn)?ln:an)+" "+this.state.facet(sn)}updateAttrs(){let t=xn(this,Gt,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(jt)?"true":"false",class:"cm-content",style:`${S.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),xn(this,Ut,e);let i=this.observer.ignore(()=>{let i=P(this.contentDOM,this.contentAttrs,e),n=P(this.dom,this.editorAttrs,t);return i||n});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)t.is(vn.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(se);let t=this.state.facet(vn.cspNonce);s.G.mount(this.root,this.styleModules.concat(un).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;ee.plugin==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return De(this,t,Le(this,t,e,i))}moveByGroup(t,e){return De(this,t,Le(this,t,e,e=>function(t,e,i){let s=t.state.charCategorizer(e),r=s(i);return t=>{let e=s(t);return r==n.Je.Space&&(r=e),r==e}}(this,t.head,e)))}visualLineSide(t,e){let i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return n.OF.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1)}moveToLineBoundary(t,e,i=!0){return function(t,e,i,s){let r=Ye(t,e.head,e.assoc||-1),o=s&&r.type==A.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(o){let e=t.dom.getBoundingClientRect(),s=t.textDirectionAt(r.from),a=t.posAtCoords({x:i==(s==at.LTR)?e.right-1:e.left+1,y:(o.top+o.bottom)/2});if(null!=a)return n.OF.cursor(a,i?-1:1)}return n.OF.cursor(i?r.to:r.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return De(this,t,function(t,e,i,s){let r=e.head,o=i?1:-1;if(r==(i?t.state.doc.length:0))return n.OF.cursor(r,e.assoc);let a,l=e.goalColumn,h=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(r,e.assoc||((e.empty?i:e.head==e.from)?1:-1)),u=t.documentTop;if(c)null==l&&(l=c.left-h.left),a=o<0?c.top:c.bottom;else{let e=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-e.from))),a=(o<0?e.top:e.bottom)+u}let f=h.left+l,d=t.viewState.heightOracle.textHeight>>1,O=null!=s?s:d;for(let e=0;;e+=d){let s=a+(O+e)*o,r=je(t,{x:f,y:s},!1,o);if(i?s>h.bottom:sa:u0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(zt)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>wn)return St(t.length);let e,i=this.textDirectionAt(t.from);for(let n of this.bidiCache)if(n.from==t.from&&n.dir==i&&(n.fresh||vt(n.isolates,e=ee(this,t))))return n.order;e||(e=ee(this,t));let n=xt(t.text,i,e);return this.bidiCache.push(new yn(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||S.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{tt(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){var i,s,r,o;return Wt.of(new Et("number"==typeof t?n.OF.cursor(t):t,null!==(i=e.y)&&void 0!==i?i:"nearest",null!==(s=e.x)&&void 0!==s?s:"nearest",null!==(r=e.yMargin)&&void 0!==r?r:5,null!==(o=e.xMargin)&&void 0!==o?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return Wt.of(new Et(n.OF.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){null==t?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof t?this.inputState.tabFocusMode=t?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return It.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return It.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=s.G.newName(),n=[sn.of(i),se.of(cn(`.${i}`,t))];return e&&e.dark&&n.push(rn.of(!0)),n}static baseTheme(t){return n.Nb.lowest(se.of(cn("."+on,t,hn)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&le.get(i)||le.get(t);return(null===(e=null==n?void 0:n.root)||void 0===e?void 0:e.view)||null}}vn.styleModule=se,vn.inputHandler=Mt,vn.clipboardInputFilter=Xt,vn.clipboardOutputFilter=_t,vn.scrollHandler=Lt,vn.focusChangeEffect=Rt,vn.perLineTextDirection=zt,vn.exceptionSink=At,vn.updateListener=Ct,vn.editable=jt,vn.mouseSelectionStyle=Tt,vn.dragMovesSelection=Zt,vn.clickAddsSelectionRange=Pt,vn.decorations=Ft,vn.blockWrappers=Ht,vn.outerDecorations=Kt,vn.atomicRanges=Jt,vn.bidiIsolatedRanges=te,vn.cursorScrollMargin=n.sj.define({combine:t=>{let e=5,i=5;for(let n of t)"number"==typeof n?e=i=n:({x:e,y:i}=n);return{x:e,y:i}}}),vn.scrollMargins=ie,vn.darkTheme=rn,vn.cspNonce=n.sj.define({combine:t=>t.length?t[0]:""}),vn.contentAttributes=Ut,vn.editorAttributes=Gt,vn.lineWrapping=vn.contentAttributes.of({class:"cm-lineWrapping"}),vn.announce=n.Pe.define();const wn=4096,bn={};class yn{constructor(t,e,i,n,s,r){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=s,this.order=r}static update(t,e){if(e.empty&&!t.some(t=>t.fresh))return t;let i=[],n=t.length?t[t.length-1].dir:at.LTR;for(let s=Math.max(0,t.length-10);s=0;s--){let e=n[s],r="function"==typeof e?e(t):e;r&&Q(r,i)}return i}const Sn=S.mac?"mac":S.windows?"win":S.linux?"linux":"key";function Qn(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const kn=n.Nb.default(vn.domEventHandlers({keydown:(t,e)=>Mn(Zn(e.state),t,e,"editor")})),$n=n.sj.define({enables:kn}),Pn=new WeakMap;function Zn(t){let e=t.facet($n),i=Pn.get(e);return i||Pn.set(e,i=function(t,e=Sn){let i=Object.create(null),n=Object.create(null),s=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},r=(t,n,r,o,a)=>{var l,h;let c=i[t]||(i[t]=Object.create(null)),u=n.split(/ (?!$)/).map(t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=An={view:e,prefix:i,scope:t};return setTimeout(()=>{An==n&&(An=null)},4e3),!0}]})}let f=u.join(" ");s(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(l=c._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!0),a&&(d.stopPropagation=!0)};for(let n of t){let t=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:s}=n;for(let e in t)t[e].run.push(t=>s(t,Cn))}let s=n[e]||n.key;if(s)for(let e of t)r(e,s,n.run,n.preventDefault,n.stopPropagation),n.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault,n.stopPropagation)}return i}(e.reduce((t,e)=>t.concat(e),[]))),i}function Tn(t,e,i){return Mn(Zn(t.state),e,t,i)}let An=null,Cn=null;function Mn(t,e,i,s){Cn=e;let h=function(t){var e=!(a&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||l&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?o:r)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),c=(0,n.vS)(h,0),u=(0,n.Fh)(c)==h.length&&" "!=h,f="",d=!1,O=!1,p=!1;An&&An.view==i&&An.scope==s&&(f=An.prefix+" ",ai.indexOf(e.keyCode)<0&&(O=!0,An=null));let g,m,v=new Set,w=t=>{if(t){for(let e of t.run)if(!v.has(e)&&(v.add(e),e(i)))return t.stopPropagation&&(p=!0),!0;t.preventDefault&&(t.stopPropagation&&(p=!0),O=!0)}return!1},b=t[s];return b&&(w(b[f+Qn(h,e,!u)])?d=!0:!u||!(e.altKey||e.metaKey||e.ctrlKey)||S.windows&&e.ctrlKey&&e.altKey||S.mac&&e.altKey&&!e.ctrlKey&&!e.metaKey||!(g=r[e.keyCode])||g==h?u&&e.shiftKey&&w(b[f+Qn(h,e,!0)])&&(d=!0):(w(b[f+Qn(g,e,!0)])||e.shiftKey&&(m=o[e.keyCode])!=h&&m!=g&&w(b[f+Qn(m,e,!1)]))&&(d=!0),!d&&w(b._any)&&(d=!0)),O&&(d=!0),d&&p&&e.stopPropagation(),Cn=null,d}class Rn{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Xn(t);return[new Rn(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==at.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Xn(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=a.right-(c?parseInt(c.paddingRight):0),d=Ye(t,n,1),O=Ye(t,s,-1),p=d.type==A.Text?d:null,g=O.type==A.Text?O:null;if(p&&(t.lineWrapping||d.widgetLineBreaks)&&(p=zn(t,n,1,p)),g&&(t.lineWrapping||O.widgetLineBreaks)&&(g=zn(t,s,-1,g)),p&&g&&p.from==g.from&&p.to==g.to)return v(w(i.from,i.to,p));{let e=p?w(i.from,null,p):b(d,!1),n=g?w(null,i.to,g):b(O,!0),s=[];return(p||d).to<(g||O).from-(p&&g?1:0)||d.widgetLineBreaks>1&&e.bottom+t.defaultLineHeight/2h&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function b(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Xn(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==at.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function zn(t,e,i,n){let s=t.coordsAtPos(e,2*i);if(!s)return n;let r=t.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=t.posAtCoords({x:r.left+1,y:o}),l=t.posAtCoords({x:r.right-1,y:o});return null==a||null==l?n:{from:Math.max(n.from,Math.min(a,l)),to:Math.min(n.to,Math.max(a,l))}}class Yn{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Ln)!=t.state.facet(Ln)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Ln);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n})){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t,S.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ln=n.sj.define();function En(t){return[It.define(e=>new Yn(e,t)),Ln.of(t)]}const Wn=n.sj.define({combine:t=>(0,n.QR)(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function Dn(t={}){return[Wn.of(t),Vn,In,Nn,Yt.of(!0)]}function qn(t){return t.facet(Wn)}function jn(t){return t.startState.facet(Wn)!=t.state.facet(Wn)}const Vn=En({above:!0,markers(t){let{state:e}=t,i=e.facet(Wn),s=[];for(let r of e.selection.ranges){let o=r==e.selection.main;if(r.empty||i.drawRangeCursor&&!(o&&S.ios&&i.iosSelectionHandles)){let e=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=r.empty?r:n.OF.cursor(r.head,r.assoc);for(let n of Rn.forRange(t,e,i))s.push(n)}}return s},update(t,e){t.transactions.some(t=>t.selection)&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=jn(t);return i&&Bn(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){Bn(e.state,t)},class:"cm-cursorLayer"});function Bn(t,e){e.style.animationDuration=t.facet(Wn).cursorBlinkRate+"ms"}const In=En({above:!1,markers(t){let e=[],{main:i,ranges:s}=t.state.selection;for(let i of s)if(!i.empty)for(let n of Rn.forRange(t,"cm-selectionBackground",i))e.push(n);if(S.ios&&!i.empty&&t.state.facet(Wn).iosSelectionHandles){for(let s of Rn.forRange(t,"cm-selectionHandle cm-selectionHandle-start",n.OF.cursor(i.from,1)))e.push(s);for(let s of Rn.forRange(t,"cm-selectionHandle cm-selectionHandle-end",n.OF.cursor(i.to,1)))e.push(s)}return e},update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||jn(t),class:"cm-selectionLayer"}),Nn=n.Nb.highest(vn.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Gn=n.Pe.define({map:(t,e)=>null==t?null:e.mapPos(t)}),Un=n.sU.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce((t,e)=>e.is(Gn)?e.value:t,t))}),Fn=It.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(Un);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Un)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Un),i=null!=e&&t.coordsAtPos(e);if(!i)return null;let n=t.scrollDOM.getBoundingClientRect();return{left:i.left-n.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-n.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:i}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Un)!=t&&this.view.dispatch({effects:Gn.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Hn(){return[Un,Fn]}function Kn(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class Jn{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new n.vB,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))Kn(t.state.doc,this.regexp,e,n,(e,n)=>this.addMatch(n,t,e,i));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges((e,s,r,o)=>{o>=t.view.viewport.from&&r<=t.view.viewport.to&&(i=Math.min(r,i),n=Math.max(o,n))}),t.viewportMoved||n-i>1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>=r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const ts=null!=/x/.unicode?"gu":"g",es=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",ts),is={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let ns=null;const ss=n.sj.define({combine(t){let e=(0,n.QR)(t,{render:null,specialChars:es,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==ns&&"undefined"!=typeof document&&document.body){let e=document.body.style;ns=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return ns||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,ts)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ts)),e}});function rs(t={}){return[ss.of(t),os||(os=It.fromClass(class{constructor(t){this.view=t,this.decorations=C.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(ss)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Jn({regexp:t.specialChars,decoration:(e,i,s)=>{let{doc:r}=i.state,o=(0,n.vS)(e[0],0);if(9==o){let t=r.lineAt(s),e=i.state.tabSize,o=(0,n.y$)(t.text,e,s-t.from);return C.replace({widget:new ls((e-o%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=C.replace({widget:new as(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(ss);t.startState.facet(ss)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let os=null;class as extends T{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(is[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class ls extends T{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}const hs=It.fromClass(class{constructor(){this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}update(t){let{view:e}=t,i=e.viewState.editorHeight-e.defaultLineHeight-e.documentPadding.top-.5;i>=0&&i!=this.height&&(this.height=i,this.attrs={style:`padding-bottom: ${i}px`})}});function cs(){return[hs,Ut.of(t=>{var e;return(null===(e=t.plugin(hs))||void 0===e?void 0:e.attrs)||null})]}function us(){return ds}const fs=C.line({class:"cm-activeLine"}),ds=It.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let s=t.lineBlockAt(n.head);s.from>e&&(i.push(fs.range(s.from)),e=s.from)}return C.set(i)}},{decorations:t=>t.decorations});class Os extends T{constructor(t){super(),this.content=t}toDOM(t){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(t):this.content.cloneNode(!0)),e.setAttribute("aria-hidden","true"),e}coordsAt(t){let e=t.firstChild?D(t.firstChild):[];if(!e.length)return null;let i=window.getComputedStyle(t.parentNode),n=N(e[0],"rtl"!=i.direction),s=parseInt(i.lineHeight);return n.bottom-n.top>1.5*s?{left:n.left,right:n.right,top:n.top,bottom:n.top+s}:n}ignoreEvent(){return!1}}function ps(t){let e=It.fromClass(class{constructor(e){this.view=e,this.placeholder=t?C.set([C.widget({widget:new Os(t),side:1}).range(0)]):C.none}get decorations(){return this.view.state.doc.length?C.none:this.placeholder}},{decorations:t=>t.decorations});return"string"==typeof t?[e,vn.contentAttributes.of({"aria-placeholder":t})]:e}const gs=2e3;function ms(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),s=t.state.doc.lineAt(i),r=i-s.from,o=r>gs?-1:r==s.length?function(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):(0,n.y$)(s.text,t.state.tabSize,i-s.from);return{line:s.number,col:o,off:r}}function vs(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return vn.mouseSelectionStyle.of((t,i)=>e(i)?function(t,e){let i=ms(t,e),s=t.state.selection;return i?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(i.line).from),n=t.state.doc.lineAt(e);i={line:n.number,col:i.col,off:Math.min(i.off,n.length)},s=s.map(t.changes)}},get(e,r,o){let a=ms(t,e);if(!a)return s;let l=function(t,e,i){let s=Math.min(e.line,i.line),r=Math.max(e.line,i.line),o=[];if(e.off>gs||i.off>gs||e.col<0||i.col<0){let a=Math.min(e.off,i.off),l=Math.max(e.off,i.off);for(let e=s;e<=r;e++){let i=t.doc.line(e);i.length<=l&&o.push(n.OF.range(i.from+a,i.to+l))}}else{let a=Math.min(e.col,i.col),l=Math.max(e.col,i.col);for(let e=s;e<=r;e++){let i=t.doc.line(e),s=(0,n.kn)(i.text,a,t.tabSize,!0);if(s<0)o.push(n.OF.cursor(i.to));else{let e=(0,n.kn)(i.text,l,t.tabSize);o.push(n.OF.range(i.from+s,i.from+e))}}}return o}(t.state,i,a);return l.length?o?n.OF.create(l.concat(s.ranges)):n.OF.create(l):s}}:null}(t,i):null)}const ws={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},bs={style:"cursor: crosshair"};function ys(t={}){let[e,i]=ws[t.key||"Alt"],n=It.fromClass(class{constructor(t){this.view=t,this.isDown=!1}set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}},{eventObservers:{keydown(t){this.set(t.keyCode==e||i(t))},keyup(t){t.keyCode!=e&&i(t)||this.set(!1)},mousemove(t){this.set(i(t))}}});return[n,vn.contentAttributes.of(t=>{var e;return(null===(e=t.plugin(n))||void 0===e?void 0:e.isDown)?bs:null})]}const xs="-10000px";class Ss{constructor(t,e,i,n){this.facet=e,this.createTooltipView=i,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(t=>t);let s=null;this.tooltipViews=this.tooltips.map(t=>s=i(t,s))}update(t,e){var i;let n=t.state.facet(this.facet),s=n.filter(t=>t);if(n===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let r=[],o=e?[]:null;for(let i=0;ie[i]=t),e.length=o.length),this.input=n,this.tooltips=s,this.tooltipViews=r,!0}}function Qs(t={}){return $s.of(t)}function ks(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const $s=n.sj.define({combine:t=>{var e,i,n;return{position:S.ios?"absolute":(null===(e=t.find(t=>t.position))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(t=>t.parent))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find(t=>t.tooltipSpace))||void 0===n?void 0:n.tooltipSpace)||ks}}}),Ps=new WeakMap,Zs=It.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet($s);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ss(t,Ms,(t,e)=>this.createTooltip(t,e),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet($s);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t,e){let i=t.create(this.view),n=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",i.dom.appendChild(t)}return i.dom.style.position=this.position,i.dom.style.top=xs,i.dom.style.left="0px",this.container.insertBefore(i.dom,n),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(S.safari){let e=t.getBoundingClientRect();i=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}else i=!!t.offsetParent&&t.offsetParent!=this.container.ownerDocument.body}if(i||"absolute"==this.position)if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),s=ne(this.view);return{visible:{left:n.left+s.left,top:n.top+s.top,right:n.right-s.right,bottom:n.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet($s).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:i}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{visible:i,space:n,scaleX:s,scaleY:r}=t,o=[];for(let a=0;a=Math.min(i.bottom,n.bottom)||u.rightMath.min(i.right,n.right)+.1)){c.style.top=xs;continue}let d=l.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,O=d?7:0,p=f.right-f.left,g=null!==(e=Ps.get(h))&&void 0!==e?e:f.bottom-f.top,m=h.offset||Cs,v=this.view.textDirection==at.LTR,w=f.width>n.right-n.left?v?n.left:n.right-f.width:v?Math.max(n.left,Math.min(u.left-(d?14:0)+m.x,n.right-p)):Math.min(Math.max(n.left,u.left-p+(d?14:0)-m.x),n.right-p),b=this.above[a];!l.strictSide&&(b?u.top-g-O-m.yn.bottom)&&b==n.bottom-u.bottom>u.top-n.top&&(b=this.above[a]=!b);let y=(b?u.top-n.top:n.bottom-u.bottom)-O;if(yw&&t.topx&&(x=b?t.top-g-2-O:t.bottom+O+2);if("absolute"==this.position?(c.style.top=(x-t.parent.top)/r+"px",Ts(c,(w-t.parent.left)/s)):(c.style.top=x/r+"px",Ts(c,w/s)),d){let t=u.left+(v?m.x:-m.x)-(w+14-7);d.style.left=t/s+"px"}!0!==h.overlap&&o.push({left:w,top:x,right:S,bottom:x+g}),c.classList.toggle("cm-tooltip-above",b),c.classList.toggle("cm-tooltip-below",!b),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=xs}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ts(t,e){let i=parseInt(t.style.left,10);(isNaN(i)||Math.abs(e-i)>1)&&(t.style.left=e+"px")}const As=vn.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Cs={x:0,y:0},Ms=n.sj.define({enables:[Zs,As]}),Rs=n.sj.define({combine:t=>t.reduce((t,e)=>t.concat(e),[])});class Xs{static create(t){return new Xs(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ss(t,Rs,(t,e)=>this.createHostedView(t,e),t=>t.dom.remove())}createHostedView(t,e){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)null===(t=e.destroy)||void 0===t||t.call(e)}passProp(t){let e;for(let i of this.manager.tooltipViews){let n=i[t];if(void 0!==n)if(void 0===e)e=n;else if(e!==n)return}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const _s=Ms.compute([Rs],t=>{let e=t.facet(Rs);return 0===e.length?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var e;return null!==(e=t.end)&&void 0!==e?e:t.pos})),create:Xs.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class zs{constructor(t,e,i,n,s){this.view=t,this.source=e,this.field=i,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;ti.bottom||e.xi.right+t.defaultCharacterWidth)return;let r=t.bidiSpans(t.state.doc.lineAt(n)).find(t=>t.from<=n&&t.to>=n),o=r&&r.dir==at.RTL?-1:1;s=e.x{this.pending==e&&(this.pending=null,!i||Array.isArray(i)&&!i.length||t.dispatch({effects:this.setHover.of(Array.isArray(i)?i:[i])}))},e=>qt(t.state,e,"hover tooltip"))}else!r||Array.isArray(r)&&!r.length||t.dispatch({effects:this.setHover.of(Array.isArray(r)?r:[r])})}get tooltip(){let t=this.view.plugin(Zs),e=t?t.manager.tooltips.findIndex(t=>t.create==Xs.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!function(t,e){let i,{left:n,right:s,top:r,bottom:o}=t.getBoundingClientRect();if(i=t.querySelector(".cm-tooltip-arrow")){let t=i.getBoundingClientRect();r=Math.min(t.top,r),o=Math.max(t.bottom,o)}return e.clientX>=n-4&&e.clientX<=s+4&&e.clientY>=r-4&&e.clientY<=o+4}(s.dom,t)||this.pending){let{pos:s}=n[0]||this.pending,r=null!==(i=null===(e=n[0])||void 0===e?void 0:e.end)&&void 0!==i?i:s;(s==r?this.view.posAtCoords(this.lastMove)==s:function(t,e,i,n,s){let r=t.scrollDOM.getBoundingClientRect(),o=t.documentTop+t.documentPadding.top+t.contentHeight;if(r.left>n||r.rights||Math.min(r.bottom,o)=e&&a<=i}(this.view,s,r,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:e}=this;e&&e.dom.contains(t.relatedTarget)?this.watchTooltipLeave(e.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=i=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function Ys(t,e={}){let i=n.Pe.define(),s=n.sU.define({create:()=>[],update(t,s){if(t.length&&(e.hideOnChange&&(s.docChanged||s.selection)?t=[]:e.hideOn&&(t=t.filter(t=>!e.hideOn(s,t))),s.docChanged)){let e=[];for(let i of t){let t=s.changes.mapPos(i.pos,-1,n.iR.TrackDel);if(null!=t){let n=Object.assign(Object.create(null),i);n.pos=t,null!=n.end&&(n.end=s.changes.mapPos(n.end)),e.push(n)}}t=e}for(let e of s.effects)e.is(i)&&(t=e.value),e.is(Ws)&&(t=[]);return t},provide:t=>Rs.from(t)});return{active:s,extension:[s,It.define(n=>new zs(n,t,s,i,e.hoverTime||300)),_s]}}function Ls(t,e){let i=t.plugin(Zs);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}function Es(t){return t.facet(Rs).some(t=>t)}const Ws=n.Pe.define(),Ds=Ws.of(null);function qs(t){let e=t.plugin(Zs);e&&e.maybeMeasure()}const js=n.sj.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function Vs(t){return t?[js.of(t)]:[]}function Bs(t,e){let i=t.plugin(Is),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Is=It.fromClass(class{constructor(t){this.input=t.state.facet(Us),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(e=>e(t));let e=t.state.facet(js);this.top=new Ns(t,!0,e.topContainer),this.bottom=new Ns(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(js);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ns(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ns(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Us);if(i!=this.input){let e=i.filter(t=>t),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],e.update&&e.update(t)),n.push(e),(e.top?s:r).push(e)}this.specs=e,this.panels=n,this.top.sync(s),this.bottom.sync(r);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>vn.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class Ns{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Gs(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Gs(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Gs(t){let e=t.nextSibling;return t.remove(),e}const Us=n.sj.define({enables:Is});function Fs(t,e){let i,s=new Promise(t=>i=t),r=t=>function(t,e,i){let n=e.content?e.content(t,()=>o(null)):null;if(!n){if(n=(0,u.A)("form"),e.input){let t=(0,u.A)("input",e.input);/^(text|password|number|email|tel|url)$/.test(t.type)&&t.classList.add("cm-textfield"),t.name||(t.name="input"),n.appendChild((0,u.A)("label",(e.label||"")+": ",t))}else n.appendChild(document.createTextNode(e.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild((0,u.A)("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s="FORM"==n.nodeName?[n]:n.querySelectorAll("form");for(let t=0;t{27==t.keyCode?(t.preventDefault(),o(null)):13==t.keyCode&&(t.preventDefault(),o(e))}),e.addEventListener("submit",t=>{t.preventDefault(),o(e)})}let r=(0,u.A)("div",n,(0,u.A)("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));function o(e){r.contains(r.ownerDocument.activeElement)&&t.focus(),i(e)}return e.class&&(r.className=e.class),r.classList.add("cm-dialog"),{dom:r,top:e.top,mount:()=>{if(e.focus){let t;t="string"==typeof e.focus?n.querySelector(e.focus):n.querySelector("input")||n.querySelector("button"),t&&"select"in t?t.select():t&&"focus"in t&&t.focus()}}}}(t,e,i);t.state.field(Ks,!1)?t.dispatch({effects:Js.of(r)}):t.dispatch({effects:n.Pe.appendConfig.of(Ks.init(()=>[r]))});let o=tr.of(r);return{close:o,result:s.then(e=>((t.win.queueMicrotask||(e=>t.win.setTimeout(e,10)))(()=>{t.state.field(Ks).indexOf(r)>-1&&t.dispatch({effects:o})}),e))}}function Hs(t,e){let i=t.state.field(Ks,!1)||[];for(let n of i){let i=Bs(t,n);if(i&&i.dom.classList.contains(e))return i}return null}const Ks=n.sU.define({create:()=>[],update(t,e){for(let i of e.effects)i.is(Js)?t=[i.value].concat(t):i.is(tr)&&(t=t.filter(t=>t!=i.value));return t},provide:t=>Us.computeN([t],e=>e.field(t))}),Js=n.Pe.define(),tr=n.Pe.define();class er extends n.FB{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}er.prototype.elementClass="",er.prototype.toDOM=void 0,er.prototype.mapMode=n.iR.TrackBefore,er.prototype.startSide=er.prototype.endSide=-1,er.prototype.point=!0;const ir=n.sj.define(),nr=n.sj.define(),sr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>n.om.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rr=n.sj.define();function or(t){return[lr(),rr.of({...sr,...t})]}const ar=n.sj.define({combine:t=>t.some(t=>t)});function lr(t){let e=[hr];return t&&!1===t.fixed&&e.push(ar.of(!0)),e}const hr=It.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(rr).map(e=>new dr(t,e)),this.fixed=!t.state.facet(ar);for(let t of this.gutters)"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}if(t.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(ar)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let i=n.om.iter(this.view.state.facet(ir),this.view.viewport.from),s=[],r=this.gutters.map(t=>new fr(t,this.view.viewport,-this.view.documentPadding.top));for(let t of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(t.type)){let e=!0;for(let n of t.type)if(n.type==A.Text&&e){ur(i,s,n.from);for(let t of r)t.line(this.view,n,s);e=!1}else if(n.widget)for(let t of r)t.widget(this.view,n)}else if(t.type==A.Text){ur(i,s,t.from);for(let e of r)e.line(this.view,t,s)}else if(t.widget)for(let e of r)e.widget(this.view,t);for(let t of r)t.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(rr),i=t.state.facet(rr),s=t.docChanged||t.heightChanged||t.viewportChanged||!n.om.eq(t.startState.facet(ir),t.state.facet(ir),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(s=!0);else{s=!0;let n=[];for(let s of i){let i=e.indexOf(s);i<0?n.push(new dr(this.view,s)):(this.gutters[i].update(t),n.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),n.indexOf(t)<0&&t.destroy();for(let t of n)"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.gutters=n}return s}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>vn.scrollMargins.of(e=>{let i=e.plugin(t);if(!i||0==i.gutters.length||!i.fixed)return null;let n=i.dom.offsetWidth*e.scaleX,s=i.domAfter?i.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==at.LTR?{left:n,right:s}:{right:n,left:s}})});function cr(t){return Array.isArray(t)?t:[t]}function ur(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class fr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=n.om.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,s=(e.top-this.height)/t.scaleY,r=e.height/t.scaleY;if(this.i==n.elements.length){let e=new Or(t,r,s,i);n.elements.push(e),n.dom.appendChild(e.dom)}else n.elements[this.i].update(t,r,s,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];ur(this.cursor,n,e.from),i.length&&(n=n.concat(i));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let r=this.gutter;(0!=n.length||r.config.renderEmptyElements)&&this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e),n=i?[i]:null;for(let i of t.state.facet(nr)){let s=i(t,e.widget,e);s&&(n||(n=[])).push(s)}n&&this.addElement(t,e,n)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class dr{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,n=>{let s,r=n.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let t=r.getBoundingClientRect();s=(t.top+t.bottom)/2}else s=n.clientY;let o=t.lineBlockAtHeight(s-t.documentTop);e.domEventHandlers[i](t,o,n)&&n.preventDefault()});this.markers=cr(e.markers(t)),e.initialSpacer&&(this.spacer=new Or(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=cr(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!n.om.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class Or{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;i(0,n.QR)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let n=i[t],s=e[t];i[t]=n?(t,e,i)=>n(t,e,i)||s(t,e,i):s}return i}})});class vr extends er{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function wr(t,e){return t.state.facet(mr).formatNumber(e,t.state)}const br=rr.compute([mr],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(pr),lineMarker:(t,e,i)=>i.some(t=>t.toDOM)?null:new vr(wr(t,t.state.doc.lineAt(e.from).number)),widgetMarker:(t,e,i)=>{for(let n of t.state.facet(gr)){let s=n(t,e,i);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(mr)!=t.state.facet(mr),initialSpacer:t=>new vr(wr(t,xr(t.state.doc.lines))),updateSpacer(t,e){let i=wr(e.view,xr(e.view.state.doc.lines));return i==t.number?t:new vr(i)},domEventHandlers:t.facet(mr).domEventHandlers,side:"before"}));function yr(t={}){return[mr.of(t),lr(),br]}function xr(t){let e=9;for(;e{let e=[],i=-1;for(let n of t.selection.ranges){let s=t.doc.lineAt(n.head).from;s>i&&(i=s,e.push(Sr.range(s)))}return n.om.of(e)});function kr(){return Qr}function $r(t){return It.define(e=>({decorations:t.createDeco(e),update(e){this.decorations=t.updateDeco(e,this.decorations)}}),{decorations:t=>t.decorations})}const Pr=C.mark({class:"cm-highlightTab"}),Zr=C.mark({class:"cm-highlightSpace"}),Tr=$r(new Jn({regexp:/\t| /g,decoration:t=>"\t"==t[0]?Pr:Zr,boundary:/\S/}));function Ar(){return Tr}const Cr=$r(new Jn({regexp:/\s+$/g,decoration:C.mark({class:"cm-trailingSpace"})}));function Mr(){return Cr}const Rr={HeightMap:_i,HeightOracle:Ai,MeasuredHeights:Ci,QueryType:Ri,ChangedRange:re,computeOrder:xt,moveVisually:kt,clearHeightChangeFlag:Ti,getHeightChangeFlag:()=>Zi}},90365(t,e,i){i.d(e,{PH:()=>O,Qj:()=>d,RY:()=>M,Z6:()=>h,cF:()=>n,fI:()=>c,iX:()=>X,rr:()=>R,uY:()=>o});const n=1024;let s=0;class r{constructor(t,e){this.from=t,this.to=e}}class o{constructor(t={}){this.id=s++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=h.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}o.closedBy=new o({deserialize:t=>t.split(" ")}),o.openedBy=new o({deserialize:t=>t.split(" ")}),o.group=new o({deserialize:t=>t.split(" ")}),o.isolate=new o({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),o.contextHash=new o({perNode:!0}),o.lookAhead=new o({perNode:!0}),o.mounted=new o({perNode:!0});class a{constructor(t,e,i,n=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=n}static get(t){return t&&t.props&&t.props[o.mounted.id]}}const l=Object.create(null);class h{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):l,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new h(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(o.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(o.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}h.none=new h("",Object.create(null),0,8);class c{constructor(t){this.types=t;for(let e=0;e=e){let o=new b(r.tree,r.overlay[0].from+t.from,-1,t);(s||(s=[n])).push(v(o,e,i,!1))}}return s?k(s):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:s=this.length}=t,r=t.mode||0,o=(r&d.IncludeAnonymous)>0;for(let t=this.cursor(r|d.IncludeAnonymous);;){let r=!1;if(t.from<=s&&t.to>=n&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;r=!0}for(;r&&i&&(o||!t.type.isAnonymous)&&i(t),!t.nextSibling();){if(!t.parent())return;r=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:C(h.none,this.children,this.positions,0,this.children.length,0,this.length,(t,e,i)=>new O(this.type,t,e,i,this.propValues),t.makeTree||((t,e,i)=>new O(h.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:s,maxBufferLength:r=n,reused:a=[],minRepeatType:l=s.types.length}=t,h=Array.isArray(i)?new p(i,i.length):i,c=s.types,u=0,f=0;function d(t,e,i,n,p,y){let{id:x,start:S,end:Q,size:k}=h,$=f,P=u;if(k<0){if(h.next(),-1==k){let e=a[x];return i.push(e),void n.push(S-t)}if(-3==k)return void(u=x);if(-4==k)return void(f=x);throw new RangeError(`Unrecognized record size: ${k}`)}let Z,T,A=c[x],M=S-t;if(Q-S<=r&&(T=function(t,e){let i=h.fork(),n=0,s=0,o=0,a=i.end-r,c={size:0,start:0,skip:0};t:for(let r=i.pos-t;i.pos>r;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=s,c.skip=o,o+=4,n+=4,i.next();continue}let h=i.pos-t;if(t<0||h=l?4:0,f=i.start;for(i.next();i.pos>h;){if(i.size<0){if(-3!=i.size&&-4!=i.size)break t;u+=4}else i.id>=l&&(u+=4);i.next()}s=f,n+=t,o+=u}return(e<0||n==t)&&(c.size=n,c.start=s,c.skip=o),c.size>4?c:void 0}(h.pos-e,p))){let e=new Uint16Array(T.size-T.skip),i=h.pos-T.size,n=e.length;for(;h.pos>i;)n=b(T.start,e,n);Z=new g(e,Q-T.start,s),M=T.start-t}else{let t=h.pos-k;h.next();let e=[],i=[],n=x>=l?x:-1,s=0,a=Q;for(;h.pos>t;)n>=0&&h.id==n&&h.size>=0?(h.end<=a-r&&(v(e,i,S,s,h.end,a,n,$,P),s=e.length,a=h.end),h.next()):y>2500?m(S,t,e,i):d(S,t,e,i,n,y+1);if(n>=0&&s>0&&s-1&&s>0){let t=function(t,e){return(i,n,s)=>{let r,a,l=0,h=i.length-1;if(h>=0&&(r=i[h])instanceof O){if(!h&&r.type==t&&r.length==s)return r;(a=r.prop(o.lookAhead))&&(l=n[h]+r.length+a)}return w(t,i,n,s,l,e)}}(A,P);Z=C(A,e,i,0,e.length,0,Q-S,t,t)}else Z=w(A,e,i,Q-S,$-Q,P)}i.push(Z),n.push(M)}function m(t,e,i,n){let o=[],a=0,l=-1;for(;h.pos>e;){let{id:t,start:e,end:i,size:n}=h;if(n>4)h.next();else{if(l>-1&&e=0;t-=3)e[i++]=o[t],e[i++]=o[t+1]-r,e[i++]=o[t+2]-r,e[i++]=i;i.push(new g(e,o[2]-r,s)),n.push(r-t)}}function v(t,e,i,n,r,o,a,l,h){let c=[],u=[];for(;t.length>n;)c.push(t.pop()),u.push(e.pop()+i-r);t.push(w(s.types[a],c,u,o-r,l-o,h)),e.push(r-i)}function w(t,e,i,n,s,r,a){if(r){let t=[o.contextHash,r];a=a?[t].concat(a):[t]}if(s>25){let t=[o.lookAhead,s];a=a?[t].concat(a):[t]}return new O(t,e,i,n,a)}function b(t,e,i){let{id:n,start:s,end:r,size:o}=h;if(h.next(),o>=0&&n4){let n=h.pos-(o-4);for(;h.pos>n;)i=b(t,e,i)}e[--i]=a,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==o?u=n:-4==o&&(f=n);return i}let y=[],x=[];for(;h.pos>0;)d(t.start||0,t.bufferStart||0,y,x,-1,0);let S=null!==(e=t.length)&&void 0!==e?e:y.length?x[0]+y[0].length:0;return new O(c[t.topID],y.reverse(),x.reverse(),S)}(t)}}O.empty=new O(h.none,[],[],0);class p{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new p(this.buffer,this.index)}}class g{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return h.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function v(t,e,i,n){for(var s;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?o.length:-1;t!=h;t+=e){let h,c=o[t],u=l[t]+r.from;if(s&d.EnterBracketed&&c instanceof O&&(h=a.get(c))&&!h.overlay&&h.bracketed&&i>=u&&i<=u+c.length||m(n,i,u,u+c.length))if(c instanceof g){if(s&d.ExcludeBuffers)continue;let o=c.findChild(0,c.buffer.length,e,i-u,n);if(o>-1)return new Q(new S(r,c,t,u),null,o)}else if(s&d.IncludeAnonymous||!c.type.isAnonymous||Z(c)){let o;if(!(s&d.IgnoreMounts)&&(o=a.get(c))&&!o.overlay)return new b(o.tree,u,t,r);let l=new b(c,u,t,r);return s&d.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?c.children.length-1:0,e,i,n,s)}}if(s&d.IncludeAnonymous||!r.type.isAnonymous)return null;if(t=r.index>=0?r.index+e:e<0?-1:r._parent._tree.children.length,r=r._parent,!r)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,e,i=0){let n;if(!(i&d.IgnoreOverlays)&&(n=a.get(this._tree))&&n.overlay){let s=t-this.from,r=i&d.EnterBracketed&&n.bracketed;for(let{from:t,to:i}of n.overlay)if((e>0||r?t<=s:t=s:i>s))return new b(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function y(t,e,i,n){let s=t.cursor(),r=[];if(!s.firstChild())return r;if(null!=i)for(let t=!1;!t;)if(t=s.type.is(i),!s.nextSibling())return r;for(;;){if(null!=n&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return null==n?r:[]}}function x(t,e,i=e.length-1){for(let n=t;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class S{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Q extends w{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return s<0?null:new Q(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,e,i=0){if(i&d.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new Q(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Q(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Q(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let r=i.buffer[this.index+1];t.push(i.slice(n,s,r)),e.push(0)}return new O(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function k(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;ni.from||s.to0){if(this.index-1)for(let n=e+t,s=t<0?-1:i._tree.children.length;n!=s;n+=t){let t=i._tree.children[n];if(this.mode&d.IncludeAnonymous||t instanceof g||!t.type.isAnonymous||Z(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let r=t;r;r=r._parent)if(r.index==n){if(n==this.index)return r;e=r,i=s+1;break t}n=this.stack[--s]}for(let t=i;t=0;s--){if(s<0)return x(this._tree,t,n);let r=i[e.buffer[this.stack[s]]];if(!r.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}}function Z(t){return t.children.some(t=>t instanceof g||!t.type.isAnonymous||Z(t))}const T=new WeakMap;function A(t,e){if(!t.isAnonymous||e instanceof g||e.type!=t)return 1;let i=T.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof O)){i=1;break}i+=A(t,n)}T.set(e,i)}return i}function C(t,e,i,n,s,r,o,a,l){let h=0;for(let i=n;i=c)break;O+=e}if(h==s+1){if(O>c){let t=i[s];e(t.children,t.positions,0,t.children.length,n[s]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-d;u.push(C(t,i,n,s,h,d,e,null,l))}f.push(d+a-r)}}(e,i,n,s,0),(a||l)(u,f,o)}class M{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Q?this.setBuffer(t.context.buffer,t.index,e):t instanceof b&&this.map.set(t.tree,e)}get(t){return t instanceof Q?this.getBuffer(t.context.buffer,t.index):t instanceof b?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class R{constructor(t,e,i,n,s=!1,r=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(s?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new R(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],s=1,r=t.length?t[0]:null;for(let o=0,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new R(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew r(t.from,t.to)):[new r(0,0)]:[new r(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class _{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new o({perNode:!0})},43720(t,e,i){i.d(e,{DM:()=>f,_A:()=>T,az:()=>u,pn:()=>l});var n=i(90365);let s=0;class r{constructor(t,e,i,n){this.name=t,this.set=e,this.base=i,this.modified=n,this.id=s++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let i="string"==typeof t?t:"?";if(t instanceof r&&(e=t),null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let n=new r(i,[],null,[]);if(n.set.push(n),e)for(let t of e.set)n.set.push(t);return n}static defineModifier(t){let e=new a(t);return t=>t.modified.indexOf(e)>-1?t:a.get(t.base||t,t.modified.concat(e).sort((t,e)=>t.id-e.id))}}let o=0;class a{constructor(t){this.name=t,this.instances=[],this.id=o++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(i=>{return i.base==t&&(n=e,s=i.modified,n.length==s.length&&n.every((t,e)=>t==s[e]));var n,s});if(i)return i;let n=[],s=new r(t.name,n,t,e);for(let t of e)t.instances.push(s);let o=function(t){let e=[[]];for(let i=0;ie.length-t.length)}(e);for(let e of t.set)if(!e.modified.length)for(let t of o)n.push(a.get(e,t));return s}}function l(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],s=2,r=t;for(let e=0;;){if("..."==r&&e>0&&e+3==t.length){s=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);r=t.slice(e)}let o=i.length-1,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new c(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return h.add(e)}const h=new n.uY({combine(t,e){let i,n,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),i&&i.mode==s.mode&&!s.context&&!i.context)continue;let r=new c(s.tags,s.mode,s.context);i?i.next=r:n=r,i=r}return n}});class c{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth{let e=s;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function f(t,e,i,n=0,s=t.length){let r=new d(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}c.empty=new c([],2,null);class d{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,s,r){let{type:o,from:a,to:l}=t;if(a>=i||l<=e)return;o.isTop&&(r=this.highlighters.filter(t=>!t.scope||t.scope(o)));let u=s,f=function(t){let e=t.type.prop(h);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||c.empty,d=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(r,f.tags);if(d&&(u&&(u+=" "),u+=d,1==f.mode&&(s+=(s?" ":"")+d)),this.startSpan(Math.max(e,a),u),f.opaque)return;let O=t.tree&&t.tree.prop(n.uY.mounted);if(O&&O.overlay){let n=t.node.enter(O.overlay[0].from+a,1),o=this.highlighters.filter(t=>!t.scope||t.scope(O.tree.type)),h=t.firstChild();for(let c=0,f=a;;c++){let d=c=p)&&t.nextSibling()););if(!d||p>i)break;f=d.to+a,f>e&&(this.highlightRange(n.cursor(),Math.max(e,d.from+a),Math.min(i,f),"",o),this.startSpan(Math.min(i,f),u))}h&&t.parent()}else if(t.firstChild()){O&&(s="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,s,r),this.startSpan(Math.min(i,t.to),u)}}while(t.nextSibling());t.parent()}}}const O=r.define,p=O(),g=O(),m=O(g),v=O(g),w=O(),b=O(w),y=O(w),x=O(),S=O(x),Q=O(),k=O(),$=O(),P=O($),Z=O(),T={comment:p,lineComment:O(p),blockComment:O(p),docComment:O(p),name:g,variableName:O(g),typeName:m,tagName:O(m),propertyName:v,attributeName:O(v),className:O(g),labelName:O(g),namespace:O(g),macroName:O(g),literal:w,string:b,docString:O(b),character:O(b),attributeValue:O(b),number:y,integer:O(y),float:O(y),bool:O(w),regexp:O(w),escape:O(w),color:O(w),url:O(w),keyword:Q,self:O(Q),null:O(Q),atom:O(Q),unit:O(Q),modifier:O(Q),operatorKeyword:O(Q),controlKeyword:O(Q),definitionKeyword:O(Q),moduleKeyword:O(Q),operator:k,derefOperator:O(k),arithmeticOperator:O(k),logicOperator:O(k),bitwiseOperator:O(k),compareOperator:O(k),updateOperator:O(k),definitionOperator:O(k),typeOperator:O(k),controlOperator:O(k),punctuation:$,separator:O($),bracket:P,angleBracket:O(P),squareBracket:O(P),paren:O(P),brace:O(P),content:x,heading:S,heading1:O(S),heading2:O(S),heading3:O(S),heading4:O(S),heading5:O(S),heading6:O(S),contentSeparator:O(x),list:O(x),quote:O(x),emphasis:O(x),strong:O(x),link:O(x),monospace:O(x),strikethrough:O(x),inserted:O(),deleted:O(),changed:O(),invalid:O(),meta:Z,documentMeta:O(Z),annotation:O(Z),processingInstruction:O(Z),definition:r.defineModifier("definition"),constant:r.defineModifier("constant"),function:r.defineModifier("function"),standard:r.defineModifier("standard"),local:r.defineModifier("local"),special:r.defineModifier("special")};for(let t in T){let e=T[t];e instanceof r&&(e.name=t)}u([{tag:T.link,class:"tok-link"},{tag:T.heading,class:"tok-heading"},{tag:T.emphasis,class:"tok-emphasis"},{tag:T.strong,class:"tok-strong"},{tag:T.keyword,class:"tok-keyword"},{tag:T.atom,class:"tok-atom"},{tag:T.bool,class:"tok-bool"},{tag:T.url,class:"tok-url"},{tag:T.labelName,class:"tok-labelName"},{tag:T.inserted,class:"tok-inserted"},{tag:T.deleted,class:"tok-deleted"},{tag:T.literal,class:"tok-literal"},{tag:T.string,class:"tok-string"},{tag:T.number,class:"tok-number"},{tag:[T.regexp,T.escape,T.special(T.string)],class:"tok-string2"},{tag:T.variableName,class:"tok-variableName"},{tag:T.local(T.variableName),class:"tok-variableName tok-local"},{tag:T.definition(T.variableName),class:"tok-variableName tok-definition"},{tag:T.special(T.variableName),class:"tok-variableName2"},{tag:T.definition(T.propertyName),class:"tok-propertyName tok-definition"},{tag:T.typeName,class:"tok-typeName"},{tag:T.namespace,class:"tok-namespace"},{tag:T.className,class:"tok-className"},{tag:T.macroName,class:"tok-macroName"},{tag:T.propertyName,class:"tok-propertyName"},{tag:T.operator,class:"tok-operator"},{tag:T.comment,class:"tok-comment"},{tag:T.meta,class:"tok-meta"},{tag:T.invalid,class:"tok-invalid"},{tag:T.punctuation,class:"tok-punctuation"}])},86298(t,e,i){i.r(e),i.d(e,{Annotation:()=>o.YH,AnnotationType:()=>o.UJ,BidiSpan:()=>a.tF,BlockInfo:()=>a.uF,BlockType:()=>a._B,BlockWrapper:()=>a.l_,ChangeDesc:()=>o.Gu,ChangeSet:()=>o.VR,CharCategory:()=>o.Je,Compartment:()=>o.xx,Decoration:()=>a.NZ,Direction:()=>a.OP,EditorSelection:()=>o.OF,EditorState:()=>o.$t,EditorView:()=>a.Lz,ExternalChange:()=>_i,Facet:()=>o.sj,GutterMarker:()=>a.wJ,Line:()=>o.N1,MapMode:()=>o.iR,MatchDecorator:()=>a.dT,Prec:()=>o.Nb,Range:()=>o.Q6,RangeSet:()=>o.om,RangeSetBuilder:()=>o.vB,RangeValue:()=>o.FB,RectangleMarker:()=>a.Ip,SelectionRange:()=>o.yn,StateEffect:()=>o.Pe,StateEffectType:()=>o.DA,StateField:()=>o.sU,Text:()=>o.EY,Transaction:()=>o.ZX,ViewPlugin:()=>a.Z9,ViewUpdate:()=>a.X3,WidgetType:()=>a.xO,__test:()=>a.rU,basicSetup:()=>oi,closeHoverTooltips:()=>a.vo,codePointAt:()=>o.vS,codePointSize:()=>o.Fh,color:()=>ki,combineConfig:()=>o.QR,countColumn:()=>o.y$,crosshairCursor:()=>a.HJ,default:()=>Di,defaultLightThemeOption:()=>Ti,drawSelection:()=>a.VH,dropCursor:()=>a.A,findClusterBreak:()=>o.zK,findColumn:()=>o.kn,fromCodePoint:()=>o.MK,getDefaultExtensions:()=>Ai,getDialog:()=>a.rC,getDrawSelectionConfig:()=>a.$G,getPanel:()=>a.ld,getStatistics:()=>Ci,getTooltip:()=>a.Eg,gutter:()=>a.cU,gutterLineClass:()=>a.EV,gutterWidgetClass:()=>a.QO,gutters:()=>a.Hm,hasHoverTooltips:()=>a.n6,highlightActiveLine:()=>a.dz,highlightActiveLineGutter:()=>a.Wu,highlightSpecialChars:()=>a.N$,highlightTrailingWhitespace:()=>a.wu,highlightWhitespace:()=>a.Yq,hoverTooltip:()=>a.Ux,keymap:()=>a.w4,layer:()=>a.qd,lineNumberMarkers:()=>a.pK,lineNumberWidgetMarker:()=>a.qy,lineNumbers:()=>a.$K,logException:()=>a.c_,minimalSetup:()=>ai,oneDark:()=>Zi,oneDarkHighlightStyle:()=>Pi,oneDarkTheme:()=>$i,panels:()=>a.C3,placeholder:()=>a.qf,rectangularSelection:()=>a.D4,repositionTooltips:()=>a.Pq,runScopeHandlers:()=>a.TS,scrollPastEnd:()=>a.BE,showDialog:()=>a.ui,showPanel:()=>a.S7,showTooltip:()=>a.DK,tooltips:()=>a.vX,useCodeMirror:()=>Yi});var n=i(58168),s=i(98587),r=i(51609),o=i(31638),a=i(36898),l=i(15874),h=i(90365);function c(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=t(e,i);return!!s&&(n(i.update(s)),!0)}}const u=c(g,0),f=c(p,0),d=c((t,e)=>p(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),s=i.to<=n.to?n:t.doc.lineAt(i.to);s.from>n.from&&s.from==i.to&&(s=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}(e)),0);function O(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}function p(t,e,i=e.selection.ranges){let n=i.map(t=>O(e,t.from).block);if(!n.every(t=>t))return null;let s=i.map((t,i)=>function(t,{open:e,close:i},n,s){let r,o,a=t.sliceDoc(n-50,n),l=t.sliceDoc(s,s+50),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=100?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+50),o=t.sliceDoc(s-50,s));let f=/^\s*/.exec(r)[0].length,d=/\s*$/.exec(o)[0].length,O=o.length-d-i.length;return r.slice(f,f+e.length)==e&&o.slice(O,O+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(r.charAt(f+e.length))?1:0},close:{pos:s-d-i.length,margin:/\s/.test(o.charAt(O-1))?1:0}}:null}(e,n[i],t.from,t.to));if(2!=t&&!s.every(t=>t))return{changes:e.changes(i.map((t,e)=>s[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}]))};if(1!=t&&s.some(t=>t)){let t=[];for(let e,i=0;is&&(t==r||r>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,r=l.text.slice(t,t+i.length)==i?t:-1;tt.comment<0&&(!t.empty||t.single))){let t=[];for(let{line:e,token:i,indent:s,empty:r,single:o}of n)!o&&r||t.push({from:e.from+s,insert:i+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some(t=>t.comment>=0)){let t=[];for(let{line:e,comment:i,token:s}of n)if(i>=0){let n=e.from+i,r=n+s.length;" "==e.text[r-e.from]&&r++,t.push({from:n,to:r})}return{changes:t}}return null}const m=o.YH.define(),v=o.YH.define(),w=o.sj.define(),b=o.sj.define({combine:t=>(0,o.QR)(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})}),y=o.sU.define({create:()=>Y.empty,update(t,e){let i=e.state.facet(b),n=e.annotation(m);if(n){let s=Z.fromTransaction(e,n.selection),r=n.side,o=0==r?t.undone:t.done;return o=s?T(o,o.length,i.minDepth,s):M(o,e.startState.selection),new Y(0==r?n.rest:o,0==r?o:n.rest)}let s=e.annotation(v);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(o.ZX.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Z.fromTransaction(e),a=e.annotation(o.ZX.time),l=e.annotation(o.ZX.userEvent);return r?t=t.addChanges(r,a,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,a,l,i.newGroupDelay)),"full"!=s&&"after"!=s||(t=t.isolate()),t},toJSON:t=>({done:t.done.map(t=>t.toJSON()),undone:t.undone.map(t=>t.toJSON())}),fromJSON:t=>new Y(t.done.map(Z.fromJSON),t.undone.map(Z.fromJSON))});function x(t={}){return[y,b.of(t),a.Lz.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?Q:"historyRedo"==t.inputType?k:null;return!!i&&(t.preventDefault(),i(e))}})]}function S(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(y,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const Q=S(0,!1),k=S(1,!1),$=S(0,!0),P=S(1,!0);class Z{constructor(t,e,i,n,s){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new Z(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(t=>t.toJSON())}}static fromJSON(t){return new Z(t.changes&&o.VR.fromJSON(t.changes),[],t.mapped&&o.Gu.fromJSON(t.mapped),t.startSelection&&o.OF.fromJSON(t.startSelection),t.selectionsAfter.map(o.OF.fromJSON))}static fromTransaction(t,e){let i=C;for(let e of t.startState.facet(w)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Z(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,C)}static selection(t){return new Z(void 0,C,void 0,void 0,t)}}function T(t,e,i,n){let s=e+1>i+20?e-i-1:0,r=t.slice(s,e);return r.push(n),r}function A(t,e){return t.length?e.length?t.concat(e):t:e}const C=[];function M(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-200));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),T(t,t.length-1,1e9,i.setSelAfter(n)))}return[Z.selection([e])]}function R(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function X(t,e){if(!t.length)return t;let i=t.length,n=C;for(;i;){let s=_(t[i-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let e=t.slice(0,i);return e[i-1]=s,e}e=s.mapped,i--,n=s.selectionsAfter}return n.length?[Z.selection(n)]:C}function _(t,e,i){let n=A(t.selectionsAfter.length?t.selectionsAfter.map(t=>t.map(e)):C,i);if(!t.changes)return Z.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(r):r;return new Z(s,o.Pe.mapEffects(t.effects,e),a,t.startSelection.map(r),n)}const z=/^(input\.type|delete)($|\.)/;class Y{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new Y(this.done,this.undone):this}addChanges(t,e,i,n,s){let r=this.done,a=r[r.length-1];return r=a&&a.changes&&!a.changes.empty&&t.changes&&(!i||z.test(i))&&(!a.selectionsAfter.length&&e-this.prevTimei.push(t,e)),e.iterChangedRanges((t,e,s,r)=>{for(let t=0;t=e&&s<=o&&(n=!0)}}),n}(a.changes,t.changes))||"input.type.compose"==i)?T(r,r.length-1,n.minDepth,new Z(t.changes.compose(a.changes),A(o.Pe.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,C)):T(r,r.length,n.minDepth,t),new Y(r,C,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:C;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty).length)?this:new Y(M(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Y(X(this.done,t),X(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let s=n[n.length-1],r=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):e.selection);if(i&&s.selectionsAfter.length)return e.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:m.of({side:t,rest:R(n),selection:r}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?C:n.slice(0,n.length-1);return s.mapped&&(i=X(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:m.of({side:t,rest:i,selection:r}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Y.empty=new Y(C,C);const L=[{key:"Mod-z",run:Q,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:k,preventDefault:!0},{linux:"Ctrl-Shift-z",run:k,preventDefault:!0},{key:"Mod-u",run:$,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:P,preventDefault:!0}];function E(t,e){return o.OF.create(t.ranges.map(e),t.mainIndex)}function W(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function D({state:t,dispatch:e},i){let n=E(t.selection,i);return!n.eq(t.selection,!0)&&(e(W(t,n)),!0)}function q(t,e){return o.OF.cursor(e?t.to:t.from)}function j(t,e){return D(t,i=>i.empty?t.moveByChar(i,e):q(i,e))}function V(t){return t.textDirectionAt(t.state.selection.main.head)==a.OP.LTR}const B=t=>j(t,!V(t)),I=t=>j(t,V(t));function N(t,e){return D(t,i=>i.empty?t.moveByGroup(i,e):q(i,e))}function G(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function U(t,e,i){let n,s,r=(0,l.mv)(t).resolveInner(e.head),a=i?h.uY.closedBy:h.uY.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;G(t,e,a)?r=e:n=i?e.to:e.from}return s=r.type.prop(a)&&(n=i?(0,l.jU)(t,r.from,1):(0,l.jU)(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,o.OF.cursor(s,i?-1:1)}function F(t,e){return D(t,i=>{if(!i.empty)return q(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}"undefined"!=typeof Intl&&Intl.Segmenter;const H=t=>F(t,!1),K=t=>F(t,!0);function J(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):q(i,e));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+n.marginTop,h=o.bottom-n.marginBottom;e&&e.top>l&&e.bottomtt(t,!1),it=t=>tt(t,!0);function nt(t,e,i){let n=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,i);if(s.head==e.head&&s.head!=(i?n.to:n.from)&&(s=t.moveToLineBoundary(e,i,!1)),!i&&s.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(s=o.OF.cursor(n.from+i))}return s}function st(t,e){let i=E(t.state.selection,t=>{let i=e(t);return o.OF.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(t.state.selection)&&(t.dispatch(W(t.state,i)),!0)}function rt(t,e){return st(t,i=>t.moveByChar(i,e))}const ot=t=>rt(t,!V(t)),at=t=>rt(t,V(t));function lt(t,e){return st(t,i=>t.moveByGroup(i,e))}function ht(t,e){return st(t,i=>t.moveVertically(i,e))}const ct=t=>ht(t,!1),ut=t=>ht(t,!0);function ft(t,e){return st(t,i=>t.moveVertically(i,e,J(t).height))}const dt=t=>ft(t,!1),Ot=t=>ft(t,!0),pt=({state:t,dispatch:e})=>(e(W(t,{anchor:0})),!0),gt=({state:t,dispatch:e})=>(e(W(t,{anchor:t.doc.length})),!0),mt=({state:t,dispatch:e})=>(e(W(t,{anchor:t.selection.main.anchor,head:0})),!0),vt=({state:t,dispatch:e})=>(e(W(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function wt(t,e){let{state:i}=t,n=i.selection,s=i.selection.ranges.slice();for(let n of i.selection.ranges){let r=i.doc.lineAt(n.head);if(e?r.to0)for(let i=n;;){let n=t.moveVertically(i,e);if(n.headr.to){s.some(t=>t.head==n.head)||s.push(n);break}if(n.head==i.head)break;i=n}}return s.length!=n.ranges.length&&(t.dispatch(W(i,o.OF.create(s,s.length-1))),!0)}function bt(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,s=n.changeByRange(n=>{let{from:s,to:r}=n;if(s==r){let o=e(n);os&&(i="delete.forward",o=yt(t,o,!0)),s=Math.min(s,o),r=Math.max(r,o)}else s=yt(t,s,!1),r=yt(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:o.OF.cursor(s,se(t)))n.between(e,e,(t,n)=>{te&&(e=i?n:t)});return e}const xt=(t,e,i)=>bt(t,n=>{let s,r,a=n.from,{state:h}=t,c=h.doc.lineAt(a);if(i&&!e&&a>c.from&&axt(t,!1,!0),Qt=t=>xt(t,!0,!1),kt=(t,e)=>bt(t,i=>{let n=i.head,{state:s}=t,r=s.doc.lineAt(n),a=s.charCategorizer(n);for(let t=null;;){if(n==(e?r.to:r.from)){n==i.head&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let l=(0,o.zK)(r.text,n-r.from,e)+r.from,h=r.text.slice(Math.min(n,l)-r.from,Math.max(n,l)-r.from),c=a(h);if(null!=t&&c!=t)break;" "==h&&n==i.head||(t=c),n=l}return n}),$t=t=>kt(t,!1);function Pt(t){let e=[],i=-1;for(let n of t.selection.ranges){let s=t.doc.lineAt(n.from),r=t.doc.lineAt(n.to);if(n.empty||n.to!=r.from||(r=t.doc.lineAt(n.to-1)),i>=s.number){let t=e[e.length-1];t.to=r.to,t.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});i=r.number+1}return e}function Zt(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Pt(t)){if(i?e.to==t.doc.length:0==e.from)continue;let r=t.doc.lineAt(i?e.to+1:e.from-1),a=r.length+1;if(i){n.push({from:e.to,to:r.to},{from:e.from,insert:r.text+t.lineBreak});for(let i of e.ranges)s.push(o.OF.range(Math.min(t.doc.length,i.anchor+a),Math.min(t.doc.length,i.head+a)))}else{n.push({from:r.from,to:e.from},{from:e.to,insert:t.lineBreak+r.text});for(let t of e.ranges)s.push(o.OF.range(t.anchor-a,t.head-a))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:o.OF.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Tt(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Pt(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});let s=t.changes(n);return e(t.update({changes:s,selection:t.selection.map(s,i?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const At=Ct(!1);function Ct(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:n,to:s}=i,r=e.doc.lineAt(n),a=!t&&n==s&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=(0,l.mv)(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(h.uY.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}(e,n);t&&(n=s=(s<=r.to?r:e.doc.lineAt(s)).to);let c=new l.KB(e,{simulateBreak:n,simulateDoubleBreak:!!a}),u=(0,l._v)(c,n);for(null==u&&(u=(0,o.y$)(/^\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize));sr.from&&n{let s=[];for(let r=n.from;r<=n.to;){let o=t.doc.lineAt(r);o.number>i&&(n.empty||n.to>o.from)&&(e(o,s,n),i=o.number),r=o.to+1}let r=t.changes(s);return{changes:s,range:o.OF.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}const Rt=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Mt(t,(e,i)=>{i.push({from:e.from,insert:t.facet(l.Xt)})}),{userEvent:"input.indent"})),!0),Xt=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Mt(t,(e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=(0,o.y$)(n,t.tabSize),r=0,a=(0,l.EI)(t,Math.max(0,s-(0,l.tp)(t)));for(;rD(t,e=>U(t.state,e,!V(t))),shift:t=>st(t,e=>U(t.state,e,!V(t)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>D(t,e=>U(t.state,e,V(t))),shift:t=>st(t,e=>U(t.state,e,V(t)))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Zt(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Tt(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Zt(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Tt(t,e,!0)},{key:"Mod-Alt-ArrowUp",run:t=>wt(t,!1)},{key:"Mod-Alt-ArrowDown",run:t=>wt(t,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=o.OF.create([i.main]):i.main.empty||(n=o.OF.create([o.OF.cursor(i.main.head)])),!!n&&(e(W(t,n)),!0)}},{key:"Mod-Enter",run:Ct(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Pt(t).map(({from:e,to:i})=>o.OF.range(e,Math.min(i+1,t.doc.length)));return e(t.update({selection:o.OF.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=E(t.selection,e=>{let i=(0,l.mv)(t),n=i.resolveStack(e.from,1);if(e.empty){let t=i.resolveStack(e.from,-1);t.node.from>=n.node.from&&t.node.to<=n.node.to&&(n=t)}for(let t=n;t;t=t.next){let{node:i}=t;if((i.from=e.to||i.to>e.to&&i.from<=e.from)&&t.next)return o.OF.range(i.to,i.from)}return e});return!i.eq(t.selection)&&(e(W(t,i)),!0)},preventDefault:!0},{key:"Mod-[",run:Xt},{key:"Mod-]",run:Rt},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new l.KB(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Mt(t,(e,s,r)=>{let o=(0,l._v)(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],h=(0,l.EI)(t,o);(a!=h||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Pt(e).map(({from:t,to:i})=>(t>0?t--:i{let i;if(t.lineWrapping){let n=t.lineBlockAt(e.head),s=t.coordsAtPos(e.head,e.assoc||1);s&&(i=n.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,i)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,i){let n=!1,s=E(t.selection,e=>{let s=(0,l.jU)(t,e.head,-1)||(0,l.jU)(t,e.head,1)||e.head>0&&(0,l.jU)(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=O(t.state,i.from);return n.line?u(t):!!n.block&&d(t)}},{key:"Alt-A",run:f},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:B,shift:ot,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>N(t,!V(t)),shift:t=>lt(t,!V(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>D(t,e=>nt(t,e,!V(t))),shift:t=>st(t,e=>nt(t,e,!V(t))),preventDefault:!0},{key:"ArrowRight",run:I,shift:at,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>N(t,V(t)),shift:t=>lt(t,V(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>D(t,e=>nt(t,e,V(t))),shift:t=>st(t,e=>nt(t,e,V(t))),preventDefault:!0},{key:"ArrowUp",run:H,shift:ct,preventDefault:!0},{mac:"Cmd-ArrowUp",run:pt,shift:mt},{mac:"Ctrl-ArrowUp",run:et,shift:dt},{key:"ArrowDown",run:K,shift:ut,preventDefault:!0},{mac:"Cmd-ArrowDown",run:gt,shift:vt},{mac:"Ctrl-ArrowDown",run:it,shift:Ot},{key:"PageUp",run:et,shift:dt},{key:"PageDown",run:it,shift:Ot},{key:"Home",run:t=>D(t,e=>nt(t,e,!1)),shift:t=>st(t,e=>nt(t,e,!1)),preventDefault:!0},{key:"Mod-Home",run:pt,shift:mt},{key:"End",run:t=>D(t,e=>nt(t,e,!0)),shift:t=>st(t,e=>nt(t,e,!0)),preventDefault:!0},{key:"Mod-End",run:gt,shift:vt},{key:"Enter",run:At,shift:At},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:St,shift:St,preventDefault:!0},{key:"Delete",run:Qt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$t,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>kt(t,!0),preventDefault:!0},{mac:"Mod-Backspace",run:t=>bt(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:t=>bt(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.headD(t,e=>o.OF.cursor(t.lineBlockAt(e.head).from,1)),shift:t=>st(t,e=>o.OF.cursor(t.lineBlockAt(e.head).from))},{key:"Ctrl-e",run:t=>D(t,e=>o.OF.cursor(t.lineBlockAt(e.head).to,-1)),shift:t=>st(t,e=>o.OF.cursor(t.lineBlockAt(e.head).to))},{key:"Ctrl-d",run:Qt},{key:"Ctrl-h",run:St},{key:"Ctrl-k",run:t=>bt(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head{if(t.readOnly)return!1;let i=t.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:o.EY.of(["",""])},range:o.OF.cursor(t.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),s=i==n.from?i-1:(0,o.zK)(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:(0,o.zK)(n.text,i-n.from,!0)+n.from;return{changes:{from:s,to:r,insert:t.doc.slice(i,r).append(t.doc.slice(s,i))},range:o.OF.cursor(r)}});return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:it}].map(t=>({mac:t.key,run:t.run,shift:t.shift})))),zt={key:"Tab",run:Rt,shift:Xt};var Yt=i(93748);const Lt="function"==typeof String.prototype.normalize?t=>t.normalize("NFKD"):t=>t;class Et{constructor(t,e,i=0,n=t.length,s,r){this.test=r,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=s?t=>s(Lt(t)):Lt,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return(0,o.vS)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=(0,o.MK)(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=(0,o.Fh)(t);let n=this.normalize(e);if(n.length)for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s,this.bufferPos+this.bufferStart);if(t==n.length-1){if(o)return this.value=o,this;break}s==i&&tthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=It(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,e)))return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||n.to<=e){let n=new Vt(e,t.sliceString(e,i));return jt.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:s,from:r}=n;return r>e&&(s=t.sliceString(e,r)+s,r=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,i=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,i,e)))return this.value={from:t,to:i,match:e},this.matchPos=It(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Vt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function It(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}"undefined"!=typeof Symbol&&(qt.prototype[Symbol.iterator]=Bt.prototype[Symbol.iterator]=function(){return this});const Nt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Gt=o.sj.define({combine:t=>(0,o.QR)(t,Nt,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}),Ut=a.NZ.mark({class:"cm-selectionMatch"}),Ft=a.NZ.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ht(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==o.Je.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==o.Je.Word)}const Kt=a.Z9.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Gt),{state:i}=t,n=i.selection;if(n.ranges.length>1)return a.NZ.none;let s,r=n.main,l=null;if(r.empty){if(!e.highlightWordAroundCursor)return a.NZ.none;let t=i.wordAt(r.head);if(!t)return a.NZ.none;l=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return a.NZ.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),l=i.charCategorizer(r.head),!Ht(l,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==o.Je.Word&&t(e.sliceDoc(n-1,n))==o.Je.Word}(l,i,r.from,r.to))return a.NZ.none}else if(s=i.sliceDoc(r.from,r.to),!s)return a.NZ.none}let h=[];for(let n of t.visibleRanges){let t=new Et(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!l||Ht(l,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?h.push(Ft.range(n,s)):(n>=r.to||s<=r.from)&&h.push(Ut.range(n,s)),h.length>e.maxMatches))return a.NZ.none}}return a.NZ.set(h)}},{decorations:t=>t.decorations}),Jt=a.Lz.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),te=o.sj.define({combine:t=>(0,o.QR)(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Te(t),scrollToMatch:t=>a.Lz.scrollIntoView(t)})});class ee{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,Dt),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new le(this):new se(this)}getCursor(t,e=0,i){let n=t.doc?t:o.$t.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?re(this,n,e,i):ne(this,n,e,i)}}class ie{constructor(t){this.spec=t}}function ne(t,e,i,n){let s;var r,a;return t.wholeWord&&(r=e.doc,a=e.charCategorizer(e.selection.main.head),s=(t,e,i,n)=>((n>t||n+i.length{if(i&&!i(n,s,r,o))return!1;let a=n>=o&&s<=o+r.length?r.slice(n-o,s-o):e.doc.sliceString(n,s);return t(a,e,n,s)}}(t.test,e,s)),new Et(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:t=>t.toLowerCase(),s)}class se extends ie{constructor(t){super(t)}nextMatch(t,e,i){let n=ne(this.spec,t,i,t.doc.length).nextOverlapping();if(n.done){let i=Math.min(t.doc.length,e+this.spec.unquoted.length);n=ne(this.spec,t,0,i).nextOverlapping()}return n.done||n.value.from==e&&n.value.to==i?null:n.value}prevMatchInRange(t,e,i){for(let n=i;;){let i=Math.max(e,n-1e4-this.spec.unquoted.length),s=ne(this.spec,t,i,n),r=null;for(;!s.nextOverlapping().done;)r=s.value;if(r)return r;if(i==e)return null;n-=1e4}}prevMatch(t,e,i){let n=this.prevMatchInRange(t,0,e);return n||(n=this.prevMatchInRange(t,Math.max(0,i-this.spec.unquoted.length),t.doc.length)),!n||n.from==e&&n.to==i?null:n}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,e){let i=ne(this.spec,t,0,t.doc.length),n=[];for(;!i.next().done;){if(n.length>=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=ne(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}function re(t,e,i,n){let s;var r;return t.wholeWord&&(r=e.charCategorizer(e.selection.main.head),s=(t,e,i)=>!i[0].length||(r(oe(i.input,i.index))!=o.Je.Word||r(ae(i.input,i.index))!=o.Je.Word)&&(r(ae(i.input,i.index+i[0].length))!=o.Je.Word||r(oe(i.input,i.index+i[0].length))!=o.Je.Word)),t.test&&(s=function(t,e,i){return(n,s,r)=>(!i||i(n,s,r))&&t(r[0],e,n,s)}(t.test,e,s)),new qt(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},i,n)}function oe(t,e){return t.slice((0,o.zK)(t,e,!1),e)}function ae(t,e){return t.slice(e,(0,o.zK)(t,e))}class le extends ie{nextMatch(t,e,i){let n=re(this.spec,t,i,t.doc.length).next();return n.done&&(n=re(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let s=Math.max(e,i-1e4*n),r=re(this.spec,t,s,i),o=null;for(;!r.next().done;)o=r.value;if(o&&(s==e||o.from>s+10))return o;if(s==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(e,i)=>{if("&"==i)return t.match[0];if("$"==i)return"$";for(let e=i.length;e>0;e--){let n=+i.slice(0,e);if(n>0&&n=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=re(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}const he=o.Pe.define(),ce=o.Pe.define(),ue=o.sU.define({create:t=>new fe(Se(t).create(),null),update(t,e){for(let i of e.effects)i.is(he)?t=new fe(i.value.create(),t.panel):i.is(ce)&&(t=new fe(t.query,i.value?xe:null));return t},provide:t=>a.S7.from(t,t=>t.panel)});class fe{constructor(t,e){this.query=t,this.panel=e}}const de=a.NZ.mark({class:"cm-searchMatch"}),Oe=a.NZ.mark({class:"cm-searchMatch cm-searchMatch-selected"}),pe=a.Z9.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(ue))}update(t){let e=t.state.field(ue);(e!=t.startState.field(ue)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return a.NZ.none;let{view:i}=this,n=new o.vB;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,(t,e)=>{let s=i.state.selection.ranges.some(i=>i.from==t&&i.to==e);n.add(t,e,s?Oe:de)})}return n.finish()}},{decorations:t=>t.decorations});function ge(t){return e=>{let i=e.state.field(ue,!1);return i&&i.query.spec.valid?t(e,i):$e(e)}}const me=ge((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=o.OF.single(n.from,n.to),r=t.state.facet(te);return t.dispatch({selection:s,effects:[Me(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),ke(t),!0}),ve=ge((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=o.OF.single(s.from,s.to),a=t.state.facet(te);return t.dispatch({selection:r,effects:[Me(t,s),a.scrollToMatch(r.main,t)],userEvent:"select.search"}),ke(t),!0}),we=ge((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length||(t.dispatch({selection:o.OF.create(i.map(t=>o.OF.range(t.from,t.to))),userEvent:"select.search.matches"}),0))}),be=ge((t,{query:e})=>{let{state:i}=t,{from:n,to:s}=i.selection.main;if(i.readOnly)return!1;let r=e.nextMatch(i,n,n);if(!r)return!1;let l,h,c=r,u=[],f=[];c.from==n&&c.to==s&&(h=i.toText(e.getReplacement(c)),u.push({from:c.from,to:c.to,insert:h}),c=e.nextMatch(i,c.from,c.to),f.push(a.Lz.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+".")));let d=t.state.changes(u);return c&&(l=o.OF.single(c.from,c.to).map(d),f.push(Me(t,c)),f.push(i.facet(te).scrollToMatch(l.main,t))),t.dispatch({changes:d,selection:l,effects:f,userEvent:"input.replace"}),!0}),ye=ge((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(t=>{let{from:i,to:n}=t;return{from:i,to:n,insert:e.getReplacement(t)}});if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:a.Lz.announce.of(n),userEvent:"input.replace.all"}),!0});function xe(t){return t.state.facet(te).createPanel(t)}function Se(t,e){var i,n,s,r,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let h=t.facet(te);return new ee({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:h.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:h.literal,regexp:null!==(r=null==e?void 0:e.regexp)&&void 0!==r?r:h.regexp,wholeWord:null!==(o=null==e?void 0:e.wholeWord)&&void 0!==o?o:h.wholeWord})}function Qe(t){let e=(0,a.ld)(t,xe);return e&&e.dom.querySelector("[main-field]")}function ke(t){let e=Qe(t);e&&e==t.root.activeElement&&e.select()}const $e=t=>{let e=t.state.field(ue,!1);if(e&&e.panel){let i=Qe(t);if(i&&i!=t.root.activeElement){let n=Se(t.state,e.query.spec);n.valid&&t.dispatch({effects:he.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[ce.of(!0),e?he.of(Se(t.state,e.query.spec)):o.Pe.appendConfig.of(Xe)]});return!0},Pe=t=>{let e=t.state.field(ue,!1);if(!e||!e.panel)return!1;let i=(0,a.ld)(t,xe);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ce.of(!1)}),!0},Ze=[{key:"Mod-f",run:$e,scope:"editor search-panel"},{key:"F3",run:me,shift:ve,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:me,shift:ve,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Pe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:s}=i.main,r=[],a=0;for(let e=new Et(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(a=r.length),r.push(o.OF.range(e.value.from,e.value.to))}return e(t.update({selection:o.OF.create(r,a),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:t=>{let{state:e}=t,i=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:s}=(0,a.ui)(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:e.phrase("go")});return s.then(i=>{let s=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!s)return void t.dispatch({effects:n});let r=e.doc.lineAt(e.selection.main.head),[,l,h,c,u]=s,f=c?+c.slice(1):0,d=h?+h:r.number;if(h&&u){let t=d/100;l&&(t=t*("-"==l?-1:1)+r.number/e.doc.lines),d=Math.round(e.doc.lines*t)}else h&&l&&(d=d*("-"==l?-1:1)+r.number);let O=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),p=o.OF.cursor(O.from+Math.max(0,Math.min(f,O.length)));t.dispatch({effects:[n,a.Lz.scrollIntoView(p.from,{y:"center"})],selection:p})}),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(t=>t.from===t.to))return(({state:t,dispatch:e})=>{let{selection:i}=t,n=o.OF.create(i.ranges.map(e=>t.wordAt(e.head)||o.OF.cursor(e.head)),i.mainIndex);return!n.eq(i)&&(e(t.update({selection:n})),!0)})({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(e=>t.sliceDoc(e.from,e.to)!=n))return!1;let s=function(t,e){let{main:i,ranges:n}=t.selection,s=t.wordAt(i.head),r=s&&s.from==i.from&&s.to==i.to;for(let i=!1,s=new Et(t.doc,e,n[n.length-1].to);;){if(s.next(),!s.done){if(i&&n.some(t=>t.from==s.value.from))continue;if(r){let e=t.wordAt(s.value.from);if(!e||e.from!=s.value.from||e.to!=s.value.to)continue}return s.value}if(i)return null;s=new Et(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}}(t,n);return!!s&&(e(t.update({selection:t.selection.addRange(o.OF.range(s.from,s.to),!1),effects:a.Lz.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Te{constructor(t){this.view=t;let e=this.query=t.state.field(ue).query.spec;function i(t,e,i){return(0,Yt.A)("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=(0,Yt.A)("input",{value:e.search,placeholder:Ae(t,"Find"),"aria-label":Ae(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=(0,Yt.A)("input",{value:e.replace,placeholder:Ae(t,"Replace"),"aria-label":Ae(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=(0,Yt.A)("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=(0,Yt.A)("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=(0,Yt.A)("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=(0,Yt.A)("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",()=>me(t),[Ae(t,"next")]),i("prev",()=>ve(t),[Ae(t,"previous")]),i("select",()=>we(t),[Ae(t,"all")]),(0,Yt.A)("label",null,[this.caseField,Ae(t,"match case")]),(0,Yt.A)("label",null,[this.reField,Ae(t,"regexp")]),(0,Yt.A)("label",null,[this.wordField,Ae(t,"by word")]),...t.state.readOnly?[]:[(0,Yt.A)("br"),this.replaceField,i("replace",()=>be(t),[Ae(t,"replace")]),i("replaceAll",()=>ye(t),[Ae(t,"replace all")])],(0,Yt.A)("button",{name:"close",onclick:()=>Pe(t),"aria-label":Ae(t,"close"),type:"button"},["×"])])}commit(){let t=new ee({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:he.of(t)}))}keydown(t){(0,a.TS)(this.view,t,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ve:me)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),be(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(he)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(te).top}}function Ae(t,e){return t.state.phrase(e)}const Ce=/[\s\.,:;?!]/;function Me(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),s=t.state.doc.lineAt(i).to,r=Math.max(n.from,e-30),o=Math.min(s,i+30),l=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;t<30;t++)if(!Ce.test(l[t+1])&&Ce.test(l[t])){l=l.slice(t);break}if(o!=s)for(let t=l.length-1;t>l.length-30;t--)if(!Ce.test(l[t-1])&&Ce.test(l[t])){l=l.slice(0,t);break}return a.Lz.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${n.number}.`)}const Re=a.Lz.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Xe=[ue,o.Nb.low(pe),Re];var _e=i(47404);class ze{constructor(t,e,i){this.from=t,this.to=e,this.diagnostic=i}}class Ye{constructor(t,e,i){this.diagnostics=t,this.panel=e,this.selected=i}static init(t,e,i){let n=i.facet(Ge).markerFilter;n&&(t=n(t,i));let s=t.slice().sort((t,e)=>t.from-e.from||t.to-e.to),r=new o.vB,l=[],h=0,c=i.doc.iter(),u=0,f=i.doc.length;for(let t=0;;){let e,i,n=t==s.length?null:s[t];if(!n&&!l.length)break;if(l.length)e=h,i=l.reduce((t,e)=>Math.min(t,e.to),n&&n.from>e?n.from:1e8);else{if(e=n.from,e>f)break;i=n.to,l.push(n),t++}for(;tn.from||n.to==e)){i=Math.min(n.from,i);break}l.push(n),t++,i=Math.min(n.to,i)}i=Math.min(i,f);let o=!1;if(l.some(t=>t.from==e&&(t.to==i||i==f))&&(o=e==i,!o&&i-e<10)){let t=e-(u+c.value.length);t>0&&(c.next(t),u=e);for(let t=e;;){if(t>=i){o=!0;break}if(!c.lineBreak&&u+c.value.length>t)break;t=u+c.value.length,u+=c.value.length,c.next()}}let d=si(l);if(o)r.add(e,e,a.NZ.widget({widget:new Ke(d),diagnostics:l.slice()}));else{let t=l.reduce((t,e)=>e.markClass?t+" "+e.markClass:t,"");r.add(e,i,a.NZ.mark({class:"cm-lintRange cm-lintRange-"+d+t,diagnostics:l.slice(),inclusiveEnd:l.some(t=>t.to>i)}))}if(h=i,h==f)break;for(let t=0;t{if(!(e&&s.diagnostics.indexOf(e)<0))if(n){if(s.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new ze(n.from,i,n.diagnostic)}else n=new ze(t,i,e||s.diagnostics[0])}),n}const Ee=o.Pe.define(),We=o.Pe.define(),De=o.Pe.define(),qe=o.sU.define({create:()=>new Ye(a.NZ.none,null,null),update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),n=null,s=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);n=Le(i,t.selected.diagnostic,s)||Le(i,null,s)}!i.size&&s&&e.state.facet(Ge).autoPanel&&(s=null),t=new Ye(i,s,n)}for(let i of e.effects)if(i.is(Ee)){let n=e.state.facet(Ge).autoPanel?i.value.length?ti.open:null:t.panel;t=Ye.init(i.value,n,e.state)}else i.is(We)?t=new Ye(t.diagnostics,i.value?ti.open:null,t.selected):i.is(De)&&(t=new Ye(t.diagnostics,t.panel,i.value));return t},provide:t=>[a.S7.from(t,t=>t.panel),a.Lz.decorations.from(t,t=>t.diagnostics)]}),je=a.NZ.mark({class:"cm-lintRange cm-lintRange-active"});function Ve(t,e,i){let n,{diagnostics:s}=t.state.field(qe),r=-1,o=-1;s.between(e-(i<0?1:0),e+(i>0?1:0),(t,s,{spec:a})=>{if(e>=t&&e<=s&&(t==s||(e>t||i>0)&&(e({dom:Be(t,n)})}:null}function Be(t,e){return(0,Yt.A)("ul",{class:"cm-tooltip-lint"},e.map(e=>He(t,e,!1)))}const Ie=t=>{let e=t.state.field(qe,!1);return!(!e||!e.panel||(t.dispatch({effects:We.of(!1)}),0))},Ne=[{key:"Mod-Shift-m",run:t=>{let e=t.state.field(qe,!1);var i,n;e&&e.panel||t.dispatch({effects:(i=t.state,n=[We.of(!0)],i.field(qe,!1)?n:n.concat(o.Pe.appendConfig.of(ri)))});let s=(0,a.ld)(t,ti.open);return s&&s.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(qe,!1);if(!e)return!1;let i=t.state.selection.main,n=Le(e.diagnostics,null,i.to+1);return!(!n&&(n=Le(e.diagnostics,null,0),!n||n.from==i.from&&n.to==i.to)||(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),0))}}],Ge=o.sj.define({combine:t=>({sources:t.map(t=>t.source).filter(t=>null!=t),...(0,o.QR)(t.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ue,tooltipFilter:Ue,needsRefresh:(t,e)=>t?e?i=>t(i)||e(i):t:e,hideOn:(t,e)=>t?e?(i,n,s)=>t(i,n,s)||e(i,n,s):t:e,autoPanel:(t,e)=>t||e})})});function Ue(t,e){return t?e?(i,n)=>e(t(i,n),n):t:e}function Fe(t){let e=[];if(t)t:for(let{name:i}of t){for(let t=0;tt.toLowerCase()==n.toLowerCase())){e.push(n);continue t}}e.push("")}return e}function He(t,e,i){var n;let s=i?Fe(e.actions):[];return(0,Yt.A)("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},(0,Yt.A)("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(n=e.actions)||void 0===n?void 0:n.map((i,n)=>{let r=!1,o=n=>{if(n.preventDefault(),r)return;r=!0;let s=Le(t.state.field(qe).diagnostics,e);s&&i.apply(t,s.from,s.to)},{name:a}=i,l=s[n]?a.indexOf(s[n]):-1,h=l<0?a:[a.slice(0,l),(0,Yt.A)("u",a.slice(l,l+1)),a.slice(l+1)],c=i.markClass?" "+i.markClass:"";return(0,Yt.A)("button",{type:"button",class:"cm-diagnosticAction"+c,onclick:o,onmousedown:o,"aria-label":` Action: ${a}${l<0?"":` (access key "${s[n]})"`}.`},h)}),e.source&&(0,Yt.A)("div",{class:"cm-diagnosticSource"},e.source))}class Ke extends a.xO{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return(0,Yt.A)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Je{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=He(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ti{constructor(t){this.view=t,this.items=[],this.list=(0,Yt.A)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e=>{if(!(e.ctrlKey||e.altKey||e.metaKey)){if(27==e.keyCode)Ie(this.view),this.view.focus();else if(38==e.keyCode||33==e.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==e.keyCode||34==e.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==e.keyCode)this.moveSelection(0);else if(35==e.keyCode)this.moveSelection(this.items.length-1);else if(13==e.keyCode)this.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:i}=this.items[this.selectedIndex],n=Fe(i.actions);for(let s=0;s{for(let e=0;eIe(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(qe).selected;if(!t)return-1;for(let e=0;e{for(let t of a.diagnostics){if(r.has(t))continue;r.add(t);let o,a=-1;for(let e=i;ei&&(this.items.splice(i,a-i),n=!0)),e&&o.diagnostic==e.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),s=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),i++}});i({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:t,panel:e})=>{let i=e.height/this.list.offsetHeight;t.tope.bottom&&(this.list.scrollTop+=(t.bottom-e.bottom)/i)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let e=t;t=e.nextSibling,e.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;t!=i.dom;)e();t=i.dom.nextSibling}else this.list.insertBefore(i.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=Le(this.view.state.field(qe).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:De.of(e)})}static open(t){return new ti(t)}}function ei(t){return function(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}(``,'width="6" height="3"')}const ii=a.Lz.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ei("#d11")},".cm-lintRange-warning":{backgroundImage:ei("orange")},".cm-lintRange-info":{backgroundImage:ei("#999")},".cm-lintRange-hint":{backgroundImage:ei("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function ni(t){return"error"==t?4:"warning"==t?3:"info"==t?2:1}function si(t){let e="hint",i=1;for(let n of t){let t=ni(n.severity);t>i&&(i=t,e=n.severity)}return e}a.wJ;const ri=[qe,a.Lz.decorations.compute([qe],t=>{let{selected:e,panel:i}=t.field(qe);return e&&i&&e.from!=e.to?a.NZ.set([je.range(e.from,e.to)]):a.NZ.none}),(0,a.Ux)(Ve,{hideOn:function(t,e){let i=e.pos,n=e.end||i,s=t.state.facet(Ge).hideOn(t,i,n);if(null!=s)return s;let r=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(t=>t.is(Ee))&&!t.changes.touchesRange(r.from,Math.max(r.to,n)))}}),ii];var oi=function(t){void 0===t&&(t={});var{crosshairCursor:e=!1}=t,i=[];!1!==t.closeBracketsKeymap&&(i=i.concat(_e.Bc)),!1!==t.defaultKeymap&&(i=i.concat(_t)),!1!==t.searchKeymap&&(i=i.concat(Ze)),!1!==t.historyKeymap&&(i=i.concat(L)),!1!==t.foldKeymap&&(i=i.concat(l.f7)),!1!==t.completionKeymap&&(i=i.concat(_e.OO)),!1!==t.lintKeymap&&(i=i.concat(Ne));var n=[];return!1!==t.lineNumbers&&n.push((0,a.$K)()),!1!==t.highlightActiveLineGutter&&n.push((0,a.Wu)()),!1!==t.highlightSpecialChars&&n.push((0,a.N$)()),!1!==t.history&&n.push(x()),!1!==t.foldGutter&&n.push((0,l.Lv)()),!1!==t.drawSelection&&n.push((0,a.VH)()),!1!==t.dropCursor&&n.push((0,a.A)()),!1!==t.allowMultipleSelections&&n.push(o.$t.allowMultipleSelections.of(!0)),!1!==t.indentOnInput&&n.push((0,l.WD)()),!1!==t.syntaxHighlighting&&n.push((0,l.y9)(l.Zt,{fallback:!0})),!1!==t.bracketMatching&&n.push((0,l.SG)()),!1!==t.closeBrackets&&n.push((0,_e.wm)()),!1!==t.autocompletion&&n.push((0,_e.yU)()),!1!==t.rectangularSelection&&n.push((0,a.D4)()),!1!==e&&n.push((0,a.HJ)()),!1!==t.highlightActiveLine&&n.push((0,a.dz)()),!1!==t.highlightSelectionMatches&&n.push(function(){let t=[Jt,Kt];return t}()),t.tabSize&&"number"==typeof t.tabSize&&n.push(l.Xt.of(" ".repeat(t.tabSize))),n.concat([a.w4.of(i.flat())]).filter(Boolean)},ai=function(t){void 0===t&&(t={});var e=[];!1!==t.defaultKeymap&&(e=e.concat(_t)),!1!==t.historyKeymap&&(e=e.concat(L));var i=[];return!1!==t.highlightSpecialChars&&i.push((0,a.N$)()),!1!==t.history&&i.push(x()),!1!==t.drawSelection&&i.push((0,a.VH)()),!1!==t.syntaxHighlighting&&i.push((0,l.y9)(l.Zt,{fallback:!0})),i.concat([a.w4.of(e.flat())]).filter(Boolean)},li=i(43720);const hi="#e5c07b",ci="#e06c75",ui="#56b6c2",fi="#ffffff",di="#abb2bf",Oi="#7d8799",pi="#61afef",gi="#98c379",mi="#d19a66",vi="#c678dd",wi="#21252b",bi="#2c313a",yi="#282c34",xi="#353a42",Si="#3E4451",Qi="#528bff",ki={chalky:hi,coral:ci,cyan:ui,invalid:fi,ivory:di,stone:Oi,malibu:pi,sage:gi,whiskey:mi,violet:vi,darkBackground:wi,highlightBackground:bi,background:yi,tooltipBackground:xi,selection:Si,cursor:Qi},$i=a.Lz.theme({"&":{color:di,backgroundColor:yi},".cm-content":{caretColor:Qi},".cm-cursor, .cm-dropCursor":{borderLeftColor:Qi},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Si},".cm-panels":{backgroundColor:wi,color:di},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:yi,color:Oi,border:"none"},".cm-activeLineGutter":{backgroundColor:bi},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:xi},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:xi,borderBottomColor:xi},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:bi,color:di}}},{dark:!0}),Pi=l.cr.define([{tag:li._A.keyword,color:vi},{tag:[li._A.name,li._A.deleted,li._A.character,li._A.propertyName,li._A.macroName],color:ci},{tag:[li._A.function(li._A.variableName),li._A.labelName],color:pi},{tag:[li._A.color,li._A.constant(li._A.name),li._A.standard(li._A.name)],color:mi},{tag:[li._A.definition(li._A.name),li._A.separator],color:di},{tag:[li._A.typeName,li._A.className,li._A.number,li._A.changed,li._A.annotation,li._A.modifier,li._A.self,li._A.namespace],color:hi},{tag:[li._A.operator,li._A.operatorKeyword,li._A.url,li._A.escape,li._A.regexp,li._A.link,li._A.special(li._A.string)],color:ui},{tag:[li._A.meta,li._A.comment],color:Oi},{tag:li._A.strong,fontWeight:"bold"},{tag:li._A.emphasis,fontStyle:"italic"},{tag:li._A.strikethrough,textDecoration:"line-through"},{tag:li._A.link,color:Oi,textDecoration:"underline"},{tag:li._A.heading,fontWeight:"bold",color:ci},{tag:[li._A.atom,li._A.bool,li._A.special(li._A.variableName)],color:mi},{tag:[li._A.processingInstruction,li._A.string,li._A.inserted],color:gi},{tag:li._A.invalid,color:fi}]),Zi=[$i,(0,l.y9)(Pi)];var Ti=a.Lz.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Ai=function(t){void 0===t&&(t={});var{indentWithTab:e=!0,editable:i=!0,readOnly:n=!1,theme:s="light",placeholder:r="",basicSetup:l=!0}=t,h=[];switch(e&&h.unshift(a.w4.of([zt])),l&&("boolean"==typeof l?h.unshift(oi()):h.unshift(oi(l))),r&&h.unshift((0,a.qf)(r)),s){case"light":h.push(Ti);break;case"dark":h.push(Zi);break;case"none":break;default:h.push(s)}return!1===i&&h.push(a.Lz.editable.of(!1)),n&&h.push(o.$t.readOnly.of(!0)),[...h]},Ci=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(t=>!t.empty)});class Mi{constructor(t,e){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=e,this.timeoutMS=e,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(t=>{try{t()}catch(t){console.error("TimeoutLatch callback error:",t)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class Ri{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var Xi=null,_i=o.YH.define(),zi=[];function Yi(t){var{value:e,selection:i,onChange:n,onStatistics:s,onCreateEditor:l,onUpdate:h,extensions:c=zi,autoFocus:u,theme:f="light",height:d=null,minHeight:O=null,maxHeight:p=null,width:g=null,minWidth:m=null,maxWidth:v=null,placeholder:w="",editable:b=!0,readOnly:y=!1,indentWithTab:x=!0,basicSetup:S=!0,root:Q,initialState:k}=t,[$,P]=(0,r.useState)(),[Z,T]=(0,r.useState)(),[A,C]=(0,r.useState)(),M=(0,r.useState)(()=>({current:null}))[0],R=(0,r.useState)(()=>({current:null}))[0],X=a.Lz.theme({"&":{height:d,minHeight:O,maxHeight:p,width:g,minWidth:m,maxWidth:v},"& .cm-scroller":{height:"100% !important"}}),_=[a.Lz.updateListener.of(t=>{if(t.docChanged&&"function"==typeof n&&!t.transactions.some(t=>t.annotation(_i))){M.current?M.current.reset():(M.current=new Mi(()=>{if(R.current){var t=R.current;R.current=null,t()}M.current=null},200),("undefined"==typeof window?new Ri:(Xi||(Xi=new Ri),Xi)).add(M.current));var e=t.state.doc.toString();n(e,t)}s&&s(Ci(t))}),X,...Ai({theme:f,editable:b,readOnly:y,placeholder:w,indentWithTab:x,basicSetup:S})];return h&&"function"==typeof h&&_.push(a.Lz.updateListener.of(h)),_=_.concat(c),(0,r.useLayoutEffect)(()=>{if($&&!A){var t={doc:e,selection:i,extensions:_},n=k?o.$t.fromJSON(k.json,t,k.fields):o.$t.create(t);if(C(n),!Z){var s=new a.Lz({state:n,parent:$,root:Q});T(s),l&&l(s,n)}}return()=>{Z&&(C(void 0),T(void 0))}},[$,A]),(0,r.useEffect)(()=>{t.container&&P(t.container)},[t.container]),(0,r.useEffect)(()=>()=>{Z&&(Z.destroy(),T(void 0)),M.current&&(M.current.cancel(),M.current=null)},[Z]),(0,r.useEffect)(()=>{u&&Z&&Z.focus()},[u,Z]),(0,r.useEffect)(()=>{Z&&Z.dispatch({effects:o.Pe.reconfigure.of(_)})},[f,c,d,O,p,g,m,v,w,b,y,x,S,n,h]),(0,r.useEffect)(()=>{if(void 0!==e){var t=Z?Z.state.doc.toString():"";if(Z&&e!==t){var i=()=>{Z&&e!==Z.state.doc.toString()&&Z.dispatch({changes:{from:0,to:Z.state.doc.toString().length,insert:e||""},annotations:[_i.of(!0)]})};M.current&&!M.current.isDone?R.current=i:i()}}},[e,Z]),{state:A,setState:C,view:Z,setView:T,container:$,setContainer:P}}var Li=i(10790),Ei=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Wi=(0,r.forwardRef)((t,e)=>{var{className:i,value:o="",selection:a,extensions:l=[],onChange:h,onStatistics:c,onCreateEditor:u,onUpdate:f,autoFocus:d,theme:O="light",height:p,minHeight:g,maxHeight:m,width:v,minWidth:w,maxWidth:b,basicSetup:y,placeholder:x,indentWithTab:S,editable:Q,readOnly:k,root:$,initialState:P}=t,Z=(0,s.A)(t,Ei),T=(0,r.useRef)(null),{state:A,view:C,container:M,setContainer:R}=Yi({root:$,value:o,autoFocus:d,theme:O,height:p,minHeight:g,maxHeight:m,width:v,minWidth:w,maxWidth:b,basicSetup:y,placeholder:x,indentWithTab:S,editable:Q,readOnly:k,selection:a,onChange:h,onStatistics:c,onCreateEditor:u,onUpdate:f,extensions:l,initialState:P});(0,r.useImperativeHandle)(e,()=>({editor:T.current,state:A,view:C}),[T,M,A,C]);var X=(0,r.useCallback)(t=>{T.current=t,R(t)},[R]);if("string"!=typeof o)throw new Error("value must be typeof string but got "+typeof o);var _="string"==typeof O?"cm-theme-"+O:"cm-theme";return(0,Li.jsx)("div",(0,n.A)({ref:X,className:_+(i?" "+i:"")},Z))});Wi.displayName="CodeMirror";const Di=Wi},93748(t,e,i){function n(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];"string"==typeof r?t.setAttribute(n,r):null!=r&&(t[n]=r)}e++}for(;en})},97417(t,e,i){i.d(e,{G:()=>o});const n="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),s="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class o{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,e,r,o){let a=[],l=/^@(\w+)\b/.exec(t[0]),h=l&&"keyframes"==l[1];if(l&&null==e)return r.push(t[0]+";");for(let i in e){let o=e[i];if(/&/.test(i))s(i.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((t,e)=>t.concat(e)),o,r);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,t=>"-"+t.toLowerCase())+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=r[n]||1;return r[n]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[s],r=i&&i.nonce;n?r&&n.setNonce(r):n=new l(t,r),n.mount(Array.isArray(e)?e:[e],t)}}let a=new Map;class l{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=a.get(i);if(e)return t[s]=e;this.sheet=new n.CSSStyleSheet,a.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[s]=this}mount(t,e){let i=this.sheet,n=0,s=0;for(let e=0;e-1&&(this.modules.splice(o,1),s--,o=-1),-1==o){if(this.modules.splice(s++,0,r),i)for(let t=0;t