'),this.$editors.append(t.$el).append(e.$el)}this.modal&&(this.modal.setTitle("Export template"),this.modal.setContent(this.$editors),this.modal.open());var i=this.em;this.protCss;this.htmlEditor.setContent(i.getHtml()),this.cssEditor.setContent(i.getCss()),this.sender&&this.sender.set("active",!1)},stop:function(){}}}).call(e,n(0))},function(t,e,n){"use strict";t.exports={run:function(t){t.Canvas.getBody().className=this.ppfx+"dashed"},stop:function(t){t.Canvas.getBody().className=""}}},function(t,e,n){"use strict";(function(e){var i=n(188),r=e.$;t.exports={run:function(t,e){if(!this.toAppend){var n=t.DomComponents.getComponent().get("components"),o=t.getConfig(),s=o.stylePrefix,a=t.Panels,l=o.layers.stylePrefix||"nv-";o.layers.stylePrefix=o.stylePrefix+l,o.layers.pStylePrefix=o.stylePrefix,o.layers.em=t.editor,o.layers.opened=t.editor.get("opened"),a.getPanel("views-container")?this.panel=a.getPanel("views-container"):this.panel=a.addPanel({id:"views-container"});var c=r('
');this.panel.set("appendContent",c).trigger("change:appendContent"),o.layers.sortContainer=c.get(0);var u=(new i).init(n,o.layers);this.$layers=u.render(),c.append(this.$layers),this.toAppend=c}this.toAppend.show()},stop:function(){this.toAppend&&this.toAppend.hide()}}}).call(e,n(0))},function(t,e,n){"use strict";t.exports=function(){var t=void 0,e={},i=n(189),r=n(54),o=n(55);return{init:function(n,s){e=s||e;var a=e.em;for(var l in i)l in e||(e[l]=i[l]);var c=o,u=s.opened||{},h={level:0,config:e,opened:u};return e.showWrapper&&n.parent?(c=r,h.model=n.parent):h.collection=n,t=new c(h),a&&a.on("change:selectedComponent",this.componentChanged),this.componentChanged(),this},componentChanged:function(t,n){if(!(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).fromLayers){var i=e.em,r=i.get("opened"),o=i.get("selectedComponent"),s=o&&o.collection?o.collection.parent:null;for(var a in r)r[a].set("open",0);for(;s;)s.set("open",1),r[s.cid]=s,s=s.collection?s.collection.parent:null}},render:function(){return t.render().$el}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"nv-",sortable:1,hidable:1,hideTextnode:1,showWrapper:1}},function(t,e,n){"use strict";var i=(n(30),n(0)),r=i.$;t.exports={run:function(t,e){if(this.sender=e,!this.$cn){var n=t.getConfig(),i=t.Panels;this.$cn=r("
"),this.$cn.append(this.$cn2);var o=t.DeviceManager;if(o&&n.showDevices){i.addPanel({id:"devices-c"}).set("appendContent",o.render()).trigger("change:appendContent")}var s=t.SelectorManager;s&&this.$cn2.append(s.render([])),this.$cn2.append(t.StyleManager.render());var a=t.StyleManager.getConfig(),l=a.stylePrefix;this.$header=r('"),this.$cn.append(this.$header),i.getPanel("views-container")?this.panel=i.getPanel("views-container"):this.panel=i.addPanel({id:"views-container"}),this.panel.set("appendContent",this.$cn).trigger("change:appendContent"),this.target=t.editor,this.listenTo(this.target,"change:selectedComponent",this.toggleSm)}this.toggleSm()},toggleSm:function(){this.sender.get("active")&&(this.target.get("selectedComponent")?(this.$cn2.show(),this.$header.hide()):(this.$cn2.hide(),this.$header.show()))},stop:function(){this.$cn2&&this.$cn2.hide(),this.$header&&this.$header.hide()}}},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports={run:function(t,e){var i,r=t.Config,o=r.stylePrefix,s=t.TraitManager;if(!this.obj){var a=s.getTraitsViewer(),l=s.getConfig();this.obj=n("
").get(0),this.obj.appendChild(a.render().el);var c=t.Panels;i=c.getPanel("views-container")?c.getPanel("views-container"):c.addPanel({id:"views-container"}),i.set("appendContent",this.obj).trigger("change:appendContent")}this.obj.style.display="block"},stop:function(){this.obj&&(this.obj.style.display="none")}}}).call(e,n(0))},function(t,e,n){"use strict";t.exports={run:function(t,e){var n=t.BlockManager,i=t.Panels;if(!this.blocks){n.render();var r="views-container",o=document.createElement("div"),s=i.getPanel(r)||i.addPanel({id:r});o.appendChild(n.getContainer()),s.set("appendContent",o).trigger("change:appendContent"),this.blocks=o}this.blocks.style.display="block"},stop:function(){var t=this.blocks;t&&(t.style.display="none")}}},function(t,e,n){"use strict";t.exports={run:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.Modal,r=t.AssetManager,o=r.getConfig(),s=n.modalTitle||o.modalTitle||"";r.setTarget(n.target),r.onClick(n.onClick),r.onDblClick(n.onDblClick),r.onSelect(n.onSelect),this.rendered||(r.render(r.getAll().filter(function(t){return"image"==t.get("type")})),this.rendered=1),i.setTitle(s),i.setContent(r.getContainer()),i.open()}}},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports={getOffsetMethod:function(t){return"get"+(t||"")+"OffsetViewerEl"},run:function(t,e,i){var r=i||{},o=r.state||"",s=t.getConfig();if(s.showOffsets&&(s.showOffsetsSelected||"Fixed"!=o)){var a=t.Canvas,l=r.el||"",c=r.elPos||a.getElementPos(l),u=window.getComputedStyle(l),h=this.ppfx,d=o+"State",f=this.getOffsetMethod(o),p=a[f]();p.style.display="block";var g=this["marginT"+o],v=this["marginB"+o],m=this["marginL"+o],y=this["marginR"+o],b=this["padT"+o],x=this["padB"+o],w=this["padL"+o],C=this["padR"+o];if(!this[d]){var k=o.toLowerCase(),S=k+"margin-v",T=k+"padding-v",M=n('
').get(0),E=n('
').get(0),P=h+S+"-el",A=h+T+"-el",L=P+" "+(h+S),O=A+" "+(h+T);g=n('
').get(0),v=n('
').get(0),m=n('
').get(0),y=n('
').get(0),b=n('
').get(0),x=n('
').get(0),w=n('
').get(0),C=n('
').get(0),this["marginT"+o]=g,this["marginB"+o]=v,this["marginL"+o]=m,this["marginR"+o]=y,this["padT"+o]=b,this["padB"+o]=x,this["padL"+o]=w,this["padR"+o]=C,M.appendChild(g),M.appendChild(v),M.appendChild(m),M.appendChild(y),E.appendChild(b),E.appendChild(x),E.appendChild(w),E.appendChild(C),p.appendChild(M),p.appendChild(E),this[d]="1"}var N=u.marginLeft.replace("px",""),I=parseInt(u.marginTop.replace("px","")),D=parseInt(u.marginBottom.replace("px","")),_=g.style,F=v.style,$=m.style,z=y.style,R=b.style,H=x.style,V=w.style,j=C.style,B=parseInt(c.left);_.height=u.marginTop,_.width=u.width,_.top=c.top-u.marginTop.replace("px","")+"px",_.left=B+"px",F.height=u.marginBottom,F.width=u.width,F.top=c.top+c.height+"px",F.left=B+"px";var W=c.height+I+D+"px",U=c.top-I+"px";$.height=W,$.width=u.marginLeft,$.top=U,$.left=B-N+"px",z.height=W,z.width=u.marginRight,z.top=U,z.left=B+c.width+"px";var q=parseInt(u.paddingTop.replace("px",""));R.height=u.paddingTop,R.width=u.width,R.top=c.top+"px",R.left=B+"px";var K=parseInt(u.paddingBottom.replace("px",""));H.height=u.paddingBottom,H.width=u.width,H.top=c.top+c.height-K+"px",H.left=B+"px";var G=c.height-K-q+"px",Y=c.top+q+"px";V.height=G,V.width=u.paddingLeft,V.top=Y,V.left=c.left+"px";var X=parseInt(u.paddingRight.replace("px",""));j.height=G,j.width=u.paddingRight,j.top=Y,j.left=c.left+c.width-X+"px"}},stop:function(t,e,n){var i=n||{},r=i.state||"",o=this.getOffsetMethod(r);t.Canvas[o]().style.display="none"}}}).call(e,n(0))},function(t,e,n){"use strict";t.exports={run:function(t){var e=t.getSelected(),n=e&&e.collection;n&&n.parent&&t.select(n.parent)}}},function(t,e,n){"use strict";t.exports={isEnabled:function(){var t=document;return t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement?1:0},enable:function(t){var e="";return t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?(e="webkit",t.webkitRequestFullscreen()):t.mozRequestFullScreen?(e="moz",t.mozRequestFullScreen()):t.msRequestFullscreen?t.msRequestFullscreen():console.warn("Fullscreen not supported"),e},disable:function(){var t=document;t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen?t.webkitExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.msExitFullscreen&&t.msExitFullscreen()},fsChanged:function(t,e){var n=(document,(t||"")+"fullscreenchange");this.isEnabled()||(this.stop(null,this.sender),document.removeEventListener(n,this.fsChanged))},run:function(t,e){this.sender=e;var n=this.enable(t.getContainer());this.fsChanged=this.fsChanged.bind(this,n),document.addEventListener(n+"fullscreenchange",this.fsChanged),t&&t.trigger("change:canvasOffset")},stop:function(t,e){e&&e.set&&e.set("active",!1),this.disable(),t&&t.trigger("change:canvasOffset")}}},function(t,e,n){"use strict";(function(e){t.exports={getPanels:function(t){return this.panels||(this.panels=t.Panels.getPanelsEl()),this.panels},tglPointers:function(t,n){var i=t.Canvas.getBody().querySelectorAll("."+this.ppfx+"no-pointer");e.each(i,function(t){t.style.pointerEvents=n?"":"all"})},run:function(t,e){e&&e.set&&e.set("active",!1),t.stopCommand("sw-visibility"),t.getModel().stopDefault();var n=this,i=this.getPanels(t),r=t.Canvas.getElement(),o=t.getEl(),s=t.Config.stylePrefix;this.helper||(this.helper=document.createElement("span"),this.helper.className=s+"off-prv fa fa-eye-slash",o.appendChild(this.helper),this.helper.onclick=function(){n.stop(t)}),this.helper.style.display="inline-block",this.tglPointers(t),i.style.display="none";var a=r.style;a.width="100%",a.height="100%",a.top="0",a.left="0",a.padding="0",a.margin="0",t.trigger("change:canvasOffset")},stop:function(t,e){var n=this.getPanels(t);t.runCommand("sw-visibility"),t.getModel().runDefault(),n.style.display="block",t.Canvas.getElement().setAttribute("style",""),this.helper&&(this.helper.style.display="none"),t.trigger("change:canvasOffset"),this.tglPointers(t,1)}}}).call(e,n(1))},function(t,e,n){"use strict";t.exports={run:function(t,e,n){var i=n||{},r=i.el||"",o=t.Canvas,s=this.canvasResizer,a=i.options||{},l=o.getCanvasView();return a.ratioDefault=1,a.appendTo=o.getResizerEl(),a.prefix=t.getConfig().stylePrefix,a.posFetcher=l.getElementPos.bind(l),a.mousePosFetcher=o.getMouseRelativePos,s&&!i.forceNew||(this.canvasResizer=t.Utils.Resizer.init(a),s=this.canvasResizer),s.setOptions(a),s.focus(r),s},stop:function(){var t=this.canvasResizer;t&&t.blur()}}},function(t,e,n){"use strict";t.exports={run:function(t,e,n){var i=n&&n.el||"",r=t.Canvas,o=this.dragger,s=n.options||{},a=r.getCanvasView();return s.prefix=t.getConfig().stylePrefix,s.mousePosFetcher=r.getMouseRelativePos,s.posFetcher=a.getElementPos.bind(a),o||(o=t.Utils.Dragger.init(s),this.dragger=o),o.setOptions(s),o.focus(i),s.event&&o.start(s.event),o},stop:function(){this.canvasResizer&&this.canvasResizer.blur()}}},function(t,e,n){"use strict";t.exports=function(){var t,e,i,r={},o=n(201),s=n(202),a=n(204),l=n(205),c=[];return{name:"BlockManager",init:function(n){r=n||{};var u=r.em;for(var h in o)h in r||(r[h]=o[h]);return t=new s([]),e=new s([]),c=new a,i=new l({collection:e,categories:c},r),t.listenTo(t,"add",function(t){e.add(t),u&&u.trigger("block:add",t)}),t.listenTo(t,"remove",function(t){e.remove(t),u&&u.trigger("block:remove",t)}),t.listenTo(t,"reset",function(t){e.reset(t.models)}),this},getConfig:function(){return r},onLoad:function(){var t=this.getAll();!t.length&&t.reset(r.blocks)},add:function(e,n){var i=n||{};return i.id=e,t.add(i)},get:function(e){return t.get(e)},getAll:function(){return t},getAllVisible:function(){return e},remove:function(e){return t.remove(e)},getCategories:function(){return c},getContainer:function(){return i.el},render:function(t){var e=t||this.getAll().models;i.rendered||(i.render(),i.rendered=1),i.collection.reset(e)}}}},function(t,e,n){"use strict";t.exports={blocks:[],appendTo:""}},function(t,e,n){"use strict";var i=n(0),r=n(203);t.exports=i.Collection.extend({model:r})},function(t,e,n){"use strict";var i=n(0),r=n(56);t.exports=i.Model.extend({defaults:{label:"",content:"",category:"",attributes:{}},initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],this.get("category"));if(t&&"string"==typeof t){new r({id:t,label:t})}}})},function(t,e,n){"use strict";var i=n(0);t.exports=i.Collection.extend({model:n(56)})},function(t,e,n){"use strict";(function(e){var i=n(0),r=n(206),o=n(207);t.exports=i.View.extend({initialize:function(t,n){e.bindAll(this,"getSorter","onDrag","onDrop"),this.config=n||{},this.categories=t.categories||"",this.renderedCategories=[];var i=this.config.pStylePrefix||"";this.ppfx=i,this.noCatClass=i+"blocks-no-cat",this.blockContClass=i+"blocks-c",this.catsClass=i+"block-categories";var r=this.collection;this.listenTo(r,"add",this.addTo),this.listenTo(r,"reset",this.render),this.em=this.config.em,this.tac="test-tac",this.grabbingCls=this.ppfx+"grabbing",this.em&&(this.config.getSorter=this.getSorter,this.canvas=this.em.get("Canvas"))},getSorter:function(){if(this.em){if(!this.sorter){var t=this.em.get("Utils"),e=this.canvas;this.sorter=new t.Sorter({container:e.getBody(),placer:e.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,onStart:this.onDrag,onEndMove:this.onDrop,onMove:this.onMove,document:e.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1,em:this.em,canvasRelative:1})}return this.sorter}},onDrag:function(t){this.em.stopDefault(),this.em.trigger("block:drag:start",t)},onMove:function(t){this.em.trigger("block:drag:move",t)},onDrop:function(t){var e=this.em;e.runDefault(),t&&t.get&&(t.get("activeOnRender")&&(t.trigger("active"),t.set("activeOnRender",0)),e.initChildrenComp(t),e.trigger("block:drag:stop",t))},addTo:function(t){this.add(t)},add:function(t,e){var n=e||null,i=new r({model:t,attributes:t.get("attributes")},this.config),s=i.render().el,a=t.get("category");if(a&&this.categories){"string"==typeof a&&(a={id:a,label:a});var l=this.categories.add(a),c=l.get("id"),u=this.renderedCategories[c],h=this.getCategoriesEl();return t.set("category",l),!u&&h&&(u=new o({model:l},this.config).render(),this.renderedCategories[c]=u,h.appendChild(u.el)),void(u&&u.append(s))}n?n.appendChild(s):this.append(s)},getCategoriesEl:function(){return this.catsEl||(this.catsEl=this.el.querySelector("."+this.catsClass)),this.catsEl},getBlocksEl:function(){return this.blocksEl||(this.blocksEl=this.el.querySelector("."+this.noCatClass+" ."+this.blockContClass)),this.blocksEl},append:function(t){var e=this.getBlocksEl();e&&e.appendChild(t)},render:function(){var t=this,e=document.createDocumentFragment();return this.catsEl=null,this.blocksEl=null,this.renderedCategories=[],this.el.innerHTML='\n
\n
\n ',this.collection.each(function(n){return t.add(n,e)}),this.append(e),this.$el.addClass(this.blockContClass+"s"),this}})}).call(e,n(1))},function(t,e,n){"use strict";(function(e){var i=n(2);t.exports=e.View.extend({events:{mousedown:"startDrag"},initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.config=e,this.endDrag=this.endDrag.bind(this),this.ppfx=e.pStylePrefix||"",this.listenTo(this.model,"destroy remove",this.remove)},startDrag:function(t){if(0===t.button&&this.config.getSorter){this.config.em.refreshCanvas();var e=this.config.getSorter();e.setDragHelper(this.el,t),e.setDropContent(this.model.get("content")),e.startSort(this.el),(0,i.on)(document,"mouseup",this.endDrag)}},endDrag:function(t){(0,i.off)(document,"mouseup",this.endDrag);var e=this.config.getSorter();e.moved=0,e.endMove()},render:function(){var t=this.el,e=this.ppfx,n=e+"block";return t.className+=" "+n+" "+e+"one-bg "+e+"four-color-h",t.innerHTML='
'+this.model.get("label")+"
",this}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=n(0);t.exports=i.View.extend({template:e.template('\n
\n \n <%= label %>\n
\n
\n '),events:{},initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});this.config=t;var e=this.config.pStylePrefix||"";this.pfx=e,this.caretR="fa fa-caret-right",this.caretD="fa fa-caret-down",this.iconClass=e+"caret-icon",this.activeClass=e+"open",this.className=e+"block-category",this.events["click ."+e+"title"]="toggle",this.listenTo(this.model,"change:open",this.updateVisibility),this.delegateEvents()},updateVisibility:function(){this.model.get("open")?this.open():this.close()},open:function(){this.el.className=this.className+" "+this.activeClass,this.getIconEl().className=this.iconClass+" "+this.caretD,this.getBlocksEl().style.display=""},close:function(){this.el.className=this.className,this.getIconEl().className=this.iconClass+" "+this.caretR,this.getBlocksEl().style.display="none"},toggle:function(){var t=this.model;t.set("open",!t.get("open"))},getIconEl:function(){return this.iconEl||(this.iconEl=this.el.querySelector("."+this.iconClass)),this.iconEl},getBlocksEl:function(){return this.blocksEl||(this.blocksEl=this.el.querySelector("."+this.pfx+"blocks-c")),this.blocksEl},append:function(t){this.getBlocksEl().appendChild(t)},render:function(){return this.el.innerHTML=this.template({pfx:this.pfx,label:this.model.get("label")}),this.el.className=this.className,this.updateVisibility(),this}})}).call(e,n(1))},function(t,e,n){var i,r,o;/*!
+/*! grapesjs - 0.12.50 */
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grapesjs=e():t.grapesjs=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=57)}([function(t,e,n){(function(i){var r,o;!function(s){var a="object"==typeof self&&self.self===self&&self||"object"==typeof i&&i.global===i&&i;r=[n(1),n(8),e],void 0!==(o=function(t,e,n){a.Backbone=s(a,n,t,e)}.apply(e,r))&&(t.exports=o)}(function(t,e,n,i){var r=t.Backbone,o=Array.prototype.slice;e.VERSION="1.3.3",e.$=i,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var s=function(t,e,i){switch(t){case 1:return function(){return n[e](this[i])};case 2:return function(t){return n[e](this[i],t)};case 3:return function(t,r){return n[e](this[i],l(t,this),r)};case 4:return function(t,r,o){return n[e](this[i],l(t,this),r,o)};default:return function(){var t=o.call(arguments);return t.unshift(this[i]),n[e].apply(n,t)}}},a=function(t,e,i){n.each(e,function(e,r){n[r]&&(t.prototype[r]=s(e,r,i))})},l=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?c(t):n.isString(t)?function(e){return e.get(t)}:t},c=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},u=e.Events={},h=/\s+/,d=function(t,e,i,r,o){var s,a=0;if(i&&"object"==typeof i){void 0!==r&&"context"in o&&void 0===o.context&&(o.context=r);for(s=n.keys(i);a
this.length&&(r=this.length),r<0&&(r+=this.length+1);var o,s,a=[],l=[],c=[],u=[],h={},d=e.add,f=e.merge,p=e.remove,g=!1,v=this.comparator&&null==r&&!1!==e.sort,m=n.isString(this.comparator)?this.comparator:null;for(s=0;s7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(_,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var i=document.body,r=i.insertBefore(this.iframe,i.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var o=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),I.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e===this.fragment)return!1;this.iframe&&this.navigate(e),this.loadUrl()},loadUrl:function(t){return!!this.matchRoot()&&(t=this.fragment=this.getFragment(t),n.some(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0}))},navigate:function(t,e){if(!I.started)return!1;e&&!0!==e||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;""!==t&&"?"!==t.charAt(0)||(n=n.slice(0,-1)||"/");var i=n+t;if(t=this.decodeFragment(t.replace(F,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var r=this.iframe.contentWindow;e.replace||(r.document.open(),r.document.close()),this._updateHash(r.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var i=t.href.replace(/(javascript:|#).*$/,"");t.replace(i+"#"+e)}else t.hash="#"+e}}),e.history=new I;var z=function(t,e){var i,r=this;return i=t&&n.has(t,"constructor")?t.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,e),i.prototype=n.create(r.prototype,t),i.prototype.constructor=i,i.__super__=r.prototype,i};b.extend=x.extend=P.extend=S.extend=I.extend=z;var $=function(){throw new Error('A "url" property or function must be specified')},R=function(t,e){var n=e.error;e.error=function(i){n&&n.call(e.context,t,i,e),t.trigger("error",t,i,e)}};return e})}).call(e,n(16))},function(t,e,n){var i,r;(function(){function n(t){function e(e,n,i,r,o,s){for(;o>=0&&o0?0:a-1;return arguments.length<3&&(r=n[s?s[l]:l],l+=t),e(n,i,r,s,l,a)}}function o(t){return function(e,n,i){n=S(n,i);for(var r=A(e),o=t>0?0:r-1;o>=0&&o0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(n&&o&&a)return o=n(i,r),i[o]===r?o:-1;if(r!==r)return o=e(p.call(i,s,a),C.isNaN),o>=0?o+s:-1;for(o=t>0?s:a-1;o>=0&&o=0&&e<=P};C.each=C.forEach=function(t,e,n){e=k(e,n);var i,r;if(L(t))for(i=0,r=t.length;i=0},C.invoke=function(t,e){var n=p.call(arguments,2),i=C.isFunction(e);return C.map(t,function(t){var r=i?e:t[e];return null==r?r:r.apply(t,n)})},C.pluck=function(t,e){return C.map(t,C.property(e))},C.where=function(t,e){return C.filter(t,C.matcher(e))},C.findWhere=function(t,e){return C.find(t,C.matcher(e))},C.max=function(t,e,n){var i,r,o=-1/0,s=-1/0;if(null==e&&null!=t){t=L(t)?t:C.values(t);for(var a=0,l=t.length;ao&&(o=i)}else e=S(e,n),C.each(t,function(t,n,i){((r=e(t,n,i))>s||r===-1/0&&o===-1/0)&&(o=t,s=r)});return o},C.min=function(t,e,n){var i,r,o=1/0,s=1/0;if(null==e&&null!=t){t=L(t)?t:C.values(t);for(var a=0,l=t.length;ai||void 0===n)return 1;if(ne?(s&&(clearTimeout(s),s=null),a=c,o=t.apply(i,r),s||(i=r=null)):s||!1===n.trailing||(s=setTimeout(l,u)),o}},C.debounce=function(t,e,n){var i,r,o,s,a,l=function(){var c=C.now()-s;c=0?i=setTimeout(l,e-c):(i=null,n||(a=t.apply(o,r),i||(o=r=null)))};return function(){o=this,r=arguments,s=C.now();var c=n&&!i;return i||(i=setTimeout(l,e)),c&&(a=t.apply(o,r),o=r=null),a}},C.wrap=function(t,e){return C.partial(e,t)},C.negate=function(t){return function(){return!t.apply(this,arguments)}},C.compose=function(){var t=arguments,e=t.length-1;return function(){for(var n=e,i=t[e].apply(this,arguments);n--;)i=t[n].call(this,i);return i}},C.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},C.before=function(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=null),n}},C.once=C.partial(C.before,2);var D=!{toString:null}.propertyIsEnumerable("toString"),_=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];C.keys=function(t){if(!C.isObject(t))return[];if(y)return y(t);var e=[];for(var n in t)C.has(t,n)&&e.push(n);return D&&a(t,e),e},C.allKeys=function(t){if(!C.isObject(t))return[];var e=[];for(var n in t)e.push(n);return D&&a(t,e),e},C.values=function(t){for(var e=C.keys(t),n=e.length,i=Array(n),r=0;r":">",'"':""","'":"'","`":"`"},$=C.invert(z),R=function(t){var e=function(e){return t[e]},n="(?:"+C.keys(t).join("|")+")",i=RegExp(n),r=RegExp(n,"g");return function(t){return t=null==t?"":""+t,i.test(t)?t.replace(r,e):t}};C.escape=R(z),C.unescape=R($),C.result=function(t,e,n){var i=null==t?void 0:t[e];return void 0===i&&(i=n),C.isFunction(i)?i.call(t):i};var H=0;C.uniqueId=function(t){var e=++H+"";return t?t+e:e},C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var V=/(.)^/,j={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\u2028|\u2029/g,W=function(t){return"\\"+j[t]};C.template=function(t,e,n){!e&&n&&(e=n),e=C.defaults({},e,C.templateSettings);var i=RegExp([(e.escape||V).source,(e.interpolate||V).source,(e.evaluate||V).source].join("|")+"|$","g"),r=0,o="__p+='";t.replace(i,function(e,n,i,s,a){return o+=t.slice(r,a).replace(B,W),r=a+e.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":i?o+="'+\n((__t=("+i+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\n__p+='"),e}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var s=new Function(e.variable||"obj","_",o)}catch(t){throw t.source=o,t}var a=function(t){return s.call(this,t,C)};return a.source="function("+(e.variable||"obj")+"){\n"+o+"}",a},C.chain=function(t){var e=C(t);return e._chain=!0,e};var U=function(t,e){return t._chain?C(e).chain():e};C.mixin=function(t){C.each(C.functions(t),function(e){var n=C[e]=t[e];C.prototype[e]=function(){var t=[this._wrapped];return f.apply(t,arguments),U(this,n.apply(C,t))}})},C.mixin(C),C.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];C.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],U(this,n)}}),C.each(["concat","join","slice"],function(t){var e=u[t];C.prototype[t]=function(){return U(this,e.apply(this._wrapped,arguments))}}),C.prototype.value=function(){return this._wrapped},C.prototype.valueOf=C.prototype.toJSON=C.prototype.value,C.prototype.toString=function(){return""+this._wrapped},i=[],void 0!==(r=function(){return C}.apply(e,i))&&(t.exports=r)}).call(this)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitFromValue=e.normalizeFloat=e.shallowDiff=e.camelCase=e.matches=e.upFirst=e.off=e.on=void 0;var i=n(1),r=window.Element.prototype,o=r.matches||r.webkitMatchesSelector||r.mozMatchesSelector||r.msMatchesSelector,s=function(t,e){var n={},r=(0,i.keys)(e);for(var o in t)if(t.hasOwnProperty(o)){var s=t[o],a=e[o];r.indexOf(o)>=0?s!==a&&(n[o]=a):n[o]=null}for(var l in e)e.hasOwnProperty(l)&&(0,i.isUndefined)(t[l])&&(n[l]=e[l]);return n},a=function(t,e,n){e=e.split(/\s+/),t=t instanceof Array?t:[t];for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=0;if(isNaN(t))return n;if(t=parseFloat(t),Math.floor(t)!==t){var r=e.toString().split(".")[1];i=r?r.length:0}return i?parseFloat(t.toFixed(i)):t};e.on=a,e.off=l,e.upFirst=u,e.matches=o,e.camelCase=h,e.shallowDiff=s,e.normalizeFloat=d,e.getUnitFromValue=c},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.sm||e.em||"",o=this.parent(),s=o&&o.attributes;if(s&&s.propagate){var a={},l=s.propagate;l.forEach(function(t){return a[t]=o.get(t)}),a.propagate=l,a=i({},a,t),this.set(a)}var c=this.get("propagate");c&&this.set("propagate",(0,r.isArray)(c)?c:[c]),e&&e.config&&e.config.voidElements.indexOf(this.get("tagName"))>=0&&this.set("void",!0),e.em=n,this.opt=e,this.sm=n,this.em=n,this.config=e.config||{},this.set("attributes",this.get("attributes")||{}),this.listenTo(this,"change:script",this.scriptUpdated),this.listenTo(this,"change:traits",this.traitsUpdated),this.loadTraits(),this.initClasses(),this.initComponents(),this.initToolbar(),this.set("status",""),this.init()},setAttributes:function(t){t=i({},t);var e=t.class;e&&this.setClass(e),delete t.class;var n=t.style;n&&this.setStyle(n),delete t.style,this.set("attributes",t)},getStyle:function(){var t=this.em;if(t&&t.getConfig("avoidInlineStyle")){var e=this.get("state"),n=t.get("CssComposer"),i=n.getIdRule(this.getId(),{state:e});if(this.rule=i,i)return i.getStyle()}return a.default.getStyle.call(this)},setStyle:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.em;if(s&&s.getConfig("avoidInlineStyle")){e=(0,r.isString)(e)?this.parseStyle(e):e;var l=this.get("state"),c=s.get("CssComposer"),u=this.getStyle();this.rule=c.setIdRule(this.getId(),e,i({},n,{state:l}));var h=(0,o.shallowDiff)(u,e);(0,r.keys)(h).forEach(function(e){return t.trigger("change:style:"+e)})}else e=a.default.setStyle.apply(this,arguments);return e},getAttributes:function(){var t=[],e=this.get("attributes")||{};return this.get("classes").each(function(e){return t.push(e.get("name"))}),t.length&&(e.class=t.join(" ")),(0,r.isEmpty)(this.getStyle())||(0,r.has)(e,"id")||(e.id=this.getId()),e},addClass:function(t){var e=this.em.get("SelectorManager").addClass(t);return this.get("classes").add(e)},setClass:function(t){return this.get("classes").reset(),this.addClass(t)},initClasses:function(){var t=this.normalizeClasses(this.get("classes")||[]);return this.set("classes",new u(t)),this},initComponents:function(){var t=new c(null,this.opt);return t.parent=this,t.reset(this.get("components")),this.set("components",t),this},init:function(){},append:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.components().add(t,e);return(0,r.isArray)(n)?n:[n]},components:function(t){var e=this.get("components");if((0,r.isUndefined)(t))return e;e.reset(),t&&this.append(t)},parent:function(){var t=this.collection;return t&&t.parent},scriptUpdated:function(){this.set("scriptUpdated",1)},traitsUpdated:function(){var t=0,e=i({},this.get("attributes")),n=this.get("traits");if(!(n instanceof h))return void this.loadTraits();n.each(function(n){if(t=1,!n.get("changeProp")){var i=n.getInitValue();i&&(e[n.get("name")]=i)}}),t&&this.set("attributes",e)},initToolbar:function(){var t=this;if(!t.get("toolbar")){var e=[];t.collection&&e.push({attributes:{class:"fa fa-arrow-up"},command:"select-parent"}),t.get("draggable")&&e.push({attributes:{class:"fa fa-arrows"},command:"tlb-move"}),t.get("copyable")&&e.push({attributes:{class:"fa fa-clone"},command:"tlb-clone"}),t.get("removable")&&e.push({attributes:{class:"fa fa-trash-o"},command:"tlb-delete"}),t.set("toolbar",e)}},loadTraits:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new h([],this.opt);return n.setTarget(this),t=t||this.get("traits"),t.length&&n.add(t),this.set("traits",n,e),this},normalizeClasses:function(t){var e=[];if(this.sm.get){var n=this.sm.get("SelectorManager");if(n)return t.forEach(function(t){var i="";i="string"==typeof t?t:t.name;var r=n.add(i);e.push(r)}),e}},clone:function(t){var e=this.em,n=this.getStyle(),i=(0,r.clone)(this.attributes);return delete i.attributes.id,i.components=[],i.classes=[],i.traits=[],this.get("components").each(function(t,e){i.components[e]=t.clone(1)}),this.get("traits").each(function(t,e){i.traits[e]=t.clone()}),this.get("classes").each(function(t,e){i.classes[e]=t.get("name")}),i.status="",i.view="",t&&(this.opt.collection=null),e&&e.getConfig("avoidInlineStyle")&&!(0,r.isEmpty)(n)&&(i.style=n),new this.constructor(i,this.opt)},getName:function(){var t=this.get("custom-name"),e=this.get("tagName");e="div"==e?"box":e;var n=this.get("type")||e;return n=n.charAt(0).toUpperCase()+n.slice(1),t||n},getIcon:function(){var t=this.get("icon");return t?t+" ":""},toHTML:function(t){var e=this,n=[],i=e.get("tagName"),o=e.get("void"),s=this.getAttrToHTML();for(var a in s){var l=s[a];(0,r.isUndefined)(l)||n.push(a+'="'+l+'"')}var c=n.length?" "+n.join(" "):"",u="<"+i+c+(o?"/":"")+">"+e.get("content");return e.get("components").each(function(t){return u+=t.toHTML()}),!o&&(u+=""+i+">"),u},getAttrToHTML:function(){var t=this.getAttributes();return delete t.style,t},toJSON:function(){for(var t=arguments.length,e=Array(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},e=this.model,n=t.config||{};this.opts=t,this.config=n,this.em=n.em||"",this.pfx=n.stylePrefix||"",this.ppfx=n.pStylePrefix||"",this.attr=e.get("attributes"),this.classe=this.attr.class||[];var i=this.$el,r=e.get("classes");this.listenTo(e,"destroy remove",this.remove),this.listenTo(e,"change:style",this.updateStyle),this.listenTo(e,"change:attributes",this.updateAttributes),this.listenTo(e,"change:highlightable",this.updateHighlight),this.listenTo(e,"change:status",this.updateStatus),this.listenTo(e,"change:state",this.updateState),this.listenTo(e,"change:script",this.render),this.listenTo(e,"change",this.handleChange),this.listenTo(r,"add remove change",this.updateClasses),i.data("model",e),i.data("collection",e.get("components")),e.view=this,r.length&&this.importClasses(),this.init()},remove:function(){e.View.prototype.remove.apply(this);var t=this.childrenView;t&&t.stopListening()},init:function(){},handleChange:function(){var t=this.em;if(t){var e=this.model;t.trigger("component:update",e);for(var n in e.changed)t.trigger("component:update:"+n,e)}},importClasses:function(){var t=this.config.em.get("SelectorManager");t&&this.model.get("classes").each(function(e){t.add(e.get("name"))})},updateState:function(t){var e="hc-state";this.model.get("state")?this.$el.addClass(e):this.$el.removeClass(e)},updateStatus:function(t){var e=this.el,n=this.model.get("status"),i=this.pfx,r=this.ppfx,o=i+"selected",s=o+"-parent",a=r+"freezed",l=e.getAttribute("class")||"",c="";switch(n){case"selected":c=l+" "+o;break;case"selected-parent":c=l+" "+s;break;case"freezed":c=l+" "+a;break;default:this.$el.removeClass(o+" "+s+" "+a)}(c=c.trim())&&e.setAttribute("class",c)},updateHighlight:function(){var t=this.model.get("highlightable");this.setAttribute("data-highlightable",t?1:"")},updateStyle:function(){var t=this.em,e=this.model;t&&t.get("avoidInlineStyle")?(this.el.id=e.getId(),e.setStyle(e.getStyle())):this.setAttribute("style",e.styleToString())},updateClasses:function(){var t=this.model.get("classes").pluck("name").join(" ");this.setAttribute("class",t),this.updateStatus()},setAttribute:function(t,e){var n=this.$el;e?n.attr(t,e):n.removeAttr(t)},getClasses:function(){var t=this.model.get("attributes"),e=t.class||[];return e=(0,i.isArray)(e)?e:[e],e.length?e.join(" "):null},updateAttributes:function(){var t=this.model,e={},n=t.get("attributes"),i=t.get("src");for(var r in n)e[r]=n[r];i&&(e.src=i),this.$el.attr(e),this.updateHighlight(),this.updateStyle()},updateContent:function(){this.getChildrenContainer().innerHTML=this.model.get("content")},prevDef:function(t){t.preventDefault()},updateScript:function(){if(this.model.get("script")){var t=this.em;if(t){t.get("Canvas").getCanvasView().updateScript(this)}}},getChildrenContainer:function(){var t=this.el;return"function"==typeof this.getChildrenSelector?t=this.el.querySelector(this.getChildrenSelector()):this.getTemplate,t},renderChildren:function(){var t=this.getChildrenContainer(),e=new r({collection:this.model.get("components"),config:this.config,componentTypes:this.opts.componentTypes});e.render(t),this.childrenView=e;for(var n=Array.prototype.slice.call(e.el.childNodes),i=0,o=n.length;i\n '+this.templateLabel(t)+'\n \n
\n '+this.templateInput(t)+"\n
\n "},templateLabel:function(t){var e=this.pfx;return'\n
\n '+t.get("name")+'\n \n
⨯ \n '},templateInput:function(t){return'\n
\n \n
\n '},events:{change:"inputValueChanged"},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,i.bindAll)(this,"targetUpdated"),this.config=t.config||{};var e=this.config.em;this.em=e,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.onChange=t.onChange,this.onInputRender=t.onInputRender||{},this.customValue=t.customValue||{};var n=this.model;this.property=n.get("property"),this.input=null;var r=this.pfx;this.inputHolderId="#"+r+"input-holder",this.sector=n.collection&&n.collection.sector,n.view=this,n.get("value")||n.set("value",n.getDefaultValue()),e&&e.on("update:component:style:"+this.property,this.targetUpdated),this.listenTo(this.propTarget,"update",this.targetUpdated),this.listenTo(n,"destroy remove",this.remove),this.listenTo(n,"change:value",this.modelValueChanged),this.listenTo(n,"targetUpdated",this.targetUpdated),this.listenTo(n,"change:visible",this.updateVisibility),this.listenTo(n,"change:status",this.updateStatus),this.events["click ."+r+"clear"]="clear",this.delegateEvents();var o=this.init&&this.init.bind(this);o&&o()},updateStatus:function(){var t=this.model.get("status"),e=this.pfx,n=this.ppfx,i=this.config,r=n+"four-color",o=n+"color-warn",s=this.$el.children("."+e+"label"),a=this.getClearEl().style;switch(s.removeClass(r+" "+o),a.display="none",t){case"updated":s.addClass(r),i.clearProperties&&(a.display="inline");break;case"computed":s.addClass(o)}},clear:function(){this.getTargetModel().removeStyle(this.model.get("property")),this.targetUpdated()},getClearEl:function(){return this.el.querySelector("."+this.pfx+"clear")},getTarget:function(){return this.getTargetModel()},getTargetModel:function(){return this.propTarget&&this.propTarget.model},getHelperModel:function(){return this.propTarget&&this.propTarget.helper},inputValueChanged:function(t){t&&t.stopPropagation(),this.model.setValue(this.getInputValue(),1,{fromInput:1}),this.elementUpdated()},elementUpdated:function(){this.model.set("status","updated");var t=this.model.parent,e=t&&t.view;e&&e.elementUpdated()},setStatus:function(t){this.model.set("status",t);var e=this.model.parent;e&&e.set("status",t)},targetUpdated:function(){if(this.checkVisibility()){var t=this.config,e=t.em,n=this.model,i="",r="",o=this.getTargetValue({ignoreDefault:1}),s=n.getDefaultValue(),a=this.getComputedValue();o?(i=o,t.highlightChanged&&(r="updated")):a&&t.showComputed&&a!=s?(i=a,t.highlightComputed&&(r="computed")):(i=s,r=""),n.setValue(i,0,{fromTarget:1}),this.setStatus(r),e&&(e.trigger("styleManager:change",this),e.trigger("styleManager:change:"+n.get("property"),this))}},checkVisibility:function(){var t=1;return this.config.hideNotStylable&&(this.isTargetStylable()&&this.isComponentStylable()?this.show():(this.hide(),t=0),this.sector&&this.sector.trigger("updateVisibility")),t},getTargetValue:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.model,i=this.getTargetModel(),r=this.customValue;if(!i)return t;if(t=i.getStyle()[n.get("property")],t||e.ignoreDefault||(t=n.getDefaultValue()),"function"==typeof r&&!e.ignoreCustomValue){var o=n.collection.indexOf(n),s=r(this,o);s&&(t=s)}return t},getComputedValue:function(){var t=this.propTarget,e=t.computed||{},n=t.computedDefault||{},i=this.config.avoidComputed||[],o=this.model.get("property"),s=i.indexOf(o)<0,a=e[o],l=n[(0,r.camelCase)(o)];return e&&s&&l!==a&&a},getInputValue:function(){var t=this.getInputEl();return t?t.value:""},modelValueChanged:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.config.em,r=this.model,o=r.getFullValue(),s=this.getTarget(),a=this.onChange;n.fromInput||this.setValue(o),s&&this.isTargetStylable()&&this.isComponentStylable()&&(n.fromTarget||(a&&!n.fromParent?a(s,this,n):this.updateTargetStyle(o,null,n)),i&&(i.trigger("component:update",s),i.trigger("component:styleUpdate",s),i.trigger("component:styleUpdate:"+r.get("property"),s)))},updateTargetStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e||this.model.get("property"),r=this.getTarget(),o=r.getStyle();t?o[i]=t:delete o[i],r.setStyle(o,n);var s=this.getHelperModel();s&&s.setStyle(o,n)},isTargetStylable:function(t){this.model.get("id");var e=t||this.getTarget(),n=this.model,r=n.get("property"),o=n.get("toRequire"),s=e.get("unstylable"),a=e.get("stylable-require"),l=e.get("stylable");return(0,i.isArray)(l)&&(l=l.indexOf(r)>=0),(0,i.isArray)(s)&&(l=s.indexOf(r)<0),o&&(l=a&&a.indexOf(r)>=0||!t),l},isComponentStylable:function(){var t=this.em,e=t&&t.get("selectedComponent");return!e||this.isTargetStylable(e)},setRawValue:function(t){this.setValue(this.model.parseValue(t))},setValue:function(t){var e=this.model,n=t||e.getDefaultValue(),i=this.getInputEl();i&&(i.value=n)},getInputEl:function(){return this.input||(this.input=this.el.querySelector("input")),this.input},updateVisibility:function(){this.el.style.display=this.model.get("visible")?"block":"none"},show:function(){this.model.set("visible",1)},hide:function(){this.model.set("visible",0)},cleanValue:function(){this.setValue("")},render:function(){var t=this.pfx,e=this.model,n=this.el;n.innerHTML=this.template(e),n.className=t+"property "+t+e.get("type"),this.updateStatus();var i=this.onRender&&this.onRender.bind(this);i&&i(),this.setValue(e.get("value"),{targetUpdate:1})}})}).call(e,n(0))},function(t,e,n){!function(e,n){t.exports=n()}(0,function(){"use strict";function t(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function e(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function n(t,n){return e(t).appendChild(n)}function i(t,e,n,i){var r=document.createElement(t);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var o=0;o
=e)return s+(e-o);s+=a-o,s+=n-s%n,o=a+1}}function d(t,e){for(var n=0;n=e)return i+Math.min(s,e-r);if(r+=o-i,r+=n-r%n,i=o+1,r>=e)return i}}function p(t){for(;qs.length<=t;)qs.push(g(qs)+" ");return qs[t]}function g(t){return t[t.length-1]}function v(t,e){for(var n=[],i=0;i""&&(t.toUpperCase()!=t.toLowerCase()||Ks.test(t))}function w(t,e){return e?!!(e.source.indexOf("\\w")>-1&&x(t))||e.test(t):x(t)}function C(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function k(t){return t.charCodeAt(0)>=768&&Gs.test(t)}function S(t,e,n){for(;(n<0?e>0:en?-1:1;;){if(e==n)return e;var r=(e+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+i}}function M(t,e,n){var o=this;this.input=n,o.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=i("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=r("div",null,"CodeMirror-code"),o.selectionDiv=i("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=i("div",null,"CodeMirror-cursors"),o.measure=i("div",null,"CodeMirror-measure"),o.lineMeasure=i("div",null,"CodeMirror-measure"),o.lineSpace=r("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var s=r("div",[o.lineSpace],"CodeMirror-lines");o.mover=i("div",[s],null,"position: relative"),o.sizer=i("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=i("div",null,null,"position: absolute; height: "+Vs+"px; width: 1px;"),o.gutters=i("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=i("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=i("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),ms&&ys<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),bs||fs&&Ps||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,n.init(o)}function E(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(e=t.first&&en?_(n,E(t,n).text.length):B(e,E(t,e.line).text.length)}function B(t,e){var n=t.ch;return null==n||n>e?_(t.line,e):n<0?_(t.line,0):t}function W(t,e){for(var n=[],i=0;i=e:o.to>e);(i||(i=[])).push(new K(s,o.from,l?null:o.to))}}return i}function Z(t,e,n){var i;if(t)for(var r=0;r=e:o.to>e);if(a||o.from==e&&"bookmark"==s.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(s.inclusiveLeft?o.from<=e:o.from0&&a)for(var w=0;w0)){var u=[l,1],h=F(c.from,a.from),f=F(c.to,a.to);(h<0||!s.inclusiveLeft&&!h)&&u.push({from:c.from,to:a.from}),(f>0||!s.inclusiveRight&&!f)&&u.push({from:a.to,to:c.to}),r.splice.apply(r,u),l+=u.length-3}}return r}function nt(t){var e=t.markedSpans;if(e){for(var n=0;n=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(c.to,n)>=0:F(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(c.from,i)<=0:F(c.from,i)<0)))return!0}}}function ht(t){for(var e;e=lt(t);)t=e.find(-1,!0).line;return t}function dt(t){for(var e;e=ct(t);)t=e.find(1,!0).line;return t}function ft(t){for(var e,n;e=ct(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function pt(t,e){var n=E(t,e),i=ht(n);return n==i?e:O(i)}function gt(t,e){if(e>t.lastLine())return e;var n,i=E(t,e);if(!vt(t,i))return e;for(;n=ct(i);)i=n.find(1,!0).line;return O(i)+1}function vt(t,e){var n=Xs&&e.markedSpans;if(n)for(var i=void 0,r=0;re.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function wt(t,e,n,i){if(!t)return i(e,n,"ltr",0);for(var r=!1,o=0;oe||e==n&&s.to==e)&&(i(Math.max(s.from,e),Math.min(s.to,n),1==s.level?"rtl":"ltr",o),r=!0)}r||i(e,n,"ltr")}function Ct(t,e,n){var i;Js=null;for(var r=0;re)return r;o.to==e&&(o.from!=o.to&&"before"==n?i=r:Js=r),o.from==e&&(o.from!=o.to&&"before"!=n?i=r:Js=r)}return null!=i?i:Js}function kt(t,e){var n=t.order;return null==n&&(n=t.order=Zs(t.text,e)),n}function St(t,e){return t._handlers&&t._handlers[e]||Qs}function Tt(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var i=t._handlers,r=i&&i[e];if(r){var o=d(r,n);o>-1&&(i[e]=r.slice(0,o).concat(r.slice(o+1)))}}}function Mt(t,e){var n=St(t,e);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function Lt(t){t.prototype.on=function(t,e){ta(this,t,e)},t.prototype.off=function(t,e){Tt(this,t,e)}}function Ot(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Nt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function It(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Dt(t){Ot(t),Nt(t)}function _t(t){return t.target||t.srcElement}function Ft(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),As&&t.ctrlKey&&1==e&&(e=3),e}function zt(t){if(null==Rs){var e=i("span","");n(t,i("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Rs=e.offsetWidth<=1&&e.offsetHeight>2&&!(ms&&ys<8))}var r=Rs?i("span",""):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function $t(t){if(null!=Hs)return Hs;var i=n(t,document.createTextNode("AخA")),r=Is(i,0,1).getBoundingClientRect(),o=Is(i,1,2).getBoundingClientRect();return e(t),!(!r||r.left==r.right)&&(Hs=o.right-r.right<3)}function Rt(t){if(null!=oa)return oa;var e=n(t,i("span","x")),r=e.getBoundingClientRect(),o=Is(e,0,1).getBoundingClientRect();return oa=Math.abs(r.left-o.left)>1}function Ht(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),sa[t]=e}function Vt(t,e){aa[t]=e}function jt(t){if("string"==typeof t&&aa.hasOwnProperty(t))t=aa[t];else if(t&&"string"==typeof t.name&&aa.hasOwnProperty(t.name)){var e=aa[t.name];"string"==typeof e&&(e={name:e}),t=b(e,t),t.name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return jt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return jt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Bt(t,e){e=jt(e);var n=sa[e.name];if(!n)return Bt(t,"text/plain");var i=n(t,e);if(la.hasOwnProperty(e.name)){var r=la[e.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=e.name,e.helperType&&(i.helperType=e.helperType),e.modeProps)for(var s in e.modeProps)i[s]=e.modeProps[s];return i}function Wt(t,e){u(e,la.hasOwnProperty(t)?la[t]:la[t]={})}function Ut(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var r=e[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function qt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Kt(t,e,n){return!t.startState||t.startState(e,n)}function Gt(t,e,n,i){var r=[t.state.modeGen],o={};ne(t,e.text,t.doc.mode,n,function(t,e){return r.push(t,e)},o,i);for(var s=n.state,a=0;at&&r.splice(l,1,t,r[l+1],i),l+=2,c=Math.min(t,i)}if(e)if(a.opaque)r.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;nt.options.maxHighlightLength&&Ut(t.doc.mode,i.state),o=Gt(t,e,i);r&&(i.state=r),e.stateAfter=i.save(!r),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function Xt(t,e,n){var i=t.doc,r=t.display;if(!i.mode.startState)return new ha(i,!0,e);var o=ie(t,e,n),s=o>i.first&&E(i,o-1).stateAfter,a=s?ha.fromSaved(i,s,o):new ha(i,Kt(i.mode),o);return i.iter(o,e,function(n){Jt(t,n.text,a);var i=a.line;n.stateAfter=i==e-1||i%5==0||i>=r.viewFrom&&ie.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}function te(t,e,n,i){var r,o=t.doc,s=o.mode;e=j(o,e);var a,l=E(o,e.line),c=Xt(t,e.line,n),u=new ca(l.text,t.options.tabSize,c);for(i&&(a=[]);(i||u.post.options.maxHighlightLength?(a=!1,s&&Jt(t,e,i,h.pos),h.pos=e.length,l=null):l=ee(Qt(n,h,i.state,d),o),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!a||u!=l){for(;cs;--a){if(a<=o.first)return o.first;var l=E(o,a-1),c=l.stateAfter;if(c&&(!n||a+(c instanceof ua?c.lookAhead:0)<=o.modeFrontier))return a;var u=h(l.text,null,t.options.tabSize);(null==r||i>u)&&(r=a-1,i=u)}return r}function re(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontiern;i--){var r=E(t,i).stateAfter;if(r&&(!(r instanceof ua)||i+r.lookAhead1&&!/ /.test(t))return t;for(var n=e,i="",r=0;rc&&h.from<=c));d++);if(h.to>=u)return t(n,i,r,o,s,a,l);t(n,i.slice(0,h.to-c),r,o,null,a,l),o=null,i=i.slice(h.to-c),c=h.to}}}function fe(t,e,n,i){var r=!i&&n.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!i&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function pe(t,e,n){var i=t.markedSpans,r=t.text,o=0;if(i)for(var s,a,l,c,u,h,d,f=r.length,p=0,g=1,v="",m=0;;){if(m==p){l=c=u=h=a="",d=null,m=1/0;for(var y=[],b=void 0,x=0;xp||C.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&m>w.to&&(m=w.to,c=""),C.className&&(l+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&w.from==p&&(u+=" "+C.startStyle),C.endStyle&&w.to==m&&(b||(b=[])).push(C.endStyle,w.to),C.title&&!h&&(h=C.title),C.collapsed&&(!d||st(d.marker,C)<0)&&(d=w)):w.from>p&&m>w.from&&(m=w.from)}if(b)for(var k=0;k=f)break;for(var T=Math.min(f,m);;){if(v){var M=p+v.length;if(!d){var E=M>T?v.slice(0,T-p):v;e.addToken(e,E,s?s+l:l,u,p+E.length==m?c:"",h,a)}if(M>=T){v=v.slice(T-p),p=T;break}p=M,u=""}v=r.slice(o,o=n[g++]),s=ae(n[g++],e.cm.options)}}else for(var P=1;P2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Be(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var i=0;in)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function We(t,e){e=ht(e);var i=O(e),r=t.display.externalMeasured=new ge(t.doc,e,i);r.lineN=i;var o=r.built=le(t,r);return r.text=o.pre,n(t.display.lineMeasure,o.pre),r}function Ue(t,e,n,i){return Ge(t,Ke(t,e),n,i)}function qe(t,e){if(e>=t.display.viewFrom&&e=n.lineN&&ee)&&(o=l-a,r=o-1,e>=l&&(s="right")),null!=r){if(i=t[c+2],a==l&&n==(i.insertLeft?"left":"right")&&(s=n),"left"==n&&0==r)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)i=t[2+(c-=3)],s="left";if("right"==n&&r==l-a)for(;c=0&&(n=t[r]).left==n.right;r--);return n}function Je(t,e,n,i){var r,o=Ye(e.map,n,i),s=o.node,a=o.start,l=o.end,c=o.collapse;if(3==s.nodeType){for(var u=0;u<4;u++){for(;a&&k(e.line.text.charAt(o.coverStart+a));)--a;for(;o.coverStart+l0&&(c=i="right");var h;r=t.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==i?h.length-1:0]:s.getBoundingClientRect()}if(ms&&ys<9&&!a&&(!r||!r.left&&!r.right)){var d=s.parentNode.getClientRects()[0];r=d?{left:d.left,right:d.left+xn(t.display),top:d.top,bottom:d.bottom}:ba}for(var f=r.top-e.rect.top,p=r.bottom-e.rect.top,g=(f+p)/2,v=e.view.measure.heights,m=0;m=i.text.length?(c=i.text.length,u="before"):c<=0&&(c=0,u="after"),!l)return s("before"==u?c-1:c,"before"==u);var h=Ct(l,c,u),d=Js,f=a(c,h,"before"==u);return null!=d&&(f.other=a(c,d,"before"!=u)),f}function un(t,e){var n=0;e=j(t.doc,e),t.options.lineWrapping||(n=xn(t.display)*e.ch);var i=E(t.doc,e.line),r=yt(i)+Fe(t.display);return{left:n,right:n,top:r,bottom:r+i.height}}function hn(t,e,n,i,r){var o=_(t,e,n);return o.xRel=r,i&&(o.outside=!0),o}function dn(t,e,n){var i=t.doc;if((n+=t.display.viewOffset)<0)return hn(i.first,0,null,!0,-1);var r=N(i,n),o=i.first+i.size-1;if(r>o)return hn(i.first+i.size-1,E(i,o).text.length,null,!0,1);e<0&&(e=0);for(var s=E(i,r);;){var a=vn(t,s,r,e,n),l=ct(s),c=l&&l.find(0,!0);if(!l||!(a.ch>c.from.ch||a.ch==c.from.ch&&a.xRel>0))return a;r=O(s=c.to.line)}}function fn(t,e,n,i){i-=on(e);var r=e.text.length,o=T(function(e){return Ge(t,n,e-1).bottom<=i},r,0);return r=T(function(e){return Ge(t,n,e).top>i},o,r),{begin:o,end:r}}function pn(t,e,n,i){return n||(n=Ke(t,e)),fn(t,e,n,sn(t,e,Ge(t,n,i),"line").top)}function gn(t,e,n,i){return!(t.bottom<=n)&&(t.top>n||(i?t.left:t.right)>e)}function vn(t,e,n,i,r){r-=yt(e);var o=Ke(t,e),s=on(e),a=0,l=e.text.length,c=!0,u=kt(e,t.doc.direction);if(u){var h=(t.options.lineWrapping?yn:mn)(t,e,n,o,u,i,r);c=1!=h.level,a=c?h.from:h.to-1,l=c?h.to:h.from-1}var d,f,p=null,g=null,v=T(function(e){var n=Ge(t,o,e);return n.top+=s,n.bottom+=s,!!gn(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(p=e,g=n),!0)},a,l),m=!1;if(g){var y=i-g.left=x.bottom}return v=S(e.text,v,1),hn(n,v,f,m,i-d)}function mn(t,e,n,i,r,o,s){var a=T(function(a){var l=r[a],c=1!=l.level;return gn(cn(t,_(n,c?l.to:l.from,c?"before":"after"),"line",e,i),o,s,!0)},0,r.length-1),l=r[a];if(a>0){var c=1!=l.level,u=cn(t,_(n,c?l.from:l.to,c?"after":"before"),"line",e,i);gn(u,o,s,!0)&&u.top>s&&(l=r[a-1])}return l}function yn(t,e,n,i,r,o,s){var a=fn(t,e,i,s),l=a.begin,c=a.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,h=null,d=0;d=c||f.to<=l)){var p=1!=f.level,g=Ge(t,i,p?Math.min(c,f.to)-1:Math.max(l,f.from)).right,v=gv)&&(u=f,h=v)}}return u||(u=r[r.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function bn(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==pa){pa=i("pre");for(var r=0;r<49;++r)pa.appendChild(document.createTextNode("x")),pa.appendChild(i("br"));pa.appendChild(document.createTextNode("x"))}n(t.measure,pa);var o=pa.offsetHeight/50;return o>3&&(t.cachedTextHeight=o),e(t.measure),o||1}function xn(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=i("span","xxxxxxxxxx"),r=i("pre",[e]);n(t.measure,r);var o=e.getBoundingClientRect(),s=(o.right-o.left)/10;return s>2&&(t.cachedCharWidth=s),s||10}function wn(t){for(var e=t.display,n={},i={},r=e.gutters.clientLeft,o=e.gutters.firstChild,s=0;o;o=o.nextSibling,++s)n[t.options.gutters[s]]=o.offsetLeft+o.clientLeft+r,i[t.options.gutters[s]]=o.clientWidth;return{fixedPos:Cn(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function Cn(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function kn(t){var e=bn(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/xn(t.display)-3);return function(r){if(vt(t.doc,r))return 0;var o=0;if(r.widgets)for(var s=0;s=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,i=0;i=t.display.viewTo||a.to().line0?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function In(t){t.state.focused||(t.display.input.focus(),_n(t))}function Dn(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,Fn(t))},100)}function _n(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(Mt(t,"focus",t,e),t.state.focused=!0,a(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),bs&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Nn(t))}function Fn(t,e){t.state.delayingBlurEvent||(t.state.focused&&(Mt(t,"blur",t,e),t.state.focused=!1,Fs(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function zn(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=0;i.005||l<-.005)&&(L(r.line,o),$n(r.line),r.rest))for(var c=0;c=s&&(o=N(e,yt(E(e,l))-t.wrapper.clientHeight),s=l)}return{from:o,to:Math.max(s,o+1)}}function Hn(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=Cn(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,o=i+"px",s=0;s(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Ts){var s=i("div","",null,"position: absolute;\n top: "+(e.top-n.viewOffset-Fe(t.display))+"px;\n height: "+(e.bottom-e.top+Re(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(s),s.scrollIntoView(o),t.display.lineSpace.removeChild(s)}}}function Bn(t,e,n,i){null==i&&(i=0);var r;t.options.lineWrapping||e!=n||(e=e.ch?_(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e,n="before"==e.sticky?_(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var s=!1,a=cn(t,e),l=n&&n!=e?cn(t,n):a;r={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i};var c=Un(t,r),u=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=c.scrollTop&&(Zn(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(s=!0)),null!=c.scrollLeft&&(ti(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(s=!0)),!s)break}return r}function Wn(t,e){var n=Un(t,e);null!=n.scrollTop&&Zn(t,n.scrollTop),null!=n.scrollLeft&&ti(t,n.scrollLeft)}function Un(t,e){var n=t.display,i=bn(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Ve(t),s={};e.bottom-e.top>o&&(e.bottom=e.top+o);var a=t.doc.height+ze(n),l=e.topa-i;if(e.topr+o){var u=Math.min(e.top,(c?a:e.bottom)-o);u!=r&&(s.scrollTop=u)}var h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft,d=He(t)-(t.options.fixedGutter?n.gutters.offsetWidth:0),f=e.right-e.left>d;return f&&(e.right=e.left+d),e.left<10?s.scrollLeft=0:e.leftd+h-3&&(s.scrollLeft=e.right+(f?0:10)-d),s}function qn(t,e){null!=e&&(Xn(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Kn(t){Xn(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Gn(t,e,n){null==e&&null==n||Xn(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function Yn(t,e){Xn(t),t.curOp.scrollToPos=e}function Xn(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;Jn(t,un(t,e.from),un(t,e.to),e.margin)}}function Jn(t,e,n,i){var r=Un(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-i,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+i});Gn(t,r.scrollLeft,r.scrollTop)}function Zn(t,e){Math.abs(t.doc.scrollTop-e)<2||(fs||Li(t,{top:e}),Qn(t,e,!0),fs&&Li(t),ki(t,100))}function Qn(t,e,n){e=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function ti(t,e,n,i){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!i||(t.doc.scrollLeft=e,Hn(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function ei(t){var e=t.display,n=e.gutters.offsetWidth,i=Math.round(t.doc.height+ze(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Re(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}function ni(t,e){e||(e=ei(t));var n=t.display.barWidth,i=t.display.barHeight;ii(t,e);for(var r=0;r<4&&n!=t.display.barWidth||i!=t.display.barHeight;r++)n!=t.display.barWidth&&t.options.lineWrapping&&zn(t),ii(t,ei(t)),n=t.display.barWidth,i=t.display.barHeight}function ii(t,e){var n=t.display,i=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}function ri(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Fs(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Ca[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),ta(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?ti(t,e):Zn(t,e)},t),t.display.scrollbars.addClass&&a(t.display.wrapper,t.display.scrollbars.addClass)}function oi(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.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:++ka},me(t.curOp)}function si(t){be(t.curOp,function(t){for(var e=0;e=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new Sa(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function ci(t){t.updatedDisplay=t.mustUpdate&&Pi(t.cm,t.update)}function ui(t){var e=t.cm,n=e.display;t.updatedDisplay&&zn(e),t.barMeasure=ei(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ue(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+Re(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-He(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function hi(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLefte)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)Xs&&pt(t.doc,e)r.viewFrom?bi(t):(r.viewFrom+=i,r.viewTo+=i);else if(e<=r.viewFrom&&n>=r.viewTo)bi(t);else if(e<=r.viewFrom){var o=xi(t,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):bi(t)}else if(n>=r.viewTo){var s=xi(t,e,e,-1);s?(r.view=r.view.slice(0,s.index),r.viewTo=s.lineN):bi(t)}else{var a=xi(t,e,e,-1),l=xi(t,n,n+i,1);a&&l?(r.view=r.view.slice(0,a.index).concat(ve(t,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):bi(t)}var c=r.externalMeasured;c&&(n=r.lineN&&e=i.viewTo)){var o=i.view[Mn(t,e)];if(null!=o.node){var s=o.changes||(o.changes=[]);-1==d(s,n)&&s.push(n)}}}function bi(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function xi(t,e,n,i){var r,o=Mn(t,e),s=t.display.view;if(!Xs||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var a=t.display.viewFrom,l=0;l0){if(o==s.length-1)return null;r=a+s[o].size-e,o++}else r=a-e;e+=r,n+=r}for(;pt(t.doc,n)!=n;){if(o==(i<0?0:s.length-1))return null;n+=i*s[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function wi(t,e,n){var i=t.display;0==i.view.length||e>=i.viewTo||n<=i.viewFrom?(i.view=ve(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=ve(t,e,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,Mn(t,n)))),i.viewTo=n}function Ci(t){for(var e=t.display.view,n=0,i=0;i=t.display.viewTo)){var n=+new Date+t.options.workTime,i=Xt(t,e.highlightFrontier),r=[];e.iter(i.line,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(i.line>=t.display.viewFrom){var s=o.styles,a=o.text.length>t.options.maxHighlightLength?Ut(e.mode,i.state):null,l=Gt(t,o,i,!0);a&&(i.state=a),o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var h=!s||s.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&dn)return ki(t,t.options.workDelay),!0}),e.highlightFrontier=i.line,e.modeFrontier=Math.max(e.modeFrontier,i.line),r.length&&fi(t,function(){for(var e=0;e=i.viewFrom&&n.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Ci(t))return!1;Vn(t)&&(bi(t),n.dims=wn(t));var o=r.first+r.size,s=Math.max(n.visible.from-t.options.viewportMargin,r.first),a=Math.min(o,n.visible.to+t.options.viewportMargin);i.viewFroma&&i.viewTo-a<20&&(a=Math.min(o,i.viewTo)),Xs&&(s=pt(t.doc,s),a=gt(t.doc,a));var l=s!=i.viewFrom||a!=i.viewTo||i.lastWrapHeight!=n.wrapperHeight||i.lastWrapWidth!=n.wrapperWidth;wi(t,s,a),i.viewOffset=yt(E(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var c=Ci(t);if(!l&&0==c&&!n.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var u=Mi(t);return c>4&&(i.lineDiv.style.display="none"),Oi(t,i.updateLineNumbers,n.dims),c>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Ei(u),e(i.cursorDiv),e(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,l&&(i.lastWrapHeight=n.wrapperHeight,i.lastWrapWidth=n.wrapperWidth,ki(t,400)),i.updateLineNumbers=null,!0}function Ai(t,e){for(var n=e.viewport,i=!0;(i&&t.options.lineWrapping&&e.oldDisplayWidth!=He(t)||(n&&null!=n.top&&(n={top:Math.min(t.doc.height+ze(t.display)-Ve(t),n.top)}),e.visible=Rn(t.display,t.doc,n),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&Pi(t,e);i=!1){zn(t);var r=ei(t);En(t),ni(t,r),Ii(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Li(t,e){var n=new Sa(t,e);if(Pi(t,n)){zn(t),Ai(t,n);var i=ei(t);En(t),ni(t,i),Ii(t,i),n.finish()}}function Oi(t,n,i){function r(e){var n=e.nextSibling;return bs&&As&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var o=t.display,s=t.options.lineNumbers,a=o.lineDiv,l=a.firstChild,c=o.view,u=o.viewFrom,h=0;h-1&&(p=!1),Ce(t,f,u,i)),p&&(e(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(D(t.options,u)))),l=f.node.nextSibling}else{var g=Le(t,f,u,i);a.insertBefore(g,l)}u+=f.size}for(;l;)l=r(l)}function Ni(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function Ii(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+Re(t)+"px"}function Di(t){var n=t.display.gutters,r=t.options.gutters;e(n);for(var o=0;o-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function Fi(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function zi(t){var e=Fi(t);return e.x*=Ma,e.y*=Ma,e}function $i(t,e){var n=Fi(e),i=n.x,r=n.y,o=t.display,s=o.scroller,a=s.scrollWidth>s.clientWidth,l=s.scrollHeight>s.clientHeight;if(i&&a||r&&l){if(r&&As&&bs)t:for(var c=e.target,u=o.view;c!=s;c=c.parentNode)for(var h=0;h=0){var s=H(o.from(),r.from()),a=R(o.to(),r.to()),l=o.empty()?r.from()==r.head:o.from()==o.head;i<=e&&--e,t.splice(--i,2,new Pa(l?a:s,l?s:a))}}return new Ea(t,e)}function Hi(t,e){return new Ea([new Pa(t,e||t)],0)}function Vi(t){return t.text?_(t.from.line+t.text.length-1,g(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function ji(t,e){if(F(t,e.from)<0)return t;if(F(t,e.to)<=0)return Vi(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=Vi(e).ch-e.to.ch),_(n,i)}function Bi(t,e){for(var n=[],i=0;i1&&t.remove(a.line+1,p-1),t.insert(a.line+1,y)}xe(t,"change",t,e)}function Xi(t,e,n){function i(t,r,o){if(t.linked)for(var s=0;s1&&!t.done[t.done.length-2].ranges?(t.done.pop(),g(t.done)):void 0}function rr(t,e,n,i){var r=t.history;r.undone.length=0;var o,s,a=+new Date;if((r.lastOp==i||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&r.lastModTime>a-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))&&(o=ir(r,r.lastOp==i)))s=g(o.changes),0==F(e.from,e.to)&&0==F(e.from,s.to)?s.to=Vi(e):o.changes.push(er(t,e));else{var l=g(r.done);for(l&&l.ranges||ar(t.sel,r.done),o={changes:[er(t,e)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=e.origin,s||Mt(t,"historyAdded")}function or(t,e,n,i){var r=e.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function sr(t,e,n,i){var r=t.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||or(t,o,g(r.done),e))?r.done[r.done.length-1]=e:ar(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&!1!==i.clearRedo&&nr(r.undone)}function ar(t,e){var n=g(e);n&&n.ranges&&n.equals(t)||e.push(t)}function lr(t,e,n,i){var r=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),function(n){n.markedSpans&&((r||(r=e["spans_"+t.id]={}))[o]=n.markedSpans),++o})}function cr(t){if(!t)return null;for(var e,n=0;n-1&&(g(a)[h]=c[h],delete c[h])}}}return i}function fr(t,e,n,i){if(i){var r=t.anchor;if(n){var o=F(e,r)<0;o!=F(n,r)<0?(r=e,e=n):o!=F(e,n)<0&&(e=n)}return new Pa(r,e)}return new Pa(n||e,e)}function pr(t,e,n,i,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),xr(t,new Ea([fr(t.sel.primary(),e,n,r)],0),i)}function gr(t,e,n){for(var i=[],r=t.cm&&(t.cm.display.shift||t.extend),o=0;o=e.ch:a.to>e.ch))){if(r&&(Mt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--s;continue}break}if(!l.atomic)continue;if(n){var c=l.find(i<0?1:-1),u=void 0;if((i<0?l.inclusiveRight:l.inclusiveLeft)&&(c=Er(t,c,-i,c&&c.line==e.line?o:null)),c&&c.line==e.line&&(u=F(c,n))&&(i<0?u<0:u>0))return Tr(t,c,e,i,r)}var h=l.find(i<0?-1:1);return(i<0?l.inclusiveLeft:l.inclusiveRight)&&(h=Er(t,h,i,h.line==e.line?o:null)),h?Tr(t,h,e,i,r):null}}return e}function Mr(t,e,n,i,r){var o=i||1,s=Tr(t,e,n,o,r)||!r&&Tr(t,e,n,o,!0)||Tr(t,e,n,-o,r)||!r&&Tr(t,e,n,-o,!0);return s||(t.cantEdit=!0,_(t.first,0))}function Er(t,e,n,i){return n<0&&0==e.ch?e.line>t.first?j(t,_(e.line-1)):null:n>0&&e.ch==(i||E(t,e.line)).text.length?e.line=0;--r)Or(t,{from:i[r].from,to:i[r].to,text:r?[""]:e.text,origin:e.origin});else Or(t,e)}}function Or(t,e){if(1!=e.text.length||""!=e.text[0]||0!=F(e.from,e.to)){var n=Bi(t,e);rr(t,e,n,t.cm?t.cm.curOp.id:NaN),Dr(t,e,n,Q(t,e));var i=[];Xi(t,function(t,n){n||-1!=d(i,t.history)||(Rr(t.history,e),i.push(t.history)),Dr(t,e,null,Q(t,e))})}}function Nr(t,e,n){if(!t.cm||!t.cm.state.suppressEdits||n){for(var i,r=t.history,o=t.sel,s="undo"==e?r.done:r.undone,a="undo"==e?r.undone:r.done,l=0;l=0;--h){var f=function(n){var r=i.changes[n];if(r.origin=e,u&&!Ar(t,r,!1))return s.length=0,{};c.push(er(t,r));var o=n?Bi(t,r):g(s);Dr(t,r,o,hr(t,r)),!n&&t.cm&&t.cm.scrollIntoView({from:r.from,to:Vi(r)});var a=[];Xi(t,function(t,e){e||-1!=d(a,t.history)||(Rr(t.history,r),a.push(t.history)),Dr(t,r,null,hr(t,r))})}(h);if(f)return f.v}}}}function Ir(t,e){if(0!=e&&(t.first+=e,t.sel=new Ea(v(t.sel.ranges,function(t){return new Pa(_(t.anchor.line+e,t.anchor.ch),_(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){mi(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;it.lastLine())){if(e.from.lineo&&(e={from:e.from,to:_(o,E(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=P(t,e.from,e.to),n||(n=Bi(t,e)),t.cm?_r(t.cm,e,i):Yi(t,e,i),wr(t,n,Bs)}}function _r(t,e,n){var i=t.doc,r=t.display,o=e.from,s=e.to,a=!1,l=o.line;t.options.lineWrapping||(l=O(ht(E(i,o.line))),i.iter(l,s.line+1,function(t){if(t==r.maxLine)return a=!0,!0})),i.sel.contains(e.from,e.to)>-1&&Pt(t),Yi(i,e,n,kn(t)),t.options.lineWrapping||(i.iter(l,o.line+e.text.length,function(t){var e=bt(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,a=!1)}),a&&(t.curOp.updateMaxLine=!0)),re(i,o.line),ki(t,400);var c=e.text.length-(s.line-o.line)-1;e.full?mi(t):o.line!=s.line||1!=e.text.length||Gi(t.doc,e)?mi(t,o.line,s.line+1,c):yi(t,o.line,"text");var u=At(t,"changes"),h=At(t,"change");if(h||u){var d={from:o,to:s,text:e.text,removed:e.removed,origin:e.origin};h&&xe(t,"change",t,d),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}function Fr(t,e,n,i,r){if(i||(i=n),F(i,n)<0){var o;o=[i,n],n=o[0],i=o[1]}"string"==typeof e&&(e=t.splitLines(e)),Lr(t,{from:n,to:i,text:e,origin:r})}function zr(t,e,n,i){n0||0==a&&!1!==s.clearWhenEmpty)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=r("span",[s.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(ut(t,e.line,e,n,s)||e.line!=n.line&&ut(t,n.line,e,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");q()}s.addToHistory&&rr(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var l,c=e.line,h=t.cm;if(t.iter(c,n.line+1,function(t){h&&s.collapsed&&!h.options.lineWrapping&&ht(t)==h.display.maxLine&&(l=!0),s.collapsed&&c!=e.line&&L(t,0),X(t,new K(s,c==e.line?e.ch:null,c==n.line?n.ch:null)),++c}),s.collapsed&&t.iter(e.line,n.line+1,function(e){vt(t,e)&&L(e,0)}),s.clearOnEnter&&ta(s,"beforeCursorEnter",function(){return s.clear()}),s.readOnly&&(U(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),s.collapsed&&(s.id=++La,s.atomic=!0),h){if(l&&(h.curOp.updateMaxLine=!0),s.collapsed)mi(h,e.line,n.line+1);else if(s.className||s.title||s.startStyle||s.endStyle||s.css)for(var d=e.line;d<=n.line;d++)yi(h,d,"text");s.atomic&&kr(h.doc),xe(h,"markerAdded",h,s)}return s}function qr(t,e,n,i,r){i=u(i),i.shared=!1;var o=[Ur(t,e,n,i,r)],s=o[0],a=i.widgetNode;return Xi(t,function(t){a&&(i.widgetNode=a.cloneNode(!0)),o.push(Ur(t,j(t,e),j(t,n),i,r));for(var l=0;l-1)return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var l=t.dataTransfer.getData("Text");if(l){var c;if(e.state.draggingText&&!e.state.draggingText.copy&&(c=e.listSelections()),wr(e.doc,Hi(n,n)),c)for(var u=0;u=0;e--)Fr(t.doc,"",i[e].from,i[e].to,"+delete");Kn(t)})}function fo(t,e,n){var i=S(t.text,e+n,n);return i<0||i>t.text.length?null:i}function po(t,e,n){var i=fo(t,e.ch,n);return null==i?null:new _(e.line,i,n<0?"after":"before")}function go(t,e,n,i,r){if(t){var o=kt(n,e.doc.direction);if(o){var s,a=r<0?g(o):o[0],l=r<0==(1==a.level),c=l?"after":"before";if(a.level>0||"rtl"==e.doc.direction){var u=Ke(e,n);s=r<0?n.text.length-1:0;var h=Ge(e,u,s).top;s=T(function(t){return Ge(e,u,t).top==h},r<0==(1==a.level)?a.from:a.to-1,s),"before"==c&&(s=fo(n,s,1))}else s=r<0?a.to:a.from;return new _(i,s,c)}}return new _(i,r<0?n.text.length:0,r<0?"before":"after")}function vo(t,e,n,i){var r=kt(e,t.doc.direction);if(!r)return po(e,n,i);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Ct(r,n.ch,n.sticky),s=r[o];if("ltr"==t.doc.direction&&s.level%2==0&&(i>0?s.to>n.ch:s.from=s.from&&d>=u.begin)){var f=h?"before":"after";return new _(n.line,d,f)}}var p=function(t,e,i){for(var o=function(t,e){return e?new _(n.line,l(t,1),"before"):new _(n.line,t,"after")};t>=0&&t0==(1!=s.level),c=a?i.begin:l(i.end,-1);if(s.from<=c&&c0?u.end:l(u.begin,-1);return null==v||i>0&&v==e.text.length||!(g=p(i>0?0:r.length-1,i,c(v)))?null:g}function mo(t,e){var n=E(t.doc,e),i=ht(n);return i!=n&&(e=O(i)),go(!0,t,i,e,1)}function yo(t,e){var n=E(t.doc,e),i=dt(n);return i!=n&&(e=O(i)),go(!0,t,n,e,-1)}function bo(t,e){var n=mo(t,e.line),i=E(t.doc,n.line),r=kt(i,t.doc.direction);if(!r||0==r[0].level){var o=Math.max(0,i.text.search(/\S/)),s=e.line==n.line&&e.ch<=o&&e.ch;return _(n.line,s?0:o,n.sticky)}return n}function xo(t,e,n){if("string"==typeof e&&!(e=ja[e]))return!1;t.display.input.ensurePolled();var i=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),r=e(t)!=js}finally{t.display.shift=i,t.state.suppressEdits=!1}return r}function wo(t,e,n){for(var i=0;i-1&&(F((r=a.ranges[r]).from(),e)<0||e.xRel>0)&&(F(r.to(),e)>0||e.xRel<0)?Do(t,i,e,o):Fo(t,i,e,o)}function Do(t,e,n,i){var r=t.display,o=!1,s=pi(t,function(e){bs&&(r.scroller.draggable=!1),t.state.draggingText=!1,Tt(document,"mouseup",s),Tt(document,"mousemove",a),Tt(r.scroller,"dragstart",l),Tt(r.scroller,"drop",s),o||(Ot(e),i.addNew||pr(t.doc,n,null,null,i.extend),bs||ms&&9==ys?setTimeout(function(){document.body.focus(),r.input.focus()},20):r.input.focus())}),a=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},l=function(){return o=!0};bs&&(r.scroller.draggable=!0),t.state.draggingText=s,s.copy=!i.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),ta(document,"mouseup",s),ta(document,"mousemove",a),ta(r.scroller,"dragstart",l),ta(r.scroller,"drop",s),Dn(t),setTimeout(function(){return r.input.focus()},20)}function _o(t,e,n){if("char"==n)return new Pa(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new Pa(_(e.line,0),j(t.doc,_(e.line+1,0)));var i=n(t,e);return new Pa(i.from,i.to)}function Fo(t,e,n,i){function r(e){if(0!=F(m,e))if(m=e,"rectangle"==i.unit){for(var r=[],o=t.options.tabSize,s=h(E(c,n.line).text,n.ch,o),a=h(E(c,e.line).text,e.ch,o),l=Math.min(s,a),g=Math.max(s,a),v=Math.min(n.line,e.line),y=Math.min(t.lastLine(),Math.max(n.line,e.line));v<=y;v++){var b=E(c,v).text,x=f(b,l,o);l==g?r.push(new Pa(_(v,x),_(v,x))):b.length>x&&r.push(new Pa(_(v,x),_(v,f(b,g,o))))}r.length||r.push(new Pa(n,n)),xr(c,Ri(p.ranges.slice(0,d).concat(r),d),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var w,C=u,k=_o(t,e,i.unit),S=C.anchor;F(k.anchor,S)>0?(w=k.head,S=H(C.from(),k.anchor)):(w=k.anchor,S=R(C.to(),k.head));var T=p.ranges.slice(0);T[d]=zo(t,new Pa(j(c,S),w)),xr(c,Ri(T,d),Ws)}}function o(e){var n=++b,a=Tn(t,e,!0,"rectangle"==i.unit);if(a)if(0!=F(a,m)){t.curOp.focus=s(),r(a);var u=Rn(l,c);(a.line>=u.to||a.liney.bottom?20:0;h&&setTimeout(pi(t,function(){b==n&&(l.scroller.scrollTop+=h,o(e))}),50)}}function a(e){t.state.selectingText=!1,b=1/0,Ot(e),l.input.focus(),Tt(document,"mousemove",x),Tt(document,"mouseup",w),c.history.lastSelOrigin=null}var l=t.display,c=t.doc;Ot(e);var u,d,p=c.sel,g=p.ranges;if(i.addNew&&!i.extend?(d=c.sel.contains(n),u=d>-1?g[d]:new Pa(n,n)):(u=c.sel.primary(),d=c.sel.primIndex),"rectangle"==i.unit)i.addNew||(u=new Pa(n,n)),n=Tn(t,e,!0,!0),d=-1;else{var v=_o(t,n,i.unit);u=i.extend?fr(u,v.anchor,v.head,i.extend):v}i.addNew?-1==d?(d=g.length,xr(c,Ri(g.concat([u]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&"char"==i.unit&&!i.extend?(xr(c,Ri(g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),p=c.sel):vr(c,d,u,Ws):(d=0,xr(c,new Ea([u],0),Ws),p=c.sel);var m=n,y=l.wrapper.getBoundingClientRect(),b=0,x=pi(t,function(t){Ft(t)?o(t):a(t)}),w=pi(t,a);t.state.selectingText=w,ta(document,"mousemove",x),ta(document,"mouseup",w)}function zo(t,e){var n=e.anchor,i=e.head,r=E(t.doc,n.line);if(0==F(n,i)&&n.sticky==i.sticky)return e;var o=kt(r);if(!o)return e;var s=Ct(o,n.ch,n.sticky),a=o[s];if(a.from!=n.ch&&a.to!=n.ch)return e;var l=s+(a.from==n.ch==(1!=a.level)?0:1);if(0==l||l==o.length)return e;var c;if(i.line!=n.line)c=(i.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=Ct(o,i.ch,i.sticky),h=u-s||(i.ch-n.ch)*(1==a.level?-1:1);c=u==l-1||u==l?h<0:h>0}var d=o[l+(c?-1:0)],f=c==(1==d.level),p=f?d.from:d.to,g=f?"after":"before";return n.ch==p&&n.sticky==g?e:new Pa(new _(n.line,p,g),i)}function $o(t,e,n,i){var r,o;if(e.touches)r=e.touches[0].clientX,o=e.touches[0].clientY;else try{r=e.clientX,o=e.clientY}catch(e){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&Ot(e);var s=t.display,a=s.lineDiv.getBoundingClientRect();if(o>a.bottom||!At(t,n))return It(e);o-=a.top-s.viewOffset;for(var l=0;l=r){return Mt(t,n,t,N(t.doc,o),t.options.gutters[l],e),It(e)}}}function Ro(t,e){return $o(t,e,"gutterClick",!0)}function Ho(t,e){_e(t.display,e)||Vo(t,e)||Et(t,e,"contextmenu")||t.display.input.onContextMenu(e)}function Vo(t,e){return!!At(t,"gutterContextMenu")&&$o(t,e,"gutterContextMenu",!1)}function jo(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),en(t)}function Bo(t){Di(t),mi(t),Hn(t)}function Wo(t,e,n){if(!e!=!(n&&n!=Ga)){var i=t.display.dragFunctions,r=e?ta:Tt;r(t.display.scroller,"dragstart",i.start),r(t.display.scroller,"dragenter",i.enter),r(t.display.scroller,"dragover",i.over),r(t.display.scroller,"dragleave",i.leave),r(t.display.scroller,"drop",i.drop)}}function Uo(t){t.options.lineWrapping?(a(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Fs(t.display.wrapper,"CodeMirror-wrap"),xt(t)),Sn(t),mi(t),en(t),setTimeout(function(){return ni(t)},100)}function qo(t,e){var n=this;if(!(this instanceof qo))return new qo(t,e);this.options=e=e?u(e):{},u(Ya,e,!1),_i(e);var i=e.value;"string"==typeof i&&(i=new Da(i,e.mode,null,e.lineSeparator,e.direction)),this.doc=i;var r=new qo.inputStyles[e.inputStyle](this),o=this.display=new M(t,i,r);o.wrapper.CodeMirror=this,Di(this),jo(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ri(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new $s,keySeq:null,specialChars:null},e.autofocus&&!Ps&&o.input.focus(),ms&&ys<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ko(this),eo(),oi(this),this.curOp.forceUpdate=!0,Ji(this,i),e.autofocus&&!Ps||this.hasFocus()?setTimeout(c(_n,this),20):Fn(this);for(var s in Xa)Xa.hasOwnProperty(s)&&Xa[s](n,e[s],Ga);Vn(this),e.finishInit&&e.finishInit(this);for(var a=0;a400}var r=t.display;ta(r.scroller,"mousedown",pi(t,Lo)),ms&&ys<11?ta(r.scroller,"dblclick",pi(t,function(e){if(!Et(t,e)){var n=Tn(t,e);if(n&&!Ro(t,e)&&!_e(t.display,e)){Ot(e);var i=t.findWordAt(n);pr(t.doc,i.anchor,i.head)}}})):ta(r.scroller,"dblclick",function(e){return Et(t,e)||Ot(e)}),_s||ta(r.scroller,"contextmenu",function(e){return Ho(t,e)});var o,s={end:0};ta(r.scroller,"touchstart",function(e){if(!Et(t,e)&&!n(e)&&!Ro(t,e)){r.input.ensurePolled(),clearTimeout(o);var i=+new Date;r.activeTouch={start:i,moved:!1,prev:i-s.end<=300?s:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),ta(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),ta(r.scroller,"touchend",function(n){var o=r.activeTouch;if(o&&!_e(r,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var s,a=t.coordsChar(r.activeTouch,"page");s=!o.prev||i(o,o.prev)?new Pa(a,a):!o.prev.prev||i(o,o.prev.prev)?t.findWordAt(a):new Pa(_(a.line,0),j(t.doc,_(a.line+1,0))),t.setSelection(s.anchor,s.head),t.focus(),Ot(n)}e()}),ta(r.scroller,"touchcancel",e),ta(r.scroller,"scroll",function(){r.scroller.clientHeight&&(Zn(t,r.scroller.scrollTop),ti(t,r.scroller.scrollLeft,!0),Mt(t,"scroll",t))}),ta(r.scroller,"mousewheel",function(e){return $i(t,e)}),ta(r.scroller,"DOMMouseScroll",function(e){return $i(t,e)}),ta(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(e){Et(t,e)||Dt(e)},over:function(e){Et(t,e)||(Zr(t,e),Dt(e))},start:function(e){return Jr(t,e)},drop:pi(t,Xr),leave:function(e){Et(t,e)||Qr(t)}};var a=r.input.getField();ta(a,"keyup",function(e){return Eo.call(t,e)}),ta(a,"keydown",pi(t,To)),ta(a,"keypress",pi(t,Po)),ta(a,"focus",function(e){return _n(t,e)}),ta(a,"blur",function(e){return Fn(t,e)})}function Go(t,e,n,i){var r,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=Xt(t,e).state:n="prev");var s=t.options.tabSize,a=E(o,e),l=h(a.text,null,s);a.stateAfter&&(a.stateAfter=null);var c,u=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==n&&((c=o.mode.indent(r,a.text.slice(u.length),a.text))==js||c>150)){if(!i)return;n="prev"}}else c=0,n="not";"prev"==n?c=e>o.first?h(E(o,e-1).text,null,s):0:"add"==n?c=l+t.options.indentUnit:"subtract"==n?c=l-t.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var d="",f=0;if(t.options.indentWithTabs)for(var g=Math.floor(c/s);g;--g)f+=s,d+="\t";if(f1)if(Za&&Za.text.join("\n")==e){if(i.ranges.length%Za.text.length==0){l=[];for(var c=0;c=0;h--){var d=i.ranges[h],f=d.from(),p=d.to();d.empty()&&(n&&n>0?f=_(f.line,f.ch-n):t.state.overwrite&&!s?p=_(p.line,Math.min(E(o,p.line).text.length,p.ch+g(a).length)):Za&&Za.lineWise&&Za.text.join("\n")==e&&(f=p=_(f.line,0))),u=t.curOp.updateInput;var m={from:f,to:p,text:l?l[h%l.length]:a,origin:r||(s?"paste":t.state.cutIncoming?"cut":"+input")};Lr(t.doc,m),xe(t,"inputRead",t,m)}e&&!s&&Zo(t,e),Kn(t),t.curOp.updateInput=u,t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=!1}function Jo(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||fi(e,function(){return Xo(e,n,0,null,"paste")}),!0}function Zo(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var o=t.getModeAt(r.head),s=!1;if(o.electricChars){for(var a=0;a-1){s=Go(t,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(E(t.doc,r.head.line).text.slice(0,r.head.ch))&&(s=Go(t,r.head.line,"smart"));s&&xe(t,"electricInput",t,r.head.line)}}}function Qo(t){for(var e=[],n=[],i=0;i=t.first+t.size)&&(e=new _(i,e.ch,e.sticky),c=E(t,i))}function s(i){var s;if(null==(s=r?vo(t.cm,c,e,n):po(c,e,n))){if(i||!o())return!1;e=go(r,t.cm,c,e.line,n)}else e=s;return!0}var a=e,l=n,c=E(t,e.line);if("char"==i)s();else if("column"==i)s(!0);else if("word"==i||"group"==i)for(var u=null,h="group"==i,d=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;!(n<0)||s(!f);f=!1){var p=c.text.charAt(e.ch)||"\n",g=w(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||f||g||(g="s"),u&&u!=g){n<0&&(n=1,s(),e.sticky="after");break}if(g&&(u=g),n>0&&!s(!f))break}var v=Mr(t,e,a,l,!0);return z(a,v)&&(v.hitSide=!0),v}function is(t,e,n,i){var r,o=t.doc,s=e.left;if("page"==i){var a=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(a-.5*bn(t.display),3);r=(n>0?e.bottom:e.top)+n*l}else"line"==i&&(r=n>0?e.bottom+3:e.top-3);for(var c;c=dn(t,s,r),c.outside;){if(n<0?r<=0:r>=o.height){c.hitSide=!0;break}r+=5*n}return c}function rs(t,e){var n=qe(t,e.line);if(!n||n.hidden)return null;var i=E(t.doc,e.line),r=Be(n,i,e.line),o=kt(i,t.doc.direction),s="left";if(o){s=Ct(o,e.ch)%2?"right":"left"}var a=Ye(r.map,e.ch,s);return a.offset="right"==a.collapse?a.end:a.start,a}function os(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function ss(t,e){return e&&(t.bad=!0),t}function as(t,e,n,i,r){function o(t){return function(e){return e.id==t}}function s(){u&&(c+=h,u=!1)}function a(t){t&&(s(),c+=t)}function l(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(null!=n)return void a(n||e.textContent.replace(/\u200b/g,""));var c,d=e.getAttribute("cm-marker");if(d){var f=t.findMarks(_(i,0),_(r+1,0),o(+d));return void(f.length&&(c=f[0].find(0))&&a(P(t.doc,c.from,c.to).join(h)))}if("false"==e.getAttribute("contenteditable"))return;var p=/^(pre|div|p)$/i.test(e.nodeName);p&&s();for(var g=0;g=15&&(Cs=!1,bs=!0);var Is,Ds=As&&(xs||Cs&&(null==Ns||Ns<12.11)),_s=fs||ms&&ys>=9,Fs=function(e,n){var i=e.className,r=t(n).exec(i);if(r){var o=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(o?r[1]+o:"")}};Is=document.createRange?function(t,e,n,i){var r=document.createRange();return r.setEnd(i||t,n),r.setStart(t,e),r}:function(t,e,n){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(t){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",e),i};var zs=function(t){t.select()};Ms?zs=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:ms&&(zs=function(t){try{t.select()}catch(t){}});var $s=function(){this.id=null};$s.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var Rs,Hs,Vs=30,js={toString:function(){return"CodeMirror.Pass"}},Bs={scroll:!1},Ws={origin:"*mouse"},Us={origin:"+move"},qs=[""],Ks=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Gs=/[\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]/,Ys=!1,Xs=!1,Js=null,Zs=function(){function t(t){return t<=247?n.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1785?i.charAt(t-1536):1774<=t&&t<=2220?"r":8192<=t&&t<=8203?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t,this.from=e,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,s=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;return function(n,i){var c="ltr"==i?"L":"R";if(0==n.length||"ltr"==i&&!r.test(n))return!1;for(var u=n.length,h=[],d=0;d=this.string.length},ca.prototype.sol=function(){return this.pos==this.lineStart},ca.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ca.prototype.next=function(){if(this.pose},ca.prototype.eatSpace=function(){for(var t=this,e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++t.pos;return this.pos>e},ca.prototype.skipToEnd=function(){this.pos=this.string.length},ca.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},ca.prototype.backUp=function(t){this.pos-=t},ca.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}var r=function(t){return n?t.toLowerCase():t};if(r(this.string.substr(this.pos,t.length))==r(t))return!1!==e&&(this.pos+=t.length),!0},ca.prototype.current=function(){return this.string.slice(this.start,this.pos)},ca.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},ca.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},ca.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ua=function(t,e){this.state=t,this.lookAhead=e},ha=function(t,e,n,i){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};ha.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},ha.prototype.baseToken=function(t){var e=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)e.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},ha.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ha.fromSaved=function(t,e,n){return e instanceof ua?new ha(t,Ut(t.mode,e.state),n,e.lookAhead):new ha(t,Ut(t.mode,e),n)},ha.prototype.save=function(t){var e=!1!==t?Ut(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ua(e,this.maxLookAhead):e};var da=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n},fa=function(t,e,n){this.text=t,it(this,e),this.height=n?n(this):1};fa.prototype.lineNo=function(){return O(this)},Lt(fa);var pa,ga={},va={},ma=null,ya=null,ba={left:0,right:0,top:0,bottom:0},xa=function(t,e,n){this.cm=n;var r=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");t(r),t(o),ta(r,"scroll",function(){r.clientHeight&&e(r.scrollTop,"vertical")}),ta(o,"scroll",function(){o.clientWidth&&e(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ms&&ys<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xa.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?i+"px":"0";var r=t.viewHeight-(e?i:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:e?i:0}},xa.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xa.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xa.prototype.zeroWidthHack=function(){var t=As&&!Ss?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new $s,this.disableVert=new $s},xa.prototype.enableZeroWidthBar=function(t,e,n){function i(){var r=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1))!=t?t.style.pointerEvents="none":e.set(1e3,i)}t.style.pointerEvents="auto",e.set(1e3,i)},xa.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var wa=function(){};wa.prototype.update=function(){return{bottom:0,right:0}},wa.prototype.setScrollLeft=function(){},wa.prototype.setScrollTop=function(){},wa.prototype.clear=function(){};var Ca={native:xa,null:wa},ka=0,Sa=function(t,e,n){var i=t.display;this.viewport=e,this.visible=Rn(i,t.doc,e),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=He(t),this.force=n,this.dims=wn(t),this.events=[]};Sa.prototype.signal=function(t,e){At(t,e)&&this.events.push(arguments)},Sa.prototype.finish=function(){for(var t=this,e=0;e=0&&F(t,r.to())<=0)return i}return-1};var Pa=function(t,e){this.anchor=t,this.head=e};Pa.prototype.from=function(){return H(this.anchor,this.head)},Pa.prototype.to=function(){return R(this.anchor,this.head)},Pa.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Vr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=this,i=t,r=t+e;i1||!(this.children[0]instanceof Vr))){var l=[];this.collapse(l),this.children=[new Vr(l)],this.children[0].parent=this}},collapse:function(t){for(var e=this,n=0;n50){for(var a=o.lines.length%25+25,l=a;l10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=this,r=0;re.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&mi(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&kr(e.doc)),e&&xe(e,"markerCleared",e,this,r,o),n&&si(e),this.parent&&this.parent.clear()}},Oa.prototype.find=function(t,e){var n=this;null==t&&"bookmark"==this.type&&(t=1);for(var i,r,o=0;o=0;c--)Lr(i,r[c]);l?br(this,l):this.cm&&Kn(this.cm)}),undo:vi(function(){Nr(this,"undo")}),redo:vi(function(){Nr(this,"redo")}),undoSelection:vi(function(){Nr(this,"undo",!0)}),redoSelection:vi(function(){Nr(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,n){t=j(this,t),e=j(this,e);var i=[],r=t.line;return this.iter(t.line,e.line+1,function(o){var s=o.markedSpans;if(s)for(var a=0;a=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r}),i},getAllMarks:function(){var t=[];return this.iter(function(e){var n=e.markedSpans;if(n)for(var i=0;it)return e=t,!0;t-=o,++n}),j(this,_(n,e))},indexFromPos:function(t){t=j(this,t);var e=t.ch;if(t.linee&&(e=t.from),null!=t.to&&t.to0)r=new _(r.line,r.ch+1),t.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),_(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var s=E(t.doc,r.line-1).text;s&&(r=new _(r.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+s.charAt(s.length-1),_(r.line-1,s.length-1),r,"+transpose"))}n.push(new Pa(r,r))}t.setSelections(n)})},newlineAndIndent:function(t){return fi(t,function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var i=0;it&&0==F(e,this.pos)&&n==this.button};var qa,Ka,Ga={toString:function(){return"CodeMirror.Init"}},Ya={},Xa={};qo.defaults=Ya,qo.optionHandlers=Xa;var Ja=[];qo.defineInitHook=function(t){return Ja.push(t)};var Za=null,Qa=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new $s,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Qa.prototype.init=function(t){function e(t){if(!Et(r,t)){if(r.somethingSelected())Yo({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=Qo(r);Yo({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation(function(){r.setSelections(e.ranges,0,Bs),r.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var n=Za.text.join("\n");if(t.clipboardData.setData("Text",n),t.clipboardData.getData("Text")==n)return void t.preventDefault()}var s=es(),a=s.firstChild;r.display.lineSpace.insertBefore(s,r.display.lineSpace.firstChild),a.value=Za.text.join("\n");var l=document.activeElement;zs(a),setTimeout(function(){r.display.lineSpace.removeChild(s),l.focus(),l==o&&i.showPrimarySelection()},50)}}var n=this,i=this,r=i.cm,o=i.div=t.lineDiv;ts(o,r.options.spellcheck),ta(o,"paste",function(t){Et(r,t)||Jo(t,r)||ys<=11&&setTimeout(pi(r,function(){return n.updateFromDOM()}),20)}),ta(o,"compositionstart",function(t){n.composing={data:t.data,done:!1}}),ta(o,"compositionupdate",function(t){n.composing||(n.composing={data:t.data,done:!1})}),ta(o,"compositionend",function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),ta(o,"touchstart",function(){return i.forceCompositionEnd()}),ta(o,"input",function(){n.composing||n.readFromDOMSoon()}),ta(o,"copy",e),ta(o,"cut",e)},Qa.prototype.prepareSelection=function(){var t=Pn(this.cm,!1);return t.focus=this.cm.state.focused,t},Qa.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},Qa.prototype.showPrimarySelection=function(){var t=window.getSelection(),e=this.cm,n=e.doc.sel.primary(),i=n.from(),r=n.to();if(e.display.viewTo==e.display.viewFrom||i.line>=e.display.viewTo||r.line=e.display.viewFrom&&rs(e,i)||{node:a[0].measure.map[2],offset:0},c=r.linet.firstLine()&&(i=_(i.line-1,E(t.doc,i.line-1).length)),r.ch==E(t.doc,r.line).text.length&&r.linee.viewTo-1)return!1;var o,s,a;i.line==e.viewFrom||0==(o=Mn(t,i.line))?(s=O(e.view[0].line),a=e.view[0].node):(s=O(e.view[o].line),a=e.view[o-1].node.nextSibling);var l,c,u=Mn(t,r.line);if(u==e.view.length-1?(l=e.viewTo-1,c=e.lineDiv.lastChild):(l=O(e.view[u+1].line)-1,c=e.view[u+1].node.previousSibling),!a)return!1;for(var h=t.doc.splitLines(as(t,a,c,s,l)),d=P(t.doc,_(s,0),_(l,E(t.doc,l).text.length));h.length>1&&d.length>1;)if(g(h)==g(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),s++}for(var f=0,p=0,v=h[0],m=d[0],y=Math.min(v.length,m.length);fi.ch&&b.charCodeAt(b.length-p-1)==x.charCodeAt(x.length-p-1);)f--,p++;h[h.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var C=_(s,f),k=_(l,d.length?g(d).length-p:0);return h.length>1||h[0]||F(C,k)?(Fr(t.doc,h,C,k,"+input"),!0):void 0},Qa.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qa.prototype.reset=function(){this.forceCompositionEnd()},Qa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Qa.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()},80))},Qa.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||fi(this.cm,function(){return mi(t.cm)})},Qa.prototype.setUneditable=function(t){t.contentEditable="false"},Qa.prototype.onKeyPress=function(t){0!=t.charCode&&(t.preventDefault(),this.cm.isReadOnly()||pi(this.cm,Xo)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Qa.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Qa.prototype.onContextMenu=function(){},Qa.prototype.resetPosition=function(){},Qa.prototype.needsContentAttribute=!0;var tl=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new $s,this.hasSelection=!1,this.composing=null};tl.prototype.init=function(t){function e(t){if(!Et(r,t)){if(r.somethingSelected())Yo({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=Qo(r);Yo({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Bs):(i.prevInput="",s.value=e.text.join("\n"),zs(s))}"cut"==t.type&&(r.state.cutIncoming=!0)}}var n=this,i=this,r=this.cm,o=this.wrapper=es(),s=this.textarea=o.firstChild;t.wrapper.insertBefore(o,t.wrapper.firstChild),Ms&&(s.style.width="0px"),ta(s,"input",function(){ms&&ys>=9&&n.hasSelection&&(n.hasSelection=null),i.poll()}),ta(s,"paste",function(t){Et(r,t)||Jo(t,r)||(r.state.pasteIncoming=!0,i.fastPoll())}),ta(s,"cut",e),ta(s,"copy",e),ta(t.scroller,"paste",function(e){_e(t,e)||Et(r,e)||(r.state.pasteIncoming=!0,i.focus())}),ta(t.lineSpace,"selectstart",function(e){_e(t,e)||Ot(e)}),ta(s,"compositionstart",function(){var t=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ta(s,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},tl.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,i=Pn(t);if(t.options.moveInputWithCursor){var r=cn(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),s=e.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+s.top-o.top)),i.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+s.left-o.left))}return i},tl.prototype.showSelection=function(t){var e=this.cm,i=e.display;n(i.cursorDiv,t.cursors),n(i.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},tl.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&zs(this.textarea),ms&&ys>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",ms&&ys>=9&&(this.hasSelection=null))}},tl.prototype.getField=function(){return this.textarea},tl.prototype.supportsTouch=function(){return!1},tl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Ps||s()!=this.textarea))try{this.textarea.focus()}catch(t){}},tl.prototype.blur=function(){this.textarea.blur()},tl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},tl.prototype.receivedFocus=function(){this.slowPoll()},tl.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},tl.prototype.fastPoll=function(){function t(){n.poll()||e?(n.pollingFast=!1,n.slowPoll()):(e=!0,n.polling.set(60,t))}var e=!1,n=this;n.pollingFast=!0,n.polling.set(20,t)},tl.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!e.state.focused||ia(n)&&!i&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=n.value;if(r==i&&!e.somethingSelected())return!1;if(ms&&ys>=9&&this.hasSelection===r||As&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=r.charCodeAt(0);if(8203!=o||i||(i=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,a=Math.min(i.length,r.length);s1e3||r.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},tl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},tl.prototype.onKeyPress=function(){ms&&ys>=9&&(this.hasSelection=null),this.fastPoll()},tl.prototype.onContextMenu=function(t){function e(){if(null!=s.selectionStart){var t=r.somethingSelected(),e=""+(t?s.value:"");s.value="⇚",s.value=e,i.prevInput=t?"":"",s.selectionStart=1,s.selectionEnd=e.length,o.selForContextMenu=r.doc.sel}}function n(){if(i.contextMenuPending=!1,i.wrapper.style.cssText=u,s.style.cssText=c,ms&&ys<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=s.selectionStart){(!ms||ms&&ys<9)&&e();var t=0,n=function(){o.selForContextMenu==r.doc.sel&&0==s.selectionStart&&s.selectionEnd>0&&""==i.prevInput?pi(r,Pr)(r):t++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var i=this,r=i.cm,o=r.display,s=i.textarea,a=Tn(r,t),l=o.scroller.scrollTop;if(a&&!Cs){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(a)&&pi(r,xr)(r.doc,Hi(a),Bs);var c=s.style.cssText,u=i.wrapper.style.cssText;i.wrapper.style.cssText="position: absolute";var h=i.wrapper.getBoundingClientRect();s.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-h.top-5)+"px; left: "+(t.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(ms?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var d;if(bs&&(d=window.scrollY),o.input.focus(),bs&&window.scrollTo(null,d),o.input.reset(),r.somethingSelected()||(s.value=i.prevInput=" "),i.contextMenuPending=!0,o.selForContextMenu=r.doc.sel,clearTimeout(o.detectingSelectAll),ms&&ys>=9&&e(),_s){Dt(t);var f=function(){Tt(window,"mouseup",f),setTimeout(n,20)};ta(window,"mouseup",f)}else setTimeout(n,50)}},tl.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t},tl.prototype.setUneditable=function(){},tl.prototype.needsContentAttribute=!1,function(t){function e(e,i,r,o){t.defaults[e]=i,r&&(n[e]=o?function(t,e,n){n!=Ga&&r(t,e,n)}:r)}var n=t.optionHandlers;t.defineOption=e,t.Init=Ga,e("value","",function(t,e){return t.setValue(e)},!0),e("mode",null,function(t,e){t.doc.modeOption=e,qi(t)},!0),e("indentUnit",2,qi,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(t){Ki(t),en(t),mi(t)},!0),e("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var n=[],i=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var o=t.text.indexOf(e,r);if(-1==o)break;r=o+e.length,n.push(_(i,o))}i++});for(var r=n.length-1;r>=0;r--)Fr(t.doc,e,n[r],_(n[r].line,n[r].ch+e.length))}}),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=Ga&&t.refresh()}),e("specialCharPlaceholder",ce,function(t){return t.refresh()},!0),e("electricChars",!0),e("inputStyle",Ps?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(t,e){return t.getInputField().spellcheck=e},!0),e("rtlMoveVisually",!Os),e("wholeLineUpdateBefore",!0),e("theme","default",function(t){jo(t),Bo(t)},!0),e("keyMap","default",function(t,e,n){var i=uo(e),r=n!=Ga&&uo(n);r&&r.detach&&r.detach(t,i),i.attach&&i.attach(t,r||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,Uo,!0),e("gutters",[],function(t){_i(t.options),Bo(t)},!0),e("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?Cn(t.display)+"px":"0",t.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(t){return ni(t)},!0),e("scrollbarStyle","native",function(t){ri(t),ni(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),e("lineNumbers",!1,function(t){_i(t.options),Bo(t)},!0),e("firstLineNumber",1,Bo,!0),e("lineNumberFormatter",function(t){return t},Bo,!0),e("showCursorWhenSelecting",!1,En,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("readOnly",!1,function(t,e){"nocursor"==e&&(Fn(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)}),e("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),e("dragDrop",!0,Wo),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,En,!0),e("singleCursorHeightPerLine",!0,En,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Ki,!0),e("addModeClass",!1,Ki,!0),e("pollInterval",100),e("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),e("historyEventDelay",1250),e("viewportMargin",10,function(t){return t.refresh()},!0),e("maxHighlightLength",1e4,Ki,!0),e("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),e("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),e("autofocus",null),e("direction","ltr",function(t,e){return t.doc.setDirection(e)},!0)}(qo),function(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,n){var i=this.options,r=i[t];i[t]==n&&"mode"!=t||(i[t]=n,e.hasOwnProperty(t)&&pi(this,e[t])(this,n,r),Mt(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](uo(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;ni&&(Go(e,o.head.line,t,!0),i=o.head.line,r==e.doc.sel.primIndex&&Kn(e));else{var s=o.from(),a=o.to(),l=Math.max(i,s.line);i=Math.min(e.lastLine(),a.line-(a.ch?0:1))+1;for(var c=l;c0&&vr(e.doc,r,new Pa(s,u[r].to()),Bs)}}}),getTokenAt:function(t,e){return te(this,t,e)},getLineTokens:function(t,e){return te(this,_(t),e,!0)},getTokenTypeAt:function(t){t=j(this.doc,t);var e,n=Yt(this,E(this.doc,t.line)),i=0,r=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var s=i+r>>1;if((s?n[2*s-1]:0)>=o)r=s;else{if(!(n[2*s+1]o&&(t=o,r=!0),i=E(this.doc,t)}else i=t;return sn(this,i,{top:0,left:0},e||"page",n||r).top+(r?this.doc.height-yt(i):0)},defaultTextHeight:function(){return bn(this.display)},defaultCharWidth:function(){return xn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,i,r){var o=this.display;t=cn(this,j(this.doc,t));var s=t.bottom,a=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),o.sizer.appendChild(e),"over"==i)s=t.top;else if("above"==i||"near"==i){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?s=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(s=t.bottom),a+e.offsetWidth>c&&(a=c-e.offsetWidth)}e.style.top=s+"px",e.style.left=e.style.right="","right"==r?(a=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?a=0:"middle"==r&&(a=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=a+"px"),n&&Wn(this,{left:a,top:s,right:a+e.offsetWidth,bottom:s+e.offsetHeight})},triggerOnKeyDown:gi(To),triggerOnKeyPress:gi(Po),triggerOnKeyUp:Eo,triggerOnMouseDown:gi(Lo),execCommand:function(t){if(ja.hasOwnProperty(t))return ja[t].call(null,this)},triggerElectric:gi(function(t){Zo(this,t)}),findPosH:function(t,e,n,i){var r=this,o=1;e<0&&(o=-1,e=-e);for(var s=j(this.doc,t),a=0;a0&&a(n.charAt(i-1));)--i;for(;r.5)&&Sn(this),Mt(this,"refresh",this)}),swapDoc:gi(function(t){var e=this.doc;return e.cm=null,Ji(this,t),en(this),this.display.input.reset(),Gn(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,xe(this,"swapDoc",this,e),e}),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}},Lt(t),t.registerHelper=function(e,i,r){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][i]=r},t.registerGlobalHelper=function(e,i,r,o){t.registerHelper(e,i,o),n[e]._global.push({pred:r,val:o})}}(qo);var el="iter insert remove copy getEditor constructor".split(" ");for(var nl in Da.prototype)Da.prototype.hasOwnProperty(nl)&&d(el,nl)<0&&(qo.prototype[nl]=function(t){return function(){return t.apply(this.doc,arguments)}}(Da.prototype[nl]));return Lt(Da),qo.inputStyles={textarea:tl,contenteditable:Qa},qo.defineMode=function(t){qo.defaults.mode||"null"==t||(qo.defaults.mode=t),Ht.apply(this,arguments)},qo.defineMIME=Vt,qo.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),qo.defineMIME("text/plain","null"),qo.defineExtension=function(t,e){qo.prototype[t]=e},qo.defineDocExtension=function(t,e){Da.prototype[t]=e},qo.fromTextArea=us,function(t){t.off=Tt,t.on=ta,t.wheelEventPixels=zi,t.Doc=Da,t.splitLines=na,t.countColumn=h,t.findColumn=f,t.isWordChar=x,t.Pass=js,t.signal=Mt,t.Line=fa,t.changeEnd=Vi,t.scrollbarModel=Ca,t.Pos=_,t.cmpPos=F,t.modes=sa,t.mimeModes=aa,t.resolveMode=jt,t.getMode=Bt,t.modeExtensions=la,t.extendMode=Wt,t.copyState=Ut,t.startState=Kt,t.innerMode=qt,t.commands=ja,t.keyMap=Va,t.keyName=co,t.isModifierKey=ao,t.lookupKey=so,t.normalizeKeyMap=oo,t.StringStream=ca,t.SharedTextMarker=Na,t.TextMarker=Oa,t.LineWidget=Aa,t.e_preventDefault=Ot,t.e_stopPropagation=Nt,t.e_stop=Dt,t.addClass=a,t.contains=o,t.rmClass=Fs,t.keyNames=za}(qo),qo.version="5.31.0",qo})},function(t,e,n){"use strict";(function(e,n){var i=e.$;t.exports=e.View.extend({events:{change:"onChange"},initialize:function(t){var e=this.model;this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=e.target,this.className=this.pfx+"trait",this.labelClass=this.ppfx+"label",this.fieldClass=this.ppfx+"field "+this.ppfx+"field-"+e.get("type"),this.inputhClass=this.ppfx+"input-holder",e.off("change:value",this.onValueChange),this.listenTo(e,"change:value",this.onValueChange),this.tmpl=''},onChange:function(){this.model.set("value",this.getInputEl().value)},getValueForTarget:function(){return this.model.get("value")},onValueChange:function(){var t=this.model,e=this.target,i=t.get("name"),r=this.getValueForTarget();if(t.get("changeProp"))e.set(i,r);else{var o=n.clone(e.get("attributes"));o[i]=r,e.set("attributes",o)}},renderLabel:function(){this.$el.html(''+this.getLabel()+"
")},getLabel:function(){var t=this.model,e=t.get("label")||t.get("name");return e.charAt(0).toUpperCase()+e.slice(1).replace(/-/g," ")},getInputEl:function(){if(!this.$input){var t=this.model,e=this.target,n=t.get("name"),r=t.get("placeholder")||t.get("default")||"",o=t.get("type")||"text",s=e.get("attributes"),a=t.get("min"),l=t.get("max"),c=t.get("changeProp")?e.get(n):t.get("value")||s[n],u=i(' ');c&&u.prop("value",c),a&&u.prop("min",a),l&&u.prop("max",l),this.$input=u}return this.$input.get(0)},getModelValue:function(){var t,e=this.model,n=this.target,i=e.get("name");if(e.get("changeProp"))t=n.get(i);else{var r=n.get("attributes");t=e.get("value")||r[i]}return t},renderField:function(){if(!this.$input){this.$el.append(this.tmpl);var t=this.getInputEl(),e=this.el.querySelector("."+this.inputhClass);e.insertBefore(t,e.childNodes[0])}},render:function(){return this.renderLabel(),this.renderField(),this.el.className=this.className,this}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";var i,r;!function(o,s){i=s,void 0!==(r="function"==typeof i?i.call(e,n,e,t):i)&&(t.exports=r)}(0,function(){function t(t,e){return e=e||E,z.test(t)?e.getElementsByClassName(t.slice(1)):R.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t)}function e(t){if(!M){M=E.implementation.createHTMLDocument();var e=M.createElement("base");e.href=E.location.href,M.head.appendChild(e)}return M.body.innerHTML=t,M.body.childNodes}function n(t){"loading"!==E.readyState?t():E.addEventListener("DOMContentLoaded",t)}function i(i,r){if(!i)return this;if(i.cash&&i!==P)return i;var o,s=i,a=0;if(_(i))s=F.test(i)?E.getElementById(i.slice(1)):$.test(i)?e(i):t(i,r);else if(D(i))return n(i),this;if(!s)return this;if(s.nodeType||s===P)this[0]=s,this.length=1;else for(o=this.length=s.length;a=0&&s.splice(i,1)):(o(s,function(n){t.removeEventListener(e,n)}),s=[]))}function x(t,e){return"&"+encodeURIComponent(t)+"="+encodeURIComponent(e).replace(/%20/g,"+")}function w(t){var e=[];return o(t.options,function(t){t.selected&&e.push(t.value)}),e.length?e:null}function C(t){var e=t.selectedIndex;return e>=0?t.options[e].value:null}function k(t){var e=t.type;if(!e)return null;switch(e.toLowerCase()){case"select-one":return C(t);case"select-multiple":return w(t);case"radio":case"checkbox":return t.checked?t.value:null;default:return t.value?t.value:null}}function S(t,e,n){if(n){var i=t.childNodes[0];t.insertBefore(e,i)}else t.appendChild(e)}function T(t,e,n){var i=_(e);if(!i&&e.length)return void o(e,function(e){return T(t,e,n)});o(t,i?function(t){return t.insertAdjacentHTML(n?"afterbegin":"beforeend",e)}:function(t,i){return S(t,0===i?e:e.cloneNode(!0),n)})}var M,E=document,P=window,A=Array.prototype,L=A.slice,O=A.filter,N=A.push,I=function(){},D=function(t){return typeof t==typeof I&&t.call},_=function(t){return"string"==typeof t},F=/^#[\w-]*$/,z=/^\.[\w-]*$/,$=/<.+>/,R=/^\w+$/,H=r.fn=r.prototype=i.prototype={cash:!0,length:0,push:N,splice:A.splice,map:A.map,init:i};Object.defineProperty(H,"constructor",{value:r}),r.parseHTML=e,r.noop=I,r.isFunction=D,r.isString=_,r.extend=H.extend=function(t){t=t||{};var e=L.call(arguments),n=e.length,i=1;for(1===e.length&&(t=this,i=0);i1?this.each(function(n){return n.style[t]=e}):P.getComputedStyle(this[0])[t];for(var n in t)this.css(n,t[n]);return this}}),o(["Width","Height"],function(t){var e=t.toLowerCase();H[e]=function(){return this[0].getBoundingClientRect()[e]},H["inner"+t]=function(){return this[0]["client"+t]},H["outer"+t]=function(e){return this[0]["offset"+t]+(e?m(this,"margin"+("Width"===t?"Left":"Top"))+m(this,"margin"+("Width"===t?"Right":"Bottom")):0)}}),H.extend({off:function(t,e){return this.each(function(n){return b(n,t,e)})},on:function(t,e,i,r){var o;if(!_(t)){for(var a in t)this.on(a,e,t[a]);return this}return D(e)&&(i=e,e=null),"ready"===t?(n(i),this):(e&&(o=i,i=function(t){for(var n=t.target;!s(n,e);){if(n===this)return n=!1;n=n.parentNode}n&&o.call(n,t)}),this.each(function(e){var n=i;r&&(n=function(){i.apply(this,arguments),b(e,t,n)}),y(e,t,n)}))},one:function(t,e,n){return this.on(t,e,n,!0)},ready:n,trigger:function(t,e){var n=E.createEvent("HTMLEvents");return n.data=e,n.initEvent(t,!0,!1),this.each(function(t){return t.dispatchEvent(n)})}}),H.extend({serialize:function(){var t="";return o(this[0].elements||this,function(e){if(!e.disabled&&"FIELDSET"!==e.tagName){var n=e.name;switch(e.type.toLowerCase()){case"file":case"reset":case"submit":case"button":break;case"select-multiple":var i=k(e);null!==i&&o(i,function(e){t+=x(n,e)});break;default:var r=k(e);null!==r&&(t+=x(n,r))}}}),t.substr(1)},val:function(t){return void 0===t?k(this[0]):this.each(function(e){return e.value=t})}}),H.extend({after:function(t){return r(t).insertAfter(this),this},append:function(t){return T(this,t),this},appendTo:function(t){return T(r(t),this),this},before:function(t){return r(t).insertBefore(this),this},clone:function(){return r(this.map(function(t){return t.cloneNode(!0)}))},empty:function(){return this.html(""),this},html:function(t){if(void 0===t)return this[0].innerHTML;var e=t.nodeType?t[0].outerHTML:t;return this.each(function(t){return t.innerHTML=e})},insertAfter:function(t){var e=this;return r(t).each(function(t,n){var i=t.parentNode,r=t.nextSibling;e.each(function(t){i.insertBefore(0===n?t:t.cloneNode(!0),r)})}),this},insertBefore:function(t){var e=this;return r(t).each(function(t,n){var i=t.parentNode;e.each(function(e){i.insertBefore(0===n?e:e.cloneNode(!0),t)})}),this},prepend:function(t){return T(this,t,!0),this},prependTo:function(t){return T(r(t),this,!0),this},remove:function(){return this.each(function(t){return t.parentNode.removeChild(t)})},text:function(t){return void 0===t?this[0].textContent:this.each(function(e){return e.textContent=t})}});var U=E.documentElement;return H.extend({position:function(){var t=this[0];return{left:t.offsetLeft,top:t.offsetTop}},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+P.pageYOffset-U.clientTop,left:t.left+P.pageXOffset-U.clientLeft}},offsetParent:function(){return r(this[0].offsetParent)}}),H.extend({children:function(t){var e=[];return this.each(function(t){N.apply(e,t.children)}),e=l(e),t?e.filter(function(e){return s(e,t)}):e},closest:function(t){return!t||this.length<1?r():this.is(t)?this.filter(t):this.parent().closest(t)},is:function(t){if(!t)return!1;var e=!1,n=a(t);return this.each(function(i){return!(e=n(i,t))}),e},find:function(e){if(!e||e.nodeType)return r(e&&this.has(e).length?e:null);var n=[];return this.each(function(i){N.apply(n,t(e,i))}),l(n)},has:function(e){var n=_(e)?function(n){return 0!==t(e,n).length}:function(t){return t.contains(e)};return this.filter(n)},next:function(){return r(this[0].nextElementSibling)},not:function(t){if(!t)return this;var e=a(t);return this.filter(function(n){return!e(n,t)})},parent:function(){var t=[];return this.each(function(e){e&&e.parentNode&&t.push(e.parentNode)}),l(t)},parents:function(t){var e,n=[];return this.each(function(i){for(e=i;e&&e.parentNode&&e!==E.body.parentNode;)e=e.parentNode,(!t||t&&s(e,t))&&n.push(e)}),l(n)},prev:function(){return r(this[0].previousElementSibling)},siblings:function(){var t=this.parent().children(),e=this[0];return t.filter(function(t){return t!==e})}}),r})},function(t,e,n){"use strict";var i=n(0),r=i.Model.extend({idAttribute:"name",defaults:{name:"",label:"",type:1,active:!0,private:!1,protected:!1},initialize:function(){var t=this.get("name"),e=this.get("label");t?e||this.set("label",t):this.set("name",e),this.set("name",r.escapeName(this.get("name")))},getFullName:function(){var t="";switch(this.get("type")){case 1:t=".";break;case 2:t="#"}return t+this.get("name")}},{TYPE_CLASS:1,TYPE_ID:2,escapeName:function(t){return(""+t).trim().replace(/([^a-z0-9\w-]+)/gi,"-")}});t.exports=r},function(t,e,n){"use strict";(function(e){var i=n(0),r=n(9);t.exports=i.Collection.extend({model:r,getStyleable:function(){return e.filter(this.models,function(t){return t.get("active")&&!t.get("private")})},getValid:function(){return e.filter(this.models,function(t){return!t.get("private")})},getFullString:function(){var t=[];return this.each(function(e){return t.push(e.getFullName())}),t.join("").trim()}})}).call(e,n(1))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.parseValue(t);this.set(r,i({},n,{avoidStore:1})),e&&(this.set("value","",n),this.set(r,n))},setValueFromInput:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.setValue(t,e,i({},n,{fromInput:1}))},parseValue:function(t){var e={value:t};if(!this.get("functionName"))return e;var n=[],i=""+t,r=i.indexOf("(")+1,o=i.lastIndexOf(")");return n.push(r),o>=0&&n.push(o),e.value=String.prototype.substring.apply(i,n),e},getDefaultValue:function(){return this.get("defaults")},getFullValue:function(t){var e=this.get("functionName"),n=t||this.get("value");return e&&(n=e+"("+n+")"),n}})},function(t,e,n){"use strict";(function(e){n(5),n(14),n(35),n(36),n(37),n(39),n(18),n(33);t.exports=e.View.extend({initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.onChange=t.onChange,this.onInputRender=t.onInputRender||{},this.customValue=t.customValue||{};var e=this.collection;this.listenTo(e,"add",this.addTo),this.listenTo(e,"reset",this.render)},addTo:function(t){this.add(t)},add:function(t,e){var n=new t.typeView({model:t,name:t.get("name"),id:this.pfx+t.get("property"),target:this.target,propTarget:this.propTarget,onChange:this.onChange,onInputRender:this.onInputRender,config:this.config});"composite"!=t.get("type")&&(n.customValue=this.customValue),n.render();var i=n.el;e?e.appendChild(i):this.el.appendChild(i)},render:function(){var t=this,e=document.createDocumentFragment();return this.collection.each(function(n){return t.add(n,e)}),this.$el.append(e),this.$el.attr("class",this.pfx+"properties"),this}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=(n(19),e.$);t.exports=n(5).extend({templateInput:function(){return""},init:function(){var t=this.model;this.listenTo(t,"change:unit",this.modelValueChanged),this.listenTo(t,"el:change",this.elementUpdated)},setValue:function(t){this.inputInst.setValue(t,{silent:1})},onRender:function(){var t=this.ppfx;if(!this.input){var e=this.model.input;e.ppfx=t,e.render();this.el.querySelector("."+t+"fields").appendChild(e.el),this.$input=e.inputEl,this.unit=e.unitEl,this.$unit=i(this.unit),this.input=this.$input.get(0),this.inputInst=e}}})}).call(e,n(0))},function(t,e,n){"use strict";var i=(n(0),n(4));t.exports=i.extend({tagName:"img",events:{dblclick:"openModal",click:"initResize"},initialize:function(t){var e=this.model;i.prototype.initialize.apply(this,arguments),this.listenTo(e,"change:src",this.updateSrc),this.listenTo(e,"dblclick active",this.openModal),this.classEmpty=this.ppfx+"plh-image";var n=this.config;n.modal&&(this.modal=n.modal),n.am&&(this.am=n.am)},updateSrc:function(){var t=this.model.get("src"),e=this.$el;e.attr("src",t),e[t?"removeClass":"addClass"](this.classEmpty)},openModal:function(t){var e=this.opts.config.em,n=e?e.get("Editor"):"";n&&this.model.get("editable")&&n.runCommand("open-assets",{target:this.model,onSelect:function(){n.Modal.close(),n.AssetManager.setTarget(null)}})},render:function(){this.updateAttributes(),this.updateClasses();var t=this.$el.attr("class")||"";return this.model.get("src")||this.$el.attr("class",(t+" "+this.classEmpty).trim()),this.$el.attr("onmousedown","return false"),this}})},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){!function(e){function n(t,e){for(var n=t.length;n--;)if(t[n]===e)return n;return-1}function i(t,e){if(t.length!=e.length)return!1;for(var n=0;n0;for(o in C)(!C[o]&&n(i.mods,+o)>-1||C[o]&&-1==n(i.mods,+o))&&(a=!1);(0!=i.mods.length||C[16]||C[18]||C[17]||C[91])&&!a||!1===i.method(t,i)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function s(t){var e,i=t.keyCode,r=n(E,i);if(r>=0&&E.splice(r,1),93!=i&&224!=i||(i=91),i in C){C[i]=!1;for(e in S)S[e]==i&&(l[e]=!1)}}function a(){for(x in C)C[x]=!1;for(x in S)l[x]=!1}function l(t,e,n){var i,r;i=v(t),void 0===n&&(n=e,e="all");for(var o=0;o1&&(r=m(t),t=[t[t.length-1]]),t=t[0],t=M(t),t in w||(w[t]=[]),w[t].push({shortcut:i[o],scope:e,method:n,key:i[o],mods:r})}function c(t,e){var n,r,o,s,a,l=[];for(n=v(t),s=0;s1&&(l=m(r),t=r[r.length-1]),t=M(t),void 0===e&&(e=p()),!w[t])return;for(o=0;o\n \n \n '},inputValueChanged:function(){if(!this.model.get("detached")){for(var t=arguments.length,e=Array(t),n=0;n