From 2e8e2881407cfdb85bdeba6d52b80cb0b3a929a8 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 1 Jun 2017 15:22:31 +0200 Subject: [PATCH] Remove jquery from the builder --- dist/grapes.min.js | 28 +++++++++++----------------- index.html | 1 + package.json | 2 +- src/index.js | 3 +-- src/wrappers/jquery.js | 1 - webpack.config.js | 2 +- 6 files changed, 15 insertions(+), 22 deletions(-) delete mode 100644 src/wrappers/jquery.js diff --git a/dist/grapes.min.js b/dist/grapes.min.js index b6ad4b002f..edea441585 100644 --- a/dist/grapes.min.js +++ b/dist/grapes.min.js @@ -1,17 +1,11 @@ -/*! grapesjs - v0.5.41 */ -!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports&&"object"==typeof module?module.exports=b():a.grapesjs=a.GrapesJS=b()}(this,function(){var a,b,c;!function(d){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if(e=p[o.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,b){return function(){var c=w.call(arguments,0);return"string"!=typeof c[0]&&1===c.length&&c.push(null),o.apply(d,c.concat([a,b]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var b=s[a];delete s[a],u[a]=!0,n.apply(d,b)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return"undefined"!=typeof b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,b,c,f){var h,k,m,n,o,t,v,w=[],x=typeof c;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(b=!b.length&&c.length?["require","exports","module"]:b,o=0;o
",attributes:{"class":"gjs-fonts gjs-f-b1"}},{id:"b2",label:"2 Blocks",content:'
",attributes:{"class":"gjs-fonts gjs-f-b2"}},{id:"b3",label:"3 Blocks",content:'
",attributes:{"class":"gjs-fonts gjs-f-b3"}},{id:"b4",label:"3/7 Block",content:'
",attributes:{"class":"gjs-fonts gjs-f-b37"}},{id:"hero",label:"Hero section",content:'
Build your templates without coding
Try it now
',attributes:{"class":"gjs-fonts gjs-f-hero"}},{id:"h1p",label:"Text section",content:'

Insert title here

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

',attributes:{"class":"gjs-fonts gjs-f-h1p"}},{id:"3ba",label:"Badges",content:'
Adam Smith
CEO
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
John Black
Software Engineer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
Jessica White
Web Designer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
',attributes:{"class":"gjs-fonts gjs-f-3ba"}},{id:"text",label:"Text",attributes:{"class":"gjs-fonts gjs-f-text"},content:{type:"text",content:"Insert your text here",style:{padding:"10px"},activeOnRender:1}},{id:"image",label:"Image",attributes:{"class":"gjs-fonts gjs-f-image"},content:{style:{color:"black"},type:"image",activeOnRender:1}},{id:"quo",label:"Quote",content:'
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
',attributes:{"class":"fa fa-quote-right"}},{id:"link",label:"Link",attributes:{"class":"fa fa-link"},content:{type:"link",content:"Link",style:{color:"#d983a6"}}},{id:"map",label:"Map",attributes:{"class":"fa fa-map-o"},content:{type:"map",style:{height:"350px"}}},{id:"video",label:"Video",attributes:{"class":"fa fa-youtube-play"},content:{type:"video",src:"img/video2.webm",style:{height:"350px",width:"615px"}}}]}}}),function(){function a(a){function b(b,c,d,e,f,g){for(;f>=0&&f0?0:h-1;return arguments.length<3&&(e=c[g?g[i]:i],i+=a),b(c,d,e,g,i,h)}}function b(a){return function(b,c,d){c=v(c,d);for(var e=A(b),f=a>0?0:e-1;f>=0&&f0?g=f>=0?f:Math.max(f+h,g):h=f>=0?Math.min(f+1,h):f+h+1;else if(c&&f&&h)return f=c(d,e),d[f]===e?f:-1;if(e!==e)return f=b(l.call(d,g,h),t.isNaN),f>=0?f+g:-1;for(f=a>0?g:h-1;f>=0&&f=0&&b<=z};t.each=t.forEach=function(a,b,c){b=u(b,c);var d,e;if(B(a))for(d=0,e=a.length;d=0},t.invoke=function(a,b){var c=l.call(arguments,2),d=t.isFunction(b);return t.map(a,function(a){var e=d?b:a[b];return null==e?e:e.apply(a,c)})},t.pluck=function(a,b){return t.map(a,t.property(b))},t.where=function(a,b){return t.filter(a,t.matcher(b))},t.findWhere=function(a,b){return t.find(a,t.matcher(b))},t.max=function(a,b,c){var d,e,f=-(1/0),g=-(1/0);if(null==b&&null!=a){a=B(a)?a:t.values(a);for(var h=0,i=a.length;hf&&(f=d)}else b=v(b,c),t.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-(1/0)&&f===-(1/0))&&(f=a,g=e)});return f},t.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=B(a)?a:t.values(a);for(var h=0,i=a.length;hd||void 0===c)return 1;if(cb?(g&&(clearTimeout(g),g=null),h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},t.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=t.now()-g;j=0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=t.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},t.wrap=function(a,b){return t.partial(b,a)},t.negate=function(a){return function(){return!a.apply(this,arguments)}},t.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},t.after=function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}},t.before=function(a,b){var c;return function(){return--a>0&&(c=b.apply(this,arguments)),a<=1&&(b=null),c}},t.once=t.partial(t.before,2);var F=!{toString:null}.propertyIsEnumerable("toString"),G=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];t.keys=function(a){if(!t.isObject(a))return[];if(p)return p(a);var b=[];for(var c in a)t.has(a,c)&&b.push(c);return F&&e(a,b),b},t.allKeys=function(a){if(!t.isObject(a))return[];var b=[];for(var c in a)b.push(c);return F&&e(a,b),b},t.values=function(a){for(var b=t.keys(a),c=b.length,d=Array(c),e=0;e":">",'"':""","'":"'","`":"`"},J=t.invert(I),K=function(a){var b=function(b){return a[b]},c="(?:"+t.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};t.escape=K(I),t.unescape=K(J),t.result=function(a,b,c){var d=null==a?void 0:a[b];return void 0===d&&(d=c),t.isFunction(d)?d.call(a):d};var L=0;t.uniqueId=function(a){var b=++L+"";return a?a+b:b},t.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var M=/(.)^/,N={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\u2028|\u2029/g,P=function(a){return"\\"+N[a]};t.template=function(a,b,c){!b&&c&&(b=c),b=t.defaults({},b,t.templateSettings);var d=RegExp([(b.escape||M).source,(b.interpolate||M).source,(b.evaluate||M).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(O,P),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,t)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},t.chain=function(a){var b=t(a);return b._chain=!0,b};var Q=function(a,b){return a._chain?t(b).chain():b};t.mixin=function(a){t.each(t.functions(a),function(b){var c=t[b]=a[b];t.prototype[b]=function(){var a=[this._wrapped];return k.apply(a,arguments),Q(this,c.apply(t,a))}})},t.mixin(t),t.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=h[a];t.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],Q(this,c)}}),t.each(["concat","join","slice"],function(a){var b=h[a];t.prototype[a]=function(){return Q(this,b.apply(this._wrapped,arguments))}}),t.prototype.value=function(){return this._wrapped},t.prototype.valueOf=t.prototype.toJSON=t.prototype.value,t.prototype.toString=function(){return""+this._wrapped},"function"==typeof c&&c.amd&&c("underscore",[],function(){return t})}.call(this),c("jquery",[],function(){return jQuery}),function(a){var d="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if("function"==typeof c&&c.amd)c("backbone",["underscore","jquery","exports"],function(b,c,e){d.Backbone=a(d,e,b,c)});else if("undefined"!=typeof exports){var e,f=b("underscore");try{e=b("jquery")}catch(g){}a(d,exports,f,e)}else d.Backbone=a(d,{},d._,d.jQuery||d.Zepto||d.ender||d.$)}(function(a,b,c,d){var e=a.Backbone,f=Array.prototype.slice;b.VERSION="1.3.3",b.$=d,b.noConflict=function(){return a.Backbone=e,this},b.emulateHTTP=!1,b.emulateJSON=!1;var g=function(a,b,d){switch(a){case 1:return function(){return c[b](this[d])};case 2:return function(a){return c[b](this[d],a)};case 3:return function(a,e){return c[b](this[d],i(a,this),e)};case 4:return function(a,e,f){return c[b](this[d],i(a,this),e,f)};default:return function(){var a=f.call(arguments);return a.unshift(this[d]),c[b].apply(c,a)}}},h=function(a,b,d){c.each(b,function(b,e){c[e]&&(a.prototype[e]=g(b,e,d))})},i=function(a,b){return c.isFunction(a)?a:c.isObject(a)&&!b._isModel(a)?j(a):c.isString(a)?function(b){return b.get(a)}:a},j=function(a){var b=c.matches(a);return function(a){return b(a.attributes)}},k=b.Events={},l=/\s+/,m=function(a,b,d,e,f){var g,h=0;if(d&&"object"==typeof d){void 0!==e&&"context"in f&&void 0===f.context&&(f.context=e);for(g=c.keys(d);hthis.length&&(e=this.length),e<0&&(e+=this.length+1);var f,g,h=[],i=[],j=[],k=[],l={},m=b.add,n=b.merge,o=b.remove,p=!1,q=this.comparator&&null==e&&b.sort!==!1,r=c.isString(this.comparator)?this.comparator:null;for(g=0;g7),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(L,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var b=this.root.slice(0,-1)||"/";return this.location.replace(b+"#"+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 d=document.body,e=d.insertBefore(this.iframe,d.firstChild).contentWindow;e.document.open(),e.document.close(),e.location.hash="#"+this.fragment}var f=window.addEventListener||function(a,b){return attachEvent("on"+a,b)};if(this._usePushState?f("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?f("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var a=window.removeEventListener||function(a,b){return detachEvent("on"+a,b)};this._usePushState?a("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&a("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),J.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(a){var b=this.getFragment();return b===this.fragment&&this.iframe&&(b=this.getHash(this.iframe.contentWindow)),b!==this.fragment&&(this.iframe&&this.navigate(b),void this.loadUrl())},loadUrl:function(a){return!!this.matchRoot()&&(a=this.fragment=this.getFragment(a),c.some(this.handlers,function(b){if(b.route.test(a))return b.callback(a),!0}))},navigate:function(a,b){if(!J.started)return!1;b&&b!==!0||(b={trigger:!!b}),a=this.getFragment(a||"");var c=this.root;""!==a&&"?"!==a.charAt(0)||(c=c.slice(0,-1)||"/");var d=c+a;if(a=this.decodeFragment(a.replace(M,"")),this.fragment!==a){if(this.fragment=a,this._usePushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,d);else{if(!this._wantsHashChange)return this.location.assign(d);if(this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getHash(this.iframe.contentWindow)){var e=this.iframe.contentWindow;b.replace||(e.document.open(),e.document.close()),this._updateHash(e.location,a,b.replace)}}return b.trigger?this.loadUrl(a):void 0}},_updateHash:function(a,b,c){if(c){var d=a.href.replace(/(javascript:|#).*$/,"");a.replace(d+"#"+b)}else a.hash="#"+b}}),b.history=new J;var N=function(a,b){var d,e=this;return d=a&&c.has(a,"constructor")?a.constructor:function(){return e.apply(this,arguments)},c.extend(d,e,b),d.prototype=c.create(e.prototype,a),d.prototype.constructor=d,d.__super__=e.prototype,d};t.extend=v.extend=E.extend=A.extend=J.extend=N;var O=function(){throw new Error('A "url" property or function must be specified')},P=function(a,b){var c=b.error;b.error=function(d){c&&c.call(b.context,a,d,b),a.trigger("error",a,d,b)}};return b}),function(a){"function"==typeof c&&c.amd?c("backboneUndo",["underscore","backbone"],a):"undefined"!=typeof exports?module.exports=a(b("underscore"),b("backbone")):a(_,Backbone)}(function(a,b){function c(a,b,c){return c.length<=4?a.call(b,c[0],c[1],c[2],c[3]):a.apply(b,c)}function d(a,b){return n.call(a,b)}function e(b,c){return null!=b&&(a.isArray(c)||(c=d(arguments,1)),a.all(c,function(a){return a in b}))}function f(){this.registeredObjects=[],this.cidIndexes=[]}function g(b,c,d,e){for(var f,g=0,h=c.length;ga.maximumStackLength&&(a.shift(),a.pointer--)}}}function l(){}function m(b,c,d,f){if("object"==typeof c)return a.each(c,function(a,c){2===b?m(b,a,d,f):m(b,c,a,d)});switch(b){case 0:e(d,"undo","redo","on")&&a.all(a.pick(d,"undo","redo","on"),a.isFunction)&&(f[c]=d);break;case 1:f[c]&&a.isObject(d)&&(f[c]=a.extend({},f[c],d));break;case 2:delete f[c]}return this}var n=Array.prototype.slice,o=function(){function b(){d++,c=!0,a.defer(function(){c=!1})}var c=!1,d=-1;return function(){return c||b(),d}}();f.prototype={isRegistered:function(b){return b&&b.cid?this.registeredObjects[b.cid]:a.contains(this.registeredObjects,b)},register:function(a){return!this.isRegistered(a)&&(a&&a.cid?(this.registeredObjects[a.cid]=a,this.cidIndexes.push(a.cid)):this.registeredObjects.push(a),!0)},unregister:function(b){if(this.isRegistered(b)){if(b&&b.cid)delete this.registeredObjects[b.cid],this.cidIndexes.splice(a.indexOf(this.cidIndexes,b.cid),1);else{var c=a.indexOf(this.registeredObjects,b);this.registeredObjects.splice(c,1)}return!0}return!1},get:function(){return a.map(this.cidIndexes,function(a){return this.registeredObjects[a]},this).concat(this.registeredObjects)}};var p={add:{undo:function(a,b,c,d){a.remove(c,d)},redo:function(a,b,c,d){d.index&&(d.at=d.index),a.add(c,d)},on:function(b,c,d){return{object:c,before:void 0,after:b,options:a.clone(d)}}},remove:{undo:function(a,b,c,d){"index"in d&&(d.at=d.index),a.add(b,d)},redo:function(a,b,c,d){a.remove(b,d)},on:function(b,c,d){return{object:c,before:b,after:void 0,options:a.clone(d)}}},change:{undo:function(b,c,d,e){a.isEmpty(c)?a.each(a.keys(d),b.unset,b):(b.set(c),e&&e.unsetData&&e.unsetData.before&&e.unsetData.before.length&&a.each(e.unsetData.before,b.unset,b))},redo:function(b,c,d,e){a.isEmpty(d)?a.each(a.keys(c),b.unset,b):(b.set(d),e&&e.unsetData&&e.unsetData.after&&e.unsetData.after.length&&a.each(e.unsetData.after,b.unset,b))},on:function(b,c){var d=b.changedAttributes(),e=a.keys(d),f=a.pick(b.previousAttributes(),e),g=a.keys(f),h=(c||(c={})).unsetData={after:[],before:[]};return e.length!=g.length&&(e.length>g.length?a.each(e,function(a){a in f||h.before.push(a)},this):a.each(g,function(a){a in d||h.after.push(a)})),{object:b,before:f,after:d,options:a.clone(c)}}},reset:{undo:function(a,b,c){a.reset(b)},redo:function(a,b,c){a.reset(c)},on:function(b,c){return{object:b,before:c.previousModels,after:a.clone(b.models)}}}};l.prototype=p;var q=b.Model.extend({defaults:{type:null,object:null,before:null,after:null,magicFusionIndex:null},undo:function(a){h("undo",this.attributes)},redo:function(a){h("redo",this.attributes)}}),r=b.Collection.extend({model:q,pointer:-1,track:!1,isCurrentlyUndoRedoing:!1,maximumStackLength:1/0,setMaxLength:function(a){this.maximumStackLength=a}}),s=b.Model.extend({defaults:{maximumStackLength:1/0,track:!1},initialize:function(b){this.stack=new r,this.objectRegistry=new f,this.undoTypes=new l,this.stack.setMaxLength(this.get("maximumStackLength")),this.on("change:maximumStackLength",function(a,b){this.stack.setMaxLength(b)},this),b&&b.track&&this.startTracking(),b&&b.register&&(a.isArray(b.register)||a.isArguments(b.register)?c(this.register,this,b.register):this.register(b.register))},startTracking:function(){this.set("track",!0),this.stack.track=!0},stopTracking:function(){this.set("track",!1),this.stack.track=!1},isTracking:function(){return this.get("track")},_addToStack:function(a){k(this.stack,a,d(arguments,1),this.undoTypes)},register:function(){g("on",arguments,this._addToStack,this)},unregister:function(){g("off",arguments,this._addToStack,this)},unregisterAll:function(){c(this.unregister,this,this.objectRegistry.get())},undo:function(a){i("undo",this,this.stack,a)},undoAll:function(){i("undo",this,this.stack,!1,!0)},redo:function(a){i("redo",this,this.stack,a)},redoAll:function(){i("redo",this,this.stack,!1,!0)},isAvailable:function(a){var b=this.stack,c=b.length;switch(a){case"undo":return c>0&&b.pointer>-1;case"redo":return c>0&&b.pointer0;for(f in v)(!v[f]&&b(e.mods,+f)>-1||v[f]&&b(e.mods,+f)==-1)&&(i=!1);(0!=e.mods.length||v[16]||v[18]||v[17]||v[91])&&!i||e.method(a,e)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0))}}function f(a){var c,d=a.keyCode,e=b(A,d);if(e>=0&&A.splice(e,1),93!=d&&224!=d||(d=91),d in v){v[d]=!1;for(c in x)x[c]==d&&(h[c]=!1)}}function g(){for(t in v)v[t]=!1;for(t in x)h[t]=!1}function h(a,b,c){var d,e;d=p(a),void 0===c&&(c=b,b="all");for(var f=0;f1&&(e=q(a),a=[a[a.length-1]]),a=a[0],a=z(a),a in u||(u[a]=[]),u[a].push({shortcut:d[f],scope:b,method:c,key:d[f],mods:e})}function i(a,b){var d,e,f,g,h,i=[];for(d=p(a),g=0;g1&&(i=q(e),a=e[e.length-1]),a=z(a),void 0===b&&(b=n()),!u[a])return;for(f=0;fg||g>h+j-e||i+e>f||f>i+k-e)&&(d=1),!!d},findPosition:function(a,b,c){for(var d={index:0,method:"before"},e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=a.length;mf||h&&j>=h||e&&gg?d.h=Math.round(d.w/g):d.w=Math.round(d.h*g)}return~e.indexOf("l")&&(d.l=c.w-d.w),~e.indexOf("t")&&(d.t=c.h-d.h),d}}}}),c("Utils/main",["require","./Sorter","./Resizer"],function(a){var b=function(){var b=a("./Sorter"),c=a("./Resizer");return{name:"Utils",init:function(){return this},Sorter:b,Resizer:c}};return b}),c("Utils",["Utils/main"],function(a){return a}),c("StorageManager/config/config",[],function(){return{id:"gjs-",autosave:1,autoload:1,type:"local",stepsBeforeSave:1,storeComponents:!1,storeStyles:!1,storeHtml:!0,storeCss:!0,checkLocal:!0,params:{},urlStore:"",urlLoad:"",beforeSend:function(a,b){},onComplete:function(a,b){},contentTypeJson:!1}}),c("StorageManager/model/LocalStorage",["backbone"],function(a){return a.Model.extend({defaults:{checkLocal:!0},store:function(a,b){this.checkStorageEnvironment();for(var c in a)localStorage.setItem(c,a[c]);"function"==typeof b&&b()},load:function(a){this.checkStorageEnvironment();for(var b={},c=0,d=a.length;c/im,j=/]*>\s*([\s\S]+)\s*<\/body>/im,k="undefined"!=typeof location&&location.href,l=k&&location.protocol&&location.protocol.replace(/\:/,""),m=k&&location.hostname,n=k&&(location.port||void 0),o={},p=a.config&&a.config()||{};return c={version:"2.0.12",strip:function(a){if(a){a=a.replace(i,"");var b=a.match(j);b&&(a=b[1])}else a="";return a},jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:p.createXhr||function(){var a,b,c;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(b=0;b<3;b+=1){c=h[b];try{a=new ActiveXObject(c)}catch(d){}if(a){h=[c];break}}return a},parseName:function(a){var b,c,d,e=!1,f=a.indexOf("."),g=0===a.indexOf("./")||0===a.indexOf("../");return f!==-1&&(!g||f>1)?(b=a.substring(0,f),c=a.substring(f+1,a.length)):b=a,d=c||b,f=d.indexOf("!"),f!==-1&&(e="strip"===d.substring(f+1),d=d.substring(0,f),c?c=d:b=d),{moduleName:b,ext:c,strip:e}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,b,d,e){var f,g,h,i=c.xdRegExp.exec(a);return!i||(f=i[2],g=i[3],g=g.split(":"),h=g[1],g=g[0],!(f&&f!==b||g&&g.toLowerCase()!==d.toLowerCase()||(h||g)&&h!==e))},finishLoad:function(a,b,d,e){d=b?c.strip(d):d,p.isBuild&&(o[a]=d),e(d)},load:function(a,b,d,e){if(e&&e.isBuild&&!e.inlineText)return void d();p.isBuild=e&&e.isBuild;var f=c.parseName(a),g=f.moduleName+(f.ext?"."+f.ext:""),h=b.toUrl(g),i=p.useXhr||c.useXhr;return 0===h.indexOf("empty:")?void d():void(!k||i(h,l,m,n)?c.get(h,function(b){c.finishLoad(a,f.strip,b,d)},function(a){d.error&&d.error(a)}):b([g],function(a){c.finishLoad(f.moduleName+"."+f.ext,f.strip,a,d)}))},write:function(a,b,d,e){if(o.hasOwnProperty(b)){var f=c.jsEscape(o[b]);d.asModule(a+"!"+b,"define(function () { return '"+f+"';});\n")}},writeFile:function(a,b,d,e,f){var g=c.parseName(b),h=g.ext?"."+g.ext:"",i=g.moduleName+h,j=d.toUrl(g.moduleName+h)+".js";c.load(i,d,function(b){var d=function(a){return e(j,a)};d.asModule=function(a,b){return e.asModule(a,j,b)},c.write(a,i,d,f)},f)}},"node"===p.env||!p.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]?(d=b.nodeRequire("fs"),c.get=function(a,b,c){try{var e=d.readFileSync(a,"utf8");0===e.indexOf("\ufeff")&&(e=e.substring(1)),b(e)}catch(f){c&&c(f)}}):"xhr"===p.env||!p.env&&c.createXhr()?c.get=function(a,b,d,e){var f,g=c.createXhr();if(g.open("GET",a,!0),e)for(f in e)e.hasOwnProperty(f)&&g.setRequestHeader(f.toLowerCase(),e[f]);p.onXhr&&p.onXhr(g,a),g.onreadystatechange=function(c){var e,f;4===g.readyState&&(e=g.status||0,e>399&&e<600?(f=new Error(a+" HTTP status: "+e),f.xhr=g,d&&d(f)):b(g.responseText),p.onXhrComplete&&p.onXhrComplete(g,a))},g.send(null)}:"rhino"===p.env||!p.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?c.get=function(a,b){var c,d,e="utf-8",f=new java.io.File(a),g=java.lang.System.getProperty("line.separator"),h=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(f),e)),i="";try{for(c=new java.lang.StringBuffer,d=h.readLine(),d&&d.length()&&65279===d.charAt(0)&&(d=d.substring(1)),null!==d&&c.append(d);null!==(d=h.readLine());)c.append(g),c.append(d);i=String(c.toString())}finally{h.close()}b(i)}:("xpconnect"===p.env||!p.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(e=Components.classes,f=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),g="@mozilla.org/windows-registry-key;1"in e,c.get=function(a,b){var c,d,h,i={};g&&(a=a.replace(/\//g,"\\")),h=new FileUtils.File(a);try{c=e["@mozilla.org/network/file-input-stream;1"].createInstance(f.nsIFileInputStream),c.init(h,1,0,!1),d=e["@mozilla.org/intl/converter-input-stream;1"].createInstance(f.nsIConverterInputStream),d.init(c,"utf-8",c.available(),f.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),d.readString(c.available(),i),d.close(),c.close(),b(i.value)}catch(j){throw new Error((h&&h.path||"")+": "+j)}}),c}),c("text!DeviceManager/template/devices.html",[],function(){return'
<%= deviceLabel %>
\n
\n \n \n \n
\n
\n
\n
\n'}),c("DeviceManager/view/DevicesView",["backbone","text!./../template/devices.html"],function(a,b){return a.View.extend({template:_.template(b),events:{change:"updateDevice"},initialize:function(a){this.config=a.config||{},this.em=this.config.em,this.ppfx=this.config.pStylePrefix||"",this.events["click ."+this.ppfx+"add-trasp"]=this.startAdd,this.listenTo(this.em,"change:device",this.updateSelect),this.delegateEvents()},startAdd:function(){},updateDevice:function(){var a=this.em;if(a){var b=this.devicesEl,c=b?b.val():"";a.set("device",c)}},updateSelect:function(){var a=this.em,b=this.devicesEl;if(a&&a.getDeviceModel&&b){var c=a.getDeviceModel(),d=c?c.get("name"):"";b.val(d)}},getOptions:function(){var a="";return this.collection.each(function(b){var c=b.get("name");a+='"}),a},render:function(){var a=this.ppfx;return this.$el.html(this.template({ppfx:a,deviceLabel:this.config.deviceLabel})),this.devicesEl=this.$el.find("."+a+"devices"),this.devicesEl.append(this.getOptions()),this.el.className=a+"devices-c",this}})}),c("DeviceManager/main",["require","./config/config","./model/Devices","./view/DevicesView"],function(a){return function(){var b,c,d={},e=a("./config/config"),f=a("./model/Devices"),g=a("./view/DevicesView");return{name:"DeviceManager",init:function(a){d=a||{};for(var h in e)h in d||(d[h]=e[h]);return b=new f(d.devices),c=new g({collection:b,config:d}),this},add:function(a,c,d){var e=d||{};return e.name=a,e.width=c,b.add(e)},get:function(a){return b.get(a)},getAll:function(){return b},render:function(){return c.render().el}}}}),c("DeviceManager",["DeviceManager/main"],function(a){return a}),c("Parser/config/config",[],function(){return{textTags:["br","b","i","u"]}}),c("Parser/model/ParserCss",["require"],function(a){return function(a){return{parseSelector:function(a){for(var b=[],c=[],d=a.split(","),e=0,f=d.length;e\n
<%= label %>
\n
\n \n
\n \n \n \n
\n
\n
\n
\n
\n
\n\n
\n
\n \n \n
\n
\n
Selected
\n
\n
\n
\n'}),c("text!SelectorManager/template/classTag.html",[],function(){return'\n \n />\n \n'}),c("SelectorManager/view/ClassTagView",["backbone","text!./../template/classTag.html"],function(a,b){return a.View.extend({template:_.template(b),events:{},initialize:function(a){this.config=a.config||{},this.coll=a.coll||null,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.inputProp="readonly",this.target=this.config.em,this.className=this.pfx+"tag",this.closeId=this.pfx+"close",this.chkId=this.pfx+"checkbox",this.labelId=this.pfx+"tag-label",this.events["click #"+this.closeId]="removeTag",this.events["click #"+this.chkId]="changeStatus",this.events["dblclick #"+this.labelId]="startEditTag",this.events["keypress #"+this.labelId+" input"]="updateInputLabel",this.events["blur #"+this.labelId+" input"]="endEditTag",this.listenTo(this.model,"change:active",this.updateStatus),this.delegateEvents()},startEditTag:function(){this.$labelInput.prop(this.inputProp,!1)},endEditTag:function(){var a=this.$labelInput.val(),b=this.model.escapeName(a);if(this.target){var c=this.target.get("SelectorManager");c&&(c.get(b)?this.$labelInput.val(this.model.get("label")):this.model.set({name:b,label:a}))}this.$labelInput.prop(this.inputProp,!0)},changeStatus:function(){this.model.set("active",!this.model.get("active")),this.target.trigger("targetClassUpdated")},removeTag:function(a){var b=this.target.get("selectedComponent");b&&b.get("classes").remove(this.model),this.coll&&(this.coll.remove(this.model),this.target.trigger("targetClassRemoved")),this.remove()},updateStatus:function(){this.$chk||(this.$chk=this.$el.find("#"+this.pfx+"checkbox")),this.model.get("active")?(this.$chk.removeClass("fa-circle-o").addClass("fa-dot-circle-o"),this.$el.removeClass("opac50")):(this.$chk.removeClass("fa-dot-circle-o").addClass("fa-circle-o"),this.$el.addClass("opac50"))},updateInputLabel:function(){this.$labelInput||(this.$labelInput=this.$el.find("input"));var a=this.$labelInput.val().length-1;a=a<1?1:a,this.$labelInput.attr("size",a)},render:function(){return this.$el.html(this.template({label:this.model.get("label"),pfx:this.pfx,ppfx:this.ppfx,inputProp:this.inputProp})),this.updateStatus(),this.$el.attr("class",this.className),this.updateInputLabel(),this}})}),c("SelectorManager/view/ClassTagsView",["backbone","text!./../template/classTags.html","./ClassTagView"],function(a,b,c){return a.View.extend({template:_.template(b),events:{},initialize:function(a){this.config=a.config||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.className=this.pfx+"tags",this.addBtnId=this.pfx+"add-tag",this.newInputId=this.pfx+"new",this.stateInputId=this.pfx+"states",this.stateInputC=this.pfx+"input-c",this.states=this.config.states||[],this.events["click #"+this.addBtnId]="startNewTag",this.events["blur #"+this.newInputId]="endNewTag",this.events["keyup #"+this.newInputId]="onInputKeyUp",this.events["change #"+this.stateInputId]="stateChanged",this.target=this.config.em,this.listenTo(this.target,"change:selectedComponent",this.componentChanged),this.listenTo(this.target,"targetClassUpdated",this.updateSelector),this.listenTo(this.collection,"add",this.addNew),this.listenTo(this.collection,"reset",this.renderClasses),this.listenTo(this.collection,"remove",this.tagRemoved),this.delegateEvents()},tagRemoved:function(a){this.updateStateVis()},getStateOptions:function(){for(var a="",b=0;b'+this.states[b].label+"";return a},addNew:function(a){this.addToClasses(a)},startNewTag:function(a){this.$addBtn.hide(),this.$input.show().focus()},endNewTag:function(a){this.$addBtn.show(),this.$input.hide().val("")},onInputKeyUp:function(a){13===a.keyCode?this.addNewTag(this.$input.val()):27===a.keyCode&&this.endNewTag()},componentChanged:function(a){this.compTarget=this.target.get("selectedComponent"),this.compTarget&&this.getStates().val(this.compTarget.get("state"));var b=this.compTarget?this.compTarget.get("classes").models:[];this.collection.reset(b),this.updateStateVis()},updateStateVis:function(){this.collection.length?this.getStatesC().css("display","block"):this.getStatesC().css("display","none"),this.updateSelector()},updateSelector:function(){if(this.compTarget=this.target.get("selectedComponent"),this.compTarget&&this.compTarget.get){var a="",b=this.compTarget.get("classes");b.each(function(b){b.get("active")&&(a+="."+b.get("name"))});var c=this.compTarget.get("state");a=c?a+":"+c:a;var d=this.el.querySelector("#"+this.pfx+"sel");d&&(d.innerHTML=a)}},stateChanged:function(a){this.compTarget&&(this.compTarget.set("state",this.$states.val()),this.target&&this.target.trigger("targetStateUpdated"),this.updateSelector())},addNewTag:function(a){if(a){if(this.target){var b=this.target.get("SelectorManager"),c=b.add(a);if(this.compTarget){var d=this.compTarget.get("classes"),e=d.length;d.add(c);var f=d.length;this.collection.add(c),f>e&&this.target.trigger("targetClassAdded"),this.updateStateVis()}}this.endNewTag()}},addToClasses:function(a,b){var d=b||null,e=new c({model:a,config:this.config,coll:this.collection}),f=e.render().el;return d?d.appendChild(f):this.getClasses().append(f),f},renderClasses:function(){var a=document.createDocumentFragment();return this.collection.each(function(b){this.addToClasses(b,a)},this),this.getClasses()&&this.getClasses().empty().append(a),this},getClasses:function(){return this.$classes||(this.$classes=this.$el.find("#"+this.pfx+"tags-c")),this.$classes},getStates:function(){return this.$states||(this.$states=this.$el.find("#"+this.stateInputId)),this.$states},getStatesC:function(){return this.$statesC||(this.$statesC=this.$el.find("#"+this.stateInputC)),this.$statesC},render:function(){return this.$el.html(this.template({label:this.config.label,statesLabel:this.config.statesLabel,pfx:this.pfx,ppfx:this.ppfx})),this.$input=this.$el.find("input#"+this.newInputId),this.$addBtn=this.$el.find("#"+this.addBtnId),this.$classes=this.$el.find("#"+this.pfx+"tags-c"),this.$states=this.$el.find("#"+this.stateInputId),this.$statesC=this.$el.find("#"+this.stateInputC),this.$states.append(this.getStateOptions()),this.renderClasses(),this.$el.attr("class",this.className),this}})}),c("SelectorManager/main",["require","./config/config","./model/Selectors","./view/ClassTagsView"],function(a){return function(b){var c=b||{},d=a("./config/config");Selectors=a("./model/Selectors"),ClassTagsView=a("./view/ClassTagsView");var e,f;return{name:"SelectorManager",init:function(a){c=a||{};for(var b in d)b in c||(c[b]=d[b]);var g=c.pStylePrefix;return g&&(c.stylePrefix=g+c.stylePrefix),e=new Selectors(c.selectors,{em:c.em,config:c}),f=new ClassTagsView({collection:e,config:c}),this},add:function(a,b){var c=b||{};return c.name=a.name||a,e.add(c)},get:function(a){return e.where({name:a})[0]},getAll:function(){return e},render:function(a){if(a){var b=new ClassTagsView({collection:new Selectors(a),config:c});return b.render().el}return f.render().el}}}}),c("SelectorManager",["SelectorManager/main"],function(a){return a}),c("ModalDialog/config/config",[],function(){return{stylePrefix:"mdl-",title:"",content:"",backdrop:!0}}),c("ModalDialog/model/Modal",["backbone"],function(a){return a.Model.extend({ -defaults:{title:"",content:"",open:!1}})}),c("text!ModalDialog/template/modal.html",[],function(){return'
\n
\n
<%= title %>
\n
\n
\n
\n
<%= content %>
\n
\n
\n
\n
\n\n'}),c("ModalDialog/view/ModalView",["backbone","text!./../template/modal.html"],function(a,b){return a.View.extend({template:_.template(b),events:{},initialize:function(a){this.config=a.config||{},this.pfx=this.config.stylePrefix||"",this.listenTo(this.model,"change:open",this.updateOpen),this.listenTo(this.model,"change:title",this.updateTitle),this.listenTo(this.model,"change:content",this.updateContent),this.events["click ."+this.pfx+"btn-close"]="hide",this.config.backdrop&&(this.events["click ."+this.pfx+"backlayer"]="hide"),this.delegateEvents()},getCollector:function(){return this.$collector||(this.$collector=this.$el.find("."+this.pfx+"collector")),this.$collector},getContent:function(){return this.$content||(this.$content=this.$el.find("."+this.pfx+"content #"+this.pfx+"c")),this.$content},getTitle:function(){return this.$title||(this.$title=this.$el.find("."+this.pfx+"title")),this.$title.get(0)},updateContent:function(){var a=this.getContent();this.getCollector().append(a.children()),a.html(this.model.get("content"))},updateTitle:function(){var a=this.getTitle();a&&(a.innerHTML=this.model.get("title"))},updateOpen:function(){this.model.get("open")?this.$el.show():this.$el.hide()},hide:function(){this.model.set("open",0)},show:function(){this.model.set("open",1)},render:function(){var a=this.model.toJSON();return a.pfx=this.pfx,this.$el.html(this.template(a)),this.$el.attr("class",this.pfx+"container"),this.updateOpen(),this}})}),c("ModalDialog/main",["require","./config/config","./model/Modal","./view/ModalView"],function(a){return function(){var b,c,d={},e=a("./config/config"),f=a("./model/Modal"),g=a("./view/ModalView");return{name:"Modal",init:function(a){d=a||{};for(var h in e)h in d||(d[h]=e[h]);var i=d.pStylePrefix;return i&&(d.stylePrefix=i+d.stylePrefix),b=new f(d),c=new g({model:b,config:d}),d.em&&d.em.on("loaded",function(){this.render().appendTo(d.em.config.el||"body")},this),this},open:function(){return c.show(),this},close:function(){return c.hide(),this},isOpen:function(){return!!b.get("open")},setTitle:function(a){return b.set("title",a),this},getTitle:function(){return b.get("title")},setContent:function(a){return b.set("content"," "),b.set("content",a),this},getContent:function(){return b.get("content")},getContentEl:function(){return c.getContent().get(0)},getModel:function(){return b},render:function(){return c.render().$el}}}}),c("ModalDialog",["ModalDialog/main"],function(a){return a}),c("CodeManager/config/config",[],function(){return{stylePrefix:"cm-",inlineCss:!1}}),c("CodeManager/model/HtmlGenerator",["backbone"],function(a){return a.Model.extend({build:function(a,b){var c=a.get("components")||a,d="";return c.each(function(a){d+=a.toHTML({cssc:b})},this),d}})}),c("CodeManager/model/CssGenerator",["backbone"],function(a){return a.Model.extend({initialize:function(){this.compCls=[]},buildFromModel:function(a){var b="",c=a.get("style"),d=a.get("classes");if(d&&d.each(function(a){this.compCls.push(a.get("name"))},this),c&&0!==Object.keys(c).length){b+="#"+a.cid+"{";for(var e in c)c.hasOwnProperty(e)&&(b+=e+":"+c[e]+";");b+="}"}return b},buildFromComp:function(a){var b=a.get("components")||a,c="";return b.each(function(a){var b=a.get("components");c+=this.buildFromModel(a),b.length&&(c+=this.buildFromComp(b))},this),c},build:function(a,b){this.compCls=[];var c=this.buildFromModel(a);c+=this.buildFromComp(a);this.compCls;if(b){var d=b.getAll(),e={};d.each(function(a){var b=a.get("mediaText");if(b){var d=e[b];return void(d?d.push(a):e[b]=[a])}c+=this.buildFromRule(a)},this);for(var f in e){for(var g=e[f],h="",i=0,j=g.length;i-1&&(h=1)}),g&&h||c){g+=f?":"+f:"",g+=c?(g?", ":"")+c:"";var j="";if(e&&0!==Object.keys(e).length)for(var k in e)e.hasOwnProperty(k)&&(j+=k+":"+e[k]+";");j&&(b+=g+"{"+j+"}")}return b}})}),c("CodeManager/model/JsonGenerator",["backbone"],function(a){return a.Model.extend({build:function(b){var c=b.toJSON();return this.beforeEach(c),_.each(c,function(b,d){var e=c[d];if(e instanceof a.Model)c[d]=this.build(e);else if(e instanceof a.Collection){var f=e;c[d]=[],f.length&&f.each(function(a,b){c[d][b]=this.build(a)},this)}},this),c},beforeEach:function(a){delete a.status}})}),c("CodeManager/model/JsGenerator",["backbone"],function(a){return a.Model.extend({mapModel:function(a){var b="",c=a.get("script"),d=a.get("type"),e=a.get("components"),f=a.cid;if(c){var g=a.get("attributes");g=_.extend({},g,{id:f}),a.set("attributes",g);var h="function(){"+c+"}";if(h="function"==typeof c?c.toString():h,a.get("scriptUpdated"))this.mapJs[d+"-"+f]={ids:[f],code:h};else{var i=this.mapJs[d];i?i.ids.push(f):this.mapJs[d]={ids:[f],code:h}}}return e.each(function(a){b+=this.mapModel(a)},this),b},build:function(a){this.mapJs={},this.mapModel(a);var b="";for(var c in this.mapJs){var d=this.mapJs[c],e="#"+d.ids.join(", #");b+='var items = document.querySelectorAll("'+e+'");for (var i = 0, len = items.length; i < len; i++) {('+d.code+".bind(items[i]))();}"}return b}})}),function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof c&&c.amd?c("codemirror/lib/codemirror",b):a.CodeMirror=b()}(this,function(){"use strict";function a(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function b(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function c(a,c){return b(a).appendChild(c)}function d(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}}function l(){this.id=null}function m(a,b){for(var c=0;c=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function o(a){for(;Hg.length<=a;)Hg.push(p(Hg)+" ");return Hg[a]}function p(a){return a[a.length-1]}function q(a,b){for(var c=[],d=0;d"€"&&(a.toUpperCase()!=a.toLowerCase()||Ig.test(a))}function v(a,b){return b?!!(b.source.indexOf("\\w")>-1&&u(a))||b.test(a):u(a)}function w(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function x(a){return a.charCodeAt(0)>=768&&Jg.test(a)}function y(a,b,c){var e=this;this.input=c,e.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),e.scrollbarFiller.setAttribute("cm-not-content","true"),e.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),e.gutterFiller.setAttribute("cm-not-content","true"),e.lineDiv=d("div",null,"CodeMirror-code"),e.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),e.cursorDiv=d("div",null,"CodeMirror-cursors"),e.measure=d("div",null,"CodeMirror-measure"),e.lineMeasure=d("div",null,"CodeMirror-measure"),e.lineSpace=d("div",[e.measure,e.lineMeasure,e.selectionDiv,e.cursorDiv,e.lineDiv],null,"position: relative; outline: none"),e.mover=d("div",[d("div",[e.lineSpace],"CodeMirror-lines")],null,"position: relative"),e.sizer=d("div",[e.mover],"CodeMirror-sizer"),e.sizerWidth=null,e.heightForcer=d("div",null,null,"position: absolute; height: "+Cg+"px; width: 1px;"),e.gutters=d("div",null,"CodeMirror-gutters"),e.lineGutter=null,e.scroller=d("div",[e.sizer,e.heightForcer,e.gutters],"CodeMirror-scroll"),e.scroller.setAttribute("tabIndex","-1"),e.wrapper=d("div",[e.scrollbarFiller,e.gutterFiller,e.scroller],"CodeMirror"),gg&&hg<8&&(e.gutters.style.zIndex=-1,e.scroller.style.paddingRight=0),ig||dg&&qg||(e.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(e.wrapper):a(e.wrapper)),e.viewFrom=e.viewTo=b.first,e.reportedViewFrom=e.reportedViewTo=b.first,e.view=[],e.renderedView=null,e.externalMeasured=null,e.viewOffset=0,e.lastWrapHeight=e.lastWrapWidth=0,e.updateLineNumbers=null,e.nativeBarWidth=e.barHeight=e.barWidth=0,e.scrollbarsClipped=!1,e.lineNumWidth=e.lineNumInnerWidth=e.lineNumChars=null,e.alignWidgets=!1,e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.maxLine=null,e.maxLineLength=0,e.maxLineChanged=!1,e.wheelDX=e.wheelDY=e.wheelStartX=e.wheelStartY=null,e.shift=!1,e.selForContextMenu=null,e.activeTouch=null,c.init(e)}function z(a,b){if(b-=a.first,b<0||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b=a.first&&bc?H(c,z(a,c).text.length):O(b,z(a,b.line).text.length)}function O(a,b){var c=a.ch;return null==c||c>b?H(a.line,b):c<0?H(a.line,0):a}function P(a,b){for(var c=[],d=0;d=b:f.to>b);(d||(d=[])).push(new S(g,f.from,i?null:f.to))}}return d}function X(a,b,c){var d;if(a)for(var e=0;e=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var v=0;v0)){var k=[i,1],l=I(j.from,h.from),n=I(j.to,h.to);(l<0||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(n>0||!g.inclusiveRight&&!n)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function _(a){var b=a.markedSpans;if(b){for(var c=0;c=0&&l<=0||k<=0&&l>=0)&&(k<=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?I(j.to,c)>=0:I(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?I(j.from,d)<=0:I(j.from,d)<0)))return!0}}}function ia(a){for(var b;b=fa(a);)a=b.find(-1,!0).line;return a}function ja(a){for(var b,c;b=ga(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function ka(a,b){var c=z(a,b),d=ia(c);return c==d?b:D(d)}function la(a,b){if(b>a.lastLine())return b;var c,d=z(a,b);if(!ma(a,d))return b;for(;c=ga(d);)d=c.find(1,!0).line;return D(d)+1}function ma(a,b){var c=Lg&&b.markedSpans;if(c)for(var d=void 0,e=0;eb.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function ra(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;fb||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function sa(a){return a.level%2?a.to:a.from}function ta(a){return a.level%2?a.from:a.to}function ua(a){var b=Ba(a);return b?sa(b[0]):0}function va(a){var b=Ba(a);return b?ta(p(b)):a.text.length}function wa(a,b,c){var d=a[0].level;return b==d||c!=d&&bb)return d;if(e.from==b||e.to==b){if(null!=c)return wa(a,e.level,a[c].level)?(e.from!=e.to&&(Mg=c),d):(e.from!=e.to&&(Mg=d),c);c=d}}return c}function ya(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&x(a.text.charAt(b)));return b}function za(a,b,c,d){var e=Ba(a);if(!e)return Aa(a,b,c,d);for(var f=xa(e,b),g=e[f],h=ya(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?ya(a,g.to,-1,d):ya(a,g.from,1,d)}}function Aa(a,b,c,d){var e=b+c;if(d)for(;e>0&&x(a.text.charAt(e));)e+=c;return e<0||e>a.text.length?null:e}function Ba(a){var b=a.order;return null==b&&(b=a.order=Ng(a.text)),b}function Ca(a,b){return a._handlers&&a._handlers[b]||Og}function Da(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers,e=d&&d[b];if(e){var f=m(e,c);f>-1&&(d[b]=e.slice(0,f).concat(e.slice(f+1)))}}}function Ea(a,b){var c=Ca(a,b);if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e0}function Ia(a){a.prototype.on=function(a,b){Pg(this,a,b)},a.prototype.off=function(a,b){Da(this,a,b)}}function Ja(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ka(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function La(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Ma(a){Ja(a),Ka(a)}function Na(a){return a.target||a.srcElement}function Oa(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),rg&&a.ctrlKey&&1==b&&(b=3),b}function Pa(a){if(null==Ag){var b=d("span","​");c(a,d("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Ag=b.offsetWidth<=1&&b.offsetHeight>2&&!(gg&&hg<8))}var e=Ag?d("span","​"):d("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return e.setAttribute("cm-text",""),e}function Qa(a){if(null!=Bg)return Bg;var d=c(a,document.createTextNode("AخA")),e=vg(d,0,1).getBoundingClientRect(),f=vg(d,1,2).getBoundingClientRect();return b(a),!(!e||e.left==e.right)&&(Bg=f.right-e.right<3)}function Ra(a){if(null!=Ug)return Ug;var b=c(a,d("span","x")),e=b.getBoundingClientRect(),f=vg(b,0,1).getBoundingClientRect();return Ug=Math.abs(e.left-f.left)>1}function Sa(a,b){arguments.length>2&&(b.dependencies=Array.prototype.slice.call(arguments,2)),Vg[a]=b}function Ta(a,b){Wg[a]=b}function Ua(a){if("string"==typeof a&&Wg.hasOwnProperty(a))a=Wg[a];else if(a&&"string"==typeof a.name&&Wg.hasOwnProperty(a.name)){var b=Wg[a.name];"string"==typeof b&&(b={name:b}),a=t(b,a),a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return Ua("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return Ua("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function Va(a,b){b=Ua(b);var c=Vg[b.name];if(!c)return Va(a,"text/plain");var d=c(a,b);if(Xg.hasOwnProperty(b.name)){var e=Xg[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var g in b.modeProps)d[g]=b.modeProps[g];return d}function Wa(a,b){var c=Xg.hasOwnProperty(a)?Xg[a]:Xg[a]={};j(b,c)}function Xa(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function Ya(a,b){for(var c;a.innerMode&&(c=a.innerMode(b),c&&c.mode!=a);)b=c.state,a=c.mode;return c||{mode:a,state:b}}function Za(a,b,c){return!a.startState||a.startState(b,c)}function $a(a,b,c,d){var e=[a.state.modeGen],f={};gb(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);for(var g=function(c){var d=a.state.overlays[c],g=1,h=0;gb(a,b.text,d.mode,!0,function(a,b){for(var c=g;ha&&e.splice(g,1,a,e[g+1],f),g+=2,h=Math.min(a,f)}if(b)if(d.opaque)e.splice(c,g-c,a,"overlay "+b),g=c+2;else for(;ca.options.maxHighlightLength?Xa(a.doc.mode,d):d);b.stateAfter=d,b.styles=e.styles,e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function ab(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=hb(a,b,c),g=f>d.first&&z(d,f-1).stateAfter;return g=g?Xa(d.mode,g):Za(d.mode),d.iter(f,b,function(c){bb(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&fb.start)return f}throw new Error("Mode "+a.name+" failed to advance stream.")}function eb(a,b,c,d){var e,f=function(a){return{start:l.start,end:l.pos,string:l.current(),type:e||null,state:a?Xa(g.mode,k):k}},g=a.doc,h=g.mode;b=N(g,b);var i,j=z(g,b.line),k=ab(a,b.line,c),l=new Yg(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.posa.options.maxHighlightLength?(h=!1,g&&bb(a,b,d,l.pos),l.pos=b.length,i=null):i=fb(db(c,l,d,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;jg;--h){if(h<=f.first)return f.first;var i=z(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=k(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function ib(a,b,c){this.text=a,aa(this,b),this.height=c?c(this):1}function jb(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),_(a),aa(a,c);var e=d?d(a):1;e!=a.height&&C(a,e)}function kb(a){a.parent=null,_(a)}function lb(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?_g:$g;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function mb(a,b){var c=d("span",null,null,ig?"padding-right: .1px":null),e={pre:d("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(gg||ig)&&a.getOption("lineWrapping")};b.measure={};for(var f=0;f<=(b.rest?b.rest.length:0);f++){var g=f?b.rest[f-1]:b.line,i=void 0;e.pos=0,e.addToken=ob,Qa(a.display.measure)&&(i=Ba(g))&&(e.addToken=qb(e.addToken,i)),e.map=[];var j=b!=a.display.externalMeasured&&D(g);sb(g,e,_a(a,g,j)),g.styleClasses&&(g.styleClasses.bgClass&&(e.bgClass=h(g.styleClasses.bgClass,e.bgClass||"")),g.styleClasses.textClass&&(e.textClass=h(g.styleClasses.textClass,e.textClass||""))),0==e.map.length&&e.map.push(0,0,e.content.appendChild(Pa(a.display.measure))),0==f?(b.measure.map=e.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(e.map),(b.measure.caches||(b.measure.caches=[])).push({}))}if(ig){var k=e.content.lastChild;(/\bcm-tab\b/.test(k.className)||k.querySelector&&k.querySelector(".cm-tab"))&&(e.content.className="cm-tab-wrap-hack")}return Ea(a,"renderLine",a,b.line,e.pre),e.pre.className&&(e.textClass=h(e.pre.className,e.textClass||"")),e}function nb(a){var b=d("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function ob(a,b,c,e,f,g,h){if(b){var i,j=a.splitSpaces?pb(b,a.trailingSpace):b,k=a.cm.state.specialChars,l=!1;if(k.test(b)){i=document.createDocumentFragment();for(var m=0;;){k.lastIndex=m;var n=k.exec(b),p=n?n.index-m:b.length-m;if(p){var q=document.createTextNode(j.slice(m,m+p));gg&&hg<9?i.appendChild(d("span",[q])):i.appendChild(q),a.map.push(a.pos,a.pos+p,q),a.col+=p,a.pos+=p}if(!n)break;m+=p+1;var r=void 0;if("\t"==n[0]){var s=a.cm.options.tabSize,t=s-a.col%s;r=i.appendChild(d("span",o(t),"cm-tab")),r.setAttribute("role","presentation"),r.setAttribute("cm-text","\t"),a.col+=t}else"\r"==n[0]||"\n"==n[0]?(r=i.appendChild(d("span","\r"==n[0]?"␍":"␤","cm-invalidchar")),r.setAttribute("cm-text",n[0]),a.col+=1):(r=a.cm.options.specialCharPlaceholder(n[0]),r.setAttribute("cm-text",n[0]),gg&&hg<9?i.appendChild(d("span",[r])):i.appendChild(r),a.col+=1);a.map.push(a.pos,a.pos+1,r),a.pos++}}else a.col+=b.length,i=document.createTextNode(j),a.map.push(a.pos,a.pos+b.length,i),gg&&hg<9&&(l=!0),a.pos+=b.length;if(a.trailingSpace=32==j.charCodeAt(b.length-1),c||e||f||l||h){var u=c||"";e&&(u+=e),f&&(u+=f);var v=d("span",[i],u,h);return g&&(v.title=g),a.content.appendChild(v)}a.content.appendChild(i)}}function pb(a,b){if(a.length>1&&!/ /.test(a))return a;for(var c=b,d="",e=0;ej&&l.from<=j));m++);if(l.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,l.to-j),e,f,null,h,i),f=null,d=d.slice(l.to-j),j=l.to}}}function rb(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b,a.trailingSpace=!1}function sb(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s=[],t=void 0,u=0;uo||w.collapsed&&v.to==o&&v.from==o)?(null!=v.to&&v.to!=o&&r>v.to&&(r=v.to,j=""),w.className&&(i+=" "+w.className),w.css&&(h=(h?h+";":"")+w.css),w.startStyle&&v.from==o&&(k+=" "+w.startStyle),w.endStyle&&v.to==r&&(t||(t=[])).push(w.endStyle,v.to),w.title&&!l&&(l=w.title),w.collapsed&&(!m||da(m.marker,w)<0)&&(m=v)):v.from>o&&r>v.from&&(r=v.from)}if(t)for(var x=0;x=n)break;for(var z=Math.min(n,r);;){if(q){var A=o+q.length;if(!m){var B=A>z?q.slice(0,z-o):q;b.addToken(b,B,g?g+i:i,k,o+B.length==r?j:"",l,h)}if(A>=z){q=q.slice(z-o),o=z;break}o=A,k=""}q=e.slice(f,f=c[p++]),g=lb(c[p++],b.cm.options)}}else for(var C=1;C2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Vb(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;dc)return{map:a.measure.maps[e],cache:a.measure.caches[e],before:!0}}function Wb(a,b){b=ia(b);var d=D(b),e=a.display.externalMeasured=new tb(a.doc,b,d);e.lineN=d;var f=e.built=mb(a,e);return e.text=f.pre,c(a.display.lineMeasure,f.pre),e}function Xb(a,b,c,d){return $b(a,Zb(a,b),c,d)}function Yb(a,b){if(b>=a.display.viewFrom&&b=c.lineN&&bb)&&(f=i-h,e=f-1,b>=i&&(g="right")),null!=e){if(d=a[j+2],h==i&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;j&&a[j-2]==a[j-3]&&a[j-1].insertLeft;)d=a[(j-=3)+2],g="left";if("right"==c&&e==i-h)for(;j=0&&(c=a[e]).left==c.right;e--);return c}function bc(a,b,c,d){var e,f=_b(b.map,c,d),g=f.node,h=f.start,i=f.end,j=f.collapse;if(3==g.nodeType){for(var k=0;k<4;k++){for(;h&&x(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+i0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(gg&&hg<9&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+rc(a.display),top:m.top,bottom:m.bottom}:ch}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,r=0;rc.from?g(a-1):g(a,d)}d=d||z(a.doc,b.line),e||(e=Zb(a,d));var i=Ba(d),j=b.ch;if(!i)return g(j);var k=xa(i,j),l=h(j,k);return null!=Mg&&(l.other=h(j,Mg)),l}function mc(a,b){var c=0;b=N(a.doc,b),a.options.lineWrapping||(c=rc(a.display)*b.ch);var d=z(a.doc,b.line),e=oa(d)+Ob(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function nc(a,b,c,d){var e=H(a,b);return e.xRel=d,c&&(e.outside=!0),e}function oc(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,c<0)return nc(d.first,0,!0,-1);var e=E(d,c),f=d.first+d.size-1;if(e>f)return nc(d.first+d.size-1,z(d,f).text.length,!0,1);b<0&&(b=0);for(var g=z(d,e);;){var h=pc(a,g,e,b,c),i=ga(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=D(g=j.to.line)}}function pc(a,b,c,d,e){function f(d){var e=lc(a,H(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:gq)return nc(c,n,r,1);for(;;){if(k?n==m||n==za(b,m,1):n-m<=1){var s=d0&&s1){var v=$b(a,j,s,"right");g<=v.bottom&&g>=v.top&&Math.abs(d-v.right)1?1:0);return w}var y=Math.ceil(l/2),z=m+y;if(k){z=m;for(var A=0;Ad?(n=z,q=B,(r=h)&&(q+=1e3),l=y):(m=z,o=B,p=h,l-=y)}}function qc(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Zg){Zg=d("pre");for(var e=0;e<49;++e)Zg.appendChild(document.createTextNode("x")),Zg.appendChild(d("br"));Zg.appendChild(document.createTextNode("x"))}c(a.measure,Zg);var f=Zg.offsetHeight/50;return f>3&&(a.cachedTextHeight=f),b(a.measure),f||1}function rc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=d("span","xxxxxxxxxx"),e=d("pre",[b]);c(a.measure,e);var f=b.getBoundingClientRect(),g=(f.right-f.left)/10;return g>2&&(a.cachedCharWidth=g),g||10}function sc(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:tc(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function tc(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function uc(a){var b=qc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/rc(a.display)-3);return function(e){if(ma(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g=a.display.viewTo)return null;if(b-=a.display.viewFrom,b<0)return null;for(var c=a.display.view,d=0;d=a.display.viewTo||h.to().line3&&(e(n,p.top,null,p.bottom),n=k,p.bottomi.bottom||j.bottom==i.bottom&&j.right>i.right)&&(i=j),n0?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Dc(a){a.state.focused||(a.display.input.focus(),Fc(a))}function Ec(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Gc(a))},100)}function Fc(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(Ea(a,"focus",a,b),a.state.focused=!0,g(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),ig&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Cc(a))}function Gc(a,b){a.state.delayingBlurEvent||(a.state.focused&&(Ea(a,"blur",a,b),a.state.focused=!1,yg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function Hc(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=tc(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g.001||i<-.001)&&(C(e.line,f),Kc(e.line),e.rest))for(var j=0;j=g&&(f=E(b,oa(z(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function Mc(a,b){Math.abs(a.doc.scrollTop-b)<2||(a.doc.scrollTop=b,dg||Ad(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),dg&&Ad(a),ud(a,100))}function Nc(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,Hc(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Oc(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}}function Pc(a){var b=Oc(a);return b.x*=eh,b.y*=eh,b}function Qc(a,b){var c=Oc(b),d=c.x,e=c.y,f=a.display,g=f.scroller,h=g.scrollWidth>g.clientWidth,i=g.scrollHeight>g.clientHeight;if(d&&h||e&&i){if(e&&rg&&ig)a:for(var j=b.target,k=f.view;j!=g;j=j.parentNode)for(var l=0;l(window.innerHeight||document.documentElement.clientHeight)&&(f=!1),null!=f&&!og){var g=d("div","​",null,"position: absolute;\n top: "+(b.top-c.viewOffset-Ob(a.display))+"px;\n height: "+(b.bottom-b.top+Rb(a)+c.barHeight)+"px;\n left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(g),g.scrollIntoView(f),a.display.lineSpace.removeChild(g)}}}function Yc(a,b,c,d){null==d&&(d=0);for(var e,f=0;f<5;f++){var g=!1;e=lc(a,b);var h=c&&c!=b?lc(a,c):e,i=$c(a,Math.min(e.left,h.left),Math.min(e.top,h.top)-d,Math.max(e.left,h.left),Math.max(e.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(Mc(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(g=!0)),null!=i.scrollLeft&&(Nc(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(g=!0)),!g)break}return e}function Zc(a,b,c,d,e){var f=$c(a,b,c,d,e);null!=f.scrollTop&&Mc(a,f.scrollTop),null!=f.scrollLeft&&Nc(a,f.scrollLeft)}function $c(a,b,c,d,e){var f=a.display,g=qc(a.display);c<0&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Tb(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Pb(f),l=ck-g;if(ch+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=Sb(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0),q=d-b>p;return q&&(d=b+p),b<10?j.scrollLeft=0:bp+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function _c(a,b,c){null==b&&null==c||bd(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function ad(a){bd(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?H(b.line,b.ch-1):b,d=H(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function bd(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=mc(a,b.from),d=mc(a,b.to),e=$c(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function cd(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.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:++gh},vb(a.curOp)}function dd(a){var b=a.curOp;xb(b,function(a){for(var b=0;b=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new wd(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function gd(a){a.updatedDisplay=a.mustUpdate&&yd(a.cm,a.update)}function hd(a){var b=a.cm,c=b.display;a.updatedDisplay&&Jc(b),a.barMeasure=Rc(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Xb(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Rb(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Sb(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection(a.focus))}function id(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeftb)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Lg&&ka(a.doc,b)e.viewFrom?qd(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)qd(a);else if(b<=e.viewFrom){var f=rd(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):qd(a)}else if(c>=e.viewTo){var g=rd(a,b,b,-1);g?(e.view=e.view.slice(0,g.index),e.viewTo=g.lineN):qd(a)}else{var h=rd(a,b,b,-1),i=rd(a,c,c+d,1);h&&i?(e.view=e.view.slice(0,h.index).concat(ub(a,h.lineN,i.lineN)).concat(e.view.slice(i.index)),e.viewTo+=d):qd(a)}var j=e.externalMeasured;j&&(c=e.lineN&&b=d.viewTo)){var f=d.view[xc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);m(g,c)==-1&&g.push(c)}}}function qd(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function rd(a,b,c,d){var e,f=xc(a,b),g=a.display.view;if(!Lg||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=a.display.viewFrom,i=0;i0){if(f==g.length-1)return null;e=h+g[f].size-b,f++}else e=h-b;b+=e,c+=e}for(;ka(a.doc,c)!=c;){if(f==(d<0?0:g.length-1))return null;c+=d*g[f-(d<0?1:0)].size,f+=d}return{index:f,lineN:c}}function sd(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=ub(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=ub(a,b,d.viewFrom).concat(d.view):d.viewFromc&&(d.view=d.view.slice(0,xc(a,c)))),d.viewTo=c}function td(a){for(var b=a.display.view,c=0,d=0;d=a.display.viewTo)){var c=+new Date+a.options.workTime,d=Xa(b.mode,ab(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,i=$a(a,f,h?Xa(b.mode,d):d,!0);f.styles=i.styles;var j=f.styleClasses,k=i.classes;k?f.styleClasses=k:j&&(f.styleClasses=null);for(var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass),m=0;!l&&mc)return ud(a,a.options.workDelay),!0}),e.length&&kd(a,function(){for(var b=0;b=d.viewFrom&&c.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==td(a))return!1;Ic(a)&&(qd(a),c.dims=sc(a));var g=e.first+e.size,h=Math.max(c.visible.from-a.options.viewportMargin,e.first),i=Math.min(g,c.visible.to+a.options.viewportMargin);d.viewFromi&&d.viewTo-i<20&&(i=Math.min(g,d.viewTo)),Lg&&(h=ka(a.doc,h),i=la(a.doc,i));var j=h!=d.viewFrom||i!=d.viewTo||d.lastWrapHeight!=c.wrapperHeight||d.lastWrapWidth!=c.wrapperWidth;sd(a,h,i),d.viewOffset=oa(z(a.doc,d.viewFrom)),a.display.mover.style.top=d.viewOffset+"px";var k=td(a);if(!j&&0==k&&!c.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1; -var l=f();return k>4&&(d.lineDiv.style.display="none"),Bd(a,d.updateLineNumbers,c.dims),k>4&&(d.lineDiv.style.display=""),d.renderedView=d.view,l&&f()!=l&&l.offsetHeight&&l.focus(),b(d.cursorDiv),b(d.selectionDiv),d.gutters.style.height=d.sizer.style.minHeight=0,j&&(d.lastWrapHeight=c.wrapperHeight,d.lastWrapWidth=c.wrapperWidth,ud(a,400)),d.updateLineNumbers=null,!0}function zd(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Sb(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Pb(a.display)-Tb(a),c.top)}),b.visible=Lc(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&yd(a,b);d=!1){Jc(a);var e=Rc(a);yc(a),Uc(a,e),Dd(a,e)}b.signal(a,"update",a),a.display.viewFrom==a.display.reportedViewFrom&&a.display.viewTo==a.display.reportedViewTo||(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function Ad(a,b){var c=new wd(a,b);if(yd(a,c)){Jc(a),zd(a,c);var d=Rc(a);yc(a),Uc(a,d),Dd(a,d),c.finish()}}function Bd(a,c,d){function e(b){var c=b.nextSibling;return ig&&rg&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var f=a.display,g=a.options.lineNumbers,h=f.lineDiv,i=h.firstChild,j=f.view,k=f.viewFrom,l=0;l-1&&(o=!1),Ab(a,n,k,d)),o&&(b(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(G(a.options,k)))),i=n.node.nextSibling}else{var p=Ib(a,n,k,d);h.insertBefore(p,i)}k+=n.size}for(;i;)i=e(i)}function Cd(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px"}function Dd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px",a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=b.docHeight+a.display.barHeight+Rb(a)+"px"}function Ed(a){var c=a.display.gutters,e=a.options.gutters;b(c);for(var f=0;f-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function Gd(a,b){this.ranges=a,this.primIndex=b}function Hd(a,b){this.anchor=a,this.head=b}function Id(a,b){var c=a[b];a.sort(function(a,b){return I(a.from(),b.from())}),b=m(a,c);for(var d=1;d=0){var g=L(f.from(),e.from()),h=K(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;d<=b&&--b,a.splice(--d,2,new Hd(i?h:g,i?g:h))}}return new Gd(a,b)}function Jd(a,b){return new Gd([new Hd(a,b||a)],0)}function Kd(a){return a.text?H(a.from.line+a.text.length-1,p(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ld(a,b){if(I(a,b.from)<0)return a;if(I(a,b.to)<=0)return Kd(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Kd(b).ch-b.to.ch),H(c,d)}function Md(a,b){for(var c=[],d=0;d1&&a.remove(h.line+1,o-1),a.insert(h.line+1,s)}yb(a,"change",a,b)}function Td(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g1&&!a.done[a.done.length-2].ranges?(a.done.pop(),p(a.done)):void 0}function Zd(a,b,c,d){var e=a.history;e.undone.length=0;var f,g,h=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>h-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=Yd(e,e.lastOp==d)))g=p(f.changes),0==I(b.from,b.to)&&0==I(b.from,g.to)?g.to=Kd(b):f.changes.push(Wd(a,b));else{var i=p(e.done);for(i&&i.ranges||ae(a.sel,e.done),f={changes:[Wd(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=h,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,g||Ea(a,"historyAdded")}function $d(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function _d(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||$d(a,f,p(e.done),b))?e.done[e.done.length-1]=b:ae(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&Xd(e.undone)}function ae(a,b){var c=p(b);c&&c.ranges&&c.equals(a)||b.push(a)}function be(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ce(a){if(!a)return null;for(var b,c=0;c-1&&(p(h)[l]=j[l],delete j[l])}}}return d}function ge(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=I(c,e)<0;f!=I(d,e)<0?(e=c,c=d):f!=I(c,d)<0&&(c=d)}return new Hd(e,c)}return new Hd(d||c,c)}function he(a,b,c,d){ne(a,new Gd([ge(a,a.sel.primary(),b,c)],0),d)}function ie(a,b,c){for(var d=[],e=0;e=b.ch:h.to>b.ch))){if(e&&(Ea(i,"beforeCursorEnter"),i.explicitlyCleared)){if(f.markedSpans){--g;continue}break}if(!i.atomic)continue;if(c){var j=i.find(d<0?1:-1),k=void 0;if((d<0?i.inclusiveRight:i.inclusiveLeft)&&(j=ue(a,j,-d,j&&j.line==b.line?f:null)),j&&j.line==b.line&&(k=I(j,c))&&(d<0?k<0:k>0))return se(a,j,b,d,e)}var l=i.find(d<0?-1:1);return(d<0?i.inclusiveLeft:i.inclusiveRight)&&(l=ue(a,l,d,l.line==b.line?f:null)),l?se(a,l,b,d,e):null}}return b}function te(a,b,c,d,e){var f=d||1,g=se(a,b,c,f,e)||!e&&se(a,b,c,f,!0)||se(a,b,c,-f,e)||!e&&se(a,b,c,-f,!0);return g?g:(a.cantEdit=!0,H(a.first,0))}function ue(a,b,c,d){return c<0&&0==b.ch?b.line>a.first?N(a,H(b.line-1)):null:c>0&&b.ch==(d||z(a,b.line)).text.length?b.line=0;--e)ye(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else ye(a,b)}}function ye(a,b){if(1!=b.text.length||""!=b.text[0]||0!=I(b.from,b.to)){var c=Md(a,b);Zd(a,b,c,a.cm?a.cm.curOp.id:NaN),Be(a,b,c,Y(a,b));var d=[];Td(a,function(a,c){c||m(d,a.history)!=-1||(Ge(a.history,b),d.push(a.history)),Be(a,b,null,Y(a,b))})}}function ze(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i=0;--n){var o=l(n);if(o)return o.v}}}}function Ae(a,b){if(0!=b&&(a.first+=b,a.sel=new Gd(q(a.sel.ranges,function(a){return new Hd(H(a.anchor.line+b,a.anchor.ch),H(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){od(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;da.lastLine())){if(b.from.linef&&(b={from:b.from,to:H(f,z(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=A(a,b.from,b.to),c||(c=Md(a,b)),a.cm?Ce(a.cm,b,d):Sd(a,b,d),oe(a,c,Eg)}}function Ce(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=D(ia(z(d,f.line))),d.iter(i,g.line+1,function(a){if(a==e.maxLine)return h=!0,!0})),d.sel.contains(b.from,b.to)>-1&&Ga(a),Sd(d,b,c,uc(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=pa(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,f.line),ud(a,400);var j=b.text.length-(g.line-f.line)-1;b.full?od(a):f.line!=g.line||1!=b.text.length||Rd(a.doc,b)?od(a,f.line,g.line+1,j):pd(a,f.line,"text");var k=Ha(a,"changes"),l=Ha(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&yb(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}a.display.selForContextMenu=null}function De(a,b,c,d,e){if(d||(d=c),I(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),xe(a,{from:c,to:d,text:b,origin:e})}function Ee(a,b,c,d){c0||0==h&&g.clearWhenEmpty!==!1)return g;if(g.replacedWith&&(g.collapsed=!0,g.widgetNode=d("span",[g.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||g.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(g.widgetNode.insertLeft=!0)),g.collapsed){if(ha(a,b.line,b,c,g)||b.line!=c.line&&ha(a,c.line,b,c,g))throw new Error("Inserting collapsed marker partially overlapping an existing one");R()}g.addToHistory&&Zd(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var i,k=b.line,l=a.cm;if(a.iter(k,c.line+1,function(a){l&&g.collapsed&&!l.options.lineWrapping&&ia(a)==l.display.maxLine&&(i=!0),g.collapsed&&k!=b.line&&C(a,0),V(a,new S(g,k==b.line?b.ch:null,k==c.line?c.ch:null)),++k}),g.collapsed&&a.iter(b.line,c.line+1,function(b){ma(a,b)&&C(b,0)}),g.clearOnEnter&&Pg(g,"beforeCursorEnter",function(){return g.clear()}),g.readOnly&&(Q(),(a.history.done.length||a.history.undone.length)&&a.clearHistory()),g.collapsed&&(g.id=++hh,g.atomic=!0),l){if(i&&(l.curOp.updateMaxLine=!0),g.collapsed)od(l,b.line,c.line+1);else if(g.className||g.title||g.startStyle||g.endStyle||g.css)for(var m=b.line;m<=c.line;m++)pd(l,m,"text");g.atomic&&qe(l.doc),yb(l,"markerAdded",l,g)}return g}function Pe(a,b){var c=this;this.markers=a,this.primary=b;for(var d=0;d-1)return b.state.draggingText(a),void setTimeout(function(){return b.display.input.focus()},20);try{var j=a.dataTransfer.getData("Text");if(j){var k;if(b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections()),oe(b.doc,Jd(c,c)),k)for(var l=0;l=0;b--)De(a.doc,"",d[b].from,d[b].to,"+delete");ad(a)})}function hf(a,b){var c=z(a.doc,b),d=ia(c);d!=c&&(b=D(d));var e=Ba(d),f=e?e[0].level%2?va(d):ua(d):0;return H(b,f)}function jf(a,b){for(var c,d=z(a.doc,b);c=ga(d);)d=c.find(1,!0).line,b=null;var e=Ba(d),f=e?e[0].level%2?ua(d):va(d):d.text.length;return H(null==b?D(d):b,f)}function kf(a,b){var c=hf(a,b.line),d=z(a.doc,c.line),e=Ba(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return H(c.line,g?0:f)}return c}function lf(a,b,c){if("string"==typeof b&&(b=th[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Dg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function mf(a,b,c){for(var d=0;de-400&&0==I(sh.pos,c)?d="triple":rh&&rh.time>e-400&&0==I(rh.pos,c)?(d="double",sh={time:e,pos:c}):(d="single",rh={time:e,pos:c});var g,h=a.doc.sel,j=rg?b.metaKey:b.ctrlKey;a.options.dragDrop&&Qg&&!a.isReadOnly()&&"single"==d&&(g=h.contains(c))>-1&&(I((g=h.ranges[g]).from(),c)<0||c.xRel>0)&&(I(g.to(),c)>0||c.xRel<0)?wf(a,b,c,j):xf(a,b,c,d,j)}function wf(a,b,c,d){var e=a.display,f=+new Date,g=ld(a,function(h){ig&&(e.scroller.draggable=!1),a.state.draggingText=!1,Da(document,"mouseup",g),Da(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(Ja(h),!d&&+new Date-200u&&e.push(new Hd(H(q,u),H(q,n(s,j,f))))}e.length||e.push(new Hd(c,c)),ne(l,Id(p.ranges.slice(0,o).concat(e),o),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var v=m,w=v.anchor,x=b;if("single"!=d){var y;y="double"==d?a.findWordAt(b):new Hd(H(b.line,0),N(l,H(b.line+1,0))),I(y.anchor,w)>0?(x=y.head,w=L(v.from(),y.anchor)):(x=y.anchor,w=K(v.to(),y.head))}var A=p.ranges.slice(0);A[o]=new Hd(N(l,w),x),ne(l,Id(A,o),Fg)}}function h(b){var c=++v,e=wc(a,b,!0,"rect"==d);if(e)if(0!=I(e,t)){a.curOp.focus=f(),g(e);var i=Lc(j,l);(e.line>=i.to||e.lineu.bottom?20:0;k&&setTimeout(ld(a,function(){v==c&&(j.scroller.scrollTop+=k,h(b))}),50)}}function i(b){a.state.selectingText=!1,v=1/0,Ja(b),j.input.focus(),Da(document,"mousemove",w),Da(document,"mouseup",x),l.history.lastSelOrigin=null}var j=a.display,l=a.doc;Ja(b);var m,o,p=l.sel,q=p.ranges;if(e&&!b.shiftKey?(o=l.sel.contains(c),m=o>-1?q[o]:new Hd(c,c)):(m=l.sel.primary(),o=l.sel.primIndex),sg?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(m=new Hd(c,c)),c=wc(a,b,!0,!0),o=-1;else if("double"==d){var r=a.findWordAt(c);m=a.display.shift||l.extend?ge(l,m,r.anchor,r.head):r}else if("triple"==d){var s=new Hd(H(c.line,0),N(l,H(c.line+1,0)));m=a.display.shift||l.extend?ge(l,m,s.anchor,s.head):s}else m=ge(l,m,c);e?o==-1?(o=q.length,ne(l,Id(q.concat([m]),o),{scroll:!1,origin:"*mouse"})):q.length>1&&q[o].empty()&&"single"==d&&!b.shiftKey?(ne(l,Id(q.slice(0,o).concat(q.slice(o+1)),0),{scroll:!1,origin:"*mouse"}),p=l.sel):je(l,o,m,Fg):(o=0,ne(l,new Gd([m],0),Fg),p=l.sel);var t=c,u=j.wrapper.getBoundingClientRect(),v=0,w=ld(a,function(a){Oa(a)?h(a):i(a)}),x=ld(a,i);a.state.selectingText=x,Pg(document,"mousemove",w),Pg(document,"mouseup",x)}function yf(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(b){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Ja(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Ha(a,c))return La(b);f-=h.top-g.viewOffset;for(var i=0;i=e){var k=E(a.doc,f),l=a.options.gutters[i];return Ea(a,c,a,k,l,b),La(b)}}}function zf(a,b){return yf(a,b,"gutterClick",!0)}function Af(a,b){Nb(a.display,b)||Bf(a,b)||Fa(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function Bf(a,b){return!!Ha(a,"gutterContextMenu")&&yf(a,b,"gutterContextMenu",!1)}function Cf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),fc(a)}function Df(a){function b(b,d,e,f){a.defaults[b]=d,e&&(c[b]=f?function(a,b,c){c!=wh&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b,a.Init=wh,b("value","",function(a,b){return a.setValue(b)},!0),b("mode",null,function(a,b){a.doc.modeOption=b,Pd(a)},!0),b("indentUnit",2,Pd,!0),b("indentWithTabs",!1),b("smartIndent",!0),b("tabSize",4,function(a){Qd(a),fc(a),od(a)},!0),b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(f==-1)break;e=f+b.length,c.push(H(d,f))}d++});for(var e=c.length-1;e>=0;e--)De(a.doc,b,c[e],H(c[e].line,c[e].ch+b.length))}}),b("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g"),c!=wh&&a.refresh()}),b("specialCharPlaceholder",nb,function(a){return a.refresh()},!0),b("electricChars",!0),b("inputStyle",qg?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0),b("rtlMoveVisually",!tg),b("wholeLineUpdateBefore",!0),b("theme","default",function(a){Cf(a),Ef(a)},!0),b("keyMap","default",function(a,b,c){var d=ff(b),e=c!=wh&&ff(c);e&&e.detach&&e.detach(a,d),d.attach&&d.attach(a,e||null)}),b("extraKeys",null),b("lineWrapping",!1,Gf,!0),b("gutters",[],function(a){Fd(a.options),Ef(a)},!0),b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?tc(a.display)+"px":"0",a.refresh()},!0),b("coverGutterNextToScrollbar",!1,function(a){return Uc(a)},!0),b("scrollbarStyle","native",function(a){Wc(a),Uc(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),b("lineNumbers",!1,function(a){Fd(a.options),Ef(a)},!0),b("firstLineNumber",1,Ef,!0),b("lineNumberFormatter",function(a){ -return a},Ef,!0),b("showCursorWhenSelecting",!1,yc,!0),b("resetSelectionOnContextMenu",!0),b("lineWiseCopyCut",!0),b("readOnly",!1,function(a,b){"nocursor"==b?(Gc(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1,a.display.input.readOnlyChanged(b)}),b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),b("dragDrop",!0,Ff),b("allowDropFileTypes",null),b("cursorBlinkRate",530),b("cursorScrollMargin",0),b("cursorHeight",1,yc,!0),b("singleCursorHeightPerLine",!0,yc,!0),b("workTime",100),b("workDelay",100),b("flattenSpans",!0,Qd,!0),b("addModeClass",!1,Qd,!0),b("pollInterval",100),b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b}),b("historyEventDelay",1250),b("viewportMargin",10,function(a){return a.refresh()},!0),b("maxHighlightLength",1e4,Qd,!0),b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""}),b("autofocus",null)}function Ef(a){Ed(a),od(a),setTimeout(function(){return Hc(a)},20)}function Ff(a,b,c){var d=c&&c!=wh;if(!b!=!d){var e=a.display.dragFunctions,f=b?Pg:Da;f(a.display.scroller,"dragstart",e.start),f(a.display.scroller,"dragenter",e.enter),f(a.display.scroller,"dragover",e.over),f(a.display.scroller,"dragleave",e.leave),f(a.display.scroller,"drop",e.drop)}}function Gf(a){a.options.lineWrapping?(g(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(yg(a.display.wrapper,"CodeMirror-wrap"),qa(a)),vc(a),od(a),fc(a),setTimeout(function(){return Uc(a)},100)}function Hf(a,b){var c=this;if(!(this instanceof Hf))return new Hf(a,b);this.options=b=b?j(b):{},j(xh,b,!1),Fd(b);var d=b.value;"string"==typeof d&&(d=new jh(d,b.mode,null,b.lineSeparator)),this.doc=d;var e=new Hf.inputStyles[b.inputStyle](this),f=this.display=new y(a,d,e);f.wrapper.CodeMirror=this,Ed(this),Cf(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),b.autofocus&&!qg&&f.input.focus(),Wc(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 l,keySeq:null,specialChars:null},gg&&hg<11&&setTimeout(function(){return c.display.input.reset(!0)},20),If(this),Ze(),cd(this),this.curOp.forceUpdate=!0,Ud(this,d),b.autofocus&&!qg||this.hasFocus()?setTimeout(i(Fc,this),20):Gc(this);for(var g in yh)yh.hasOwnProperty(g)&&yh[g](c,b[g],wh);Ic(this),b.finishInit&&b.finishInit(this);for(var h=0;h400}var e=a.display;Pg(e.scroller,"mousedown",ld(a,uf)),gg&&hg<11?Pg(e.scroller,"dblclick",ld(a,function(b){if(!Fa(a,b)){var c=wc(a,b);if(c&&!zf(a,b)&&!Nb(a.display,b)){Ja(b);var d=a.findWordAt(c);he(a.doc,d.anchor,d.head)}}})):Pg(e.scroller,"dblclick",function(b){return Fa(a,b)||Ja(b)}),xg||Pg(e.scroller,"contextmenu",function(b){return Af(a,b)});var f,g={end:0};Pg(e.scroller,"touchstart",function(b){if(!Fa(a,b)&&!c(b)){e.input.ensurePolled(),clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}}),Pg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),Pg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Nb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new Hd(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new Hd(H(h.line,0),N(a.doc,H(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Ja(c)}b()}),Pg(e.scroller,"touchcancel",b),Pg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(Mc(a,e.scroller.scrollTop),Nc(a,e.scroller.scrollLeft,!0),Ea(a,"scroll",a))}),Pg(e.scroller,"mousewheel",function(b){return Qc(a,b)}),Pg(e.scroller,"DOMMouseScroll",function(b){return Qc(a,b)}),Pg(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(b){Fa(a,b)||Ma(b)},over:function(b){Fa(a,b)||(We(a,b),Ma(b))},start:function(b){return Ve(a,b)},drop:ld(a,Ue),leave:function(b){Fa(a,b)||Xe(a)}};var h=e.input.getField();Pg(h,"keyup",function(b){return sf.call(a,b)}),Pg(h,"keydown",ld(a,qf)),Pg(h,"keypress",ld(a,tf)),Pg(h,"focus",function(b){return Fc(a,b)}),Pg(h,"blur",function(b){return Gc(a,b)})}function Jf(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=ab(a,b):c="prev");var g=a.options.tabSize,h=z(f,b),i=k(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,l=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(l.length),h.text),j==Dg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?k(z(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var m="",n=0;if(a.options.indentWithTabs)for(var p=Math.floor(j/g);p;--p)n+=g,m+="\t";if(n1)if(Ah&&Ah.text.join("\n")==b){if(d.ranges.length%Ah.text.length==0){i=[];for(var j=0;j=0;l--){var m=d.ranges[l],n=m.from(),o=m.to();m.empty()&&(c&&c>0?n=H(n.line,n.ch-c):a.state.overwrite&&!g?o=H(o.line,Math.min(z(f,o.line).text.length,o.ch+p(h).length)):Ah&&Ah.lineWise&&Ah.text.join("\n")==b&&(n=o=H(n.line,0))),k=a.curOp.updateInput;var r={from:n,to:o,text:i?i[l%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};xe(a.doc,r),yb(a,"inputRead",a,r)}b&&!g&&Nf(a,b),ad(a),a.curOp.updateInput=k,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function Mf(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||kd(b,function(){return Lf(b,c,0,null,"paste")}),!0}function Nf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h-1){g=Jf(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(z(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Jf(a,e.head.line,"smart"));g&&yb(a,"electricInput",a,e.head.line)}}}function Of(a){for(var b=[],c=[],d=0;dd&&(Jf(b,f.head.line,a,!0),d=f.head.line,e==b.doc.sel.primIndex&&ad(b));else{var g=f.from(),h=f.to(),i=Math.max(d,g.line);d=Math.min(b.lastLine(),h.line-(h.ch?0:1))+1;for(var j=i;j0&&je(b.doc,e,new Hd(g,k[e].to()),Eg)}}}),getTokenAt:function(a,b){return eb(this,a,b)},getLineTokens:function(a,b){return eb(this,H(a),b,!0)},getTokenTypeAt:function(a){a=N(this.doc,a);var b,c=_a(this,z(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]f&&(a=f,e=!0),d=z(this.doc,a)}else d=a;return ic(this,d,{top:0,left:0},b||"page",c).top+(e?this.doc.height-oa(d):0)},defaultTextHeight:function(){return qc(this.display)},defaultCharWidth:function(){return rc(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=lc(this,N(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Zc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:md(qf),triggerOnKeyPress:md(tf),triggerOnKeyUp:sf,execCommand:function(a){if(th.hasOwnProperty(a))return th[a].call(null,this)},triggerElectric:md(function(a){Nf(this,a)}),findPosH:function(a,b,c,d){var e=this,f=1;b<0&&(f=-1,b=-b);for(var g=N(this.doc,a),h=0;h0&&h(c.charAt(d-1));)--d;for(;e.5)&&vc(this),Ea(this,"refresh",this)}),swapDoc:md(function(a){var b=this.doc;return b.cm=null,Ud(this,a),fc(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,yb(this,"swapDoc",this,b),b}),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}},Ia(a),a.registerHelper=function(b,d,e){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]}),c[b][d]=e},a.registerGlobalHelper=function(b,d,e,f){a.registerHelper(b,d,f),c[b]._global.push({pred:e,val:f})}}function Sf(a,b,c,d,e){function f(){var b=h+c;return!(b=a.first+a.size)&&(h=b,k=z(a,b))}function g(a){var b=(e?za:Aa)(k,i,c,!0);if(null==b){if(a||!f())return!1;i=e?(c<0?va:ua)(k):c<0?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=z(a,h);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var l=null,m="group"==d,n=a.cm&&a.cm.getHelper(b,"wordChars"),o=!0;!(c<0)||g(!o);o=!1){var p=k.text.charAt(i)||"\n",q=v(p,n)?"w":m&&"\n"==p?"n":!m||/\s/.test(p)?null:"p";if(!m||o||q||(q="s"),l&&l!=q){c<0&&(c=1,g());break}if(q&&(l=q),c>0&&!g(!o))break}var r=te(a,H(h,i),b,j,!0);return I(b,r)||(r.hitSide=!0),r}function Tf(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(h-.5*qc(a.display),3);e=(c>0?b.bottom:b.top)+c*i}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(var j;j=oc(a,g,e),j.outside;){if(c<0?e<=0:e>=f.height){j.hitSide=!0;break}e+=5*c}return j}function Uf(a){this.cm=a,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new l,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Vf(a,b){var c=Yb(a,b.line);if(!c||c.hidden)return null;var d=z(a.doc,b.line),e=Vb(c,d,b.line),f=Ba(d),g="left";if(f){var h=xa(f,b.ch);g=h%2?"right":"left"}var i=_b(e.map,b.ch,g);return i.offset="right"==i.collapse?i.end:i.start,i}function Wf(a,b){return b&&(a.bad=!0),a}function Xf(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return void(h+=""==c?b.textContent.replace(/\u200b/g,""):c);var k,l=b.getAttribute("cm-marker");if(l){var m=a.findMarks(H(d,0),H(e+1,0),f(+l));return void(m.length&&(k=m[0].find())&&(h+=A(a.doc,k.from,k.to).join(j)))}if("false"==b.getAttribute("contenteditable"))return;for(var n=0;n=15&&(lg=!1,ig=!0);var vg,wg=rg&&(jg||lg&&(null==ug||ug<12.11)),xg=dg||gg&&hg>=9,yg=function(b,c){var d=b.className,e=a(c).exec(d);if(e){var f=d.slice(e.index+e[0].length);b.className=d.slice(0,e.index)+(f?e[1]+f:"")}};vg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var zg=function(a){a.select()};pg?zg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:gg&&(zg=function(a){try{a.select()}catch(b){}}),l.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var Ag,Bg,Cg=30,Dg={toString:function(){return"CodeMirror.Pass"}},Eg={scroll:!1},Fg={origin:"*mouse"},Gg={origin:"+move"},Hg=[""],Ig=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Jg=/[\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]/,Kg=!1,Lg=!1,Mg=null,Ng=function(){function a(a){return a<=247?c.charAt(a):1424<=a&&a<=1524?"R":1536<=a&&a<=1773?d.charAt(a-1536):1774<=a&&a<=2220?"r":8192<=a&&a<=8203?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d=c.length,k=[],l=0;l=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.posb},eatSpace:function(){for(var a=this,b=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++a.pos;return this.pos>b},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);if(e(f)==e(a))return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}},Ia(ib),ib.prototype.lineNo=function(){return D(this)};var Zg,$g={},_g={},ah=null,bh=null,ch={left:0,right:0,top:0,bottom:0},dh=0,eh=null;gg?eh=-.53:dg?eh=15:kg?eh=-.7:mg&&(eh=-1/3),Sc.prototype=j({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+f+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&a.clientHeight>0&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var a=rg&&!ng?"12px":"18px";this.horiz.style.height=this.vert.style.width=a,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new l,this.disableVert=new l},enableZeroWidthBar:function(a,b){function c(){var d=a.getBoundingClientRect(),e=document.elementFromPoint(d.left+1,d.bottom-1);e!=a?a.style.pointerEvents="none":b.set(1e3,c); -}a.style.pointerEvents="auto",b.set(1e3,c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},Sc.prototype),Tc.prototype=j({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},Tc.prototype);var fh={"native":Sc,"null":Tc},gh=0;wd.prototype.signal=function(a,b){Ha(a,b)&&this.events.push(arguments)},wd.prototype.finish=function(){for(var a=this,b=0;b=0&&I(a,e.to())<=0)return d}return-1}},Hd.prototype={from:function(){return L(this.anchor,this.head)},to:function(){return K(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}},Ie.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=this,d=a,e=a+b;d1||!(this.children[0]instanceof Ie))){var i=[];this.collapse(i),this.children=[new Ie(i)],this.children[0].parent=this}},collapse:function(a){for(var b=this,c=0;c50){for(var h=f.lines.length%25+25,i=h;i10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=this,e=0;eb.display.maxLineLength&&(b.display.maxLine=k,b.display.maxLineLength=l,b.display.maxLineChanged=!0)}null!=e&&b&&this.collapsed&&od(b,e,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,b&&qe(b.doc)),b&&yb(b,"markerCleared",b,this),c&&dd(b),this.parent&&this.parent.clear()}},Ne.prototype.find=function(a,b){var c=this;null==a&&"bookmark"==this.type&&(a=1);for(var d,e,f=0;f=0;j--)xe(d,e[j]);i?me(this,i):this.cm&&ad(this.cm)}),undo:nd(function(){ze(this,"undo")}),redo:nd(function(){ze(this,"redo")}),undoSelection:nd(function(){ze(this,"undo",!0)}),redoSelection:nd(function(){ze(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=N(this,a),b=N(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h=i.to||null==i.from&&e!=a.line||null!=i.from&&e==b.line&&i.from>=b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;da?(b=a,!0):(a-=f,void++c)}),N(this,H(c,b))},indexFromPos:function(a){a=N(this,a);var b=a.ch;if(a.lineb&&(b=a.from),null!=a.to&&a.to0)e=new H(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),H(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=z(a.doc,e.line-1).text;g&&(e=new H(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),H(e.line-1,g.length-1),e,"+transpose"))}c.push(new Hd(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return kd(a,function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(var d=0;da.firstLine()&&(d=H(d.line-1,z(a.doc,d.line-1).length)),e.ch==z(a.doc,e.line).text.length&&e.lineb.viewTo-1)return!1;var f,g,h;d.line==b.viewFrom||0==(f=xc(a,d.line))?(g=D(b.view[0].line),h=b.view[0].node):(g=D(b.view[f].line),h=b.view[f-1].node.nextSibling);var i,j,k=xc(a,e.line);if(k==b.view.length-1?(i=b.viewTo-1,j=b.lineDiv.lastChild):(i=D(b.view[k+1].line)-1,j=b.view[k+1].node.previousSibling),!h)return!1;for(var l=a.doc.splitLines(Xf(a,h,j,g,i)),m=A(a.doc,H(g,0),H(i,z(a.doc,i).text.length));l.length>1&&m.length>1;)if(p(l)==p(m))l.pop(),m.pop(),i--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,q=l[0],r=m[0],s=Math.min(q.length,r.length);n1||l[0]||I(w,x)?(De(a.doc,l,w,x,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&(this.composing=null,this.pollContent()||od(this.cm),this.div.blur(),this.div.focus())},readFromDOMSoon:function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null,a.composing||!a.cm.isReadOnly()&&a.pollContent()||kd(a.cm,function(){return od(a.cm)})},80))},setUneditable:function(a){a.contentEditable="false"},onKeyPress:function(a){a.preventDefault(),this.cm.isReadOnly()||ld(this.cm,Lf)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},readOnlyChanged:function(a){this.div.contentEditable=String("nocursor"!=a)},onContextMenu:s,resetPosition:s,needsContentAttribute:!0},Uf.prototype),$f.prototype=j({init:function(a){function b(a){if(!Fa(e,a)){if(e.somethingSelected())Kf({lineWise:!1,text:e.getSelections()}),d.inaccurateSelection&&(d.prevInput="",d.inaccurateSelection=!1,g.value=Ah.text.join("\n"),zg(g));else{if(!e.options.lineWiseCopyCut)return;var b=Of(e);Kf({lineWise:!0,text:b.text}),"cut"==a.type?e.setSelections(b.ranges,null,Eg):(d.prevInput="",g.value=b.text.join("\n"),zg(g))}"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Qf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild),pg&&(g.style.width="0px"),Pg(g,"input",function(){gg&&hg>=9&&c.hasSelection&&(c.hasSelection=null),d.poll()}),Pg(g,"paste",function(a){Fa(e,a)||Mf(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())}),Pg(g,"cut",b),Pg(g,"copy",b),Pg(a.scroller,"paste",function(b){Nb(a,b)||Fa(e,b)||(e.state.pasteIncoming=!0,d.focus())}),Pg(a.lineSpace,"selectstart",function(b){Nb(a,b)||Ja(b)}),Pg(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear(),d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}}),Pg(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=zc(a);if(a.options.moveInputWithCursor){var e=lc(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,d=b.display;c(d.cursorDiv,a.cursors),c(d.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var f=e.sel.primary();b=Tg&&(f.to().line-f.from().line>100||(c=d.getSelection()).length>1e3);var g=b?"-":c||d.getSelection();this.textarea.value=g,d.state.focused&&zg(this.textarea),gg&&hg>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",gg&&hg>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!qg||f()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},fastPoll:function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},poll:function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||Sg(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value; -if(e==d&&!b.somethingSelected())return!1;if(gg&&hg>=9&&this.hasSelection===e||rg&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);if(8203!=f||d||(d="​"),8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,h=Math.min(d.length,e.length);g1e3||e.indexOf("\n")>-1?c.value=a.prevInput="":a.prevInput=e,a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){gg&&hg>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="​"+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"​",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=l,g.style.cssText=k,gg&&hg<9&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!gg||gg&&hg<9)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&"​"==d.prevInput?ld(e,ve)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=wc(e,a),i=f.scroller.scrollTop;if(h&&!lg){var j=e.options.resetSelectionOnContextMenu;j&&e.doc.sel.contains(h)==-1&&ld(e,ne)(e.doc,Jd(h),Eg);var k=g.style.cssText,l=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";var m=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-m.top-5)+"px; left: "+(a.clientX-m.left-5)+"px;\n z-index: 1000; background: "+(gg?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var n;if(ig&&(n=window.scrollY),f.input.focus(),ig&&window.scrollTo(null,n),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),gg&&hg>=9&&b(),xg){Ma(a);var o=function(){Da(window,"mouseup",o),setTimeout(c,20)};Pg(window,"mouseup",o)}else setTimeout(c,50)}},readOnlyChanged:function(a){a||this.reset()},setUneditable:s,needsContentAttribute:!1},$f.prototype),Df(Hf),Rf(Hf);var Bh="iter insert remove copy getEditor constructor".split(" ");for(var Ch in jh.prototype)jh.prototype.hasOwnProperty(Ch)&&m(Bh,Ch)<0&&(Hf.prototype[Ch]=function(a){return function(){return a.apply(this.doc,arguments)}}(jh.prototype[Ch]));return Ia(jh),Hf.inputStyles={textarea:$f,contenteditable:Uf},Hf.defineMode=function(a){Hf.defaults.mode||"null"==a||(Hf.defaults.mode=a),Sa.apply(this,arguments)},Hf.defineMIME=Ta,Hf.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}}),Hf.defineMIME("text/plain","null"),Hf.defineExtension=function(a,b){Hf.prototype[a]=b},Hf.defineDocExtension=function(a,b){jh.prototype[a]=b},Hf.fromTextArea=_f,ag(Hf),Hf.version="5.21.0",Hf}),function(a){"object"==typeof exports&&"object"==typeof module?a(b("../../lib/codemirror")):"function"==typeof c&&c.amd?c("codemirror/mode/xml/xml",["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";var b={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},c={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};a.defineMode("xml",function(d,e){function f(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if("<"==d)return a.eat("!")?a.eat("[")?a.match("CDATA[")?c(i("atom","]]>")):null:a.match("--")?c(i("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(j(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=i("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",b.tokenize=g,"tag bracket");if("&"==d){var e;return e=a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),e?"atom":"error"}return a.eatWhile(/[^&<]/),null}function g(a,b){var c=a.next();if(">"==c||"/"==c&&a.eat(">"))return b.tokenize=f,A=">"==c?"endTag":"selfcloseTag","tag bracket";if("="==c)return A="equals",null;if("<"==c){b.tokenize=f,b.state=n,b.tagName=b.tagStart=null;var d=b.tokenize(a,b);return d?d+" tag error":"tag error"}return/[\'\"]/.test(c)?(b.tokenize=h(c),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(a){var b=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=g;break}return"string"};return b.isInAttribute=!0,b}function i(a,b){return function(c,d){for(;!c.eol();){if(c.match(b)){d.tokenize=f;break}c.next()}return a}}function j(a){return function(b,c){for(var d;null!=(d=b.next());){if("<"==d)return c.tokenize=j(a+1),c.tokenize(b,c);if(">"==d){if(1==a){c.tokenize=f;break}return c.tokenize=j(a-1),c.tokenize(b,c)}}return"meta"}}function k(a,b,c){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=c,(x.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function l(a){a.context&&(a.context=a.context.prev)}function m(a,b){for(var c;;){if(!a.context)return;if(c=a.context.tagName,!x.contextGrabbers.hasOwnProperty(c)||!x.contextGrabbers[c].hasOwnProperty(b))return;l(a)}}function n(a,b,c){return"openTag"==a?(c.tagStart=b.column(),o):"closeTag"==a?p:n}function o(a,b,c){return"word"==a?(c.tagName=b.current(),B="tag",s):(B="error",o)}function p(a,b,c){if("word"==a){var d=b.current();return c.context&&c.context.tagName!=d&&x.implicitlyClosed.hasOwnProperty(c.context.tagName)&&l(c),c.context&&c.context.tagName==d||x.matchClosing===!1?(B="tag",q):(B="tag error",r)}return B="error",r}function q(a,b,c){return"endTag"!=a?(B="error",q):(l(c),n)}function r(a,b,c){return B="error",q(a,b,c)}function s(a,b,c){if("word"==a)return B="attribute",t;if("endTag"==a||"selfcloseTag"==a){var d=c.tagName,e=c.tagStart;return c.tagName=c.tagStart=null,"selfcloseTag"==a||x.autoSelfClosers.hasOwnProperty(d)?m(c,d):(m(c,d),c.context=new k(c,d,e==c.indented)),n}return B="error",s}function t(a,b,c){return"equals"==a?u:(x.allowMissing||(B="error"),s(a,b,c))}function u(a,b,c){return"string"==a?v:"word"==a&&x.allowUnquoted?(B="string",s):(B="error",s(a,b,c))}function v(a,b,c){return"string"==a?v:s(a,b,c)}var w=d.indentUnit,x={},y=e.htmlMode?b:c;for(var z in y)x[z]=y[z];for(var z in e)x[z]=e[z];var A,B;return f.isInText=!0,{startState:function(a){var b={tokenize:f,state:n,indented:a||0,tagName:null,tagStart:null,context:null};return null!=a&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;A=null;var c=b.tokenize(a,b);return(c||A)&&"comment"!=c&&(B=null,b.state=b.state(A||c,a,b),B&&(c="error"==B?c+" error":B)),c},indent:function(b,c,d){var e=b.context;if(b.tokenize.isInAttribute)return b.tagStart==b.indented?b.stringStartCol+1:b.indented+w;if(e&&e.noIndent)return a.Pass;if(b.tokenize!=g&&b.tokenize!=f)return d?d.match(/^(\s*)/)[0].length:0;if(b.tagName)return x.multilineTagIndentPastTag!==!1?b.tagStart+b.tagName.length+2:b.tagStart+w*(x.multilineTagIndentFactor||1);if(x.alignCDATA&&/$/,blockCommentStart:"",configuration:x.htmlMode?"html":"xml",helperType:x.htmlMode?"html":"xml",skipAttribute:function(a){a.state==u&&(a.state=s)}}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(a){"object"==typeof exports&&"object"==typeof module?a(b("../../lib/codemirror")):"function"==typeof c&&c.amd?c("codemirror/mode/javascript/javascript",["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b,c){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(b.lastType)||"quasi"==b.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(c||0)))}a.defineMode("javascript",function(c,d){function e(a){for(var b,c=!1,d=!1;null!=(b=a.next());){if(!c){if("/"==b&&!d)return;"["==b?d=!0:d&&"]"==b&&(d=!1)}c=!c&&"\\"==b}}function f(a,b,c){return xa=a,ya=c,b}function g(a,c){var d=a.next();if('"'==d||"'"==d)return c.tokenize=h(d),c.tokenize(a,c);if("."==d&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return f("number","number");if("."==d&&a.match(".."))return f("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(d))return f(d);if("="==d&&a.eat(">"))return f("=>","operator");if("0"==d&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),f("number","number");if("0"==d&&a.eat(/o/i))return a.eatWhile(/[0-7]/i),f("number","number");if("0"==d&&a.eat(/b/i))return a.eatWhile(/[01]/i),f("number","number");if(/\d/.test(d))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),f("number","number");if("/"==d)return a.eat("*")?(c.tokenize=i,i(a,c)):a.eat("/")?(a.skipToEnd(),f("comment","comment")):b(a,c,1)?(e(a),a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),f("regexp","string-2")):(a.eatWhile(Ga),f("operator","operator",a.current()));if("`"==d)return c.tokenize=j,j(a,c);if("#"==d)return a.skipToEnd(),f("error","error");if(Ga.test(d))return a.eatWhile(Ga),f("operator","operator",a.current());if(Ea.test(d)){a.eatWhile(Ea);var g=a.current(),k=Fa.propertyIsEnumerable(g)&&Fa[g];return k&&"."!=c.lastType?f(k.type,k.style,g):f("variable","variable",g)}}function h(a){return function(b,c){var d,e=!1;if(Ba&&"@"==b.peek()&&b.match(Ha))return c.tokenize=g,f("jsonld-keyword","meta");for(;null!=(d=b.next())&&(d!=a||e);)e=!e&&"\\"==d;return e||(c.tokenize=g),f("string","string")}}function i(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=g;break}d="*"==c}return f("comment","comment")}function j(a,b){for(var c,d=!1;null!=(c=a.next());){if(!d&&("`"==c||"$"==c&&a.eat("{"))){b.tokenize=g;break}d=!d&&"\\"==c}return f("quasi","string-2",a.current())}function k(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(c<0)){if(Da){var d=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,c));d&&(c=d.index)}for(var e=0,f=!1,g=c-1;g>=0;--g){var h=a.string.charAt(g),i=Ia.indexOf(h);if(i>=0&&i<3){if(!e){++g;break}if(0==--e){"("==h&&(f=!0);break}}else if(i>=3&&i<6)++e;else if(Ea.test(h))f=!0;else{if(/["'\/]/.test(h))return;if(f&&!e){++g;break}}}f&&!e&&(b.fatArrowAt=g)}}function l(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function m(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function n(a,b,c,d,e){var f=a.cc;for(Ka.state=a,Ka.stream=e,Ka.marked=null,Ka.cc=f,Ka.style=b,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var g=f.length?f.pop():Ca?x:w;if(g(c,d)){for(;f.length&&f[f.length-1].lex;)f.pop()();return Ka.marked?Ka.marked:"variable"==c&&m(a,d)?"variable-2":b}}}function o(){for(var a=arguments.length-1;a>=0;a--)Ka.cc.push(arguments[a])}function p(){return o.apply(null,arguments),!0}function q(a){function b(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var c=Ka.state;if(Ka.marked="def",c.context){if(b(c.localVars))return;c.localVars={name:a,next:c.localVars}}else{if(b(c.globalVars))return;d.globalVars&&(c.globalVars={name:a,next:c.globalVars})}}function r(){Ka.state.context={prev:Ka.state.context,vars:Ka.state.localVars},Ka.state.localVars=La}function s(){Ka.state.localVars=Ka.state.context.vars,Ka.state.context=Ka.state.context.prev}function t(a,b){var c=function(){var c=Ka.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new l(d,Ka.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function u(){var a=Ka.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function v(a){function b(c){return c==a?p():";"==a?o():p(b)}return b}function w(a,b){return"var"==a?p(t("vardef",b.length),$,v(";"),u):"keyword a"==a?p(t("form"),z,w,u):"keyword b"==a?p(t("form"),w,u):"{"==a?p(t("}"),T,u):";"==a?p():"if"==a?("else"==Ka.state.lexical.info&&Ka.state.cc[Ka.state.cc.length-1]==u&&Ka.state.cc.pop()(),p(t("form"),z,w,u,da)):"function"==a?p(ja):"for"==a?p(t("form"),ea,w,u):"variable"==a?p(t("stat"),M):"switch"==a?p(t("form"),z,t("}","switch"),v("{"),T,u,u):"case"==a?p(x,v(":")):"default"==a?p(v(":")):"catch"==a?p(t("form"),r,v("("),ka,v(")"),w,u,s):"class"==a?p(t("form"),ma,u):"export"==a?p(t("stat"),qa,u):"import"==a?p(t("stat"),ra,u):"module"==a?p(t("form"),_,t("}"),v("{"),T,u,u):"type"==a?p(V,v("operator"),V,v(";")):"async"==a?p(w):o(t("stat"),x,v(";"),u)}function x(a){return A(a,!1)}function y(a){return A(a,!0)}function z(a){return"("!=a?o():p(t(")"),x,v(")"),u)}function A(a,b){if(Ka.state.fatArrowAt==Ka.stream.start){var c=b?I:H;if("("==a)return p(r,t(")"),R(_,")"),u,v("=>"),c,s);if("variable"==a)return o(r,_,v("=>"),c,s)}var d=b?E:D;return Ja.hasOwnProperty(a)?p(d):"function"==a?p(ja,d):"class"==a?p(t("form"),la,u):"keyword c"==a||"async"==a?p(b?C:B):"("==a?p(t(")"),B,v(")"),u,d):"operator"==a||"spread"==a?p(b?y:x):"["==a?p(t("]"),va,u,d):"{"==a?S(O,"}",null,d):"quasi"==a?o(F,d):"new"==a?p(J(b)):p()}function B(a){return a.match(/[;\}\)\],]/)?o():o(x)}function C(a){return a.match(/[;\}\)\],]/)?o():o(y)}function D(a,b){return","==a?p(x):E(a,b,!1)}function E(a,b,c){var d=0==c?D:E,e=0==c?x:y;return"=>"==a?p(r,c?I:H,s):"operator"==a?/\+\+|--/.test(b)?p(d):"?"==b?p(x,v(":"),e):p(e):"quasi"==a?o(F,d):";"!=a?"("==a?S(y,")","call",d):"."==a?p(N,d):"["==a?p(t("]"),B,v("]"),u,d):void 0:void 0}function F(a,b){return"quasi"!=a?o():"${"!=b.slice(b.length-2)?p(F):p(x,G)}function G(a){if("}"==a)return Ka.marked="string-2",Ka.state.tokenize=j,p(F)}function H(a){return k(Ka.stream,Ka.state),o("{"==a?w:x)}function I(a){return k(Ka.stream,Ka.state),o("{"==a?w:y)}function J(a){return function(b){return"."==b?p(a?L:K):o(a?y:x)}}function K(a,b){if("target"==b)return Ka.marked="keyword",p(D)}function L(a,b){if("target"==b)return Ka.marked="keyword",p(E)}function M(a){return":"==a?p(u,w):o(D,v(";"),u)}function N(a){if("variable"==a)return Ka.marked="property",p()}function O(a,b){return"async"==a?(Ka.marked="property",p(O)):"variable"==a||"keyword"==Ka.style?(Ka.marked="property",p("get"==b||"set"==b?P:Q)):"number"==a||"string"==a?(Ka.marked=Ba?"property":Ka.style+" property",p(Q)):"jsonld-keyword"==a?p(Q):"modifier"==a?p(O):"["==a?p(x,v("]"),Q):"spread"==a?p(x):":"==a?o(Q):void 0}function P(a){return"variable"!=a?o(Q):(Ka.marked="property",p(ja))}function Q(a){return":"==a?p(y):"("==a?o(ja):void 0}function R(a,b){function c(d,e){if(","==d){var f=Ka.state.lexical;return"call"==f.info&&(f.pos=(f.pos||0)+1),p(function(c,d){return c==b||d==b?o():o(a)},c)}return d==b||e==b?p():p(v(b))}return function(d,e){return d==b||e==b?p():o(a,c)}}function S(a,b,c){for(var d=3;d"==a)return p(V)}function X(a){return"variable"==a||"keyword"==Ka.style?(Ka.marked="property",p(X)):":"==a?p(V):void 0}function Y(a){return"variable"==a?p(Y):":"==a?p(V):void 0}function Z(a,b){return"<"==b?p(R(V,">"),Z):"["==a?p(v("]"),Z):void 0}function $(){return o(_,U,ba,ca)}function _(a,b){return"modifier"==a?p(_):"variable"==a?(q(b),p()):"spread"==a?p(_):"["==a?S(_,"]"):"{"==a?S(aa,"}"):void 0}function aa(a,b){return"variable"!=a||Ka.stream.match(/^\s*:/,!1)?("variable"==a&&(Ka.marked="property"),"spread"==a?p(_):"}"==a?o():p(v(":"),_,ba)):(q(b),p(ba))}function ba(a,b){if("="==b)return p(y)}function ca(a){if(","==a)return p($)}function da(a,b){if("keyword b"==a&&"else"==b)return p(t("form","else"),w,u)}function ea(a){if("("==a)return p(t(")"),fa,v(")"),u)}function fa(a){return"var"==a?p($,v(";"),ha):";"==a?p(ha):"variable"==a?p(ga):o(x,v(";"),ha)}function ga(a,b){return"in"==b||"of"==b?(Ka.marked="keyword",p(x)):p(D,ha)}function ha(a,b){return";"==a?p(ia):"in"==b||"of"==b?(Ka.marked="keyword",p(x)):o(x,v(";"),ia)}function ia(a){")"!=a&&p(x)}function ja(a,b){return"*"==b?(Ka.marked="keyword",p(ja)):"variable"==a?(q(b),p(ja)):"("==a?p(r,t(")"),R(ka,")"),u,U,w,s):void 0}function ka(a){return"spread"==a?p(ka):o(_,U,ba)}function la(a,b){return"variable"==a?ma(a,b):na(a,b)}function ma(a,b){if("variable"==a)return q(b),p(na)}function na(a,b){return"extends"==b||"implements"==b?p(Da?V:x,na):"{"==a?p(t("}"),oa,u):void 0}function oa(a,b){return"variable"==a||"keyword"==Ka.style?("static"==b||"get"==b||"set"==b||Da&&("public"==b||"private"==b||"protected"==b||"readonly"==b||"abstract"==b))&&Ka.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(Ka.marked="keyword",p(oa)):(Ka.marked="property",p(Da?pa:ja,oa)):"*"==b?(Ka.marked="keyword",p(oa)):";"==a?p(oa):"}"==a?p():void 0}function pa(a,b){return"?"==b?p(pa):":"==a?p(V,ba):o(ja)}function qa(a,b){return"*"==b?(Ka.marked="keyword",p(ua,v(";"))):"default"==b?(Ka.marked="keyword",p(x,v(";"))):o(w)}function ra(a){return"string"==a?p():o(sa,ua)}function sa(a,b){return"{"==a?S(sa,"}"):("variable"==a&&q(b),"*"==b&&(Ka.marked="keyword"),p(ta))}function ta(a,b){if("as"==b)return Ka.marked="keyword",p(sa)}function ua(a,b){if("from"==b)return Ka.marked="keyword",p(x)}function va(a){return"]"==a?p():o(R(y,"]"))}function wa(a,b){return"operator"==a.lastType||","==a.lastType||Ga.test(b.charAt(0))||/[,.]/.test(b.charAt(0))}var xa,ya,za=c.indentUnit,Aa=d.statementIndent,Ba=d.jsonld,Ca=d.json||Ba,Da=d.typescript,Ea=d.wordCharacters||/[\w$\xa1-\uffff]/,Fa=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"},g={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":a("new"),"delete":d,"throw":d,"debugger":d,"var":a("var"),"const":a("var"),"let":a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,undefined:f,NaN:f,Infinity:f,"this":a("this"),"class":a("class"),"super":a("atom"),"yield":d,"export":a("export"),"import":a("import"),"extends":d,await:d,async:a("async")};if(Da){var h={type:"variable",style:"variable-3"},i={"interface":a("class"),"implements":d,namespace:d,module:a("module"),"enum":a("module"),type:a("type"),"public":a("modifier"),"private":a("modifier"),"protected":a("modifier"),"abstract":a("modifier"),as:e,string:h,number:h,"boolean":h,any:h};for(var j in i)g[j]=i[j]}return g}(),Ga=/[+\-*&%=<>!?|~^]/,Ha=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ia="([{}])",Ja={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Ka={state:null,column:null,marked:null,cc:null},La={name:"this",next:{name:"arguments"}};return u.lex=!0,{startState:function(a){var b={tokenize:g,lastType:"sof",cc:[],lexical:new l((a||0)-za,0,"block",(!1)),localVars:d.localVars,context:d.localVars&&{vars:d.localVars},indented:a||0};return d.globalVars&&"object"==typeof d.globalVars&&(b.globalVars=d.globalVars),b},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),k(a,b)),b.tokenize!=i&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==xa?c:(b.lastType="operator"!=xa||"++"!=ya&&"--"!=ya?xa:"incdec",n(b,c,xa,ya,a))},indent:function(b,c){if(b.tokenize==i)return a.Pass;if(b.tokenize!=g)return 0;var e,f=c&&c.charAt(0),h=b.lexical;if(!/^\s*else\b/.test(c))for(var j=b.cc.length-1;j>=0;--j){var k=b.cc[j];if(k==u)h=h.prev;else if(k!=da)break}for(;("stat"==h.type||"form"==h.type)&&("}"==f||(e=b.cc[b.cc.length-1])&&(e==D||e==E)&&!/^[,\.=+\-*:?[\(]/.test(c));)h=h.prev;Aa&&")"==h.type&&"stat"==h.prev.type&&(h=h.prev);var l=h.type,m=f==l;return"vardef"==l?h.indented+("operator"==b.lastType||","==b.lastType?h.info+1:0):"form"==l&&"{"==f?h.indented:"form"==l?h.indented+za:"stat"==l?h.indented+(wa(b,c)?Aa||za:0):"switch"!=h.info||m||0==d.doubleIndentSwitch?h.align?h.column+(m?0:1):h.indented+(m?0:za):h.indented+(/^(?:case|default)\b/.test(c)?za:2*za)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ca?null:"/*",blockCommentEnd:Ca?null:"*/",lineComment:Ca?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ca?"json":"javascript",jsonldMode:Ba,jsonMode:Ca,expressionAllowed:b,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=x&&b!=y||a.cc.pop()}}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(a){"object"==typeof exports&&"object"==typeof module?a(b("../../lib/codemirror")):"function"==typeof c&&c.amd?c("codemirror/mode/css/css",["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=0;c*\/]/.test(c)?d(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?d("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?d(null,c):"u"==c&&a.match(/rl(-prefix)?\(/)||"d"==c&&a.match("omain(")||"r"==c&&a.match("egexp(")?(a.backUp(1),b.tokenize=g,d("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),d("property","word")):d(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),d("number","unit")):a.match(/^-[\w\\\-]+/)?(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?d("variable-2","variable-definition"):d("variable-2","variable")):a.match(/^\w+-/)?d("meta","meta"):void 0}function f(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){")"==a&&b.backUp(1);break}f=!f&&"\\"==e}return(e==a||!f&&")"!=a)&&(c.tokenize=null),d("string","string")}}function g(a,b){return a.next(),a.match(/\s*[\"\')]/,!1)?b.tokenize=null:b.tokenize=f(")"),d(null,"(")}function h(a,b,c){this.type=a,this.indent=b,this.prev=c}function i(a,b,c,d){return a.context=new h(c,b.indentation()+(d===!1?0:q),a.context),c}function j(a){return a.context.prev&&(a.context=a.context.prev),a.context.type}function k(a,b,c){return E[c.context.type](a,b,c)}function l(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return k(a,b,c)}function m(a){var b=a.current().toLowerCase();p=B.hasOwnProperty(b)?"atom":A.hasOwnProperty(b)?"keyword":"variable"}var n=c.inline;c.propertyKeywords||(c=a.resolveMode("text/css"));var o,p,q=b.indentUnit,r=c.tokenHooks,s=c.documentTypes||{},t=c.mediaTypes||{},u=c.mediaFeatures||{},v=c.mediaValueKeywords||{},w=c.propertyKeywords||{},x=c.nonStandardPropertyKeywords||{},y=c.fontProperties||{},z=c.counterDescriptors||{},A=c.colorKeywords||{},B=c.valueKeywords||{},C=c.allowNested,D=c.supportsAtComponent===!0,E={};return E.top=function(a,b,c){if("{"==a)return i(c,b,"block");if("}"==a&&c.context.prev)return j(c);if(D&&/@component/.test(a))return i(c,b,"atComponentBlock");if(/^@(-moz-)?document$/.test(a))return i(c,b,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(a))return i(c,b,"atBlock");if(/^@(font-face|counter-style)/.test(a))return c.stateArg=a,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return i(c,b,"at");if("hash"==a)p="builtin";else if("word"==a)p="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return i(c,b,"interpolation");if(":"==a)return"pseudo";if(C&&"("==a)return i(c,b,"parens")}return c.context.type},E.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return w.hasOwnProperty(d)?(p="property","maybeprop"):x.hasOwnProperty(d)?(p="string-2","maybeprop"):C?(p=b.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==a?"block":C||"hash"!=a&&"qualifier"!=a?E.top(a,b,c):(p="error","block")},E.maybeprop=function(a,b,c){return":"==a?i(c,b,"prop"):k(a,b,c)},E.prop=function(a,b,c){if(";"==a)return j(c);if("{"==a&&C)return i(c,b,"propBlock");if("}"==a||"{"==a)return l(a,b,c);if("("==a)return i(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(b.current())){if("word"==a)m(b);else if("interpolation"==a)return i(c,b,"interpolation")}else p+=" error";return"prop"},E.propBlock=function(a,b,c){return"}"==a?j(c):"word"==a?(p="property","maybeprop"):c.context.type},E.parens=function(a,b,c){return"{"==a||"}"==a?l(a,b,c):")"==a?j(c):"("==a?i(c,b,"parens"):"interpolation"==a?i(c,b,"interpolation"):("word"==a&&m(b),"parens")},E.pseudo=function(a,b,c){return"word"==a?(p="variable-3",c.context.type):k(a,b,c)},E.documentTypes=function(a,b,c){return"word"==a&&s.hasOwnProperty(b.current())?(p="tag",c.context.type):E.atBlock(a,b,c)},E.atBlock=function(a,b,c){if("("==a)return i(c,b,"atBlock_parens");if("}"==a||";"==a)return l(a,b,c);if("{"==a)return j(c)&&i(c,b,C?"block":"top");if("interpolation"==a)return i(c,b,"interpolation");if("word"==a){var d=b.current().toLowerCase();p="only"==d||"not"==d||"and"==d||"or"==d?"keyword":t.hasOwnProperty(d)?"attribute":u.hasOwnProperty(d)?"property":v.hasOwnProperty(d)?"keyword":w.hasOwnProperty(d)?"property":x.hasOwnProperty(d)?"string-2":B.hasOwnProperty(d)?"atom":A.hasOwnProperty(d)?"keyword":"error"}return c.context.type},E.atComponentBlock=function(a,b,c){return"}"==a?l(a,b,c):"{"==a?j(c)&&i(c,b,C?"block":"top",!1):("word"==a&&(p="error"),c.context.type)},E.atBlock_parens=function(a,b,c){return")"==a?j(c):"{"==a||"}"==a?l(a,b,c,2):E.atBlock(a,b,c)},E.restricted_atBlock_before=function(a,b,c){return"{"==a?i(c,b,"restricted_atBlock"):"word"==a&&"@counter-style"==c.stateArg?(p="variable","restricted_atBlock_before"):k(a,b,c)},E.restricted_atBlock=function(a,b,c){return"}"==a?(c.stateArg=null,j(c)):"word"==a?(p="@font-face"==c.stateArg&&!y.hasOwnProperty(b.current().toLowerCase())||"@counter-style"==c.stateArg&&!z.hasOwnProperty(b.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(a,b,c){return"word"==a?(p="variable","keyframes"):"{"==a?i(c,b,"top"):k(a,b,c)},E.at=function(a,b,c){return";"==a?j(c):"{"==a||"}"==a?l(a,b,c):("word"==a?p="tag":"hash"==a&&(p="builtin"),"at")},E.interpolation=function(a,b,c){return"}"==a?j(c):"{"==a||";"==a?l(a,b,c):("word"==a?p="variable":"variable"!=a&&"("!=a&&")"!=a&&(p="error"),"interpolation")},{startState:function(a){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new h(n?"block":"top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||e)(a,b);return c&&"object"==typeof c&&(o=c[1],c=c[0]),p=c,b.state=E[b.state](o,a,b),p},indent:function(a,b){var c=a.context,d=b&&b.charAt(0),e=c.indent;return"prop"!=c.type||"}"!=d&&")"!=d||(c=c.prev),c.prev&&("}"!=d||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"restricted_atBlock"!=c.type?(")"!=d||"parens"!=c.type&&"atBlock_parens"!=c.type)&&("{"!=d||"at"!=c.type&&"atBlock"!=c.type)||(e=Math.max(0,c.indent-q),c=c.prev):(c=c.prev,e=c.indent)),e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var d=["domain","regexp","url","url-prefix"],e=b(d),f=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=b(f),h=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],i=b(h),j=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],k=b(j),l=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],m=b(l),n=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],o=b(n),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],q=b(p),r=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],s=b(r),t=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],u=b(t),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=b(v),x=d.concat(f).concat(h).concat(j).concat(l).concat(n).concat(t).concat(v); -a.registerHelper("hintWords","css",x),a.defineMIME("text/css",{documentTypes:e,mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},":":function(a){return!!a.match(/\s*\{/)&&[null,"{"]},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return!!a.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},"@":function(a){return a.eat("{")?[null,"interpolation"]:!a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),a.defineMIME("text/x-gss",{documentTypes:e,mediaTypes:g,mediaFeatures:i,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css",helperType:"gss"})}),function(a){"object"==typeof exports&&"object"==typeof module?a(b("../../lib/codemirror"),b("../xml/xml"),b("../javascript/javascript"),b("../css/css")):"function"==typeof c&&c.amd?c("codemirror/mode/htmlmixed/htmlmixed",["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b,c){var d=a.current(),e=d.search(b);return e>-1?a.backUp(d.length-e):d.match(/<\/?$/)&&(a.backUp(d.length),a.match(b,!1)||a.match(d)),c}function c(a){var b=i[a];return b?b:i[a]=new RegExp("\\s+"+a+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function d(a,b){var d=a.match(c(b));return d?/^\s*(.*?)\s*$/.exec(d[2])[1]:""}function e(a,b){return new RegExp((b?"^":"")+"","i")}function f(a,b){for(var c in a)for(var d=b[c]||(b[c]=[]),e=a[c],f=e.length-1;f>=0;f--)d.unshift(e[f])}function g(a,b){for(var c=0;c\s\/]/.test(d.current())&&(h=f.htmlState.tagName&&f.htmlState.tagName.toLowerCase())&&k.hasOwnProperty(h))f.inTag=h+" ";else if(f.inTag&&m&&/>$/.test(d.current())){var n=/^([\S]+) (.*)/.exec(f.inTag);f.inTag=null;var o=">"==d.current()&&g(k[n[1]],n[2]),p=a.getMode(c,o),q=e(n[1],!0),r=e(n[1],!1);f.token=function(a,c){return a.match(q,!1)?(c.token=i,c.localState=c.localMode=null,null):b(a,r,c.localMode.token(a,c.localState))},f.localMode=p,f.localState=a.startState(p,j.indent(f.htmlState,""))}else f.inTag&&(f.inTag+=d.current(),d.eol()&&(f.inTag+=" "));return l}var j=a.getMode(c,{name:"xml",htmlMode:!0,multilineTagIndentFactor:d.multilineTagIndentFactor,multilineTagIndentPastTag:d.multilineTagIndentPastTag}),k={},l=d&&d.tags,m=d&&d.scriptTypes;if(f(h,k),l&&f(l,k),m)for(var n=m.length-1;n>=0;n--)k.script.unshift(["type",m[n].matches,m[n].mode]);return{startState:function(){var b=a.startState(j);return{token:i,inTag:null,localMode:null,localState:null,htmlState:b}},copyState:function(b){var c;return b.localState&&(c=a.copyState(b.localMode,b.localState)),{token:b.token,inTag:b.inTag,localMode:b.localMode,localState:c,htmlState:a.copyState(j,b.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(b,c){return!b.localMode||/^\s*<\//.test(c)?j.indent(b.htmlState,c):b.localMode.indent?b.localMode.indent(b.localState,c):a.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||j}}}},"xml","javascript","css"),a.defineMIME("text/html","htmlmixed")}),function(a){"object"==typeof exports&&"object"==typeof module?a(b("codemirror/lib/codemirror")):"function"==typeof c&&c.amd?c("formatting",["codemirror/lib/codemirror"],a):a(CodeMirror)}(function(a){a.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(a,b){return/^[;{}]$/.test(b)}}),a.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(a,b,c,d){return this.jsonMode?/^[\[,{]$/.test(b)||/^}/.test(c):(";"!=b||!d.lexical||")"!=d.lexical.type)&&(/^[;{}]$/.test(b)&&!/^;/.test(c))}});var b=/^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;a.extendMode("xml",{commentStart:"",newlineAfterToken:function(a,c,d,e){var f=!1;return"html"==this.configuration&&(f=!!e.context&&b.test(e.context.tagName)),!f&&("tag"==a&&/>$/.test(c)&&e.context||/^-1&&h>-1&&h>g&&(a=a.substr(0,g)+a.substring(g+f.commentStart.length,h)+a.substr(h+f.commentEnd.length)),e.replaceRange(a,c,d)}})}),a.defineExtension("autoIndentRange",function(a,b){var c=this;this.operation(function(){for(var d=a.line;d<=b.line;d++)c.indentLine(d,"smart")})}),a.defineExtension("autoFormatRange",function(b,c){function d(){j+="\n",l=!0,++k}for(var e=this,f=e.getMode(),g=e.getRange(b,c).split("\n"),h=a.copyState(f,e.getTokenAt(b).state),i=e.getOption("tabSize"),j="",k=0,l=0===b.ch,m=0;m\n\t
<%= label %>
\n\t
\n\n'}),c("CodeManager/view/EditorView",["backbone","text!./../template/editor.html"],function(a,b){return a.View.extend({template:_.template(b),initialize:function(a){this.config=a.config||{},this.pfx=this.config.stylePrefix},render:function(){var a=this.model.toJSON();return a.pfx=this.pfx,this.$el.html(this.template(a)),this.$el.attr("class",this.pfx+"editor-c"),this.$el.find("#"+this.pfx+"code").html(this.model.get("input")),this}})}),c("CodeManager/main",["require","./config/config","./model/HtmlGenerator","./model/CssGenerator","./model/JsonGenerator","./model/JsGenerator","./model/CodeMirrorEditor","./view/EditorView"],function(a){var b=function(){var b={},c=a("./config/config"),d=a("./model/HtmlGenerator"),e=a("./model/CssGenerator"),f=a("./model/JsonGenerator"),g=a("./model/JsGenerator"),h=a("./model/CodeMirrorEditor"),i=a("./view/EditorView"),j={},k={},l={},m={};return{getConfig:function(){return b},config:b,EditorView:i,name:"CodeManager",init:function(a){b=a||{};for(var i in c)i in b||(b[i]=c[i]);var j=b.pStylePrefix;return j&&(b.stylePrefix=j+b.stylePrefix),k.html=new d,k.css=new e,k.json=new f,k.js=new g,m.CodeMirror=new h,this},onLoad:function(){this.loadDefaultGenerators().loadDefaultViewers()},addGenerator:function(a,b){return j[a]=b,this},getGenerator:function(a){return j[a]||null},getGenerators:function(){return j},addViewer:function(a,b){return l[a]=b,this},getViewer:function(a){return l[a]||null},getViewers:function(){return l},updateViewer:function(a,b){a.setContent(b)},getCode:function(a,b,c){var d=this.getGenerator(b);return d?d.build(a,c):""},loadDefaultGenerators:function(){for(var a in k)this.addGenerator(a,k[a]);return this},loadDefaultViewers:function(){for(var a in m)this.addViewer(a,m[a]);return this}}};return b}),c("CodeManager",["CodeManager/main"],function(a){return a}),c("Panels/config/config",[],function(){var a="create-comp",b="move-comp",c="sw-visibility",d="export-template",e="open-sm",f="open-tm",g="open-layers",h="open-blocks",i="fullscreen",j="preview";return{stylePrefix:"pn-",defaults:[{id:"commands",buttons:[{id:a,command:a,className:"fa fa-pencil-square-o",attributes:{title:"Create element"},stopDefaultCommand:1},{id:b,command:b,className:"fa fa-arrows",attributes:{title:"Move elements"},stopDefaultCommand:1}]},{id:"options",buttons:[{active:!0,id:c,className:"fa fa-square-o",command:c,context:c,attributes:{title:"View components"}},{id:j,className:"fa fa-eye",command:j,context:j,stopDefaultCommand:1,attributes:{title:"Preview"}},{id:i,className:"fa fa-arrows-alt",command:i,context:i,attributes:{title:"Fullscreen"}},{id:d,className:"fa fa-code",command:d,attributes:{title:"View code"}}]},{id:"views",buttons:[{id:e,className:"fa fa-paint-brush",command:e,active:!0,attributes:{title:"Open Style Manager"}},{id:f,className:"fa fa-cog",command:f,attributes:{title:"Settings"}},{id:g,className:"fa fa-bars",command:g,attributes:{title:"Open Layer Manager"}},{id:h,className:"fa fa-th-large",command:h,attributes:{title:"Open Blocks"}}]}],em:null,delayBtnsShow:300}}),c("Panels/model/Button",["backbone","require"],function(a,b){return a.Model.extend({defaults:{id:"",className:"",command:"",context:"",buttons:[],attributes:{},options:{},active:!1,dragDrop:!1,runDefaultCommand:!0,stopDefaultCommand:!1},initialize:function(a){if(this.get("buttons").length){var c=b("./Buttons");this.set("buttons",new c(this.get("buttons")))}}})}),c("Panels/model/Buttons",["backbone","./Button"],function(a,b){return a.Collection.extend({model:b,deactivateAllExceptOne:function(a,b){this.forEach(function(c,d){c!==a&&(c.set("active",!1),b&&c.get("buttons").length&&c.get("buttons").deactivateAllExceptOne(a,b))})},deactivateAll:function(a){var b=a||"";this.forEach(function(a,c){a.get("context")==b&&(a.set("active",!1),a.get("buttons").length&&a.get("buttons").deactivateAll(b))})}})}),c("Panels/model/Panel",["backbone","./Buttons"],function(a,b){return a.Model.extend({defaults:{id:"",content:"",visible:!0,buttons:[]},initialize:function(a){this.btn=this.get("buttons")||[],this.buttons=new b(this.btn),this.set("buttons",this.buttons)}})}),c("Panels/model/Panels",["backbone","./Panel"],function(a,b){return a.Collection.extend({model:b})}),c("Panels/view/ButtonView",["backbone","require"],function(a,b){return a.View.extend({tagName:"span",initialize:function(a){_.bindAll(this,"startTimer","stopTimer","showButtons","hideButtons","closeOnKeyPress","onDrop","initSorter","stopDrag");var b=this.model.get("className");this.config=a.config||{},this.em=this.config.em||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.id=this.pfx+this.model.get("id"),this.activeCls=this.pfx+"active",this.btnsVisCls=this.pfx+"visible",this.parentM=a.parentM||null,this.className=this.pfx+"btn"+(b?" "+b:""),this.listenTo(this.model,"change:active updateActive",this.updateActive),this.listenTo(this.model,"checkActive",this.checkActive),this.listenTo(this.model,"change:bntsVis",this.updateBtnsVis),this.listenTo(this.model,"change:attributes",this.updateAttributes),this.listenTo(this.model,"change:className",this.updateClassName),this.model.get("buttons").length&&(this.$el.on("mousedown",this.startTimer),this.$el.append($("
",{"class":this.pfx+"arrow-rd"}))),this.em&&this.em.get&&(this.commands=this.em.get("Commands")),this.events={},this.model.get("dragDrop")?(this.events.mousedown="initDrag",this.em.on("loaded",this.initSorter)):this.events.click="clicked",this.delegateEvents()},initSorter:function(){if(this.em.Canvas){var a=this.em.Canvas;this.canvasEl=a.getBody(),this.sorter=new this.em.Utils.Sorter({container:this.canvasEl,placer:a.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,onMove:this.onDrag,onEndMove:this.onDrop,document:a.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1});var b=a.getOffset();this.sorter.offTop=b.top,this.sorter.offLeft=b.left}},initDrag:function(){this.model.collection.deactivateAll(this.model.get("context")),this.sorter.startSort(this.el),this.sorter.setDropContent(this.model.get("options").content),this.canvasEl.style.cursor="grabbing",$(document).on("mouseup",this.stopDrag)},stopDrag:function(){$(document).off("mouseup",this.stopDrag),this.sorter.endMove()},onDrag:function(a){},onDrop:function(a){this.canvasEl.style.cursor="default"},updateClassName:function(){var a=this.model.get("className");this.$el.attr("class",this.pfx+"btn"+(a?" "+a:""))},updateAttributes:function(){this.$el.attr(this.model.get("attributes"))},updateBtnsVis:function(){this.$buttons&&(this.model.get("bntsVis")?this.$buttons.addClass(this.btnsVisCls):this.$buttons.removeClass(this.btnsVisCls))},startTimer:function(){this.timeout=setTimeout(this.showButtons,this.config.delayBtnsShow),$(document).on("mouseup",this.stopTimer)},stopTimer:function(){$(document).off("mouseup",this.stopTimer),this.timeout&&clearTimeout(this.timeout)},showButtons:function(){clearTimeout(this.timeout),this.model.set("bntsVis",!0),$(document).on("mousedown",this.hideButtons),$(document).on("keypress",this.closeOnKeyPress)},hideButtons:function(a){a&&$(a.target).trigger("click"),this.model.set("bntsVis",!1),$(document).off("mousedown",this.hideButtons),$(document).off("keypress",this.closeOnKeyPress)},closeOnKeyPress:function(a){var b=a.which||a.keyCode;27==b&&this.hideButtons()},updateActive:function(){var a=null,b=this.em&&this.em.get?this.em.get("Editor"):null,c=this.model.get("command");this.commands&&"string"==typeof c?a=this.commands.get(c):null!==c&&"object"==typeof c?a=c:"function"==typeof c&&(a={run:c}),this.model.get("active")?(this.model.collection.deactivateAll(this.model.get("context")),this.model.set("active",!0,{silent:!0}).trigger("checkActive"),this.parentM&&this.parentM.set("active",!0,{silent:!0}).trigger("checkActive"),a&&a.run&&(a.run(b,this.model,this.model.get("options")),b.trigger("run:"+c))):(this.$el.removeClass(this.activeCls),this.model.collection.deactivateAll(this.model.get("context")),this.parentM&&this.parentM.set("active",!1,{silent:!0}).trigger("checkActive"),a&&a.stop&&(a.stop(b,this.model,this.model.get("options")),b.trigger("stop:"+c)))},checkActive:function(){this.model.get("active")?this.$el.addClass(this.activeCls):this.$el.removeClass(this.activeCls)},clicked:function(a){if(!this.model.get("bntsVis")){this.parentM&&this.swapParent();var b=this.model.get("active");this.model.set("active",!b);this.em.get("Commands").get("select-comp");b?this.model.get("runDefaultCommand")&&this.em.runDefault():this.model.get("stopDefaultCommand")&&this.em.stopDefault()}},swapParent:function(){this.parentM.collection.deactivateAll(this.model.get("context")),this.parentM.set("attributes",this.model.get("attributes")),this.parentM.set("options",this.model.get("options")),this.parentM.set("command",this.model.get("command")),this.parentM.set("className",this.model.get("className")),this.parentM.set("active",!0,{silent:!0}).trigger("checkActive")},render:function(){if(this.updateAttributes(),this.$el.attr("class",this.className),this.model.get("buttons").length){var a=b("./ButtonsView"),c=new a({collection:this.model.get("buttons"),config:this.config,parentM:this.model});this.$buttons=c.render().$el,this.$buttons.append($("
",{"class":this.pfx+"arrow-l"})),this.$el.append(this.$buttons)}return this}})}),c("Panels/view/ButtonsView",["backbone","./ButtonView"],function(a,b){return a.View.extend({initialize:function(a){this.opt=a||{},this.config=this.opt.config||{},this.pfx=this.config.stylePrefix||"",this.parentM=this.opt.parentM||null,this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render),this.className=this.pfx+"buttons"},addTo:function(a){this.addToCollection(a)},addToCollection:function(a,c){var d=c||null,e=b,f=new e({model:a,config:this.config,parentM:this.parentM}),g=f.render().el;return d?d.appendChild(g):this.$el.append(g),g},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.addToCollection(b,a)},this),this.$el.append(a),this.$el.attr("class",_.result(this,"className")),this}})}),c("Panels/view/PanelView",["backbone","./ButtonsView"],function(a,b){return a.View.extend({initialize:function(a){this.config=a.config||{},this.pfx=this.config.stylePrefix||"",this.buttons=this.model.get("buttons"),this.className=this.pfx+"panel",this.id=this.pfx+this.model.get("id"),this.listenTo(this.model,"change:appendContent",this.appendContent),this.listenTo(this.model,"change:content",this.updateContent)},appendContent:function(){this.$el.append(this.model.get("appendContent"))},updateContent:function(){this.$el.html(this.model.get("content"))},render:function(){if(this.$el.attr("class",_.result(this,"className")),this.id&&this.$el.attr("id",this.id),this.buttons.length){var a=new b({collection:this.buttons,config:this.config});this.$el.append(a.render().el)}return this.$el.append(this.model.get("content")),this}})}),c("Panels/view/PanelsView",["backbone","./PanelView"],function(a,b){return a.View.extend({initialize:function(a){this.opt=a||{},this.config=this.opt.config||{},this.pfx=this.config.stylePrefix||"",this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render),this.className=this.pfx+"panels"},addTo:function(a){this.addToCollection(a)},addToCollection:function(a,c){var d=c||null,e=b,f=new e({model:a,config:this.config}),g=f.render().el;return d?d.appendChild(g):this.$el.append(g),g},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.addToCollection(b,a)},this),this.$el.append(a),this.$el.attr("class",_.result(this,"className")),this}})}),c("Panels/main",["require","./config/config","./model/Panel","./model/Panels","./view/PanelView","./view/PanelsView"],function(a){return function(){var b,c,d={},e=a("./config/config"),f=a("./model/Panel"),g=a("./model/Panels"),h=(a("./view/PanelView"),a("./view/PanelsView"));return{name:"Panels",init:function(a){d=a||{};for(var f in e)f in d||(d[f]=e[f]);var i=d.pStylePrefix;return i&&(d.stylePrefix=i+d.stylePrefix),b=new g(d.defaults),c=new h({collection:b,config:d}),this},getPanels:function(){return b},getPanelsEl:function(){return c.el},addPanel:function(a){return b.add(a)},getPanel:function(a){var c=b.where({id:a});return c.length?c[0]:null},addButton:function(a,b){var c=this.getPanel(a);return c?c.get("buttons").add(b):null},getButton:function(a,b){var c=this.getPanel(a);if(c){var d=c.get("buttons").where({id:b});return d.length?d[0]:null}return null},render:function(){return c.render().el},active:function(){this.getPanels().each(function(a){a.get("buttons").each(function(a){a.get("active")&&a.trigger("updateActive")})})},Panel:f}}}),c("Panels",["Panels/main"],function(a){return a}),c("RichTextEditor/config/config",[],function(){return{stylePrefix:"rte-",toolbarId:"toolbar",containerId:"wrapper",commands:[{command:"bold",title:"Bold","class":"fa fa-bold"},{command:"italic",title:"Italic","class":"fa fa-italic"},{command:"underline",title:"Underline","class":"fa fa-underline"},{command:"strikethrough",title:"Strikethrough","class":"fa fa-strikethrough",group:"format"},{command:"insertHTML",title:"Link","class":"fa fa-link",args:'${content}'}]}}),c("RichTextEditor/view/TextEditorView",["jquery"],function(a){var b=function(b){var c=a.Deferred(),d=new FileReader;return d.onload=function(a){c.resolve(a.target.result)},d.onerror=c.reject,d.onprogress=c.notify,d.readAsDataURL(b),c.promise()};return a.fn.cleanHtml=function(){var b=a(this).html();return b&&b.replace(/(
|\s|

<\/div>| )*$/,"")},a.fn.wysiwyg=function(c){var d,e,f,g=this,h=function(){var b=e.activeToolbarClass;b&&a(e.toolbarSelector).find(f).each(function(){var c=a(this),d=c.data(e.commandRole),f=g.get(0).ownerDocument;f.queryCommandState(d)?c.addClass(b):c.removeClass(b)})},i=function(a,b){var c=a.split(" "),d=c.shift(),e=c.join(" ")+(b||"");g.get(0).ownerDocument.execCommand("styleWithCSS",!1,!0),g.get(0).ownerDocument.execCommand(d,0,e),h(),g.trigger("change")},j=function(){var a=window.getSelection();if(a.getRangeAt&&a.rangeCount)return a.getRangeAt(0)},k=function(){d=j()},l=function(){var a=window.getSelection();if(d){try{a.removeAllRanges()}catch(b){document.body.createTextRange().select(),document.selection.empty()}a.addRange(d)}},m=function(c){g.focus(),a.each(c,function(c,d){/^image\//.test(d.type)?a.when(b(d)).done(function(a){i("insertimage",a)}).fail(function(a){e.fileUploadError("file-reader",a)}):e.fileUploadError("unsupported-file-type",d.type)})},n=function(a,b){l(),document.queryCommandSupported("hiliteColor")&&document.execCommand("hiliteColor",0,b||"transparent"),k(),a.data(e.selectionMarker,b)},o=function(b,c){b.find(f).unbind().click(function(){l();var b=g.get(0).ownerDocument,d=a(this),e=d.data(c.commandRole),f=d.data("args");f?(f=f.replace("${content}",b.getSelection()),i(e,f)):b.execCommand(e),k()}),b.find("[data-toggle=dropdown]").click(l);var d="[data-"+c.commandRole+"]";b.find("select"+d).on("webkitspeechchange change",function(){var b=this.value;l(),b&&(g.focus(),i(a(this).data(c.commandRole),b)),k()}),b.find("input[type=text]"+d,", select"+d).on("webkitspeechchange change",function(){var b=this.value;this.value="",l(),b&&(g.focus(),i(a(this).data(c.commandRole),b)),k()}).on("focus",function(){var b=a(this);b.data(c.selectionMarker)||(n(b,c.selectionColor),b.focus())}).on("blur",function(){var b=a(this);b.data(c.selectionMarker)&&n(b,!1)}),b.find("input[type=file][data-"+c.commandRole+"]").change(function(){l(),"file"===this.type&&this.files&&this.files.length>0&&m(this.files),k(),this.value=""})},p=function(){g.on("dragenter dragover",!1).on("drop",function(a){var b=a.originalEvent.dataTransfer;a.stopPropagation(),a.preventDefault(),b&&b.files&&b.files.length>0&&m(b.files)})};if("string"==typeof c&&"destroy"==c)return g.attr("contenteditable",!1).unbind("mouseup keyup mouseout dragenter dragover"),a(window).unbind("touchend"),this;e=a.extend({},a.fn.wysiwyg.defaults,c);var q="[data-"+e.commandRole+"]";return f="a"+q+",button"+q+",input[type=button]"+q+", select"+q,e.dragAndDropImages&&p(),o(a(e.toolbarSelector),e),g.attr("contenteditable",!0).on("mouseup keyup mouseout",function(){k(),h()}),a(window).bind("touchend",function(a){var b=g.is(a.target)||g.has(a.target).length>0,c=j(),d=c&&c.startContainer===c.endContainer&&c.startOffset===c.endOffset;d&&!b||(k(),h())}),this},a.fn.wysiwyg.defaults={toolbarSelector:"[data-role=editor-toolbar]",commandRole:"edit",activeToolbarClass:"btn-info",selectionMarker:"edit-focus-marker",selectionColor:"darkgrey",dragAndDropImages:!0,fileUploadError:function(a,b){console.log("File upload error",a,b)}},a}),c("RichTextEditor/model/CommandButton",["backbone"],function(a){return a.Model.extend({idAttribute:"command",defaults:{command:"",type:"",title:"","class":"",options:[]},initialize:function(){var a=this.get("options");a.length&&this.set("type","select")}})}),c("RichTextEditor/model/CommandButtons",["backbone","./CommandButton"],function(a,b){return a.Collection.extend({model:b})}),c("RichTextEditor/view/CommandButtonView",["backbone"],function(a){return a.View.extend({tagName:"a",initialize:function(a,b){this.config=b||{},this.ppfx=this.config.pStylePrefix||"",this.className=this.config.stylePrefix+"btn "+this.model.get("class")},render:function(){return this.$el.addClass(this.className),this}})}),c("RichTextEditor/view/CommandButtonSelectView",["backbone","./CommandButtonView"],function(a,b){return b.extend({initialize:function(a,c){b.prototype.initialize.apply(this,arguments)},getInput:function(){var a=this.model;if(!this.input){var b=a.get("command"),c='",this.input=$(c)}return this.input},getInputCont:function(){var a=this.getInput(),b=this.ppfx,c=$('
');return c.append(a)},render:function(){return b.prototype.render.apply(this,arguments),this.$el.html(this.getInputCont()),this}})}),c("RichTextEditor/view/CommandButtonsView",["backbone","./CommandButtonView","./CommandButtonSelectView"],function(a,b,c){return a.View.extend({attributes:{"data-role":"editor-toolbar"},initialize:function(a){this.config=a.config||{};var b=this.config.stylePrefix||"";this.id=b+this.config.toolbarId,this.listenTo(this.collection,"add",this.addTo),this.$el.data("helper",1)},addTo:function(a){this.add(a)},add:function(a,d){var e=d||null,f=b;switch(a.get("type")){case"select":f=c}var g=a.get("args"),h={title:a.get("title"),"data-edit":a.get("command")};g&&(h["data-args"]=g);var i=new f({model:a,attributes:h},this.config),j=i.render().el;e?e.appendChild(j):this.$el.append(j)},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.add(b,a)},this),this.$el.append(a),this.$el.attr("id",this.id),this}})}),c("RichTextEditor/main",["require","./config/config","./view/TextEditorView","./model/CommandButtons","./view/CommandButtonsView"],function(a){return function(){var b,c,d,e,f={},g=a("./config/config"),h=(a("./view/TextEditorView"),a("./model/CommandButtons")),i=a("./view/CommandButtonsView");return{customRte:null,name:"rte",init:function(a){e=this,f=a||{};for(var j in g)j in f||(f[j]=g[j]);var k=f.pStylePrefix;return k&&(f.stylePrefix=k+f.stylePrefix),b=f.stylePrefix,d=new h(f.commands),c=new i({collection:d,config:f}),this},add:function(a,b){var c=b||{};return c.command=a,d.add(c)},get:function(a){return d.where({command:a})[0]},getAll:function(){return d},udpatePosition:function(){var a="px",b=f.em.get("Canvas"),d=b.getTargetToElementDim(c.el,this.lastEl,{event:"rteToolbarPosUpdate"}),e=c.el.style;e.top=d.top+a,e.left=d.left+a},attach:function(a,b){this.lastEl=a.el;var d=a.getChildrenContainer(),e=this.customRte;return e?b=e.enable(d,b):$(d).wysiwyg({}).focus(),this.show(),f.em&&(setTimeout(this.udpatePosition.bind(this),0),f.em.off("change:canvasOffset",this.udpatePosition,this),f.em.on("change:canvasOffset",this.udpatePosition,this),f.em.off("canvasScroll",this.udpatePosition,this),f.em.on("canvasScroll",this.udpatePosition,this)),c.$el.on("mousedown",this.disableProp),b},detach:function(a,b){var d=this.customRte,e=a.getChildrenContainer();d?(a.model.set("content",e.innerHTML),d.disable(e,b)):$(e).wysiwyg("destroy"),this.hide(),c.$el.off("mousedown",this.disableProp)},focus:function(a,b){var c=this.customRte,d=a.getChildrenContainer();c?c.focus&&c.focus(d,b):this.attach(a)},show:function(){var a=c.el.style;a.display="block"},hide:function(){c.el.style.display="none"},disableProp:function(a){a.stopPropagation()},getToolbarEl:function(){return c.el},render:function(){return c.render().el}}}}),c("RichTextEditor",["RichTextEditor/main"],function(a){return a}),c("StyleManager/config/config",[],function(){return{stylePrefix:"sm-",sectors:[],textNoElement:"Select an element before using Style Manager",hideNotStylable:!0}}),c("StyleManager/model/Layer",["backbone"],function(a){return a.Model.extend({defaults:{index:"",value:"",values:{},active:!0,preview:!1},initialize:function(){var a=this.get("value");if(!a){var b="",c=this.get("values");for(var d in c)b+=" "+c[d];this.set("value",b.trim())}}})}),c("StyleManager/model/Layers",["backbone","./Layer"],function(a,b){return a.Collection.extend({model:b,initialize:function(){this.idx=1,this.on("add",this.onAdd),this.on("reset",this.onReset)},onAdd:function(a,b,c){c.noIncrement||a.set("index",this.idx++)},onReset:function(){this.idx=1}})}),c("StyleManager/model/Property",["backbone","./Layers","require"],function(a,b,c){return a.Model.extend({defaults:{name:"",property:"",type:"",units:[],unit:"",defaults:"",info:"",value:"",icon:"",preview:!1,detached:!1,visible:!0,functionName:"",properties:[],layers:[],list:[],fixedValues:["initial","inherit"]},initialize:function(a){var d=this.get("type"),e=this.get("name"),f=this.get("property"),g=this.get("properties");if(e||this.set("name",f.charAt(0).toUpperCase()+f.slice(1).replace(/-/g," ")),g.length){var h=c("./Properties");this.set("properties",new h(g))}switch(d){case"stack":this.set("layers",new b)}},getValue:function(){var a="",b=this.get("type");switch(b){case"integer":a=this.get("value")+this.get("unit");break;default:a=this.get("value")}return a}})}),c("StyleManager/model/Properties",["backbone","./Property"],function(a,b){return a.Collection.extend({model:b})}),c("StyleManager/model/PropertyFactory",["backbone"],function(a){return function(){return{build:function(a){var b=[];"string"==typeof a&&(a=[a]);for(var c=0,d=a.length;c\n\t
\n\t\t<%= label %>\n\t
\n
'}),c("text!StyleManager/templates/propertyInput.html",[],function(){return'
\n\tinput-holder\'>\n
\n
\n'}),c("StyleManager/view/PropertyView",["backbone","text!./../templates/propertyLabel.html","text!./../templates/propertyInput.html"],function(a,b,c){return a.View.extend({template:_.template(c),templateLabel:_.template(b),events:{change:"valueUpdated"},initialize:function(a){this.config=a.config||{},this.em=this.config.em,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=a.target||{},this.propTarget=a.propTarget||{},this.onChange=a.onChange||{},this.onInputRender=a.onInputRender||{},this.customValue=a.customValue||{},this.defaultValue=this.model.get("defaults"),this.property=this.model.get("property"),this.input=this.$input=null,this.className=this.pfx+"property",this.inputHolderId="#"+this.pfx+"input-holder",this.sector=this.model.collection&&this.model.collection.sector,this.model.get("value")||this.model.set("value",this.model.get("defaults")),this.listenTo(this.propTarget,"update",this.targetUpdated),this.listenTo(this.model,"destroy remove",this.remove),this.listenTo(this.model,"change:value",this.valueChanged),this.listenTo(this.model,"targetUpdated",this.targetUpdated),this.listenTo(this.model,"change:visible",this.updateVisibility)},getTarget:function(){return this.selectedComponent?this.selectedComponent:this.propTarget?this.propTarget.model:null},valueUpdated:function(){this.$input&&this.model.set("value",this.getInputValue())},targetUpdated:function(){this.selectedComponent=this.propTarget.model,this.helperComponent=this.propTarget.helper,this.checkVisibility(),this.getTarget()&&(this.sameValue()||this.renderInputRequest())},checkVisibility:function(){this.config.hideNotStylable&&(this.isTargetStylable()&&this.isComponentStylable()?this.show():this.hide(),this.sector&&this.sector.trigger("updateVisibility"))},sameValue:function(){return this.getComponentValue()==this.getValueForTarget()},getComponentValue:function(){var a=this.model,b=this.getTarget();if(b){var c=b.get("style")[this.property];if(c?this.componentValue=c:this.componentValue=this.defaultValue+(this.unit||""),a.get("functionName")){var d=this.fetchFromFunction(this.componentValue);d&&(this.componentValue=d)}if(this.customValue&&"function"==typeof this.customValue){var e=a.collection.indexOf(a),f=this.customValue(this,e);f&&(this.componentValue=f)}return this.componentValue}},getTargetValue:function(a){var b,c=a||{},d=this.model,e=this.getTarget();return e?(b=e.get("style")[d.get("property")],b||c.ignoreDefault||(b=this.getDefaultValue()),b):b},getDefaultValue:function(){return this.model.get("defaults")},fetchFromFunction:function(a){return a.substring(a.indexOf("(")+1,a.lastIndexOf(")"))},tryFetchFromFunction:function(a){if(!this.model.get("functionName"))return a;var b=a.indexOf("(")+1,c=a.lastIndexOf(")");return a.substring(b,c)},getValueForTarget:function(){return this.model.get("value")},getInputValue:function(){return this.$input?this.$input.val():""},valueChanged:function(a,b,c){var d=this.getValueForTarget(),e=this.config.em,f=this.model;if(this.$input&&this.setValue(d),this.getTarget()&&this.isTargetStylable()&&this.isComponentStylable()){value=this.getValueForTarget();var g=f.get("functionName");g&&(value=g+"("+value+")");var h=this.getTarget(),i=this.onChange;i&&"function"==typeof i?i(h,this,c):this.updateTargetStyle(value,null,c),e&&(e.trigger("component:update",f),e.trigger("component:styleUpdate",f),e.trigger("component:styleUpdate:"+f.get("property"),f))}},updateTargetStyle:function(a,b,c){var d=b||this.property,e=a||"",f=c?c.avoidStore:0,g=this.getTarget(),h=_.clone(g.get("style"));e?h[d]=e:delete h[d],g.set("style",h,{avoidStore:f}),this.helperComponent&&this.helperComponent.set("style",h,{avoidStore:f})},isTargetStylable:function(){var a=this.getTarget().get("stylable");return a instanceof Array&&(a=_.indexOf(a,this.property)>=0),a},isComponentStylable:function(){var a=this.em,b=a&&a.get("selectedComponent");if(!b)return!0;var c=b.get("stylable");return c instanceof Array&&(c=_.indexOf(c,this.property)>=0),c},setValue:function(a,b){var c=0===b?0:1,d=this.model.get("defaults"),e=this.model.get("value")||d;(a||c)&&(e=a),this.$input&&this.$input.val(e),this.model.set({value:e},{silent:!0})},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)},renderLabel:function(){this.$el.html(this.templateLabel({pfx:this.pfx,ppfx:this.ppfx,icon:this.model.get("icon"),info:this.model.get("info"),label:this.model.get("name")}))},renderField:function(){this.renderTemplate(),this.renderInput(),delete this.componentValue},renderTemplate:function(){this.$el.append(this.template({pfx:this.pfx,ppfx:this.ppfx,icon:this.model.get("icon"),info:this.model.get("info"),label:this.model.get("name")}))},renderInput:function(){this.$input||(this.$input=$("",{placeholder:this.model.get("defaults"),type:"text"}),this.$el.find(this.inputHolderId).html(this.$input)),this.setValue(this.componentValue,0)},renderInputRequest:function(){this.renderInput()},cleanValue:function(){this.setValue("")},render:function(){return this.renderLabel(),this.renderField(),this.$el.attr("class",this.className),this}})}),c("text!Abstract/ui/templates/inputNumber.html",[],function(){return'input-holder\'>\nfield-units\'>\n
\n\t
\n\t
\n
\n'}),c("Abstract/ui/InputNumber",["backbone","text!./templates/inputNumber.html"],function(a,b){return a.View.extend({events:{},template:_.template(b),initialize:function(a){_.bindAll(this,"moveIncrement","upIncrement");var b=a||{},c=b.ppfx||"",d=b.contClass||c+"field";this.ppfx=c,this.docEl=$(document),this.inputCls=c+"input-number",this.unitCls=c+"input-unit",this.contClass=d,this.events["click ."+c+"field-arrow-u"]="upArrowClick",this.events["click ."+c+"field-arrow-d"]="downArrowClick",this.events["mousedown ."+c+"field-arrows"]="downIncrement",this.events["change ."+this.inputCls]="handleChange",this.events["change ."+this.unitCls]="handleUnitChange",this.listenTo(this.model,"change:unit change:value",this.handleModelChange),this.delegateEvents()},setValue:function(a,b){var c=b||{},d=this.validateInputValue(a,{deepCheck:1}),e={value:d.value};(d.unit||d.force)&&(e.unit=d.unit),this.model.set(e,c),c.silent&&this.handleModelChange()},handleChange:function(a){a.stopPropagation(),this.setValue(this.getInputEl().value)},handleUnitChange:function(a){a.stopPropagation();var b=this.getUnitEl().value;this.model.set("unit",b)},handleModelChange:function(){var a=this.model;this.getInputEl().value=a.get("value");var b=this.getUnitEl();b&&(b.value=a.get("unit"))},getInputEl:function(){return this.inputEl||(this.inputEl=$("",{type:"text","class":this.inputCls,placeholder:this.model.get("defaults")})),this.inputEl.get(0)},getUnitEl:function(){if(!this.unitEl){var a=this.model,b=a.get("units")||[];if(b.length){var c='",this.unitEl=$(c)}}return this.unitEl&&this.unitEl.get(0)},upArrowClick:function(){var a=this.model.get("value");a=isNaN(a)?1:parseInt(a,10)+1;var b=this.validateInputValue(a);this.model.set("value",b.value)},downArrowClick:function(){var a=this.model.get("value");a=isNaN(a)?0:parseInt(a,10)-1;var b=this.validateInputValue(a);this.model.set("value",b.value)},downIncrement:function(a){a.preventDefault(),this.moved=0;var b=this.model.get("value");b=isNaN(b)?0:parseInt(b,10);var c={y:a.pageY,val:b};this.docEl.mouseup(c,this.upIncrement),this.docEl.mousemove(c,this.moveIncrement)},moveIncrement:function(a){this.moved=1;var b=parseInt(a.data.val-a.pageY+a.data.y,10);return this.prValue=this.validateInputValue(b).value,this.model.set("value",this.prValue,{avoidStore:1}),!1},upIncrement:function(a){if(this.docEl.off("mouseup",this.upIncrement),this.docEl.off("mousemove",this.moveIncrement),this.prValue&&this.moved){var b=this.prValue-1;this.model.set("value",b,{avoidStore:1}).set("value",b+1)}},validateInputValue:function(a,b){var c=0,d=b||{},e=this.model,f=a||e.get("defaults"),g=e.get("units")||[],h=e.get("unit")||g.length&&g[0]||"",i=e.get("max"),j=e.get("min");if(d.deepCheck){var k=e.get("fixedValues")||[];if(f){var l=new RegExp("^"+k.join("|"),"g");if(k.length&&l.test(f))f=f.match(l)[0],h="",c=1;else{var m=f+"";f+="",f=parseFloat(f.replace(",",".")),f=isNaN(f)?e.get("defaults"):f;var n=m.replace(f,"");_.indexOf(g,n)>=0&&(h=n)}}}return"undefined"!=typeof i&&""!==i&&(f=f>i?i:f),"undefined"!=typeof j&&""!==j&&(f=f\n\tinput-holder\'>\n
\n
\n'}),c("StyleManager/view/PropertyRadioView",["backbone","./PropertyView","text!./../templates/propertyRadio.html"],function(a,b,c){return b.extend({template:_.template(c),initialize:function(a){b.prototype.initialize.apply(this,arguments),this.list=this.model.get("list")||[],this.className=this.className+" "+this.pfx+"list"},renderInput:function(){var a=this.pfx,b=this.ppfx,c=b+"radio-item-label",d=this.property;if(!this.$input&&this.list&&this.list.length){var e="";_.each(this.list,function(f){var g=f.className?f.className+" "+a+"icon "+c:"",h=d+"-"+f.value,i=f.name?f.name:f.value;titleAttr=f.title?'title="'+f.title+'"':"",e+='
"}),this.input=e,this.$inputEl=$(this.input),this.$el.find("#"+a+"input-holder").html(this.$inputEl),this.$input=this.$inputEl.find('input[name="'+this.property+'"]')}this.setValue(this.componentValue)},getInputValue:function(){return this.$input?this.$el.find("input:checked").val():""},setValue:function(a){var b=this.model.get("value")||this.defaultValue;a&&(b=a),this.$input&&this.$input.filter('[value="'+b+'"]').prop("checked",!0),this.model.set({value:b},{silent:!0})}})}),c("text!StyleManager/templates/propertySelect.html",[],function(){return'
\n\tinput-holder\'>\n\t
\n\t\t
\n\t
\n
\n
\n'}),c("StyleManager/view/PropertySelectView",["backbone","./PropertyView","text!./../templates/propertySelect.html"],function(a,b,c){return b.extend({template:_.template(c),initialize:function(a){b.prototype.initialize.apply(this,arguments),this.list=this.model.get("list")||[]},renderInput:function(){var a=this.pfx;if(!this.$input){var b="",this.input=b,this.$input=$(this.input),this.$el.find("#"+a+"input-holder").html(this.$input)}this.setValue(this.componentValue,0)}})}),c("text!Abstract/ui/templates/input.html",[],function(){return"\n"}),c("Abstract/ui/Input",["backbone","text!./templates/input.html"],function(a,b){return a.View.extend({events:{change:"handleChange"},template:_.template(b),initialize:function(a){var b=a||{},c=b.ppfx||"";this.target=b.target||{},this.inputClass=c+"field",this.inputHolderClass=c+"input-holder",this.ppfx=c,this.listenTo(this.model,"change:value",this.handleModelChange)},handleChange:function(a){a.stopPropagation(),this.setValue(this.getInputEl().value)},setValue:function(a,b){var c=b||{},d=this.model;d.set({value:a||d.get("defaults")},c),c.silent&&this.handleModelChange()},handleModelChange:function(){this.getInputEl().value=this.model.get("value")},getInputEl:function(){return this.inputEl||(this.inputEl=$("",{type:"text","class":this.inputCls,placeholder:this.model.get("defaults")})),this.inputEl.get(0)},render:function(){var a=this.$el;return a.addClass(this.inputClass),a.html(this.template({holderClass:this.inputHolderClass,ppfx:this.ppfx})),a.find("."+this.inputHolderClass).html(this.getInputEl()),this}})}),function(a){"use strict";"function"==typeof c&&c.amd?c("Spectrum",["jquery"],a):"object"==typeof exports&&"object"==typeof module?module.exports=a(b("jquery")):a(jQuery)}(function(a,b){"use strict";function c(b,c,d,e){for(var f=[],g=0;g')}else{var m="sp-clear-display";f.push(a("
").append(a('').attr("title",e.noColorSelectedText)).html())}}return"
"+f.join("")+"
"}function d(){for(var a=0;aMath.abs(b-e);ta=f?"x":"y"}}else ta=null;var g=!ta||"x"===ta,h=!ta||"y"===ta;g&&(ka=parseFloat(a/ba)),h&&(la=parseFloat((ca-b)/ca)),Xa=!1,U.showAlpha||(ma=1),K()},y,z),Ta?(H(Ta),L(),Va=U.preferredFormat||tinycolor(Ta).format,u(Ta)):L(),V&&C();var d=p?"mousedown.spectrum":"click.spectrum touchstart.spectrum";Ha.delegate(".sp-thumb-el",d,b),Ia.delegate(".sp-thumb-el:nth-child(1)",d,{ignore:!0},b)}function t(){if(X&&window.localStorage){try{var b=window.localStorage[X].split(",#");b.length>1&&(delete window.localStorage[X],a.each(b,function(a,b){u(b)}))}catch(c){}try{qa=window.localStorage[X].split(";")}catch(c){}}}function u(b){if(W){var c=tinycolor(b).toRgbString();if(!pa[c]&&a.inArray(c,qa)===-1)for(qa.push(c);qa.length>ra;)qa.shift();if(X&&window.localStorage)try{window.localStorage[X]=qa.join(";")}catch(d){}}}function v(){var a=[];if(U.showPalette)for(var b=0;bj&&j>e?Math.abs(l.left+e-j):0),l.top-=Math.min(l.top,l.top+f>k&&k>f?Math.abs(f+g-d):d),l}function h(){}function i(a){a.stopPropagation()}function j(a,b){var c=Array.prototype.slice,d=c.call(arguments,2);return function(){return a.apply(b,d.concat(c.call(arguments)))}}function k(b,c,d,e){function f(a){a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.returnValue=!1}function g(a){if(k){if(p&&j.documentMode<9&&!a.button)return i();var d=a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches[0],e=d&&d.pageX||a.pageX,g=d&&d.pageY||a.pageY,h=Math.max(0,Math.min(e-l.left,n)),q=Math.max(0,Math.min(g-l.top,m));o&&f(a),c.apply(b,[h,q,a])}}function h(c){var e=c.which?3==c.which:2==c.button;e||k||d.apply(b,arguments)!==!1&&(k=!0,m=a(b).height(),n=a(b).width(),l=a(b).offset(),a(j).bind(q),a(j.body).addClass("sp-dragging"),g(c),f(c))}function i(){k&&(a(j).unbind(q),a(j.body).removeClass("sp-dragging"),setTimeout(function(){e.apply(b,arguments)},0)),k=!1}c=c||function(){},d=d||function(){},e=e||function(){};var j=document,k=!1,l={},m=0,n=0,o="ontouchstart"in window,q={};q.selectstart=f,q.dragstart=f,q["touchmove mousemove"]=g,q["touchend mouseup"]=i,a(b).bind("touchstart mousedown",h)}function l(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d),!c&&d||(d=setTimeout(g,b))}}function m(){return a.fn.spectrum.inputTypeColorSupport()}var n={beforeShow:h,move:h,change:h,show:h,hide:h,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},o=[],p=!!/msie/i.exec(window.navigator.userAgent),q=function(){function a(a,b){return!!~(""+a).indexOf(b)}var b=document.createElement("div"),c=b.style;return c.cssText="background-color:rgba(0,0,0,.5)",a(c.backgroundColor,"rgba")||a(c.backgroundColor,"hsla")}(),r=["
","
","
","
"].join(""),s=function(){var a="";if(p)for(var b=1;b<=6;b++)a+="
";return["
","
","
","
","","
","
","
","
","
","
","
","
","
","
","
","
","
","
","
","
","
",a,"
","
","
","
","
","","
","
","
","","","
","
","
"].join("")}(),t="spectrum.id";a.fn.spectrum=function(b,c){if("string"==typeof b){var d=this,e=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=o[a(this).data(t)];if(c){var f=c[b];if(!f)throw new Error("Spectrum: no such method: '"+b+"'");"get"==b?d=c.get():"container"==b?d=c.container:"option"==b?d=c.option.apply(c,e):"destroy"==b?(c.destroy(),a(this).removeData(t)):f.apply(c,e)}}),d}return this.spectrum("destroy").each(function(){var c=a.extend({},b,a(this).data()),d=f(this,c);a(this).data(t,d.id)})},a.fn.spectrum.load=!0,a.fn.spectrum.loadOpts={},a.fn.spectrum.draggable=k,a.fn.spectrum.defaults=n,a.fn.spectrum.inputTypeColorSupport=function u(){if("undefined"==typeof u._cachedResult){var b=a("")[0];u._cachedResult="color"===b.type&&""!==b.value}return u._cachedResult},a.spectrum={},a.spectrum.localization={},a.spectrum.palettes={},a.fn.spectrum.processNativeColorInputs=function(){var b=a("input[type=color]");b.length&&!m()&&b.spectrum({preferredFormat:"hex6"})},function(){function a(a){var c={r:0,g:0,b:0},e=1,g=!1,h=!1;return"string"==typeof a&&(a=G(a)),"object"==typeof a&&(a.hasOwnProperty("r")&&a.hasOwnProperty("g")&&a.hasOwnProperty("b")?(c=b(a.r,a.g,a.b),g=!0,h="%"===String(a.r).substr(-1)?"prgb":"rgb"):a.hasOwnProperty("h")&&a.hasOwnProperty("s")&&a.hasOwnProperty("v")?(a.s=D(a.s),a.v=D(a.v),c=f(a.h,a.s,a.v),g=!0,h="hsv"):a.hasOwnProperty("h")&&a.hasOwnProperty("s")&&a.hasOwnProperty("l")&&(a.s=D(a.s),a.l=D(a.l),c=d(a.h,a.s,a.l),g=!0,h="hsl"),a.hasOwnProperty("a")&&(e=a.a)),e=w(e),{ok:g,format:a.format||h,r:M(255,N(c.r,0)),g:M(255,N(c.g,0)),b:M(255,N(c.b,0)),a:e}}function b(a,b,c){return{r:255*x(a,255),g:255*x(b,255),b:255*x(c,255)}}function c(a,b,c){a=x(a,255),b=x(b,255),c=x(c,255);var d,e,f=N(a,b,c),g=M(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(b1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(a=x(a,360),b=x(b,100),c=x(c,100),0===b)e=f=g=c;else{var h=c<.5?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return{r:255*e,g:255*f,b:255*g}}function e(a,b,c){a=x(a,255),b=x(b,255),c=x(c,255);var d,e,f=N(a,b,c),g=M(a,b,c),h=f,i=f-g;if(e=0===f?0:i/f,f==g)d=0;else{switch(f){case a:d=(b-c)/i+(b>1)+720)%360;--b;)d.h=(d.h+e)%360,f.push(P(d));return f}function u(a,b){b=b||6;for(var c=P(a).toHsv(),d=c.h,e=c.s,f=c.v,g=[],h=1/b;b--;)g.push(P({h:d,s:e,v:f})),f=(f+h)%1;return g}function v(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}function w(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function x(a,b){A(a)&&(a="100%");var c=B(a);return a=M(b,N(0,parseFloat(a))),c&&(a=parseInt(a*b,10)/100),K.abs(a-b)<1e-6?1:a%b/parseFloat(b)}function y(a){return M(1,N(0,a))}function z(a){return parseInt(a,16)}function A(a){return"string"==typeof a&&a.indexOf(".")!=-1&&1===parseFloat(a)}function B(a){return"string"==typeof a&&a.indexOf("%")!=-1}function C(a){return 1==a.length?"0"+a:""+a}function D(a){return a<=1&&(a=100*a+"%"),a}function E(a){return Math.round(255*parseFloat(a)).toString(16)}function F(a){return z(a)/255}function G(a){a=a.replace(H,"").replace(I,"").toLowerCase();var b=!1;if(Q[a])a=Q[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=S.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=S.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=S.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=S.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=S.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=S.hsva.exec(a))?{h:c[1],s:c[2],v:c[3],a:c[4]}:(c=S.hex8.exec(a))?{a:F(c[1]),r:z(c[2]),g:z(c[3]),b:z(c[4]),format:b?"name":"hex8"}:(c=S.hex6.exec(a))?{r:z(c[1]),g:z(c[2]),b:z(c[3]),format:b?"name":"hex"}:!!(c=S.hex3.exec(a))&&{r:z(c[1]+""+c[1]),g:z(c[2]+""+c[2]),b:z(c[3]+""+c[3]),format:b?"name":"hex"}}var H=/^[\s,#]+/,I=/\s+$/,J=0,K=Math,L=K.round,M=K.min,N=K.max,O=K.random,P=function(b,c){if(b=b?b:"",c=c||{},b instanceof P)return b;if(!(this instanceof P))return new P(b,c);var d=a(b);this._originalInput=b,this._r=d.r,this._g=d.g,this._b=d.b,this._a=d.a,this._roundA=L(100*this._a)/100,this._format=c.format||d.format,this._gradientType=c.gradientType,this._r<1&&(this._r=L(this._r)),this._g<1&&(this._g=L(this._g)),this._b<1&&(this._b=L(this._b)),this._ok=d.ok,this._tc_id=J++};P.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var a=this.toRgb();return(299*a.r+587*a.g+114*a.b)/1e3},setAlpha:function(a){return this._a=w(a),this._roundA=L(100*this._a)/100,this},toHsv:function(){var a=e(this._r,this._g,this._b);return{h:360*a.h,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=e(this._r,this._g,this._b),b=L(360*a.h),c=L(100*a.s),d=L(100*a.v);return 1==this._a?"hsv("+b+", "+c+"%, "+d+"%)":"hsva("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHsl:function(){var a=c(this._r,this._g,this._b);return{h:360*a.h,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=c(this._r,this._g,this._b),b=L(360*a.h),d=L(100*a.s),e=L(100*a.l);return 1==this._a?"hsl("+b+", "+d+"%, "+e+"%)":"hsla("+b+", "+d+"%, "+e+"%, "+this._roundA+")"},toHex:function(a){return g(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(){return h(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:L(this._r),g:L(this._g),b:L(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+L(this._r)+", "+L(this._g)+", "+L(this._b)+")":"rgba("+L(this._r)+", "+L(this._g)+", "+L(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:L(100*x(this._r,255))+"%",g:L(100*x(this._g,255))+"%",b:L(100*x(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+L(100*x(this._r,255))+"%, "+L(100*x(this._g,255))+"%, "+L(100*x(this._b,255))+"%)":"rgba("+L(100*x(this._r,255))+"%, "+L(100*x(this._g,255))+"%, "+L(100*x(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(R[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(a){var b="#"+h(this._r,this._g,this._b,this._a),c=b,d=this._gradientType?"GradientType = 1, ":"";if(a){var e=P(a);c=e.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+d+"startColorstr="+b+",endColorstr="+c+")"},toString:function(a){var b=!!a;a=a||this._format;var c=!1,d=this._a<1&&this._a>=0,e=!b&&d&&("hex"===a||"hex6"===a||"hex3"===a||"name"===a);return e?"name"===a&&0===this._a?this.toName():this.toRgbString():("rgb"===a&&(c=this.toRgbString()),"prgb"===a&&(c=this.toPercentageRgbString()),"hex"!==a&&"hex6"!==a||(c=this.toHexString()),"hex3"===a&&(c=this.toHexString(!0)),"hex8"===a&&(c=this.toHex8String()),"name"===a&&(c=this.toName()),"hsl"===a&&(c=this.toHslString()),"hsv"===a&&(c=this.toHsvString()),c||this.toHexString())},_applyModification:function(a,b){var c=a.apply(null,[this].concat([].slice.call(b)));return this._r=c._r,this._g=c._g,this._b=c._b,this.setAlpha(c._a),this},lighten:function(){return this._applyModification(l,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(n,arguments)},desaturate:function(){return this._applyModification(i,arguments)},saturate:function(){return this._applyModification(j,arguments)},greyscale:function(){return this._applyModification(k,arguments)},spin:function(){return this._applyModification(o,arguments)},_applyCombination:function(a,b){return a.apply(null,[this].concat([].slice.call(b)))},analogous:function(){return this._applyCombination(t,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(u,arguments)},splitcomplement:function(){return this._applyCombination(s,arguments)},triad:function(){return this._applyCombination(q,arguments)},tetrad:function(){return this._applyCombination(r,arguments)}},P.fromRatio=function(a,b){if("object"==typeof a){var c={};for(var d in a)a.hasOwnProperty(d)&&("a"===d?c[d]=a[d]:c[d]=D(a[d]));a=c}return P(a,b)},P.equals=function(a,b){return!(!a||!b)&&P(a).toRgbString()==P(b).toRgbString()},P.random=function(){return P.fromRatio({r:O(),g:O(),b:O()})},P.mix=function(a,b,c){c=0===c?0:c||50;var d,e=P(a).toRgb(),f=P(b).toRgb(),g=c/100,h=2*g-1,i=f.a-e.a;d=h*i==-1?h:(h+i)/(1+h*i),d=(d+1)/2;var j=1-d,k={r:f.r*d+e.r*j,g:f.g*d+e.g*j,b:f.b*d+e.b*j,a:f.a*g+e.a*(1-g)};return P(k)},P.readability=function(a,b){var c=P(a),d=P(b),e=c.toRgb(),f=d.toRgb(),g=c.getBrightness(),h=d.getBrightness(),i=Math.max(e.r,f.r)-Math.min(e.r,f.r)+Math.max(e.g,f.g)-Math.min(e.g,f.g)+Math.max(e.b,f.b)-Math.min(e.b,f.b);return{brightness:Math.abs(g-h),color:i}},P.isReadable=function(a,b){var c=P.readability(a,b);return c.brightness>125&&c.color>500},P.mostReadable=function(a,b){for(var c=null,d=0,e=!1,f=0;f125&&g.color>500,i=3*(g.brightness/125)+g.color/500;(h&&!e||h&&e&&i>d||!h&&!e&&i>d)&&(e=h,d=i,c=P(b[f]))}return c};var Q=P.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},R=P.hexNames=v(Q),S=function(){var a="[-\\+]?\\d+%?",b="[-\\+]?\\d*\\.\\d+%?",c="(?:"+b+")|(?:"+a+")",d="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",e="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?";return{rgb:new RegExp("rgb"+d),rgba:new RegExp("rgba"+e),hsl:new RegExp("hsl"+d),hsla:new RegExp("hsla"+e),hsv:new RegExp("hsv"+d),hsva:new RegExp("hsva"+e),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();window.tinycolor=P}(),a(function(){a.fn.spectrum.load&&a.fn.spectrum.processNativeColorInputs()})}),c("text!Abstract/ui/templates/inputColor.html",[],function(){return'
input-holder\'>
\n
\n\t
\n\t\t
\n\t
\n
\n'}),c("Abstract/ui/InputColor",["backbone","./Input","Spectrum","text!./templates/inputColor.html"],function(a,b,c,d){return b.extend({template:_.template(d),initialize:function(a){b.prototype.initialize.apply(this,arguments);var c=this.ppfx;this.colorCls=c+"field-color-picker",this.inputClass=c+"field "+c+"field-color",this.colorHolderClass=c+"field-colorp-c",this.listenTo(this.model,"change:value",this.handleModelChange)},handleModelChange:function(){b.prototype.handleModelChange.apply(this,arguments);var a=this.model.get("value"),c=this.getColorEl();a="none"===a?"#fff":a,c.spectrum("set",a),c.get(0).style.backgroundColor=a},getColorEl:function(){if(!this.colorEl){var a=this.model,b=$("
",{"class":this.colorCls}),c=b.get(0).style,d=this.target&&this.target.config?this.target.config.el:"";b.spectrum({appendTo:d||"body",maxSelectionSize:8,showPalette:!0,showAlpha:!0,chooseText:"Ok",cancelText:"⨯",palette:[],move:function(a){var b=1==a.getAlpha()?a.toHexString():a.toRgbString();c.backgroundColor=b},change:function(b){var d=1==b.getAlpha()?b.toHexString():b.toRgbString();d=d.replace(/ /g,""),c.backgroundColor=d,a.set("value",d)}}),this.colorEl=b}return this.colorEl},render:function(){return b.prototype.render.apply(this,arguments),this.$el.find("."+this.colorHolderClass).html(this.getColorEl()),this}})}),c("StyleManager/view/PropertyColorView",["backbone","./PropertyView","Abstract/ui/InputColor"],function(a,b,c){return b.extend({renderTemplate:function(){},renderInput:function(){if(!this.input){var a=new c({target:this.target,model:this.model,ppfx:this.ppfx});this.input=a.render(),this.$el.append(this.input.$el),this.$input=this.input.inputEl,this.$color=this.input.colorEl}this.setValue(this.componentValue)},setValue:function(a){this.input.setValue(a,{silent:1})}})}),c("text!StyleManager/templates/propertyFile.html",[],function(){return'
\n\t
input-holder\'>\n\t\t
\n\t\t\t\n\t\t
\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t
\n\t
\n
\n
'}),c("StyleManager/view/PropertyFileView",["backbone","./PropertyView","text!./../templates/propertyFile.html"],function(a,b,c){return b.extend({template:_.template(c),initialize:function(a){b.prototype.initialize.apply(this,arguments),this.assets=this.target.get("assets"),this.modal=this.target.get("Modal"),this.am=this.target.get("AssetManager"),this.className=this.className+" "+this.pfx+"file",this.events["click #"+this.pfx+"close"]="removeFile",this.events["click #"+this.pfx+"images"]="openAssetManager",this.delegateEvents()},renderInput:function(){this.$input||(this.$input=$("",{placeholder:this.defaultValue,type:"text"})),this.$preview||(this.$preview=this.$el.find("#"+this.pfx+"preview-file")),this.$previewBox||(this.$previewBox=this.$el.find("#"+this.pfx+"preview-box")),this.componentValue&&this.componentValue!=this.defaultValue?this.setPreviewView(1):this.setPreviewView(0),this.setValue(this.componentValue,0)},setPreviewView:function(a){this.$previewBox&&(a?this.$previewBox.addClass(this.pfx+"show"):this.$previewBox.removeClass(this.pfx+"show"))},spreadUrl:function(a){this.setValue(a),this.setPreviewView(1)},setPreview:function(a){this.$preview&&this.$preview.css("background-image","url("+a+")")},setValue:function(a,c){b.prototype.setValue.apply(this,arguments),this.setPreview(a)},renderTemplate:function(){this.$el.append(this.template({upload:"Upload",assets:"Images",pfx:this.pfx}))},cleanValue:function(){this.setPreviewView(0),this.model.set({value:""},{silent:!0})},removeFile:function(){this.model.set("value",this.defaultValue),b.prototype.cleanValue.apply(this,arguments),this.setPreviewView(0)},openAssetManager:function(a){var b=this;this.modal&&this.am&&(this.modal.setTitle("Select image"),this.modal.setContent(this.am.render()),this.am.setTarget(null),this.modal.open(),this.am.onSelect(function(c){b.modal.close(),b.spreadUrl(c.get("src")),b.valueChanged(a)}))}})}),c("text!StyleManager/templates/propertyComposite.html",[],function(){return'
\n\tinput-holder\'>\n
\n
'}),c("StyleManager/view/PropertyCompositeView",["backbone","./PropertyView","text!./../templates/propertyComposite.html","require"],function(a,b,c,d){return b.extend({template:_.template(c),initialize:function(a){b.prototype.initialize.apply(this,arguments),_.bindAll(this,"build"),this.config=a.config||{},this.className=this.className+" "+this.pfx+"composite"},valueUpdated:function(){this.model.get("detached")||b.prototype.valueUpdated.apply(this,arguments)},renderInput:function(){var a=this.model,b=a.get("properties")||[];if(b.length&&(this.$input||(this.$input=$("",{value:0,type:"hidden"})),this.props||(this.props=a.get("properties")),!this.$props)){this.props.each(function(b,c){b&&"composite"==b.get("type")&&(this.props.remove(b),console.warn("Nested composite types not yet allowed.")),b.parent=a},this);var c=d("./PropertiesView"),e=new c(this.getPropsConfig());this.$props=e.render().$el,this.$el.find("#"+this.pfx+"input-holder").html(this.$props)}},getPropsConfig:function(a){var b=this;return result={config:this.config,collection:this.props,target:this.target,propTarget:this.propTarget,onChange:function(a,c,d){var e=b.build();b.model.set("value",e,d)},customValue:function(a,c){return b.valueOnIndex(c,a)}},this.model.get("detached")&&delete result.onChange,result},getDefaultValue:function(){var a="";return this.props.each(function(b,c){a+=b.get("defaults")+b.get("unit")+" "}),a.replace(/ +$/,"")},valueOnIndex:function(a,b){var c=null,d=this.getComponentValue().split(" ");if(d.length&&d[a]&&(c=d[a],b&&b.model&&b.model.get("functionName"))){var e=this.fetchFromFunction(c);e&&(c=e)}return c},build:function(a,b,c){var d="";return this.model.get("properties").each(function(a){var b=a.getValue();func=a.get("functionName"),func&&(b=func+"("+b+")"),d+=b+" "}),d.replace(/ +$/,"")}})}),c("text!StyleManager/templates/propertyStack.html",[],function(){return"
field <%= pfx %>stack\">\n\t\n\t\n
\n
"}),c("text!StyleManager/templates/layer.html",[],function(){return'
\n \n
\n
<%= label %>
\n
\n\t
\n
\n
\n
\n
'}),c("StyleManager/view/LayerView",["backbone","text!./../templates/layer.html"],function(a,b){return a.View.extend({events:{click:"updateIndex"},template:_.template(b),initialize:function(a){this.stackModel=a.stackModel||{},this.config=a.config||{},this.pfx=this.config.stylePrefix||"",this.className=this.pfx+"layer",this.sorter=a.sorter||null,this.listenTo(this.model,"destroy remove",this.remove),this.listenTo(this.model,"change:value",this.valueChanged),this.listenTo(this.model,"change:props",this.showProps),this.events["click #"+this.pfx+"close-layer"]="remove",this.events["mousedown > #"+this.pfx+"move"]="initSorter",this.model.get("preview")||this.$el.addClass(this.pfx+"no-preview"),this.$el.data("model",this.model),this.delegateEvents()},initSorter:function(a){this.sorter&&this.sorter.startSort(this.el)},getProps:function(){return this.stackModel.get?this.stackModel.get("properties"):null},valueChanged:function(){var a=this.model.get("preview");if(a){this.$preview||(this.$preview=this.$el.find("#"+this.pfx+"preview"));var b=this.getProps(),c=this.$preview;"function"==typeof a?a(b,c):this.onPreview(b,c)}},onPreview:function(a,b){var c=this.model.get("value").split(" "),d=3,e="";if(a.each(function(a,b){var f=c[b]||"";if(f&&"integer"==a.get("type")){var g=parseInt(f,10),h=f.replace(g,"");g=isNaN(g)?0:g,g>d&&(g=d),g<-d&&(g=-d),f=g+h}e+=f+" "}),this.stackModel.get){var f=this.stackModel.get("property");f&&(this.$preview.get(0).style[f]=e)}},showProps:function(){this.$props=this.model.get("props"),this.$el.find("#"+this.pfx+"inputs").html(this.$props.show()),this.model.set({props:null},{silent:!0})},remove:function(b){this.$props&&this.$props.detach(),b&&b.stopPropagation&&b.stopPropagation(),a.View.prototype.remove.apply(this,arguments),this.model.collection.contains(this.model)&&this.model.collection.remove(this.model),this.stackModel&&this.stackModel.set&&(this.stackModel.set({stackIndex:null},{silent:!0}),this.stackModel.trigger("updateValue"))},updateIndex:function(a){var b=this.getIndex();this.stackModel.set("stackIndex",b),this.model.collection&&this.model.collection.trigger("deselectAll"),this.$el.addClass(this.pfx+"active")},getIndex:function(){var a=0,b=this.model;return b.collection&&(a=b.collection.indexOf(b)),a},render:function(){return this.$el.html(this.template({label:"Layer "+this.model.get("index"),pfx:this.pfx})),this.$el.attr("class",this.className),this.valueChanged(),this}})}),c("StyleManager/view/LayersView",["backbone","./LayerView"],function(a,b){return a.View.extend({initialize:function(a){this.config=a.config||{},this.stackModel=a.stackModel,this.preview=a.preview,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.className=this.pfx+"layers "+this.ppfx+"field",this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"deselectAll",this.deselectAll),this.listenTo(this.collection,"reset",this.render);var b=this.config.em||"",c=b?b.get("Utils"):"";this.sorter=c?new c.Sorter({container:this.el,containerSel:"."+this.pfx+"layers",itemSel:"."+this.pfx+"layer",pfx:this.config.pStylePrefix}):"",this.$el.data("model",{}),this.$el.data("collection",this.collection)},addTo:function(a){var b=this.collection.indexOf(a);this.addToCollection(a,null,b)},addToCollection:function(a,c,d){var e=c||null,f=b;"undefined"!=typeof this.preview&&a.set("preview",this.preview);var g=new f({model:a,stackModel:this.stackModel,config:this.config,sorter:this.sorter}),h=g.render().el;if(e)e.appendChild(h);else if("undefined"!=typeof d){var i="before";this.$el.children().length==d&&(d--,i="after"),d<0?this.$el.append(h):this.$el.children().eq(d)[i](h)}else this.$el.append(h);return h},deselectAll:function(){this.$el.find("."+this.pfx+"layer").removeClass(this.pfx+"active")},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.addToCollection(b,a)},this),this.$el.append(a),this.$el.attr("class",this.className),this.sorter&&(this.sorter.plh=null),this}})}),c("StyleManager/view/PropertyStackView",["backbone","./PropertyCompositeView","text!./../templates/propertyStack.html","./../model/Layers","./LayersView"],function(a,b,c,d,e){return b.extend({template:_.template(c),initialize:function(a){b.prototype.initialize.apply(this,arguments),this.model.set("stackIndex",null),this.className=this.pfx+"property "+this.pfx+"stack",this.events["click #"+this.pfx+"add"]="addLayer",this.listenTo(this.model,"change:stackIndex",this.indexChanged),this.listenTo(this.model,"updateValue",this.valueUpdated),this.delegateEvents()},targetUpdated:function(){this.model.get("detached")?(this.checkVisibility(),this.refreshLayers()):b.prototype.targetUpdated.apply(this,arguments)},getLayers:function(){return this.model.get("layers")},indexChanged:function(a){var b=this.model,c=this.getLayers().at(b.get("stackIndex"));c.set("props",this.$props),b.get("properties").each(function(a){a.trigger("targetUpdated")})},getStackValues:function(){return this.getLayers().pluck("value")},getPropsConfig:function(a){var c=this,d=b.prototype.getPropsConfig.apply(this,arguments);return d.onChange=function(a,b,d){var e=b.model,f=c.build();if(c.model.get("detached")){var g="";e.collection.indexOf(e);c.getLayers().each(function(a){var b=a.get("values")[e.get("property")];b&&(g+=(g?",":"")+b)}),b.updateTargetStyle(g,null,d)}else c.model.set("value",f,d)},d},valueOnIndex:function(a,b){var c=null,d=this.model.get("stackIndex");if(this.model.get("detached")){var e=b.getTargetValue(),f=(e+"").split(",");c=f[d],c=c?c.trim():b.getDefaultValue(),c=b.tryFetchFromFunction(c)}else{var g=this.getStackValues(),h=g[d];if(!h)return;var i=h.split(" ");i.length&&i[a]&&(c=i[a])}return c},build:function(){var a=this.model.get("stackIndex");if(null!==a){var c=b.prototype.build.apply(this,arguments),d=this.getLayers().at(a);if(d){var e={};return this.model.get("properties").each(function(a){var b=a.getValue(),c=a.get("functionName");c&&(b=c+"("+b+")"),e[a.get("property")]=b}),d.set("values",e), -d.set("value",c),this.createValue()}}},addLayer:function(a){if(this.getTarget()){var b=this.getLayers(),c=b.add({name:"test"}),d=b.indexOf(c);return c.set("value",this.getDefaultValue()),this.valueUpdated(),this.model.set("stackIndex",d),c}},valueUpdated:function(){var a=this.model;a.get("detached")?a.get("properties").each(function(a){a.trigger("change:value")}):a.set("value",this.createValue())},createValue:function(){return this.getStackValues().join(", ")},renderLayers:function(){return this.$field||(this.$field=this.$el.find("> ."+this.pfx+"field")),this.$layers||(this.$layers=new e({collection:this.getLayers(),stackModel:this.model,preview:this.model.get("preview"),config:this.config})),this.$field.append(this.$layers.render().el),this.$props.hide(),this},renderInput:function(){b.prototype.renderInput.apply(this,arguments),this.refreshLayers()},getLayersFromTarget:function(){var a=[],b=this.getTarget();if(!b)return a;var c=b.get("style");return this.model.get("properties").each(function(b){var d=c[b.get("property")];if(d)for(var e=d.split(","),f=0,g=e.length;f",{"class":"clear"})),this.$el.attr("class",this.pfx+"properties"),this}})}),c("text!StyleManager/templates/sector.html",[],function(){return'
\n \n <%= label %>\n
'}),c("StyleManager/view/SectorView",["backbone","./PropertiesView","text!./../templates/sector.html"],function(a,b,c){return a.View.extend({template:_.template(c),events:{},initialize:function(a){this.config=a.config||{},this.pfx=this.config.stylePrefix||"",this.target=a.target||{},this.propTarget=a.propTarget||{},this.open=this.model.get("open"),this.caretR="fa-caret-right",this.caretD="fa-caret-down",this.listenTo(this.model,"change:open",this.updateOpen),this.listenTo(this.model,"updateVisibility",this.updateVisibility),this.events["click ."+this.pfx+"title"]="toggle",this.delegateEvents()},updateVisibility:function(){var a;this.model.get("properties").each(function(b){b.get("visible")&&(a=1)}),this.el.style.display=a?"block":"none"},updateOpen:function(){this.model.get("open")?this.show():this.hide()},show:function(){this.$el.addClass(this.pfx+"open"),this.$el.find("."+this.pfx+"properties").show(),this.$caret.removeClass(this.caretR).addClass(this.caretD)},hide:function(){this.$el.removeClass(this.pfx+"open"),this.$el.find("."+this.pfx+"properties").hide(),this.$caret.removeClass(this.caretD).addClass(this.caretR)},toggle:function(){var a=this.model.get("open")?0:1;this.model.set("open",a)},render:function(){return this.$el.html(this.template({pfx:this.pfx,label:this.model.get("name")})),this.$caret=this.$el.find("#"+this.pfx+"caret"),this.renderProperties(),this.$el.attr("class",this.pfx+"sector no-select"),this.updateOpen(),this},renderProperties:function(){var a=this.model.get("properties");if(a){var c=new b({collection:a,target:this.target,propTarget:this.propTarget,config:this.config});this.$el.append(c.render().el)}}})}),c("StyleManager/view/SectorsView",["backbone","./SectorView"],function(a,b){return a.View.extend({initialize:function(b){this.config=b.config||{},this.pfx=this.config.stylePrefix||"",this.target=b.target||{},this.propTarget={},_.extend(this.propTarget,a.Events),this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render),this.listenTo(this.target,"change:selectedComponent targetClassAdded targetClassRemoved targetClassUpdated targetStateUpdated targetStyleUpdated change:device",this.targetUpdated)},addTo:function(a){this.addToCollection(a)},targetUpdated:function(){var a=this.target.get("selectedComponent");if(a){var b=this.target.get("Config").devicePreviewMode,c=a.get("classes"),d=this.propTarget,e=this.target.getDeviceModel(),f=b?"":a.get("state"),g=e&&!b&&e.get("width")?"(max-width: "+e.get("width")+")":"";if(d.helper=null,c.length){var h=this.target.get("CssComposer"),i=_.filter(c.models,function(a){return a.get("active")}),j=h.get(i,f,g);if(j||(j=h.add(i,f,g),j.set("style",a.get("style")),a.set("style",{})),f){var k=this.target.get("SelectorManager"),l=k.add("hc-state"),m=h.get([l]);m?(h.getAll().remove(m),h.getAll().add(m)):m=h.add([l]),m.set("style",j.get("style")),d.helper=m}return d.model=j,void d.trigger("update")}d.model=a,d.trigger("update")}},addToCollection:function(a,c){var d=c||null,e=b,f=new e({model:a,id:this.pfx+a.get("name").replace(" ","_").toLowerCase(),name:a.get("name"),properties:a.get("properties"),target:this.target,propTarget:this.propTarget,config:this.config}),g=f.render().el;return d?d.appendChild(g):this.$el.append(g),g},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.addToCollection(b,a)},this),this.$el.attr("id",this.pfx+"sectors"),this.$el.append(a),this}})}),c("StyleManager/main",["require","./config/config","./model/Sectors","./view/SectorsView"],function(a){return function(){var b,c,d={},e=a("./config/config"),f=a("./model/Sectors"),g=a("./view/SectorsView");return{name:"StyleManager",getConfig:function(){return d},init:function(a){d=a||{};for(var h in e)h in d||(d[h]=e[h]);var i=d.pStylePrefix;return i&&(d.stylePrefix=i+d.stylePrefix),b=new f(d.sectors),c=new g({collection:b,target:d.em,config:d}),this},addSector:function(a,c){var d=this.getSector(a);return d||(c.id=a,d=b.add(c)),d},getSector:function(a){var c=b.where({id:a});return c.length?c[0]:null},getSectors:function(){return b},addProperty:function(a,b){var c=null,d=this.getSector(a);return d&&(c=d.get("properties").add(b)),c},getProperty:function(a,b){var c=null,d=this.getSector(a);return d&&(c=d.get("properties").where({property:b}),c=1==c.length?c[0]:c),c},getProperties:function(a){var b=null,c=this.getSector(a);return c&&(b=c.get("properties")),b},getModelToStyle:function(a){var b=a.get("classes");if(d.em&&b&&b.length){var c=d.em.get("Config").devicePreviewMode,e=d.em.getDeviceModel(),f=c?"":a.get("state"),g=e&&!c?e.get("width"):"",h=d.em.get("CssComposer"),i=_.filter(b.models,function(a){return a.get("active")}),j=h.get(i,f,g);if(j)return j}return a},render:function(){return c.render().el}}}}),c("StyleManager",["StyleManager/main"],function(a){return a}),c("AssetManager/model/Asset",["backbone"],function(a){return a.Model.extend({idAttribute:"src",defaults:{type:"",src:""},getFilename:function(){return this.get("src").split("/").pop()},getExtension:function(){return this.getFilename().split(".").pop()}})}),c("AssetManager/model/AssetImage",["backbone","./Asset"],function(a,b){return b.extend({defaults:_.extend({},b.prototype.defaults,{type:"image",unitDim:"px",height:0,width:0})})}),c("AssetManager/model/Assets",["backbone","./Asset","./AssetImage"],function(a,b,c){return a.Collection.extend({model:c,initialize:function(a,b){this.model=function(a,b){var d;switch(a.type){default:d=new c(a,b)}return d}},addImg:function(a,b){return this.add({type:"image",src:a},b),this},add:function(b,c){var d=[];b=b instanceof Array?b:[b];for(var e=0,f=b.length;e\n
\n
\n
\n
\n\t
<%= name %>
\n\t
<%= dim %>
\n
\n
\n
'}),c("AssetManager/view/AssetImageView",["./AssetView","text!./../template/assetImage.html"],function(a,b){return a.extend({events:{click:"handleClick",dblclick:"handleDblClick"},template:_.template(b),initialize:function(b){a.prototype.initialize.apply(this,arguments),this.className+=" "+this.pfx+"asset-image",this.events["click #"+this.pfx+"close"]="removeItem",this.delegateEvents()},handleClick:function(){var a=this.config.onClick,b=this.model;b.collection.trigger("deselectAll"),this.$el.addClass(this.pfx+"highlight"),"function"==typeof a?a(b):this.updateTarget(b.get("src"))},handleDblClick:function(){var a=this.config.onDblClick,b=this.model;"function"==typeof a?a(b):this.updateTarget(b.get("src"));var c=b.collection.onSelect;"function"==typeof c&&c(this.model)},updateTarget:function(a){var b=this.model.collection.target;if(b&&b.set){var c=_.clone(b.get("attributes"));b.set("attributes",c),b.set("src",a)}},removeItem:function(a){a.stopPropagation(),this.model.collection.remove(this.model)},render:function(){var a=this.model.get("name"),b=this.model.get("width")&&this.model.get("height")?this.model.get("width")+" x "+this.model.get("height"):"";return a=a?a:this.model.get("src").split("/").pop(),a=a&&a.length>30?a.substring(0,30)+"...":a,b=b?b+(this.model.get("unitDim")?this.model.get("unitDim"):" px"):"",this.$el.html(this.template({name:a,src:this.model.get("src"),dim:b,pfx:this.pfx,ppfx:this.ppfx})),this.$el.attr("class",this.className),this}})}),c("text!AssetManager/template/fileUploader.html",[],function(){return'
\n\t
<%= title %>
\n\t multiple/>\n\t
\n
'}),c("AssetManager/view/FileUploader",["backbone","text!./../template/fileUploader.html"],function(a,b){return a.View.extend({template:_.template(b),events:{},initialize:function(a){this.options=a||{},this.config=a.config||{},this.pfx=this.config.stylePrefix||"",this.target=this.collection||{},this.uploadId=this.pfx+"uploadFile",this.disabled=!this.config.upload,this.events["change #"+this.uploadId]="uploadFile",this.delegateEvents()},uploadFile:function(a){for(var b=a.dataTransfer?a.dataTransfer.files:a.target.files,c=new FormData,d=0;d\n
\n
\n
\n \n
\n \n
\n
\n \n
\n
\n
\n
\n'}),c("AssetManager/view/AssetsView",["backbone","./AssetView","./AssetImageView","./FileUploader","text!./../template/assets.html"],function(a,b,c,d,e){return a.View.extend({template:_.template(e),initialize:function(a){this.options=a,this.config=a.config,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.collection,"add",this.addToAsset),this.listenTo(this.collection,"deselectAll",this.deselectAll),this.className=this.pfx+"assets",this.events={},this.events.submit="addFromStr",this.delegateEvents()},addFromStr:function(a){a.preventDefault();var b=this.getInputUrl(),c=b.value.trim();if(c)return this.collection.addImg(c,{at:0}),this.getAssetsEl().scrollTop=0,b.value="",this},getAssetsEl:function(){return this.assets=this.el.querySelector("."+this.pfx+"assets"),this.assets},getInputUrl:function(){return this.inputUrl&&this.inputUrl.value||(this.inputUrl=this.el.querySelector("."+this.pfx+"add-asset input")),this.inputUrl},addToAsset:function(a){this.addAsset(a)},addAsset:function(a,d){var e=d||null,f=b;a.get("type").indexOf("image")>-1&&(f=c);var g=new f({model:a,config:this.config}),h=g.render().el;if(e)e.appendChild(h);else{var i=this.getAssetsEl();i&&i.insertBefore(h,i.firstChild)}return h},deselectAll:function(){this.$el.find("."+this.pfx+"highlight").removeClass(this.pfx+"highlight")},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.addAsset(b,a)},this),this.$el.html(this.template({pfx:this.pfx,ppfx:this.ppfx,btnText:this.config.addBtnText})),this.$el.find("."+this.pfx+"assets").append(a),this}})}),c("AssetManager/config/config",[],function(){return{assets:[],stylePrefix:"am-",upload:"http://localhost/assets/upload",uploadText:"Drop files here or click to upload",addBtnText:"Add image"}}),c("AssetManager/main",["require","./model/Assets","./view/AssetsView","./view/FileUploader","./config/config"],function(a){return function(){var b,c,d,e={},f=a("./model/Assets"),g=a("./view/AssetsView"),h=a("./view/FileUploader");return{name:"AssetManager",storageKey:"assets",init:function(i){e=i||{};var j=a("./config/config");for(var k in j)k in e||(e[k]=j[k]);var l=e.pStylePrefix;l&&(e.stylePrefix=l+e.stylePrefix),b=new f(e.assets);var m={collection:b,config:e};return c=new g(m),d=new h(m),this},add:function(a){return b.add(a)},get:function(a){return b.where({src:a})[0]},getAll:function(){return b},remove:function(a){var b=this.get(a);return this.getAll().remove(b),this},store:function(a){var b={},c=JSON.stringify(this.getAll().toJSON());return b[this.storageKey]=c,!a&&e.stm&&e.stm.store(b),b},load:function(a){var b=a||"",c=this.storageKey;!b&&e.stm&&(b=e.stm.load(c));var d=[];try{d=JSON.parse(b[c])}catch(f){}return this.getAll().add(d),d},render:function(a){return this.rendered&&!a||(this.rendered=c.render().$el.add(d.render().$el)),this.rendered},setTarget:function(a){c.collection.target=a},onSelect:function(a){c.collection.onSelect=a},onClick:function(a){e.onClick=a},onDblClick:function(a){e.onDblClick=a}}}}),c("AssetManager",["AssetManager/main"],function(a){return a}),c("CssComposer/config/config",[],function(){return{stylePrefix:"css-",staticRules:"",rules:[]}}),c("CssComposer/model/Selectors",["backbone","require"],function(a,b){return a.Collection.extend({initialize:function(a,c){this.model=function(a,c){var d;return this.ClassTag||(this.ClassTag=b("SelectorManager/model/Selector")),d=new this.ClassTag(a,c)}}})}),c("CssComposer/model/CssRule",["backbone","./Selectors"],function(a,b){return a.Model.extend({defaults:{selectors:{},selectorsAdd:"",style:{},mediaText:"",state:"",stylable:!0},initialize:function(a,c){if(this.config=a||{},this.sm=c?c.sm||{}:{},this.slct=this.config.selectors||[],this.sm.get){for(var d=[],e=0;e=0&&(c.css=d.em.getCss()),e.indexOf("styles")>=0&&(c.styles=JSON.stringify(b)),a||d.stm.store(c),c}},add:function(a,c,d,e){var g=c||"",h=d||"",i=e||{},j=this.get(a,g,h,i);return j?j:(i.state=g,i.mediaText=h,i.selectors="",j=new f(i),j.get("selectors").add(a),b.add(j),j)},get:function(a,c,d,e){var f=null;return b.each(function(b){f||b.compare(a,c,d,e)&&(f=b)}),f},getAll:function(){return b},addCollection:function(a,b){for(var c=b||{},e=[],f=a instanceof Array?a:[a],g=0,h=f.length;g=0&&this.set("void",!0),this.opt=e,this.sm=e?e.sm||{}:{},this.config=a||{},this.defaultC=this.config.components||[],this.defaultCl=this.normalizeClasses(this.get("classes")||this.config.classes||[]),this.components=new b(this.defaultC,e),this.components.parent=this,this.listenTo(this,"change:script",this.scriptUpdated),this.set("attributes",this.get("attributes")||{}),this.set("components",this.components),this.set("classes",new c(this.defaultCl));var f=new d;f.setTarget(this),f.add(this.get("traits")),this.set("traits",f),this.initToolbar();var g=["stylable"];g.forEach(function(a){var b=this.get(a);if("string"==typeof b){var c=b.split(",").map(function(a){return a.trim()});this.set(a,c)}},this),this.init()},init:function(){},scriptUpdated:function(){this.set("scriptUpdated",1)},initToolbar:function(){var a=this;if(!a.get("toolbar")){var b=[];a.get("draggable")&&b.push({attributes:{"class":"fa fa-arrows"},command:"tlb-move"}),a.get("copyable")&&b.push({attributes:{"class":"fa fa-clone"},command:"tlb-clone"}),a.get("removable")&&b.push({attributes:{"class":"fa fa-trash-o"},command:"tlb-delete"}),a.set("toolbar",b)}},loadTraits:function(a){var b=new d;b.setTarget(this),b.add(a),this.set("traits",b)},normalizeClasses:function(a){var b=[];if(this.sm.get){var c=this.sm.get("SelectorManager");if(c)return a.forEach(function(a){var d="";d="string"==typeof a?a:a.name;var e=c.add(d);b.push(e)}),b}},clone:function(a){var b=_.clone(this.attributes),c=this.get("components"),d=this.get("traits"),e=this.get("classes");return b.components=[],b.classes=[],b.traits=[],c.each(function(a,c){b.components[c]=a.clone(1)}),d.each(function(a,c){b.traits[c]=a.clone()}),e.each(function(a,c){b.classes[c]=a.get("name")}),b.status="",b.view="",a&&(this.opt.collection=null),new this.constructor(b,this.opt)},getName:function(){if(!this.name){var a=(this.cid.replace(/\D/g,""),this.get("type")),b=this.get("tagName");b="div"==b?"box":b,b=a?a:b,this.name=b.charAt(0).toUpperCase()+b.slice(1)}return this.name},toHTML:function(a){var b="",c=this,d=c.get("tagName"),e=c.get("void"),f="",g="",h=this.getAttrToHTML();for(var i in h){var j=h[i];g+=void 0!==typeof j&&""!==j?" "+i+'="'+j+'"':""}var k="";return c.get("classes").each(function(a){k+=" "+a.get("name")}),k=""!==k?' class="'+k.trim()+'"':"",_.isEmpty(c.get("style"))||(f=' id="'+c.cid+'" '),b+="<"+d+k+f+g+(e?"/":"")+">"+c.get("content"),c.get("components").each(function(a){b+=a.toHTML()}),e||(b+=""),b},getAttrToHTML:function(){var a=this.get("attributes")||{};return delete a.style,a},toJSON:function(){var b=a.Model.prototype.toJSON.apply(this,arguments),c=this.getScriptString();return c&&(b.script=c),b},getScriptString:function(a){var b=a||this.get("script");if("function"==typeof b){var c=b.toString().trim();c=c.replace(/^function\s?\(\)\s?\{/,""),c=c.replace(/\}$/,""),b=c}return b}},{isComponent:function(a){return{tagName:a.tagName?a.tagName.toLowerCase():""}}})}),c("DomComponents/view/ComponentsView",["backbone","require"],function(a,b){return a.View.extend({initialize:function(a){this.opts=a||{},this.config=a.config||{},this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset",this.render)},addTo:function(a){var b=this.collection.indexOf(a);this.addToCollection(a,null,b);var c=this.config.em;c&&(c.trigger("add:component",a),c.trigger("component:add",a))},addToCollection:function(a,c,d){this.compView||(this.compView=b("./ComponentView"));for(var e=c||null,f=this.compView,g=this.opts.defaultTypes,h=this.opts.componentTypes,i=a.get("type"),j=0;j=0&&(b.html=d.em.getHtml()),c.indexOf("components")>=0&&(b.components=JSON.stringify(d.em.getComponents())),a||d.stm.store(b),b}},getComponent:function(){return b},getWrapper:function(){return this.getComponent()},getComponents:function(){return this.getWrapper().get("components")},addComponent:function(a){return this.getComponents().add(a)},render:function(){return c.render().el},clear:function(){for(var a=this.getComponents(),b=0,c=a.length;b div")},render:function(){return this.$el.attr({"class":this.ppfx+"frame"}),this}})}),c("Canvas/view/CanvasView",["backbone","./FrameView"],function(a,b){return a.View.extend({initialize:function(a){_.bindAll(this,"renderBody","onFrameScroll","clearOff"),this.config=a.config||{},this.em=this.config.em||{},this.ppfx=this.config.pStylePrefix||"",this.className=this.config.stylePrefix+"canvas",this.listenTo(this.em,"change:canvasOffset",this.clearOff),this.frame=new b({model:this.model.get("frame"),config:this.config})},onFrameScroll:function(){var a="px",b=this.frame.el.contentDocument.body;this.toolsEl.style.top="-"+b.scrollTop+a,this.toolsEl.style.left="-"+b.scrollLeft+a,this.em.trigger("canvasScroll")},renderScripts:function(){var a=this.frame,b=this;a.el.onload=function(){function c(d){if(d.length>0){var e=document.createElement("script");e.type="text/javascript",e.src=d.shift(),e.onerror=e.onload=c.bind(null,d),a.el.contentDocument.head.appendChild(e)}else b.renderBody()}var d=b.config.scripts.slice(0);c(d)}},renderBody:function(){var a=this.model.get("frame").get("wrapper"),b=this.config.em;if(a){var c=this.ppfx,d=this.frame.$el.contents().find("body"),e=b.get("CssComposer"),f=b.get("Config");d.append(a.render()).append(e.render());var g=f.protectedCss,h="* {box-sizing: border-box;} body{margin:0;height:auto;background-color:#fff} #wrapper{min-height:100%; overflow:auto}."+c+"dashed :not([contenteditable]) > *[data-highlightable]{outline: 1px dashed rgba(170,170,170,0.7); outline-offset: -2px}."+c+"comp-selected{outline: 3px solid #3b97e3 !important}."+c+"no-select{user-select: none; -webkit-user-select:none; -moz-user-select: none}."+c+"freezed{opacity: 0.5; pointer-events: none}."+c+"no-pointer{pointer-events: none}."+c+"plh-image{background:#f5f5f5; border:none; height:50px; width:50px; display:block; outline:3px solid #ffca6f; cursor:pointer}."+c+"grabbing{cursor: grabbing; cursor: -webkit-grabbing}* ::-webkit-scrollbar-track {background: rgba(0, 0, 0, 0.1)}* ::-webkit-scrollbar-thumb {background: rgba(255, 255, 255, 0.2)}* ::-webkit-scrollbar {width: 10px}"+(f.canvasCss||"");h+=g||"",d.append(""),d.append(this.getJsContainer()),b.trigger("loaded"),this.frame.el.contentWindow.onscroll=this.onFrameScroll,this.frame.udpateOffset();var i=document,j=this.frame.el.contentDocument;j.addEventListener("keydown",function(a){i.dispatchEvent(new KeyboardEvent(a.type,a))}),j.addEventListener("keyup",function(a){i.dispatchEvent(new KeyboardEvent(a.type,a))})}},offset:function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument.body;return{top:b.top+c.scrollTop,left:b.left+c.scrollLeft}},clearOff:function(){this.frmOff=null,this.cvsOff=null},getFrameOffset:function(){return this.frmOff||(this.frmOff=this.offset(this.frame.el)),this.frmOff},getCanvasOffset:function(){return this.cvsOff||(this.cvsOff=this.offset(this.el)),this.cvsOff},getElementPos:function(a){var b=this.getFrameOffset(),c=this.getCanvasOffset(),d=this.offset(a),e=d.top+b.top-c.top,f=d.left+b.left-c.left;return{top:e,left:f,height:a.offsetHeight,width:a.offsetWidth}},getPosition:function(){var a=this.frame.el.contentDocument.body,b=this.getFrameOffset(),c=this.getCanvasOffset();return{top:b.top+a.scrollTop-c.top,left:b.left+a.scrollLeft-c.left}},updateScript:function(a){a.scriptContainer||(a.scriptContainer=$("
"),this.getJsContainer().append(a.scriptContainer.get(0)));var b=a.model.cid,c=a.model.get("script"),d="function(){"+c+"}";d="function"==typeof c?c.toString():d,a.el.id=b,a.scriptContainer.html(""),a.scriptContainer.append('")},getJsContainer:function(){return this.jsContainer||(this.jsContainer=$("
",{"class":this.ppfx+"js-cont"}).get(0)),this.jsContainer},render:function(){if(this.wrapper=this.model.get("wrapper"),this.wrapper&&"function"==typeof this.wrapper.render){this.model.get("frame").set("wrapper",this.wrapper),this.$el.append(this.frame.render().el);var a=this.frame;0===this.config.scripts.length?a.el.onload=this.renderBody:this.renderScripts()}var b=this.ppfx;toolsEl=$("
",{id:b+"tools"}).get(0),this.hlEl=$("
",{"class":b+"highlighter"}).get(0),this.badgeEl=$("
",{"class":b+"badge"}).get(0),this.placerEl=$("
",{"class":b+"placeholder"}).get(0),this.placerIntEl=$("
",{"class":b+"placeholder-int"}).get(0),this.ghostEl=$("
",{"class":b+"ghost"}).get(0),this.toolbarEl=$("
",{"class":b+"toolbar"}).get(0),this.resizerEl=$("
",{"class":b+"resizer"}).get(0),this.offsetEl=$("
",{"class":b+"offset-v"}).get(0),this.fixedOffsetEl=$("
",{"class":b+"offset-fixed-v"}).get(0),this.placerEl.appendChild(this.placerIntEl),toolsEl.appendChild(this.hlEl),toolsEl.appendChild(this.badgeEl),toolsEl.appendChild(this.placerEl),toolsEl.appendChild(this.ghostEl),toolsEl.appendChild(this.toolbarEl),toolsEl.appendChild(this.resizerEl),toolsEl.appendChild(this.offsetEl),toolsEl.appendChild(this.fixedOffsetEl),this.$el.append(toolsEl);var c=this.em.get("rte");return c&&toolsEl.appendChild(c.render()),this.toolsEl=toolsEl,this.$el.attr({"class":this.className}),this}})}),c("Canvas/main",["require","./config/config","./model/Canvas","./view/CanvasView"],function(a){return function(){var b,c={},d=a("./config/config"),e=a("./model/Canvas"),f=a("./view/CanvasView");return{getCanvasView:function(){return f},name:"Canvas",init:function(a){c=a||{};for(var g in d)g in c||(c[g]=d[g]);var h=c.pStylePrefix;h&&(c.stylePrefix=h+c.stylePrefix),b=new e(a),f=new f({model:b,config:c});var i=c.em.get("DomComponents");return i&&this.setWrapper(i),this},setWrapper:function(a){b.set("wrapper",a)},getElement:function(){return f.el},getFrameEl:function(){return f.frame.el},getBody:function(){return f.frame.el.contentDocument.body},getWrapperEl:function(){return this.getBody().querySelector("#wrapper")},getToolsEl:function(){return f.toolsEl},getHighlighter:function(){return f.hlEl},getBadgeEl:function(){return f.badgeEl},getPlacerEl:function(){return f.placerEl},getGhostEl:function(){return f.ghostEl},getToolbarEl:function(){return f.toolbarEl},getResizerEl:function(){return f.resizerEl},getOffsetViewerEl:function(){return f.offsetEl},getFixedOffsetViewerEl:function(){return f.fixedOffsetEl},render:function(){return f.render().el},getOffset:function(){var a=this.offset(this.getFrameEl()),b=this.offset(this.getElement());return{top:a.top-b.top,left:a.left-b.left}},offset:function(a){var b=a.getBoundingClientRect();return{top:b.top+document.body.scrollTop,left:b.left+document.body.scrollLeft}},getElementPos:function(a){return f.getElementPos(a)},getTargetToElementDim:function(a,b,d){var e=d||{},g=f.getPosition(),h=e.elPos||f.getElementPos(b),i=d.toRight||0,j=e.targetHeight||a.offsetHeight,k=e.targetWidth||a.offsetWidth,l=e.event||null,m=h.top-j,n=h.left;n+=i?h.width:0,n=i?n-k:n;var o=nh.top+h.height?h.top+h.height:p;var q={top:p,left:o,elementTop:h.top,elementLeft:h.left,elementWidth:h.width,elementHeight:h.height,targetWidth:a.offsetWidth,targetHeight:a.offsetHeight,canvasTop:g.top,canvasLeft:g.left};return l&&c.em&&c.em.trigger(l,q),q},getMouseRelativePos:function(a,b){var c=b||{},d=0,e=0,f=c.subWinOffset,g=a.target.ownerDocument,h=g.defaultView||g.parentWindow,i=h.frameElement,j=f?h.pageYOffset:0,k=f?h.pageXOffset:0;if(i){var l=i.getBoundingClientRect();d=l.top||0,e=l.left||0}return{y:a.clientY+d-j,x:a.clientX+e-k}},getMouseRelativeCanvas:function(a,b){var c=this.getFrameEl(),d=this.getBody(),e=c.offsetTop||0,f=c.offsetLeft||0,g=d.scrollTop||0,h=d.scrollLeft||0;return{y:a.clientY+e+g,x:a.clientX+f+h}},getFrameWrapperEl:function(){return f.frame.getWrapper()}}}}),c("Canvas",["Canvas/main"],function(a){return a}),c("Commands/config/config",[],function(){return{ESCAPE_KEY:27,stylePrefix:"com-",defaults:[],em:null,firstCentered:!0,newFixedH:!1,minComponentH:50,minComponentW:50}}),c("Commands/view/CommandAbstract",["backbone"],function(a){return a.View.extend({initialize:function(a){this.config=a||{},this.editorModel=this.em=this.config.em||{},this.pfx=this.config.stylePrefix,this.ppfx=this.config.pStylePrefix,this.hoverClass=this.pfx+"hover",this.badgeClass=this.pfx+"badge",this.plhClass=this.pfx+"placeholder",this.freezClass=this.ppfx+"freezed",this.canvas=this.em.get&&this.em.get("Canvas"),this.em.get&&this.setElement(this.getCanvas()),this.canvas&&(this.$canvas=this.$el,this.$wrapper=$(this.getCanvasWrapper()),this.frameEl=this.canvas.getFrameEl(),this.canvasTool=this.getCanvasTools(),this.bodyEl=this.getCanvasBody()),this.init(this.config)},onFrameScroll:function(a){},getCanvas:function(){return this.canvas.getElement()},getCanvasBody:function(){return this.canvas.getBody()},getCanvasWrapper:function(){return this.canvas.getWrapperEl()},getCanvasTools:function(){return this.canvas.getToolsEl()},offset:function(a){var b=a.getBoundingClientRect();return{top:b.top+a.ownerDocument.body.scrollTop,left:b.left+a.ownerDocument.body.scrollLeft}},init:function(a){},run:function(a,b){},stop:function(a,b){}})}),c("Abstract/view/DomainViews",["backbone"],function(a){return a.View.extend({itemView:"",itemsView:"",itemType:"type",initialize:function(a,b){this.config=b||{}},addTo:function(a){ -this.add(a)},add:function(a,b){var c=b||null,d=this.itemView,e=a.get(this.itemType);this.itemsView&&this.itemsView[e]&&(d=this.itemsView[e]);var f=new d({model:a,config:this.config},this.config),g=f.render().el;c?c.appendChild(g):this.$el.append(g)},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.length&&this.collection.each(function(b){this.add(b,a)},this),this.$el.append(a),this}})}),c("DomComponents/view/ToolbarButtonView",["backbone"],function(a){return a.View.extend({events:{mousedown:"handleClick"},attributes:function(){return this.model.get("attributes")},initialize:function(a){this.editor=a.config.editor},handleClick:function(){var a=this.model.get("command");"function"==typeof a&&a(this.editor),"string"==typeof a&&this.editor.runCommand(a)},render:function(){var a=this.editor.getConfig();return this.el.className+=" "+a.stylePrefix+"toolbar-item",this}})}),c("DomComponents/view/ToolbarView",["backbone","Abstract/view/DomainViews","./ToolbarButtonView"],function(a,b,c){return b.extend({itemView:c,initialize:function(a){this.config={editor:a.editor||""},this.listenTo(this.collection,"reset",this.render)}})}),c("DomComponents/model/ToolbarButton",["backbone"],function(a){return a.Model.extend({defaults:{command:"",attributes:{}}})}),c("DomComponents/model/Toolbar",["backbone","./ToolbarButton"],function(a,b){return a.Collection.extend({model:b})}),c("Commands/view/SelectComponent",["require","DomComponents/view/ToolbarView","DomComponents/model/Toolbar"],function(a){var b=a("DomComponents/view/ToolbarView"),c=a("DomComponents/model/Toolbar");return{init:function(a){_.bindAll(this,"onHover","onOut","onClick","onKeyPress")},enable:function(){_.bindAll(this,"copyComp","pasteComp","onFrameScroll"),this.frameOff=this.canvasOff=this.adjScroll=null;var a=this.config.em.get("Config");this.startSelectComponent(),this.toggleClipboard(a.copyPaste);var b=this.config.em;b.on("component:update",this.updateAttached,this),b.on("change:canvasOffset",this.updateAttached,this),b.on("change:selectedComponent",this.updateToolbar,this)},toggleClipboard:function(a){var b=a||0;b?(key("⌘+c, ctrl+c",this.copyComp),key("⌘+v, ctrl+v",this.pasteComp)):(key.unbind("⌘+c, ctrl+c"),key.unbind("⌘+v, ctrl+v"))},copyComp:function(){var a=this.editorModel.get("selectedComponent");a&&a.get("copyable")&&this.editorModel.set("clipboard",a)},pasteComp:function(){var a=this.editorModel.get("clipboard"),b=this.editorModel.get("selectedComponent");if(a&&b&&b.collection){var c=b.collection.indexOf(b),d=a.clone();b.collection.add(d,{at:c+1})}},getCanvasBodyEl:function(){return this.$bodyEl||(this.$bodyEl=$(this.getCanvasBody())),this.$bodyEl},startSelectComponent:function(){this.toggleSelectComponent(1)},stopSelectComponent:function(){this.toggleSelectComponent()},toggleSelectComponent:function(a){var b="*",c=a?"on":"off";this.getCanvasBodyEl()[c]("mouseover",b,this.onHover)[c]("mouseout",b,this.onOut)[c]("click",b,this.onClick);var d=this.getContentWindow();d[c]("scroll",this.onFrameScroll),d[c]("keydown",this.onKeyPress)},onKeyPress:function(a){var b=a.which||a.keyCode,c=this.editorModel.get("selectedComponent"),d="BODY"!==this.frameEl.contentDocument.activeElement.tagName;if((8==b||46==b)&&(d||a.preventDefault(),c&&!d)){if(!c.get("removable"))return;c.set("status",""),c.destroy(),this.hideBadge(),this.clean(),this.hideHighlighter(),this.editorModel.set("selectedComponent",null)}},onHover:function(a){a.stopPropagation();var b=a.target;this.adjScroll||(this.adjScroll=1,this.onFrameScroll(a),this.updateAttached());var c=this.getElementPos(b);this.updateBadge(b,c),this.updateHighlighter(b,c),this.showElementOffset(b,c)},onOut:function(a){a.stopPropagation(),this.hideBadge(),this.hideHighlighter(),this.hideElementOffset()},showElementOffset:function(a,b){var c=$(a),d=c.data("model");d&&"selected"==d.get("status")||this.editor.runCommand("show-offset",{el:a,elPos:b})},hideElementOffset:function(a,b){this.editor.stopCommand("show-offset")},showFixedElementOffset:function(a,b){this.editor.runCommand("show-offset",{el:a,elPos:b,state:"Fixed"})},hideFixedElementOffset:function(a,b){this.editor&&this.editor.stopCommand("show-offset",{state:"Fixed"})},hideHighlighter:function(){this.canvas.getHighlighter().style.display="none"},onClick:function(a){var b=$(a.target).data("model");if(b){var c=b.get("stylable");(c instanceof Array||c)&&this.onSelect(a,a.target)}},updateBadge:function(a,b){var c=$(a);this.cacheEl=a;var d=c.data("model");if(d&&d.get("badgable")){var e=this.getBadge();e.innerHTML=d.getName();var f=e.style,g="px";f.display="block";var h=this.canvas.getCanvasView().getPosition(),i=e?e.offsetHeight:0,j=e?e.offsetWidth:0,k=b.top-i"),e=this.codeMirror.clone().set({label:c,codeName:a,theme:b,input:d[0]}),f=new this.cm.EditorView({model:e,config:this.cm.getConfig()}).render().$el;return e.init(d[0]),{el:e,$el:f}},enable:function(){if(!this.$editors){var a=this.buildEditor("htmlmixed","hopscotch","HTML"),b=this.buildEditor("css","hopscotch","CSS");this.htmlEditor=a.el,this.cssEditor=b.el,this.$editors=$("
",{"class":this.pfx+"export-dl"}),this.$editors.append(a.$el).append(b.$el)}this.modal&&(this.modal.setTitle("Export template"),this.modal.setContent(this.$editors),this.modal.open());var c=this.protCss||"";this.htmlEditor.setContent(this.em.getHtml()),this.cssEditor.setContent(c+this.cm.getCode(this.wrapper,"css",this.cssc)),this.sender&&this.sender.set("active",!1)},stop:function(){}}}),c("Commands/view/SwitchVisibility",[],function(){return{run:function(a){a.Canvas.getBody().className=this.ppfx+"dashed"},stop:function(a){a.Canvas.getBody().className=""}}}),c("Navigator/config/config",[],function(){return{stylePrefix:"nv-",sortable:1,hidable:1,hideTextnode:1,containerId:"navigator",itemClass:"item",itemsClass:"items"}}),c("text!Navigator/template/item.html",[],function(){return'<% if (hidable) { %>\n\t\n<% } %>\n\n
\n
\n \t\n\t\t\n\t\t\n
\n
\n\n
<%= (count ? count : \'\') %>
\n\n
\n\t\n
\n\n
\n'}),c("Navigator/view/ItemView",["backbone","text!./../template/item.html","require"],function(a,b,c){return a.View.extend({template:_.template(b),initialize:function(a){this.opt=a,this.config=a.config,this.em=a.config.em,this.ppfx=this.em.get("Config").stylePrefix,this.sorter=a.sorter||{},this.pfx=this.config.stylePrefix,"undefined"==typeof this.model.get("open")&&this.model.set("open",!1),this.listenTo(this.model.components,"remove add change reset",this.checkChildren),this.listenTo(this.model,"destroy remove",this.remove),this.listenTo(this.model,"change:status",this.updateStatus),this.listenTo(this.model,"change:open",this.updateOpening),this.className=this.pfx+"item no-select",this.editBtnCls=this.pfx+"nav-item-edit",this.inputNameCls=this.ppfx+"nav-comp-name",this.caretCls=this.ppfx+"nav-item-caret",this.titleCls=this.pfx+"title",this.customNameProp="custom-name",this.events={},this.events["click > #"+this.pfx+"btn-eye"]="toggleVisibility",this.events["click ."+this.caretCls]="toggleOpening",this.events["click ."+this.titleCls]="handleSelect",this.events["click ."+this.editBtnCls]="handleEdit",this.events["blur ."+this.inputNameCls]="handleEditEnd",this.$el.data("model",this.model),this.$el.data("collection",this.model.get("components")),a.config.sortable&&(this.events["mousedown > #"+this.pfx+"move"]="startSort"),this.delegateEvents()},handleEdit:function(a){a.stopPropagation();var b=this.getInputName();b.readOnly=!1,b.focus()},handleEditEnd:function(a){a.stopPropagation();var b=this.getInputName();b.readOnly=!0,this.model.set(this.customNameProp,b.value)},getInputName:function(){return this.inputName||(this.inputName=this.el.querySelector("."+this.inputNameCls)),this.inputName},updateOpening:function(){var a=this.opt.opened||{},b=this.model;b.get("open")?(this.$el.addClass("open"),this.$caret.addClass("fa-chevron-down"),a[b.cid]=b):(this.$el.removeClass("open"),this.$caret.removeClass("fa-chevron-down"),delete a[b.cid])},toggleOpening:function(a){a.stopPropagation(),this.model.components.length&&this.model.set("open",!this.model.get("open"))},handleSelect:function(a){a.stopPropagation();var b=this.em;if(b){var c=b.get("selectedComponent");c&&c.set("status",""),this.model.set("status","selected"),b.set("selectedComponent",this.model)}},startSort:function(a){this.sorter&&this.sorter.startSort(a.target)},freeze:function(){this.$el.addClass(this.pfx+"opac50"),this.model.set("open",0)},unfreeze:function(){this.$el.removeClass(this.pfx+"opac50")},updateStatus:function(a){var b=this.model.get("status"),c=this.pfx+"selected",d=this.$el;switch(b){case"selected":d.addClass(c);break;case"moving":break;default:d.removeClass(c)}},toggleVisibility:function(a){this.$eye||(this.$eye=this.$el.find("> #"+this.pfx+"btn-eye"));var b=_.clone(this.model.get("style")),c=this.pfx+"hide";this.isVisible()?(this.$el.addClass(c),this.$eye.addClass("fa-eye-slash"),b.display="none"):(this.$el.removeClass(c),this.$eye.removeClass("fa-eye-slash"),delete b.display),this.model.set("style",b)},isVisible:function(){var a=this.model.get("style"),b=a.display;if(!b||"none"!=b)return 1},checkChildren:function(){var a=this.countChildren(this.model),b=this.pfx,c="> ."+b+"title-c > ."+b+"title";this.$counter||(this.$counter=this.$el.find("> #"+b+"counter")),a?(this.$el.find(c).removeClass(b+"no-chld"),this.$counter.html(a)):(this.$el.find(c).addClass(b+"no-chld"),this.$counter.empty(),this.model.set("open",0))},countChildren:function(a){var b=0;return a.components.each(function(a){var c=this.opt.isCountable,d=this.config.hideTextnode;c&&!c(a,d)||b++},this),b},render:function(){var a=this.pfx,b=this.isVisible(),d=this.countChildren(this.model);return this.$el.html(this.template({title:this.model.get(this.customNameProp)||this.model.getName(),addClass:d?"":a+"no-chld",editBtnCls:this.editBtnCls,inputNameCls:this.inputNameCls,caretCls:this.caretCls,count:d,visible:b,hidable:this.config.hidable,prefix:a,ppfx:this.ppfx})),"undefined"==typeof ItemsView&&(ItemsView=c("./ItemsView")),this.$components=new ItemsView({collection:this.model.components,config:this.config,sorter:this.sorter,opened:this.opt.opened,parent:this.model}).render().$el,this.$el.find("."+a+"children").html(this.$components),this.$caret=this.$el.find("> ."+a+"title-c > ."+a+"title > #"+a+"caret"),this.model.get("draggable")&&this.config.sortable||this.$el.find("> #"+a+"move").detach(),b||(this.className+=" "+a+"hide"),this.$el.attr("class",_.result(this,"className")),this.updateOpening(),this.updateStatus(),this}})}),c("Navigator/view/ItemsView",["backbone","./ItemView"],function(a,b){return a.View.extend({initialize:function(a){if(this.opt=a,this.config=a.config,this.preview=a.preview,this.ppfx=a.config.pStylePrefix||"",this.pfx=a.config.stylePrefix||"",this.parent=a.parent,this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset resetNavigator",this.render),this.className=this.pfx+"items",this.config.sortable&&!this.opt.sorter){var b=this.pfx,c=this.config.em.get("Utils");this.opt.sorter=new c.Sorter({container:this.el,containerSel:"."+b+"items",itemSel:"."+b+"item",ppfx:this.ppfx,pfx:b,nested:1})}this.sorter=this.opt.sorter||"",this.parent||(this.className+=" "+this.pfx+this.config.containerId),this.$el.data("collection",this.collection)},addTo:function(a){var b=this.collection.indexOf(a);this.addToCollection(a,null,b)},addToCollection:function(a,c,d){var e=c||null,f=b,g=new f({model:a,config:this.config,sorter:this.sorter,isCountable:this.isCountable,opened:this.opt.opened}),h=g.render().el;if(e)e.appendChild(h);else if("undefined"!=typeof d){var i="before";this.$el.children().length==d&&(d--,i="after"),d<0?this.$el.append(h):this.$el.children().eq(d)[i](h)}else this.$el.append(h);return h},isCountable:function(a,b){var c=a.get("type"),d=a.get("tagName");return("textnode"!=c&&"br"!=d||!b)&&!a.get("hiddenLayer")},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.isCountable(b,this.config.hideTextnode)&&this.addToCollection(b,a)},this),this.$el.append(a),this.$el.attr("class",_.result(this,"className")),this}})}),c("Navigator/main",["require","./config/config","./view/ItemsView"],function(a){function b(b,c){var d=c,e=a("./config/config"),f=a("./view/ItemsView");for(var g in e)g in d||(d[g]=e[g]);var h={collection:b,config:d,opened:c.opened||{}};this.ItemsView=new f(h)}return b.prototype={render:function(){return this.ItemsView.render().$el}},b}),c("Navigator",["Navigator/main"],function(a){return a}),c("Commands/view/OpenLayers",["Navigator"],function(a){return{run:function(b,c){if(!this.$layers){var d=b.DomComponents.getComponent().get("components"),e=b.getConfig(),f=b.Panels,g=e.layers.stylePrefix||"nv-";e.layers.stylePrefix=e.stylePrefix+g,e.layers.pStylePrefix=e.stylePrefix,e.layers.em=b.editor,e.layers.opened=b.editor.get("opened");var h=new a(d,e.layers);this.$layers=h.render(),f.getPanel("views-container")?this.panel=f.getPanel("views-container"):this.panel=f.addPanel({id:"views-container"}),this.panel.set("appendContent",this.$layers).trigger("change:appendContent")}this.$layers.show()},stop:function(){this.$layers&&this.$layers.hide()}}}),c("Commands/view/OpenStyleManager",["StyleManager"],function(a){return{run:function(a,b){if(this.sender=b,!this.$cn){var c=a.getConfig(),d=a.Panels;this.$cn=$("
"),this.$cn2=$("
"),this.$cn.append(this.$cn2);var e=a.DeviceManager;if(e&&c.showDevices){var f=d.addPanel({id:"devices-c"});f.set("appendContent",e.render()).trigger("change:appendContent")}var g=a.SelectorManager;g&&this.$cn2.append(g.render([])),this.$cn2.append(a.StyleManager.render());var h=a.StyleManager.getConfig();this.$header=$("
",{"class":h.stylePrefix+"header",text:h.textNoElement}),this.$cn.append(this.$header),d.getPanel("views-container")?this.panel=d.getPanel("views-container"):this.panel=d.addPanel({id:"views-container"}),this.panel.set("appendContent",this.$cn).trigger("change:appendContent"),this.target=a.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()}}}),c("Commands/view/OpenTraitManager",[],function(){return{run:function(a,b){var c=a.Config,d=c.stylePrefix,e=a.TraitManager;if(!this.obj){var f=e.getTraitsViewer(),g=e.getConfig();this.obj=$("
").append('
'+g.labelContainer+"
").get(0),this.obj.appendChild(f.render().el);var h=a.Panels;h.getPanel("views-container")?panelC=h.getPanel("views-container"):panelC=h.addPanel({id:"views-container"}),panelC.set("appendContent",this.obj).trigger("change:appendContent")}this.obj.style.display="block"},stop:function(){this.obj&&(this.obj.style.display="none")}}}),c("Commands/view/OpenBlocks",[],function(){return{run:function(a,b){var c=a.Config,d=(c.stylePrefix,a.BlockManager);if(!this.blocks){this.blocks=$("
").get(0),this.blocks.appendChild(d.render());var e=a.Panels;e.getPanel("views-container")?panelC=e.getPanel("views-container"):panelC=e.addPanel({id:"views-container"}),panelC.set("appendContent",this.blocks).trigger("change:appendContent")}this.blocks.style.display="block"},stop:function(){this.blocks&&(this.blocks.style.display="none")}}}),c("Commands/view/OpenAssets",[],function(){return{run:function(a,b,c){var d=c||{},e=(a.getConfig(),a.Modal),f=a.AssetManager;f.onClick(d.onClick),f.onDblClick(d.onDblClick),f.setTarget(d.target),f.onSelect(d.onSelect),e.setTitle(d.modalTitle||"Select image"),e.setContent(f.render()),e.open()}}}),c("Commands/view/ShowOffset",[],function(){return{getOffsetMethod:function(a){var b=a||"";return"get"+b+"OffsetViewerEl"},run:function(a,b,c){var d=c||{},e=d.state||"",f=a.getConfig();if(f.showOffsets&&(f.showOffsetsSelected||"Fixed"!=e)){var g=a.Canvas,h=d.el||"",i=d.elPos||g.getElementPos(h),j=window.getComputedStyle(h),k=this.ppfx,l=e+"State",m=this.getOffsetMethod(e),n=g[m]();n.style.display="block";var o=this["marginT"+e],p=this["marginB"+e],q=this["marginL"+e],r=this["marginR"+e],s=this["padT"+e],t=this["padB"+e],u=this["padL"+e],v=this["padR"+e];if(!this[l]){var w=e.toLowerCase(),x=w+"margin-v",y=w+"padding-v",z=$("
",{"class":k+x}).get(0),A=$("
",{"class":k+y}).get(0),B=k+x+"-el",C=k+y+"-el";o=$("
",{"class":k+x+"-top "+B}).get(0),p=$("
",{"class":k+x+"-bottom "+B}).get(0),q=$("
",{"class":k+x+"-left "+B}).get(0),r=$("
",{"class":k+x+"-right "+B}).get(0),s=$("
",{"class":k+y+"-top "+C}).get(0),t=$("
",{"class":k+y+"-bottom "+C}).get(0),u=$("
",{"class":k+y+"-left "+C}).get(0),v=$("
",{"class":k+y+"-right "+C}).get(0),this["marginT"+e]=o,this["marginB"+e]=p,this["marginL"+e]=q,this["marginR"+e]=r,this["padT"+e]=s,this["padB"+e]=t,this["padL"+e]=u,this["padR"+e]=v,z.appendChild(o),z.appendChild(p),z.appendChild(q),z.appendChild(r),A.appendChild(s),A.appendChild(t),A.appendChild(u),A.appendChild(v),n.appendChild(z),n.appendChild(A),this[l]="1"}var D="px",E=j.marginLeft.replace(D,""),F=parseInt(j.marginTop.replace(D,"")),G=parseInt(j.marginBottom.replace(D,"")),H=o.style,I=p.style,J=q.style,K=r.style,L=s.style,M=t.style,N=u.style,O=v.style,P=parseInt(i.left);H.height=j.marginTop,H.width=j.width,H.top=i.top-j.marginTop.replace(D,"")+D,H.left=P+D,I.height=j.marginBottom,I.width=j.width,I.top=i.top+i.height+D,I.left=P+D;var Q=i.height+F+G+D,R=i.top-F+D;J.height=Q,J.width=j.marginLeft,J.top=R,J.left=P-E+D,K.height=Q,K.width=j.marginRight,K.top=R,K.left=P+i.width+D;var S=parseInt(j.paddingTop.replace(D,""));L.height=j.paddingTop,L.width=j.width,L.top=i.top+D,L.left=P+D;var T=parseInt(j.paddingBottom.replace(D,""));M.height=j.paddingBottom,M.width=j.width,M.top=i.top+i.height-T+D,M.left=P+D;var U=i.height-T-S+D,V=i.top+S+D;N.height=U,N.width=j.paddingLeft,N.top=V,N.left=i.left+D;var W=parseInt(j.paddingRight.replace(D,""));O.height=U,O.width=j.paddingRight,O.top=V,O.left=i.left+i.width-W+D}},stop:function(a,b,c){var d=c||{},e=d.state||"",f=this.getOffsetMethod(e),g=a.Canvas,h=g[f]();h.style.display="none"}}}),c("Commands/view/Fullscreen",[],function(){return{isEnabled:function(){var a=document;return a.fullscreenElement||a.webkitFullscreenElement||a.mozFullScreenElement?1:0},enable:function(a){var b="";return a.requestFullscreen?a.requestFullscreen():a.webkitRequestFullscreen?(b="webkit",a.webkitRequestFullscreen()):a.mozRequestFullScreen?(b="moz",a.mozRequestFullScreen()):a.msRequestFullscreen?a.msRequestFullscreen():console.warn("Fullscreen not supported"),b},disable:function(){var a=document;a.exitFullscreen?a.exitFullscreen():a.webkitExitFullscreen?a.webkitExitFullscreen():a.mozCancelFullScreen?a.mozCancelFullScreen():a.msExitFullscreen&&a.msExitFullscreen()},fsChanged:function(a,b){var c=(document,(a||"")+"fullscreenchange");this.isEnabled()||(this.stop(null,this.sender),document.removeEventListener(c,this.fsChanged))},run:function(a,b){this.sender=b;var c=this.enable(a.getContainer());this.fsChanged=this.fsChanged.bind(this,c), -document.addEventListener(c+"fullscreenchange",this.fsChanged),a&&a.trigger("change:canvasOffset")},stop:function(a,b){b&&b.set&&b.set("active",!1),this.disable(),a&&a.trigger("change:canvasOffset")}}}),c("Commands/view/Preview",[],function(){return{getPanels:function(a){return this.panels||(this.panels=a.Panels.getPanelsEl()),this.panels},tglPointers:function(a,b){var c=a.Canvas.getBody().querySelectorAll("."+this.ppfx+"no-pointer");_.each(c,function(a){a.style.pointerEvents=b?"":"all"})},run:function(a,b){b&&b.set&&b.set("active",!1),a.stopCommand("sw-visibility");var c=this,d=this.getPanels(a),e=a.Canvas.getElement(),f=a.getEl(),g=a.Config.stylePrefix;this.helper||(this.helper=document.createElement("span"),this.helper.className=g+"off-prv fa fa-eye-slash",f.appendChild(this.helper),this.helper.onclick=function(){c.stop(a)}),this.helper.style.display="inline-block",this.tglPointers(a),d.style.display="none";var h=e.style;h.width="100%",h.height="100%",h.top="0",h.left="0",h.padding="0",h.margin="0",a.trigger("change:canvasOffset")},stop:function(a,b){var c=this.getPanels(a);a.runCommand("sw-visibility"),a.getModel().runDefault(),c.style.display="block";var d=a.Canvas.getElement();d.setAttribute("style",""),this.helper&&(this.helper.style.display="none"),a.trigger("change:canvasOffset"),this.tglPointers(a,1)}}}),c("Commands/view/Resize",[],function(){return{run:function(a,b,c){var d=c&&c.el||"",e=a.Canvas,f=this.canvasResizer,g=c.options||{};if(!f){var h=e.getCanvasView();g.ratioDefault=1,g.appendTo=e.getResizerEl(),g.prefix=a.getConfig().stylePrefix,g.posFetcher=h.getElementPos.bind(h),g.mousePosFetcher=e.getMouseRelativePos,this.canvasResizer=a.Utils.Resizer.init(g),f=this.canvasResizer}f.setOptions(g),f.focus(d)},stop:function(){this.canvasResizer&&this.canvasResizer.blur()}}}),c("Commands/main",["require","./config/config","./view/CommandAbstract","./view/SelectComponent","./view/CreateComponent","./view/DeleteComponent","./view/ImageComponent","./view/MoveComponent","./view/TextComponent","./view/InsertCustom","./view/ExportTemplate","./view/SwitchVisibility","./view/OpenLayers","./view/OpenStyleManager","./view/OpenTraitManager","./view/OpenBlocks","./view/OpenAssets","./view/ShowOffset","./view/Fullscreen","./view/Preview","./view/Resize"],function(a){return function(){var b={},c={},d={},e=a("./config/config"),f=a("./view/CommandAbstract"),g=function(a,b){return delete b.initialize,c[a]=f.extend(b),this};return{name:"Commands",init:function(c){b=c||{};for(var f in e)f in b||(b[f]=e[f]);var g=b.pStylePrefix;g&&(b.stylePrefix=g+b.stylePrefix);for(var h in b.defaults){var i=b.defaults[h];i.id&&this.add(i.id,i)}return d["select-comp"]=a("./view/SelectComponent"),d["create-comp"]=a("./view/CreateComponent"),d["delete-comp"]=a("./view/DeleteComponent"),d["image-comp"]=a("./view/ImageComponent"),d["move-comp"]=a("./view/MoveComponent"),d["text-comp"]=a("./view/TextComponent"),d["insert-custom"]=a("./view/InsertCustom"),d["export-template"]=a("./view/ExportTemplate"),d["sw-visibility"]=a("./view/SwitchVisibility"),d["open-layers"]=a("./view/OpenLayers"),d["open-sm"]=a("./view/OpenStyleManager"),d["open-tm"]=a("./view/OpenTraitManager"),d["open-blocks"]=a("./view/OpenBlocks"),d["open-assets"]=a("./view/OpenAssets"),d["show-offset"]=a("./view/ShowOffset"),d.fullscreen=a("./view/Fullscreen"),d.preview=a("./view/Preview"),d.resize=a("./view/Resize"),d["tlb-delete"]={run:function(a){var b=a.getSelected();return b&&b.get("removable")?(b.set("status",""),b.destroy(),a.trigger("component:update",b),void a.editor.set("selectedComponent",null)):void console.warn("The element is not removable")}},d["tlb-clone"]={run:function(a){var b=a.getSelected();if(!b||!b.get("copyable"))return void console.warn("The element is not clonable");var c=b.collection,d=c.indexOf(b);c.add(b.clone(),{at:d+1}),a.trigger("component:update",b)}},d["tlb-move"]={run:function(a){var b=a.getSelected();if(!b||!b.get("draggable"))return void console.warn("The element is not draggable");var c=a.Canvas.getToolbarEl(),d=a.Commands.get("move-comp");d.onEndMoveFromModel=function(){a.editor.runDefault(),a.editor.set("selectedComponent",b),a.trigger("component:update",b)},a.editor.stopDefault(),d.initSorterFromModel(b),b.set("status","selected"),c.style.display="none"}},b.em&&(b.model=b.em.get("Canvas")),this},onLoad:function(){this.loadDefaultCommands()},add:g,get:function(a){var d=c[a];return"function"==typeof d&&(d=new d(b),c[a]=d),d},has:function(a){return!!c[a]},loadDefaultCommands:function(){for(var a in d)this.add(a,d[a]);return this}}}}),c("Commands",["Commands/main"],function(a){return a}),c("BlockManager/config/config",[],function(){return{blocks:[]}}),c("BlockManager/model/Block",["backbone"],function(a){return a.Model.extend({defaults:{label:"",content:"",attributes:{}}})}),c("BlockManager/model/Blocks",["backbone","./Block"],function(a,b){return a.Collection.extend({model:b})}),c("BlockManager/view/BlockView",["backbone"],function(a){return a.View.extend({events:{mousedown:"onDrag"},initialize:function(a,b){_.bindAll(this,"onDrop"),this.config=b||{},this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.model,"destroy",this.remove),this.doc=$(document)},onDrag:function(a){if(this.config.getSorter){this.config.em.refreshCanvas();var b=this.config.getSorter();b.setDragHelper(this.el,a),b.startSort(this.el),b.setDropContent(this.model.get("content")),this.doc.on("mouseup",this.onDrop)}},onDrop:function(){this.doc.off("mouseup",this.onDrop),this.config.getSorter().endMove()},render:function(){var a=this.ppfx+"block";return this.$el.addClass(a),this.el.innerHTML='
'+this.model.get("label")+"
",this}})}),c("BlockManager/view/BlocksView",["backbone","./BlockView"],function(a,b){return a.View.extend({initialize:function(a,b){_.bindAll(this,"getSorter","onDrag","onDrop"),this.config=b||{},this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.collection,"add",this.addTo),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 a=this.em.get("Utils"),b=this.canvas;this.sorter=new a.Sorter({container:b.getBody(),placer:b.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,onStart:this.onDrag,onEndMove:this.onDrop,document:b.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1,em:this.em,canvasRelative:1})}return this.sorter}},onDrag:function(){this.em.stopDefault()},onDrop:function(a){this.em.runDefault(),a&&a.get&&(a.get("activeOnRender")&&(a.trigger("active"),a.set("activeOnRender",0)),this.em.initChildrenComp(a))},addTo:function(a){this.add(a)},add:function(a,c){var d=c||null,e=new b({model:a,attributes:a.get("attributes")},this.config),f=e.render().el;d?d.appendChild(f):this.$el.append(f)},render:function(){var a=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(b){this.add(b,a)},this),this.$el.append(a),this.$el.addClass(this.ppfx+"blocks-c"),this}})}),c("BlockManager/main",["require","./config/config","./model/Blocks","./view/BlocksView"],function(a){return function(){var b,c,d={},e=a("./config/config"),f=a("./model/Blocks"),g=a("./view/BlocksView");return{name:"BlockManager",init:function(a){d=a||{};for(var h in e)h in d||(d[h]=e[h]);return b=new f(d.blocks),c=new g({collection:b},d),this},add:function(a,c){var d=c||{};return d.id=a,b.add(d)},get:function(a){return b.get(a)},getAll:function(){return b},render:function(){return c.render().el}}}}),c("BlockManager",["BlockManager/main"],function(a){return a}),c("TraitManager/config/config",[],function(){return{stylePrefix:"trt-",labelContainer:"Component settings"}}),c("TraitManager/view/TraitView",["backbone"],function(a){return a.View.extend({events:{change:"onChange"},initialize:function(a){var b=this.model;this.config=a.config||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=b.target,this.className=this.pfx+"trait",this.labelClass=this.ppfx+"label",this.fieldClass=this.ppfx+"field "+this.ppfx+"field-"+b.get("type"),this.inputhClass=this.ppfx+"input-holder",b.off("change:value",this.onValueChange),this.listenTo(b,"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 a=this.model,b=this.target,c=a.get("name"),d=this.getValueForTarget();if(a.get("changeProp"))b.set(c,d);else{var e=_.clone(b.get("attributes"));e[c]=d,b.set("attributes",e)}},renderLabel:function(){this.$el.html('
'+this.getLabel()+"
")},getLabel:function(){var a=this.model,b=a.get("label")||a.get("name");return b.charAt(0).toUpperCase()+b.slice(1).replace(/-/g," ")},getInputEl:function(){if(!this.$input){var a=this.model,b=this.target,c=a.get("name"),d={placeholder:a.get("placeholder")||a.get("default"),type:a.get("type")||"text"};if(a.get("changeProp"))d.value=b.get(c);else{var e=b.get("attributes");d.value=a.get("value")||e[c]}a.get("min")&&(d.min=a.get("min")),a.get("max")&&(d.max=a.get("max")),this.$input=$("",d)}return this.$input.get(0)},getModelValue:function(){var a,b=this.model,c=this.target,d=b.get("name");if(b.get("changeProp"))a=c.get(d);else{var e=c.get("attributes");a=b.get("value")||e[d]}return a},renderField:function(){if(!this.$input){this.$el.append(this.tmpl);var a=this.getInputEl();this.$el.find("."+this.inputhClass).prepend(a)}},render:function(){return this.renderLabel(),this.renderField(),this.el.className=this.className,this}})}),c("TraitManager/view/TraitSelectView",["backbone","./TraitView"],function(a,b){return b.extend({initialize:function(a){b.prototype.initialize.apply(this,arguments);var c=this.ppfx;this.tmpl='
'},getInputEl:function(){if(!this.$input){var a=this.model,b=a.get("options")||[],c="",this.input=c,this.$input=$(this.input);var d=this.target,e=a.get("name"),f=a.get("value");if(a.get("changeProp"))f=f||d.get(e);else{var g=d.get("attributes");f=g[e]}f&&this.$input.val(f)}return this.$input.get(0)}})}),c("TraitManager/view/TraitCheckboxView",["./TraitView"],function(a){return a.extend({initialize:function(b){a.prototype.initialize.apply(this,arguments);var c=this.ppfx+"chk-icon";this.tmpl='
'},onChange:function(){this.model.set("value",this.getInputEl().checked)},getInputEl:function(){var b;this.$input||(b=1);var c=a.prototype.getInputEl.apply(this,arguments);if(b){var d=this.model,e=d.get("name"),f=this.target;if(d.get("changeProp"))c.checked=f.get(e);else{var g=f.get("attributes");c.checked=!!g[e]}}return c}})}),c("TraitManager/view/TraitNumberView",["./TraitView","Abstract/ui/InputNumber"],function(a,b){return a.extend({getValueForTarget:function(){var a=this.model,b=a.get("value"),c=a.get("unit");return b?b+c:""},getInputEl:function(){if(!this.$input){var a=this.getModelValue(),c=new b({contClass:this.ppfx+"field-int",model:this.model,ppfx:this.ppfx});this.input=c.render(),this.$input=this.input.inputEl,this.$unit=this.input.unitEl,this.model.set("value",a),this.$input.val(a)}return this.$input.get(0)},renderField:function(){this.$input||(this.$el.append(this.tmpl),this.getInputEl(),this.$el.find("."+this.inputhClass).prepend(this.input.el))}})}),c("TraitManager/view/TraitColorView",["./TraitView","Abstract/ui/InputColor"],function(a,b){return a.extend({getInputEl:function(){if(!this.$input){var a=this.getModelValue(),c=new b({contClass:this.ppfx+"field-color",model:this.model,ppfx:this.ppfx});this.input=c.render(),this.$input=this.input.colorEl,a=a||"",this.model.set("value",a).trigger("change:value")}return this.$input.get(0)},renderField:function(){this.$input||(this.getInputEl(),this.$el.append(this.input.el))}})}),c("TraitManager/view/TraitsView",["require","Abstract/view/DomainViews","./TraitView","./TraitSelectView","./TraitCheckboxView","./TraitNumberView","./TraitColorView"],function(a){var b=a("Abstract/view/DomainViews"),c=a("./TraitView"),d=a("./TraitSelectView"),e=a("./TraitCheckboxView"),f=a("./TraitNumberView"),g=a("./TraitColorView");return b.extend({itemView:c,itemsView:{text:c,number:f,select:d,checkbox:e,color:g},initialize:function(a){this.config=a.config||{},this.em=a.editor,this.pfx=this.config.stylePrefix||"",this.className=this.pfx+"traits",this.listenTo(this.em,"change:selectedComponent",this.updatedCollection),this.updatedCollection()},updatedCollection:function(){this.el.className=this.className;var a=this.em.get("selectedComponent");a&&(this.collection=a.get("traits"),this.render())}})}),c("TraitManager/main",["require","./config/config","./model/Traits","./view/TraitsView"],function(a){return function(){var b,c={},d=a("./config/config"),e=(a("./model/Traits"),a("./view/TraitsView"));return{TraitsView:e,name:"TraitManager",getConfig:function(){return c},init:function(a){c=a||{};for(var f in d)f in c||(c[f]=d[f]);var g=c.pStylePrefix;return g&&(c.stylePrefix=g+c.stylePrefix),b=new e({collection:[],editor:c.em,config:c}),this},getTraitsViewer:function(){return b},addType:function(a,c){var d=b.itemView;b.itemsView[a]=d.extend(c)},getType:function(a){return b.itemsView[a]}}}}),c("TraitManager",["TraitManager/main"],function(a){return a});var d=["Utils","StorageManager","DeviceManager","Parser","SelectorManager","ModalDialog","CodeManager","Panels","RichTextEditor","StyleManager","AssetManager","CssComposer","DomComponents","Canvas","Commands","BlockManager","TraitManager"];return c("editor/model/Editor",["backbone","backboneUndo","keymaster","Utils","StorageManager","DeviceManager","Parser","SelectorManager","ModalDialog","CodeManager","Panels","RichTextEditor","StyleManager","AssetManager","CssComposer","DomComponents","Canvas","Commands","BlockManager","TraitManager"],function(){return Backbone.Model.extend({defaults:{clipboard:null,designerMode:!1,selectedComponent:null,previousModel:null,changesCount:0,storables:[],toLoad:[],opened:{},device:""},initialize:function(a){this.config=a,this.set("Config",a),a.el&&a.fromElement&&(this.config.components=a.el.innerHTML),d.forEach(function(a){this.loadModule(a)},this),this.get("toLoad").forEach(function(a){a.onLoad()}),this.initUndoManager(),this.on("change:selectedComponent",this.componentSelected,this),this.on("change:changesCount",this.updateBeforeUnload,this)},updateBeforeUnload:function(){var a=this.get("changesCount");this.config.noticeOnUnload&&a?window.onbeforeunload=function(a){return 1}:window.onbeforeunload=null},loadModule:function(a){var c=this.config,d=new b(a)(),e=d.name.charAt(0).toLowerCase()+d.name.slice(1),f=c[e]||c[d.name]||{};f.pStylePrefix=c.pStylePrefix||"";var g=this.get("StorageManager");if(d.storageKey&&d.store&&d.load&&g){f.stm=g;var h=this.get("storables");h.push(d),this.set("storables",h)}return f.em=this,d.init(Object.create(f)),d["private"]||this.set(d.name,d),d.onLoad&&this.get("toLoad").push(d),this},init:function(a){this.set("Editor",a)},listenRules:function(a){this.stopListening(a,"add remove",this.listenRule),this.listenTo(a,"add remove",this.listenRule),a.each(function(a){this.listenRule(a)},this)},listenRule:function(a){this.stopListening(a,"change:style",this.ruleUpdated),this.listenTo(a,"change:style",this.ruleUpdated)},ruleUpdated:function(a,b,c){var d=this.get("changesCount")+1,e=c?c.avoidStore:0;this.set("changesCount",d);var f=this.get("StorageManager");f.isAutosave()&&d"+a+"":""},getCss:function(){var a=this.get("CssComposer"),b=this.get("DomComponents").getComponent(),c=this.config.protectedCss;return c+this.get("CodeManager").getCode(b,"css",a)},getJs:function(){var a=this.get("DomComponents").getWrapper();return this.get("CodeManager").getCode(a,"js").trim()},store:function(a){var b=this.get("StorageManager"),c={};if(b)return this.get("storables").forEach(function(a){var b=a.store(1);for(var d in b)c[d]=b[d]}),b.store(c,a),this.set("changesCount",0),this.trigger("storage:store",c),c},load:function(a){var b=this.getCacheLoad(1);return this.get("storables").forEach(function(a){a.load(b)}),b},getCacheLoad:function(a){var b=a?1:0;if(this.cacheLoad&&!b)return this.cacheLoad;var c=this.get("StorageManager"),d=[];return c?(this.get("storables").forEach(function(a){var b=a.storageKey;b="function"==typeof b?b():b,keys=b instanceof Array?b:[b],keys.forEach(function(a){d.push(a)})}),this.cacheLoad=c.load(d),this.trigger("storage:load",this.cacheLoad),this.cacheLoad):{}},getDeviceModel:function(){var a=this.get("device");return this.get("DeviceManager").get(a)},runDefault:function(){var a=this.get("Commands").get(this.config.defaultCommand);a&&!this.defaultRunning&&(a.stop(this,this),a.run(this,this),this.defaultRunning=1)},stopDefault:function(){var a=this.get("Commands").get(this.config.defaultCommand);a&&(a.stop(this,this),this.defaultRunning=0)},refreshCanvas:function(){this.set("canvasOffset",this.get("Canvas").getOffset())},clearSelection:function(a){var b=a||window;b.getSelection().removeAllRanges()}})}),c("editor/view/EditorView",["backbone"],function(a){return a.View.extend({initialize:function(){this.pn=this.model.get("Panels"),this.conf=this.model.config,this.className=this.conf.stylePrefix+"editor",this.model.on("loaded",function(){this.pn.active(),this.model.runDefault(),this.model.trigger("load")},this)},render:function(){var a=this.model,b=a.get("UndoManager"),c=a.get("DomComponents"),d=a.get("Config");d.loadCompsOnRender&&(d.clearOnRender&&c.clear(),c.getComponents().add(d.components),b.clear(),c.onLoad());var e=this.conf,f=$(e.el||"body "+e.container);return this.$el.empty(),e.width&&f.css("width",e.width),e.height&&f.css("height",e.height),this.$el.append(a.get("Canvas").render()),this.$el.append(this.pn.render()),this.$el.attr("class",this.className),f.addClass(e.stylePrefix+"editor-cont"),f.html(this.$el),this}})}),c("editor/main",["require","./config/config","./model/Editor","./view/EditorView"],function(a){var b=function(b){var c=b||{},d=a("./config/config"),e=a("./model/Editor"),f=a("./view/EditorView");for(var g in d)g in c||(c[g]=d[g]);c.pStylePrefix=c.stylePrefix;var h=new e(c),i=new f({model:h,config:c});return{editor:h,DomComponents:h.get("DomComponents"),CssComposer:h.get("CssComposer"),StorageManager:h.get("StorageManager"),AssetManager:h.get("AssetManager"),BlockManager:h.get("BlockManager"),TraitManager:h.get("TraitManager"),SelectorManager:h.get("SelectorManager"),CodeManager:h.get("CodeManager"),Commands:h.get("Commands"),Modal:h.get("Modal"),Panels:h.get("Panels"),StyleManager:h.get("StyleManager"),Canvas:h.get("Canvas"),UndoManager:h.get("UndoManager"),DeviceManager:h.get("DeviceManager"),RichTextEditor:h.get("rte"),Utils:h.get("Utils"),Config:h.get("Config"),init:function(){return h.init(this),this},getConfig:function(){return c},getHtml:function(){return h.getHtml()},getCss:function(){return h.getCss()},getJs:function(){return h.getJs()},getComponents:function(){return h.get("DomComponents").getComponents()},setComponents:function(a){return h.setComponents(a),this},addComponents:function(a){return this.getComponents().add(a)},getStyle:function(){return h.get("CssComposer").getAll()},setStyle:function(a){return h.setStyle(a),this},getSelected:function(){return h.getSelected()},setDevice:function(a){return h.set("device",a)},getDevice:function(){return h.get("device")},runCommand:function(a,b){var c,d=h.get("Commands").get(a);return d&&(c=d.run(this,this,b),this.trigger("run:"+a)),c},stopCommand:function(a,b){var c,d=h.get("Commands").get(a);return d&&(c=d.stop(this,this,b),this.trigger("stop:"+a)),c},store:function(a){return h.store(a)},load:function(){return h.load()},getContainer:function(){return c.el},refresh:function(){h.refreshCanvas()},setCustomRte:function(a){this.RichTextEditor.customRte=a},on:function(a,b){return h.on(a,b)},trigger:function(a){return h.trigger(a)},getEl:function(){return i.el},getModel:function(){return h},render:function(){return i.render().el}}};return b}),c("PluginManager/config/config",[],function(){return{plugins:[]}}),c("PluginManager/main",["require","./config/config"],function(a){return function(b){var c=b||{},d=a("./config/config");for(var e in d)e in c||(c[e]=d[e]);var f={};return{add:function(a,b){return f[a]?this:(f[a]=b,this)},get:function(a){return f[a]},getAll:function(){return f}}}}),c("PluginManager",["PluginManager/main"],function(a){return a}),c("grapesjs/main",["require","./config/config","editor/main","PluginManager"],function(a){return function(b){var c=a("./config/config"),d=a("editor/main"),e=a("PluginManager"),f=new e,g=[];return{editors:g,plugins:f,init:function(a){var b=a||{},e=b.container;for(var h in c)h in b||(b[h]=c[h]);if(!e)throw new Error("'container' is required");b.el=document.querySelector(e);var i=new d(b).init(),j=f.getAll();for(var k in j)if(!(b.plugins.indexOf(k)<0)){var l=b.pluginsOpts[k]||{},m=f.get(k);m(i,l)}return b.autorender&&i.render(),g.push(i),i}}}()}),b(["src/config/require-config.js"],function(){b(["grapesjs/main"],function(a){return a})}),c("main",function(){}),b("grapesjs/main")}); \ No newline at end of file +/*! grapesjs - 0.5.46 */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jQuery")):"function"==typeof define&&define.amd?define(["jQuery"],e):"object"==typeof exports?exports.grapesjs=e(require("jQuery")):t.grapesjs=e(t.jQuery)}(this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=129)}([function(t,e,i){(function(n){var r,s;!function(o){var a="object"==typeof self&&self.self===self&&self||"object"==typeof n&&n.global===n&&n;r=[i(8),i(1),e],void 0!==(s=function(t,e,i){a.Backbone=o(a,i,t,e)}.apply(e,r))&&(t.exports=s)}(function(t,e,i,n){var r=t.Backbone,s=Array.prototype.slice;e.VERSION="1.3.3",e.$=n,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o=function(t,e,n){switch(t){case 1:return function(){return i[e](this[n])};case 2:return function(t){return i[e](this[n],t)};case 3:return function(t,r){return i[e](this[n],l(t,this),r)};case 4:return function(t,r,s){return i[e](this[n],l(t,this),r,s)};default:return function(){var t=s.call(arguments);return t.unshift(this[n]),i[e].apply(i,t)}}},a=function(t,e,n){i.each(e,function(e,r){i[r]&&(t.prototype[r]=o(e,r,n))})},l=function(t,e){return i.isFunction(t)?t:i.isObject(t)&&!e._isModel(t)?c(t):i.isString(t)?function(e){return e.get(t)}:t},c=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}},u=e.Events={},h=/\s+/,d=function(t,e,n,r,s){var o,a=0;if(n&&"object"==typeof n){void 0!==r&&"context"in s&&void 0===s.context&&(s.context=r);for(o=i.keys(n);athis.length&&(r=this.length),r<0&&(r+=this.length+1);var s,o,a=[],l=[],c=[],u=[],h={},d=e.add,f=e.merge,p=e.remove,g=!1,m=this.comparator&&null==r&&!1!==e.sort,v=i.isString(this.comparator)?this.comparator:null;for(o=0;o7),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(I,"/"),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 n=document.body,r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("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),$.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),i.some(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0}))},navigate:function(t,e){if(!$.started)return!1;e&&!0!==e||(e={trigger:!!e}),t=this.getFragment(t||"");var i=this.root;""!==t&&"?"!==t.charAt(0)||(i=i.slice(0,-1)||"/");var n=i+t;if(t=this.decodeFragment(t.replace(D,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);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,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else t.hash="#"+e}}),e.history=new $;var z=function(t,e){var n,r=this;return n=t&&i.has(t,"constructor")?t.constructor:function(){return r.apply(this,arguments)},i.extend(n,r,e),n.prototype=i.create(r.prototype,t),n.prototype.constructor=n,n.__super__=r.prototype,n};b.extend=x.extend=P.extend=S.extend=$.extend=z;var H=function(){throw new Error('A "url" property or function must be specified')},F=function(t,e){var i=e.error;e.error=function(n){i&&i.call(e.context,t,n,e),t.trigger("error",t,n,e)}};return e})}).call(e,i(40))},function(e,i){e.exports=t},function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=i(0),s=i(109),o=i(31),a=i(37);t.exports=r.Model.extend({defaults:{tagName:"div",type:"",removable:!0,draggable:!0,droppable:!0,badgable:!0,stylable:!0,highlightable:!0,copyable:!0,resizable:!1,editable:!1,hiddenLayer:!1,void:!1,state:"",status:"",content:"",style:{},attributes:"",classes:"",script:"",traits:["id","title"],toolbar:null,previousModel:"",mirror:""},initialize:function(t,e){e&&e.config&&e.config.voidElements.indexOf(this.get("tagName"))>=0&&this.set("void",!0),this.opt=e,this.sm=e?e.sm||{}:{},this.config=t||{},this.defaultC=this.config.components||[],this.defaultCl=this.normalizeClasses(this.get("classes")||this.config.classes||[]),this.components=new s(this.defaultC,e),this.components.parent=this,this.listenTo(this,"change:script",this.scriptUpdated),this.set("attributes",this.get("attributes")||{}),this.set("components",this.components),this.set("classes",new o(this.defaultCl));var i=new a;i.setTarget(this),i.add(this.get("traits")),this.set("traits",i),this.initToolbar(),["stylable"].forEach(function(t){var e=this.get(t);if("string"==typeof e){var i=e.split(",").map(function(t){return t.trim()});this.set(t,i)}},this),this.init()},init:function(){},scriptUpdated:function(){this.set("scriptUpdated",1)},initToolbar:function(){var t=this;if(!t.get("toolbar")){var e=[];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=new a;e.setTarget(this),e.add(t),this.set("traits",e)},normalizeClasses:function(t){var e=[];if(this.sm.get){var i=this.sm.get("SelectorManager");if(i)return t.forEach(function(t){var n="";n="string"==typeof t?t:t.name;var r=i.add(n);e.push(r)}),e}},clone:function(t){var e=_.clone(this.attributes),i=this.get("components"),n=this.get("traits"),r=this.get("classes");return e.components=[],e.classes=[],e.traits=[],i.each(function(t,i){e.components[i]=t.clone(1)}),n.each(function(t,i){e.traits[i]=t.clone()}),r.each(function(t,i){e.classes[i]=t.get("name")}),e.status="",e.view="",t&&(this.opt.collection=null),new this.constructor(e,this.opt)},getName:function(){if(!this.name){var t=(this.cid.replace(/\D/g,""),this.get("type")),e=this.get("tagName");e="div"==e?"box":e,e=t||e,this.name=e.charAt(0).toUpperCase()+e.slice(1)}return this.name},toHTML:function(t){var e="",i=this,r=i.get("tagName"),s=i.get("void"),o="",a="",l=this.getAttrToHTML();for(var c in l){var u=l[c];a+=void 0!==(void 0===u?"undefined":n(u))&&""!==u?" "+c+'="'+u+'"':""}var h="";return i.get("classes").each(function(t){h+=" "+t.get("name")}),h=""!==h?' class="'+h.trim()+'"':"",_.isEmpty(i.get("style"))||(o=' id="'+i.cid+'" '),e+="<"+r+h+o+a+(s?"/":"")+">"+i.get("content"),i.get("components").each(function(t){e+=t.toHTML()}),s||(e+=""),e},getAttrToHTML:function(){var t=this.get("attributes")||{};return delete t.style,t},toJSON:function(){var t=r.Model.prototype.toJSON.apply(this,arguments),e=this.getScriptString();return e&&(t.script=e),t},getScriptString:function(t){var e=t||this.get("script");if("function"==typeof e){var i=e.toString().trim();i=i.replace(/^function\s?\(\)\s?\{/,""),i=i.replace(/\}$/,""),e=i}return e}},{isComponent:function(t){return{tagName:t.tagName?t.tagName.toLowerCase():""}}})},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(120);t.exports=n.View.extend({events:{click:"initResize"},className:function(){return this.getClasses()},tagName:function(){return this.model.get("tagName")},initialize:function(t){var e=this.model;this.opts=t||{},this.config=this.opts.config||{},this.em=this.config.em||"",this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.components=e.get("components"),this.attr=e.get("attributes"),this.classe=this.attr.class||[],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: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(e.get("classes"),"add remove change",this.updateClasses),this.$el.data("model",e),e.view=this,this.$el.data("collection",this.components),e.get("classes").length&&this.importClasses(),this.init()},init:function(){},handleChange:function(){var t=this.em;if(t){var e=this.model;t.trigger("component:update",e);for(var i in e.changed)t.trigger("component:update:"+i,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.model.get("status"),i=this.pfx;switch(e){case"selected":this.$el.addClass(i+"selected");break;case"moving":break;default:this.$el.removeClass(i+"selected")}},getClasses:function(){var t=this.model.get("attributes"),e=t.class||[];return e.length?e.join(" "):null},updateAttributes:function(){var t=this.model,e={},i=t.get("attributes");for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n]);t.get("src")&&(e.src=t.get("src")),t.get("highlightable")&&(e["data-highlightable"]=1);var r=this.getStyleString();r&&(e.style=r),this.$el.attr(e)},updateStyle:function(){this.$el.attr("style",this.getStyleString())},getStyleString:function(){var t="";this.style=this.model.get("style");for(var e in this.style)this.style.hasOwnProperty(e)&&(t+=e+":"+this.style[e]+";");return t},updateClasses:function(){var t="";this.model.get("classes").each(function(e){t+=e.get("name")+" "}),t=t.trim(),t?this.$el.attr("class",t):this.$el.removeAttr("class"),this.updateStatus()},eventCall:function(t){t.viewResponse=this},initResize:function(){var t,e=this.opts.config.em,i=e?e.get("Editor"):"",n=e?e.get("Config"):"",r=n.stylePrefix||"",s="data-"+r+"handler",o=r+"resizing",a=this.model,l=function(t,e,i){var n=(e.target.getAttribute(s),o);i.docs&&i.docs.find("body")[t](n)};i&&this.model.get("resizable")&&i.runCommand("resize",{el:this.el,options:{onStart:function(i,n){l("addClass",i,n),t=e.get("StyleManager").getModelToStyle(a)},onMove:function(){i.trigger("change:canvasOffset")},onEnd:function(t,e){l("removeClass",t,e),i.trigger("change:canvasOffset")},updateTarget:function(i,n,r){if(t){var s=_.clone(t.get("style")),o=n.w+(r?1:0);if(s.width=o+"px",s.height=n.h+"px",t.set("style",s,{avoidStore:1}),e.trigger("targetStyleUpdated"),r){var a=_.clone(s);a.width=o-1+"px",t.set("style",a)}}}}})},prevDef:function(t){t.preventDefault()},updateScript:function(){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=new r({collection:this.model.get("components"),config:this.config,defaultTypes:this.opts.defaultTypes,componentTypes:this.opts.componentTypes}),i=this.getChildrenContainer(),n=t.render(e(i)).el.childNodes;n=Array.prototype.slice.call(n);for(var s=0,o=n.length;s\n input-holder\'>\n
\n
'),templateLabel:_.template('\n
\n
\n <%= label %>\n
\n
'),events:{change:"valueUpdated"},initialize:function(t){this.config=t.config||{},this.em=this.config.em,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||{},this.defaultValue=this.model.get("defaults"),this.property=this.model.get("property"),this.input=this.$input=null,this.className=this.pfx+"property",this.inputHolderId="#"+this.pfx+"input-holder",this.sector=this.model.collection&&this.model.collection.sector,this.model.get("value")||this.model.set("value",this.model.get("defaults")),this.listenTo(this.propTarget,"update",this.targetUpdated),this.listenTo(this.model,"destroy remove",this.remove),this.listenTo(this.model,"change:value",this.valueChanged),this.listenTo(this.model,"targetUpdated",this.targetUpdated),this.listenTo(this.model,"change:visible",this.updateVisibility)},getTarget:function(){return this.selectedComponent?this.selectedComponent:this.propTarget?this.propTarget.model:null},valueUpdated:function(){this.$input&&this.model.set("value",this.getInputValue())},targetUpdated:function(){this.selectedComponent=this.propTarget.model,this.helperComponent=this.propTarget.helper,this.checkVisibility(),this.getTarget()&&(this.sameValue()||this.renderInputRequest())},checkVisibility:function(){this.config.hideNotStylable&&(this.isTargetStylable()&&this.isComponentStylable()?this.show():this.hide(),this.sector&&this.sector.trigger("updateVisibility"))},sameValue:function(){return this.getComponentValue()==this.getValueForTarget()},getComponentValue:function(){var t=this.model,e=this.getTarget();if(e){var i=e.get("style")[this.property];if(this.componentValue=i||this.defaultValue+(this.unit||""),t.get("functionName")){var n=this.fetchFromFunction(this.componentValue);n&&(this.componentValue=n)}if(this.customValue&&"function"==typeof this.customValue){var r=t.collection.indexOf(t),s=this.customValue(this,r);s&&(this.componentValue=s)}return this.componentValue}},getTargetValue:function(t){var e,i=t||{},n=this.model,r=this.getTarget();return r?(e=r.get("style")[n.get("property")],e||i.ignoreDefault||(e=this.getDefaultValue()),e):e},getDefaultValue:function(){return this.model.get("defaults")},fetchFromFunction:function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},tryFetchFromFunction:function(t){if(!this.model.get("functionName"))return t;var e=t.indexOf("(")+1,i=t.lastIndexOf(")");return t.substring(e,i)},getValueForTarget:function(){return this.model.get("value")},getInputValue:function(){return this.$input?this.$input.val():""},valueChanged:function(t,e,i){var n=this.getValueForTarget(),r=this.config.em,s=this.model;if(this.$input&&this.setValue(n),this.getTarget()&&this.isTargetStylable()&&this.isComponentStylable()){var o=this.getValueForTarget(),a=s.get("functionName");a&&(o=a+"("+o+")");var l=this.getTarget(),c=this.onChange;c&&"function"==typeof c?c(l,this,i):this.updateTargetStyle(o,null,i),r&&(r.trigger("component:update",s),r.trigger("component:styleUpdate",s),r.trigger("component:styleUpdate:"+s.get("property"),s))}},updateTargetStyle:function(t,e,i){var n=e||this.property,r=t||"",s=i?i.avoidStore:0,o=this.getTarget(),a=_.clone(o.get("style"));r?a[n]=r:delete a[n],o.set("style",a,{avoidStore:s}),this.helperComponent&&this.helperComponent.set("style",a,{avoidStore:s})},isTargetStylable:function(){var t=this.getTarget().get("stylable");return t instanceof Array&&(t=_.indexOf(t,this.property)>=0),t},isComponentStylable:function(){var t=this.em,e=t&&t.get("selectedComponent");if(!e)return!0;var i=e.get("stylable");return i instanceof Array&&(i=_.indexOf(i,this.property)>=0),i},setValue:function(t,e){var i=0===e?0:1,n=this.model.get("defaults"),r=this.model.get("value")||n;(t||i)&&(r=t),this.$input&&this.$input.val(r),this.model.set({value:r},{silent:!0})},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)},renderLabel:function(){this.$el.html(this.templateLabel({pfx:this.pfx,ppfx:this.ppfx,icon:this.model.get("icon"),info:this.model.get("info"),label:this.model.get("name")}))},renderField:function(){this.renderTemplate(),this.renderInput(),delete this.componentValue},renderTemplate:function(){this.$el.append(this.template({pfx:this.pfx,ppfx:this.ppfx,icon:this.model.get("icon"),info:this.model.get("info"),label:this.model.get("name")}))},renderInput:function(){this.$input||(this.$input=e("",{placeholder:this.model.get("defaults"),type:"text"}),this.$el.find(this.inputHolderId).html(this.$input)),this.setValue(this.componentValue,0)},renderInputRequest:function(){this.renderInput()},cleanValue:function(){this.setValue("")},render:function(){return this.renderLabel(),this.renderField(),this.$el.attr("class",this.className),this}})}).call(e,i(1))},function(t,e,i){!function(e,i){t.exports=i()}(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 i(t,i){return e(t).appendChild(i)}function n(t,e,i,n){var r=document.createElement(t);if(i&&(r.className=i),n&&(r.style.cssText=n),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var s=0;s=e)return o+(e-s);o+=a-s,o+=i-o%i,s=a+1}}function h(){this.id=null}function d(t,e){for(var i=0;i=e)return n+Math.min(o,e-r);if(r+=s-n,r+=i-r%i,n=s+1,r>=e)return n}}function p(t){for(;No.length<=t;)No.push(g(No)+" ");return No[t]}function g(t){return t[t.length-1]}function m(t,e){for(var i=[],n=0;n"€"&&(t.toUpperCase()!=t.toLowerCase()||Oo.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&&$o.test(t)}function S(t,e,i){var r=this;this.input=i,r.scrollbarFiller=n("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=n("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=n("div",null,"CodeMirror-code"),r.selectionDiv=n("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=n("div",null,"CodeMirror-cursors"),r.measure=n("div",null,"CodeMirror-measure"),r.lineMeasure=n("div",null,"CodeMirror-measure"),r.lineSpace=n("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=n("div",[n("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=n("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=n("div",null,null,"position: absolute; height: "+Mo+"px; width: 1px;"),r.gutters=n("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=n("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=n("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),no&&ro<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),so||to&&po||(r.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(r.wrapper):t(r.wrapper)),r.viewFrom=r.viewTo=e.first,r.reportedViewFrom=r.reportedViewTo=e.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,i.init(r)}function T(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 i=t;!i.lines;)for(var n=0;;++n){var r=i.children[n],s=r.chunkSize();if(e=t.first&&ei?$(i,T(t,i).text.length):R(e,T(t,e.line).text.length)}function R(t,e){var i=t.ch;return null==i||i>e?$(t.line,e):i<0?$(t.line,0):t}function V(t,e){for(var i=[],n=0;n=e:s.to>e);(n||(n=[])).push(new j(o,s.from,l?null:s.to))}}return n}function Y(t,e,i){var n;if(t)for(var r=0;r=e:s.to>e);if(a||s.from==e&&"bookmark"==o.type&&(!i||s.marker.insertLeft)){var l=null==s.from||(o.inclusiveLeft?s.from<=e:s.from0&&a)for(var w=0;w0)){var u=[l,1],h=_(c.from,a.from),f=_(c.to,a.to);(h<0||!o.inclusiveLeft&&!h)&&u.push({from:c.from,to:a.from}),(f>0||!o.inclusiveRight&&!f)&&u.push({from:a.to,to:c.to}),r.splice.apply(r,u),l+=u.length-1}}return r}function Q(t){var e=t.markedSpans;if(e){for(var i=0;i=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?_(c.to,i)>=0:_(c.to,i)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?_(c.from,n)<=0:_(c.from,n)<0)))return!0}}}function lt(t){for(var e;e=st(t);)t=e.find(-1,!0).line;return t}function ct(t){for(var e,i;e=ot(t);)t=e.find(1,!0).line,(i||(i=[])).push(t);return i}function ut(t,e){var i=T(t,e),n=lt(i);return i==n?e:L(n)}function ht(t,e){if(e>t.lastLine())return e;var i,n=T(t,e);if(!dt(t,n))return e;for(;i=ot(n);)n=i.find(1,!0).line;return L(n)+1}function dt(t,e){var i=Io&&e.markedSpans;if(i)for(var n=void 0,r=0;re.maxLineLength&&(e.maxLineLength=i,e.maxLine=t)})}function vt(t,e,i,n){if(!t)return n(e,i,"ltr");for(var r=!1,s=0;se||e==i&&o.to==e)&&(n(Math.max(o.from,e),Math.min(o.to,i),1==o.level?"rtl":"ltr"),r=!0)}r||n(e,i,"ltr")}function yt(t){return t.level%2?t.to:t.from}function bt(t){return t.level%2?t.from:t.to}function xt(t){var e=Et(t);return e?yt(e[0]):0}function wt(t){var e=Et(t);return e?bt(g(e)):t.text.length}function Ct(t,e,i){var n=t[0].level;return e==n||i!=n&&ee)return n;if(r.from==e||r.to==e){if(null!=i)return Ct(t,r.level,t[i].level)?(r.from!=r.to&&(Do=i),n):(r.from!=r.to&&(Do=n),i);i=n}}return i}function St(t,e,i,n){if(!n)return e+i;do{e+=i}while(e>0&&k(t.text.charAt(e)));return e}function Tt(t,e,i,n){var r=Et(t);if(!r)return Mt(t,e,i,n);for(var s=kt(r,e),o=r[s],a=St(t,e,o.level%2?-i:i,n);;){if(a>o.from&&a0==o.level%2?o.to:o.from);if(!(o=r[s+=i]))return null;a=i>0==o.level%2?St(t,o.to,-1,n):St(t,o.from,1,n)}}function Mt(t,e,i,n){var r=e+i;if(n)for(;r>0&&k(t.text.charAt(r));)r+=i;return r<0||r>t.text.length?null:r}function Et(t){var e=t.order;return null==e&&(e=t.order=zo(t.text)),e}function Pt(t,e){return t._handlers&&t._handlers[e]||Ho}function Lt(t,e,i){if(t.removeEventListener)t.removeEventListener(e,i,!1);else if(t.detachEvent)t.detachEvent("on"+e,i);else{var n=t._handlers,r=n&&n[e];if(r){var s=d(r,i);s>-1&&(n[e]=r.slice(0,s).concat(r.slice(s+1)))}}}function At(t,e){var i=Pt(t,e);if(i.length)for(var n=Array.prototype.slice.call(arguments,2),r=0;r0}function _t(t){t.prototype.on=function(t,e){Fo(this,t,e)},t.prototype.off=function(t,e){Lt(this,t,e)}}function It(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Dt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function zt(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Ht(t){It(t),Dt(t)}function Ft(t){return t.target||t.srcElement}function Rt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),go&&t.ctrlKey&&1==e&&(e=3),e}function Vt(t){if(null==So){var e=n("span","​");i(t,n("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(So=e.offsetWidth<=1&&e.offsetHeight>2&&!(no&&ro<8))}var r=So?n("span","​"):n("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Wt(t){if(null!=To)return To;var n=i(t,document.createTextNode("AخA")),r=bo(n,0,1).getBoundingClientRect(),s=bo(n,1,2).getBoundingClientRect();return e(t),!(!r||r.left==r.right)&&(To=s.right-r.right<3)}function Bt(t){if(null!=jo)return jo;var e=i(t,n("span","x")),r=e.getBoundingClientRect(),s=bo(e,0,1).getBoundingClientRect();return jo=Math.abs(r.left-s.left)>1}function jt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Uo[t]=e}function Ut(t,e){qo[t]=e}function qt(t){if("string"==typeof t&&qo.hasOwnProperty(t))t=qo[t];else if(t&&"string"==typeof t.name&&qo.hasOwnProperty(t.name)){var e=qo[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 qt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return qt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Kt(t,e){e=qt(e);var i=Uo[e.name];if(!i)return Kt(t,"text/plain");var n=i(t,e);if(Ko.hasOwnProperty(e.name)){var r=Ko[e.name];for(var s in r)r.hasOwnProperty(s)&&(n.hasOwnProperty(s)&&(n["_"+s]=n[s]),n[s]=r[s])}if(n.name=e.name,e.helperType&&(n.helperType=e.helperType),e.modeProps)for(var o in e.modeProps)n[o]=e.modeProps[o];return n}function Gt(t,e){c(e,Ko.hasOwnProperty(t)?Ko[t]:Ko[t]={})}function Yt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var i={};for(var n in e){var r=e[n];r instanceof Array&&(r=r.concat([])),i[n]=r}return i}function Jt(t,e){for(var i;t.innerMode&&(i=t.innerMode(e))&&i.mode!=t;)e=i.state,t=i.mode;return i||{mode:t,state:e}}function Xt(t,e,i){return!t.startState||t.startState(e,i)}function Zt(t,e,i,n){var r=[t.state.modeGen],s={};oe(t,e.text,t.doc.mode,i,function(t,e){return r.push(t,e)},s,n);for(var o=0;ot&&r.splice(o,1,t,r[o+1],s),o+=2,a=Math.min(t,s)}if(e)if(n.opaque)r.splice(i,o-i,t,"overlay "+e),o=i+2;else for(;it.options.maxHighlightLength?Yt(t.doc.mode,n):n);e.stateAfter=n,e.styles=r.styles,r.classes?e.styleClasses=r.classes:e.styleClasses&&(e.styleClasses=null),i===t.doc.frontier&&t.doc.frontier++}return e.styles}function te(t,e,i){var n=t.doc,r=t.display;if(!n.mode.startState)return!0;var s=ae(t,e,i),o=s>n.first&&T(n,s-1).stateAfter;return o=o?Yt(n.mode,o):Xt(n.mode),n.iter(s,e,function(i){ee(t,i.text,o);var a=s==e-1||s%5==0||s>=r.viewFrom&&se.start)return s}throw new Error("Mode "+t.name+" failed to advance stream.")}function re(t,e,i,n){var r,s=function(t){return{start:h.start,end:h.pos,string:h.current(),type:r||null,state:t?Yt(o.mode,u):u}},o=t.doc,a=o.mode;e=F(o,e);var l,c=T(o,e.line),u=te(t,e.line,i),h=new Go(c.text,t.options.tabSize);for(n&&(l=[]);(n||h.post.options.maxHighlightLength?(a=!1,o&&ee(t,e,n,h.pos),h.pos=e.length,l=null):l=se(ne(i,h,n,d),s),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!a||u!=l){for(;co;--a){if(a<=s.first)return s.first;var l=T(s,a-1);if(l.stateAfter&&(!i||a<=s.frontier))return a;var c=u(l.text,null,t.options.tabSize);(null==r||n>c)&&(r=a-1,n=c)}return r}function le(t,e,i){this.text=t,tt(this,e),this.height=i?i(this):1}function ce(t,e,i,n){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Q(t),tt(t,i);var r=n?n(t):1;r!=t.height&&P(t,r)}function ue(t){t.parent=null,Q(t)}function he(t,e){if(!t||/^\s*$/.test(t))return null;var i=e.addModeClass?Xo:Jo;return i[t]||(i[t]=t.replace(/\S+/g,"cm-$&"))}function de(t,e){var i=n("span",null,null,so?"padding-right: .1px":null),r={pre:n("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:(no||so)&&t.getOption("lineWrapping")};e.measure={};for(var s=0;s<=(e.rest?e.rest.length:0);s++){var o=s?e.rest[s-1]:e.line,l=void 0;r.pos=0,r.addToken=pe,Wt(t.display.measure)&&(l=Et(o))&&(r.addToken=me(r.addToken,l)),r.map=[];ye(o,r,Qt(t,o,e!=t.display.externalMeasured&&L(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=a(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=a(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Vt(t.display.measure))),0==s?(e.measure.map=r.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(r.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(so){var c=r.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return At(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=a(r.pre.className,r.textClass||"")),r}function fe(t){var e=n("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function pe(t,e,i,r,s,o,a){if(e){var l,c=t.splitSpaces?ge(e,t.trailingSpace):e,u=t.cm.state.specialChars,h=!1;if(u.test(e)){l=document.createDocumentFragment();for(var d=0;;){u.lastIndex=d;var f=u.exec(e),g=f?f.index-d:e.length-d;if(g){var m=document.createTextNode(c.slice(d,d+g));no&&ro<9?l.appendChild(n("span",[m])):l.appendChild(m),t.map.push(t.pos,t.pos+g,m),t.col+=g,t.pos+=g}if(!f)break;d+=g+1;var v=void 0;if("\t"==f[0]){var y=t.cm.options.tabSize,b=y-t.col%y;v=l.appendChild(n("span",p(b),"cm-tab")),v.setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=b}else"\r"==f[0]||"\n"==f[0]?(v=l.appendChild(n("span","\r"==f[0]?"␍":"␤","cm-invalidchar")),v.setAttribute("cm-text",f[0]),t.col+=1):(v=t.cm.options.specialCharPlaceholder(f[0]),v.setAttribute("cm-text",f[0]),no&&ro<9?l.appendChild(n("span",[v])):l.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,l=document.createTextNode(c),t.map.push(t.pos,t.pos+e.length,l),no&&ro<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==c.charCodeAt(e.length-1),i||r||s||h||a){var x=i||"";r&&(x+=r),s&&(x+=s);var w=n("span",[l],x,a);return o&&(w.title=o),t.content.appendChild(w)}t.content.appendChild(l)}}function ge(t,e){if(t.length>1&&!/ /.test(t))return t;for(var i=e,n="",r=0;rc&&h.from<=c));d++);if(h.to>=u)return t(i,n,r,s,o,a,l);t(i,n.slice(0,h.to-c),r,s,null,a,l),s=null,n=n.slice(h.to-c),c=h.to}}}function ve(t,e,i,n){var r=!n&&i.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!n&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",i.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function ye(t,e,i){var n=t.markedSpans,r=t.text,s=0;if(n)for(var o,a,l,c,u,h,d,f=r.length,p=0,g=1,m="",v=0;;){if(v==p){l=c=u=h=a="",d=null,v=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&&v>w.to&&(v=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==v&&(b||(b=[])).push(C.endStyle,w.to),C.title&&!h&&(h=C.title),C.collapsed&&(!d||nt(d.marker,C)<0)&&(d=w)):w.from>p&&v>w.from&&(v=w.from)}if(b)for(var k=0;k=f)break;for(var T=Math.min(f,v);;){if(m){var M=p+m.length;if(!d){var E=M>T?m.slice(0,T-p):m;e.addToken(e,E,o?o+l:l,u,p+E.length==v?c:"",h,a)}if(M>=T){m=m.slice(T-p),p=T;break}p=M,u=""}m=r.slice(s,s=i[g++]),o=he(i[g++],e.cm.options)}}else for(var P=1;P2&&s.push((l.bottom+c.top)/2-i.top)}}s.push(i.bottom-i.top)}}function Ke(t,e,i){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var n=0;ni)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function Ge(t,e){e=lt(e);var n=L(e),r=t.display.externalMeasured=new be(t.doc,e,n);r.lineN=n;var s=r.built=de(t,r);return r.text=s.pre,i(t.display.lineMeasure,s.pre),r}function Ye(t,e,i,n){return Ze(t,Xe(t,e),i,n)}function Je(t,e){if(e>=t.display.viewFrom&&e=i.lineN&&ee)&&(s=l-a,r=s-1,e>=l&&(o="right")),null!=r){if(n=t[c+2],a==l&&i==(n.insertLeft?"left":"right")&&(o=i),"left"==i&&0==r)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)n=t[2+(c-=3)],o="left";if("right"==i&&r==l-a)for(;c=0&&(i=t[r]).left==i.right;r--);return i}function ei(t,e,i,n){var r,s=Qe(e.map,i,n),o=s.node,a=s.start,l=s.end,c=s.collapse;if(3==o.nodeType){for(var u=0;u<4;u++){for(;a&&k(e.line.text.charAt(s.coverStart+a));)--a;for(;s.coverStart+l0&&(c=n="right");var h;r=t.options.lineWrapping&&(h=o.getClientRects()).length>1?h["right"==n?h.length-1:0]:o.getBoundingClientRect()}if(no&&ro<9&&!a&&(!r||!r.left&&!r.right)){var d=o.parentNode.getClientRects()[0];r=d?{left:d.left,right:d.left+vi(t.display),top:d.top,bottom:d.bottom}:ta}for(var f=r.top-e.rect.top,p=r.bottom-e.rect.top,g=(f+p)/2,m=e.view.measure.heights,v=0;vi.from?o(t-1):o(t,n)}n=n||T(t.doc,e.line),r||(r=Xe(t,n));var l=Et(n),c=e.ch;if(!l)return o(c);var u=kt(l,c),h=a(c,u);return null!=Do&&(h.other=a(c,Do)),h}function di(t,e){var i=0;e=F(t.doc,e),t.options.lineWrapping||(i=vi(t.display)*e.ch);var n=T(t.doc,e.line),r=pt(n)+Re(t.display);return{left:i,right:i,top:r,bottom:r+n.height}}function fi(t,e,i,n){var r=$(t,e);return r.xRel=n,i&&(r.outside=!0),r}function pi(t,e,i){var n=t.doc;if((i+=t.display.viewOffset)<0)return fi(n.first,0,!0,-1);var r=A(n,i),s=n.first+n.size-1;if(r>s)return fi(n.first+n.size-1,T(n,s).text.length,!0,1);e<0&&(e=0);for(var o=T(n,r);;){var a=gi(t,o,r,e,i),l=ot(o),c=l&&l.find(0,!0);if(!l||!(a.ch>c.from.ch||a.ch==c.from.ch&&a.xRel>0))return a;r=L(o=c.to.line)}}function gi(t,e,i,n,r){function s(n){var r=hi(t,$(i,n),"line",e,c);return a=!0,o>r.bottom?r.left-l:om)return fi(i,f,v,1);for(;;){if(u?f==d||f==Tt(e,d,1):f-d<=1){var y=n0&&y1){var w=Ze(t,c,y,"right");o<=w.bottom&&o>=w.top&&Math.abs(n-w.right)1?1:0)}var C=Math.ceil(h/2),S=d+C;if(u){S=d;for(var T=0;Tn?(f=S,m=M,(v=a)&&(m+=1e3),h=C):(d=S,p=M,g=a,h-=C)}}function mi(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==Yo){Yo=n("pre");for(var r=0;r<49;++r)Yo.appendChild(document.createTextNode("x")),Yo.appendChild(n("br"));Yo.appendChild(document.createTextNode("x"))}i(t.measure,Yo);var s=Yo.offsetHeight/50;return s>3&&(t.cachedTextHeight=s),e(t.measure),s||1}function vi(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=n("span","xxxxxxxxxx"),r=n("pre",[e]);i(t.measure,r);var s=e.getBoundingClientRect(),o=(s.right-s.left)/10;return o>2&&(t.cachedCharWidth=o),o||10}function yi(t){for(var e=t.display,i={},n={},r=e.gutters.clientLeft,s=e.gutters.firstChild,o=0;s;s=s.nextSibling,++o)i[t.options.gutters[o]]=s.offsetLeft+s.clientLeft+r,n[t.options.gutters[o]]=s.clientWidth;return{fixedPos:bi(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:e.wrapper.clientWidth}}function bi(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function xi(t){var e=mi(t.display),i=t.options.lineWrapping,n=i&&Math.max(5,t.display.scroller.clientWidth/vi(t.display)-3);return function(r){if(dt(t.doc,r))return 0;var s=0;if(r.widgets)for(var o=0;o=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var i=t.display.view,n=0;n=t.display.viewTo||a.to().line3&&(r(f,g.top,null,g.bottom),f=u,g.bottoml.bottom||c.bottom==l.bottom&&c.right>l.right)&&(l=c),f0?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(i=!i)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Li(t){t.state.focused||(t.display.input.focus(),Ni(t))}function Ai(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,Oi(t))},100)}function Ni(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(At(t,"focus",t,e),t.state.focused=!0,o(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),so&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Pi(t))}function Oi(t,e){t.state.delayingBlurEvent||(t.state.focused&&(At(t,"blur",t,e),t.state.focused=!1,Co(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function $i(t){var e=t.display,i=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var n=bi(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,s=n+"px",o=0;o.001||l<-.001)&&(P(r.line,s),Di(r.line),r.rest))for(var c=0;c=o&&(s=A(e,pt(T(e,l))-t.wrapper.clientHeight),o=l)}return{from:s,to:Math.max(o,s+1)}}function Hi(t,e){Math.abs(t.doc.scrollTop-e)<2||(t.doc.scrollTop=e,to||En(t,{top:e}),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e),t.display.scrollbars.setScrollTop(e),to&&En(t),wn(t,100))}function Fi(t,e,i){(i?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)||(e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),t.doc.scrollLeft=e,$i(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function Ri(t){var e=t.wheelDeltaX,i=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==i&&t.detail&&t.axis==t.VERTICAL_AXIS?i=t.detail:null==i&&(i=t.wheelDelta),{x:e,y:i}}function Vi(t){var e=Ri(t);return e.x*=ia,e.y*=ia,e}function Wi(t,e){var i=Ri(e),n=i.x,r=i.y,s=t.display,o=s.scroller,a=o.scrollWidth>o.clientWidth,l=o.scrollHeight>o.clientHeight;if(n&&a||r&&l){if(r&&go&&so)t:for(var c=e.target,u=s.view;c!=o;c=c.parentNode)for(var h=0;h(window.innerHeight||document.documentElement.clientHeight)&&(s=!1),null!=s&&!ho){var o=n("div","​",null,"position: absolute;\n top: "+(e.top-i.viewOffset-Re(t.display))+"px;\n height: "+(e.bottom-e.top+Be(t)+i.barHeight)+"px;\n left: "+e.left+"px; width: 2px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(s),t.display.lineSpace.removeChild(o)}}}function Ji(t,e,i,n){null==n&&(n=0);for(var r,s=0;s<5;s++){var o=!1;r=hi(t,e);var a=i&&i!=e?hi(t,i):r,l=Zi(t,Math.min(r.left,a.left),Math.min(r.top,a.top)-n,Math.max(r.left,a.left),Math.max(r.bottom,a.bottom)+n),c=t.doc.scrollTop,u=t.doc.scrollLeft;if(null!=l.scrollTop&&(Hi(t,l.scrollTop),Math.abs(t.doc.scrollTop-c)>1&&(o=!0)),null!=l.scrollLeft&&(Fi(t,l.scrollLeft),Math.abs(t.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return r}function Xi(t,e,i,n,r){var s=Zi(t,e,i,n,r);null!=s.scrollTop&&Hi(t,s.scrollTop),null!=s.scrollLeft&&Fi(t,s.scrollLeft)}function Zi(t,e,i,n,r){var s=t.display,o=mi(t.display);i<0&&(i=0);var a=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:s.scroller.scrollTop,l=Ue(t),c={};r-i>l&&(r=i+l);var u=t.doc.height+Ve(s),h=iu-o;if(ia+l){var f=Math.min(i,(d?u:r)-l);f!=a&&(c.scrollTop=f)}var p=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:s.scroller.scrollLeft,g=je(t)-(t.options.fixedGutter?s.gutters.offsetWidth:0),m=n-e>g;return m&&(n=e+g),e<10?c.scrollLeft=0:eg+p-3&&(c.scrollLeft=n+(m?0:10)-g),c}function Qi(t,e,i){null==e&&null==i||en(t),null!=e&&(t.curOp.scrollLeft=(null==t.curOp.scrollLeft?t.doc.scrollLeft:t.curOp.scrollLeft)+e),null!=i&&(t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+i)}function tn(t){en(t);var e=t.getCursor(),i=e,n=e;t.options.lineWrapping||(i=e.ch?$(e.line,e.ch-1):e,n=$(e.line,e.ch+1)),t.curOp.scrollToPos={from:i,to:n,margin:t.options.cursorScrollMargin,isCursor:!0}}function en(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var i=di(t,e.from),n=di(t,e.to),r=Zi(t,Math.min(i.left,n.left),Math.min(i.top,n.top)-e.margin,Math.max(i.right,n.right),Math.max(i.bottom,n.bottom)+e.margin);t.scrollTo(r.scrollLeft,r.scrollTop)}}function nn(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:++ra},we(t.curOp)}function rn(t){ke(t.curOp,function(t){for(var e=0;e=i.viewTo)||i.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new kn(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function an(t){t.updatedDisplay=t.mustUpdate&&Tn(t.cm,t.update)}function ln(t){var e=t.cm,i=e.display;t.updatedDisplay&&Ii(e),t.barMeasure=Bi(e),i.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ye(e,i.maxLine,i.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+t.adjustWidthTo+Be(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+t.adjustWidthTo-je(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=i.input.prepareSelection(t.focus))}function cn(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)Io&&ut(t.doc,e)r.viewFrom?vn(t):(r.viewFrom+=n,r.viewTo+=n);else if(e<=r.viewFrom&&i>=r.viewTo)vn(t);else if(e<=r.viewFrom){var s=yn(t,i,i+n,1);s?(r.view=r.view.slice(s.index),r.viewFrom=s.lineN,r.viewTo+=n):vn(t)}else if(i>=r.viewTo){var o=yn(t,e,e,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):vn(t)}else{var a=yn(t,e,e,-1),l=yn(t,i,i+n,1);a&&l?(r.view=r.view.slice(0,a.index).concat(xe(t,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=n):vn(t)}var c=r.externalMeasured;c&&(i=r.lineN&&e=n.viewTo)){var s=n.view[ki(t,e)];if(null!=s.node){var o=s.changes||(s.changes=[]);-1==d(o,i)&&o.push(i)}}}function vn(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function yn(t,e,i,n){var r,s=ki(t,e),o=t.display.view;if(!Io||i==t.doc.first+t.doc.size)return{index:s,lineN:i};for(var a=t.display.viewFrom,l=0;l0){if(s==o.length-1)return null;r=a+o[s].size-e,s++}else r=a-e;e+=r,i+=r}for(;ut(t.doc,i)!=i;){if(s==(n<0?0:o.length-1))return null;i+=n*o[s-(n<0?1:0)].size,s+=n}return{index:s,lineN:i}}function bn(t,e,i){var n=t.display;0==n.view.length||e>=n.viewTo||i<=n.viewFrom?(n.view=xe(t,e,i),n.viewFrom=e):(n.viewFrom>e?n.view=xe(t,e,n.viewFrom).concat(n.view):n.viewFromi&&(n.view=n.view.slice(0,ki(t,i)))),n.viewTo=i}function xn(t){for(var e=t.display.view,i=0,n=0;n=t.display.viewTo)){var i=+new Date+t.options.workTime,n=Yt(e.mode,te(t,e.frontier)),r=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.viewTo+500),function(s){if(e.frontier>=t.display.viewFrom){var o=s.styles,a=s.text.length>t.options.maxHighlightLength,l=Zt(t,s,a?Yt(e.mode,n):n,!0);s.styles=l.styles;var c=s.styleClasses,u=l.classes;u?s.styleClasses=u:c&&(s.styleClasses=null);for(var h=!o||o.length!=s.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&di)return wn(t,t.options.workDelay),!0}),r.length&&hn(t,function(){for(var e=0;e=n.viewFrom&&i.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==xn(t))return!1;_i(t)&&(vn(t),i.dims=yi(t));var o=r.first+r.size,a=Math.max(i.visible.from-t.options.viewportMargin,r.first),l=Math.min(o,i.visible.to+t.options.viewportMargin);n.viewFroml&&n.viewTo-l<20&&(l=Math.min(o,n.viewTo)),Io&&(a=ut(t.doc,a),l=ht(t.doc,l));var c=a!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=i.wrapperHeight||n.lastWrapWidth!=i.wrapperWidth;bn(t,a,l),n.viewOffset=pt(T(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var u=xn(t);if(!c&&0==u&&!i.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var h=s();return u>4&&(n.lineDiv.style.display="none"),Pn(t,n.updateLineNumbers,i.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,h&&s()!=h&&h.offsetHeight&&h.focus(),e(n.cursorDiv),e(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,c&&(n.lastWrapHeight=i.wrapperHeight,n.lastWrapWidth=i.wrapperWidth,wn(t,400)),n.updateLineNumbers=null,!0}function Mn(t,e){for(var i=e.viewport,n=!0;(n&&t.options.lineWrapping&&e.oldDisplayWidth!=je(t)||(i&&null!=i.top&&(i={top:Math.min(t.doc.height+Ve(t.display)-Ue(t),i.top)}),e.visible=zi(t.display,t.doc,i),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&Tn(t,e);n=!1){Ii(t);var r=Bi(t);Si(t),qi(t,r),An(t,r)}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 En(t,e){var i=new kn(t,e);if(Tn(t,i)){Ii(t),Mn(t,i);var n=Bi(t);Si(t),qi(t,n),An(t,n),i.finish()}}function Pn(t,i,n){function r(e){var i=e.nextSibling;return so&&go&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),i}for(var s=t.display,o=t.options.lineNumbers,a=s.lineDiv,l=a.firstChild,c=s.view,u=s.viewFrom,h=0;h-1&&(p=!1),Me(t,f,u,n)),p&&(e(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(O(t.options,u)))),l=f.node.nextSibling}else{var g=_e(t,f,u,n);a.insertBefore(g,l)}u+=f.size}for(;l;)l=r(l)}function Ln(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function An(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+Be(t)+"px"}function Nn(t){var i=t.display.gutters,r=t.options.gutters;e(i);for(var s=0;s-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function $n(t,e){this.ranges=t,this.primIndex=e}function _n(t,e){this.anchor=t,this.head=e}function In(t,e){var i=t[e];t.sort(function(t,e){return _(t.from(),e.from())}),e=d(t,i);for(var n=1;n=0){var o=z(s.from(),r.from()),a=D(s.to(),r.to()),l=s.empty()?r.from()==r.head:s.from()==s.head;n<=e&&--e,t.splice(--n,2,new _n(l?a:o,l?o:a))}}return new $n(t,e)}function Dn(t,e){return new $n([new _n(t,e||t)],0)}function zn(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 Hn(t,e){if(_(t,e.from)<0)return t;if(_(t,e.to)<=0)return zn(e);var i=t.line+e.text.length-(e.to.line-e.from.line)-1,n=t.ch;return t.line==e.to.line&&(n+=zn(e).ch-e.to.ch),$(i,n)}function Fn(t,e){for(var i=[],n=0;n1&&t.remove(a.line+1,p-1),t.insert(a.line+1,y)}Se(t,"change",t,e)}function qn(t,e,i){function n(t,r,s){if(t.linked)for(var o=0;o1&&!t.done[t.done.length-2].ranges?(t.done.pop(),g(t.done)):void 0}function Zn(t,e,i,n){var r=t.history;r.undone.length=0;var s,o,a=+new Date;if((r.lastOp==n||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&r.lastModTime>a-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))&&(s=Xn(r,r.lastOp==n)))o=g(s.changes),0==_(e.from,e.to)&&0==_(e.from,o.to)?o.to=zn(e):s.changes.push(Yn(t,e));else{var l=g(r.done);for(l&&l.ranges||er(t.sel,r.done),s={changes:[Yn(t,e)],generation:r.generation},r.done.push(s);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(i),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=e.origin,o||At(t,"historyAdded")}function Qn(t,e,i,n){var r=e.charAt(0);return"*"==r||"+"==r&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function tr(t,e,i,n){var r=t.history,s=n&&n.origin;i==r.lastSelOp||s&&r.lastSelOrigin==s&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==s||Qn(t,s,g(r.done),e))?r.done[r.done.length-1]=e:er(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=s,r.lastSelOp=i,n&&!1!==n.clearRedo&&Jn(r.undone)}function er(t,e){var i=g(e);i&&i.ranges&&i.equals(t)||e.push(t)}function ir(t,e,i,n){var r=e["spans_"+t.id],s=0;t.iter(Math.max(t.first,i),Math.min(t.first+t.size,n),function(i){i.markedSpans&&((r||(r=e["spans_"+t.id]={}))[s]=i.markedSpans),++s})}function nr(t){if(!t)return null;for(var e,i=0;i-1&&(g(a)[h]=c[h],delete c[h])}}}return n}function ar(t,e,i,n){if(t.cm&&t.cm.display.shift||t.extend){var r=e.anchor;if(n){var s=_(i,r)<0;s!=_(n,r)<0?(r=i,i=n):s!=_(i,n)<0&&(i=n)}return new _n(r,i)}return new _n(n||i,i)}function lr(t,e,i,n){pr(t,new $n([ar(t,t.sel.primary(),e,i)],0),n)}function cr(t,e,i){for(var n=[],r=0;r=e.ch:a.to>e.ch))){if(r&&(At(l,"beforeCursorEnter"),l.explicitlyCleared)){if(s.markedSpans){--o;continue}break}if(!l.atomic)continue;if(i){var c=l.find(n<0?1:-1),u=void 0;if((n<0?l.inclusiveRight:l.inclusiveLeft)&&(c=wr(t,c,-n,c&&c.line==e.line?s:null)),c&&c.line==e.line&&(u=_(c,i))&&(n<0?u<0:u>0))return br(t,c,e,n,r)}var h=l.find(n<0?-1:1);return(n<0?l.inclusiveLeft:l.inclusiveRight)&&(h=wr(t,h,n,h.line==e.line?s:null)),h?br(t,h,e,n,r):null}}return e}function xr(t,e,i,n,r){var s=n||1,o=br(t,e,i,s,r)||!r&&br(t,e,i,s,!0)||br(t,e,i,-s,r)||!r&&br(t,e,i,-s,!0);return o||(t.cantEdit=!0,$(t.first,0))}function wr(t,e,i,n){return i<0&&0==e.ch?e.line>t.first?F(t,$(e.line-1)):null:i>0&&e.ch==(n||T(t,e.line)).text.length?e.line=0;--r)Tr(t,{from:n[r].from,to:n[r].to,text:r?[""]:e.text});else Tr(t,e)}}function Tr(t,e){if(1!=e.text.length||""!=e.text[0]||0!=_(e.from,e.to)){var i=Fn(t,e);Zn(t,e,i,t.cm?t.cm.curOp.id:NaN),Pr(t,e,i,J(t,e));var n=[];qn(t,function(t,i){i||-1!=d(n,t.history)||($r(t.history,e),n.push(t.history)),Pr(t,e,null,J(t,e))})}}function Mr(t,e,i){if(!t.cm||!t.cm.state.suppressEdits||i){for(var n,r=t.history,s=t.sel,o="undo"==e?r.done:r.undone,a="undo"==e?r.undone:r.done,l=0;l=0;--h){var f=function(i){var r=n.changes[i];if(r.origin=e,u&&!kr(t,r,!1))return o.length=0,{};c.push(Yn(t,r));var s=i?Fn(t,r):g(o);Pr(t,r,s,sr(t,r)),!i&&t.cm&&t.cm.scrollIntoView({from:r.from,to:zn(r)});var a=[];qn(t,function(t,e){e||-1!=d(a,t.history)||($r(t.history,r),a.push(t.history)),Pr(t,r,null,sr(t,r))})}(h);if(f)return f.v}}}}function Er(t,e){if(0!=e&&(t.first+=e,t.sel=new $n(m(t.sel.ranges,function(t){return new _n($(t.anchor.line+e,t.anchor.ch),$(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){gn(t.cm,t.first,t.first-e,e);for(var i=t.cm.display,n=i.viewFrom;nt.lastLine())){if(e.from.lines&&(e={from:e.from,to:$(s,T(t,s).text.length),text:[e.text[0]],origin:e.origin}),e.removed=M(t,e.from,e.to),i||(i=Fn(t,e)),t.cm?Lr(t.cm,e,n):Un(t,e,n),gr(t,i,Po)}}function Lr(t,e,i){var n=t.doc,r=t.display,s=e.from,o=e.to,a=!1,l=s.line;t.options.lineWrapping||(l=L(lt(T(n,s.line))),n.iter(l,o.line+1,function(t){if(t==r.maxLine)return a=!0,!0})),n.sel.contains(e.from,e.to)>-1&&Ot(t),Un(n,e,i,xi(t)),t.options.lineWrapping||(n.iter(l,s.line+e.text.length,function(t){var e=gt(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,a=!1)}),a&&(t.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,s.line),wn(t,400);var c=e.text.length-(o.line-s.line)-1;e.full?gn(t):s.line!=o.line||1!=e.text.length||jn(t.doc,e)?gn(t,s.line,o.line+1,c):mn(t,s.line,"text");var u=$t(t,"changes"),h=$t(t,"change");if(h||u){var d={from:s,to:o,text:e.text,removed:e.removed,origin:e.origin};h&&Se(t,"change",t,d),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}function Ar(t,e,i,n,r){if(n||(n=i),_(n,i)<0){var s=n;n=i,i=s}"string"==typeof e&&(e=t.splitLines(e)),Sr(t,{from:i,to:n,text:e,origin:r})}function Nr(t,e,i,n){i0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=n("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(at(t,e.line,e,i,o)||e.line!=i.line&&at(t,i.line,e,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");B()}o.addToHistory&&Zn(t,{from:e,to:i,origin:"markText"},t.sel,NaN);var l,u=e.line,h=t.cm;if(t.iter(u,i.line+1,function(t){h&&o.collapsed&&!h.options.lineWrapping&<(t)==h.display.maxLine&&(l=!0),o.collapsed&&u!=e.line&&P(t,0),K(t,new j(o,u==e.line?e.ch:null,u==i.line?i.ch:null)),++u}),o.collapsed&&t.iter(e.line,i.line+1,function(e){dt(t,e)&&P(e,0)}),o.clearOnEnter&&Fo(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(W(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++sa,o.atomic=!0),h){if(l&&(h.curOp.updateMaxLine=!0),o.collapsed)gn(h,e.line,i.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var d=e.line;d<=i.line;d++)mn(h,d,"text");o.atomic&&vr(h.doc),Se(h,"markerAdded",h,o)}return o}function Wr(t,e){var i=this;this.markers=t,this.primary=e;for(var n=0;n-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()),gr(e.doc,Dn(i,i)),c)for(var u=0;u=0;e--)Ar(t.doc,"",n[e].from,n[e].to,"+delete");tn(t)})}function ls(t,e){var i=T(t.doc,e),n=lt(i);n!=i&&(e=L(n));var r=Et(n);return $(e,r?r[0].level%2?wt(n):xt(n):0)}function cs(t,e){for(var i,n=T(t.doc,e);i=ot(n);)n=i.find(1,!0).line,e=null;var r=Et(n),s=r?r[0].level%2?xt(n):wt(n):n.text.length;return $(null==e?L(n):e,s)}function us(t,e){var i=ls(t,e.line),n=T(t.doc,i.line),r=Et(n);if(!r||0==r[0].level){var s=Math.max(0,n.text.search(/\S/)),o=e.line==i.line&&e.ch<=s&&e.ch;return $(i.line,o?0:s)}return i}function hs(t,e,i){if("string"==typeof e&&!(e=va[e]))return!1;t.display.input.ensurePolled();var n=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i&&(t.display.shift=!1),r=e(t)!=Eo}finally{t.display.shift=n,t.state.suppressEdits=!1}return r}function ds(t,e,i){for(var n=0;nr-400&&0==_(ma.pos,i)?n="triple":ga&&ga.time>r-400&&0==_(ga.pos,i)?(n="double",ma={time:r,pos:i}):(n="single",ga={time:r,pos:i});var o,a=t.doc.sel,c=go?e.metaKey:e.ctrlKey;t.options.dragDrop&&Ro&&!t.isReadOnly()&&"single"==n&&(o=a.contains(i))>-1&&(_((o=a.ranges[o]).from(),i)<0||i.xRel>0)&&(_(o.to(),i)>0||i.xRel<0)?Cs(t,e,i,c):ks(t,e,i,n,c)}function Cs(t,e,i,n){var r=t.display,s=+new Date,o=dn(t,function(a){so&&(r.scroller.draggable=!1),t.state.draggingText=!1,Lt(document,"mouseup",o),Lt(r.scroller,"drop",o),Math.abs(e.clientX-a.clientX)+Math.abs(e.clientY-a.clientY)<10&&(It(a),!n&&+new Date-200x&&r.push(new _n($(m,x),$(m,f(y,c,s))))}r.length||r.push(new _n(i,i)),pr(h,In(g.ranges.slice(0,p).concat(r),p),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var w=d,C=w.anchor,k=e;if("single"!=n){var S;S="double"==n?t.findWordAt(e):new _n($(e.line,0),F(h,$(e.line+1,0))),_(S.anchor,C)>0?(k=S.head,C=z(w.from(),S.anchor)):(k=S.anchor,C=D(w.to(),S.head))}var M=g.ranges.slice(0);M[p]=new _n(F(h,C),k),pr(h,In(M,p),Lo)}}function a(e){var i=++w,r=Ci(t,e,!0,"rect"==n);if(r)if(0!=_(r,b)){t.curOp.focus=s(),o(r);var l=zi(c,h);(r.line>=l.to||r.linex.bottom?20:0;u&&setTimeout(dn(t,function(){w==i&&(c.scroller.scrollTop+=u,a(e))}),50)}}function l(e){t.state.selectingText=!1,w=1/0,It(e),c.input.focus(),Lt(document,"mousemove",C),Lt(document,"mouseup",k),h.history.lastSelOrigin=null}var c=t.display,h=t.doc;It(e);var d,p,g=h.sel,m=g.ranges;if(r&&!e.shiftKey?(p=h.sel.contains(i),d=p>-1?m[p]:new _n(i,i)):(d=h.sel.primary(),p=h.sel.primIndex),mo?e.shiftKey&&e.metaKey:e.altKey)n="rect",r||(d=new _n(i,i)),i=Ci(t,e,!0,!0),p=-1;else if("double"==n){var v=t.findWordAt(i);d=t.display.shift||h.extend?ar(h,d,v.anchor,v.head):v}else if("triple"==n){var y=new _n($(i.line,0),F(h,$(i.line+1,0)));d=t.display.shift||h.extend?ar(h,d,y.anchor,y.head):y}else d=ar(h,d,i);r?-1==p?(p=m.length,pr(h,In(m.concat([d]),p),{scroll:!1,origin:"*mouse"})):m.length>1&&m[p].empty()&&"single"==n&&!e.shiftKey?(pr(h,In(m.slice(0,p).concat(m.slice(p+1)),0),{scroll:!1,origin:"*mouse"}),g=h.sel):ur(h,p,d,Lo):(p=0,pr(h,new $n([d],0),Lo),g=h.sel);var b=i,x=c.wrapper.getBoundingClientRect(),w=0,C=dn(t,function(t){Rt(t)?a(t):l(t)}),k=dn(t,l);t.state.selectingText=k,Fo(document,"mousemove",C),Fo(document,"mouseup",k)}function Ss(t,e,i,n){var r,s;try{r=e.clientX,s=e.clientY}catch(e){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;n&&It(e);var o=t.display,a=o.lineDiv.getBoundingClientRect();if(s>a.bottom||!$t(t,i))return zt(e);s-=a.top-o.viewOffset;for(var l=0;l=r){return At(t,i,t,A(t.doc,s),t.options.gutters[l],e),zt(e)}}}function Ts(t,e){return Ss(t,e,"gutterClick",!0)}function Ms(t,e){Fe(t.display,e)||Es(t,e)||Nt(t,e,"contextmenu")||t.display.input.onContextMenu(e)}function Es(t,e){return!!$t(t,"gutterContextMenu")&&Ss(t,e,"gutterContextMenu",!1)}function Ps(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),si(t)}function Ls(t){Nn(t),gn(t),setTimeout(function(){return $i(t)},20)}function As(t,e,i){if(!e!=!(i&&i!=xa)){var n=t.display.dragFunctions,r=e?Fo:Lt;r(t.display.scroller,"dragstart",n.start),r(t.display.scroller,"dragenter",n.enter),r(t.display.scroller,"dragover",n.over),r(t.display.scroller,"dragleave",n.leave),r(t.display.scroller,"drop",n.drop)}}function Ns(t){t.options.lineWrapping?(o(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Co(t.display.wrapper,"CodeMirror-wrap"),mt(t)),wi(t),gn(t),si(t),setTimeout(function(){return qi(t)},100)}function Os(t,e){var i=this;if(!(this instanceof Os))return new Os(t,e);this.options=e=e?c(e):{},c(wa,e,!1),On(e);var n=e.value;"string"==typeof n&&(n=new aa(n,e.mode,null,e.lineSeparator)),this.doc=n;var r=new Os.inputStyles[e.inputStyle](this),s=this.display=new S(t,n,r);s.wrapper.CodeMirror=this,Nn(this),Ps(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),e.autofocus&&!po&&s.input.focus(),Gi(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 h,keySeq:null,specialChars:null},no&&ro<11&&setTimeout(function(){return i.display.input.reset(!0)},20),$s(this),Zr(),nn(this),this.curOp.forceUpdate=!0,Kn(this,n),e.autofocus&&!po||this.hasFocus()?setTimeout(l(Ni,this),20):Oi(this);for(var o in Ca)Ca.hasOwnProperty(o)&&Ca[o](i,e[o],xa);_i(this),e.finishInit&&e.finishInit(this);for(var a=0;a400}var r=t.display;Fo(r.scroller,"mousedown",dn(t,xs)),no&&ro<11?Fo(r.scroller,"dblclick",dn(t,function(e){if(!Nt(t,e)){var i=Ci(t,e);if(i&&!Ts(t,e)&&!Fe(t.display,e)){It(e);var n=t.findWordAt(i);lr(t.doc,n.anchor,n.head)}}})):Fo(r.scroller,"dblclick",function(e){return Nt(t,e)||It(e)}),wo||Fo(r.scroller,"contextmenu",function(e){return Ms(t,e)});var s,o={end:0};Fo(r.scroller,"touchstart",function(e){if(!Nt(t,e)&&!i(e)){r.input.ensurePolled(),clearTimeout(s);var n=+new Date;r.activeTouch={start:n,moved:!1,prev:n-o.end<=300?o:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),Fo(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),Fo(r.scroller,"touchend",function(i){var s=r.activeTouch;if(s&&!Fe(r,i)&&null!=s.left&&!s.moved&&new Date-s.start<300){var o,a=t.coordsChar(r.activeTouch,"page");o=!s.prev||n(s,s.prev)?new _n(a,a):!s.prev.prev||n(s,s.prev.prev)?t.findWordAt(a):new _n($(a.line,0),F(t.doc,$(a.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),It(i)}e()}),Fo(r.scroller,"touchcancel",e),Fo(r.scroller,"scroll",function(){r.scroller.clientHeight&&(Hi(t,r.scroller.scrollTop),Fi(t,r.scroller.scrollLeft,!0),At(t,"scroll",t))}),Fo(r.scroller,"mousewheel",function(e){return Wi(t,e)}),Fo(r.scroller,"DOMMouseScroll",function(e){return Wi(t,e)}),Fo(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(e){Nt(t,e)||Ht(e)},over:function(e){Nt(t,e)||(Yr(t,e),Ht(e))},start:function(e){return Gr(t,e)},drop:dn(t,Kr),leave:function(e){Nt(t,e)||Jr(t)}};var a=r.input.getField();Fo(a,"keyup",function(e){return ys.call(t,e)}),Fo(a,"keydown",dn(t,ms)),Fo(a,"keypress",dn(t,bs)),Fo(a,"focus",function(e){return Ni(t,e)}),Fo(a,"blur",function(e){return Oi(t,e)})}function _s(t,e,i,n){var r,s=t.doc;null==i&&(i="add"),"smart"==i&&(s.mode.indent?r=te(t,e):i="prev");var o=t.options.tabSize,a=T(s,e),l=u(a.text,null,o);a.stateAfter&&(a.stateAfter=null);var c,h=a.text.match(/^\s*/)[0];if(n||/\S/.test(a.text)){if("smart"==i&&((c=s.mode.indent(r,a.text.slice(h.length),a.text))==Eo||c>150)){if(!n)return;i="prev"}}else c=0,i="not";"prev"==i?c=e>s.first?u(T(s,e-1).text,null,o):0:"add"==i?c=l+t.options.indentUnit:"subtract"==i?c=l-t.options.indentUnit:"number"==typeof i&&(c=l+i),c=Math.max(0,c);var d="",f=0;if(t.options.indentWithTabs)for(var g=Math.floor(c/o);g;--g)f+=o,d+="\t";if(f1)if(Sa&&Sa.text.join("\n")==e){if(n.ranges.length%Sa.text.length==0){l=[];for(var c=0;c=0;h--){var d=n.ranges[h],f=d.from(),p=d.to();d.empty()&&(i&&i>0?f=$(f.line,f.ch-i):t.state.overwrite&&!o?p=$(p.line,Math.min(T(s,p.line).text.length,p.ch+g(a).length)):Sa&&Sa.lineWise&&Sa.text.join("\n")==e&&(f=p=$(f.line,0))),u=t.curOp.updateInput;var v={from:f,to:p,text:l?l[h%l.length]:a,origin:r||(o?"paste":t.state.cutIncoming?"cut":"+input")};Sr(t.doc,v),Se(t,"inputRead",t,v)}e&&!o&&Hs(t,e),tn(t),t.curOp.updateInput=u,t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=!1}function zs(t,e){var i=t.clipboardData&&t.clipboardData.getData("Text");if(i)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||hn(e,function(){return Ds(e,i,0,null,"paste")}),!0}function Hs(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var i=t.doc.sel,n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(!(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line)){var s=t.getModeAt(r.head),o=!1;if(s.electricChars){for(var a=0;a-1){o=_s(t,r.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(T(t.doc,r.head.line).text.slice(0,r.head.ch))&&(o=_s(t,r.head.line,"smart"));o&&Se(t,"electricInput",t,r.head.line)}}}function Fs(t){for(var e=[],i=[],n=0;n=t.first+t.size)&&(a=e,u=T(t,e))}function o(t){var e=(r?Tt:Mt)(u,l,i,!0);if(null==e){if(t||!s())return!1;l=r?(i<0?wt:xt)(u):i<0?u.text.length:0}else l=e;return!0}var a=e.line,l=e.ch,c=i,u=T(t,a);if("char"==n)o();else if("column"==n)o(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,f=t.cm&&t.cm.getHelper(e,"wordChars"),p=!0;!(i<0)||o(!p);p=!1){var g=u.text.charAt(l)||"\n",m=w(g,f)?"w":d&&"\n"==g?"n":!d||/\s/.test(g)?null:"p";if(!d||p||m||(m="s"),h&&h!=m){i<0&&(i=1,o());break}if(m&&(h=m),i>0&&!o(!p))break}var v=xr(t,$(a,l),e,c,!0);return _(e,v)||(v.hitSide=!0),v}function Bs(t,e,i,n){var r,s=t.doc,o=e.left;if("page"==n){var a=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(a-.5*mi(t.display),3);r=(i>0?e.bottom:e.top)+i*l}else"line"==n&&(r=i>0?e.bottom+3:e.top-3);for(var c;c=pi(t,o,r),c.outside;){if(i<0?r<=0:r>=s.height){c.hitSide=!0;break}r+=5*i}return c}function js(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new h,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Us(t,e){var i=Je(t,e.line);if(!i||i.hidden)return null;var n=T(t.doc,e.line),r=Ke(i,n,e.line),s=Et(n),o="left";if(s){o=kt(s,e.ch)%2?"right":"left"}var a=Qe(r.map,e.ch,o);return a.offset="right"==a.collapse?a.end:a.start,a}function qs(t,e){return e&&(t.bad=!0),t}function Ks(t,e,i,n,r){function s(t){return function(e){return e.id==t}}function o(e){if(1==e.nodeType){var i=e.getAttribute("cm-text");if(null!=i)return void(a+=""==i?e.textContent.replace(/\u200b/g,""):i);var u,h=e.getAttribute("cm-marker");if(h){var d=t.findMarks($(n,0),$(r+1,0),s(+h));return void(d.length&&(u=d[0].find())&&(a+=M(t.doc,u.from,u.to).join(c)))}if("false"==e.getAttribute("contenteditable"))return;for(var f=0;f=15&&(lo=!1,so=!0);var bo,xo=go&&(oo||lo&&(null==yo||yo<12.11)),wo=to||no&&ro>=9,Co=function(e,i){var n=e.className,r=t(i).exec(n);if(r){var s=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(s?r[1]+s:"")}};bo=document.createRange?function(t,e,i,n){var r=document.createRange();return r.setEnd(n||t,i),r.setStart(t,e),r}:function(t,e,i){var n=document.body.createTextRange();try{n.moveToElementText(t.parentNode)}catch(t){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",e),n};var ko=function(t){t.select()};fo?ko=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:no&&(ko=function(t){try{t.select()}catch(t){}}),h.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var So,To,Mo=30,Eo={toString:function(){return"CodeMirror.Pass"}},Po={scroll:!1},Lo={origin:"*mouse"},Ao={origin:"+move"},No=[""],Oo=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,$o=/[\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]/,_o=!1,Io=!1,Do=null,zo=function(){function t(t){return t<=247?i.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1773?n.charAt(t-1536):1774<=t&&t<=2220?"r":8192<=t&&t<=8203?"w":8204==t?"b":"L"}function e(t,e,i){this.level=t,this.from=e,this.to=i}var i="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;return function(i){if(!r.test(i))return!1;for(var n=i.length,c=[],u=0;u=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pose},eatSpace:function(){for(var t=this,e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++t.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},backUp:function(t){this.pos-=t},column:function(){return this.lastColumnPos0?null:(n&&!1!==e&&(this.pos+=n[0].length),n)}var r=function(t){return i?t.toLowerCase():t};if(r(this.string.substr(this.pos,t.length))==r(t))return!1!==e&&(this.pos+=t.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}}},_t(le),le.prototype.lineNo=function(){return L(this)};var Yo,Jo={},Xo={},Zo=null,Qo=null,ta={left:0,right:0,top:0,bottom:0},ea=0,ia=null;no?ia=-.53:to?ia=15:ao?ia=-.7:co&&(ia=-1/3),ji.prototype=c({update:function(t){var e=t.scrollWidth>t.clientWidth+1,i=t.scrollHeight>t.clientHeight+1,n=t.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=e?n+"px":"0";var r=t.viewHeight-(e?n: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=i?n+"px":"0",this.horiz.style.left=t.barLeft+"px";var s=t.viewWidth-t.barLeft-(i?n:0);this.horiz.firstChild.style.width=t.scrollWidth-t.clientWidth+s+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:e?n:0}},setScrollLeft:function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var t=go&&!uo?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new h,this.disableVert=new h},enableZeroWidthBar:function(t,e){function i(){var n=t.getBoundingClientRect();document.elementFromPoint(n.left+1,n.bottom-1)!=t?t.style.pointerEvents="none":e.set(1e3,i)}t.style.pointerEvents="auto",e.set(1e3,i)},clear:function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)}},ji.prototype),Ui.prototype=c({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},Ui.prototype);var na={native:ji,null:Ui},ra=0;kn.prototype.signal=function(t,e){$t(t,e)&&this.events.push(arguments)},kn.prototype.finish=function(){for(var t=this,e=0;e=0&&_(t,r.to())<=0)return n}return-1}},_n.prototype={from:function(){return z(this.anchor,this.head)},to:function(){return D(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}},Ir.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var i=this,n=t,r=t+e;n1||!(this.children[0]instanceof Ir))){var l=[];this.collapse(l),this.children=[new Ir(l)],this.children[0].parent=this}},collapse:function(t){for(var e=this,i=0;i50){for(var a=s.lines.length%25+25,l=a;l10);t.parent.maybeSpill()}},iterN:function(t,e,i){for(var n=this,r=0;re.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&gn(e,r,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&vr(e.doc)),e&&Se(e,"markerCleared",e,this),i&&rn(e),this.parent&&this.parent.clear()}},Rr.prototype.find=function(t,e){var i=this;null==t&&"bookmark"==this.type&&(t=1);for(var n,r,s=0;s=0;c--)Sr(n,r[c]);l?fr(this,l):this.cm&&tn(this.cm)}),undo:pn(function(){Mr(this,"undo")}),redo:pn(function(){Mr(this,"redo")}),undoSelection:pn(function(){Mr(this,"undo",!0)}),redoSelection:pn(function(){Mr(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,i=0,n=0;n=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,i){t=F(this,t),e=F(this,e);var n=[],r=t.line;return this.iter(t.line,e.line+1,function(s){var o=s.markedSpans;if(o)for(var a=0;a=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||i&&!i(l.marker)||n.push(l.marker.parent||l.marker)}++r}),n},getAllMarks:function(){var t=[];return this.iter(function(e){var i=e.markedSpans;if(i)for(var n=0;nt)return e=t,!0;t-=s,++i}),F(this,$(i,e))},indexFromPos:function(t){t=F(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(s.charAt(r.ch-1)+s.charAt(r.ch-2),$(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var o=T(t.doc,r.line-1).text;o&&(r=new $(r.line,1),t.replaceRange(s.charAt(0)+t.doc.lineSeparator()+o.charAt(o.length-1),$(r.line-1,o.length-1),r,"+transpose"))}i.push(new _n(r,r))}t.setSelections(i)})},newlineAndIndent:function(t){return hn(t,function(){for(var e=t.listSelections(),i=e.length-1;i>=0;i--)t.replaceRange(t.doc.lineSeparator(),e[i].anchor,e[i].head,"+input");e=t.listSelections();for(var n=0;nt.firstLine()&&(n=$(n.line-1,T(t.doc,n.line-1).length)),r.ch==T(t.doc,r.line).text.length&&r.linee.viewTo-1)return!1;var s,o,a;n.line==e.viewFrom||0==(s=ki(t,n.line))?(o=L(e.view[0].line),a=e.view[0].node):(o=L(e.view[s].line),a=e.view[s-1].node.nextSibling);var l,c,u=ki(t,r.line);if(u==e.view.length-1?(l=e.viewTo-1,c=e.lineDiv.lastChild):(l=L(e.view[u+1].line)-1,c=e.view[u+1].node.previousSibling),!a)return!1;for(var h=t.doc.splitLines(Ks(t,a,c,o,l)),d=M(t.doc,$(o,0),$(l,T(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(),o++}for(var f=0,p=0,m=h[0],v=d[0],y=Math.min(m.length,v.length);f1||h[0]||_(C,k)?(Ar(t.doc,h,C,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&(this.composing=null,this.pollContent()||gn(this.cm),this.div.blur(),this.div.focus())},readFromDOMSoon:function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){t.readDOMTimeout=null,t.composing||!t.cm.isReadOnly()&&t.pollContent()||hn(t.cm,function(){return gn(t.cm)})},80))},setUneditable:function(t){t.contentEditable="false"},onKeyPress:function(t){t.preventDefault(),this.cm.isReadOnly()||dn(this.cm,Ds)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0)},readOnlyChanged:function(t){this.div.contentEditable=String("nocursor"!=t)},onContextMenu:y,resetPosition:y,needsContentAttribute:!0},js.prototype),Js.prototype=c({init:function(t){function e(t){if(!Nt(r,t)){if(r.somethingSelected())Is({lineWise:!1,text:r.getSelections()}),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,o.value=Sa.text.join("\n"),ko(o));else{if(!r.options.lineWiseCopyCut)return;var e=Fs(r);Is({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Po):(n.prevInput="",o.value=e.text.join("\n"),ko(o))}"cut"==t.type&&(r.state.cutIncoming=!0)}}var i=this,n=this,r=this.cm,s=this.wrapper=Vs(),o=this.textarea=s.firstChild;t.wrapper.insertBefore(s,t.wrapper.firstChild),fo&&(o.style.width="0px"),Fo(o,"input",function(){no&&ro>=9&&i.hasSelection&&(i.hasSelection=null),n.poll()}),Fo(o,"paste",function(t){Nt(r,t)||zs(t,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Fo(o,"cut",e),Fo(o,"copy",e),Fo(t.scroller,"paste",function(e){Fe(t,e)||Nt(r,e)||(r.state.pasteIncoming=!0,n.focus())}),Fo(t.lineSpace,"selectstart",function(e){Fe(t,e)||It(e)}),Fo(o,"compositionstart",function(){var t=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Fo(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var t=this.cm,e=t.display,i=t.doc,n=Ti(t);if(t.options.moveInputWithCursor){var r=hi(t,i.sel.primary().head,"div"),s=e.wrapper.getBoundingClientRect(),o=e.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+o.top-s.top)),n.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+o.left-s.left))}return n},showSelection:function(t){var e=this.cm,n=e.display;i(n.cursorDiv,t.cursors),i(n.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},reset:function(t){if(!this.contextMenuPending){var e,i,n=this.cm,r=n.doc;if(n.somethingSelected()){this.prevInput="";var s=r.sel.primary();e=Bo&&(s.to().line-s.from().line>100||(i=n.getSelection()).length>1e3);var o=e?"-":i||n.getSelection();this.textarea.value=o,n.state.focused&&ko(this.textarea),no&&ro>=9&&(this.hasSelection=o)}else t||(this.prevInput=this.textarea.value="",no&&ro>=9&&(this.hasSelection=null));this.inaccurateSelection=e}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!po||s()!=this.textarea))try{this.textarea.focus()}catch(t){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},fastPoll:function(){function t(){i.poll()||e?(i.pollingFast=!1,i.slowPoll()):(e=!0,i.polling.set(60,t))}var e=!1,i=this;i.pollingFast=!0,i.polling.set(20,t)},poll:function(){var t=this,e=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||Wo(i)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=i.value;if(r==n&&!e.somethingSelected())return!1;if(no&&ro>=9&&this.hasSelection===r||go&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var s=r.charCodeAt(0);if(8203!=s||n||(n="​"),8666==s)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);o1e3||r.indexOf("\n")>-1?i.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},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){no&&ro>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(t){function e(){if(null!=o.selectionStart){var t=r.somethingSelected(),e="​"+(t?o.value:"");o.value="⇚",o.value=e,n.prevInput=t?"":"​",o.selectionStart=1,o.selectionEnd=e.length,s.selForContextMenu=r.doc.sel}}function i(){if(n.contextMenuPending=!1,n.wrapper.style.cssText=u,o.style.cssText=c,no&&ro<9&&s.scrollbars.setScrollTop(s.scroller.scrollTop=l),null!=o.selectionStart){(!no||no&&ro<9)&&e();var t=0,i=function(){s.selForContextMenu==r.doc.sel&&0==o.selectionStart&&o.selectionEnd>0&&"​"==n.prevInput?dn(r,Cr)(r):t++<10?s.detectingSelectAll=setTimeout(i,500):s.input.reset()};s.detectingSelectAll=setTimeout(i,200)}}var n=this,r=n.cm,s=r.display,o=n.textarea,a=Ci(r,t),l=s.scroller.scrollTop;if(a&&!lo){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(a)&&dn(r,pr)(r.doc,Dn(a),Po);var c=o.style.cssText,u=n.wrapper.style.cssText;n.wrapper.style.cssText="position: absolute";var h=n.wrapper.getBoundingClientRect();o.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: "+(no?"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(so&&(d=window.scrollY),s.input.focus(),so&&window.scrollTo(null,d),s.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=!0,s.selForContextMenu=r.doc.sel,clearTimeout(s.detectingSelectAll),no&&ro>=9&&e(),wo){Ht(t);var f=function(){Lt(window,"mouseup",f),setTimeout(i,20)};Fo(window,"mouseup",f)}else setTimeout(i,50)}},readOnlyChanged:function(t){t||this.reset()},setUneditable:y,needsContentAttribute:!1},Js.prototype),function(t){function e(e,n,r,s){t.defaults[e]=n,r&&(i[e]=s?function(t,e,i){i!=xa&&r(t,e,i)}:r)}var i=t.optionHandlers;t.defineOption=e,t.Init=xa,e("value","",function(t,e){return t.setValue(e)},!0),e("mode",null,function(t,e){t.doc.modeOption=e,Wn(t)},!0),e("indentUnit",2,Wn,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(t){Bn(t),si(t),gn(t)},!0),e("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var i=[],n=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var s=t.text.indexOf(e,r);if(-1==s)break;r=s+e.length,i.push($(n,s))}n++});for(var r=i.length-1;r>=0;r--)Ar(t.doc,e,i[r],$(i[r].line,i[r].ch+e.length))}}),e("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e,i){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),i!=xa&&t.refresh()}),e("specialCharPlaceholder",fe,function(t){return t.refresh()},!0),e("electricChars",!0),e("inputStyle",po?"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",!vo),e("wholeLineUpdateBefore",!0),e("theme","default",function(t){Ps(t),Ls(t)},!0),e("keyMap","default",function(t,e,i){var n=os(e),r=i!=xa&&os(i);r&&r.detach&&r.detach(t,n),n.attach&&n.attach(t,r||null)}),e("extraKeys",null),e("lineWrapping",!1,Ns,!0),e("gutters",[],function(t){On(t.options),Ls(t)},!0),e("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?bi(t.display)+"px":"0",t.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(t){return qi(t)},!0),e("scrollbarStyle","native",function(t){Gi(t),qi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),e("lineNumbers",!1,function(t){On(t.options),Ls(t)},!0),e("firstLineNumber",1,Ls,!0),e("lineNumberFormatter",function(t){return t},Ls,!0),e("showCursorWhenSelecting",!1,Si,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("readOnly",!1,function(t,e){"nocursor"==e?(Oi(t),t.display.input.blur(),t.display.disabled=!0):t.display.disabled=!1,t.display.input.readOnlyChanged(e)}),e("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),e("dragDrop",!0,As),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,Si,!0),e("singleCursorHeightPerLine",!0,Si,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Bn,!0),e("addModeClass",!1,Bn,!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,Bn,!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)}(Os),function(t){var e=t.optionHandlers,i=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,i){var n=this.options,r=n[t];n[t]==i&&"mode"!=t||(n[t]=i,e.hasOwnProperty(t)&&dn(this,e[t])(this,i,r))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](os(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,i=0;in&&(_s(e,s.head.line,t,!0),n=s.head.line,r==e.doc.sel.primIndex&&tn(e));else{var o=s.from(),a=s.to(),l=Math.max(n,o.line);n=Math.min(e.lastLine(),a.line-(a.ch?0:1))+1;for(var c=l;c0&&ur(e.doc,r,new _n(o,u[r].to()),Po)}}}),getTokenAt:function(t,e){return re(this,t,e)},getLineTokens:function(t,e){return re(this,$(t),e,!0)},getTokenTypeAt:function(t){t=F(this.doc,t);var e,i=Qt(this,T(this.doc,t.line)),n=0,r=(i.length-1)/2,s=t.ch;if(0==s)e=i[2];else for(;;){var o=n+r>>1;if((o?i[2*o-1]:0)>=s)r=o;else{if(!(i[2*o+1]s&&(t=s,r=!0),n=T(this.doc,t)}else n=t;return li(this,n,{top:0,left:0},e||"page",i).top+(r?this.doc.height-pt(n):0)},defaultTextHeight:function(){return mi(this.display)},defaultCharWidth:function(){return vi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,i,n,r){var s=this.display;t=hi(this,F(this.doc,t));var o=t.bottom,a=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),s.sizer.appendChild(e),"over"==n)o=t.top;else if("above"==n||"near"==n){var l=Math.max(s.wrapper.clientHeight,this.doc.height),c=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?o=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(o=t.bottom),a+e.offsetWidth>c&&(a=c-e.offsetWidth)}e.style.top=o+"px",e.style.left=e.style.right="","right"==r?(a=s.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?a=0:"middle"==r&&(a=(s.sizer.clientWidth-e.offsetWidth)/2),e.style.left=a+"px"),i&&Xi(this,a,o,a+e.offsetWidth,o+e.offsetHeight)},triggerOnKeyDown:fn(ms),triggerOnKeyPress:fn(bs),triggerOnKeyUp:ys,execCommand:function(t){if(va.hasOwnProperty(t))return va[t].call(null,this)},triggerElectric:fn(function(t){Hs(this,t)}),findPosH:function(t,e,i,n){var r=this,s=1;e<0&&(s=-1,e=-e);for(var o=F(this.doc,t),a=0;a0&&a(i.charAt(n-1));)--n;for(;r.5)&&wi(this),At(this,"refresh",this)}),swapDoc:fn(function(t){var e=this.doc;return e.cm=null,Kn(this,t),si(this),this.display.input.reset(),this.scrollTo(t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,Se(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}},_t(t),t.registerHelper=function(e,n,r){i.hasOwnProperty(e)||(i[e]=t[e]={_global:[]}),i[e][n]=r},t.registerGlobalHelper=function(e,n,r,s){t.registerHelper(e,n,s),i[e]._global.push({pred:r,val:s})}}(Os);var Ta="iter insert remove copy getEditor constructor".split(" ");for(var Ma in aa.prototype)aa.prototype.hasOwnProperty(Ma)&&d(Ta,Ma)<0&&(Os.prototype[Ma]=function(t){return function(){return t.apply(this.doc,arguments)}}(aa.prototype[Ma]));return _t(aa),Os.inputStyles={textarea:Js,contenteditable:js},Os.defineMode=function(t){Os.defaults.mode||"null"==t||(Os.defaults.mode=t),jt.apply(this,arguments)},Os.defineMIME=Ut,Os.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),Os.defineMIME("text/plain","null"),Os.defineExtension=function(t,e){Os.prototype[t]=e},Os.defineDocExtension=function(t,e){aa.prototype[t]=e},Os.fromTextArea=Xs,function(t){t.off=Lt,t.on=Fo,t.wheelEventPixels=Vi,t.Doc=aa,t.splitLines=Vo,t.countColumn=u,t.findColumn=f,t.isWordChar=x,t.Pass=Eo,t.signal=At,t.Line=le,t.changeEnd=zn,t.scrollbarModel=na,t.Pos=$,t.cmpPos=_,t.modes=Uo,t.mimeModes=qo,t.resolveMode=qt,t.getMode=Kt,t.modeExtensions=Ko,t.extendMode=Gt,t.copyState=Yt,t.startState=Xt,t.innerMode=Jt,t.commands=va,t.keyMap=pa,t.keyName=ss,t.isModifierKey=rs,t.lookupKey=ns,t.normalizeKeyMap=is,t.StringStream=Go,t.SharedTextMarker=Wr,t.TextMarker=Rr,t.LineWidget=zr,t.e_preventDefault=It,t.e_stopPropagation=Dt,t.e_stop=Ht,t.addClass=o,t.contains=r,t.rmClass=Co,t.keyNames=ua}(Os),Os.version="5.21.0",Os})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.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"),n=this.getValueForTarget();if(t.get("changeProp"))e.set(i,n);else{var r=_.clone(e.get("attributes"));r[i]=n,e.set("attributes",r)}},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,i=this.target,n=t.get("name"),r={placeholder:t.get("placeholder")||t.get("default"),type:t.get("type")||"text"};if(t.get("changeProp"))r.value=i.get(n);else{var s=i.get("attributes");r.value=t.get("value")||s[n]}t.get("min")&&(r.min=t.get("min")),t.get("max")&&(r.max=t.get("max")),this.$input=e("",r)}return this.$input.get(0)},getModelValue:function(){var t,e=this.model,i=this.target,n=e.get("name");if(e.get("changeProp"))t=i.get(n);else{var r=i.get("attributes");t=e.get("value")||r[n]}return t},renderField:function(){if(!this.$input){this.$el.append(this.tmpl);var t=this.getInputEl();this.$el.find("."+this.inputhClass).prepend(t)}},render:function(){return this.renderLabel(),this.renderField(),this.el.className=this.className,this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=(i(0),i(3));t.exports=n.extend({tagName:"img",events:{dblclick:"openModal",click:"initResize"},initialize:function(t){n.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:src",this.updateSrc),this.listenTo(this.model,"dblclick active",this.openModal),this.classEmpty=this.ppfx+"plh-image",this.config.modal&&(this.modal=this.config.modal),this.config.am&&(this.am=this.config.am)},updateSrc:function(){var t=this.model.get("src");this.$el.attr("src",t),t?this.$el.removeClass(this.classEmpty):this.$el.addClass(this.classEmpty)},openModal:function(t){var e=this.opts.config.em,i=e?e.get("Editor"):"";i&&i.runCommand("open-assets",{target:this.model,onSelect:function(){i.Modal.close(),i.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,i){var n,r;(function(){function i(t){function e(e,i,n,r,s,o){for(;s>=0&&s0?0:a-1;return arguments.length<3&&(r=i[o?o[l]:l],l+=t),e(i,n,r,o,l,a)}}function s(t){return function(e,i,n){i=S(i,n);for(var r=L(e),s=t>0?0:r-1;s>=0&&s0?o=s>=0?s:Math.max(s+a,o):a=s>=0?Math.min(s+1,a):s+a+1;else if(i&&s&&a)return s=i(n,r),n[s]===r?s:-1;if(r!==r)return s=e(p.call(n,o,a),C.isNaN),s>=0?s+o:-1;for(s=t>0?o:a-1;s>=0&&s=0&&e<=P};C.each=C.forEach=function(t,e,i){e=k(e,i);var n,r;if(A(t))for(n=0,r=t.length;n=0},C.invoke=function(t,e){var i=p.call(arguments,2),n=C.isFunction(e);return C.map(t,function(t){var r=n?e:t[e];return null==r?r:r.apply(t,i)})},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,i){var n,r,s=-1/0,o=-1/0;if(null==e&&null!=t){t=A(t)?t:C.values(t);for(var a=0,l=t.length;as&&(s=n)}else e=S(e,i),C.each(t,function(t,i,n){((r=e(t,i,n))>o||r===-1/0&&s===-1/0)&&(s=t,o=r)});return s},C.min=function(t,e,i){var n,r,s=1/0,o=1/0;if(null==e&&null!=t){t=A(t)?t:C.values(t);for(var a=0,l=t.length;an||void 0===i)return 1;if(ie?(o&&(clearTimeout(o),o=null),a=c,s=t.apply(n,r),o||(n=r=null)):o||!1===i.trailing||(o=setTimeout(l,u)),s}},C.debounce=function(t,e,i){var n,r,s,o,a,l=function(){var c=C.now()-o;c=0?n=setTimeout(l,e-c):(n=null,i||(a=t.apply(s,r),n||(s=r=null)))};return function(){s=this,r=arguments,o=C.now();var c=i&&!n;return n||(n=setTimeout(l,e)),c&&(a=t.apply(s,r),s=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 i=e,n=t[e].apply(this,arguments);i--;)n=t[i].call(this,n);return n}},C.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},C.before=function(t,e){var i;return function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=null),i}},C.once=C.partial(C.before,2);var _=!{toString:null}.propertyIsEnumerable("toString"),I=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];C.keys=function(t){if(!C.isObject(t))return[];if(y)return y(t);var e=[];for(var i in t)C.has(t,i)&&e.push(i);return _&&a(t,e),e},C.allKeys=function(t){if(!C.isObject(t))return[];var e=[];for(var i in t)e.push(i);return _&&a(t,e),e},C.values=function(t){for(var e=C.keys(t),i=e.length,n=Array(i),r=0;r":">",'"':""","'":"'","`":"`"},H=C.invert(z),F=function(t){var e=function(e){return t[e]},i="(?:"+C.keys(t).join("|")+")",n=RegExp(i),r=RegExp(i,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(r,e):t}};C.escape=F(z),C.unescape=F(H),C.result=function(t,e,i){var n=null==t?void 0:t[e];return void 0===n&&(n=i),C.isFunction(n)?n.call(t):n};var R=0;C.uniqueId=function(t){var e=++R+"";return t?t+e:e},C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var V=/(.)^/,W={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\u2028|\u2029/g,j=function(t){return"\\"+W[t]};C.template=function(t,e,i){!e&&i&&(e=i),e=C.defaults({},e,C.templateSettings);var n=RegExp([(e.escape||V).source,(e.interpolate||V).source,(e.evaluate||V).source].join("|")+"|$","g"),r=0,s="__p+='";t.replace(n,function(e,i,n,o,a){return s+=t.slice(r,a).replace(B,j),r=a+e.length,i?s+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":n?s+="'+\n((__t=("+n+"))==null?'':__t)+\n'":o&&(s+="';\n"+o+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(e.variable||"obj","_",s)}catch(t){throw t.source=s,t}var a=function(t){return o.call(this,t,C)};return a.source="function("+(e.variable||"obj")+"){\n"+s+"}",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 i=C[e]=t[e];C.prototype[e]=function(){var t=[this._wrapped];return f.apply(t,arguments),U(this,i.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 i=this._wrapped;return e.apply(i,arguments),"shift"!==t&&"splice"!==t||0!==i.length||delete i[0],U(this,i)}}),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},n=[],void 0!==(r=function(){return C}.apply(e,n))&&(t.exports=r)}).call(this)},function(t,e,i){"use strict";(function(e){var n=(i(0),i(16));t.exports=_.extend({},n,{init:function(t){_.bindAll(this,"startDraw","draw","endDraw","rollback"),this.config=t||{},this.hType=this.config.newFixedH?"height":"min-height",this.allowDraw=1},enable:function(){n.enable.apply(this,arguments),this.$wr.css("cursor","crosshair"),this.allowDraw&&this.$wr.on("mousedown",this.startDraw),this.ghost=this.canvas.getGhostEl()},startDraw:function(t){t.preventDefault(),this.stopSelectPosition(),this.ghost.style.display="block",this.frameOff=this.getOffsetDim(),this.startPos={top:t.pageY+this.frameOff.top,left:t.pageX+this.frameOff.left},this.isDragged=!1,this.tempComponent={style:{}},this.beforeDraw(this.tempComponent),this.updateSize(this.startPos.top,this.startPos.left,0,0),this.toggleEvents(1)},toggleEvents:function(t){var i=t?"on":"off";this.$wr[i]("mousemove",this.draw),this.$wr[i]("mouseup",this.endDraw),this.$canvas[i]("mousemove",this.draw),e(document)[i]("mouseup",this.endDraw),e(document)[i]("keypress",this.rollback)},draw:function(t){this.isDragged=!0,this.updateComponentSize(t)},endDraw:function(t){this.toggleEvents();var e={};if(this.isDragged){this.updateComponentSize(t),this.setRequirements(this.tempComponent);var i=this.sorter.lastPos;e=this.create(this.sorter.target,this.tempComponent,i.index,i.method),this.sorter.prevTarget=null}this.ghost.style.display="none",this.startSelectPosition(),this.afterDraw(e)},create:function(t,i,n,r,s){n="after"===r?n+1:n;var o=s||{},a=e(t),l=a.data("model"),c=a.data("collection"),u=l?l.get("droppable"):1;if(o.at=n,c&&u)return c.add(i,o);console.warn("Invalid target position")},setRequirements:function(t){var e=this.config,i=t.style;i.width.replace(/\D/g,"")\n
<%= title %>
\n multiple/>\n
\n\n'),events:{},initialize:function(t){this.options=t||{},this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=this.collection||{},this.uploadId=this.pfx+"uploadFile",this.disabled=!this.config.upload,this.events["change #"+this.uploadId]="uploadFile",this.delegateEvents()},uploadFile:function(t){for(var i=t.dataTransfer?t.dataTransfer.files:t.target.files,n=new FormData,r=0;rinput-holder\'>
\n
\n
\n
\n
\n
'),initialize:function(t){n.prototype.initialize.apply(this,arguments);var e=this.ppfx;this.colorCls=e+"field-color-picker",this.inputClass=e+"field "+e+"field-color",this.colorHolderClass=e+"field-colorp-c",this.listenTo(this.model,"change:value",this.handleModelChange)},handleModelChange:function(){n.prototype.handleModelChange.apply(this,arguments);var t=this.model.get("value"),e=this.getColorEl();t="none"===t?"#fff":t,e.spectrum("set",t),e.get(0).style.backgroundColor=t},getColorEl:function(){if(!this.colorEl){var t=this.model,i=e("
",{class:this.colorCls}),n=i.get(0).style,r=this.target&&this.target.config?this.target.config.el:"";i.spectrum({appendTo:r||"body",maxSelectionSize:8,showPalette:!0,showAlpha:!0,chooseText:"Ok",cancelText:"⨯",palette:[],move:function(t){var e=1==t.getAlpha()?t.toHexString():t.toRgbString();n.backgroundColor=e},change:function(e){var i=1==e.getAlpha()?e.toHexString():e.toRgbString();i=i.replace(/ /g,""),n.backgroundColor=i,t.set("value",i)}}),this.colorEl=i}return this.colorEl},render:function(){return n.prototype.render.apply(this,arguments),this.$el.find("."+this.colorHolderClass).html(this.getColorEl()),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({events:{},template:_.template('\n input-holder\'>\n field-units\'>\n
\n
\n
\n
'),initialize:function(t){_.bindAll(this,"moveIncrement","upIncrement");var i=t||{},n=i.ppfx||"",r=i.contClass||n+"field";this.ppfx=n,this.docEl=e(document),this.inputCls=n+"input-number",this.unitCls=n+"input-unit",this.contClass=r,this.events["click ."+n+"field-arrow-u"]="upArrowClick",this.events["click ."+n+"field-arrow-d"]="downArrowClick",this.events["mousedown ."+n+"field-arrows"]="downIncrement",this.events["change ."+this.inputCls]="handleChange",this.events["change ."+this.unitCls]="handleUnitChange",this.listenTo(this.model,"change:unit change:value",this.handleModelChange),this.delegateEvents()},setValue:function(t,e){var i=e||{},n=this.validateInputValue(t,{deepCheck:1}),r={value:n.value};(n.unit||n.force)&&(r.unit=n.unit),this.model.set(r,i),i.silent&&this.handleModelChange()},handleChange:function(t){t.stopPropagation(),this.setValue(this.getInputEl().value)},handleUnitChange:function(t){t.stopPropagation();var e=this.getUnitEl().value;this.model.set("unit",e)},handleModelChange:function(){var t=this.model;this.getInputEl().value=t.get("value");var e=this.getUnitEl();e&&(e.value=t.get("unit"))},getInputEl:function(){return this.inputEl||(this.inputEl=e("",{type:"text",class:this.inputCls,placeholder:this.model.get("defaults")})),this.inputEl.get(0)},getUnitEl:function(){if(!this.unitEl){var t=this.model,i=t.get("units")||[];if(i.length){var n='",this.unitEl=e(n)}}return this.unitEl&&this.unitEl.get(0)},upArrowClick:function(){var t=this.model.get("value");t=isNaN(t)?1:parseInt(t,10)+1;var e=this.validateInputValue(t);this.model.set("value",e.value)},downArrowClick:function(){var t=this.model.get("value");t=isNaN(t)?0:parseInt(t,10)-1;var e=this.validateInputValue(t);this.model.set("value",e.value)},downIncrement:function(t){t.preventDefault(),this.moved=0;var e=this.model.get("value");e=isNaN(e)?0:parseInt(e,10);var i={y:t.pageY,val:e};this.docEl.mouseup(i,this.upIncrement),this.docEl.mousemove(i,this.moveIncrement)},moveIncrement:function(t){this.moved=1;var e=parseInt(t.data.val-t.pageY+t.data.y,10);return this.prValue=this.validateInputValue(e).value,this.model.set("value",this.prValue,{avoidStore:1}),!1},upIncrement:function(t){if(this.docEl.off("mouseup",this.upIncrement),this.docEl.off("mousemove",this.moveIncrement),this.prValue&&this.moved){var e=this.prValue-1;this.model.set("value",e,{avoidStore:1}).set("value",e+1)}},validateInputValue:function(t,e){var i=0,n=e||{},r=this.model,s=t||r.get("defaults"),o=r.get("units")||[],a=r.get("unit")||o.length&&o[0]||"",l=r.get("max"),c=r.get("min");if(n.deepCheck){var u=r.get("fixedValues")||[];if(s){var h=new RegExp("^"+u.join("|"),"g");if(u.length&&h.test(s))s=s.match(h)[0],a="",i=1;else{var d=s+"";s+="",s=parseFloat(s.replace(",",".")),s=isNaN(s)?r.get("defaults"):s;var f=d.replace(s,"");_.indexOf(o,f)>=0&&(a=f)}}}return void 0!==l&&""!==l&&(s=s>l?l:s),void 0!==c&&""!==c&&(s=s",{class:"clear"})),this.$el.attr("class",this.pfx+"properties"),this}})}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=(i(0),i(4));t.exports=n.extend({template:_.template('\n
\n \tinput-holder\'>\n
\n
'),initialize:function(t){n.prototype.initialize.apply(this,arguments),_.bindAll(this,"build"),this.config=t.config||{},this.className=this.className+" "+this.pfx+"composite"},valueUpdated:function(){this.model.get("detached")||n.prototype.valueUpdated.apply(this,arguments)},renderInput:function(){var t=this.model,n=t.get("properties")||[];if(n.length&&(this.$input||(this.$input=e("",{value:0,type:"hidden"})),this.props||(this.props=t.get("properties")),!this.$props)){this.props.each(function(e,i){e&&"composite"==e.get("type")&&(this.props.remove(e),console.warn("Nested composite types not yet allowed.")),e.parent=t},this);var r=i(35),s=new r(this.getPropsConfig());this.$props=s.render().$el,this.$el.find("#"+this.pfx+"input-holder").html(this.$props)}},getPropsConfig:function(t){var e=this,i={config:this.config,collection:this.props,target:this.target,propTarget:this.propTarget,onChange:function(t,i,n){var r=e.build();e.model.set("value",r,n)},customValue:function(t,i){return e.valueOnIndex(i,t)}};return this.model.get("detached")&&delete i.onChange,i},getDefaultValue:function(){var t="";return this.props.each(function(e,i){t+=e.get("defaults")+e.get("unit")+" "}),t.replace(/ +$/,"")},valueOnIndex:function(t,e){var i=null,n=this.getComponentValue().split(" ");if(n.length&&n[t]&&(i=n[t],e&&e.model&&e.model.get("functionName"))){var r=this.fetchFromFunction(i);r&&(i=r)}return i},build:function(t,e,i){var n="";return this.model.get("properties").each(function(t){var e=t.getValue();func=t.get("functionName"),func&&(e=func+"("+e+")"),n+=e+" "}),n.replace(/ +$/,"")}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(182),s=i(183);t.exports=n.Collection.extend({model:r,setTarget:function(t){this.target=t},add:function(t,e){if("string"==typeof t||t instanceof Array){"string"==typeof t&&(t=[t]);for(var i=0,r=t.length;i*\/]/.test(i)?n(null,"select-op"):"."==i&&t.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(i)?n(null,i):"u"==i&&t.match(/rl(-prefix)?\(/)||"d"==i&&t.match("omain(")||"r"==i&&t.match("egexp(")?(t.backUp(1),e.tokenize=o,n("property","word")):/[\w\\\-]/.test(i)?(t.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(t.peek())?(t.eatWhile(/[\w.%]/),n("number","unit")):t.match(/^-[\w\\\-]+/)?(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):t.match(/^\w+-/)?n("meta","meta"):void 0}function s(t){return function(e,i){for(var r,s=!1;null!=(r=e.next());){if(r==t&&!s){")"==t&&e.backUp(1);break}s=!s&&"\\"==r}return(r==t||!s&&")"!=t)&&(i.tokenize=null),n("string","string")}}function o(t,e){return t.next(),t.match(/\s*[\"\')]/,!1)?e.tokenize=null:e.tokenize=s(")"),n(null,"(")}function a(t,e,i){this.type=t,this.indent=e,this.prev=i}function l(t,e,i,n){return t.context=new a(i,e.indentation()+(!1===n?0:m),t.context),i}function c(t){return t.context.prev&&(t.context=t.context.prev),t.context.type}function u(t,e,i){return A[i.context.type](t,e,i)}function h(t,e,i,n){for(var r=n||1;r>0;r--)i.context=i.context.prev;return u(t,e,i)}function d(t){var e=t.current().toLowerCase();g=E.hasOwnProperty(e)?"atom":M.hasOwnProperty(e)?"keyword":"variable"}var f=i.inline;i.propertyKeywords||(i=t.resolveMode("text/css"));var p,g,m=e.indentUnit,v=i.tokenHooks,y=i.documentTypes||{},b=i.mediaTypes||{},x=i.mediaFeatures||{},w=i.mediaValueKeywords||{},C=i.propertyKeywords||{},k=i.nonStandardPropertyKeywords||{},S=i.fontProperties||{},T=i.counterDescriptors||{},M=i.colorKeywords||{},E=i.valueKeywords||{},P=i.allowNested,L=!0===i.supportsAtComponent,A={};return A.top=function(t,e,i){if("{"==t)return l(i,e,"block");if("}"==t&&i.context.prev)return c(i);if(L&&/@component/.test(t))return l(i,e,"atComponentBlock");if(/^@(-moz-)?document$/.test(t))return l(i,e,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(t))return l(i,e,"atBlock");if(/^@(font-face|counter-style)/.test(t))return i.stateArg=t,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(t))return"keyframes";if(t&&"@"==t.charAt(0))return l(i,e,"at");if("hash"==t)g="builtin";else if("word"==t)g="tag";else{if("variable-definition"==t)return"maybeprop";if("interpolation"==t)return l(i,e,"interpolation");if(":"==t)return"pseudo";if(P&&"("==t)return l(i,e,"parens")}return i.context.type},A.block=function(t,e,i){if("word"==t){var n=e.current().toLowerCase();return C.hasOwnProperty(n)?(g="property","maybeprop"):k.hasOwnProperty(n)?(g="string-2","maybeprop"):P?(g=e.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(g+=" error","maybeprop")}return"meta"==t?"block":P||"hash"!=t&&"qualifier"!=t?A.top(t,e,i):(g="error","block")},A.maybeprop=function(t,e,i){return":"==t?l(i,e,"prop"):u(t,e,i)},A.prop=function(t,e,i){if(";"==t)return c(i);if("{"==t&&P)return l(i,e,"propBlock");if("}"==t||"{"==t)return h(t,e,i);if("("==t)return l(i,e,"parens");if("hash"!=t||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(e.current())){if("word"==t)d(e);else if("interpolation"==t)return l(i,e,"interpolation")}else g+=" error";return"prop"},A.propBlock=function(t,e,i){return"}"==t?c(i):"word"==t?(g="property","maybeprop"):i.context.type},A.parens=function(t,e,i){return"{"==t||"}"==t?h(t,e,i):")"==t?c(i):"("==t?l(i,e,"parens"):"interpolation"==t?l(i,e,"interpolation"):("word"==t&&d(e),"parens")},A.pseudo=function(t,e,i){return"word"==t?(g="variable-3",i.context.type):u(t,e,i)},A.documentTypes=function(t,e,i){return"word"==t&&y.hasOwnProperty(e.current())?(g="tag",i.context.type):A.atBlock(t,e,i)},A.atBlock=function(t,e,i){if("("==t)return l(i,e,"atBlock_parens");if("}"==t||";"==t)return h(t,e,i);if("{"==t)return c(i)&&l(i,e,P?"block":"top");if("interpolation"==t)return l(i,e,"interpolation");if("word"==t){var n=e.current().toLowerCase();g="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":x.hasOwnProperty(n)?"property":w.hasOwnProperty(n)?"keyword":C.hasOwnProperty(n)?"property":k.hasOwnProperty(n)?"string-2":E.hasOwnProperty(n)?"atom":M.hasOwnProperty(n)?"keyword":"error"}return i.context.type},A.atComponentBlock=function(t,e,i){return"}"==t?h(t,e,i):"{"==t?c(i)&&l(i,e,P?"block":"top",!1):("word"==t&&(g="error"),i.context.type)},A.atBlock_parens=function(t,e,i){return")"==t?c(i):"{"==t||"}"==t?h(t,e,i,2):A.atBlock(t,e,i)},A.restricted_atBlock_before=function(t,e,i){return"{"==t?l(i,e,"restricted_atBlock"):"word"==t&&"@counter-style"==i.stateArg?(g="variable","restricted_atBlock_before"):u(t,e,i)},A.restricted_atBlock=function(t,e,i){return"}"==t?(i.stateArg=null,c(i)):"word"==t?(g="@font-face"==i.stateArg&&!S.hasOwnProperty(e.current().toLowerCase())||"@counter-style"==i.stateArg&&!T.hasOwnProperty(e.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},A.keyframes=function(t,e,i){return"word"==t?(g="variable","keyframes"):"{"==t?l(i,e,"top"):u(t,e,i)},A.at=function(t,e,i){return";"==t?c(i):"{"==t||"}"==t?h(t,e,i):("word"==t?g="tag":"hash"==t&&(g="builtin"),"at")},A.interpolation=function(t,e,i){return"}"==t?c(i):"{"==t||";"==t?h(t,e,i):("word"==t?g="variable":"variable"!=t&&"("!=t&&")"!=t&&(g="error"),"interpolation")},{startState:function(t){return{tokenize:null,state:f?"block":"top",stateArg:null,context:new a(f?"block":"top",t||0,null)}},token:function(t,e){if(!e.tokenize&&t.eatSpace())return null;var i=(e.tokenize||r)(t,e);return i&&"object"==typeof i&&(p=i[1],i=i[0]),g=i,e.state=A[e.state](p,t,e),g},indent:function(t,e){var i=t.context,n=e&&e.charAt(0),r=i.indent;return"prop"!=i.type||"}"!=n&&")"!=n||(i=i.prev),i.prev&&("}"!=n||"block"!=i.type&&"top"!=i.type&&"interpolation"!=i.type&&"restricted_atBlock"!=i.type?(")"!=n||"parens"!=i.type&&"atBlock_parens"!=i.type)&&("{"!=n||"at"!=i.type&&"atBlock"!=i.type)||(r=Math.max(0,i.indent-m),i=i.prev):(i=i.prev,r=i.indent)),r},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],r=e(n),s=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=e(s),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],l=e(a),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=e(c),h=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=e(h),f=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],p=e(f),g=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=e(g),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=e(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],x=e(b),w=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],C=e(w),k=n.concat(s).concat(a).concat(c).concat(h).concat(f).concat(b).concat(w);t.registerHelper("hintWords","css",k),t.defineMIME("text/css",{documentTypes:r,mediaTypes:o,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:x,valueKeywords:C,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=i,i(t,e))}},name:"css"}),t.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,colorKeywords:x,valueKeywords:C,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=i,i(t,e)):["operator","operator"]},":":function(t){return!!t.match(/\s*\{/)&&[null,"{"]},$:function(t){return t.match(/^[\w-]+/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(t){return!!t.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),t.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,colorKeywords:x,valueKeywords:C,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=i,i(t,e)):["operator","operator"]},"@":function(t){return t.eat("{")?[null,"interpolation"]:!t.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),t.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:o,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:p,fontProperties:m,counterDescriptors:y,colorKeywords:x,valueKeywords:C,supportsAtComponent:!0,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=i,i(t,e))}},name:"css",helperType:"gss"})})},function(t,e,i){!function(e){function i(t,e){for(var i=t.length;i--;)if(t[i]===e)return i;return-1}function n(t,e){if(t.length!=e.length)return!1;for(var i=0;i0;for(s in C)(!C[s]&&i(n.mods,+s)>-1||C[s]&&-1==i(n.mods,+s))&&(a=!1);(0!=n.mods.length||C[16]||C[18]||C[17]||C[91])&&!a||!1===n.method(t,n)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function o(t){var e,n=t.keyCode,r=i(E,n);if(r>=0&&E.splice(r,1),93!=n&&224!=n||(n=91),n in C){C[n]=!1;for(e in S)S[e]==n&&(l[e]=!1)}}function a(){for(x in C)C[x]=!1;for(x in S)l[x]=!1}function l(t,e,i){var n,r;n=m(t),void 0===i&&(i=e,e="all");for(var s=0;s1&&(r=v(t),t=[t[t.length-1]]),t=t[0],t=M(t),t in w||(w[t]=[]),w[t].push({shortcut:n[s],scope:e,method:i,key:n[s],mods:r})}function c(t,e){var i,r,s,o,a,l=[];for(i=m(t),o=0;o1&&(l=v(r),t=r[r.length-1]),t=M(t),void 0===e&&(e=p()),!w[t])return;for(s=0;so?n.h=Math.round(n.w/o):n.w=Math.round(n.h*o)}return~r.indexOf("l")&&(n.l=i.w-n.w),~r.indexOf("t")&&(n.t=i.h-n.h),n}}}}).call(e,i(1))},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({initialize:function(t){this.opt=t||{},_.bindAll(this,"startSort","onMove","endMove","rollback","udpateOffset","moveDragHelper");var i=t||{};this.elT=0,this.elL=0,this.borderOffset=i.borderOffset||10;var n=i.container;this.el="string"==typeof n?document.querySelector(n):n,this.$el=e(this.el),this.containerSel=i.containerSel||"div",this.itemSel=i.itemSel||"div",this.draggable=i.draggable||!0,this.nested=i.nested||0,this.pfx=i.pfx||"",this.ppfx=i.ppfx||"",this.freezeClass=i.freezeClass||this.pfx+"freezed",this.onStart=i.onStart||"",this.onEndMove=i.onEndMove||"",this.direction=i.direction||"v",this.onMoveClb=i.onMove||"",this.relative=i.relative||0,this.plh=i.placer||"",this.wmargin=i.wmargin||0,this.offTop=i.offsetTop||0,this.offLeft=i.offsetLeft||0,this.document=i.document||document,this.$document=e(this.document),this.dropContent=null,this.em=i.em||"",this.dragHelper=null,this.canvasRelative=i.canvasRelative||0,this.em&&this.em.on&&(this.em.on("change:canvasOffset",this.udpateOffset),this.udpateOffset())},getContainerEl:function(){if(!this.el){var t=this.opt.container;this.el="string"==typeof t?document.querySelector(t):t,this.$el=e(this.el)}return this.el},udpateOffset:function(){var t=this.em.get("canvasOffset");this.offTop=t.top,this.offLeft=t.left},setDropContent:function(t){this.dropContent=t},toggleSortCursor:function(t){var e=this.em,i=document.body,n=this.ppfx||this.pfx,r=n+"grabbing",s=e?e.get("Canvas").getBody():"";t?(i.className+=" "+r,e&&(s.className+=" "+r)):(i.className=i.className.replace(r,"").trim(),e&&(s.className=s.className.replace(r,"").trim()))},setDragHelper:function(t,i){for(var n=i||"",r=t.cloneNode(1),s="",o=getComputedStyle(t),a=0;ao||o>a+c-r||l+r>s||s>l+u-r)&&(n=1),!!n},findPosition:function(t,e,i){for(var n={index:0,method:"before"},r=0,s=0,o=0,a=0,l=0,c=0,u=0,h=0,d=0,f=t.length;ds||a&&c>=a||r&&o\n
\n
\n
\n
\n\t
<%= name %>
\n\t
<%= dim %>
\n
\n
\n
\n'),initialize:function(t){n.prototype.initialize.apply(this,arguments),this.className+=" "+this.pfx+"asset-image",this.events["click #"+this.pfx+"close"]="removeItem",this.delegateEvents()},handleClick:function(){var t=this.config.onClick,e=this.model;e.collection.trigger("deselectAll"),this.$el.addClass(this.pfx+"highlight"),"function"==typeof t?t(e):this.updateTarget(e.get("src"))},handleDblClick:function(){var t=this.config.onDblClick,e=this.model;"function"==typeof t?t(e):this.updateTarget(e.get("src"));var i=e.collection.onSelect;"function"==typeof i&&i(this.model)},updateTarget:function(t){var e=this.model.collection.target;if(e&&e.set){var i=_.clone(e.get("attributes"));e.set("attributes",i),e.set("src",t)}},removeItem:function(t){t.stopPropagation(),this.model.collection.remove(this.model)},render:function(){var t=this.model.get("name"),e=this.model.get("width")&&this.model.get("height")?this.model.get("width")+" x "+this.model.get("height"):"";return t=t||this.model.get("src").split("/").pop(),t=t&&t.length>30?t.substring(0,30)+"...":t,e=e?e+(this.model.get("unitDim")?this.model.get("unitDim"):" px"):"",this.$el.html(this.template({name:t,src:this.model.get("src"),dim:e,pfx:this.pfx,ppfx:this.ppfx})),this.$el.attr("class",this.className),this}})},function(t,e,i){"use strict";var n=i(0),r=i(13),s=i(49);i(14);t.exports=n.View.extend({template:_.template('\n
\n
\n
\n
\n \n
\n \n
\n
\n \n
\n
\n
\n
\n\n'),initialize:function(t){this.options=t,this.config=t.config,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.collection,"add",this.addToAsset),this.listenTo(this.collection,"deselectAll",this.deselectAll),this.className=this.pfx+"assets",this.events={},this.events.submit="addFromStr",this.delegateEvents()},addFromStr:function(t){t.preventDefault();var e=this.getInputUrl(),i=e.value.trim();if(i)return this.collection.addImg(i,{at:0}),this.getAssetsEl().scrollTop=0,e.value="",this},getAssetsEl:function(){return this.assets=this.el.querySelector("."+this.pfx+"assets"),this.assets},getInputUrl:function(){return this.inputUrl&&this.inputUrl.value||(this.inputUrl=this.el.querySelector("."+this.pfx+"add-asset input")),this.inputUrl},addToAsset:function(t){this.addAsset(t)},addAsset:function(t,e){var i=e||null,n=r;t.get("type").indexOf("image")>-1&&(n=s);var o=new n({model:t,config:this.config}),a=o.render().el;if(i)i.appendChild(a);else{var l=this.getAssetsEl();l&&l.insertBefore(a,l.firstChild)}return a},deselectAll:function(){this.$el.find("."+this.pfx+"highlight").removeClass(this.pfx+"highlight")},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addAsset(e,t)},this),this.$el.html(this.template({pfx:this.pfx,ppfx:this.ppfx,btnText:this.config.addBtnText})),this.$el.find("."+this.pfx+"assets").append(t),this}})},function(t,e,i){"use strict";t.exports={blocks:[]}},function(t,e,i){"use strict";t.exports=function(){var t,e,n={},r=i(51),s=i(54),o=i(56);return{name:"BlockManager",init:function(i){n=i||{};for(var a in r)a in n||(n[a]=r[a]);return t=new s(n.blocks),e=new o({collection:t},n),this},add:function(e,i){var n=i||{};return n.id=e,t.add(n)},get:function(e){return t.get(e)},getAll:function(){return t},render:function(){return e.render().el}}}},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{label:"",content:"",attributes:{}}})},function(t,e,i){"use strict";var n=i(0),r=i(53);t.exports=n.Collection.extend({model:r})},function(t,e,i){"use strict";(function(e){var n=i(0);t.exports=n.View.extend({events:{mousedown:"onDrag"},initialize:function(t,i){_.bindAll(this,"onDrop"),this.config=i||{},this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.model,"destroy",this.remove),this.doc=e(document)},onDrag:function(t){if(this.config.getSorter){this.config.em.refreshCanvas();var e=this.config.getSorter();e.setDragHelper(this.el,t),e.startSort(this.el),e.setDropContent(this.model.get("content")),this.doc.on("mouseup",this.onDrop)}},onDrop:function(){this.doc.off("mouseup",this.onDrop),this.config.getSorter().endMove()},render:function(){var t=this.ppfx+"block";return this.$el.addClass(t),this.el.innerHTML='
'+this.model.get("label")+"
",this}})}).call(e,i(1))},function(t,e,i){"use strict";var n=i(0),r=i(55);t.exports=n.View.extend({initialize:function(t,e){_.bindAll(this,"getSorter","onDrag","onDrop"),this.config=e||{},this.ppfx=this.config.pStylePrefix||"",this.listenTo(this.collection,"add",this.addTo),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,document:e.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1,em:this.em,canvasRelative:1})}return this.sorter}},onDrag:function(){this.em.stopDefault()},onDrop:function(t){this.em.runDefault(),t&&t.get&&(t.get("activeOnRender")&&(t.trigger("active"),t.set("activeOnRender",0)),this.em.initChildrenComp(t))},addTo:function(t){this.add(t)},add:function(t,e){var i=e||null,n=new r({model:t,attributes:t.get("attributes")},this.config),s=n.render().el;i?i.appendChild(s):this.$el.append(s)},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.add(e,t)},this),this.$el.append(t),this.$el.addClass(this.ppfx+"blocks-c"),this}})},function(t,e,i){"use strict";t.exports={stylePrefix:"cv-",rulers:!1,scripts:[]}},function(t,e,i){"use strict";t.exports=function(){var t,e={},n=i(57),r=i(59),s=i(61);return{getCanvasView:function(){return s},name:"Canvas",init:function(i){e=i||{};for(var o in n)o in e||(e[o]=n[o]);var a=e.pStylePrefix;a&&(e.stylePrefix=a+e.stylePrefix),t=new r(i),s=new s({model:t,config:e});var l=e.em.get("DomComponents");return l&&this.setWrapper(l),this},setWrapper:function(e){t.set("wrapper",e)},getElement:function(){return s.el},getFrameEl:function(){return s.frame.el},getBody:function(){return s.frame.el.contentDocument.body},getWrapperEl:function(){return this.getBody().querySelector("#wrapper")},getToolsEl:function(){return s.toolsEl},getHighlighter:function(){return s.hlEl},getBadgeEl:function(){return s.badgeEl},getPlacerEl:function(){return s.placerEl},getGhostEl:function(){return s.ghostEl},getToolbarEl:function(){return s.toolbarEl},getResizerEl:function(){return s.resizerEl},getOffsetViewerEl:function(){return s.offsetEl},getFixedOffsetViewerEl:function(){return s.fixedOffsetEl},render:function(){return s.render().el},getOffset:function(){var t=this.offset(this.getFrameEl()),e=this.offset(this.getElement());return{top:t.top-e.top,left:t.left-e.left}},offset:function(t){var e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},getElementPos:function(t){return s.getElementPos(t)},getTargetToElementDim:function(t,i,n){var r=n||{},o=s.getPosition(),a=r.elPos||s.getElementPos(i),l=n.toRight||0,c=r.targetHeight||t.offsetHeight,u=r.targetWidth||t.offsetWidth,h=r.event||null,d=a.top-c,f=a.left;f+=l?a.width:0,f=l?f-u:f;var p=fa.top+a.height?a.top+a.height:g;var m={top:g,left:p,elementTop:a.top,elementLeft:a.left,elementWidth:a.width,elementHeight:a.height,targetWidth:t.offsetWidth,targetHeight:t.offsetHeight,canvasTop:o.top,canvasLeft:o.left};return h&&e.em&&e.em.trigger(h,m),m},getMouseRelativePos:function(t,e){var i=e||{},n=0,r=0,s=i.subWinOffset,o=t.target.ownerDocument,a=o.defaultView||o.parentWindow,l=a.frameElement,c=s?a.pageYOffset:0,u=s?a.pageXOffset:0;if(l){var h=l.getBoundingClientRect();n=h.top||0,r=h.left||0}return{y:t.clientY+n-c,x:t.clientX+r-u}},getMouseRelativeCanvas:function(t,e){var i=this.getFrameEl(),n=this.getBody(),r=i.offsetTop||0,s=i.offsetLeft||0,o=n.scrollTop||0,a=n.scrollLeft||0;return{y:t.clientY+r+o,x:t.clientX+s+a}},getFrameWrapperEl:function(){return s.frame.getWrapper()}}}},function(t,e,i){"use strict";var n=i(0),r=i(60);t.exports=n.Model.extend({defaults:{frame:"",wrapper:"",rulers:!1},initialize:function(t){var e=this.conf||{};this.set("frame",new r(e.frame))}})},function(t,e,i){"use strict";var n=i(0);t.exports=n.Model.extend({defaults:{wrapper:"",width:"",height:"",attributes:{}}})},function(t,e,i){"use strict";(function(e){var n=i(0),r=i(62);t.exports=n.View.extend({initialize:function(t){_.bindAll(this,"renderBody","onFrameScroll","clearOff"),this.config=t.config||{},this.em=this.config.em||{},this.ppfx=this.config.pStylePrefix||"",this.className=this.config.stylePrefix+"canvas",this.listenTo(this.em,"change:canvasOffset",this.clearOff),this.frame=new r({model:this.model.get("frame"),config:this.config})},onFrameScroll:function(){var t=this.frame.el.contentDocument.body;this.toolsEl.style.top="-"+t.scrollTop+"px",this.toolsEl.style.left="-"+t.scrollLeft+"px",this.em.trigger("canvasScroll")},renderScripts:function(){var t=this.frame,e=this;t.el.onload=function(){function i(n){if(n.length>0){var r=document.createElement("script");r.type="text/javascript",r.src=n.shift(),r.onerror=r.onload=i.bind(null,n),t.el.contentDocument.head.appendChild(r)}else e.renderBody()}var n=e.config.scripts.slice(0);i(n)}},renderBody:function(){var t=this.model.get("frame").get("wrapper"),e=this.config.em;if(t){var i=this.ppfx,n=this.frame.$el.contents().find("body"),r=e.get("CssComposer"),s=e.get("Config");n.append(t.render()).append(r.render());var o=s.protectedCss,a="* {box-sizing: border-box;} body{margin:0;height:auto;background-color:#fff} #wrapper{min-height:100%; overflow:auto}."+i+"dashed :not([contenteditable]) > *[data-highlightable]{outline: 1px dashed rgba(170,170,170,0.7); outline-offset: -2px}."+i+"comp-selected{outline: 3px solid #3b97e3 !important}."+i+"no-select{user-select: none; -webkit-user-select:none; -moz-user-select: none}."+i+"freezed{opacity: 0.5; pointer-events: none}."+i+"no-pointer{pointer-events: none}."+i+"plh-image{background:#f5f5f5; border:none; height:50px; width:50px; display:block; outline:3px solid #ffca6f; cursor:pointer}."+i+"grabbing{cursor: grabbing; cursor: -webkit-grabbing}* ::-webkit-scrollbar-track {background: rgba(0, 0, 0, 0.1)}* ::-webkit-scrollbar-thumb {background: rgba(255, 255, 255, 0.2)}* ::-webkit-scrollbar {width: 10px}"+(s.canvasCss||"");a+=o||"",n.append(""),n.append(this.getJsContainer()),e.trigger("loaded"),this.frame.el.contentWindow.onscroll=this.onFrameScroll,this.frame.udpateOffset();var l=document,c=this.frame.el.contentDocument;c.addEventListener("keydown",function(t){l.dispatchEvent(new KeyboardEvent(t.type,t))}),c.addEventListener("keyup",function(t){l.dispatchEvent(new KeyboardEvent(t.type,t))})}},offset:function(t){var e=t.getBoundingClientRect(),i=t.ownerDocument.body;return{top:e.top+i.scrollTop,left:e.left+i.scrollLeft}},clearOff:function(){this.frmOff=null,this.cvsOff=null},getFrameOffset:function(){return this.frmOff||(this.frmOff=this.offset(this.frame.el)),this.frmOff},getCanvasOffset:function(){return this.cvsOff||(this.cvsOff=this.offset(this.el)),this.cvsOff},getElementPos:function(t){var e=this.getFrameOffset(),i=this.getCanvasOffset(),n=this.offset(t);return{top:n.top+e.top-i.top,left:n.left+e.left-i.left,height:t.offsetHeight,width:t.offsetWidth}},getPosition:function(){var t=this.frame.el.contentDocument.body,e=this.getFrameOffset(),i=this.getCanvasOffset();return{top:e.top+t.scrollTop-i.top,left:e.left+t.scrollLeft-i.left}},updateScript:function(t){t.scriptContainer||(t.scriptContainer=e("
"),this.getJsContainer().append(t.scriptContainer.get(0)));var i=t.model.cid,n=t.model.get("script"),r="function(){"+n+"}";r="function"==typeof n?n.toString():r,t.el.id=i,t.scriptContainer.html(""),t.scriptContainer.append(' diff --git a/package.json b/package.json index 75291d4e66..a33b049d89 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grapesjs", "description": "Free and Open Source Web Builder Framework", - "version": "0.5.43", + "version": "0.5.46", "author": "Artur Arseniev", "license": "BSD-3-Clause", "homepage": "http://grapesjs.com", diff --git a/src/index.js b/src/index.js index d0c72180bd..03021ac741 100644 --- a/src/index.js +++ b/src/index.js @@ -1,2 +1 @@ -const grapesjs = require('./grapesjs'); -module.exports = grapesjs; +module.exports = require('./grapesjs'); diff --git a/src/wrappers/jquery.js b/src/wrappers/jquery.js deleted file mode 100644 index 89f47a3011..0000000000 --- a/src/wrappers/jquery.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = jQuery; diff --git a/webpack.config.js b/webpack.config.js index df1c6c303d..a801f51939 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,5 @@ //webpack --display-reasons //Remove jquery https://github.com/webpack/webpack/issues/1275 -//Migrateing https://webpack.js.org/guides/migrating/ var webpack = require('webpack'); var pkg = require('./package.json'); var env = process.env.WEBPACK_ENV; @@ -27,6 +26,7 @@ module.exports = { library: 'grapesjs', libraryTarget: 'umd', }, + externals: {jquery: 'jQuery'}, plugins: plugins, module: { loaders: [{