UNPKG

vegana

Version:

vegana is a container based js framework

1 lines 264 kB
!function(){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){return i(t[a][1][e]||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){n.networkInterfaces=function(){return{}}},{}],2:[function(t,n,r){var i,o,a=n.exports={};function l(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function c(t){if(i===setTimeout)return setTimeout(t,0);if((i===l||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:l}catch(e){i=l}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(e){o=s}}();var u,d=[],f=!1,p=-1;function h(){f&&u&&(f=!1,u.length?d=u.concat(d):p=-1,d.length&&m())}function m(){if(!f){var t=c(h);f=!0;for(var n=d.length;n;){for(u=d,d=[];++p<n;)u&&u[p].run();p=-1,n=d.length}u=null,f=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function g(e,t){this.fun=e,this.array=t}function v(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new g(e,t)),1!==d.length||f||c(m)},g.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=v,a.addListener=v,a.once=v,a.off=v,a.removeListener=v,a.removeAllListeners=v,a.emit=v,a.prependListener=v,a.prependOnceListener=v,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],3:[function(e,t,n){const r={toCont:async(e,t)=>{let n=e+"Cont",r=null;t&&(r=t+"Panel"),engine.global.function.loader().show("loading "+e+" apis"),engine.get.contModule("docsPage",n)||await engine.loader.load.cont("docsPage",n,!0).then(()=>!0).catch(()=>!1)||(engine.global.function.loader().hide(),engine.global.function.message().danger(`failed to load ${e} apis please check your internet and try again.`)),engine.global.function.loader().hide(),engine.global.function.menu&&engine.global.function.menu().close(),engine.router.navigate.new.cont(engine.get.contModule("docsPage",n),{panel:r})},load_article:async(e,t)=>{engine.global.function.loader().show("loading article");let n=`${engine.router.get.baseHref()}/assets/articles/${e}/${t}.json`,r=await engine.request({url:n,method:"GET"});return engine.global.function.loader().hide(),r}};t.exports=(()=>{for(let e in r)engine.add.function(e,r[e])})},{}],4:[function(e,t,n){const r=e(5);e(19),e(3)(),engine.ui.getComp("commonUi","loaderComp").init("page-router",{integrate:!0,show:!1}),engine.ui.getComp("commonUi","messageComp").init("page-router"),engine.router.set.baseHref(""),engine.sketch.fonts.add("text","Montserrat-Regular","assets/fonts/Montserrat-Regular.ttf"),engine.sketch.fonts.add("text","OpenSans-Regular","assets/fonts/OpenSans-Regular.ttf"),engine.sketch.fonts.add("text","Redressed-Regular","assets/fonts/Redressed-Regular.ttf"),engine.sketch.fonts.add("text","Roboto-Regular","assets/fonts/Roboto-Regular.ttf"),function(){let e=engine.params.native.get();e.page,r.init({params:e.params})}()},{19:19,3:3,5:5}],5:[function(e,t,n){let r={init:e=>{engine.make.init.page("page-docs","page"),async function(e){let t="engine.add.comp";e.params.a&&(t=e.params.a),engine.params.add("a",t);const n=await engine.global.function.load_article("docsPage",t);engine.ui.getComp("commonUi","pageLibraryComp").init("page-docs",{page:"docsPage",base:"engine",article:n,starting_article_name:t,articles:[{name:"add",children:["comp","function","object"]},{name:"binder",children:["active","boolean","click","files","hover","number","text","value"]},{name:"common",children:["error","tell"]},{name:"creator",children:["draw","events","expire","function","intro","timer","touch","view"]},{name:"data",children:["delete","get","intro","reset","set"]},{name:"get",children:["body","contModule","element","elementPosition","host","os","pageModule","panelModule","platform"]},{name:"loader",children:["css",{name:"hook",children:["comp","page","cont","panel"]},{name:"load",children:["comp","page","cont","panel","js","sassPack","wasm","image"]}]},{name:"make",children:["addClass","a","button","div","element","heading","image","input","list","p","removeClass","select","span","textarea","text"]},{name:"meta",children:["add","delete","intro","update"]},{name:"params",children:["add","delete","get","intro",{name:"native",children:["get","push"]}]},{name:"request",children:[]},{name:"router",children:["intro","comp","page","cont","panel"]},{name:"session",children:["intro","get"]},{name:"set",children:["div","input","pageTitle","style"]},{name:"sketch",children:["colors","fonts"]},{name:"static",children:["onWeb","publish"]},{name:"ui",children:["add","getComp"]},{name:"validate",children:["email","json"]},{name:"view",children:["hide","remove","show"]},{name:"wet",children:[{name:"api",children:["get","set","query"]}]}]})}(e)},ref:"page-docs",type:"page",name:"docsPage",contModules:{},contList:{},trackers:{title:"vegana js docs",meta:[{name:"description",content:"vegana js docs for apis provided by engine to build ui with structured components and a cover around native web and os apis."},{name:"keywords",content:"vegana,js,docs,apis"}],function_data:{},function:e=>{}}};t.exports=r,window.pageModules.docsPage=r},{}],19:[function(e,t,n){e(7)},{7:7}],6:[function(e,t,n){var r,i;t.exports={init:(e,t)=>null==e||null==e?engine.common.error("no_parent_page_ref_found"):(i=(r=e)+"-comp-articleComp",engine.make.init.comp(i,r,"comp"),function(e){return e.article.title&&engine.set.pageTitle(e.article.title),e.article.keywords&&engine.meta.update({name:"keywords",content:e.article.keywords}),e.article.discription&&engine.meta.update({name:"description",content:e.article.discription}),engine.ui.getComp("commonUi","veganaDocViewComp").init(i,e.article)}(t)),ref:"-comp-articleComp",type:"comp"}},{}],7:[function(e,t,n){const r={articleComp:e(6),loaderComp:e(8),menuComp:e(10),messageComp:e(11),mobileMenuComp:e(12),pageLibraryComp:e(13),sidepanelv1Comp:e(14),veganaDocViewComp:e(15)};engine.ui.add("commonUi",r)},{10:10,11:11,12:12,13:13,14:14,15:15,6:6,8:8}],10:[function(e,t,n){var r,i;t.exports={init:(e,t)=>{if(null==e||null==e)return engine.common.error("no_parent_page_ref_found");i=(r=e)+"-comp-menuComp",engine.make.init.comp(i,r,"comp"),function(e){let t=engine.make.div({parent:i,class:"ui-common-comp-menu-main"});engine.make.div({parent:t,class:"ui-common-comp-menu-main-first_pad"});const n=engine.make.div({parent:t,class:"ui-common-comp-menu-main-icon"});engine.make.image({parent:n,class:"ui-common-comp-menu-main-icon-img",type:"local",location:"assets/images/icons/menu.png",function:()=>{engine.global.function.menuToggle()}}),engine.make.div({parent:t,class:"ui-common-comp-menu-main-title",text:"vegana js"}),engine.make.div({parent:t,class:"ui-common-comp-menu-main-buttons"})}()},ref:"-comp-menuComp",type:"comp"}},{}],11:[function(e,t,n){var r,i;function o(e,t){return"success"==e?a(t):"warn"==e?l(t):"danger"==e?s(t):"info"==e?c(t):{success:a,warn:l,danger:s,info:c,form:u}}function a(e){return d("message message-success",e),!0}function l(e){return d("message message-warning",e),!1}function s(e){return d("message message-danger",e),!1}function c(e){return d("message message-info",e),!0}function u(){return d("message message-info","Please fill the form correctly."),!1}function d(e,t){let n=engine.make.div({id:"message-"+engine.uniqid(),parent:"page-router",class:e}),r=engine.make.div({id:"closeCont",parent:n,class:"message-close-cont"});engine.make.button({id:"close",parent:r,class:"message-close-button",value:"close",function:()=>{engine.view.remove(n)}}),engine.make.div({id:"message",parent:n,class:"message-text-cont",text:t}),setTimeout(()=>{engine.view.remove(n)},5e3)}t.exports={init:e=>{if(null==e||null==e)return engine.common.error("no_parent_page_ref_found");i=(r=e)+"-comp-message",engine.make.init.comp(i,r,"comp"),engine.add.function("message",o)},ref:"-comp-message",type:"comp"}},{}],12:[function(e,t,n){var r,i;function o(e,t,n,r){const i=engine.make.div({parent:e,class:"comp-menu-main-menu-buttons-button",function:()=>{n(),t.function&&t.function(r)}});let o="comp-menu-main-menu-buttons-button-tag";if(t.icon){o+=" comp-menu-main-menu-buttons-button-tag_with_icon";const e=engine.make.div({parent:i,class:"comp-menu-main-menu-buttons-button-icon"});engine.make.image({parent:e,class:"comp-menu-main-menu-buttons-button-icon-img",type:"local",location:t.icon})}engine.make.div({parent:i,class:o,text:t.tag})}t.exports={init:(e,t)=>null==e||null==e?engine.common.error("no_parent_page_ref_found"):(i=(r=e)+"-comp-testmenu",engine.make.init.comp(i,r,"comp"),async function(e){const t=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),n=Math.abs(.7*t),r=(Math.abs(.3*t),engine.make.div({parent:i,class:"comp-menu-main"}));let a;engine.get.element(r),engine.make.div({parent:r,class:"comp-menu-main-slider",touch:(e,t)=>{h(t)}});let l=!0,s=!1;function c(){if(s)return!1;l||(engine.view.show(r),engine.view.hide(f),l=!0,p(0))}function u(){if(s)return!1;l&&(engine.view.hide(r),engine.view.show(f),l=!1)}const d={open:c,close:u,remove:()=>!s&&(engine.view.remove(r),!0),toggle:()=>{if(s)return!1;l?u():c()}};e.integrate&&engine.add.function(e.globalFunctionName||"menu",()=>d);const f=engine.make.div({parent:i,class:"comp-menu-opener",touch:(e,t)=>{c(),h(t)}});function p(e){a.style.transform=a.style["-webkit-transition"]=0===e?"translateX(0px)":"translateX(-"+e+"px)"}function h(e){if("end"===e.type)return void("left"===e.dirX?(p(n),u()):(p(0),c()));let t=n-Math.abs(e.posX);p(t>0?t:0)}u();const m=engine.make.div({parent:r,class:"comp-menu-main-menu"});let g,v;if(a=engine.get.element(m),e.only_body&&(g=engine.make.div({parent:m,class:e.body_class||"comp-menu-main-menu-body"})),e.buttons){v=engine.make.div({parent:m,class:"comp-menu-main-menu-buttons"});for(let t of e.buttons)o(v,t,u,d)}return{main:r,menu:m,buttons:v,body:g,functions:d}}(t)),ref:"-comp-testmenu",type:"comp",trackers:null}},{}],13:[function(e,t,n){var r,i;t.exports={init:(e,t)=>{if(null==e||null==e)return engine.common.error("no_parent_page_ref_found");i=(r=e)+"-comp-pageLibraryComp",engine.make.init.comp(i,r,"comp"),function(e){const t=engine.make.div({parent:i,class:"ui-common-comp-pageLibrary-main"}),n=engine.make.div({parent:t,class:"ui-common-comp-pageLibrary-main-menu"});engine.ui.getComp("commonUi","menuComp").init(n);const r=engine.make.div({parent:t,class:"ui-common-comp-pageLibrary-main-body"}),o=engine.make.div({parent:r,class:"ui-common-comp-pageLibrary-main-body-sidepanel"});engine.ui.getComp("commonUi","sidepanelv1Comp").init(o,{articles:e.articles,base:e.base,page:e.page,starting_article_name:e.starting_article_name});const a=engine.make.div({parent:r,class:"ui-common-comp-pageLibrary-main-body-article_router"});let l;function s(e){l&&(engine.view.remove(l),l=null),l=engine.ui.getComp("commonUi","articleComp").init(a,{article:e})}let c=!0;e.article&&s(e.article),engine.add.function("menuToggle",function(){c?(engine.make.removeClass({id:r,class:"ui-common-comp-pageLibrary-main_open"}),engine.make.addClass({id:r,class:"ui-common-comp-pageLibrary-main_close"}),c=!1):(engine.make.addClass({id:r,class:"ui-common-comp-pageLibrary-main_open"}),engine.make.removeClass({id:r,class:"ui-common-comp-pageLibrary-main_close"}),c=!0)}),engine.add.function("openArticle",s)}(t)},ref:"-comp-pageLibraryComp",type:"comp"}},{}],14:[function(e,t,n){var r,i;function o(e,t,n,r,i){const a=engine.make.div({parent:e,class:"ui-common-comp-sidepanelComp-sections-section"});let l,s=n||t.name;if(s+="Cont",0===t.children.length){let e=`${n}.${t.name}`;l=engine.make.a({parent:a,class:"ui-common-comp-sidepanelComp-sections-section-href",type:"local",page:"docsPage",params:{a:e},superFunction:async()=>{let t=await engine.global.function.load_article(r,e);engine.params.add("a",e),t&&engine.global.function.openArticle(t)}})}const c=engine.make.div({parent:0===t.children.length?l:a,class:"ui-common-comp-sidepanelComp-sections-section-title",function:0===t.children.length?null:function(){p?(engine.make.addClass({id:d,class:"ui-common-comp-sidepanelComp-sections-section-title-icon-img-right"}),engine.make.removeClass({id:d,class:"ui-common-comp-sidepanelComp-sections-section-title-icon-img-down"}),engine.view.hide(f),p=!1):(engine.make.removeClass({id:d,class:"ui-common-comp-sidepanelComp-sections-section-title-icon-img-right"}),engine.make.addClass({id:d,class:"ui-common-comp-sidepanelComp-sections-section-title-icon-img-down"}),engine.view.show(f),p=!0)}});engine.make.div({parent:c,class:"ui-common-comp-sidepanelComp-sections-section-title-text",text:t.name});const u=engine.make.div({parent:c,class:"ui-common-comp-sidepanelComp-sections-section-title-icon"});let d;"object"==typeof t&&t.children.length>0&&(d=engine.make.image({parent:u,class:"ui-common-comp-sidepanelComp-sections-section-title-icon-img",type:"local",location:"assets/images/icons/right-arrow.png"}));const f=engine.make.div({parent:a,class:"ui-common-comp-sidepanelComp-sections-section-links"});let p=!1;t.children.length>0&&i&&i.indexOf(`${n}.${t.name}`)>=0&&(p=!0),p?engine.make.addClass({id:d,class:"ui-common-comp-sidepanelComp-sections-section-title-icon-img-down"}):engine.view.hide(f);for(let h of t.children)if("string"==typeof h){let e=`${n}.${t.name}.${h}`,i=engine.make.a({parent:f,class:"ui-common-comp-sidepanelComp-sections-section-links-link",type:"local",page:"docsPage",params:{a:e},superFunction:async()=>{let t=await engine.global.function.load_article(r,e);engine.params.add("a",e),t&&engine.global.function.openArticle(t)}}),o="ui-common-comp-sidepanelComp-sections-section-links-link-text";t.withSubsections&&(o+=" ui-common-comp-sidepanelComp-sections-section-links-link-text-withSubsections"),engine.make.div({parent:i,class:o,text:h})}else o(engine.make.div({parent:f,class:"ui-common-comp-sidepanelComp-sections-section-links-subSection"}),h,`${n}.${t.name}`,r,i)}t.exports={init:(e,t)=>{if(null==e||null==e)return engine.common.error("no_parent_page_ref_found");i=(r=e)+"-comp-sidepanelComp",engine.make.init.comp(i,r,"ui-common-comp-sidepanelComp"),async function(e){let t;if(engine.get.platform("mobile")){let e=await engine.ui.getComp("commonUi","mobileMenuComp").init(i,{integrate:!0,globalFunctionName:"docsPageMobilMenu",only_body:!0});engine.add.function("menuToggle",()=>{e.functions.toggle()}),t=e.body}else t=engine.make.div({parent:i,class:"ui-common-comp-sidepanelComp-main"});const n=engine.make.div({parent:t,class:"ui-common-comp-sidepanelComp-sections"});for(let r of e.articles)o(n,r,e.base,e.page,e.starting_article_name)}(t)},ref:"-comp-sidepanelComp",type:"comp"}},{}],8:[function(e,t,n){var r,i;t.exports={init:(t,n)=>null==t||null==t?engine.common.error("no_parent_page_ref_found"):(i=(r=t)+"-comp-loaderComp",engine.make.init.comp(i,r,"comp"),function(t){t||(t={integrate:!0});const n=e(9)(i,t);return t.integrate?(engine.add.function(t.globalFunctionName||"loader",()=>n),!0):n}(n)),ref:"-comp-loaderComp",type:"comp"}},{9:9}],15:[function(e,t,n){const r="-comp-veganaDocViewComp";var i,o;function a(e,t){const n=engine.make.div({parent:e,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row"});let r={all:{}};t.style&&t.style.hasOwnProperty("grid-template-columns")&&(r.all=t.style,r.all.display="grid");const i=engine.make.div({parent:n,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers",draw:r});for(let o of t.template)s(i,t.containers[o])}const l=e(17);function s(e,t){const n=engine.make.div({parent:e,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container"});t.style&&engine.set.style(n,t.style),l.init(n,t.field)}t.exports={init:(e,t)=>null==e||null==e?engine.common.error("no_parent_page_ref_found"):(o=(i=e)+r,engine.make.init.comp(o,i,"comp"),function(e){const t=engine.make.div({parent:o,class:"ui-cmmon-comp-veganaDocViewComp-main"}),n=engine.make.div({parent:t,class:"ui-cmmon-comp-veganaDocViewComp-main-rows"});for(let r of e.template)a(n,e.rows[r]);return o}(t)),ref:r,type:"comp"}},{17:17}],9:[function(e,t,n){t.exports=((e,t)=>{let n=engine.make.div({parent:e,class:"loader-master"}),r=!0,i=!1;!1!==t.show&&!0!==t.hide||(r=!1,engine.view.hide(n));const o=engine.make.div({parent:n,class:"loader-master-card"}),a=engine.make.div({parent:o,class:"loader-master-card-loader"});engine.make.div({parent:a,class:"loader-master-card-loader-spinner"});const l=engine.make.div({parent:o,text:t.text||"loading ...",class:"loader-master-card-text"});function s(e){if(i)return!0;engine.set.div.text(l,e)}return{show:e=>!!i||!!r||(r=!0,engine.view.show(n),s(e||"Loading ...")),hide:()=>!!i||!r||(r=!1,engine.view.hide(n),!0),remove:()=>t.integrate?(console.error("failed-remove-integrated-loader"),!1):(i=!0,engine.view.remove(n),n=null,!0),say:s,text:s,main:()=>n,status:()=>r}})},{}],17:[function(require,module,exports){const codemirror=require(16);function init(e,t){const n=engine.make.div({parent:e,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field"});"heading"===t.type?make_heading(n,t.data.value):"paragraph"===t.type?make_paragraph(n,t.data.value):"image"===t.type?make_image(n,t.data):"code"===t.type&&make_code(n,t.data)}function make_code(parent,data){const main=engine.make.div({parent:parent,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-code"}),editor=engine.make.div({parent:main,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-code-editor"}),writer=codemirror(engine.get.element(editor),{value:data.value?data.value:"",lineNumbers:!0,mode:"javascript",lineWrapping:!0,theme:"cobalt",viewportMargin:1/0});engine.make.div({parent:main,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-code-runner",text:"run",function:execute});const executer_cont=engine.make.div({parent:main,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-code-executer_cont"});let executer;async function execute(){executer&&engine.view.remove(executer),executer=engine.make.div({parent:main,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-code-executer_cont-executer"});let value=writer.getValue();if(value){for(;value.indexOf("compId")>=0;)value=value.replace("compId",`"${executer}"`);for(;value.indexOf("pageId")>=0;)value=value.replace("pageId",`"${executer}"`);for(;value.indexOf("contId")>=0;)value=value.replace("contId",`"${executer}"`);for(;value.indexOf("panelId")>=0;)value=value.replace("panelId",`"${executer}"`);for(;value.indexOf("console.log")>=0;)value=value.replace("console.log","log");for(;value.indexOf("console.error")>=0;)value=value.replace("console.error","log")}let outputs=["//console output"];function log(e){console.log(e),"object"==typeof e?outputs.push(JSON.stringify(e,null,2)):outputs.push(e)}if(await eval(`(async () => {\n${value}\n})()`),outputs.length>1){const e=engine.make.div({parent:executer,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-code-executer_cont-executer-output"});let t="";for(let n of outputs)t+="\n"+n+"\n";codemirror(engine.get.element(e),{value:t,lineNumbers:!0,lineWrapping:!0,theme:"cobalt"})}}}function make_image(e,t){const n=engine.make.div({parent:e,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-image"});engine.make.image({parent:n,type:"url",location:"http://localhost:5566/"+t.location,draw:{all:{height:t.height,width:t.width}}})}function make_paragraph(e,t){for(t||(t="");t.indexOf("\n")>=0;)t=t.replace("\n","<br>");engine.make.div({parent:e,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-paragraph",text:t})}function make_heading(e,t){engine.make.div({parent:e,class:"ui-cmmon-comp-veganaDocViewComp-main-rows-row-containers-container-field-heading",text:t})}require(18),module.exports={init:init}},{16:16,18:18}],16:[function(e,t,n){var r,i;r=this,i=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,l=a&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),c=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),d=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),h=/PhantomJS/.test(e),m=f&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),g=/Android/.test(e),v=m||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=m||/Mac/.test(t),w=/\bCrOS\b/.test(e),b=/win/i.test(t),x=d&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(d=!1,s=!0);var k=y&&(c||d&&(null==x||x<12.11)),C=n||a&&l>=9;function _(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,M=function(e,t){var n=e.className,r=_(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function L(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return L(e).appendChild(t)}function O(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function N(e,t,n,r){var i=O(e,t,n,r);return i.setAttribute("role","presentation"),i}function A(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function D(){var e;try{e=document.activeElement}catch(Ae){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function P(e,t){var n=e.className;_(t).test(n)||(e.className+=(n?" ":"")+t)}function E(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!_(n[r]).test(t)&&(t+=" "+n[r]);return t}S=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(Ae){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var W=function(e){e.select()};function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function H(e,t,n){for(var r in t||(t={}),e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function j(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}m?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(W=function(e){try{e.select()}catch(t){}});var F=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};function B(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}F.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},F.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};var R=50,z={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},U={origin:"*mouse"},G={origin:"+move"};function q(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var $=[""];function X(e){for(;$.length<=e;)$.push(K($)+" ");return $[e]}function K(e){return e[e.length-1]}function Y(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function J(){}function Z(e,t){var n;return Object.create?n=Object.create(e):(J.prototype=e,n=new J),t&&H(t,n),n}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return e.charCodeAt(0)>=768&&re.test(e)}function oe(e,t,n){for(;(n<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=n;return t}function ae(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}var le=null;function se(e,t,n){var r;le=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:le=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:le=i)}return null!=r?r:le}var ce=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/;function o(e,t,n){this.level=e,this.from=t,this.to=n}return function(a,l){var s="ltr"==l?"L":"R";if(0==a.length||"ltr"==l&&!e.test(a))return!1;for(var c,u=a.length,d=[],f=0;f<u;++f)d.push((c=a.charCodeAt(f))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(c):1424<=c&&c<=1524?"R":1536<=c&&c<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(c-1536):1774<=c&&c<=2220?"r":8192<=c&&c<=8203?"w":8204==c?"b":"L");for(var p=0,h=s;p<u;++p){var m=d[p];"m"==m?d[p]=h:h=m}for(var g=0,v=s;g<u;++g){var y=d[g];"1"==y&&"r"==v?d[g]="n":n.test(y)&&(v=y,"r"==y&&(d[g]="R"))}for(var w=1,b=d[0];w<u-1;++w){var x=d[w];"+"==x&&"1"==b&&"1"==d[w+1]?d[w]="1":","!=x||b!=d[w+1]||"1"!=b&&"n"!=b||(d[w]=b),b=x}for(var k=0;k<u;++k){var C=d[k];if(","==C)d[k]="N";else if("%"==C){var _=void 0;for(_=k+1;_<u&&"%"==d[_];++_);for(var S=k&&"!"==d[k-1]||_<u&&"1"==d[_]?"1":"N",M=k;M<_;++M)d[M]=S;k=_-1}}for(var L=0,T=s;L<u;++L){var O=d[L];"L"==T&&"1"==O?d[L]="L":n.test(O)&&(T=O)}for(var N=0;N<u;++N)if(t.test(d[N])){var A=void 0;for(A=N+1;A<u&&t.test(d[A]);++A);for(var D="L"==(N?d[N-1]:s),P=D==("L"==(A<u?d[A]:s))?D?"L":"R":s,E=N;E<A;++E)d[E]=P;N=A-1}for(var W,I=[],H=0;H<u;)if(r.test(d[H])){var j=H;for(++H;H<u&&r.test(d[H]);++H);I.push(new o(0,j,H))}else{var F=H,B=I.length,R="rtl"==l?1:0;for(++H;H<u&&"L"!=d[H];++H);for(var z=F;z<H;)if(i.test(d[z])){F<z&&(I.splice(B,0,new o(1,F,z)),B+=R);var V=z;for(++z;z<H&&i.test(d[z]);++z);I.splice(B,0,new o(2,V,z)),B+=R,F=z}else++z;F<H&&I.splice(B,0,new o(1,F,H))}return"ltr"==l&&(1==I[0].level&&(W=a.match(/^\s+/))&&(I[0].from=W[0].length,I.unshift(new o(0,0,W[0].length))),1==K(I).level&&(W=a.match(/\s+$/))&&(K(I).to-=W[0].length,I.push(new o(0,u-W[0].length,u)))),"rtl"==l?I.reverse():I}}();function ue(e,t){var n=e.order;return null==n&&(n=e.order=ce(e.text,t)),n}var de=[],fe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||de).concat(n)}};function pe(e,t){return e._handlers&&e._handlers[t]||de}function he(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=B(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function me(e,t){var n=pe(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function ge(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),me(e,n||t.type,e,t),ke(t)||t.codemirrorIgnore}function ve(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==B(n,t[r])&&n.push(t[r])}function ye(e,t){return pe(e,t).length>0}function we(e){e.prototype.on=function(e,t){fe(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function xe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ke(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){be(e),xe(e)}function _e(e){return e.target||e.srcElement}function Se(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Me,Le,Te=function(){if(a&&l<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function Oe(e){if(null==Me){var t=O("span","\u200b");T(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Me=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var n=Me?O("span","\u200b"):O("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ne(e){if(null!=Le)return Le;var t=T(e,document.createTextNode("A\u062eA")),n=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return L(e),!(!n||n.left==n.right)&&(Le=r.right-n.right<3)}var Ae,De=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Pe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(Ae){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(Ae){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ee="oncopy"in(Ae=O("div"))||(Ae.setAttribute("oncopy","return;"),"function"==typeof Ae.oncopy),We=null,Ie={},He={};function je(e){if("string"==typeof e&&He.hasOwnProperty(e))e=He[e];else if(e&&"string"==typeof e.name&&He.hasOwnProperty(e.name)){var t=He[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return je("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return je("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Fe(e,t){t=je(t);var n=Ie[t.name];if(!n)return Fe(e,"text/plain");var r=n(e,t);if(Be.hasOwnProperty(t.name)){var i=Be[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var Be={};function Re(e,t){H(t,Be.hasOwnProperty(e)?Be[e]:Be[e]={})}function ze(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Ve(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ue(e,t,n){return!e.startState||e.startState(t,n)}var Ge=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function qe(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var 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 $e(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 Xe(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Ke(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ye(e){if(null==e.parent)return null;for(var t=e.parent,n=B(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 Je(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].height;if(t<l)break;t-=l}return n+a}function Ze(e,t){return t>=e.first&&t<e.first+e.size}function Qe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,n){if(void 0===n&&(n=null),!(this instanceof et))return new et(e,t,n);this.line=e,this.ch=t,this.sticky=n}function tt(e,t){return e.line-t.line||e.ch-t.ch}function nt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function rt(e){return et(e.line,e.ch)}function it(e,t){return tt(e,t)<0?t:e}function ot(e,t){return tt(e,t)<0?e:t}function at(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return et(e.first,0);var n=e.first+e.size-1;return t.line>n?et(n,qe(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?et(e.line,t):n<0?et(e.line,0):e}(t,qe(e,t.line).text.length)}function st(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r]);return n}Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ge.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ge.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=j(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Ge.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Ge.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ct=function(e,t){this.state=e,this.lookAhead=t},ut=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function dt(e,t,n,r){var i=[e.state.modeGen],o={};bt(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var a=n.state,l=function(r){n.baseTokens=i;var l=e.state.overlays[r],s=1,c=0;n.state=!0,bt(e,t.text,l.mode,n,function(e,t){for(var n=s;c<e;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;n<s;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+t}},o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function ft(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=pt(e,Ye(t)),i=t.text.length>e.options.maxHighlightLength&&ze(e.doc.mode,r.state),o=dt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function pt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ut(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=qe(o,l-1),c=s.stateAfter;if(c&&(!n||l+(c instanceof ct?c.lookAhead:0)<=o.modeFrontier))return l;var u=j(s.text,null,e.options.tabSize);(null==i||r>u)&&(i=l-1,r=u)}return i}(e,t,n),a=o>r.first&&qe(r,o-1).stateAfter,l=a?ut.fromSaved(r,a,o):new ut(r,Ue(r.mode),o);return r.iter(o,t,function(n){ht(e,n.text,l);var r=l.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?l.save():null,l.nextLine()}),n&&(r.modeFrontier=l.line),l}function ht(e,t,n,r){var i=e.doc.mode,o=new Ge(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&mt(i,n.state);!o.eol();)gt(i,o,n.state),o.start=o.pos}function mt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Ve(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function gt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ve(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ut.fromSaved=function(e,t,n){return t instanceof ct?new ut(e,ze(e.mode,t.state),n,t.lookAhead):new ut(e,ze(e.mode,t),n)},ut.prototype.save=function(e){var t=!1!==e?ze(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t};var vt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function yt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=qe(a,(t=lt(a,t)).line),c=pt(e,t.line,n),u=new Ge(s.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=gt(l,u,c.state),r&&o.push(new vt(u,i,ze(a.mode,c.state)));return r?o:new vt(u,i,c.state)}function wt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function bt(e,t,n,r,i,o,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new Ge(t,e.options.tabSize,r),f=e.options.addModeClass&&[null];for(""==t&&wt(mt(n,r.state),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&ht(e,t,r,d.pos),d.pos=t.length,s=null):s=wt(gt(n,d,r.state,f),o),f){var p=f[0].name;p&&(s="m-"+(s?p+" "+s:p))}if(!l||u!=s){for(;c<d.start;)i(c=Math.min(d.start,c+5e3),u);u=s}d.start=d.pos}for(;c<d.pos;){var h=Math.min(d.pos,c+5e3);i(h,u),c=h}}var xt=!1,kt=!1;function Ct(e,t,n){this.marker=e,this.from=t,this.to=n}function _t(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function St(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Mt(e,t){if(t.full)return null;var n=Ze(e,t.from.line)&&qe(e,t.from.line).markedSpans,r=Ze(e,t.to.line)&&qe(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==tt(t.from,t.to),l=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Ct(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Ct(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}(r,o,a),c=1==t.text.length,u=K(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var p=_t(s,f.marker);p?c&&(f.to=null==p.to?null:p.to+u):f.to=i}}if(s)for(var h=0;h<s.length;++h){var m=s[h];null!=m.to&&(m.to+=u),null==m.from?_t(l,m.marker)||(m.from=u,c&&(l||(l=[])).push(m)):(m.from+=u,c&&(l||(l=[])).push(m))}l&&(l=Lt(l)),s&&s!=l&&(s=Lt(s));var g=[l];if(!c){var v,y=t.text.length-2;if(y>0&&l)for(var w=0;w<l.length;++w)null==l[w].to&&(v||(v=[])).push(new Ct(l[w].marker,null,null));for(var b=0;b<y;++b)g.push(v);g.push(s)}return g}function Lt(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Tt(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Ot(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Nt(e){return e.inclusiveLeft?-1:0}function At(e){return e.inclusiveRight?1:0}function Dt(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=tt(r.from,i.from)||Nt(e)-Nt(t);return o?-o:tt(r.to,i.to)||At(e)-At(t)||t.id-e.id}function Pt(e,t){var n,r=kt&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Dt(n,i.marker)<0)&&(n=i.marker);return n}function Et(e){return Pt(e,!0)}function Wt(e){return Pt(e,!1)}function It(e,t){var n,r=kt&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Dt(n,o.marker)<0)&&(n=o.marker)}return n}function Ht(e,t,n,r,i){var o=qe(e,t),a=kt&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=tt(c.from,n)||Nt(s.marker)-Nt(i),d=tt(c.to,r)||At(s.marker)-At(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.to,n)>=0:tt(c.to,n)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.from,r)<=0:tt(c.from,r)<0)))return!0}}}function jt(e){for(var t;t=Et(e);)e=t.find(-1,!0).line;return e}function Ft(e,t){var n=qe(e,t),r=jt(n);return n==r?t:Ye(r)}function Bt(e,t){if(t>e.lastLine())return t;var n,r=qe(e,t);if(!Rt(e,r))return t;for(;n=Wt(r);)r=n.find(1,!0).line;return Ye(r)+1}function Rt(e,t){var n=kt&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&zt(e,t,r))return!0}}function zt(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return zt(e,r.line,_t(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&zt(e,t,i))return!0}function Vt(e){for(var t=0,n=(e=jt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==n)break;t+=l.height}return t}function Ut(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Et(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=Wt(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function Gt(e){var t=e.display,n=e.doc;t.maxLine=qe(n,n.first),t.maxLineLength=Ut(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=Ut(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}var qt=function(e,t,n){this.text=e,Ot(this,t),this.height=n?n(this):1};function $t(e){e.parent=null,Tt(e)}qt.prototype.lineNo=function(){return Ye(this)},we(qt);var Xt={},Kt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Kt:Xt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Jt(e,t){var n=N("span",null,null,s?"padding-right: .1px":null),r={pre:N("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Qt,Ne(e.display.measure)&&(a=ue(o,e.doc.direction))&&(r.addToken=en(r.addToken,a)),r.map=[],nn(o,r,ft(e,o,t!=e.display.externalMeasured&&Ye(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=E(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=E(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Oe(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=E(r.pre.className,r.textClass||"")),r}function Zt(e){var t=O("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,n,r,i,o,s){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o="\xa0"),r+=o,n=" "==o}return r}(t,e.trailingSpace):t,d=e.cm.state.specialChars,f=!1;if(d.test(t)){c=document.createDocumentFragment();for(var p=0;;){d.lastIndex=p;var h=d.exec(t),m=h?h.index-p:t.length-p;if(m){var g=document.createTextNode(u.slice(p,p+m));a&&l<9?c.appendChild(O("span",[g])):c.appendChild(g),e.map.push(e.pos,e.pos+m,g),e.col+=m,e.pos+=m}if(!h)break;p+=m+1;var v=void 0;if("\t"==h[0]){var y=e.cm.options.tabSize,w=y-e.col%y;(v=c.appendChild(O("span",X(w),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=w}else"\r"==h[0]||"\n"==h[0]?((v=c.appendChild(O("span","\r"==h[0]?"\u240d":"\u2424","cm-invalidchar"))).setAttribute("cm-text",h[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(h[0])).setAttribute("cm-text",h[0]),a&&l<9?c.appendChild(O("span",[v])):c.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),a&&l<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),n||r||i||f||o||s){var b=n||"";r&&(b+=r),i&&(b+=i);var x=O("span",[c],b,o);if(s)for(var k in s)s.hasOwnProperty(k)&&"style"!=k&&"class"!=k&&x.setAttribute(k,s[k]);return e.content.appendChild(x)}e.content.appendChild(c)}}function en(e,t){return function(n,r,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+r.length;;){for(var d=void 0,f=0;f<t.length&&!((d=t[f]).to>c&&d.from<=c);f++);if(d.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-c),i,o,null,l,s),o=null,r=r.slice(d.to-c),c=d.to}}}function tn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)