You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simplemde-markdown-editor/dist/simplemde.min.js

15 lines
267 KiB
JavaScript

/**
* simplemde v1.11.2
* Copyright Sparksuite, Inc.
* @link https://github.com/sparksuite/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 u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.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 u=0;for(t=0,n=0;t<i;t+=4,n+=3)o=c[e.charCodeAt(t)]<<18|c[e.charCodeAt(t+1)]<<12|c[e.charCodeAt(t+2)]<<6|c[e.charCodeAt(t+3)],l[u++]=o>>16&255,l[u++]=o>>8&255,l[u++]=255&o;return 2===a?(o=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,l[u++]=255&o):1===a&&(o=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,l[u++]=o>>8&255,l[u++]=255&o),l}function a(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[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,c=n-r;s<c;s+=a)o.push(l(e,s,s+a>c?c:s+a));return 1===r?(t=e[n-1],i+=u[t>>2],i+=u[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=s;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d<p;++d)u[d]=h[d],c[h.charCodeAt(d)]=d;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){},{}],3:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=a.prototype):(null===e&&(e=new a(t)),e.length=t),e}function a(e,t,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(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(this,e)}return l(this,e,t,n)}function l(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?d(e,t,n,r):"string"==typeof t?f(e,t,n):p(e,t)}function s(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 u(e,t,n,r){return s(t),t<=0?o(e,t):void 0!==n?"string"==typeof r?o(e,t).fill(n,r):o(e,t).fill(n):o(e,t)}function c(e,t){if(s(t),e=o(e,t<0?0:0|m(t)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function f(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|v(t,n);e=o(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function h(e,t){var n=t.length<0?0:0|m(t.length);e=o(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function d(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8A
n=new y),t&&u(t,n),n}function b(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Da.test(e))}function w(e,t){return t?!!(t.source.indexOf("\\w")>-1&&b(e))||t.test(e):b(e)}function k(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function S(e){return e.charCodeAt(0)>=768&&Ha.test(e)}function C(e,t,n){var i=this;this.input=n,i.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=r("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=r("div",null,"CodeMirror-code"),i.selectionDiv=r("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=r("div",null,"CodeMirror-cursors"),i.measure=r("div",null,"CodeMirror-measure"),i.lineMeasure=r("div",null,"CodeMirror-measure"),i.lineSpace=r("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none"),i.mover=r("div",[r("div",[i.lineSpace],"CodeMirror-lines")],null,"position: relative"),i.sizer=r("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=r("div",null,null,"position: absolute; height: "+Na+"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"),la&&sa<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),ua||ia&&va||(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 L(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 T(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 M(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 N(e){if(null==e.parent)return null;for(var t=e.parent,n=h(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 E(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 O(e,t){return t>=e.first&&t<e.first+e.size}function I(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function P(e,t){return this instanceof P?(this.line=e,void(this.ch=t)):new P(e,t)}function R(e,t){return e.line-t.line||e.ch-t.ch}function D(e){return P(e.line,e.ch)}function H(e,t){return R(e,t)<0?t:e}function W(e,t){return R(e,t)<0?e:t}function B(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function _(e,t){if(t.line<e.first)return P(e.first,0);var n=e.first+e.size-1;return t.line>n?P(n,L(e,n).text.length):F(t,L(e,t.line).text.length)}function F(e,t){var n=e.ch;return null==n||n>t?P(e.line,t):n<0?P(e.line,0):e}function z(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=_(e,t[r]);return n}function j(){Wa=!0}function U(){Ba=!0}function q(e,t,n){this.marker=e,this.from=t,this.to=n}function G(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}
n}function cn(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=ln(),i-=sn();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 fn(e,t,n,r,i){return r||(r=L(e.doc,t.line)),un(e,r,Kt(e,r,t.ch,i),n)}function hn(e,t,n,r,i,o){function a(t,a){var l=Jt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,un(e,r,l,n)}function l(e,t){var n=s[t],r=n.level%2;return e==ye(n)&&t&&n.level<s[t-1].level?(n=s[--t],e=xe(n)-(n.level%2?0:1),r=!0):e==xe(n)&&t<s.length-1&&n.level<s[t+1].level&&(n=s[++t],e=ye(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?a(e-1):a(e,r)}r=r||L(e.doc,t.line),i||(i=Zt(e,r));var s=Me(r),u=t.ch;if(!s)return a(u);var c=Se(s,u),f=l(u,c);return null!=_a&&(f.other=l(u,_a)),f}function dn(e,t){var n=0;t=_(e.doc,t),e.options.lineWrapping||(n=yn(e.display)*t.ch);var r=L(e.doc,t.line),i=pe(r)+Ft(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function pn(e,t,n,r){var i=P(e,t);return i.xRel=r,n&&(i.outside=!0),i}function mn(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return pn(r.first,0,!0,-1);var i=E(r,n),o=r.first+r.size-1;if(i>o)return pn(r.first+r.size-1,L(r,o).text.length,!0,1);t<0&&(t=0);for(var a=L(r,i);;){var l=gn(e,a,i,t,n),s=ae(a),u=s&&s.find(0,!0);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=N(a=u.to.line)}}function gn(e,t,n,r,i){function o(r){var i=hn(e,P(n,r),"line",t,u);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-pe(t),l=!1,s=2*e.display.wrapper.clientWidth,u=Zt(e,t),c=Me(t),f=t.text.length,h=be(t),d=we(t),p=o(h),m=l,g=o(d),v=l;if(r>g)return pn(n,d,v,1);for(;;){if(c?d==h||d==Le(t,h,1):d-h<=1){var y=r<p||r-p<=g-r?h:d,x=y==h?m:v,b=r-(y==h?p:g);if(v&&!c&&!/\s/.test(t.text.charAt(y))&&b>0&&y<t.text.length&&u.view.measure.heights.length>1){var w=Jt(e,u,y,"right");a<=w.bottom&&a>=w.top&&Math.abs(r-w.right)<b&&(x=!1,y++,b=r-w.right)}for(;S(t.text.charAt(y));)++y;var k=pn(n,y,x,b<-1?-1:b>1?1:0);return k}var C=Math.ceil(f/2),L=h+C;if(c){L=h;for(var T=0;T<C;++T)L=Le(t,L,1)}var M=o(L);M>r?(d=L,g=M,(v=l)&&(g+=1e3),f=C):(h=L,p=M,m=l,f-=C)}}function vn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ja){Ja=r("pre");for(var i=0;i<49;++i)Ja.appendChild(document.createTextNode("x")),Ja.appendChild(r("br"));Ja.appendChild(document.createTextNode("x"))}n(e.measure,Ja);var o=Ja.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(he(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 Sn(e,t,n,r){var i=e.display;if(!n&&"true"==_e(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,u=mn(e,o,a);if(r&&1==u.xRel&&(s=L(e.doc,u.line).text).length==u.ch){var f=c(s,s.length,e.options.tabSize)-s.length;u=P(u.line,Math.max(0,Math.round((o-jt(e.display).left)/yn(e.display))-f))}return u}function Cn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,
return r}function oi(e,t){var n=ii(e,t),r=X(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function ai(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?Pr.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];r.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c=void 0;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&h(t,Number(c[1]))>-1&&(m(l)[f]=u[f],delete u[f])}}}return r}function li(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var o=R(n,i)<0;o!=R(r,i)<0?(i=n,n=r):o!=R(n,r)<0&&(n=r)}return new Rr(i,n)}return new Rr(r||n,n)}function si(e,t,n,r){pi(e,new Pr([li(e,e.sel.primary(),t,n)],0),r)}function ui(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=li(e,e.sel.ranges[i],t[i],null);var o=Dr(r,e.sel.primIndex);pi(e,o,n)}function ci(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,pi(e,Dr(i,e.sel.primIndex),r)}function fi(e,t,n,r){pi(e,Hr(t,n),r)}function hi(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 Rr(_(e,t[r].anchor),_(e,t[r].head))},origin:n&&n.origin};return Ee(e,"beforeSelectionChange",e,r),e.cm&&Ee(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Dr(r.ranges,r.ranges.length-1):t}function di(e,t,n){var r=e.history.done,i=m(r);i&&i.ranges?(r[r.length-1]=t,mi(e,t,n)):pi(e,t,n)}function pi(e,t,n){mi(e,t,n),ei(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function mi(e,t,n){(Pe(e,"beforeSelectionChange")||e.cm&&Pe(e.cm,"beforeSelectionChange"))&&(t=hi(e,t,n));var r=n&&n.bias||(R(t.primary().head,e.sel.primary().head)<0?-1:1);gi(e,yi(e,t,r,!0)),n&&n.scroll===!1||!e.cm||tr(e.cm)}function gi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ie(e.cm)),Ct(e,"cursorActivity",e))}function vi(e){gi(e,yi(e,e.sel,null,!1),Oa)}function yi(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=bi(e,a.anchor,l&&l.anchor,n,r),u=bi(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Rr(s,u))}return i?Dr(i,t.primIndex):t}function xi(e,t,n,r,i){var o=L(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&&(Ee(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var u=s.find(r<0?1:-1),c=void 0;if((r<0?s.inclusiveRight:s.inclusiveLeft)&&(u=wi(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=R(u,n))&&(r<0?c<0:c>0))return xi(e,u,t,r,i)}var f=s.find(r<0?-1:1);return(r<0?s.inclusiveLeft:s.inclusiveRight)&&(f=wi(e,f,r,f.line==t.line?o:null)),f?xi(e,f,t,r,i):null}}return t}function bi(e,t,n,r,i){var o=r||1,a=xi(e,t,n,o,i)||!i&&xi(e,t,n,o,!0)||xi(e,t,n,-o,i)||!i&&xi(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,P(e.first,0))}function wi(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?_(e,P(t.line-1)):null:n>0&&t.ch==(r||L(e,t.line)).text.length?t.line<e.first+e.size-1?P(t.line+1,0):null:new P(t.line,t.ch+n)}function ki(e){e.setSelection(P(e.firstLine(),0),P(e.lastLine()),Oa)}function Si(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)}),Ee(e,"beforeChange",e,r),e.cm&&Ee(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Ci(e,t,n){if(e.cm){if(!e.cm.curOp)return hr(e.cm,Ci)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Pe(e,"beforeChange")||e.cm&&Pe(e.cm,"beforeChange"))||(t=Si(e,t,!0))){var r=Wa&&!n&&J(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Li(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Li(
return ua?e.style.width="1000px":e.setAttribute("wrap","off"),ga&&(e.style.border="1px solid black"),jo(e),t}function qo(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&hr(this,t[e])(this,n,i))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](ao(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:dr(function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");v(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},function(e){return e.priority}),this.state.modeGen++,mr(this)}),removeOverlay:dr(function(e){for(var t=this,n=this.state.overlays,r=0;r<n.length;++r){var i=n[r].modeSpec;if(i==e||"string"==typeof e&&i.name==e)return n.splice(r,1),t.state.modeGen++,void mr(t)}}),indentLine:dr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),O(this.doc,e)&&Ho(this,e,t,n)}),indentSelection:dr(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&&(Ho(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&tr(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 u=s;u<r;++u)Ho(t,u,e);var c=t.doc.sel.ranges;0==a.ch&&n.length==c.length&&c[i].from().ch>0&&ci(t.doc,i,new Rr(a,c[i].to()),Oa)}}}),getTokenAt:function(e,t){return it(this,e,t)},getLineTokens:function(e,t){return it(this,P(e),t,!0)},getTokenTypeAt:function(e){e=_(this.doc,e);var t,n=Qe(this,L(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 u=0;u<o._global.length;u++){var c=o._global[u];c.pred(a,r)&&h(i,c.val)==-1&&i.push(c.val)}return i},getStateAfter:function(e,t){var n=this.doc;return e=B(n,null==e?n.first+n.size-1:e),et(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(),hn(this,n,t||"page")},charCoords:function(e,t){return fn(this,_(this.doc,e),t||"page")},coordsChar:function(e,t){return e=cn(this,e,t||"page"),mn(this,e.left,e.top)},lineAtHeight:function(e,t){return e=cn(this,{top:e,left:0},t||"page").top,E(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=L(this.doc,e)}else r=e;return un(this,r,{top:0,left:0},t||"page",n).top+(i?this.doc.height-pe(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=hn(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),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.off
},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:pr(function(e,t,n){fi(this,_(this,"number"==typeof e?P(e,t||0):e),null,n)}),setSelection:pr(function(e,t,n){fi(this,_(this,e),_(this,t||e),n)}),extendSelection:pr(function(e,t,n){si(this,_(this,e),t&&_(this,t),n)}),extendSelections:pr(function(e,t){ui(this,z(this,e),t)}),extendSelectionsBy:pr(function(e,t){var n=g(this.sel.ranges,e);ui(this,z(this,n),t)}),setSelections:pr(function(e,t,n){var r=this;if(e.length){for(var i=[],o=0;o<e.length;o++)i[o]=new Rr(_(r,e[o].anchor),_(r,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),pi(this,Dr(i,t),n)}}),addSelection:pr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Rr(_(this,e),_(this,t||e))),pi(this,Dr(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=T(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=T(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:pr(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&&zr(this,i,t),u=i.length-1;u>=0;u--)Ci(r,i[u]);s?di(this,s):this.cm&&tr(this.cm)}),undo:pr(function(){Ti(this,"undo")}),redo:pr(function(){Ti(this,"redo")}),undoSelection:pr(function(){Ti(this,"undo",!0)}),redoSelection:pr(function(){Ti(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 Vr(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:ai(this.history.done),undone:ai(this.history.undone)}},setHistory:function(e){var t=this.history=new Vr(this.history.maxGeneration);t.done=ai(e.done.slice(0),null,!0),t.undone=ai(e.undone.slice(0),null,!0)},setGutterMarker:pr(function(e,t,n){return Ri(this,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&k(r)&&(e.gutterMarkers=null),!0})}),clearGutter:pr(function(e){var t=this,n=this.first;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Ri(t,r,"gutter",function(){return r.gutterMarkers[e]=null,k(r.gutterMarkers)&&(r.gutterMarkers=null),!0}),++n})}),lineInfo:function(e){var t;if("number"==typeof e){if(!O(this,e))return null;if(t=e,e=L(this,e),!e)return null}else if(t=N(e),null==t)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:pr(function(t,n,r){return Ri(this,t,"gutter"==n?"gutter":"class",function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(t[i]){if(e(r).test(t[i]))return!1;t[i]+=" "+r}else t[i]=r;return!0})}),removeLineClass:pr(function(t,n,r){return Ri(this,t,"gutter"==n?"gutter":"class",function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass",o=t[i];if(!o)return!1;if(null==r)t[i]=null;else{var a=o.match(e(r));if(!a)return!1;var l=a.index+a[0].length;t[i]=o.slice(0,a.index)+(a.index&&l!=o.lengt
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=c,n.highlightFormatting&&(o.formatting="code-block"),o.code=-1,h(o)):i(t,o,o.inline)}function u(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 c(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=f,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),S.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(S.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(S.formatting+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(S.formatting+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(S.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(S.linkHref,"url"):(e.strong&&t.push(S.strong),e.em&&t.push(S.em),e.strikethrough&&t.push(S.strikethrough),e.linkText&&t.push(S.linkText),e.code&&t.push(S.code),e.image&&t.push(S.image),e.imageAltText&&t.push(S.imageAltText,"link"),e.imageMarker&&t.push(S.imageMarker)),e.header&&t.push(S.header,S.header+"-"+e.header),e.quote&&(t.push(S.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(S.quote+"-"+e.quote):t.push(S.quote+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(S.list2):t.push(S.list3):t.push(S.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function d(e,t){if(e.match(E,!0))return h(t)}function p(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,h(r);if(r.taskList){var a="x"!==t.match(M,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,h(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"),h(r);var l=t.sol(),s=t.next();if(r.linkTitle){r.linkTitle=!1;var c=s;"("===s&&(c=")"),c=(c+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var f="^\\s*(?:[^"+c+"\\\\]+|\\\\\\\\|\\\\.)"+c;if(t.match(new RegExp(f),!0))return S.linkHref}if("`"===s){var d=r.formatting;n.highlightFormatting&&(r.formatting="code"),t.eatWhile("`");var p=t.current().length;if(0==r.code)return r.code=p,h(r);if(p==r.code){var v=h(r);return r.code=0,v}return r.formatting=d,h(r)}if(r.code)return h(r);if("\\"===s&&(t.next(),n.highlightFormatting)){var y=h(r),x=S.formatting+"-escape";return y?y+" "+x:x}if("!"===s&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return r.imageMarker=!0,r.image=!0,n.highlightFormatting&&(r.formatting="image"),h(r);if("["===s&&r.imageMarker)return r.imageMarker=!1,r.imageAltText=!0,n.highlightFormatting&&(r.formatting="image"),h(r);if("]"===s&&r.imageAltText){n.highlightFormatting&&(r.formatting="image");var y=h(r);return r.imageAltText=!1,r.image=!1,r.inline=r.f=g,y}if("["===s&&t.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1)&&!r.image)return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),h(r);if("]"===s&&r.linkText&&t.match(/\(.*?\)| ?\[.*?\]/,!1)){n.highlightFormatting&&(r.formatting="link");var y=h(r);return r.linkText=!1,r.inline=r.f=g,y}if("<"===s&&t.match(/^(https?
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=u(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,u,c,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")},c=0;c<s.align.length;c++)/^ *-+: *$/.test(s.align[c])?s.align[c]="right":/^ *:-+: *$/.test(s.align[c])?s.align[c]="center":/^ *:-+ *$/.test(s.align[c])?s.align[c]="left":s.align[c]=null;for(c=0;c<s.cells.length;c++)s.cells[c]=s.cells[c].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"}),o=o[0].replace(/^ *> ?/gm,""),this.token(o,t,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),a=o[2],this.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(this.rules.item),r=!1,f=o.length,c=0;c<f;c++)s=o[c],u=s.length,s=s.replace(/^ *([*+-]|\d+\.) +/,""),~s.indexOf("\n ")&&(u-=s.length,s=this.options.pedantic?s.replace(/^ {1,4}/gm,""):s.replace(new RegExp("^ {1,"+u+"}","gm"),"")),this.options.smartLists&&c!==f-1&&(l=d.bullet.exec(o[c+1])[0],a===l||a.length>1&&l.length>1||(e=o.slice(c+1).join("\n")+e,c=f-1)),i=r||/\n\n(?!\s*$)/.test(s),c!==f-1&&(r="\n"===s.charAt(s.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(s,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!n&&t&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(t&&(o=this.rules.table.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")},c=0;c<s.align.length;c++)/^ *-+: *$/.test(s.align[c])?s.align[c]="right":/^ *:-+: *$/.test(s.align[c])?s.align[c]="center":/^ *:-+ *$/.test(s.align[c])?s.align[c]="left":s.align[c]=null;for(c=0;c<s.cells.length;c++)s.cells[c]=s.cells[c].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(s)}else if(t&&(o=this.rules.paragraph.exec(e)))e=e.substring(o[0].length),this.tokens.push({type:"paragraph",text:"\n"===o[1].charAt(o[1].length-1)?o[1].slice(0,-1):o[1]});else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),this.tokens.
}e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=H({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=H({},X,e.insertTexts||{}),e.promptTexts=Z,e.blockStyles=H({},J,e.blockStyles||{}),e.shortcuts=H({},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 _(){if("object"!=typeof localStorage)return!1;try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}var F=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 z=e("codemirror-spell-checker"),j=e("marked"),U=/Mac/.test(navigator.platform),q={toggleBold:u,toggleItalic:c,drawLink:k,toggleHeadingSmaller:p,toggleHeadingBigger:m,drawImage:S,toggleBlockquote:d,toggleOrderedList:b,toggleUnorderedList:x,toggleCodeBlock:h,togglePreview:N,toggleStrikethrough:f,toggleHeading1:g,toggleHeading2:v,toggleHeading3:y,cleanBlock:w,drawTable:C,drawHorizontalRule:L,undo:T,redo:M,toggleSideBySide:A,toggleFullScreen:s},G={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Y=function(e){for(var t in q)if(q[t]===e)return t;return null},$=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.use