mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-12-12 06:15:27 +00:00
2 lines
274 KiB
JavaScript
2 lines
274 KiB
JavaScript
|
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s="./src/codemirror.wikieditor.init.js")}({"./src/codemirror.wikieditor.init.js":function(t,e,i){"use strict";i.r(e);class n{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,i){let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),s.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let i=[];return this.decompose(t,e,i,0),s.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new h(this),r=new h(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 h(this,t)}iterRange(t,e=this.length){return new a(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 c(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new r(t):s.from(r.split(t,[])):n.empty}}class r extends n{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 u(n,o,i,s);n=o+1,i++}}decompose(t,e,i,n){let s=t<=0&&e>=this.length?this:new r(l(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&n){let t=i.pop(),e=o(s.text,t.text.slice(),0,s.length);if(e.length<=32)i.push(new r(e,t.length+s.length));else{let t=e.length>>1;i.push(new r(e.slice(0,t)),new r(e.slice(t)))}}else i.push(s)}replace(t,e,i){if(!(i instanceof r))return super.replace(t,e,i);let n=o(this.text,o(i.text,l(this.text,0,t)),e),h=this.length+i.length-(e-t);return n.length<=32?new r(n,h):s.from(r.split(n,[]),h)}sliceString(t,e=this.length,i="\n"){let n="";for(let r=0,s=0;r<=e&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;r>t&&s&&(n+=i),t<l&&e>r&&(n+=o.slice(Math.max(0,t-r),e-r)),r=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let s of t)i.push(s),n+=s.length+1,32==i.length&&(e.push(new r(i,n)),i=[],n=-1);return n>-1&&e.push(new r(i,n)),e}}class s extends n{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,l=i+s.lines-1;if((e?l:o)>=t)return s.lineInner(t,e,i,n);n=o+1,i=l+1}}decompose(t,e,i,n){for(let r=0,s=0;s<=e&&r<this.children.length;r++){let o=this.children[r],l=s+o.leng
|
||
|
//# sourceMappingURL=main.js.map.json
|