Files
leanote/public/md/main-v2.min.js

6 lines
211 KiB
JavaScript
Raw Normal View History

2015-11-28 15:32:56 +08:00
(function(){var e=this,n=e._,t={},r=Array.prototype,a=Object.prototype,i=Function.prototype,o=r.push,s=r.slice,l=r.concat,c=a.toString,u=a.hasOwnProperty,d=r.forEach,p=r.map,f=r.reduce,m=r.reduceRight,g=r.filter,h=r.every,v=r.some,b=r.indexOf,w=r.lastIndexOf,x=Array.isArray,y=Object.keys,C=i.bind,k=function(e){return e instanceof k?e:this instanceof k?void(this._wrapped=e):new k(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=k),exports._=k):e._=k,k.VERSION="1.5.1";var S=k.each=k.forEach=function(e,n,r){if(null!=e)if(d&&e.forEach===d)e.forEach(n,r);else if(e.length===+e.length){for(var a=0,i=e.length;i>a;a++)if(n.call(r,e[a],a,e)===t)return}else for(var o in e)if(k.has(e,o)&&n.call(r,e[o],o,e)===t)return};k.map=k.collect=function(e,n,t){var r=[];return null==e?r:p&&e.map===p?e.map(n,t):(S(e,function(e,a,i){r.push(n.call(t,e,a,i))}),r)};var _="Reduce of empty array with no initial value";k.reduce=k.foldl=k.inject=function(e,n,t,r){var a=arguments.length>2;if(null==e&&(e=[]),f&&e.reduce===f)return r&&(n=k.bind(n,r)),a?e.reduce(n,t):e.reduce(n);if(S(e,function(e,i,o){a?t=n.call(r,t,e,i,o):(t=e,a=!0)}),!a)throw new TypeError(_);return t},k.reduceRight=k.foldr=function(e,n,t,r){var a=arguments.length>2;if(null==e&&(e=[]),m&&e.reduceRight===m)return r&&(n=k.bind(n,r)),a?e.reduceRight(n,t):e.reduceRight(n);var i=e.length;if(i!==+i){var o=k.keys(e);i=o.length}if(S(e,function(s,l,c){l=o?o[--i]:--i,a?t=n.call(r,t,e[l],l,c):(t=e[l],a=!0)}),!a)throw new TypeError(_);return t},k.find=k.detect=function(e,n,t){var r;return E(e,function(e,a,i){return n.call(t,e,a,i)?(r=e,!0):void 0}),r},k.filter=k.select=function(e,n,t){var r=[];return null==e?r:g&&e.filter===g?e.filter(n,t):(S(e,function(e,a,i){n.call(t,e,a,i)&&r.push(e)}),r)},k.reject=function(e,n,t){return k.filter(e,function(e,r,a){return!n.call(t,e,r,a)},t)},k.every=k.all=function(e,n,r){n||(n=k.identity);var a=!0;return null==e?a:h&&e.every===h?e.every(n,r):(S(e,function(e,i,o){return(a=a&&n.call(r,e,i,o))?void 0:t}),!!a)};var E=k.some=k.any=function(e,n,r){n||(n=k.identity);var a=!1;return null==e?a:v&&e.some===v?e.some(n,r):(S(e,function(e,i,o){return a||(a=n.call(r,e,i,o))?t:void 0}),!!a)};k.contains=k.include=function(e,n){return null==e?!1:b&&e.indexOf===b?-1!=e.indexOf(n):E(e,function(e){return e===n})},k.invoke=function(e,n){var t=s.call(arguments,2),r=k.isFunction(n);return k.map(e,function(e){return(r?n:e[n]).apply(e,t)})},k.pluck=function(e,n){return k.map(e,function(e){return e[n]})},k.where=function(e,n,t){return k.isEmpty(n)?t?void 0:[]:k[t?"find":"filter"](e,function(e){for(var t in n)if(n[t]!==e[t])return!1;return!0})},k.findWhere=function(e,n){return k.where(e,n,!0)},k.max=function(e,n,t){if(!n&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!n&&k.isEmpty(e))return-1/0;var r={computed:-1/0,value:-1/0};return S(e,function(e,a,i){var o=n?n.call(t,e,a,i):e;o>r.computed&&(r={value:e,computed:o})}),r.value},k.min=function(e,n,t){if(!n&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!n&&k.isEmpty(e))return 1/0;var r={computed:1/0,value:1/0};return S(e,function(e,a,i){var o=n?n.call(t,e,a,i):e;o<r.computed&&(r={value:e,computed:o})}),r.value},k.shuffle=function(e){var n,t=0,r=[];return S(e,function(e){n=k.random(t++),r[t-1]=r[n],r[n]=e}),r};var T=function(e){return k.isFunction(e)?e:function(n){return n[e]}};k.sortBy=function(e,n,t){var r=T(n);return k.pluck(k.map(e,function(e,n,a){return{value:e,index:n,criteria:r.call(t,e,n,a)}}).sort(function(e,n){var t=e.criteria,r=n.criteria;if(t!==r){if(t>r||void 0===t)return 1;if(r>t||void 0===r)return-1}return e.index<n.index?-1:1}),"value")};var I=function(e,n,t,r){var a={},i=T(null==n?k.identity:n);return S(e,function(n,o){var s=i.call(t,n,o,e);r(a,s,n)}),a};k.groupBy=function(e,n,t){return I(e,n,t,function(e,n,t){(k.has(e,n)?e[n]:e[n]=[]).push(t)})},k.countBy=function(e,n,t){return I(e,n,t,function(e,n){k.has(e,n)||(e[n]=0),e[n]++})},k.sortedIndex=function(e,n,t,r){t=null==t?k.identity:T(t);for(var a=t.call(r,n),i=0,o
}(e),function(e){if(!e.addUnicodeData)throw new ReferenceError("Unicode Base must be loaded before Unicode Categories");e.addUnicodeData([{name:"C",alias:"Other",isBmpLast:!0,bmp:"\x00--Ÿ­͸͹Ϳ-΃΋΍΢Ԩ-԰՗՘ՠֈ֋-֎֐׈-׏׫-ׯ׵-؅؜؝۝܎܏݋݌޲-޿߻-߿࠮࠯࠿࡜࡝࡟-࢟ࢡࢭ-ࣣࣿॸঀ঄঍঎঑঒঩঱঳-঵঺঻৅৆৉৊৏-৖৘-৛৞৤৥ৼ-਀਄਋-਎਑਒਩਱਴਷਺਻਽੃-੆੉੊੎-੐੒-੘੝੟-੥੶-઀઄઎઒઩઱઴઺઻૆૊૎૏૑-૟૤૥૲-଀଄଍଎଑଒଩଱଴଺଻୅୆୉୊୎-୕୘-୛୞୤୥୸-஁஄஋-஍஑஖-஘஛஝஠-஢஥-஧஫-஭஺-஽௃-௅௉௎௏௑-௖௘-௥௻-ఀఄ఍఑఩ఴ఺-఼౅౉౎-౔౗ౚ-౟౤౥౰-౷ಀಁ಄಍಑಩಴಺಻೅೉೎-೔೗-ೝ೟೤೥೰ೳ-ഁഄ഍഑഻഼൅൉൏-ൖ൘-ൟ൤൥൶-൸඀ඁ඄඗-඙඲඼඾඿෇-෉෋-෎෕෗෠-෱෵-฀฻-฾๜-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇໎໏໚໛໠-໿཈཭-཰྘྽࿍࿛-࿿჆჈-჌჎჏቉቎቏቗቙቞቟኉኎኏኱኶኷኿዁዆዇዗጑጖጗፛፜፽-፿᎚-᎟Ᏽ-᏿᚝-᚟ᛱ-᛿ᜍ᜕-ᜟ᜷-᜿᝔-᝟᝭᝱᝴-᝿៞៟៪-៯៺-៿᠏᠚-᠟ᡸ-᡿᢫-᢯᣶-᣿ᤝ-᤟᤬-᤯᤼-᤿᥁-᥃᥮᥯᥵-᥿᦬-᦯᧊-᧏᧛-᧝᨜᨝᩟᩽᩾᪊-᪏᪚-᪟᪮-᫿ᭌ-᭏᭽-᭿᯴-᯻᰸-᰺᱊-᱌ᲀ-Ჿ᳈-᳏᳷-᳿ᷧ-᷻἖἗἞἟὆὇὎὏὘὚὜὞὾὿᾵῅῔῕῜῰῱῵῿​---⁲⁳₏₝-₟₻-⃏⃱-⃿↊-↏⏴-⏿␧-␿⑋-⑟✀⭍-⭏⭚-⯿Ⱟⱟ⳴-⳸⴦⴨-⴬⴮⴯⵨-⵮⵱-⵾⶗-⶟⶧⶯⶷⶿⷇⷏⷗⷟⸼-⹿⺚⻴-⻿⿖-⿯⿼-⿿぀゗゘㄀-㄄ㄮ-㄰㆏ㆻ-ㆿ㇤-㇯㈟㋿䶶-䶿鿍-鿿꒍-꒏꓇-꓏꘬-꘿Ꚙ-ꚞ꛸-꛿ꞏꞔ--ꟷ꠬-꠯꠺-꠿꡸-꡿ꣅ-꣍꣚-꣟꣼-ꣿ꥔-꥞꥽-꥿꧎꧚-꧝ꧠ-꧿꨷-꨿꩎꩏꩚꩛ꩼ-ꩿ꫃-꫚꫷-꬀꬇꬈꬏꬐꬗-꬟꬧꬯-ꮿ꯮꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬷﬽﬿﭂﭅﯂-﯒﵀-﵏﶐﶑﷈-﷯﷾﷿︚-︟︧-︯﹓﹧﹬-﹯﹵﻽-＀﾿-￁￈￉￐￑￘￙￝-￟￧￯-￾￿",astral:"<22>[<5B>-<2D>]|<7C>[<5B>-<2D><>-<2D>]|<7C>[<5B>-<2D><>-<2D><><EFBFBD>-<2D><>-<2D><>-<2D><><EFBFBD>-<2D><>-<2D><>-<2D>]|<7C>[<5B><><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><><EFBFBD>-<2D><><EFBFBD><EFBFBD>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><><EFBFBD><EFBFBD>-<2D><>-<2D>]|<7C>[<5B>-<2D>]|<7C>[<5B>-<2D><>-<2D><>-<2D><>-<2D>]|<7C>[<5B>-<2D>]|<7C>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><><EFBFBD>-<2D><>-<2D><><EFBFBD>-<2D><>-<2D>]|<7C>[<5B>-<2D>]|<7C>[<5B>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD>-<2D><>-<2D>]|<7C>[<5B>-<2D>]|<7C>[<5B>-<2D><>-<2D>]|<7C>[<5B>-<2D><>-<2D>]|<7C>[<5B>-<2D>]|[<5B><><EFBFBD><EFBFBD><EFBFBD>-<2D><>-<2D><>-<2D><>-<2D><><EFBFBD><EFBFBD>-<2D><>-<2D><>-<2D>][<5B>-<2D>]|<7C>[<5B><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D>]|<7C>[<5B>-<2D><>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><>-<2D><><EFBFBD>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><>-<2D><><EFBFBD>-<2D><>-<2D><><EFBFBD>-<2D><>-<2D>]|<7C>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]|<7C>[<5B>-<2D>]|<7C>[<5B>-<2D><><EFBFBD><EFBFBD>-<2D><>-<2D><>-<2D><>-<2D><>-<2D>]|<7C>[<5B><><EFBFBD>-<2D>]|<7C>[<5B>-<2D><>-<2D><>-<2D>]|<7C>[<5B>-<2D>]"},{name:"Cc",alias:"Control",bmp:"\x00--Ÿ"},{name:"Cf",alias:"Format",bmp:"­؀-؄۝܏​-----",astral:"<22>[<5B><>-<2D>]|<7C>[<5B>-<2D>]|𑂽"},{name:"Cn",alias:"Unassigned",bmp:"͸͹Ϳ-΃΋΍΢Ԩ-԰՗՘ՠֈ֋-֎֐׈-׏׫-ׯ׵-׿؅؜؝܎݋݌޲-޿߻-߿-ࢡࢭ-ॸঀ-------------------------------<EFBFBD><EFBFBD>
var M;!I&&(M=r(t))&&C.test(M.tagName)&&(I=M.className.match(b)),I&&(I=I[1])}var $;if(y.test(t.tagName))$=1;else{var L=t.currentStyle,A=s.defaultView,R=L?L.whiteSpace:A&&A.getComputedStyle?A.getComputedStyle(t,null).getPropertyValue("white-space"):0;$=R&&"pre"===R.substring(0,3)}var N=i.linenums;(N="true"===N||+N)||(N=m.match(/\blinenums\b(?::(\d+))?/),N=N?N[1]&&N[1].length?+N[1]:!0:!1),N&&o(t,N,$),h={langExtension:I,sourceNode:t,numberLines:N,pre:$},u(h)}}}v<c.length?setTimeout(a,250):"function"==typeof e&&e()}for(var i=n||document.body,s=i.ownerDocument||document,l=[t("pre"),t("code"),t("xmp")],c=[],d=0;d<l.length;++d)for(var p=0,m=l[d].length;m>p;++p)c.push(l[d][p]);l=null;var g=Date;g.now||(g={now:function(){return+new Date}});var h,v=0,b=/\blang(?:uage)?-([\w.]+)(?!\S)/,w=/\bprettyprint\b/,x=/\bprettyprinted\b/,y=/pre|xmp/i,C=/^code$/i,k=/^(?:pre|code|xmp)$/i,S={};a()}var f=window,m=["break,continue,do,else,for,if,return,while"],g=[m,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],h=[g,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[h,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],b=[h,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[b,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],x="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[h,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],C="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",k=[m,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],S=[m,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],_=[m,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],E=[m,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[v,w,y,C,k,S,E],I=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,M="str",$="kwd",L="com",A="typ",R="lit",N="pun",P="pln",B="tag",D="dec",O="src",H="atn",F="atv",j="nocode",q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*",U=/\S/,K=i({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),z={};l(K,["default-code"]),l(a([],[[P,/^[^<?]+/],[D,/^<!\w[^>]*(?:>|$)/],[L,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[N,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),l(a([[P,/^[\s]+/,null," \r\n"],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[B,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[H,/^(?!style[\s=]|on)[a
2016-04-16 14:51:54 +08:00
},w.insertLink=function(e,n,t,r,a){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);var i;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return void this.addLinkDef(e,null);var s=function(t){i.parentNode.removeChild(i),null!==t&&(e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),e.startTag=a?"![":"[",e.endTag="]("+o(t)+")",e.selection=r),n()};return i=c.createBackground(),s(t),!0}e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",this.addLinkDef(e,null)},w.doLinkOrImage=function(e,n,t){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\(.*?\))?/);var r;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return void this.addLinkDef(e,null);var a=this,i=function(i,s){if(r.parentNode.removeChild(r),null!==i&&(e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),e.startTag=t?"![":"[",e.endTag="]("+o(i)+")",!e.selection)){var l="";l=s?s:a.getString(t?"imagedescription":"linkdescription"),e.selection=l}n()};return r=c.createBackground(),t?this.hooks.insertImageDialog(i)||c.prompt(this.getString("imagedialog"),v,i):this.hooks.insertLinkDialog(i)||c.prompt(this.getString("linkdialog"),b,i),!0}e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",this.addLinkDef(e,null)},w.doAutoindent=function(e){var n=this,t=!1;e.before=e.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"),e.selection||/^[ \t]*(?:\n|$)/.test(e.after)||(e.after=e.after.replace(/^[^\n]*/,function(n){return e.selection=n,""}),t=!0),/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(e.before)&&n.doList&&n.doList(e),/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(e.before)&&n.doBlockquote&&n.doBlockquote(e),/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&n.doCode&&n.doCode(e),t&&(e.after=e.selection+e.after,e.selection="")},w.doBlockquote=function(e){e.selection=e.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(n,t,r,a){return e.before+=t,e.after=a+e.after,r}),e.before=e.before.replace(/(>[ \t]*)$/,function(n,t){return e.selection=t+e.selection,""}),e.selection=e.selection.replace(/^(\s|>)+$/,""),e.selection=e.selection||this.getString("quoteexample");var n,t="",r="";if(e.before){for(var a=e.before.replace(/\n$/,"").split("\n"),i=!1,o=0;o<a.length;o++){var s=!1;n=a[o],i=i&&n.length>0,/^>/.test(n)?(s=!0,!i&&n.length>1&&(i=!0)):s=/^[ \t]*$/.test(n)?!0:i,s?t+=n+"\n":(r+=t+n,t="\n")}/(^|\n)>/.test(t)||(r+=t,t="")}e.startTag=t,e.before=r;var l=function(n){var t=n?"> ":"";e.startTag&&(e.startTag=e.startTag.replace(/\n((>|\s)*)\n$/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"})),e.endTag&&(e.endTag=e.endTag.replace(/^\n((>|\s)*)\n/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"}))};/^(?![ ]{0,3}>)/m.test(e.selection)?(this.wrap(e,f.lineLength-2),e.selection=e.selection.replace(/^/gm,"> "),l(!0),e.skipLines()):(e.selection=e.selection.replace(/^[ ]{0,3}> ?/gm,""),this.unwrap(e),l(!1),!/^(\n|^)[ ]{0,3}>/.test(e.selection)&&e.startTag&&(e.startTag=e.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(e.selection)&&e.endTag&&(e.endTag=e.endTag.replace(/^\n{0,2}/,"\n\n"))),e.selection=this.hooks.postBlockquoteCreation(e.selection),/\n/.test(e.selection)||(e.selection=e.selection.replace(/^(> *)/,function(n,t){return e.startTag+=t,""}))},w.doCode=function(e){var n=/\S[ ]*$/.test(e.before),t=/^[ ]*\S/.test(e.after);if(!t&&!n||/\n/.test(e.selection)){e.before=e.before.replace(/[ ]{4}$/,function(n){return e.selection=n+e.selection,""});var r=1,a=1;/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&(r=0),/^\n(\t|[ ]{4,})/.test(e.after)&&(a=0),e.skipLines(r,a),e.selection?/^[ ]{0,3}\S/m.test(e.selection)?/\n/.test(e.selection)?e.selection=e.selection.replace(/^/gm," "):e.before+=" ":e.selection=e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm,""):(e.startTag=
});if(void 0!==i){var o=(n-i.startOffset)/(i.height||1),s=r[a];return s.startOffset+s.height*o}}var r,a=new n("scrollLink","Scroll Link",!0,!0);a.onAceCreated=function(e){r=e};var i;a.onSectionsCreated=function(e){i=e};var o=0;a.onMarkdownTrim=function(e){o=e};var s,l,c,u,d,p=[],f=[],m=e.debounce(function(){function n(e){var n=g;if(void 0!==e){var t=document.createTextNode(e);l.empty().append(t),n+=l.prop("scrollHeight")}var r=a+n;p.push({startOffset:a,endOffset:r,height:n}),a=r}p=[];var t=0,a=0,m=o,g=0;if(window.lightMode){l.innerWidth(s.innerWidth()),e.each(i,function(e,t){var r=e.text;t!==i.length-1?0===r.length&&(r=void 0):/\n$/.test(r)&&(r+="\n"),n(r)});var h=e.last(p).endOffset,v=s[0].scrollHeight,b=v/h;p=e.map(p,function(e){return{startOffset:e.startOffset*b,endOffset:e.endOffset*b,height:e.height*b}})}else e.each(i,function(e){t+=e.text.length+m,m=0;var n=r.session.doc.indexToPosition(t),i=r.session.documentToScreenPosition(n.row,n.column),o=i.row*r.renderer.lineHeight,s=o-a;p.push({startOffset:a,endOffset:o,height:s}),a=o});f=[];var w,y=c.scrollTop();c.find(".preview-content > .se-section-delimiter").each(function(){if(void 0===w)return void(w=0);var e=$(this),n=e.position().top+y;f.push({startOffset:w,endOffset:n,height:n-w}),w=n});var C=c.prop("scrollHeight");f.push({startOffset:w,endOffset:C,height:C-w}),u=-10,d=-10,x()},500),g=!1,h=!1,v=!1,b=!1,w=$("<div>"),x=e.throttle(function(){if(0===p.length||p.length!==f.length)return void x();var n=window.lightMode?s.scrollTop():r.renderer.getScrollTop();0>n&&(n=0);var a,i=c.scrollTop();if(g===!0){if(Math.abs(n-u)<=9)return;if(g=!1,u=n,a=t(n,p,f),a=e.min([a,c.prop("scrollHeight")-c.outerHeight()]),Math.abs(a-i)<=9)return void(d=i);w.stop("scrollLinkFx",!0).css("value",0).animate({value:a-i},{easing:"linear",duration:200,queue:"scrollLinkFx",step:function(e){b=!0,d=i+e,c.scrollTop(d)},done:function(){e.defer(function(){b=!1})}}).dequeue("scrollLinkFx")}else if(h===!0){if(Math.abs(i-d)<=9)return;if(h=!1,d=i,a=t(i,f,p),window.lightMode?a=e.min([a,s.prop("scrollHeight")-s.outerHeight()]):(a=e.min([a,r.session.getScreenLength()*r.renderer.lineHeight+r.renderer.scrollMargin.bottom-r.renderer.$size.scrollerHeight]),0>a&&(a=0)),Math.abs(a-n)<=9)return void(u=n);w.stop("scrollLinkFx",!0).css("value",0).animate({value:a-n},{easing:"linear",duration:200,queue:"scrollLinkFx",step:function(e){v=!0,u=n+e,window.lightMode||r.session.setScrollTop(u),window.lightMode&&s.scrollTop(u)},done:function(){e.defer(function(){v=!1})}}).dequeue("scrollLinkFx")}},100);a.onLayoutResize=function(){g=!0,m()},a.onFileClosed=function(){p=[]};var y=function(e){c=$(".preview-container"),s=$("#wmd-input"),l=$(".textarea-helper"),c.scroll(function(){b===!1&&C===!1&&(h=!0,g=!1,x()),C=!1});var n=function(){v===!1&&(g=!0,h=!1,x())},t=e?500:0;setTimeout(function(){window.lightMode?s.scroll(n):r.session.on("changeScrollTop",n)},t)};a.onToggleMode=function(){c=$(".preview-container"),s=$("#wmd-input"),l=$(".textarea-helper"),m(),y(!0)};var C=!1;a.onReady=function(){c=$(".preview-container"),s=$("#wmd-input"),l=$(".textarea-helper"),y(),$(".extension-preview-buttons .table-of-contents, #preview-contents").on("click","a",function(e){var n=this.hash;if(n){e.preventDefault();var a=$("#preview-contents "+n);if(a.length){var i=a[0].getBoundingClientRect().top-c.get(0).getBoundingClientRect().top+c.scrollTop(),o=t(i,f,p);c.scrollTop(i),window.lightMode||r.session.setScrollTop(o),window.lightMode&&s.scrollTop(o)}}})};var k;return a.onPagedownConfigure=function(e){k=$("#preview-contents"),e.getConverter().hooks.chain("postConversion",function(e){return k.height(k.height()),e})},a.onPreviewFinished=function(){var e=k.height();k.height("auto");var n=k.height();g=!0,e>n&&(C=!0),m()},a}),define("extensions/htmlSanitizer",["underscore","utils","classes/Extension"],function(e,n,t){function r(e){var n,t={},r=e.split(",");for(n=0;n<r.length;n++)t[r[n]]=!0;return t}function a(e,n){function t(e,t,a,o){if(t=t&&t.toLowerCase(),k[t])for(;c.last()&&S[c.last()];)r("",c.last());C[t]&&c.last()==t&&r("",t),o=w[t]||!!o,o||c.push(t);var
var p=d.createElement("input");p.type="button",p.onclick=function(){return o(!1)},p.value="OK",u=p.style,u.margin="10px",u.display="inline",u.width="7em";var f=d.createElement("input");f.type="button",f.onclick=function(){return o(!0)},f.value="Cancel",u=f.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(p),s.appendChild(f),l.addEvent(d.body,"keydown",i),r.style.top="50%",r.style.left="50%",r.style.display="block",g.isIE_5or6&&(r.style.position="absolute",r.style.top=d.documentElement.scrollTop+200+"px",r.style.left="50%"),d.body.appendChild(r),r.style.marginTop=-(c.getHeight(r)/2)+"px",r.style.marginLeft=-(c.getWidth(r)/2)+"px"};setTimeout(function(){s();var e=n.length;if(void 0!==a.selectionStart)a.selectionStart=0,a.selectionEnd=e;else if(a.createTextRange){var t=a.createTextRange();t.collapse(!1),t.moveStart("character",-e),t.moveEnd("character",e),t.select()}a.focus()},0)};var w=o.prototype;w.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",w.unwrap=function(e){var n=new p("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");e.selection=e.selection.replace(n,"$1 $2")},w.wrap=function(e,n){this.unwrap(e);var t=new p("(.{1,"+n+"})( +|$\\n?)","gm"),r=this;e.selection=e.selection.replace(t,function(e,n){return new p("^"+r.prefixes,"").test(e)?e:n+"\n"}),e.selection=e.selection.replace(/\s+$/,"")},w.doBold=function(e,n){return this.doBorI(e,n,2,this.getString("boldexample"))},w.doItalic=function(e,n){return this.doBorI(e,n,1,this.getString("italicexample"))},w.doBorI=function(e,n,t,r){e.trimWhitespace(),e.selection=e.selection.replace(/\n{2,}/g,"\n");var a=/(\**$)/.exec(e.before)[0],i=/(^\**)/.exec(e.after)[0],o=Math.min(a.length,i.length);if(o>=t&&(2!=o||1!=t))e.before=e.before.replace(p("[*]{"+t+"}$",""),""),e.after=e.after.replace(p("^[*]{"+t+"}",""),"");else if(!e.selection&&i){e.after=e.after.replace(/^([*_]*)/,""),e.before=e.before.replace(/(\s?)$/,"");var s=p.$1;e.before=e.before+i+s}else{e.selection||i||(e.selection=r);var l=1>=t?"*":"**";e.before=e.before+l,e.after=l+e.after}},w.stripLinkDefs=function(e,n){return e=e.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(e,t,r,a,i){return n[t]=e.replace(/\s*$/,""),a?(n[t]=e.replace(/["(](.+?)[")]$/,""),a+i):""})},w.addLinkDef=function(e,n){var t=0,r={};e.before=this.stripLinkDefs(e.before,r),e.selection=this.stripLinkDefs(e.selection,r),e.after=this.stripLinkDefs(e.after,r);var a="",i=/(\[)((?:\[[^\]]*\]|[^\[\]])*)(\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g,o=function(e){t++,e=e.replace(/^[ ]{0,3}\[(\d+)\]:/," ["+t+"]:"),a+="\n"+e},s=function(e,n,a,l,c,u){return a=a.replace(i,s),r[c]?(o(r[c]),n+a+l+t+u):e};e.before=e.before.replace(i,s),n?o(n):e.selection=e.selection.replace(i,s);var l=t;return e.after=e.after.replace(i,s),e.after&&(e.after=e.after.replace(/\n*$/,"")),e.after||(e.selection=e.selection.replace(/\n*$/,"")),e.after+="\n\n"+a,l},w.insertLink=function(e,n,t,r,a){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);var i;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return void this.addLinkDef(e,null);var o=function(t){i.parentNode.removeChild(i),null!==t&&(e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),e.startTag=a?"![":"[",e.endTag="]("+s(t)+")",e.selection=r),n()};return i=u.createBackground(),o(t),!0}e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",this.addLinkDef(e,null)},w.doLinkOrImage=function(e,n,t){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\(.*?\))?/);var r;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return void this.addLinkDef(e,null);var a=this,i=function(i,o){if(r.parentNode.removeChild(r),null!==i&&(e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),e.startTag=t?"![":"[",e.endTag="]("+s(i)+")",!e.selection)){var l="";l=o?o:a.getString(t?