t)return o;i.to==t&&(i.from!=i.to&&"before"==r?n=o:pe=o),i.from==t&&(i.from!=i.to&&"before"!=r?n=o:pe=o)}return null!=n?n:pe}var de=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,o=/[LRr]/,i=/[Lb1n]/,a=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(c,u){var l,f="ltr"==u?"L":"R";if(0==c.length||"ltr"==u&&!r.test(c))return!1;for(var p=c.length,h=[],d=0;d-1&&(n[t]=o.slice(0,i).concat(o.slice(i+1)))}}}function ge(e,t){var r=ye(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),o=0;o0}function we(e){e.prototype.on=function(e,t){Qe(this,e,t)},e.prototype.off=function(e,t){ve(this,e,t)}}function xe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ee(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ce(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Se(e){xe(e),Ee(e)}function Oe(e){return e.target||e.srcElement}function Me(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),v&&e.ctrlKey&&1==t&&(t=3),t}var ke,Ae,De=function(){if(a&&s<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}();function He(e){if(null==ke){var t=M("span","\u200b");O(e,M("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&s<8))}var r=ke?M("span","\u200b"):M("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ne(e){if(null!=Ae)return Ae;var t=O(e,document.createTextNode("A\u062eA")),r=E(t,0,1).getBoundingClientRect(),n=E(t,1,2).getBoundingClientRect();return S(e),!(!r||r.left==r.right)&&(Ae=n.right-r.right<3)}var Pe=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var o=e.indexOf("\n",t);-1==o&&(o=e.length);var i=e.slice(t,"\r"==e.charAt(o-1)?o-1:o),a=i.indexOf("\r");-1!=a?(r.push(i.slice(0,a)),t+=a+1):(r.push(i),t=o+1)}return r}:function(e){return e.split(/\r\n?|\n/)},je=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ve=function(){var e=M("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Fe=null,Ie={},Re={};function Be(e){if("string"==typeof e&&Re.hasOwnProperty(e))e=Re[e];else if(e&&"string"==typeof e.name&&Re.hasOwnProperty(e.name)){var t=Re[e.name];"string"==typeof t&&(t={name:t}),(e=ne(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Be("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Be("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function ze(e,t){t=Be(t);var r=Ie[t.name];if(!r)return ze(e,"text/plain");var n=r(e,t);if(qe.hasOwnProperty(t.name)){var o=qe[t.name];for(var i in o)o.hasOwnProperty(i)&&(n.hasOwnProperty(i)&&(n["_"+i]=n[i]),n[i]=o[i])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a];return n}var qe={};function Ue(e,t){var r=qe.hasOwnProperty(e)?qe[e]:qe[e]={};B(t,r)}function Ge(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var o=t[n];o instanceof Array&&(o=o.concat([])),r[n]=o}return r}function We(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function $e(e,t,r){return!e.startState||e.startState(t,r)}var Ze=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function Xe(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var o=r.children[n],i=o.chunkSize();if(t=e.first&&tr?ot(r,Xe(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?ot(e.line,t):r<0?ot(e.line,0):e}(t,Xe(e,t.line).text.length)}function pt(e,t){for(var r=[],n=0;n=this.string.length},Ze.prototype.sol=function(){return this.pos==this.lineStart},Ze.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ze.prototype.next=function(){if(this.post},Ze.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ze.prototype.skipToEnd=function(){this.pos=this.string.length},Ze.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ze.prototype.backUp=function(e){this.pos-=e},Ze.prototype.column=function(){return this.lastColumnPos0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var o=function(e){return r?e.toLowerCase():e},i=this.string.substr(this.pos,e.length);if(o(i)==o(e))return!1!==t&&(this.pos+=e.length),!0},Ze.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ze.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ze.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ze.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ht=function(e,t){this.state=e,this.lookAhead=t},dt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function Tt(e,t,r,n){var o=[e.state.modeGen],i={};wt(e,t.text,e.doc.mode,r,function(e,t){return o.push(e,t)},i,n);for(var a=r.state,s=function(n){r.baseTokens=o;var s=e.state.overlays[n],c=1,u=0;r.state=!0,wt(e,t.text,s.mode,r,function(e,t){for(var r=c;ue&&o.splice(c,1,e,o[c+1],n),c+=2,u=Math.min(e,n)}if(t)if(s.opaque)o.splice(r,c-r,e,"overlay "+t),c=r+2;else for(;re.options.maxHighlightLength&&Ge(e.doc.mode,n.state),i=Tt(e,t,n);o&&(n.state=o),t.stateAfter=n.save(!o),t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Qt(e,t,r){var n=e.doc,o=e.display;if(!n.mode.startState)return new dt(n,!0,t);var i=function(e,t,r){for(var n,o,i=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>a;--s){if(s<=i.first)return i.first;var c=Xe(i,s-1),u=c.stateAfter;if(u&&(!r||s+(u instanceof ht?u.lookAhead:0)<=i.modeFrontier))return s;var l=z(c.text,null,e.options.tabSize);(null==o||n>l)&&(o=s-1,n=l)}return o}(e,t,r),a=i>n.first&&Xe(n,i-1).stateAfter,s=a?dt.fromSaved(n,a,i):new dt(n,$e(n.mode),i);return n.iter(i,t,function(r){yt(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=o.viewFrom&&nt.start)return i}throw new Error("Mode "+e.name+" failed to advance stream.")}dt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},dt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},dt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},dt.fromSaved=function(e,t,r){return t instanceof ht?new dt(e,Ge(e.mode,t.state),r,t.lookAhead):new dt(e,Ge(e.mode,t),r)},dt.prototype.save=function(e){var t=!1!==e?Ge(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ht(t,this.maxLookAhead):t};var bt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Lt(e,t,r,n){var o,i=e.doc,a=i.mode;t=ft(i,t);var s,c=Xe(i,t.line),u=Qt(e,t.line,r),l=new Ze(c.text,e.options.tabSize,u);for(n&&(s=[]);(n||l.pose.options.maxHighlightLength?(s=!1,a&&yt(e,t,n,f.pos),f.pos=t.length,c=null):c=_t(gt(r,f,n.state,p),i),p){var h=p[0].name;h&&(c="m-"+(c?h+" "+c:h))}if(!s||l!=c){for(;u=t:i.to>t);(n||(n=[])).push(new Ct(a,i.from,c?null:i.to))}}return n}(r,o,a),c=function(e,t,r){var n;if(e)for(var o=0;o=t:i.to>t);if(s||i.from==t&&"bookmark"==a.type&&(!r||i.marker.insertLeft)){var c=null==i.from||(a.inclusiveLeft?i.from<=t:i.from0&&s)for(var g=0;gt)&&(!r||Pt(r,i.marker)<0)&&(r=i.marker)}return r}function Rt(e,t,r,n,o){var i=Xe(e,t),a=Et&&i.markedSpans;if(a)for(var s=0;s=0&&f<=0||l<=0&&f>=0)&&(l<=0&&(c.marker.inclusiveRight&&o.inclusiveLeft?it(u.to,r)>=0:it(u.to,r)>0)||l>=0&&(c.marker.inclusiveRight&&o.inclusiveLeft?it(u.from,n)<=0:it(u.from,n)<0)))return!0}}}function Bt(e){for(var t;t=Vt(e);)e=t.find(-1,!0).line;return e}function zt(e,t){var r=Xe(e,t),n=Bt(r);return r==n?t:et(n)}function qt(e,t){if(t>e.lastLine())return t;var r,n=Xe(e,t);if(!Ut(e,n))return t;for(;r=Ft(n);)n=r.find(1,!0).line;return et(n)+1}function Ut(e,t){var r=Et&&t.markedSpans;if(r)for(var n=void 0,o=0;ot.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var Xt=function(e,t,r){this.text=e,Dt(this,t),this.height=r?r(this):1};function Kt(e){e.parent=null,At(e)}Xt.prototype.lineNo=function(){return et(this)},we(Xt);var Jt={},Yt={};function er(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Yt:Jt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function tr(e,t){var r=k("span",null,null,c?"padding-right: .1px":null),n={pre:k("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var i=o?t.rest[o-1]:t.line,a=void 0;n.pos=0,n.addToken=nr,Ne(e.display.measure)&&(a=Te(i,e.doc.direction))&&(n.addToken=or(n.addToken,a)),n.map=[];var s=t!=e.display.externalMeasured&&et(i);ar(i,n,mt(e,i,s)),i.styleClasses&&(i.styleClasses.bgClass&&(n.bgClass=N(i.styleClasses.bgClass,n.bgClass||"")),i.styleClasses.textClass&&(n.textClass=N(i.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(He(e.display.measure))),0==o?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(c){var u=n.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return ge(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=N(n.pre.className,n.textClass||"")),n}function rr(e){var t=M("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function nr(e,t,r,n,o,i,c){if(t){var u,l=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",o=0;ou&&f.from<=u);p++);if(f.to>=l)return e(r,n,o,i,a,s,c);e(r,n.slice(0,f.to-u),o,i,null,s,c),i=null,n=n.slice(f.to-u),u=f.to}}}function ir(e,t,r,n){var o=!n&&r.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!n&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",r.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function ar(e,t,r){var n=e.markedSpans,o=e.text,i=0;if(n)for(var a,s,c,u,l,f,p,h=o.length,d=0,T=1,m="",Q=0;;){if(Q==d){c=u=l=s="",p=null,f=null,Q=1/0;for(var y=[],v=void 0,g=0;gd||L.collapsed&&b.to==d&&b.from==d)){if(null!=b.to&&b.to!=d&&Q>b.to&&(Q=b.to,u=""),L.className&&(c+=" "+L.className),L.css&&(s=(s?s+";":"")+L.css),L.startStyle&&b.from==d&&(l+=" "+L.startStyle),L.endStyle&&b.to==Q&&(v||(v=[])).push(L.endStyle,b.to),L.title&&((p||(p={})).title=L.title),L.attributes)for(var _ in L.attributes)(p||(p={}))[_]=L.attributes[_];L.collapsed&&(!f||Pt(f.marker,L)<0)&&(f=b)}else b.from>d&&Q>b.from&&(Q=b.from)}if(v)for(var w=0;w=h)break;for(var E=Math.min(h,Q);;){if(m){var C=d+m.length;if(!f){var S=C>E?m.slice(0,E-d):m;t.addToken(t,S,a?a+c:c,l,d+S.length==Q?u:"",s,p)}if(C>=E){m=m.slice(E-d),d=E;break}d=C,l=""}m=o.slice(i,i=r[T++]),a=er(r[T++],t.cm.options)}}else for(var O=1;Or)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}}function Dr(e,t,r,n){return Pr(e,Nr(e,t),r,n)}function Hr(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&t2&&i.push((c.bottom+u.top)/2-r.top)}}i.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(i=function(e,t,r,n){var o,i=Fr(t.map,r,n),c=i.node,u=i.start,l=i.end,f=i.collapse;if(3==c.nodeType){for(var p=0;p<4;p++){for(;u&&ue(t.line.text.charAt(i.coverStart+u));)--u;for(;i.coverStart+l1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,o))}else{var h;u>0&&(f=n="right"),o=e.options.lineWrapping&&(h=c.getClientRects()).length>1?h["right"==n?h.length-1:0]:c.getBoundingClientRect()}if(a&&s<9&&!u&&(!o||!o.left&&!o.right)){var d=c.parentNode.getClientRects()[0];o=d?{left:d.left,right:d.left+an(e.display),top:d.top,bottom:d.bottom}:Vr}for(var T=o.top-t.rect.top,m=o.bottom-t.rect.top,Q=(T+m)/2,y=t.view.measure.heights,v=0;vt)&&(o=(i=c-s)-1,t>=c&&(a="right")),null!=o){if(n=e[u+2],s==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==o)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],a="left";if("right"==r&&o==c-s)for(;u=0&&(r=e[o]).left==r.right;o--);return r}function Rr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=n.text.length?(c=n.text.length,u="before"):c<=0&&(c=0,u="after"),!s)return a("before"==u?c-1:c,"before"==u);function l(e,t,r){var n=s[t],o=1==n.level;return a(r?e-1:e,o!=r)}var f=he(s,c,u),p=pe,h=l(c,f,"before"==u);return null!=p&&(h.other=l(c,p,"before"!=u)),h}function Kr(e,t){var r=0;t=ft(e.doc,t),e.options.lineWrapping||(r=an(e.display)*t.ch);var n=Xe(e.doc,t.line),o=Wt(n)+Er(e.display);return{left:r,right:r,top:o,bottom:o+n.height}}function Jr(e,t,r,n,o){var i=ot(e,t,r);return i.xRel=o,n&&(i.outside=n),i}function Yr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Jr(n.first,0,null,-1,-1);var o=tt(n,r),i=n.first+n.size-1;if(o>i)return Jr(n.first+n.size-1,Xe(n,i).text.length,null,1,1);t<0&&(t=0);for(var a=Xe(n,o);;){var s=nn(e,a,o,t,r),c=It(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!c)return s;var u=c.find(1);if(u.line==o)return u;a=Xe(n,o=u.line)}}function en(e,t,r,n){n-=Gr(t);var o=t.text.length,i=fe(function(t){return Pr(e,r,t-1).bottom<=n},o,0);return o=fe(function(t){return Pr(e,r,t).top>n},i,o),{begin:i,end:o}}function tn(e,t,r,n){r||(r=Nr(e,t));var o=Wr(e,t,Pr(e,r,n),"line").top;return en(e,t,r,o)}function rn(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function nn(e,t,r,n,o){o-=Wt(t);var i=Nr(e,t),a=Gr(t),s=0,c=t.text.length,u=!0,l=Te(t,e.doc.direction);if(l){var f=(e.options.lineWrapping?function(e,t,r,n,o,i,a){var s=en(e,t,n,a),c=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var l=null,f=null,p=0;p=u||h.to<=c)){var d=1!=h.level,T=Pr(e,n,d?Math.min(u,h.to)-1:Math.max(c,h.from)).right,m=Tm)&&(l=h,f=m)}}return l||(l=o[o.length-1]),l.fromu&&(l={from:l.from,to:u,level:l.level}),l}:function(e,t,r,n,o,i,a){var s=fe(function(s){var c=o[s],u=1!=c.level;return rn(Xr(e,ot(r,u?c.to:c.from,u?"before":"after"),"line",t,n),i,a,!0)},0,o.length-1),c=o[s];if(s>0){var u=1!=c.level,l=Xr(e,ot(r,u?c.from:c.to,u?"after":"before"),"line",t,n);rn(l,i,a,!0)&&l.top>a&&(c=o[s-1])}return c})(e,t,r,i,l,n,o);u=1!=f.level,s=u?f.from:f.to-1,c=u?f.to:f.from-1}var p,h,d=null,T=null,m=fe(function(t){var r=Pr(e,i,t);return r.top+=a,r.bottom+=a,!!rn(r,n,o,!1)&&(r.top<=o&&r.left<=n&&(d=t,T=r),!0)},s,c),Q=!1;if(T){var y=n-T.left=g.bottom?1:0}return m=le(t.text,m,1),Jr(r,m,h,Q,n-p)}function on(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==jr){jr=M("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)jr.appendChild(document.createTextNode("x")),jr.appendChild(M("br"));jr.appendChild(document.createTextNode("x"))}O(e.measure,jr);var r=jr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),S(e.measure),r||1}function an(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),r=M("pre",[t],"CodeMirror-line-like");O(e.measure,r);var n=t.getBoundingClientRect(),o=(n.right-n.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function sn(e){for(var t=e.display,r={},n={},o=t.gutters.clientLeft,i=t.gutters.firstChild,a=0;i;i=i.nextSibling,++a){var s=e.display.gutterSpecs[a].className;r[s]=i.offsetLeft+i.clientLeft+o,n[s]=i.clientWidth}return{fixedPos:cn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function cn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function un(e){var t=on(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/an(e.display)-3);return function(o){if(Ut(e.doc,o))return 0;var i=0;if(o.widgets)for(var a=0;a0&&(c=Xe(e.doc,u.line).text).length==u.ch){var l=z(c,c.length,e.options.tabSize)-c.length;u=ot(u.line,Math.max(0,Math.round((i-Sr(e.display).left)/an(e.display))-l))}return u}function pn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;nt)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Et&&zt(e.doc,t)o.viewFrom?Tn(e):(o.viewFrom+=n,o.viewTo+=n);else if(t<=o.viewFrom&&r>=o.viewTo)Tn(e);else if(t<=o.viewFrom){var i=mn(e,r,r+n,1);i?(o.view=o.view.slice(i.index),o.viewFrom=i.lineN,o.viewTo+=n):Tn(e)}else if(r>=o.viewTo){var a=mn(e,t,t,-1);a?(o.view=o.view.slice(0,a.index),o.viewTo=a.lineN):Tn(e)}else{var s=mn(e,t,t,-1),c=mn(e,r,r+n,1);s&&c?(o.view=o.view.slice(0,s.index).concat(cr(e,s.lineN,c.lineN)).concat(o.view.slice(c.index)),o.viewTo+=n):Tn(e)}var u=o.externalMeasured;u&&(r=o.lineN&&t=n.viewTo)){var i=n.view[pn(e,t)];if(null!=i.node){var a=i.changes||(i.changes=[]);-1==U(a,r)&&a.push(r)}}}function Tn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function mn(e,t,r,n){var o,i=pn(e,t),a=e.display.view;if(!Et||r==e.doc.first+e.doc.size)return{index:i,lineN:r};for(var s=e.display.viewFrom,c=0;c0){if(i==a.length-1)return null;o=s+a[i].size-t,i++}else o=s-t;t+=o,r+=o}for(;zt(e.doc,r)!=r;){if(i==(n<0?0:a.length-1))return null;r+=n*a[i-(n<0?1:0)].size,i+=n}return{index:i,lineN:r}}function Qn(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||c.to().line0?a:e.defaultCharWidth())+"px"}if(n.other){var s=r.appendChild(M("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=n.other.left+"px",s.style.top=n.other.top+"px",s.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function bn(e,t){return e.top-t.top||e.left-t.left}function Ln(e,t,r){var n=e.display,o=e.doc,i=document.createDocumentFragment(),a=Sr(e.display),s=a.left,c=Math.max(n.sizerWidth,Mr(e)-n.sizer.offsetLeft)-a.right,u="ltr"==o.direction;function l(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),i.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?c-e:r)+"px;\n height: "+(n-t)+"px"))}function f(t,r,n){var i,a,f=Xe(o,t),p=f.text.length;function h(r,n){return Zr(e,ot(t,r),"div",f,n)}function d(t,r,n){var o=tn(e,f,null,t),i="ltr"==r==("after"==n)?"left":"right",a="after"==n?o.begin:o.end-(/\s/.test(f.text.charAt(o.end-1))?2:1);return h(a,i)[i]}var T=Te(f,o.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var o=!1,i=0;it||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",i),o=!0)}o||n(t,r,"ltr")}(T,r||0,null==n?p:n,function(e,t,o,f){var m="ltr"==o,Q=h(e,m?"left":"right"),y=h(t-1,m?"right":"left"),v=null==r&&0==e,g=null==n&&t==p,b=0==f,L=!T||f==T.length-1;if(y.top-Q.top<=3){var _=(u?v:g)&&b,w=(u?g:v)&&L,x=_?s:(m?Q:y).left,E=w?c:(m?y:Q).right;l(x,Q.top,E-x,Q.bottom)}else{var C,S,O,M;m?(C=u&&v&&b?s:Q.left,S=u?c:d(e,o,"before"),O=u?s:d(t,o,"after"),M=u&&g&&L?c:y.right):(C=u?d(e,o,"before"):s,S=!u&&v&&b?c:Q.right,O=!u&&g&&L?s:y.left,M=u?d(t,o,"after"):c),l(C,Q.top,S-C,Q.bottom),Q.bottom0?t.blinker=setInterval(function(){e.hasFocus()||Cn(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function wn(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||En(e))}function xn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Cn(e))},100)}function En(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(ge(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),c&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),_n(e))}function Cn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ge(e,"blur",e,t),e.state.focused=!1,C(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Sn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=Math.max(0,t.scroller.getBoundingClientRect().top),o=t.lineDiv.getBoundingClientRect().top,i=0,c=0;c.005||T<-.005)&&(oe.display.sizerWidth){var Q=Math.ceil(p/an(e.display));Q>e.display.maxLineLength&&(e.display.maxLineLength=Q,e.display.maxLine=u.line,e.display.maxLineChanged=!0)}}}Math.abs(i)>2&&(t.scroller.scrollTop+=i)}function On(e){if(e.widgets)for(var t=0;t=a&&(i=tt(t,Wt(Xe(t,c))-e.wrapper.clientHeight),a=c)}return{from:i,to:Math.max(a,i+1)}}function kn(e,t){var r=e.display,n=on(e.display);t.top<0&&(t.top=0);var o=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,i=kr(e),a={};t.bottom-t.top>i&&(t.bottom=t.top+i);var s=e.doc.height+Cr(r),c=t.tops-n;if(t.topo+i){var l=Math.min(t.top,(u?s:t.bottom)-i);l!=o&&(a.scrollTop=l)}var f=e.options.fixedGutter?0:r.gutters.offsetWidth,p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft-f,h=Mr(e)-r.gutters.offsetWidth,d=t.right-t.left>h;return d&&(t.right=t.left+h),t.left<10?a.scrollLeft=0:t.lefth+p-3&&(a.scrollLeft=t.right+(d?0:10)-h),a}function An(e,t){null!=t&&(Nn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Dn(e){Nn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Hn(e,t,r){null==t&&null==r||Nn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Nn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Kr(e,t.from),n=Kr(e,t.to);Pn(e,r,n,t.margin)}}function Pn(e,t,r,n){var o=kn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Hn(e,o.scrollLeft,o.scrollTop)}function jn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||uo(e,{top:t}),Vn(e,t,!0),r&&uo(e),oo(e,100))}function Vn(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Fn(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,po(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function In(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Cr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Or(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Rn=function(e,t,r){this.cm=r;var n=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=o.tabIndex=-1,e(n),e(o),Qe(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Qe(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Rn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var o=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var i=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+i)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Rn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rn.prototype.zeroWidthHack=function(){var e=v&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new q,this.disableVert=new q},Rn.prototype.enableZeroWidthBar=function(e,t,r){e.style.visibility="",t.set(1e3,function n(){var o=e.getBoundingClientRect(),i="vert"==r?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);i!=e?e.style.visibility="hidden":t.set(1e3,n)})},Rn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Bn=function(){};function zn(e,t){t||(t=In(e));var r=e.display.barWidth,n=e.display.barHeight;qn(e,t);for(var o=0;o<4&&r!=e.display.barWidth||n!=e.display.barHeight;o++)r!=e.display.barWidth&&e.options.lineWrapping&&Sn(e),qn(e,In(e)),r=e.display.barWidth,n=e.display.barHeight}function qn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Bn.prototype.update=function(){return{bottom:0,right:0}},Bn.prototype.setScrollLeft=function(){},Bn.prototype.setScrollTop=function(){},Bn.prototype.clear=function(){};var Un={native:Rn,null:Bn};function Gn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&C(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Un[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Qe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?Fn(e,t):jn(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var Wn=0;function $n(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Wn,markArrays:null},t=e.curOp,ur?ur.ops.push(t):t.ownsGroup=ur={ops:[t],delayedCallbacks:[]}}function Zn(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ao(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Kn(e){var t=e.cm,r=t.display;e.updatedDisplay&&Sn(t),e.barMeasure=In(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Dr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Or(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Mr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Jn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft1&&(a=!0)),null!=u.scrollLeft&&(Fn(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(a=!0)),!a)break}return o}(t,ft(n,e.scrollToPos.from),ft(n,e.scrollToPos.to),e.scrollToPos.margin);!function(e,t){if(!be(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),o=null,i=r.wrapper.ownerDocument;if(t.top+n.top<0?o=!0:t.bottom+n.top>(i.defaultView.innerHeight||i.documentElement.clientHeight)&&(o=!1),null!=o&&!T){var a=M("div","\u200b",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Er(e.display))+"px;\n height: "+(t.bottom-t.top+Or(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(o),e.display.lineSpace.removeChild(a)}}}(t,o)}var i=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(i)for(var s=0;s=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Qt(e,t.highlightFrontier),o=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(i){if(n.line>=e.display.viewFrom){var a=i.styles,s=i.text.length>e.options.maxHighlightLength?Ge(t.mode,n.state):null,c=Tt(e,i,n,!0);s&&(n.state=s),i.styles=c.styles;var u=i.styleClasses,l=c.classes;l?i.styleClasses=l:u&&(i.styleClasses=null);for(var f=!a||a.length!=i.styles.length||u!=l&&(!u||!l||u.bgClass!=l.bgClass||u.textClass!=l.textClass),p=0;!f&&pr)return oo(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),o.length&&eo(e,function(){for(var t=0;t=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Qn(e))return!1;ho(e)&&(Tn(e),t.dims=sn(e));var o=n.first+n.size,i=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(o,t.visible.to+e.options.viewportMargin);r.viewFroma&&r.viewTo-a<20&&(a=Math.min(o,r.viewTo)),Et&&(i=zt(e.doc,i),a=qt(e.doc,a));var s=i!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=cr(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=cr(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,pn(e,r)))),n.viewTo=r}(e,i,a),r.viewOffset=Wt(Xe(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=Qn(e);if(!s&&0==u&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var l=function(e){if(e.hasFocus())return null;var t=D(V(e));if(!t||!A(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=I(e).getSelection();n.anchorNode&&n.extend&&A(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return u>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,o=e.options.lineNumbers,i=n.lineDiv,a=i.firstChild;function s(t){var r=t.nextSibling;return c&&v&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,l=n.viewFrom,f=0;f-1&&(h=!1),hr(e,p,l,r)),h&&(S(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(nt(e.options,l)))),a=p.node.nextSibling}else{var d=gr(e,p,l,r);i.insertBefore(d,a)}l+=p.size}for(;a;)a=s(a)}(e,r.updateLineNumbers,t.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=D(F(e.activeElt))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&A(document.body,e.anchorNode)&&A(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,r=t.defaultView.getSelection(),n=t.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),r.removeAllRanges(),r.addRange(n),r.extend(e.focusNode,e.focusOffset)}}(l),S(r.cursorDiv),S(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,oo(e,400)),r.updateLineNumbers=null,!0}function co(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Mr(e))n&&(t.visible=Mn(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Cr(e.display)-kr(e),r.top)}),t.visible=Mn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!so(e,t))break;Sn(e);var o=In(e);yn(e),zn(e,o),fo(e,o),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function uo(e,t){var r=new ao(e,t);if(so(e,r)){Sn(e),co(e,r);var n=In(e);yn(e),zn(e,n),fo(e,n),r.finish()}}function lo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",fr(e,"gutterChanged",e)}function fo(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Or(e)+"px"}function po(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=cn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,o=t.gutters.offsetWidth,i=n+"px",a=0;a=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),a&&s<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),c||r&&y||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=To(o.gutters,o.lineNumbers),mo(i),n.init(i)}ao.prototype.signal=function(e,t){_e(e,t)&&this.events.push(arguments)},ao.prototype.finish=function(){for(var e=0;eu.clientWidth,d=u.scrollHeight>u.clientHeight;if(o&&h||i&&d){if(i&&v&&c)e:for(var T=t.target,m=s.view;T!=u;T=T.parentNode)for(var Q=0;Q=0&&it(e,n.to())<=0)return r}return-1};var xo=function(e,t){this.anchor=e,this.head=t};function Eo(e,t,r){var n=e&&e.options.selectionsMayTouch,o=t[r];t.sort(function(e,t){return it(e.from(),t.from())}),r=U(t,o);for(var i=1;i0:c>=0){var u=ut(s.from(),a.from()),l=ct(s.to(),a.to()),f=s.empty()?a.from()==a.head:s.from()==s.head;i<=r&&--r,t.splice(--i,2,new xo(f?l:u,f?u:l))}}return new wo(t,r)}function Co(e,t){return new wo([new xo(e,t||e)],0)}function So(e){return e.text?ot(e.from.line+e.text.length-1,ee(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Oo(e,t){if(it(e,t.from)<0)return e;if(it(e,t.to)<=0)return So(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=So(t).ch-t.to.ch),ot(r,n)}function Mo(e,t){for(var r=[],n=0;n1&&e.remove(s.line+1,d-1),e.insert(s.line+1,Q)}fr(e,"change",e,t)}function Po(e,t,r){!function e(n,o,i){if(n.linked)for(var a=0;as-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(i=function(e,t){return t?(Ro(e.done),ee(e.done)):e.done.length&&!ee(e.done).ranges?ee(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ee(e.done)):void 0}(o,o.lastOp==n)))a=ee(i.changes),0==it(t.from,t.to)&&0==it(t.from,a.to)?a.to=So(t):i.changes.push(Io(e,t));else{var c=ee(o.done);for(c&&c.ranges||qo(e.sel,o.done),i={changes:[Io(e,t)],generation:o.generation},o.done.push(i);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(r),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=s,o.lastOp=o.lastSelOp=n,o.lastOrigin=o.lastSelOrigin=t.origin,a||ge(e,"historyAdded")}function zo(e,t,r,n){var o=e.history,i=n&&n.origin;r==o.lastSelOp||i&&o.lastSelOrigin==i&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==i||function(e,t,r,n){var o=t.charAt(0);return"*"==o||"+"==o&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,i,ee(o.done),t))?o.done[o.done.length-1]=t:qo(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=i,o.lastSelOp=r,n&&!1!==n.clearRedo&&Ro(o.undone)}function qo(e,t){var r=ee(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Uo(e,t,r,n){var o=t["spans_"+e.id],i=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((o||(o=t["spans_"+e.id]={}))[i]=r.markedSpans),++i})}function Go(e){if(!e)return null;for(var t,r=0;r-1&&(ee(s)[f]=u[f],delete u[f])}}}return n}function Zo(e,t,r,n){if(n){var o=e.anchor;if(r){var i=it(t,o)<0;i!=it(r,o)<0?(o=t,t=r):i!=it(t,r)<0&&(t=r)}return new xo(o,t)}return new xo(r||t,t)}function Xo(e,t,r,n,o){null==o&&(o=e.cm&&(e.cm.display.shift||e.extend)),ti(e,new wo([Zo(e.sel.primary(),t,r,o)],0),n)}function Ko(e,t,r){for(var n=[],o=e.cm&&(e.cm.display.shift||e.extend),i=0;i=t.ch:s.to>t.ch))){if(o&&(ge(c,"beforeCursorEnter"),c.explicitlyCleared)){if(i.markedSpans){--a;continue}break}if(!c.atomic)continue;if(r){var f=c.find(n<0?1:-1),p=void 0;if((n<0?l:u)&&(f=ci(e,f,-n,f&&f.line==t.line?i:null)),f&&f.line==t.line&&(p=it(f,r))&&(n<0?p<0:p>0))return ai(e,f,t,n,o)}var h=c.find(n<0?-1:1);return(n<0?u:l)&&(h=ci(e,h,n,h.line==t.line?i:null)),h?ai(e,h,t,n,o):null}}return t}function si(e,t,r,n,o){var i=n||1,a=ai(e,t,r,i,o)||!o&&ai(e,t,r,i,!0)||ai(e,t,r,-i,o)||!o&&ai(e,t,r,-i,!0);return a||(e.cantEdit=!0,ot(e.first,0))}function ci(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ft(e,ot(t.line-1)):null:r>0&&t.ch==(n||Xe(e,t.line)).text.length?t.line0)){var l=[c,1],f=it(u.from,s.from),p=it(u.to,s.to);(f<0||!a.inclusiveLeft&&!f)&&l.push({from:u.from,to:s.from}),(p>0||!a.inclusiveRight&&!p)&&l.push({from:s.to,to:u.to}),o.splice.apply(o,l),c+=l.length-3}}return o}(e,t.from,t.to);if(n)for(var o=n.length-1;o>=0;--o)pi(e,{from:n[o].from,to:n[o].to,text:o?[""]:t.text,origin:t.origin});else pi(e,t)}}function pi(e,t){if(1!=t.text.length||""!=t.text[0]||0!=it(t.from,t.to)){var r=Mo(e,t);Bo(e,t,r,e.cm?e.cm.curOp.id:NaN),Ti(e,t,r,Mt(e,t));var n=[];Po(e,function(e,r){r||-1!=U(n,e.history)||(vi(e.history,t),n.push(e.history)),Ti(e,t,null,Mt(e,t))})}}function hi(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var o,i=e.history,a=e.sel,s="undo"==t?i.done:i.undone,c="undo"==t?i.undone:i.done,u=0;u=0;--h){var d=p(h);if(d)return d.v}}}}function di(e,t){if(0!=t&&(e.first+=t,e.sel=new wo(te(e.sel.ranges,function(e){return new xo(ot(e.anchor.line+t,e.anchor.ch),ot(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){hn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.linei&&(t={from:t.from,to:ot(i,Xe(e,i).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ke(e,t.from,t.to),r||(r=Mo(e,t)),e.cm?function(e,t,r){var n=e.doc,o=e.display,i=t.from,a=t.to,s=!1,c=i.line;e.options.lineWrapping||(c=et(Bt(Xe(n,i.line))),n.iter(c,a.line+1,function(e){if(e==o.maxLine)return s=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Le(e),No(n,t,r,un(e)),e.options.lineWrapping||(n.iter(c,i.line+t.text.length,function(e){var t=$t(e);t>o.maxLineLength&&(o.maxLine=e,o.maxLineLength=t,o.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;n--){var o=Xe(e,n).stateAfter;if(o&&(!(o instanceof ht)||n+o.lookAhead1||!(this.children[0]instanceof bi))){var s=[];this.collapse(s),this.children=[new bi(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=o.lines.length%25+25,s=a;s10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n0||0==a&&!1!==i.clearWhenEmpty)return i;if(i.replacedWith&&(i.collapsed=!0,i.widgetNode=k("span",[i.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||i.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(i.widgetNode.insertLeft=!0)),i.collapsed){if(Rt(e,t.line,t,r,i)||t.line!=r.line&&Rt(e,r.line,t,r,i))throw new Error("Inserting collapsed marker partially overlapping an existing one");Et=!0}i.addToHistory&&Bo(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,c=t.line,u=e.cm;if(e.iter(c,r.line+1,function(n){u&&i.collapsed&&!u.options.lineWrapping&&Bt(n)==u.display.maxLine&&(s=!0),i.collapsed&&c!=t.line&&Ye(n,0),function(e,t,r){var n=r&&window.WeakSet&&(r.markedSpans||(r.markedSpans=new WeakSet));n&&e.markedSpans&&n.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],n&&n.add(e.markedSpans)),t.marker.attachLine(e)}(n,new Ct(i,c==t.line?t.ch:null,c==r.line?r.ch:null),e.cm&&e.cm.curOp),++c}),i.collapsed&&e.iter(t.line,r.line+1,function(t){Ut(e,t)&&Ye(t,0)}),i.clearOnEnter&&Qe(i,"beforeCursorEnter",function(){return i.clear()}),i.readOnly&&(xt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),i.collapsed&&(i.id=++xi,i.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),i.collapsed)hn(u,t.line,r.line+1);else if(i.className||i.startStyle||i.endStyle||i.css||i.attributes||i.title)for(var l=t.line;l<=r.line;l++)dn(u,l,"text");i.atomic&&oi(u.doc),fr(u,"markerAdded",u,i)}return i}Ei.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&$n(e),_e(this,"clear")){var r=this.find();r&&fr(this,"clear",r.from,r.to)}for(var n=null,o=null,i=0;ie.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=l,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&hn(e,n,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&oi(e.doc)),e&&fr(e,"markerCleared",e,this,n,o),t&&Zn(e),this.parent&&this.parent.clear()}},Ei.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var o=0;o=0;c--)fi(this,n[c]);s?ei(this,s):this.cm&&Dn(this.cm)}),undo:no(function(){hi(this,"undo")}),redo:no(function(){hi(this,"redo")}),undoSelection:no(function(){hi(this,"undo",!0)}),redoSelection:no(function(){hi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,r){e=ft(this,e),t=ft(this,t);var n=[],o=e.line;return this.iter(e.line,t.line+1,function(i){var a=i.markedSpans;if(a)for(var s=0;s=c.to||null==c.from&&o!=e.line||null!=c.from&&o==t.line&&c.from>=t.ch||r&&!r(c.marker)||n.push(c.marker.parent||c.marker)}++o}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=i,++r}),ft(this,ot(r,t))},indexFromPos:function(e){var t=(e=ft(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var f=e.dataTransfer.getData("Text");if(f){var p;if(t.state.draggingText&&!t.state.draggingText.copy&&(p=t.listSelections()),ri(t.doc,Co(r,r)),p)for(var h=0;h=0;t--)mi(e.doc,"",n[t].from,n[t].to,"+delete");Dn(e)})}function Yi(e,t,r){var n=le(e.text,t+r,r);return n<0||n>e.text.length?null:n}function ea(e,t,r){var n=Yi(e,t.ch,r);return null==n?null:new ot(t.line,n,r<0?"after":"before")}function ta(e,t,r,n,o){if(e){"rtl"==t.doc.direction&&(o=-o);var i=Te(r,t.doc.direction);if(i){var a,s=o<0?ee(i):i[0],c=o<0==(1==s.level),u=c?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var l=Nr(t,r);a=o<0?r.text.length-1:0;var f=Pr(t,l,a).top;a=fe(function(e){return Pr(t,l,e).top==f},o<0==(1==s.level)?s.from:s.to-1,a),"before"==u&&(a=Yi(r,a,1))}else a=o<0?s.to:s.from;return new ot(n,a,u)}}return new ot(n,o<0?r.text.length:0,o<0?"before":"after")}qi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},qi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},qi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},qi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},qi.default=v?qi.macDefault:qi.pcDefault;var ra={selectAll:ui,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),$)},killLine:function(e){return Ji(e,function(t){if(t.empty()){var r=Xe(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)o=new ot(o.line,o.ch+1),e.replaceRange(i.charAt(o.ch-1)+i.charAt(o.ch-2),ot(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var a=Xe(e.doc,o.line-1).text;a&&(o=new ot(o.line,1),e.replaceRange(i.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),ot(o.line-1,a.length-1),o,"+transpose"))}r.push(new xo(o,o))}e.setSelections(r)})},newlineAndIndent:function(e){return eo(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n-1&&(it((o=u.ranges[o]).from(),t)<0||t.xRel>0)&&(it(o.to(),t)>0||t.xRel<0)?function(e,t,r,n){var o=e.display,i=!1,u=to(e,function(t){c&&(o.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:xn(e)),ve(o.wrapper.ownerDocument,"mouseup",u),ve(o.wrapper.ownerDocument,"mousemove",l),ve(o.scroller,"dragstart",f),ve(o.scroller,"drop",u),i||(xe(t),n.addNew||Xo(e.doc,r,null,null,n.extend),c&&!h||a&&9==s?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),l=function(e){i=i||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return i=!0};c&&(o.scroller.draggable=!0),e.state.draggingText=u,u.copy=!n.moveOnDrag,Qe(o.wrapper.ownerDocument,"mouseup",u),Qe(o.wrapper.ownerDocument,"mousemove",l),Qe(o.scroller,"dragstart",f),Qe(o.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()}(e,n,t,i):function(e,t,r,n){a&&xn(e);var o=e.display,i=e.doc;xe(t);var s,c,u=i.sel,l=u.ranges;if(n.addNew&&!n.extend?(c=i.sel.contains(r),s=c>-1?l[c]:new xo(r,r)):(s=i.sel.primary(),c=i.sel.primIndex),"rectangle"==n.unit)n.addNew||(s=new xo(r,r)),r=fn(e,t,!0,!0),c=-1;else{var f=ya(e,r,n.unit);s=n.extend?Zo(s,f.anchor,f.head,n.extend):f}n.addNew?-1==c?(c=l.length,ti(i,Eo(e,l.concat([s]),c),{scroll:!1,origin:"*mouse"})):l.length>1&&l[c].empty()&&"char"==n.unit&&!n.extend?(ti(i,Eo(e,l.slice(0,c).concat(l.slice(c+1)),0),{scroll:!1,origin:"*mouse"}),u=i.sel):Jo(i,c,s,Z):(c=0,ti(i,new wo([s],0),Z),u=i.sel);var p=r;function h(t){if(0!=it(p,t))if(p=t,"rectangle"==n.unit){for(var o=[],a=e.options.tabSize,l=z(Xe(i,r.line).text,r.ch,a),f=z(Xe(i,t.line).text,t.ch,a),h=Math.min(l,f),d=Math.max(l,f),T=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));T<=m;T++){var Q=Xe(i,T).text,y=K(Q,h,a);h==d?o.push(new xo(ot(T,y),ot(T,y))):Q.length>y&&o.push(new xo(ot(T,y),ot(T,K(Q,d,a))))}o.length||o.push(new xo(r,r)),ti(i,Eo(e,u.ranges.slice(0,c).concat(o),c),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var v,g=s,b=ya(e,t,n.unit),L=g.anchor;it(b.anchor,L)>0?(v=b.head,L=ut(g.from(),b.anchor)):(v=b.anchor,L=ct(g.to(),b.head));var _=u.ranges.slice(0);_[c]=function(e,t){var r=t.anchor,n=t.head,o=Xe(e.doc,r.line);if(0==it(r,n)&&r.sticky==n.sticky)return t;var i=Te(o);if(!i)return t;var a=he(i,r.ch,r.sticky),s=i[a];if(s.from!=r.ch&&s.to!=r.ch)return t;var c,u=a+(s.from==r.ch==(1!=s.level)?0:1);if(0==u||u==i.length)return t;if(n.line!=r.line)c=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var l=he(i,n.ch,n.sticky),f=l-a||(n.ch-r.ch)*(1==s.level?-1:1);c=l==u-1||l==u?f<0:f>0}var p=i[u+(c?-1:0)],h=c==(1==p.level),d=h?p.from:p.to,T=h?"after":"before";return r.ch==d&&r.sticky==T?t:new xo(new ot(r.line,d,T),n)}(e,new xo(ft(i,L),v)),ti(i,Eo(e,_,c),Z)}}var d=o.wrapper.getBoundingClientRect(),T=0;function m(t){e.state.selectingText=!1,T=1/0,t&&(xe(t),o.input.focus()),ve(o.wrapper.ownerDocument,"mousemove",Q),ve(o.wrapper.ownerDocument,"mouseup",y),i.history.lastSelOrigin=null}var Q=to(e,function(t){0!==t.buttons&&Me(t)?function t(r){var a=++T,s=fn(e,r,!0,"rectangle"==n.unit);if(s)if(0!=it(s,p)){e.curOp.focus=D(V(e)),h(s);var c=Mn(o,i);(s.line>=c.to||s.lined.bottom?20:0;u&&setTimeout(to(e,function(){T==a&&(o.scroller.scrollTop+=u,t(r))}),50)}}(t):m(t)}),y=to(e,m);e.state.selectingText=y,Qe(o.wrapper.ownerDocument,"mousemove",Q),Qe(o.wrapper.ownerDocument,"mouseup",y)}(e,n,t,i)}(t,n,i,e):Oe(e)==r.scroller&&xe(e):2==o?(n&&Xo(t.doc,n),setTimeout(function(){return r.input.focus()},20)):3==o&&(w?t.display.input.onContextMenu(e):xn(t)))}}function ya(e,t,r){if("char"==r)return new xo(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new xo(ot(t.line,0),ft(e.doc,ot(t.line+1,0)));var n=r(e,t);return new xo(n.from,n.to)}function va(e,t,r,n){var o,i;if(t.touches)o=t.touches[0].clientX,i=t.touches[0].clientY;else try{o=t.clientX,i=t.clientY}catch(p){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&xe(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(i>s.bottom||!_e(e,r))return Ce(t);i-=s.top-a.viewOffset;for(var c=0;c=o){var l=tt(e.doc,i),f=e.display.gutterSpecs[c];return ge(e,r,e,l,f.className,t),Ce(t)}}}function ga(e,t){return va(e,t,"gutterClick",!0)}function ba(e,t){xr(e.display,t)||function(e,t){return!!_e(e,"gutterContextMenu")&&va(e,t,"gutterContextMenu",!1)}(e,t)||be(e,t,"contextmenu")||w||e.display.input.onContextMenu(t)}function La(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),zr(e)}ma.prototype.compare=function(e,t,r){return this.time+400>e&&0==it(t,this.pos)&&r==this.button};var _a={toString:function(){return"CodeMirror.Init"}},wa={},xa={};function Ea(e,t,r){var n=r&&r!=_a;if(!t!=!n){var o=e.display.dragFunctions,i=t?Qe:ve;i(e.display.scroller,"dragstart",o.start),i(e.display.scroller,"dragenter",o.enter),i(e.display.scroller,"dragover",o.over),i(e.display.scroller,"dragleave",o.leave),i(e.display.scroller,"drop",o.drop)}}function Ca(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),Zt(e)),ln(e),hn(e),zr(e),setTimeout(function(){return zn(e)},100)}function Sa(e,t){var r=this;if(!(this instanceof Sa))return new Sa(e,t);this.options=t=t?B(t):{},B(wa,t,!1);var n=t.value;"string"==typeof n?n=new Ai(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var o=new Sa.inputStyles[t.inputStyle](this),i=this.display=new yo(e,n,o,t);for(var u in i.wrapper.CodeMirror=this,La(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new q,keySeq:null,specialChars:null},t.autofocus&&!y&&i.input.focus(),a&&s<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(e){var t=e.display;Qe(t.scroller,"mousedown",to(e,Qa)),Qe(t.scroller,"dblclick",a&&s<11?to(e,function(t){if(!be(e,t)){var r=fn(e,t);if(r&&!ga(e,t)&&!xr(e.display,t)){xe(t);var n=e.findWordAt(r);Xo(e.doc,n.anchor,n.head)}}}):function(t){return be(e,t)||xe(t)}),Qe(t.scroller,"contextmenu",function(t){return ba(e,t)}),Qe(t.input.getField(),"contextmenu",function(r){t.scroller.contains(r.target)||ba(e,r)});var r,n={end:0};function o(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),(n=t.activeTouch).end=+new Date)}function i(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}Qe(t.scroller,"touchstart",function(o){if(!be(e,o)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(o)&&!ga(e,o)){t.input.ensurePolled(),clearTimeout(r);var i=+new Date;t.activeTouch={start:i,moved:!1,prev:i-n.end<=300?n:null},1==o.touches.length&&(t.activeTouch.left=o.touches[0].pageX,t.activeTouch.top=o.touches[0].pageY)}}),Qe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Qe(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!xr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var a,s=e.coordsChar(t.activeTouch,"page");a=!n.prev||i(n,n.prev)?new xo(s,s):!n.prev.prev||i(n,n.prev.prev)?e.findWordAt(s):new xo(ot(s.line,0),ft(e.doc,ot(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),xe(r)}o()}),Qe(t.scroller,"touchcancel",o),Qe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(jn(e,t.scroller.scrollTop),Fn(e,t.scroller.scrollLeft,!0),ge(e,"scroll",e))}),Qe(t.scroller,"mousewheel",function(t){return _o(e,t)}),Qe(t.scroller,"DOMMouseScroll",function(t){return _o(e,t)}),Qe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){be(e,t)||Se(t)},over:function(t){be(e,t)||(function(e,t){var r=fn(e,t);if(r){var n=document.createDocumentFragment();gn(e,r,n),e.display.dragCursor||(e.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),O(e.display.dragCursor,n)}}(e,t),Se(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Di<100))Se(t);else if(!be(e,t)&&!xr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var r=M("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}(e,t)},drop:to(e,Hi),leave:function(t){be(e,t)||Ni(e)}};var c=t.input.getField();Qe(c,"keyup",function(t){return pa.call(e,t)}),Qe(c,"keydown",to(e,fa)),Qe(c,"keypress",to(e,ha)),Qe(c,"focus",function(t){return En(e,t)}),Qe(c,"blur",function(t){return Cn(e,t)})}(this),Vi(),$n(this),this.curOp.forceUpdate=!0,jo(this,n),t.autofocus&&!y||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&En(r)},20):Cn(this),xa)xa.hasOwnProperty(u)&&xa[u](this,t[u],_a);ho(this),t.finishInit&&t.finishInit(this);for(var l=0;l150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>i.first?z(Xe(i,t-1).text,null,a):0:"add"==r?u=c+e.options.indentUnit:"subtract"==r?u=c-e.options.indentUnit:"number"==typeof r&&(u=c+r),u=Math.max(0,u);var f="",p=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)p+=a,f+="\t";if(pa,c=Pe(t),u=null;if(s&&n.ranges.length>1)if(ka&&ka.text.join("\n")==t){if(n.ranges.length%ka.text.length==0){u=[];for(var l=0;l=0;p--){var h=n.ranges[p],d=h.from(),T=h.to();h.empty()&&(r&&r>0?d=ot(d.line,d.ch-r):e.state.overwrite&&!s?T=ot(T.line,Math.min(Xe(i,T.line).text.length,T.ch+ee(c).length)):s&&ka&&ka.lineWise&&ka.text.join("\n")==c.join("\n")&&(d=T=ot(d.line,0)));var m={from:d,to:T,text:u?u[p%u.length]:c,origin:o||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};fi(e.doc,m),fr(e,"inputRead",e,m)}t&&!s&&Na(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ha(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||!t.hasFocus()||eo(t,function(){return Da(t,r,0,null,"paste")}),!0}function Na(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var o=r.ranges[n];if(!(o.head.ch>100||n&&r.ranges[n-1].head.line==o.head.line)){var i=e.getModeAt(o.head),a=!1;if(i.electricChars){for(var s=0;s-1){a=Ma(e,o.head.line,"smart");break}}else i.electricInput&&i.electricInput.test(Xe(e.doc,o.head.line).text.slice(0,o.head.ch))&&(a=Ma(e,o.head.line,"smart"));a&&fr(e,"electricInput",e,o.head.line)}}}function Pa(e){for(var t=[],r=[],n=0;n0?0:-1));if(isNaN(u))a=null;else{var l=r>0?u>=55296&&u<56320:u>=56320&&u<57343;a=new ot(t.line,Math.max(0,Math.min(s.text.length,t.ch+r*(l?2:1))),-r)}}else a=o?function(e,t,r,n){var o=Te(t,e.doc.direction);if(!o)return ea(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var i=he(o,r.ch,r.sticky),a=o[i];if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from=a.from&&p>=l.begin)){var h=f?"before":"after";return new ot(r.line,p,h)}}var d=function(e,t,n){for(var i=function(e,t){return t?new ot(r.line,c(e,1),"before"):new ot(r.line,e,"after")};e>=0&&e0==(1!=a.level),u=s?n.begin:c(n.end,-1);if(a.from<=u&&u0?l.end:c(l.begin,-1);return null==m||n>0&&m==t.text.length||!(T=d(n>0?0:o.length-1,n,u(m)))?null:T}(e.cm,s,t,r):ea(s,t,r);if(null==a){if(i||!function(){var r=t.line+c;return!(r=e.first+e.size)&&(t=new ot(r,t.ch,t.sticky),s=Xe(e,r))}())return!1;t=ta(o,e.cm,s,t.line,c)}else t=a;return!0}if("char"==n||"codepoint"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var l=null,f="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||u(!h);h=!1){var d=s.text.charAt(t.ch)||"\n",T=ae(d,p)?"w":f&&"\n"==d?"n":!f||/\s/.test(d)?null:"p";if(!f||h||T||(T="s"),l&&l!=T){r<0&&(r=1,u(),t.sticky="after");break}if(T&&(l=T),r>0&&!u(!h))break}var m=si(e,t,i,a,!0);return at(i,m)&&(m.hitSide=!0),m}function Ia(e,t,r,n){var o,i,a=e.doc,s=t.left;if("page"==n){var c=Math.min(e.display.wrapper.clientHeight,I(e).innerHeight||a(e).documentElement.clientHeight),u=Math.max(c-.5*on(e.display),3);o=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(o=r>0?t.bottom+3:t.top-3);for(;(i=Yr(e,s,o)).outside;){if(r<0?o<=0:o>=a.height){i.hitSide=!0;break}o+=5*r}return i}var Ra=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ba(e,t){var r=Hr(e,t.line);if(!r||r.hidden)return null;var n=Xe(e.doc,t.line),o=Ar(r,n,t.line),i=Te(n,e.doc.direction),a="left";if(i){var s=he(i,t.ch);a=s%2?"right":"left"}var c=Fr(o.map,t.ch,a);return c.offset="right"==c.collapse?c.end:c.start,c}function za(e,t){return t&&(e.bad=!0),e}function qa(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return za(e.clipPos(ot(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var o=0;o=t.display.viewTo||i.line=t.display.viewFrom&&Ba(t,o)||{node:c[0].measure.map[2],offset:0},l=i.linen.firstLine()&&(a=ot(a.line-1,Xe(n.doc,a.line-1).length)),s.ch==Xe(n.doc,s.line).text.length&&s.lineo.viewTo-1)return!1;a.line==o.viewFrom||0==(e=pn(n,a.line))?(t=et(o.view[0].line),r=o.view[0].node):(t=et(o.view[e].line),r=o.view[e-1].node.nextSibling);var c,u,l=pn(n,s.line);if(l==o.view.length-1?(c=o.viewTo-1,u=o.lineDiv.lastChild):(c=et(o.view[l+1].line)-1,u=o.view[l+1].node.previousSibling),!r)return!1;for(var f=n.doc.splitLines(function(e,t,r,n,o){var i="",a=!1,s=e.doc.lineSeparator(),c=!1;function u(){a&&(i+=s,c&&(i+=s),a=c=!1)}function l(e){e&&(u(),i+=e)}function f(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void l(r);var i,p=t.getAttribute("cm-marker");if(p){var h=e.findMarks(ot(n,0),ot(o+1,0),(m=+p,function(e){return e.id==m}));return void(h.length&&(i=h[0].find(0))&&l(Ke(e.doc,i.from,i.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;d&&u();for(var T=0;T1&&p.length>1;)if(ee(f)==ee(p))f.pop(),p.pop(),c--;else{if(f[0]!=p[0])break;f.shift(),p.shift(),t++}for(var h=0,d=0,T=f[0],m=p[0],Q=Math.min(T.length,m.length);ha.ch&&y.charCodeAt(y.length-d-1)==v.charCodeAt(v.length-d-1);)h--,d++;f[f.length-1]=y.slice(0,y.length-d).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"");var b=ot(t,h),L=ot(c,p.length?ee(p).length-d:0);return f.length>1||f[0]||it(b,L)?(mi(n.doc,f,b,L,"+input"),!0):void 0},Ra.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ra.prototype.reset=function(){this.forceCompositionEnd()},Ra.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ra.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Ra.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||eo(this.cm,function(){return hn(e.cm)})},Ra.prototype.setUneditable=function(e){e.contentEditable="false"},Ra.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||to(this.cm,Da)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ra.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ra.prototype.onContextMenu=function(){},Ra.prototype.resetPosition=function(){},Ra.prototype.needsContentAttribute=!0;var Ga=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null,this.resetting=!1};Ga.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var o=this.textarea;function i(e){if(!be(n,e)){if(n.somethingSelected())Aa({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Pa(n);Aa({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,$):(r.prevInput="",o.value=t.text.join("\n"),P(o))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(o.style.width="0px"),Qe(o,"input",function(){a&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Qe(o,"paste",function(e){be(n,e)||Ha(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())}),Qe(o,"cut",i),Qe(o,"copy",i),Qe(e.scroller,"paste",function(t){if(!xr(e,t)&&!be(n,t)){if(!o.dispatchEvent)return n.state.pasteIncoming=+new Date,void r.focus();var i=new Event("paste");i.clipboardData=t.clipboardData,o.dispatchEvent(i)}}),Qe(e.lineSpace,"selectstart",function(t){xr(e,t)||xe(t)}),Qe(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Qe(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ga.prototype.createField=function(e){this.wrapper=Va(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;ja(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Ga.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ga.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=vn(e);if(e.options.moveInputWithCursor){var o=Xr(e,r.sel.primary().head,"div"),i=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+a.top-i.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+a.left-i.left))}return n},Ga.prototype.showSelection=function(e){var t=this.cm,r=t.display;O(r.cursorDiv,e.cursors),O(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ga.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&P(this.textarea),a&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null));this.resetting=!1}},Ga.prototype.getField=function(){return this.textarea},Ga.prototype.supportsTouch=function(){return!1},Ga.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!y||D(F(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},Ga.prototype.blur=function(){this.textarea.blur()},Ga.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ga.prototype.receivedFocus=function(){this.slowPoll()},Ga.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ga.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function r(){var n=t.poll();n||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))})},Ga.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||je(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=r.value;if(o==n&&!t.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===o||v&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var i=o.charCodeAt(0);if(8203!=i||n||(n="\u200b"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var c=0,u=Math.min(n.length,o.length);c1e3||o.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ga.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ga.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},Ga.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var i=fn(r,e),u=n.scroller.scrollTop;if(i&&!p){var l=r.options.resetSelectionOnContextMenu;l&&-1==r.doc.sel.contains(i)&&to(r,ti)(r.doc,Co(i),$);var f,h=o.style.cssText,d=t.wrapper.style.cssText,T=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-T.top-5)+"px; left: "+(e.clientX-T.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",c&&(f=o.ownerDocument.defaultView.scrollY),n.input.focus(),c&&o.ownerDocument.defaultView.scrollTo(null,f),n.input.reset(),r.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=Q,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),a&&s>=9&&m(),w?(Se(e),Qe(window,"mouseup",function e(){ve(window,"mouseup",e),setTimeout(Q,20)})):setTimeout(Q,50)}function m(){if(null!=o.selectionStart){var e=r.somethingSelected(),i="\u200b"+(e?o.value:"");o.value="\u21da",o.value=i,t.prevInput=e?"":"\u200b",o.selectionStart=1,o.selectionEnd=i.length,n.selForContextMenu=r.doc.sel}}function Q(){if(t.contextMenuPending==Q&&(t.contextMenuPending=!1,t.wrapper.style.cssText=d,o.style.cssText=h,a&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=o.selectionStart)){(!a||a&&s<9)&&m();var e=0;n.detectingSelectAll=setTimeout(function i(){n.selForContextMenu==r.doc.sel&&0==o.selectionStart&&o.selectionEnd>0&&"\u200b"==t.prevInput?to(r,ui)(r):e++<10?n.detectingSelectAll=setTimeout(i,500):(n.selForContextMenu=null,n.input.reset())},200)}}},Ga.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},Ga.prototype.setUneditable=function(){},Ga.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,o,i){e.defaults[r]=n,o&&(t[r]=i?function(e,t,r){r!=_a&&o(e,t,r)}:o)}e.defineOption=r,e.Init=_a,r("value","",function(e,t){return e.setValue(t)},!0),r("mode",null,function(e,t){e.doc.modeOption=t,Ao(e)},!0),r("indentUnit",2,Ao,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(e){Do(e),zr(e),hn(e)},!0),r("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var o=0;;){var i=e.text.indexOf(t,o);if(-1==i)break;o=i+t.length,r.push(ot(n,i))}n++});for(var o=r.length-1;o>=0;o--)mi(e.doc,t,r[o],ot(r[o].line,r[o].ch+t.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=_a&&e.refresh()}),r("specialCharPlaceholder",rr,function(e){return e.refresh()},!0),r("electricChars",!0),r("inputStyle",y?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),r("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),r("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),r("rtlMoveVisually",!b),r("wholeLineUpdateBefore",!0),r("theme","default",function(e){La(e),Qo(e)},!0),r("keyMap","default",function(e,t,r){var n=Ki(t),o=r!=_a&&Ki(r);o&&o.detach&&o.detach(e,n),n.attach&&n.attach(e,o||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ca,!0),r("gutters",[],function(e,t){e.display.gutterSpecs=To(t,e.options.lineNumbers),Qo(e)},!0),r("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?cn(e.display)+"px":"0",e.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(e){return zn(e)},!0),r("scrollbarStyle","native",function(e){Gn(e),zn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),r("lineNumbers",!1,function(e,t){e.display.gutterSpecs=To(e.options.gutters,t),Qo(e)},!0),r("firstLineNumber",1,Qo,!0),r("lineNumberFormatter",function(e){return e},Qo,!0),r("showCursorWhenSelecting",!1,yn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(e,t){"nocursor"==t&&(Cn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),r("screenReaderLabel",null,function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)}),r("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),r("dragDrop",!0,Ea),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,yn,!0),r("singleCursorHeightPerLine",!0,yn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Do,!0),r("addModeClass",!1,Do,!0),r("pollInterval",100),r("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),r("historyEventDelay",1250),r("viewportMargin",10,function(e){return e.refresh()},!0),r("maxHighlightLength",1e4,Do,!0),r("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),r("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),r("autofocus",null),r("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),r("phrases",null)}(Sa),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){I(this).focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,o=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&to(this,t[e])(this,r,o),ge(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ki(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(Ma(this,o.head.line,e,!0),r=o.head.line,n==this.doc.sel.primIndex&&Dn(this));else{var i=o.from(),a=o.to(),s=Math.max(r,i.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var c=s;c0&&Jo(this.doc,n,new xo(i,u[n].to()),$)}}}),getTokenAt:function(e,t){return Lt(this,e,t)},getLineTokens:function(e,t){return Lt(this,ot(e),t,!0)},getTokenTypeAt:function(e){e=ft(this.doc,e);var t,r=mt(this,Xe(this.doc,e.line)),n=0,o=(r.length-1)/2,i=e.ch;if(0==i)t=r[2];else for(;;){var a=n+o>>1;if((a?r[2*a-1]:0)>=i)o=a;else{if(!(r[2*a+1]i&&(e=i,o=!0),n=Xe(this.doc,e)}else n=e;return Wr(this,n,{top:0,left:0},t||"page",r||o).top+(o?this.doc.height-Wt(n):0)},defaultTextHeight:function(){return on(this.display)},defaultCharWidth:function(){return an(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,o){var i=this.display,a=(e=Xr(this,ft(this.doc,e))).bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),i.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var c=Math.max(i.wrapper.clientHeight,this.doc.height),u=Math.max(i.sizer.clientWidth,i.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>c)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=c&&(a=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==o?(s=i.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==o?s=0:"middle"==o&&(s=(i.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&function(e,t){var r=kn(e,t);null!=r.scrollTop&&jn(e,r.scrollTop),null!=r.scrollLeft&&Fn(e,r.scrollLeft)}(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:ro(fa),triggerOnKeyPress:ro(ha),triggerOnKeyUp:pa,triggerOnMouseDown:ro(Qa),execCommand:function(e){if(ra.hasOwnProperty(e))return ra[e].call(null,this)},triggerElectric:ro(function(e){Na(this,e)}),findPosH:function(e,t,r,n){var o=1;t<0&&(o=-1,t=-t);for(var i=ft(this.doc,e),a=0;a0&&s(r.charAt(n-1));)--n;for(;o.5||this.options.lineWrapping)&&ln(this),ge(this,"refresh",this)}),swapDoc:ro(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),jo(this,e),zr(this),this.display.input.reset(),Hn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,fr(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},we(e),e.registerHelper=function(t,n,o){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=o},e.registerGlobalHelper=function(t,n,o,i){e.registerHelper(t,n,i),r[t]._global.push({pred:o,val:i})}}(Sa);var Wa="iter insert remove copy getEditor constructor".split(" ");for(var $a in Ai.prototype)Ai.prototype.hasOwnProperty($a)&&U(Wa,$a)<0&&(Sa.prototype[$a]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ai.prototype[$a]));return we(Ai),Sa.inputStyles={textarea:Ga,contenteditable:Ra},Sa.defineMode=function(e){Sa.defaults.mode||"null"==e||(Sa.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ie[e]=t}.apply(this,arguments)},Sa.defineMIME=function(e,t){Re[e]=t},Sa.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Sa.defineMIME("text/plain","null"),Sa.defineExtension=function(e,t){Sa.prototype[e]=t},Sa.defineDocExtension=function(e,t){Ai.prototype[e]=t},Sa.fromTextArea=function(e,t){if((t=t?B(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=D(F(e));t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var o;if(e.form&&(Qe(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var i=e.form;o=i.submit;try{var a=i.submit=function(){n(),i.submit=o,i.submit(),i.submit=a}}catch(c){}}t.finishInit=function(r){r.save=n,r.getTextArea=function(){return e},r.toTextArea=function(){r.toTextArea=isNaN,n(),e.parentNode.removeChild(r.getWrapperElement()),e.style.display="",e.form&&(ve(e.form,"submit",n),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=o))}},e.style.display="none";var s=Sa(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s},function(e){e.off=ve,e.on=Qe,e.wheelEventPixels=Lo,e.Doc=Ai,e.splitLines=Pe,e.countColumn=z,e.findColumn=K,e.isWordChar=ie,e.Pass=W,e.signal=ge,e.Line=Xt,e.changeEnd=So,e.scrollbarModel=Un,e.Pos=ot,e.cmpPos=it,e.modes=Ie,e.mimeModes=Re,e.resolveMode=Be,e.getMode=ze,e.modeExtensions=qe,e.extendMode=Ue,e.copyState=Ge,e.startState=$e,e.innerMode=We,e.commands=ra,e.keyMap=qi,e.keyName=Xi,e.isModifierKey=$i,e.lookupKey=Wi,e.normalizeKeyMap=Gi,e.StringStream=Ze,e.SharedTextMarker=Si,e.TextMarker=Ei,e.LineWidget=_i,e.e_preventDefault=xe,e.e_stopPropagation=Ee,e.e_stop=Se,e.addClass=H,e.contains=A,e.rmClass=C,e.keyNames=Ii}(Sa),Sa.version="5.65.16",Sa}()},function(e,t,r){"use strict";var n=r(188),o=r(460),i=Object.prototype.toString;function a(e){return"[object Array]"===i.call(e)}function s(e){return null!==e&&"object"===typeof e}function c(e){return"[object Function]"===i.call(e)}function u(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r=0)){var o=e.props.insertExtraNode;e.extraNode=document.createElement("div");var i=v(e).extraNode;i.className="ant-click-animating-node";var a=e.getAttributeName();t.setAttribute(a,"true"),n=n||document.createElement("style"),r&&"#ffffff"!==r&&"rgb(255, 255, 255)"!==r&&function(e){var t=(e||"").match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/);return!(t&&t[1]&&t[2]&&t[3])||!(t[1]===t[2]&&t[2]===t[3])}(r)&&!/rgba\(\d*, \d*, \d*, 0\)/.test(r)&&"transparent"!==r&&(e.csp&&e.csp.nonce&&(n.nonce=e.csp.nonce),i.style.borderColor=r,n.innerHTML="\n [ant-click-animating-without-extra-node='true']::after, .ant-click-animating-node {\n --antd-wave-shadow-color: ".concat(r,";\n }"),document.body.contains(n)||document.body.appendChild(n)),o&&t.appendChild(i),h.a.addStartEventListener(t,e.onTransitionStart),h.a.addEndEventListener(t,e.onTransitionEnd)}},e.onTransitionStart=function(t){if(!e.destroy){var r=Object(p.findDOMNode)(v(e));t&&t.target===r&&(e.animationStart||e.resetEffect(r))}},e.onTransitionEnd=function(t){t&&"fadeEffect"===t.animationName&&e.resetEffect(t.target)},e.bindAnimationEvent=function(t){if(t&&t.getAttribute&&!t.getAttribute("disabled")&&!(t.className.indexOf("disabled")>=0)){var r=function(r){if("INPUT"!==r.target.tagName&&!b(r.target)){e.resetEffect(t);var n=getComputedStyle(t).getPropertyValue("border-top-color")||getComputedStyle(t).getPropertyValue("border-color")||getComputedStyle(t).getPropertyValue("background-color");e.clickWaveTimeoutId=window.setTimeout(function(){return e.onClick(t,n)},0),d.a.cancel(e.animationStartId),e.animationStart=!0,e.animationStartId=Object(d.a)(function(){e.animationStart=!1},10)}};return t.addEventListener("click",r,!0),{cancel:function(){t.removeEventListener("click",r,!0)}}}},e.renderWave=function(t){var r=t.csp,n=e.props.children;return e.csp=r,n},e}return t=s,(r=[{key:"componentDidMount",value:function(){var e=Object(p.findDOMNode)(this);e&&1===e.nodeType&&(this.instance=this.bindAnimationEvent(e))}},{key:"componentWillUnmount",value:function(){this.instance&&this.instance.cancel(),this.clickWaveTimeoutId&&clearTimeout(this.clickWaveTimeoutId),this.destroy=!0}},{key:"getAttributeName",value:function(){return this.props.insertExtraNode?"ant-click-animating":"ant-click-animating-without-extra-node"}},{key:"resetEffect",value:function(e){if(e&&e!==this.extraNode&&e instanceof Element){var t=this.props.insertExtraNode,r=this.getAttributeName();e.setAttribute(r,"false"),n&&(n.innerHTML=""),t&&this.extraNode&&e.contains(this.extraNode)&&e.removeChild(this.extraNode),h.a.removeStartEventListener(e,this.onTransitionStart),h.a.removeEndEventListener(e,this.onTransitionEnd)}}},{key:"render",value:function(){return o.createElement(f.a,null,this.renderWave)}}])&&m(t.prototype,r),i&&m(t,i),s}(),_=r(23);function w(){return(w=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:1,r=i++,n=t;return a[r]=o()(function t(){(n-=1)<=0?(e(),delete a[r]):a[r]=o()(t)}),r}s.cancel=function(e){void 0!==e&&(o.a.cancel(a[e]),delete a[e])},s.ids=a},function(e,t,r){"use strict";var n=function(){};e.exports=n},function(e,t,r){e.exports=r(459)},function(e,t,r){"use strict";var n={transitionstart:{transition:"transitionstart",WebkitTransition:"webkitTransitionStart",MozTransition:"mozTransitionStart",OTransition:"oTransitionStart",msTransition:"MSTransitionStart"},animationstart:{animation:"animationstart",WebkitAnimation:"webkitAnimationStart",MozAnimation:"mozAnimationStart",OAnimation:"oAnimationStart",msAnimation:"MSAnimationStart"}},o={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},i=[],a=[];function s(e,t,r){e.addEventListener(t,r,!1)}function c(e,t,r){e.removeEventListener(t,r,!1)}"undefined"!==typeof window&&"undefined"!==typeof document&&function(){var e=document.createElement("div").style;function t(t,r){for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];for(var i in o)if(i in e){r.push(o[i]);break}}}"AnimationEvent"in window||(delete n.animationstart.animation,delete o.animationend.animation),"TransitionEvent"in window||(delete n.transitionstart.transition,delete o.transitionend.transition),t(n,i),t(o,a)}();var u={startEvents:i,addStartEventListener:function(e,t){0!==i.length?i.forEach(function(r){s(e,r,t)}):window.setTimeout(t,0)},removeStartEventListener:function(e,t){0!==i.length&&i.forEach(function(r){c(e,r,t)})},endEvents:a,addEndEventListener:function(e,t){0!==a.length?a.forEach(function(r){s(e,r,t)}):window.setTimeout(t,0)},removeEndEventListener:function(e,t){0!==a.length&&a.forEach(function(r){c(e,r,t)})}};t.a=u},function(e,t){var r=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=r)},function(e,t,r){var n=r(173),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},function(e,t,r){var n=r(123)("wks"),o=r(96),i=r(53).Symbol,a="function"==typeof i;(e.exports=function(e){return n[e]||(n[e]=a&&i[e]||(a?i:o)("Symbol."+e))}).store=n},,function(e,t,r){var n=r(324)();e.exports=n;try{regeneratorRuntime=n}catch(o){"object"===typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=t.connect=t.Provider=void 0;var n=a(r(452)),o=a(r(453)),i=a(r(455));function a(e){return e&&e.__esModule?e:{default:e}}t.Provider=n.default,t.connect=o.default,t.create=i.default},function(e,t,r){"use strict";var n=r(3),o=r.n(n),i=r(8),a=r.n(i),s=r(6),c=r.n(s),u=r(10),l=r.n(u),f=r(0),p=r.n(f),h=r(1),d=r.n(h),T=r(7),m=r.n(T),Q=r(16),y=r(63),v=r(50),g=r(113),b=r(114),L=r(12),_=r.n(L);function w(e,t,r){return r?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}function x(e,t){this[e]=t}var E=r(161),C=r(31),S=r(24),O=r.n(S),M=function(e){function t(){return a()(this,t),c()(this,e.apply(this,arguments))}return l()(t,e),t.prototype.shouldComponentUpdate=function(e){return e.hiddenClassName||e.visible},t.prototype.render=function(){var e=this.props,t=e.hiddenClassName,r=e.visible,n=O()(e,["hiddenClassName","visible"]);return t||p.a.Children.count(n.children)>1?(!r&&t&&(n.className+=" "+t),p.a.createElement("div",n)):p.a.Children.only(n.children)},t}(f.Component);M.propTypes={children:d.a.any,className:d.a.string,visible:d.a.bool,hiddenClassName:d.a.string};var k=M,A=function(e){function t(){return a()(this,t),c()(this,e.apply(this,arguments))}return l()(t,e),t.prototype.render=function(){var e=this.props,t=e.className;return e.visible||(t+=" "+e.hiddenClassName),p.a.createElement("div",{className:t,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onMouseDown:e.onMouseDown,onTouchStart:e.onTouchStart,style:e.style},p.a.createElement(k,{className:e.prefixCls+"-content",visible:e.visible},e.children))},t}(f.Component);A.propTypes={hiddenClassName:d.a.string,className:d.a.string,prefixCls:d.a.string,onMouseEnter:d.a.func,onMouseLeave:d.a.func,onMouseDown:d.a.func,onTouchStart:d.a.func,children:d.a.any};var D=A,H=function(e){function t(r){a()(this,t);var n=c()(this,e.call(this,r));return N.call(n),n.state={stretchChecked:!1,targetWidth:void 0,targetHeight:void 0},n.savePopupRef=x.bind(n,"popupInstance"),n.saveAlignRef=x.bind(n,"alignInstance"),n}return l()(t,e),t.prototype.componentDidMount=function(){this.rootNode=this.getPopupDomNode(),this.setStretchSize()},t.prototype.componentDidUpdate=function(){this.setStretchSize()},t.prototype.getPopupDomNode=function(){return m.a.findDOMNode(this.popupInstance)},t.prototype.getMaskTransitionName=function(){var e=this.props,t=e.maskTransitionName,r=e.maskAnimation;return!t&&r&&(t=e.prefixCls+"-"+r),t},t.prototype.getTransitionName=function(){var e=this.props,t=e.transitionName;return!t&&e.animation&&(t=e.prefixCls+"-"+e.animation),t},t.prototype.getClassName=function(e){return this.props.prefixCls+" "+this.props.className+" "+e},t.prototype.getPopupElement=function(){var e=this,t=this.savePopupRef,r=this.state,n=r.stretchChecked,i=r.targetHeight,a=r.targetWidth,s=this.props,c=s.align,u=s.visible,l=s.prefixCls,f=s.style,h=s.getClassNameFromAlign,d=s.destroyPopupOnHide,T=s.stretch,m=s.children,Q=s.onMouseEnter,y=s.onMouseLeave,v=s.onMouseDown,g=s.onTouchStart,b=this.getClassName(this.currentAlignClassName||h(c)),L=l+"-hidden";u||(this.currentAlignClassName=null);var _={};T&&(-1!==T.indexOf("height")?_.height=i:-1!==T.indexOf("minHeight")&&(_.minHeight=i),-1!==T.indexOf("width")?_.width=a:-1!==T.indexOf("minWidth")&&(_.minWidth=a),n||(_.visibility="hidden",setTimeout(function(){e.alignInstance&&e.alignInstance.forceAlign()},0)));var w={className:b,prefixCls:l,ref:t,onMouseEnter:Q,onMouseLeave:y,onMouseDown:v,onTouchStart:g,style:o()({},_,f,this.getZIndexStyle())};return d?p.a.createElement(C.a,{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName()},u?p.a.createElement(E.a,{target:this.getAlignTarget(),key:"popup",ref:this.saveAlignRef,monitorWindowResize:!0,align:c,onAlign:this.onAlign},p.a.createElement(D,o()({visible:!0},w),m)):null):p.a.createElement(C.a,{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName(),showProp:"xVisible"},p.a.createElement(E.a,{target:this.getAlignTarget(),key:"popup",ref:this.saveAlignRef,monitorWindowResize:!0,xVisible:u,childrenProps:{visible:"xVisible"},disabled:!u,align:c,onAlign:this.onAlign},p.a.createElement(D,o()({hiddenClassName:L},w),m)))},t.prototype.getZIndexStyle=function(){var e={},t=this.props;return void 0!==t.zIndex&&(e.zIndex=t.zIndex),e},t.prototype.getMaskElement=function(){var e=this.props,t=void 0;if(e.mask){var r=this.getMaskTransitionName();t=p.a.createElement(k,{style:this.getZIndexStyle(),key:"mask",className:e.prefixCls+"-mask",hiddenClassName:e.prefixCls+"-mask-hidden",visible:e.visible}),r&&(t=p.a.createElement(C.a,{key:"mask",showProp:"visible",transitionAppear:!0,component:"",transitionName:r},t))}return t},t.prototype.render=function(){return p.a.createElement("div",null,this.getMaskElement(),this.getPopupElement())},t}(f.Component);H.propTypes={visible:d.a.bool,style:d.a.object,getClassNameFromAlign:d.a.func,onAlign:d.a.func,getRootDomNode:d.a.func,align:d.a.any,destroyPopupOnHide:d.a.bool,className:d.a.string,prefixCls:d.a.string,onMouseEnter:d.a.func,onMouseLeave:d.a.func,onMouseDown:d.a.func,onTouchStart:d.a.func,stretch:d.a.string,children:d.a.node,point:d.a.shape({pageX:d.a.number,pageY:d.a.number})};var N=function(){var e=this;this.onAlign=function(t,r){var n=e.props,o=n.getClassNameFromAlign(r);e.currentAlignClassName!==o&&(e.currentAlignClassName=o,t.className=e.getClassName(o)),n.onAlign(t,r)},this.setStretchSize=function(){var t=e.props,r=t.stretch,n=t.getRootDomNode,o=t.visible,i=e.state,a=i.stretchChecked,s=i.targetHeight,c=i.targetWidth;if(r&&o){var u=n();if(u){var l=u.offsetHeight,f=u.offsetWidth;s===l&&c===f&&a||e.setState({stretchChecked:!0,targetHeight:l,targetWidth:f})}}else a&&e.setState({stretchChecked:!1})},this.getTargetElement=function(){return e.props.getRootDomNode()},this.getAlignTarget=function(){var t=e.props.point;return t||e.getTargetElement}},P=H;function j(){}var V=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"],F=!!T.createPortal,I={rcTrigger:d.a.shape({onPopupMouseDown:d.a.func})},R=function(e){function t(r){a()(this,t);var n=c()(this,e.call(this,r));B.call(n);var o=void 0;return o="popupVisible"in r?!!r.popupVisible:!!r.defaultPopupVisible,n.state={prevPopupVisible:o,popupVisible:o},V.forEach(function(e){n["fire"+e]=function(t){n.fireEvents(e,t)}}),n}return l()(t,e),t.prototype.getChildContext=function(){return{rcTrigger:{onPopupMouseDown:this.onPopupMouseDown}}},t.prototype.componentDidMount=function(){this.componentDidUpdate({},{popupVisible:this.state.popupVisible})},t.prototype.componentDidUpdate=function(e,t){var r=this.props,n=this.state;if(F||this.renderComponent(null,function(){t.popupVisible!==n.popupVisible&&r.afterPopupVisibleChange(n.popupVisible)}),n.popupVisible){var o=void 0;return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(o=r.getDocument(),this.clickOutsideHandler=Object(v.a)(o,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(o=o||r.getDocument(),this.touchOutsideHandler=Object(v.a)(o,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(o=o||r.getDocument(),this.contextMenuOutsideHandler1=Object(v.a)(o,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(v.a)(window,"blur",this.onContextMenuClose)))}this.clearOutsideHandler()},t.prototype.componentWillUnmount=function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout)},t.getDerivedStateFromProps=function(e,t){var r=e.popupVisible,n={};return void 0!==r&&t.popupVisible!==r&&(n.popupVisible=r,n.prevPopupVisible=t.popupVisible),n},t.prototype.getPopupDomNode=function(){return this._component&&this._component.getPopupDomNode?this._component.getPopupDomNode():null},t.prototype.getPopupAlign=function(){var e=this.props,t=e.popupPlacement,r=e.popupAlign,n=e.builtinPlacements;return t&&n?function(e,t,r){var n=e[t]||{};return o()({},n,r)}(n,t,r):r},t.prototype.setPopupVisible=function(e,t){var r=this.props.alignPoint,n=this.state.popupVisible;this.clearDelayTimer(),n!==e&&("popupVisible"in this.props||this.setState({popupVisible:e,prevPopupVisible:n}),this.props.onPopupVisibleChange(e)),r&&t&&this.setPoint(t)},t.prototype.delaySetPopupVisible=function(e,t,r){var n=this,o=1e3*t;if(this.clearDelayTimer(),o){var i=r?{pageX:r.pageX,pageY:r.pageY}:null;this.delayTimer=setTimeout(function(){n.setPopupVisible(e,i),n.clearDelayTimer()},o)}else this.setPopupVisible(e,r)},t.prototype.clearDelayTimer=function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)},t.prototype.clearOutsideHandler=function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)},t.prototype.createTwoChains=function(e){var t=this.props.children.props,r=this.props;return t[e]&&r[e]?this["fire"+e]:t[e]||r[e]},t.prototype.isClickToShow=function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("click")||-1!==r.indexOf("click")},t.prototype.isContextMenuToShow=function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("contextMenu")||-1!==r.indexOf("contextMenu")},t.prototype.isClickToHide=function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("click")||-1!==r.indexOf("click")},t.prototype.isMouseEnterToShow=function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("hover")||-1!==r.indexOf("mouseEnter")},t.prototype.isMouseLeaveToHide=function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("hover")||-1!==r.indexOf("mouseLeave")},t.prototype.isFocusToShow=function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("focus")||-1!==r.indexOf("focus")},t.prototype.isBlurToHide=function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("focus")||-1!==r.indexOf("blur")},t.prototype.forcePopupAlign=function(){this.state.popupVisible&&this._component&&this._component.alignInstance&&this._component.alignInstance.forceAlign()},t.prototype.fireEvents=function(e,t){var r=this.props.children.props[e];r&&r(t);var n=this.props[e];n&&n(t)},t.prototype.close=function(){this.setPopupVisible(!1)},t.prototype.render=function(){var e=this,t=this.state.popupVisible,r=this.props,n=r.children,o=r.forceRender,i=r.alignPoint,a=r.className,s=p.a.Children.only(n),c={key:"trigger"};this.isContextMenuToShow()?c.onContextMenu=this.onContextMenu:c.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(c.onClick=this.onClick,c.onMouseDown=this.onMouseDown,c.onTouchStart=this.onTouchStart):(c.onClick=this.createTwoChains("onClick"),c.onMouseDown=this.createTwoChains("onMouseDown"),c.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(c.onMouseEnter=this.onMouseEnter,i&&(c.onMouseMove=this.onMouseMove)):c.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?c.onMouseLeave=this.onMouseLeave:c.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(c.onFocus=this.onFocus,c.onBlur=this.onBlur):(c.onFocus=this.createTwoChains("onFocus"),c.onBlur=this.createTwoChains("onBlur"));var u=_()(s&&s.props&&s.props.className,a);u&&(c.className=u);var l=p.a.cloneElement(s,c);if(!F)return p.a.createElement(g.a,{parent:this,visible:t,autoMount:!1,forceRender:o,getComponent:this.getComponent,getContainer:this.getContainer},function(t){var r=t.renderComponent;return e.renderComponent=r,l});var f=void 0;return(t||this._component||o)&&(f=p.a.createElement(b.a,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),[l,f]},t}(p.a.Component);R.propTypes={children:d.a.any,action:d.a.oneOfType([d.a.string,d.a.arrayOf(d.a.string)]),showAction:d.a.any,hideAction:d.a.any,getPopupClassNameFromAlign:d.a.any,onPopupVisibleChange:d.a.func,afterPopupVisibleChange:d.a.func,popup:d.a.oneOfType([d.a.node,d.a.func]).isRequired,popupStyle:d.a.object,prefixCls:d.a.string,popupClassName:d.a.string,className:d.a.string,popupPlacement:d.a.string,builtinPlacements:d.a.object,popupTransitionName:d.a.oneOfType([d.a.string,d.a.object]),popupAnimation:d.a.any,mouseEnterDelay:d.a.number,mouseLeaveDelay:d.a.number,zIndex:d.a.number,focusDelay:d.a.number,blurDelay:d.a.number,getPopupContainer:d.a.func,getDocument:d.a.func,forceRender:d.a.bool,destroyPopupOnHide:d.a.bool,mask:d.a.bool,maskClosable:d.a.bool,onPopupAlign:d.a.func,popupAlign:d.a.object,popupVisible:d.a.bool,defaultPopupVisible:d.a.bool,maskTransitionName:d.a.oneOfType([d.a.string,d.a.object]),maskAnimation:d.a.string,stretch:d.a.string,alignPoint:d.a.bool},R.contextTypes=I,R.childContextTypes=I,R.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:function(){return""},getDocument:function(){return window.document},onPopupVisibleChange:j,afterPopupVisibleChange:j,onPopupAlign:j,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[]};var B=function(){var e=this;this.onMouseEnter=function(t){var r=e.props.mouseEnterDelay;e.fireEvents("onMouseEnter",t),e.delaySetPopupVisible(!0,r,r?null:t)},this.onMouseMove=function(t){e.fireEvents("onMouseMove",t),e.setPoint(t)},this.onMouseLeave=function(t){e.fireEvents("onMouseLeave",t),e.delaySetPopupVisible(!1,e.props.mouseLeaveDelay)},this.onPopupMouseEnter=function(){e.clearDelayTimer()},this.onPopupMouseLeave=function(t){t.relatedTarget&&!t.relatedTarget.setTimeout&&e._component&&e._component.getPopupDomNode&&Object(y.a)(e._component.getPopupDomNode(),t.relatedTarget)||e.delaySetPopupVisible(!1,e.props.mouseLeaveDelay)},this.onFocus=function(t){e.fireEvents("onFocus",t),e.clearDelayTimer(),e.isFocusToShow()&&(e.focusTime=Date.now(),e.delaySetPopupVisible(!0,e.props.focusDelay))},this.onMouseDown=function(t){e.fireEvents("onMouseDown",t),e.preClickTime=Date.now()},this.onTouchStart=function(t){e.fireEvents("onTouchStart",t),e.preTouchTime=Date.now()},this.onBlur=function(t){e.fireEvents("onBlur",t),e.clearDelayTimer(),e.isBlurToHide()&&e.delaySetPopupVisible(!1,e.props.blurDelay)},this.onContextMenu=function(t){t.preventDefault(),e.fireEvents("onContextMenu",t),e.setPopupVisible(!0,t)},this.onContextMenuClose=function(){e.isContextMenuToShow()&&e.close()},this.onClick=function(t){if(e.fireEvents("onClick",t),e.focusTime){var r=void 0;if(e.preClickTime&&e.preTouchTime?r=Math.min(e.preClickTime,e.preTouchTime):e.preClickTime?r=e.preClickTime:e.preTouchTime&&(r=e.preTouchTime),Math.abs(r-e.focusTime)<20)return;e.focusTime=0}e.preClickTime=0,e.preTouchTime=0,e.isClickToShow()&&(e.isClickToHide()||e.isBlurToHide())&&t&&t.preventDefault&&t.preventDefault();var n=!e.state.popupVisible;(e.isClickToHide()&&!n||n&&e.isClickToShow())&&e.setPopupVisible(!e.state.popupVisible,t)},this.onPopupMouseDown=function(){var t=e.context.rcTrigger,r=void 0===t?{}:t;e.hasPopupMouseDown=!0,clearTimeout(e.mouseDownTimeout),e.mouseDownTimeout=setTimeout(function(){e.hasPopupMouseDown=!1},0),r.onPopupMouseDown&&r.onPopupMouseDown.apply(r,arguments)},this.onDocumentClick=function(t){if(!e.props.mask||e.props.maskClosable){var r=t.target,n=Object(T.findDOMNode)(e);Object(y.a)(n,r)||e.hasPopupMouseDown||e.close()}},this.getRootDomNode=function(){return Object(T.findDOMNode)(e)},this.getPopupClassNameFromAlign=function(t){var r=[],n=e.props,o=n.popupPlacement,i=n.builtinPlacements,a=n.prefixCls,s=n.alignPoint,c=n.getPopupClassNameFromAlign;return o&&i&&r.push(function(e,t,r,n){var o=r.points;for(var i in e)if(e.hasOwnProperty(i)&&w(e[i].points,o,n))return t+"-placement-"+i;return""}(i,a,t,s)),c&&r.push(c(t)),r.join(" ")},this.getComponent=function(){var t=e.props,r=t.prefixCls,n=t.destroyPopupOnHide,i=t.popupClassName,a=t.action,s=t.onPopupAlign,c=t.popupAnimation,u=t.popupTransitionName,l=t.popupStyle,f=t.mask,h=t.maskAnimation,d=t.maskTransitionName,T=t.zIndex,m=t.popup,Q=t.stretch,y=t.alignPoint,v=e.state,g=v.popupVisible,b=v.point,L=e.getPopupAlign(),_={};return e.isMouseEnterToShow()&&(_.onMouseEnter=e.onPopupMouseEnter),e.isMouseLeaveToHide()&&(_.onMouseLeave=e.onPopupMouseLeave),_.onMouseDown=e.onPopupMouseDown,_.onTouchStart=e.onPopupMouseDown,p.a.createElement(P,o()({prefixCls:r,destroyPopupOnHide:n,visible:g,point:y&&b,className:i,action:a,align:L,onAlign:s,animation:c,getClassNameFromAlign:e.getPopupClassNameFromAlign},_,{stretch:Q,getRootDomNode:e.getRootDomNode,style:l,mask:f,zIndex:T,transitionName:u,maskAnimation:h,maskTransitionName:d,ref:e.savePopup}),"function"===typeof m?m():m)},this.getContainer=function(){var t=e.props,r=document.createElement("div");return r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",(t.getPopupContainer?t.getPopupContainer(Object(T.findDOMNode)(e)):t.getDocument().body).appendChild(r),r},this.setPoint=function(t){e.props.alignPoint&&t&&e.setState({point:{pageX:t.pageX,pageY:t.pageY}})},this.handlePortalUpdate=function(){e.state.prevPopupVisible!==e.state.popupVisible&&e.props.afterPopupVisibleChange(e.state.popupVisible)},this.savePopup=function(t){e._component=t}};Object(Q.polyfill)(R);t.a=R},function(e,t,r){"use strict";r.d(t,"a",function(){return s});var n=r(263),o=r.n(n),i=r(7),a=r.n(i);function s(e,t,r,n){var i=a.a.unstable_batchedUpdates?function(e){a.a.unstable_batchedUpdates(r,e)}:r;return o()(e,t,i,n)}},function(e,t,r){"use strict";function n(e,t){for(var r=0;r1&&(t+=n.length-1)}return h(r,t)}r.d(t,"a",function(){return ie}),r.d(t,"b",function(){return ge}),r.d(t,"c",function(){return y});var d=function(){function e(e){this.node=e}var t,r,o,i=e.prototype;return i.lineIndent=function(e){var t=this.nestOLCount,r=this.nestULCount,n=this.nestCount,o=this.node,i="\n "+f(" ",n-1)+"$1";return p(o,e)&&t?i="\n "+f(" ",n)+"$1":r&&(i="\n"+f(" ",2*n)+"$1"),i},i.caclPrefix=function(e){var t=e,r=this.nestOLCount,n=this.nestULCount,o=this.parentIsOL,i=this.node,a=this.parent,s=this.isNewList,c=this.inLast,u=this.isLoose,l=this.followCode,p=this.nestListAndParentIsEmpty;if(a&&o){var d=a.getAttribute("start"),T=Array.prototype.indexOf.call(a.children,i);t=(d?Number(d)+T:T+1)+(s?") ":". ")}(l&&(u||(t=" "+t+" "),c&&u&&(t=" "+t)),n>1&&(t=f(" ",2*(n-1))+t),n&&r)&&(t=f(" ",4*n+h(i))+t);return p&&(t=t.trimStart()),t},t=e,(r=[{key:"parent",get:function(){return this.node.parentNode}},{key:"parentIsOL",get:function(){return this.parent&&"OL"===this.parent.nodeName}},{key:"nestULCount",get:function(){return l(this.node,"UL")}},{key:"nestOLCount",get:function(){return l(this.node,"OL")}},{key:"nestCount",get:function(){return this.nestULCount+this.nestOLCount}},{key:"isLoose",get:function(){var e=this.node;return e.firstChild&&"P"===e.firstChild.nodeName}},{key:"isNewList",get:function(){var e=this.parent;return e&&e.previousSibling&&e.previousSibling.nodeName===e.nodeName}},{key:"followCode",get:function(){var e=this.parent;return e&&e.nextSibling&&"PRE"===e.nextSibling.nodeName}},{key:"inLast",get:function(){var e=this.parent;return e&&e.lastChild===this.node}},{key:"nestListAndParentIsEmpty",get:function(){var e=this.nestOLCount,t=this.nestULCount,r=this.node;return e+t>1&&r.parentNode&&r.parentNode.parentNode&&r.parentNode.parentNode.innerHTML===r.parentNode.outerHTML}}])&&n(t.prototype,r),o&&n(t,o),e}();function T(e,t,r){var n=new d(t),o=n.isLoose,i=n.isNewList?"+":r.bulletListMarker;return n.caclPrefix(i+" ")+(e=e.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n(\S)/gm,n.lineIndent(r)))+(t.nextSibling&&!/\n$/.test(e)?"\n":"")+(o?"\n":"")}function m(e,t){var r=t.outerHTML;if(!e){for(var n="",o=0;o"}return t.isBlock?"\n\n"+r+"\n":r}function Q(e,t,r){if(c(r,t))return m(e,t);if(a(r,t))return u(e,t,r);if(s(t)){var n=r.codeDelimiter?r.codeDelimiter:"`";return n+("fenced"===r.codeBlockStyle?" ":"")+(e||" ")+n+"\n"}return"blockquote"===t.nodeName.toLowerCase()?">":"li"===t.nodeName.toLowerCase()?T(e,t,r):"ul"===t.nodeName.toLowerCase()?e+"\n\n":t.isBlock?e+"\n\n":""}var y={__proto__:null,escape:i,isFence:a,isCode:s,blankReplacement:Q,listReplacement:T,fenceReplacement:u,keepReplacement:m,repeat:f,findParentNumber:l,findOrderListIndentNumber:h,IndentCodeIsListfirstChild:p},v=function(e){e.addRule("list",{filter:["ul","ol"],replacement:function(e,t){var r=t.parentNode;return r&&"LI"===r.nodeName&&r.lastElementChild===t?"\n"+e:"\n\n"+e+"\n\n"}}),e.addRule("listItem",{filter:"li",replacement:T})},g=function(e){e.addRule("hr",{filter:"hr",replacement:function(e,t,r){return"\n"+r.hr+"\n"}})},b=[[/\s-/g," \\-"]];var L=function(e){e.addRule("paragraph",{filter:"p",replacement:function(e,t){var r;return"\n\n"+(Array.from(t.childNodes).some(function(e){return 8===e.nodeType})?e:(r=e,b.reduce(function(e,t){return e.replace(t[0],t[1])},r)))+"\n\n"}})},_=[[/\s#/g," \\#"]],w=function(e){e.addRule("heading",{filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,r){var n=Number(t.nodeName.charAt(1));return"setext"===r.headingStyle&&n<3?"\n\n"+e+"\n"+f(1===n?"=":"-",e.length)+"\n\n":"\n\n"+f("#",n)+" "+i(_,e)+"\n\n"}})},x=function(e){e.addRule("fencedCodeBlock",{filter:function(e,t){return a(t,e)},replacement:u})},E=function(e){e.addRule("code",{filter:function(e){var t=e.previousSibling||e.nextSibling,r=e.parentNode&&"PRE"===e.parentNode.nodeName&&!t;return"CODE"===e.nodeName&&!r},replacement:function(e,t,r){if(!e.trim())return"";var n=r.codeDelimiter||"`",o="",i="",a=e.match(/`+/gm);if(a)for(/^`/.test(e)&&(o=" "),/`$/.test(e)&&(i=" ");-1!==a.indexOf(n);)n+="`";return n+o+e+i+n}})},C=[[/\*/g,"\\*"],[/"/g,'\\"']],S=function(e){e.addRule("referenceLink",{filter:function(e,t){return!("referenced"!==t.linkStyle||"A"!==e.nodeName||!e.getAttribute("href"))},replacement:function(e,t,r){var n=i(C,decodeURIComponent(t.getAttribute("href")));n.includes(" ")&&(n="<"+n+">");var o,a,s=t.title?' "'+i(C,t.title)+'"':"";switch(r.linkReferenceStyle){case"collapsed":o="["+e+"][]",a="["+e+"]: "+n+s;break;case"shortcut":o="["+e+"]",a="["+e+"]: "+n+s;break;default:var c=this.references&&this.references.length?"ref"+(this.references.length+1):"ref";o="["+e+"]["+c+"]",a="["+c+"]: "+n+s}return this.references&&this.references.push(a),o},references:[],unshift:function(){var e="";return this.references&&this.references.length&&(e="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),e}})},O=[[/(.*)\|(.*)/g,function(e,t,r){return e.match(/\`.*\|.*\`/)?t+"|"+r:t+"\\|"+r}]],M=Array.prototype.every,k=Array.prototype.indexOf;function A(e,t,r){var n=t.parentNode?k.call(t.parentNode.childNodes,t):-1,o=" ";return r&&r.convertNoHeaderTable&&(e=e.replace(/\n+/g,"
")),0===n&&(o="| "),o+i(O,e)+" |"}function D(e){var t=e.parentNode;return!!t&&("THEAD"===t.nodeName||t.firstChild===e&&("TABLE"===t.nodeName||function(e){var t=e.previousSibling;return"TBODY"===e.nodeName&&(!t||"THEAD"===t.nodeName&&/^\s*$/i.test(t.textContent||""))}(t))&&M.call(e.childNodes,function(e){return"TH"===e.nodeName}))}var H=function(e){e.keep(function(e){return"TABLE"===e.nodeName&&!D(e.rows[0])}),e.addRule("table",{filter:function(e){return"TABLE"===e.nodeName&&D(e.rows[0])},replacement:function(e){return"\n\n"+(e=e.replace("\n\n","\n"))+"\n\n"}}),e.addRule("tableSection",{filter:["thead","tbody","tfoot"],replacement:function(e){return e}}),e.addRule("tableRow",{filter:"tr",replacement:function(e,t){var r="",n={left:":--",right:"--:",center:":-:"};if(D(t))for(var o=0;o "))+n}})},j=function(e){e.addRule("em",{filter:["em","i"],replacement:function(e,t,r){if(!e.trim())return"";var n=r.emDelimiter;return t.parentNode&&"EM"===t.parentNode.nodeName&&t.parentNode.firstChild===t.parentNode.lastChild&&(n="_"===n?"*":"_"),n+e+n}})},V=function(e){e.addRule("del",{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}})},F=[" ","(",")","\\",'"'],I=[[/"/g,"""]],R=function(e){e.addRule("link",{filter:function(e,t){return!("inlined"!==t.linkStyle||"A"!==e.nodeName)},replacement:function(e,t){var r=t.getAttribute("href");if(!r&&!e)return"";var n=r?decodeURIComponent(r).replace("mailto:",""):"";if(t.firstChild&&n===t.firstChild.nodeValue)return"<"+t.firstChild.nodeValue+">";r&&n.split("").some(function(e){return F.includes(e)})&&(r="<"+decodeURIComponent(r)+">");var o=i(I,t.title);return"["+e+"]("+r+(o=o?' "'+o+'"':"")+")"}})},B=function(e){e.addRule("hr",{filter:"img",replacement:function(e,t){var r=t.getAttribute("alt")||"",n=t.getAttribute("src")||"",o=t.title||"";return n?"!["+r+"]("+n+(o?' "'+o+'"':"")+")":""}})},z=function(e){e.addRule("hr",{filter:"br",replacement:function(e,t,r){return r.br+"\n"}})},q=function(e){e.addRule("hr",{filter:["strong","b"],replacement:function(e,t,r){return e.trim()?r.strongDelimiter+e+r.strongDelimiter:""}})},U=function(e){e.addRule("task",{filter:function(e){return"checkbox"===e.type&&null!=e.parentNode&&"LI"===e.parentNode.nodeName},replacement:function(e,t){return(t.checked?"[x]":"[ ]")+" "}})},G=function(e){e.use([v,g,L,w,x,E,S,H,N,P,j,V,R,z,q,B,U]),e.keep(function(t){if(c(e.options,t)){if(t.parentNode){var r=Array.from(t.parentNode.childNodes).findIndex(function(e){return e===t}),n=t.parentNode.childNodes[r+1];n&&(n.unNeedEscape=!0)}return!0}return!1})};function W(e){var t=e.nextSibling||e.parentNode;return e.parentNode&&e.parentNode.removeChild(e),t}function $(e,t,r){return e&&e.parentNode===t||r(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Z=["address","article","aside","audio","blockquote","body","canvas","center","dd","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frameset","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","isindex","li","main","menu","nav","noframes","noscript","ol","output","p","pre","section","table","tbody","td","tfoot","th","thead","tr","ul"];function X(e){return-1!==Z.indexOf(e.nodeName.toLowerCase())}var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function J(e){return-1!==K.indexOf(e.nodeName.toLowerCase())}var Y="undefined"!==typeof window?window:{};function ee(){var e=Y.DOMParser,t=!1;try{(new e).parseFromString("","text/html")&&(t=!0)}catch(r){}return t}var te,re=function(){function e(){}return e.prototype.parseFromString=function(e){return new(0,r(599).JSDOM)(e).window.document},e}(),ne=ee()?Y.DOMParser:re;function oe(e){var t;"string"===typeof e?t=(te=te||new ne).parseFromString(''+e+"","text/html").getElementById("root-node"):t=e.cloneNode(!0);return function(e){var t=e.element,r=e.isBlock,n=e.isVoid,o=e.isPre||function(e){return"PRE"===e.nodeName};if(t.firstChild&&!o(t)){for(var i=null,a=!1,s=null,c=$(s,t,o);c!==t;){if(3===c.nodeType||4===c.nodeType){var u=c.data?c.data.replace(/[ \r\n\t]+/g," "):"";if(i&&i.data&&!/ $/.test(i.data)||a||" "!==u[0]||(u=u.substr(1)),!u){c=W(c);continue}c.data=u,i=c}else if(1===c.nodeType)r(c)||"BR"===c.nodeName?(i&&i.data&&(i.data=i.data.replace(/ $/,"")),i=null,a=!1):n(c)&&(i=null,a=!0);else{if(8!==c.nodeType){c=W(c);continue}if(c.nextElementSibling&&c.parentNode){var l=Array.from(c.parentNode.childNodes).findIndex(function(e){return e===c});c.parentNode.childNodes[l+1].unNeedEscape=!0}}var f=$(s,c,o);s=c,c=f}i&&i.data&&(i.data=i.data.replace(/ $/,""),i.data||W(i))}}({element:t,isBlock:X,isVoid:J}),t}var ie=function(e){return oe(e)};function ae(e,t,r){var n=e.filter;if("string"===typeof n)return n===t.nodeName.toLowerCase();if(Array.isArray(n))return n.indexOf(t.nodeName.toLowerCase())>-1;if("function"===typeof n)return n.call(e,t,r);throw new TypeError("`filter` needs to be a string, array, or function")}function se(e,t,r){for(var n=0;n/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "],[/^(\d+)\. /g,"$1\\. "],[/!/g,"\\!"],[/\$/g,"\\$"],[/%/g,"\\%"],[/&/g,"\\&"],[/\(/g,"\\("],[/\)/g,"\\)"],[/\1)for(var r=1;r0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,r){var n=e[r];switch(r){case"class":t.className=n,delete t.class;break;default:t[r]=n}return t},{})}var d=function(){function e(){a()(this,e),this.collection={}}return c()(e,[{key:"clear",value:function(){this.collection={}}},{key:"delete",value:function(e){return delete this.collection[e]}},{key:"get",value:function(e){return this.collection[e]}},{key:"has",value:function(e){return Boolean(this.collection[e])}},{key:"set",value:function(e,t){return this.collection[e]=t,this}},{key:"size",get:function(){return Object.keys(this.collection).length}}]),e}();function T(e,t,r){return r?l.createElement(e.tag,o()({key:t},h(e.attrs),r),(e.children||[]).map(function(r,n){return T(r,t+"-"+e.tag+"-"+n)})):l.createElement(e.tag,o()({key:t},h(e.attrs)),(e.children||[]).map(function(r,n){return T(r,t+"-"+e.tag+"-"+n)}))}function m(e){return Object(u.generate)(e)[0]}function Q(e,t){switch(t){case"fill":return e+"-fill";case"outline":return e+"-o";case"twotone":return e+"-twotone";default:throw new TypeError("Unknown theme type: "+t+", name: "+e)}}}).call(this,r(52))},function(e,t,r){"use strict";r.d(t,"a",function(){return u}),r.d(t,"d",function(){return l}),r.d(t,"c",function(){return f}),r.d(t,"b",function(){return p});var n=!("undefined"===typeof window||!window.document||!window.document.createElement);function o(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r["ms"+e]="MS"+t,r["O"+e]="o"+t.toLowerCase(),r}var i=function(e,t){var r={animationend:o("Animation","AnimationEnd"),transitionend:o("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete r.animationend.animation,"TransitionEvent"in t||delete r.transitionend.transition),r}(n,"undefined"!==typeof window?window:{}),a={};n&&(a=document.createElement("div").style);var s={};function c(e){if(s[e])return s[e];var t=i[e];if(t)for(var r=Object.keys(t),n=r.length,o=0;o=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=r(46),a=r.n(i);function s(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(u){return void r(u)}s.done?t(c):Promise.resolve(c).then(n,o)}function c(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,c,"next",e)}function c(e){s(i,n,o,a,c,"throw",e)}a(void 0)})}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e){var t=function(e,t){if("object"!=l(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==l(t)?t:String(t)}function p(e,t){for(var r=0;r=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function d(e,t){if(c.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return I(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return R(e).length;default:if(n)return I(e).length;t=(""+t).toLowerCase(),n=!0}}function T(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,o){if(0===e.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"===typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:Q(e,t,r,n,o);if("number"===typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Q(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Q(e,t,r,n,o){var i,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=r;is&&(r=s-c),i=r;i>=0;i--){for(var f=!0,p=0;po&&(n=o):n=o;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function w(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+f<=r)switch(f){case 1:u<128&&(l=u);break;case 2:128===(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],a=e[o+2],128===(192&i)&&128===(192&a)&&(c=(15&u)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128===(192&i)&&128===(192&a)&&128===(192&s)&&(c=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=f}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return w(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},c.prototype.compare=function(e,t,r,n,o){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(n,o),l=e.slice(t,r),f=0;fo)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return g(this,e,t,r);case"latin1":case"binary":return b(this,e,t,r);case"base64":return L(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function C(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;on)&&(r=n);for(var o="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function A(e,t,r,n,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o>>8*(n?o:1-o)}function H(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o>>8*(n?o:3-o)&255}function N(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(e,t,r,n,i){return i||N(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,i){return i||N(e,0,r,8),o.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)n+=this[e+--t]*o;return n},c.prototype.readUInt8=function(e,t){return t||k(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||k(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||k(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||k(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||k(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||k(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||k(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||k(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||k(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||A(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):H(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):H(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);A(this,e,t,r,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);A(this,e,t,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):H(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):H(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n