From 76b01fb4cf74bba3df81d316bd69548d62a9ded4 Mon Sep 17 00:00:00 2001 From: Matthew Beale Date: Mon, 14 Dec 2015 17:13:49 -0500 Subject: [PATCH] built website from 94507c9f49d15caa600469752480d6ea3ff4aa96 --- ...t-demo-09f34ab085d48b3bfacd2aa3c168abfa.js | 1 + ...t-demo-5fbf3ae66387e1e41933809822b210e1.js | 1 - ...endor-76170da5950856e207f7592fda4777cd.js} | 24 +++++++++---------- website/demo/index.html | 6 ++--- 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 website/demo/assets/mobiledoc-kit-demo-09f34ab085d48b3bfacd2aa3c168abfa.js delete mode 100644 website/demo/assets/mobiledoc-kit-demo-5fbf3ae66387e1e41933809822b210e1.js rename website/demo/assets/{vendor-6a74a58011942a2866f5e4130abbf9c2.js => vendor-76170da5950856e207f7592fda4777cd.js} (64%) diff --git a/website/demo/assets/mobiledoc-kit-demo-09f34ab085d48b3bfacd2aa3c168abfa.js b/website/demo/assets/mobiledoc-kit-demo-09f34ab085d48b3bfacd2aa3c168abfa.js new file mode 100644 index 000000000..e11afcd60 --- /dev/null +++ b/website/demo/assets/mobiledoc-kit-demo-09f34ab085d48b3bfacd2aa3c168abfa.js @@ -0,0 +1 @@ +"use strict";define("mobiledoc-kit-demo/app",["exports","ember","ember/resolver","ember/load-initializers","mobiledoc-kit-demo/config/environment"],function(e,t,o,d,n){var r;t["default"].MODEL_FACTORY_INJECTIONS=!0,r=t["default"].Application.extend({modulePrefix:n["default"].modulePrefix,podModulePrefix:n["default"].podModulePrefix,Resolver:o["default"]}),d["default"](r,n["default"].modulePrefix),e["default"]=r}),define("mobiledoc-kit-demo/components/app-version",["exports","ember-cli-app-version/components/app-version","mobiledoc-kit-demo/config/environment"],function(e,t,o){var d=o["default"].APP,n=d.name,r=d.version;e["default"]=t["default"].extend({version:r,name:n})}),define("mobiledoc-kit-demo/components/ember-wormhole",["exports","ember-wormhole/components/ember-wormhole"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-component-card",["exports","ember-mobiledoc-editor/components/mobiledoc-component-card/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-dom-renderer",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/dom","ember-mobiledoc-dom-renderer"],function(e,t,o,d){var n=new d["default"]({cards:o["default"]});e["default"]=t["default"].Component.extend({didRender:function(){var e=this.get("mobiledoc");if(e){this._teardownRender&&(this._teardownRender(),this._teardownRender=null);var t=this.$();t.empty();try{var o=n.render(e),d=o.result,r=o.teardown;t.append(d),this._teardownRender=r}catch(i){console.error(i);var d=document.createTextNode(i.message);t.append(d)}}}})}),define("mobiledoc-kit-demo/components/mobiledoc-editor",["exports","ember-mobiledoc-editor/components/mobiledoc-editor/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-html-renderer",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/html","ember-mobiledoc-html-renderer"],function(e,t,o,d){var n=new d["default"]({cards:o["default"]});e["default"]=t["default"].Component.extend({didRender:function(){var e=this.get("mobiledoc");if(e){var t=this.$();t.empty();try{var o=n.render(e),d=o.result;t.text(d)}catch(r){console.error(r);var i=document.createTextNode(r.message);t.append(i)}}}})}),define("mobiledoc-kit-demo/components/mobiledoc-link-button",["exports","ember-mobiledoc-editor/components/mobiledoc-link-button/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-link-prompt",["exports","ember-mobiledoc-editor/components/mobiledoc-link-prompt/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-markup-button",["exports","ember-mobiledoc-editor/components/mobiledoc-markup-button/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-section-button",["exports","ember-mobiledoc-editor/components/mobiledoc-section-button/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-text-renderer",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/text","ember-mobiledoc-text-renderer"],function(e,t,o,d){var n=new d["default"]({cards:o["default"]}),r=function(e){return e.replace(//g,">").replace(/\n/g,"
")};e["default"]=t["default"].Component.extend({didRender:function(){var e=this.get("mobiledoc");if(e){this._teardownRender&&(this._teardownRender(),this._teardownRender=null);var t=this.$();t.empty();try{var o=n.render(e),d=o.result,i=o.teardown;d=r(d),t.html(d),this._teardownRender=i}catch(a){console.error(a);var l=document.createTextNode(a.message);t.append(l)}}}})}),define("mobiledoc-kit-demo/components/mobiledoc-toolbar",["exports","ember-mobiledoc-editor/components/mobiledoc-toolbar/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/render-mobiledoc",["exports","ember-mobiledoc-dom-renderer/components/render-mobiledoc"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/tether-to-selection",["exports","ember-mobiledoc-editor/components/tether-to-selection/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/controllers/array",["exports","ember"],function(e,t){e["default"]=t["default"].Controller}),define("mobiledoc-kit-demo/controllers/index",["exports","ember","mobiledoc-kit-demo/mobiledocs/index"],function(e,t,o){var d=t["default"].$;e["default"]=t["default"].Controller.extend({init:function(){this._super.apply(this,arguments);var e=o["default"].simple;this.set("mobiledoc",e),this.set("editedMobiledoc",e),this.set("rendererName","dom")},actions:{changeMobiledoc:function(){var e=d("#select-mobiledoc"),t=e.val(),n=o["default"][t];this.set("mobiledoc",n),this.set("editedMobiledoc",n)},setRenderer:function(e){this.set("rendererName",e)},didEdit:function(e){this.set("editedMobiledoc",e)}}})}),define("mobiledoc-kit-demo/controllers/object",["exports","ember"],function(e,t){e["default"]=t["default"].Controller}),define("mobiledoc-kit-demo/helpers/format-object",["exports","ember"],function(e,t){function o(e){var t=d(e,1),o=t[0];return JSON.stringify(o,null," ")}e.formatObject=o;var d=function(){function e(e,t){var o=[],d=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(d=(i=a.next()).done)&&(o.push(i.value),!t||o.length!==t);d=!0);}catch(l){n=!0,r=l}finally{try{!d&&a["return"]&&a["return"]()}finally{if(n)throw r}}return o}return function(t,o){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e["default"]=t["default"].Helper.helper(o)}),define("mobiledoc-kit-demo/helpers/hash",["exports","ember-mobiledoc-editor/helpers/hash"],function(e,t){e["default"]=t["default"],e.hash=t.hash}),define("mobiledoc-kit-demo/helpers/in-array",["exports","ember-mobiledoc-editor/helpers/in-array"],function(e,t){e["default"]=t["default"],e.inArray=t.inArray}),define("mobiledoc-kit-demo/helpers/mobiledoc-cards-list",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/dom"],function(e,t,o){function d(){return o["default"]}e.mobiledocCardsList=d,e["default"]=t["default"].Helper.helper(d)}),define("mobiledoc-kit-demo/initializers/app-version",["exports","ember-cli-app-version/initializer-factory","mobiledoc-kit-demo/config/environment"],function(e,t,o){var d=o["default"].APP,n=d.name,r=d.version;e["default"]={name:"App Version",initialize:t["default"](n,r)}}),define("mobiledoc-kit-demo/initializers/export-application-global",["exports","ember","mobiledoc-kit-demo/config/environment"],function(e,t,o){function d(){var e=arguments[1]||arguments[0];if(o["default"].exportApplicationGlobal!==!1){var d,n=o["default"].exportApplicationGlobal;d="string"==typeof n?n:t["default"].String.classify(o["default"].modulePrefix),window[d]||(window[d]=e,e.reopen({willDestroy:function(){this._super.apply(this,arguments),delete window[d]}}))}}e.initialize=d,e["default"]={name:"export-application-global",initialize:d}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/codemirror",["exports"],function(e){function t(e,t){var o=arguments.length<=2||void 0===arguments[2]?!0:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(){}:arguments[3];setTimeout(function(){var n=$("").appendTo(e),r={mode:"javascript"};o&&(r.readOnly="nocursor");var i=CodeMirror.fromTextArea(n[0],r);d(i)})}var o="let x = 3;";e["default"]={name:"codemirror-card",type:"dom",render:function(e){var d=e.env,n=(e.options,e.payload),r=$("
")[0],i=n.code||o;d.isInEditor&&$("").appendTo(r).on("click",d.edit);var a=!0;return t(r,i,a),r},edit:function(e){var d=e.env,n=(e.options,e.payload),r=$("
")[0],i=n.code||o,a=$("").appendTo(r),l=!1,c=function(e){a.on("click",function(){return d.save({code:e.getValue()})})};return t(r,i,l,c),r}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/image",["exports"],function(e){function t(){var e=arguments.length<=0||void 0===arguments[0]?o:arguments[0];return $("
").append('')[0]}var o="http://placekitten.com/200/75";e["default"]={name:"image-card",type:"dom",render:function(e){var o=e.env,d=e.payload,n=t(d.src),r=o.isInEditor;return r&&$("").appendTo(n).on("click",o.edit),n},edit:function(e){function o(e){var t=new FileReader,o=e.target.files[0];t.onloadend=function(){d.save({src:t.result})},t.readAsDataURL(o)}var d=e.env,n=e.payload,r=t(n.src);return $('').appendTo(r).on("change",o),$("").appendTo(r).on("click",function(){d.save(n)}),r}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/input",["exports","ember"],function(e,t){var o=t["default"].$;e["default"]={name:"input-card",type:"dom",render:function(e){var t=e.env,d=e.payload,n="I am in display mode";d.name&&(n="Hello, "+d.name+"!");var r=o("
"+n+"
"),i=o("");return i.on("click",t.edit),t.edit&&r.append(i),r[0]},edit:function(e){var t=e.env,d=o("
What is your name?
");d.innerHTML="What is your name?";var n=o(''),r=o("");return r.on("click",function(){var e=n.val();t.save({name:e})}),d.append(n),d.append(r),d[0]}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/selfie",["exports","ember"],function(e,t){var o=t["default"].$;e["default"]={name:"selfie-card",type:"dom",render:function(e){var t=e.env,d=e.payload,n=o("
")[0],r=t.isInEditor;return d.src?o('

You look nice today.
'+(r?"
":"")+"
").appendTo(n):o("
Hello there!"+(r?"":"")+"
").appendTo(n),r&&setTimeout(function(){o("#go-edit").on("click",t.edit)}),n},edit:function(e){var t=e.env,d=o("
")[0];return o('
').appendTo(d),setTimeout(function(){var e=document.getElementById("canvas"),d=e.getContext("2d"),n=document.getElementById("video"),r={video:!0},i=function(){return alert("error getting video feed")};navigator.getMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getMedia(r,function(r){var i=void 0;navigator.mozGetUserMedia?n.mozSrcObject=r:(i=window.URL||window.webkitURL,n.src=i.createObjectURL(r),n.play()),o("#snap").click(function(){d.drawImage(n,0,0,400,300);var o=e.toDataURL("image/png");t.save({src:o})})},i)}),d}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/simple",["exports","ember"],function(e,t){var o=t["default"].$;e["default"]={name:"simple-card",type:"dom",render:function(e){var t=e.env,d=document.createElement("div"),n=document.createElement("span");n.innerHTML="Hello, world",d.appendChild(n);var r=o("");return r.on("click",t.remove),d}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom",["exports","mobiledoc-kit-demo/mobiledoc-cards/dom/input","mobiledoc-kit-demo/mobiledoc-cards/dom/simple","mobiledoc-kit-demo/mobiledoc-cards/dom/selfie","mobiledoc-kit-demo/mobiledoc-cards/dom/image","mobiledoc-kit-demo/mobiledoc-cards/dom/codemirror"],function(e,t,o,d,n,r){e["default"]=[t["default"],o["default"],d["default"],n["default"],r["default"]]}),define("mobiledoc-kit-demo/mobiledoc-cards/html/codemirror",["exports"],function(e){e["default"]={name:"codemirror-card",type:"html",render:function(e){var t=e.payload;return t.code?""+t.code+"":void 0}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/image",["exports"],function(e){var t="http://placekitten.com/200/75";e["default"]={name:"image-card",type:"html",render:function(e){var o=e.payload;return''}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/input",["exports"],function(e){e["default"]={name:"input-card",type:"html",render:function(e){var t=e.payload;return"Hello, "+(t.name||"unknown")+"!"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/selfie",["exports"],function(e){e["default"]={name:"selfie-card",type:"html",render:function(e){var t=(e.env,e.payload);return''}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/simple",["exports"],function(e){e["default"]={name:"simple-card",type:"html",render:function(){return"Hello, world"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html",["exports","mobiledoc-kit-demo/mobiledoc-cards/html/input","mobiledoc-kit-demo/mobiledoc-cards/html/selfie","mobiledoc-kit-demo/mobiledoc-cards/html/simple","mobiledoc-kit-demo/mobiledoc-cards/html/image","mobiledoc-kit-demo/mobiledoc-cards/html/codemirror"],function(e,t,o,d,n,r){e["default"]=[t["default"],o["default"],d["default"],n["default"],r["default"]]}),define("mobiledoc-kit-demo/mobiledoc-cards/text/codemirror",["exports"],function(e){e["default"]={name:"codemirror-card",type:"text",render:function(e){var t=e.payload;return t.code?"[code] "+t.code:void 0}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/image",["exports"],function(e){e["default"]={name:"image-card",type:"text",render:function(){return"[image]"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/input",["exports"],function(e){e["default"]={name:"input-card",type:"text",render:function(e){var t=e.payload;return"Hello, "+(t.name||"unknown")+"!"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/selfie",["exports"],function(e){e["default"]={name:"selfie-card",type:"text",render:function(){return"[ :) ]"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/simple",["exports"],function(e){e["default"]={name:"simple-card",type:"text",render:function(){return"Hello, world"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text",["exports","mobiledoc-kit-demo/mobiledoc-cards/text/codemirror","mobiledoc-kit-demo/mobiledoc-cards/text/simple","mobiledoc-kit-demo/mobiledoc-cards/text/input","mobiledoc-kit-demo/mobiledoc-cards/text/image","mobiledoc-kit-demo/mobiledoc-cards/text/selfie"],function(e,t,o,d,n,r){e["default"]=[t["default"],o["default"],d["default"],n["default"],r["default"]]}),define("mobiledoc-kit-demo/mobiledoc-titleize/helper",["exports","ember-mobiledoc-editor/helpers/mobiledoc-titleize"],function(e,t){e["default"]=t["default"],e.mobiledocTitleize=t.mobiledocTitleize}),define("mobiledoc-kit-demo/mobiledocs/index",["exports"],function(e){e["default"]={codemirrorCard:{version:"0.2.0",sections:[[],[[1,"h2",[[[],0,"Codemirror"]]],[10,"codemirror-card"]]]},empty:{version:"0.2.0",sections:[[],[]]},inputCard:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"Input Card"]]],[10,"input-card"],[1,"P",[[[],0,"Text after the card."]]]]]},imageCard:{version:"0.2.0",sections:[[],[[1,"p",[[[],0,"before"]]],[10,"image-card"],[1,"p",[[[],0,"after"]]]]]},selfieCard:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"Selfie Card"]]],[10,"selfie-card"]]]},simpleCard:{version:"0.2.0",sections:[[],[[1,"p",[[[],0,"before"]]],[10,"simple-card"],[1,"p",[[[],0,"after"]]]]]},simpleList:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"To do today:"]]],[3,"ul",[[[[],0,"buy milk"]],[[[],0,"water plants"]],[[[],0,"world domination"]]]]]]},simple:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"Hello World"]]],[1,"p",[[[],0,"This is Mobiledoc-kit."]]]]]}}}),define("mobiledoc-kit-demo/router",["exports","ember","mobiledoc-kit-demo/config/environment"],function(e,t,o){var d=t["default"].Router.extend({location:o["default"].locationType});d.map(function(){}),e["default"]=d}),define("mobiledoc-kit-demo/templates/application",["exports"],function(e){e["default"]=Ember.HTMLBars.template(function(){return{meta:{fragmentReason:{name:"missing-wrapper",problems:["multiple-nodes","wrong-type"]},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:8,column:0}},moduleName:"mobiledoc-kit-demo/templates/application.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createElement("div");e.setAttribute(o,"class","section");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("h1"),n=e.createTextNode("Mobiledoc");e.appendChild(d,n);var n=e.createElement("span");e.setAttribute(n,"class","headline-note");var r=e.createTextNode("beta!");e.appendChild(n,r),e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("p");e.setAttribute(d,"class","subheadline");var n=e.createTextNode("A web-friendly file format for WYSIWYG editors");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");e.appendChild(t,o);var o=e.createElement("hr");e.appendChild(t,o);var o=e.createTextNode("\n\n");e.appendChild(t,o);var o=e.createComment("");e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(e,t,o){var d=new Array(1);return d[0]=e.createMorphAt(t,4,4,o),d},statements:[["content","outlet",["loc",[null,[7,0],[7,10]]]]],locals:[],templates:[]}}())}),define("mobiledoc-kit-demo/templates/components/mobiledoc-dom-renderer",["exports"],function(e){e["default"]=Ember.HTMLBars.template(function(){return{meta:{fragmentReason:{name:"triple-curlies"},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:3,column:0}},moduleName:"mobiledoc-kit-demo/templates/components/mobiledoc-dom-renderer.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createElement("div");e.setAttribute(o,"class","rendered-mobiledoc");var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(){return[]},statements:[],locals:[],templates:[]}}())}),define("mobiledoc-kit-demo/templates/index",["exports"],function(e){e["default"]=Ember.HTMLBars.template(function(){var e=function(){return{meta:{fragmentReason:!1,revision:"Ember@2.2.0",loc:{source:null,start:{line:30,column:6},end:{line:38,column:6}},moduleName:"mobiledoc-kit-demo/templates/index.hbs"},isEmpty:!1,arity:1,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createTextNode(" ");e.appendChild(t,o);var o=e.createElement("button"),d=e.createTextNode("Add image");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n ");e.appendChild(t,o);var o=e.createComment("");e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(e,t,o){var d=e.childAt(t,[1]),n=new Array(2);return n[0]=e.createElementMorph(d),n[1]=e.createMorphAt(t,3,3,o),n},statements:[["element","action",[["get","editor.addCardInEditMode",["loc",[null,[36,25],[36,49]]]],"image-card"],[],["loc",[null,[36,16],[36,64]]]],["inline","mobiledoc-toolbar",[],["editor",["subexpr","@mut",[["get","editor",["loc",[null,[37,35],[37,41]]]]],[],[]]],["loc",[null,[37,8],[37,43]]]]],locals:["editor"],templates:[]}}();return{meta:{fragmentReason:{name:"missing-wrapper",problems:["multiple-nodes"]},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:64,column:0}},moduleName:"mobiledoc-kit-demo/templates/index.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createElement("div");e.setAttribute(o,"class","section");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("p"),n=e.createTextNode("\n Mobiledoc is a publishing solution designed for both text and\n dynamically rendered cards. Posts are serialized into ");e.appendChild(d,n);var n=e.createElement("a");e.setAttribute(n,"href","https://github.com/bustlelabs/mobiledoc-kit/blob/master/MOBILEDOC.md");var r=e.createTextNode("Mobiledoc");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode(", and\n rendered to DOM in a reader's browser.\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("p"),n=e.createTextNode("\n Read more on the ");e.appendChild(d,n);var n=e.createElement("a");e.setAttribute(n,"href","https://github.com/bustlelabs/mobiledoc-kit");var r=e.createTextNode("mobiledoc-kit");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n GitHub repo.\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");e.appendChild(t,o);var o=e.createElement("div");e.setAttribute(o,"class","section");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("br");e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("h2"),n=e.createTextNode("Try a Demo");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");e.appendChild(t,o);var o=e.createElement("div");e.setAttribute(o,"class","container");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("div");e.setAttribute(d,"class","pane");var n=e.createTextNode("\n ");e.appendChild(d,n);var n=e.createElement("div");e.setAttribute(n,"class","output full-left");var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("select");e.setAttribute(r,"id","select-mobiledoc");var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"disabled","");var a=e.createTextNode("Load a new Mobiledoc");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","simple");var a=e.createTextNode("Simple text content");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","empty");var a=e.createTextNode("Empty mobiledoc");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","simpleList");var a=e.createTextNode("List example");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","simpleCard");var a=e.createTextNode("Simple Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","imageCard");var a=e.createTextNode("Image Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","inputCard");var a=e.createTextNode("Card with Input");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","selfieCard");var a=e.createTextNode("Selfie Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","codemirrorCard");var a=e.createTextNode("Codemirror Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n");e.appendChild(n,r);var r=e.createComment("");e.appendChild(n,r);var r=e.createTextNode(" ");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n\n ");e.appendChild(o,d);var d=e.createElement("div");e.setAttribute(d,"class","pane");var n=e.createTextNode("\n ");e.appendChild(d,n);var n=e.createElement("div");e.setAttribute(n,"class","output");var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("h4"),i=e.createTextNode("Mobiledoc Output");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("pre");e.setAttribute(r,"class","serialized-mobiledoc-wrapper");var i=e.createElement("code");e.setAttribute(i,"id","serialized-mobiledoc");var a=e.createComment("");e.appendChild(i,a),e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("div");e.setAttribute(d,"class","pane");var n=e.createTextNode("\n ");e.appendChild(d,n);var n=e.createElement("div");e.setAttribute(n,"class","output full-right");var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("h4"),i=e.createTextNode("Rendered with ");e.appendChild(r,i);var i=e.createComment("");e.appendChild(r,i);var i=e.createTextNode(" renderer");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("ul"),i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("li"),a=e.createTextNode("Use ");e.appendChild(i,a);var a=e.createElement("button"),l=e.createTextNode("DOM-Renderer");e.appendChild(a,l),e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("li"),a=e.createTextNode("Use ");e.appendChild(i,a);var a=e.createElement("button"),l=e.createTextNode("HTML Renderer");e.appendChild(a,l),e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("li"),a=e.createTextNode("Use ");e.appendChild(i,a);var a=e.createElement("button"),l=e.createTextNode("Text Renderer");e.appendChild(a,l),e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("hr");e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createComment("");e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(e,t,o){var d=e.childAt(t,[4]),n=e.childAt(d,[1,1]),r=e.childAt(n,[1]),i=e.childAt(d,[5,1]),a=e.childAt(i,[3]),l=e.childAt(a,[1,1]),c=e.childAt(a,[3,1]),m=e.childAt(a,[5,1]),p=new Array(8);return p[0]=e.createElementMorph(r),p[1]=e.createMorphAt(n,3,3),p[2]=e.createMorphAt(e.childAt(d,[3,1,3,0]),0,0),p[3]=e.createMorphAt(e.childAt(i,[1]),1,1),p[4]=e.createElementMorph(l),p[5]=e.createElementMorph(c),p[6]=e.createElementMorph(m),p[7]=e.createMorphAt(i,7,7),p},statements:[["element","action",["changeMobiledoc"],["on","change"],["loc",[null,[19,36],[19,76]]]],["block","mobiledoc-editor",[],["class","post-editor__editor","mobiledoc",["subexpr","@mut",[["get","mobiledoc",["loc",[null,[32,20],[32,29]]]]],[],[]],"cards",["subexpr","mobiledoc-cards-list",[],[],["loc",[null,[33,16],[33,38]]]],"on-change",["subexpr","action",["didEdit"],[],["loc",[null,[34,20],[34,38]]]]],0,null,["loc",[null,[30,6],[38,27]]]],["inline","format-object",[["get","editedMobiledoc",["loc",[null,[46,24],[46,39]]]]],[],["loc",[null,[46,6],[46,43]]]],["content","rendererName",["loc",[null,[52,24],[52,40]]]],["element","action",["setRenderer","dom"],[],["loc",[null,[54,24],[54,54]]]],["element","action",["setRenderer","html"],[],["loc",[null,[55,24],[55,55]]]],["element","action",["setRenderer","text"],[],["loc",[null,[56,24],[56,55]]]],["inline","component",[["subexpr","concat",["mobiledoc-",["get","rendererName",["loc",[null,[59,39],[59,51]]]],"-renderer"],[],["loc",[null,[59,18],[59,64]]]]],["mobiledoc",["subexpr","@mut",[["get","editedMobiledoc",["loc",[null,[59,75],[59,90]]]]],[],[]]],["loc",[null,[59,6],[59,92]]]]],locals:[],templates:[e]}}())}),define("mobiledoc-kit-demo/config/environment",["ember"],function(e){var t="mobiledoc-kit-demo";try{var o=t+"/config/environment",d=e["default"].$('meta[name="'+o+'"]').attr("content"),n=JSON.parse(unescape(d));return{"default":n}}catch(r){throw new Error('Could not read config from meta tag with name "'+o+'".')}}),runningTests?require("mobiledoc-kit-demo/tests/test-helper"):require("mobiledoc-kit-demo/app")["default"].create({name:"mobiledoc-kit-demo",version:"0.0.0+94507c9f"}); \ No newline at end of file diff --git a/website/demo/assets/mobiledoc-kit-demo-5fbf3ae66387e1e41933809822b210e1.js b/website/demo/assets/mobiledoc-kit-demo-5fbf3ae66387e1e41933809822b210e1.js deleted file mode 100644 index 07e57d1fe..000000000 --- a/website/demo/assets/mobiledoc-kit-demo-5fbf3ae66387e1e41933809822b210e1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";define("mobiledoc-kit-demo/app",["exports","ember","ember/resolver","ember/load-initializers","mobiledoc-kit-demo/config/environment"],function(e,t,o,d,n){var r;t["default"].MODEL_FACTORY_INJECTIONS=!0,r=t["default"].Application.extend({modulePrefix:n["default"].modulePrefix,podModulePrefix:n["default"].podModulePrefix,Resolver:o["default"]}),d["default"](r,n["default"].modulePrefix),e["default"]=r}),define("mobiledoc-kit-demo/components/app-version",["exports","ember-cli-app-version/components/app-version","mobiledoc-kit-demo/config/environment"],function(e,t,o){var d=o["default"].APP,n=d.name,r=d.version;e["default"]=t["default"].extend({version:r,name:n})}),define("mobiledoc-kit-demo/components/ember-wormhole",["exports","ember-wormhole/components/ember-wormhole"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-component-card",["exports","ember-mobiledoc-editor/components/mobiledoc-component-card/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-dom-renderer",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/dom","ember-mobiledoc-dom-renderer"],function(e,t,o,d){var n=t["default"].run,r=new d["default"]({cards:o["default"]});e["default"]=t["default"].Component.extend({didRender:function(){var e=this,t=this.get("mobiledoc");t&&n(function(){e._teardownRender&&(e._teardownRender(),e._teardownRender=null);var o=e.$(),d=r.render(t),n=d.result,i=d.teardown;o.append(n),e._teardownRender=i})}})}),define("mobiledoc-kit-demo/components/mobiledoc-editor",["exports","ember-mobiledoc-editor/components/mobiledoc-editor/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-html-renderer",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/html","ember-mobiledoc-html-renderer"],function(e,t,o,d){var n=t["default"].run,r=new d["default"]({cards:o["default"]});e["default"]=t["default"].Component.extend({didRender:function(){var e=this,t=this.get("mobiledoc");t&&n(function(){var o=e.$(),d=r.render(t),n=d.result;o.text(n)})}})}),define("mobiledoc-kit-demo/components/mobiledoc-link-button",["exports","ember-mobiledoc-editor/components/mobiledoc-link-button/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-link-prompt",["exports","ember-mobiledoc-editor/components/mobiledoc-link-prompt/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-markup-button",["exports","ember-mobiledoc-editor/components/mobiledoc-markup-button/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-section-button",["exports","ember-mobiledoc-editor/components/mobiledoc-section-button/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/mobiledoc-text-renderer",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/text","ember-mobiledoc-text-renderer"],function(e,t,o,d){var n=t["default"].run,r=new d["default"]({cards:o["default"]}),i=function(e){return e.replace(//g,">").replace(/\n/g,"
")};e["default"]=t["default"].Component.extend({didRender:function(){var e=this,t=this.get("mobiledoc");t&&n(function(){e._teardownRender&&(e._teardownRender(),e._teardownRender=null);var o=e.$(),d=r.render(t),n=d.result,a=d.teardown;n=i(n),o.html(n),e._teardownRender=a})}})}),define("mobiledoc-kit-demo/components/mobiledoc-toolbar",["exports","ember-mobiledoc-editor/components/mobiledoc-toolbar/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/render-mobiledoc",["exports","ember-mobiledoc-dom-renderer/components/render-mobiledoc"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/components/tether-to-selection",["exports","ember-mobiledoc-editor/components/tether-to-selection/component"],function(e,t){e["default"]=t["default"]}),define("mobiledoc-kit-demo/controllers/array",["exports","ember"],function(e,t){e["default"]=t["default"].Controller}),define("mobiledoc-kit-demo/controllers/index",["exports","ember","mobiledoc-kit-demo/mobiledocs/index"],function(e,t,o){var d=t["default"].$;e["default"]=t["default"].Controller.extend({init:function(){this._super.apply(this,arguments);var e=o["default"].simple;this.set("mobiledoc",e),this.set("editedMobiledoc",e),this.set("rendererName","dom")},actions:{changeMobiledoc:function(){var e=d("#select-mobiledoc"),t=e.val(),n=o["default"][t];this.set("mobiledoc",n),this.set("editedMobiledoc",n)},setRenderer:function(e){this.set("rendererName",e)},didEdit:function(e){this.set("editedMobiledoc",e)}}})}),define("mobiledoc-kit-demo/controllers/object",["exports","ember"],function(e,t){e["default"]=t["default"].Controller}),define("mobiledoc-kit-demo/helpers/format-object",["exports","ember"],function(e,t){function o(e){var t=d(e,1),o=t[0];return JSON.stringify(o,null," ")}e.formatObject=o;var d=function(){function e(e,t){var o=[],d=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(d=(i=a.next()).done)&&(o.push(i.value),!t||o.length!==t);d=!0);}catch(l){n=!0,r=l}finally{try{!d&&a["return"]&&a["return"]()}finally{if(n)throw r}}return o}return function(t,o){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e["default"]=t["default"].Helper.helper(o)}),define("mobiledoc-kit-demo/helpers/hash",["exports","ember-mobiledoc-editor/helpers/hash"],function(e,t){e["default"]=t["default"],e.hash=t.hash}),define("mobiledoc-kit-demo/helpers/in-array",["exports","ember-mobiledoc-editor/helpers/in-array"],function(e,t){e["default"]=t["default"],e.inArray=t.inArray}),define("mobiledoc-kit-demo/helpers/mobiledoc-cards-list",["exports","ember","mobiledoc-kit-demo/mobiledoc-cards/dom"],function(e,t,o){function d(){return o["default"]}e.mobiledocCardsList=d,e["default"]=t["default"].Helper.helper(d)}),define("mobiledoc-kit-demo/initializers/app-version",["exports","ember-cli-app-version/initializer-factory","mobiledoc-kit-demo/config/environment"],function(e,t,o){var d=o["default"].APP,n=d.name,r=d.version;e["default"]={name:"App Version",initialize:t["default"](n,r)}}),define("mobiledoc-kit-demo/initializers/export-application-global",["exports","ember","mobiledoc-kit-demo/config/environment"],function(e,t,o){function d(){var e=arguments[1]||arguments[0];if(o["default"].exportApplicationGlobal!==!1){var d,n=o["default"].exportApplicationGlobal;d="string"==typeof n?n:t["default"].String.classify(o["default"].modulePrefix),window[d]||(window[d]=e,e.reopen({willDestroy:function(){this._super.apply(this,arguments),delete window[d]}}))}}e.initialize=d,e["default"]={name:"export-application-global",initialize:d}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/codemirror",["exports"],function(e){function t(e,t){var o=arguments.length<=2||void 0===arguments[2]?!0:arguments[2],d=arguments.length<=3||void 0===arguments[3]?function(){}:arguments[3];setTimeout(function(){var n=$("").appendTo(e),r={mode:"javascript"};o&&(r.readOnly="nocursor");var i=CodeMirror.fromTextArea(n[0],r);d(i)})}var o="let x = 3;";e["default"]={name:"codemirror-card",type:"dom",render:function(e){var d=e.env,n=(e.options,e.payload),r=$("
")[0],i=n.code||o;d.isInEditor&&$("").appendTo(r).on("click",d.edit);var a=!0;return t(r,i,a),r},edit:function(e){var d=e.env,n=(e.options,e.payload),r=$("
")[0],i=n.code||o,a=$("").appendTo(r),l=!1,c=function(e){a.on("click",function(){return d.save({code:e.getValue()})})};return t(r,i,l,c),r}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/image",["exports"],function(e){function t(){var e=arguments.length<=0||void 0===arguments[0]?o:arguments[0];return $("
").append('')[0]}var o="http://placekitten.com/200/75";e["default"]={name:"image-card",type:"dom",render:function(e){var o=e.env,d=e.payload,n=t(d.src),r=o.isInEditor;return r&&$("").appendTo(n).on("click",o.edit),n},edit:function(e){function o(e){var t=new FileReader,o=e.target.files[0];t.onloadend=function(){d.save({src:t.result})},t.readAsDataURL(o)}var d=e.env,n=e.payload,r=t(n.src);return $('').appendTo(r).on("change",o),$("").appendTo(r).on("click",function(){d.save(n)}),r}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/input",["exports","ember"],function(e,t){var o=t["default"].$;e["default"]={name:"input-card",type:"dom",render:function(e){var t=e.env,d=e.payload,n="I am in display mode";d.name&&(n="Hello, "+d.name+"!");var r=o("
"+n+"
"),i=o("");return i.on("click",t.edit),t.edit&&r.append(i),r[0]},edit:function(e){var t=e.env,d=o("
What is your name?
");d.innerHTML="What is your name?";var n=o(''),r=o("");return r.on("click",function(){var e=n.val();t.save({name:e})}),d.append(n),d.append(r),d[0]}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/selfie",["exports","ember"],function(e,t){var o=t["default"].$;e["default"]={name:"selfie-card",type:"dom",render:function(e){var t=e.env,d=e.payload,n=o("
")[0],r=t.isInEditor;return d.src?o('

You look nice today.
'+(r?"
":"")+"
").appendTo(n):o("
Hello there!"+(r?"":"")+"
").appendTo(n),r&&setTimeout(function(){o("#go-edit").on("click",t.edit)}),n},edit:function(e){var t=e.env,d=o("
")[0];return o('
').appendTo(d),setTimeout(function(){var e=document.getElementById("canvas"),d=e.getContext("2d"),n=document.getElementById("video"),r={video:!0},i=function(){return alert("error getting video feed")};navigator.getMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getMedia(r,function(r){var i=void 0;navigator.mozGetUserMedia?n.mozSrcObject=r:(i=window.URL||window.webkitURL,n.src=i.createObjectURL(r),n.play()),o("#snap").click(function(){d.drawImage(n,0,0,400,300);var o=e.toDataURL("image/png");t.save({src:o})})},i)}),d}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom/simple",["exports","ember"],function(e,t){var o=t["default"].$;e["default"]={name:"simple-card",type:"dom",render:function(e){var t=e.env,d=document.createElement("div"),n=document.createElement("span");n.innerHTML="Hello, world",d.appendChild(n);var r=o("");return r.on("click",t.remove),d}}}),define("mobiledoc-kit-demo/mobiledoc-cards/dom",["exports","mobiledoc-kit-demo/mobiledoc-cards/dom/input","mobiledoc-kit-demo/mobiledoc-cards/dom/simple","mobiledoc-kit-demo/mobiledoc-cards/dom/selfie","mobiledoc-kit-demo/mobiledoc-cards/dom/image","mobiledoc-kit-demo/mobiledoc-cards/dom/codemirror"],function(e,t,o,d,n,r){e["default"]=[t["default"],o["default"],d["default"],n["default"],r["default"]]}),define("mobiledoc-kit-demo/mobiledoc-cards/html/codemirror",["exports"],function(e){e["default"]={name:"codemirror-card",type:"html",render:function(e){var t=e.payload;return t.code?""+t.code+"":void 0}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/image",["exports"],function(e){var t="http://placekitten.com/200/75";e["default"]={name:"image-card",type:"html",render:function(e){var o=e.payload;return''}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/input",["exports"],function(e){e["default"]={name:"input-card",type:"html",render:function(e){var t=e.payload;return"Hello, "+(t.name||"unknown")+"!"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/selfie",["exports"],function(e){e["default"]={name:"selfie-card",type:"html",render:function(e){var t=(e.env,e.payload);return''}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html/simple",["exports"],function(e){e["default"]={name:"simple-card",type:"html",render:function(){return"Hello, world"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/html",["exports","mobiledoc-kit-demo/mobiledoc-cards/html/input","mobiledoc-kit-demo/mobiledoc-cards/html/selfie","mobiledoc-kit-demo/mobiledoc-cards/html/simple","mobiledoc-kit-demo/mobiledoc-cards/html/image","mobiledoc-kit-demo/mobiledoc-cards/html/codemirror"],function(e,t,o,d,n,r){e["default"]=[t["default"],o["default"],d["default"],n["default"],r["default"]]}),define("mobiledoc-kit-demo/mobiledoc-cards/text/codemirror",["exports"],function(e){e["default"]={name:"codemirror-card",type:"text",render:function(e){var t=e.payload;return t.code?"[code] "+t.code:void 0}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/image",["exports"],function(e){e["default"]={name:"image-card",type:"text",render:function(){return"[image]"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/input",["exports"],function(e){e["default"]={name:"input-card",type:"text",render:function(e){var t=e.payload;return"Hello, "+(t.name||"unknown")+"!"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/selfie",["exports"],function(e){e["default"]={name:"selfie-card",type:"text",render:function(){return"[ :) ]"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text/simple",["exports"],function(e){e["default"]={name:"simple-card",type:"text",render:function(){return"Hello, world"}}}),define("mobiledoc-kit-demo/mobiledoc-cards/text",["exports","mobiledoc-kit-demo/mobiledoc-cards/text/codemirror","mobiledoc-kit-demo/mobiledoc-cards/text/simple","mobiledoc-kit-demo/mobiledoc-cards/text/input","mobiledoc-kit-demo/mobiledoc-cards/text/image","mobiledoc-kit-demo/mobiledoc-cards/text/selfie"],function(e,t,o,d,n,r){e["default"]=[t["default"],o["default"],d["default"],n["default"],r["default"]]}),define("mobiledoc-kit-demo/mobiledoc-titleize/helper",["exports","ember-mobiledoc-editor/helpers/mobiledoc-titleize"],function(e,t){e["default"]=t["default"],e.mobiledocTitleize=t.mobiledocTitleize}),define("mobiledoc-kit-demo/mobiledocs/index",["exports"],function(e){e["default"]={codemirrorCard:{version:"0.2.0",sections:[[],[[1,"h2",[[[],0,"Codemirror"]]],[10,"codemirror-card"]]]},empty:{version:"0.2.0",sections:[[],[]]},inputCard:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"Input Card"]]],[10,"input-card"],[1,"P",[[[],0,"Text after the card."]]]]]},imageCard:{version:"0.2.0",sections:[[],[[1,"p",[[[],0,"before"]]],[10,"image-card"],[1,"p",[[[],0,"after"]]]]]},selfieCard:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"Selfie Card"]]],[10,"selfie-card"]]]},simpleCard:{version:"0.2.0",sections:[[],[[1,"p",[[[],0,"before"]]],[10,"simple-card"],[1,"p",[[[],0,"after"]]]]]},simpleList:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"To do today:"]]],[3,"ul",[[[[],0,"buy milk"]],[[[],0,"water plants"]],[[[],0,"world domination"]]]]]]},simple:{version:"0.2.0",sections:[[],[[1,"H2",[[[],0,"Hello World"]]],[1,"p",[[[],0,"This is Mobiledoc-kit."]]]]]}}}),define("mobiledoc-kit-demo/router",["exports","ember","mobiledoc-kit-demo/config/environment"],function(e,t,o){var d=t["default"].Router.extend({location:o["default"].locationType});d.map(function(){}),e["default"]=d}),define("mobiledoc-kit-demo/templates/application",["exports"],function(e){e["default"]=Ember.HTMLBars.template(function(){return{meta:{fragmentReason:{name:"missing-wrapper",problems:["multiple-nodes","wrong-type"]},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:8,column:0}},moduleName:"mobiledoc-kit-demo/templates/application.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createElement("div");e.setAttribute(o,"class","section");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("h1"),n=e.createTextNode("Mobiledoc");e.appendChild(d,n);var n=e.createElement("span");e.setAttribute(n,"class","headline-note");var r=e.createTextNode("beta!");e.appendChild(n,r),e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("p");e.setAttribute(d,"class","subheadline");var n=e.createTextNode("A web-friendly file format for WYSIWYG editors");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");e.appendChild(t,o);var o=e.createElement("hr");e.appendChild(t,o);var o=e.createTextNode("\n\n");e.appendChild(t,o);var o=e.createComment("");e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(e,t,o){var d=new Array(1);return d[0]=e.createMorphAt(t,4,4,o),d},statements:[["content","outlet",["loc",[null,[7,0],[7,10]]]]],locals:[],templates:[]}}())}),define("mobiledoc-kit-demo/templates/components/mobiledoc-dom-renderer",["exports"],function(e){e["default"]=Ember.HTMLBars.template(function(){return{meta:{fragmentReason:{name:"triple-curlies"},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:3,column:0}},moduleName:"mobiledoc-kit-demo/templates/components/mobiledoc-dom-renderer.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createElement("div");e.setAttribute(o,"class","rendered-mobiledoc");var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(){return[]},statements:[],locals:[],templates:[]}}())}),define("mobiledoc-kit-demo/templates/index",["exports"],function(e){e["default"]=Ember.HTMLBars.template(function(){var e=function(){return{meta:{fragmentReason:!1,revision:"Ember@2.2.0",loc:{source:null,start:{line:30,column:6},end:{line:38,column:6}},moduleName:"mobiledoc-kit-demo/templates/index.hbs"},isEmpty:!1,arity:1,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createTextNode(" ");e.appendChild(t,o);var o=e.createElement("button"),d=e.createTextNode("Add image");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n ");e.appendChild(t,o);var o=e.createComment("");e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(e,t,o){var d=e.childAt(t,[1]),n=new Array(2);return n[0]=e.createElementMorph(d),n[1]=e.createMorphAt(t,3,3,o),n},statements:[["element","action",[["get","editor.addCardInEditMode",["loc",[null,[36,25],[36,49]]]],"image-card"],[],["loc",[null,[36,16],[36,64]]]],["inline","mobiledoc-toolbar",[],["editor",["subexpr","@mut",[["get","editor",["loc",[null,[37,35],[37,41]]]]],[],[]]],["loc",[null,[37,8],[37,43]]]]],locals:["editor"],templates:[]}}();return{meta:{fragmentReason:{name:"missing-wrapper",problems:["multiple-nodes"]},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:64,column:0}},moduleName:"mobiledoc-kit-demo/templates/index.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),o=e.createElement("div");e.setAttribute(o,"class","section");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("p"),n=e.createTextNode("\n Mobiledoc is a publishing solution designed for both text and\n dynamically rendered cards. Posts are serialized into ");e.appendChild(d,n);var n=e.createElement("a");e.setAttribute(n,"href","https://github.com/bustlelabs/mobiledoc-kit/blob/master/MOBILEDOC.md");var r=e.createTextNode("Mobiledoc");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode(", and\n rendered to DOM in a reader's browser.\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("p"),n=e.createTextNode("\n Read more on the ");e.appendChild(d,n);var n=e.createElement("a");e.setAttribute(n,"href","https://github.com/bustlelabs/mobiledoc-kit");var r=e.createTextNode("mobiledoc-kit");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n GitHub repo.\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");e.appendChild(t,o);var o=e.createElement("div");e.setAttribute(o,"class","section");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("br");e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("h2"),n=e.createTextNode("Try a Demo");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");e.appendChild(t,o);var o=e.createElement("div");e.setAttribute(o,"class","container");var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("div");e.setAttribute(d,"class","pane");var n=e.createTextNode("\n ");e.appendChild(d,n);var n=e.createElement("div");e.setAttribute(n,"class","output full-left");var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("select");e.setAttribute(r,"id","select-mobiledoc");var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"disabled","");var a=e.createTextNode("Load a new Mobiledoc");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","simple");var a=e.createTextNode("Simple text content");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","empty");var a=e.createTextNode("Empty mobiledoc");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","simpleList");var a=e.createTextNode("List example");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","simpleCard");var a=e.createTextNode("Simple Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","imageCard");var a=e.createTextNode("Image Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","inputCard");var a=e.createTextNode("Card with Input");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","selfieCard");var a=e.createTextNode("Selfie Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("option");e.setAttribute(i,"value","codemirrorCard");var a=e.createTextNode("Codemirror Card");e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n");e.appendChild(n,r);var r=e.createComment("");e.appendChild(n,r);var r=e.createTextNode(" ");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n\n ");e.appendChild(o,d);var d=e.createElement("div");e.setAttribute(d,"class","pane");var n=e.createTextNode("\n ");e.appendChild(d,n);var n=e.createElement("div");e.setAttribute(n,"class","output");var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("h4"),i=e.createTextNode("Mobiledoc Output");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("pre");e.setAttribute(r,"class","serialized-mobiledoc-wrapper");var i=e.createElement("code");e.setAttribute(i,"id","serialized-mobiledoc");var a=e.createComment("");e.appendChild(i,a),e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n ");e.appendChild(o,d);var d=e.createElement("div");e.setAttribute(d,"class","pane");var n=e.createTextNode("\n ");e.appendChild(d,n);var n=e.createElement("div");e.setAttribute(n,"class","output full-right");var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("h4"),i=e.createTextNode("Rendered with ");e.appendChild(r,i);var i=e.createComment("");e.appendChild(r,i);var i=e.createTextNode(" renderer");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("ul"),i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("li"),a=e.createTextNode("Use ");e.appendChild(i,a);var a=e.createElement("button"),l=e.createTextNode("DOM-Renderer");e.appendChild(a,l),e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("li"),a=e.createTextNode("Use ");e.appendChild(i,a);var a=e.createElement("button"),l=e.createTextNode("HTML Renderer");e.appendChild(a,l),e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i);var i=e.createElement("li"),a=e.createTextNode("Use ");e.appendChild(i,a);var a=e.createElement("button"),l=e.createTextNode("Text Renderer");e.appendChild(a,l),e.appendChild(i,a),e.appendChild(r,i);var i=e.createTextNode("\n ");e.appendChild(r,i),e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createElement("hr");e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r);var r=e.createComment("");e.appendChild(n,r);var r=e.createTextNode("\n ");e.appendChild(n,r),e.appendChild(d,n);var n=e.createTextNode("\n ");e.appendChild(d,n),e.appendChild(o,d);var d=e.createTextNode("\n\n");e.appendChild(o,d),e.appendChild(t,o);var o=e.createTextNode("\n");return e.appendChild(t,o),t},buildRenderNodes:function(e,t,o){var d=e.childAt(t,[4]),n=e.childAt(d,[1,1]),r=e.childAt(n,[1]),i=e.childAt(d,[5,1]),a=e.childAt(i,[3]),l=e.childAt(a,[1,1]),c=e.childAt(a,[3,1]),m=e.childAt(a,[5,1]),p=new Array(8);return p[0]=e.createElementMorph(r),p[1]=e.createMorphAt(n,3,3),p[2]=e.createMorphAt(e.childAt(d,[3,1,3,0]),0,0),p[3]=e.createMorphAt(e.childAt(i,[1]),1,1),p[4]=e.createElementMorph(l),p[5]=e.createElementMorph(c),p[6]=e.createElementMorph(m),p[7]=e.createMorphAt(i,7,7),p},statements:[["element","action",["changeMobiledoc"],["on","change"],["loc",[null,[19,36],[19,76]]]],["block","mobiledoc-editor",[],["class","post-editor__editor","mobiledoc",["subexpr","@mut",[["get","mobiledoc",["loc",[null,[32,20],[32,29]]]]],[],[]],"cards",["subexpr","mobiledoc-cards-list",[],[],["loc",[null,[33,16],[33,38]]]],"on-change",["subexpr","action",["didEdit"],[],["loc",[null,[34,20],[34,38]]]]],0,null,["loc",[null,[30,6],[38,27]]]],["inline","format-object",[["get","editedMobiledoc",["loc",[null,[46,24],[46,39]]]]],[],["loc",[null,[46,6],[46,43]]]],["content","rendererName",["loc",[null,[52,24],[52,40]]]],["element","action",["setRenderer","dom"],[],["loc",[null,[54,24],[54,54]]]],["element","action",["setRenderer","html"],[],["loc",[null,[55,24],[55,55]]]],["element","action",["setRenderer","text"],[],["loc",[null,[56,24],[56,55]]]],["inline","component",[["subexpr","concat",["mobiledoc-",["get","rendererName",["loc",[null,[59,39],[59,51]]]],"-renderer"],[],["loc",[null,[59,18],[59,64]]]]],["mobiledoc",["subexpr","@mut",[["get","editedMobiledoc",["loc",[null,[59,75],[59,90]]]]],[],[]]],["loc",[null,[59,6],[59,92]]]]],locals:[],templates:[e]}}())}),define("mobiledoc-kit-demo/config/environment",["ember"],function(e){var t="mobiledoc-kit-demo";try{var o=t+"/config/environment",d=e["default"].$('meta[name="'+o+'"]').attr("content"),n=JSON.parse(unescape(d));return{"default":n}}catch(r){throw new Error('Could not read config from meta tag with name "'+o+'".')}}),runningTests?require("mobiledoc-kit-demo/tests/test-helper"):require("mobiledoc-kit-demo/app")["default"].create({name:"mobiledoc-kit-demo",version:"0.0.0+ea57d2f4"}); \ No newline at end of file diff --git a/website/demo/assets/vendor-6a74a58011942a2866f5e4130abbf9c2.js b/website/demo/assets/vendor-76170da5950856e207f7592fda4777cd.js similarity index 64% rename from website/demo/assets/vendor-6a74a58011942a2866f5e4130abbf9c2.js rename to website/demo/assets/vendor-76170da5950856e207f7592fda4777cd.js index 7db3a6eb9..a7d25de7c 100644 --- a/website/demo/assets/vendor-6a74a58011942a2866f5e4130abbf9c2.js +++ b/website/demo/assets/vendor-76170da5950856e207f7592fda4777cd.js @@ -15,15 +15,15 @@ this.scheduledRevalidation=!1},h.scheduleRevalidate=function(e,t,r){return e&&!t }),y.reopenClass({views:{},childViewsProperty:a.childViewsProperty});var w=y.extend({init:function(){b(),this._super.apply(this,arguments)}});w.reopen=function(){return b(),y.reopen.apply(y,arguments),this},e["default"]=y,e.ViewContextSupport=o["default"],e.ViewChildViewsSupport=a["default"],e.ViewStateSupport=l["default"],e.TemplateRenderingSupport=u["default"],e.ClassNamesSupport=c["default"],e.DeprecatedView=w}),e("ember-views",["exports","ember-runtime","ember-views/system/jquery","ember-views/system/utils","ember-views/system/ext","ember-views/views/states","ember-metal-views/renderer","ember-views/views/core_view","ember-views/views/view","ember-views/views/container_view","ember-views/views/collection_view","ember-views/components/component","ember-views/system/event_dispatcher","ember-views/mixins/view_target_action_support","ember-views/component_lookup","ember-views/views/checkbox","ember-views/mixins/text_support","ember-views/views/text_field","ember-views/views/text_area","ember-views/views/select","ember-views/compat/metamorph_view","ember-views/views/legacy_each_view"],function(e,t,r,n,i,o,a,s,l,u,c,d,f,h,p,m,v,g,b,y,w,_){"use strict";t["default"].$=r["default"],t["default"].ViewTargetActionSupport=h["default"];var k=t["default"].ViewUtils={};k.isSimpleClick=n.isSimpleClick,k.getViewClientRects=n.getViewClientRects,k.getViewBoundingClientRect=n.getViewBoundingClientRect,t["default"].ENV._ENABLE_LEGACY_VIEW_SUPPORT&&(t["default"].CoreView=s.DeprecatedCoreView,t["default"].View=l.DeprecatedView,t["default"].View.states=o.states,t["default"].View.cloneStates=o.cloneStates,t["default"].View._Renderer=a["default"],t["default"].ContainerView=u.DeprecatedContainerView,t["default"].CollectionView=c["default"]),t["default"]._Renderer=a["default"],t["default"].Checkbox=m["default"],t["default"].TextField=g["default"],t["default"].TextArea=b["default"],t["default"].ENV._ENABLE_LEGACY_VIEW_SUPPORT&&(t["default"].Select=y.Select),t["default"].SelectOption=y.SelectOption,t["default"].SelectOptgroup=y.SelectOptgroup,t["default"].TextSupport=v["default"],t["default"].ComponentLookup=p["default"],t["default"].Component=d["default"],t["default"].EventDispatcher=f["default"],t["default"].ENV._ENABLE_LEGACY_VIEW_SUPPORT&&(t["default"]._Metamorph=w._Metamorph,t["default"]._MetamorphView=w["default"],t["default"]._LegacyEachView=_["default"]),e["default"]=t["default"]}),e("ember",["exports","ember-metal","ember-runtime","ember-views","ember-routing","ember-application","ember-extension-support","ember-htmlbars","ember-routing-htmlbars","ember-routing-views","ember-metal/core","ember-runtime/system/lazy_load"],function(e,r,n,i,o,a,s,l,u,c,d,f){"use strict";d["default"].__loader.registry["ember-template-compiler"]&&t("ember-template-compiler"),d["default"].__loader.registry["ember-testing"]&&t("ember-testing"),f.runLoadHooks("Ember")}),e("htmlbars-runtime/expression-visitor",["exports"],function(e){"use strict";function t(e,t,r){for(var i=[],o=0,a=e.length;a>o;o++)i.push(n(e[o],t,r).value);return i}function r(e,t,r){for(var i={},o=0,a=e.length;a>o;o+=2){var s=e[o],l=e[o+1];i[s]=n(l,t,r).value}return i}function n(e,t,r){var n={value:null};return"object"!=typeof e||null===e?n.value=e:n.value=i(e,t,r),n}function i(e,t,r){switch(e[0]){case"value":return e[1];case"get":return o(e,t,r);case"subexpr":return a(e,t,r);case"concat":return s(e,t,r)}}function o(e,t,r){var n=e[1];return t.hooks.get(t,r,n)}function a(e,n,i){var o=e[1],a=e[2],s=e[3],l=t(a,n,i),u=r(s,n,i);return n.hooks.subexpr(n,i,o,l,u)}function s(e,r,n){var i=e[1],o=t(i,r,n);return r.hooks.concat(r,o)}e.acceptParams=t,e.acceptHash=r}),e("htmlbars-runtime/hooks",["exports","htmlbars-runtime/render","morph-range/morph-list","htmlbars-util/object-utils","htmlbars-util/morph-utils","htmlbars-util/template-utils"],function(e,t,r,n,i,o){"use strict";function a(e){return null===e?null:{meta:e.meta,arity:e.arity,raw:e,render:function(r,n,i,o){var a=n.hooks.createFreshScope(),s=i&&i.contextualElement,l=new t.RenderOptions(null,r,o,s);return t["default"](e,n,a,l)}}}function s(e,t,r,n,i,o){if(!e)return{};var a=l(e,t,r,n,i,o);return{meta:e.meta,arity:e.arity,"yield":a,yieldItem:u(e,t,r,n,i,o),raw:e,render:function(e,t){a(t,e)}}}function l(e,r,n,i,a,s){return function(l,u){a.morphToClear=null,i.morphList&&(o.clearMorphList(i.morphList,i,r),a.morphListToClear=null);var d=n;if(i.lastYielded&&c(e,i.lastYielded))return i.lastResult.revalidateWith(r,void 0,u,l,s);(void 0!==u||null===n||e.arity)&&(d=r.hooks.createChildScope(n)),i.lastYielded={self:u,template:e,shadowTemplate:null};var f=new t.RenderOptions(i,u,l);t["default"](e,r,d,f)}}function u(e,n,i,o,a,s){function u(e){for(var t=c;t.key!==e;)d[t.key]=t,t=t.nextMorph;return c=t.nextMorph,t}var c=null,d={},f=o.morphList;return f&&(c=f.firstChildMorph),function(f,h,p){if("string"!=typeof f)throw new Error("You must provide a string key when calling `yieldItem`; you provided "+f);a.morphListToClear=null,o.lastYielded=null;var m,v;o.morphList||(o.morphList=new r["default"],o.morphMap={},o.setMorphList(o.morphList)),m=o.morphList,v=o.morphMap;var g=a.handledMorphs,b=void 0;if(f in g){var y=a.collisions;void 0===y&&(y=a.collisions={});var w=0|y[f];y[f]=++w,b=f+"--z8mS2hvDW0A--"+w}else b=f;if(c&&c.key===b)l(e,n,i,c,a,s)(h,p),c=c.nextMorph,g[b]=c;else if(void 0!==v[b]){var _=v[b];b in d?m.insertBeforeMorph(_,c):u(b),g[_.key]=_,l(e,n,i,_,a,s)(h,p)}else{var k=t.createChildMorph(n.dom,o);k.key=b,v[b]=g[b]=k,m.insertBeforeMorph(k,c),l(e,n,i,k,a,s)(h,p)}a.morphListToPrune=m,o.childNodes=null}}function c(e,t){return!t.shadowTemplate&&e===t.template}function d(e,t,r,n,i,a){var l=i.lastResult?i:null,u=new o.RenderState(l,i.morphList||null);return{templates:{template:s(e,r,n,i,u,a),inverse:s(t,r,n,i,u,a)},renderState:u}}function f(e){return{arity:e.template.arity,"yield":e.template["yield"],yieldItem:e.template.yieldItem,yieldIn:e.template.yieldIn}}function h(e,t){return t?e.hooks.createChildScope(t):e.hooks.createFreshScope()}function p(){return{self:null,blocks:{},locals:{},localPresent:{}}}function m(e){return e.hooks.createFreshScope()}function v(e){var t=Object.create(e);return t.locals=Object.create(e.locals),t.localPresent=Object.create(e.localPresent),t.blocks=Object.create(e.blocks),t}function g(e,t,r){t.self=r}function b(e,t,r){e.hooks.bindSelf(e,t,r)}function y(e,t,r,n){t.localPresent[r]=!0,t.locals[r]=n}function w(e,t,r,n){e.hooks.bindLocal(e,t,r,n)}function _(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?"default":arguments[3];t.blocks[n]=r}function k(e,t,r,n,i,o,a,s,l){E(e,t,r,n,i,o,a,s,l)||x(e,t,r,n,i,o,a,s,l)}function x(e,t,r,n,i,o,a,s,l){C(e,t,r,a,s,null,l,function(a){var s=t.hooks.lookupHelper(t,r,n);return t.hooks.invokeHelper(e,t,r,l,i,o,s,a.templates,f(a.templates))})}function C(e,t,r,n,i,a,s,l){var u=d(n,i,t,r,e,s);o.renderAndCleanup(e,t,u,a,l)}function E(e,t,r,n,i,o,a,s,l){if(!n)return!1;var u=t.hooks.classify(t,r,n);if(u){switch(u){case"component":t.hooks.component(e,t,r,n,i,o,{"default":a,inverse:s},l);break;case"inline":t.hooks.inline(e,t,r,n,i,o,l);break;case"block":t.hooks.block(e,t,r,n,i,o,a,s,l);break;default:throw new Error("Internal HTMLBars redirection to "+u+" not supported")}return!0}return S(n,e,t,r,i,o,a,s,l)?!0:!1}function S(e,t,r,a,s,l,u,c,d){var f=r.hooks.keywords[e];if(!f)return!1;if("function"==typeof f)return f(t,r,a,s,l,u,c,d);f.willRender&&f.willRender(t,r);var h,p;f.setupState&&(h=n.shallowCopy(t.getState()),p=t.setState(f.setupState(h,r,a,s,l))),f.childEnv&&(r=f.childEnv(t.getState(),r),t.buildChildEnv=f.childEnv);var m=!t.rendered;if(f.isEmpty){var v=f.isEmpty(t.getState(),r,a,s,l);if(v)return m||o.clearMorph(t,r,!1),!0}if(m)return f.render&&f.render(t,r,a,s,l,u,c,d),t.rendered=!0,!0;var g;if(g=f.isStable?f.isStable(h,p):T(h,p)){if(f.rerender){var b=f.rerender(t,r,a,s,l,u,c,d);r=b||r}return i.validateChildMorphs(r,t,d),!0}return o.clearMorph(t,r,!1),f.render?(f.render(t,r,a,s,l,u,c,d),t.rendered=!0,!0):void 0}function T(e,t){if(n.keyLength(e)!==n.keyLength(t))return!1;for(var r in e)if(e[r]!==t[r])return!1;return!0}function N(){}function A(e,t,r,n,o,a,s){if(!E(e,t,r,n,o,a,null,null,s)){var l=void 0,u=void 0;if(e.linkedResult)l=t.hooks.getValue(e.linkedResult),u=!0;else{var c=d(null,null,t,r,e),h=t.hooks.lookupHelper(t,r,n),p=t.hooks.invokeHelper(e,t,r,s,o,a,h,c.templates,f(c.templates));p&&p.link&&(e.linkedResult=p.value,i.linkParams(t,r,e,"@content-helper",[e.linkedResult],null)),p&&"value"in p&&(l=t.hooks.getValue(p.value),u=!0)}u&&(e.lastValue!==l&&e.setContent(l),e.lastValue=l)}}function O(e,t,r,n,i,o,a,s,l){S(e,t,r,n,i,o,a,s,l)}function M(e,t,r,n,i,o,a,s,l){var u=L(t,i),c=P(t,o);return{value:a.call(l,u,c,s)}}function L(e,t){for(var r=new Array(t.length),n=0,i=t.length;i>n;n++)r[n]=e.hooks.getCellOrValue(t[n]);return r}function P(e,t){var r={};for(var n in t)r[n]=e.hooks.getCellOrValue(t[n]);return r}function R(){return null}function D(e,t,r,n){var i=t.partials[n];return i.render(r.self,t,{}).fragment}function I(e,t,r,n,i,o){E(e,t,r,n,[i],{},null,null,o)||(i=t.hooks.getValue(i),e.lastValue!==i&&e.setContent(i),e.lastValue=i)}function j(e,t,r,n,i,o,a){if(!E(e,t,r,n,i,o,null,null,a)){var s=t.hooks.lookupHelper(t,r,n);s&&t.hooks.invokeHelper(null,t,r,null,i,o,s,{element:e.element})}}function F(e,t,r,n,i){i=t.hooks.getValue(i),e.lastValue!==i&&e.setContent(i),e.lastValue=i}function H(e,t,r,n,i){var o=e.hooks.lookupHelper(e,t,r),a=e.hooks.invokeHelper(null,e,t,null,n,i,o,{});return a&&"value"in a?e.hooks.getValue(a.value):void 0}function V(e,t,r){if(""===r)return t.self;for(var n=r.split("."),i=e.hooks.getRoot(t,n[0])[0],o=1;on;n++)r+=e.hooks.getValue(t[n]);return r}function Y(e,r,n,i,o,a){var s=r.dom.createElement(i);for(var l in o)s.setAttribute(l,r.hooks.getValue(o[l]));var u=t["default"](a,r,n,{}).fragment;s.appendChild(u),e.setNode(s)}function $(e,t,r){return void 0!==e.helpers[r]}function Q(e,t,r){return e.helpers[r]}function X(){}function J(e,t){e.hooks.bindScope(e,t)}e.wrap=a,e.wrapForHelper=s,e.createScope=h,e.createFreshScope=p,e.bindShadowScope=m,e.createChildScope=v,e.bindSelf=g,e.updateSelf=b,e.bindLocal=y,e.updateLocal=w,e.bindBlock=_,e.block=k,e.continueBlock=x,e.hostBlock=C,e.handleRedirect=E,e.handleKeyword=S,e.linkRenderNode=N,e.inline=A,e.keyword=O,e.invokeHelper=M,e.classify=R,e.partial=D,e.range=I,e.element=j,e.attribute=F,e.subexpr=H,e.get=V,e.getRoot=B,e.getBlock=z,e.getChild=W,e.getValue=U,e.getCellOrValue=q,e.component=K,e.concat=G,e.hasHelper=$,e.lookupHelper=Q,e.bindScope=X,e.updateScope=J;var Z={partial:function(e,t,r,n){var i=t.hooks.partial(e,t,r,n[0]);return e.setContent(i),!0},"yield":function(e,t,r,n,i,o,a,s){var l=t.hooks.getValue(i.to)||"default",u=t.hooks.getBlock(r,l);return u&&u.invoke(t,n,i.self,e,r,s),!0},hasBlock:function(e,t,r,n){var i=t.hooks.getValue(n[0])||"default";return!!t.hooks.getBlock(r,i)},hasBlockParams:function(e,t,r,n){var i=t.hooks.getValue(n[0])||"default",o=t.hooks.getBlock(r,i);return!(!o||!o.arity)}};e.keywords=Z,e["default"]={bindLocal:y,bindSelf:g,bindScope:X,classify:R,component:K,concat:G,createFreshScope:p,getChild:W,getRoot:B,getBlock:z,getValue:U,getCellOrValue:q,keywords:Z,linkRenderNode:N,partial:D,subexpr:H,bindBlock:_,bindShadowScope:m,updateLocal:w,updateSelf:b,updateScope:J,createChildScope:v,hasHelper:$,lookupHelper:Q,invokeHelper:M,cleanupRenderNode:null,destroyRenderNode:null,willCleanupTree:null,didCleanupTree:null,willRenderNode:null,didRenderNode:null,attribute:F,block:k,createScope:h,element:j,get:V,inline:A,range:I,keyword:O}}),e("htmlbars-runtime/morph",["exports","morph-range"],function(e,t){"use strict";function r(e,t){this.super$constructor(e,t),this._state=void 0,this.ownerNode=null,this.isDirty=!1,this.isSubtreeDirty=!1,this.lastYielded=null,this.lastResult=null,this.lastValue=null,this.buildChildEnv=null,this.morphList=null,this.morphMap=null,this.key=null,this.linkedParams=null,this.linkedResult=null,this.childNodes=null,this.rendered=!1,this.guid="range"+n++,this.seen=!1}var n=1;r.empty=function(e,t){var n=new r(e,t);return n.clear(),n},r.create=function(e,t,n){var i=new r(e,t);return i.setNode(n),i},r.attach=function(e,t,n,i){var o=new r(e,t);return o.setRange(n,i),o};var i=r.prototype=Object.create(t["default"].prototype);i.constructor=r,i.super$constructor=t["default"],i.getState=function(){return this._state||(this._state={}),this._state},i.setState=function(e){return this._state=e},e["default"]=r}),e("htmlbars-runtime/node-visitor",["exports","htmlbars-util/morph-utils","htmlbars-runtime/expression-visitor"],function(e,t,r){"use strict";function n(e,n,i,o,a,s){return i.linkedParams?(a=i.linkedParams.params,s=i.linkedParams.hash):(a=a&&r.acceptParams(a,e,n),s=s&&r.acceptHash(s,e,n)),t.linkParams(e,n,i,o,a,s),[a,s]}function i(e,r,n,i){var o=r.isDirty,s=r.isSubtreeDirty,l=e;s&&(n=a),o||s?i(n):(r.buildChildEnv&&(l=r.buildChildEnv(r.getState(),l)),t.validateChildMorphs(l,r,n))}function o(e,t,r){return void 0!==e.hooks.keywords[r]||e.hooks.hasHelper(e,t,r)}var a={block:function(e,t,r,i,o,a){var s=e[1],l=e[2],u=e[3],c=e[4],d=e[5],f=n(r,i,t,s,l,u);t.isDirty=t.isSubtreeDirty=!1,r.hooks.block(t,r,i,s,f[0],f[1],null===c?null:o.templates[c],null===d?null:o.templates[d],a)},inline:function(e,t,r,i,o){var a=e[1],s=e[2],l=e[3],u=n(r,i,t,a,s,l);t.isDirty=t.isSubtreeDirty=!1,r.hooks.inline(t,r,i,a,u[0],u[1],o)},content:function(e,r,n,i,a){var s=e[1];if(r.isDirty=r.isSubtreeDirty=!1,o(n,i,s))return n.hooks.inline(r,n,i,s,[],{},a),void(r.linkedResult&&t.linkParams(n,i,r,"@content-helper",[r.linkedResult],null));var l=void 0;l=r.linkedParams?r.linkedParams.params:[n.hooks.get(n,i,s)],t.linkParams(n,i,r,"@range",l,null),n.hooks.range(r,n,i,s,l[0],a)},element:function(e,t,r,i,o){var a=e[1],s=e[2],l=e[3],u=n(r,i,t,a,s,l);t.isDirty=t.isSubtreeDirty=!1,r.hooks.element(t,r,i,a,u[0],u[1],o)},attribute:function(e,t,r,i){var o=e[1],a=e[2],s=n(r,i,t,"@attribute",[a],null);t.isDirty=t.isSubtreeDirty=!1,r.hooks.attribute(t,r,i,o,s[0][0])},component:function(e,t,r,i,o,a){var s=e[1],l=e[2],u=e[3],c=e[4],d=n(r,i,t,s,[],l),f={"default":o.templates[u],inverse:o.templates[c]};t.isDirty=t.isSubtreeDirty=!1,r.hooks.component(t,r,i,s,d[0],d[1],f,a)},attributes:function(e,t,r,n,i,o){var a=e[1];r.hooks.attributes(t,r,n,a,i,o)}};e.AlwaysDirtyVisitor=a,e["default"]={block:function(e,t,r,n,o,s){i(r,t,s,function(i){a.block(e,t,r,n,o,i)})},inline:function(e,t,r,n,o){i(r,t,o,function(i){a.inline(e,t,r,n,i)})},content:function(e,t,r,n,o){i(r,t,o,function(i){a.content(e,t,r,n,i)})},element:function(e,t,r,n,o,s){i(r,t,s,function(i){a.element(e,t,r,n,o,i)})},attribute:function(e,t,r,n,o){i(r,t,null,function(){a.attribute(e,t,r,n,o)})},component:function(e,t,r,n,o,s){i(r,t,s,function(i){a.component(e,t,r,n,o,i)})},attributes:function(e,t,r,n,i,o){a.attributes(e,t,r,n,i,o)}}}),e("htmlbars-runtime/render",["exports","htmlbars-util/morph-utils","htmlbars-runtime/node-visitor","htmlbars-runtime/morph","htmlbars-util/template-utils","htmlbars-util/void-tag-names"],function(e,t,r,n,i,o){"use strict";function a(e,t,r,n){var i,o=t.dom;n&&(n.renderNode?i=n.renderNode.contextualElement:n.contextualElement&&(i=n.contextualElement)),o.detectNamespace(i);var a=l.build(t,r,e,n,i);return a.render(),a}function s(e,t,r,n){this.renderNode=e||null,this.self=t,this.blockArguments=r||null,this.contextualElement=n||null}function l(e,t,r,n,i,o,a,s,l){this.root=n,this.fragment=a,this.nodes=o,this.template=s,this.statements=s.statements.slice(),this.env=e,this.scope=t,this.shouldSetContent=l,void 0!==r.self&&this.bindSelf(r.self),void 0!==r.blockArguments&&this.bindLocals(r.blockArguments),this.initializeNodes(i)}function u(e,t,r){var n=[];for(var i in t)"string"!=typeof t[i]&&n.push(["attribute",i,t[i]]);var a=r||o["default"][e];a||n.push(["content","yield"]);var s={arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(r){var n=r.createDocumentFragment();"svg"===e&&r.setNamespace(p);var i=r.createElement(e);for(var o in t)"string"==typeof t[o]&&r.setAttribute(i,o,t[o]);if(!a){var s=r.createComment("");r.appendChild(i,s)}return r.appendChild(n,i),n},buildRenderNodes:function(e,r){var n=e.childAt(r,[0]),i=[];for(var o in t)"string"!=typeof t[o]&&i.push(e.createAttrMorph(n,o));return a||i.push(e.createMorphAt(n,0,0)),i},statements:n,locals:[],templates:[]};return s}function c(e){var t=[];for(var r in e)"string"!=typeof e[r]&&t.push(["attribute",r,e[r]]);var n={arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(t){var r=this.element;"http://www.w3.org/2000/svg"===r.namespaceURI&&t.setNamespace(p);for(var n in e)"string"==typeof e[n]&&t.setAttribute(r,n,e[n]);return r},buildRenderNodes:function(t){var r=this.element,n=[];for(var i in e)"string"!=typeof e[i]&&n.push(t.createAttrMorph(r,i));return n},statements:t,locals:[],templates:[],element:null};return n}function d(e,t){e.ownerNode=t}function f(e,t,r){var i=n["default"].empty(e,r||t.contextualElement);return d(i,t.ownerNode),i}function h(e,t){var r,n=t.dom;return t.useFragmentCache&&n.canClone?(null===e.cachedFragment&&(r=e.buildFragment(n),e.hasRendered?e.cachedFragment=r:e.hasRendered=!0),e.cachedFragment&&(r=n.cloneNode(e.cachedFragment,!0))):r||(r=e.buildFragment(n)),r}e["default"]=a,e.RenderOptions=s,e.manualElement=u,e.attachAttributes=c,e.createChildMorph=f,e.getCachedFragment=h;var p="http://www.w3.org/2000/svg";l.build=function(e,r,n,o,a){var s,u,c,d=e.dom,f=h(n,e),p=n.buildRenderNodes(d,f,a);return o&&o.renderNode?(s=o.renderNode,u=s.ownerNode,c=!0):(s=d.createMorph(null,f.firstChild,f.lastChild,a),u=s,s.ownerNode=u,c=!1),s.childNodes&&t.visitChildren(s.childNodes,function(t){i.clearMorph(t,e,!0)}),s.childNodes=p,new l(e,r,o,s,u,p,f,n,c)},l.prototype.initializeNodes=function(e){for(var t=this.root.childNodes,r=0,n=t.length;n>r;r++)t[r].ownerNode=e},l.prototype.render=function(){this.root.lastResult=this,this.root.rendered=!0,this.populateNodes(r.AlwaysDirtyVisitor),this.shouldSetContent&&this.root.setContent&&this.root.setContent(this.fragment)},l.prototype.dirty=function(){t.visitChildren([this.root],function(e){e.isDirty=!0})},l.prototype.revalidate=function(e,t,n,i){this.revalidateWith(e,i,t,n,r["default"])},l.prototype.rerender=function(e,t,n,i){this.revalidateWith(e,i,t,n,r.AlwaysDirtyVisitor)},l.prototype.revalidateWith=function(e,t,r,n,i){void 0!==e&&(this.env=e),void 0!==t&&(this.scope=t),this.updateScope(),void 0!==r&&this.updateSelf(r),void 0!==n&&this.updateLocals(n),this.populateNodes(i)},l.prototype.destroy=function(){var e=this.root;i.clearMorph(e,this.env,!0)},l.prototype.populateNodes=function(e){var t,r,n=this.env,i=this.scope,o=this.template,a=this.nodes,s=this.statements;for(t=0,r=s.length;r>t;t++){var l=s[t],u=a[t];switch(n.hooks.willRenderNode&&n.hooks.willRenderNode(u,n,i),l[0]){case"block":e.block(l,u,n,i,o,e);break;case"inline":e.inline(l,u,n,i,e);break;case"content":e.content(l,u,n,i,e);break;case"element":e.element(l,u,n,i,o,e);break;case"attribute":e.attribute(l,u,n,i);break;case"component":e.component(l,u,n,i,o,e)}n.hooks.didRenderNode&&n.hooks.didRenderNode(u,n,i)}},l.prototype.bindScope=function(){this.env.hooks.bindScope(this.env,this.scope)},l.prototype.updateScope=function(){this.env.hooks.updateScope(this.env,this.scope)},l.prototype.bindSelf=function(e){this.env.hooks.bindSelf(this.env,this.scope,e)},l.prototype.updateSelf=function(e){this.env.hooks.updateSelf(this.env,this.scope,e)},l.prototype.bindLocals=function(e){for(var t=this.template.locals,r=0,n=t.length;n>r;r++)this.env.hooks.bindLocal(this.env,this.scope,t[r],e[r])},l.prototype.updateLocals=function(e){for(var t=this.template.locals,r=0,n=t.length;n>r;r++)this.env.hooks.updateLocal(this.env,this.scope,t[r],e[r])}}),e("htmlbars-runtime",["exports","htmlbars-runtime/hooks","htmlbars-runtime/render","htmlbars-util/morph-utils","htmlbars-util/template-utils"],function(e,t,r,n,i){"use strict";var o={blockFor:i.blockFor,manualElement:r.manualElement,hostBlock:t.hostBlock,continueBlock:t.continueBlock,hostYieldWithShadowTemplate:t.hostYieldWithShadowTemplate,visitChildren:n.visitChildren,validateChildMorphs:n.validateChildMorphs,clearMorph:i.clearMorph};e.hooks=t["default"],e.render=r["default"],e.internal=o}),e("htmlbars-util/array-utils",["exports"],function(e){"use strict";function t(e,t,r){var n,i;if(void 0===r)for(n=0,i=e.length;i>n;n++)t(e[n],n,e);else for(n=0,i=e.length;i>n;n++)t.call(r,e[n],n,e)}function r(e,t){var r,n,i=[];for(r=0,n=e.length;n>r;r++)i.push(t(e[r],r,e));return i}e.forEach=t,e.map=r;var n;n=Array.prototype.indexOf?function(e,t,r){return e.indexOf(t,r)}:function(e,t,r){void 0===r||null===r?r=0:0>r&&(r=Math.max(0,e.length+r));for(var n=r,i=e.length;i>n;n++)if(e[n]===t)return n;return-1};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};e.isArray=i;var o=n;e.indexOfArray=o}),e("htmlbars-util/handlebars/safe-string",["exports"],function(e){"use strict";function t(e){this.string=e}t.prototype.toString=t.prototype.toHTML=function(){return""+this.string},e["default"]=t}),e("htmlbars-util/handlebars/utils",["exports"],function(e){"use strict";function t(e){return l[e]}function r(e){for(var t=1;tr;r++)if(e[r]===t)return r;return-1}function i(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}return c.test(e)?e.replace(u,t):e}function o(e){return e||0===e?h(e)&&0===e.length?!0:!1:!0}function a(e,t){return e.path=t,e}function s(e,t){return(e?e+".":"")+t}e.extend=r,e.indexOf=n,e.escapeExpression=i,e.isEmpty=o,e.blockParams=a,e.appendContextPath=s;var l={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},u=/[&<>"'`]/g,c=/[&<>"'`]/,d=Object.prototype.toString;e.toString=d;var f=function(e){return"function"==typeof e};f(/x/)&&(e.isFunction=f=function(e){return"function"==typeof e&&"[object Function]"===d.call(e)});var f;e.isFunction=f;var h=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===d.call(e):!1};e.isArray=h}),e("htmlbars-util/morph-utils",["exports"],function(e){"use strict";function t(e,t){if(e&&0!==e.length)for(e=e.slice();e.length;){var r=e.pop();if(t(r),r.childNodes)e.push.apply(e,r.childNodes);else if(r.firstChildMorph)for(var n=r.firstChildMorph;n;)e.push(n),n=n.nextMorph;else if(r.morphList)for(var n=r.morphList.firstChildMorph;n;)e.push(n),n=n.nextMorph}}function r(e,t,n){var i=t.morphList;if(t.morphList)for(var o=i.firstChildMorph;o;){var a=o.nextMorph;r(e,o,n),o=a}else if(t.lastResult)t.lastResult.revalidateWith(e,void 0,void 0,void 0,n);else if(t.childNodes)for(var s=0,l=t.childNodes.length;l>s;s++)r(e,t.childNodes[s],n)}function n(e,t,r,n,i,o){r.linkedParams||e.hooks.linkRenderNode(r,e,t,n,i,o)&&(r.linkedParams={params:i,hash:o})}function i(e){if(console.group(e,e.isDirty),e.childNodes)o(e.childNodes,i);else if(e.firstChildMorph)for(var t=e.firstChildMorph;t;)i(t),t=t.nextMorph;else e.morphList&&i(e.morphList);console.groupEnd()}function o(e,t){for(var r=0,n=e.length;n>r;r++)t(e[r])}e.visitChildren=t,e.validateChildMorphs=r,e.linkParams=n,e.dump=i}),e("htmlbars-util/namespaces",["exports"],function(e){"use strict";function t(e,t){if(t)return t;var n,i=e.indexOf(":");if(-1!==i){var o=e.slice(0,i);n=r[o]}return n||null}e.getAttrNamespace=t;var r={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"}}),e("htmlbars-util/object-utils",["exports"],function(e){"use strict";function t(e,t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r]);return e}function r(e){return t({},e)}function n(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=!0);return t}function i(e){var t=0;for(var r in e)e.hasOwnProperty(r)&&t++;return t}e.merge=t,e.shallowCopy=r,e.keySet=n,e.keyLength=i}),e("htmlbars-util/quoting",["exports"],function(e){"use strict";function t(e){return e=e.replace(/\\/g,"\\\\"),e=e.replace(/"/g,'\\"'),e=e.replace(/\n/g,"\\n")}function r(e){return'"'+t(e)+'"'}function n(e){return"["+e+"]"}function i(e){return"{"+e.join(", ")+"}"}function o(e,t){for(var r="";t--;)r+=e;return r}e.hash=i,e.repeat=o,e.escapeString=t,e.string=r,e.array=n}),e("htmlbars-util/safe-string",["exports","htmlbars-util/handlebars/safe-string"],function(e,t){"use strict";e["default"]=t["default"]}),e("htmlbars-util/template-utils",["exports","htmlbars-util/morph-utils","htmlbars-runtime/render"],function(e,t,r){"use strict";function n(e,t){this.morphListToClear=t,this.morphListToPrune=null,this.handledMorphs={},this.collisions=void 0,this.morphToClear=e,this.shadowOptions=null}function i(e,t,r){this.render=e,this.template=t,this.blockOptions=r,this.arity=t.arity}function o(e,t,r){return new i(e,t,r)}function a(e,t,r){if(r)if(r instanceof i)e.hooks.bindBlock(e,t,r);else for(var n in r)r.hasOwnProperty(n)&&e.hooks.bindBlock(e,t,r[n],n)}function s(e,t,r,n,i){var o=r.renderState;o.collisions=void 0,o.shadowOptions=n;var a=i(r);if(!a||!a.handled){var s=e.morphMap,c=o.morphListToPrune;if(c)for(var d=o.handledMorphs,f=c.firstChildMorph;f;){var h=f.nextMorph;f.key in d||(delete s[f.key],l(f,t,!0),f.destroy()),f=h}c=o.morphListToClear,c&&u(c,e,t);var p=o.morphToClear;p&&l(p,t)}}function l(e,r,n){function i(e){o&&o(e),a&&a(e)}var o=r.hooks.cleanupRenderNode,a=r.hooks.destroyRenderNode,s=r.hooks.willCleanupTree,l=r.hooks.didCleanupTree;s&&s(r,e,n),o&&o(e),n&&a&&a(e),t.visitChildren(e.childNodes,i),e.clear(),l&&l(r,e,n),e.lastResult=null,e.lastYielded=null,e.childNodes=null}function u(e,t,r){for(var n=e.firstChildMorph;n;){var i=n.nextMorph;delete t.morphMap[n.key],l(n,r,!0),n.destroy(),n=i}e.clear(),t.morphList=null}e.RenderState=n,e.blockFor=o,e.renderAndCleanup=s,e.clearMorph=l,e.clearMorphList=u,i.prototype.invoke=function(e,t,r,n,i,o){n.lastResult?n.lastResult.revalidateWith(e,void 0,r,t,o):this._firstRender(e,t,r,n,i)},i.prototype._firstRender=function(e,t,i,o,l){var u={renderState:new n(o)},c=this.render,d=this.template,f=this.blockOptions.scope,h=f?e.hooks.createChildScope(f):e.hooks.createFreshScope();e.hooks.bindShadowScope(e,l,h,this.blockOptions.options),void 0!==i?e.hooks.bindSelf(e,h,i):void 0!==this.blockOptions.self&&e.hooks.bindSelf(e,h,this.blockOptions.self),a(e,h,this.blockOptions.yieldTo),s(o,e,u,null,function(){u.renderState.morphToClear=null;var n=new r.RenderOptions(o,void 0,t);c(d,e,h,n)})}}),e("htmlbars-util/void-tag-names",["exports","htmlbars-util/array-utils"],function(e,t){"use strict";var r="area base br col command embed hr img input keygen link meta param source track wbr",n={};t.forEach(r.split(" "),function(e){n[e]=!0}),e["default"]=n}),e("htmlbars-util",["exports","htmlbars-util/safe-string","htmlbars-util/handlebars/utils","htmlbars-util/namespaces","htmlbars-util/morph-utils"],function(e,t,r,n,i){"use strict";e.SafeString=t["default"],e.escapeExpression=r.escapeExpression,e.getAttrNamespace=n.getAttrNamespace,e.validateChildMorphs=i.validateChildMorphs,e.linkParams=i.linkParams,e.dump=i.dump}),e("morph-attr/sanitize-attribute-value",["exports"],function(e){"use strict";function t(e,t,s,l){var u;if(u=t?t.tagName.toUpperCase():null,l&&l.toHTML)return l.toHTML();if((null===u||n[u])&&o[s]){var c=e.protocolForURL(l);if(r[c]===!0)return"unsafe:"+l}return i[u]&&a[s]?"unsafe:"+l:l}e.sanitizeAttributeValue=t;var r={"javascript:":!0,"vbscript:":!0},n={A:!0,BODY:!0,LINK:!0,IMG:!0,IFRAME:!0,BASE:!0,FORM:!0},i={EMBED:!0},o={href:!0,src:!0,background:!0,action:!0};e.badAttributes=o;var a={src:!0}}),e("morph-attr",["exports","morph-attr/sanitize-attribute-value","dom-helper/prop","dom-helper/build-html-dom","htmlbars-util"],function(e,t,r,n,i){"use strict";function o(){return this.domHelper.getPropertyStrict(this.element,this.attrName)}function a(e){this._renderedInitially!==!0&&r.isAttrRemovalValue(e)||this.domHelper.setPropertyStrict(this.element,this.attrName,e),this._renderedInitially=!0}function s(){return this.domHelper.getAttribute(this.element,this.attrName)}function l(e){r.isAttrRemovalValue(e)?this.domHelper.removeAttribute(this.element,this.attrName):this.domHelper.setAttribute(this.element,this.attrName,e)}function u(){return this.domHelper.getAttributeNS(this.element,this.namespace,this.attrName)}function c(e){r.isAttrRemovalValue(e)?this.domHelper.removeAttribute(this.element,this.attrName):this.domHelper.setAttributeNS(this.element,this.namespace,this.attrName,e)}function d(e,t,i){var o=r.normalizeProperty(e,t),a=o.normalized,s=o.type;return e.namespaceURI===n.svgNamespace||"style"===t||"attr"===s?new m(e,a,i):new h(e,a,i)}function f(e,t,r){this.element=e,this.domHelper=r,this.attrName=t,this._state=void 0,this.isDirty=!1,this.isSubtreeDirty=!1,this.escaped=!0,this.lastValue=v,this.lastResult=null,this.lastYielded=null,this.childNodes=null,this.linkedParams=null,this.linkedResult=null,this.guid="attr"+g++,this.seen=!1,this.ownerNode=null,this.rendered=!1,this._renderedInitially=!1,this.namespace=void 0,this.didInit()}function h(e,t,r){this._$superAttrMorph(e,t,r)}function p(e,t,r,n){this._$superAttrMorph(e,t,r),this.namespace=n}function m(e,t,r){this._$superAttrMorph(e,t,r)}var v={unset:!0},g=1;f.create=function(e,t,r,n){var o=i.getAttrNamespace(t,n);return o?new p(e,t,r,o):d(e,t,r)},f.prototype.getState=function(){return this._state||(this._state={}),this._state},f.prototype.setState=function(e){return this._state=e},f.prototype.didInit=function(){},f.prototype.willSetContent=function(){},f.prototype.setContent=function(e){if(this.willSetContent(e),this.lastValue!==e)if(this.lastValue=e,this.escaped){var r=t.sanitizeAttributeValue(this.domHelper,this.element,this.attrName,e);this._update(r,this.namespace)}else this._update(e,this.namespace)},f.prototype.getContent=function(){var e=this.lastValue=this._get();return e},f.prototype.clear=function(){},f.prototype.destroy=function(){this.element=null,this.domHelper=null},f.prototype._$superAttrMorph=f,h.prototype=Object.create(f.prototype),h.prototype._update=a,h.prototype._get=o,p.prototype=Object.create(f.prototype),p.prototype._update=c,p.prototype._get=u,m.prototype=Object.create(f.prototype),m.prototype._update=l,m.prototype._get=s,e["default"]=f,e.sanitizeAttributeValue=t.sanitizeAttributeValue}),e("morph-range/morph-list",["exports","morph-range/utils"],function(e,t){"use strict";function r(){this.firstChildMorph=null,this.lastChildMorph=null,this.mountedMorph=null}var n=r.prototype;n.clear=function(){for(var e=this.firstChildMorph;e;){var t=e.nextMorph;e.previousMorph=null,e.nextMorph=null,e.parentMorphList=null,e=t}this.firstChildMorph=this.lastChildMorph=null},n.destroy=function(){},n.appendMorph=function(e){this.insertBeforeMorph(e,null)},n.insertBeforeMorph=function(e,r){if(null!==e.parentMorphList&&e.unlink(),r&&r.parentMorphList!==this)throw new Error("The morph before which the new morph is to be inserted is not a child of this morph.");var n=this.mountedMorph;if(n){var i=n.firstNode.parentNode,o=r?r.firstNode:n.lastNode.nextSibling;t.insertBefore(i,e.firstNode,e.lastNode,o),this.firstChildMorph||t.clear(this.mountedMorph.firstNode.parentNode,this.mountedMorph.firstNode,this.mountedMorph.lastNode)}e.parentMorphList=this;var a=r?r.previousMorph:this.lastChildMorph;a?(a.nextMorph=e,e.previousMorph=a):this.firstChildMorph=e,r?(r.previousMorph=e,e.nextMorph=r):this.lastChildMorph=e,this.firstChildMorph._syncFirstNode(),this.lastChildMorph._syncLastNode(); },n.removeChildMorph=function(e){if(e.parentMorphList!==this)throw new Error("Cannot remove a morph from a parent it is not inside of");e.destroy()},e["default"]=r}),e("morph-range/morph-list.umd",["exports","morph-range/morph-list"],function(e,t){"use strict";!function(t,r){"function"==typeof define&&define.amd?define([],r):"object"==typeof e?module.exports=r():t.MorphList=r()}(void 0,function(){return t["default"]})}),e("morph-range/utils",["exports"],function(e){"use strict";function t(e,t,r){if(e){var n,i=t;do{if(n=i.nextSibling,e.removeChild(i),i===r)break;i=n}while(i)}}function r(e,t,r,n){var i,o=t;do{if(i=o.nextSibling,e.insertBefore(o,n),o===r)break;o=i}while(o)}e.clear=t,e.insertBefore=r}),e("morph-range",["exports","morph-range/utils"],function(e,t){"use strict";function r(e,t){this.domHelper=e,this.contextualElement=t,this.firstNode=null,this.lastNode=null,this.parseTextAsHTML=!1,this.parentMorphList=null,this.previousMorph=null,this.nextMorph=null}function n(e){var t,r=e.name;throw t=r?"Unsupported Content: Cannot bind to function `"+r+"`":"Unsupported Content: Cannot bind to function",new TypeError(t)}r.empty=function(e,t){var n=new r(e,t);return n.clear(),n},r.create=function(e,t,n){var i=new r(e,t);return i.setNode(n),i},r.attach=function(e,t,n,i){var o=new r(e,t);return o.setRange(n,i),o},r.prototype.setContent=function(e){if(null===e||void 0===e)return this.clear();var t=typeof e;switch(t){case"string":return this.parseTextAsHTML?this.domHelper.setMorphHTML(this,e):this.setText(e);case"object":if("number"==typeof e.nodeType)return this.setNode(e);if("string"==typeof e.string)return this.setHTML(e.string);if(this.parseTextAsHTML)return this.setHTML(e.toString());case"boolean":case"number":return this.setText(e.toString());case"function":n(e);default:throw new TypeError("unsupported content")}},r.prototype.clear=function(){var e=this.setNode(this.domHelper.createComment(""));return e},r.prototype.setText=function(e){var t=this.firstNode,r=this.lastNode;return t&&r===t&&3===t.nodeType?(t.nodeValue=e,t):this.setNode(e?this.domHelper.createTextNode(e):this.domHelper.createComment(""))},r.prototype.setNode=function(e){var t,r;switch(e.nodeType){case 3:t=e,r=e;break;case 11:t=e.firstChild,r=e.lastChild,null===t&&(t=this.domHelper.createComment(""),e.appendChild(t),r=t);break;default:t=e,r=e}return this.setRange(t,r),e},r.prototype.setRange=function(e,r){var n=this.firstNode;if(null!==n){var i=n.parentNode;null!==i&&(t.insertBefore(i,e,r,n),t.clear(i,n,this.lastNode))}this.firstNode=e,this.lastNode=r,this.parentMorphList&&(this._syncFirstNode(),this._syncLastNode())},r.prototype.destroy=function(){this.unlink();var e=this.firstNode,r=this.lastNode,n=e&&e.parentNode;this.firstNode=null,this.lastNode=null,t.clear(n,e,r)},r.prototype.unlink=function(){var e=this.parentMorphList,t=this.previousMorph,r=this.nextMorph;if(t?r?(t.nextMorph=r,r.previousMorph=t):(t.nextMorph=null,e.lastChildMorph=t):r?(r.previousMorph=null,e.firstChildMorph=r):e&&(e.lastChildMorph=e.firstChildMorph=null),this.parentMorphList=null,this.nextMorph=null,this.previousMorph=null,e&&e.mountedMorph){if(!e.firstChildMorph)return void e.mountedMorph.clear();e.firstChildMorph._syncFirstNode(),e.lastChildMorph._syncLastNode()}},r.prototype.setHTML=function(e){var t=this.domHelper.parseHTML(e,this.contextualElement);return this.setNode(t)},r.prototype.setMorphList=function(e){e.mountedMorph=this,this.clear();var t=this.firstNode;if(e.firstChildMorph){this.firstNode=e.firstChildMorph.firstNode,this.lastNode=e.lastChildMorph.lastNode;for(var r=e.firstChildMorph;r;){var n=r.nextMorph;r.insertBeforeNode(t,null),r=n}t.parentNode.removeChild(t)}},r.prototype._syncFirstNode=function(){for(var e,t=this;(e=t.parentMorphList)&&null!==e.mountedMorph&&t===e.firstChildMorph&&t.firstNode!==e.mountedMorph.firstNode;)e.mountedMorph.firstNode=t.firstNode,t=e.mountedMorph},r.prototype._syncLastNode=function(){for(var e,t=this;(e=t.parentMorphList)&&null!==e.mountedMorph&&t===e.lastChildMorph&&t.lastNode!==e.mountedMorph.lastNode;)e.mountedMorph.lastNode=t.lastNode,t=e.mountedMorph},r.prototype.insertBeforeNode=function(e,r){t.insertBefore(e,this.firstNode,this.lastNode,r)},r.prototype.appendToNode=function(e){t.insertBefore(e,this.firstNode,this.lastNode,null)},e["default"]=r}),e("route-recognizer/dsl",["exports"],function(e){"use strict";function t(e,t,r){this.path=e,this.matcher=t,this.delegate=r}function r(e){this.routes={},this.children={},this.target=e}function n(e,r,i){return function(o,a){var s=e+o;return a?void a(n(s,r,i)):new t(e+o,r,i)}}function i(e,t,r){for(var n=0,i=0,o=e.length;o>i;i++)n+=e[i].path.length;t=t.substr(n);var a={path:t,handler:r};e.push(a)}function o(e,t,r,n){var a=t.routes;for(var s in a)if(a.hasOwnProperty(s)){var l=e.slice();i(l,s,a[s]),t.children[s]?o(l,t.children[s],r,n):r.call(n,l)}}t.prototype={to:function(e,t){var r=this.delegate;if(r&&r.willAddRoute&&(e=r.willAddRoute(this.matcher.target,e)),this.matcher.add(this.path,e),t){if(0===t.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,e,t,this.delegate)}return this}},r.prototype={add:function(e,t){this.routes[e]=t},addChild:function(e,t,i,o){var a=new r(t);this.children[e]=a;var s=n(e,a,o);o&&o.contextEntered&&o.contextEntered(t,s),i(s)}},e["default"]=function(e,t){var i=new r;e(n("",i,this.delegate)),o([],i,function(e){t?t(this,e):this.add(e)},this)}}),e("route-recognizer",["exports","route-recognizer/dsl"],function(e,t){"use strict";function r(e){return"[object Array]"===Object.prototype.toString.call(e)}function n(e){this.string=e}function i(e){this.name=e}function o(e){this.name=e}function a(){}function s(e,t,r){"/"===e.charAt(0)&&(e=e.substr(1));for(var s=e.split("/"),l=[],u=0,c=s.length;c>u;u++){var d,f=s[u];(d=f.match(/^:([^\/]+)$/))?(l.push(new i(d[1])),t.push(d[1]),r.dynamics++):(d=f.match(/^\*([^\/]+)$/))?(l.push(new o(d[1])),t.push(d[1]),r.stars++):""===f?l.push(new a):(l.push(new n(f)),r.statics++)}return l}function l(e){this.charSpec=e,this.nextStates=[]}function u(e){return e.sort(function(e,t){if(e.types.stars!==t.types.stars)return e.types.stars-t.types.stars;if(e.types.stars){if(e.types.statics!==t.types.statics)return t.types.statics-e.types.statics;if(e.types.dynamics!==t.types.dynamics)return t.types.dynamics-e.types.dynamics}return e.types.dynamics!==t.types.dynamics?e.types.dynamics-t.types.dynamics:e.types.statics!==t.types.statics?t.types.statics-e.types.statics:0})}function c(e,t){for(var r=[],n=0,i=e.length;i>n;n++){var o=e[n];r=r.concat(o.match(t))}return r}function d(e){this.queryParams=e||{}}function f(e,t,r){for(var n=e.handlers,i=e.regex,o=t.match(i),a=1,s=new d(r),l=0,u=n.length;u>l;l++){for(var c=n[l],f=c.names,h={},p=0,m=f.length;m>p;p++)h[f[p]]=o[a++];s.push({handler:c.handler,params:h,isDynamic:!!f.length})}return s}function h(e,t){return t.eachChar(function(t){e=e.put(t)}),e}function p(e){return e=e.replace(/\+/gm,"%20"),decodeURIComponent(e)}var m=["/",".","*","+","?","|","(",")","[","]","{","}","\\"],v=new RegExp("(\\"+m.join("|\\")+")","g");n.prototype={eachChar:function(e){for(var t,r=this.string,n=0,i=r.length;i>n;n++)t=r.charAt(n),e({validChars:t})},regex:function(){return this.string.replace(v,"\\$1")},generate:function(){return this.string}},i.prototype={eachChar:function(e){e({invalidChars:"/",repeat:!0})},regex:function(){return"([^/]+)"},generate:function(e){return e[this.name]}},o.prototype={eachChar:function(e){e({invalidChars:"",repeat:!0})},regex:function(){return"(.+)"},generate:function(e){return e[this.name]}},a.prototype={eachChar:function(){},regex:function(){return""},generate:function(){return""}},l.prototype={get:function(e){for(var t=this.nextStates,r=0,n=t.length;n>r;r++){var i=t[r],o=i.charSpec.validChars===e.validChars;if(o=o&&i.charSpec.invalidChars===e.invalidChars)return i}},put:function(e){var t;return(t=this.get(e))?t:(t=new l(e),this.nextStates.push(t),e.repeat&&t.nextStates.push(t),t)},match:function(e){for(var t,r,n,i=this.nextStates,o=[],a=0,s=i.length;s>a;a++)t=i[a],r=t.charSpec,"undefined"!=typeof(n=r.validChars)?-1!==n.indexOf(e)&&o.push(t):"undefined"!=typeof(n=r.invalidChars)&&-1===n.indexOf(e)&&o.push(t);return o}};var g=Object.create||function(e){function t(){}return t.prototype=e,new t};d.prototype=g({splice:Array.prototype.splice,slice:Array.prototype.slice,push:Array.prototype.push,length:0,queryParams:null});var b=function(){this.rootState=new l,this.names={}};b.prototype={add:function(e,t){for(var r,n=this.rootState,i="^",o={statics:0,dynamics:0,stars:0},l=[],u=[],c=!0,d=0,f=e.length;f>d;d++){var p=e[d],m=[],v=s(p.path,m,o);u=u.concat(v);for(var g=0,b=v.length;b>g;g++){var y=v[g];y instanceof a||(c=!1,n=n.put({validChars:"/"}),i+="/",n=h(n,y),i+=y.regex())}var w={handler:p.handler,names:m};l.push(w)}c&&(n=n.put({validChars:"/"}),i+="/"),n.handlers=l,n.regex=new RegExp(i+"$"),n.types=o,(r=t&&t.as)&&(this.names[r]={segments:u,handlers:l})},handlersFor:function(e){var t=this.names[e],r=[];if(!t)throw new Error("There is no route named "+e);for(var n=0,i=t.handlers.length;i>n;n++)r.push(t.handlers[n]);return r},hasRoute:function(e){return!!this.names[e]},generate:function(e,t){var r=this.names[e],n="";if(!r)throw new Error("There is no route named "+e);for(var i=r.segments,o=0,s=i.length;s>o;o++){var l=i[o];l instanceof a||(n+="/",n+=l.generate(t))}return"/"!==n.charAt(0)&&(n="/"+n),t&&t.queryParams&&(n+=this.generateQueryString(t.queryParams,r.handlers)),n},generateQueryString:function(e,t){var n=[],i=[];for(var o in e)e.hasOwnProperty(o)&&i.push(o);i.sort();for(var a=0,s=i.length;s>a;a++){o=i[a];var l=e[o];if(null!=l){var u=encodeURIComponent(o);if(r(l))for(var c=0,d=l.length;d>c;c++){var f=o+"[]="+encodeURIComponent(l[c]);n.push(f)}else u+="="+encodeURIComponent(l),n.push(u)}}return 0===n.length?"":"?"+n.join("&")},parseQueryString:function(e){for(var t=e.split("&"),r={},n=0;n2&&"[]"===a.slice(s-2)&&(l=!0,a=a.slice(0,s-2),r[a]||(r[a]=[])),i=o[1]?p(o[1]):""),l?r[a].push(i):r[a]=i}return r},recognize:function(e){var t,r,n,i,o=[this.rootState],a={},s=!1;if(i=e.indexOf("?"),-1!==i){var l=e.substr(i+1,e.length);e=e.substr(0,i),a=this.parseQueryString(l)}for(e=decodeURI(e),"/"!==e.charAt(0)&&(e="/"+e),t=e.length,t>1&&"/"===e.charAt(t-1)&&(e=e.substr(0,t-1),s=!0),r=0,n=e.length;n>r&&(o=c(o,e.charAt(r)),o.length);r++);var d=[];for(r=0,n=o.length;n>r;r++)o[r].handlers&&d.push(o[r]);o=u(d);var h=d[0];return h&&h.handlers?(s&&"(.+)$"===h.regex.source.slice(-5)&&(e+="/"),f(h,e,a)):void 0}},b.prototype.map=t["default"],b.VERSION="0.1.5",e["default"]=b}),e("router/handler-info/factory",["exports","router/handler-info/resolved-handler-info","router/handler-info/unresolved-handler-info-by-object","router/handler-info/unresolved-handler-info-by-param"],function(e,t,r,n){"use strict";function i(e,t){var r=i.klasses[e],n=new r(t||{});return n.factory=i,n}i.klasses={resolved:t["default"],param:n["default"],object:r["default"]},e["default"]=i}),e("router/handler-info/resolved-handler-info",["exports","router/handler-info","router/utils","rsvp/promise"],function(e,t,r,n){"use strict";var i=r.subclass(t["default"],{resolve:function(e,t){return t&&t.resolvedModels&&(t.resolvedModels[this.name]=this.context),n["default"].resolve(this,this.promiseLabel("Resolve"))},getUnresolved:function(){return this.factory("param",{name:this.name,handler:this.handler,params:this.params})},isResolved:!0});e["default"]=i}),e("router/handler-info/unresolved-handler-info-by-object",["exports","router/handler-info","router/utils","rsvp/promise"],function(e,t,r,n){"use strict";var i=r.subclass(t["default"],{getModel:function(e){return this.log(e,this.name+": resolving provided model"),n["default"].resolve(this.context)},initialize:function(e){this.names=e.names||[],this.context=e.context},serialize:function(e){var t=e||this.context,n=this.names,i=this.handler,o={};if(r.isParam(t))return o[n[0]]=t,o;if(i.serialize)return i.serialize(t,n);if(1===n.length){var a=n[0];return/_id$/.test(a)?o[a]=t.id:o[a]=t,o}}});e["default"]=i}),e("router/handler-info/unresolved-handler-info-by-param",["exports","router/handler-info","router/utils"],function(e,t,r){"use strict";var n=r.subclass(t["default"],{initialize:function(e){this.params=e.params||{}},getModel:function(e){var t=this.params;e&&e.queryParams&&(t={},r.merge(t,this.params),t.queryParams=e.queryParams);var n=this.handler,i=r.resolveHook(n,"deserialize")||r.resolveHook(n,"model");return this.runSharedModelHook(e,i,[t])}});e["default"]=n}),e("router/handler-info",["exports","router/utils","rsvp/promise"],function(e,t,r){"use strict";function n(e){var r=e||{};t.merge(this,r),this.initialize(r)}function i(e,t){if(!e^!t)return!1;if(!e)return!0;for(var r in e)if(e.hasOwnProperty(r)&&e[r]!==t[r])return!1;return!0}n.prototype={name:null,handler:null,params:null,context:null,factory:null,initialize:function(){},log:function(e,t){e.log&&e.log(this.name+": "+t)},promiseLabel:function(e){return t.promiseLabel("'"+this.name+"' "+e)},getUnresolved:function(){return this},serialize:function(){return this.params||{}},resolve:function(e,n){var i=t.bind(this,this.checkForAbort,e),o=t.bind(this,this.runBeforeModelHook,n),a=t.bind(this,this.getModel,n),s=t.bind(this,this.runAfterModelHook,n),l=t.bind(this,this.becomeResolved,n);return r["default"].resolve(void 0,this.promiseLabel("Start handler")).then(i,null,this.promiseLabel("Check for abort")).then(o,null,this.promiseLabel("Before model")).then(i,null,this.promiseLabel("Check if aborted during 'beforeModel' hook")).then(a,null,this.promiseLabel("Model")).then(i,null,this.promiseLabel("Check if aborted in 'model' hook")).then(s,null,this.promiseLabel("After model")).then(i,null,this.promiseLabel("Check if aborted in 'afterModel' hook")).then(l,null,this.promiseLabel("Become resolved"))},runBeforeModelHook:function(e){return e.trigger&&e.trigger(!0,"willResolveModel",e,this.handler),this.runSharedModelHook(e,"beforeModel",[])},runAfterModelHook:function(e,t){var r=this.name;return this.stashResolvedModel(e,t),this.runSharedModelHook(e,"afterModel",[t]).then(function(){return e.resolvedModels[r]},null,this.promiseLabel("Ignore fulfillment value and return model value"))},runSharedModelHook:function(e,n,i){this.log(e,"calling "+n+" hook"),this.queryParams&&i.push(this.queryParams),i.push(e);var o=t.applyHook(this.handler,n,i);return o&&o.isTransition&&(o=null),r["default"].resolve(o,this.promiseLabel("Resolve value returned from one of the model hooks"))},getModel:null,checkForAbort:function(e,t){return r["default"].resolve(e(),this.promiseLabel("Check for abort")).then(function(){return t},null,this.promiseLabel("Ignore fulfillment value and continue"))},stashResolvedModel:function(e,t){e.resolvedModels=e.resolvedModels||{},e.resolvedModels[this.name]=t},becomeResolved:function(e,t){var r=this.serialize(t);return e&&(this.stashResolvedModel(e,t),e.params=e.params||{},e.params[this.name]=r),this.factory("resolved",{context:t,name:this.name,handler:this.handler,params:r})},shouldSupercede:function(e){if(!e)return!0;var t=e.context===this.context;return e.name!==this.name||this.hasOwnProperty("context")&&!t||this.hasOwnProperty("params")&&!i(this.params,e.params)}},e["default"]=n}),e("router/router",["exports","route-recognizer","rsvp/promise","router/utils","router/transition-state","router/transition","router/transition-intent/named-transition-intent","router/transition-intent/url-transition-intent","router/handler-info"],function(e,t,r,n,i,o,a,s,l){"use strict";function u(e){var r=e||{};this.getHandler=r.getHandler||this.getHandler,this.updateURL=r.updateURL||this.updateURL,this.replaceURL=r.replaceURL||this.replaceURL,this.didTransition=r.didTransition||this.didTransition,this.willTransition=r.willTransition||this.willTransition,this.delegate=r.delegate||this.delegate,this.triggerEvent=r.triggerEvent||this.triggerEvent,this.log=r.log||this.log,this.recognizer=new t["default"],this.reset()}function c(e,t){var r,i=!!this.activeTransition,a=i?this.activeTransition.state:this.state,s=e.applyToState(a,this.recognizer,this.getHandler,t),l=n.getChangelist(a.queryParams,s.queryParams);return b(s.handlerInfos,a.handlerInfos)?l&&(r=this.queryParamsTransition(l,i,a,s))?r:this.activeTransition||new o.Transition(this):t?void f(this,s):(r=new o.Transition(this,e,s),this.activeTransition&&this.activeTransition.abort(),this.activeTransition=r,r.promise=r.promise.then(function(e){return v(r,e.state)},null,n.promiseLabel("Settle transition promise when transition is finalized")),i||w(this,s,r),d(this,s,l),r)}function d(e,t,r){r&&(e._changedQueryParams=r.all,n.trigger(e,t.handlerInfos,!0,["queryParamsDidChange",r.changed,r.all,r.removed]),e._changedQueryParams=null)}function f(e,t,r){var i,o,a,s=p(e.state,t);for(i=0,o=s.exited.length;o>i;i++)a=s.exited[i].handler,delete a.context,n.callHook(a,"reset",!0,r),n.callHook(a,"exit",r);var l=e.oldState=e.state;e.state=t;var u=e.currentHandlerInfos=s.unchanged.slice();try{for(i=0,o=s.reset.length;o>i;i++)a=s.reset[i].handler,n.callHook(a,"reset",!1,r);for(i=0,o=s.updatedContext.length;o>i;i++)h(u,s.updatedContext[i],!1,r);for(i=0,o=s.entered.length;o>i;i++)h(u,s.entered[i],!0,r)}catch(c){throw e.state=l,e.currentHandlerInfos=l.handlerInfos,c}e.state.queryParams=y(e,u,t.queryParams,r)}function h(e,t,r,i){var a=t.handler,s=t.context;if(r&&n.callHook(a,"enter",i),i&&i.isAborted)throw new o.TransitionAborted;if(a.context=s,n.callHook(a,"contextDidChange"),n.callHook(a,"setup",s,i),i&&i.isAborted)throw new o.TransitionAborted;return e.push(t),!0}function p(e,t){var r,n,i,o=e.handlerInfos,a=t.handlerInfos,s={updatedContext:[],exited:[],entered:[],unchanged:[]},l=!1;for(n=0,i=a.length;i>n;n++){var u=o[n],c=a[n];u&&u.handler===c.handler||(r=!0),r?(s.entered.push(c),u&&s.exited.unshift(u)):l||u.context!==c.context?(l=!0,s.updatedContext.push(c)):s.unchanged.push(u)}for(n=a.length,i=o.length;i>n;n++)s.exited.unshift(o[n]);return s.reset=s.updatedContext.slice(),s.reset.reverse(),s}function m(e,t,r){var i=e.urlMethod;if(i){for(var o=e.router,a=t.handlerInfos,s=a[a.length-1].name,l={},u=a.length-1;u>=0;--u){var c=a[u];n.merge(l,c.params),c.handler.inaccessibleByURL&&(i=null)}if(i){l.queryParams=e._visibleQueryParams||t.queryParams;var d=o.recognizer.generate(s,l);"replace"===i?o.replaceURL(d):o.updateURL(d)}}}function v(e,t){try{n.log(e.router,e.sequence,"Resolved all models on destination route; finalizing transition.");var i=e.router,a=t.handlerInfos;e.sequence;return f(i,t,e),e.isAborted?(i.state.handlerInfos=i.currentHandlerInfos,r["default"].reject(o.logAbort(e))):(m(e,t,e.intent.url),e.isActive=!1,i.activeTransition=null,n.trigger(i,i.currentHandlerInfos,!0,["didTransition"]),i.didTransition&&i.didTransition(i.currentHandlerInfos),n.log(i,e.sequence,"TRANSITION COMPLETE."),a[a.length-1].handler)}catch(s){if(!(s instanceof o.TransitionAborted)){var l=e.state.handlerInfos;e.trigger(!0,"error",s,e,l[l.length-1].handler),e.abort()}throw s}}function g(e,t,r){var i=t[0]||"/",o=t[t.length-1],l={};o&&o.hasOwnProperty("queryParams")&&(l=_.call(t).queryParams);var u;if(0===t.length){n.log(e,"Updating query params");var c=e.state.handlerInfos;u=new a["default"]({name:c[c.length-1].name,contexts:[],queryParams:l})}else"/"===i.charAt(0)?(n.log(e,"Attempting URL transition to "+i),u=new s["default"]({url:i})):(n.log(e,"Attempting transition to "+i),u=new a["default"]({name:t[0],contexts:n.slice.call(t,1),queryParams:l}));return e.transitionByIntent(u,r)}function b(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;n>r;++r)if(e[r]!==t[r])return!1;return!0}function y(e,t,r,i){for(var o in r)r.hasOwnProperty(o)&&null===r[o]&&delete r[o];var a=[];n.trigger(e,t,!0,["finalizeQueryParamChange",r,a,i]),i&&(i._visibleQueryParams={});for(var s={},l=0,u=a.length;u>l;++l){var c=a[l];s[c.key]=c.value,i&&c.visible!==!1&&(i._visibleQueryParams[c.key]=c.value)}return s}function w(e,t,r){var i,o,a,s,l,u,c=e.state.handlerInfos,d=[],f=null;for(s=c.length,a=0;s>a;a++){if(l=c[a],u=t.handlerInfos[a],!u||l.name!==u.name){f=a;break}u.isResolved||d.push(l)}null!==f&&(i=c.slice(f,s),o=function(e){for(var t=0,r=i.length;r>t;t++)if(i[t].name===e)return!0;return!1}),n.trigger(e,c,!0,["willTransition",r]),e.willTransition&&e.willTransition(c,t.handlerInfos,r)}var _=Array.prototype.pop;u.prototype={map:function(e){this.recognizer.delegate=this.delegate,this.recognizer.map(e,function(e,t){for(var r=t.length-1,n=!0;r>=0&&n;--r){var i=t[r];e.add(t,{as:i.handler}),n="/"===i.path||""===i.path||".index"===i.handler.slice(-6)}})},hasRoute:function(e){return this.recognizer.hasRoute(e)},getHandler:function(){},queryParamsTransition:function(e,t,r,i){var a=this;if(d(this,i,e),!t&&this.activeTransition)return this.activeTransition;var s=new o.Transition(this);return s.queryParamsOnly=!0,r.queryParams=y(this,i.handlerInfos,i.queryParams,s),s.promise=s.promise.then(function(e){return m(s,r,!0),a.didTransition&&a.didTransition(a.currentHandlerInfos),e},null,n.promiseLabel("Transition complete")),s},transitionByIntent:function(e,t){try{return c.apply(this,arguments)}catch(r){return new o.Transition(this,e,null,r)}},reset:function(){this.state&&n.forEach(this.state.handlerInfos.slice().reverse(),function(e){var t=e.handler;n.callHook(t,"exit")}),this.state=new i["default"],this.currentHandlerInfos=null},activeTransition:null,handleURL:function(e){var t=n.slice.call(arguments);return"/"!==e.charAt(0)&&(t[0]="/"+e),g(this,t).method(null)},updateURL:function(){throw new Error("updateURL is not implemented")},replaceURL:function(e){this.updateURL(e)},transitionTo:function(e){return g(this,arguments)},intermediateTransitionTo:function(e){return g(this,arguments,!0)},refresh:function(e){for(var t=this.activeTransition?this.activeTransition.state:this.state,r=t.handlerInfos,i={},o=0,s=r.length;s>o;++o){var l=r[o];i[l.name]=l.params||{}}n.log(this,"Starting a refresh transition");var u=new a["default"]({name:r[r.length-1].name,pivotHandler:e||r[0].handler,contexts:[],queryParams:this._changedQueryParams||t.queryParams||{}});return this.transitionByIntent(u,!1)},replaceWith:function(e){return g(this,arguments).method("replace")},generate:function(e){for(var t=n.extractQueryParams(n.slice.call(arguments,1)),r=t[0],i=t[1],o=new a["default"]({name:e,contexts:r}),s=o.applyToState(this.state,this.recognizer,this.getHandler),l={},u=0,c=s.handlerInfos.length;c>u;++u){var d=s.handlerInfos[u],f=d.serialize();n.merge(l,f)}return l.queryParams=i,this.recognizer.generate(e,l)},applyIntent:function(e,t){var r=new a["default"]({name:e,contexts:t}),n=this.activeTransition&&this.activeTransition.state||this.state;return r.applyToState(n,this.recognizer,this.getHandler)},isActiveIntent:function(e,t,r,o){var s,l,u=o||this.state,c=u.handlerInfos;if(!c.length)return!1;var d=c[c.length-1].name,f=this.recognizer.handlersFor(d),h=0;for(l=f.length;l>h&&(s=c[h],s.name!==e);++h);if(h===f.length)return!1;var p=new i["default"];p.handlerInfos=c.slice(0,h+1),f=f.slice(0,h+1);var m=new a["default"]({name:d,contexts:t}),v=m.applyToHandlers(p,f,this.getHandler,d,!0,!0),g=b(v.handlerInfos,p.handlerInfos);if(!r||!g)return g;var y={};n.merge(y,r);var w=u.queryParams;for(var _ in w)w.hasOwnProperty(_)&&y.hasOwnProperty(_)&&(y[_]=w[_]);return g&&!n.getChangelist(y,r)},isActive:function(e){var t=n.extractQueryParams(n.slice.call(arguments,1));return this.isActiveIntent(e,t[0],t[1])},trigger:function(e){var t=n.slice.call(arguments);n.trigger(this,this.currentHandlerInfos,!1,t)},log:null},e["default"]=u}),e("router/transition-intent/named-transition-intent",["exports","router/transition-intent","router/transition-state","router/handler-info/factory","router/utils"],function(e,t,r,n,i){"use strict";e["default"]=i.subclass(t["default"],{name:null,pivotHandler:null,contexts:null,queryParams:null,initialize:function(e){this.name=e.name,this.pivotHandler=e.pivotHandler,this.contexts=e.contexts||[],this.queryParams=e.queryParams},applyToState:function(e,t,r,n){var o=i.extractQueryParams([this.name].concat(this.contexts)),a=o[0],s=(o[1],t.handlersFor(a[0])),l=s[s.length-1].handler;return this.applyToHandlers(e,s,r,l,n)},applyToHandlers:function(e,t,n,o,a,s){var l,u,c=new r["default"],d=this.contexts.slice(0),f=t.length;if(this.pivotHandler)for(l=0,u=t.length;u>l;++l)if(n(t[l].handler)===this.pivotHandler){f=l;break}!this.pivotHandler;for(l=t.length-1;l>=0;--l){var h=t[l],p=h.handler,m=n(p),v=e.handlerInfos[l],g=null;if(g=h.names.length>0?l>=f?this.createParamHandlerInfo(p,m,h.names,d,v):this.getHandlerInfoForDynamicSegment(p,m,h.names,d,v,o,l):this.createParamHandlerInfo(p,m,h.names,d,v),s){g=g.becomeResolved(null,g.context);var b=v&&v.context;h.names.length>0&&g.context===b&&(g.params=v&&v.params),g.context=b}var y=v;(l>=f||g.shouldSupercede(v))&&(f=Math.min(l,f),y=g),a&&!s&&(y=y.becomeResolved(null,y.context)),c.handlerInfos.unshift(y)}if(d.length>0)throw new Error("More context objects were passed than there are dynamic segments for the route: "+o);return a||this.invalidateChildren(c.handlerInfos,f),i.merge(c.queryParams,this.queryParams||{}),c},invalidateChildren:function(e,t){for(var r=t,n=e.length;n>r;++r){e[r];e[r]=e[r].getUnresolved()}},getHandlerInfoForDynamicSegment:function(e,t,r,o,a,s,l){var u;r.length;if(o.length>0){if(u=o[o.length-1],i.isParam(u))return this.createParamHandlerInfo(e,t,r,o,a);o.pop()}else{if(a&&a.name===e)return a;if(!this.preTransitionState)return a;var c=this.preTransitionState.handlerInfos[l];u=c&&c.context}return n["default"]("object",{name:e,handler:t,context:u,names:r})},createParamHandlerInfo:function(e,t,r,o,a){for(var s={},l=r.length;l--;){var u=a&&e===a.name&&a.params||{},c=o[o.length-1],d=r[l];if(i.isParam(c))s[d]=""+o.pop();else{if(!u.hasOwnProperty(d))throw new Error("You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route "+e);s[d]=u[d]}}return n["default"]("param",{name:e,handler:t,params:s})}})}),e("router/transition-intent/url-transition-intent",["exports","router/transition-intent","router/transition-state","router/handler-info/factory","router/utils","router/unrecognized-url-error"],function(e,t,r,n,i,o){"use strict";e["default"]=i.subclass(t["default"],{url:null,initialize:function(e){this.url=e.url},applyToState:function(e,t,a){var s,l,u=new r["default"],c=t.recognize(this.url);if(!c)throw new o["default"](this.url);var d=!1;for(s=0,l=c.length;l>s;++s){var f=c[s],h=f.handler,p=a(h);if(p.inaccessibleByURL)throw new o["default"](this.url);var m=n["default"]("param",{name:h,handler:p,params:f.params}),v=e.handlerInfos[s];d||m.shouldSupercede(v)?(d=!0,u.handlerInfos[s]=m):u.handlerInfos[s]=v}return i.merge(u.queryParams,c.queryParams),u}})}),e("router/transition-intent",["exports","router/utils"],function(e,t){"use strict";function r(e){this.initialize(e),this.data=this.data||{}}r.prototype={initialize:null,applyToState:null},e["default"]=r}),e("router/transition-state",["exports","router/handler-info","router/utils","rsvp/promise"],function(e,t,r,n){"use strict";function i(e){this.handlerInfos=[],this.queryParams={},this.params={}}i.prototype={handlerInfos:null,queryParams:null,params:null,promiseLabel:function(e){var t="";return r.forEach(this.handlerInfos,function(e){""!==t&&(t+="."),t+=e.name}),r.promiseLabel("'"+t+"': "+e)},resolve:function(e,t){function i(){return n["default"].resolve(e(),u.promiseLabel("Check if should continue"))["catch"](function(e){return c=!0,n["default"].reject(e)},u.promiseLabel("Handle abort"))}function o(e){var r=u.handlerInfos,i=t.resolveIndex>=r.length?r.length-1:t.resolveIndex;return n["default"].reject({error:e,handlerWithError:u.handlerInfos[i].handler,wasAborted:c,state:u})}function a(e){var n=u.handlerInfos[t.resolveIndex].isResolved;if(u.handlerInfos[t.resolveIndex++]=e,!n){var o=e.handler;r.callHook(o,"redirect",e.context,t)}return i().then(s,null,u.promiseLabel("Resolve handler"))}function s(){if(t.resolveIndex===u.handlerInfos.length)return{error:null,state:u};var e=u.handlerInfos[t.resolveIndex];return e.resolve(i,t).then(a,null,u.promiseLabel("Proceed"))}var l=this.params;r.forEach(this.handlerInfos,function(e){l[e.name]=e.params||{}}),t=t||{},t.resolveIndex=0;var u=this,c=!1;return n["default"].resolve(null,this.promiseLabel("Start transition")).then(s,null,this.promiseLabel("Resolve handler"))["catch"](o,this.promiseLabel("Handle error"))}},e["default"]=i}),e("router/transition",["exports","rsvp/promise","router/handler-info","router/utils"],function(e,t,r,n){"use strict";function i(e,r,a,s){function l(){return u.isAborted?t["default"].reject(void 0,n.promiseLabel("Transition aborted - reject")):void 0}var u=this;if(this.state=a||e.state,this.intent=r,this.router=e,this.data=this.intent&&this.intent.data||{},this.resolvedModels={},this.queryParams={},s)return this.promise=t["default"].reject(s),void(this.error=s);if(a){this.params=a.params,this.queryParams=a.queryParams,this.handlerInfos=a.handlerInfos;var c=a.handlerInfos.length;c&&(this.targetName=a.handlerInfos[c-1].name);for(var d=0;c>d;++d){var f=a.handlerInfos[d];if(!f.isResolved)break;this.pivotHandler=f.handler}this.sequence=i.currentSequence++,this.promise=a.resolve(l,this)["catch"](function(e){return e.wasAborted||u.isAborted?t["default"].reject(o(u)):(u.trigger("error",e.error,u,e.handlerWithError),u.abort(),t["default"].reject(e.error))},n.promiseLabel("Handle Abort"))}else this.promise=t["default"].resolve(this.state),this.params={}}function o(e){return n.log(e.router,e.sequence,"detected abort."),new a}function a(e){this.message=e||"TransitionAborted",this.name="TransitionAborted"}i.currentSequence=0,i.prototype={targetName:null,urlMethod:"update",intent:null,params:null,pivotHandler:null,resolveIndex:0,handlerInfos:null,resolvedModels:null,isActive:!0,state:null,queryParamsOnly:!1,isTransition:!0,isExiting:function(e){for(var t=this.handlerInfos,r=0,n=t.length;n>r;++r){var i=t[r];if(i.name===e||i.handler===e)return!1}return!0},promise:null,data:null,then:function(e,t,r){return this.promise.then(e,t,r)},"catch":function(e,t){return this.promise["catch"](e,t)},"finally":function(e,t){return this.promise["finally"](e,t)},abort:function(){return this.isAborted?this:(n.log(this.router,this.sequence,this.targetName+": transition was aborted"),this.intent.preTransitionState=this.router.state,this.isAborted=!0,this.isActive=!1,this.router.activeTransition=null,this)},retry:function(){return this.abort(),this.router.transitionByIntent(this.intent,!1)},method:function(e){return this.urlMethod=e,this},trigger:function(e){var t=n.slice.call(arguments);"boolean"==typeof e?t.shift():e=!1,n.trigger(this.router,this.state.handlerInfos.slice(0,this.resolveIndex+1),e,t)},followRedirects:function(){var e=this.router;return this.promise["catch"](function(r){return e.activeTransition?e.activeTransition.followRedirects():t["default"].reject(r)})},toString:function(){return"Transition (sequence "+this.sequence+")"},log:function(e){n.log(this.router,this.sequence,e)}},i.prototype.send=i.prototype.trigger,e.Transition=i,e.logAbort=o,e.TransitionAborted=a}),e("router/unrecognized-url-error",["exports","router/utils"],function(e,t){"use strict";function r(e){this.message=e||"UnrecognizedURLError",this.name="UnrecognizedURLError",Error.call(this)}r.prototype=t.oCreate(Error.prototype),e["default"]=r}),e("router/utils",["exports"],function(e){"use strict";function t(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}function r(e){var t,r,n=e&&e.length;return n&&n>0&&e[n-1]&&e[n-1].hasOwnProperty("queryParams")?(r=e[n-1].queryParams,t=v.call(e,0,n-1),[t,r]):[e,null]}function n(e){for(var t in e)if("number"==typeof e[t])e[t]=""+e[t];else if(g(e[t]))for(var r=0,n=e[t].length;n>r;r++)e[t][r]=""+e[t][r]}function i(e,t,r){e.log&&(3===arguments.length?e.log("Transition #"+t+": "+r):(r=t,e.log(r))); }function o(e,t){var r=arguments;return function(n){var i=v.call(r,2);return i.push(n),t.apply(e,i)}}function a(e){return"string"==typeof e||e instanceof String||"number"==typeof e||e instanceof Number}function s(e,t){for(var r=0,n=e.length;n>r&&!1!==t(e[r]);r++);}function l(e,t,r,n){if(e.triggerEvent)return void e.triggerEvent(t,r,n);var i=n.shift();if(!t){if(r)return;throw new Error("Could not trigger event '"+i+"'. There are no active handlers")}for(var o=!1,a=t.length-1;a>=0;a--){var s=t[a],l=s.handler;if(l.events&&l.events[i]){if(l.events[i].apply(l,n)!==!0)return;o=!0}}if(!o&&!r)throw new Error("Nothing handled the event '"+i+"'.")}function u(e,r){var i,o={all:{},changed:{},removed:{}};t(o.all,r);var a=!1;n(e),n(r);for(i in e)e.hasOwnProperty(i)&&(r.hasOwnProperty(i)||(a=!0,o.removed[i]=e[i]));for(i in r)if(r.hasOwnProperty(i))if(g(e[i])&&g(r[i]))if(e[i].length!==r[i].length)o.changed[i]=r[i],a=!0;else for(var s=0,l=e[i].length;l>s;s++)e[i][s]!==r[i][s]&&(o.changed[i]=r[i],a=!0);else e[i]!==r[i]&&(o.changed[i]=r[i],a=!0);return a&&o}function c(e){return"Router: "+e}function d(e,r){function n(t){e.call(this,t||{})}return n.prototype=b(e.prototype),t(n.prototype,r),n}function f(e,t){if(e){var r="_"+t;return e[r]&&r||e[t]&&t}}function h(e,t,r,n){var i=f(e,t);return i&&e[i].call(e,r,n)}function p(e,t,r){var n=f(e,t);return n?0===r.length?e[n].call(e):1===r.length?e[n].call(e,r[0]):2===r.length?e[n].call(e,r[0],r[1]):e[n].apply(e,r):void 0}e.extractQueryParams=r,e.log=i,e.bind=o,e.forEach=s,e.trigger=l,e.getChangelist=u,e.promiseLabel=c,e.subclass=d;var m,v=Array.prototype.slice;m=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var g=m;e.isArray=g;var b=Object.create||function(e){function t(){}return t.prototype=e,new t};e.oCreate=b,e.merge=t,e.slice=v,e.isParam=a,e.coerceQueryParamsToString=n,e.callHook=h,e.resolveHook=f,e.applyHook=p}),e("router",["exports","router/router"],function(e,t){"use strict";e["default"]=t["default"]}),e("rsvp/-internal",["exports","rsvp/utils","rsvp/instrument","rsvp/config"],function(e,t,r,n){"use strict";function i(){return new TypeError("A promises callback cannot return that same promise.")}function o(){}function a(e){try{return e.then}catch(t){return C.error=t,C}}function s(e,t,r,n){try{e.call(t,r,n)}catch(i){return i}}function l(e,t,r){n.config.async(function(e){var n=!1,i=s(r,t,function(r){n||(n=!0,t!==r?d(e,r):h(e,r))},function(t){n||(n=!0,p(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&i&&(n=!0,p(e,i))},e)}function u(e,t){t._state===k?h(e,t._result):t._state===x?(t._onError=null,p(e,t._result)):m(t,void 0,function(r){t!==r?d(e,r):h(e,r)},function(t){p(e,t)})}function c(e,r){if(r.constructor===e.constructor)u(e,r);else{var n=a(r);n===C?p(e,C.error):void 0===n?h(e,r):t.isFunction(n)?l(e,r,n):h(e,r)}}function d(e,r){e===r?h(e,r):t.objectOrFunction(r)?c(e,r):h(e,r)}function f(e){e._onError&&e._onError(e._result),v(e)}function h(e,t){e._state===_&&(e._result=t,e._state=k,0===e._subscribers.length?n.config.instrument&&r["default"]("fulfilled",e):n.config.async(v,e))}function p(e,t){e._state===_&&(e._state=x,e._result=t,n.config.async(f,e))}function m(e,t,r,i){var o=e._subscribers,a=o.length;e._onError=null,o[a]=t,o[a+k]=r,o[a+x]=i,0===a&&e._state&&n.config.async(v,e)}function v(e){var t=e._subscribers,i=e._state;if(n.config.instrument&&r["default"](i===k?"fulfilled":"rejected",e),0!==t.length){for(var o,a,s=e._result,l=0;le;e+=2){var t=b[e],r=b[e+1];t(r),b[e]=void 0,b[e+1]=void 0}f=0}function u(){try{var e=r,t=e("vertx");return c=t.runOnLoop||t.runOnContext,i()}catch(n){return s()}}e["default"]=t;var c,d,f=0,h=({}.toString,"undefined"!=typeof window?window:void 0),p=h||{},m=p.MutationObserver||p.WebKitMutationObserver,v="undefined"==typeof window&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),g="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,b=new Array(1e3);d=v?n():m?o():g?a():void 0===h&&"function"==typeof r?u():s()}),e("rsvp/config",["exports","rsvp/events"],function(e,t){"use strict";function r(e,t){return"onerror"===e?void n.on("error",t):2!==arguments.length?n[e]:void(n[e]=t)}var n={instrument:!1};t["default"].mixin(n),e.config=n,e.configure=r}),e("rsvp/defer",["exports","rsvp/promise"],function(e,t){"use strict";function r(e){var r={};return r.promise=new t["default"](function(e,t){r.resolve=e,r.reject=t},e),r}e["default"]=r}),e("rsvp/enumerator",["exports","rsvp/utils","rsvp/-internal"],function(e,t,r){"use strict";function n(e,t,n){return e===r.FULFILLED?{state:"fulfilled",value:n}:{state:"rejected",reason:n}}function i(e,t,n,i){var o=this;o._instanceConstructor=e,o.promise=new e(r.noop,i),o._abortOnReject=n,o._validateInput(t)?(o._input=t,o.length=t.length,o._remaining=t.length,o._init(),0===o.length?r.fulfill(o.promise,o._result):(o.length=o.length||0,o._enumerate(),0===o._remaining&&r.fulfill(o.promise,o._result))):r.reject(o.promise,o._validationError())}e.makeSettledResult=n,e["default"]=i,i.prototype._validateInput=function(e){return t.isArray(e)},i.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},i.prototype._init=function(){this._result=new Array(this.length)},i.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,i=e._input,o=0;n._state===r.PENDING&&t>o;o++)e._eachEntry(i[o],o)},i.prototype._eachEntry=function(e,n){var i=this,o=i._instanceConstructor;t.isMaybeThenable(e)?e.constructor===o&&e._state!==r.PENDING?(e._onError=null,i._settledAt(e._state,n,e._result)):i._willSettleAt(o.resolve(e),n):(i._remaining--,i._result[n]=i._makeResult(r.FULFILLED,n,e))},i.prototype._settledAt=function(e,t,n){var i=this,o=i.promise;o._state===r.PENDING&&(i._remaining--,i._abortOnReject&&e===r.REJECTED?r.reject(o,n):i._result[t]=i._makeResult(e,t,n)),0===i._remaining&&r.fulfill(o,i._result)},i.prototype._makeResult=function(e,t,r){return r},i.prototype._willSettleAt=function(e,t){var n=this;r.subscribe(e,void 0,function(e){n._settledAt(r.FULFILLED,t,e)},function(e){n._settledAt(r.REJECTED,t,e)})}}),e("rsvp/events",["exports"],function(e){"use strict";function t(e,t){for(var r=0,n=e.length;n>r;r++)if(e[r]===t)return r;return-1}function r(e){var t=e._promiseCallbacks;return t||(t=e._promiseCallbacks={}),t}e["default"]={mixin:function(e){return e.on=this.on,e.off=this.off,e.trigger=this.trigger,e._promiseCallbacks=void 0,e},on:function(e,n){if("function"!=typeof n)throw new TypeError("Callback must be a function");var i,o=r(this);i=o[e],i||(i=o[e]=[]),-1===t(i,n)&&i.push(n)},off:function(e,n){var i,o,a=r(this);return n?(i=a[e],o=t(i,n),void(-1!==o&&i.splice(o,1))):void(a[e]=[])},trigger:function(e,t){var n,i,o=r(this);if(n=o[e])for(var a=0;as;s++)a[s]=n(e[s]);return t["default"].all(a,i).then(function(t){for(var r=new Array(o),n=0,i=0;o>i;i++)t[i]&&(r[n]=e[i],n++);return r.length=n,r})})}e["default"]=n}),e("rsvp/hash-settled",["exports","rsvp/promise","rsvp/enumerator","rsvp/promise-hash","rsvp/utils"],function(e,t,r,n,i){"use strict";function o(e,t,r){this._superConstructor(e,t,!1,r)}function a(e,r){return new o(t["default"],e,r).promise}e["default"]=a,o.prototype=i.o_create(n["default"].prototype),o.prototype._superConstructor=r["default"],o.prototype._makeResult=r.makeSettledResult,o.prototype._validationError=function(){return new Error("hashSettled must be called with an object")}}),e("rsvp/hash",["exports","rsvp/promise","rsvp/promise-hash"],function(e,t,r){"use strict";function n(e,n){return new r["default"](t["default"],e,n).promise}e["default"]=n}),e("rsvp/instrument",["exports","rsvp/config","rsvp/utils"],function(e,t,r){"use strict";function n(){setTimeout(function(){for(var e,r=0;rs;s++)a[s]=n(e[s]);return t["default"].all(a,i)})}e["default"]=n}),e("rsvp/node",["exports","rsvp/promise","rsvp/-internal","rsvp/utils"],function(e,t,r,n){"use strict";function i(){this.value=void 0}function o(e){try{return e.then}catch(t){return p.value=t,p}}function a(e,t,r){try{e.apply(t,r)}catch(n){return p.value=n,p}}function s(e,t){for(var r,n,i={},o=e.length,a=new Array(o),s=0;o>s;s++)a[s]=e[s];for(n=0;nn;n++)r[n-1]=e[n];return r}function u(e,t){return{then:function(r,n){return e.call(t,r,n)}}}function c(e,i){var o=function(){for(var o,a=this,c=arguments.length,p=new Array(c+1),v=!1,g=0;c>g;++g){if(o=arguments[g],!v){if(v=h(o),v===m){var b=new t["default"](r.noop);return r.reject(b,m.value),b}v&&v!==!0&&(o=u(v,o))}p[g]=o}var y=new t["default"](r.noop);return p[c]=function(e,t){e?r.reject(y,e):void 0===i?r.resolve(y,t):i===!0?r.resolve(y,l(arguments)):n.isArray(i)?r.resolve(y,s(arguments,i)):r.resolve(y,t)},v?f(y,p,e,a):d(y,p,e,a)};return o.__proto__=e,o}function d(e,t,n,i){var o=a(n,i,t);return o===p&&r.reject(e,o.value),e}function f(e,n,i,o){return t["default"].all(n).then(function(t){var n=a(i,o,t);return n===p&&r.reject(e,n.value),e})}function h(e){return e&&"object"==typeof e?e.constructor===t["default"]?!0:o(e):!1}e["default"]=c;var p=new i,m=new i}),e("rsvp/platform",["exports"],function(e){"use strict";var t;if("object"==typeof self)t=self;else{if("object"!=typeof global)throw new Error("no global: `self` or `global` found");t=global}e["default"]=t}),e("rsvp/promise/all",["exports","rsvp/enumerator"],function(e,t){"use strict";function r(e,r){return new t["default"](this,e,!0,r).promise}e["default"]=r}),e("rsvp/promise/race",["exports","rsvp/utils","rsvp/-internal"],function(e,t,r){"use strict";function n(e,n){function i(e){r.resolve(s,e)}function o(e){r.reject(s,e)}var a=this,s=new a(r.noop,n);if(!t.isArray(e))return r.reject(s,new TypeError("You must pass an array to race.")),s;for(var l=e.length,u=0;s._state===r.PENDING&&l>u;u++)r.subscribe(a.resolve(e[u]),void 0,i,o);return s}e["default"]=n}),e("rsvp/promise/reject",["exports","rsvp/-internal"],function(e,t){"use strict";function r(e,r){var n=this,i=new n(t.noop,r);return t.reject(i,e),i}e["default"]=r}),e("rsvp/promise/resolve",["exports","rsvp/-internal"],function(e,t){"use strict";function r(e,r){var n=this;if(e&&"object"==typeof e&&e.constructor===n)return e;var i=new n(t.noop,r);return t.resolve(i,e),i}e["default"]=r}),e("rsvp/promise-hash",["exports","rsvp/enumerator","rsvp/-internal","rsvp/utils"],function(e,t,r,n){"use strict";function i(e,t,r){this._superConstructor(e,t,!0,r)}e["default"]=i,i.prototype=n.o_create(t["default"].prototype),i.prototype._superConstructor=t["default"],i.prototype._init=function(){this._result={}},i.prototype._validateInput=function(e){return e&&"object"==typeof e},i.prototype._validationError=function(){return new Error("Promise.hash must be called with an object")},i.prototype._enumerate=function(){var e=this,t=e.promise,n=e._input,i=[];for(var o in n)t._state===r.PENDING&&Object.prototype.hasOwnProperty.call(n,o)&&i.push({position:o,entry:n[o]});var a=i.length;e._remaining=a;for(var s,l=0;t._state===r.PENDING&&a>l;l++)s=i[l],e._eachEntry(s.entry,s.position)}}),e("rsvp/promise",["exports","rsvp/config","rsvp/instrument","rsvp/utils","rsvp/-internal","rsvp/promise/all","rsvp/promise/race","rsvp/promise/resolve","rsvp/promise/reject"],function(e,t,r,n,i,o,a,s,l){"use strict";function u(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function c(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function d(e,o){var a=this;a._id=h++,a._label=o,a._state=void 0,a._result=void 0,a._subscribers=[],t.config.instrument&&r["default"]("created",a),i.noop!==e&&(n.isFunction(e)||u(),a instanceof d||c(),i.initializePromise(a,e))}e["default"]=d;var f="rsvp_"+n.now()+"-",h=0;d.cast=s["default"],d.all=o["default"],d.race=a["default"],d.resolve=s["default"],d.reject=l["default"],d.prototype={constructor:d,_guidKey:f,_onError:function(e){var r=this;t.config.after(function(){r._onError&&t.config.trigger("error",e)})},then:function(e,n,o){var a=this,s=a._state;if(s===i.FULFILLED&&!e||s===i.REJECTED&&!n)return t.config.instrument&&r["default"]("chained",a,a),a;a._onError=null;var l=new a.constructor(i.noop,o),u=a._result;if(t.config.instrument&&r["default"]("chained",a,l),s){var c=arguments[s-1];t.config.async(function(){i.invokeCallback(s,l,c,u)})}else i.subscribe(a,l,e,n);return l},"catch":function(e,t){return this.then(void 0,e,t)},"finally":function(e,t){var r=this,n=r.constructor;return r.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})},t)}}}),e("rsvp/race",["exports","rsvp/promise"],function(e,t){"use strict";function r(e,r){return t["default"].race(e,r)}e["default"]=r}),e("rsvp/reject",["exports","rsvp/promise"],function(e,t){"use strict";function r(e,r){return t["default"].reject(e,r)}e["default"]=r}),e("rsvp/resolve",["exports","rsvp/promise"],function(e,t){"use strict";function r(e,r){return t["default"].resolve(e,r)}e["default"]=r}),e("rsvp/rethrow",["exports"],function(e){"use strict";function t(e){throw setTimeout(function(){throw e}),e}e["default"]=t}),e("rsvp/utils",["exports"],function(e){"use strict";function t(e){return"function"==typeof e||"object"==typeof e&&null!==e}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(){}e.objectOrFunction=t,e.isFunction=r,e.isMaybeThenable=n;var o;o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var a=o;e.isArray=a;var s=Date.now||function(){return(new Date).getTime()};e.now=s;var l=Object.create||function(e){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof e)throw new TypeError("Argument must be an object");return i.prototype=e,new i};e.o_create=l}),e("rsvp",["exports","rsvp/promise","rsvp/events","rsvp/node","rsvp/all","rsvp/all-settled","rsvp/race","rsvp/hash","rsvp/hash-settled","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/map","rsvp/resolve","rsvp/reject","rsvp/filter","rsvp/asap"],function(e,t,r,n,i,o,a,s,l,u,c,d,f,h,p,m,v){"use strict";function g(e,t){d.config.async(e,t)}function b(){d.config.on.apply(d.config,arguments)}function y(){d.config.off.apply(d.config,arguments)}d.config.async=v["default"],d.config.after=function(e){setTimeout(e,0)};var w=h["default"];if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){var _=window.__PROMISE_INSTRUMENTATION__;d.configure("instrument",!0);for(var k in _)_.hasOwnProperty(k)&&b(k,_[k])}e.cast=w,e.Promise=t["default"],e.EventTarget=r["default"],e.all=i["default"],e.allSettled=o["default"],e.race=a["default"],e.hash=s["default"],e.hashSettled=l["default"],e.rethrow=u["default"],e.defer=c["default"],e.denodeify=n["default"],e.configure=d.configure,e.on=b,e.off=y,e.resolve=h["default"],e.reject=p["default"],e.async=g,e.map=f["default"],e.filter=m["default"]}),e("rsvp.umd",["exports","rsvp/platform","rsvp"],function(e,t,r){"use strict";var n={race:r.race,Promise:r.Promise,allSettled:r.allSettled,hash:r.hash,hashSettled:r.hashSettled,denodeify:r.denodeify,on:r.on,off:r.off,map:r.map,filter:r.filter,resolve:r.resolve,reject:r.reject,all:r.all,rethrow:r.rethrow,defer:r.defer,EventTarget:r.EventTarget,configure:r.configure,async:r.async};"function"==typeof define&&define.amd?define(function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:"undefined"!=typeof t["default"]&&(t["default"].RSVP=n)}),e("vertex",["exports"],function(e){"use strict";function t(e){this.name=e,this.incoming={},this.incomingNames=[],this.hasOutgoing=!1,this.value=null}e["default"]=t}),e("visit",["exports"],function(e){"use strict";function t(e,r,n,i){var o,a=e.name,s=e.incoming,l=e.incomingNames,u=l.length;if(n||(n={}),i||(i=[]),!n.hasOwnProperty(a)){for(i.push(a),n[a]=!0,o=0;u>o;o++)t(s[l[o]],r,n,i);r(e,i),i.pop()}}e["default"]=t}),t("ember")}(),function(){function e(){var e={ember:{"default":Ember},"ember-application":{"default":Ember.Application},"ember-array":{"default":Ember.Array},"ember-array/mutable":{"default":Ember.MutableArray},"ember-array/utils":{A:Ember.A,isEmberArray:Ember.isArray,wrap:Ember.makeArray},"ember-component":{"default":Ember.Component},"ember-components/checkbox":{"default":Ember.Checkbox},"ember-components/text-area":{"default":Ember.TextArea},"ember-components/text-field":{"default":Ember.TextField},"ember-controller":{"default":Ember.Controller},"ember-controller/inject":{"default":Ember.inject.controller},"ember-controller/proxy":{"default":Ember.ArrayProxy},"ember-controllers/sortable":{"default":Ember.SortableMixin},"ember-debug":{log:Ember.debug,inspect:Ember.inspect,run:Ember.runInDebug,warn:Ember.warn},"ember-debug/container-debug-adapter":{"default":Ember.ContainerDebugAdapter},"ember-debug/data-adapter":{"default":Ember.DataAdapter},"ember-deprecations":{deprecate:Ember.deprecate,deprecateFunc:Ember.deprecateFunc},"ember-enumerable":{"default":Ember.Enumerable},"ember-evented":{"default":Ember.Evented},"ember-evented/on":{"default":Ember.on},"ember-globals-resolver":{"default":Ember.DefaultResolver},"ember-helper":{"default":Ember.Helper,helper:Ember.Helper&&Ember.Helper.helper},"ember-instrumentation":{instrument:Ember.Instrumentation.instrument,reset:Ember.Instrumentation.reset,subscribe:Ember.Instrumentation.subscribe,unsubscribe:Ember.Instrumentation.unsubscribe},"ember-locations/hash":{"default":Ember.HashLocation},"ember-locations/history":{"default":Ember.HistoryLocation},"ember-locations/none":{"default":Ember.NoneLocation},"ember-map":{"default":Ember.Map,withDefault:Ember.MapWithDefault},"ember-metal/destroy":{"default":Ember.destroy},"ember-metal/events":{addListener:Ember.addListener,removeListener:Ember.removeListener,send:Ember.sendEvent},"ember-metal/get":{"default":Ember.get},"ember-metal/mixin":{"default":Ember.Mixin},"ember-metal/observer":{"default":Ember.observer,addObserver:Ember.addObserver,removeObserver:Ember.removeObserver},"ember-metal/on-load":{"default":Ember.onLoad,run:Ember.runLoadHooks},"ember-metal/set":{"default":Ember.set,setProperties:Ember.setProperties,trySet:Ember.trySet},"ember-metal/utils":{aliasMethod:Ember.aliasMethod,assert:Ember.assert,cacheFor:Ember.cacheFor,copy:Ember.copy},"ember-object":{"default":Ember.Object},"ember-platform":{assign:Ember.merge,create:Ember.create,defineProperty:Ember.platform.defineProperty,hasAccessors:Ember.platform.hasPropertyAccessors,keys:Ember.keys},"ember-route":{"default":Ember.Route},"ember-router":{"default":Ember.Router},"ember-runloop":{"default":Ember.run,begin:Ember.run.begin,bind:Ember.run.bind,cancel:Ember.run.cancel,debounce:Ember.run.debounce,end:Ember.run.end,join:Ember.run.join,later:Ember.run.later,next:Ember.run.next,once:Ember.run.once,schedule:Ember.run.schedule,scheduleOnce:Ember.run.scheduleOnce,throttle:Ember.run.throttle},"ember-service":{"default":Ember.Service},"ember-service/inject":{"default":Ember.inject.service},"ember-set/ordered":{"default":Ember.OrderedSet},"ember-string":{camelize:Ember.String.camelize,capitalize:Ember.String.capitalize,classify:Ember.String.classify,dasherize:Ember.String.dasherize,decamelize:Ember.String.decamelize,fmt:Ember.String.fmt,htmlSafe:Ember.String.htmlSafe,loc:Ember.String.loc,underscore:Ember.String.underscore,w:Ember.String.w},"ember-utils":{isBlank:Ember.isBlank,isEmpty:Ember.isEmpty,isNone:Ember.isNone,isPresent:Ember.isPresent,tryInvoke:Ember.tryInvoke,typeOf:Ember.typeOf}};e["ember-computed"]={"default":Ember.computed};for(var t=["empty","notEmpty","none","not","bool","match","equal","gt","gte","lt","lte","alias","oneWay","reads","readOnly","deprecatingAlias","and","or","collect","sum","min","max","map","sort","setDiff","mapBy","mapProperty","filter","filterBy","filterProperty","uniq","union","intersect"],n=0,i=t.length;i>n;n++){var o=t[n];e["ember-computed"][o]=Ember.computed[o]}for(var a in e)r(a,e[a])}function t(){var e={"ember-data":"","ember-data/model":"Model","ember-data/serializers/rest":"RESTSerializer","ember-data/serializers/active-model":"ActiveModelSerializer","ember-data/serializers/json":"JSONSerializer","ember-data/serializers/json-api":"JSONAPISerializer","ember-data/adapters/json-api":"JSONAPIAdapter","ember-data/adapters/rest":"RESTAdapter","ember-data/adapter":"Adapter","ember-data/adapters/active-model":"ActiveModelAdapter","ember-data/store":"Store","ember-data/transform":"Transform","ember-data/attr":"attr","ember-data/relationships":["hasMany","belongsTo"]};for(var t in e)n("DS",t,e[t]);if(Ember.Test){var i={"ember-test":{"default":Ember.Test},"ember-test/adapter":{"default":Ember.Test.Adapter},"ember-test/qunit-adapter":{"default":Ember.Test.QUnitAdapter}};for(var t in i)r(t,i[t])}}function r(e,t){define(e,[],function(){"use strict";return t})}function n(e,t,r){define(t,[],function(){"use strict";var t={};if("object"==typeof r)for(var n=0,i=r.length;i>n;n++)t[r[n]]=window[e][r[n]];else t["default"]=""!==r?window[e][r]:window[e];return t})}e(),t(),r("jquery",{"default":self.jQuery})}(),function(){define("ember/resolver",[],function(){"use strict";function e(e){return{create:function(t){return"function"==typeof e.extend?e.extend(t):e}}}function t(){var e=i(null);return e._dict=null,delete e._dict,e}function r(e){if(e.parsedName===!0)return e;var t,r,n,i=e.split("@");if("helper:@content-helper"!==e&&2===i.length){var s=i[0].split(":");if(2===s.length)t=s[1],r=s[0],n=i[1];else{var l=i[1].split(":");t=i[0],r=l[0],n=l[1]}}else i=e.split(":"),r=i[0],n=i[1];var u=n,c=a(this,"namespace"),d=c;return{parsedName:!0,fullName:e,prefix:t||this.prefix({type:r}),type:r,fullNameWithoutType:u,name:n,root:d,resolveMethodName:"resolve"+o(r)}}function n(t){Ember.assert("`modulePrefix` must be defined",this.namespace.modulePrefix);var r=this.findModuleName(t);if(r){var n=this._extractDefaultExport(r,t);if(void 0===n)throw new Error(" Expected to find: '"+t.fullName+"' within '"+r+"' but got 'undefined'. Did you forget to `export default` within '"+r+"'?");return this.shouldWrapInClassFactory(n,t)&&(n=e(n)),n}return this._super(t)}"undefined"==typeof requirejs.entries&&(requirejs.entries=requirejs._eak_seen);var i=Object.create||Ember.create;if(!i||i(null).hasOwnProperty)throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg");var o=(Ember.String.underscore,Ember.String.classify),a=Ember.get,s=Ember.DefaultResolver.extend({resolveOther:n,resolveTemplate:n,pluralizedTypes:null,makeToString:function(e,t){return""+this.namespace.modulePrefix+"@"+t+":"},parseName:r,shouldWrapInClassFactory:function(e,t){return!1},init:function(){this._super(),this.moduleBasedResolver=!0,this._normalizeCache=t(),this.pluralizedTypes=this.pluralizedTypes||t(),this.pluralizedTypes.config||(this.pluralizedTypes.config="config"),this._deprecatedPodModulePrefix=!1},normalize:function(e){return this._normalizeCache[e]||(this._normalizeCache[e]=this._normalize(e))},_normalize:function(e){var t=e.split(":");return t.length>1?t[0]+":"+Ember.String.dasherize(t[1].replace(/\./g,"/")):e},pluralize:function(e){return this.pluralizedTypes[e]||(this.pluralizedTypes[e]=e+"s")},podBasedLookupWithPrefix:function(e,t){var r=t.fullNameWithoutType;return"template"===t.type&&(r=r.replace(/^components\//,"")),e+"/"+r+"/"+t.type},podBasedModuleName:function(e){var t=this.namespace.podModulePrefix||this.namespace.modulePrefix;return this.podBasedLookupWithPrefix(t,e)},podBasedComponentsInSubdir:function(e){var t=this.namespace.podModulePrefix||this.namespace.modulePrefix;return t+="/components","component"===e.type||e.fullNameWithoutType.match(/^components/)?this.podBasedLookupWithPrefix(t,e):void 0},mainModuleName:function(e){var t=e.prefix+"/"+e.type;return"main"===e.fullNameWithoutType?t:void 0},defaultModuleName:function(e){return e.prefix+"/"+this.pluralize(e.type)+"/"+e.fullNameWithoutType},prefix:function(e){var t=this.namespace.modulePrefix;return this.namespace[e.type+"Prefix"]&&(t=this.namespace[e.type+"Prefix"]),t},moduleNameLookupPatterns:Ember.computed(function(){return Ember.A([this.podBasedModuleName,this.podBasedComponentsInSubdir,this.mainModuleName,this.defaultModuleName])}),findModuleName:function(e,t){var r,n=this;return this.get("moduleNameLookupPatterns").find(function(i){var o=requirejs.entries,a=i.call(n,e);return a&&(a=n.chooseModuleName(o,a)),a&&o[a]&&(t||n._logLookup(!0,e,a),r=a),t||n._logLookup(r,e,a),r}),r},chooseModuleName:function(e,t){var r=Ember.String.underscore(t);if(t!==r&&e[t]&&e[r])throw new TypeError("Ambiguous module names: `"+t+"` and `"+r+"`");if(e[t])return t;if(e[r])return r;var n=t.replace(/\/-([^\/]*)$/,"/_$1");return e[n]?(Ember.deprecate('Modules should not contain underscores. Attempted to lookup "'+t+'" which was not found. Please rename "'+n+'" to "'+t+'" instead.',!1),n):t},lookupDescription:function(e){var t=this.parseName(e),r=this.findModuleName(t,!0);return r},_logLookup:function(e,t,r){if(Ember.ENV.LOG_MODULE_RESOLVER||t.root.LOG_RESOLVER){var n,i;n=e?"[✓]":"[ ]",i=t.fullName.length>60?".":new Array(60-t.fullName.length).join("."),r||(r=this.lookupDescription(t)),Ember.Logger.info(n,t.fullName,i,r)}},knownForType:function(e){for(var r=requirejs.entries,n=(Object.keys||Ember.keys)(r),i=t(),o=0,a=n.length;a>o;o++){var s=n[o],l=this.translateToContainerFullname(e,s);l&&(i[l]=!0)}return i},translateToContainerFullname:function(e,t){var r=this.prefix({type:e}),n=r+"/",i="/"+e,o=t.indexOf(n),a=t.indexOf(i);if(0===o&&a===t.length-i.length&&t.length>n.length+i.length)return e+":"+t.slice(o+n.length,a);var s=this.pluralize(e),l=r+"/"+s+"/";return 0===t.indexOf(l)&&t.length>l.length?e+":"+t.slice(l.length):void 0},_extractDefaultExport:function(e){var t=require(e,null,null,!0);return t&&t["default"]&&(t=t["default"]),t}});return s.moduleBasedResolver=!0,s["default"]=s,s}),define("resolver",["ember/resolver"],function(e){return Ember.deprecate('Importing/requiring Ember Resolver as "resolver" is deprecated, please use "ember/resolver" instead'),e})}(),function(){define("ember/container-debug-adapter",[],function(){"use strict";function e(e,t,r){var n=t.match(new RegExp("^/?"+r+"/(.+)/"+e+"$"));return n?n[1]:void 0}if("undefined"==typeof Ember.ContainerDebugAdapter)return null;var t=Ember.ContainerDebugAdapter.extend({canCatalogEntriesByType:function(e){return!0},_getEntries:function(){return requirejs.entries},catalogEntriesByType:function(t){var r=this._getEntries(),n=Ember.A(),i=this.namespace.modulePrefix;for(var o in r)if(r.hasOwnProperty(o)&&-1!==o.indexOf(t)){var a=e(t,o,this.namespace.podModulePrefix||i);a||(a=o.split(t+"s/").pop()),n.addObject(a)}return n}});return t["default"]=t,t})}(),function(){!function(){"use strict";Ember.Application.initializer({name:"container-debug-adapter",initialize:function(){var e=arguments[1]||arguments[0],t=require("ember/container-debug-adapter");require("ember/resolver");e.register("container-debug-adapter:main",t),e.inject("container-debug-adapter:main","namespace","application:main")}})}()}(),function(){define("ember/load-initializers",[],function(){"use strict";return{"default":function(e,t){var r=new RegExp("^"+t+"/((?:instance-)?initializers)/"),n=Object.keys||Ember.keys;n(requirejs._eak_seen).map(function(e){return{moduleName:e,matches:r.exec(e)}}).filter(function(e){return e.matches&&2===e.matches.length}).forEach(function(t){var r=t.moduleName,n=require(r,null,null,!0);if(!n)throw new Error(r+" must export an initializer.");var i=Ember.String.camelize(t.matches[1].substring(0,t.matches[1].length-1)),o=n["default"];if(!o.name){var a=r.match(/[^\/]+\/?$/)[0];o.name=a}e[i]&&e[i](o)})}}})}(),define("ic-ajax",["ember","exports"],function(e,t){"use strict";function r(){return n.apply(null,arguments).then(function(e){return e.response},null,"ic-ajax: unwrap raw ajax response")}function n(){return a(s.apply(null,arguments))}function i(e,t){t.response&&(t.response=JSON.parse(JSON.stringify(t.response))),d[e]=t}function o(e){return d&&d[e]}function a(e){return new c.RSVP.Promise(function(t,r){var n=o(e.url);return n?"success"===n.textStatus||null==n.textStatus?c.run.later(null,t,n):c.run.later(null,r,n):(e.success=l(t),e.error=u(r),void c.$.ajax(e))},"ic-ajax: "+(e.type||"GET")+" to "+e.url)}function s(){var e={};if(1===arguments.length?"string"==typeof arguments[0]?e.url=arguments[0]:e=arguments[0]:2===arguments.length&&(e=arguments[1],e.url=arguments[0]),e.success||e.error)throw new c.Error("ajax should use promises, received 'success' or 'error' callback");return e}function l(e){return function(t,r,n){c.run(null,e,{response:t,textStatus:r,jqXHR:n})}}function u(e){return function(t,r,n){c.run(null,e,{jqXHR:t,textStatus:r,errorThrown:n})}}var c=e["default"]||e;t.request=r,t["default"]=r,t.raw=n;var d={};t.__fixtures__=d,t.defineFixture=i,t.lookupFixture=o}),function(){var e,t,r,n;!function(){"use strict";function i(e){throw new Error("an unsupported module was defined, expected `define(name, deps, module)` instead got: `"+e+"` arguments to define`"); -}function o(e,t,r){this.id=m++,this.name=e,this.deps=!t.length&&r.length?v:t,this.module={exports:{}},this.callback=r,this.state=void 0,this._require=void 0,this.finalized=!1,this.hasExportsAsDep=!1}function a(e){this.name=e}function s(e,t){throw new Error("Could not find module `"+e+"` imported from `"+t+"`")}function l(e,t){for(var r=d[e];r&&r.callback instanceof a;)e=r.callback.name,r=d[e];return r||s(e,t),r.build(),r}function u(e,t){if("."!==e.charAt(0))return e;for(var r=e.split("/"),n=t.split("/"),i=n.slice(0,-1),o=0,a=r.length;a>o;o++){var s=r[o];if(".."===s){if(0===i.length)throw new Error("Cannot access parent module of root");i.pop()}else{if("."===s)continue;i.push(s)}}return i.join("/")}var c;c=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var d={},f={},h=!1,p=!0,m=0,v=["require","exports","module"];o.prototype.makeDefaultExport=function(){var e=this.module.exports;null===e||"object"!=typeof e&&"function"!=typeof e||void 0!==e["default"]||(e["default"]=e)},o.prototype.exports=function(e){if(this.finalized)return this.module.exports;var t=this.callback.apply(this,e);return this.hasExportsAsDep&&void 0===t||(this.module.exports=t),this.makeDefaultExport(),this.finalized=!0,this.module.exports},o.prototype.unsee=function(){this.finalized=!1,this.state=void 0,this.module={exports:{}}},o.prototype.reify=function(){for(var e,t=this.deps,r=t.length,n=new Array(r),i=0,o=r;o>i;i++)e=t[i],"exports"===e?(this.hasExportsAsDep=!0,n[i]=this.module.exports):"require"===e?n[i]=this.makeRequire():"module"===e?n[i]=this.module:n[i]=l(u(e,this.name),this.name).module.exports;return n},o.prototype.makeRequire=function(){var e=this.name;return this._require||(this._require=function(t){return r(u(t,e))})},o.prototype.build=function(){this.state!==h&&(this.state=h,this.exports(this.reify()),this.state=p)},e=function(e,t,r){arguments.length<2&&i(arguments.length),c(t)||(r=t,t=[]),d[e]=new o(e,t,r)},e.petal={},e.alias=function(e){return new a(e)},n=r=t=function(e){return l(e,"(require)").module.exports},n.entries=n._eak_seen=d,n.unsee=function(e){l(e,"(unsee)").unsee()},n.clear=function(){n.entries=n._eak_seen=d={},f={}}}(),e("content-kit-utils/array-utils",["exports"],function(e){"use strict";function t(e){for(var t=[],r=e&&e.length>>>0;r--;)t[r]=e[r];return t}function r(e){var t,r=0;for(t in e)e.hasOwnProperty(t)&&(r+=e[t]);return r}e.toArray=t,e.sumSparseArray=r}),e("content-kit-utils",["exports","content-kit-utils/array-utils","content-kit-utils/node-utils","content-kit-utils/object-utils","content-kit-utils/string-utils"],function(e,t,r,n,i){"use strict";e.toArray=t.toArray,e.sumSparseArray=t.sumSparseArray,e.textOfNode=r.textOfNode,e.unwrapNode=r.unwrapNode,e.attributesForNode=r.attributesForNode,e.mergeWithOptions=n.mergeWithOptions,e.merge=n.merge,e.inherit=n.inherit,e.trim=i.trim,e.trimLeft=i.trimLeft,e.underscore=i.underscore,e.sanitizeWhitespace=i.sanitizeWhitespace,e.injectIntoString=i.injectIntoString,e["default"]={}}),e("content-kit-utils/node-utils",["exports","content-kit-utils/string-utils","content-kit-utils/array-utils"],function(e,t,r){"use strict";function n(e){var r=e.textContent||e.innerText;return r?(0,t.sanitizeWhitespace)(r):""}function i(e){if(e.hasChildNodes()){var t,n=(0,r.toArray)(e.childNodes),i=n.length,o=e.parentNode;for(t=0;i>t;t++)o.insertBefore(n[t],e)}}function o(e,t){var r,n,i,o,a=e.attributes,s=a&&a.length;for(r=0;s>r;r++)if(n=a[r],i=n.name,n.specified&&n.value){if(t&&i in t)continue;o=o||{},o[i]=n.value}return o}e.textOfNode=n,e.unwrapNode=i,e.attributesForNode=o}),e("content-kit-utils/object-utils",["exports"],function(e){"use strict";function t(e,t,r){r=r||{};for(var n in t)r.hasOwnProperty(n)?e[n]=r[n]:t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function r(e,r){return t(e,r)}function n(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=new t,e.constructor=e,e._super=t}e.mergeWithOptions=t,e.merge=r,e.inherit=n}),e("content-kit-utils/string-utils",["exports"],function(e){"use strict";function t(e){return e?(e+"").replace(a,""):""}function r(e){return e?(e+"").replace(s,""):""}function n(e){return e?t(e+"").replace(c,"_"):""}function i(e){return e?(e+"").replace(l,"").replace(u," "):""}function o(e,t,r){return e.substr(0,r)+t+e.substr(r)}var a=/^\s+|\s+$/g,s=/^\s+/,l=/(\r\n|\n|\r|\t)/gm,u=/\s+/g,c=/[^a-zA-Z\d]/g;e.trim=t,e.trimLeft=r,e.underscore=n,e.sanitizeWhitespace=i,e.injectIntoString=o}),e("mobiledoc-html-renderer/cards/image",["exports","mobiledoc-html-renderer/utils/render-type"],function(e,t){"use strict";e["default"]={name:"image-card",type:t["default"],render:function(e){var t=(e.env,e.options,e.payload);return t.src?'':void 0}}}),e("mobiledoc-html-renderer",["exports","mobiledoc-html-renderer/renderer-factory","mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e){e.MobiledocHTMLRenderer=t["default"]}e.registerGlobal=n,e.RENDER_TYPE=r["default"],e["default"]=t["default"]}),e("mobiledoc-html-renderer/renderer-factory",["exports","mobiledoc-html-renderer/renderer","mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(!Array.isArray(e))throw new Error("`cards` must be passed as an array, not an object.");for(var t=0;ta;a+=2){var u=i[a],c=i[a+1];(0,t.setAttribute)(o,u,c)}return o}function a(e){if("0.2.0"!==e)throw new Error('Unexpected Mobiledoc version "'+e+'"')}var s=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(l){i=!0,o=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var r=0;ra;a++){for(var u=r[a],c=s(u,3),d=c[0],f=c[1],h=c[2],p=0,m=d.length;m>p;p++){var v=this.markerTypes[d[p]],g=o(v);(0,t.appendChild)(i,g),n.push(g),i=g}(0,t.appendChild)(i,(0,t.createTextNode)(h));for(var p=0,m=f;m>p;p++)n.pop(),i=n[n.length-1]}}},{key:"_defaultUnknownCardHandler",get:function(){return function(e){var t=e.env.name;throw new Error('Card "'+t+'" not found but no unknownCardHandler was registered')}}}]),e}();e["default"]=h}),e("mobiledoc-html-renderer/utils/dom",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){return e.replace(/ /g,"  ")}function n(e){return new c(e)}function i(e,t){e.appendChild(t)}function o(e){return new d(e)}function a(e,t,r){e.setAttribute(t,r)}function s(){return n("div")}var l=function(){function e(e,t){for(var r=0;r"}return e}}]),e}(),d=function(){function e(r){t(this,e),this.value=r}return l(e,[{key:"toString",value:function(){return r(this.value)}}]),e}()}),e("mobiledoc-html-renderer/utils/render-type",["exports"],function(e){"use strict";e["default"]="html"}),e("mobiledoc-kit/cards/image",["exports","mobiledoc-kit/utils/placeholder-image-src"],function(e,t){"use strict";e["default"]={name:"image",type:"dom",render:function(e){var r=(e.env,e.options,e.payload),n=document.createElement("img");return n.src=r.src||t["default"],n}}}),e("mobiledoc-kit/editor/editor",["exports","mobiledoc-kit/views/tooltip","mobiledoc-kit/editor/post","mobiledoc-kit/cards/image","mobiledoc-kit/utils/key","mobiledoc-kit/utils/event-emitter","mobiledoc-kit/parsers/mobiledoc","mobiledoc-kit/parsers/html","mobiledoc-kit/parsers/dom","mobiledoc-kit/renderers/editor-dom","mobiledoc-kit/models/render-tree","mobiledoc-kit/renderers/mobiledoc","content-kit-utils","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/array-utils","mobiledoc-kit/utils/element-utils","mobiledoc-kit/utils/mixin","mobiledoc-kit/utils/event-listener","mobiledoc-kit/utils/cursor","mobiledoc-kit/utils/cursor/range","mobiledoc-kit/models/post-node-builder","mobiledoc-kit/editor/text-expansions","mobiledoc-kit/editor/key-commands","mobiledoc-kit/utils/string-utils","mobiledoc-kit/utils/lifecycle-callbacks","mobiledoc-kit/models/card","mobiledoc-kit/utils/paste-utils","mobiledoc-kit/utils/characters"],function(e,t,r,n,i,o,a,s,l,u,c,d,f,h,p,m,v,g,b,y,w,_,k,x,C,E,S,T){"use strict";function N(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var A=function(){function e(e,t){for(var r=0;ri;i++)n[i]=arguments[i];return e.handleEvent.apply(e,[t].concat(n))})}),L.forEach(function(t){e.addEventListener(document,t,function(){for(var r=arguments.length,n=Array(r),i=0;r>i;i++)n[i]=arguments[i];return e.handleEvent.apply(e,[t].concat(n))})})}},{key:"handleEvent",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];if((0,p.contains)(M,e)){var i=r[0].target;if(!this.cursor.isAddressable(i))return!0}var o="handle"+(0,x.capitalize)(e);if(!this[o])throw new Error("No handler for "+e);this[o].apply(this,r)}},{key:"handleMouseup",value:function(){var e=this;setTimeout(function(){return e._reportSelectionState()},0)}},{key:"handleKeyup",value:function(){this._reportSelectionState()}},{key:"_reportSelectionState",value:function(){this.runCallbacks(R.CURSOR_DID_CHANGE)}},{key:"_insertEmptyMarkupSectionAtCursor",value:function(){var e=this;this.run(function(t){var r=t.builder.createMarkupSection("p");t.insertSectionBefore(e.post.sections,r),t.setRange(y["default"].fromSection(r))})}},{key:"handleKeydown",value:function(e){if(this.isEditable&&!this.handleKeyCommand(e)){this.post.isBlank&&this._insertEmptyMarkupSectionAtCursor();var t=i["default"].fromEvent(e),r=void 0,n=void 0;switch(!0){case t.isHorizontalArrow():r=this.cursor.offsets;var o=r.tail;if(r.direction===i.DIRECTION.BACKWARD&&(o=r.head),o.section.isCardSection&&(n=o.move(t.direction))){var a=void 0;a=t.isShift()?r.moveFocusedPosition(t.direction):new y["default"](n),this.selectRange(a),e.preventDefault()}break;case t.isDelete():this.handleDeletion(e),e.preventDefault();break;case t.isEnter():this.handleNewline(e);break;case t.isPrintable():var r=this.cursor.offsets,s=r,l=s.isCollapsed,n=r.head;this.run(function(e){l||(n=e.deleteRange(r)),t.isTab()&&!r.head.section.isCardSection&&(n=e.insertText(n,T.TAB)),n&&n!==r.head&&e.setRange(new y["default"](n))}),(l&&r.head.section.isCardSection||t.isTab())&&e.preventDefault()}this._lastKeydownEvent=e,this.addCallbackOnce(R.DID_REPARSE,this._handleLastKeydownExpansion)}}},{key:"handleKeyCommand",value:function(e){for(var t=(0,k.findKeyCommands)(this.keyCommands,e),r=0;r=r){var l=r-o,u=this.splitMarker(a,l),c=u.afterMarker;o+=l,s=o,a=c;break}o+=a.length,a=a.next,a&&(s+=a.length)}for(;a;){if(s+=a.length,s>=n){var l=a.length-(s-n),d=this.splitMarker(a,l),f=d.beforeMarker;f&&this.removeMarker(f);break}o+=a.length;var h=a.next;this.removeMarker(a),a=h}return new t["default"](e,r)}},{key:"_coalesceMarkers",value:function(e){e.isMarkerable&&(this._removeEmptyMarkers(e),this._joinSimilarMarkers(e))}},{key:"_removeEmptyMarkers",value:function(e){var t=this;(0,r.forEach)((0,r.filter)(e.markers,function(e){return e.isEmpty}),function(e){return t.removeMarker(e)})}},{key:"_joinSimilarMarkers",value:function(e){for(var t=e.markers.head,n=void 0;t&&t.next;)n=t.next,(0,r.isArrayEqual)(t.markups,n.markups)&&(n.value=t.value+n.value,this._markDirty(n),this.removeMarker(t)),t=n}},{key:"removeMarker",value:function(e){this._scheduleForRemoval(e),e.section&&(this._markDirty(e.section),e.section.markers.remove(e))}},{key:"_scheduleForRemoval",value:function(e){var t=this;e.renderNode&&(e.renderNode.scheduleForRemoval(),this.scheduleRerender(),this.scheduleDidUpdate());var r=e.prev&&e.prev.isListSection||e.next&&e.next.isListSection;r&&this.addCallback(h.BEFORE_COMPLETE,function(){return t._joinContiguousListSections()})}},{key:"_joinContiguousListSections",value:function(){var e=this,t=this.editor,n=t.post,i=t.range,o=void 0,a=[],s=void 0,u=null;(0,r.forEach)(n.sections,function(e){o&&o.isListSection&&e.isListSection&&o.tagName===e.tagName?(s=s||[o],s.push(e)):(s&&a.push(s),s=null),o=e}),s&&a.push(s),(0,r.forEach)(a,function(t){var n=t[0];(0,r.forEach)(t,function(t){if(t!==n){var r=i.head,o=void 0;r.section.isListItem&&r.section.parent===t&&(o=n.tailPosition()),e._joinListSections(n,t),o&&(u=o.moveRight())}})}),u&&this.setRange(new l["default"](u,u,i.direction))}},{key:"_joinListSections",value:function(e,t){e.join(t),this._markDirty(e),this.removeSection(t)}},{key:"_markDirty",value:function(e){var t=this;e.renderNode&&(e.renderNode.markDirty(),this.scheduleRerender(),this.scheduleDidUpdate()),e.section&&this._markDirty(e.section),e.isMarkerable&&this.addCallback(h.BEFORE_COMPLETE,function(){return t._coalesceMarkers(e)})}},{key:"deleteFrom",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?n.DIRECTION.BACKWARD:arguments[1];return t===n.DIRECTION.BACKWARD?this._deleteBackwardFrom(e):this._deleteForwardFrom(e)}},{key:"_joinPositionToPreviousSection",value:function(e){var t=e.section,r=e.clone();if((0,a["default"])("Cannot join non-markerable section to previous section",t.isMarkerable),t.isListItem){ -var n=this._changeSectionFromListItem(t,"p");r=n.headPosition()}else{var i=t.previousLeafSection();if(i)if(i.isCardSection)t.isBlank&&this.removeSection(t),r=i.tailPosition();else{var o=i.join(t),s=o.beforeMarker;this._markDirty(i),this.removeSection(t),r.section=i,r.offset=s?i.offsetOfMarker(s,s.length):0}}return r}},{key:"_deleteForwardFrom",value:function(e){var t=e.section,r=e.offset;if(t.isBlank){var n=e.clone(),i=t.immediatelyNextMarkerableSection();return i&&(this.removeSection(t),n.section=i,n.offset=0),n}if(r===t.length)return t.isCardSection?(t.next&&t.next.isBlank&&this.removeSection(t.next),e):this._joinPositionToNextSection(e);if(!t.isCardSection)return this._deleteForwardFromMarkerPosition(e.markerPosition);if(0===r){var o=this.builder.createMarkupSection();return this.replaceSection(t,o),o.headPosition()}}},{key:"_joinPositionToNextSection",value:function(e){var t=e.section,r=e.clone();if(!t.isMarkerable)throw new Error("Cannot join non-markerable section to next section");var n=t.immediatelyNextMarkerableSection();return n&&(t.join(n),this._markDirty(t),this.removeSection(n)),r}},{key:"_deleteForwardFromMarkerPosition",value:function(e){var r=e.marker,n=e.offset,i=r.section,o=new t["default"](i,i.offsetOfMarker(r,n));if(n===r.length){var a=r.next;if(a){var s={marker:a,offset:0};return this._deleteForwardFromMarkerPosition(s)}var l=r.section.next;if(l&&l.isMarkupSection){var u=r.section;u.join(l),this._markDirty(u),this.removeSection(l)}}else r.deleteValueAtOffset(n),this._markDirty(r);return o}},{key:"_deleteBackwardFrom",value:function(e){var t=e.section,r=e.offset;if(0===r)return t.isCardSection?(t.prev&&t.prev.isBlank&&this.removeSection(t.prev),e):this._joinPositionToPreviousSection(e);var n=e.clone();if(t.isCardSection){var i=this.builder.createMarkupSection();return this.replaceSection(t,i),i.headPosition()}var o=e.markerPosition,a=o.marker,s=o.offset,l=s-1;return a.deleteValueAtOffset(l),n.offset-=1,this._markDirty(a),n}},{key:"splitMarkers",value:function(e){var t=this.editor.post,r=e.head,n=e.tail;return this.splitSectionMarkerAtOffset(r.section,r.offset),this.splitSectionMarkerAtOffset(n.section,n.offset),t.markersContainedByRange(e)}},{key:"splitSectionMarkerAtOffset",value:function(e,t){var r=this,n=e.splitMarkerAtOffset(t);n.removed.forEach(function(e){return r.removeMarker(e)})}},{key:"splitMarker",value:function(e,t){var r=void 0,n=void 0;if(0===t)r=e.prev,n=e;else if(t===e.length)r=e,n=e.next;else{var i=this.editor.builder,o=e.section;r=i.createMarker(e.value.substring(0,t),e.markups),n=i.createMarker(e.value.substring(t,e.length),e.markups),o.markers.splice(e,1,[r,n]),this.removeMarker(e),this._markDirty(o)}return{beforeMarker:r,afterMarker:n}}},{key:"splitSection",value:function(e){var t=this,r=e.section;if(r.isCardSection)return this._splitCardSection(r,e);if(r.isListItem){var n=r.splitAtPosition(e),i=d(n,2),o=i[0],a=i[1];this._coalesceMarkers(o),this._coalesceMarkers(a);var s=[o,a],l=[o,a];if(o.isBlank&&r.isBlank){var u=r===r.parent.items.tail;u&&l.shift()}return this._replaceSection(r,l),s}var c=r.splitAtPosition(e);return c.forEach(function(e){return t._coalesceMarkers(e)}),this._replaceSection(r,c),c}},{key:"_splitCardSection",value:function(e,t){var r=t.offset;(0,a["default"])("Cards section must be split at offset 0 or 1",0===r||1===r);var n=this.builder.createMarkupSection(),i=void 0,o=void 0;0===r?(i=e,o=[n,e]):(i=e.next,o=[e,n]);var s=this.editor.post.sections;return this.insertSectionBefore(s,n,i),o}},{key:"replaceSection",value:function(e,t){e?this._replaceSection(e,[t]):this.insertSectionBefore(this.editor.post.sections,t,null)}},{key:"moveSectionBefore",value:function(e,t,r){var n=t.clone();return this.removeSection(t),this.insertSectionBefore(e,n,r),n}},{key:"moveSectionUp",value:function(e){var t=!e.prev;if(t)return e;var r=e.parent.sections,n=e.prev;return this.moveSectionBefore(r,e,n)}},{key:"moveSectionDown",value:function(e){var t=!e.next;if(t)return e;var r=e.next.next,n=e.parent.sections;return this.moveSectionBefore(n,e,r)}},{key:"insertText",value:function(e,r){var n=e.section;if(n.isMarkerable){var i=e.markerPosition,o=i.marker,a=i.offset,s=e;if(o){if(o){var l=o.value.slice(0,a),u=o.value.slice(a,o.length);o.value=""+l+r+u,this._markDirty(o),s=e.moveRight()}}else o=this.builder.createMarker(r),n.markers.append(o),this._markDirty(n),s=new t["default"](n,1);return s}}},{key:"_replaceSection",value:function(e,t){var r=this,n=e.next,i=e.parent.sections,o=t[0];o.isMarkupSection&&e.isListItem&&(i=e.parent.parent.sections,n=e.parent.next),t.forEach(function(e){return r.insertSectionBefore(i,e,n)}),this.removeSection(e)}},{key:"addMarkupToRange",value:function(e,t){var r=this;e.isCollapsed||this.splitMarkers(e).forEach(function(e){e.addMarkup(t),r._markDirty(e)})}},{key:"removeMarkupFromRange",value:function(e,t){var r=this;e.isCollapsed||this.splitMarkers(e).forEach(function(e){e.removeMarkup(t),r._markDirty(e)})}},{key:"toggleMarkup",value:function(e){var t=this,r=this.editor.cursor.offsets;if(!r.isCollapsed){var n="string"==typeof e?this.builder.createMarkup(e):e,i=this.editor.detectMarkupInRange(r,n.tagName);i?this.removeMarkupFromRange(r,i):this.addMarkupToRange(r,n),this.scheduleAfterRender(function(){return t.editor.selectRange(r)})}}},{key:"toggleSection",value:function(e){var t=this,r=arguments.length<=1||void 0===arguments[1]?this.editor.range:arguments[1];e=(0,s.normalizeTagName)(e);var n=this.editor.post,i=!0;n.walkMarkerableSections(r,function(r){t._isSameSectionType(r,e)||(i=!1)});var o=i?"p":e,a=void 0;n.walkMarkerableSections(r,function(e){var r=t.changeSectionTagName(e,o);a=a||r}),a&&this.setRange(new l["default"](a.headPosition()))}},{key:"_isSameSectionType",value:function(e,t){return e.isListItem?e.parent.tagName===t:e.tagName===t}},{key:"changeSectionTagName",value:function(e,t){return c(t)?this._changeSectionToListItem(e,t):e.isListItem?this._changeSectionFromListItem(e,t):(e.tagName=t,this._markDirty(e),e)}},{key:"_splitListAtItem",value:function(e,t){var r=this,n=e,i=this.builder.createListSection(n.tagName),o=this.builder.createListSection(n.tagName),s=!0,l=n.items.toArray();l.forEach(function(e){var n=void 0;if(e===t)s=!1,n=o;else{if(!s)return;n=i}n.join(e),r.removeSection(e)});var u=!s;(0,a["default"])("Cannot split list at item that is not present in the list",u);var c=this.editor.post.sections;return this.insertSectionBefore(c,o,n),this.insertSectionBefore(c,i,o),this.addCallback(h.BEFORE_COMPLETE,function(){[i,n].forEach(function(e){var t=!!e.parent;e.isBlank&&t&&r.removeSection(e)})}),[i,o,n]}},{key:"_changeSectionFromListItem",value:function(e,t){(0,a["default"])("Must pass list item to `_changeSectionFromListItem`",e.isListItem);var r=this.builder,n=e.parent,i=r.createMarkupSection(t);i.join(e);var o=this._splitListAtItem(n,e),s=d(o,3),l=(s[0],s[1]);s[2];return this.replaceSection(l,i),i}},{key:"_changeSectionToListItem",value:function(e,t){var r=e.isListItem&&e.parent.tagName===t;if(r)return e;var n=this.builder.createListSection(t);n.join(e);var i=void 0;if(e.isListItem){var o=this._splitListAtItem(e.parent,e),a=d(o,3),s=(a[0],a[1]);a[2];i=s}else i=e;return this.replaceSection(i,n),n}},{key:"insertSectionBefore",value:function(e,t,r){e.insertBefore(t,r),this._markDirty(t.parent)}},{key:"insertSection",value:function(e){var t=this.editor.activeSection,r=t&&t.next,n=this.editor.post.sections;this.insertSectionBefore(n,e,r)}},{key:"insertSectionAtEnd",value:function(e){this.insertSectionBefore(this.editor.post.sections,e,null)}},{key:"insertPost",value:function(e,t){var r=this;if(t.isBlank)return e;var n=this.editor.post,i=this.splitSection(e),o=d(i,2),a=o[0],s=o[1],l=e.clone();return t.sections.forEach(function(e,t){0===t&&a.canJoin(e)?(a.join(e),r._markDirty(a),l=a.tailPosition()):(e=e.clone(),r.insertSectionBefore(n.sections,e,s),l=e.tailPosition())}),s.isBlank&&this.removeSection(s),a.canJoin(s)&&a.next===s?(l=a.tailPosition(),a.join(s),this._markDirty(a),this.removeSection(s)):a.isBlank&&this.removeSection(a),l}},{key:"removeSection",value:function(e){var t=e.parent;this._scheduleForRemoval(e),t.sections.remove(e),t.isListSection&&this._scheduleListRemovalIfEmpty(t)}},{key:"_scheduleListRemovalIfEmpty",value:function(e){var t=this;this.addCallback(h.BEFORE_COMPLETE,function(){var r=!!e.parent;r&&e.isBlank&&t.removeSection(e)})}},{key:"schedule",value:function(e){(0,a["default"])("Work can only be scheduled before a post edit has completed",!this._didComplete),this.addCallback(h.COMPLETE,e)}},{key:"scheduleRerender",value:function(){var e=this;this._didScheduleRerender||(this.schedule(function(){return e.editor.rerender()}),this._didScheduleRerender=!0)}},{key:"scheduleDidUpdate",value:function(){var e=this;this._didScheduleUpdate||(this.schedule(function(){return e.editor.didUpdate()}),this._didScheduleUpdate=!0)}},{key:"scheduleAfterRender",value:function(e){this.addCallback(h.AFTER_COMPLETE,e)}},{key:"complete",value:function(){if(this._didComplete)throw new Error("Post editing can only be completed once");this.runCallbacks(h.BEFORE_COMPLETE),this._didComplete=!0,this.runCallbacks(h.COMPLETE),this.runCallbacks(h.AFTER_COMPLETE),this.editor.range=null}}]),e}();(0,o["default"])(p,i["default"]),e["default"]=p}),e("mobiledoc-kit/editor/text-expansions",["exports","mobiledoc-kit/utils/keycodes","mobiledoc-kit/utils/key","mobiledoc-kit/utils/array-utils","mobiledoc-kit/models/types","mobiledoc-kit/utils/cursor/range"],function(e,t,r,n,i,o){"use strict";function a(e,t){var r=e.cursor.offsets.head.section;e.run(function(e){var n=e.builder,i=n.createListItem(),a=n.createListSection(t,[i]);e.replaceSection(r,a),e.setRange(o["default"].fromSection(i))})}function s(e,t){var r=e.cursor.offsets.head.section;e.run(function(e){var n=e.builder,i=n.createMarkupSection(t);e.replaceSection(r,i),e.setRange(o["default"].fromSection(i))})}function l(e){return!!e.trigger&&!!e.text&&!!e.run}function u(e,t,o){var a=r["default"].fromEvent(t);if(a.isPrintable()){var s=o.cursor.offsets.head,l=s.section,u=s.offset;if(l.type===i.MARKUP_SECTION_TYPE){var c=l.textUntil(u);return(0,n.detect)(e,function(e){var t=e.trigger,r=e.text;return a.keyCode===t&&c===r+String.fromCharCode(t)})}}}e.validateExpansion=l,e.findExpansion=u;var c=t["default"].SPACE,d=[{trigger:c,text:"*",run:function(e){a(e,"ul")}},{trigger:c,text:"1",run:function(e){a(e,"ol")}},{trigger:c,text:"1.",run:function(e){a(e,"ol")}},{trigger:c,text:"##",run:function(e){s(e,"h2")}},{trigger:c,text:"###",run:function(e){s(e,"h3")}}];e.DEFAULT_TEXT_EXPANSIONS=d}),e("mobiledoc-kit",["exports","mobiledoc-kit/editor/editor","mobiledoc-kit/cards/image"],function(e,t,r){"use strict";function n(e){e.Mobiledoc=i}e.registerGlobal=n;var i={Editor:t["default"],ImageCard:r["default"]};e.Editor=t["default"],e["default"]=i}),e("mobiledoc-kit/models/_markerable",["exports","mobiledoc-kit/utils/array-utils","mobiledoc-kit/utils/set","mobiledoc-kit/utils/linked-list","mobiledoc-kit/models/_section","mobiledoc-kit/utils/cursor/position"],function(e,t,r,n,i,o){"use strict";function a(e){return Array.isArray(e)?e:Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var r=0;ri&&o>a){var u=Math.max(i-a,0),c=l.length-Math.max(s-o,0),d=0===u&&c===l.length;t(l,{markerHead:u,markerTail:c,isContained:d})}if(a+=l.length,l=l.next,a>o)break}}},{key:"join",value:function(e){var t=this,r=this.markers.tail,n=null;return e.markers.forEach(function(e){e.isEmpty||(e=e.clone(),t.markers.append(e),n||(n=e))}),{beforeMarker:r,afterMarker:n}}},{key:"isBlank",get:function(){return this.markers.length?this.markers.every(function(e){return e.isBlank}):!0}},{key:"text",get:function(){return(0,t.reduce)(this.markers,function(e,t){return e+t.value},"")}},{key:"length",get:function(){return this.text.length}}]),i}(i["default"]);e["default"]=d}),e("mobiledoc-kit/models/_section",["exports","mobiledoc-kit/models/types","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/linked-item","mobiledoc-kit/utils/assert"],function(e,t,r,n,i){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.type===t.LIST_ITEM_TYPE}function l(e,t){throw new Error("`"+e+"()` must be implemented by "+t.constructor.name)}var u=function(){function e(e,t){for(var r=0;re||e>this.length)throw new Error('Invalid offset "'+e+'"');var t=this.value.slice(0,e),r=this.value.slice(e+1);this.value=t+r}},{key:"hasMarkup",value:function(e){return!!this.getMarkup(e)}},{key:"getMarkup",value:function(e){var t=this;if("string"==typeof e){var i=function(){var i=(0,r.normalizeTagName)(e);return{v:(0,n.detect)(t.markups,function(e){return e.tagName===i})}}();if("object"==typeof i)return i.v}else{var o=function(){var r=e;return{v:(0,n.detect)(t.markups,function(e){return e===r})}}();if("object"==typeof o)return o.v}}},{key:"join",value:function(e){var t=this.builder.createMarker(this.value+e.value);return this.markups.forEach(function(e){return t.addMarkup(e)}),e.markups.forEach(function(e){return t.addMarkup(e)}),t}},{key:"split",value:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=arguments.length<=1||void 0===arguments[1]?this.length:arguments[1],r=[];return r=[this.builder.createMarker(this.value.substring(0,e)),this.builder.createMarker(this.value.substring(e,t)),this.builder.createMarker(this.value.substring(t))],this.markups.forEach(function(e){return r.forEach(function(t){return t.addMarkup(e)})}),r}},{key:"isEmpty",get:function(){return 0===this.length}},{key:"isBlank",get:function(){return 0===this.value.length}},{key:"length", -get:function(){return this.value.length}},{key:"openedMarkups",get:function(){var e=0;return this.prev&&(e=(0,n.commonItemLength)(this.markups,this.prev.markups)),this.markups.slice(e)}},{key:"closedMarkups",get:function(){var e=0;return this.next&&(e=(0,n.commonItemLength)(this.markups,this.next.markups)),this.markups.slice(e)}}]),i}(i["default"]);e["default"]=u}),e("mobiledoc-kit/models/markup-section",["exports","mobiledoc-kit/models/_markerable","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/array-utils","mobiledoc-kit/models/types"],function(e,t,r,n,i){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var r=0;r=0;l--){a=s[l];var u=d(document,a);u.appendChild(o),o=u}if(r){var c=r.element,p=h(c,t);t.insertBefore(o,p.nextSibling)}else t.insertBefore(o,t.firstChild);return i}function _(e,t){var r=e.element,n=!!t;if(n){var i=e.parent.element;i.replaceChild(r,t)}else{var i=void 0,o=void 0;if(e.prev){var a=e.prev.element;i=a.parentNode,o=a.nextSibling}else i=e.parent.element,o=i.firstChild;i.insertBefore(r,o)}}function k(e,t){var r=e.parent.postNode;r.sections.remove(t)}function x(e){e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element)}function C(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];return(0,r.forEach)(e,function(e){(0,s["default"])('Card "'+e.name+'" must define type "dom", has: "'+e.type+'"',"dom"===e.type),(0,s["default"])('Card "'+e.name+'" must define `render` method',!!e.render)}),e}function E(e){for(var t=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],r=e.childNodes.head,n=void 0,i=void 0;r;){if(n=r.next,r.isRemoved||t){if(E(r,!0),i=r.postNode.type,!R[i])throw new Error('editor-dom cannot destroy "'+i+'"');R[i](r,r.postNode),e.childNodes.remove(r)}r=n}}function S(e,t,r,n){if(r.renderNode)return r.renderNode;var i=e.buildRenderNode(r);return t.childNodes.insertAfter(i,n),i}var T,N=function(){function e(e,t){for(var r=0;ri;i++)n[i]=arguments[i];return t.visit.apply(t,[e].concat(n))}),r.markClean(),r=this.nodes.shift()}}}]),e}();e["default"]=D}),e("mobiledoc-kit/renderers/mobiledoc/0-2",["exports","mobiledoc-kit/utils/compiler","mobiledoc-kit/utils/array-utils","mobiledoc-kit/models/types"],function(e,t,r,n){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o,a="0.2.0";e.MOBILEDOC_VERSION=a;var s=1;e.MOBILEDOC_MARKUP_SECTION_TYPE=s;var l=2;e.MOBILEDOC_IMAGE_SECTION_TYPE=l;var u=3;e.MOBILEDOC_LIST_SECTION_TYPE=u;var c=10;e.MOBILEDOC_CARD_SECTION_TYPE=c;var d=(o={},i(o,n.POST_TYPE,function(e,r){r.push(["openPost"]),(0,t.visitArray)(d,e.sections,r)}),i(o,n.MARKUP_SECTION_TYPE,function(e,r){r.push(["openMarkupSection",e.tagName]),(0,t.visitArray)(d,e.markers,r)}),i(o,n.LIST_SECTION_TYPE,function(e,r){r.push(["openListSection",e.tagName]),(0,t.visitArray)(d,e.items,r)}),i(o,n.LIST_ITEM_TYPE,function(e,r){r.push(["openListItem"]),(0,t.visitArray)(d,e.markers,r)}),i(o,n.IMAGE_SECTION_TYPE,function(e,t){t.push(["openImageSection",e.src])}),i(o,n.CARD_TYPE,function(e,t){t.push(["openCardSection",e.name,e.payload])}),i(o,n.MARKER_TYPE,function(e,r){r.push(["openMarker",e.closedMarkups.length,e.value]),(0,t.visitArray)(d,e.openedMarkups,r)}),i(o,n.MARKUP_TYPE,function(e,t){t.push(["openMarkup",e.tagName,(0,r.objectToSortedKVArray)(e.attributes)])}),o),f={openMarker:function(e,t){this.markupMarkerIds=[],this.markers.push([this.markupMarkerIds,e,t||""])},openMarkupSection:function(e){this.markers=[],this.sections.push([s,e,this.markers])},openListSection:function(e){this.items=[],this.sections.push([u,e,this.items])},openListItem:function(){this.markers=[],this.items.push(this.markers)},openImageSection:function(e){this.sections.push([l,e])},openCardSection:function(e,t){this.sections.push([c,e,t])},openPost:function(){this.markerTypes=[],this.sections=[],this.result={version:a,sections:[this.markerTypes,this.sections]}},openMarkup:function(e,t){var r=this._findOrAddMarkerTypeIndex(e,t);this.markupMarkerIds.push(r)},_findOrAddMarkerTypeIndex:function(e,t){this._markerTypeCache||(this._markerTypeCache={});var r=e+"-"+t.join("-"),n=this._markerTypeCache[r];if(void 0===n){var i=[e];t.length&&i.push(t),this.markerTypes.push(i),n=this.markerTypes.length-1,this._markerTypeCache[r]=n}return n}};e["default"]={render:function(e){var r=[];(0,t.visit)(d,e,r);var n=Object.create(f);return(0,t.compile)(n,r),n.result}}}),e("mobiledoc-kit/renderers/mobiledoc",["exports","mobiledoc-kit/renderers/mobiledoc/0-2"],function(e,t){"use strict";e.MOBILEDOC_VERSION=t.MOBILEDOC_VERSION,e["default"]={render:function(e,r){switch(r){case t.MOBILEDOC_VERSION:case void 0:case null:return t["default"].render(e);default:throw new Error("Unknown version of mobiledoc renderer requested: "+r)}}}}),e("mobiledoc-kit/utils/array-utils",["exports"],function(e){"use strict";function t(e,t){if(e.detect)return e.detect(t);for(var r=0;ri;i++)if(e[i]!==t[i])return!1;return!0}function h(e){var t=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],r={};return o(a(Object.keys(e),function(e){return-1!==t.indexOf(e)}),function(t){return r[t]=e[t]}),r}function p(e,t){return-1!==e.indexOf(t)}e.detect=t,e.forEach=o,e.any=r,e.every=n,e.filter=a,e.commonItemLength=s,e.compact=l,e.reduce=u,e.objectToSortedKVArray=d,e.kvArrayToObject=c,e.isArrayEqual=f,e.toArray=i,e.filterObject=h,e.contains=p}),e("mobiledoc-kit/utils/assert",["exports"],function(e){"use strict";e["default"]=function(e,t){if(!t)throw new Error(e)}}),e("mobiledoc-kit/utils/characters",["exports"],function(e){"use strict";var t=" ";e.TAB=t}),e("mobiledoc-kit/utils/compiler",["exports"],function(e){"use strict";function t(e){return Array.isArray(e)?e:Array.from(e)}function r(e,t,r){var n=t.type;if(!e[n])throw new Error("Cannot visit unknown type "+n);e[n](t,r)}function n(e,r){for(var n=0,i=r.length;i>n;n++){var o=t(r[n]),a=o[0],s=o.slice(1);s.length?e[a].apply(e,s):e[a].call(e)}}function i(e,t,n){t&&0!==t.length&&t.forEach(function(t){r(e,t,n)})}e.visit=r,e.compile=n,e.visitArray=i}),e("mobiledoc-kit/utils/copy",["exports"],function(e){"use strict";function t(e){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t}e.shallowCopyObject=t}),e("mobiledoc-kit/utils/cursor/position",["exports","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/key","mobiledoc-kit/utils/assert"],function(e,t,r,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return e&&e.type?e.isMarkerable||e.isCardSection:!1}function a(e,t){var r=e.findRenderNodeFromElement(t,function(e){return o(e.postNode)});return r&&r.postNode}function s(e,r,n){if(!e.isCardSection)return(0,t.findOffsetInElement)(e.renderNode.element,r,n);var i=e.renderNode.element,o=i.lastChild;return r===o?1:0}var l=function(){function e(e,t){for(var r=0;r0?new e(this.section,this.offset-1):this.section.prev?new e(this.section.prev,this.section.prev.length):null}},{key:"moveRight",value:function(){return this.offseti?0:1:0;return new e(o,s)}}]),e}();e["default"]=u}),e("mobiledoc-kit/utils/cursor/range",["exports","mobiledoc-kit/utils/cursor/position","mobiledoc-kit/utils/key"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;rr;r++)n[e][r].apply(this,Array.prototype.slice.call(arguments,1))}};e["default"]=t}),e("mobiledoc-kit/utils/event-listener",["exports","mobiledoc-kit/utils/array-utils"],function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t=t["default"][0]&&e<=t["default"][9]||this.isSpace()||this.isTab()||this.isEnter()||e>=t["default"].A&&e<=t["default"].Z||e>=t["default"].NUMPAD_0&&e<=t["default"].NUMPAD_9||e>=t["default"][";"]&&e<=t["default"]["`"]||e>=t["default"]["["]&&e<=t["default"]['"']||e===t["default"].IME}},{key:"direction",get:function(){switch(!0){case this.isDelete():return this.isForwardDelete()?s.FORWARD:s.BACKWARD;case this.isHorizontalArrow():return this.isRightArrow()?s.FORWARD:s.BACKWARD}}},{key:"ctrlKey",get:function(){return l.CTRL&this.modifierMask}},{key:"metaKey",get:function(){return l.META&this.modifierMask}},{key:"shiftKey",get:function(){return l.SHIFT&this.modifierMask}},{key:"altKey",get:function(){return l.ALT&this.modifierMask}}],[{key:"fromEvent",value:function(t){return(0,r["default"])("Must pass a Key event to Key.fromEvent",t&&o(t)),new e(t)}}]),e}();e["default"]=c}),e("mobiledoc-kit/utils/keycodes",["exports"],function(e){"use strict";e["default"]={BACKSPACE:8,SPACE:32,ENTER:13,ESC:27,DELETE:46,0:48,9:57,A:65,Z:90,NUMPAD_0:186,NUMPAD_9:111,";":186,"`":192,"[":219,'"':222,IME:229,TAB:9,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INS:45}}),e("mobiledoc-kit/utils/lifecycle-callbacks",["exports","mobiledoc-kit/utils/assert"],function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);ta;)a++,o=i.next,this.remove(i),i=o;r.forEach(function(e){n.insertBefore(e,o)})}},{key:"removeBy",value:function(e){for(var t=this.head;t;){var r=t.next;e(t)&&this.remove(t),t=r}}},{key:"_ensureItemIsNotInList",value:function(e){(0,t["default"])("Cannot insert an item into a list if it is already in a list",!e[i])}},{key:"_ensureItemIsInThisList",value:function(e){(0,t["default"])("Cannot remove item that is in another list",e[i]===this)}},{key:"isEmpty",get:function(){return 0===this.length}}]),e}();e["default"]=o}),e("mobiledoc-kit/utils/mixin",["exports"],function(e){"use strict";function t(e,t){e=e.prototype,t=t.prototype||t,Object.getOwnPropertyNames(t).forEach(function(n){if(n!==r){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i)}})}e["default"]=t;var r="constructor"}),e("mobiledoc-kit/utils/paste-utils",["exports","mobiledoc-kit/parsers/mobiledoc","mobiledoc-kit/parsers/html","mobiledoc-html-renderer","mobiledoc-text-renderer"],function(e,t,r,n,i){"use strict";function o(e,t){var r=t.cursor,o=t.post,a=e.clipboardData,s=r.offsets,l=o.cloneRange(s),u=function(){},c=new n["default"]({unknownCardHandler:u}).render(l),d=c.result,f="
"+d+"
",h=new i["default"]({unknownCardHandler:u}).render(l),p=h.result;a.setData("text/plain",p),a.setData("text/html",f)}function a(e,n){var i=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],o=void 0,a=void 0,s=new RegExp(/data\-mobiledoc='(.*?)'>/),l=e.clipboardData.getData("text/html");if(s.test(l)){var u=l.match(s)[1];o=JSON.parse(u),a=t["default"].parse(n,o)}else a=new r["default"](n,{plugins:i}).parse(l);return a}e.setClipboardCopyData=o,e.parsePostFromPaste=a}),e("mobiledoc-kit/utils/placeholder-image-src",["exports"],function(e){"use strict";var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAMFBMVEXp7vG6vsHm6+63u77Hy868wMPe4+bO09bh5unr8fTR1djAxMfM0NPX3N/c4eTBxcjXRf5TAAACh0lEQVR4nO3b6ZKqMBSFUSQMYZL3f9tbBq/NEEDiqUqOfusn1ZXKbjcQlGQZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACC6RkbsGHuabChEtHmiGYfS3EQYM+Sxw/gMQvmcNnYaj6oTDHi73WPn2eqnj9B8zo3TJXcq5uNjXmVff86VwSR3JtryMa1BYqi7S1hJDCVpSigyLcGhJJEwzlCSNtPKrbVhVwsdCfOhH7uuaG3ARV9DwsaOzxt3N1yPqCHhvXytTUz92VDpmE/LLhZwl++R6Sds6sUa/PL6K/2E2fIhw1xdRKefsFolrPc+xNx/N0k/4fpBsdhL2HfeiN+TsDCms8dDpeRyS3P3QDl6Iqaf8L0rTf+80m6Lmn7Ct+4Wxf+/2RY1/YRv3PHz/u+fsCmqgoTnq7Z+8SGviqoh4dnKu1ieqauiakh4/PQ0r6ivqDoSHj0B97eNRVG1JNxV+L4bnxdVecJtRTdFVZ7QU9F1UXUn9FZ0VVRlCav5ob2KLouqKmFjy676u2HsVnRRVFUJq3J+8KCi86IqSthMvyl209Hjijqm3RsqAZ5pNfa5PJ2KelJRjQmr1/r7cfy0ouoSNvOfvbvhvKLaEr4qOin9kTQnrN7LpDZhE/Zmhp6Eq4p+YcKgiipKGFhRRQkDK6ooYfgLbiSMioQkJGF8P5XwHv4O+7AaKiXzaeXh1kMl5AffTUxiKEm/krD94BR8Gdxl1fceSlR58ZhXKbEpyD2amNiBtmrJLTMHL1LF8/rpXkSZXEmz8K8uvAFFNm6Iq0aBLUFOmeCuJ6exrcCmoLpN7kYx891bSAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgh/wDdr8peyRHLogAAAAASUVORK5CYII=";e["default"]=t}),e("mobiledoc-kit/utils/selection-utils",["exports","mobiledoc-kit/utils/key"],function(e,t){"use strict";function r(){window.getSelection().removeAllRanges()}function n(e){for(var r=!0;r;){var n=e;r=!1;var i=n.anchorNode,o=n.focusNode,a=n.anchorOffset,s=n.focusOffset,l=void 0,u=void 0,c=void 0,d=void 0,f=void 0,h=i.compareDocumentPosition(o); -if(h&Node.DOCUMENT_POSITION_CONTAINS)e={focusNode:o.childNodes[s],focusOffset:0,anchorNode:i,anchorOffset:a},r=!0,i=o=a=s=l=u=c=d=f=h=void 0;else{if(!(h&Node.DOCUMENT_POSITION_CONTAINED_BY))return h&Node.DOCUMENT_POSITION_FOLLOWING?(l=i,u=o,c=a,d=s,f=t.DIRECTION.FORWARD):h&Node.DOCUMENT_POSITION_PRECEDING?(l=o,u=i,c=s,d=a,f=t.DIRECTION.BACKWARD):(l=u=i,c=a,d=s,c>d?(c=s,d=a,f=t.DIRECTION.BACKWARD):f=d>c?t.DIRECTION.FORWARD:null),{headNode:l,headOffset:c,tailNode:u,tailOffset:d,direction:f};var p=a-1;0>p&&(p=0),e={anchorNode:i.childNodes[p],anchorOffset:0,focusNode:o,focusOffset:s},r=!0,i=o=a=s=l=u=c=d=f=h=p=void 0}}}e.clearSelection=r,e.comparePosition=n}),e("mobiledoc-kit/utils/set",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var r=0;r'+e+"";this.showMessage(r,t)}}]),t}(t["default"]);e["default"]=l}),e("mobiledoc-kit/views/view",["exports","mobiledoc-kit/utils/mixin","mobiledoc-kit/utils/event-listener","mobiledoc-kit/utils/dom-utils"],function(e,t,r,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;ryo&&setTimeout(function(){l.display.input.reset(!0)},20),Bt(this),Yi(),yt(this),this.curOp.forceUpdate=!0,$n(this,i),n.autofocus&&!No||l.hasFocus()?setTimeout(ji(mr,this),20):vr(this);for(var c in Zo)Zo.hasOwnProperty(c)&&Zo[c](this,n[c],ea);k(this),n.finishInit&&n.finishInit(this);for(var d=0;dyo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),wo||mo&&No||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Fe(e,100),e.state.modeGen++,e.curOp&&Rt(e)}function i(e){e.options.lineWrapping?(Qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):($a(e.display.wrapper,"CodeMirror-wrap"),f(e)),a(e),Rt(e),at(e),setTimeout(function(){b(e)},100)}function o(e){var t=gt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/bt(e.display)-3);return function(i){if(_n(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function h(e){var t=Li(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 p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+We(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+qe(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function m(e,t,r){this.cm=r;var n=this.vert=Bi("div",[Bi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Bi("div",[Bi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Na(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Na(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,bo&&8>yo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function v(){}function g(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&$a(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Na(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?nr(t,e):rr(t,e)},t),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)}function b(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;y(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&M(e),y(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function y(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-ze(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ti(t,n),a=ti(t,i);if(r&&r.ensure){var s=r.ensure.from.line,l=r.ensure.to.line;o>s?(o=s,a=ti(t,ri(Qn(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ti(t,ri(Qn(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function _(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Vt(e))return!1;k(e)&&(It(e),t.dims=P(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroma&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Do&&(o=yn(e.doc,o),a=wn(e.doc,a));var s=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Ht(e,o,a),r.viewOffset=ri(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var l=Vt(e);if(!s&&0==l&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=Ui();return l>4&&(r.lineDiv.style.display="none"),R(e,r.updateLineNumbers,t.dims),l>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,u&&Ui()!=u&&u.offsetHeight&&u.focus(),zi(r.cursorDiv),zi(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fe(e,400)),r.updateLineNumbers=null,!0}function N(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ke(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+We(e.display)-Ge(e),r.top)}),t.visible=w(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&T(e,t);n=!1){M(e);var i=p(e);Pe(e),O(e,i),b(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new E(e,t);if(T(e,r)){M(e),N(e,r);var n=p(e);Pe(e),O(e,n),b(e,n),r.finish()}}function O(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var r=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=r+"px",e.display.gutters.style.height=Math.max(r+qe(e),t.clientHeight)+"px"}function M(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;nyo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(2>i&&(i=gt(t)),(l>.001||-.001>l)&&(Zn(o.line,i),L(o.line),o.rest))for(var u=0;u=t&&d.lineNumber;d.changes&&(Li(d.changes,"gutter")>-1&&(f=!1),D(e,d,u,r)),f&&(zi(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(x(e.options,u)))),s=d.node.nextSibling}else{var h=W(e,d,u,r);a.insertBefore(h,s)}u+=d.size}for(;s;)s=n(s)}function D(e,t,r,n){for(var i=0;iyo&&(e.node.style.zIndex=2)),e.node}function j(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=I(e);e.background=r.insertBefore(Bi("div",null,t),r.firstChild)}}function F(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):jn(e,t)}function H(e,t){var r=t.text.className,n=F(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,V(t)):r&&(t.text.className=r)}function V(e){j(e),e.line.wrapClass?I(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function B(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=I(t);t.gutterBackground=Bi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=I(t),a=t.gutter=Bi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Bi("div",x(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s1)if(Fo&&Fo.join("\n")==t){if(n.ranges.length%Fo.length==0){l=[];for(var u=0;u=0;u--){var c=n.ranges[u],d=c.from(),f=c.to();c.empty()&&(r&&r>0?d=Io(d.line,d.ch-r):e.state.overwrite&&!a&&(f=Io(f.line,Math.min(Qn(o,f.line).text.length,f.ch+Mi(s).length))));var h=e.curOp.updateInput,p={from:d,to:f,text:l?l[u%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Cr(e.doc,p),xi(e,"inputRead",e,p)}t&&!a&&ee(e,t),Ir(e),e.curOp.updateInput=h,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Z(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");return r?(e.preventDefault(),X(t)||t.options.disableInput||Nt(t,function(){J(t,r,0,null,"paste")}),!0):void 0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Fr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fr(e,i.head.line,"smart"));a&&xi(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],r=[],n=0;ni?u.map:c[i],a=0;ai?e.line:e.rest[i]),d=o[a]+n;return(0>n||s!=t)&&(d=o[a+(n?1:0)]),Io(l,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Ka(i,t))return se(Io(ei(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Mi(e.rest):e.line;return se(Io(ei(a),a.text.length),o)}var s=3==t.nodeType?t:null,l=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var u=e.measure,c=u.maps,d=n(s,l,r);if(d)return se(d,o);for(var f=l.nextSibling,h=s?s.nodeValue.length-r:0;f;f=f.nextSibling){if(d=n(f,f.firstChild,0))return se(Io(d.line,d.ch-h),o);h+=f.textContent.length}for(var p=l.previousSibling,h=r;p;p=p.previousSibling){if(d=n(p,p.firstChild,-1))return se(Io(d.line,d.ch+h),o);h+=f.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var c,d=t.getAttribute("cm-marker");if(d){var f=e.findMarks(Io(n,0),Io(i+1,0),o(+d));return void(f.length&&(c=f[0].find())&&(s+=Xn(e.doc,c.from,c.to).join(u)))}if("false"==t.getAttribute("contenteditable"))return;for(var h=0;h=0){var a=$(o.from(),i.from()),s=Y(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head; -t>=n&&--t,e.splice(--n,2,new fe(l?s:a,l?a:s))}}return new de(e,t)}function pe(e,t){return new de([new fe(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ve(e,t){if(t.liner?Io(r,Qn(e,r).text.length):ge(t,Qn(e,t.line).text.length)}function ge(e,t){var r=e.ch;return null==r||r>t?Io(e.line,t):0>r?Io(e.line,0):e}function be(e,t){return t>=e.first&&t=o.ch:u.to>o.ch))){if(n&&(Ma(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--l;continue}break}if(!c.atomic)continue;var d=c.find(0>a?-1:1);if(0==jo(d,o)&&(d.ch+=a,d.ch<0?d=d.line>e.first?ve(e,Io(d.line-1)):null:d.ch>s.text.length&&(d=d.linet&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild(Bi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return dt(e,Io(t,r),"div",d,n)}var s,l,d=Qn(a,t),f=d.text.length;return Zi(ni(d),r||0,null==i?f:i,function(e,t,a){var d,h,p,m=o(e,"left");if(e==t)d=m,h=p=m.left;else{if(d=o(t-1,"right"),"rtl"==a){var v=m;m=d,d=v}h=m.left,p=d.right}null==r&&0==e&&(h=u),d.top-m.top>3&&(n(h,m.top,null,m.bottom),h=u,m.bottoml.bottom||d.bottom==l.bottom&&d.right>l.right)&&(l=d),u+1>h&&(h=u),n(h,d.top,p-h,d.bottom)}),{start:s,end:l}}var o=e.display,a=e.doc,s=document.createDocumentFragment(),l=Ue(e.display),u=l.left,c=Math.max(o.sizerWidth,Ke(e)-o.sizer.offsetLeft)-l.right,d=t.from(),f=t.to();if(d.line==f.line)i(d.line,d.ch,f.ch);else{var h=Qn(a,d.line),p=Qn(a,f.line),m=gn(h)==gn(p),v=i(d.line,d.ch,m?h.text.length+1:null).end,g=i(f.line,m?0:null,f.ch).start;m&&(v.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Fe(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var r=+new Date+e.options.workTime,n=aa(t.mode,Be(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength,l=Pn(e,o,s?aa(t.mode,n):n,!0);o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!d&&fr?(Fe(e,e.options.workDelay),!0):void 0}),i.length&&Nt(e,function(){for(var t=0;ta;--s){if(s<=o.first)return o.first;var l=Qn(o,s-1);if(l.stateAfter&&(!r||s<=o.frontier))return s;var u=Fa(l.text,null,e.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}function Be(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Ve(e,t,r),a=o>n.first&&Qn(n,o-1).stateAfter;return a=a?aa(n.mode,a):sa(n.mode),n.iter(o,t,function(r){Dn(e,r.text,a);var s=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((l.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function $e(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Qe(e,t){t=gn(t);var r=ei(t),n=e.display.externalMeasured=new Lt(e.doc,t,r);n.lineN=r;var i=n.built=jn(e,n);return n.text=i.pre,Wi(e.display.lineMeasure,i.pre),n}function Xe(e,t,r,n){return et(e,Ze(e,t),r,n)}function Je(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt?(i=0,o=1,a="left"):u>t?(i=t-l,o=i+1):(s==e.length-3||t==u&&e[s+3]>t)&&(o=u-l,i=o-1,t>=u&&(a="right")),null!=i){if(n=e[s+2],l==u&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],a="left";if("right"==r&&i==u-l)for(;sc;c++){for(;s&&Vi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+lyo&&0==s&&l==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(bo&&e.options.lineWrapping){var d=za(a,s,l).getClientRects();i=d.length?d["right"==n?d.length-1:0]:zo}else i=za(a,s,l).getBoundingClientRect()||zo;if(i.left||i.right||0==s)break;l=s,s-=1,u="right"}bo&&11>yo&&(i=nt(e.display.measure,i))}else{s>0&&(u=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(bo&&9>yo&&!s&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+bt(e.display),top:f.top,bottom:f.bottom}:zo}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/2,v=t.view.measure.heights,c=0;cr.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=Ze(e,n));var l=ni(n),u=t.ch;if(!l)return a(u);var c=lo(l,u),d=s(u,c);return null!=is&&(d.other=s(u,is)),d}function ht(e,t){var r=0,t=ve(e.doc,t);e.options.lineWrapping||(r=bt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ri(n)+ze(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function pt(e,t,r,n){var i=Io(e,t);return i.xRel=n,r&&(i.outside=!0),i}function mt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return pt(n.first,0,!0,-1);var i=ti(n,r),o=n.first+n.size-1;if(i>o)return pt(n.first+n.size-1,Qn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=Qn(n,i);;){var s=vt(e,a,i,t,r),l=mn(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=ei(a=u.to.line)}}function vt(e,t,r,n,i){function o(n){var i=ft(e,Io(r,n),"line",t,u);return s=!0,a>i.bottom?i.left-l:av)return pt(r,h,g,1);for(;;){if(c?h==f||h==co(t,f,1):1>=h-f){for(var b=p>n||v-n>=n-p?f:h,y=n-(b==f?p:v);Vi(t.text.charAt(b));)++b;var w=pt(r,b,b==f?m:g,-1>y?-1:y>1?1:0);return w}var _=Math.ceil(d/2),k=f+_;if(c){k=f;for(var x=0;_>x;++x)k=co(t,k,1)}var C=o(k);C>n?(h=k,v=C,(g=s)&&(v+=1e3),d=_):(f=k,p=C,m=s,d-=_)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ho){Ho=Bi("pre");for(var t=0;49>t;++t)Ho.appendChild(document.createTextNode("x")),Ho.appendChild(Bi("br"));Ho.appendChild(document.createTextNode("x"))}Wi(e.measure,Ho);var r=Ho.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),zi(e.measure),r||1}function bt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Bi("span","xxxxxxxxxx"),r=Bi("pre",[t]);Wi(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function yt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Uo},Wo?Wo.ops.push(e.curOp):e.curOp.ownsGroup=Wo={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new E(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&T(e.cm,e.update)}function Et(e){var t=e.cm,r=t.display;e.updatedDisplay&&M(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Xe(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+qe(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ke(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function St(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=n){var a=new Lt(e.doc,Qn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Rt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Do&&yn(e.doc,t)i.viewFrom?It(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)It(e);else if(t<=i.viewFrom){var o=Ft(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):It(e)}else if(r>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var a=Ft(e,t,t,-1),s=Ft(e,r,r+n,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):It(e)}var l=i.externalMeasured;l&&(r=i.lineN&&t=n.viewTo)){var o=n.view[jt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Li(a,r)&&a.push(r)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function jt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;nt)return n}function Ft(e,t,r,n){var i,o=jt(e,t),a=e.display.view;if(!Do||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,l=e.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;yn(e.doc,r)!=r;){if(o==(0>n?0:a.length-1))return null;r+=n*a[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function Ht(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Pt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Pt(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,jt(e,r)))),n.viewTo=r}function Vt(e){for(var t=e.display.view,r=0,n=0;n400}var i=e.display;Na(i.scroller,"mousedown",At(e,Kt)),bo&&11>yo?Na(i.scroller,"dblclick",At(e,function(t){if(!Ei(e,t)){var r=qt(e,t);if(r&&!Xt(e,t)&&!Ut(e.display,t)){Ea(t);var n=e.findWordAt(r);_e(e.doc,n.anchor,n.head)}}})):Na(i.scroller,"dblclick",function(t){Ei(e,t)||Ea(t)}),Po||Na(i.scroller,"contextmenu",function(t){gr(e,t)});var o,a={end:0};Na(i.scroller,"touchstart",function(e){if(!r(e)){clearTimeout(o);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-a.end<=300?a:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY)}}),Na(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Na(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Ut(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new fe(s,s):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(s):new fe(Io(s.line,0),ve(e.doc,Io(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Ea(r)}t()}),Na(i.scroller,"touchcancel",t),Na(i.scroller,"scroll",function(){i.scroller.clientHeight&&(rr(e,i.scroller.scrollTop),nr(e,i.scroller.scrollLeft,!0),Ma(e,"scroll",e))}),Na(i.scroller,"mousewheel",function(t){ir(e,t)}),Na(i.scroller,"DOMMouseScroll",function(t){ir(e,t)}),Na(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ei(e,t)||Ta(t)},over:function(t){Ei(e,t)||(er(e,t),Ta(t))},start:function(t){Zt(e,t)},drop:At(e,Jt),leave:function(){tr(e)}};var s=i.input.getField();Na(s,"keyup",function(t){fr.call(e,t)}),Na(s,"keydown",At(e,cr)),Na(s,"keypress",At(e,hr)),Na(s,"focus",ji(mr,e)),Na(s,"blur",ji(vr,e))}function zt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Na:Oa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Wt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Ut(e,t){for(var r=wi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function qt(e,t,r,n){var i=e.display;if(!r&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(t){return null}var l,u=mt(e,o,a);if(n&&1==u.xRel&&(l=Qn(e.doc,u.line).text).length==u.ch){var c=Fa(l,l.length,e.options.tabSize)-l.length;u=Io(u.line,Math.max(0,Math.round((o-Ue(e.display).left)/bt(e.display))-c))}return u}function Kt(e){var t=this,r=t.display;if(!(r.activeTouch&&r.input.supportsTouch()||Ei(t,e))){if(r.shift=e.shiftKey,Ut(r,e))return void(wo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Xt(t,e)){var n=qt(t,e);switch(window.focus(),_i(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Gt(t,e,n):wi(e)==r.scroller&&Ea(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),n&&_e(t.doc,n),setTimeout(function(){r.input.focus()},20),Ea(e);break;case 3:Po?gr(t,e):pr(t)}}}}function Gt(e,t,r){bo?setTimeout(ji(Q,e),0):e.curOp.focus=Ui();var n,i=+new Date;Bo&&Bo.time>i-400&&0==jo(Bo.pos,r)?n="triple":Vo&&Vo.time>i-400&&0==jo(Vo.pos,r)?(n="double",Bo={time:i,pos:r}):(n="single",Vo={time:i,pos:r});var o,a=e.doc.sel,s=Ao?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ja&&!X(e)&&"single"==n&&(o=a.contains(r))>-1&&(jo((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(jo(o.to(),r)>0||r.xRel<0)?Yt(e,t,r,s):$t(e,t,r,n,s)}function Yt(e,t,r,n){var i=e.display,o=+new Date,a=At(e,function(s){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Oa(document,"mouseup",a),Oa(i.scroller,"drop",a),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Ea(s),!n&&+new Date-200=p;p++){var g=Qn(u,p).text,b=Ha(g,l,o);l==h?i.push(new fe(Io(p,b),Io(p,b))):g.length>b&&i.push(new fe(Io(p,b),Io(p,Ha(g,h,o))))}i.length||i.push(new fe(r,r)),Te(u,he(f.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var y=c,w=y.anchor,_=t;if("single"!=n){if("double"==n)var k=e.findWordAt(t);else var k=new fe(Io(t.line,0),ve(u,Io(t.line+1,0)));jo(k.anchor,w)>0?(_=k.head,w=$(y.from(),k.anchor)):(_=k.anchor,w=Y(y.to(),k.head))}var i=f.ranges.slice(0);i[d]=new fe(ve(u,w),_),Te(u,he(i,d),Ia)}}function a(t){var r=++b,i=qt(e,t,!0,"rect"==n);if(i)if(0!=jo(i,v)){e.curOp.focus=Ui(),o(i);var s=w(l,u);(i.line>=s.to||i.lineg.bottom?20:0;c&&setTimeout(At(e,function(){b==r&&(l.scroller.scrollTop+=c,a(t))}),50)}}function s(t){e.state.selectingText=!1,b=1/0,Ea(t),l.input.focus(),Oa(document,"mousemove",y),Oa(document,"mouseup",_),u.history.lastSelOrigin=null}var l=e.display,u=e.doc;Ea(t);var c,d,f=u.sel,h=f.ranges;if(i&&!t.shiftKey?(d=u.sel.contains(r),c=d>-1?h[d]:new fe(r,r)):(c=u.sel.primary(),d=u.sel.primIndex),t.altKey)n="rect",i||(c=new fe(r,r)),r=qt(e,t,!0,!0),d=-1;else if("double"==n){var p=e.findWordAt(r);c=e.display.shift||u.extend?we(u,c,p.anchor,p.head):p}else if("triple"==n){var m=new fe(Io(r.line,0),ve(u,Io(r.line+1,0)));c=e.display.shift||u.extend?we(u,c,m.anchor,m.head):m}else c=we(u,c,r);i?-1==d?(d=h.length,Te(u,he(h.concat([c]),d),{scroll:!1,origin:"*mouse"})):h.length>1&&h[d].empty()&&"single"==n&&!t.shiftKey?(Te(u,he(h.slice(0,d).concat(h.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),f=u.sel):xe(u,d,c,Ia):(d=0,Te(u,new de([c],0),Ia),f=u.sel);var v=r,g=l.wrapper.getBoundingClientRect(),b=0,y=At(e,function(e){_i(e)?a(e):s(e)}),_=At(e,s);e.state.selectingText=_,Na(document,"mousemove",y),Na(document,"mouseup",_)}function Qt(e,t,r,n,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Ea(t);var s=e.display,l=s.lineDiv.getBoundingClientRect();if(a>l.bottom||!Ti(e,r))return yi(t);a-=l.top-s.viewOffset;for(var u=0;u=o){var d=ti(e.doc,a),f=e.options.gutters[u];return i(e,r,e,d,f,t),yi(t)}}}function Xt(e,t){return Qt(e,t,"gutterClick",!0,xi)}function Jt(e){var t=this;if(tr(t),!Ei(t,e)&&!Ut(t.display,e)){Ea(e),bo&&(qo=+new Date);var r=qt(t,e,!0),n=e.dataTransfer.files;if(r&&!X(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,s=function(e,n){if(!t.options.allowDropFileTypes||-1!=Li(t.options.allowDropFileTypes,e.type)){var s=new FileReader;s.onload=At(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ve(t.doc,r);var l={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Cr(t.doc,l),Se(t.doc,pe(r,Xo(l)))}}),s.readAsText(e)}},l=0;i>l;++l)s(n[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Ao?e.altKey:e.ctrlKey))var u=t.listSelections();if(Ne(t.doc,pe(r,r)),u)for(var l=0;la.clientWidth,l=a.scrollHeight>a.clientHeight;if(n&&s||i&&l){if(i&&Ao&&wo)e:for(var u=t.target,c=o.view;u!=a;u=u.parentNode)for(var d=0;df?h=Math.max(0,h+f-50):p=Math.min(e.doc.height,p+f+50),A(e,{top:h,bottom:p})}20>Ko&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Go=(Go*Ko+r)/(Ko+1),++Ko)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function or(e,t,r){if("string"==typeof t&&(t=la[t],!t))return!1; -e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{X(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Ra}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function ar(e,t,r){for(var n=0;nyo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=lr(t,e);xo&&(Qo=n?r:null,!n&&88==r&&!ts&&(Ao?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||dr(t)}}function dr(e){function t(e){18!=e.keyCode&&e.altKey||($a(r,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t))}var r=e.display.lineDiv;Qa(r,"CodeMirror-crosshair"),Na(document,"keyup",t),Na(document,"mouseover",t)}function fr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Ei(this,e)}function hr(e){var t=this;if(!(Ut(t.display,e)||Ei(t,e)||e.ctrlKey&&!e.altKey||Ao&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(xo&&r==Qo)return Qo=null,void Ea(e);if(!xo||e.which&&!(e.which<10)||!lr(t,e)){var i=String.fromCharCode(null==n?r:n);ur(t,e,i)||t.display.input.onKeyPress(e)}}}function pr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vr(e))},100)}function mr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ma(e,"focus",e),e.state.focused=!0,Qa(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),wo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),je(e))}function vr(e){e.state.delayingBlurEvent||(e.state.focused&&(Ma(e,"blur",e),e.state.focused=!1,$a(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function gr(e,t){Ut(e.display,t)||br(e,t)||Ei(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function br(e,t){return Ti(e,"gutterContextMenu")?Qt(e,t,"gutterContextMenu",!1,Ma):!1}function yr(e,t){if(jo(e,t.from)<0)return e;if(jo(e,t.to)<=0)return Xo(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Xo(t).ch-t.to.ch),Io(r,n)}function wr(e,t){for(var r=[],n=0;n=0;--i)Er(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Er(e,t)}}function Er(e,t){if(1!=t.text.length||""!=t.text[0]||0!=jo(t.from,t.to)){var r=wr(e,t);li(e,t,r,e.cm?e.cm.curOp.id:NaN),Nr(e,t,r,nn(e,t));var n=[];Yn(e,function(e,r){r||-1!=Li(n,e.history)||(bi(e.history,t),n.push(e.history)),Nr(e,t,null,nn(e,t))})}}function Sr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l=0;--l){var d=n.changes[l];if(d.origin=t,c&&!xr(e,d,!1))return void(a.length=0);u.push(oi(e,d));var f=l?wr(e,d):Mi(a);Nr(e,d,f,an(e,d)),!l&&e.cm&&e.cm.scrollIntoView({from:d.from,to:Xo(d)});var h=[];Yn(e,function(e,t){t||-1!=Li(h,e.history)||(bi(e.history,d),h.push(e.history)),Nr(e,d,null,an(e,d))})}}}}function Tr(e,t){if(0!=t&&(e.first+=t,e.sel=new de(Pi(e.sel.ranges,function(e){return new fe(Io(e.anchor.line+t,e.anchor.ch),Io(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Rt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:Io(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Xn(e,t.from,t.to),r||(r=wr(e,t)),e.cm?Ar(e.cm,t,n):qn(e,t,n),Ne(e,r,Da)}}function Ar(e,t,r){var n=e.doc,i=e.display,a=t.from,s=t.to,l=!1,u=a.line;e.options.lineWrapping||(u=ei(gn(Qn(n,a.line))),n.iter(u,s.line+1,function(e){return e==i.maxLine?(l=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&Si(e),qn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Fe(e,400);var c=t.text.length-(s.line-a.line)-1;t.full?Rt(e):a.line!=s.line||1!=t.text.length||Un(e.doc,t)?Rt(e,a.line,s.line+1,c):Dt(e,a.line,"text");var f=Ti(e,"changes"),h=Ti(e,"change");if(h||f){var p={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};h&&xi(e,"change",e,p),f&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Or(e,t,r,n,i){if(n||(n=r),jo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Cr(e,{from:r,to:n,text:t,origin:i})}function Mr(e,t){if(!Ei(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!So){var o=Bi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-ze(e.display))+"px; height: "+(t.bottom-t.top+qe(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Lr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,a=ft(e,t),s=r&&r!=t?ft(e,r):a,l=Rr(e,Math.min(a.left,s.left),Math.min(a.top,s.top)-n,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+n),u=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=l.scrollTop&&(rr(e,l.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=l.scrollLeft&&(nr(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return a}function Pr(e,t,r,n,i){var o=Rr(e,t,r,n,i);null!=o.scrollTop&&rr(e,o.scrollTop),null!=o.scrollLeft&&nr(e,o.scrollLeft)}function Rr(e,t,r,n,i){var o=e.display,a=gt(e.display);0>r&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Ge(e),u={};i-r>l&&(i=r+l);var c=e.doc.height+We(o),d=a>r,f=i>c-a;if(s>r)u.scrollTop=d?0:r;else if(i>s+l){var h=Math.min(r,(f?c:i)-l);h!=s&&(u.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ke(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),v=n-t>m;return v&&(n=t+m),10>t?u.scrollLeft=0:p>t?u.scrollLeft=Math.max(0,t-(v?0:10)):n>m+p-3&&(u.scrollLeft=n+(v?0:10)-m),u}function Dr(e,t,r){(null!=t||null!=r)&&jr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Ir(e){jr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Io(t.line,t.ch-1):t,n=Io(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function jr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ht(e,t.from),n=ht(e,t.to),i=Rr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Be(e,t):r="prev");var a=e.options.tabSize,s=Qn(o,t),l=Fa(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==Ra||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?Fa(Qn(o,t-1).text,null,a):0:"add"==r?u=l+e.options.indentUnit:"subtract"==r?u=l-e.options.indentUnit:"number"==typeof r&&(u=l+r),u=Math.max(0,u);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)f+=a,d+=" ";if(u>f&&(d+=Oi(u-f)),d!=c)return Or(o,d,Io(t,0),Io(t,c.length),"+input"),s.stateAfter=null,!0;for(var h=0;h=0;t--)Or(e.doc,"",n[t].from,n[t].to,"+delete");Ir(e)})}function Br(e,t,r,n,i){function o(){var t=s+r;return t=e.first+e.size?d=!1:(s=t,c=Qn(e,t))}function a(e){var t=(i?co:fo)(c,l,r,!0);if(null==t){if(e||!o())return d=!1;l=i?(0>r?no:ro)(c):0>r?c.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,u=r,c=Qn(e,s),d=!0;if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var f=null,h="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(0>r)||a(!m);m=!1){var v=c.text.charAt(l)||"\n",g=Fi(v,p)?"w":h&&"\n"==v?"n":!h||/\s/.test(v)?null:"p";if(!h||m||g||(g="s"),f&&f!=g){0>r&&(r=1,a());break}if(g&&(f=g),r>0&&!a(!m))break}var b=Le(e,Io(s,l),u,!0);return d||(b.hitSide=!0),b}function zr(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*gt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var l=mt(e,a,i);if(!l.outside)break;if(0>r?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*r}return l}function Wr(t,r,n,i){e.defaults[t]=r,n&&(Zo[t]=i?function(e,t,r){r!=ea&&n(e,t,r)}:n)}function Ur(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Bi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(vn(e,t.line,t,r,o)||t.line!=r.line&&vn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&li(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,l=t.line,u=e.cm;if(e.iter(l,r.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&gn(e)==u.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&Zn(e,0),en(e,new Xr(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){_n(e,t)&&Zn(t,0)}),o.clearOnEnter&&Na(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Ro=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++pa,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Rt(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)Dt(u,c,"text");o.atomic&&Oe(u.doc),xi(u,"markerAdded",u,o)}return o}function Gr(e,t,r,n,i){n=Ii(n),n.shared=!1;var o=[Kr(e,t,r,n,i)],a=o[0],s=n.widgetNode;return Yn(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Kr(e,ve(e,t),ve(e,r),n,i));for(var l=0;l=t:o.to>t);(n||(n=[])).push(new Xr(a,o.from,l?null:o.to))}}return n}function rn(e,t,r){if(e)for(var n,i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var d=0;dd;++d)p.push(m);p.push(l)}return p}function on(e){for(var t=0;t0)){var c=[l,1],d=jo(u.from,s.from),f=jo(u.to,s.to);(0>d||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-1}}return i}function ln(e){var t=e.markedSpans;if(t){for(var r=0;r=0&&0>=d||0>=c&&d>=0)&&(0>=c&&(jo(u.to,r)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(jo(u.from,n)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function gn(e){for(var t;t=pn(e);)e=t.find(-1,!0).line;return e}function bn(e){for(var t,r;t=mn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function yn(e,t){var r=Qn(e,t),n=gn(r);return r==n?t:ei(n)}function wn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!_n(e,n))return t;for(;r=mn(n);)n=r.find(1,!0).line;return ei(n)+1}function _n(e,t){var r=Do&&t.markedSpans;if(r)for(var n,i=0;io;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Mn(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?aa(a.mode,c):c}}var o,a=e.doc,s=a.mode;t=ve(a,t);var l,u=Qn(a,t.line),c=Be(e,t.line,r),d=new ha(u.text,e.options.tabSize);for(n&&(l=[]);(n||d.pose.options.maxHighlightLength?(s=!1,a&&Dn(e,t,n,d.pos),d.pos=t.length,l=null):l=Nn(On(r,d,n,f),o),f){var h=f[0].name;h&&(l="m-"+(l?h+" "+l:h))}if(!s||c!=l){for(;uu;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,l-r,e,"cm-overlay "+t),l=r+2;else for(;l>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Rn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ei(t)),i=Pn(e,t,t.text.length>e.options.maxHighlightLength?aa(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Dn(e,t,r,n){var i=e.doc.mode,o=new ha(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&An(i,r);!o.eol();)On(i,o,r),o.start=o.pos}function In(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?wa:ya;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var r=Bi("span",null,null,wo?"padding-right: .1px":null),n={pre:Bi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,splitSpaces:(bo||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Hn,Xi(e.display.measure)&&(o=ni(a))&&(n.addToken=Bn(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&ei(a);Wn(a,n,Rn(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Ki(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Ki(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return wo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Ma(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Ki(n.pre.className,n.textClass||"")),n}function Fn(e){var t=Bi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Hn(e,t,r,n,i,o,a){if(t){var s=e.splitSpaces?t.replace(/ {3,}/g,Vn):t,l=e.cm.state.specialChars,u=!1;if(l.test(t))for(var c=document.createDocumentFragment(),d=0;;){l.lastIndex=d;var f=l.exec(t),h=f?f.index-d:t.length-d;if(h){var p=document.createTextNode(s.slice(d,d+h));bo&&9>yo?c.appendChild(Bi("span",[p])):c.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!f)break;if(d+=h+1," "==f[0]){var m=e.cm.options.tabSize,v=m-e.col%m,p=c.appendChild(Bi("span",Oi(v),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=v}else if("\r"==f[0]||"\n"==f[0]){var p=c.appendChild(Bi("span","\r"==f[0]?"␍":"␤","cm-invalidchar"));p.setAttribute("cm-text",f[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(f[0]);p.setAttribute("cm-text",f[0]),bo&&9>yo?c.appendChild(Bi("span",[p])):c.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var c=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,c),bo&&9>yo&&(u=!0),e.pos+=t.length}if(r||n||i||u||a){var g=r||"";n&&(g+=n),i&&(g+=i);var b=Bi("span",[c],g,a);return o&&(b.title=o),e.content.appendChild(b)}e.content.appendChild(c)}}function Vn(e){for(var t=" ",r=0;ru&&f.from<=u)break}if(f.to>=c)return e(r,n,i,o,a,s,l);e(r,n.slice(0,f.to-u),i,o,null,s,l),o=null,n=n.slice(f.to-u),u=f.to}}}function zn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Wn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,s,l,u,c,d,f,h=i.length,p=0,m=1,v="",g=0;;){if(g==p){l=u=c=d=s="",f=null,g=1/0;for(var b=[],y=0;yp||_.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&g>w.to&&(g=w.to,u=""),_.className&&(l+=" "+_.className),_.css&&(s=_.css),_.startStyle&&w.from==p&&(c+=" "+_.startStyle),_.endStyle&&w.to==g&&(u+=" "+_.endStyle),_.title&&!d&&(d=_.title),_.collapsed&&(!f||fn(f.marker,_)<0)&&(f=w)):w.from>p&&g>w.from&&(g=w.from)}if(f&&(f.from||0)==p){if(zn(t,(null==f.to?h+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}if(!f&&b.length)for(var y=0;y=h)break;for(var k=Math.min(h,g);;){if(v){var x=p+v.length;if(!f){var C=x>k?v.slice(0,k-p):v;t.addToken(t,C,a?a+l:l,c,p+C.length==g?u:"",d,s)}if(x>=k){v=v.slice(k-p),p=k;break}p=x,c=""}v=i.slice(o,o=r[m++]),a=In(r[m++],t.cm.options)}}else for(var m=1;mr;++r)o.push(new ba(u[r],i(r),n));return o}var s=t.from,l=t.to,u=t.text,c=Qn(e,s.line),d=Qn(e,l.line),f=Mi(u),h=i(u.length-1),p=l.line-s.line;if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length);else if(Un(e,t)){var m=a(0,u.length-1);o(d,d.text,h),p&&e.remove(s.line,p),m.length&&e.insert(s.line,m)}else if(c==d)if(1==u.length)o(c,c.text.slice(0,s.ch)+f+c.text.slice(l.ch),h);else{var m=a(1,u.length-1);m.push(new ba(f+c.text.slice(l.ch),h,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,m)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+d.text.slice(l.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(d,f+d.text.slice(l.ch),h);var m=a(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,m)}xi(e,"change",e,t)}function Kn(e){this.lines=e,this.parent=null;for(var t=0,r=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function Xn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function Jn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function Zn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ei(e){if(null==e.parent)return null;for(var t=e.parent,r=Li(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ti(e,t){var r=e.first;e:do{for(var n=0;nt){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;nt)break;t-=s}return r+n}function ri(e){e=gn(e);for(var t=0,r=e.parent,n=0;n1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Mi(e.done)):void 0}function li(e,t,r,n){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=si(i,i.lastOp==n))){var s=Mi(o.changes);0==jo(t.from,t.to)&&0==jo(t.from,s.to)?s.to=Xo(t):o.changes.push(oi(e,t))}else{var l=Mi(i.done);for(l&&l.ranges||di(e.sel,i.done),o={changes:[oi(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||Ma(e,"historyAdded")}function ui(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ci(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ui(e,o,Mi(i.done),t))?i.done[i.done.length-1]=t:di(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ai(i.undone)}function di(e,t){var r=Mi(t);r&&r.ranges&&r.equals(e)||t.push(e)}function fi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function hi(e){if(!e)return null;for(var t,r=0;r-1&&(Mi(s)[d]=c[d],delete c[d])}}}return i}function vi(e,t,r,n){r0?n.slice():Aa:n||Aa}function xi(e,t){function r(e){return function(){e.apply(null,o)}}var n=ki(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Wo?i=Wo.delayedCallbacks:La?i=La:(i=La=[],setTimeout(Ci,0));for(var a=0;a0}function Ni(e){e.prototype.on=function(e,t){Na(this,e,t)},e.prototype.off=function(e,t){Oa(this,e,t)}}function Ai(){this.id=null}function Oi(e){for(;Va.length<=e;)Va.push(Mi(Va)+" ");return Va[e]}function Mi(e){return e[e.length-1]}function Li(e,t){for(var r=0;r-1&&Ua(e)?!0:t.test(e):Ua(e)}function Hi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Vi(e){return e.charCodeAt(0)>=768&&qa.test(e)}function Bi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Wi(e,t){return zi(e).appendChild(t)}function Ui(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function qi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Ki(e,t){for(var r=e.split(" "),n=0;n2&&!(bo&&8>yo))}var r=Ga?Bi("span","​"):Bi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Xi(e){if(null!=Ya)return Ya;var t=Wi(e,document.createTextNode("AخA")),r=za(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=za(t,1,2).getBoundingClientRect();return Ya=n.right-r.right<3}function Ji(e){if(null!=rs)return rs;var t=Wi(e,Bi("span","x")),r=t.getBoundingClientRect(),n=za(t,0,1).getBoundingClientRect();return rs=Math.abs(r.left-n.left)>1}function Zi(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;ot||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function eo(e){return e.level%2?e.to:e.from}function to(e){return e.level%2?e.from:e.to}function ro(e){var t=ni(e);return t?eo(t[0]):0}function no(e){var t=ni(e);return t?to(Mi(t)):e.text.length}function io(e,t){var r=Qn(e.doc,t),n=gn(r);n!=r&&(t=ei(n));var i=ni(n),o=i?i[0].level%2?no(n):ro(n):0;return Io(t,o)}function oo(e,t){for(var r,n=Qn(e.doc,t);r=mn(n);)n=r.find(1,!0).line,t=null;var i=ni(n),o=i?i[0].level%2?ro(n):no(n):n.text.length;return Io(null==t?ei(n):t,o)}function ao(e,t){var r=io(e,t.line),n=Qn(e.doc,r.line),i=ni(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return Io(r.line,a?0:o)}return r}function so(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function lo(e,t){is=null;for(var r,n=0;nt)return n;if(i.from==t||i.to==t){if(null!=r)return so(e,i.level,e[r].level)?(i.from!=i.to&&(is=r),n):(i.from!=i.to&&(is=n),r);r=n}}return r}function uo(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Vi(e.text.charAt(t)));return t}function co(e,t,r,n){var i=ni(e);if(!i)return fo(e,t,r,n);for(var o=lo(i,t),a=i[o],s=uo(e,t,a.level%2?-r:r,n);;){if(s>a.from&&s0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;s=r>0==a.level%2?uo(e,a.to,-1,n):uo(e,a.from,1,n)}}function fo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Vi(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var ho=navigator.userAgent,po=navigator.platform,mo=/gecko\/\d/i.test(ho),vo=/MSIE \d/.test(ho),go=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ho),bo=vo||go,yo=bo&&(vo?document.documentMode||6:go[1]),wo=/WebKit\//.test(ho),_o=wo&&/Qt\/\d+\.\d+/.test(ho),ko=/Chrome\//.test(ho),xo=/Opera\//.test(ho),Co=/Apple Computer/.test(navigator.vendor),Eo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ho),So=/PhantomJS/.test(ho),To=/AppleWebKit/.test(ho)&&/Mobile\/\w+/.test(ho),No=To||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ho),Ao=To||/Mac/.test(po),Oo=/win/i.test(po),Mo=xo&&ho.match(/Version\/(\d*\.\d*)/);Mo&&(Mo=Number(Mo[1])),Mo&&Mo>=15&&(xo=!1,wo=!0);var Lo=Ao&&(_o||xo&&(null==Mo||12.11>Mo)),Po=mo||bo&&yo>=9,Ro=!1,Do=!1;m.prototype=Ii({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==n&&this.overlayHack(),this.checkedOverlay=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=Ao&&!Eo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,r=function(e){wi(e)!=t.vert&&wi(e)!=t.horiz&&At(t.cm,Kt)(e)};Na(this.vert,"mousedown",r),Na(this.horiz,"mousedown",r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),v.prototype=Ii({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},v.prototype),e.scrollbarModel={"native":m,"null":v},E.prototype.signal=function(e,t){Ti(e,t)&&this.events.push(arguments)},E.prototype.finish=function(){for(var e=0;e=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Na(o,"paste",function(e){return Z(e,n)?!0:(n.state.pasteIncoming=!0,void r.fastPoll())}),Na(o,"cut",t),Na(o,"copy",t),Na(e.scroller,"paste",function(t){Ut(e,t)||(n.state.pasteIncoming=!0,r.focus())}),Na(e.lineSpace,"selectstart",function(t){Ut(e,t)||Ea(t)}),Na(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Na(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=Re(e);if(e.options.moveInputWithCursor){var i=ft(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Wi(r.cursorDiv,e.cursors),Wi(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=ts&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.textarea.value=a,n.state.focused&&Ba(this.textarea),bo&&yo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",bo&&yo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!No||Ui()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||es(t)&&!r&&!this.composing||X(e)||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(bo&&yo>=9&&this.hasSelection===n||Ao&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);a>o&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var s=this;return Nt(e,function(){J(e,n.slice(o),r.length-o,null,s.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=n,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){bo&&yo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",a.style.cssText=c,bo&&9>yo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!bo||bo&&9>yo)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==n.prevInput?At(i,la.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,a=n.textarea,s=qt(i,e),l=o.scroller.scrollTop;if(s&&!xo){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(s)&&At(i,Te)(i.doc,pe(s),Da);var c=a.style.cssText;if(n.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(bo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var d=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),bo&&yo>=9&&t(),Po){Ta(e);var f=function(){Oa(window,"mouseup",f),setTimeout(r,20)};Na(window,"mouseup",f)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Ri,needsContentAttribute:!1},ne.prototype),oe.prototype=Ii({init:function(e){function t(e){if(n.somethingSelected())Fo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Fo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Da),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!To)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Fo.join("\n"));else{var r=ie(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Fo.join("\n");var o=document.activeElement;Ba(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}var r=this,n=r.cm,i=r.div=e.lineDiv;re(i),Na(i,"paste",function(e){Z(e,n)}),Na(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=pe(Io(i.head.line,a),Io(i.head.line,a+t.length)))}}),Na(i,"compositionupdate",function(e){r.composing.data=e.data}),Na(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),Na(i,"touchstart",function(){r.forceCompositionEnd()}),Na(i,"input",function(){r.composing||(X(n)||!r.pollContent())&&Nt(r.cm,function(){Rt(n)})}),Na(i,"copy",t),Na(i,"cut",t)},prepareSelection:function(){var e=Re(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=jo($(r,n),t.from())||0!=jo(Y(r,n),t.to())){var i=ae(this.cm,t.from()),o=ae(this.cm,t.to());if(i||o){var a=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=a[a.length-1].measure,u=l.maps?l.maps[l.maps.length-1]:l.map;o={node:u[u.length-1],offset:u[u.length-2]-u[u.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var c=za(i.node,i.offset,o.offset,o.node)}catch(d){}c&&(e.removeAllRanges(),e.addRange(c),s&&null==e.anchorNode?e.addRange(s):mo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Wi(this.cm.display.cursorDiv,e.cursors),Wi(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Ka(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Nt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Nt(t,function(){Te(t.doc,pe(r,n),Da),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.linet.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=jt(e,n.line)))var a=ei(t.view[0].line),s=t.view[0].node;else var a=ei(t.view[o].line),s=t.view[o-1].node.nextSibling;var l=jt(e,i.line);if(l==t.view.length-1)var u=t.viewTo-1,c=t.lineDiv.lastChild;else var u=ei(t.view[l+1].line)-1,c=t.view[l+1].node.previousSibling;for(var d=e.doc.splitLines(ce(e,s,c,a,u)),f=Xn(e.doc,Io(a,0),Io(u,Qn(e.doc,u).text.length));d.length>1&&f.length>1;)if(Mi(d)==Mi(f))d.pop(),f.pop(),u--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),a++}for(var h=0,p=0,m=d[0],v=f[0],g=Math.min(m.length,v.length);g>h&&m.charCodeAt(h)==v.charCodeAt(h);)++h;for(var b=Mi(d),y=Mi(f),w=Math.min(b.length-(1==d.length?h:0),y.length-(1==f.length?h:0));w>p&&b.charCodeAt(b.length-p-1)==y.charCodeAt(y.length-p-1);)++p;d[d.length-1]=b.slice(0,b.length-p),d[0]=d[0].slice(h);var _=Io(a,h),k=Io(u,f.length?Mi(f).length-p:0);return d.length>1||d[0]||jo(_,k)?(Or(e.doc,d,_,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){X(this.cm)?At(this.cm,Rt)(this.cm):e.data&&e.data!=e.startData&&At(this.cm,J)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),X(this.cm)||At(this.cm,J)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Ri,resetPosition:Ri,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:ne,contenteditable:oe},de.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&jo(e,n.to())<=0)return r}return-1}},fe.prototype={from:function(){return $(this.anchor,this.head)},to:function(){return Y(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ho,Vo,Bo,zo={left:0,right:0,top:0,bottom:0},Wo=null,Uo=0,qo=0,Ko=0,Go=null;bo?Go=-.53:mo?Go=15:ko?Go=-.7:Co&&(Go=-1/3);var Yo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Yo(e);return t.x*=Go,t.y*=Go,t};var $o=new Ai,Qo=null,Xo=e.changeEnd=function(e){return e.text?Io(e.from.line+e.text.length-1,Mi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,Zo.hasOwnProperty(e)&&At(this,Zo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](qr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(Fr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Ir(this));else{var o=i.from(),a=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;r>l;++l)Fr(this,l,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&xe(this.doc,n,new fe(o,u[n].to()),Da)}}}),getTokenAt:function(e,t){return Mn(this,e,t)},getLineTokens:function(e,t){return Mn(this,Io(e),t,!0)},getTokenTypeAt:function(e){e=ve(this.doc,e);var t,r=Rn(this,Qn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]s?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!oa.hasOwnProperty(t))return r;var n=oa[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;oi&&(e=i,n=!0),r=Qn(this.doc,e)}else r=e;return ut(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ri(r):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return bt(this.display)},setGutterMarker:Ot(function(e,t,r){return Hr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Hi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Dt(t,n,"gutter"),Hi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!be(this.doc,e))return null;var t=e;if(e=Qn(this.doc,e),!e)return null}else{var t=ei(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ft(this,ve(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&Pr(this,s,a,s+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(cr),triggerOnKeyPress:Ot(hr),triggerOnKeyUp:fr,execCommand:function(e){return la.hasOwnProperty(e)?la[e].call(null,this):void 0},triggerElectric:Ot(function(e){ee(this,e)}),findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ve(this.doc,e);t>o&&(a=Br(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Br(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},ja)}),deleteH:Ot(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Vr(this,function(r){var i=Br(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,s=ve(this.doc,e);t>a;++a){var l=ft(this,s,"div");if(null==o?o=l.left:l.left=o,s=zr(this,l,i,r),s.hitSide)break}return s},moveV:Ot(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var s=ft(r,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=zr(r,s,e,t);return"page"==t&&a==n.sel.primary()&&Dr(r,null,dt(r,l,"div").top-s.top),l},ja),i.length)for(var a=0;a0&&s(r.charAt(n-1));)--n;for(;i.5)&&a(this),Ma(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,$n(this,e),at(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,xi(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ni(e);var Jo=e.defaults={},Zo=e.optionHandlers={},ea=e.Init={toString:function(){return"CodeMirror.Init"}};Wr("value","",function(e,t){e.setValue(t)},!0),Wr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Wr("indentUnit",2,r,!0),Wr("indentWithTabs",!1),Wr("smartIndent",!0),Wr("tabSize",4,function(e){n(e),at(e),Rt(e)},!0),Wr("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(Io(n,o))}n++});for(var i=r.length-1;i>=0;i--)Or(e.doc,t,r[i],Io(r[i].line,r[i].ch+t.length))}}),Wr("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),Wr("specialCharPlaceholder",Fn,function(e){e.refresh()},!0),Wr("electricChars",!0),Wr("inputStyle",No?"contenteditable":"textarea",function(){ -throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Wr("rtlMoveVisually",!Oo),Wr("wholeLineUpdateBefore",!0),Wr("theme","default",function(e){s(e),l(e)},!0),Wr("keyMap","default",function(t,r,n){var i=qr(r),o=n!=e.Init&&qr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Wr("extraKeys",null),Wr("lineWrapping",!1,i,!0),Wr("gutters",[],function(e){h(e.options),l(e)},!0),Wr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Wr("coverGutterNextToScrollbar",!1,function(e){b(e)},!0),Wr("scrollbarStyle","native",function(e){g(e),b(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Wr("lineNumbers",!1,function(e){h(e.options),l(e)},!0),Wr("firstLineNumber",1,l,!0),Wr("lineNumberFormatter",function(e){return e},l,!0),Wr("showCursorWhenSelecting",!1,Pe,!0),Wr("resetSelectionOnContextMenu",!0),Wr("lineWiseCopyCut",!0),Wr("readOnly",!1,function(e,t){"nocursor"==t?(vr(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Wr("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Wr("dragDrop",!0,zt),Wr("allowDropFileTypes",null),Wr("cursorBlinkRate",530),Wr("cursorScrollMargin",0),Wr("cursorHeight",1,Pe,!0),Wr("singleCursorHeightPerLine",!0,Pe,!0),Wr("workTime",100),Wr("workDelay",100),Wr("flattenSpans",!0,n,!0),Wr("addModeClass",!1,n,!0),Wr("pollInterval",100),Wr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Wr("historyEventDelay",1250),Wr("viewportMargin",10,function(e){e.refresh()},!0),Wr("maxHighlightLength",1e4,n,!0),Wr("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Wr("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Wr("autofocus",null);var ta=e.modes={},ra=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),ta[t]=r},e.defineMIME=function(e,t){ra[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ra.hasOwnProperty(t))t=ra[t];else if(t&&"string"==typeof t.name&&ra.hasOwnProperty(t.name)){var r=ra[t.name];"string"==typeof r&&(r={name:r}),t=Di(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=ta[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(na.hasOwnProperty(r.name)){var o=na[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var na=e.modeExtensions={};e.extendMode=function(e,t){var r=na.hasOwnProperty(e)?na[e]:na[e]={};Ii(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){ka.prototype[e]=t},e.defineOption=Wr;var ia=[];e.defineInitHook=function(e){ia.push(e)};var oa=e.helpers={};e.registerHelper=function(t,r,n){oa.hasOwnProperty(t)||(oa[t]=e[t]={_global:[]}),oa[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),oa[t]._global.push({pred:n,val:i})};var aa=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},sa=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var la=e.commands={selectAll:function(e){e.setSelection(Io(e.firstLine(),0),Io(e.lastLine()),Da)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Da)},killLine:function(e){Vr(e,function(t){if(t.empty()){var r=Qn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new Io(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Io(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Qn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Io(i.line-1,a.length-1),Io(i.line,1),"+transpose")}r.push(new fe(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Nt(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}Ir(e)})},toggleOverwrite:function(e){e.toggleOverwrite()}},ua=e.keyMap={};ua.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ua.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ua.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},ua.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},ua["default"]=Ao?ua.macDefault:ua.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Pi(r.split(" "),Ur),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var pa=0,ma=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++pa};Ni(ma),ma.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&yt(e),Ti(this,"clear")){var r=this.find();r&&xi(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Rt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Oe(e.doc)),e&&xi(e,"markerCleared",e,this),t&&_t(e),this.parent&&this.parent.clear()}},ma.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;ir;++r){var i=this.lines[r];this.height-=i.height,Tn(i),xi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;ne;++e)if(r(this.lines[e]))return!0}},Gn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;re){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Kn))){var s=[];this.collapse(s),this.children=[new Kn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),s=new Kn(a);i.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Gn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Li(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Gn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;ne){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var _a=0,ka=e.Doc=function(e,t,r,n){if(!(this instanceof ka))return new ka(e,t,r,n);null==r&&(r=0),Gn.call(this,[new Kn([new ba("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Io(r,0);this.sel=pe(i),this.history=new ii(null),this.id=++_a,this.modeOption=t,this.lineSep=n,"string"==typeof e&&(e=this.splitLines(e)),qn(this,{from:i,to:i,text:e}),Te(this,pe(i),Da)};ka.prototype=Di(Gn.prototype,{constructor:ka,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n=0;o--)Cr(this,n[o]);s?Se(this,s):this.cm&&Ir(this.cm)}),undo:Mt(function(){Sr(this,"undo")}),redo:Mt(function(){Sr(this,"redo")}),undoSelection:Mt(function(){Sr(this,"undo",!0)}),redoSelection:Mt(function(){Sr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ve(this,e),t=ve(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;sl.to||null==l.from&&i!=e.line||i==t.line&&l.from>t.ch||r&&!r(l.marker)||n.push(l.marker.parent||l.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne?(t=e,!0):(e-=i,void++r)}),ve(this,Io(r,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;return e.linet&&(t=e.from),null!=e.to&&e.tos||s>=t)return a+(t-o);a+=s-o,a+=r-a%r,o=s+1}},Ha=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},Va=[""],Ba=function(e){e.select()};To?Ba=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:bo&&(Ba=function(e){try{e.select()}catch(t){}});var za,Wa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ua=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Wa.test(e))},qa=/[\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]/;za=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var Ka=e.contains=function(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)};bo&&11>yo&&(Ui=function(){try{return document.activeElement}catch(e){return document.body}});var Ga,Ya,$a=e.rmClass=function(e,t){var r=e.className,n=qi(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Qa=e.addClass=function(e,t){var r=e.className;qi(t).test(r)||(e.className+=(r?" ":"")+t)},Xa=!1,Ja=function(){if(bo&&9>yo)return!1;var e=Bi("div");return"draggable"in e||"dragDrop"in e}(),Za=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){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?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},es=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},ts=function(){var e=Bi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),rs=null,ns=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;10>e;e++)ns[e+48]=ns[e+96]=String(e);for(var e=65;90>=e;e++)ns[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)ns[e+111]=ns[e+63235]="F"+e}();var is,os=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n,c=r.length,d=[],f=0;c>f;++f)d.push(n=e(r.charCodeAt(f)));for(var f=0,h=u;c>f;++f){var n=d[f];"m"==n?d[f]=h:h=n}for(var f=0,p=u;c>f;++f){var n=d[f];"1"==n&&"r"==p?d[f]="n":a.test(n)&&(p=n,"r"==n&&(d[f]="R"))}for(var f=1,h=d[0];c-1>f;++f){var n=d[f];"+"==n&&"1"==h&&"1"==d[f+1]?d[f]="1":","!=n||h!=d[f+1]||"1"!=h&&"n"!=h||(d[f]=h),h=n}for(var f=0;c>f;++f){var n=d[f];if(","==n)d[f]="N";else if("%"==n){for(var m=f+1;c>m&&"%"==d[m];++m);for(var v=f&&"!"==d[f-1]||c>m&&"1"==d[m]?"1":"N",g=f;m>g;++g)d[g]=v;f=m-1}}for(var f=0,p=u;c>f;++f){var n=d[f];"L"==p&&"1"==n?d[f]="L":a.test(n)&&(p=n)}for(var f=0;c>f;++f)if(o.test(d[f])){for(var m=f+1;c>m&&o.test(d[m]);++m);for(var b="L"==(f?d[f-1]:u),y="L"==(c>m?d[m]:u),v=b||y?"L":"R",g=f;m>g;++g)d[g]=v;f=m-1}for(var w,_=[],f=0;c>f;)if(s.test(d[f])){var k=f;for(++f;c>f&&s.test(d[f]);++f);_.push(new t(0,k,f))}else{var x=f,C=_.length;for(++f;c>f&&"L"!=d[f];++f);for(var g=x;f>g;)if(l.test(d[g])){g>x&&_.splice(C,0,new t(1,x,g));var E=g;for(++g;f>g&&l.test(d[g]);++g);_.splice(C,0,new t(2,E,g)),x=g}else++g;f>x&&_.splice(C,0,new t(1,x,f))}return 1==_[0].level&&(w=r.match(/^\s+/))&&(_[0].from=w[0].length,_.unshift(new t(0,0,w[0].length))),1==Mi(_).level&&(w=r.match(/\s+$/))&&(Mi(_).to-=w[0].length,_.push(new t(0,c-w[0].length,c))),2==_[0].level&&_.unshift(new t(1,_[0].to,_[0].to)),_[0].level!=Mi(_).level&&_.push(new t(_[0].level,c,c)),_}}();return e.version="5.8.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function i(e,t,r){return ye=e,we=r,t}function o(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=a(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r);if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if("0"==r&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),i("number","number");if("0"==r&&e.eat(/b/i))return e.eatWhile(/[01]/i),i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=s,s(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),i("regexp","string-2")):(e.eatWhile(Ne),i("operator","operator",e.current()));if("`"==r)return t.tokenize=l,l(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(Ne.test(r))return e.eatWhile(Ne),i("operator","operator",e.current());if(Se.test(r)){e.eatWhile(Se);var o=e.current(),u=Te.propertyIsEnumerable(o)&&Te[o];return u&&"."!=t.lastType?i(u.type,u.style,o):i("variable","variable",o)}}function a(e){return function(t,r){var n,a=!1;if(xe&&"@"==t.peek()&&t.match(Ae))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||a);)a=!a&&"\\"==n;return a||(r.tokenize=o),i("string","string")}}function s(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=o;break}n="*"==r}return i("comment","comment")}function l(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=o;break}n=!n&&"\\"==r}return i("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),s=Oe.indexOf(a);if(s>=0&&3>s){if(!n){++o;break}if(0==--n)break}else if(s>=3&&6>s)++n;else if(Se.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function c(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(Le.state=e,Le.stream=i,Le.marked=null,Le.cc=o,Le.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Ce?k:_;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Le.marked?Le.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Le.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=Le.state;if(Le.marked="def",n.context){if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function v(){Le.state.context={prev:Le.state.context,vars:Le.state.localVars},Le.state.localVars=Pe}function g(){Le.state.localVars=Le.state.context.vars,Le.state.context=Le.state.context.prev}function b(e,t){var r=function(){var r=Le.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new c(n,Le.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function y(){var e=Le.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function w(e){function t(r){return r==e?p():";"==e?h():p(t)}return t}function _(e,t){return"var"==e?p(b("vardef",t.length),G,w(";"),y):"keyword a"==e?p(b("form"),k,_,y):"keyword b"==e?p(b("form"),_,y):"{"==e?p(b("}"),W,y):";"==e?p():"if"==e?("else"==Le.state.lexical.info&&Le.state.cc[Le.state.cc.length-1]==y&&Le.state.cc.pop()(),p(b("form"),k,_,y,J)):"function"==e?p(ie):"for"==e?p(b("form"),Z,_,y):"variable"==e?p(b("stat"),I):"switch"==e?p(b("form"),k,b("}","switch"),w("{"),W,y,y):"case"==e?p(k,w(":")):"default"==e?p(w(":")):"catch"==e?p(b("form"),v,w("("),oe,w(")"),_,y,g):"class"==e?p(b("form"),ae,y):"export"==e?p(b("stat"),ce,y):"import"==e?p(b("stat"),de,y):h(b("stat"),k,w(";"),y)}function k(e){return C(e,!1)}function x(e){return C(e,!0)}function C(e,t){if(Le.state.fatArrowAt==Le.stream.start){var r=t?L:M;if("("==e)return p(v,b(")"),B(Y,")"),y,w("=>"),r,g);if("variable"==e)return h(v,Y,w("=>"),r,g)}var n=t?N:T;return Me.hasOwnProperty(e)?p(n):"async"==e?p(k):"function"==e?p(ie,n):"keyword c"==e?p(t?S:E):"("==e?p(b(")"),E,ge,w(")"),y,n):"operator"==e||"spread"==e?p(t?x:k):"["==e?p(b("]"),me,y,n):"{"==e?z(F,"}",null,n):"quasi"==e?h(A,n):"new"==e?p(P(t)):p()}function E(e){return e.match(/[;\}\)\],]/)?h():h(k)}function S(e){return e.match(/[;\}\)\],]/)?h():h(x)}function T(e,t){return","==e?p(k):N(e,t,!1)}function N(e,t,r){var n=0==r?T:N,i=0==r?k:x;return"=>"==e?p(v,r?L:M,g):"operator"==e?/\+\+|--/.test(t)?p(n):"?"==t?p(k,w(":"),i):p(i):"quasi"==e?h(A,n):";"!=e?"("==e?z(x,")","call",n):"."==e?p(j,n):"["==e?p(b("]"),E,w("]"),y,n):void 0:void 0}function A(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(A):p(k,O)}function O(e){return"}"==e?(Le.marked="string-2",Le.state.tokenize=l,p(A)):void 0}function M(e){return u(Le.stream,Le.state),h("{"==e?_:k)}function L(e){return u(Le.stream,Le.state),h("{"==e?_:x)}function P(e){return function(t){return"."==t?p(e?D:R):h(e?x:k)}}function R(e,t){return"target"==t?(Le.marked="keyword",p(T)):void 0}function D(e,t){return"target"==t?(Le.marked="keyword",p(N)):void 0}function I(e){return":"==e?p(y,_):h(T,w(";"),y)}function j(e){return"variable"==e?(Le.marked="property",p()):void 0}function F(e,t){return"async"==e?p(F):"variable"==e||"keyword"==Le.style?(Le.marked="property",p("get"==t||"set"==t?H:V)):"number"==e||"string"==e?(Le.marked=xe?"property":Le.style+" property",p(V)):"jsonld-keyword"==e?p(V):"["==e?p(k,w("]"),V):void 0}function H(e){return"variable"!=e?h(V):(Le.marked="property",p(ie))}function V(e){return":"==e?p(x):"("==e?h(ie):void 0}function B(e,t){function r(n){if(","==n){var i=Le.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,r)}return n==t?p():p(w(t))}return function(n){return n==t?p():h(e,r)}}function z(e,t,r){for(var n=3;n!?|~^]/,Ae=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Oe="([{}])",Me={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Le={state:null,column:null,marked:null,cc:null},Pe={name:"this",next:{name:"arguments"}};return y.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new c((e||0)-_e,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=s&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==ye?r:(t.lastType="operator"!=ye||"++"!=we&&"--"!=we?ye:"incdec",f(t,r,ye,we,e))},indent:function(t,n){if(t.tokenize==s)return e.Pass;if(t.tokenize!=o)return 0;var i=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var l=t.cc.length-1;l>=0;--l){var u=t.cc[l];if(u==y)a=a.prev;else if(u!=J)break}"stat"==a.type&&"}"==i&&(a=a.prev),ke&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,d=i==c;return"vardef"==c?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==c&&"{"==i?a.indented:"form"==c?a.indented+_e:"stat"==c?a.indented+(be(t,n)?ke||_e:0):"switch"!=a.info||d||0==r.doubleIndentSwitch?a.align?a.column+(d?0:1):a.indented+(d?0:_e):a.indented+(/^(?:case|default)\b/.test(n)?_e:2*_e)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ce?null:"/*",blockCommentEnd:Ce?null:"*/",lineComment:Ce?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ce?"json":"javascript",jsonldMode:xe,jsonMode:Ce}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),define("ember-cli-app-version/components/app-version",["exports","ember","ember-cli-app-version/templates/app-version"],function(e,t,r){"use strict";e["default"]=t["default"].Component.extend({tagName:"span",layout:r["default"]})}),define("ember-cli-app-version/initializer-factory",["exports","ember"],function(e,t){"use strict";function r(e,r){var i=!1;return function(){if(!i&&e&&r){var o=n(e);t["default"].libraries.register(o,r),i=!0}}}e["default"]=r;var n=t["default"].String.classify}),define("ember-cli-app-version/templates/app-version",["exports"],function(e){"use strict";e["default"]=Ember.HTMLBars.template(function(){return{meta:{fragmentReason:{name:"missing-wrapper",problems:["wrong-type"]},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:2,column:0}},moduleName:"modules/ember-cli-app-version/templates/app-version.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),r=e.createComment("");e.appendChild(t,r);var r=e.createTextNode("\n");return e.appendChild(t,r),t},buildRenderNodes:function(e,t,r){var n=new Array(1);return n[0]=e.createMorphAt(t,0,0,r),e.insertBoundary(t,0),n},statements:[["content","version",["loc",[null,[1,0],[1,11]]]]],locals:[],templates:[]}}())}),define("ember-cli-app-version",["ember-cli-app-version/index","ember","exports"],function(e,t,r){"use strict";var n=Object.keys||t["default"].keys,i=Array.prototype.forEach&&function(e,t){e.forEach(t)}||t["default"].EnumerableUtils.forEach;i(n(e),function(t){r[t]=e[t]})}),define("ember-mobiledoc-dom-renderer/components/render-mobiledoc",["exports","ember","ember-mobiledoc-dom-renderer","ember-mobiledoc-dom-renderer/templates/components/render-mobiledoc"],function(e,t,r,n){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return{name:e,type:r.RENDER_TYPE,render:function(e){var t=e.env,r=e.options,n=r[f],i=r[h],o=t.onTeardown,a=n.apply(void 0,arguments),s=a.card,l=a.element;return o(function(){return i(s)}),l}}}var a=t["default"].$,s=t["default"].computed,l=t["default"].assert,u=t["default"].run,c=u.schedule,d=u.join,f="addComponentCard",h="removeComponentCard",p="render-mobiledoc",m="__rendered-mobiledoc",v="__rendered-mobiledoc-card-",g="__rendered-mobiledoc-card";e["default"]=t["default"].Component.extend({layout:n["default"],cardNames:[],_mdcCards:s("cardNames",function(){return this.get("cardNames").map(function(e){return o(e)})}),didInsertElement:function(){var e,t=this;this._super.apply(this,arguments);var n=(e={},i(e,f,function(e){var r=e.env,n=(e.options,e.payload),i=r.name,o=t.generateUuid(),s=a("
").attr("id",o).addClass(g).addClass(g+"-"+i)[0],l=t.cardNameToComponentName(i),u={componentName:l,destinationElementId:o,payload:n};return t.addCard(u),{card:u,element:s}}),i(e,h,function(e){return t.removeCard(e)}),e),o=this.get("_mdcCards"),s=this.get("mobiledoc");l('Must pass mobiledoc to "'+p+'" component',!!s);var u=new r["default"]({cards:o,cardOptions:n}),c=u.render(s),d=c.result,m=c.teardown;this.getRenderElement().appendChild(d),this._teardownRender=m},willDestroyElement:function(){return this._teardownRender&&this._teardownRender(),this._super.apply(this,arguments)},cardNameToComponentName:function(e){return e},_componentCards:s(function(){return t["default"].A()}),addCard:function(e){var t=this;c("afterRender",function(){t.get("_componentCards").pushObject(e)})},removeCard:function(e){var t=this;d(function(){t.get("_componentCards").removeObject(e)})},getRenderElement:function(){return this.$("."+m)[0]},generateUuid:function(){return""+v+t["default"].uuid()}}),e.CARD_ELEMENT_CLASS=g}),define("ember-mobiledoc-dom-renderer/index",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/index"],function(e,t){"use strict";e["default"]=t["default"],e.RENDER_TYPE=t.RENDER_TYPE}),define("ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/cards/image",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/dom","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/render-type"],function(e,t,r){"use strict";e["default"]={name:"image",type:r["default"],render:function(e){var r=e.payload,n=t.createElement("img");return n.src=r.src,n}}}),define("ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/index",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/renderer-factory","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e){e.MobiledocDOMRenderer=t["default"]}e.registerGlobal=n,e["default"]=t["default"],e.RENDER_TYPE=r["default"]}),define("ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/renderer-factory",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/renderer","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(!Array.isArray(e))throw new Error("`cards` must be passed as an array, not an object.");for(var t=0;ta;a+=2){var u=i[a],c=i[a+1];t.setAttribute(o,u,c)}return o}function a(e){if("0.2.0"!==e)throw new Error('Unexpected Mobiledoc version "'+e+'"')}var s=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(l){i=!0,o=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var r=0;ra;a++){for(var u=r[a],c=s(u,3),d=c[0],f=c[1],h=c[2],p=0,m=d.length;m>p;p++){var v=this.markerTypes[d[p]],g=o(v);t.appendChild(i,g),n.push(g),i=g}t.appendChild(i,t.createTextNode(h));for(var p=0,m=f;m>p;p++)n.pop(),i=n[n.length-1]}}},{key:"renderListItem",value:function(e){var r=t.createElement("li");return this.renderMarkersOnElement(r,e),r}},{key:"renderListSection",value:function(e){var r=this,n=s(e,3),i=(n[0],n[1]),o=n[2],a=t.createElement(i);return o.forEach(function(e){t.appendChild(a,r.renderListItem(e))}),a}},{key:"renderImageSection",value:function(e){var r=s(e,2),n=(r[0],r[1]),i=t.createElement("img");return i.src=n,i}},{key:"findCard",value:function(e){for(var t=0;t':void 0}}}),define("ember-mobiledoc-html-renderer/index",["exports","ember-mobiledoc-html-renderer/renderer-factory","ember-mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e){e.MobiledocHTMLRenderer=t["default"]}e.registerGlobal=n,e["default"]=t["default"],e.RENDER_TYPE=r["default"]; -}),define("ember-mobiledoc-html-renderer/renderer-factory",["exports","ember-mobiledoc-html-renderer/renderer","ember-mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(!Array.isArray(e))throw new Error("`cards` must be passed as an array, not an object.");for(var t=0;ta;a+=2){var u=i[a],c=i[a+1];t.setAttribute(o,u,c)}return o}function a(e){if("0.2.0"!==e)throw new Error('Unexpected Mobiledoc version "'+e+'"')}var s=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(l){i=!0,o=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var r=0;ra;a++){for(var u=r[a],c=s(u,3),d=c[0],f=c[1],h=c[2],p=0,m=d.length;m>p;p++){var v=this.markerTypes[d[p]],g=o(v);t.appendChild(i,g),n.push(g),i=g}t.appendChild(i,t.createTextNode(h));for(var p=0,m=f;m>p;p++)n.pop(),i=n[n.length-1]}}},{key:"_defaultUnknownCardHandler",get:function(){return function(e){var t=e.env.name;throw new Error('Card "'+t+'" not found but no unknownCardHandler was registered')}}}]),e}();e["default"]=h}),define("ember-mobiledoc-html-renderer/utils/dom",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){return e.replace(/ /g,"  ")}function n(e){return new c(e)}function i(e,t){e.appendChild(t)}function o(e){return new d(e)}function a(e,t,r){e.setAttribute(t,r)}function s(){return n("div")}e.createElement=n,e.appendChild=i,e.createTextNode=o,e.setAttribute=a,e.createDocumentFragment=s;var l=function(){function e(e,t){for(var r=0;r"}return e}}]),e}(),d=function(){function e(r){t(this,e),this.value=r}return l(e,[{key:"toString",value:function(){return r(this.value)}}]),e}()}),define("ember-mobiledoc-html-renderer/utils/render-type",["exports"],function(e){"use strict";e["default"]="html"}),define("ember-mobiledoc-html-renderer",["ember-mobiledoc-html-renderer/index","ember","exports"],function(e,t,r){"use strict";var n=Object.keys||t["default"].keys,i=Array.prototype.forEach&&function(e,t){e.forEach(t)}||t["default"].EnumerableUtils.forEach;i(n(e),function(t){r[t]=e[t]})}),define("ember-mobiledoc-text-renderer/cards/image",["exports"],function(e){"use strict";e["default"]={name:"image-card",type:"text",render:function(){}}}),define("ember-mobiledoc-text-renderer/index",["exports","ember-mobiledoc-text-renderer/renderer-factory"],function(e,t){"use strict";function r(e){e.MobiledocTextRenderer=t["default"]}e.registerGlobal=r,e["default"]=t["default"]}),define("ember-mobiledoc-text-renderer/renderer-factory",["exports","ember-mobiledoc-text-renderer/renderer"],function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){if(!Array.isArray)throw new Error("`cards` must be an array");for(var t=0;to;o++){var s=r[o];if(".."===s){if(0===i.length)throw new Error("Cannot access parent module of root");i.pop()}else{if("."===s)continue;i.push(s)}}return i.join("/")}var c;c=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var d={},f={},h=!1,p=!0,m=0,v=["require","exports","module"];o.prototype.makeDefaultExport=function(){var e=this.module.exports;null===e||"object"!=typeof e&&"function"!=typeof e||void 0!==e["default"]||(e["default"]=e)},o.prototype.exports=function(e){if(this.finalized)return this.module.exports;var t=this.callback.apply(this,e);return this.hasExportsAsDep&&void 0===t||(this.module.exports=t),this.makeDefaultExport(),this.finalized=!0,this.module.exports},o.prototype.unsee=function(){this.finalized=!1,this.state=void 0,this.module={exports:{}}},o.prototype.reify=function(){for(var e,t=this.deps,r=t.length,n=new Array(r),i=0,o=r;o>i;i++)e=t[i],"exports"===e?(this.hasExportsAsDep=!0,n[i]=this.module.exports):"require"===e?n[i]=this.makeRequire():"module"===e?n[i]=this.module:n[i]=l(u(e,this.name),this.name).module.exports;return n},o.prototype.makeRequire=function(){var e=this.name;return this._require||(this._require=function(t){return r(u(t,e))})},o.prototype.build=function(){this.state!==h&&(this.state=h,this.exports(this.reify()),this.state=p)},e=function(e,t,r){arguments.length<2&&i(arguments.length),c(t)||(r=t,t=[]),d[e]=new o(e,t,r)},e.petal={},e.alias=function(e){return new a(e)},n=r=t=function(e){return l(e,"(require)").module.exports},n.entries=n._eak_seen=d,n.unsee=function(e){l(e,"(unsee)").unsee()},n.clear=function(){n.entries=n._eak_seen=d={},f={}}}(),e("content-kit-utils/array-utils",["exports"],function(e){"use strict";function t(e){for(var t=[],r=e&&e.length>>>0;r--;)t[r]=e[r];return t}function r(e){var t,r=0;for(t in e)e.hasOwnProperty(t)&&(r+=e[t]);return r}e.toArray=t,e.sumSparseArray=r}),e("content-kit-utils",["exports","content-kit-utils/array-utils","content-kit-utils/node-utils","content-kit-utils/object-utils","content-kit-utils/string-utils"],function(e,t,r,n,i){"use strict";e.toArray=t.toArray,e.sumSparseArray=t.sumSparseArray,e.textOfNode=r.textOfNode,e.unwrapNode=r.unwrapNode,e.attributesForNode=r.attributesForNode,e.mergeWithOptions=n.mergeWithOptions,e.merge=n.merge,e.inherit=n.inherit,e.trim=i.trim,e.trimLeft=i.trimLeft,e.underscore=i.underscore,e.sanitizeWhitespace=i.sanitizeWhitespace,e.injectIntoString=i.injectIntoString,e["default"]={}}),e("content-kit-utils/node-utils",["exports","content-kit-utils/string-utils","content-kit-utils/array-utils"],function(e,t,r){"use strict";function n(e){var r=e.textContent||e.innerText;return r?(0,t.sanitizeWhitespace)(r):""}function i(e){if(e.hasChildNodes()){var t,n=(0,r.toArray)(e.childNodes),i=n.length,o=e.parentNode;for(t=0;i>t;t++)o.insertBefore(n[t],e)}}function o(e,t){var r,n,i,o,a=e.attributes,s=a&&a.length;for(r=0;s>r;r++)if(n=a[r],i=n.name,n.specified&&n.value){if(t&&i in t)continue;o=o||{},o[i]=n.value}return o}e.textOfNode=n,e.unwrapNode=i,e.attributesForNode=o}),e("content-kit-utils/object-utils",["exports"],function(e){"use strict";function t(e,t,r){r=r||{};for(var n in t)r.hasOwnProperty(n)?e[n]=r[n]:t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function r(e,r){return t(e,r)}function n(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=new t,e.constructor=e,e._super=t}e.mergeWithOptions=t,e.merge=r,e.inherit=n}),e("content-kit-utils/string-utils",["exports"],function(e){"use strict";function t(e){return e?(e+"").replace(a,""):""}function r(e){return e?(e+"").replace(s,""):""}function n(e){return e?t(e+"").replace(c,"_"):""}function i(e){return e?(e+"").replace(l,"").replace(u," "):""}function o(e,t,r){return e.substr(0,r)+t+e.substr(r)}var a=/^\s+|\s+$/g,s=/^\s+/,l=/(\r\n|\n|\r|\t)/gm,u=/\s+/g,c=/[^a-zA-Z\d]/g;e.trim=t,e.trimLeft=r,e.underscore=n,e.sanitizeWhitespace=i,e.injectIntoString=o}),e("mobiledoc-html-renderer/cards/image",["exports","mobiledoc-html-renderer/utils/render-type"],function(e,t){"use strict";e["default"]={name:"image-card",type:t["default"],render:function(e){var t=(e.env,e.options,e.payload);return t.src?'':void 0}}}),e("mobiledoc-html-renderer",["exports","mobiledoc-html-renderer/renderer-factory","mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e){e.MobiledocHTMLRenderer=t["default"]}e.registerGlobal=n,e.RENDER_TYPE=r["default"],e["default"]=t["default"]}),e("mobiledoc-html-renderer/renderer-factory",["exports","mobiledoc-html-renderer/renderer","mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(!Array.isArray(e))throw new Error("`cards` must be passed as an array, not an object.");for(var t=0;ta;a+=2){var u=i[a],c=i[a+1];(0,t.setAttribute)(o,u,c)}return o}function a(e){if("0.2.0"!==e)throw new Error('Unexpected Mobiledoc version "'+e+'"')}var s=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(l){i=!0,o=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var r=0;ra;a++){for(var u=r[a],c=s(u,3),d=c[0],f=c[1],h=c[2],p=0,m=d.length;m>p;p++){var v=this.markerTypes[d[p]],g=o(v);(0,t.appendChild)(i,g),n.push(g),i=g}(0,t.appendChild)(i,(0,t.createTextNode)(h));for(var p=0,m=f;m>p;p++)n.pop(),i=n[n.length-1]}}},{key:"_defaultUnknownCardHandler",get:function(){return function(e){var t=e.env.name;throw new Error('Card "'+t+'" not found but no unknownCardHandler was registered')}}}]),e}();e["default"]=h}),e("mobiledoc-html-renderer/utils/dom",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){return e.replace(/ /g,"  ")}function n(e){return new c(e)}function i(e,t){e.appendChild(t)}function o(e){return new d(e)}function a(e,t,r){e.setAttribute(t,r)}function s(){return n("div")}var l=function(){function e(e,t){for(var r=0;r"}return e}}]),e}(),d=function(){function e(r){t(this,e),this.value=r}return l(e,[{key:"toString",value:function(){return r(this.value)}}]),e}()}),e("mobiledoc-html-renderer/utils/render-type",["exports"],function(e){"use strict";e["default"]="html"}),e("mobiledoc-kit/cards/image",["exports","mobiledoc-kit/utils/placeholder-image-src"],function(e,t){"use strict";e["default"]={name:"image",type:"dom",render:function(e){var r=(e.env,e.options,e.payload),n=document.createElement("img");return n.src=r.src||t["default"],n}}}),e("mobiledoc-kit/editor/editor",["exports","mobiledoc-kit/views/tooltip","mobiledoc-kit/editor/post","mobiledoc-kit/cards/image","mobiledoc-kit/utils/key","mobiledoc-kit/utils/event-emitter","mobiledoc-kit/parsers/mobiledoc","mobiledoc-kit/parsers/html","mobiledoc-kit/parsers/dom","mobiledoc-kit/renderers/editor-dom","mobiledoc-kit/models/render-tree","mobiledoc-kit/renderers/mobiledoc","content-kit-utils","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/array-utils","mobiledoc-kit/utils/element-utils","mobiledoc-kit/utils/mixin","mobiledoc-kit/utils/event-listener","mobiledoc-kit/utils/cursor","mobiledoc-kit/utils/cursor/range","mobiledoc-kit/models/post-node-builder","mobiledoc-kit/editor/text-expansions","mobiledoc-kit/editor/key-commands","mobiledoc-kit/utils/string-utils","mobiledoc-kit/utils/lifecycle-callbacks","mobiledoc-kit/models/card","mobiledoc-kit/utils/paste-utils","mobiledoc-kit/utils/characters"],function(e,t,r,n,i,o,a,s,l,u,c,d,f,h,p,m,v,g,b,y,w,_,k,x,C,E,S,T){"use strict";function N(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var A=function(){function e(e,t){for(var r=0;ri;i++)n[i]=arguments[i];return e.handleEvent.apply(e,[t].concat(n))})}),L.forEach(function(t){e.addEventListener(document,t,function(){for(var r=arguments.length,n=Array(r),i=0;r>i;i++)n[i]=arguments[i];return e.handleEvent.apply(e,[t].concat(n))})})}},{key:"handleEvent",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];if((0,p.contains)(M,e)){var i=r[0].target;if(!this.cursor.isAddressable(i))return!0}var o="handle"+(0,x.capitalize)(e);if(!this[o])throw new Error("No handler for "+e);this[o].apply(this,r)}},{key:"handleMouseup",value:function(){var e=this;setTimeout(function(){return e._reportSelectionState()},0)}},{key:"handleKeyup",value:function(){this._reportSelectionState()}},{key:"_reportSelectionState",value:function(){this.runCallbacks(R.CURSOR_DID_CHANGE)}},{key:"_insertEmptyMarkupSectionAtCursor",value:function(){var e=this;this.run(function(t){var r=t.builder.createMarkupSection("p");t.insertSectionBefore(e.post.sections,r),t.setRange(y["default"].fromSection(r))})}},{key:"handleKeydown",value:function(e){if(this.isEditable&&!this.handleKeyCommand(e)){this.post.isBlank&&this._insertEmptyMarkupSectionAtCursor();var t=i["default"].fromEvent(e),r=void 0,n=void 0;switch(!0){case t.isHorizontalArrow():r=this.cursor.offsets;var o=r.tail;if(r.direction===i.DIRECTION.BACKWARD&&(o=r.head),o.section.isCardSection&&(n=o.move(t.direction))){var a=void 0;a=t.isShift()?r.moveFocusedPosition(t.direction):new y["default"](n),this.selectRange(a),e.preventDefault()}break;case t.isDelete():this.handleDeletion(e),e.preventDefault();break;case t.isEnter():this.handleNewline(e);break;case t.isPrintable():var r=this.cursor.offsets,s=r,l=s.isCollapsed,n=r.head;this.run(function(e){l||(n=e.deleteRange(r)),t.isTab()&&!r.head.section.isCardSection&&(n=e.insertText(n,T.TAB)),n&&n!==r.head&&e.setRange(new y["default"](n))}),(l&&r.head.section.isCardSection||t.isTab())&&e.preventDefault()}this._lastKeydownEvent=e,this.addCallbackOnce(R.DID_REPARSE,this._handleLastKeydownExpansion)}}},{key:"handleKeyCommand",value:function(e){for(var t=(0,k.findKeyCommands)(this.keyCommands,e),r=0;r=r){var l=r-o,u=this.splitMarker(a,l),c=u.afterMarker;o+=l,s=o,a=c;break}o+=a.length,a=a.next,a&&(s+=a.length)}for(;a;){if(s+=a.length,s>=n){var l=a.length-(s-n),d=this.splitMarker(a,l),f=d.beforeMarker;f&&this.removeMarker(f);break}o+=a.length;var h=a.next;this.removeMarker(a),a=h}return new t["default"](e,r)}},{key:"_coalesceMarkers",value:function(e){e.isMarkerable&&(this._removeEmptyMarkers(e),this._joinSimilarMarkers(e))}},{key:"_removeEmptyMarkers",value:function(e){var t=this;(0,r.forEach)((0,r.filter)(e.markers,function(e){return e.isEmpty}),function(e){return t.removeMarker(e)})}},{key:"_joinSimilarMarkers",value:function(e){for(var t=e.markers.head,n=void 0;t&&t.next;)n=t.next,(0,r.isArrayEqual)(t.markups,n.markups)&&(n.value=t.value+n.value,this._markDirty(n),this.removeMarker(t)),t=n}},{key:"removeMarker",value:function(e){this._scheduleForRemoval(e),e.section&&(this._markDirty(e.section),e.section.markers.remove(e))}},{key:"_scheduleForRemoval",value:function(e){var t=this;e.renderNode&&(e.renderNode.scheduleForRemoval(),this.scheduleRerender(),this.scheduleDidUpdate());var r=e.prev&&e.prev.isListSection||e.next&&e.next.isListSection;r&&this.addCallback(h.BEFORE_COMPLETE,function(){return t._joinContiguousListSections()})}},{key:"_joinContiguousListSections",value:function(){var e=this,t=this.editor,n=t.post,i=t.range,o=void 0,a=[],s=void 0,u=null;(0,r.forEach)(n.sections,function(e){o&&o.isListSection&&e.isListSection&&o.tagName===e.tagName?(s=s||[o],s.push(e)):(s&&a.push(s),s=null),o=e}),s&&a.push(s),(0,r.forEach)(a,function(t){var n=t[0];(0,r.forEach)(t,function(t){if(t!==n){var r=i.head,o=void 0;r.section.isListItem&&r.section.parent===t&&(o=n.tailPosition()),e._joinListSections(n,t),o&&(u=o.moveRight())}})}),u&&this.setRange(new l["default"](u,u,i.direction))}},{key:"_joinListSections",value:function(e,t){e.join(t),this._markDirty(e),this.removeSection(t)}},{key:"_markDirty",value:function(e){var t=this;e.renderNode&&(e.renderNode.markDirty(),this.scheduleRerender(),this.scheduleDidUpdate()),e.section&&this._markDirty(e.section),e.isMarkerable&&this.addCallback(h.BEFORE_COMPLETE,function(){return t._coalesceMarkers(e)})}},{key:"deleteFrom",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?n.DIRECTION.BACKWARD:arguments[1]; +return t===n.DIRECTION.BACKWARD?this._deleteBackwardFrom(e):this._deleteForwardFrom(e)}},{key:"_joinPositionToPreviousSection",value:function(e){var t=e.section,r=e.clone();if((0,a["default"])("Cannot join non-markerable section to previous section",t.isMarkerable),t.isListItem){var n=this._changeSectionFromListItem(t,"p");r=n.headPosition()}else{var i=t.previousLeafSection();if(i)if(i.isCardSection)t.isBlank&&this.removeSection(t),r=i.tailPosition();else{var o=i.join(t),s=o.beforeMarker;this._markDirty(i),this.removeSection(t),r.section=i,r.offset=s?i.offsetOfMarker(s,s.length):0}}return r}},{key:"_deleteForwardFrom",value:function(e){var t=e.section,r=e.offset;if(t.isBlank){var n=e.clone(),i=t.immediatelyNextMarkerableSection();return i&&(this.removeSection(t),n.section=i,n.offset=0),n}if(r===t.length)return t.isCardSection?(t.next&&t.next.isBlank&&this.removeSection(t.next),e):this._joinPositionToNextSection(e);if(!t.isCardSection)return this._deleteForwardFromMarkerPosition(e.markerPosition);if(0===r){var o=this.builder.createMarkupSection();return this.replaceSection(t,o),o.headPosition()}}},{key:"_joinPositionToNextSection",value:function(e){var t=e.section,r=e.clone();if(!t.isMarkerable)throw new Error("Cannot join non-markerable section to next section");var n=t.immediatelyNextMarkerableSection();return n&&(t.join(n),this._markDirty(t),this.removeSection(n)),r}},{key:"_deleteForwardFromMarkerPosition",value:function(e){var r=e.marker,n=e.offset,i=r.section,o=new t["default"](i,i.offsetOfMarker(r,n));if(n===r.length){var a=r.next;if(a){var s={marker:a,offset:0};return this._deleteForwardFromMarkerPosition(s)}var l=r.section.next;if(l&&l.isMarkupSection){var u=r.section;u.join(l),this._markDirty(u),this.removeSection(l)}}else r.deleteValueAtOffset(n),this._markDirty(r);return o}},{key:"_deleteBackwardFrom",value:function(e){var t=e.section,r=e.offset;if(0===r)return t.isCardSection?(t.prev&&t.prev.isBlank&&this.removeSection(t.prev),e):this._joinPositionToPreviousSection(e);var n=e.clone();if(t.isCardSection){var i=this.builder.createMarkupSection();return this.replaceSection(t,i),i.headPosition()}var o=e.markerPosition,a=o.marker,s=o.offset,l=s-1;return a.deleteValueAtOffset(l),n.offset-=1,this._markDirty(a),n}},{key:"splitMarkers",value:function(e){var t=this.editor.post,r=e.head,n=e.tail;return this.splitSectionMarkerAtOffset(r.section,r.offset),this.splitSectionMarkerAtOffset(n.section,n.offset),t.markersContainedByRange(e)}},{key:"splitSectionMarkerAtOffset",value:function(e,t){var r=this,n=e.splitMarkerAtOffset(t);n.removed.forEach(function(e){return r.removeMarker(e)})}},{key:"splitMarker",value:function(e,t){var r=void 0,n=void 0;if(0===t)r=e.prev,n=e;else if(t===e.length)r=e,n=e.next;else{var i=this.editor.builder,o=e.section;r=i.createMarker(e.value.substring(0,t),e.markups),n=i.createMarker(e.value.substring(t,e.length),e.markups),o.markers.splice(e,1,[r,n]),this.removeMarker(e),this._markDirty(o)}return{beforeMarker:r,afterMarker:n}}},{key:"splitSection",value:function(e){var t=this,r=e.section;if(r.isCardSection)return this._splitCardSection(r,e);if(r.isListItem){var n=r.splitAtPosition(e),i=d(n,2),o=i[0],a=i[1];this._coalesceMarkers(o),this._coalesceMarkers(a);var s=[o,a],l=[o,a];if(o.isBlank&&r.isBlank){var u=r===r.parent.items.tail;u&&l.shift()}return this._replaceSection(r,l),s}var c=r.splitAtPosition(e);return c.forEach(function(e){return t._coalesceMarkers(e)}),this._replaceSection(r,c),c}},{key:"_splitCardSection",value:function(e,t){var r=t.offset;(0,a["default"])("Cards section must be split at offset 0 or 1",0===r||1===r);var n=this.builder.createMarkupSection(),i=void 0,o=void 0;0===r?(i=e,o=[n,e]):(i=e.next,o=[e,n]);var s=this.editor.post.sections;return this.insertSectionBefore(s,n,i),o}},{key:"replaceSection",value:function(e,t){e?this._replaceSection(e,[t]):this.insertSectionBefore(this.editor.post.sections,t,null)}},{key:"moveSectionBefore",value:function(e,t,r){var n=t.clone();return this.removeSection(t),this.insertSectionBefore(e,n,r),n}},{key:"moveSectionUp",value:function(e){var t=!e.prev;if(t)return e;var r=e.parent.sections,n=e.prev;return this.moveSectionBefore(r,e,n)}},{key:"moveSectionDown",value:function(e){var t=!e.next;if(t)return e;var r=e.next.next,n=e.parent.sections;return this.moveSectionBefore(n,e,r)}},{key:"insertText",value:function(e,r){var n=e.section;if(n.isMarkerable){var i=e.markerPosition,o=i.marker,a=i.offset,s=e;if(o){if(o){var l=o.value.slice(0,a),u=o.value.slice(a,o.length);o.value=""+l+r+u,this._markDirty(o),s=e.moveRight()}}else o=this.builder.createMarker(r),n.markers.append(o),this._markDirty(n),s=new t["default"](n,1);return s}}},{key:"_replaceSection",value:function(e,t){var r=this,n=e.next,i=e.parent.sections,o=t[0];o.isMarkupSection&&e.isListItem&&(i=e.parent.parent.sections,n=e.parent.next),t.forEach(function(e){return r.insertSectionBefore(i,e,n)}),this.removeSection(e)}},{key:"addMarkupToRange",value:function(e,t){var r=this;e.isCollapsed||this.splitMarkers(e).forEach(function(e){e.addMarkup(t),r._markDirty(e)})}},{key:"removeMarkupFromRange",value:function(e,t){var r=this;e.isCollapsed||this.splitMarkers(e).forEach(function(e){e.removeMarkup(t),r._markDirty(e)})}},{key:"toggleMarkup",value:function(e){var t=this,r=this.editor.cursor.offsets;if(!r.isCollapsed){var n="string"==typeof e?this.builder.createMarkup(e):e,i=this.editor.detectMarkupInRange(r,n.tagName);i?this.removeMarkupFromRange(r,i):this.addMarkupToRange(r,n),this.scheduleAfterRender(function(){return t.editor.selectRange(r)})}}},{key:"toggleSection",value:function(e){var t=this,r=arguments.length<=1||void 0===arguments[1]?this.editor.range:arguments[1];e=(0,s.normalizeTagName)(e);var n=this.editor.post,i=!0;n.walkMarkerableSections(r,function(r){t._isSameSectionType(r,e)||(i=!1)});var o=i?"p":e,a=void 0;n.walkMarkerableSections(r,function(e){var r=t.changeSectionTagName(e,o);a=a||r}),a&&this.setRange(new l["default"](a.headPosition()))}},{key:"_isSameSectionType",value:function(e,t){return e.isListItem?e.parent.tagName===t:e.tagName===t}},{key:"changeSectionTagName",value:function(e,t){return c(t)?this._changeSectionToListItem(e,t):e.isListItem?this._changeSectionFromListItem(e,t):(e.tagName=t,this._markDirty(e),e)}},{key:"_splitListAtItem",value:function(e,t){var r=this,n=e,i=this.builder.createListSection(n.tagName),o=this.builder.createListSection(n.tagName),s=!0,l=n.items.toArray();l.forEach(function(e){var n=void 0;if(e===t)s=!1,n=o;else{if(!s)return;n=i}n.join(e),r.removeSection(e)});var u=!s;(0,a["default"])("Cannot split list at item that is not present in the list",u);var c=this.editor.post.sections;return this.insertSectionBefore(c,o,n),this.insertSectionBefore(c,i,o),this.addCallback(h.BEFORE_COMPLETE,function(){[i,n].forEach(function(e){var t=!!e.parent;e.isBlank&&t&&r.removeSection(e)})}),[i,o,n]}},{key:"_changeSectionFromListItem",value:function(e,t){(0,a["default"])("Must pass list item to `_changeSectionFromListItem`",e.isListItem);var r=this.builder,n=e.parent,i=r.createMarkupSection(t);i.join(e);var o=this._splitListAtItem(n,e),s=d(o,3),l=(s[0],s[1]);s[2];return this.replaceSection(l,i),i}},{key:"_changeSectionToListItem",value:function(e,t){var r=e.isListItem&&e.parent.tagName===t;if(r)return e;var n=this.builder.createListSection(t);n.join(e);var i=void 0;if(e.isListItem){var o=this._splitListAtItem(e.parent,e),a=d(o,3),s=(a[0],a[1]);a[2];i=s}else i=e;return this.replaceSection(i,n),n}},{key:"insertSectionBefore",value:function(e,t,r){e.insertBefore(t,r),this._markDirty(t.parent)}},{key:"insertSection",value:function(e){var t=this.editor.activeSection,r=t&&t.next,n=this.editor.post.sections;this.insertSectionBefore(n,e,r)}},{key:"insertSectionAtEnd",value:function(e){this.insertSectionBefore(this.editor.post.sections,e,null)}},{key:"insertPost",value:function(e,t){var r=this;if(t.isBlank)return e;var n=this.editor.post,i=this.splitSection(e),o=d(i,2),a=o[0],s=o[1],l=e.clone();return t.sections.forEach(function(e,t){0===t&&a.canJoin(e)?(a.join(e),r._markDirty(a),l=a.tailPosition()):(e=e.clone(),r.insertSectionBefore(n.sections,e,s),l=e.tailPosition())}),s.isBlank&&this.removeSection(s),a.canJoin(s)&&a.next===s?(l=a.tailPosition(),a.join(s),this._markDirty(a),this.removeSection(s)):a.isBlank&&this.removeSection(a),l}},{key:"removeSection",value:function(e){var t=e.parent;this._scheduleForRemoval(e),t.sections.remove(e),t.isListSection&&this._scheduleListRemovalIfEmpty(t)}},{key:"_scheduleListRemovalIfEmpty",value:function(e){var t=this;this.addCallback(h.BEFORE_COMPLETE,function(){var r=!!e.parent;r&&e.isBlank&&t.removeSection(e)})}},{key:"schedule",value:function(e){(0,a["default"])("Work can only be scheduled before a post edit has completed",!this._didComplete),this.addCallback(h.COMPLETE,e)}},{key:"scheduleRerender",value:function(){var e=this;this._didScheduleRerender||(this.schedule(function(){return e.editor.rerender()}),this._didScheduleRerender=!0)}},{key:"scheduleDidUpdate",value:function(){var e=this;this._didScheduleUpdate||(this.schedule(function(){return e.editor.didUpdate()}),this._didScheduleUpdate=!0)}},{key:"scheduleAfterRender",value:function(e){this.addCallback(h.AFTER_COMPLETE,e)}},{key:"complete",value:function(){if(this._didComplete)throw new Error("Post editing can only be completed once");this.runCallbacks(h.BEFORE_COMPLETE),this._didComplete=!0,this.runCallbacks(h.COMPLETE),this.runCallbacks(h.AFTER_COMPLETE),this.editor.range=null}}]),e}();(0,o["default"])(p,i["default"]),e["default"]=p}),e("mobiledoc-kit/editor/text-expansions",["exports","mobiledoc-kit/utils/keycodes","mobiledoc-kit/utils/key","mobiledoc-kit/utils/array-utils","mobiledoc-kit/models/types","mobiledoc-kit/utils/cursor/range"],function(e,t,r,n,i,o){"use strict";function a(e,t){var r=e.cursor.offsets.head.section;e.run(function(e){var n=e.builder,i=n.createListItem(),a=n.createListSection(t,[i]);e.replaceSection(r,a),e.setRange(o["default"].fromSection(i))})}function s(e,t){var r=e.cursor.offsets.head.section;e.run(function(e){var n=e.builder,i=n.createMarkupSection(t);e.replaceSection(r,i),e.setRange(o["default"].fromSection(i))})}function l(e){return!!e.trigger&&!!e.text&&!!e.run}function u(e,t,o){var a=r["default"].fromEvent(t);if(a.isPrintable()){var s=o.cursor.offsets.head,l=s.section,u=s.offset;if(l.type===i.MARKUP_SECTION_TYPE){var c=l.textUntil(u);return(0,n.detect)(e,function(e){var t=e.trigger,r=e.text;return a.keyCode===t&&c===r+String.fromCharCode(t)})}}}e.validateExpansion=l,e.findExpansion=u;var c=t["default"].SPACE,d=[{trigger:c,text:"*",run:function(e){a(e,"ul")}},{trigger:c,text:"1",run:function(e){a(e,"ol")}},{trigger:c,text:"1.",run:function(e){a(e,"ol")}},{trigger:c,text:"##",run:function(e){s(e,"h2")}},{trigger:c,text:"###",run:function(e){s(e,"h3")}}];e.DEFAULT_TEXT_EXPANSIONS=d}),e("mobiledoc-kit",["exports","mobiledoc-kit/editor/editor","mobiledoc-kit/cards/image"],function(e,t,r){"use strict";function n(e){e.Mobiledoc=i}e.registerGlobal=n;var i={Editor:t["default"],ImageCard:r["default"]};e.Editor=t["default"],e["default"]=i}),e("mobiledoc-kit/models/_markerable",["exports","mobiledoc-kit/utils/array-utils","mobiledoc-kit/utils/set","mobiledoc-kit/utils/linked-list","mobiledoc-kit/models/_section","mobiledoc-kit/utils/cursor/position"],function(e,t,r,n,i,o){"use strict";function a(e){return Array.isArray(e)?e:Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var r=0;ri&&o>a){var u=Math.max(i-a,0),c=l.length-Math.max(s-o,0),d=0===u&&c===l.length;t(l,{markerHead:u,markerTail:c,isContained:d})}if(a+=l.length,l=l.next,a>o)break}}},{key:"join",value:function(e){var t=this,r=this.markers.tail,n=null;return e.markers.forEach(function(e){e.isEmpty||(e=e.clone(),t.markers.append(e),n||(n=e))}),{beforeMarker:r,afterMarker:n}}},{key:"isBlank",get:function(){return this.markers.length?this.markers.every(function(e){return e.isBlank}):!0}},{key:"text",get:function(){return(0,t.reduce)(this.markers,function(e,t){return e+t.value},"")}},{key:"length",get:function(){return this.text.length}}]),i}(i["default"]);e["default"]=d}),e("mobiledoc-kit/models/_section",["exports","mobiledoc-kit/models/types","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/linked-item","mobiledoc-kit/utils/assert"],function(e,t,r,n,i){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.type===t.LIST_ITEM_TYPE}function l(e,t){throw new Error("`"+e+"()` must be implemented by "+t.constructor.name)}var u=function(){function e(e,t){for(var r=0;re||e>this.length)throw new Error('Invalid offset "'+e+'"');var t=this.value.slice(0,e),r=this.value.slice(e+1);this.value=t+r}},{key:"hasMarkup",value:function(e){return!!this.getMarkup(e)}},{key:"getMarkup",value:function(e){var t=this;if("string"==typeof e){var i=function(){var i=(0,r.normalizeTagName)(e);return{v:(0,n.detect)(t.markups,function(e){return e.tagName===i})}}();if("object"==typeof i)return i.v}else{var o=function(){var r=e;return{v:(0,n.detect)(t.markups,function(e){return e===r})}}();if("object"==typeof o)return o.v}}},{key:"join",value:function(e){var t=this.builder.createMarker(this.value+e.value);return this.markups.forEach(function(e){return t.addMarkup(e)}),e.markups.forEach(function(e){return t.addMarkup(e)}),t}},{key:"split",value:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=arguments.length<=1||void 0===arguments[1]?this.length:arguments[1],r=[];return r=[this.builder.createMarker(this.value.substring(0,e)),this.builder.createMarker(this.value.substring(e,t)),this.builder.createMarker(this.value.substring(t))], +this.markups.forEach(function(e){return r.forEach(function(t){return t.addMarkup(e)})}),r}},{key:"isEmpty",get:function(){return 0===this.length}},{key:"isBlank",get:function(){return 0===this.value.length}},{key:"length",get:function(){return this.value.length}},{key:"openedMarkups",get:function(){var e=0;return this.prev&&(e=(0,n.commonItemLength)(this.markups,this.prev.markups)),this.markups.slice(e)}},{key:"closedMarkups",get:function(){var e=0;return this.next&&(e=(0,n.commonItemLength)(this.markups,this.next.markups)),this.markups.slice(e)}}]),i}(i["default"]);e["default"]=u}),e("mobiledoc-kit/models/markup-section",["exports","mobiledoc-kit/models/_markerable","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/array-utils","mobiledoc-kit/models/types"],function(e,t,r,n,i){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var r=0;r=0;l--){a=s[l];var u=d(document,a);u.appendChild(o),o=u}if(r){var c=r.element,p=h(c,t);t.insertBefore(o,p.nextSibling)}else t.insertBefore(o,t.firstChild);return i}function _(e,t){var r=e.element,n=!!t;if(n){var i=e.parent.element;i.replaceChild(r,t)}else{var i=void 0,o=void 0;if(e.prev){var a=e.prev.element;i=a.parentNode,o=a.nextSibling}else i=e.parent.element,o=i.firstChild;i.insertBefore(r,o)}}function k(e,t){var r=e.parent.postNode;r.sections.remove(t)}function x(e){e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element)}function C(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];return(0,r.forEach)(e,function(e){(0,s["default"])('Card "'+e.name+'" must define type "dom", has: "'+e.type+'"',"dom"===e.type),(0,s["default"])('Card "'+e.name+'" must define `render` method',!!e.render)}),e}function E(e){for(var t=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],r=e.childNodes.head,n=void 0,i=void 0;r;){if(n=r.next,r.isRemoved||t){if(E(r,!0),i=r.postNode.type,!R[i])throw new Error('editor-dom cannot destroy "'+i+'"');R[i](r,r.postNode),e.childNodes.remove(r)}r=n}}function S(e,t,r,n){if(r.renderNode)return r.renderNode;var i=e.buildRenderNode(r);return t.childNodes.insertAfter(i,n),i}var T,N=function(){function e(e,t){for(var r=0;ri;i++)n[i]=arguments[i];return t.visit.apply(t,[e].concat(n))}),r.markClean(),r=this.nodes.shift()}}}]),e}();e["default"]=D}),e("mobiledoc-kit/renderers/mobiledoc/0-2",["exports","mobiledoc-kit/utils/compiler","mobiledoc-kit/utils/array-utils","mobiledoc-kit/models/types"],function(e,t,r,n){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o,a="0.2.0";e.MOBILEDOC_VERSION=a;var s=1;e.MOBILEDOC_MARKUP_SECTION_TYPE=s;var l=2;e.MOBILEDOC_IMAGE_SECTION_TYPE=l;var u=3;e.MOBILEDOC_LIST_SECTION_TYPE=u;var c=10;e.MOBILEDOC_CARD_SECTION_TYPE=c;var d=(o={},i(o,n.POST_TYPE,function(e,r){r.push(["openPost"]),(0,t.visitArray)(d,e.sections,r)}),i(o,n.MARKUP_SECTION_TYPE,function(e,r){r.push(["openMarkupSection",e.tagName]),(0,t.visitArray)(d,e.markers,r)}),i(o,n.LIST_SECTION_TYPE,function(e,r){r.push(["openListSection",e.tagName]),(0,t.visitArray)(d,e.items,r)}),i(o,n.LIST_ITEM_TYPE,function(e,r){r.push(["openListItem"]),(0,t.visitArray)(d,e.markers,r)}),i(o,n.IMAGE_SECTION_TYPE,function(e,t){t.push(["openImageSection",e.src])}),i(o,n.CARD_TYPE,function(e,t){t.push(["openCardSection",e.name,e.payload])}),i(o,n.MARKER_TYPE,function(e,r){r.push(["openMarker",e.closedMarkups.length,e.value]),(0,t.visitArray)(d,e.openedMarkups,r)}),i(o,n.MARKUP_TYPE,function(e,t){t.push(["openMarkup",e.tagName,(0,r.objectToSortedKVArray)(e.attributes)])}),o),f={openMarker:function(e,t){this.markupMarkerIds=[],this.markers.push([this.markupMarkerIds,e,t||""])},openMarkupSection:function(e){this.markers=[],this.sections.push([s,e,this.markers])},openListSection:function(e){this.items=[],this.sections.push([u,e,this.items])},openListItem:function(){this.markers=[],this.items.push(this.markers)},openImageSection:function(e){this.sections.push([l,e])},openCardSection:function(e,t){this.sections.push([c,e,t])},openPost:function(){this.markerTypes=[],this.sections=[],this.result={version:a,sections:[this.markerTypes,this.sections]}},openMarkup:function(e,t){var r=this._findOrAddMarkerTypeIndex(e,t);this.markupMarkerIds.push(r)},_findOrAddMarkerTypeIndex:function(e,t){this._markerTypeCache||(this._markerTypeCache={});var r=e+"-"+t.join("-"),n=this._markerTypeCache[r];if(void 0===n){var i=[e];t.length&&i.push(t),this.markerTypes.push(i),n=this.markerTypes.length-1,this._markerTypeCache[r]=n}return n}};e["default"]={render:function(e){var r=[];(0,t.visit)(d,e,r);var n=Object.create(f);return(0,t.compile)(n,r),n.result}}}),e("mobiledoc-kit/renderers/mobiledoc",["exports","mobiledoc-kit/renderers/mobiledoc/0-2"],function(e,t){"use strict";e.MOBILEDOC_VERSION=t.MOBILEDOC_VERSION,e["default"]={render:function(e,r){switch(r){case t.MOBILEDOC_VERSION:case void 0:case null:return t["default"].render(e);default:throw new Error("Unknown version of mobiledoc renderer requested: "+r)}}}}),e("mobiledoc-kit/utils/array-utils",["exports"],function(e){"use strict";function t(e,t){if(e.detect)return e.detect(t);for(var r=0;ri;i++)if(e[i]!==t[i])return!1;return!0}function h(e){var t=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],r={};return o(a(Object.keys(e),function(e){return-1!==t.indexOf(e)}),function(t){return r[t]=e[t]}),r}function p(e,t){return-1!==e.indexOf(t)}e.detect=t,e.forEach=o,e.any=r,e.every=n,e.filter=a,e.commonItemLength=s,e.compact=l,e.reduce=u,e.objectToSortedKVArray=d,e.kvArrayToObject=c,e.isArrayEqual=f,e.toArray=i,e.filterObject=h,e.contains=p}),e("mobiledoc-kit/utils/assert",["exports"],function(e){"use strict";e["default"]=function(e,t){if(!t)throw new Error(e)}}),e("mobiledoc-kit/utils/characters",["exports"],function(e){"use strict";var t=" ";e.TAB=t;var r="\n";e.ENTER=r}),e("mobiledoc-kit/utils/compiler",["exports","mobiledoc-kit/utils/array-utils"],function(e,t){"use strict";function r(e){return Array.isArray(e)?e:Array.from(e)}function n(e,t,r){var n=t.type;if(!e[n])throw new Error("Cannot visit unknown type "+n);e[n](t,r)}function i(e,t){for(var n=0,i=t.length;i>n;n++){var o=r(t[n]),a=o[0],s=o.slice(1),l=s.length;0===l?e[a].call(e):1===l?e[a].call(e,s[0]):2===l?e[a].call(e,s[0],s[1]):e[a].apply(e,s)}}function o(e,r,i){r&&0!==r.length&&(0,t.forEach)(r,function(t){n(e,t,i)})}e.visit=n,e.compile=i,e.visitArray=o}),e("mobiledoc-kit/utils/copy",["exports"],function(e){"use strict";function t(e){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t}e.shallowCopyObject=t}),e("mobiledoc-kit/utils/cursor/position",["exports","mobiledoc-kit/utils/dom-utils","mobiledoc-kit/utils/key","mobiledoc-kit/utils/assert"],function(e,t,r,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return e&&e.type?e.isMarkerable||e.isCardSection:!1}function a(e,t){var r=e.findRenderNodeFromElement(t,function(e){return o(e.postNode)});return r&&r.postNode}function s(e,r,n){if(!e.isCardSection)return(0,t.findOffsetInElement)(e.renderNode.element,r,n);var i=e.renderNode.element,o=i.lastChild;return r===o?1:0}var l=function(){function e(e,t){for(var r=0;r0?new e(this.section,this.offset-1):this.section.prev?new e(this.section.prev,this.section.prev.length):null}},{key:"moveRight",value:function(){return this.offseti?0:1:0;return new e(o,s)}}]),e}();e["default"]=u}),e("mobiledoc-kit/utils/cursor/range",["exports","mobiledoc-kit/utils/cursor/position","mobiledoc-kit/utils/key"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;rr;r++)n[e][r].apply(this,Array.prototype.slice.call(arguments,1))}};e["default"]=t}),e("mobiledoc-kit/utils/event-listener",["exports","mobiledoc-kit/utils/array-utils"],function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t=t["default"][0]&&e<=t["default"][9]||this.isSpace()||this.isTab()||this.isEnter()||e>=t["default"].A&&e<=t["default"].Z||e>=t["default"].NUMPAD_0&&e<=t["default"].NUMPAD_9||e>=t["default"][";"]&&e<=t["default"]["`"]||e>=t["default"]["["]&&e<=t["default"]['"']||e===t["default"].IME}},{key:"direction",get:function(){switch(!0){case this.isDelete():return this.isForwardDelete()?s.FORWARD:s.BACKWARD;case this.isHorizontalArrow():return this.isRightArrow()?s.FORWARD:s.BACKWARD}}},{key:"ctrlKey",get:function(){return l.CTRL&this.modifierMask}},{key:"metaKey",get:function(){return l.META&this.modifierMask}},{key:"shiftKey",get:function(){return l.SHIFT&this.modifierMask}},{key:"altKey",get:function(){return l.ALT&this.modifierMask}}],[{key:"fromEvent",value:function(t){return(0,r["default"])("Must pass a Key event to Key.fromEvent",t&&o(t)),new e(t)}}]),e}();e["default"]=c}),e("mobiledoc-kit/utils/keycodes",["exports"],function(e){"use strict";e["default"]={BACKSPACE:8,SPACE:32,ENTER:13,ESC:27,DELETE:46,0:48,9:57,A:65,Z:90,NUMPAD_0:186,NUMPAD_9:111,";":186,".":190,"`":192,"[":219,'"':222,IME:229,TAB:9,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INS:45}}),e("mobiledoc-kit/utils/lifecycle-callbacks",["exports","mobiledoc-kit/utils/assert"],function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);ta;)a++,o=i.next,this.remove(i),i=o;r.forEach(function(e){n.insertBefore(e,o)})}},{key:"removeBy",value:function(e){for(var t=this.head;t;){var r=t.next;e(t)&&this.remove(t),t=r}}},{key:"_ensureItemIsNotInList",value:function(e){(0,t["default"])("Cannot insert an item into a list if it is already in a list",!e[i])}},{key:"_ensureItemIsInThisList",value:function(e){(0,t["default"])("Cannot remove item that is in another list",e[i]===this)}},{key:"isEmpty",get:function(){return 0===this.length}}]),e}();e["default"]=o}),e("mobiledoc-kit/utils/mixin",["exports"],function(e){"use strict";function t(e,t){e=e.prototype,t=t.prototype||t,Object.getOwnPropertyNames(t).forEach(function(n){if(n!==r){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i)}})}e["default"]=t;var r="constructor"}),e("mobiledoc-kit/utils/paste-utils",["exports","mobiledoc-kit/parsers/mobiledoc","mobiledoc-kit/parsers/html","mobiledoc-html-renderer","mobiledoc-text-renderer"],function(e,t,r,n,i){"use strict";function o(e,t){var r=t.cursor,o=t.post,a=e.clipboardData,s=r.offsets,l=o.cloneRange(s),u=function(){},c=new n["default"]({unknownCardHandler:u}).render(l),d=c.result,f="
"+d+"
",h=new i["default"]({unknownCardHandler:u}).render(l),p=h.result;a.setData("text/plain",p),a.setData("text/html",f)}function a(e,n){var i=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],o=void 0,a=void 0,s=new RegExp(/data\-mobiledoc='(.*?)'>/),l=e.clipboardData.getData("text/html");if(l&&0!==l.length||(l=e.clipboardData.getData("text/plain")),s.test(l)){var u=l.match(s)[1];o=JSON.parse(u),a=t["default"].parse(n,o)}else a=new r["default"](n,{plugins:i}).parse(l);return a}e.setClipboardCopyData=o,e.parsePostFromPaste=a}),e("mobiledoc-kit/utils/placeholder-image-src",["exports"],function(e){"use strict";var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAMFBMVEXp7vG6vsHm6+63u77Hy868wMPe4+bO09bh5unr8fTR1djAxMfM0NPX3N/c4eTBxcjXRf5TAAACh0lEQVR4nO3b6ZKqMBSFUSQMYZL3f9tbBq/NEEDiqUqOfusn1ZXKbjcQlGQZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACC6RkbsGHuabChEtHmiGYfS3EQYM+Sxw/gMQvmcNnYaj6oTDHi73WPn2eqnj9B8zo3TJXcq5uNjXmVff86VwSR3JtryMa1BYqi7S1hJDCVpSigyLcGhJJEwzlCSNtPKrbVhVwsdCfOhH7uuaG3ARV9DwsaOzxt3N1yPqCHhvXytTUz92VDpmE/LLhZwl++R6Sds6sUa/PL6K/2E2fIhw1xdRKefsFolrPc+xNx/N0k/4fpBsdhL2HfeiN+TsDCms8dDpeRyS3P3QDl6Iqaf8L0rTf+80m6Lmn7Ct+4Wxf+/2RY1/YRv3PHz/u+fsCmqgoTnq7Z+8SGviqoh4dnKu1ieqauiakh4/PQ0r6ivqDoSHj0B97eNRVG1JNxV+L4bnxdVecJtRTdFVZ7QU9F1UXUn9FZ0VVRlCav5ob2KLouqKmFjy676u2HsVnRRVFUJq3J+8KCi86IqSthMvyl209Hjijqm3RsqAZ5pNfa5PJ2KelJRjQmr1/r7cfy0ouoSNvOfvbvhvKLaEr4qOin9kTQnrN7LpDZhE/Zmhp6Eq4p+YcKgiipKGFhRRQkDK6ooYfgLbiSMioQkJGF8P5XwHv4O+7AaKiXzaeXh1kMl5AffTUxiKEm/krD94BR8Gdxl1fceSlR58ZhXKbEpyD2amNiBtmrJLTMHL1LF8/rpXkSZXEmz8K8uvAFFNm6Iq0aBLUFOmeCuJ6exrcCmoLpN7kYx891bSAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgh/wDdr8peyRHLogAAAAASUVORK5CYII="; +e["default"]=t}),e("mobiledoc-kit/utils/selection-utils",["exports","mobiledoc-kit/utils/key"],function(e,t){"use strict";function r(){window.getSelection().removeAllRanges()}function n(e){for(var r=!0;r;){var n=e;r=!1;var i=n.anchorNode,o=n.focusNode,a=n.anchorOffset,s=n.focusOffset,l=void 0,u=void 0,c=void 0,d=void 0,f=void 0,h=i.compareDocumentPosition(o);if(h&Node.DOCUMENT_POSITION_CONTAINS)e={focusNode:o.childNodes[s],focusOffset:0,anchorNode:i,anchorOffset:a},r=!0,i=o=a=s=l=u=c=d=f=h=void 0;else{if(!(h&Node.DOCUMENT_POSITION_CONTAINED_BY))return h&Node.DOCUMENT_POSITION_FOLLOWING?(l=i,u=o,c=a,d=s,f=t.DIRECTION.FORWARD):h&Node.DOCUMENT_POSITION_PRECEDING?(l=o,u=i,c=s,d=a,f=t.DIRECTION.BACKWARD):(l=u=i,c=a,d=s,c>d?(c=s,d=a,f=t.DIRECTION.BACKWARD):f=d>c?t.DIRECTION.FORWARD:null),{headNode:l,headOffset:c,tailNode:u,tailOffset:d,direction:f};var p=a-1;0>p&&(p=0),e={anchorNode:i.childNodes[p],anchorOffset:0,focusNode:o,focusOffset:s},r=!0,i=o=a=s=l=u=c=d=f=h=p=void 0}}}e.clearSelection=r,e.comparePosition=n}),e("mobiledoc-kit/utils/set",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var r=0;r'+e+"";this.showMessage(r,t)}}]),t}(t["default"]);e["default"]=l}),e("mobiledoc-kit/views/view",["exports","mobiledoc-kit/utils/mixin","mobiledoc-kit/utils/event-listener","mobiledoc-kit/utils/dom-utils"],function(e,t,r,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;ryo&&setTimeout(function(){l.display.input.reset(!0)},20),Bt(this),Yi(),yt(this),this.curOp.forceUpdate=!0,$n(this,i),n.autofocus&&!No||l.hasFocus()?setTimeout(ji(mr,this),20):vr(this);for(var c in Zo)Zo.hasOwnProperty(c)&&Zo[c](this,n[c],ea);k(this),n.finishInit&&n.finishInit(this);for(var d=0;dyo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),wo||mo&&No||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Fe(e,100),e.state.modeGen++,e.curOp&&Rt(e)}function i(e){e.options.lineWrapping?(Qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):($a(e.display.wrapper,"CodeMirror-wrap"),f(e)),a(e),Rt(e),at(e),setTimeout(function(){b(e)},100)}function o(e){var t=gt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/bt(e.display)-3);return function(i){if(_n(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function h(e){var t=Li(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 p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+We(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+qe(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function m(e,t,r){this.cm=r;var n=this.vert=Bi("div",[Bi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Bi("div",[Bi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Na(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Na(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,bo&&8>yo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function v(){}function g(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&$a(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Na(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?nr(t,e):rr(t,e)},t),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)}function b(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;y(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&M(e),y(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function y(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-ze(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ti(t,n),a=ti(t,i);if(r&&r.ensure){var s=r.ensure.from.line,l=r.ensure.to.line;o>s?(o=s,a=ti(t,ri(Qn(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ti(t,ri(Qn(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function _(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Vt(e))return!1;k(e)&&(It(e),t.dims=P(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroma&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Do&&(o=yn(e.doc,o),a=wn(e.doc,a));var s=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Ht(e,o,a),r.viewOffset=ri(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var l=Vt(e);if(!s&&0==l&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=Ui();return l>4&&(r.lineDiv.style.display="none"),R(e,r.updateLineNumbers,t.dims),l>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,u&&Ui()!=u&&u.offsetHeight&&u.focus(),zi(r.cursorDiv),zi(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fe(e,400)),r.updateLineNumbers=null,!0}function N(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ke(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+We(e.display)-Ge(e),r.top)}),t.visible=w(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&T(e,t);n=!1){M(e);var i=p(e);Pe(e),O(e,i),b(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new E(e,t);if(T(e,r)){M(e),N(e,r);var n=p(e);Pe(e),O(e,n),b(e,n),r.finish()}}function O(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var r=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=r+"px",e.display.gutters.style.height=Math.max(r+qe(e),t.clientHeight)+"px"}function M(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;nyo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(2>i&&(i=gt(t)),(l>.001||-.001>l)&&(Zn(o.line,i),L(o.line),o.rest))for(var u=0;u=t&&d.lineNumber;d.changes&&(Li(d.changes,"gutter")>-1&&(f=!1),D(e,d,u,r)),f&&(zi(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(x(e.options,u)))),s=d.node.nextSibling}else{var h=W(e,d,u,r);a.insertBefore(h,s)}u+=d.size}for(;s;)s=n(s)}function D(e,t,r,n){for(var i=0;iyo&&(e.node.style.zIndex=2)),e.node}function j(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=I(e);e.background=r.insertBefore(Bi("div",null,t),r.firstChild)}}function F(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):jn(e,t)}function H(e,t){var r=t.text.className,n=F(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,V(t)):r&&(t.text.className=r)}function V(e){j(e),e.line.wrapClass?I(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function B(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=I(t);t.gutterBackground=Bi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=I(t),a=t.gutter=Bi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Bi("div",x(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s1)if(Fo&&Fo.join("\n")==t){if(n.ranges.length%Fo.length==0){l=[];for(var u=0;u=0;u--){var c=n.ranges[u],d=c.from(),f=c.to();c.empty()&&(r&&r>0?d=Io(d.line,d.ch-r):e.state.overwrite&&!a&&(f=Io(f.line,Math.min(Qn(o,f.line).text.length,f.ch+Mi(s).length))));var h=e.curOp.updateInput,p={from:d,to:f,text:l?l[u%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Cr(e.doc,p),xi(e,"inputRead",e,p)}t&&!a&&ee(e,t),Ir(e),e.curOp.updateInput=h,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Z(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");return r?(e.preventDefault(),X(t)||t.options.disableInput||Nt(t,function(){J(t,r,0,null,"paste")}),!0):void 0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Fr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fr(e,i.head.line,"smart"));a&&xi(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],r=[],n=0;ni?u.map:c[i],a=0;ai?e.line:e.rest[i]),d=o[a]+n;return(0>n||s!=t)&&(d=o[a+(n?1:0)]),Io(l,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Ka(i,t))return se(Io(ei(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Mi(e.rest):e.line;return se(Io(ei(a),a.text.length),o)}var s=3==t.nodeType?t:null,l=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var u=e.measure,c=u.maps,d=n(s,l,r);if(d)return se(d,o);for(var f=l.nextSibling,h=s?s.nodeValue.length-r:0;f;f=f.nextSibling){if(d=n(f,f.firstChild,0))return se(Io(d.line,d.ch-h),o);h+=f.textContent.length}for(var p=l.previousSibling,h=r;p;p=p.previousSibling){if(d=n(p,p.firstChild,-1))return se(Io(d.line,d.ch+h),o);h+=f.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var c,d=t.getAttribute("cm-marker");if(d){var f=e.findMarks(Io(n,0),Io(i+1,0),o(+d));return void(f.length&&(c=f[0].find())&&(s+=Xn(e.doc,c.from,c.to).join(u)))}if("false"==t.getAttribute("contenteditable"))return;for(var h=0;h=0){var a=$(o.from(),i.from()),s=Y(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new fe(l?s:a,l?a:s))}}return new de(e,t)}function pe(e,t){return new de([new fe(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ve(e,t){if(t.liner?Io(r,Qn(e,r).text.length):ge(t,Qn(e,t.line).text.length)}function ge(e,t){var r=e.ch;return null==r||r>t?Io(e.line,t):0>r?Io(e.line,0):e}function be(e,t){return t>=e.first&&t=o.ch:u.to>o.ch))){if(n&&(Ma(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--l;continue}break}if(!c.atomic)continue;var d=c.find(0>a?-1:1);if(0==jo(d,o)&&(d.ch+=a,d.ch<0?d=d.line>e.first?ve(e,Io(d.line-1)):null:d.ch>s.text.length&&(d=d.linet&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild(Bi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return dt(e,Io(t,r),"div",d,n)}var s,l,d=Qn(a,t),f=d.text.length;return Zi(ni(d),r||0,null==i?f:i,function(e,t,a){var d,h,p,m=o(e,"left");if(e==t)d=m,h=p=m.left;else{if(d=o(t-1,"right"),"rtl"==a){var v=m;m=d,d=v}h=m.left,p=d.right}null==r&&0==e&&(h=u),d.top-m.top>3&&(n(h,m.top,null,m.bottom),h=u,m.bottoml.bottom||d.bottom==l.bottom&&d.right>l.right)&&(l=d),u+1>h&&(h=u),n(h,d.top,p-h,d.bottom)}),{start:s,end:l}}var o=e.display,a=e.doc,s=document.createDocumentFragment(),l=Ue(e.display),u=l.left,c=Math.max(o.sizerWidth,Ke(e)-o.sizer.offsetLeft)-l.right,d=t.from(),f=t.to();if(d.line==f.line)i(d.line,d.ch,f.ch);else{var h=Qn(a,d.line),p=Qn(a,f.line),m=gn(h)==gn(p),v=i(d.line,d.ch,m?h.text.length+1:null).end,g=i(f.line,m?0:null,f.ch).start;m&&(v.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Fe(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var r=+new Date+e.options.workTime,n=aa(t.mode,Be(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength,l=Pn(e,o,s?aa(t.mode,n):n,!0);o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!d&&fr?(Fe(e,e.options.workDelay),!0):void 0}),i.length&&Nt(e,function(){for(var t=0;ta;--s){if(s<=o.first)return o.first;var l=Qn(o,s-1);if(l.stateAfter&&(!r||s<=o.frontier))return s;var u=Fa(l.text,null,e.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}function Be(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Ve(e,t,r),a=o>n.first&&Qn(n,o-1).stateAfter;return a=a?aa(n.mode,a):sa(n.mode),n.iter(o,t,function(r){Dn(e,r.text,a);var s=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((l.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function $e(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Qe(e,t){t=gn(t);var r=ei(t),n=e.display.externalMeasured=new Lt(e.doc,t,r);n.lineN=r;var i=n.built=jn(e,n);return n.text=i.pre,Wi(e.display.lineMeasure,i.pre),n}function Xe(e,t,r,n){return et(e,Ze(e,t),r,n)}function Je(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt?(i=0,o=1,a="left"):u>t?(i=t-l,o=i+1):(s==e.length-3||t==u&&e[s+3]>t)&&(o=u-l,i=o-1,t>=u&&(a="right")),null!=i){if(n=e[s+2],l==u&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],a="left";if("right"==r&&i==u-l)for(;sc;c++){for(;s&&Vi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+lyo&&0==s&&l==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(bo&&e.options.lineWrapping){var d=za(a,s,l).getClientRects();i=d.length?d["right"==n?d.length-1:0]:zo}else i=za(a,s,l).getBoundingClientRect()||zo;if(i.left||i.right||0==s)break;l=s,s-=1,u="right"}bo&&11>yo&&(i=nt(e.display.measure,i))}else{s>0&&(u=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(bo&&9>yo&&!s&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+bt(e.display),top:f.top,bottom:f.bottom}:zo}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/2,v=t.view.measure.heights,c=0;cr.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=Ze(e,n));var l=ni(n),u=t.ch;if(!l)return a(u);var c=lo(l,u),d=s(u,c);return null!=is&&(d.other=s(u,is)),d}function ht(e,t){var r=0,t=ve(e.doc,t);e.options.lineWrapping||(r=bt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ri(n)+ze(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function pt(e,t,r,n){var i=Io(e,t);return i.xRel=n,r&&(i.outside=!0),i}function mt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return pt(n.first,0,!0,-1);var i=ti(n,r),o=n.first+n.size-1;if(i>o)return pt(n.first+n.size-1,Qn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=Qn(n,i);;){var s=vt(e,a,i,t,r),l=mn(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=ei(a=u.to.line)}}function vt(e,t,r,n,i){function o(n){var i=ft(e,Io(r,n),"line",t,u);return s=!0,a>i.bottom?i.left-l:av)return pt(r,h,g,1);for(;;){if(c?h==f||h==co(t,f,1):1>=h-f){for(var b=p>n||v-n>=n-p?f:h,y=n-(b==f?p:v);Vi(t.text.charAt(b));)++b;var w=pt(r,b,b==f?m:g,-1>y?-1:y>1?1:0);return w}var _=Math.ceil(d/2),k=f+_;if(c){k=f;for(var x=0;_>x;++x)k=co(t,k,1)}var C=o(k);C>n?(h=k,v=C,(g=s)&&(v+=1e3),d=_):(f=k,p=C,m=s,d-=_)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ho){Ho=Bi("pre");for(var t=0;49>t;++t)Ho.appendChild(document.createTextNode("x")),Ho.appendChild(Bi("br"));Ho.appendChild(document.createTextNode("x"))}Wi(e.measure,Ho);var r=Ho.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),zi(e.measure),r||1}function bt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Bi("span","xxxxxxxxxx"),r=Bi("pre",[t]);Wi(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function yt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Uo},Wo?Wo.ops.push(e.curOp):e.curOp.ownsGroup=Wo={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new E(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&T(e.cm,e.update)}function Et(e){var t=e.cm,r=t.display;e.updatedDisplay&&M(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Xe(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+qe(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ke(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function St(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=n){var a=new Lt(e.doc,Qn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Rt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Do&&yn(e.doc,t)i.viewFrom?It(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)It(e);else if(t<=i.viewFrom){var o=Ft(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):It(e)}else if(r>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var a=Ft(e,t,t,-1),s=Ft(e,r,r+n,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):It(e)}var l=i.externalMeasured;l&&(r=i.lineN&&t=n.viewTo)){var o=n.view[jt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Li(a,r)&&a.push(r)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function jt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;nt)return n}function Ft(e,t,r,n){var i,o=jt(e,t),a=e.display.view;if(!Do||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,l=e.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;yn(e.doc,r)!=r;){if(o==(0>n?0:a.length-1))return null;r+=n*a[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function Ht(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Pt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Pt(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,jt(e,r)))),n.viewTo=r}function Vt(e){for(var t=e.display.view,r=0,n=0;n400}var i=e.display;Na(i.scroller,"mousedown",At(e,Kt)),bo&&11>yo?Na(i.scroller,"dblclick",At(e,function(t){if(!Ei(e,t)){var r=qt(e,t);if(r&&!Xt(e,t)&&!Ut(e.display,t)){Ea(t);var n=e.findWordAt(r);_e(e.doc,n.anchor,n.head)}}})):Na(i.scroller,"dblclick",function(t){Ei(e,t)||Ea(t)}),Po||Na(i.scroller,"contextmenu",function(t){gr(e,t)});var o,a={end:0};Na(i.scroller,"touchstart",function(e){if(!r(e)){clearTimeout(o);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-a.end<=300?a:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY)}}),Na(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Na(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Ut(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new fe(s,s):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(s):new fe(Io(s.line,0),ve(e.doc,Io(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Ea(r)}t()}),Na(i.scroller,"touchcancel",t),Na(i.scroller,"scroll",function(){i.scroller.clientHeight&&(rr(e,i.scroller.scrollTop),nr(e,i.scroller.scrollLeft,!0),Ma(e,"scroll",e))}),Na(i.scroller,"mousewheel",function(t){ir(e,t)}),Na(i.scroller,"DOMMouseScroll",function(t){ir(e,t)}),Na(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ei(e,t)||Ta(t)},over:function(t){Ei(e,t)||(er(e,t),Ta(t))},start:function(t){Zt(e,t)},drop:At(e,Jt),leave:function(){tr(e)}};var s=i.input.getField();Na(s,"keyup",function(t){fr.call(e,t)}),Na(s,"keydown",At(e,cr)),Na(s,"keypress",At(e,hr)),Na(s,"focus",ji(mr,e)),Na(s,"blur",ji(vr,e))}function zt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Na:Oa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Wt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Ut(e,t){for(var r=wi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function qt(e,t,r,n){var i=e.display;if(!r&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(t){return null}var l,u=mt(e,o,a);if(n&&1==u.xRel&&(l=Qn(e.doc,u.line).text).length==u.ch){var c=Fa(l,l.length,e.options.tabSize)-l.length;u=Io(u.line,Math.max(0,Math.round((o-Ue(e.display).left)/bt(e.display))-c))}return u}function Kt(e){var t=this,r=t.display;if(!(r.activeTouch&&r.input.supportsTouch()||Ei(t,e))){if(r.shift=e.shiftKey,Ut(r,e))return void(wo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Xt(t,e)){var n=qt(t,e);switch(window.focus(),_i(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Gt(t,e,n):wi(e)==r.scroller&&Ea(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),n&&_e(t.doc,n),setTimeout(function(){r.input.focus()},20),Ea(e);break;case 3:Po?gr(t,e):pr(t)}}}}function Gt(e,t,r){bo?setTimeout(ji(Q,e),0):e.curOp.focus=Ui();var n,i=+new Date;Bo&&Bo.time>i-400&&0==jo(Bo.pos,r)?n="triple":Vo&&Vo.time>i-400&&0==jo(Vo.pos,r)?(n="double",Bo={time:i,pos:r}):(n="single",Vo={time:i,pos:r});var o,a=e.doc.sel,s=Ao?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ja&&!X(e)&&"single"==n&&(o=a.contains(r))>-1&&(jo((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(jo(o.to(),r)>0||r.xRel<0)?Yt(e,t,r,s):$t(e,t,r,n,s)}function Yt(e,t,r,n){var i=e.display,o=+new Date,a=At(e,function(s){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Oa(document,"mouseup",a),Oa(i.scroller,"drop",a),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Ea(s),!n&&+new Date-200=p;p++){var g=Qn(u,p).text,b=Ha(g,l,o);l==h?i.push(new fe(Io(p,b),Io(p,b))):g.length>b&&i.push(new fe(Io(p,b),Io(p,Ha(g,h,o))))}i.length||i.push(new fe(r,r)),Te(u,he(f.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var y=c,w=y.anchor,_=t;if("single"!=n){if("double"==n)var k=e.findWordAt(t);else var k=new fe(Io(t.line,0),ve(u,Io(t.line+1,0)));jo(k.anchor,w)>0?(_=k.head,w=$(y.from(),k.anchor)):(_=k.anchor,w=Y(y.to(),k.head))}var i=f.ranges.slice(0);i[d]=new fe(ve(u,w),_),Te(u,he(i,d),Ia)}}function a(t){var r=++b,i=qt(e,t,!0,"rect"==n);if(i)if(0!=jo(i,v)){e.curOp.focus=Ui(),o(i);var s=w(l,u);(i.line>=s.to||i.lineg.bottom?20:0;c&&setTimeout(At(e,function(){b==r&&(l.scroller.scrollTop+=c,a(t))}),50)}}function s(t){e.state.selectingText=!1,b=1/0,Ea(t),l.input.focus(),Oa(document,"mousemove",y),Oa(document,"mouseup",_),u.history.lastSelOrigin=null}var l=e.display,u=e.doc;Ea(t);var c,d,f=u.sel,h=f.ranges;if(i&&!t.shiftKey?(d=u.sel.contains(r),c=d>-1?h[d]:new fe(r,r)):(c=u.sel.primary(),d=u.sel.primIndex),t.altKey)n="rect",i||(c=new fe(r,r)),r=qt(e,t,!0,!0),d=-1;else if("double"==n){var p=e.findWordAt(r);c=e.display.shift||u.extend?we(u,c,p.anchor,p.head):p}else if("triple"==n){var m=new fe(Io(r.line,0),ve(u,Io(r.line+1,0)));c=e.display.shift||u.extend?we(u,c,m.anchor,m.head):m}else c=we(u,c,r);i?-1==d?(d=h.length,Te(u,he(h.concat([c]),d),{scroll:!1,origin:"*mouse"})):h.length>1&&h[d].empty()&&"single"==n&&!t.shiftKey?(Te(u,he(h.slice(0,d).concat(h.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),f=u.sel):xe(u,d,c,Ia):(d=0,Te(u,new de([c],0),Ia),f=u.sel);var v=r,g=l.wrapper.getBoundingClientRect(),b=0,y=At(e,function(e){_i(e)?a(e):s(e)}),_=At(e,s);e.state.selectingText=_,Na(document,"mousemove",y),Na(document,"mouseup",_)}function Qt(e,t,r,n,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Ea(t);var s=e.display,l=s.lineDiv.getBoundingClientRect();if(a>l.bottom||!Ti(e,r))return yi(t);a-=l.top-s.viewOffset;for(var u=0;u=o){var d=ti(e.doc,a),f=e.options.gutters[u];return i(e,r,e,d,f,t),yi(t)}}}function Xt(e,t){return Qt(e,t,"gutterClick",!0,xi)}function Jt(e){var t=this;if(tr(t),!Ei(t,e)&&!Ut(t.display,e)){Ea(e),bo&&(qo=+new Date);var r=qt(t,e,!0),n=e.dataTransfer.files;if(r&&!X(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,s=function(e,n){if(!t.options.allowDropFileTypes||-1!=Li(t.options.allowDropFileTypes,e.type)){var s=new FileReader;s.onload=At(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ve(t.doc,r);var l={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Cr(t.doc,l),Se(t.doc,pe(r,Xo(l)))}}),s.readAsText(e)}},l=0;i>l;++l)s(n[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Ao?e.altKey:e.ctrlKey))var u=t.listSelections();if(Ne(t.doc,pe(r,r)),u)for(var l=0;la.clientWidth,l=a.scrollHeight>a.clientHeight;if(n&&s||i&&l){if(i&&Ao&&wo)e:for(var u=t.target,c=o.view;u!=a;u=u.parentNode)for(var d=0;df?h=Math.max(0,h+f-50):p=Math.min(e.doc.height,p+f+50),A(e,{top:h,bottom:p})}20>Ko&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft, +o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Go=(Go*Ko+r)/(Ko+1),++Ko)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function or(e,t,r){if("string"==typeof t&&(t=la[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{X(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Ra}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function ar(e,t,r){for(var n=0;nyo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=lr(t,e);xo&&(Qo=n?r:null,!n&&88==r&&!ts&&(Ao?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||dr(t)}}function dr(e){function t(e){18!=e.keyCode&&e.altKey||($a(r,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t))}var r=e.display.lineDiv;Qa(r,"CodeMirror-crosshair"),Na(document,"keyup",t),Na(document,"mouseover",t)}function fr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Ei(this,e)}function hr(e){var t=this;if(!(Ut(t.display,e)||Ei(t,e)||e.ctrlKey&&!e.altKey||Ao&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(xo&&r==Qo)return Qo=null,void Ea(e);if(!xo||e.which&&!(e.which<10)||!lr(t,e)){var i=String.fromCharCode(null==n?r:n);ur(t,e,i)||t.display.input.onKeyPress(e)}}}function pr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vr(e))},100)}function mr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ma(e,"focus",e),e.state.focused=!0,Qa(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),wo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),je(e))}function vr(e){e.state.delayingBlurEvent||(e.state.focused&&(Ma(e,"blur",e),e.state.focused=!1,$a(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function gr(e,t){Ut(e.display,t)||br(e,t)||Ei(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function br(e,t){return Ti(e,"gutterContextMenu")?Qt(e,t,"gutterContextMenu",!1,Ma):!1}function yr(e,t){if(jo(e,t.from)<0)return e;if(jo(e,t.to)<=0)return Xo(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Xo(t).ch-t.to.ch),Io(r,n)}function wr(e,t){for(var r=[],n=0;n=0;--i)Er(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Er(e,t)}}function Er(e,t){if(1!=t.text.length||""!=t.text[0]||0!=jo(t.from,t.to)){var r=wr(e,t);li(e,t,r,e.cm?e.cm.curOp.id:NaN),Nr(e,t,r,nn(e,t));var n=[];Yn(e,function(e,r){r||-1!=Li(n,e.history)||(bi(e.history,t),n.push(e.history)),Nr(e,t,null,nn(e,t))})}}function Sr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l=0;--l){var d=n.changes[l];if(d.origin=t,c&&!xr(e,d,!1))return void(a.length=0);u.push(oi(e,d));var f=l?wr(e,d):Mi(a);Nr(e,d,f,an(e,d)),!l&&e.cm&&e.cm.scrollIntoView({from:d.from,to:Xo(d)});var h=[];Yn(e,function(e,t){t||-1!=Li(h,e.history)||(bi(e.history,d),h.push(e.history)),Nr(e,d,null,an(e,d))})}}}}function Tr(e,t){if(0!=t&&(e.first+=t,e.sel=new de(Pi(e.sel.ranges,function(e){return new fe(Io(e.anchor.line+t,e.anchor.ch),Io(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Rt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:Io(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Xn(e,t.from,t.to),r||(r=wr(e,t)),e.cm?Ar(e.cm,t,n):qn(e,t,n),Ne(e,r,Da)}}function Ar(e,t,r){var n=e.doc,i=e.display,a=t.from,s=t.to,l=!1,u=a.line;e.options.lineWrapping||(u=ei(gn(Qn(n,a.line))),n.iter(u,s.line+1,function(e){return e==i.maxLine?(l=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&Si(e),qn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Fe(e,400);var c=t.text.length-(s.line-a.line)-1;t.full?Rt(e):a.line!=s.line||1!=t.text.length||Un(e.doc,t)?Rt(e,a.line,s.line+1,c):Dt(e,a.line,"text");var f=Ti(e,"changes"),h=Ti(e,"change");if(h||f){var p={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};h&&xi(e,"change",e,p),f&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Or(e,t,r,n,i){if(n||(n=r),jo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Cr(e,{from:r,to:n,text:t,origin:i})}function Mr(e,t){if(!Ei(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!So){var o=Bi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-ze(e.display))+"px; height: "+(t.bottom-t.top+qe(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Lr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,a=ft(e,t),s=r&&r!=t?ft(e,r):a,l=Rr(e,Math.min(a.left,s.left),Math.min(a.top,s.top)-n,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+n),u=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=l.scrollTop&&(rr(e,l.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=l.scrollLeft&&(nr(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return a}function Pr(e,t,r,n,i){var o=Rr(e,t,r,n,i);null!=o.scrollTop&&rr(e,o.scrollTop),null!=o.scrollLeft&&nr(e,o.scrollLeft)}function Rr(e,t,r,n,i){var o=e.display,a=gt(e.display);0>r&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Ge(e),u={};i-r>l&&(i=r+l);var c=e.doc.height+We(o),d=a>r,f=i>c-a;if(s>r)u.scrollTop=d?0:r;else if(i>s+l){var h=Math.min(r,(f?c:i)-l);h!=s&&(u.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ke(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),v=n-t>m;return v&&(n=t+m),10>t?u.scrollLeft=0:p>t?u.scrollLeft=Math.max(0,t-(v?0:10)):n>m+p-3&&(u.scrollLeft=n+(v?0:10)-m),u}function Dr(e,t,r){(null!=t||null!=r)&&jr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Ir(e){jr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Io(t.line,t.ch-1):t,n=Io(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function jr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ht(e,t.from),n=ht(e,t.to),i=Rr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Be(e,t):r="prev");var a=e.options.tabSize,s=Qn(o,t),l=Fa(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==Ra||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?Fa(Qn(o,t-1).text,null,a):0:"add"==r?u=l+e.options.indentUnit:"subtract"==r?u=l-e.options.indentUnit:"number"==typeof r&&(u=l+r),u=Math.max(0,u);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)f+=a,d+=" ";if(u>f&&(d+=Oi(u-f)),d!=c)return Or(o,d,Io(t,0),Io(t,c.length),"+input"),s.stateAfter=null,!0;for(var h=0;h=0;t--)Or(e.doc,"",n[t].from,n[t].to,"+delete");Ir(e)})}function Br(e,t,r,n,i){function o(){var t=s+r;return t=e.first+e.size?d=!1:(s=t,c=Qn(e,t))}function a(e){var t=(i?co:fo)(c,l,r,!0);if(null==t){if(e||!o())return d=!1;l=i?(0>r?no:ro)(c):0>r?c.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,u=r,c=Qn(e,s),d=!0;if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var f=null,h="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(0>r)||a(!m);m=!1){var v=c.text.charAt(l)||"\n",g=Fi(v,p)?"w":h&&"\n"==v?"n":!h||/\s/.test(v)?null:"p";if(!h||m||g||(g="s"),f&&f!=g){0>r&&(r=1,a());break}if(g&&(f=g),r>0&&!a(!m))break}var b=Le(e,Io(s,l),u,!0);return d||(b.hitSide=!0),b}function zr(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*gt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var l=mt(e,a,i);if(!l.outside)break;if(0>r?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*r}return l}function Wr(t,r,n,i){e.defaults[t]=r,n&&(Zo[t]=i?function(e,t,r){r!=ea&&n(e,t,r)}:n)}function Ur(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Bi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(vn(e,t.line,t,r,o)||t.line!=r.line&&vn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&li(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,l=t.line,u=e.cm;if(e.iter(l,r.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&gn(e)==u.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&Zn(e,0),en(e,new Xr(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){_n(e,t)&&Zn(t,0)}),o.clearOnEnter&&Na(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Ro=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++pa,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Rt(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)Dt(u,c,"text");o.atomic&&Oe(u.doc),xi(u,"markerAdded",u,o)}return o}function Gr(e,t,r,n,i){n=Ii(n),n.shared=!1;var o=[Kr(e,t,r,n,i)],a=o[0],s=n.widgetNode;return Yn(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Kr(e,ve(e,t),ve(e,r),n,i));for(var l=0;l=t:o.to>t);(n||(n=[])).push(new Xr(a,o.from,l?null:o.to))}}return n}function rn(e,t,r){if(e)for(var n,i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var d=0;dd;++d)p.push(m);p.push(l)}return p}function on(e){for(var t=0;t0)){var c=[l,1],d=jo(u.from,s.from),f=jo(u.to,s.to);(0>d||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-1}}return i}function ln(e){var t=e.markedSpans;if(t){for(var r=0;r=0&&0>=d||0>=c&&d>=0)&&(0>=c&&(jo(u.to,r)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(jo(u.from,n)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function gn(e){for(var t;t=pn(e);)e=t.find(-1,!0).line;return e}function bn(e){for(var t,r;t=mn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function yn(e,t){var r=Qn(e,t),n=gn(r);return r==n?t:ei(n)}function wn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!_n(e,n))return t;for(;r=mn(n);)n=r.find(1,!0).line;return ei(n)+1}function _n(e,t){var r=Do&&t.markedSpans;if(r)for(var n,i=0;io;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Mn(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?aa(a.mode,c):c}}var o,a=e.doc,s=a.mode;t=ve(a,t);var l,u=Qn(a,t.line),c=Be(e,t.line,r),d=new ha(u.text,e.options.tabSize);for(n&&(l=[]);(n||d.pose.options.maxHighlightLength?(s=!1,a&&Dn(e,t,n,d.pos),d.pos=t.length,l=null):l=Nn(On(r,d,n,f),o),f){var h=f[0].name;h&&(l="m-"+(l?h+" "+l:h))}if(!s||c!=l){for(;uu;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,l-r,e,"cm-overlay "+t),l=r+2;else for(;l>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Rn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ei(t)),i=Pn(e,t,t.text.length>e.options.maxHighlightLength?aa(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Dn(e,t,r,n){var i=e.doc.mode,o=new ha(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&An(i,r);!o.eol();)On(i,o,r),o.start=o.pos}function In(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?wa:ya;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var r=Bi("span",null,null,wo?"padding-right: .1px":null),n={pre:Bi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,splitSpaces:(bo||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Hn,Xi(e.display.measure)&&(o=ni(a))&&(n.addToken=Bn(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&ei(a);Wn(a,n,Rn(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Ki(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Ki(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return wo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Ma(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Ki(n.pre.className,n.textClass||"")),n}function Fn(e){var t=Bi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Hn(e,t,r,n,i,o,a){if(t){var s=e.splitSpaces?t.replace(/ {3,}/g,Vn):t,l=e.cm.state.specialChars,u=!1;if(l.test(t))for(var c=document.createDocumentFragment(),d=0;;){l.lastIndex=d;var f=l.exec(t),h=f?f.index-d:t.length-d;if(h){var p=document.createTextNode(s.slice(d,d+h));bo&&9>yo?c.appendChild(Bi("span",[p])):c.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!f)break;if(d+=h+1," "==f[0]){var m=e.cm.options.tabSize,v=m-e.col%m,p=c.appendChild(Bi("span",Oi(v),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=v}else if("\r"==f[0]||"\n"==f[0]){var p=c.appendChild(Bi("span","\r"==f[0]?"␍":"␤","cm-invalidchar"));p.setAttribute("cm-text",f[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(f[0]);p.setAttribute("cm-text",f[0]),bo&&9>yo?c.appendChild(Bi("span",[p])):c.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var c=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,c),bo&&9>yo&&(u=!0),e.pos+=t.length}if(r||n||i||u||a){var g=r||"";n&&(g+=n),i&&(g+=i);var b=Bi("span",[c],g,a);return o&&(b.title=o),e.content.appendChild(b)}e.content.appendChild(c)}}function Vn(e){for(var t=" ",r=0;ru&&f.from<=u)break}if(f.to>=c)return e(r,n,i,o,a,s,l);e(r,n.slice(0,f.to-u),i,o,null,s,l),o=null,n=n.slice(f.to-u),u=f.to}}}function zn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Wn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,s,l,u,c,d,f,h=i.length,p=0,m=1,v="",g=0;;){if(g==p){l=u=c=d=s="",f=null,g=1/0;for(var b=[],y=0;yp||_.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&g>w.to&&(g=w.to,u=""),_.className&&(l+=" "+_.className),_.css&&(s=_.css),_.startStyle&&w.from==p&&(c+=" "+_.startStyle),_.endStyle&&w.to==g&&(u+=" "+_.endStyle),_.title&&!d&&(d=_.title),_.collapsed&&(!f||fn(f.marker,_)<0)&&(f=w)):w.from>p&&g>w.from&&(g=w.from)}if(f&&(f.from||0)==p){if(zn(t,(null==f.to?h+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}if(!f&&b.length)for(var y=0;y=h)break;for(var k=Math.min(h,g);;){if(v){var x=p+v.length;if(!f){var C=x>k?v.slice(0,k-p):v;t.addToken(t,C,a?a+l:l,c,p+C.length==g?u:"",d,s)}if(x>=k){v=v.slice(k-p),p=k;break}p=x,c=""}v=i.slice(o,o=r[m++]),a=In(r[m++],t.cm.options)}}else for(var m=1;mr;++r)o.push(new ba(u[r],i(r),n));return o}var s=t.from,l=t.to,u=t.text,c=Qn(e,s.line),d=Qn(e,l.line),f=Mi(u),h=i(u.length-1),p=l.line-s.line;if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length);else if(Un(e,t)){var m=a(0,u.length-1);o(d,d.text,h),p&&e.remove(s.line,p),m.length&&e.insert(s.line,m)}else if(c==d)if(1==u.length)o(c,c.text.slice(0,s.ch)+f+c.text.slice(l.ch),h);else{var m=a(1,u.length-1);m.push(new ba(f+c.text.slice(l.ch),h,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,m)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+d.text.slice(l.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(d,f+d.text.slice(l.ch),h);var m=a(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,m)}xi(e,"change",e,t)}function Kn(e){this.lines=e,this.parent=null;for(var t=0,r=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function Xn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function Jn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function Zn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ei(e){if(null==e.parent)return null;for(var t=e.parent,r=Li(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ti(e,t){var r=e.first;e:do{for(var n=0;nt){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;nt)break;t-=s}return r+n}function ri(e){e=gn(e);for(var t=0,r=e.parent,n=0;n1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Mi(e.done)):void 0}function li(e,t,r,n){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=si(i,i.lastOp==n))){var s=Mi(o.changes);0==jo(t.from,t.to)&&0==jo(t.from,s.to)?s.to=Xo(t):o.changes.push(oi(e,t))}else{var l=Mi(i.done);for(l&&l.ranges||di(e.sel,i.done),o={changes:[oi(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||Ma(e,"historyAdded")}function ui(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ci(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ui(e,o,Mi(i.done),t))?i.done[i.done.length-1]=t:di(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r, +n&&n.clearRedo!==!1&&ai(i.undone)}function di(e,t){var r=Mi(t);r&&r.ranges&&r.equals(e)||t.push(e)}function fi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function hi(e){if(!e)return null;for(var t,r=0;r-1&&(Mi(s)[d]=c[d],delete c[d])}}}return i}function vi(e,t,r,n){r0?n.slice():Aa:n||Aa}function xi(e,t){function r(e){return function(){e.apply(null,o)}}var n=ki(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Wo?i=Wo.delayedCallbacks:La?i=La:(i=La=[],setTimeout(Ci,0));for(var a=0;a0}function Ni(e){e.prototype.on=function(e,t){Na(this,e,t)},e.prototype.off=function(e,t){Oa(this,e,t)}}function Ai(){this.id=null}function Oi(e){for(;Va.length<=e;)Va.push(Mi(Va)+" ");return Va[e]}function Mi(e){return e[e.length-1]}function Li(e,t){for(var r=0;r-1&&Ua(e)?!0:t.test(e):Ua(e)}function Hi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Vi(e){return e.charCodeAt(0)>=768&&qa.test(e)}function Bi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Wi(e,t){return zi(e).appendChild(t)}function Ui(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function qi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Ki(e,t){for(var r=e.split(" "),n=0;n2&&!(bo&&8>yo))}var r=Ga?Bi("span","​"):Bi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Xi(e){if(null!=Ya)return Ya;var t=Wi(e,document.createTextNode("AخA")),r=za(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=za(t,1,2).getBoundingClientRect();return Ya=n.right-r.right<3}function Ji(e){if(null!=rs)return rs;var t=Wi(e,Bi("span","x")),r=t.getBoundingClientRect(),n=za(t,0,1).getBoundingClientRect();return rs=Math.abs(r.left-n.left)>1}function Zi(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;ot||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function eo(e){return e.level%2?e.to:e.from}function to(e){return e.level%2?e.from:e.to}function ro(e){var t=ni(e);return t?eo(t[0]):0}function no(e){var t=ni(e);return t?to(Mi(t)):e.text.length}function io(e,t){var r=Qn(e.doc,t),n=gn(r);n!=r&&(t=ei(n));var i=ni(n),o=i?i[0].level%2?no(n):ro(n):0;return Io(t,o)}function oo(e,t){for(var r,n=Qn(e.doc,t);r=mn(n);)n=r.find(1,!0).line,t=null;var i=ni(n),o=i?i[0].level%2?ro(n):no(n):n.text.length;return Io(null==t?ei(n):t,o)}function ao(e,t){var r=io(e,t.line),n=Qn(e.doc,r.line),i=ni(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return Io(r.line,a?0:o)}return r}function so(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function lo(e,t){is=null;for(var r,n=0;nt)return n;if(i.from==t||i.to==t){if(null!=r)return so(e,i.level,e[r].level)?(i.from!=i.to&&(is=r),n):(i.from!=i.to&&(is=n),r);r=n}}return r}function uo(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Vi(e.text.charAt(t)));return t}function co(e,t,r,n){var i=ni(e);if(!i)return fo(e,t,r,n);for(var o=lo(i,t),a=i[o],s=uo(e,t,a.level%2?-r:r,n);;){if(s>a.from&&s0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;s=r>0==a.level%2?uo(e,a.to,-1,n):uo(e,a.from,1,n)}}function fo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Vi(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var ho=navigator.userAgent,po=navigator.platform,mo=/gecko\/\d/i.test(ho),vo=/MSIE \d/.test(ho),go=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ho),bo=vo||go,yo=bo&&(vo?document.documentMode||6:go[1]),wo=/WebKit\//.test(ho),_o=wo&&/Qt\/\d+\.\d+/.test(ho),ko=/Chrome\//.test(ho),xo=/Opera\//.test(ho),Co=/Apple Computer/.test(navigator.vendor),Eo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ho),So=/PhantomJS/.test(ho),To=/AppleWebKit/.test(ho)&&/Mobile\/\w+/.test(ho),No=To||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ho),Ao=To||/Mac/.test(po),Oo=/win/i.test(po),Mo=xo&&ho.match(/Version\/(\d*\.\d*)/);Mo&&(Mo=Number(Mo[1])),Mo&&Mo>=15&&(xo=!1,wo=!0);var Lo=Ao&&(_o||xo&&(null==Mo||12.11>Mo)),Po=mo||bo&&yo>=9,Ro=!1,Do=!1;m.prototype=Ii({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==n&&this.overlayHack(),this.checkedOverlay=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=Ao&&!Eo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,r=function(e){wi(e)!=t.vert&&wi(e)!=t.horiz&&At(t.cm,Kt)(e)};Na(this.vert,"mousedown",r),Na(this.horiz,"mousedown",r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),v.prototype=Ii({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},v.prototype),e.scrollbarModel={"native":m,"null":v},E.prototype.signal=function(e,t){Ti(e,t)&&this.events.push(arguments)},E.prototype.finish=function(){for(var e=0;e=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Na(o,"paste",function(e){return Z(e,n)?!0:(n.state.pasteIncoming=!0,void r.fastPoll())}),Na(o,"cut",t),Na(o,"copy",t),Na(e.scroller,"paste",function(t){Ut(e,t)||(n.state.pasteIncoming=!0,r.focus())}),Na(e.lineSpace,"selectstart",function(t){Ut(e,t)||Ea(t)}),Na(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Na(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=Re(e);if(e.options.moveInputWithCursor){var i=ft(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Wi(r.cursorDiv,e.cursors),Wi(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=ts&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.textarea.value=a,n.state.focused&&Ba(this.textarea),bo&&yo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",bo&&yo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!No||Ui()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||es(t)&&!r&&!this.composing||X(e)||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(bo&&yo>=9&&this.hasSelection===n||Ao&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);a>o&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var s=this;return Nt(e,function(){J(e,n.slice(o),r.length-o,null,s.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=n,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){bo&&yo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",a.style.cssText=c,bo&&9>yo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!bo||bo&&9>yo)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==n.prevInput?At(i,la.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,a=n.textarea,s=qt(i,e),l=o.scroller.scrollTop;if(s&&!xo){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(s)&&At(i,Te)(i.doc,pe(s),Da);var c=a.style.cssText;if(n.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(bo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var d=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),bo&&yo>=9&&t(),Po){Ta(e);var f=function(){Oa(window,"mouseup",f),setTimeout(r,20)};Na(window,"mouseup",f)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Ri,needsContentAttribute:!1},ne.prototype),oe.prototype=Ii({init:function(e){function t(e){if(n.somethingSelected())Fo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Fo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Da),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!To)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Fo.join("\n"));else{var r=ie(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Fo.join("\n");var o=document.activeElement;Ba(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}var r=this,n=r.cm,i=r.div=e.lineDiv;re(i),Na(i,"paste",function(e){Z(e,n)}),Na(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=pe(Io(i.head.line,a),Io(i.head.line,a+t.length)))}}),Na(i,"compositionupdate",function(e){r.composing.data=e.data}),Na(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),Na(i,"touchstart",function(){r.forceCompositionEnd()}),Na(i,"input",function(){r.composing||(X(n)||!r.pollContent())&&Nt(r.cm,function(){Rt(n)})}),Na(i,"copy",t),Na(i,"cut",t)},prepareSelection:function(){var e=Re(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=jo($(r,n),t.from())||0!=jo(Y(r,n),t.to())){var i=ae(this.cm,t.from()),o=ae(this.cm,t.to());if(i||o){var a=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=a[a.length-1].measure,u=l.maps?l.maps[l.maps.length-1]:l.map;o={node:u[u.length-1],offset:u[u.length-2]-u[u.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var c=za(i.node,i.offset,o.offset,o.node)}catch(d){}c&&(e.removeAllRanges(),e.addRange(c),s&&null==e.anchorNode?e.addRange(s):mo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Wi(this.cm.display.cursorDiv,e.cursors),Wi(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Ka(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Nt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Nt(t,function(){Te(t.doc,pe(r,n),Da),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.linet.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=jt(e,n.line)))var a=ei(t.view[0].line),s=t.view[0].node;else var a=ei(t.view[o].line),s=t.view[o-1].node.nextSibling;var l=jt(e,i.line);if(l==t.view.length-1)var u=t.viewTo-1,c=t.lineDiv.lastChild;else var u=ei(t.view[l+1].line)-1,c=t.view[l+1].node.previousSibling;for(var d=e.doc.splitLines(ce(e,s,c,a,u)),f=Xn(e.doc,Io(a,0),Io(u,Qn(e.doc,u).text.length));d.length>1&&f.length>1;)if(Mi(d)==Mi(f))d.pop(),f.pop(),u--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),a++}for(var h=0,p=0,m=d[0],v=f[0],g=Math.min(m.length,v.length);g>h&&m.charCodeAt(h)==v.charCodeAt(h);)++h;for(var b=Mi(d),y=Mi(f),w=Math.min(b.length-(1==d.length?h:0),y.length-(1==f.length?h:0));w>p&&b.charCodeAt(b.length-p-1)==y.charCodeAt(y.length-p-1);)++p;d[d.length-1]=b.slice(0,b.length-p),d[0]=d[0].slice(h);var _=Io(a,h),k=Io(u,f.length?Mi(f).length-p:0);return d.length>1||d[0]||jo(_,k)?(Or(e.doc,d,_,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){X(this.cm)?At(this.cm,Rt)(this.cm):e.data&&e.data!=e.startData&&At(this.cm,J)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),X(this.cm)||At(this.cm,J)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Ri,resetPosition:Ri,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:ne,contenteditable:oe},de.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&jo(e,n.to())<=0)return r}return-1}},fe.prototype={from:function(){return $(this.anchor,this.head)},to:function(){return Y(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ho,Vo,Bo,zo={left:0,right:0,top:0,bottom:0},Wo=null,Uo=0,qo=0,Ko=0,Go=null;bo?Go=-.53:mo?Go=15:ko?Go=-.7:Co&&(Go=-1/3);var Yo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Yo(e);return t.x*=Go,t.y*=Go,t};var $o=new Ai,Qo=null,Xo=e.changeEnd=function(e){return e.text?Io(e.from.line+e.text.length-1,Mi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,Zo.hasOwnProperty(e)&&At(this,Zo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](qr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(Fr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Ir(this));else{var o=i.from(),a=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;r>l;++l)Fr(this,l,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&xe(this.doc,n,new fe(o,u[n].to()),Da)}}}),getTokenAt:function(e,t){return Mn(this,e,t)},getLineTokens:function(e,t){return Mn(this,Io(e),t,!0)},getTokenTypeAt:function(e){e=ve(this.doc,e);var t,r=Rn(this,Qn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]s?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!oa.hasOwnProperty(t))return r;var n=oa[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;oi&&(e=i,n=!0),r=Qn(this.doc,e)}else r=e;return ut(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ri(r):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return bt(this.display)},setGutterMarker:Ot(function(e,t,r){return Hr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Hi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Dt(t,n,"gutter"),Hi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!be(this.doc,e))return null;var t=e;if(e=Qn(this.doc,e),!e)return null}else{var t=ei(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ft(this,ve(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&Pr(this,s,a,s+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(cr),triggerOnKeyPress:Ot(hr),triggerOnKeyUp:fr,execCommand:function(e){return la.hasOwnProperty(e)?la[e].call(null,this):void 0},triggerElectric:Ot(function(e){ee(this,e)}),findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ve(this.doc,e);t>o&&(a=Br(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Br(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},ja)}),deleteH:Ot(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Vr(this,function(r){var i=Br(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,s=ve(this.doc,e);t>a;++a){var l=ft(this,s,"div");if(null==o?o=l.left:l.left=o,s=zr(this,l,i,r),s.hitSide)break}return s},moveV:Ot(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var s=ft(r,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=zr(r,s,e,t);return"page"==t&&a==n.sel.primary()&&Dr(r,null,dt(r,l,"div").top-s.top),l},ja),i.length)for(var a=0;a0&&s(r.charAt(n-1));)--n;for(;i.5)&&a(this),Ma(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,$n(this,e),at(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,xi(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ni(e);var Jo=e.defaults={},Zo=e.optionHandlers={},ea=e.Init={toString:function(){return"CodeMirror.Init"}};Wr("value","",function(e,t){e.setValue(t)},!0),Wr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Wr("indentUnit",2,r,!0),Wr("indentWithTabs",!1),Wr("smartIndent",!0),Wr("tabSize",4,function(e){n(e),at(e),Rt(e)},!0),Wr("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break; +i=o+t.length,r.push(Io(n,o))}n++});for(var i=r.length-1;i>=0;i--)Or(e.doc,t,r[i],Io(r[i].line,r[i].ch+t.length))}}),Wr("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),Wr("specialCharPlaceholder",Fn,function(e){e.refresh()},!0),Wr("electricChars",!0),Wr("inputStyle",No?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Wr("rtlMoveVisually",!Oo),Wr("wholeLineUpdateBefore",!0),Wr("theme","default",function(e){s(e),l(e)},!0),Wr("keyMap","default",function(t,r,n){var i=qr(r),o=n!=e.Init&&qr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Wr("extraKeys",null),Wr("lineWrapping",!1,i,!0),Wr("gutters",[],function(e){h(e.options),l(e)},!0),Wr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Wr("coverGutterNextToScrollbar",!1,function(e){b(e)},!0),Wr("scrollbarStyle","native",function(e){g(e),b(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Wr("lineNumbers",!1,function(e){h(e.options),l(e)},!0),Wr("firstLineNumber",1,l,!0),Wr("lineNumberFormatter",function(e){return e},l,!0),Wr("showCursorWhenSelecting",!1,Pe,!0),Wr("resetSelectionOnContextMenu",!0),Wr("lineWiseCopyCut",!0),Wr("readOnly",!1,function(e,t){"nocursor"==t?(vr(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Wr("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Wr("dragDrop",!0,zt),Wr("allowDropFileTypes",null),Wr("cursorBlinkRate",530),Wr("cursorScrollMargin",0),Wr("cursorHeight",1,Pe,!0),Wr("singleCursorHeightPerLine",!0,Pe,!0),Wr("workTime",100),Wr("workDelay",100),Wr("flattenSpans",!0,n,!0),Wr("addModeClass",!1,n,!0),Wr("pollInterval",100),Wr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Wr("historyEventDelay",1250),Wr("viewportMargin",10,function(e){e.refresh()},!0),Wr("maxHighlightLength",1e4,n,!0),Wr("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Wr("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Wr("autofocus",null);var ta=e.modes={},ra=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),ta[t]=r},e.defineMIME=function(e,t){ra[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ra.hasOwnProperty(t))t=ra[t];else if(t&&"string"==typeof t.name&&ra.hasOwnProperty(t.name)){var r=ra[t.name];"string"==typeof r&&(r={name:r}),t=Di(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=ta[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(na.hasOwnProperty(r.name)){var o=na[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var na=e.modeExtensions={};e.extendMode=function(e,t){var r=na.hasOwnProperty(e)?na[e]:na[e]={};Ii(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){ka.prototype[e]=t},e.defineOption=Wr;var ia=[];e.defineInitHook=function(e){ia.push(e)};var oa=e.helpers={};e.registerHelper=function(t,r,n){oa.hasOwnProperty(t)||(oa[t]=e[t]={_global:[]}),oa[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),oa[t]._global.push({pred:n,val:i})};var aa=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},sa=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var la=e.commands={selectAll:function(e){e.setSelection(Io(e.firstLine(),0),Io(e.lastLine()),Da)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Da)},killLine:function(e){Vr(e,function(t){if(t.empty()){var r=Qn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new Io(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Io(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Qn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Io(i.line-1,a.length-1),Io(i.line,1),"+transpose")}r.push(new fe(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Nt(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}Ir(e)})},toggleOverwrite:function(e){e.toggleOverwrite()}},ua=e.keyMap={};ua.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ua.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ua.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},ua.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},ua["default"]=Ao?ua.macDefault:ua.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Pi(r.split(" "),Ur),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var pa=0,ma=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++pa};Ni(ma),ma.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&yt(e),Ti(this,"clear")){var r=this.find();r&&xi(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Rt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Oe(e.doc)),e&&xi(e,"markerCleared",e,this),t&&_t(e),this.parent&&this.parent.clear()}},ma.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;ir;++r){var i=this.lines[r];this.height-=i.height,Tn(i),xi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;ne;++e)if(r(this.lines[e]))return!0}},Gn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;re){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Kn))){var s=[];this.collapse(s),this.children=[new Kn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),s=new Kn(a);i.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Gn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Li(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Gn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;ne){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var _a=0,ka=e.Doc=function(e,t,r,n){if(!(this instanceof ka))return new ka(e,t,r,n);null==r&&(r=0),Gn.call(this,[new Kn([new ba("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Io(r,0);this.sel=pe(i),this.history=new ii(null),this.id=++_a,this.modeOption=t,this.lineSep=n,"string"==typeof e&&(e=this.splitLines(e)),qn(this,{from:i,to:i,text:e}),Te(this,pe(i),Da)};ka.prototype=Di(Gn.prototype,{constructor:ka,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n=0;o--)Cr(this,n[o]);s?Se(this,s):this.cm&&Ir(this.cm)}),undo:Mt(function(){Sr(this,"undo")}),redo:Mt(function(){Sr(this,"redo")}),undoSelection:Mt(function(){Sr(this,"undo",!0)}),redoSelection:Mt(function(){Sr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ve(this,e),t=ve(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;sl.to||null==l.from&&i!=e.line||i==t.line&&l.from>t.ch||r&&!r(l.marker)||n.push(l.marker.parent||l.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne?(t=e,!0):(e-=i,void++r)}),ve(this,Io(r,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;return e.linet&&(t=e.from),null!=e.to&&e.tos||s>=t)return a+(t-o);a+=s-o,a+=r-a%r,o=s+1}},Ha=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},Va=[""],Ba=function(e){e.select()};To?Ba=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:bo&&(Ba=function(e){try{e.select()}catch(t){}});var za,Wa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ua=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Wa.test(e))},qa=/[\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]/;za=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var Ka=e.contains=function(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)};bo&&11>yo&&(Ui=function(){try{return document.activeElement}catch(e){return document.body}});var Ga,Ya,$a=e.rmClass=function(e,t){var r=e.className,n=qi(t).exec(r); +if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Qa=e.addClass=function(e,t){var r=e.className;qi(t).test(r)||(e.className+=(r?" ":"")+t)},Xa=!1,Ja=function(){if(bo&&9>yo)return!1;var e=Bi("div");return"draggable"in e||"dragDrop"in e}(),Za=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){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?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},es=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},ts=function(){var e=Bi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),rs=null,ns=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;10>e;e++)ns[e+48]=ns[e+96]=String(e);for(var e=65;90>=e;e++)ns[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)ns[e+111]=ns[e+63235]="F"+e}();var is,os=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n,c=r.length,d=[],f=0;c>f;++f)d.push(n=e(r.charCodeAt(f)));for(var f=0,h=u;c>f;++f){var n=d[f];"m"==n?d[f]=h:h=n}for(var f=0,p=u;c>f;++f){var n=d[f];"1"==n&&"r"==p?d[f]="n":a.test(n)&&(p=n,"r"==n&&(d[f]="R"))}for(var f=1,h=d[0];c-1>f;++f){var n=d[f];"+"==n&&"1"==h&&"1"==d[f+1]?d[f]="1":","!=n||h!=d[f+1]||"1"!=h&&"n"!=h||(d[f]=h),h=n}for(var f=0;c>f;++f){var n=d[f];if(","==n)d[f]="N";else if("%"==n){for(var m=f+1;c>m&&"%"==d[m];++m);for(var v=f&&"!"==d[f-1]||c>m&&"1"==d[m]?"1":"N",g=f;m>g;++g)d[g]=v;f=m-1}}for(var f=0,p=u;c>f;++f){var n=d[f];"L"==p&&"1"==n?d[f]="L":a.test(n)&&(p=n)}for(var f=0;c>f;++f)if(o.test(d[f])){for(var m=f+1;c>m&&o.test(d[m]);++m);for(var b="L"==(f?d[f-1]:u),y="L"==(c>m?d[m]:u),v=b||y?"L":"R",g=f;m>g;++g)d[g]=v;f=m-1}for(var w,_=[],f=0;c>f;)if(s.test(d[f])){var k=f;for(++f;c>f&&s.test(d[f]);++f);_.push(new t(0,k,f))}else{var x=f,C=_.length;for(++f;c>f&&"L"!=d[f];++f);for(var g=x;f>g;)if(l.test(d[g])){g>x&&_.splice(C,0,new t(1,x,g));var E=g;for(++g;f>g&&l.test(d[g]);++g);_.splice(C,0,new t(2,E,g)),x=g}else++g;f>x&&_.splice(C,0,new t(1,x,f))}return 1==_[0].level&&(w=r.match(/^\s+/))&&(_[0].from=w[0].length,_.unshift(new t(0,0,w[0].length))),1==Mi(_).level&&(w=r.match(/\s+$/))&&(Mi(_).to-=w[0].length,_.push(new t(0,c-w[0].length,c))),2==_[0].level&&_.unshift(new t(1,_[0].to,_[0].to)),_[0].level!=Mi(_).level&&_.push(new t(_[0].level,c,c)),_}}();return e.version="5.8.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function i(e,t,r){return ye=e,we=r,t}function o(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=a(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r);if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if("0"==r&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),i("number","number");if("0"==r&&e.eat(/b/i))return e.eatWhile(/[01]/i),i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=s,s(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),i("regexp","string-2")):(e.eatWhile(Ne),i("operator","operator",e.current()));if("`"==r)return t.tokenize=l,l(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(Ne.test(r))return e.eatWhile(Ne),i("operator","operator",e.current());if(Se.test(r)){e.eatWhile(Se);var o=e.current(),u=Te.propertyIsEnumerable(o)&&Te[o];return u&&"."!=t.lastType?i(u.type,u.style,o):i("variable","variable",o)}}function a(e){return function(t,r){var n,a=!1;if(xe&&"@"==t.peek()&&t.match(Ae))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||a);)a=!a&&"\\"==n;return a||(r.tokenize=o),i("string","string")}}function s(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=o;break}n="*"==r}return i("comment","comment")}function l(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=o;break}n=!n&&"\\"==r}return i("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),s=Oe.indexOf(a);if(s>=0&&3>s){if(!n){++o;break}if(0==--n)break}else if(s>=3&&6>s)++n;else if(Se.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function c(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(Le.state=e,Le.stream=i,Le.marked=null,Le.cc=o,Le.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Ce?k:_;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Le.marked?Le.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Le.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=Le.state;if(Le.marked="def",n.context){if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function v(){Le.state.context={prev:Le.state.context,vars:Le.state.localVars},Le.state.localVars=Pe}function g(){Le.state.localVars=Le.state.context.vars,Le.state.context=Le.state.context.prev}function b(e,t){var r=function(){var r=Le.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new c(n,Le.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function y(){var e=Le.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function w(e){function t(r){return r==e?p():";"==e?h():p(t)}return t}function _(e,t){return"var"==e?p(b("vardef",t.length),G,w(";"),y):"keyword a"==e?p(b("form"),k,_,y):"keyword b"==e?p(b("form"),_,y):"{"==e?p(b("}"),W,y):";"==e?p():"if"==e?("else"==Le.state.lexical.info&&Le.state.cc[Le.state.cc.length-1]==y&&Le.state.cc.pop()(),p(b("form"),k,_,y,J)):"function"==e?p(ie):"for"==e?p(b("form"),Z,_,y):"variable"==e?p(b("stat"),I):"switch"==e?p(b("form"),k,b("}","switch"),w("{"),W,y,y):"case"==e?p(k,w(":")):"default"==e?p(w(":")):"catch"==e?p(b("form"),v,w("("),oe,w(")"),_,y,g):"class"==e?p(b("form"),ae,y):"export"==e?p(b("stat"),ce,y):"import"==e?p(b("stat"),de,y):h(b("stat"),k,w(";"),y)}function k(e){return C(e,!1)}function x(e){return C(e,!0)}function C(e,t){if(Le.state.fatArrowAt==Le.stream.start){var r=t?L:M;if("("==e)return p(v,b(")"),B(Y,")"),y,w("=>"),r,g);if("variable"==e)return h(v,Y,w("=>"),r,g)}var n=t?N:T;return Me.hasOwnProperty(e)?p(n):"async"==e?p(k):"function"==e?p(ie,n):"keyword c"==e?p(t?S:E):"("==e?p(b(")"),E,ge,w(")"),y,n):"operator"==e||"spread"==e?p(t?x:k):"["==e?p(b("]"),me,y,n):"{"==e?z(F,"}",null,n):"quasi"==e?h(A,n):"new"==e?p(P(t)):p()}function E(e){return e.match(/[;\}\)\],]/)?h():h(k)}function S(e){return e.match(/[;\}\)\],]/)?h():h(x)}function T(e,t){return","==e?p(k):N(e,t,!1)}function N(e,t,r){var n=0==r?T:N,i=0==r?k:x;return"=>"==e?p(v,r?L:M,g):"operator"==e?/\+\+|--/.test(t)?p(n):"?"==t?p(k,w(":"),i):p(i):"quasi"==e?h(A,n):";"!=e?"("==e?z(x,")","call",n):"."==e?p(j,n):"["==e?p(b("]"),E,w("]"),y,n):void 0:void 0}function A(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(A):p(k,O)}function O(e){return"}"==e?(Le.marked="string-2",Le.state.tokenize=l,p(A)):void 0}function M(e){return u(Le.stream,Le.state),h("{"==e?_:k)}function L(e){return u(Le.stream,Le.state),h("{"==e?_:x)}function P(e){return function(t){return"."==t?p(e?D:R):h(e?x:k)}}function R(e,t){return"target"==t?(Le.marked="keyword",p(T)):void 0}function D(e,t){return"target"==t?(Le.marked="keyword",p(N)):void 0}function I(e){return":"==e?p(y,_):h(T,w(";"),y)}function j(e){return"variable"==e?(Le.marked="property",p()):void 0}function F(e,t){return"async"==e?p(F):"variable"==e||"keyword"==Le.style?(Le.marked="property",p("get"==t||"set"==t?H:V)):"number"==e||"string"==e?(Le.marked=xe?"property":Le.style+" property",p(V)):"jsonld-keyword"==e?p(V):"["==e?p(k,w("]"),V):void 0}function H(e){return"variable"!=e?h(V):(Le.marked="property",p(ie))}function V(e){return":"==e?p(x):"("==e?h(ie):void 0}function B(e,t){function r(n){if(","==n){var i=Le.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,r)}return n==t?p():p(w(t))}return function(n){return n==t?p():h(e,r)}}function z(e,t,r){for(var n=3;n!?|~^]/,Ae=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Oe="([{}])",Me={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Le={state:null,column:null,marked:null,cc:null},Pe={name:"this",next:{name:"arguments"}};return y.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new c((e||0)-_e,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=s&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==ye?r:(t.lastType="operator"!=ye||"++"!=we&&"--"!=we?ye:"incdec",f(t,r,ye,we,e))},indent:function(t,n){if(t.tokenize==s)return e.Pass;if(t.tokenize!=o)return 0;var i=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var l=t.cc.length-1;l>=0;--l){var u=t.cc[l];if(u==y)a=a.prev;else if(u!=J)break}"stat"==a.type&&"}"==i&&(a=a.prev),ke&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,d=i==c;return"vardef"==c?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==c&&"{"==i?a.indented:"form"==c?a.indented+_e:"stat"==c?a.indented+(be(t,n)?ke||_e:0):"switch"!=a.info||d||0==r.doubleIndentSwitch?a.align?a.column+(d?0:1):a.indented+(d?0:_e):a.indented+(/^(?:case|default)\b/.test(n)?_e:2*_e)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ce?null:"/*",blockCommentEnd:Ce?null:"*/",lineComment:Ce?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ce?"json":"javascript",jsonldMode:xe,jsonMode:Ce}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),define("ember-cli-app-version/components/app-version",["exports","ember","ember-cli-app-version/templates/app-version"],function(e,t,r){"use strict";e["default"]=t["default"].Component.extend({tagName:"span",layout:r["default"]})}),define("ember-cli-app-version/initializer-factory",["exports","ember"],function(e,t){"use strict";function r(e,r){var i=!1;return function(){if(!i&&e&&r){var o=n(e);t["default"].libraries.register(o,r),i=!0}}}e["default"]=r;var n=t["default"].String.classify}),define("ember-cli-app-version/templates/app-version",["exports"],function(e){"use strict";e["default"]=Ember.HTMLBars.template(function(){return{meta:{fragmentReason:{name:"missing-wrapper",problems:["wrong-type"]},revision:"Ember@2.2.0",loc:{source:null,start:{line:1,column:0},end:{line:2,column:0}},moduleName:"modules/ember-cli-app-version/templates/app-version.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(e){var t=e.createDocumentFragment(),r=e.createComment("");e.appendChild(t,r);var r=e.createTextNode("\n");return e.appendChild(t,r),t},buildRenderNodes:function(e,t,r){var n=new Array(1);return n[0]=e.createMorphAt(t,0,0,r),e.insertBoundary(t,0),n},statements:[["content","version",["loc",[null,[1,0],[1,11]]]]],locals:[],templates:[]}}())}),define("ember-cli-app-version",["ember-cli-app-version/index","ember","exports"],function(e,t,r){"use strict";var n=Object.keys||t["default"].keys,i=Array.prototype.forEach&&function(e,t){e.forEach(t)}||t["default"].EnumerableUtils.forEach;i(n(e),function(t){r[t]=e[t]})}),define("ember-mobiledoc-dom-renderer/components/render-mobiledoc",["exports","ember","ember-mobiledoc-dom-renderer","ember-mobiledoc-dom-renderer/templates/components/render-mobiledoc"],function(e,t,r,n){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return{name:e,type:r.RENDER_TYPE,render:function(e){var t=e.env,r=e.options,n=r[f],i=r[h],o=t.onTeardown,a=n.apply(void 0,arguments),s=a.card,l=a.element;return o(function(){return i(s)}),l}}}var a=t["default"].$,s=t["default"].computed,l=t["default"].assert,u=t["default"].run,c=u.schedule,d=u.join,f="addComponentCard",h="removeComponentCard",p="render-mobiledoc",m="__rendered-mobiledoc",v="__rendered-mobiledoc-card-",g="__rendered-mobiledoc-card";e["default"]=t["default"].Component.extend({layout:n["default"],cardNames:[],_mdcCards:s("cardNames",function(){return this.get("cardNames").map(function(e){return o(e)})}),didInsertElement:function(){var e,t=this;this._super.apply(this,arguments);var n=(e={},i(e,f,function(e){var r=e.env,n=(e.options,e.payload),i=r.name,o=t.generateUuid(),s=a("
").attr("id",o).addClass(g).addClass(g+"-"+i)[0],l=t.cardNameToComponentName(i),u={componentName:l,destinationElementId:o,payload:n};return t.addCard(u),{card:u,element:s}}),i(e,h,function(e){return t.removeCard(e)}),e),o=this.get("_mdcCards"),s=this.get("mobiledoc");l('Must pass mobiledoc to "'+p+'" component',!!s);var u=new r["default"]({cards:o,cardOptions:n}),c=u.render(s),d=c.result,m=c.teardown;this.getRenderElement().appendChild(d),this._teardownRender=m},willDestroyElement:function(){return this._teardownRender&&this._teardownRender(),this._super.apply(this,arguments)},cardNameToComponentName:function(e){return e},_componentCards:s(function(){return t["default"].A()}),addCard:function(e){var t=this;c("afterRender",function(){t.get("_componentCards").pushObject(e)})},removeCard:function(e){var t=this;d(function(){t.get("_componentCards").removeObject(e)})},getRenderElement:function(){return this.$("."+m)[0]},generateUuid:function(){return""+v+t["default"].uuid()}}),e.CARD_ELEMENT_CLASS=g}),define("ember-mobiledoc-dom-renderer/index",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/index"],function(e,t){"use strict";e["default"]=t["default"],e.RENDER_TYPE=t.RENDER_TYPE}),define("ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/cards/image",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/dom","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/render-type"],function(e,t,r){"use strict";e["default"]={name:"image",type:r["default"],render:function(e){var r=e.payload,n=t.createElement("img");return n.src=r.src,n}}}),define("ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/index",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/renderer-factory","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e){e.MobiledocDOMRenderer=t["default"]}e.registerGlobal=n,e["default"]=t["default"],e.RENDER_TYPE=r["default"]}),define("ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/renderer-factory",["exports","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/renderer","ember-mobiledoc-dom-renderer/mobiledoc-dom-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(!Array.isArray(e))throw new Error("`cards` must be passed as an array, not an object.");for(var t=0;ta;a+=2){var u=i[a],c=i[a+1];t.setAttribute(o,u,c)}return o}function a(e){if("0.2.0"!==e)throw new Error('Unexpected Mobiledoc version "'+e+'"')}var s=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(l){i=!0,o=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var r=0;ra;a++){for(var u=r[a],c=s(u,3),d=c[0],f=c[1],h=c[2],p=0,m=d.length;m>p;p++){var v=this.markerTypes[d[p]],g=o(v);t.appendChild(i,g),n.push(g),i=g}t.appendChild(i,t.createTextNode(h));for(var p=0,m=f;m>p;p++)n.pop(),i=n[n.length-1]}}},{key:"renderListItem",value:function(e){var r=t.createElement("li");return this.renderMarkersOnElement(r,e),r}},{key:"renderListSection",value:function(e){var r=this,n=s(e,3),i=(n[0],n[1]),o=n[2],a=t.createElement(i);return o.forEach(function(e){t.appendChild(a,r.renderListItem(e))}),a}},{key:"renderImageSection",value:function(e){var r=s(e,2),n=(r[0],r[1]),i=t.createElement("img");return i.src=n,i}},{key:"findCard",value:function(e){for(var t=0;t':void 0}}}),define("ember-mobiledoc-html-renderer/index",["exports","ember-mobiledoc-html-renderer/renderer-factory","ember-mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e){e.MobiledocHTMLRenderer=t["default"]}e.registerGlobal=n,e["default"]=t["default"],e.RENDER_TYPE=r["default"]}),define("ember-mobiledoc-html-renderer/renderer-factory",["exports","ember-mobiledoc-html-renderer/renderer","ember-mobiledoc-html-renderer/utils/render-type"],function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(!Array.isArray(e))throw new Error("`cards` must be passed as an array, not an object.");for(var t=0;ta;a+=2){var u=i[a],c=i[a+1];t.setAttribute(o,u,c)}return o}function a(e){if("0.2.0"!==e)throw new Error('Unexpected Mobiledoc version "'+e+'"')}var s=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(l){i=!0,o=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var r=0;ra;a++){for(var u=r[a],c=s(u,3),d=c[0],f=c[1],h=c[2],p=0,m=d.length;m>p;p++){var v=this.markerTypes[d[p]],g=o(v);t.appendChild(i,g),n.push(g),i=g}t.appendChild(i,t.createTextNode(h));for(var p=0,m=f;m>p;p++)n.pop(),i=n[n.length-1]}}},{key:"_defaultUnknownCardHandler",get:function(){return function(e){var t=e.env.name;throw new Error('Card "'+t+'" not found but no unknownCardHandler was registered')}}}]),e}();e["default"]=h}),define("ember-mobiledoc-html-renderer/utils/dom",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){return e.replace(/ /g,"  ")}function n(e){return new c(e)}function i(e,t){e.appendChild(t)}function o(e){return new d(e)}function a(e,t,r){e.setAttribute(t,r)}function s(){return n("div")}e.createElement=n,e.appendChild=i,e.createTextNode=o,e.setAttribute=a,e.createDocumentFragment=s;var l=function(){function e(e,t){for(var r=0;r"}return e}}]),e}(),d=function(){function e(r){t(this,e),this.value=r}return l(e,[{key:"toString",value:function(){return r(this.value)}}]),e}()}),define("ember-mobiledoc-html-renderer/utils/render-type",["exports"],function(e){"use strict";e["default"]="html"}),define("ember-mobiledoc-html-renderer",["ember-mobiledoc-html-renderer/index","ember","exports"],function(e,t,r){"use strict";var n=Object.keys||t["default"].keys,i=Array.prototype.forEach&&function(e,t){e.forEach(t)}||t["default"].EnumerableUtils.forEach;i(n(e),function(t){r[t]=e[t]})}),define("ember-mobiledoc-text-renderer/cards/image",["exports"],function(e){"use strict";e["default"]={name:"image-card",type:"text",render:function(){}}}),define("ember-mobiledoc-text-renderer/index",["exports","ember-mobiledoc-text-renderer/renderer-factory"],function(e,t){"use strict";function r(e){e.MobiledocTextRenderer=t["default"]}e.registerGlobal=r,e["default"]=t["default"]}),define("ember-mobiledoc-text-renderer/renderer-factory",["exports","ember-mobiledoc-text-renderer/renderer"],function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){if(!Array.isArray)throw new Error("`cards` must be an array");for(var t=0;t - + @@ -19,8 +19,8 @@ - - + +