diff --git a/package.json b/package.json index 2e23f4d0..9ef8c668 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "bundlesize": [ { "path": "resources/dist/main.js", - "maxSize": "100.0kB" + "maxSize": "105.0kB" } ] } diff --git a/resources/dist/main.js b/resources/dist/main.js index 48e76860..7b31a911 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,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2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,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:g)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&m(t.charCodeAt(e))&&w(t.charCodeAt(e-1))&&e--;let n=v(t,e);for(e+=k(n);e=0&&u(v(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function g(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 m(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 k(t){return t<65536?1:2}const b=/\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 D(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||b)):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 D(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)||W(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 _)||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 j(t){return e=>new K(e,t)}const q={highest:j(0),high:j(1),default:j(2),low:j(3),lowest:j(4)};class K{constructor(t,e){this.inner=t,this.prec=e}}class G{of(t){return new U(this,t)}reconfigure(t){return G.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class U{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 U&&i.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let e of s)t(e,o);else if(s instanceof U){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 _)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 _?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=>V(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,gt(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 gt(t){return null==t?pt:Array.isArray(t)?t:[t]}var mt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(mt||(mt={}));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=gt(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=gt(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)||b)),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 mt.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 mt.Word;for(let i=0;i-1)return mt.Word;return mt.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))!=mt.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,G.reconfigure=lt.define();class bt{eq(t){return this==t}range(t,e=t){return xt.create(t,e,this)}}bt.prototype.startSide=bt.prototype.endSide=0,bt.prototype.point=!1,bt.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 Dt(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 Ot.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Ot.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 Dt(s,e,i,r));return 1==n.length?n[0]:new Ot(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=Ot.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=Vt[Ht]||1;return Vt[Ht]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[Wt],r=i&&i.nonce;n?r&&n.setNonce(r):n=new jt(t,r),n.mount(Array.isArray(e)?e:[e])}}let _t=new Map;class jt{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=_t.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[Wt]=e;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],_t.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[Wt]=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),Gt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ut=0;Ut<10;Ut++)qt[48+Ut]=qt[96+Ut]=String(Ut);for(Ut=1;Ut<=24;Ut++)qt[Ut+111]="F"+Ut;for(Ut=65;Ut<=90;Ut++)qt[Ut]=String.fromCharCode(Ut+32),$t[Ut]=String.fromCharCode(Ut);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?ce(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}}class oe{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 ae,le=null;function he(t){if(t.setActive)return t.setActive();if(le)return t.focus(le);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==le?{get preventScroll(){return le={preventScroll:!0},!0}}:void 0),!le){le=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}class pe{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new pe(t.parentNode,ee(t),e)}static after(t,e){return new pe(t.parentNode,ee(t)+1,e)}}const ge=[];class me{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=me.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=we(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=we(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&&!me.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 i=t;ithis.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 ye(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 Be={mac:Le||/Mac/.test(be.platform),windows:/Win/.test(be.platform),linux:/Linux|X11/.test(be.platform),ie:Ce,ie_version:Ae?xe.documentMode||6:Me?+Me[1]:Se?+Se[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(be.userAgent)||[0,0])[1]:0,chrome:!!De,chrome_version:De?+De[1]:0,ios:Le,android:/Android\b/.test(be.userAgent),webkit:Oe,safari:Ee,webkit_version:Oe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=xe.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Pe extends me{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 Pe)||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 Pe(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 pe(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?Be.chrome||Be.gecko||(e?(r--,o=1):s=0)?0:a.length-1];return Be.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 Ne extends me{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(fe(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 Ne&&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 Ne(this.mark,e,s)}domAtPos(t){return ze(this,t)}coordsAt(t,e){return We(this,t,e)}}class Re extends me{static create(t,e,i){return new Re(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Re.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 Re&&this.widget.compare(i.widget))||t>0&&r<=0||e0)?pe.before(this.dom):pe.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?pe.before(this.dom):pe.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 ze(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 Ne&&r.length&&(n=r[r.length-1])instanceof Ne&&n.mark.eq(e.mark)?He(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 je(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 qe(t){let e=Object.create(null);for(let i=0;i0?3e8:-4e8:e>0?1e8:-1e8,new Ye(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}=Xe(t,n);e=(r?n?-3e8:-1:5e8)-1,i=1+(s?n?2e8:1:-6e8)}return new Ye(t,e,i,n,t.widget||null,!0)}static line(t){return new Je(t)}static set(t,e=!1){return Mt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Ge.none=Mt.empty;class Ue extends Ge{constructor(t){let{start:e,end:i}=Xe(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 Ue&&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)}}Ue.prototype.point=!1;class Je extends Ge{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Je&&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)}}Je.prototype.mapMode=x.TrackBefore,Je.prototype.point=!0;class Ye extends Ge{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=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Ye&&((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 Xe(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 Qe(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)}Ye.prototype.point=!0;class Ze extends me{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,n,r,s){if(i){if(!(i instanceof Ze))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),ke(this,t,e,i?i.children:[],r,s),!0}split(t){let e=new Ze;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:n}=this.childPos(t);n&&(e.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let t=i;t0&&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){He(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Ve(e,this.attrs||{})),i&&(this.attrs=Ve({class:i},this.attrs||{}))}domAtPos(t){return ze(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(fe(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&&(je(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&&me.get(n)instanceof Ne;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=me.get(n))||void 0===i?void 0:i.isEditable)||Be.ios&&this.children.some((t=>t instanceof Pe))))){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 Pe)||/[^ -~]/.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 Ze)return r;if(s>e)break}n=s+r.breakAfter}return null}}class ti extends me{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof ti&&this.widget.compare(i.widget))||t>0&&r<=0||e0;){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(ii(new Pe(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 Ye){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 Ye)if(i.block){let{type:t}=i;t!=Ke.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ti(i.widget||new ni("div"),o,t))}else{let s=Re.create(i.widget||new ni("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(ii(new Ie(1),n),r),r=n.length+Math.max(0,r-n.length)),h.append(ii(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 ei(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 ii(t,e){for(let i of e)t=new Ne(i,[t],t.length);return t}class ni extends $e{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 ri=R.define(),si=R.define(),oi=R.define(),ai=R.define(),li=R.define(),hi=R.define(),ci=R.define(),ui=R.define({combine:t=>t.some((t=>t))}),fi=R.define({combine:t=>t.some((t=>t))});class di{constructor(t,e="nearest",i="nearest",n=5,r=5){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r}map(t){return t.empty?this:new di(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const pi=lt.define({map:(t,e)=>t.map(e)});function gi(t,e,i){let n=t.facet(ai);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 mi=R.define({combine:t=>!t.length||t[0]});let wi=0;const vi=R.define();class yi{constructor(t,e,i,n){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=n(this)}static define(t,e){const{eventHandlers:i,provide:n,decorations:r}=e||{};return new yi(wi++,t,i,(t=>{let e=[vi.of(t)];return r&&e.push(Si.of((e=>{let i=e.plugin(t);return i?r(i):Ge.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return yi.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 bi=R.define(),xi=R.define(),Si=R.define(),Ai=R.define(),Mi=R.define();function Ci(t,e,i){let n=t.state.facet(Mi);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 Ti=R.define();function Di(t){let e=0,i=0,n=0,r=0;for(let s of t.state.facet(Ti)){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 Oi=R.define();class Ei{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Ei(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 Ei(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),s=a.toA,o=a.toB}}}class Li{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 Ei(t,e,i,r)))),this.changedRanges=n}static create(t,e,i){return new Li(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 Bi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Bi||(Bi={}));const Pi=Bi.LTR,Ni=Bi.RTL;function Ri(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 Fi(l,p.from,f)),$i(t,p.direction==Pi!=!(f%2)?n+1:n,r,p.inner,p.from,p.to,o),l=p.to),d=p.to}else{if(d==i||(e?ji[d]!=a:ji[d]==a))break;d++}u?qi(t,l,d,n+1,r,u,o):le;){let i=!0,c=!1;if(!h||l>s[h-1].to){let t=ji[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(ji[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&&(ji[o]=ji[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=ji[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),ji[--e]=c;l=o}else s=o,l++}}}(r,s,n,a),qi(t,r,s,e,i,n,o)}function Ki(t){return[new Fi(0,t,0)]}let Gi="";function Ui(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=Fi.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.side(r,i))return B.cursor(c+t.from,h?-1:1,l.level);let u=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return u||l.level==i?u&&u.level0&&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=Xi(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 Ei(l.mapPos(s),l.mapPos(o),s,o),c=[];for(let e=r.parentNode;;e=e.parentNode){let i=me.get(e);if(i instanceof Ne)c.push({node:e,deco:i.mark});else{if(i instanceof Ze||"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 Ue({inclusive:!0,attributes:qe(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 Ei(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,(Be.ie||Be.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,i){let n=new Zi;return Mt.compare(t,e,i,n),n.changes}(this.decorations,this.updateDeco(),t.changes);return i=Ei.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=Be.chrome||Be.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=ei.build(this.view.state.doc,u,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=ei.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}=ei.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=r.findPos(c,1),{i:g,off:m}=r.findPos(h,-1);ye(this,g,m,d,p,s,o,a,l)}i&&this.fixCompositionDOM(i)}compositionView(t){let e=new Pe(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Ne(i,[e],e.length);let i=new Ze;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=me.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(Be.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 pe(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((()=>{Be.android&&Be.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(Be.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 pe(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new pe(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=Ze.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=me.get(i.childNodes[n]);t instanceof Ze&&(e=t.domAtPos(t.length))}return e?new pe(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=me.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(;es||t==s&&r.type!=Ke.WidgetBefore&&r.type!=Ke.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==Ke.WidgetBefore&&e>-2))return r.coordsAt(t-s,e);i=s}}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof Ze))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 Pe))return null;let r=d(n.text,i);if(r==i)return null;let s=ce(n.dom,i,r).getClientRects();return!s.length||s[0].top>=s[0].bottom?null:s[0]}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,r=this.view.contentDOM.clientWidth,s=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Bi.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?Bi.RTL:Bi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof Ze){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 ve(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(Ge.replace({widget:new Yi(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!r)break;i=r.to+1}return Ge.set(t)}updateDeco(){let t=this.view.state.facet(Si).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};!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();d=e.width/c.offsetWidth,p=e.height/c.offsetHeight,t={left:e.left,right:e.left+c.clientWidth*d,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==r)e.top0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+m+o)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+o,i<0&&e.top-m0&&e.right>t.right+g&&(g=e.right-t.right+g+s)):e.right>t.right&&(g=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 Zi=class{constructor(){this.changes=[]}compareRange(t,e){Qe(t,e,this.changes)}comparePoint(t,e){Qe(t,e,this.changes)}};function tn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function en(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function nn(t,e){return t.tope.top+1}function rn(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function on(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;dm||o==m&&s>g){n=f,r=p,s=g,o=m;let a=m?i0?d0)}0==g?i>p.bottom&&(!h||h.bottomp.top)&&(l=f,c=p):h&&nn(h,p)?h=sn(h,p.bottom):c&&nn(c,p)&&(c=rn(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?an(n,f,i):u&&"false"!=n.contentEditable?on(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(r.left+r.right)/2?1:0)}}function an(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((Be.chrome||Be.gecko)&&ce(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 ln(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!=Ke.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:hn(t,a,o,c,u);let p=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:p,m=g.elementFromPoint(c,u);m&&!t.contentDOM.contains(m)&&(m=null),m||(c=Math.max(a.left+1,Math.min(a.right-1,c)),m=g.elementFromPoint(c,u),m&&!t.contentDOM.contains(m)&&(m=null));let w,v=-1;if(m&&0!=(null===(r=t.docView.nearest(m))||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)||Be.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 ce(t,n-1,n).getBoundingClientRect().left>i}(w,v,c)||Be.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():ce(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=Ze.find(t.docView,d);if(!e)return f>o.top+o.height/2?o.to:o.from;({node:w,offset:v}=on(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 cn(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=Ui(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 un(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,n{this.ignoreDuringComposition(i)||"keydown"==i.type&&this.keydown(t,i)||(this.mustFlushObserver(i)&&t.observer.forceFlush(),this.runCustomHandlers(i.type,t,i)?i.preventDefault():e(t,i))};for(let i in kn){let n=kn[i];t.contentDOM.addEventListener(i,(i=>{yn(t,i)&&e(n,i)}),bn[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(kn.mousedown,i),!i.defaultPrevented&&2==i.button)){let e=t.contentDOM.style.minHeight;t.contentDOM.style.minHeight="100%",setTimeout((()=>t.contentDOM.style.minHeight=e),200)}})),t.scrollDOM.addEventListener("drop",(i=>{i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&e(kn.drop,i)})),Be.chrome&&102==Be.chrome_version&&t.scrollDOM.addEventListener("wheel",(()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout((()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=t.hasFocus,Be.safari&&t.contentDOM.addEventListener("input",(()=>null)),Be.gecko&&function(t){Wn.has(t)||(Wn.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}ensureHandlers(t,e){var i;let n;this.customHandlers=[];for(let r of e)if(n=null===(i=r.update(t).spec)||void 0===i?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:n});for(let e in n)this.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(this.registeredEvents.push(e),t.contentDOM.addEventListener(e,(i=>{yn(t,i)&&this.runCustomHandlers(e,t,i)&&i.preventDefault()})))}}runCustomHandlers(t,e,i){for(let n of this.customHandlers){let r=n.handlers[t];if(r)try{if(r.call(n.plugin,i,e)||i.defaultPrevented)return!0}catch(t){gi(e.state,t)}}return!1}runScrollHandlers(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;for(let i of this.customHandlers){let n=i.handlers.scroll;if(n)try{n.call(i.plugin,e,t)}catch(e){gi(t.state,e)}}}keydown(t,e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()t.keyCode==e.keyCode)))&&!e.ctrlKey||gn.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)||(this.pendingIOSKey=i||e,setTimeout((()=>this.flushIOSKey(t)),250),0))}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,ue(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Be.safari&&!Be.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const pn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],gn="dthko",mn=[16,17,18,20,91,92,224,225];function wn(t){return.7*Math.max(0,t)+8}class vn{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(Ai).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(ri);return i.length?i[0](e):Be.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!=Pn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),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=-wn(o.left-t.clientX):t.clientX+a.right>=o.right-6&&(r=wn(t.clientX-o.right)),t.clientY-a.top<=o.top+6?s=-wn(o.top-t.clientY):t.clientY+a.bottom>=o.bottom-6&&(s=wn(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=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)}}function yn(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=me.get(n))&&i.ignoreEvent(e))return!1;return!0}const kn=Object.create(null),bn=Object.create(null),xn=Be.ie&&Be.ie_version<15||Be.ios&&Be.webkit_version<604;function Sn(t,e){let i,{state:n}=t,r=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(null!=Rn&&n.selection.ranges.every((t=>t.empty))&&Rn==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 An(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.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},kn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},kn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},bn.touchstart=bn.touchmove={passive:!0},kn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(oi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Dn(t,e),n=Pn(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=Dn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.pos&&!s){let e=An(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 vn(t,e,i,n)),n&&t.observer.ignore((()=>he(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Mn=(t,e)=>t>=e.top&&t<=e.bottom,Cn=(t,e,i)=>Mn(e,i)&&t>=i.left&&t<=i.right;function Tn(t,e,i,n){let r=Ze.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&&Cn(i,n,o))return-1;let a=r.coordsAt(s,1);return a&&Cn(i,n,a)?1:o&&Mn(n,o)?-1:1}function Dn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Tn(t,i,e.clientX,e.clientY)}}const On=Be.ie&&Be.ie_version<=11;let En=null,Ln=0,Bn=0;function Pn(t){if(!On)return t.detail;let e=En,i=Bn;return En=t,Bn=Date.now(),Ln=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Ln+1)%3:1}function Nn(t,e,i,n){if(!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:s}=t.inputState,o=n&&s&&s.dragging&&function(t,e){let i=t.state.facet(si);return i.length?i[0](e):Be.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.dragging.from,to:s.dragging.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"})}kn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:n}=t.inputState;n&&(n.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},kn.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let n=Array(i.length),r=0,s=()=>{++r==i.length&&Nn(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])}}else Nn(t,e,e.dataTransfer.getData("Text"),!0)},kn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=xn?null:e.clipboardData;i?(Sn(t,i.getData("text/plain")||i.getData("text/uri-text")),e.preventDefault()):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(),Sn(t,i.value)}),50)}(t)};let Rn=null;kn.copy=kn.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;Rn=r?i:null;let s=xn?null:e.clipboardData;s?(e.preventDefault(),s.clearData(),s.setData("text/plain",i)):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),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"})};const In=st.define();function zn(t,e){let i=[];for(let n of t.facet(ci)){let r=n(t,e);r&&i.push(r)}return i?t.update({effects:i,annotations:In.of(!0)}):null}function Hn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=zn(t.state,e);i?t.dispatch(i):t.update([])}}),10)}kn.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),Hn(t)},kn.blur=t=>{t.observer.clearSelectionRange(),Hn(t)},kn.compositionstart=kn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},kn.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,Be.chrome&&Be.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},kn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},kn.beforeinput=(t,e)=>{var i;let n;if(Be.chrome&&Be.android&&(n=pn.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)}};const Wn=new Set,Vn=["pre-wrap","normal","pre-line","break-spaces"];class Fn{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 Vn.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)>$n&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Kn.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,qn.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=l?u:r.lineAt(l,qn.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 Un extends Gn{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new jn(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Un||n instanceof Jn&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Jn?n=new Un(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Kn.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 Jn extends Kn{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 jn(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 jn(a,l,i+o*n,o,0)}}lineAt(t,e,i,n,r){if(e==qn.ByHeight)return this.blockAt(t,i,n,r);if(e==qn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new jn(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 jn(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 jn(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 Jn?i[i.length-1]=new Jn(t.length+n):i.push(null,new Jn(n-1))}if(t>0){let e=i[0];e instanceof Jn?i[0]=new Jn(t+e.length):i.unshift(new Jn(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new Jn(t-1),null)}decomposeRight(t,e){e.push(null,new Jn(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 Jn(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)>=$n&&(o=-2);let a=new Un(e,r);a.outdated=!1,i.push(a),s+=e+1}s<=r&&i.push(null,new Jn(r-s).updateHeight(t,s));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=$n||Math.abs(o-this.heightMetrics(t,e).perLine)>=$n)&&(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 Yn extends Kn{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==qn.ByPosNoHeight?qn.ByPosNoHeight:qn.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,qn.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&&Xn(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?Kn.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 Xn(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Jn&&(n=t[e+1])instanceof Jn&&t.splice(e-1,3,new Jn(i.length+1+n.length))}class Qn{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 Un?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Un(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 Un(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new Jn(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 Un)return t;let e=new Un(0,-1);return this.nodes.push(e),e}addBlock(t){var e;this.enterLine();let i=null===(e=t.deco)||void 0===e?void 0:e.type;i!=Ke.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,i!=Ke.WidgetBefore&&(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 Un||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 er(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class ir{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 Fn(i),this.stateDeco=e.facet(Si).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Ei(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ge.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 sr(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?hr:new cr(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:ur(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Si).filter((t=>"function"!=typeof t));let n=t.changedRanges,r=Ei.extendWithRanges(n,function(t,e,i){let n=new Zn;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(fi)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Bi.RTL:Bi.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 t=a.width/i.offsetWidth,e=a.height/i.offsetHeight;t>.995&&t<1.005&&(t=1),e>.995&&e<1.005&&(e=1),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=de(e.scrollDOM);let p=(this.printing?er:tr)(i,this.paddingTop),g=p.top-this.pixelViewport.top,m=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)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),r.heightChanged=!1;for(let n of this.viewports){let s=n.from==this.viewport.from?i:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new Ei(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 sr(n.lineAt(s-1e3*i,qn.ByHeight,r,0,0).from,n.lineAt(o+1e3*(1-i),qn.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,qn.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!=Bi.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 ir(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))||ur(this.heightMap.lineAt(t,qn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return ur(this.heightMap.lineAt(this.scaler.fromDOM(t),qn.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 ur(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 sr{constructor(t,e){this.from=t,this.to=e}}function or(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 lr(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 hr={toDOM:t=>t,fromDOM:t=>t,scale:1};class cr{constructor(t,e,i){let n=0,r=0,s=0;this.viewports=i.map((({from:i,to:r})=>{let s=e.lineAt(i,qn.ByPos,t,0,0).top,o=e.lineAt(r,qn.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=eur(t,e))):t._content)}const fr=R.define({combine:t=>t.join(" ")}),dr=R.define({combine:t=>t.indexOf(!0)>-1}),pr=Ft.newName(),gr=Ft.newName(),mr=Ft.newName(),wr={"&light":"."+gr,"&dark":"."+mr};function vr(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 yr=vr("."+pr,{"&":{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",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"},"&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"}},wr),kr="￿";class br{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(yt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=kr}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=me.get(n),o=me.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:xr(n))||xr(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=me.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+Math.min(e,i.offset))}}function xr(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class Sr{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class Ar{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="";let{impreciseHead:r,impreciseAnchor:s}=t.docView;if(t.state.readOnly&&e>-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 Sr(i,n)),r==i&&s==n||e.push(new Sr(r,s))),e}(t),i=new br(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 Mr(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||Be.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,kr),i.text,l-r,h);c&&(Be.chrome&&13==o&&c.toB==c.from+2&&i.text.slice(c.from,c.toB)==kr+kr&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:t.of(i.text.slice(c.from,c.toB).split(kr))})}else r&&(!e.hasFocus&&e.state.facet(mi)||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))}:(Be.mac||Be.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([" "])}):Be.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(Be.ios&&e.inputState.flushIOSKey(e))return!0;if(Be.android&&(n.from==s.from&&n.to==s.to&&1==n.insert.length&&2==n.insert.lines&&ue(e.contentDOM,"Enter",13)||(n.from==s.from-1&&n.to==s.to&&0==n.insert.length||8==o&&n.insert.lengths.head)&&ue(e.contentDOM,"Backspace",8)||n.from==s.from&&n.to==s.to+1&&0==n.insert.length&&ue(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&&Xi(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(hi).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 Cr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Tr=Be.ie&&Be.ie_version<=11;class Dr{constructor(t){this.view=t,this.active=!1,this.selectionRange=new oe,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.resizeContent=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);(Be.ie&&Be.ie_version<=11||Be.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()})),Tr&&(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.view.requestMeasure())),this.resizeContent.observe(t.contentDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((t=>{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.runScrollHandlers(this.view,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(mi)?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):(Be.ie&&Be.ie_version<=11||Be.android&&Be.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=Be.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&&ue(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 Ar(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!1;let i=this.view.state,n=Mr(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=Or(e,t.previousSibling||t.target.previousSibling,-1),n=Or(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,n;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(),null===(n=this.resizeContent)||void 0===n||n.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 Or(t,e,i){for(;e;){let n=me.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 Er{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.style.cssText="position: fixed; top: -10000px",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 rr(t.state||yt.create(t)),this.plugins=this.state.facet(vi).map((t=>new ki(t)));for(let t of this.plugins)t.update(this);this.observer=new Dr(this),this.inputState=new dn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Ji(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(In)))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=zn(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=Li.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 di(t.empty?t:B.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(pi)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Pr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Oi)!=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(fr)!=e.state.facet(fr)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(li))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Mr(this,h)&&l.force&&ue(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 rr(t),this.plugins=t.facet(vi).map((t=>new ki(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new Ji(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(vi),i=t.state.facet(vi);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(),this.inputState.ensureHandlers(this,this.plugins)}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(de(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),Br}})),h=Li.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(li))t(e)}get themeClasses(){return pr+" "+(this.state.facet(dr)?mr:gr)+" "+this.state.facet(fr)}updateAttrs(){let t=Nr(this,bi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(mi)?"true":"false",class:"cm-content",style:`${Be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Nr(this,xi,e);let i=this.observer.ignore((()=>{let i=je(this.contentDOM,this.contentAttrs,e),n=je(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(Er.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(Oi);let t=this.state.facet(Er.cspNonce);Ft.mount(this.root,this.styleModules.concat(yr).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 fn(this,t,cn(this,t,e,i))}moveByGroup(t,e){return fn(this,t,cn(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==mt.Space&&(r=e),r==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let r=function(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==Ke.Text))return t;return i}(t,e.head),s=n&&r.type==Ke.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==Bi.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 fn(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),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 i=0;;i+=10){let n=o+(f+i)*s,h=ln(t,{x:u,y:n},!1,s);if(nl.bottom||(s<0?hr))return B.cursor(h,e.assoc,void 0,a)}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),ln(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),r=this.bidiSpans(n);return re(i,r[Fi.find(r,t-n.from,-1,e)].dir==Bi.LTR==e>0)}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(ui)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Lr)return Ki(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=Ci(this,t.from,t.to))))return n.order;e||(e=Ci(this,t.from,t.to));let n=function(t,e,i){if(!t)return[new Fi(0,0,e==Ni?1:0)];if(e==Pi&&!i.length&&!Vi.test(t))return Ki(t.length);if(i.length)for(;t.length>ji.length;)ji[ji.length]=256;let n=[],r=e==Pi?0:1;return $i(t,r,r,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new Pr(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Be.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{he(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.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return pi.of(new di("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return yi.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=Ft.newName(),n=[fr.of(i),Oi.of(vr(`.${i}`,t))];return e&&e.dark&&n.push(dr.of(!0)),n}static baseTheme(t){return q.lowest(Oi.of(vr("."+pr,t,wr)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&me.get(i)||me.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Er.styleModule=Oi,Er.inputHandler=hi,Er.focusChangeEffect=ci,Er.perLineTextDirection=ui,Er.exceptionSink=ai,Er.updateListener=li,Er.editable=mi,Er.mouseSelectionStyle=oi,Er.dragMovesSelection=si,Er.clickAddsSelectionRange=ri,Er.decorations=Si,Er.atomicRanges=Ai,Er.bidiIsolatedRanges=Mi,Er.scrollMargins=Ti,Er.darkTheme=dr,Er.cspNonce=R.define({combine:t=>t.length?t[0]:""}),Er.contentAttributes=xi,Er.editorAttributes=bi,Er.lineWrapping=Er.contentAttributes.of({class:"cm-lineWrapping"}),Er.announce=lt.define();const Lr=4096,Br={};class Pr{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:Bi.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&&Ve(s,i)}return i}const Rr=Be.mac?"mac":Be.windows?"win":Be.linux?"linux":"key";function Ir(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 zr=q.default(Er.domEventHandlers({keydown:(t,e)=>jr(Vr(e.state),t,e,"editor")})),Hr=R.define({enables:zr}),Wr=new WeakMap;function Vr(t){let e=t.facet(Hr),i=Wr.get(e);return i||Wr.set(e,i=function(t,e=Rr){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=Fr={view:e,prefix:i,scope:t};return setTimeout((()=>{Fr==n&&(Fr=null)}),_r),!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 Fr=null;const _r=4e3;function jr(t,e,i,n){let r=function(t){var e=!(Kt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Gt&&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=k(v(r,0))==r.length&&" "!=r,o="",a=!1,l=!1,h=!1;Fr&&Fr.view==i&&Fr.scope==n&&(o=Fr.prefix+" ",mn.indexOf(e.keyCode)<0&&(l=!0,Fr=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+Ir(r,e,!s)])?a=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Be.windows&&e.ctrlKey&&e.altKey)&&(c=qt[e.keyCode])&&c!=r?(d(p[o+Ir(c,e,!0)])||e.shiftKey&&(u=$t[e.keyCode])!=r&&u!=c&&d(p[o+Ir(u,e,!1)]))&&(a=!0):s&&e.shiftKey&&d(p[o+Ir(r,e,!0)])&&(a=!0),!a&&d(p._any)&&(a=!0)),l&&(a=!0),a&&h&&e.stopPropagation(),a}Be.ios;function qr(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 $r{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))qr(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 Kr=null!=/x/.unicode?"gu":"g",Gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Kr),Ur={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 Jr=null;const Yr=R.define({combine(t){let e=kt(t,{render:null,specialChars:Gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==Jr&&"undefined"!=typeof document&&document.body){let e=document.body.style;Jr=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return Jr||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Kr)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Kr)),e}});let Xr=null;class Qr extends $e{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")+" "+(Ur[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 Zr extends $e{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 ts=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 es(t,e){let i=t.plugin(is),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const is=yi.fromClass(class{constructor(t){this.input=t.state.facet(ss),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(ts);this.top=new ns(t,!0,e.topContainer),this.bottom=new ns(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(ts);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ns(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ns(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(ss);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=>Er.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class ns{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=rs(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=rs(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 rs(t){let e=t.nextSibling;return t.remove(),e}const ss=R.define({enables:is});class os extends bt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}os.prototype.elementClass="",os.prototype.toDOM=void 0,os.prototype.mapMode=x.TrackBefore,os.prototype.startSide=os.prototype.endSide=-1,os.prototype.point=!0;const as=R.define(),ls=R.define(),hs=R.define({combine:t=>t.some((t=>t))});function cs(t){let e=[us];return t&&!1===t.fixed&&e.push(hs.of(!0)),e}const us=yi.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(ls).map((e=>new gs(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(hs),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(hs)!=!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(as),this.view.viewport.from),n=[],r=this.gutters.map((t=>new ps(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==Ke.Text&&e){ds(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==Ke.Text){ds(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(ls),i=t.state.facet(ls),n=t.docChanged||t.heightChanged||t.viewportChanged||!Mt.eq(t.startState.facet(as),t.state.facet(as),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 gs(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=>Er.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Bi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function fs(t){return Array.isArray(t)?t:[t]}function ds(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class ps{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;if(this.i==n.elements.length){let s=new ms(t,e.height,r,i);n.elements.push(s),n.dom.appendChild(s.dom)}else n.elements[this.i].update(t,e.height,r,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];ds(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 gs{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=fs(e.markers(t)),e.initialSpacer&&(this.spacer=new ms(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=fs(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 ms{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/t.scaleY+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i/t.scaleY+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;ikt(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 ys extends os{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function ks(t,e){return t.state.facet(vs).formatNumber(e,t.state)}const bs=ls.compute([vs],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(ws),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new ys(ks(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(vs)!=t.state.facet(vs),initialSpacer:t=>new ys(ks(t,xs(t.state.doc.lines))),updateSpacer(t,e){let i=ks(e.view,xs(e.view.state.doc.lines));return i==t.number?t:new ys(i)},domEventHandlers:t.facet(vs).domEventHandlers})));function xs(t){let e=9;for(;e{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 Ge.replace({widget:new Zr((e-s%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ge.replace({widget:new Qr(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Yr);t.startState.facet(Yr)!=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;this.state=yt.create({doc:this.$textarea.textSelection("getContents"),extensions:e}),this.view=new Er({state:this.state,parent:this.$textarea.parent()[0]}),mw.user.options.get("usecodemirror-colorblind")&&"wikitext"===mw.config.get("wgPageContentModel")&&this.view.dom.classList.add("cm-mw-colorblind-colors"),this.$textarea.hide(),this.$textarea[0].form&&this.$textarea[0].form.addEventListener("submit",(function(){t.$textarea.val(t.view.state.doc.toString())})),$(this.view.dom).textSelection("register",this.cmTextSelection),this.$textarea.textSelection("register",this.cmTextSelection),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}},{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,e=$(this.view.dom);return{getContents:function(){return t.view.state.doc.toString()},setContents:function(i){return t.view.dispatch({changes:{from:0,to:t.view.state.doc.length,insert:i}}),e},getSelection:function(){return t.view.state.sliceDoc(t.view.state.selection.main.from,t.view.state.selection.main.to)},setSelection:function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{start:0,end:0};return t.view.dispatch({selection:{anchor:i.start,head:i.end||i.start}}),t.view.focus(),e},replaceSelection:function(i){return t.view.dispatch(t.view.state.replaceSelection(i)),e},getCaretPosition:function(e){return e.startAndEnd?[t.view.state.selection.main.from,t.view.state.selection.main.to]:t.view.state.selection.main.head},scrollToCaretPosition:function(){return t.view.dispatch({effects:Er.scrollIntoView(t.view.state.selection.main.head)}),e}}}}],i&&As(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Ts=1024;let Ds=0;class Os{constructor(t,e){this.from=t,this.to=e}}class Es{constructor(t={}){this.id=Ds++,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=Ps.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}Es.closedBy=new Es({deserialize:t=>t.split(" ")}),Es.openedBy=new Es({deserialize:t=>t.split(" ")}),Es.group=new Es({deserialize:t=>t.split(" ")}),Es.isolate=new Es({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),Es.contextHash=new Es({perNode:!0}),Es.lookAhead=new Es({perNode:!0}),Es.mounted=new Es({perNode:!0});class Ls{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[Es.mounted.id]}}const Bs=Object.create(null);class Ps{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):Bs,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new Ps(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(Es.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(Es.group),n=-1;n<(i?i.length:0);n++){let r=e[n<0?t.name:i[n]];if(r)return r}}}}Ps.none=new Ps("",Object.create(null),0,8);class Ns{constructor(t){this.types=t;for(let e=0;e=e){let o=new qs(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[n])).push(_s(o,e,i,!1))}}return r?Js(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&zs.IncludeAnonymous)>0;for(let t=this.cursor(s|zs.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:eo(Ps.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new Hs(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new Hs(Ps.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=Ts,reused:s=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new Ws(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,w,v){let{id:y,start:k,end:b,size:x}=a,S=c;for(;x<0;){if(a.next(),-1==x){let e=s[y];return i.push(e),void m.push(k-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=k-t;if(b-k<=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=g(M.start,e,r);A=new Vs(e,b-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=b;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-r&&(d(e,i,k,s,a.end,l,n,S),s=e.length,l=a.end),a.next()):v>2500?f(k,t,e,i):u(k,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 Hs){if(!a&&r.type==t&&r.length==n)return r;(s=r.prop(Es.lookAhead))&&(o=i[a]+r.length+s)}return p(t,e,i,n,o)}}(C);A=eo(C,e,i,0,e.length,0,b-k,t,t)}else A=p(C,e,i,b-k,S-b)}i.push(A),m.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 Vs(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=[Es.contextHash,h];s=s?[t].concat(s):[t]}if(r>25){let t=[Es.lookAhead,r];s=s?[t].concat(s):[t]}return new Hs(t,e,i,n,s)}function g(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=g(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 m=[],w=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,w,-1,0);let v=null!==(e=t.length)&&void 0!==e?e:m.length?w[0]+m[0].length:0;return new Hs(l[t.topID],m.reverse(),w.reverse(),v)}(t)}}Hs.empty=new Hs(Ps.none,[],[],0);class Ws{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 Ws(this.buffer,this.index)}}class Vs{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return Ps.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 _s(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(Fs(n,i,h,h+l.length))if(l instanceof Vs){if(r&zs.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Us(new Gs(s,l,t,h),null,o)}else if(r&zs.IncludeAnonymous||!l.type.isAnonymous||Qs(l)){let o;if(!(r&zs.IgnoreMounts)&&(o=Ls.get(l))&&!o.overlay)return new qs(o.tree,h,t,s);let a=new qs(l,h,t,s);return r&zs.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(r&zs.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&zs.IgnoreOverlays)&&(n=Ls.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 qs(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 $s(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 Ks(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 Gs{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Us extends js{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 Us(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&zs.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 Us(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 Us(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 Us(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 Hs(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Js(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&zs.IncludeAnonymous||t instanceof Vs||!t.type.isAnonymous||Qs(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 Ks(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 Qs(t){return t.children.some((t=>t instanceof Vs||!t.type.isAnonymous||Qs(t)))}const Zs=new WeakMap;function to(t,e){if(!t.isAnonymous||e instanceof Vs||e.type!=t)return 1;let i=Zs.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof Hs)){i=1;break}i+=to(t,n)}Zs.set(e,i)}return i}function eo(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(eo(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 io{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 io(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 io(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),s.to>c)break;s=rnew Os(t.from,t.to))):[new Os(0,0)]:[new Os(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 ro{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 Es({perNode:!0});let so=0;class oo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=so++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new oo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new lo;return e=>e.modified.indexOf(t)>-1?e:lo.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let ao=0;class lo{constructor(){this.instances=[],this.id=ao++}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 oo(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(lo.get(e,t));return r}}function ho(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 uo(n,r,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return co.add(e)}const co=new Es;class uo{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 po(t,e,i,n=0,r=t.length){let s=new go(n,Array.isArray(e)?e:[e],i);s.highlightRange(t.cursor(),n,r,"",s.highlighters),s.flush(r)}uo.empty=new uo([],2,null);class go{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(co);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||uo.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(Es.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=g)&&t.nextSibling()););if(!p||g>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 mo=oo.define,wo=mo(),vo=mo(),yo=mo(vo),ko=mo(vo),bo=mo(),xo=mo(bo),So=mo(bo),Ao=mo(),Mo=mo(Ao),Co=mo(),To=mo(),Do=mo(),Oo=mo(Do),Eo=mo(),Lo={comment:wo,lineComment:mo(wo),blockComment:mo(wo),docComment:mo(wo),name:vo,variableName:mo(vo),typeName:yo,tagName:mo(yo),propertyName:ko,attributeName:mo(ko),className:mo(vo),labelName:mo(vo),namespace:mo(vo),macroName:mo(vo),literal:bo,string:xo,docString:mo(xo),character:mo(xo),attributeValue:mo(xo),number:So,integer:mo(So),float:mo(So),bool:mo(bo),regexp:mo(bo),escape:mo(bo),color:mo(bo),url:mo(bo),keyword:Co,self:mo(Co),null:mo(Co),atom:mo(Co),unit:mo(Co),modifier:mo(Co),operatorKeyword:mo(Co),controlKeyword:mo(Co),definitionKeyword:mo(Co),moduleKeyword:mo(Co),operator:To,derefOperator:mo(To),arithmeticOperator:mo(To),logicOperator:mo(To),bitwiseOperator:mo(To),compareOperator:mo(To),updateOperator:mo(To),definitionOperator:mo(To),typeOperator:mo(To),controlOperator:mo(To),punctuation:Do,separator:mo(Do),bracket:Oo,angleBracket:mo(Oo),squareBracket:mo(Oo),paren:mo(Oo),brace:mo(Oo),content:Ao,heading:Mo,heading1:mo(Mo),heading2:mo(Mo),heading3:mo(Mo),heading4:mo(Mo),heading5:mo(Mo),heading6:mo(Mo),contentSeparator:mo(Ao),list:mo(Ao),quote:mo(Ao),emphasis:mo(Ao),strong:mo(Ao),link:mo(Ao),monospace:mo(Ao),strikethrough:mo(Ao),inserted:mo(),deleted:mo(),changed:mo(),invalid:mo(),meta:Eo,documentMeta:mo(Eo),annotation:mo(Eo),processingInstruction:mo(Eo),definition:oo.defineModifier(),constant:oo.defineModifier(),function:oo.defineModifier(),standard:oo.defineModifier(),local:oo.defineModifier(),special:oo.defineModifier()};var Bo;fo([{tag:Lo.link,class:"tok-link"},{tag:Lo.heading,class:"tok-heading"},{tag:Lo.emphasis,class:"tok-emphasis"},{tag:Lo.strong,class:"tok-strong"},{tag:Lo.keyword,class:"tok-keyword"},{tag:Lo.atom,class:"tok-atom"},{tag:Lo.bool,class:"tok-bool"},{tag:Lo.url,class:"tok-url"},{tag:Lo.labelName,class:"tok-labelName"},{tag:Lo.inserted,class:"tok-inserted"},{tag:Lo.deleted,class:"tok-deleted"},{tag:Lo.literal,class:"tok-literal"},{tag:Lo.string,class:"tok-string"},{tag:Lo.number,class:"tok-number"},{tag:[Lo.regexp,Lo.escape,Lo.special(Lo.string)],class:"tok-string2"},{tag:Lo.variableName,class:"tok-variableName"},{tag:Lo.local(Lo.variableName),class:"tok-variableName tok-local"},{tag:Lo.definition(Lo.variableName),class:"tok-variableName tok-definition"},{tag:Lo.special(Lo.variableName),class:"tok-variableName2"},{tag:Lo.definition(Lo.propertyName),class:"tok-propertyName tok-definition"},{tag:Lo.typeName,class:"tok-typeName"},{tag:Lo.namespace,class:"tok-namespace"},{tag:Lo.className,class:"tok-className"},{tag:Lo.macroName,class:"tok-macroName"},{tag:Lo.propertyName,class:"tok-propertyName"},{tag:Lo.operator,class:"tok-operator"},{tag:Lo.comment,class:"tok-comment"},{tag:Lo.meta,class:"tok-meta"},{tag:Lo.invalid,class:"tok-invalid"},{tag:Lo.punctuation,class:"tok-punctuation"}]);const Po=new Es;const No=new Es;class Ro{constructor(t,e,i=[],n=""){this.data=t,this.name=n,yt.prototype.hasOwnProperty("tree")||Object.defineProperty(yt.prototype,"tree",{get(){return zo(this)}}),this.parser=e,this.extension=[Ko.of(this),yt.languageData.of(((t,e,i)=>{let n=Io(t,e,i),r=n.type.prop(Po);if(!r)return[];let s=t.facet(r),o=n.type.prop(No);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 Io(t,e,i).type.prop(Po)==this.data}findRegions(t){let e=t.facet(Ko);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(Po)==this.data)return void i.push({from:e,to:e+t.length});let r=t.prop(Es.mounted);if(r){if(r.tree.prop(Po)==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 Wo=null;class Vo{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 Vo(t,e,[],Hs.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Ho(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Hs.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(io.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Wo;Wo=this;try{return t()}finally{Wo=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Fo(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=io.applyChanges(i,e),n=Hs.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=Fo(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 no{createParse(e,i,n){let r=n[0].from,s=n[n.length-1].to;return{parsedPos:r,advance(){let e=Wo;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 Hs(Ps.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 Wo}}function Fo(t,e,i){return io.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class _o{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 _o(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Vo.create(t.facet(Ko).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new _o(i)}}Ro.state=_.define({create:_o.init,update(t,e){for(let t of e.effects)if(t.is(Ro.setState))return t.value;return e.startState.facet(Ko)!=e.state.facet(Ko)?_o.init(e.state):t.apply(e)}});let jo=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(jo=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const qo="undefined"!=typeof navigator&&(null===(Bo=navigator.scheduling)||void 0===Bo?void 0:Bo.isInputPending)?()=>navigator.scheduling.isInputPending():null,$o=yi.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(Ro.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(Ro.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=jo(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=r.context.work((()=>qo&&qo()||Date.now()>s),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Ro.setState.of(new _o(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()}}}),Ko=R.define({combine:t=>t.length?t[0]:null,enables:t=>[Ro.state,$o,Er.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Go{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Uo=R.define(),Jo=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 Yo(t){let e=t.facet(Jo);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Xo(t,e){let i="",n=t.tabSize,r=t.facet(Jo)[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 ea(n,t,i)}(t,i,e):null}class Zo{constructor(t,e={}){this.state=t,this.options=e,this.unit=Yo(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 ta=new Es;function ea(t,e,i){for(let n=t;n;n=n.next){let t=ia(n.node);if(t)return t(ra.create(e,i,n))}return 0}function ia(t){let e=t.type.prop(ta);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(Es.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.fromt.prop(Po)==s.data:s?t=>t==s:void 0,this.style=fo(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 oa(t,e||{})}}const aa=R.define(),la=R.define({combine:t=>t.length?[t[0]]:null});function ha(t){let e=t.facet(aa);return e.length?e:t.facet(la)}class ca{constructor(t){this.markCache=Object.create(null),this.tree=zo(t.state),this.decorations=this.buildDeco(t,ha(t.state))}update(t){let e=zo(t.state),i=ha(t.state),n=i!=ha(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=Ge.mark({class:n})))}),n,r);return i.finish()}}const ua=q.high(yi.fromClass(ca,{decorations:t=>t.decorations})),fa=(Lo.meta,Lo.link,Lo.heading,Lo.emphasis,Lo.strong,Lo.strikethrough,Lo.keyword,Lo.atom,Lo.bool,Lo.url,Lo.contentSeparator,Lo.labelName,Lo.literal,Lo.inserted,Lo.string,Lo.deleted,Lo.regexp,Lo.escape,Lo.string,Lo.variableName,Lo.variableName,Lo.typeName,Lo.namespace,Lo.className,Lo.variableName,Lo.macroName,Lo.propertyName,Lo.comment,Lo.invalid,Er.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),da=1e4,pa="()[]{}",ga=R.define({combine:t=>kt(t,{afterCursor:!0,brackets:pa,maxScanDistance:da,renderMatch:va})}),ma=Ge.mark({class:"cm-matchingBracket"}),wa=Ge.mark({class:"cm-nonmatchingBracket"});function va(t){let e=[],i=t.matched?ma:wa;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 ya=_.define({create:()=>Ge.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(ga);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=Ma(e.state,t.head,-1,n)||t.head>0&&Ma(e.state,t.head-1,1,n)||n.afterCursor&&(Ma(e.state,t.head,1,n)||t.headEr.decorations.from(t)}),ka=[ya,fa];function ba(t={}){return[ga.of(t),ka]}const xa=new Es;function Sa(t,e,i){let n=t.prop(e<0?Es.openedBy:Es.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 Aa(t){let e=t.type.prop(xa);return e?e(t.node):t}function Ma(t,e,i,n={}){let r=n.maxScanDistance||da,s=n.brackets||pa,o=zo(t),a=o.resolveInner(e,i);for(let t=a;t;t=t.parent){let n=Sa(t.type,i,s);if(n&&t.from0?e>=r.from&&er.from&&e<=r.to))return Ca(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 Ca(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 Oa(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 Ea=new WeakMap;class La extends Ro{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||Oa,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||Ia};var r,s;super(i,new class extends no{createParse(t,i,n){return new Na(e,t,i,n)}},[Uo.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=Ps.define({id:za.length,name:"Document",props:[Po.add((()=>t))],top:!0});return za.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new Es({perNode:!0}),this.tokenTable=t.tokenTable?new _a(n.tokenTable):ja}static define(t){return new La(t)}getIndent(t,e){let i,n=zo(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=Ea.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 Hs&&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&&Ba(t,n.tree,0-n.offset,i,s);if(o&&(e=Pa(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?Yo(n):4),tree:Hs.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 Da(e,t?t.state.tabSize:4,t?Yo(t.state):2);if(s.eol())r.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let t=Ra(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 Ia=Object.create(null),za=[Ps.none],Ha=new Ns(za),Wa=[],Va=Object.create(null),Fa=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"]])Fa[t]=$a(Ia,e);class _a{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Fa)}resolve(t){return t?this.table[t]||(this.table[t]=$a(this.extra,t)):0}}const ja=new _a(Ia);function qa(t,e){Wa.indexOf(t)>-1||(Wa.push(t),console.warn(e))}function $a(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||Lo[i];n?"function"==typeof n?e.length?e=e.map(n):qa(i,`Modifier ${i} used at start of tag`):e.length?qa(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:qa(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=Va[r];if(s)return s.id;let o=Va[r]=Ps.define({id:za.length,name:n,props:[ho({[n]:i})]});return za.push(o),o.id}function Ka(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 Ga=Ka(Za,0),Ua=Ka(Qa,0),Ja=Ka(((t,e)=>Qa(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 Ya(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const Xa=50;function Qa(t,e,i=e.selection.ranges){let n=i.map((t=>Ya(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-Xa,n),l=t.sliceDoc(r,r+Xa),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*Xa?s=o=t.sliceDoc(n,r):(s=t.sliceDoc(n,n+Xa),o=t.sliceDoc(r-Xa,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 tl=st.define(),el=st.define(),il=R.define(),nl=R.define({combine:t=>kt(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)})}),rl=_.define({create:()=>bl.empty,update(t,e){let i=e.state.facet(nl),n=e.annotation(tl);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=ul.fromTransaction(e,r),o=n.side,a=0==o?t.undone:t.done;return a=s?fl(a,a.length,i.minDepth,s):ml(a,e.startState.selection),new bl(0==o?n.rest:a,0==o?a:n.rest)}let r=e.annotation(el);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=ul.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 bl(t.done.map(ul.fromJSON),t.undone.map(ul.fromJSON))});function sl(t={}){return[rl,nl.of(t),Er.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?al:"historyRedo"==t.inputType?ll:null;return!!i&&(t.preventDefault(),i(e))}})]}function ol(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(rl,!1);if(!r)return!1;let s=r.pop(t,i,e);return!!s&&(n(s),!0)}}const al=ol(0,!1),ll=ol(1,!1),hl=ol(0,!0),cl=ol(1,!0);class ul{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 ul(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 ul(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=pl;for(let e of t.startState.facet(il)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new ul(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,pl)}static selection(t){return new ul(void 0,pl,void 0,void 0,t)}}function fl(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 dl(t,e){return t.length?e.length?t.concat(e):t:e}const pl=[],gl=200;function ml(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-gl));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),fl(t,t.length-1,1e9,i.setSelAfter(n)))}return[ul.selection([e])]}function wl(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 vl(t,e){if(!t.length)return t;let i=t.length,n=pl;for(;i;){let r=yl(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?[ul.selection(n)]:pl}function yl(t,e,i){let n=dl(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):pl,i);if(!t.changes)return ul.selection(n);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new ul(r,lt.mapEffects(t.effects,e),o,t.startSelection.map(s),n)}const kl=/^(input\.type|delete)($|\.)/;class bl{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 bl(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||kl.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)?fl(s,s.length-1,n.minDepth,new ul(t.changes.compose(o.changes),dl(t.effects,o.effects),o.mapped,o.startSelection,pl)):fl(s,s.length,n.minDepth,t),new bl(s,pl,e,i)}addSelection(t,e,i,n){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:pl;return r.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new bl(ml(this.done,t),this.undone,e,i);var s,o}addMapping(t){return new bl(vl(this.done,t),vl(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:tl.of({side:t,rest:wl(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let i=1==n.length?pl:n.slice(0,n.length-1);return r.mapped&&(i=vl(i,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:tl.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}bl.empty=new bl(pl,pl);const xl=[{key:"Mod-z",run:al,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ll,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ll,preventDefault:!0},{key:"Mod-u",run:hl,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:cl,preventDefault:!0}];function Sl(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function Al(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Ml({state:t,dispatch:e},i){let n=Sl(t.selection,i);return!n.eq(t.selection)&&(e(Al(t,n)),!0)}function Cl(t,e){return B.cursor(e?t.to:t.from)}function Tl(t,e){return Ml(t,(i=>i.empty?t.moveByChar(i,e):Cl(i,e)))}function Dl(t){return t.textDirectionAt(t.state.selection.main.head)==Bi.LTR}const Ol=t=>Tl(t,!Dl(t)),El=t=>Tl(t,Dl(t));function Ll(t,e){return Ml(t,(i=>i.empty?t.moveByGroup(i,e):Cl(i,e)))}function Bl(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 Pl(t,e,i){let n,r,s=zo(t).resolveInner(e.head),o=i?Es.closedBy:Es.openedBy;for(let n=e.head;;){let e=i?s.childAfter(n):s.childBefore(n);if(!e)break;Bl(t,e,o)?s=e:n=i?e.to:e.from}return r=s.type.prop(o)&&(n=i?Ma(t,s.from,1):Ma(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 Nl(t,e){return Ml(t,(i=>{if(!i.empty)return Cl(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const Rl=t=>Nl(t,!1),Il=t=>Nl(t,!0);function zl(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Cl(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.bottomHl(t,!1),Vl=t=>Hl(t,!0);function Fl(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 _l(t,e){let i=Sl(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(Al(t.state,i)),!0)}function jl(t,e){return _l(t,(i=>t.moveByChar(i,e)))}const ql=t=>jl(t,!Dl(t)),$l=t=>jl(t,Dl(t));function Kl(t,e){return _l(t,(i=>t.moveByGroup(i,e)))}function Gl(t,e){return _l(t,(i=>t.moveVertically(i,e)))}const Ul=t=>Gl(t,!1),Jl=t=>Gl(t,!0);function Yl(t,e){return _l(t,(i=>t.moveVertically(i,e,zl(t).height)))}const Xl=t=>Yl(t,!1),Ql=t=>Yl(t,!0),Zl=({state:t,dispatch:e})=>(e(Al(t,{anchor:0})),!0),th=({state:t,dispatch:e})=>(e(Al(t,{anchor:t.doc.length})),!0),eh=({state:t,dispatch:e})=>(e(Al(t,{anchor:t.selection.main.anchor,head:0})),!0),ih=({state:t,dispatch:e})=>(e(Al(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function nh(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=rh(t,n,!0)),r=Math.min(r,n),s=Math.max(s,n)}else r=rh(t,r,!1),s=rh(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?Er.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function rh(t,e,i){if(t instanceof Er)for(let n of t.state.facet(Er.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const sh=(t,e)=>nh(t,(i=>{let n,r,{state:s}=t,o=s.doc.lineAt(i);if(!e&&i>o.from&&ish(t,!1),ah=t=>sh(t,!0),lh=(t,e)=>nh(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})),hh=t=>lh(t,!1),ch=t=>nh(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 fh(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let e of uh(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 dh(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of uh(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 ph=gh(!1);function gh(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=zo(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Es.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 Zo(i,{simulateBreak:r,simulateDoubleBreak:!!a}),h=Qo(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 wh=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>Ml(t,(e=>Pl(t.state,e,!Dl(t)))),shift:t=>_l(t,(e=>Pl(t.state,e,!Dl(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>Ml(t,(e=>Pl(t.state,e,Dl(t)))),shift:t=>_l(t,(e=>Pl(t.state,e,Dl(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>fh(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>dh(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>fh(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>dh(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(Al(t,n)),!0)}},{key:"Mod-Enter",run:gh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=uh(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=Sl(t.selection,(e=>{var i;let n=zo(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(Al(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(mh(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let r=zt(n,t.tabSize),s=0,o=Xo(t,Math.max(0,r-Yo(t)));for(;s!t.readOnly&&(e(t.update(mh(t,((e,i)=>{i.push({from:e.from,insert:t.facet(Jo)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Zo(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),r=mh(t,((e,r,s)=>{let o=Qo(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Xo(t,o);(a!=l||s.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(uh(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=Sl(t.selection,(e=>{let r=Ma(t,e.head,-1)||Ma(t,e.head,1)||e.head>0&&Ma(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Ya(t.state,i.from);return n.line?Ga(t):!!n.block&&Ja(t)}},{key:"Alt-A",run:Ua}].concat([{key:"ArrowLeft",run:Ol,shift:ql,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Ll(t,!Dl(t)),shift:t=>Kl(t,!Dl(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>Ml(t,(e=>Fl(t,e,!Dl(t)))),shift:t=>_l(t,(e=>Fl(t,e,!Dl(t)))),preventDefault:!0},{key:"ArrowRight",run:El,shift:$l,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Ll(t,Dl(t)),shift:t=>Kl(t,Dl(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>Ml(t,(e=>Fl(t,e,Dl(t)))),shift:t=>_l(t,(e=>Fl(t,e,Dl(t)))),preventDefault:!0},{key:"ArrowUp",run:Rl,shift:Ul,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Zl,shift:eh},{mac:"Ctrl-ArrowUp",run:Wl,shift:Xl},{key:"ArrowDown",run:Il,shift:Jl,preventDefault:!0},{mac:"Cmd-ArrowDown",run:th,shift:ih},{mac:"Ctrl-ArrowDown",run:Vl,shift:Ql},{key:"PageUp",run:Wl,shift:Xl},{key:"PageDown",run:Vl,shift:Ql},{key:"Home",run:t=>Ml(t,(e=>Fl(t,e,!1))),shift:t=>_l(t,(e=>Fl(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:Zl,shift:eh},{key:"End",run:t=>Ml(t,(e=>Fl(t,e,!0))),shift:t=>_l(t,(e=>Fl(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:th,shift:ih},{key:"Enter",run:ph},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:oh,shift:oh},{key:"Delete",run:ah},{key:"Mod-Backspace",mac:"Alt-Backspace",run:hh},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>lh(t,!0)},{mac:"Mod-Backspace",run:t=>nh(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:ch}].concat([{key:"Ctrl-b",run:Ol,shift:ql,preventDefault:!0},{key:"Ctrl-f",run:El,shift:$l},{key:"Ctrl-p",run:Rl,shift:Ul},{key:"Ctrl-n",run:Il,shift:Jl},{key:"Ctrl-a",run:t=>Ml(t,(e=>B.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>_l(t,(e=>B.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>Ml(t,(e=>B.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>_l(t,(e=>B.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:ah},{key:"Ctrl-h",run:oh},{key:"Ctrl-k",run:ch},{key:"Ctrl-Alt-h",run:hh},{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:Vl}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function vh(){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 bh{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(kh(t)):kh,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+=k(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=Dh(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 Ch(e,t.sliceString(e,i));return Mh.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=Dh(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ch.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Dh(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Oh(t){let e=vh("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:[Eh.of(!1),Er.scrollIntoView(f.from,{y:"center"})],selection:f}),t.focus()}return{dom:vh("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Eh.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},vh("label",t.state.phrase("Go to line"),": ",e)," ",vh("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Ah.prototype[Symbol.iterator]=Th.prototype[Symbol.iterator]=function(){return this});const Eh=lt.define(),Lh=_.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Eh)&&(t=i.value);return t},provide:t=>ss.from(t,(t=>t?Oh:null))}),Bh=Er.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Ph=R.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new lc(t),scrollToMatch:t=>Er.scrollIntoView(t)})});class Nh{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,Sh),!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 Fh(this):new zh(this)}getCursor(t,e=0,i){let n=t.doc?t:yt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?Hh(this,n,e,i):Ih(this,n,e,i)}}class Rh{constructor(t){this.spec=t}}function Ih(t,e,i,n){return new bh(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=Ih(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 Hh(t,e,i,n){return new Ah(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(r(Wh(i.input,i.index))!=mt.Word||r(Vh(i.input,i.index))!=mt.Word)&&(r(Vh(i.input,i.index+i[0].length))!=mt.Word||r(Wh(i.input,i.index+i[0].length))!=mt.Word)):void 0},i,n);var r}function Wh(t,e){return t.slice(d(t,e,!1),e)}function Vh(t,e){return t.slice(e,d(t,e))}class Fh extends Rh{nextMatch(t,e,i){let n=Hh(this.spec,t,i,t.doc.length).next();return n.done&&(n=Hh(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=Hh(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=Hh(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 _h=lt.define(),jh=lt.define(),qh=_.define({create:t=>new $h(ic(t).create(),null),update(t,e){for(let i of e.effects)i.is(_h)?t=new $h(i.value.create(),t.panel):i.is(jh)&&(t=new $h(t.query,i.value?ec:null));return t},provide:t=>ss.from(t,(t=>t.panel))});class $h{constructor(t,e){this.query=t,this.panel=e}}const Kh=Ge.mark({class:"cm-searchMatch"}),Gh=Ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Uh=yi.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(qh))}update(t){let e=t.state.field(qh);(e!=t.startState.field(qh)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ge.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?Gh:Kh)}))}return n.finish()}},{decorations:t=>t.decorations});function Jh(t){return e=>{let i=e.state.field(qh,!1);return i&&i.query.spec.valid?t(e,i):sc(e)}}const Yh=Jh(((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(Ph);return t.dispatch({selection:r,effects:[fc(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),rc(t),!0})),Xh=Jh(((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(Ph);return t.dispatch({selection:s,effects:[fc(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),rc(t),!0})),Qh=Jh(((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))})),Zh=Jh(((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(Er.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(fc(t,s)),h.push(i.facet(Ph).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),tc=Jh(((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:Er.announce.of(n),userEvent:"input.replace.all"}),!0}));function ec(t){return t.state.facet(Ph).createPanel(t)}function ic(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(Ph);return new Nh({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 nc(t){let e=es(t,ec);return e&&e.dom.querySelector("[main-field]")}function rc(t){let e=nc(t);e&&e==t.root.activeElement&&e.select()}const sc=t=>{let e=t.state.field(qh,!1);if(e&&e.panel){let i=nc(t);if(i&&i!=t.root.activeElement){let n=ic(t.state,e.query.spec);n.valid&&t.dispatch({effects:_h.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[jh.of(!0),e?_h.of(ic(t.state,e.query.spec)):lt.appendConfig.of(pc)]});return!0},oc=t=>{let e=t.state.field(qh,!1);if(!e||!e.panel)return!1;let i=es(t,ec);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:jh.of(!1)}),!0},ac=[{key:"Mod-f",run:sc,scope:"editor search-panel"},{key:"F3",run:Yh,shift:Xh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Yh,shift:Xh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:oc,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 bh(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=es(t,Oh);if(!e){let i=[Eh.of(!0)];null==t.state.field(Lh,!1)&&i.push(lt.appendConfig.of([Lh,Bh])),t.dispatch({effects:i}),e=es(t,Oh)}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 bh(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 bh(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:Er.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class lc{constructor(t){this.view=t;let e=this.query=t.state.field(qh).query.spec;function i(t,e,i){return vh("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=vh("input",{value:e.search,placeholder:hc(t,"Find"),"aria-label":hc(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=vh("input",{value:e.replace,placeholder:hc(t,"Replace"),"aria-label":hc(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=vh("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=vh("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=vh("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=vh("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>Yh(t)),[hc(t,"next")]),i("prev",(()=>Xh(t)),[hc(t,"previous")]),i("select",(()=>Qh(t)),[hc(t,"all")]),vh("label",null,[this.caseField,hc(t,"match case")]),vh("label",null,[this.reField,hc(t,"regexp")]),vh("label",null,[this.wordField,hc(t,"by word")]),...t.state.readOnly?[]:[vh("br"),this.replaceField,i("replace",(()=>Zh(t)),[hc(t,"replace")]),i("replaceAll",(()=>tc(t)),[hc(t,"replace all")])],vh("button",{name:"close",onclick:()=>oc(t),"aria-label":hc(t,"close"),type:"button"},["×"])])}commit(){let t=new Nh({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:_h.of(t)}))}keydown(t){var e,i;i=t,jr(Vr((e=this.view).state),i,e,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Xh:Yh)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),Zh(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(_h)&&!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(Ph).top}}function hc(t,e){return t.state.phrase(e)}const cc=30,uc=/[\s\.,:;?!]/;function fc(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-cc),o=Math.min(r,i+cc),a=t.state.sliceDoc(s,o);if(s!=n.from)for(let t=0;ta.length-cc;t--)if(!uc.test(a[t-1])&&uc.test(a[t])){a=a.slice(0,t);break}return Er.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const dc=Er.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"}}),pc=[qh,q.low(Uh),dc];function gc(t){return gc="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},gc(t)}function mc(t){return function(t){if(Array.isArray(t))return wc(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 wc(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)?wc(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 wc(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&&Ac(t,e)}(e,t),i=e,(n=[{key:"setCodeMirrorPreference",value:function(t){this.useCodeMirror=t,xc(Sc(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(mc(this.defaultExtensions),[this.langExtension,ba(),sl(),Er.contentAttributes.of({spellcheck:"true"}),Er.domEventHandlers({blur:function(){return t.$textarea.triggerHandler("blur")},focus:function(){return t.$textarea.triggerHandler("focus")}}),Er.updateListener.of((function(e){e.docChanged&&"function"==typeof t.editRecoveryHandler&&t.editRecoveryHandler()})),Er.lineWrapping,Hr.of([].concat(mc(wh),mc(ac),mc(xl)))]);mw.hook("editRecovery.loadEnd").add((function(e){t.editRecoveryHandler=e.fieldChangeHandler})),this.initialize(s),this.view.scrollDOM.scrollTop=n,this.view.dispatch({selection:B.create([B.range(e,i)]),scrollIntoView:!0}),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.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})}}])&&vc(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),e}(Cs);function Cc(t){return Cc="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},Cc(t)}function Tc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);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=Rc.tokenTable,Object.keys(this.config.tags).forEach((function(t){return Rc.addTag(t)}))}var e,i;return e=t,i=[{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(";"))?Rc.tags.htmlEntity:e}},{key:"makeStyle",value:function(t,e,i){return this.isBold&&(t+=" "+Rc.tags.strong),this.isItalic&&(t+=" "+Rc.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(Rc.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(Rc.tags.sectionHeader)):i.match(/^.*?=)/,!1)&&(i.backUp(t),n.tokenize=e.eatBlock(Rc.tags.sectionHeader,"\x3c!--",!1)),Rc.tags.section):e.eatWikiText(Rc.tags.section)(i,n)}}},{key:"inVariable",value:function(t,e){return t.match(/^[^{}|]+/)?this.makeLocalStyle(Rc.tags.templateVariableName,e):t.eat("|")?(e.tokenize=this.inVariableDefault.bind(this),this.makeLocalStyle(Rc.tags.templateVariableDelimiter,e)):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.tags.templateVariableBracket,e)):t.match("{{{")?(e.stack.push(e.tokenize),this.makeLocalStyle(Rc.tags.templateVariableBracket,e)):(t.next(),this.makeLocalStyle(Rc.tags.templateVariableName,e))}},{key:"inVariableDefault",value:function(t,e){return t.match(/^[^{}[<&~]+/)?this.makeLocalStyle(Rc.tags.templateVariable,e):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.tags.templateVariableBracket,e)):this.eatWikiText(Rc.tags.templateVariable)(t,e)}},{key:"inParserFunctionName",value:function(t,e){return t.match(/^#?[^:}{~]+/)?this.makeLocalStyle(Rc.tags.parserFunctionName,e):t.eat(":")?(e.tokenize=this.inParserFunctionArguments.bind(this),this.makeLocalStyle(Rc.tags.parserFunctionDelimiter,e)):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Rc.tags.parserFunction)(t,e)}},{key:"inParserFunctionArguments",value:function(t,e){return t.match(/^[^|}{[<&~]+/)?this.makeLocalStyle(Rc.tags.parserFunction,e):t.eat("|")?this.makeLocalStyle(Rc.tags.parserFunctionDelimiter,e):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Rc.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(Rc.tags.templateDelimiter,n)):i.match(/^[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Rc.tags.templateBracket,n,"nTemplate")):i.match(/^[\s\u00a0]*/)?e.makeLocalStyle(Rc.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(Rc.tags.templateName,n)):i.eatSpace()?(i.eol(),e.makeLocalStyle(Rc.tags.templateName,n)):e.eatWikiText(Rc.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(Rc.tags.templateArgumentName,n)):e.makeLocalStyle(Rc.tags.template,n):i.eatWhile(/[^|}{[<&~]/)?e.makeLocalStyle(Rc.tags.template,n):i.eat("|")?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(Rc.tags.templateDelimiter,n)):i.match("}}")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Rc.tags.templateBracket,n,"nTemplate")):e.eatWikiText(Rc.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(Rc.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(Rc.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(Rc.tags.extLink,e)):this.eatWikiText(Rc.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(Rc.tags.extLinkBracket,e,"nLink")):t.match(/^[^'\]{&~<]+/)?this.makeStyle(Rc.tags.extLinkText,e):this.eatWikiText(Rc.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(Rc.tags.link,e)):t.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Rc.tags.linkDelimiter,e)):t.match(/^[\s\u00a0]*\]\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.tags.linkBracket,e,"nLink")):t.match(/^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/)||t.eatSpace()?this.makeStyle("".concat(Rc.tags.linkPageName," ").concat(Rc.tags.pageName),e):this.eatWikiText("".concat(Rc.tags.linkPageName," ").concat(Rc.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(Rc.tags.linkToSection,e):t.eat("|")?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Rc.tags.linkDelimiter,e)):t.match("]]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.tags.linkBracket,e,"nLink")):this.eatWikiText(Rc.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(Rc.tags.linkBracket,r,"nLink")):n.match("'''")?(t=!t,i.makeLocalStyle("".concat(Rc.tags.linkText," ").concat(Rc.tags.apostrophes),r)):n.match("''")?(e=!e,i.makeLocalStyle("".concat(Rc.tags.linkText," ").concat(Rc.tags.apostrophes),r)):(s=Rc.tags.linkText,t&&(s+=" "+Rc.tags.strong),e&&(s+=" "+Rc.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&&!Rc.implicitlyClosedHtmlTags[o]?s.tokenize=n.eatChar(">",Rc.tags.htmlTagBracket):s.tokenize=n.eatHtmlTagAttribute(o),n.makeLocalStyle(Rc.tags.htmlTagName,s)):(s.tokenize=e?n.eatChar(">","".concat(Rc.tags.extTagBracket," mw-ext-").concat(o)):n.eatExtTagAttribute(o),n.makeLocalStyle("".concat(Rc.tags.extTagName," mw-ext-").concat(o),s))}}},{key:"eatHtmlTagAttribute",value:function(t){var e=this;return function(i,n){return i.match(/^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/)?e.makeLocalStyle(Rc.tags.htmlTagAttribute,n):i.eat(">")?(t in Rc.implicitlyClosedHtmlTags||n.inHtmlTag.push(t),n.tokenize=n.stack.pop(),e.makeLocalStyle(Rc.tags.htmlTagBracket,n)):i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Rc.tags.htmlTagBracket,n)):e.eatWikiText(Rc.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(Rc.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(Rc.tags.extTagBracket," mw-ext-").concat(t),n)}return i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle("".concat(Rc.tags.extTagBracket," mw-ext-").concat(t),n)):e.eatWikiText("".concat(Rc.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(Rc.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=Rc.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),Rc.tags.tableBracket}},{key:"inTableDefinition",value:function(t,e){return t.sol()?(e.tokenize=this.inTable.bind(this),this.inTable(t,e)):this.eatWikiText(Rc.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(Rc.tags.tableDelimiter,e)):t.eat("+")?(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1,!0),this.makeLocalStyle(Rc.tags.tableDelimiter,e)):t.eat("}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.tags.tableBracket,e)):(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1),this.makeLocalStyle(Rc.tags.tableDelimiter,e));if(t.eat("!"))return t.eatSpace(),e.tokenize=this.eatTableRow(!0,!0),this.makeLocalStyle(Rc.tags.tableDelimiter,e)}return this.eatWikiText("")(t,e)}},{key:"eatTableRow",value:function(t,e,i){var n=this,r="";return i?r=Rc.tags.tableCaption:e&&(r=Rc.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(Rc.tags.tableDelimiter,o);if(t&&s.eat("|"))return o.tokenize=n.eatTableRow(!1,e,i),n.makeLocalStyle(Rc.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(Rc.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(Rc.tags.freeExtLink,e)}else if("{"===t.peek()){if(!t.match("{{",!1))return t.next(),this.makeLocalStyle(Rc.tags.freeExtLink,e)}else if("'"===t.peek()){if(!t.match("''",!1))return t.next(),this.makeLocalStyle(Rc.tags.freeExtLink,e)}else if(t.match(/^[).,]+(?=[^\s\u00a0{[\]<>~).,])/))return this.makeLocalStyle(Rc.tags.freeExtLink,e);return e.tokenize=e.stack.pop(),this.makeLocalStyle(Rc.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(Rc.tags.freeExtLinkProtocol,n);switch(r=i.next()){case"-":if(i.match(/^---+/))return Rc.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),Rc.tags.sectionHeader+" "+Rc.tags["sectionHeader".concat(s[1].length+1)];break;case"*":case"#":case";":return i.match(/^[*#;:]*/),Rc.tags.list;case":":return i.match(/^:*{\|/,!1)&&(n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e)),i.match(/^[*#;:]*/),Rc.tags.indenting;case" ":if(!i.match(/^[\s\u00a0]*:*{\|/,!1))return Rc.tags.skipFormatting;if(i.eatSpace(),i.match(/^:+/))return n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e),Rc.tags.indenting;i.eat("{");case"{":if(i.eat("|"))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inTableDefinition.bind(e),Rc.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(Rc.tags.apostrophesBold,n);if(i.eat("'"))return e.isItalic=!e.isItalic,e.makeLocalStyle(Rc.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(Rc.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(Rc.tags.extLinkBracket,n);break;case"{":if(i.match(/^{{(?!{|[^{}]*}}(?!}))/))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inVariable.bind(e),e.makeLocalStyle(Rc.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(Rc.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(Rc.tags.templateBracket,n)):(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(Rc.tags.parserFunctionBracket,n));break;case"<":if(l=!!i.eat("/"),h=i.match(/^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/),i.match("!--"))return c=e.eatBlock(Rc.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?Rc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l,!1),e.makeLocalStyle("".concat(Rc.tags.extTagBracket," mw-ext-").concat(h),n));if(h in Rc.permittedHtmlTags)return!0===l&&h!==n.inHtmlTag.pop()?(i.pos++,Rc.tags.error):!0===l&&h in Rc.implicitlyClosedHtmlTags?Rc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l||h in Rc.implicitlyClosedHtmlTags,!0),e.makeLocalStyle(Rc.tags.htmlTagBracket,n));i.backUp(h.length)}break;case"~":if(i.match(/^~{2,4}/))return Rc.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]?Rc.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&&zc(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();mw.loader.getState("ext.wikiEditor")&&mw.hook("wikiEditor.toolbarReady").add((function(t){new Mc(t,function(){var t=new Wc((arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||mw.config.get("extCodeMirrorConfig")).mediawiki,e=La.define(t),i=function(t,e){let i,n=[ua];return t instanceof oa&&(t.module&&n.push(Er.styleModule.of(t.module)),i=t.themeType),i?n.push(aa.computeN([Er.darkTheme],(e=>e.facet(Er.darkTheme)==("dark"==i)?[t]:[]))):n.push(aa.of(t)),n}(oa.define(Rc.getTagStyles(t)));return new Go(e,i)}()).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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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+=k(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 k(t){return t<65536?1:2}const b=/\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 D(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||b)):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 D(t,e,i,n=!1){let r=[],s=n?[]:null,o=new L(t),a=new L(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 L{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 E{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 E(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 E(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=>E.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 R=0;class N{constructor(t,e,i,n,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}static define(t={}){return new N(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=R++}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)||W(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 N?e.facet(i)===t.facet(i):!(i instanceof _)||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 q(t){return e=>new K(e,t)}const j={highest:q(0),high:q(1),default:q(2),low:q(3),lowest:q(4)};class K{constructor(t,e){this.inner=t,this.prec=e}}class G{of(t){return new U(this,t)}reconfigure(t){return G.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class U{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 U&&i.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let e of s)t(e,o);else if(s instanceof U){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 _)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 _?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=>V(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=N.define(),Z=N.define({combine:t=>t.some((t=>t)),static:!0}),tt=N.define({combine:t=>t.length?t[0]:void 0,static:!0}),et=N.define(),it=N.define(),nt=N.define(),rt=N.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)||b)),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=N.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,G.reconfigure=lt.define();class bt{eq(t){return this==t}range(t,e=t){return xt.create(t,e,this)}}bt.prototype.startSide=bt.prototype.endSide=0,bt.prototype.point=!1,bt.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 Dt(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 Ot.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Ot.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 Et(s,a,r),h=new Et(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 Et(r,o,0).goto(i),l=new Et(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 Et(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 Dt(s,e,i,r));return 1==n.length?n[0]:new Ot(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--)Lt(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--)Lt(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(),Lt(this.heap,0)}}}function Lt(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 Et{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=Ot.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){Rt(this.active,t),Rt(this.activeTo,t),Rt(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&&Rt(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=Vt[Ht]||1;return Vt[Ht]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[Wt],r=i&&i.nonce;n?r&&n.setNonce(r):n=new qt(t,r),n.mount(Array.isArray(e)?e:[e])}}let _t=new Map;class qt{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=_t.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[Wt]=e;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],_t.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[Wt]=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),Gt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ut=0;Ut<10;Ut++)jt[48+Ut]=jt[96+Ut]=String(Ut);for(Ut=1;Ut<=24;Ut++)jt[Ut+111]="F"+Ut;for(Ut=65;Ut<=90;Ut++)jt[Ut]=String.fromCharCode(Ut+32),$t[Ut]=String.fromCharCode(Ut);for(var Jt in jt)$t.hasOwnProperty(Jt)||($t[Jt]=jt[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?ce(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}}class oe{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 ae,le=null;function he(t){if(t.setActive)return t.setActive();if(le)return t.focus(le);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==le?{get preventScroll(){return le={preventScroll:!0},!0}}:void 0),!le){le=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}class pe{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new pe(t.parentNode,ee(t),e)}static after(t,e){return new pe(t.parentNode,ee(t)+1,e)}}const me=[];class ge{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=ge.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=we(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=we(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&&!ge.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=me){this.markDirty();for(let i=t;ithis.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 ye(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 Be={mac:Ee||/Mac/.test(be.platform),windows:/Win/.test(be.platform),linux:/Linux|X11/.test(be.platform),ie:Ce,ie_version:Ae?xe.documentMode||6:Me?+Me[1]:Se?+Se[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(be.userAgent)||[0,0])[1]:0,chrome:!!De,chrome_version:De?+De[1]:0,ios:Ee,android:/Android\b/.test(be.userAgent),webkit:Oe,safari:Le,webkit_version:Oe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=xe.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Pe extends ge{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 Pe)||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 Pe(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 pe(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?Be.chrome||Be.gecko||(e?(r--,o=1):s=0)?0:a.length-1];return Be.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 ge{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(fe(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 ze(this,t)}coordsAt(t,e){return We(this,t,e)}}class Ne extends ge{static create(t,e,i){return new Ne(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Ne.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 Ne&&this.widget.compare(i.widget))||t>0&&r<=0||e0)?pe.before(this.dom):pe.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?pe.before(this.dom):pe.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 ze(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)?He(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 je(t){let e=Object.create(null);for(let i=0;i0?3e8:-4e8:e>0?1e8:-1e8,new Ye(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}=Xe(t,n);e=(r?n?-3e8:-1:5e8)-1,i=1+(s?n?2e8:1:-6e8)}return new Ye(t,e,i,n,t.widget||null,!0)}static line(t){return new Je(t)}static set(t,e=!1){return Mt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Ge.none=Mt.empty;class Ue extends Ge{constructor(t){let{start:e,end:i}=Xe(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 Ue&&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)}}Ue.prototype.point=!1;class Je extends Ge{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Je&&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)}}Je.prototype.mapMode=x.TrackBefore,Je.prototype.point=!0;class Ye extends Ge{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=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Ye&&((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 Xe(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 Qe(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)}Ye.prototype.point=!0;class Ze extends ge{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,n,r,s){if(i){if(!(i instanceof Ze))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),ke(this,t,e,i?i.children:[],r,s),!0}split(t){let e=new Ze;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:n}=this.childPos(t);n&&(e.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let t=i;t0&&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){He(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Ve(e,this.attrs||{})),i&&(this.attrs=Ve({class:i},this.attrs||{}))}domAtPos(t){return ze(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(fe(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&&ge.get(n)instanceof Re;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=ge.get(n))||void 0===i?void 0:i.isEditable)||Be.ios&&this.children.some((t=>t instanceof Pe))))){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 Pe)||/[^ -~]/.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 Ze)return r;if(s>e)break}n=s+r.breakAfter}return null}}class ti extends ge{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof ti&&this.widget.compare(i.widget))||t>0&&r<=0||e0;){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(ii(new Pe(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 Ye){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 Ye)if(i.block){let{type:t}=i;t!=Ke.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ti(i.widget||new ni("div"),o,t))}else{let s=Ne.create(i.widget||new ni("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(ii(new Ie(1),n),r),r=n.length+Math.max(0,r-n.length)),h.append(ii(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 ei(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 ii(t,e){for(let i of e)t=new Re(i,[t],t.length);return t}class ni extends $e{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 ri=N.define(),si=N.define(),oi=N.define(),ai=N.define(),li=N.define(),hi=N.define(),ci=N.define(),ui=N.define({combine:t=>t.some((t=>t))}),fi=N.define({combine:t=>t.some((t=>t))});class di{constructor(t,e="nearest",i="nearest",n=5,r=5){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r}map(t){return t.empty?this:new di(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const pi=lt.define({map:(t,e)=>t.map(e)});function mi(t,e,i){let n=t.facet(ai);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 gi=N.define({combine:t=>!t.length||t[0]});let wi=0;const vi=N.define();class yi{constructor(t,e,i,n){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=n(this)}static define(t,e){const{eventHandlers:i,provide:n,decorations:r}=e||{};return new yi(wi++,t,i,(t=>{let e=[vi.of(t)];return r&&e.push(Si.of((e=>{let i=e.plugin(t);return i?r(i):Ge.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return yi.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(mi(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){mi(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){mi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const bi=N.define(),xi=N.define(),Si=N.define(),Ai=N.define(),Mi=N.define();function Ci(t,e,i){let n=t.state.facet(Mi);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 Ti=N.define();function Di(t){let e=0,i=0,n=0,r=0;for(let s of t.state.facet(Ti)){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 Oi=N.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 Ei{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 Ei(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 Bi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Bi||(Bi={}));const Pi=Bi.LTR,Ri=Bi.RTL;function Ni(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 Fi(l,p.from,f)),$i(t,p.direction==Pi!=!(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?ji(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),ji(t,r,s,e,i,n,o)}function Ki(t){return[new Fi(0,t,0)]}let Gi="";function Ui(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=Fi.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.side(r,i))return B.cursor(c+t.from,h?-1:1,l.level);let u=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return u||l.level==i?u&&u.level0&&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=Xi(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=ge.get(e);if(i instanceof Re)c.push({node:e,deco:i.mark});else{if(i instanceof Ze||"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 Ue({inclusive:!0,attributes:je(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,(Be.ie||Be.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,i){let n=new Zi;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=Be.chrome||Be.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=ei.build(this.view.state.doc,u,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=ei.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}=ei.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);ye(this,m,g,d,p,s,o,a,l)}i&&this.fixCompositionDOM(i)}compositionView(t){let e=new Pe(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Re(i,[e],e.length);let i=new Ze;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=ge.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(Be.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 pe(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((()=>{Be.android&&Be.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(Be.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 pe(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new pe(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=Ze.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=ge.get(i.childNodes[n]);t instanceof Ze&&(e=t.domAtPos(t.length))}return e?new pe(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=ge.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(;es||t==s&&r.type!=Ke.WidgetBefore&&r.type!=Ke.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==Ke.WidgetBefore&&e>-2))return r.coordsAt(t-s,e);i=s}}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof Ze))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 Pe))return null;let r=d(n.text,i);if(r==i)return null;let s=ce(n.dom,i,r).getClientRects();return!s.length||s[0].top>=s[0].bottom?null:s[0]}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,r=this.view.contentDOM.clientWidth,s=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Bi.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?Bi.RTL:Bi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof Ze){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 ve(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(Ge.replace({widget:new Yi(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!r)break;i=r.to+1}return Ge.set(t)}updateDeco(){let t=this.view.state.facet(Si).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};!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();d=e.width/c.offsetWidth,p=e.height/c.offsetHeight,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 Zi=class{constructor(){this.changes=[]}compareRange(t,e){Qe(t,e,this.changes)}comparePoint(t,e){Qe(t,e,this.changes)}};function tn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function en(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function nn(t,e){return t.tope.top+1}function rn(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function on(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&&nn(h,p)?h=sn(h,p.bottom):c&&nn(c,p)&&(c=rn(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?an(n,f,i):u&&"false"!=n.contentEditable?on(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(r.left+r.right)/2?1:0)}}function an(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((Be.chrome||Be.gecko)&&ce(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 ln(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!=Ke.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:hn(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)||Be.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 ce(t,n-1,n).getBoundingClientRect().left>i}(w,v,c)||Be.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():ce(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=Ze.find(t.docView,d);if(!e)return f>o.top+o.height/2?o.to:o.from;({node:w,offset:v}=on(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 cn(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==Ke.Text))return t;return i}function un(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=Ui(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 fn(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,n{this.ignoreDuringComposition(i)||"keydown"==i.type&&this.keydown(t,i)||(this.mustFlushObserver(i)&&t.observer.forceFlush(),this.runCustomHandlers(i.type,t,i)?i.preventDefault():e(t,i))};for(let i in bn){let n=bn[i];t.contentDOM.addEventListener(i,(i=>{kn(t,i)&&e(n,i)}),xn[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(bn.mousedown,i),!i.defaultPrevented&&2==i.button)){let e=t.contentDOM.style.minHeight;t.contentDOM.style.minHeight="100%",setTimeout((()=>t.contentDOM.style.minHeight=e),200)}})),t.scrollDOM.addEventListener("drop",(i=>{i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&e(bn.drop,i)})),Be.chrome&&102==Be.chrome_version&&t.scrollDOM.addEventListener("wheel",(()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout((()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=t.hasFocus,Be.safari&&t.contentDOM.addEventListener("input",(()=>null)),Be.gecko&&function(t){Vn.has(t)||(Vn.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}ensureHandlers(t,e){var i;let n;this.customHandlers=[];for(let r of e)if(n=null===(i=r.update(t).spec)||void 0===i?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:n});for(let e in n)this.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(this.registeredEvents.push(e),t.contentDOM.addEventListener(e,(i=>{kn(t,i)&&this.runCustomHandlers(e,t,i)&&i.preventDefault()})))}}runCustomHandlers(t,e,i){for(let n of this.customHandlers){let r=n.handlers[t];if(r)try{if(r.call(n.plugin,i,e)||i.defaultPrevented)return!0}catch(t){mi(e.state,t)}}return!1}runScrollHandlers(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;for(let i of this.customHandlers){let n=i.handlers.scroll;if(n)try{n.call(i.plugin,e,t)}catch(e){mi(t.state,e)}}}keydown(t,e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()t.keyCode==e.keyCode)))&&!e.ctrlKey||gn.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)||(this.pendingIOSKey=i||e,setTimeout((()=>this.flushIOSKey(t)),250),0))}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,ue(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Be.safari&&!Be.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const mn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],gn="dthko",wn=[16,17,18,20,91,92,224,225];function vn(t){return.7*Math.max(0,t)+8}class yn{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(Ai).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(ri);return i.length?i[0](e):Be.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!=Rn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),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=-vn(o.left-t.clientX):t.clientX+a.right>=o.right-6&&(r=vn(t.clientX-o.right)),t.clientY-a.top<=o.top+6?s=-vn(o.top-t.clientY):t.clientY+a.bottom>=o.bottom-6&&(s=vn(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=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)}}function kn(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=ge.get(n))&&i.ignoreEvent(e))return!1;return!0}const bn=Object.create(null),xn=Object.create(null),Sn=Be.ie&&Be.ie_version<15||Be.ios&&Be.webkit_version<604;function An(t,e){let i,{state:n}=t,r=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(null!=In&&n.selection.ranges.every((t=>t.empty))&&In==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 Mn(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.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},bn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},bn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},xn.touchstart=xn.touchmove={passive:!0},bn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(oi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=On(t,e),n=Rn(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=On(t,e),h=Mn(t,l.pos,l.bias,n);if(i.pos!=l.pos&&!s){let e=Mn(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 yn(t,e,i,n)),n&&t.observer.ignore((()=>he(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Cn=(t,e)=>t>=e.top&&t<=e.bottom,Tn=(t,e,i)=>Cn(e,i)&&t>=i.left&&t<=i.right;function Dn(t,e,i,n){let r=Ze.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&&Tn(i,n,o))return-1;let a=r.coordsAt(s,1);return a&&Tn(i,n,a)?1:o&&Cn(n,o)?-1:1}function On(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Dn(t,i,e.clientX,e.clientY)}}const Ln=Be.ie&&Be.ie_version<=11;let En=null,Bn=0,Pn=0;function Rn(t){if(!Ln)return t.detail;let e=En,i=Pn;return En=t,Pn=Date.now(),Bn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Bn+1)%3:1}function Nn(t,e,i,n){if(!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:s}=t.inputState,o=n&&s&&s.dragging&&function(t,e){let i=t.state.facet(si);return i.length?i[0](e):Be.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.dragging.from,to:s.dragging.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"})}bn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:n}=t.inputState;n&&(n.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},bn.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let n=Array(i.length),r=0,s=()=>{++r==i.length&&Nn(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])}}else Nn(t,e,e.dataTransfer.getData("Text"),!0)},bn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Sn?null:e.clipboardData;i?(An(t,i.getData("text/plain")||i.getData("text/uri-text")),e.preventDefault()):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(),An(t,i.value)}),50)}(t)};let In=null;bn.copy=bn.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;In=r?i:null;let s=Sn?null:e.clipboardData;s?(e.preventDefault(),s.clearData(),s.setData("text/plain",i)):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),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"})};const zn=st.define();function Hn(t,e){let i=[];for(let n of t.facet(ci)){let r=n(t,e);r&&i.push(r)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Wn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=Hn(t.state,e);i?t.dispatch(i):t.update([])}}),10)}bn.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),Wn(t)},bn.blur=t=>{t.observer.clearSelectionRange(),Wn(t)},bn.compositionstart=bn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},bn.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,Be.chrome&&Be.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},bn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},bn.beforeinput=(t,e)=>{var i;let n;if(Be.chrome&&Be.android&&(n=mn.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)}};const Vn=new Set,Fn=["pre-wrap","normal","pre-line","break-spaces"];class _n{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 Fn.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)>Kn&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Gn.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,$n.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=l?u:r.lineAt(l,$n.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 Jn extends Un{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new jn(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Jn||n instanceof Yn&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Yn?n=new Jn(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Gn.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 Yn extends Gn{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 jn(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 jn(a,l,i+o*n,o,0)}}lineAt(t,e,i,n,r){if(e==$n.ByHeight)return this.blockAt(t,i,n,r);if(e==$n.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new jn(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 jn(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 jn(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 Yn?i[i.length-1]=new Yn(t.length+n):i.push(null,new Yn(n-1))}if(t>0){let e=i[0];e instanceof Yn?i[0]=new Yn(t+e.length):i.unshift(new Yn(t-1),null)}return Gn.of(i)}decomposeLeft(t,e){e.push(new Yn(t-1),null)}decomposeRight(t,e){e.push(null,new Yn(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 Yn(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)>=Kn&&(o=-2);let a=new Jn(e,r);a.outdated=!1,i.push(a),s+=e+1}s<=r&&i.push(null,new Yn(r-s).updateHeight(t,s));let a=Gn.of(i);return(o<0||Math.abs(a.height-this.height)>=Kn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Kn)&&(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 Xn extends Gn{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==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.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,$n.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&&Qn(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?Gn.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 Qn(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Yn&&(n=t[e+1])instanceof Yn&&t.splice(e-1,3,new Yn(i.length+1+n.length))}class Zn{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 Jn?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Jn(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 Jn(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new Yn(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 Jn)return t;let e=new Jn(0,-1);return this.nodes.push(e),e}addBlock(t){var e;this.enterLine();let i=null===(e=t.deco)||void 0===e?void 0:e.type;i!=Ke.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,i!=Ke.WidgetBefore&&(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 Jn||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 ir(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class nr{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 _n(i),this.stateDeco=e.facet(Si).filter((t=>"function"!=typeof t)),this.heightMap=Gn.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=Ge.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 or(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?cr:new ur(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:fr(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Si).filter((t=>"function"!=typeof t));let n=t.changedRanges,r=Li.extendWithRanges(n,function(t,e,i){let n=new tr;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(fi)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Bi.RTL:Bi.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 t=a.width/i.offsetWidth,e=a.height/i.offsetHeight;t>.995&&t<1.005&&(t=1),e>.995&&e<1.005&&(e=1),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=de(e.scrollDOM);let p=(this.printing?ir:er)(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?Gn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new Li(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new qn(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 or(n.lineAt(s-1e3*i,$n.ByHeight,r,0,0).from,n.lineAt(o+1e3*(1-i),$n.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,$n.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!=Bi.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 nr(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))||fr(this.heightMap.lineAt(t,$n.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return fr(this.heightMap.lineAt(this.scaler.fromDOM(t),$n.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 fr(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 or{constructor(t,e){this.from=t,this.to=e}}function ar(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 hr(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 cr={toDOM:t=>t,fromDOM:t=>t,scale:1};class ur{constructor(t,e,i){let n=0,r=0,s=0;this.viewports=i.map((({from:i,to:r})=>{let s=e.lineAt(i,$n.ByPos,t,0,0).top,o=e.lineAt(r,$n.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=efr(t,e))):t._content)}const dr=N.define({combine:t=>t.join(" ")}),pr=N.define({combine:t=>t.indexOf(!0)>-1}),mr=Ft.newName(),gr=Ft.newName(),wr=Ft.newName(),vr={"&light":"."+gr,"&dark":"."+wr};function yr(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 kr=yr("."+mr,{"&":{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",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"},"&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"}},vr),br="￿";class xr{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(yt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=br}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=ge.get(n),o=ge.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:Sr(n))||Sr(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=ge.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+Math.min(e,i.offset))}}function Sr(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class Ar{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class Mr{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="";let{impreciseHead:r,impreciseAnchor:s}=t.docView;if(t.state.readOnly&&e>-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 Ar(i,n)),r==i&&s==n||e.push(new Ar(r,s))),e}(t),i=new xr(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 Cr(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||Be.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,br),i.text,l-r,h);c&&(Be.chrome&&13==o&&c.toB==c.from+2&&i.text.slice(c.from,c.toB)==br+br&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:t.of(i.text.slice(c.from,c.toB).split(br))})}else r&&(!e.hasFocus&&e.state.facet(gi)||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))}:(Be.mac||Be.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([" "])}):Be.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(Be.ios&&e.inputState.flushIOSKey(e))return!0;if(Be.android&&(n.from==s.from&&n.to==s.to&&1==n.insert.length&&2==n.insert.lines&&ue(e.contentDOM,"Enter",13)||(n.from==s.from-1&&n.to==s.to&&0==n.insert.length||8==o&&n.insert.lengths.head)&&ue(e.contentDOM,"Backspace",8)||n.from==s.from&&n.to==s.to+1&&0==n.insert.length&&ue(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&&Xi(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(hi).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 Tr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Dr=Be.ie&&Be.ie_version<=11;class Or{constructor(t){this.view=t,this.active=!1,this.selectionRange=new oe,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.resizeContent=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);(Be.ie&&Be.ie_version<=11||Be.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()})),Dr&&(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.view.requestMeasure())),this.resizeContent.observe(t.contentDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((t=>{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.runScrollHandlers(this.view,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(gi)?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):(Be.ie&&Be.ie_version<=11||Be.android&&Be.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=Be.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&&ue(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 Mr(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!1;let i=this.view.state,n=Cr(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=Lr(e,t.previousSibling||t.target.previousSibling,-1),n=Lr(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,n;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(),null===(n=this.resizeContent)||void 0===n||n.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 Lr(t,e,i){for(;e;){let n=ge.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 Er{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.style.cssText="position: fixed; top: -10000px",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 sr(t.state||yt.create(t)),this.plugins=this.state.facet(vi).map((t=>new ki(t)));for(let t of this.plugins)t.update(this);this.observer=new Or(this),this.inputState=new pn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Ji(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(zn)))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=Hn(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=Ei.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 di(t.empty?t:B.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(pi)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Rr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Oi)!=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(dr)!=e.state.facet(dr)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(li))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cr(this,h)&&l.force&&ue(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 sr(t),this.plugins=t.facet(vi).map((t=>new ki(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new Ji(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(vi),i=t.state.facet(vi);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(),this.inputState.ensureHandlers(this,this.plugins)}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(de(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 mi(this.state,t),Pr}})),h=Ei.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(li))t(e)}get themeClasses(){return mr+" "+(this.state.facet(pr)?wr:gr)+" "+this.state.facet(dr)}updateAttrs(){let t=Nr(this,bi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(gi)?"true":"false",class:"cm-content",style:`${Be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Nr(this,xi,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(Er.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(Oi);let t=this.state.facet(Er.cspNonce);Ft.mount(this.root,this.styleModules.concat(kr).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 dn(this,t,un(this,t,e,i))}moveByGroup(t,e){return dn(this,t,un(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=cn(t,e.head),s=n&&r.type==Ke.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==Bi.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 dn(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),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 i=0;;i+=10){let n=o+(f+i)*s,h=ln(t,{x:u,y:n},!1,s);if(nl.bottom||(s<0?hr))return B.cursor(h,e.assoc,void 0,a)}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),ln(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),r=this.bidiSpans(n);return re(i,r[Fi.find(r,t-n.from,-1,e)].dir==Bi.LTR==e>0)}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(ui)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Br)return Ki(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=Ci(this,t.from,t.to))))return n.order;e||(e=Ci(this,t.from,t.to));let n=function(t,e,i){if(!t)return[new Fi(0,0,e==Ri?1:0)];if(e==Pi&&!i.length&&!Vi.test(t))return Ki(t.length);if(i.length)for(;t.length>qi.length;)qi[qi.length]=256;let n=[],r=e==Pi?0:1;return $i(t,r,r,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new Rr(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Be.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{he(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.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return pi.of(new di("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return yi.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=Ft.newName(),n=[dr.of(i),Oi.of(yr(`.${i}`,t))];return e&&e.dark&&n.push(pr.of(!0)),n}static baseTheme(t){return j.lowest(Oi.of(yr("."+mr,t,vr)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&ge.get(i)||ge.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Er.styleModule=Oi,Er.inputHandler=hi,Er.focusChangeEffect=ci,Er.perLineTextDirection=ui,Er.exceptionSink=ai,Er.updateListener=li,Er.editable=gi,Er.mouseSelectionStyle=oi,Er.dragMovesSelection=si,Er.clickAddsSelectionRange=ri,Er.decorations=Si,Er.atomicRanges=Ai,Er.bidiIsolatedRanges=Mi,Er.scrollMargins=Ti,Er.darkTheme=pr,Er.cspNonce=N.define({combine:t=>t.length?t[0]:""}),Er.contentAttributes=xi,Er.editorAttributes=bi,Er.lineWrapping=Er.contentAttributes.of({class:"cm-lineWrapping"}),Er.announce=lt.define();const Br=4096,Pr={};class Rr{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:Bi.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&&Ve(s,i)}return i}const Ir=Be.mac?"mac":Be.windows?"win":Be.linux?"linux":"key";function zr(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 Hr=j.default(Er.domEventHandlers({keydown:(t,e)=>jr(Fr(e.state),t,e,"editor")})),Wr=N.define({enables:Hr}),Vr=new WeakMap;function Fr(t){let e=t.facet(Wr),i=Vr.get(e);return i||Vr.set(e,i=function(t,e=Ir){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)}),qr),!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 qr=4e3;function jr(t,e,i,n){let r=function(t){var e=!(Kt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Gt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?$t:jt)[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=k(v(r,0))==r.length&&" "!=r,o="",a=!1,l=!1,h=!1;_r&&_r.view==i&&_r.scope==n&&(o=_r.prefix+" ",wn.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+zr(r,e,!s)])?a=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Be.windows&&e.ctrlKey&&e.altKey)&&(c=jt[e.keyCode])&&c!=r?(d(p[o+zr(c,e,!0)])||e.shiftKey&&(u=$t[e.keyCode])!=r&&u!=c&&d(p[o+zr(u,e,!1)]))&&(a=!0):s&&e.shiftKey&&d(p[o+zr(r,e,!0)])&&(a=!0),!a&&d(p._any)&&(a=!0)),l&&(a=!0),a&&h&&e.stopPropagation(),a}class $r{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=Kr(t);return[new $r(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==Bi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Kr(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=cn(t,n),p=cn(t,r),m=d.type==Ke.Text?d:null,g=p.type==Ke.Text?p:null;if(m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=Gr(t,n,m)),g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=Gr(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):k(d,!1),n=g?y(null,i.to,g):k(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 k(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Kr(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Bi.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Gr(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:Ke.Text}}class Ur{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(Jr)!=t.state.facet(Jr)&&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(Jr);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 Jr=N.define();function Yr(t){return[yi.define((e=>new Ur(e,t))),Jr.of(t)]}const Xr=!Be.ios,Qr=N.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function Zr(t={}){return[Qr.of(t),es,ns,ss,fi.of(!0)]}function ts(t){return t.startState.facet(Qr)!=t.state.facet(Qr)}const es=Yr({above:!0,markers(t){let{state:e}=t,i=e.facet(Qr),n=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty?!s||Xr: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 $r.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=ts(t);return i&&is(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){is(e.state,t)},class:"cm-cursorLayer"});function is(t,e){e.style.animationDuration=t.facet(Qr).cursorBlinkRate+"ms"}const ns=Yr({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:$r.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||ts(t),class:"cm-selectionLayer"}),rs={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Xr&&(rs[".cm-line"].caretColor="transparent !important");const ss=j.highest(Er.theme(rs));function os(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 as{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))os(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 ls=null!=/x/.unicode?"gu":"g",hs=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",ls),cs={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 us=null;const fs=N.define({combine(t){let e=kt(t,{render:null,specialChars:hs,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==us&&"undefined"!=typeof document&&document.body){let e=document.body.style;us=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return us||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,ls)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ls)),e}});let ds=null;class ps extends $e{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")+" "+(cs[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 ms extends $e{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 gs=N.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 ws(t,e){let i=t.plugin(vs),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const vs=yi.fromClass(class{constructor(t){this.input=t.state.facet(bs),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(gs);this.top=new ys(t,!0,e.topContainer),this.bottom=new ys(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(gs);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ys(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ys(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(bs);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=>Er.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class ys{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=ks(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=ks(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 ks(t){let e=t.nextSibling;return t.remove(),e}const bs=N.define({enables:vs});class xs extends bt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}xs.prototype.elementClass="",xs.prototype.toDOM=void 0,xs.prototype.mapMode=x.TrackBefore,xs.prototype.startSide=xs.prototype.endSide=-1,xs.prototype.point=!0;const Ss=N.define(),As=N.define(),Ms=N.define({combine:t=>t.some((t=>t))});function Cs(t){let e=[Ts];return t&&!1===t.fixed&&e.push(Ms.of(!0)),e}const Ts=yi.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(As).map((e=>new Es(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Ms),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(Ms)!=!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(Ss),this.view.viewport.from),n=[],r=this.gutters.map((t=>new Ls(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==Ke.Text&&e){Os(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==Ke.Text){Os(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(As),i=t.state.facet(As),n=t.docChanged||t.heightChanged||t.viewportChanged||!Mt.eq(t.startState.facet(Ss),t.state.facet(Ss),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 Es(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=>Er.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Bi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function Ds(t){return Array.isArray(t)?t:[t]}function Os(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Ls{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;if(this.i==n.elements.length){let s=new Bs(t,e.height,r,i);n.elements.push(s),n.dom.appendChild(s.dom)}else n.elements[this.i].update(t,e.height,r,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];Os(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 Es{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=Ds(e.markers(t)),e.initialSpacer&&(this.spacer=new Bs(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=Ds(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 Bs{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/t.scaleY+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i/t.scaleY+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;ikt(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 Ns extends xs{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Is(t,e){return t.state.facet(Rs).formatNumber(e,t.state)}const zs=As.compute([Rs],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(Ps),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new Ns(Is(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Rs)!=t.state.facet(Rs),initialSpacer:t=>new Ns(Is(t,Hs(t.state.doc.lines))),updateSpacer(t,e){let i=Is(e.view,Hs(e.view.state.doc.lines));return i==t.number?t:new Ns(i)},domEventHandlers:t.facet(Rs).domEventHandlers})));function Hs(t){let e=9;for(;e{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 Ge.replace({widget:new ms((e-s%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ge.replace({widget:new ps(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(fs);t.startState.facet(fs)!=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;this.state=yt.create({doc:this.$textarea.textSelection("getContents"),extensions:e}),this.view=new Er({state:this.state,parent:this.$textarea.parent()[0]}),mw.user.options.get("usecodemirror-colorblind")&&"wikitext"===mw.config.get("wgPageContentModel")&&this.view.dom.classList.add("cm-mw-colorblind-colors"),this.$textarea.hide(),this.$textarea[0].form&&this.$textarea[0].form.addEventListener("submit",(function(){t.$textarea.val(t.view.state.doc.toString())})),$(this.view.dom).textSelection("register",this.cmTextSelection),this.$textarea.textSelection("register",this.cmTextSelection),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}},{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,e=$(this.view.dom);return{getContents:function(){return t.view.state.doc.toString()},setContents:function(i){return t.view.dispatch({changes:{from:0,to:t.view.state.doc.length,insert:i}}),e},getSelection:function(){return t.view.state.sliceDoc(t.view.state.selection.main.from,t.view.state.selection.main.to)},setSelection:function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{start:0,end:0};return t.view.dispatch({selection:{anchor:i.start,head:i.end||i.start}}),t.view.focus(),e},replaceSelection:function(i){return t.view.dispatch(t.view.state.replaceSelection(i)),e},getCaretPosition:function(e){return e.startAndEnd?[t.view.state.selection.main.from,t.view.state.selection.main.to]:t.view.state.selection.main.head},scrollToCaretPosition:function(){return t.view.dispatch({effects:Er.scrollIntoView(t.view.state.selection.main.head)}),e}}}}],i&&Vs(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const qs=1024;let js=0;class $s{constructor(t,e){this.from=t,this.to=e}}class Ks{constructor(t={}){this.id=js++,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=Js.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}Ks.closedBy=new Ks({deserialize:t=>t.split(" ")}),Ks.openedBy=new Ks({deserialize:t=>t.split(" ")}),Ks.group=new Ks({deserialize:t=>t.split(" ")}),Ks.isolate=new Ks({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),Ks.contextHash=new Ks({perNode:!0}),Ks.lookAhead=new Ks({perNode:!0}),Ks.mounted=new Ks({perNode:!0});class Gs{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[Ks.mounted.id]}}const Us=Object.create(null);class Js{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):Us,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new Js(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(Ks.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(Ks.group),n=-1;n<(i?i.length:0);n++){let r=e[n<0?t.name:i[n]];if(r)return r}}}}Js.none=new Js("",Object.create(null),0,8);class Ys{constructor(t){this.types=t;for(let e=0;e=e){let o=new oo(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[n])).push(ro(o,e,i,!1))}}return r?uo(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&Zs.IncludeAnonymous)>0;for(let t=this.cursor(s|Zs.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:vo(Js.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new to(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new to(Js.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=qs,reused:s=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new eo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,g,w,v){let{id:y,start:k,end:b,size:x}=a,S=c;for(;x<0;){if(a.next(),-1==x){let e=s[y];return i.push(e),void g.push(k-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=k-t;if(b-k<=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 io(e,b-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=b;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-r&&(d(e,i,k,s,a.end,l,n,S),s=e.length,l=a.end),a.next()):v>2500?f(k,t,e,i):u(k,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 to){if(!a&&r.type==t&&r.length==n)return r;(s=r.prop(Ks.lookAhead))&&(o=i[a]+r.length+s)}return p(t,e,i,n,o)}}(C);A=vo(C,e,i,0,e.length,0,b-k,t,t)}else A=p(C,e,i,b-k,S-b)}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 io(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=[Ks.contextHash,h];s=s?[t].concat(s):[t]}if(r>25){let t=[Ks.lookAhead,r];s=s?[t].concat(s):[t]}return new to(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 to(l[t.topID],g.reverse(),w.reverse(),v)}(t)}}to.empty=new to(Js.none,[],[],0);class eo{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 eo(this.buffer,this.index)}}class io{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return Js.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 ro(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(no(n,i,h,h+l.length))if(l instanceof io){if(r&Zs.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new co(new ho(s,l,t,h),null,o)}else if(r&Zs.IncludeAnonymous||!l.type.isAnonymous||mo(l)){let o;if(!(r&Zs.IgnoreMounts)&&(o=Gs.get(l))&&!o.overlay)return new oo(o.tree,h,t,s);let a=new oo(l,h,t,s);return r&Zs.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(r&Zs.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&Zs.IgnoreOverlays)&&(n=Gs.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 oo(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 ao(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 lo(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 ho{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class co extends so{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 co(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&Zs.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 co(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 co(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 co(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 to(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function uo(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&Zs.IncludeAnonymous||t instanceof io||!t.type.isAnonymous||mo(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 lo(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 mo(t){return t.children.some((t=>t instanceof io||!t.type.isAnonymous||mo(t)))}const go=new WeakMap;function wo(t,e){if(!t.isAnonymous||e instanceof io||e.type!=t)return 1;let i=go.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof to)){i=1;break}i+=wo(t,n)}go.set(e,i)}return i}function vo(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(vo(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 yo{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 yo(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 yo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),s.to>c)break;s=rnew $s(t.from,t.to))):[new $s(0,0)]:[new $s(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 bo{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 Ks({perNode:!0});let xo=0;class So{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=xo++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new So([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new Mo;return e=>e.modified.indexOf(t)>-1?e:Mo.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ao=0;class Mo{constructor(){this.instances=[],this.id=Ao++}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 So(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(Mo.get(e,t));return r}}function Co(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 Do(n,r,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return To.add(e)}const To=new Ks;class Do{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 Lo(t,e,i,n=0,r=t.length){let s=new Eo(n,Array.isArray(e)?e:[e],i);s.highlightRange(t.cursor(),n,r,"",s.highlighters),s.flush(r)}Do.empty=new Do([],2,null);class Eo{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(To);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||Do.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(Ks.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 Bo=So.define,Po=Bo(),Ro=Bo(),No=Bo(Ro),Io=Bo(Ro),zo=Bo(),Ho=Bo(zo),Wo=Bo(zo),Vo=Bo(),Fo=Bo(Vo),_o=Bo(),qo=Bo(),jo=Bo(),$o=Bo(jo),Ko=Bo(),Go={comment:Po,lineComment:Bo(Po),blockComment:Bo(Po),docComment:Bo(Po),name:Ro,variableName:Bo(Ro),typeName:No,tagName:Bo(No),propertyName:Io,attributeName:Bo(Io),className:Bo(Ro),labelName:Bo(Ro),namespace:Bo(Ro),macroName:Bo(Ro),literal:zo,string:Ho,docString:Bo(Ho),character:Bo(Ho),attributeValue:Bo(Ho),number:Wo,integer:Bo(Wo),float:Bo(Wo),bool:Bo(zo),regexp:Bo(zo),escape:Bo(zo),color:Bo(zo),url:Bo(zo),keyword:_o,self:Bo(_o),null:Bo(_o),atom:Bo(_o),unit:Bo(_o),modifier:Bo(_o),operatorKeyword:Bo(_o),controlKeyword:Bo(_o),definitionKeyword:Bo(_o),moduleKeyword:Bo(_o),operator:qo,derefOperator:Bo(qo),arithmeticOperator:Bo(qo),logicOperator:Bo(qo),bitwiseOperator:Bo(qo),compareOperator:Bo(qo),updateOperator:Bo(qo),definitionOperator:Bo(qo),typeOperator:Bo(qo),controlOperator:Bo(qo),punctuation:jo,separator:Bo(jo),bracket:$o,angleBracket:Bo($o),squareBracket:Bo($o),paren:Bo($o),brace:Bo($o),content:Vo,heading:Fo,heading1:Bo(Fo),heading2:Bo(Fo),heading3:Bo(Fo),heading4:Bo(Fo),heading5:Bo(Fo),heading6:Bo(Fo),contentSeparator:Bo(Vo),list:Bo(Vo),quote:Bo(Vo),emphasis:Bo(Vo),strong:Bo(Vo),link:Bo(Vo),monospace:Bo(Vo),strikethrough:Bo(Vo),inserted:Bo(),deleted:Bo(),changed:Bo(),invalid:Bo(),meta:Ko,documentMeta:Bo(Ko),annotation:Bo(Ko),processingInstruction:Bo(Ko),definition:So.defineModifier(),constant:So.defineModifier(),function:So.defineModifier(),standard:So.defineModifier(),local:So.defineModifier(),special:So.defineModifier()};var Uo;Oo([{tag:Go.link,class:"tok-link"},{tag:Go.heading,class:"tok-heading"},{tag:Go.emphasis,class:"tok-emphasis"},{tag:Go.strong,class:"tok-strong"},{tag:Go.keyword,class:"tok-keyword"},{tag:Go.atom,class:"tok-atom"},{tag:Go.bool,class:"tok-bool"},{tag:Go.url,class:"tok-url"},{tag:Go.labelName,class:"tok-labelName"},{tag:Go.inserted,class:"tok-inserted"},{tag:Go.deleted,class:"tok-deleted"},{tag:Go.literal,class:"tok-literal"},{tag:Go.string,class:"tok-string"},{tag:Go.number,class:"tok-number"},{tag:[Go.regexp,Go.escape,Go.special(Go.string)],class:"tok-string2"},{tag:Go.variableName,class:"tok-variableName"},{tag:Go.local(Go.variableName),class:"tok-variableName tok-local"},{tag:Go.definition(Go.variableName),class:"tok-variableName tok-definition"},{tag:Go.special(Go.variableName),class:"tok-variableName2"},{tag:Go.definition(Go.propertyName),class:"tok-propertyName tok-definition"},{tag:Go.typeName,class:"tok-typeName"},{tag:Go.namespace,class:"tok-namespace"},{tag:Go.className,class:"tok-className"},{tag:Go.macroName,class:"tok-macroName"},{tag:Go.propertyName,class:"tok-propertyName"},{tag:Go.operator,class:"tok-operator"},{tag:Go.comment,class:"tok-comment"},{tag:Go.meta,class:"tok-meta"},{tag:Go.invalid,class:"tok-invalid"},{tag:Go.punctuation,class:"tok-punctuation"}]);const Jo=new Ks;const Yo=new Ks;class Xo{constructor(t,e,i=[],n=""){this.data=t,this.name=n,yt.prototype.hasOwnProperty("tree")||Object.defineProperty(yt.prototype,"tree",{get(){return Zo(this)}}),this.parser=e,this.extension=[la.of(this),yt.languageData.of(((t,e,i)=>{let n=Qo(t,e,i),r=n.type.prop(Jo);if(!r)return[];let s=t.facet(r),o=n.type.prop(Yo);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 Qo(t,e,i).type.prop(Jo)==this.data}findRegions(t){let e=t.facet(la);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(Jo)==this.data)return void i.push({from:e,to:e+t.length});let r=t.prop(Ks.mounted);if(r){if(r.tree.prop(Jo)==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 ea=null;class ia{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 ia(t,e,[],to.empty,0,i,[],null)}startParse(){return this.parser.startParse(new ta(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=to.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(yo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=ea;ea=this;try{return t()}finally{ea=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=na(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=yo.applyChanges(i,e),n=to.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=na(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 ko{createParse(e,i,n){let r=n[0].from,s=n[n.length-1].to;return{parsedPos:r,advance(){let e=ea;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 to(Js.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 ea}}function na(t,e,i){return yo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class ra{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 ra(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=ia.create(t.facet(la).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new ra(i)}}Xo.state=_.define({create:ra.init,update(t,e){for(let t of e.effects)if(t.is(Xo.setState))return t.value;return e.startState.facet(la)!=e.state.facet(la)?ra.init(e.state):t.apply(e)}});let sa=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(sa=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const oa="undefined"!=typeof navigator&&(null===(Uo=navigator.scheduling)||void 0===Uo?void 0:Uo.isInputPending)?()=>navigator.scheduling.isInputPending():null,aa=yi.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(Xo.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(Xo.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=sa(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=r.context.work((()=>oa&&oa()||Date.now()>s),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Xo.setState.of(new ra(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=>mi(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()}}}),la=N.define({combine:t=>t.length?t[0]:null,enables:t=>[Xo.state,aa,Er.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class ha{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const ca=N.define(),ua=N.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 fa(t){let e=t.facet(ua);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function da(t,e){let i="",n=t.tabSize,r=t.facet(ua)[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 wa(n,t,i)}(t,i,e):null}class ma{constructor(t,e={}){this.state=t,this.options=e,this.unit=fa(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 ga=new Ks;function wa(t,e,i){for(let n=t;n;n=n.next){let t=va(n.node);if(t)return t(ka.create(e,i,n))}return 0}function va(t){let e=t.type.prop(ga);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(Ks.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.fromt.prop(Jo)==s.data:s?t=>t==s:void 0,this.style=Oo(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 xa(t,e||{})}}const Sa=N.define(),Aa=N.define({combine:t=>t.length?[t[0]]:null});function Ma(t){let e=t.facet(Sa);return e.length?e:t.facet(Aa)}class Ca{constructor(t){this.markCache=Object.create(null),this.tree=Zo(t.state),this.decorations=this.buildDeco(t,Ma(t.state))}update(t){let e=Zo(t.state),i=Ma(t.state),n=i!=Ma(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=Ge.mark({class:n})))}),n,r);return i.finish()}}const Ta=j.high(yi.fromClass(Ca,{decorations:t=>t.decorations})),Da=(Go.meta,Go.link,Go.heading,Go.emphasis,Go.strong,Go.strikethrough,Go.keyword,Go.atom,Go.bool,Go.url,Go.contentSeparator,Go.labelName,Go.literal,Go.inserted,Go.string,Go.deleted,Go.regexp,Go.escape,Go.string,Go.variableName,Go.variableName,Go.typeName,Go.namespace,Go.className,Go.variableName,Go.macroName,Go.propertyName,Go.comment,Go.invalid,Er.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),Oa=1e4,La="()[]{}",Ea=N.define({combine:t=>kt(t,{afterCursor:!0,brackets:La,maxScanDistance:Oa,renderMatch:Ra})}),Ba=Ge.mark({class:"cm-matchingBracket"}),Pa=Ge.mark({class:"cm-nonmatchingBracket"});function Ra(t){let e=[],i=t.matched?Ba:Pa;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 Na=_.define({create:()=>Ge.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Ea);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=Fa(e.state,t.head,-1,n)||t.head>0&&Fa(e.state,t.head-1,1,n)||n.afterCursor&&(Fa(e.state,t.head,1,n)||t.headEr.decorations.from(t)}),Ia=[Na,Da];function za(t={}){return[Ea.of(t),Ia]}const Ha=new Ks;function Wa(t,e,i){let n=t.prop(e<0?Ks.openedBy:Ks.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 Va(t){let e=t.type.prop(Ha);return e?e(t.node):t}function Fa(t,e,i,n={}){let r=n.maxScanDistance||Oa,s=n.brackets||La,o=Zo(t),a=o.resolveInner(e,i);for(let t=a;t;t=t.parent){let n=Wa(t.type,i,s);if(n&&t.from0?e>=r.from&&er.from&&e<=r.to))return _a(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 _a(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 $a(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 Ka=new WeakMap;class Ga extends Xo{constructor(t){let e,i=(r=t.languageData,N.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||$a,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||Qa};var r,s;super(i,new class extends ko{createParse(t,i,n){return new Ya(e,t,i,n)}},[ca.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=Js.define({id:Za.length,name:"Document",props:[Jo.add((()=>t))],top:!0});return Za.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new Ks({perNode:!0}),this.tokenTable=t.tokenTable?new rl(n.tokenTable):sl}static define(t){return new Ga(t)}getIndent(t,e){let i,n=Zo(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=Ka.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 to&&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&&Ua(t,n.tree,0-n.offset,i,s);if(o&&(e=Ja(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?fa(n):4),tree:to.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 ja(e,t?t.state.tabSize:4,t?fa(t.state):2);if(s.eol())r.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let t=Xa(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 Qa=Object.create(null),Za=[Js.none],tl=new Ys(Za),el=[],il=Object.create(null),nl=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"]])nl[t]=al(Qa,e);class rl{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),nl)}resolve(t){return t?this.table[t]||(this.table[t]=al(this.extra,t)):0}}const sl=new rl(Qa);function ol(t,e){el.indexOf(t)>-1||(el.push(t),console.warn(e))}function al(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||Go[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=il[r];if(s)return s.id;let o=il[r]=Js.define({id:Za.length,name:n,props:[Co({[n]:i})]});return Za.push(o),o.id}function ll(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 hl=ll(ml,0),cl=ll(pl,0),ul=ll(((t,e)=>pl(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 fl(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const dl=50;function pl(t,e,i=e.selection.ranges){let n=i.map((t=>fl(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-dl,n),l=t.sliceDoc(r,r+dl),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*dl?s=o=t.sliceDoc(n,r):(s=t.sliceDoc(n,n+dl),o=t.sliceDoc(r-dl,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 gl=st.define(),wl=st.define(),vl=N.define(),yl=N.define({combine:t=>kt(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)})}),kl=_.define({create:()=>zl.empty,update(t,e){let i=e.state.facet(yl),n=e.annotation(gl);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=Tl.fromTransaction(e,r),o=n.side,a=0==o?t.undone:t.done;return a=s?Dl(a,a.length,i.minDepth,s):Bl(a,e.startState.selection),new zl(0==o?n.rest:a,0==o?a:n.rest)}let r=e.annotation(wl);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=Tl.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 zl(t.done.map(Tl.fromJSON),t.undone.map(Tl.fromJSON))});function bl(t={}){return[kl,yl.of(t),Er.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?Sl:"historyRedo"==t.inputType?Al:null;return!!i&&(t.preventDefault(),i(e))}})]}function xl(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(kl,!1);if(!r)return!1;let s=r.pop(t,i,e);return!!s&&(n(s),!0)}}const Sl=xl(0,!1),Al=xl(1,!1),Ml=xl(0,!0),Cl=xl(1,!0);class Tl{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 Tl(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 Tl(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=Ll;for(let e of t.startState.facet(vl)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Tl(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Ll)}static selection(t){return new Tl(void 0,Ll,void 0,void 0,t)}}function Dl(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 Ol(t,e){return t.length?e.length?t.concat(e):t:e}const Ll=[],El=200;function Bl(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-El));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Dl(t,t.length-1,1e9,i.setSelAfter(n)))}return[Tl.selection([e])]}function Pl(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 Rl(t,e){if(!t.length)return t;let i=t.length,n=Ll;for(;i;){let r=Nl(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?[Tl.selection(n)]:Ll}function Nl(t,e,i){let n=Ol(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Ll,i);if(!t.changes)return Tl.selection(n);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Tl(r,lt.mapEffects(t.effects,e),o,t.startSelection.map(s),n)}const Il=/^(input\.type|delete)($|\.)/;class zl{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 zl(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||Il.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)?Dl(s,s.length-1,n.minDepth,new Tl(t.changes.compose(o.changes),Ol(t.effects,o.effects),o.mapped,o.startSelection,Ll)):Dl(s,s.length,n.minDepth,t),new zl(s,Ll,e,i)}addSelection(t,e,i,n){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Ll;return r.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new zl(Bl(this.done,t),this.undone,e,i);var s,o}addMapping(t){return new zl(Rl(this.done,t),Rl(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:gl.of({side:t,rest:Pl(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let i=1==n.length?Ll:n.slice(0,n.length-1);return r.mapped&&(i=Rl(i,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:gl.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}zl.empty=new zl(Ll,Ll);const Hl=[{key:"Mod-z",run:Sl,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Al,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Al,preventDefault:!0},{key:"Mod-u",run:Ml,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Cl,preventDefault:!0}];function Wl(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function Vl(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Fl({state:t,dispatch:e},i){let n=Wl(t.selection,i);return!n.eq(t.selection)&&(e(Vl(t,n)),!0)}function _l(t,e){return B.cursor(e?t.to:t.from)}function ql(t,e){return Fl(t,(i=>i.empty?t.moveByChar(i,e):_l(i,e)))}function jl(t){return t.textDirectionAt(t.state.selection.main.head)==Bi.LTR}const $l=t=>ql(t,!jl(t)),Kl=t=>ql(t,jl(t));function Gl(t,e){return Fl(t,(i=>i.empty?t.moveByGroup(i,e):_l(i,e)))}function Ul(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 Jl(t,e,i){let n,r,s=Zo(t).resolveInner(e.head),o=i?Ks.closedBy:Ks.openedBy;for(let n=e.head;;){let e=i?s.childAfter(n):s.childBefore(n);if(!e)break;Ul(t,e,o)?s=e:n=i?e.to:e.from}return r=s.type.prop(o)&&(n=i?Fa(t,s.from,1):Fa(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 Yl(t,e){return Fl(t,(i=>{if(!i.empty)return _l(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const Xl=t=>Yl(t,!1),Ql=t=>Yl(t,!0);function Zl(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):_l(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.bottomth(t,!1),ih=t=>th(t,!0);function nh(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 rh(t,e){let i=Wl(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(Vl(t.state,i)),!0)}function sh(t,e){return rh(t,(i=>t.moveByChar(i,e)))}const oh=t=>sh(t,!jl(t)),ah=t=>sh(t,jl(t));function lh(t,e){return rh(t,(i=>t.moveByGroup(i,e)))}function hh(t,e){return rh(t,(i=>t.moveVertically(i,e)))}const ch=t=>hh(t,!1),uh=t=>hh(t,!0);function fh(t,e){return rh(t,(i=>t.moveVertically(i,e,Zl(t).height)))}const dh=t=>fh(t,!1),ph=t=>fh(t,!0),mh=({state:t,dispatch:e})=>(e(Vl(t,{anchor:0})),!0),gh=({state:t,dispatch:e})=>(e(Vl(t,{anchor:t.doc.length})),!0),wh=({state:t,dispatch:e})=>(e(Vl(t,{anchor:t.selection.main.anchor,head:0})),!0),vh=({state:t,dispatch:e})=>(e(Vl(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function yh(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=kh(t,n,!0)),r=Math.min(r,n),s=Math.max(s,n)}else r=kh(t,r,!1),s=kh(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?Er.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function kh(t,e,i){if(t instanceof Er)for(let n of t.state.facet(Er.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const bh=(t,e)=>yh(t,(i=>{let n,r,{state:s}=t,o=s.doc.lineAt(i);if(!e&&i>o.from&&ibh(t,!1),Sh=t=>bh(t,!0),Ah=(t,e)=>yh(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})),Mh=t=>Ah(t,!1),Ch=t=>yh(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 Dh(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let e of Th(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 Oh(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Th(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 Lh=Eh(!1);function Eh(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=Zo(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Ks.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 ma(i,{simulateBreak:r,simulateDoubleBreak:!!a}),h=pa(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 Ph=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>Fl(t,(e=>Jl(t.state,e,!jl(t)))),shift:t=>rh(t,(e=>Jl(t.state,e,!jl(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>Fl(t,(e=>Jl(t.state,e,jl(t)))),shift:t=>rh(t,(e=>Jl(t.state,e,jl(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Dh(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Oh(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Dh(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Oh(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(Vl(t,n)),!0)}},{key:"Mod-Enter",run:Eh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Th(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=Wl(t.selection,(e=>{var i;let n=Zo(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(Vl(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Bh(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let r=zt(n,t.tabSize),s=0,o=da(t,Math.max(0,r-fa(t)));for(;s!t.readOnly&&(e(t.update(Bh(t,((e,i)=>{i.push({from:e.from,insert:t.facet(ua)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ma(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),r=Bh(t,((e,r,s)=>{let o=pa(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=da(t,o);(a!=l||s.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Th(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=Wl(t.selection,(e=>{let r=Fa(t,e.head,-1)||Fa(t,e.head,1)||e.head>0&&Fa(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fl(t.state,i.from);return n.line?hl(t):!!n.block&&ul(t)}},{key:"Alt-A",run:cl}].concat([{key:"ArrowLeft",run:$l,shift:oh,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Gl(t,!jl(t)),shift:t=>lh(t,!jl(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>Fl(t,(e=>nh(t,e,!jl(t)))),shift:t=>rh(t,(e=>nh(t,e,!jl(t)))),preventDefault:!0},{key:"ArrowRight",run:Kl,shift:ah,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Gl(t,jl(t)),shift:t=>lh(t,jl(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>Fl(t,(e=>nh(t,e,jl(t)))),shift:t=>rh(t,(e=>nh(t,e,jl(t)))),preventDefault:!0},{key:"ArrowUp",run:Xl,shift:ch,preventDefault:!0},{mac:"Cmd-ArrowUp",run:mh,shift:wh},{mac:"Ctrl-ArrowUp",run:eh,shift:dh},{key:"ArrowDown",run:Ql,shift:uh,preventDefault:!0},{mac:"Cmd-ArrowDown",run:gh,shift:vh},{mac:"Ctrl-ArrowDown",run:ih,shift:ph},{key:"PageUp",run:eh,shift:dh},{key:"PageDown",run:ih,shift:ph},{key:"Home",run:t=>Fl(t,(e=>nh(t,e,!1))),shift:t=>rh(t,(e=>nh(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:mh,shift:wh},{key:"End",run:t=>Fl(t,(e=>nh(t,e,!0))),shift:t=>rh(t,(e=>nh(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:gh,shift:vh},{key:"Enter",run:Lh},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xh,shift:xh},{key:"Delete",run:Sh},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Mh},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Ah(t,!0)},{mac:"Mod-Backspace",run:t=>yh(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Ch}].concat([{key:"Ctrl-b",run:$l,shift:oh,preventDefault:!0},{key:"Ctrl-f",run:Kl,shift:ah},{key:"Ctrl-p",run:Xl,shift:ch},{key:"Ctrl-n",run:Ql,shift:uh},{key:"Ctrl-a",run:t=>Fl(t,(e=>B.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rh(t,(e=>B.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>Fl(t,(e=>B.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rh(t,(e=>B.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:Sh},{key:"Ctrl-h",run:xh},{key:"Ctrl-k",run:Ch},{key:"Ctrl-Alt-h",run:Mh},{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:ih}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Rh(){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 zh{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(Ih(t)):Ih,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+=k(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=jh(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 _h(e,t.sliceString(e,i));return Fh.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=jh(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=_h.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jh(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function $h(t){let e=Rh("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:[Kh.of(!1),Er.scrollIntoView(f.from,{y:"center"})],selection:f}),t.focus()}return{dom:Rh("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Kh.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Rh("label",t.state.phrase("Go to line"),": ",e)," ",Rh("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Vh.prototype[Symbol.iterator]=qh.prototype[Symbol.iterator]=function(){return this});const Kh=lt.define(),Gh=_.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Kh)&&(t=i.value);return t},provide:t=>bs.from(t,(t=>t?$h:null))}),Uh=Er.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jh=N.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Ac(t),scrollToMatch:t=>Er.scrollIntoView(t)})});class Yh{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,Wh),!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 nc(this):new Zh(this)}getCursor(t,e=0,i){let n=t.doc?t:yt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?tc(this,n,e,i):Qh(this,n,e,i)}}class Xh{constructor(t){this.spec=t}}function Qh(t,e,i,n){return new zh(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=Qh(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 tc(t,e,i,n){return new Vh(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(r(ec(i.input,i.index))!=gt.Word||r(ic(i.input,i.index))!=gt.Word)&&(r(ic(i.input,i.index+i[0].length))!=gt.Word||r(ec(i.input,i.index+i[0].length))!=gt.Word)):void 0},i,n);var r}function ec(t,e){return t.slice(d(t,e,!1),e)}function ic(t,e){return t.slice(e,d(t,e))}class nc extends Xh{nextMatch(t,e,i){let n=tc(this.spec,t,i,t.doc.length).next();return n.done&&(n=tc(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=tc(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=tc(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 rc=lt.define(),sc=lt.define(),oc=_.define({create:t=>new ac(vc(t).create(),null),update(t,e){for(let i of e.effects)i.is(rc)?t=new ac(i.value.create(),t.panel):i.is(sc)&&(t=new ac(t.query,i.value?wc:null));return t},provide:t=>bs.from(t,(t=>t.panel))});class ac{constructor(t,e){this.query=t,this.panel=e}}const lc=Ge.mark({class:"cm-searchMatch"}),hc=Ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),cc=yi.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(oc))}update(t){let e=t.state.field(oc);(e!=t.startState.field(oc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ge.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?hc:lc)}))}return n.finish()}},{decorations:t=>t.decorations});function uc(t){return e=>{let i=e.state.field(oc,!1);return i&&i.query.spec.valid?t(e,i):bc(e)}}const fc=uc(((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(Jh);return t.dispatch({selection:r,effects:[Dc(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),kc(t),!0})),dc=uc(((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(Jh);return t.dispatch({selection:s,effects:[Dc(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),kc(t),!0})),pc=uc(((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))})),mc=uc(((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(Er.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(Dc(t,s)),h.push(i.facet(Jh).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),gc=uc(((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:Er.announce.of(n),userEvent:"input.replace.all"}),!0}));function wc(t){return t.state.facet(Jh).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(Jh);return new Yh({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 yc(t){let e=ws(t,wc);return e&&e.dom.querySelector("[main-field]")}function kc(t){let e=yc(t);e&&e==t.root.activeElement&&e.select()}const bc=t=>{let e=t.state.field(oc,!1);if(e&&e.panel){let i=yc(t);if(i&&i!=t.root.activeElement){let n=vc(t.state,e.query.spec);n.valid&&t.dispatch({effects:rc.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[sc.of(!0),e?rc.of(vc(t.state,e.query.spec)):lt.appendConfig.of(Lc)]});return!0},xc=t=>{let e=t.state.field(oc,!1);if(!e||!e.panel)return!1;let i=ws(t,wc);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:sc.of(!1)}),!0},Sc=[{key:"Mod-f",run:bc,scope:"editor search-panel"},{key:"F3",run:fc,shift:dc,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:fc,shift:dc,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:xc,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 zh(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=ws(t,$h);if(!e){let i=[Kh.of(!0)];null==t.state.field(Gh,!1)&&i.push(lt.appendConfig.of([Gh,Uh])),t.dispatch({effects:i}),e=ws(t,$h)}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 zh(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 zh(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:Er.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class Ac{constructor(t){this.view=t;let e=this.query=t.state.field(oc).query.spec;function i(t,e,i){return Rh("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Rh("input",{value:e.search,placeholder:Mc(t,"Find"),"aria-label":Mc(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Rh("input",{value:e.replace,placeholder:Mc(t,"Replace"),"aria-label":Mc(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Rh("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Rh("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Rh("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Rh("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>fc(t)),[Mc(t,"next")]),i("prev",(()=>dc(t)),[Mc(t,"previous")]),i("select",(()=>pc(t)),[Mc(t,"all")]),Rh("label",null,[this.caseField,Mc(t,"match case")]),Rh("label",null,[this.reField,Mc(t,"regexp")]),Rh("label",null,[this.wordField,Mc(t,"by word")]),...t.state.readOnly?[]:[Rh("br"),this.replaceField,i("replace",(()=>mc(t)),[Mc(t,"replace")]),i("replaceAll",(()=>gc(t)),[Mc(t,"replace all")])],Rh("button",{name:"close",onclick:()=>xc(t),"aria-label":Mc(t,"close"),type:"button"},["×"])])}commit(){let t=new Yh({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:rc.of(t)}))}keydown(t){var e,i;i=t,jr(Fr((e=this.view).state),i,e,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?dc:fc)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),mc(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(rc)&&!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(Jh).top}}function Mc(t,e){return t.state.phrase(e)}const Cc=30,Tc=/[\s\.,:;?!]/;function Dc(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-Cc),o=Math.min(r,i+Cc),a=t.state.sliceDoc(s,o);if(s!=n.from)for(let t=0;ta.length-Cc;t--)if(!Tc.test(a[t-1])&&Tc.test(a[t])){a=a.slice(0,t);break}return Er.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Oc=Er.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"}}),Lc=[oc,j.low(cc),Oc];function Ec(t){return Ec="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},Ec(t)}function Bc(t){return function(t){if(Array.isArray(t))return Pc(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 Pc(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)?Pc(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 Pc(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&&Vc(t,e)}(e,t),i=e,(n=[{key:"setCodeMirrorPreference",value:function(t){this.useCodeMirror=t,Hc(Wc(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(Bc(this.defaultExtensions),[this.langExtension,za(),bl(),Er.contentAttributes.of({spellcheck:"true"}),Er.domEventHandlers({blur:function(){return t.$textarea.triggerHandler("blur")},focus:function(){return t.$textarea.triggerHandler("focus")}}),Er.updateListener.of((function(e){e.docChanged&&"function"==typeof t.editRecoveryHandler&&t.editRecoveryHandler()})),Er.lineWrapping,yt.allowMultipleSelections.of(!0),Zr(),Wr.of([].concat(Bc(Ph),Bc(Sc),Bc(Hl)))]);mw.hook("editRecovery.loadEnd").add((function(e){t.editRecoveryHandler=e.fieldChangeHandler})),this.initialize(s),this.view.scrollDOM.scrollTop=n,this.view.dispatch({selection:B.create([B.range(e,i)]),scrollIntoView:!0}),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.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})}}])&&Rc(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),e}(_s);function _c(t){return _c="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},_c(t)}function qc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);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=Xc.tokenTable,Object.keys(this.config.tags).forEach((function(t){return Xc.addTag(t)}))}var e,i;return e=t,i=[{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(";"))?Xc.tags.htmlEntity:e}},{key:"makeStyle",value:function(t,e,i){return this.isBold&&(t+=" "+Xc.tags.strong),this.isItalic&&(t+=" "+Xc.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(Xc.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(Xc.tags.sectionHeader)):i.match(/^.*?=)/,!1)&&(i.backUp(t),n.tokenize=e.eatBlock(Xc.tags.sectionHeader,"\x3c!--",!1)),Xc.tags.section):e.eatWikiText(Xc.tags.section)(i,n)}}},{key:"inVariable",value:function(t,e){return t.match(/^[^{}|]+/)?this.makeLocalStyle(Xc.tags.templateVariableName,e):t.eat("|")?(e.tokenize=this.inVariableDefault.bind(this),this.makeLocalStyle(Xc.tags.templateVariableDelimiter,e)):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.tags.templateVariableBracket,e)):t.match("{{{")?(e.stack.push(e.tokenize),this.makeLocalStyle(Xc.tags.templateVariableBracket,e)):(t.next(),this.makeLocalStyle(Xc.tags.templateVariableName,e))}},{key:"inVariableDefault",value:function(t,e){return t.match(/^[^{}[<&~]+/)?this.makeLocalStyle(Xc.tags.templateVariable,e):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.tags.templateVariableBracket,e)):this.eatWikiText(Xc.tags.templateVariable)(t,e)}},{key:"inParserFunctionName",value:function(t,e){return t.match(/^#?[^:}{~]+/)?this.makeLocalStyle(Xc.tags.parserFunctionName,e):t.eat(":")?(e.tokenize=this.inParserFunctionArguments.bind(this),this.makeLocalStyle(Xc.tags.parserFunctionDelimiter,e)):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Xc.tags.parserFunction)(t,e)}},{key:"inParserFunctionArguments",value:function(t,e){return t.match(/^[^|}{[<&~]+/)?this.makeLocalStyle(Xc.tags.parserFunction,e):t.eat("|")?this.makeLocalStyle(Xc.tags.parserFunctionDelimiter,e):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Xc.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(Xc.tags.templateDelimiter,n)):i.match(/^[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Xc.tags.templateBracket,n,"nTemplate")):i.match(/^[\s\u00a0]*/)?e.makeLocalStyle(Xc.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(Xc.tags.templateName,n)):i.eatSpace()?(i.eol(),e.makeLocalStyle(Xc.tags.templateName,n)):e.eatWikiText(Xc.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(Xc.tags.templateArgumentName,n)):e.makeLocalStyle(Xc.tags.template,n):i.eatWhile(/[^|}{[<&~]/)?e.makeLocalStyle(Xc.tags.template,n):i.eat("|")?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(Xc.tags.templateDelimiter,n)):i.match("}}")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Xc.tags.templateBracket,n,"nTemplate")):e.eatWikiText(Xc.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(Xc.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(Xc.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(Xc.tags.extLink,e)):this.eatWikiText(Xc.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(Xc.tags.extLinkBracket,e,"nLink")):t.match(/^[^'\]{&~<]+/)?this.makeStyle(Xc.tags.extLinkText,e):this.eatWikiText(Xc.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(Xc.tags.link,e)):t.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Xc.tags.linkDelimiter,e)):t.match(/^[\s\u00a0]*\]\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.tags.linkBracket,e,"nLink")):t.match(/^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/)||t.eatSpace()?this.makeStyle("".concat(Xc.tags.linkPageName," ").concat(Xc.tags.pageName),e):this.eatWikiText("".concat(Xc.tags.linkPageName," ").concat(Xc.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(Xc.tags.linkToSection,e):t.eat("|")?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Xc.tags.linkDelimiter,e)):t.match("]]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.tags.linkBracket,e,"nLink")):this.eatWikiText(Xc.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(Xc.tags.linkBracket,r,"nLink")):n.match("'''")?(t=!t,i.makeLocalStyle("".concat(Xc.tags.linkText," ").concat(Xc.tags.apostrophes),r)):n.match("''")?(e=!e,i.makeLocalStyle("".concat(Xc.tags.linkText," ").concat(Xc.tags.apostrophes),r)):(s=Xc.tags.linkText,t&&(s+=" "+Xc.tags.strong),e&&(s+=" "+Xc.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&&!Xc.implicitlyClosedHtmlTags[o]?s.tokenize=n.eatChar(">",Xc.tags.htmlTagBracket):s.tokenize=n.eatHtmlTagAttribute(o),n.makeLocalStyle(Xc.tags.htmlTagName,s)):(s.tokenize=e?n.eatChar(">","".concat(Xc.tags.extTagBracket," mw-ext-").concat(o)):n.eatExtTagAttribute(o),n.makeLocalStyle("".concat(Xc.tags.extTagName," mw-ext-").concat(o),s))}}},{key:"eatHtmlTagAttribute",value:function(t){var e=this;return function(i,n){return i.match(/^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/)?e.makeLocalStyle(Xc.tags.htmlTagAttribute,n):i.eat(">")?(t in Xc.implicitlyClosedHtmlTags||n.inHtmlTag.push(t),n.tokenize=n.stack.pop(),e.makeLocalStyle(Xc.tags.htmlTagBracket,n)):i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Xc.tags.htmlTagBracket,n)):e.eatWikiText(Xc.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(Xc.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(Xc.tags.extTagBracket," mw-ext-").concat(t),n)}return i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle("".concat(Xc.tags.extTagBracket," mw-ext-").concat(t),n)):e.eatWikiText("".concat(Xc.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(Xc.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=Xc.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),Xc.tags.tableBracket}},{key:"inTableDefinition",value:function(t,e){return t.sol()?(e.tokenize=this.inTable.bind(this),this.inTable(t,e)):this.eatWikiText(Xc.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(Xc.tags.tableDelimiter,e)):t.eat("+")?(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1,!0),this.makeLocalStyle(Xc.tags.tableDelimiter,e)):t.eat("}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.tags.tableBracket,e)):(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1),this.makeLocalStyle(Xc.tags.tableDelimiter,e));if(t.eat("!"))return t.eatSpace(),e.tokenize=this.eatTableRow(!0,!0),this.makeLocalStyle(Xc.tags.tableDelimiter,e)}return this.eatWikiText("")(t,e)}},{key:"eatTableRow",value:function(t,e,i){var n=this,r="";return i?r=Xc.tags.tableCaption:e&&(r=Xc.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(Xc.tags.tableDelimiter,o);if(t&&s.eat("|"))return o.tokenize=n.eatTableRow(!1,e,i),n.makeLocalStyle(Xc.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(Xc.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(Xc.tags.freeExtLink,e)}else if("{"===t.peek()){if(!t.match("{{",!1))return t.next(),this.makeLocalStyle(Xc.tags.freeExtLink,e)}else if("'"===t.peek()){if(!t.match("''",!1))return t.next(),this.makeLocalStyle(Xc.tags.freeExtLink,e)}else if(t.match(/^[).,]+(?=[^\s\u00a0{[\]<>~).,])/))return this.makeLocalStyle(Xc.tags.freeExtLink,e);return e.tokenize=e.stack.pop(),this.makeLocalStyle(Xc.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(Xc.tags.freeExtLinkProtocol,n);switch(r=i.next()){case"-":if(i.match(/^---+/))return Xc.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),Xc.tags.sectionHeader+" "+Xc.tags["sectionHeader".concat(s[1].length+1)];break;case"*":case"#":case";":return i.match(/^[*#;:]*/),Xc.tags.list;case":":return i.match(/^:*{\|/,!1)&&(n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e)),i.match(/^[*#;:]*/),Xc.tags.indenting;case" ":if(!i.match(/^[\s\u00a0]*:*{\|/,!1))return Xc.tags.skipFormatting;if(i.eatSpace(),i.match(/^:+/))return n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e),Xc.tags.indenting;i.eat("{");case"{":if(i.eat("|"))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inTableDefinition.bind(e),Xc.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(Xc.tags.apostrophesBold,n);if(i.eat("'"))return e.isItalic=!e.isItalic,e.makeLocalStyle(Xc.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(Xc.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(Xc.tags.extLinkBracket,n);break;case"{":if(i.match(/^{{(?!{|[^{}]*}}(?!}))/))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inVariable.bind(e),e.makeLocalStyle(Xc.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(Xc.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(Xc.tags.templateBracket,n)):(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(Xc.tags.parserFunctionBracket,n));break;case"<":if(l=!!i.eat("/"),h=i.match(/^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/),i.match("!--"))return c=e.eatBlock(Xc.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?Xc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l,!1),e.makeLocalStyle("".concat(Xc.tags.extTagBracket," mw-ext-").concat(h),n));if(h in Xc.permittedHtmlTags)return!0===l&&h!==n.inHtmlTag.pop()?(i.pos++,Xc.tags.error):!0===l&&h in Xc.implicitlyClosedHtmlTags?Xc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,l||h in Xc.implicitlyClosedHtmlTags,!0),e.makeLocalStyle(Xc.tags.htmlTagBracket,n));i.backUp(h.length)}break;case"~":if(i.match(/^~{2,4}/))return Xc.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]?Xc.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&&Zc(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();mw.loader.getState("ext.wikiEditor")&&mw.hook("wikiEditor.toolbarReady").add((function(t){new Fc(t,function(){var t=new eu((arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||mw.config.get("extCodeMirrorConfig")).mediawiki,e=Ga.define(t),i=function(t,e){let i,n=[Ta];return t instanceof xa&&(t.module&&n.push(Er.styleModule.of(t.module)),i=t.themeType),i?n.push(Sa.computeN([Er.darkTheme],(e=>e.facet(Er.darkTheme)==("dark"==i)?[t]:[]))):n.push(Sa.of(t)),n}(xa.define(Xc.getTagStyles(t)));return new ha(e,i)}()).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 2199a594..f3903904 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,EAAMC,KAAKC,OACtB,MAAM,IAAIC,WAAW,oBAAoBH,2BAA6BC,KAAKC,UAC/E,OAAOD,KAAKG,U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AEhnB,MACHgnB,EAAEnJ,KACV,EAEA8oD,UAAW,SAAE3mE,GACPA,EAAMomF,SAAWpmF,EAAMomF,QAAQzf,WACnC3mE,EAAMomF,QAAQzf,UAAW3mE,EAAMwmF,SAEjC,EAQA1f,WAAYz3E,KAAKy3E,WAEnB,I,wEAAC2b,CAAA,CArqC2B,GCbxBr7B,GAAGyhC,OAAOC,SAAU,mBACxB1hC,GAAGyB,KAAM,2BAA4B3zD,KAAK,SAAE4xD,GAC9B,IAAIgyB,GAAsBhyB,ED8rCZ,WAAqB,IAI3CmE,EAHO,IAAIw3B,IADmBl/D,UAAAj0B,OAAA,QAAA2N,IAAAsmB,UAAA,GAAAA,UAAA,GAAG,OAE5B6jC,GAAG9nD,OAAOM,IAAK,wBAEN2mF,UACd/+B,EAAOif,GAAepnE,OAAQ4rD,GAC9B4K,ENoeP,SAA4BA,EAAa9iD,GACrC,IAA6ByvD,EAAzBn/D,EAAM,CAAC2/D,IAcX,OAbInN,aAAuBsM,KACnBtM,EAAY0M,QACZl/D,EAAIjQ,KAAK6kD,GAAWjvB,YAAYh3B,GAAG6jE,EAAY0M,SACnDC,EAAY3M,EAAY2M,WAInBA,EACLn/D,EAAIjQ,KAAKqvE,GAAiB5iE,SAAS,CAACo4C,GAAWhK,YAAYjuC,GAChDA,EAAMG,MAAM83C,GAAWhK,aAA4B,QAAbu0B,GAAuB,CAAC3M,GAAe,MAGxFxyD,EAAIjQ,KAAKqvE,GAAiBzwE,GAAG6jE,IAC1BxyD,CACX,CMpfqB0lF,CACnB5mB,GAAe9iE,OACd+jF,GAAW4F,aAAc/9B,KAG3B,OAAO,IAAIiU,GAAiB1X,EAAMqO,EACnC,CC1sCoDozB,IAC7CC,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.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/./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.mode.mediawiki.config.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