2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-25 02:44:29 -06:00
easy-markdown-editor/dist/simplemde.min.js

15 lines
270 KiB
JavaScript
Raw Normal View History

/**
2016-06-14 12:48:07 -05:00
* simplemde v1.11.2
* Copyright Next Step Webs, Inc.
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
* @license MIT
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.SimpleMDE=e()}}(function(){var e;return function e(t,n,r){function i(a,l){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return i(n?n:e)},u,u.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,l,s=e.length;a=r(e),l=new f(3*s/4-a),i=a>0?s-4:s;var c=0;for(t=0,n=0;t<i;t+=4,n+=3)o=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],l[c++]=o>>16&255,l[c++]=o>>8&255,l[c++]=255&o;return 2===a?(o=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,l[c++]=255&o):1===a&&(o=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,l[c++]=o>>8&255,l[c++]=255&o),l}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function l(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(a(r));return i.join("")}function s(e){for(var t,n=e.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(l(e,s,s+a>u?u:s+a));return 1===r?(t=e[n-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=s;for(var c=[],u=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d<p;++d)c[d]=h[d],u[h.charCodeAt(d)]=d;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){},{}],3:[function(e,t,n){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function i(e){if(e>Y)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=o.prototype,t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(e)}return a(e,t,n)}function a(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return e instanceof ArrayBuffer?h(e,t,n):"string"==typeof e?u(e,t):d(e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function s(e,t,n){return l(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}function c(e){return l(e),i(e<0?0:0|p(e))}function u(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(e,t),r=i(n),a=r.write(e,t);return a!==n&&(r=r.slice(0,a)),r}function f(e){for(var t=e.length<0?0:0|p(e.length),n=i(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");var r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),r.__proto__=o.prototype,r}function d(e){if(o.isBuffer(e)){var t=0|p(e.length),n=i(t);return 0===n.length?n:(e.copy(n,0,0,t),n)}if(e){if(ArrayBuffer.isView(e)||"length"in e)return"number"!=typeof e.length||V(e.length)?i(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}functio
i.sizer=r("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=r("div",null,null,"position: absolute; height: "+xa+"px; width: 1px;"),i.gutters=r("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=r("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=r("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),Yo&&Zo<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),Jo||$o&&aa||(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,n.init(i)}function T(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function M(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function N(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function A(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function E(e){if(null==e.parent)return null;for(var t=e.parent,n=f(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function O(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return n+a}function I(e,t){return t>=e.first&&t<e.first+e.size}function H(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function D(e,t,n){return void 0===n&&(n=null),this instanceof D?(this.line=e,this.ch=t,void(this.sticky=n)):new D(e,t,n)}function W(e,t){return e.line-t.line||e.ch-t.ch}function B(e,t){return e.sticky==t.sticky&&0==W(e,t)}function P(e){return D(e.line,e.ch)}function R(e,t){return W(e,t)<0?t:e}function F(e,t){return W(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function _(e,t){if(t.line<e.first)return D(e.first,0);var n=e.first+e.size-1;return t.line>n?D(n,T(e,n).text.length):j(t,T(e,t.line).text.length)}function j(e,t){var n=e.ch;return null==n||n>t?D(e.line,t):n<0?D(e.line,0):e}function q(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=_(e,t[r]);return n}function U(){Ma=!0}function G(){Na=!0}function $(e,t,n){this.marker=e,this.from=t,this.to=n}function V(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function K(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function X(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Y(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new $(a,o.from,s?null:o.to))}}return r}function Z(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new $(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return r}function J(e,t){if(t.full)return null;var n=I(e,t.from.line)&&T(e,t.from.line).markedSpans,r=I(e,t.to.line)&&T(e,t.to.line).markedSpans;if(!n&&!
i-=an();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function cn(e,t,n,r,i){return r||(r=T(e.doc,t.line)),ln(e,r,Vt(e,r,t.ch,i),n)}function un(e,t,n,r,i,o){function a(t,a){var l=Yt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,ln(e,r,l,n)}function l(e,t,n){var r=s[t],i=r.level%2!=0;return a(n?e-1:e,i!=n)}r=r||T(e.doc,t.line),i||(i=Xt(e,r));var s=ke(r),c=t.ch,u=t.sticky;if(c>=r.text.length?(c=r.text.length,u="before"):c<=0&&(c=0,u="after"),!s)return a("before"==u?c-1:c,"before"==u);var f=we(s,c,u),h=Aa,d=l(c,f,"before"==u);return null!=h&&(d.other=l(c,h,"before"!=u)),d}function fn(e,t){var n=0;t=_(e.doc,t),e.options.lineWrapping||(n=yn(e.display)*t.ch);var r=T(e.doc,t.line),i=ve(r)+Rt(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function hn(e,t,n,r,i){var o=D(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function dn(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return hn(r.first,0,null,!0,-1);var i=O(r,n),o=r.first+r.size-1;if(i>o)return hn(r.first+r.size-1,T(r,o).text.length,null,!0,1);t<0&&(t=0);for(var a=T(r,i);;){var l=gn(e,a,i,t,n),s=se(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=E(a=c.to.line)}}function pn(e,t,n,r){var i=function(r){return ln(e,t,Yt(e,n,r),"line")},o=t.text.length,a=S(function(e){return i(e-1).bottom<=r},o,0);return o=S(function(e){return i(e).top>r},a,o),{begin:a,end:o}}function mn(e,t,n,r){var i=ln(e,t,Yt(e,n,r),"line").top;return pn(e,t,n,i)}function gn(e,t,n,r,i){i-=ve(t);var o,a=0,l=t.text.length,s=Xt(e,t),c=ke(t);if(c){if(e.options.lineWrapping){var u;u=pn(e,t,s,i),a=u.begin,l=u.end,u}o=new D(n,a);var f,h,d=un(e,o,"line",t,s).left,p=d<r?1:-1,m=d-r;do{if(f=m,h=o,o=Te(e,t,o,p),null==o||o.ch<a||l<=("before"==o.sticky?o.ch-1:o.ch)){o=h;break}m=un(e,o,"line",t,s).left-r}while(p<0!=m<0&&Math.abs(m)<=Math.abs(f));if(Math.abs(m)>Math.abs(f)){if(m<0==f<0)throw new Error("Broke out of infinite loop in coordsCharInner");o=h}}else{var g=S(function(n){var o=ln(e,t,Yt(e,s,n),"line");return o.top>i?(l=Math.min(n,l),!0):!(o.bottom<=i)&&(o.left>r||!(o.right<r)&&r-o.left<o.right-r)},a,l);g=C(t.text,g,1),o=new D(n,g,g==l?"before":"after")}var v=un(e,o,"line",t,s);return(i<v.top||v.bottom<i)&&(o.outside=!0),o.xRel=r<v.left?-1:r>v.right?1:0,o}function vn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==qa){qa=r("pre");for(var i=0;i<49;++i)qa.appendChild(document.createTextNode("x")),qa.appendChild(r("br"));qa.appendChild(document.createTextNode("x"))}n(e.measure,qa);var o=qa.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function yn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=r("span","xxxxxxxxxx"),i=r("pre",[t]);n(e.measure,i);var o=t.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function xn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:bn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function bn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function wn(e){var t=vn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/yn(e.display)-3);return function(i){if(me(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function kn(e){var t=e.doc,n=wn(e);t.iter(function(e){var t=n(e);t!=e.height&&A(e,t)})}function Cn(e,t,n,r){var i=e.display;if(!n&&"true"==Re(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(e){return null}var s,c=dn(e,o,a);if(r&&1==c.xRel&&(s=T(e.doc,c.line).text).length==c.ch){var f=u(s,s.length,e.options.tabSize)-s.leng
}}}return r}function ni(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var o=W(n,i)<0;o!=W(r,i)<0?(i=n,n=r):o!=W(n,r)<0&&(n=r)}return new rl(i,n)}return new rl(r||n,n)}function ri(e,t,n,r){ci(e,new nl([ni(e,e.sel.primary(),t,n)],0),r)}function ii(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=ni(e,e.sel.ranges[i],t[i],null);var o=Er(r,e.sel.primIndex);ci(e,o,n)}function oi(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,ci(e,Er(i,e.sel.primIndex),r)}function ai(e,t,n,r){ci(e,Or(t,n),r)}function li(e,t,n){var r={ranges:t.ranges,update:function(t){var n=this;this.ranges=[];for(var r=0;r<t.length;r++)n.ranges[r]=new rl(_(e,t[r].anchor),_(e,t[r].head))},origin:n&&n.origin};return Ae(e,"beforeSelectionChange",e,r),e.cm&&Ae(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Er(r.ranges,r.ranges.length-1):t}function si(e,t,n){var r=e.history.done,i=p(r);i&&i.ranges?(r[r.length-1]=t,ui(e,t,n)):ci(e,t,n)}function ci(e,t,n){ui(e,t,n),Xr(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ui(e,t,n){(Ie(e,"beforeSelectionChange")||e.cm&&Ie(e.cm,"beforeSelectionChange"))&&(t=li(e,t,n));var r=n&&n.bias||(W(t.primary().head,e.sel.primary().head)<0?-1:1);fi(e,di(e,t,r,!0)),n&&n.scroll===!1||!e.cm||Qn(e.cm)}function fi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Oe(e.cm)),kt(e,"cursorActivity",e))}function hi(e){fi(e,di(e,e.sel,null,!1),wa)}function di(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=mi(e,a.anchor,l&&l.anchor,n,r),c=mi(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new rl(s,c))}return i?Er(i,t.primIndex):t}function pi(e,t,n,r,i){var o=T(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(Ae(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var c=s.find(r<0?1:-1),u=void 0;if((r<0?s.inclusiveRight:s.inclusiveLeft)&&(c=gi(e,c,-r,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=W(c,n))&&(r<0?u<0:u>0))return pi(e,c,t,r,i)}var f=s.find(r<0?-1:1);return(r<0?s.inclusiveLeft:s.inclusiveRight)&&(f=gi(e,f,r,f.line==t.line?o:null)),f?pi(e,f,t,r,i):null}}return t}function mi(e,t,n,r,i){var o=r||1,a=pi(e,t,n,o,i)||!i&&pi(e,t,n,o,!0)||pi(e,t,n,-o,i)||!i&&pi(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,D(e.first,0))}function gi(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?_(e,D(t.line-1)):null:n>0&&t.ch==(r||T(e,t.line)).text.length?t.line<e.first+e.size-1?D(t.line+1,0):null:new D(t.line,t.ch+n)}function vi(e){e.setSelection(D(e.firstLine(),0),D(e.lastLine()),wa)}function yi(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=_(e,t)),n&&(r.to=_(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),Ae(e,"beforeChange",e,r),e.cm&&Ae(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function xi(e,t,n){if(e.cm){if(!e.cm.curOp)return ur(e.cm,xi)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Ie(e,"beforeChange")||e.cm&&Ie(e.cm,"beforeChange"))||(t=yi(e,t,!0))){var r=Ma&&!n&&ee(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)bi(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else bi(e,t)}}function bi(e,t){if(1!=t.text.length||""!=t.text[0]||0!=W(t.from,t.to)){var n=Dr(e,t);Vr(e,t,n,e.cm?e.cm.curOp.id:NaN),Ci(e,t,n,J(e,t));var r=[];_r(e,function(e,n){n||f(r,e.history)!=-1||(Ni(e.history,t),r.push(e.history)),Ci(e,t,null,J(e,t))})}}function wi(e,t,n){if(!e.cm||!e.cm.state.suppressEdits||n){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(r=a[s],n?!r.ranges||r.equals(e.sel):r.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;r=a.pop(),r.ranges;){if(Yr(r,l),n&&!r.equals(e.sel))return void ci(e,r,{clearRedo:!1});o=r}var c=[];
if(i==e||"string"==typeof e&&i.name==e)return n.splice(r,1),t.state.modeGen++,void dr(t)}}),indentLine:fr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),I(this.doc,e)&&To(this,e,t,n)}),indentSelection:fr(function(e){for(var t=this,n=this.doc.sel.ranges,r=-1,i=0;i<n.length;i++){var o=n[i];if(o.empty())o.head.line>r&&(To(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&Qn(t));else{var a=o.from(),l=o.to(),s=Math.max(r,a.line);r=Math.min(t.lastLine(),l.line-(l.ch?0:1))+1;for(var c=s;c<r;++c)To(t,c,e);var u=t.doc.sel.ranges;0==a.ch&&n.length==u.length&&u[i].from().ch>0&&oi(t.doc,i,new rl(a,u[i].to()),wa)}}}),getTokenAt:function(e,t){return rt(this,e,t)},getLineTokens:function(e,t){return rt(this,D(e),t,!0)},getTokenTypeAt:function(e){e=_(this.doc,e);var t,n=Je(this,T(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=this,i=[];if(!n.hasOwnProperty(t))return i;var o=n[t],a=this.getModeAt(e);if("string"==typeof a[t])o[a[t]]&&i.push(o[a[t]]);else if(a[t])for(var l=0;l<a[t].length;l++){var s=o[a[t][l]];s&&i.push(s)}else a.helperType&&o[a.helperType]?i.push(o[a.helperType]):o[a.name]&&i.push(o[a.name]);for(var c=0;c<o._global.length;c++){var u=o._global[c];u.pred(a,r)&&f(i,u.val)==-1&&i.push(u.val)}return i},getStateAfter:function(e,t){var n=this.doc;return e=z(n,null==e?n.first+n.size-1:e),Qe(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?_(this.doc,e):e?r.from():r.to(),un(this,n,t||"page")},charCoords:function(e,t){return cn(this,_(this.doc,e),t||"page")},coordsChar:function(e,t){return e=sn(this,e,t||"page"),dn(this,e.left,e.top)},lineAtHeight:function(e,t){return e=sn(this,{top:e,left:0},t||"page").top,O(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=T(this.doc,e)}else r=e;return ln(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-ve(r):0)},defaultTextHeight:function(){return vn(this.display)},defaultCharWidth:function(){return yn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=un(this,_(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&Yn(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:fr(ao),triggerOnKeyPress:fr(co),triggerOnKeyUp:so,execCommand:function(e){if(wl.hasOwnProperty(e))return wl[e].call(null,this)},triggerElectric:fr(function(e){Eo(this,e)}),findPosH:function(e,t,n,r){var i=this,o=1;t<0&&(o=-1,t=-t);for(var a=_(this.doc,e),l=0;l<t&&(a=Wo(i.doc,a,o,n,r),!a.hitSide);++l);return a},moveH:fr(function(e,t){var n=this;this.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Wo(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},Ca)}),deleteH:fr(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Zi(th
var t=D(this.first,0),n=this.first+this.size-1;xi(this,{from:t,to:D(n,T(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),ci(this,Or(t))}),replaceRange:function(e,t,n,r){t=_(this,t),n=n?_(this,n):t,Li(this,e,t,n,r)},getRange:function(e,t,n){var r=M(this,_(this,e),_(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(I(this,e))return T(this,e)},getLineNumber:function(e){return E(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=T(this,e)),ue(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return _(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||e===!1?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:hr(function(e,t,n){ai(this,_(this,"number"==typeof e?D(e,t||0):e),null,n)}),setSelection:hr(function(e,t,n){ai(this,_(this,e),_(this,t||e),n)}),extendSelection:hr(function(e,t,n){ri(this,_(this,e),t&&_(this,t),n)}),extendSelections:hr(function(e,t){ii(this,q(this,e),t)}),extendSelectionsBy:hr(function(e,t){var n=m(this.sel.ranges,e);ii(this,q(this,n),t)}),setSelections:hr(function(e,t,n){var r=this;if(e.length){for(var i=[],o=0;o<e.length;o++)i[o]=new rl(_(r,e[o].anchor),_(r,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),ci(this,Er(i,t),n)}}),addSelection:hr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new rl(_(this,e),_(this,t||e))),ci(this,Er(r,r.length-1),n)}),getSelection:function(e){for(var t,n=this,r=this.sel.ranges,i=0;i<r.length;i++){var o=M(n,r[i].from(),r[i].to());t=t?t.concat(o):o}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=this,n=[],r=this.sel.ranges,i=0;i<r.length;i++){var o=M(t,r[i].from(),r[i].to());e!==!1&&(o=o.join(e||t.lineSeparator())),n[i]=o}return n},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:hr(function(e,t,n){for(var r=this,i=[],o=this.sel,a=0;a<o.ranges.length;a++){var l=o.ranges[a];i[a]={from:l.from(),to:l.to(),text:r.splitLines(e[a]),origin:n}}for(var s=t&&"end"!=t&&Br(this,i,t),c=i.length-1;c>=0;c--)xi(r,i[c]);s?si(this,s):this.cm&&Qn(this.cm)}),undo:hr(function(){wi(this,"undo")}),redo:hr(function(){wi(this,"redo")}),undoSelection:hr(function(){wi(this,"undo",!0)}),redoSelection:hr(function(){wi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new qr(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ti(this.history.done),undone:ti(this.history.undone)}},setHistory:function(e){var t=this.history=new qr(this.history.maxGeneration);t.done=ti(e.done.slice(0),null,!0),t.undone=ti(e.undone.slice(0),null,!0)},setGutterMarker:hr(function(e,t,n){return Ai(this,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&w(r)&&(e.gutterMarkers=null),!0})}),clearGutter:hr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Ai(t,n,"gutter",function(){return n.gutterMarkers[e]=null,w(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!I(this,e))return null;if(t=e,e=T(this,e),!e)return null}else if(t=E(e),null==t)return null;return{line:t,handle:e,text:e.text
"../../lib/codemirror":10,"../markdown/markdown":12}],12:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror"),t("../xml/xml"),t("../meta")):"function"==typeof e&&e.amd?e(["../../lib/codemirror","../xml/xml","../meta"],i):i(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,n){function r(n){if(e.findModeByName){var r=e.findModeByName(n);r&&(n=r.mime||r.mimes[0])}var i=e.getMode(t,n);return"null"==i.name?null:i}function i(e,t,n){return t.f=t.inline=n,n(e,t)}function o(e,t,n){return t.f=t.block=n,n(e,t)}function a(e){return!e||!/\S/.test(e.string)}function l(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,k&&e.f==c&&(e.f=p,e.block=s),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function s(t,o){var l=t.sol(),s=o.list!==!1,c=o.indentedCode;o.indentedCode=!1,s&&(o.indentationDiff>=0?(o.indentationDiff<4&&(o.indentation-=o.indentationDiff),o.list=null):o.indentation>0?o.list=null:o.list=!1);var f=null;if(o.indentationDiff>=4)return t.skipToEnd(),c||a(o.prevLine)?(o.indentation-=4,o.indentedCode=!0,C.code):null;if(t.eatSpace())return null;if((f=t.match(N))&&f[1].length<=6)return o.header=f[1].length,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,h(o);if(!(a(o.prevLine)||o.quote||s||c)&&(f=t.match(A)))return o.header="="==f[0].charAt(0)?1:2,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,h(o);if(t.eat(">"))return o.quote=l?1:o.quote+1,n.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),h(o);if("["===t.peek())return i(t,o,y);if(t.match(L,!0))return o.hr=!0,C.hr;if(f=t.match(T)){var d=f[1]?"ol":"ul";for(o.indentation=t.column()+t.current().length,o.list=!0;o.listStack&&t.column()<o.listStack[o.listStack.length-1];)o.listStack.pop();return o.listStack.push(o.indentation),n.taskLists&&t.match(M,!1)&&(o.taskList=!0),o.f=o.inline,n.highlightFormatting&&(o.formatting=["list","list-"+d]),h(o)}return n.fencedCodeBlocks&&(f=t.match(O,!0))?(o.fencedChars=f[1],o.localMode=r(f[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=u,n.highlightFormatting&&(o.formatting="code-block"),o.code=-1,h(o)):i(t,o,o.inline)}function c(t,n){var r=w.token(t,n.htmlState);if(!k){var i=e.innerMode(w,n.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||n.md_inside&&t.current().indexOf(">")>-1)&&(n.f=p,n.block=s,n.htmlState=null)}return r}function u(e,t){return t.fencedChars&&e.match(t.fencedChars)?(n.highlightFormatting&&(t.formatting="code-block"),t.localMode=t.localState=null,t.f=t.block=f,h(t)):t.fencedChars&&e.skipTo(t.fencedChars)?"comment":t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),C.code)}function f(e,t){e.match(t.fencedChars),t.block=s,t.f=p,t.fencedChars=null,n.highlightFormatting&&(t.formatting="code-block"),t.code=1;var r=h(t);return t.code=0,r}function h(e){var t=[];if(e.formatting){t.push(C.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(C.formatting+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(C.formatting+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(C.formatting+"-"+e.formatting[r]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(C.linkHref,"url"):(e.strong&&t.push(C.strong),e.em&&t.push(C.em),e.strikethrough&&t.push(C.strikethrough),e.linkText&&t.push(C.linkText),e.code&&t.push(C.code),e.image&&t.push(C.image),e.imageAltText&&t.push(C.imageAltText,"link"),e.imageMarker&&t.push(C.imageMarker)),e.header&&t.push(C.header,C.header+"-"+e.header),e.quote&&(t.push(C.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(C.quote+"-"+e.quote):t.push(C.quote+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(C.list2):t.push(C.list3):t.push(C.list1)}return e.
try{i=t.lex(e,n)}catch(e){return r(e)}o=i.length;var u=function(e){if(e)return n.highlight=s,r(e);var t;try{t=a.parse(i,n)}catch(t){e=t}return n.highlight=s,e?r(e):r(null,t)};if(!s||s.length<3)return u();if(delete n.highlight,!o)return u();for(;c<i.length;c++)!function(e){return"code"!==e.type?--o||u():s(e.text,e.lang,function(t,n){return t?u(t):null==n||n===e.text?--o||u():(e.text=n,e.escaped=!0,void(--o||u()))})}(i[c])}else try{return n&&(n=f({},h.defaults,n)),a.parse(t.lex(e,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(n||h.defaults).silent)return"<p>An error occured:</p><pre>"+l(e.message+"",!0)+"</pre>";throw e}}var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:u,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:u,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:u,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=c(d.item,"gm")(/bull/g,d.bullet)(),d.list=c(d.list)(/bull/g,d.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+d.def.source+")")(),d.blockquote=c(d.blockquote)("def",d.def)(),d._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",d.html=c(d.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,d._tag)(),d.paragraph=c(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=f({},d),d.gfm=f({},d.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),d.gfm.paragraph=c(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=f({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=d,t.lex=function(e,n){var r=new t(n);return r.lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t,n){for(var r,i,o,a,l,s,c,u,f,e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=this.rules.nptable.exec(e))){for(e=e.substring(o[0].length),s={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},u=0;u<s.align.length;u++)/^ *-+: *$/.test(s.align[u])?s.align[u]="right":/^ *:-+: *$/.test(s.align[u])?s.align[u]="center":/^ *:-+ *$/.test(s.align[u])?s.align[u]="left":s.align[u]=null;for(u=0;u<s.cells.length;u++)s.cells[u]=s.cells[u].split(/ *\| */);this.tokens.push(s)}else if(o=this.rules.lheading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:"="===o[2]?1:2,text:o[1]});else if(o=this.rules.hr.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"hr"});else if(o=this.rules.blockquote.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"blockquote_start"})
var l=n.exec(a),h=c(t,f);null!==l?(u(t,l[2])&&(h=""),a=l[1]+h+l[3]+a.replace(r,"").replace(s[t],"$1")):a=h+" "+a,f+=1}e.replaceRange(a,{line:o,ch:0},{line:o,ch:99999999999999})}(h);e.focus()}}function H(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r="undefined"==typeof r?n:r;var i,o=e.codemirror,a=l(o),s=n,c=r,u=o.getCursor("start"),f=o.getCursor("end");a[t]?(i=o.getLine(u.line),s=i.slice(0,u.ch),c=i.slice(u.ch),"bold"==t?(s=s.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),c=c.replace(/(\*\*|__)/,"")):"italic"==t?(s=s.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),c=c.replace(/(\*|_)/,"")):"strikethrough"==t&&(s=s.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),c=c.replace(/(\*\*|~~)/,"")),o.replaceRange(s+c,{line:u.line,ch:0},{line:u.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(u.ch-=2,u!==f&&(f.ch-=2)):"italic"==t&&(u.ch-=1,u!==f&&(f.ch-=1))):(i=o.getSelection(),"bold"==t?(i=i.split("**").join(""),i=i.split("__").join("")):"italic"==t?(i=i.split("*").join(""),i=i.split("_").join("")):"strikethrough"==t&&(i=i.split("~~").join("")),o.replaceSelection(s+i+c),u.ch+=n.length,f.ch=u.ch+i.length),o.setSelection(u,f),o.focus()}}function D(e){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className))for(var t,n=e.getCursor("start"),r=e.getCursor("end"),i=n.line;i<=r.line;i++)t=e.getLine(i),t=t.replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/,""),e.replaceRange(t,{line:i,ch:0},{line:i,ch:99999999999999})}function W(e,t){for(var n in t)t.hasOwnProperty(n)&&(t[n]instanceof Array?e[n]=t[n].concat(e[n]instanceof Array?e[n]:[]):null!==t[n]&&"object"==typeof t[n]&&t[n].constructor===Object?e[n]=W(e[n]||{},t[n]):e[n]=t[n]);return e}function B(e){for(var t=1;t<arguments.length;t++)e=W(e,arguments[t]);return e}function P(e){var t=/[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g,n=e.match(t),r=0;if(null===n)return r;for(var i=0;i<n.length;i++)r+=n[i].charCodeAt(0)>=19968?n[i].length:1;return r}function R(e){e=e||{},e.parent=this;var t=!0;if(e.autoDownloadFontAwesome===!1&&(t=!1),e.autoDownloadFontAwesome!==!0)for(var n=document.styleSheets,r=0;r<n.length;r++)n[r].href&&n[r].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/")>-1&&(t=!1);if(t){var i=document.createElement("link");i.rel="stylesheet",i.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(i)}if(e.element)this.element=e.element;else if(null===e.element)return void console.log("SimpleMDE: Error. No element was found.");if(void 0===e.toolbar){e.toolbar=[];for(var o in X)X.hasOwnProperty(o)&&(o.indexOf("separator-")!=-1&&e.toolbar.push("|"),(X[o].default===!0||e.showIcons&&e.showIcons.constructor===Array&&e.showIcons.indexOf(o)!=-1)&&e.toolbar.push(o))}e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=B({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=B({},Y,e.insertTexts||{}),e.promptTexts=Z,e.blockStyles=B({},J,e.blockStyles||{}),e.shortcuts=B({},G,e.shortcuts||{}),e.minHeight=e.minHeight||"300px",void 0!=e.autosave&&void 0!=e.autosave.unique_id&&""!=e.autosave.unique_id&&(e.autosave.uniqueId=e.autosave.unique_id),this.options=e,this.render(),!e.initialValue||this.options.autosave&&this.options.autosave.foundSavedValue===!0||this.value(e.initialValue)}function F(){if("object"!=typeof localStorage)return!1;try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}var z=e("codemirror");e("codemirror/addon/edit/continuelist.js"),e("./codemirror/tablist"),e("codemirror/addon/display/fullscreen.js"),e("codemirror/mode/markdown/markdown.js"),e("codemirror/addon/mode/overlay.js"),e("codemirror/addon/display/placeholder.js"),e("codemirror/addon/selection/mark-selection.js"),e("codemirror/mode/gfm/gfm.js"),e("codemirror/mode/xml/xml.js");var _=e("codemirror-spell-checker"),j=e("ma