diff --git a/assets/index-cec18d30.js b/assets/index-6a83c016.js similarity index 80% rename from assets/index-cec18d30.js rename to assets/index-6a83c016.js index 9c2a799..4df0f66 100644 --- a/assets/index-cec18d30.js +++ b/assets/index-6a83c016.js @@ -1,4 +1,4 @@ -var Yn=Object.defineProperty;var Dn=(s,e,r)=>e in s?Yn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var Se=(s,e,r)=>(Dn(s,typeof e!="symbol"?e+"":e,r),r),zr=(s,e,r)=>{if(!e.has(s))throw TypeError("Cannot "+r)};var N=(s,e,r)=>(zr(s,e,"read from private field"),r?r.call(s):e.get(s)),rt=(s,e,r)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,r)},Ue=(s,e,r,n)=>(zr(s,e,"write to private field"),n?n.call(s,r):e.set(s,r),r);var xr=(s,e,r,n)=>({set _(o){Ue(s,e,o,r)},get _(){return N(s,e,n)}}),_e=(s,e,r)=>(zr(s,e,"access private method"),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();const output="",style="";class Text{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,r,n){let o=[];return this.decompose(0,e,o,2),n.length&&n.decompose(0,n.length,o,3),this.decompose(r,this.length,o,1),TextNode.from(o,this.length-(r-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,r=this.length){let n=[];return this.decompose(e,r,n,0),TextNode.from(n,r-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let r=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),o=new RawTextCursor(this),a=new RawTextCursor(e);for(let l=r,c=r;;){if(o.next(l),a.next(l),l=0,o.lineBreak!=a.lineBreak||o.done!=a.done||o.value!=a.value)return!1;if(c+=o.value.length,o.done||c>=n)return!0}}iter(e=1){return new RawTextCursor(this,e)}iterRange(e,r=this.length){return new PartialTextCursor(this,e,r)}iterLines(e,r){let n;if(e==null)n=this.iter();else{r==null&&(r=this.lines+1);let o=this.line(e).from;n=this.iterRange(o,Math.max(o,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new LineCursor(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Text.empty:e.length<=32?new TextLeaf(e):TextNode.from(TextLeaf.split(e,[]))}}class TextLeaf extends Text{constructor(e,r=textLength(e)){super(),this.text=e,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(e,r,n,o){for(let a=0;;a++){let l=this.text[a],c=o+l.length;if((r?n:c)>=e)return new Line$1(o,c,n,l);o=c+1,n++}}decompose(e,r,n,o){let a=e<=0&&r>=this.length?this:new TextLeaf(sliceText(this.text,e,r),Math.min(r,this.length)-Math.max(0,e));if(o&1){let l=n.pop(),c=appendText(a.text,l.text.slice(),0,a.length);if(c.length<=32)n.push(new TextLeaf(c,l.length+a.length));else{let h=c.length>>1;n.push(new TextLeaf(c.slice(0,h)),new TextLeaf(c.slice(h)))}}else n.push(a)}replace(e,r,n){if(!(n instanceof TextLeaf))return super.replace(e,r,n);let o=appendText(this.text,appendText(n.text,sliceText(this.text,0,e)),r),a=this.length+n.length-(r-e);return o.length<=32?new TextLeaf(o,a):TextNode.from(TextLeaf.split(o,[]),a)}sliceString(e,r=this.length,n=` +var Yn=Object.defineProperty;var Dn=(s,e,r)=>e in s?Yn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var z=(s,e,r)=>(Dn(s,typeof e!="symbol"?e+"":e,r),r),zr=(s,e,r)=>{if(!e.has(s))throw TypeError("Cannot "+r)};var N=(s,e,r)=>(zr(s,e,"read from private field"),r?r.call(s):e.get(s)),rt=(s,e,r)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,r)},Ue=(s,e,r,n)=>(zr(s,e,"write to private field"),n?n.call(s,r):e.set(s,r),r);var xr=(s,e,r,n)=>({set _(o){Ue(s,e,o,r)},get _(){return N(s,e,n)}}),_e=(s,e,r)=>(zr(s,e,"access private method"),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();const output="",style="";class Text{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,r,n){let o=[];return this.decompose(0,e,o,2),n.length&&n.decompose(0,n.length,o,3),this.decompose(r,this.length,o,1),TextNode.from(o,this.length-(r-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,r=this.length){let n=[];return this.decompose(e,r,n,0),TextNode.from(n,r-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let r=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),o=new RawTextCursor(this),a=new RawTextCursor(e);for(let l=r,c=r;;){if(o.next(l),a.next(l),l=0,o.lineBreak!=a.lineBreak||o.done!=a.done||o.value!=a.value)return!1;if(c+=o.value.length,o.done||c>=n)return!0}}iter(e=1){return new RawTextCursor(this,e)}iterRange(e,r=this.length){return new PartialTextCursor(this,e,r)}iterLines(e,r){let n;if(e==null)n=this.iter();else{r==null&&(r=this.lines+1);let o=this.line(e).from;n=this.iterRange(o,Math.max(o,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new LineCursor(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Text.empty:e.length<=32?new TextLeaf(e):TextNode.from(TextLeaf.split(e,[]))}}class TextLeaf extends Text{constructor(e,r=textLength(e)){super(),this.text=e,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(e,r,n,o){for(let a=0;;a++){let l=this.text[a],c=o+l.length;if((r?n:c)>=e)return new Line$1(o,c,n,l);o=c+1,n++}}decompose(e,r,n,o){let a=e<=0&&r>=this.length?this:new TextLeaf(sliceText(this.text,e,r),Math.min(r,this.length)-Math.max(0,e));if(o&1){let l=n.pop(),c=appendText(a.text,l.text.slice(),0,a.length);if(c.length<=32)n.push(new TextLeaf(c,l.length+a.length));else{let h=c.length>>1;n.push(new TextLeaf(c.slice(0,h)),new TextLeaf(c.slice(h)))}}else n.push(a)}replace(e,r,n){if(!(n instanceof TextLeaf))return super.replace(e,r,n);let o=appendText(this.text,appendText(n.text,sliceText(this.text,0,e)),r),a=this.length+n.length-(r-e);return o.length<=32?new TextLeaf(o,a):TextNode.from(TextLeaf.split(o,[]),a)}sliceString(e,r=this.length,n=` `){let o="";for(let a=0,l=0;a<=r&&le&&l&&(o+=n),ea&&(o+=c.slice(Math.max(0,e-a),r-a)),a=h+1}return o}flatten(e){for(let r of this.text)e.push(r)}scanIdentical(){return 0}static split(e,r){let n=[],o=-1;for(let a of e)n.push(a),o+=a.length+1,n.length==32&&(r.push(new TextLeaf(n,o)),n=[],o=-1);return o>-1&&r.push(new TextLeaf(n,o)),r}}class TextNode extends Text{constructor(e,r){super(),this.children=e,this.length=r,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,r,n,o){for(let a=0;;a++){let l=this.children[a],c=o+l.length,h=n+l.lines-1;if((r?h:c)>=e)return l.lineInner(e,r,n,o);o=c+1,n=h+1}}decompose(e,r,n,o){for(let a=0,l=0;l<=r&&a=l){let f=o&((l<=e?1:0)|(h>=r?2:0));l>=e&&h<=r&&!f?n.push(c):c.decompose(e-l,r-l,n,f)}l=h+1}}replace(e,r,n){if(n.lines=a&&r<=c){let h=l.replace(e-a,r-a,n),f=this.lines-l.lines+h.lines;if(h.lines>5-1&&h.lines>f>>5+1){let d=this.children.slice();return d[o]=h,new TextNode(d,this.length-(r-e)+n.length)}return super.replace(a,c,h)}a=c+1}return super.replace(e,r,n)}sliceString(e,r=this.length,n=` `){let o="";for(let a=0,l=0;ae&&a&&(o+=n),el&&(o+=c.sliceString(e-l,r-l,n)),l=h+1}return o}flatten(e){for(let r of this.children)r.flatten(e)}scanIdentical(e,r){if(!(e instanceof TextNode))return 0;let n=0,[o,a,l,c]=r>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;o+=r,a+=r){if(o==l||a==c)return n;let h=this.children[o],f=e.children[a];if(h!=f)return n+h.scanIdentical(f,r);n+=h.length+1}}static from(e,r=e.reduce((n,o)=>n+o.length+1,-1)){let n=0;for(let A of e)n+=A.lines;if(n<32){let A=[];for(let T of e)T.flatten(A);return new TextLeaf(A,r)}let o=Math.max(32,n>>5),a=o<<1,l=o>>1,c=[],h=0,f=-1,d=[];function m(A){let T;if(A.lines>a&&A instanceof TextNode)for(let B of A.children)m(B);else A.lines>l&&(h>l||!h)?(v(),c.push(A)):A instanceof TextLeaf&&h&&(T=d[d.length-1])instanceof TextLeaf&&A.lines+T.lines<=32?(h+=A.lines,f+=A.length+1,d[d.length-1]=new TextLeaf(T.text.concat(A.text),T.length+1+A.length)):(h+A.lines>o&&v(),h+=A.lines,f+=A.length+1,d.push(A))}function v(){h!=0&&(c.push(d.length==1?d[0]:TextNode.from(d,f)),f=-1,h=d.length=0)}for(let A of e)m(A);return v(),c.length==1?c[0]:new TextNode(c,r)}}Text.empty=new TextLeaf([""],0);function textLength(s){let e=-1;for(let r of s)e+=r.length+1;return e}function appendText(s,e,r=0,n=1e9){for(let o=0,a=0,l=!0;a=r&&(h>n&&(c=c.slice(0,n-o)),o0?1:(e instanceof TextLeaf?e.text.length:e.children.length)<<1]}nextInner(e,r){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,o=this.nodes[n],a=this.offsets[n],l=a>>1,c=o instanceof TextLeaf?o.text.length:o.children.length;if(l==(r>0?c:0)){if(n==0)return this.done=!0,this.value="",this;r>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(r>0?0:1)){if(this.offsets[n]+=r,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(o instanceof TextLeaf){let h=o.text[l+(r<0?-1:0)];if(this.offsets[n]+=r,h.length>Math.max(0,e))return this.value=e==0?h:r>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=o.children[l+(r<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=r):(r<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(r>0?1:(h instanceof TextLeaf?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class PartialTextCursor{constructor(e,r,n){this.value="",this.done=!1,this.cursor=new RawTextCursor(e,r>n?-1:1),this.pos=r>n?e.length:0,this.from=Math.min(r,n),this.to=Math.max(r,n)}nextInner(e,r){if(r<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,r<0?this.pos-this.to:this.from-this.pos);let n=r<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:o}=this.cursor.next(e);return this.pos+=(o.length+e)*r,this.value=o.length<=n?o:r<0?o.slice(o.length-n):o.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class LineCursor{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:r,lineBreak:n,value:o}=this.inner.next(e);return r?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Text.prototype[Symbol.iterator]=function(){return this.iter()},RawTextCursor.prototype[Symbol.iterator]=PartialTextCursor.prototype[Symbol.iterator]=LineCursor.prototype[Symbol.iterator]=function(){return this});let Line$1=class{constructor(e,r,n,o){this.from=e,this.to=r,this.number=n,this.text=o}get length(){return this.to-this.from}},extend="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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s,36):1);for(let s=1;ss)return extend[e-1]<=s;return!1}function isRegionalIndicator(s){return s>=127462&&s<=127487}const ZWJ=8205;function findClusterBreak(s,e,r=!0,n=!0){return(r?nextClusterBreak:prevClusterBreak)(s,e,n)}function nextClusterBreak(s,e,r){if(e==s.length)return e;e&&surrogateLow(s.charCodeAt(e))&&surrogateHigh(s.charCodeAt(e-1))&&e--;let n=codePointAt(s,e);for(e+=codePointSize(n);e=0&&isRegionalIndicator(codePointAt(s,l));)a++,l-=2;if(a%2==0)break;e+=2}else break}return e}function prevClusterBreak(s,e,r){for(;e>0;){let n=nextClusterBreak(s,e-2,r);if(n=56320&&s<57344}function surrogateHigh(s){return s>=55296&&s<56320}function codePointAt(s,e){let r=s.charCodeAt(e);if(!surrogateHigh(r)||e+1==s.length)return r;let n=s.charCodeAt(e+1);return surrogateLow(n)?(r-55296<<10)+(n-56320)+65536:r}function fromCodePoint(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function codePointSize(s){return s<65536?1:2}const DefaultSplit=/\r\n?|\n/;var MapMode=function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s}(MapMode||(MapMode={}));class ChangeDesc{constructor(e){this.sections=e}get length(){let e=0;for(let r=0;re)return a+(e-o);a+=c}else{if(n!=MapMode.Simple&&f>=e&&(n==MapMode.TrackDel&&oe||n==MapMode.TrackBefore&&oe))return null;if(f>e||f==e&&r<0&&!c)return e==o||r<0?a:a+h;a+=h}o=f}if(e>o)throw new RangeError(`Position ${e} is out of range for changeset of length ${o}`);return a}touchesRange(e,r=e){for(let n=0,o=0;n=0&&o<=r&&c>=e)return or?"cover":!0;o=c}return!1}toString(){let e="";for(let r=0;r=0?":"+o:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(r=>typeof r!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ChangeDesc(e)}static create(e){return new ChangeDesc(e)}}class ChangeSet extends ChangeDesc{constructor(e,r){super(e),this.inserted=r}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return iterChanges(this,(r,n,o,a,l)=>e=e.replace(o,o+(n-r),l),!1),e}mapDesc(e,r=!1){return mapSet(this,e,r,!0)}invert(e){let r=this.sections.slice(),n=[];for(let o=0,a=0;o=0){r[o]=c,r[o+1]=l;let h=o>>1;for(;n.length0&&addInsert(n,r,a.text),a.forward(d),c+=d}let f=e[l++];for(;c>1].toJSON()))}return e}static of(e,r,n){let o=[],a=[],l=0,c=null;function h(d=!1){if(!d&&!o.length)return;lv||m<0||v>r)throw new RangeError(`Invalid change range ${m} to ${v} (in doc of length ${r})`);let T=A?typeof A=="string"?Text.of(A.split(n||DefaultSplit)):A:Text.empty,B=T.length;if(m==v&&B==0)return;ml&&addSection(o,m-l,-1),addSection(o,v-m,B),addInsert(a,o,T),l=v}}return f(e),h(!c),c}static empty(e){return new ChangeSet(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let r=[],n=[];for(let o=0;oc&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)r.push(a[0],0);else{for(;n.length=0&&r<=0&&r==s[o+1]?s[o]+=e:e==0&&s[o]==0?s[o+1]+=r:n?(s[o]+=e,s[o+1]+=r):s.push(e,r)}function addInsert(s,e,r){if(r.length==0)return;let n=e.length-2>>1;if(n>1])),!(r||l==s.sections.length||s.sections[l+1]<0);)c=s.sections[l++],h=s.sections[l++];e(o,f,a,d,m),o=f,a=d}}}function mapSet(s,e,r,n=!1){let o=[],a=n?[]:null,l=new SectionIter(s),c=new SectionIter(e);for(let h=-1;;)if(l.ins==-1&&c.ins==-1){let f=Math.min(l.len,c.len);addSection(o,f,-1),l.forward(f),c.forward(f)}else if(c.ins>=0&&(l.ins<0||h==l.i||l.off==0&&(c.len=0&&h=0){let f=0,d=l.len;for(;d;)if(c.ins==-1){let m=Math.min(d,c.len);f+=m,d-=m,c.forward(m)}else if(c.ins==0&&c.lenh||l.ins>=0&&l.len>h)&&(c||n.length>f),a.forward2(h),l.forward(h)}}}}class SectionIter{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return r>=e.length?Text.empty:e[r]}textBit(e){let{inserted:r}=this.set,n=this.i-2>>1;return n>=r.length&&!e?Text.empty:r[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class SelectionRange{constructor(e,r,n){this.from=e,this.to=r,this.flags=n}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,r=-1){let n,o;return this.empty?n=o=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),o=e.mapPos(this.to,-1)),n==this.from&&o==this.to?this:new SelectionRange(n,o,this.flags)}extend(e,r=e){if(e<=this.anchor&&r>=this.anchor)return EditorSelection.range(e,r);let n=Math.abs(e-this.anchor)>Math.abs(r-this.anchor)?e:r;return EditorSelection.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return EditorSelection.range(e.anchor,e.head)}static create(e,r,n){return new SelectionRange(e,r,n)}}class EditorSelection{constructor(e,r){this.ranges=e,this.mainIndex=r}map(e,r=-1){return e.empty?this:EditorSelection.create(this.ranges.map(n=>n.map(e,r)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new EditorSelection(e.ranges.map(r=>SelectionRange.fromJSON(r)),e.main)}static single(e,r=e){return new EditorSelection([EditorSelection.range(e,r)],0)}static create(e,r=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,o=0;oe?4:0)|a)}static normalized(e,r=0){let n=e[r];e.sort((o,a)=>o.from-a.from),r=e.indexOf(n);for(let o=1;oa.head?EditorSelection.range(h,c):EditorSelection.range(c,h))}}return new EditorSelection(e,r)}}function checkSelection(s,e){for(let r of s.ranges)if(r.to>e)throw new RangeError("Selection points outside of document")}let nextID=0;class Facet{constructor(e,r,n,o,a){this.combine=e,this.compareInput=r,this.compare=n,this.isStatic=o,this.id=nextID++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}static define(e={}){return new Facet(e.combine||(r=>r),e.compareInput||((r,n)=>r===n),e.compare||(e.combine?(r,n)=>r===n:sameArray$1),!!e.static,e.enables)}of(e){return new FacetProvider([],this,0,e)}compute(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new FacetProvider(e,this,1,r)}computeN(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new FacetProvider(e,this,2,r)}from(e,r){return r||(r=n=>n),this.compute([e],n=>r(n.field(e)))}}function sameArray$1(s,e){return s==e||s.length==e.length&&s.every((r,n)=>r===e[n])}class FacetProvider{constructor(e,r,n,o){this.dependencies=e,this.facet=r,this.type=n,this.value=o,this.id=nextID++}dynamicSlot(e){var r;let n=this.value,o=this.facet.compareInput,a=this.id,l=e[a]>>1,c=this.type==2,h=!1,f=!1,d=[];for(let m of this.dependencies)m=="doc"?h=!0:m=="selection"?f=!0:((r=e[m.id])!==null&&r!==void 0?r:1)&1||d.push(e[m.id]);return{create(m){return m.values[l]=n(m),1},update(m,v){if(h&&v.docChanged||f&&(v.docChanged||v.selection)||ensureAll(m,d)){let A=n(m);if(c?!compareArray(A,m.values[l],o):!o(A,m.values[l]))return m.values[l]=A,1}return 0},reconfigure:(m,v)=>{let A,T=v.config.address[a];if(T!=null){let B=getAddr(v,T);if(this.dependencies.every(Y=>Y instanceof Facet?v.facet(Y)===m.facet(Y):Y instanceof StateField?v.field(Y,!1)==m.field(Y,!1):!0)||(c?compareArray(A=n(m),B,o):o(A=n(m),B)))return m.values[l]=B,0}else A=n(m);return m.values[l]=A,1}}}}function compareArray(s,e,r){if(s.length!=e.length)return!1;for(let n=0;ns[h.id]),o=r.map(h=>h.type),a=n.filter(h=>!(h&1)),l=s[e.id]>>1;function c(h){let f=[];for(let d=0;dn===o),e);return e.provide&&(r.provides=e.provide(r)),r}create(e){let r=e.facet(initField).find(n=>n.field==this);return((r==null?void 0:r.create)||this.createF)(e)}slot(e){let r=e[this.id]>>1;return{create:n=>(n.values[r]=this.create(n),1),update:(n,o)=>{let a=n.values[r],l=this.updateF(a,o);return this.compareF(a,l)?0:(n.values[r]=l,1)},reconfigure:(n,o)=>o.config.address[this.id]!=null?(n.values[r]=o.field(this),0):(n.values[r]=this.create(n),1)}}init(e){return[this,initField.of({field:this,create:e})]}get extension(){return this}}const Prec_={lowest:4,low:3,default:2,high:1,highest:0};function prec(s){return e=>new PrecExtension(e,s)}const Prec={highest:prec(Prec_.highest),high:prec(Prec_.high),default:prec(Prec_.default),low:prec(Prec_.low),lowest:prec(Prec_.lowest)};class PrecExtension{constructor(e,r){this.inner=e,this.prec=r}}class Compartment{of(e){return new CompartmentInstance(this,e)}reconfigure(e){return Compartment.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class CompartmentInstance{constructor(e,r){this.compartment=e,this.inner=r}}class Configuration{constructor(e,r,n,o,a,l){for(this.base=e,this.compartments=r,this.dynamicSlots=n,this.address=o,this.staticValues=a,this.facets=l,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,r,n){let o=[],a=Object.create(null),l=new Map;for(let v of flatten(e,r,l))v instanceof StateField?o.push(v):(a[v.facet.id]||(a[v.facet.id]=[])).push(v);let c=Object.create(null),h=[],f=[];for(let v of o)c[v.id]=f.length<<1,f.push(A=>v.slot(A));let d=n==null?void 0:n.config.facets;for(let v in a){let A=a[v],T=A[0].facet,B=d&&d[v]||[];if(A.every(Y=>Y.type==0))if(c[T.id]=h.length<<1|1,sameArray$1(B,A))h.push(n.facet(T));else{let Y=T.combine(A.map(F=>F.value));h.push(n&&T.compare(Y,n.facet(T))?n.facet(T):Y)}else{for(let Y of A)Y.type==0?(c[Y.id]=h.length<<1|1,h.push(Y.value)):(c[Y.id]=f.length<<1,f.push(F=>Y.dynamicSlot(F)));c[T.id]=f.length<<1,f.push(Y=>dynamicFacetSlot(Y,T,A))}}let m=f.map(v=>v(c));return new Configuration(e,l,m,c,h,a)}}function flatten(s,e,r){let n=[[],[],[],[],[]],o=new Map;function a(l,c){let h=o.get(l);if(h!=null){if(h<=c)return;let f=n[h].indexOf(l);f>-1&&n[h].splice(f,1),l instanceof CompartmentInstance&&r.delete(l.compartment)}if(o.set(l,c),Array.isArray(l))for(let f of l)a(f,c);else if(l instanceof CompartmentInstance){if(r.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(l.compartment)||l.inner;r.set(l.compartment,f),a(f,c)}else if(l instanceof PrecExtension)a(l.inner,l.prec);else if(l instanceof StateField)n[c].push(l),l.provides&&a(l.provides,c);else if(l instanceof FacetProvider)n[c].push(l),l.facet.extensions&&a(l.facet.extensions,Prec_.default);else{let f=l.extension;if(!f)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(f,c)}}return a(s,Prec_.default),n.reduce((l,c)=>l.concat(c))}function ensureAddr(s,e){if(e&1)return 2;let r=e>>1,n=s.status[r];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;s.status[r]=4;let o=s.computeSlot(s,s.config.dynamicSlots[r]);return s.status[r]=2|o}function getAddr(s,e){return e&1?s.config.staticValues[e>>1]:s.values[e>>1]}const languageData=Facet.define(),allowMultipleSelections=Facet.define({combine:s=>s.some(e=>e),static:!0}),lineSeparator=Facet.define({combine:s=>s.length?s[0]:void 0,static:!0}),changeFilter=Facet.define(),transactionFilter=Facet.define(),transactionExtender=Facet.define(),readOnly=Facet.define({combine:s=>s.length?s[0]:!1});class Annotation{constructor(e,r){this.type=e,this.value=r}static define(){return new AnnotationType}}class AnnotationType{of(e){return new Annotation(this,e)}}class StateEffectType{constructor(e){this.map=e}of(e){return new StateEffect(this,e)}}class StateEffect{constructor(e,r){this.type=e,this.value=r}map(e){let r=this.type.map(this.value,e);return r===void 0?void 0:r==this.value?this:new StateEffect(this.type,r)}is(e){return this.type==e}static define(e={}){return new StateEffectType(e.map||(r=>r))}static mapEffects(e,r){if(!e.length)return e;let n=[];for(let o of e){let a=o.map(r);a&&n.push(a)}return n}}StateEffect.reconfigure=StateEffect.define();StateEffect.appendConfig=StateEffect.define();class Transaction{constructor(e,r,n,o,a,l){this.startState=e,this.changes=r,this.selection=n,this.effects=o,this.annotations=a,this.scrollIntoView=l,this._doc=null,this._state=null,n&&checkSelection(n,r.newLength),a.some(c=>c.type==Transaction.time)||(this.annotations=a.concat(Transaction.time.of(Date.now())))}static create(e,r,n,o,a,l){return new Transaction(e,r,n,o,a,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let r of this.annotations)if(r.type==e)return r.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let r=this.annotation(Transaction.userEvent);return!!(r&&(r==e||r.length>e.length&&r.slice(0,e.length)==e&&r[e.length]=="."))}}Transaction.time=Annotation.define();Transaction.userEvent=Annotation.define();Transaction.addToHistory=Annotation.define();Transaction.remote=Annotation.define();function joinRanges(s,e){let r=[];for(let n=0,o=0;;){let a,l;if(n=s[n]))a=s[n++],l=s[n++];else if(o=0;o--){let a=n[o](s);a instanceof Transaction?s=a:Array.isArray(a)&&a.length==1&&a[0]instanceof Transaction?s=a[0]:s=resolveTransaction(e,asArray$1(a),!1)}return s}function extendTransaction(s){let e=s.startState,r=e.facet(transactionExtender),n=s;for(let o=r.length-1;o>=0;o--){let a=r[o](s);a&&Object.keys(a).length&&(n=mergeTransaction(n,resolveTransactionInner(e,a,s.changes.newLength),!0))}return n==s?s:Transaction.create(e,s.changes,s.selection,n.effects,n.annotations,n.scrollIntoView)}const none$3=[];function asArray$1(s){return s==null?none$3:Array.isArray(s)?s:[s]}var CharCategory=function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s}(CharCategory||(CharCategory={}));const nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let wordChar$1;try{wordChar$1=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function hasWordChar(s){if(wordChar$1)return wordChar$1.test(s);for(let e=0;e"€"&&(r.toUpperCase()!=r.toLowerCase()||nonASCIISingleCaseWordChar.test(r)))return!0}return!1}function makeCategorizer(s){return e=>{if(!/\S/.test(e))return CharCategory.Space;if(hasWordChar(e))return CharCategory.Word;for(let r=0;r-1)return CharCategory.Word;return CharCategory.Other}}class EditorState{constructor(e,r,n,o,a,l){this.config=e,this.doc=r,this.selection=n,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=a,l&&(l._state=this);for(let c=0;co.set(h,c)),r=null),o.set(l.value.compartment,l.value.extension)):l.is(StateEffect.reconfigure)?(r=null,n=l.value):l.is(StateEffect.appendConfig)&&(r=null,n=asArray$1(n).concat(l.value));let a;r?a=e.startState.values.slice():(r=Configuration.resolve(n,o,this),a=new EditorState(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values),new EditorState(r,e.newDoc,e.newSelection,a,(l,c)=>c.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:e},range:EditorSelection.cursor(r.from+e.length)}))}changeByRange(e){let r=this.selection,n=e(r.ranges[0]),o=this.changes(n.changes),a=[n.range],l=asArray$1(n.effects);for(let c=1;cl.spec.fromJSON(c,h)))}}return EditorState.create({doc:e.doc,selection:EditorSelection.fromJSON(e.selection),extensions:r.extensions?o.concat([r.extensions]):o})}static create(e={}){let r=Configuration.resolve(e.extensions||[],new Map),n=e.doc instanceof Text?e.doc:Text.of((e.doc||"").split(r.staticFacet(EditorState.lineSeparator)||DefaultSplit)),o=e.selection?e.selection instanceof EditorSelection?e.selection:EditorSelection.single(e.selection.anchor,e.selection.head):EditorSelection.single(0);return checkSelection(o,n.length),r.staticFacet(allowMultipleSelections)||(o=o.asSingle()),new EditorState(r,n,o,r.dynamicSlots.map(()=>null),(a,l)=>l.create(a),null)}get tabSize(){return this.facet(EditorState.tabSize)}get lineBreak(){return this.facet(EditorState.lineSeparator)||` @@ -25,35 +25,35 @@ var Yn=Object.defineProperty;var Dn=(s,e,r)=>e in s?Yn(s,e,{enumerable:!0,config `+e.scrub();for(let n of e.markers)r.marks.push(n)}return this.finishLeaf(r),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let r=scanLineResult;if(r.end=e,e>=this.to)r.text="";else if(r.text=this.lineChunkAt(e),r.end+=r.text.length,this.ranges.length>1){let n=this.absoluteLineStart,o=this.rangeI;for(;this.ranges[o].tothis.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,r,n=0){this.block=CompositeBlock.create(e,n,this.lineStart+r,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,r,n=0){this.startContext(this.parser.getNodeType(e),r,n)}addNode(e,r,n){typeof e=="number"&&(e=new Tree(this.parser.nodeSet.types[e],none,none,(n??this.prevLineEnd())-r)),this.block.addChild(e,r-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,r){this.addNode(this.buffer.writeElements(injectMarks(r.children,e.marks),-r.from).finish(r.type,r.to-r.from),r.from)}finishContext(){let e=this.stack.pop(),r=this.stack[this.stack.length-1];r.addChild(e.toTree(this.parser.nodeSet),e.from-r.from),this.block=r}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?injectGaps(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let r=injectMarks(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(r,-e.start).finish(Type.Paragraph,e.content.length),e.start)}elt(e,r,n,o){return typeof e=="string"?elt(this.parser.getNodeType(e),r,n,o):new TreeElement(e,r)}get buffer(){return new Buffer(this.parser.nodeSet)}}function injectGaps(s,e,r,n,o){let a=s[e].to,l=[],c=[],h=r.from+n;function f(d,m){for(;m?d>=a:d>a;){let v=s[e+1].from-a;n+=v,d+=v,e++,a=s[e].to}}for(let d=r.firstChild;d;d=d.nextSibling){f(d.from+n,!0);let m=d.from+n,v,A=o.get(d.tree);A?v=A:d.to+n>a?(v=injectGaps(s,e,d,n,o),f(d.to+n,!1)):v=d.toTree(),l.push(v),c.push(m-h)}return f(r.to+n,!1),new Tree(r.type,l,c,r.to+n-h,r.tree?r.tree.propValues:void 0)}class MarkdownParser extends Parser{constructor(e,r,n,o,a,l,c,h,f){super(),this.nodeSet=e,this.blockParsers=r,this.leafBlockParsers=n,this.blockNames=o,this.endLeafBlock=a,this.skipContextMarkup=l,this.inlineParsers=c,this.inlineNames=h,this.wrappers=f,this.nodeTypes=Object.create(null);for(let d of e.types)this.nodeTypes[d.name]=d.id}createParse(e,r,n){let o=new BlockContext(this,e,r,n);for(let a of this.wrappers)o=a(o,e,r,n);return o}configure(e){let r=resolveConfig(e);if(!r)return this;let{nodeSet:n,skipContextMarkup:o}=this,a=this.blockParsers.slice(),l=this.leafBlockParsers.slice(),c=this.blockNames.slice(),h=this.inlineParsers.slice(),f=this.inlineNames.slice(),d=this.endLeafBlock.slice(),m=this.wrappers;if(nonEmpty(r.defineNodes)){o=Object.assign({},o);let v=n.types.slice(),A;for(let T of r.defineNodes){let{name:B,block:Y,composite:F,style:ke}=typeof T=="string"?{name:T}:T;if(v.some(Te=>Te.name==B))continue;F&&(o[v.length]=(Te,Le,Me)=>F(Le,Me,Te.value));let Qe=v.length,xe=F?["Block","BlockContext"]:Y?Qe>=Type.ATXHeading1&&Qe<=Type.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;v.push(NodeType.define({id:Qe,name:B,props:xe&&[[NodeProp.group,xe]]})),ke&&(A||(A={}),Array.isArray(ke)||ke instanceof Tag?A[B]=ke:Object.assign(A,ke))}n=new NodeSet(v),A&&(n=n.extend(styleTags(A)))}if(nonEmpty(r.props)&&(n=n.extend(...r.props)),nonEmpty(r.remove))for(let v of r.remove){let A=this.blockNames.indexOf(v),T=this.inlineNames.indexOf(v);A>-1&&(a[A]=l[A]=void 0),T>-1&&(h[T]=void 0)}if(nonEmpty(r.parseBlock))for(let v of r.parseBlock){let A=c.indexOf(v.name);if(A>-1)a[A]=v.parse,l[A]=v.leaf;else{let T=v.before?findName(c,v.before):v.after?findName(c,v.after)+1:c.length-1;a.splice(T,0,v.parse),l.splice(T,0,v.leaf),c.splice(T,0,v.name)}v.endLeaf&&d.push(v.endLeaf)}if(nonEmpty(r.parseInline))for(let v of r.parseInline){let A=f.indexOf(v.name);if(A>-1)h[A]=v.parse;else{let T=v.before?findName(f,v.before):v.after?findName(f,v.after)+1:f.length-1;h.splice(T,0,v.parse),f.splice(T,0,v.name)}}return r.wrap&&(m=m.concat(r.wrap)),new MarkdownParser(n,a,l,c,d,o,h,f,m)}getNodeType(e){let r=this.nodeTypes[e];if(r==null)throw new RangeError(`Unknown node type '${e}'`);return r}parseInline(e,r){let n=new InlineContext(this,e,r);e:for(let o=r;o=0){o=c;continue e}}o++}return n.resolveMarkers(0)}}function nonEmpty(s){return s!=null&&s.length>0}function resolveConfig(s){if(!Array.isArray(s))return s;if(s.length==0)return null;let e=resolveConfig(s[0]);if(s.length==1)return e;let r=resolveConfig(s.slice(1));if(!r||!e)return e||r;let n=(l,c)=>(l||none).concat(c||none),o=e.wrap,a=r.wrap;return{props:n(e.props,r.props),defineNodes:n(e.defineNodes,r.defineNodes),parseBlock:n(e.parseBlock,r.parseBlock),parseInline:n(e.parseInline,r.parseInline),remove:n(e.remove,r.remove),wrap:o?a?(l,c,h,f)=>o(a(l,c,h,f),c,h,f):o:a}}function findName(s,e){let r=s.indexOf(e);if(r<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return r}let nodeTypes=[NodeType.none];for(let s=1,e;e=Type[s];s++)nodeTypes[s]=NodeType.define({id:s,name:e,props:s>=Type.Escape?[]:[[NodeProp.group,s in DefaultSkipMarkup?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const none=[];class Buffer{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,r,n,o=0){return this.content.push(e,r,n,4+o*4),this}writeElements(e,r=0){for(let n of e)n.writeTo(this,r);return this}finish(e,r){return Tree.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:r})}}let Element$1=class{constructor(e,r,n,o=none){this.type=e,this.from=r,this.to=n,this.children=o}writeTo(e,r){let n=e.content.length;e.writeElements(this.children,r),e.content.push(this.type,this.from+r,this.to+r,e.content.length+4-n)}toTree(e){return new Buffer(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class TreeElement{constructor(e,r){this.tree=e,this.from=r}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return none}writeTo(e,r){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+r,this.to+r,-1)}toTree(){return this.tree}}function elt(s,e,r,n){return new Element$1(s,e,r,n)}const EmphasisUnderscore={resolve:"Emphasis",mark:"EmphasisMark"},EmphasisAsterisk={resolve:"Emphasis",mark:"EmphasisMark"},LinkStart={},ImageStart={};class InlineDelimiter{constructor(e,r,n,o){this.type=e,this.from=r,this.to=n,this.side=o}}const Escapable="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let Punctuation=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{Punctuation=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch{}const DefaultInline={Escape(s,e,r){if(e!=92||r==s.end-1)return-1;let n=s.char(r+1);for(let o=0;o]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(n);if(o)return s.append(elt(Type.URL,r,r+1+o[0].length));let a=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(n);if(a)return s.append(elt(Type.Comment,r,r+1+a[0].length));let l=/^\?[^]*?\?>/.exec(n);if(l)return s.append(elt(Type.ProcessingInstruction,r,r+1+l[0].length));let c=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return c?s.append(elt(Type.HTMLTag,r,r+1+c[0].length)):-1},Emphasis(s,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;s.char(n)==e;)n++;let o=s.slice(r-1,r),a=s.slice(n,n+1),l=Punctuation.test(o),c=Punctuation.test(a),h=/\s|^$/.test(o),f=/\s|^$/.test(a),d=!f&&(!c||h||l),m=!h&&(!l||f||c),v=d&&(e==42||!m||l),A=m&&(e==42||!d||c);return s.append(new InlineDelimiter(e==95?EmphasisUnderscore:EmphasisAsterisk,r,n,(v?1:0)|(A?2:0)))},HardBreak(s,e,r){if(e==92&&s.char(r+1)==10)return s.append(elt(Type.HardBreak,r,r+2));if(e==32){let n=r+1;for(;s.char(n)==32;)n++;if(s.char(n)==10&&n>=r+2)return s.append(elt(Type.HardBreak,r,n+1))}return-1},Link(s,e,r){return e==91?s.append(new InlineDelimiter(LinkStart,r,r+1,1)):-1},Image(s,e,r){return e==33&&s.char(r+1)==91?s.append(new InlineDelimiter(ImageStart,r,r+2,1)):-1},LinkEnd(s,e,r){if(e!=93)return-1;for(let n=s.parts.length-1;n>=0;n--){let o=s.parts[n];if(o instanceof InlineDelimiter&&(o.type==LinkStart||o.type==ImageStart)){if(!o.side||s.skipSpace(o.to)==r&&!/[(\[]/.test(s.slice(r+1,r+2)))return s.parts[n]=null,-1;let a=s.takeContent(n),l=s.parts[n]=finishLink(s,a,o.type==LinkStart?Type.Link:Type.Image,o.from,r+1);if(o.type==LinkStart)for(let c=0;ce?elt(Type.URL,e+r,a+r):a==s.length?null:!1}}function parseLinkTitle(s,e,r){let n=s.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let o=n==40?41:n;for(let a=e+1,l=!1;a=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,o,a){return this.append(new InlineDelimiter(e,r,n,(o?1:0)|(a?2:0)))}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;h--){let B=this.parts[h];if(B instanceof InlineDelimiter&&B.side&1&&B.type==o.type&&!(a&&(o.side&1||B.side&2)&&(B.to-B.from+l)%3==0&&((B.to-B.from)%3||l%3))){c=B;break}}if(!c)continue;let f=o.type.resolve,d=[],m=c.from,v=o.to;if(a){let B=Math.min(2,c.to-c.from,l);m=c.to-B,v=o.from+B,f=B==1?"Emphasis":"StrongEmphasis"}c.type.mark&&d.push(this.elt(c.type.mark,m,c.to));for(let B=h+1;B=0;r--){let n=this.parts[r];if(n instanceof InlineDelimiter&&n.type==e)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}skipSpace(e){return skipSpace(this.text,e-this.offset)+this.offset}elt(e,r,n,o){return typeof e=="string"?elt(this.parser.getNodeType(e),r,n,o):new TreeElement(e,r)}}function injectMarks(s,e){if(!e.length)return s;if(!s.length)return e;let r=s.slice(),n=0;for(let o of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let a=this.fragment.to;for(;a>0&&this.input.read(a-1,a)!=` -`;)a--;this.fragmentEnd=a?a-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let o=e+this.fragment.offset;for(;n.to<=o;)if(!n.parent())return!1;for(;;){if(n.from>=o)return this.fragment.from<=r;if(!n.childAfter(o))return!1}}matches(e){let r=this.cursor.tree;return r&&r.prop(NodeProp.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,o=this.fragmentEnd-(this.fragment.openEnd?1:0),a=e.absoluteLineStart,l=a,c=e.block.children.length,h=l,f=c;for(;;){if(r.to-n>o){if(r.type.isAnonymous&&r.firstChild())continue;break}let d=toRelative(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,d);else{let m=new Tree(e.parser.nodeSet.types[Type.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(m,r.tree),e.addNode(m,d)}if(r.type.is("Block")&&(NotLast.indexOf(r.type.id)<0?(l=r.to-n,c=e.block.children.length):(l=h,c=f,h=r.to-n,f=e.block.children.length)),!r.nextSibling())break}for(;e.block.children.length>c;)e.block.children.pop(),e.block.positions.pop();return l-a}}function toRelative(s,e){let r=s;for(let n=1;nDefaultBlockParsers[s]),Object.keys(DefaultBlockParsers).map(s=>DefaultLeafBlocks[s]),Object.keys(DefaultBlockParsers),DefaultEndLeaf,DefaultSkipMarkup,Object.keys(DefaultInline).map(s=>DefaultInline[s]),Object.keys(DefaultInline),[]);function leftOverSpace(s,e,r){let n=[];for(let o=s.firstChild,a=e;;o=o.nextSibling){let l=o?o.from:r;if(l>a&&n.push({from:a,to:l}),!o)break;a=o.to}return n}function parseCode(s){let{codeParser:e,htmlParser:r}=s;return{wrap:parseMixed((o,a)=>{let l=o.type.id;if(e&&(l==Type.CodeBlock||l==Type.FencedCode)){let c="";if(l==Type.FencedCode){let f=o.node.getChild(Type.CodeInfo);f&&(c=a.read(f.from,f.to))}let h=e(c);if(h)return{parser:h,overlay:f=>f.type.id==Type.CodeText}}else if(r&&(l==Type.HTMLBlock||l==Type.HTMLTag))return{parser:r,overlay:leftOverSpace(o.node,o.from,o.to)};return null})}}const StrikethroughDelim={resolve:"Strikethrough",mark:"StrikethroughMark"},Strikethrough={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":tags$1.strikethrough}},{name:"StrikethroughMark",style:tags$1.processingInstruction}],parseInline:[{name:"Strikethrough",parse(s,e,r){if(e!=126||s.char(r+1)!=126||s.char(r+2)==126)return-1;let n=s.slice(r-1,r),o=s.slice(r+2,r+3),a=/\s|^$/.test(n),l=/\s|^$/.test(o),c=Punctuation.test(n),h=Punctuation.test(o);return s.addDelimiter(StrikethroughDelim,r,r+2,!l&&(!h||a||c),!a&&(!c||l||h))},after:"Emphasis"}]};function parseRow(s,e,r=0,n,o=0){let a=0,l=!0,c=-1,h=-1,f=!1,d=()=>{n.push(s.elt("TableCell",o+c,o+h,s.parser.parseInline(e.slice(c,h),o+c)))};for(let m=r;m-1)&&a++,l=!1,n&&(c>-1&&d(),n.push(s.elt("TableDelimiter",m+o,m+o+1))),c=h=-1):(f||v!=32&&v!=9)&&(c<0&&(c=m),h=m+1),f=!f&&v==92}return c>-1&&(a++,n&&d()),a}function hasPipe(s,e){for(let r=e;ro instanceof TableParser)||!hasPipe(e.text,e.basePos))return!1;let n=s.scanLine(s.absoluteLineEnd+1).text;return delimiterLine.test(n)&&parseRow(s,e.text,e.basePos)==parseRow(s,n,e.basePos)},before:"SetextHeading"}]};class TaskParser{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}}const TaskList={defineNodes:[{name:"Task",block:!0,style:tags$1.list},{name:"TaskMarker",style:tags$1.atom}],parseBlock:[{name:"TaskList",leaf(s,e){return/^\[[ xX]\][ \t]/.test(e.content)&&s.parentType().name=="ListItem"?new TaskParser:null},after:"SetextHeading"}]},autolinkRE=/(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy,urlRE=/[\w-]+(\.\w+(\.\w+)?)(\/[^\s<]*)?/gy,emailRE=/[\w.+-]+@[\w-]+\.[\w.-]+/gy,xmppResourceRE=/\/[a-zA-Z\d@.]+/gy;function count(s,e,r,n){let o=0;for(let a=e;acount(s,e,n,"("))n--;else if(o==";"&&(a=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(s.slice(e,n))))n=e+a.index;else break}return n}function autolinkEmailEnd(s,e){emailRE.lastIndex=e;let r=emailRE.exec(s);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}const Autolink={parseInline:[{name:"Autolink",parse(s,e,r){let n=r-s.offset;autolinkRE.lastIndex=n;let o=autolinkRE.exec(s.text),a=-1;return!o||(o[1]||o[2]?a=autolinkURLEnd(s.text,n+o[0].length):o[3]?a=autolinkEmailEnd(s.text,n):(a=autolinkEmailEnd(s.text,n+o[0].length),a>-1&&o[0]=="xmpp:"&&(xmppResourceRE.lastIndex=a,o=xmppResourceRE.exec(s.text),o&&(a=o.index+o[0].length))),a<0)?-1:(s.addElement(s.elt("URL",r,a+s.offset)),a+s.offset)}}]},GFM=[Table,TaskList,Strikethrough,Autolink];function parseSubSuper(s,e,r){return(n,o,a)=>{if(o!=s||n.char(a+1)==s)return-1;let l=[n.elt(r,a,a+1)];for(let c=a+1;c=65&&s<=90||s==95||s>=97&&s<=122||s>=161}function isSpace(s){return s==9||s==10||s==13||s==32}let cachedName=null,cachedInput=null,cachedPos=0;function tagNameAfter(s,e){let r=s.pos+e;if(cachedPos==r&&cachedInput==s)return cachedName;let n=s.peek(e);for(;isSpace(n);)n=s.peek(++e);let o="";for(;nameChar(n);)o+=String.fromCharCode(n),n=s.peek(++e);return cachedInput=s,cachedPos=r,cachedName=o?o.toLowerCase():n==question||n==bang?void 0:null}const lessThan=60,greaterThan=62,slash=47,question=63,bang=33,dash$1=45;function ElementContext(s,e){this.name=s,this.parent=e,this.hash=e?e.hash:0;for(let r=0;r-1?new ElementContext(tagNameAfter(n,1)||"",s):s},reduce(s,e){return e==Element&&s?s.parent:s},reuse(s,e,r,n){let o=e.type.id;return o==StartTag||o==OpenTag?new ElementContext(tagNameAfter(n,1)||"",s):s},hash(s){return s?s.hash:0},strict:!1}),tagStart=new ExternalTokenizer((s,e)=>{if(s.next!=lessThan){s.next<0&&e.context&&s.acceptToken(missingCloseTag);return}s.advance();let r=s.next==slash;r&&s.advance();let n=tagNameAfter(s,0);if(n===void 0)return;if(!n)return s.acceptToken(r?IncompleteCloseTag:StartTag);let o=e.context?e.context.name:null;if(r){if(n==o)return s.acceptToken(StartCloseTag);if(o&&implicitlyClosed[o])return s.acceptToken(missingCloseTag,-2);if(e.dialectEnabled(Dialect_noMatch))return s.acceptToken(NoMatchStartCloseTag);for(let a=e.context;a;a=a.parent)if(a.name==n)return;s.acceptToken(MismatchedStartCloseTag)}else{if(n=="script")return s.acceptToken(StartScriptTag);if(n=="style")return s.acceptToken(StartStyleTag);if(n=="textarea")return s.acceptToken(StartTextareaTag);if(selfClosers$1.hasOwnProperty(n))return s.acceptToken(StartSelfClosingTag);o&&closeOnOpen[o]&&closeOnOpen[o][n]?s.acceptToken(missingCloseTag,-1):s.acceptToken(StartTag)}},{contextual:!0}),commentContent=new ExternalTokenizer(s=>{for(let e=0,r=0;;r++){if(s.next<0){r&&s.acceptToken(commentContent$1);break}if(s.next==dash$1)e++;else if(s.next==greaterThan&&e>=2){r>3&&s.acceptToken(commentContent$1,-2);break}else e=0;s.advance()}});function inForeignElement(s){for(;s;s=s.parent)if(s.name=="svg"||s.name=="math")return!0;return!1}const endTag=new ExternalTokenizer((s,e)=>{if(s.next==slash&&s.peek(1)==greaterThan){let r=e.dialectEnabled(Dialect_selfClosing)||inForeignElement(e.context);s.acceptToken(r?SelfClosingEndTag:EndTag,2)}else s.next==greaterThan&&s.acceptToken(EndTag,1)});function contentTokenizer(s,e,r){let n=2+s.length;return new ExternalTokenizer(o=>{for(let a=0,l=0,c=0;;c++){if(o.next<0){c&&o.acceptToken(e);break}if(a==0&&o.next==lessThan||a==1&&o.next==slash||a>=2&&al?o.acceptToken(e,-l):o.acceptToken(r,-(l-2));break}else if((o.next==10||o.next==13)&&c){o.acceptToken(e,1);break}else a=l=0;o.advance()}})}const scriptTokens=contentTokenizer("script",scriptText,StartCloseScriptTag),styleTokens=contentTokenizer("style",styleText,StartCloseStyleTag),textareaTokens=contentTokenizer("textarea",textareaText,StartCloseTextareaTag),htmlHighlighting=styleTags({"Text RawText":tags$1.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":tags$1.angleBracket,TagName:tags$1.tagName,"MismatchedCloseTag/TagName":[tags$1.tagName,tags$1.invalid],AttributeName:tags$1.attributeName,"AttributeValue UnquotedAttributeValue":tags$1.attributeValue,Is:tags$1.definitionOperator,"EntityReference CharacterReference":tags$1.character,Comment:tags$1.blockComment,ProcessingInst:tags$1.processingInstruction,DoctypeDecl:tags$1.documentMeta}),parser$1=LRParser.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rOOO`7+$t7+$tO)rQ#|O,59eO)wQ#|O,59hO)|Q#|O,59kOOO`1G/X1G/XO*RO7[O'#CvO*dOM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R!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:elementContext,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[htmlHighlighting],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!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Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let f=c.type.id;if(f==ScriptText)return maybeNest(c,h,r);if(f==StyleText)return maybeNest(c,h,n);if(f==TextareaText)return maybeNest(c,h,o);if(f==Element&&a.length){let d=c.node,m=d.firstChild,v=m&&findTagName(m,h),A;if(v){for(let T of a)if(T.tag==v&&(!T.attrs||T.attrs(A||(A=getAttrs(d,h))))){let B=d.lastChild;return{parser:T.parser,overlay:[{from:m.to,to:B.type.id==CloseTag?B.from:d.to}]}}}}if(l&&f==Attribute){let d=c.node,m;if(m=d.firstChild){let v=l[h.read(m.from,m.to)];if(v)for(let A of v){if(A.tagName&&A.tagName!=findTagName(d.parent,h))continue;let T=d.lastChild;if(T.type.id==AttributeValue){let B=T.from+1,Y=T.lastChild,F=T.to-(Y&&Y.isError?0:1);if(F>B)return{parser:A.parser,overlay:[{from:B,to:F}]}}else if(T.type.id==UnquotedAttributeValue)return{parser:A.parser,overlay:[{from:T.from,to:T.to}]}}}}return null})}const descendantOp=96,Unit=1,callee=97,identifier$2=98,VariableName=2,space=[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],colon=58,parenL=40,underscore=95,bracketL=91,dash=45,period=46,hash=35,percent=37;function isAlpha(s){return s>=65&&s<=90||s>=97&&s<=122||s>=161}function isDigit(s){return s>=48&&s<=57}const identifiers=new ExternalTokenizer((s,e)=>{for(let r=!1,n=0,o=0;;o++){let{next:a}=s;if(isAlpha(a)||a==dash||a==underscore||r&&isDigit(a))!r&&(a!=dash||o>0)&&(r=!0),n===o&&a==dash&&n++,s.advance();else{r&&s.acceptToken(a==parenL?callee:n==2&&e.canShift(VariableName)?VariableName:identifier$2);break}}}),descendant=new ExternalTokenizer(s=>{if(space.includes(s.peek(-1))){let{next:e}=s;(isAlpha(e)||e==underscore||e==hash||e==period||e==bracketL||e==colon||e==dash)&&s.acceptToken(descendantOp)}}),unitToken=new ExternalTokenizer(s=>{if(!space.includes(s.peek(-1))){let{next:e}=s;if(e==percent&&(s.advance(),s.acceptToken(Unit)),isAlpha(e)){do s.advance();while(isAlpha(s.next));s.acceptToken(Unit)}}}),cssHighlighting=styleTags({"AtKeyword import charset namespace keyframes media supports":tags$1.definitionKeyword,"from to selector":tags$1.keyword,NamespaceName:tags$1.namespace,KeyframeName:tags$1.labelName,KeyframeRangeName:tags$1.operatorKeyword,TagName:tags$1.tagName,ClassName:tags$1.className,PseudoClassName:tags$1.constant(tags$1.className),IdName:tags$1.labelName,"FeatureName PropertyName":tags$1.propertyName,AttributeName:tags$1.attributeName,NumberLiteral:tags$1.number,KeywordQuery:tags$1.keyword,UnaryQueryOp:tags$1.operatorKeyword,"CallTag ValueName":tags$1.atom,VariableName:tags$1.variableName,Callee:tags$1.operatorKeyword,Unit:tags$1.unit,"UniversalSelector NestingSelector":tags$1.definitionOperator,MatchOp:tags$1.compareOperator,"ChildOp SiblingOp, LogicOp":tags$1.logicOperator,BinOp:tags$1.arithmeticOperator,Important:tags$1.modifier,Comment:tags$1.blockComment,ColorLiteral:tags$1.color,"ParenthesizedContent StringLiteral":tags$1.string,":":tags$1.punctuation,"PseudoOp #":tags$1.derefOperator,"; ,":tags$1.separator,"( )":tags$1.paren,"[ ]":tags$1.squareBracket,"{ }":tags$1.brace}),spec_callee={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},spec_AtKeyword={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},spec_identifier={__proto__:null,not:128,only:128},parser=LRParser.deserialize({version:14,states:"9bQYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DPO$vQ[O'#DTOOQP'#Ej'#EjO${QdO'#DeO%gQ[O'#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^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU]QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!W^Oy%^z;'S%^;'S;=`%o<%lO%^dCoSzSOy%^z;'S%^;'S;=`%o<%lO%^bDQU|QOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS|Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[!YQo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bFfSxQOy%^z;'S%^;'S;=`%o<%lO%^lFwSv[Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!`Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!RUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!Q^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!PQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[descendant,unitToken,identifiers,1,2,3,4,new LocalTokenGroup("m~RRYZ[z{a~~g~aO#Z~~dP!P!Qg~lO#[~~",28,102)],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:97,get:s=>spec_callee[s]||-1},{term:56,get:s=>spec_AtKeyword[s]||-1},{term:98,get:s=>spec_identifier[s]||-1}],tokenPrec:1169});let _properties=null;function properties(){if(!_properties&&typeof document=="object"&&document.body){let{style:s}=document.body,e=[],r=new Set;for(let n in s)n!="cssText"&&n!="cssFloat"&&typeof s[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,o=>"-"+o.toLowerCase())),r.has(n)||(e.push(n),r.add(n)));_properties=e.sort().map(n=>({type:"property",label:n}))}return _properties||[]}const pseudoClasses=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(s=>({type:"class",label:s})),values=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(s=>({type:"keyword",label:s})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(s=>({type:"constant",label:s}))),tags=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(s=>({type:"type",label:s})),identifier$1=/^(\w[\w-]*|-\w[\w-]*|)$/,variable=/^-(-[\w-]*)?$/;function isVarArg(s,e){var r;if((s.name=="("||s.type.isError)&&(s=s.parent||s),s.name!="ArgList")return!1;let n=(r=s.parent)===null||r===void 0?void 0:r.firstChild;return(n==null?void 0:n.name)!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}const VariablesByNode=new NodeWeakMap,declSelector=["Declaration"];function astTop(s){for(let e=s;;){if(e.type.isTop)return e;if(!(e=e.parent))return s}}function variableNames(s,e,r){if(e.to-e.from>4096){let n=VariablesByNode.get(e);if(n)return n;let o=[],a=new Set,l=e.cursor(IterMode.IncludeAnonymous);if(l.firstChild())do for(let c of variableNames(s,l.node,r))a.has(c.label)||(a.add(c.label),o.push(c));while(l.nextSibling());return VariablesByNode.set(e,o),o}else{let n=[],o=new Set;return e.cursor().iterate(a=>{var l;if(r(a)&&a.matchContext(declSelector)&&((l=a.node.nextSibling)===null||l===void 0?void 0:l.name)==":"){let c=s.sliceString(a.from,a.to);o.has(c)||(o.add(c),n.push({label:c,type:"variable"}))}}),n}}const defineCSSCompletionSource=s=>e=>{let{state:r,pos:n}=e,o=syntaxTree(r).resolveInner(n,-1),a=o.type.isError&&o.from==o.to-1&&r.doc.sliceString(o.from,o.to)=="-";if(o.name=="PropertyName"||(a||o.name=="TagName")&&/^(Block|Styles)$/.test(o.resolve(o.to).name))return{from:o.from,options:properties(),validFor:identifier$1};if(o.name=="ValueName")return{from:o.from,options:values,validFor:identifier$1};if(o.name=="PseudoClassName")return{from:o.from,options:pseudoClasses,validFor:identifier$1};if(s(o)||(e.explicit||a)&&isVarArg(o,r.doc))return{from:s(o)||a?o.from:n,options:variableNames(r.doc,astTop(o),s),validFor:variable};if(o.name=="TagName"){for(let{parent:h}=o;h;h=h.parent)if(h.name=="Block")return{from:o.from,options:properties(),validFor:identifier$1};return{from:o.from,options:tags,validFor:identifier$1}}if(!e.explicit)return null;let l=o.resolve(n),c=l.childBefore(n);return c&&c.name==":"&&l.name=="PseudoClassSelector"?{from:n,options:pseudoClasses,validFor:identifier$1}:c&&c.name==":"&&l.name=="Declaration"||l.name=="ArgList"?{from:n,options:values,validFor:identifier$1}:l.name=="Block"||l.name=="Styles"?{from:n,options:properties(),validFor:identifier$1}:null},cssCompletionSource=defineCSSCompletionSource(s=>s.name=="VariableName"),cssLanguage=LRLanguage.define({name:"css",parser:parser.configure({props:[indentNodeProp.add({Declaration:continuedIndent()}),foldNodeProp.add({Block:foldInside})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function css(){return new LanguageSupport(cssLanguage,cssLanguage.data.of({autocomplete:cssCompletionSource}))}const Targets=["_blank","_self","_top","_parent"],Charsets=["ascii","utf-8","utf-16","latin1","latin1"],Methods=["get","post","put","delete"],Encs=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Bool=["true","false"],S={},Tags={a:{attrs:{href:null,ping:null,type:null,media:null,target:Targets,hreflang:null}},abbr:S,address:S,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:S,aside:S,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:S,base:{attrs:{href:null,target:Targets}},bdi:S,bdo:S,blockquote:{attrs:{cite:null}},body:S,br:S,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Encs,formmethod:Methods,formnovalidate:["novalidate"],formtarget:Targets,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:S,center:S,cite:S,code:S,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:S,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:S,div:S,dl:S,dt:S,em:S,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:S,figure:S,footer:S,form:{attrs:{action:null,name:null,"accept-charset":Charsets,autocomplete:["on","off"],enctype:Encs,method:Methods,novalidate:["novalidate"],target:Targets}},h1:S,h2:S,h3:S,h4:S,h5:S,h6:S,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:S,hgroup:S,hr:S,html:{attrs:{manifest:null}},i:S,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Encs,formmethod:Methods,formnovalidate:["novalidate"],formtarget:Targets,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:S,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:S,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:S,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Charsets,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:S,noscript:S,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:S,param:{attrs:{name:null,value:null}},pre:S,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:S,rt:S,ruby:S,samp:S,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Charsets}},section:S,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:S,source:{attrs:{src:null,type:null,media:null}},span:S,strong:S,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:S,summary:S,sup:S,table:S,tbody:S,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:S,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:S,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:S,time:{attrs:{datetime:null}},title:S,tr:S,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:S,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:S},GlobalAttrs={accesskey:null,class:null,contenteditable:Bool,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Bool,autocorrect:Bool,autocapitalize:Bool,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Bool,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Bool,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Bool,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Bool,"aria-hidden":Bool,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Bool,"aria-multiselectable":Bool,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Bool,"aria-relevant":null,"aria-required":Bool,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},eventAttributes="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(s=>"on"+s);for(let s of eventAttributes)GlobalAttrs[s]=null;class Schema{constructor(e,r){this.tags=Object.assign(Object.assign({},Tags),e),this.globalAttrs=Object.assign(Object.assign({},GlobalAttrs),r),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Schema.default=new Schema;function elementName(s,e,r=s.length){if(!e)return"";let n=e.firstChild,o=n&&n.getChild("TagName");return o?s.sliceString(o.from,Math.min(o.to,r)):""}function findParentElement(s,e=!1){for(;s;s=s.parent)if(s.name=="Element")if(e)e=!1;else return s;return null}function allowedChildren(s,e,r){let n=r.tags[elementName(s,findParentElement(e))];return(n==null?void 0:n.children)||r.allTags}function openTags(s,e){let r=[];for(let n=findParentElement(e);n&&!n.type.isTop;n=findParentElement(n.parent)){let o=elementName(s,n);if(o&&n.lastChild.name=="CloseTag")break;o&&r.indexOf(o)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&r.push(o)}return r}const identifier=/^[:\-\.\w\u00b7-\uffff]*$/;function completeTag(s,e,r,n,o){let a=/\s*>/.test(s.sliceDoc(o,o+5))?"":">",l=findParentElement(r,!0);return{from:n,to:o,options:allowedChildren(s.doc,l,e).map(c=>({label:c,type:"type"})).concat(openTags(s.doc,r).map((c,h)=>({label:"/"+c,apply:"/"+c+a,type:"type",boost:99-h}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeCloseTag(s,e,r,n){let o=/\s*>/.test(s.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:openTags(s.doc,e).map((a,l)=>({label:a,apply:a+o,type:"type",boost:99-l})),validFor:identifier}}function completeStartTag(s,e,r,n){let o=[],a=0;for(let l of allowedChildren(s.doc,r,e))o.push({label:"<"+l,type:"type"});for(let l of openTags(s.doc,r))o.push({label:"",type:"type",boost:99-a++});return{from:n,to:n,options:o,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeAttrName(s,e,r,n,o){let a=findParentElement(r),l=a?e.tags[elementName(s.doc,a)]:null,c=l&&l.attrs?Object.keys(l.attrs):[],h=l&&l.globalAttrs===!1?c:c.length?c.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:o,options:h.map(f=>({label:f,type:"property"})),validFor:identifier}}function completeAttrValue(s,e,r,n,o){var a;let l=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),c=[],h;if(l){let f=s.sliceDoc(l.from,l.to),d=e.globalAttrs[f];if(!d){let m=findParentElement(r),v=m?e.tags[elementName(s.doc,m)]:null;d=(v==null?void 0:v.attrs)&&v.attrs[f]}if(d){let m=s.sliceDoc(n,o).toLowerCase(),v='"',A='"';/^['"]/.test(m)?(h=m[0]=='"'?/^[^"]*$/:/^[^']*$/,v="",A=s.sliceDoc(o,o+1)==m[0]?"":m[0],m=m.slice(1),n++):h=/^[^\s<>='"]*$/;for(let T of d)c.push({label:T,apply:v+T+A,type:"constant"})}}return{from:n,to:o,options:c,validFor:h}}function htmlCompletionFor(s,e){let{state:r,pos:n}=e,o=syntaxTree(r).resolveInner(n,-1),a=o.resolve(n);for(let l=n,c;a==o&&(c=o.childBefore(l));){let h=c.lastChild;if(!h||!h.type.isError||h.fromhtmlCompletionFor(n,o)}const defaultNesting=[{tag:"script",attrs:s=>s.type=="text/typescript"||s.lang=="ts",parser:typescriptLanguage.parser},{tag:"script",attrs:s=>s.type=="text/babel"||s.type=="text/jsx",parser:jsxLanguage.parser},{tag:"script",attrs:s=>s.type=="text/typescript-jsx",parser:tsxLanguage.parser},{tag:"script",attrs(s){return!s.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(s.type)},parser:javascriptLanguage.parser},{tag:"style",attrs(s){return(!s.lang||s.lang=="css")&&(!s.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(s.type))},parser:cssLanguage.parser}],defaultAttrs=[{name:"style",parser:cssLanguage.parser.configure({top:"Styles"})}].concat(eventAttributes.map(s=>({name:s,parser:javascriptLanguage.parser}))),htmlPlain=LRLanguage.define({name:"html",parser:parser$1.configure({props:[indentNodeProp.add({Element(s){let e=/^(\s*)(<\/)?/.exec(s.textAfter);return s.node.to<=s.pos+e[0].length?s.continue():s.lineIndent(s.node.from)+(e[2]?0:s.unit)},"OpenTag CloseTag SelfClosingTag"(s){return s.column(s.node.from)+s.unit},Document(s){if(s.pos+/\s*/.exec(s.textAfter)[0].lengths.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),htmlLanguage=htmlPlain.configure({wrap:configureNesting(defaultNesting,defaultAttrs)});function html(s={}){let e="",r;s.matchClosingTags===!1&&(e="noMatch"),s.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(s.nestedLanguages&&s.nestedLanguages.length||s.nestedAttributes&&s.nestedAttributes.length)&&(r=configureNesting((s.nestedLanguages||[]).concat(defaultNesting),(s.nestedAttributes||[]).concat(defaultAttrs)));let n=r?htmlPlain.configure({wrap:r,dialect:e}):e?htmlLanguage.configure({dialect:e}):htmlLanguage;return new LanguageSupport(n,[htmlLanguage.data.of({autocomplete:htmlCompletionSourceWith(s)}),s.autoCloseTags!==!1?autoCloseTags:[],javascript().support,css().support])}const selfClosers=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),autoCloseTags=EditorView.inputHandler.of((s,e,r,n)=>{if(s.composing||s.state.readOnly||e!=r||n!=">"&&n!="/"||!htmlLanguage.isActiveAt(s.state,e,-1))return!1;let{state:o}=s,a=o.changeByRange(l=>{var c,h,f;let{head:d}=l,m=syntaxTree(o).resolveInner(d,-1),v;if((m.name=="TagName"||m.name=="StartTag")&&(m=m.parent),n==">"&&m.name=="OpenTag"){if(((h=(c=m.parent)===null||c===void 0?void 0:c.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(v=elementName(o.doc,m.parent,d))&&!selfClosers.has(v)){let A=s.state.doc.sliceString(d,d+1)===">",T=`${A?"":">"}`;return{range:EditorSelection.cursor(d+1),changes:{from:d+(A?1:0),insert:T}}}}else if(n=="/"&&m.name=="OpenTag"){let A=m.parent,T=A==null?void 0:A.parent;if(A.from==d-1&&((f=T.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(v=elementName(o.doc,T,d))&&!selfClosers.has(v)){let B=s.state.doc.sliceString(d,d+1)===">",Y=`/${v}${B?"":">"}`,F=d+Y.length+(B?1:0);return{range:EditorSelection.cursor(F),changes:{from:d,insert:Y}}}}return{range:l}});return a.changes.empty?!1:(s.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)}),data=defineLanguageFacet({commentTokens:{block:{open:""}}}),headingProp=new NodeProp,commonmark=parser$2.configure({props:[foldNodeProp.add(s=>!s.is("Block")||s.is("Document")||isHeading(s)!=null?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),headingProp.add(isHeading),indentNodeProp.add({Document:()=>null}),languageDataProp.add({Document:data})]});function isHeading(s){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(s.name);return e?+e[1]:void 0}function findSectionEnd(s,e){let r=s;for(;;){let n=r.nextSibling,o;if(!n||(o=isHeading(n.type))!=null&&o<=e)break;r=n}return r.to}const headerIndent=foldService.of((s,e,r)=>{for(let n=syntaxTree(s).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:a}}return null});function mkLang(s){return new Language(data,s,[headerIndent],"markdown")}const commonmarkLanguage=mkLang(commonmark),extended=commonmark.configure([GFM,Subscript,Superscript,Emoji]),markdownLanguage=mkLang(extended);function getCodeParser(s,e){return r=>{if(r&&s){let n=null;if(r=/\S*/.exec(r)[0],typeof s=="function"?n=s(r):n=LanguageDescription.matchLanguageName(s,r,!0),n instanceof LanguageDescription)return n.support?n.support.language.parser:ParseContext.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class Context{constructor(e,r,n,o,a,l,c){this.node=e,this.from=r,this.to=n,this.spaceBefore=o,this.spaceAfter=a,this.type=l,this.item=c}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;o--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+itemNumber(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function getContext(s,e){let r=[];for(let o=s;o&&o.name!="Document";o=o.parent)(o.name=="ListItem"||o.name=="Blockquote"||o.name=="FencedCode")&&r.push(o);let n=[];for(let o=r.length-1;o>=0;o--){let a=r[o],l,c=e.lineAt(a.from),h=a.from-c.from;if(a.name=="FencedCode")n.push(new Context(a,h,h,"","","",null));else if(a.name=="Blockquote"&&(l=/^[ \t]*>( ?)/.exec(c.text.slice(h))))n.push(new Context(a,h,h+l[0].length,"",l[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(l=/^([ \t]*)\d+([.)])([ \t]*)/.exec(c.text.slice(h)))){let f=l[3],d=l[0].length;f.length>=4&&(f=f.slice(0,f.length-4),d-=4),n.push(new Context(a.parent,h,h+d,l[1],f,l[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(l=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(c.text.slice(h)))){let f=l[4],d=l[0].length;f.length>4&&(f=f.slice(0,f.length-4),d-=4);let m=l[2];l[3]&&(m+=l[3].replace(/[xX]/," ")),n.push(new Context(a.parent,h,h+d,l[1],f,m,a))}}return n}function itemNumber(s,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(s.from,s.from+10))}function renumberList(s,e,r,n=0){for(let o=-1,a=s;;){if(a.name=="ListItem"){let c=itemNumber(a,e),h=+c[2];if(o>=0){if(h!=o+1)return;r.push({from:a.from+c[1].length,to:a.from+c[0].length,insert:String(o+2+n)})}o=h}let l=a.nextSibling;if(!l)break;a=l}}const insertNewlineContinueMarkup=({state:s,dispatch:e})=>{let r=syntaxTree(s),{doc:n}=s,o=null,a=s.changeByRange(l=>{if(!l.empty||!markdownLanguage.isActiveAt(s,l.from))return o={range:l};let c=l.from,h=n.lineAt(c),f=getContext(r.resolveInner(c,-1),n);for(;f.length&&f[f.length-1].from>c-h.from;)f.pop();if(!f.length)return o={range:l};let d=f[f.length-1];if(d.to-d.spaceAfter.length>c-h.from)return o={range:l};let m=c>=d.to-d.spaceAfter.length&&!/\S/.test(h.text.slice(d.to));if(d.item&&m)if(d.node.firstChild.to>=c||h.from>0&&!/[^\s>]/.test(n.lineAt(h.from-1).text)){let Y=f.length>1?f[f.length-2]:null,F,ke="";Y&&Y.item?(F=h.from+Y.from,ke=Y.marker(n,1)):F=h.from+(Y?Y.to:0);let Qe=[{from:F,to:c,insert:ke}];return d.node.name=="OrderedList"&&renumberList(d.item,n,Qe,-2),Y&&Y.node.name=="OrderedList"&&renumberList(Y.item,n,Qe),{range:EditorSelection.cursor(F+ke.length),changes:Qe}}else{let Y="";for(let F=0,ke=f.length-2;F<=ke;F++)Y+=f[F].blank(F\s*$/.exec(Y.text);if(F&&F.index==d.from){let ke=s.changes([{from:Y.from+F.index,to:Y.to},{from:h.from+d.from,to:h.to}]);return{range:l.map(ke),changes:ke}}}let v=[];d.node.name=="OrderedList"&&renumberList(d.item,n,v);let A=d.item&&d.item.from]*/.exec(h.text)[0].length>=d.to)for(let Y=0,F=f.length-1;Y<=F;Y++)T+=Y==F&&!A?f[Y].marker(n,1):f[Y].blank(Yh.from&&/\s/.test(h.text.charAt(B-h.from-1));)B--;return T=s.lineBreak+T,v.push({from:B,to:c,insert:T}),{range:EditorSelection.cursor(B+T.length),changes:v}});return o?!1:(e(s.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)};function isMark(s){return s.name=="QuoteMark"||s.name=="ListMark"}function contextNodeForDelete(s,e){let r=s.resolveInner(e,-1),n=e;isMark(r)&&(n=r.from,r=r.parent);for(let o;o=r.childBefore(n);)if(isMark(o))n=o.from;else if(o.name=="OrderedList"||o.name=="BulletList")r=o.lastChild,n=r.to;else break;return r}const deleteMarkupBackward=({state:s,dispatch:e})=>{let r=syntaxTree(s),n=null,o=s.changeByRange(a=>{let l=a.from,{doc:c}=s;if(a.empty&&markdownLanguage.isActiveAt(s,a.from)){let h=c.lineAt(l),f=getContext(contextNodeForDelete(r,l),c);if(f.length){let d=f[f.length-1],m=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(l-h.from>m&&!/\S/.test(h.text.slice(m,l-h.from)))return{range:EditorSelection.cursor(h.from+m),changes:{from:h.from+m,to:l}};if(l-h.from==m&&(!d.item||h.from<=d.item.from||!/\S/.test(h.text.slice(0,d.to)))){let v=h.from+d.from;if(d.item&&d.node.from .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:selection},".cm-panels":{backgroundColor:darkBackground,color:ivory},".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:background,color:stone,border:"none"},".cm-activeLineGutter":{backgroundColor:highlightBackground},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:tooltipBackground},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:tooltipBackground,borderBottomColor:tooltipBackground},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:highlightBackground,color:ivory}}},{dark:!0}),oneDarkHighlightStyle=HighlightStyle.define([{tag:tags$1.keyword,color:violet},{tag:[tags$1.name,tags$1.deleted,tags$1.character,tags$1.propertyName,tags$1.macroName],color:coral},{tag:[tags$1.function(tags$1.variableName),tags$1.labelName],color:malibu},{tag:[tags$1.color,tags$1.constant(tags$1.name),tags$1.standard(tags$1.name)],color:whiskey},{tag:[tags$1.definition(tags$1.name),tags$1.separator],color:ivory},{tag:[tags$1.typeName,tags$1.className,tags$1.number,tags$1.changed,tags$1.annotation,tags$1.modifier,tags$1.self,tags$1.namespace],color:chalky},{tag:[tags$1.operator,tags$1.operatorKeyword,tags$1.url,tags$1.escape,tags$1.regexp,tags$1.link,tags$1.special(tags$1.string)],color:cyan},{tag:[tags$1.meta,tags$1.comment],color:stone},{tag:tags$1.strong,fontWeight:"bold"},{tag:tags$1.emphasis,fontStyle:"italic"},{tag:tags$1.strikethrough,textDecoration:"line-through"},{tag:tags$1.link,color:stone,textDecoration:"underline"},{tag:tags$1.heading,fontWeight:"bold",color:coral},{tag:[tags$1.atom,tags$1.bool,tags$1.special(tags$1.variableName)],color:whiskey},{tag:[tags$1.processingInstruction,tags$1.string,tags$1.inserted],color:sage},{tag:tags$1.invalid,color:invalid}]),oneDark=[oneDarkTheme,syntaxHighlighting(oneDarkHighlightStyle)];function initVim(s){var e=s.Pos;function r(u,p){var g=u.state.vim;if(!g||g.insertMode)return p.head;var y=g.sel.head;if(!y)return p.head;if(!(g.visualBlock&&p.head.line!=y.line))return p.from()==p.anchor&&!p.empty()&&p.head.line==y.line&&p.head.ch!=y.ch?new e(p.head.line,p.head.ch-1):p.head}function n(u,p,g){if(p.line===g.line&&p.ch>=g.ch-1){var y=u.getLine(p.line),b=y.charCodeAt(p.ch);55296<=b&&b<=55551&&(g.ch+=1)}return{start:p,end:g}}var o=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],a=o.length,l=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}];function c(u){u.setOption("disableInput",!0),u.setOption("showCursorWhenSelecting",!1),s.signal(u,"vim-mode-change",{mode:"normal"}),u.on("cursorActivity",un),$i(u),s.on(u.getInputField(),"paste",Y(u))}function h(u){u.setOption("disableInput",!1),u.off("cursorActivity",un),s.off(u.getInputField(),"paste",Y(u)),u.state.vim=null,kr&&clearTimeout(kr)}function f(u,p){this==s.keyMap.vim&&(u.options.$customCursor=null,s.rmClass(u.getWrapperElement(),"cm-fat-cursor")),(!p||p.attach!=d)&&h(u)}function d(u,p){this==s.keyMap.vim&&(u.curOp&&(u.curOp.selectionChanged=!0),u.options.$customCursor=r,s.addClass(u.getWrapperElement(),"cm-fat-cursor")),(!p||p.attach!=d)&&c(u)}s.defineOption("vimMode",!1,function(u,p,g){p&&u.getOption("keyMap")!="vim"?u.setOption("keyMap","vim"):!p&&g!=s.Init&&/^vim/.test(u.getOption("keyMap"))&&u.setOption("keyMap","default")});function m(u,p){if(p){if(this[u])return this[u];var g=B(u);if(!g)return!1;var y=Tt.findKey(p,g);return typeof y=="function"&&s.signal(p,"vim-keypress",g),y}}var v={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},A={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},T={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(A)).forEach(function(u){T[(A[u]||"").toLowerCase()]=T[u.toLowerCase()]=u});function B(u){if(u.charAt(0)=="'")return u.charAt(1);var p=u.split(/-(?!$)/),g=p[p.length-1];if(p.length==1&&p[0].length==1)return!1;if(p.length==2&&p[0]=="Shift"&&g.length==1)return!1;for(var y=!1,b=0;b"):!1}function Y(u){var p=u.state.vim;return p.onPasteFn||(p.onPasteFn=function(){p.insertMode||(u.setCursor(wt(u.getCursor(),0,1)),mi.enterInsertMode(u,{},p))}),p.onPasteFn}var F=/[\d]/,ke=[s.isWordChar,function(u){return u&&!s.isWordChar(u)&&!/\s/.test(u)}],Qe=[function(u){return/\S/.test(u)}];function xe(u,p){for(var g=[],y=u;y"]),Fe=[].concat(Te,Le,Me,["-",'"',".",":","_","/","+"]),Ve;try{Ve=new RegExp("^[\\p{Lu}]$","u")}catch{Ve=/^[A-Z]$/}function at(u,p){return p>=u.firstLine()&&p<=u.lastLine()}function dt(u){return/^[a-z]$/.test(u)}function ct(u){return"()[]{}".indexOf(u)!=-1}function nt(u){return F.test(u)}function ft(u){return Ve.test(u)}function it(u){return/^\s*$/.test(u)}function pt(u){return".?!".indexOf(u)!=-1}function lt(u,p){for(var g=0;gg?p=g:p0?1:-1,Pe,oe=R.getCursor();do if(p+=$e,Z=b[(u+p)%u],Z&&(Pe=Z.find())&&!H(oe,Pe))break;while(py)}return Z}function M(R,V){var Z=p,$e=P(R,V);return p=Z,$e&&$e.find()}return{cachedCursor:void 0,add:I,find:M,move:P}},Oi=function(u){return u?{changes:u.changes,expectCursorActivityForChange:u.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function Fi(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=Oi()}Fi.prototype={exitMacroRecordMode:function(){var u=Ye.macroModeState;u.onRecordingDone&&u.onRecordingDone(),u.onRecordingDone=void 0,u.isRecording=!1},enterMacroRecordMode:function(u,p){var g=Ye.registerController.getRegister(p);if(g){if(g.clear(),this.latestRegister=p,u.openDialog){var y=vi("span",{class:"cm-vim-message"},"recording @"+p);this.onRecordingDone=u.openDialog(y,null,{bottom:!0})}this.isRecording=!0}}};function $i(u){return u.state.vim||(u.state.vim={inputState:new Mi,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),u.state.vim}var Ye;function hr(){Ye={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:gi(),macroModeState:new Fi,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new fr({}),searchHistoryController:new qi,exCommandHistoryController:new qi};for(var u in st){var p=st[u];p.value=p.defaultValue}}var xi,Tt={enterVimMode:c,leaveVimMode:h,buildKeyMap:function(){},getRegisterController:function(){return Ye.registerController},resetVimGlobalState_:hr,getVimGlobalState_:function(){return Ye},maybeInitVimState_:$i,suppressErrorLogging:!1,InsertModeKey:Wr,map:function(u,p,g){ei.map(u,p,g)},unmap:function(u,p){return ei.unmap(u,p)},noremap:function(u,p,g){ei.map(u,p,g,!0)},mapclear:function(u){var p=o.length,g=a,y=o.slice(0,p-g);if(o=o.slice(p-g),u)for(var b=y.length-1;b>=0;b--){var I=y[b];if(u!==I.context)if(I.context)this._mapCommand(I);else{var P=["normal","insert","visual"];for(var M in P)if(P[M]!==u){var R={};for(var V in I)R[V]=I[V];R.context=P[M],this._mapCommand(R)}}}},setOption:Vt,getOption:Yt,defineOption:mt,defineEx:function(u,p,g){if(!p)p=u;else if(u.indexOf(p)!==0)throw new Error('(Vim.defineEx) "'+p+'" is not a prefix of "'+u+'", command not registered');ln[u]=g,ei.commandMap_[p]={name:u,shortName:p,type:"api"}},handleKey:function(u,p,g){var y=this.findKey(u,p,g);if(typeof y=="function")return y()},multiSelectHandleKey:Mn,findKey:function(u,p,g){var y=$i(u);function b(){var V=Ye.macroModeState;if(V.isRecording){if(p=="q")return V.exitMacroRecordMode(),Lt(u),!0;g!="mapping"&&Ln(V,p)}}function I(){if(p==""){if(y.visualMode)Ht(u);else if(y.insertMode)Ci(u);else return;return Lt(u),!0}}function P(){if(I())return!0;y.inputState.keyBuffer.push(p);var V=y.inputState.keyBuffer.join(""),Z=p.length==1,$e=ui.matchCommand(V,o,y.inputState,"insert"),Pe=y.inputState.changeQueue;if($e.type=="none")return Lt(u),!1;if($e.type=="partial"){if(xi&&window.clearTimeout(xi),xi=Z&&window.setTimeout(function(){y.insertMode&&y.inputState.keyBuffer.length&&Lt(u)},Yt("insertModeEscKeysTimeout")),Z){var oe=u.listSelections();(!Pe||Pe.removed.length!=oe.length)&&(Pe=y.inputState.changeQueue=new ur),Pe.inserted+=p;for(var K=0;K|./gi,I;I=b.exec(p);){var P=I[0],M=y.insertMode,R=Tt.handleKey(u,P,"mapping");if(!R&&M&&y.insertMode){if(P[0]=="<"){var Z=P.toLowerCase().slice(1,-1),V=Z.split("-"),Z=V.pop();if(Z=="lt")P="<";else if(Z=="space")P=" ";else if(Z=="cr")P=` +`;)a--;this.fragmentEnd=a?a-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let o=e+this.fragment.offset;for(;n.to<=o;)if(!n.parent())return!1;for(;;){if(n.from>=o)return this.fragment.from<=r;if(!n.childAfter(o))return!1}}matches(e){let r=this.cursor.tree;return r&&r.prop(NodeProp.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,o=this.fragmentEnd-(this.fragment.openEnd?1:0),a=e.absoluteLineStart,l=a,c=e.block.children.length,h=l,f=c;for(;;){if(r.to-n>o){if(r.type.isAnonymous&&r.firstChild())continue;break}let d=toRelative(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,d);else{let m=new Tree(e.parser.nodeSet.types[Type.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(m,r.tree),e.addNode(m,d)}if(r.type.is("Block")&&(NotLast.indexOf(r.type.id)<0?(l=r.to-n,c=e.block.children.length):(l=h,c=f,h=r.to-n,f=e.block.children.length)),!r.nextSibling())break}for(;e.block.children.length>c;)e.block.children.pop(),e.block.positions.pop();return l-a}}function toRelative(s,e){let r=s;for(let n=1;nDefaultBlockParsers[s]),Object.keys(DefaultBlockParsers).map(s=>DefaultLeafBlocks[s]),Object.keys(DefaultBlockParsers),DefaultEndLeaf,DefaultSkipMarkup,Object.keys(DefaultInline).map(s=>DefaultInline[s]),Object.keys(DefaultInline),[]);function leftOverSpace(s,e,r){let n=[];for(let o=s.firstChild,a=e;;o=o.nextSibling){let l=o?o.from:r;if(l>a&&n.push({from:a,to:l}),!o)break;a=o.to}return n}function parseCode(s){let{codeParser:e,htmlParser:r}=s;return{wrap:parseMixed((o,a)=>{let l=o.type.id;if(e&&(l==Type.CodeBlock||l==Type.FencedCode)){let c="";if(l==Type.FencedCode){let f=o.node.getChild(Type.CodeInfo);f&&(c=a.read(f.from,f.to))}let h=e(c);if(h)return{parser:h,overlay:f=>f.type.id==Type.CodeText}}else if(r&&(l==Type.HTMLBlock||l==Type.HTMLTag))return{parser:r,overlay:leftOverSpace(o.node,o.from,o.to)};return null})}}const StrikethroughDelim={resolve:"Strikethrough",mark:"StrikethroughMark"},Strikethrough={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":tags$1.strikethrough}},{name:"StrikethroughMark",style:tags$1.processingInstruction}],parseInline:[{name:"Strikethrough",parse(s,e,r){if(e!=126||s.char(r+1)!=126||s.char(r+2)==126)return-1;let n=s.slice(r-1,r),o=s.slice(r+2,r+3),a=/\s|^$/.test(n),l=/\s|^$/.test(o),c=Punctuation.test(n),h=Punctuation.test(o);return s.addDelimiter(StrikethroughDelim,r,r+2,!l&&(!h||a||c),!a&&(!c||l||h))},after:"Emphasis"}]};function parseRow(s,e,r=0,n,o=0){let a=0,l=!0,c=-1,h=-1,f=!1,d=()=>{n.push(s.elt("TableCell",o+c,o+h,s.parser.parseInline(e.slice(c,h),o+c)))};for(let m=r;m-1)&&a++,l=!1,n&&(c>-1&&d(),n.push(s.elt("TableDelimiter",m+o,m+o+1))),c=h=-1):(f||v!=32&&v!=9)&&(c<0&&(c=m),h=m+1),f=!f&&v==92}return c>-1&&(a++,n&&d()),a}function hasPipe(s,e){for(let r=e;ro instanceof TableParser)||!hasPipe(e.text,e.basePos))return!1;let n=s.scanLine(s.absoluteLineEnd+1).text;return delimiterLine.test(n)&&parseRow(s,e.text,e.basePos)==parseRow(s,n,e.basePos)},before:"SetextHeading"}]};class TaskParser{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}}const TaskList={defineNodes:[{name:"Task",block:!0,style:tags$1.list},{name:"TaskMarker",style:tags$1.atom}],parseBlock:[{name:"TaskList",leaf(s,e){return/^\[[ xX]\][ \t]/.test(e.content)&&s.parentType().name=="ListItem"?new TaskParser:null},after:"SetextHeading"}]},autolinkRE=/(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy,urlRE=/[\w-]+(\.\w+(\.\w+)?)(\/[^\s<]*)?/gy,emailRE=/[\w.+-]+@[\w-]+\.[\w.-]+/gy,xmppResourceRE=/\/[a-zA-Z\d@.]+/gy;function count(s,e,r,n){let o=0;for(let a=e;acount(s,e,n,"("))n--;else if(o==";"&&(a=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(s.slice(e,n))))n=e+a.index;else break}return n}function autolinkEmailEnd(s,e){emailRE.lastIndex=e;let r=emailRE.exec(s);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}const Autolink={parseInline:[{name:"Autolink",parse(s,e,r){let n=r-s.offset;autolinkRE.lastIndex=n;let o=autolinkRE.exec(s.text),a=-1;return!o||(o[1]||o[2]?a=autolinkURLEnd(s.text,n+o[0].length):o[3]?a=autolinkEmailEnd(s.text,n):(a=autolinkEmailEnd(s.text,n+o[0].length),a>-1&&o[0]=="xmpp:"&&(xmppResourceRE.lastIndex=a,o=xmppResourceRE.exec(s.text),o&&(a=o.index+o[0].length))),a<0)?-1:(s.addElement(s.elt("URL",r,a+s.offset)),a+s.offset)}}]},GFM=[Table,TaskList,Strikethrough,Autolink];function parseSubSuper(s,e,r){return(n,o,a)=>{if(o!=s||n.char(a+1)==s)return-1;let l=[n.elt(r,a,a+1)];for(let c=a+1;c=65&&s<=90||s==95||s>=97&&s<=122||s>=161}function isSpace(s){return s==9||s==10||s==13||s==32}let cachedName=null,cachedInput=null,cachedPos=0;function tagNameAfter(s,e){let r=s.pos+e;if(cachedPos==r&&cachedInput==s)return cachedName;let n=s.peek(e);for(;isSpace(n);)n=s.peek(++e);let o="";for(;nameChar(n);)o+=String.fromCharCode(n),n=s.peek(++e);return cachedInput=s,cachedPos=r,cachedName=o?o.toLowerCase():n==question||n==bang?void 0:null}const lessThan=60,greaterThan=62,slash=47,question=63,bang=33,dash$1=45;function ElementContext(s,e){this.name=s,this.parent=e,this.hash=e?e.hash:0;for(let r=0;r-1?new ElementContext(tagNameAfter(n,1)||"",s):s},reduce(s,e){return e==Element&&s?s.parent:s},reuse(s,e,r,n){let o=e.type.id;return o==StartTag||o==OpenTag?new ElementContext(tagNameAfter(n,1)||"",s):s},hash(s){return s?s.hash:0},strict:!1}),tagStart=new ExternalTokenizer((s,e)=>{if(s.next!=lessThan){s.next<0&&e.context&&s.acceptToken(missingCloseTag);return}s.advance();let r=s.next==slash;r&&s.advance();let n=tagNameAfter(s,0);if(n===void 0)return;if(!n)return s.acceptToken(r?IncompleteCloseTag:StartTag);let o=e.context?e.context.name:null;if(r){if(n==o)return s.acceptToken(StartCloseTag);if(o&&implicitlyClosed[o])return s.acceptToken(missingCloseTag,-2);if(e.dialectEnabled(Dialect_noMatch))return s.acceptToken(NoMatchStartCloseTag);for(let a=e.context;a;a=a.parent)if(a.name==n)return;s.acceptToken(MismatchedStartCloseTag)}else{if(n=="script")return s.acceptToken(StartScriptTag);if(n=="style")return s.acceptToken(StartStyleTag);if(n=="textarea")return s.acceptToken(StartTextareaTag);if(selfClosers$1.hasOwnProperty(n))return s.acceptToken(StartSelfClosingTag);o&&closeOnOpen[o]&&closeOnOpen[o][n]?s.acceptToken(missingCloseTag,-1):s.acceptToken(StartTag)}},{contextual:!0}),commentContent=new ExternalTokenizer(s=>{for(let e=0,r=0;;r++){if(s.next<0){r&&s.acceptToken(commentContent$1);break}if(s.next==dash$1)e++;else if(s.next==greaterThan&&e>=2){r>3&&s.acceptToken(commentContent$1,-2);break}else e=0;s.advance()}});function inForeignElement(s){for(;s;s=s.parent)if(s.name=="svg"||s.name=="math")return!0;return!1}const endTag=new ExternalTokenizer((s,e)=>{if(s.next==slash&&s.peek(1)==greaterThan){let r=e.dialectEnabled(Dialect_selfClosing)||inForeignElement(e.context);s.acceptToken(r?SelfClosingEndTag:EndTag,2)}else s.next==greaterThan&&s.acceptToken(EndTag,1)});function contentTokenizer(s,e,r){let n=2+s.length;return new ExternalTokenizer(o=>{for(let a=0,l=0,c=0;;c++){if(o.next<0){c&&o.acceptToken(e);break}if(a==0&&o.next==lessThan||a==1&&o.next==slash||a>=2&&al?o.acceptToken(e,-l):o.acceptToken(r,-(l-2));break}else if((o.next==10||o.next==13)&&c){o.acceptToken(e,1);break}else a=l=0;o.advance()}})}const scriptTokens=contentTokenizer("script",scriptText,StartCloseScriptTag),styleTokens=contentTokenizer("style",styleText,StartCloseStyleTag),textareaTokens=contentTokenizer("textarea",textareaText,StartCloseTextareaTag),htmlHighlighting=styleTags({"Text RawText":tags$1.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":tags$1.angleBracket,TagName:tags$1.tagName,"MismatchedCloseTag/TagName":[tags$1.tagName,tags$1.invalid],AttributeName:tags$1.attributeName,"AttributeValue UnquotedAttributeValue":tags$1.attributeValue,Is:tags$1.definitionOperator,"EntityReference CharacterReference":tags$1.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EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:elementContext,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[htmlHighlighting],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbhSkWa!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^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id;if(f==ScriptText)return maybeNest(c,h,r);if(f==StyleText)return maybeNest(c,h,n);if(f==TextareaText)return maybeNest(c,h,o);if(f==Element&&a.length){let d=c.node,m=d.firstChild,v=m&&findTagName(m,h),A;if(v){for(let T of a)if(T.tag==v&&(!T.attrs||T.attrs(A||(A=getAttrs(d,h))))){let B=d.lastChild;return{parser:T.parser,overlay:[{from:m.to,to:B.type.id==CloseTag?B.from:d.to}]}}}}if(l&&f==Attribute){let d=c.node,m;if(m=d.firstChild){let v=l[h.read(m.from,m.to)];if(v)for(let A of v){if(A.tagName&&A.tagName!=findTagName(d.parent,h))continue;let T=d.lastChild;if(T.type.id==AttributeValue){let B=T.from+1,Y=T.lastChild,F=T.to-(Y&&Y.isError?0:1);if(F>B)return{parser:A.parser,overlay:[{from:B,to:F}]}}else if(T.type.id==UnquotedAttributeValue)return{parser:A.parser,overlay:[{from:T.from,to:T.to}]}}}}return null})}const descendantOp=96,Unit=1,callee=97,identifier$2=98,VariableName=2,space=[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],colon=58,parenL=40,underscore=95,bracketL=91,dash=45,period=46,hash=35,percent=37;function isAlpha(s){return s>=65&&s<=90||s>=97&&s<=122||s>=161}function isDigit(s){return s>=48&&s<=57}const identifiers=new ExternalTokenizer((s,e)=>{for(let r=!1,n=0,o=0;;o++){let{next:a}=s;if(isAlpha(a)||a==dash||a==underscore||r&&isDigit(a))!r&&(a!=dash||o>0)&&(r=!0),n===o&&a==dash&&n++,s.advance();else{r&&s.acceptToken(a==parenL?callee:n==2&&e.canShift(VariableName)?VariableName:identifier$2);break}}}),descendant=new ExternalTokenizer(s=>{if(space.includes(s.peek(-1))){let{next:e}=s;(isAlpha(e)||e==underscore||e==hash||e==period||e==bracketL||e==colon||e==dash)&&s.acceptToken(descendantOp)}}),unitToken=new ExternalTokenizer(s=>{if(!space.includes(s.peek(-1))){let{next:e}=s;if(e==percent&&(s.advance(),s.acceptToken(Unit)),isAlpha(e)){do s.advance();while(isAlpha(s.next));s.acceptToken(Unit)}}}),cssHighlighting=styleTags({"AtKeyword import charset namespace keyframes media supports":tags$1.definitionKeyword,"from to selector":tags$1.keyword,NamespaceName:tags$1.namespace,KeyframeName:tags$1.labelName,KeyframeRangeName:tags$1.operatorKeyword,TagName:tags$1.tagName,ClassName:tags$1.className,PseudoClassName:tags$1.constant(tags$1.className),IdName:tags$1.labelName,"FeatureName PropertyName":tags$1.propertyName,AttributeName:tags$1.attributeName,NumberLiteral:tags$1.number,KeywordQuery:tags$1.keyword,UnaryQueryOp:tags$1.operatorKeyword,"CallTag ValueName":tags$1.atom,VariableName:tags$1.variableName,Callee:tags$1.operatorKeyword,Unit:tags$1.unit,"UniversalSelector NestingSelector":tags$1.definitionOperator,MatchOp:tags$1.compareOperator,"ChildOp SiblingOp, LogicOp":tags$1.logicOperator,BinOp:tags$1.arithmeticOperator,Important:tags$1.modifier,Comment:tags$1.blockComment,ColorLiteral:tags$1.color,"ParenthesizedContent StringLiteral":tags$1.string,":":tags$1.punctuation,"PseudoOp #":tags$1.derefOperator,"; ,":tags$1.separator,"( )":tags$1.paren,"[ ]":tags$1.squareBracket,"{ }":tags$1.brace}),spec_callee={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},spec_AtKeyword={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},spec_identifier={__proto__:null,not:128,only:128},parser=LRParser.deserialize({version:14,states:"9bQYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DPO$vQ[O'#DTOOQP'#Ej'#EjO${QdO'#DeO%gQ[O'#DrO${QdO'#DtO%xQ[O'#DvO&TQ[O'#DyO&]Q[O'#EPO&kQ[O'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'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!W^Oy%^z;'S%^;'S;=`%o<%lO%^dCoSzSOy%^z;'S%^;'S;=`%o<%lO%^bDQU|QOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS|Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[!YQo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bFfSxQOy%^z;'S%^;'S;=`%o<%lO%^lFwSv[Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!`Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!RUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!Q^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!PQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[descendant,unitToken,identifiers,1,2,3,4,new LocalTokenGroup("m~RRYZ[z{a~~g~aO#Z~~dP!P!Qg~lO#[~~",28,102)],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:97,get:s=>spec_callee[s]||-1},{term:56,get:s=>spec_AtKeyword[s]||-1},{term:98,get:s=>spec_identifier[s]||-1}],tokenPrec:1169});let _properties=null;function properties(){if(!_properties&&typeof document=="object"&&document.body){let{style:s}=document.body,e=[],r=new Set;for(let n in s)n!="cssText"&&n!="cssFloat"&&typeof s[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,o=>"-"+o.toLowerCase())),r.has(n)||(e.push(n),r.add(n)));_properties=e.sort().map(n=>({type:"property",label:n}))}return _properties||[]}const pseudoClasses=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(s=>({type:"class",label:s})),values=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(s=>({type:"keyword",label:s})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(s=>({type:"constant",label:s}))),tags=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(s=>({type:"type",label:s})),identifier$1=/^(\w[\w-]*|-\w[\w-]*|)$/,variable=/^-(-[\w-]*)?$/;function isVarArg(s,e){var r;if((s.name=="("||s.type.isError)&&(s=s.parent||s),s.name!="ArgList")return!1;let n=(r=s.parent)===null||r===void 0?void 0:r.firstChild;return(n==null?void 0:n.name)!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}const VariablesByNode=new NodeWeakMap,declSelector=["Declaration"];function astTop(s){for(let e=s;;){if(e.type.isTop)return e;if(!(e=e.parent))return s}}function variableNames(s,e,r){if(e.to-e.from>4096){let n=VariablesByNode.get(e);if(n)return n;let o=[],a=new Set,l=e.cursor(IterMode.IncludeAnonymous);if(l.firstChild())do for(let c of variableNames(s,l.node,r))a.has(c.label)||(a.add(c.label),o.push(c));while(l.nextSibling());return VariablesByNode.set(e,o),o}else{let n=[],o=new Set;return e.cursor().iterate(a=>{var l;if(r(a)&&a.matchContext(declSelector)&&((l=a.node.nextSibling)===null||l===void 0?void 0:l.name)==":"){let c=s.sliceString(a.from,a.to);o.has(c)||(o.add(c),n.push({label:c,type:"variable"}))}}),n}}const defineCSSCompletionSource=s=>e=>{let{state:r,pos:n}=e,o=syntaxTree(r).resolveInner(n,-1),a=o.type.isError&&o.from==o.to-1&&r.doc.sliceString(o.from,o.to)=="-";if(o.name=="PropertyName"||(a||o.name=="TagName")&&/^(Block|Styles)$/.test(o.resolve(o.to).name))return{from:o.from,options:properties(),validFor:identifier$1};if(o.name=="ValueName")return{from:o.from,options:values,validFor:identifier$1};if(o.name=="PseudoClassName")return{from:o.from,options:pseudoClasses,validFor:identifier$1};if(s(o)||(e.explicit||a)&&isVarArg(o,r.doc))return{from:s(o)||a?o.from:n,options:variableNames(r.doc,astTop(o),s),validFor:variable};if(o.name=="TagName"){for(let{parent:h}=o;h;h=h.parent)if(h.name=="Block")return{from:o.from,options:properties(),validFor:identifier$1};return{from:o.from,options:tags,validFor:identifier$1}}if(!e.explicit)return null;let l=o.resolve(n),c=l.childBefore(n);return c&&c.name==":"&&l.name=="PseudoClassSelector"?{from:n,options:pseudoClasses,validFor:identifier$1}:c&&c.name==":"&&l.name=="Declaration"||l.name=="ArgList"?{from:n,options:values,validFor:identifier$1}:l.name=="Block"||l.name=="Styles"?{from:n,options:properties(),validFor:identifier$1}:null},cssCompletionSource=defineCSSCompletionSource(s=>s.name=="VariableName"),cssLanguage=LRLanguage.define({name:"css",parser:parser.configure({props:[indentNodeProp.add({Declaration:continuedIndent()}),foldNodeProp.add({Block:foldInside})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function css(){return new LanguageSupport(cssLanguage,cssLanguage.data.of({autocomplete:cssCompletionSource}))}const Targets=["_blank","_self","_top","_parent"],Charsets=["ascii","utf-8","utf-16","latin1","latin1"],Methods=["get","post","put","delete"],Encs=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Bool=["true","false"],S={},Tags={a:{attrs:{href:null,ping:null,type:null,media:null,target:Targets,hreflang:null}},abbr:S,address:S,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:S,aside:S,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:S,base:{attrs:{href:null,target:Targets}},bdi:S,bdo:S,blockquote:{attrs:{cite:null}},body:S,br:S,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Encs,formmethod:Methods,formnovalidate:["novalidate"],formtarget:Targets,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:S,center:S,cite:S,code:S,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:S,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:S,div:S,dl:S,dt:S,em:S,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:S,figure:S,footer:S,form:{attrs:{action:null,name:null,"accept-charset":Charsets,autocomplete:["on","off"],enctype:Encs,method:Methods,novalidate:["novalidate"],target:Targets}},h1:S,h2:S,h3:S,h4:S,h5:S,h6:S,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:S,hgroup:S,hr:S,html:{attrs:{manifest:null}},i:S,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Encs,formmethod:Methods,formnovalidate:["novalidate"],formtarget:Targets,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:S,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:S,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:S,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Charsets,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:S,noscript:S,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:S,param:{attrs:{name:null,value:null}},pre:S,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:S,rt:S,ruby:S,samp:S,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Charsets}},section:S,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:S,source:{attrs:{src:null,type:null,media:null}},span:S,strong:S,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:S,summary:S,sup:S,table:S,tbody:S,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:S,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:S,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:S,time:{attrs:{datetime:null}},title:S,tr:S,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:S,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:S},GlobalAttrs={accesskey:null,class:null,contenteditable:Bool,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Bool,autocorrect:Bool,autocapitalize:Bool,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Bool,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Bool,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Bool,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Bool,"aria-hidden":Bool,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Bool,"aria-multiselectable":Bool,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Bool,"aria-relevant":null,"aria-required":Bool,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},eventAttributes="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(s=>"on"+s);for(let s of eventAttributes)GlobalAttrs[s]=null;class Schema{constructor(e,r){this.tags=Object.assign(Object.assign({},Tags),e),this.globalAttrs=Object.assign(Object.assign({},GlobalAttrs),r),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Schema.default=new Schema;function elementName(s,e,r=s.length){if(!e)return"";let n=e.firstChild,o=n&&n.getChild("TagName");return o?s.sliceString(o.from,Math.min(o.to,r)):""}function findParentElement(s,e=!1){for(;s;s=s.parent)if(s.name=="Element")if(e)e=!1;else return s;return null}function allowedChildren(s,e,r){let n=r.tags[elementName(s,findParentElement(e))];return(n==null?void 0:n.children)||r.allTags}function openTags(s,e){let r=[];for(let n=findParentElement(e);n&&!n.type.isTop;n=findParentElement(n.parent)){let o=elementName(s,n);if(o&&n.lastChild.name=="CloseTag")break;o&&r.indexOf(o)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&r.push(o)}return r}const identifier=/^[:\-\.\w\u00b7-\uffff]*$/;function completeTag(s,e,r,n,o){let a=/\s*>/.test(s.sliceDoc(o,o+5))?"":">",l=findParentElement(r,!0);return{from:n,to:o,options:allowedChildren(s.doc,l,e).map(c=>({label:c,type:"type"})).concat(openTags(s.doc,r).map((c,h)=>({label:"/"+c,apply:"/"+c+a,type:"type",boost:99-h}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeCloseTag(s,e,r,n){let o=/\s*>/.test(s.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:openTags(s.doc,e).map((a,l)=>({label:a,apply:a+o,type:"type",boost:99-l})),validFor:identifier}}function completeStartTag(s,e,r,n){let o=[],a=0;for(let l of allowedChildren(s.doc,r,e))o.push({label:"<"+l,type:"type"});for(let l of openTags(s.doc,r))o.push({label:"",type:"type",boost:99-a++});return{from:n,to:n,options:o,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeAttrName(s,e,r,n,o){let a=findParentElement(r),l=a?e.tags[elementName(s.doc,a)]:null,c=l&&l.attrs?Object.keys(l.attrs):[],h=l&&l.globalAttrs===!1?c:c.length?c.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:o,options:h.map(f=>({label:f,type:"property"})),validFor:identifier}}function completeAttrValue(s,e,r,n,o){var a;let l=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),c=[],h;if(l){let f=s.sliceDoc(l.from,l.to),d=e.globalAttrs[f];if(!d){let m=findParentElement(r),v=m?e.tags[elementName(s.doc,m)]:null;d=(v==null?void 0:v.attrs)&&v.attrs[f]}if(d){let m=s.sliceDoc(n,o).toLowerCase(),v='"',A='"';/^['"]/.test(m)?(h=m[0]=='"'?/^[^"]*$/:/^[^']*$/,v="",A=s.sliceDoc(o,o+1)==m[0]?"":m[0],m=m.slice(1),n++):h=/^[^\s<>='"]*$/;for(let T of d)c.push({label:T,apply:v+T+A,type:"constant"})}}return{from:n,to:o,options:c,validFor:h}}function htmlCompletionFor(s,e){let{state:r,pos:n}=e,o=syntaxTree(r).resolveInner(n,-1),a=o.resolve(n);for(let l=n,c;a==o&&(c=o.childBefore(l));){let h=c.lastChild;if(!h||!h.type.isError||h.fromhtmlCompletionFor(n,o)}const defaultNesting=[{tag:"script",attrs:s=>s.type=="text/typescript"||s.lang=="ts",parser:typescriptLanguage.parser},{tag:"script",attrs:s=>s.type=="text/babel"||s.type=="text/jsx",parser:jsxLanguage.parser},{tag:"script",attrs:s=>s.type=="text/typescript-jsx",parser:tsxLanguage.parser},{tag:"script",attrs(s){return!s.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(s.type)},parser:javascriptLanguage.parser},{tag:"style",attrs(s){return(!s.lang||s.lang=="css")&&(!s.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(s.type))},parser:cssLanguage.parser}],defaultAttrs=[{name:"style",parser:cssLanguage.parser.configure({top:"Styles"})}].concat(eventAttributes.map(s=>({name:s,parser:javascriptLanguage.parser}))),htmlPlain=LRLanguage.define({name:"html",parser:parser$1.configure({props:[indentNodeProp.add({Element(s){let e=/^(\s*)(<\/)?/.exec(s.textAfter);return s.node.to<=s.pos+e[0].length?s.continue():s.lineIndent(s.node.from)+(e[2]?0:s.unit)},"OpenTag CloseTag SelfClosingTag"(s){return s.column(s.node.from)+s.unit},Document(s){if(s.pos+/\s*/.exec(s.textAfter)[0].lengths.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),htmlLanguage=htmlPlain.configure({wrap:configureNesting(defaultNesting,defaultAttrs)});function html(s={}){let e="",r;s.matchClosingTags===!1&&(e="noMatch"),s.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(s.nestedLanguages&&s.nestedLanguages.length||s.nestedAttributes&&s.nestedAttributes.length)&&(r=configureNesting((s.nestedLanguages||[]).concat(defaultNesting),(s.nestedAttributes||[]).concat(defaultAttrs)));let n=r?htmlPlain.configure({wrap:r,dialect:e}):e?htmlLanguage.configure({dialect:e}):htmlLanguage;return new LanguageSupport(n,[htmlLanguage.data.of({autocomplete:htmlCompletionSourceWith(s)}),s.autoCloseTags!==!1?autoCloseTags:[],javascript().support,css().support])}const selfClosers=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),autoCloseTags=EditorView.inputHandler.of((s,e,r,n)=>{if(s.composing||s.state.readOnly||e!=r||n!=">"&&n!="/"||!htmlLanguage.isActiveAt(s.state,e,-1))return!1;let{state:o}=s,a=o.changeByRange(l=>{var c,h,f;let{head:d}=l,m=syntaxTree(o).resolveInner(d,-1),v;if((m.name=="TagName"||m.name=="StartTag")&&(m=m.parent),n==">"&&m.name=="OpenTag"){if(((h=(c=m.parent)===null||c===void 0?void 0:c.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(v=elementName(o.doc,m.parent,d))&&!selfClosers.has(v)){let A=s.state.doc.sliceString(d,d+1)===">",T=`${A?"":">"}`;return{range:EditorSelection.cursor(d+1),changes:{from:d+(A?1:0),insert:T}}}}else if(n=="/"&&m.name=="OpenTag"){let A=m.parent,T=A==null?void 0:A.parent;if(A.from==d-1&&((f=T.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(v=elementName(o.doc,T,d))&&!selfClosers.has(v)){let B=s.state.doc.sliceString(d,d+1)===">",Y=`/${v}${B?"":">"}`,F=d+Y.length+(B?1:0);return{range:EditorSelection.cursor(F),changes:{from:d,insert:Y}}}}return{range:l}});return a.changes.empty?!1:(s.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)}),data=defineLanguageFacet({commentTokens:{block:{open:""}}}),headingProp=new NodeProp,commonmark=parser$2.configure({props:[foldNodeProp.add(s=>!s.is("Block")||s.is("Document")||isHeading(s)!=null?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),headingProp.add(isHeading),indentNodeProp.add({Document:()=>null}),languageDataProp.add({Document:data})]});function isHeading(s){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(s.name);return e?+e[1]:void 0}function findSectionEnd(s,e){let r=s;for(;;){let n=r.nextSibling,o;if(!n||(o=isHeading(n.type))!=null&&o<=e)break;r=n}return r.to}const headerIndent=foldService.of((s,e,r)=>{for(let n=syntaxTree(s).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:a}}return null});function mkLang(s){return new Language(data,s,[headerIndent],"markdown")}const commonmarkLanguage=mkLang(commonmark),extended=commonmark.configure([GFM,Subscript,Superscript,Emoji]),markdownLanguage=mkLang(extended);function getCodeParser(s,e){return r=>{if(r&&s){let n=null;if(r=/\S*/.exec(r)[0],typeof s=="function"?n=s(r):n=LanguageDescription.matchLanguageName(s,r,!0),n instanceof LanguageDescription)return n.support?n.support.language.parser:ParseContext.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class Context{constructor(e,r,n,o,a,l,c){this.node=e,this.from=r,this.to=n,this.spaceBefore=o,this.spaceAfter=a,this.type=l,this.item=c}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;o--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+itemNumber(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function getContext(s,e){let r=[];for(let o=s;o&&o.name!="Document";o=o.parent)(o.name=="ListItem"||o.name=="Blockquote"||o.name=="FencedCode")&&r.push(o);let n=[];for(let o=r.length-1;o>=0;o--){let a=r[o],l,c=e.lineAt(a.from),h=a.from-c.from;if(a.name=="FencedCode")n.push(new Context(a,h,h,"","","",null));else if(a.name=="Blockquote"&&(l=/^[ \t]*>( ?)/.exec(c.text.slice(h))))n.push(new Context(a,h,h+l[0].length,"",l[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(l=/^([ \t]*)\d+([.)])([ \t]*)/.exec(c.text.slice(h)))){let f=l[3],d=l[0].length;f.length>=4&&(f=f.slice(0,f.length-4),d-=4),n.push(new Context(a.parent,h,h+d,l[1],f,l[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(l=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(c.text.slice(h)))){let f=l[4],d=l[0].length;f.length>4&&(f=f.slice(0,f.length-4),d-=4);let m=l[2];l[3]&&(m+=l[3].replace(/[xX]/," ")),n.push(new Context(a.parent,h,h+d,l[1],f,m,a))}}return n}function itemNumber(s,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(s.from,s.from+10))}function renumberList(s,e,r,n=0){for(let o=-1,a=s;;){if(a.name=="ListItem"){let c=itemNumber(a,e),h=+c[2];if(o>=0){if(h!=o+1)return;r.push({from:a.from+c[1].length,to:a.from+c[0].length,insert:String(o+2+n)})}o=h}let l=a.nextSibling;if(!l)break;a=l}}const insertNewlineContinueMarkup=({state:s,dispatch:e})=>{let r=syntaxTree(s),{doc:n}=s,o=null,a=s.changeByRange(l=>{if(!l.empty||!markdownLanguage.isActiveAt(s,l.from))return o={range:l};let c=l.from,h=n.lineAt(c),f=getContext(r.resolveInner(c,-1),n);for(;f.length&&f[f.length-1].from>c-h.from;)f.pop();if(!f.length)return o={range:l};let d=f[f.length-1];if(d.to-d.spaceAfter.length>c-h.from)return o={range:l};let m=c>=d.to-d.spaceAfter.length&&!/\S/.test(h.text.slice(d.to));if(d.item&&m)if(d.node.firstChild.to>=c||h.from>0&&!/[^\s>]/.test(n.lineAt(h.from-1).text)){let Y=f.length>1?f[f.length-2]:null,F,ke="";Y&&Y.item?(F=h.from+Y.from,ke=Y.marker(n,1)):F=h.from+(Y?Y.to:0);let Qe=[{from:F,to:c,insert:ke}];return d.node.name=="OrderedList"&&renumberList(d.item,n,Qe,-2),Y&&Y.node.name=="OrderedList"&&renumberList(Y.item,n,Qe),{range:EditorSelection.cursor(F+ke.length),changes:Qe}}else{let Y="";for(let F=0,ke=f.length-2;F<=ke;F++)Y+=f[F].blank(F\s*$/.exec(Y.text);if(F&&F.index==d.from){let ke=s.changes([{from:Y.from+F.index,to:Y.to},{from:h.from+d.from,to:h.to}]);return{range:l.map(ke),changes:ke}}}let v=[];d.node.name=="OrderedList"&&renumberList(d.item,n,v);let A=d.item&&d.item.from]*/.exec(h.text)[0].length>=d.to)for(let Y=0,F=f.length-1;Y<=F;Y++)T+=Y==F&&!A?f[Y].marker(n,1):f[Y].blank(Yh.from&&/\s/.test(h.text.charAt(B-h.from-1));)B--;return T=s.lineBreak+T,v.push({from:B,to:c,insert:T}),{range:EditorSelection.cursor(B+T.length),changes:v}});return o?!1:(e(s.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)};function isMark(s){return s.name=="QuoteMark"||s.name=="ListMark"}function contextNodeForDelete(s,e){let r=s.resolveInner(e,-1),n=e;isMark(r)&&(n=r.from,r=r.parent);for(let o;o=r.childBefore(n);)if(isMark(o))n=o.from;else if(o.name=="OrderedList"||o.name=="BulletList")r=o.lastChild,n=r.to;else break;return r}const deleteMarkupBackward=({state:s,dispatch:e})=>{let r=syntaxTree(s),n=null,o=s.changeByRange(a=>{let l=a.from,{doc:c}=s;if(a.empty&&markdownLanguage.isActiveAt(s,a.from)){let h=c.lineAt(l),f=getContext(contextNodeForDelete(r,l),c);if(f.length){let d=f[f.length-1],m=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(l-h.from>m&&!/\S/.test(h.text.slice(m,l-h.from)))return{range:EditorSelection.cursor(h.from+m),changes:{from:h.from+m,to:l}};if(l-h.from==m&&(!d.item||h.from<=d.item.from||!/\S/.test(h.text.slice(0,d.to)))){let v=h.from+d.from;if(d.item&&d.node.from .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:selection},".cm-panels":{backgroundColor:darkBackground,color:ivory},".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:background,color:stone,border:"none"},".cm-activeLineGutter":{backgroundColor:highlightBackground},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:tooltipBackground},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:tooltipBackground,borderBottomColor:tooltipBackground},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:highlightBackground,color:ivory}}},{dark:!0}),oneDarkHighlightStyle=HighlightStyle.define([{tag:tags$1.keyword,color:violet},{tag:[tags$1.name,tags$1.deleted,tags$1.character,tags$1.propertyName,tags$1.macroName],color:coral},{tag:[tags$1.function(tags$1.variableName),tags$1.labelName],color:malibu},{tag:[tags$1.color,tags$1.constant(tags$1.name),tags$1.standard(tags$1.name)],color:whiskey},{tag:[tags$1.definition(tags$1.name),tags$1.separator],color:ivory},{tag:[tags$1.typeName,tags$1.className,tags$1.number,tags$1.changed,tags$1.annotation,tags$1.modifier,tags$1.self,tags$1.namespace],color:chalky},{tag:[tags$1.operator,tags$1.operatorKeyword,tags$1.url,tags$1.escape,tags$1.regexp,tags$1.link,tags$1.special(tags$1.string)],color:cyan},{tag:[tags$1.meta,tags$1.comment],color:stone},{tag:tags$1.strong,fontWeight:"bold"},{tag:tags$1.emphasis,fontStyle:"italic"},{tag:tags$1.strikethrough,textDecoration:"line-through"},{tag:tags$1.link,color:stone,textDecoration:"underline"},{tag:tags$1.heading,fontWeight:"bold",color:coral},{tag:[tags$1.atom,tags$1.bool,tags$1.special(tags$1.variableName)],color:whiskey},{tag:[tags$1.processingInstruction,tags$1.string,tags$1.inserted],color:sage},{tag:tags$1.invalid,color:invalid}]),oneDark=[oneDarkTheme,syntaxHighlighting(oneDarkHighlightStyle)];function initVim(s){var e=s.Pos;function r(u,p){var g=u.state.vim;if(!g||g.insertMode)return p.head;var y=g.sel.head;if(!y)return p.head;if(!(g.visualBlock&&p.head.line!=y.line))return p.from()==p.anchor&&!p.empty()&&p.head.line==y.line&&p.head.ch!=y.ch?new e(p.head.line,p.head.ch-1):p.head}function n(u,p,g){if(p.line===g.line&&p.ch>=g.ch-1){var y=u.getLine(p.line),b=y.charCodeAt(p.ch);55296<=b&&b<=55551&&(g.ch+=1)}return{start:p,end:g}}var o=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],a=o.length,l=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}];function c(u){u.setOption("disableInput",!0),u.setOption("showCursorWhenSelecting",!1),s.signal(u,"vim-mode-change",{mode:"normal"}),u.on("cursorActivity",un),$i(u),s.on(u.getInputField(),"paste",Y(u))}function h(u){u.setOption("disableInput",!1),u.off("cursorActivity",un),s.off(u.getInputField(),"paste",Y(u)),u.state.vim=null,kr&&clearTimeout(kr)}function f(u,p){this==s.keyMap.vim&&(u.options.$customCursor=null,s.rmClass(u.getWrapperElement(),"cm-fat-cursor")),(!p||p.attach!=d)&&h(u)}function d(u,p){this==s.keyMap.vim&&(u.curOp&&(u.curOp.selectionChanged=!0),u.options.$customCursor=r,s.addClass(u.getWrapperElement(),"cm-fat-cursor")),(!p||p.attach!=d)&&c(u)}s.defineOption("vimMode",!1,function(u,p,g){p&&u.getOption("keyMap")!="vim"?u.setOption("keyMap","vim"):!p&&g!=s.Init&&/^vim/.test(u.getOption("keyMap"))&&u.setOption("keyMap","default")});function m(u,p){if(p){if(this[u])return this[u];var g=B(u);if(!g)return!1;var y=Tt.findKey(p,g);return typeof y=="function"&&s.signal(p,"vim-keypress",g),y}}var v={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},A={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},T={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(A)).forEach(function(u){T[(A[u]||"").toLowerCase()]=T[u.toLowerCase()]=u});function B(u){if(u.charAt(0)=="'")return u.charAt(1);var p=u.split(/-(?!$)/),g=p[p.length-1];if(p.length==1&&p[0].length==1)return!1;if(p.length==2&&p[0]=="Shift"&&g.length==1)return!1;for(var y=!1,b=0;b"):!1}function Y(u){var p=u.state.vim;return p.onPasteFn||(p.onPasteFn=function(){p.insertMode||(u.setCursor(wt(u.getCursor(),0,1)),mi.enterInsertMode(u,{},p))}),p.onPasteFn}var F=/[\d]/,ke=[s.isWordChar,function(u){return u&&!s.isWordChar(u)&&!/\s/.test(u)}],Qe=[function(u){return/\S/.test(u)}];function xe(u,p){for(var g=[],y=u;y"]),Fe=[].concat(Te,Le,Me,["-",'"',".",":","_","/","+"]),Ve;try{Ve=new RegExp("^[\\p{Lu}]$","u")}catch{Ve=/^[A-Z]$/}function at(u,p){return p>=u.firstLine()&&p<=u.lastLine()}function dt(u){return/^[a-z]$/.test(u)}function ct(u){return"()[]{}".indexOf(u)!=-1}function nt(u){return F.test(u)}function ft(u){return Ve.test(u)}function it(u){return/^\s*$/.test(u)}function pt(u){return".?!".indexOf(u)!=-1}function lt(u,p){for(var g=0;gg?p=g:p0?1:-1,Pe,Oe=R.getCursor();do if(p+=$e,Z=b[(u+p)%u],Z&&(Pe=Z.find())&&!H(Oe,Pe))break;while(py)}return Z}function M(R,V){var Z=p,$e=P(R,V);return p=Z,$e&&$e.find()}return{cachedCursor:void 0,add:I,find:M,move:P}},Oi=function(u){return u?{changes:u.changes,expectCursorActivityForChange:u.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function Fi(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=Oi()}Fi.prototype={exitMacroRecordMode:function(){var u=Ye.macroModeState;u.onRecordingDone&&u.onRecordingDone(),u.onRecordingDone=void 0,u.isRecording=!1},enterMacroRecordMode:function(u,p){var g=Ye.registerController.getRegister(p);if(g){if(g.clear(),this.latestRegister=p,u.openDialog){var y=vi("span",{class:"cm-vim-message"},"recording @"+p);this.onRecordingDone=u.openDialog(y,null,{bottom:!0})}this.isRecording=!0}}};function $i(u){return u.state.vim||(u.state.vim={inputState:new Mi,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),u.state.vim}var Ye;function hr(){Ye={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:gi(),macroModeState:new Fi,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new fr({}),searchHistoryController:new qi,exCommandHistoryController:new qi};for(var u in st){var p=st[u];p.value=p.defaultValue}}var xi,Tt={enterVimMode:c,leaveVimMode:h,buildKeyMap:function(){},getRegisterController:function(){return Ye.registerController},resetVimGlobalState_:hr,getVimGlobalState_:function(){return Ye},maybeInitVimState_:$i,suppressErrorLogging:!1,InsertModeKey:Wr,map:function(u,p,g){ei.map(u,p,g)},unmap:function(u,p){return ei.unmap(u,p)},noremap:function(u,p,g){ei.map(u,p,g,!0)},mapclear:function(u){var p=o.length,g=a,y=o.slice(0,p-g);if(o=o.slice(p-g),u)for(var b=y.length-1;b>=0;b--){var I=y[b];if(u!==I.context)if(I.context)this._mapCommand(I);else{var P=["normal","insert","visual"];for(var M in P)if(P[M]!==u){var R={};for(var V in I)R[V]=I[V];R.context=P[M],this._mapCommand(R)}}}},setOption:Vt,getOption:Yt,defineOption:mt,defineEx:function(u,p,g){if(!p)p=u;else if(u.indexOf(p)!==0)throw new Error('(Vim.defineEx) "'+p+'" is not a prefix of "'+u+'", command not registered');ln[u]=g,ei.commandMap_[p]={name:u,shortName:p,type:"api"}},handleKey:function(u,p,g){var y=this.findKey(u,p,g);if(typeof y=="function")return y()},multiSelectHandleKey:Mn,findKey:function(u,p,g){var y=$i(u);function b(){var V=Ye.macroModeState;if(V.isRecording){if(p=="q")return V.exitMacroRecordMode(),Lt(u),!0;g!="mapping"&&Ln(V,p)}}function I(){if(p==""){if(y.visualMode)Ht(u);else if(y.insertMode)Ci(u);else return;return Lt(u),!0}}function P(){if(I())return!0;y.inputState.keyBuffer.push(p);var V=y.inputState.keyBuffer.join(""),Z=p.length==1,$e=ui.matchCommand(V,o,y.inputState,"insert"),Pe=y.inputState.changeQueue;if($e.type=="none")return Lt(u),!1;if($e.type=="partial"){if(xi&&window.clearTimeout(xi),xi=Z&&window.setTimeout(function(){y.insertMode&&y.inputState.keyBuffer.length&&Lt(u)},Yt("insertModeEscKeysTimeout")),Z){var Oe=u.listSelections();(!Pe||Pe.removed.length!=Oe.length)&&(Pe=y.inputState.changeQueue=new ur),Pe.inserted+=p;for(var oe=0;oe|./gi,I;I=b.exec(p);){var P=I[0],M=y.insertMode,R=Tt.handleKey(u,P,"mapping");if(!R&&M&&y.insertMode){if(P[0]=="<"){var Z=P.toLowerCase().slice(1,-1),V=Z.split("-"),Z=V.pop();if(Z=="lt")P="<";else if(Z=="space")P=" ";else if(Z=="cr")P=` `;else if(T.hasOwnProperty(Z)){P=T[Z],gn(u,P);continue}else P=P[0],b.lastIndex=I.index+1}u.replaceSelection(P)}}}finally{zi=!1,Ui.length=0}}function Mi(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null,this.changeQueue=null}Mi.prototype.pushRepeatDigit=function(u){this.operator?this.motionRepeat=this.motionRepeat.concat(u):this.prefixRepeat=this.prefixRepeat.concat(u)},Mi.prototype.getRepeat=function(){var u=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(u=1,this.prefixRepeat.length>0&&(u*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(u*=parseInt(this.motionRepeat.join(""),10))),u};function Lt(u,p){u.state.vim.inputState=new Mi,s.signal(u,"vim-command-done",p)}function ur(){this.removed=[],this.inserted=""}function Gt(u,p,g){this.clear(),this.keyBuffer=[u||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!p,this.blockwise=!!g}Gt.prototype={setText:function(u,p,g){this.keyBuffer=[u||""],this.linewise=!!p,this.blockwise=!!g},pushText:function(u,p){p&&(this.linewise||this.keyBuffer.push(` `),this.linewise=!0),this.keyBuffer.push(u)},pushInsertModeChanges:function(u){this.insertModeChanges.push(Oi(u))},pushSearchQuery:function(u){this.searchQueries.push(u)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};function Lr(u,p){var g=Ye.registerController.registers;if(!u||u.length!=1)throw Error("Register name must be 1 character");if(g[u])throw Error("Register already defined "+u);g[u]=p,Fe.push(u)}function fr(u){this.registers=u,this.unnamedRegister=u['"']=new Gt,u["."]=new Gt,u[":"]=new Gt,u["/"]=new Gt,u["+"]=new Gt}fr.prototype={pushText:function(u,p,g,y,b){if(u!=="_"){y&&g.charAt(g.length-1)!==` `&&(g+=` `);var I=this.isValidRegister(u)?this.getRegister(u):null;if(!I){switch(p){case"yank":this.registers[0]=new Gt(g,y,b);break;case"delete":case"change":g.indexOf(` -`)==-1?this.registers["-"]=new Gt(g,y):(this.shiftNumericRegisters_(),this.registers[1]=new Gt(g,y));break}this.unnamedRegister.setText(g,y,b);return}var P=ft(u);P?I.pushText(g,y):I.setText(g,y,b),u==="+"&&navigator.clipboard.writeText(g),this.unnamedRegister.setText(I.toString(),y)}},getRegister:function(u){return this.isValidRegister(u)?(u=u.toLowerCase(),this.registers[u]||(this.registers[u]=new Gt),this.registers[u]):this.unnamedRegister},isValidRegister:function(u){return u&<(u,Fe)},shiftNumericRegisters_:function(){for(var u=9;u>=2;u--)this.registers[u]=this.getRegister(""+(u-1))}};function qi(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}qi.prototype={nextMatch:function(u,p){var g=this.historyBuffer,y=p?-1:1;this.initialPrefix===null&&(this.initialPrefix=u);for(var b=this.iterator+y;p?b>=0:b=g.length)return this.iterator=g.length,this.initialPrefix;if(b<0)return u},pushInput:function(u){var p=this.historyBuffer.indexOf(u);p>-1&&this.historyBuffer.splice(p,1),u.length&&this.historyBuffer.push(u)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var ui={matchCommand:function(u,p,g,y){var b=Er(u,p,y,g);if(!b.full&&!b.partial)return{type:"none"};if(!b.full&&b.partial)return{type:"partial"};for(var I,P=0;P"){var R=Yr(u);if(!R||R.length>1)return{type:"clear"};g.selectedCharacter=R}return{type:"full",command:I}},processCommand:function(u,p,g){switch(p.inputState.repeatOverride=g.repeatOverride,g.type){case"motion":this.processMotion(u,p,g);break;case"operator":this.processOperator(u,p,g);break;case"operatorMotion":this.processOperatorMotion(u,p,g);break;case"action":this.processAction(u,p,g);break;case"search":this.processSearch(u,p,g);break;case"ex":case"keyToEx":this.processEx(u,p,g);break}},processMotion:function(u,p,g){p.inputState.motion=g.motion,p.inputState.motionArgs=Ei(g.motionArgs),this.evalInput(u,p)},processOperator:function(u,p,g){var y=p.inputState;if(y.operator)if(y.operator==g.operator){y.motion="expandToLine",y.motionArgs={linewise:!0},this.evalInput(u,p);return}else Lt(u);y.operator=g.operator,y.operatorArgs=Ei(g.operatorArgs),g.keys.length>1&&(y.operatorShortcut=g.keys),g.exitVisualBlock&&(p.visualBlock=!1,li(u)),p.visualMode&&this.evalInput(u,p)},processOperatorMotion:function(u,p,g){var y=p.visualMode,b=Ei(g.operatorMotionArgs);b&&y&&b.visualLine&&(p.visualLine=!0),this.processOperator(u,p,g),y||this.processMotion(u,p,g)},processAction:function(u,p,g){var y=p.inputState,b=y.getRepeat(),I=!!b,P=Ei(g.actionArgs)||{};y.selectedCharacter&&(P.selectedCharacter=y.selectedCharacter),g.operator&&this.processOperator(u,p,g),g.motion&&this.processMotion(u,p,g),(g.motion||g.operator)&&this.evalInput(u,p),P.repeat=b||1,P.repeatIsExplicit=I,P.registerName=y.registerName,Lt(u),p.lastMotion=null,g.isEdit&&this.recordLastEdit(p,y,g),mi[g.action](u,P,p)},processSearch:function(u,p,g){if(!u.getSearchCursor)return;var y=g.searchArgs.forward,b=g.searchArgs.wholeWordOnly;Oe(u).setReversed(!y);var I=y?"/":"?",P=Oe(u).getQuery(),M=u.getScrollInfo();function R(Re,He,ze){Ye.searchHistoryController.pushInput(Re),Ye.searchHistoryController.reset();try{rr(u,Re,He,ze)}catch{Ot(u,"Invalid regex: "+Re),Lt(u);return}ui.processMotion(u,p,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:g.searchArgs.toJumplist}})}function V(Re){u.scrollTo(M.left,M.top),R(Re,!0,!0);var He=Ye.macroModeState;He.isRecording&&Rn(He,Re)}function Z(Re,He,ze){var Ze=s.keyName(Re),yt,Dt;Ze=="Up"||Ze=="Down"?(yt=Ze=="Up",Dt=Re.target?Re.target.selectionEnd:0,He=Ye.searchHistoryController.nextMatch(He,yt)||"",ze(He),Dt&&Re.target&&(Re.target.selectionEnd=Re.target.selectionStart=Math.min(Dt,Re.target.value.length))):Ze!="Left"&&Ze!="Right"&&Ze!="Ctrl"&&Ze!="Alt"&&Ze!="Shift"&&Ye.searchHistoryController.reset();var It;try{It=rr(u,He,!0,!0)}catch{}It?u.scrollIntoView(nn(u,!y,It),30):(Gr(u),u.scrollTo(M.left,M.top))}function $e(Re,He,ze){var Ze=s.keyName(Re);Ze=="Esc"||Ze=="Ctrl-C"||Ze=="Ctrl-["||Ze=="Backspace"&&He==""?(Ye.searchHistoryController.pushInput(He),Ye.searchHistoryController.reset(),rr(u,P),Gr(u),u.scrollTo(M.left,M.top),s.e_stop(Re),Lt(u),ze(),u.focus()):Ze=="Up"||Ze=="Down"?s.e_stop(Re):Ze=="Ctrl-U"&&(s.e_stop(Re),ze(""))}switch(g.searchArgs.querySrc){case"prompt":var Pe=Ye.macroModeState;if(Pe.isPlaying){var Ne=Pe.replaySearchQueries.shift();R(Ne,!0,!1)}else wr(u,{onClose:V,prefix:I,desc:"(JavaScript regexp)",onKeyUp:Z,onKeyDown:$e});break;case"wordUnderCursor":var oe=Bi(u,!1,!1,!1,!0),K=!0;if(oe||(oe=Bi(u,!1,!1,!1,!1),K=!1),!oe)return;var Ne=u.getLine(oe.start.line).substring(oe.start.ch,oe.end.ch);K&&b?Ne="\\b"+Ne+"\\b":Ne=Yi(Ne),Ye.jumpList.cachedCursor=u.getCursor(),u.setCursor(oe.start),R(Ne,!0,!1);break}},processEx:function(u,p,g){function y(I){Ye.exCommandHistoryController.pushInput(I),Ye.exCommandHistoryController.reset(),ei.processCommand(u,I),u.state.vim&&Lt(u)}function b(I,P,M){var R=s.keyName(I),V,Z;(R=="Esc"||R=="Ctrl-C"||R=="Ctrl-["||R=="Backspace"&&P=="")&&(Ye.exCommandHistoryController.pushInput(P),Ye.exCommandHistoryController.reset(),s.e_stop(I),Lt(u),M(),u.focus()),R=="Up"||R=="Down"?(s.e_stop(I),V=R=="Up",Z=I.target?I.target.selectionEnd:0,P=Ye.exCommandHistoryController.nextMatch(P,V)||"",M(P),Z&&I.target&&(I.target.selectionEnd=I.target.selectionStart=Math.min(Z,I.target.value.length))):R=="Ctrl-U"?(s.e_stop(I),M("")):R!="Left"&&R!="Right"&&R!="Ctrl"&&R!="Alt"&&R!="Shift"&&Ye.exCommandHistoryController.reset()}g.type=="keyToEx"?ei.processCommand(u,g.exArgs.input):p.visualMode?wr(u,{onClose:y,prefix:":",value:"'<,'>",onKeyDown:b,selectValueOnOpen:!1}):wr(u,{onClose:y,prefix:":",onKeyDown:b})},evalInput:function(u,p){var g=p.inputState,y=g.motion,b=g.motionArgs||{},I=g.operator,P=g.operatorArgs||{},M=g.registerName,R=p.sel,V=gt(p.visualMode?Nt(u,R.head):u.getCursor("head")),Z=gt(p.visualMode?Nt(u,R.anchor):u.getCursor("anchor")),$e=gt(V),Pe=gt(Z),oe,K,Ne;if(I&&this.recordLastEdit(p,g),g.repeatOverride!==void 0?Ne=g.repeatOverride:Ne=g.getRepeat(),Ne>0&&b.explicitRepeat?b.repeatIsExplicit=!0:(b.noRepeat||!b.explicitRepeat&&Ne===0)&&(Ne=1,b.repeatIsExplicit=!1),g.selectedCharacter&&(b.selectedCharacter=P.selectedCharacter=g.selectedCharacter),b.repeat=Ne,Lt(u),y){var Re=Kt[y](u,V,b,p,g);if(p.lastMotion=Kt[y],!Re)return;if(b.toJumplist){var He=Ye.jumpList,ze=He.cachedCursor;ze?(Xi(u,ze,Re),delete He.cachedCursor):Xi(u,V,Re)}Re instanceof Array?(K=Re[0],oe=Re[1]):oe=Re,oe||(oe=gt(V)),p.visualMode?(p.visualBlock&&oe.ch===1/0||(oe=Nt(u,oe,$e)),K&&(K=Nt(u,K)),K=K||Pe,R.anchor=K,R.head=oe,li(u),qt(u,p,"<",qe(K,oe)?K:oe),qt(u,p,">",qe(K,oe)?oe:K)):I||(oe=Nt(u,oe,$e),u.setCursor(oe.line,oe.ch))}if(I){if(P.lastSel){K=Pe;var Ze=P.lastSel,yt=Math.abs(Ze.head.line-Ze.anchor.line),Dt=Math.abs(Ze.head.ch-Ze.anchor.ch);Ze.visualLine?oe=new e(Pe.line+yt,Pe.ch):Ze.visualBlock?oe=new e(Pe.line+yt,Pe.ch+Dt):Ze.head.line==Ze.anchor.line?oe=new e(Pe.line,Pe.ch+Dt):oe=new e(Pe.line+yt,Pe.ch),p.visualMode=!0,p.visualLine=Ze.visualLine,p.visualBlock=Ze.visualBlock,R=p.sel={anchor:K,head:oe},li(u)}else p.visualMode&&(P.lastSel={anchor:gt(R.anchor),head:gt(R.head),visualBlock:p.visualBlock,visualLine:p.visualLine});var It,Rt,ht,ut,Xt;if(p.visualMode){It=Qt(R.head,R.anchor),Rt=kt(R.head,R.anchor),ht=p.visualLine||P.linewise,ut=p.visualBlock?"block":ht?"line":"char";var $t=n(u,It,Rt);if(Xt=et(u,{anchor:$t.start,head:$t.end},ut),ht){var xt=Xt.ranges;if(ut=="block")for(var bi=0;biM:Z.lineV&&b.line==V?tr(u,p,g,y,!0):(g.toFirstChar&&(I=Jt(u.getLine(M)),y.lastHPos=I),y.lastHSPos=u.charCoords(new e(M,I),"div").left,new e(M,I))},moveByDisplayLines:function(u,p,g,y){var b=p;switch(y.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:y.lastHSPos=u.charCoords(b,"div").left}var I=g.repeat,P=u.findPosV(b,g.forward?I:-I,"line",y.lastHSPos);if(P.hitSide)if(g.forward)var M=u.charCoords(P,"div"),R={top:M.top+8,left:y.lastHSPos},P=u.coordsChar(R,"div");else{var V=u.charCoords(new e(u.firstLine(),0),"div");V.left=y.lastHSPos,P=u.coordsChar(V,"div")}return y.lastHPos=P.ch,P},moveByPage:function(u,p,g){var y=p,b=g.repeat;return u.findPosV(y,g.forward?b:-b,"page")},moveByParagraph:function(u,p,g){var y=g.forward?1:-1;return Pi(u,p,g.repeat,y)},moveBySentence:function(u,p,g){var y=g.forward?1:-1;return Ir(u,p,g.repeat,y)},moveByScroll:function(u,p,g,y){var b=u.getScrollInfo(),I=null,P=g.repeat;P||(P=b.clientHeight/(2*u.defaultTextHeight()));var M=u.charCoords(p,"local");if(g.repeat=P,I=Kt.moveByDisplayLines(u,p,g,y),!I)return null;var R=u.charCoords(I,"local");return u.scrollTo(null,b.top+R.top-M.top),I},moveByWords:function(u,p,g){return Zr(u,p,g.repeat,!!g.forward,!!g.wordEnd,!!g.bigWord)},moveTillCharacter:function(u,p,g){var y=g.repeat,b=ir(u,y,g.forward,g.selectedCharacter,p),I=g.forward?-1:1;return Si(I,g),b?(b.ch+=I,b):null},moveToCharacter:function(u,p,g){var y=g.repeat;return Si(0,g),ir(u,y,g.forward,g.selectedCharacter,p)||p},moveToSymbol:function(u,p,g){var y=g.repeat;return er(u,y,g.forward,g.selectedCharacter)||p},moveToColumn:function(u,p,g,y){var b=g.repeat;return y.lastHPos=b-1,y.lastHSPos=u.charCoords(p,"div").left,_r(u,b)},moveToEol:function(u,p,g,y){return tr(u,p,g,y,!1)},moveToFirstNonWhiteSpaceCharacter:function(u,p){var g=p;return new e(g.line,Jt(u.getLine(g.line)))},moveToMatchedSymbol:function(u,p){for(var g=p,y=g.line,b=g.ch,I=u.getLine(y),P;b"?/[(){}[\]<>]/:/[(){}[\]]/,V=u.findMatchingBracket(new e(y,b),{bracketRegex:R});return V.to}else return g},moveToStartOfLine:function(u,p){return new e(p.line,0)},moveToLineOrEdgeOfDocument:function(u,p,g){var y=g.forward?u.lastLine():u.firstLine();return g.repeatIsExplicit&&(y=g.repeat-u.getOption("firstLineNumber")),new e(y,Jt(u.getLine(y)))},moveToStartOfDisplayLine:function(u){return u.execCommand("goLineLeft"),u.getCursor()},moveToEndOfDisplayLine:function(u){u.execCommand("goLineRight");var p=u.getCursor();return p.sticky=="before"&&p.ch--,p},textObjectManipulation:function(u,p,g,y){var b={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},I={"'":!0,'"':!0,"`":!0},P=g.selectedCharacter;P=="b"?P="(":P=="B"&&(P="{");var M=!g.textObjectInner,R,V;if(b[P]){if(V=!0,R=Wt(u,p,P,M),!R){var Z=u.getSearchCursor(new RegExp("\\"+P,"g"),p);Z.find()&&(R=Wt(u,Z.from(),P,M))}}else if(I[P])V=!0,R=X(u,p,P,M);else if(P==="W")R=Bi(u,M,!M,!0);else if(P==="w")R=Bi(u,M,!M,!1);else if(P==="p")if(R=Pi(u,p,g.repeat,0,M),g.linewise=!0,y.visualMode)y.visualLine||(y.visualLine=!0);else{var $e=y.inputState.operatorArgs;$e&&($e.linewise=!0),R.end.line--}else if(P==="t")R=Sr(u,p,M);else if(P==="s"){var Pe=u.getLine(p.line);p.ch>0&&pt(Pe[p.ch])&&(p.ch-=1);var oe=br(u,p,g.repeat,1,M),K=br(u,p,g.repeat,-1,M);it(u.getLine(K.line)[K.ch])&&it(u.getLine(oe.line)[oe.ch-1])&&(K={line:K.line,ch:K.ch+1}),R={start:K,end:oe}}return R?u.state.vim.visualMode?mr(u,R.start,R.end,V):[R.start,R.end]:null},repeatLastCharacterSearch:function(u,p,g){var y=Ye.lastCharacterSearch,b=g.repeat,I=g.forward===y.forward,P=(y.increment?1:0)*(I?-1:1);u.moveH(-P,"char"),g.inclusive=!!I;var M=ir(u,b,I,y.selectedCharacter);return M?(M.ch+=P,M):(u.moveH(P,"char"),p)}};function Qr(u,p){Kt[u]=p}function dr(u,p){for(var g=[],y=0;yu.lastLine()&&p.linewise&&!$e?u.replaceRange("",Z,M):u.replaceRange("",P,M),p.linewise&&($e||(u.setCursor(Z),s.commands.newlineAndIndent(u)),P.ch=Number.MAX_VALUE),y=P}Ye.registerController.pushText(p.registerName,"change",b,p.linewise,g.length>1),mi.enterInsertMode(u,{head:y},u.state.vim)},delete:function(u,p,g){var y,b,I=u.state.vim;if(I.visualBlock){b=u.getSelection();var R=dr("",g.length);u.replaceSelections(R),y=Qt(g[0].head,g[0].anchor)}else{var P=g[0].anchor,M=g[0].head;p.linewise&&M.line!=u.firstLine()&&P.line==u.lastLine()&&P.line==M.line-1&&(P.line==u.firstLine()?P.ch=0:P=new e(P.line-1,De(u,P.line-1))),b=u.getRange(P,M),u.replaceRange("",P,M),y=P,p.linewise&&(y=Kt.moveToFirstNonWhiteSpaceCharacter(u,P))}return Ye.registerController.pushText(p.registerName,"delete",b,p.linewise,I.visualBlock),Nt(u,y)},indent:function(u,p,g){var y=u.state.vim;if(u.indentMore)for(var b=y.visualMode?p.repeat:1,I=0;IV.top?(R.line+=(M-V.top)/b,R.line=Math.ceil(R.line),u.setCursor(R),V=u.charCoords(R,"local"),u.scrollTo(null,V.top)):u.scrollTo(null,M);else{var Z=M+u.getScrollInfo().clientHeight;Z=b.anchor.line?I=wt(b.head,0,1):I=new e(b.anchor.line,0)}else if(y=="inplace"){if(g.visualMode)return}else y=="lastEdit"&&(I=sn(u)||I);u.setOption("disableInput",!1),p&&p.replace?(u.toggleOverwrite(!0),u.setOption("keyMap","vim-replace"),s.signal(u,"vim-mode-change",{mode:"replace"})):(u.toggleOverwrite(!1),u.setOption("keyMap","vim-insert"),s.signal(u,"vim-mode-change",{mode:"insert"})),Ye.macroModeState.isPlaying||(u.on("change",hn),g.insertEnd&&g.insertEnd.clear(),g.insertEnd=u.setBookmark(I,{insertLeft:!0}),s.on(u.getInputField(),"keydown",dn)),g.visualMode&&Ht(u),bt(u,I,P)}},toggleVisualMode:function(u,p,g){var y=p.repeat,b=u.getCursor(),I;if(g.visualMode)g.visualLine^p.linewise||g.visualBlock^p.blockwise?(g.visualLine=!!p.linewise,g.visualBlock=!!p.blockwise,s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""}),li(u)):Ht(u);else{g.visualMode=!0,g.visualLine=!!p.linewise,g.visualBlock=!!p.blockwise,I=Nt(u,new e(b.line,b.ch+y-1));var P=n(u,b,I);g.sel={anchor:P.start,head:P.end},s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""}),li(u),qt(u,g,"<",Qt(b,I)),qt(u,g,">",kt(b,I))}},reselectLastSelection:function(u,p,g){var y=g.lastSelection;if(g.visualMode&&Or(u,g),y){var b=y.anchorMark.find(),I=y.headMark.find();if(!b||!I)return;g.sel={anchor:b,head:I},g.visualMode=!0,g.visualLine=y.visualLine,g.visualBlock=y.visualBlock,li(u),qt(u,g,"<",Qt(b,I)),qt(u,g,">",kt(b,I)),s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""})}},joinLines:function(u,p,g){var y,b;if(g.visualMode){if(y=u.getCursor("anchor"),b=u.getCursor("head"),qe(b,y)){var I=b;b=y,y=I}b.ch=De(u,b.line)-1}else{var P=Math.max(p.repeat,2);y=u.getCursor(),b=Nt(u,new e(y.line+P-1,1/0))}for(var M=0,R=y.line;R=2;u--)this.registers[u]=this.getRegister(""+(u-1))}};function qi(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}qi.prototype={nextMatch:function(u,p){var g=this.historyBuffer,y=p?-1:1;this.initialPrefix===null&&(this.initialPrefix=u);for(var b=this.iterator+y;p?b>=0:b=g.length)return this.iterator=g.length,this.initialPrefix;if(b<0)return u},pushInput:function(u){var p=this.historyBuffer.indexOf(u);p>-1&&this.historyBuffer.splice(p,1),u.length&&this.historyBuffer.push(u)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var ui={matchCommand:function(u,p,g,y){var b=Er(u,p,y,g);if(!b.full&&!b.partial)return{type:"none"};if(!b.full&&b.partial)return{type:"partial"};for(var I,P=0;P"){var R=Yr(u);if(!R||R.length>1)return{type:"clear"};g.selectedCharacter=R}return{type:"full",command:I}},processCommand:function(u,p,g){switch(p.inputState.repeatOverride=g.repeatOverride,g.type){case"motion":this.processMotion(u,p,g);break;case"operator":this.processOperator(u,p,g);break;case"operatorMotion":this.processOperatorMotion(u,p,g);break;case"action":this.processAction(u,p,g);break;case"search":this.processSearch(u,p,g);break;case"ex":case"keyToEx":this.processEx(u,p,g);break}},processMotion:function(u,p,g){p.inputState.motion=g.motion,p.inputState.motionArgs=Ei(g.motionArgs),this.evalInput(u,p)},processOperator:function(u,p,g){var y=p.inputState;if(y.operator)if(y.operator==g.operator){y.motion="expandToLine",y.motionArgs={linewise:!0},this.evalInput(u,p);return}else Lt(u);y.operator=g.operator,y.operatorArgs=Ei(g.operatorArgs),g.keys.length>1&&(y.operatorShortcut=g.keys),g.exitVisualBlock&&(p.visualBlock=!1,li(u)),p.visualMode&&this.evalInput(u,p)},processOperatorMotion:function(u,p,g){var y=p.visualMode,b=Ei(g.operatorMotionArgs);b&&y&&b.visualLine&&(p.visualLine=!0),this.processOperator(u,p,g),y||this.processMotion(u,p,g)},processAction:function(u,p,g){var y=p.inputState,b=y.getRepeat(),I=!!b,P=Ei(g.actionArgs)||{};y.selectedCharacter&&(P.selectedCharacter=y.selectedCharacter),g.operator&&this.processOperator(u,p,g),g.motion&&this.processMotion(u,p,g),(g.motion||g.operator)&&this.evalInput(u,p),P.repeat=b||1,P.repeatIsExplicit=I,P.registerName=y.registerName,Lt(u),p.lastMotion=null,g.isEdit&&this.recordLastEdit(p,y,g),mi[g.action](u,P,p)},processSearch:function(u,p,g){if(!u.getSearchCursor)return;var y=g.searchArgs.forward,b=g.searchArgs.wholeWordOnly;Se(u).setReversed(!y);var I=y?"/":"?",P=Se(u).getQuery(),M=u.getScrollInfo();function R(Re,He,ze){Ye.searchHistoryController.pushInput(Re),Ye.searchHistoryController.reset();try{rr(u,Re,He,ze)}catch{Ot(u,"Invalid regex: "+Re),Lt(u);return}ui.processMotion(u,p,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:g.searchArgs.toJumplist}})}function V(Re){u.scrollTo(M.left,M.top),R(Re,!0,!0);var He=Ye.macroModeState;He.isRecording&&Rn(He,Re)}function Z(Re,He,ze){var Ze=s.keyName(Re),yt,Dt;Ze=="Up"||Ze=="Down"?(yt=Ze=="Up",Dt=Re.target?Re.target.selectionEnd:0,He=Ye.searchHistoryController.nextMatch(He,yt)||"",ze(He),Dt&&Re.target&&(Re.target.selectionEnd=Re.target.selectionStart=Math.min(Dt,Re.target.value.length))):Ze!="Left"&&Ze!="Right"&&Ze!="Ctrl"&&Ze!="Alt"&&Ze!="Shift"&&Ye.searchHistoryController.reset();var It;try{It=rr(u,He,!0,!0)}catch{}It?u.scrollIntoView(nn(u,!y,It),30):(Gr(u),u.scrollTo(M.left,M.top))}function $e(Re,He,ze){var Ze=s.keyName(Re);Ze=="Esc"||Ze=="Ctrl-C"||Ze=="Ctrl-["||Ze=="Backspace"&&He==""?(Ye.searchHistoryController.pushInput(He),Ye.searchHistoryController.reset(),rr(u,P),Gr(u),u.scrollTo(M.left,M.top),s.e_stop(Re),Lt(u),ze(),u.focus()):Ze=="Up"||Ze=="Down"?s.e_stop(Re):Ze=="Ctrl-U"&&(s.e_stop(Re),ze(""))}switch(g.searchArgs.querySrc){case"prompt":var Pe=Ye.macroModeState;if(Pe.isPlaying){var Ne=Pe.replaySearchQueries.shift();R(Ne,!0,!1)}else wr(u,{onClose:V,prefix:I,desc:"(JavaScript regexp)",onKeyUp:Z,onKeyDown:$e});break;case"wordUnderCursor":var Oe=Bi(u,!1,!1,!1,!0),oe=!0;if(Oe||(Oe=Bi(u,!1,!1,!1,!1),oe=!1),!Oe)return;var Ne=u.getLine(Oe.start.line).substring(Oe.start.ch,Oe.end.ch);oe&&b?Ne="\\b"+Ne+"\\b":Ne=Yi(Ne),Ye.jumpList.cachedCursor=u.getCursor(),u.setCursor(Oe.start),R(Ne,!0,!1);break}},processEx:function(u,p,g){function y(I){Ye.exCommandHistoryController.pushInput(I),Ye.exCommandHistoryController.reset(),ei.processCommand(u,I),u.state.vim&&Lt(u)}function b(I,P,M){var R=s.keyName(I),V,Z;(R=="Esc"||R=="Ctrl-C"||R=="Ctrl-["||R=="Backspace"&&P=="")&&(Ye.exCommandHistoryController.pushInput(P),Ye.exCommandHistoryController.reset(),s.e_stop(I),Lt(u),M(),u.focus()),R=="Up"||R=="Down"?(s.e_stop(I),V=R=="Up",Z=I.target?I.target.selectionEnd:0,P=Ye.exCommandHistoryController.nextMatch(P,V)||"",M(P),Z&&I.target&&(I.target.selectionEnd=I.target.selectionStart=Math.min(Z,I.target.value.length))):R=="Ctrl-U"?(s.e_stop(I),M("")):R!="Left"&&R!="Right"&&R!="Ctrl"&&R!="Alt"&&R!="Shift"&&Ye.exCommandHistoryController.reset()}g.type=="keyToEx"?ei.processCommand(u,g.exArgs.input):p.visualMode?wr(u,{onClose:y,prefix:":",value:"'<,'>",onKeyDown:b,selectValueOnOpen:!1}):wr(u,{onClose:y,prefix:":",onKeyDown:b})},evalInput:function(u,p){var g=p.inputState,y=g.motion,b=g.motionArgs||{},I=g.operator,P=g.operatorArgs||{},M=g.registerName,R=p.sel,V=gt(p.visualMode?Nt(u,R.head):u.getCursor("head")),Z=gt(p.visualMode?Nt(u,R.anchor):u.getCursor("anchor")),$e=gt(V),Pe=gt(Z),Oe,oe,Ne;if(I&&this.recordLastEdit(p,g),g.repeatOverride!==void 0?Ne=g.repeatOverride:Ne=g.getRepeat(),Ne>0&&b.explicitRepeat?b.repeatIsExplicit=!0:(b.noRepeat||!b.explicitRepeat&&Ne===0)&&(Ne=1,b.repeatIsExplicit=!1),g.selectedCharacter&&(b.selectedCharacter=P.selectedCharacter=g.selectedCharacter),b.repeat=Ne,Lt(u),y){var Re=Kt[y](u,V,b,p,g);if(p.lastMotion=Kt[y],!Re)return;if(b.toJumplist){var He=Ye.jumpList,ze=He.cachedCursor;ze?(Xi(u,ze,Re),delete He.cachedCursor):Xi(u,V,Re)}Re instanceof Array?(oe=Re[0],Oe=Re[1]):Oe=Re,Oe||(Oe=gt(V)),p.visualMode?(p.visualBlock&&Oe.ch===1/0||(Oe=Nt(u,Oe,$e)),oe&&(oe=Nt(u,oe)),oe=oe||Pe,R.anchor=oe,R.head=Oe,li(u),qt(u,p,"<",qe(oe,Oe)?oe:Oe),qt(u,p,">",qe(oe,Oe)?Oe:oe)):I||(Oe=Nt(u,Oe,$e),u.setCursor(Oe.line,Oe.ch))}if(I){if(P.lastSel){oe=Pe;var Ze=P.lastSel,yt=Math.abs(Ze.head.line-Ze.anchor.line),Dt=Math.abs(Ze.head.ch-Ze.anchor.ch);Ze.visualLine?Oe=new e(Pe.line+yt,Pe.ch):Ze.visualBlock?Oe=new e(Pe.line+yt,Pe.ch+Dt):Ze.head.line==Ze.anchor.line?Oe=new e(Pe.line,Pe.ch+Dt):Oe=new e(Pe.line+yt,Pe.ch),p.visualMode=!0,p.visualLine=Ze.visualLine,p.visualBlock=Ze.visualBlock,R=p.sel={anchor:oe,head:Oe},li(u)}else p.visualMode&&(P.lastSel={anchor:gt(R.anchor),head:gt(R.head),visualBlock:p.visualBlock,visualLine:p.visualLine});var It,Rt,ht,ut,Xt;if(p.visualMode){It=Qt(R.head,R.anchor),Rt=kt(R.head,R.anchor),ht=p.visualLine||P.linewise,ut=p.visualBlock?"block":ht?"line":"char";var $t=n(u,It,Rt);if(Xt=et(u,{anchor:$t.start,head:$t.end},ut),ht){var xt=Xt.ranges;if(ut=="block")for(var bi=0;biM:Z.lineV&&b.line==V?tr(u,p,g,y,!0):(g.toFirstChar&&(I=Jt(u.getLine(M)),y.lastHPos=I),y.lastHSPos=u.charCoords(new e(M,I),"div").left,new e(M,I))},moveByDisplayLines:function(u,p,g,y){var b=p;switch(y.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:y.lastHSPos=u.charCoords(b,"div").left}var I=g.repeat,P=u.findPosV(b,g.forward?I:-I,"line",y.lastHSPos);if(P.hitSide)if(g.forward)var M=u.charCoords(P,"div"),R={top:M.top+8,left:y.lastHSPos},P=u.coordsChar(R,"div");else{var V=u.charCoords(new e(u.firstLine(),0),"div");V.left=y.lastHSPos,P=u.coordsChar(V,"div")}return y.lastHPos=P.ch,P},moveByPage:function(u,p,g){var y=p,b=g.repeat;return u.findPosV(y,g.forward?b:-b,"page")},moveByParagraph:function(u,p,g){var y=g.forward?1:-1;return Pi(u,p,g.repeat,y)},moveBySentence:function(u,p,g){var y=g.forward?1:-1;return Ir(u,p,g.repeat,y)},moveByScroll:function(u,p,g,y){var b=u.getScrollInfo(),I=null,P=g.repeat;P||(P=b.clientHeight/(2*u.defaultTextHeight()));var M=u.charCoords(p,"local");if(g.repeat=P,I=Kt.moveByDisplayLines(u,p,g,y),!I)return null;var R=u.charCoords(I,"local");return u.scrollTo(null,b.top+R.top-M.top),I},moveByWords:function(u,p,g){return Zr(u,p,g.repeat,!!g.forward,!!g.wordEnd,!!g.bigWord)},moveTillCharacter:function(u,p,g){var y=g.repeat,b=ir(u,y,g.forward,g.selectedCharacter,p),I=g.forward?-1:1;return Si(I,g),b?(b.ch+=I,b):null},moveToCharacter:function(u,p,g){var y=g.repeat;return Si(0,g),ir(u,y,g.forward,g.selectedCharacter,p)||p},moveToSymbol:function(u,p,g){var y=g.repeat;return er(u,y,g.forward,g.selectedCharacter)||p},moveToColumn:function(u,p,g,y){var b=g.repeat;return y.lastHPos=b-1,y.lastHSPos=u.charCoords(p,"div").left,_r(u,b)},moveToEol:function(u,p,g,y){return tr(u,p,g,y,!1)},moveToFirstNonWhiteSpaceCharacter:function(u,p){var g=p;return new e(g.line,Jt(u.getLine(g.line)))},moveToMatchedSymbol:function(u,p){for(var g=p,y=g.line,b=g.ch,I=u.getLine(y),P;b"?/[(){}[\]<>]/:/[(){}[\]]/,V=u.findMatchingBracket(new e(y,b),{bracketRegex:R});return V.to}else return g},moveToStartOfLine:function(u,p){return new e(p.line,0)},moveToLineOrEdgeOfDocument:function(u,p,g){var y=g.forward?u.lastLine():u.firstLine();return g.repeatIsExplicit&&(y=g.repeat-u.getOption("firstLineNumber")),new e(y,Jt(u.getLine(y)))},moveToStartOfDisplayLine:function(u){return u.execCommand("goLineLeft"),u.getCursor()},moveToEndOfDisplayLine:function(u){u.execCommand("goLineRight");var p=u.getCursor();return p.sticky=="before"&&p.ch--,p},textObjectManipulation:function(u,p,g,y){var b={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},I={"'":!0,'"':!0,"`":!0},P=g.selectedCharacter;P=="b"?P="(":P=="B"&&(P="{");var M=!g.textObjectInner,R,V;if(b[P]){if(V=!0,R=Wt(u,p,P,M),!R){var Z=u.getSearchCursor(new RegExp("\\"+P,"g"),p);Z.find()&&(R=Wt(u,Z.from(),P,M))}}else if(I[P])V=!0,R=X(u,p,P,M);else if(P==="W")R=Bi(u,M,!M,!0);else if(P==="w")R=Bi(u,M,!M,!1);else if(P==="p")if(R=Pi(u,p,g.repeat,0,M),g.linewise=!0,y.visualMode)y.visualLine||(y.visualLine=!0);else{var $e=y.inputState.operatorArgs;$e&&($e.linewise=!0),R.end.line--}else if(P==="t")R=Sr(u,p,M);else if(P==="s"){var Pe=u.getLine(p.line);p.ch>0&&pt(Pe[p.ch])&&(p.ch-=1);var Oe=br(u,p,g.repeat,1,M),oe=br(u,p,g.repeat,-1,M);it(u.getLine(oe.line)[oe.ch])&&it(u.getLine(Oe.line)[Oe.ch-1])&&(oe={line:oe.line,ch:oe.ch+1}),R={start:oe,end:Oe}}return R?u.state.vim.visualMode?mr(u,R.start,R.end,V):[R.start,R.end]:null},repeatLastCharacterSearch:function(u,p,g){var y=Ye.lastCharacterSearch,b=g.repeat,I=g.forward===y.forward,P=(y.increment?1:0)*(I?-1:1);u.moveH(-P,"char"),g.inclusive=!!I;var M=ir(u,b,I,y.selectedCharacter);return M?(M.ch+=P,M):(u.moveH(P,"char"),p)}};function Qr(u,p){Kt[u]=p}function dr(u,p){for(var g=[],y=0;yu.lastLine()&&p.linewise&&!$e?u.replaceRange("",Z,M):u.replaceRange("",P,M),p.linewise&&($e||(u.setCursor(Z),s.commands.newlineAndIndent(u)),P.ch=Number.MAX_VALUE),y=P}Ye.registerController.pushText(p.registerName,"change",b,p.linewise,g.length>1),mi.enterInsertMode(u,{head:y},u.state.vim)},delete:function(u,p,g){var y,b,I=u.state.vim;if(I.visualBlock){b=u.getSelection();var R=dr("",g.length);u.replaceSelections(R),y=Qt(g[0].head,g[0].anchor)}else{var P=g[0].anchor,M=g[0].head;p.linewise&&M.line!=u.firstLine()&&P.line==u.lastLine()&&P.line==M.line-1&&(P.line==u.firstLine()?P.ch=0:P=new e(P.line-1,De(u,P.line-1))),b=u.getRange(P,M),u.replaceRange("",P,M),y=P,p.linewise&&(y=Kt.moveToFirstNonWhiteSpaceCharacter(u,P))}return Ye.registerController.pushText(p.registerName,"delete",b,p.linewise,I.visualBlock),Nt(u,y)},indent:function(u,p,g){var y=u.state.vim;if(u.indentMore)for(var b=y.visualMode?p.repeat:1,I=0;IV.top?(R.line+=(M-V.top)/b,R.line=Math.ceil(R.line),u.setCursor(R),V=u.charCoords(R,"local"),u.scrollTo(null,V.top)):u.scrollTo(null,M);else{var Z=M+u.getScrollInfo().clientHeight;Z=b.anchor.line?I=wt(b.head,0,1):I=new e(b.anchor.line,0)}else if(y=="inplace"){if(g.visualMode)return}else y=="lastEdit"&&(I=sn(u)||I);u.setOption("disableInput",!1),p&&p.replace?(u.toggleOverwrite(!0),u.setOption("keyMap","vim-replace"),s.signal(u,"vim-mode-change",{mode:"replace"})):(u.toggleOverwrite(!1),u.setOption("keyMap","vim-insert"),s.signal(u,"vim-mode-change",{mode:"insert"})),Ye.macroModeState.isPlaying||(u.on("change",hn),g.insertEnd&&g.insertEnd.clear(),g.insertEnd=u.setBookmark(I,{insertLeft:!0}),s.on(u.getInputField(),"keydown",dn)),g.visualMode&&Ht(u),bt(u,I,P)}},toggleVisualMode:function(u,p,g){var y=p.repeat,b=u.getCursor(),I;if(g.visualMode)g.visualLine^p.linewise||g.visualBlock^p.blockwise?(g.visualLine=!!p.linewise,g.visualBlock=!!p.blockwise,s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""}),li(u)):Ht(u);else{g.visualMode=!0,g.visualLine=!!p.linewise,g.visualBlock=!!p.blockwise,I=Nt(u,new e(b.line,b.ch+y-1));var P=n(u,b,I);g.sel={anchor:P.start,head:P.end},s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""}),li(u),qt(u,g,"<",Qt(b,I)),qt(u,g,">",kt(b,I))}},reselectLastSelection:function(u,p,g){var y=g.lastSelection;if(g.visualMode&&Or(u,g),y){var b=y.anchorMark.find(),I=y.headMark.find();if(!b||!I)return;g.sel={anchor:b,head:I},g.visualMode=!0,g.visualLine=y.visualLine,g.visualBlock=y.visualBlock,li(u),qt(u,g,"<",Qt(b,I)),qt(u,g,">",kt(b,I)),s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""})}},joinLines:function(u,p,g){var y,b;if(g.visualMode){if(y=u.getCursor("anchor"),b=u.getCursor("head"),qe(b,y)){var I=b;b=y,y=I}b.ch=De(u,b.line)-1}else{var P=Math.max(p.repeat,2);y=u.getCursor(),b=Nt(u,new e(y.line+P-1,1/0))}for(var M=0,R=y.line;R{this.continuePaste(u,p,g,I,y)});else{var b=y.toString();this.continuePaste(u,p,g,b,y)}},continuePaste:function(u,p,g,y,b){var I=gt(u.getCursor());if(y){if(p.matchIndent){var P=u.getOption("tabSize"),M=function($t){var xt=$t.split(" ").length-1,bi=$t.split(" ").length-1;return xt*P+bi*1},R=u.getLine(u.getCursor().line),V=M(R.match(/^\s*/)[0]),Z=y.replace(/\n$/,""),$e=y!==Z,Pe=M(y.match(/^\s*/)[0]),y=Z.replace(/^\s*/gm,function($t){var xt=V+(M($t)-Pe);if(xt<0)return"";if(u.getOption("indentWithTabs")){var bi=Math.floor(xt/P);return Array(bi+1).join(" ")}else return Array(xt+1).join(" ")});y+=$e?` -`:""}if(p.repeat>1)var y=Array(p.repeat+1).join(y);var oe=b.linewise,K=b.blockwise;if(K){y=y.split(` -`),oe&&y.pop();for(var Ne=0;Ne1)var y=Array(p.repeat+1).join(y);var Oe=b.linewise,oe=b.blockwise;if(oe){y=y.split(` +`),Oe&&y.pop();for(var Ne=0;Neu.lastLine()&&u.replaceRange(` -`,new e(ht,0));var ut=De(u,ht);utR.length&&(I=R.length),P=new e(b.line,I)}var V=n(u,b,P);if(b=V.start,P=V.end,y==` +`+y.slice(0,y.length-1),I.ch=De(u,I.line)):I.ch=0:I.ch+=p.after?1:0;var Re;if(g.visualMode){g.lastPastedText=y;var He,ze=Dr(u,g),Ze=ze[0],yt=ze[1],Dt=u.getSelection(),It=u.listSelections(),Rt=new Array(It.length).join("1").split("1");g.lastSelection&&(He=g.lastSelection.headMark.find()),Ye.registerController.unnamedRegister.setText(Dt),oe?(u.replaceSelections(Rt),yt=new e(Ze.line+y.length-1,Ze.ch),u.setCursor(Ze),gr(u,yt),u.replaceSelections(y),Re=Ze):g.visualBlock?(u.replaceSelections(Rt),u.setCursor(Ze),u.replaceRange(y,Ze,Ze),Re=Ze):(u.replaceRange(y,Ze,yt),Re=u.posFromIndex(u.indexFromPos(Ze)+y.length-1)),He&&(g.lastSelection.headMark=u.setBookmark(He)),Oe&&(Re.ch=0)}else if(oe){u.setCursor(I);for(var Ne=0;Neu.lastLine()&&u.replaceRange(` +`,new e(ht,0));var ut=De(u,ht);utR.length&&(I=R.length),P=new e(b.line,I)}var V=n(u,b,P);if(b=V.start,P=V.end,y==` `)g.visualMode||u.replaceRange("",b,P),(s.commands.newlineAndIndentContinueComment||s.commands.newlineAndIndent)(u);else{var Z=u.getRange(b,P);if(Z=Z.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,y),Z=Z.replace(/[^\n]/g,y),g.visualBlock){var $e=new Array(u.getOption("tabSize")+1).join(" ");Z=u.getSelection(),Z=Z.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,y),Z=Z.replace(/\t/g,$e).replace(/[^\n]/g,y).split(` -`),u.replaceSelections(Z)}else u.replaceRange(Z,b,P);g.visualMode?(b=qe(M[0].anchor,M[0].head)?M[0].anchor:M[0].head,u.setCursor(b),Ht(u,!1)):u.setCursor(wt(P,0,-1))}},incrementNumberToken:function(u,p){for(var g=u.getCursor(),y=u.getLine(g.line),b=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,I,P,M,R;(I=b.exec(y))!==null&&(P=I.index,M=P+I[0].length,!(g.chR&&(Z=-1),R+=Z,R>M&&(R-=2)}return new e(I,R)}function Ei(u){var p={};for(var g in u)u.hasOwnProperty(g)&&(p[g]=u[g]);return p}function wt(u,p,g){return typeof p=="object"&&(g=p.ch,p=p.line),new e(u.line+p,u.ch+g)}function Er(u,p,g,y){for(var b=y.operator,I,P=[],M=[],R=zi?p.length-a:0,V=R;V"){var g=p.length-11,y=u.slice(0,g),b=p.slice(0,g);return y==b&&u.length>g?"full":b.indexOf(y)==0?"partial":!1}else return u==p?"full":p.indexOf(u)==0?"partial":!1}function Yr(u){var p=/^.*(<[^>]+>)$/.exec(u),g=p?p[1]:u.slice(-1);if(g.length>1)switch(g){case"":g=` -`;break;case"":g=" ";break;default:g="";break}return g}function pr(u,p,g){return function(){for(var y=0;y2&&(p=Qt.apply(void 0,Array.prototype.slice.call(arguments,1))),qe(u,p)?u:p}function kt(u,p){return arguments.length>2&&(p=kt.apply(void 0,Array.prototype.slice.call(arguments,1))),qe(u,p)?p:u}function Ni(u,p,g){var y=qe(u,p),b=qe(p,g);return y&&b}function De(u,p){return u.getLine(p).length}function je(u){return u.trim?u.trim():u.replace(/^\s+|\s+$/g,"")}function Yi(u){return u.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Ai(u,p,g){var y=De(u,p),b=new Array(g-y+1).join(" ");u.setCursor(new e(p,y)),u.replaceRange(b,u.getCursor())}function gr(u,p){var g=[],y=u.listSelections(),b=gt(u.clipPos(p)),I=!H(p,b),P=u.getCursor("head"),M=Ji(y,P),R=H(y[M].head,y[M].anchor),V=y.length-1,Z=V-M>M?V:0,$e=y[Z].anchor,Pe=Math.min($e.line,b.line),oe=Math.max($e.line,b.line),K=$e.ch,Ne=b.ch,Re=y[Z].head.ch-K,He=Ne-K;Re>0&&He<=0?(K++,I||Ne--):Re<0&&He>=0?(K--,R||Ne++):Re<0&&He==-1&&(K--,Ne++);for(var ze=Pe;ze<=oe;ze++){var Ze={anchor:new e(ze,K),head:new e(ze,Ne)};g.push(Ze)}return u.setSelections(g),p.ch=Ne,$e.ch=K,$e}function bt(u,p,g){for(var y=[],b=0;bR&&(b.line=R),b.ch=De(u,b.line)}return{ranges:[{anchor:I,head:b}],primary:0}}else if(g=="block"){var V=Math.min(I.line,b.line),Z=I.ch,$e=Math.max(I.line,b.line),Pe=b.ch;Z0&&I&&it(I);I=b.pop())g.line--,g.ch=0;I?(g.line--,g.ch=De(u,g.line)):g.ch=0}}function Di(u,p,g){p.ch=0,g.ch=0,g.line++}function Jt(u){if(!u)return 0;var p=u.search(/\S/);return p==-1?u.length:p}function Bi(u,p,g,y,b){var I=Br(u),P=u.getLine(I.line),M=I.ch,R=b?ke[0]:Qe[0];if(g&&/\s/.test(P.charAt(M)))R=function(oe){return/\s/.test(oe)};else{for(;!R(P.charAt(M));)if(M++,M>=P.length)return null;y?R=Qe[0]:(R=ke[0],R(P.charAt(M))||(R=ke[1]))}for(var V=M,Z=M;R(P.charAt(V))&&V=0;)Z--;if(Z++,p){for(var $e=V;/\s/.test(P.charAt(V))&&V0;)Z--;Z||(Z=Pe)}}return{start:new e(I.line,Z),end:new e(I.line,V)}}function Sr(u,p,g){var y=p;if(!s.findMatchingTag||!s.findEnclosingTag)return{start:y,end:y};var b=s.findMatchingTag(u,p)||s.findEnclosingTag(u,p);return!b||!b.open||!b.close?{start:y,end:y}:g?{start:b.open.from,end:b.close.to}:{start:b.open.to,end:b.close.from}}function Xi(u,p,g){H(p,g)||Ye.jumpList.add(u,p,g)}function Si(u,p){Ye.lastCharacterSearch.increment=u,Ye.lastCharacterSearch.forward=p.forward,Ye.lastCharacterSearch.selectedCharacter=p.selectedCharacter}var yr={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},vr={bracket:{isComplete:function(u){if(u.nextCh===u.symb){if(u.depth++,u.depth>=1)return!0}else u.nextCh===u.reverseSymb&&u.depth--;return!1}},section:{init:function(u){u.curMoveThrough=!0,u.symb=(u.forward?"]":"[")===u.symb?"{":"}"},isComplete:function(u){return u.index===0&&u.nextCh===u.symb}},comment:{isComplete:function(u){var p=u.lastCh==="*"&&u.nextCh==="/";return u.lastCh=u.nextCh,p}},method:{init:function(u){u.symb=u.symb==="m"?"{":"}",u.reverseSymb=u.symb==="{"?"}":"{"},isComplete:function(u){return u.nextCh===u.symb}},preprocess:{init:function(u){u.index=0},isComplete:function(u){if(u.nextCh==="#"){var p=u.lineText.match(/^#(\w+)/)[1];if(p==="endif"){if(u.forward&&u.depth===0)return!0;u.depth++}else if(p==="if"){if(!u.forward&&u.depth===0)return!0;u.depth--}if(p==="else"&&u.depth===0)return!0}return!1}}};function er(u,p,g,y){var b=gt(u.getCursor()),I=g?1:-1,P=g?u.lineCount():-1,M=b.ch,R=b.line,V=u.getLine(R),Z={lineText:V,nextCh:V.charAt(M),lastCh:null,index:M,symb:y,reverseSymb:(g?{")":"(","}":"{"}:{"(":")","{":"}"})[y],forward:g,depth:0,curMoveThrough:!1},$e=yr[y];if(!$e)return b;var Pe=vr[$e].init,oe=vr[$e].isComplete;for(Pe&&Pe(Z);R!==P&&p;){if(Z.index+=I,Z.nextCh=Z.lineText.charAt(Z.index),!Z.nextCh){if(R+=I,Z.lineText=u.getLine(R)||"",I>0)Z.index=0;else{var K=Z.lineText.length;Z.index=K>0?K-1:0}Z.nextCh=Z.lineText.charAt(Z.index)}oe(Z)&&(b.line=R,b.ch=Z.index,p--)}return Z.nextCh||Z.curMoveThrough?new e(R,Z.index):b}function Cr(u,p,g,y,b){var I=p.line,P=p.ch,M=u.getLine(I),R=g?1:-1,V=y?Qe:ke;if(b&&M==""){if(I+=R,M=u.getLine(I),!at(u,I))return null;P=g?0:M.length}for(;;){if(b&&M=="")return{from:0,to:0,line:I};for(var Z=R>0?M.length:-1,$e=Z,Pe=Z;P!=Z;){for(var oe=!1,K=0;K0?0:M.length}}function Zr(u,p,g,y,b,I){var P=gt(p),M=[];(y&&!b||!y&&b)&&g++;for(var R=!(y&&b),V=0;V0;)Pe(Z,y)&&g--,Z+=y;return new e(Z,0)}var oe=u.state.vim;if(oe.visualLine&&Pe(I,1,!0)){var K=oe.sel.anchor;Pe(K.line,-1,!0)&&(!b||K.line!=I)&&(I+=1)}var Ne=$e(I);for(Z=I;Z<=M&&g;Z++)Pe(Z,1,!0)&&(!b||$e(Z)!=Ne)&&g--;for(V=new e(Z,0),Z>M&&!Ne?Ne=!0:b=!1,Z=I;Z>P&&!((!b||$e(Z)==Ne||Z==I)&&Pe(Z,-1,!0));Z--);return R=new e(Z,0),{start:R,end:V}}function br(u,p,g,y,b){function I(V){V.pos+V.dir<0||V.pos+V.dir>=V.line.length?V.line=null:V.pos+=V.dir}function P(V,Z,$e,Pe){var oe=V.getLine(Z),K={line:oe,ln:Z,pos:$e,dir:Pe};if(K.line==="")return{ln:K.ln,pos:K.pos};var Ne=K.pos;for(I(K);K.line!==null;){if(Ne=K.pos,pt(K.line[K.pos]))if(b){for(I(K);K.line!==null&&it(K.line[K.pos]);)Ne=K.pos,I(K);return{ln:K.ln,pos:Ne+1}}else return{ln:K.ln,pos:K.pos+1};I(K)}return{ln:K.ln,pos:Ne+1}}function M(V,Z,$e,Pe){var oe=V.getLine(Z),K={line:oe,ln:Z,pos:$e,dir:Pe};if(K.line==="")return{ln:K.ln,pos:K.pos};var Ne=K.pos;for(I(K);K.line!==null;){if(!it(K.line[K.pos])&&!pt(K.line[K.pos]))Ne=K.pos;else if(pt(K.line[K.pos]))return b?it(K.line[K.pos+1])?{ln:K.ln,pos:K.pos+1}:{ln:K.ln,pos:Ne}:{ln:K.ln,pos:Ne};I(K)}return K.line=oe,b&&it(K.line[K.pos])?{ln:K.ln,pos:K.pos}:{ln:K.ln,pos:Ne}}for(var R={ln:p.line,pos:p.ch};g>0;)y<0?R=M(u,R.ln,R.pos,y):R=P(u,R.ln,R.pos,y),g--;return new e(R.ln,R.pos)}function Ir(u,p,g,y){function b(R,V){if(V.pos+V.dir<0||V.pos+V.dir>=V.line.length){if(V.ln+=V.dir,!at(R,V.ln)){V.line=null,V.ln=null,V.pos=null;return}V.line=R.getLine(V.ln),V.pos=V.dir>0?0:V.line.length-1}else V.pos+=V.dir}function I(R,V,Z,$e){var Re=R.getLine(V),Pe=Re==="",oe={line:Re,ln:V,pos:Z,dir:$e},K={ln:oe.ln,pos:oe.pos},Ne=oe.line==="";for(b(R,oe);oe.line!==null;){if(K.ln=oe.ln,K.pos=oe.pos,oe.line===""&&!Ne)return{ln:oe.ln,pos:oe.pos};if(Pe&&oe.line!==""&&!it(oe.line[oe.pos]))return{ln:oe.ln,pos:oe.pos};pt(oe.line[oe.pos])&&!Pe&&(oe.pos===oe.line.length-1||it(oe.line[oe.pos+1]))&&(Pe=!0),b(R,oe)}var Re=R.getLine(K.ln);K.pos=0;for(var He=Re.length-1;He>=0;--He)if(!it(Re[He])){K.pos=He;break}return K}function P(R,V,Z,$e){var Ne=R.getLine(V),Pe={line:Ne,ln:V,pos:Z,dir:$e},oe={ln:Pe.ln,pos:null},K=Pe.line==="";for(b(R,Pe);Pe.line!==null;){if(Pe.line===""&&!K)return oe.pos!==null?oe:{ln:Pe.ln,pos:Pe.pos};if(pt(Pe.line[Pe.pos])&&oe.pos!==null&&!(Pe.ln===oe.ln&&Pe.pos+1===oe.pos))return oe;Pe.line!==""&&!it(Pe.line[Pe.pos])&&(K=!1,oe={ln:Pe.ln,pos:Pe.pos}),b(R,Pe)}var Ne=R.getLine(oe.ln);oe.pos=0;for(var Re=0;Re0;)y<0?M=P(u,M.ln,M.pos,y):M=I(u,M.ln,M.pos,y),g--;return new e(M.ln,M.pos)}function Wt(u,p,g,y){var b=p,I,P,M={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[g],R={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[g],V=u.getLine(b.line).charAt(b.ch),Z=V===R?1:0;if(I=u.scanForBracket(new e(b.line,b.ch+Z),-1,void 0,{bracketRegex:M}),P=u.scanForBracket(new e(b.line,b.ch+Z),1,void 0,{bracketRegex:M}),!I||!P)return null;if(I=I.pos,P=P.pos,I.line==P.line&&I.ch>P.ch||I.line>P.line){var $e=I;I=P,P=$e}return y?P.ch+=1:I.ch+=1,{start:I,end:P}}function X(u,p,g,y){var b=gt(p),I=u.getLine(b.line),P=I.split(""),M,R,V,Z,$e=P.indexOf(g);if(b.ch<$e)b.ch=$e;else if($e-1&&!M;V--)P[V]==g&&(M=V+1);if(M&&!R)for(V=M,Z=P.length;VR&&(Z=-1),R+=Z,R>M&&(R-=2)}return new e(I,R)}function Ei(u){var p={};for(var g in u)u.hasOwnProperty(g)&&(p[g]=u[g]);return p}function wt(u,p,g){return typeof p=="object"&&(g=p.ch,p=p.line),new e(u.line+p,u.ch+g)}function Er(u,p,g,y){for(var b=y.operator,I,P=[],M=[],R=zi?p.length-a:0,V=R;V"){var g=p.length-11,y=u.slice(0,g),b=p.slice(0,g);return y==b&&u.length>g?"full":b.indexOf(y)==0?"partial":!1}else return u==p?"full":p.indexOf(u)==0?"partial":!1}function Yr(u){var p=/^.*(<[^>]+>)$/.exec(u),g=p?p[1]:u.slice(-1);if(g.length>1)switch(g){case"":g=` +`;break;case"":g=" ";break;default:g="";break}return g}function pr(u,p,g){return function(){for(var y=0;y2&&(p=Qt.apply(void 0,Array.prototype.slice.call(arguments,1))),qe(u,p)?u:p}function kt(u,p){return arguments.length>2&&(p=kt.apply(void 0,Array.prototype.slice.call(arguments,1))),qe(u,p)?p:u}function Ni(u,p,g){var y=qe(u,p),b=qe(p,g);return y&&b}function De(u,p){return u.getLine(p).length}function je(u){return u.trim?u.trim():u.replace(/^\s+|\s+$/g,"")}function Yi(u){return u.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Ai(u,p,g){var y=De(u,p),b=new Array(g-y+1).join(" ");u.setCursor(new e(p,y)),u.replaceRange(b,u.getCursor())}function gr(u,p){var g=[],y=u.listSelections(),b=gt(u.clipPos(p)),I=!H(p,b),P=u.getCursor("head"),M=Ji(y,P),R=H(y[M].head,y[M].anchor),V=y.length-1,Z=V-M>M?V:0,$e=y[Z].anchor,Pe=Math.min($e.line,b.line),Oe=Math.max($e.line,b.line),oe=$e.ch,Ne=b.ch,Re=y[Z].head.ch-oe,He=Ne-oe;Re>0&&He<=0?(oe++,I||Ne--):Re<0&&He>=0?(oe--,R||Ne++):Re<0&&He==-1&&(oe--,Ne++);for(var ze=Pe;ze<=Oe;ze++){var Ze={anchor:new e(ze,oe),head:new e(ze,Ne)};g.push(Ze)}return u.setSelections(g),p.ch=Ne,$e.ch=oe,$e}function bt(u,p,g){for(var y=[],b=0;bR&&(b.line=R),b.ch=De(u,b.line)}return{ranges:[{anchor:I,head:b}],primary:0}}else if(g=="block"){var V=Math.min(I.line,b.line),Z=I.ch,$e=Math.max(I.line,b.line),Pe=b.ch;Z0&&I&&it(I);I=b.pop())g.line--,g.ch=0;I?(g.line--,g.ch=De(u,g.line)):g.ch=0}}function Di(u,p,g){p.ch=0,g.ch=0,g.line++}function Jt(u){if(!u)return 0;var p=u.search(/\S/);return p==-1?u.length:p}function Bi(u,p,g,y,b){var I=Br(u),P=u.getLine(I.line),M=I.ch,R=b?ke[0]:Qe[0];if(g&&/\s/.test(P.charAt(M)))R=function(Oe){return/\s/.test(Oe)};else{for(;!R(P.charAt(M));)if(M++,M>=P.length)return null;y?R=Qe[0]:(R=ke[0],R(P.charAt(M))||(R=ke[1]))}for(var V=M,Z=M;R(P.charAt(V))&&V=0;)Z--;if(Z++,p){for(var $e=V;/\s/.test(P.charAt(V))&&V0;)Z--;Z||(Z=Pe)}}return{start:new e(I.line,Z),end:new e(I.line,V)}}function Sr(u,p,g){var y=p;if(!s.findMatchingTag||!s.findEnclosingTag)return{start:y,end:y};var b=s.findMatchingTag(u,p)||s.findEnclosingTag(u,p);return!b||!b.open||!b.close?{start:y,end:y}:g?{start:b.open.from,end:b.close.to}:{start:b.open.to,end:b.close.from}}function Xi(u,p,g){H(p,g)||Ye.jumpList.add(u,p,g)}function Si(u,p){Ye.lastCharacterSearch.increment=u,Ye.lastCharacterSearch.forward=p.forward,Ye.lastCharacterSearch.selectedCharacter=p.selectedCharacter}var yr={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},vr={bracket:{isComplete:function(u){if(u.nextCh===u.symb){if(u.depth++,u.depth>=1)return!0}else u.nextCh===u.reverseSymb&&u.depth--;return!1}},section:{init:function(u){u.curMoveThrough=!0,u.symb=(u.forward?"]":"[")===u.symb?"{":"}"},isComplete:function(u){return u.index===0&&u.nextCh===u.symb}},comment:{isComplete:function(u){var p=u.lastCh==="*"&&u.nextCh==="/";return u.lastCh=u.nextCh,p}},method:{init:function(u){u.symb=u.symb==="m"?"{":"}",u.reverseSymb=u.symb==="{"?"}":"{"},isComplete:function(u){return u.nextCh===u.symb}},preprocess:{init:function(u){u.index=0},isComplete:function(u){if(u.nextCh==="#"){var p=u.lineText.match(/^#(\w+)/)[1];if(p==="endif"){if(u.forward&&u.depth===0)return!0;u.depth++}else if(p==="if"){if(!u.forward&&u.depth===0)return!0;u.depth--}if(p==="else"&&u.depth===0)return!0}return!1}}};function er(u,p,g,y){var b=gt(u.getCursor()),I=g?1:-1,P=g?u.lineCount():-1,M=b.ch,R=b.line,V=u.getLine(R),Z={lineText:V,nextCh:V.charAt(M),lastCh:null,index:M,symb:y,reverseSymb:(g?{")":"(","}":"{"}:{"(":")","{":"}"})[y],forward:g,depth:0,curMoveThrough:!1},$e=yr[y];if(!$e)return b;var Pe=vr[$e].init,Oe=vr[$e].isComplete;for(Pe&&Pe(Z);R!==P&&p;){if(Z.index+=I,Z.nextCh=Z.lineText.charAt(Z.index),!Z.nextCh){if(R+=I,Z.lineText=u.getLine(R)||"",I>0)Z.index=0;else{var oe=Z.lineText.length;Z.index=oe>0?oe-1:0}Z.nextCh=Z.lineText.charAt(Z.index)}Oe(Z)&&(b.line=R,b.ch=Z.index,p--)}return Z.nextCh||Z.curMoveThrough?new e(R,Z.index):b}function Cr(u,p,g,y,b){var I=p.line,P=p.ch,M=u.getLine(I),R=g?1:-1,V=y?Qe:ke;if(b&&M==""){if(I+=R,M=u.getLine(I),!at(u,I))return null;P=g?0:M.length}for(;;){if(b&&M=="")return{from:0,to:0,line:I};for(var Z=R>0?M.length:-1,$e=Z,Pe=Z;P!=Z;){for(var Oe=!1,oe=0;oe0?0:M.length}}function Zr(u,p,g,y,b,I){var P=gt(p),M=[];(y&&!b||!y&&b)&&g++;for(var R=!(y&&b),V=0;V0;)Pe(Z,y)&&g--,Z+=y;return new e(Z,0)}var Oe=u.state.vim;if(Oe.visualLine&&Pe(I,1,!0)){var oe=Oe.sel.anchor;Pe(oe.line,-1,!0)&&(!b||oe.line!=I)&&(I+=1)}var Ne=$e(I);for(Z=I;Z<=M&&g;Z++)Pe(Z,1,!0)&&(!b||$e(Z)!=Ne)&&g--;for(V=new e(Z,0),Z>M&&!Ne?Ne=!0:b=!1,Z=I;Z>P&&!((!b||$e(Z)==Ne||Z==I)&&Pe(Z,-1,!0));Z--);return R=new e(Z,0),{start:R,end:V}}function br(u,p,g,y,b){function I(V){V.pos+V.dir<0||V.pos+V.dir>=V.line.length?V.line=null:V.pos+=V.dir}function P(V,Z,$e,Pe){var Oe=V.getLine(Z),oe={line:Oe,ln:Z,pos:$e,dir:Pe};if(oe.line==="")return{ln:oe.ln,pos:oe.pos};var Ne=oe.pos;for(I(oe);oe.line!==null;){if(Ne=oe.pos,pt(oe.line[oe.pos]))if(b){for(I(oe);oe.line!==null&&it(oe.line[oe.pos]);)Ne=oe.pos,I(oe);return{ln:oe.ln,pos:Ne+1}}else return{ln:oe.ln,pos:oe.pos+1};I(oe)}return{ln:oe.ln,pos:Ne+1}}function M(V,Z,$e,Pe){var Oe=V.getLine(Z),oe={line:Oe,ln:Z,pos:$e,dir:Pe};if(oe.line==="")return{ln:oe.ln,pos:oe.pos};var Ne=oe.pos;for(I(oe);oe.line!==null;){if(!it(oe.line[oe.pos])&&!pt(oe.line[oe.pos]))Ne=oe.pos;else if(pt(oe.line[oe.pos]))return b?it(oe.line[oe.pos+1])?{ln:oe.ln,pos:oe.pos+1}:{ln:oe.ln,pos:Ne}:{ln:oe.ln,pos:Ne};I(oe)}return oe.line=Oe,b&&it(oe.line[oe.pos])?{ln:oe.ln,pos:oe.pos}:{ln:oe.ln,pos:Ne}}for(var R={ln:p.line,pos:p.ch};g>0;)y<0?R=M(u,R.ln,R.pos,y):R=P(u,R.ln,R.pos,y),g--;return new e(R.ln,R.pos)}function Ir(u,p,g,y){function b(R,V){if(V.pos+V.dir<0||V.pos+V.dir>=V.line.length){if(V.ln+=V.dir,!at(R,V.ln)){V.line=null,V.ln=null,V.pos=null;return}V.line=R.getLine(V.ln),V.pos=V.dir>0?0:V.line.length-1}else V.pos+=V.dir}function I(R,V,Z,$e){var Re=R.getLine(V),Pe=Re==="",Oe={line:Re,ln:V,pos:Z,dir:$e},oe={ln:Oe.ln,pos:Oe.pos},Ne=Oe.line==="";for(b(R,Oe);Oe.line!==null;){if(oe.ln=Oe.ln,oe.pos=Oe.pos,Oe.line===""&&!Ne)return{ln:Oe.ln,pos:Oe.pos};if(Pe&&Oe.line!==""&&!it(Oe.line[Oe.pos]))return{ln:Oe.ln,pos:Oe.pos};pt(Oe.line[Oe.pos])&&!Pe&&(Oe.pos===Oe.line.length-1||it(Oe.line[Oe.pos+1]))&&(Pe=!0),b(R,Oe)}var Re=R.getLine(oe.ln);oe.pos=0;for(var He=Re.length-1;He>=0;--He)if(!it(Re[He])){oe.pos=He;break}return oe}function P(R,V,Z,$e){var Ne=R.getLine(V),Pe={line:Ne,ln:V,pos:Z,dir:$e},Oe={ln:Pe.ln,pos:null},oe=Pe.line==="";for(b(R,Pe);Pe.line!==null;){if(Pe.line===""&&!oe)return Oe.pos!==null?Oe:{ln:Pe.ln,pos:Pe.pos};if(pt(Pe.line[Pe.pos])&&Oe.pos!==null&&!(Pe.ln===Oe.ln&&Pe.pos+1===Oe.pos))return Oe;Pe.line!==""&&!it(Pe.line[Pe.pos])&&(oe=!1,Oe={ln:Pe.ln,pos:Pe.pos}),b(R,Pe)}var Ne=R.getLine(Oe.ln);Oe.pos=0;for(var Re=0;Re0;)y<0?M=P(u,M.ln,M.pos,y):M=I(u,M.ln,M.pos,y),g--;return new e(M.ln,M.pos)}function Wt(u,p,g,y){var b=p,I,P,M={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[g],R={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[g],V=u.getLine(b.line).charAt(b.ch),Z=V===R?1:0;if(I=u.scanForBracket(new e(b.line,b.ch+Z),-1,void 0,{bracketRegex:M}),P=u.scanForBracket(new e(b.line,b.ch+Z),1,void 0,{bracketRegex:M}),!I||!P)return null;if(I=I.pos,P=P.pos,I.line==P.line&&I.ch>P.ch||I.line>P.line){var $e=I;I=P,P=$e}return y?P.ch+=1:I.ch+=1,{start:I,end:P}}function X(u,p,g,y){var b=gt(p),I=u.getLine(b.line),P=I.split(""),M,R,V,Z,$e=P.indexOf(g);if(b.ch<$e)b.ch=$e;else if($e-1&&!M;V--)P[V]==g&&(M=V+1);if(M&&!R)for(V=M,Z=P.length;V=p&&u<=g:u==p}function Hr(u){var p=u.getScrollInfo(),g=6,y=10,b=u.coordsChar({left:0,top:g+p.top},"local"),I=p.clientHeight-y+p.top,P=u.coordsChar({left:0,top:I},"local");return{top:b.line,bottom:P.line}}function $r(u,p,g){if(g=="'"||g=="`")return Ye.jumpList.find(u,-1)||new e(0,0);if(g==".")return sn(u);var y=p.marks[g];return y&&y.find()}function sn(u){if(u.getLastEditEnd)return u.getLastEditEnd();for(var p=u.doc.history.done,g=p.length;g--;)if(p[g].changes)return gt(p[g].changes[0].to)}var an=function(){this.buildCommandMap_()};an.prototype={processCommand:function(u,p,g){var y=this;u.operation(function(){u.curOp.isVimOp=!0,y._processCommand(u,p,g)})},_processCommand:function(u,p,g){var y=u.state.vim,b=Ye.registerController.getRegister(":"),I=b.toString(),P=new s.StringStream(p);b.setText(p);var M=g||{};M.input=p;try{this.parseInput_(u,P,M)}catch($e){throw Ot(u,$e.toString()),$e}y.visualMode&&Ht(u);var R,V;if(!M.commandName)M.line!==void 0&&(V="move");else if(R=this.matchCommand_(M.commandName),R){if(V=R.name,R.excludeFromCommandHistory&&b.setText(I),this.parseCommandArgs_(P,M,R),R.type=="exToKey"){for(var Z=0;Z"))==null?void 0:I.line):g.selectionLine=u.getCursor().line:(g.selectionLine=g.line,g.selectionLineEnd=g.lineEnd);var y=p.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return y?g.commandName=y[1]:g.commandName=p.match(/.*/)[0],g},parseLineSpec_:function(u,p){var g=p.match(/^(\d+)/);if(g)return parseInt(g[1],10)-1;switch(p.next()){case".":return this.parseLineSpecOffset_(p,u.getCursor().line);case"$":return this.parseLineSpecOffset_(p,u.lastLine());case"'":var y=p.next(),b=$r(u,u.state.vim,y);if(!b)throw new Error("Mark not set");return this.parseLineSpecOffset_(p,b.line);case"-":case"+":return p.backUp(1),this.parseLineSpecOffset_(p,u.getCursor().line);default:p.backUp(1);return}},parseLineSpecOffset_:function(u,p){var g=u.match(/^([+-])?(\d+)/);if(g){var y=parseInt(g[2],10);g[1]=="-"?p-=y:p+=y}return p},parseCommandArgs_:function(u,p,g){if(!u.eol()){p.argString=u.match(/.*/)[0];var y=g.argDelimiter||/\s+/,b=je(p.argString).split(y);b.length&&b[0]&&(p.args=b)}},matchCommand_:function(u){for(var p=u.length;p>0;p--){var g=u.substring(0,p);if(this.commandMap_[g]){var y=this.commandMap_[g];if(y.name.indexOf(u)===0)return y}}return null},buildCommandMap_:function(){this.commandMap_={};for(var u=0;u=p&&u<=g:u==p}function Hr(u){var p=u.getScrollInfo(),g=6,y=10,b=u.coordsChar({left:0,top:g+p.top},"local"),I=p.clientHeight-y+p.top,P=u.coordsChar({left:0,top:I},"local");return{top:b.line,bottom:P.line}}function $r(u,p,g){if(g=="'"||g=="`")return Ye.jumpList.find(u,-1)||new e(0,0);if(g==".")return sn(u);var y=p.marks[g];return y&&y.find()}function sn(u){if(u.getLastEditEnd)return u.getLastEditEnd();for(var p=u.doc.history.done,g=p.length;g--;)if(p[g].changes)return gt(p[g].changes[0].to)}var an=function(){this.buildCommandMap_()};an.prototype={processCommand:function(u,p,g){var y=this;u.operation(function(){u.curOp.isVimOp=!0,y._processCommand(u,p,g)})},_processCommand:function(u,p,g){var y=u.state.vim,b=Ye.registerController.getRegister(":"),I=b.toString(),P=new s.StringStream(p);b.setText(p);var M=g||{};M.input=p;try{this.parseInput_(u,P,M)}catch($e){throw Ot(u,$e.toString()),$e}y.visualMode&&Ht(u);var R,V;if(!M.commandName)M.line!==void 0&&(V="move");else if(R=this.matchCommand_(M.commandName),R){if(V=R.name,R.excludeFromCommandHistory&&b.setText(I),this.parseCommandArgs_(P,M,R),R.type=="exToKey"){for(var Z=0;Z"))==null?void 0:I.line):g.selectionLine=u.getCursor().line:(g.selectionLine=g.line,g.selectionLineEnd=g.lineEnd);var y=p.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return y?g.commandName=y[1]:g.commandName=p.match(/.*/)[0],g},parseLineSpec_:function(u,p){var g=p.match(/^(\d+)/);if(g)return parseInt(g[1],10)-1;switch(p.next()){case".":return this.parseLineSpecOffset_(p,u.getCursor().line);case"$":return this.parseLineSpecOffset_(p,u.lastLine());case"'":var y=p.next(),b=$r(u,u.state.vim,y);if(!b)throw new Error("Mark not set");return this.parseLineSpecOffset_(p,b.line);case"-":case"+":return p.backUp(1),this.parseLineSpecOffset_(p,u.getCursor().line);default:p.backUp(1);return}},parseLineSpecOffset_:function(u,p){var g=u.match(/^([+-])?(\d+)/);if(g){var y=parseInt(g[2],10);g[1]=="-"?p-=y:p+=y}return p},parseCommandArgs_:function(u,p,g){if(!u.eol()){p.argString=u.match(/.*/)[0];var y=g.argDelimiter||/\s+/,b=je(p.argString).split(y);b.length&&b[0]&&(p.args=b)}},matchCommand_:function(u){for(var p=u.length;p>0;p--){var g=u.substring(0,p);if(this.commandMap_[g]){var y=this.commandMap_[g];if(y.name.indexOf(u)===0)return y}}return null},buildCommandMap_:function(){this.commandMap_={};for(var u=0;u1)return"Invalid arguments";I=Xt&&"decimal"||$t&&"hex"||xt&&"octal"}ut[2]&&(P=new RegExp(ut[2].substr(1,ut[2].length-2),y?"i":""))}}var R=M();if(R){Ot(u,R+": "+p.argString);return}var V=p.line||u.firstLine(),Z=p.lineEnd||p.line||u.lastLine();if(V==Z)return;var $e=new e(V,0),Pe=new e(Z,De(u,Z)),oe=u.getRange($e,Pe).split(` -`),K=P||(I=="decimal"?/(-?)([\d]+)/:I=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:I=="octal"?/([0-7]+)/:null),Ne=I=="decimal"?10:I=="hex"?16:I=="octal"?8:null,Re=[],He=[];if(I||P)for(var ze=0;ze=V){Ot(u,"Invalid argument: "+p.argString.substring(b));return}for(var Z=0;Z<=V-R;Z++){var $e=String.fromCharCode(R+Z);delete g.marks[$e]}}else{Ot(u,"Invalid argument: "+P+"-");return}}else delete g.marks[I]}}},ei=new an;function An(u,p,g,y,b,I,P,M,R){u.state.vim.exMode=!0;var V=!1,Z,$e,Pe;function oe(){u.operation(function(){for(;!V;)K(),Re();He()})}function K(){var Ze=u.getRange(I.from(),I.to()),yt=Ze.replace(P,M),Dt=I.to().line;I.replace(yt),$e=I.to().line,b+=$e-Dt,Pe=$e1&&(pn(u,g,g.insertModeRepeat-1,!0),g.lastEditInputState.repeatOverride=g.insertModeRepeat),delete g.insertModeRepeat,g.insertMode=!1,p||u.setCursor(u.getCursor().line,u.getCursor().ch-1),u.setOption("keyMap","vim"),u.setOption("disableInput",!0),u.toggleOverwrite(!1),b.setText(P.changes.join("")),s.signal(u,"vim-mode-change",{mode:"normal"}),y.isRecording&&Qn(y)}function cn(u){o.unshift(u)}function Pn(u,p,g,y,b){var I={keys:u,type:p};I[p]=g,I[p+"Args"]=y;for(var P in b)I[P]=b[P];cn(I)}mt("insertModeEscKeysTimeout",200,"number"),s.keyMap["vim-insert"]={fallthrough:["default"],attach:d,detach:f,call:m},s.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:d,detach:f};function Tn(u,p,g,y){var b=Ye.registerController.getRegister(y);if(y==":"){b.keyBuffer[0]&&ei.processCommand(u,b.keyBuffer[0]),g.isPlaying=!1;return}var I=b.keyBuffer,P=0;g.isPlaying=!0,g.replaySearchQueries=b.searchQueries.slice(0);for(var M=0;M|<\w+>|./.exec(R),Z=V[0],R=R.substring(V.index+Z.length),Tt.handleKey(u,Z,"macro"),p.insertMode){var $e=b.insertModeChanges[P++].changes;Ye.macroModeState.lastInsertModeChanges.changes=$e,On(u,$e,1),Ci(u)}g.isPlaying=!1}function Ln(u,p){if(!u.isPlaying){var g=u.latestRegister,y=Ye.registerController.getRegister(g);y&&y.pushText(p)}}function Qn(u){if(!u.isPlaying){var p=u.latestRegister,g=Ye.registerController.getRegister(p);g&&g.pushInsertModeChanges&&g.pushInsertModeChanges(u.lastInsertModeChanges)}}function Rn(u,p){if(!u.isPlaying){var g=u.latestRegister,y=Ye.registerController.getRegister(g);y&&y.pushSearchQuery&&y.pushSearchQuery(p)}}function hn(u,p){var g=Ye.macroModeState,y=g.lastInsertModeChanges;if(!g.isPlaying)for(var b=u.state.vim;p;){if(y.expectCursorActivityForChange=!0,y.ignoreCount>1)y.ignoreCount--;else if(p.origin=="+input"||p.origin=="paste"||p.origin===void 0){var I=u.listSelections().length;I>1&&(y.ignoreCount=I);var P=p.text.join(` -`);if(y.maybeReset&&(y.changes=[],y.maybeReset=!1),P)if(u.state.overwrite&&!/\n/.test(P))y.changes.push([P]);else{if(P.length>1){var M=b&&b.insertEnd&&b.insertEnd.find(),R=u.getCursor();if(M&&M.line==R.line){var V=M.ch-R.ch;V>0&&V",kt(y,g))}else p.insertMode||(p.lastHPos=u.getCursor().ch)}function Wr(u){this.keyName=u}function dn(u){var p=Ye.macroModeState,g=p.lastInsertModeChanges,y=s.keyName(u);if(!y)return;function b(){return g.maybeReset&&(g.changes=[],g.maybeReset=!1),g.changes.push(new Wr(y)),!0}(y.indexOf("Delete")!=-1||y.indexOf("Backspace")!=-1)&&s.lookupKey(y,"vim-insert",b)}function pn(u,p,g,y){var b=Ye.macroModeState;b.isPlaying=!0;var I=!!p.lastEditActionCommand,P=p.inputState;function M(){I?ui.processAction(u,p,p.lastEditActionCommand):ui.evalInput(u,p)}function R(Z){if(b.lastInsertModeChanges.changes.length>0){Z=p.lastEditActionCommand?Z:1;var $e=b.lastInsertModeChanges;On(u,$e.changes,Z)}}if(p.inputState=p.lastEditInputState,I&&p.lastEditActionCommand.interlaceInsertRepeat)for(var V=0;V"&&!b.insertMode&&!b.visualMode&&P&&b.status=="")Lt(u);else if(I||!P||u.inVirtualSelectionMode)y=Tt.handleKey(u,p,g);else{var M=Fr(b),R=b.inputState.changeQueueList||[];u.operation(function(){u.curOp.isVimOp=!0;var V=0;u.forEachSelection(function(){u.state.vim.inputState.changeQueue=R[V];var Z=u.getCursor("head"),$e=u.getCursor("anchor"),Pe=qe(Z,$e)?0:-1,oe=qe(Z,$e)?-1:0;Z=wt(Z,0,Pe),$e=wt($e,0,oe),u.state.vim.sel.head=Z,u.state.vim.sel.anchor=$e,y=Tt.handleKey(u,p,g),u.virtualSelection&&(R[V]=u.state.vim.inputState.changeQueue,u.state.vim=Fr(M)),V++}),u.curOp.cursorActivity&&!y&&(u.curOp.cursorActivity=!1),u.state.vim=b,b.inputState.changeQueueList=R,b.inputState.changeQueue=null},!0)}return y&&!b.visualMode&&!b.insert&&b.visualMode!=u.somethingSelected()&&fn(u,b),y}return hr(),Tt}function indexFromPos(s,e){var r=e.ch,n=e.line+1;n<1&&(n=1,r=0),n>s.lines&&(n=s.lines,r=Number.MAX_VALUE);var o=s.line(n);return Math.min(o.from+Math.max(0,r),o.to)}function posFromIndex(s,e){let r=s.lineAt(e);return{line:r.number-1,ch:e-r.from}}class Pos{constructor(e,r){this.line=e,this.ch=r}}function on(s,e,r){if(s.addEventListener)s.addEventListener(e,r,!1);else{var n=s._handlers||(s._handlers={});n[e]=(n[e]||[]).concat(r)}}function off(s,e,r){if(s.removeEventListener)s.removeEventListener(e,r,!1);else{var n=s._handlers,o=n&&n[e];if(o){var a=o.indexOf(r);a>-1&&(n[e]=o.slice(0,a).concat(o.slice(a+1)))}}}function signal(s,e,...r){var n,o=(n=s._handlers)===null||n===void 0?void 0:n[e];if(o)for(var a=0;a({anchor:posFromIndex(e,r.anchor),head:posFromIndex(e,r.head)}))}setSelections(e,r){var n=this.cm6.state.doc,o=e.map(a=>EditorSelection.range(indexFromPos(n,a.anchor),indexFromPos(n,a.head)));this.cm6.dispatch({selection:EditorSelection.create(o,r)})}setSelection(e,r,n){var o=this.cm6.state.doc,a=[EditorSelection.range(indexFromPos(o,e),indexFromPos(o,r))];this.cm6.dispatch({selection:EditorSelection.create(a,0)}),n&&n.origin=="*mouse"&&this.onBeforeEndOperation()}getLine(e){var r=this.cm6.state.doc;return e<0||e>=r.lines?"":this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:e,index:this.indexFromPos(new Pos(e,0))}}getLineNumber(e){var r=this.$lineHandleChanges;if(!r)return null;for(var n=e.index,o=0;o({from:o.from,to:o.to,insert:e[a]||""}));dispatchChange(this,{changes:n})}getSelection(){return this.getSelections().join(` +`)}Ot(u,b)},sort:function(u,p){var g,y,b,I,P;function M(){if(p.argString){var ht=new s.StringStream(p.argString);if(ht.eat("!")&&(g=!0),ht.eol())return;if(!ht.eatSpace())return"Invalid arguments";var ut=ht.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!ut&&!ht.eol())return"Invalid arguments";if(ut[1]){y=ut[1].indexOf("i")!=-1,b=ut[1].indexOf("u")!=-1;var Xt=ut[1].indexOf("d")!=-1||ut[1].indexOf("n")!=-1&&1,$t=ut[1].indexOf("x")!=-1&&1,xt=ut[1].indexOf("o")!=-1&&1;if(Xt+$t+xt>1)return"Invalid arguments";I=Xt&&"decimal"||$t&&"hex"||xt&&"octal"}ut[2]&&(P=new RegExp(ut[2].substr(1,ut[2].length-2),y?"i":""))}}var R=M();if(R){Ot(u,R+": "+p.argString);return}var V=p.line||u.firstLine(),Z=p.lineEnd||p.line||u.lastLine();if(V==Z)return;var $e=new e(V,0),Pe=new e(Z,De(u,Z)),Oe=u.getRange($e,Pe).split(` +`),oe=P||(I=="decimal"?/(-?)([\d]+)/:I=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:I=="octal"?/([0-7]+)/:null),Ne=I=="decimal"?10:I=="hex"?16:I=="octal"?8:null,Re=[],He=[];if(I||P)for(var ze=0;ze=V){Ot(u,"Invalid argument: "+p.argString.substring(b));return}for(var Z=0;Z<=V-R;Z++){var $e=String.fromCharCode(R+Z);delete g.marks[$e]}}else{Ot(u,"Invalid argument: "+P+"-");return}}else delete g.marks[I]}}},ei=new an;function An(u,p,g,y,b,I,P,M,R){u.state.vim.exMode=!0;var V=!1,Z,$e,Pe;function Oe(){u.operation(function(){for(;!V;)oe(),Re();He()})}function oe(){var Ze=u.getRange(I.from(),I.to()),yt=Ze.replace(P,M),Dt=I.to().line;I.replace(yt),$e=I.to().line,b+=$e-Dt,Pe=$e1&&(pn(u,g,g.insertModeRepeat-1,!0),g.lastEditInputState.repeatOverride=g.insertModeRepeat),delete g.insertModeRepeat,g.insertMode=!1,p||u.setCursor(u.getCursor().line,u.getCursor().ch-1),u.setOption("keyMap","vim"),u.setOption("disableInput",!0),u.toggleOverwrite(!1),b.setText(P.changes.join("")),s.signal(u,"vim-mode-change",{mode:"normal"}),y.isRecording&&Qn(y)}function cn(u){o.unshift(u)}function Pn(u,p,g,y,b){var I={keys:u,type:p};I[p]=g,I[p+"Args"]=y;for(var P in b)I[P]=b[P];cn(I)}mt("insertModeEscKeysTimeout",200,"number"),s.keyMap["vim-insert"]={fallthrough:["default"],attach:d,detach:f,call:m},s.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:d,detach:f};function Tn(u,p,g,y){var b=Ye.registerController.getRegister(y);if(y==":"){b.keyBuffer[0]&&ei.processCommand(u,b.keyBuffer[0]),g.isPlaying=!1;return}var I=b.keyBuffer,P=0;g.isPlaying=!0,g.replaySearchQueries=b.searchQueries.slice(0);for(var M=0;M|<\w+>|./.exec(R),Z=V[0],R=R.substring(V.index+Z.length),Tt.handleKey(u,Z,"macro"),p.insertMode){var $e=b.insertModeChanges[P++].changes;Ye.macroModeState.lastInsertModeChanges.changes=$e,On(u,$e,1),Ci(u)}g.isPlaying=!1}function Ln(u,p){if(!u.isPlaying){var g=u.latestRegister,y=Ye.registerController.getRegister(g);y&&y.pushText(p)}}function Qn(u){if(!u.isPlaying){var p=u.latestRegister,g=Ye.registerController.getRegister(p);g&&g.pushInsertModeChanges&&g.pushInsertModeChanges(u.lastInsertModeChanges)}}function Rn(u,p){if(!u.isPlaying){var g=u.latestRegister,y=Ye.registerController.getRegister(g);y&&y.pushSearchQuery&&y.pushSearchQuery(p)}}function hn(u,p){var g=Ye.macroModeState,y=g.lastInsertModeChanges;if(!g.isPlaying)for(var b=u.state.vim;p;){if(y.expectCursorActivityForChange=!0,y.ignoreCount>1)y.ignoreCount--;else if(p.origin=="+input"||p.origin=="paste"||p.origin===void 0){var I=u.listSelections().length;I>1&&(y.ignoreCount=I);var P=p.text.join(` +`);if(y.maybeReset&&(y.changes=[],y.maybeReset=!1),P)if(u.state.overwrite&&!/\n/.test(P))y.changes.push([P]);else{if(P.length>1){var M=b&&b.insertEnd&&b.insertEnd.find(),R=u.getCursor();if(M&&M.line==R.line){var V=M.ch-R.ch;V>0&&V",kt(y,g))}else p.insertMode||(p.lastHPos=u.getCursor().ch)}function Wr(u){this.keyName=u}function dn(u){var p=Ye.macroModeState,g=p.lastInsertModeChanges,y=s.keyName(u);if(!y)return;function b(){return g.maybeReset&&(g.changes=[],g.maybeReset=!1),g.changes.push(new Wr(y)),!0}(y.indexOf("Delete")!=-1||y.indexOf("Backspace")!=-1)&&s.lookupKey(y,"vim-insert",b)}function pn(u,p,g,y){var b=Ye.macroModeState;b.isPlaying=!0;var I=!!p.lastEditActionCommand,P=p.inputState;function M(){I?ui.processAction(u,p,p.lastEditActionCommand):ui.evalInput(u,p)}function R(Z){if(b.lastInsertModeChanges.changes.length>0){Z=p.lastEditActionCommand?Z:1;var $e=b.lastInsertModeChanges;On(u,$e.changes,Z)}}if(p.inputState=p.lastEditInputState,I&&p.lastEditActionCommand.interlaceInsertRepeat)for(var V=0;V"&&!b.insertMode&&!b.visualMode&&P&&b.status=="")Lt(u);else if(I||!P||u.inVirtualSelectionMode)y=Tt.handleKey(u,p,g);else{var M=Fr(b),R=b.inputState.changeQueueList||[];u.operation(function(){u.curOp.isVimOp=!0;var V=0;u.forEachSelection(function(){u.state.vim.inputState.changeQueue=R[V];var Z=u.getCursor("head"),$e=u.getCursor("anchor"),Pe=qe(Z,$e)?0:-1,Oe=qe(Z,$e)?-1:0;Z=wt(Z,0,Pe),$e=wt($e,0,Oe),u.state.vim.sel.head=Z,u.state.vim.sel.anchor=$e,y=Tt.handleKey(u,p,g),u.virtualSelection&&(R[V]=u.state.vim.inputState.changeQueue,u.state.vim=Fr(M)),V++}),u.curOp.cursorActivity&&!y&&(u.curOp.cursorActivity=!1),u.state.vim=b,b.inputState.changeQueueList=R,b.inputState.changeQueue=null},!0)}return y&&!b.visualMode&&!b.insert&&b.visualMode!=u.somethingSelected()&&fn(u,b),y}return hr(),Tt}function indexFromPos(s,e){var r=e.ch,n=e.line+1;n<1&&(n=1,r=0),n>s.lines&&(n=s.lines,r=Number.MAX_VALUE);var o=s.line(n);return Math.min(o.from+Math.max(0,r),o.to)}function posFromIndex(s,e){let r=s.lineAt(e);return{line:r.number-1,ch:e-r.from}}class Pos{constructor(e,r){this.line=e,this.ch=r}}function on(s,e,r){if(s.addEventListener)s.addEventListener(e,r,!1);else{var n=s._handlers||(s._handlers={});n[e]=(n[e]||[]).concat(r)}}function off(s,e,r){if(s.removeEventListener)s.removeEventListener(e,r,!1);else{var n=s._handlers,o=n&&n[e];if(o){var a=o.indexOf(r);a>-1&&(n[e]=o.slice(0,a).concat(o.slice(a+1)))}}}function signal(s,e,...r){var n,o=(n=s._handlers)===null||n===void 0?void 0:n[e];if(o)for(var a=0;a({anchor:posFromIndex(e,r.anchor),head:posFromIndex(e,r.head)}))}setSelections(e,r){var n=this.cm6.state.doc,o=e.map(a=>EditorSelection.range(indexFromPos(n,a.anchor),indexFromPos(n,a.head)));this.cm6.dispatch({selection:EditorSelection.create(o,r)})}setSelection(e,r,n){var o=this.cm6.state.doc,a=[EditorSelection.range(indexFromPos(o,e),indexFromPos(o,r))];this.cm6.dispatch({selection:EditorSelection.create(a,0)}),n&&n.origin=="*mouse"&&this.onBeforeEndOperation()}getLine(e){var r=this.cm6.state.doc;return e<0||e>=r.lines?"":this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:e,index:this.indexFromPos(new Pos(e,0))}}getLineNumber(e){var r=this.$lineHandleChanges;if(!r)return null;for(var n=e.index,o=0;o({from:o.from,to:o.to,insert:e[a]||""}));dispatchChange(this,{changes:n})}getSelection(){return this.getSelections().join(` `)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(r=>e.state.sliceDoc(r.from,r.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var r=this.cm6.state.doc,n=e.ch,o=e.line+1;o<1&&(o=1,n=0),o>r.lines&&(o=r.lines,n=Number.MAX_VALUE);var a=r.line(o);return n=Math.min(Math.max(0,n),a.to-a.from),new Pos(o-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var r=this.cm6;return r.dispatch({changes:{from:0,to:r.state.doc.length,insert:e},selection:EditorSelection.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e){var r=this.cm6.state,n=indexFromPos(r.doc,e),o=matchBrackets(r,n+1,-1);return o&&o.end?{to:posFromIndex(r.doc,o.end.from)}:(o=matchBrackets(r,n,1),o&&o.end?{to:posFromIndex(r.doc,o.end.from)}:{to:void 0})}scanForBracket(e,r,n,o){return scanForBracket(this,e,r,n,o)}indentLine(e,r){r?this.indentMore():this.indentLess()}indentMore(){indentMore(this.cm6)}indentLess(){indentLess(this.cm6)}execCommand(e){e=="indentAuto"?CodeMirror.commands.indentAuto(this):e=="goLineLeft"?cursorLineBoundaryBackward(this.cm6):e=="goLineRight"?(cursorLineBoundaryForward(this.cm6),cursorCharBackward(this.cm6)):console.log(e+" is not implemented")}setBookmark(e,r){var n=r!=null&&r.insertLeft?1:-1,o=this.indexFromPos(e),a=new Marker(this,o,n);return a}addOverlay({query:e}){let r=new SearchQuery({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(r.valid){r.forVim=!0,this.cm6Query=r;let n=setSearchQuery.of(r);return this.cm6.dispatch({effects:n}),r}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let r=setSearchQuery.of(this.cm6Query);this.cm6.dispatch({effects:r})}getSearchCursor(e,r){var n=this,o=null,a=null;r.ch==null&&(r.ch=Number.MAX_VALUE);var l=indexFromPos(n.cm6.state.doc,r),c=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(v,A){return A||"\\"+v});function h(v,A=0,T=v.length){return new RegExpCursor(v,c,{ignoreCase:e.ignoreCase},A,T)}function f(v){var A=n.cm6.state.doc;if(v>A.length)return null;let T=h(A,v).next();return T.done?null:T.value}var d=1e4;function m(v,A){var T=n.cm6.state.doc;for(let B=1;;B++){let Y=Math.max(v,A-B*d),F=h(T,Y,A),ke=null;for(;!F.next().done;)ke=F.value;if(ke&&(Y==v||ke.from>Y+10))return ke;if(Y==v)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(v){var A=n.cm6.state.doc;if(v){let T=o?o.from==o.to?o.to-1:o.from:l;o=m(0,T)}else{let T=o?o.from==o.to?o.to+1:o.to:l;o=f(T)}return a=o&&{from:posFromIndex(A,o.from),to:posFromIndex(A,o.to),match:o.match},o&&o.match},from:function(){return a==null?void 0:a.from},to:function(){return a==null?void 0:a.to},replace:function(v){o&&(dispatchChange(n,{changes:{from:o.from,to:o.to,insert:v}}),o.to=o.from+v.length,a&&(a.to=posFromIndex(n.cm6.state.doc,o.to)))}}}findPosV(e,r,n,o){let{cm6:a}=this;const l=a.state.doc;let c=n=="page"?a.dom.clientHeight:0;const h=indexFromPos(l,e);let f=EditorSelection.range(h,h,o),d=Math.round(Math.abs(r));for(let v=0;v0,c):n=="line"&&(f=a.moveVertically(f,r>0));let m=posFromIndex(l,f.head);return(r<0&&f.head==0&&o!=0&&e.line==0&&e.ch!=0||r>0&&f.head==l.length&&m.ch!=o&&e.line==m.line)&&(m.hitSide=!0),m}charCoords(e,r){var n=this.cm6.contentDOM.getBoundingClientRect(),o=indexFromPos(this.cm6.state.doc,e),a=this.cm6.coordsAtPos(o),l=-n.top;return{left:((a==null?void 0:a.left)||0)-n.left,top:((a==null?void 0:a.top)||0)+l,bottom:((a==null?void 0:a.bottom)||0)+l}}coordsChar(e,r){var n=this.cm6.contentDOM.getBoundingClientRect(),o=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return posFromIndex(this.cm6.state.doc,o)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,r){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),r!=null&&(this.cm6.scrollDOM.scrollTop=r)}scrollIntoView(e,r){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:EditorView.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:"scroll"})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption("mode")}}setSize(e,r){this.cm6.dom.style.width=e+4+"px",this.cm6.dom.style.height=r+"px",this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let n in this.marks)this.marks[n].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(n=>n.map(e.changes)));var r=this.curOp=this.curOp||{};e.changes.iterChanges((n,o,a,l,c)=>{(r.$changeStart==null||r.$changeStart>a)&&(r.$changeStart=a),this.$lastChangeEndOffset=l;var h={text:c.toJSON()};r.lastChange?r.lastChange.next=r.lastChange=h:r.lastChange=r.change=h},!0),r.changeHandlers||(r.changeHandlers=this._handlers.change&&this._handlers.change.slice())}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||(e.cursorActivityHandlers=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice()),this.curOp.cursorActivity=!0}operation(e){this.curOp||(this.curOp={$d:0}),this.curOp.$d++;try{var r=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return r}onBeforeEndOperation(){var e=this.curOp,r=!1;e&&(e.change&&signalTo(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(signalTo(e.cursorActivityHandlers,this,null),e.isVimOp&&(r=!0)),this.curOp=null),r&&this.scrollIntoView()}moveH(e,r){if(r=="char"){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,r){switch(e){case"keyMap":this.state.keyMap=r;break}}getOption(e){switch(e){case"firstLineNumber":return 1;case"tabSize":return this.cm6.state.tabSize||4;case"readonly":return this.cm6.state.readOnly;case"indentWithTabs":return this.cm6.state.facet(indentUnit)==" ";case"indentUnit":return this.cm6.state.facet(indentUnit).length||2;case"keyMap":return this.state.keyMap||"vim"}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var r,n=this.indexFromPos(e),o=ensureSyntaxTree(this.cm6.state,n),a=o==null?void 0:o.resolve(n),l=((r=a==null?void 0:a.type)===null||r===void 0?void 0:r.name)||"";return/comment/i.test(l)?"comment":/string/i.test(l)?"string":""}overWriteSelection(e){var r=this.cm6.state.doc,n=this.cm6.state.selection,o=n.ranges.map(a=>{if(a.empty){var l=a.to1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var r=this.cm6.state.selection;this.virtualSelection=EditorSelection.create(r.ranges,r.mainIndex);for(var n=0;ndispatchChange(s,e)})},indentAuto:function(s){indentSelection(s.cm6)}};CodeMirror.defineOption=function(s,e,r){};CodeMirror.isWordChar=function(s){return wordChar.test(s)};CodeMirror.keys=keys;CodeMirror.keyMap={};CodeMirror.addClass=function(){};CodeMirror.rmClass=function(){};CodeMirror.e_preventDefault=function(s){s.preventDefault()};CodeMirror.e_stop=function(s){var e,r;(e=s==null?void 0:s.stopPropagation)===null||e===void 0||e.call(s),(r=s==null?void 0:s.preventDefault)===null||r===void 0||r.call(s)};CodeMirror.keyName=function(s){var e=s.key;if(!ignoredKeys[e]){e=="Escape"&&(e="Esc"),e==" "&&(e="Space"),e.length>1&&(e=e.replace(/Numpad|Arrow/,"")),e.length==1&&(e=e.toUpperCase());var r="";return s.ctrlKey&&(r+="Ctrl-"),s.altKey&&(r+="Alt-"),(r||e.length>1)&&s.shiftKey&&(r+="Shift-"),r+=e,r}};CodeMirror.vimKey=function(e){var r=e.key;if(!ignoredKeys[r]){r.length>1&&r[0]=="n"&&(r=r.replace("Numpad","")),r=specialKey[r]||r;var n="";return e.ctrlKey&&(n+="C-"),e.altKey&&(n+="A-"),e.metaKey&&(n+="M-"),CodeMirror.isMac&&e.altKey&&!e.metaKey&&!e.ctrlKey&&(n=n.slice(2)),(n||r.length>1)&&e.shiftKey&&(n+="S-"),n+=r,n.length>1&&(n="<"+n+">"),n}};CodeMirror.lookupKey=function(e,r,n){var o=CodeMirror.keys[e];o&&n(o)};CodeMirror.on=on;CodeMirror.off=off;CodeMirror.signal=signal;CodeMirror.findMatchingTag=findMatchingTag;CodeMirror.findEnclosingTag=findEnclosingTag;function dialogDiv(s,e,r){var n=document.createElement("div");return n.appendChild(e),n}function closeNotification(s,e){s.state.currentNotificationClose&&s.state.currentNotificationClose(),s.state.currentNotificationClose=e}function openNotification(s,e,r){closeNotification(s,c);var n=dialogDiv(s,e,r&&r.bottom),o=!1,a,l=r&&typeof r.duration<"u"?r.duration:5e3;function c(){o||(o=!0,clearTimeout(a),n.remove(),hideDialog(s,n))}return n.onclick=function(h){h.preventDefault(),c()},showDialog(s,n),l&&(a=setTimeout(c,l)),c}function showDialog(s,e){var r=s.state.dialog;s.state.dialog=e,e&&r!==e&&(r&&r.contains(document.activeElement)&&s.focus(),r&&r.parentElement?r.parentElement.replaceChild(e,r):r&&r.remove(),CodeMirror.signal(s,"dialog"))}function hideDialog(s,e){s.state.dialog==e&&(s.state.dialog=null,CodeMirror.signal(s,"dialog"))}function openDialog(s,e,r,n){n||(n={}),closeNotification(s,void 0);var o=dialogDiv(s,e,n.bottom),a=!1;showDialog(s,o);function l(h){if(typeof h=="string")c.value=h;else{if(a)return;a=!0,hideDialog(s,o),s.state.dialog||s.focus(),n.onClose&&n.onClose(o)}}var c=o.getElementsByTagName("input")[0];return c&&(n.value&&(c.value=n.value,n.selectValueOnOpen!==!1&&c.select()),n.onInput&&CodeMirror.on(c,"input",function(h){n.onInput(h,c.value,l)}),n.onKeyUp&&CodeMirror.on(c,"keyup",function(h){n.onKeyUp(h,c.value,l)}),CodeMirror.on(c,"keydown",function(h){n&&n.onKeyDown&&n.onKeyDown(h,c.value,l)||(h.keyCode==13&&r(c.value),(h.keyCode==27||n.closeOnEnter!==!1&&h.keyCode==13)&&(c.blur(),CodeMirror.e_stop(h),l()))}),n.closeOnBlur!==!1&&CodeMirror.on(c,"blur",function(){setTimeout(function(){document.activeElement!==c&&l()})}),c.focus()),l}var matching={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function bracketRegex(s){return s&&s.bracketRegex||/[(){}[\]]/}function scanForBracket(s,e,r,n,o){for(var a=o&&o.maxScanLineLength||1e4,l=o&&o.maxScanLines||1e3,c=[],h=bracketRegex(o),f=r>0?Math.min(e.line+l,s.lastLine()+1):Math.max(s.firstLine()-1,e.line-l),d=e.line;d!=f;d+=r){var m=s.getLine(d);if(m){var v=r>0?0:m.length-1,A=r>0?m.length:-1;if(!(m.length>a))for(d==e.line&&(v=e.ch-(r<0?1:0));v!=A;v+=r){var T=m.charAt(v);if(h.test(T)){var B=matching[T];if(B&&B.charAt(1)==">"==r>0)c.push(T);else if(c.length)c.pop();else return{pos:new Pos(d,v),ch:T}}}}}return d-r==(r>0?s.lastLine():s.firstLine())?!1:null}function findMatchingTag(s,e){}function findEnclosingTag(s,e){var r,n,o=s.cm6.state,a=s.indexFromPos(e);if(a!r.eq(this.cursors[n]))){let r=this.cursorLayer.children;if(r.length!==e.length){this.cursorLayer.textContent="";for(const n of e)this.cursorLayer.appendChild(n.draw())}else e.forEach((n,o)=>n.adjust(r[o]));this.cursors=e}}destroy(){this.cursorLayer.remove()}}const themeSpec={".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-fat-cursor":{position:"absolute",background:"#ff9696",border:"none",whiteSpace:"pre"},"&:not(.cm-focused) .cm-fat-cursor":{background:"none",outline:"solid 1px #ff9696",color:"transparent !important"}},hideNativeSelection=Prec.highest(EditorView.theme(themeSpec));function getBase(s){let e=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==Direction.LTR?e.left:e.right-s.scrollDOM.clientWidth)-s.scrollDOM.scrollLeft,top:e.top-s.scrollDOM.scrollTop}}function measureCursor(s,e,r,n){let o=r.head,a=!1,l=1,c=s.state.vim;if(c&&(!c.insertMode||s.state.overwrite)){if(a=!0,c.visualBlock&&!n)return null;r.anchor1&&(o--,f=e.state.sliceDoc(o,o+1));let d=e.coordsAtPos(o,1);if(!d)return null;let m=getBase(e),v=e.domAtPos(o),A=v?v.node:e.contentDOM;for(;v&&v.node instanceof HTMLElement;)A=v.node,v={node:v.node.childNodes[v.offset],offset:0};if(!(A instanceof HTMLElement)){if(!A.parentNode)return null;A=A.parentNode}let T=getComputedStyle(A),B=d.left;if(!f||f==` -`||f=="\r")f=" ";else if(f==" "){f=" ";var h=e.coordsAtPos(o+1,-1);h&&(B=h.left-(h.left-d.left)/parseInt(T.tabSize))}else/[\uD800-\uDBFF]/.test(f)&&o{e.state.vim&&(e.state.vim.status=""),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on("vim-mode-change",r=>{e.state.vim.mode=r.mode,r.subMode&&(e.state.vim.mode+=" block"),e.state.vim.status="",this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus()}),this.cm.on("dialog",()=>{this.cm.state.statusbar?this.updateStatus():s.dispatch({effects:showVimPanel.of(!!this.cm.state.dialog)})}),this.dom=document.createElement("span"),this.dom.style.cssText="position: absolute; right: 10px; top: 1px",this.statusButton=document.createElement("span"),this.statusButton.onclick=r=>{Vim.handleKey(this.cm,"","user"),this.cm.focus()},this.statusButton.style.cssText="cursor: pointer"}update(s){var e;if((s.viewportChanged||s.docChanged)&&this.query&&this.highlight(this.query),s.docChanged&&this.cm.onChange(s),s.selectionSet&&this.cm.onSelectionChange(),s.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),s.transactions){for(let r of s.transactions)for(let n of r.effects)if(n.is(setSearchQuery))if(!((e=n.value)===null||e===void 0?void 0:e.forVim))this.highlight(null);else{let a=n.value.create();this.highlight(a)}}this.blockCursor.update(s)}updateClass(){const s=this.cm.state;!s.vim||s.vim.insertMode&&!s.overwrite?this.view.scrollDOM.classList.remove("cm-vimMode"):this.view.scrollDOM.classList.add("cm-vimMode")}updateStatus(){let s=this.cm.state.statusbar,e=this.cm.state.vim;if(!s||!e)return;let r=this.cm.state.dialog;if(r)r.parentElement!=s&&(s.textContent="",s.appendChild(r));else{s.textContent="";var n=(e.mode||"normal").toUpperCase();e.insertModeReturn&&(n+="(C-O)"),this.statusButton.textContent=`--${n}--`,s.appendChild(this.statusButton)}this.dom.textContent=e.status,s.appendChild(this.dom)}destroy(){Vim.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(s){if(this.query=s,!s)return this.decorations=Decoration.none;let{view:e}=this,r=new RangeSetBuilder;for(let n=0,o=e.visibleRanges,a=o.length;no[n+1].from-2*HighlightMargin;)c=o[++n].to;s.highlight(e.state,l,c,(h,f)=>{r.add(h,f,matchMark)})}return this.decorations=r.finish()}handleKey(s,e){const r=CodeMirror.vimKey(s),n=this.cm;if(!r)return;let o=n.state.vim;if(!o)return;if(r==""&&!o.insertMode&&!o.visualMode&&this.query){const c=o.searchState_;c&&(n.removeOverlay(c.getOverlay()),c.setOverlay(null))}if(r===""&&!CodeMirror.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;o.status=(o.status||"")+r;let l=Vim.multiSelectHandleKey(n,r,"user");return o=n.state.vim,!l&&o.insertMode&&n.state.overwrite&&(s.key&&s.key.length==1&&!/\n/.test(s.key)?(l=!0,n.overWriteSelection(s.key)):s.key=="Backspace"&&(l=!0,CodeMirror.commands.cursorCharLeft(n))),l&&(CodeMirror.signal(this.cm,"vim-keypress",r),s.preventDefault(),s.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!l}},{eventHandlers:{copy:function(s,e){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var r=this.cm,n=r.state.vim;n&&(n.insertMode?r.setSelection(r.getCursor(),r.getCursor()):r.operation(()=>{r.curOp&&(r.curOp.isVimOp=!0),Vim.handleKey(r,"","user")}))}))},compositionstart:function(s,e){this.useNextTextInput=!0},keypress:function(s,e){this.lastKeydown=="Dead"&&this.handleKey(s,e)},keydown:function(s,e){this.lastKeydown=s.key,this.lastKeydown=="Unidentified"||this.lastKeydown=="Process"||this.lastKeydown=="Dead"?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(s,e))}},provide:()=>[EditorView.inputHandler.of((s,e,r,n)=>{var o,a,l=getCM(s);if(!l)return!1;var c=(o=l.state)===null||o===void 0?void 0:o.vim,h=l.state.vimPlugin;return c&&!c.insertMode&&!(!((a=l.curOp)===null||a===void 0)&&a.isVimOp)?(n==="\0\0"||(n.length==1&&h.useNextTextInput&&h.handleKey({key:n,preventDefault:()=>{},stopPropagation:()=>{}}),forceEndComposition(s)),!0):!1})],decorations:s=>s.decorations});function forceEndComposition(s){var e=s.scrollDOM.parentElement;if(e){if(FIREFOX_LINUX){s.contentDOM.textContent="\0\0",s.contentDOM.dispatchEvent(new CustomEvent("compositionend"));return}var r=s.scrollDOM.nextSibling,n=window.getSelection(),o=n&&{anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset};s.scrollDOM.remove(),e.insertBefore(s.scrollDOM,r);try{o&&n&&(n.setPosition(o.anchorNode,o.anchorOffset),o.focusNode&&n.extend(o.focusNode,o.focusOffset))}catch(a){console.error(a)}s.focus(),s.contentDOM.dispatchEvent(new CustomEvent("compositionend"))}}const matchMark=Decoration.mark({class:"cm-searchMatch"}),showVimPanel=StateEffect.define(),vimPanelState=StateField.define({create:()=>!1,update(s,e){for(let r of e.effects)r.is(showVimPanel)&&(s=r.value);return s},provide:s=>showPanel.from(s,e=>e?createVimPanel:null)});function createVimPanel(s){let e=document.createElement("div");e.className="cm-vim-panel";let r=s.cm;return r.state.dialog&&e.appendChild(r.state.dialog),{top:!1,dom:e}}function statusPanel(s){let e=document.createElement("div");e.className="cm-vim-panel";let r=s.cm;return r.state.statusbar=e,r.state.vimPlugin.updateStatus(),{dom:e}}function vim(s={}){return[vimStyle,vimPlugin,hideNativeSelection,s.status?showPanel.of(statusPanel):vimPanelState]}function getCM(s){return s.cm||null}const delay=s=>new Promise((e,r)=>setTimeout(()=>r(new Error("Operation took too long")),s)),tryCatchWrapper=(s,e)=>new Promise((r,n)=>{try{Function(`with (this) {try{${e}} catch (e) {console.log(e)}};`).call(s.api),r(!0)}catch(o){console.log(o),r(!1)}}),tryEvaluate=async(s,e,r=5e3)=>{try{e.evaluations++,await Promise.race([tryCatchWrapper(s,`let i = ${e.evaluations};`+e.candidate),delay(r)])?e.committed=e.candidate:await evaluate(s,e,r)}catch(n){console.log(n)}},evaluate=async(s,e,r=1e3)=>{try{await Promise.race([tryCatchWrapper(s,e.committed),delay(r)]),e.evaluations&&e.evaluations++}catch(n){console.log(n)}},zeroPad=(s,e)=>String(s).padStart(e,"0");class TransportNode extends AudioWorkletNode{constructor(r,n,o){super(r,"transport",n);Se(this,"handleMessage",r=>{if(r.data&&r.data.type==="bang"){this.startTime===null&&(this.startTime=r.data.currentTime),this.elapsedTime=r.data.currentTime-this.startTime,this.prevCurrentTime=r.data.currentTime;let{futureTimeStamp:n,timeToNextPulse:o,nextPulsePosition:a}=this.convertTimeToNextBarsBeats(this.elapsedTime);this.nextPulsePosition!==a&&(this.nextPulsePosition=a,setTimeout(()=>{const l=performance.now();this.app.clock.time_position=n,this.$clock.innerHTML=`[${n.bar}:${n.beat}:${zeroPad(n.pulse,"2")}]`,tryEvaluate(this.app,this.app.global_buffer),this.hasBeenEvaluated=!0,this.currentPulsePosition=a;const c=performance.now();this.lastLatencies[this.indexOfLastLatencies]=c-l,this.indexOfLastLatencies=(this.indexOfLastLatencies+1)%this.lastLatencies.length;const h=this.lastLatencies.reduce((f,d)=>f+d)/this.lastLatencies.length;this.executionLatency=h/1e3},(o+this.executionLatency)*1e3))}});this.app=o,this.port.addEventListener("message",this.handleMessage),this.port.start(),this.$clock=document.getElementById("clockviewer"),this.hasBeenEvaluated=!1,this.currentPulsePosition=0,this.nextPulsePosition=-1,this.executionLatency=0,this.lastLatencies=[0,0,0,0,0,0,0,0,0,0],this.indexOfLastLatencies=0,this.startTime=null,this.elapsedTime=0}start(){this.port.postMessage("start")}pause(){this.port.postMessage("pause")}stop(){this.startTime=null,this.elapsedTime=null,this.app.clock.tick=0,this.$clock.innerHTML=`[1 | 1 | ${zeroPad(1,"2")}]`,this.port.postMessage("stop")}convertTimeToBarsBeats(r){const n=60/this.app.clock.bpm,o=r/n,a=this.app.clock.time_signature[0],l=Math.floor(o/a)+1,c=Math.floor(o%a)+1,h=Math.floor(o%1*this.app.clock.ppqn);return this.app.clock.tick++,{bar:l,beat:c,ppqn:h}}convertTimeToNextBarsBeats(r){const n=60/this.app.clock.bpm,o=r/n,a=this.app.clock.time_signature[0];this.currentPulsePosition=o*this.app.clock.ppqn;const l=Math.ceil(this.currentPulsePosition),c=this.app.clock.convertPulseToSecond(this.nextPulsePosition-this.currentPulsePosition),h=this.nextPulsePosition/this.app.clock.ppqn,f=h/a,d={bar:Math.floor(f)+1,beat:Math.floor(h)%a+1,pulse:Math.floor(this.nextPulsePosition)%this.app.clock.ppqn};return this.app.clock.tick++,{futureTimeStamp:d,timeToNextPulse:c,nextPulsePosition:l}}}const TransportProcessor="/assets/TransportProcessor-9e6f56da.js";class Clock{constructor(e,r){Se(this,"ctx");Se(this,"transportNode");Se(this,"bpm");Se(this,"time_signature");Se(this,"time_position");Se(this,"ppqn");Se(this,"tick");this.app=e,this.time_position={bar:0,beat:0,pulse:0},this.time_signature=[4,4],this.tick=0,this.bpm=120,this.ppqn=48,this.transportNode=null,this.ctx=r,r.audioWorklet.addModule(TransportProcessor).then(n=>(this.transportNode=new TransportNode(r,{},this.app),this.transportNode.connect(r.destination),n)).catch(n=>{console.log("Error loading TransportProcessor.js:",n)})}get ticks_before_new_bar(){const e=(this.app.clock.beats_since_origin-1)*48+this.time_position.pulse+1;return this.beats_per_bar*this.ppqn*this.time_position.bar+1-e}get beats_per_bar(){return this.time_signature[0]}get beats_since_origin(){return(this.time_position.bar-1)*this.beats_per_bar+this.time_position.beat}get pulses_since_origin(){return this.beats_since_origin*this.ppqn+this.time_position.pulse}get pulse_duration(){return 60/this.bpm/this.ppqn}convertPulseToSecond(e){return e*this.pulse_duration}start(){var e,r;((e=this.transportNode)==null?void 0:e.state)==="running"?console.log("Already started"):(this.app.audioContext.resume(),(r=this.transportNode)==null||r.start())}pause(){var e;(e=this.transportNode)==null||e.pause()}stop(){var e;(e=this.transportNode)==null||e.stop()}}const global_text=` +`||f=="\r")f=" ";else if(f==" "){f=" ";var h=e.coordsAtPos(o+1,-1);h&&(B=h.left-(h.left-d.left)/parseInt(T.tabSize))}else/[\uD800-\uDBFF]/.test(f)&&o{e.state.vim&&(e.state.vim.status=""),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on("vim-mode-change",r=>{e.state.vim.mode=r.mode,r.subMode&&(e.state.vim.mode+=" block"),e.state.vim.status="",this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus()}),this.cm.on("dialog",()=>{this.cm.state.statusbar?this.updateStatus():s.dispatch({effects:showVimPanel.of(!!this.cm.state.dialog)})}),this.dom=document.createElement("span"),this.dom.style.cssText="position: absolute; right: 10px; top: 1px",this.statusButton=document.createElement("span"),this.statusButton.onclick=r=>{Vim.handleKey(this.cm,"","user"),this.cm.focus()},this.statusButton.style.cssText="cursor: pointer"}update(s){var e;if((s.viewportChanged||s.docChanged)&&this.query&&this.highlight(this.query),s.docChanged&&this.cm.onChange(s),s.selectionSet&&this.cm.onSelectionChange(),s.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),s.transactions){for(let r of s.transactions)for(let n of r.effects)if(n.is(setSearchQuery))if(!((e=n.value)===null||e===void 0?void 0:e.forVim))this.highlight(null);else{let a=n.value.create();this.highlight(a)}}this.blockCursor.update(s)}updateClass(){const s=this.cm.state;!s.vim||s.vim.insertMode&&!s.overwrite?this.view.scrollDOM.classList.remove("cm-vimMode"):this.view.scrollDOM.classList.add("cm-vimMode")}updateStatus(){let s=this.cm.state.statusbar,e=this.cm.state.vim;if(!s||!e)return;let r=this.cm.state.dialog;if(r)r.parentElement!=s&&(s.textContent="",s.appendChild(r));else{s.textContent="";var n=(e.mode||"normal").toUpperCase();e.insertModeReturn&&(n+="(C-O)"),this.statusButton.textContent=`--${n}--`,s.appendChild(this.statusButton)}this.dom.textContent=e.status,s.appendChild(this.dom)}destroy(){Vim.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(s){if(this.query=s,!s)return this.decorations=Decoration.none;let{view:e}=this,r=new RangeSetBuilder;for(let n=0,o=e.visibleRanges,a=o.length;no[n+1].from-2*HighlightMargin;)c=o[++n].to;s.highlight(e.state,l,c,(h,f)=>{r.add(h,f,matchMark)})}return this.decorations=r.finish()}handleKey(s,e){const r=CodeMirror.vimKey(s),n=this.cm;if(!r)return;let o=n.state.vim;if(!o)return;if(r==""&&!o.insertMode&&!o.visualMode&&this.query){const c=o.searchState_;c&&(n.removeOverlay(c.getOverlay()),c.setOverlay(null))}if(r===""&&!CodeMirror.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;o.status=(o.status||"")+r;let l=Vim.multiSelectHandleKey(n,r,"user");return o=n.state.vim,!l&&o.insertMode&&n.state.overwrite&&(s.key&&s.key.length==1&&!/\n/.test(s.key)?(l=!0,n.overWriteSelection(s.key)):s.key=="Backspace"&&(l=!0,CodeMirror.commands.cursorCharLeft(n))),l&&(CodeMirror.signal(this.cm,"vim-keypress",r),s.preventDefault(),s.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!l}},{eventHandlers:{copy:function(s,e){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var r=this.cm,n=r.state.vim;n&&(n.insertMode?r.setSelection(r.getCursor(),r.getCursor()):r.operation(()=>{r.curOp&&(r.curOp.isVimOp=!0),Vim.handleKey(r,"","user")}))}))},compositionstart:function(s,e){this.useNextTextInput=!0},keypress:function(s,e){this.lastKeydown=="Dead"&&this.handleKey(s,e)},keydown:function(s,e){this.lastKeydown=s.key,this.lastKeydown=="Unidentified"||this.lastKeydown=="Process"||this.lastKeydown=="Dead"?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(s,e))}},provide:()=>[EditorView.inputHandler.of((s,e,r,n)=>{var o,a,l=getCM(s);if(!l)return!1;var c=(o=l.state)===null||o===void 0?void 0:o.vim,h=l.state.vimPlugin;return c&&!c.insertMode&&!(!((a=l.curOp)===null||a===void 0)&&a.isVimOp)?(n==="\0\0"||(n.length==1&&h.useNextTextInput&&h.handleKey({key:n,preventDefault:()=>{},stopPropagation:()=>{}}),forceEndComposition(s)),!0):!1})],decorations:s=>s.decorations});function forceEndComposition(s){var e=s.scrollDOM.parentElement;if(e){if(FIREFOX_LINUX){s.contentDOM.textContent="\0\0",s.contentDOM.dispatchEvent(new CustomEvent("compositionend"));return}var r=s.scrollDOM.nextSibling,n=window.getSelection(),o=n&&{anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset};s.scrollDOM.remove(),e.insertBefore(s.scrollDOM,r);try{o&&n&&(n.setPosition(o.anchorNode,o.anchorOffset),o.focusNode&&n.extend(o.focusNode,o.focusOffset))}catch(a){console.error(a)}s.focus(),s.contentDOM.dispatchEvent(new CustomEvent("compositionend"))}}const matchMark=Decoration.mark({class:"cm-searchMatch"}),showVimPanel=StateEffect.define(),vimPanelState=StateField.define({create:()=>!1,update(s,e){for(let r of e.effects)r.is(showVimPanel)&&(s=r.value);return s},provide:s=>showPanel.from(s,e=>e?createVimPanel:null)});function createVimPanel(s){let e=document.createElement("div");e.className="cm-vim-panel";let r=s.cm;return r.state.dialog&&e.appendChild(r.state.dialog),{top:!1,dom:e}}function statusPanel(s){let e=document.createElement("div");e.className="cm-vim-panel";let r=s.cm;return r.state.statusbar=e,r.state.vimPlugin.updateStatus(),{dom:e}}function vim(s={}){return[vimStyle,vimPlugin,hideNativeSelection,s.status?showPanel.of(statusPanel):vimPanelState]}function getCM(s){return s.cm||null}const delay=s=>new Promise((e,r)=>setTimeout(()=>r(new Error("Operation took too long")),s)),tryCatchWrapper=(s,e)=>new Promise((r,n)=>{try{Function(`with (this) {try{${e}} catch (e) {console.log(e)}};`).call(s.api),r(!0)}catch(o){console.log(o),r(!1)}}),tryEvaluate=async(s,e,r=5e3)=>{try{e.evaluations++,await Promise.race([tryCatchWrapper(s,`let i = ${e.evaluations};`+e.candidate),delay(r)])?e.committed=e.candidate:await evaluate(s,e,r)}catch(n){console.log(n)}},evaluate=async(s,e,r=1e3)=>{try{await Promise.race([tryCatchWrapper(s,e.committed),delay(r)]),e.evaluations&&e.evaluations++}catch(n){console.log(n)}},zeroPad=(s,e)=>String(s).padStart(e,"0");class TransportNode extends AudioWorkletNode{constructor(r,n,o){super(r,"transport",n);z(this,"handleMessage",r=>{if(r.data&&r.data.type==="bang"){this.startTime===null&&(this.startTime=r.data.currentTime),this.elapsedTime=r.data.currentTime-this.startTime,this.prevCurrentTime=r.data.currentTime;let{futureTimeStamp:n,timeToNextPulse:o,nextPulsePosition:a}=this.convertTimeToNextBarsBeats(this.elapsedTime);this.nextPulsePosition!==a&&(this.nextPulsePosition=a,setTimeout(()=>{const l=performance.now();this.app.clock.time_position=n,this.$clock.innerHTML=`[${n.bar}:${n.beat}:${zeroPad(n.pulse,"2")}]`,tryEvaluate(this.app,this.app.global_buffer),this.hasBeenEvaluated=!0,this.currentPulsePosition=a;const c=performance.now();this.lastLatencies[this.indexOfLastLatencies]=c-l,this.indexOfLastLatencies=(this.indexOfLastLatencies+1)%this.lastLatencies.length;const h=this.lastLatencies.reduce((f,d)=>f+d)/this.lastLatencies.length;this.executionLatency=h/1e3},(o+this.executionLatency)*1e3))}});this.app=o,this.port.addEventListener("message",this.handleMessage),this.port.start(),this.$clock=document.getElementById("clockviewer"),this.hasBeenEvaluated=!1,this.currentPulsePosition=0,this.nextPulsePosition=-1,this.executionLatency=0,this.lastLatencies=[0,0,0,0,0,0,0,0,0,0],this.indexOfLastLatencies=0,this.startTime=null,this.elapsedTime=0}start(){this.port.postMessage("start")}pause(){this.port.postMessage("pause")}stop(){this.startTime=null,this.elapsedTime=null,this.app.clock.tick=0,this.$clock.innerHTML=`[1 | 1 | ${zeroPad(1,"2")}]`,this.port.postMessage("stop")}convertTimeToBarsBeats(r){const n=60/this.app.clock.bpm,o=r/n,a=this.app.clock.time_signature[0],l=Math.floor(o/a)+1,c=Math.floor(o%a)+1,h=Math.floor(o%1*this.app.clock.ppqn);return this.app.clock.tick++,{bar:l,beat:c,ppqn:h}}convertTimeToNextBarsBeats(r){const n=60/this.app.clock.bpm,o=r/n,a=this.app.clock.time_signature[0];this.currentPulsePosition=o*this.app.clock.ppqn;const l=Math.ceil(this.currentPulsePosition),c=this.app.clock.convertPulseToSecond(this.nextPulsePosition-this.currentPulsePosition),h=this.nextPulsePosition/this.app.clock.ppqn,f=h/a,d={bar:Math.floor(f)+1,beat:Math.floor(h)%a+1,pulse:Math.floor(this.nextPulsePosition)%this.app.clock.ppqn};return this.app.clock.tick++,{futureTimeStamp:d,timeToNextPulse:c,nextPulsePosition:l}}}const TransportProcessor="/assets/TransportProcessor-9e6f56da.js";class Clock{constructor(e,r){z(this,"ctx");z(this,"transportNode");z(this,"bpm");z(this,"time_signature");z(this,"time_position");z(this,"ppqn");z(this,"tick");this.app=e,this.time_position={bar:0,beat:0,pulse:0},this.time_signature=[4,4],this.tick=0,this.bpm=120,this.ppqn=48,this.transportNode=null,this.ctx=r,r.audioWorklet.addModule(TransportProcessor).then(n=>(this.transportNode=new TransportNode(r,{},this.app),this.transportNode.connect(r.destination),n)).catch(n=>{console.log("Error loading TransportProcessor.js:",n)})}get ticks_before_new_bar(){const e=(this.app.clock.beats_since_origin-1)*48+this.time_position.pulse+1;return this.beats_per_bar*this.ppqn*this.time_position.bar+1-e}get beats_per_bar(){return this.time_signature[0]}get beats_since_origin(){return(this.time_position.bar-1)*this.beats_per_bar+this.time_position.beat}get pulses_since_origin(){return this.beats_since_origin*this.ppqn+this.time_position.pulse}get pulse_duration(){return 60/this.bpm/this.ppqn}convertPulseToSecond(e){return e*this.pulse_duration}start(){var e,r;((e=this.transportNode)==null?void 0:e.state)==="running"?console.log("Already started"):(this.app.audioContext.resume(),(r=this.transportNode)==null||r.start())}pause(){var e;(e=this.transportNode)==null||e.pause()}stop(){var e;(e=this.transportNode)==null||e.stop()}}const global_text=` // Global buffer: a central buffer to command them all. // ==================================================== // The global buffer is a special buffer used to control @@ -68,16 +68,16 @@ var Yn=Object.defineProperty;var Dn=(s,e,r)=>e in s?Yn(s,e,{enumerable:!0,config // Init buffer: a buffer to initialize the universe. // This universe is runned once when the universe is // loaded! -`,note_buffer="// Notes buffer: a buffer to write your notes.",tutorial_universe={global:{candidate:global_text,committed:global_text,evaluations:0},locals:{1:{candidate:local_buffer,committed:local_buffer,evaluations:0},2:{candidate:local_buffer,committed:local_buffer,evaluations:0},3:{candidate:local_buffer,committed:local_buffer,evaluations:0},4:{candidate:local_buffer,committed:local_buffer,evaluations:0},5:{candidate:local_buffer,committed:local_buffer,evaluations:0},6:{candidate:local_buffer,committed:local_buffer,evaluations:0},7:{candidate:local_buffer,committed:local_buffer,evaluations:0},8:{candidate:local_buffer,committed:local_buffer,evaluations:0},9:{candidate:local_buffer,committed:local_buffer,evaluations:0}},init:{candidate:init_buffer,committed:init_buffer,evaluations:0},notes:{candidate:note_buffer}},template_universe={global:{candidate:"",committed:"",evaluations:0},locals:{1:{candidate:"",committed:"",evaluations:0},2:{candidate:"",committed:"",evaluations:0},3:{candidate:"",committed:"",evaluations:0},4:{candidate:"",committed:"",evaluations:0},5:{candidate:"",committed:"",evaluations:0},6:{candidate:"",committed:"",evaluations:0},7:{candidate:"",committed:"",evaluations:0},8:{candidate:"",committed:"",evaluations:0},9:{candidate:"",committed:"",evaluations:0}},init:{candidate:"",committed:"",evaluations:0},notes:{candidate:""}},template_universes={Default:{global:{candidate:"",committed:"",evaluations:0},locals:{1:{candidate:"",committed:"",evaluations:0},2:{candidate:"",committed:"",evaluations:0},3:{candidate:"",committed:"",evaluations:0},4:{candidate:"",committed:"",evaluations:0},5:{candidate:"",committed:"",evaluations:0},6:{candidate:"",committed:"",evaluations:0},7:{candidate:"",committed:"",evaluations:0},8:{candidate:"",committed:"",evaluations:0},9:{candidate:"",committed:"",evaluations:0}},init:{candidate:"",committed:"",evaluations:0},notes:{candidate:"// NOTES"}},Help:tutorial_universe};class AppSettings{constructor(){Se(this,"vimMode",!1);Se(this,"theme","materialDark");Se(this,"font","SpaceMono");Se(this,"font_size",22);Se(this,"universes");Se(this,"selected_universe","Default");Se(this,"line_numbers",!0);const e=JSON.parse(localStorage.getItem("topos")||"{}");e&&Object.keys(e).length!==0?(this.vimMode=e.vimMode,this.theme=e.theme,this.font=e.font,this.font_size=e.font_size,this.universes=e.universes,this.selected_universe=e.selected_universe,this.line_numbers=e.line_numbers):this.universes=template_universes}get data(){return{vimMode:this.vimMode,theme:this.theme,font:this.font,font_size:this.font_size,universes:this.universes,selected_universe:this.selected_universe,line_numbers:this.line_numbers}}saveApplicationToLocalStorage(e,r){this.universes=e,this.vimMode=r.vimMode,this.font=r.font,this.font_size=r.font_size,this.selected_universe=r.selected_universe,this.line_numbers=r.line_numbers,localStorage.setItem("topos",JSON.stringify(this.data))}}const OPERATORS={"+":(s,e)=>s+e,"-":(s,e)=>s-e,"*":(s,e)=>s*e,"/":(s,e)=>s/e,"%":(s,e)=>s%e,"^":(s,e)=>s**e,"<<":(s,e)=>s<>":(s,e)=>s>>e,"&":(s,e)=>s&e,"|":(s,e)=>s|e},DEFAULT_OPTIONS={octave:0,duration:.25,key:"C4",scale:"IONIAN",measure:0,degrees:!1},DEFAULT_DURS={m:8,k:10240/1920,l:4,"d.":3,p:5120/1920,d:2,"w.":1.5,c:2560/1920,w:1,"h..":.875,"h.":.75,y:1280/1920,h:.5,"q..":840/1920,"q.":.375,n:640/1920,q:.25,"e..":420/1920,"e.":.1875,a:320/1920,e:.125,"s..":210/1920,"s.":180/1920,f:160/1920,s:.0625,"t..":105/1920,"t.":90/1920,x:80/1920,t:60/1920,"u.":45/1920,g:40/1920,u:30/1920,j:15/1920,o:8/1920,z:0},NOTES_TO_INTERVALS={C:0,Cs:1,D:2,Eb:3,E:4,F:5,Fs:6,G:7,Ab:8,A:9,Bb:10,B:11},MODIFIERS={"#":1,b:-1,s:1},scales=()=>{const s=[2,1,2,2,1,2,2],e=[2,2,1,2,2,2,1],r=[2,1,2,2,1,3,1],n=[2,2,1,2,1,3,1],o=[3,2,2,3,2],a=[2,3,2,3,2],l=[2,2,2,2,2,2],c=[2,1,1,3,2,3],h=[3,2,1,1,3,2],f=[2,1,2,2,2,2,1],d=[2,2,1,2,1,2,2];return{MAJOR:e,MINOR:s,"HARMONIC MINOR":r,"HARMONIC MAJOR":n,"MINOR PENTATONIC":o,"SUSPENDED PENTATONIC":a,"BLUES MAJOR":c,"BLUES MINOR":h,WHOLE:l,"MELODIC MINOR":f,"MELODIC MAJOR":d,MINORIC:[4,4,4],THAPTIC:[4,3,4,1],LOTHIC:[3,4,1,4],PHRATIC:[4,1,4,3],AERATHIC:[1,4,3,4],EPATHIC:[4,3,2,3],MYNIC:[3,2,3,4],ROTHIC:[2,3,4,3],EPORIC:[3,4,3,2],ZYPHIC:[4,4,3,1],EPOGIC:[4,3,1,4],LANIC:[3,1,4,4],PYRRIC:[1,4,4,3],AEOLORIC:[4,4,1,3],GONIC:[4,1,3,4],DALIC:[1,3,4,4],DYGIC:[3,4,4,1],DARIC:[4,3,3,2],LONIC:[3,3,2,4],PHRADIC:[3,2,4,3],BOLIC:[2,4,3,3],SARIC:[4,2,3,3],ZOPTIC:[2,3,3,4],AERAPHIC:[3,3,4,2],BYPTIC:[3,4,2,3],AEOLIC:[4,4,2,2],KOPTIC:[4,2,2,4],MIXOLYRIC:[2,2,4,4],LYDIC:[2,4,4,2],STATHIC:[4,2,4,2],DADIC:[2,4,2,4],PHRYNIC:[3,3,3,3],EPATHITONIC:[3,2,3,2,2],MYNITONIC:[2,3,2,2,3],ROCRITONIC:o,PENTATONIC:[2,2,3,2,3],THAPTITONIC:a,MAGITONIC:[4,3,2,2,1],DADITONIC:[3,2,2,1,4],AEOLYPHRITONIC:[2,2,1,4,3],GYCRITONIC:[2,1,4,3,2],PYRITONIC:[1,4,3,2,2],GATHITONIC:[4,2,3,2,1],IONITONIC:[2,3,2,1,4],PHRYNITONIC:[3,2,1,4,2],STATHITONIC:[2,1,4,2,3],THALITONIC:[1,4,2,3,2],ZOLITONIC:[4,2,1,4,1],EPOGITONIC:[2,1,4,1,4],LANITONIC:[1,4,1,4,2],PAPTITONIC:[4,1,4,2,1],IONACRITONIC:[1,4,2,1,4],PHRADITONIC:[4,1,4,1,2],AEOLORITONIC:[1,4,1,2,4],GONITONIC:[4,1,2,4,1],DALITONIC:[1,2,4,1,4],DYGITONIC:[2,4,1,4,1],AERACRITONIC:[4,1,2,3,2],BYPTITONIC:[1,2,3,2,4],DARITONIC:[2,3,2,4,1],LONITONIC:[3,2,4,1,2],IONYCRITONIC:[2,4,1,2,3],LOTHITONIC:[4,1,2,2,3],PHRATONIC:[1,2,2,3,4],AERATHITONIC:[2,2,3,4,1],SARITONIC:[2,3,4,1,2],ZOPTITONIC:[3,4,1,2,2],DOLITONIC:[4,4,1,2,1],PORITONIC:[4,1,2,1,4],AERYLITONIC:[1,2,1,4,4],ZAGITONIC:[2,1,4,4,1],LAGITONIC:[1,4,4,1,2],MOLITONIC:[4,3,3,1,1],STAPTITONIC:[3,3,1,1,4],MOTHITONIC:[3,1,1,4,3],AERITONIC:[1,1,4,3,3],RAGITONIC:[1,4,3,3,1],IONADITONIC:[4,3,2,1,2],BOCRITONIC:[3,2,1,2,4],GYTHITONIC:[2,1,2,4,3],PAGITONIC:[1,2,4,3,2],AEOLYTHITONIC:[2,4,3,2,1],ZACRITONIC:[4,3,1,3,1],LARITONIC:[3,1,3,1,4],THACRITONIC:[1,3,1,4,3],STYDITONIC:[3,1,4,3,1],LORITONIC:[1,4,3,1,3],AEOLYRITONIC:[4,3,1,1,3],GORITONIC:[3,1,1,3,4],AEOLODITONIC:[1,1,3,4,3],DOPTITONIC:[1,3,4,3,1],AERAPHITONIC:[3,4,3,1,1],ZATHITONIC:[4,2,4,1,1],RADITONIC:[2,4,1,1,4],STONITONIC:[4,1,1,4,2],SYPTITONIC:[1,1,4,2,4],IONYTHITONIC:[1,4,2,4,1],AEOLANITONIC:[4,2,2,3,1],DANITONIC:[2,2,3,1,4],IONARITONIC:[2,3,1,4,2],DYNITONIC:[3,1,4,2,2],ZYDITONIC:[1,4,2,2,3],AEOLACRITONIC:[4,2,1,2,3],ZYTHITONIC:[2,1,2,3,4],DYRITONIC:[1,2,3,4,2],KOPTITONIC:[2,3,4,2,1],THOCRITONIC:[3,4,2,1,2],LYCRITONIC:[4,1,3,3,1],DAPTITONIC:[1,3,3,1,4],KYGITONIC:[3,3,1,4,1],MOCRITONIC:[3,1,4,1,3],ZYNITONIC:[1,4,1,3,3],EPYGITONIC:[4,1,3,2,2],ZAPTITONIC:[1,3,2,2,4],KAGITONIC:[3,2,2,4,1],ZOGITONIC:[2,2,4,1,3],EPYRITONIC:[2,4,1,3,2],ZOTHITONIC:[4,1,3,1,3],PHROLITONIC:[1,3,1,3,4],IONAGITONIC:[3,1,3,4,1],AEOLAPRITONIC:[1,3,4,1,3],KYRITONIC:[3,4,1,3,1],IONYPTITONIC:[4,1,1,3,3],GYRITONIC:[1,1,3,3,4],ZALITONIC:[1,3,3,4,1],STOLITONIC:[3,3,4,1,1],BYLITONIC:[3,4,1,1,3],THODITONIC:[3,3,2,3,1],DOGITONIC:[3,2,3,1,3],PHRALITONIC:[2,3,1,3,3],GARITONIC:[3,1,3,3,2],SOPTITONIC:[1,3,3,2,3],KATARITONIC:[3,3,2,2,2],SYLITONIC:[3,2,2,2,3],THONITONIC:[2,2,2,3,3],PHROPITONIC:[2,2,3,3,2],STADITONIC:[2,3,3,2,2],LYDITONIC:[3,3,1,3,2],MYTHITONIC:[3,1,3,2,3],SOGITONIC:[1,3,2,3,3],GOTHITONIC:[3,2,3,3,1],ROTHITONIC:[2,3,3,1,3],ZYLITONIC:[4,4,2,1,1],ZODITONIC:[4,2,1,1,4],ZARITONIC:[2,1,1,4,4],PHRYTHITONIC:[1,1,4,4,2],ROLITONIC:[1,4,4,2,1],RANITONIC:[4,4,1,1,2],LADITONIC:[4,1,1,2,4],PODITONIC:[1,1,2,4,4],IONOTHITONIC:[1,2,4,4,1],KANITONIC:[2,4,4,1,1],RYPHITONIC:[4,3,1,2,2],GYLITONIC:[3,1,2,2,4],AEOLYCRITONIC:[1,2,2,4,3],PYNITONIC:[2,2,4,3,1],ZANITONIC:[2,4,3,1,2],PHRONITONIC:[4,2,3,1,2],BANITONIC:[2,3,1,2,4],AERONITONIC:[3,1,2,4,2],GOLITONIC:[1,2,4,2,3],DYPTITONIC:[2,4,2,3,1],AERYNITONIC:[4,2,2,1,3],PALITONIC:[2,2,1,3,4],STOTHITONIC:[2,1,3,4,2],AEROPHITONIC:[1,3,4,2,2],KATAGITONIC:[3,4,2,2,1],IONODITONIC:[4,2,1,3,2],BOGITONIC:[2,1,3,2,4],MOGITONIC:[1,3,2,4,2],DOCRITONIC:[3,2,4,2,1],EPADITONIC:[2,4,2,1,3],MIXITONIC:[3,3,3,2,1],PHROTHITONIC:[3,3,2,1,3],KATYCRITONIC:[3,2,1,3,3],IONALITONIC:[2,1,3,3,3],LOPTITONIC:[1,3,3,3,2],THYRITONIC:[3,3,3,1,2],THOPTITONIC:[3,3,1,2,3],BYCRITONIC:[3,1,2,3,3],PATHITONIC:[1,2,3,3,3],MYDITONIC:[2,3,3,3,1],BOLITONIC:[4,2,2,2,2],BOTHITONIC:[2,2,2,2,4],KATADITONIC:[2,2,2,4,2],KODITONIC:[2,2,4,2,2],THOLITONIC:[2,4,2,2,2],EPATHIMIC:[3,2,2,1,2,2],MYNIMIC:[2,2,1,2,2,3],ROCRIMIC:[2,1,2,2,3,2],EPORIMIC:[1,2,2,3,2,2],THAPTIMIC:[2,2,3,2,2,1],LOTHIMIC:[2,3,2,2,1,2],DYRIMIC:[4,2,1,2,2,1],KOPTIMIC:[2,1,2,2,1,4],THOCRIMIC:[1,2,2,1,4,2],AEOLANIMIC:[2,2,1,4,2,1],DANIMIC:[2,1,4,2,1,2],IONARIMIC:[1,4,2,1,2,2],DAPTIMIC:[4,1,4,1,1,1],KYGIMIC:[1,4,1,1,1,4],MOCRIMIC:[4,1,1,1,4,1],ZYNIMIC:[1,1,1,4,1,4],AEOLIMIC:[1,1,4,1,4,1],ZYTHIMIC:[1,4,1,4,1,1],EPYGIMIC:[4,1,2,3,1,1],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,1],EPIRYLLIAN:[1,1,1,1,2,1,1,1,1,2],LYRYLLIAN:[1,1,1,2,1,1,1,1,2,1],MOGYLLIAN:[1,1,2,1,1,1,1,2,1,1],KATODYLLIAN:[1,2,1,1,1,1,2,1,1,1],AERYCRATIC:[2,1,1,1,1,1,1,1,1,1,1],MONATIC:[1,1,1,1,1,1,1,1,1,1,2],SOLATIC:[1,1,1,1,1,1,1,1,1,2,1],ZYLATIC:[1,1,1,1,1,1,1,1,2,1,1],MIXOLATIC:[1,1,1,1,1,1,1,2,1,1,1],SORATIC:[1,1,1,1,1,1,2,1,1,1,1],GODATIC:[1,1,1,1,1,2,1,1,1,1,1],EPTATIC:[1,1,1,1,2,1,1,1,1,1,1],IONATIC:[1,1,1,2,1,1,1,1,1,1,1],AEOLATIC:[1,1,2,1,1,1,1,1,1,1,1],THYDATIC:[1,2,1,1,1,1,1,1,1,1,1],CHROMATIC:[1,1,1,1,1,1,1,1,1,1,1,1]}},SCALES$1=scales(),getRandomScale=()=>{const s=Object.keys(SCALES$1),e=s[Math.floor(Math.random()*s.length)];return SCALES$1[e]},getScale=s=>SCALES$1[s.toUpperCase()],isScale=s=>s.toUpperCase()in SCALES$1;function noteFromPc(s,e,r,n=0,o=0,a=!1){e=a&&e>0?e-1:e,s=typeof s=="string"?noteNameToMidi(s):s;const l=typeof r=="string"?getScale(r):r,c=l.length;(e>=c||e<0)&&(n+=Math.floor(e/c),e=e<0?c-Math.abs(e)%c:e%c,e===c&&(e=0));let h=s+l.slice(0,e).reduce((f,d)=>f+d,0);return h=h+n*l.reduce((f,d)=>f+d,0)+o,Number.isInteger(h)?[h,void 0]:resolvePitchBend(h)}function noteNameToMidi(s){const e=s.match(/^([a-gA-G])([#bs])?([1-9])?$/);if(e===null)return 60;const[,r,n,o]=e,a=o?parseInt(o,10):4,l=MODIFIERS[n]||0,c=NOTES_TO_INTERVALS[r.toUpperCase()];return 12+a*12+c+l}function resolvePitchBend(s,e=1){let r=8192;if(s%1!==0){const n=s>Math.round(s)?s:Math.round(s),o=s>Math.round(s)?Math.round(s):s,a=midiToFreq(n)/midiToFreq(o),l=1200*Math.log2(a);r=r+Math.floor(8191*(l/(100*e)))}return[s,r]}function midiToFreq(s){return 440/32*2**((s-9)/12)}function ratioToCents(s){return 1200*Math.log2(s)}function*primeSieve(){var r;const s={};let e=2;for(;;){if(!(e in s))yield e,s[e*e]=[e];else{for(const n of s[e])(s[r=n+e]||(s[r]=[])).push(n);delete s[e]}e++}}function getPrimes(s){const e=primeSieve();return Array.from({length:s},()=>e.next().value)}function monzoToCents(s){const e=s.length,r=getPrimes(e+1);let n=1;for(let o=0;o>>0;return e=r,r=n,n=o,o^=(o>>>19^l^l>>>8)>>>0,(o>>>0)/4294967296}for(let l=0;ldeepClone(e)):s&&typeof s=="object"?Object.getOwnPropertyNames(s).reduce((e,r)=>(Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r)),e[r]=deepClone(s[r]),e),Object.create(Object.getPrototypeOf(s))):s}class Base{constructor(e){Se(this,"text");Se(this,"location");Object.assign(this,e)}clone(){return deepClone(this)}collect(e){return this[e]}refresh(){}evaluate(e={}){}}class Event extends Base{constructor(r){super(r);Se(this,"duration");Se(this,"_next");Se(this,"_prev");Se(this,"modifiedEvent");Object.assign(this,r)}next(){return this._next}previous(){return this._prev}collect(r){return this[r]}sometimesBy(r,n){return Math.random()n.duration))}evaluate(r={}){return this.pitches.map(n=>n.evaluate(r))}collect(r){return this.pitches.map(o=>o.collect(r))}scale(r){return this.pitches.forEach(n=>n.scale(r)),this}}class RandomPitch extends Pitch{constructor(r){super(r);Se(this,"min");Se(this,"max");Se(this,"randomSeed");Se(this,"seededRandom");Se(this,"random");Object.assign(this,r),r.min||(this.min=0),r.max||(this.max=scaleLength(this.parsedScale)),this.seededRandom?(console.log("SEEDED RANDOM GEN!"),this.random=this.seededRandom):this.random=Math.random}evaluate(r={}){const n=this.random();return console.log(n),this.pitch=Math.floor(n*(this.max-this.min+1))+this.min,super.evaluate(r)}seed(r){this.randomSeed=r,this.seededRandom=seededRandom(r)}}class OctaveChange extends Base{constructor(r){super(r);Se(this,"octave");Object.assign(this,r)}evaluate(r={}){r.octave=this.octave}}class DurationChange extends Base{constructor(r){super(r);Se(this,"duration");Object.assign(this,r)}evaluate(r={}){r.duration=this.duration}}class Repeat extends Base{constructor(r){super(r);Se(this,"times");Se(this,"item");Object.assign(this,r)}evaluate(r={}){return[...Array(this.times)].map(()=>this.item).flat(1/0).map(o=>o.evaluate(r))}}class List extends Base{constructor(r){super(r);Se(this,"items");Object.assign(this,r)}evaluate(r={}){return this.items.map(n=>n.evaluate(r))}}class ListOperation extends Base{constructor(r){super(r);Se(this,"left");Se(this,"right");Se(this,"operation");Object.assign(this,r)}evaluate(r={}){this.left.evaluate(),this.right.evaluate();const n=OPERATORS[this.operation];return this.right.items.flatMap(l=>this.left.items.map(c=>[l.clone(),c.clone()])).map(l=>(l[0].pitch=n(l[0].pitch,l[1].pitch),l[0].evaluate(r)))}}class Cycle extends Event{constructor(r){super(r);Se(this,"items");Se(this,"index");Object.assign(this,r),this.index=0}nextItem(r={}){let n=this.items[this.index%this.items.length];for(;n instanceof Cycle;)n=n.nextItem(r);return this.index=this.index+1,n instanceof Base?n.evaluate(r):n}evaluate(r={}){return this.nextItem(r)}}const peggyParser$1=function(){function s(o,a){function l(){this.constructor=o}l.prototype=a.prototype,o.prototype=new l}function e(o,a,l,c){var h=Error.call(this,o);return Object.setPrototypeOf&&Object.setPrototypeOf(h,e.prototype),h.expected=a,h.found=l,h.location=c,h.name="SyntaxError",h}s(e,Error);function r(o,a,l){return l=l||" ",o.length>a?o:(a-=o.length,l+=l.repeat(a),o+l.slice(0,a))}e.prototype.format=function(o){var a="Error: "+this.message;if(this.location){var l=null,c;for(c=0;cs+e,"-":(s,e)=>s-e,"*":(s,e)=>s*e,"/":(s,e)=>s/e,"%":(s,e)=>s%e,"^":(s,e)=>s**e,"<<":(s,e)=>s<>":(s,e)=>s>>e,"&":(s,e)=>s&e,"|":(s,e)=>s|e},DEFAULT_OPTIONS={octave:0,duration:.25,key:"C4",scale:"IONIAN",measure:0,degrees:!1},DEFAULT_DURS={m:8,k:10240/1920,l:4,"d.":3,p:5120/1920,d:2,"w.":1.5,c:2560/1920,w:1,"h..":.875,"h.":.75,y:1280/1920,h:.5,"q..":840/1920,"q.":.375,n:640/1920,q:.25,"e..":420/1920,"e.":.1875,a:320/1920,e:.125,"s..":210/1920,"s.":180/1920,f:160/1920,s:.0625,"t..":105/1920,"t.":90/1920,x:80/1920,t:60/1920,"u.":45/1920,g:40/1920,u:30/1920,j:15/1920,o:8/1920,z:0},NOTES_TO_INTERVALS={C:0,Cs:1,D:2,Eb:3,E:4,F:5,Fs:6,G:7,Ab:8,A:9,Bb:10,B:11},MODIFIERS={"#":1,b:-1,s:1},scales=()=>{const s=[2,1,2,2,1,2,2],e=[2,2,1,2,2,2,1],r=[2,1,2,2,1,3,1],n=[2,2,1,2,1,3,1],o=[3,2,2,3,2],a=[2,3,2,3,2],l=[2,2,2,2,2,2],c=[2,1,1,3,2,3],h=[3,2,1,1,3,2],f=[2,1,2,2,2,2,1],d=[2,2,1,2,1,2,2];return{MAJOR:e,MINOR:s,"HARMONIC MINOR":r,"HARMONIC MAJOR":n,"MINOR PENTATONIC":o,"SUSPENDED PENTATONIC":a,"BLUES MAJOR":c,"BLUES MINOR":h,WHOLE:l,"MELODIC MINOR":f,"MELODIC MAJOR":d,MINORIC:[4,4,4],THAPTIC:[4,3,4,1],LOTHIC:[3,4,1,4],PHRATIC:[4,1,4,3],AERATHIC:[1,4,3,4],EPATHIC:[4,3,2,3],MYNIC:[3,2,3,4],ROTHIC:[2,3,4,3],EPORIC:[3,4,3,2],ZYPHIC:[4,4,3,1],EPOGIC:[4,3,1,4],LANIC:[3,1,4,4],PYRRIC:[1,4,4,3],AEOLORIC:[4,4,1,3],GONIC:[4,1,3,4],DALIC:[1,3,4,4],DYGIC:[3,4,4,1],DARIC:[4,3,3,2],LONIC:[3,3,2,4],PHRADIC:[3,2,4,3],BOLIC:[2,4,3,3],SARIC:[4,2,3,3],ZOPTIC:[2,3,3,4],AERAPHIC:[3,3,4,2],BYPTIC:[3,4,2,3],AEOLIC:[4,4,2,2],KOPTIC:[4,2,2,4],MIXOLYRIC:[2,2,4,4],LYDIC:[2,4,4,2],STATHIC:[4,2,4,2],DADIC:[2,4,2,4],PHRYNIC:[3,3,3,3],EPATHITONIC:[3,2,3,2,2],MYNITONIC:[2,3,2,2,3],ROCRITONIC:o,PENTATONIC:[2,2,3,2,3],THAPTITONIC:a,MAGITONIC:[4,3,2,2,1],DADITONIC:[3,2,2,1,4],AEOLYPHRITONIC:[2,2,1,4,3],GYCRITONIC:[2,1,4,3,2],PYRITONIC:[1,4,3,2,2],GATHITONIC:[4,2,3,2,1],IONITONIC:[2,3,2,1,4],PHRYNITONIC:[3,2,1,4,2],STATHITONIC:[2,1,4,2,3],THALITONIC:[1,4,2,3,2],ZOLITONIC:[4,2,1,4,1],EPOGITONIC:[2,1,4,1,4],LANITONIC:[1,4,1,4,2],PAPTITONIC:[4,1,4,2,1],IONACRITONIC:[1,4,2,1,4],PHRADITONIC:[4,1,4,1,2],AEOLORITONIC:[1,4,1,2,4],GONITONIC:[4,1,2,4,1],DALITONIC:[1,2,4,1,4],DYGITONIC:[2,4,1,4,1],AERACRITONIC:[4,1,2,3,2],BYPTITONIC:[1,2,3,2,4],DARITONIC:[2,3,2,4,1],LONITONIC:[3,2,4,1,2],IONYCRITONIC:[2,4,1,2,3],LOTHITONIC:[4,1,2,2,3],PHRATONIC:[1,2,2,3,4],AERATHITONIC:[2,2,3,4,1],SARITONIC:[2,3,4,1,2],ZOPTITONIC:[3,4,1,2,2],DOLITONIC:[4,4,1,2,1],PORITONIC:[4,1,2,1,4],AERYLITONIC:[1,2,1,4,4],ZAGITONIC:[2,1,4,4,1],LAGITONIC:[1,4,4,1,2],MOLITONIC:[4,3,3,1,1],STAPTITONIC:[3,3,1,1,4],MOTHITONIC:[3,1,1,4,3],AERITONIC:[1,1,4,3,3],RAGITONIC:[1,4,3,3,1],IONADITONIC:[4,3,2,1,2],BOCRITONIC:[3,2,1,2,4],GYTHITONIC:[2,1,2,4,3],PAGITONIC:[1,2,4,3,2],AEOLYTHITONIC:[2,4,3,2,1],ZACRITONIC:[4,3,1,3,1],LARITONIC:[3,1,3,1,4],THACRITONIC:[1,3,1,4,3],STYDITONIC:[3,1,4,3,1],LORITONIC:[1,4,3,1,3],AEOLYRITONIC:[4,3,1,1,3],GORITONIC:[3,1,1,3,4],AEOLODITONIC:[1,1,3,4,3],DOPTITONIC:[1,3,4,3,1],AERAPHITONIC:[3,4,3,1,1],ZATHITONIC:[4,2,4,1,1],RADITONIC:[2,4,1,1,4],STONITONIC:[4,1,1,4,2],SYPTITONIC:[1,1,4,2,4],IONYTHITONIC:[1,4,2,4,1],AEOLANITONIC:[4,2,2,3,1],DANITONIC:[2,2,3,1,4],IONARITONIC:[2,3,1,4,2],DYNITONIC:[3,1,4,2,2],ZYDITONIC:[1,4,2,2,3],AEOLACRITONIC:[4,2,1,2,3],ZYTHITONIC:[2,1,2,3,4],DYRITONIC:[1,2,3,4,2],KOPTITONIC:[2,3,4,2,1],THOCRITONIC:[3,4,2,1,2],LYCRITONIC:[4,1,3,3,1],DAPTITONIC:[1,3,3,1,4],KYGITONIC:[3,3,1,4,1],MOCRITONIC:[3,1,4,1,3],ZYNITONIC:[1,4,1,3,3],EPYGITONIC:[4,1,3,2,2],ZAPTITONIC:[1,3,2,2,4],KAGITONIC:[3,2,2,4,1],ZOGITONIC:[2,2,4,1,3],EPYRITONIC:[2,4,1,3,2],ZOTHITONIC:[4,1,3,1,3],PHROLITONIC:[1,3,1,3,4],IONAGITONIC:[3,1,3,4,1],AEOLAPRITONIC:[1,3,4,1,3],KYRITONIC:[3,4,1,3,1],IONYPTITONIC:[4,1,1,3,3],GYRITONIC:[1,1,3,3,4],ZALITONIC:[1,3,3,4,1],STOLITONIC:[3,3,4,1,1],BYLITONIC:[3,4,1,1,3],THODITONIC:[3,3,2,3,1],DOGITONIC:[3,2,3,1,3],PHRALITONIC:[2,3,1,3,3],GARITONIC:[3,1,3,3,2],SOPTITONIC:[1,3,3,2,3],KATARITONIC:[3,3,2,2,2],SYLITONIC:[3,2,2,2,3],THONITONIC:[2,2,2,3,3],PHROPITONIC:[2,2,3,3,2],STADITONIC:[2,3,3,2,2],LYDITONIC:[3,3,1,3,2],MYTHITONIC:[3,1,3,2,3],SOGITONIC:[1,3,2,3,3],GOTHITONIC:[3,2,3,3,1],ROTHITONIC:[2,3,3,1,3],ZYLITONIC:[4,4,2,1,1],ZODITONIC:[4,2,1,1,4],ZARITONIC:[2,1,1,4,4],PHRYTHITONIC:[1,1,4,4,2],ROLITONIC:[1,4,4,2,1],RANITONIC:[4,4,1,1,2],LADITONIC:[4,1,1,2,4],PODITONIC:[1,1,2,4,4],IONOTHITONIC:[1,2,4,4,1],KANITONIC:[2,4,4,1,1],RYPHITONIC:[4,3,1,2,2],GYLITONIC:[3,1,2,2,4],AEOLYCRITONIC:[1,2,2,4,3],PYNITONIC:[2,2,4,3,1],ZANITONIC:[2,4,3,1,2],PHRONITONIC:[4,2,3,1,2],BANITONIC:[2,3,1,2,4],AERONITONIC:[3,1,2,4,2],GOLITONIC:[1,2,4,2,3],DYPTITONIC:[2,4,2,3,1],AERYNITONIC:[4,2,2,1,3],PALITONIC:[2,2,1,3,4],STOTHITONIC:[2,1,3,4,2],AEROPHITONIC:[1,3,4,2,2],KATAGITONIC:[3,4,2,2,1],IONODITONIC:[4,2,1,3,2],BOGITONIC:[2,1,3,2,4],MOGITONIC:[1,3,2,4,2],DOCRITONIC:[3,2,4,2,1],EPADITONIC:[2,4,2,1,3],MIXITONIC:[3,3,3,2,1],PHROTHITONIC:[3,3,2,1,3],KATYCRITONIC:[3,2,1,3,3],IONALITONIC:[2,1,3,3,3],LOPTITONIC:[1,3,3,3,2],THYRITONIC:[3,3,3,1,2],THOPTITONIC:[3,3,1,2,3],BYCRIT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ROMATIC:[1,1,1,1,1,1,1,1,1,1,1,1]}},SCALES$1=scales(),getRandomScale=()=>{const s=Object.keys(SCALES$1),e=s[Math.floor(Math.random()*s.length)];return SCALES$1[e]},getScale=s=>SCALES$1[s.toUpperCase()],isScale=s=>s.toUpperCase()in SCALES$1;function noteFromPc(s,e,r,n=0,o=0,a=!1){e=a&&e>0?e-1:e,s=typeof s=="string"?noteNameToMidi(s):s;const l=typeof r=="string"?getScale(r):r,c=l.length;(e>=c||e<0)&&(n+=Math.floor(e/c),e=e<0?c-Math.abs(e)%c:e%c,e===c&&(e=0));let h=s+l.slice(0,e).reduce((f,d)=>f+d,0);return h=h+n*l.reduce((f,d)=>f+d,0)+o,Number.isInteger(h)?[h,void 0]:resolvePitchBend(h)}function noteNameToMidi(s){const e=s.match(/^([a-gA-G])([#bs])?([1-9])?$/);if(e===null)return 60;const[,r,n,o]=e,a=o?parseInt(o,10):4,l=MODIFIERS[n]||0,c=NOTES_TO_INTERVALS[r.toUpperCase()];return 12+a*12+c+l}function resolvePitchBend(s,e=1){let r=8192;if(s%1!==0){const n=s>Math.round(s)?s:Math.round(s),o=s>Math.round(s)?Math.round(s):s,a=midiToFreq(n)/midiToFreq(o),l=1200*Math.log2(a);r=r+Math.floor(8191*(l/(100*e)))}return[s,r]}function midiToFreq(s){return 440/32*2**((s-9)/12)}function ratioToCents(s){return 1200*Math.log2(s)}function*primeSieve(){var r;const s={};let e=2;for(;;){if(!(e in s))yield e,s[e*e]=[e];else{for(const n of s[e])(s[r=n+e]||(s[r]=[])).push(n);delete s[e]}e++}}function getPrimes(s){const e=primeSieve();return Array.from({length:s},()=>e.next().value)}function monzoToCents(s){const e=s.length,r=getPrimes(e+1);let n=1;for(let o=0;o>>0;return e=r,r=n,n=o,o^=(o>>>19^l^l>>>8)>>>0,(o>>>0)/4294967296}for(let l=0;ldeepClone(e)):s&&typeof s=="object"?Object.getOwnPropertyNames(s).reduce((e,r)=>(Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r)),e[r]=deepClone(s[r]),e),Object.create(Object.getPrototypeOf(s))):s}class Base{constructor(e){z(this,"text");z(this,"location");Object.assign(this,e)}clone(){return deepClone(this)}collect(e){return this[e]}refresh(){}evaluate(e={}){}}class Event extends Base{constructor(r){super(r);z(this,"duration");z(this,"_next");z(this,"_prev");z(this,"modifiedEvent");Object.assign(this,r)}next(){return this._next}previous(){return this._prev}collect(r){return this[r]}sometimesBy(r,n){return Math.random()n.duration))}evaluate(r={}){return this.pitches.map(n=>n.evaluate(r))}collect(r){return this.pitches.map(o=>o.collect(r))}scale(r){return this.pitches.forEach(n=>n.scale(r)),this}}class RandomPitch extends Pitch{constructor(r){super(r);z(this,"min");z(this,"max");z(this,"randomSeed");z(this,"seededRandom");z(this,"random");Object.assign(this,r),r.min||(this.min=0),r.max||(this.max=scaleLength(this.parsedScale)),this.seededRandom?(console.log("SEEDED RANDOM GEN!"),this.random=this.seededRandom):this.random=Math.random}evaluate(r={}){const n=this.random();return console.log(n),this.pitch=Math.floor(n*(this.max-this.min+1))+this.min,super.evaluate(r)}seed(r){this.randomSeed=r,this.seededRandom=seededRandom(r)}}class OctaveChange extends Base{constructor(r){super(r);z(this,"octave");Object.assign(this,r)}evaluate(r={}){r.octave=this.octave}}class DurationChange extends Base{constructor(r){super(r);z(this,"duration");Object.assign(this,r)}evaluate(r={}){r.duration=this.duration}}class Repeat extends Base{constructor(r){super(r);z(this,"times");z(this,"item");Object.assign(this,r)}evaluate(r={}){return[...Array(this.times)].map(()=>this.item).flat(1/0).map(o=>o.evaluate(r))}}class List extends Base{constructor(r){super(r);z(this,"items");Object.assign(this,r)}evaluate(r={}){return this.items.map(n=>n.evaluate(r))}}class ListOperation extends Base{constructor(r){super(r);z(this,"left");z(this,"right");z(this,"operation");Object.assign(this,r)}evaluate(r={}){this.left.evaluate(),this.right.evaluate();const n=OPERATORS[this.operation];return this.right.items.flatMap(l=>this.left.items.map(c=>[l.clone(),c.clone()])).map(l=>(l[0].pitch=n(l[0].pitch,l[1].pitch),l[0].evaluate(r)))}}class Cycle extends Event{constructor(r){super(r);z(this,"items");z(this,"index");Object.assign(this,r),this.index=0}nextItem(r={}){let n=this.items[this.index%this.items.length];for(;n instanceof Cycle;)n=n.nextItem(r);return this.index=this.index+1,n instanceof Base?n.evaluate(r):n}evaluate(r={}){return this.nextItem(r)}}const peggyParser$1=function(){function s(o,a){function l(){this.constructor=o}l.prototype=a.prototype,o.prototype=new l}function e(o,a,l,c){var h=Error.call(this,o);return Object.setPrototypeOf&&Object.setPrototypeOf(h,e.prototype),h.expected=a,h.found=l,h.location=c,h.name="SyntaxError",h}s(e,Error);function r(o,a,l){return l=l||" ",o.length>a?o:(a-=o.length,l+=l.repeat(a),o+l.slice(0,a))}e.prototype.format=function(o){var a="Error: "+this.message;if(this.location){var l=null,c;for(c=0;c `+d+` `+v+` | `+f.line+" | "+A+` `+v+" | "+r("",h.column-1," ")+r("",B,"^")}else a+=` at `+d}return a},e.buildMessage=function(o,a){var l={literal:function(A){return'"'+h(A.text)+'"'},class:function(A){var T=A.parts.map(function(B){return Array.isArray(B)?f(B[0])+"-"+f(B[1]):f(B)});return"["+(A.inverted?"^":"")+T.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(A){return A.description}};function c(A){return A.charCodeAt(0).toString(16).toUpperCase()}function h(A){return A.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(T){return"\\x0"+c(T)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(T){return"\\x"+c(T)})}function f(A){return A.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(T){return"\\x0"+c(T)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(T){return"\\x"+c(T)})}function d(A){return l[A.type](A)}function m(A){var T=A.map(d),B,Y;if(T.sort(),T.length>0){for(B=1,Y=1;B>",Me="<<",ot="<",Fe=">",Ve="_",at="?",dt=":",ct=/^[0-9]/,nt=/^[ \n\r\t]/,ft=/^[a-z]/,it=bt("-",!1),pt=Ji([["0","9"]],!1,!1),lt=bt(".",!1),st=Or("whitespace"),mt=Ji([" ",` -`,"\r"," "],!1,!1),Vt=bt(",",!1),Yt=bt("|",!1),gi=Ji([["a","z"]],!1,!1),Oi=bt("(",!1),Fi=bt(")",!1),$i=bt("+",!1),Ye=bt("*",!1),hr=bt("/",!1),xi=bt("%",!1),Tt=bt("^",!1),Ui=bt("&",!1),zi=bt(">>",!1),ji=bt("<<",!1),Mi=bt("<",!1),Lt=bt(">",!1),ur=bt("_",!1),Gt=bt("?",!1),Lr=bt(":",!1),fr=function(X){return X.filter(z=>z)},qi=function(){return parseFloat(Ai())},ui=function(){return parseInt(Ai())},Kt=function(){},Qr=function(){return DEFAULT_DURS[Ai()]},dr=function(X){return X.filter(z=>z)},Ki=function(X){return Wt(List,{items:X})},Rr=function(X,z,Oe){return Wt(ListOperation,{left:X,operation:z,right:Oe})},mi=function(X){return X},Mr=function(X){return Wt(Cycle,{items:X})},Nt=function(X){return a.nodeOptions.octave=X,Wt(OctaveChange,{octave:X})},Ei=function(){return Ai().split("").reduce((X,z)=>X+(z==="^"?1:-1),0)},wt=function(){return Wt(RandomPitch,{seededRandom:a.seededRandom})},Er=function(X,z){return Wt(RandomPitch,{min:X,max:z,seededRandom:a.seededRandom})},Nr=function(X,z){return Wt(Repeat,{item:X,times:z})},Yr=function(X){return a.nodeOptions.duration=X,Wt(DurationChange,{duration:X})},pr=function(X,z,Oe){const Ee=X?a.nodeOptions.octave+X:a.nodeOptions.octave;return Wt(Pitch,{duration:z,pitch:Oe,octave:Ee})},gt=function(X,z){return Wt(Chord,{pitches:[X].concat(z)})},H=0,qe=0,Qt=[{line:1,column:1}],kt=0,Ni=[],De=0,je={},Yi;if("startRule"in a){if(!(a.startRule in h))throw new Error(`Can't start parsing from rule "`+a.startRule+'".');f=h[a.startRule]}function Ai(){return o.substring(qe,H)}function gr(){return li(qe,H)}function bt(X,z){return{type:"literal",text:X,ignoreCase:z}}function Ji(X,z,Oe){return{type:"class",parts:X,inverted:z,ignoreCase:Oe}}function Dr(){return{type:"end"}}function Or(X){return{type:"other",description:X}}function mr(X){var z=Qt[X],Oe;if(z)return z;for(Oe=X-1;!Qt[Oe];)Oe--;for(z=Qt[Oe],z={line:z.line,column:z.column};Oekt&&(kt=H,Ni=[]),Ni.push(X))}function Br(X,z,Oe){return new e(e.buildMessage(X,z),X,z,Oe)}function Ht(){var X,z,Oe=H*23+0,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(X=H,z=Xi(),z!==l&&(qe=X,z=fr(z)),X=z,je[Oe]={nextPos:H,result:X},X)}function Xr(){var X,z,Oe,Ee,We,tt,Ft,yi=H*23+1,Zi=je[yi];if(Zi)return H=Zi.nextPos,Zi.result;for(X=H,z=H,o.charCodeAt(H)===45?(Oe=d,H++):(Oe=l,De===0&&et(it)),Oe===l&&(Oe=null),Ee=[],ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));We!==l;)Ee.push(We),ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));if(o.charCodeAt(H)===46?(We=m,H++):(We=l,De===0&&et(lt)),We!==l){if(tt=[],ct.test(o.charAt(H))?(Ft=o.charAt(H),H++):(Ft=l,De===0&&et(pt)),Ft!==l)for(;Ft!==l;)tt.push(Ft),ct.test(o.charAt(H))?(Ft=o.charAt(H),H++):(Ft=l,De===0&&et(pt));else tt=l;tt!==l?(Oe=[Oe,Ee,We,tt],z=Oe):(H=z,z=l)}else H=z,z=l;if(z===l)if(z=H,o.charCodeAt(H)===46?(Oe=m,H++):(Oe=l,De===0&&et(lt)),Oe!==l){if(Ee=[],ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt)),We!==l)for(;We!==l;)Ee.push(We),ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));else Ee=l;Ee!==l?(Oe=[Oe,Ee],z=Oe):(H=z,z=l)}else H=z,z=l;return z!==l&&(qe=X,z=qi()),X=z,je[yi]={nextPos:H,result:X},X}function Di(){var X,z,Oe=H*23+2,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(X=H,o.charCodeAt(H)===45?H++:De===0&&et(it),ct.test(o.charAt(H))?(z=o.charAt(H),H++):(z=l,De===0&&et(pt)),z!==l?(qe=X,X=ui()):(H=X,X=l),je[Oe]={nextPos:H,result:X},X)}function Jt(){var X,z,Oe=H*23+3,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(De++,X=H,nt.test(o.charAt(H))?(z=o.charAt(H),H++):(z=l,De===0&&et(mt)),z!==l&&(qe=X,z=Kt()),X=z,De--,X===l&&(z=l,De===0&&et(st)),je[Oe]={nextPos:H,result:X},X)}function Bi(){var X,z,Oe=H*23+7,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(X=H,ft.test(o.charAt(H))?(z=o.charAt(H),H++):(z=l,De===0&&et(gi)),z!==l&&(qe=X,z=Qr()),X=z,je[Oe]={nextPos:H,result:X},X)}function Sr(){var X,z=H*23+8,Oe=je[z];return Oe?(H=Oe.nextPos,Oe.result):(X=Bi(),X===l&&(X=Xr()),je[z]={nextPos:H,result:X},X)}function Xi(){var X,z,Oe,Ee=H*23+9,We=je[Ee];if(We)return H=We.nextPos,We.result;if(X=H,z=[],Oe=qt(),Oe===l&&(Oe=yr(),Oe===l&&(Oe=Si(),Oe===l&&(Oe=er(),Oe===l&&(Oe=Cr())))),Oe!==l)for(;Oe!==l;)z.push(Oe),Oe=qt(),Oe===l&&(Oe=yr(),Oe===l&&(Oe=Si(),Oe===l&&(Oe=er(),Oe===l&&(Oe=Cr()))));else z=l;return z!==l&&(qe=X,z=dr(z)),X=z,je[Ee]={nextPos:H,result:X},X}function Si(){var X,z,Oe,Ee,We=H*23+10,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,o.charCodeAt(H)===40?(z=T,H++):(z=l,De===0&&et(Oi)),z!==l?(Oe=Xi(),Oe!==l?(o.charCodeAt(H)===41?(Ee=B,H++):(Ee=l,De===0&&et(Fi)),Ee!==l?(qe=X,X=Ki(Oe)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function yr(){var X,z,Oe,Ee,We=H*23+11,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,z=Si(),z!==l?(Oe=vr(),Oe!==l?(Ee=Si(),Ee!==l?(qe=X,X=Rr(z,Oe,Ee)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function vr(){var X,z=H*23+12,Oe=je[z];return Oe?(H=Oe.nextPos,Oe.result):(o.charCodeAt(H)===43?(X=Y,H++):(X=l,De===0&&et($i)),X===l&&(o.charCodeAt(H)===45?(X=d,H++):(X=l,De===0&&et(it)),X===l&&(o.charCodeAt(H)===42?(X=F,H++):(X=l,De===0&&et(Ye)),X===l&&(o.charCodeAt(H)===47?(X=ke,H++):(X=l,De===0&&et(hr)),X===l&&(o.charCodeAt(H)===37?(X=Qe,H++):(X=l,De===0&&et(xi)),X===l&&(o.charCodeAt(H)===94?(X=xe,H++):(X=l,De===0&&et(Tt)),X===l&&(o.charCodeAt(H)===124?(X=A,H++):(X=l,De===0&&et(Yt)),X===l&&(o.charCodeAt(H)===38?(X=Te,H++):(X=l,De===0&&et(Ui)),X===l&&(o.substr(H,2)===Le?(X=Le,H+=2):(X=l,De===0&&et(zi)),X===l&&(o.substr(H,2)===Me?(X=Me,H+=2):(X=l,De===0&&et(ji))))))))))),je[z]={nextPos:H,result:X},X)}function er(){var X,z,Oe=H*23+13,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(X=H,z=br(),z===l&&(z=Pi(),z===l&&(z=Zr(),z===l&&(z=Jt(),z===l&&(z=Vr(),z===l&&(z=ir(),z===l&&(z=_r(),z===l&&(z=Si()))))))),z!==l&&(qe=X,z=mi(z)),X=z,je[Oe]={nextPos:H,result:X},X)}function Cr(){var X,z,Oe,Ee,We=H*23+14,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,o.charCodeAt(H)===60?(z=ot,H++):(z=l,De===0&&et(Mi)),z!==l?(Oe=Xi(),Oe!==l?(o.charCodeAt(H)===62?(Ee=Fe,H++):(Ee=l,De===0&&et(Lt)),Ee!==l?(qe=X,X=Mr(Oe)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function Zr(){var X,z,Oe=H*23+15,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(X=H,z=tr(),z!==l&&(qe=X,z=Nt(z)),X=z,je[Oe]={nextPos:H,result:X},X)}function tr(){var X,z,Oe,Ee=H*23+16,We=je[Ee];if(We)return H=We.nextPos,We.result;if(X=H,z=[],o.charCodeAt(H)===94?(Oe=xe,H++):(Oe=l,De===0&&et(Tt)),Oe===l&&(o.charCodeAt(H)===95?(Oe=Ve,H++):(Oe=l,De===0&&et(ur))),Oe!==l)for(;Oe!==l;)z.push(Oe),o.charCodeAt(H)===94?(Oe=xe,H++):(Oe=l,De===0&&et(Tt)),Oe===l&&(o.charCodeAt(H)===95?(Oe=Ve,H++):(Oe=l,De===0&&et(ur)));else z=l;return z!==l&&(qe=X,z=Ei()),X=z,je[Ee]={nextPos:H,result:X},X}function ir(){var X,z,Oe=H*23+17,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(X=H,o.charCodeAt(H)===63?(z=at,H++):(z=l,De===0&&et(Gt)),z!==l&&(qe=X,z=wt()),X=z,je[Oe]={nextPos:H,result:X},X)}function _r(){var X,z,Oe,Ee,We,tt,Ft=H*23+18,yi=je[Ft];return yi?(H=yi.nextPos,yi.result):(X=H,o.charCodeAt(H)===40?(z=T,H++):(z=l,De===0&&et(Oi)),z!==l?(Oe=Di(),Oe!==l?(o.charCodeAt(H)===44?(Ee=v,H++):(Ee=l,De===0&&et(Vt)),Ee!==l?(We=Di(),We!==l?(o.charCodeAt(H)===41?(tt=B,H++):(tt=l,De===0&&et(Fi)),tt!==l?(qe=X,X=Er(Oe,We)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[Ft]={nextPos:H,result:X},X)}function qt(){var X,z,Oe,Ee,We=H*23+19,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,z=er(),z!==l?(o.charCodeAt(H)===58?(Oe=dt,H++):(Oe=l,De===0&&et(Lr)),Oe!==l?(Ee=Di(),Ee!==l?(qe=X,X=Nr(z,Ee)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function Vr(){var X,z,Oe=H*23+20,Ee=je[Oe];return Ee?(H=Ee.nextPos,Ee.result):(X=H,z=Sr(),z!==l&&(qe=X,z=Yr(z)),X=z,je[Oe]={nextPos:H,result:X},X)}function Pi(){var X,z,Oe,Ee,We=H*23+21,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,z=tr(),z===l&&(z=null),Oe=Sr(),Oe===l&&(Oe=null),Ee=Di(),Ee!==l?(qe=X,X=pr(z,Oe,Ee)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function br(){var X,z,Oe,Ee,We=H*23+22,tt=je[We];if(tt)return H=tt.nextPos,tt.result;if(X=H,z=Pi(),z!==l){if(Oe=[],Ee=Pi(),Ee!==l)for(;Ee!==l;)Oe.push(Ee),Ee=Pi();else Oe=l;Oe!==l?(qe=X,X=gt(z,Oe)):(H=X,X=l)}else H=X,X=l;return je[We]={nextPos:H,result:X},X}var Ir=a.nodeOptions||{};function Wt(X,z){z.text=Ai(),z.location=gr();for(var Oe in Ir)(z[Oe]===void 0||z[Oe]===null)&&(z[Oe]=Ir[Oe]);return new X(z)}if(Yi=f(),Yi!==l&&H===o.length)return Yi;throw Yi!==l&&He?s:(e-=s.length,r+=r.repeat(e),s+r.slice(0,e))}peg$SyntaxError.prototype.format=function(s){var e="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n>",!1),ji=bt("<<",!1),Mi=bt("<",!1),Lt=bt(">",!1),ur=bt("_",!1),Gt=bt("?",!1),Lr=bt(":",!1),fr=function(X){return X.filter(K=>K)},qi=function(){return parseFloat(Ai())},ui=function(){return parseInt(Ai())},Kt=function(){},Qr=function(){return DEFAULT_DURS[Ai()]},dr=function(X){return X.filter(K=>K)},Ki=function(X){return Wt(List,{items:X})},Rr=function(X,K,Se){return Wt(ListOperation,{left:X,operation:K,right:Se})},mi=function(X){return X},Mr=function(X){return Wt(Cycle,{items:X})},Nt=function(X){return a.nodeOptions.octave=X,Wt(OctaveChange,{octave:X})},Ei=function(){return Ai().split("").reduce((X,K)=>X+(K==="^"?1:-1),0)},wt=function(){return Wt(RandomPitch,{seededRandom:a.seededRandom})},Er=function(X,K){return Wt(RandomPitch,{min:X,max:K,seededRandom:a.seededRandom})},Nr=function(X,K){return Wt(Repeat,{item:X,times:K})},Yr=function(X){return a.nodeOptions.duration=X,Wt(DurationChange,{duration:X})},pr=function(X,K,Se){const Ee=X?a.nodeOptions.octave+X:a.nodeOptions.octave;return Wt(Pitch,{duration:K,pitch:Se,octave:Ee})},gt=function(X,K){return Wt(Chord,{pitches:[X].concat(K)})},H=0,qe=0,Qt=[{line:1,column:1}],kt=0,Ni=[],De=0,je={},Yi;if("startRule"in a){if(!(a.startRule in h))throw new Error(`Can't start parsing from rule "`+a.startRule+'".');f=h[a.startRule]}function Ai(){return o.substring(qe,H)}function gr(){return li(qe,H)}function bt(X,K){return{type:"literal",text:X,ignoreCase:K}}function Ji(X,K,Se){return{type:"class",parts:X,inverted:K,ignoreCase:Se}}function Dr(){return{type:"end"}}function Or(X){return{type:"other",description:X}}function mr(X){var K=Qt[X],Se;if(K)return K;for(Se=X-1;!Qt[Se];)Se--;for(K=Qt[Se],K={line:K.line,column:K.column};Sekt&&(kt=H,Ni=[]),Ni.push(X))}function Br(X,K,Se){return new e(e.buildMessage(X,K),X,K,Se)}function Ht(){var X,K,Se=H*23+0,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=Xi(),K!==l&&(qe=X,K=fr(K)),X=K,je[Se]={nextPos:H,result:X},X)}function Xr(){var X,K,Se,Ee,We,tt,Ft,yi=H*23+1,Zi=je[yi];if(Zi)return H=Zi.nextPos,Zi.result;for(X=H,K=H,o.charCodeAt(H)===45?(Se=d,H++):(Se=l,De===0&&et(it)),Se===l&&(Se=null),Ee=[],ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));We!==l;)Ee.push(We),ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));if(o.charCodeAt(H)===46?(We=m,H++):(We=l,De===0&&et(lt)),We!==l){if(tt=[],ct.test(o.charAt(H))?(Ft=o.charAt(H),H++):(Ft=l,De===0&&et(pt)),Ft!==l)for(;Ft!==l;)tt.push(Ft),ct.test(o.charAt(H))?(Ft=o.charAt(H),H++):(Ft=l,De===0&&et(pt));else tt=l;tt!==l?(Se=[Se,Ee,We,tt],K=Se):(H=K,K=l)}else H=K,K=l;if(K===l)if(K=H,o.charCodeAt(H)===46?(Se=m,H++):(Se=l,De===0&&et(lt)),Se!==l){if(Ee=[],ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt)),We!==l)for(;We!==l;)Ee.push(We),ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));else Ee=l;Ee!==l?(Se=[Se,Ee],K=Se):(H=K,K=l)}else H=K,K=l;return K!==l&&(qe=X,K=qi()),X=K,je[yi]={nextPos:H,result:X},X}function Di(){var X,K,Se=H*23+2,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,o.charCodeAt(H)===45?H++:De===0&&et(it),ct.test(o.charAt(H))?(K=o.charAt(H),H++):(K=l,De===0&&et(pt)),K!==l?(qe=X,X=ui()):(H=X,X=l),je[Se]={nextPos:H,result:X},X)}function Jt(){var X,K,Se=H*23+3,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(De++,X=H,nt.test(o.charAt(H))?(K=o.charAt(H),H++):(K=l,De===0&&et(mt)),K!==l&&(qe=X,K=Kt()),X=K,De--,X===l&&(K=l,De===0&&et(st)),je[Se]={nextPos:H,result:X},X)}function Bi(){var X,K,Se=H*23+7,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,ft.test(o.charAt(H))?(K=o.charAt(H),H++):(K=l,De===0&&et(gi)),K!==l&&(qe=X,K=Qr()),X=K,je[Se]={nextPos:H,result:X},X)}function Sr(){var X,K=H*23+8,Se=je[K];return Se?(H=Se.nextPos,Se.result):(X=Bi(),X===l&&(X=Xr()),je[K]={nextPos:H,result:X},X)}function Xi(){var X,K,Se,Ee=H*23+9,We=je[Ee];if(We)return H=We.nextPos,We.result;if(X=H,K=[],Se=qt(),Se===l&&(Se=yr(),Se===l&&(Se=Si(),Se===l&&(Se=er(),Se===l&&(Se=Cr())))),Se!==l)for(;Se!==l;)K.push(Se),Se=qt(),Se===l&&(Se=yr(),Se===l&&(Se=Si(),Se===l&&(Se=er(),Se===l&&(Se=Cr()))));else K=l;return K!==l&&(qe=X,K=dr(K)),X=K,je[Ee]={nextPos:H,result:X},X}function Si(){var X,K,Se,Ee,We=H*23+10,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,o.charCodeAt(H)===40?(K=T,H++):(K=l,De===0&&et(Oi)),K!==l?(Se=Xi(),Se!==l?(o.charCodeAt(H)===41?(Ee=B,H++):(Ee=l,De===0&&et(Fi)),Ee!==l?(qe=X,X=Ki(Se)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function yr(){var X,K,Se,Ee,We=H*23+11,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,K=Si(),K!==l?(Se=vr(),Se!==l?(Ee=Si(),Ee!==l?(qe=X,X=Rr(K,Se,Ee)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function vr(){var X,K=H*23+12,Se=je[K];return Se?(H=Se.nextPos,Se.result):(o.charCodeAt(H)===43?(X=Y,H++):(X=l,De===0&&et($i)),X===l&&(o.charCodeAt(H)===45?(X=d,H++):(X=l,De===0&&et(it)),X===l&&(o.charCodeAt(H)===42?(X=F,H++):(X=l,De===0&&et(Ye)),X===l&&(o.charCodeAt(H)===47?(X=ke,H++):(X=l,De===0&&et(hr)),X===l&&(o.charCodeAt(H)===37?(X=Qe,H++):(X=l,De===0&&et(xi)),X===l&&(o.charCodeAt(H)===94?(X=xe,H++):(X=l,De===0&&et(Tt)),X===l&&(o.charCodeAt(H)===124?(X=A,H++):(X=l,De===0&&et(Yt)),X===l&&(o.charCodeAt(H)===38?(X=Te,H++):(X=l,De===0&&et(Ui)),X===l&&(o.substr(H,2)===Le?(X=Le,H+=2):(X=l,De===0&&et(zi)),X===l&&(o.substr(H,2)===Me?(X=Me,H+=2):(X=l,De===0&&et(ji))))))))))),je[K]={nextPos:H,result:X},X)}function er(){var X,K,Se=H*23+13,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=br(),K===l&&(K=Pi(),K===l&&(K=Zr(),K===l&&(K=Jt(),K===l&&(K=Vr(),K===l&&(K=ir(),K===l&&(K=_r(),K===l&&(K=Si()))))))),K!==l&&(qe=X,K=mi(K)),X=K,je[Se]={nextPos:H,result:X},X)}function Cr(){var X,K,Se,Ee,We=H*23+14,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,o.charCodeAt(H)===60?(K=ot,H++):(K=l,De===0&&et(Mi)),K!==l?(Se=Xi(),Se!==l?(o.charCodeAt(H)===62?(Ee=Fe,H++):(Ee=l,De===0&&et(Lt)),Ee!==l?(qe=X,X=Mr(Se)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function Zr(){var X,K,Se=H*23+15,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=tr(),K!==l&&(qe=X,K=Nt(K)),X=K,je[Se]={nextPos:H,result:X},X)}function tr(){var X,K,Se,Ee=H*23+16,We=je[Ee];if(We)return H=We.nextPos,We.result;if(X=H,K=[],o.charCodeAt(H)===94?(Se=xe,H++):(Se=l,De===0&&et(Tt)),Se===l&&(o.charCodeAt(H)===95?(Se=Ve,H++):(Se=l,De===0&&et(ur))),Se!==l)for(;Se!==l;)K.push(Se),o.charCodeAt(H)===94?(Se=xe,H++):(Se=l,De===0&&et(Tt)),Se===l&&(o.charCodeAt(H)===95?(Se=Ve,H++):(Se=l,De===0&&et(ur)));else K=l;return K!==l&&(qe=X,K=Ei()),X=K,je[Ee]={nextPos:H,result:X},X}function ir(){var X,K,Se=H*23+17,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,o.charCodeAt(H)===63?(K=at,H++):(K=l,De===0&&et(Gt)),K!==l&&(qe=X,K=wt()),X=K,je[Se]={nextPos:H,result:X},X)}function _r(){var X,K,Se,Ee,We,tt,Ft=H*23+18,yi=je[Ft];return yi?(H=yi.nextPos,yi.result):(X=H,o.charCodeAt(H)===40?(K=T,H++):(K=l,De===0&&et(Oi)),K!==l?(Se=Di(),Se!==l?(o.charCodeAt(H)===44?(Ee=v,H++):(Ee=l,De===0&&et(Vt)),Ee!==l?(We=Di(),We!==l?(o.charCodeAt(H)===41?(tt=B,H++):(tt=l,De===0&&et(Fi)),tt!==l?(qe=X,X=Er(Se,We)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[Ft]={nextPos:H,result:X},X)}function qt(){var X,K,Se,Ee,We=H*23+19,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,K=er(),K!==l?(o.charCodeAt(H)===58?(Se=dt,H++):(Se=l,De===0&&et(Lr)),Se!==l?(Ee=Di(),Ee!==l?(qe=X,X=Nr(K,Ee)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function Vr(){var X,K,Se=H*23+20,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=Sr(),K!==l&&(qe=X,K=Yr(K)),X=K,je[Se]={nextPos:H,result:X},X)}function Pi(){var X,K,Se,Ee,We=H*23+21,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,K=tr(),K===l&&(K=null),Se=Sr(),Se===l&&(Se=null),Ee=Di(),Ee!==l?(qe=X,X=pr(K,Se,Ee)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function br(){var X,K,Se,Ee,We=H*23+22,tt=je[We];if(tt)return H=tt.nextPos,tt.result;if(X=H,K=Pi(),K!==l){if(Se=[],Ee=Pi(),Ee!==l)for(;Ee!==l;)Se.push(Ee),Ee=Pi();else Se=l;Se!==l?(qe=X,X=gt(K,Se)):(H=X,X=l)}else H=X,X=l;return je[We]={nextPos:H,result:X},X}var Ir=a.nodeOptions||{};function Wt(X,K){K.text=Ai(),K.location=gr();for(var Se in Ir)(K[Se]===void 0||K[Se]===null)&&(K[Se]=Ir[Se]);return new X(K)}if(Yi=f(),Yi!==l&&H===o.length)return Yi;throw Yi!==l&&He?s:(e-=s.length,r+=r.repeat(e),s+r.slice(0,e))}peg$SyntaxError.prototype.format=function(s){var e="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n `+l+` `+h+` | `+a.line+" | "+f+` `+h+" | "+peg$padEnd("",o.column-1," ")+peg$padEnd("",m,"^")}else e+=` at `+l}return e},peg$SyntaxError.buildMessage=function(s,e){var r={literal:function(f){return'"'+o(f.text)+'"'},class:function(f){var d=f.parts.map(function(m){return Array.isArray(m)?a(m[0])+"-"+a(m[1]):a(m)});return"["+(f.inverted?"^":"")+d.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(f){return f.description}};function n(f){return f.charCodeAt(0).toString(16).toUpperCase()}function o(f){return f.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function a(f){return f.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function l(f){return r[f.type](f)}function c(f){var d=f.map(l),m,v;if(d.sort(),d.length>0){for(m=1,v=1;m",peg$c9="[",peg$c10="+",peg$c11="*",peg$c12="%",peg$c13="&",peg$c14="|",peg$c15="<<",peg$c16=">>",peg$r0=/^[' '\t\r\n]/,peg$r1=/^[0-9]/,peg$e0=peg$classExpectation(["'"," ","'"," ","\r",` -`],!1,!1),peg$e1=peg$literalExpectation("(",!1),peg$e2=peg$literalExpectation(",",!1),peg$e3=peg$literalExpectation(")",!1),peg$e4=peg$classExpectation([["0","9"]],!1,!1),peg$e5=peg$literalExpectation(".",!1),peg$e6=peg$literalExpectation("-",!1),peg$e7=peg$literalExpectation("/",!1),peg$e8=peg$literalExpectation("\\",!1),peg$e9=peg$literalExpectation("<",!1),peg$e10=peg$literalExpectation(">",!1),peg$e11=peg$literalExpectation("[",!1),peg$e12=peg$literalExpectation("+",!1),peg$e13=peg$literalExpectation("*",!1),peg$e14=peg$literalExpectation("%",!1),peg$e15=peg$literalExpectation("&",!1),peg$e16=peg$literalExpectation("|",!1),peg$e17=peg$literalExpectation("<<",!1),peg$e18=peg$literalExpectation(">>",!1),peg$f0=function(s){return centsToSemitones(s.filter(e=>e))},peg$f1=function(){},peg$f2=function(s,e){return Math.floor(Math.random()*(e-s+1)+s)},peg$f3=function(s,e){return Math.random()*(e-s)+s},peg$f4=function(){return parseFloat(text())},peg$f5=function(){return parseInt(text())},peg$f6=function(s){return ratioToCents(s)},peg$f7=function(s,e){return s/e},peg$f8=function(s,e){return Math.pow(2,s/e)},peg$f9=function(s,e,r,n){var o=n?r/n:r;return Math.pow(o,s/e)},peg$f10=function(s,e){return parseFloat(s.toString()+"."+e.toString())},peg$f11=function(s){return s.filter(e=>e)},peg$f12=function(s){return monzoToCents(s)},peg$f13=function(){return eval(text())},peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$resultsCache={},peg$result;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error(`Can't start parsing from rule "`+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}function text(){return input.substring(peg$savedPos,peg$currPos)}function peg$literalExpectation(s,e){return{type:"literal",text:s,ignoreCase:e}}function peg$classExpectation(s,e,r){return{type:"class",parts:s,inverted:e,ignoreCase:r}}function peg$endExpectation(){return{type:"end"}}function peg$computePosDetails(s){var e=peg$posDetailsCache[s],r;if(e)return e;for(r=s-1;!peg$posDetailsCache[r];)r--;for(e=peg$posDetailsCache[r],e={line:e.line,column:e.column};rpeg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(s))}function peg$buildStructuredError(s,e,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(s,e),s,e,r)}function peg$parselines(){var s,e,r,n=peg$currPos*17+0,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,e=[],r=peg$parseratio(),r===peg$FAILED&&(r=peg$parsevalue(),r===peg$FAILED&&(r=peg$parsemonzo(),r===peg$FAILED&&(r=peg$parseoperation(),r===peg$FAILED&&(r=peg$parsesep())))),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),r=peg$parseratio(),r===peg$FAILED&&(r=peg$parsevalue(),r===peg$FAILED&&(r=peg$parsemonzo(),r===peg$FAILED&&(r=peg$parseoperation(),r===peg$FAILED&&(r=peg$parsesep()))));else e=peg$FAILED;return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f0(e)),s=e,peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parsesep(){var s,e,r=peg$currPos*17+1,n=peg$resultsCache[r];return n?(peg$currPos=n.nextPos,n.result):(s=peg$currPos,peg$r0.test(input.charAt(peg$currPos))?(e=input.charAt(peg$currPos),peg$currPos++):(e=peg$FAILED,peg$fail(peg$e0)),e!==peg$FAILED&&(peg$savedPos=s,e=peg$f1()),s=e,peg$resultsCache[r]={nextPos:peg$currPos,result:s},s)}function peg$parsevalue(){var s,e=peg$currPos*17+2,r=peg$resultsCache[e];return r?(peg$currPos=r.nextPos,r.result):(s=peg$parsefloat(),s===peg$FAILED&&(s=peg$parseint(),s===peg$FAILED&&(s=peg$parserandom_int(),s===peg$FAILED&&(s=peg$parserandom_float()))),peg$resultsCache[e]={nextPos:peg$currPos,result:s},s)}function peg$parserandom_int(){var s,e,r,n,o,a,l=peg$currPos*17+3,c=peg$resultsCache[l];return c?(peg$currPos=c.nextPos,c.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parseint(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(n=peg$c1,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e2)),n!==peg$FAILED?(o=peg$parseint(),o!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(a=peg$c2,peg$currPos++):(a=peg$FAILED,peg$fail(peg$e3)),a!==peg$FAILED?(peg$savedPos=s,s=peg$f2(r,o)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[l]={nextPos:peg$currPos,result:s},s)}function peg$parserandom_float(){var s,e,r,n,o,a,l=peg$currPos*17+4,c=peg$resultsCache[l];return c?(peg$currPos=c.nextPos,c.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parsefloat(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(n=peg$c1,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e2)),n!==peg$FAILED?(o=peg$parsefloat(),o!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(a=peg$c2,peg$currPos++):(a=peg$FAILED,peg$fail(peg$e3)),a!==peg$FAILED?(peg$savedPos=s,s=peg$f3(r,o)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[l]={nextPos:peg$currPos,result:s},s)}function peg$parsefloat(){var s,e,r,n,o,a,l,c=peg$currPos*17+5,h=peg$resultsCache[c];if(h)return peg$currPos=h.nextPos,h.result;if(s=peg$currPos,e=peg$currPos,r=[],peg$r1.test(input.charAt(peg$currPos))?(n=input.charAt(peg$currPos),peg$currPos++):(n=peg$FAILED,peg$fail(peg$e4)),n!==peg$FAILED)for(;n!==peg$FAILED;)r.push(n),peg$r1.test(input.charAt(peg$currPos))?(n=input.charAt(peg$currPos),peg$currPos++):(n=peg$FAILED,peg$fail(peg$e4));else r=peg$FAILED;if(r!==peg$FAILED?(input.charCodeAt(peg$currPos)===46?(n=peg$c3,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e5)),n!==peg$FAILED?(r=[r,n],e=r):(peg$currPos=e,e=peg$FAILED)):(peg$currPos=e,e=peg$FAILED),e===peg$FAILED){for(e=peg$currPos,input.charCodeAt(peg$currPos)===45?(r=peg$c4,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e6)),r===peg$FAILED&&(r=null),n=[],peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));o!==peg$FAILED;)n.push(o),peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));if(input.charCodeAt(peg$currPos)===46?(o=peg$c3,peg$currPos++):(o=peg$FAILED,peg$fail(peg$e5)),o!==peg$FAILED){if(a=[],peg$r1.test(input.charAt(peg$currPos))?(l=input.charAt(peg$currPos),peg$currPos++):(l=peg$FAILED,peg$fail(peg$e4)),l!==peg$FAILED)for(;l!==peg$FAILED;)a.push(l),peg$r1.test(input.charAt(peg$currPos))?(l=input.charAt(peg$currPos),peg$currPos++):(l=peg$FAILED,peg$fail(peg$e4));else a=peg$FAILED;a!==peg$FAILED?(r=[r,n,o,a],e=r):(peg$currPos=e,e=peg$FAILED)}else peg$currPos=e,e=peg$FAILED;if(e===peg$FAILED)if(e=peg$currPos,input.charCodeAt(peg$currPos)===46?(r=peg$c3,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e5)),r!==peg$FAILED){if(n=[],peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4)),o!==peg$FAILED)for(;o!==peg$FAILED;)n.push(o),peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));else n=peg$FAILED;n!==peg$FAILED?(r=[r,n],e=r):(peg$currPos=e,e=peg$FAILED)}else peg$currPos=e,e=peg$FAILED}return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f4()),s=e,peg$resultsCache[c]={nextPos:peg$currPos,result:s},s}function peg$parseint(){var s,e,r,n=peg$currPos*17+6,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,input.charCodeAt(peg$currPos)===45?peg$currPos++:peg$fail(peg$e6),e=[],peg$r1.test(input.charAt(peg$currPos))?(r=input.charAt(peg$currPos),peg$currPos++):(r=peg$FAILED,peg$fail(peg$e4)),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),peg$r1.test(input.charAt(peg$currPos))?(r=input.charAt(peg$currPos),peg$currPos++):(r=peg$FAILED,peg$fail(peg$e4));else e=peg$FAILED;return e!==peg$FAILED?(peg$savedPos=s,s=peg$f5()):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parseratio(){var s,e,r=peg$currPos*17+7,n=peg$resultsCache[r];return n?(peg$currPos=n.nextPos,n.result):(s=peg$currPos,e=peg$parseedji_ratio(),e===peg$FAILED&&(e=peg$parseedo_ratio(),e===peg$FAILED&&(e=peg$parsefrac_ratio(),e===peg$FAILED&&(e=peg$parsedecimal_ratio()))),e!==peg$FAILED&&(peg$savedPos=s,e=peg$f6(e)),s=e,peg$resultsCache[r]={nextPos:peg$currPos,result:s},s)}function peg$parsefrac_ratio(){var s,e,r,n,o=peg$currPos*17+8,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===47?(r=peg$c5,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e7)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(peg$savedPos=s,s=peg$f7(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseedo_ratio(){var s,e,r,n,o=peg$currPos*17+9,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===92?(r=peg$c6,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e8)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(peg$savedPos=s,s=peg$f8(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseedji_ratio(){var s,e,r,n,o,a,l,c,h=peg$currPos*17+10,f=peg$resultsCache[h];return f?(peg$currPos=f.nextPos,f.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===92?(r=peg$c6,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e8)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(input.charCodeAt(peg$currPos)===60?(o=peg$c7,peg$currPos++):(o=peg$FAILED,peg$fail(peg$e9)),o!==peg$FAILED?(a=peg$parseint(),a===peg$FAILED&&(a=peg$parserandom_int()),a!==peg$FAILED?(input.charCodeAt(peg$currPos)===47?peg$currPos++:peg$fail(peg$e7),l=peg$parseint(),l===peg$FAILED&&(l=peg$parserandom_int()),l===peg$FAILED&&(l=null),input.charCodeAt(peg$currPos)===62?(c=peg$c8,peg$currPos++):(c=peg$FAILED,peg$fail(peg$e10)),c!==peg$FAILED?(peg$savedPos=s,s=peg$f9(e,n,a,l)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[h]={nextPos:peg$currPos,result:s},s)}function peg$parsedecimal_ratio(){var s,e,r,n,o=peg$currPos*17+11,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(r=peg$c1,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e2)),r!==peg$FAILED?(n=peg$parseint(),n!==peg$FAILED?(peg$savedPos=s,s=peg$f10(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseints(){var s,e,r,n=peg$currPos*17+12,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,e=[],r=peg$parseint(),r===peg$FAILED&&(r=peg$parsesep()),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),r=peg$parseint(),r===peg$FAILED&&(r=peg$parsesep());else e=peg$FAILED;return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f11(e)),s=e,peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parsemonzo(){var s,e,r,n,o=peg$currPos*17+13,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===91?(e=peg$c9,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e11)),e!==peg$FAILED?(r=peg$parseints(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===62?(n=peg$c8,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e10)),n!==peg$FAILED?(peg$savedPos=s,s=peg$f12(r)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseoperation(){var s,e,r,n,o,a,l,c=peg$currPos*17+14,h=peg$resultsCache[c];if(h)return peg$currPos=h.nextPos,h.result;if(s=peg$currPos,e=peg$parsevalue(),e===peg$FAILED&&(e=peg$parseratio(),e===peg$FAILED&&(e=peg$parsemonzo(),e===peg$FAILED)))for(e=[],r=peg$parsesep();r!==peg$FAILED;)e.push(r),r=peg$parsesep();if(e!==peg$FAILED){if(r=[],n=peg$currPos,o=peg$parseoperator(),o!==peg$FAILED){if(a=peg$parsevalue(),a===peg$FAILED&&(a=peg$parseratio(),a===peg$FAILED&&(a=peg$parsemonzo(),a===peg$FAILED&&(a=peg$parsesub_operations(),a===peg$FAILED&&(a=peg$parseoperation(),a===peg$FAILED)))))for(a=[],l=peg$parsesep();l!==peg$FAILED;)a.push(l),l=peg$parsesep();a!==peg$FAILED?(o=[o,a],n=o):(peg$currPos=n,n=peg$FAILED)}else peg$currPos=n,n=peg$FAILED;if(n!==peg$FAILED)for(;n!==peg$FAILED;)if(r.push(n),n=peg$currPos,o=peg$parseoperator(),o!==peg$FAILED){if(a=peg$parsevalue(),a===peg$FAILED&&(a=peg$parseratio(),a===peg$FAILED&&(a=peg$parsemonzo(),a===peg$FAILED&&(a=peg$parsesub_operations(),a===peg$FAILED&&(a=peg$parseoperation(),a===peg$FAILED)))))for(a=[],l=peg$parsesep();l!==peg$FAILED;)a.push(l),l=peg$parsesep();a!==peg$FAILED?(o=[o,a],n=o):(peg$currPos=n,n=peg$FAILED)}else peg$currPos=n,n=peg$FAILED;else r=peg$FAILED;r!==peg$FAILED?(peg$savedPos=s,s=peg$f13()):(peg$currPos=s,s=peg$FAILED)}else peg$currPos=s,s=peg$FAILED;return peg$resultsCache[c]={nextPos:peg$currPos,result:s},s}function peg$parseoperator(){var s,e=peg$currPos*17+15,r=peg$resultsCache[e];return r?(peg$currPos=r.nextPos,r.result):(input.charCodeAt(peg$currPos)===43?(s=peg$c10,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e12)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===45?(s=peg$c4,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e6)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===42?(s=peg$c11,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e13)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===37?(s=peg$c12,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e14)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===38?(s=peg$c13,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e15)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===124?(s=peg$c14,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e16)),s===peg$FAILED&&(input.substr(peg$currPos,2)===peg$c15?(s=peg$c15,peg$currPos+=2):(s=peg$FAILED,peg$fail(peg$e17)),s===peg$FAILED&&(input.substr(peg$currPos,2)===peg$c16?(s=peg$c16,peg$currPos+=2):(s=peg$FAILED,peg$fail(peg$e18))))))))),peg$resultsCache[e]={nextPos:peg$currPos,result:s},s)}function peg$parsesub_operations(){var s,e,r,n,o=peg$currPos*17+16,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parseoperation(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(n=peg$c2,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e3)),n!==peg$FAILED?(e=[e,r,n],s=e):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}if(peg$result=peg$startRuleFunction(),peg$result!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos{typeof PROCESS.emitWarning=="function"?PROCESS.emitWarning(s,e,r,n):console.error(`[${r}] ${e}: ${s}`)};let AC=globalThis.AbortController,AS=globalThis.AbortSignal;var mn;if(typeof AC>"u"){AS=class{constructor(){Se(this,"onabort");Se(this,"_onabort",[]);Se(this,"reason");Se(this,"aborted",!1)}addEventListener(n,o){this._onabort.push(o)}},AC=class{constructor(){Se(this,"signal",new AS);e()}abort(n){var o,a;if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(const l of this.signal._onabort)l(n);(a=(o=this.signal).onabort)==null||a.call(o,n)}}};let s=((mn=PROCESS.env)==null?void 0:mn.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{s&&(s=!1,emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const shouldWarn=s=>!warned.has(s),isPosInt=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),getUintArray=s=>isPosInt(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?ZeroArray:null:null;class ZeroArray extends Array{constructor(e){super(e),this.fill(0)}}var _i;const Ti=class Ti{constructor(e,r){Se(this,"heap");Se(this,"length");if(!N(Ti,_i))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}static create(e){const r=getUintArray(e);if(!r)return[];Ue(Ti,_i,!0);const n=new Ti(e,r);return Ue(Ti,_i,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};_i=new WeakMap,rt(Ti,_i,!1);let Stack=Ti;var ti,Ut,ii,ri,Vi,At,ni,Pt,vt,Je,Zt,zt,Bt,Mt,si,Et,fi,di,oi,ai,ki,_t,sr,qr,Li,pi,or,jt,Tr,yn,Qi,Gi,ar,ci,Ii,hi,wi,lr,Kr,Hi,Ar,Wi,Pr,St,Ct,cr,Jr,Ri,nr;const en=class en{constructor(e){rt(this,sr);rt(this,Tr);rt(this,ci);rt(this,hi);rt(this,lr);rt(this,Hi);rt(this,Wi);rt(this,St);rt(this,cr);rt(this,Ri);rt(this,ti,void 0);rt(this,Ut,void 0);rt(this,ii,void 0);rt(this,ri,void 0);rt(this,Vi,void 0);Se(this,"ttl");Se(this,"ttlResolution");Se(this,"ttlAutopurge");Se(this,"updateAgeOnGet");Se(this,"updateAgeOnHas");Se(this,"allowStale");Se(this,"noDisposeOnSet");Se(this,"noUpdateTTL");Se(this,"maxEntrySize");Se(this,"sizeCalculation");Se(this,"noDeleteOnFetchRejection");Se(this,"noDeleteOnStaleGet");Se(this,"allowStaleOnFetchAbort");Se(this,"allowStaleOnFetchRejection");Se(this,"ignoreFetchAbort");rt(this,At,void 0);rt(this,ni,void 0);rt(this,Pt,void 0);rt(this,vt,void 0);rt(this,Je,void 0);rt(this,Zt,void 0);rt(this,zt,void 0);rt(this,Bt,void 0);rt(this,Mt,void 0);rt(this,si,void 0);rt(this,Et,void 0);rt(this,fi,void 0);rt(this,di,void 0);rt(this,oi,void 0);rt(this,ai,void 0);rt(this,ki,void 0);rt(this,_t,void 0);rt(this,Li,()=>{});rt(this,pi,()=>{});rt(this,or,()=>{});rt(this,jt,()=>!1);rt(this,Qi,e=>{});rt(this,Gi,(e,r,n)=>{});rt(this,ar,(e,r,n,o)=>{if(n||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:r=0,ttl:n,ttlResolution:o=1,ttlAutopurge:a,updateAgeOnGet:l,updateAgeOnHas:c,allowStale:h,dispose:f,disposeAfter:d,noDisposeOnSet:m,noUpdateTTL:v,maxSize:A=0,maxEntrySize:T=0,sizeCalculation:B,fetchMethod:Y,noDeleteOnFetchRejection:F,noDeleteOnStaleGet:ke,allowStaleOnFetchRejection:Qe,allowStaleOnFetchAbort:xe,ignoreFetchAbort:Te}=e;if(r!==0&&!isPosInt(r))throw new TypeError("max option must be a nonnegative integer");const Le=r?getUintArray(r):Array;if(!Le)throw new Error("invalid max value: "+r);if(Ue(this,ti,r),Ue(this,Ut,A),this.maxEntrySize=T||N(this,Ut),this.sizeCalculation=B,this.sizeCalculation){if(!N(this,Ut)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(Y!==void 0&&typeof Y!="function")throw new TypeError("fetchMethod must be a function if specified");if(Ue(this,Vi,Y),Ue(this,ki,!!Y),Ue(this,Pt,new Map),Ue(this,vt,new Array(r).fill(void 0)),Ue(this,Je,new Array(r).fill(void 0)),Ue(this,Zt,new Le(r)),Ue(this,zt,new Le(r)),Ue(this,Bt,0),Ue(this,Mt,0),Ue(this,si,Stack.create(r)),Ue(this,At,0),Ue(this,ni,0),typeof f=="function"&&Ue(this,ii,f),typeof d=="function"?(Ue(this,ri,d),Ue(this,Et,[])):(Ue(this,ri,void 0),Ue(this,Et,void 0)),Ue(this,ai,!!N(this,ii)),Ue(this,_t,!!N(this,ri)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!F,this.allowStaleOnFetchRejection=!!Qe,this.allowStaleOnFetchAbort=!!xe,this.ignoreFetchAbort=!!Te,this.maxEntrySize!==0){if(N(this,Ut)!==0&&!isPosInt(N(this,Ut)))throw new TypeError("maxSize must be a positive integer if specified");if(!isPosInt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");_e(this,Tr,yn).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!ke,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!c,this.ttlResolution=isPosInt(o)||o===0?o:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!isPosInt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");_e(this,sr,qr).call(this)}if(N(this,ti)===0&&this.ttl===0&&N(this,Ut)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!N(this,ti)&&!N(this,Ut)){const Me="LRU_CACHE_UNBOUNDED";shouldWarn(Me)&&(warned.add(Me),emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Me,en))}}static unsafeExposeInternals(e){return{starts:N(e,di),ttls:N(e,oi),sizes:N(e,fi),keyMap:N(e,Pt),keyList:N(e,vt),valList:N(e,Je),next:N(e,Zt),prev:N(e,zt),get head(){return N(e,Bt)},get tail(){return N(e,Mt)},free:N(e,si),isBackgroundFetch:r=>{var n;return _e(n=e,St,Ct).call(n,r)},backgroundFetch:(r,n,o,a)=>{var l;return _e(l=e,Wi,Pr).call(l,r,n,o,a)},moveToTail:r=>{var n;return _e(n=e,Ri,nr).call(n,r)},indexes:r=>{var n;return _e(n=e,ci,Ii).call(n,r)},rindexes:r=>{var n;return _e(n=e,hi,wi).call(n,r)},isStale:r=>{var n;return N(n=e,jt).call(n,r)}}}get max(){return N(this,ti)}get maxSize(){return N(this,Ut)}get calculatedSize(){return N(this,ni)}get size(){return N(this,At)}get fetchMethod(){return N(this,Vi)}get dispose(){return N(this,ii)}get disposeAfter(){return N(this,ri)}getRemainingTTL(e){return N(this,Pt).has(e)?1/0:0}*entries(){for(const e of _e(this,ci,Ii).call(this))N(this,Je)[e]!==void 0&&N(this,vt)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield[N(this,vt)[e],N(this,Je)[e]])}*rentries(){for(const e of _e(this,hi,wi).call(this))N(this,Je)[e]!==void 0&&N(this,vt)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield[N(this,vt)[e],N(this,Je)[e]])}*keys(){for(const e of _e(this,ci,Ii).call(this)){const r=N(this,vt)[e];r!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield r)}}*rkeys(){for(const e of _e(this,hi,wi).call(this)){const r=N(this,vt)[e];r!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield r)}}*values(){for(const e of _e(this,ci,Ii).call(this))N(this,Je)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield N(this,Je)[e])}*rvalues(){for(const e of _e(this,hi,wi).call(this))N(this,Je)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield N(this,Je)[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(const n of _e(this,ci,Ii).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;if(a!==void 0&&e(a,N(this,vt)[n],this))return this.get(N(this,vt)[n],r)}}forEach(e,r=this){for(const n of _e(this,ci,Ii).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;a!==void 0&&e.call(r,a,N(this,vt)[n],this)}}rforEach(e,r=this){for(const n of _e(this,hi,wi).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;a!==void 0&&e.call(r,a,N(this,vt)[n],this)}}purgeStale(){let e=!1;for(const r of _e(this,hi,wi).call(this,{allowStale:!0}))N(this,jt).call(this,r)&&(this.delete(N(this,vt)[r]),e=!0);return e}dump(){const e=[];for(const r of _e(this,ci,Ii).call(this,{allowStale:!0})){const n=N(this,vt)[r],o=N(this,Je)[r],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;if(a===void 0||n===void 0)continue;const l={value:a};if(N(this,oi)&&N(this,di)){l.ttl=N(this,oi)[r];const c=perf.now()-N(this,di)[r];l.start=Math.floor(Date.now()-c)}N(this,fi)&&(l.size=N(this,fi)[r]),e.unshift([n,l])}return e}load(e){this.clear();for(const[r,n]of e){if(n.start){const o=Date.now()-n.start;n.start=perf.now()-o}this.set(r,n.value,n)}}set(e,r,n={}){var v,A,T,B,Y;if(r===void 0)return this.delete(e),this;const{ttl:o=this.ttl,start:a,noDisposeOnSet:l=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:h}=n;let{noUpdateTTL:f=this.noUpdateTTL}=n;const d=N(this,ar).call(this,e,r,n.size||0,c);if(this.maxEntrySize&&d>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.delete(e),this;let m=N(this,At)===0?void 0:N(this,Pt).get(e);if(m===void 0)m=N(this,At)===0?N(this,Mt):N(this,si).length!==0?N(this,si).pop():N(this,At)===N(this,ti)?_e(this,Hi,Ar).call(this,!1):N(this,At),N(this,vt)[m]=e,N(this,Je)[m]=r,N(this,Pt).set(e,m),N(this,Zt)[N(this,Mt)]=m,N(this,zt)[m]=N(this,Mt),Ue(this,Mt,m),xr(this,At)._++,N(this,Gi).call(this,m,d,h),h&&(h.set="add"),f=!1;else{_e(this,Ri,nr).call(this,m);const F=N(this,Je)[m];if(r!==F){if(N(this,ki)&&_e(this,St,Ct).call(this,F)){F.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:ke}=F;ke!==void 0&&!l&&(N(this,ai)&&((v=N(this,ii))==null||v.call(this,ke,e,"set")),N(this,_t)&&((A=N(this,Et))==null||A.push([ke,e,"set"])))}else l||(N(this,ai)&&((T=N(this,ii))==null||T.call(this,F,e,"set")),N(this,_t)&&((B=N(this,Et))==null||B.push([F,e,"set"])));if(N(this,Qi).call(this,m),N(this,Gi).call(this,m,d,h),N(this,Je)[m]=r,h){h.set="replace";const ke=F&&_e(this,St,Ct).call(this,F)?F.__staleWhileFetching:F;ke!==void 0&&(h.oldValue=ke)}}else h&&(h.set="update")}if(o!==0&&!N(this,oi)&&_e(this,sr,qr).call(this),N(this,oi)&&(f||N(this,or).call(this,m,o,a),h&&N(this,pi).call(this,h,m)),!l&&N(this,_t)&&N(this,Et)){const F=N(this,Et);let ke;for(;ke=F==null?void 0:F.shift();)(Y=N(this,ri))==null||Y.call(this,...ke)}return this}pop(){var e;try{for(;N(this,At);){const r=N(this,Je)[N(this,Bt)];if(_e(this,Hi,Ar).call(this,!0),_e(this,St,Ct).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(N(this,_t)&&N(this,Et)){const r=N(this,Et);let n;for(;n=r==null?void 0:r.shift();)(e=N(this,ri))==null||e.call(this,...n)}}}has(e,r={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:o}=r,a=N(this,Pt).get(e);if(a!==void 0){const l=N(this,Je)[a];if(_e(this,St,Ct).call(this,l)&&l.__staleWhileFetching===void 0)return!1;if(N(this,jt).call(this,a))o&&(o.has="stale",N(this,pi).call(this,o,a));else return n&&N(this,Li).call(this,a),o&&(o.has="hit",N(this,pi).call(this,o,a)),!0}else o&&(o.has="miss");return!1}peek(e,r={}){const{allowStale:n=this.allowStale}=r,o=N(this,Pt).get(e);if(o!==void 0&&(n||!N(this,jt).call(this,o))){const a=N(this,Je)[o];return _e(this,St,Ct).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,r={}){const{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:B,forceRefresh:Y=!1,status:F,signal:ke}=r;if(!N(this,ki))return F&&(F.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:a,status:F});const Qe={allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:a,ttl:l,noDisposeOnSet:c,size:h,sizeCalculation:f,noUpdateTTL:d,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:T,ignoreFetchAbort:A,status:F,signal:ke};let xe=N(this,Pt).get(e);if(xe===void 0){F&&(F.fetch="miss");const Te=_e(this,Wi,Pr).call(this,e,xe,Qe,B);return Te.__returned=Te}else{const Te=N(this,Je)[xe];if(_e(this,St,Ct).call(this,Te)){const Ve=n&&Te.__staleWhileFetching!==void 0;return F&&(F.fetch="inflight",Ve&&(F.returnedStale=!0)),Ve?Te.__staleWhileFetching:Te.__returned=Te}const Le=N(this,jt).call(this,xe);if(!Y&&!Le)return F&&(F.fetch="hit"),_e(this,Ri,nr).call(this,xe),o&&N(this,Li).call(this,xe),F&&N(this,pi).call(this,F,xe),Te;const Me=_e(this,Wi,Pr).call(this,e,xe,Qe,B),Fe=Me.__staleWhileFetching!==void 0&&n;return F&&(F.fetch=Le?"stale":"refresh",Fe&&Le&&(F.returnedStale=!0)),Fe?Me.__staleWhileFetching:Me.__returned=Me}}get(e,r={}){const{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:l}=r,c=N(this,Pt).get(e);if(c!==void 0){const h=N(this,Je)[c],f=_e(this,St,Ct).call(this,h);return l&&N(this,pi).call(this,l,c),N(this,jt).call(this,c)?(l&&(l.get="stale"),f?(l&&n&&h.__staleWhileFetching!==void 0&&(l.returnedStale=!0),n?h.__staleWhileFetching:void 0):(a||this.delete(e),l&&n&&(l.returnedStale=!0),n?h:void 0)):(l&&(l.get="hit"),f?h.__staleWhileFetching:(_e(this,Ri,nr).call(this,c),o&&N(this,Li).call(this,c),h))}else l&&(l.get="miss")}delete(e){var n,o,a,l;let r=!1;if(N(this,At)!==0){const c=N(this,Pt).get(e);if(c!==void 0)if(r=!0,N(this,At)===1)this.clear();else{N(this,Qi).call(this,c);const h=N(this,Je)[c];_e(this,St,Ct).call(this,h)?h.__abortController.abort(new Error("deleted")):(N(this,ai)||N(this,_t))&&(N(this,ai)&&((n=N(this,ii))==null||n.call(this,h,e,"delete")),N(this,_t)&&((o=N(this,Et))==null||o.push([h,e,"delete"]))),N(this,Pt).delete(e),N(this,vt)[c]=void 0,N(this,Je)[c]=void 0,c===N(this,Mt)?Ue(this,Mt,N(this,zt)[c]):c===N(this,Bt)?Ue(this,Bt,N(this,Zt)[c]):(N(this,Zt)[N(this,zt)[c]]=N(this,Zt)[c],N(this,zt)[N(this,Zt)[c]]=N(this,zt)[c]),xr(this,At)._--,N(this,si).push(c)}}if(N(this,_t)&&((a=N(this,Et))!=null&&a.length)){const c=N(this,Et);let h;for(;h=c==null?void 0:c.shift();)(l=N(this,ri))==null||l.call(this,...h)}return r}clear(){var e,r,n;for(const o of _e(this,hi,wi).call(this,{allowStale:!0})){const a=N(this,Je)[o];if(_e(this,St,Ct).call(this,a))a.__abortController.abort(new Error("deleted"));else{const l=N(this,vt)[o];N(this,ai)&&((e=N(this,ii))==null||e.call(this,a,l,"delete")),N(this,_t)&&((r=N(this,Et))==null||r.push([a,l,"delete"]))}}if(N(this,Pt).clear(),N(this,Je).fill(void 0),N(this,vt).fill(void 0),N(this,oi)&&N(this,di)&&(N(this,oi).fill(0),N(this,di).fill(0)),N(this,fi)&&N(this,fi).fill(0),Ue(this,Bt,0),Ue(this,Mt,0),N(this,si).length=0,Ue(this,ni,0),Ue(this,At,0),N(this,_t)&&N(this,Et)){const o=N(this,Et);let a;for(;a=o==null?void 0:o.shift();)(n=N(this,ri))==null||n.call(this,...a)}}};ti=new WeakMap,Ut=new WeakMap,ii=new WeakMap,ri=new WeakMap,Vi=new WeakMap,At=new WeakMap,ni=new WeakMap,Pt=new WeakMap,vt=new WeakMap,Je=new WeakMap,Zt=new WeakMap,zt=new WeakMap,Bt=new WeakMap,Mt=new WeakMap,si=new WeakMap,Et=new WeakMap,fi=new WeakMap,di=new WeakMap,oi=new WeakMap,ai=new WeakMap,ki=new WeakMap,_t=new WeakMap,sr=new WeakSet,qr=function(){const e=new ZeroArray(N(this,ti)),r=new ZeroArray(N(this,ti));Ue(this,oi,e),Ue(this,di,r),Ue(this,or,(a,l,c=perf.now())=>{if(r[a]=l!==0?c:0,e[a]=l,l!==0&&this.ttlAutopurge){const h=setTimeout(()=>{N(this,jt).call(this,a)&&this.delete(N(this,vt)[a])},l+1);h.unref&&h.unref()}}),Ue(this,Li,a=>{r[a]=e[a]!==0?perf.now():0}),Ue(this,pi,(a,l)=>{if(e[l]){const c=e[l],h=r[l];a.ttl=c,a.start=h,a.now=n||o();const f=a.now-h;a.remainingTTL=c-f}});let n=0;const o=()=>{const a=perf.now();if(this.ttlResolution>0){n=a;const l=setTimeout(()=>n=0,this.ttlResolution);l.unref&&l.unref()}return a};this.getRemainingTTL=a=>{const l=N(this,Pt).get(a);if(l===void 0)return 0;const c=e[l],h=r[l];if(c===0||h===0)return 1/0;const f=(n||o())-h;return c-f},Ue(this,jt,a=>e[a]!==0&&r[a]!==0&&(n||o())-r[a]>e[a])},Li=new WeakMap,pi=new WeakMap,or=new WeakMap,jt=new WeakMap,Tr=new WeakSet,yn=function(){const e=new ZeroArray(N(this,ti));Ue(this,ni,0),Ue(this,fi,e),Ue(this,Qi,r=>{Ue(this,ni,N(this,ni)-e[r]),e[r]=0}),Ue(this,ar,(r,n,o,a)=>{if(_e(this,St,Ct).call(this,n))return 0;if(!isPosInt(o))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(o=a(n,r),!isPosInt(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o}),Ue(this,Gi,(r,n,o)=>{if(e[r]=n,N(this,Ut)){const a=N(this,Ut)-e[r];for(;N(this,ni)>a;)_e(this,Hi,Ar).call(this,!0)}Ue(this,ni,N(this,ni)+e[r]),o&&(o.entrySize=n,o.totalCalculatedSize=N(this,ni))})},Qi=new WeakMap,Gi=new WeakMap,ar=new WeakMap,ci=new WeakSet,Ii=function*({allowStale:e=this.allowStale}={}){if(N(this,At))for(let r=N(this,Mt);!(!_e(this,lr,Kr).call(this,r)||((e||!N(this,jt).call(this,r))&&(yield r),r===N(this,Bt)));)r=N(this,zt)[r]},hi=new WeakSet,wi=function*({allowStale:e=this.allowStale}={}){if(N(this,At))for(let r=N(this,Bt);!(!_e(this,lr,Kr).call(this,r)||((e||!N(this,jt).call(this,r))&&(yield r),r===N(this,Mt)));)r=N(this,Zt)[r]},lr=new WeakSet,Kr=function(e){return e!==void 0&&N(this,Pt).get(N(this,vt)[e])===e},Hi=new WeakSet,Ar=function(e){var a,l;const r=N(this,Bt),n=N(this,vt)[r],o=N(this,Je)[r];return N(this,ki)&&_e(this,St,Ct).call(this,o)?o.__abortController.abort(new Error("evicted")):(N(this,ai)||N(this,_t))&&(N(this,ai)&&((a=N(this,ii))==null||a.call(this,o,n,"evict")),N(this,_t)&&((l=N(this,Et))==null||l.push([o,n,"evict"]))),N(this,Qi).call(this,r),e&&(N(this,vt)[r]=void 0,N(this,Je)[r]=void 0,N(this,si).push(r)),N(this,At)===1?(Ue(this,Bt,Ue(this,Mt,0)),N(this,si).length=0):Ue(this,Bt,N(this,Zt)[r]),N(this,Pt).delete(n),xr(this,At)._--,r},Wi=new WeakSet,Pr=function(e,r,n,o){const a=r===void 0?void 0:N(this,Je)[r];if(_e(this,St,Ct).call(this,a))return a;const l=new AC,{signal:c}=n;c==null||c.addEventListener("abort",()=>l.abort(c.reason),{signal:l.signal});const h={signal:l.signal,options:n,context:o},f=(B,Y=!1)=>{const{aborted:F}=l.signal,ke=n.ignoreFetchAbort&&B!==void 0;if(n.status&&(F&&!Y?(n.status.fetchAborted=!0,n.status.fetchError=l.signal.reason,ke&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),F&&!ke&&!Y)return m(l.signal.reason);const Qe=A;return N(this,Je)[r]===A&&(B===void 0?Qe.__staleWhileFetching?N(this,Je)[r]=Qe.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,B,h.options))),B},d=B=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=B),m(B)),m=B=>{const{aborted:Y}=l.signal,F=Y&&n.allowStaleOnFetchAbort,ke=F||n.allowStaleOnFetchRejection,Qe=ke||n.noDeleteOnFetchRejection,xe=A;if(N(this,Je)[r]===A&&(!Qe||xe.__staleWhileFetching===void 0?this.delete(e):F||(N(this,Je)[r]=xe.__staleWhileFetching)),ke)return n.status&&xe.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),xe.__staleWhileFetching;if(xe.__returned===xe)throw B},v=(B,Y)=>{var ke;const F=(ke=N(this,Vi))==null?void 0:ke.call(this,e,a,h);F&&F instanceof Promise&&F.then(Qe=>B(Qe===void 0?void 0:Qe),Y),l.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(B(void 0),n.allowStaleOnFetchAbort&&(B=Qe=>f(Qe,!0)))})};n.status&&(n.status.fetchDispatched=!0);const A=new Promise(v).then(f,d),T=Object.assign(A,{__abortController:l,__staleWhileFetching:a,__returned:void 0});return r===void 0?(this.set(e,T,{...h.options,status:void 0}),r=N(this,Pt).get(e)):N(this,Je)[r]=T,T},St=new WeakSet,Ct=function(e){if(!N(this,ki))return!1;const r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AC},cr=new WeakSet,Jr=function(e,r){N(this,zt)[r]=e,N(this,Zt)[e]=r},Ri=new WeakSet,nr=function(e){e!==N(this,Mt)&&(e===N(this,Bt)?Ue(this,Bt,N(this,Zt)[e]):_e(this,cr,Jr).call(this,N(this,zt)[e],N(this,Zt)[e]),_e(this,cr,Jr).call(this,N(this,Mt),e),Ue(this,Mt,e))};let LRUCache=en;const zcache=new LRUCache({max:1e3,ttl:1e3*60*5});class Ziffers{constructor(e,r={}){Se(this,"values");Se(this,"evaluated");Se(this,"options");Se(this,"index",0);Se(this,"redo");Se(this,"_current");r={...DEFAULT_OPTIONS,...r},r.scale&&(typeof r.scale=="string"&&(isScale(r.scale)?(r.scaleName=r.scale,r.scale=getScale(r.scale)):r.scale=parse(r.scale)),r.parsedScale=r.scale,delete r.scale),r.redo!==void 0?this.redo=r.redo:this.redo=1,r&&r.seed&&(r.randomSeed=r.seed,r.seededRandom=seededRandom(r.seed)),this.options={nodeOptions:r};try{this.values=parse$1(e,this.options),this.evaluated=this.evaluate()}catch(n){console.log(n),this.values=[],this.evaluated=[]}}update(){this.evaluated=this.evaluate()}pitches(){return this.evaluated.map(e=>e.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}next(){if(this.redo>0&&this.index>=this.evaluated.length*this.redo&&(this.update(),this._current=void 0),this._current!==void 0){const r=this.evaluated[this._current%this.evaluated.length];r.modifiedEvent&&r.modifiedEvent==null,this._current=this._current+1r.evaluate()).flat(1/0).filter(r=>r!==void 0);return e.forEach((r,n)=>{r._next=n0?n-1:e.length-1}),e}}const generateCacheKey=(...s)=>s.map(e=>JSON.stringify(e)).join(","),cachedCall=(s,e)=>{const r=generateCacheKey(s,e);if(zcache.has(r))return zcache.get(r);{const n=new Ziffers(s,e);return zcache.set(r,n),n}},cachedPattern=(s,e={})=>cachedCall(s,e);class MidiConnection{constructor(){Se(this,"midiAccess",null);Se(this,"midiOutputs",[]);Se(this,"currentOutputIndex",0);Se(this,"scheduledNotes",{});this.initializeMidiAccess()}async initializeMidiAccess(){try{this.midiAccess=await navigator.requestMIDIAccess(),this.midiOutputs=Array.from(this.midiAccess.outputs.values()),this.midiOutputs.length===0&&console.warn("No MIDI outputs available.")}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndexn.name===e);return r!==-1?(this.currentOutputIndex=r,!0):(console.error(`MIDI output "${e}" not found.`),!1)}listMidiOutputs(){console.log("Available MIDI Outputs:"),this.midiOutputs.forEach((e,r)=>{console.log(`${r+1}. ${e.name}`)})}sendMidiNote(e,r,n,o){const a=this.midiOutputs[this.currentOutputIndex];if(e=Math.min(Math.max(e,0),127),a){const l=[144+r,e,n],c=[128+r,e,0];a.send(l);const h=setTimeout(()=>{a.send(c),delete this.scheduledNotes[e]},(o-.02)*1e3);this.scheduledNotes[e]=h}else console.error("MIDI output not available.")}sendSysExMessage(e){const r=this.midiOutputs[this.currentOutputIndex];r?r.send(e):console.error("MIDI output not available.")}sendPitchBend(e,r){(e<0||e>16383)&&console.error("Invalid pitch bend value. Value must be in the range 0-16383."),(r<0||r>15)&&console.error("Invalid MIDI channel. Channel must be in the range 0-15.");const n=this.midiOutputs[this.currentOutputIndex];if(n){const o=e&127,a=e>>7&127;n.send([224|r,o,a])}else console.error("MIDI output not available.")}sendProgramChange(e,r){const n=this.midiOutputs[this.currentOutputIndex];n?n.send([192+r,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,r,n){const o=this.midiOutputs[this.currentOutputIndex];o?o.send([176+n,e,r]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const r in this.scheduledNotes){const n=this.scheduledNotes[r];clearTimeout(n),e.send([128,parseInt(r),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class DrunkWalk{constructor(e,r,n){Se(this,"min");Se(this,"max");Se(this,"wrap");Se(this,"position");this.min=e,this.max=r,this.wrap=n,this.position=0}step(){const e=Math.floor(Math.random()*3)-1;this.position+=e,this.wrap?this.position>this.max?this.position=this.min:this.positionthis.max&&(this.position=this.max)}getPosition(){return this.position}toggleWrap(e){this.wrap=e}}const SCALES={major:[0,2,4,5,7,9,11],naturalMinor:[0,2,3,5,7,8,10],harmonicMinor:[0,2,3,5,7,8,11],melodicMinor:[0,2,3,5,7,9,11],dorian:[0,2,3,5,7,9,10],phrygian:[0,1,3,5,7,8,10],lydian:[0,2,4,6,7,9,11],mixolydian:[0,2,4,5,7,9,10],aeolian:[0,2,3,5,7,8,10],locrian:[0,1,3,5,6,8,10],wholeTone:[0,2,4,6,8,10],majorPentatonic:[0,2,4,7,9],minorPentatonic:[0,3,5,7,10],chromatic:[0,1,2,3,4,5,6,7,8,9,10,11],blues:[0,3,5,6,7,10],diminished:[0,2,3,5,6,8,9,11],neapolitanMinor:[0,1,3,5,7,8,11],neapolitanMajor:[0,1,3,5,7,9,11],enigmatic:[0,1,4,6,8,10,11],doubleHarmonic:[0,1,4,5,7,8,11],octatonic:[0,2,3,5,6,8,9,11],bebopDominant:[0,2,4,5,7,9,10,11],bebopMajor:[0,2,4,5,7,8,9,11],bebopMinor:[0,2,3,5,7,8,9,11],bebopDorian:[0,2,3,4,5,7,9,10],harmonicMajor:[0,2,4,5,7,8,11],hungarianMinor:[0,2,3,6,7,8,11],hungarianMajor:[0,3,4,6,7,9,10],oriental:[0,1,4,5,6,9,10],romanianMinor:[0,2,3,6,7,9,10],spanishGypsy:[0,1,4,5,7,8,10],jewish:[0,1,4,5,7,8,10],hindu:[0,2,4,5,7,8,10],japanese:[0,1,5,7,8],hirajoshi:[0,2,3,7,8],kumoi:[0,2,3,7,9],inSen:[0,1,5,7,10],iwato:[0,1,5,6,10],yo:[0,2,5,7,9],minorBlues:[0,3,5,6,7,10],algerian:[0,2,3,5,6,7,8,11],augmented:[0,3,4,7,8,11],balinese:[0,1,3,7,8],byzantine:[0,1,4,5,7,8,11],chinese:[0,4,6,7,11],egyptian:[0,2,5,7,10],eightToneSpanish:[0,1,3,4,5,6,8,10],hawaiian:[0,2,3,5,7,9,10],hindustan:[0,2,4,5,7,8,10],persian:[0,1,4,5,6,8,11],eastIndianPurvi:[0,1,4,6,7,8,11],orientalA:[0,1,4,5,6,9,10]};function scale(s,e="major",r=4){const n=SCALES[e];if(!n)throw new Error(`Unknown scale ${e}`);let o=s%n.length;o<0&&(o+=n.length);let a=Math.floor(s/n.length);return 60+(r+a)*12+n[o]}let listenerQueue=[],atom=(s,e)=>{let r,n=[],o={lc:0,l:e||0,value:s,set(a){o.value=a,o.notify()},get(){return o.lc||o.listen(()=>{})(),o.value},notify(a){r=n;let l=!listenerQueue.length;for(let c=0;c{n===r&&(n=n.slice());let c=n.indexOf(a);~c&&(n.splice(c,2),o.lc--,o.lc||o.off())}},subscribe(a,l){let c=o.listen(a,l);return a(o.value),c},off(){}};return o},map=(s={})=>{let e=atom(s);return e.setKey=function(r,n){typeof n>"u"?r in e.value&&(e.value={...e.value},delete e.value[r],e.notify(r)):e.value[r]!==n&&(e.value={...e.value,[r]:n},e.notify(r))},e};if(typeof DelayNode<"u"){class s extends DelayNode{constructor(r,n,o,a){super(r),n=Math.abs(n),this.delayTime.value=o;const l=r.createGain();l.gain.value=Math.min(Math.abs(a),.995),this.feedback=l.gain;const c=r.createGain();return c.gain.value=n,this.delayGain=c,this.connect(l),this.connect(c),l.connect(this),this.connect=h=>c.connect(h),this}start(r){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,r+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,r,n){return new s(this,e,r,n)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(s,e=1){const r=this.sampleRate*s,n=this.createBuffer(e,r,this.sampleRate),o=n.getChannelData(0);for(let a=0;a(e.buffer=this.impulseResponse(r),e.duration=s,e),e.setDuration(s),e});var q={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class s extends GainNode{constructor(r,n){if(super(r),!q[n])throw new Error("vowel: unknown vowel "+n);const{gains:o,qs:a,freqs:l}=q[n],c=r.createGain();for(let h=0;h<5;h++){const f=r.createGain();f.gain.value=o[h];const d=r.createBiquadFilter();d.type="bandpass",d.Q.value=a[h],d.frequency.value=l[h],this.connect(d),d.connect(f),f.connect(c)}return c.gain.value=8,this.connect=h=>c.connect(h),this}}AudioContext.prototype.createVowelFilter=function(e){return new s(this,e)}}const ce=s=>{var o;if(typeof s!="string")return[];const[e,r="",n]=((o=s.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/))==null?void 0:o.slice(1))||[];return e?[e,r,n?Number(n):void 0]:[]},re={c:0,d:2,e:4,f:5,g:7,a:9,b:11},ie={"#":1,b:-1,s:1,f:-1},L=(s,e=3)=>{const[r,n,o=e]=ce(s);if(!r)throw new Error('not a note: "'+s+'"');const a=re[r.toLowerCase()],l=(n==null?void 0:n.split("").reduce((c,h)=>c+ie[h],0))||0;return(Number(o)+1)*12+a+l},se=s=>Math.pow(2,(s-69)/12)*440,ae=(s,e,r)=>Math.min(Math.max(s,e),r),ge=s=>12*Math.log(s/440)/Math.LN2+69,de=(s,e)=>{if(typeof s!="object")throw new Error("valueToMidi: expected object value");let{freq:r,note:n}=s;if(typeof r=="number")return ge(r);if(typeof n=="string")return L(n);if(typeof n=="number")return n;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},ue="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFs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swXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function k(s){const e=C().createGain();return e.gain.value=s,e}const Ie=({s,freq:e,t:r})=>{const n=C().createOscillator();return n.type=s||"triangle",n.frequency.value=Number(e),n.start(r),{node:n,stop:o=>n.stop(o)}},ee=(s,e,r,n,o,a)=>{const l=C().createGain();return l.gain.setValueAtTime(0,a),l.gain.linearRampToValueAtTime(o,a+s),l.gain.linearRampToValueAtTime(r*o,a+s+e),{node:l,stop:c=>{l.gain.setValueAtTime(r*o,c),l.gain.linearRampToValueAtTime(0,c+n)}}},Q=(s,e,r)=>{const n=C().createBiquadFilter();return n.type=s,n.frequency.value=e,n.Q.value=r,n},E=map();function te(s,e,r={}){E.setKey(s,{onTrigger:e,data:r})}function U(s){return E.get()[s]}let J;const C=()=>(J||(J=new AudioContext),J);let W;const j=()=>{const s=C();return W||(W=s.createGain(),W.connect(s.destination)),W};let D;function le(){return D||(D=C().audioWorklet.addModule(ue),D)}function x(s,e,r){const n=new AudioWorkletNode(s,e);return Object.entries(r).forEach(([o,a])=>{n.parameters.get(o).value=a}),n}async function Ce(s={}){const{disableWorklets:e=!1}=s;typeof window<"u"&&(await C().resume(),e?console.log("disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!"):await le().catch(r=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",r)}))}async function ve(s){return new Promise(e=>{document.addEventListener("click",async function r(){await Ce(s),e(),document.removeEventListener("click",r)})})}let G={};function fe(s,e,r,n){var o;if(r=ae(r,0,.98),!G[s]){const a=C().createFeedbackDelay(1,e,r);(o=a.start)==null||o.call(a,n),a.connect(j()),G[s]=a}return G[s].delayTime.value!==e&&G[s].delayTime.setValueAtTime(e,n),G[s].feedback.value!==r&&G[s].feedback.setValueAtTime(r,n),G[s]}let w={};function Ae(s,e=2){if(!w[s]){const r=C().createReverb(e);r.connect(j()),w[s]=r}return w[s].duration!==e&&(w[s]=w[s].setDuration(e),w[s].duration=e),w[s]}function _(s,e,r){const n=k(r);return s.connect(n),n.connect(e),n}const he=async(s,e,r)=>{const n=C();if(typeof s!="object")throw new Error(`expected hap.value to be an object, but got "${s}". Hint: append .note() or .s() to the end`,"error");let o=n.currentTime+e,{s:a="triangle",bank:l,source:c,gain:h=.8,cutoff:f,resonance:d=1,hcutoff:m,hresonance:v=1,bandf:A,bandq:T=1,coarse:B,crush:Y,shape:F,pan:ke,vowel:Qe,delay:xe=0,delayfeedback:Te=.5,delaytime:Le=.25,orbit:Me=1,room:ot,size:Fe=2,velocity:Ve=1}=s;h*=Ve;let at=[];const dt=()=>{at.forEach(lt=>lt==null?void 0:lt.disconnect())};l&&a&&(a=`${l}_${a}`);let ct;if(c)ct=c(o,s,r);else if(U(a)){const{onTrigger:lt}=U(a),st=await lt(o,s,dt);st&&(ct=st.node,st.stop(o+r))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!ct||n.currentTime>o)return;const nt=[];if(nt.push(ct),nt.push(k(h)),f!==void 0&&nt.push(Q("lowpass",f,d)),m!==void 0&&nt.push(Q("highpass",m,v)),A!==void 0&&nt.push(Q("bandpass",A,T)),Qe!==void 0&&nt.push(n.createVowelFilter(Qe)),B!==void 0&&nt.push(x(n,"coarse-processor",{coarse:B})),Y!==void 0&&nt.push(x(n,"crush-processor",{crush:Y})),F!==void 0&&nt.push(x(n,"shape-processor",{shape:F})),ke!==void 0){const lt=n.createStereoPanner();lt.pan.value=2*ke-1,nt.push(lt)}const ft=k(1);nt.push(ft),ft.connect(j());let it;if(xe>0&&Le>0&&Te>0){const lt=fe(Me,Le,Te,o);it=_(ft,lt,xe)}let pt;if(ot>0&&Fe>0){const lt=Ae(Me,Fe);pt=_(ft,lt,ot)}nt.slice(1).reduce((lt,st)=>lt.connect(st),nt[0]),at=nt.concat([it,pt])},O={};function pe(s,e){var r=e?1e3:1024;if(s=r);return s.toFixed(1)+" "+n[o]}const be=async(s,e,r,n,o,a,l)=>{let c=0,h=de({freq:o,note:r},36);c=h-36;const f=C();let d;if(Array.isArray(a))d=a[e%a.length];else{const T=Y=>L(Y)-h,B=Object.keys(a).filter(Y=>!Y.startsWith("_")).reduce((Y,F,ke)=>!Y||Math.abs(T(F))(O[s]||(O[s]=fetch(s).then(o=>o.arrayBuffer()).then(async o=>(pe(o.byteLength),await e.decodeAudioData(o)))),O[s]);function ye(s){const e=C(),r=e.createBuffer(s.numberOfChannels,s.length,e.sampleRate);for(let n=0;nObject.entries(s).forEach(([n,o])=>{if(typeof o=="string"&&(o=[o]),typeof o!="object")throw new Error("wrong sample map format for "+n);r=o._base||r;const a=l=>(r+l).replace("github:","https://raw.githubusercontent.com/");Array.isArray(o)?o=o.map(a):o=Object.fromEntries(Object.entries(o).map(([l,c])=>[l,(typeof c=="string"?[c]:c).map(a)])),e(n,o)});let ne={};function Ge(s){const e=Object.entries(ne).find(([r])=>s.startsWith(r));if(e)return e[1]}const we=async(s,e=s._base||"",r={})=>{if(typeof s=="string"){const a=Ge(s);if(a)return a(s);if(s.startsWith("github:")){let[c,h]=s.split("github:");h=h.endsWith("/")?h.slice(0,-1):h,s=`https://raw.githubusercontent.com/${h}/strudel.json`}if(typeof fetch!="function")return;const l=s.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(s).then(c=>c.json()).then(c=>we(c,e||c._base||l,r)).catch(c=>{throw console.error(c),new Error(`error loading "${s}"`)})}const{prebake:n,tag:o}=r;me(s,(a,l)=>te(a,(c,h,f)=>Xe(c,h,f,l),{type:"sample",samples:l,baseUrl:e,prebake:n,tag:o}),e)},$=[];async function Xe(s,e,r,n,o){const{s:a,freq:l,unit:c,nudge:h=0,cut:f,loop:d,clip:m=void 0,n:v=0,note:A,speed:T=1,begin:B=0,end:Y=1}=e;if(T===0)return;const F=C(),{attack:ke=.001,decay:Qe=.001,sustain:xe=1,release:Te=.001}=e,Le=s+h,Me=await be(a,v,A,T,l,n,o);if(F.currentTime>s||!Me)return;Me.playbackRate.value=Math.abs(T)*Me.playbackRate.value,c==="c"&&(Me.playbackRate.value=Me.playbackRate.value*Me.buffer.duration*1);const ot=B*Me.buffer.duration;Me.start(Le,ot);const Fe=Me.buffer.duration/Me.playbackRate.value,{node:Ve,stop:at}=ee(ke,Qe,xe,Te,1,s);Me.connect(Ve);const dt=F.createGain();Ve.connect(dt),Me.onended=function(){Me.disconnect(),Ve.disconnect(),dt.disconnect(),r()};const ct={node:dt,bufferSource:Me,stop:(nt,ft=m===void 0)=>{let it=nt;ft&&(it=s+(Y-B)*Fe),Me.stop(it+Te),at(it)}};if(f!==void 0){const nt=$[f];nt&&(nt.node.gain.setValueAtTime(1,Le),nt.node.gain.linearRampToValueAtTime(0,Le+.01)),$[f]=ct}return ct}function Ke(){["sine","square","triangle","sawtooth"].forEach(s=>{te(s,(e,r,n)=>{const{attack:o=.001,decay:a=.05,sustain:l=.6,release:c=.01}=r;let{n:h,note:f,freq:d}=r;h=f||h||36,typeof h=="string"&&(h=L(h)),!d&&typeof h=="number"&&(d=se(h));const{node:m,stop:v}=Ie({t:e,s,freq:d}),A=k(.3),{node:T,stop:B}=ee(o,a,l,c,1,e);return m.onended=()=>{m.disconnect(),A.disconnect(),n()},{node:m.connect(A).connect(T),stop:Y=>{B(Y),v(Y+c)}}},{type:"synth",prebake:!0})})}const cache=new LRUCache({max:1e3,ttl:1e3*60*5});Array.prototype.in=function(s){return this.includes(s)};Promise.all([ve(),we("github:tidalcycles/Dirt-Samples/master"),we("github:Bubobubobubobubo/Topos-Samples/main"),Ke()]);class UserAPI{constructor(e){Se(this,"variables",{});Se(this,"iterators",{});Se(this,"_drunk",new DrunkWalk(-100,100,!1));Se(this,"MidiConnection",new MidiConnection);Se(this,"load");Se(this,"s",this.script);Se(this,"cs",this.clear_script);Se(this,"cps",this.copy_script);Se(this,"$",this.iterator);Se(this,"v",this.variable);Se(this,"dv",this.delete_variable);Se(this,"cv",this.clear_variables);Se(this,"rI",this.randI);Se(this,"r",this.rand);Se(this,"quant",this.quantize);Se(this,"cmp",this.clamp);Se(this,"tempo",this.bpm);Se(this,"silence",this.stop);Se(this,"hush",this.stop);Se(this,"abs",Math.abs);Se(this,"sound",async(e,r=0)=>{he(e,r)});Se(this,"d",this.sound);Se(this,"samples",we);Se(this,"log",console.log);Se(this,"scale",scale);this.app=e,this.load=we("github:tidalcycles/Dirt-Samples/master")}get time(){return this.app.audioContext.currentTime}get mouseX(){return this.app._mouseX}get mouseY(){return this.app._mouseY}script(...e){e.forEach(r=>{tryEvaluate(this.app,this.app.universes[this.app.selected_universe].locals[r])})}clear_script(e){this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}}copy_script(e,r){this.app.universes[this.app.selected_universe].locals[r]=this.app.universes[this.app.selected_universe].locals[e]}midi_outputs(){return console.log(this.MidiConnection.listMidiOutputs()),this.MidiConnection.midiOutputs}midi_output(e){e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())}note(e,r={}){const n=r.channel?r.channel:0,o=r.velocity?r.velocity:100,a=r.duration?r.duration:.5;this.MidiConnection.sendMidiNote(e,n,o,a)}sysex(e){this.MidiConnection.sendSysExMessage(e)}pitch_bend(e,r){this.MidiConnection.sendPitchBend(e,r)}program_change(e,r){this.MidiConnection.sendProgramChange(e,r)}midi_clock(){this.MidiConnection.sendMidiClock()}control_change({control:e=20,value:r=0,channel:n=0}){this.MidiConnection.sendMidiControlChange(e,r,n)}midi_panic(){this.MidiConnection.panic()}zn(e,r={}){const n=cachedPattern(e,r);if(n.hasStarted()){const o=n.peek(),a=o.modifiedEvent?o.modifiedEvent:o,l=r.channel?r.channel:0,c=r.velocity?r.velocity:100,h=r.sustain?r.sustain:.5;a instanceof Pitch?(a.bend&&this.MidiConnection.sendPitchBend(a.bend,l),this.MidiConnection.sendMidiNote(a.note,l,c,h),a.bend&&this.MidiConnection.sendPitchBend(8192,l)):a instanceof Chord&&a.pitches.forEach(f=>{f.bend&&this.MidiConnection.sendPitchBend(f.bend,l),this.MidiConnection.sendMidiNote(f.note,l,c,h),f.bend&&this.MidiConnection.sendPitchBend(8192,l)}),o.modifiedEvent&&(o.modifiedEvent=void 0)}return n.next()}iterator(e,r,n){return e in this.iterators?(this.iterators[e].limit!==r&&(this.iterators[e].value=0,this.iterators[e].limit=r),this.iterators[e].step!==n&&(this.iterators[e].step=n??this.iterators[e].step),this.iterators[e].value+=this.iterators[e].step,this.iterators[e].limit!==void 0&&this.iterators[e].value>this.iterators[e].limit&&(this.iterators[e].value=0)):this.iterators[e]={value:0,step:n??1,limit:r},this.iterators[e].value}get drunk(){return this._drunk.step(),this._drunk.getPosition()}set drunk(e){this._drunk.position=e}set drunk_max(e){this._drunk.max=e}set drunk_min(e){this._drunk.min=e}set drunk_wrap(e){this._drunk.toggleWrap(e)}variable(e,r){return typeof e=="string"&&r===void 0?this.variables[e]:(this.variables[e]=r,this.variables[e])}delete_variable(e){delete this.variables[e]}clear_variables(){this.variables={}}_sequence_key_generator(e){return btoa(JSON.stringify(e))}seqmod(...e){if(cache.has(this._sequence_key_generator(e))){let r=cache.get(this._sequence_key_generator(e));return r.options.currentIteration++,r.options.currentIteration===r.options.nextTarget&&(r.options.index++,r.options.nextTarget=e[r.options.index%e.length],r.options.currentIteration=0),cache.set(this._sequence_key_generator(e),{pattern:e,options:r.options}),r.options.currentIteration===0}else{let r={index:-1,nextTarget:this.app.clock.ticks_before_new_bar,currentIteration:0};return typeof e[e.length-1]=="object"&&(r={...e.pop(),...r}),r.nextTarget=this.app.clock.ticks_before_new_bar,r.currentIteration===r.nextTarget&&(r.index++,r.nextTarget=e[r.index%e.length],r.currentIteration=0),cache.set(this._sequence_key_generator(e),{pattern:e,options:r}),r.currentIteration===0}}seq(...e){if(cache.has(this._sequence_key_generator(e))){let r=cache.get(this._sequence_key_generator(e));return r.options.index+=1,cache.set(this._sequence_key_generator(e),r),r.pattern[r.options.index%r.pattern.length]}else{let r={index:0};return typeof e[e.length-1]=="object"&&(r={...e.pop(),...r}),cache.set(this._sequence_key_generator(e),{pattern:e,options:r}),cache.get(this._sequence_key_generator(e))}}pick(...e){return e[Math.floor(Math.random()*e.length)]}seqbeat(...e){return e[this.ebeat%e.length]}mel(e,r){return r[e%r.length]}seqbar(...e){return e[(this.app.clock.time_position.bar+1)%e.length]}seqpulse(...e){return e[this.app.clock.time_position.pulse%e.length]}randI(e,r){return Math.floor(Math.random()*(r-e+1))+e}rand(e,r){return Math.random()*(r-e)+e}quantize(e,r){if(r.length===0)return e;let n=r[0];return r.forEach(o=>{Math.abs(o-e)500)&&console.log(`Setting bpm to ${e}`),this.app.clock.bpm=e,e)}bpb(e){return e===void 0?this.app.clock.time_signature[0]:(e<1&&console.log(`Setting bpb to ${e}`),this.app.clock.time_signature[0]=e,e)}ppqn(e){return e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e)}time_signature(e,r){this.app.clock.time_signature=[e,r]}almostNever(){return Math.random()>.9}sometimes(){return Math.random()>.5}rarely(){return Math.random()>.75}often(){return Math.random()>.25}almostAlways(){return Math.random()>.1}dice(e){return Math.floor(Math.random()*e)+1}get i(){return this.app.universes[this.app.selected_universe].global.evaluations}set i(e){this.app.universes[this.app.selected_universe].global.evaluations=e}get bar(){return this.app.clock.time_position.bar}get tick(){return this.app.clock.tick}get pulse(){return this.app.clock.time_position.pulse}get beat(){return this.app.clock.time_position.beat}get ebeat(){return this.app.clock.beats_since_origin}get epulse(){return this.app.clock.pulses_since_origin}onbar(e,...r){const n=[...Array(e).keys()].map(o=>o+1);return console.log(r.some(o=>n.includes(o%e))),r.some(o=>n.includes(o%e))}onbeat(...e){let r=[];return e.forEach(n=>{n=n%this.app.clock.time_signature[0]+1;let o=Math.floor(n),a=n-o;r.push(o===this.app.clock.time_position.beat&&this.app.clock.time_position.pulse===a*this.app.clock.ppqn)}),r.some(n=>n==!0)}stop(){this.app.clock.pause(),this.app.setButtonHighlighting("pause",!0)}prob(e){return Math.random()*100.5}min(...e){return Math.min(...e)}max(...e){return Math.max(...e)}limit(e,r,n){return Math.min(Math.max(e,r),n)}delay(e,r){setTimeout(r,e)}delayr(e,r,n){[...Array(r).keys()].map(a=>e*a).forEach((a,l)=>{setTimeout(n,a)})}mod(...e){return e.some(r=>this.app.clock.time_position.pulse%r===0)}modbar(...e){return e.some(r=>this.app.clock.time_position.bar%r===0)}euclid(e,r,n,o=0){return this._euclidean_cycle(r,n,o)[e%n]}_euclidean_cycle(e,r,n=0){function o(c,h){const f=c.length,d=(h+1)%f;return c[h]>c[d]}if(e>=r)return[!0];const a=Array.from({length:r},(c,h)=>(e*(h-1)%r+r)%r);let l=a.map((c,h)=>o(a,h));return n!=0&&(l=l.slice(n).concat(l.slice(0,n))),l}bin(e,r){let o=r.toString(2).split("").map(a=>a==="1");return o[e%o.length]}gold(){}line(e,r,n=1){const o=[];if(r>e&&n>0||r0?1:-1}noise(){return Math.random()*2-1}rate(e){}}class Editor{constructor(){Se(this,"universes",template_universes);Se(this,"selected_universe");Se(this,"local_index",1);Se(this,"editor_mode","local");Se(this,"fontSize");Se(this,"withLineNumbers");Se(this,"vimModeCompartment");Se(this,"chosenLanguage");Se(this,"settings",new AppSettings);Se(this,"editorExtensions",[]);Se(this,"userPlugins",[]);Se(this,"state");Se(this,"api");Se(this,"audioContext");Se(this,"view");Se(this,"clock");Se(this,"manualPlay",!1);Se(this,"_mouseX",0);Se(this,"_mouseY",0);Se(this,"play_buttons",[document.getElementById("play-button-1"),document.getElementById("play-button-2")]);Se(this,"pause_buttons",[document.getElementById("pause-button-1"),document.getElementById("pause-button-2")]);Se(this,"stop_buttons",[document.getElementById("stop-button-1"),document.getElementById("stop-button-2")]);Se(this,"clear_buttons",[document.getElementById("clear-button-1"),document.getElementById("clear-button-2")]);Se(this,"local_button",document.getElementById("local-button"));Se(this,"global_button",document.getElementById("global-button"));Se(this,"init_button",document.getElementById("init-button"));Se(this,"note_button",document.getElementById("note-button"));Se(this,"settings_button",document.getElementById("settings-button"));Se(this,"close_settings_button",document.getElementById("close-settings-button"));Se(this,"universe_viewer",document.getElementById("universe-viewer"));Se(this,"buffer_modal",document.getElementById("modal-buffers"));Se(this,"buffer_search",document.getElementById("buffer-search"));Se(this,"local_script_tabs",document.getElementById("local-script-tabs"));Se(this,"font_size_slider",document.getElementById("font-size-slider"));Se(this,"font_size_witness",document.getElementById("font-size-witness"));Se(this,"line_numbers_checkbox",document.getElementById("show-line-numbers"));Se(this,"normal_mode_button",document.getElementById("normal-mode"));Se(this,"vim_mode_button",document.getElementById("vim-mode"));this.selected_universe=this.settings.selected_universe,this.universe_viewer.innerHTML=`Topos: ${this.selected_universe}`,this.universes={...template_universes,...this.settings.universes},this.audioContext=new AudioContext({latencyHint:"playback"}),this.clock=new Clock(this,this.audioContext),this.api=new UserAPI(this),this.vimModeCompartment=new Compartment,this.withLineNumbers=new Compartment,this.chosenLanguage=new Compartment,this.fontSize=new Compartment;const e=this.settings.vimMode?vim():[],r=this.settings.line_numbers?lineNumbers():[],n=EditorView.theme({"&":{fontSize:`${this.settings.font_size}px`},".cm-gutters":{fontSize:`${this.settings.font_size}px`}});this.editorExtensions=[this.withLineNumbers.of(r),this.fontSize.of(n),this.vimModeCompartment.of(e),editorSetup,oneDark,this.chosenLanguage.of(javascript()),EditorView.updateListener.of(l=>{})];let o=new Compartment;this.state=EditorState.create({extensions:[...this.editorExtensions,EditorView.lineWrapping,o.of(this.userPlugins)],doc:this.universes[this.selected_universe].locals[this.local_index].candidate}),this.view=new EditorView({parent:document.getElementById("editor"),state:this.state}),document.addEventListener("keydown",l=>{l.key==="Tab"&&l.preventDefault(),l.ctrlKey&&l.key==="s"&&(l.preventDefault(),this.setButtonHighlighting("pause",!0),this.clock.pause()),l.ctrlKey&&l.key==="r"&&(l.preventDefault(),this.setButtonHighlighting("stop",!0),this.clock.stop()),l.ctrlKey&&l.key==="p"&&(l.preventDefault(),this.setButtonHighlighting("play",!0),this.clock.start()),(l.key==="v"||l.key==="V")&&l.ctrlKey&&l.shiftKey&&(this.settings.vimMode=!this.settings.vimMode,l.preventDefault(),this.userPlugins=this.settings.vimMode?[]:[vim()],this.view.dispatch({effects:o.reconfigure(this.userPlugins)})),(l.key==="Enter"||l.key==="Return")&&l.ctrlKey&&(l.preventDefault(),this.currentFile().candidate=this.view.state.doc.toString(),this.flashBackground("#2d313d",200)),(l.key==="Enter"&&l.shiftKey||l.key==="e"&&l.ctrlKey)&&(l.preventDefault(),this.currentFile().candidate=this.view.state.doc.toString(),this.flashBackground("#2d313d",200)),l.ctrlKey&&l.key==="b"&&this.openBuffersModal(),l.shiftKey&&l.key==="Escape"&&this.openSettingsModal(),l.ctrlKey&&l.key==="l"&&(l.preventDefault(),this.changeModeFromInterface("local"),this.view.focus()),l.ctrlKey&&l.key==="n"&&(l.preventDefault(),this.changeModeFromInterface("notes"),this.view.focus()),l.ctrlKey&&l.key==="g"&&(l.preventDefault(),this.changeModeFromInterface("global"),this.view.focus()),l.ctrlKey&&l.key==="i"&&(l.preventDefault(),this.changeModeFromInterface("init"),this.changeToLocalBuffer(0),this.view.focus()),[112,113,114,115,116,117,118,119,120].forEach((c,h)=>{l.keyCode===c&&(l.preventDefault(),l.ctrlKey?this.api.script(c-111):(this.changeModeFromInterface("local"),this.changeToLocalBuffer(h)))}),l.keyCode==121&&this.changeModeFromInterface("global"),l.keyCode==122&&this.changeModeFromInterface("init")});const a=document.querySelectorAll('[id^="tab-"]');for(let l=0;l{a[l].classList.add("bg-orange-300");for(let d=0;d{l.addEventListener("click",()=>{this.setButtonHighlighting("play",!0),this.clock.start()})}),this.clear_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("clear",!0),confirm("Do you want to reset the current universe?")&&(this.universes[this.selected_universe]=template_universe,this.updateEditorView())})}),this.pause_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("pause",!0),this.clock.pause()})}),this.stop_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("stop",!0),this.clock.stop()})}),this.local_button.addEventListener("click",()=>this.changeModeFromInterface("local")),this.global_button.addEventListener("click",()=>this.changeModeFromInterface("global")),this.init_button.addEventListener("click",()=>this.changeModeFromInterface("init")),this.note_button.addEventListener("click",()=>this.changeModeFromInterface("notes")),this.settings_button.addEventListener("click",()=>{var h;this.font_size_slider.value=this.settings.font_size.toString(),this.font_size_witness.innerHTML=`Font Size: ${this.settings.font_size}px`,(h=this.font_size_witness)==null||h.setAttribute("style",`font-size: ${this.settings.font_size}px;`),this.line_numbers_checkbox.checked=this.settings.line_numbers;let l=document.getElementById("modal-settings"),c=document.getElementById("editor");l==null||l.classList.remove("invisible"),c==null||c.classList.add("invisible")}),this.close_settings_button.addEventListener("click",()=>{let l=document.getElementById("modal-settings"),c=document.getElementById("editor");l==null||l.classList.add("invisible"),c==null||c.classList.remove("invisible")}),this.font_size_slider.addEventListener("input",()=>{const l=this.font_size_slider.value;this.settings.font_size=parseInt(l),this.font_size_witness.style.fontSize=`${l}px`,this.font_size_witness.innerHTML=`Font Size: ${l}px`;let c=EditorView.theme({"&":{fontSize:l+"px"},".cm-gutters":{fontSize:l+"px"}});this.view.dispatch({effects:this.fontSize.reconfigure(c)}),this.settings.font_size=parseInt(l)}),this.normal_mode_button.addEventListener("click",()=>{this.settings.vimMode=!1,this.view.dispatch({effects:this.vimModeCompartment.reconfigure([])})}),this.line_numbers_checkbox.addEventListener("change",()=>{let l=!!this.line_numbers_checkbox.checked;this.settings.line_numbers=l,this.view.dispatch({effects:this.withLineNumbers.reconfigure(l?[lineNumbers()]:[])})}),this.vim_mode_button.addEventListener("click",()=>{this.settings.vimMode=!0,this.view.dispatch({effects:this.vimModeCompartment.reconfigure(vim())})}),this.buffer_search.addEventListener("keydown",l=>{if(l.key==="Enter"){let c=this.buffer_search.value;c.length>2&&c.length<20&&(this.loadUniverse(c),this.settings.selected_universe=c,this.buffer_search.value="",this.closeBuffersModal(),this.view.focus())}}),tryEvaluate(this,this.universes[this.selected_universe.toString()].init)}get note_buffer(){return this.universes[this.selected_universe.toString()].notes}get global_buffer(){return this.universes[this.selected_universe.toString()].global}get init_buffer(){return this.universes[this.selected_universe.toString()].init}get local_buffer(){return this.universes[this.selected_universe.toString()].locals[this.local_index]}changeToLocalBuffer(e){const r=document.querySelectorAll('[id^="tab-"]'),n=r[e];n.classList.add("bg-orange-300");for(let a=0;a{r.forEach(a=>{let l=a.children[0];l.classList.contains("text-orange-300")&&(l.classList.remove("text-orange-300"),a.classList.remove("text-orange-300"))}),o.children[0].classList.remove("text-white"),o.children[0].classList.add("text-orange-300"),o.classList.add("text-orange-300")};switch(e){case"local":this.local_script_tabs.classList.contains("hidden")&&this.local_script_tabs.classList.remove("hidden"),this.editor_mode="local",this.local_index=0,this.changeToLocalBuffer(this.local_index),n(this.local_button);break;case"global":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="global",n(this.global_button);break;case"init":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="init",n(this.init_button);break;case"notes":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="notes",n(this.note_button);break}this.view.dispatch({effects:this.chosenLanguage.reconfigure(this.editor_mode=="notes"?[markdown()]:[javascript()])}),this.updateEditorView()}setButtonHighlighting(e,r){this.flashBackground("#2d313d",200);const n=['[id^="play-button-"]','[id^="pause-button-"]','[id^="clear-button-"]','[id^="stop-button-"]'];let o;switch(e){case"play":o=0;break;case"pause":o=1;break;case"clear":o=2;break;case"stop":o=3;break}document.querySelectorAll(n[o]).forEach(a=>{r&&a.children[0].classList.add("fill-orange-300")}),document.querySelectorAll(n.filter((a,l)=>l!=o).join(",")).forEach(a=>{a.children[0].classList.remove("fill-orange-300"),a.children[0].classList.remove("text-orange-300"),a.children[0].classList.remove("bg-orange-300")})}unfocusPlayButtons(){document.querySelectorAll('[id^="play-button-"]').forEach(e=>{e.children[0].classList.remove("fill-orange-300")})}updateEditorView(){this.view.dispatch({changes:{from:0,to:this.view.state.doc.toString().length,insert:this.currentFile().candidate}})}currentFile(){switch(this.editor_mode){case"global":return this.global_buffer;case"local":return this.local_buffer;case"init":return this.init_buffer;case"notes":return this.note_buffer}}loadUniverse(e){this.currentFile().candidate=this.view.state.doc.toString();let r=e.trim();this.universes[r]===void 0&&(this.universes[r]=template_universe),this.selected_universe=r,this.settings.selected_universe=this.selected_universe,this.universe_viewer.innerHTML=`Topos: ${r}`,this.updateEditorView(),tryEvaluate(this,this.universes[this.selected_universe.toString()].init)}openSettingsModal(){document.getElementById("modal-settings").classList.contains("invisible")?(document.getElementById("editor").classList.add("invisible"),document.getElementById("modal-settings").classList.remove("invisible")):this.closeSettingsModal()}closeSettingsModal(){document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal-settings").classList.add("invisible")}openBuffersModal(){document.getElementById("modal-buffers").classList.contains("invisible")?(document.getElementById("editor").classList.add("invisible"),document.getElementById("modal-buffers").classList.remove("invisible"),document.getElementById("buffer-search").focus()):this.closeBuffersModal()}closeBuffersModal(){document.getElementById("buffer-search").value="",document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal").classList.add("invisible"),document.getElementById("modal-buffers").classList.add("invisible")}flashBackground(e,r){this.view.dom.style.backgroundColor=e;const n=this.view.dom.getElementsByClassName("cm-gutter");Array.from(n).forEach(o=>o.style.backgroundColor=e),setTimeout(()=>{this.view.dom.style.backgroundColor="",Array.from(n).forEach(o=>o.style.backgroundColor="")},r)}}const app=new Editor;function startClock(){document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal").classList.add("hidden"),document.getElementById("modal-container").classList.remove("motion-safe:animate-pulse"),document.getElementById("start-button").removeEventListener("click",startClock),document.removeEventListener("click",startClock),document.removeEventListener("keydown",startOnEnter),document.removeEventListener("click",startOnClick),app.clock.start(),app.view.focus(),app.setButtonHighlighting("play",!0)}function startOnEnter(s){(s.code==="Enter"||s.code==="Space")&&startClock()}function startOnClick(s){s.button===0&&startClock()}document.addEventListener("keydown",startOnEnter);document.addEventListener("click",startOnClick);function reportMouseCoordinates(s){app._mouseX=s.clientX,app._mouseY=s.clientY}window.addEventListener("mousemove",reportMouseCoordinates);window.addEventListener("beforeunload",()=>(event.preventDefault(),app.currentFile().candidate=app.view.state.doc.toString(),app.currentFile().committed=app.view.state.doc.toString(),app.settings.saveApplicationToLocalStorage(app.universes,app.settings),app.clock.stop(),null)); +`],!1,!1),peg$e1=peg$literalExpectation("(",!1),peg$e2=peg$literalExpectation(",",!1),peg$e3=peg$literalExpectation(")",!1),peg$e4=peg$classExpectation([["0","9"]],!1,!1),peg$e5=peg$literalExpectation(".",!1),peg$e6=peg$literalExpectation("-",!1),peg$e7=peg$literalExpectation("/",!1),peg$e8=peg$literalExpectation("\\",!1),peg$e9=peg$literalExpectation("<",!1),peg$e10=peg$literalExpectation(">",!1),peg$e11=peg$literalExpectation("[",!1),peg$e12=peg$literalExpectation("+",!1),peg$e13=peg$literalExpectation("*",!1),peg$e14=peg$literalExpectation("%",!1),peg$e15=peg$literalExpectation("&",!1),peg$e16=peg$literalExpectation("|",!1),peg$e17=peg$literalExpectation("<<",!1),peg$e18=peg$literalExpectation(">>",!1),peg$f0=function(s){return centsToSemitones(s.filter(e=>e))},peg$f1=function(){},peg$f2=function(s,e){return Math.floor(Math.random()*(e-s+1)+s)},peg$f3=function(s,e){return Math.random()*(e-s)+s},peg$f4=function(){return parseFloat(text())},peg$f5=function(){return parseInt(text())},peg$f6=function(s){return ratioToCents(s)},peg$f7=function(s,e){return s/e},peg$f8=function(s,e){return Math.pow(2,s/e)},peg$f9=function(s,e,r,n){var o=n?r/n:r;return Math.pow(o,s/e)},peg$f10=function(s,e){return parseFloat(s.toString()+"."+e.toString())},peg$f11=function(s){return s.filter(e=>e)},peg$f12=function(s){return monzoToCents(s)},peg$f13=function(){return eval(text())},peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$resultsCache={},peg$result;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error(`Can't start parsing from rule "`+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}function text(){return input.substring(peg$savedPos,peg$currPos)}function peg$literalExpectation(s,e){return{type:"literal",text:s,ignoreCase:e}}function peg$classExpectation(s,e,r){return{type:"class",parts:s,inverted:e,ignoreCase:r}}function peg$endExpectation(){return{type:"end"}}function peg$computePosDetails(s){var e=peg$posDetailsCache[s],r;if(e)return e;for(r=s-1;!peg$posDetailsCache[r];)r--;for(e=peg$posDetailsCache[r],e={line:e.line,column:e.column};rpeg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(s))}function peg$buildStructuredError(s,e,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(s,e),s,e,r)}function peg$parselines(){var s,e,r,n=peg$currPos*17+0,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,e=[],r=peg$parseratio(),r===peg$FAILED&&(r=peg$parsevalue(),r===peg$FAILED&&(r=peg$parsemonzo(),r===peg$FAILED&&(r=peg$parseoperation(),r===peg$FAILED&&(r=peg$parsesep())))),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),r=peg$parseratio(),r===peg$FAILED&&(r=peg$parsevalue(),r===peg$FAILED&&(r=peg$parsemonzo(),r===peg$FAILED&&(r=peg$parseoperation(),r===peg$FAILED&&(r=peg$parsesep()))));else e=peg$FAILED;return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f0(e)),s=e,peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parsesep(){var s,e,r=peg$currPos*17+1,n=peg$resultsCache[r];return n?(peg$currPos=n.nextPos,n.result):(s=peg$currPos,peg$r0.test(input.charAt(peg$currPos))?(e=input.charAt(peg$currPos),peg$currPos++):(e=peg$FAILED,peg$fail(peg$e0)),e!==peg$FAILED&&(peg$savedPos=s,e=peg$f1()),s=e,peg$resultsCache[r]={nextPos:peg$currPos,result:s},s)}function peg$parsevalue(){var s,e=peg$currPos*17+2,r=peg$resultsCache[e];return r?(peg$currPos=r.nextPos,r.result):(s=peg$parsefloat(),s===peg$FAILED&&(s=peg$parseint(),s===peg$FAILED&&(s=peg$parserandom_int(),s===peg$FAILED&&(s=peg$parserandom_float()))),peg$resultsCache[e]={nextPos:peg$currPos,result:s},s)}function peg$parserandom_int(){var s,e,r,n,o,a,l=peg$currPos*17+3,c=peg$resultsCache[l];return c?(peg$currPos=c.nextPos,c.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parseint(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(n=peg$c1,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e2)),n!==peg$FAILED?(o=peg$parseint(),o!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(a=peg$c2,peg$currPos++):(a=peg$FAILED,peg$fail(peg$e3)),a!==peg$FAILED?(peg$savedPos=s,s=peg$f2(r,o)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[l]={nextPos:peg$currPos,result:s},s)}function peg$parserandom_float(){var s,e,r,n,o,a,l=peg$currPos*17+4,c=peg$resultsCache[l];return c?(peg$currPos=c.nextPos,c.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parsefloat(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(n=peg$c1,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e2)),n!==peg$FAILED?(o=peg$parsefloat(),o!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(a=peg$c2,peg$currPos++):(a=peg$FAILED,peg$fail(peg$e3)),a!==peg$FAILED?(peg$savedPos=s,s=peg$f3(r,o)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[l]={nextPos:peg$currPos,result:s},s)}function peg$parsefloat(){var s,e,r,n,o,a,l,c=peg$currPos*17+5,h=peg$resultsCache[c];if(h)return peg$currPos=h.nextPos,h.result;if(s=peg$currPos,e=peg$currPos,r=[],peg$r1.test(input.charAt(peg$currPos))?(n=input.charAt(peg$currPos),peg$currPos++):(n=peg$FAILED,peg$fail(peg$e4)),n!==peg$FAILED)for(;n!==peg$FAILED;)r.push(n),peg$r1.test(input.charAt(peg$currPos))?(n=input.charAt(peg$currPos),peg$currPos++):(n=peg$FAILED,peg$fail(peg$e4));else r=peg$FAILED;if(r!==peg$FAILED?(input.charCodeAt(peg$currPos)===46?(n=peg$c3,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e5)),n!==peg$FAILED?(r=[r,n],e=r):(peg$currPos=e,e=peg$FAILED)):(peg$currPos=e,e=peg$FAILED),e===peg$FAILED){for(e=peg$currPos,input.charCodeAt(peg$currPos)===45?(r=peg$c4,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e6)),r===peg$FAILED&&(r=null),n=[],peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));o!==peg$FAILED;)n.push(o),peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));if(input.charCodeAt(peg$currPos)===46?(o=peg$c3,peg$currPos++):(o=peg$FAILED,peg$fail(peg$e5)),o!==peg$FAILED){if(a=[],peg$r1.test(input.charAt(peg$currPos))?(l=input.charAt(peg$currPos),peg$currPos++):(l=peg$FAILED,peg$fail(peg$e4)),l!==peg$FAILED)for(;l!==peg$FAILED;)a.push(l),peg$r1.test(input.charAt(peg$currPos))?(l=input.charAt(peg$currPos),peg$currPos++):(l=peg$FAILED,peg$fail(peg$e4));else a=peg$FAILED;a!==peg$FAILED?(r=[r,n,o,a],e=r):(peg$currPos=e,e=peg$FAILED)}else peg$currPos=e,e=peg$FAILED;if(e===peg$FAILED)if(e=peg$currPos,input.charCodeAt(peg$currPos)===46?(r=peg$c3,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e5)),r!==peg$FAILED){if(n=[],peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4)),o!==peg$FAILED)for(;o!==peg$FAILED;)n.push(o),peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));else n=peg$FAILED;n!==peg$FAILED?(r=[r,n],e=r):(peg$currPos=e,e=peg$FAILED)}else peg$currPos=e,e=peg$FAILED}return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f4()),s=e,peg$resultsCache[c]={nextPos:peg$currPos,result:s},s}function peg$parseint(){var s,e,r,n=peg$currPos*17+6,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,input.charCodeAt(peg$currPos)===45?peg$currPos++:peg$fail(peg$e6),e=[],peg$r1.test(input.charAt(peg$currPos))?(r=input.charAt(peg$currPos),peg$currPos++):(r=peg$FAILED,peg$fail(peg$e4)),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),peg$r1.test(input.charAt(peg$currPos))?(r=input.charAt(peg$currPos),peg$currPos++):(r=peg$FAILED,peg$fail(peg$e4));else e=peg$FAILED;return e!==peg$FAILED?(peg$savedPos=s,s=peg$f5()):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parseratio(){var s,e,r=peg$currPos*17+7,n=peg$resultsCache[r];return n?(peg$currPos=n.nextPos,n.result):(s=peg$currPos,e=peg$parseedji_ratio(),e===peg$FAILED&&(e=peg$parseedo_ratio(),e===peg$FAILED&&(e=peg$parsefrac_ratio(),e===peg$FAILED&&(e=peg$parsedecimal_ratio()))),e!==peg$FAILED&&(peg$savedPos=s,e=peg$f6(e)),s=e,peg$resultsCache[r]={nextPos:peg$currPos,result:s},s)}function peg$parsefrac_ratio(){var s,e,r,n,o=peg$currPos*17+8,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===47?(r=peg$c5,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e7)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(peg$savedPos=s,s=peg$f7(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseedo_ratio(){var s,e,r,n,o=peg$currPos*17+9,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===92?(r=peg$c6,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e8)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(peg$savedPos=s,s=peg$f8(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseedji_ratio(){var s,e,r,n,o,a,l,c,h=peg$currPos*17+10,f=peg$resultsCache[h];return f?(peg$currPos=f.nextPos,f.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===92?(r=peg$c6,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e8)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(input.charCodeAt(peg$currPos)===60?(o=peg$c7,peg$currPos++):(o=peg$FAILED,peg$fail(peg$e9)),o!==peg$FAILED?(a=peg$parseint(),a===peg$FAILED&&(a=peg$parserandom_int()),a!==peg$FAILED?(input.charCodeAt(peg$currPos)===47?peg$currPos++:peg$fail(peg$e7),l=peg$parseint(),l===peg$FAILED&&(l=peg$parserandom_int()),l===peg$FAILED&&(l=null),input.charCodeAt(peg$currPos)===62?(c=peg$c8,peg$currPos++):(c=peg$FAILED,peg$fail(peg$e10)),c!==peg$FAILED?(peg$savedPos=s,s=peg$f9(e,n,a,l)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[h]={nextPos:peg$currPos,result:s},s)}function peg$parsedecimal_ratio(){var s,e,r,n,o=peg$currPos*17+11,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(r=peg$c1,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e2)),r!==peg$FAILED?(n=peg$parseint(),n!==peg$FAILED?(peg$savedPos=s,s=peg$f10(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseints(){var s,e,r,n=peg$currPos*17+12,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,e=[],r=peg$parseint(),r===peg$FAILED&&(r=peg$parsesep()),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),r=peg$parseint(),r===peg$FAILED&&(r=peg$parsesep());else e=peg$FAILED;return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f11(e)),s=e,peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parsemonzo(){var s,e,r,n,o=peg$currPos*17+13,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===91?(e=peg$c9,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e11)),e!==peg$FAILED?(r=peg$parseints(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===62?(n=peg$c8,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e10)),n!==peg$FAILED?(peg$savedPos=s,s=peg$f12(r)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseoperation(){var s,e,r,n,o,a,l,c=peg$currPos*17+14,h=peg$resultsCache[c];if(h)return peg$currPos=h.nextPos,h.result;if(s=peg$currPos,e=peg$parsevalue(),e===peg$FAILED&&(e=peg$parseratio(),e===peg$FAILED&&(e=peg$parsemonzo(),e===peg$FAILED)))for(e=[],r=peg$parsesep();r!==peg$FAILED;)e.push(r),r=peg$parsesep();if(e!==peg$FAILED){if(r=[],n=peg$currPos,o=peg$parseoperator(),o!==peg$FAILED){if(a=peg$parsevalue(),a===peg$FAILED&&(a=peg$parseratio(),a===peg$FAILED&&(a=peg$parsemonzo(),a===peg$FAILED&&(a=peg$parsesub_operations(),a===peg$FAILED&&(a=peg$parseoperation(),a===peg$FAILED)))))for(a=[],l=peg$parsesep();l!==peg$FAILED;)a.push(l),l=peg$parsesep();a!==peg$FAILED?(o=[o,a],n=o):(peg$currPos=n,n=peg$FAILED)}else peg$currPos=n,n=peg$FAILED;if(n!==peg$FAILED)for(;n!==peg$FAILED;)if(r.push(n),n=peg$currPos,o=peg$parseoperator(),o!==peg$FAILED){if(a=peg$parsevalue(),a===peg$FAILED&&(a=peg$parseratio(),a===peg$FAILED&&(a=peg$parsemonzo(),a===peg$FAILED&&(a=peg$parsesub_operations(),a===peg$FAILED&&(a=peg$parseoperation(),a===peg$FAILED)))))for(a=[],l=peg$parsesep();l!==peg$FAILED;)a.push(l),l=peg$parsesep();a!==peg$FAILED?(o=[o,a],n=o):(peg$currPos=n,n=peg$FAILED)}else peg$currPos=n,n=peg$FAILED;else r=peg$FAILED;r!==peg$FAILED?(peg$savedPos=s,s=peg$f13()):(peg$currPos=s,s=peg$FAILED)}else peg$currPos=s,s=peg$FAILED;return peg$resultsCache[c]={nextPos:peg$currPos,result:s},s}function peg$parseoperator(){var s,e=peg$currPos*17+15,r=peg$resultsCache[e];return r?(peg$currPos=r.nextPos,r.result):(input.charCodeAt(peg$currPos)===43?(s=peg$c10,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e12)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===45?(s=peg$c4,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e6)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===42?(s=peg$c11,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e13)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===37?(s=peg$c12,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e14)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===38?(s=peg$c13,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e15)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===124?(s=peg$c14,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e16)),s===peg$FAILED&&(input.substr(peg$currPos,2)===peg$c15?(s=peg$c15,peg$currPos+=2):(s=peg$FAILED,peg$fail(peg$e17)),s===peg$FAILED&&(input.substr(peg$currPos,2)===peg$c16?(s=peg$c16,peg$currPos+=2):(s=peg$FAILED,peg$fail(peg$e18))))))))),peg$resultsCache[e]={nextPos:peg$currPos,result:s},s)}function peg$parsesub_operations(){var s,e,r,n,o=peg$currPos*17+16,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parseoperation(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(n=peg$c2,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e3)),n!==peg$FAILED?(e=[e,r,n],s=e):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}if(peg$result=peg$startRuleFunction(),peg$result!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos{typeof PROCESS.emitWarning=="function"?PROCESS.emitWarning(s,e,r,n):console.error(`[${r}] ${e}: ${s}`)};let AC=globalThis.AbortController,AS=globalThis.AbortSignal;var mn;if(typeof AC>"u"){AS=class{constructor(){z(this,"onabort");z(this,"_onabort",[]);z(this,"reason");z(this,"aborted",!1)}addEventListener(n,o){this._onabort.push(o)}},AC=class{constructor(){z(this,"signal",new AS);e()}abort(n){var o,a;if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(const l of this.signal._onabort)l(n);(a=(o=this.signal).onabort)==null||a.call(o,n)}}};let s=((mn=PROCESS.env)==null?void 0:mn.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{s&&(s=!1,emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const shouldWarn=s=>!warned.has(s),isPosInt=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),getUintArray=s=>isPosInt(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?ZeroArray:null:null;class ZeroArray extends Array{constructor(e){super(e),this.fill(0)}}var _i;const Ti=class Ti{constructor(e,r){z(this,"heap");z(this,"length");if(!N(Ti,_i))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}static create(e){const r=getUintArray(e);if(!r)return[];Ue(Ti,_i,!0);const n=new Ti(e,r);return Ue(Ti,_i,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};_i=new WeakMap,rt(Ti,_i,!1);let Stack=Ti;var ti,Ut,ii,ri,Vi,At,ni,Pt,vt,Je,Zt,zt,Bt,Mt,si,Et,fi,di,oi,ai,ki,_t,sr,qr,Li,pi,or,jt,Tr,yn,Qi,Gi,ar,ci,Ii,hi,wi,lr,Kr,Hi,Ar,Wi,Pr,St,Ct,cr,Jr,Ri,nr;const en=class en{constructor(e){rt(this,sr);rt(this,Tr);rt(this,ci);rt(this,hi);rt(this,lr);rt(this,Hi);rt(this,Wi);rt(this,St);rt(this,cr);rt(this,Ri);rt(this,ti,void 0);rt(this,Ut,void 0);rt(this,ii,void 0);rt(this,ri,void 0);rt(this,Vi,void 0);z(this,"ttl");z(this,"ttlResolution");z(this,"ttlAutopurge");z(this,"updateAgeOnGet");z(this,"updateAgeOnHas");z(this,"allowStale");z(this,"noDisposeOnSet");z(this,"noUpdateTTL");z(this,"maxEntrySize");z(this,"sizeCalculation");z(this,"noDeleteOnFetchRejection");z(this,"noDeleteOnStaleGet");z(this,"allowStaleOnFetchAbort");z(this,"allowStaleOnFetchRejection");z(this,"ignoreFetchAbort");rt(this,At,void 0);rt(this,ni,void 0);rt(this,Pt,void 0);rt(this,vt,void 0);rt(this,Je,void 0);rt(this,Zt,void 0);rt(this,zt,void 0);rt(this,Bt,void 0);rt(this,Mt,void 0);rt(this,si,void 0);rt(this,Et,void 0);rt(this,fi,void 0);rt(this,di,void 0);rt(this,oi,void 0);rt(this,ai,void 0);rt(this,ki,void 0);rt(this,_t,void 0);rt(this,Li,()=>{});rt(this,pi,()=>{});rt(this,or,()=>{});rt(this,jt,()=>!1);rt(this,Qi,e=>{});rt(this,Gi,(e,r,n)=>{});rt(this,ar,(e,r,n,o)=>{if(n||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:r=0,ttl:n,ttlResolution:o=1,ttlAutopurge:a,updateAgeOnGet:l,updateAgeOnHas:c,allowStale:h,dispose:f,disposeAfter:d,noDisposeOnSet:m,noUpdateTTL:v,maxSize:A=0,maxEntrySize:T=0,sizeCalculation:B,fetchMethod:Y,noDeleteOnFetchRejection:F,noDeleteOnStaleGet:ke,allowStaleOnFetchRejection:Qe,allowStaleOnFetchAbort:xe,ignoreFetchAbort:Te}=e;if(r!==0&&!isPosInt(r))throw new TypeError("max option must be a nonnegative integer");const Le=r?getUintArray(r):Array;if(!Le)throw new Error("invalid max value: "+r);if(Ue(this,ti,r),Ue(this,Ut,A),this.maxEntrySize=T||N(this,Ut),this.sizeCalculation=B,this.sizeCalculation){if(!N(this,Ut)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(Y!==void 0&&typeof Y!="function")throw new TypeError("fetchMethod must be a function if specified");if(Ue(this,Vi,Y),Ue(this,ki,!!Y),Ue(this,Pt,new Map),Ue(this,vt,new Array(r).fill(void 0)),Ue(this,Je,new Array(r).fill(void 0)),Ue(this,Zt,new Le(r)),Ue(this,zt,new Le(r)),Ue(this,Bt,0),Ue(this,Mt,0),Ue(this,si,Stack.create(r)),Ue(this,At,0),Ue(this,ni,0),typeof f=="function"&&Ue(this,ii,f),typeof d=="function"?(Ue(this,ri,d),Ue(this,Et,[])):(Ue(this,ri,void 0),Ue(this,Et,void 0)),Ue(this,ai,!!N(this,ii)),Ue(this,_t,!!N(this,ri)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!F,this.allowStaleOnFetchRejection=!!Qe,this.allowStaleOnFetchAbort=!!xe,this.ignoreFetchAbort=!!Te,this.maxEntrySize!==0){if(N(this,Ut)!==0&&!isPosInt(N(this,Ut)))throw new TypeError("maxSize must be a positive integer if specified");if(!isPosInt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");_e(this,Tr,yn).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!ke,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!c,this.ttlResolution=isPosInt(o)||o===0?o:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!isPosInt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");_e(this,sr,qr).call(this)}if(N(this,ti)===0&&this.ttl===0&&N(this,Ut)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!N(this,ti)&&!N(this,Ut)){const Me="LRU_CACHE_UNBOUNDED";shouldWarn(Me)&&(warned.add(Me),emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Me,en))}}static unsafeExposeInternals(e){return{starts:N(e,di),ttls:N(e,oi),sizes:N(e,fi),keyMap:N(e,Pt),keyList:N(e,vt),valList:N(e,Je),next:N(e,Zt),prev:N(e,zt),get head(){return N(e,Bt)},get tail(){return N(e,Mt)},free:N(e,si),isBackgroundFetch:r=>{var n;return _e(n=e,St,Ct).call(n,r)},backgroundFetch:(r,n,o,a)=>{var l;return _e(l=e,Wi,Pr).call(l,r,n,o,a)},moveToTail:r=>{var n;return _e(n=e,Ri,nr).call(n,r)},indexes:r=>{var n;return _e(n=e,ci,Ii).call(n,r)},rindexes:r=>{var n;return _e(n=e,hi,wi).call(n,r)},isStale:r=>{var n;return N(n=e,jt).call(n,r)}}}get max(){return N(this,ti)}get maxSize(){return N(this,Ut)}get calculatedSize(){return N(this,ni)}get size(){return N(this,At)}get fetchMethod(){return N(this,Vi)}get dispose(){return N(this,ii)}get disposeAfter(){return N(this,ri)}getRemainingTTL(e){return N(this,Pt).has(e)?1/0:0}*entries(){for(const e of _e(this,ci,Ii).call(this))N(this,Je)[e]!==void 0&&N(this,vt)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield[N(this,vt)[e],N(this,Je)[e]])}*rentries(){for(const e of _e(this,hi,wi).call(this))N(this,Je)[e]!==void 0&&N(this,vt)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield[N(this,vt)[e],N(this,Je)[e]])}*keys(){for(const e of _e(this,ci,Ii).call(this)){const r=N(this,vt)[e];r!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield r)}}*rkeys(){for(const e of _e(this,hi,wi).call(this)){const r=N(this,vt)[e];r!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield r)}}*values(){for(const e of _e(this,ci,Ii).call(this))N(this,Je)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield N(this,Je)[e])}*rvalues(){for(const e of _e(this,hi,wi).call(this))N(this,Je)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield N(this,Je)[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(const n of _e(this,ci,Ii).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;if(a!==void 0&&e(a,N(this,vt)[n],this))return this.get(N(this,vt)[n],r)}}forEach(e,r=this){for(const n of _e(this,ci,Ii).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;a!==void 0&&e.call(r,a,N(this,vt)[n],this)}}rforEach(e,r=this){for(const n of _e(this,hi,wi).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;a!==void 0&&e.call(r,a,N(this,vt)[n],this)}}purgeStale(){let e=!1;for(const r of _e(this,hi,wi).call(this,{allowStale:!0}))N(this,jt).call(this,r)&&(this.delete(N(this,vt)[r]),e=!0);return e}dump(){const e=[];for(const r of _e(this,ci,Ii).call(this,{allowStale:!0})){const n=N(this,vt)[r],o=N(this,Je)[r],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;if(a===void 0||n===void 0)continue;const l={value:a};if(N(this,oi)&&N(this,di)){l.ttl=N(this,oi)[r];const c=perf.now()-N(this,di)[r];l.start=Math.floor(Date.now()-c)}N(this,fi)&&(l.size=N(this,fi)[r]),e.unshift([n,l])}return e}load(e){this.clear();for(const[r,n]of e){if(n.start){const o=Date.now()-n.start;n.start=perf.now()-o}this.set(r,n.value,n)}}set(e,r,n={}){var v,A,T,B,Y;if(r===void 0)return this.delete(e),this;const{ttl:o=this.ttl,start:a,noDisposeOnSet:l=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:h}=n;let{noUpdateTTL:f=this.noUpdateTTL}=n;const d=N(this,ar).call(this,e,r,n.size||0,c);if(this.maxEntrySize&&d>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.delete(e),this;let m=N(this,At)===0?void 0:N(this,Pt).get(e);if(m===void 0)m=N(this,At)===0?N(this,Mt):N(this,si).length!==0?N(this,si).pop():N(this,At)===N(this,ti)?_e(this,Hi,Ar).call(this,!1):N(this,At),N(this,vt)[m]=e,N(this,Je)[m]=r,N(this,Pt).set(e,m),N(this,Zt)[N(this,Mt)]=m,N(this,zt)[m]=N(this,Mt),Ue(this,Mt,m),xr(this,At)._++,N(this,Gi).call(this,m,d,h),h&&(h.set="add"),f=!1;else{_e(this,Ri,nr).call(this,m);const F=N(this,Je)[m];if(r!==F){if(N(this,ki)&&_e(this,St,Ct).call(this,F)){F.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:ke}=F;ke!==void 0&&!l&&(N(this,ai)&&((v=N(this,ii))==null||v.call(this,ke,e,"set")),N(this,_t)&&((A=N(this,Et))==null||A.push([ke,e,"set"])))}else l||(N(this,ai)&&((T=N(this,ii))==null||T.call(this,F,e,"set")),N(this,_t)&&((B=N(this,Et))==null||B.push([F,e,"set"])));if(N(this,Qi).call(this,m),N(this,Gi).call(this,m,d,h),N(this,Je)[m]=r,h){h.set="replace";const ke=F&&_e(this,St,Ct).call(this,F)?F.__staleWhileFetching:F;ke!==void 0&&(h.oldValue=ke)}}else h&&(h.set="update")}if(o!==0&&!N(this,oi)&&_e(this,sr,qr).call(this),N(this,oi)&&(f||N(this,or).call(this,m,o,a),h&&N(this,pi).call(this,h,m)),!l&&N(this,_t)&&N(this,Et)){const F=N(this,Et);let ke;for(;ke=F==null?void 0:F.shift();)(Y=N(this,ri))==null||Y.call(this,...ke)}return this}pop(){var e;try{for(;N(this,At);){const r=N(this,Je)[N(this,Bt)];if(_e(this,Hi,Ar).call(this,!0),_e(this,St,Ct).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(N(this,_t)&&N(this,Et)){const r=N(this,Et);let n;for(;n=r==null?void 0:r.shift();)(e=N(this,ri))==null||e.call(this,...n)}}}has(e,r={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:o}=r,a=N(this,Pt).get(e);if(a!==void 0){const l=N(this,Je)[a];if(_e(this,St,Ct).call(this,l)&&l.__staleWhileFetching===void 0)return!1;if(N(this,jt).call(this,a))o&&(o.has="stale",N(this,pi).call(this,o,a));else return n&&N(this,Li).call(this,a),o&&(o.has="hit",N(this,pi).call(this,o,a)),!0}else o&&(o.has="miss");return!1}peek(e,r={}){const{allowStale:n=this.allowStale}=r,o=N(this,Pt).get(e);if(o!==void 0&&(n||!N(this,jt).call(this,o))){const a=N(this,Je)[o];return _e(this,St,Ct).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,r={}){const{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:B,forceRefresh:Y=!1,status:F,signal:ke}=r;if(!N(this,ki))return F&&(F.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:a,status:F});const Qe={allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:a,ttl:l,noDisposeOnSet:c,size:h,sizeCalculation:f,noUpdateTTL:d,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:T,ignoreFetchAbort:A,status:F,signal:ke};let xe=N(this,Pt).get(e);if(xe===void 0){F&&(F.fetch="miss");const Te=_e(this,Wi,Pr).call(this,e,xe,Qe,B);return Te.__returned=Te}else{const Te=N(this,Je)[xe];if(_e(this,St,Ct).call(this,Te)){const Ve=n&&Te.__staleWhileFetching!==void 0;return F&&(F.fetch="inflight",Ve&&(F.returnedStale=!0)),Ve?Te.__staleWhileFetching:Te.__returned=Te}const Le=N(this,jt).call(this,xe);if(!Y&&!Le)return F&&(F.fetch="hit"),_e(this,Ri,nr).call(this,xe),o&&N(this,Li).call(this,xe),F&&N(this,pi).call(this,F,xe),Te;const Me=_e(this,Wi,Pr).call(this,e,xe,Qe,B),Fe=Me.__staleWhileFetching!==void 0&&n;return F&&(F.fetch=Le?"stale":"refresh",Fe&&Le&&(F.returnedStale=!0)),Fe?Me.__staleWhileFetching:Me.__returned=Me}}get(e,r={}){const{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:l}=r,c=N(this,Pt).get(e);if(c!==void 0){const h=N(this,Je)[c],f=_e(this,St,Ct).call(this,h);return l&&N(this,pi).call(this,l,c),N(this,jt).call(this,c)?(l&&(l.get="stale"),f?(l&&n&&h.__staleWhileFetching!==void 0&&(l.returnedStale=!0),n?h.__staleWhileFetching:void 0):(a||this.delete(e),l&&n&&(l.returnedStale=!0),n?h:void 0)):(l&&(l.get="hit"),f?h.__staleWhileFetching:(_e(this,Ri,nr).call(this,c),o&&N(this,Li).call(this,c),h))}else l&&(l.get="miss")}delete(e){var n,o,a,l;let r=!1;if(N(this,At)!==0){const c=N(this,Pt).get(e);if(c!==void 0)if(r=!0,N(this,At)===1)this.clear();else{N(this,Qi).call(this,c);const h=N(this,Je)[c];_e(this,St,Ct).call(this,h)?h.__abortController.abort(new Error("deleted")):(N(this,ai)||N(this,_t))&&(N(this,ai)&&((n=N(this,ii))==null||n.call(this,h,e,"delete")),N(this,_t)&&((o=N(this,Et))==null||o.push([h,e,"delete"]))),N(this,Pt).delete(e),N(this,vt)[c]=void 0,N(this,Je)[c]=void 0,c===N(this,Mt)?Ue(this,Mt,N(this,zt)[c]):c===N(this,Bt)?Ue(this,Bt,N(this,Zt)[c]):(N(this,Zt)[N(this,zt)[c]]=N(this,Zt)[c],N(this,zt)[N(this,Zt)[c]]=N(this,zt)[c]),xr(this,At)._--,N(this,si).push(c)}}if(N(this,_t)&&((a=N(this,Et))!=null&&a.length)){const c=N(this,Et);let h;for(;h=c==null?void 0:c.shift();)(l=N(this,ri))==null||l.call(this,...h)}return r}clear(){var e,r,n;for(const o of _e(this,hi,wi).call(this,{allowStale:!0})){const a=N(this,Je)[o];if(_e(this,St,Ct).call(this,a))a.__abortController.abort(new Error("deleted"));else{const l=N(this,vt)[o];N(this,ai)&&((e=N(this,ii))==null||e.call(this,a,l,"delete")),N(this,_t)&&((r=N(this,Et))==null||r.push([a,l,"delete"]))}}if(N(this,Pt).clear(),N(this,Je).fill(void 0),N(this,vt).fill(void 0),N(this,oi)&&N(this,di)&&(N(this,oi).fill(0),N(this,di).fill(0)),N(this,fi)&&N(this,fi).fill(0),Ue(this,Bt,0),Ue(this,Mt,0),N(this,si).length=0,Ue(this,ni,0),Ue(this,At,0),N(this,_t)&&N(this,Et)){const o=N(this,Et);let a;for(;a=o==null?void 0:o.shift();)(n=N(this,ri))==null||n.call(this,...a)}}};ti=new WeakMap,Ut=new WeakMap,ii=new WeakMap,ri=new WeakMap,Vi=new WeakMap,At=new WeakMap,ni=new WeakMap,Pt=new WeakMap,vt=new WeakMap,Je=new WeakMap,Zt=new WeakMap,zt=new WeakMap,Bt=new WeakMap,Mt=new WeakMap,si=new WeakMap,Et=new WeakMap,fi=new WeakMap,di=new WeakMap,oi=new WeakMap,ai=new WeakMap,ki=new WeakMap,_t=new WeakMap,sr=new WeakSet,qr=function(){const e=new ZeroArray(N(this,ti)),r=new ZeroArray(N(this,ti));Ue(this,oi,e),Ue(this,di,r),Ue(this,or,(a,l,c=perf.now())=>{if(r[a]=l!==0?c:0,e[a]=l,l!==0&&this.ttlAutopurge){const h=setTimeout(()=>{N(this,jt).call(this,a)&&this.delete(N(this,vt)[a])},l+1);h.unref&&h.unref()}}),Ue(this,Li,a=>{r[a]=e[a]!==0?perf.now():0}),Ue(this,pi,(a,l)=>{if(e[l]){const c=e[l],h=r[l];a.ttl=c,a.start=h,a.now=n||o();const f=a.now-h;a.remainingTTL=c-f}});let n=0;const o=()=>{const a=perf.now();if(this.ttlResolution>0){n=a;const l=setTimeout(()=>n=0,this.ttlResolution);l.unref&&l.unref()}return a};this.getRemainingTTL=a=>{const l=N(this,Pt).get(a);if(l===void 0)return 0;const c=e[l],h=r[l];if(c===0||h===0)return 1/0;const f=(n||o())-h;return c-f},Ue(this,jt,a=>e[a]!==0&&r[a]!==0&&(n||o())-r[a]>e[a])},Li=new WeakMap,pi=new WeakMap,or=new WeakMap,jt=new WeakMap,Tr=new WeakSet,yn=function(){const e=new ZeroArray(N(this,ti));Ue(this,ni,0),Ue(this,fi,e),Ue(this,Qi,r=>{Ue(this,ni,N(this,ni)-e[r]),e[r]=0}),Ue(this,ar,(r,n,o,a)=>{if(_e(this,St,Ct).call(this,n))return 0;if(!isPosInt(o))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(o=a(n,r),!isPosInt(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o}),Ue(this,Gi,(r,n,o)=>{if(e[r]=n,N(this,Ut)){const a=N(this,Ut)-e[r];for(;N(this,ni)>a;)_e(this,Hi,Ar).call(this,!0)}Ue(this,ni,N(this,ni)+e[r]),o&&(o.entrySize=n,o.totalCalculatedSize=N(this,ni))})},Qi=new WeakMap,Gi=new WeakMap,ar=new WeakMap,ci=new WeakSet,Ii=function*({allowStale:e=this.allowStale}={}){if(N(this,At))for(let r=N(this,Mt);!(!_e(this,lr,Kr).call(this,r)||((e||!N(this,jt).call(this,r))&&(yield r),r===N(this,Bt)));)r=N(this,zt)[r]},hi=new WeakSet,wi=function*({allowStale:e=this.allowStale}={}){if(N(this,At))for(let r=N(this,Bt);!(!_e(this,lr,Kr).call(this,r)||((e||!N(this,jt).call(this,r))&&(yield r),r===N(this,Mt)));)r=N(this,Zt)[r]},lr=new WeakSet,Kr=function(e){return e!==void 0&&N(this,Pt).get(N(this,vt)[e])===e},Hi=new WeakSet,Ar=function(e){var a,l;const r=N(this,Bt),n=N(this,vt)[r],o=N(this,Je)[r];return N(this,ki)&&_e(this,St,Ct).call(this,o)?o.__abortController.abort(new Error("evicted")):(N(this,ai)||N(this,_t))&&(N(this,ai)&&((a=N(this,ii))==null||a.call(this,o,n,"evict")),N(this,_t)&&((l=N(this,Et))==null||l.push([o,n,"evict"]))),N(this,Qi).call(this,r),e&&(N(this,vt)[r]=void 0,N(this,Je)[r]=void 0,N(this,si).push(r)),N(this,At)===1?(Ue(this,Bt,Ue(this,Mt,0)),N(this,si).length=0):Ue(this,Bt,N(this,Zt)[r]),N(this,Pt).delete(n),xr(this,At)._--,r},Wi=new WeakSet,Pr=function(e,r,n,o){const a=r===void 0?void 0:N(this,Je)[r];if(_e(this,St,Ct).call(this,a))return a;const l=new AC,{signal:c}=n;c==null||c.addEventListener("abort",()=>l.abort(c.reason),{signal:l.signal});const h={signal:l.signal,options:n,context:o},f=(B,Y=!1)=>{const{aborted:F}=l.signal,ke=n.ignoreFetchAbort&&B!==void 0;if(n.status&&(F&&!Y?(n.status.fetchAborted=!0,n.status.fetchError=l.signal.reason,ke&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),F&&!ke&&!Y)return m(l.signal.reason);const Qe=A;return N(this,Je)[r]===A&&(B===void 0?Qe.__staleWhileFetching?N(this,Je)[r]=Qe.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,B,h.options))),B},d=B=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=B),m(B)),m=B=>{const{aborted:Y}=l.signal,F=Y&&n.allowStaleOnFetchAbort,ke=F||n.allowStaleOnFetchRejection,Qe=ke||n.noDeleteOnFetchRejection,xe=A;if(N(this,Je)[r]===A&&(!Qe||xe.__staleWhileFetching===void 0?this.delete(e):F||(N(this,Je)[r]=xe.__staleWhileFetching)),ke)return n.status&&xe.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),xe.__staleWhileFetching;if(xe.__returned===xe)throw B},v=(B,Y)=>{var ke;const F=(ke=N(this,Vi))==null?void 0:ke.call(this,e,a,h);F&&F instanceof Promise&&F.then(Qe=>B(Qe===void 0?void 0:Qe),Y),l.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(B(void 0),n.allowStaleOnFetchAbort&&(B=Qe=>f(Qe,!0)))})};n.status&&(n.status.fetchDispatched=!0);const A=new Promise(v).then(f,d),T=Object.assign(A,{__abortController:l,__staleWhileFetching:a,__returned:void 0});return r===void 0?(this.set(e,T,{...h.options,status:void 0}),r=N(this,Pt).get(e)):N(this,Je)[r]=T,T},St=new WeakSet,Ct=function(e){if(!N(this,ki))return!1;const r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AC},cr=new WeakSet,Jr=function(e,r){N(this,zt)[r]=e,N(this,Zt)[e]=r},Ri=new WeakSet,nr=function(e){e!==N(this,Mt)&&(e===N(this,Bt)?Ue(this,Bt,N(this,Zt)[e]):_e(this,cr,Jr).call(this,N(this,zt)[e],N(this,Zt)[e]),_e(this,cr,Jr).call(this,N(this,Mt),e),Ue(this,Mt,e))};let LRUCache=en;const zcache=new LRUCache({max:1e3,ttl:1e3*60*5});class Ziffers{constructor(e,r={}){z(this,"values");z(this,"evaluated");z(this,"options");z(this,"index",0);z(this,"redo");z(this,"_current");r={...DEFAULT_OPTIONS,...r},r.scale&&(typeof r.scale=="string"&&(isScale(r.scale)?(r.scaleName=r.scale,r.scale=getScale(r.scale)):r.scale=parse(r.scale)),r.parsedScale=r.scale,delete r.scale),r.redo!==void 0?this.redo=r.redo:this.redo=1,r&&r.seed&&(r.randomSeed=r.seed,r.seededRandom=seededRandom(r.seed)),this.options={nodeOptions:r};try{this.values=parse$1(e,this.options),this.evaluated=this.evaluate()}catch(n){console.log(n),this.values=[],this.evaluated=[]}}update(){this.evaluated=this.evaluate()}pitches(){return this.evaluated.map(e=>e.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}next(){if(this.redo>0&&this.index>=this.evaluated.length*this.redo&&(this.update(),this._current=void 0),this._current!==void 0){const r=this.evaluated[this._current%this.evaluated.length];r.modifiedEvent&&r.modifiedEvent==null,this._current=this._current+1r.evaluate()).flat(1/0).filter(r=>r!==void 0);return e.forEach((r,n)=>{r._next=n0?n-1:e.length-1}),e}}const generateCacheKey=(...s)=>s.map(e=>JSON.stringify(e)).join(","),cachedCall=(s,e)=>{const r=generateCacheKey(s,e);if(zcache.has(r))return zcache.get(r);{const n=new Ziffers(s,e);return zcache.set(r,n),n}},cachedPattern=(s,e={})=>cachedCall(s,e);class MidiConnection{constructor(){z(this,"midiAccess",null);z(this,"midiOutputs",[]);z(this,"currentOutputIndex",0);z(this,"scheduledNotes",{});this.initializeMidiAccess()}async initializeMidiAccess(){try{this.midiAccess=await navigator.requestMIDIAccess(),this.midiOutputs=Array.from(this.midiAccess.outputs.values()),this.midiOutputs.length===0&&console.warn("No MIDI outputs available.")}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndexn.name===e);return r!==-1?(this.currentOutputIndex=r,!0):(console.error(`MIDI output "${e}" not found.`),!1)}listMidiOutputs(){console.log("Available MIDI Outputs:"),this.midiOutputs.forEach((e,r)=>{console.log(`${r+1}. ${e.name}`)})}sendMidiNote(e,r,n,o){const a=this.midiOutputs[this.currentOutputIndex];if(e=Math.min(Math.max(e,0),127),a){const l=[144+r,e,n],c=[128+r,e,0];a.send(l);const h=setTimeout(()=>{a.send(c),delete this.scheduledNotes[e]},(o-.02)*1e3);this.scheduledNotes[e]=h}else console.error("MIDI output not available.")}sendSysExMessage(e){const r=this.midiOutputs[this.currentOutputIndex];r?r.send(e):console.error("MIDI output not available.")}sendPitchBend(e,r){(e<0||e>16383)&&console.error("Invalid pitch bend value. Value must be in the range 0-16383."),(r<0||r>15)&&console.error("Invalid MIDI channel. Channel must be in the range 0-15.");const n=this.midiOutputs[this.currentOutputIndex];if(n){const o=e&127,a=e>>7&127;n.send([224|r,o,a])}else console.error("MIDI output not available.")}sendProgramChange(e,r){const n=this.midiOutputs[this.currentOutputIndex];n?n.send([192+r,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,r,n){const o=this.midiOutputs[this.currentOutputIndex];o?o.send([176+n,e,r]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const r in this.scheduledNotes){const n=this.scheduledNotes[r];clearTimeout(n),e.send([128,parseInt(r),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class DrunkWalk{constructor(e,r,n){z(this,"min");z(this,"max");z(this,"wrap");z(this,"position");this.min=e,this.max=r,this.wrap=n,this.position=0}step(){const e=Math.floor(Math.random()*3)-1;this.position+=e,this.wrap?this.position>this.max?this.position=this.min:this.positionthis.max&&(this.position=this.max)}getPosition(){return this.position}toggleWrap(e){this.wrap=e}}const SCALES={major:[0,2,4,5,7,9,11],naturalMinor:[0,2,3,5,7,8,10],harmonicMinor:[0,2,3,5,7,8,11],melodicMinor:[0,2,3,5,7,9,11],dorian:[0,2,3,5,7,9,10],phrygian:[0,1,3,5,7,8,10],lydian:[0,2,4,6,7,9,11],mixolydian:[0,2,4,5,7,9,10],aeolian:[0,2,3,5,7,8,10],locrian:[0,1,3,5,6,8,10],wholeTone:[0,2,4,6,8,10],majorPentatonic:[0,2,4,7,9],minorPentatonic:[0,3,5,7,10],chromatic:[0,1,2,3,4,5,6,7,8,9,10,11],blues:[0,3,5,6,7,10],diminished:[0,2,3,5,6,8,9,11],neapolitanMinor:[0,1,3,5,7,8,11],neapolitanMajor:[0,1,3,5,7,9,11],enigmatic:[0,1,4,6,8,10,11],doubleHarmonic:[0,1,4,5,7,8,11],octatonic:[0,2,3,5,6,8,9,11],bebopDominant:[0,2,4,5,7,9,10,11],bebopMajor:[0,2,4,5,7,8,9,11],bebopMinor:[0,2,3,5,7,8,9,11],bebopDorian:[0,2,3,4,5,7,9,10],harmonicMajor:[0,2,4,5,7,8,11],hungarianMinor:[0,2,3,6,7,8,11],hungarianMajor:[0,3,4,6,7,9,10],oriental:[0,1,4,5,6,9,10],romanianMinor:[0,2,3,6,7,9,10],spanishGypsy:[0,1,4,5,7,8,10],jewish:[0,1,4,5,7,8,10],hindu:[0,2,4,5,7,8,10],japanese:[0,1,5,7,8],hirajoshi:[0,2,3,7,8],kumoi:[0,2,3,7,9],inSen:[0,1,5,7,10],iwato:[0,1,5,6,10],yo:[0,2,5,7,9],minorBlues:[0,3,5,6,7,10],algerian:[0,2,3,5,6,7,8,11],augmented:[0,3,4,7,8,11],balinese:[0,1,3,7,8],byzantine:[0,1,4,5,7,8,11],chinese:[0,4,6,7,11],egyptian:[0,2,5,7,10],eightToneSpanish:[0,1,3,4,5,6,8,10],hawaiian:[0,2,3,5,7,9,10],hindustan:[0,2,4,5,7,8,10],persian:[0,1,4,5,6,8,11],eastIndianPurvi:[0,1,4,6,7,8,11],orientalA:[0,1,4,5,6,9,10]};function scale(s,e="major",r=4){const n=SCALES[e];if(!n)throw new Error(`Unknown scale ${e}`);let o=s%n.length;o<0&&(o+=n.length);let a=Math.floor(s/n.length);return 60+(r+a)*12+n[o]}let listenerQueue=[],atom=(s,e)=>{let r,n=[],o={lc:0,l:e||0,value:s,set(a){o.value=a,o.notify()},get(){return o.lc||o.listen(()=>{})(),o.value},notify(a){r=n;let l=!listenerQueue.length;for(let c=0;c{n===r&&(n=n.slice());let c=n.indexOf(a);~c&&(n.splice(c,2),o.lc--,o.lc||o.off())}},subscribe(a,l){let c=o.listen(a,l);return a(o.value),c},off(){}};return o},map=(s={})=>{let e=atom(s);return e.setKey=function(r,n){typeof n>"u"?r in e.value&&(e.value={...e.value},delete e.value[r],e.notify(r)):e.value[r]!==n&&(e.value={...e.value,[r]:n},e.notify(r))},e};if(typeof DelayNode<"u"){class s extends DelayNode{constructor(r,n,o,a){super(r),n=Math.abs(n),this.delayTime.value=o;const l=r.createGain();l.gain.value=Math.min(Math.abs(a),.995),this.feedback=l.gain;const c=r.createGain();return c.gain.value=n,this.delayGain=c,this.connect(l),this.connect(c),l.connect(this),this.connect=h=>c.connect(h),this}start(r){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,r+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,r,n){return new s(this,e,r,n)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(s,e=1){const r=this.sampleRate*s,n=this.createBuffer(e,r,this.sampleRate),o=n.getChannelData(0);for(let a=0;a(e.buffer=this.impulseResponse(r),e.duration=s,e),e.setDuration(s),e});var q={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class s extends GainNode{constructor(r,n){if(super(r),!q[n])throw new Error("vowel: unknown vowel "+n);const{gains:o,qs:a,freqs:l}=q[n],c=r.createGain();for(let h=0;h<5;h++){const f=r.createGain();f.gain.value=o[h];const d=r.createBiquadFilter();d.type="bandpass",d.Q.value=a[h],d.frequency.value=l[h],this.connect(d),d.connect(f),f.connect(c)}return c.gain.value=8,this.connect=h=>c.connect(h),this}}AudioContext.prototype.createVowelFilter=function(e){return new s(this,e)}}const ce=s=>{var o;if(typeof s!="string")return[];const[e,r="",n]=((o=s.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/))==null?void 0:o.slice(1))||[];return e?[e,r,n?Number(n):void 0]:[]},re={c:0,d:2,e:4,f:5,g:7,a:9,b:11},ie={"#":1,b:-1,s:1,f:-1},L=(s,e=3)=>{const[r,n,o=e]=ce(s);if(!r)throw new Error('not a note: "'+s+'"');const a=re[r.toLowerCase()],l=(n==null?void 0:n.split("").reduce((c,h)=>c+ie[h],0))||0;return(Number(o)+1)*12+a+l},se=s=>Math.pow(2,(s-69)/12)*440,ae=(s,e,r)=>Math.min(Math.max(s,e),r),ge=s=>12*Math.log(s/440)/Math.LN2+69,de=(s,e)=>{if(typeof s!="object")throw new Error("valueToMidi: expected object value");let{freq:r,note:n}=s;if(typeof r=="number")return ge(r);if(typeof n=="string")return L(n);if(typeof n=="number")return n;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},ue="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0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N0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm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B9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function k(s){const e=C().createGain();return e.gain.value=s,e}const Ie=({s,freq:e,t:r})=>{const n=C().createOscillator();return n.type=s||"triangle",n.frequency.value=Number(e),n.start(r),{node:n,stop:o=>n.stop(o)}},ee=(s,e,r,n,o,a)=>{const l=C().createGain();return l.gain.setValueAtTime(0,a),l.gain.linearRampToValueAtTime(o,a+s),l.gain.linearRampToValueAtTime(r*o,a+s+e),{node:l,stop:c=>{l.gain.setValueAtTime(r*o,c),l.gain.linearRampToValueAtTime(0,c+n)}}},Q=(s,e,r)=>{const n=C().createBiquadFilter();return n.type=s,n.frequency.value=e,n.Q.value=r,n},E=map();function te(s,e,r={}){E.setKey(s,{onTrigger:e,data:r})}function U(s){return E.get()[s]}let J;const C=()=>(J||(J=new AudioContext),J);let W;const j=()=>{const s=C();return W||(W=s.createGain(),W.connect(s.destination)),W};let D;function le(){return D||(D=C().audioWorklet.addModule(ue),D)}function x(s,e,r){const n=new AudioWorkletNode(s,e);return Object.entries(r).forEach(([o,a])=>{n.parameters.get(o).value=a}),n}async function Ce(s={}){const{disableWorklets:e=!1}=s;typeof window<"u"&&(await C().resume(),e?console.log("disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!"):await le().catch(r=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",r)}))}async function ve(s){return new Promise(e=>{document.addEventListener("click",async function r(){await Ce(s),e(),document.removeEventListener("click",r)})})}let G={};function fe(s,e,r,n){var o;if(r=ae(r,0,.98),!G[s]){const a=C().createFeedbackDelay(1,e,r);(o=a.start)==null||o.call(a,n),a.connect(j()),G[s]=a}return G[s].delayTime.value!==e&&G[s].delayTime.setValueAtTime(e,n),G[s].feedback.value!==r&&G[s].feedback.setValueAtTime(r,n),G[s]}let w={};function Ae(s,e=2){if(!w[s]){const r=C().createReverb(e);r.connect(j()),w[s]=r}return w[s].duration!==e&&(w[s]=w[s].setDuration(e),w[s].duration=e),w[s]}function _(s,e,r){const n=k(r);return s.connect(n),n.connect(e),n}const he=async(s,e,r)=>{const n=C();if(typeof s!="object")throw new Error(`expected hap.value to be an object, but got "${s}". Hint: append .note() or .s() to the end`,"error");let o=n.currentTime+e,{s:a="triangle",bank:l,source:c,gain:h=.8,cutoff:f,resonance:d=1,hcutoff:m,hresonance:v=1,bandf:A,bandq:T=1,coarse:B,crush:Y,shape:F,pan:ke,vowel:Qe,delay:xe=0,delayfeedback:Te=.5,delaytime:Le=.25,orbit:Me=1,room:ot,size:Fe=2,velocity:Ve=1}=s;h*=Ve;let at=[];const dt=()=>{at.forEach(lt=>lt==null?void 0:lt.disconnect())};l&&a&&(a=`${l}_${a}`);let ct;if(c)ct=c(o,s,r);else if(U(a)){const{onTrigger:lt}=U(a),st=await lt(o,s,dt);st&&(ct=st.node,st.stop(o+r))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!ct||n.currentTime>o)return;const nt=[];if(nt.push(ct),nt.push(k(h)),f!==void 0&&nt.push(Q("lowpass",f,d)),m!==void 0&&nt.push(Q("highpass",m,v)),A!==void 0&&nt.push(Q("bandpass",A,T)),Qe!==void 0&&nt.push(n.createVowelFilter(Qe)),B!==void 0&&nt.push(x(n,"coarse-processor",{coarse:B})),Y!==void 0&&nt.push(x(n,"crush-processor",{crush:Y})),F!==void 0&&nt.push(x(n,"shape-processor",{shape:F})),ke!==void 0){const lt=n.createStereoPanner();lt.pan.value=2*ke-1,nt.push(lt)}const ft=k(1);nt.push(ft),ft.connect(j());let it;if(xe>0&&Le>0&&Te>0){const lt=fe(Me,Le,Te,o);it=_(ft,lt,xe)}let pt;if(ot>0&&Fe>0){const lt=Ae(Me,Fe);pt=_(ft,lt,ot)}nt.slice(1).reduce((lt,st)=>lt.connect(st),nt[0]),at=nt.concat([it,pt])},O={};function pe(s,e){var r=e?1e3:1024;if(s=r);return s.toFixed(1)+" "+n[o]}const be=async(s,e,r,n,o,a,l)=>{let c=0,h=de({freq:o,note:r},36);c=h-36;const f=C();let d;if(Array.isArray(a))d=a[e%a.length];else{const T=Y=>L(Y)-h,B=Object.keys(a).filter(Y=>!Y.startsWith("_")).reduce((Y,F,ke)=>!Y||Math.abs(T(F))(O[s]||(O[s]=fetch(s).then(o=>o.arrayBuffer()).then(async o=>(pe(o.byteLength),await e.decodeAudioData(o)))),O[s]);function ye(s){const e=C(),r=e.createBuffer(s.numberOfChannels,s.length,e.sampleRate);for(let n=0;nObject.entries(s).forEach(([n,o])=>{if(typeof o=="string"&&(o=[o]),typeof o!="object")throw new Error("wrong sample map format for "+n);r=o._base||r;const a=l=>(r+l).replace("github:","https://raw.githubusercontent.com/");Array.isArray(o)?o=o.map(a):o=Object.fromEntries(Object.entries(o).map(([l,c])=>[l,(typeof c=="string"?[c]:c).map(a)])),e(n,o)});let ne={};function Ge(s){const e=Object.entries(ne).find(([r])=>s.startsWith(r));if(e)return e[1]}const we=async(s,e=s._base||"",r={})=>{if(typeof s=="string"){const a=Ge(s);if(a)return a(s);if(s.startsWith("github:")){let[c,h]=s.split("github:");h=h.endsWith("/")?h.slice(0,-1):h,s=`https://raw.githubusercontent.com/${h}/strudel.json`}if(typeof fetch!="function")return;const l=s.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(s).then(c=>c.json()).then(c=>we(c,e||c._base||l,r)).catch(c=>{throw console.error(c),new Error(`error loading "${s}"`)})}const{prebake:n,tag:o}=r;me(s,(a,l)=>te(a,(c,h,f)=>Xe(c,h,f,l),{type:"sample",samples:l,baseUrl:e,prebake:n,tag:o}),e)},$=[];async function Xe(s,e,r,n,o){const{s:a,freq:l,unit:c,nudge:h=0,cut:f,loop:d,clip:m=void 0,n:v=0,note:A,speed:T=1,begin:B=0,end:Y=1}=e;if(T===0)return;const F=C(),{attack:ke=.001,decay:Qe=.001,sustain:xe=1,release:Te=.001}=e,Le=s+h,Me=await be(a,v,A,T,l,n,o);if(F.currentTime>s||!Me)return;Me.playbackRate.value=Math.abs(T)*Me.playbackRate.value,c==="c"&&(Me.playbackRate.value=Me.playbackRate.value*Me.buffer.duration*1);const ot=B*Me.buffer.duration;Me.start(Le,ot);const Fe=Me.buffer.duration/Me.playbackRate.value,{node:Ve,stop:at}=ee(ke,Qe,xe,Te,1,s);Me.connect(Ve);const dt=F.createGain();Ve.connect(dt),Me.onended=function(){Me.disconnect(),Ve.disconnect(),dt.disconnect(),r()};const ct={node:dt,bufferSource:Me,stop:(nt,ft=m===void 0)=>{let it=nt;ft&&(it=s+(Y-B)*Fe),Me.stop(it+Te),at(it)}};if(f!==void 0){const nt=$[f];nt&&(nt.node.gain.setValueAtTime(1,Le),nt.node.gain.linearRampToValueAtTime(0,Le+.01)),$[f]=ct}return ct}function Ke(){["sine","square","triangle","sawtooth"].forEach(s=>{te(s,(e,r,n)=>{const{attack:o=.001,decay:a=.05,sustain:l=.6,release:c=.01}=r;let{n:h,note:f,freq:d}=r;h=f||h||36,typeof h=="string"&&(h=L(h)),!d&&typeof h=="number"&&(d=se(h));const{node:m,stop:v}=Ie({t:e,s,freq:d}),A=k(.3),{node:T,stop:B}=ee(o,a,l,c,1,e);return m.onended=()=>{m.disconnect(),A.disconnect(),n()},{node:m.connect(A).connect(T),stop:Y=>{B(Y),v(Y+c)}}},{type:"synth",prebake:!0})})}class Sound{constructor(e){z(this,"values");z(this,"unit",e=>(this.values.unit=e,this));z(this,"frequency",e=>(this.values.frequency=e,this));z(this,"nudge",e=>(this.values.nudge=e,this));z(this,"cut",e=>(this.values.cut=e,this));z(this,"loop",e=>(this.values.loop=e,this));z(this,"clip",e=>(this.values.clip=e,this));z(this,"n",e=>(this.values.n=e,this));z(this,"note",e=>(this.values.note=e,this));z(this,"speed",e=>(this.values.speed=e,this));z(this,"begin",e=>(this.values.begin=e,this));z(this,"end",e=>(this.values.end=e,this));z(this,"gain",e=>(this.values.gain=e,this));z(this,"cutoff",e=>(this.values.cutoff=e,this));z(this,"resonance",e=>(this.values.resonance=e,this));z(this,"hcutoff",e=>(this.values.hcutoff=e,this));z(this,"hresonance",e=>(this.values.hresonance=e,this));z(this,"bandf",e=>(this.values.bandf=e,this));z(this,"bandq",e=>(this.values.bandq=e,this));z(this,"coarse",e=>(this.values.coarse=e,this));z(this,"crush",e=>(this.values.crush=e,this));z(this,"shape",e=>(this.values.shape=e,this));z(this,"pan",e=>(this.values.pan=e,this));z(this,"vowel",e=>(this.values.vowel=e,this));z(this,"delay",e=>(this.values.delay=e,this));z(this,"delayfeedback",e=>(this.values.delayfeedback=e,this));z(this,"delaytime",e=>(this.values.delaytime=e,this));z(this,"orbit",e=>(this.values.orbit=e,this));z(this,"room",e=>(this.values.room=e,this));z(this,"size",e=>(this.values.size=e,this));z(this,"velocity",e=>(this.values.velocity=e,this));z(this,"out",()=>he(this.values,0));this.values={s:e}}}const cache=new LRUCache({max:1e3,ttl:1e3*60*5});Array.prototype.in=function(s){return this.includes(s)};Promise.all([ve(),we("github:tidalcycles/Dirt-Samples/master"),we("github:Bubobubobubobubo/Topos-Samples/main"),Ke()]);class UserAPI{constructor(e){z(this,"variables",{});z(this,"iterators",{});z(this,"_drunk",new DrunkWalk(-100,100,!1));z(this,"MidiConnection",new MidiConnection);z(this,"load");z(this,"s",this.script);z(this,"cs",this.clear_script);z(this,"cps",this.copy_script);z(this,"$",this.iterator);z(this,"v",this.variable);z(this,"dv",this.delete_variable);z(this,"cv",this.clear_variables);z(this,"rI",this.randI);z(this,"r",this.rand);z(this,"quant",this.quantize);z(this,"cmp",this.clamp);z(this,"tempo",this.bpm);z(this,"silence",this.stop);z(this,"hush",this.stop);z(this,"abs",Math.abs);z(this,"d",async(e,r=0)=>{he(e,r)});z(this,"sound",e=>new Sound(e));z(this,"samples",we);z(this,"log",console.log);z(this,"scale",scale);this.app=e,this.load=we("github:tidalcycles/Dirt-Samples/master")}get time(){return this.app.audioContext.currentTime}get mouseX(){return this.app._mouseX}get mouseY(){return this.app._mouseY}script(...e){e.forEach(r=>{tryEvaluate(this.app,this.app.universes[this.app.selected_universe].locals[r])})}clear_script(e){this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}}copy_script(e,r){this.app.universes[this.app.selected_universe].locals[r]=this.app.universes[this.app.selected_universe].locals[e]}midi_outputs(){return console.log(this.MidiConnection.listMidiOutputs()),this.MidiConnection.midiOutputs}midi_output(e){e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())}note(e,r={}){const n=r.channel?r.channel:0,o=r.velocity?r.velocity:100,a=r.duration?r.duration:.5;this.MidiConnection.sendMidiNote(e,n,o,a)}sysex(e){this.MidiConnection.sendSysExMessage(e)}pitch_bend(e,r){this.MidiConnection.sendPitchBend(e,r)}program_change(e,r){this.MidiConnection.sendProgramChange(e,r)}midi_clock(){this.MidiConnection.sendMidiClock()}control_change({control:e=20,value:r=0,channel:n=0}){this.MidiConnection.sendMidiControlChange(e,r,n)}midi_panic(){this.MidiConnection.panic()}zn(e,r={}){const n=cachedPattern(e,r);if(n.hasStarted()){const o=n.peek(),a=o.modifiedEvent?o.modifiedEvent:o,l=r.channel?r.channel:0,c=r.velocity?r.velocity:100,h=r.sustain?r.sustain:.5;a instanceof Pitch?(a.bend&&this.MidiConnection.sendPitchBend(a.bend,l),this.MidiConnection.sendMidiNote(a.note,l,c,h),a.bend&&this.MidiConnection.sendPitchBend(8192,l)):a instanceof Chord&&a.pitches.forEach(f=>{f.bend&&this.MidiConnection.sendPitchBend(f.bend,l),this.MidiConnection.sendMidiNote(f.note,l,c,h),f.bend&&this.MidiConnection.sendPitchBend(8192,l)}),o.modifiedEvent&&(o.modifiedEvent=void 0)}return n.next()}iterator(e,r,n){return e in this.iterators?(this.iterators[e].limit!==r&&(this.iterators[e].value=0,this.iterators[e].limit=r),this.iterators[e].step!==n&&(this.iterators[e].step=n??this.iterators[e].step),this.iterators[e].value+=this.iterators[e].step,this.iterators[e].limit!==void 0&&this.iterators[e].value>this.iterators[e].limit&&(this.iterators[e].value=0)):this.iterators[e]={value:0,step:n??1,limit:r},this.iterators[e].value}get drunk(){return this._drunk.step(),this._drunk.getPosition()}set drunk(e){this._drunk.position=e}set drunk_max(e){this._drunk.max=e}set drunk_min(e){this._drunk.min=e}set drunk_wrap(e){this._drunk.toggleWrap(e)}variable(e,r){return typeof e=="string"&&r===void 0?this.variables[e]:(this.variables[e]=r,this.variables[e])}delete_variable(e){delete this.variables[e]}clear_variables(){this.variables={}}_sequence_key_generator(e){return btoa(JSON.stringify(e))}seqmod(...e){if(cache.has(this._sequence_key_generator(e))){let r=cache.get(this._sequence_key_generator(e));return r.options.currentIteration++,r.options.currentIteration===r.options.nextTarget&&(r.options.index++,r.options.nextTarget=e[r.options.index%e.length],r.options.currentIteration=0),cache.set(this._sequence_key_generator(e),{pattern:e,options:r.options}),r.options.currentIteration===0}else{let r={index:-1,nextTarget:this.app.clock.ticks_before_new_bar,currentIteration:0};return typeof e[e.length-1]=="object"&&(r={...e.pop(),...r}),r.nextTarget=this.app.clock.ticks_before_new_bar,r.currentIteration===r.nextTarget&&(r.index++,r.nextTarget=e[r.index%e.length],r.currentIteration=0),cache.set(this._sequence_key_generator(e),{pattern:e,options:r}),r.currentIteration===0}}seq(...e){if(cache.has(this._sequence_key_generator(e))){let r=cache.get(this._sequence_key_generator(e));return r.options.index+=1,cache.set(this._sequence_key_generator(e),r),r.pattern[r.options.index%r.pattern.length]}else{let r={index:0};return typeof e[e.length-1]=="object"&&(r={...e.pop(),...r}),cache.set(this._sequence_key_generator(e),{pattern:e,options:r}),cache.get(this._sequence_key_generator(e))}}pick(...e){return e[Math.floor(Math.random()*e.length)]}seqbeat(...e){return e[this.ebeat%e.length]}mel(e,r){return r[e%r.length]}seqbar(...e){return e[(this.app.clock.time_position.bar+1)%e.length]}seqpulse(...e){return e[this.app.clock.time_position.pulse%e.length]}randI(e,r){return Math.floor(Math.random()*(r-e+1))+e}rand(e,r){return Math.random()*(r-e)+e}quantize(e,r){if(r.length===0)return e;let n=r[0];return r.forEach(o=>{Math.abs(o-e)500)&&console.log(`Setting bpm to ${e}`),this.app.clock.bpm=e,e)}bpb(e){return e===void 0?this.app.clock.time_signature[0]:(e<1&&console.log(`Setting bpb to ${e}`),this.app.clock.time_signature[0]=e,e)}ppqn(e){return e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e)}time_signature(e,r){this.app.clock.time_signature=[e,r]}almostNever(){return Math.random()>.9}sometimes(){return Math.random()>.5}rarely(){return Math.random()>.75}often(){return Math.random()>.25}almostAlways(){return Math.random()>.1}dice(e){return Math.floor(Math.random()*e)+1}get i(){return this.app.universes[this.app.selected_universe].global.evaluations}set i(e){this.app.universes[this.app.selected_universe].global.evaluations=e}get bar(){return this.app.clock.time_position.bar}get tick(){return this.app.clock.tick}get pulse(){return this.app.clock.time_position.pulse}get beat(){return this.app.clock.time_position.beat}get ebeat(){return this.app.clock.beats_since_origin}get epulse(){return this.app.clock.pulses_since_origin}onbar(e,...r){const n=[...Array(e).keys()].map(o=>o+1);return console.log(r.some(o=>n.includes(o%e))),r.some(o=>n.includes(o%e))}onbeat(...e){let r=[];return e.forEach(n=>{n=n%this.app.clock.time_signature[0]+1;let o=Math.floor(n),a=n-o;r.push(o===this.app.clock.time_position.beat&&this.app.clock.time_position.pulse===a*this.app.clock.ppqn)}),r.some(n=>n==!0)}stop(){this.app.clock.pause(),this.app.setButtonHighlighting("pause",!0)}prob(e){return Math.random()*100.5}min(...e){return Math.min(...e)}max(...e){return Math.max(...e)}limit(e,r,n){return Math.min(Math.max(e,r),n)}delay(e,r){setTimeout(r,e)}delayr(e,r,n){[...Array(r).keys()].map(a=>e*a).forEach((a,l)=>{setTimeout(n,a)})}mod(...e){return e.some(r=>this.app.clock.time_position.pulse%r===0)}modbar(...e){return e.some(r=>this.app.clock.time_position.bar%r===0)}euclid(e,r,n,o=0){return this._euclidean_cycle(r,n,o)[e%n]}_euclidean_cycle(e,r,n=0){function o(c,h){const f=c.length,d=(h+1)%f;return c[h]>c[d]}if(e>=r)return[!0];const a=Array.from({length:r},(c,h)=>(e*(h-1)%r+r)%r);let l=a.map((c,h)=>o(a,h));return n!=0&&(l=l.slice(n).concat(l.slice(0,n))),l}bin(e,r){let o=r.toString(2).split("").map(a=>a==="1");return o[e%o.length]}gold(){}line(e,r,n=1){const o=[];if(r>e&&n>0||r0?1:-1}usquare(e=1,r=0){return(this.square(e,r)+1)/2}noise(){return Math.random()*2-1}rate(e){}}class Editor{constructor(){z(this,"universes",template_universes);z(this,"selected_universe");z(this,"local_index",1);z(this,"editor_mode","local");z(this,"fontSize");z(this,"withLineNumbers");z(this,"vimModeCompartment");z(this,"chosenLanguage");z(this,"settings",new AppSettings);z(this,"editorExtensions",[]);z(this,"userPlugins",[]);z(this,"state");z(this,"api");z(this,"audioContext");z(this,"view");z(this,"clock");z(this,"manualPlay",!1);z(this,"_mouseX",0);z(this,"_mouseY",0);z(this,"play_buttons",[document.getElementById("play-button-1"),document.getElementById("play-button-2")]);z(this,"pause_buttons",[document.getElementById("pause-button-1"),document.getElementById("pause-button-2")]);z(this,"stop_buttons",[document.getElementById("stop-button-1"),document.getElementById("stop-button-2")]);z(this,"clear_buttons",[document.getElementById("clear-button-1"),document.getElementById("clear-button-2")]);z(this,"local_button",document.getElementById("local-button"));z(this,"global_button",document.getElementById("global-button"));z(this,"init_button",document.getElementById("init-button"));z(this,"note_button",document.getElementById("note-button"));z(this,"settings_button",document.getElementById("settings-button"));z(this,"close_settings_button",document.getElementById("close-settings-button"));z(this,"universe_viewer",document.getElementById("universe-viewer"));z(this,"buffer_modal",document.getElementById("modal-buffers"));z(this,"buffer_search",document.getElementById("buffer-search"));z(this,"local_script_tabs",document.getElementById("local-script-tabs"));z(this,"font_size_slider",document.getElementById("font-size-slider"));z(this,"font_size_witness",document.getElementById("font-size-witness"));z(this,"line_numbers_checkbox",document.getElementById("show-line-numbers"));z(this,"normal_mode_button",document.getElementById("normal-mode"));z(this,"vim_mode_button",document.getElementById("vim-mode"));this.selected_universe=this.settings.selected_universe,this.universe_viewer.innerHTML=`Topos: ${this.selected_universe}`,this.universes={...template_universes,...this.settings.universes},this.audioContext=new AudioContext({latencyHint:"playback"}),this.clock=new Clock(this,this.audioContext),this.api=new UserAPI(this),this.vimModeCompartment=new Compartment,this.withLineNumbers=new Compartment,this.chosenLanguage=new Compartment,this.fontSize=new Compartment;const e=this.settings.vimMode?vim():[],r=this.settings.line_numbers?lineNumbers():[],n=EditorView.theme({"&":{fontSize:`${this.settings.font_size}px`},".cm-gutters":{fontSize:`${this.settings.font_size}px`}});this.editorExtensions=[this.withLineNumbers.of(r),this.fontSize.of(n),this.vimModeCompartment.of(e),editorSetup,oneDark,this.chosenLanguage.of(javascript()),EditorView.updateListener.of(l=>{})];let o=new Compartment;this.state=EditorState.create({extensions:[...this.editorExtensions,EditorView.lineWrapping,o.of(this.userPlugins)],doc:this.universes[this.selected_universe].locals[this.local_index].candidate}),this.view=new EditorView({parent:document.getElementById("editor"),state:this.state}),document.addEventListener("keydown",l=>{l.key==="Tab"&&l.preventDefault(),l.ctrlKey&&l.key==="s"&&(l.preventDefault(),this.setButtonHighlighting("pause",!0),this.clock.pause()),l.ctrlKey&&l.key==="r"&&(l.preventDefault(),this.setButtonHighlighting("stop",!0),this.clock.stop()),l.ctrlKey&&l.key==="p"&&(l.preventDefault(),this.setButtonHighlighting("play",!0),this.clock.start()),(l.key==="v"||l.key==="V")&&l.ctrlKey&&l.shiftKey&&(this.settings.vimMode=!this.settings.vimMode,l.preventDefault(),this.userPlugins=this.settings.vimMode?[]:[vim()],this.view.dispatch({effects:o.reconfigure(this.userPlugins)})),(l.key==="Enter"||l.key==="Return")&&l.ctrlKey&&(l.preventDefault(),this.currentFile().candidate=this.view.state.doc.toString(),this.flashBackground("#2d313d",200)),(l.key==="Enter"&&l.shiftKey||l.key==="e"&&l.ctrlKey)&&(l.preventDefault(),this.currentFile().candidate=this.view.state.doc.toString(),this.flashBackground("#2d313d",200)),l.ctrlKey&&l.key==="b"&&this.openBuffersModal(),l.shiftKey&&l.key==="Escape"&&this.openSettingsModal(),l.ctrlKey&&l.key==="l"&&(l.preventDefault(),this.changeModeFromInterface("local"),this.view.focus()),l.ctrlKey&&l.key==="n"&&(l.preventDefault(),this.changeModeFromInterface("notes"),this.view.focus()),l.ctrlKey&&l.key==="g"&&(l.preventDefault(),this.changeModeFromInterface("global"),this.view.focus()),l.ctrlKey&&l.key==="i"&&(l.preventDefault(),this.changeModeFromInterface("init"),this.changeToLocalBuffer(0),this.view.focus()),[112,113,114,115,116,117,118,119,120].forEach((c,h)=>{l.keyCode===c&&(l.preventDefault(),l.ctrlKey?this.api.script(c-111):(this.changeModeFromInterface("local"),this.changeToLocalBuffer(h)))}),l.keyCode==121&&this.changeModeFromInterface("global"),l.keyCode==122&&this.changeModeFromInterface("init")});const a=document.querySelectorAll('[id^="tab-"]');for(let l=0;l{a[l].classList.add("bg-orange-300");for(let d=0;d{l.addEventListener("click",()=>{this.setButtonHighlighting("play",!0),this.clock.start()})}),this.clear_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("clear",!0),confirm("Do you want to reset the current universe?")&&(this.universes[this.selected_universe]=template_universe,this.updateEditorView())})}),this.pause_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("pause",!0),this.clock.pause()})}),this.stop_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("stop",!0),this.clock.stop()})}),this.local_button.addEventListener("click",()=>this.changeModeFromInterface("local")),this.global_button.addEventListener("click",()=>this.changeModeFromInterface("global")),this.init_button.addEventListener("click",()=>this.changeModeFromInterface("init")),this.note_button.addEventListener("click",()=>this.changeModeFromInterface("notes")),this.settings_button.addEventListener("click",()=>{var h;this.font_size_slider.value=this.settings.font_size.toString(),this.font_size_witness.innerHTML=`Font Size: ${this.settings.font_size}px`,(h=this.font_size_witness)==null||h.setAttribute("style",`font-size: ${this.settings.font_size}px;`),this.line_numbers_checkbox.checked=this.settings.line_numbers;let l=document.getElementById("modal-settings"),c=document.getElementById("editor");l==null||l.classList.remove("invisible"),c==null||c.classList.add("invisible")}),this.close_settings_button.addEventListener("click",()=>{let l=document.getElementById("modal-settings"),c=document.getElementById("editor");l==null||l.classList.add("invisible"),c==null||c.classList.remove("invisible")}),this.font_size_slider.addEventListener("input",()=>{const l=this.font_size_slider.value;this.settings.font_size=parseInt(l),this.font_size_witness.style.fontSize=`${l}px`,this.font_size_witness.innerHTML=`Font Size: ${l}px`;let c=EditorView.theme({"&":{fontSize:l+"px"},".cm-gutters":{fontSize:l+"px"}});this.view.dispatch({effects:this.fontSize.reconfigure(c)}),this.settings.font_size=parseInt(l)}),this.normal_mode_button.addEventListener("click",()=>{this.settings.vimMode=!1,this.view.dispatch({effects:this.vimModeCompartment.reconfigure([])})}),this.line_numbers_checkbox.addEventListener("change",()=>{let l=!!this.line_numbers_checkbox.checked;this.settings.line_numbers=l,this.view.dispatch({effects:this.withLineNumbers.reconfigure(l?[lineNumbers()]:[])})}),this.vim_mode_button.addEventListener("click",()=>{this.settings.vimMode=!0,this.view.dispatch({effects:this.vimModeCompartment.reconfigure(vim())})}),this.buffer_search.addEventListener("keydown",l=>{if(l.key==="Enter"){let c=this.buffer_search.value;c.length>2&&c.length<20&&(this.loadUniverse(c),this.settings.selected_universe=c,this.buffer_search.value="",this.closeBuffersModal(),this.view.focus())}}),tryEvaluate(this,this.universes[this.selected_universe.toString()].init)}get note_buffer(){return this.universes[this.selected_universe.toString()].notes}get global_buffer(){return this.universes[this.selected_universe.toString()].global}get init_buffer(){return this.universes[this.selected_universe.toString()].init}get local_buffer(){return this.universes[this.selected_universe.toString()].locals[this.local_index]}changeToLocalBuffer(e){const r=document.querySelectorAll('[id^="tab-"]'),n=r[e];n.classList.add("bg-orange-300");for(let a=0;a{r.forEach(a=>{let l=a.children[0];l.classList.contains("text-orange-300")&&(l.classList.remove("text-orange-300"),a.classList.remove("text-orange-300"))}),o.children[0].classList.remove("text-white"),o.children[0].classList.add("text-orange-300"),o.classList.add("text-orange-300")};switch(e){case"local":this.local_script_tabs.classList.contains("hidden")&&this.local_script_tabs.classList.remove("hidden"),this.editor_mode="local",this.local_index=0,this.changeToLocalBuffer(this.local_index),n(this.local_button);break;case"global":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="global",n(this.global_button);break;case"init":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="init",n(this.init_button);break;case"notes":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="notes",n(this.note_button);break}this.view.dispatch({effects:this.chosenLanguage.reconfigure(this.editor_mode=="notes"?[markdown()]:[javascript()])}),this.updateEditorView()}setButtonHighlighting(e,r){this.flashBackground("#2d313d",200);const n=['[id^="play-button-"]','[id^="pause-button-"]','[id^="clear-button-"]','[id^="stop-button-"]'];let o;switch(e){case"play":o=0;break;case"pause":o=1;break;case"clear":o=2;break;case"stop":o=3;break}document.querySelectorAll(n[o]).forEach(a=>{r&&a.children[0].classList.add("fill-orange-300")}),document.querySelectorAll(n.filter((a,l)=>l!=o).join(",")).forEach(a=>{a.children[0].classList.remove("fill-orange-300"),a.children[0].classList.remove("text-orange-300"),a.children[0].classList.remove("bg-orange-300")})}unfocusPlayButtons(){document.querySelectorAll('[id^="play-button-"]').forEach(e=>{e.children[0].classList.remove("fill-orange-300")})}updateEditorView(){this.view.dispatch({changes:{from:0,to:this.view.state.doc.toString().length,insert:this.currentFile().candidate}})}currentFile(){switch(this.editor_mode){case"global":return this.global_buffer;case"local":return this.local_buffer;case"init":return this.init_buffer;case"notes":return this.note_buffer}}loadUniverse(e){this.currentFile().candidate=this.view.state.doc.toString();let r=e.trim();this.universes[r]===void 0&&(this.universes[r]=template_universe),this.selected_universe=r,this.settings.selected_universe=this.selected_universe,this.universe_viewer.innerHTML=`Topos: ${r}`,this.updateEditorView(),tryEvaluate(this,this.universes[this.selected_universe.toString()].init)}openSettingsModal(){document.getElementById("modal-settings").classList.contains("invisible")?(document.getElementById("editor").classList.add("invisible"),document.getElementById("modal-settings").classList.remove("invisible")):this.closeSettingsModal()}closeSettingsModal(){document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal-settings").classList.add("invisible")}openBuffersModal(){document.getElementById("modal-buffers").classList.contains("invisible")?(document.getElementById("editor").classList.add("invisible"),document.getElementById("modal-buffers").classList.remove("invisible"),document.getElementById("buffer-search").focus()):this.closeBuffersModal()}closeBuffersModal(){document.getElementById("buffer-search").value="",document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal").classList.add("invisible"),document.getElementById("modal-buffers").classList.add("invisible")}flashBackground(e,r){this.view.dom.style.backgroundColor=e;const n=this.view.dom.getElementsByClassName("cm-gutter");Array.from(n).forEach(o=>o.style.backgroundColor=e),setTimeout(()=>{this.view.dom.style.backgroundColor="",Array.from(n).forEach(o=>o.style.backgroundColor="")},r)}}const app=new Editor;function startClock(){document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal").classList.add("hidden"),document.getElementById("modal-container").classList.remove("motion-safe:animate-pulse"),document.getElementById("start-button").removeEventListener("click",startClock),document.removeEventListener("click",startClock),document.removeEventListener("keydown",startOnEnter),document.removeEventListener("click",startOnClick),app.clock.start(),app.view.focus(),app.setButtonHighlighting("play",!0)}function startOnEnter(s){(s.code==="Enter"||s.code==="Space")&&startClock()}function startOnClick(s){s.button===0&&startClock()}document.addEventListener("keydown",startOnEnter);document.addEventListener("click",startOnClick);function reportMouseCoordinates(s){app._mouseX=s.clientX,app._mouseY=s.clientY}window.addEventListener("mousemove",reportMouseCoordinates);window.addEventListener("beforeunload",()=>(event.preventDefault(),app.currentFile().candidate=app.view.state.doc.toString(),app.currentFile().committed=app.view.state.doc.toString(),app.settings.saveApplicationToLocalStorage(app.universes,app.settings),app.clock.stop(),null)); diff --git a/index.html b/index.html index c5e3dea..2439050 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Topos - +