UNPKG

catalogue

Version:
2 lines 323 kB
require=function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);throw new Error("Cannot find module '"+a+"'")}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return i(n?n:e)},u,u.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){e("__browserify_process"),e("__browserify_Buffer");n["404.html"]=function(e){var t=(e.extensions,"");return t+="404 Page Not Found"},n["document.html"]=function(e,t,n){var r=(e.extensions,"");return r+='<div id="header">\n <img src="/assets/images/logo.png" class="logo">\n \n <div class="menu-icon">\n <div class="line"></div>\n <div class="line"></div>\n <div class="line"></div>\n </div>\n</div>\n\n<div id="subheader">\n <a href="/model/',r+=n.e(n.url_encode("undefined"!=typeof t.model?"undefined"!=typeof t.model?t.model:"":"undefined"!=typeof model?model:"")),r+='" class="title">\n <img src="/assets/images/icon-back.png" class="icon">\n ',r+=n.e(n.title("undefined"!=typeof t.model?"undefined"!=typeof t.model?t.model:"":"undefined"!=typeof model?model:"")),r+='\n </a>\n <div class="actions">\n <input id="save" type="button" class="btn" value="Save"/>\n <input id="delete" type="button" class="btn" value="Delete"/> \n </div>\n</div>\n\n<div id="document-view">\n <textarea id="doc"></textarea>\n</div>\n \n'},n["model.html"]=function(e,t,n){var r=(e.extensions,"");return r+='<div id="model-container">\n <div id="header">\n <img src="/assets/images/logo.png" class="logo">\n <div class="menu-icon">\n <div class="line"></div>\n <div class="line"></div>\n <div class="line"></div>\n </div>\n </div>\n\n <div id="results-container">\n ...\n </div>\n \n <div id="footer">\n <a href="/model/',r+=n.e("undefined"!=typeof t.model?"undefined"!=typeof t.model?t.model:"":"undefined"!=typeof model?model:""),r+='/document/new" class="btn-add">\n <img src="/assets/images/icon-add.png" class="icon">\n </a>\n\n <span id="model-pagination">\n <a class="btn-arrow">&larr;</a>\n <span id="model-results-label"></span>\n <a class="btn-arrow">&rarr;</a>\n </span>\n\n <a id="view-options">Options</a>\n\n </div>\n \n <div id="options-modal" class="modal-overlay">\n <div class="modal-window">\n <form id="model-options-form">\n <div class="modal-titlebar">\n <div class="title">Options</div>\n <div class="actions">\n <a id="close-modal" class="ui btn first margin-right">\n <img src="/assets/images/icon-close.png" class="icon">\n </a>\n </div>\n </div>\n <div class="modal-container">\n <div class="modal-padding">\n <table width="100%">\n\n <!-- Filter -->\n <tr>\n <td width="90px">\n <div class="label">Filter</div>\n </td>\n <td>\n <textarea name="filter" width="100%"></textarea>\n </td>\n </tr>\n \n <!-- Select -->\n <tr>\n <td>\n <div class="label">Select</div>\n </td>\n <td>\n <input name="select" type="text">\n </td>\n </tr>\n\n <!-- Sort -->\n <tr>\n <td>\n <div class="label">Sort</div>\n </td>\n <td>\n <input name="sort" type="text">\n </td>\n </tr>\n\n <!-- Limit -->\n <tr>\n <td>\n <div class="label">Limit</div>\n </td>\n <td>\n <select name="limit" width="100%">\n <option value="10">10</option>\n <option value="25">25</option>\n <option value="50">50</option>\n <option value="100">100</option>\n </select>\n </td>\n </tr>\n\n <!-- Populate -->\n <tr>\n <td>\n <div class="label">Populate</div>\n </td>\n <td>\n <textarea name="populate" width="100%"></textarea>\n </td>\n </tr>\n </table>\n </div>\n </div>\n <div class="modal-toolbar">\n <input type="submit" value="Save" class="btn-submit">\n </div>\n </div>\n </form>\n </div>\n</div>\n'},n["partials/model.link.html"]=function(e,t,n){var r=(e.extensions,"");return r+='<a href="/model/',r+=n.e(n.url_encode("undefined"!=typeof t.model?"undefined"!=typeof t.model?t.model:"":"undefined"!=typeof model?model:"")),r+='">',r+=n.e("undefined"!=typeof t.model?"undefined"!=typeof t.model?t.model:"":"undefined"!=typeof model?model:""),r+="</a>"},n["partials/model.results.html"]=function(e,t,n,r){var i=(e.extensions,"");return i+='<table id="model-docs-table" class="model-table" width="100%">\n <thead>\n <tr>\n ',function(){var e="undefined"!=typeof t.fields?"undefined"!=typeof t.fields?t.fields:"":"undefined"!=typeof fields?fields:"",o=r.isArray(e)?e.length:r.keys(e).length;e&&(t.___loopcache={loop:t.loop,field:t.field,__k:t.__k},t.loop={first:!1,index:1,index0:0,revindex:o,revindex0:o-1,length:o,last:!1},r.each(e,function(e,r){t.field=e,t.__k=r,t.loop.key=r,t.loop.first=0===t.loop.index0,t.loop.last=0===t.loop.revindex0,i+="\n <th>\n ",i+=n.e("undefined"!=typeof t.field&&void 0!==t.field.name?"undefined"!=typeof t.field&&void 0!==t.field.name?t.field.name:"":"undefined"!=typeof e&&void 0!==e.name?e.name:""),i+="\n ",("undefined"!=typeof t.field&&void 0!==t.field.populated?"undefined"!=typeof t.field&&void 0!==t.field.populated?t.field.populated:"":"undefined"!=typeof e&&void 0!==e.populated?e.populated:"")&&(i+=" (POPULATED) "),i+="\n </th>\n ",t.loop.index+=1,t.loop.index0+=1,t.loop.revindex-=1,t.loop.revindex0-=1}),t.loop=t.___loopcache.loop,t.field=t.___loopcache.field,t.__k=t.___loopcache.__k)}(),i+="\n </tr>\n </thead>\n\n <tbody>\n ",("undefined"!=typeof t.documents&&void 0!==t.documents.length?"undefined"!=typeof t.documents&&void 0!==t.documents.length?t.documents.length:"":"undefined"!=typeof documents&&void 0!==documents.length?documents.length:"")?(i+="\n ",function(){var e="undefined"!=typeof t.documents?"undefined"!=typeof t.documents?t.documents:"":"undefined"!=typeof documents?documents:"",o=r.isArray(e)?e.length:r.keys(e).length;e&&(t.___loopcache={loop:t.loop,row:t.row,__k:t.__k},t.loop={first:!1,index:1,index0:0,revindex:o,revindex0:o-1,length:o,last:!1},r.each(e,function(e,o){t.row=e,t.__k=o,t.loop.key=o,t.loop.first=0===t.loop.index0,t.loop.last=0===t.loop.revindex0,i+='\n <tr data-id="',i+=n.e("undefined"!=typeof t.row&&void 0!==t.row._id?"undefined"!=typeof t.row&&void 0!==t.row._id?t.row._id:"":"undefined"!=typeof e&&void 0!==e._id?e._id:""),i+='">\n ',function(){var o="undefined"!=typeof t.fields?"undefined"!=typeof t.fields?t.fields:"":"undefined"!=typeof fields?fields:"",a=r.isArray(o)?o.length:r.keys(o).length;o&&(t.___loopcache={loop:t.loop,field:t.field,__k:t.__k},t.loop={first:!1,index:1,index0:0,revindex:a,revindex0:a-1,length:a,last:!1},r.each(o,function(r,o){t.field=r,t.__k=o,t.loop.key=o,t.loop.first=0===t.loop.index0,t.loop.last=0===t.loop.revindex0,i+='\n <td>\n <div class="cell-wrap">\n ',("undefined"!=typeof t.field&&void 0!==t.field.ref?"undefined"!=typeof t.field&&void 0!==t.field.ref?t.field.ref:"":"undefined"!=typeof r&&void 0!==r.ref?r.ref:"")?(i+="\n ",("undefined"!=typeof t.field&&void 0!==t.field.populated?"undefined"!=typeof t.field&&void 0!==t.field.populated?t.field.populated:"":"undefined"!=typeof r&&void 0!==r.populated?r.populated:"")?(i+='\n <a href="/model/',i+=n.e(n.url_encode("undefined"!=typeof t.field&&void 0!==t.field.ref?"undefined"!=typeof t.field&&void 0!==t.field.ref?t.field.ref:"":"undefined"!=typeof r&&void 0!==r.ref?r.ref:"")),i+="/document/",i+=n.e(n.jsonpath(n.jsonpath("undefined"!=typeof t.row?"undefined"!=typeof t.row?t.row:"":"undefined"!=typeof e?e:"","undefined"!=typeof t.field&&void 0!==t.field.name?"undefined"!=typeof t.field&&void 0!==t.field.name?t.field.name:"":"undefined"!=typeof r&&void 0!==r.name?r.name:""),"_id")),i+='">\n ',i+=n.e(n.json_encode(n.jsonpath("undefined"!=typeof t.row?"undefined"!=typeof t.row?t.row:"":"undefined"!=typeof e?e:"","undefined"!=typeof t.field&&void 0!==t.field.name?"undefined"!=typeof t.field&&void 0!==t.field.name?t.field.name:"":"undefined"!=typeof r&&void 0!==r.name?r.name:""))),i+='\n <img src="/assets/images/icon-add.png" class="icon">\n </a>\n '):(i+='\n <a href="/model/',i+=n.e(n.url_encode("undefined"!=typeof t.field&&void 0!==t.field.ref?"undefined"!=typeof t.field&&void 0!==t.field.ref?t.field.ref:"":"undefined"!=typeof r&&void 0!==r.ref?r.ref:"")),i+="/document/",i+=n.e(n.jsonpath("undefined"!=typeof t.row?"undefined"!=typeof t.row?t.row:"":"undefined"!=typeof e?e:"","undefined"!=typeof t.field&&void 0!==t.field.name?"undefined"!=typeof t.field&&void 0!==t.field.name?t.field.name:"":"undefined"!=typeof r&&void 0!==r.name?r.name:"")),i+='">\n ',i+=n.e(n.jsonpath("undefined"!=typeof t.row?"undefined"!=typeof t.row?t.row:"":"undefined"!=typeof e?e:"","undefined"!=typeof t.field&&void 0!==t.field.name?"undefined"!=typeof t.field&&void 0!==t.field.name?t.field.name:"":"undefined"!=typeof r&&void 0!==r.name?r.name:"")),i+='\n <img src="/assets/images/icon-go.png" class="icon">\n </a>\n '),i+="\n "):"Date"==("undefined"!=typeof t.field&&void 0!==t.field.type?"undefined"!=typeof t.field&&void 0!==t.field.type?t.field.type:"":"undefined"!=typeof r&&void 0!==r.type?r.type:"")?(i+="\n ",i+=n.e(n.date(n.jsonpath("undefined"!=typeof t.row?"undefined"!=typeof t.row?t.row:"":"undefined"!=typeof e?e:"","undefined"!=typeof t.field&&void 0!==t.field.name?"undefined"!=typeof t.field&&void 0!==t.field.name?t.field.name:"":"undefined"!=typeof r&&void 0!==r.name?r.name:""),"Y-m-d H:i:s")),i+="\n "):(i+="\n ",i+=n.e(n.jsonpath("undefined"!=typeof t.row?"undefined"!=typeof t.row?t.row:"":"undefined"!=typeof e?e:"","undefined"!=typeof t.field&&void 0!==t.field.name?"undefined"!=typeof t.field&&void 0!==t.field.name?t.field.name:"":"undefined"!=typeof r&&void 0!==r.name?r.name:"")),i+="\n "),i+="\n </div>\n </td>\n ",t.loop.index+=1,t.loop.index0+=1,t.loop.revindex-=1,t.loop.revindex0-=1}),t.loop=t.___loopcache.loop,t.field=t.___loopcache.field,t.__k=t.___loopcache.__k)}(),i+="\n </tr>\n ",t.loop.index+=1,t.loop.index0+=1,t.loop.revindex-=1,t.loop.revindex0-=1}),t.loop=t.___loopcache.loop,t.row=t.___loopcache.row,t.__k=t.___loopcache.__k)}(),i+="\n "):(i+='\n <tr>\n <td colspan="',i+=n.e("undefined"!=typeof t.fields&&void 0!==t.fields.length?"undefined"!=typeof t.fields&&void 0!==t.fields.length?t.fields.length:"":"undefined"!=typeof fields&&void 0!==fields.length?fields.length:""),i+='">\n No results found\n </td>\n </tr>\n '),i+="\n </tbody>\n</table>\n"}},{__browserify_Buffer:25,__browserify_process:24}],2:[function(e,t,n){function r(e,t){if(this.$container=e,this.model=t.model,this.document=t.document,this.editor=null,i.call(this),o.call(this),"new"==this.document)this.editor.setValue("{\n\n}");else{var n="/api/model/"+this.model+"/document/"+this.document,r=u.get(n,a.bind(this));r.fail(function(e){alert(e.responseText)})}}function i(){this.$container.find("#save").click(s.bind(this)),this.$container.find("#delete").click(l.bind(this))}function o(){this.editor=f.fromTextArea(document.getElementById("doc"),{mode:{name:"javascript",json:!0},smartIndent:!0,matchBrackets:!0,lineNumbers:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],theme:"mbo"})}function a(e){var t=JSON.stringify(e,null," ");this.editor.setValue(t)}function s(){var e,t,n=this.editor.getValue(),r=this.document,i=this.model;try{n=JSON.parse(n)}catch(o){return alert("Error parsing document"),!1}"new"==r?(e="post",t="/api/model/"+this.model+"/document"):(e="put",t="/api/model/"+this.model+"/document/"+this.document);var a={data:n},s=u.ajax(t,{data:a,type:e});s.done(function(e){return"new"==r?c("/model/"+i+"/document/"+e._id):void alert("Document saved succesfully")}),s.fail(function(e){alert("Error Saving Document: "+e.responseText)})}function l(){var e=this.model,t=confirm("Are you sure you want to delete this document?");if(t){var n="/api/model/"+this.model+"/document/"+this.document,r=u.ajax(n,{type:"delete"});r.done(function(){alert("Document deleted succesfully"),c("/model/"+e)}),r.fail(function(e){alert("Error deleting document \n\n"+e.responseText)})}}var u=(e("__browserify_process"),e("__browserify_Buffer"),e("jquery")),c=e("page"),f=(e("swig"),e("../../build/js/templates"),e("codemirror"));e("codemirror/addon/fold/foldcode"),e("codemirror/addon/fold/foldgutter"),e("codemirror/addon/fold/brace-fold"),e("codemirror/addon/edit/matchbrackets"),e("codemirror/mode/javascript/javascript"),t.exports=n=r},{"../../build/js/templates":1,__browserify_Buffer:25,__browserify_process:24,codemirror:"UwPSSZ","codemirror/addon/edit/matchbrackets":"XPoO69","codemirror/addon/fold/brace-fold":"WPCYQZ","codemirror/addon/fold/foldcode":"KjRyZG","codemirror/addon/fold/foldgutter":"R6AE1J","codemirror/mode/javascript/javascript":"DtRaKM",jquery:27,page:28,swig:29}],3:[function(e,t,n){function r(e,t){this.$container=e,this.model=t.model,this.options=c.call(this);var n=parseInt(t.page);this.options.page=isNaN(n)?1:n,this.options.skip=this.options.limit*(this.options.page-1),i.call(this),o.call(this)}function i(){var e=this.$container;e.find("#model-options-form").submit(l.bind(this)),e.find("#view-options").click(u.bind(this))}function o(){var e=d(this.options),t="/api/model/"+this.model+"/documents?"+p.param(e),n=p.get(t,a.bind(this));n.fail(function(e){alert(e.responseText)})}function a(e){var t=h.run(m["partials/model.results.html"],e);this.$container.find("#results-container").html(t),s.call(this,e.documents.length,parseInt(e.total));var n=this.$container.find("#model-docs-table");n.floatThead({scrollingTop:90,debounceResizeMs:3,useAbsolutePositioning:!1,scrollContainer:function(e){return e.closest("#results-container")}})}function s(e,t){var n=this.$container.find("#model-pagination"),r=n.find("a:eq(0)"),i=n.find("#model-results-label"),o=n.find("a:eq(1)");if(0===t)return r.hide(),i.html("No results found"),void o.hide();var a=this.options.skip+1,s=this.options.skip+e;i.html(a+" - "+s+" of "+t),0===this.options.skip?r.hide():(r.attr("href","/model/"+this.model+"/"+(this.options.page-1)),r.show()),e+this.options.skip>=t?o.hide():(o.attr("href","/model/"+this.model+"/"+(this.options.page+1)),o.show())}function l(){var e=this.$container.find("#model-options-form");return this.options=e.serializeObject(),this.options.skip=0,localStorage[this.model]=JSON.stringify(d(this.options)),o.call(this),this.$container.find("#options-modal").fadeOut("fast"),!1}function u(){var e=this.$container.find("#options-modal");e.find('[name="filter"]').val(this.options.filter||"{}"),e.find('[name="select"]').val(this.options.select||""),e.find('[name="sort"]').val(this.options.sort||""),e.find('[name="limit"]').val(this.options.limit||10),e.find('[name="populate"]').val(this.options.populate||"{}"),e.fadeIn("fast")}function c(){var e=localStorage[this.model]?JSON.parse(localStorage[this.model]):{};e=f(e);var t=parseInt(e.limit);return isNaN(t)?delete e.limit:e.limit=t,e=p.extend({},g,e)}function f(e){var t={};for(var n in e)e.hasOwnProperty(n)&&e[n]&&(t[n]=decodeURIComponent(e[n]));return t}function d(e){var t={};for(var n in e)e.hasOwnProperty(n)&&e[n]&&(t[n]=encodeURIComponent(e[n]));return t}var p=(e("__browserify_process"),e("__browserify_Buffer"),e("jquery")),h=e("swig"),m=e("../../build/js/templates");e("jquery-scrollable-table"),e("jquery-serialize");var g={limit:50};t.exports=n=r},{"../../build/js/templates":1,__browserify_Buffer:25,__browserify_process:24,jquery:27,"jquery-scrollable-table":"yT2qnU","jquery-serialize":"qlQOd/",swig:29}],4:[function(e,t,n){function r(){this.$overlay=null,s(document).ready(function(){this.$overlay=s("#overlay"),o.call(this);var e=s.get("/api/models",i.bind(this));e.fail(function(e){alert("Error getting models: "+e.responseText)})}.bind(this))}function i(e){var t=e.reduce(function(e,t){return e+l.run(u["partials/model.link.html"],{model:t})},"");this.$overlay.find("#models-list").html(t)}function o(){s(window).on("keyup.overlay",a.bind(this)),s("body").on("click","#header",this.show.bind(this)),s("body").on("click","#overlay",this.hide.bind(this))}function a(e){if(32===e.keyCode){var t=e.target.tagName.toLowerCase();"input"!=t&&"textarea"!=t&&"article"!=t&&(s("#overlay").hasClass("open")?this.hide():this.show(),e.stopPropagation(),e.preventDefault())}}var s=(e("__browserify_process"),e("__browserify_Buffer"),e("jquery")),l=e("swig"),u=e("../../build/js/templates");r.prototype.show=function(e,t){this.$overlay.addClass("open"),this.$overlay.fadeIn("fast"),t&&t()},r.prototype.hide=function(e,t){this.$overlay.removeClass("open"),this.$overlay.fadeOut(),t&&t()},r.prototype.pin=function(){s(window).off("keyup.overlay")},r.prototype.unpin=function(){s(window).off("keyup.overlay"),s(window).on("keyup.overlay",a.bind(this))},t.exports=n=new r},{"../../build/js/templates":1,__browserify_Buffer:25,__browserify_process:24,jquery:27,swig:29}],5:[function(e){function t(){u=c("#viewport"),s(),n(),r(),i()}function n(){for(var e in p)p.hasOwnProperty(e)&&d.setFilter(e,p[e])}function r(){c("body").on("click","a",function(e){var t=c(this).attr("href");f(t),e.preventDefault()})}function i(){function e(e){var t=c(e.target);return 0===t.closest(".modal-window").length||1===t.closest("#close-modal").length?(c(".modal-overlay").fadeOut("fast"),!1):void 0}c("body").on("click touchend","#close-modal",e).on("click touchend",".modal-overlay",e)}function o(){m.show(),m.pin()}function a(e,t){m.hide(),m.unpin(),t()}function s(){f.base(""),f("/",o),f("/model/:model/:page?",a,v.model),f("/model/:model/document/:id",a,v.document),f("*",a,v.notfound),f.start()}function l(e,t){t=t||{};var n=d.run(g[e],t);u.html(n)}var u,c=(e("__browserify_process"),e("__browserify_Buffer"),e("jquery")),f=e("page"),d=e("swig"),p=e("./plugins/swig.helpers"),h={Model:e("./apps/model"),Document:e("./apps/document")},m=e("./apps/overlay"),g=e("../build/js/templates"),v={};v.model=function(e){var t={model:e.params.model,page:e.params.page};l("model.html",t),new h.Model(u,t),document.title="Catalogue - "+t.model},v.document=function(e){var t={model:e.params.model,document:e.params.id};l("document.html",t),new h.Document(u,t),document.title="Catalogue - "+t.model},v.notfound=function(){l("404.html"),document.title="Catalogue"},c(document).ready(t)},{"../build/js/templates":1,"./apps/document":2,"./apps/model":3,"./apps/overlay":4,"./plugins/swig.helpers":22,__browserify_Buffer:25,__browserify_process:24,jquery:27,page:28,swig:29}],XPoO69:[function(e,t){{var n=(e("__browserify_process"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});e("__browserify_Buffer")}(function(){n.CodeMirror=e("codemirror"),function(){function e(e,t,n){function r(t,n,r){if(t.text){var a=p?0:t.text.length-1,l=p?t.text.length:-1;if(t.text.length>s)return null;for(null!=r&&(a=r+h);a!=l;a+=h){var u=t.text.charAt(a);if(y.test(u)&&e.getTokenTypeAt(i(n,a+1))==g){var c=o[u];if(">"==c.charAt(1)==p)v.push(u);else{if(v.pop()!=c.charAt(0))return{pos:a,match:!1};if(!v.length)return{pos:a,match:!0}}}}}}var a=e.state.matchBrackets,s=a&&a.maxScanLineLength||1e4,l=a&&a.maxScanLines||100,u=t||e.getCursor(),c=e.getLineHandle(u.line),f=u.ch-1,d=f>=0&&o[c.text.charAt(f)]||o[c.text.charAt(++f)];if(!d)return null;var p=">"==d.charAt(1),h=p?1:-1;if(n&&p!=(f==u.ch))return null;for(var m,g=e.getTokenTypeAt(i(u.line,f+1)),v=[c.text.charAt(f)],y=/[(){}[\]]/,b=u.line,w=p?Math.min(b+l,e.lineCount()):Math.max(-1,b-l);b!=w&&!(m=b==u.line?r(c,b,f):r(e.getLineHandle(b),b));b+=h);return{from:i(u.line,f),to:m&&i(b,m.pos),match:m&&m.match,forward:p}}function t(t,n){var o=t.state.matchBrackets.maxHighlightLineLength||1e3,a=e(t);if(!(!a||t.getLine(a.from.line).length>o||a.to&&t.getLine(a.to.line).length>o)){var s=a.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",l=t.markText(a.from,i(a.from.line,a.from.ch+1),{className:s}),u=a.to&&t.markText(a.to,i(a.to.line,a.to.ch+1),{className:s});r&&t.state.focused&&t.display.input.focus();var c=function(){t.operation(function(){l.clear(),u&&u.clear()})};return n?void setTimeout(c,800):c}}function n(e){e.operation(function(){a&&(a(),a=null),e.somethingSelected()||(a=t(e,!1))})}var r=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),i=CodeMirror.Pos,o={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},a=null;CodeMirror.defineOption("matchBrackets",!1,function(e,t,r){r&&r!=CodeMirror.Init&&e.off("cursorActivity",n),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",n))}),CodeMirror.defineExtension("matchBrackets",function(){t(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(t,n){return e(this,t,n)})}()}).call(n,t,void 0)},{__browserify_Buffer:25,__browserify_process:24,codemirror:"UwPSSZ"}],"codemirror/addon/edit/matchbrackets":[function(e,t){e("__browserify_process"),e("__browserify_Buffer");t.exports=e("XPoO69")},{__browserify_Buffer:25,__browserify_process:24}],WPCYQZ:[function(e,t){{var n=(e("__browserify_process"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});e("__browserify_Buffer")}(function(){n.CodeMirror=e("codemirror"),CodeMirror.registerHelper("fold","brace",function(e,t){function n(n){for(var r=t.ch,s=0;;){var l=0>=r?-1:a.lastIndexOf(n,r-1);if(-1!=l){if(1==s&&l<t.ch)break;if(i=e.getTokenTypeAt(CodeMirror.Pos(o,l+1)),!/^(comment|string)/.test(i))return l+1;r=l-1}else{if(1==s)break;s=1,r=a.length}}}var r,i,o=t.line,a=e.getLine(o),s="{",l="}",r=n("{");if(null==r&&(s="[",l="]",r=n("[")),null!=r){var u,c,f=1,d=e.lastLine();e:for(var p=o;d>=p;++p)for(var h=e.getLine(p),m=p==o?r:0;;){var g=h.indexOf(s,m),v=h.indexOf(l,m);if(0>g&&(g=h.length),0>v&&(v=h.length),m=Math.min(g,v),m==h.length)break;if(e.getTokenTypeAt(CodeMirror.Pos(p,m+1))==i)if(m==g)++f;else if(!--f){u=p,c=m;break e}++m}if(null!=u&&(o!=u||c!=r))return{from:CodeMirror.Pos(o,r),to:CodeMirror.Pos(u,c)}}}),CodeMirror.braceRangeFinder=CodeMirror.fold.brace,CodeMirror.registerHelper("fold","import",function(e,t){function n(t){if(t<e.firstLine()||t>e.lastLine())return null;var n=e.getTokenAt(CodeMirror.Pos(t,1));if(/\S/.test(n.string)||(n=e.getTokenAt(CodeMirror.Pos(t,n.end+1))),"keyword"!=n.type||"import"!=n.string)return null;for(var r=t,i=Math.min(e.lastLine(),t+10);i>=r;++r){var o=e.getLine(r),a=o.indexOf(";");if(-1!=a)return{startCh:n.end,end:CodeMirror.Pos(r,a)}}}var r,t=t.line,i=n(t);if(!i||n(t-1)||(r=n(t-2))&&r.end.line==t-1)return null;for(var o=i.end;;){var a=n(o.line+1);if(null==a)break;o=a.end}return{from:e.clipPos(CodeMirror.Pos(t,i.startCh+1)),to:o}}),CodeMirror.importRangeFinder=CodeMirror.fold["import"],CodeMirror.registerHelper("fold","include",function(e,t){function n(t){if(t<e.firstLine()||t>e.lastLine())return null;var n=e.getTokenAt(CodeMirror.Pos(t,1));return/\S/.test(n.string)||(n=e.getTokenAt(CodeMirror.Pos(t,n.end+1))),"meta"==n.type&&"#include"==n.string.slice(0,8)?n.start+8:void 0}var t=t.line,r=n(t);if(null==r||null!=n(t-1))return null;for(var i=t;;){var o=n(i+1);if(null==o)break;++i}return{from:CodeMirror.Pos(t,r+1),to:e.clipPos(CodeMirror.Pos(i))}}),CodeMirror.includeRangeFinder=CodeMirror.fold.include}).call(n,t,void 0)},{__browserify_Buffer:25,__browserify_process:24,codemirror:"UwPSSZ"}],"codemirror/addon/fold/brace-fold":[function(e,t){e("__browserify_process"),e("__browserify_Buffer");t.exports=e("WPCYQZ")},{__browserify_Buffer:25,__browserify_process:24}],"codemirror/addon/fold/foldcode":[function(e,t){e("__browserify_process"),e("__browserify_Buffer");t.exports=e("KjRyZG")},{__browserify_Buffer:25,__browserify_process:24}],KjRyZG:[function(e,t){{var n=(e("__browserify_process"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});e("__browserify_Buffer")}(function(){n.CodeMirror=e("codemirror"),function(){"use strict";function e(e,n,r,i){function o(t){var r=a(e,n);if(!r||r.to.line-r.from.line<s)return null;for(var o=e.findMarksAt(r.from),l=0;l<o.length;++l)if(o[l].__isFold&&"fold"!==i){if(!t)return null;r.cleared=!0,o[l].clear()}return r}var a=r&&(r.call?r:r.rangeFinder);a||(a=CodeMirror.fold.auto),"number"==typeof n&&(n=CodeMirror.Pos(n,0));var s=r&&r.minFoldSize||0,l=o(!0);if(r&&r.scanUp)for(;!l&&n.line>e.firstLine();)n=CodeMirror.Pos(n.line-1,0),l=o(!1);if(l&&!l.cleared&&"unfold"!==i){var u=t(r);CodeMirror.on(u,"mousedown",function(){c.clear()});var c=e.markText(l.from,l.to,{replacedWith:u,clearOnEnter:!0,__isFold:!0});c.on("clear",function(t,n){CodeMirror.signal(e,"unfold",e,t,n)}),CodeMirror.signal(e,"fold",e,l.from,l.to)}}function t(e){var t=e&&e.widget||"↔";if("string"==typeof t){var n=document.createTextNode(t);t=document.createElement("span"),t.appendChild(n),t.className="CodeMirror-foldmarker"}return t}CodeMirror.newFoldFunction=function(t,n){return function(r,i){e(r,i,{rangeFinder:t,widget:n})}},CodeMirror.defineExtension("foldCode",function(t,n,r){e(this,t,n,r)}),CodeMirror.commands.fold=function(e){e.foldCode(e.getCursor())},CodeMirror.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,n){for(var r=0;r<e.length;++r){var i=e[r](t,n);if(i)return i}}}),CodeMirror.registerHelper("fold","auto",function(e,t){for(var n=e.getHelpers(t,"fold"),r=0;r<n.length;r++){var i=n[r](e,t);if(i)return i}})}()}).call(n,t,void 0)},{__browserify_Buffer:25,__browserify_process:24,codemirror:"UwPSSZ"}],"codemirror/addon/fold/foldgutter":[function(e,t){e("__browserify_process"),e("__browserify_Buffer");t.exports=e("R6AE1J")},{__browserify_Buffer:25,__browserify_process:24}],R6AE1J:[function(e,t){{var n=(e("__browserify_process"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});e("__browserify_Buffer")}(function(){n.CodeMirror=e("codemirror"),function(){"use strict";function e(e){this.options=e,this.from=this.to=0}function t(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function n(e,t){for(var n=e.findMarksAt(c(t)),r=0;r<n.length;++r)if(n[r].__isFold&&n[r].find().from.line==t)return!0}function r(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e,t}return e.cloneNode(!0)}function i(e,t,i){var o=e.state.foldGutter.options,a=t;e.eachLine(t,i,function(t){var i=null;if(n(e,a))i=r(o.indicatorFolded);else{var s=c(a,0),l=o.rangeFinder||CodeMirror.fold.auto,u=l&&l(e,s);u&&u.from.line+1<u.to.line&&(i=r(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,i),++a})}function o(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){i(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function a(e,t,n){var r=e.state.foldGutter.options;n==r.gutter&&e.foldCode(c(t,0),r.rangeFinder)}function s(e){var t=e.state.foldGutter,n=e.state.foldGutter.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){o(e)},n.foldOnChangeTimeSpan||600)}function l(e){var t=e.state.foldGutter,n=e.state.foldGutter.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?o(e):e.operation(function(){n.from<t.from&&(i(e,n.from,t.from),t.from=n.from),n.to>t.to&&(i(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}function u(e,t){var n=e.state.foldGutter,r=t.line;r>=n.from&&r<n.to&&i(e,r,r+1)}CodeMirror.defineOption("foldGutter",!1,function(n,r,i){i&&i!=CodeMirror.Init&&(n.clearGutter(n.state.foldGutter.options.gutter),n.state.foldGutter=null,n.off("gutterClick",a),n.off("change",s),n.off("viewportChange",l),n.off("fold",u),n.off("unfold",u),n.off("swapDoc",o)),r&&(n.state.foldGutter=new e(t(r)),o(n),n.on("gutterClick",a),n.on("change",s),n.on("viewportChange",l),n.on("fold",u),n.on("unfold",u),n.on("swapDoc",o))});var c=CodeMirror.Pos}()}).call(n,t,void 0)},{__browserify_Buffer:25,__browserify_process:24,codemirror:"UwPSSZ"}],codemirror:[function(e,t){e("__browserify_process"),e("__browserify_Buffer");t.exports=e("UwPSSZ")},{__browserify_Buffer:25,__browserify_process:24}],UwPSSZ:[function(e,t){{var n=(e("__browserify_process"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});e("__browserify_Buffer")}(function(e,t,n,r){window.CodeMirror=function(){"use strict";function e(n,r){if(!(this instanceof e))return new e(n,r);this.options=r=r||{};for(var i in yo)!r.hasOwnProperty(i)&&yo.hasOwnProperty(i)&&(r[i]=yo[i]);p(r);var o="string"==typeof r.value?0:r.value.first,a=this.display=t(n,o);a.wrapper.CodeMirror=this,c(this),r.autofocus&&!Zi&&mt(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new ni},l(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var s=r.value;"string"==typeof s&&(s=new Do(r.value,r.mode)),st(this,xr)(this,s),ji&&setTimeout(fi(ht,this,!0),20),vt(this);var u;try{u=document.activeElement==a.input}catch(f){}u||r.autofocus&&!Zi?setTimeout(fi(Bt,this),20):jt(this),st(this,function(){for(var e in vo)vo.propertyIsEnumerable(e)&&vo[e](this,r[e],bo);for(var t=0;t<Co.length;++t)Co[t](this)})()}function t(e,t){var n={},r=n.input=mi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return Wi?r.style.width="1000px":r.setAttribute("wrap","off"),Xi&&(r.style.border="1px solid black"),r.setAttribute("autocorrect","off"),r.setAttribute("autocapitalize","off"),r.setAttribute("spellcheck","false"),n.inputDiv=mi("div",[r],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),n.scrollbarH=mi("div",[mi("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),n.scrollbarV=mi("div",[mi("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),n.scrollbarFiller=mi("div",null,"CodeMirror-scrollbar-filler"),n.gutterFiller=mi("div",null,"CodeMirror-gutter-filler"),n.lineDiv=mi("div",null,"CodeMirror-code"),n.selectionDiv=mi("div",null,null,"position: relative; z-index: 1"),n.cursor=mi("div"," ","CodeMirror-cursor"),n.otherCursor=mi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),n.measure=mi("div",null,"CodeMirror-measure"),n.lineSpace=mi("div",[n.measure,n.selectionDiv,n.lineDiv,n.cursor,n.otherCursor],null,"position: relative; outline: none"),n.mover=mi("div",[mi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=mi("div",[n.mover],"CodeMirror-sizer"),n.heightForcer=mi("div",null,null,"position: absolute; height: "+Po+"px; width: 1px;"),n.gutters=mi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=mi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=mi("div",[n.inputDiv,n.scrollbarH,n.scrollbarV,n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),Hi&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),e.appendChild?e.appendChild(n.wrapper):e(n.wrapper),Xi&&(r.style.width="0px"),Wi||(n.scroller.draggable=!0),Vi?(n.inputDiv.style.height="1px",n.inputDiv.style.position="absolute"):Hi&&(n.scrollbarH.style.minWidth=n.scrollbarV.style.minWidth="18px"),n.viewOffset=n.lastSizeC=0,n.showingFrom=n.showingTo=t,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.prevInput="",n.alignWidgets=!1,n.pollingFast=!1,n.poll=new ni,n.cachedCharWidth=n.cachedTextHeight=null,n.measureLineCache=[],n.measureLineCachePos=0,n.inaccurateSelection=!1,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n }function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,D(e,100),e.state.modeGen++,e.curOp&&ct(e)}function i(e){e.options.lineWrapping?(e.display.wrapper.className+=" CodeMirror-wrap",e.display.sizer.style.minWidth=""):(e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-wrap",""),d(e)),a(e),ct(e),G(e),setTimeout(function(){h(e)},100)}function o(e){var t=rt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/it(e.display)-3);return function(i){return Xn(e.doc,i)?0:n?(Math.ceil(i.text.length/r)||1)*t:t}}function a(e){var t=e.doc,n=o(e);t.iter(function(e){var t=n(e);t!=e.height&&Tr(e,t)})}function s(e){var t=Eo[e.options.keyMap],n=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(n?" cm-keymap-"+n:"")}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),G(e)}function u(e){c(e),ct(e),setTimeout(function(){g(e)},20)}function c(e){var t=e.display.gutters,n=e.options.gutters;gi(t);for(var r=0;r<n.length;++r){var i=n[r],o=t.appendChild(mi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none"}function f(e,t){if(0==t.height)return 0;for(var n,r=t.text.length,i=t;n=Vn(i);){var o=n.find();i=_r(e,o.from.line),r+=o.from.ch-o.to.ch}for(i=t;n=Gn(i);){var o=n.find();r-=i.text.length-o.from.ch,i=_r(e,o.to.line),r+=i.text.length-o.to.ch}return r}function d(e){var t=e.display,n=e.doc;t.maxLine=_r(n,n.first),t.maxLineLength=f(n,t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var r=f(n,e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function p(e){var t=si(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,n=e.doc.height,r=n+P(t);t.sizer.style.minHeight=t.heightForcer.style.top=r+"px",t.gutters.style.height=Math.max(r,t.scroller.clientHeight-Po)+"px";var i=Math.max(r,t.scroller.scrollHeight),o=t.scroller.scrollWidth>t.scroller.clientWidth+1,a=i>t.scroller.clientHeight+1;a?(t.scrollbarV.style.display="block",t.scrollbarV.style.bottom=o?xi(t.measure)+"px":"0",t.scrollbarV.firstChild.style.height=i-t.scroller.clientHeight+t.scrollbarV.clientHeight+"px"):(t.scrollbarV.style.display="",t.scrollbarV.firstChild.style.height="0"),o?(t.scrollbarH.style.display="block",t.scrollbarH.style.right=a?xi(t.measure)+"px":"0",t.scrollbarH.firstChild.style.width=t.scroller.scrollWidth-t.scroller.clientWidth+t.scrollbarH.clientWidth+"px"):(t.scrollbarH.style.display="",t.scrollbarH.firstChild.style.width="0"),o&&a?(t.scrollbarFiller.style.display="block",t.scrollbarFiller.style.height=t.scrollbarFiller.style.width=xi(t.measure)+"px"):t.scrollbarFiller.style.display="",o&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(t.gutterFiller.style.display="block",t.gutterFiller.style.height=xi(t.measure)+"px",t.gutterFiller.style.width=t.gutters.offsetWidth+"px"):t.gutterFiller.style.display="",Gi&&0===xi(t.measure)&&(t.scrollbarV.style.minWidth=t.scrollbarH.style.minHeight=Yi?"18px":"12px",t.scrollbarV.style.pointerEvents=t.scrollbarH.style.pointerEvents="none")}function m(e,t,n){var r=e.scroller.scrollTop,i=e.wrapper.clientHeight;"number"==typeof n?r=n:n&&(r=n.top,i=n.bottom-n.top),r=Math.floor(r-H(e));var o=Math.ceil(r+i);return{from:Lr(t,r),to:Lr(t,o)}}function g(e){var t=e.display;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=b(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,i=n+"px",o=t.lineDiv.firstChild;o;o=o.nextSibling)if(o.alignable)for(var a=0,s=o.alignable;a<s.length;++a)s[a].style.left=i;e.options.fixedGutter&&(t.gutters.style.left=n+r+"px")}}function v(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=y(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(mi("div",[mi("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a),r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",!0}return!1}function y(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function b(e){return bi(e.scroller).left-bi(e.sizer).left}function w(e,t,n,r){for(var i,o=e.display.showingFrom,a=e.display.showingTo,s=m(e.display,e.doc,n),l=!0;;l=!1){var u=e.display.scroller.clientWidth;if(!x(e,t,s,r))break;if(i=!0,t=[],A(e),h(e),l&&e.options.lineWrapping&&u!=e.display.scroller.clientWidth)r=!0;else if(r=!1,n&&(n=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,"number"==typeof n?n:n.top)),s=m(e.display,e.doc,n),s.from>=e.display.showingFrom&&s.to<=e.display.showingTo)break}return i&&(Zr(e,"update",e),(e.display.showingFrom!=o||e.display.showingTo!=a)&&Zr(e,"viewportChange",e,e.display.showingFrom,e.display.showingTo)),i}function x(e,t,n,r){var i=e.display,o=e.doc;if(!i.wrapper.offsetWidth)return i.showingFrom=i.showingTo=o.first,void(i.viewOffset=0);if(!(!r&&0==t.length&&n.from>i.showingFrom&&n.to<i.showingTo)){v(e)&&(t=[{from:o.first,to:o.first+o.size}]);var a=i.sizer.style.marginLeft=i.gutters.offsetWidth+"px";i.scrollbarH.style.left=e.options.fixedGutter?a:"0";var s=1/0;if(e.options.lineNumbers)for(var l=0;l<t.length;++l)t[l].diff&&t[l].from<s&&(s=t[l].from);var u=o.first+o.size,c=Math.max(n.from-e.options.viewportMargin,o.first),f=Math.min(u,n.to+e.options.viewportMargin);if(i.showingFrom<c&&c-i.showingFrom<20&&(c=Math.max(o.first,i.showingFrom)),i.showingTo>f&&i.showingTo-f<20&&(f=Math.min(u,i.showingTo)),so)for(c=Er(Kn(o,_r(o,c)));u>f&&Xn(o,_r(o,f));)++f;var d=[{from:Math.max(i.showingFrom,o.first),to:Math.min(i.showingTo,u)}];if(d=d[0].from>=d[0].to?[]:k(d,t),so)for(var l=0;l<d.length;++l)for(var p,h=d[l];p=Gn(_r(o,h.to-1));){var m=p.find().from.line;if(!(m>h.from)){d.splice(l--,1);break}h.to=m}for(var g=0,l=0;l<d.length;++l){var h=d[l];h.from<c&&(h.from=c),h.to>f&&(h.to=f),h.from>=h.to?d.splice(l--,1):g+=h.to-h.from}if(!r&&g==f-c&&c==i.showingFrom&&f==i.showingTo)return void C(e);d.sort(function(e,t){return e.from-t.from});try{var y=document.activeElement}catch(b){}.7*(f-c)>g&&(i.lineDiv.style.display="none"),E(e,c,f,d,s),i.lineDiv.style.display="",y&&document.activeElement!=y&&y.offsetHeight&&y.focus();var w=c!=i.showingFrom||f!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;return w&&(i.lastSizeC=i.wrapper.clientHeight,D(e,400)),i.showingFrom=c,i.showingTo=f,i.gutters.style.height="",_(e),C(e),!0}}function _(e){for(var t,n=e.display,r=n.lineDiv.offsetTop,i=n.lineDiv.firstChild;i;i=i.nextSibling)if(i.lineObj){if(Hi){var o=i.offsetTop+i.offsetHeight;t=o-r,r=o}else{var a=bi(i);t=a.bottom-a.top}var s=i.lineObj.height-t;if(2>t&&(t=rt(n)),s>.001||-.001>s){Tr(i.lineObj,t);var l=i.lineObj.widgets;if(l)for(var u=0;u<l.length;++u)l[u].height=l[u].node.offsetHeight}}}function C(e){var t=e.display.viewOffset=Sr(e,_r(e.doc,e.display.showingFrom));e.display.mover.style.top=t+"px"}function k(e,t){for(var n=0,r=t.length||0;r>n;++n){for(var i=t[n],o=[],a=i.diff||0,s=0,l=e.length;l>s;++s){var u=e[s];i.to<=u.from&&i.diff?o.push({from:u.from+a,to:u.to+a}):i.to<=u.from||i.from>=u.to?o.push(u):(i.from>u.from&&o.push({from:u.from,to:i.from}),i.to<u.to&&o.push({from:i.to+a,to:u.to+a}))}e=o}return e}function T(e){for(var t=e.display,n={},r={},i=t.gutters.firstChild,o=0;i;i=i.nextSibling,++o)n[e.options.gutters[o]]=i.offsetLeft,r[e.options.gutters[o]]=i.offsetWidth;return{fixedPos:b(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function E(e,t,n,r,i){function o(t){var n=t.nextSibling;return Wi&&Ji&&e.display.currentWheelTarget==t?(t.style.display="none",t.lineObj=null):t.parentNode.removeChild(t),n}var a=T(e),s=e.display,l=e.options.lineNumbers;r.length||Wi&&e.display.currentWheelTarget||gi(s.lineDiv);var u=s.lineDiv,c=u.firstChild,f=r.shift(),d=t;for(e.doc.iter(t,n,function(t){if(f&&f.to==d&&(f=r.shift()),Xn(e.doc,t)){if(0!=t.height&&Tr(t,0),t.widgets&&c&&c.previousSibling)for(var n=0;n<t.widgets.length;++n){var s=t.widgets[n];if(s.showIfHidden){var p=c.previousSibling;if(/pre/i.test(p.nodeName)){var h=mi("div",null,null,"position: relative");p.parentNode.replaceChild(h,p),h.appendChild(p),p=h}var m=p.appendChild(mi("div",[s.node],"CodeMirror-linewidget"));s.handleMouseEvents||(m.ignoreEvents=!0),S(s,m,p,a)}}}else if(f&&f.from<=d&&f.to>d){for(;c.lineObj!=t;)c=o(c);l&&d>=i&&c.lineNumber&&yi(c.lineNumber,y(e.options,d)),c=c.nextSibling}else{if(t.widgets)for(var g,v=0,b=c;b&&20>v;++v,b=b.nextSibling)if(b.lineObj==t&&/div/i.test(b.nodeName)){g=b;break}var w=L(e,t,d,a,g);if(w!=g)u.insertBefore(w,c);else{for(;c!=g;)c=o(c);c=c.nextSibling}w.lineObj=t}++d});c;)c=o(c)}function L(e,t,n,r,i){var o,a=cr(e,t),s=a.pre,l=t.gutterMarkers,u=e.display,c=a.bgClass?a.bgClass+" "+(t.bgClass||""):t.bgClass;if(!(e.options.lineNumbers||l||c||t.wrapClass||t.widgets))return s;if(i){i.alignable=null;for(var f,d=!0,p=0,h=null,m=i.firstChild;m;m=f)if(f=m.nextSibling,/\bCodeMirror-linewidget\b/.test(m.className)){for(var g=0;g<t.widgets.length;++g){var v=t.widgets[g];if(v.node==m.firstChild){v.above||h||(h=m),S(v,m,i,r),++p;break}}if(g==t.widgets.length){d=!1;break}}else i.removeChild(m);i.insertBefore(s,h),d&&p==t.widgets.length&&(o=i,i.className=t.wrapClass||"")}if(o||(o=mi("div",null,t.wrapClass,"position: relative"),o.appendChild(s)),c&&o.insertBefore(mi("div",null,c+" CodeMirror-linebackground"),o.firstChild),e.options.lineNumbers||l){var b=o.insertBefore(mi("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px"),s);if(e.options.fixedGutter&&(o.alignable||(o.alignable=[])).push(b),!e.options.lineNumbers||l&&l["CodeMirror-linenumbers"]||(o.lineNumber=b.appendChild(mi("div",y(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+u.lineNumInnerWidth+"px"))),l)for(var w=0;w<e.options.gutters.length;++w){var x=e.options.gutters[w],_=l.hasOwnProperty(x)&&l[x];_&&b.appendChild(mi("div",[_],"CodeMirror-gutter-elt","left: "+r.gutterLeft[x]+"px; width: "+r.gutterWidth[x]+"px"))}}if(Hi&&(o.style.zIndex=2),t.widgets&&o!=i)for(var g=0,C=t.widgets;g<C.length;++g){var v=C[g],k=mi("div",[v.node],"CodeMirror-linewidget");v.handleMouseEvents||(k.ignoreEvents=!0),S(v,k,o,r),v.above?o.insertBefore(k,e.options.lineNumbers&&0!=t.height?b:s):o.appendChild(k),Zr(v,"redraw")}return o}function S(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function A(e){var t=e.display,n=Kt(e.doc.sel.from,e.doc.sel.to);if(n||e.options.showCursorWhenSelecting?M(e):t.cursor.style.display=t.otherCursor.style.display="none",n?t.selectionDiv.style.display="none":N(e),e.options.moveInputWithCursor){var r=Q(e,e.doc.sel.head,"div"),i=bi(t.wrapper),o=bi(t.lineDiv);t.inputDiv.style.top=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+o.top-i.top))+"px",t.inputDiv.style.left=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+o.left-i.left))+"px"}}function M(e){var t=e.display,n=Q(e,e.doc.sel.head,"div");t.cursor.style.left=n.left+"px",t.cursor.style.top=n.top+"px",t.cursor.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",t.cursor.style.display="",n.other?(t.otherCursor.style.display="",t.otherCursor.style.left=n.other.left+"px",t.otherCursor.style.top=n.other.top+"px",t.otherCursor.style.height=.85*(n.other.bottom-n.other.top)+"px"):t.otherCursor.style.display="none"}function N(e){function t(e,t,n,r){0>t&&(t=0),a.appendChild(mi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?s-e:n)+"px; height: "+(r-t)+"px"))}function n(n,r,o){function a(t,r){return J(e,Yt(n,t),"div",f,r)}var u,c,f=_r(i,n),d=f.text.length;return Ci(Ar(f),r||0,null==o?d:o,function(e,n,i){var f,p,h,m=a(e,"left");if(e==n)f=m,p=h=m.left;else{if(f=a(n-1,"right"),"rtl"==i){var g=m;m=f,f=g}p=m.left,h=f.right}null==r&&0==e&&(p=l),f.top-m.top>3&&(t(p,m.top,null,m.bottom),p=l,m.bottom<f.top&&t(p,m.bottom,null,f.top)),null==o&&n==d&&(h=s),(!u||m.top<u.top||m.top==u.top&&m.left<u.left)&&(u=m),(!c||f.bottom>c.bottom||f.bottom==c.bottom&&f.right>c.right)&&(c=f),l+1>p&&(p=l),t(p,f.top,h-p,f.bottom)}),{start:u,end:c}}var r=e.display,i=e.doc,o=e.doc.sel,a=document.createDocumentFragment(),s=r.lineSpace.offsetWidth,l=R(e.display);if(o.from.line==o.to.line)n(o.from.line,o.from.ch,o.to.ch);else{var u=_r(i,o.from.line),c=_r(i,o.to.line),f=Kn(i,u)==Kn(i,c),d=n(o.from.line,o.from.ch,f?u.text.length:null).end,p=n(o.to.line,f?0:null,o.to.ch).start;f&&(d.top<p.top-2?(t(d.right,d.top,null,d.bottom),t(l,p.top,p.left,p.bottom)):t(d.right,d.top,p.left-d.right,d.bottom)),d.bottom<p.top&&t(l,d.bottom,null,p.top)}vi(r.selectionDiv,a),r.selectionDiv.style.display=""}function O(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursor.style.visibility=t.otherCursor.style.visibility="",e.options.cursorBlinkRate>0&&(t.blinker=setInterval(function(){t.cursor.style.visibility=t.otherCursor.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate))}}function D(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.showingTo&&e.state.highlight.set(t,fi(I,e))}function I(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.showingTo)){var n,r=+new Date+e.options.workTime,i=_n(t.mode,j(e,t.frontier)),o=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.showingTo+500),function(a){if(t.frontier>=e.display.showingFrom){var s=a.styles;a.styles=ar(e,a,i,!0);for(var l=!s||s.length!=a.styles.length,u=0;!l&&u<s.length;++u)l=s[u]!=a.styles[u];l&&(n&&n.end==t.frontier?n.end++:o.push(n={start:t.frontier,end:t.frontier+1})),a.stateAfter=_n(t.mode,i)}else lr(e,a.text,i),a.stateAfter=t.frontier%5==0?_n(t.mode,i):null;return++t.frontier,+new Date>r?(D(e,e.options.workDelay),!0):void 0}),o.length&&st(e,function(){for(var e=0;e<o.length;++e)ct(this,o[e].start,o[e].end)})()}}function B(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>a;--s){if(s<=o.first)return o.first;var l=_r(o,s-1);if(l.stateAfter&&(!n||s<=o.frontier))return s;var u=ri(l.text,null,e.options.tabSize);(null==i||r>u)&&(i=s-1,r=u)}return i}function j(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=B(e,t,n),a=o>r.first&&_r(r,o-1).stateAfter;return a=a?_n(r.mode,a):Cn(r.mode),r.iter(o,t,function(n){lr(e,n.text,a);var s=o==t-1||o%5==0||o>=i.showingFrom&&o<i.showingTo;n.stateAfter=s?_n(r.mode,a):null,++o}),n&&(r.frontier=o),a}function H(e){return e.lineSpace.offsetTop}function P(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function R(e){var t=vi(e.measure,mi("pre",null,null,"text-align: left")).appendChild(mi("span","x"));return t.offsetLeft}function F(e,t,n,r,i){var o=-1;if(r=r||z(e,t),r.crude){var a=r.left+n*r.width;return{left:a,right:a+r.width,top:r.top,bottom:r.bottom}}for(var s=n;;s+=o){var l=r[s];if(l)break;0>o&&0==s&&(o=1)}return i=s>n?"left":n>s?"right":i,"left"==i&&l.leftSide?l=l.leftSide:"right"==i&&l.rightSide&&(l=l.rightSide),{left:n>s?l.right:l.left,right:s>n?l.left:l.right,top:l.top,bottom:l.bottom}}function W(e,t){for(var n=e.display.measureLineCache,r=0;r<n.length;++r){var i=n[r];if(i.text==t.text&&i.markedSpans==t.markedSpans&&e.display.scroller.clientWidth==i.width&&i.classes==t.textClass+"|"+t.wrapClass)return i}}function U(e,t){var n=W(e,t);n&&(n.text=n.measure=n.markedSpans=null)}function z(e,t){var n=W(e,t);if(n)return n.measure;var r=q(e,t),i=e.display.measureLineCache,o={text:t.text,width:e.display.s