diff --git a/extension.json b/extension.json index e13f8207..d247491a 100644 --- a/extension.json +++ b/extension.json @@ -183,7 +183,7 @@ } ], "styles": [ - "ext.CodeMirror.v6.WikiEditor.less", + "ext.CodeMirror.v6.less", "mode/mediawiki/mediawiki.less", "mode/mediawiki/colorblind-colors.less" ], diff --git a/resources/dist/main.js b/resources/dist/main.js index 53e32ca2..e38d86ad 100644 --- a/resources/dist/main.js +++ b/resources/dist/main.js @@ -1,2 +1,2 @@ -(()=>{"use strict";class t{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){let r=[];return this.decompose(0,t,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(e,this.length,r,1),i.from(r,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let n=[];return this.decompose(t,e,n,0),i.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new s(this),r=new s(t);for(let t=e,s=e;;){if(n.next(t),r.next(t),t=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(s+=n.value.length,n.done||s>=i)return!0}}iter(t=1){return new s(this,t)}iterRange(t,e=this.length){return new o(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(n){if(0==n.length)throw new RangeError("A document must have at least one line");return 1!=n.length||n[0]?n.length<=32?new e(n):i.from(e.split(n,[])):t.empty}}class e extends t{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let r=0;;r++){let s=this.text[r],o=n+s.length;if((e?i:o)>=t)return new l(n,o,i,s);n=o+1,i++}}decompose(t,i,s,o){let a=t<=0&&i>=this.length?this:new e(r(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&o){let t=s.pop(),i=n(a.text,t.text.slice(),0,a.length);if(i.length<=32)s.push(new e(i,t.length+a.length));else{let t=i.length>>1;s.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else s.push(a)}replace(t,s,o){if(!(o instanceof e))return super.replace(t,s,o);let a=n(this.text,n(o.text,r(this.text,0,t)),s),l=this.length+o.length-(s-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}sliceString(t,e=this.length,i="\n"){let n="";for(let r=0,s=0;r<=e&&st&&s&&(n+=i),tr&&(n+=o.slice(Math.max(0,t-r),e-r)),r=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,i){let n=[],r=-1;for(let s of t)n.push(s),r+=s.length+1,32==n.length&&(i.push(new e(n,r)),n=[],r=-1);return r>-1&&i.push(new e(n,r)),i}}class i extends t{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let r=0;;r++){let s=this.children[r],o=n+s.length,a=i+s.lines-1;if((e?a:o)>=t)return s.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let r=0,s=0;s<=e&&r=s){let r=n&((s<=t?1:0)|(a>=e?2:0));s>=t&&a<=e&&!r?i.push(o):o.decompose(t-s,e-s,i,r)}s=a+1}}replace(t,e,n){if(n.lines=s&&e<=a){let l=o.replace(t-s,e-s,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let s=this.children.slice();return s[r]=l,new i(s,this.length-(e-t)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(t,e,n)}sliceString(t,e=this.length,i="\n"){let n="";for(let r=0,s=0;rt&&r&&(n+=i),ts&&(n+=o.sliceString(t-s,e-s,i)),s=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let n=0,[r,s,o,a]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=e,s+=e){if(r==o||s==a)return n;let i=this.children[r],l=t.children[s];if(i!=l)return n+i.scanIdentical(l,e);n+=i.length+1}}static from(t,n=t.reduce(((t,e)=>t+e.length+1),-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let i=[];for(let e of t)e.flatten(i);return new e(i,n)}let s=Math.max(32,r>>5),o=s<<1,a=s>>1,l=[],h=0,c=-1,u=[];function f(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)f(e);else t.lines>a&&(h>a||!h)?(d(),l.push(t)):t instanceof e&&h&&(n=u[u.length-1])instanceof e&&t.lines+n.lines<=32?(h+=t.lines,c+=t.length+1,u[u.length-1]=new e(n.text.concat(t.text),n.length+1+t.length)):(h+t.lines>s&&d(),h+=t.lines,c+=t.length+1,u.push(t))}function d(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)f(e);return d(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let r=0,s=0,o=!0;s=i&&(l>n&&(a=a.slice(0,n-r)),r0?1:(t instanceof e?t.text.length:t.children.length)<<1]}nextInner(t,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,a=r instanceof e?r.text.length:r.children.length;if(o==(i>0?a:0)){if(0==n)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(i>0?0:1)){if(this.offsets[n]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(r instanceof e){let e=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,e.length>Math.max(0,t))return this.value=0==t?e:i>0?e.slice(t):e.slice(0,e.length-t),this;t-=e.length}else{let s=r.children[o+(i<0?-1:0)];t>s.length?(t-=s.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(s),this.offsets.push(i>0?1:(s instanceof e?s.text.length:s.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class o{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new s(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class a{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter()},s.prototype[Symbol.iterator]=o.prototype[Symbol.iterator]=a.prototype[Symbol.iterator]=function(){return this});class l{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}let h="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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6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((t=>t?parseInt(t,36):1));for(let t=1;tt)return h[e-1]<=t;return!1}function u(t){return t>=127462&&t<=127487}const f=8205;function d(t,e,i=!0,n=!0){return(i?p:m)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&w(t.charCodeAt(e-1))&&e--;let n=v(t,e);for(e+=b(n);e=0&&u(v(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function m(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function w(t){return t>=55296&&t<56320}function v(t,e){let i=t.charCodeAt(e);if(!w(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function y(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function b(t){return t<65536?1:2}const k=/\r\n?|\n/;var x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(x||(x={}));class S{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return r+(t-n);r+=o}else{if(i!=x.Simple&&l>=t&&(i==x.TrackDel&&nt||i==x.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?r:r+a;r+=a}n=l}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return r}touchesRange(t,e=t){for(let i=0,n=0;i=0&&n<=e&&r>=t)return!(ne)||"cover";n=r}return!1}toString(){let t="";for(let e=0;e=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t)}static create(t){return new S(t)}}class A extends S{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return T(this,((e,i,n,r,s)=>t=t.replace(n,n+(i-e),s)),!1),t}mapDesc(t,e=!1){return O(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,s=0;r=0){i[r]=a,i[r+1]=o;let l=r>>1;for(;n.length0&&C(i,e,r.text),r.forward(t),o+=t}let l=t[s++];for(;o>1].toJSON()))}return t}static of(e,i,n){let r=[],s=[],o=0,a=null;function l(t=!1){if(!t&&!r.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||k)):c:t.empty,f=u.length;if(e==a&&0==f)return;eo&&M(r,e-o,-1),M(r,a-e,f),C(s,r,u),o=a}}(e),l(!a),a}static empty(t){return new A(t?[t,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let r=0;re&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)i.push(s[0],0);else{for(;n.length=0&&i<=0&&i==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=i:n?(t[r]+=e,t[r+1]+=i):t.push(e,i)}function C(e,i,n){if(0==n.length)return;let r=i.length-2>>1;if(r>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(s,c,o,u,f),s=c,o=u}}}function O(t,e,i,n=!1){let r=[],s=n?[]:null,o=new E(t),a=new E(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);M(r,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return s?A.createSet(r,s):S.create(r);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),s.forward2(e),o.forward(e)}}else M(n,0,o.ins,t),r&&C(r,n,o.text),o.next()}}class E{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return i>=e.length?t.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?t.empty:i[n].slice(this.off,null==e?void 0:this.off+e)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class L{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let t=3&this.flags;return 3==t?null:t}get goalColumn(){let t=this.flags>>5;return 33554431==t?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new L(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head)}static create(t,e,i){return new L(t,e,i)}}class B{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:B.create(this.ranges.map((i=>i.map(t,e))),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;et.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map((t=>L.fromJSON(t))),t.main)}static single(t,e=t){return new B([B.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;nt?4:0)|r)}static normalized(t,e=0){let i=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(i);for(let i=1;in.head?B.range(o,s):B.range(s,o))}}return new B(t,e)}}function P(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let N=0;class R{constructor(t,e,i,n,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=N++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}static define(t={}){return new R(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:I),!!t.static,t.enables)}of(t){return new z([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function I(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class z{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=N++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,r=this.id,s=t[r]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!0:0==(1&(null!==(e=t[i.id])&&void 0!==e?e:1))&&h.push(t[i.id]);return{create:t=>(t.values[s]=i(t),1),update(t,e){if(a&&e.docChanged||l&&(e.docChanged||e.selection)||V(t,h)){let e=i(t);if(o?!H(e,t.values[s],n):!n(e,t.values[s]))return t.values[s]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[r];if(null!=l){let r=X(e,l);if(this.dependencies.every((i=>i instanceof R?e.facet(i)===t.facet(i):!(i instanceof j)||e.field(i,!1)==t.field(i,!1)))||(o?H(a=i(t),r,n):n(a=i(t),r)))return t.values[s]=r,0}else a=i(t);return t.values[s]=a,1}}}}function H(t,e,i){if(t.length!=e.length)return!1;for(let n=0;nt[e.id])),r=i.map((t=>t.type)),s=n.filter((t=>!(1&t))),o=t[e.id]>>1;function a(t){let i=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(F).find((t=>t.field==this));return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,i)=>{let n=t.values[e],r=this.updateF(n,i);return this.compareF(n,r)?0:(t.values[e]=r,1)},reconfigure:(t,i)=>null!=i.config.address[this.id]?(t.values[e]=i.field(this),0):(t.values[e]=this.create(t),1)}}init(t){return[this,F.of({field:this,create:t})]}get extension(){return this}}function _(t){return e=>new K(e,t)}const q={highest:_(0),high:_(1),default:_(2),low:_(3),lowest:_(4)};class K{constructor(t,e){this.inner=t,this.prec=e}}class U{of(t){return new G(this,t)}reconfigure(t){return U.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class G{constructor(t,e){this.compartment=t,this.inner=e}}class J{constructor(t,e,i,n,r,s){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,i){let n=[],r=Object.create(null),s=new Map;for(let i of function(t,e,i){let n=[[],[],[],[],[]],r=new Map;return function t(s,o){let a=r.get(s);if(null!=a){if(a<=o)return;let t=n[a].indexOf(s);t>-1&&n[a].splice(t,1),s instanceof G&&i.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let e of s)t(e,o);else if(s instanceof G){if(i.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(s.compartment)||s.inner;i.set(s.compartment,n),t(n,o)}else if(s instanceof K)t(s.inner,s.prec);else if(s instanceof j)n[o].push(s),s.provides&&t(s.provides,o);else if(s instanceof z)n[o].push(s),s.facet.extensions&&t(s.facet.extensions,2);else{let e=s.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,2),n.reduce(((t,e)=>t.concat(e)))}(t,e,s))i instanceof j?n.push(i):(r[i.facet.id]||(r[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.push((e=>t.slot(e)));let h=null==i?void 0:i.config.facets;for(let t in r){let e=r[t],n=e[0].facet,s=h&&h[t]||[];if(e.every((t=>0==t.type)))if(o[n.id]=a.length<<1|1,I(s,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>W(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,s,c,o,a,r)}}function Y(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r}function X(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const Q=R.define(),Z=R.define({combine:t=>t.some((t=>t)),static:!0}),tt=R.define({combine:t=>t.length?t[0]:void 0,static:!0}),et=R.define(),it=R.define(),nt=R.define(),rt=R.define({combine:t=>!!t.length&&t[0]});class st{constructor(t,e){this.type=t,this.value=e}static define(){return new ot}}class ot{of(t){return new st(this,t)}}class at{constructor(t){this.map=t}of(t){return new lt(this,t)}}class lt{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new lt(this.type,e)}is(t){return this.type==t}static define(t={}){return new at(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}lt.reconfigure=lt.define(),lt.appendConfig=lt.define();class ht{constructor(t,e,i,n,r,s){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,i&&P(i,e.newLength),r.some((t=>t.type==ht.time))||(this.annotations=r.concat(ht.time.of(Date.now())))}static create(t,e,i,n,r,s){return new ht(t,e,i,n,r,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(ht.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ct(t,e){let i=[];for(let n=0,r=0;;){let s,o;if(n=t[n]))s=t[n++],o=t[n++];else{if(!(r=0;r--){let s=i[r](t);s&&Object.keys(s).length&&(n=ut(n,ft(e,s,t.changes.newLength),!0))}return n==t?t:ht.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let n of e.facet(et)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ct(i,e))}if(!0!==i){let n,r;if(!1===i)r=t.changes.invertedDesc,n=A.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,r=e.filtered.mapDesc(e.changes).invertedDesc}t=ht.create(e,n,t.selection&&t.selection.map(r),lt.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let n=e.facet(it);for(let i=n.length-1;i>=0;i--){let r=n[i](t);t=r instanceof ht?r:Array.isArray(r)&&1==r.length&&r[0]instanceof ht?r[0]:dt(e,mt(r),!1)}return t}(r):r)}ht.time=st.define(),ht.userEvent=st.define(),ht.addToHistory=st.define(),ht.remote=st.define();const pt=[];function mt(t){return null==t?pt:Array.isArray(t)?t:[t]}var gt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(gt||(gt={}));const wt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let vt;try{vt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class yt{constructor(t,e,i,n,r,s){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let t=0;tr.set(e,t))),i=null),r.set(e.value.compartment,e.value.extension)):e.is(lt.reconfigure)?(i=null,n=e.value):e.is(lt.appendConfig)&&(i=null,n=mt(n).concat(e.value));i?e=t.startState.values.slice():(i=J.resolve(n,r,this),e=new yt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values),new yt(i,t.newDoc,t.newSelection,e,((e,i)=>i.update(e,t)),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)})))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),r=[i.range],s=mt(i.effects);for(let i=1;ir.spec.fromJSON(s,t))))}return yt.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(e={}){let i=J.resolve(e.extensions||[],new Map),n=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(yt.lineSeparator)||k)),r=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return P(r,n.length),i.staticFacet(Z)||(r=r.asSingle()),new yt(i,n,r,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(yt.tabSize)}get lineBreak(){return this.facet(yt.lineSeparator)||"\n"}get readOnly(){return this.facet(rt)}phrase(t,...e){for(let e of this.facet(yt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,((t,i)=>{if("$"==i)return"$";let n=+(i||1);return!n||n>e.length?t:e[n-1]}))),t}languageDataAt(t,e,i=-1){let n=[];for(let r of this.facet(Q))for(let s of r(this,e,i))Object.prototype.hasOwnProperty.call(s,t)&&n.push(s[t]);return n}charCategorizer(t){return e=this.languageDataAt("wordChars",t).join(""),t=>{if(!/\S/.test(t))return gt.Space;if(function(t){if(vt)return vt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||wt.test(i)))return!0}return!1}(t))return gt.Word;for(let i=0;i-1)return gt.Word;return gt.Other};var e}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),r=this.charCategorizer(t),s=t-i,o=t-i;for(;s>0;){let t=d(e,s,!1);if(r(e.slice(t,s))!=gt.Word)break;s=t}for(;ot.length?t[0]:4}),yt.lineSeparator=tt,yt.readOnly=rt,yt.phrases=R.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every((i=>t[i]==e[i]))}}),yt.languageData=Q,yt.changeFilter=et,yt.transactionFilter=it,yt.transactionExtender=nt,U.reconfigure=lt.define();class kt{eq(t){return this==t}range(t,e=t){return xt.create(t,e,this)}}kt.prototype.startSide=kt.prototype.endSide=0,kt.prototype.point=!1,kt.prototype.mapMode=x.TrackDel;class xt{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new xt(t,e,i)}}function St(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class At{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let r=i?this.to:this.from;for(let s=n,o=r.length;;){if(s==o)return s;let n=s+o>>1,a=r[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==s)return a>=0?s:o;a>=0?o=n:s=n+1}}between(t,e,i,n){for(let r=this.findIndex(e,-1e9,!0),s=this.findIndex(i,1e9,!1,r);rh||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(s<0&&(s=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-s),r.push(h-s))}return{mapped:i.length?new At(n,r,i,o):null,pos:s}}}class Mt{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new Mt(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:r=this.length}=t,s=t.filter;if(0==e.length&&!s)return this;if(i&&(e=e.slice().sort(St)),this.isEmpty)return e.length?Mt.of(e):this;let o=new Ot(this,null,-1).goto(0),a=0,l=[],h=new Ct;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.push(t)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||ro.to||r=r&&t<=r+s.length&&!1===s.between(r,t-r,e-r,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return Dt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Dt.from(t).goto(e)}static compare(t,e,i,n,r=-1){let s=t.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),o=e.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),a=Tt(s,o,i),l=new Lt(s,a,r),h=new Lt(o,a,r);i.iterGaps(((t,e,i)=>Bt(l,t,h,e,i,n))),i.empty&&0==i.length&&Bt(l,0,h,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),s=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(r.length!=s.length)return!1;if(!r.length)return!0;let o=Tt(r,s),a=new Lt(r,o,0).goto(i),l=new Lt(s,o,0).goto(i);for(;;){if(a.to!=l.to||!Pt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,r=-1){let s=new Lt(t,null,r).goto(e),o=e,a=s.openStart;for(;;){let t=Math.min(s.to,i);if(s.point){let i=s.activeForPoint(s.to),r=s.pointFromo&&(n.span(o,t,s.active,a),a=s.openEnd(t));if(s.to>i)return a+(s.point&&s.to>i?1:0);o=s.to,s.next()}}static of(t,e=!1){let i=new Ct;for(let n of t instanceof xt?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(St);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}Mt.empty=new Mt([],[],null,-1),Mt.empty.nextLayer=Mt.empty;class Ct{finishChunk(t){this.chunks.push(new At(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Ct)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(Mt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Tt(t,e,i){let n=new Map;for(let e of t)for(let t=0;t=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&n.push(new Ot(s,e,i,r));return 1==n.length?n[0]:new Dt(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Et(this.heap,0)}}}function Et(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let r=t[n];if(n+1=0&&(r=t[n+1],n++),i.compare(r)<0)break;t[n]=i,t[e]=r,e=n}}class Lt{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Nt(this.active,t),Nt(this.activeTo,t),Nt(this.activeRank,t),this.minActive=It(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:r}=this.cursor;for(;e-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Nt(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&i[e]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function Bt(t,e,i,n,r,s){t.goto(e),i.goto(n);let o=n+r,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l:i.to,r=Math.min(n,o);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Pt(t.activeForPoint(t.to),i.activeForPoint(i.to))||s.comparePoint(a,r,t.point,i.point):r>a&&!Pt(t.active,i.active)&&s.compareRange(a,r,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Pt(t,e){if(t.length!=e.length)return!1;for(let i=0;i=e;i--)t[i+1]=t[i];t[e]=i}function It(t,e){let i=-1,n=1e9;for(let r=0;rt.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,s);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");r(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&s.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)r(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=Wt[Ht]||1;return Wt[Ht]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[Vt],r=i&&i.nonce;n?r&&n.setNonce(r):n=new _t(t,r),n.mount(Array.isArray(e)?e:[e])}}let jt=new Map;class _t{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=jt.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[Vt]=e;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],jt.set(i,this)}else{this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);let n=t.head||t;n.insertBefore(this.styleTag,n.firstChild)}this.modules=[],t[Vt]=this}mount(t){let e=this.sheet,i=0,n=0;for(let r=0;r-1&&(this.modules.splice(o,1),n--,o=-1),-1==o){if(this.modules.splice(n++,0,s),e)for(let t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ut="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Gt=0;Gt<10;Gt++)qt[48+Gt]=qt[96+Gt]=String(Gt);for(Gt=1;Gt<=24;Gt++)qt[Gt+111]="F"+Gt;for(Gt=65;Gt<=90;Gt++)qt[Gt]=String.fromCharCode(Gt+32),$t[Gt]=String.fromCharCode(Gt);for(var Jt in qt)$t.hasOwnProperty(Jt)||($t[Jt]=qt[Jt]);function Yt(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function Xt(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Qt(t,e){if(!e.anchorNode)return!1;try{return Xt(t,e.anchorNode)}catch(t){return!1}}function Zt(t){return 3==t.nodeType?ue(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function te(t,e,i,n){return!!i&&(ie(t,e,i,n,-1)||ie(t,e,i,n,1))}function ee(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function ie(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:ne(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ee(t)+(r<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?ne(t):0}}}function ne(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function re(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function se(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function oe(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}class ae{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?ne(e):0),i,Math.min(t.focusOffset,i?ne(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let le,he=null;function ce(t){if(t.setActive)return t.setActive();if(he)return t.focus(he);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==he?{get preventScroll(){return he={preventScroll:!0},!0}}:void 0),!he){he=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}class me{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new me(t.parentNode,ee(t),e)}static after(t,e){return new me(t.parentNode,ee(t)+1,e)}}const ge=[];class we{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let i,n=this.dom,r=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(i=r?r.nextSibling:n.firstChild)){let t=we.get(i);(!t||!t.parent&&t.canReuseDOM(s))&&s.reuseDOM(i)}s.sync(t,e),s.flags&=-8}if(i=r?r.nextSibling:n.firstChild,e&&!e.written&&e.node==n&&i!=s.dom&&(e.written=!0),s.dom.parentNode==n)for(;i&&i!=s.dom;)i=ve(i);else n.insertBefore(s.dom,i);r=s.dom}for(i=r?r.nextSibling:n.firstChild,i&&e&&e.node==n&&(e.written=!0);i;)i=ve(i)}else if(1&this.flags)for(let i of this.children)7&i.flags&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let n=0==ne(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}i=n<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!we.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let n=this.children[t];if(n.dom==i)return e;e+=n.length+n.breakAfter}}domBoundsAround(t,e,i=0){let n=-1,r=-1,s=-1,o=-1;for(let a=0,l=i,h=i;ae)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,r=l),l>e&&i.dom.parentNode==this.dom){s=a,o=h;break}h=c,l=c+i.breakAfter}return{from:r,to:o<0?i+this.length:o,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=ge){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function be(t,e,i,n,r,s,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=s.length?s[s.length-1]:null,f=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!f&&s.length<2&&c.merge(i,r,s.length?u:null,0==i,a,l))){if(n0&&(!o&&s.length&&c.merge(i,c.length,s[0],!1,a,0)?c.breakAfter=s.shift().breakAfter:(i2);var Pe={mac:Be||/Mac/.test(xe.platform),windows:/Win/.test(xe.platform),linux:/Linux|X11/.test(xe.platform),ie:Te,ie_version:Me?Se.documentMode||6:Ce?+Ce[1]:Ae?+Ae[1]:0,gecko:Oe,gecko_version:Oe?+(/Firefox\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,chrome:!!De,chrome_version:De?+De[1]:0,ios:Be,android:/Android\b/.test(xe.userAgent),webkit:Ee,safari:Le,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Se.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Ne extends we{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Ne)||this.length-(e-t)+i.length>256||8&i.flags)||(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),0))}split(t){let e=new Ne(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new me(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,i){let n=t.nodeValue.length;e>n&&(e=n);let r=e,s=e,o=0;0==e&&i<0||e==n&&i>=0?Pe.chrome||Pe.gecko||(e?(r--,o=1):s=0)?0:a.length-1];return Pe.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?re(l,o<0):l||null}(this.dom,t,e)}}class Re extends we{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let t of e)t.setParent(this)}setAttrs(t){if(de(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof Re&&i.mark.eq(this.mark))||t&&r<=0||et&&e.push(i=t&&(n=r),i=o,r++}let s=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new Re(this.mark,e,s)}domAtPos(t){return He(this,t)}coordsAt(t,e){return We(this,t,e)}}class Ie extends we{static create(t,e,i){return new Ie(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Ie.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof Ie&&this.widget.compare(i.widget))||t>0&&r<=0||e0)?me.before(this.dom):me.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let n=this.dom.getClientRects(),r=null;if(!n.length)return null;let s=this.side?this.side<0:t>0;for(let e=s?n.length-1:0;r=n[e],!(t>0?0==e:e==n.length-1||r.top0?me.before(this.dom):me.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function He(t,e){let i=t.dom,{children:n}=t,r=0;for(let t=0;rt&&e0;t--){let e=n[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=r;t0&&e instanceof Re&&r.length&&(n=r[r.length-1])instanceof Re&&n.mark.eq(e.mark)?Ve(n,e.children[0],i-1):(r.push(e),e.setParent(t)),t.length+=e.length}function We(t,e,i){let n=null,r=-1,s=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!s||s.isHidden&&i>0)&&(u>a||h==u&&c.getSide()>0)?(s=c,o=a-h):(h-1?1:0)!=r.length-(i&&r.indexOf(i)>-1?1:0))return!1;for(let s of n)if(s!=i&&(-1==r.indexOf(s)||t[s]!==e[s]))return!1;return!0}function qe(t,e,i){let n=!1;if(e)for(let r in e)i&&r in i||(n=!0,"style"==r?t.style.cssText="":t.removeAttribute(r));if(i)for(let r in i)e&&e[r]==i[r]||(n=!0,"style"==r?t.style.cssText=i[r]:t.setAttribute(r,i[r]));return n}function $e(t){let e=Object.create(null);for(let i=0;i0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){_e(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Ve(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Fe(e,this.attrs||{})),i&&(this.attrs=Fe({class:i},this.attrs||{}))}domAtPos(t){return He(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(de(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(qe(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&we.get(n)instanceof Re;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=we.get(n))||void 0===i?void 0:i.isEditable)||Pe.ios&&this.children.some((t=>t instanceof Ne))))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let i of this.children){if(!(i instanceof Ne)||/[^ -~]/.test(i.text))return null;let n=Zt(i.dom);if(1!=n.length)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=We(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=i.bottom-i.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight=e){if(r instanceof Ke)return r;if(s>e)break}n=s+r.breakAfter}return null}}class Ue extends we{constructor(t,e,i){super(),this.widget=t,this.length=e,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof Ue&&this.widget.compare(i.widget))||t>0&&r<=0||e0)}}class Ge{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}destroy(t){}}var Je=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Je||(Je={}));class Ye extends kt{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Xe(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ze(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:r,end:s}=ti(t,n);e=(r?n?-3e8:-1:5e8)-1,i=1+(s?n?2e8:1:-6e8)}return new Ze(t,e,i,n,t.widget||null,!0)}static line(t){return new Qe(t)}static set(t,e=!1){return Mt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Ye.none=Mt.empty;class Xe extends Ye{constructor(t){let{start:e,end:i}=ti(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof Xe&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&_e(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Xe.prototype.point=!1;class Qe extends Ye{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Qe&&this.spec.class==t.spec.class&&_e(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}Qe.prototype.mapMode=x.TrackBefore,Qe.prototype.point=!0;class Ze extends Ye{constructor(t,e,i,n,r,s){super(e,i,r,t),this.block=n,this.isReplace=s,this.mapMode=n?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel}get type(){return this.startSide!=this.endSide?Je.WidgetRange:this.startSide<=0?Je.WidgetBefore:Je.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Ze&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function ti(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function ei(t,e,i,n=0){let r=i.length-1;r>=0&&i[r]+n>=t?i[r]=Math.max(i[r],e):i.push(t,e)}Ze.prototype.point=!0;class ii{constructor(t,e,i,n){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof Ue&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ke),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(ni(new ze(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof Ue||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ni(new Ne(this.text.slice(this.textOff,this.textOff+n)),e),i),this.atCursorPos=!0,this.textOff+=n,t-=n,i=0}}span(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,i,n,r,s){if(this.disallowBlockEffectsFor[s]&&i instanceof Ze){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof Ze)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ue(i.widget||new ri("div"),o,i));else{let s=Ie.create(i.widget||new ri("span"),o,o?0:i.startSide),a=this.atCursorPos&&!s.isEditable&&r<=n.length&&(t0),l=!s.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(ni(new ze(1),n),r),r=n.length+Math.max(0,r-n.length)),h.append(ni(s,n),r),this.atCursorPos=l,this.pendingBuffer=l?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,i,n,r){let s=new ii(t,e,i,r);return s.openEnd=Mt.spans(n,e,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function ni(t,e){for(let i of e)t=new Re(i,[t],t.length);return t}class ri extends Ge{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const si=R.define(),oi=R.define(),ai=R.define(),li=R.define(),hi=R.define(),ci=R.define(),ui=R.define(),fi=R.define({combine:t=>t.some((t=>t))}),di=R.define({combine:t=>t.some((t=>t))});class pi{constructor(t,e="nearest",i="nearest",n=5,r=5,s=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=s}map(t){return t.empty?this:new pi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new pi(B.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const mi=lt.define({map:(t,e)=>t.map(e)});function gi(t,e,i){let n=t.facet(li);n.length?n[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const wi=R.define({combine:t=>!t.length||t[0]});let vi=0;const yi=R.define();class bi{constructor(t,e,i,n,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.extension=r(this)}static define(t,e){const{eventHandlers:i,eventObservers:n,provide:r,decorations:s}=e||{};return new bi(vi++,t,i,n,(t=>{let e=[yi.of(t)];return s&&e.push(Ai.of((e=>{let i=e.plugin(t);return i?s(i):Ye.none}))),r&&e.push(r(t)),e}))}static fromClass(t,e){return bi.define((e=>new t(e)),e)}}class ki{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(gi(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){gi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){gi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const xi=R.define(),Si=R.define(),Ai=R.define(),Mi=R.define(),Ci=R.define();function Ti(t,e,i){let n=t.state.facet(Ci);if(!n.length)return n;let r=n.map((e=>e instanceof Function?e(t):e)),s=[];return Mt.spans(r,e,i,{point(){},span(t,e,i,n){let r=s;for(let s=i.length-1;s>=0;s--,n--){let o,a=i[s].spec.bidiIsolate;if(null!=a)if(n>0&&r.length&&(o=r[r.length-1]).to==t&&o.direction==a)o.to=e,r=o.inner;else{let i={from:t,to:e,direction:a,inner:[]};r.push(i),r=i.inner}}}}),s}const Oi=R.define();function Di(t){let e=0,i=0,n=0,r=0;for(let s of t.state.facet(Oi)){let o=s(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(i=Math.max(i,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:e,right:i,top:n,bottom:r}}const Ei=R.define();class Li{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Li(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toAh)break;r+=2}if(!a)return i;new Li(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),s=a.toA,o=a.toB}}}class Bi{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let n=[];this.changes.iterChangedRanges(((t,e,i,r)=>n.push(new Li(t,e,i,r)))),this.changedRanges=n}static create(t,e,i){return new Bi(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}var Pi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Pi||(Pi={}));const Ni=Pi.LTR,Ri=Pi.RTL;function Ii(t){let e=[];for(let i=0;i=e){if(o.level==i)return s;(r<0||(0!=n?n<0?o.frome:t[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function _i(t,e){if(t.length!=e.length)return!1;for(let i=0;il&&o.push(new ji(l,p.from,f)),Ki(t,p.direction==Ni!=!(f%2)?n+1:n,r,p.inner,p.from,p.to,o),l=p.to),d=p.to}else{if(d==i||(e?qi[d]!=a:qi[d]==a))break;d++}u?$i(t,l,d,n+1,r,u,o):le;){let i=!0,c=!1;if(!h||l>s[h-1].to){let t=qi[l-1];t!=a&&(i=!1,c=16==t)}let u=i||1!=a?null:[],f=i?n:n+1,d=l;t:for(;;)if(h&&d==s[h-1].to){if(c)break t;let p=s[--h];if(!i)for(let t=p.from,i=h;;){if(t==e)break t;if(!i||s[i-1].to!=t){if(qi[t-1]==a)break t;break}t=s[--i].from}u?u.push(p):(p.to=0;t-=3)if(Wi[t+1]==-i){let e=Wi[t+2],i=2&e?r:4&e?1&e?s:r:0;i&&(qi[o]=qi[Wi[t]]=i),a=t;break}}else{if(189==Wi.length)break;Wi[a++]=o,Wi[a++]=e,Wi[a++]=l}else if(2==(n=qi[o])||1==n){let t=n==r;l=t?0:1;for(let e=a-3;e>=0;e-=3){let i=Wi[e+2];if(2&i)break;if(t)Wi[e+2]|=2;else{if(4&i)break;Wi[e+2]|=4}}}}}(t,r,s,n,a),function(t,e,i,n){for(let r=0,s=n;r<=i.length;r++){let o=r?i[r-1].to:t,a=rl;)e==s&&(e=i[--n].from,s=n?i[n-1].to:t),qi[--e]=c;l=o}else s=o,l++}}}(r,s,n,a),$i(t,r,s,e,i,n,o)}function Ui(t){return[new ji(0,t,0)]}let Gi="";function Ji(t,e,i,n,r){var s;let o=n.head-t.from,a=-1;if(0==o){if(!r||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(r)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=ji.find(e,o,null!==(s=n.bidiLevel)&&void 0!==s?s:-1,n.assoc));let l=e[a];o==l.side(r,i)&&(l=e[a+=r?1:-1],o=l.side(!r,i));let h=r==(l.dir==i),c=d(t.text,o,h);if(Gi=t.text.slice(Math.min(o,c),Math.max(o,c)),c>l.from&&c0&&i.length&&(i.every((({fromA:t,toA:e})=>ethis.minWidthTo))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?n=this.domChanged.newSel.head:function(t,e){let i=!1;return e&&t.iterChangedRanges(((t,n)=>{te.from&&(i=!0)})),i}(t.changes,this.hasComposition)||t.selectionSet||(n=t.state.selection.main.head));let r=n>-1?function(t,e,i){let n=Qi(t,i);if(!n)return null;let{node:r,from:s,to:o}=n,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(t.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc,h=new Li(l.mapPos(s),l.mapPos(o),s,o),c=[];for(let e=r.parentNode;;e=e.parentNode){let i=we.get(e);if(i instanceof Re)c.push({node:e,deco:i.mark});else{if(i instanceof Ke||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:h,text:r,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new Xe({inclusive:!0,attributes:$e(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:n}=this.hasComposition;i=new Li(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Pe.ie||Pe.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,i){let n=new tn;return Mt.compare(t,e,i,n),n.changes}(this.decorations,this.updateDeco(),t.changes);return i=Li.extendWithRanges(i,s),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:n}=this.view;n.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Pe.chrome||Pe.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||n.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((t=>t.flags&=-9));let r=[];if(this.view.viewport.from||this.view.viewport.to=0?n[t]:null;if(!e)break;let s,o,a,l,{fromA:h,toA:c,fromB:u,toB:f}=e;if(i&&i.range.fromBu){let t=ii.build(this.view.state.doc,u,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=ii.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);o=t.breakAtStart,a=t.openStart,l=e.openEnd;let n=this.compositionView(i);e.breakAtStart?n.breakAfter=1:e.content.length&&n.merge(n.length,n.length,e.content[0],!1,e.openStart,0)&&(n.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&n.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),s=t.content.concat(n).concat(e.content)}else({content:s,breakAtStart:o,openStart:a,openEnd:l}=ii.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=r.findPos(c,1),{i:m,off:g}=r.findPos(h,-1);be(this,m,g,d,p,s,o,a,l)}i&&this.fixCompositionDOM(i)}compositionView(t){let e=new Ne(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Re(i,[e],e.length);let i=new Ke;return i.append(e,0),i}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some((t=>7&t.flags))?1:0),this.markedForComposition.add(e);let i=we.get(t);i&&i!=e&&(i.dom=null),e.setDOM(t)},i=this.childPos(t.range.fromB,1),n=this.children[i.i];e(t.line,n);for(let r=t.marks.length-1;r>=-1;r--)i=n.childPos(i.off,1),n=n.children[i.i],e(r>=0?t.marks[r].node:t.text,n)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,r=!n&&Qt(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||e||r))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(o.anchor)),l=o.empty?a:this.moveToLine(this.domAtPos(o.head));if(Pe.gecko&&o.empty&&!this.hasComposition&&1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new me(t,0),s=!0}var h;let c=this.view.observer.selectionRange;!s&&c.focusNode&&te(a.node,a.offset,c.anchorNode,c.anchorOffset)&&te(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{Pe.android&&Pe.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=Yt(this.view.root);if(t)if(o.empty){if(Pe.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}var e,n;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new me(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new me(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Yt(t.root),{anchorNode:n,anchorOffset:r}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let s=Ke.find(this,e.head);if(!s)return;let o=s.posAtStart;if(e.head==o||e.head==o+s.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.top)return;let h=this.domAtPos(e.head+e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,r)}moveToLine(t){let e,i=this.dom;if(t.node!=i)return t;for(let n=t.offset;!e&&n=0;n--){let t=we.get(i.childNodes[n]);t instanceof Ke&&(e=t.domAtPos(t.length))}return e?new me(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=we.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e=0;s--){let o=this.children[s],a=r-o.breakAfter,l=a-o.length;if(at||o.covers(1))&&(!i||o instanceof Ke&&!(i instanceof Ke&&e>=0))&&(i=o,n=l),r=l}return i?i.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof Ke))return null;for(;n.children.length;){let{i:t,off:e}=n.childPos(i,1);for(;;t++){if(t==n.children.length)return null;if((n=n.children[t]).length)break}i=e}if(!(n instanceof Ne))return null;let r=d(n.text,i);if(r==i)return null;let s=ue(n.dom,i,r).getClientRects();for(let t=0;tMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Pi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),s){let e=h.dom.lastChild,n=e?Zt(e):[];if(n.length){let e=n[n.length-1],s=a?e.right-i.left:i.right-e.left;s>o&&(o=s,this.minWidth=r,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?Pi.RTL:Pi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof Ke){let e=t.measureTextSize();if(e)return e}let t,e,i,n=document.createElement("div");return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let r=Zt(n.firstChild)[0];t=n.getBoundingClientRect().height,e=r?r.width/27:7,i=r?r.height:t,n.remove()})),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ye(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let r=n==e.viewports.length?null:e.viewports[n],s=r?r.from-1:this.length;if(s>i){let n=(e.lineBlockAt(s).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(Ye.replace({widget:new Xi(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!r)break;i=r.to+1}return Ye.set(t)}updateDeco(){let t=this.view.state.facet(Ai).map(((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t));for(let e=t.length;ei.anchor?-1:1);if(!n)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,e.left),top:Math.min(n.top,e.top),right:Math.max(n.right,e.right),bottom:Math.max(n.bottom,e.bottom)});let r=Di(this.view),s={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:o,offsetHeight:a}=this.view.scrollDOM;!function(t,e,i,n,r,s,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,f=c==l.body,d=1,p=1;if(f)t=se(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:d,scaleY:p}=oe(c,e)),t={left:e.left,right:e.left+c.clientWidth*d,top:e.top,bottom:e.top+c.clientHeight*p}}let m=0,g=0;if("nearest"==r)e.top0&&e.bottom>t.bottom+g&&(g=e.bottom-t.bottom+g+o)):e.bottom>t.bottom&&(g=e.bottom-t.bottom+o,i<0&&e.top-g0&&e.right>t.right+m&&(m=e.right-t.right+m+s)):e.right>t.right&&(m=e.right-t.right+s,i<0&&e.left0))break;i=i.childNodes[n-1],n=ne(i)}if(i>=0)for(let n=t,r=e;;){if(3==n.nodeType)return{node:n,offset:r};if(!(1==n.nodeType&&r=0))break;n=n.childNodes[r],r=0}return null}let tn=class{constructor(){this.changes=[]}compareRange(t,e){ei(t,e,this.changes)}comparePoint(t,e){ei(t,e,this.changes)}};function en(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function nn(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function rn(t,e){return t.tope.top+1}function sn(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function an(t,e,i){let n,r,s,o,a,l,h,c,u=!1;for(let f=t.firstChild;f;f=f.nextSibling){let t=Zt(f);for(let d=0;dg||o==g&&s>m){n=f,r=p,s=m,o=g;let a=g?i0?d0)}0==m?i>p.bottom&&(!h||h.bottomp.top)&&(l=f,c=p):h&&rn(h,p)?h=on(h,p.bottom):c&&rn(c,p)&&(c=sn(c,p.top))}}if(h&&h.bottom>=i?(n=a,r=h):c&&c.top<=i&&(n=l,r=c),!n)return{node:t,offset:0};let f=Math.max(r.left,Math.min(r.right,e));return 3==n.nodeType?ln(n,f,i):u&&"false"!=n.contentEditable?an(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(r.left+r.right)/2?1:0)}}function ln(t,e,i){let n=t.nodeValue.length,r=-1,s=1e9,o=0;for(let a=0;ai?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c=(h.left+h.right)/2,n=i;if((Pe.chrome||Pe.gecko)&&ue(t,a).getBoundingClientRect().left==h.right&&(n=!i),c<=0)return{node:t,offset:a+(n?1:0)};r=a+(n?1:0),s=c}}}return{node:t,offset:r>-1?r:o>0?t.nodeValue.length:0}}function hn(t,e,i,n=-1){var r,s;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,f=u-l;if(f<0)return 0;if(f>h)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,r=!1;o=t.elementAtHeight(f),o.type!=Je.Text;)for(;f=n>0?o.bottom+e:o.top-e,!(f>=0&&f<=h);){if(r)return i?null:0;r=!0,n=-n}u=l+f;let d=o.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:cn(t,a,o,c,u);let p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,g=m.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=m.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let w,v=-1;if(g&&0!=(null===(r=t.docView.nearest(g))||void 0===r?void 0:r.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:w,offset:v}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:w,startOffset:v}=e),(!t.contentDOM.contains(w)||Pe.safari&&function(t,e,i){let n;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(let e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return!1;return ue(t,n-1,n).getBoundingClientRect().left>i}(w,v,c)||Pe.chrome&&function(t,e,i){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}return i-(1==t.nodeType?t.getBoundingClientRect():ue(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(w,v,c))&&(w=void 0))}if(!w||!t.docView.dom.contains(w)){let e=Ke.find(t.docView,d);if(!e)return f>o.top+o.height/2?o.to:o.from;({node:w,offset:v}=an(e.dom,c,u))}let y=t.docView.nearest(w);if(!y)return null;if(y.isWidget&&1==(null===(s=y.dom)||void 0===s?void 0:s.nodeType)){let t=y.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;s+=Math.floor((r-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+function(t,e,i,n){for(let n=0,r=0;;){if(r>=e)return n;if(n==t.length)break;r+=9==t.charCodeAt(n)?i-r%i:1,n=d(t,n)}return t.length}(o,s,t.state.tabSize)}function un(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type))for(let t of i.type)if(t.to>e||t.to==e&&(t.to==i.to||t.type==Je.Text))return t;return i}function fn(t,e,i,n){let r=t.state.doc.lineAt(e.head),s=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let a=e,l=null;;){let e=Ji(r,s,o,a,i),h=Gi;if(!e){if(r.number==(i?t.state.doc.lines:1))return a;h="\n",r=t.state.doc.line(r.number+(i?1:-1)),s=t.bidiSpans(r),e=B.cursor(i?r.from:r.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function dn(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,((t,r,s)=>{if(e>t&&ee(t))),i.from,e.head>i.from?-1:1);return n==i.from?i:B.cursor(n,nnull)),Pe.gecko&&function(t){jn.has(t)||(jn.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=we.get(n))&&i.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=wn(t),i=this.handlers,n=this.view.contentDOM;for(let t in e)if("scroll"!=t){let r=!e[t].handlers.length,s=i[t];s&&r!=!s.handlers.length&&(n.removeEventListener(t,this.handleEvent),s=null),s||n.addEventListener(t,this.handleEvent,{passive:r})}for(let t in i)"scroll"==t||e[t]||n.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()e.keyCode==t.keyCode)))&&!t.ctrlKey||yn.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(){let t=this.pendingIOSKey;return!!t&&(this.pendingIOSKey=void 0,fe(this.view.contentDOM,t.key,t.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Pe.safari&&!Pe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function gn(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(t){gi(i.state,t)}}}function wn(t){let e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec;if(t&&t.domEventHandlers)for(let n in t.domEventHandlers){let r=t.domEventHandlers[n];r&&i(n).handlers.push(gn(e.value,r))}if(t&&t.domEventObservers)for(let n in t.domEventObservers){let r=t.domEventObservers[n];r&&i(n).observers.push(gn(e.value,r))}}for(let t in Sn)i(t).handlers.push(Sn[t]);for(let t in An)i(t).observers.push(An[t]);return e}const vn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],yn="dthko",bn=[16,17,18,20,91,92,224,225];function kn(t){return.7*Math.max(0,t)+8}class xn{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){let e=t.ownerDocument;for(let i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}(t.contentDOM),this.atoms=t.state.facet(Mi).map((e=>e(t)));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(yt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(si);return i.length?i[0](e):Pe.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=Yt(t.root);if(!n||0==n.rangeCount)return!0;let r=n.getRangeAt(0).getClientRects();for(let t=0;t=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(t,e)||1!=In(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){var e,i,n;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,n=t,Math.max(Math.abs(i.clientX-n.clientX),Math.abs(i.clientY-n.clientY))<10))return;this.select(this.lastEvent=t);let r=0,s=0,o=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},a=Di(this.view);t.clientX-a.left<=o.left+6?r=-kn(o.left-t.clientX):t.clientX+a.right>=o.right-6&&(r=kn(t.clientX-o.right)),t.clientY-a.top<=o.top+6?s=-kn(o.top-t.clientY):t.clientY+a.bottom>=o.bottom-6&&(s=kn(t.clientY-o.bottom)),this.setScrollSpeed(r,s)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let i=0;ithis.select(this.lastEvent)),20)}}const Sn=Object.create(null),An=Object.create(null),Mn=Pe.ie&&Pe.ie_version<15||Pe.ios&&Pe.webkit_version<604;function Cn(t,e){let i,{state:n}=t,r=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(null!=Hn&&n.selection.ranges.every((t=>t.empty))&&Hn==s.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?s.line(r++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:B.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=s.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:B.cursor(t.from+e.length)}})):n.replaceSelection(s);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Tn(t,e,i,n){if(1==n)return B.cursor(e,i);if(2==n)return function(t,e,i=1){let n=t.charCategorizer(e),r=t.doc.lineAt(e),s=e-r.from;if(0==r.length)return B.cursor(e);0==s?i=1:s==r.length&&(i=-1);let o=s,a=s;i<0?o=d(r.text,s,!1):a=d(r.text,s);let l=n(r.text.slice(o,a));for(;o>0;){let t=d(r.text,o,!1);if(n(r.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Sn.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1),An.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},An.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Sn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(ai))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Ln(t,e),n=In(e),r=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes))},get(e,s,o){let a,l=Ln(t,e),h=Tn(t,l.pos,l.bias,n);if(i.pos!=l.pos&&!s){let e=Tn(t,i.pos,i.bias,n),r=Math.min(e.from,h.from),s=Math.max(e.to,h.to);h=r1&&(a=function(t,e){for(let i=0;i=e)return B.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(r,l.pos))?a:o?r.addRange(h):B.create([h])}}}(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new xn(t,e,i,n)),n&&t.observer.ignore((()=>ce(t.contentDOM)));let r=t.inputState.mouseSelection;if(r)return r.start(e),!1===r.dragging}return!1};let On=(t,e)=>t>=e.top&&t<=e.bottom,Dn=(t,e,i)=>On(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let r=Ke.find(t.docView,e);if(!r)return 1;let s=e-r.posAtStart;if(0==s)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&Dn(i,n,o))return-1;let a=r.coordsAt(s,1);return a&&Dn(i,n,a)?1:o&&On(n,o)?-1:1}function Ln(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Bn=Pe.ie&&Pe.ie_version<=11;let Pn=null,Nn=0,Rn=0;function In(t){if(!Bn)return t.detail;let e=Pn,i=Rn;return Pn=t,Rn=Date.now(),Nn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nn+1)%3:1}function zn(t,e,i,n){if(!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=n&&s&&function(t,e){let i=t.state.facet(oi);return i.length?i[0](e):Pe.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.from,to:s.to}:null,a={from:r,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Sn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let n=t.docView.nearest(e.target);if(n&&n.isWidget){let t=n.posAtStart,e=t+n.length;(t>=i.to||e<=i.from)&&(i=B.range(t,e))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1},Sn.dragend=t=>(t.inputState.draggedContent=null,!1),Sn.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),r=0,s=()=>{++r==i.length&&zn(t,e,n.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),s()},e.readAsText(i[t])}return!0}{let i=e.dataTransfer.getData("Text");if(i)return zn(t,e,i,!0),!0}return!1},Sn.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Mn?null:e.clipboardData;return i?(Cn(t,i.getData("text/plain")||i.getData("text/uri-text")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{t.focus(),i.remove(),Cn(t,i.value)}),50)}(t),!1)};let Hn=null;Sn.copy=Sn.cut=(t,e)=>{let{text:i,ranges:n,linewise:r}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let r=-1;for(let{from:n}of t.selection.ranges){let s=t.doc.lineAt(n);s.number>r&&(e.push(s.text),i.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),r=s.number}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state);if(!i&&!r)return!1;Hn=r?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=Mn?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",i),!0):(function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout((()=>{n.remove(),t.focus()}),50)}(t,i),!1)};const Vn=st.define();function Wn(t,e){let i=[];for(let n of t.facet(ui)){let r=n(t,e);r&&i.push(r)}return i?t.update({effects:i,annotations:Vn.of(!0)}):null}function Fn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=Wn(t.state,e);i?t.dispatch(i):t.update([])}}),10)}An.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Fn(t)},An.blur=t=>{t.observer.clearSelectionRange(),Fn(t)},An.compositionstart=An.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},An.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Pe.chrome&&Pe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},An.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Sn.beforeinput=(t,e)=>{var i;let n;if(Pe.chrome&&Pe.android&&(n=vn.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(n.key,n.keyCode),"Backspace"==n.key||"Delete"==n.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}return!1};const jn=new Set,_n=["pre-wrap","normal","pre-line","break-spaces"];class qn{constructor(e){this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return _n.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=r,a){this.heightSamples={};for(let t=0;t0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>Gn&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Jn.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let r=this,s=i.doc;for(let o=n.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:h,toB:c}=n[o],u=r.lineAt(a,Un.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=l?u:r.lineAt(l,Un.ByPosNoHeight,i,0,0);for(c+=f.to-l,l=f.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*r){let r=t[e-1];r.break?t.splice(--e,1,r.left,null,r.right):t.splice(--e,1,r.left,r.right),i+=1+r.break,n-=r.size}else{if(!(r>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,r-=e.size}}else if(n=r&&s(this.blockAt(0,i,n,r))}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Xn extends Yn{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new Kn(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Xn||n instanceof Qn&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Qn?n=new Xn(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Jn.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Qn extends Jn{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,s=r-n+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*s);i=e/s,this.length>s+1&&(o=(this.height-e)/(this.length-s-1))}else i=this.height/s;return{firstLine:n,lastLine:r,perLine:i,perChar:o}}blockAt(t,e,i,n){let{firstLine:r,lastLine:s,perLine:o,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let r=n+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),s=e.doc.lineAt(r),l=o+s.length*a,h=Math.max(i,t-l/2);return new Kn(s.from,s.length,h,l,0)}{let n=Math.max(0,Math.min(s-r,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(r+n);return new Kn(a,l,i+o*n,o,0)}}lineAt(t,e,i,n,r){if(e==Un.ByHeight)return this.blockAt(t,i,n,r);if(e==Un.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Kn(e,n-e,0,0,0)}let{firstLine:s,perLine:o,perChar:a}=this.heightMetrics(i,r),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-s,u=n+o*c+a*(l.from-r-c);return new Kn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,0)}forEachLine(t,e,i,n,r,s){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(i,r);for(let h=t,c=n;h<=e;){let e=i.doc.lineAt(h);if(h==t){let i=e.number-o;c+=a*i+l*(t-r-i)}let n=a+l*e.length;s(new Kn(e.from,e.length,c,n,0)),c+=n,h=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof Qn?i[i.length-1]=new Qn(t.length+n):i.push(null,new Qn(n-1))}if(t>0){let e=i[0];e instanceof Qn?i[0]=new Qn(t+e.length):i.unshift(new Qn(t-1),null)}return Jn.of(i)}decomposeLeft(t,e){e.push(new Qn(t-1),null)}decomposeRight(t,e){e.push(null,new Qn(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let r=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],s=Math.max(e,n.from),o=-1;for(n.from>e&&i.push(new Qn(n.from-e-1).updateHeight(t,e));s<=r&&n.more;){let e=t.doc.lineAt(s).length;i.length&&i.push(null);let r=n.heights[n.index++];-1==o?o=r:Math.abs(r-o)>=Gn&&(o=-2);let a=new Xn(e,r);a.outdated=!1,i.push(a),s+=e+1}s<=r&&i.push(null,new Qn(r-s).updateHeight(t,s));let a=Jn.of(i);return(o<0||Math.abs(a.height-this.height)>=Gn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Gn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Zn extends Jn{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let r=i+this.left.height;return to))return l;let h=e==Un.ByPosNoHeight?Un.ByPosNoHeight:Un.ByPos;return a?l.join(this.right.lineAt(o,h,i,s,o)):this.left.lineAt(o,h,i,n,r).join(l)}forEachLine(t,e,i,n,r,s){let o=n+this.left.height,a=r+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,s);else{let l=this.lineAt(a,Un.ByPos,i,n,r);t=t&&l.from<=e&&s(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,s)}}replace(t,e,i){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let r=[];t>0&&this.decomposeLeft(t,r);let s=r.length;for(let t of i)r.push(t);if(t>0&&tr(r,s-1),e=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Jn.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:r,right:s}=this,o=e+r.length+this.break,a=null;return n&&n.from<=e+r.length&&n.more?a=r=r.updateHeight(t,e,i,n):r.updateHeight(t,e,i),n&&n.from<=o+s.length&&n.more?a=s=s.updateHeight(t,o,i,n):s.updateHeight(t,o,i),a?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function tr(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Qn&&(n=t[e+1])instanceof Qn&&t.splice(e-1,3,new Qn(i.length+1+n.length))}class er{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Xn?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Xn(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(n,r,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Xn(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new Qn(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Xn)return t;let e=new Xn(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Xn||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();s=Math.max(s,n.left),o=Math.min(o,n.right),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:s-i.left,right:Math.max(s,o)-i.left,top:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function rr(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class sr{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new qn(i),this.stateDeco=e.facet(Ai).filter((t=>"function"!=typeof t)),this.heightMap=Jn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Li(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ye.set(this.lineGaps.map((t=>t.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some((({from:t,to:e})=>n>=t&&n<=e))){let{from:e,to:i}=this.lineBlockAt(n);t.push(new lr(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?fr:new dr(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(t=>{this.viewportLines.push(1==this.scaler.scale?t:pr(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ai).filter((t=>"function"!=typeof t));let n=t.changedRanges,r=Li.extendWithRanges(n,function(t,e,i){let n=new ir;return Mt.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=s&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let l=!t.changes.empty||2&t.flags||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),l&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(di)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Pi.RTL:Pi.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0;if(a.width&&a.height){let{scaleX:t,scaleY:e}=oe(i,a);this.scaleX==t&&this.scaleY==e||(this.scaleX=t,this.scaleY=e,h|=8,o=l=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==f||(this.paddingTop=u,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=pe(e.scrollDOM);let p=(this.printing?rr:nr)(i,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let v=a.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(i)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&r.refresh(s,t,n,a,v/n,i),o&&(e.docView.minWidth=0,h|=8)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),r.heightChanged=!1;for(let n of this.viewports){let s=n.from==this.viewport.from?i:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Jn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new Li(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new $n(n.from,s))}r.heightChanged&&(h|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,a=new lr(n.lineAt(s-1e3*i,Un.ByHeight,r,0,0).from,n.lineAt(o+1e3*(1-i),Un.ByHeight,r,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Un.ByPos,r,0,0);i="center"==e.y?(o.top+o.bottom)/2-s/2:"start"==e.y||"nearest"==e.y&&t=o+Math.max(10,Math.min(i,250)))&&n>s-2e3&&r>1,s=n<<1;if(this.defaultTextDirection!=Pi.LTR&&!i)return[];let o=[],a=(n,s,l,h)=>{if(s-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!f){if(st.from<=s&&t.to>=s))){let t=e.moveToLineBoundary(B.cursor(s),!1,!0).head;t>n&&(s=t)}f=new sr(n,s,this.gapSize(l,n,s,h))}o.push(f)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,r,t,e),ot.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];Mt.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some(((t,i)=>t.from!=e[i].from||t.to!=e[i].to));return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((e=>e.from<=t&&e.to>=t))||pr(this.heightMap.lineAt(t,Un.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return pr(this.heightMap.lineAt(this.scaler.fromDOM(t),Un.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return pr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class lr{constructor(t,e){this.from=t,this.to=e}}function hr(t,e,i){let n=[],r=t,s=0;return Mt.spans(i,t,e,{span(){},point(t,e){t>r&&(n.push({from:r,to:t}),s+=t-r),r=e}},20),r=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:r}=e[t],s=r-i;if(n<=s)return i+n;n-=s}}function ur(t,e){let i=0;for(let{from:n,to:r}of t.ranges){if(e<=r){i+=e-n;break}i+=r-n}return i/t.total}const fr={toDOM:t=>t,fromDOM:t=>t,scale:1};class dr{constructor(t,e,i){let n=0,r=0,s=0;this.viewports=i.map((({from:i,to:r})=>{let s=e.lineAt(i,Un.ByPos,t,0,0).top,o=e.lineAt(r,Un.ByPos,t,0,0).bottom;return n+=o-s,{from:i,to:r,top:s,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-n)/(e.height-n);for(let t of this.viewports)t.domTop=s+(t.top-r)*this.scale,s=t.domBottom=t.domTop+(t.bottom-t.top),r=t.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let r=epr(t,e))):t._content)}const mr=R.define({combine:t=>t.join(" ")}),gr=R.define({combine:t=>t.indexOf(!0)>-1}),wr=Ft.newName(),vr=Ft.newName(),yr=Ft.newName(),br={"&light":"."+vr,"&dark":"."+yr};function kr(t,e,i){return new Ft(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]})):t+" "+e})}const xr=kr("."+wr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},br),Sr="￿";class Ar{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(yt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Sr}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let r=n.nextSibling;if(r==e)break;let s=we.get(n),o=we.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:Cr(n))||Cr(r)&&("BR"!=n.nodeName||n.cmIgnore)&&this.text.length>t)&&this.lineBreak(),n=r}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(r=n.exec(e))&&(s=r.index,o=r[0].length),this.append(e.slice(i,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);i=s+o}}readNode(t){if(t.cmIgnore)return;let e=we.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(Mr(t,i.node,i.offset)?e:0))}}function Mr(t,e,i){for(;;){if(!e||i-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let e=r||s?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}=t.observer.selectionRange;return i&&(e.push(new Tr(i,n)),r==i&&s==n||e.push(new Tr(r,s))),e}(t),i=new Ar(e,t.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,n=2==t.length?t[1].pos:i;return i>-1&&n>-1?B.single(i+e,n+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=r&&r.node==e.focusNode&&r.offset==e.focusOffset||!Xt(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),n=s&&s.node==e.anchorNode&&s.offset==e.anchorOffset||!Xt(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=B.single(n,i)}}}function Dr(e,i){let n,{newSel:r}=i,s=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(i.bounds){let{from:r,to:a}=i.bounds,l=s.from,h=null;(8===o||Pe.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;return"end"==n&&(i-=o+Math.max(0,s-Math.min(o,a))-s),o=o?s-i:0,a=s+(a-o),o=s):a=a?s-i:0,o=s+(o-a),a=s),{from:s,toA:o,toB:a}}(e.state.doc.sliceString(r,a,Sr),i.text,l-r,h);c&&(Pe.chrome&&13==o&&c.toB==c.from+2&&i.text.slice(c.from,c.toB)==Sr+Sr&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:t.of(i.text.slice(c.from,c.toB).split(Sr))})}else r&&(!e.hasFocus&&e.state.facet(wi)||r.main.eq(s))&&(r=null);if(!n&&!r)return!1;if(!n&&i.typeOver&&!s.empty&&r&&r.main.empty?n={from:s.from,to:s.to,insert:e.state.doc.slice(s.from,s.to)}:n&&n.from>=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:e.state.doc.slice(s.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,s.to))}:(Pe.mac||Pe.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=B.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:t.of([" "])}):Pe.chrome&&n&&n.from==n.to&&n.from==s.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=B.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:t.of([" "])}),n){if(Pe.ios&&e.inputState.flushIOSKey())return!0;if(Pe.android&&(n.from==s.from&&n.to==s.to&&1==n.insert.length&&2==n.insert.lines&&fe(e.contentDOM,"Enter",13)||(n.from==s.from-1&&n.to==s.to&&0==n.insert.length||8==o&&n.insert.lengths.head)&&fe(e.contentDOM,"Backspace",8)||n.from==s.from&&n.to==s.to+1&&0==n.insert.length&&fe(e.contentDOM,"Delete",46)))return!0;let t,i=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>t||(t=function(t,e,i){let n,r=t.state,s=r.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=s.frome.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=r.changes(e),a=i&&i.main.to<=o.newLength?i.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let l,h=t.state.sliceDoc(e.from,e.to),c=i&&Qi(t,i.main.head);if(c){let t=e.insert.length-(e.to-e.from);l={from:c.from,to:c.to-t}}else l=t.state.doc.lineAt(s.head);let u=s.to-e.to,f=s.to-s.from;n=r.changeByRange((i=>{if(i.from==s.from&&i.to==s.to)return{changes:o,range:a||i.map(o)};let n=i.to-u,c=n-h.length;if(i.to-i.from!=f||t.state.sliceDoc(c,n)!=h||i.to>=l.from&&i.from<=l.to)return{range:i};let d=r.changes({from:c,to:n,insert:e.insert}),p=i.to-s.to;return{changes:d,range:a?B.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(d)}}))}else n={changes:o,selection:a&&r.selection.replaceRange(a)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:o,scrollIntoView:!0})}(e,n,r));return e.state.facet(ci).some((t=>t(e,n.from,n.to,i,a)))||e.dispatch(a()),!0}if(r&&!r.main.eq(s)){let t=!1,i="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:r,scrollIntoView:t,userEvent:i}),!0}return!1}const Er={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Lr=Pe.ie&&Pe.ie_version<=11;class Br{constructor(t){this.view=t,this.active=!1,this.selectionRange=new ae,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);(Pe.ie&&Pe.ie_version<=11||Pe.ios&&t.composing)&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),Lr&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(((e,i)=>e!=t[i])))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(wi)?i.root.activeElement!=this.dom:!Qt(i.dom,n))return;let r=n.anchorNode&&i.docView.nearest(n.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Pe.ie&&Pe.ie_version<=11||Pe.android&&Pe.chrome)&&!i.state.selection.main.empty&&n.focusNode&&te(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Pe.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let n=e.startContainer,r=e.startOffset,s=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return te(a.node,a.offset,s,o)&&([n,r,s,o]=[s,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:o}}(this.view)||Yt(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=Qt(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&fe(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let r of t){let t=this.readMutation(r);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Qt(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Or(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=Dr(this.view,e);return this.view.state==i&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let i=Pr(e,t.previousSibling||t.target.previousSibling,-1),n=Pr(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Pr(t,e,i){for(;e;){let n=we.get(e);if(n&&n.parent==t)return n;let r=e.parentNode;e=r!=t.dom?r:i>0?e.nextSibling:e.previousSibling}return null}class Nr{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(t=>t.forEach((t=>e(t,this))))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new ar(t.state||yt.create(t)),t.scrollTo&&t.scrollTo.is(mi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(yi).map((t=>new ki(t)));for(let t of this.plugins)t.update(this);this.observer=new Br(this),this.inputState=new mn(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Yi(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}dispatch(...t){let e=1==t.length&&t[0]instanceof ht?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,n=!1,r=this.state;for(let e of t){if(e.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,a=null;t.some((t=>t.annotation(Vn)))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=Wn(r,s),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(yt.phrases)!=this.state.facet(yt.phrases))return this.setState(r);e=Bi.create(this,r,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new pi(t.empty?t:B.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(mi)&&(c=t.value.clip(this.state))}this.viewState.update(e,c),this.bidiCache=zr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Ei)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(mr)!=e.state.facet(mr)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(hi))try{t(e)}catch(t){gi(this.state,t,"update listener")}(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Dr(this,h)&&l.force&&fe(this.contentDOM,l.key,l.keyCode)}))}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new ar(t),this.plugins=t.facet(yi).map((t=>new ki(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new Yi(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(yi),i=t.state.facet(yi);if(e!=i){let n=[];for(let r of i){let i=e.indexOf(r);if(i<0)n.push(new ki(r));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(s<0)if(pe(i))r=-1,s=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);r=t.from,s=t.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((t=>{try{return t.read(this)}catch(t){return gi(this.state,t),Ir}})),h=Bi.create(this,this.state,[]),c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h));for(let t=0;t1||t<-1){n+=t,i.scrollTop=n/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(hi))t(e)}get themeClasses(){return wr+" "+(this.state.facet(gr)?yr:vr)+" "+this.state.facet(mr)}updateAttrs(){let t=Hr(this,xi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(wi)?"true":"false",class:"cm-content",style:`${Pe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Hr(this,Si,e);let i=this.observer.ignore((()=>{let i=qe(this.contentDOM,this.contentAttrs,e),n=qe(this.dom,this.editorAttrs,t);return i||n}));return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)t.is(Nr.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(Ei);let t=this.state.facet(Nr.cspNonce);Ft.mount(this.root,this.styleModules.concat(xr).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;ee.spec==t))||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return pn(this,t,fn(this,t,e,i))}moveByGroup(t,e){return pn(this,t,fn(this,t,e,(e=>function(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return t=>{let e=n(t);return r==gt.Space&&(r=e),r==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let r=un(t,e.head),s=n&&r.type==Je.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(s){let e=t.dom.getBoundingClientRect(),n=t.textDirectionAt(r.from),o=t.posAtCoords({x:i==(n==Pi.LTR)?e.right-1:e.left+1,y:(s.top+s.bottom)/2});if(null!=o)return B.cursor(o,i?-1:1)}return B.cursor(i?r.to:r.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return pn(this,t,function(t,e,i,n){let r=e.head,s=i?1:-1;if(r==(i?t.state.doc.length:0))return B.cursor(r,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=s<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(r);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(r-e.from))),o=(s<0?e.top:e.bottom)+c}let u=l.left+a,f=null!=n?n:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let i=o+(f+e)*s,n=hn(t,{x:u,y:i},!1,s);if(il.bottom||(s<0?nr)){let e=t.docView.coordsForChar(n),r=!e||i0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(fi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rr)return Ui(t.length);let e,i=this.textDirectionAt(t.from);for(let n of this.bidiCache)if(n.from==t.from&&n.dir==i&&(n.fresh||_i(n.isolates,e=Ti(this,t.from,t.to))))return n.order;e||(e=Ti(this,t.from,t.to));let n=function(t,e,i){if(!t)return[new ji(0,0,e==Ri?1:0)];if(e==Ni&&!i.length&&!Fi.test(t))return Ui(t.length);if(i.length)for(;t.length>qi.length;)qi[qi.length]=256;let n=[],r=e==Ni?0:1;return Ki(t,r,r,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new zr(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Pe.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ce(this.contentDOM),this.docView.updateSelection()}))}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return mi.of(new pi("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return mi.of(new pi(B.cursor(i.from),"start","start",i.top-t,e,!0))}static domEventHandlers(t){return bi.define((()=>({})),{eventHandlers:t})}static domEventObservers(t){return bi.define((()=>({})),{eventObservers:t})}static theme(t,e){let i=Ft.newName(),n=[mr.of(i),Ei.of(kr(`.${i}`,t))];return e&&e.dark&&n.push(gr.of(!0)),n}static baseTheme(t){return q.lowest(Ei.of(kr("."+wr,t,br)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&we.get(i)||we.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Nr.styleModule=Ei,Nr.inputHandler=ci,Nr.focusChangeEffect=ui,Nr.perLineTextDirection=fi,Nr.exceptionSink=li,Nr.updateListener=hi,Nr.editable=wi,Nr.mouseSelectionStyle=ai,Nr.dragMovesSelection=oi,Nr.clickAddsSelectionRange=si,Nr.decorations=Ai,Nr.atomicRanges=Mi,Nr.bidiIsolatedRanges=Ci,Nr.scrollMargins=Oi,Nr.darkTheme=gr,Nr.cspNonce=R.define({combine:t=>t.length?t[0]:""}),Nr.contentAttributes=Si,Nr.editorAttributes=xi,Nr.lineWrapping=Nr.contentAttributes.of({class:"cm-lineWrapping"}),Nr.announce=lt.define();const Rr=4096,Ir={};class zr{constructor(t,e,i,n,r,s){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=r,this.order=s}static update(t,e){if(e.empty&&!t.some((t=>t.fresh)))return t;let i=[],n=t.length?t[t.length-1].dir:Pi.LTR;for(let r=Math.max(0,t.length-10);r=0;r--){let e=n[r],s="function"==typeof e?e(t):e;s&&Fe(s,i)}return i}const Vr=Pe.mac?"mac":Pe.windows?"win":Pe.linux?"linux":"key";function Wr(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const Fr=q.default(Nr.domEventHandlers({keydown:(t,e)=>Ur(qr(e.state),t,e,"editor")})),jr=R.define({enables:Fr}),_r=new WeakMap;function qr(t){let e=t.facet(jr),i=_r.get(e);return i||_r.set(e,i=function(t,e=Vr){let i=Object.create(null),n=Object.create(null),r=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=(t,n,s,o,a)=>{var l,h;let c=i[t]||(i[t]=Object.create(null)),u=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,r,s,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=$r={view:e,prefix:i,scope:t};return setTimeout((()=>{$r==n&&($r=null)}),Kr),!0}]})}let f=u.join(" ");r(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(l=c._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});s&&d.run.push(s),o&&(d.preventDefault=!0),a&&(d.stopPropagation=!0)};for(let n of t){let t=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let e in t)t[e].run.push(n.any)}let r=n[e]||n.key;if(r)for(let e of t)s(e,r,n.run,n.preventDefault,n.stopPropagation),n.shift&&s(e,"Shift-"+r,n.shift,n.preventDefault,n.stopPropagation)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let $r=null;const Kr=4e3;function Ur(t,e,i,n){let r=function(t){var e=!(Kt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Ut&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?$t:qt)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),s=b(v(r,0))==r.length&&" "!=r,o="",a=!1,l=!1,h=!1;$r&&$r.view==i&&$r.scope==n&&(o=$r.prefix+" ",bn.indexOf(e.keyCode)<0&&(l=!0,$r=null));let c,u,f=new Set,d=t=>{if(t){for(let n of t.run)if(!f.has(n)&&(f.add(n),n(i,e)))return t.stopPropagation&&(h=!0),!0;t.preventDefault&&(t.stopPropagation&&(h=!0),l=!0)}return!1},p=t[n];return p&&(d(p[o+Wr(r,e,!s)])?a=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Pe.windows&&e.ctrlKey&&e.altKey)&&(c=qt[e.keyCode])&&c!=r?(d(p[o+Wr(c,e,!0)])||e.shiftKey&&(u=$t[e.keyCode])!=r&&u!=c&&d(p[o+Wr(u,e,!1)]))&&(a=!0):s&&e.shiftKey&&d(p[o+Wr(r,e,!0)])&&(a=!0),!a&&d(p._any)&&(a=!0)),l&&(a=!0),a&&h&&e.stopPropagation(),a}class Gr{constructor(t,e,i,n,r){this.className=t,this.left=e,this.top=i,this.width=n,this.height=r}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=Jr(t);return[new Gr(e,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),s=t.textDirection==Pi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Jr(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=a.right-(c?parseInt(c.paddingRight):0),d=un(t,n),p=un(t,r),m=d.type==Je.Text?d:null,g=p.type==Je.Text?p:null;if(m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=Yr(t,n,m)),g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=Yr(t,r,g)),m&&g&&m.from==g.from)return v(y(i.from,i.to,m));{let e=m?y(i.from,null,m):b(d,!1),n=g?y(null,i.to,g):b(p,!0),r=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&e.bottom+t.defaultLineHeight/2h&&n.from=s)break;a>r&&l(Math.max(t,r),null==e&&t<=h,Math.min(a,s),null==i&&a>=c,o.dir)}if(r=n.to+1,r>=s)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:r,bottom:o,horizontal:a}}function b(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Jr(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Pi.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Yr(t,e,i){let n=B.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:Je.Text}}class Xr{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Qr)!=t.state.facet(Qr)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,i=t.facet(Qr);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Qr=R.define();function Zr(t){return[bi.define((e=>new Xr(e,t))),Qr.of(t)]}const ts=!Pe.ios,es=R.define({combine:t=>bt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function is(t={}){return[es.of(t),rs,os,ls,di.of(!0)]}function ns(t){return t.startState.facet(es)!=t.state.facet(es)}const rs=Zr({above:!0,markers(t){let{state:e}=t,i=e.facet(es),n=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty?!s||ts:i.drawRangeCursor){let e=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=r.empty?r:B.cursor(r.head,r.head>r.anchor?-1:1);for(let r of Gr.forRange(t,e,i))n.push(r)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=ns(t);return i&&ss(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){ss(e.state,t)},class:"cm-cursorLayer"});function ss(t,e){e.style.animationDuration=t.facet(es).cursorBlinkRate+"ms"}const os=Zr({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:Gr.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||ns(t),class:"cm-selectionLayer"}),as={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};ts&&(as[".cm-line"].caretColor="transparent !important",as[".cm-content"]={caretColor:"transparent !important"});const ls=q.highest(Nr.theme(as));function hs(t,e,i,n,r){e.lastIndex=0;for(let s,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;s=e.exec(o.value);)r(a+s.index,s)}class cs{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:r,maxLength:s=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,r)=>n(r,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,r)=>{let s=i(t,e,n);s&&r(n,n+t[0].length,s)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,r)=>r(n,n+t[0].length,i)}this.boundary=r,this.maxLength=s}createDeco(t){let e=new Ct,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:r,to:s}of i)r=Math.max(t.state.doc.lineAt(r).from,r-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=s:n.push({from:r,to:s});return n}(t,this.maxLength))hs(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,r,s,o)=>{o>t.view.viewport.from&&s1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let r of t.visibleRanges){let s=Math.max(r.from,i),o=Math.min(r.to,n);if(o>s){let i=t.state.doc.lineAt(s),n=i.toi.from;s--)if(this.boundary.test(i.text[s-1-i.from])){a=s;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const us=null!=/x/.unicode?"gu":"g",fs=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",us),ds={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let ps=null;const ms=R.define({combine(t){let e=bt(t,{render:null,specialChars:fs,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==ps&&"undefined"!=typeof document&&document.body){let e=document.body.style;ps=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return ps||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,us)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,us)),e}});let gs=null;class ws extends Ge{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(ds[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class vs extends Ge{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}const ys="-10000px";class bs{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t,e){var i;let n=t.state.facet(this.facet),r=n.filter((t=>t));if(n===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[],o=e?[]:null;for(let i=0;ie[i]=t)),e.length=o.length),this.input=n,this.tooltips=r,this.tooltipViews=s,!0}}function ks(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const xs=R.define({combine:t=>{var e,i,n;return{position:Pe.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||ks}}}),Ss=new WeakMap,As=bi.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(xs);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new bs(t,Ts,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(xs);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=ys,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,i=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(Pe.gecko)n=t.offsetParent!=this.container.ownerDocument.body;else if(1!=this.view.scaleX||1!=this.view.scaleY)n=!0;else if(t.style.top==ys&&"0px"==t.style.left){let e=t.getBoundingClientRect();n=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}}if(n||"absolute"==this.position)if(this.parent){let t=this.parent.getBoundingClientRect();t.width&&t.height&&(e=t.width/this.parent.offsetWidth,i=t.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:i}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(xs).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{editor:i,space:n,scaleX:r,scaleY:s}=t,o=[];for(let a=0;a=Math.min(i.bottom,n.bottom)||u.rightMath.min(i.right,n.right)+.1){c.style.top=ys;continue}let d=l.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,g=null!==(e=Ss.get(h))&&void 0!==e?e:f.bottom-f.top,w=h.offset||Cs,v=this.view.textDirection==Pi.LTR,y=f.width>n.right-n.left?v?n.left:n.right-f.width:v?Math.min(u.left-(d?14:0)+w.x,n.right-m):Math.max(n.left,u.left-m+(d?14:0)-w.x),b=this.above[a];!l.strictSide&&(b?u.top-(f.bottom-f.top)-w.yn.bottom)&&b==n.bottom-u.bottom>u.top-n.top&&(b=this.above[a]=!b);let k=(b?u.top-n.top:n.bottom-u.bottom)-p;if(ky&&t.topx&&(x=b?t.top-g-2-p:t.bottom+p+2);if("absolute"==this.position?(c.style.top=(x-t.parent.top)/s+"px",c.style.left=(y-t.parent.left)/r+"px"):(c.style.top=x/s+"px",c.style.left=y/r+"px"),d){let t=u.left+(v?w.x:-w.x)-(y+14-7);d.style.left=t/r+"px"}!0!==h.overlap&&o.push({left:y,top:x,right:S,bottom:x+g}),c.classList.toggle("cm-tooltip-above",b),c.classList.toggle("cm-tooltip-below",!b),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ys}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Ms=Nr.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Cs={x:0,y:0},Ts=R.define({enables:[As,Ms]}),Os=R.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function Ds(t,e){let i=t.plugin(Es),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Es=bi.fromClass(class{constructor(t){this.input=t.state.facet(Ps),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Os);this.top=new Ls(t,!0,e.topContainer),this.bottom=new Ls(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(Os);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ls(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ls(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ps);if(i!=this.input){let e=i.filter((t=>t)),n=[],r=[],s=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],e.update&&e.update(t)),n.push(e),(e.top?r:s).push(e)}this.specs=e,this.panels=n,this.top.sync(r),this.bottom.sync(s);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Nr.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Ls{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Bs(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Bs(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Bs(t){let e=t.nextSibling;return t.remove(),e}const Ps=R.define({enables:Es});class Ns extends kt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Ns.prototype.elementClass="",Ns.prototype.toDOM=void 0,Ns.prototype.mapMode=x.TrackBefore,Ns.prototype.startSide=Ns.prototype.endSide=-1,Ns.prototype.point=!0;const Rs=R.define(),Is=R.define(),zs=R.define({combine:t=>t.some((t=>t))});function Hs(t){let e=[Vs];return t&&!1===t.fixed&&e.push(zs.of(!0)),e}const Vs=bi.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Is).map((e=>new _s(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(zs),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(zs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=Mt.iter(this.view.state.facet(Rs),this.view.viewport.from),n=[],r=this.gutters.map((t=>new js(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(t.type)){let e=!0;for(let s of t.type)if(s.type==Je.Text&&e){Fs(i,n,s.from);for(let t of r)t.line(this.view,s,n);e=!1}else if(s.widget)for(let t of r)t.widget(this.view,s)}else if(t.type==Je.Text){Fs(i,n,t.from);for(let e of r)e.line(this.view,t,n)}else if(t.widget)for(let e of r)e.widget(this.view,t);for(let t of r)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Is),i=t.state.facet(Is),n=t.docChanged||t.heightChanged||t.viewportChanged||!Mt.eq(t.startState.facet(Rs),t.state.facet(Rs),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(n=!0);else{n=!0;let r=[];for(let n of i){let i=e.indexOf(n);i<0?r.push(new _s(this.view,n)):(this.gutters[i].update(t),r.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),r.indexOf(t)<0&&t.destroy();for(let t of r)this.dom.appendChild(t.dom);this.gutters=r}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>Nr.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Pi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function Ws(t){return Array.isArray(t)?t:[t]}function Fs(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class js{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Mt.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,r=(e.top-this.height)/t.scaleY,s=e.height/t.scaleY;if(this.i==n.elements.length){let e=new qs(t,s,r,i);n.elements.push(e),n.dom.appendChild(e.dom)}else n.elements[this.i].update(t,s,r,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];Fs(this.cursor,n,e.from),i.length&&(n=n.concat(i));let r=this.gutter.config.lineMarker(t,e,n);r&&n.unshift(r);let s=this.gutter;(0!=n.length||s.config.renderEmptyElements)&&this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class _s{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,(n=>{let r,s=n.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let t=s.getBoundingClientRect();r=(t.top+t.bottom)/2}else r=n.clientY;let o=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[i](t,o,n)&&n.preventDefault()}));this.markers=Ws(e.markers(t)),e.initialSpacer&&(this.spacer=new qs(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Ws(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!Mt.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class qs{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;ibt(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let n=i[t],r=e[t];i[t]=n?(t,e,i)=>n(t,e,i)||r(t,e,i):r}return i}})});class Us extends Ns{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Gs(t,e){return t.state.facet(Ks).formatNumber(e,t.state)}const Js=Is.compute([Ks],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet($s),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new Us(Gs(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Ks)!=t.state.facet(Ks),initialSpacer:t=>new Us(Gs(t,Ys(t.state.doc.lines))),updateSpacer(t,e){let i=Gs(e.view,Ys(e.view.state.doc.lines));return i==t.number?t:new Us(i)},domEventHandlers:t.facet(Ks).domEventHandlers})));function Ys(t){let e=9;for(;et.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?(this.view.dispatch(this.view.state.changeByRange((function(e){return{changes:[{from:e.from,insert:t.pre},{from:e.to,insert:t.post}],range:B.range(e.to+t.pre.length+t.post.length,e.to+t.pre.length+t.post.length)}}))),this.$cmDom):(this.replaceSelection(r),i&&t.selectPeri?this.setSelection({start:n+t.pre.length,end:n+t.pre.length+e.length}):this.setSelection({start:n+r.length}),this.$cmDom)}}],i&&Zs(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const io=1024;let no=0;class ro{constructor(t,e){this.from=t,this.to=e}}class so{constructor(t={}){this.id=no++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=lo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}so.closedBy=new so({deserialize:t=>t.split(" ")}),so.openedBy=new so({deserialize:t=>t.split(" ")}),so.group=new so({deserialize:t=>t.split(" ")}),so.isolate=new so({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),so.contextHash=new so({perNode:!0}),so.lookAhead=new so({perNode:!0}),so.mounted=new so({perNode:!0});class oo{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[so.mounted.id]}}const ao=Object.create(null);class lo{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):ao,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new lo(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(so.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(so.group),n=-1;n<(i?i.length:0);n++){let r=e[n<0?t.name:i[n]];if(r)return r}}}}lo.none=new lo("",Object.create(null),0,8);class ho{constructor(t){this.types=t;for(let e=0;e=e){let o=new bo(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[n])).push(vo(o,e,i,!1))}}return r?Mo(r):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,s=t.mode||0,o=(s&fo.IncludeAnonymous)>0;for(let t=this.cursor(s|fo.IncludeAnonymous);;){let s=!1;if(t.from<=r&&t.to>=n&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;s=!0}for(;s&&i&&(o||!t.type.isAnonymous)&&i(t),!t.nextSibling();){if(!t.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Lo(lo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new po(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new po(lo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=io,reused:s=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new mo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,g,w,v){let{id:y,start:b,end:k,size:x}=a,S=c;for(;x<0;){if(a.next(),-1==x){let e=s[y];return i.push(e),void g.push(b-t)}if(-3==x)return void(h=y);if(-4==x)return void(c=y);throw new RangeError(`Unrecognized record size: ${x}`)}let A,M,C=l[y],T=b-t;if(k-b<=r&&(M=function(t,e){let i=a.fork(),n=0,s=0,l=0,h=i.end-r,c={size:0,start:0,skip:0};t:for(let r=i.pos-t;i.pos>r;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=s,c.skip=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,f=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}s=f,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=s,c.skip=l),c.size>4?c:void 0}(a.pos-e,w))){let e=new Uint16Array(M.size-M.skip),i=a.pos-M.size,r=e.length;for(;a.pos>i;)r=m(M.start,e,r);A=new go(e,k-M.start,n),T=M.start-t}else{let t=a.pos-x;a.next();let e=[],i=[],n=y>=o?y:-1,s=0,l=k;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-r&&(d(e,i,b,s,a.end,l,n,S),s=e.length,l=a.end),a.next()):v>2500?f(b,t,e,i):u(b,t,e,i,n,v+1);if(n>=0&&s>0&&s-1&&s>0){let t=function(t){return(e,i,n)=>{let r,s,o=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof po){if(!a&&r.type==t&&r.length==n)return r;(s=r.prop(so.lookAhead))&&(o=i[a]+r.length+s)}return p(t,e,i,n,o)}}(C);A=Lo(C,e,i,0,e.length,0,k-b,t,t)}else A=p(C,e,i,k-b,S-k)}i.push(A),g.push(T)}function f(t,e,i,s){let o=[],l=0,h=-1;for(;a.pos>e;){let{id:t,start:e,end:i,size:n}=a;if(n>4)a.next();else{if(h>-1&&e=0;t-=3)e[i++]=o[t],e[i++]=o[t+1]-r,e[i++]=o[t+2]-r,e[i++]=i;i.push(new go(e,o[2]-r,n)),s.push(r-t)}}function d(t,e,i,r,s,o,a,l){let h=[],c=[];for(;t.length>r;)h.push(t.pop()),c.push(e.pop()+i-s);t.push(p(n.types[a],h,c,o-s,l-o)),e.push(s-i)}function p(t,e,i,n,r=0,s){if(h){let t=[so.contextHash,h];s=s?[t].concat(s):[t]}if(r>25){let t=[so.lookAhead,r];s=s?[t].concat(s):[t]}return new po(t,e,i,n,s)}function m(t,e,i){let{id:n,start:r,end:s,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=m(t,e,i)}e[--i]=o,e[--i]=s-t,e[--i]=r-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let g=[],w=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,g,w,-1,0);let v=null!==(e=t.length)&&void 0!==e?e:g.length?w[0]+g[0].length:0;return new po(l[t.topID],g.reverse(),w.reverse(),v)}(t)}}po.empty=new po(lo.none,[],[],0);class mo{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new mo(this.buffer,this.index)}}class go{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return lo.none}toString(){let t=[];for(let e=0;e0));a=s[a+3]);return o}slice(t,e,i){let n=this.buffer,r=new Uint16Array(e-t),s=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function vo(t,e,i,n){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?o.length:-1;t!=l;t+=e){let l=o[t],h=a[t]+s.from;if(wo(n,i,h,h+l.length))if(l instanceof go){if(r&fo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Ao(new So(s,l,t,h),null,o)}else if(r&fo.IncludeAnonymous||!l.type.isAnonymous||Oo(l)){let o;if(!(r&fo.IgnoreMounts)&&(o=oo.get(l))&&!o.overlay)return new bo(o.tree,h,t,s);let a=new bo(l,h,t,s);return r&fo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(r&fo.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+e:e<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,i=0){let n;if(!(i&fo.IgnoreOverlays)&&(n=oo.get(this._tree))&&n.overlay){let i=t-this.from;for(let{from:t,to:r}of n.overlay)if((e>0?t<=i:t=i:r>i))return new bo(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ko(t,e,i,n){let r=t.cursor(),s=[];if(!r.firstChild())return s;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return s;for(;;){if(null!=n&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return null==n?s:[]}}function xo(t,e,i=e.length-1){for(let n=t.parent;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class So{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Ao extends yo{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new Ao(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i=0){if(i&fo.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Ao(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Ao(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Ao(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let s=i.buffer[this.index+1];t.push(i.slice(n,r,s)),e.push(0)}return new po(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Mo(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;ni.from||r.to0){if(this.index-1)for(let n=e+t,r=t<0?-1:i._tree.children.length;n!=r;n+=t){let t=i._tree.children[n];if(this.mode&fo.IncludeAnonymous||t instanceof go||!t.type.isAnonymous||Oo(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let s=t;s;s=s._parent)if(s.index==n){if(n==this.index)return s;e=s,i=r+1;break t}n=this.stack[--r]}for(let t=i;t=0;r--){if(r<0)return xo(this.node,t,n);let s=i[e.buffer[this.stack[r]]];if(!s.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}}function Oo(t){return t.children.some((t=>t instanceof go||!t.type.isAnonymous||Oo(t)))}const Do=new WeakMap;function Eo(t,e){if(!t.isAnonymous||e instanceof go||e.type!=t)return 1;let i=Do.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof po)){i=1;break}i+=Eo(t,n)}Do.set(e,i)}return i}function Lo(t,e,i,n,r,s,o,a,l){let h=0;for(let i=n;i=c)break;p+=e}if(h==r+1){if(p>c){let t=i[r];e(t.children,t.positions,0,t.children.length,n[r]+a);continue}u.push(i[r])}else{let e=n[h-1]+i[h-1].length-d;u.push(Lo(t,i,n,r,h,d,e,null,l))}f.push(d+a-s)}}(e,i,n,r,0),(a||l)(u,f,o)}class Bo{constructor(t,e,i,n,r=!1,s=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new Bo(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],r=1,s=t.length?t[0]:null;for(let o=0,a=0,l=0;;o++){let h=o=i)for(;s&&s.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Bo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),s.to>c)break;s=rnew ro(t.from,t.to))):[new ro(0,0)]:[new ro(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class No{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new so({perNode:!0});let Ro=0;class Io{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ro++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Io([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new Ho;return e=>e.modified.indexOf(t)>-1?e:Ho.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let zo=0;class Ho{constructor(){this.instances=[],this.id=zo++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find((i=>{return i.base==t&&(n=e,r=i.modified,n.length==r.length&&n.every(((t,e)=>t==r[e])));var n,r}));if(i)return i;let n=[],r=new Io(n,t,e);for(let t of e)t.instances.push(r);let s=function(t){let e=[[]];for(let i=0;ie.length-t.length))}(e);for(let e of t.set)if(!e.modified.length)for(let t of s)n.push(Ho.get(e,t));return r}}function Vo(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],r=2,s=t;for(let e=0;;){if("..."==s&&e>0&&e+3==t.length){r=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);s=t.slice(e)}let o=i.length-1,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new Fo(n,r,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return Wo.add(e)}const Wo=new so;class Fo{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth{let e=r;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function _o(t,e,i,n=0,r=t.length){let s=new qo(n,Array.isArray(e)?e:[e],i);s.highlightRange(t.cursor(),n,r,"",s.highlighters),s.flush(r)}Fo.empty=new Fo([],2,null);class qo{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,r){let{type:s,from:o,to:a}=t;if(o>=i||a<=e)return;s.isTop&&(r=this.highlighters.filter((t=>!t.scope||t.scope(s))));let l=n,h=function(t){let e=t.type.prop(Wo);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||Fo.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(r,h.tags);if(c&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,o),l),h.opaque)return;let u=t.tree&&t.tree.prop(so.mounted);if(u&&u.overlay){let s=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter((t=>!t.scope||t.scope(u.tree.type))),c=t.firstChild();for(let f=0,d=o;;f++){let p=f=m)&&t.nextSibling()););if(!p||m>i)break;d=p.to+o,d>e&&(this.highlightRange(s.cursor(),Math.max(e,p.from+o),Math.min(i,d),"",h),this.startSpan(Math.min(i,d),l))}c&&t.parent()}else if(t.firstChild()){u&&(n="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,r),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const $o=Io.define,Ko=$o(),Uo=$o(),Go=$o(Uo),Jo=$o(Uo),Yo=$o(),Xo=$o(Yo),Qo=$o(Yo),Zo=$o(),ta=$o(Zo),ea=$o(),ia=$o(),na=$o(),ra=$o(na),sa=$o(),oa={comment:Ko,lineComment:$o(Ko),blockComment:$o(Ko),docComment:$o(Ko),name:Uo,variableName:$o(Uo),typeName:Go,tagName:$o(Go),propertyName:Jo,attributeName:$o(Jo),className:$o(Uo),labelName:$o(Uo),namespace:$o(Uo),macroName:$o(Uo),literal:Yo,string:Xo,docString:$o(Xo),character:$o(Xo),attributeValue:$o(Xo),number:Qo,integer:$o(Qo),float:$o(Qo),bool:$o(Yo),regexp:$o(Yo),escape:$o(Yo),color:$o(Yo),url:$o(Yo),keyword:ea,self:$o(ea),null:$o(ea),atom:$o(ea),unit:$o(ea),modifier:$o(ea),operatorKeyword:$o(ea),controlKeyword:$o(ea),definitionKeyword:$o(ea),moduleKeyword:$o(ea),operator:ia,derefOperator:$o(ia),arithmeticOperator:$o(ia),logicOperator:$o(ia),bitwiseOperator:$o(ia),compareOperator:$o(ia),updateOperator:$o(ia),definitionOperator:$o(ia),typeOperator:$o(ia),controlOperator:$o(ia),punctuation:na,separator:$o(na),bracket:ra,angleBracket:$o(ra),squareBracket:$o(ra),paren:$o(ra),brace:$o(ra),content:Zo,heading:ta,heading1:$o(ta),heading2:$o(ta),heading3:$o(ta),heading4:$o(ta),heading5:$o(ta),heading6:$o(ta),contentSeparator:$o(Zo),list:$o(Zo),quote:$o(Zo),emphasis:$o(Zo),strong:$o(Zo),link:$o(Zo),monospace:$o(Zo),strikethrough:$o(Zo),inserted:$o(),deleted:$o(),changed:$o(),invalid:$o(),meta:sa,documentMeta:$o(sa),annotation:$o(sa),processingInstruction:$o(sa),definition:Io.defineModifier(),constant:Io.defineModifier(),function:Io.defineModifier(),standard:Io.defineModifier(),local:Io.defineModifier(),special:Io.defineModifier()};var aa;jo([{tag:oa.link,class:"tok-link"},{tag:oa.heading,class:"tok-heading"},{tag:oa.emphasis,class:"tok-emphasis"},{tag:oa.strong,class:"tok-strong"},{tag:oa.keyword,class:"tok-keyword"},{tag:oa.atom,class:"tok-atom"},{tag:oa.bool,class:"tok-bool"},{tag:oa.url,class:"tok-url"},{tag:oa.labelName,class:"tok-labelName"},{tag:oa.inserted,class:"tok-inserted"},{tag:oa.deleted,class:"tok-deleted"},{tag:oa.literal,class:"tok-literal"},{tag:oa.string,class:"tok-string"},{tag:oa.number,class:"tok-number"},{tag:[oa.regexp,oa.escape,oa.special(oa.string)],class:"tok-string2"},{tag:oa.variableName,class:"tok-variableName"},{tag:oa.local(oa.variableName),class:"tok-variableName tok-local"},{tag:oa.definition(oa.variableName),class:"tok-variableName tok-definition"},{tag:oa.special(oa.variableName),class:"tok-variableName2"},{tag:oa.definition(oa.propertyName),class:"tok-propertyName tok-definition"},{tag:oa.typeName,class:"tok-typeName"},{tag:oa.namespace,class:"tok-namespace"},{tag:oa.className,class:"tok-className"},{tag:oa.macroName,class:"tok-macroName"},{tag:oa.propertyName,class:"tok-propertyName"},{tag:oa.operator,class:"tok-operator"},{tag:oa.comment,class:"tok-comment"},{tag:oa.meta,class:"tok-meta"},{tag:oa.invalid,class:"tok-invalid"},{tag:oa.punctuation,class:"tok-punctuation"}]);const la=new so;const ha=new so;class ca{constructor(t,e,i=[],n=""){this.data=t,this.name=n,yt.prototype.hasOwnProperty("tree")||Object.defineProperty(yt.prototype,"tree",{get(){return fa(this)}}),this.parser=e,this.extension=[xa.of(this),yt.languageData.of(((t,e,i)=>{let n=ua(t,e,i),r=n.type.prop(la);if(!r)return[];let s=t.facet(r),o=n.type.prop(ha);if(o){let r=n.resolve(e-n.from,i);for(let e of o)if(e.test(r,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(s)}}return s}))].concat(i)}isActiveAt(t,e,i=-1){return ua(t,e,i).type.prop(la)==this.data}findRegions(t){let e=t.facet(xa);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(la)==this.data)return void i.push({from:e,to:e+t.length});let r=t.prop(so.mounted);if(r){if(r.tree.prop(la)==this.data){if(r.overlay)for(let t of r.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(r.overlay){let t=i.length;if(n(r.tree,r.overlay[0].from+e),i.length>t)return}}for(let i=0;i=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let ma=null;class ga{constructor(t,e,i=[],n,r,s,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new ga(t,e,[],po.empty,0,i,[],null)}startParse(){return this.parser.startParse(new pa(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=po.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((()=>{for(;!(e=this.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Bo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=ma;ma=this;try{return t()}finally{ma=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=wa(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges(((t,i,n,r)=>e.push({fromA:t,toA:i,fromB:n,toB:r}))),i=Bo.applyChanges(i,e),n=po.empty,r=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);it.from&&(this.fragments=wa(this.fragments,i,n),this.skipped.splice(e--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Po{createParse(e,i,n){let r=n[0].from,s=n[n.length-1].to;return{parsedPos:r,advance(){let e=ma;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=s,new po(lo.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return ma}}function wa(t,e,i){return Bo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class va{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new va(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=ga.create(t.facet(xa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new va(i)}}ca.state=j.define({create:va.init,update(t,e){for(let t of e.effects)if(t.is(ca.setState))return t.value;return e.startState.facet(xa)!=e.state.facet(xa)?va.init(e.state):t.apply(e)}});let ya=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(ya=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const ba="undefined"!=typeof navigator&&(null===(aa=navigator.scheduling)||void 0===aa?void 0:aa.isInputPending)?()=>navigator.scheduling.isInputPending():null,ka=bi.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(ca.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(ca.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=ya(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=r.context.work((()=>ba&&ba()||Date.now()>s),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:ca.setState.of(new va(r.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>gi(this.view.state,t))).then((()=>this.workScheduled--)),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xa=R.define({combine:t=>t.length?t[0]:null,enables:t=>[ca.state,ka,Nr.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Sa{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Aa=R.define(),Ma=R.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((t=>t!=e[0])))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Ca(t){let e=t.facet(Ma);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ta(t,e){let i="",n=t.tabSize,r=t.facet(Ma)[0];if("\t"==r){for(;e>=n;)i+="\t",e-=n;r=" "}for(let t=0;t=e?function(t,e,i){let n=e.resolveStack(i),r=n.node.enterUnfinishedNodesBefore(i);if(r!=n.node){let t=[];for(let e=r;e!=n.node;e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return La(n,t,i)}(t,i,e):null}class Da{constructor(t,e={}){this.state=t,this.options=e,this.unit=Ca(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:r}=this.options;return null!=n&&n>=i.from&&n<=i.to?r&&n==t?{text:"",from:t}:(e<0?n-1&&(r+=s-this.countColumn(i,i.search(/\S|$/))),r}countColumn(t,e=t.length){return zt(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let t=r(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ea=new so;function La(t,e,i){for(let n=t;n;n=n.next){let t=Ba(n.node);if(t)return t(Na.create(e,i,n))}return 0}function Ba(t){let e=t.type.prop(Ea);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(so.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>function(t,e,i,n,r){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||r==t.pos+o,l=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let r=t.options.simulateBreak,s=t.state.doc.lineAt(i.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let t=i.to;;){let r=e.childAfter(t);if(!r||r==n)return null;if(!r.type.isSkipped)return r.from=n?void 0:{from:i,to:n}}const za=lt.define({map:Ia}),Ha=lt.define({map:Ia}),Va=j.define({create:()=>Ye.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)if(i.is(za)&&!Fa(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(_a),r=n?Ye.replace({widget:new Ka(n(e.state,i.value))}):$a;t=t.update({add:[r.range(i.value.from,i.value.to)]})}else i.is(Ha)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Nr.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{t==e&&r==i&&(n=!0)})),n}const ja={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},_a=R.define({combine:t=>bt(t,ja)});function qa(t,e){let{state:i}=t,n=i.facet(_a),r=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=function(t,e,i){var n;let r=null;return null===(n=t.field(Va,!1))||void 0===n||n.between(e,i,((t,e)=>{(!r||r.from>t)&&(r={from:t,to:e})})),r}(t.state,i.from,i.to);n&&t.dispatch({effects:Ha.of(n)}),e.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",i.phrase("folded code")),s.title=i.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const $a=Ye.replace({widget:new class extends Ge{toDOM(t){return qa(t,null)}}});class Ka extends Ge{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return qa(t,this.value)}}const Ua=Nr.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ga{constructor(t,e){let i;function n(t){let e=Ft.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const r="string"==typeof e.all?e.all:e.all?n(e.all):void 0,s=e.scope;this.scope=s instanceof ca?t=>t.prop(la)==s.data:s?t=>t==s:void 0,this.style=jo(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:r}).style,this.module=i?new Ft(i):null,this.themeType=e.themeType}static define(t,e){return new Ga(t,e||{})}}const Ja=R.define(),Ya=R.define({combine:t=>t.length?[t[0]]:null});function Xa(t){let e=t.facet(Ja);return e.length?e:t.facet(Ya)}function Qa(t,e){let i,n=[tl];return t instanceof Ga&&(t.module&&n.push(Nr.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(Ya.of(t)):i?n.push(Ja.computeN([Nr.darkTheme],(e=>e.facet(Nr.darkTheme)==("dark"==i)?[t]:[]))):n.push(Ja.of(t)),n}class Za{constructor(t){this.markCache=Object.create(null),this.tree=fa(t.state),this.decorations=this.buildDeco(t,Xa(t.state))}update(t){let e=fa(t.state),i=Xa(t.state),n=i!=Xa(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=Ye.mark({class:n})))}),n,r);return i.finish()}}const tl=q.high(bi.fromClass(Za,{decorations:t=>t.decorations})),el=(oa.meta,oa.link,oa.heading,oa.emphasis,oa.strong,oa.strikethrough,oa.keyword,oa.atom,oa.bool,oa.url,oa.contentSeparator,oa.labelName,oa.literal,oa.inserted,oa.string,oa.deleted,oa.regexp,oa.escape,oa.string,oa.variableName,oa.variableName,oa.typeName,oa.namespace,oa.className,oa.variableName,oa.macroName,oa.propertyName,oa.comment,oa.invalid,Nr.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),il=1e4,nl="()[]{}",rl=R.define({combine:t=>bt(t,{afterCursor:!0,brackets:nl,maxScanDistance:il,renderMatch:al})}),sl=Ye.mark({class:"cm-matchingBracket"}),ol=Ye.mark({class:"cm-nonmatchingBracket"});function al(t){let e=[],i=t.matched?sl:ol;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}const ll=j.define({create:()=>Ye.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(rl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=pl(e.state,t.head,-1,n)||t.head>0&&pl(e.state,t.head-1,1,n)||n.afterCursor&&(pl(e.state,t.head,1,n)||t.headNr.decorations.from(t)}),hl=[ll,el];function cl(t={}){return[rl.of(t),hl]}const ul=new so;function fl(t,e,i){let n=t.prop(e<0?so.openedBy:so.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function dl(t){let e=t.type.prop(ul);return e?e(t.node):t}function pl(t,e,i,n={}){let r=n.maxScanDistance||il,s=n.brackets||nl,o=fa(t),a=o.resolveInner(e,i);for(let t=a;t;t=t.parent){let n=fl(t.type,i,s);if(n&&t.from0?e>=r.from&&er.from&&e<=r.to))return ml(0,0,i,t,r,n,s)}}return function(t,e,i,n,r,s,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=i>0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=s;){let s=c.value;i<0&&(t+=s.length);let a=e+t*i;for(let t=i>0?0:s.length-1,e=i>0?s.length:-1;t!=e;t+=i){let e=o.indexOf(s[t]);if(!(e<0||n.resolveInner(a+t,1).type!=r))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=s.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,r,s)}function ml(t,e,i,n,r,s,o){let a=n.parent,l={from:r.from,to:r.to},h=0,c=null==a?void 0:a.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==h&&s.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pose}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosi?t.toLowerCase():t;return n(this.string.substr(this.pos,t.length))==n(t)?(!1!==e&&(this.pos+=t.length),!0):null}{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function vl(t){if("object"!=typeof t)return t;let e={};for(let i in t){let n=t[i];e[i]=n instanceof Array?n.slice():n}return e}const yl=new WeakMap;class bl extends ca{constructor(t){let e,i=(r=t.languageData,R.define({combine:r?t=>t.concat(r):void 0})),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||vl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||Ml};var r,s;super(i,new class extends Po{createParse(t,i,n){return new Sl(e,t,i,n)}},[Aa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=lo.define({id:Cl.length,name:"Document",props:[la.add((()=>t))],top:!0});return Cl.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new so({perNode:!0}),this.tokenTable=t.tokenTable?new Ll(n.tokenTable):Bl}static define(t){return new bl(t)}getIndent(t,e){let i,n=fa(t.state),r=n.resolve(e);for(;r&&r.type!=this.topNode;)r=r.parent;if(!r)return null;let{overrideIndentation:s}=t.options;s&&(i=yl.get(t.state),null!=i&&i1e4)return null;for(;o=n&&i+e.length<=r&&e.prop(t.stateAfter);if(s)return{state:t.streamParser.copyState(s),pos:i+e.length};for(let s=e.children.length-1;s>=0;s--){let o=e.children[s],a=i+e.positions[s],l=o instanceof po&&a=e.length)return e;r||e.type!=t.topNode||(r=!0);for(let s=e.children.length-1;s>=0;s--){let o,a=e.positions[s],l=e.children[s];if(ai&&kl(t,n.tree,0-n.offset,i,s);if(o&&(e=xl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?Ca(n):4),tree:po.empty}}(t,i,s,null==r?void 0:r.state);this.state=o,this.parsedPos=this.chunkStart=s+a.length;for(let t=0;t=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{let t=e.indexOf("\n");t>-1&&(e=e.slice(0,t))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let t=this.rangeIndex;;){let n=this.ranges[t].to;if(n>=i)break;if(e=e.slice(0,n-(i-e.length)),t++,t==this.ranges.length)break;let r=this.ranges[t].from,s=this.lineAfter(r);e+=s,i=r+s.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,r=t+e;if(i>0?n>r:n>=r)break;e+=this.ranges[++this.rangeIndex].from-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){e+=r=this.skipGapsTo(e,r,1);let t=this.chunk.length;i+=r=this.skipGapsTo(i,r,-1),n+=this.chunk.length-t}return this.chunk.push(t,e,i,n),r}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:r}=this.lang,s=new wl(e,t?t.state.tabSize:4,t?Ca(t.state):2);if(s.eol())r.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let t=Al(r.token,s,this.state);if(t&&(n=this.emitToken(this.lang.tokenTable.resolve(t),this.parsedPos+s.start,this.parsedPos+s.pos,4,n)),s.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}const Ml=Object.create(null),Cl=[lo.none],Tl=new ho(Cl),Ol=[],Dl=Object.create(null),El=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])El[t]=Nl(Ml,e);class Ll{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),El)}resolve(t){return t?this.table[t]||(this.table[t]=Nl(this.extra,t)):0}}const Bl=new Ll(Ml);function Pl(t,e){Ol.indexOf(t)>-1||(Ol.push(t),console.warn(e))}function Nl(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||oa[i];n?"function"==typeof n?e.length?e=e.map(n):Pl(i,`Modifier ${i} used at start of tag`):e.length?Pl(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:Pl(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map((t=>t.id)),s=Dl[r];if(s)return s.id;let o=Dl[r]=lo.define({id:Cl.length,name:n,props:[Vo({[n]:i})]});return Cl.push(o),o.id}function Rl(t){return Rl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rl(t)}function Il(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i1&&void 0!==arguments[1]?arguments[1]:null;this.tokenTable["mw-tag-".concat(t)]||(this.addToken("mw-tag-".concat(t),e),this.addToken("mw-ext-".concat(t),e))}},{key:"addToken",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.tokenTable[t]||(this.tokenTable[t]=Io.define(e),this.extHighlightStyles.push({tag:this.tokenTable[t],class:"cm-".concat(t)}))}},{key:"permittedHtmlTags",get:function(){return{b:!0,bdi:!0,del:!0,i:!0,ins:!0,u:!0,font:!0,big:!0,small:!0,sub:!0,sup:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,cite:!0,code:!0,em:!0,s:!0,strike:!0,strong:!0,tt:!0,var:!0,div:!0,center:!0,blockquote:!0,q:!0,ol:!0,ul:!0,dl:!0,table:!0,caption:!0,pre:!0,ruby:!0,rb:!0,rp:!0,rt:!0,rtc:!0,p:!0,span:!0,abbr:!0,dfn:!0,kbd:!0,samp:!0,data:!0,time:!0,mark:!0,br:!0,wbr:!0,hr:!0,li:!0,dt:!0,dd:!0,td:!0,th:!0,tr:!0,noinclude:!0,includeonly:!0,onlyinclude:!0}}},{key:"implicitlyClosedHtmlTags",get:function(){return{br:!0,hr:!0,wbr:!0}}},{key:"tags",get:function(){return function(t){for(var e=1;et.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(t.visibleRanges);try{var r=function(){var n,r=e.value,s=r.from,o=r.to;fa(t.state).iterate({from:s,to:o,enter:function(t){var e=t.name.split("_").some((function(t){return[ql.tags.htmlTagBracket,ql.tags.extTagBracket].includes(t)}));!n&&e?n=t.from:e&&(i.add(n,t.to,Jl),n=null)}})};for(n.s();!(e=n.n()).done;)r()}catch(t){n.e(t)}finally{n.f()}return i.finish()}var Xl=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.isolates=Yl(e),this.tree=fa(e.state)}var e,i;return e=t,(i=[{key:"update",value:function(t){(t.docChanged||t.viewportChanged||fa(t.state)!==this.tree)&&(this.isolates=Yl(t.view),this.tree=fa(t.state))}}])&&Kl(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Ql={provide:function(t){var e=function(e){return e.plugin(t)&&e.plugin(t).isolates||Ye.none};return q.lowest([Nr.decorations.of(e),Nr.bidiIsolatedRanges.of(e)])}};const Zl=bi.fromClass(Xl,Ql);function th(t){return th="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},th(t)}function eh(t,e){for(var i=0;i{let{doc:r}=i.state,s=v(e[0],0);if(9==s){let t=r.lineAt(n),e=i.state.tabSize,s=zt(t.text,e,n-t.from);return Ye.replace({widget:new vs((e-s%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ye.replace({widget:new ws(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(ms);t.startState.facet(ms)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}({render:function(e,i,n){i=t[e]||mw.msg("codemirror-control-character",e);var r=document.createElement("span");return r.className="cm-specialChar",160!==e&&8239!==e||(n="·",r.className="cm-special-char-nbsp"),r.textContent=n,r.title=i,r.setAttribute("aria-label",i),r},addSpecialChars:/\u00a0|\u202f/g})}},{key:"initialize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.defaultExtensions;mw.hook("ext.CodeMirror.initialize").fire(this.$textarea),this.state=yt.create({doc:this.$textarea.textSelection("getContents"),extensions:e}),this.view=new Nr({state:this.state,parent:this.$textarea.parent()[0]}),this.$textarea.hide(),this.$textarea[0].form&&this.$textarea[0].form.addEventListener("submit",(function(){t.$textarea.val(t.view.state.doc.toString());var e=document.getElementById("wpScrolltop");e&&(e.value=t.view.scrollDOM.scrollTop)})),$(this.view.dom).textSelection("register",this.cmTextSelection),this.$textarea.textSelection("register",this.cmTextSelection)}},{key:"logUsage",value:function(t){var e=Object.assign({session_token:mw.user.sessionId(),user_id:mw.user.getId()},t),i=mw.config.get("wgUserEditCountBucket");null!==i&&(e.user_edit_count_bucket=i),mw.track("event.CodeMirrorUsage",e)}},{key:"setCodeMirrorPreference",value:function(t){mw.user.isNamed()&&((new mw.Api).saveOption("usecodemirror",t?1:0),mw.user.options.set("usecodemirror",t?1:0))}},{key:"cmTextSelection",get:function(){var t=this;return this.textSelection||(this.textSelection=new eo(this.view)),{getContents:function(){return t.textSelection.getContents()},setContents:function(e){return t.textSelection.setContents(e)},getCaretPosition:function(e){return t.textSelection.getCaretPosition(e)},scrollToCaretPosition:function(){return t.textSelection.scrollToCaretPosition()},getSelection:function(){return t.textSelection.getSelection()},setSelection:function(e){return t.textSelection.setSelection(e)},replaceSelection:function(e){return t.textSelection.replaceSelection(e)},encapsulateSelection:function(e){return t.textSelection.encapsulateSelection(e)}}}}],i&&eh(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function rh(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return!!r&&(n(i.update(r)),!0)}}const sh=rh(uh,0),oh=rh(ch,0),ah=rh(((t,e)=>ch(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}(e))),0);function lh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const hh=50;function ch(t,e,i=e.selection.ranges){let n=i.map((t=>lh(e,t.from).block));if(!n.every((t=>t)))return null;let r=i.map(((t,i)=>function(t,{open:e,close:i},n,r){let s,o,a=t.sliceDoc(n-hh,n),l=t.sliceDoc(r,r+hh),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:r+c,margin:c&&1}};r-n<=2*hh?s=o=t.sliceDoc(n,r):(s=t.sliceDoc(n,n+hh),o=t.sliceDoc(r-hh,r));let f=/^\s*/.exec(s)[0].length,d=/\s*$/.exec(o)[0].length,p=o.length-d-i.length;return s.slice(f,f+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(s.charAt(f+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,n[i],t.from,t.to)));if(2!=t&&!r.every((t=>t)))return{changes:e.changes(i.map(((t,e)=>r[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}])))};if(1!=t&&r.some((t=>t))){let t=[];for(let e,i=0;ir&&(t==s||s>l.from)){r=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?t:-1;tt.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:i,indent:r,empty:s,single:o}of n)!o&&s||t.push({from:e.from+r,insert:i+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:i,token:r}of n)if(i>=0){let n=e.from+i,s=n+r.length;" "==e.text[s-e.from]&&s++,t.push({from:n,to:s})}return{changes:t}}return null}const fh=st.define(),dh=st.define(),ph=R.define(),mh=R.define({combine:t=>bt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})}),gh=j.define({create:()=>Ph.empty,update(t,e){let i=e.state.facet(mh),n=e.annotation(fh);if(n){let r=e.docChanged?B.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,s=Sh.fromTransaction(e,r),o=n.side,a=0==o?t.undone:t.done;return a=s?Ah(a,a.length,i.minDepth,s):Oh(a,e.startState.selection),new Ph(0==o?n.rest:a,0==o?a:n.rest)}let r=e.annotation(dh);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(ht.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let s=Sh.fromTransaction(e),o=e.annotation(ht.time),a=e.annotation(ht.userEvent);return s?t=t.addChanges(s,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new Ph(t.done.map(Sh.fromJSON),t.undone.map(Sh.fromJSON))});function wh(t={}){return[gh,mh.of(t),Nr.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?yh:"historyRedo"==t.inputType?bh:null;return!!i&&(t.preventDefault(),i(e))}})]}function vh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(gh,!1);if(!r)return!1;let s=r.pop(t,i,e);return!!s&&(n(s),!0)}}const yh=vh(0,!1),bh=vh(1,!1),kh=vh(0,!0),xh=vh(1,!0);class Sh{constructor(t,e,i,n,r){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=r}setSelAfter(t){return new Sh(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new Sh(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON))}static fromTransaction(t,e){let i=Ch;for(let e of t.startState.facet(ph)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Sh(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Ch)}static selection(t){return new Sh(void 0,Ch,void 0,void 0,t)}}function Ah(t,e,i,n){let r=e+1>i+20?e-i-1:0,s=t.slice(r,e);return s.push(n),s}function Mh(t,e){return t.length?e.length?t.concat(e):t:e}const Ch=[],Th=200;function Oh(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Th));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Ah(t,t.length-1,1e9,i.setSelAfter(n)))}return[Sh.selection([e])]}function Dh(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function Eh(t,e){if(!t.length)return t;let i=t.length,n=Ch;for(;i;){let r=Lh(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let e=t.slice(0,i);return e[i-1]=r,e}e=r.mapped,i--,n=r.selectionsAfter}return n.length?[Sh.selection(n)]:Ch}function Lh(t,e,i){let n=Mh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Ch,i);if(!t.changes)return Sh.selection(n);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Sh(r,lt.mapEffects(t.effects,e),o,t.startSelection.map(s),n)}const Bh=/^(input\.type|delete)($|\.)/;class Ph{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new Ph(this.done,this.undone):this}addChanges(t,e,i,n,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&t.changes&&(!i||Bh.test(i))&&(!o.selectionsAfter.length&&e-this.prevTimei.push(t,e))),e.iterChangedRanges(((t,e,r,s)=>{for(let t=0;t=e&&r<=o&&(n=!0)}})),n}(o.changes,t.changes))||"input.type.compose"==i)?Ah(s,s.length-1,n.minDepth,new Sh(t.changes.compose(o.changes),Mh(t.effects,o.effects),o.mapped,o.startSelection,Ch)):Ah(s,s.length,n.minDepth,t),new Ph(s,Ch,e,i)}addSelection(t,e,i,n){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Ch;return r.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Ph(Oh(this.done,t),this.undone,e,i);var s,o}addMapping(t){return new Ph(Eh(this.done,t),Eh(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let r=n[n.length-1];if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:fh.of({side:t,rest:Dh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let i=1==n.length?Ch:n.slice(0,n.length-1);return r.mapped&&(i=Eh(i,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:fh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Ph.empty=new Ph(Ch,Ch);const Nh=[{key:"Mod-z",run:yh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:bh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:bh,preventDefault:!0},{key:"Mod-u",run:kh,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:xh,preventDefault:!0}];function Rh(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function Ih(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function zh({state:t,dispatch:e},i){let n=Rh(t.selection,i);return!n.eq(t.selection)&&(e(Ih(t,n)),!0)}function Hh(t,e){return B.cursor(e?t.to:t.from)}function Vh(t,e){return zh(t,(i=>i.empty?t.moveByChar(i,e):Hh(i,e)))}function Wh(t){return t.textDirectionAt(t.state.selection.main.head)==Pi.LTR}const Fh=t=>Vh(t,!Wh(t)),jh=t=>Vh(t,Wh(t));function _h(t,e){return zh(t,(i=>i.empty?t.moveByGroup(i,e):Hh(i,e)))}function qh(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function $h(t,e,i){let n,r,s=fa(t).resolveInner(e.head),o=i?so.closedBy:so.openedBy;for(let n=e.head;;){let e=i?s.childAfter(n):s.childBefore(n);if(!e)break;qh(t,e,o)?s=e:n=i?e.to:e.from}return r=s.type.prop(o)&&(n=i?pl(t,s.from,1):pl(t,s.to,-1))&&n.matched?i?n.end.to:n.end.from:i?s.to:s.from,B.cursor(r,i?-1:1)}function Kh(t,e){return zh(t,(i=>{if(!i.empty)return Hh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const Uh=t=>Kh(t,!1),Gh=t=>Kh(t,!0);function Jh(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Hh(i,e)));if(s.eq(r.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomYh(t,!1),Qh=t=>Yh(t,!0);function Zh(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(r=B.cursor(n.from+i))}return r}function tc(t,e){let i=Rh(t.state.selection,(t=>{let i=e(t);return B.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Ih(t.state,i)),!0)}function ec(t,e){return tc(t,(i=>t.moveByChar(i,e)))}const ic=t=>ec(t,!Wh(t)),nc=t=>ec(t,Wh(t));function rc(t,e){return tc(t,(i=>t.moveByGroup(i,e)))}function sc(t,e){return tc(t,(i=>t.moveVertically(i,e)))}const oc=t=>sc(t,!1),ac=t=>sc(t,!0);function lc(t,e){return tc(t,(i=>t.moveVertically(i,e,Jh(t).height)))}const hc=t=>lc(t,!1),cc=t=>lc(t,!0),uc=({state:t,dispatch:e})=>(e(Ih(t,{anchor:0})),!0),fc=({state:t,dispatch:e})=>(e(Ih(t,{anchor:t.doc.length})),!0),dc=({state:t,dispatch:e})=>(e(Ih(t,{anchor:t.selection.main.anchor,head:0})),!0),pc=({state:t,dispatch:e})=>(e(Ih(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function mc(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange((n=>{let{from:r,to:s}=n;if(r==s){let n=e(r);nr&&(i="delete.forward",n=gc(t,n,!0)),r=Math.min(r,n),s=Math.max(s,n)}else r=gc(t,r,!1),s=gc(t,s,!0);return r==s?{range:n}:{changes:{from:r,to:s},range:B.cursor(r)}}));return!r.changes.empty&&(t.dispatch(n.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Nr.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function gc(t,e,i){if(t instanceof Nr)for(let n of t.state.facet(Nr.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const wc=(t,e)=>mc(t,(i=>{let n,r,{state:s}=t,o=s.doc.lineAt(i);if(!e&&i>o.from&&iwc(t,!1),yc=t=>wc(t,!0),bc=(t,e)=>mc(t,(i=>{let n=i,{state:r}=t,s=r.doc.lineAt(n),o=r.charCategorizer(n);for(let t=null;;){if(n==(e?s.to:s.from)){n==i&&s.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let a=d(s.text,n-s.from,e)+s.from,l=s.text.slice(Math.min(n,a)-s.from,Math.max(n,a)-s.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),kc=t=>bc(t,!1),xc=t=>mc(t,(e=>{let i=t.lineBlockAt(e).to;return e=r.number){let t=e[e.length-1];t.to=s.to,t.ranges.push(n)}else e.push({from:r.from,to:s.to,ranges:[n]});i=s.number+1}return e}function Ac(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let e of Sc(t)){if(i?e.to==t.doc.length:0==e.from)continue;let s=t.doc.lineAt(i?e.to+1:e.from-1),o=s.length+1;if(i){n.push({from:e.to,to:s.to},{from:e.from,insert:s.text+t.lineBreak});for(let i of e.ranges)r.push(B.range(Math.min(t.doc.length,i.anchor+o),Math.min(t.doc.length,i.head+o)))}else{n.push({from:s.from,to:e.from},{from:e.to,insert:t.lineBreak+s.text});for(let t of e.ranges)r.push(B.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:B.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Mc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Sc(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Cc=Tc(!1);function Tc(e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=i.changeByRange((n=>{let{from:r,to:s}=n,o=i.doc.lineAt(r),a=!e&&r==s&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=fa(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(so.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(i,r);e&&(r=s=(s<=o.to?o:i.doc.lineAt(s)).to);let l=new Da(i,{simulateBreak:r,simulateDoubleBreak:!!a}),h=Oa(l,r);for(null==h&&(h=zt(/^\s*/.exec(i.doc.lineAt(r).text)[0],i.tabSize));so.from&&r{let r=[];for(let s=n.from;s<=n.to;){let o=t.doc.lineAt(s);o.number>i&&(n.empty||n.to>o.from)&&(e(o,r,n),i=o.number),s=o.to+1}let s=t.changes(r);return{changes:r,range:B.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}}))}const Dc=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>zh(t,(e=>$h(t.state,e,!Wh(t)))),shift:t=>tc(t,(e=>$h(t.state,e,!Wh(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>zh(t,(e=>$h(t.state,e,Wh(t)))),shift:t=>tc(t,(e=>$h(t.state,e,Wh(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Ac(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Mc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Ac(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Mc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=B.create([i.main]):i.main.empty||(n=B.create([B.cursor(i.main.head)])),!!n&&(e(Ih(t,n)),!0)}},{key:"Mod-Enter",run:Tc(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Sc(t).map((({from:e,to:i})=>B.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:B.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Rh(t.selection,(e=>{var i;let n=fa(t).resolveInner(e.head,1);for(;!(n.from=e.to||n.to>e.to&&n.from<=e.from)&&(null===(i=n.parent)||void 0===i?void 0:i.parent);)n=n.parent;return B.range(n.to,n.from)}));return e(Ih(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Oc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let r=zt(n,t.tabSize),s=0,o=Ta(t,Math.max(0,r-Ca(t)));for(;s!t.readOnly&&(e(t.update(Oc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(Ma)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Da(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),r=Oc(t,((e,r,s)=>{let o=Oa(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ta(t,o);(a!=l||s.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Sc(e).map((({from:t,to:i})=>(t>0?t--:it.moveVertically(e,!0))).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,i){let n=!1,r=Rh(t.selection,(e=>{let r=pl(t,e.head,-1)||pl(t,e.head,1)||e.head>0&&pl(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=lh(t.state,i.from);return n.line?sh(t):!!n.block&&ah(t)}},{key:"Alt-A",run:oh}].concat([{key:"ArrowLeft",run:Fh,shift:ic,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>_h(t,!Wh(t)),shift:t=>rc(t,!Wh(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>zh(t,(e=>Zh(t,e,!Wh(t)))),shift:t=>tc(t,(e=>Zh(t,e,!Wh(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:nc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>_h(t,Wh(t)),shift:t=>rc(t,Wh(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>zh(t,(e=>Zh(t,e,Wh(t)))),shift:t=>tc(t,(e=>Zh(t,e,Wh(t)))),preventDefault:!0},{key:"ArrowUp",run:Uh,shift:oc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:uc,shift:dc},{mac:"Ctrl-ArrowUp",run:Xh,shift:hc},{key:"ArrowDown",run:Gh,shift:ac,preventDefault:!0},{mac:"Cmd-ArrowDown",run:fc,shift:pc},{mac:"Ctrl-ArrowDown",run:Qh,shift:cc},{key:"PageUp",run:Xh,shift:hc},{key:"PageDown",run:Qh,shift:cc},{key:"Home",run:t=>zh(t,(e=>Zh(t,e,!1))),shift:t=>tc(t,(e=>Zh(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:uc,shift:dc},{key:"End",run:t=>zh(t,(e=>Zh(t,e,!0))),shift:t=>tc(t,(e=>Zh(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:fc,shift:pc},{key:"Enter",run:Cc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:vc,shift:vc},{key:"Delete",run:yc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:kc},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>bc(t,!0)},{mac:"Mod-Backspace",run:t=>mc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:xc}].concat([{key:"Ctrl-b",run:Fh,shift:ic,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:nc},{key:"Ctrl-p",run:Uh,shift:oc},{key:"Ctrl-n",run:Gh,shift:ac},{key:"Ctrl-a",run:t=>zh(t,(e=>B.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>tc(t,(e=>B.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>zh(t,(e=>B.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>tc(t,(e=>B.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:yc},{key:"Ctrl-h",run:vc},{key:"Ctrl-k",run:xc},{key:"Ctrl-Alt-h",run:kc},{key:"Ctrl-o",run:({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)})));return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),r=i==n.from?i-1:d(n.text,i-n.from,!1)+n.from,s=i==n.to?i+1:d(n.text,i-n.from,!0)+n.from;return{changes:{from:r,to:s,insert:t.doc.slice(i,s).append(t.doc.slice(r,i))},range:B.cursor(s)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Qh}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Ec(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];"string"==typeof r?t.setAttribute(n,r):null!=r&&(t[n]=r)}e++}for(;et.normalize("NFKD"):t=>t;class Pc{constructor(t,e,i=0,n=t.length,r,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=r?t=>r(Bc(t)):Bc,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return v(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=y(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=b(t);let n=this.normalize(e);for(let t=0,r=i;;t++){let s=n.charCodeAt(t),o=this.match(s,r);if(t==n.length-1){if(o)return this.value=o,this;break}r==i&&tthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=Wc(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,e)))return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||n.to<=e){let n=new Hc(e,t.sliceString(e,i));return zc.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:r,from:s}=n;return s>e&&(r=t.sliceString(e,s)+r,s=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,i=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,i,e)))return this.value={from:t,to:i,match:e},this.matchPos=Wc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Hc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Wc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Fc(t){let e=Ec("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;let{state:n}=t,r=n.doc.lineAt(n.selection.main.head),[,s,o,a,l]=i,h=a?+a.slice(1):0,c=o?+o:r.number;if(o&&l){let t=c/100;s&&(t=t*("-"==s?-1:1)+r.number/n.doc.lines),c=Math.round(n.doc.lines*t)}else o&&s&&(c=c*("-"==s?-1:1)+r.number);let u=n.doc.line(Math.max(1,Math.min(n.doc.lines,c))),f=B.cursor(u.from+Math.max(0,Math.min(h,u.length)));t.dispatch({effects:[jc.of(!1),Nr.scrollIntoView(f.from,{y:"center"})],selection:f}),t.focus()}return{dom:Ec("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:jc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Ec("label",t.state.phrase("Go to line"),": ",e)," ",Ec("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Ic.prototype[Symbol.iterator]=Vc.prototype[Symbol.iterator]=function(){return this});const jc=lt.define(),_c=j.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(jc)&&(t=i.value);return t},provide:t=>Ps.from(t,(t=>t?Fc:null))}),qc=Nr.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),$c=R.define({combine:t=>bt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new bu(t),scrollToMatch:t=>Nr.scrollIntoView(t)})});class Kc{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,Rc),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new Zc(this):new Jc(this)}getCursor(t,e=0,i){let n=t.doc?t:yt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?Yc(this,n,e,i):Gc(this,n,e,i)}}class Uc{constructor(t){this.spec=t}}function Gc(t,e,i,n){return new Pc(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:t=>t.toLowerCase(),t.wholeWord?function(t,e){return(i,n,r,s)=>((s>i||s+r.length=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let r=Gc(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}function Yc(t,e,i,n){return new Ic(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(r(Xc(i.input,i.index))!=gt.Word||r(Qc(i.input,i.index))!=gt.Word)&&(r(Qc(i.input,i.index+i[0].length))!=gt.Word||r(Xc(i.input,i.index+i[0].length))!=gt.Word)):void 0},i,n);var r}function Xc(t,e){return t.slice(d(t,e,!1),e)}function Qc(t,e){return t.slice(e,d(t,e))}class Zc extends Uc{nextMatch(t,e,i){let n=Yc(this.spec,t,i,t.doc.length).next();return n.done&&(n=Yc(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let r=Math.max(e,i-1e4*n),s=Yc(this.spec,t,r,i),o=null;for(;!s.next().done;)o=s.value;if(o&&(r==e||o.from>r+10))return o;if(r==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,((e,i)=>"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let r=Yc(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}const tu=lt.define(),eu=lt.define(),iu=j.define({create:t=>new nu(pu(t).create(),null),update(t,e){for(let i of e.effects)i.is(tu)?t=new nu(i.value.create(),t.panel):i.is(eu)&&(t=new nu(t.query,i.value?du:null));return t},provide:t=>Ps.from(t,(t=>t.panel))});class nu{constructor(t,e){this.query=t,this.panel=e}}const ru=Ye.mark({class:"cm-searchMatch"}),su=Ye.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ou=bi.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(iu))}update(t){let e=t.state.field(iu);(e!=t.startState.field(iu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ye.none;let{view:i}=this,n=new Ct;for(let e=0,r=i.visibleRanges,s=r.length;er[e+1].from-500;)a=r[++e].to;t.highlight(i.state,o,a,((t,e)=>{let r=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,r?su:ru)}))}return n.finish()}},{decorations:t=>t.decorations});function au(t){return e=>{let i=e.state.field(iu,!1);return i&&i.query.spec.valid?t(e,i):wu(e)}}const lu=au(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=B.single(n.from,n.to),s=t.state.facet($c);return t.dispatch({selection:r,effects:[Au(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),gu(t),!0})),hu=au(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let s=B.single(r.from,r.to),o=t.state.facet($c);return t.dispatch({selection:s,effects:[Au(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),gu(t),!0})),cu=au(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length||(t.dispatch({selection:B.create(i.map((t=>B.range(t.from,t.to)))),userEvent:"select.search.matches"}),0))})),uu=au(((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let s=e.nextMatch(i,n,n);if(!s)return!1;let o,a,l=[],h=[];if(s.from==n&&s.to==r&&(a=i.toText(e.getReplacement(s)),l.push({from:s.from,to:s.to,insert:a}),s=e.nextMatch(i,s.from,s.to),h.push(Nr.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),s){let e=0==l.length||l[0].from>=s.to?0:s.to-s.from-a.length;o=B.single(s.from-e,s.to-e),h.push(Au(t,s)),h.push(i.facet($c).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),fu=au(((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map((t=>{let{from:i,to:n}=t;return{from:i,to:n,insert:e.getReplacement(t)}}));if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Nr.announce.of(n),userEvent:"input.replace.all"}),!0}));function du(t){return t.state.facet($c).createPanel(t)}function pu(t,e){var i,n,r,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let h=t.facet($c);return new Kc({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:h.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:h.literal,regexp:null!==(s=null==e?void 0:e.regexp)&&void 0!==s?s:h.regexp,wholeWord:null!==(o=null==e?void 0:e.wholeWord)&&void 0!==o?o:h.wholeWord})}function mu(t){let e=Ds(t,du);return e&&e.dom.querySelector("[main-field]")}function gu(t){let e=mu(t);e&&e==t.root.activeElement&&e.select()}const wu=t=>{let e=t.state.field(iu,!1);if(e&&e.panel){let i=mu(t);if(i&&i!=t.root.activeElement){let n=pu(t.state,e.query.spec);n.valid&&t.dispatch({effects:tu.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[eu.of(!0),e?tu.of(pu(t.state,e.query.spec)):lt.appendConfig.of(Cu)]});return!0},vu=t=>{let e=t.state.field(iu,!1);if(!e||!e.panel)return!1;let i=Ds(t,du);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:eu.of(!1)}),!0},yu=[{key:"Mod-f",run:wu,scope:"editor search-panel"},{key:"F3",run:lu,shift:hu,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:lu,shift:hu,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:vu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:r}=i.main,s=[],o=0;for(let e=new Pc(t.doc,t.sliceDoc(n,r));!e.next().done;){if(s.length>1e3)return!1;e.value.from==n&&(o=s.length),s.push(B.range(e.value.from,e.value.to))}return e(t.update({selection:B.create(s,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Ds(t,Fc);if(!e){let i=[jc.of(!0)];null==t.state.field(_c,!1)&&i.push(lt.appendConfig.of([_c,qc])),t.dispatch({effects:i}),e=Ds(t,Fc)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some((t=>t.from===t.to)))return(({state:t,dispatch:e})=>{let{selection:i}=t,n=B.create(i.ranges.map((e=>t.wordAt(e.head)||B.cursor(e.head))),i.mainIndex);return!n.eq(i)&&(e(t.update({selection:n})),!0)})({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some((e=>t.sliceDoc(e.from,e.to)!=n)))return!1;let r=function(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),s=r&&r.from==i.from&&r.to==i.to;for(let i=!1,r=new Pc(t.doc,e,n[n.length-1].to);;){if(r.next(),!r.done){if(i&&n.some((t=>t.from==r.value.from)))continue;if(s){let e=t.wordAt(r.value.from);if(!e||e.from!=r.value.from||e.to!=r.value.to)continue}return r.value}if(i)return null;r=new Pc(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}}(t,n);return!!r&&(e(t.update({selection:t.selection.addRange(B.range(r.from,r.to),!1),effects:Nr.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class bu{constructor(t){this.view=t;let e=this.query=t.state.field(iu).query.spec;function i(t,e,i){return Ec("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Ec("input",{value:e.search,placeholder:ku(t,"Find"),"aria-label":ku(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ec("input",{value:e.replace,placeholder:ku(t,"Replace"),"aria-label":ku(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ec("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Ec("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Ec("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Ec("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>lu(t)),[ku(t,"next")]),i("prev",(()=>hu(t)),[ku(t,"previous")]),i("select",(()=>cu(t)),[ku(t,"all")]),Ec("label",null,[this.caseField,ku(t,"match case")]),Ec("label",null,[this.reField,ku(t,"regexp")]),Ec("label",null,[this.wordField,ku(t,"by word")]),...t.state.readOnly?[]:[Ec("br"),this.replaceField,i("replace",(()=>uu(t)),[ku(t,"replace")]),i("replaceAll",(()=>fu(t)),[ku(t,"replace all")])],Ec("button",{name:"close",onclick:()=>vu(t),"aria-label":ku(t,"close"),type:"button"},["×"])])}commit(){let t=new Kc({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:tu.of(t)}))}keydown(t){var e,i;i=t,Ur(qr((e=this.view).state),i,e,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?hu:lu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),uu(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(tu)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet($c).top}}function ku(t,e){return t.state.phrase(e)}const xu=30,Su=/[\s\.,:;?!]/;function Au(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,s=Math.max(n.from,e-xu),o=Math.min(r,i+xu),a=t.state.sliceDoc(s,o);if(s!=n.from)for(let t=0;ta.length-xu;t--)if(!Su.test(a[t-1])&&Su.test(a[t])){a=a.slice(0,t);break}return Nr.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Mu=Nr.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Cu=[iu,q.low(ou),Mu];function Tu(t){return Tu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tu(t)}function Ou(t){return function(t){if(Array.isArray(t))return Du(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Du(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Du(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Du(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0,n}var i,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Iu(t,e)}(e,t),i=e,(n=[{key:"setCodeMirrorPreference",value:function(t){this.useCodeMirror=t,Nu(Ru(e.prototype),"setCodeMirrorPreference",this).call(this,t)}},{key:"enableCodeMirror",value:function(){var t=this;if(!this.view){var e=this.$textarea.prop("selectionStart"),i=this.$textarea.prop("selectionEnd"),n=this.$textarea.scrollTop(),r=this.$textarea.is(":focus"),s=[].concat(Ou(this.defaultExtensions),[this.langExtension,cl(),wh(),Nr.contentAttributes.of({spellcheck:"true"}),Nr.domEventHandlers({blur:function(){return t.$textarea.triggerHandler("blur")},focus:function(){return t.$textarea.triggerHandler("focus")}}),Nr.updateListener.of((function(e){e.docChanged&&"function"==typeof t.editRecoveryHandler&&t.editRecoveryHandler()})),Nr.lineWrapping,yt.allowMultipleSelections.of(!0),is(),jr.of([].concat(Ou(Dc),Ou(yu),Ou(Nh)))]);if(mw.hook("editRecovery.loadEnd").add((function(e){t.editRecoveryHandler=e.fieldChangeHandler})),this.initialize(s),requestAnimationFrame((function(){t.view.scrollDOM.scrollTop=n})),0!==e||0!==i){var o=B.range(e,i),a=Nr.scrollIntoView(o);a.value.isSnapshot=!0,this.view.dispatch({selection:B.create([o]),effects:a})}r&&this.view.focus(),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}}},{key:"addCodeMirrorToWikiEditor",value:function(){var t=this,e=this.$textarea.data("wikiEditor-context"),i=e&&e.modules&&e.modules.toolbar;i&&(this.$textarea.wikiEditor("addToToolbar",{section:"main",groups:{codemirror:{tools:{CodeMirror:{label:mw.msg("codemirror-toggle-label"),type:"toggle",oouiIcon:"highlight",action:{type:"callback",execute:function(){return t.switchCodeMirror()}}}}}}}),i.$toolbar.find(".tool[rel=CodeMirror]").attr("id","mw-editbutton-codemirror"),this.readOnly&&this.$textarea.data("wikiEditor-context").$ui.addClass("ext-codemirror-readonly"),this.useCodeMirror&&this.enableCodeMirror(),this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!1,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0}))}},{key:"updateToolbarButton",value:function(){var t=$("#mw-editbutton-codemirror");t.toggleClass("mw-editbutton-codemirror-active",this.useCodeMirror),t.data("setActive")&&t.data("setActive")(this.useCodeMirror)}},{key:"switchCodeMirror",value:function(){if(this.view){this.setCodeMirrorPreference(!1);var t=this.view.scrollDOM.scrollTop,e=this.view.hasFocus,i=this.view.state.selection.ranges[0],n=i.from,r=i.to;$(this.view.dom).textSelection("unregister"),this.$textarea.textSelection("unregister"),this.$textarea.val(this.view.state.doc.toString()),this.view.destroy(),this.view=null,this.$textarea.show(),e&&this.$textarea.trigger("focus"),this.$textarea.prop("selectionStart",Math.min(n,r)).prop("selectionEnd",Math.max(r,n)),this.$textarea.scrollTop(t),mw.hook("ext.CodeMirror.switch").fire(!1,this.$textarea)}else this.enableCodeMirror(),this.setCodeMirrorPreference(!0);this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!0,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0})}}])&&Eu(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),e}(nh);function Hu(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=Vu(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Vu(t,e){if(t){if("string"==typeof t)return Wu(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Wu(t,e):void 0}}function Wu(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0){var p=t.dom.querySelector(".cm-tooltip-fold");return p&&p.remove(),t.dispatch({effects:s,selection:{anchor:a}}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function(t){var e,i=t.state,n=i.selection,r=[],s=Wa(i),o=Hu(n.ranges);try{for(o.s();!(e=o.n()).done;){var a=e.value,l=a.from,h=a.to;s.between(l,h,(function(t,e){r.push(Ha.of({from:t,to:e}))}))}}catch(t){o.e(t)}finally{o.f()}return r.length>0&&(t.dispatch({effects:r,selection:n}),!0)}},{key:"Ctrl-Alt-]",run:t=>{let e=t.state.field(Va,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,((t,e)=>{i.push(Ha.of({from:t,to:e}))})),t.dispatch({effects:i}),!0}}],Gu=[function(t){let e=[Va,Ua];return t&&e.push(_a.of(t)),e}({placeholderDOM:function(t){var e=document.createElement("span");return e.textContent="…",e.setAttribute("aria-label",mw.msg("codemirror-folded-code")),e.title=mw.msg("codemirror-unfold"),e.className="cm-foldPlaceholder",e.onclick=function(e){var i=e.target,n=t.posAtDOM(i),r=t.state,s=r.selection;Wa(r).between(n,n,(function(e,i){e===n&&t.dispatch({effects:Ha.of({from:e,to:i}),selection:s})}))},e}}),j.define({create:Ku,update:function(t,e){var i=e.state,n=e.docChanged,r=e.selection;return n||r?Ku(i):t},provide:function(t){return Ts.from(t)}}),jr.of(Uu)];function Ju(t){return Ju="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ju(t)}function Yu(t,e){for(var i=0;i~).,'])"),"i"),this.isBold=!1,this.wasBold=!1,this.isItalic=!1,this.wasItalic=!1,this.firstSingleLetterWord=null,this.firstMultiLetterWord=null,this.firstSpace=null,this.oldStyle=null,this.tokens=[],this.oldTokens=[],this.tokenTable=ql.tokenTable,this.registerGroundTokens(),Object.keys(this.config.tags).forEach((function(t){return ql.addTag(t)}))}var e,i;return e=t,i=[{key:"registerGroundTokens",value:function(){["mw-ext-ground","mw-ext-link-ground","mw-ext2-ground","mw-ext2-link-ground","mw-ext3-ground","mw-ext3-link-ground","mw-link-ground","mw-template-ext-ground","mw-template-ext-link-ground","mw-template-ext2-ground","mw-template-ext2-link-ground","mw-template-ext3-ground","mw-template-ext3-link-ground","mw-template-ground","mw-template-link-ground","mw-template2-ext-ground","mw-template2-ext-link-ground","mw-template2-ext2-ground","mw-template2-ext2-link-ground","mw-template2-ext3-ground","mw-template2-ext3-link-ground","mw-template2-ground","mw-template2-link-ground","mw-template3-ext-ground","mw-template3-ext-link-ground","mw-template3-ext2-ground","mw-template3-ext2-link-ground","mw-template3-ext3-ground","mw-template3-ext3-link-ground","mw-template3-ground","mw-template3-link-ground"].forEach((function(t){return ql.addToken(t)}))}},{key:"eatHtmlEntity",value:function(t,e){return(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w.\-:]/)&&t.eat(";"))?ql.tags.htmlEntity:e}},{key:"makeStyle",value:function(t,e,i){return this.isBold&&(t+=" "+ql.tags.strong),this.isItalic&&(t+=" "+ql.tags.em),this.makeLocalStyle(t,e,i)}},{key:"makeLocalStyle",value:function(t,e,i){var n="";switch(e.nTemplate){case 0:break;case 1:n+="-template";break;case 2:n+="-template2";break;default:n+="-template3"}switch(e.nExt){case 0:break;case 1:n+="-ext";break;case 2:n+="-ext2";break;default:n+="-ext3"}return e.nLink>0&&(n+="-link"),""!==n&&(t="mw".concat(n,"-ground ").concat(t)),i&&e[i]--,t.trim()}},{key:"eatBlock",value:function(t,e,i){var n=this;return function(r,s){return r.skipTo(e)?(!1!==i&&r.match(e),s.tokenize=s.stack.pop()):r.skipToEnd(),n.makeLocalStyle(t,s)}}},{key:"eatEnd",value:function(t){var e=this;return function(i,n){return i.skipToEnd(),n.tokenize=n.stack.pop(),e.makeLocalStyle(t,n)}}},{key:"eatChar",value:function(t,e){var i=this;return function(n,r){return r.tokenize=r.stack.pop(),n.eat(t)?i.makeLocalStyle(e,r):i.makeLocalStyle(ql.tags.error,r)}}},{key:"eatSectionHeader",value:function(t){var e=this;return function(i,n){return i.match(/^[^&<[{~]+/)?(i.eol()?(i.backUp(t),n.tokenize=e.eatEnd(ql.tags.sectionHeader)):i.match(/^.*?=)/,!1)&&(i.backUp(t),n.tokenize=e.eatBlock(ql.tags.sectionHeader,"\x3c!--",!1)),ql.tags.section):e.eatWikiText(ql.tags.section)(i,n)}}},{key:"inVariable",value:function(t,e){return t.match(/^[^{}|]+/)?this.makeLocalStyle(ql.tags.templateVariableName,e):t.eat("|")?(e.tokenize=this.inVariableDefault.bind(this),this.makeLocalStyle(ql.tags.templateVariableDelimiter,e)):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.templateVariableBracket,e)):t.match("{{{")?(e.stack.push(e.tokenize),this.makeLocalStyle(ql.tags.templateVariableBracket,e)):(t.next(),this.makeLocalStyle(ql.tags.templateVariableName,e))}},{key:"inVariableDefault",value:function(t,e){return t.match(/^[^{}[<&~]+/)?this.makeLocalStyle(ql.tags.templateVariable,e):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.templateVariableBracket,e)):this.eatWikiText(ql.tags.templateVariable)(t,e)}},{key:"inParserFunctionName",value:function(t,e){return t.match(/^#?[^:}{~]+/)?this.makeLocalStyle(ql.tags.parserFunctionName,e):t.eat(":")?(e.tokenize=this.inParserFunctionArguments.bind(this),this.makeLocalStyle(ql.tags.parserFunctionDelimiter,e)):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(ql.tags.parserFunction)(t,e)}},{key:"inParserFunctionArguments",value:function(t,e){return t.match(/^[^|}{[<&~]+/)?this.makeLocalStyle(ql.tags.parserFunction,e):t.eat("|")?this.makeLocalStyle(ql.tags.parserFunctionDelimiter,e):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(ql.tags.parserFunction)(t,e)}},{key:"eatTemplatePageName",value:function(t){var e=this;return function(i,n){return i.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(ql.tags.templateDelimiter,n)):i.match(/^[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),e.makeLocalStyle(ql.tags.templateBracket,n,"nTemplate")):i.match(/^[\s\u00a0]*/)?e.makeLocalStyle(ql.tags.comment,n):t&&i.sol()?(n.nTemplate--,void(n.tokenize=n.stack.pop())):i.match(/^[\s\u00a0]*[^\s\u00a0|}<{&~]+/)?(n.tokenize=e.eatTemplatePageName(!0),e.makeLocalStyle(ql.tags.templateName,n)):i.eatSpace()?(i.eol(),e.makeLocalStyle(ql.tags.templateName,n)):e.eatWikiText(ql.tags.templateName)(i,n)}}},{key:"eatTemplateArgument",value:function(t){var e=this;return function(i,n){return t&&i.eatWhile(/[^=|}{[<&~]/)?i.eat("=")?(n.tokenize=e.eatTemplateArgument(!1),e.makeLocalStyle(ql.tags.templateArgumentName,n)):e.makeLocalStyle(ql.tags.template,n):i.eatWhile(/[^|}{[<&~]/)?e.makeLocalStyle(ql.tags.template,n):i.eat("|")?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(ql.tags.templateDelimiter,n)):i.match("}}")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(ql.tags.templateBracket,n,"nTemplate")):e.eatWikiText(ql.tags.template)(i,n)}}},{key:"eatExternalLinkProtocol",value:function(t){var e=this;return function(i,n){for(;t>0;)t--,i.next();return i.eol()?(n.nLink--,n.tokenize=n.stack.pop()):n.tokenize=e.inExternalLink.bind(e),e.makeLocalStyle(ql.tags.extLinkProtocol,n)}}},{key:"inExternalLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.extLinkBracket,e,"nLink")):t.eatSpace()?(e.tokenize=this.inExternalLinkText.bind(this),this.makeStyle("",e)):t.match(/^[^\s\u00a0\]{&~']+/)||t.eatSpace()?("'"===t.peek()&&(t.match("''",!1)?e.tokenize=this.inExternalLinkText.bind(this):t.next()),this.makeStyle(ql.tags.extLink,e)):this.eatWikiText(ql.tags.extLink)(t,e)}},{key:"inExternalLinkText",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.eat("]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.extLinkBracket,e,"nLink")):t.match(/^[^'\]{&~<]+/)?this.makeStyle(ql.tags.extLinkText,e):this.eatWikiText(ql.tags.extLinkText)(t,e)}},{key:"inLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*#[\s\u00a0]*/)?(e.tokenize=this.inLinkToSection.bind(this),this.makeLocalStyle(ql.tags.link,e)):t.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(ql.tags.linkDelimiter,e)):t.match(/^[\s\u00a0]*\]\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.linkBracket,e,"nLink")):t.match(/^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/)||t.eatSpace()?this.makeStyle("".concat(ql.tags.linkPageName," ").concat(ql.tags.pageName),e):this.eatWikiText("".concat(ql.tags.linkPageName," ").concat(ql.tags.pageName))(t,e)}},{key:"inLinkToSection",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[^|\]&~{}]+/)?this.makeLocalStyle(ql.tags.linkToSection,e):t.eat("|")?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(ql.tags.linkDelimiter,e)):t.match("]]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.linkBracket,e,"nLink")):this.eatWikiText(ql.tags.linkToSection)(t,e)}},{key:"eatLinkText",value:function(){var t,e,i=this;return function(n,r){var s;return n.match("]]")?(r.tokenize=r.stack.pop(),i.makeLocalStyle(ql.tags.linkBracket,r,"nLink")):n.match("'''")?(t=!t,i.makeLocalStyle("".concat(ql.tags.linkText," ").concat(ql.tags.apostrophes),r)):n.match("''")?(e=!e,i.makeLocalStyle("".concat(ql.tags.linkText," ").concat(ql.tags.apostrophes),r)):(s=ql.tags.linkText,t&&(s+=" "+ql.tags.strong),e&&(s+=" "+ql.tags.em),n.match(/^[^'\]{&~<]+/)?i.makeStyle(s,r):i.eatWikiText(s)(n,r))}}},{key:"eatTagName",value:function(t,e,i){var n=this;return function(r,s){for(var o="";t>0;)t--,o+=r.next();return r.eatSpace(),o=o.toLowerCase(),i?(e&&!ql.implicitlyClosedHtmlTags[o]?s.tokenize=n.eatChar(">",ql.tags.htmlTagBracket):s.tokenize=n.eatHtmlTagAttribute(o),n.makeLocalStyle(ql.tags.htmlTagName,s)):(s.tokenize=e?n.eatChar(">","".concat(ql.tags.extTagBracket," mw-ext-").concat(o)):n.eatExtTagAttribute(o),n.makeLocalStyle("".concat(ql.tags.extTagName," mw-ext-").concat(o),s))}}},{key:"eatHtmlTagAttribute",value:function(t){var e=this;return function(i,n){return i.match(/^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/)?e.makeLocalStyle(ql.tags.htmlTagAttribute,n):i.eat(">")?(t in ql.implicitlyClosedHtmlTags||n.inHtmlTag.push(t),n.tokenize=n.stack.pop(),e.makeLocalStyle(ql.tags.htmlTagBracket,n)):i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(ql.tags.htmlTagBracket,n)):e.eatWikiText(ql.tags.htmlTagAttribute)(i,n)}}},{key:"eatNowiki",value:function(){var t=this;return function(e){return e.match(/^[^&]+/)?"":(e.next(),t.eatHtmlEntity(e,""))}}},{key:"eatExtTagAttribute",value:function(t){var e=this;return function(i,n){if(i.match(/^(?:"[^">]*"|'[^'>]*'|[^>/<{&~])+/))return e.makeLocalStyle("".concat(ql.tags.extTagAttribute," mw-ext-").concat(t),n);if(i.eat(">")){if(n.extName=t,"nowiki"===t||"pre"===t)n.extMode={startState:function(){},copyState:function(){},token:e.eatNowiki()};else if(t in e.config.tagModes){var r=e.config.tagModes[t];"mediawiki"!==r&&"text/mediawiki"!==r||(n.extMode=e.mediawiki,n.extState=n.extMode.startState())}return n.tokenize=e.eatExtTagArea(t),e.makeLocalStyle("".concat(ql.tags.extTagBracket," mw-ext-").concat(t),n)}return i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle("".concat(ql.tags.extTagBracket," mw-ext-").concat(t),n)):e.eatWikiText("".concat(ql.tags.extTagAttribute," mw-ext-").concat(t))(i,n)}}},{key:"eatExtTagArea",value:function(t){var e=this;return function(i,n){var r,s=i.pos,o=new RegExp(""),"i").exec(s?i.string.slice(s):i.string),a=!1;if(o){if(0===o.index)return n.tokenize=e.eatExtCloseTag(t),n.extName=!1,!1!==n.extMode&&(n.extMode=!1,n.extState=!1),n.tokenize(i,n);r=o.index+s,a=i.string,i.string=a.slice(0,r)}return n.stack.push(n.tokenize),n.tokenize=e.eatExtTokens(a),n.tokenize(i,n)}}},{key:"eatExtCloseTag",value:function(t){var e=this;return function(i,n){return i.next(),i.next(),n.tokenize=e.eatTagName(t.length,!0,!1),e.makeLocalStyle("".concat(ql.tags.extTagBracket," mw-ext-").concat(t),n)}}},{key:"eatExtTokens",value:function(t){var e=this;return function(i,n){var r;return!1===n.extMode?(r=ql.tags.extTag,i.skipToEnd()):r="mw-tag-".concat(n.extName," ")+n.extMode.token(i,n.extState,!1===t),i.eol()&&(!1!==t&&(i.string=t),n.tokenize=n.stack.pop()),e.makeLocalStyle(r,n)}}},{key:"eatStartTable",value:function(t,e){return t.match("{|"),t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),ql.tags.tableBracket}},{key:"inTableDefinition",value:function(t,e){return t.sol()?(e.tokenize=this.inTable.bind(this),this.inTable(t,e)):this.eatWikiText(ql.tags.tableDefinition)(t,e)}},{key:"inTable",value:function(t,e){if(t.sol()){if(t.eatSpace(),t.eat("|"))return t.eat("-")?(t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),this.makeLocalStyle(ql.tags.tableDelimiter,e)):t.eat("+")?(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1,!0),this.makeLocalStyle(ql.tags.tableDelimiter,e)):t.eat("}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.tableBracket,e)):(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1),this.makeLocalStyle(ql.tags.tableDelimiter,e));if(t.eat("!"))return t.eatSpace(),e.tokenize=this.eatTableRow(!0,!0),this.makeLocalStyle(ql.tags.tableDelimiter,e)}return this.eatWikiText("")(t,e)}},{key:"eatTableRow",value:function(t,e,i){var n=this,r="";return i?r=ql.tags.tableCaption:e&&(r=ql.tags.strong),function(s,o){if(s.sol()){if(s.match(/^[\s\u00a0]*[|!]/,!1))return o.tokenize=n.inTable.bind(n),n.inTable(s,o)}else{if(s.match(/^[^'|{[<&~!]+/))return n.makeStyle(r,o);if(s.match("||")||e&&s.match("!!"))return n.isBold=!1,n.isItalic=!1,o.tokenize=n.eatTableRow(!0,e,i),n.makeLocalStyle(ql.tags.tableDelimiter,o);if(t&&s.eat("|"))return o.tokenize=n.eatTableRow(!1,e,i),n.makeLocalStyle(ql.tags.tableDelimiter,o)}return n.eatWikiText(r)(s,o)}}},{key:"eatFreeExternalLinkProtocol",value:function(t,e){return t.match(this.urlProtocols),e.tokenize=this.eatFreeExternalLink.bind(this),this.makeLocalStyle(ql.tags.freeExtLinkProtocol,e)}},{key:"eatFreeExternalLink",value:function(t,e){if(t.eol());else if(t.match(/^[^\s\u00a0{[\]<>~).,']*/))if("~"===t.peek()){if(!t.match(/^~~~+/,!1))return t.match(/^~*/),this.makeLocalStyle(ql.tags.freeExtLink,e)}else if("{"===t.peek()){if(!t.match("{{",!1))return t.next(),this.makeLocalStyle(ql.tags.freeExtLink,e)}else if("'"===t.peek()){if(!t.match("''",!1))return t.next(),this.makeLocalStyle(ql.tags.freeExtLink,e)}else if(t.match(/^[).,]+(?=[^\s\u00a0{[\]<>~).,])/))return this.makeLocalStyle(ql.tags.freeExtLink,e);return e.tokenize=e.stack.pop(),this.makeLocalStyle(ql.tags.freeExtLink,e)}},{key:"eatWikiText",value:function(t){var e=this;return function(i,n){var r,s,o,a,l,h,c;if(i.sol()){if(!i.match("//",!1)&&i.match(e.urlProtocols))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLink.bind(e),e.makeLocalStyle(ql.tags.freeExtLinkProtocol,n);switch(r=i.next()){case"-":if(i.match(/^---+/))return ql.tags.hr;break;case"=":if(s=i.match(/^(={0,5})(.+?(=\1\s*)(.*\S).*?)?)$/))return i.backUp(s[2].length),n.stack.push(n.tokenize),n.tokenize=e.eatSectionHeader(s[3].length),ql.tags.sectionHeader+" "+ql.tags["sectionHeader".concat(s[1].length+1)];break;case"*":case"#":case";":return i.match(/^[*#;:]*/),ql.tags.list;case":":return i.match(/^:*{\|/,!1)&&(n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e)),i.match(/^[*#;:]*/),ql.tags.indenting;case" ":if(!i.match(/^[\s\u00a0]*:*{\|/,!1))return ql.tags.skipFormatting;if(i.eatSpace(),i.match(/^:+/))return n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e),ql.tags.indenting;i.eat("{");case"{":if(i.eat("|"))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inTableDefinition.bind(e),ql.tags.tableBracket}}else r=i.next();switch(r){case"&":return e.makeStyle(e.eatHtmlEntity(i,t),n);case"'":if(i.match(/^'*(?=''''')/)||i.match(/^'''(?!')/,!1))break;if(i.match("''"))return e.firstSingleLetterWord||i.match("''",!1)||e.prepareItalicForCorrection(i),e.isBold=!e.isBold,e.makeLocalStyle(ql.tags.apostrophesBold,n);if(i.eat("'"))return e.isItalic=!e.isItalic,e.makeLocalStyle(ql.tags.apostrophesItalic,n);break;case"[":if(i.eat("[")){if(i.eatSpace(),/[^\]|[]/.test(i.peek()))return n.nLink++,n.stack.push(n.tokenize),n.tokenize=e.inLink.bind(e),e.makeLocalStyle(ql.tags.linkBracket,n)}else if(o=i.match(e.urlProtocols))return n.nLink++,i.backUp(o[0].length),n.stack.push(n.tokenize),n.tokenize=e.eatExternalLinkProtocol(o[0].length),e.makeLocalStyle(ql.tags.extLinkBracket,n);break;case"{":if(i.match(/^{{(?!{|[^{}]*}}(?!}))/))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inVariable.bind(e),e.makeLocalStyle(ql.tags.templateVariableBracket,n);if(i.match(/^{(?!{(?!{))[\s\u00a0]*/))return"#"===i.peek()?(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(ql.tags.parserFunctionBracket,n)):!(a=i.match(/^([^\s\u00a0}[\]<{'|&:]+)(:|[\s\u00a0]*)(\}\}?)?(.)?/))||(i.backUp(a[0].length),":"!==a[2]&&void 0!==a[4]&&"}}"!==a[3]||!(a[1].toLowerCase()in e.config.functionSynonyms[0])&&!(a[1]in e.config.functionSynonyms[1]))?(n.nTemplate++,n.stack.push(n.tokenize),n.tokenize=e.eatTemplatePageName(!1),e.makeLocalStyle(ql.tags.templateBracket,n)):(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(ql.tags.parserFunctionBracket,n));break;case"<":if(l=!!i.eat("/"),h=i.match(/^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/),i.match("!--"))return c=e.eatBlock(ql.tags.comment,"--\x3e"),n.stack.push(n.tokenize),n.tokenize=c,c(i,n);if(h){if((h=h[0].toLowerCase())in e.config.tags)return!0===l?ql.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l,!1),e.makeLocalStyle("".concat(ql.tags.extTagBracket," mw-ext-").concat(h),n));if(h in ql.permittedHtmlTags)return!0===l&&h!==n.inHtmlTag.pop()?(i.pos++,ql.tags.error):!0===l&&h in ql.implicitlyClosedHtmlTags?ql.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l||h in ql.implicitlyClosedHtmlTags,!0),e.makeLocalStyle(ql.tags.htmlTagBracket,n));i.backUp(h.length)}break;case"~":if(i.match(/^~{2,4}/))return ql.tags.signature;break;case"_":for(s=1;i.eat("_");)s++;if(s>2)return i.eol()||i.backUp(2),e.makeStyle(t,n);if(2===s&&(a=i.match(/^([^\s\u00a0>}[\]<{'|&:~]+?)__/))&&a[0])return"__"+a[0].toLowerCase()in e.config.doubleUnderscore[0]||"__"+a[0]in e.config.doubleUnderscore[1]?ql.tags.doubleUnderscore:(i.eol()||i.backUp(2),e.makeStyle(t,n));break;default:if(/[\s\u00a0]/.test(r)&&(i.eatSpace(),i.match(e.urlProtocols,!1)&&!i.match("//")))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLinkProtocol.bind(e),e.makeStyle(t,n)}return i.match(/^[^\s\u00a0_>}[\]<{'|&:~=]+/),e.makeStyle(t,n)}}},{key:"prepareItalicForCorrection",value:function(t){var e=t.pos,i=t.string.slice(0,e-3),n=i.slice(-1),r=i.slice(-2,-1);if(" "===n){if(this.firstMultiLetterWord||this.firstSpace)return;this.firstSpace=e}else if(" "===r)this.firstSingleLetterWord=e;else{if(this.firstMultiLetterWord)return;this.firstMultiLetterWord=e}this.wasBold=this.isBold,this.wasItalic=this.isItalic}},{key:"mediawiki",get:function(){var t=this;return{name:"mediawiki",startState:function(){return{tokenize:t.eatWikiText(""),stack:[],inHtmlTag:[],extName:!1,extMode:!1,extState:!1,nTemplate:0,nLink:0,nExt:0}},copyState:function(t){return{tokenize:t.tokenize,stack:t.stack.concat([]),inHtmlTag:t.inHtmlTag.concat([]),extName:t.extName,extMode:t.extMode,extState:!1!==t.extMode&&t.extMode.copyState(t.extState),nTemplate:t.nTemplate,nLink:t.nLink,nExt:t.nExt}},token:function(e,i){var n,r,s,o,a=[],l=[];if(t.oldTokens.length>0)return s=t.oldTokens.shift(),e.pos=s.pos,i=s.state,s.style;e.sol()&&(t.isBold=!1,t.isItalic=!1,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null);do{if(n=i.tokenize(e,i),!(o=t.firstSingleLetterWord||t.firstMultiLetterWord||t.firstSpace))return t.oldStyle=n,n;o!==r&&(r=o,l.length>0&&(a=a.concat(l),l=[])),l.push({pos:e.pos,style:n,state:(i.extMode||t.mediawiki).copyState(i)})}while(!e.eol());if(t.isBold&&t.isItalic){if(t.isItalic=t.wasItalic,t.isBold=t.wasBold,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null,!(a.length>0))return e.pos=l[0].pos-2,t.oldStyle;a[a.length-1].pos++,t.oldTokens=a}else t.oldTokens=a.concat(l);return s=t.oldTokens.shift(),e.pos=s.pos,i=s.state,s.style},blankLine:function(t){t.extMode&&t.extMode.blankLine&&t.extMode.blankLine(t.extState)},tokenTable:this.tokenTable}}}],i&&Yu(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();mw.loader.getState("ext.wikiEditor")&&mw.hook("wikiEditor.toolbarReady").add((function(t){var e=new zu(t,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t=t||mw.config.get("extCodeMirrorConfig");var e=new Qu(t).mediawiki,i=bl.define(e),n=[Qa(Ga.define(ql.getTagStyles(e)))],r=t.templateFoldingNamespaces;return r&&!r.includes(mw.config.get("wgNamespaceNumber"))||n.push(Gu),new Sa(i,n)}());e.addCodeMirrorToWikiEditor()}))})(); +(()=>{"use strict";class t{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){let r=[];return this.decompose(0,t,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(e,this.length,r,1),i.from(r,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let n=[];return this.decompose(t,e,n,0),i.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new s(this),r=new s(t);for(let t=e,s=e;;){if(n.next(t),r.next(t),t=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(s+=n.value.length,n.done||s>=i)return!0}}iter(t=1){return new s(this,t)}iterRange(t,e=this.length){return new o(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(n){if(0==n.length)throw new RangeError("A document must have at least one line");return 1!=n.length||n[0]?n.length<=32?new e(n):i.from(e.split(n,[])):t.empty}}class e extends t{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let r=0;;r++){let s=this.text[r],o=n+s.length;if((e?i:o)>=t)return new l(n,o,i,s);n=o+1,i++}}decompose(t,i,s,o){let a=t<=0&&i>=this.length?this:new e(r(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&o){let t=s.pop(),i=n(a.text,t.text.slice(),0,a.length);if(i.length<=32)s.push(new e(i,t.length+a.length));else{let t=i.length>>1;s.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else s.push(a)}replace(t,s,o){if(!(o instanceof e))return super.replace(t,s,o);let a=n(this.text,n(o.text,r(this.text,0,t)),s),l=this.length+o.length-(s-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}sliceString(t,e=this.length,i="\n"){let n="";for(let r=0,s=0;r<=e&&st&&s&&(n+=i),tr&&(n+=o.slice(Math.max(0,t-r),e-r)),r=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,i){let n=[],r=-1;for(let s of t)n.push(s),r+=s.length+1,32==n.length&&(i.push(new e(n,r)),n=[],r=-1);return r>-1&&i.push(new e(n,r)),i}}class i extends t{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let r=0;;r++){let s=this.children[r],o=n+s.length,a=i+s.lines-1;if((e?a:o)>=t)return s.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let r=0,s=0;s<=e&&r=s){let r=n&((s<=t?1:0)|(a>=e?2:0));s>=t&&a<=e&&!r?i.push(o):o.decompose(t-s,e-s,i,r)}s=a+1}}replace(t,e,n){if(n.lines=s&&e<=a){let l=o.replace(t-s,e-s,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let s=this.children.slice();return s[r]=l,new i(s,this.length-(e-t)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(t,e,n)}sliceString(t,e=this.length,i="\n"){let n="";for(let r=0,s=0;rt&&r&&(n+=i),ts&&(n+=o.sliceString(t-s,e-s,i)),s=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let n=0,[r,s,o,a]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=e,s+=e){if(r==o||s==a)return n;let i=this.children[r],l=t.children[s];if(i!=l)return n+i.scanIdentical(l,e);n+=i.length+1}}static from(t,n=t.reduce(((t,e)=>t+e.length+1),-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let i=[];for(let e of t)e.flatten(i);return new e(i,n)}let s=Math.max(32,r>>5),o=s<<1,a=s>>1,l=[],h=0,c=-1,u=[];function f(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)f(e);else t.lines>a&&(h>a||!h)?(d(),l.push(t)):t instanceof e&&h&&(n=u[u.length-1])instanceof e&&t.lines+n.lines<=32?(h+=t.lines,c+=t.length+1,u[u.length-1]=new e(n.text.concat(t.text),n.length+1+t.length)):(h+t.lines>s&&d(),h+=t.lines,c+=t.length+1,u.push(t))}function d(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)f(e);return d(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let r=0,s=0,o=!0;s=i&&(l>n&&(a=a.slice(0,n-r)),r0?1:(t instanceof e?t.text.length:t.children.length)<<1]}nextInner(t,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,a=r instanceof e?r.text.length:r.children.length;if(o==(i>0?a:0)){if(0==n)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(i>0?0:1)){if(this.offsets[n]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(r instanceof e){let e=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,e.length>Math.max(0,t))return this.value=0==t?e:i>0?e.slice(t):e.slice(0,e.length-t),this;t-=e.length}else{let s=r.children[o+(i<0?-1:0)];t>s.length?(t-=s.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(s),this.offsets.push(i>0?1:(s instanceof e?s.text.length:s.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class o{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new s(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class a{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter()},s.prototype[Symbol.iterator]=o.prototype[Symbol.iterator]=a.prototype[Symbol.iterator]=function(){return this});class l{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}let h="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((t=>t?parseInt(t,36):1));for(let t=1;tt)return h[e-1]<=t;return!1}function u(t){return t>=127462&&t<=127487}const f=8205;function d(t,e,i=!0,n=!0){return(i?p:m)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&w(t.charCodeAt(e-1))&&e--;let n=v(t,e);for(e+=b(n);e=0&&u(v(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function m(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function w(t){return t>=55296&&t<56320}function v(t,e){let i=t.charCodeAt(e);if(!w(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function y(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function b(t){return t<65536?1:2}const k=/\r\n?|\n/;var x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(x||(x={}));class S{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return r+(t-n);r+=o}else{if(i!=x.Simple&&l>=t&&(i==x.TrackDel&&nt||i==x.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?r:r+a;r+=a}n=l}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return r}touchesRange(t,e=t){for(let i=0,n=0;i=0&&n<=e&&r>=t)return!(ne)||"cover";n=r}return!1}toString(){let t="";for(let e=0;e=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t)}static create(t){return new S(t)}}class A extends S{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return T(this,((e,i,n,r,s)=>t=t.replace(n,n+(i-e),s)),!1),t}mapDesc(t,e=!1){return O(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,s=0;r=0){i[r]=a,i[r+1]=o;let l=r>>1;for(;n.length0&&C(i,e,r.text),r.forward(t),o+=t}let l=t[s++];for(;o>1].toJSON()))}return t}static of(e,i,n){let r=[],s=[],o=0,a=null;function l(t=!1){if(!t&&!r.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||k)):c:t.empty,f=u.length;if(e==a&&0==f)return;eo&&M(r,e-o,-1),M(r,a-e,f),C(s,r,u),o=a}}(e),l(!a),a}static empty(t){return new A(t?[t,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let r=0;re&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)i.push(s[0],0);else{for(;n.length=0&&i<=0&&i==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=i:n?(t[r]+=e,t[r+1]+=i):t.push(e,i)}function C(e,i,n){if(0==n.length)return;let r=i.length-2>>1;if(r>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(s,c,o,u,f),s=c,o=u}}}function O(t,e,i,n=!1){let r=[],s=n?[]:null,o=new E(t),a=new E(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);M(r,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return s?A.createSet(r,s):S.create(r);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),s.forward2(e),o.forward(e)}}else M(n,0,o.ins,t),r&&C(r,n,o.text),o.next()}}class E{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return i>=e.length?t.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?t.empty:i[n].slice(this.off,null==e?void 0:this.off+e)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class L{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let t=3&this.flags;return 3==t?null:t}get goalColumn(){let t=this.flags>>5;return 33554431==t?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new L(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head)}static create(t,e,i){return new L(t,e,i)}}class B{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:B.create(this.ranges.map((i=>i.map(t,e))),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;et.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map((t=>L.fromJSON(t))),t.main)}static single(t,e=t){return new B([B.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;nt?4:0)|r)}static normalized(t,e=0){let i=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(i);for(let i=1;in.head?B.range(o,s):B.range(s,o))}}return new B(t,e)}}function P(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let N=0;class R{constructor(t,e,i,n,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=N++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}static define(t={}){return new R(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:I),!!t.static,t.enables)}of(t){return new z([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function I(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class z{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=N++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,r=this.id,s=t[r]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!0:0==(1&(null!==(e=t[i.id])&&void 0!==e?e:1))&&h.push(t[i.id]);return{create:t=>(t.values[s]=i(t),1),update(t,e){if(a&&e.docChanged||l&&(e.docChanged||e.selection)||V(t,h)){let e=i(t);if(o?!H(e,t.values[s],n):!n(e,t.values[s]))return t.values[s]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[r];if(null!=l){let r=X(e,l);if(this.dependencies.every((i=>i instanceof R?e.facet(i)===t.facet(i):!(i instanceof j)||e.field(i,!1)==t.field(i,!1)))||(o?H(a=i(t),r,n):n(a=i(t),r)))return t.values[s]=r,0}else a=i(t);return t.values[s]=a,1}}}}function H(t,e,i){if(t.length!=e.length)return!1;for(let n=0;nt[e.id])),r=i.map((t=>t.type)),s=n.filter((t=>!(1&t))),o=t[e.id]>>1;function a(t){let i=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(F).find((t=>t.field==this));return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,i)=>{let n=t.values[e],r=this.updateF(n,i);return this.compareF(n,r)?0:(t.values[e]=r,1)},reconfigure:(t,i)=>null!=i.config.address[this.id]?(t.values[e]=i.field(this),0):(t.values[e]=this.create(t),1)}}init(t){return[this,F.of({field:this,create:t})]}get extension(){return this}}function _(t){return e=>new K(e,t)}const q={highest:_(0),high:_(1),default:_(2),low:_(3),lowest:_(4)};class K{constructor(t,e){this.inner=t,this.prec=e}}class U{of(t){return new G(this,t)}reconfigure(t){return U.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class G{constructor(t,e){this.compartment=t,this.inner=e}}class J{constructor(t,e,i,n,r,s){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,i){let n=[],r=Object.create(null),s=new Map;for(let i of function(t,e,i){let n=[[],[],[],[],[]],r=new Map;return function t(s,o){let a=r.get(s);if(null!=a){if(a<=o)return;let t=n[a].indexOf(s);t>-1&&n[a].splice(t,1),s instanceof G&&i.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let e of s)t(e,o);else if(s instanceof G){if(i.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(s.compartment)||s.inner;i.set(s.compartment,n),t(n,o)}else if(s instanceof K)t(s.inner,s.prec);else if(s instanceof j)n[o].push(s),s.provides&&t(s.provides,o);else if(s instanceof z)n[o].push(s),s.facet.extensions&&t(s.facet.extensions,2);else{let e=s.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,2),n.reduce(((t,e)=>t.concat(e)))}(t,e,s))i instanceof j?n.push(i):(r[i.facet.id]||(r[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.push((e=>t.slot(e)));let h=null==i?void 0:i.config.facets;for(let t in r){let e=r[t],n=e[0].facet,s=h&&h[t]||[];if(e.every((t=>0==t.type)))if(o[n.id]=a.length<<1|1,I(s,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>W(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,s,c,o,a,r)}}function Y(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r}function X(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const Q=R.define(),Z=R.define({combine:t=>t.some((t=>t)),static:!0}),tt=R.define({combine:t=>t.length?t[0]:void 0,static:!0}),et=R.define(),it=R.define(),nt=R.define(),rt=R.define({combine:t=>!!t.length&&t[0]});class st{constructor(t,e){this.type=t,this.value=e}static define(){return new ot}}class ot{of(t){return new st(this,t)}}class at{constructor(t){this.map=t}of(t){return new lt(this,t)}}class lt{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new lt(this.type,e)}is(t){return this.type==t}static define(t={}){return new at(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}lt.reconfigure=lt.define(),lt.appendConfig=lt.define();class ht{constructor(t,e,i,n,r,s){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,i&&P(i,e.newLength),r.some((t=>t.type==ht.time))||(this.annotations=r.concat(ht.time.of(Date.now())))}static create(t,e,i,n,r,s){return new ht(t,e,i,n,r,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(ht.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ct(t,e){let i=[];for(let n=0,r=0;;){let s,o;if(n=t[n]))s=t[n++],o=t[n++];else{if(!(r=0;r--){let s=i[r](t);s&&Object.keys(s).length&&(n=ut(n,ft(e,s,t.changes.newLength),!0))}return n==t?t:ht.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let n of e.facet(et)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ct(i,e))}if(!0!==i){let n,r;if(!1===i)r=t.changes.invertedDesc,n=A.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,r=e.filtered.mapDesc(e.changes).invertedDesc}t=ht.create(e,n,t.selection&&t.selection.map(r),lt.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let n=e.facet(it);for(let i=n.length-1;i>=0;i--){let r=n[i](t);t=r instanceof ht?r:Array.isArray(r)&&1==r.length&&r[0]instanceof ht?r[0]:dt(e,mt(r),!1)}return t}(r):r)}ht.time=st.define(),ht.userEvent=st.define(),ht.addToHistory=st.define(),ht.remote=st.define();const pt=[];function mt(t){return null==t?pt:Array.isArray(t)?t:[t]}var gt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(gt||(gt={}));const wt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let vt;try{vt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class yt{constructor(t,e,i,n,r,s){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let t=0;tr.set(e,t))),i=null),r.set(e.value.compartment,e.value.extension)):e.is(lt.reconfigure)?(i=null,n=e.value):e.is(lt.appendConfig)&&(i=null,n=mt(n).concat(e.value));i?e=t.startState.values.slice():(i=J.resolve(n,r,this),e=new yt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values),new yt(i,t.newDoc,t.newSelection,e,((e,i)=>i.update(e,t)),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)})))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),r=[i.range],s=mt(i.effects);for(let i=1;ir.spec.fromJSON(s,t))))}return yt.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(e={}){let i=J.resolve(e.extensions||[],new Map),n=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(yt.lineSeparator)||k)),r=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return P(r,n.length),i.staticFacet(Z)||(r=r.asSingle()),new yt(i,n,r,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(yt.tabSize)}get lineBreak(){return this.facet(yt.lineSeparator)||"\n"}get readOnly(){return this.facet(rt)}phrase(t,...e){for(let e of this.facet(yt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,((t,i)=>{if("$"==i)return"$";let n=+(i||1);return!n||n>e.length?t:e[n-1]}))),t}languageDataAt(t,e,i=-1){let n=[];for(let r of this.facet(Q))for(let s of r(this,e,i))Object.prototype.hasOwnProperty.call(s,t)&&n.push(s[t]);return n}charCategorizer(t){return e=this.languageDataAt("wordChars",t).join(""),t=>{if(!/\S/.test(t))return gt.Space;if(function(t){if(vt)return vt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||wt.test(i)))return!0}return!1}(t))return gt.Word;for(let i=0;i-1)return gt.Word;return gt.Other};var e}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),r=this.charCategorizer(t),s=t-i,o=t-i;for(;s>0;){let t=d(e,s,!1);if(r(e.slice(t,s))!=gt.Word)break;s=t}for(;ot.length?t[0]:4}),yt.lineSeparator=tt,yt.readOnly=rt,yt.phrases=R.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every((i=>t[i]==e[i]))}}),yt.languageData=Q,yt.changeFilter=et,yt.transactionFilter=it,yt.transactionExtender=nt,U.reconfigure=lt.define();class kt{eq(t){return this==t}range(t,e=t){return xt.create(t,e,this)}}kt.prototype.startSide=kt.prototype.endSide=0,kt.prototype.point=!1,kt.prototype.mapMode=x.TrackDel;class xt{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new xt(t,e,i)}}function St(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class At{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let r=i?this.to:this.from;for(let s=n,o=r.length;;){if(s==o)return s;let n=s+o>>1,a=r[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==s)return a>=0?s:o;a>=0?o=n:s=n+1}}between(t,e,i,n){for(let r=this.findIndex(e,-1e9,!0),s=this.findIndex(i,1e9,!1,r);rh||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(s<0&&(s=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-s),r.push(h-s))}return{mapped:i.length?new At(n,r,i,o):null,pos:s}}}class Mt{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new Mt(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:r=this.length}=t,s=t.filter;if(0==e.length&&!s)return this;if(i&&(e=e.slice().sort(St)),this.isEmpty)return e.length?Mt.of(e):this;let o=new Ot(this,null,-1).goto(0),a=0,l=[],h=new Ct;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.push(t)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||ro.to||r=r&&t<=r+s.length&&!1===s.between(r,t-r,e-r,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return Dt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Dt.from(t).goto(e)}static compare(t,e,i,n,r=-1){let s=t.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),o=e.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),a=Tt(s,o,i),l=new Lt(s,a,r),h=new Lt(o,a,r);i.iterGaps(((t,e,i)=>Bt(l,t,h,e,i,n))),i.empty&&0==i.length&&Bt(l,0,h,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),s=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(r.length!=s.length)return!1;if(!r.length)return!0;let o=Tt(r,s),a=new Lt(r,o,0).goto(i),l=new Lt(s,o,0).goto(i);for(;;){if(a.to!=l.to||!Pt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,r=-1){let s=new Lt(t,null,r).goto(e),o=e,a=s.openStart;for(;;){let t=Math.min(s.to,i);if(s.point){let i=s.activeForPoint(s.to),r=s.pointFromo&&(n.span(o,t,s.active,a),a=s.openEnd(t));if(s.to>i)return a+(s.point&&s.to>i?1:0);o=s.to,s.next()}}static of(t,e=!1){let i=new Ct;for(let n of t instanceof xt?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(St);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}Mt.empty=new Mt([],[],null,-1),Mt.empty.nextLayer=Mt.empty;class Ct{finishChunk(t){this.chunks.push(new At(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Ct)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(Mt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Tt(t,e,i){let n=new Map;for(let e of t)for(let t=0;t=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&n.push(new Ot(s,e,i,r));return 1==n.length?n[0]:new Dt(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Et(this.heap,0)}}}function Et(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let r=t[n];if(n+1=0&&(r=t[n+1],n++),i.compare(r)<0)break;t[n]=i,t[e]=r,e=n}}class Lt{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Nt(this.active,t),Nt(this.activeTo,t),Nt(this.activeRank,t),this.minActive=It(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:r}=this.cursor;for(;e-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Nt(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&i[e]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function Bt(t,e,i,n,r,s){t.goto(e),i.goto(n);let o=n+r,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l:i.to,r=Math.min(n,o);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Pt(t.activeForPoint(t.to),i.activeForPoint(i.to))||s.comparePoint(a,r,t.point,i.point):r>a&&!Pt(t.active,i.active)&&s.compareRange(a,r,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Pt(t,e){if(t.length!=e.length)return!1;for(let i=0;i=e;i--)t[i+1]=t[i];t[e]=i}function It(t,e){let i=-1,n=1e9;for(let r=0;rt.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,s);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");r(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&s.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)r(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=Wt[Ht]||1;return Wt[Ht]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[Vt],r=i&&i.nonce;n?r&&n.setNonce(r):n=new _t(t,r),n.mount(Array.isArray(e)?e:[e])}}let jt=new Map;class _t{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=jt.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[Vt]=e;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],jt.set(i,this)}else{this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);let n=t.head||t;n.insertBefore(this.styleTag,n.firstChild)}this.modules=[],t[Vt]=this}mount(t){let e=this.sheet,i=0,n=0;for(let r=0;r-1&&(this.modules.splice(o,1),n--,o=-1),-1==o){if(this.modules.splice(n++,0,s),e)for(let t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ut="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Gt=0;Gt<10;Gt++)qt[48+Gt]=qt[96+Gt]=String(Gt);for(Gt=1;Gt<=24;Gt++)qt[Gt+111]="F"+Gt;for(Gt=65;Gt<=90;Gt++)qt[Gt]=String.fromCharCode(Gt+32),$t[Gt]=String.fromCharCode(Gt);for(var Jt in qt)$t.hasOwnProperty(Jt)||($t[Jt]=qt[Jt]);function Yt(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function Xt(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Qt(t,e){if(!e.anchorNode)return!1;try{return Xt(t,e.anchorNode)}catch(t){return!1}}function Zt(t){return 3==t.nodeType?ue(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function te(t,e,i,n){return!!i&&(ie(t,e,i,n,-1)||ie(t,e,i,n,1))}function ee(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function ie(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:ne(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ee(t)+(r<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?ne(t):0}}}function ne(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function re(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function se(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function oe(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}class ae{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?ne(e):0),i,Math.min(t.focusOffset,i?ne(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let le,he=null;function ce(t){if(t.setActive)return t.setActive();if(he)return t.focus(he);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==he?{get preventScroll(){return he={preventScroll:!0},!0}}:void 0),!he){he=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}class me{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new me(t.parentNode,ee(t),e)}static after(t,e){return new me(t.parentNode,ee(t)+1,e)}}const ge=[];class we{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let i,n=this.dom,r=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(i=r?r.nextSibling:n.firstChild)){let t=we.get(i);(!t||!t.parent&&t.canReuseDOM(s))&&s.reuseDOM(i)}s.sync(t,e),s.flags&=-8}if(i=r?r.nextSibling:n.firstChild,e&&!e.written&&e.node==n&&i!=s.dom&&(e.written=!0),s.dom.parentNode==n)for(;i&&i!=s.dom;)i=ve(i);else n.insertBefore(s.dom,i);r=s.dom}for(i=r?r.nextSibling:n.firstChild,i&&e&&e.node==n&&(e.written=!0);i;)i=ve(i)}else if(1&this.flags)for(let i of this.children)7&i.flags&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let n=0==ne(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}i=n<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!we.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let n=this.children[t];if(n.dom==i)return e;e+=n.length+n.breakAfter}}domBoundsAround(t,e,i=0){let n=-1,r=-1,s=-1,o=-1;for(let a=0,l=i,h=i;ae)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,r=l),l>e&&i.dom.parentNode==this.dom){s=a,o=h;break}h=c,l=c+i.breakAfter}return{from:r,to:o<0?i+this.length:o,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=ge){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function be(t,e,i,n,r,s,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=s.length?s[s.length-1]:null,f=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!f&&s.length<2&&c.merge(i,r,s.length?u:null,0==i,a,l))){if(n0&&(!o&&s.length&&c.merge(i,c.length,s[0],!1,a,0)?c.breakAfter=s.shift().breakAfter:(i2);var Pe={mac:Be||/Mac/.test(xe.platform),windows:/Win/.test(xe.platform),linux:/Linux|X11/.test(xe.platform),ie:Te,ie_version:Me?Se.documentMode||6:Ce?+Ce[1]:Ae?+Ae[1]:0,gecko:Oe,gecko_version:Oe?+(/Firefox\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,chrome:!!De,chrome_version:De?+De[1]:0,ios:Be,android:/Android\b/.test(xe.userAgent),webkit:Ee,safari:Le,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Se.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Ne extends we{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Ne)||this.length-(e-t)+i.length>256||8&i.flags)||(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),0))}split(t){let e=new Ne(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new me(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,i){let n=t.nodeValue.length;e>n&&(e=n);let r=e,s=e,o=0;0==e&&i<0||e==n&&i>=0?Pe.chrome||Pe.gecko||(e?(r--,o=1):s=0)?0:a.length-1];return Pe.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?re(l,o<0):l||null}(this.dom,t,e)}}class Re extends we{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let t of e)t.setParent(this)}setAttrs(t){if(de(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof Re&&i.mark.eq(this.mark))||t&&r<=0||et&&e.push(i=t&&(n=r),i=o,r++}let s=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new Re(this.mark,e,s)}domAtPos(t){return He(this,t)}coordsAt(t,e){return We(this,t,e)}}class Ie extends we{static create(t,e,i){return new Ie(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Ie.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof Ie&&this.widget.compare(i.widget))||t>0&&r<=0||e0)?me.before(this.dom):me.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let n=this.dom.getClientRects(),r=null;if(!n.length)return null;let s=this.side?this.side<0:t>0;for(let e=s?n.length-1:0;r=n[e],!(t>0?0==e:e==n.length-1||r.top0?me.before(this.dom):me.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function He(t,e){let i=t.dom,{children:n}=t,r=0;for(let t=0;rt&&e0;t--){let e=n[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=r;t0&&e instanceof Re&&r.length&&(n=r[r.length-1])instanceof Re&&n.mark.eq(e.mark)?Ve(n,e.children[0],i-1):(r.push(e),e.setParent(t)),t.length+=e.length}function We(t,e,i){let n=null,r=-1,s=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!s||s.isHidden&&i>0)&&(u>a||h==u&&c.getSide()>0)?(s=c,o=a-h):(h-1?1:0)!=r.length-(i&&r.indexOf(i)>-1?1:0))return!1;for(let s of n)if(s!=i&&(-1==r.indexOf(s)||t[s]!==e[s]))return!1;return!0}function qe(t,e,i){let n=!1;if(e)for(let r in e)i&&r in i||(n=!0,"style"==r?t.style.cssText="":t.removeAttribute(r));if(i)for(let r in i)e&&e[r]==i[r]||(n=!0,"style"==r?t.style.cssText=i[r]:t.setAttribute(r,i[r]));return n}function $e(t){let e=Object.create(null);for(let i=0;i0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){_e(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Ve(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Fe(e,this.attrs||{})),i&&(this.attrs=Fe({class:i},this.attrs||{}))}domAtPos(t){return He(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(de(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(qe(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&we.get(n)instanceof Re;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=we.get(n))||void 0===i?void 0:i.isEditable)||Pe.ios&&this.children.some((t=>t instanceof Ne))))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let i of this.children){if(!(i instanceof Ne)||/[^ -~]/.test(i.text))return null;let n=Zt(i.dom);if(1!=n.length)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=We(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=i.bottom-i.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight=e){if(r instanceof Ke)return r;if(s>e)break}n=s+r.breakAfter}return null}}class Ue extends we{constructor(t,e,i){super(),this.widget=t,this.length=e,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof Ue&&this.widget.compare(i.widget))||t>0&&r<=0||e0)}}class Ge{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}destroy(t){}}var Je=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Je||(Je={}));class Ye extends kt{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Xe(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ze(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:r,end:s}=ti(t,n);e=(r?n?-3e8:-1:5e8)-1,i=1+(s?n?2e8:1:-6e8)}return new Ze(t,e,i,n,t.widget||null,!0)}static line(t){return new Qe(t)}static set(t,e=!1){return Mt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Ye.none=Mt.empty;class Xe extends Ye{constructor(t){let{start:e,end:i}=ti(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof Xe&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&_e(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Xe.prototype.point=!1;class Qe extends Ye{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Qe&&this.spec.class==t.spec.class&&_e(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}Qe.prototype.mapMode=x.TrackBefore,Qe.prototype.point=!0;class Ze extends Ye{constructor(t,e,i,n,r,s){super(e,i,r,t),this.block=n,this.isReplace=s,this.mapMode=n?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel}get type(){return this.startSide!=this.endSide?Je.WidgetRange:this.startSide<=0?Je.WidgetBefore:Je.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Ze&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function ti(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function ei(t,e,i,n=0){let r=i.length-1;r>=0&&i[r]+n>=t?i[r]=Math.max(i[r],e):i.push(t,e)}Ze.prototype.point=!0;class ii{constructor(t,e,i,n){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof Ue&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ke),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(ni(new ze(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof Ue||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ni(new Ne(this.text.slice(this.textOff,this.textOff+n)),e),i),this.atCursorPos=!0,this.textOff+=n,t-=n,i=0}}span(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,i,n,r,s){if(this.disallowBlockEffectsFor[s]&&i instanceof Ze){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof Ze)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ue(i.widget||new ri("div"),o,i));else{let s=Ie.create(i.widget||new ri("span"),o,o?0:i.startSide),a=this.atCursorPos&&!s.isEditable&&r<=n.length&&(t0),l=!s.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(ni(new ze(1),n),r),r=n.length+Math.max(0,r-n.length)),h.append(ni(s,n),r),this.atCursorPos=l,this.pendingBuffer=l?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,i,n,r){let s=new ii(t,e,i,r);return s.openEnd=Mt.spans(n,e,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function ni(t,e){for(let i of e)t=new Re(i,[t],t.length);return t}class ri extends Ge{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const si=R.define(),oi=R.define(),ai=R.define(),li=R.define(),hi=R.define(),ci=R.define(),ui=R.define(),fi=R.define({combine:t=>t.some((t=>t))}),di=R.define({combine:t=>t.some((t=>t))});class pi{constructor(t,e="nearest",i="nearest",n=5,r=5,s=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=s}map(t){return t.empty?this:new pi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new pi(B.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const mi=lt.define({map:(t,e)=>t.map(e)});function gi(t,e,i){let n=t.facet(li);n.length?n[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const wi=R.define({combine:t=>!t.length||t[0]});let vi=0;const yi=R.define();class bi{constructor(t,e,i,n,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.extension=r(this)}static define(t,e){const{eventHandlers:i,eventObservers:n,provide:r,decorations:s}=e||{};return new bi(vi++,t,i,n,(t=>{let e=[yi.of(t)];return s&&e.push(Ai.of((e=>{let i=e.plugin(t);return i?s(i):Ye.none}))),r&&e.push(r(t)),e}))}static fromClass(t,e){return bi.define((e=>new t(e)),e)}}class ki{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(gi(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){gi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){gi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const xi=R.define(),Si=R.define(),Ai=R.define(),Mi=R.define(),Ci=R.define();function Ti(t,e,i){let n=t.state.facet(Ci);if(!n.length)return n;let r=n.map((e=>e instanceof Function?e(t):e)),s=[];return Mt.spans(r,e,i,{point(){},span(t,e,i,n){let r=s;for(let s=i.length-1;s>=0;s--,n--){let o,a=i[s].spec.bidiIsolate;if(null!=a)if(n>0&&r.length&&(o=r[r.length-1]).to==t&&o.direction==a)o.to=e,r=o.inner;else{let i={from:t,to:e,direction:a,inner:[]};r.push(i),r=i.inner}}}}),s}const Oi=R.define();function Di(t){let e=0,i=0,n=0,r=0;for(let s of t.state.facet(Oi)){let o=s(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(i=Math.max(i,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:e,right:i,top:n,bottom:r}}const Ei=R.define();class Li{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Li(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toAh)break;r+=2}if(!a)return i;new Li(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),s=a.toA,o=a.toB}}}class Bi{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let n=[];this.changes.iterChangedRanges(((t,e,i,r)=>n.push(new Li(t,e,i,r)))),this.changedRanges=n}static create(t,e,i){return new Bi(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}var Pi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Pi||(Pi={}));const Ni=Pi.LTR,Ri=Pi.RTL;function Ii(t){let e=[];for(let i=0;i=e){if(o.level==i)return s;(r<0||(0!=n?n<0?o.frome:t[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function _i(t,e){if(t.length!=e.length)return!1;for(let i=0;il&&o.push(new ji(l,p.from,f)),Ki(t,p.direction==Ni!=!(f%2)?n+1:n,r,p.inner,p.from,p.to,o),l=p.to),d=p.to}else{if(d==i||(e?qi[d]!=a:qi[d]==a))break;d++}u?$i(t,l,d,n+1,r,u,o):le;){let i=!0,c=!1;if(!h||l>s[h-1].to){let t=qi[l-1];t!=a&&(i=!1,c=16==t)}let u=i||1!=a?null:[],f=i?n:n+1,d=l;t:for(;;)if(h&&d==s[h-1].to){if(c)break t;let p=s[--h];if(!i)for(let t=p.from,i=h;;){if(t==e)break t;if(!i||s[i-1].to!=t){if(qi[t-1]==a)break t;break}t=s[--i].from}u?u.push(p):(p.to=0;t-=3)if(Wi[t+1]==-i){let e=Wi[t+2],i=2&e?r:4&e?1&e?s:r:0;i&&(qi[o]=qi[Wi[t]]=i),a=t;break}}else{if(189==Wi.length)break;Wi[a++]=o,Wi[a++]=e,Wi[a++]=l}else if(2==(n=qi[o])||1==n){let t=n==r;l=t?0:1;for(let e=a-3;e>=0;e-=3){let i=Wi[e+2];if(2&i)break;if(t)Wi[e+2]|=2;else{if(4&i)break;Wi[e+2]|=4}}}}}(t,r,s,n,a),function(t,e,i,n){for(let r=0,s=n;r<=i.length;r++){let o=r?i[r-1].to:t,a=rl;)e==s&&(e=i[--n].from,s=n?i[n-1].to:t),qi[--e]=c;l=o}else s=o,l++}}}(r,s,n,a),$i(t,r,s,e,i,n,o)}function Ui(t){return[new ji(0,t,0)]}let Gi="";function Ji(t,e,i,n,r){var s;let o=n.head-t.from,a=-1;if(0==o){if(!r||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(r)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=ji.find(e,o,null!==(s=n.bidiLevel)&&void 0!==s?s:-1,n.assoc));let l=e[a];o==l.side(r,i)&&(l=e[a+=r?1:-1],o=l.side(!r,i));let h=r==(l.dir==i),c=d(t.text,o,h);if(Gi=t.text.slice(Math.min(o,c),Math.max(o,c)),c>l.from&&c0&&i.length&&(i.every((({fromA:t,toA:e})=>ethis.minWidthTo))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?n=this.domChanged.newSel.head:function(t,e){let i=!1;return e&&t.iterChangedRanges(((t,n)=>{te.from&&(i=!0)})),i}(t.changes,this.hasComposition)||t.selectionSet||(n=t.state.selection.main.head));let r=n>-1?function(t,e,i){let n=Qi(t,i);if(!n)return null;let{node:r,from:s,to:o}=n,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(t.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc,h=new Li(l.mapPos(s),l.mapPos(o),s,o),c=[];for(let e=r.parentNode;;e=e.parentNode){let i=we.get(e);if(i instanceof Re)c.push({node:e,deco:i.mark});else{if(i instanceof Ke||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:h,text:r,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new Xe({inclusive:!0,attributes:$e(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:n}=this.hasComposition;i=new Li(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Pe.ie||Pe.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,i){let n=new tn;return Mt.compare(t,e,i,n),n.changes}(this.decorations,this.updateDeco(),t.changes);return i=Li.extendWithRanges(i,s),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:n}=this.view;n.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Pe.chrome||Pe.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||n.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((t=>t.flags&=-9));let r=[];if(this.view.viewport.from||this.view.viewport.to=0?n[t]:null;if(!e)break;let s,o,a,l,{fromA:h,toA:c,fromB:u,toB:f}=e;if(i&&i.range.fromBu){let t=ii.build(this.view.state.doc,u,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=ii.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);o=t.breakAtStart,a=t.openStart,l=e.openEnd;let n=this.compositionView(i);e.breakAtStart?n.breakAfter=1:e.content.length&&n.merge(n.length,n.length,e.content[0],!1,e.openStart,0)&&(n.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&n.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),s=t.content.concat(n).concat(e.content)}else({content:s,breakAtStart:o,openStart:a,openEnd:l}=ii.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=r.findPos(c,1),{i:m,off:g}=r.findPos(h,-1);be(this,m,g,d,p,s,o,a,l)}i&&this.fixCompositionDOM(i)}compositionView(t){let e=new Ne(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Re(i,[e],e.length);let i=new Ke;return i.append(e,0),i}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some((t=>7&t.flags))?1:0),this.markedForComposition.add(e);let i=we.get(t);i&&i!=e&&(i.dom=null),e.setDOM(t)},i=this.childPos(t.range.fromB,1),n=this.children[i.i];e(t.line,n);for(let r=t.marks.length-1;r>=-1;r--)i=n.childPos(i.off,1),n=n.children[i.i],e(r>=0?t.marks[r].node:t.text,n)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,r=!n&&Qt(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||e||r))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(o.anchor)),l=o.empty?a:this.moveToLine(this.domAtPos(o.head));if(Pe.gecko&&o.empty&&!this.hasComposition&&1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new me(t,0),s=!0}var h;let c=this.view.observer.selectionRange;!s&&c.focusNode&&te(a.node,a.offset,c.anchorNode,c.anchorOffset)&&te(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{Pe.android&&Pe.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=Yt(this.view.root);if(t)if(o.empty){if(Pe.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}var e,n;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new me(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new me(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Yt(t.root),{anchorNode:n,anchorOffset:r}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let s=Ke.find(this,e.head);if(!s)return;let o=s.posAtStart;if(e.head==o||e.head==o+s.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.top)return;let h=this.domAtPos(e.head+e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,r)}moveToLine(t){let e,i=this.dom;if(t.node!=i)return t;for(let n=t.offset;!e&&n=0;n--){let t=we.get(i.childNodes[n]);t instanceof Ke&&(e=t.domAtPos(t.length))}return e?new me(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=we.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e=0;s--){let o=this.children[s],a=r-o.breakAfter,l=a-o.length;if(at||o.covers(1))&&(!i||o instanceof Ke&&!(i instanceof Ke&&e>=0))&&(i=o,n=l),r=l}return i?i.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof Ke))return null;for(;n.children.length;){let{i:t,off:e}=n.childPos(i,1);for(;;t++){if(t==n.children.length)return null;if((n=n.children[t]).length)break}i=e}if(!(n instanceof Ne))return null;let r=d(n.text,i);if(r==i)return null;let s=ue(n.dom,i,r).getClientRects();for(let t=0;tMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Pi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),s){let e=h.dom.lastChild,n=e?Zt(e):[];if(n.length){let e=n[n.length-1],s=a?e.right-i.left:i.right-e.left;s>o&&(o=s,this.minWidth=r,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?Pi.RTL:Pi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof Ke){let e=t.measureTextSize();if(e)return e}let t,e,i,n=document.createElement("div");return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let r=Zt(n.firstChild)[0];t=n.getBoundingClientRect().height,e=r?r.width/27:7,i=r?r.height:t,n.remove()})),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ye(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let r=n==e.viewports.length?null:e.viewports[n],s=r?r.from-1:this.length;if(s>i){let n=(e.lineBlockAt(s).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(Ye.replace({widget:new Xi(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!r)break;i=r.to+1}return Ye.set(t)}updateDeco(){let t=this.view.state.facet(Ai).map(((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t));for(let e=t.length;ei.anchor?-1:1);if(!n)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,e.left),top:Math.min(n.top,e.top),right:Math.max(n.right,e.right),bottom:Math.max(n.bottom,e.bottom)});let r=Di(this.view),s={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:o,offsetHeight:a}=this.view.scrollDOM;!function(t,e,i,n,r,s,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,f=c==l.body,d=1,p=1;if(f)t=se(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:d,scaleY:p}=oe(c,e)),t={left:e.left,right:e.left+c.clientWidth*d,top:e.top,bottom:e.top+c.clientHeight*p}}let m=0,g=0;if("nearest"==r)e.top0&&e.bottom>t.bottom+g&&(g=e.bottom-t.bottom+g+o)):e.bottom>t.bottom&&(g=e.bottom-t.bottom+o,i<0&&e.top-g0&&e.right>t.right+m&&(m=e.right-t.right+m+s)):e.right>t.right&&(m=e.right-t.right+s,i<0&&e.left0))break;i=i.childNodes[n-1],n=ne(i)}if(i>=0)for(let n=t,r=e;;){if(3==n.nodeType)return{node:n,offset:r};if(!(1==n.nodeType&&r=0))break;n=n.childNodes[r],r=0}return null}let tn=class{constructor(){this.changes=[]}compareRange(t,e){ei(t,e,this.changes)}comparePoint(t,e){ei(t,e,this.changes)}};function en(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function nn(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function rn(t,e){return t.tope.top+1}function sn(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function an(t,e,i){let n,r,s,o,a,l,h,c,u=!1;for(let f=t.firstChild;f;f=f.nextSibling){let t=Zt(f);for(let d=0;dg||o==g&&s>m){n=f,r=p,s=m,o=g;let a=g?i0?d0)}0==m?i>p.bottom&&(!h||h.bottomp.top)&&(l=f,c=p):h&&rn(h,p)?h=on(h,p.bottom):c&&rn(c,p)&&(c=sn(c,p.top))}}if(h&&h.bottom>=i?(n=a,r=h):c&&c.top<=i&&(n=l,r=c),!n)return{node:t,offset:0};let f=Math.max(r.left,Math.min(r.right,e));return 3==n.nodeType?ln(n,f,i):u&&"false"!=n.contentEditable?an(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(r.left+r.right)/2?1:0)}}function ln(t,e,i){let n=t.nodeValue.length,r=-1,s=1e9,o=0;for(let a=0;ai?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c=(h.left+h.right)/2,n=i;if((Pe.chrome||Pe.gecko)&&ue(t,a).getBoundingClientRect().left==h.right&&(n=!i),c<=0)return{node:t,offset:a+(n?1:0)};r=a+(n?1:0),s=c}}}return{node:t,offset:r>-1?r:o>0?t.nodeValue.length:0}}function hn(t,e,i,n=-1){var r,s;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,f=u-l;if(f<0)return 0;if(f>h)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,r=!1;o=t.elementAtHeight(f),o.type!=Je.Text;)for(;f=n>0?o.bottom+e:o.top-e,!(f>=0&&f<=h);){if(r)return i?null:0;r=!0,n=-n}u=l+f;let d=o.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:cn(t,a,o,c,u);let p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,g=m.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=m.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let w,v=-1;if(g&&0!=(null===(r=t.docView.nearest(g))||void 0===r?void 0:r.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:w,offset:v}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:w,startOffset:v}=e),(!t.contentDOM.contains(w)||Pe.safari&&function(t,e,i){let n;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(let e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return!1;return ue(t,n-1,n).getBoundingClientRect().left>i}(w,v,c)||Pe.chrome&&function(t,e,i){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}return i-(1==t.nodeType?t.getBoundingClientRect():ue(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(w,v,c))&&(w=void 0))}if(!w||!t.docView.dom.contains(w)){let e=Ke.find(t.docView,d);if(!e)return f>o.top+o.height/2?o.to:o.from;({node:w,offset:v}=an(e.dom,c,u))}let y=t.docView.nearest(w);if(!y)return null;if(y.isWidget&&1==(null===(s=y.dom)||void 0===s?void 0:s.nodeType)){let t=y.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;s+=Math.floor((r-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+function(t,e,i,n){for(let n=0,r=0;;){if(r>=e)return n;if(n==t.length)break;r+=9==t.charCodeAt(n)?i-r%i:1,n=d(t,n)}return t.length}(o,s,t.state.tabSize)}function un(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type))for(let t of i.type)if(t.to>e||t.to==e&&(t.to==i.to||t.type==Je.Text))return t;return i}function fn(t,e,i,n){let r=t.state.doc.lineAt(e.head),s=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let a=e,l=null;;){let e=Ji(r,s,o,a,i),h=Gi;if(!e){if(r.number==(i?t.state.doc.lines:1))return a;h="\n",r=t.state.doc.line(r.number+(i?1:-1)),s=t.bidiSpans(r),e=B.cursor(i?r.from:r.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function dn(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,((t,r,s)=>{if(e>t&&ee(t))),i.from,e.head>i.from?-1:1);return n==i.from?i:B.cursor(n,nnull)),Pe.gecko&&function(t){jn.has(t)||(jn.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=we.get(n))&&i.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=wn(t),i=this.handlers,n=this.view.contentDOM;for(let t in e)if("scroll"!=t){let r=!e[t].handlers.length,s=i[t];s&&r!=!s.handlers.length&&(n.removeEventListener(t,this.handleEvent),s=null),s||n.addEventListener(t,this.handleEvent,{passive:r})}for(let t in i)"scroll"==t||e[t]||n.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()e.keyCode==t.keyCode)))&&!t.ctrlKey||yn.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(){let t=this.pendingIOSKey;return!!t&&(this.pendingIOSKey=void 0,fe(this.view.contentDOM,t.key,t.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Pe.safari&&!Pe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function gn(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(t){gi(i.state,t)}}}function wn(t){let e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec;if(t&&t.domEventHandlers)for(let n in t.domEventHandlers){let r=t.domEventHandlers[n];r&&i(n).handlers.push(gn(e.value,r))}if(t&&t.domEventObservers)for(let n in t.domEventObservers){let r=t.domEventObservers[n];r&&i(n).observers.push(gn(e.value,r))}}for(let t in Sn)i(t).handlers.push(Sn[t]);for(let t in An)i(t).observers.push(An[t]);return e}const vn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],yn="dthko",bn=[16,17,18,20,91,92,224,225];function kn(t){return.7*Math.max(0,t)+8}class xn{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){let e=t.ownerDocument;for(let i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}(t.contentDOM),this.atoms=t.state.facet(Mi).map((e=>e(t)));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(yt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(si);return i.length?i[0](e):Pe.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=Yt(t.root);if(!n||0==n.rangeCount)return!0;let r=n.getRangeAt(0).getClientRects();for(let t=0;t=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(t,e)||1!=In(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){var e,i,n;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,n=t,Math.max(Math.abs(i.clientX-n.clientX),Math.abs(i.clientY-n.clientY))<10))return;this.select(this.lastEvent=t);let r=0,s=0,o=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},a=Di(this.view);t.clientX-a.left<=o.left+6?r=-kn(o.left-t.clientX):t.clientX+a.right>=o.right-6&&(r=kn(t.clientX-o.right)),t.clientY-a.top<=o.top+6?s=-kn(o.top-t.clientY):t.clientY+a.bottom>=o.bottom-6&&(s=kn(t.clientY-o.bottom)),this.setScrollSpeed(r,s)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let i=0;ithis.select(this.lastEvent)),20)}}const Sn=Object.create(null),An=Object.create(null),Mn=Pe.ie&&Pe.ie_version<15||Pe.ios&&Pe.webkit_version<604;function Cn(t,e){let i,{state:n}=t,r=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(null!=Hn&&n.selection.ranges.every((t=>t.empty))&&Hn==s.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?s.line(r++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:B.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=s.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:B.cursor(t.from+e.length)}})):n.replaceSelection(s);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Tn(t,e,i,n){if(1==n)return B.cursor(e,i);if(2==n)return function(t,e,i=1){let n=t.charCategorizer(e),r=t.doc.lineAt(e),s=e-r.from;if(0==r.length)return B.cursor(e);0==s?i=1:s==r.length&&(i=-1);let o=s,a=s;i<0?o=d(r.text,s,!1):a=d(r.text,s);let l=n(r.text.slice(o,a));for(;o>0;){let t=d(r.text,o,!1);if(n(r.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Sn.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1),An.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},An.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Sn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(ai))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Ln(t,e),n=In(e),r=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes))},get(e,s,o){let a,l=Ln(t,e),h=Tn(t,l.pos,l.bias,n);if(i.pos!=l.pos&&!s){let e=Tn(t,i.pos,i.bias,n),r=Math.min(e.from,h.from),s=Math.max(e.to,h.to);h=r1&&(a=function(t,e){for(let i=0;i=e)return B.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(r,l.pos))?a:o?r.addRange(h):B.create([h])}}}(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new xn(t,e,i,n)),n&&t.observer.ignore((()=>ce(t.contentDOM)));let r=t.inputState.mouseSelection;if(r)return r.start(e),!1===r.dragging}return!1};let On=(t,e)=>t>=e.top&&t<=e.bottom,Dn=(t,e,i)=>On(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let r=Ke.find(t.docView,e);if(!r)return 1;let s=e-r.posAtStart;if(0==s)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&Dn(i,n,o))return-1;let a=r.coordsAt(s,1);return a&&Dn(i,n,a)?1:o&&On(n,o)?-1:1}function Ln(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Bn=Pe.ie&&Pe.ie_version<=11;let Pn=null,Nn=0,Rn=0;function In(t){if(!Bn)return t.detail;let e=Pn,i=Rn;return Pn=t,Rn=Date.now(),Nn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nn+1)%3:1}function zn(t,e,i,n){if(!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=n&&s&&function(t,e){let i=t.state.facet(oi);return i.length?i[0](e):Pe.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.from,to:s.to}:null,a={from:r,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Sn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let n=t.docView.nearest(e.target);if(n&&n.isWidget){let t=n.posAtStart,e=t+n.length;(t>=i.to||e<=i.from)&&(i=B.range(t,e))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1},Sn.dragend=t=>(t.inputState.draggedContent=null,!1),Sn.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),r=0,s=()=>{++r==i.length&&zn(t,e,n.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),s()},e.readAsText(i[t])}return!0}{let i=e.dataTransfer.getData("Text");if(i)return zn(t,e,i,!0),!0}return!1},Sn.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Mn?null:e.clipboardData;return i?(Cn(t,i.getData("text/plain")||i.getData("text/uri-text")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{t.focus(),i.remove(),Cn(t,i.value)}),50)}(t),!1)};let Hn=null;Sn.copy=Sn.cut=(t,e)=>{let{text:i,ranges:n,linewise:r}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let r=-1;for(let{from:n}of t.selection.ranges){let s=t.doc.lineAt(n);s.number>r&&(e.push(s.text),i.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),r=s.number}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state);if(!i&&!r)return!1;Hn=r?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=Mn?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",i),!0):(function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout((()=>{n.remove(),t.focus()}),50)}(t,i),!1)};const Vn=st.define();function Wn(t,e){let i=[];for(let n of t.facet(ui)){let r=n(t,e);r&&i.push(r)}return i?t.update({effects:i,annotations:Vn.of(!0)}):null}function Fn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=Wn(t.state,e);i?t.dispatch(i):t.update([])}}),10)}An.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Fn(t)},An.blur=t=>{t.observer.clearSelectionRange(),Fn(t)},An.compositionstart=An.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},An.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Pe.chrome&&Pe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},An.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Sn.beforeinput=(t,e)=>{var i;let n;if(Pe.chrome&&Pe.android&&(n=vn.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(n.key,n.keyCode),"Backspace"==n.key||"Delete"==n.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}return!1};const jn=new Set,_n=["pre-wrap","normal","pre-line","break-spaces"];class qn{constructor(e){this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return _n.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=r,a){this.heightSamples={};for(let t=0;t0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>Gn&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Jn.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let r=this,s=i.doc;for(let o=n.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:h,toB:c}=n[o],u=r.lineAt(a,Un.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=l?u:r.lineAt(l,Un.ByPosNoHeight,i,0,0);for(c+=f.to-l,l=f.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*r){let r=t[e-1];r.break?t.splice(--e,1,r.left,null,r.right):t.splice(--e,1,r.left,r.right),i+=1+r.break,n-=r.size}else{if(!(r>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,r-=e.size}}else if(n=r&&s(this.blockAt(0,i,n,r))}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Xn extends Yn{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new Kn(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Xn||n instanceof Qn&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Qn?n=new Xn(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Jn.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Qn extends Jn{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,s=r-n+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*s);i=e/s,this.length>s+1&&(o=(this.height-e)/(this.length-s-1))}else i=this.height/s;return{firstLine:n,lastLine:r,perLine:i,perChar:o}}blockAt(t,e,i,n){let{firstLine:r,lastLine:s,perLine:o,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let r=n+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),s=e.doc.lineAt(r),l=o+s.length*a,h=Math.max(i,t-l/2);return new Kn(s.from,s.length,h,l,0)}{let n=Math.max(0,Math.min(s-r,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(r+n);return new Kn(a,l,i+o*n,o,0)}}lineAt(t,e,i,n,r){if(e==Un.ByHeight)return this.blockAt(t,i,n,r);if(e==Un.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Kn(e,n-e,0,0,0)}let{firstLine:s,perLine:o,perChar:a}=this.heightMetrics(i,r),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-s,u=n+o*c+a*(l.from-r-c);return new Kn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,0)}forEachLine(t,e,i,n,r,s){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(i,r);for(let h=t,c=n;h<=e;){let e=i.doc.lineAt(h);if(h==t){let i=e.number-o;c+=a*i+l*(t-r-i)}let n=a+l*e.length;s(new Kn(e.from,e.length,c,n,0)),c+=n,h=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof Qn?i[i.length-1]=new Qn(t.length+n):i.push(null,new Qn(n-1))}if(t>0){let e=i[0];e instanceof Qn?i[0]=new Qn(t+e.length):i.unshift(new Qn(t-1),null)}return Jn.of(i)}decomposeLeft(t,e){e.push(new Qn(t-1),null)}decomposeRight(t,e){e.push(null,new Qn(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let r=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],s=Math.max(e,n.from),o=-1;for(n.from>e&&i.push(new Qn(n.from-e-1).updateHeight(t,e));s<=r&&n.more;){let e=t.doc.lineAt(s).length;i.length&&i.push(null);let r=n.heights[n.index++];-1==o?o=r:Math.abs(r-o)>=Gn&&(o=-2);let a=new Xn(e,r);a.outdated=!1,i.push(a),s+=e+1}s<=r&&i.push(null,new Qn(r-s).updateHeight(t,s));let a=Jn.of(i);return(o<0||Math.abs(a.height-this.height)>=Gn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Gn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Zn extends Jn{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let r=i+this.left.height;return to))return l;let h=e==Un.ByPosNoHeight?Un.ByPosNoHeight:Un.ByPos;return a?l.join(this.right.lineAt(o,h,i,s,o)):this.left.lineAt(o,h,i,n,r).join(l)}forEachLine(t,e,i,n,r,s){let o=n+this.left.height,a=r+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,s);else{let l=this.lineAt(a,Un.ByPos,i,n,r);t=t&&l.from<=e&&s(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,s)}}replace(t,e,i){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let r=[];t>0&&this.decomposeLeft(t,r);let s=r.length;for(let t of i)r.push(t);if(t>0&&tr(r,s-1),e=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Jn.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:r,right:s}=this,o=e+r.length+this.break,a=null;return n&&n.from<=e+r.length&&n.more?a=r=r.updateHeight(t,e,i,n):r.updateHeight(t,e,i),n&&n.from<=o+s.length&&n.more?a=s=s.updateHeight(t,o,i,n):s.updateHeight(t,o,i),a?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function tr(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Qn&&(n=t[e+1])instanceof Qn&&t.splice(e-1,3,new Qn(i.length+1+n.length))}class er{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Xn?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Xn(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(n,r,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Xn(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new Qn(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Xn)return t;let e=new Xn(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Xn||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();s=Math.max(s,n.left),o=Math.min(o,n.right),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:s-i.left,right:Math.max(s,o)-i.left,top:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function rr(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class sr{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new qn(i),this.stateDeco=e.facet(Ai).filter((t=>"function"!=typeof t)),this.heightMap=Jn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Li(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ye.set(this.lineGaps.map((t=>t.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some((({from:t,to:e})=>n>=t&&n<=e))){let{from:e,to:i}=this.lineBlockAt(n);t.push(new lr(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?fr:new dr(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(t=>{this.viewportLines.push(1==this.scaler.scale?t:pr(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ai).filter((t=>"function"!=typeof t));let n=t.changedRanges,r=Li.extendWithRanges(n,function(t,e,i){let n=new ir;return Mt.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=s&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let l=!t.changes.empty||2&t.flags||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),l&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(di)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Pi.RTL:Pi.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0;if(a.width&&a.height){let{scaleX:t,scaleY:e}=oe(i,a);this.scaleX==t&&this.scaleY==e||(this.scaleX=t,this.scaleY=e,h|=8,o=l=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==f||(this.paddingTop=u,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=pe(e.scrollDOM);let p=(this.printing?rr:nr)(i,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let v=a.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(i)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&r.refresh(s,t,n,a,v/n,i),o&&(e.docView.minWidth=0,h|=8)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),r.heightChanged=!1;for(let n of this.viewports){let s=n.from==this.viewport.from?i:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Jn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new Li(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new $n(n.from,s))}r.heightChanged&&(h|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,a=new lr(n.lineAt(s-1e3*i,Un.ByHeight,r,0,0).from,n.lineAt(o+1e3*(1-i),Un.ByHeight,r,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Un.ByPos,r,0,0);i="center"==e.y?(o.top+o.bottom)/2-s/2:"start"==e.y||"nearest"==e.y&&t=o+Math.max(10,Math.min(i,250)))&&n>s-2e3&&r>1,s=n<<1;if(this.defaultTextDirection!=Pi.LTR&&!i)return[];let o=[],a=(n,s,l,h)=>{if(s-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!f){if(st.from<=s&&t.to>=s))){let t=e.moveToLineBoundary(B.cursor(s),!1,!0).head;t>n&&(s=t)}f=new sr(n,s,this.gapSize(l,n,s,h))}o.push(f)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,r,t,e),ot.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];Mt.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some(((t,i)=>t.from!=e[i].from||t.to!=e[i].to));return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((e=>e.from<=t&&e.to>=t))||pr(this.heightMap.lineAt(t,Un.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return pr(this.heightMap.lineAt(this.scaler.fromDOM(t),Un.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return pr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class lr{constructor(t,e){this.from=t,this.to=e}}function hr(t,e,i){let n=[],r=t,s=0;return Mt.spans(i,t,e,{span(){},point(t,e){t>r&&(n.push({from:r,to:t}),s+=t-r),r=e}},20),r=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:r}=e[t],s=r-i;if(n<=s)return i+n;n-=s}}function ur(t,e){let i=0;for(let{from:n,to:r}of t.ranges){if(e<=r){i+=e-n;break}i+=r-n}return i/t.total}const fr={toDOM:t=>t,fromDOM:t=>t,scale:1};class dr{constructor(t,e,i){let n=0,r=0,s=0;this.viewports=i.map((({from:i,to:r})=>{let s=e.lineAt(i,Un.ByPos,t,0,0).top,o=e.lineAt(r,Un.ByPos,t,0,0).bottom;return n+=o-s,{from:i,to:r,top:s,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-n)/(e.height-n);for(let t of this.viewports)t.domTop=s+(t.top-r)*this.scale,s=t.domBottom=t.domTop+(t.bottom-t.top),r=t.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let r=epr(t,e))):t._content)}const mr=R.define({combine:t=>t.join(" ")}),gr=R.define({combine:t=>t.indexOf(!0)>-1}),wr=Ft.newName(),vr=Ft.newName(),yr=Ft.newName(),br={"&light":"."+vr,"&dark":"."+yr};function kr(t,e,i){return new Ft(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]})):t+" "+e})}const xr=kr("."+wr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},br),Sr="￿";class Ar{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(yt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Sr}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let r=n.nextSibling;if(r==e)break;let s=we.get(n),o=we.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:Cr(n))||Cr(r)&&("BR"!=n.nodeName||n.cmIgnore)&&this.text.length>t)&&this.lineBreak(),n=r}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(r=n.exec(e))&&(s=r.index,o=r[0].length),this.append(e.slice(i,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);i=s+o}}readNode(t){if(t.cmIgnore)return;let e=we.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(Mr(t,i.node,i.offset)?e:0))}}function Mr(t,e,i){for(;;){if(!e||i-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let e=r||s?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}=t.observer.selectionRange;return i&&(e.push(new Tr(i,n)),r==i&&s==n||e.push(new Tr(r,s))),e}(t),i=new Ar(e,t.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,n=2==t.length?t[1].pos:i;return i>-1&&n>-1?B.single(i+e,n+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=r&&r.node==e.focusNode&&r.offset==e.focusOffset||!Xt(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),n=s&&s.node==e.anchorNode&&s.offset==e.anchorOffset||!Xt(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=B.single(n,i)}}}function Dr(e,i){let n,{newSel:r}=i,s=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(i.bounds){let{from:r,to:a}=i.bounds,l=s.from,h=null;(8===o||Pe.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;return"end"==n&&(i-=o+Math.max(0,s-Math.min(o,a))-s),o=o?s-i:0,a=s+(a-o),o=s):a=a?s-i:0,o=s+(o-a),a=s),{from:s,toA:o,toB:a}}(e.state.doc.sliceString(r,a,Sr),i.text,l-r,h);c&&(Pe.chrome&&13==o&&c.toB==c.from+2&&i.text.slice(c.from,c.toB)==Sr+Sr&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:t.of(i.text.slice(c.from,c.toB).split(Sr))})}else r&&(!e.hasFocus&&e.state.facet(wi)||r.main.eq(s))&&(r=null);if(!n&&!r)return!1;if(!n&&i.typeOver&&!s.empty&&r&&r.main.empty?n={from:s.from,to:s.to,insert:e.state.doc.slice(s.from,s.to)}:n&&n.from>=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:e.state.doc.slice(s.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,s.to))}:(Pe.mac||Pe.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=B.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:t.of([" "])}):Pe.chrome&&n&&n.from==n.to&&n.from==s.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=B.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:t.of([" "])}),n){if(Pe.ios&&e.inputState.flushIOSKey())return!0;if(Pe.android&&(n.from==s.from&&n.to==s.to&&1==n.insert.length&&2==n.insert.lines&&fe(e.contentDOM,"Enter",13)||(n.from==s.from-1&&n.to==s.to&&0==n.insert.length||8==o&&n.insert.lengths.head)&&fe(e.contentDOM,"Backspace",8)||n.from==s.from&&n.to==s.to+1&&0==n.insert.length&&fe(e.contentDOM,"Delete",46)))return!0;let t,i=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>t||(t=function(t,e,i){let n,r=t.state,s=r.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=s.frome.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=r.changes(e),a=i&&i.main.to<=o.newLength?i.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let l,h=t.state.sliceDoc(e.from,e.to),c=i&&Qi(t,i.main.head);if(c){let t=e.insert.length-(e.to-e.from);l={from:c.from,to:c.to-t}}else l=t.state.doc.lineAt(s.head);let u=s.to-e.to,f=s.to-s.from;n=r.changeByRange((i=>{if(i.from==s.from&&i.to==s.to)return{changes:o,range:a||i.map(o)};let n=i.to-u,c=n-h.length;if(i.to-i.from!=f||t.state.sliceDoc(c,n)!=h||i.to>=l.from&&i.from<=l.to)return{range:i};let d=r.changes({from:c,to:n,insert:e.insert}),p=i.to-s.to;return{changes:d,range:a?B.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(d)}}))}else n={changes:o,selection:a&&r.selection.replaceRange(a)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:o,scrollIntoView:!0})}(e,n,r));return e.state.facet(ci).some((t=>t(e,n.from,n.to,i,a)))||e.dispatch(a()),!0}if(r&&!r.main.eq(s)){let t=!1,i="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:r,scrollIntoView:t,userEvent:i}),!0}return!1}const Er={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Lr=Pe.ie&&Pe.ie_version<=11;class Br{constructor(t){this.view=t,this.active=!1,this.selectionRange=new ae,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);(Pe.ie&&Pe.ie_version<=11||Pe.ios&&t.composing)&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),Lr&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(((e,i)=>e!=t[i])))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(wi)?i.root.activeElement!=this.dom:!Qt(i.dom,n))return;let r=n.anchorNode&&i.docView.nearest(n.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Pe.ie&&Pe.ie_version<=11||Pe.android&&Pe.chrome)&&!i.state.selection.main.empty&&n.focusNode&&te(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Pe.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let n=e.startContainer,r=e.startOffset,s=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return te(a.node,a.offset,s,o)&&([n,r,s,o]=[s,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:o}}(this.view)||Yt(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=Qt(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&fe(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let r of t){let t=this.readMutation(r);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Qt(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Or(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=Dr(this.view,e);return this.view.state==i&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let i=Pr(e,t.previousSibling||t.target.previousSibling,-1),n=Pr(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Pr(t,e,i){for(;e;){let n=we.get(e);if(n&&n.parent==t)return n;let r=e.parentNode;e=r!=t.dom?r:i>0?e.nextSibling:e.previousSibling}return null}class Nr{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(t=>t.forEach((t=>e(t,this))))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new ar(t.state||yt.create(t)),t.scrollTo&&t.scrollTo.is(mi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(yi).map((t=>new ki(t)));for(let t of this.plugins)t.update(this);this.observer=new Br(this),this.inputState=new mn(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Yi(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}dispatch(...t){let e=1==t.length&&t[0]instanceof ht?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,n=!1,r=this.state;for(let e of t){if(e.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,a=null;t.some((t=>t.annotation(Vn)))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=Wn(r,s),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(yt.phrases)!=this.state.facet(yt.phrases))return this.setState(r);e=Bi.create(this,r,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new pi(t.empty?t:B.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(mi)&&(c=t.value.clip(this.state))}this.viewState.update(e,c),this.bidiCache=zr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Ei)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(mr)!=e.state.facet(mr)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(hi))try{t(e)}catch(t){gi(this.state,t,"update listener")}(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Dr(this,h)&&l.force&&fe(this.contentDOM,l.key,l.keyCode)}))}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new ar(t),this.plugins=t.facet(yi).map((t=>new ki(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new Yi(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(yi),i=t.state.facet(yi);if(e!=i){let n=[];for(let r of i){let i=e.indexOf(r);if(i<0)n.push(new ki(r));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(s<0)if(pe(i))r=-1,s=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);r=t.from,s=t.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((t=>{try{return t.read(this)}catch(t){return gi(this.state,t),Ir}})),h=Bi.create(this,this.state,[]),c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h));for(let t=0;t1||t<-1){n+=t,i.scrollTop=n/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(hi))t(e)}get themeClasses(){return wr+" "+(this.state.facet(gr)?yr:vr)+" "+this.state.facet(mr)}updateAttrs(){let t=Hr(this,xi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(wi)?"true":"false",class:"cm-content",style:`${Pe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Hr(this,Si,e);let i=this.observer.ignore((()=>{let i=qe(this.contentDOM,this.contentAttrs,e),n=qe(this.dom,this.editorAttrs,t);return i||n}));return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)t.is(Nr.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(Ei);let t=this.state.facet(Nr.cspNonce);Ft.mount(this.root,this.styleModules.concat(xr).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;ee.spec==t))||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return pn(this,t,fn(this,t,e,i))}moveByGroup(t,e){return pn(this,t,fn(this,t,e,(e=>function(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return t=>{let e=n(t);return r==gt.Space&&(r=e),r==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let r=un(t,e.head),s=n&&r.type==Je.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(s){let e=t.dom.getBoundingClientRect(),n=t.textDirectionAt(r.from),o=t.posAtCoords({x:i==(n==Pi.LTR)?e.right-1:e.left+1,y:(s.top+s.bottom)/2});if(null!=o)return B.cursor(o,i?-1:1)}return B.cursor(i?r.to:r.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return pn(this,t,function(t,e,i,n){let r=e.head,s=i?1:-1;if(r==(i?t.state.doc.length:0))return B.cursor(r,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=s<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(r);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(r-e.from))),o=(s<0?e.top:e.bottom)+c}let u=l.left+a,f=null!=n?n:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let i=o+(f+e)*s,n=hn(t,{x:u,y:i},!1,s);if(il.bottom||(s<0?nr)){let e=t.docView.coordsForChar(n),r=!e||i0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(fi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rr)return Ui(t.length);let e,i=this.textDirectionAt(t.from);for(let n of this.bidiCache)if(n.from==t.from&&n.dir==i&&(n.fresh||_i(n.isolates,e=Ti(this,t.from,t.to))))return n.order;e||(e=Ti(this,t.from,t.to));let n=function(t,e,i){if(!t)return[new ji(0,0,e==Ri?1:0)];if(e==Ni&&!i.length&&!Fi.test(t))return Ui(t.length);if(i.length)for(;t.length>qi.length;)qi[qi.length]=256;let n=[],r=e==Ni?0:1;return Ki(t,r,r,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new zr(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Pe.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ce(this.contentDOM),this.docView.updateSelection()}))}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return mi.of(new pi("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return mi.of(new pi(B.cursor(i.from),"start","start",i.top-t,e,!0))}static domEventHandlers(t){return bi.define((()=>({})),{eventHandlers:t})}static domEventObservers(t){return bi.define((()=>({})),{eventObservers:t})}static theme(t,e){let i=Ft.newName(),n=[mr.of(i),Ei.of(kr(`.${i}`,t))];return e&&e.dark&&n.push(gr.of(!0)),n}static baseTheme(t){return q.lowest(Ei.of(kr("."+wr,t,br)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&we.get(i)||we.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Nr.styleModule=Ei,Nr.inputHandler=ci,Nr.focusChangeEffect=ui,Nr.perLineTextDirection=fi,Nr.exceptionSink=li,Nr.updateListener=hi,Nr.editable=wi,Nr.mouseSelectionStyle=ai,Nr.dragMovesSelection=oi,Nr.clickAddsSelectionRange=si,Nr.decorations=Ai,Nr.atomicRanges=Mi,Nr.bidiIsolatedRanges=Ci,Nr.scrollMargins=Oi,Nr.darkTheme=gr,Nr.cspNonce=R.define({combine:t=>t.length?t[0]:""}),Nr.contentAttributes=Si,Nr.editorAttributes=xi,Nr.lineWrapping=Nr.contentAttributes.of({class:"cm-lineWrapping"}),Nr.announce=lt.define();const Rr=4096,Ir={};class zr{constructor(t,e,i,n,r,s){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=r,this.order=s}static update(t,e){if(e.empty&&!t.some((t=>t.fresh)))return t;let i=[],n=t.length?t[t.length-1].dir:Pi.LTR;for(let r=Math.max(0,t.length-10);r=0;r--){let e=n[r],s="function"==typeof e?e(t):e;s&&Fe(s,i)}return i}const Vr=Pe.mac?"mac":Pe.windows?"win":Pe.linux?"linux":"key";function Wr(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const Fr=q.default(Nr.domEventHandlers({keydown:(t,e)=>Ur(qr(e.state),t,e,"editor")})),jr=R.define({enables:Fr}),_r=new WeakMap;function qr(t){let e=t.facet(jr),i=_r.get(e);return i||_r.set(e,i=function(t,e=Vr){let i=Object.create(null),n=Object.create(null),r=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=(t,n,s,o,a)=>{var l,h;let c=i[t]||(i[t]=Object.create(null)),u=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,r,s,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=$r={view:e,prefix:i,scope:t};return setTimeout((()=>{$r==n&&($r=null)}),Kr),!0}]})}let f=u.join(" ");r(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(l=c._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});s&&d.run.push(s),o&&(d.preventDefault=!0),a&&(d.stopPropagation=!0)};for(let n of t){let t=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let e in t)t[e].run.push(n.any)}let r=n[e]||n.key;if(r)for(let e of t)s(e,r,n.run,n.preventDefault,n.stopPropagation),n.shift&&s(e,"Shift-"+r,n.shift,n.preventDefault,n.stopPropagation)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let $r=null;const Kr=4e3;function Ur(t,e,i,n){let r=function(t){var e=!(Kt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Ut&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?$t:qt)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),s=b(v(r,0))==r.length&&" "!=r,o="",a=!1,l=!1,h=!1;$r&&$r.view==i&&$r.scope==n&&(o=$r.prefix+" ",bn.indexOf(e.keyCode)<0&&(l=!0,$r=null));let c,u,f=new Set,d=t=>{if(t){for(let n of t.run)if(!f.has(n)&&(f.add(n),n(i,e)))return t.stopPropagation&&(h=!0),!0;t.preventDefault&&(t.stopPropagation&&(h=!0),l=!0)}return!1},p=t[n];return p&&(d(p[o+Wr(r,e,!s)])?a=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Pe.windows&&e.ctrlKey&&e.altKey)&&(c=qt[e.keyCode])&&c!=r?(d(p[o+Wr(c,e,!0)])||e.shiftKey&&(u=$t[e.keyCode])!=r&&u!=c&&d(p[o+Wr(u,e,!1)]))&&(a=!0):s&&e.shiftKey&&d(p[o+Wr(r,e,!0)])&&(a=!0),!a&&d(p._any)&&(a=!0)),l&&(a=!0),a&&h&&e.stopPropagation(),a}class Gr{constructor(t,e,i,n,r){this.className=t,this.left=e,this.top=i,this.width=n,this.height=r}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=Jr(t);return[new Gr(e,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),s=t.textDirection==Pi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Jr(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=a.right-(c?parseInt(c.paddingRight):0),d=un(t,n),p=un(t,r),m=d.type==Je.Text?d:null,g=p.type==Je.Text?p:null;if(m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=Yr(t,n,m)),g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=Yr(t,r,g)),m&&g&&m.from==g.from)return v(y(i.from,i.to,m));{let e=m?y(i.from,null,m):b(d,!1),n=g?y(null,i.to,g):b(p,!0),r=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&e.bottom+t.defaultLineHeight/2h&&n.from=s)break;a>r&&l(Math.max(t,r),null==e&&t<=h,Math.min(a,s),null==i&&a>=c,o.dir)}if(r=n.to+1,r>=s)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:r,bottom:o,horizontal:a}}function b(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Jr(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Pi.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Yr(t,e,i){let n=B.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:Je.Text}}class Xr{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Qr)!=t.state.facet(Qr)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,i=t.facet(Qr);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Qr=R.define();function Zr(t){return[bi.define((e=>new Xr(e,t))),Qr.of(t)]}const ts=!Pe.ios,es=R.define({combine:t=>bt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function is(t={}){return[es.of(t),rs,os,ls,di.of(!0)]}function ns(t){return t.startState.facet(es)!=t.state.facet(es)}const rs=Zr({above:!0,markers(t){let{state:e}=t,i=e.facet(es),n=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty?!s||ts:i.drawRangeCursor){let e=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=r.empty?r:B.cursor(r.head,r.head>r.anchor?-1:1);for(let r of Gr.forRange(t,e,i))n.push(r)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=ns(t);return i&&ss(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){ss(e.state,t)},class:"cm-cursorLayer"});function ss(t,e){e.style.animationDuration=t.facet(es).cursorBlinkRate+"ms"}const os=Zr({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:Gr.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||ns(t),class:"cm-selectionLayer"}),as={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};ts&&(as[".cm-line"].caretColor="transparent !important",as[".cm-content"]={caretColor:"transparent !important"});const ls=q.highest(Nr.theme(as));function hs(t,e,i,n,r){e.lastIndex=0;for(let s,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;s=e.exec(o.value);)r(a+s.index,s)}class cs{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:r,maxLength:s=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,r)=>n(r,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,r)=>{let s=i(t,e,n);s&&r(n,n+t[0].length,s)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,r)=>r(n,n+t[0].length,i)}this.boundary=r,this.maxLength=s}createDeco(t){let e=new Ct,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:r,to:s}of i)r=Math.max(t.state.doc.lineAt(r).from,r-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=s:n.push({from:r,to:s});return n}(t,this.maxLength))hs(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,r,s,o)=>{o>t.view.viewport.from&&s1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let r of t.visibleRanges){let s=Math.max(r.from,i),o=Math.min(r.to,n);if(o>s){let i=t.state.doc.lineAt(s),n=i.toi.from;s--)if(this.boundary.test(i.text[s-1-i.from])){a=s;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const us=null!=/x/.unicode?"gu":"g",fs=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",us),ds={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let ps=null;const ms=R.define({combine(t){let e=bt(t,{render:null,specialChars:fs,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==ps&&"undefined"!=typeof document&&document.body){let e=document.body.style;ps=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return ps||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,us)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,us)),e}});let gs=null;class ws extends Ge{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(ds[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class vs extends Ge{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}const ys="-10000px";class bs{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t,e){var i;let n=t.state.facet(this.facet),r=n.filter((t=>t));if(n===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[],o=e?[]:null;for(let i=0;ie[i]=t)),e.length=o.length),this.input=n,this.tooltips=r,this.tooltipViews=s,!0}}function ks(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const xs=R.define({combine:t=>{var e,i,n;return{position:Pe.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||ks}}}),Ss=new WeakMap,As=bi.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(xs);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new bs(t,Ts,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(xs);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=ys,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,i=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(Pe.gecko)n=t.offsetParent!=this.container.ownerDocument.body;else if(1!=this.view.scaleX||1!=this.view.scaleY)n=!0;else if(t.style.top==ys&&"0px"==t.style.left){let e=t.getBoundingClientRect();n=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}}if(n||"absolute"==this.position)if(this.parent){let t=this.parent.getBoundingClientRect();t.width&&t.height&&(e=t.width/this.parent.offsetWidth,i=t.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:i}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(xs).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{editor:i,space:n,scaleX:r,scaleY:s}=t,o=[];for(let a=0;a=Math.min(i.bottom,n.bottom)||u.rightMath.min(i.right,n.right)+.1){c.style.top=ys;continue}let d=l.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,g=null!==(e=Ss.get(h))&&void 0!==e?e:f.bottom-f.top,w=h.offset||Cs,v=this.view.textDirection==Pi.LTR,y=f.width>n.right-n.left?v?n.left:n.right-f.width:v?Math.min(u.left-(d?14:0)+w.x,n.right-m):Math.max(n.left,u.left-m+(d?14:0)-w.x),b=this.above[a];!l.strictSide&&(b?u.top-(f.bottom-f.top)-w.yn.bottom)&&b==n.bottom-u.bottom>u.top-n.top&&(b=this.above[a]=!b);let k=(b?u.top-n.top:n.bottom-u.bottom)-p;if(ky&&t.topx&&(x=b?t.top-g-2-p:t.bottom+p+2);if("absolute"==this.position?(c.style.top=(x-t.parent.top)/s+"px",c.style.left=(y-t.parent.left)/r+"px"):(c.style.top=x/s+"px",c.style.left=y/r+"px"),d){let t=u.left+(v?w.x:-w.x)-(y+14-7);d.style.left=t/r+"px"}!0!==h.overlap&&o.push({left:y,top:x,right:S,bottom:x+g}),c.classList.toggle("cm-tooltip-above",b),c.classList.toggle("cm-tooltip-below",!b),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ys}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Ms=Nr.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Cs={x:0,y:0},Ts=R.define({enables:[As,Ms]}),Os=R.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function Ds(t,e){let i=t.plugin(Es),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Es=bi.fromClass(class{constructor(t){this.input=t.state.facet(Ps),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Os);this.top=new Ls(t,!0,e.topContainer),this.bottom=new Ls(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(Os);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ls(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ls(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ps);if(i!=this.input){let e=i.filter((t=>t)),n=[],r=[],s=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],e.update&&e.update(t)),n.push(e),(e.top?r:s).push(e)}this.specs=e,this.panels=n,this.top.sync(r),this.bottom.sync(s);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Nr.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Ls{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Bs(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Bs(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Bs(t){let e=t.nextSibling;return t.remove(),e}const Ps=R.define({enables:Es});class Ns extends kt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Ns.prototype.elementClass="",Ns.prototype.toDOM=void 0,Ns.prototype.mapMode=x.TrackBefore,Ns.prototype.startSide=Ns.prototype.endSide=-1,Ns.prototype.point=!0;const Rs=R.define(),Is=R.define(),zs=R.define({combine:t=>t.some((t=>t))});function Hs(t){let e=[Vs];return t&&!1===t.fixed&&e.push(zs.of(!0)),e}const Vs=bi.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Is).map((e=>new _s(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(zs),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(zs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=Mt.iter(this.view.state.facet(Rs),this.view.viewport.from),n=[],r=this.gutters.map((t=>new js(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(t.type)){let e=!0;for(let s of t.type)if(s.type==Je.Text&&e){Fs(i,n,s.from);for(let t of r)t.line(this.view,s,n);e=!1}else if(s.widget)for(let t of r)t.widget(this.view,s)}else if(t.type==Je.Text){Fs(i,n,t.from);for(let e of r)e.line(this.view,t,n)}else if(t.widget)for(let e of r)e.widget(this.view,t);for(let t of r)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Is),i=t.state.facet(Is),n=t.docChanged||t.heightChanged||t.viewportChanged||!Mt.eq(t.startState.facet(Rs),t.state.facet(Rs),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(n=!0);else{n=!0;let r=[];for(let n of i){let i=e.indexOf(n);i<0?r.push(new _s(this.view,n)):(this.gutters[i].update(t),r.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),r.indexOf(t)<0&&t.destroy();for(let t of r)this.dom.appendChild(t.dom);this.gutters=r}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>Nr.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Pi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function Ws(t){return Array.isArray(t)?t:[t]}function Fs(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class js{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Mt.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,r=(e.top-this.height)/t.scaleY,s=e.height/t.scaleY;if(this.i==n.elements.length){let e=new qs(t,s,r,i);n.elements.push(e),n.dom.appendChild(e.dom)}else n.elements[this.i].update(t,s,r,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];Fs(this.cursor,n,e.from),i.length&&(n=n.concat(i));let r=this.gutter.config.lineMarker(t,e,n);r&&n.unshift(r);let s=this.gutter;(0!=n.length||s.config.renderEmptyElements)&&this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class _s{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,(n=>{let r,s=n.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let t=s.getBoundingClientRect();r=(t.top+t.bottom)/2}else r=n.clientY;let o=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[i](t,o,n)&&n.preventDefault()}));this.markers=Ws(e.markers(t)),e.initialSpacer&&(this.spacer=new qs(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Ws(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!Mt.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class qs{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;ibt(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let n=i[t],r=e[t];i[t]=n?(t,e,i)=>n(t,e,i)||r(t,e,i):r}return i}})});class Us extends Ns{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Gs(t,e){return t.state.facet(Ks).formatNumber(e,t.state)}const Js=Is.compute([Ks],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet($s),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new Us(Gs(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Ks)!=t.state.facet(Ks),initialSpacer:t=>new Us(Gs(t,Ys(t.state.doc.lines))),updateSpacer(t,e){let i=Gs(e.view,Ys(e.view.state.doc.lines));return i==t.number?t:new Us(i)},domEventHandlers:t.facet(Ks).domEventHandlers})));function Ys(t){let e=9;for(;e{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=no.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}to.closedBy=new to({deserialize:t=>t.split(" ")}),to.openedBy=new to({deserialize:t=>t.split(" ")}),to.group=new to({deserialize:t=>t.split(" ")}),to.isolate=new to({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),to.contextHash=new to({perNode:!0}),to.lookAhead=new to({perNode:!0}),to.mounted=new to({perNode:!0});class eo{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[to.mounted.id]}}const io=Object.create(null);class no{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):io,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new no(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(to.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(to.group),n=-1;n<(i?i.length:0);n++){let r=e[n<0?t.name:i[n]];if(r)return r}}}}no.none=new no("",Object.create(null),0,8);class ro{constructor(t){this.types=t;for(let e=0;e=e){let o=new mo(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[n])).push(fo(o,e,i,!1))}}return r?bo(r):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,s=t.mode||0,o=(s&ao.IncludeAnonymous)>0;for(let t=this.cursor(s|ao.IncludeAnonymous);;){let s=!1;if(t.from<=r&&t.to>=n&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;s=!0}for(;s&&i&&(o||!t.type.isAnonymous)&&i(t),!t.nextSibling();){if(!t.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Co(no.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new lo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new lo(no.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=Xs,reused:s=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new ho(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,g,w,v){let{id:y,start:b,end:k,size:x}=a,S=c;for(;x<0;){if(a.next(),-1==x){let e=s[y];return i.push(e),void g.push(b-t)}if(-3==x)return void(h=y);if(-4==x)return void(c=y);throw new RangeError(`Unrecognized record size: ${x}`)}let A,M,C=l[y],T=b-t;if(k-b<=r&&(M=function(t,e){let i=a.fork(),n=0,s=0,l=0,h=i.end-r,c={size:0,start:0,skip:0};t:for(let r=i.pos-t;i.pos>r;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=s,c.skip=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,f=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}s=f,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=s,c.skip=l),c.size>4?c:void 0}(a.pos-e,w))){let e=new Uint16Array(M.size-M.skip),i=a.pos-M.size,r=e.length;for(;a.pos>i;)r=m(M.start,e,r);A=new co(e,k-M.start,n),T=M.start-t}else{let t=a.pos-x;a.next();let e=[],i=[],n=y>=o?y:-1,s=0,l=k;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-r&&(d(e,i,b,s,a.end,l,n,S),s=e.length,l=a.end),a.next()):v>2500?f(b,t,e,i):u(b,t,e,i,n,v+1);if(n>=0&&s>0&&s-1&&s>0){let t=function(t){return(e,i,n)=>{let r,s,o=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof lo){if(!a&&r.type==t&&r.length==n)return r;(s=r.prop(to.lookAhead))&&(o=i[a]+r.length+s)}return p(t,e,i,n,o)}}(C);A=Co(C,e,i,0,e.length,0,k-b,t,t)}else A=p(C,e,i,k-b,S-k)}i.push(A),g.push(T)}function f(t,e,i,s){let o=[],l=0,h=-1;for(;a.pos>e;){let{id:t,start:e,end:i,size:n}=a;if(n>4)a.next();else{if(h>-1&&e=0;t-=3)e[i++]=o[t],e[i++]=o[t+1]-r,e[i++]=o[t+2]-r,e[i++]=i;i.push(new co(e,o[2]-r,n)),s.push(r-t)}}function d(t,e,i,r,s,o,a,l){let h=[],c=[];for(;t.length>r;)h.push(t.pop()),c.push(e.pop()+i-s);t.push(p(n.types[a],h,c,o-s,l-o)),e.push(s-i)}function p(t,e,i,n,r=0,s){if(h){let t=[to.contextHash,h];s=s?[t].concat(s):[t]}if(r>25){let t=[to.lookAhead,r];s=s?[t].concat(s):[t]}return new lo(t,e,i,n,s)}function m(t,e,i){let{id:n,start:r,end:s,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=m(t,e,i)}e[--i]=o,e[--i]=s-t,e[--i]=r-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let g=[],w=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,g,w,-1,0);let v=null!==(e=t.length)&&void 0!==e?e:g.length?w[0]+g[0].length:0;return new lo(l[t.topID],g.reverse(),w.reverse(),v)}(t)}}lo.empty=new lo(no.none,[],[],0);class ho{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ho(this.buffer,this.index)}}class co{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return no.none}toString(){let t=[];for(let e=0;e0));a=s[a+3]);return o}slice(t,e,i){let n=this.buffer,r=new Uint16Array(e-t),s=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function fo(t,e,i,n){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?o.length:-1;t!=l;t+=e){let l=o[t],h=a[t]+s.from;if(uo(n,i,h,h+l.length))if(l instanceof co){if(r&ao.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new yo(new vo(s,l,t,h),null,o)}else if(r&ao.IncludeAnonymous||!l.type.isAnonymous||So(l)){let o;if(!(r&ao.IgnoreMounts)&&(o=eo.get(l))&&!o.overlay)return new mo(o.tree,h,t,s);let a=new mo(l,h,t,s);return r&ao.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(r&ao.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+e:e<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,i=0){let n;if(!(i&ao.IgnoreOverlays)&&(n=eo.get(this._tree))&&n.overlay){let i=t-this.from;for(let{from:t,to:r}of n.overlay)if((e>0?t<=i:t=i:r>i))return new mo(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function go(t,e,i,n){let r=t.cursor(),s=[];if(!r.firstChild())return s;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return s;for(;;){if(null!=n&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return null==n?s:[]}}function wo(t,e,i=e.length-1){for(let n=t.parent;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class vo{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class yo extends po{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new yo(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i=0){if(i&ao.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new yo(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new yo(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new yo(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let s=i.buffer[this.index+1];t.push(i.slice(n,r,s)),e.push(0)}return new lo(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function bo(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;ni.from||r.to0){if(this.index-1)for(let n=e+t,r=t<0?-1:i._tree.children.length;n!=r;n+=t){let t=i._tree.children[n];if(this.mode&ao.IncludeAnonymous||t instanceof co||!t.type.isAnonymous||So(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let s=t;s;s=s._parent)if(s.index==n){if(n==this.index)return s;e=s,i=r+1;break t}n=this.stack[--r]}for(let t=i;t=0;r--){if(r<0)return wo(this.node,t,n);let s=i[e.buffer[this.stack[r]]];if(!s.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}}function So(t){return t.children.some((t=>t instanceof co||!t.type.isAnonymous||So(t)))}const Ao=new WeakMap;function Mo(t,e){if(!t.isAnonymous||e instanceof co||e.type!=t)return 1;let i=Ao.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof lo)){i=1;break}i+=Mo(t,n)}Ao.set(e,i)}return i}function Co(t,e,i,n,r,s,o,a,l){let h=0;for(let i=n;i=c)break;p+=e}if(h==r+1){if(p>c){let t=i[r];e(t.children,t.positions,0,t.children.length,n[r]+a);continue}u.push(i[r])}else{let e=n[h-1]+i[h-1].length-d;u.push(Co(t,i,n,r,h,d,e,null,l))}f.push(d+a-s)}}(e,i,n,r,0),(a||l)(u,f,o)}class To{constructor(t,e,i,n,r=!1,s=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new To(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],r=1,s=t.length?t[0]:null;for(let o=0,a=0,l=0;;o++){let h=o=i)for(;s&&s.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new To(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),s.to>c)break;s=rnew Zs(t.from,t.to))):[new Zs(0,0)]:[new Zs(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class Do{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new to({perNode:!0});let Eo=0;class Lo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Eo++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Lo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new Po;return e=>e.modified.indexOf(t)>-1?e:Po.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Bo=0;class Po{constructor(){this.instances=[],this.id=Bo++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find((i=>{return i.base==t&&(n=e,r=i.modified,n.length==r.length&&n.every(((t,e)=>t==r[e])));var n,r}));if(i)return i;let n=[],r=new Lo(n,t,e);for(let t of e)t.instances.push(r);let s=function(t){let e=[[]];for(let i=0;ie.length-t.length))}(e);for(let e of t.set)if(!e.modified.length)for(let t of s)n.push(Po.get(e,t));return r}}function No(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],r=2,s=t;for(let e=0;;){if("..."==s&&e>0&&e+3==t.length){r=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);s=t.slice(e)}let o=i.length-1,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new Io(n,r,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return Ro.add(e)}const Ro=new to;class Io{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth{let e=r;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function Ho(t,e,i,n=0,r=t.length){let s=new Vo(n,Array.isArray(e)?e:[e],i);s.highlightRange(t.cursor(),n,r,"",s.highlighters),s.flush(r)}Io.empty=new Io([],2,null);class Vo{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,r){let{type:s,from:o,to:a}=t;if(o>=i||a<=e)return;s.isTop&&(r=this.highlighters.filter((t=>!t.scope||t.scope(s))));let l=n,h=function(t){let e=t.type.prop(Ro);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||Io.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(r,h.tags);if(c&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,o),l),h.opaque)return;let u=t.tree&&t.tree.prop(to.mounted);if(u&&u.overlay){let s=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter((t=>!t.scope||t.scope(u.tree.type))),c=t.firstChild();for(let f=0,d=o;;f++){let p=f=m)&&t.nextSibling()););if(!p||m>i)break;d=p.to+o,d>e&&(this.highlightRange(s.cursor(),Math.max(e,p.from+o),Math.min(i,d),"",h),this.startSpan(Math.min(i,d),l))}c&&t.parent()}else if(t.firstChild()){u&&(n="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,r),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const Wo=Lo.define,Fo=Wo(),jo=Wo(),_o=Wo(jo),qo=Wo(jo),$o=Wo(),Ko=Wo($o),Uo=Wo($o),Go=Wo(),Jo=Wo(Go),Yo=Wo(),Xo=Wo(),Qo=Wo(),Zo=Wo(Qo),ta=Wo(),ea={comment:Fo,lineComment:Wo(Fo),blockComment:Wo(Fo),docComment:Wo(Fo),name:jo,variableName:Wo(jo),typeName:_o,tagName:Wo(_o),propertyName:qo,attributeName:Wo(qo),className:Wo(jo),labelName:Wo(jo),namespace:Wo(jo),macroName:Wo(jo),literal:$o,string:Ko,docString:Wo(Ko),character:Wo(Ko),attributeValue:Wo(Ko),number:Uo,integer:Wo(Uo),float:Wo(Uo),bool:Wo($o),regexp:Wo($o),escape:Wo($o),color:Wo($o),url:Wo($o),keyword:Yo,self:Wo(Yo),null:Wo(Yo),atom:Wo(Yo),unit:Wo(Yo),modifier:Wo(Yo),operatorKeyword:Wo(Yo),controlKeyword:Wo(Yo),definitionKeyword:Wo(Yo),moduleKeyword:Wo(Yo),operator:Xo,derefOperator:Wo(Xo),arithmeticOperator:Wo(Xo),logicOperator:Wo(Xo),bitwiseOperator:Wo(Xo),compareOperator:Wo(Xo),updateOperator:Wo(Xo),definitionOperator:Wo(Xo),typeOperator:Wo(Xo),controlOperator:Wo(Xo),punctuation:Qo,separator:Wo(Qo),bracket:Zo,angleBracket:Wo(Zo),squareBracket:Wo(Zo),paren:Wo(Zo),brace:Wo(Zo),content:Go,heading:Jo,heading1:Wo(Jo),heading2:Wo(Jo),heading3:Wo(Jo),heading4:Wo(Jo),heading5:Wo(Jo),heading6:Wo(Jo),contentSeparator:Wo(Go),list:Wo(Go),quote:Wo(Go),emphasis:Wo(Go),strong:Wo(Go),link:Wo(Go),monospace:Wo(Go),strikethrough:Wo(Go),inserted:Wo(),deleted:Wo(),changed:Wo(),invalid:Wo(),meta:ta,documentMeta:Wo(ta),annotation:Wo(ta),processingInstruction:Wo(ta),definition:Lo.defineModifier(),constant:Lo.defineModifier(),function:Lo.defineModifier(),standard:Lo.defineModifier(),local:Lo.defineModifier(),special:Lo.defineModifier()};var ia;zo([{tag:ea.link,class:"tok-link"},{tag:ea.heading,class:"tok-heading"},{tag:ea.emphasis,class:"tok-emphasis"},{tag:ea.strong,class:"tok-strong"},{tag:ea.keyword,class:"tok-keyword"},{tag:ea.atom,class:"tok-atom"},{tag:ea.bool,class:"tok-bool"},{tag:ea.url,class:"tok-url"},{tag:ea.labelName,class:"tok-labelName"},{tag:ea.inserted,class:"tok-inserted"},{tag:ea.deleted,class:"tok-deleted"},{tag:ea.literal,class:"tok-literal"},{tag:ea.string,class:"tok-string"},{tag:ea.number,class:"tok-number"},{tag:[ea.regexp,ea.escape,ea.special(ea.string)],class:"tok-string2"},{tag:ea.variableName,class:"tok-variableName"},{tag:ea.local(ea.variableName),class:"tok-variableName tok-local"},{tag:ea.definition(ea.variableName),class:"tok-variableName tok-definition"},{tag:ea.special(ea.variableName),class:"tok-variableName2"},{tag:ea.definition(ea.propertyName),class:"tok-propertyName tok-definition"},{tag:ea.typeName,class:"tok-typeName"},{tag:ea.namespace,class:"tok-namespace"},{tag:ea.className,class:"tok-className"},{tag:ea.macroName,class:"tok-macroName"},{tag:ea.propertyName,class:"tok-propertyName"},{tag:ea.operator,class:"tok-operator"},{tag:ea.comment,class:"tok-comment"},{tag:ea.meta,class:"tok-meta"},{tag:ea.invalid,class:"tok-invalid"},{tag:ea.punctuation,class:"tok-punctuation"}]);const na=new to;const ra=new to;class sa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,yt.prototype.hasOwnProperty("tree")||Object.defineProperty(yt.prototype,"tree",{get(){return aa(this)}}),this.parser=e,this.extension=[wa.of(this),yt.languageData.of(((t,e,i)=>{let n=oa(t,e,i),r=n.type.prop(na);if(!r)return[];let s=t.facet(r),o=n.type.prop(ra);if(o){let r=n.resolve(e-n.from,i);for(let e of o)if(e.test(r,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(s)}}return s}))].concat(i)}isActiveAt(t,e,i=-1){return oa(t,e,i).type.prop(na)==this.data}findRegions(t){let e=t.facet(wa);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(na)==this.data)return void i.push({from:e,to:e+t.length});let r=t.prop(to.mounted);if(r){if(r.tree.prop(na)==this.data){if(r.overlay)for(let t of r.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(r.overlay){let t=i.length;if(n(r.tree,r.overlay[0].from+e),i.length>t)return}}for(let i=0;i=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let ca=null;class ua{constructor(t,e,i=[],n,r,s,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new ua(t,e,[],lo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new ha(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=lo.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((()=>{for(;!(e=this.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(To.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=ca;ca=this;try{return t()}finally{ca=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=fa(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges(((t,i,n,r)=>e.push({fromA:t,toA:i,fromB:n,toB:r}))),i=To.applyChanges(i,e),n=lo.empty,r=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);it.from&&(this.fragments=fa(this.fragments,i,n),this.skipped.splice(e--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Oo{createParse(e,i,n){let r=n[0].from,s=n[n.length-1].to;return{parsedPos:r,advance(){let e=ca;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=s,new lo(no.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return ca}}function fa(t,e,i){return To.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class da{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new da(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=ua.create(t.facet(wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new da(i)}}sa.state=j.define({create:da.init,update(t,e){for(let t of e.effects)if(t.is(sa.setState))return t.value;return e.startState.facet(wa)!=e.state.facet(wa)?da.init(e.state):t.apply(e)}});let pa=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(pa=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const ma="undefined"!=typeof navigator&&(null===(ia=navigator.scheduling)||void 0===ia?void 0:ia.isInputPending)?()=>navigator.scheduling.isInputPending():null,ga=bi.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(sa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(sa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=pa(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=r.context.work((()=>ma&&ma()||Date.now()>s),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:sa.setState.of(new da(r.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>gi(this.view.state,t))).then((()=>this.workScheduled--)),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),wa=R.define({combine:t=>t.length?t[0]:null,enables:t=>[sa.state,ga,Nr.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class va{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const ya=R.define(),ba=R.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((t=>t!=e[0])))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function ka(t){let e=t.facet(ba);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function xa(t,e){let i="",n=t.tabSize,r=t.facet(ba)[0];if("\t"==r){for(;e>=n;)i+="\t",e-=n;r=" "}for(let t=0;t=e?function(t,e,i){let n=e.resolveStack(i),r=n.node.enterUnfinishedNodesBefore(i);if(r!=n.node){let t=[];for(let e=r;e!=n.node;e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return Ca(n,t,i)}(t,i,e):null}class Aa{constructor(t,e={}){this.state=t,this.options=e,this.unit=ka(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:r}=this.options;return null!=n&&n>=i.from&&n<=i.to?r&&n==t?{text:"",from:t}:(e<0?n-1&&(r+=s-this.countColumn(i,i.search(/\S|$/))),r}countColumn(t,e=t.length){return zt(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let t=r(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ma=new to;function Ca(t,e,i){for(let n=t;n;n=n.next){let t=Ta(n.node);if(t)return t(Da.create(e,i,n))}return 0}function Ta(t){let e=t.type.prop(Ma);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(to.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>function(t,e,i,n,r){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||r==t.pos+o,l=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let r=t.options.simulateBreak,s=t.state.doc.lineAt(i.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let t=i.to;;){let r=e.childAfter(t);if(!r||r==n)return null;if(!r.type.isSkipped)return r.from=n?void 0:{from:i,to:n}}const Ba=lt.define({map:La}),Pa=lt.define({map:La}),Na=j.define({create:()=>Ye.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)if(i.is(Ba)&&!Ia(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(Ha),r=n?Ye.replace({widget:new Fa(n(e.state,i.value))}):Wa;t=t.update({add:[r.range(i.value.from,i.value.to)]})}else i.is(Pa)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Nr.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{t==e&&r==i&&(n=!0)})),n}const za={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Ha=R.define({combine:t=>bt(t,za)});function Va(t,e){let{state:i}=t,n=i.facet(Ha),r=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=function(t,e,i){var n;let r=null;return null===(n=t.field(Na,!1))||void 0===n||n.between(e,i,((t,e)=>{(!r||r.from>t)&&(r={from:t,to:e})})),r}(t.state,i.from,i.to);n&&t.dispatch({effects:Pa.of(n)}),e.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",i.phrase("folded code")),s.title=i.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const Wa=Ye.replace({widget:new class extends Ge{toDOM(t){return Va(t,null)}}});class Fa extends Ge{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Va(t,this.value)}}const ja=Nr.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class _a{constructor(t,e){let i;function n(t){let e=Ft.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const r="string"==typeof e.all?e.all:e.all?n(e.all):void 0,s=e.scope;this.scope=s instanceof sa?t=>t.prop(na)==s.data:s?t=>t==s:void 0,this.style=zo(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:r}).style,this.module=i?new Ft(i):null,this.themeType=e.themeType}static define(t,e){return new _a(t,e||{})}}const qa=R.define(),$a=R.define({combine:t=>t.length?[t[0]]:null});function Ka(t){let e=t.facet(qa);return e.length?e:t.facet($a)}function Ua(t,e){let i,n=[Ja];return t instanceof _a&&(t.module&&n.push(Nr.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push($a.of(t)):i?n.push(qa.computeN([Nr.darkTheme],(e=>e.facet(Nr.darkTheme)==("dark"==i)?[t]:[]))):n.push(qa.of(t)),n}class Ga{constructor(t){this.markCache=Object.create(null),this.tree=aa(t.state),this.decorations=this.buildDeco(t,Ka(t.state))}update(t){let e=aa(t.state),i=Ka(t.state),n=i!=Ka(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=Ye.mark({class:n})))}),n,r);return i.finish()}}const Ja=q.high(bi.fromClass(Ga,{decorations:t=>t.decorations})),Ya=(ea.meta,ea.link,ea.heading,ea.emphasis,ea.strong,ea.strikethrough,ea.keyword,ea.atom,ea.bool,ea.url,ea.contentSeparator,ea.labelName,ea.literal,ea.inserted,ea.string,ea.deleted,ea.regexp,ea.escape,ea.string,ea.variableName,ea.variableName,ea.typeName,ea.namespace,ea.className,ea.variableName,ea.macroName,ea.propertyName,ea.comment,ea.invalid,Nr.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),Xa=1e4,Qa="()[]{}",Za=R.define({combine:t=>bt(t,{afterCursor:!0,brackets:Qa,maxScanDistance:Xa,renderMatch:il})}),tl=Ye.mark({class:"cm-matchingBracket"}),el=Ye.mark({class:"cm-nonmatchingBracket"});function il(t){let e=[],i=t.matched?tl:el;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}const nl=j.define({create:()=>Ye.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Za);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=hl(e.state,t.head,-1,n)||t.head>0&&hl(e.state,t.head-1,1,n)||n.afterCursor&&(hl(e.state,t.head,1,n)||t.headNr.decorations.from(t)}),rl=[nl,Ya];function sl(t={}){return[Za.of(t),rl]}const ol=new to;function al(t,e,i){let n=t.prop(e<0?to.openedBy:to.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function ll(t){let e=t.type.prop(ol);return e?e(t.node):t}function hl(t,e,i,n={}){let r=n.maxScanDistance||Xa,s=n.brackets||Qa,o=aa(t),a=o.resolveInner(e,i);for(let t=a;t;t=t.parent){let n=al(t.type,i,s);if(n&&t.from0?e>=r.from&&er.from&&e<=r.to))return cl(0,0,i,t,r,n,s)}}return function(t,e,i,n,r,s,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=i>0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=s;){let s=c.value;i<0&&(t+=s.length);let a=e+t*i;for(let t=i>0?0:s.length-1,e=i>0?s.length:-1;t!=e;t+=i){let e=o.indexOf(s[t]);if(!(e<0||n.resolveInner(a+t,1).type!=r))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=s.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,r,s)}function cl(t,e,i,n,r,s,o){let a=n.parent,l={from:r.from,to:r.to},h=0,c=null==a?void 0:a.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==h&&s.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pose}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosi?t.toLowerCase():t;return n(this.string.substr(this.pos,t.length))==n(t)?(!1!==e&&(this.pos+=t.length),!0):null}{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function dl(t){if("object"!=typeof t)return t;let e={};for(let i in t){let n=t[i];e[i]=n instanceof Array?n.slice():n}return e}const pl=new WeakMap;class ml extends sa{constructor(t){let e,i=(r=t.languageData,R.define({combine:r?t=>t.concat(r):void 0})),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||dl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||bl};var r,s;super(i,new class extends Oo{createParse(t,i,n){return new vl(e,t,i,n)}},[ya.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=no.define({id:kl.length,name:"Document",props:[na.add((()=>t))],top:!0});return kl.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new to({perNode:!0}),this.tokenTable=t.tokenTable?new Cl(n.tokenTable):Tl}static define(t){return new ml(t)}getIndent(t,e){let i,n=aa(t.state),r=n.resolve(e);for(;r&&r.type!=this.topNode;)r=r.parent;if(!r)return null;let{overrideIndentation:s}=t.options;s&&(i=pl.get(t.state),null!=i&&i1e4)return null;for(;o=n&&i+e.length<=r&&e.prop(t.stateAfter);if(s)return{state:t.streamParser.copyState(s),pos:i+e.length};for(let s=e.children.length-1;s>=0;s--){let o=e.children[s],a=i+e.positions[s],l=o instanceof lo&&a=e.length)return e;r||e.type!=t.topNode||(r=!0);for(let s=e.children.length-1;s>=0;s--){let o,a=e.positions[s],l=e.children[s];if(ai&&gl(t,n.tree,0-n.offset,i,s);if(o&&(e=wl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?ka(n):4),tree:lo.empty}}(t,i,s,null==r?void 0:r.state);this.state=o,this.parsedPos=this.chunkStart=s+a.length;for(let t=0;t=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{let t=e.indexOf("\n");t>-1&&(e=e.slice(0,t))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let t=this.rangeIndex;;){let n=this.ranges[t].to;if(n>=i)break;if(e=e.slice(0,n-(i-e.length)),t++,t==this.ranges.length)break;let r=this.ranges[t].from,s=this.lineAfter(r);e+=s,i=r+s.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,r=t+e;if(i>0?n>r:n>=r)break;e+=this.ranges[++this.rangeIndex].from-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){e+=r=this.skipGapsTo(e,r,1);let t=this.chunk.length;i+=r=this.skipGapsTo(i,r,-1),n+=this.chunk.length-t}return this.chunk.push(t,e,i,n),r}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:r}=this.lang,s=new fl(e,t?t.state.tabSize:4,t?ka(t.state):2);if(s.eol())r.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let t=yl(r.token,s,this.state);if(t&&(n=this.emitToken(this.lang.tokenTable.resolve(t),this.parsedPos+s.start,this.parsedPos+s.pos,4,n)),s.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}const bl=Object.create(null),kl=[no.none],xl=new ro(kl),Sl=[],Al=Object.create(null),Ml=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Ml[t]=Dl(bl,e);class Cl{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Ml)}resolve(t){return t?this.table[t]||(this.table[t]=Dl(this.extra,t)):0}}const Tl=new Cl(bl);function Ol(t,e){Sl.indexOf(t)>-1||(Sl.push(t),console.warn(e))}function Dl(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||ea[i];n?"function"==typeof n?e.length?e=e.map(n):Ol(i,`Modifier ${i} used at start of tag`):e.length?Ol(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:Ol(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map((t=>t.id)),s=Al[r];if(s)return s.id;let o=Al[r]=no.define({id:kl.length,name:n,props:[No({[n]:i})]});return kl.push(o),o.id}function El(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return!!r&&(n(i.update(r)),!0)}}const Ll=El(zl,0),Bl=El(Il,0),Pl=El(((t,e)=>Il(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}(e))),0);function Nl(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const Rl=50;function Il(t,e,i=e.selection.ranges){let n=i.map((t=>Nl(e,t.from).block));if(!n.every((t=>t)))return null;let r=i.map(((t,i)=>function(t,{open:e,close:i},n,r){let s,o,a=t.sliceDoc(n-Rl,n),l=t.sliceDoc(r,r+Rl),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:r+c,margin:c&&1}};r-n<=2*Rl?s=o=t.sliceDoc(n,r):(s=t.sliceDoc(n,n+Rl),o=t.sliceDoc(r-Rl,r));let f=/^\s*/.exec(s)[0].length,d=/\s*$/.exec(o)[0].length,p=o.length-d-i.length;return s.slice(f,f+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(s.charAt(f+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,n[i],t.from,t.to)));if(2!=t&&!r.every((t=>t)))return{changes:e.changes(i.map(((t,e)=>r[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}])))};if(1!=t&&r.some((t=>t))){let t=[];for(let e,i=0;ir&&(t==s||s>l.from)){r=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?t:-1;tt.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:i,indent:r,empty:s,single:o}of n)!o&&s||t.push({from:e.from+r,insert:i+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:i,token:r}of n)if(i>=0){let n=e.from+i,s=n+r.length;" "==e.text[s-e.from]&&s++,t.push({from:n,to:s})}return{changes:t}}return null}const Hl=st.define(),Vl=st.define(),Wl=R.define(),Fl=R.define({combine:t=>bt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})}),jl=j.define({create:()=>rh.empty,update(t,e){let i=e.state.facet(Fl),n=e.annotation(Hl);if(n){let r=e.docChanged?B.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,s=Gl.fromTransaction(e,r),o=n.side,a=0==o?t.undone:t.done;return a=s?Jl(a,a.length,i.minDepth,s):Zl(a,e.startState.selection),new rh(0==o?n.rest:a,0==o?a:n.rest)}let r=e.annotation(Vl);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(ht.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let s=Gl.fromTransaction(e),o=e.annotation(ht.time),a=e.annotation(ht.userEvent);return s?t=t.addChanges(s,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new rh(t.done.map(Gl.fromJSON),t.undone.map(Gl.fromJSON))});function _l(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(jl,!1);if(!r)return!1;let s=r.pop(t,i,e);return!!s&&(n(s),!0)}}const ql=_l(0,!1),$l=_l(1,!1),Kl=_l(0,!0),Ul=_l(1,!0);class Gl{constructor(t,e,i,n,r){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=r}setSelAfter(t){return new Gl(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new Gl(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON))}static fromTransaction(t,e){let i=Xl;for(let e of t.startState.facet(Wl)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Gl(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Xl)}static selection(t){return new Gl(void 0,Xl,void 0,void 0,t)}}function Jl(t,e,i,n){let r=e+1>i+20?e-i-1:0,s=t.slice(r,e);return s.push(n),s}function Yl(t,e){return t.length?e.length?t.concat(e):t:e}const Xl=[],Ql=200;function Zl(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ql));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Jl(t,t.length-1,1e9,i.setSelAfter(n)))}return[Gl.selection([e])]}function th(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function eh(t,e){if(!t.length)return t;let i=t.length,n=Xl;for(;i;){let r=ih(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let e=t.slice(0,i);return e[i-1]=r,e}e=r.mapped,i--,n=r.selectionsAfter}return n.length?[Gl.selection(n)]:Xl}function ih(t,e,i){let n=Yl(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Xl,i);if(!t.changes)return Gl.selection(n);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Gl(r,lt.mapEffects(t.effects,e),o,t.startSelection.map(s),n)}const nh=/^(input\.type|delete)($|\.)/;class rh{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new rh(this.done,this.undone):this}addChanges(t,e,i,n,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&t.changes&&(!i||nh.test(i))&&(!o.selectionsAfter.length&&e-this.prevTimei.push(t,e))),e.iterChangedRanges(((t,e,r,s)=>{for(let t=0;t=e&&r<=o&&(n=!0)}})),n}(o.changes,t.changes))||"input.type.compose"==i)?Jl(s,s.length-1,n.minDepth,new Gl(t.changes.compose(o.changes),Yl(t.effects,o.effects),o.mapped,o.startSelection,Xl)):Jl(s,s.length,n.minDepth,t),new rh(s,Xl,e,i)}addSelection(t,e,i,n){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Xl;return r.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new rh(Zl(this.done,t),this.undone,e,i);var s,o}addMapping(t){return new rh(eh(this.done,t),eh(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let r=n[n.length-1];if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Hl.of({side:t,rest:th(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let i=1==n.length?Xl:n.slice(0,n.length-1);return r.mapped&&(i=eh(i,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Hl.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}rh.empty=new rh(Xl,Xl);const sh=[{key:"Mod-z",run:ql,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:$l,preventDefault:!0},{linux:"Ctrl-Shift-z",run:$l,preventDefault:!0},{key:"Mod-u",run:Kl,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ul,preventDefault:!0}];function oh(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function ah(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function lh({state:t,dispatch:e},i){let n=oh(t.selection,i);return!n.eq(t.selection)&&(e(ah(t,n)),!0)}function hh(t,e){return B.cursor(e?t.to:t.from)}function ch(t,e){return lh(t,(i=>i.empty?t.moveByChar(i,e):hh(i,e)))}function uh(t){return t.textDirectionAt(t.state.selection.main.head)==Pi.LTR}const fh=t=>ch(t,!uh(t)),dh=t=>ch(t,uh(t));function ph(t,e){return lh(t,(i=>i.empty?t.moveByGroup(i,e):hh(i,e)))}function mh(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function gh(t,e,i){let n,r,s=aa(t).resolveInner(e.head),o=i?to.closedBy:to.openedBy;for(let n=e.head;;){let e=i?s.childAfter(n):s.childBefore(n);if(!e)break;mh(t,e,o)?s=e:n=i?e.to:e.from}return r=s.type.prop(o)&&(n=i?hl(t,s.from,1):hl(t,s.to,-1))&&n.matched?i?n.end.to:n.end.from:i?s.to:s.from,B.cursor(r,i?-1:1)}function wh(t,e){return lh(t,(i=>{if(!i.empty)return hh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const vh=t=>wh(t,!1),yh=t=>wh(t,!0);function bh(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):hh(i,e)));if(s.eq(r.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomkh(t,!1),Sh=t=>kh(t,!0);function Ah(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(r=B.cursor(n.from+i))}return r}function Mh(t,e){let i=oh(t.state.selection,(t=>{let i=e(t);return B.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(ah(t.state,i)),!0)}function Ch(t,e){return Mh(t,(i=>t.moveByChar(i,e)))}const Th=t=>Ch(t,!uh(t)),Oh=t=>Ch(t,uh(t));function Dh(t,e){return Mh(t,(i=>t.moveByGroup(i,e)))}function Eh(t,e){return Mh(t,(i=>t.moveVertically(i,e)))}const Lh=t=>Eh(t,!1),Bh=t=>Eh(t,!0);function Ph(t,e){return Mh(t,(i=>t.moveVertically(i,e,bh(t).height)))}const Nh=t=>Ph(t,!1),Rh=t=>Ph(t,!0),Ih=({state:t,dispatch:e})=>(e(ah(t,{anchor:0})),!0),zh=({state:t,dispatch:e})=>(e(ah(t,{anchor:t.doc.length})),!0),Hh=({state:t,dispatch:e})=>(e(ah(t,{anchor:t.selection.main.anchor,head:0})),!0),Vh=({state:t,dispatch:e})=>(e(ah(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function Wh(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange((n=>{let{from:r,to:s}=n;if(r==s){let n=e(r);nr&&(i="delete.forward",n=Fh(t,n,!0)),r=Math.min(r,n),s=Math.max(s,n)}else r=Fh(t,r,!1),s=Fh(t,s,!0);return r==s?{range:n}:{changes:{from:r,to:s},range:B.cursor(r)}}));return!r.changes.empty&&(t.dispatch(n.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Nr.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Fh(t,e,i){if(t instanceof Nr)for(let n of t.state.facet(Nr.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const jh=(t,e)=>Wh(t,(i=>{let n,r,{state:s}=t,o=s.doc.lineAt(i);if(!e&&i>o.from&&ijh(t,!1),qh=t=>jh(t,!0),$h=(t,e)=>Wh(t,(i=>{let n=i,{state:r}=t,s=r.doc.lineAt(n),o=r.charCategorizer(n);for(let t=null;;){if(n==(e?s.to:s.from)){n==i&&s.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let a=d(s.text,n-s.from,e)+s.from,l=s.text.slice(Math.min(n,a)-s.from,Math.max(n,a)-s.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),Kh=t=>$h(t,!1),Uh=t=>Wh(t,(e=>{let i=t.lineBlockAt(e).to;return e=r.number){let t=e[e.length-1];t.to=s.to,t.ranges.push(n)}else e.push({from:r.from,to:s.to,ranges:[n]});i=s.number+1}return e}function Jh(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let e of Gh(t)){if(i?e.to==t.doc.length:0==e.from)continue;let s=t.doc.lineAt(i?e.to+1:e.from-1),o=s.length+1;if(i){n.push({from:e.to,to:s.to},{from:e.from,insert:s.text+t.lineBreak});for(let i of e.ranges)r.push(B.range(Math.min(t.doc.length,i.anchor+o),Math.min(t.doc.length,i.head+o)))}else{n.push({from:s.from,to:e.from},{from:e.to,insert:t.lineBreak+s.text});for(let t of e.ranges)r.push(B.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:B.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Yh(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Gh(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Xh=Qh(!1);function Qh(e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=i.changeByRange((n=>{let{from:r,to:s}=n,o=i.doc.lineAt(r),a=!e&&r==s&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=aa(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(to.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(i,r);e&&(r=s=(s<=o.to?o:i.doc.lineAt(s)).to);let l=new Aa(i,{simulateBreak:r,simulateDoubleBreak:!!a}),h=Sa(l,r);for(null==h&&(h=zt(/^\s*/.exec(i.doc.lineAt(r).text)[0],i.tabSize));so.from&&r{let r=[];for(let s=n.from;s<=n.to;){let o=t.doc.lineAt(s);o.number>i&&(n.empty||n.to>o.from)&&(e(o,r,n),i=o.number),s=o.to+1}let s=t.changes(r);return{changes:r,range:B.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}}))}const tc=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>lh(t,(e=>gh(t.state,e,!uh(t)))),shift:t=>Mh(t,(e=>gh(t.state,e,!uh(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>lh(t,(e=>gh(t.state,e,uh(t)))),shift:t=>Mh(t,(e=>gh(t.state,e,uh(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Jh(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Yh(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Jh(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Yh(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=B.create([i.main]):i.main.empty||(n=B.create([B.cursor(i.main.head)])),!!n&&(e(ah(t,n)),!0)}},{key:"Mod-Enter",run:Qh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Gh(t).map((({from:e,to:i})=>B.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:B.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=oh(t.selection,(e=>{var i;let n=aa(t).resolveInner(e.head,1);for(;!(n.from=e.to||n.to>e.to&&n.from<=e.from)&&(null===(i=n.parent)||void 0===i?void 0:i.parent);)n=n.parent;return B.range(n.to,n.from)}));return e(ah(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Zh(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let r=zt(n,t.tabSize),s=0,o=xa(t,Math.max(0,r-ka(t)));for(;s!t.readOnly&&(e(t.update(Zh(t,((e,i)=>{i.push({from:e.from,insert:t.facet(ba)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Aa(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),r=Zh(t,((e,r,s)=>{let o=Sa(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=xa(t,o);(a!=l||s.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Gh(e).map((({from:t,to:i})=>(t>0?t--:it.moveVertically(e,!0))).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,i){let n=!1,r=oh(t.selection,(e=>{let r=hl(t,e.head,-1)||hl(t,e.head,1)||e.head>0&&hl(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Nl(t.state,i.from);return n.line?Ll(t):!!n.block&&Pl(t)}},{key:"Alt-A",run:Bl}].concat([{key:"ArrowLeft",run:fh,shift:Th,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>ph(t,!uh(t)),shift:t=>Dh(t,!uh(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>lh(t,(e=>Ah(t,e,!uh(t)))),shift:t=>Mh(t,(e=>Ah(t,e,!uh(t)))),preventDefault:!0},{key:"ArrowRight",run:dh,shift:Oh,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>ph(t,uh(t)),shift:t=>Dh(t,uh(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>lh(t,(e=>Ah(t,e,uh(t)))),shift:t=>Mh(t,(e=>Ah(t,e,uh(t)))),preventDefault:!0},{key:"ArrowUp",run:vh,shift:Lh,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ih,shift:Hh},{mac:"Ctrl-ArrowUp",run:xh,shift:Nh},{key:"ArrowDown",run:yh,shift:Bh,preventDefault:!0},{mac:"Cmd-ArrowDown",run:zh,shift:Vh},{mac:"Ctrl-ArrowDown",run:Sh,shift:Rh},{key:"PageUp",run:xh,shift:Nh},{key:"PageDown",run:Sh,shift:Rh},{key:"Home",run:t=>lh(t,(e=>Ah(t,e,!1))),shift:t=>Mh(t,(e=>Ah(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:Ih,shift:Hh},{key:"End",run:t=>lh(t,(e=>Ah(t,e,!0))),shift:t=>Mh(t,(e=>Ah(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:zh,shift:Vh},{key:"Enter",run:Xh},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:_h,shift:_h},{key:"Delete",run:qh},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kh},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>$h(t,!0)},{mac:"Mod-Backspace",run:t=>Wh(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Uh}].concat([{key:"Ctrl-b",run:fh,shift:Th,preventDefault:!0},{key:"Ctrl-f",run:dh,shift:Oh},{key:"Ctrl-p",run:vh,shift:Lh},{key:"Ctrl-n",run:yh,shift:Bh},{key:"Ctrl-a",run:t=>lh(t,(e=>B.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>Mh(t,(e=>B.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>lh(t,(e=>B.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>Mh(t,(e=>B.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:qh},{key:"Ctrl-h",run:_h},{key:"Ctrl-k",run:Uh},{key:"Ctrl-Alt-h",run:Kh},{key:"Ctrl-o",run:({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)})));return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),r=i==n.from?i-1:d(n.text,i-n.from,!1)+n.from,s=i==n.to?i+1:d(n.text,i-n.from,!0)+n.from;return{changes:{from:r,to:s,insert:t.doc.slice(i,s).append(t.doc.slice(r,i))},range:B.cursor(s)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Sh}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function ec(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];"string"==typeof r?t.setAttribute(n,r):null!=r&&(t[n]=r)}e++}for(;et.normalize("NFKD"):t=>t;class rc{constructor(t,e,i=0,n=t.length,r,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=r?t=>r(nc(t)):nc,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return v(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=y(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=b(t);let n=this.normalize(e);for(let t=0,r=i;;t++){let s=n.charCodeAt(t),o=this.match(s,r);if(t==n.length-1){if(o)return this.value=o,this;break}r==i&&tthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=uc(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,e)))return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||n.to<=e){let n=new hc(e,t.sliceString(e,i));return lc.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:r,from:s}=n;return s>e&&(r=t.sliceString(e,s)+r,s=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,i=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,i,e)))return this.value={from:t,to:i,match:e},this.matchPos=uc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=hc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function uc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function fc(t){let e=ec("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;let{state:n}=t,r=n.doc.lineAt(n.selection.main.head),[,s,o,a,l]=i,h=a?+a.slice(1):0,c=o?+o:r.number;if(o&&l){let t=c/100;s&&(t=t*("-"==s?-1:1)+r.number/n.doc.lines),c=Math.round(n.doc.lines*t)}else o&&s&&(c=c*("-"==s?-1:1)+r.number);let u=n.doc.line(Math.max(1,Math.min(n.doc.lines,c))),f=B.cursor(u.from+Math.max(0,Math.min(h,u.length)));t.dispatch({effects:[dc.of(!1),Nr.scrollIntoView(f.from,{y:"center"})],selection:f}),t.focus()}return{dom:ec("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:dc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},ec("label",t.state.phrase("Go to line"),": ",e)," ",ec("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(ac.prototype[Symbol.iterator]=cc.prototype[Symbol.iterator]=function(){return this});const dc=lt.define(),pc=j.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(dc)&&(t=i.value);return t},provide:t=>Ps.from(t,(t=>t?fc:null))}),mc=Nr.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),gc=R.define({combine:t=>bt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new $c(t),scrollToMatch:t=>Nr.scrollIntoView(t)})});class wc{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,oc),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new Ac(this):new bc(this)}getCursor(t,e=0,i){let n=t.doc?t:yt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?kc(this,n,e,i):yc(this,n,e,i)}}class vc{constructor(t){this.spec=t}}function yc(t,e,i,n){return new rc(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:t=>t.toLowerCase(),t.wholeWord?function(t,e){return(i,n,r,s)=>((s>i||s+r.length=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let r=yc(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}function kc(t,e,i,n){return new ac(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(r(xc(i.input,i.index))!=gt.Word||r(Sc(i.input,i.index))!=gt.Word)&&(r(Sc(i.input,i.index+i[0].length))!=gt.Word||r(xc(i.input,i.index+i[0].length))!=gt.Word)):void 0},i,n);var r}function xc(t,e){return t.slice(d(t,e,!1),e)}function Sc(t,e){return t.slice(e,d(t,e))}class Ac extends vc{nextMatch(t,e,i){let n=kc(this.spec,t,i,t.doc.length).next();return n.done&&(n=kc(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let r=Math.max(e,i-1e4*n),s=kc(this.spec,t,r,i),o=null;for(;!s.next().done;)o=s.value;if(o&&(r==e||o.from>r+10))return o;if(r==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,((e,i)=>"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let r=kc(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}const Mc=lt.define(),Cc=lt.define(),Tc=j.define({create:t=>new Oc(Vc(t).create(),null),update(t,e){for(let i of e.effects)i.is(Mc)?t=new Oc(i.value.create(),t.panel):i.is(Cc)&&(t=new Oc(t.query,i.value?Hc:null));return t},provide:t=>Ps.from(t,(t=>t.panel))});class Oc{constructor(t,e){this.query=t,this.panel=e}}const Dc=Ye.mark({class:"cm-searchMatch"}),Ec=Ye.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Lc=bi.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Tc))}update(t){let e=t.state.field(Tc);(e!=t.startState.field(Tc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ye.none;let{view:i}=this,n=new Ct;for(let e=0,r=i.visibleRanges,s=r.length;er[e+1].from-500;)a=r[++e].to;t.highlight(i.state,o,a,((t,e)=>{let r=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,r?Ec:Dc)}))}return n.finish()}},{decorations:t=>t.decorations});function Bc(t){return e=>{let i=e.state.field(Tc,!1);return i&&i.query.spec.valid?t(e,i):jc(e)}}const Pc=Bc(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=B.single(n.from,n.to),s=t.state.facet(gc);return t.dispatch({selection:r,effects:[Jc(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),Fc(t),!0})),Nc=Bc(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let s=B.single(r.from,r.to),o=t.state.facet(gc);return t.dispatch({selection:s,effects:[Jc(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),Fc(t),!0})),Rc=Bc(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length||(t.dispatch({selection:B.create(i.map((t=>B.range(t.from,t.to)))),userEvent:"select.search.matches"}),0))})),Ic=Bc(((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let s=e.nextMatch(i,n,n);if(!s)return!1;let o,a,l=[],h=[];if(s.from==n&&s.to==r&&(a=i.toText(e.getReplacement(s)),l.push({from:s.from,to:s.to,insert:a}),s=e.nextMatch(i,s.from,s.to),h.push(Nr.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),s){let e=0==l.length||l[0].from>=s.to?0:s.to-s.from-a.length;o=B.single(s.from-e,s.to-e),h.push(Jc(t,s)),h.push(i.facet(gc).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),zc=Bc(((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map((t=>{let{from:i,to:n}=t;return{from:i,to:n,insert:e.getReplacement(t)}}));if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Nr.announce.of(n),userEvent:"input.replace.all"}),!0}));function Hc(t){return t.state.facet(gc).createPanel(t)}function Vc(t,e){var i,n,r,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let h=t.facet(gc);return new wc({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:h.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:h.literal,regexp:null!==(s=null==e?void 0:e.regexp)&&void 0!==s?s:h.regexp,wholeWord:null!==(o=null==e?void 0:e.wholeWord)&&void 0!==o?o:h.wholeWord})}function Wc(t){let e=Ds(t,Hc);return e&&e.dom.querySelector("[main-field]")}function Fc(t){let e=Wc(t);e&&e==t.root.activeElement&&e.select()}const jc=t=>{let e=t.state.field(Tc,!1);if(e&&e.panel){let i=Wc(t);if(i&&i!=t.root.activeElement){let n=Vc(t.state,e.query.spec);n.valid&&t.dispatch({effects:Mc.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[Cc.of(!0),e?Mc.of(Vc(t.state,e.query.spec)):lt.appendConfig.of(Xc)]});return!0},_c=t=>{let e=t.state.field(Tc,!1);if(!e||!e.panel)return!1;let i=Ds(t,Hc);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Cc.of(!1)}),!0},qc=[{key:"Mod-f",run:jc,scope:"editor search-panel"},{key:"F3",run:Pc,shift:Nc,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Pc,shift:Nc,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:_c,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:r}=i.main,s=[],o=0;for(let e=new rc(t.doc,t.sliceDoc(n,r));!e.next().done;){if(s.length>1e3)return!1;e.value.from==n&&(o=s.length),s.push(B.range(e.value.from,e.value.to))}return e(t.update({selection:B.create(s,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Ds(t,fc);if(!e){let i=[dc.of(!0)];null==t.state.field(pc,!1)&&i.push(lt.appendConfig.of([pc,mc])),t.dispatch({effects:i}),e=Ds(t,fc)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some((t=>t.from===t.to)))return(({state:t,dispatch:e})=>{let{selection:i}=t,n=B.create(i.ranges.map((e=>t.wordAt(e.head)||B.cursor(e.head))),i.mainIndex);return!n.eq(i)&&(e(t.update({selection:n})),!0)})({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some((e=>t.sliceDoc(e.from,e.to)!=n)))return!1;let r=function(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),s=r&&r.from==i.from&&r.to==i.to;for(let i=!1,r=new rc(t.doc,e,n[n.length-1].to);;){if(r.next(),!r.done){if(i&&n.some((t=>t.from==r.value.from)))continue;if(s){let e=t.wordAt(r.value.from);if(!e||e.from!=r.value.from||e.to!=r.value.to)continue}return r.value}if(i)return null;r=new rc(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}}(t,n);return!!r&&(e(t.update({selection:t.selection.addRange(B.range(r.from,r.to),!1),effects:Nr.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class $c{constructor(t){this.view=t;let e=this.query=t.state.field(Tc).query.spec;function i(t,e,i){return ec("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=ec("input",{value:e.search,placeholder:Kc(t,"Find"),"aria-label":Kc(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ec("input",{value:e.replace,placeholder:Kc(t,"Replace"),"aria-label":Kc(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ec("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=ec("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=ec("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=ec("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>Pc(t)),[Kc(t,"next")]),i("prev",(()=>Nc(t)),[Kc(t,"previous")]),i("select",(()=>Rc(t)),[Kc(t,"all")]),ec("label",null,[this.caseField,Kc(t,"match case")]),ec("label",null,[this.reField,Kc(t,"regexp")]),ec("label",null,[this.wordField,Kc(t,"by word")]),...t.state.readOnly?[]:[ec("br"),this.replaceField,i("replace",(()=>Ic(t)),[Kc(t,"replace")]),i("replaceAll",(()=>zc(t)),[Kc(t,"replace all")])],ec("button",{name:"close",onclick:()=>_c(t),"aria-label":Kc(t,"close"),type:"button"},["×"])])}commit(){let t=new wc({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Mc.of(t)}))}keydown(t){var e,i;i=t,Ur(qr((e=this.view).state),i,e,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Nc:Pc)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),Ic(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Mc)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(gc).top}}function Kc(t,e){return t.state.phrase(e)}const Uc=30,Gc=/[\s\.,:;?!]/;function Jc(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,s=Math.max(n.from,e-Uc),o=Math.min(r,i+Uc),a=t.state.sliceDoc(s,o);if(s!=n.from)for(let t=0;ta.length-Uc;t--)if(!Gc.test(a[t-1])&&Gc.test(a[t])){a=a.slice(0,t);break}return Nr.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Yc=Nr.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Xc=[Tc,q.low(Lc),Yc];function Qc(t){return Qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qc(t)}function Zc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?(this.view.dispatch(this.view.state.changeByRange((function(e){return{changes:[{from:e.from,insert:t.pre},{from:e.to,insert:t.post}],range:B.range(e.to+t.pre.length+t.post.length,e.to+t.pre.length+t.post.length)}}))),this.$cmDom):(this.replaceSelection(r),i&&t.selectPeri?this.setSelection({start:n+t.pre.length,end:n+t.pre.length+e.length}):this.setSelection({start:n+r.length}),this.$cmDom)}}],i&&tu(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function nu(t){return nu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nu(t)}function ru(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i1&&void 0!==arguments[1]?arguments[1]:null;this.tokenTable["mw-tag-".concat(t)]||(this.addToken("mw-tag-".concat(t),e),this.addToken("mw-ext-".concat(t),e))}},{key:"addToken",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.tokenTable[t]||(this.tokenTable[t]=Lo.define(e),this.extHighlightStyles.push({tag:this.tokenTable[t],class:"cm-".concat(t)}))}},{key:"permittedHtmlTags",get:function(){return{b:!0,bdi:!0,del:!0,i:!0,ins:!0,u:!0,font:!0,big:!0,small:!0,sub:!0,sup:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,cite:!0,code:!0,em:!0,s:!0,strike:!0,strong:!0,tt:!0,var:!0,div:!0,center:!0,blockquote:!0,q:!0,ol:!0,ul:!0,dl:!0,table:!0,caption:!0,pre:!0,ruby:!0,rb:!0,rp:!0,rt:!0,rtc:!0,p:!0,span:!0,abbr:!0,dfn:!0,kbd:!0,samp:!0,data:!0,time:!0,mark:!0,br:!0,wbr:!0,hr:!0,li:!0,dt:!0,dd:!0,td:!0,th:!0,tr:!0,noinclude:!0,includeonly:!0,onlyinclude:!0}}},{key:"implicitlyClosedHtmlTags",get:function(){return{br:!0,hr:!0,wbr:!0}}},{key:"tags",get:function(){return function(t){for(var e=1;et.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(t.visibleRanges);try{var r=function(){var n,r=e.value,s=r.from,o=r.to;aa(t.state).iterate({from:s,to:o,enter:function(t){var e=t.name.split("_").some((function(t){return[fu.tags.htmlTagBracket,fu.tags.extTagBracket].includes(t)}));!n&&e?n=t.from:e&&(i.add(n,t.to,wu),n=null)}})};for(n.s();!(e=n.n()).done;)r()}catch(t){n.e(t)}finally{n.f()}return i.finish()}var yu=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.isolates=vu(e),this.tree=aa(e.state)}var e,i;return e=t,(i=[{key:"update",value:function(t){(t.docChanged||t.viewportChanged||aa(t.state)!==this.tree)&&(this.isolates=vu(t.view),this.tree=aa(t.state))}}])&&pu(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),bu={provide:function(t){var e=function(e){return e.plugin(t)&&e.plugin(t).isolates||Ye.none};return q.lowest([Nr.decorations.of(e),Nr.bidiIsolatedRanges.of(e)])}};const ku=bi.fromClass(yu,bu);function xu(t){return xu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(t)}function Su(t){return function(t){if(Array.isArray(t))return Au(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Au(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Au(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Au(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i{let{doc:r}=i.state,s=v(e[0],0);if(9==s){let t=r.lineAt(n),e=i.state.tabSize,s=zt(t.text,e,n-t.from);return Ye.replace({widget:new vs((e-s%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ye.replace({widget:new ws(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(ms);t.startState.facet(ms)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}({render:function(e,i,n){i=t[e]||mw.msg("codemirror-control-character",e);var r=document.createElement("span");return r.className="cm-specialChar",160!==e&&8239!==e||(n="·",r.className="cm-special-char-nbsp"),r.textContent=n,r.title=i,r.setAttribute("aria-label",i),r},addSpecialChars:/[\u00a0\u202f]/g})}},{key:"initialize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.defaultExtensions;mw.hook("ext.CodeMirror.initialize").fire(this.$textarea),mw.hook("editRecovery.loadEnd").add((function(e){t.editRecoveryHandler=e.fieldChangeHandler})),this.state=yt.create({doc:this.$textarea.textSelection("getContents"),extensions:e}),this.view=new Nr({state:this.state,parent:this.$textarea.parent()[0]}),this.$textarea.hide(),this.$textarea[0].form&&this.$textarea[0].form.addEventListener("submit",(function(){t.$textarea.val(t.view.state.doc.toString());var e=document.getElementById("wpScrolltop");e&&(e.value=t.view.scrollDOM.scrollTop)})),$(this.view.dom).textSelection("register",this.cmTextSelection),this.$textarea.textSelection("register",this.cmTextSelection)}},{key:"logUsage",value:function(t){var e=Object.assign({session_token:mw.user.sessionId(),user_id:mw.user.getId()},t),i=mw.config.get("wgUserEditCountBucket");null!==i&&(e.user_edit_count_bucket=i),mw.track("event.CodeMirrorUsage",e)}},{key:"setCodeMirrorPreference",value:function(t){mw.user.isNamed()&&((new mw.Api).saveOption("usecodemirror",t?1:0),mw.user.options.set("usecodemirror",t?1:0))}},{key:"cmTextSelection",get:function(){var t=this;return this.textSelection||(this.textSelection=new iu(this.view)),{getContents:function(){return t.textSelection.getContents()},setContents:function(e){return t.textSelection.setContents(e)},getCaretPosition:function(e){return t.textSelection.getCaretPosition(e)},scrollToCaretPosition:function(){return t.textSelection.scrollToCaretPosition()},getSelection:function(){return t.textSelection.getSelection()},setSelection:function(e){return t.textSelection.setSelection(e)},replaceSelection:function(e){return t.textSelection.replaceSelection(e)},encapsulateSelection:function(e){return t.textSelection.encapsulateSelection(e)}}}}],i&&Mu(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ou(t){return Ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(t)}function Du(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0,n}var i,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Iu(t,e)}(e,t),i=e,(n=[{key:"setCodeMirrorPreference",value:function(t){this.useCodeMirror=t,Nu(Ru(e.prototype),"setCodeMirrorPreference",this).call(this,t)}},{key:"enableCodeMirror",value:function(){var t,e=this;if(!this.view){var i=this.$textarea.prop("selectionStart"),n=this.$textarea.prop("selectionEnd"),r=this.$textarea.scrollTop(),s=this.$textarea.is(":focus"),o=[].concat(function(t){if(Array.isArray(t))return Du(t)}(t=this.defaultExtensions)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Du(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Du(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[this.langExtension,Nr.domEventHandlers({blur:function(){return e.$textarea.triggerHandler("blur")},focus:function(){return e.$textarea.triggerHandler("focus")}}),Nr.lineWrapping]);if(this.initialize(o),requestAnimationFrame((function(){e.view.scrollDOM.scrollTop=r})),0!==i||0!==n){var a=B.range(i,n),l=Nr.scrollIntoView(a);l.value.isSnapshot=!0,this.view.dispatch({selection:B.create([a]),effects:l})}s&&this.view.focus(),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}}},{key:"addCodeMirrorToWikiEditor",value:function(){var t=this,e=this.$textarea.data("wikiEditor-context"),i=e&&e.modules&&e.modules.toolbar;i&&(this.$textarea.wikiEditor("addToToolbar",{section:"main",groups:{codemirror:{tools:{CodeMirror:{label:mw.msg("codemirror-toggle-label"),type:"toggle",oouiIcon:"highlight",action:{type:"callback",execute:function(){return t.switchCodeMirror()}}}}}}}),i.$toolbar.find(".tool[rel=CodeMirror]").attr("id","mw-editbutton-codemirror"),this.readOnly&&this.$textarea.data("wikiEditor-context").$ui.addClass("ext-codemirror-readonly"),this.useCodeMirror&&this.enableCodeMirror(),this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!1,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0}))}},{key:"updateToolbarButton",value:function(){var t=$("#mw-editbutton-codemirror");t.toggleClass("mw-editbutton-codemirror-active",this.useCodeMirror),t.data("setActive")&&t.data("setActive")(this.useCodeMirror)}},{key:"switchCodeMirror",value:function(){if(this.view){this.setCodeMirrorPreference(!1);var t=this.view.scrollDOM.scrollTop,e=this.view.hasFocus,i=this.view.state.selection.ranges[0],n=i.from,r=i.to;$(this.view.dom).textSelection("unregister"),this.$textarea.textSelection("unregister"),this.$textarea.val(this.view.state.doc.toString()),this.view.destroy(),this.view=null,this.$textarea.show(),e&&this.$textarea.trigger("focus"),this.$textarea.prop("selectionStart",Math.min(n,r)).prop("selectionEnd",Math.max(r,n)),this.$textarea.scrollTop(t),mw.hook("ext.CodeMirror.switch").fire(!1,this.$textarea)}else this.enableCodeMirror(),this.setCodeMirrorPreference(!0);this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!0,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0})}}])&&Eu(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),e}(Tu);function Hu(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=Vu(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Vu(t,e){if(t){if("string"==typeof t)return Wu(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Wu(t,e):void 0}}function Wu(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0){var p=t.dom.querySelector(".cm-tooltip-fold");return p&&p.remove(),t.dispatch({effects:s,selection:{anchor:a}}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function(t){var e,i=t.state,n=i.selection,r=[],s=Ra(i),o=Hu(n.ranges);try{for(o.s();!(e=o.n()).done;){var a=e.value,l=a.from,h=a.to;s.between(l,h,(function(t,e){r.push(Pa.of({from:t,to:e}))}))}}catch(t){o.e(t)}finally{o.f()}return r.length>0&&(t.dispatch({effects:r,selection:n}),!0)}},{key:"Ctrl-Alt-]",run:t=>{let e=t.state.field(Na,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,((t,e)=>{i.push(Pa.of({from:t,to:e}))})),t.dispatch({effects:i}),!0}}],Gu=[function(t){let e=[Na,ja];return t&&e.push(Ha.of(t)),e}({placeholderDOM:function(t){var e=document.createElement("span");return e.textContent="…",e.setAttribute("aria-label",mw.msg("codemirror-folded-code")),e.title=mw.msg("codemirror-unfold"),e.className="cm-foldPlaceholder",e.onclick=function(e){var i=e.target,n=t.posAtDOM(i),r=t.state,s=r.selection;Ra(r).between(n,n,(function(e,i){e===n&&t.dispatch({effects:Pa.of({from:e,to:i}),selection:s})}))},e}}),j.define({create:Ku,update:function(t,e){var i=e.state,n=e.docChanged,r=e.selection;return n||r?Ku(i):t},provide:function(t){return Ts.from(t)}}),jr.of(Uu)];function Ju(t){return Ju="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ju(t)}function Yu(t,e){for(var i=0;i~).,'])"),"i"),this.isBold=!1,this.wasBold=!1,this.isItalic=!1,this.wasItalic=!1,this.firstSingleLetterWord=null,this.firstMultiLetterWord=null,this.firstSpace=null,this.oldStyle=null,this.tokens=[],this.oldTokens=[],this.tokenTable=fu.tokenTable,this.registerGroundTokens(),Object.keys(this.config.tags).forEach((function(t){return fu.addTag(t)}))}var e,i;return e=t,i=[{key:"registerGroundTokens",value:function(){["mw-ext-ground","mw-ext-link-ground","mw-ext2-ground","mw-ext2-link-ground","mw-ext3-ground","mw-ext3-link-ground","mw-link-ground","mw-template-ext-ground","mw-template-ext-link-ground","mw-template-ext2-ground","mw-template-ext2-link-ground","mw-template-ext3-ground","mw-template-ext3-link-ground","mw-template-ground","mw-template-link-ground","mw-template2-ext-ground","mw-template2-ext-link-ground","mw-template2-ext2-ground","mw-template2-ext2-link-ground","mw-template2-ext3-ground","mw-template2-ext3-link-ground","mw-template2-ground","mw-template2-link-ground","mw-template3-ext-ground","mw-template3-ext-link-ground","mw-template3-ext2-ground","mw-template3-ext2-link-ground","mw-template3-ext3-ground","mw-template3-ext3-link-ground","mw-template3-ground","mw-template3-link-ground"].forEach((function(t){return fu.addToken(t)}))}},{key:"eatHtmlEntity",value:function(t,e){return(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w.\-:]/)&&t.eat(";"))?fu.tags.htmlEntity:e}},{key:"makeStyle",value:function(t,e,i){return this.isBold&&(t+=" "+fu.tags.strong),this.isItalic&&(t+=" "+fu.tags.em),this.makeLocalStyle(t,e,i)}},{key:"makeLocalStyle",value:function(t,e,i){var n="";switch(e.nTemplate){case 0:break;case 1:n+="-template";break;case 2:n+="-template2";break;default:n+="-template3"}switch(e.nExt){case 0:break;case 1:n+="-ext";break;case 2:n+="-ext2";break;default:n+="-ext3"}return e.nLink>0&&(n+="-link"),""!==n&&(t="mw".concat(n,"-ground ").concat(t)),i&&e[i]--,t.trim()}},{key:"eatBlock",value:function(t,e,i){var n=this;return function(r,s){return r.skipTo(e)?(!1!==i&&r.match(e),s.tokenize=s.stack.pop()):r.skipToEnd(),n.makeLocalStyle(t,s)}}},{key:"eatEnd",value:function(t){var e=this;return function(i,n){return i.skipToEnd(),n.tokenize=n.stack.pop(),e.makeLocalStyle(t,n)}}},{key:"eatChar",value:function(t,e){var i=this;return function(n,r){return r.tokenize=r.stack.pop(),n.eat(t)?i.makeLocalStyle(e,r):i.makeLocalStyle(fu.tags.error,r)}}},{key:"eatSectionHeader",value:function(t){var e=this;return function(i,n){return i.match(/^[^&<[{~]+/)?(i.eol()?(i.backUp(t),n.tokenize=e.eatEnd(fu.tags.sectionHeader)):i.match(/^.*?=)/,!1)&&(i.backUp(t),n.tokenize=e.eatBlock(fu.tags.sectionHeader,"\x3c!--",!1)),fu.tags.section):e.eatWikiText(fu.tags.section)(i,n)}}},{key:"inVariable",value:function(t,e){return t.match(/^[^{}|]+/)?this.makeLocalStyle(fu.tags.templateVariableName,e):t.eat("|")?(e.tokenize=this.inVariableDefault.bind(this),this.makeLocalStyle(fu.tags.templateVariableDelimiter,e)):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.templateVariableBracket,e)):t.match("{{{")?(e.stack.push(e.tokenize),this.makeLocalStyle(fu.tags.templateVariableBracket,e)):(t.next(),this.makeLocalStyle(fu.tags.templateVariableName,e))}},{key:"inVariableDefault",value:function(t,e){return t.match(/^[^{}[<&~]+/)?this.makeLocalStyle(fu.tags.templateVariable,e):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.templateVariableBracket,e)):this.eatWikiText(fu.tags.templateVariable)(t,e)}},{key:"inParserFunctionName",value:function(t,e){return t.match(/^#?[^:}{~]+/)?this.makeLocalStyle(fu.tags.parserFunctionName,e):t.eat(":")?(e.tokenize=this.inParserFunctionArguments.bind(this),this.makeLocalStyle(fu.tags.parserFunctionDelimiter,e)):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(fu.tags.parserFunction)(t,e)}},{key:"inParserFunctionArguments",value:function(t,e){return t.match(/^[^|}{[<&~]+/)?this.makeLocalStyle(fu.tags.parserFunction,e):t.eat("|")?this.makeLocalStyle(fu.tags.parserFunctionDelimiter,e):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(fu.tags.parserFunction)(t,e)}},{key:"eatTemplatePageName",value:function(t){var e=this;return function(i,n){return i.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(fu.tags.templateDelimiter,n)):i.match(/^[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),e.makeLocalStyle(fu.tags.templateBracket,n,"nTemplate")):i.match(/^[\s\u00a0]*/)?e.makeLocalStyle(fu.tags.comment,n):t&&i.sol()?(n.nTemplate--,void(n.tokenize=n.stack.pop())):i.match(/^[\s\u00a0]*[^\s\u00a0|}<{&~]+/)?(n.tokenize=e.eatTemplatePageName(!0),e.makeLocalStyle(fu.tags.templateName,n)):i.eatSpace()?(i.eol(),e.makeLocalStyle(fu.tags.templateName,n)):e.eatWikiText(fu.tags.templateName)(i,n)}}},{key:"eatTemplateArgument",value:function(t){var e=this;return function(i,n){return t&&i.eatWhile(/[^=|}{[<&~]/)?i.eat("=")?(n.tokenize=e.eatTemplateArgument(!1),e.makeLocalStyle(fu.tags.templateArgumentName,n)):e.makeLocalStyle(fu.tags.template,n):i.eatWhile(/[^|}{[<&~]/)?e.makeLocalStyle(fu.tags.template,n):i.eat("|")?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(fu.tags.templateDelimiter,n)):i.match("}}")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(fu.tags.templateBracket,n,"nTemplate")):e.eatWikiText(fu.tags.template)(i,n)}}},{key:"eatExternalLinkProtocol",value:function(t){var e=this;return function(i,n){for(;t>0;)t--,i.next();return i.eol()?(n.nLink--,n.tokenize=n.stack.pop()):n.tokenize=e.inExternalLink.bind(e),e.makeLocalStyle(fu.tags.extLinkProtocol,n)}}},{key:"inExternalLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.extLinkBracket,e,"nLink")):t.eatSpace()?(e.tokenize=this.inExternalLinkText.bind(this),this.makeStyle("",e)):t.match(/^[^\s\u00a0\]{&~']+/)||t.eatSpace()?("'"===t.peek()&&(t.match("''",!1)?e.tokenize=this.inExternalLinkText.bind(this):t.next()),this.makeStyle(fu.tags.extLink,e)):this.eatWikiText(fu.tags.extLink)(t,e)}},{key:"inExternalLinkText",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.eat("]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.extLinkBracket,e,"nLink")):t.match(/^[^'\]{&~<]+/)?this.makeStyle(fu.tags.extLinkText,e):this.eatWikiText(fu.tags.extLinkText)(t,e)}},{key:"inLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*#[\s\u00a0]*/)?(e.tokenize=this.inLinkToSection.bind(this),this.makeLocalStyle(fu.tags.link,e)):t.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(fu.tags.linkDelimiter,e)):t.match(/^[\s\u00a0]*\]\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.linkBracket,e,"nLink")):t.match(/^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/)||t.eatSpace()?this.makeStyle("".concat(fu.tags.linkPageName," ").concat(fu.tags.pageName),e):this.eatWikiText("".concat(fu.tags.linkPageName," ").concat(fu.tags.pageName))(t,e)}},{key:"inLinkToSection",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[^|\]&~{}]+/)?this.makeLocalStyle(fu.tags.linkToSection,e):t.eat("|")?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(fu.tags.linkDelimiter,e)):t.match("]]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.linkBracket,e,"nLink")):this.eatWikiText(fu.tags.linkToSection)(t,e)}},{key:"eatLinkText",value:function(){var t,e,i=this;return function(n,r){var s;return n.match("]]")?(r.tokenize=r.stack.pop(),i.makeLocalStyle(fu.tags.linkBracket,r,"nLink")):n.match("'''")?(t=!t,i.makeLocalStyle("".concat(fu.tags.linkText," ").concat(fu.tags.apostrophes),r)):n.match("''")?(e=!e,i.makeLocalStyle("".concat(fu.tags.linkText," ").concat(fu.tags.apostrophes),r)):(s=fu.tags.linkText,t&&(s+=" "+fu.tags.strong),e&&(s+=" "+fu.tags.em),n.match(/^[^'\]{&~<]+/)?i.makeStyle(s,r):i.eatWikiText(s)(n,r))}}},{key:"eatTagName",value:function(t,e,i){var n=this;return function(r,s){for(var o="";t>0;)t--,o+=r.next();return r.eatSpace(),o=o.toLowerCase(),i?(e&&!fu.implicitlyClosedHtmlTags[o]?s.tokenize=n.eatChar(">",fu.tags.htmlTagBracket):s.tokenize=n.eatHtmlTagAttribute(o),n.makeLocalStyle(fu.tags.htmlTagName,s)):(s.tokenize=e?n.eatChar(">","".concat(fu.tags.extTagBracket," mw-ext-").concat(o)):n.eatExtTagAttribute(o),n.makeLocalStyle("".concat(fu.tags.extTagName," mw-ext-").concat(o),s))}}},{key:"eatHtmlTagAttribute",value:function(t){var e=this;return function(i,n){return i.match(/^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/)?e.makeLocalStyle(fu.tags.htmlTagAttribute,n):i.eat(">")?(t in fu.implicitlyClosedHtmlTags||n.inHtmlTag.push(t),n.tokenize=n.stack.pop(),e.makeLocalStyle(fu.tags.htmlTagBracket,n)):i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(fu.tags.htmlTagBracket,n)):e.eatWikiText(fu.tags.htmlTagAttribute)(i,n)}}},{key:"eatNowiki",value:function(){var t=this;return function(e){return e.match(/^[^&]+/)?"":(e.next(),t.eatHtmlEntity(e,""))}}},{key:"eatExtTagAttribute",value:function(t){var e=this;return function(i,n){if(i.match(/^(?:"[^">]*"|'[^'>]*'|[^>/<{&~])+/))return e.makeLocalStyle("".concat(fu.tags.extTagAttribute," mw-ext-").concat(t),n);if(i.eat(">")){if(n.extName=t,"nowiki"===t||"pre"===t)n.extMode={startState:function(){},copyState:function(){},token:e.eatNowiki()};else if(t in e.config.tagModes){var r=e.config.tagModes[t];"mediawiki"!==r&&"text/mediawiki"!==r||(n.extMode=e.mediawiki,n.extState=n.extMode.startState())}return n.tokenize=e.eatExtTagArea(t),e.makeLocalStyle("".concat(fu.tags.extTagBracket," mw-ext-").concat(t),n)}return i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle("".concat(fu.tags.extTagBracket," mw-ext-").concat(t),n)):e.eatWikiText("".concat(fu.tags.extTagAttribute," mw-ext-").concat(t))(i,n)}}},{key:"eatExtTagArea",value:function(t){var e=this;return function(i,n){var r,s=i.pos,o=new RegExp(""),"i").exec(s?i.string.slice(s):i.string),a=!1;if(o){if(0===o.index)return n.tokenize=e.eatExtCloseTag(t),n.extName=!1,!1!==n.extMode&&(n.extMode=!1,n.extState=!1),n.tokenize(i,n);r=o.index+s,a=i.string,i.string=a.slice(0,r)}return n.stack.push(n.tokenize),n.tokenize=e.eatExtTokens(a),n.tokenize(i,n)}}},{key:"eatExtCloseTag",value:function(t){var e=this;return function(i,n){return i.next(),i.next(),n.tokenize=e.eatTagName(t.length,!0,!1),e.makeLocalStyle("".concat(fu.tags.extTagBracket," mw-ext-").concat(t),n)}}},{key:"eatExtTokens",value:function(t){var e=this;return function(i,n){var r;return!1===n.extMode?(r=fu.tags.extTag,i.skipToEnd()):r="mw-tag-".concat(n.extName," ")+n.extMode.token(i,n.extState,!1===t),i.eol()&&(!1!==t&&(i.string=t),n.tokenize=n.stack.pop()),e.makeLocalStyle(r,n)}}},{key:"eatStartTable",value:function(t,e){return t.match("{|"),t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),fu.tags.tableBracket}},{key:"inTableDefinition",value:function(t,e){return t.sol()?(e.tokenize=this.inTable.bind(this),this.inTable(t,e)):this.eatWikiText(fu.tags.tableDefinition)(t,e)}},{key:"inTable",value:function(t,e){if(t.sol()){if(t.eatSpace(),t.eat("|"))return t.eat("-")?(t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),this.makeLocalStyle(fu.tags.tableDelimiter,e)):t.eat("+")?(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1,!0),this.makeLocalStyle(fu.tags.tableDelimiter,e)):t.eat("}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.tableBracket,e)):(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1),this.makeLocalStyle(fu.tags.tableDelimiter,e));if(t.eat("!"))return t.eatSpace(),e.tokenize=this.eatTableRow(!0,!0),this.makeLocalStyle(fu.tags.tableDelimiter,e)}return this.eatWikiText("")(t,e)}},{key:"eatTableRow",value:function(t,e,i){var n=this,r="";return i?r=fu.tags.tableCaption:e&&(r=fu.tags.strong),function(s,o){if(s.sol()){if(s.match(/^[\s\u00a0]*[|!]/,!1))return o.tokenize=n.inTable.bind(n),n.inTable(s,o)}else{if(s.match(/^[^'|{[<&~!]+/))return n.makeStyle(r,o);if(s.match("||")||e&&s.match("!!"))return n.isBold=!1,n.isItalic=!1,o.tokenize=n.eatTableRow(!0,e,i),n.makeLocalStyle(fu.tags.tableDelimiter,o);if(t&&s.eat("|"))return o.tokenize=n.eatTableRow(!1,e,i),n.makeLocalStyle(fu.tags.tableDelimiter,o)}return n.eatWikiText(r)(s,o)}}},{key:"eatFreeExternalLinkProtocol",value:function(t,e){return t.match(this.urlProtocols),e.tokenize=this.eatFreeExternalLink.bind(this),this.makeLocalStyle(fu.tags.freeExtLinkProtocol,e)}},{key:"eatFreeExternalLink",value:function(t,e){if(t.eol());else if(t.match(/^[^\s\u00a0{[\]<>~).,']*/))if("~"===t.peek()){if(!t.match(/^~~~+/,!1))return t.match(/^~*/),this.makeLocalStyle(fu.tags.freeExtLink,e)}else if("{"===t.peek()){if(!t.match("{{",!1))return t.next(),this.makeLocalStyle(fu.tags.freeExtLink,e)}else if("'"===t.peek()){if(!t.match("''",!1))return t.next(),this.makeLocalStyle(fu.tags.freeExtLink,e)}else if(t.match(/^[).,]+(?=[^\s\u00a0{[\]<>~).,])/))return this.makeLocalStyle(fu.tags.freeExtLink,e);return e.tokenize=e.stack.pop(),this.makeLocalStyle(fu.tags.freeExtLink,e)}},{key:"eatWikiText",value:function(t){var e=this;return function(i,n){var r,s,o,a,l,h,c;if(i.sol()){if(!i.match("//",!1)&&i.match(e.urlProtocols))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLink.bind(e),e.makeLocalStyle(fu.tags.freeExtLinkProtocol,n);switch(r=i.next()){case"-":if(i.match(/^---+/))return fu.tags.hr;break;case"=":if(s=i.match(/^(={0,5})(.+?(=\1\s*)(.*\S).*?)?)$/))return i.backUp(s[2].length),n.stack.push(n.tokenize),n.tokenize=e.eatSectionHeader(s[3].length),fu.tags.sectionHeader+" "+fu.tags["sectionHeader".concat(s[1].length+1)];break;case"*":case"#":case";":return i.match(/^[*#;:]*/),fu.tags.list;case":":return i.match(/^:*{\|/,!1)&&(n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e)),i.match(/^[*#;:]*/),fu.tags.indenting;case" ":if(!i.match(/^[\s\u00a0]*:*{\|/,!1))return fu.tags.skipFormatting;if(i.eatSpace(),i.match(/^:+/))return n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e),fu.tags.indenting;i.eat("{");case"{":if(i.eat("|"))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inTableDefinition.bind(e),fu.tags.tableBracket}}else r=i.next();switch(r){case"&":return e.makeStyle(e.eatHtmlEntity(i,t),n);case"'":if(i.match(/^'*(?=''''')/)||i.match(/^'''(?!')/,!1))break;if(i.match("''"))return e.firstSingleLetterWord||i.match("''",!1)||e.prepareItalicForCorrection(i),e.isBold=!e.isBold,e.makeLocalStyle(fu.tags.apostrophesBold,n);if(i.eat("'"))return e.isItalic=!e.isItalic,e.makeLocalStyle(fu.tags.apostrophesItalic,n);break;case"[":if(i.eat("[")){if(i.eatSpace(),/[^\]|[]/.test(i.peek()))return n.nLink++,n.stack.push(n.tokenize),n.tokenize=e.inLink.bind(e),e.makeLocalStyle(fu.tags.linkBracket,n)}else if(o=i.match(e.urlProtocols))return n.nLink++,i.backUp(o[0].length),n.stack.push(n.tokenize),n.tokenize=e.eatExternalLinkProtocol(o[0].length),e.makeLocalStyle(fu.tags.extLinkBracket,n);break;case"{":if(i.match(/^{{(?!{|[^{}]*}}(?!}))/))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inVariable.bind(e),e.makeLocalStyle(fu.tags.templateVariableBracket,n);if(i.match(/^{(?!{(?!{))[\s\u00a0]*/))return"#"===i.peek()?(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(fu.tags.parserFunctionBracket,n)):!(a=i.match(/^([^\s\u00a0}[\]<{'|&:]+)(:|[\s\u00a0]*)(\}\}?)?(.)?/))||(i.backUp(a[0].length),":"!==a[2]&&void 0!==a[4]&&"}}"!==a[3]||!(a[1].toLowerCase()in e.config.functionSynonyms[0])&&!(a[1]in e.config.functionSynonyms[1]))?(n.nTemplate++,n.stack.push(n.tokenize),n.tokenize=e.eatTemplatePageName(!1),e.makeLocalStyle(fu.tags.templateBracket,n)):(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(fu.tags.parserFunctionBracket,n));break;case"<":if(l=!!i.eat("/"),h=i.match(/^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/),i.match("!--"))return c=e.eatBlock(fu.tags.comment,"--\x3e"),n.stack.push(n.tokenize),n.tokenize=c,c(i,n);if(h){if((h=h[0].toLowerCase())in e.config.tags)return!0===l?fu.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l,!1),e.makeLocalStyle("".concat(fu.tags.extTagBracket," mw-ext-").concat(h),n));if(h in fu.permittedHtmlTags)return!0===l&&h!==n.inHtmlTag.pop()?(i.pos++,fu.tags.error):!0===l&&h in fu.implicitlyClosedHtmlTags?fu.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l||h in fu.implicitlyClosedHtmlTags,!0),e.makeLocalStyle(fu.tags.htmlTagBracket,n));i.backUp(h.length)}break;case"~":if(i.match(/^~{2,4}/))return fu.tags.signature;break;case"_":for(s=1;i.eat("_");)s++;if(s>2)return i.eol()||i.backUp(2),e.makeStyle(t,n);if(2===s&&(a=i.match(/^([^\s\u00a0>}[\]<{'|&:~]+?)__/))&&a[0])return"__"+a[0].toLowerCase()in e.config.doubleUnderscore[0]||"__"+a[0]in e.config.doubleUnderscore[1]?fu.tags.doubleUnderscore:(i.eol()||i.backUp(2),e.makeStyle(t,n));break;default:if(/[\s\u00a0]/.test(r)&&(i.eatSpace(),i.match(e.urlProtocols,!1)&&!i.match("//")))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLinkProtocol.bind(e),e.makeStyle(t,n)}return i.match(/^[^\s\u00a0_>}[\]<{'|&:~=]+/),e.makeStyle(t,n)}}},{key:"prepareItalicForCorrection",value:function(t){var e=t.pos,i=t.string.slice(0,e-3),n=i.slice(-1),r=i.slice(-2,-1);if(" "===n){if(this.firstMultiLetterWord||this.firstSpace)return;this.firstSpace=e}else if(" "===r)this.firstSingleLetterWord=e;else{if(this.firstMultiLetterWord)return;this.firstMultiLetterWord=e}this.wasBold=this.isBold,this.wasItalic=this.isItalic}},{key:"mediawiki",get:function(){var t=this;return{name:"mediawiki",startState:function(){return{tokenize:t.eatWikiText(""),stack:[],inHtmlTag:[],extName:!1,extMode:!1,extState:!1,nTemplate:0,nLink:0,nExt:0}},copyState:function(t){return{tokenize:t.tokenize,stack:t.stack.concat([]),inHtmlTag:t.inHtmlTag.concat([]),extName:t.extName,extMode:t.extMode,extState:!1!==t.extMode&&t.extMode.copyState(t.extState),nTemplate:t.nTemplate,nLink:t.nLink,nExt:t.nExt}},token:function(e,i){var n,r,s,o,a=[],l=[];if(t.oldTokens.length>0)return s=t.oldTokens.shift(),e.pos=s.pos,i=s.state,s.style;e.sol()&&(t.isBold=!1,t.isItalic=!1,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null);do{if(n=i.tokenize(e,i),!(o=t.firstSingleLetterWord||t.firstMultiLetterWord||t.firstSpace))return t.oldStyle=n,n;o!==r&&(r=o,l.length>0&&(a=a.concat(l),l=[])),l.push({pos:e.pos,style:n,state:(i.extMode||t.mediawiki).copyState(i)})}while(!e.eol());if(t.isBold&&t.isItalic){if(t.isItalic=t.wasItalic,t.isBold=t.wasBold,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null,!(a.length>0))return e.pos=l[0].pos-2,t.oldStyle;a[a.length-1].pos++,t.oldTokens=a}else t.oldTokens=a.concat(l);return s=t.oldTokens.shift(),e.pos=s.pos,i=s.state,s.style},blankLine:function(t){t.extMode&&t.extMode.blankLine&&t.extMode.blankLine(t.extState)},tokenTable:this.tokenTable}}}],i&&Yu(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();mw.loader.getState("ext.wikiEditor")&&mw.hook("wikiEditor.toolbarReady").add((function(t){var e=new zu(t,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t=t||mw.config.get("extCodeMirrorConfig");var e=new Qu(t).mediawiki,i=ml.define(e),n=[Ua(_a.define(fu.getTagStyles(e)))],r=t.templateFoldingNamespaces;return r&&!r.includes(mw.config.get("wgNamespaceNumber"))||n.push(Gu),new va(i,n)}());e.addCodeMirrorToWikiEditor()}))})(); //# sourceMappingURL=main.js.map.json \ No newline at end of file diff --git a/resources/dist/main.js.map.json b/resources/dist/main.js.map.json index dfb3e6dd..16b0ef55 100644 --- a/resources/dist/main.js.map.json +++ b/resources/dist/main.js.map.json @@ -1 +1 @@ -{"version":3,"file":"main.js","mappings":"mBAGA,MAAMA,EAIF,MAAAC,CAAOC,GACH,GAAIA,EAAM,GAAKA,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EAAOz+E,IAAMs4B,EAAEt4B,IACf4Q,EAAQ0nB,EAAE1nB,MACH0nB,EAAEpJ,KACV,EAEAwuD,UAAW,SAAE9sE,GACPA,EAAMixF,SAAWjxF,EAAMixF,QAAQnkB,WACnC9sE,EAAMixF,QAAQnkB,UAAW9sE,EAAMqxF,SAEjC,EAQApkB,WAAY59E,KAAK49E,WAEnB,I,wEAACqgB,CAAA,CAzqC2B,GCdxBzV,GAAG6b,OAAOC,SAAU,mBACxB9b,GAAGoB,KAAM,2BAA4B/jF,KAAK,SAAEkiF,GAC3C,IAAMwc,EAAO,IAAI9J,GAAsB1S,EDosCZ,WAAqB,IAAnB93E,EAAMkjB,UAAAlzB,OAAA,QAAA2N,IAAAulB,UAAA,GAAAA,UAAA,GAAG,KACvCljB,EAASA,GAAUu4E,GAAGv4E,OAAOM,IAAK,uBAClC,IACMmwD,EADO,IAAIu9B,GAAyBhuF,GACtB8xF,UACd1wB,EAAOkM,GAAevtE,OAAQ0wD,GAC9Bi6B,EAAgB,CAAElhB,GACvBT,GAAehpE,OACdgtF,GAAWwH,aAAc9jC,MAKrB+jC,EAAoBx0F,EAAOy0F,0BAMjC,OAJMD,IAAqBA,EAAkBld,SAAUiB,GAAGv4E,OAAOM,IAAK,uBACrEoqF,EAAc52F,KAAM65F,IAGd,IAAI/oB,GAAiBxD,EAAMspB,EACnC,CCvtCoDgK,IAClDJ,EAAKK,2BACN,G","sources":["/w/extensions/CodeMirror/./node_modules/@codemirror/state/dist/index.js","/w/extensions/CodeMirror/./node_modules/style-mod/src/style-mod.js","/w/extensions/CodeMirror/./node_modules/w3c-keyname/index.js","/w/extensions/CodeMirror/./node_modules/@codemirror/view/dist/index.js","/w/extensions/CodeMirror/./src/codemirror.textSelection.js","/w/extensions/CodeMirror/./node_modules/@lezer/common/dist/index.js","/w/extensions/CodeMirror/./node_modules/@lezer/highlight/dist/index.js","/w/extensions/CodeMirror/./node_modules/@codemirror/language/dist/index.js","/w/extensions/CodeMirror/./src/codemirror.mode.mediawiki.config.js","/w/extensions/CodeMirror/./src/codemirror.bidiIsolation.js","/w/extensions/CodeMirror/./src/codemirror.js","/w/extensions/CodeMirror/./node_modules/@codemirror/commands/dist/index.js","/w/extensions/CodeMirror/./node_modules/crelt/index.js","/w/extensions/CodeMirror/./node_modules/@codemirror/search/dist/index.js","/w/extensions/CodeMirror/./src/codemirror.wikieditor.js","/w/extensions/CodeMirror/./src/codemirror.templateFolding.js","/w/extensions/CodeMirror/./src/codemirror.mode.mediawiki.js","/w/extensions/CodeMirror/./src/codemirror.wikieditor.mediawiki.js"],"sourcesContent":["/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n /**\n Get the line description around the given position.\n */\n lineAt(pos) {\n if (pos < 0 || pos > this.length)\n throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n return this.lineInner(pos, false, 1, 0);\n }\n /**\n Get the description for the given (1-based) line number.\n */\n line(n) {\n if (n < 1 || n > this.lines)\n throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`);\n return this.lineInner(n, true, 1, 0);\n }\n /**\n Replace a range of the text with the given content.\n */\n replace(from, to, text) {\n let parts = [];\n this.decompose(0, from, parts, 2 /* Open.To */);\n if (text.length)\n text.decompose(0, text.length, parts, 1 /* Open.From */ | 2 /* Open.To */);\n this.decompose(to, this.length, parts, 1 /* Open.From */);\n return TextNode.from(parts, this.length - (to - from) + text.length);\n }\n /**\n Append another document to this one.\n */\n append(other) {\n return this.replace(this.length, this.length, other);\n }\n /**\n Retrieve the text between the given points.\n */\n slice(from, to = this.length) {\n let parts = [];\n this.decompose(from, to, parts, 0);\n return TextNode.from(parts, to - from);\n }\n /**\n Test whether this text is equal to another instance.\n */\n eq(other) {\n if (other == this)\n return true;\n if (other.length != this.length || other.lines != this.lines)\n return false;\n let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1);\n let a = new RawTextCursor(this), b = new RawTextCursor(other);\n for (let skip = start, pos = start;;) {\n a.next(skip);\n b.next(skip);\n skip = 0;\n if (a.lineBreak != b.lineBreak || a.done != b.done || a.value != b.value)\n return false;\n pos += a.value.length;\n if (a.done || pos >= end)\n return true;\n }\n }\n /**\n Iterate over the text. When `dir` is `-1`, iteration happens\n from end to start. This will return lines and the breaks between\n them as separate strings.\n */\n iter(dir = 1) { return new RawTextCursor(this, dir); }\n /**\n Iterate over a range of the text. When `from` > `to`, the\n iterator will run in reverse.\n */\n iterRange(from, to = this.length) { return new PartialTextCursor(this, from, to); }\n /**\n Return a cursor that iterates over the given range of lines,\n _without_ returning the line breaks between, and yielding empty\n strings for empty lines.\n \n When `from` and `to` are given, they should be 1-based line numbers.\n */\n iterLines(from, to) {\n let inner;\n if (from == null) {\n inner = this.iter();\n }\n else {\n if (to == null)\n to = this.lines + 1;\n let start = this.line(from).from;\n inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to));\n }\n return new LineCursor(inner);\n }\n /**\n Return the document as a string, using newline characters to\n separate lines.\n */\n toString() { return this.sliceString(0); }\n /**\n Convert the document to an array of lines (which can be\n deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)).\n */\n toJSON() {\n let lines = [];\n this.flatten(lines);\n return lines;\n }\n /**\n @internal\n */\n constructor() { }\n /**\n Create a `Text` instance for the given array of lines.\n */\n static of(text) {\n if (text.length == 0)\n throw new RangeError(\"A document must have at least one line\");\n if (text.length == 1 && !text[0])\n return Text.empty;\n return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n }\n}\n// Leaves store an array of line strings. There are always line breaks\n// between these strings. Leaves are limited in size and have to be\n// contained in TextNode instances for bigger documents.\nclass TextLeaf extends Text {\n constructor(text, length = textLength(text)) {\n super();\n this.text = text;\n this.length = length;\n }\n get lines() { return this.text.length; }\n get children() { return null; }\n lineInner(target, isLine, line, offset) {\n for (let i = 0;; i++) {\n let string = this.text[i], end = offset + string.length;\n if ((isLine ? line : end) >= target)\n return new Line(offset, end, line, string);\n offset = end + 1;\n line++;\n }\n }\n decompose(from, to, target, open) {\n let text = from <= 0 && to >= this.length ? this\n : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));\n if (open & 1 /* Open.From */) {\n let prev = target.pop();\n let joined = appendText(text.text, prev.text.slice(), 0, text.length);\n if (joined.length <= 32 /* Tree.Branch */) {\n target.push(new TextLeaf(joined, prev.length + text.length));\n }\n else {\n let mid = joined.length >> 1;\n target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid)));\n }\n }\n else {\n target.push(text);\n }\n }\n replace(from, to, text) {\n if (!(text instanceof TextLeaf))\n return super.replace(from, to, text);\n let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);\n let newLen = this.length + text.length - (to - from);\n if (lines.length <= 32 /* Tree.Branch */)\n return new TextLeaf(lines, newLen);\n return TextNode.from(TextLeaf.split(lines, []), newLen);\n }\n sliceString(from, to = this.length, lineSep = \"\\n\") {\n let result = \"\";\n for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) {\n let line = this.text[i], end = pos + line.length;\n if (pos > from && i)\n result += lineSep;\n if (from < end && to > pos)\n result += line.slice(Math.max(0, from - pos), to - pos);\n pos = end + 1;\n }\n return result;\n }\n flatten(target) {\n for (let line of this.text)\n target.push(line);\n }\n scanIdentical() { return 0; }\n static split(text, target) {\n let part = [], len = -1;\n for (let line of text) {\n part.push(line);\n len += line.length + 1;\n if (part.length == 32 /* Tree.Branch */) {\n target.push(new TextLeaf(part, len));\n part = [];\n len = -1;\n }\n }\n if (len > -1)\n target.push(new TextLeaf(part, len));\n return target;\n }\n}\n// Nodes provide the tree structure of the `Text` type. They store a\n// number of other nodes or leaves, taking care to balance themselves\n// on changes. There are implied line breaks _between_ the children of\n// a node (but not before the first or after the last child).\nclass TextNode extends Text {\n constructor(children, length) {\n super();\n this.children = children;\n this.length = length;\n this.lines = 0;\n for (let child of children)\n this.lines += child.lines;\n }\n lineInner(target, isLine, line, offset) {\n for (let i = 0;; i++) {\n let child = this.children[i], end = offset + child.length, endLine = line + child.lines - 1;\n if ((isLine ? endLine : end) >= target)\n return child.lineInner(target, isLine, line, offset);\n offset = end + 1;\n line = endLine + 1;\n }\n }\n decompose(from, to, target, open) {\n for (let i = 0, pos = 0; pos <= to && i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n if (from <= end && to >= pos) {\n let childOpen = open & ((pos <= from ? 1 /* Open.From */ : 0) | (end >= to ? 2 /* Open.To */ : 0));\n if (pos >= from && end <= to && !childOpen)\n target.push(child);\n else\n child.decompose(from - pos, to - pos, target, childOpen);\n }\n pos = end + 1;\n }\n }\n replace(from, to, text) {\n if (text.lines < this.lines)\n for (let i = 0, pos = 0; i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n // Fast path: if the change only affects one child and the\n // child's size remains in the acceptable range, only update\n // that child\n if (from >= pos && to <= end) {\n let updated = child.replace(from - pos, to - pos, text);\n let totalLines = this.lines - child.lines + updated.lines;\n if (updated.lines < (totalLines >> (5 /* Tree.BranchShift */ - 1)) &&\n updated.lines > (totalLines >> (5 /* Tree.BranchShift */ + 1))) {\n let copy = this.children.slice();\n copy[i] = updated;\n return new TextNode(copy, this.length - (to - from) + text.length);\n }\n return super.replace(pos, end, updated);\n }\n pos = end + 1;\n }\n return super.replace(from, to, text);\n }\n sliceString(from, to = this.length, lineSep = \"\\n\") {\n let result = \"\";\n for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) {\n let child = this.children[i], end = pos + child.length;\n if (pos > from && i)\n result += lineSep;\n if (from < end && to > pos)\n result += child.sliceString(from - pos, to - pos, lineSep);\n pos = end + 1;\n }\n return result;\n }\n flatten(target) {\n for (let child of this.children)\n child.flatten(target);\n }\n scanIdentical(other, dir) {\n if (!(other instanceof TextNode))\n return 0;\n let length = 0;\n let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length]\n : [this.children.length - 1, other.children.length - 1, -1, -1];\n for (;; iA += dir, iB += dir) {\n if (iA == eA || iB == eB)\n return length;\n let chA = this.children[iA], chB = other.children[iB];\n if (chA != chB)\n return length + chA.scanIdentical(chB, dir);\n length += chA.length + 1;\n }\n }\n static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) {\n let lines = 0;\n for (let ch of children)\n lines += ch.lines;\n if (lines < 32 /* Tree.Branch */) {\n let flat = [];\n for (let ch of children)\n ch.flatten(flat);\n return new TextLeaf(flat, length);\n }\n let chunk = Math.max(32 /* Tree.Branch */, lines >> 5 /* Tree.BranchShift */), maxChunk = chunk << 1, minChunk = chunk >> 1;\n let chunked = [], currentLines = 0, currentLen = -1, currentChunk = [];\n function add(child) {\n let last;\n if (child.lines > maxChunk && child instanceof TextNode) {\n for (let node of child.children)\n add(node);\n }\n else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) {\n flush();\n chunked.push(child);\n }\n else if (child instanceof TextLeaf && currentLines &&\n (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf &&\n child.lines + last.lines <= 32 /* Tree.Branch */) {\n currentLines += child.lines;\n currentLen += child.length + 1;\n currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length);\n }\n else {\n if (currentLines + child.lines > chunk)\n flush();\n currentLines += child.lines;\n currentLen += child.length + 1;\n currentChunk.push(child);\n }\n }\n function flush() {\n if (currentLines == 0)\n return;\n chunked.push(currentChunk.length == 1 ? currentChunk[0] : TextNode.from(currentChunk, currentLen));\n currentLen = -1;\n currentLines = currentChunk.length = 0;\n }\n for (let child of children)\n add(child);\n flush();\n return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length);\n }\n}\nText.empty = /*@__PURE__*/new TextLeaf([\"\"], 0);\nfunction textLength(text) {\n let length = -1;\n for (let line of text)\n length += line.length + 1;\n return length;\n}\nfunction appendText(text, target, from = 0, to = 1e9) {\n for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {\n let line = text[i], end = pos + line.length;\n if (end >= from) {\n if (end > to)\n line = line.slice(0, to - pos);\n if (pos < from)\n line = line.slice(from - pos);\n if (first) {\n target[target.length - 1] += line;\n first = false;\n }\n else\n target.push(line);\n }\n pos = end + 1;\n }\n return target;\n}\nfunction sliceText(text, from, to) {\n return appendText(text, [\"\"], from, to);\n}\nclass RawTextCursor {\n constructor(text, dir = 1) {\n this.dir = dir;\n this.done = false;\n this.lineBreak = false;\n this.value = \"\";\n this.nodes = [text];\n this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1];\n }\n nextInner(skip, dir) {\n this.done = this.lineBreak = false;\n for (;;) {\n let last = this.nodes.length - 1;\n let top = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1;\n let size = top instanceof TextLeaf ? top.text.length : top.children.length;\n if (offset == (dir > 0 ? size : 0)) {\n if (last == 0) {\n this.done = true;\n this.value = \"\";\n return this;\n }\n if (dir > 0)\n this.offsets[last - 1]++;\n this.nodes.pop();\n this.offsets.pop();\n }\n else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) {\n this.offsets[last] += dir;\n if (skip == 0) {\n this.lineBreak = true;\n this.value = \"\\n\";\n return this;\n }\n skip--;\n }\n else if (top instanceof TextLeaf) {\n // Move to the next string\n let next = top.text[offset + (dir < 0 ? -1 : 0)];\n this.offsets[last] += dir;\n if (next.length > Math.max(0, skip)) {\n this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip);\n return this;\n }\n skip -= next.length;\n }\n else {\n let next = top.children[offset + (dir < 0 ? -1 : 0)];\n if (skip > next.length) {\n skip -= next.length;\n this.offsets[last] += dir;\n }\n else {\n if (dir < 0)\n this.offsets[last]--;\n this.nodes.push(next);\n this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1);\n }\n }\n }\n }\n next(skip = 0) {\n if (skip < 0) {\n this.nextInner(-skip, (-this.dir));\n skip = this.value.length;\n }\n return this.nextInner(skip, this.dir);\n }\n}\nclass PartialTextCursor {\n constructor(text, start, end) {\n this.value = \"\";\n this.done = false;\n this.cursor = new RawTextCursor(text, start > end ? -1 : 1);\n this.pos = start > end ? text.length : 0;\n this.from = Math.min(start, end);\n this.to = Math.max(start, end);\n }\n nextInner(skip, dir) {\n if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) {\n this.value = \"\";\n this.done = true;\n return this;\n }\n skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos);\n let limit = dir < 0 ? this.pos - this.from : this.to - this.pos;\n if (skip > limit)\n skip = limit;\n limit -= skip;\n let { value } = this.cursor.next(skip);\n this.pos += (value.length + skip) * dir;\n this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit);\n this.done = !this.value;\n return this;\n }\n next(skip = 0) {\n if (skip < 0)\n skip = Math.max(skip, this.from - this.pos);\n else if (skip > 0)\n skip = Math.min(skip, this.to - this.pos);\n return this.nextInner(skip, this.cursor.dir);\n }\n get lineBreak() { return this.cursor.lineBreak && this.value != \"\"; }\n}\nclass LineCursor {\n constructor(inner) {\n this.inner = inner;\n this.afterBreak = true;\n this.value = \"\";\n this.done = false;\n }\n next(skip = 0) {\n let { done, lineBreak, value } = this.inner.next(skip);\n if (done) {\n this.done = true;\n this.value = \"\";\n }\n else if (lineBreak) {\n if (this.afterBreak) {\n this.value = \"\";\n }\n else {\n this.afterBreak = true;\n this.next();\n }\n }\n else {\n this.value = value;\n this.afterBreak = false;\n }\n return this;\n }\n get lineBreak() { return false; }\n}\nif (typeof Symbol != \"undefined\") {\n Text.prototype[Symbol.iterator] = function () { return this.iter(); };\n RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] =\n LineCursor.prototype[Symbol.iterator] = function () { return this; };\n}\n/**\nThis type describes a line in the document. It is created\non-demand when lines are [queried](https://codemirror.net/6/docs/ref/#state.Text.lineAt).\n*/\nclass Line {\n /**\n @internal\n */\n constructor(\n /**\n The position of the start of the line.\n */\n from, \n /**\n The position at the end of the line (_before_ the line break,\n or at the end of document for the last line).\n */\n to, \n /**\n This line's line number (1-based).\n */\n number, \n /**\n The line's content.\n */\n text) {\n this.from = from;\n this.to = to;\n this.number = number;\n this.text = text;\n }\n /**\n The length of the line (not including any line break after it).\n */\n get length() { return this.to - this.from; }\n}\n\n// Compressed representation of the Grapheme_Cluster_Break=Extend\n// information from\n// http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n// Each pair of elements represents a range, as an offet from the\n// previous range and a length. Numbers are in base-36, with the empty\n// string being a shorthand for 1.\nlet extend = /*@__PURE__*/\"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o\".split(\",\").map(s => s ? parseInt(s, 36) : 1);\n// Convert offsets into absolute values\nfor (let i = 1; i < extend.length; i++)\n extend[i] += extend[i - 1];\nfunction isExtendingChar(code) {\n for (let i = 1; i < extend.length; i += 2)\n if (extend[i] > code)\n return extend[i - 1] <= code;\n return false;\n}\nfunction isRegionalIndicator(code) {\n return code >= 0x1F1E6 && code <= 0x1F1FF;\n}\nconst ZWJ = 0x200d;\n/**\nReturns a next grapheme cluster break _after_ (not equal to)\n`pos`, if `forward` is true, or before otherwise. Returns `pos`\nitself if no further cluster break is available in the string.\nMoves across surrogate pairs, extending characters (when\n`includeExtending` is true), characters joined with zero-width\njoiners, and flag emoji.\n*/\nfunction findClusterBreak(str, pos, forward = true, includeExtending = true) {\n return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);\n}\nfunction nextClusterBreak(str, pos, includeExtending) {\n if (pos == str.length)\n return pos;\n // If pos is in the middle of a surrogate pair, move to its start\n if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1)))\n pos--;\n let prev = codePointAt(str, pos);\n pos += codePointSize(prev);\n while (pos < str.length) {\n let next = codePointAt(str, pos);\n if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n pos += codePointSize(next);\n prev = next;\n }\n else if (isRegionalIndicator(next)) {\n let countBefore = 0, i = pos - 2;\n while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) {\n countBefore++;\n i -= 2;\n }\n if (countBefore % 2 == 0)\n break;\n else\n pos += 2;\n }\n else {\n break;\n }\n }\n return pos;\n}\nfunction prevClusterBreak(str, pos, includeExtending) {\n while (pos > 0) {\n let found = nextClusterBreak(str, pos - 2, includeExtending);\n if (found < pos)\n return found;\n pos--;\n }\n return 0;\n}\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; }\n/**\nFind the code point at the given position in a string (like the\n[`codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt)\nstring method).\n*/\nfunction codePointAt(str, pos) {\n let code0 = str.charCodeAt(pos);\n if (!surrogateHigh(code0) || pos + 1 == str.length)\n return code0;\n let code1 = str.charCodeAt(pos + 1);\n if (!surrogateLow(code1))\n return code0;\n return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000;\n}\n/**\nGiven a Unicode codepoint, return the JavaScript string that\nrespresents it (like\n[`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint)).\n*/\nfunction fromCodePoint(code) {\n if (code <= 0xffff)\n return String.fromCharCode(code);\n code -= 0x10000;\n return String.fromCharCode((code >> 10) + 0xd800, (code & 1023) + 0xdc00);\n}\n/**\nThe amount of positions a character takes up a JavaScript string.\n*/\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2; }\n\nconst DefaultSplit = /\\r\\n?|\\n/;\n/**\nDistinguishes different ways in which positions can be mapped.\n*/\nvar MapMode = /*@__PURE__*/(function (MapMode) {\n /**\n Map a position to a valid new position, even when its context\n was deleted.\n */\n MapMode[MapMode[\"Simple\"] = 0] = \"Simple\";\n /**\n Return null if deletion happens across the position.\n */\n MapMode[MapMode[\"TrackDel\"] = 1] = \"TrackDel\";\n /**\n Return null if the character _before_ the position is deleted.\n */\n MapMode[MapMode[\"TrackBefore\"] = 2] = \"TrackBefore\";\n /**\n Return null if the character _after_ the position is deleted.\n */\n MapMode[MapMode[\"TrackAfter\"] = 3] = \"TrackAfter\";\nreturn MapMode})(MapMode || (MapMode = {}));\n/**\nA change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet)\nthat doesn't store the inserted text. As such, it can't be\napplied, but is cheaper to store and manipulate.\n*/\nclass ChangeDesc {\n // Sections are encoded as pairs of integers. The first is the\n // length in the current document, and the second is -1 for\n // unaffected sections, and the length of the replacement content\n // otherwise. So an insertion would be (0, n>0), a deletion (n>0,\n // 0), and a replacement two positive numbers.\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n sections) {\n this.sections = sections;\n }\n /**\n The length of the document before the change.\n */\n get length() {\n let result = 0;\n for (let i = 0; i < this.sections.length; i += 2)\n result += this.sections[i];\n return result;\n }\n /**\n The length of the document after the change.\n */\n get newLength() {\n let result = 0;\n for (let i = 0; i < this.sections.length; i += 2) {\n let ins = this.sections[i + 1];\n result += ins < 0 ? this.sections[i] : ins;\n }\n return result;\n }\n /**\n False when there are actual changes in this set.\n */\n get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; }\n /**\n Iterate over the unchanged parts left by these changes. `posA`\n provides the position of the range in the old document, `posB`\n the new position in the changed document.\n */\n iterGaps(f) {\n for (let i = 0, posA = 0, posB = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n if (ins < 0) {\n f(posA, posB, len);\n posB += len;\n }\n else {\n posB += ins;\n }\n posA += len;\n }\n }\n /**\n Iterate over the ranges changed by these changes. (See\n [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a\n variant that also provides you with the inserted text.)\n `fromA`/`toA` provides the extent of the change in the starting\n document, `fromB`/`toB` the extent of the replacement in the\n changed document.\n \n When `individual` is true, adjacent changes (which are kept\n separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are\n reported separately.\n */\n iterChangedRanges(f, individual = false) {\n iterChanges(this, f, individual);\n }\n /**\n Get a description of the inverted form of these changes.\n */\n get invertedDesc() {\n let sections = [];\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n if (ins < 0)\n sections.push(len, ins);\n else\n sections.push(ins, len);\n }\n return new ChangeDesc(sections);\n }\n /**\n Compute the combined effect of applying another set of changes\n after this one. The length of the document after this set should\n match the length before `other`.\n */\n composeDesc(other) { return this.empty ? other : other.empty ? this : composeSets(this, other); }\n /**\n Map this description, which should start with the same document\n as `other`, over another set of changes, so that it can be\n applied after it. When `before` is true, map as if the changes\n in `other` happened before the ones in `this`.\n */\n mapDesc(other, before = false) { return other.empty ? this : mapSet(this, other, before); }\n mapPos(pos, assoc = -1, mode = MapMode.Simple) {\n let posA = 0, posB = 0;\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++], endA = posA + len;\n if (ins < 0) {\n if (endA > pos)\n return posB + (pos - posA);\n posB += len;\n }\n else {\n if (mode != MapMode.Simple && endA >= pos &&\n (mode == MapMode.TrackDel && posA < pos && endA > pos ||\n mode == MapMode.TrackBefore && posA < pos ||\n mode == MapMode.TrackAfter && endA > pos))\n return null;\n if (endA > pos || endA == pos && assoc < 0 && !len)\n return pos == posA || assoc < 0 ? posB : posB + ins;\n posB += ins;\n }\n posA = endA;\n }\n if (pos > posA)\n throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`);\n return posB;\n }\n /**\n Check whether these changes touch a given range. When one of the\n changes entirely covers the range, the string `\"cover\"` is\n returned.\n */\n touchesRange(from, to = from) {\n for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) {\n let len = this.sections[i++], ins = this.sections[i++], end = pos + len;\n if (ins >= 0 && pos <= to && end >= from)\n return pos < from && end > to ? \"cover\" : true;\n pos = end;\n }\n return false;\n }\n /**\n @internal\n */\n toString() {\n let result = \"\";\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n result += (result ? \" \" : \"\") + len + (ins >= 0 ? \":\" + ins : \"\");\n }\n return result;\n }\n /**\n Serialize this change desc to a JSON-representable value.\n */\n toJSON() { return this.sections; }\n /**\n Create a change desc from its JSON representation (as produced\n by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON).\n */\n static fromJSON(json) {\n if (!Array.isArray(json) || json.length % 2 || json.some(a => typeof a != \"number\"))\n throw new RangeError(\"Invalid JSON representation of ChangeDesc\");\n return new ChangeDesc(json);\n }\n /**\n @internal\n */\n static create(sections) { return new ChangeDesc(sections); }\n}\n/**\nA change set represents a group of modifications to a document. It\nstores the document length, and can only be applied to documents\nwith exactly that length.\n*/\nclass ChangeSet extends ChangeDesc {\n constructor(sections, \n /**\n @internal\n */\n inserted) {\n super(sections);\n this.inserted = inserted;\n }\n /**\n Apply the changes to a document, returning the modified\n document.\n */\n apply(doc) {\n if (this.length != doc.length)\n throw new RangeError(\"Applying change set to a document with the wrong length\");\n iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n return doc;\n }\n mapDesc(other, before = false) { return mapSet(this, other, before, true); }\n /**\n Given the document as it existed _before_ the changes, return a\n change set that represents the inverse of this set, which could\n be used to go from the document created by the changes back to\n the document as it existed before the changes.\n */\n invert(doc) {\n let sections = this.sections.slice(), inserted = [];\n for (let i = 0, pos = 0; i < sections.length; i += 2) {\n let len = sections[i], ins = sections[i + 1];\n if (ins >= 0) {\n sections[i] = ins;\n sections[i + 1] = len;\n let index = i >> 1;\n while (inserted.length < index)\n inserted.push(Text.empty);\n inserted.push(len ? doc.slice(pos, pos + len) : Text.empty);\n }\n pos += len;\n }\n return new ChangeSet(sections, inserted);\n }\n /**\n Combine two subsequent change sets into a single set. `other`\n must start in the document produced by `this`. If `this` goes\n `docA` → `docB` and `other` represents `docB` → `docC`, the\n returned value will represent the change `docA` → `docC`.\n */\n compose(other) { return this.empty ? other : other.empty ? this : composeSets(this, other, true); }\n /**\n Given another change set starting in the same document, maps this\n change set over the other, producing a new change set that can be\n applied to the document produced by applying `other`. When\n `before` is `true`, order changes as if `this` comes before\n `other`, otherwise (the default) treat `other` as coming first.\n \n Given two changes `A` and `B`, `A.compose(B.map(A))` and\n `B.compose(A.map(B, true))` will produce the same document. This\n provides a basic form of [operational\n transformation](https://en.wikipedia.org/wiki/Operational_transformation),\n and can be used for collaborative editing.\n */\n map(other, before = false) { return other.empty ? this : mapSet(this, other, before, true); }\n /**\n Iterate over the changed ranges in the document, calling `f` for\n each, with the range in the original document (`fromA`-`toA`)\n and the range that replaces it in the new document\n (`fromB`-`toB`).\n \n When `individual` is true, adjacent changes are reported\n separately.\n */\n iterChanges(f, individual = false) {\n iterChanges(this, f, individual);\n }\n /**\n Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change\n set.\n */\n get desc() { return ChangeDesc.create(this.sections); }\n /**\n @internal\n */\n filter(ranges) {\n let resultSections = [], resultInserted = [], filteredSections = [];\n let iter = new SectionIter(this);\n done: for (let i = 0, pos = 0;;) {\n let next = i == ranges.length ? 1e9 : ranges[i++];\n while (pos < next || pos == next && iter.len == 0) {\n if (iter.done)\n break done;\n let len = Math.min(iter.len, next - pos);\n addSection(filteredSections, len, -1);\n let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0;\n addSection(resultSections, len, ins);\n if (ins > 0)\n addInsert(resultInserted, resultSections, iter.text);\n iter.forward(len);\n pos += len;\n }\n let end = ranges[i++];\n while (pos < end) {\n if (iter.done)\n break done;\n let len = Math.min(iter.len, end - pos);\n addSection(resultSections, len, -1);\n addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0);\n iter.forward(len);\n pos += len;\n }\n }\n return { changes: new ChangeSet(resultSections, resultInserted),\n filtered: ChangeDesc.create(filteredSections) };\n }\n /**\n Serialize this change set to a JSON-representable value.\n */\n toJSON() {\n let parts = [];\n for (let i = 0; i < this.sections.length; i += 2) {\n let len = this.sections[i], ins = this.sections[i + 1];\n if (ins < 0)\n parts.push(len);\n else if (ins == 0)\n parts.push([len]);\n else\n parts.push([len].concat(this.inserted[i >> 1].toJSON()));\n }\n return parts;\n }\n /**\n Create a change set for the given changes, for a document of the\n given length, using `lineSep` as line separator.\n */\n static of(changes, length, lineSep) {\n let sections = [], inserted = [], pos = 0;\n let total = null;\n function flush(force = false) {\n if (!force && !sections.length)\n return;\n if (pos < length)\n addSection(sections, length - pos, -1);\n let set = new ChangeSet(sections, inserted);\n total = total ? total.compose(set.map(total)) : set;\n sections = [];\n inserted = [];\n pos = 0;\n }\n function process(spec) {\n if (Array.isArray(spec)) {\n for (let sub of spec)\n process(sub);\n }\n else if (spec instanceof ChangeSet) {\n if (spec.length != length)\n throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`);\n flush();\n total = total ? total.compose(spec.map(total)) : spec;\n }\n else {\n let { from, to = from, insert } = spec;\n if (from > to || from < 0 || to > length)\n throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);\n let insText = !insert ? Text.empty : typeof insert == \"string\" ? Text.of(insert.split(lineSep || DefaultSplit)) : insert;\n let insLen = insText.length;\n if (from == to && insLen == 0)\n return;\n if (from < pos)\n flush();\n if (from > pos)\n addSection(sections, from - pos, -1);\n addSection(sections, to - from, insLen);\n addInsert(inserted, sections, insText);\n pos = to;\n }\n }\n process(changes);\n flush(!total);\n return total;\n }\n /**\n Create an empty changeset of the given length.\n */\n static empty(length) {\n return new ChangeSet(length ? [length, -1] : [], []);\n }\n /**\n Create a changeset from its JSON representation (as produced by\n [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON).\n */\n static fromJSON(json) {\n if (!Array.isArray(json))\n throw new RangeError(\"Invalid JSON representation of ChangeSet\");\n let sections = [], inserted = [];\n for (let i = 0; i < json.length; i++) {\n let part = json[i];\n if (typeof part == \"number\") {\n sections.push(part, -1);\n }\n else if (!Array.isArray(part) || typeof part[0] != \"number\" || part.some((e, i) => i && typeof e != \"string\")) {\n throw new RangeError(\"Invalid JSON representation of ChangeSet\");\n }\n else if (part.length == 1) {\n sections.push(part[0], 0);\n }\n else {\n while (inserted.length < i)\n inserted.push(Text.empty);\n inserted[i] = Text.of(part.slice(1));\n sections.push(part[0], inserted[i].length);\n }\n }\n return new ChangeSet(sections, inserted);\n }\n /**\n @internal\n */\n static createSet(sections, inserted) {\n return new ChangeSet(sections, inserted);\n }\n}\nfunction addSection(sections, len, ins, forceJoin = false) {\n if (len == 0 && ins <= 0)\n return;\n let last = sections.length - 2;\n if (last >= 0 && ins <= 0 && ins == sections[last + 1])\n sections[last] += len;\n else if (len == 0 && sections[last] == 0)\n sections[last + 1] += ins;\n else if (forceJoin) {\n sections[last] += len;\n sections[last + 1] += ins;\n }\n else\n sections.push(len, ins);\n}\nfunction addInsert(values, sections, value) {\n if (value.length == 0)\n return;\n let index = (sections.length - 2) >> 1;\n if (index < values.length) {\n values[values.length - 1] = values[values.length - 1].append(value);\n }\n else {\n while (values.length < index)\n values.push(Text.empty);\n values.push(value);\n }\n}\nfunction iterChanges(desc, f, individual) {\n let inserted = desc.inserted;\n for (let posA = 0, posB = 0, i = 0; i < desc.sections.length;) {\n let len = desc.sections[i++], ins = desc.sections[i++];\n if (ins < 0) {\n posA += len;\n posB += len;\n }\n else {\n let endA = posA, endB = posB, text = Text.empty;\n for (;;) {\n endA += len;\n endB += ins;\n if (ins && inserted)\n text = text.append(inserted[(i - 2) >> 1]);\n if (individual || i == desc.sections.length || desc.sections[i + 1] < 0)\n break;\n len = desc.sections[i++];\n ins = desc.sections[i++];\n }\n f(posA, endA, posB, endB, text);\n posA = endA;\n posB = endB;\n }\n }\n}\nfunction mapSet(setA, setB, before, mkSet = false) {\n // Produce a copy of setA that applies to the document after setB\n // has been applied (assuming both start at the same document).\n let sections = [], insert = mkSet ? [] : null;\n let a = new SectionIter(setA), b = new SectionIter(setB);\n // Iterate over both sets in parallel. inserted tracks, for changes\n // in A that have to be processed piece-by-piece, whether their\n // content has been inserted already, and refers to the section\n // index.\n for (let inserted = -1;;) {\n if (a.ins == -1 && b.ins == -1) {\n // Move across ranges skipped by both sets.\n let len = Math.min(a.len, b.len);\n addSection(sections, len, -1);\n a.forward(len);\n b.forward(len);\n }\n else if (b.ins >= 0 && (a.ins < 0 || inserted == a.i || a.off == 0 && (b.len < a.len || b.len == a.len && !before))) {\n // If there's a change in B that comes before the next change in\n // A (ordered by start pos, then len, then before flag), skip\n // that (and process any changes in A it covers).\n let len = b.len;\n addSection(sections, b.ins, -1);\n while (len) {\n let piece = Math.min(a.len, len);\n if (a.ins >= 0 && inserted < a.i && a.len <= piece) {\n addSection(sections, 0, a.ins);\n if (insert)\n addInsert(insert, sections, a.text);\n inserted = a.i;\n }\n a.forward(piece);\n len -= piece;\n }\n b.next();\n }\n else if (a.ins >= 0) {\n // Process the part of a change in A up to the start of the next\n // non-deletion change in B (if overlapping).\n let len = 0, left = a.len;\n while (left) {\n if (b.ins == -1) {\n let piece = Math.min(left, b.len);\n len += piece;\n left -= piece;\n b.forward(piece);\n }\n else if (b.ins == 0 && b.len < left) {\n left -= b.len;\n b.next();\n }\n else {\n break;\n }\n }\n addSection(sections, len, inserted < a.i ? a.ins : 0);\n if (insert && inserted < a.i)\n addInsert(insert, sections, a.text);\n inserted = a.i;\n a.forward(a.len - left);\n }\n else if (a.done && b.done) {\n return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n }\n else {\n throw new Error(\"Mismatched change set lengths\");\n }\n }\n}\nfunction composeSets(setA, setB, mkSet = false) {\n let sections = [];\n let insert = mkSet ? [] : null;\n let a = new SectionIter(setA), b = new SectionIter(setB);\n for (let open = false;;) {\n if (a.done && b.done) {\n return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n }\n else if (a.ins == 0) { // Deletion in A\n addSection(sections, a.len, 0, open);\n a.next();\n }\n else if (b.len == 0 && !b.done) { // Insertion in B\n addSection(sections, 0, b.ins, open);\n if (insert)\n addInsert(insert, sections, b.text);\n b.next();\n }\n else if (a.done || b.done) {\n throw new Error(\"Mismatched change set lengths\");\n }\n else {\n let len = Math.min(a.len2, b.len), sectionLen = sections.length;\n if (a.ins == -1) {\n let insB = b.ins == -1 ? -1 : b.off ? 0 : b.ins;\n addSection(sections, len, insB, open);\n if (insert && insB)\n addInsert(insert, sections, b.text);\n }\n else if (b.ins == -1) {\n addSection(sections, a.off ? 0 : a.len, len, open);\n if (insert)\n addInsert(insert, sections, a.textBit(len));\n }\n else {\n addSection(sections, a.off ? 0 : a.len, b.off ? 0 : b.ins, open);\n if (insert && !b.off)\n addInsert(insert, sections, b.text);\n }\n open = (a.ins > len || b.ins >= 0 && b.len > len) && (open || sections.length > sectionLen);\n a.forward2(len);\n b.forward(len);\n }\n }\n}\nclass SectionIter {\n constructor(set) {\n this.set = set;\n this.i = 0;\n this.next();\n }\n next() {\n let { sections } = this.set;\n if (this.i < sections.length) {\n this.len = sections[this.i++];\n this.ins = sections[this.i++];\n }\n else {\n this.len = 0;\n this.ins = -2;\n }\n this.off = 0;\n }\n get done() { return this.ins == -2; }\n get len2() { return this.ins < 0 ? this.len : this.ins; }\n get text() {\n let { inserted } = this.set, index = (this.i - 2) >> 1;\n return index >= inserted.length ? Text.empty : inserted[index];\n }\n textBit(len) {\n let { inserted } = this.set, index = (this.i - 2) >> 1;\n return index >= inserted.length && !len ? Text.empty\n : inserted[index].slice(this.off, len == null ? undefined : this.off + len);\n }\n forward(len) {\n if (len == this.len)\n this.next();\n else {\n this.len -= len;\n this.off += len;\n }\n }\n forward2(len) {\n if (this.ins == -1)\n this.forward(len);\n else if (len == this.ins)\n this.next();\n else {\n this.ins -= len;\n this.off += len;\n }\n }\n}\n\n/**\nA single selection range. When\n[`allowMultipleSelections`](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)\nis enabled, a [selection](https://codemirror.net/6/docs/ref/#state.EditorSelection) may hold\nmultiple ranges. By default, selections hold exactly one range.\n*/\nclass SelectionRange {\n constructor(\n /**\n The lower boundary of the range.\n */\n from, \n /**\n The upper boundary of the range.\n */\n to, flags) {\n this.from = from;\n this.to = to;\n this.flags = flags;\n }\n /**\n The anchor of the range—the side that doesn't move when you\n extend it.\n */\n get anchor() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.to : this.from; }\n /**\n The head of the range, which is moved when the range is\n [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend).\n */\n get head() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.from : this.to; }\n /**\n True when `anchor` and `head` are at the same position.\n */\n get empty() { return this.from == this.to; }\n /**\n If this is a cursor that is explicitly associated with the\n character on one of its sides, this returns the side. -1 means\n the character before its position, 1 the character after, and 0\n means no association.\n */\n get assoc() { return this.flags & 4 /* RangeFlag.AssocBefore */ ? -1 : this.flags & 8 /* RangeFlag.AssocAfter */ ? 1 : 0; }\n /**\n The bidirectional text level associated with this cursor, if\n any.\n */\n get bidiLevel() {\n let level = this.flags & 3 /* RangeFlag.BidiLevelMask */;\n return level == 3 ? null : level;\n }\n /**\n The goal column (stored vertical offset) associated with a\n cursor. This is used to preserve the vertical position when\n [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across\n lines of different length.\n */\n get goalColumn() {\n let value = this.flags >> 5 /* RangeFlag.GoalColumnOffset */;\n return value == 33554431 /* RangeFlag.NoGoalColumn */ ? undefined : value;\n }\n /**\n Map this range through a change, producing a valid range in the\n updated document.\n */\n map(change, assoc = -1) {\n let from, to;\n if (this.empty) {\n from = to = change.mapPos(this.from, assoc);\n }\n else {\n from = change.mapPos(this.from, 1);\n to = change.mapPos(this.to, -1);\n }\n return from == this.from && to == this.to ? this : new SelectionRange(from, to, this.flags);\n }\n /**\n Extend this range to cover at least `from` to `to`.\n */\n extend(from, to = from) {\n if (from <= this.anchor && to >= this.anchor)\n return EditorSelection.range(from, to);\n let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;\n return EditorSelection.range(this.anchor, head);\n }\n /**\n Compare this range to another range.\n */\n eq(other) {\n return this.anchor == other.anchor && this.head == other.head;\n }\n /**\n Return a JSON-serializable object representing the range.\n */\n toJSON() { return { anchor: this.anchor, head: this.head }; }\n /**\n Convert a JSON representation of a range to a `SelectionRange`\n instance.\n */\n static fromJSON(json) {\n if (!json || typeof json.anchor != \"number\" || typeof json.head != \"number\")\n throw new RangeError(\"Invalid JSON representation for SelectionRange\");\n return EditorSelection.range(json.anchor, json.head);\n }\n /**\n @internal\n */\n static create(from, to, flags) {\n return new SelectionRange(from, to, flags);\n }\n}\n/**\nAn editor selection holds one or more selection ranges.\n*/\nclass EditorSelection {\n constructor(\n /**\n The ranges in the selection, sorted by position. Ranges cannot\n overlap (but they may touch, if they aren't empty).\n */\n ranges, \n /**\n The index of the _main_ range in the selection (which is\n usually the range that was added last).\n */\n mainIndex) {\n this.ranges = ranges;\n this.mainIndex = mainIndex;\n }\n /**\n Map a selection through a change. Used to adjust the selection\n position for changes.\n */\n map(change, assoc = -1) {\n if (change.empty)\n return this;\n return EditorSelection.create(this.ranges.map(r => r.map(change, assoc)), this.mainIndex);\n }\n /**\n Compare this selection to another selection.\n */\n eq(other) {\n if (this.ranges.length != other.ranges.length ||\n this.mainIndex != other.mainIndex)\n return false;\n for (let i = 0; i < this.ranges.length; i++)\n if (!this.ranges[i].eq(other.ranges[i]))\n return false;\n return true;\n }\n /**\n Get the primary selection range. Usually, you should make sure\n your code applies to _all_ ranges, by using methods like\n [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange).\n */\n get main() { return this.ranges[this.mainIndex]; }\n /**\n Make sure the selection only has one range. Returns a selection\n holding only the main range from this selection.\n */\n asSingle() {\n return this.ranges.length == 1 ? this : new EditorSelection([this.main], 0);\n }\n /**\n Extend this selection with an extra range.\n */\n addRange(range, main = true) {\n return EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1);\n }\n /**\n Replace a given range with another range, and then normalize the\n selection to merge and sort ranges if necessary.\n */\n replaceRange(range, which = this.mainIndex) {\n let ranges = this.ranges.slice();\n ranges[which] = range;\n return EditorSelection.create(ranges, this.mainIndex);\n }\n /**\n Convert this selection to an object that can be serialized to\n JSON.\n */\n toJSON() {\n return { ranges: this.ranges.map(r => r.toJSON()), main: this.mainIndex };\n }\n /**\n Create a selection from a JSON representation.\n */\n static fromJSON(json) {\n if (!json || !Array.isArray(json.ranges) || typeof json.main != \"number\" || json.main >= json.ranges.length)\n throw new RangeError(\"Invalid JSON representation for EditorSelection\");\n return new EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main);\n }\n /**\n Create a selection holding a single range.\n */\n static single(anchor, head = anchor) {\n return new EditorSelection([EditorSelection.range(anchor, head)], 0);\n }\n /**\n Sort and merge the given set of ranges, creating a valid\n selection.\n */\n static create(ranges, mainIndex = 0) {\n if (ranges.length == 0)\n throw new RangeError(\"A selection needs at least one range\");\n for (let pos = 0, i = 0; i < ranges.length; i++) {\n let range = ranges[i];\n if (range.empty ? range.from <= pos : range.from < pos)\n return EditorSelection.normalized(ranges.slice(), mainIndex);\n pos = range.to;\n }\n return new EditorSelection(ranges, mainIndex);\n }\n /**\n Create a cursor selection range at the given position. You can\n safely ignore the optional arguments in most situations.\n */\n static cursor(pos, assoc = 0, bidiLevel, goalColumn) {\n return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 4 /* RangeFlag.AssocBefore */ : 8 /* RangeFlag.AssocAfter */) |\n (bidiLevel == null ? 3 : Math.min(2, bidiLevel)) |\n ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */));\n }\n /**\n Create a selection range.\n */\n static range(anchor, head, goalColumn, bidiLevel) {\n let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |\n (bidiLevel == null ? 3 : Math.min(2, bidiLevel));\n return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)\n : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);\n }\n /**\n @internal\n */\n static normalized(ranges, mainIndex = 0) {\n let main = ranges[mainIndex];\n ranges.sort((a, b) => a.from - b.from);\n mainIndex = ranges.indexOf(main);\n for (let i = 1; i < ranges.length; i++) {\n let range = ranges[i], prev = ranges[i - 1];\n if (range.empty ? range.from <= prev.to : range.from < prev.to) {\n let from = prev.from, to = Math.max(range.to, prev.to);\n if (i <= mainIndex)\n mainIndex--;\n ranges.splice(--i, 2, range.anchor > range.head ? EditorSelection.range(to, from) : EditorSelection.range(from, to));\n }\n }\n return new EditorSelection(ranges, mainIndex);\n }\n}\nfunction checkSelection(selection, docLength) {\n for (let range of selection.ranges)\n if (range.to > docLength)\n throw new RangeError(\"Selection points outside of document\");\n}\n\nlet nextID = 0;\n/**\nA facet is a labeled value that is associated with an editor\nstate. It takes inputs from any number of extensions, and combines\nthose into a single output value.\n\nExamples of uses of facets are the [tab\nsize](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize), [editor\nattributes](https://codemirror.net/6/docs/ref/#view.EditorView^editorAttributes), and [update\nlisteners](https://codemirror.net/6/docs/ref/#view.EditorView^updateListener).\n*/\nclass Facet {\n constructor(\n /**\n @internal\n */\n combine, \n /**\n @internal\n */\n compareInput, \n /**\n @internal\n */\n compare, isStatic, enables) {\n this.combine = combine;\n this.compareInput = compareInput;\n this.compare = compare;\n this.isStatic = isStatic;\n /**\n @internal\n */\n this.id = nextID++;\n this.default = combine([]);\n this.extensions = typeof enables == \"function\" ? enables(this) : enables;\n }\n /**\n Define a new facet.\n */\n static define(config = {}) {\n return new Facet(config.combine || ((a) => a), config.compareInput || ((a, b) => a === b), config.compare || (!config.combine ? sameArray : (a, b) => a === b), !!config.static, config.enables);\n }\n /**\n Returns an extension that adds the given value to this facet.\n */\n of(value) {\n return new FacetProvider([], this, 0 /* Provider.Static */, value);\n }\n /**\n Create an extension that computes a value for the facet from a\n state. You must take care to declare the parts of the state that\n this value depends on, since your function is only called again\n for a new state when one of those parts changed.\n \n In cases where your value depends only on a single field, you'll\n want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead.\n */\n compute(deps, get) {\n if (this.isStatic)\n throw new Error(\"Can't compute a static facet\");\n return new FacetProvider(deps, this, 1 /* Provider.Single */, get);\n }\n /**\n Create an extension that computes zero or more values for this\n facet from a state.\n */\n computeN(deps, get) {\n if (this.isStatic)\n throw new Error(\"Can't compute a static facet\");\n return new FacetProvider(deps, this, 2 /* Provider.Multi */, get);\n }\n from(field, get) {\n if (!get)\n get = x => x;\n return this.compute([field], state => get(state.field(field)));\n }\n}\nfunction sameArray(a, b) {\n return a == b || a.length == b.length && a.every((e, i) => e === b[i]);\n}\nclass FacetProvider {\n constructor(dependencies, facet, type, value) {\n this.dependencies = dependencies;\n this.facet = facet;\n this.type = type;\n this.value = value;\n this.id = nextID++;\n }\n dynamicSlot(addresses) {\n var _a;\n let getter = this.value;\n let compare = this.facet.compareInput;\n let id = this.id, idx = addresses[id] >> 1, multi = this.type == 2 /* Provider.Multi */;\n let depDoc = false, depSel = false, depAddrs = [];\n for (let dep of this.dependencies) {\n if (dep == \"doc\")\n depDoc = true;\n else if (dep == \"selection\")\n depSel = true;\n else if ((((_a = addresses[dep.id]) !== null && _a !== void 0 ? _a : 1) & 1) == 0)\n depAddrs.push(addresses[dep.id]);\n }\n return {\n create(state) {\n state.values[idx] = getter(state);\n return 1 /* SlotStatus.Changed */;\n },\n update(state, tr) {\n if ((depDoc && tr.docChanged) || (depSel && (tr.docChanged || tr.selection)) || ensureAll(state, depAddrs)) {\n let newVal = getter(state);\n if (multi ? !compareArray(newVal, state.values[idx], compare) : !compare(newVal, state.values[idx])) {\n state.values[idx] = newVal;\n return 1 /* SlotStatus.Changed */;\n }\n }\n return 0;\n },\n reconfigure: (state, oldState) => {\n let newVal, oldAddr = oldState.config.address[id];\n if (oldAddr != null) {\n let oldVal = getAddr(oldState, oldAddr);\n if (this.dependencies.every(dep => {\n return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) :\n dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true;\n }) || (multi ? compareArray(newVal = getter(state), oldVal, compare) : compare(newVal = getter(state), oldVal))) {\n state.values[idx] = oldVal;\n return 0;\n }\n }\n else {\n newVal = getter(state);\n }\n state.values[idx] = newVal;\n return 1 /* SlotStatus.Changed */;\n }\n };\n }\n}\nfunction compareArray(a, b, compare) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!compare(a[i], b[i]))\n return false;\n return true;\n}\nfunction ensureAll(state, addrs) {\n let changed = false;\n for (let addr of addrs)\n if (ensureAddr(state, addr) & 1 /* SlotStatus.Changed */)\n changed = true;\n return changed;\n}\nfunction dynamicFacetSlot(addresses, facet, providers) {\n let providerAddrs = providers.map(p => addresses[p.id]);\n let providerTypes = providers.map(p => p.type);\n let dynamic = providerAddrs.filter(p => !(p & 1));\n let idx = addresses[facet.id] >> 1;\n function get(state) {\n let values = [];\n for (let i = 0; i < providerAddrs.length; i++) {\n let value = getAddr(state, providerAddrs[i]);\n if (providerTypes[i] == 2 /* Provider.Multi */)\n for (let val of value)\n values.push(val);\n else\n values.push(value);\n }\n return facet.combine(values);\n }\n return {\n create(state) {\n for (let addr of providerAddrs)\n ensureAddr(state, addr);\n state.values[idx] = get(state);\n return 1 /* SlotStatus.Changed */;\n },\n update(state, tr) {\n if (!ensureAll(state, dynamic))\n return 0;\n let value = get(state);\n if (facet.compare(value, state.values[idx]))\n return 0;\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n },\n reconfigure(state, oldState) {\n let depChanged = ensureAll(state, providerAddrs);\n let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet);\n if (oldProviders && !depChanged && sameArray(providers, oldProviders)) {\n state.values[idx] = oldValue;\n return 0;\n }\n let value = get(state);\n if (facet.compare(value, oldValue)) {\n state.values[idx] = oldValue;\n return 0;\n }\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n }\n };\n}\nconst initField = /*@__PURE__*/Facet.define({ static: true });\n/**\nFields can store additional information in an editor state, and\nkeep it in sync with the rest of the state.\n*/\nclass StateField {\n constructor(\n /**\n @internal\n */\n id, createF, updateF, compareF, \n /**\n @internal\n */\n spec) {\n this.id = id;\n this.createF = createF;\n this.updateF = updateF;\n this.compareF = compareF;\n this.spec = spec;\n /**\n @internal\n */\n this.provides = undefined;\n }\n /**\n Define a state field.\n */\n static define(config) {\n let field = new StateField(nextID++, config.create, config.update, config.compare || ((a, b) => a === b), config);\n if (config.provide)\n field.provides = config.provide(field);\n return field;\n }\n create(state) {\n let init = state.facet(initField).find(i => i.field == this);\n return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state);\n }\n /**\n @internal\n */\n slot(addresses) {\n let idx = addresses[this.id] >> 1;\n return {\n create: (state) => {\n state.values[idx] = this.create(state);\n return 1 /* SlotStatus.Changed */;\n },\n update: (state, tr) => {\n let oldVal = state.values[idx];\n let value = this.updateF(oldVal, tr);\n if (this.compareF(oldVal, value))\n return 0;\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n },\n reconfigure: (state, oldState) => {\n if (oldState.config.address[this.id] != null) {\n state.values[idx] = oldState.field(this);\n return 0;\n }\n state.values[idx] = this.create(state);\n return 1 /* SlotStatus.Changed */;\n }\n };\n }\n /**\n Returns an extension that enables this field and overrides the\n way it is initialized. Can be useful when you need to provide a\n non-default starting value for the field.\n */\n init(create) {\n return [this, initField.of({ field: this, create })];\n }\n /**\n State field instances can be used as\n [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a\n given state.\n */\n get extension() { return this; }\n}\nconst Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 };\nfunction prec(value) {\n return (ext) => new PrecExtension(ext, value);\n}\n/**\nBy default extensions are registered in the order they are found\nin the flattened form of nested array that was provided.\nIndividual extension values can be assigned a precedence to\noverride this. Extensions that do not have a precedence set get\nthe precedence of the nearest parent with a precedence, or\n[`default`](https://codemirror.net/6/docs/ref/#state.Prec.default) if there is no such parent. The\nfinal ordering of extensions is determined by first sorting by\nprecedence and then by order within each precedence.\n*/\nconst Prec = {\n /**\n The highest precedence level, for extensions that should end up\n near the start of the precedence ordering.\n */\n highest: /*@__PURE__*/prec(Prec_.highest),\n /**\n A higher-than-default precedence, for extensions that should\n come before those with default precedence.\n */\n high: /*@__PURE__*/prec(Prec_.high),\n /**\n The default precedence, which is also used for extensions\n without an explicit precedence.\n */\n default: /*@__PURE__*/prec(Prec_.default),\n /**\n A lower-than-default precedence.\n */\n low: /*@__PURE__*/prec(Prec_.low),\n /**\n The lowest precedence level. Meant for things that should end up\n near the end of the extension order.\n */\n lowest: /*@__PURE__*/prec(Prec_.lowest)\n};\nclass PrecExtension {\n constructor(inner, prec) {\n this.inner = inner;\n this.prec = prec;\n }\n}\n/**\nExtension compartments can be used to make a configuration\ndynamic. By [wrapping](https://codemirror.net/6/docs/ref/#state.Compartment.of) part of your\nconfiguration in a compartment, you can later\n[replace](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) that part through a\ntransaction.\n*/\nclass Compartment {\n /**\n Create an instance of this compartment to add to your [state\n configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions).\n */\n of(ext) { return new CompartmentInstance(this, ext); }\n /**\n Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that\n reconfigures this compartment.\n */\n reconfigure(content) {\n return Compartment.reconfigure.of({ compartment: this, extension: content });\n }\n /**\n Get the current content of the compartment in the state, or\n `undefined` if it isn't present.\n */\n get(state) {\n return state.config.compartments.get(this);\n }\n}\nclass CompartmentInstance {\n constructor(compartment, inner) {\n this.compartment = compartment;\n this.inner = inner;\n }\n}\nclass Configuration {\n constructor(base, compartments, dynamicSlots, address, staticValues, facets) {\n this.base = base;\n this.compartments = compartments;\n this.dynamicSlots = dynamicSlots;\n this.address = address;\n this.staticValues = staticValues;\n this.facets = facets;\n this.statusTemplate = [];\n while (this.statusTemplate.length < dynamicSlots.length)\n this.statusTemplate.push(0 /* SlotStatus.Unresolved */);\n }\n staticFacet(facet) {\n let addr = this.address[facet.id];\n return addr == null ? facet.default : this.staticValues[addr >> 1];\n }\n static resolve(base, compartments, oldState) {\n let fields = [];\n let facets = Object.create(null);\n let newCompartments = new Map();\n for (let ext of flatten(base, compartments, newCompartments)) {\n if (ext instanceof StateField)\n fields.push(ext);\n else\n (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext);\n }\n let address = Object.create(null);\n let staticValues = [];\n let dynamicSlots = [];\n for (let field of fields) {\n address[field.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => field.slot(a));\n }\n let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets;\n for (let id in facets) {\n let providers = facets[id], facet = providers[0].facet;\n let oldProviders = oldFacets && oldFacets[id] || [];\n if (providers.every(p => p.type == 0 /* Provider.Static */)) {\n address[facet.id] = (staticValues.length << 1) | 1;\n if (sameArray(oldProviders, providers)) {\n staticValues.push(oldState.facet(facet));\n }\n else {\n let value = facet.combine(providers.map(p => p.value));\n staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value);\n }\n }\n else {\n for (let p of providers) {\n if (p.type == 0 /* Provider.Static */) {\n address[p.id] = (staticValues.length << 1) | 1;\n staticValues.push(p.value);\n }\n else {\n address[p.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => p.dynamicSlot(a));\n }\n }\n address[facet.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => dynamicFacetSlot(a, facet, providers));\n }\n }\n let dynamic = dynamicSlots.map(f => f(address));\n return new Configuration(base, newCompartments, dynamic, address, staticValues, facets);\n }\n}\nfunction flatten(extension, compartments, newCompartments) {\n let result = [[], [], [], [], []];\n let seen = new Map();\n function inner(ext, prec) {\n let known = seen.get(ext);\n if (known != null) {\n if (known <= prec)\n return;\n let found = result[known].indexOf(ext);\n if (found > -1)\n result[known].splice(found, 1);\n if (ext instanceof CompartmentInstance)\n newCompartments.delete(ext.compartment);\n }\n seen.set(ext, prec);\n if (Array.isArray(ext)) {\n for (let e of ext)\n inner(e, prec);\n }\n else if (ext instanceof CompartmentInstance) {\n if (newCompartments.has(ext.compartment))\n throw new RangeError(`Duplicate use of compartment in extensions`);\n let content = compartments.get(ext.compartment) || ext.inner;\n newCompartments.set(ext.compartment, content);\n inner(content, prec);\n }\n else if (ext instanceof PrecExtension) {\n inner(ext.inner, ext.prec);\n }\n else if (ext instanceof StateField) {\n result[prec].push(ext);\n if (ext.provides)\n inner(ext.provides, prec);\n }\n else if (ext instanceof FacetProvider) {\n result[prec].push(ext);\n if (ext.facet.extensions)\n inner(ext.facet.extensions, Prec_.default);\n }\n else {\n let content = ext.extension;\n if (!content)\n throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);\n inner(content, prec);\n }\n }\n inner(extension, Prec_.default);\n return result.reduce((a, b) => a.concat(b));\n}\nfunction ensureAddr(state, addr) {\n if (addr & 1)\n return 2 /* SlotStatus.Computed */;\n let idx = addr >> 1;\n let status = state.status[idx];\n if (status == 4 /* SlotStatus.Computing */)\n throw new Error(\"Cyclic dependency between fields and/or facets\");\n if (status & 2 /* SlotStatus.Computed */)\n return status;\n state.status[idx] = 4 /* SlotStatus.Computing */;\n let changed = state.computeSlot(state, state.config.dynamicSlots[idx]);\n return state.status[idx] = 2 /* SlotStatus.Computed */ | changed;\n}\nfunction getAddr(state, addr) {\n return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1];\n}\n\nconst languageData = /*@__PURE__*/Facet.define();\nconst allowMultipleSelections = /*@__PURE__*/Facet.define({\n combine: values => values.some(v => v),\n static: true\n});\nconst lineSeparator = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : undefined,\n static: true\n});\nconst changeFilter = /*@__PURE__*/Facet.define();\nconst transactionFilter = /*@__PURE__*/Facet.define();\nconst transactionExtender = /*@__PURE__*/Facet.define();\nconst readOnly = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : false\n});\n\n/**\nAnnotations are tagged values that are used to add metadata to\ntransactions in an extensible way. They should be used to model\nthings that effect the entire transaction (such as its [time\nstamp](https://codemirror.net/6/docs/ref/#state.Transaction^time) or information about its\n[origin](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent)). For effects that happen\n_alongside_ the other changes made by the transaction, [state\neffects](https://codemirror.net/6/docs/ref/#state.StateEffect) are more appropriate.\n*/\nclass Annotation {\n /**\n @internal\n */\n constructor(\n /**\n The annotation type.\n */\n type, \n /**\n The value of this annotation.\n */\n value) {\n this.type = type;\n this.value = value;\n }\n /**\n Define a new type of annotation.\n */\n static define() { return new AnnotationType(); }\n}\n/**\nMarker that identifies a type of [annotation](https://codemirror.net/6/docs/ref/#state.Annotation).\n*/\nclass AnnotationType {\n /**\n Create an instance of this annotation.\n */\n of(value) { return new Annotation(this, value); }\n}\n/**\nRepresentation of a type of state effect. Defined with\n[`StateEffect.define`](https://codemirror.net/6/docs/ref/#state.StateEffect^define).\n*/\nclass StateEffectType {\n /**\n @internal\n */\n constructor(\n // The `any` types in these function types are there to work\n // around TypeScript issue #37631, where the type guard on\n // `StateEffect.is` mysteriously stops working when these properly\n // have type `Value`.\n /**\n @internal\n */\n map) {\n this.map = map;\n }\n /**\n Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this\n type.\n */\n of(value) { return new StateEffect(this, value); }\n}\n/**\nState effects can be used to represent additional effects\nassociated with a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction.effects). They\nare often useful to model changes to custom [state\nfields](https://codemirror.net/6/docs/ref/#state.StateField), when those changes aren't implicit in\ndocument or selection changes.\n*/\nclass StateEffect {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n type, \n /**\n The value of this effect.\n */\n value) {\n this.type = type;\n this.value = value;\n }\n /**\n Map this effect through a position mapping. Will return\n `undefined` when that ends up deleting the effect.\n */\n map(mapping) {\n let mapped = this.type.map(this.value, mapping);\n return mapped === undefined ? undefined : mapped == this.value ? this : new StateEffect(this.type, mapped);\n }\n /**\n Tells you whether this effect object is of a given\n [type](https://codemirror.net/6/docs/ref/#state.StateEffectType).\n */\n is(type) { return this.type == type; }\n /**\n Define a new effect type. The type parameter indicates the type\n of values that his effect holds. It should be a type that\n doesn't include `undefined`, since that is used in\n [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is\n removed.\n */\n static define(spec = {}) {\n return new StateEffectType(spec.map || (v => v));\n }\n /**\n Map an array of effects through a change set.\n */\n static mapEffects(effects, mapping) {\n if (!effects.length)\n return effects;\n let result = [];\n for (let effect of effects) {\n let mapped = effect.map(mapping);\n if (mapped)\n result.push(mapped);\n }\n return result;\n }\n}\n/**\nThis effect can be used to reconfigure the root extensions of\nthe editor. Doing this will discard any extensions\n[appended](https://codemirror.net/6/docs/ref/#state.StateEffect^appendConfig), but does not reset\nthe content of [reconfigured](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure)\ncompartments.\n*/\nStateEffect.reconfigure = /*@__PURE__*/StateEffect.define();\n/**\nAppend extensions to the top-level configuration of the editor.\n*/\nStateEffect.appendConfig = /*@__PURE__*/StateEffect.define();\n/**\nChanges to the editor state are grouped into transactions.\nTypically, a user action creates a single transaction, which may\ncontain any number of document changes, may change the selection,\nor have other effects. Create a transaction by calling\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update), or immediately\ndispatch one by calling\n[`EditorView.dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch).\n*/\nclass Transaction {\n constructor(\n /**\n The state from which the transaction starts.\n */\n startState, \n /**\n The document changes made by this transaction.\n */\n changes, \n /**\n The selection set by this transaction, or undefined if it\n doesn't explicitly set a selection.\n */\n selection, \n /**\n The effects added to the transaction.\n */\n effects, \n /**\n @internal\n */\n annotations, \n /**\n Whether the selection should be scrolled into view after this\n transaction is dispatched.\n */\n scrollIntoView) {\n this.startState = startState;\n this.changes = changes;\n this.selection = selection;\n this.effects = effects;\n this.annotations = annotations;\n this.scrollIntoView = scrollIntoView;\n /**\n @internal\n */\n this._doc = null;\n /**\n @internal\n */\n this._state = null;\n if (selection)\n checkSelection(selection, changes.newLength);\n if (!annotations.some((a) => a.type == Transaction.time))\n this.annotations = annotations.concat(Transaction.time.of(Date.now()));\n }\n /**\n @internal\n */\n static create(startState, changes, selection, effects, annotations, scrollIntoView) {\n return new Transaction(startState, changes, selection, effects, annotations, scrollIntoView);\n }\n /**\n The new document produced by the transaction. Contrary to\n [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't\n force the entire new state to be computed right away, so it is\n recommended that [transaction\n filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter\n when they need to look at the new document.\n */\n get newDoc() {\n return this._doc || (this._doc = this.changes.apply(this.startState.doc));\n }\n /**\n The new selection produced by the transaction. If\n [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined,\n this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's\n current selection through the changes made by the transaction.\n */\n get newSelection() {\n return this.selection || this.startState.selection.map(this.changes);\n }\n /**\n The new state created by the transaction. Computed on demand\n (but retained for subsequent access), so it is recommended not to\n access it in [transaction\n filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible.\n */\n get state() {\n if (!this._state)\n this.startState.applyTransaction(this);\n return this._state;\n }\n /**\n Get the value of the given annotation type, if any.\n */\n annotation(type) {\n for (let ann of this.annotations)\n if (ann.type == type)\n return ann.value;\n return undefined;\n }\n /**\n Indicates whether the transaction changed the document.\n */\n get docChanged() { return !this.changes.empty; }\n /**\n Indicates whether this transaction reconfigures the state\n (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or\n with a top-level configuration\n [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure).\n */\n get reconfigured() { return this.startState.config != this.state.config; }\n /**\n Returns true if the transaction has a [user\n event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to\n or more specific than `event`. For example, if the transaction\n has `\"select.pointer\"` as user event, `\"select\"` and\n `\"select.pointer\"` will match it.\n */\n isUserEvent(event) {\n let e = this.annotation(Transaction.userEvent);\n return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == \".\"));\n }\n}\n/**\nAnnotation used to store transaction timestamps. Automatically\nadded to every transaction, holding `Date.now()`.\n*/\nTransaction.time = /*@__PURE__*/Annotation.define();\n/**\nAnnotation used to associate a transaction with a user interface\nevent. Holds a string identifying the event, using a\ndot-separated format to support attaching more specific\ninformation. The events used by the core libraries are:\n\n - `\"input\"` when content is entered\n - `\"input.type\"` for typed input\n - `\"input.type.compose\"` for composition\n - `\"input.paste\"` for pasted input\n - `\"input.drop\"` when adding content with drag-and-drop\n - `\"input.complete\"` when autocompleting\n - `\"delete\"` when the user deletes content\n - `\"delete.selection\"` when deleting the selection\n - `\"delete.forward\"` when deleting forward from the selection\n - `\"delete.backward\"` when deleting backward from the selection\n - `\"delete.cut\"` when cutting to the clipboard\n - `\"move\"` when content is moved\n - `\"move.drop\"` when content is moved within the editor through drag-and-drop\n - `\"select\"` when explicitly changing the selection\n - `\"select.pointer\"` when selecting with a mouse or other pointing device\n - `\"undo\"` and `\"redo\"` for history actions\n\nUse [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check\nwhether the annotation matches a given event.\n*/\nTransaction.userEvent = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating whether a transaction should be added to\nthe undo history or not.\n*/\nTransaction.addToHistory = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating (when present and true) that a transaction\nrepresents a change made by some other actor, not the user. This\nis used, for example, to tag other people's changes in\ncollaborative editing.\n*/\nTransaction.remote = /*@__PURE__*/Annotation.define();\nfunction joinRanges(a, b) {\n let result = [];\n for (let iA = 0, iB = 0;;) {\n let from, to;\n if (iA < a.length && (iB == b.length || b[iB] >= a[iA])) {\n from = a[iA++];\n to = a[iA++];\n }\n else if (iB < b.length) {\n from = b[iB++];\n to = b[iB++];\n }\n else\n return result;\n if (!result.length || result[result.length - 1] < from)\n result.push(from, to);\n else if (result[result.length - 1] < to)\n result[result.length - 1] = to;\n }\n}\nfunction mergeTransaction(a, b, sequential) {\n var _a;\n let mapForA, mapForB, changes;\n if (sequential) {\n mapForA = b.changes;\n mapForB = ChangeSet.empty(b.changes.length);\n changes = a.changes.compose(b.changes);\n }\n else {\n mapForA = b.changes.map(a.changes);\n mapForB = a.changes.mapDesc(b.changes, true);\n changes = a.changes.compose(mapForA);\n }\n return {\n changes,\n selection: b.selection ? b.selection.map(mapForB) : (_a = a.selection) === null || _a === void 0 ? void 0 : _a.map(mapForA),\n effects: StateEffect.mapEffects(a.effects, mapForA).concat(StateEffect.mapEffects(b.effects, mapForB)),\n annotations: a.annotations.length ? a.annotations.concat(b.annotations) : b.annotations,\n scrollIntoView: a.scrollIntoView || b.scrollIntoView\n };\n}\nfunction resolveTransactionInner(state, spec, docSize) {\n let sel = spec.selection, annotations = asArray(spec.annotations);\n if (spec.userEvent)\n annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent));\n return {\n changes: spec.changes instanceof ChangeSet ? spec.changes\n : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)),\n selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)),\n effects: asArray(spec.effects),\n annotations,\n scrollIntoView: !!spec.scrollIntoView\n };\n}\nfunction resolveTransaction(state, specs, filter) {\n let s = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length);\n if (specs.length && specs[0].filter === false)\n filter = false;\n for (let i = 1; i < specs.length; i++) {\n if (specs[i].filter === false)\n filter = false;\n let seq = !!specs[i].sequential;\n s = mergeTransaction(s, resolveTransactionInner(state, specs[i], seq ? s.changes.newLength : state.doc.length), seq);\n }\n let tr = Transaction.create(state, s.changes, s.selection, s.effects, s.annotations, s.scrollIntoView);\n return extendTransaction(filter ? filterTransaction(tr) : tr);\n}\n// Finish a transaction by applying filters if necessary.\nfunction filterTransaction(tr) {\n let state = tr.startState;\n // Change filters\n let result = true;\n for (let filter of state.facet(changeFilter)) {\n let value = filter(tr);\n if (value === false) {\n result = false;\n break;\n }\n if (Array.isArray(value))\n result = result === true ? value : joinRanges(result, value);\n }\n if (result !== true) {\n let changes, back;\n if (result === false) {\n back = tr.changes.invertedDesc;\n changes = ChangeSet.empty(state.doc.length);\n }\n else {\n let filtered = tr.changes.filter(result);\n changes = filtered.changes;\n back = filtered.filtered.mapDesc(filtered.changes).invertedDesc;\n }\n tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView);\n }\n // Transaction filters\n let filters = state.facet(transactionFilter);\n for (let i = filters.length - 1; i >= 0; i--) {\n let filtered = filters[i](tr);\n if (filtered instanceof Transaction)\n tr = filtered;\n else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction)\n tr = filtered[0];\n else\n tr = resolveTransaction(state, asArray(filtered), false);\n }\n return tr;\n}\nfunction extendTransaction(tr) {\n let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr;\n for (let i = extenders.length - 1; i >= 0; i--) {\n let extension = extenders[i](tr);\n if (extension && Object.keys(extension).length)\n spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true);\n }\n return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView);\n}\nconst none = [];\nfunction asArray(value) {\n return value == null ? none : Array.isArray(value) ? value : [value];\n}\n\n/**\nThe categories produced by a [character\ncategorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer). These are used\ndo things like selecting by word.\n*/\nvar CharCategory = /*@__PURE__*/(function (CharCategory) {\n /**\n Word characters.\n */\n CharCategory[CharCategory[\"Word\"] = 0] = \"Word\";\n /**\n Whitespace.\n */\n CharCategory[CharCategory[\"Space\"] = 1] = \"Space\";\n /**\n Anything else.\n */\n CharCategory[CharCategory[\"Other\"] = 2] = \"Other\";\nreturn CharCategory})(CharCategory || (CharCategory = {}));\nconst nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\nlet wordChar;\ntry {\n wordChar = /*@__PURE__*/new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\", \"u\");\n}\ncatch (_) { }\nfunction hasWordChar(str) {\n if (wordChar)\n return wordChar.test(str);\n for (let i = 0; i < str.length; i++) {\n let ch = str[i];\n if (/\\w/.test(ch) || ch > \"\\x80\" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)))\n return true;\n }\n return false;\n}\nfunction makeCategorizer(wordChars) {\n return (char) => {\n if (!/\\S/.test(char))\n return CharCategory.Space;\n if (hasWordChar(char))\n return CharCategory.Word;\n for (let i = 0; i < wordChars.length; i++)\n if (char.indexOf(wordChars[i]) > -1)\n return CharCategory.Word;\n return CharCategory.Other;\n };\n}\n\n/**\nThe editor state class is a persistent (immutable) data structure.\nTo update a state, you [create](https://codemirror.net/6/docs/ref/#state.EditorState.update) a\n[transaction](https://codemirror.net/6/docs/ref/#state.Transaction), which produces a _new_ state\ninstance, without modifying the original object.\n\nAs such, _never_ mutate properties of a state directly. That'll\njust break things.\n*/\nclass EditorState {\n constructor(\n /**\n @internal\n */\n config, \n /**\n The current document.\n */\n doc, \n /**\n The current selection.\n */\n selection, \n /**\n @internal\n */\n values, computeSlot, tr) {\n this.config = config;\n this.doc = doc;\n this.selection = selection;\n this.values = values;\n this.status = config.statusTemplate.slice();\n this.computeSlot = computeSlot;\n // Fill in the computed state immediately, so that further queries\n // for it made during the update return this state\n if (tr)\n tr._state = this;\n for (let i = 0; i < this.config.dynamicSlots.length; i++)\n ensureAddr(this, i << 1);\n this.computeSlot = null;\n }\n field(field, require = true) {\n let addr = this.config.address[field.id];\n if (addr == null) {\n if (require)\n throw new RangeError(\"Field is not present in this state\");\n return undefined;\n }\n ensureAddr(this, addr);\n return getAddr(this, addr);\n }\n /**\n Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this\n state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec)\n can be passed. Unless\n [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the\n [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec\n are assumed to start in the _current_ document (not the document\n produced by previous specs), and its\n [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and\n [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer\n to the document created by its _own_ changes. The resulting\n transaction contains the combined effect of all the different\n specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later\n specs take precedence over earlier ones.\n */\n update(...specs) {\n return resolveTransaction(this, specs, true);\n }\n /**\n @internal\n */\n applyTransaction(tr) {\n let conf = this.config, { base, compartments } = conf;\n for (let effect of tr.effects) {\n if (effect.is(Compartment.reconfigure)) {\n if (conf) {\n compartments = new Map;\n conf.compartments.forEach((val, key) => compartments.set(key, val));\n conf = null;\n }\n compartments.set(effect.value.compartment, effect.value.extension);\n }\n else if (effect.is(StateEffect.reconfigure)) {\n conf = null;\n base = effect.value;\n }\n else if (effect.is(StateEffect.appendConfig)) {\n conf = null;\n base = asArray(base).concat(effect.value);\n }\n }\n let startValues;\n if (!conf) {\n conf = Configuration.resolve(base, compartments, this);\n let intermediateState = new EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null);\n startValues = intermediateState.values;\n }\n else {\n startValues = tr.startState.values.slice();\n }\n new EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr);\n }\n /**\n Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that\n replaces every selection range with the given content.\n */\n replaceSelection(text) {\n if (typeof text == \"string\")\n text = this.toText(text);\n return this.changeByRange(range => ({ changes: { from: range.from, to: range.to, insert: text },\n range: EditorSelection.cursor(range.from + text.length) }));\n }\n /**\n Create a set of changes and a new selection by running the given\n function for each range in the active selection. The function\n can return an optional set of changes (in the coordinate space\n of the start document), plus an updated range (in the coordinate\n space of the document produced by the call's own changes). This\n method will merge all the changes and ranges into a single\n changeset and selection, and return it as a [transaction\n spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to\n [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update).\n */\n changeByRange(f) {\n let sel = this.selection;\n let result1 = f(sel.ranges[0]);\n let changes = this.changes(result1.changes), ranges = [result1.range];\n let effects = asArray(result1.effects);\n for (let i = 1; i < sel.ranges.length; i++) {\n let result = f(sel.ranges[i]);\n let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes);\n for (let j = 0; j < i; j++)\n ranges[j] = ranges[j].map(newMapped);\n let mapBy = changes.mapDesc(newChanges, true);\n ranges.push(result.range.map(mapBy));\n changes = changes.compose(newMapped);\n effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy));\n }\n return {\n changes,\n selection: EditorSelection.create(ranges, sel.mainIndex),\n effects\n };\n }\n /**\n Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change\n description, taking the state's document length and line\n separator into account.\n */\n changes(spec = []) {\n if (spec instanceof ChangeSet)\n return spec;\n return ChangeSet.of(spec, this.doc.length, this.facet(EditorState.lineSeparator));\n }\n /**\n Using the state's [line\n separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a\n [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.\n */\n toText(string) {\n return Text.of(string.split(this.facet(EditorState.lineSeparator) || DefaultSplit));\n }\n /**\n Return the given range of the document as a string.\n */\n sliceDoc(from = 0, to = this.doc.length) {\n return this.doc.sliceString(from, to, this.lineBreak);\n }\n /**\n Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet).\n */\n facet(facet) {\n let addr = this.config.address[facet.id];\n if (addr == null)\n return facet.default;\n ensureAddr(this, addr);\n return getAddr(this, addr);\n }\n /**\n Convert this state to a JSON-serializable object. When custom\n fields should be serialized, you can pass them in as an object\n mapping property names (in the resulting object, which should\n not use `doc` or `selection`) to fields.\n */\n toJSON(fields) {\n let result = {\n doc: this.sliceDoc(),\n selection: this.selection.toJSON()\n };\n if (fields)\n for (let prop in fields) {\n let value = fields[prop];\n if (value instanceof StateField && this.config.address[value.id] != null)\n result[prop] = value.spec.toJSON(this.field(fields[prop]), this);\n }\n return result;\n }\n /**\n Deserialize a state from its JSON representation. When custom\n fields should be deserialized, pass the same object you passed\n to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as\n third argument.\n */\n static fromJSON(json, config = {}, fields) {\n if (!json || typeof json.doc != \"string\")\n throw new RangeError(\"Invalid JSON representation for EditorState\");\n let fieldInit = [];\n if (fields)\n for (let prop in fields) {\n if (Object.prototype.hasOwnProperty.call(json, prop)) {\n let field = fields[prop], value = json[prop];\n fieldInit.push(field.init(state => field.spec.fromJSON(value, state)));\n }\n }\n return EditorState.create({\n doc: json.doc,\n selection: EditorSelection.fromJSON(json.selection),\n extensions: config.extensions ? fieldInit.concat([config.extensions]) : fieldInit\n });\n }\n /**\n Create a new state. You'll usually only need this when\n initializing an editor—updated states are created by applying\n transactions.\n */\n static create(config = {}) {\n let configuration = Configuration.resolve(config.extensions || [], new Map);\n let doc = config.doc instanceof Text ? config.doc\n : Text.of((config.doc || \"\").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit));\n let selection = !config.selection ? EditorSelection.single(0)\n : config.selection instanceof EditorSelection ? config.selection\n : EditorSelection.single(config.selection.anchor, config.selection.head);\n checkSelection(selection, doc.length);\n if (!configuration.staticFacet(allowMultipleSelections))\n selection = selection.asSingle();\n return new EditorState(configuration, doc, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null);\n }\n /**\n The size (in columns) of a tab in the document, determined by\n the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet.\n */\n get tabSize() { return this.facet(EditorState.tabSize); }\n /**\n Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator)\n string for this state.\n */\n get lineBreak() { return this.facet(EditorState.lineSeparator) || \"\\n\"; }\n /**\n Returns true when the editor is\n [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only.\n */\n get readOnly() { return this.facet(readOnly); }\n /**\n Look up a translation for the given phrase (via the\n [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the\n original string if no translation is found.\n \n If additional arguments are passed, they will be inserted in\n place of markers like `$1` (for the first value) and `$2`, etc.\n A single `$` is equivalent to `$1`, and `$$` will produce a\n literal dollar sign.\n */\n phrase(phrase, ...insert) {\n for (let map of this.facet(EditorState.phrases))\n if (Object.prototype.hasOwnProperty.call(map, phrase)) {\n phrase = map[phrase];\n break;\n }\n if (insert.length)\n phrase = phrase.replace(/\\$(\\$|\\d*)/g, (m, i) => {\n if (i == \"$\")\n return \"$\";\n let n = +(i || 1);\n return !n || n > insert.length ? m : insert[n - 1];\n });\n return phrase;\n }\n /**\n Find the values for a given language data field, provided by the\n the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet.\n \n Examples of language data fields are...\n \n - [`\"commentTokens\"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying\n comment syntax.\n - [`\"autocomplete\"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override)\n for providing language-specific completion sources.\n - [`\"wordChars\"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding\n characters that should be considered part of words in this\n language.\n - [`\"closeBrackets\"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls\n bracket closing behavior.\n */\n languageDataAt(name, pos, side = -1) {\n let values = [];\n for (let provider of this.facet(languageData)) {\n for (let result of provider(this, pos, side)) {\n if (Object.prototype.hasOwnProperty.call(result, name))\n values.push(result[name]);\n }\n }\n return values;\n }\n /**\n Return a function that can categorize strings (expected to\n represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak))\n into one of:\n \n - Word (contains an alphanumeric character or a character\n explicitly listed in the local language's `\"wordChars\"`\n language data, which should be a string)\n - Space (contains only whitespace)\n - Other (anything else)\n */\n charCategorizer(at) {\n return makeCategorizer(this.languageDataAt(\"wordChars\", at).join(\"\"));\n }\n /**\n Find the word at the given position, meaning the range\n containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters\n around it. If no word characters are adjacent to the position,\n this returns null.\n */\n wordAt(pos) {\n let { text, from, length } = this.doc.lineAt(pos);\n let cat = this.charCategorizer(pos);\n let start = pos - from, end = pos - from;\n while (start > 0) {\n let prev = findClusterBreak(text, start, false);\n if (cat(text.slice(prev, start)) != CharCategory.Word)\n break;\n start = prev;\n }\n while (end < length) {\n let next = findClusterBreak(text, end);\n if (cat(text.slice(end, next)) != CharCategory.Word)\n break;\n end = next;\n }\n return start == end ? null : EditorSelection.range(start + from, end + from);\n }\n}\n/**\nA facet that, when enabled, causes the editor to allow multiple\nranges to be selected. Be careful though, because by default the\neditor relies on the native DOM selection, which cannot handle\nmultiple selections. An extension like\n[`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) can be used to make\nsecondary selections visible to the user.\n*/\nEditorState.allowMultipleSelections = allowMultipleSelections;\n/**\nConfigures the tab size to use in this state. The first\n(highest-precedence) value of the facet is used. If no value is\ngiven, this defaults to 4.\n*/\nEditorState.tabSize = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : 4\n});\n/**\nThe line separator to use. By default, any of `\"\\n\"`, `\"\\r\\n\"`\nand `\"\\r\"` is treated as a separator when splitting lines, and\nlines are joined with `\"\\n\"`.\n\nWhen you configure a value here, only that precise separator\nwill be used, allowing you to round-trip documents through the\neditor without normalizing line separators.\n*/\nEditorState.lineSeparator = lineSeparator;\n/**\nThis facet controls the value of the\n[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) getter, which is\nconsulted by commands and extensions that implement editing\nfunctionality to determine whether they should apply. It\ndefaults to false, but when its highest-precedence value is\n`true`, such functionality disables itself.\n\nNot to be confused with\n[`EditorView.editable`](https://codemirror.net/6/docs/ref/#view.EditorView^editable), which\ncontrols whether the editor's DOM is set to be editable (and\nthus focusable).\n*/\nEditorState.readOnly = readOnly;\n/**\nRegisters translation phrases. The\n[`phrase`](https://codemirror.net/6/docs/ref/#state.EditorState.phrase) method will look through\nall objects registered with this facet to find translations for\nits argument.\n*/\nEditorState.phrases = /*@__PURE__*/Facet.define({\n compare(a, b) {\n let kA = Object.keys(a), kB = Object.keys(b);\n return kA.length == kB.length && kA.every(k => a[k] == b[k]);\n }\n});\n/**\nA facet used to register [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) providers.\n*/\nEditorState.languageData = languageData;\n/**\nFacet used to register change filters, which are called for each\ntransaction (unless explicitly\n[disabled](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter)), and can suppress\npart of the transaction's changes.\n\nSuch a function can return `true` to indicate that it doesn't\nwant to do anything, `false` to completely stop the changes in\nthe transaction, or a set of ranges in which changes should be\nsuppressed. Such ranges are represented as an array of numbers,\nwith each pair of two numbers indicating the start and end of a\nrange. So for example `[10, 20, 100, 110]` suppresses changes\nbetween 10 and 20, and between 100 and 110.\n*/\nEditorState.changeFilter = changeFilter;\n/**\nFacet used to register a hook that gets a chance to update or\nreplace transaction specs before they are applied. This will\nonly be applied for transactions that don't have\n[`filter`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter) set to `false`. You\ncan either return a single transaction spec (possibly the input\ntransaction), or an array of specs (which will be combined in\nthe same way as the arguments to\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update)).\n\nWhen possible, it is recommended to avoid accessing\n[`Transaction.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state) in a filter,\nsince it will force creation of a state that will then be\ndiscarded again, if the transaction is actually filtered.\n\n(This functionality should be used with care. Indiscriminately\nmodifying transaction is likely to break something or degrade\nthe user experience.)\n*/\nEditorState.transactionFilter = transactionFilter;\n/**\nThis is a more limited form of\n[`transactionFilter`](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter),\nwhich can only add\n[annotations](https://codemirror.net/6/docs/ref/#state.TransactionSpec.annotations) and\n[effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects). _But_, this type\nof filter runs even if the transaction has disabled regular\n[filtering](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter), making it suitable\nfor effects that don't need to touch the changes or selection,\nbut do want to process every transaction.\n\nExtenders run _after_ filters, when both are present.\n*/\nEditorState.transactionExtender = transactionExtender;\nCompartment.reconfigure = /*@__PURE__*/StateEffect.define();\n\n/**\nUtility function for combining behaviors to fill in a config\nobject from an array of provided configs. `defaults` should hold\ndefault values for all optional fields in `Config`.\n\nThe function will, by default, error\nwhen a field gets two values that aren't `===`-equal, but you can\nprovide combine functions per field to do something else.\n*/\nfunction combineConfig(configs, defaults, // Should hold only the optional properties of Config, but I haven't managed to express that\ncombine = {}) {\n let result = {};\n for (let config of configs)\n for (let key of Object.keys(config)) {\n let value = config[key], current = result[key];\n if (current === undefined)\n result[key] = value;\n else if (current === value || value === undefined) ; // No conflict\n else if (Object.hasOwnProperty.call(combine, key))\n result[key] = combine[key](current, value);\n else\n throw new Error(\"Config merge conflict for field \" + key);\n }\n for (let key in defaults)\n if (result[key] === undefined)\n result[key] = defaults[key];\n return result;\n}\n\n/**\nEach range is associated with a value, which must inherit from\nthis class.\n*/\nclass RangeValue {\n /**\n Compare this value with another value. Used when comparing\n rangesets. The default implementation compares by identity.\n Unless you are only creating a fixed number of unique instances\n of your value type, it is a good idea to implement this\n properly.\n */\n eq(other) { return this == other; }\n /**\n Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value.\n */\n range(from, to = from) { return Range.create(from, to, this); }\n}\nRangeValue.prototype.startSide = RangeValue.prototype.endSide = 0;\nRangeValue.prototype.point = false;\nRangeValue.prototype.mapMode = MapMode.TrackDel;\n/**\nA range associates a value with a range of positions.\n*/\nclass Range {\n constructor(\n /**\n The range's start position.\n */\n from, \n /**\n Its end position.\n */\n to, \n /**\n The value associated with this range.\n */\n value) {\n this.from = from;\n this.to = to;\n this.value = value;\n }\n /**\n @internal\n */\n static create(from, to, value) {\n return new Range(from, to, value);\n }\n}\nfunction cmpRange(a, b) {\n return a.from - b.from || a.value.startSide - b.value.startSide;\n}\nclass Chunk {\n constructor(from, to, value, \n // Chunks are marked with the largest point that occurs\n // in them (or -1 for no points), so that scans that are\n // only interested in points (such as the\n // heightmap-related logic) can skip range-only chunks.\n maxPoint) {\n this.from = from;\n this.to = to;\n this.value = value;\n this.maxPoint = maxPoint;\n }\n get length() { return this.to[this.to.length - 1]; }\n // Find the index of the given position and side. Use the ranges'\n // `from` pos when `end == false`, `to` when `end == true`.\n findIndex(pos, side, end, startAt = 0) {\n let arr = end ? this.to : this.from;\n for (let lo = startAt, hi = arr.length;;) {\n if (lo == hi)\n return lo;\n let mid = (lo + hi) >> 1;\n let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side;\n if (mid == lo)\n return diff >= 0 ? lo : hi;\n if (diff >= 0)\n hi = mid;\n else\n lo = mid + 1;\n }\n }\n between(offset, from, to, f) {\n for (let i = this.findIndex(from, -1000000000 /* C.Far */, true), e = this.findIndex(to, 1000000000 /* C.Far */, false, i); i < e; i++)\n if (f(this.from[i] + offset, this.to[i] + offset, this.value[i]) === false)\n return false;\n }\n map(offset, changes) {\n let value = [], from = [], to = [], newPos = -1, maxPoint = -1;\n for (let i = 0; i < this.value.length; i++) {\n let val = this.value[i], curFrom = this.from[i] + offset, curTo = this.to[i] + offset, newFrom, newTo;\n if (curFrom == curTo) {\n let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode);\n if (mapped == null)\n continue;\n newFrom = newTo = mapped;\n if (val.startSide != val.endSide) {\n newTo = changes.mapPos(curFrom, val.endSide);\n if (newTo < newFrom)\n continue;\n }\n }\n else {\n newFrom = changes.mapPos(curFrom, val.startSide);\n newTo = changes.mapPos(curTo, val.endSide);\n if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0)\n continue;\n }\n if ((newTo - newFrom || val.endSide - val.startSide) < 0)\n continue;\n if (newPos < 0)\n newPos = newFrom;\n if (val.point)\n maxPoint = Math.max(maxPoint, newTo - newFrom);\n value.push(val);\n from.push(newFrom - newPos);\n to.push(newTo - newPos);\n }\n return { mapped: value.length ? new Chunk(from, to, value, maxPoint) : null, pos: newPos };\n }\n}\n/**\nA range set stores a collection of [ranges](https://codemirror.net/6/docs/ref/#state.Range) in a\nway that makes them efficient to [map](https://codemirror.net/6/docs/ref/#state.RangeSet.map) and\n[update](https://codemirror.net/6/docs/ref/#state.RangeSet.update). This is an immutable data\nstructure.\n*/\nclass RangeSet {\n constructor(\n /**\n @internal\n */\n chunkPos, \n /**\n @internal\n */\n chunk, \n /**\n @internal\n */\n nextLayer, \n /**\n @internal\n */\n maxPoint) {\n this.chunkPos = chunkPos;\n this.chunk = chunk;\n this.nextLayer = nextLayer;\n this.maxPoint = maxPoint;\n }\n /**\n @internal\n */\n static create(chunkPos, chunk, nextLayer, maxPoint) {\n return new RangeSet(chunkPos, chunk, nextLayer, maxPoint);\n }\n /**\n @internal\n */\n get length() {\n let last = this.chunk.length - 1;\n return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length);\n }\n /**\n The number of ranges in the set.\n */\n get size() {\n if (this.isEmpty)\n return 0;\n let size = this.nextLayer.size;\n for (let chunk of this.chunk)\n size += chunk.value.length;\n return size;\n }\n /**\n @internal\n */\n chunkEnd(index) {\n return this.chunkPos[index] + this.chunk[index].length;\n }\n /**\n Update the range set, optionally adding new ranges or filtering\n out existing ones.\n \n (Note: The type parameter is just there as a kludge to work\n around TypeScript variance issues that prevented `RangeSet`\n from being a subtype of `RangeSet` when `X` is a subtype of\n `Y`.)\n */\n update(updateSpec) {\n let { add = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec;\n let filter = updateSpec.filter;\n if (add.length == 0 && !filter)\n return this;\n if (sort)\n add = add.slice().sort(cmpRange);\n if (this.isEmpty)\n return add.length ? RangeSet.of(add) : this;\n let cur = new LayerCursor(this, null, -1).goto(0), i = 0, spill = [];\n let builder = new RangeSetBuilder();\n while (cur.value || i < add.length) {\n if (i < add.length && (cur.from - add[i].from || cur.startSide - add[i].value.startSide) >= 0) {\n let range = add[i++];\n if (!builder.addInner(range.from, range.to, range.value))\n spill.push(range);\n }\n else if (cur.rangeIndex == 1 && cur.chunkIndex < this.chunk.length &&\n (i == add.length || this.chunkEnd(cur.chunkIndex) < add[i].from) &&\n (!filter || filterFrom > this.chunkEnd(cur.chunkIndex) || filterTo < this.chunkPos[cur.chunkIndex]) &&\n builder.addChunk(this.chunkPos[cur.chunkIndex], this.chunk[cur.chunkIndex])) {\n cur.nextChunk();\n }\n else {\n if (!filter || filterFrom > cur.to || filterTo < cur.from || filter(cur.from, cur.to, cur.value)) {\n if (!builder.addInner(cur.from, cur.to, cur.value))\n spill.push(Range.create(cur.from, cur.to, cur.value));\n }\n cur.next();\n }\n }\n return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? RangeSet.empty\n : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo }));\n }\n /**\n Map this range set through a set of changes, return the new set.\n */\n map(changes) {\n if (changes.empty || this.isEmpty)\n return this;\n let chunks = [], chunkPos = [], maxPoint = -1;\n for (let i = 0; i < this.chunk.length; i++) {\n let start = this.chunkPos[i], chunk = this.chunk[i];\n let touch = changes.touchesRange(start, start + chunk.length);\n if (touch === false) {\n maxPoint = Math.max(maxPoint, chunk.maxPoint);\n chunks.push(chunk);\n chunkPos.push(changes.mapPos(start));\n }\n else if (touch === true) {\n let { mapped, pos } = chunk.map(start, changes);\n if (mapped) {\n maxPoint = Math.max(maxPoint, mapped.maxPoint);\n chunks.push(mapped);\n chunkPos.push(pos);\n }\n }\n }\n let next = this.nextLayer.map(changes);\n return chunks.length == 0 ? next : new RangeSet(chunkPos, chunks, next || RangeSet.empty, maxPoint);\n }\n /**\n Iterate over the ranges that touch the region `from` to `to`,\n calling `f` for each. There is no guarantee that the ranges will\n be reported in any specific order. When the callback returns\n `false`, iteration stops.\n */\n between(from, to, f) {\n if (this.isEmpty)\n return;\n for (let i = 0; i < this.chunk.length; i++) {\n let start = this.chunkPos[i], chunk = this.chunk[i];\n if (to >= start && from <= start + chunk.length &&\n chunk.between(start, from - start, to - start, f) === false)\n return;\n }\n this.nextLayer.between(from, to, f);\n }\n /**\n Iterate over the ranges in this set, in order, including all\n ranges that end at or after `from`.\n */\n iter(from = 0) {\n return HeapCursor.from([this]).goto(from);\n }\n /**\n @internal\n */\n get isEmpty() { return this.nextLayer == this; }\n /**\n Iterate over the ranges in a collection of sets, in order,\n starting from `from`.\n */\n static iter(sets, from = 0) {\n return HeapCursor.from(sets).goto(from);\n }\n /**\n Iterate over two groups of sets, calling methods on `comparator`\n to notify it of possible differences.\n */\n static compare(oldSets, newSets, \n /**\n This indicates how the underlying data changed between these\n ranges, and is needed to synchronize the iteration.\n */\n textDiff, comparator, \n /**\n Can be used to ignore all non-point ranges, and points below\n the given size. When -1, all ranges are compared.\n */\n minPointSize = -1) {\n let a = oldSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n let b = newSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n let sharedChunks = findSharedChunks(a, b, textDiff);\n let sideA = new SpanCursor(a, sharedChunks, minPointSize);\n let sideB = new SpanCursor(b, sharedChunks, minPointSize);\n textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator));\n if (textDiff.empty && textDiff.length == 0)\n compare(sideA, 0, sideB, 0, 0, comparator);\n }\n /**\n Compare the contents of two groups of range sets, returning true\n if they are equivalent in the given range.\n */\n static eq(oldSets, newSets, from = 0, to) {\n if (to == null)\n to = 1000000000 /* C.Far */ - 1;\n let a = oldSets.filter(set => !set.isEmpty && newSets.indexOf(set) < 0);\n let b = newSets.filter(set => !set.isEmpty && oldSets.indexOf(set) < 0);\n if (a.length != b.length)\n return false;\n if (!a.length)\n return true;\n let sharedChunks = findSharedChunks(a, b);\n let sideA = new SpanCursor(a, sharedChunks, 0).goto(from), sideB = new SpanCursor(b, sharedChunks, 0).goto(from);\n for (;;) {\n if (sideA.to != sideB.to ||\n !sameValues(sideA.active, sideB.active) ||\n sideA.point && (!sideB.point || !sideA.point.eq(sideB.point)))\n return false;\n if (sideA.to > to)\n return true;\n sideA.next();\n sideB.next();\n }\n }\n /**\n Iterate over a group of range sets at the same time, notifying\n the iterator about the ranges covering every given piece of\n content. Returns the open count (see\n [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end\n of the iteration.\n */\n static spans(sets, from, to, iterator, \n /**\n When given and greater than -1, only points of at least this\n size are taken into account.\n */\n minPointSize = -1) {\n let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from;\n let openRanges = cursor.openStart;\n for (;;) {\n let curTo = Math.min(cursor.to, to);\n if (cursor.point) {\n let active = cursor.activeForPoint(cursor.to);\n let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges);\n iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);\n openRanges = Math.min(cursor.openEnd(curTo), active.length);\n }\n else if (curTo > pos) {\n iterator.span(pos, curTo, cursor.active, openRanges);\n openRanges = cursor.openEnd(curTo);\n }\n if (cursor.to > to)\n return openRanges + (cursor.point && cursor.to > to ? 1 : 0);\n pos = cursor.to;\n cursor.next();\n }\n }\n /**\n Create a range set for the given range or array of ranges. By\n default, this expects the ranges to be _sorted_ (by start\n position and, if two start at the same position,\n `value.startSide`). You can pass `true` as second argument to\n cause the method to sort them.\n */\n static of(ranges, sort = false) {\n let build = new RangeSetBuilder();\n for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges)\n build.add(range.from, range.to, range.value);\n return build.finish();\n }\n}\n/**\nThe empty set of ranges.\n*/\nRangeSet.empty = /*@__PURE__*/new RangeSet([], [], null, -1);\nfunction lazySort(ranges) {\n if (ranges.length > 1)\n for (let prev = ranges[0], i = 1; i < ranges.length; i++) {\n let cur = ranges[i];\n if (cmpRange(prev, cur) > 0)\n return ranges.slice().sort(cmpRange);\n prev = cur;\n }\n return ranges;\n}\nRangeSet.empty.nextLayer = RangeSet.empty;\n/**\nA range set builder is a data structure that helps build up a\n[range set](https://codemirror.net/6/docs/ref/#state.RangeSet) directly, without first allocating\nan array of [`Range`](https://codemirror.net/6/docs/ref/#state.Range) objects.\n*/\nclass RangeSetBuilder {\n finishChunk(newArrays) {\n this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint));\n this.chunkPos.push(this.chunkStart);\n this.chunkStart = -1;\n this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint);\n this.maxPoint = -1;\n if (newArrays) {\n this.from = [];\n this.to = [];\n this.value = [];\n }\n }\n /**\n Create an empty builder.\n */\n constructor() {\n this.chunks = [];\n this.chunkPos = [];\n this.chunkStart = -1;\n this.last = null;\n this.lastFrom = -1000000000 /* C.Far */;\n this.lastTo = -1000000000 /* C.Far */;\n this.from = [];\n this.to = [];\n this.value = [];\n this.maxPoint = -1;\n this.setMaxPoint = -1;\n this.nextLayer = null;\n }\n /**\n Add a range. Ranges should be added in sorted (by `from` and\n `value.startSide`) order.\n */\n add(from, to, value) {\n if (!this.addInner(from, to, value))\n (this.nextLayer || (this.nextLayer = new RangeSetBuilder)).add(from, to, value);\n }\n /**\n @internal\n */\n addInner(from, to, value) {\n let diff = from - this.lastTo || value.startSide - this.last.endSide;\n if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0)\n throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");\n if (diff < 0)\n return false;\n if (this.from.length == 250 /* C.ChunkSize */)\n this.finishChunk(true);\n if (this.chunkStart < 0)\n this.chunkStart = from;\n this.from.push(from - this.chunkStart);\n this.to.push(to - this.chunkStart);\n this.last = value;\n this.lastFrom = from;\n this.lastTo = to;\n this.value.push(value);\n if (value.point)\n this.maxPoint = Math.max(this.maxPoint, to - from);\n return true;\n }\n /**\n @internal\n */\n addChunk(from, chunk) {\n if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0)\n return false;\n if (this.from.length)\n this.finishChunk(true);\n this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint);\n this.chunks.push(chunk);\n this.chunkPos.push(from);\n let last = chunk.value.length - 1;\n this.last = chunk.value[last];\n this.lastFrom = chunk.from[last] + from;\n this.lastTo = chunk.to[last] + from;\n return true;\n }\n /**\n Finish the range set. Returns the new set. The builder can't be\n used anymore after this has been called.\n */\n finish() { return this.finishInner(RangeSet.empty); }\n /**\n @internal\n */\n finishInner(next) {\n if (this.from.length)\n this.finishChunk(false);\n if (this.chunks.length == 0)\n return next;\n let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint);\n this.from = null; // Make sure further `add` calls produce errors\n return result;\n }\n}\nfunction findSharedChunks(a, b, textDiff) {\n let inA = new Map();\n for (let set of a)\n for (let i = 0; i < set.chunk.length; i++)\n if (set.chunk[i].maxPoint <= 0)\n inA.set(set.chunk[i], set.chunkPos[i]);\n let shared = new Set();\n for (let set of b)\n for (let i = 0; i < set.chunk.length; i++) {\n let known = inA.get(set.chunk[i]);\n if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i] &&\n !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i].length)))\n shared.add(set.chunk[i]);\n }\n return shared;\n}\nclass LayerCursor {\n constructor(layer, skip, minPoint, rank = 0) {\n this.layer = layer;\n this.skip = skip;\n this.minPoint = minPoint;\n this.rank = rank;\n }\n get startSide() { return this.value ? this.value.startSide : 0; }\n get endSide() { return this.value ? this.value.endSide : 0; }\n goto(pos, side = -1000000000 /* C.Far */) {\n this.chunkIndex = this.rangeIndex = 0;\n this.gotoInner(pos, side, false);\n return this;\n }\n gotoInner(pos, side, forward) {\n while (this.chunkIndex < this.layer.chunk.length) {\n let next = this.layer.chunk[this.chunkIndex];\n if (!(this.skip && this.skip.has(next) ||\n this.layer.chunkEnd(this.chunkIndex) < pos ||\n next.maxPoint < this.minPoint))\n break;\n this.chunkIndex++;\n forward = false;\n }\n if (this.chunkIndex < this.layer.chunk.length) {\n let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true);\n if (!forward || this.rangeIndex < rangeIndex)\n this.setRangeIndex(rangeIndex);\n }\n this.next();\n }\n forward(pos, side) {\n if ((this.to - pos || this.endSide - side) < 0)\n this.gotoInner(pos, side, true);\n }\n next() {\n for (;;) {\n if (this.chunkIndex == this.layer.chunk.length) {\n this.from = this.to = 1000000000 /* C.Far */;\n this.value = null;\n break;\n }\n else {\n let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex];\n let from = chunkPos + chunk.from[this.rangeIndex];\n this.from = from;\n this.to = chunkPos + chunk.to[this.rangeIndex];\n this.value = chunk.value[this.rangeIndex];\n this.setRangeIndex(this.rangeIndex + 1);\n if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint)\n break;\n }\n }\n }\n setRangeIndex(index) {\n if (index == this.layer.chunk[this.chunkIndex].value.length) {\n this.chunkIndex++;\n if (this.skip) {\n while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]))\n this.chunkIndex++;\n }\n this.rangeIndex = 0;\n }\n else {\n this.rangeIndex = index;\n }\n }\n nextChunk() {\n this.chunkIndex++;\n this.rangeIndex = 0;\n this.next();\n }\n compare(other) {\n return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank ||\n this.to - other.to || this.endSide - other.endSide;\n }\n}\nclass HeapCursor {\n constructor(heap) {\n this.heap = heap;\n }\n static from(sets, skip = null, minPoint = -1) {\n let heap = [];\n for (let i = 0; i < sets.length; i++) {\n for (let cur = sets[i]; !cur.isEmpty; cur = cur.nextLayer) {\n if (cur.maxPoint >= minPoint)\n heap.push(new LayerCursor(cur, skip, minPoint, i));\n }\n }\n return heap.length == 1 ? heap[0] : new HeapCursor(heap);\n }\n get startSide() { return this.value ? this.value.startSide : 0; }\n goto(pos, side = -1000000000 /* C.Far */) {\n for (let cur of this.heap)\n cur.goto(pos, side);\n for (let i = this.heap.length >> 1; i >= 0; i--)\n heapBubble(this.heap, i);\n this.next();\n return this;\n }\n forward(pos, side) {\n for (let cur of this.heap)\n cur.forward(pos, side);\n for (let i = this.heap.length >> 1; i >= 0; i--)\n heapBubble(this.heap, i);\n if ((this.to - pos || this.value.endSide - side) < 0)\n this.next();\n }\n next() {\n if (this.heap.length == 0) {\n this.from = this.to = 1000000000 /* C.Far */;\n this.value = null;\n this.rank = -1;\n }\n else {\n let top = this.heap[0];\n this.from = top.from;\n this.to = top.to;\n this.value = top.value;\n this.rank = top.rank;\n if (top.value)\n top.next();\n heapBubble(this.heap, 0);\n }\n }\n}\nfunction heapBubble(heap, index) {\n for (let cur = heap[index];;) {\n let childIndex = (index << 1) + 1;\n if (childIndex >= heap.length)\n break;\n let child = heap[childIndex];\n if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) {\n child = heap[childIndex + 1];\n childIndex++;\n }\n if (cur.compare(child) < 0)\n break;\n heap[childIndex] = cur;\n heap[index] = child;\n index = childIndex;\n }\n}\nclass SpanCursor {\n constructor(sets, skip, minPoint) {\n this.minPoint = minPoint;\n this.active = [];\n this.activeTo = [];\n this.activeRank = [];\n this.minActive = -1;\n // A currently active point range, if any\n this.point = null;\n this.pointFrom = 0;\n this.pointRank = 0;\n this.to = -1000000000 /* C.Far */;\n this.endSide = 0;\n // The amount of open active ranges at the start of the iterator.\n // Not including points.\n this.openStart = -1;\n this.cursor = HeapCursor.from(sets, skip, minPoint);\n }\n goto(pos, side = -1000000000 /* C.Far */) {\n this.cursor.goto(pos, side);\n this.active.length = this.activeTo.length = this.activeRank.length = 0;\n this.minActive = -1;\n this.to = pos;\n this.endSide = side;\n this.openStart = -1;\n this.next();\n return this;\n }\n forward(pos, side) {\n while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0)\n this.removeActive(this.minActive);\n this.cursor.forward(pos, side);\n }\n removeActive(index) {\n remove(this.active, index);\n remove(this.activeTo, index);\n remove(this.activeRank, index);\n this.minActive = findMinIndex(this.active, this.activeTo);\n }\n addActive(trackOpen) {\n let i = 0, { value, to, rank } = this.cursor;\n while (i < this.activeRank.length && this.activeRank[i] <= rank)\n i++;\n insert(this.active, i, value);\n insert(this.activeTo, i, to);\n insert(this.activeRank, i, rank);\n if (trackOpen)\n insert(trackOpen, i, this.cursor.from);\n this.minActive = findMinIndex(this.active, this.activeTo);\n }\n // After calling this, if `this.point` != null, the next range is a\n // point. Otherwise, it's a regular range, covered by `this.active`.\n next() {\n let from = this.to, wasPoint = this.point;\n this.point = null;\n let trackOpen = this.openStart < 0 ? [] : null;\n for (;;) {\n let a = this.minActive;\n if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) {\n if (this.activeTo[a] > from) {\n this.to = this.activeTo[a];\n this.endSide = this.active[a].endSide;\n break;\n }\n this.removeActive(a);\n if (trackOpen)\n remove(trackOpen, a);\n }\n else if (!this.cursor.value) {\n this.to = this.endSide = 1000000000 /* C.Far */;\n break;\n }\n else if (this.cursor.from > from) {\n this.to = this.cursor.from;\n this.endSide = this.cursor.startSide;\n break;\n }\n else {\n let nextVal = this.cursor.value;\n if (!nextVal.point) { // Opening a range\n this.addActive(trackOpen);\n this.cursor.next();\n }\n else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) {\n // Ignore any non-empty points that end precisely at the end of the prev point\n this.cursor.next();\n }\n else { // New point\n this.point = nextVal;\n this.pointFrom = this.cursor.from;\n this.pointRank = this.cursor.rank;\n this.to = this.cursor.to;\n this.endSide = nextVal.endSide;\n this.cursor.next();\n this.forward(this.to, this.endSide);\n break;\n }\n }\n }\n if (trackOpen) {\n this.openStart = 0;\n for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--)\n this.openStart++;\n }\n }\n activeForPoint(to) {\n if (!this.active.length)\n return this.active;\n let active = [];\n for (let i = this.active.length - 1; i >= 0; i--) {\n if (this.activeRank[i] < this.pointRank)\n break;\n if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide)\n active.push(this.active[i]);\n }\n return active.reverse();\n }\n openEnd(to) {\n let open = 0;\n for (let i = this.activeTo.length - 1; i >= 0 && this.activeTo[i] > to; i--)\n open++;\n return open;\n }\n}\nfunction compare(a, startA, b, startB, length, comparator) {\n a.goto(startA);\n b.goto(startB);\n let endB = startB + length;\n let pos = startB, dPos = startB - startA;\n for (;;) {\n let diff = (a.to + dPos) - b.to || a.endSide - b.endSide;\n let end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB);\n if (a.point || b.point) {\n if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) &&\n sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to))))\n comparator.comparePoint(pos, clipEnd, a.point, b.point);\n }\n else {\n if (clipEnd > pos && !sameValues(a.active, b.active))\n comparator.compareRange(pos, clipEnd, a.active, b.active);\n }\n if (end > endB)\n break;\n pos = end;\n if (diff <= 0)\n a.next();\n if (diff >= 0)\n b.next();\n }\n}\nfunction sameValues(a, b) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (a[i] != b[i] && !a[i].eq(b[i]))\n return false;\n return true;\n}\nfunction remove(array, index) {\n for (let i = index, e = array.length - 1; i < e; i++)\n array[i] = array[i + 1];\n array.pop();\n}\nfunction insert(array, index, value) {\n for (let i = array.length - 1; i >= index; i--)\n array[i + 1] = array[i];\n array[index] = value;\n}\nfunction findMinIndex(value, array) {\n let found = -1, foundPos = 1000000000 /* C.Far */;\n for (let i = 0; i < array.length; i++)\n if ((array[i] - foundPos || value[i].endSide - value[found].endSide) < 0) {\n found = i;\n foundPos = array[i];\n }\n return found;\n}\n\n/**\nCount the column position at the given offset into the string,\ntaking extending characters and tab size into account.\n*/\nfunction countColumn(string, tabSize, to = string.length) {\n let n = 0;\n for (let i = 0; i < to;) {\n if (string.charCodeAt(i) == 9) {\n n += tabSize - (n % tabSize);\n i++;\n }\n else {\n n++;\n i = findClusterBreak(string, i);\n }\n }\n return n;\n}\n/**\nFind the offset that corresponds to the given column position in a\nstring, taking extending characters and tab size into account. By\ndefault, the string length is returned when it is too short to\nreach the column. Pass `strict` true to make it return -1 in that\nsituation.\n*/\nfunction findColumn(string, col, tabSize, strict) {\n for (let i = 0, n = 0;;) {\n if (n >= col)\n return i;\n if (i == string.length)\n break;\n n += string.charCodeAt(i) == 9 ? tabSize - (n % tabSize) : 1;\n i = findClusterBreak(string, i);\n }\n return strict === true ? -1 : string.length;\n}\n\nexport { Annotation, AnnotationType, ChangeDesc, ChangeSet, CharCategory, Compartment, EditorSelection, EditorState, Facet, Line, MapMode, Prec, Range, RangeSet, RangeSetBuilder, RangeValue, SelectionRange, StateEffect, StateEffectType, StateField, Text, Transaction, codePointAt, codePointSize, combineConfig, countColumn, findClusterBreak, findColumn, fromCodePoint };\n","const C = \"\\u037c\"\nconst COUNT = typeof Symbol == \"undefined\" ? \"__\" + C : Symbol.for(C)\nconst SET = typeof Symbol == \"undefined\" ? \"__styleSet\" + Math.floor(Math.random() * 1e8) : Symbol(\"styleSet\")\nconst top = typeof globalThis != \"undefined\" ? globalThis : typeof window != \"undefined\" ? window : {}\n\n// :: - Style modules encapsulate a set of CSS rules defined from\n// JavaScript. Their definitions are only available in a given DOM\n// root after it has been _mounted_ there with `StyleModule.mount`.\n//\n// Style modules should be created once and stored somewhere, as\n// opposed to re-creating them every time you need them. The amount of\n// CSS rules generated for a given DOM root is bounded by the amount\n// of style modules that were used. So to avoid leaking rules, don't\n// create these dynamically, but treat them as one-time allocations.\nexport class StyleModule {\n // :: (Object