(function(e){function t(t){for(var o,a,s=t[0],l=t[1],c=t[2],d=0,f=[];d-1&&s>-1&&s>a&&(i=i.substr(0,a)+i.substring(a+r.commentStart.length,s)+i.substr(s+r.commentEnd.length)),o.replaceRange(i,t,n)}}))})),b.a.defineExtension("autoIndentRange",(function(e,t){var n=this;this.operation((function(){for(var o=e.line;o<=t.line;o++)n.indentLine(o,"smart")}))})),b.a.defineExtension("autoFormatRange",(function(e,t){var n=this,o=n.getMode(),r=n.getRange(e,t).split("\n"),i=b.a.copyState(o,n.getTokenAt(e).state),a=n.getOption("tabSize"),s="",l=0,c=0==e.ch;function u(){s+="\n",c=!0,++l}for(var d=0;d0}));i=r(i);var a=e.substring(0,t).split(",").map((function(e){return e.trim()}));a.forEach((function(e){o[e]||(o[e]={}),Object.keys(i).forEach((function(t){o[e][t]=i[t]}))})),e=e.slice(n+1).trim()};while(e.length>0&&-1!==e.indexOf("{")&&-1!==e.indexOf("}"))r();return o}function D(e,t){var n=e.getValue(0);n?localStorage.setItem(t,n):localStorage.removeItem(t)}function L(e){return/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(e.name)?e.size>5242880&&"由于公众号限制,图片大小不能超过 5.0M":"请上传 JPG/PNG/GIF 格式的图片"}function B(e){var t=T.a.format(e,{parser:"markdown",plugins:[N.a]});return t}var G=n("466b"),V=n.n(G);function q(){for(var e=document.getElementById("output"),t=e.getElementsByTagName("img"),n=0;n",triples:"",explode:"[]{}"},n=e.Pos;function o(e,n){return"pairs"==n&&"string"==typeof e?e:"object"==Object(ve["a"])(e)&&null!=e[n]?e[n]:t[n]}e.defineOption("autoCloseBrackets",!1,(function(t,n,a){a&&a!=e.Init&&(t.removeKeyMap(r),t.state.closeBrackets=null),n&&(i(o(n,"pairs")),t.state.closeBrackets=n,t.addKeyMap(r))}));var r={Backspace:l,Enter:c};function i(e){for(var t=0;t=0;l--){var u=a[l].head;t.replaceRange("",n(u.line,u.ch-1),n(u.line,u.ch+1),"+delete")}}function c(t){var n=s(t),r=n&&o(n,"explode");if(!r||t.getOption("disableInput"))return e.Pass;for(var i=t.listSelections(),a=0;a0;return{anchor:new n(t.anchor.line,t.anchor.ch+(o?-1:1)),head:new n(t.head.line,t.head.ch+(o?1:-1))}}function d(t,r){var i=s(t);if(!i||t.getOption("disableInput"))return e.Pass;var a=o(i,"pairs"),l=a.indexOf(r);if(-1==l)return e.Pass;for(var c,d=o(i,"closeBefore"),f=o(i,"triples"),g=a.charAt(l+1)==r,h=t.listSelections(),m=l%2==0,b=0;b1&&f.indexOf(r)>=0&&t.getRange(n(x.line,x.ch-2),x)==r+r){if(x.ch>2&&/\bstring/.test(t.getTokenTypeAt(n(x.line,x.ch-2))))return e.Pass;v="addFour"}else if(g){var C=0==x.ch?" ":t.getRange(n(x.line,x.ch-1),x);if(e.isWordChar(w)||C==r||e.isWordChar(C))return e.Pass;v="both"}else{if(!m||!(0===w.length||/\s/.test(w)||d.indexOf(w)>-1))return e.Pass;v="both"}else v=g&&p(t,x)?"both":f.indexOf(r)>=0&&t.getRange(x,n(x.line,x.ch+3))==r+r+r?"skipThree":"skip";if(c){if(c!=v)return e.Pass}else c=v}var k=l%2?a.charAt(l-1):r,S=l%2?r:a.charAt(l+1);t.operation((function(){if("skip"==c)t.execCommand("goCharRight");else if("skipThree"==c)for(var e=0;e<3;e++)t.execCommand("goCharRight");else if("surround"==c){var n=t.getSelections();for(e=0;e=65&&t.keyCode<=90||189===t.keyCode)&&e.showHint(t)})),this.cssEditor.on("update",(function(t){e.cssChanged(),D(e.cssEditor,"__css_content")}))},cssChanged:function(){var e=I(this.cssEditor.getValue(0)),t=F(this.currentSize.replace("px",""));t=M(e,this.currentColor,t),this.setWxRendererOptions({theme:t}),this.onEditorRefresh()},onTextareaChange:function(){console.log("change")},uploaded:function(e,t,n){if(e)if(e.success){var o=this.editor.getCursor(),r=e.data,i="![](".concat(r,")");this.editor.replaceSelection("\n".concat(i,"\n"),o),this.$message({showClose:!0,message:"图片插入成功",type:"success"}),this.onEditorRefresh()}else this.$message({showClose:!0,message:e.message,type:"error"});else this.$message({showClose:!0,message:"上传图片未知异常",type:"error"})},leftAndRightScroll:function(){xe()("#preview").on("scroll",(function e(){clearTimeout(this.timeout);var t=xe()(this),n=xe()(t.is("#preview")?"div.CodeMirror-scroll":"#preview");n.off("scroll");var o=t[0],r=n[0],i=o.scrollTop/(o.scrollHeight-o.offsetHeight),a=i*(r.scrollHeight-r.offsetHeight);r.scrollTo(0,a),this.timeout=setTimeout((function(){n.on("scroll",e)}),100)}))},onEditorRefresh:function(){this.editorRefresh(),setTimeout((function(){return PR.prettyPrint()}),0)},endCopy:function(){var e=this;this.backLight=!1,setTimeout((function(){e.isCoping=!1}),800)}},Object(Q["b"])(["initEditorState","initEditorEntity","setWxRendererOptions","editorRefresh","initCssEditorEntity"])),mounted:function(){this.leftAndRightScroll(),setTimeout((function(){PR.prettyPrint()}),300)}},Ce=we,ke=(n("322d"),Object(u["a"])(Ce,p,g,!1,null,"f87082ca",null)),Se=ke.exports,_e={name:"App",components:{Loading:f,CodemirrorEditor:Se},data:function(){return{loading:!0}},mounted:function(){var e=this;setTimeout((function(){e.loading=!1}),200)}},Ee=_e,Oe=Object(u["a"])(Ee,r,i,!1,null,"471dd412",null),Re=Oe.exports,Te=(n("99af"),n("a15b"),n("e0c1")),je=n.n(Te),Ne=function(e){var t=this;this.opts=e;var n=!0,o=[],r=0,i=null,a="Menlo, Operator Mono, Consolas, Monaco, monospace",s=function(e,t){return Object.assign({},e,t)};this.buildTheme=function(e){var n={},o=s(e.BASE,{"font-family":t.opts.fonts,"font-size":t.opts.size}),r=s(o,{});for(var i in e.inline)if(e.inline.hasOwnProperty(i)){var l=e.inline[i];"codespan"===i&&(l["font-family"]=a,l["white-space"]="normal"),n[i]=s(o,l)}for(var c in e.block)if(e.block.hasOwnProperty(c)){var u=e.block[c];"code"===c&&(u["font-family"]=a),n[c]=s(r,u)}return n};var l=function(e,t){var n=[],o=i[e];if(!o)return"";for(var r in o)n.push(r+":"+o[r]);return'style="'.concat(n.join(";")+(t||""),'"')},c=function(e,t){return o.push([++r,e,t]),r};this.buildFootnotes=function(){var e=o.map((function(e){return e[1]===e[2]?'['.concat(e[0],"]: ").concat(e[1],"
"):'['.concat(e[0],"] ").concat(e[1],": ").concat(e[2],"
")}));return"

引用链接

").concat(e.join("\n"),"

")},this.buildAddition=function(){return'\n \n '},this.setOptions=function(e){t.opts=s(t.opts,e)},this.hasFootnotes=function(){return 0!==o.length},this.getRenderer=function(e){o=[],r=0,i=t.buildTheme(t.opts.theme);var a=new je.a.Renderer;return a.heading=function(e,t){switch(t){case 1:return"

").concat(e,"

");case 2:return"

").concat(e,"

");case 3:return"

").concat(e,"

");default:return"

").concat(e,"

")}},a.paragraph=function(e){return-1!=e.indexOf("").concat(e,"

")},a.blockquote=function(e){return e=e.replace(//,"

")),"

").concat(e,"
")},a.code=function(e,t){e=e.replace(//g,">");for(var n=e.split("\n"),o=[],r=[],i=0;i'.concat(a||"
","
")),r.push("
  • ")}var s=t||"";return'\n
    \n
      '.concat(r.join(""),'
    \n
    \n                ').concat(o.join(""),"\n            
    \n
    \n ")},a.codespan=function(e,t){return"").concat(e,"")},a.listitem=function(e){return"<%s/>').concat(e,"")},a.list=function(e,t,n){e=e.replace(/<\/*p.*?>/g,"");var o=e.split("<%s/>");if(!t)return e=o.join("•"),"

    ").concat(e,"

    ");e=o[0];for(var r=1;r").concat(e,"

    ")},a.image=function(e,t,o){var r="";o&&(r="
    ").concat(o,"
    "));var i=l("figure"),a=l(n?"image":"image_org");return"
    ').concat(o,'').concat(r,"
    ")},a.link=function(t,n,o){if(0===t.indexOf("https://mp.weixin.qq.com"))return'").concat(o,"");if(t===o)return o;if(e){var r=c(n||o,t);return"").concat(o,"[").concat(r,"]")}return o},a.strong=function(e){return"").concat(e,"")},a.em=function(e){return''.concat(e,"")},a.table=function(e,t){return'
    ").concat(e,"").concat(t,"
    ")},a.tablecell=function(e,t){return"").concat(e,"")},a.hr=function(){return'
    '},a}},ze=Ne,$e='# 示例文章:Google 搜索的即时自动补全功能究竟是如何“工作”的?\n> Google 搜索**自动补全功能**的强大,相信不少朋友都能感受到,它帮助我们更快地“补全”我们所要输入的搜索关键字。那么,它怎么知道我们要输入什么内容?它又是如何工作的?在这篇文章里,我们一起来看看。\n\n## 使用自动补全\nGoogle 搜索的自动补全功能可以在 Google 搜索应用的大多数位置使用,包括 [Google](https://www.google.com/) 主页、适用于 IOS 和 Android 的 Google 应用,我们只需要在 Google 搜索框上开始键入关键字,就可以看到联想词了。\n\n![](https://imgkr.cn-bj.ufileos.com/17ed83bf-e028-4db2-9503-5a3b4e64deee.gif)\n\n在上图示例中,我们可以看到,输入关键字 `juej`,Google 搜索会联想到“掘金”、“掘金小册”、“绝句”等等,好处就是,我们无须输入完整的关键字即可轻松完成针对这些 topics 的搜索。\n\n谷歌搜索的自动补全功能对于使用移动设备的用户来说特别有用,用户可以轻松在难以键入的小屏幕上完成搜索。当然,对于移动设备用户和台式机用户而言,这都节省了大量的时间。根据 Google 官方报告,自动补全功能可以减少大约 25% 的打字,累积起来,预计每天可以节省 200 多年的打字时间。是的,每天!\n\n> 注意,本文所提到的“**联想词**”与“**预测**”,是同一个意思。\n\n## 基于“预测”而非“建议”\nGoogle 官方将自动补全功能称之为“预测”,而不是“建议”,为什么呢?其实是有充分理由的。自动补全功能是为了**帮助用户完成他们打算进行的搜索**,而不是建议用户要执行什么搜索。\n\n那么,Google 是如何确定这些“预测”的?其实,Google 会根据趋势搜索 [trends](https://trends.google.com/trends/?geo=US) 给到我们这些“预测”。简单来说,哪个热门、哪个搜索频率高,就更可能推给我们。当然,这也与我们当前所处的位置以及我们的搜索历史相关。\n\n另外,这些“预测”也会随着我们键入的关键字的变更而更改。例如,当我们把键入的关键字从 `juej` 更改为 `juex` 时,与“掘金”相关的预测会“消失”,同时,与“觉醒”、“决心”相关联的词会出现。\n\n![](https://imgkr.cn-bj.ufileos.com/5b17dc99-606d-42c1-9f86-e09e88aaa822.gif)\n\n## 为什么看不到某些联想词?\n如果我们在输入某个关键字时看不到联想词,那么表明 Google 的算法可能检测到:\n\n- 这个关键字不是热门字词;\n- 搜索的字词太新了,我们可能需要等待几天或几周才能看到联想词;\n- 这是一个侮辱性或敏感字词,这个搜索字词违反了 Google 的相关政策。更加详细的情况,可以了解 [Google 搜索自动补全政策](https://support.google.com/websearch/answer/7368877)。\n\n## 为什么会看到某些不当的联想词?\nGoogle 拥有专门设计的系统,可以自动捕获不适当的预测结果而不显示出来。然而,Google 每天需要处理数十亿次搜索,这意味着 Google 每天会显示数十亿甚至上百亿条预测。再好的系统,也可能存在缺陷,不正确的预测也可能随时会出现。\n\n我们作为 Google 搜索的用户,如果认定某条预测违反了相关的搜索自动补全政策,可以进行举报反馈,点击右下角“**举报不当的联想查询**”并勾选相关选项即可。\n\n![](https://imgkr.cn-bj.ufileos.com/6ca8185d-12c6-4550-bb4e-e49cfbf56db7.gif)\n\n## 如何实现自动补全算法?\n目前,Google 官方似乎并没有公开搜索自动补全的算法实现,但是业界在这方面已经有了不少研究。\n\n一个好的自动补全器必须是快速的,并且在用户键入下一个字符后立即更新联想词列表。**自动补全器的核心是一个函数,它接受输入的前缀,并搜索以给定前缀开头的词汇或语句列表**。通常来说,只需要返回少量的数目即可。\n\n接下来,我们先从一个简单且低效的实现开始,并在此基础上逐步构建更高效的方法。\n\n### 词汇表实现\n一个**简单粗暴的实现方式**是:顺序查找词汇表,依次检查每个词汇,看它是否以给定的前缀开头。\n\n但是,此方法需要将前缀与每个词汇进行匹配检查,若词汇量较少,这种方式可能勉强行得通。但是,如果词汇量规模较大,效率就太低了。\n\n一个**更好的实现方式是**:让词汇按字典顺序排序。借助二分搜索算法,可以快速搜索有序词汇表中的前缀。由于二分搜索的每一步都会将搜索的范围减半,因此,总的搜索时间与词汇表中单词数量的对数成正比,即时间复杂度是 `O(log N)`。二分搜索的性能很好,但有没有更好的实现呢?当然有,往下看。\n\n### 前缀树实现\n通常来说,许多词汇都以相同的前缀开头,比如 `need`、`nested` 都以 `ne` 开头,`seed`、`speed` 都以 `s` 开头。要是为每个单词分别存储公共前缀似乎很浪费。\n\n![](https://imgkr.cn-bj.ufileos.com/7cc3cf37-040a-420e-8ef9-d05e92c82cfd.png)\n\n前缀树是一种利用公共前缀来加速补全速度的数据结构。前缀树在节点树中排列一组单词,单词沿着从根节点到叶子节点的路径存储,树的层次对应于前缀的字母位置。\n\n前缀的补全是顺着前缀定义的路径来查找的。例如,在上图的前缀树中,前缀 `ne` 对应于从子节点取左边缘 `N` 和唯一边缘 `E` 的路径。然后可以通过继续遍历从 `E` 节点可以达到的所有叶节点来生成补全列表。在图中,`ne` 的补全可以是两个分支:`-ed` 和 `-sted`。如果在数中找不到由前缀定义的路径,则说明词汇表中不包含以该前缀开头的单词。\n\n### 有限状态自动机(DFA)实现\n前缀树可以有效处理公共前缀,但是,对于其他共享词部分,仍会分别存储在每个分支中。比如,后缀 `ed`、`ing`、`tion` 在英文单词中特别常见。在上一个例子中,`e`、`d` 分别存放在了每一个分支上。\n\n有没有一种方法可以更加节省存储空间呢?有的,那就是 DFA。\n\n
    \n
    \n\n在上面的例子中,单词 `need`、`nested`、`seed` 和 `speed` 仅由 9 个节点组成,而上一张图中的前缀树包含了 17 个节点。\n\n可以看出,最小化前缀树 DFA 可以在很大程度上减少数据结构的大小。即使词汇量很大,最小化 DFA 通常也适合在内存中存储,避免昂贵的磁盘访问是实现快速自动补全的关键。\n\n### 一些扩展\n上面介绍了如何利用合理的数据结构实现基本的自动补全功能。这些数据结构可以通过多种方式进行扩展,从而改善用户体验。\n\n通常,满足特定前缀的词汇可能很多,而用户界面上能够显示的却不多,我们更希望能显示最常搜索或者最有价值的词汇。这通常可以通过为词汇表中的每个单词增加一个代表单词值的**权重** `weight`,并且按照权重高低来排序自动补全列表。\n\n- 对于排序后的词汇表来说,在词汇表每个元素上增加 `weight` 属性并不难;\n- 对于前缀树来说,将 `weight` 存储在叶子节点中,也是很简单的一个实现;\n- 对于 `DFA` 来说,则较为复杂。因为一个叶子节点可以通过多条路径到达。一种解决方案是将权重关联到路径而不是叶子节点。\n\n目前有不少开源库都提供了这个功能,比如主流的搜索引擎框架 [Elasticsearch](https://www.elastic.co/products/elasticsearch)、[Solr](https://lucene.apache.org/solr/) 等,基于此,我们可以实现高效而强大的自动补全功能。\n\n#### 推荐阅读\n- [阿里又一个 20k+ stars 开源项目诞生,恭喜 fastjson!](https://mp.weixin.qq.com/s/RNKDCK2KoyeuMeEs6GUrow)\n- [刷掉 90% 候选人的互联网大厂海量数据面试题(附题解 + 方法总结)](https://mp.weixin.qq.com/s/rjGqxUvrEqJNlo09GrT1Dw)\n- [好用!期待已久的文本块功能究竟如何在 Java 13 中发挥作用?](https://mp.weixin.qq.com/s/kalGv5T8AZGxTnLHr2wDsA)\n- [2019 GitHub 开源贡献排行榜新鲜出炉!微软谷歌领头,阿里跻身前 12!](https://mp.weixin.qq.com/s/_q812aGD1b9QvZ2WFI0Qgw)\n\n---\n\n欢迎关注我的公众号“**Doocs开源社区**”,原创技术文章第一时间推送。\n\n
    \n \n
    \n\n',Ae=$e;o["default"].use(Q["a"]);var Pe={wxRenderer:null,output:"",editor:null,cssEditor:null,html:"",currentFont:"",currentSize:"",currentColor:"",citeStatus:0,nightMode:!1},Fe={setHtml:function(e,t){e.html=t},setEditorValue:function(e,t){e.editor.setValue(t)},setCssEditorValue:function(e,t){e.cssEditor.setValue(t)},setWxRendererOptions:function(e,t){e.wxRenderer.setOptions(t)},setCiteStatus:function(e,t){e.citeStatus=t,localStorage.setItem("citeStatus",t)},setCurrentFont:function(e,t){e.currentFont=t,localStorage.setItem("fonts",t)},setCurrentSize:function(e,t){e.currentSize=t,localStorage.setItem("size",t)},setCurrentColor:function(e,t){e.currentColor=t,localStorage.setItem("color",t)},themeChanged:function(e){e.nightMode=!e.nightMode},initEditorState:function(e){e.currentFont=localStorage.getItem("fonts")||U.builtinFonts[0].value,e.currentColor=localStorage.getItem("color")||U.colorOption[1].value,e.currentSize=localStorage.getItem("size")||U.sizeOption[2].value,e.citeStatus="true"===localStorage.getItem("citeStatus"),e.wxRenderer=new ze({theme:P(e.currentColor),fonts:e.currentFont,size:e.currentSize,status:e.citeStatus})},initEditorEntity:function(e){if(e.editor=b.a.fromTextArea(document.getElementById("editor"),{value:"",mode:"text/x-markdown",theme:"xq-light",lineNumbers:!1,lineWrapping:!0,styleActiveLine:!0,autoCloseBrackets:!0,extraKeys:{"Ctrl-F":function(e){var t=B(e.getValue(0));localStorage.setItem("__editor_content",t),e.setValue(t)}}}),localStorage.getItem("__editor_content"))e.editor.setValue(localStorage.getItem("__editor_content"));else{var t=B(Ae);e.editor.setValue(t)}},initCssEditorEntity:function(e){e.cssEditor=b.a.fromTextArea(document.getElementById("cssEditor"),{value:"",mode:"css",theme:"style-mirror",lineNumbers:!1,lineWrapping:!0,matchBrackets:!0,autofocus:!0,extraKeys:{"Ctrl-F":function(e){var t=e.lineCount();e.autoFormatRange({line:0,ch:0},{line:t})}}}),localStorage.getItem("__css_content")?e.cssEditor.setValue(localStorage.getItem("__css_content")):e.cssEditor.setValue(W)},editorRefresh:function(e){var t=je()(e.editor.getValue(0),{renderer:e.wxRenderer.getRenderer(e.citeStatus)});t=t.replace(/(style=".*?)"/,'$1;margin-top: 0"'),e.citeStatus&&(t+=e.wxRenderer.buildFootnotes(),t+=e.wxRenderer.buildAddition()),e.output=t},clearEditorToDefault:function(e){var t=B(Ae);e.editor.setValue(t),e.cssEditor.setValue(W)}},Me=new Q["a"].Store({state:Pe,mutations:Fe,actions:{},modules:{}}),Ie=n("5c96"),De=n.n(Ie);n("0fae");o["default"].use(Ie["Container"]),o["default"].use(Ie["Header"]),o["default"].use(Ie["Upload"]),o["default"].use(Ie["Tooltip"]),o["default"].use(Ie["Form"]),o["default"].use(Ie["FormItem"]),o["default"].use(Ie["Select"]),o["default"].use(Ie["Option"]),o["default"].use(Ie["ColorPicker"]),o["default"].use(Ie["Switch"]),o["default"].use(Ie["Button"]),o["default"].use(Ie["Main"]),o["default"].use(Ie["Col"]),o["default"].use(Ie["Row"]),o["default"].use(Ie["Dialog"]),o["default"].use(Ie["Loading"]),o["default"].component(Ie["Message"].name,Ie["Message"]),o["default"].prototype.$loading=Ie["Loading"].service,o["default"].prototype.$message=Ie["Message"];n("a7be"),n("0f7c"),n("f6b6"),n("8d7e"),n("90ba");o["default"].use(De.a),o["default"].config.productionTip=!1,new o["default"]({store:Me,render:function(e){return e(Re)}}).$mount("#app")},"5a64":function(e,t,n){},"90ba":function(e,t,n){},"9e7d":function(e,t,n){},e022:function(e,t,n){n("99af"),n("c975"),n("a15b"),n("d3b7"),n("4d63"),n("ac1f"),n("25f0"),n("466d"),n("5319"),n("1276"),function(){"undefined"!==typeof window&&(window.PR_SHOULD_USE_CONTINUATION=!0),function(){function e(e){function t(e){var t=e.charCodeAt(0);if(92!==t)return t;var n=e.charAt(1);return(t=d[n])?t:"0"<=n&&"7">=n?parseInt(e.substring(1),8):"u"===n||"x"===n?parseInt(e.substring(2),16):e.charCodeAt(1)}function n(e){return 32>e?(16>e?"\\x0":"\\x")+e.toString(16):(e=String.fromCharCode(e),"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e)}function o(e){var o=e.substring(1,e.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));e=[];var r="^"===o[0],i=["["];r&&i.push("^");r=r?1:0;for(var a=o.length;rl||122l||90l||122s[0]&&(s[1]+1>s[0]&&i.push("-"),i.push(n(s[1])));return i.push("]"),i.join("")}function r(e){for(var t=e.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),r=t.length,s=[],l=0,c=0;l/,null])):t.push(["com",/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(n.push(["com",/^\/\/[^\r\n]*/,null]),n.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null])),o=e.regexLiterals){var i=(o=1|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*(/(?=[^/*"+o+"])(?:[^/\\x5B\\x5C"+o+"]|\\x5C"+i+"|\\x5B(?:[^\\x5C\\x5D"+o+"]|\\x5C"+i+")*(?:\\x5D|$))+/)")])}return(o=e.types)&&n.push(["typ",o]),o=(""+e.keywords).replace(/^ | $/g,""),o.length&&n.push(["kwd",new RegExp("^(?:"+o.replace(/[\s,]+/g,"|")+")\\b"),null]),t.push(["pln",/^\s+/,null," \r\n\t "]),o="^.[^\\s\\w.$@'\"`/\\\\]*",e.regexLiterals&&(o+="(?!s*/)"),n.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(o),null]),r(t,n)}function a(e,t,n){function o(e){var t=e.nodeType;if(1!=t||i.test(e.className)){if((3==t||4==t)&&n){var l=e.nodeValue,c=l.match(a);c&&(t=l.substring(0,c.index),e.nodeValue=t,(l=l.substring(c.index+c[0].length))&&e.parentNode.insertBefore(s.createTextNode(l),e.nextSibling),r(e),t||e.parentNode.removeChild(e))}}else if("br"===e.nodeName.toLowerCase())r(e),e.parentNode&&e.parentNode.removeChild(e);else for(e=e.firstChild;e;e=e.nextSibling)o(e)}function r(e){function t(e,n){var o=n?e.cloneNode(!1):e,r=e.parentNode;if(r){r=t(r,1);var i=e.nextSibling;r.appendChild(o);for(var a=i;a;a=i)i=a.nextSibling,r.appendChild(a)}return o}for(;!e.nextSibling;)if(e=e.parentNode,!e)return;e=t(e.nextSibling,0);for(var n;(n=e.parentNode)&&1===n.nodeType;)e=n;c.push(e)}for(var i=/(?:^|\s)nocode(?:\s|$)/,a=/\r\n?|\n/,s=e.ownerDocument,l=s.createElement("li");e.firstChild;)l.appendChild(e.firstChild);for(var c=[l],u=0;u=+s[1],n=/\n/g,e.a),d=c.length,f=(o=0,e.c),p=f.length,g=(r=0,e.g),h=g.length,m=0;for(g[h]=d,a=i=0;a=C&&(r+=2),o>=k&&(m+=2)}}finally{x&&(x.style.display=e)}}catch(R){u.console&&console.log(R&&R.stack||R)}}var u="undefined"!==typeof window?window:{},d=["break,continue,do,else,for,if,return,while"],f=[[d,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[f,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],g=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[f,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],m=(f=[f,"abstract,async,await,constructor,debugger,enum,eval,export,from,function,get,import,implements,instanceof,interface,let,null,of,set,undefined,var,with,yield,Infinity,NaN"],[d,"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"]),b=[d,"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"],v=(d=[d,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/),y=/\S/,x=i({keywords:[p,h,g,f,"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",m,b,d],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),w={};s(x,["default-code"]),s(r([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),"default-markup htm html mxml xhtml xml xsl".split(" ")),s(r([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),s(r([],[["atv",/^[\s\S]+/]]),["uq.val"]),s(i({keywords:p,hashComments:!0,cStyleComments:!0,types:v}),"c cc cpp cxx cyc m".split(" ")),s(i({keywords:"null,true,false"}),["json"]),s(i({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),s(i({keywords:g,cStyleComments:!0}),["java"]),s(i({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),s(i({keywords:m,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),s(i({keywords:"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",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),s(i({keywords:b,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),s(i({keywords:f,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),s(i({keywords:"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",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),s(r([],[["str",/^[\s\S]+/]]),["regex"]);var C=u.PR={createSimpleLexer:r,registerLangHandler:s,sourceDecorator:i,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:u.prettyPrintOne=function(e,t,n){n=n||!1,t=t||null;var o=document.createElement("div");return o.innerHTML="
    "+e+"
    ",o=o.firstChild,n&&a(o,n,!0),c({j:t,m:n,h:o,l:1,a:null,i:null,c:null,g:null}),o.innerHTML},prettyPrint:u.prettyPrint=function(e,t){function n(){for(var t=u.PR_SHOULD_USE_CONTINUATION?p.now()+250:1/0;g