1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
invoiceninja/public/js/grapesjs.min.js
2018-03-21 16:11:09 +02:00

21 lines
594 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grapesjs=e():t.grapesjs=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=59)}([function(t,e,n){(function(i){var r,o;!function(s){var a="object"==typeof self&&self.self===self&&self||"object"==typeof i&&i.global===i&&i;r=[n(1),n(9),e],o=function(t,e,n){a.Backbone=s(a,n,t,e)}.apply(e,r),!(void 0!==o&&(t.exports=o))}(function(t,e,n,i){var r=t.Backbone,o=Array.prototype.slice;e.VERSION="1.3.3",e.$=i,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var s=function(t,e,i){switch(t){case 1:return function(){return n[e](this[i])};case 2:return function(t){return n[e](this[i],t)};case 3:return function(t,r){return n[e](this[i],l(t,this),r)};case 4:return function(t,r,o){return n[e](this[i],l(t,this),r,o)};default:return function(){var t=o.call(arguments);return t.unshift(this[i]),n[e].apply(n,t)}}},a=function(t,e,i){n.each(e,function(e,r){n[r]&&(t.prototype[r]=s(e,r,i))})},l=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?c(t):n.isString(t)?function(e){return e.get(t)}:t},c=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},u=e.Events={},h=/\s+/,d=function(t,e,i,r,o){var s,a=0;if(i&&"object"==typeof i){void 0!==r&&"context"in o&&void 0===o.context&&(o.context=r);for(s=n.keys(i);a<s.length;a++)e=d(t,e,s[a],i[s[a]],o)}else if(i&&h.test(i))for(s=i.split(h);a<s.length;a++)e=t(e,s[a],r,o);else e=t(e,i,r,o);return e};u.on=function(t,e,n){return f(this,t,e,n)};var f=function(t,e,n,i,r){if(t._events=d(p,t._events||{},e,n,{context:i,ctx:t,listening:r}),r){var o=t._listeners||(t._listeners={});o[r.id]=r}return t};u.listenTo=function(t,e,i){if(!t)return this;var r=t._listenId||(t._listenId=n.uniqueId("l")),o=this._listeningTo||(this._listeningTo={}),s=o[r];if(!s){var a=this._listenId||(this._listenId=n.uniqueId("l"));s=o[r]={obj:t,objId:r,id:a,listeningTo:o,count:0}}return f(t,e,i,this,s),this};var p=function(t,e,n,i){if(n){var r=t[e]||(t[e]=[]),o=i.context,s=i.ctx,a=i.listening;a&&a.count++,r.push({callback:n,context:o,ctx:o||s,listening:a})}return t};u.off=function(t,e,n){return this._events?(this._events=d(g,this._events,t,e,{context:n,listeners:this._listeners}),this):this},u.stopListening=function(t,e,i){var r=this._listeningTo;if(!r)return this;for(var o=t?[t._listenId]:n.keys(r),s=0;s<o.length;s++){var a=r[o[s]];if(!a)break;a.obj.off(e,i,this)}return this};var g=function(t,e,i,r){if(t){var o,s=0,a=r.context,l=r.listeners;if(e||i||a){for(var c=e?[e]:n.keys(t);s<c.length;s++){e=c[s];var u=t[e];if(!u)break;for(var h=[],d=0;d<u.length;d++){var f=u[d];i&&i!==f.callback&&i!==f.callback._callback||a&&a!==f.context?h.push(f):(o=f.listening,o&&0===--o.count&&(delete l[o.id],delete o.listeningTo[o.objId]))}h.length?t[e]=h:delete t[e]}return t}for(var p=n.keys(l);s<p.length;s++)o=l[p[s]],delete l[o.id],delete o.listeningTo[o.objId]}};u.once=function(t,e,i){var r=d(v,{},t,e,n.bind(this.off,this));return"string"==typeof t&&null==i&&(e=void 0),this.on(r,e,i)},u.listenToOnce=function(t,e,i){var r=d(v,{},e,i,n.bind(this.stopListening,this,t));return this.listenTo(t,r)};var v=function(t,e,i,r){if(i){var o=t[e]=n.once(function(){r(e,o),i.apply(this,arguments)});o._callback=i}return t};u.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),n=Array(e),i=0;i<e;i++)n[i]=arguments[i+1];return d(m,this._events,t,void 0,n),this};var m=function(t,e,n,i){if(t){var r=t[e],o=t.all;r&&o&&(o=o.slice()),r&&y(r,i),o&&y(o,[e].concat(i))}return t},y=function(t,e){var n,i=-1,r=t.length,o=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++i<r;)(n=t[i]).callback.call(n.ctx);return;case 1:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o);return;case 2:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o,s);return;case 3:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o,s,a);return;default:for(;++i<r;)(n=t[i]).callback.apply(n.ctx,e);return}};u.bind=u.on,u.unbind=u.off,n.extend(e,u);var b=e.Model=function(t,e){var i=t||{};e||(e={}),this.cid=n.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(i=this.parse(i,e)||{});var r=n.result(this,"defaults");i=n.defaults(n.extend({},r,i),r),this.set(i,e),this.changed={},this.initialize.apply(this,arguments)};n.extend(b.prototype,u,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return n.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return n.escape(this.get(t))},has:function(t){return null!=this.get(t)},matches:function(t){return!!n.iteratee(t,this)(this.attributes)},set:function(t,e,i){if(null==t)return this;var r;if("object"==typeof t?(r=t,i=e):(r={})[t]=e,i||(i={}),!this._validate(r,i))return!1;var o=i.unset,s=i.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=n.clone(this.attributes),this.changed={});var c=this.attributes,u=this.changed,h=this._previousAttributes;for(var d in r)e=r[d],n.isEqual(c[d],e)||a.push(d),n.isEqual(h[d],e)?delete u[d]:u[d]=e,o?delete c[d]:c[d]=e;if(this.idAttribute in r&&(this.id=this.get(this.idAttribute)),!s){a.length&&(this._pending=i);for(var f=0;f<a.length;f++)this.trigger("change:"+a[f],this,c[a[f]],i)}if(l)return this;if(!s)for(;this._pending;)i=this._pending,this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(t,e){return this.set(t,void 0,n.extend({},e,{unset:!0}))},clear:function(t){var e={};for(var i in this.attributes)e[i]=void 0;return this.set(e,n.extend({},t,{unset:!0}))},hasChanged:function(t){return null==t?!n.isEmpty(this.changed):n.has(this.changed,t)},changedAttributes:function(t){if(!t)return!!this.hasChanged()&&n.clone(this.changed);var e=this._changing?this._previousAttributes:this.attributes,i={};for(var r in t){var o=t[r];n.isEqual(e[r],o)||(i[r]=o)}return!!n.size(i)&&i},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(t){t=n.extend({parse:!0},t);var e=this,i=t.success;return t.success=function(n){var r=t.parse?e.parse(n,t):n;return!!e.set(r,t)&&(i&&i.call(t.context,e,n,t),void e.trigger("sync",e,n,t))},H(this,t),this.sync("read",this,t)},save:function(t,e,i){var r;null==t||"object"==typeof t?(r=t,i=e):(r={})[t]=e,i=n.extend({validate:!0,parse:!0},i);var o=i.wait;if(r&&!o){if(!this.set(r,i))return!1}else if(!this._validate(r,i))return!1;var s=this,a=i.success,l=this.attributes;i.success=function(t){s.attributes=l;var e=i.parse?s.parse(t,i):t;return o&&(e=n.extend({},r,e)),!(e&&!s.set(e,i))&&(a&&a.call(i.context,s,t,i),void s.trigger("sync",s,t,i))},H(this,i),r&&o&&(this.attributes=n.extend({},l,r));var c=this.isNew()?"create":i.patch?"patch":"update";"patch"!==c||i.attrs||(i.attrs=r);var u=this.sync(c,this,i);return this.attributes=l,u},destroy:function(t){t=t?n.clone(t):{};var e=this,i=t.success,r=t.wait,o=function(){e.stopListening(),e.trigger("destroy",e,e.collection,t)};t.success=function(n){r&&o(),i&&i.call(t.context,e,n,t),e.isNew()||e.trigger("sync",e,n,t)};var s=!1;return this.isNew()?n.defer(t.success):(H(this,t),s=this.sync("delete",this,t)),r||o(),s},url:function(){var t=n.result(this,"urlRoot")||n.result(this.collection,"url")||V();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},n.extend({},t,{validate:!0}))},_validate:function(t,e){if(!e.validate||!this.validate)return!0;t=n.extend({},this.attributes,t);var i=this.validationError=this.validate(t,e)||null;return!i||(this.trigger("invalid",this,i,n.extend(e,{validationError:i})),!1)}});var x={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};a(b,x,"attributes");var w=e.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),void 0!==e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,n.extend({silent:!0},e))},C={add:!0,remove:!0,merge:!0},k={add:!0,remove:!1},S=function(t,e,n){n=Math.min(Math.max(n,0),t.length);var i,r=Array(t.length-n),o=e.length;for(i=0;i<r.length;i++)r[i]=t[i+n];for(i=0;i<o;i++)t[i+n]=e[i];for(i=0;i<r.length;i++)t[i+o+n]=r[i]};n.extend(w.prototype,u,{model:b,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,n.extend({merge:!1},e,k))},remove:function(t,e){e=n.extend({},e);var i=!n.isArray(t);t=i?[t]:t.slice();var r=this._removeModels(t,e);return!e.silent&&r.length&&(e.changes={added:[],merged:[],removed:r},this.trigger("update",this,e)),i?r[0]:r},set:function(t,e){if(null!=t){e=n.extend({},C,e),e.parse&&!this._isModel(t)&&(t=this.parse(t,e)||[]);var i=!n.isArray(t);t=i?[t]:t.slice();var r=e.at;null!=r&&(r=+r),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);var o,s,a=[],l=[],c=[],u=[],h={},d=e.add,f=e.merge,p=e.remove,g=!1,v=this.comparator&&null==r&&e.sort!==!1,m=n.isString(this.comparator)?this.comparator:null;for(s=0;s<t.length;s++){o=t[s];var y=this.get(o);if(y){if(f&&o!==y){var b=this._isModel(o)?o.attributes:o;e.parse&&(b=y.parse(b,e)),y.set(b,e),c.push(y),v&&!g&&(g=y.hasChanged(m))}h[y.cid]||(h[y.cid]=!0,a.push(y)),t[s]=y}else d&&(o=t[s]=this._prepareModel(o,e),o&&(l.push(o),this._addReference(o,e),h[o.cid]=!0,a.push(o)))}if(p){for(s=0;s<this.length;s++)o=this.models[s],h[o.cid]||u.push(o);u.length&&this._removeModels(u,e)}var x=!1,w=!v&&d&&p;if(a.length&&w?(x=this.length!==a.length||n.some(this.models,function(t,e){return t!==a[e]}),this.models.length=0,S(this.models,a,0),this.length=this.models.length):l.length&&(v&&(g=!0),S(this.models,l,null==r?this.length:r),this.length=this.models.length),g&&this.sort({silent:!0}),!e.silent){for(s=0;s<l.length;s++)null!=r&&(e.index=r+s),o=l[s],o.trigger("add",o,this,e);(g||x)&&this.trigger("sort",this,e),(l.length||u.length||c.length)&&(e.changes={added:l,removed:u,merged:c},this.trigger("update",this,e))}return i?t[0]:t}},reset:function(t,e){e=e?n.clone(e):{};for(var i=0;i<this.models.length;i++)this._removeReference(this.models[i],e);return e.previousModels=this.models,this._reset(),t=this.add(t,n.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),t},push:function(t,e){return this.add(t,n.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,n.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(null!=t)return this._byId[t]||this._byId[this.modelId(t.attributes||t)]||t.cid&&this._byId[t.cid]},has:function(t){return null!=this.get(t)},at:function(t){return t<0&&(t+=this.length),this.models[t]},where:function(t,e){return this[e?"find":"filter"](t)},findWhere:function(t){return this.where(t,!0)},sort:function(t){var e=this.comparator;if(!e)throw new Error("Cannot sort a set without a comparator");t||(t={});var i=e.length;return n.isFunction(e)&&(e=n.bind(e,this)),1===i||n.isString(e)?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("sort",this,t),this},pluck:function(t){return this.map(t+"")},fetch:function(t){t=n.extend({parse:!0},t);var e=t.success,i=this;return t.success=function(n){var r=t.reset?"reset":"set";i[r](n,t),e&&e.call(t.context,i,n,t),i.trigger("sync",i,n,t)},H(this,t),this.sync("read",this,t)},create:function(t,e){e=e?n.clone(e):{};var i=e.wait;if(t=this._prepareModel(t,e),!t)return!1;i||this.add(t,e);var r=this,o=e.success;return e.success=function(t,e,n){i&&r.add(t,n),o&&o.call(n.context,t,e,n)},t.save(null,e),t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(this._isModel(t))return t.collection||(t.collection=this),t;e=e?n.clone(e):{},e.collection=this;var i=new this.model(t,e);return i.validationError?(this.trigger("invalid",this,i.validationError,e),!1):i},_removeModels:function(t,e){for(var n=[],i=0;i<t.length;i++){var r=this.get(t[i]);if(r){var o=this.indexOf(r);this.models.splice(o,1),this.length--,delete this._byId[r.cid];var s=this.modelId(r.attributes);null!=s&&delete this._byId[s],e.silent||(e.index=o,r.trigger("remove",r,this,e)),n.push(r),this._removeReference(r,e)}}return n},_isModel:function(t){return t instanceof b},_addReference:function(t,e){this._byId[t.cid]=t;var n=this.modelId(t.attributes);null!=n&&(this._byId[n]=t),t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var n=this.modelId(t.attributes);null!=n&&delete this._byId[n],this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,n,i){if(e){if(("add"===t||"remove"===t)&&n!==this)return;if("destroy"===t&&this.remove(e,i),"change"===t){var r=this.modelId(e.previousAttributes()),o=this.modelId(e.attributes);r!==o&&(null!=r&&delete this._byId[r],null!=o&&(this._byId[o]=e))}}this.trigger.apply(this,arguments)}});var T={forEach:3,each:3,map:3,collect:3,reduce:0,foldl:0,inject:0,reduceRight:0,foldr:0,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3,findIndex:3,findLastIndex:3};a(w,T,"models");var E=e.View=function(t){this.cid=n.uniqueId("view"),n.extend(this,n.pick(t,P)),this._ensureElement(),this.initialize.apply(this,arguments)},M=/^(\S+)\s*(.*)$/,P=["model","collection","el","id","attributes","className","tagName","events"];n.extend(E.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(t){return this.undelegateEvents(),this._setElement(t),this.delegateEvents(),this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t),this.el=this.$el[0]},delegateEvents:function(t){if(t||(t=n.result(this,"events")),!t)return this;this.undelegateEvents();for(var e in t){var i=t[e];if(n.isFunction(i)||(i=this[i]),i){var r=e.match(M);this.delegate(r[1],r[2],n.bind(i,this))}}return this},delegate:function(t,e,n){return this.$el.on(t+".delegateEvents"+this.cid,e,n),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(t,e,n){return this.$el.off(t+".delegateEvents"+this.cid,e,n),this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(this.el)this.setElement(n.result(this,"el"));else{var t=n.extend({},n.result(this,"attributes"));this.id&&(t.id=n.result(this,"id")),this.className&&(t["class"]=n.result(this,"className")),this.setElement(this._createElement(n.result(this,"tagName"))),this._setAttributes(t)}},_setAttributes:function(t){this.$el.attr(t)}}),e.sync=function(t,i,r){var o=A[t];n.defaults(r||(r={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var s={type:o,dataType:"json"};if(r.url||(s.url=n.result(i,"url")||V()),null!=r.data||!i||"create"!==t&&"update"!==t&&"patch"!==t||(s.contentType="application/json",s.data=JSON.stringify(r.attrs||i.toJSON(r))),r.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),r.emulateHTTP&&("PUT"===o||"DELETE"===o||"PATCH"===o)){s.type="POST",r.emulateJSON&&(s.data._method=o);var a=r.beforeSend;r.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",o),a)return a.apply(this,arguments)}}"GET"===s.type||r.emulateJSON||(s.processData=!1);var l=r.error;r.error=function(t,e,n){r.textStatus=e,r.errorThrown=n,l&&l.call(r.context,t,e,n)};var c=r.xhr=e.ajax(n.extend(s,r));return i.trigger("request",i,c,r),c};var A={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var O=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},L=/\((.*?)\)/g,N=/(\(\?)?:\w+/g,D=/\*\w+/g,I=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(O.prototype,u,{initialize:function(){},route:function(t,i,r){n.isRegExp(t)||(t=this._routeToRegExp(t)),n.isFunction(i)&&(r=i,i=""),r||(r=this[i]);var o=this;return e.history.route(t,function(n){var s=o._extractParameters(t,n);o.execute(r,s,i)!==!1&&(o.trigger.apply(o,["route:"+i].concat(s)),o.trigger("route",i,s),e.history.trigger("route",o,i,s))}),this},execute:function(t,e,n){t&&t.apply(this,e)},navigate:function(t,n){return e.history.navigate(t,n),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var t,e=n.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(I,"\\$&").replace(L,"(?:$1)?").replace(N,function(t,e){return e?t:"([^/?]+)"}).replace(D,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return n.map(i,function(t,e){return e===i.length-1?t||null:t?decodeURIComponent(t):null})}});var _=e.History=function(){this.handlers=[],this.checkUrl=n.bind(this.checkUrl,this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},F=/^[#\/]|\s+$/g,z=/^\/+|\/+$/g,R=/#.*$/;_.started=!1,n.extend(_.prototype,u,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname),e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===t.charAt(0)?t.slice(1):t},getFragment:function(t){return null==t&&(t=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),t.replace(F,"")},start:function(t){if(_.started)throw new Error("Backbone.history has already been started");if(_.started=!0,this.options=n.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7),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(z,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var i=document.body,r=i.insertBefore(this.iframe,i.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var o=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),_.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e!==this.fragment&&(this.iframe&&this.navigate(e),void this.loadUrl())},loadUrl:function(t){return!!this.matchRoot()&&(t=this.fragment=this.getFragment(t),n.some(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0}))},navigate:function(t,e){if(!_.started)return!1;e&&e!==!0||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;""!==t&&"?"!==t.charAt(0)||(n=n.slice(0,-1)||"/");var i=n+t;if(t=this.decodeFragment(t.replace(R,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var r=this.iframe.contentWindow;e.replace||(r.document.open(),r.document.close()),this._updateHash(r.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var i=t.href.replace(/(javascript:|#).*$/,"");t.replace(i+"#"+e)}else t.hash="#"+e}}),e.history=new _;var $=function(t,e){var i,r=this;return i=t&&n.has(t,"constructor")?t.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,e),i.prototype=n.create(r.prototype,t),i.prototype.constructor=i,i.__super__=r.prototype,i};b.extend=w.extend=O.extend=E.extend=_.extend=$;var V=function(){throw new Error('A "url" property or function must be specified')},H=function(t,e){var n=e.error;e.error=function(i){n&&n.call(e.context,t,i,e),t.trigger("error",t,i,e)}};return e})}).call(e,n(16))},function(t,e,n){var i,r;(function(){function n(t){function e(e,n,i,r,o,s){for(;o>=0&&o<s;o+=t){var a=r?r[o]:o;i=n(i,e[a],a,e)}return i}return function(n,i,r,o){i=k(i,o,4);var s=!O(n)&&C.keys(n),a=(s||n).length,l=t>0?0:a-1;return arguments.length<3&&(r=n[s?s[l]:l],l+=t),e(n,i,r,s,l,a)}}function o(t){return function(e,n,i){n=S(n,i);for(var r=A(e),o=t>0?0:r-1;o>=0&&o<r;o+=t)if(n(e[o],o,e))return o;return-1}}function s(t,e,n){return function(i,r,o){var s=0,a=A(i);if("number"==typeof o)t>0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(n&&o&&a)return o=n(i,r),i[o]===r?o:-1;if(r!==r)return o=e(p.call(i,s,a),C.isNaN),o>=0?o+s:-1;for(o=t>0?s:a-1;o>=0&&o<a;o+=t)if(i[o]===r)return o;return-1}}function a(t,e){var n=_.length,i=t.constructor,r=C.isFunction(i)&&i.prototype||h,o="constructor";for(C.has(t,o)&&!C.contains(e,o)&&e.push(o);n--;)o=_[n],o in t&&t[o]!==r[o]&&!C.contains(e,o)&&e.push(o)}var l=this,c=l._,u=Array.prototype,h=Object.prototype,d=Function.prototype,f=u.push,p=u.slice,g=h.toString,v=h.hasOwnProperty,m=Array.isArray,y=Object.keys,b=d.bind,x=Object.create,w=function(){},C=function(t){return t instanceof C?t:this instanceof C?void(this._wrapped=t):new C(t)};"undefined"!=typeof t&&t.exports&&(e=t.exports=C),e._=C,C.VERSION="1.8.3";var k=function(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)};case 4:return function(n,i,r,o){return t.call(e,n,i,r,o)}}return function(){return t.apply(e,arguments)}},S=function(t,e,n){return null==t?C.identity:C.isFunction(t)?k(t,e,n):C.isObject(t)?C.matcher(t):C.property(t)};C.iteratee=function(t,e){return S(t,e,1/0)};var T=function(t,e){return function(n){var i=arguments.length;if(i<2||null==n)return n;for(var r=1;r<i;r++)for(var o=arguments[r],s=t(o),a=s.length,l=0;l<a;l++){var c=s[l];e&&void 0!==n[c]||(n[c]=o[c])}return n}},E=function(t){if(!C.isObject(t))return{};if(x)return x(t);w.prototype=t;var e=new w;return w.prototype=null,e},M=function(t){return function(e){return null==e?void 0:e[t]}},P=Math.pow(2,53)-1,A=M("length"),O=function(t){var e=A(t);return"number"==typeof e&&e>=0&&e<=P};C.each=C.forEach=function(t,e,n){e=k(e,n);var i,r;if(O(t))for(i=0,r=t.length;i<r;i++)e(t[i],i,t);else{var o=C.keys(t);for(i=0,r=o.length;i<r;i++)e(t[o[i]],o[i],t)}return t},C.map=C.collect=function(t,e,n){e=S(e,n);for(var i=!O(t)&&C.keys(t),r=(i||t).length,o=Array(r),s=0;s<r;s++){var a=i?i[s]:s;o[s]=e(t[a],a,t)}return o},C.reduce=C.foldl=C.inject=n(1),C.reduceRight=C.foldr=n(-1),C.find=C.detect=function(t,e,n){var i;if(i=O(t)?C.findIndex(t,e,n):C.findKey(t,e,n),void 0!==i&&i!==-1)return t[i]},C.filter=C.select=function(t,e,n){var i=[];return e=S(e,n),C.each(t,function(t,n,r){e(t,n,r)&&i.push(t)}),i},C.reject=function(t,e,n){return C.filter(t,C.negate(S(e)),n)},C.every=C.all=function(t,e,n){e=S(e,n);for(var i=!O(t)&&C.keys(t),r=(i||t).length,o=0;o<r;o++){var s=i?i[o]:o;if(!e(t[s],s,t))return!1}return!0},C.some=C.any=function(t,e,n){e=S(e,n);for(var i=!O(t)&&C.keys(t),r=(i||t).length,o=0;o<r;o++){var s=i?i[o]:o;if(e(t[s],s,t))return!0}return!1},C.contains=C.includes=C.include=function(t,e,n,i){return O(t)||(t=C.values(t)),("number"!=typeof n||i)&&(n=0),C.indexOf(t,e,n)>=0},C.invoke=function(t,e){var n=p.call(arguments,2),i=C.isFunction(e);return C.map(t,function(t){var r=i?e:t[e];return null==r?r:r.apply(t,n)})},C.pluck=function(t,e){return C.map(t,C.property(e))},C.where=function(t,e){return C.filter(t,C.matcher(e))},C.findWhere=function(t,e){return C.find(t,C.matcher(e))},C.max=function(t,e,n){var i,r,o=-(1/0),s=-(1/0);if(null==e&&null!=t){t=O(t)?t:C.values(t);for(var a=0,l=t.length;a<l;a++)i=t[a],i>o&&(o=i)}else e=S(e,n),C.each(t,function(t,n,i){r=e(t,n,i),(r>s||r===-(1/0)&&o===-(1/0))&&(o=t,s=r)});return o},C.min=function(t,e,n){var i,r,o=1/0,s=1/0;if(null==e&&null!=t){t=O(t)?t:C.values(t);for(var a=0,l=t.length;a<l;a++)i=t[a],i<o&&(o=i)}else e=S(e,n),C.each(t,function(t,n,i){r=e(t,n,i),(r<s||r===1/0&&o===1/0)&&(o=t,s=r)});return o},C.shuffle=function(t){for(var e,n=O(t)?t:C.values(t),i=n.length,r=Array(i),o=0;o<i;o++)e=C.random(0,o),e!==o&&(r[o]=r[e]),r[e]=n[o];return r},C.sample=function(t,e,n){return null==e||n?(O(t)||(t=C.values(t)),t[C.random(t.length-1)]):C.shuffle(t).slice(0,Math.max(0,e))},C.sortBy=function(t,e,n){return e=S(e,n),C.pluck(C.map(t,function(t,n,i){return{value:t,index:n,criteria:e(t,n,i)}}).sort(function(t,e){var n=t.criteria,i=e.criteria;if(n!==i){if(n>i||void 0===n)return 1;if(n<i||void 0===i)return-1}return t.index-e.index}),"value")};var L=function(t){return function(e,n,i){var r={};return n=S(n,i),C.each(e,function(i,o){var s=n(i,o,e);t(r,i,s)}),r}};C.groupBy=L(function(t,e,n){C.has(t,n)?t[n].push(e):t[n]=[e]}),C.indexBy=L(function(t,e,n){t[n]=e}),C.countBy=L(function(t,e,n){C.has(t,n)?t[n]++:t[n]=1}),C.toArray=function(t){return t?C.isArray(t)?p.call(t):O(t)?C.map(t,C.identity):C.values(t):[]},C.size=function(t){return null==t?0:O(t)?t.length:C.keys(t).length},C.partition=function(t,e,n){e=S(e,n);var i=[],r=[];return C.each(t,function(t,n,o){(e(t,n,o)?i:r).push(t)}),[i,r]},C.first=C.head=C.take=function(t,e,n){if(null!=t)return null==e||n?t[0]:C.initial(t,t.length-e)},C.initial=function(t,e,n){return p.call(t,0,Math.max(0,t.length-(null==e||n?1:e)))},C.last=function(t,e,n){if(null!=t)return null==e||n?t[t.length-1]:C.rest(t,Math.max(0,t.length-e))},C.rest=C.tail=C.drop=function(t,e,n){return p.call(t,null==e||n?1:e)},C.compact=function(t){return C.filter(t,C.identity)};var N=function(t,e,n,i){for(var r=[],o=0,s=i||0,a=A(t);s<a;s++){var l=t[s];if(O(l)&&(C.isArray(l)||C.isArguments(l))){e||(l=N(l,e,n));var c=0,u=l.length;for(r.length+=u;c<u;)r[o++]=l[c++]}else n||(r[o++]=l)}return r};C.flatten=function(t,e){return N(t,e,!1)},C.without=function(t){return C.difference(t,p.call(arguments,1))},C.uniq=C.unique=function(t,e,n,i){C.isBoolean(e)||(i=n,n=e,e=!1),null!=n&&(n=S(n,i));for(var r=[],o=[],s=0,a=A(t);s<a;s++){var l=t[s],c=n?n(l,s,t):l;e?(s&&o===c||r.push(l),o=c):n?C.contains(o,c)||(o.push(c),r.push(l)):C.contains(r,l)||r.push(l)}return r},C.union=function(){return C.uniq(N(arguments,!0,!0))},C.intersection=function(t){for(var e=[],n=arguments.length,i=0,r=A(t);i<r;i++){var o=t[i];if(!C.contains(e,o)){for(var s=1;s<n&&C.contains(arguments[s],o);s++);s===n&&e.push(o)}}return e},C.difference=function(t){var e=N(arguments,!0,!0,1);return C.filter(t,function(t){return!C.contains(e,t)})},C.zip=function(){return C.unzip(arguments)},C.unzip=function(t){for(var e=t&&C.max(t,A).length||0,n=Array(e),i=0;i<e;i++)n[i]=C.pluck(t,i);return n},C.object=function(t,e){for(var n={},i=0,r=A(t);i<r;i++)e?n[t[i]]=e[i]:n[t[i][0]]=t[i][1];return n},C.findIndex=o(1),C.findLastIndex=o(-1),C.sortedIndex=function(t,e,n,i){n=S(n,i,1);for(var r=n(e),o=0,s=A(t);o<s;){var a=Math.floor((o+s)/2);n(t[a])<r?o=a+1:s=a}return o},C.indexOf=s(1,C.findIndex,C.sortedIndex),C.lastIndexOf=s(-1,C.findLastIndex),C.range=function(t,e,n){null==e&&(e=t||0,t=0),n=n||1;for(var i=Math.max(Math.ceil((e-t)/n),0),r=Array(i),o=0;o<i;o++,t+=n)r[o]=t;return r};var D=function(t,e,n,i,r){if(!(i instanceof e))return t.apply(n,r);var o=E(t.prototype),s=t.apply(o,r);return C.isObject(s)?s:o};C.bind=function(t,e){if(b&&t.bind===b)return b.apply(t,p.call(arguments,1));if(!C.isFunction(t))throw new TypeError("Bind must be called on a function");var n=p.call(arguments,2),i=function(){return D(t,i,e,this,n.concat(p.call(arguments)))};return i},C.partial=function(t){var e=p.call(arguments,1),n=function(){for(var i=0,r=e.length,o=Array(r),s=0;s<r;s++)o[s]=e[s]===C?arguments[i++]:e[s];for(;i<arguments.length;)o.push(arguments[i++]);return D(t,n,this,this,o)};return n},C.bindAll=function(t){var e,n,i=arguments.length;if(i<=1)throw new Error("bindAll must be passed function names");for(e=1;e<i;e++)n=arguments[e],t[n]=C.bind(t[n],t);return t},C.memoize=function(t,e){var n=function(i){var r=n.cache,o=""+(e?e.apply(this,arguments):i);return C.has(r,o)||(r[o]=t.apply(this,arguments)),r[o]};return n.cache={},n},C.delay=function(t,e){var n=p.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},C.defer=C.partial(C.delay,C,1),C.throttle=function(t,e,n){var i,r,o,s=null,a=0;n||(n={});var l=function(){a=n.leading===!1?0:C.now(),s=null,o=t.apply(i,r),s||(i=r=null)};return function(){var c=C.now();a||n.leading!==!1||(a=c);var u=e-(c-a);return i=this,r=arguments,u<=0||u>e?(s&&(clearTimeout(s),s=null),a=c,o=t.apply(i,r),s||(i=r=null)):s||n.trailing===!1||(s=setTimeout(l,u)),o}},C.debounce=function(t,e,n){var i,r,o,s,a,l=function(){var c=C.now()-s;c<e&&c>=0?i=setTimeout(l,e-c):(i=null,n||(a=t.apply(o,r),i||(o=r=null)))};return function(){o=this,r=arguments,s=C.now();var c=n&&!i;return i||(i=setTimeout(l,e)),c&&(a=t.apply(o,r),o=r=null),a}},C.wrap=function(t,e){return C.partial(e,t)},C.negate=function(t){return function(){return!t.apply(this,arguments)}},C.compose=function(){var t=arguments,e=t.length-1;
return function(){for(var n=e,i=t[e].apply(this,arguments);n--;)i=t[n].call(this,i);return i}},C.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},C.before=function(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=null),n}},C.once=C.partial(C.before,2);var I=!{toString:null}.propertyIsEnumerable("toString"),_=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];C.keys=function(t){if(!C.isObject(t))return[];if(y)return y(t);var e=[];for(var n in t)C.has(t,n)&&e.push(n);return I&&a(t,e),e},C.allKeys=function(t){if(!C.isObject(t))return[];var e=[];for(var n in t)e.push(n);return I&&a(t,e),e},C.values=function(t){for(var e=C.keys(t),n=e.length,i=Array(n),r=0;r<n;r++)i[r]=t[e[r]];return i},C.mapObject=function(t,e,n){e=S(e,n);for(var i,r=C.keys(t),o=r.length,s={},a=0;a<o;a++)i=r[a],s[i]=e(t[i],i,t);return s},C.pairs=function(t){for(var e=C.keys(t),n=e.length,i=Array(n),r=0;r<n;r++)i[r]=[e[r],t[e[r]]];return i},C.invert=function(t){for(var e={},n=C.keys(t),i=0,r=n.length;i<r;i++)e[t[n[i]]]=n[i];return e},C.functions=C.methods=function(t){var e=[];for(var n in t)C.isFunction(t[n])&&e.push(n);return e.sort()},C.extend=T(C.allKeys),C.extendOwn=C.assign=T(C.keys),C.findKey=function(t,e,n){e=S(e,n);for(var i,r=C.keys(t),o=0,s=r.length;o<s;o++)if(i=r[o],e(t[i],i,t))return i},C.pick=function(t,e,n){var i,r,o={},s=t;if(null==s)return o;C.isFunction(e)?(r=C.allKeys(s),i=k(e,n)):(r=N(arguments,!1,!1,1),i=function(t,e,n){return e in n},s=Object(s));for(var a=0,l=r.length;a<l;a++){var c=r[a],u=s[c];i(u,c,s)&&(o[c]=u)}return o},C.omit=function(t,e,n){if(C.isFunction(e))e=C.negate(e);else{var i=C.map(N(arguments,!1,!1,1),String);e=function(t,e){return!C.contains(i,e)}}return C.pick(t,e,n)},C.defaults=T(C.allKeys,!0),C.create=function(t,e){var n=E(t);return e&&C.extendOwn(n,e),n},C.clone=function(t){return C.isObject(t)?C.isArray(t)?t.slice():C.extend({},t):t},C.tap=function(t,e){return e(t),t},C.isMatch=function(t,e){var n=C.keys(e),i=n.length;if(null==t)return!i;for(var r=Object(t),o=0;o<i;o++){var s=n[o];if(e[s]!==r[s]||!(s in r))return!1}return!0};var F=function(t,e,n,i){if(t===e)return 0!==t||1/t===1/e;if(null==t||null==e)return t===e;t instanceof C&&(t=t._wrapped),e instanceof C&&(e=e._wrapped);var r=g.call(t);if(r!==g.call(e))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!==+t?+e!==+e:0===+t?1/+t===1/e:+t===+e;case"[object Date]":case"[object Boolean]":return+t===+e}var o="[object Array]"===r;if(!o){if("object"!=typeof t||"object"!=typeof e)return!1;var s=t.constructor,a=e.constructor;if(s!==a&&!(C.isFunction(s)&&s instanceof s&&C.isFunction(a)&&a instanceof a)&&"constructor"in t&&"constructor"in e)return!1}n=n||[],i=i||[];for(var l=n.length;l--;)if(n[l]===t)return i[l]===e;if(n.push(t),i.push(e),o){if(l=t.length,l!==e.length)return!1;for(;l--;)if(!F(t[l],e[l],n,i))return!1}else{var c,u=C.keys(t);if(l=u.length,C.keys(e).length!==l)return!1;for(;l--;)if(c=u[l],!C.has(e,c)||!F(t[c],e[c],n,i))return!1}return n.pop(),i.pop(),!0};C.isEqual=function(t,e){return F(t,e)},C.isEmpty=function(t){return null==t||(O(t)&&(C.isArray(t)||C.isString(t)||C.isArguments(t))?0===t.length:0===C.keys(t).length)},C.isElement=function(t){return!(!t||1!==t.nodeType)},C.isArray=m||function(t){return"[object Array]"===g.call(t)},C.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},C.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){C["is"+t]=function(e){return g.call(e)==="[object "+t+"]"}}),C.isArguments(arguments)||(C.isArguments=function(t){return C.has(t,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(C.isFunction=function(t){return"function"==typeof t||!1}),C.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},C.isNaN=function(t){return C.isNumber(t)&&t!==+t},C.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"===g.call(t)},C.isNull=function(t){return null===t},C.isUndefined=function(t){return void 0===t},C.has=function(t,e){return null!=t&&v.call(t,e)},C.noConflict=function(){return l._=c,this},C.identity=function(t){return t},C.constant=function(t){return function(){return t}},C.noop=function(){},C.property=M,C.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},C.matcher=C.matches=function(t){return t=C.extendOwn({},t),function(e){return C.isMatch(e,t)}},C.times=function(t,e,n){var i=Array(Math.max(0,t));e=k(e,n,1);for(var r=0;r<t;r++)i[r]=e(r);return i},C.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},C.now=Date.now||function(){return(new Date).getTime()};var z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},R=C.invert(z),$=function(t){var e=function(e){return t[e]},n="(?:"+C.keys(t).join("|")+")",i=RegExp(n),r=RegExp(n,"g");return function(t){return t=null==t?"":""+t,i.test(t)?t.replace(r,e):t}};C.escape=$(z),C.unescape=$(R),C.result=function(t,e,n){var i=null==t?void 0:t[e];return void 0===i&&(i=n),C.isFunction(i)?i.call(t):i};var V=0;C.uniqueId=function(t){var e=++V+"";return t?t+e:e},C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,j={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\u2028|\u2029/g,W=function(t){return"\\"+j[t]};C.template=function(t,e,n){!e&&n&&(e=n),e=C.defaults({},e,C.templateSettings);var i=RegExp([(e.escape||H).source,(e.interpolate||H).source,(e.evaluate||H).source].join("|")+"|$","g"),r=0,o="__p+='";t.replace(i,function(e,n,i,s,a){return o+=t.slice(r,a).replace(B,W),r=a+e.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":i?o+="'+\n((__t=("+i+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\n__p+='"),e}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var s=new Function(e.variable||"obj","_",o)}catch(a){throw a.source=o,a}var l=function(t){return s.call(this,t,C)},c=e.variable||"obj";return l.source="function("+c+"){\n"+o+"}",l},C.chain=function(t){var e=C(t);return e._chain=!0,e};var U=function(t,e){return t._chain?C(e).chain():e};C.mixin=function(t){C.each(C.functions(t),function(e){var n=C[e]=t[e];C.prototype[e]=function(){var t=[this._wrapped];return f.apply(t,arguments),U(this,n.apply(C,t))}})},C.mixin(C),C.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];C.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],U(this,n)}}),C.each(["concat","join","slice"],function(t){var e=u[t];C.prototype[t]=function(){return U(this,e.apply(this._wrapped,arguments))}}),C.prototype.value=function(){return this._wrapped},C.prototype.valueOf=C.prototype.toJSON=C.prototype.value,C.prototype.toString=function(){return""+this._wrapped},i=[],r=function(){return C}.apply(e,i),!(void 0!==r&&(t.exports=r))}).call(this)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitFromValue=e.normalizeFloat=e.shallowDiff=e.camelCase=e.matches=e.upFirst=e.hasDnd=e.off=e.on=void 0;var i=n(1),r=window.Element.prototype,o=r.matches||r.webkitMatchesSelector||r.mozMatchesSelector||r.msMatchesSelector,s=function(t,e){var n={},r=(0,i.keys)(e);for(var o in t)if(t.hasOwnProperty(o)){var s=t[o],a=e[o];r.indexOf(o)>=0?s!==a&&(n[o]=a):n[o]=null}for(var l in e)e.hasOwnProperty(l)&&(0,i.isUndefined)(t[l])&&(n[l]=e[l]);return n},a=function(t,e,n){e=e.split(/\s+/),t=t instanceof Array?t:[t];for(var i=function(i){t.forEach(function(t){return t.addEventListener(e[i],n)})},r=0;r<e.length;++r)i(r)},l=function(t,e,n){e=e.split(/\s+/),t=t instanceof Array?t:[t];for(var i=function(i){t.forEach(function(t){return t.removeEventListener(e[i],n)})},r=0;r<e.length;++r)i(r)},c=function(t){return t.replace(parseFloat(t),"")},u=function(t){return t[0].toUpperCase()+t.toLowerCase().slice(1)},h=function(t){var e=t.split("-");return e[0].toLowerCase()+e.slice(1).map(u)},d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=0;if(isNaN(t))return n;if(t=parseFloat(t),Math.floor(t)!==t){var r=e.toString().split(".")[1];i=r?r.length:0}return i?parseFloat(t.toFixed(i)):t},f=function(t){return"draggable"in document.createElement("i")&&(t?t.get("Config").nativeDnD:1)};e.on=a,e.off=l,e.hasDnd=f,e.upFirst=u,e.matches=o,e.camelCase=h,e.shallowDiff=s,e.normalizeFloat=d,e.getUnitFromValue=c},function(t,e,n){"use strict";(function(e){var i=n(1),r=n(51);t.exports=e.View.extend({className:function(){return this.getClasses()},tagName:function(){return this.model.get("tagName")},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.model,n=t.config||{};this.opts=t,this.config=n,this.em=n.em||"",this.pfx=n.stylePrefix||"",this.ppfx=n.pStylePrefix||"",this.attr=e.get("attributes"),this.classe=this.attr["class"]||[];var i=this.$el,r=e.get("classes");this.listenTo(e,"destroy remove",this.remove),this.listenTo(e,"change:style",this.updateStyle),this.listenTo(e,"change:attributes",this.updateAttributes),this.listenTo(e,"change:highlightable",this.updateHighlight),this.listenTo(e,"change:status",this.updateStatus),this.listenTo(e,"change:state",this.updateState),this.listenTo(e,"change:script",this.render),this.listenTo(e,"change",this.handleChange),this.listenTo(r,"add remove change",this.updateClasses),i.data("model",e),i.data("collection",e.get("components")),e.view=this,r.length&&this.importClasses(),this.init()},remove:function(){e.View.prototype.remove.apply(this);var t=this.childrenView;t&&t.stopListening()},init:function(){},handleChange:function(){var t=this.model;t.emitUpdate();for(var e in t.changed)t.emitUpdate(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",n=this.model.get("state");n?this.$el.addClass(e):this.$el.removeClass(e)},updateStatus:function(t){var e=this.el,n=this.model.get("status"),i=this.pfx,r=this.ppfx,o=i+"selected",s=o+"-parent",a=r+"freezed",l=e.getAttribute("class")||"",c="";switch(n){case"selected":c=l+" "+o;break;case"selected-parent":c=l+" "+s;break;case"freezed":c=l+" "+a;break;default:this.$el.removeClass(o+" "+s+" "+a)}c=c.trim(),c&&e.setAttribute("class",c)},updateHighlight:function(){var t=this.model.get("highlightable");this.setAttribute("data-highlightable",t?1:"")},updateStyle:function(){var t=this.em,e=this.model;t&&t.get("avoidInlineStyle")?(this.el.id=e.getId(),e.setStyle(e.getStyle())):this.setAttribute("style",e.styleToString())},updateClasses:function(){var t=this.model.get("classes").pluck("name").join(" ");this.setAttribute("class",t),this.updateStatus()},setAttribute:function(t,e){var n=this.$el;e?n.attr(t,e):n.removeAttr(t)},getClasses:function(){var t=this.model.get("attributes"),e=t["class"]||[];return e=(0,i.isArray)(e)?e:[e],e.length?e.join(" "):null},updateAttributes:function(){var t=this.model,e={},n=t.get("attributes"),i=t.get("src");for(var r in n)e[r]=n[r];i&&(e.src=i),this.$el.attr(e),this.updateHighlight(),this.updateStyle()},updateContent:function(){this.getChildrenContainer().innerHTML=this.model.get("content")},prevDef:function(t){t.preventDefault()},updateScript:function(){if(this.model.get("script")){var t=this.em;if(t){var e=t.get("Canvas");e.getCanvasView().updateScript(this)}}},getChildrenContainer:function(){var t=this.el;return"function"==typeof this.getChildrenSelector?t=this.el.querySelector(this.getChildrenSelector()):"function"==typeof this.getTemplate,t},renderChildren:function(){var t=this.getChildrenContainer(),e=new r({collection:this.model.get("components"),config:this.config,componentTypes:this.opts.componentTypes});e.render(t),this.childrenView=e;for(var n=Array.prototype.slice.call(e.el.childNodes),i=0,o=n.length;i<o;i++)t.appendChild(n.shift());if(t!==this.el){var s=function a(e){var n=Array.prototype.slice.call(e.children);n.forEach(function(e){e.style["pointer-events"]="none",t!==e&&a(e)})};s(this.el)}},renderAttributes:function(){this.updateAttributes(),this.updateClasses()},render:function(){return this.renderAttributes(),this.updateContent(),this.renderChildren(),this.updateScript(),this.onRender(),this},onRender:function(){}})}).call(e,n(0))},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=n(1),s=n(2),a=n(47),l=i(a),c=n(0),u=n(50),h=n(7),d=n(10),f=n(150),p={},g=0,v=function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},m=c.Model.extend(l["default"]).extend({defaults:{tagName:"div",type:"",name:"",removable:!0,draggable:!0,droppable:!0,badgable:!0,stylable:!0,"stylable-require":"",unstylable:"",highlightable:!0,copyable:!0,resizable:!1,editable:!1,layerable:!0,selectable:!0,hoverable:!0,"void":!1,state:"",status:"",content:"",icon:"",style:"",attributes:"",classes:"",script:"",traits:["id","title"],propagate:"",toolbar:null},initialize:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.em,s=this.parent(),a=s&&s.attributes;if(a&&a.propagate){var l={},c=a.propagate;c.forEach(function(t){return l[t]=s.get(t)}),l.propagate=c,l=r({},l,e),this.set(l)}var u=this.get("propagate");u&&this.set("propagate",(0,o.isArray)(u)?u:[u]),n&&n.config&&n.config.voidElements.indexOf(this.get("tagName"))>=0&&this.set("void",!0),n.em=i,this.opt=n,this.em=i,this.config=n.config||{},this.ccid=m.createId(this),this.set("attributes",this.get("attributes")||{}),this.on("remove",this.handleRemove),this.listenTo(this,"change:script",this.scriptUpdated),this.listenTo(this,"change:traits",this.traitsUpdated),this.listenTo(this,"change:tagName",this.tagUpdated),this.listenTo(this,"change:attributes",this.attrUpdated),this.initClasses(),this.loadTraits(),this.initComponents(),this.initToolbar(),this.set("status",""),this.listenTo(this.get("classes"),"add remove change",function(){return t.emitUpdate("classes")}),this.init()},handleRemove:function(t){var e=this.em;e&&e.trigger("component:remove",t)},is:function(t){return!(this.get("type")!=t)},find:function(t){var e=[];return this.view.$el.find(t).each(function(t,n,i){var r=i.eq(n),o=r.data("model");o&&e.push(o)}),e},closest:function(t){var e=this.view.$el.closest(t);return e.length&&e.data("model")},tagUpdated:function(){var t=this.collection,e=t.indexOf(this);t.remove(this),t.add(this,{at:e})},attrUpdated:function(){var t=this,e=r({},this.previous("attributes")),n=r({},this.get("attributes")),i=(0,s.shallowDiff)(e,n);(0,o.keys)(i).forEach(function(e){return t.trigger("change:attributes:"+e)})},setAttributes:function(t){t=r({},t);var e=t["class"];e&&this.setClass(e),delete t["class"];var n=t.style;n&&this.setStyle(n),delete t.style,this.set("attributes",t)},addAttributes:function(t){var e=r({},this.getAttributes(),t);this.setAttributes(e)},getStyle:function(){var t=this.em;if(t&&t.getConfig("avoidInlineStyle")){var e=this.get("state"),n=t.get("CssComposer"),i=n.getIdRule(this.getId(),{state:e});if(this.rule=i,i)return i.getStyle()}return l["default"].getStyle.call(this)},setStyle:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.em;if(i&&i.getConfig("avoidInlineStyle")){e=(0,o.isString)(e)?this.parseStyle(e):e;var a=this.get("state"),c=i.get("CssComposer"),u=this.getStyle();this.rule=c.setIdRule(this.getId(),e,r({},n,{state:a}));var h=(0,s.shallowDiff)(u,e);(0,o.keys)(h).forEach(function(e){return t.trigger("change:style:"+e)})}else e=l["default"].setStyle.apply(this,arguments);return e},getAttributes:function(){var t=[],e=r({},this.get("attributes"));return this.get("classes").each(function(e){return t.push(e.get("name"))}),t.length&&(e["class"]=t.join(" ")),(0,o.isEmpty)(this.getStyle())||(0,o.has)(e,"id")||(e.id=this.getId()),e},addClass:function(t){var e=this.em.get("SelectorManager").addClass(t);return this.get("classes").add(e)},setClass:function(t){return this.get("classes").reset(),this.addClass(t)},removeClass:function(t){var e=[];t=(0,o.isArray)(t)?t:[t];var n=this.get("classes"),i=h.TYPE_CLASS;return t.forEach(function(t){var r=t.split(" ");r.forEach(function(t){var r=n.where({name:t,type:i})[0];r&&e.push(n.remove(r))})}),e},initClasses:function(){var t=this.normalizeClasses(this.get("classes")||[]);return this.set("classes",new d(t)),this},initComponents:function(){var t=new u(null,this.opt);return t.parent=this,!this.opt.avoidChildren&&t.reset(this.get("components")),this.set("components",t),this},init:function(){},append:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.components().add(t,e);return(0,o.isArray)(n)?n:[n]},components:function(t){var e=this.get("components");return(0,o.isUndefined)(t)?e:(e.reset(),void(t&&this.append(t)))},parent:function(){var t=this.collection;return t&&t.parent},scriptUpdated:function(){this.set("scriptUpdated",1)},traitsUpdated:function(){var t=0,e=r({},this.get("attributes")),n=this.get("traits");return n instanceof f?(n.each(function(n){if(t=1,!n.get("changeProp")){var i=n.getInitValue();i&&(e[n.get("name")]=i)}}),void(t&&this.set("attributes",e))):void this.loadTraits()},initToolbar:function(){var t=this;if(!t.get("toolbar")){var e=[];t.collection&&e.push({attributes:{"class":"fa fa-arrow-up"},command:"select-parent"}),t.get("draggable")&&e.push({attributes:{"class":"fa fa-arrows",draggable:!0},command:"tlb-move"}),t.get("copyable")&&e.push({attributes:{"class":"fa fa-clone"},command:"tlb-clone"}),t.get("removable")&&e.push({attributes:{"class":"fa fa-trash-o"},command:"tlb-delete"}),t.set("toolbar",e)}},loadTraits:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new f([],this.opt);return n.setTarget(this),t=t||this.get("traits"),t.length&&n.add(t),this.set("traits",n,e),this},normalizeClasses:function(t){var e=[],n=this.em;if(n){var i=n.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(){var t=this.em,e=this.getStyle(),n=r({},this.attributes),i=r({},this.opt);return n.attributes=r({},n.attributes),delete n.attributes.id,n.components=[],n.classes=[],n.traits=[],this.get("components").each(function(t,e){n.components[e]=t.clone()}),this.get("traits").each(function(t,e){n.traits[e]=t.clone()}),this.get("classes").each(function(t,e){n.classes[e]=t.get("name")}),n.status="",n.view="",i.collection=null,t&&t.getConfig("avoidInlineStyle")&&!(0,o.isEmpty)(e)&&(n.style=e),new this.constructor(n,i)},getName:function(){var t=this.get("name")||this.get("custom-name"),e=this.get("tagName");e="div"==e?"box":e;var n=this.get("type")||e;return n=n.charAt(0).toUpperCase()+n.slice(1),t||n},getIcon:function(){var t=this.get("icon");return t?t+" ":""},toHTML:function(t){var e=this,n=[],i=e.get("tagName"),r=e.get("void"),s=this.getAttrToHTML();for(var a in s){var l=s[a];(0,o.isUndefined)(l)||n.push(a+'="'+l+'"')}var c=n.length?" "+n.join(" "):"",u="<"+i+c+(r?"/":"")+">"+e.get("content");return e.get("components").each(function(t){return u+=t.toHTML()}),!r&&(u+="</"+i+">"),u},getAttrToHTML:function(){var t=this.getAttributes();return delete t.style,t},toJSON:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=c.Model.prototype.toJSON.apply(this,e),r=this.getScriptString();return i.attributes=this.getAttributes(),delete i.attributes["class"],delete i.toolbar,r&&(i.script=r),i},getId:function(){var t=this.get("attributes")||{};return t.id||this.ccid||this.cid},getEl:function(){return this.view&&this.view.el},getScriptString:function(t){var e=this,n=t||this.get("script");if(!n)return n;if("function"==typeof n){var i=n.toString().trim();i=i.replace(/^function[\s\w]*\(\)\s?\{/,"").replace(/\}$/,""),n=i.trim()}var r=this.em.getConfig(),o=v(r.tagVarStart||"{[ "),s=v(r.tagVarEnd||" ]}"),a=new RegExp(o+"([\\w\\d-]*)"+s,"g");return n=n.replace(a,function(t,n){return e.scriptUpdated(),e.attributes[n]||""})},emitUpdate:function(t){var e=this.em,n="component:update"+(t?":"+t:"");e&&e.trigger(n,this)}},{isComponent:function(t){return{tagName:t.tagName?t.tagName.toLowerCase():""}},createId:function(t){g++;var e=g.toString().length+2,n=(Math.random()+1.1).toString(36).slice(-e),i="i"+n;return p[i]=t,i},getList:function(){return p}});t.exports=m},function(t,e,n){"use strict";(function(e){function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var r=n(1),o=n(2),s="data-clear-style";t.exports=e.View.extend({template:function(t){var e=this.pfx;return'\n <div class="'+e+'label">\n '+this.templateLabel(t)+'\n </div>\n <div class="'+this.ppfx+'fields">\n '+this.templateInput(t)+"\n </div>\n "},templateLabel:function(t){var e=this.pfx,n=t.get("icon"),i=t.get("info");return'\n <span class="'+e+"icon "+n+'" title="'+i+'">\n '+t.get("name")+'\n </span>\n <b class="'+e+'clear" '+s+">&Cross;</b>\n "},templateInput:function(t){return'\n <div class="'+this.ppfx+'field">\n <input placeholder="'+t.getDefaultValue()+'"/>\n </div>\n '},events:i({change:"inputValueChanged"},"click ["+s+"]","clear"),initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,r.bindAll)(this,"targetUpdated"),this.config=t.config||{};var e=this.config.em;this.em=e,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.onChange=t.onChange,this.onInputRender=t.onInputRender||{},this.customValue=t.customValue||{};var n=this.model;this.property=n.get("property"),this.input=null;var i=this.pfx;this.inputHolderId="#"+i+"input-holder",this.sector=n.collection&&n.collection.sector,n.view=this,n.get("value")||n.set("value",n.getDefaultValue()),e&&e.on("update:component:style:"+this.property,this.targetUpdated),this.listenTo(this.propTarget,"update",this.targetUpdated),this.listenTo(n,"destroy remove",this.remove),this.listenTo(n,"change:value",this.modelValueChanged),this.listenTo(n,"targetUpdated",this.targetUpdated),this.listenTo(n,"change:visible",this.updateVisibility),this.listenTo(n,"change:status",this.updateStatus);var o=this.init&&this.init.bind(this);o&&o()},updateStatus:function(){var t=this.model.get("status"),e=this.pfx,n=this.ppfx,i=this.config,r=n+"four-color",o=n+"color-warn",s=this.$el.children("."+e+"label"),a=this.getClearEl().style;switch(s.removeClass(r+" "+o),a.display="none",t){case"updated":s.addClass(r),i.clearProperties&&(a.display="inline");break;case"computed":s.addClass(o)}},clear:function(){var t=this.getTargetModel();t.removeStyle(this.model.get("property")),this.targetUpdated()},getClearEl:function(){return this.el.querySelector("["+s+"]")},getTarget:function(){return this.getTargetModel()},getTargetModel:function(){return this.propTarget&&this.propTarget.model},getHelperModel:function(){return this.propTarget&&this.propTarget.helper},inputValueChanged:function(t){t&&t.stopPropagation(),this.model.setValue(this.getInputValue(),1,{fromInput:1}),this.elementUpdated()},elementUpdated:function(){this.setStatus("updated")},setStatus:function(t){this.model.set("status",t);var e=this.model.parent;e&&e.set("status",t)},targetUpdated:function(){if(this.checkVisibility()){var t=this.config,e=t.em,n=this.model,i="",r="",o=this.getTargetValue({ignoreDefault:1}),s=n.getDefaultValue(),a=this.getComputedValue();o?(i=o,t.highlightChanged&&(r="updated")):a&&t.showComputed&&a!=s?(i=a,t.highlightComputed&&(r="computed")):(i=s,r=""),n.setValue(i,0,{fromTarget:1}),this.setStatus(r),e&&(e.trigger("styleManager:change",this),e.trigger("styleManager:change:"+n.get("property"),this))}},checkVisibility:function(){var t=1;return this.config.hideNotStylable&&(this.isTargetStylable()&&this.isComponentStylable()?this.show():(this.hide(),t=0),this.sector&&this.sector.trigger("updateVisibility")),t},getTargetValue:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.model,i=this.getTargetModel(),r=this.customValue;if(!i)return t;if(t=i.getStyle()[n.get("property")],t||e.ignoreDefault||(t=n.getDefaultValue()),"function"==typeof r&&!e.ignoreCustomValue){var o=n.collection.indexOf(n),s=r(this,o);s&&(t=s)}return t},getComputedValue:function(){var t=this.propTarget,e=t.computed||{},n=t.computedDefault||{},i=this.config.avoidComputed||[],r=this.model.get("property"),s=i.indexOf(r)<0,a=e[r],l=n[(0,o.camelCase)(r)];return e&&s&&l!==a&&a},getInputValue:function(){var t=this.getInputEl();return t?t.value:""},modelValueChanged:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.config.em,r=this.model,o=r.getFullValue(),s=this.getTarget(),a=this.onChange;n.fromInput||this.setValue(o),s&&this.isTargetStylable()&&this.isComponentStylable()&&(n.fromTarget||(a&&!n.fromParent?a(s,this,n):this.updateTargetStyle(o,null,n)),i&&(i.trigger("component:update",s),i.trigger("component:styleUpdate",s),i.trigger("component:styleUpdate:"+r.get("property"),s)))},updateTargetStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e||this.model.get("property"),r=this.getTarget(),o=r.getStyle();t?o[i]=t:delete o[i],r.setStyle(o,n);var s=this.getHelperModel();s&&s.setStyle(o,n)},isTargetStylable:function(t){var e=t||this.getTarget(),n=this.model,i=n.get("property"),o=n.get("toRequire"),s=e.get("unstylable"),a=e.get("stylable-require"),l=e.get("stylable");return(0,r.isArray)(l)&&(l=l.indexOf(i)>=0),(0,r.isArray)(s)&&(l=s.indexOf(i)<0),o&&(l=a&&a.indexOf(i)>=0||!t),l},isComponentStylable:function(){var t=this.em,e=t&&t.get("selectedComponent");return!e||this.isTargetStylable(e)},setRawValue:function(t){this.setValue(this.model.parseValue(t))},setValue:function(t){var e=this.model,n=t||e.getDefaultValue(),i=this.getInputEl();i&&(i.value=n)},getInputEl:function(){return this.input||(this.input=this.el.querySelector("input")),this.input},updateVisibility:function(){this.el.style.display=this.model.get("visible")?"block":"none"},show:function(){this.model.set("visible",1)},hide:function(){this.model.set("visible",0)},cleanValue:function(){this.setValue("")},render:function(){var t=this.pfx,e=this.model,n=this.el;n.innerHTML=this.template(e),n.className=t+"property "+t+e.get("type"),this.updateStatus();var i=this.onRender&&this.onRender.bind(this);i&&i(),this.setValue(e.get("value"),{targetUpdate:1})}})}).call(e,n(0))},function(t,e,n){!function(e,n){t.exports=n()}(this,function(){"use strict";function t(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function e(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function n(t,n){return e(t).appendChild(n)}function i(t,e,n,i){var r=document.createElement(t);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)r.appendChild(e[o]);return r}function r(t,e,n,r){var o=i(t,e,n,r);return o.setAttribute("role","presentation"),o}function o(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do if(11==e.nodeType&&(e=e.host),e==t)return!0;while(e=e.parentNode)}function s(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function a(e,n){var i=e.className;t(n).test(i)||(e.className+=(i?" ":"")+n)}function l(e,n){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!t(i[r]).test(n)&&(n+=" "+i[r]);return n}function c(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function u(t,e,n){e||(e={});for(var i in t)!t.hasOwnProperty(i)||n===!1&&e.hasOwnProperty(i)||(e[i]=t[i]);return e}function h(t,e,n,i,r){null==e&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));for(var o=i||0,s=r||0;;){var a=t.indexOf("\t",o);if(a<0||a>=e)return s+(e-o);s+=a-o,s+=n-s%n,o=a+1}}function d(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}function f(t,e,n){for(var i=0,r=0;;){var o=t.indexOf("\t",i);o==-1&&(o=t.length);var s=o-i;if(o==t.length||r+s>=e)return i+Math.min(s,e-r);if(r+=o-i,r+=n-r%n,i=o+1,r>=e)return i}}function p(t){for(;Gs.length<=t;)Gs.push(g(Gs)+" ");return Gs[t]}function g(t){return t[t.length-1]}function v(t,e){for(var n=[],i=0;i<t.length;i++)n[i]=e(t[i],i);return n}function m(t,e,n){for(var i=0,r=n(e);i<t.length&&n(t[i])<=r;)i++;t.splice(i,0,e)}function y(){}function b(t,e){var n;return Object.create?n=Object.create(t):(y.prototype=t,n=new y),e&&u(e,n),n}function x(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ys.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&&Xs.test(t)}function S(t,e,n){for(;(n<0?e>0:e<t.length)&&k(t.charAt(e));)e+=n;return e}function T(t,e,n){for(var i=e>n?-1:1;;){if(e==n)return e;var r=(e+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+i}}function E(t,e,n){var o=this;this.input=n,o.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=i("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=r("div",null,"CodeMirror-code"),o.selectionDiv=i("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=i("div",null,"CodeMirror-cursors"),o.measure=i("div",null,"CodeMirror-measure"),o.lineMeasure=i("div",null,"CodeMirror-measure"),o.lineSpace=r("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var s=r("div",[o.lineSpace],"CodeMirror-lines");o.mover=i("div",[s],null,"position: relative"),o.sizer=i("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=i("div",null,null,"position: absolute; height: "+Bs+"px; width: 1px;"),o.gutters=i("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=i("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=i("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),bs&&xs<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),ws||gs&&Os||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,n.init(o)}function M(t,e){if(e-=t.first,e<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(e<o){n=r;break}e-=o}return n.lines[e]}function P(t,e,n){var i=[],r=e.line;return t.iter(e.line,n.line+1,function(t){var o=t.text;r==n.line&&(o=o.slice(0,n.ch)),r==e.line&&(o=o.slice(e.ch)),i.push(o),++r}),i}function A(t,e,n){var i=[];return t.iter(e,n,function(t){i.push(t.text)}),i}function O(t,e){
var n=e-t.height;if(n)for(var i=t;i;i=i.parent)i.height+=n}function L(t){if(null==t.parent)return null;for(var e=t.parent,n=d(e.lines,t),i=e.parent;i;e=i,i=i.parent)for(var r=0;i.children[r]!=e;++r)n+=i.children[r].chunkSize();return n+e.first}function N(t,e){var n=t.first;t:do{for(var i=0;i<t.children.length;++i){var r=t.children[i],o=r.height;if(e<o){t=r;continue t}e-=o,n+=r.chunkSize()}return n}while(!t.lines);for(var s=0;s<t.lines.length;++s){var a=t.lines[s],l=a.height;if(e<l)break;e-=l}return n+s}function D(t,e){return e>=t.first&&e<t.first+t.size}function I(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function _(t,e,n){return void 0===n&&(n=null),this instanceof _?(this.line=t,this.ch=e,void(this.sticky=n)):new _(t,e,n)}function F(t,e){return t.line-e.line||t.ch-e.ch}function z(t,e){return t.sticky==e.sticky&&0==F(t,e)}function R(t){return _(t.line,t.ch)}function $(t,e){return F(t,e)<0?e:t}function V(t,e){return F(t,e)<0?t:e}function H(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function j(t,e){if(e.line<t.first)return _(t.first,0);var n=t.first+t.size-1;return e.line>n?_(n,M(t,n).text.length):B(e,M(t,e.line).text.length)}function B(t,e){var n=t.ch;return null==n||n>e?_(t.line,e):n<0?_(t.line,0):t}function W(t,e){for(var n=[],i=0;i<e.length;i++)n[i]=j(t,e[i]);return n}function U(){Js=!0}function q(){Zs=!0}function K(t,e,n){this.marker=t,this.from=e,this.to=n}function G(t,e){if(t)for(var n=0;n<t.length;++n){var i=t[n];if(i.marker==e)return i}}function Y(t,e){for(var n,i=0;i<t.length;++i)t[i]!=e&&(n||(n=[])).push(t[i]);return n}function X(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t)}function J(t,e,n){var i;if(t)for(var r=0;r<t.length;++r){var o=t[r],s=o.marker,a=null==o.from||(s.inclusiveLeft?o.from<=e:o.from<e);if(a||o.from==e&&"bookmark"==s.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(s.inclusiveRight?o.to>=e:o.to>e);(i||(i=[])).push(new K(s,o.from,l?null:o.to))}}return i}function Z(t,e,n){var i;if(t)for(var r=0;r<t.length;++r){var o=t[r],s=o.marker,a=null==o.to||(s.inclusiveRight?o.to>=e:o.to>e);if(a||o.from==e&&"bookmark"==s.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(s.inclusiveLeft?o.from<=e:o.from<e);(i||(i=[])).push(new K(s,l?null:o.from-e,null==o.to?null:o.to-e))}}return i}function Q(t,e){if(e.full)return null;var n=D(t,e.from.line)&&M(t,e.from.line).markedSpans,i=D(t,e.to.line)&&M(t,e.to.line).markedSpans;if(!n&&!i)return null;var r=e.from.ch,o=e.to.ch,s=0==F(e.from,e.to),a=J(n,r,s),l=Z(i,o,s),c=1==e.text.length,u=g(e.text).length+(c?r:0);if(a)for(var h=0;h<a.length;++h){var d=a[h];if(null==d.to){var f=G(l,d.marker);f?c&&(d.to=null==f.to?null:f.to+u):d.to=r}}if(l)for(var p=0;p<l.length;++p){var v=l[p];if(null!=v.to&&(v.to+=u),null==v.from){var m=G(a,v.marker);m||(v.from=u,c&&(a||(a=[])).push(v))}else v.from+=u,c&&(a||(a=[])).push(v)}a&&(a=tt(a)),l&&l!=a&&(l=tt(l));var y=[a];if(!c){var b,x=e.text.length-2;if(x>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(b||(b=[])).push(new K(a[w].marker,null,null));for(var C=0;C<x;++C)y.push(b);y.push(l)}return y}function tt(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&t.splice(e--,1)}return t.length?t:null}function et(t,e,n){var i=null;if(t.iter(e.line,n.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||i&&d(i,n)!=-1||(i||(i=[])).push(n)}}),!i)return null;for(var r=[{from:e,to:n}],o=0;o<i.length;++o)for(var s=i[o],a=s.find(0),l=0;l<r.length;++l){var c=r[l];if(!(F(c.to,a.from)<0||F(c.from,a.to)>0)){var u=[l,1],h=F(c.from,a.from),f=F(c.to,a.to);(h<0||!s.inclusiveLeft&&!h)&&u.push({from:c.from,to:a.from}),(f>0||!s.inclusiveRight&&!f)&&u.push({from:a.to,to:c.to}),r.splice.apply(r,u),l+=u.length-3}}return r}function nt(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function it(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function rt(t){return t.inclusiveLeft?-1:0}function ot(t){return t.inclusiveRight?1:0}function st(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var i=t.find(),r=e.find(),o=F(i.from,r.from)||rt(t)-rt(e);if(o)return-o;var s=F(i.to,r.to)||ot(t)-ot(e);return s?s:e.id-t.id}function at(t,e){var n,i=Zs&&t.markedSpans;if(i)for(var r=void 0,o=0;o<i.length;++o)r=i[o],r.marker.collapsed&&null==(e?r.from:r.to)&&(!n||st(n,r.marker)<0)&&(n=r.marker);return n}function lt(t){return at(t,!0)}function ct(t){return at(t,!1)}function ut(t,e,n,i,r){var o=M(t,e),s=Zs&&o.markedSpans;if(s)for(var a=0;a<s.length;++a){var l=s[a];if(l.marker.collapsed){var c=l.marker.find(0),u=F(c.from,n)||rt(l.marker)-rt(r),h=F(c.to,i)||ot(l.marker)-ot(r);if(!(u>=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(c.to,n)>=0:F(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?F(c.from,i)<=0:F(c.from,i)<0)))return!0}}}function ht(t){for(var e;e=lt(t);)t=e.find(-1,!0).line;return t}function dt(t){for(var e;e=ct(t);)t=e.find(1,!0).line;return t}function ft(t){for(var e,n;e=ct(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function pt(t,e){var n=M(t,e),i=ht(n);return n==i?e:L(i)}function gt(t,e){if(e>t.lastLine())return e;var n,i=M(t,e);if(!vt(t,i))return e;for(;n=ct(i);)i=n.find(1,!0).line;return L(i)+1}function vt(t,e){var n=Zs&&e.markedSpans;if(n)for(var i=void 0,r=0;r<n.length;++r)if(i=n[r],i.marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&mt(t,e,i))return!0}}function mt(t,e,n){if(null==n.to){var i=n.marker.find(1,!0);return mt(t,i.line,G(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var r=void 0,o=0;o<e.markedSpans.length;++o)if(r=e.markedSpans[o],r.marker.collapsed&&!r.marker.widgetNode&&r.from==n.to&&(null==r.to||r.to!=n.from)&&(r.marker.inclusiveLeft||n.marker.inclusiveRight)&&mt(t,e,r))return!0}function yt(t){t=ht(t);for(var e=0,n=t.parent,i=0;i<n.lines.length;++i){var r=n.lines[i];if(r==t)break;e+=r.height}for(var o=n.parent;o;n=o,o=n.parent)for(var s=0;s<o.children.length;++s){var a=o.children[s];if(a==n)break;e+=a.height}return e}function bt(t){if(0==t.height)return 0;for(var e,n=t.text.length,i=t;e=lt(i);){var r=e.find(0,!0);i=r.from.line,n+=r.from.ch-r.to.ch}for(i=t;e=ct(i);){var o=e.find(0,!0);n-=i.text.length-o.from.ch,i=o.to.line,n+=i.text.length-o.to.ch}return n}function xt(t){var e=t.display,n=t.doc;e.maxLine=M(n,n.first),e.maxLineLength=bt(e.maxLine),e.maxLineChanged=!0,n.iter(function(t){var n=bt(t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function wt(t,e,n,i){if(!t)return i(e,n,"ltr",0);for(var r=!1,o=0;o<t.length;++o){var s=t[o];(s.from<n&&s.to>e||e==n&&s.to==e)&&(i(Math.max(s.from,e),Math.min(s.to,n),1==s.level?"rtl":"ltr",o),r=!0)}r||i(e,n,"ltr")}function Ct(t,e,n){var i;Qs=null;for(var r=0;r<t.length;++r){var o=t[r];if(o.from<e&&o.to>e)return r;o.to==e&&(o.from!=o.to&&"before"==n?i=r:Qs=r),o.from==e&&(o.from!=o.to&&"before"!=n?i=r:Qs=r)}return null!=i?i:Qs}function kt(t,e){var n=t.order;return null==n&&(n=t.order=ta(t.text,e)),n}function St(t,e){return t._handlers&&t._handlers[e]||ea}function Tt(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var i=t._handlers,r=i&&i[e];if(r){var o=d(r,n);o>-1&&(i[e]=r.slice(0,o).concat(r.slice(o+1)))}}}function Et(t,e){var n=St(t,e);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,i)}function Mt(t,e,n){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),Et(t,n||e.type,t,e),Dt(e)||e.codemirrorIgnore}function Pt(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),i=0;i<e.length;++i)d(n,e[i])==-1&&n.push(e[i])}function At(t,e){return St(t,e).length>0}function Ot(t){t.prototype.on=function(t,e){na(this,t,e)},t.prototype.off=function(t,e){Tt(this,t,e)}}function Lt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Nt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Dt(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function It(t){Lt(t),Nt(t)}function _t(t){return t.target||t.srcElement}function Ft(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Ls&&t.ctrlKey&&1==e&&(e=3),e}function zt(t){if(null==Hs){var e=i("span","");n(t,i("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Hs=e.offsetWidth<=1&&e.offsetHeight>2&&!(bs&&xs<8))}var r=Hs?i("span",""):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Rt(t){if(null!=js)return js;var i=n(t,document.createTextNode("AخA")),r=_s(i,0,1).getBoundingClientRect(),o=_s(i,1,2).getBoundingClientRect();return e(t),!(!r||r.left==r.right)&&(js=o.right-r.right<3)}function $t(t){if(null!=aa)return aa;var e=n(t,i("span","x")),r=e.getBoundingClientRect(),o=_s(e,0,1).getBoundingClientRect();return aa=Math.abs(r.left-o.left)>1}function Vt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),la[t]=e}function Ht(t,e){ca[t]=e}function jt(t){if("string"==typeof t&&ca.hasOwnProperty(t))t=ca[t];else if(t&&"string"==typeof t.name&&ca.hasOwnProperty(t.name)){var e=ca[t.name];"string"==typeof e&&(e={name:e}),t=b(e,t),t.name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return jt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return jt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Bt(t,e){e=jt(e);var n=la[e.name];if(!n)return Bt(t,"text/plain");var i=n(t,e);if(ua.hasOwnProperty(e.name)){var r=ua[e.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=e.name,e.helperType&&(i.helperType=e.helperType),e.modeProps)for(var s in e.modeProps)i[s]=e.modeProps[s];return i}function Wt(t,e){var n=ua.hasOwnProperty(t)?ua[t]:ua[t]={};u(e,n)}function Ut(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var r=e[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function qt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e),n&&n.mode!=t);)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Kt(t,e,n){return!t.startState||t.startState(e,n)}function Gt(t,e,n,i){var r=[t.state.modeGen],o={};ne(t,e.text,t.doc.mode,n,function(t,e){return r.push(t,e)},o,i);for(var s=n.state,a=function(i){n.baseTokens=r;var a=t.state.overlays[i],l=1,c=0;n.state=!0,ne(t,e.text,a.mode,n,function(t,e){for(var n=l;c<t;){var i=r[l];i>t&&r.splice(l,1,t,r[l+1],i),l+=2,c=Math.min(t,i)}if(e)if(a.opaque)r.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;n<l;n+=2){var o=r[n+1];r[n+1]=(o?o+" ":"")+"overlay "+e}},o),n.state=s,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)a(l);return{styles:r,classes:o.bgClass||o.textClass?o:null}}function Yt(t,e,n){if(!e.styles||e.styles[0]!=t.state.modeGen){var i=Xt(t,L(e)),r=e.text.length>t.options.maxHighlightLength&&Ut(t.doc.mode,i.state),o=Gt(t,e,i);r&&(i.state=r),e.stateAfter=i.save(!r),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function Xt(t,e,n){var i=t.doc,r=t.display;if(!i.mode.startState)return new fa(i,(!0),e);var o=ie(t,e,n),s=o>i.first&&M(i,o-1).stateAfter,a=s?fa.fromSaved(i,s,o):new fa(i,Kt(i.mode),o);return i.iter(o,e,function(n){Jt(t,n.text,a);var i=a.line;n.stateAfter=i==e-1||i%5==0||i>=r.viewFrom&&i<r.viewTo?a.save():null,a.nextLine()}),n&&(i.modeFrontier=a.line),a}function Jt(t,e,n,i){var r=t.doc.mode,o=new ha(e,t.options.tabSize,n);for(o.start=o.pos=i||0,""==e&&Zt(r,n.state);!o.eol();)Qt(r,o,n.state),o.start=o.pos}function Zt(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var n=qt(t,e);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Qt(t,e,n,i){for(var r=0;r<10;r++){i&&(i[0]=qt(t,n).mode);var o=t.token(e,n);if(e.pos>e.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}function te(t,e,n,i){var r,o=t.doc,s=o.mode;e=j(o,e);var a,l=M(o,e.line),c=Xt(t,e.line,n),u=new ha(l.text,t.options.tabSize,c);for(i&&(a=[]);(i||u.pos<e.ch)&&!u.eol();)u.start=u.pos,r=Qt(s,u,c.state),i&&a.push(new pa(u,r,Ut(o.mode,c.state)));return i?a:new pa(u,r,c.state)}function ee(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";null==e[i]?e[i]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(e[i])||(e[i]+=" "+n[2])}return t}function ne(t,e,n,i,r,o,s){var a=n.flattenSpans;null==a&&(a=t.options.flattenSpans);var l,c=0,u=null,h=new ha(e,t.options.tabSize,i),d=t.options.addModeClass&&[null];for(""==e&&ee(Zt(n,i.state),o);!h.eol();){if(h.pos>t.options.maxHighlightLength?(a=!1,s&&Jt(t,e,i,h.pos),h.pos=e.length,l=null):l=ee(Qt(n,h,i.state,d),o),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!a||u!=l){for(;c<h.start;)c=Math.min(h.start,c+5e3),r(c,u);u=l}h.start=h.pos}for(;c<h.pos;){var p=Math.min(h.pos,c+5e3);r(p,u),c=p}}function ie(t,e,n){for(var i,r,o=t.doc,s=n?-1:e-(t.doc.mode.innerMode?1e3:100),a=e;a>s;--a){if(a<=o.first)return o.first;var l=M(o,a-1),c=l.stateAfter;if(c&&(!n||a+(c instanceof da?c.lookAhead:0)<=o.modeFrontier))return a;var u=h(l.text,null,t.options.tabSize);(null==r||i>u)&&(r=a-1,i=u)}return r}function re(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontier<e-10)){for(var n=t.first,i=e-1;i>n;i--){var r=M(t,i).stateAfter;if(r&&(!(r instanceof da)||i+r.lookAhead<e)){n=i+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,n)}}function oe(t,e,n,i){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),nt(t),it(t,n);var r=i?i(t):1;r!=t.height&&O(t,r)}function se(t){t.parent=null,nt(t)}function ae(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?ya:ma;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function le(t,e){var n=r("span",null,null,ws?"padding-right: .1px":null),i={pre:r("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:(bs||ws)&&t.getOption("lineWrapping")};e.measure={};for(var o=0;o<=(e.rest?e.rest.length:0);o++){var s=o?e.rest[o-1]:e.line,a=void 0;i.pos=0,i.addToken=ue,Rt(t.display.measure)&&(a=kt(s,t.doc.direction))&&(i.addToken=de(i.addToken,a)),i.map=[];var c=e!=t.display.externalMeasured&&L(s);pe(s,i,Yt(t,s,c)),s.styleClasses&&(s.styleClasses.bgClass&&(i.bgClass=l(s.styleClasses.bgClass,i.bgClass||"")),s.styleClasses.textClass&&(i.textClass=l(s.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(zt(t.display.measure))),0==o?(e.measure.map=i.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(i.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(ws){var u=i.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Et(t,"renderLine",t,e.line,i.pre),i.pre.className&&(i.textClass=l(i.pre.className,i.textClass||"")),i}function ce(t){var e=i("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function ue(t,e,n,r,o,s,a){if(e){var l,c=t.splitSpaces?he(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 v=document.createTextNode(c.slice(d,d+g));bs&&xs<9?l.appendChild(i("span",[v])):l.appendChild(v),t.map.push(t.pos,t.pos+g,v),t.col+=g,t.pos+=g}if(!f)break;d+=g+1;var m=void 0;if("\t"==f[0]){var y=t.cm.options.tabSize,b=y-t.col%y;m=l.appendChild(i("span",p(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),t.col+=b}else"\r"==f[0]||"\n"==f[0]?(m=l.appendChild(i("span","\r"==f[0]?"␍":"␤","cm-invalidchar")),m.setAttribute("cm-text",f[0]),t.col+=1):(m=t.cm.options.specialCharPlaceholder(f[0]),m.setAttribute("cm-text",f[0]),bs&&xs<9?l.appendChild(i("span",[m])):l.appendChild(m),t.col+=1);t.map.push(t.pos,t.pos+1,m),t.pos++}}else t.col+=e.length,l=document.createTextNode(c),t.map.push(t.pos,t.pos+e.length,l),bs&&xs<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==c.charCodeAt(e.length-1),n||r||o||h||a){var x=n||"";r&&(x+=r),o&&(x+=o);var w=i("span",[l],x,a);return s&&(w.title=s),t.content.appendChild(w)}t.content.appendChild(l)}}function he(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,i="",r=0;r<t.length;r++){var o=t.charAt(r);" "!=o||!n||r!=t.length-1&&32!=t.charCodeAt(r+1)||(o=" "),i+=o,n=" "==o}return i}function de(t,e){return function(n,i,r,o,s,a,l){r=r?r+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+i.length;;){for(var h=void 0,d=0;d<e.length&&(h=e[d],!(h.to>c&&h.from<=c));d++);if(h.to>=u)return t(n,i,r,o,s,a,l);t(n,i.slice(0,h.to-c),r,o,null,a,l),o=null,i=i.slice(h.to-c),c=h.to}}}function fe(t,e,n,i){var r=!i&&n.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!i&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function pe(t,e,n){var i=t.markedSpans,r=t.text,o=0;if(i)for(var s,a,l,c,u,h,d,f=r.length,p=0,g=1,v="",m=0;;){if(m==p){l=c=u=h=a="",d=null,m=1/0;for(var y=[],b=void 0,x=0;x<i.length;++x){var w=i[x],C=w.marker;"bookmark"==C.type&&w.from==p&&C.widgetNode?y.push(C):w.from<=p&&(null==w.to||w.to>p||C.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&m>w.to&&(m=w.to,c=""),C.className&&(l+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&w.from==p&&(u+=" "+C.startStyle),C.endStyle&&w.to==m&&(b||(b=[])).push(C.endStyle,w.to),C.title&&!h&&(h=C.title),C.collapsed&&(!d||st(d.marker,C)<0)&&(d=w)):w.from>p&&m>w.from&&(m=w.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==m&&(c+=" "+b[k]);if(!d||d.from==p)for(var S=0;S<y.length;++S)fe(e,0,y[S]);if(d&&(d.from||0)==p){if(fe(e,(null==d.to?f+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(p>=f)break;for(var T=Math.min(f,m);;){if(v){var E=p+v.length;if(!d){var M=E>T?v.slice(0,T-p):v;e.addToken(e,M,s?s+l:l,u,p+M.length==m?c:"",h,a)}if(E>=T){v=v.slice(T-p),p=T;break}p=E,u=""}v=r.slice(o,o=n[g++]),s=ae(n[g++],e.cm.options)}}else for(var P=1;P<n.length;P+=2)e.addToken(e,r.slice(o,o=n[P]),ae(n[P+1],e.cm.options))}function ge(t,e,n){this.line=e,this.rest=ft(e),this.size=this.rest?L(g(this.rest))-n+1:1,this.node=this.text=null,this.hidden=vt(t,e)}function ve(t,e,n){for(var i,r=[],o=e;o<n;o=i){var s=new ge(t.doc,M(t.doc,o),o);i=o+s.size,r.push(s)}return r}function me(t){ba?ba.ops.push(t):t.ownsGroup=ba={ops:[t],delayedCallbacks:[]}}function ye(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n].call(null);for(var i=0;i<t.ops.length;i++){var r=t.ops[i];if(r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(n<e.length)}function be(t,e){var n=t.ownsGroup;if(n)try{ye(n)}finally{ba=null,e(n)}}function xe(t,e){var n=St(t,e);if(n.length){var i,r=Array.prototype.slice.call(arguments,2);ba?i=ba.delayedCallbacks:xa?i=xa:(i=xa=[],setTimeout(we,0));for(var o=function(t){i.push(function(){return n[t].apply(null,r)})},s=0;s<n.length;++s)o(s)}}function we(){var t=xa;xa=null;for(var e=0;e<t.length;++e)t[e]()}function Ce(t,e,n,i){for(var r=0;r<e.changes.length;r++){var o=e.changes[r];"text"==o?Ee(t,e):"gutter"==o?Pe(t,e,n,i):"class"==o?Me(t,e):"widget"==o&&Ae(t,e,i)}e.changes=null}function ke(t){return t.node==t.text&&(t.node=i("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),bs&&xs<8&&(t.node.style.zIndex=2)),t.node}function Se(t,e){var n=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),e.background)n?e.background.className=n:(e.background.parentNode.removeChild(e.background),e.background=null);else if(n){var r=ke(e);e.background=r.insertBefore(i("div",null,n),r.firstChild),t.display.input.setUneditable(e.background)}}function Te(t,e){var n=t.display.externalMeasured;return n&&n.line==e.line?(t.display.externalMeasured=null,e.measure=n.measure,n.built):le(t,e)}function Ee(t,e){var n=e.text.className,i=Te(t,e);e.text==e.node&&(e.node=i.pre),e.text.parentNode.replaceChild(i.pre,e.text),e.text=i.pre,i.bgClass!=e.bgClass||i.textClass!=e.textClass?(e.bgClass=i.bgClass,e.textClass=i.textClass,Me(t,e)):n&&(e.text.className=n)}function Me(t,e){Se(t,e),e.line.wrapClass?ke(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var n=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=n||""}function Pe(t,e,n,r){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var o=ke(e);e.gutterBackground=i("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),t.display.input.setUneditable(e.gutterBackground),o.insertBefore(e.gutterBackground,e.text)}var s=e.line.gutterMarkers;if(t.options.lineNumbers||s){var a=ke(e),l=e.gutter=i("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(t.display.input.setUneditable(l),a.insertBefore(l,e.text),e.line.gutterClass&&(l.className+=" "+e.line.gutterClass),!t.options.lineNumbers||s&&s["CodeMirror-linenumbers"]||(e.lineNumber=l.appendChild(i("div",I(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),s)for(var c=0;c<t.options.gutters.length;++c){var u=t.options.gutters[c],h=s.hasOwnProperty(u)&&s[u];h&&l.appendChild(i("div",[h],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function Ae(t,e,n){e.alignable&&(e.alignable=null);for(var i=e.node.firstChild,r=void 0;i;i=r)r=i.nextSibling,"CodeMirror-linewidget"==i.className&&e.node.removeChild(i);Le(t,e,n)}function Oe(t,e,n,i){var r=Te(t,e);return e.text=e.node=r.pre,r.bgClass&&(e.bgClass=r.bgClass),r.textClass&&(e.textClass=r.textClass),Me(t,e),Pe(t,e,n,i),Le(t,e,i),e.node}function Le(t,e,n){if(Ne(t,e.line,e,n,!0),e.rest)for(var i=0;i<e.rest.length;i++)Ne(t,e.rest[i],e,n,!1)}function Ne(t,e,n,r,o){if(e.widgets)for(var s=ke(n),a=0,l=e.widgets;a<l.length;++a){var c=l[a],u=i("div",[c.node],"CodeMirror-linewidget");c.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),De(c,u,n,r),t.display.input.setUneditable(u),o&&c.above?s.insertBefore(u,n.gutter||n.text):s.appendChild(u),xe(c,"redraw")}}function De(t,e,n,i){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var r=i.wrapperWidth;e.style.left=i.fixedPos+"px",t.coverGutter||(r-=i.gutterTotalWidth,e.style.paddingLeft=i.gutterTotalWidth+"px"),e.style.width=r+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-i.gutterTotalWidth+"px"))}function Ie(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!o(document.body,t.node)){var r="position: relative;";t.coverGutter&&(r+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(r+="width: "+e.display.wrapper.clientWidth+"px;"),n(e.display.measure,i("div",[t.node],null,r))}return t.height=t.node.parentNode.offsetHeight}function _e(t,e){for(var n=_t(e);n!=t.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==t.sizer&&n!=t.mover)return!0}function Fe(t){return t.lineSpace.offsetTop}function ze(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Re(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=n(t.measure,i("pre","x")),r=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,o={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(o.left)||isNaN(o.right)||(t.cachedPaddingH=o),o}function $e(t){return Bs-t.display.nativeBarWidth}function Ve(t){return t.display.scroller.clientWidth-$e(t)-t.display.barWidth}function He(t){return t.display.scroller.clientHeight-$e(t)-t.display.barHeight}function je(t,e,n){var i=t.options.lineWrapping,r=i&&Ve(t);if(!e.measure.heights||i&&e.measure.width!=r){var o=e.measure.heights=[];if(i){e.measure.width=r;for(var s=e.text.firstChild.getClientRects(),a=0;a<s.length-1;a++){var l=s[a],c=s[a+1];Math.abs(l.bottom-c.bottom)>2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Be(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var i=0;i<t.rest.length;i++)if(t.rest[i]==e)return{map:t.measure.maps[i],cache:t.measure.caches[i]};for(var r=0;r<t.rest.length;r++)if(L(t.rest[r])>n)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function We(t,e){e=ht(e);var i=L(e),r=t.display.externalMeasured=new ge(t.doc,e,i);r.lineN=i;var o=r.built=le(t,r);return r.text=o.pre,n(t.display.lineMeasure,o.pre),r}function Ue(t,e,n,i){return Ge(t,Ke(t,e),n,i)}function qe(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[En(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function Ke(t,e){var n=L(e),i=qe(t,n);i&&!i.text?i=null:i&&i.changes&&(Ce(t,i,n,wn(t)),t.curOp.forceUpdate=!0),i||(i=We(t,e));var r=Be(i,e,n);return{line:e,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function Ge(t,e,n,i,r){e.before&&(n=-1);var o,s=n+(i||"");return e.cache.hasOwnProperty(s)?o=e.cache[s]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(je(t,e.view,e.rect),e.hasHeights=!0),o=Je(t,e,n,i),o.bogus||(e.cache[s]=o)),{left:o.left,right:o.right,top:r?o.rtop:o.top,bottom:r?o.rbottom:o.bottom}}function Ye(t,e,n){for(var i,r,o,s,a,l,c=0;c<t.length;c+=3)if(a=t[c],l=t[c+1],e<a?(r=0,o=1,s="left"):e<l?(r=e-a,o=r+1):(c==t.length-3||e==l&&t[c+3]>e)&&(o=l-a,r=o-1,e>=l&&(s="right")),null!=r){if(i=t[c+2],a==l&&n==(i.insertLeft?"left":"right")&&(s=n),"left"==n&&0==r)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)i=t[(c-=3)+2],s="left";if("right"==n&&r==l-a)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)i=t[(c+=3)+2],s="right";break}return{node:i,start:r,end:o,collapse:s,coverStart:a,coverEnd:l}}function Xe(t,e){var n=wa;if("left"==e)for(var i=0;i<t.length&&(n=t[i]).left==n.right;i++);else for(var r=t.length-1;r>=0&&(n=t[r]).left==n.right;r--);return n}function Je(t,e,n,i){var r,o=Ye(e.map,n,i),s=o.node,a=o.start,l=o.end,c=o.collapse;if(3==s.nodeType){for(var u=0;u<4;u++){for(;a&&k(e.line.text.charAt(o.coverStart+a));)--a;for(;o.coverStart+l<o.coverEnd&&k(e.line.text.charAt(o.coverStart+l));)++l;if(r=bs&&xs<9&&0==a&&l==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():Xe(_s(s,a,l).getClientRects(),i),r.left||r.right||0==a)break;l=a,a-=1,c="right"}bs&&xs<11&&(r=Ze(t.display.measure,r))}else{a>0&&(c=i="right");var h;r=t.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==i?h.length-1:0]:s.getBoundingClientRect()}if(bs&&xs<9&&!a&&(!r||!r.left&&!r.right)){var d=s.parentNode.getClientRects()[0];r=d?{left:d.left,right:d.left+xn(t.display),top:d.top,bottom:d.bottom}:wa}for(var f=r.top-e.rect.top,p=r.bottom-e.rect.top,g=(f+p)/2,v=e.view.measure.heights,m=0;m<v.length-1&&!(g<v[m]);m++);var y=m?v[m-1]:0,b=v[m],x={left:("right"==c?r.right:r.left)-e.rect.left,right:("left"==c?r.left:r.right)-e.rect.left,top:y,bottom:b};return r.left||r.right||(x.bogus=!0),t.options.singleCursorHeightPerLine||(x.rtop=f,x.rbottom=p),x}function Ze(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!$t(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*i,bottom:e.bottom*i}}function Qe(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function tn(t){t.display.externalMeasure=null,e(t.display.lineMeasure);for(var n=0;n<t.display.view.length;n++)Qe(t.display.view[n])}function en(t){tn(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function nn(){return ks&&As?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function rn(){return ks&&As?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function on(t){var e=0;if(t.widgets)for(var n=0;n<t.widgets.length;++n)t.widgets[n].above&&(e+=Ie(t.widgets[n]));return e}function sn(t,e,n,i,r){if(!r){var o=on(e);n.top+=o,n.bottom+=o}if("line"==i)return n;i||(i="local");var s=yt(e);if("local"==i?s+=Fe(t.display):s-=t.display.viewOffset,"page"==i||"window"==i){var a=t.display.lineSpace.getBoundingClientRect();s+=a.top+("window"==i?0:rn());var l=a.left+("window"==i?0:nn());n.left+=l,n.right+=l}return n.top+=s,n.bottom+=s,n}function an(t,e,n){if("div"==n)return e;var i=e.left,r=e.top;if("page"==n)i-=nn(),r-=rn();else if("local"==n||!n){var o=t.display.sizer.getBoundingClientRect();i+=o.left,r+=o.top}var s=t.display.lineSpace.getBoundingClientRect();return{left:i-s.left,top:r-s.top}}function ln(t,e,n,i,r){return i||(i=M(t.doc,e.line)),sn(t,i,Ue(t,i,e.ch,r),n)}function cn(t,e,n,i,r,o){function s(e,s){var a=Ge(t,r,e,s?"right":"left",o);return s?a.left=a.right:a.right=a.left,sn(t,i,a,n)}function a(t,e,n){var i=l[e],r=1==i.level;return s(n?t-1:t,r!=n)}i=i||M(t.doc,e.line),r||(r=Ke(t,i));var l=kt(i,t.doc.direction),c=e.ch,u=e.sticky;if(c>=i.text.length?(c=i.text.length,u="before"):c<=0&&(c=0,u="after"),!l)return s("before"==u?c-1:c,"before"==u);var h=Ct(l,c,u),d=Qs,f=a(c,h,"before"==u);return null!=d&&(f.other=a(c,d,"before"!=u)),f}function un(t,e){var n=0;e=j(t.doc,e),t.options.lineWrapping||(n=xn(t.display)*e.ch);var i=M(t.doc,e.line),r=yt(i)+Fe(t.display);return{left:n,right:n,top:r,bottom:r+i.height}}function hn(t,e,n,i,r){var o=_(t,e,n);return o.xRel=r,i&&(o.outside=!0),o}function dn(t,e,n){var i=t.doc;if(n+=t.display.viewOffset,n<0)return hn(i.first,0,null,!0,-1);var r=N(i,n),o=i.first+i.size-1;if(r>o)return hn(i.first+i.size-1,M(i,o).text.length,null,!0,1);e<0&&(e=0);for(var s=M(i,r);;){var a=vn(t,s,r,e,n),l=ct(s),c=l&&l.find(0,!0);if(!l||!(a.ch>c.from.ch||a.ch==c.from.ch&&a.xRel>0))return a;r=L(s=c.to.line)}}function fn(t,e,n,i){i-=on(e);var r=e.text.length,o=T(function(e){return Ge(t,n,e-1).bottom<=i},r,0);return r=T(function(e){return Ge(t,n,e).top>i},o,r),{begin:o,end:r}}function pn(t,e,n,i){n||(n=Ke(t,e));var r=sn(t,e,Ge(t,n,i),"line").top;return fn(t,e,n,r)}function gn(t,e,n,i){return!(t.bottom<=n)&&(t.top>n||(i?t.left:t.right)>e)}function vn(t,e,n,i,r){r-=yt(e);var o=Ke(t,e),s=on(e),a=0,l=e.text.length,c=!0,u=kt(e,t.doc.direction);if(u){var h=(t.options.lineWrapping?yn:mn)(t,e,n,o,u,i,r);c=1!=h.level,a=c?h.from:h.to-1,l=c?h.to:h.from-1}var d,f,p=null,g=null,v=T(function(e){var n=Ge(t,o,e);return n.top+=s,n.bottom+=s,!!gn(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(p=e,g=n),!0)},a,l),m=!1;if(g){var y=i-g.left<g.right-i,b=y==c;v=p+(b?0:1),f=b?"after":"before",d=y?g.left:g.right}else{c||v!=l&&v!=a||v++,f=0==v?"after":v==e.text.length?"before":Ge(t,o,v-(c?1:0)).bottom+s<=r==c?"after":"before";var x=cn(t,_(n,v,f),"line",e,o);d=x.left,m=r<x.top||r>=x.bottom}return v=S(e.text,v,1),hn(n,v,f,m,i-d)}function mn(t,e,n,i,r,o,s){var a=T(function(a){
var l=r[a],c=1!=l.level;return gn(cn(t,_(n,c?l.to:l.from,c?"before":"after"),"line",e,i),o,s,!0)},0,r.length-1),l=r[a];if(a>0){var c=1!=l.level,u=cn(t,_(n,c?l.from:l.to,c?"after":"before"),"line",e,i);gn(u,o,s,!0)&&u.top>s&&(l=r[a-1])}return l}function yn(t,e,n,i,r,o,s){var a=fn(t,e,i,s),l=a.begin,c=a.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,h=null,d=0;d<r.length;d++){var f=r[d];if(!(f.from>=c||f.to<=l)){var p=1!=f.level,g=Ge(t,i,p?Math.min(c,f.to)-1:Math.max(l,f.from)).right,v=g<o?o-g+1e9:g-o;(!u||h>v)&&(u=f,h=v)}}return u||(u=r[r.length-1]),u.from<l&&(u={from:l,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function bn(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==va){va=i("pre");for(var r=0;r<49;++r)va.appendChild(document.createTextNode("x")),va.appendChild(i("br"));va.appendChild(document.createTextNode("x"))}n(t.measure,va);var o=va.offsetHeight/50;return o>3&&(t.cachedTextHeight=o),e(t.measure),o||1}function xn(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=i("span","xxxxxxxxxx"),r=i("pre",[e]);n(t.measure,r);var o=e.getBoundingClientRect(),s=(o.right-o.left)/10;return s>2&&(t.cachedCharWidth=s),s||10}function wn(t){for(var e=t.display,n={},i={},r=e.gutters.clientLeft,o=e.gutters.firstChild,s=0;o;o=o.nextSibling,++s)n[t.options.gutters[s]]=o.offsetLeft+o.clientLeft+r,i[t.options.gutters[s]]=o.clientWidth;return{fixedPos:Cn(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function Cn(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function kn(t){var e=bn(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/xn(t.display)-3);return function(r){if(vt(t.doc,r))return 0;var o=0;if(r.widgets)for(var s=0;s<r.widgets.length;s++)r.widgets[s].height&&(o+=r.widgets[s].height);return n?o+(Math.ceil(r.text.length/i)||1)*e:o+e}}function Sn(t){var e=t.doc,n=kn(t);e.iter(function(t){var e=n(t);e!=t.height&&O(t,e)})}function Tn(t,e,n,i){var r=t.display;if(!n&&"true"==_t(e).getAttribute("cm-not-content"))return null;var o,s,a=r.lineSpace.getBoundingClientRect();try{o=e.clientX-a.left,s=e.clientY-a.top}catch(e){return null}var l,c=dn(t,o,s);if(i&&1==c.xRel&&(l=M(t.doc,c.line).text).length==c.ch){var u=h(l,l.length,t.options.tabSize)-l.length;c=_(c.line,Math.max(0,Math.round((o-Re(t.display).left)/xn(t.display))-u))}return c}function En(t,e){if(e>=t.display.viewTo)return null;if(e-=t.display.viewFrom,e<0)return null;for(var n=t.display.view,i=0;i<n.length;i++)if(e-=n[i].size,e<0)return i}function Mn(t){t.display.input.showSelection(t.display.input.prepareSelection())}function Pn(t,e){void 0===e&&(e=!0);for(var n=t.doc,i={},r=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),s=0;s<n.sel.ranges.length;s++)if(e||s!=n.sel.primIndex){var a=n.sel.ranges[s];if(!(a.from().line>=t.display.viewTo||a.to().line<t.display.viewFrom)){var l=a.empty();(l||t.options.showCursorWhenSelecting)&&An(t,a.head,r),l||Ln(t,a,o)}}return i}function An(t,e,n){var r=cn(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),o=n.appendChild(i("div"," ","CodeMirror-cursor"));if(o.style.left=r.left+"px",o.style.top=r.top+"px",o.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px",r.other){var s=n.appendChild(i("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=r.other.left+"px",s.style.top=r.other.top+"px",s.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function On(t,e){return t.top-e.top||t.left-e.left}function Ln(t,e,n){function r(t,e,n,r){e<0&&(e=0),e=Math.round(e),r=Math.round(r),l.appendChild(i("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==n?h-t:n)+"px;\n height: "+(r-e)+"px"))}function o(e,n,i){function o(n,i){return ln(t,_(e,n),"div",f,i)}function s(e,n,i){var r=pn(t,f,null,e),s="ltr"==n==("after"==i)?"left":"right",a="after"==i?r.begin:r.end-(/\s/.test(f.text.charAt(r.end-1))?2:1);return o(a,s)[s]}var l,c,f=M(a,e),p=f.text.length,g=kt(f,a.direction);return wt(g,n||0,null==i?p:i,function(t,e,a,f){var v="ltr"==a,m=o(t,v?"left":"right"),y=o(e-1,v?"right":"left"),b=null==n&&0==t,x=null==i&&e==p,w=0==f,C=!g||f==g.length-1;if(y.top-m.top<=3){var k=(d?b:x)&&w,S=(d?x:b)&&C,T=k?u:(v?m:y).left,E=S?h:(v?y:m).right;r(T,m.top,E-T,m.bottom)}else{var M,P,A,O;v?(M=d&&b&&w?u:m.left,P=d?h:s(t,a,"before"),A=d?u:s(e,a,"after"),O=d&&x&&C?h:y.right):(M=d?s(t,a,"before"):u,P=!d&&b&&w?h:m.right,A=!d&&x&&C?u:y.left,O=d?s(e,a,"after"):h),r(M,m.top,P-M,m.bottom),m.bottom<y.top&&r(u,m.bottom,null,y.top),r(A,y.top,O-A,y.bottom)}(!l||On(m,l)<0)&&(l=m),On(y,l)<0&&(l=y),(!c||On(m,c)<0)&&(c=m),On(y,c)<0&&(c=y)}),{start:l,end:c}}var s=t.display,a=t.doc,l=document.createDocumentFragment(),c=Re(t.display),u=c.left,h=Math.max(s.sizerWidth,Ve(t)-s.sizer.offsetLeft)-c.right,d="ltr"==a.direction,f=e.from(),p=e.to();if(f.line==p.line)o(f.line,f.ch,p.ch);else{var g=M(a,f.line),v=M(a,p.line),m=ht(g)==ht(v),y=o(f.line,f.ch,m?g.text.length+1:null).end,b=o(p.line,m?0:null,p.ch).start;m&&(y.top<b.top-2?(r(y.right,y.top,null,y.bottom),r(u,b.top,b.left,b.bottom)):r(y.right,y.top,b.left-y.right,y.bottom)),y.bottom<b.top&&r(u,y.bottom,null,b.top)}n.appendChild(l)}function Nn(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Dn(t){t.state.focused||(t.display.input.focus(),_n(t))}function In(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,Fn(t))},100)}function _n(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(Et(t,"focus",t,e),t.state.focused=!0,a(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),ws&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Nn(t))}function Fn(t,e){t.state.delayingBlurEvent||(t.state.focused&&(Et(t,"blur",t,e),t.state.focused=!1,Rs(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function zn(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=0;i<e.view.length;i++){var r=e.view[i],o=void 0;if(!r.hidden){if(bs&&xs<8){var s=r.node.offsetTop+r.node.offsetHeight;o=s-n,n=s}else{var a=r.node.getBoundingClientRect();o=a.bottom-a.top}var l=r.line.height-o;if(o<2&&(o=bn(e)),(l>.005||l<-.005)&&(O(r.line,o),Rn(r.line),r.rest))for(var c=0;c<r.rest.length;c++)Rn(r.rest[c])}}}function Rn(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e)t.widgets[e].height=t.widgets[e].node.parentNode.offsetHeight}function $n(t,e,n){var i=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;i=Math.floor(i-Fe(t));var r=n&&null!=n.bottom?n.bottom:i+t.wrapper.clientHeight,o=N(e,i),s=N(e,r);if(n&&n.ensure){var a=n.ensure.from.line,l=n.ensure.to.line;a<o?(o=a,s=N(e,yt(M(e,a))+t.wrapper.clientHeight)):Math.min(l,e.lastLine())>=s&&(o=N(e,yt(M(e,l))-t.wrapper.clientHeight),s=l)}return{from:o,to:Math.max(s,o+1)}}function Vn(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=Cn(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,o=i+"px",s=0;s<n.length;s++)if(!n[s].hidden){t.options.fixedGutter&&(n[s].gutter&&(n[s].gutter.style.left=o),n[s].gutterBackground&&(n[s].gutterBackground.style.left=o));var a=n[s].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=i+r+"px")}}function Hn(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=I(t.options,e.first+e.size-1),r=t.display;if(n.length!=r.lineNumChars){var o=r.measure.appendChild(i("div",[i("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),s=o.firstChild.offsetWidth,a=o.offsetWidth-s;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(s,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ni(t),!0}return!1}function jn(t,e){if(!Mt(t,"scrollCursorIntoView")){var n=t.display,r=n.sizer.getBoundingClientRect(),o=null;if(e.top+r.top<0?o=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Ms){var s=i("div","",null,"position: absolute;\n top: "+(e.top-n.viewOffset-Fe(t.display))+"px;\n height: "+(e.bottom-e.top+$e(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(s),s.scrollIntoView(o),t.display.lineSpace.removeChild(s)}}}function Bn(t,e,n,i){null==i&&(i=0);var r;t.options.lineWrapping||e!=n||(e=e.ch?_(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e,n="before"==e.sticky?_(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var s=!1,a=cn(t,e),l=n&&n!=e?cn(t,n):a;r={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i};var c=Un(t,r),u=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=c.scrollTop&&(Zn(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(s=!0)),null!=c.scrollLeft&&(ti(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(s=!0)),!s)break}return r}function Wn(t,e){var n=Un(t,e);null!=n.scrollTop&&Zn(t,n.scrollTop),null!=n.scrollLeft&&ti(t,n.scrollLeft)}function Un(t,e){var n=t.display,i=bn(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=He(t),s={};e.bottom-e.top>o&&(e.bottom=e.top+o);var a=t.doc.height+ze(n),l=e.top<i,c=e.bottom>a-i;if(e.top<r)s.scrollTop=l?0:e.top;else if(e.bottom>r+o){var u=Math.min(e.top,(c?a:e.bottom)-o);u!=r&&(s.scrollTop=u)}var h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft,d=Ve(t)-(t.options.fixedGutter?n.gutters.offsetWidth:0),f=e.right-e.left>d;return f&&(e.right=e.left+d),e.left<10?s.scrollLeft=0:e.left<h?s.scrollLeft=Math.max(0,e.left-(f?0:10)):e.right>d+h-3&&(s.scrollLeft=e.right+(f?0:10)-d),s}function qn(t,e){null!=e&&(Xn(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Kn(t){Xn(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Gn(t,e,n){null==e&&null==n||Xn(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function Yn(t,e){Xn(t),t.curOp.scrollToPos=e}function Xn(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var n=un(t,e.from),i=un(t,e.to);Jn(t,n,i,e.margin)}}function Jn(t,e,n,i){var r=Un(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-i,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+i});Gn(t,r.scrollLeft,r.scrollTop)}function Zn(t,e){Math.abs(t.doc.scrollTop-e)<2||(gs||Oi(t,{top:e}),Qn(t,e,!0),gs&&Oi(t),ki(t,100))}function Qn(t,e,n){e=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function ti(t,e,n,i){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!i||(t.doc.scrollLeft=e,Vn(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function ei(t){var e=t.display,n=e.gutters.offsetWidth,i=Math.round(t.doc.height+ze(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+$e(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}function ni(t,e){e||(e=ei(t));var n=t.display.barWidth,i=t.display.barHeight;ii(t,e);for(var r=0;r<4&&n!=t.display.barWidth||i!=t.display.barHeight;r++)n!=t.display.barWidth&&t.options.lineWrapping&&zn(t),ii(t,ei(t)),n=t.display.barWidth,i=t.display.barHeight}function ii(t,e){var n=t.display,i=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}function ri(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Rs(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Sa[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),na(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?ti(t,e):Zn(t,e)},t),t.display.scrollbars.addClass&&a(t.display.wrapper,t.display.scrollbars.addClass)}function oi(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ta},me(t.curOp)}function si(t){var e=t.curOp;be(e,function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;ai(t)})}function ai(t){for(var e=t.ops,n=0;n<e.length;n++)li(e[n]);for(var i=0;i<e.length;i++)ci(e[i]);for(var r=0;r<e.length;r++)ui(e[r]);for(var o=0;o<e.length;o++)hi(e[o]);for(var s=0;s<e.length;s++)di(e[s])}function li(t){var e=t.cm,n=e.display;Ti(e),t.updateMaxLine&&xt(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new Ea(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function ci(t){t.updatedDisplay=t.mustUpdate&&Pi(t.cm,t.update)}function ui(t){var e=t.cm,n=e.display;t.updatedDisplay&&zn(e),t.barMeasure=ei(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ue(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+$e(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Ve(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function hi(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&ti(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var n=t.focus&&t.focus==s();t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,n),(t.updatedDisplay||t.startHeight!=e.doc.height)&&ni(e,t.barMeasure),t.updatedDisplay&&Di(e,t.barMeasure),t.selectionChanged&&Nn(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),n&&Dn(t.cm)}function di(t){var e=t.cm,n=e.display,i=e.doc;if(t.updatedDisplay&&Ai(e,t.update),null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=t.scrollTop&&Qn(e,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&ti(e,t.scrollLeft,!0,!0),t.scrollToPos){var r=Bn(e,j(i,t.scrollToPos.from),j(i,t.scrollToPos.to),t.scrollToPos.margin);jn(e,r)}var o=t.maybeHiddenMarkers,s=t.maybeUnhiddenMarkers;if(o)for(var a=0;a<o.length;++a)o[a].lines.length||Et(o[a],"hide");if(s)for(var l=0;l<s.length;++l)s[l].lines.length&&Et(s[l],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&Et(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function fi(t,e){if(t.curOp)return e();oi(t);try{return e()}finally{si(t)}}function pi(t,e){return function(){if(t.curOp)return e.apply(t,arguments);oi(t);try{return e.apply(t,arguments)}finally{si(t)}}}function gi(t){return function(){if(this.curOp)return t.apply(this,arguments);oi(this);try{return t.apply(this,arguments)}finally{si(this)}}}function vi(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);oi(e);try{return t.apply(this,arguments)}finally{si(e)}}}function mi(t,e,n,i){null==e&&(e=t.doc.first),null==n&&(n=t.doc.first+t.doc.size),i||(i=0);var r=t.display;if(i&&n<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>e)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)Zs&&pt(t.doc,e)<r.viewTo&&bi(t);else if(n<=r.viewFrom)Zs&&gt(t.doc,n+i)>r.viewFrom?bi(t):(r.viewFrom+=i,r.viewTo+=i);else if(e<=r.viewFrom&&n>=r.viewTo)bi(t);else if(e<=r.viewFrom){var o=xi(t,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):bi(t)}else if(n>=r.viewTo){var s=xi(t,e,e,-1);s?(r.view=r.view.slice(0,s.index),r.viewTo=s.lineN):bi(t)}else{var a=xi(t,e,e,-1),l=xi(t,n,n+i,1);a&&l?(r.view=r.view.slice(0,a.index).concat(ve(t,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):bi(t)}var c=r.externalMeasured;c&&(n<c.lineN?c.lineN+=i:e<c.lineN+c.size&&(r.externalMeasured=null))}function yi(t,e,n){t.curOp.viewChanged=!0;var i=t.display,r=t.display.externalMeasured;if(r&&e>=r.lineN&&e<r.lineN+r.size&&(i.externalMeasured=null),!(e<i.viewFrom||e>=i.viewTo)){var o=i.view[En(t,e)];if(null!=o.node){var s=o.changes||(o.changes=[]);d(s,n)==-1&&s.push(n)}}}function bi(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function xi(t,e,n,i){var r,o=En(t,e),s=t.display.view;if(!Zs||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var a=t.display.viewFrom,l=0;l<o;l++)a+=s[l].size;if(a!=e){if(i>0){if(o==s.length-1)return null;r=a+s[o].size-e,o++}else r=a-e;e+=r,n+=r}for(;pt(t.doc,n)!=n;){if(o==(i<0?0:s.length-1))return null;n+=i*s[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function wi(t,e,n){var i=t.display,r=i.view;0==r.length||e>=i.viewTo||n<=i.viewFrom?(i.view=ve(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=ve(t,e,i.viewFrom).concat(i.view):i.viewFrom<e&&(i.view=i.view.slice(En(t,e))),i.viewFrom=e,i.viewTo<n?i.view=i.view.concat(ve(t,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,En(t,n)))),i.viewTo=n}function Ci(t){for(var e=t.display.view,n=0,i=0;i<e.length;i++){var r=e[i];r.hidden||r.node&&!r.changes||++n}return n}function ki(t,e){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(e,c(Si,t))}function Si(t){var e=t.doc;if(!(e.highlightFrontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,i=Xt(t,e.highlightFrontier),r=[];e.iter(i.line,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(i.line>=t.display.viewFrom){var s=o.styles,a=o.text.length>t.options.maxHighlightLength?Ut(e.mode,i.state):null,l=Gt(t,o,i,!0);a&&(i.state=a),o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var h=!s||s.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&d<s.length;++d)h=s[d]!=o.styles[d];h&&r.push(i.line),o.stateAfter=i.save(),i.nextLine()}else o.text.length<=t.options.maxHighlightLength&&Jt(t,o.text,i),o.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return ki(t,t.options.workDelay),!0}),e.highlightFrontier=i.line,e.modeFrontier=Math.max(e.modeFrontier,i.line),r.length&&fi(t,function(){for(var e=0;e<r.length;e++)yi(t,r[e],"text")})}}function Ti(t){var e=t.display;!e.scrollbarsClipped&&e.scroller.offsetWidth&&(e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth,e.heightForcer.style.height=$e(t)+"px",e.sizer.style.marginBottom=-e.nativeBarWidth+"px",e.sizer.style.borderRightWidth=$e(t)+"px",e.scrollbarsClipped=!0)}function Ei(t){if(t.hasFocus())return null;var e=s();if(!e||!o(t.display.lineDiv,e))return null;var n={activeElt:e};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&o(t.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function Mi(t){if(t&&t.activeElt&&t.activeElt!=s()&&(t.activeElt.focus(),t.anchorNode&&o(document.body,t.anchorNode)&&o(document.body,t.focusNode))){var e=window.getSelection(),n=document.createRange();n.setEnd(t.anchorNode,t.anchorOffset),n.collapse(!1),e.removeAllRanges(),e.addRange(n),e.extend(t.focusNode,t.focusOffset)}}function Pi(t,n){var i=t.display,r=t.doc;if(n.editorIsHidden)return bi(t),!1;if(!n.force&&n.visible.from>=i.viewFrom&&n.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Ci(t))return!1;Hn(t)&&(bi(t),n.dims=wn(t));var o=r.first+r.size,s=Math.max(n.visible.from-t.options.viewportMargin,r.first),a=Math.min(o,n.visible.to+t.options.viewportMargin);i.viewFrom<s&&s-i.viewFrom<20&&(s=Math.max(r.first,i.viewFrom)),i.viewTo>a&&i.viewTo-a<20&&(a=Math.min(o,i.viewTo)),Zs&&(s=pt(t.doc,s),a=gt(t.doc,a));var l=s!=i.viewFrom||a!=i.viewTo||i.lastWrapHeight!=n.wrapperHeight||i.lastWrapWidth!=n.wrapperWidth;wi(t,s,a),i.viewOffset=yt(M(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var c=Ci(t);if(!l&&0==c&&!n.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var u=Ei(t);return c>4&&(i.lineDiv.style.display="none"),Li(t,i.updateLineNumbers,n.dims),c>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Mi(u),e(i.cursorDiv),e(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,l&&(i.lastWrapHeight=n.wrapperHeight,i.lastWrapWidth=n.wrapperWidth,ki(t,400)),i.updateLineNumbers=null,!0}function Ai(t,e){for(var n=e.viewport,i=!0;(i&&t.options.lineWrapping&&e.oldDisplayWidth!=Ve(t)||(n&&null!=n.top&&(n={top:Math.min(t.doc.height+ze(t.display)-He(t),n.top)}),e.visible=$n(t.display,t.doc,n),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&Pi(t,e);i=!1){zn(t);var r=ei(t);Mn(t),ni(t,r),Di(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Oi(t,e){var n=new Ea(t,e);if(Pi(t,n)){zn(t),Ai(t,n);var i=ei(t);Mn(t),ni(t,i),Di(t,i),n.finish()}}function Li(t,n,i){function r(e){var n=e.nextSibling;return ws&&Ls&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var o=t.display,s=t.options.lineNumbers,a=o.lineDiv,l=a.firstChild,c=o.view,u=o.viewFrom,h=0;h<c.length;h++){var f=c[h];if(f.hidden);else if(f.node&&f.node.parentNode==a){for(;l!=f.node;)l=r(l);var p=s&&null!=n&&n<=u&&f.lineNumber;f.changes&&(d(f.changes,"gutter")>-1&&(p=!1),Ce(t,f,u,i)),p&&(e(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(I(t.options,u)))),l=f.node.nextSibling}else{var g=Oe(t,f,u,i);a.insertBefore(g,l)}u+=f.size}for(;l;)l=r(l)}function Ni(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function Di(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+$e(t)+"px"}function Ii(t){var n=t.display.gutters,r=t.options.gutters;e(n);for(var o=0;o<r.length;++o){var s=r[o],a=n.appendChild(i("div",null,"CodeMirror-gutter "+s));"CodeMirror-linenumbers"==s&&(t.display.lineGutter=a,a.style.width=(t.display.lineNumWidth||1)+"px")}n.style.display=o?"":"none",Ni(t)}function _i(t){var e=d(t.gutters,"CodeMirror-linenumbers");e==-1&&t.lineNumbers?t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]):e>-1&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function Fi(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function zi(t){var e=Fi(t);return e.x*=Pa,e.y*=Pa,e}function Ri(t,e){var n=Fi(e),i=n.x,r=n.y,o=t.display,s=o.scroller,a=s.scrollWidth>s.clientWidth,l=s.scrollHeight>s.clientHeight;if(i&&a||r&&l){if(r&&Ls&&ws)t:for(var c=e.target,u=o.view;c!=s;c=c.parentNode)for(var h=0;h<u.length;h++)if(u[h].node==c){t.display.currentWheelTarget=c;break t}if(i&&!gs&&!Ss&&null!=Pa)return r&&l&&Zn(t,Math.max(0,s.scrollTop+r*Pa)),ti(t,Math.max(0,s.scrollLeft+i*Pa)),(!r||r&&l)&&Lt(e),void(o.wheelStartX=null);if(r&&null!=Pa){var d=r*Pa,f=t.doc.scrollTop,p=f+o.wrapper.clientHeight;d<0?f=Math.max(0,f+d-50):p=Math.min(t.doc.height,p+d+50),Oi(t,{top:f,bottom:p})}Ma<20&&(null==o.wheelStartX?(o.wheelStartX=s.scrollLeft,o.wheelStartY=s.scrollTop,o.wheelDX=i,o.wheelDY=r,setTimeout(function(){if(null!=o.wheelStartX){var t=s.scrollLeft-o.wheelStartX,e=s.scrollTop-o.wheelStartY,n=e&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Pa=(Pa*Ma+n)/(Ma+1),++Ma)}},200)):(o.wheelDX+=i,o.wheelDY+=r))}}function $i(t,e){var n=t[e];t.sort(function(t,e){return F(t.from(),e.from())}),e=d(t,n);for(var i=1;i<t.length;i++){var r=t[i],o=t[i-1];if(F(o.to(),r.from())>=0){var s=V(o.from(),r.from()),a=$(o.to(),r.to()),l=o.empty()?r.from()==r.head:o.from()==o.head;i<=e&&--e,t.splice(--i,2,new Oa(l?a:s,l?s:a))}}return new Aa(t,e)}function Vi(t,e){return new Aa([new Oa(t,e||t)],0)}function Hi(t){return t.text?_(t.from.line+t.text.length-1,g(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function ji(t,e){if(F(t,e.from)<0)return t;if(F(t,e.to)<=0)return Hi(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=Hi(e).ch-e.to.ch),_(n,i)}function Bi(t,e){for(var n=[],i=0;i<t.sel.ranges.length;i++){var r=t.sel.ranges[i];n.push(new Oa(ji(r.anchor,e),ji(r.head,e)))}return $i(n,t.sel.primIndex)}function Wi(t,e,n){return t.line==e.line?_(n.line,t.ch-e.ch+n.ch):_(n.line+(t.line-e.line),t.ch)}function Ui(t,e,n){for(var i=[],r=_(t.first,0),o=r,s=0;s<e.length;s++){var a=e[s],l=Wi(a.from,r,o),c=Wi(Hi(a),r,o);if(r=a.to,o=c,"around"==n){var u=t.sel.ranges[s],h=F(u.head,u.anchor)<0;i[s]=new Oa(h?c:l,h?l:c)}else i[s]=new Oa(l,l)}return new Aa(i,t.sel.primIndex)}function qi(t){t.doc.mode=Bt(t.options,t.doc.modeOption),Ki(t)}function Ki(t){t.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,ki(t,100),t.state.modeGen++,t.curOp&&mi(t)}function Gi(t,e){return 0==e.from.ch&&0==e.to.ch&&""==g(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Yi(t,e,n,i){function r(t){return n?n[t]:null}function o(t,n,r){oe(t,n,r,i),xe(t,"change",t,e)}function s(t,e){for(var n=[],o=t;o<e;++o)n.push(new ga(c[o],r(o),i));return n}var a=e.from,l=e.to,c=e.text,u=M(t,a.line),h=M(t,l.line),d=g(c),f=r(c.length-1),p=l.line-a.line;if(e.full)t.insert(0,s(0,c.length)),t.remove(c.length,t.size-c.length);else if(Gi(t,e)){var v=s(0,c.length-1);o(h,h.text,f),p&&t.remove(a.line,p),v.length&&t.insert(a.line,v)}else if(u==h)if(1==c.length)o(u,u.text.slice(0,a.ch)+d+u.text.slice(l.ch),f);else{var m=s(1,c.length-1);m.push(new ga(d+u.text.slice(l.ch),f,i)),o(u,u.text.slice(0,a.ch)+c[0],r(0)),t.insert(a.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,a.ch)+c[0]+h.text.slice(l.ch),r(0)),t.remove(a.line+1,p);else{o(u,u.text.slice(0,a.ch)+c[0],r(0)),o(h,d+h.text.slice(l.ch),f);var y=s(1,c.length-1);p>1&&t.remove(a.line+1,p-1),t.insert(a.line+1,y)}xe(t,"change",t,e)}function Xi(t,e,n){function i(t,r,o){if(t.linked)for(var s=0;s<t.linked.length;++s){var a=t.linked[s];if(a.doc!=r){var l=o&&a.sharedHist;n&&!l||(e(a.doc,l),i(a.doc,t,l))}}}i(t,null,!0)}function Ji(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,Sn(t),qi(t),Zi(t),t.options.lineWrapping||xt(t),t.options.mode=e.modeOption,mi(t)}function Zi(t){("rtl"==t.doc.direction?a:Rs)(t.display.lineDiv,"CodeMirror-rtl")}function Qi(t){fi(t,function(){Zi(t),mi(t)})}function tr(t){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t||1}function er(t,e){var n={from:R(e.from),to:Hi(e),text:P(t,e.from,e.to)};return lr(t,n,e.from.line,e.to.line+1),Xi(t,function(t){return lr(t,n,e.from.line,e.to.line+1)},!0),n}function nr(t){for(;t.length;){var e=g(t);if(!e.ranges)break;t.pop()}}function ir(t,e){return e?(nr(t.done),g(t.done)):t.done.length&&!g(t.done).ranges?g(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),g(t.done)):void 0}function rr(t,e,n,i){var r=t.history;r.undone.length=0;var o,s,a=+new Date;if((r.lastOp==i||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&r.lastModTime>a-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))&&(o=ir(r,r.lastOp==i)))s=g(o.changes),0==F(e.from,e.to)&&0==F(e.from,s.to)?s.to=Hi(e):o.changes.push(er(t,e));else{var l=g(r.done);for(l&&l.ranges||ar(t.sel,r.done),o={changes:[er(t,e)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=e.origin,s||Et(t,"historyAdded")}function or(t,e,n,i){var r=e.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function sr(t,e,n,i){var r=t.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||or(t,o,g(r.done),e))?r.done[r.done.length-1]=e:ar(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&i.clearRedo!==!1&&nr(r.undone)}function ar(t,e){var n=g(e);n&&n.ranges&&n.equals(t)||e.push(t)}function lr(t,e,n,i){var r=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),function(n){n.markedSpans&&((r||(r=e["spans_"+t.id]={}))[o]=n.markedSpans),++o})}function cr(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function ur(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var i=[],r=0;r<e.text.length;++r)i.push(cr(n[r]));return i}function hr(t,e){var n=ur(t,e),i=Q(t,e);if(!n)return i;if(!i)return n;for(var r=0;r<n.length;++r){var o=n[r],s=i[r];if(o&&s)t:for(var a=0;a<s.length;++a){for(var l=s[a],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue t;o.push(l)}else s&&(n[r]=s)}return n}function dr(t,e,n){for(var i=[],r=0;r<t.length;++r){var o=t[r];if(o.ranges)i.push(n?Aa.prototype.deepCopy.call(o):o);else{var s=o.changes,a=[];i.push({changes:a});for(var l=0;l<s.length;++l){var c=s[l],u=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),e)for(var h in c)(u=h.match(/^spans_(\d+)$/))&&d(e,Number(u[1]))>-1&&(g(a)[h]=c[h],delete c[h])}}}return i}function fr(t,e,n,i){if(i){var r=t.anchor;if(n){var o=F(e,r)<0;o!=F(n,r)<0?(r=e,e=n):o!=F(e,n)<0&&(e=n)}return new Oa(r,e)}return new Oa(n||e,e)}function pr(t,e,n,i,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),xr(t,new Aa([fr(t.sel.primary(),e,n,r)],0),i)}function gr(t,e,n){for(var i=[],r=t.cm&&(t.cm.display.shift||t.extend),o=0;o<t.sel.ranges.length;o++)i[o]=fr(t.sel.ranges[o],e[o],null,r);var s=$i(i,t.sel.primIndex);xr(t,s,n)}function vr(t,e,n,i){var r=t.sel.ranges.slice(0);r[e]=n,xr(t,$i(r,t.sel.primIndex),i)}function mr(t,e,n,i){
xr(t,Vi(e,n),i)}function yr(t,e,n){var i={ranges:e.ranges,update:function(e){var n=this;this.ranges=[];for(var i=0;i<e.length;i++)n.ranges[i]=new Oa(j(t,e[i].anchor),j(t,e[i].head))},origin:n&&n.origin};return Et(t,"beforeSelectionChange",t,i),t.cm&&Et(t.cm,"beforeSelectionChange",t.cm,i),i.ranges!=e.ranges?$i(i.ranges,i.ranges.length-1):e}function br(t,e,n){var i=t.history.done,r=g(i);r&&r.ranges?(i[i.length-1]=e,wr(t,e,n)):xr(t,e,n)}function xr(t,e,n){wr(t,e,n),sr(t,t.sel,t.cm?t.cm.curOp.id:NaN,n)}function wr(t,e,n){(At(t,"beforeSelectionChange")||t.cm&&At(t.cm,"beforeSelectionChange"))&&(e=yr(t,e,n));var i=n&&n.bias||(F(e.primary().head,t.sel.primary().head)<0?-1:1);Cr(t,Sr(t,e,i,!0)),n&&n.scroll===!1||!t.cm||Kn(t.cm)}function Cr(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=!0,Pt(t.cm)),xe(t,"cursorActivity",t))}function kr(t){Cr(t,Sr(t,t.sel,null,!1))}function Sr(t,e,n,i){for(var r,o=0;o<e.ranges.length;o++){var s=e.ranges[o],a=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[o],l=Er(t,s.anchor,a&&a.anchor,n,i),c=Er(t,s.head,a&&a.head,n,i);(r||l!=s.anchor||c!=s.head)&&(r||(r=e.ranges.slice(0,o)),r[o]=new Oa(l,c))}return r?$i(r,e.primIndex):e}function Tr(t,e,n,i,r){var o=M(t,e.line);if(o.markedSpans)for(var s=0;s<o.markedSpans.length;++s){var a=o.markedSpans[s],l=a.marker;if((null==a.from||(l.inclusiveLeft?a.from<=e.ch:a.from<e.ch))&&(null==a.to||(l.inclusiveRight?a.to>=e.ch:a.to>e.ch))){if(r&&(Et(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--s;continue}break}if(!l.atomic)continue;if(n){var c=l.find(i<0?1:-1),u=void 0;if((i<0?l.inclusiveRight:l.inclusiveLeft)&&(c=Mr(t,c,-i,c&&c.line==e.line?o:null)),c&&c.line==e.line&&(u=F(c,n))&&(i<0?u<0:u>0))return Tr(t,c,e,i,r)}var h=l.find(i<0?-1:1);return(i<0?l.inclusiveLeft:l.inclusiveRight)&&(h=Mr(t,h,i,h.line==e.line?o:null)),h?Tr(t,h,e,i,r):null}}return e}function Er(t,e,n,i,r){var o=i||1,s=Tr(t,e,n,o,r)||!r&&Tr(t,e,n,o,!0)||Tr(t,e,n,-o,r)||!r&&Tr(t,e,n,-o,!0);return s?s:(t.cantEdit=!0,_(t.first,0))}function Mr(t,e,n,i){return n<0&&0==e.ch?e.line>t.first?j(t,_(e.line-1)):null:n>0&&e.ch==(i||M(t,e.line)).text.length?e.line<t.first+t.size-1?_(e.line+1,0):null:new _(e.line,e.ch+n)}function Pr(t){t.setSelection(_(t.firstLine(),0),_(t.lastLine()),Us)}function Ar(t,e,n){var i={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(e,n,r,o){e&&(i.from=j(t,e)),n&&(i.to=j(t,n)),r&&(i.text=r),void 0!==o&&(i.origin=o)}),Et(t,"beforeChange",t,i),t.cm&&Et(t.cm,"beforeChange",t.cm,i),i.canceled?null:{from:i.from,to:i.to,text:i.text,origin:i.origin}}function Or(t,e,n){if(t.cm){if(!t.cm.curOp)return pi(t.cm,Or)(t,e,n);if(t.cm.state.suppressEdits)return}if(!(At(t,"beforeChange")||t.cm&&At(t.cm,"beforeChange"))||(e=Ar(t,e,!0))){var i=Js&&!n&&et(t,e.from,e.to);if(i)for(var r=i.length-1;r>=0;--r)Lr(t,{from:i[r].from,to:i[r].to,text:r?[""]:e.text,origin:e.origin});else Lr(t,e)}}function Lr(t,e){if(1!=e.text.length||""!=e.text[0]||0!=F(e.from,e.to)){var n=Bi(t,e);rr(t,e,n,t.cm?t.cm.curOp.id:NaN),Ir(t,e,n,Q(t,e));var i=[];Xi(t,function(t,n){n||d(i,t.history)!=-1||($r(t.history,e),i.push(t.history)),Ir(t,e,null,Q(t,e))})}}function Nr(t,e,n){if(!t.cm||!t.cm.state.suppressEdits||n){for(var i,r=t.history,o=t.sel,s="undo"==e?r.done:r.undone,a="undo"==e?r.undone:r.done,l=0;l<s.length&&(i=s[l],n?!i.ranges||i.equals(t.sel):i.ranges);l++);if(l!=s.length){for(r.lastOrigin=r.lastSelOrigin=null;i=s.pop(),i.ranges;){if(ar(i,a),n&&!i.equals(t.sel))return void xr(t,i,{clearRedo:!1});o=i}var c=[];ar(o,a),a.push({changes:c,generation:r.generation}),r.generation=i.generation||++r.maxGeneration;for(var u=At(t,"beforeChange")||t.cm&&At(t.cm,"beforeChange"),h=function(n){var r=i.changes[n];if(r.origin=e,u&&!Ar(t,r,!1))return s.length=0,{};c.push(er(t,r));var o=n?Bi(t,r):g(s);Ir(t,r,o,hr(t,r)),!n&&t.cm&&t.cm.scrollIntoView({from:r.from,to:Hi(r)});var a=[];Xi(t,function(t,e){e||d(a,t.history)!=-1||($r(t.history,r),a.push(t.history)),Ir(t,r,null,hr(t,r))})},f=i.changes.length-1;f>=0;--f){var p=h(f);if(p)return p.v}}}}function Dr(t,e){if(0!=e&&(t.first+=e,t.sel=new Aa(v(t.sel.ranges,function(t){return new Oa(_(t.anchor.line+e,t.anchor.ch),_(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){mi(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;i<n.viewTo;i++)yi(t.cm,i,"gutter")}}function Ir(t,e,n,i){if(t.cm&&!t.cm.curOp)return pi(t.cm,Ir)(t,e,n,i);if(e.to.line<t.first)return void Dr(t,e.text.length-1-(e.to.line-e.from.line));if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var r=e.text.length-1-(t.first-e.from.line);Dr(t,r),e={from:_(t.first,0),to:_(e.to.line+r,e.to.ch),text:[g(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:_(o,M(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=P(t,e.from,e.to),n||(n=Bi(t,e)),t.cm?_r(t.cm,e,i):Yi(t,e,i),wr(t,n,Us)}}function _r(t,e,n){var i=t.doc,r=t.display,o=e.from,s=e.to,a=!1,l=o.line;t.options.lineWrapping||(l=L(ht(M(i,o.line))),i.iter(l,s.line+1,function(t){if(t==r.maxLine)return a=!0,!0})),i.sel.contains(e.from,e.to)>-1&&Pt(t),Yi(i,e,n,kn(t)),t.options.lineWrapping||(i.iter(l,o.line+e.text.length,function(t){var e=bt(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,a=!1)}),a&&(t.curOp.updateMaxLine=!0)),re(i,o.line),ki(t,400);var c=e.text.length-(s.line-o.line)-1;e.full?mi(t):o.line!=s.line||1!=e.text.length||Gi(t.doc,e)?mi(t,o.line,s.line+1,c):yi(t,o.line,"text");var u=At(t,"changes"),h=At(t,"change");if(h||u){var d={from:o,to:s,text:e.text,removed:e.removed,origin:e.origin};h&&xe(t,"change",t,d),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}function Fr(t,e,n,i,r){if(i||(i=n),F(i,n)<0){var o;o=[i,n],n=o[0],i=o[1],o}"string"==typeof e&&(e=t.splitLines(e)),Or(t,{from:n,to:i,text:e,origin:r})}function zr(t,e,n,i){n<t.line?t.line+=i:e<t.line&&(t.line=e,t.ch=0)}function Rr(t,e,n,i){for(var r=0;r<t.length;++r){var o=t[r],s=!0;if(o.ranges){o.copied||(o=t[r]=o.deepCopy(),o.copied=!0);for(var a=0;a<o.ranges.length;a++)zr(o.ranges[a].anchor,e,n,i),zr(o.ranges[a].head,e,n,i)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(n<c.from.line)c.from=_(c.from.line+i,c.from.ch),c.to=_(c.to.line+i,c.to.ch);else if(e<=c.to.line){s=!1;break}}s||(t.splice(0,r+1),r=0)}}}function $r(t,e){var n=e.from.line,i=e.to.line,r=e.text.length-(i-n)-1;Rr(t.done,n,i,r),Rr(t.undone,n,i,r)}function Vr(t,e,n,i){var r=e,o=e;return"number"==typeof e?o=M(t,H(t,e)):r=L(e),null==r?null:(i(o,r)&&t.cm&&yi(t.cm,r,n),o)}function Hr(t){var e=this;this.lines=t,this.parent=null;for(var n=0,i=0;i<t.length;++i)t[i].parent=e,n+=t[i].height;this.height=n}function jr(t){var e=this;this.children=t;for(var n=0,i=0,r=0;r<t.length;++r){var o=t[r];n+=o.chunkSize(),i+=o.height,o.parent=e}this.size=n,this.height=i,this.parent=null}function Br(t,e,n){yt(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&qn(t,n)}function Wr(t,e,n,i){var r=new La(t,n,i),o=t.cm;return o&&r.noHScroll&&(o.display.alignWidgets=!0),Vr(t,e,"widget",function(e){var n=e.widgets||(e.widgets=[]);if(null==r.insertAt?n.push(r):n.splice(Math.min(n.length-1,Math.max(0,r.insertAt)),0,r),r.line=e,o&&!vt(t,e)){var i=yt(e)<t.scrollTop;O(e,e.height+Ie(r)),i&&qn(o,r.height),o.curOp.forceUpdate=!0}return!0}),xe(o,"lineWidgetAdded",o,r,"number"==typeof e?e:L(e)),r}function Ur(t,e,n,i,o){if(i&&i.shared)return qr(t,e,n,i,o);if(t.cm&&!t.cm.curOp)return pi(t.cm,Ur)(t,e,n,i,o);var s=new Da(t,o),a=F(e,n);if(i&&u(i,s,!1),a>0||0==a&&s.clearWhenEmpty!==!1)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=r("span",[s.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(ut(t,e.line,e,n,s)||e.line!=n.line&&ut(t,n.line,e,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");q()}s.addToHistory&&rr(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var l,c=e.line,h=t.cm;if(t.iter(c,n.line+1,function(t){h&&s.collapsed&&!h.options.lineWrapping&&ht(t)==h.display.maxLine&&(l=!0),s.collapsed&&c!=e.line&&O(t,0),X(t,new K(s,c==e.line?e.ch:null,c==n.line?n.ch:null)),++c}),s.collapsed&&t.iter(e.line,n.line+1,function(e){vt(t,e)&&O(e,0)}),s.clearOnEnter&&na(s,"beforeCursorEnter",function(){return s.clear()}),s.readOnly&&(U(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),s.collapsed&&(s.id=++Na,s.atomic=!0),h){if(l&&(h.curOp.updateMaxLine=!0),s.collapsed)mi(h,e.line,n.line+1);else if(s.className||s.title||s.startStyle||s.endStyle||s.css)for(var d=e.line;d<=n.line;d++)yi(h,d,"text");s.atomic&&kr(h.doc),xe(h,"markerAdded",h,s)}return s}function qr(t,e,n,i,r){i=u(i),i.shared=!1;var o=[Ur(t,e,n,i,r)],s=o[0],a=i.widgetNode;return Xi(t,function(t){a&&(i.widgetNode=a.cloneNode(!0)),o.push(Ur(t,j(t,e),j(t,n),i,r));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;s=g(o)}),new Ia(o,s)}function Kr(t){return t.findMarks(_(t.first,0),t.clipPos(_(t.lastLine())),function(t){return t.parent})}function Gr(t,e){for(var n=0;n<e.length;n++){var i=e[n],r=i.find(),o=t.clipPos(r.from),s=t.clipPos(r.to);if(F(o,s)){var a=Ur(t,o,s,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}function Yr(t){for(var e=function(e){var n=t[e],i=[n.primary.doc];Xi(n.primary.doc,function(t){return i.push(t)});for(var r=0;r<n.markers.length;r++){var o=n.markers[r];d(i,o.doc)==-1&&(o.parent=null,n.markers.splice(r--,1))}},n=0;n<t.length;n++)e(n)}function Xr(t){var e=this;if(Qr(e),!Mt(e,t)&&!_e(e.display,t)){Lt(t),bs&&(za=+new Date);var n=Tn(e,t,!0),i=t.dataTransfer.files;if(n&&!e.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var r=i.length,o=Array(r),s=0,a=function(t,i){if(!e.options.allowDropFileTypes||d(e.options.allowDropFileTypes,t.type)!=-1){var a=new FileReader;a.onload=pi(e,function(){var t=a.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(t)&&(t=""),o[i]=t,++s==r){n=j(e.doc,n);var l={from:n,to:n,text:e.doc.splitLines(o.join(e.doc.lineSeparator())),origin:"paste"};Or(e.doc,l),br(e.doc,Vi(n,Hi(l)))}}),a.readAsText(t)}},l=0;l<r;++l)a(i[l],l);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1)return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var c=t.dataTransfer.getData("Text");if(c){var u;if(e.state.draggingText&&!e.state.draggingText.copy&&(u=e.listSelections()),wr(e.doc,Vi(n,n)),u)for(var h=0;h<u.length;++h)Fr(e.doc,"",u[h].anchor,u[h].head,"drag");e.replaceSelection(c,"around","paste"),e.display.input.focus()}}catch(t){}}}}function Jr(t,e){if(bs&&(!t.state.draggingText||+new Date-za<100))return void It(e);if(!Mt(t,e)&&!_e(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!Ts)){var n=i("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Ss&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),Ss&&n.parentNode.removeChild(n)}}function Zr(t,e){var r=Tn(t,e);if(r){var o=document.createDocumentFragment();An(t,r,o),t.display.dragCursor||(t.display.dragCursor=i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),n(t.display.dragCursor,o)}}function Qr(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function to(t){if(document.getElementsByClassName)for(var e=document.getElementsByClassName("CodeMirror"),n=0;n<e.length;n++){var i=e[n].CodeMirror;i&&t(i)}}function eo(){Ra||(no(),Ra=!0)}function no(){var t;na(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null,to(io)},100))}),na(window,"blur",function(){return to(Fn)})}function io(t){var e=t.display;e.lastWrapHeight==e.wrapper.clientHeight&&e.lastWrapWidth==e.wrapper.clientWidth||(e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize())}function ro(t){var e=t.split(/-(?!$)/);t=e[e.length-1];for(var n,i,r,o,s=0;s<e.length-1;s++){var a=e[s];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);r=!0}}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Cmd-"+t),r&&(t="Shift-"+t),t}function oo(t){var e={};for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==i){delete t[n];continue}for(var r=v(n.split(" "),ro),o=0;o<r.length;o++){var s=void 0,a=void 0;o==r.length-1?(a=r.join(" "),s=i):(a=r.slice(0,o+1).join(" "),s="...");var l=e[a];if(l){if(l!=s)throw new Error("Inconsistent bindings for "+a)}else e[a]=s}delete t[n]}for(var c in e)t[c]=e[c];return t}function so(t,e,n,i){e=uo(e);var r=e.call?e.call(t,i):e[t];if(r===!1)return"nothing";if("..."===r)return"multi";if(null!=r&&n(r))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return so(t,e.fallthrough,n,i);for(var o=0;o<e.fallthrough.length;o++){var s=so(t,e.fallthrough[o],n,i);if(s)return s}}}function ao(t){var e="string"==typeof t?t:$a[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function lo(t,e,n){var i=t;return e.altKey&&"Alt"!=i&&(t="Alt-"+t),(Fs?e.metaKey:e.ctrlKey)&&"Ctrl"!=i&&(t="Ctrl-"+t),(Fs?e.ctrlKey:e.metaKey)&&"Cmd"!=i&&(t="Cmd-"+t),!n&&e.shiftKey&&"Shift"!=i&&(t="Shift-"+t),t}function co(t,e){if(Ss&&34==t.keyCode&&t["char"])return!1;var n=$a[t.keyCode];return null!=n&&!t.altGraphKey&&lo(n,t,e)}function uo(t){return"string"==typeof t?Ba[t]:t}function ho(t,e){for(var n=t.doc.sel.ranges,i=[],r=0;r<n.length;r++){for(var o=e(n[r]);i.length&&F(o.from,g(i).to)<=0;){var s=i.pop();if(F(s.from,o.from)<0){o.from=s.from;break}}i.push(o)}fi(t,function(){for(var e=i.length-1;e>=0;e--)Fr(t.doc,"",i[e].from,i[e].to,"+delete");Kn(t)})}function fo(t,e,n){var i=S(t.text,e+n,n);return i<0||i>t.text.length?null:i}function po(t,e,n){var i=fo(t,e.ch,n);return null==i?null:new _(e.line,i,n<0?"after":"before")}function go(t,e,n,i,r){if(t){var o=kt(n,e.doc.direction);if(o){var s,a=r<0?g(o):o[0],l=r<0==(1==a.level),c=l?"after":"before";if(a.level>0||"rtl"==e.doc.direction){var u=Ke(e,n);s=r<0?n.text.length-1:0;var h=Ge(e,u,s).top;s=T(function(t){return Ge(e,u,t).top==h},r<0==(1==a.level)?a.from:a.to-1,s),"before"==c&&(s=fo(n,s,1))}else s=r<0?a.to:a.from;return new _(i,s,c)}}return new _(i,r<0?n.text.length:0,r<0?"before":"after")}function vo(t,e,n,i){var r=kt(e,t.doc.direction);if(!r)return po(e,n,i);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Ct(r,n.ch,n.sticky),s=r[o];if("ltr"==t.doc.direction&&s.level%2==0&&(i>0?s.to>n.ch:s.from<n.ch))return po(e,n,i);var a,l=function(t,n){return fo(e,t instanceof _?t.ch:t,n)},c=function(n){return t.options.lineWrapping?(a=a||Ke(t,e),pn(t,e,a,n)):{begin:0,end:e.text.length}},u=c("before"==n.sticky?l(n,-1):n.ch);if("rtl"==t.doc.direction||1==s.level){var h=1==s.level==i<0,d=l(n,h?1:-1);if(null!=d&&(h?d<=s.to&&d<=u.end:d>=s.from&&d>=u.begin)){var f=h?"before":"after";return new _(n.line,d,f)}}var p=function(t,e,i){for(var o=function(t,e){return e?new _(n.line,l(t,1),"before"):new _(n.line,t,"after")};t>=0&&t<r.length;t+=e){var s=r[t],a=e>0==(1!=s.level),c=a?i.begin:l(i.end,-1);if(s.from<=c&&c<s.to)return o(c,a);if(c=a?s.from:l(s.to,-1),i.begin<=c&&c<i.end)return o(c,a)}},g=p(o+i,i,u);if(g)return g;var v=i>0?u.end:l(u.begin,-1);return null==v||i>0&&v==e.text.length||!(g=p(i>0?0:r.length-1,i,c(v)))?null:g}function mo(t,e){var n=M(t.doc,e),i=ht(n);return i!=n&&(e=L(i)),go(!0,t,i,e,1)}function yo(t,e){var n=M(t.doc,e),i=dt(n);return i!=n&&(e=L(i)),go(!0,t,n,e,-1)}function bo(t,e){var n=mo(t,e.line),i=M(t.doc,n.line),r=kt(i,t.doc.direction);if(!r||0==r[0].level){var o=Math.max(0,i.text.search(/\S/)),s=e.line==n.line&&e.ch<=o&&e.ch;return _(n.line,s?0:o,n.sticky)}return n}function xo(t,e,n){if("string"==typeof e&&(e=Wa[e],!e))return!1;t.display.input.ensurePolled();var i=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),r=e(t)!=Ws}finally{t.display.shift=i,t.state.suppressEdits=!1}return r}function wo(t,e,n){for(var i=0;i<t.state.keyMaps.length;i++){var r=so(e,t.state.keyMaps[i],n,t);if(r)return r}return t.options.extraKeys&&so(e,t.options.extraKeys,n,t)||so(e,t.options.keyMap,n,t)}function Co(t,e,n,i){var r=t.state.keySeq;if(r){if(ao(e))return"handled";Ua.set(50,function(){t.state.keySeq==r&&(t.state.keySeq=null,t.display.input.reset())}),e=r+" "+e}var o=wo(t,e,i);return"multi"==o&&(t.state.keySeq=e),"handled"==o&&xe(t,"keyHandled",t,e,n),"handled"!=o&&"multi"!=o||(Lt(n),Nn(t)),r&&!o&&/\'$/.test(e)?(Lt(n),!0):!!o}function ko(t,e){var n=co(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?Co(t,"Shift-"+n,e,function(e){return xo(t,e,!0)})||Co(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return xo(t,e)}):Co(t,n,e,function(e){return xo(t,e)}))}function So(t,e,n){return Co(t,"'"+n+"'",e,function(e){return xo(t,e,!0)})}function To(t){var e=this;if(e.curOp.focus=s(),!Mt(e,t)){bs&&xs<11&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var i=ko(e,t);Ss&&(qa=i?n:null,!i&&88==n&&!sa&&(Ls?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||Eo(e)}}function Eo(t){function e(t){18!=t.keyCode&&t.altKey||(Rs(n,"CodeMirror-crosshair"),Tt(document,"keyup",e),Tt(document,"mouseover",e))}var n=t.display.lineDiv;a(n,"CodeMirror-crosshair"),na(document,"keyup",e),na(document,"mouseover",e)}function Mo(t){16==t.keyCode&&(this.doc.sel.shift=!1),Mt(this,t)}function Po(t){var e=this;if(!(_e(e.display,t)||Mt(e,t)||t.ctrlKey&&!t.altKey||Ls&&t.metaKey)){var n=t.keyCode,i=t.charCode;if(Ss&&n==qa)return qa=null,void Lt(t);if(!Ss||t.which&&!(t.which<10)||!ko(e,t)){var r=String.fromCharCode(null==i?n:i);"\b"!=r&&(So(e,t,r)||e.display.input.onKeyPress(t))}}}function Ao(t,e){var n=+new Date;return Xa&&Xa.compare(n,t,e)?(Ya=Xa=null,"triple"):Ya&&Ya.compare(n,t,e)?(Xa=new Ga(n,t,e),Ya=null,"double"):(Ya=new Ga(n,t,e),Xa=null,"single")}function Oo(t){var e=this,n=e.display;if(!(Mt(e,t)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=t.shiftKey,_e(n,t))return void(ws||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100)));if(!$o(e,t)){var i=Tn(e,t),r=Ft(t),o=i?Ao(i,r):"single";window.focus(),1==r&&e.state.selectingText&&e.state.selectingText(t),i&&Lo(e,r,i,o,t)||(1==r?i?Do(e,i,o,t):_t(t)==n.scroller&&Lt(t):2==r?(i&&pr(e.doc,i),setTimeout(function(){return n.input.focus()},20)):3==r&&(zs?Vo(e,t):In(e)))}}}function Lo(t,e,n,i,r){var o="Click";return"double"==i?o="Double"+o:"triple"==i&&(o="Triple"+o),o=(1==e?"Left":2==e?"Middle":"Right")+o,Co(t,lo(o,r),r,function(e){if("string"==typeof e&&(e=Wa[e]),!e)return!1;var i=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i=e(t,n)!=Ws}finally{t.state.suppressEdits=!1}return i})}function No(t,e,n){var i=t.getOption("configureMouse"),r=i?i(t,e,n):{};if(null==r.unit){var o=Ns?n.shiftKey&&n.metaKey:n.altKey;r.unit=o?"rectangle":"single"==e?"char":"double"==e?"word":"line"}return(null==r.extend||t.doc.extend)&&(r.extend=t.doc.extend||n.shiftKey),null==r.addNew&&(r.addNew=Ls?n.metaKey:n.ctrlKey),null==r.moveOnDrag&&(r.moveOnDrag=!(Ls?n.altKey:n.ctrlKey)),r}function Do(t,e,n,i){bs?setTimeout(c(Dn,t),0):t.curOp.focus=s();var r,o=No(t,n,i),a=t.doc.sel;t.options.dragDrop&&ia&&!t.isReadOnly()&&"single"==n&&(r=a.contains(e))>-1&&(F((r=a.ranges[r]).from(),e)<0||e.xRel>0)&&(F(r.to(),e)>0||e.xRel<0)?Io(t,i,e,o):Fo(t,i,e,o)}function Io(t,e,n,i){var r=t.display,o=!1,s=pi(t,function(e){ws&&(r.scroller.draggable=!1),t.state.draggingText=!1,Tt(document,"mouseup",s),Tt(document,"mousemove",a),Tt(r.scroller,"dragstart",l),Tt(r.scroller,"drop",s),o||(Lt(e),i.addNew||pr(t.doc,n,null,null,i.extend),ws||bs&&9==xs?setTimeout(function(){document.body.focus(),r.input.focus()},20):r.input.focus())}),a=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},l=function(){return o=!0};ws&&(r.scroller.draggable=!0),t.state.draggingText=s,s.copy=!i.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),na(document,"mouseup",s),na(document,"mousemove",a),na(r.scroller,"dragstart",l),na(r.scroller,"drop",s),In(t),setTimeout(function(){return r.input.focus()},20)}function _o(t,e,n){if("char"==n)return new Oa(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new Oa(_(e.line,0),j(t.doc,_(e.line+1,0)));var i=n(t,e);return new Oa(i.from,i.to)}function Fo(t,e,n,i){function r(e){if(0!=F(m,e))if(m=e,"rectangle"==i.unit){for(var r=[],o=t.options.tabSize,s=h(M(c,n.line).text,n.ch,o),a=h(M(c,e.line).text,e.ch,o),l=Math.min(s,a),g=Math.max(s,a),v=Math.min(n.line,e.line),y=Math.min(t.lastLine(),Math.max(n.line,e.line));v<=y;v++){var b=M(c,v).text,x=f(b,l,o);l==g?r.push(new Oa(_(v,x),_(v,x))):b.length>x&&r.push(new Oa(_(v,x),_(v,f(b,g,o))))}r.length||r.push(new Oa(n,n)),xr(c,$i(p.ranges.slice(0,d).concat(r),d),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var w,C=u,k=_o(t,e,i.unit),S=C.anchor;F(k.anchor,S)>0?(w=k.head,S=V(C.from(),k.anchor)):(w=k.anchor,S=$(C.to(),k.head));var T=p.ranges.slice(0);T[d]=zo(t,new Oa(j(c,S),w)),xr(c,$i(T,d),qs)}}function o(e){var n=++b,a=Tn(t,e,!0,"rectangle"==i.unit);if(a)if(0!=F(a,m)){t.curOp.focus=s(),r(a);var u=$n(l,c);(a.line>=u.to||a.line<u.from)&&setTimeout(pi(t,function(){b==n&&o(e)}),150)}else{var h=e.clientY<y.top?-20:e.clientY>y.bottom?20:0;h&&setTimeout(pi(t,function(){b==n&&(l.scroller.scrollTop+=h,o(e))}),50)}}function a(e){t.state.selectingText=!1,b=1/0,Lt(e),l.input.focus(),Tt(document,"mousemove",x),Tt(document,"mouseup",w),c.history.lastSelOrigin=null}var l=t.display,c=t.doc;Lt(e);var u,d,p=c.sel,g=p.ranges;if(i.addNew&&!i.extend?(d=c.sel.contains(n),u=d>-1?g[d]:new Oa(n,n)):(u=c.sel.primary(),d=c.sel.primIndex),"rectangle"==i.unit)i.addNew||(u=new Oa(n,n)),n=Tn(t,e,!0,!0),d=-1;else{var v=_o(t,n,i.unit);u=i.extend?fr(u,v.anchor,v.head,i.extend):v}i.addNew?d==-1?(d=g.length,xr(c,$i(g.concat([u]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&"char"==i.unit&&!i.extend?(xr(c,$i(g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),p=c.sel):vr(c,d,u,qs):(d=0,xr(c,new Aa([u],0),qs),p=c.sel);var m=n,y=l.wrapper.getBoundingClientRect(),b=0,x=pi(t,function(t){Ft(t)?o(t):a(t)}),w=pi(t,a);t.state.selectingText=w,na(document,"mousemove",x),na(document,"mouseup",w)}function zo(t,e){var n=e.anchor,i=e.head,r=M(t.doc,n.line);if(0==F(n,i)&&n.sticky==i.sticky)return e;var o=kt(r);if(!o)return e;var s=Ct(o,n.ch,n.sticky),a=o[s];if(a.from!=n.ch&&a.to!=n.ch)return e;var l=s+(a.from==n.ch==(1!=a.level)?0:1);if(0==l||l==o.length)return e;var c;if(i.line!=n.line)c=(i.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=Ct(o,i.ch,i.sticky),h=u-s||(i.ch-n.ch)*(1==a.level?-1:1);c=u==l-1||u==l?h<0:h>0}var d=o[l+(c?-1:0)],f=c==(1==d.level),p=f?d.from:d.to,g=f?"after":"before";return n.ch==p&&n.sticky==g?e:new Oa(new _(n.line,p,g),i)}function Ro(t,e,n,i){var r,o;if(e.touches)r=e.touches[0].clientX,o=e.touches[0].clientY;else try{r=e.clientX,o=e.clientY}catch(e){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&Lt(e);var s=t.display,a=s.lineDiv.getBoundingClientRect();if(o>a.bottom||!At(t,n))return Dt(e);o-=a.top-s.viewOffset;for(var l=0;l<t.options.gutters.length;++l){var c=s.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=r){var u=N(t.doc,o),h=t.options.gutters[l];return Et(t,n,t,u,h,e),Dt(e)}}}function $o(t,e){return Ro(t,e,"gutterClick",!0)}function Vo(t,e){_e(t.display,e)||Ho(t,e)||Mt(t,e,"contextmenu")||t.display.input.onContextMenu(e)}function Ho(t,e){return!!At(t,"gutterContextMenu")&&Ro(t,e,"gutterContextMenu",!1)}function jo(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),en(t)}function Bo(t){function e(e,i,r,o){t.defaults[e]=i,r&&(n[e]=o?function(t,e,n){n!=Ja&&r(t,e,n)}:r)}var n=t.optionHandlers;t.defineOption=e,t.Init=Ja,e("value","",function(t,e){return t.setValue(e)},!0),e("mode",null,function(t,e){t.doc.modeOption=e,qi(t)},!0),e("indentUnit",2,qi,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(t){Ki(t),en(t),mi(t)},!0),e("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var n=[],i=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var o=t.text.indexOf(e,r);if(o==-1)break;r=o+e.length,n.push(_(i,o))}i++});for(var r=n.length-1;r>=0;r--)Fr(t.doc,e,n[r],_(n[r].line,n[r].ch+e.length))}}),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=Ja&&t.refresh()}),e("specialCharPlaceholder",ce,function(t){return t.refresh()},!0),e("electricChars",!0),e("inputStyle",Os?"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",!Ds),e("wholeLineUpdateBefore",!0),e("theme","default",function(t){jo(t),Wo(t)},!0),e("keyMap","default",function(t,e,n){var i=uo(e),r=n!=Ja&&uo(n);r&&r.detach&&r.detach(t,i),i.attach&&i.attach(t,r||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,qo,!0),e("gutters",[],function(t){_i(t.options),Wo(t)},!0),e("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?Cn(t.display)+"px":"0",t.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(t){return ni(t)},!0),e("scrollbarStyle","native",function(t){ri(t),ni(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),e("lineNumbers",!1,function(t){_i(t.options),Wo(t)},!0),e("firstLineNumber",1,Wo,!0),e("lineNumberFormatter",function(t){return t},Wo,!0),e("showCursorWhenSelecting",!1,Mn,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("readOnly",!1,function(t,e){"nocursor"==e&&(Fn(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)}),e("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),e("dragDrop",!0,Uo),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,Mn,!0),e("singleCursorHeightPerLine",!0,Mn,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Ki,!0),e("addModeClass",!1,Ki,!0),e("pollInterval",100),e("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),e("historyEventDelay",1250),e("viewportMargin",10,function(t){return t.refresh()},!0),e("maxHighlightLength",1e4,Ki,!0),e("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),e("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),e("autofocus",null),e("direction","ltr",function(t,e){return t.doc.setDirection(e)},!0)}function Wo(t){Ii(t),mi(t),Vn(t)}function Uo(t,e,n){var i=n&&n!=Ja;if(!e!=!i){var r=t.display.dragFunctions,o=e?na:Tt;o(t.display.scroller,"dragstart",r.start),o(t.display.scroller,"dragenter",r.enter),o(t.display.scroller,"dragover",r.over),o(t.display.scroller,"dragleave",r.leave),o(t.display.scroller,"drop",r.drop)}}function qo(t){t.options.lineWrapping?(a(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Rs(t.display.wrapper,"CodeMirror-wrap"),xt(t)),Sn(t),mi(t),en(t),setTimeout(function(){return ni(t)},100)}function Ko(t,e){var n=this;if(!(this instanceof Ko))return new Ko(t,e);this.options=e=e?u(e):{},u(Za,e,!1),_i(e);var i=e.value;"string"==typeof i&&(i=new Fa(i,e.mode,null,e.lineSeparator,e.direction)),this.doc=i;var r=new Ko.inputStyles[e.inputStyle](this),o=this.display=new E(t,i,r);o.wrapper.CodeMirror=this,Ii(this),jo(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ri(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Vs,keySeq:null,specialChars:null},e.autofocus&&!Os&&o.input.focus(),bs&&xs<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Go(this),eo(),oi(this),this.curOp.forceUpdate=!0,Ji(this,i),e.autofocus&&!Os||this.hasFocus()?setTimeout(c(_n,this),20):Fn(this);for(var s in Qa)Qa.hasOwnProperty(s)&&Qa[s](n,e[s],Ja);Hn(this),e.finishInit&&e.finishInit(this);for(var a=0;a<tl.length;++a)tl[a](n);si(this),ws&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Go(t){function e(){r.activeTouch&&(o=setTimeout(function(){return r.activeTouch=null},1e3),s=r.activeTouch,s.end=+new Date)}function n(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}function i(t,e){if(null==e.left)return!0;var n=e.left-t.left,i=e.top-t.top;return n*n+i*i>400}var r=t.display;na(r.scroller,"mousedown",pi(t,Oo)),bs&&xs<11?na(r.scroller,"dblclick",pi(t,function(e){if(!Mt(t,e)){var n=Tn(t,e);if(n&&!$o(t,e)&&!_e(t.display,e)){Lt(e);var i=t.findWordAt(n);pr(t.doc,i.anchor,i.head)}}})):na(r.scroller,"dblclick",function(e){return Mt(t,e)||Lt(e)}),zs||na(r.scroller,"contextmenu",function(e){return Vo(t,e)});var o,s={end:0};na(r.scroller,"touchstart",function(e){if(!Mt(t,e)&&!n(e)&&!$o(t,e)){r.input.ensurePolled(),clearTimeout(o);var i=+new Date;r.activeTouch={start:i,moved:!1,prev:i-s.end<=300?s:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),na(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),na(r.scroller,"touchend",function(n){var o=r.activeTouch;if(o&&!_e(r,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var s,a=t.coordsChar(r.activeTouch,"page");s=!o.prev||i(o,o.prev)?new Oa(a,a):!o.prev.prev||i(o,o.prev.prev)?t.findWordAt(a):new Oa(_(a.line,0),j(t.doc,_(a.line+1,0))),t.setSelection(s.anchor,s.head),t.focus(),Lt(n)}e()}),na(r.scroller,"touchcancel",e),na(r.scroller,"scroll",function(){r.scroller.clientHeight&&(Zn(t,r.scroller.scrollTop),ti(t,r.scroller.scrollLeft,!0),Et(t,"scroll",t))}),na(r.scroller,"mousewheel",function(e){return Ri(t,e)}),na(r.scroller,"DOMMouseScroll",function(e){return Ri(t,e)}),na(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(e){Mt(t,e)||It(e)},over:function(e){Mt(t,e)||(Zr(t,e),It(e))},start:function(e){return Jr(t,e)},drop:pi(t,Xr),leave:function(e){Mt(t,e)||Qr(t)}};var a=r.input.getField();na(a,"keyup",function(e){return Mo.call(t,e)}),na(a,"keydown",pi(t,To)),na(a,"keypress",pi(t,Po)),na(a,"focus",function(e){return _n(t,e)}),na(a,"blur",function(e){return Fn(t,e)})}function Yo(t,e,n,i){var r,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=Xt(t,e).state:n="prev");var s=t.options.tabSize,a=M(o,e),l=h(a.text,null,s);a.stateAfter&&(a.stateAfter=null);var c,u=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==n&&(c=o.mode.indent(r,a.text.slice(u.length),a.text),c==Ws||c>150)){if(!i)return;n="prev"}}else c=0,n="not";"prev"==n?c=e>o.first?h(M(o,e-1).text,null,s):0:"add"==n?c=l+t.options.indentUnit:"subtract"==n?c=l-t.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var d="",f=0;if(t.options.indentWithTabs)for(var g=Math.floor(c/s);g;--g)f+=s,d+="\t";if(f<c&&(d+=p(c-f)),d!=u)return Fr(o,d,_(e,0),_(e,u.length),"+input"),a.stateAfter=null,!0;for(var v=0;v<o.sel.ranges.length;v++){var m=o.sel.ranges[v];if(m.head.line==e&&m.head.ch<u.length){var y=_(e,u.length);vr(o,v,new Oa(y,y));break}}}function Xo(t){el=t}function Jo(t,e,n,i,r){var o=t.doc;t.display.shift=!1,i||(i=o.sel);var s=t.state.pasteIncoming||"paste"==r,a=ra(e),l=null;
if(s&&i.ranges.length>1)if(el&&el.text.join("\n")==e){if(i.ranges.length%el.text.length==0){l=[];for(var c=0;c<el.text.length;c++)l.push(o.splitLines(el.text[c]))}}else a.length==i.ranges.length&&t.options.pasteLinesPerSelection&&(l=v(a,function(t){return[t]}));for(var u,h=i.ranges.length-1;h>=0;h--){var d=i.ranges[h],f=d.from(),p=d.to();d.empty()&&(n&&n>0?f=_(f.line,f.ch-n):t.state.overwrite&&!s?p=_(p.line,Math.min(M(o,p.line).text.length,p.ch+g(a).length)):el&&el.lineWise&&el.text.join("\n")==e&&(f=p=_(f.line,0))),u=t.curOp.updateInput;var m={from:f,to:p,text:l?l[h%l.length]:a,origin:r||(s?"paste":t.state.cutIncoming?"cut":"+input")};Or(t.doc,m),xe(t,"inputRead",t,m)}e&&!s&&Qo(t,e),Kn(t),t.curOp.updateInput=u,t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=!1}function Zo(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||fi(e,function(){return Jo(e,n,0,null,"paste")}),!0}function Qo(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var o=t.getModeAt(r.head),s=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(e.indexOf(o.electricChars.charAt(a))>-1){s=Yo(t,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(M(t.doc,r.head.line).text.slice(0,r.head.ch))&&(s=Yo(t,r.head.line,"smart"));s&&xe(t,"electricInput",t,r.head.line)}}}function ts(t){for(var e=[],n=[],i=0;i<t.doc.sel.ranges.length;i++){var r=t.doc.sel.ranges[i].head.line,o={anchor:_(r,0),head:_(r+1,0)};n.push(o),e.push(t.getRange(o.anchor,o.head))}return{text:e,ranges:n}}function es(t,e){t.setAttribute("autocorrect","off"),t.setAttribute("autocapitalize","off"),t.setAttribute("spellcheck",!!e)}function ns(){var t=i("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),e=i("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return ws?t.style.width="1000px":t.setAttribute("wrap","off"),Ps&&(t.style.border="1px solid black"),es(t),e}function is(t,e,n,i,r){function o(){var i=e.line+n;return!(i<t.first||i>=t.first+t.size)&&(e=new _(i,e.ch,e.sticky),c=M(t,i))}function s(i){var s;if(s=r?vo(t.cm,c,e,n):po(c,e,n),null==s){if(i||!o())return!1;e=go(r,t.cm,c,e.line,n)}else e=s;return!0}var a=e,l=n,c=M(t,e.line);if("char"==i)s();else if("column"==i)s(!0);else if("word"==i||"group"==i)for(var u=null,h="group"==i,d=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;!(n<0)||s(!f);f=!1){var p=c.text.charAt(e.ch)||"\n",g=w(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||f||g||(g="s"),u&&u!=g){n<0&&(n=1,s(),e.sticky="after");break}if(g&&(u=g),n>0&&!s(!f))break}var v=Er(t,e,a,l,!0);return z(a,v)&&(v.hitSide=!0),v}function rs(t,e,n,i){var r,o=t.doc,s=e.left;if("page"==i){var a=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(a-.5*bn(t.display),3);r=(n>0?e.bottom:e.top)+n*l}else"line"==i&&(r=n>0?e.bottom+3:e.top-3);for(var c;c=dn(t,s,r),c.outside;){if(n<0?r<=0:r>=o.height){c.hitSide=!0;break}r+=5*n}return c}function os(t,e){var n=qe(t,e.line);if(!n||n.hidden)return null;var i=M(t.doc,e.line),r=Be(n,i,e.line),o=kt(i,t.doc.direction),s="left";if(o){var a=Ct(o,e.ch);s=a%2?"right":"left"}var l=Ye(r.map,e.ch,s);return l.offset="right"==l.collapse?l.end:l.start,l}function ss(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function as(t,e){return e&&(t.bad=!0),t}function ls(t,e,n,i,r){function o(t){return function(e){return e.id==t}}function s(){u&&(c+=h,u=!1)}function a(t){t&&(s(),c+=t)}function l(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(null!=n)return void a(n||e.textContent.replace(/\u200b/g,""));var c,d=e.getAttribute("cm-marker");if(d){var f=t.findMarks(_(i,0),_(r+1,0),o(+d));return void(f.length&&(c=f[0].find(0))&&a(P(t.doc,c.from,c.to).join(h)))}if("false"==e.getAttribute("contenteditable"))return;var p=/^(pre|div|p)$/i.test(e.nodeName);p&&s();for(var g=0;g<e.childNodes.length;g++)l(e.childNodes[g]);p&&(u=!0)}else 3==e.nodeType&&a(e.nodeValue)}for(var c="",u=!1,h=t.doc.lineSeparator();l(e),e!=n;)e=e.nextSibling;return c}function cs(t,e,n){var i;if(e==t.display.lineDiv){if(i=t.display.lineDiv.childNodes[n],!i)return as(t.clipPos(_(t.display.viewTo-1)),!0);e=null,n=0}else for(i=e;;i=i.parentNode){if(!i||i==t.display.lineDiv)return null;if(i.parentNode&&i.parentNode==t.display.lineDiv)break}for(var r=0;r<t.display.view.length;r++){var o=t.display.view[r];if(o.node==i)return us(o,e,n)}}function us(t,e,n){function i(e,n,i){for(var r=-1;r<(h?h.length:0);r++)for(var o=r<0?u.map:h[r],s=0;s<o.length;s+=3){var a=o[s+2];if(a==e||a==n){var l=L(r<0?t.line:t.rest[r]),c=o[s]+i;return(i<0||a!=e)&&(c=o[s+(i?1:0)]),_(l,c)}}}var r=t.text.firstChild,s=!1;if(!e||!o(r,e))return as(_(L(t.line),0),!0);if(e==r&&(s=!0,e=r.childNodes[n],n=0,!e)){var a=t.rest?g(t.rest):t.line;return as(_(L(a),a.text.length),s)}var l=3==e.nodeType?e:null,c=e;for(l||1!=e.childNodes.length||3!=e.firstChild.nodeType||(l=e.firstChild,n&&(n=l.nodeValue.length));c.parentNode!=r;)c=c.parentNode;var u=t.measure,h=u.maps,d=i(l,c,n);if(d)return as(d,s);for(var f=c.nextSibling,p=l?l.nodeValue.length-n:0;f;f=f.nextSibling){if(d=i(f,f.firstChild,0))return as(_(d.line,d.ch-p),s);p+=f.textContent.length}for(var v=c.previousSibling,m=n;v;v=v.previousSibling){if(d=i(v,v.firstChild,-1))return as(_(d.line,d.ch+m),s);m+=v.textContent.length}}function hs(t,e){function n(){t.value=c.getValue()}if(e=e?u(e):{},e.value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var i=s();e.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}var r;if(t.form&&(na(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var o=t.form;r=o.submit;try{var a=o.submit=function(){n(),o.submit=r,o.submit(),o.submit=a}}catch(l){}}e.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(Tt(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=r))}},t.style.display="none";var c=Ko(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return c}function ds(t){t.off=Tt,t.on=na,t.wheelEventPixels=zi,t.Doc=Fa,t.splitLines=ra,t.countColumn=h,t.findColumn=f,t.isWordChar=x,t.Pass=Ws,t.signal=Et,t.Line=ga,t.changeEnd=Hi,t.scrollbarModel=Sa,t.Pos=_,t.cmpPos=F,t.modes=la,t.mimeModes=ca,t.resolveMode=jt,t.getMode=Bt,t.modeExtensions=ua,t.extendMode=Wt,t.copyState=Ut,t.startState=Kt,t.innerMode=qt,t.commands=Wa,t.keyMap=Ba,t.keyName=co,t.isModifierKey=ao,t.lookupKey=so,t.normalizeKeyMap=oo,t.StringStream=ha,t.SharedTextMarker=Ia,t.TextMarker=Da,t.LineWidget=La,t.e_preventDefault=Lt,t.e_stopPropagation=Nt,t.e_stop=It,t.addClass=a,t.contains=o,t.rmClass=Rs,t.keyNames=$a}var fs=navigator.userAgent,ps=navigator.platform,gs=/gecko\/\d/i.test(fs),vs=/MSIE \d/.test(fs),ms=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fs),ys=/Edge\/(\d+)/.exec(fs),bs=vs||ms||ys,xs=bs&&(vs?document.documentMode||6:+(ys||ms)[1]),ws=!ys&&/WebKit\//.test(fs),Cs=ws&&/Qt\/\d+\.\d+/.test(fs),ks=!ys&&/Chrome\//.test(fs),Ss=/Opera\//.test(fs),Ts=/Apple Computer/.test(navigator.vendor),Es=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(fs),Ms=/PhantomJS/.test(fs),Ps=!ys&&/AppleWebKit/.test(fs)&&/Mobile\/\w+/.test(fs),As=/Android/.test(fs),Os=Ps||As||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(fs),Ls=Ps||/Mac/.test(ps),Ns=/\bCrOS\b/.test(fs),Ds=/win/i.test(ps),Is=Ss&&fs.match(/Version\/(\d*\.\d*)/);Is&&(Is=Number(Is[1])),Is&&Is>=15&&(Ss=!1,ws=!0);var _s,Fs=Ls&&(Cs||Ss&&(null==Is||Is<12.11)),zs=gs||bs&&xs>=9,Rs=function(e,n){var i=e.className,r=t(n).exec(i);if(r){var o=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(o?r[1]+o:"")}};_s=document.createRange?function(t,e,n,i){var r=document.createRange();return r.setEnd(i||t,n),r.setStart(t,e),r}:function(t,e,n){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(r){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",e),i};var $s=function(t){t.select()};Ps?$s=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:bs&&($s=function(t){try{t.select()}catch(e){}});var Vs=function(){this.id=null};Vs.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var Hs,js,Bs=30,Ws={toString:function(){return"CodeMirror.Pass"}},Us={scroll:!1},qs={origin:"*mouse"},Ks={origin:"+move"},Gs=[""],Ys=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Xs=/[\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]/,Js=!1,Zs=!1,Qs=null,ta=function(){function t(t){return t<=247?n.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1785?i.charAt(t-1536):1774<=t&&t<=2220?"r":8192<=t&&t<=8203?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t,this.from=e,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,s=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;return function(n,i){var c="ltr"==i?"L":"R";if(0==n.length||"ltr"==i&&!r.test(n))return!1;for(var u=n.length,h=[],d=0;d<u;++d)h.push(t(n.charCodeAt(d)));for(var f=0,p=c;f<u;++f){var v=h[f];"m"==v?h[f]=p:p=v}for(var m=0,y=c;m<u;++m){var b=h[m];"1"==b&&"r"==y?h[m]="n":s.test(b)&&(y=b,"r"==b&&(h[m]="R"))}for(var x=1,w=h[0];x<u-1;++x){var C=h[x];"+"==C&&"1"==w&&"1"==h[x+1]?h[x]="1":","!=C||w!=h[x+1]||"1"!=w&&"n"!=w||(h[x]=w),w=C}for(var k=0;k<u;++k){var S=h[k];if(","==S)h[k]="N";else if("%"==S){var T=void 0;for(T=k+1;T<u&&"%"==h[T];++T);for(var E=k&&"!"==h[k-1]||T<u&&"1"==h[T]?"1":"N",M=k;M<T;++M)h[M]=E;k=T-1}}for(var P=0,A=c;P<u;++P){var O=h[P];"L"==A&&"1"==O?h[P]="L":s.test(O)&&(A=O)}for(var L=0;L<u;++L)if(o.test(h[L])){var N=void 0;for(N=L+1;N<u&&o.test(h[N]);++N);for(var D="L"==(L?h[L-1]:c),I="L"==(N<u?h[N]:c),_=D==I?D?"L":"R":c,F=L;F<N;++F)h[F]=_;L=N-1}for(var z,R=[],$=0;$<u;)if(a.test(h[$])){var V=$;for(++$;$<u&&a.test(h[$]);++$);R.push(new e(0,V,$))}else{var H=$,j=R.length;for(++$;$<u&&"L"!=h[$];++$);for(var B=H;B<$;)if(l.test(h[B])){H<B&&R.splice(j,0,new e(1,H,B));var W=B;for(++B;B<$&&l.test(h[B]);++B);R.splice(j,0,new e(2,W,B)),H=B}else++B;H<$&&R.splice(j,0,new e(1,H,$))}return"ltr"==i&&(1==R[0].level&&(z=n.match(/^\s+/))&&(R[0].from=z[0].length,R.unshift(new e(0,0,z[0].length))),1==g(R).level&&(z=n.match(/\s+$/))&&(g(R).to-=z[0].length,R.push(new e(0,u-z[0].length,u)))),"rtl"==i?R.reverse():R}}(),ea=[],na=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var i=t._handlers||(t._handlers={});i[e]=(i[e]||ea).concat(n)}},ia=function(){if(bs&&xs<9)return!1;var t=i("div");return"draggable"in t||"dragDrop"in t}(),ra=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],i=t.length;e<=i;){var r=t.indexOf("\n",e);r==-1&&(r=t.length);var o=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),s=o.indexOf("\r");s!=-1?(n.push(o.slice(0,s)),e+=s+1):(n.push(o),e=r+1)}return n}:function(t){return t.split(/\r\n?|\n/)},oa=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(n){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},sa=function(){var t=i("div");return"oncopy"in t||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),aa=null,la={},ca={},ua={},ha=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};ha.prototype.eol=function(){return this.pos>=this.string.length},ha.prototype.sol=function(){return this.pos==this.lineStart},ha.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ha.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},ha.prototype.eat=function(t){var e,n=this.string.charAt(this.pos);if(e="string"==typeof t?n==t:n&&(t.test?t.test(n):t(n)))return++this.pos,n},ha.prototype.eatWhile=function(t){for(var e=this.pos;this.eat(t););return this.pos>e},ha.prototype.eatSpace=function(){for(var t=this,e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++t.pos;return this.pos>e},ha.prototype.skipToEnd=function(){this.pos=this.string.length},ha.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},ha.prototype.backUp=function(t){this.pos-=t},ha.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=h(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?h(this.string,this.lineStart,this.tabSize):0)},ha.prototype.indentation=function(){return h(this.string,null,this.tabSize)-(this.lineStart?h(this.string,this.lineStart,this.tabSize):0)},ha.prototype.match=function(t,e,n){if("string"!=typeof t){var i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&e!==!1&&(this.pos+=i[0].length),i)}var r=function(t){return n?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);if(r(o)==r(t))return e!==!1&&(this.pos+=t.length),!0},ha.prototype.current=function(){return this.string.slice(this.start,this.pos)},ha.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},ha.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},ha.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var da=function(t,e){this.state=t,this.lookAhead=e},fa=function(t,e,n,i){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};fa.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},fa.prototype.baseToken=function(t){var e=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)e.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},fa.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},fa.fromSaved=function(t,e,n){return e instanceof da?new fa(t,Ut(t.mode,e.state),n,e.lookAhead):new fa(t,Ut(t.mode,e),n)},fa.prototype.save=function(t){var e=t!==!1?Ut(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new da(e,this.maxLookAhead):e};var pa=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n},ga=function(t,e,n){this.text=t,it(this,e),this.height=n?n(this):1};ga.prototype.lineNo=function(){return L(this)},Ot(ga);var va,ma={},ya={},ba=null,xa=null,wa={left:0,right:0,top:0,bottom:0},Ca=function(t,e,n){this.cm=n;var r=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");t(r),t(o),na(r,"scroll",function(){r.clientHeight&&e(r.scrollTop,"vertical")}),na(o,"scroll",function(){o.clientWidth&&e(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,bs&&xs<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ca.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?i+"px":"0";var r=t.viewHeight-(e?i:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:e?i:0}},Ca.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ca.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ca.prototype.zeroWidthHack=function(){var t=Ls&&!Es?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Vs,this.disableVert=new Vs},Ca.prototype.enableZeroWidthBar=function(t,e,n){function i(){var r=t.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);o!=t?t.style.pointerEvents="none":e.set(1e3,i)}t.style.pointerEvents="auto",e.set(1e3,i)},Ca.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var ka=function(){};ka.prototype.update=function(){return{bottom:0,right:0}},ka.prototype.setScrollLeft=function(){},ka.prototype.setScrollTop=function(){},ka.prototype.clear=function(){};var Sa={"native":Ca,"null":ka},Ta=0,Ea=function(t,e,n){var i=t.display;this.viewport=e,this.visible=$n(i,t.doc,e),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Ve(t),this.force=n,this.dims=wn(t),this.events=[]};Ea.prototype.signal=function(t,e){At(t,e)&&this.events.push(arguments)},Ea.prototype.finish=function(){for(var t=this,e=0;e<this.events.length;e++)Et.apply(null,t.events[e])};var Ma=0,Pa=null;bs?Pa=-.53:gs?Pa=15:ks?Pa=-.7:Ts&&(Pa=-1/3);var Aa=function(t,e){this.ranges=t,this.primIndex=e};Aa.prototype.primary=function(){return this.ranges[this.primIndex]},Aa.prototype.equals=function(t){var e=this;if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var i=e.ranges[n],r=t.ranges[n];if(!z(i.anchor,r.anchor)||!z(i.head,r.head))return!1}return!0},Aa.prototype.deepCopy=function(){for(var t=this,e=[],n=0;n<this.ranges.length;n++)e[n]=new Oa(R(t.ranges[n].anchor),R(t.ranges[n].head));return new Aa(e,this.primIndex)},Aa.prototype.somethingSelected=function(){for(var t=this,e=0;e<this.ranges.length;e++)if(!t.ranges[e].empty())return!0;return!1},Aa.prototype.contains=function(t,e){var n=this;e||(e=t);for(var i=0;i<this.ranges.length;i++){var r=n.ranges[i];if(F(e,r.from())>=0&&F(t,r.to())<=0)return i}return-1};var Oa=function(t,e){this.anchor=t,this.head=e};Oa.prototype.from=function(){return V(this.anchor,this.head)},Oa.prototype.to=function(){return $(this.anchor,this.head)},Oa.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Hr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=this,i=t,r=t+e;i<r;++i){var o=n.lines[i];n.height-=o.height,se(o),xe(o,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){var i=this;this.height+=n,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var r=0;r<e.length;++r)e[r].parent=i},iterN:function(t,e,n){for(var i=this,r=t+e;t<r;++t)if(n(i.lines[t]))return!0}},jr.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){var n=this;this.size-=e;for(var i=0;i<this.children.length;++i){var r=n.children[i],o=r.chunkSize();if(t<o){var s=Math.min(e,o-t),a=r.height;if(r.removeInner(t,s),n.height-=a-r.height,o==s&&(n.children.splice(i--,1),r.parent=null),0==(e-=s))break;t=0}else t-=o}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof Hr))){var l=[];this.collapse(l),this.children=[new Hr(l)],this.children[0].parent=this}},collapse:function(t){for(var e=this,n=0;n<this.children.length;++n)e.children[n].collapse(t)},insertInner:function(t,e,n){var i=this;this.size+=e.length,this.height+=n;for(var r=0;r<this.children.length;++r){var o=i.children[r],s=o.chunkSize();if(t<=s){if(o.insertInner(t,e,n),o.lines&&o.lines.length>50){for(var a=o.lines.length%25+25,l=a;l<o.lines.length;){var c=new Hr(o.lines.slice(l,l+=25));o.height-=c.height,i.children.splice(++r,0,c),c.parent=i}o.lines=o.lines.slice(0,a),i.maybeSpill()}break}t-=s}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),n=new jr(e);if(t.parent){t.size-=n.size,t.height-=n.height;var i=d(t.parent.children,t);t.parent.children.splice(i+1,0,n)}else{var r=new jr(t.children);r.parent=t,t.children=[r,n],t=r}n.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=this,r=0;r<this.children.length;++r){var o=i.children[r],s=o.chunkSize();if(t<s){var a=Math.min(e,s-t);if(o.iterN(t,a,n))return!0;if(0==(e-=a))break;t=0}else t-=s}}};var La=function(t,e,n){var i=this;if(n)for(var r in n)n.hasOwnProperty(r)&&(i[r]=n[r]);this.doc=t,this.node=e};La.prototype.clear=function(){var t=this,e=this.doc.cm,n=this.line.widgets,i=this.line,r=L(i);if(null!=r&&n){for(var o=0;o<n.length;++o)n[o]==t&&n.splice(o--,1);n.length||(i.widgets=null);var s=Ie(this);O(i,Math.max(0,i.height-s)),e&&(fi(e,function(){Br(e,i,-s),yi(e,r,"widget")}),xe(e,"lineWidgetCleared",e,this,r))}},La.prototype.changed=function(){var t=this,e=this.height,n=this.doc.cm,i=this.line;this.height=null;var r=Ie(this)-e;r&&(O(i,i.height+r),n&&fi(n,function(){n.curOp.forceUpdate=!0,Br(n,i,r),xe(n,"lineWidgetChanged",n,t,L(i))}))},Ot(La);var Na=0,Da=function(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++Na};Da.prototype.clear=function(){var t=this;if(!this.explicitlyCleared){var e=this.doc.cm,n=e&&!e.curOp;if(n&&oi(e),At(this,"clear")){var i=this.find();i&&xe(this,"clear",i.from,i.to)}for(var r=null,o=null,s=0;s<this.lines.length;++s){var a=t.lines[s],l=G(a.markedSpans,t);e&&!t.collapsed?yi(e,L(a),"text"):e&&(null!=l.to&&(o=L(a)),null!=l.from&&(r=L(a))),a.markedSpans=Y(a.markedSpans,l),null==l.from&&t.collapsed&&!vt(t.doc,a)&&e&&O(a,bn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=ht(t.lines[c]),h=bt(u);h>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&mi(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&kr(e.doc)),e&&xe(e,"markerCleared",e,this,r,o),n&&si(e),this.parent&&this.parent.clear()}},Da.prototype.find=function(t,e){var n=this;null==t&&"bookmark"==this.type&&(t=1);for(var i,r,o=0;o<this.lines.length;++o){var s=n.lines[o],a=G(s.markedSpans,n);if(null!=a.from&&(i=_(e?s:L(s),a.from),t==-1))return i;if(null!=a.to&&(r=_(e?s:L(s),a.to),1==t))return r}return i&&{from:i,to:r}},Da.prototype.changed=function(){var t=this,e=this.find(-1,!0),n=this,i=this.doc.cm;e&&i&&fi(i,function(){var r=e.line,o=L(e.line),s=qe(i,o);if(s&&(Qe(s),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!vt(n.doc,r)&&null!=n.height){var a=n.height;n.height=null;var l=Ie(n)-a;l&&O(r,r.height+l)}xe(i,"markerChanged",i,t)})},Da.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&d(e.maybeHiddenMarkers,this)!=-1||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},Da.prototype.detachLine=function(t){if(this.lines.splice(d(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},Ot(Da);var Ia=function(t,e){var n=this;this.markers=t,this.primary=e;for(var i=0;i<t.length;++i)t[i].parent=n};Ia.prototype.clear=function(){var t=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)t.markers[e].clear();xe(this,"clear")}},Ia.prototype.find=function(t,e){return this.primary.find(t,e)},Ot(Ia);var _a=0,Fa=function(t,e,n,i,r){if(!(this instanceof Fa))return new Fa(t,e,n,i,r);null==n&&(n=0),jr.call(this,[new Hr([new ga("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=_(n,0);this.sel=Vi(o),this.history=new tr(null),this.id=++_a,this.modeOption=e,this.lineSep=i,this.direction="rtl"==r?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),Yi(this,{from:o,to:o,text:t}),xr(this,Vi(o),Us)};Fa.prototype=b(jr.prototype,{constructor:Fa,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,i=0;i<e.length;++i)n+=e[i].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=A(this,this.first,this.first+this.size);return t===!1?e:e.join(t||this.lineSeparator())},setValue:vi(function(t){var e=_(this.first,0),n=this.first+this.size-1;Or(this,{from:e,to:_(n,M(this,n).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&Gn(this.cm,0,0),xr(this,Vi(e),Us)}),replaceRange:function(t,e,n,i){e=j(this,e),n=n?j(this,n):e,Fr(this,t,e,n,i)},getRange:function(t,e,n){var i=P(this,j(this,t),j(this,e));return n===!1?i:i.join(n||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){if(D(this,t))return M(this,t)},getLineNumber:function(t){return L(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=M(this,t)),ht(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return j(this,t)},getCursor:function(t){var e,n=this.sel.primary();return e=null==t||"head"==t?n.head:"anchor"==t?n.anchor:"end"==t||"to"==t||t===!1?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:vi(function(t,e,n){mr(this,j(this,"number"==typeof t?_(t,e||0):t),null,n)}),setSelection:vi(function(t,e,n){mr(this,j(this,t),j(this,e||t),n)}),extendSelection:vi(function(t,e,n){pr(this,j(this,t),e&&j(this,e),n)}),extendSelections:vi(function(t,e){gr(this,W(this,t),e)}),extendSelectionsBy:vi(function(t,e){var n=v(this.sel.ranges,t);gr(this,W(this,n),e)}),setSelections:vi(function(t,e,n){var i=this;if(t.length){for(var r=[],o=0;o<t.length;o++)r[o]=new Oa(j(i,t[o].anchor),j(i,t[o].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),xr(this,$i(r,e),n)}}),addSelection:vi(function(t,e,n){var i=this.sel.ranges.slice(0);i.push(new Oa(j(this,t),j(this,e||t))),xr(this,$i(i,i.length-1),n)}),getSelection:function(t){for(var e,n=this,i=this.sel.ranges,r=0;r<i.length;r++){var o=P(n,i[r].from(),i[r].to());e=e?e.concat(o):o}return t===!1?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=this,n=[],i=this.sel.ranges,r=0;r<i.length;r++){var o=P(e,i[r].from(),i[r].to());t!==!1&&(o=o.join(t||e.lineSeparator())),n[r]=o}return n},replaceSelection:function(t,e,n){for(var i=[],r=0;r<this.sel.ranges.length;r++)i[r]=t;this.replaceSelections(i,e,n||"+input")},replaceSelections:vi(function(t,e,n){for(var i=this,r=[],o=this.sel,s=0;s<o.ranges.length;s++){var a=o.ranges[s];r[s]={from:a.from(),to:a.to(),text:i.splitLines(t[s]),origin:n}}for(var l=e&&"end"!=e&&Ui(this,r,e),c=r.length-1;c>=0;c--)Or(i,r[c]);l?br(this,l):this.cm&&Kn(this.cm)}),undo:vi(function(){Nr(this,"undo")}),redo:vi(function(){Nr(this,"redo")}),undoSelection:vi(function(){Nr(this,"undo",!0)}),redoSelection:vi(function(){Nr(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i<t.done.length;i++)t.done[i].ranges||++e;for(var r=0;r<t.undone.length;r++)t.undone[r].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){this.history=new tr(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:dr(this.history.done),undone:dr(this.history.undone)}},setHistory:function(t){var e=this.history=new tr(this.history.maxGeneration);e.done=dr(t.done.slice(0),null,!0),e.undone=dr(t.undone.slice(0),null,!0)},setGutterMarker:vi(function(t,e,n){return Vr(this,t,"gutter",function(t){var i=t.gutterMarkers||(t.gutterMarkers={});return i[e]=n,!n&&C(i)&&(t.gutterMarkers=null),!0})}),clearGutter:vi(function(t){var e=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[t]&&Vr(e,n,"gutter",function(){return n.gutterMarkers[t]=null,C(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(t){var e;if("number"==typeof t){if(!D(this,t))return null;if(e=t,t=M(this,t),!t)return null}else if(e=L(t),null==e)return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:vi(function(e,n,i){return Vr(this,e,"gutter"==n?"gutter":"class",function(e){var r="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[r]){if(t(i).test(e[r]))return!1;e[r]+=" "+i}else e[r]=i;return!0})}),
removeLineClass:vi(function(e,n,i){return Vr(this,e,"gutter"==n?"gutter":"class",function(e){var r="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass",o=e[r];if(!o)return!1;if(null==i)e[r]=null;else{var s=o.match(t(i));if(!s)return!1;var a=s.index+s[0].length;e[r]=o.slice(0,s.index)+(s.index&&a!=o.length?" ":"")+o.slice(a)||null}return!0})}),addLineWidget:vi(function(t,e,n){return Wr(this,t,e,n)}),removeLineWidget:function(t){t.clear()},markText:function(t,e,n){return Ur(this,j(this,t),j(this,e),n,n&&n.type||"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return t=j(this,t),Ur(this,t,t,n,"bookmark")},findMarksAt:function(t){t=j(this,t);var e=[],n=M(this,t.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var r=n[i];(null==r.from||r.from<=t.ch)&&(null==r.to||r.to>=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,n){t=j(this,t),e=j(this,e);var i=[],r=t.line;return this.iter(t.line,e.line+1,function(o){var s=o.markedSpans;if(s)for(var a=0;a<s.length;a++){var l=s[a];null!=l.to&&r==t.line&&t.ch>=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r}),i},getAllMarks:function(){var t=[];return this.iter(function(e){var n=e.markedSpans;if(n)for(var i=0;i<n.length;++i)null!=n[i].from&&t.push(n[i].marker)}),t},posFromIndex:function(t){var e,n=this.first,i=this.lineSeparator().length;return this.iter(function(r){var o=r.text.length+i;return o>t?(e=t,!0):(t-=o,void++n)}),j(this,_(n,e))},indexFromPos:function(t){t=j(this,t);var e=t.ch;if(t.line<this.first||t.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,t.line,function(t){e+=t.text.length+n}),e},copy:function(t){var e=new Fa(A(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<n&&(n=t.to);var i=new Fa(A(this,e,n),t.mode||this.modeOption,e,this.lineSep,this.direction);return t.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:t.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],Gr(i,Kr(this)),i},unlinkDoc:function(t){var e=this;if(t instanceof Ko&&(t=t.doc),this.linked)for(var n=0;n<this.linked.length;++n){var i=e.linked[n];if(i.doc==t){e.linked.splice(n,1),t.unlinkDoc(e),Yr(Kr(e));break}}if(t.history==this.history){var r=[t.id];Xi(t,function(t){return r.push(t.id)},!0),t.history=new tr(null),t.history.done=dr(this.history.done,r),t.history.undone=dr(this.history.undone,r)}},iterLinkedDocs:function(t){Xi(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):ra(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:vi(function(t){"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter(function(t){return t.order=null}),this.cm&&Qi(this.cm))})}),Fa.prototype.eachLine=Fa.prototype.iter;for(var za=0,Ra=!1,$a={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Va=0;Va<10;Va++)$a[Va+48]=$a[Va+96]=String(Va);for(var Ha=65;Ha<=90;Ha++)$a[Ha]=String.fromCharCode(Ha);for(var ja=1;ja<=12;ja++)$a[ja+111]=$a[ja+63235]="F"+ja;var Ba={};Ba.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ba.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ba.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ba.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ba["default"]=Ls?Ba.macDefault:Ba.pcDefault;var Wa={selectAll:Pr,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Us)},killLine:function(t){return ho(t,function(e){if(e.empty()){var n=M(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:_(e.head.line+1,0)}:{from:e.head,to:_(e.head.line,n)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return ho(t,function(e){return{from:_(e.from().line,0),to:j(t.doc,_(e.to().line+1,0))}})},delLineLeft:function(t){return ho(t,function(t){return{from:_(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(t){return ho(t,function(e){var n=t.charCoords(e.head,"div").top+5,i=t.coordsChar({left:0,top:n},"div");return{from:i,to:e.from()}})},delWrappedLineRight:function(t){return ho(t,function(e){var n=t.charCoords(e.head,"div").top+5,i=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:i}})},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(_(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(_(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return mo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return bo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return yo(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")},Ks)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")},Ks)},goLineLeftSmart:function(t){return t.extendSelectionsBy(function(e){var n=t.cursorCoords(e.head,"div").top+5,i=t.coordsChar({left:0,top:n},"div");return i.ch<t.getLine(i.line).search(/\S/)?bo(t,e.head):i},Ks)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"char")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),i=t.options.tabSize,r=0;r<n.length;r++){var o=n[r].from(),s=h(t.getLine(o.line),o.ch,i);e.push(p(i-s%i))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return fi(t,function(){for(var e=t.listSelections(),n=[],i=0;i<e.length;i++)if(e[i].empty()){var r=e[i].head,o=M(t.doc,r.line).text;if(o)if(r.ch==o.length&&(r=new _(r.line,r.ch-1)),r.ch>0)r=new _(r.line,r.ch+1),t.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),_(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var s=M(t.doc,r.line-1).text;s&&(r=new _(r.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+s.charAt(s.length-1),_(r.line-1,s.length-1),r,"+transpose"))}n.push(new Oa(r,r))}t.setSelections(n)})},newlineAndIndent:function(t){return fi(t,function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var i=0;i<e.length;i++)t.indentLine(e[i].from().line,null,!0);Kn(t)})},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}},Ua=new Vs,qa=null,Ka=400,Ga=function(t,e,n){this.time=t,this.pos=e,this.button=n};Ga.prototype.compare=function(t,e,n){return this.time+Ka>t&&0==F(e,this.pos)&&n==this.button};var Ya,Xa,Ja={toString:function(){return"CodeMirror.Init"}},Za={},Qa={};Ko.defaults=Za,Ko.optionHandlers=Qa;var tl=[];Ko.defineInitHook=function(t){return tl.push(t)};var el=null,nl=function(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,n){var i=this.options,r=i[t];i[t]==n&&"mode"!=t||(i[t]=n,e.hasOwnProperty(t)&&pi(this,e[t])(this,n,r),Et(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](uo(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||e[n].name==t)return e.splice(n,1),!0},addOverlay:gi(function(e,n){var i=e.token?e:t.getMode(this.options,e);if(i.startState)throw new Error("Overlays may not be stateful.");m(this.state.overlays,{mode:i,modeSpec:e,opaque:n&&n.opaque,priority:n&&n.priority||0},function(t){return t.priority}),this.state.modeGen++,mi(this)}),removeOverlay:gi(function(t){for(var e=this,n=this.state.overlays,i=0;i<n.length;++i){var r=n[i].modeSpec;if(r==t||"string"==typeof t&&r.name==t)return n.splice(i,1),e.state.modeGen++,void mi(e)}}),indentLine:gi(function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),D(this.doc,t)&&Yo(this,t,e,n)}),indentSelection:gi(function(t){for(var e=this,n=this.doc.sel.ranges,i=-1,r=0;r<n.length;r++){var o=n[r];if(o.empty())o.head.line>i&&(Yo(e,o.head.line,t,!0),i=o.head.line,r==e.doc.sel.primIndex&&Kn(e));else{var s=o.from(),a=o.to(),l=Math.max(i,s.line);i=Math.min(e.lastLine(),a.line-(a.ch?0:1))+1;for(var c=l;c<i;++c)Yo(e,c,t);var u=e.doc.sel.ranges;0==s.ch&&n.length==u.length&&u[r].from().ch>0&&vr(e.doc,r,new Oa(s,u[r].to()),Us)}}}),getTokenAt:function(t,e){return te(this,t,e)},getLineTokens:function(t,e){return te(this,_(t),e,!0)},getTokenTypeAt:function(t){t=j(this.doc,t);var e,n=Yt(this,M(this.doc,t.line)),i=0,r=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var s=i+r>>1;if((s?n[2*s-1]:0)>=o)r=s;else{if(!(n[2*s+1]<o)){e=n[2*s+2];break}i=s+1}}var a=e?e.indexOf("overlay "):-1;return a<0?e:0==a?null:e.slice(0,a-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var i=this,r=[];if(!n.hasOwnProperty(e))return r;var o=n[e],s=this.getModeAt(t);if("string"==typeof s[e])o[s[e]]&&r.push(o[s[e]]);else if(s[e])for(var a=0;a<s[e].length;a++){var l=o[s[e][a]];l&&r.push(l)}else s.helperType&&o[s.helperType]?r.push(o[s.helperType]):o[s.name]&&r.push(o[s.name]);for(var c=0;c<o._global.length;c++){var u=o._global[c];u.pred(s,i)&&d(r,u.val)==-1&&r.push(u.val)}return r},getStateAfter:function(t,e){var n=this.doc;return t=H(n,null==t?n.first+n.size-1:t),Xt(this,t+1,e).state},cursorCoords:function(t,e){var n,i=this.doc.sel.primary();return n=null==t?i.head:"object"==typeof t?j(this.doc,t):t?i.from():i.to(),cn(this,n,e||"page")},charCoords:function(t,e){return ln(this,j(this.doc,t),e||"page")},coordsChar:function(t,e){return t=an(this,t,e||"page"),dn(this,t.left,t.top)},lineAtHeight:function(t,e){return t=an(this,{top:t,left:0},e||"page").top,N(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,n){var i,r=!1;if("number"==typeof t){var o=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>o&&(t=o,r=!0),i=M(this.doc,t)}else i=t;return sn(this,i,{top:0,left:0},e||"page",n||r).top+(r?this.doc.height-yt(i):0)},defaultTextHeight:function(){return bn(this.display)},defaultCharWidth:function(){return xn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,i,r){var o=this.display;t=cn(this,j(this.doc,t));var s=t.bottom,a=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),o.sizer.appendChild(e),"over"==i)s=t.top;else if("above"==i||"near"==i){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?s=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(s=t.bottom),a+e.offsetWidth>c&&(a=c-e.offsetWidth)}e.style.top=s+"px",e.style.left=e.style.right="","right"==r?(a=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?a=0:"middle"==r&&(a=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=a+"px"),n&&Wn(this,{left:a,top:s,right:a+e.offsetWidth,bottom:s+e.offsetHeight})},triggerOnKeyDown:gi(To),triggerOnKeyPress:gi(Po),triggerOnKeyUp:Mo,triggerOnMouseDown:gi(Oo),execCommand:function(t){if(Wa.hasOwnProperty(t))return Wa[t].call(null,this)},triggerElectric:gi(function(t){Qo(this,t)}),findPosH:function(t,e,n,i){var r=this,o=1;e<0&&(o=-1,e=-e);for(var s=j(this.doc,t),a=0;a<e&&(s=is(r.doc,s,o,n,i),!s.hitSide);++a);return s},moveH:gi(function(t,e){var n=this;this.extendSelectionsBy(function(i){return n.display.shift||n.doc.extend||i.empty()?is(n.doc,i.head,t,e,n.options.rtlMoveVisually):t<0?i.from():i.to()},Ks)}),deleteH:gi(function(t,e){var n=this.doc.sel,i=this.doc;n.somethingSelected()?i.replaceSelection("",null,"+delete"):ho(this,function(n){var r=is(i,n.head,t,e,!1);return t<0?{from:r,to:n.head}:{from:n.head,to:r}})}),findPosV:function(t,e,n,i){var r=this,o=1,s=i;e<0&&(o=-1,e=-e);for(var a=j(this.doc,t),l=0;l<e;++l){var c=cn(r,a,"div");if(null==s?s=c.left:c.left=s,a=rs(r,c,o,n),a.hitSide)break}return a},moveV:gi(function(t,e){var n=this,i=this.doc,r=[],o=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy(function(s){if(o)return t<0?s.from():s.to();var a=cn(n,s.head,"div");null!=s.goalColumn&&(a.left=s.goalColumn),r.push(a.left);var l=rs(n,a,t,e);return"page"==e&&s==i.sel.primary()&&qn(n,ln(n,l,"div").top-a.top),l},Ks),r.length)for(var s=0;s<i.sel.ranges.length;s++)i.sel.ranges[s].goalColumn=r[s]}),findWordAt:function(t){var e=this.doc,n=M(e,t.line).text,i=t.ch,r=t.ch;if(n){var o=this.getHelper(t,"wordChars");"before"!=t.sticky&&r!=n.length||!i?++r:--i;for(var s=n.charAt(i),a=w(s,o)?function(t){return w(t,o)}:/\s/.test(s)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!w(t)};i>0&&a(n.charAt(i-1));)--i;for(;r<n.length&&a(n.charAt(r));)++r}return new Oa(_(t.line,i),_(t.line,r))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?a(this.display.cursorDiv,"CodeMirror-overwrite"):Rs(this.display.cursorDiv,"CodeMirror-overwrite"),Et(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==s()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:gi(function(t,e){Gn(this,t,e)}),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-$e(this)-this.display.barHeight,width:t.scrollWidth-$e(this)-this.display.barWidth,clientHeight:He(this),clientWidth:Ve(this)}},scrollIntoView:gi(function(t,e){null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:_(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line?Yn(this,t):Jn(this,t.from,t.to,t.margin)}),setSize:gi(function(t,e){var n=this,i=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=i(t)),null!=e&&(this.display.wrapper.style.height=i(e)),this.options.lineWrapping&&tn(this);var r=this.display.viewFrom;this.doc.iter(r,this.display.viewTo,function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){yi(n,r,"widget");break}++r}),this.curOp.forceUpdate=!0,Et(this,"refresh",this)}),operation:function(t){return fi(this,t)},startOperation:function(){return oi(this)},endOperation:function(){return si(this)},refresh:gi(function(){var t=this.display.cachedTextHeight;mi(this),this.curOp.forceUpdate=!0,en(this),Gn(this,this.doc.scrollLeft,this.doc.scrollTop),Ni(this),(null==t||Math.abs(t-bn(this.display))>.5)&&Sn(this),Et(this,"refresh",this)}),swapDoc:gi(function(t){var e=this.doc;return e.cm=null,Ji(this,t),en(this),this.display.input.reset(),Gn(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,xe(this,"swapDoc",this,e),e}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ot(t),t.registerHelper=function(e,i,r){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][i]=r},t.registerGlobalHelper=function(e,i,r,o){t.registerHelper(e,i,o),n[e]._global.push({pred:r,val:o})}},il=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Vs,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};il.prototype.init=function(t){function e(t){if(!Mt(r,t)){if(r.somethingSelected())Xo({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=ts(r);Xo({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation(function(){r.setSelections(e.ranges,0,Us),r.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var n=el.text.join("\n");if(t.clipboardData.setData("Text",n),t.clipboardData.getData("Text")==n)return void t.preventDefault()}var s=ns(),a=s.firstChild;r.display.lineSpace.insertBefore(s,r.display.lineSpace.firstChild),a.value=el.text.join("\n");var l=document.activeElement;$s(a),setTimeout(function(){r.display.lineSpace.removeChild(s),l.focus(),l==o&&i.showPrimarySelection()},50)}}var n=this,i=this,r=i.cm,o=i.div=t.lineDiv;es(o,r.options.spellcheck),na(o,"paste",function(t){Mt(r,t)||Zo(t,r)||xs<=11&&setTimeout(pi(r,function(){return n.updateFromDOM()}),20)}),na(o,"compositionstart",function(t){n.composing={data:t.data,done:!1}}),na(o,"compositionupdate",function(t){n.composing||(n.composing={data:t.data,done:!1})}),na(o,"compositionend",function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),na(o,"touchstart",function(){return i.forceCompositionEnd()}),na(o,"input",function(){n.composing||n.readFromDOMSoon()}),na(o,"copy",e),na(o,"cut",e)},il.prototype.prepareSelection=function(){var t=Pn(this.cm,!1);return t.focus=this.cm.state.focused,t},il.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},il.prototype.showPrimarySelection=function(){var t=window.getSelection(),e=this.cm,n=e.doc.sel.primary(),i=n.from(),r=n.to();if(e.display.viewTo==e.display.viewFrom||i.line>=e.display.viewTo||r.line<e.display.viewFrom)return void t.removeAllRanges();var o=cs(e,t.anchorNode,t.anchorOffset),s=cs(e,t.focusNode,t.focusOffset);if(!o||o.bad||!s||s.bad||0!=F(V(o,s),i)||0!=F($(o,s),r)){var a=e.display.view,l=i.line>=e.display.viewFrom&&os(e,i)||{node:a[0].measure.map[2],offset:0},c=r.line<e.display.viewTo&&os(e,r);if(!c){var u=a[a.length-1].measure,h=u.maps?u.maps[u.maps.length-1]:u.map;c={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(!l||!c)return void t.removeAllRanges();var d,f=t.rangeCount&&t.getRangeAt(0);try{d=_s(l.node,l.offset,c.offset,c.node)}catch(p){}d&&(!gs&&e.state.focused?(t.collapse(l.node,l.offset),d.collapsed||(t.removeAllRanges(),t.addRange(d))):(t.removeAllRanges(),t.addRange(d)),f&&null==t.anchorNode?t.addRange(f):gs&&this.startGracePeriod()),this.rememberSelection()}},il.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation(function(){return t.cm.curOp.selectionChanged=!0})},20)},il.prototype.showMultipleSelections=function(t){n(this.cm.display.cursorDiv,t.cursors),n(this.cm.display.selectionDiv,t.selection)},il.prototype.rememberSelection=function(){var t=window.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},il.prototype.selectionInEditor=function(){var t=window.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return o(this.div,e)},il.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},il.prototype.blur=function(){this.div.blur()},il.prototype.getField=function(){return this.div},il.prototype.supportsTouch=function(){return!0},il.prototype.receivedFocus=function(){function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}var e=this;this.selectionInEditor()?this.pollSelection():fi(this.cm,function(){return e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,t)},il.prototype.selectionChanged=function(){var t=window.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},il.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=window.getSelection(),e=this.cm;if(As&&ks&&this.cm.options.gutters.length&&ss(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=cs(e,t.anchorNode,t.anchorOffset),i=cs(e,t.focusNode,t.focusOffset);n&&i&&fi(e,function(){xr(e.doc,Vi(n,i),Us),(n.bad||i.bad)&&(e.curOp.selectionChanged=!0)})}}},il.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t=this.cm,e=t.display,n=t.doc.sel.primary(),i=n.from(),r=n.to();if(0==i.ch&&i.line>t.firstLine()&&(i=_(i.line-1,M(t.doc,i.line-1).length)),r.ch==M(t.doc,r.line).text.length&&r.line<t.lastLine()&&(r=_(r.line+1,0)),i.line<e.viewFrom||r.line>e.viewTo-1)return!1;var o,s,a;i.line==e.viewFrom||0==(o=En(t,i.line))?(s=L(e.view[0].line),a=e.view[0].node):(s=L(e.view[o].line),a=e.view[o-1].node.nextSibling);var l,c,u=En(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(ls(t,a,c,s,l)),d=P(t.doc,_(s,0),_(l,M(t.doc,l).text.length));h.length>1&&d.length>1;)if(g(h)==g(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),s++}for(var f=0,p=0,v=h[0],m=d[0],y=Math.min(v.length,m.length);f<y&&v.charCodeAt(f)==m.charCodeAt(f);)++f;for(var b=g(h),x=g(d),w=Math.min(b.length-(1==h.length?f:0),x.length-(1==d.length?f:0));p<w&&b.charCodeAt(b.length-p-1)==x.charCodeAt(x.length-p-1);)++p;if(1==h.length&&1==d.length&&s==i.line)for(;f&&f>i.ch&&b.charCodeAt(b.length-p-1)==x.charCodeAt(x.length-p-1);)f--,p++;h[h.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var C=_(s,f),k=_(l,d.length?g(d).length-p:0);return h.length>1||h[0]||F(C,k)?(Fr(t.doc,h,C,k,"+input"),!0):void 0},il.prototype.ensurePolled=function(){this.forceCompositionEnd()},il.prototype.reset=function(){this.forceCompositionEnd()},il.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},il.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()},80))},il.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||fi(this.cm,function(){return mi(t.cm)})},il.prototype.setUneditable=function(t){t.contentEditable="false"},il.prototype.onKeyPress=function(t){0!=t.charCode&&(t.preventDefault(),this.cm.isReadOnly()||pi(this.cm,Jo)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},il.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},il.prototype.onContextMenu=function(){},il.prototype.resetPosition=function(){},il.prototype.needsContentAttribute=!0;var rl=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new Vs,this.hasSelection=!1,this.composing=null};rl.prototype.init=function(t){function e(t){if(!Mt(r,t)){if(r.somethingSelected())Xo({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=ts(r);Xo({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Us):(i.prevInput="",s.value=e.text.join("\n"),$s(s))}"cut"==t.type&&(r.state.cutIncoming=!0)}}var n=this,i=this,r=this.cm,o=this.wrapper=ns(),s=this.textarea=o.firstChild;t.wrapper.insertBefore(o,t.wrapper.firstChild),Ps&&(s.style.width="0px"),na(s,"input",function(){bs&&xs>=9&&n.hasSelection&&(n.hasSelection=null),i.poll()}),na(s,"paste",function(t){Mt(r,t)||Zo(t,r)||(r.state.pasteIncoming=!0,i.fastPoll())}),na(s,"cut",e),na(s,"copy",e),na(t.scroller,"paste",function(e){_e(t,e)||Mt(r,e)||(r.state.pasteIncoming=!0,i.focus())}),na(t.lineSpace,"selectstart",function(e){_e(t,e)||Lt(e)}),na(s,"compositionstart",function(){var t=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}}),na(s,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},rl.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,i=Pn(t);if(t.options.moveInputWithCursor){var r=cn(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),s=e.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+s.top-o.top)),i.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+s.left-o.left))}return i},rl.prototype.showSelection=function(t){var e=this.cm,i=e.display;n(i.cursorDiv,t.cursors),n(i.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},rl.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&$s(this.textarea),bs&&xs>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",bs&&xs>=9&&(this.hasSelection=null))}},rl.prototype.getField=function(){return this.textarea},rl.prototype.supportsTouch=function(){return!1},rl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Os||s()!=this.textarea))try{this.textarea.focus()}catch(t){}},rl.prototype.blur=function(){this.textarea.blur()},rl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rl.prototype.receivedFocus=function(){this.slowPoll()},rl.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},rl.prototype.fastPoll=function(){function t(){var i=n.poll();i||e?(n.pollingFast=!1,n.slowPoll()):(e=!0,n.polling.set(60,t))}var e=!1,n=this;n.pollingFast=!0,n.polling.set(20,t)},rl.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!e.state.focused||oa(n)&&!i&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=n.value;if(r==i&&!e.somethingSelected())return!1;if(bs&&xs>=9&&this.hasSelection===r||Ls&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=r.charCodeAt(0);if(8203!=o||i||(i=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,a=Math.min(i.length,r.length);s<a&&i.charCodeAt(s)==r.charCodeAt(s);)++s;return fi(e,function(){Jo(e,r.slice(s),i.length-s,null,t.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},rl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},rl.prototype.onKeyPress=function(){bs&&xs>=9&&(this.hasSelection=null),this.fastPoll()},rl.prototype.onContextMenu=function(t){function e(){if(null!=s.selectionStart){var t=r.somethingSelected(),e=""+(t?s.value:"");s.value="⇚",s.value=e,i.prevInput=t?"":"",s.selectionStart=1,s.selectionEnd=e.length,o.selForContextMenu=r.doc.sel}}function n(){if(i.contextMenuPending=!1,i.wrapper.style.cssText=h,s.style.cssText=u,bs&&xs<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=s.selectionStart){(!bs||bs&&xs<9)&&e();var t=0,n=function(){
o.selForContextMenu==r.doc.sel&&0==s.selectionStart&&s.selectionEnd>0&&""==i.prevInput?pi(r,Pr)(r):t++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var i=this,r=i.cm,o=r.display,s=i.textarea,a=Tn(r,t),l=o.scroller.scrollTop;if(a&&!Ss){var c=r.options.resetSelectionOnContextMenu;c&&r.doc.sel.contains(a)==-1&&pi(r,xr)(r.doc,Vi(a),Us);var u=s.style.cssText,h=i.wrapper.style.cssText;i.wrapper.style.cssText="position: absolute";var d=i.wrapper.getBoundingClientRect();s.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-d.top-5)+"px; left: "+(t.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(bs?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(ws&&(f=window.scrollY),o.input.focus(),ws&&window.scrollTo(null,f),o.input.reset(),r.somethingSelected()||(s.value=i.prevInput=" "),i.contextMenuPending=!0,o.selForContextMenu=r.doc.sel,clearTimeout(o.detectingSelectAll),bs&&xs>=9&&e(),zs){It(t);var p=function(){Tt(window,"mouseup",p),setTimeout(n,20)};na(window,"mouseup",p)}else setTimeout(n,50)}},rl.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t},rl.prototype.setUneditable=function(){},rl.prototype.needsContentAttribute=!1,Bo(Ko),nl(Ko);var ol="iter insert remove copy getEditor constructor".split(" ");for(var sl in Fa.prototype)Fa.prototype.hasOwnProperty(sl)&&d(ol,sl)<0&&(Ko.prototype[sl]=function(t){return function(){return t.apply(this.doc,arguments)}}(Fa.prototype[sl]));return Ot(Fa),Ko.inputStyles={textarea:rl,contenteditable:il},Ko.defineMode=function(t){Ko.defaults.mode||"null"==t||(Ko.defaults.mode=t),Vt.apply(this,arguments)},Ko.defineMIME=Ht,Ko.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),Ko.defineMIME("text/plain","null"),Ko.defineExtension=function(t,e){Ko.prototype[t]=e},Ko.defineDocExtension=function(t,e){Fa.prototype[t]=e},Ko.fromTextArea=hs,ds(Ko),Ko.version="5.31.0",Ko})},function(t,e,n){"use strict";var i=n(0),r=1,o=2,s=i.Model.extend({idAttribute:"name",defaults:{name:"",label:"",type:r,active:!0,"private":!1,"protected":!1},initialize:function(){var t=this.get("name"),e=this.get("label");t?e||this.set("label",t):this.set("name",e),this.set("name",s.escapeName(this.get("name")))},getFullName:function(){var t="";switch(this.get("type")){case r:t=".";break;case o:t="#"}return t+this.get("name")}},{TYPE_CLASS:r,TYPE_ID:o,escapeName:function(t){return(""+t).trim().replace(/([^a-z0-9\w-]+)/gi,"-")}});t.exports=s},function(t,e,n){"use strict";var i=(n(1),n(0)),r=i.$;t.exports=i.View.extend({events:{change:"onChange"},attributes:function(){return this.model.get("attributes")},initialize:function(t){var e=this.model,n=(e.get("name"),e.target);this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=n,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='<div class="'+this.fieldClass+'"><div class="'+this.inputhClass+'"></div></div>'},onChange:function(){this.model.set("value",this.getInputEl().value)},getValueForTarget:function(){return this.model.get("value")},setInputValue:function(t){this.getInputEl().value=t},onValueChange:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.model;this.target,i.get("name");if(n.fromTarget)this.setInputValue(i.get("value"));else{var r=this.getValueForTarget();i.setTargetValue(r)}},renderLabel:function(){this.$el.html('<div class="'+this.labelClass+'">'+this.getLabel()+"</div>")},getLabel:function(){var t=this.model,e=t.get("label")||t.get("name");return e.charAt(0).toUpperCase()+e.slice(1).replace(/-/g," ")},getInputEl:function(){if(!this.$input){var t=this.model,e=this.target,n=t.get("name"),i=t.get("placeholder")||t.get("default")||"",o=t.get("type")||"text",s=e.get("attributes"),a=t.get("min"),l=t.get("max"),c=t.get("changeProp")?e.get(n):t.get("value")||s[n],u=r('<input type="'+o+'" placeholder="'+i+'">');c&&u.prop("value",c),a&&u.prop("min",a),l&&u.prop("max",l),this.$input=u}return this.$input.get(0)},getModelValue:function(){var t,e=this.model,n=this.target,i=e.get("name");if(e.get("changeProp"))t=n.get(i);else{var r=n.get("attributes");t=e.get("value")||r[i]}return t},renderField:function(){if(!this.$input){this.$el.append(this.tmpl);var t=this.getInputEl(),e=this.el.querySelector("."+this.inputhClass);e.insertBefore(t,e.childNodes[0])}},render:function(){return this.renderLabel(),this.renderField(),this.el.className=this.className,this}})},function(t,e,n){"use strict";var i,r;!function(o,s){i=s,r="function"==typeof i?i.call(e,n,e,t):i,!(void 0!==r&&(t.exports=r))}(this,function(){function t(t,e){e=e||M;var n=z.test(t)?e.getElementsByClassName(t.slice(1)):$.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t);return n}function e(t){if(!E){E=M.implementation.createHTMLDocument();var e=E.createElement("base");e.href=M.location.href,E.head.appendChild(e)}return E.body.innerHTML=t,E.body.childNodes}function n(t){"loading"!==M.readyState?t():M.addEventListener("DOMContentLoaded",t)}function i(i,r){if(!i)return this;if(i.cash&&i!==P)return i;var o,s=i,a=0;if(_(i))s=F.test(i)?M.getElementById(i.slice(1)):R.test(i)?e(i):t(i,r);else if(I(i))return n(i),this;if(!s)return this;if(s.nodeType||s===P)this[0]=s,this.length=1;else for(o=this.length=s.length;a<o;a++)this[a]=s[a];return this}function r(t,e){return new i(t,e)}function o(t,e){for(var n=t.length,i=0;i<n&&e.call(t[i],t[i],i,t)!==!1;i++);}function s(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector);return!!n&&n.call(t,e)}function a(t){return _(t)?s:t.cash?function(e){return t.is(e)}:function(t,e){return t===e}}function l(t){return r(O.call(t).filter(function(t,e,n){return n.indexOf(t)===e}))}function c(t){return t[H]=t[H]||{}}function u(t,e,n){return c(t)[e]=n}function h(t,e){var n=c(t);return void 0===n[e]&&(n[e]=t.dataset?t.dataset[e]:r(t).attr("data-"+e)),n[e]}function d(t,e){var n=c(t);n?delete n[e]:t.dataset?delete t.dataset[e]:r(t).removeAttr("data-"+name)}function f(t){return _(t)&&t.match(j)}function p(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function g(t,e,n){t.classList?t.classList.add(e):n.indexOf(" "+e+" ")&&(t.className+=" "+e)}function v(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"")}function m(t,e){return parseInt(P.getComputedStyle(t[0],null)[e],10)||0}function y(t,e,n){var i=h(t,"_cashEvents")||u(t,"_cashEvents",{});i[e]=i[e]||[],i[e].push(n),t.addEventListener(e,n)}function b(t,e,n){var i,r=h(t,"_cashEvents"),s=r&&r[e];s&&(n?(t.removeEventListener(e,n),i=s.indexOf(n),i>=0&&s.splice(i,1)):(o(s,function(n){t.removeEventListener(e,n)}),s=[]))}function x(t,e){return"&"+encodeURIComponent(t)+"="+encodeURIComponent(e).replace(/%20/g,"+")}function w(t){var e=[];return o(t.options,function(t){t.selected&&e.push(t.value)}),e.length?e:null}function C(t){var e=t.selectedIndex;return e>=0?t.options[e].value:null}function k(t){var e=t.type;if(!e)return null;switch(e.toLowerCase()){case"select-one":return C(t);case"select-multiple":return w(t);case"radio":return t.checked?t.value:null;case"checkbox":return t.checked?t.value:null;default:return t.value?t.value:null}}function S(t,e,n){if(n){var i=t.childNodes[0];t.insertBefore(e,i)}else t.appendChild(e)}function T(t,e,n){var i=_(e);return!i&&e.length?void o(e,function(e){return T(t,e,n)}):void o(t,i?function(t){return t.insertAdjacentHTML(n?"afterbegin":"beforeend",e)}:function(t,i){return S(t,0===i?e:e.cloneNode(!0),n)})}var E,M=document,P=window,A=Array.prototype,O=A.slice,L=A.filter,N=A.push,D=function(){},I=function(t){return typeof t==typeof D&&t.call},_=function(t){return"string"==typeof t},F=/^#[\w-]*$/,z=/^\.[\w-]*$/,R=/<.+>/,$=/^\w+$/,V=r.fn=r.prototype=i.prototype={cash:!0,length:0,push:N,splice:A.splice,map:A.map,init:i};Object.defineProperty(V,"constructor",{value:r}),r.parseHTML=e,r.noop=D,r.isFunction=I,r.isString=_,r.extend=V.extend=function(t){t=t||{};var e=O.call(arguments),n=e.length,i=1;for(1===e.length&&(t=this,i=0);i<n;i++)if(e[i])for(var r in e[i])e[i].hasOwnProperty(r)&&(t[r]=e[i][r]);return t},r.extend({merge:function(t,e){for(var n=+e.length,i=t.length,r=0;r<n;i++,r++)t[i]=e[r];return t.length=i,t},each:o,matches:s,unique:l,isArray:Array.isArray,isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}});var H=r.uid="_cash"+Date.now();V.extend({data:function(t,e){if(_(t))return void 0===e?h(this[0],t):this.each(function(n){return u(n,t,e)});for(var n in t)this.data(n,t[n]);return this},removeData:function(t){return this.each(function(e){return d(e,t)})}});var j=/\S+/g;V.extend({addClass:function(t){var e=f(t);return e?this.each(function(t){var n=" "+t.className+" ";o(e,function(e){g(t,e,n)})}):this},attr:function(t,e){if(t){if(_(t))return void 0===e?this[0]?this[0].getAttribute?this[0].getAttribute(t):this[0][t]:void 0:this.each(function(n){n.setAttribute?n.setAttribute(t,e):n[t]=e});for(var n in t)this.attr(n,t[n]);return this}},hasClass:function(t){var e=!1,n=f(t);return n&&n.length&&this.each(function(t){return e=p(t,n[0]),!e}),e},prop:function(t,e){if(_(t))return void 0===e?this[0][t]:this.each(function(n){n[t]=e});for(var n in t)this.prop(n,t[n]);return this},removeAttr:function(t){return this.each(function(e){e.removeAttribute?e.removeAttribute(t):delete e[t]})},removeClass:function(t){if(!arguments.length)return this.attr("class","");var e=f(t);return e?this.each(function(t){o(e,function(e){v(t,e)})}):this},removeProp:function(t){return this.each(function(e){delete e[t]})},toggleClass:function(t,e){if(void 0!==e)return this[e?"addClass":"removeClass"](t);var n=f(t);return n?this.each(function(t){var e=" "+t.className+" ";o(n,function(n){p(t,n)?v(t,n):g(t,n,e)})}):this}}),V.extend({add:function(t,e){return l(r.merge(this,r(t,e)))},each:function(t){return o(this,t),this},eq:function(t){return r(this.get(t))},filter:function(t){if(!t)return this;var e=I(t)?t:a(t);return r(L.call(this,function(n){return e(n,t)}))},first:function(){return this.eq(0)},get:function(t){return void 0===t?O.call(this):t<0?this[t+this.length]:this[t]},index:function(t){var e=t?r(t)[0]:this[0],n=t?this:r(e).parent().children();return O.call(n).indexOf(e)},last:function(){return this.eq(-1)}});var B=function(){var t=/(?:^\w|[A-Z]|\b\w)/g,e=/[\s-_]+/g;return function(n){return n.replace(t,function(t,e){return t[0===e?"toLowerCase":"toUpperCase"]()}).replace(e,"")}}(),W=function(){var t={},e=document,n=e.createElement("div"),i=n.style;return function(e){if(e=B(e),t[e])return t[e];var n=e.charAt(0).toUpperCase()+e.slice(1),r=["webkit","moz","ms","o"],s=(e+" "+r.join(n+" ")+n).split(" ");return o(s,function(n){if(n in i)return t[n]=e=t[e]=n,!1}),t[e]}}();r.prefixedProp=W,r.camelCase=B,V.extend({css:function(t,e){if(_(t))return t=W(t),arguments.length>1?this.each(function(n){return n.style[t]=e}):P.getComputedStyle(this[0])[t];for(var n in t)this.css(n,t[n]);return this}}),o(["Width","Height"],function(t){var e=t.toLowerCase();V[e]=function(){return this[0].getBoundingClientRect()[e]},V["inner"+t]=function(){return this[0]["client"+t]},V["outer"+t]=function(e){return this[0]["offset"+t]+(e?m(this,"margin"+("Width"===t?"Left":"Top"))+m(this,"margin"+("Width"===t?"Right":"Bottom")):0)}}),V.extend({off:function(t,e){return this.each(function(n){return b(n,t,e)})},on:function(t,e,i,r){var o;if(!_(t)){for(var a in t)this.on(a,e,t[a]);return this}return I(e)&&(i=e,e=null),"ready"===t?(n(i),this):(e&&(o=i,i=function(t){for(var n=t.target;!s(n,e);){if(n===this)return n=!1;n=n.parentNode}n&&o.call(n,t)}),this.each(function(e){var n=i;r&&(n=function(){i.apply(this,arguments),b(e,t,n)}),y(e,t,n)}))},one:function(t,e,n){return this.on(t,e,n,!0)},ready:n,trigger:function(t,e){var n=M.createEvent("HTMLEvents");return n.data=e,n.initEvent(t,!0,!1),this.each(function(t){return t.dispatchEvent(n)})}}),V.extend({serialize:function(){var t="";return o(this[0].elements||this,function(e){if(!e.disabled&&"FIELDSET"!==e.tagName){var n=e.name;switch(e.type.toLowerCase()){case"file":case"reset":case"submit":case"button":break;case"select-multiple":var i=k(e);null!==i&&o(i,function(e){t+=x(n,e)});break;default:var r=k(e);null!==r&&(t+=x(n,r))}}}),t.substr(1)},val:function(t){return void 0===t?k(this[0]):this.each(function(e){return e.value=t})}}),V.extend({after:function(t){return r(t).insertAfter(this),this},append:function(t){return T(this,t),this},appendTo:function(t){return T(r(t),this),this},before:function(t){return r(t).insertBefore(this),this},clone:function(){return r(this.map(function(t){return t.cloneNode(!0)}))},empty:function(){return this.html(""),this},html:function(t){if(void 0===t)return this[0].innerHTML;var e=t.nodeType?t[0].outerHTML:t;return this.each(function(t){return t.innerHTML=e})},insertAfter:function(t){var e=this;return r(t).each(function(t,n){var i=t.parentNode,r=t.nextSibling;e.each(function(t){i.insertBefore(0===n?t:t.cloneNode(!0),r)})}),this},insertBefore:function(t){var e=this;return r(t).each(function(t,n){var i=t.parentNode;e.each(function(e){i.insertBefore(0===n?e:e.cloneNode(!0),t)})}),this},prepend:function(t){return T(this,t,!0),this},prependTo:function(t){return T(r(t),this,!0),this},remove:function(){return this.each(function(t){return t.parentNode.removeChild(t)})},text:function(t){return void 0===t?this[0].textContent:this.each(function(e){return e.textContent=t})}});var U=M.documentElement;return V.extend({position:function(){var t=this[0];return{left:t.offsetLeft,top:t.offsetTop}},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+P.pageYOffset-U.clientTop,left:t.left+P.pageXOffset-U.clientLeft}},offsetParent:function(){return r(this[0].offsetParent)}}),V.extend({children:function(t){var e=[];return this.each(function(t){N.apply(e,t.children)}),e=l(e),t?e.filter(function(e){return s(e,t)}):e},closest:function(t){return!t||this.length<1?r():this.is(t)?this.filter(t):this.parent().closest(t)},is:function(t){if(!t)return!1;var e=!1,n=a(t);return this.each(function(i){return e=n(i,t),!e}),e},find:function(e){if(!e||e.nodeType)return r(e&&this.has(e).length?e:null);var n=[];return this.each(function(i){N.apply(n,t(e,i))}),l(n)},has:function(e){var n=_(e)?function(n){return 0!==t(e,n).length}:function(t){return t.contains(e)};return this.filter(n)},next:function(){return r(this[0].nextElementSibling)},not:function(t){if(!t)return this;var e=a(t);return this.filter(function(n){return!e(n,t)})},parent:function(){var t=[];return this.each(function(e){e&&e.parentNode&&t.push(e.parentNode)}),l(t)},parents:function(t){var e,n=[];return this.each(function(i){for(e=i;e&&e.parentNode&&e!==M.body.parentNode;)e=e.parentNode,(!t||t&&s(e,t))&&n.push(e)}),l(n)},prev:function(){return r(this[0].previousElementSibling)},siblings:function(){var t=this.parent().children(),e=this[0];return t.filter(function(t){return t!==e})}}),r})},function(t,e,n){"use strict";var i=n(1),r=n(7);t.exports=n(0).Collection.extend({model:r,getStyleable:function(){return(0,i.filter)(this.models,function(t){return t.get("active")&&!t.get("private")})},getValid:function(){return(0,i.filter)(this.models,function(t){return!t.get("private")})},getFullString:function(t){var e=[],n=t||this;return n.forEach(function(t){return e.push(t.getFullName())}),e.join("").trim()}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=n(32),s=i(o),a=n(12);t.exports=n(0).Collection.extend(s["default"]).extend({types:[{id:"stack",model:n(119),view:n(34),isType:function(t){if(t&&"stack"==t.type)return t}},{id:"composite",model:n(33),view:n(17),isType:function(t){if(t&&"composite"==t.type)return t}},{id:"file",model:a,view:n(40),isType:function(t){if(t&&"file"==t.type)return t}},{id:"color",model:a,view:n(38),isType:function(t){if(t&&"color"==t.type)return t}},{id:"select",model:n(41),view:n(37),isType:function(t){if(t&&"select"==t.type)return t}},{id:"radio",model:n(41),view:n(36),isType:function(t){if(t&&"radio"==t.type)return t}},{id:"slider",model:n(125),view:n(126),isType:function(t){if(t&&"slider"==t.type)return t}},{id:"integer",model:n(42),view:n(14),isType:function(t){if(t&&"integer"==t.type)return t}},{id:"base",model:a,view:n(5),isType:function(t){return t.type="base",t}}],deepClone:function(){var t=this.clone();return t.reset(t.map(function(t){var e=t.clone();return e.typeView=t.typeView,e})),t},parseValue:function(t){var e=this,n=[],i=t.split(" ");return i.forEach(function(t,i){var o=e.at(i);n.push(r({},o.attributes,{value:t}))}),n},getFullValue:function(){var t="";return this.each(function(e){return t+=e.getFullValue()+" "}),t.trim()}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};t.exports=n(0).Model.extend({defaults:{name:"",property:"",type:"",defaults:"",info:"",value:"",icon:"",functionName:"",status:"",visible:!0,fixedValues:["initial","inherit"],toRequire:0},initialize:function(t){var e=this.get("name"),n=this.get("property");e||this.set("name",n.charAt(0).toUpperCase()+n.slice(1).replace(/-/g," "));var i=this.init&&this.init.bind(this);i&&i()},setValue:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.parseValue(t);this.set(r,i({},n,{avoidStore:1})),e&&(this.set("value","",n),this.set(r,n))},setValueFromInput:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.setValue(t,e,i({},n,{fromInput:1}))},parseValue:function(t){var e={value:t};if(!this.get("functionName"))return e;var n=[],i=""+t,r=i.indexOf("(")+1,o=i.lastIndexOf(")");return n.push(r),o>=0&&n.push(o),e.value=String.prototype.substring.apply(i,n),e},getDefaultValue:function(){return this.get("defaults")},getFullValue:function(t){var e=this.get("functionName"),n=t||this.get("value");return e&&(n=e+"("+n+")"),n}})},function(t,e,n){"use strict";(function(e){n(5),n(14),n(36),n(37),n(38),n(40),n(17),n(34);t.exports=e.View.extend({initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.onChange=t.onChange,this.onInputRender=t.onInputRender||{},this.customValue=t.customValue||{};var e=this.collection;this.listenTo(e,"add",this.addTo),this.listenTo(e,"reset",this.render)},addTo:function(t){this.add(t)},add:function(t,e){var n=new t.typeView({model:t,name:t.get("name"),id:this.pfx+t.get("property"),target:this.target,propTarget:this.propTarget,onChange:this.onChange,onInputRender:this.onInputRender,config:this.config});"composite"!=t.get("type")&&(n.customValue=this.customValue),n.render();var i=n.el;e?e.appendChild(i):this.el.appendChild(i)},render:function(){var t=this,e=document.createDocumentFragment();return this.collection.each(function(n){return t.add(n,e)}),this.$el.append(e),this.$el.attr("class",this.pfx+"properties"),this}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=(n(18),e.$);t.exports=n(5).extend({templateInput:function(){return""},init:function(){var t=this.model;this.listenTo(t,"change:unit",this.modelValueChanged),this.listenTo(t,"el:change",this.elementUpdated)},setValue:function(t){this.inputInst.setValue(t,{silent:1})},onRender:function(){var t=this.ppfx;if(!this.input){var e=this.model.input;e.ppfx=t,e.render();var n=this.el.querySelector("."+t+"fields");n.appendChild(e.el),this.$input=e.inputEl,this.unit=e.unitEl,this.$unit=i(this.unit),this.input=this.$input.get(0),this.inputInst=e}}})}).call(e,n(0))},function(t,e,n){"use strict";var i=(n(0),n(3));t.exports=i.extend({tagName:"img",events:{dblclick:"openModal",click:"initResize"},initialize:function(t){var e=this.model;i.prototype.initialize.apply(this,arguments),this.listenTo(e,"change:src",this.updateSrc),this.listenTo(e,"dblclick active",this.openModal),this.classEmpty=this.ppfx+"plh-image";var n=this.config;n.modal&&(this.modal=n.modal),n.am&&(this.am=n.am),this.fetchFile()},fetchFile:function(){var t=this.model,e=t.get("file");if(e){var n=this.em.get("AssetManager").FileUploader();n.uploadFile({dataTransfer:{files:[e]}},function(e){var n=e&&e.data&&e.data[0],i=n&&n.src;i&&t.set({src:i})}),t.set("file","")}},updateSrc:function(){var t=this.model.get("src"),e=this.$el;e.attr("src",t),e[t?"removeClass":"addClass"](this.classEmpty)},openModal:function(t){var e=this.opts.config.em,n=e?e.get("Editor"):"";n&&this.model.get("editable")&&n.runCommand("open-assets",{target:this.model,onSelect:function(){n.Modal.close(),n.AssetManager.setTarget(null)}})},render:function(){this.updateAttributes(),this.updateClasses();var t=this.$el.attr("class")||"";return this.model.get("src")||this.$el.attr("class",(t+" "+this.classEmpty).trim()),this.$el.attr("onmousedown","return false"),this}})},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(i){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";(function(e){var i=n(5),r=e.$;t.exports=i.extend({templateInput:function(){var t=this.pfx;return'\n <div class="'+t+"field "+t+'composite">\n <span id="'+t+'input-holder"></span>\n </div>\n '},inputValueChanged:function(){if(!this.model.get("detached")){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.prototype.inputValueChanged.apply(this,e)}},onRender:function(){var t=this.model,e=t.get("properties")||[];if(e.length&&(this.$input||(this.$input=r('<input type="hidden" value="0">'),this.input=this.$input.get(0)),this.props||(this.props=t.get("properties")),!this.$props)){this.props.each(function(e,n){e&&"composite"==e.get("type")&&this.props.remove(e),e.parent=t},this);var i=n(13),o=new i(this.getPropsConfig());this.$props=o.render().$el,this.$el.find("#"+this.pfx+"input-holder").append(this.$props)}},getPropsConfig:function(t){var e=this,n=this.model,i={config:this.config,collection:this.props,target:this.target,propTarget:this.propTarget,onChange:function(t,e,i){n.set("value",n.getFullValue(),i)},customValue:function(t,n){return e.valueOnIndex(n,t)}};return n.get("detached")&&delete i.onChange,i},valueOnIndex:function(t,e){var n=void 0,i=this.getTargetValue({ignoreDefault:1});if(i){var r=i.split(" ");n=r[t]}else n=e&&e.getTargetValue({ignoreCustomValue:1,ignoreDefault:1});return e&&(n=e.model.parseValue(n).value),n}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=n(1),r=n(2),o=n(35),s=n(0);s.$;t.exports=o.extend({events:{"change input":"handleChange","change select":"handleUnitChange","click [data-arrow-up]":"upArrowClick","click [data-arrow-down]":"downArrowClick","mousedown [data-arrows]":"downIncrement"},template:function(){var t=this.ppfx;return'\n <span class="'+t+'input-holder"></span>\n <span class="'+t+'field-units"></span>\n <div class="'+t+'field-arrows" data-arrows>\n <div class="'+t+'field-arrow-u" data-arrow-up></div>\n <div class="'+t+'field-arrow-d" data-arrow-down></div>\n </div>\n '},inputClass:function(){var t=this.ppfx;return this.opts.contClass||t+"field "+t+"field-integer"},initialize:function(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o.prototype.initialize.apply(this,arguments),(0,i.bindAll)(this,"moveIncrement","upIncrement"),this.doc=document,this.listenTo(this.model,"change:unit",this.handleModelChange)},setValue:function(t,e){var n=e||{},i=this.validateInputValue(t,{deepCheck:1}),r={value:i.value};(i.unit||i.force)&&(r.unit=i.unit),this.model.set(r,n),n.silent&&this.handleModelChange()},handleChange:function(t){t.stopPropagation(),this.setValue(this.getInputEl().value),this.elementUpdated()},handleUnitChange:function(t){t.stopPropagation();var e=this.getUnitEl().value;this.model.set("unit",e),this.elementUpdated()},elementUpdated:function(){this.model.trigger("el:change")},handleModelChange:function(){var t=this.model;this.getInputEl().value=t.get("value");var e=this.getUnitEl();e&&(e.value=t.get("unit")||"")},getUnitEl:function(){if(!this.unitEl){var t=this.model,e=t.get("units")||[];if(e.length){var n=[];e.forEach(function(e){var i=e==t.get("unit")?"selected":"";n.push("<option "+i+">"+e+"</option>")});var i=document.createElement("div");i.innerHTML='<select class="'+this.ppfx+'input-unit">'+n.join("")+"</select>",this.unitEl=i.firstChild}}return this.unitEl},upArrowClick:function(){var t=this.model,e=t.get("step"),n=parseInt(t.get("value"),10);n=this.normalizeValue(n+e);var i=this.validateInputValue(n);t.set("value",i.value),this.elementUpdated()},downArrowClick:function(){var t=this.model,e=t.get("step"),n=parseInt(t.get("value"),10),i=this.normalizeValue(n-e),r=this.validateInputValue(i);t.set("value",r.value),this.elementUpdated()},downIncrement:function(t){t.preventDefault(),this.moved=0;var e=this.model.get("value");e=this.normalizeValue(e),this.current={y:t.pageY,val:e},(0,r.on)(this.doc,"mousemove",this.moveIncrement),(0,r.on)(this.doc,"mouseup",this.upIncrement)},moveIncrement:function(t){this.moved=1;var e=this.model,n=e.get("step"),i=this.current,r=this.normalizeValue(i.val+(i.y-t.pageY)*n);return this.prValue=this.validateInputValue(r).value,e.set("value",this.prValue,{avoidStore:1}),!1},upIncrement:function(){var t=this.model,e=t.get("step");if((0,r.off)(this.doc,"mouseup",this.upIncrement),(0,r.off)(this.doc,"mousemove",this.moveIncrement),this.prValue&&this.moved){var n=this.prValue-e;t.set("value",n,{avoidStore:1}).set("value",n+e),this.elementUpdated()}},normalizeValue:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.model,i=n.get("step"),r=0;if(isNaN(t))return e;if(t=parseFloat(t),Math.floor(t)!==t){var o=i.toString().split(".")[1];r=o?o.length:0}return r?parseFloat(t.toFixed(r)):t},validateInputValue:function(t,n){var i=0,r=n||{},o=this.model,s=""!==t?t:o.get("defaults"),a=o.get("units")||[],l=o.get("unit")||a.length&&a[0]||"",c=o.get("max"),u=o.get("min");if(r.deepCheck){var h=o.get("fixedValues")||[];if(s){var d=new RegExp("^"+h.join("|"),"g");if(h.length&&d.test(s))s=s.match(d)[0],l="",i=1;else{var f=s+"";s+="",s=parseFloat(s.replace(",",".")),s=isNaN(s)?o.get("defaults"):s;var p=f.replace(s,"");e.indexOf(a,p)>=0&&(l=p)}}}return"undefined"!=typeof c&&""!==c&&(s=s>c?c:s),"undefined"!=typeof u&&""!==u&&(s=s<u?u:s),{force:i,value:s,unit:l}},render:function(){o.prototype.render.call(this);var t=this.getUnitEl();return t&&this.$el.find("."+this.ppfx+"field-units").get(0).appendChild(t),this}})}).call(e,n(1))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(4);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"tbody",tagName:"tbody",draggable:["table"],droppable:["tr"],columns:1,rows:1}),initialize:function(t,e){r.prototype.initialize.apply(this,arguments);var n=this.get("components"),i=this.get("columns"),o=this.get("rows");if(!n.length){for(var s=[];o--;){for(var a=[],l=i;l--;)a.push({type:"cell",classes:["cell"]});s.push({type:"row",classes:["row"],components:a})}n.add(s)}}},{isComponent:function(t){var e="";return"TBODY"==t.tagName&&(e={type:"tbody"}),e}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(4);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"image",tagName:"img",src:"","void":1,droppable:0,editable:1,highlightable:0,resizable:1,traits:["alt"],file:""}),initialize:function(t,e){r.prototype.initialize.apply(this,arguments);var n=this.get("attributes");n.src&&this.set("src",n.src)},initToolbar:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.prototype.initToolbar.apply(this,e);var i=this.em;if(i){var o=i.get("Commands"),s="image-editor";if(o.has(s)){var a=this.get("toolbar");a.push({attributes:{"class":"fa fa-pencil"},command:s}),this.set("toolbar",a)}}},getAttrToHTML:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=r.prototype.getAttrToHTML.apply(this,e);delete i.onmousedown;var o=this.get("src");return o&&(i.src=o),i},parseUri:function(t){var e=document.createElement("a");e.href=t;for(var n={},i=e.search.substring(1).split("&"),r=0;r<i.length;r++){var o=i[r].split("="),s=decodeURIComponent(o[0]);s&&(n[s]=decodeURIComponent(o[1]))}return{hostname:e.hostname,pathname:e.pathname,protocol:e.protocol,search:e.search,hash:e.hash,port:e.port,query:n}}},{isComponent:function(t){var e="";return"IMG"==t.tagName&&(e={type:"image"}),e}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r="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},o=n(1),s=n(2),a=n(187),l=n(189),c=(n(23),n(0).$),u=void 0;t.exports={init:function(t){(0,o.bindAll)(this,"onHover","onOut","onClick","onKeyPress","onFrameScroll")},enable:function(){this.frameOff=this.canvasOff=this.adjScroll=null;this.config.em.get("Config");this.startSelectComponent();var t=this.config.em;u=1,t.on("component:update",this.updateAttached,this),t.on("change:canvasOffset",this.updateAttached,this)},startSelectComponent:function(){this.toggleSelectComponent(1)},stopSelectComponent:function(){this.toggleSelectComponent()},toggleSelectComponent:function(t){var e=this.em,n=t?"on":"off",i={on:s.on,off:s.off},r=this.getCanvasBody(),o=this.getContentWindow();i[n](r,"mouseover",this.onHover),i[n](r,"mouseout",this.onOut),i[n](r,"click",this.onClick),i[n](o,"scroll",this.onFrameScroll),i[n](o,"keydown",this.onKeyPress),e[n]("change:selectedComponent",this.onSelect,this)},onKeyPress:function(t){var e=t.which||t.keyCode,n=this.editorModel.get("selectedComponent"),i="BODY"!==this.frameEl.contentDocument.activeElement.tagName;if((8==e||46==e)&&(i||t.preventDefault(),n&&!i)){if(!n.get("removable"))return;n.set("status",""),n.destroy(),this.hideBadge(),this.clean(),this.hideHighlighter(),this.editorModel.set("selectedComponent",null)}},onHover:function(t){t.stopPropagation();var e=t.target,n=c(e).data("model");if(this.adjScroll||(this.adjScroll=1,this.onFrameScroll(t),this.updateAttached()),n&&!n.get("hoverable")){for(var i=n&&n.parent();i&&!i.get("hoverable");)i=i.parent();i&&(e=i.view.el)}var r=this.getElementPos(e);this.updateBadge(e,r),this.updateHighlighter(e,r),this.showElementOffset(e,r)},onOut:function(t){t.stopPropagation(),this.hideBadge(),this.hideHighlighter(),this.hideElementOffset()},showElementOffset:function(t,e){var n=c(t),i=n.data("model");i&&"selected"==i.get("status")||!u||this.editor.runCommand("show-offset",{el:t,elPos:e})},hideElementOffset:function(t,e){this.editor.stopCommand("show-offset")},showFixedElementOffset:function(t,e){this.editor.runCommand("show-offset",{el:t,elPos:e,state:"Fixed"})},hideFixedElementOffset:function(t,e){this.editor&&this.editor.stopCommand("show-offset",{state:"Fixed"})},hideHighlighter:function(){this.canvas.getHighlighter().style.display="none";
},onClick:function(t){t.stopPropagation();var e=c(t.target).data("model"),n=this.editor;if(e)if(e.get("selectable"))n.select(e);else{for(var i=e.parent();i&&!i.get("selectable");)i=i.parent();i&&n.select(i)}},updateBadge:function(t,e){var n=c(t),i=this.canvas,r=i.getConfig(),o=r.customBadgeLabel;this.cacheEl=t;var s=n.data("model");if(s&&s.get("badgable")){var a=this.getBadge(),l=s.getIcon()+s.getName();l=o?o(s):l,a.innerHTML=l;var u=a.style,h="px";u.display="block";var d=i.getCanvasView().getPosition(),f=a?a.offsetHeight:0,p=a?a.offsetWidth:0,g=e.top-f<d.top?d.top:e.top-f,v=e.left+p<d.left?d.left:e.left;u.top=g+h,u.left=v+h}},updateHighlighter:function(t,e){var n=c(t),i=n.data("model");if(i&&i.get("hoverable")&&"selected"!=i.get("status")){var r=this.canvas.getHighlighter(),o=r.style,s="px";o.left=e.left+s,o.top=e.top+s,o.height=e.height+s,o.width=e.width+s,o.display="block"}},onSelect:function(){var t=this.editor,e=this.em.getSelected();if(this.updateToolbar(e),e){var n=e.view.el;this.showFixedElementOffset(n),this.hideElementOffset(),this.hideHighlighter(),this.initResize(n)}else t.stopCommand("resize")},initResize:function(t){var e,n=this.em,o=n?n.get("Editor"):"",a=n?n.get("Config"):"",l=a.stylePrefix||"",c=l+"resizing",h=n.get("selectedComponent"),d=h.get("resizable"),f={},p=function(t,e,n){var i=n.docs;i&&i.forEach(function(e){var n=e.body,i=n.className||"";n.className=("add"==t?i+" "+c:i.replace(c,"")).trim()})};o&&d&&(f={onStart:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.el,o=i.config,a=i.resizer,l=o.keyHeight,c=o.keyWidth,d=o.currentUnit;p("add",t,i),e=n.get("StyleManager").getModelToStyle(h);var f=getComputedStyle(r),g=e.getStyle(),v=g[c]||f[c],m=g[l]||f[l];a.startDim.w=parseFloat(v),a.startDim.h=parseFloat(m),u=0,d&&(o.unitHeight=(0,s.getUnitFromValue)(m),o.unitWidth=(0,s.getUnitFromValue)(v))},onMove:function(){o.trigger("change:canvasOffset")},onEnd:function(t,e){p("remove",t,e),o.trigger("change:canvasOffset"),u=1},updateTarget:function(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e){var o=r.store,s=r.selectedHandler,a=r.config,l=a.keyHeight,c=a.keyWidth,u=["tc","bc"].indexOf(s)>=0,h=["cl","cr"].indexOf(s)>=0,d=e.getStyle();u||(d[c]=i.w+a.unitWidth),h||(d[l]=i.h+a.unitHeight),e.setStyle(d,{avoidStore:1});var f="update:component:style";n&&n.trigger(f+":"+l+" "+f+":"+c),o&&e.trigger("change:style",e,d,{})}}},"object"==("undefined"==typeof d?"undefined":r(d))&&(f=i({},f,d)),o.runCommand("resize",{el:t,options:f}))},updateToolbar:function(t){var e=this.config.em,n=t==e?e.get("selectedComponent"):t,i=this.canvas.getToolbarEl(),r=i.style;if(!n)return void(r.opacity=0);var o=n.get("toolbar"),s=(this.ppfx,e.get("Config").showToolbar);if(s&&o&&o.length){if(r.opacity="",r.display="",!this.toolbar){i.innerHTML="",this.toolbar=new l(o);var c=new a({collection:this.toolbar,editor:this.editor});i.appendChild(c.render().el)}this.toolbar.reset(o);var u=n.view;u&&this.updateToolbarPos(u.el)}else r.display="none"},updateToolbarPos:function(t,e){var n="px",i=this.canvas.getToolbarEl(),r=i.style,o=r.display;r.display="block";var s=this.canvas.getTargetToElementDim(i,t,{elPos:e,event:"toolbarPosUpdate"}),a=s.left+s.elementWidth-s.targetWidth;r.top=s.top+n,r.left=(a<0?0:a)+n,r.display=o},getCanvasPosition:function(){return this.canvas.getCanvasView().getPosition()},clean:function(){this.selEl&&this.selEl.removeClass(this.hoverClass)},getBadge:function(){return this.canvas.getBadgeEl()},onFrameScroll:function(t){var e=this.cacheEl;if(e){var n=this.getElementPos(e);this.updateBadge(e,n);var i=this.em.get("selectedComponent");i&&this.updateToolbarPos(i.view.el)}},updateAttached:function(t){var e=this.em.getSelected();if(e){var n=e.view;this.updateToolbarPos(n.el),this.showFixedElementOffset(n.el)}},getElementPos:function(t,e){return this.canvas.getCanvasView().getElementPos(t)},hideBadge:function(){this.getBadge().style.display="none"},cleanPrevious:function(t){t&&t.set({status:"",state:""})},getContentWindow:function(){return this.frameEl.contentWindow},run:function(t){this.editor=t&&t.get("Editor"),this.enable(),this.onSelect()},stop:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.em;this.stopSelectComponent(),!n.preserveSelected&&i.setSelected(null),this.clean(),this.hideBadge(),this.hideFixedElementOffset(),this.canvas.getToolbarEl().style.display="none",i.off("component:update",this.updateAttached,this),i.off("change:canvasOffset",this.updateAttached,this),i.off("change:selectedComponent",this.updateToolbar,this)}}},function(t,e,n){"use strict";(function(e,i){var r=n(54),o=e.$;t.exports=i.extend({},r,{init:function(t){i.bindAll(this,"startDraw","draw","endDraw","rollback"),this.config=t||{},this.hType=this.config.newFixedH?"height":"min-height",this.allowDraw=1},enable:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.enable.apply(this,e),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 e=t?"on":"off";this.$wr[e]("mousemove",this.draw),this.$wr[e]("mouseup",this.endDraw),this.$canvas[e]("mousemove",this.draw),o(document)[e]("mouseup",this.endDraw),o(document)[e]("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 n=this.sorter.lastPos;e=this.create(this.sorter.target,this.tempComponent,n.index,n.method),this.sorter.prevTarget=null}this.ghost.style.display="none",this.startSelectPosition(),this.afterDraw(e)},create:function(t,e,n,i,r){n="after"===i?n+1:n;var s=r||{},a=o(t),l=a.data("model"),c=a.data("collection"),u=l?l.get("droppable"):1;if(s.at=n,c&&u)return c.add(e,s)},setRequirements:function(t){var e=this.config,n=t.style;n.width.replace(/\D/g,"")<e.minComponentW&&(n.width=e.minComponentW+"px"),n[this.hType].replace(/\D/g,"")<e.minComponentH&&(n[this.hType]=e.minComponentH+"px"),e.newFixedH&&(n.overflow="auto"),this.absoluteMode?n.position="absolute":(delete n.left,delete n.top);var i=this.sorter.lastPos;return this.nearFloat(i.index,i.method,this.sorter.lastDims)&&(n["float"]="left"),this.config.firstCentered&&this.getCanvasWrapper()==this.sorter.target&&(n.margin="0 auto"),t},updateComponentSize:function(t){var e=t.pageY+this.frameOff.top,n=t.pageX+this.frameOff.left,i=this.startPos,r=i.top,o=i.left,s=e-r,a=n-o;n<o&&(o=n,a=i.left-n),e<r&&(r=e,s=i.top-e),this.updateSize(r,o,a,s)},updateSize:function(t,e,n,i){var r="px",o=this.ghost.style,s=this.tempComponent.style;o.top=s.top=t+r,o.left=s.left=e+r,o.width=s.width=n+r,o[this.hType]=s[this.hType]=i+r},rollback:function(t,e){var n=t.which||t.keyCode;(n==this.config.ESCAPE_KEY||e)&&(this.isDragged=!1,this.endDraw())},beforeDraw:function(t){t.editable=!1},afterDraw:function(t){},run:function(t,e,n){this.editor=t,this.sender=e,this.$wr=this.$wrapper,this.enable()},stop:function(){this.stopSelectPosition(),this.$wrapper.css("cursor",""),this.$wrapper.unbind()}})}).call(e,n(0),n(1))},function(t,e,n){!function(e){function n(t,e){for(var n=t.length;n--;)if(t[n]===e)return n;return-1}function i(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function r(t){for(x in C)C[x]=t[P[x]]}function o(t){var e,i,o,s,a,c;if(e=t.keyCode,n(M,e)==-1&&M.push(e),93!=e&&224!=e||(e=91),e in C){C[e]=!0;for(o in S)S[o]==e&&(l[o]=!0)}else if(r(t),l.filter.call(this,t)&&e in w)for(c=p(),s=0;s<w[e].length;s++)if(i=w[e][s],i.scope==c||"all"==i.scope){a=i.mods.length>0;for(o in C)(!C[o]&&n(i.mods,+o)>-1||C[o]&&n(i.mods,+o)==-1)&&(a=!1);(0!=i.mods.length||C[16]||C[18]||C[17]||C[91])&&!a||i.method(t,i)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function s(t){var e,i=t.keyCode,r=n(M,i);if(r>=0&&M.splice(r,1),93!=i&&224!=i||(i=91),i in C){C[i]=!1;for(e in S)S[e]==i&&(l[e]=!1)}}function a(){for(x in C)C[x]=!1;for(x in S)l[x]=!1}function l(t,e,n){var i,r;i=v(t),void 0===n&&(n=e,e="all");for(var o=0;o<i.length;o++)r=[],t=i[o].split("+"),t.length>1&&(r=m(t),t=[t[t.length-1]]),t=t[0],t=E(t),t in w||(w[t]=[]),w[t].push({shortcut:i[o],scope:e,method:n,key:i[o],mods:r})}function c(t,e){var n,r,o,s,a,l=[];for(n=v(t),s=0;s<n.length;s++){if(r=n[s].split("+"),r.length>1&&(l=m(r),t=r[r.length-1]),t=E(t),void 0===e&&(e=p()),!w[t])return;for(o=0;o<w[t].length;o++)a=w[t][o],a.scope===e&&i(a.mods,l)&&(w[t][o]={})}}function u(t){return"string"==typeof t&&(t=E(t)),n(M,t)!=-1}function h(){return M.slice(0)}function d(t){var e=(t.target||t.srcElement).tagName;return!("INPUT"==e||"SELECT"==e||"TEXTAREA"==e)}function f(t){k=t||"all"}function p(){return k||"all"}function g(t){var e,n,i;for(e in w)for(n=w[e],i=0;i<n.length;)n[i].scope===t?n.splice(i,1):i++}function v(t){var e;return t=t.replace(/\s/g,""),e=t.split(","),""==e[e.length-1]&&(e[e.length-2]+=","),e}function m(t){for(var e=t.slice(0,t.length-1),n=0;n<e.length;n++)e[n]=S[e[n]];return e}function y(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,function(){n(window.event)})}function b(){var t=e.key;return e.key=A,t}var x,w={},C={16:!1,18:!1,17:!1,91:!1},k="all",S={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},T={backspace:8,tab:9,clear:12,enter:13,"return":13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,"delete":46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220},E=function(t){return T[t]||t.toUpperCase().charCodeAt(0)},M=[];for(x=1;x<20;x++)T["f"+x]=111+x;var P={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(x in S)l[x]=!1;y(document,"keydown",function(t){o(t)}),y(document,"keyup",s),y(window,"focus",a);var A=e.key;e.key=l,e.key.setScope=f,e.key.getScope=p,e.key.deleteScope=g,e.key.filter=d,e.key.isPressed=u,e.key.getPressedKeyCodes=h,e.key.noConflict=b,e.key.unbind=c,t.exports=l}(this)},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(75),o=i(r);window.Promise=window.Promise||o["default"],e["default"]="function"==typeof fetch?fetch.bind():function(t,e){return new o["default"](function(n,i){var r=new XMLHttpRequest;r.open(e.method||"get",t),r.withCredentials="include"==e.credentials;for(var s in e.headers||{})r.setRequestHeader(s,e.headers[s]);r.onload=function(t){return n({status:r.status,statusText:r.statusText,text:function(){return o["default"].resolve(r.responseText)}})},r.onerror=i,r.upload&&e.onProgress&&(r.upload.onprogress=e.onProgress),e.body?r.send(e.body):r.send()})}},function(t,e,n){"use strict";t.exports=function(t){var e=t,n="data-gjs-";return{compTypes:"",parseStyle:function(t){for(var e={},n=t.split(";"),i=0,r=n.length;i<r;i++){var o=n[i].trim();if(o){var s=o.split(":");e[s[0].trim()]=s.slice(1).join(":").trim()}}return e},parseClass:function(t){for(var n=[],i=t.split(" "),r=0,o=i.length;r<o;r++){var s=i[r].trim(),a=new RegExp("^"+e.pStylePrefix);s&&!a.test(s)&&n.push(s)}return n},parseNode:function(t){for(var i=[],r=t.childNodes,o=0,s=r.length;o<s;o++){var a=r[o],l=a.attributes||[],c=l.length,u=i[i.length-1],h=a.childNodes.length,d=this.compTypes,f={};if(d){for(var p="",g=0;g<d.length&&!(p=d[g].model.isComponent(a));g++);f=p}f.tagName||(f.tagName=a.tagName?a.tagName.toLowerCase():""),c&&(f.attributes={});for(var v=0;v<c;v++){var m=l[v].nodeName,y=l[v].nodeValue;if("style"==m)f.style=this.parseStyle(y);else if("class"==m)f.classes=this.parseClass(y);else{if("contenteditable"==m)continue;if(0===m.indexOf(n)){var b=m.replace(n,""),x=y.length,w=y&&y.substr(0,1),C=y&&y.substr(x-1);y="true"===y||y,y="false"!==y&&y;try{y="{"==w&&"}"==C||"["==w&&"]"==C?JSON.parse(y):y}catch(k){}f[b]=y}else f.attributes[m]=y}}if(h&&!f.components){var S=a.childNodes[0];1===h&&3===S.nodeType?(!f.type&&(f.type="text"),f.content=S.nodeValue):f.components=this.parseNode(a)}if("textnode"==f.type){if(u&&"textnode"==u.type){u.content+=f.content;continue}var T=a.nodeValue;if(" "!=T&&!T.trim())continue}var E=f.components;if(!f.type&&E){for(var M=1,P=0,A=0;A<E.length;A++){var O=E[A],L=O.type;if(["text","textnode"].indexOf(L)<0&&e.textTags.indexOf(O.tagName)<0){M=0;break}"textnode"==L&&(P=1)}M&&P&&(f.type="text")}(f.tagName||"textnode"==f.type)&&i.push(f)}return i},parse:function(t,n){var i=e.em&&e.em.get("Config")||{},r={html:"",css:""},o=document.createElement("div");o.innerHTML=t;var s=o.querySelectorAll("script"),a=s.length;if(!i.allowScripts)for(;a--;)s[a].parentNode.removeChild(s[a]);if(n){for(var l="",c=o.querySelectorAll("style"),u=c.length;u--;)l=c[u].innerHTML+l,c[u].parentNode.removeChild(c[u]);l&&(r.css=n.parse(l))}var h=this.parseNode(o);return 1==h.length&&(h=h[0]),r.html=h,r}}}},function(t,e,n){!function(t){t(n(6))}(function(t){"use strict";function e(t){for(var e={},n=0;n<t.length;++n)e[t[n].toLowerCase()]=!0;return e}function n(t,e){for(var n,i=!1;null!=(n=t.next());){if(i&&"/"==n){e.tokenize=null;break}i="*"==n}return["comment","comment"]}t.defineMode("css",function(e,n){function i(t,e){return p=e,t}function r(t,e){var n=t.next();if(m[n]){var r=m[n](t,e);if(r!==!1)return r}return"@"==n?(t.eatWhile(/[\w\\\-]/),i("def",t.current())):"="==n||("~"==n||"|"==n)&&t.eat("=")?i(null,"compare"):'"'==n||"'"==n?(e.tokenize=o(n),e.tokenize(t,e)):"#"==n?(t.eatWhile(/[\w\\\-]/),i("atom","hash")):"!"==n?(t.match(/^\s*\w*/),i("keyword","important")):/\d/.test(n)||"."==n&&t.eat(/\d/)?(t.eatWhile(/[\w.%]/),i("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?i(null,"select-op"):"."==n&&t.match(/^-?[_a-z][_a-z0-9-]*/i)?i("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?i(null,n):"u"==n&&t.match(/rl(-prefix)?\(/)||"d"==n&&t.match("omain(")||"r"==n&&t.match("egexp(")?(t.backUp(1),e.tokenize=s,i("property","word")):/[\w\\\-]/.test(n)?(t.eatWhile(/[\w\\\-]/),i("property","word")):i(null,null):/[\d.]/.test(t.peek())?(t.eatWhile(/[\w.%]/),i("number","unit")):t.match(/^-[\w\\\-]+/)?(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?i("variable-2","variable-definition"):i("variable-2","variable")):t.match(/^\w+-/)?i("meta","meta"):void 0}function o(t){return function(e,n){for(var r,o=!1;null!=(r=e.next());){if(r==t&&!o){")"==t&&e.backUp(1);break}o=!o&&"\\"==r}return(r==t||!o&&")"!=t)&&(n.tokenize=null),i("string","string")}}function s(t,e){return t.next(),t.match(/\s*[\"\')]/,!1)?e.tokenize=null:e.tokenize=o(")"),i(null,"(")}function a(t,e,n){this.type=t,this.indent=e,this.prev=n}function l(t,e,n,i){return t.context=new a(n,e.indentation()+(i===!1?0:v),t.context),n}function c(t){return t.context.prev&&(t.context=t.context.prev),t.context.type}function u(t,e,n){return L[n.context.type](t,e,n)}function h(t,e,n,i){for(var r=i||1;r>0;r--)n.context=n.context.prev;return u(t,e,n)}function d(t){var e=t.current().toLowerCase();g=M.hasOwnProperty(e)?"atom":E.hasOwnProperty(e)?"keyword":"variable"}var f=n.inline;n.propertyKeywords||(n=t.resolveMode("text/css"));var p,g,v=e.indentUnit,m=n.tokenHooks,y=n.documentTypes||{},b=n.mediaTypes||{},x=n.mediaFeatures||{},w=n.mediaValueKeywords||{},C=n.propertyKeywords||{},k=n.nonStandardPropertyKeywords||{},S=n.fontProperties||{},T=n.counterDescriptors||{},E=n.colorKeywords||{},M=n.valueKeywords||{},P=n.allowNested,A=n.lineComment,O=n.supportsAtComponent===!0,L={};return L.top=function(t,e,n){if("{"==t)return l(n,e,"block");if("}"==t&&n.context.prev)return c(n);if(O&&/@component/.test(t))return l(n,e,"atComponentBlock");if(/^@(-moz-)?document$/.test(t))return l(n,e,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(t))return l(n,e,"atBlock");if(/^@(font-face|counter-style)/.test(t))return n.stateArg=t,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(t))return"keyframes";if(t&&"@"==t.charAt(0))return l(n,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(n,e,"interpolation");if(":"==t)return"pseudo";if(P&&"("==t)return l(n,e,"parens")}return n.context.type},L.block=function(t,e,n){if("word"==t){var i=e.current().toLowerCase();return C.hasOwnProperty(i)?(g="property","maybeprop"):k.hasOwnProperty(i)?(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?L.top(t,e,n):(g="error","block")},L.maybeprop=function(t,e,n){return":"==t?l(n,e,"prop"):u(t,e,n)},L.prop=function(t,e,n){if(";"==t)return c(n);if("{"==t&&P)return l(n,e,"propBlock");if("}"==t||"{"==t)return h(t,e,n);if("("==t)return l(n,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(n,e,"interpolation")}else g+=" error";return"prop"},L.propBlock=function(t,e,n){return"}"==t?c(n):"word"==t?(g="property","maybeprop"):n.context.type},L.parens=function(t,e,n){return"{"==t||"}"==t?h(t,e,n):")"==t?c(n):"("==t?l(n,e,"parens"):"interpolation"==t?l(n,e,"interpolation"):("word"==t&&d(e),"parens")},L.pseudo=function(t,e,n){return"meta"==t?"pseudo":"word"==t?(g="variable-3",n.context.type):u(t,e,n)},L.documentTypes=function(t,e,n){return"word"==t&&y.hasOwnProperty(e.current())?(g="tag",n.context.type):L.atBlock(t,e,n)},L.atBlock=function(t,e,n){if("("==t)return l(n,e,"atBlock_parens");if("}"==t||";"==t)return h(t,e,n);if("{"==t)return c(n)&&l(n,e,P?"block":"top");if("interpolation"==t)return l(n,e,"interpolation");if("word"==t){var i=e.current().toLowerCase();g="only"==i||"not"==i||"and"==i||"or"==i?"keyword":b.hasOwnProperty(i)?"attribute":x.hasOwnProperty(i)?"property":w.hasOwnProperty(i)?"keyword":C.hasOwnProperty(i)?"property":k.hasOwnProperty(i)?"string-2":M.hasOwnProperty(i)?"atom":E.hasOwnProperty(i)?"keyword":"error"}return n.context.type},L.atComponentBlock=function(t,e,n){return"}"==t?h(t,e,n):"{"==t?c(n)&&l(n,e,P?"block":"top",!1):("word"==t&&(g="error"),n.context.type)},L.atBlock_parens=function(t,e,n){return")"==t?c(n):"{"==t||"}"==t?h(t,e,n,2):L.atBlock(t,e,n)},L.restricted_atBlock_before=function(t,e,n){return"{"==t?l(n,e,"restricted_atBlock"):"word"==t&&"@counter-style"==n.stateArg?(g="variable","restricted_atBlock_before"):u(t,e,n)},L.restricted_atBlock=function(t,e,n){return"}"==t?(n.stateArg=null,c(n)):"word"==t?(g="@font-face"==n.stateArg&&!S.hasOwnProperty(e.current().toLowerCase())||"@counter-style"==n.stateArg&&!T.hasOwnProperty(e.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},L.keyframes=function(t,e,n){return"word"==t?(g="variable","keyframes"):"{"==t?l(n,e,"top"):u(t,e,n)},L.at=function(t,e,n){return";"==t?c(n):"{"==t||"}"==t?h(t,e,n):("word"==t?g="tag":"hash"==t&&(g="builtin"),"at")},L.interpolation=function(t,e,n){return"}"==t?c(n):"{"==t||";"==t?h(t,e,n):("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 n=(e.tokenize||r)(t,e);return n&&"object"==typeof n&&(p=n[1],n=n[0]),g=n,"comment"!=p&&(e.state=L[e.state](p,t,e)),g},indent:function(t,e){var n=t.context,i=e&&e.charAt(0),r=n.indent;return"prop"!=n.type||"}"!=i&&")"!=i||(n=n.prev),n.prev&&("}"!=i||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type?(")"!=i||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=i||"at"!=n.type&&"atBlock"!=n.type)||(r=Math.max(0,n.indent-v)):(n=n.prev,r=n.indent)),r},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:A,fold:"brace"}});var i=["domain","regexp","url","url-prefix"],r=e(i),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],s=e(o),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","caret-color","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","justify-items","justify-self","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","place-content","place-items","place-self","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","will-change","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"],v=e(g),m=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=e(m),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","auto-flow","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","contents","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","opacity","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","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","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","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","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","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","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=i.concat(o).concat(a).concat(c).concat(h).concat(f).concat(b).concat(w);
t.registerHelper("hintWords","css",k),t.defineMIME("text/css",{documentTypes:r,mediaTypes:s,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,fontProperties:v,counterDescriptors:y,colorKeywords:x,valueKeywords:C,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=n,n(t,e))}},name:"css"}),t.defineMIME("text/x-scss",{mediaTypes:s,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,colorKeywords:x,valueKeywords:C,fontProperties:v,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=n,n(t,e)):["operator","operator"]},":":function(t){return!!t.match(/\s*\{/,!1)&&[null,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:s,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:p,colorKeywords:x,valueKeywords:C,fontProperties:v,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=n,n(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:s,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:p,fontProperties:v,counterDescriptors:y,colorKeywords:x,valueKeywords:C,supportsAtComponent:!0,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=n,n(t,e))}},name:"css",helperType:"gss"})})},function(t,e,n){"use strict";var i=n(0),r=n(28);t.exports=i.Model.extend({defaults:{id:"",content:"",visible:!0,buttons:[],attributes:{}},initialize:function(t){this.btn=this.get("buttons")||[],this.buttons=new r(this.btn),this.set("buttons",this.buttons)}})},function(t,e,n){"use strict";var i=n(0),r=n(109);t.exports=i.Collection.extend({model:r,deactivateAllExceptOne:function(t,e){this.forEach(function(n,i){n!==t&&(n.set("active",!1),e&&n.get("buttons").length&&n.get("buttons").deactivateAllExceptOne(t,e))})},deactivateAll:function(t){var e=t||"";this.forEach(function(t,n){t.get("context")==e&&(t.set("active",!1),t.get("buttons").length&&t.get("buttons").deactivateAll(e))})},disableAllButtons:function(t){var e=t||"";this.forEach(function(t,n){t.get("context")==e&&(t.set("disable",!0),t.get("buttons").length&&t.get("buttons").disableAllButtons(e))})},disableAllButtonsExceptOne:function(t,e){this.forEach(function(n,i){n!==t&&(n.set("disable",!0),e&&n.get("buttons").length&&n.get("buttons").disableAllButtonsExceptOne(t,e))})}})},function(t,e,n){"use strict";var i=n(0),r=n(30);t.exports=i.View.extend({initialize:function(t){var e=t.config||{};this.config=e,this.pfx=e.stylePrefix||"",this.ppfx=e.pStylePrefix||"",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"))},attributes:function(){return this.model.get("attributes")},initResize:function(){var t=this.config.em,e=t?t.get("Editor"):"",n=this.model.get("resizable");if(e&&n){var i,r,o,s=n===!0?[1,1,1,1]:n,a=s.length,l=0;2==a?(i=s[0],o=s[0],r=s[1],l=s[1]):4==a&&(i=s[0],r=s[1],o=s[2],l=s[3]);var c=e.Utils.Resizer.init({tc:i,cr:r,bc:o,cl:l,tl:0,tr:0,bl:0,br:0,appendTo:this.el,prefix:e.getConfig().stylePrefix,posFetcher:function(t){var e=t.getBoundingClientRect();return{left:0,top:0,width:e.width,height:e.height}}});c.blur=function(){},c.focus(this.el)}},render:function(){var t=this.$el,e=this.ppfx;if(t.attr("class",this.className+" "+e+"one-bg"),this.id&&t.attr("id",this.id),this.buttons.length){var n=new r({collection:this.buttons,config:this.config});t.append(n.render().el)}return t.append(this.model.get("content")),this}})},function(t,e,n){"use strict";(function(e){var i=n(0),r=n(111);t.exports=i.View.extend({initialize:function(t){this.opt=t||{},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(t){this.addToCollection(t)},addToCollection:function(t,e){var n=e||null,i=r,o=new i({model:t,config:this.config,parentM:this.parentM}),s=o.render().el;return n?n.appendChild(s):this.$el.append(s),s},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",e.result(this,"className")),this}})}).call(e,n(1))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};t.exports=function(){var t,e,r={},o=n(116),s=n(117),a=n(11),l=n(128),c=void 0;return{name:"StyleManager",getConfig:function(){return r},init:function(n){r=n||{};for(var i in o)i in r||(r[i]=o[i]);var u=r.pStylePrefix;return u&&(r.stylePrefix=u+r.stylePrefix),c=new a,t=new s(r.sectors,r),e=new l({collection:t,target:r.em,config:r}),this},addSector:function(e,n){var i=this.getSector(e);return i||(n.id=e,i=t.add(n)),i},getSector:function(e){var n=t.where({id:e});return n.length?n[0]:null},removeSector:function(t){return this.getSectors().remove(this.getSector(t))},getSectors:function(){return t},addProperty:function(t,e){var n=null,i=this.getSector(t);return i&&(n=i.get("properties").add(e)),n},getProperty:function(t,e){var n=null,i=this.getSector(t);return i&&(n=i.get("properties").where({property:e}),n=1==n.length?n[0]:n),n},removeProperty:function(t,e){var n=this.getProperties(t);return n&&n.remove(this.getProperty(t,e))},getProperties:function(t){var e=null,n=this.getSector(t);return n&&(e=n.get("properties")),e},getModelToStyle:function(t){var e=r.em,n=t.get("classes"),i=t.getId();if(e){var o=e.getConfig(),s=e.get("UndoManager"),a=e.get("CssComposer"),l=o.devicePreviewMode?"":t.get("state"),c=n.getStyleable(),u=c.length,h={state:l},d=void 0;if(u){var f=e.getCurrentMedia();d=a.get(c,l,f),d||(s.stop(),d=a.add(c,l,f),d.setStyle(t.getStyle()),t.setStyle({}),s.start())}else o.avoidInlineStyle&&(d=a.getIdRule(i,h),!d&&(d=a.setIdRule(i,{},h)));d&&(t=d)}return t},addType:function(t,e){c.addType(t,e)},getType:function(t){return c.getType(t)},getTypes:function(){return c.getTypes()},createType:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.model,o=void 0===n?{}:n,s=e.view,a=void 0===s?{}:s,l=this.getType(t);if(l)return new l.view(i({model:new l.model(o),config:r},a))},render:function(){return e.render().el}}}},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n=t.Model,i=t.View;e["default"]={types:[],initialize:function(t,e){var n=this;this.model=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=void 0,r=void 0,o=void 0;if(t&&t.type){var s=n.getBaseType();o=n.getType(t.type),i=o?o.model:s.model,r=o?o.view:s.view}else{var a=n.recognizeType(t);o=a.type,i=o.model,r=o.view,t=a.attributes}var l=new i(t,e);return l.typeView=r,l};var i=this.init&&this.init.bind(this);i&&i()},recognizeType:function(t){for(var e=this.getTypes(),n=0;n<e.length;n++){var i=e[n],r=i.isType(t);if(r="boolean"==typeof r&&r?{type:i.id}:r)return{type:i,attributes:r}}return{type:this.getBaseType(),attributes:t}},getBaseType:function(){var t=this.getTypes();return t[t.length-1]},getTypes:function(){return this.types},getType:function(t){for(var e=this.getTypes(),n=0;n<e.length;n++){var i=e[n];if(i.id===t)return i}},addType:function(t,e){var r=this.getType(t),o=this.getBaseType(),s=r?r.model:o.model,a=r?r.view:o.view,l=e.model,c=e.view,u=e.isType;l=l instanceof n?l:s.extend(l||{}),c=c instanceof i?c:a.extend(c||{}),r?(r.model=l,r.view=c,r.isType=u||r.isType):(e.id=t,e.model=l,e.view=c,e.isType=u||function(e){if(e&&e.type==t)return!0},this.getTypes().unshift(e))}}}).call(e,n(0))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(12);t.exports=r.extend({defaults:i({},r.prototype.defaults,{detached:0,properties:[],separator:" "}),init:function(){var t=this.get("properties")||[],e=n(11);this.set("properties",new e(t)),this.listenTo(this,"change:value",this.updateValues)},updateValues:function(){var t=this.get("value").split(this.get("separator"));this.get("properties").each(function(e,n){var i=t.length;t[n]||t[n%i+(1!=i&&i%2?1:0)]})},getDefaultValue:function(t){var e=this.get("defaults");if(e&&!t)return e;e="";var n=this.get("properties");return n.each(function(t,n){return e+=t.getDefaultValue()+" "}),e.trim()},getFullValue:function(){return this.get("detached")?"":this.get("properties").getFullValue()}})},function(t,e,n){"use strict";var i=n(17),r=n(123);t.exports=i.extend({templateInput:function(){var t=this.pfx;this.ppfx;return'\n <div class="'+t+"field "+t+'stack">\n <button type="button" id="'+t+'add" data-add-layer>+</button>\n <div data-layers-wrapper></div>\n </div>\n '},init:function(){var t=this.model;this.pfx;t.set("stackIndex",null),this.events["click [data-add-layer]"]="addLayer",this.listenTo(t,"change:stackIndex",this.indexChanged),this.listenTo(t,"updateValue",this.inputValueChanged),this.delegateEvents()},targetUpdated:function(){if(this.model.get("detached"))this.checkVisibility();else{for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.prototype.targetUpdated.apply(this,e)}this.refreshLayers()},getLayers:function(){return this.model.get("layers")},indexChanged:function(t){var e=this.model;this.getLayers().active(e.get("stackIndex"))},addLayer:function(){var t=this.model,e=this.getLayers(),n=t.get("properties").deepClone();n.each(function(t){return t.set("value","")});var i=e.add({properties:n});this.inputValueChanged(),t.set("stackIndex",e.indexOf(i))},inputValueChanged:function(){var t=this.model;this.elementUpdated(),t.get("detached")?t.get("properties").each(function(t){return t.trigger("change:value")}):t.set("value",this.getLayerValues())},setValue:function(){},getLayerValues:function(){return this.getLayers().getFullValue()},refreshLayers:function(){var t=[],e=this.model,n=this.getLayers(),i=e.get("detached");if(i){var r=this.getTarget(),o=r?r.getStyle():{};t=n.getLayersFromStyle(o)}else{var s=this.getTargetValue();s=s==e.getDefaultValue()?"":s,t=n.getLayersFromValue(s)}n.reset(),n.add(t),e.set({stackIndex:null},{silent:!0})},onRender:function(){var t=this,e=this.model,i=this.el.querySelector("[data-layers-wrapper]"),o=n(13),s={target:this.target,propTarget:this.propTarget,onChange:function(n,i,r){var o=i.model;if(e.get("detached")){var s=o.get("property"),a=t.getLayers().getPropertyValues(s);i.updateTargetStyle(a,null,r)}else e.set("value",e.getFullValue(),r)}},a=new r({collection:this.getLayers(),stackModel:e,preview:e.get("preview"),config:this.config,propsConfig:s}).render().el;new o({target:this.target,collection:this.model.get("properties"),stackModel:e,config:this.config,onChange:s.onChange,propTarget:s.propTarget,customValue:s.customValue}).render(),i.appendChild(a)}})},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports=e.View.extend({events:{change:"handleChange"},template:function(){return'<span class="'+this.holderClass()+'"></span>'},inputClass:function(){return this.ppfx+"field"},holderClass:function(){return this.ppfx+"input-holder"},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.ppfx||"";this.opts=t,this.ppfx=e,this.em=t.target||{},this.listenTo(this.model,"change:value",this.handleModelChange)},elementUpdated:function(){this.model.trigger("el:change")},setValue:function(t){var e=this.model,n=t||e.get("defaults"),i=this.getInputEl();i&&(i.value=n)},handleModelChange:function(t,e,n){this.setValue(e,n)},handleChange:function(t){t.stopPropagation(),this.model.set("value",this.getInputEl().value),this.elementUpdated()},getInputEl:function(){if(!this.inputEl){var t=this.model.get("defaults");this.inputEl=n('<input type="text" placeholder="'+t+'">')}return this.inputEl.get(0)},render:function(){var t=this.$el;return t.addClass(this.inputClass()),t.html(this.template()),t.find("."+this.holderClass()).append(this.getInputEl()),this}})}).call(e,n(0))},function(t,e,n){"use strict";t.exports=n(5).extend({templateInput:function(){var t=(this.pfx,this.ppfx);return'\n <div class="'+t+"field "+t+'field-radio">\n </div>\n '},onRender:function(){var t=this.pfx,e=this.ppfx,n=e+"radio-item-label",i=this.model,r=i.get("property"),o=i.get("list")||i.get("options")||[];if(!this.input&&o&&o.length){var s="";o.forEach(function(i){var o=i.className?i.className+" "+t+"icon "+n:"",a=r+"-"+i.value,l=i.name||i.value,c=i.title?'title="'+i.title+'"':"";s+='\n <div class="'+e+'radio-item">\n <input type="radio" class="'+t+'radio" id="'+a+'" name="'+r+'" value="'+i.value+'"/>\n <label class="'+(o||n)+'" '+c+' for="'+a+'">'+(o?"":l)+"</label>\n </div>\n "});var a=this.el.querySelector("."+e+"field");a.innerHTML='<div class="'+e+'radio-items">'+s+"</div>",this.input=a.firstChild}},getInputValue:function(){var t=this.getCheckedEl();return t?t.value:""},getCheckedEl:function(){var t=this.getInputEl();return t?t.querySelector("input:checked"):""},setValue:function(t){var e=this.model,n=t||e.get("value")||e.getDefaultValue(),i=this.getInputEl(),r=i?i.querySelector('[value="'+n+'"]'):"";if(r)r.checked=!0;else{var o=this.getCheckedEl();o&&(o.checked=!1)}}})},function(t,e,n){"use strict";(function(e){e.$;t.exports=n(5).extend({templateInput:function(){var t=this.pfx,e=this.ppfx;return'\n <div class="'+e+"field "+e+'select">\n <span id="'+t+'input-holder"></span>\n <div class="'+e+'sel-arrow">\n <div class="'+e+'d-s-arrow"></div>\n </div>\n </div>\n '},onRender:function(){var t=this.pfx,e=this.model,n=e.get("list")||e.get("options")||[];if(!this.input){var i="";n.forEach(function(t){var e=t.name||t.value,n=t.style?t.style.replace(/"/g,"&quot;"):"",r=n?'style="'+n+'"':"",o=t.value.replace(/"/g,"&quot;");i+='<option value="'+o+'" '+r+">"+e+"</option>"});var r=this.el.querySelector("#"+t+"input-holder");r.innerHTML="<select>"+i+"</select>",this.input=r.firstChild}}})}).call(e,n(0))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(39);t.exports=n(14).extend({setValue:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=i({},e,{silent:1}),this.inputInst.setValue(t,e)},onRender:function(){if(!this.input){var t=this.ppfx,e=new r({target:this.target,model:this.model,ppfx:t}),n=e.render();this.el.querySelector("."+t+"fields").appendChild(n.el),this.$input=n.inputEl,this.$color=n.colorEl,this.input=this.$input.get(0),this.inputInst=n}}})},function(t,e,n){"use strict";(function(e){var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};n(122);var r=n(35),o=e.$;t.exports=r.extend({template:function(){var t=this.ppfx;return'\n <div class="'+this.holderClass()+'"></div>\n <div class="'+t+'field-colorp">\n <div class="'+t+'field-colorp-c" data-colorp-c>\n <div class="'+t+'checker-bg"></div>\n </div>\n </div>\n '},inputClass:function(){var t=this.ppfx;return t+"field "+t+"field-color"},holderClass:function(){return this.ppfx+"input-holder"},setValue:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.model,i=t||n.get("defaults"),r=this.getInputEl(),o=this.getColorEl(),s="none"!=i?i:"";r.value=i,o.get(0).style.backgroundColor=s,e.fromTarget&&(o.spectrum("set",s),this.noneColor="none"==i)},getColorEl:function(){if(!this.colorEl){var t=this,e=this.ppfx,n=this.model,r=o('<div class="'+this.ppfx+'field-color-picker"></div>'),s=r.get(0).style,a=this.em&&this.em.config?this.em.config.el:"",l=this.em&&this.em.getConfig&&this.em.getConfig("colorPicker")||{},c=function(t){var e=1==t.getAlpha()?t.toHexString():t.toRgbString();return e.replace(/ /g,"")},u=0,h=void 0;this.$el.find("[data-colorp-c]").append(r),r.spectrum(i({containerClassName:e+"one-bg "+e+"two-color",appendTo:a||"body",maxSelectionSize:8,showPalette:!0,showAlpha:!0,chooseText:"Ok",cancelText:"",palette:[]},l,{move:function(t){var e=c(t);s.backgroundColor=e,n.setValueFromInput(e,0)},change:function(e){u=1;var i=c(e);s.backgroundColor=i,n.setValueFromInput(i),t.noneColor=0},show:function(t){u=0,h=c(t)},hide:function(e){!u&&h&&(t.noneColor&&(h=""),s.backgroundColor=h,r.spectrum("set",h),n.setValueFromInput(h,0))}})),this.colorEl=r}return this.colorEl},render:function(){return r.prototype.render.call(this),this.getColorEl(),this}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=n(5),r=e.$;t.exports=i.extend({templateInput:function(){var t=this.pfx,e=(this.ppfx,this.config.assetsLabel||"Images");return'\n <div class="'+t+"field "+t+"file\">\n <div id='"+t+"input-holder'>\n <div class=\""+t+'btn-c">\n <button class="'+t+'btn" id="'+t+'images" type="button">\n '+e+'\n </button>\n </div>\n <div style="clear:both;"></div>\n </div>\n <div id="'+t+'preview-box">\n <div id="'+t+'preview-file"></div>\n <div id="'+t+'close">&Cross;</div>\n </div>\n </div>\n '},init:function(){var t=this.em;this.modal=t.get("Modal"),this.am=t.get("AssetManager"),this.events["click #"+this.pfx+"close"]="removeFile",this.events["click #"+this.pfx+"images"]="openAssetManager",this.delegateEvents()},onRender:function(){if(!this.$input){var t=this.model.getDefaultValue();this.$input=r('<input placeholder="'+t+'">')}this.$preview||(this.$preview=this.$el.find("#"+this.pfx+"preview-file")),this.$previewBox||(this.$previewBox=this.$el.find("#"+this.pfx+"preview-box")),this.setValue(this.componentValue,0)},setValue:function(t,e){i.prototype.setValue.apply(this,arguments),this.setPreviewView(t&&t!=this.model.getDefaultValue()),this.setPreview(t)},setPreviewView:function(t){var e=this.$previewBox;e&&e[t?"addClass":"removeClass"](this.pfx+"show")},spreadUrl:function(t){this.model.set("value",t),this.setPreviewView(1)},setPreview:function(t){var e=this.$preview;t=t&&t.indexOf("url(")<0?"url("+t+")":t,e&&e.css("background-image",t)},cleanValue:function(){this.setPreviewView(0),this.model.set({value:""},{silent:!0})},removeFile:function(){this.model.set("value",this.model.getDefaultValue());for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.prototype.cleanValue.apply(this,e),this.setPreviewView(0)},openAssetManager:function(t){var e=this,n=this.em,i=n?n.get("Editor"):"";i&&(this.modal.setTitle("Select image"),this.modal.setContent(this.am.getContainer()),this.am.setTarget(null),i.runCommand("open-assets",{target:this.model,onSelect:function(t){e.modal.close(),e.spreadUrl(t.get("src"))}}))}})}).call(e,n(0))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(12);t.exports=r.extend({defaults:i({},r.prototype.defaults,{options:[]})})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(12),o=n(18);t.exports=r.extend({defaults:i({},r.prototype.defaults,{units:[],unit:"",step:1,min:"",max:""}),init:function(){var t=this.get("unit"),e=this.get("units");this.input=new o({model:this}),e.length&&!t&&this.set("unit",e[0])},parseValue:function(t){var e=r.prototype.parseValue.apply(this,arguments),n=this.input.validateInputValue(e.value,{deepCheck:1}),i=n.value,o=n.unit;return e.value=i,e.unit=o,e},getFullValue:function(){var t=this.get("value")+this.get("unit");return r.prototype.getFullValue.apply(this,[t])}})},function(t,e,n){"use strict";t.exports=n(44).extend({events:{"click [data-toggle=asset-remove]":"onRemove",click:"onClick",dblclick:"onDblClick"},getPreview:function(){var t=this.pfx,e=this.model.get("src");return'\n <div class="'+t+'preview" style="background-image: url(\''+e+'\');"></div>\n <div class="'+t+"preview-bg "+this.ppfx+'checker-bg"></div>\n '},getInfo:function(){var t=this.pfx,e=this.model,n=e.get("name"),i=e.get("width"),r=e.get("height"),o=e.get("unitDim"),s=i&&r?i+"x"+r+o:"";return n=n||e.getFilename(),'\n <div class="'+t+'name">'+n+'</div>\n <div class="'+t+'dimensions">'+s+"</div>\n "},init:function(t){var e=this.pfx;this.className+=" "+e+"asset-image"},onClick:function i(){var i=this.config.onClick,t=this.model;this.collection.trigger("deselectAll"),this.$el.addClass(this.pfx+"highlight"),"function"==typeof i?i(t):this.updateTarget(this.collection.target)},onDblClick:function r(){var t=this.em,r=this.config.onDblClick,e=this.model;"function"==typeof r?r(e):(this.updateTarget(this.collection.target),t&&t.get("Modal").close());var n=this.collection.onSelect;"function"==typeof n&&n(this.model)},onRemove:function(t){t.stopImmediatePropagation(),this.model.collection.remove(this.model)}})},function(t,e,n){"use strict";(function(e,n){t.exports=e.View.extend({initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t,this.collection=t.collection;var e=t.config||{};this.config=e,this.pfx=e.stylePrefix||"",this.ppfx=e.pStylePrefix||"",this.em=e.em,this.className=this.pfx+"asset",this.listenTo(this.model,"destroy remove",this.remove),this.model.view=this;var n=this.init&&this.init.bind(this);n&&n(t)},template:function(){var t=this.pfx;return'\n <div class="'+t+'preview-cont">\n '+this.getPreview()+'\n </div>\n <div class="'+t+'meta">\n '+this.getInfo()+'\n </div>\n <div class="'+t+'close" data-toggle="asset-remove">\n &Cross;\n </div>\n '},updateTarget:function(t){t&&t.set&&(t.set("attributes",n.clone(t.get("attributes"))),t.set("src",this.model.get("src")))},getPreview:function(){return""},getInfo:function(){return""},render:function(){var t=this.el;return t.innerHTML=this.template(this,this.model),t.className=this.className,this}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";(function(e,i){function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(24),s=r(o);t.exports=e.View.extend({template:i.template('\n <form>\n <div id="<%= pfx %>title"><%= title %></div>\n <input type="file" id="<%= uploadId %>" name="file" accept="image/*" <%= disabled ? \'disabled\' : \'\' %> multiple/>\n <div style="clear:both;"></div>\n </form>\n '),events:{},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t;var e=t.config||{};this.config=e,this.pfx=e.stylePrefix||"",this.ppfx=e.pStylePrefix||"",this.target=this.options.globalCollection||{},this.uploadId=this.pfx+"uploadFile",this.disabled=void 0!==e.disableUpload?e.disableUpload:!e.upload&&!e.embedAsBase64,this.events["change #"+this.uploadId]="uploadFile";var n=e.uploadFile;n?this.uploadFile=n.bind(this):e.embedAsBase64&&(this.uploadFile=this.constructor.embedAsBase64),this.delegateEvents()},onUploadStart:function(){var t=this.config.em;t&&t.trigger("asset:upload:start")},onUploadEnd:function(t){var e=this.config.em;e&&e.trigger("asset:upload:end",t)},onUploadError:function(t){var e=this.config.em;this.onUploadEnd(t),e&&e.trigger("asset:upload:error",t)},onUploadResponse:function(t,e){var n=this.config.em,i=this.config,r=this.target,o="string"==typeof t?JSON.parse(t):t;n&&n.trigger("asset:upload:response",o),i.autoAdd&&r&&r.add(o.data,{at:0}),this.onUploadEnd(t),e&&e(o)},uploadFile:function(t,e){for(var n=this,i=t.dataTransfer?t.dataTransfer.files:t.target.files,r=new FormData,o=this.config,a=o.params,l=0;l<i.length;l++)r.append(o.uploadName+"[]",i[l]);for(var c in a)r.append(c,a[c]);var u=(this.target,o.upload),h=o.headers,d="X-Requested-With";if("undefined"==typeof h[d]&&(h[d]="XMLHttpRequest"),u)return this.onUploadStart(),(0,s["default"])(u,{method:"post",credentials:"include",headers:h,body:r}).then(function(t){return 1==(t.status/200|0)?t.text():t.text().then(function(t){return Promise.reject(t)})}).then(function(t){return n.onUploadResponse(t,e)})["catch"](function(t){return n.onUploadError(t)})},initDrop:function(){var t=this;if(!this.uploadForm&&(this.uploadForm=this.$el.find("form").get(0),"draggable"in this.uploadForm)){this.uploadFile;this.uploadForm.ondragover=function(){return this.className=t.pfx+"hover",!1},this.uploadForm.ondragleave=function(){return this.className="",!1},this.uploadForm.ondrop=function(e){this.className="",e.preventDefault(),t.uploadFile(e)}}},initDropzone:function(t){var e=this,n=0,i=this.config,r=t.model,o=t.el,s=r.get("Editor"),a=(r.get("Config").el,r.get("Canvas").getBody()),l=this.ppfx,c=l+"dropzone-active",u=l+"dropzone",h=function(){o.className=o.className.replace(c,"").trim(),n=0},d=function(){return n||(o.className+=" "+c,n=1),!1},f=function(){return h(),!1},p=function(t){if(h(),t.preventDefault(),t.stopPropagation(),e.uploadFile(t),i.openAssetsOnDrop&&s){var n=s.getSelected();s.runCommand("open-assets",{target:n,onSelect:function(){s.Modal.close(),s.AssetManager.setTarget(null)}})}return!1};t.$el.append('<div class="'+u+'">'+i.dropzoneContent+"</div>"),h(),"draggable"in o&&[o,a].forEach(function(t){t.ondragover=d,t.ondragleave=f,t.ondrop=p})},render:function(){return this.$el.html(this.template({title:this.config.uploadText,uploadId:this.uploadId,disabled:this.disabled,pfx:this.pfx})),this.initDrop(),this.$el.attr("class",this.pfx+"file-uploader"),this}},{embedAsBase64:function(t,e){var n=this,i=t.dataTransfer?t.dataTransfer.files:t.target.files,r={data:[]};if(!FileReader)return void this.onUploadError(new Error("Unsupported platform, FileReader is not defined"));var o=[],s=/^(.+)\/(.+)$/,a=function(t){var e=new Promise(function(e,n){var i=new FileReader;i.addEventListener("load",function(r){var o=void 0,a=t.name,l=s.exec(t.type);if(o=l?l[1]:t.type,"image"===o){var c={src:i.result,name:a,type:o,height:0,width:0},u=new Image;u.addEventListener("error",function(t){n(t)}),u.addEventListener("load",function(){c.height=u.height,c.width=u.width,e(c)}),u.src=c.src}else e(o?{src:i.result,name:a,type:o}:i.result)}),i.addEventListener("error",function(t){n(t)}),i.addEventListener("abort",function(t){n("Aborted")}),i.readAsDataURL(t)});o.push(e)},l=!0,c=!1,u=void 0;try{for(var h,d=i[Symbol.iterator]();!(l=(h=d.next()).done);l=!0){var f=h.value;a(f)}}catch(p){c=!0,u=p}finally{try{!l&&d["return"]&&d["return"]()}finally{if(c)throw u}}Promise.all(o).then(function(t){r.data=t,n.onUploadResponse(r,e)},function(t){n.onUploadError(t)})}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";(function(e){function i(t){return t&&t.__esModule?t:{"default":t}}var r=n(47),o=i(r),s=n(0),a=n(10);t.exports=s.Model.extend(o["default"]).extend({defaults:{selectors:{},selectorsAdd:"",style:{},mediaText:"",state:"",stylable:!0,atRuleType:"",singleAtRule:0,important:0},initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.config=t||{};var n=e.em,i=this.config.selectors||[];if(this.em=n,n){var r=n.get("SelectorManager"),o=[];i.forEach(function(t){o.push(r.add(t))}),i=o}this.set("selectors",new a(i))},getAtRule:function(){var t=this.get("atRuleType"),e=this.get("mediaText"),n=t?"@"+t:e?"@media":"";return n+(e&&n?" "+e:"")},selectorsToString:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],n=this.get("state"),i=this.get("selectorsAdd"),r=this.get("selectors").getFullString(),o=n?":"+n:"";return r&&e.push(""+r+o),i&&!t.skipAdd&&e.push(i),e.join(", ")},getDeclaration:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="",n=this.selectorsToString(),i=this.styleToString(t),r=this.get("singleAtRule");return(n||r)&&i&&(e=r?i:n+"{"+i+"}"),e},toCSS:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="",n=this.getAtRule(),i=this.getDeclaration(t);return i&&(e=i),n&&e&&(e=n+"{"+e+"}"),e},compare:function(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n||"",s=i||"",a=r.selectorsAdd||"",l=r.atRuleType||"";t instanceof Array||t.models||(t=[t]);var c=e.map(t.models||t,function(t){return t.get("name")}),u=e.map(this.get("selectors").models,function(t){return t.get("name")}),h=!1;if(c.length!==u.length)return h;for(var d=0;d<c.length;d++){for(var f=0,p=0;p<u.length;p++)c[d]===u[p]&&(f=1);if(0===f)return h}return this.get("state")===o&&this.get("mediaText")===s&&this.get("selectorsAdd")===a&&this.get("atRuleType")===l||h}})}).call(e,n(1))},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=n(1),s=n(2),a=n(25),l=i(a),c=(0,l["default"])().parseStyle;e["default"]={parseStyle:c,extendStyle:function(t){return r({},this.getStyle(),t)},getStyle:function(){return r({},this.get("style"))},setStyle:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,o.isString)(e)&&(e=c(e));var i=this.getStyle(),a=r({},e);this.set("style",a,n);var l=(0,s.shallowDiff)(i,a);return(0,o.keys)(l).forEach(function(e){return t.trigger("change:style:"+e)}),a},addStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof t?t={prop:e}:n=e||{},t=this.extendStyle(t),this.setStyle(t,n)},removeStyle:function(t){var e=this.getStyle();delete e[t],this.setStyle(e)},styleToString:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],n=this.getStyle();for(var i in n){var r=t.important,s=(0,o.isArray)(r)?r.indexOf(i)>=0:r,a=""+n[i]+(s?" !important":"");e.push(i+":"+a+";")}return e.join("")}}},function(t,e,n){"use strict";t.exports=n(0).View.extend({tagName:"style",initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config=t.config||{};var e=this.model,n="change:style change:state change:mediaText";this.listenTo(e,n,this.render),this.listenTo(e,"destroy remove",this.remove),this.listenTo(e.get("selectors"),"change",this.render)},render:function(){var t=this.model,e=t.get("important");return this.el.innerHTML=this.model.toCSS({important:e}),this}})},function(t,e,n){"use strict";var i=n(0);t.exports=i.View.extend({itemView:"",itemsView:"",itemType:"type",initialize:function(t,e){this.config=e||{}},addTo:function(t){this.add(t)},add:function(t,e){var n=e||null,i=this.itemView,r=t.get(this.itemType);this.itemsView&&this.itemsView[r]&&(i=this.itemsView[r]);var o=new i({model:t,config:this.config},this.config),s=o.render().el;
n?n.appendChild(s):this.$el.append(s)},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.length&&this.collection.each(function(e){this.add(e,t)},this),this.$el.append(t),this}})},function(t,e,n){"use strict";var i=n(1),r=n(0);t.exports=r.Collection.extend({initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.listenTo(this,"add",this.onAdd),this.config=e.config,this.em=e.em,this.model=function(t,n){var i,r=e.componentTypes;n.em=e.em,n.config=e.config,n.componentTypes=r;for(var o=0;o<r.length;o++){var s=r[o].id;if(s==t.type){i=r[o].model;break}}return i||(i=r[r.length-1].model),new i(t,n)}},add:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t){var n=this.em.get("Parser").parseHtml(t);t=n.html;var i=this.em.get("CssComposer");if(n.css&&i){var o=e.avoidUpdateStyle;i.addCollection(n.css,{extend:1,avoidUpdateStyle:o})}}return r.Collection.prototype.add.apply(this,[t,e])},onAdd:function(t,e,n){var r=this.em,o=t.getStyle(),s=r&&r.getConfig("avoidInlineStyle");if(!(0,i.isEmpty)(o)&&!s&&r&&r.get&&r.getConfig("forceClass")){var a=t.cid;r.get("CssComposer").setClassRule(a,o);t.setStyle({}),t.addClass(a)}}})},function(t,e,n){"use strict";(function(e){var i=n(1);t.exports=e.View.extend({initialize:function(t){this.opts=t||{},this.config=t.config||{};var e=this.collection;this.listenTo(e,"add",this.addTo),this.listenTo(e,"reset",this.resetChildren)},addTo:function(t){var e=this.config.em,n=this.collection.indexOf(t);this.addToCollection(t,null,n),e&&!t.opt.temporary&&(e.trigger("add:component",t),e.trigger("component:add",t))},addToCollection:function(t,e,r){this.compView||(this.compView=n(3));for(var o=e||null,s=this.compView,a=this.opts.componentTypes,l=t.get("type"),c=0;c<a.length;c++){var u=a[c].id;if(u==l){s=a[c].view;break}}var h=new s({model:t,config:this.config,componentTypes:a}),d=h.render().el;if("textnode"==h.model.get("type")&&(d=document.createTextNode(h.model.get("content"))),o)o.appendChild(d);else{var f=this.parentEl,p=f.childNodes;if((0,i.isUndefined)(r))f.appendChild(d);else{var g=p.length==r;g&&r--,g||!p.length?f.appendChild(d):f.insertBefore(d,p[r])}}return d},resetChildren:function(){var t=this;this.parentEl.innerHTML="",this.collection.each(function(e){return t.addToCollection(e)})},render:function(t){var e=this,n=this.el,i=document.createDocumentFragment();return this.parentEl=t||this.el,this.collection.each(function(t){return e.addToCollection(t,i)}),n.innerHTML="",n.appendChild(i),this}})}).call(e,n(0))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(4);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"text",droppable:!1,editable:!0})})},function(t,e,n){"use strict";var i=n(2),r=n(3);t.exports=r.extend({events:{dblclick:"enableEditing"},initialize:function(t){r.prototype.initialize.apply(this,arguments),this.disableEditing=this.disableEditing.bind(this);var e=this.model,n=this.em;this.listenTo(e,"focus active",this.enableEditing),this.listenTo(e,"change:content",this.updateContent),this.rte=n&&n.get("RichTextEditor")},enableEditing:function(){var t=this.rte;if(!this.rteEnabled&&this.model.get("editable")){if(t)try{this.activeRte=t.enable(this,this.activeRte)}catch(e){}this.rteEnabled=1,this.toggleEvents(1)}},disableEditing:function(){var t=this.model,e=t.get("editable"),n=this.rte;if(n&&e){try{n.disable(this,this.activeRte)}catch(i){}var r=this.getChildrenContainer().innerHTML,o=t.get("components");if(o.length&&o.reset(),t.set("content",""),n.customRte)t.set("content",r);else{var s=function a(t){t.set({editable:0,highlightable:0,removable:0,draggable:0,copyable:0,toolbar:""}),t.get("components").each(function(t){return a(t)})};t.trigger("change:content",t),o.add(r),o.each(function(t){return s(t)}),o.trigger("resetNavigator")}}this.rteEnabled=0,this.toggleEvents()},disablePropagation:function(t){t.stopPropagation()},toggleEvents:function(t){var e=t?"on":"off",n={on:i.on,off:i.off},r=[this.el.ownerDocument,document];n.off(r,"mousedown",this.disableEditing),n[e](r,"mousedown",this.disableEditing),this.$el.off("mousedown",this.disablePropagation),this.$el[e]("mousedown",this.disablePropagation)}})},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports={startSelectPosition:function(t,e){this.isPointed=!1;var n=this.editorModel.get("Utils");n&&!this.sorter&&(this.sorter=new n.Sorter({container:this.getCanvasBody(),placer:this.canvas.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,direction:"a",document:e,wmargin:1,nested:1,em:this.editorModel,canvasRelative:1})),this.sorter.startSort(t)},getOffsetDim:function(){var t=this.offset(this.canvas.getFrameEl()),e=this.offset(this.canvas.getElement()),n=t.top-e.top,i=t.left-e.left;return{top:n,left:i}},stopSelectPosition:function(){this.posTargetCollection=null,this.posIndex="after"==this.posMethod&&0!==this.cDim.length?this.posIndex+1:this.posIndex,this.sorter&&(this.sorter.moved=0,this.sorter.endMove()),this.cDim&&(this.posIsLastEl=0!==this.cDim.length&&"after"==this.posMethod&&this.posIndex==this.cDim.length,this.posTargetEl=0===this.cDim.length?n(this.outsideElem):!this.posIsLastEl&&this.cDim[this.posIndex]?n(this.cDim[this.posIndex][5]).parent():n(this.outsideElem),this.posTargetModel=this.posTargetEl.data("model"),this.posTargetCollection=this.posTargetEl.data("model-comp"))},enable:function(){this.startSelectPosition()},nearFloat:function(t,e,n){var i=t||0,r=e||"before",o=n.length,s=0!==o&&"after"==r&&i==o;return 0!==o&&(!s&&!n[i][4]||n[i-1]&&!n[i-1][4]||s&&!n[i-1][4])?1:0},run:function(){this.enable()},stop:function(){this.stopSelectPosition(),this.$wrapper.css("cursor",""),this.$wrapper.unbind()}}}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=(n(0),n(22));t.exports=e.extend({},i,{init:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];i.init.apply(this,n),e.bindAll(this,"insertComponent"),this.allowDraw=0},run:function(t,e,n){this.em=t,this.sender=e,this.opt=n||{},this.$wr=this.$wrapper,this.enable()},enable:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.enable.apply(this,e),this.$wr.on("click",this.insertComponent)},insertComponent:function(){this.$wr.off("click",this.insertComponent),this.stopSelectPosition();var t=this.buildContent();this.beforeInsert(t);var e=this.sorter.lastPos.index,n=this.create(this.sorter.target,t,e,null,{silent:!1});this.opt.terminateAfterInsert&&this.sender?this.sender.set("active",!1):this.enable(),n&&this.afterInsert(n,this)},beforeInsert:function(t){},afterInsert:function(t){},buildContent:function(){return this.opt.content||{}}})}).call(e,n(1))},function(t,e,n){"use strict";var i=n(1),r=n(3),o=void 0;t.exports=n(0).View.extend({events:{"mousedown [data-toggle-move]":"startSort","click [data-toggle-visible]":"toggleVisibility","click [data-toggle-select]":"handleSelect","click [data-toggle-open]":"toggleOpening","dblclick input":"handleEdit","focusout input":"handleEditEnd"},template:function(t){var e=this.pfx,n=this.ppfx,i=this.config.hidable,r=this.countChildren(t),o=r?"":e+"no-chld",s=this.level+1;return"\n "+(i?'<i id="'+e+'btn-eye" class="'+e+"btn fa fa-eye "+(this.isVisible()?"":"fa-eye-slash")+'" data-toggle-visible></i>':"")+'\n\n <div class="'+e+"title-c "+n+'one-bg">\n <div class="'+e+"title "+o+'" style="padding-left: '+(30+10*s)+'px" data-toggle-select>\n <div class="'+e+'title-inn">\n <i id="'+e+'caret" class="fa fa-chevron-right '+this.caretCls+'" data-toggle-open></i>\n '+t.getIcon()+'\n <input class="'+n+"no-app "+this.inputNameCls+'" value="'+t.getName()+'" readonly>\n </div>\n </div>\n </div>\n <div id="'+e+'counter">'+(r?r:"")+'</div>\n <div id="'+e+'move" data-toggle-move>\n <i class="fa fa-arrows"></i>\n </div>\n <div class="'+e+'children"></div>\n '},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.opt=t,this.level=t.level,this.config=t.config,this.em=t.config.em,this.ppfx=this.em.get("Config").stylePrefix,this.sorter=t.sorter||"",this.pfx=this.config.stylePrefix;var e=this.pfx,n=this.ppfx,i=this.model,r=i.get("components");i.set("open",!1),this.listenTo(r,"remove add change reset",this.checkChildren),this.listenTo(i,"destroy remove",this.remove),this.listenTo(i,"change:status",this.updateStatus),this.listenTo(i,"change:open",this.updateOpening),this.listenTo(i,"change:style:display",this.updateVisibility),this.className=e+"item no-select",this.editBtnCls=e+"nav-item-edit",this.inputNameCls=n+"nav-comp-name",this.caretCls=n+"nav-item-caret",this.titleCls=e+"title",this.$el.data("model",i),this.$el.data("collection",r)},getVisibilityEl:function(){return this.eyeEl||(this.eyeEl=this.$el.children("#"+this.pfx+"btn-eye")),this.eyeEl},updateVisibility:function(){var t=this.pfx,e=this.model,n=t+"hide",i="fa-eye-slash",r="none"==e.getStyle().display,o=r?"addClass":"removeClass";this.$el[o](n),this.getVisibilityEl()[o](i)},toggleVisibility:function(t){t&&t.stopPropagation();var e=this.model,n=e.getStyle(),i="none"==n.display;i?delete n.display:n.display="none",e.setStyle(n)},handleEdit:function(t){t.stopPropagation();var e=this.getInputName();e.readOnly=!1,e.focus()},handleEditEnd:function(t){t.stopPropagation();var e=this.getInputName();e.readOnly=!0,this.model.set("custom-name",e.value)},getInputName:function(){return this.inputName||(this.inputName=this.el.querySelector("."+this.inputNameCls)),this.inputName},updateOpening:function(){var t=this.opt.opened||{},e=this.model,n="fa-chevron-down";e.get("open")?(this.$el.addClass("open"),this.getCaret().addClass(n),t[e.cid]=e):(this.$el.removeClass("open"),this.getCaret().removeClass(n),delete t[e.cid])},toggleOpening:function(t){t.stopPropagation(),this.model.get("components").length&&this.model.set("open",!this.model.get("open"))},handleSelect:function(t){t.stopPropagation(),this.em&&this.em.setSelected(this.model,{fromLayers:1})},startSort:function(t){t.stopPropagation(),0===t.button&&this.sorter&&this.sorter.startSort(t.target)},freeze:function(){this.$el.addClass(this.pfx+"opac50"),this.model.set("open",0)},unfreeze:function(){this.$el.removeClass(this.pfx+"opac50")},updateStatus:function(t){r.prototype.updateStatus.apply(this,arguments)},isVisible:function(){var t=this.model.get("style"),e=t.display;if(!e||"none"!=e)return 1},checkChildren:function(){var t=this.model,e=this.countChildren(t),n=this.pfx,i=n+"no-chld",r=this.$el.children("."+n+"title-c").children("."+n+"title");this.$counter||(this.$counter=this.$el.children("#"+n+"counter")),e?(r.removeClass(i),this.$counter.html(e)):(r.addClass(i),this.$counter.empty(),t.set("open",0))},countChildren:function(t){var e=0;return t.get("components").each(function(t){var n=this.opt.isCountable,i=this.config.hideTextnode;n&&!n(t,i)||e++},this),e},getCaret:function(){if(!this.caret){var t=this.pfx;this.caret=this.$el.children("."+t+"title-c").find("#"+t+"caret")}return this.caret},render:function(){var t=this.model,e=this.pfx,r=this.isVisible(),s=this.$el,a=this.level+1;s.html(this.template(t)),(0,i.isUndefined)(o)&&(o=n(57));var l=new o({collection:t.get("components"),config:this.config,sorter:this.sorter,opened:this.opt.opened,parent:t,level:a}).render().$el;return s.find("."+e+"children").append(l),t.get("draggable")&&this.config.sortable||s.children("#"+e+"move").remove(),!r&&(this.className+=" "+e+"hide"),s.attr("class",this.className),this.updateOpening(),this.updateStatus(),this.updateVisibility(),this}})},function(t,e,n){"use strict";var i=n(0),r=n(56);t.exports=i.View.extend({initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.opt=t;var e=t.config||{};if(this.level=t.level,this.config=e,this.preview=t.preview,this.ppfx=e.pStylePrefix||"",this.pfx=e.stylePrefix||"",this.parent=t.parent,this.listenTo(this.collection,"add",this.addTo),this.listenTo(this.collection,"reset resetNavigator",this.render),this.className=this.pfx+"items",e.sortable&&!this.opt.sorter){var n=this.pfx,i=e.em.get("Utils");this.opt.sorter=new i.Sorter({container:e.sortContainer||this.el,containerSel:"."+n+"items",itemSel:"."+n+"item",ppfx:this.ppfx,ignoreViewChildren:1,avoidSelectOnEnd:1,pfx:n,nested:1})}this.sorter=this.opt.sorter||"",this.$el.data("collection",this.collection),this.parent&&this.$el.data("model",this.parent)},addTo:function(t){var e=this.collection.indexOf(t);this.addToCollection(t,null,e)},addToCollection:function(t,e,n){var i=this.level,o=e||null,s=r;if(this.isCountable(t,this.config.hideTextnode)){var a=new s({level:i,model:t,config:this.config,sorter:this.sorter,isCountable:this.isCountable,opened:this.opt.opened}),l=a.render().el;if(o)o.appendChild(l);else if("undefined"!=typeof n){var c="before";this.$el.children().length==n&&(n--,c="after"),n<0?this.$el.append(l):this.$el.children().eq(n)[c](l)}else this.$el.append(l);return l}},isCountable:function(t,e){var n=t.get("type"),i=t.get("tagName");return!(("textnode"==n||"br"==i)&&e||!t.get("layerable"))},render:function(){var t=this,e=document.createDocumentFragment();return this.el.innerHTML="",this.collection.each(function(n){return t.addToCollection(n,e)}),this.el.appendChild(e),this.$el.attr("class",this.className),this}})},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({defaults:{id:"",label:"",open:!0,attributes:{}}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=n(9),s=i(o),a=n(60),l=i(a),c=n(219),u=i(c),h=n(221),d=i(h);(0,d["default"])(),t.exports=function(){var t=new u["default"],e=[],n={autorender:1,plugins:[],pluginsOpts:{}};return{$:s["default"],editors:e,plugins:t,version:"0.13.8",init:function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.container;if(!o)throw new Error("'container' is required");i=r({},n,i);var s=o instanceof window.HTMLElement;i.el=s?o:document.querySelector(o);var a=new l["default"](i).init();return i.plugins.forEach(function(e){var n=t.get(e);n&&n(a,i.pluginsOpts[e]||{})}),a.getModel().loadOnStart(),i.autorender&&a.render(),e.push(a),a}}}()},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=n(9),o=i(r);t.exports=function(t){var e=t||{},i=n(61),r=n(62),s=n(218);for(var a in i)a in e||(e[a]=i[a]);e.pStylePrefix=e.stylePrefix;var l=new r(e),c=new s({model:l,config:e});return{$:o["default"],editor:l,DomComponents:l.get("DomComponents"),CssComposer:l.get("CssComposer"),StorageManager:l.get("StorageManager"),AssetManager:l.get("AssetManager"),BlockManager:l.get("BlockManager"),TraitManager:l.get("TraitManager"),SelectorManager:l.get("SelectorManager"),CodeManager:l.get("CodeManager"),Commands:l.get("Commands"),Keymaps:l.get("Keymaps"),Modal:l.get("Modal"),Panels:l.get("Panels"),StyleManager:l.get("StyleManager"),Canvas:l.get("Canvas"),UndoManager:l.get("UndoManager"),DeviceManager:l.get("DeviceManager"),RichTextEditor:l.get("RichTextEditor"),Utils:l.get("Utils"),Config:l.get("Config"),init:function(){return l.init(this),this},getConfig:function(t){return l.getConfig(t)},getHtml:function(t){return l.getHtml(t)},getCss:function(t){return l.getCss(t)},getJs:function(){return l.getJs()},getComponents:function(){return l.get("DomComponents").getComponents()},setComponents:function(t){return l.setComponents(t),this},addComponents:function(t,e){return this.getComponents().add(t,e)},getStyle:function(){return l.get("CssComposer").getAll()},setStyle:function(t){return l.setStyle(t),this},getSelected:function(){return l.getSelected()},getSelectedToStyle:function(){var t=l.getSelected();if(t)return this.StyleManager.getModelToStyle(t)},select:function(t){return l.setSelected(t),this},setDevice:function(t){return l.set("device",t),this},getDevice:function(){return l.get("device")},runCommand:function(t,e){var n,i=l.get("Commands").get(t);return i&&(n=i.run(this,this,e),this.trigger("run:"+t)),n},stopCommand:function(t,e){var n,i=l.get("Commands").get(t);return i&&(n=i.stop(this,this,e),this.trigger("stop:"+t)),n},store:function(t){return l.store(t)},load:function(t){return l.load(t)},getContainer:function(){return e.el},refresh:function(){l.refreshCanvas()},setCustomRte:function(t){this.RichTextEditor.customRte=t},on:function(t,e){return l.on(t,e)},off:function(t,e){return l.off(t,e)},trigger:function(t){return l.trigger.apply(l,arguments)},getEl:function(){return c.el},getModel:function(){return l},render:function(){var t=this;return l.on("loaded",function(){t.UndoManager.clear(),l.get("modules").forEach(function(t){t.postRender&&t.postRender(c)})}),c.render(),c.el}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"gjs-",components:"",style:"",fromElement:0,noticeOnUnload:!0,showOffsets:!1,showOffsetsSelected:!1,forceClass:!0,height:"900px",width:"100%",protectedCss:"* { box-sizing: border-box; } body {margin: 0;}",canvasCss:"",defaultCommand:"select-comp",showToolbar:1,allowScripts:0,showDevices:1,devicePreviewMode:0,mediaCondition:"max-width",tagVarStart:"{[ ",tagVarEnd:" ]}",jsInHtml:!0,nativeDnD:1,exportWrapper:0,wrappesIsBody:1,avoidInlineStyle:0,clearStyles:0,el:"",undoManager:{},assetManager:{},canvas:{},layers:{},storageManager:{},rte:{},domComponents:{},modal:{},codeManager:{},panels:{},commands:{},cssComposer:{},selectorManager:{},deviceManager:{devices:[{name:"Desktop",width:""},{name:"Tablet",width:"768px",widthMedia:"992px"},{name:"Mobile landscape",width:"568px",widthMedia:"768px"},{name:"Mobile portrait",width:"320px",widthMedia:"480px"}]},styleManager:{sectors:[{name:"General",open:!1,buildProps:["float","display","position","top","right","left","bottom"]},{name:"Dimension",open:!1,buildProps:["width","height","max-width","min-height","margin","padding"]},{name:"Typography",open:!1,buildProps:["font-family","font-size","font-weight","letter-spacing","color","line-height","text-align","text-shadow"],properties:[{property:"text-align",list:[{value:"left",className:"fa fa-align-left"},{value:"center",className:"fa fa-align-center"},{value:"right",className:"fa fa-align-right"},{value:"justify",className:"fa fa-align-justify"}]}]},{name:"Decorations",open:!1,buildProps:["border-radius-c","background-color","border-radius","border","box-shadow","background"]},{name:"Extra",open:!1,buildProps:["transition","perspective","transform"]}]},blockManager:{},textViewCode:"Code"}},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(1),o=[n(63),n(67),n(68),n(71),n(79),n(84),n(87),n(91),n(95),n(107),n(113),n(31),n(130),n(136),n(141),n(148),n(176),n(183),n(209)],s=n(0),a=void 0;n(217)({Backbone:s,$:s.$});var l=s.$;t.exports=s.Model.extend({defaults:{clipboard:null,designerMode:!1,selectedComponent:null,previousModel:null,changesCount:0,storables:[],modules:[],toLoad:[],opened:{},device:""},initialize:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config=e,this.set("Config",e),this.set("modules",[]),this.set("toLoad",[]),e.el&&e.fromElement&&(this.config.components=e.el.innerHTML),o.forEach(function(e){return t.loadModule(e)}),this.on("change:selectedComponent",this.componentSelected,this),this.on("change:changesCount",this.updateChanges,this)},getConfig:function(t){var e=this.config;return(0,r.isUndefined)(t)?e:e[t]},loadOnStart:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=this.get("StorageManager");this.get("toLoad").forEach(function(t){t.onLoad()});var i=function(){var n=t.get("modules");n.forEach(function(e){return e.postLoad&&e.postLoad(t)}),e&&e()};n&&n.getConfig().autoload?this.load(i):i()},updateChanges:function(){var t=this.get("StorageManager"),e=this.get("changesCount");this.config.noticeOnUnload&&e?window.onbeforeunload=function(t){return 1}:window.onbeforeunload=null,t.isAutosave()&&e>=t.getStepsBeforeSave()&&this.store()},loadModule:function(t){var e=this.config,n=new t,r=n.name.charAt(0).toLowerCase()+n.name.slice(1),o=e[r]||e[n.name]||{};o.pStylePrefix=e.pStylePrefix||"";var s=this.get("StorageManager");if(n.storageKey&&n.store&&n.load&&s){o.stm=s;var a=this.get("storables");a.push(n),this.set("storables",a)}return o.em=this,n.init(i({},o)),!n["private"]&&this.set(n.name,n),n.onLoad&&this.get("toLoad").push(n),this.get("modules").push(n),this},init:function(t){this.set("Editor",t)},getEditor:function(){return this.get("Editor")},handleUpdates:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.temporary||(a&&clearInterval(a),a=setTimeout(function(){i.avoidStore||n.set("changesCount",n.get("changesCount")+1,i)},0))},componentSelected:function(t,e,n){this.get("selectedComponent")?(this.trigger("select-comp",[t,e,n]),this.trigger("component:selected",arguments)):this.trigger("deselect-comp")},getSelected:function(){return this.get("selectedComponent")},setSelected:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t;t instanceof window.HTMLElement&&(n=l(t).data("model")),n&&!n.get("selectable")||this.set("selectedComponent",n,e)},setComponents:function(t){return this.get("DomComponents").setComponents(t)},getComponents:function(){var t=this.get("DomComponents"),e=this.get("CodeManager");if(t&&e){var n=t.getComponents();return e.getCode(n,"json")}},setStyle:function(t){for(var e=this.get("CssComposer").getAll(),n=0,i=e.length;n<i;n++)e.pop();return e.add(t),this},getStyle:function(){return this.get("CssComposer").getAll()},getHtml:function(){var t=this.config,e=t.exportWrapper,n=t.wrappesIsBody,i=t.jsInHtml?this.getJs():"",r=this.get("DomComponents").getComponent(),o=this.get("CodeManager").getCode(r,"html",{exportWrapper:e,wrappesIsBody:n});return o+=i?"<script>"+i+"</script>":""},getCss:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.config,n=e.wrappesIsBody,i=t.avoidProtected,r=this.get("CssComposer"),o=this.get("DomComponents").getComponent(),s=i?"":e.protectedCss;return s+this.get("CodeManager").getCode(o,"css",{cssc:r,wrappesIsBody:n})},getJs:function(){var t=this.get("DomComponents").getWrapper();return this.get("CodeManager").getCode(t,"js").trim()},store:function c(t){var e=this,n=this.get("StorageManager"),c={};if(n)return this.get("storables").forEach(function(t){var e=t.store(1);for(var n in e)c[n]=e[n]}),n.store(c,function(){t&&t(),e.set("changesCount",0),e.trigger("storage:store",c)}),c},load:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.getCacheLoad(1,function(n){t.get("storables").forEach(function(t){return t.load(n)}),e&&e(n)})},getCacheLoad:function(t,e){var n=this,i=t?1:0;if(this.cacheLoad&&!i)return this.cacheLoad;var r=this.get("StorageManager"),o=[];return r?(this.get("storables").forEach(function(t){var e=t.storageKey;e="function"==typeof e?e():e;var n=e instanceof Array?e:[e];n.forEach(function(t){o.push(t)})}),void r.load(o,function(t){n.cacheLoad=t,e&&e(t),n.trigger("storage:load",t)})):{}},getDeviceModel:function(){var t=this.get("device");return this.get("DeviceManager").get(t)},runDefault:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.get("Commands").get(this.config.defaultCommand);e&&!this.defaultRunning&&(e.stop(this,this,t),e.run(this,this,t),this.defaultRunning=1)},stopDefault:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.get("Commands").get(this.config.defaultCommand);e&&(e.stop(this,this,t),this.defaultRunning=0)},refreshCanvas:function(){this.set("canvasOffset",this.get("Canvas").getOffset())},clearSelection:function(t){var e=t||window;e.getSelection().removeAllRanges()},getCurrentMedia:function(){var t=this.config,e=this.getDeviceModel(),n=t.mediaCondition,i=t.devicePreviewMode,r=e&&e.get("widthMedia");return e&&r&&!i?"("+n+": "+r+")":""},data:function(t,e,n){var i="_gjs-data";return t[i]||(t[i]={}),(0,r.isUndefined)(n)?t[i][e]:void(t[i][e]=n)}})},function(t,e,n){"use strict";t.exports=function(){var t=n(64),e=n(65),i=n(66);return{name:"Utils",init:function(){return this},Sorter:t,Resizer:e,Dragger:i}}},function(t,e,n){"use strict";(function(e,i){var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=n(1),s=n(2),a=e.$;t.exports=e.View.extend({initialize:function(t){this.opt=t||{},i.bindAll(this,"startSort","onMove","endMove","rollback","udpateOffset","moveDragHelper");var e=t||{};this.elT=0,this.elL=0,this.borderOffset=e.borderOffset||10;var n=e.container;this.el="string"==typeof n?document.querySelector(n):n,this.$el=a(this.el),this.containerSel=e.containerSel||"div",this.itemSel=e.itemSel||"div",this.draggable=e.draggable||!0,this.nested=e.nested||0,this.pfx=e.pfx||"",this.ppfx=e.ppfx||"",this.freezeClass=e.freezeClass||this.pfx+"freezed",this.onStart=e.onStart||"",this.onEndMove=e.onEndMove||"",this.direction=e.direction||"v",this.onMoveClb=e.onMove||"",this.relative=e.relative||0,this.ignoreViewChildren=e.ignoreViewChildren||0,this.ignoreModels=e.ignoreModels||0,this.plh=e.placer||"",this.wmargin=e.wmargin||0,this.offTop=e.offsetTop||0,this.offLeft=e.offsetLeft||0,this.document=e.document||document,this.$document=a(this.document),this.dropContent=null,this.em=e.em||"",this.dragHelper=null,this.canvasRelative=e.canvasRelative||0,this.selectOnEnd=!e.avoidSelectOnEnd,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=a(this.el)}return this.el},getDocuments:function(){var t=this.em,e=t&&t.get("Canvas").getBody().ownerDocument,n=[document];return e&&n.push(e),n},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;document.body,this.ppfx||this.pfx,e?e.get("Canvas").getBody():"";t?e&&e.get("Canvas").startAutoscroll():e&&e.get("Canvas").stopAutoscroll()},setDragHelper:function(t,e){for(var n=e||"",i=t.cloneNode(1),r=t.getBoundingClientRect(),o=getComputedStyle(t),s="",l=0;l<o.length;l++){var c=o[l];s+=c+":"+o.getPropertyValue(c)+";"}document.body.appendChild(i),i.className+=" "+this.pfx+"bdrag",i.setAttribute("style",s),this.dragHelper=i,i.style.width=r.width+"px",i.style.height=r.height+"px",n&&this.moveDragHelper(n),this.em&&a(this.em.get("Canvas").getBody().ownerDocument).off("mousemove",this.moveDragHelper).on("mousemove",this.moveDragHelper),a(document).off("mousemove",this.moveDragHelper).on("mousemove",this.moveDragHelper)},moveDragHelper:function(t){var e=t.target.ownerDocument;if(this.dragHelper&&e){var n=t.pageY,i=t.pageX,r=0,o=0,s=e.defaultView||e.parentWindow,a=s.frameElement,l=this.dragHelper.style;if(a){var c=a.getBoundingClientRect();r=c.top+document.documentElement.scrollTop,o=c.left+document.documentElement.scrollLeft,n=t.clientY,i=t.clientX}l.top=n+r+"px",l.left=i+o+"px"}},matches:function(t,e,n){return s.matches.call(t,e)},closest:function(t,e){if(t){for(var n=t.parentNode;n&&1===n.nodeType;){if(this.matches(n,e))return n;n=n.parentNode}return null}},offset:function(t){var e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},createPlaceholder:function(){var t=this.pfx,e=document.createElement("div"),n=document.createElement("div");return e.className=t+"placeholder",e.style.display="none",e.style["pointer-events"]="none",n.className=t+"placeholder-int",e.appendChild(n),e},startSort:function(t){var e=this.em,n=this.itemSel,i=this.containerSel,r=this.getContainerEl(),o=this.getDocuments(),a=this.onStart,l=void 0,c=this.plh;this.dropModel=null,this.moved=0,t&&!this.matches(t,n+", "+i)&&(t=this.closest(t,n)),this.eV=t,c||(c=this.createPlaceholder(),r.appendChild(c),this.plh=c),t&&(l=this.getSourceModel(t),l&&l.set&&l.set("status","freezed")),(0,s.on)(r,"mousemove dragover",this.onMove),(0,s.on)(o,"mouseup dragend",this.endMove),(0,s.on)(o,"keydown",this.rollback),a&&a(),e&&e.clearSelection(),this.toggleSortCursor(1),e&&e.trigger("sorter:drag:start",t,l)},getTargetModel:function(t){var e=t||this.target;return a(e).data("model")},getSourceModel:function(t){var e=t||this.eV,n=this.dropContent,i=this.dropModel,r=this.em;if(n&&r){if(!i){var o=r.get("DomComponents").getComponents(),s={avoidStore:1,avoidChildren:1,avoidUpdateStyle:1,temporary:1},l=o.add(n,s);i=o.remove(l,s),this.dropModel=i instanceof Array?i[0]:i}return i}if(e)return a(e).data("model")},selectTargetModel:function(t){if(!(t instanceof e.Collection)){var n=this.targetModel;n&&n.set("status",""),t&&t.set&&(t.set("status","selected-parent"),this.targetModel=t)}},onMove:function(t){var e=this.em;this.moved=1;var n=this.plh,i=n.style.display;i&&"none"!==i||(n.style.display="block");var r=this.offset(this.el);this.elT=this.wmargin?Math.abs(r.top):r.top,this.elL=this.wmargin?Math.abs(r.left):r.left;var o=t.pageY-this.elT+this.el.scrollTop,s=t.pageX-this.elL+this.el.scrollLeft;if(this.canvasRelative&&e){var l=e.get("Canvas").getMouseRelativeCanvas(t);s=l.x,o=l.y}this.rX=s,this.rY=o,this.eventMove=t;var c=this.dimsFromTarget(t.target,s,o),u=this.target,h=this.getTargetModel(u);this.selectTargetModel(h),this.lastDims=c;var d=this.findPosition(c,s,o);this.lastPos&&this.lastPos.index==d.index&&this.lastPos.method==d.method||(this.movePlaceholder(this.plh,c,d,this.prevTargetDim),this.$plh||(this.$plh=a(this.plh)),this.canvasRelative||(this.offTop&&this.$plh.css("top","+="+this.offTop+"px"),this.offLeft&&this.$plh.css("left","+="+this.offLeft+"px")),this.lastPos=d),"function"==typeof this.onMoveClb&&this.onMoveClb(t),e&&e.trigger("sorter:drag",{target:u,targetModel:h,dims:c,pos:d,x:s,y:o})},isInFlow:function(t,e){if(!t)return!1;e=e||document.body;var n,i=t;return n=i.offsetHeight,!!this.styleInFlow(i,e)},styleInFlow:function(t,e){var n=t.style,i=a(t);if(!(n.overflow&&"visible"!==n.overflow||"none"!==i.css("float")||e&&"flex"==a(e).css("display"))){switch(n.position){case"static":case"relative":case"":break;default:return}switch(t.tagName){case"TR":case"TBODY":case"THEAD":case"TFOOT":return!0}switch(i.css("display")){case"block":case"list-item":case"table":case"flex":return!0}}},validTarget:function(t){var n=this.getSourceModel(),i=n&&n.view&&n.view.el,r=this.getTargetModel(t);t=r&&r.view&&r.view.el;var s={valid:!0,src:i,srcModel:n,trg:t,trgModel:r};if(!i||!t)return s.valid=!1,s;var a=r.get("droppable");a=a instanceof e.Collection?1:a,a=a instanceof Array?a.join(", "):a,s.dropInfo=a,a=(0,o.isString)(a)?this.matches(i,a):a,s.droppable=a;var l=n.get("draggable");return l=l instanceof Array?l.join(", "):l,s.dragInfo=l,l=(0,o.isString)(l)?this.matches(t,l):l,s.draggable=l,a&&l||(s.valid=!1),s},dimsFromTarget:function(t,e,n){var i=this.em,r=[];if(!t)return r;if(this.matches(t,this.itemSel+", "+this.containerSel)||(t=this.closest(t,this.itemSel)),this.draggable instanceof Array&&(t=this.closest(t,this.draggable.join(","))),!t)return r;if(this.prevTarget&&this.prevTarget!=t&&(this.prevTarget=null),!this.prevTarget){this.targetP=this.closest(t,this.containerSel);var o=this.validTarget(t);if(i&&i.trigger("sorter:drag:validation",o),!o.valid&&this.targetP)return this.dimsFromTarget(this.targetP,e,n);this.prevTarget=t,this.prevTargetDim=this.getDim(t),this.cacheDimsP=this.getChildrenDim(this.targetP),this.cacheDims=this.getChildrenDim(t)}if(this.prevTarget==t&&(r=this.cacheDims),
this.target=this.prevTarget,this.nearBorders(this.prevTargetDim,e,n)||!this.nested&&!this.cacheDims.length){var s=this.targetP;s&&this.validTarget(s).valid&&(r=this.cacheDimsP,this.target=s)}return this.lastPos=null,r},getTargetFromEl:function(t){var e=t,n=void 0,i=this.targetPrev,r=this.em,o=this.containerSel,s=this.itemSel;if(this.matches(e,s+", "+o)||(e=this.closest(e,s)),this.draggable instanceof Array&&(e=this.closest(e,this.draggable.join(","))),i&&i!=e&&(this.targetPrev=""),!this.targetPrev){n=this.closest(e,o);var a=this.validTarget(e);if(r&&r.trigger("sorter:drag:validation",a),!a.valid&&n)return this.getTargetFromEl(n);this.targetPrev=e}return this.nearElBorders(e)&&(n=this.closest(e,o),n&&this.validTarget(n).valid&&(e=n)),e},nearElBorders:function(t){var e=10,n=t.getBoundingClientRect(),i=t.ownerDocument.body,r=this.getCurrentPos(),o=r.x,s=r.y,a=n.top+i.scrollTop,l=n.left+i.scrollLeft,c=n.width,u=n.height;if(s<a+e||s>a+u-e||o<l+e||o>l+c-e)return 1},getCurrentPos:function(){var t=this.eventMove,e=t.pageX||0,n=t.pageY||0;return{x:e,y:n}},getDim:function(t){var e,n,i,r;if(this.canvasRelative&&this.em){var o=this.em.get("Canvas").getElementPos(t),s=window.getComputedStyle(t),a=parseFloat(s.marginTop),l=parseFloat(s.marginBottom),c=parseFloat(s.marginRight),u=parseFloat(s.marginLeft);e=o.top-a,n=o.left-u,i=o.height+a+l,r=o.width+u+c}else{var h=this.offset(t);e=this.relative?t.offsetTop:h.top-(this.wmargin?-1:1)*this.elT,n=this.relative?t.offsetLeft:h.left-(this.wmargin?-1:1)*this.elL,i=t.offsetHeight,r=t.offsetWidth}return[e,n,i,r]},getChildrenDim:function(t){var e=[];if(!t)return e;var n=this.getTargetModel(t);n&&n.view&&!this.ignoreViewChildren&&(t=n.view.getChildrenContainer());for(var i=t.children,r=0,o=i.length;r<o;r++){var s=i[r];if(this.matches(s,this.itemSel)){var a=this.getDim(s),l=this.direction;l="v"==l||"h"!=l&&this.isInFlow(s,t),a.push(l),a.push(s),e.push(a)}}return e},nearBorders:function(t,e,n){var i=0,r=this.borderOffset,o=e||0,s=n||0,a=t[0],l=t[1],c=t[2],u=t[3];return(a+r>s||s>a+c-r||l+r>o||o>l+u-r)&&(i=1),!!i},findPosition:function(t,e,n){for(var i={index:0,method:"before"},r=0,o=0,s=0,a=0,l=0,c=0,u=0,h=0,d=0,f=t.length;d<f;d++)if(h=t[d],s=h[1]+h[3],u=h[0]+h[2],l=h[1]+h[3]/2,c=h[0]+h[2]/2,!(o&&h[1]>o||a&&c>=a||r&&s<r))if(i.index=d,h[4]){if(n<c){i.method="before";break}i.method="after"}else n<u&&(a=u),e<l?(o=l,i.method="before"):(r=l,i.method="after");return i},movePlaceholder:function(t,e,n,i){var r=0,o=0,s=0,a=0,l=0,c="px",u=5,h="#62c462",d=3,f=n.method,p=e[n.index];if(t.style.borderColor="transparent "+h,t.style.borderWidth=d+c+" "+(d+2)+c,t.style.margin="-"+d+"px 0 0",p)p[4]?(a=p[3]+c,l="auto",o="before"==f?p[0]-r:p[0]+p[2]-r,s=p[1]):(a="auto",l=p[2]-2*r+c,o=p[0]+r,s="before"==f?p[1]-r:p[1]+p[3]-r,t.style.borderColor=h+" transparent",t.style.borderWidth=d+2+c+" "+d+c,t.style.margin="0 0 0 -"+d+"px");else{if(!this.nested)return void(t.style.display="none");i&&(o=i[0]+u,s=i[1]+u,a=parseInt(i[3])-2*u+c,l="auto")}t.style.top=o+c,t.style.left=s+c,a&&(t.style.width=a),l&&(t.style.height=l)},endMove:function(t){var e,n=this.getDocuments(),i=this.getContainerEl();(0,s.off)(i,"mousemove dragover",this.onMove),(0,s.off)(n,"mouseup dragend",this.endMove),(0,s.off)(n,"keydown",this.rollback),this.plh.style.display="none";var r=(new RegExp("(?:^|\\s)"+this.freezeClass+"(?!\\S)","gi"),this.eV);if(r){var o=this.getSourceModel();o&&o.set&&(o.set("status",""),o.set("status","selected"))}this.moved&&(e=this.move(this.target,r,this.lastPos)),this.plh&&(this.plh.style.display="none"),"function"==typeof this.onEndMove&&this.onEndMove(e);var a=this.dragHelper;a&&(a.parentNode.removeChild(a),this.dragHelper=null),this.selectTargetModel(),this.toggleSortCursor()},move:function(t,n,i){var o=this.em;o&&o.trigger("component:dragEnd:before",t,n,i);var s,l,c,u=[],h=i.index,d=this.validTarget(t),f=a(t).data("collection"),p=d.srcModel,g=d.droppable,v=d.draggable,m=d.dropInfo,y=d.dragInfo,b=this.dropContent;if(g=d.trgModel instanceof e.Collection?1:g,f&&g&&v){h="after"===i.method?h+1:h;var x={at:h,noIncrement:1};b?(s=b,x.silent=!1,x.avoidUpdateStyle=1):(l=f.add({},r({},x,{avoidStore:1})),p&&(s=p.collection.remove(p))),c=f.add(s,x),b?this.dropContent=null:f.remove(l,{avoidStore:1}),this.prevTarget=null}else f||u.push("Target collection not found"),g||u.push("Target is not droppable, accepts ["+m+"]"),v||u.push("Component not draggable, acceptable by ["+y+"]");return o&&o.trigger("component:dragEnd",f,s,u),o&&o.trigger("sorter:drag:end",f,s,u),c},rollback:function(t){(0,s.off)(this.getDocuments(),"keydown",this.rollback);var e=t.which||t.keyCode;27==e&&(this.moved=0,this.endMove())}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(1),s=n(2),a={mousePosFetcher:null,updateTarget:null,ratioDefault:0,posFetcher:null,onStart:null,onMove:null,onEnd:null,step:1,minDim:32,maxDim:"",unitHeight:"px",unitWidth:"px",keyHeight:"height",keyWidth:"width",currentUnit:1,tl:1,tc:1,tr:1,cl:1,cr:1,bl:1,bc:1,br:1},l=function(t,e){var n=e.prefix||"",i=document.createElement("i");return i.className=n+"resizer-h "+n+"resizer-h-"+t,i.setAttribute("data-"+n+"handler",t),i},c=function(t,e){var n=e||window,i=t.getBoundingClientRect();return{left:i.left+n.pageXOffset,top:i.top+n.pageYOffset,width:i.width,height:i.height}},u=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,t),this.setOptions(e),(0,o.bindAll)(this,"handleKeyDown","handleMouseDown","move","stop"),this}return r(t,[{key:"getConfig",value:function(){return this.opts}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.opts=(0,o.defaults)(t,a),this.setup()}},{key:"setup",value:function(){var t=this.opts,e=t.prefix||"",n=t.appendTo||document.body,i=this.container;for(i||(i=document.createElement("div"),i.className=e+"resizer-c",n.appendChild(i),this.container=i);i.firstChild;)i.removeChild(i.firstChild);var r={};["tl","tc","tr","cl","cr","bl","bc","br"].forEach(function(e){return r[e]=t[e]?l(e,t):""});for(var o in r){var s=r[o];s&&i.appendChild(s)}this.handlers=r,this.mousePosFetcher=t.mousePosFetcher,this.updateTarget=t.updateTarget,this.posFetcher=t.posFetcher,this.onStart=t.onStart,this.onMove=t.onMove,this.onEnd=t.onEnd}},{key:"isHandler",value:function(t){var e=this.handlers;for(var n in e)if(e[n]===t)return!0;return!1}},{key:"getFocusedEl",value:function(){return this.el}},{key:"getDocumentEl",value:function(){return[this.el.ownerDocument,document]}},{key:"getElementPos",value:function(t){var e=this.posFetcher||"";return e?e(t):c(t)}},{key:"focus",value:function(t){if(!t||t!==this.el){this.el=t;var e="px",n=this.getElementPos(t),i=this.container,r=i.style;r.left=n.left+e,r.top=n.top+e,r.width=n.width+e,r.height=n.height+e,i.style.display="block",(0,s.on)(this.getDocumentEl(),"mousedown",this.handleMouseDown)}}},{key:"blur",value:function(){this.container.style.display="none",this.el&&((0,s.off)(this.getDocumentEl(),"mousedown",this.handleMouseDown),this.el=null)}},{key:"start",value:function(t){if(0===t.button){t.preventDefault(),t.stopPropagation();var e=this.el,n=this,i=this.opts||{},r="data-"+i.prefix+"handler",a=this.getElementPos(e);this.handlerAttr=t.target.getAttribute(r),this.clickedHandler=t.target,this.startDim={t:a.top,l:a.left,w:a.width,h:a.height},this.rectDim={t:a.top,l:a.left,w:a.width,h:a.height},this.startPos={x:t.clientX,y:t.clientY};var l=this.getDocumentEl();(0,s.on)(l,"mousemove",this.move),(0,s.on)(l,"keydown",this.handleKeyDown),(0,s.on)(l,"mouseup",this.stop),(0,o.isFunction)(this.onStart)&&this.onStart(t,{docs:l,config:i,el:e,resizer:n}),this.move(t)}}},{key:"move",value:function(t){var e=this.onMove,n=this.mousePosFetcher,i=n?n(t):{x:t.clientX,y:t.clientY};this.currentPos=i,this.delta={x:i.x-this.startPos.x,y:i.y-this.startPos.y},this.keys={shift:t.shiftKey,ctrl:t.ctrlKey,alt:t.altKey},this.rectDim=this.calc(this),this.updateRect(0),e&&e(t),0===t.which&&this.stop(t)}},{key:"stop",value:function(t){var e=this.opts,n=this.getDocumentEl();(0,s.off)(n,"mousemove",this.move),(0,s.off)(n,"keydown",this.handleKeyDown),(0,s.off)(n,"mouseup",this.stop),this.updateRect(1),(0,o.isFunction)(this.onEnd)&&this.onEnd(t,{docs:n,config:e})}},{key:"updateRect",value:function(t){var e=this.el,n=this,i=this.opts,r=this.rectDim,s=this.container.style,a=this.updateTarget,l=this.getSelectedHandler(),c=i.unitHeight,u=i.unitWidth;if((0,o.isFunction)(a))a(e,r,{store:t,selectedHandler:l,resizer:n,config:i});else{var h=e.style;h.width=r.w+u,h.height=r.h+c}var d="px",f=this.getElementPos(e);s.left=f.left+d,s.top=f.top+d,s.width=f.width+d,s.height=f.height+d}},{key:"getSelectedHandler",value:function(){var t=this.handlers;if(this.selectedHandler)for(var e in t)if(t[e]===this.selectedHandler)return e}},{key:"handleKeyDown",value:function(t){27===t.keyCode&&(this.rectDim=this.startDim,this.stop(t))}},{key:"handleMouseDown",value:function(t){var e=t.target;this.isHandler(e)?(this.selectedHandler=e,this.start(t)):e!==this.el&&(this.selectedHandler="",this.blur())}},{key:"calc",value:function(t){var e=void 0,n=this.opts||{},i=n.step,r=this.startDim,o=n.minDim,a=n.maxDim,l=t.delta.x,c=t.delta.y,u=r.w,h=r.h,d={t:0,l:0,w:u,h:h};if(t){var f=t.handlerAttr;~f.indexOf("r")&&(e=(0,s.normalizeFloat)(u+l*i,i),e=Math.max(o,e),a&&(e=Math.min(a,e)),d.w=e),~f.indexOf("b")&&(e=(0,s.normalizeFloat)(h+c*i,i),e=Math.max(o,e),a&&(e=Math.min(a,e)),d.h=e),~f.indexOf("l")&&(e=(0,s.normalizeFloat)(u-l*i,i),e=Math.max(o,e),a&&(e=Math.min(a,e)),d.w=e),~f.indexOf("t")&&(e=(0,s.normalizeFloat)(h-c*i,i),e=Math.max(o,e),a&&(e=Math.min(a,e)),d.h=e);var p=n.ratioDefault?!t.keys.shift:t.keys.shift;if(f.indexOf("c")<0&&p){var g=r.w/r.h;d.w/d.h>g?d.h=Math.round(d.w/g):d.w=Math.round(d.h*g)}return~f.indexOf("l")&&(d.l=r.w-d.w),~f.indexOf("t")&&(d.t=r.h-d.h),d}}}]),t}();t.exports={init:function(t){return new u(t)}}},function(t,e,n){"use strict";(function(e){var n=e.$,i=function(t,e){var n=e||window,i=t.getBoundingClientRect();return{left:i.left+n.pageXOffset,top:i.top+n.pageYOffset,width:i.width,height:i.height}};t.exports={setKey:function(t,e){},getElementRect:function(t){var e=this.opts.posFetcher||"";return e?e(t,{avoidFrameOffset:1}):i(t)},init:function(t){return this.setOptions(t),this.handleMouseDown=this.handleMouseDown.bind(this),this.drag=this.drag.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this),this.setKey("up, right, down, left",this.handleKey),this},setOptions:function(t){this.opts=t||{}},focus:function(t){if(!t||t!==this.el){this.getDocumentEl(t),this.blur(),this.el=t,this.handlers=this.opts.dragHandlers||[t];var e=this.getElementRect(t);this.elRect=e,this.startTop=e.top,this.startLeft=e.left,this.getDocumentEl().on("mousedown",this.handleMouseDown)}},blur:function(){this.getDocumentEl().off("mousedown",this.handleMouseDown),this.el=null},start:function(t){this.startPos=this.getMousePos(t);var e=this.getDocumentEl();e.on("mousemove",this.drag),e.on("mouseup",this.stop);var n=this.opts.onStart;"function"==typeof n&&n(t,{docs:e,el:this.el,start:this.startPos,elRect:this.elRect}),this.drag(t)},stop:function(t){var e=this.getDocumentEl();e.off("mousemove",this.drag),e.off("mouseup",this.stop),this.lockedAxis=null;var n=this.opts.onEnd;"function"==typeof n&&n(t,{docs:e,delta:this.delta,end:{x:this.startLeft+this.delta.x,y:this.startTop+this.delta.y}})},handleMouseDown:function(t){var e=t.target;this.isHandler(e)&&this.start(t)},isHandler:function(t){var e=this.handlers;for(var n in e)if(e[n]===t)return!0;return!1},handleKey:function(t,e){switch(e.shortcut){case"up":this.move(0,-1);break;case"right":this.move(1,0);break;case"down":this.move(0,1);break;case"left":this.move(-1,0)}},getDocumentEl:function(t){var t=t||this.el;if(!this.$doc){var e=[document];t&&e.push(t.ownerDocument),this.$doc=n(e)}return this.$doc},getMousePos:function(t){var e=this.opts.mousePosFetcher;return e?e(t):{x:t.clientX,y:t.clientY}},drag:function(t){var e=this.lockedAxis,n=this.getMousePos(t),i={x:n.x-this.startPos.x,y:n.y-this.startPos.y};if(t.shiftKey){if(!e){var r=i.x,o=i.y,s=Math.abs(r),a=Math.abs(o);o>=s||o<=-s?e="x":(r>a||r<-a)&&(e="y")}}else e=null;"x"===e&&(i.x=this.startPos.x),"y"===e&&(i.y=this.startPos.y),this.lockedAxis=e,this.delta=i,this.move(i.x,i.y);var l=this.opts.onDrag;"function"==typeof l&&l(t,{delta:i,current:{x:this.startLeft+i.x,y:this.startTop+i.y},lockedAxis:e}),0===t.which&&this.stop(t)},move:function(t,e){this.moveX(t),this.moveY(e)},moveX:function(t){var e=this.el,n=(this.opts,this.startLeft+t),i=this.opts.setX;"function"==typeof i?i(n,{el:e,start:this.startLeft,delta:t}):e.style.left=n+"px"},moveY:function(t){var e=this.el,n=(this.opts,this.startTop+t),i=this.opts.setY;"function"==typeof i?i(n,{el:e,start:this.startTop,delta:t}):e.style.top=n+"px"}}}).call(e,n(0))},function(t,e,n){"use strict";var i="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=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=n(1),s=n(23);t.exports=function(){var t=void 0,e=void 0,n={},a={defaults:{"core:undo":{keys:"⌘+z, ctrl+z",handler:"core:undo"},"core:redo":{keys:"⌘+shift+z, ctrl+shift+z",handler:"core:redo"},"core:copy":{keys:"⌘+c, ctrl+c",handler:"core:copy"},"core:paste":{keys:"⌘+v, ctrl+v",handler:"core:paste"}}};return{keymaster:s,name:"Keymaps",getConfig:function(){return e},init:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=r({},a,n),t=e.em,this.em=t,this},onLoad:function(){var t=e.defaults;for(var n in t){var i=t[n];this.add(n,i.keys,i.handler)}},add:function(t,e,r){var a=this.em,l=a.get("Commands"),c=a.getEditor(),u={id:t,keys:e,handler:r},h=n[t];return h&&this.remove(t),n[t]=u,s(e,function(e,n){r=(0,o.isString)(r)?l.get(r):r,"object"==("undefined"==typeof r?"undefined":i(r))?r.run(c):r(c);var s=[t,n.shortcut,e];a.trigger.apply(a,["keymap:emit"].concat(s)),a.trigger.apply(a,["keymap:emit:"+t].concat(s))}),a.trigger("keymap:add",u),u},get:function(t){return n[t]},getAll:function(){return n},remove:function(t){var e=this.em,i=this.get(t);if(i)return delete n[t],s.unbind(i.keys),e&&e.trigger("keymap:remove",i),i}}}},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=n(69),s=i(o);t.exports=function(){var t=void 0,e=void 0,n=void 0,i=void 0,o={};return{name:"UndoManager",init:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n=r({},a,o),t=n.em,this.em=t,e=new s["default"]({track:!0,register:[]}),e.changeUndoType("change",{condition:!1}),e.changeUndoType("add",{on:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.avoidStore)return{object:e,before:void 0,after:t,options:r({},n)}}}),e.changeUndoType("remove",{on:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.avoidStore)return{object:e,before:t,after:void 0,options:r({},n)}}});var l={on:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!i&&(i=t.previousAttributes()),!n.avoidStore){var r={object:t,before:i,after:t.toJSON()};return i=null,r}},undo:function(t,e,n,i){t.set(e)},redo:function(t,e,n,i){t.set(n)}},c=["style","attributes","content","src"];return c.forEach(function(t){return e.addUndoType("change:"+t,l)}),e.on("undo redo",function(){return t.trigger("change:selectedComponent change:canvasOffset")}),["undo","redo"].forEach(function(n){return e.on(n,function(){return t.trigger(n)})}),this},getConfig:function(){return n},add:function(t){return e.register(t),this},remove:function(t){return e.unregister(t),this},removeAll:function(){return e.unregisterAll(),this},start:function(){return e.startTracking(),this},stop:function(){return e.stopTracking(),this},undo:function(){return t.get("Canvas").isInputFocused()||e.undo(1),this},undoAll:function(){return e.undoAll(),this},redo:function(){return t.get("Canvas").isInputFocused()||e.redo(1),this},redoAll:function(){return e.redoAll(),this},hasUndo:function(){return e.isAvailable("undo")},hasRedo:function(){return e.isAvailable("redo")},getStack:function(){return e.stack},clear:function(){return e.clear(),this},getInstance:function(){return e}}}},function(t,e,n){var i,r,o;!function(s){r=[n(1),n(70)],i=s,o="function"==typeof i?i.apply(e,r):i,!(void 0!==o&&(t.exports=o))}(function(t,e){function n(t,e,n){return n.length<=4?t.call(e,n[0],n[1],n[2],n[3]):t.apply(e,n)}function i(t,e){return f.call(t,e)}function r(e,n){return null!=e&&(t.isArray(n)||(n=i(arguments,1)),t.all(n,function(t){return t in e}))}function o(){this.registeredObjects=[],this.cidIndexes=[]}function s(e,n,i,r){for(var o,s=0,a=n.length;s<a;s++)if(o=n[s]){if("on"===e){if(!r.objectRegistry.register(o))continue}else if(!r.objectRegistry.unregister(o))continue;t.isFunction(o[e])&&o[e]("all",i,r)}}function a(e,n){var i=n.type,r=n.undoTypes,o=!r[i]||r[i][e];t.isFunction(o)&&o(n.object,n.before,n.after,n.options)}function l(e,n,i,r,o){if(!(i.isCurrentlyUndoRedoing||"undo"===e&&i.pointer===-1||"redo"===e&&i.pointer===i.length-1)){i.isCurrentlyUndoRedoing=!0;var s,a,l="undo"===e;for(o?a=l&&i.pointer===i.length-1||!l&&i.pointer===-1?t.clone(i.models):f.apply(i.models,l?[0,i.pointer]:[i.pointer,i.length-1]):(s=i.at(l?i.pointer:i.pointer+1),a=r?i.where({magicFusionIndex:s.get("magicFusionIndex")}):[s]),i.pointer+=(l?-1:1)*a.length;s=l?a.pop():a.shift();)s[e]();i.isCurrentlyUndoRedoing=!1,n.trigger(e,n)}}function c(t,e){var i=t.condition,r=typeof i;return"function"===r?!!n(i,t,e):"boolean"!==r||i}function u(t,e,i,o){if(t.track&&!t.isCurrentlyUndoRedoing&&e in o&&c(o[e],i)){var s,a=n(o[e].on,o[e],i);if(r(a,"object","before","after")){if(a.type=e,a.magicFusionIndex=p(),a.undoTypes=o,t.pointer<t.length-1)for(var s=t.length-t.pointer-1;s--;)t.pop();t.pointer=t.length,t.add(a),t.length>t.maximumStackLength&&(t.shift(),t.pointer--)}}}function h(){}function d(e,n,i,o){if("object"==typeof n)return t.each(n,function(t,n){2===e?d(e,t,i,o):d(e,n,t,i)});switch(e){case 0:r(i,"undo","redo","on")&&t.all(t.pick(i,"undo","redo","on"),t.isFunction)&&(o[n]=i);break;case 1:o[n]&&t.isObject(i)&&(o[n]=t.extend({},o[n],i));break;case 2:delete o[n]}return this}var f=Array.prototype.slice,p=function(){function e(){i++,n=!0,t.defer(function(){n=!1})}var n=!1,i=-1;return function(){return n||e(),i}}();o.prototype={isRegistered:function(e){return e&&e.cid?this.registeredObjects[e.cid]:t.contains(this.registeredObjects,e)},register:function(t){return!this.isRegistered(t)&&(t&&t.cid?(this.registeredObjects[t.cid]=t,this.cidIndexes.push(t.cid)):this.registeredObjects.push(t),!0)},unregister:function(e){if(this.isRegistered(e)){if(e&&e.cid)delete this.registeredObjects[e.cid],this.cidIndexes.splice(t.indexOf(this.cidIndexes,e.cid),1);else{var n=t.indexOf(this.registeredObjects,e);this.registeredObjects.splice(n,1)}return!0}return!1},get:function(){return t.map(this.cidIndexes,function(t){return this.registeredObjects[t]},this).concat(this.registeredObjects)}};var g={add:{undo:function(t,e,n,i){t.remove(n,i)},redo:function(t,e,n,i){i.index&&(i.at=i.index),t.add(n,i)},on:function(e,n,i){return{object:n,before:void 0,after:e,options:t.clone(i)}}},remove:{undo:function(t,e,n,i){"index"in i&&(i.at=i.index),t.add(e,i)},redo:function(t,e,n,i){t.remove(e,i)},on:function(e,n,i){return{object:n,before:e,after:void 0,options:t.clone(i)}}},change:{undo:function(e,n,i,r){t.isEmpty(n)?t.each(t.keys(i),e.unset,e):(e.set(n),r&&r.unsetData&&r.unsetData.before&&r.unsetData.before.length&&t.each(r.unsetData.before,e.unset,e))},redo:function(e,n,i,r){t.isEmpty(i)?t.each(t.keys(n),e.unset,e):(e.set(i),r&&r.unsetData&&r.unsetData.after&&r.unsetData.after.length&&t.each(r.unsetData.after,e.unset,e))},on:function(e,n){var i=e.changedAttributes(),r=t.keys(i),o=t.pick(e.previousAttributes(),r),s=t.keys(o),a=(n||(n={})).unsetData={after:[],before:[]};return r.length!=s.length&&(r.length>s.length?t.each(r,function(t){t in o||a.before.push(t)},this):t.each(s,function(t){t in i||a.after.push(t)})),{object:e,before:o,after:i,options:t.clone(n)}}},reset:{undo:function(t,e,n){t.reset(e)},redo:function(t,e,n){t.reset(n)},on:function(e,n){return{object:e,before:n.previousModels,after:t.clone(e.models)}}}};h.prototype=g;var v=e.Model.extend({defaults:{type:null,object:null,before:null,after:null,magicFusionIndex:null},undo:function(t){a("undo",this.attributes)},redo:function(t){a("redo",this.attributes)}}),m=e.Collection.extend({model:v,pointer:-1,track:!1,isCurrentlyUndoRedoing:!1,maximumStackLength:1/0,setMaxLength:function(t){this.maximumStackLength=t}}),y=e.Model.extend({defaults:{maximumStackLength:1/0,track:!1},initialize:function(e){this.stack=new m,this.objectRegistry=new o,this.undoTypes=new h,this.stack.setMaxLength(this.get("maximumStackLength")),this.on("change:maximumStackLength",function(t,e){this.stack.setMaxLength(e)},this),e&&e.track&&this.startTracking(),e&&e.register&&(t.isArray(e.register)||t.isArguments(e.register)?n(this.register,this,e.register):this.register(e.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(t){u(this.stack,t,i(arguments,1),this.undoTypes)},register:function(){s("on",arguments,this._addToStack,this)},unregister:function(){s("off",arguments,this._addToStack,this)},unregisterAll:function(){n(this.unregister,this,this.objectRegistry.get())},undo:function(t){l("undo",this,this.stack,t)},undoAll:function(){l("undo",this,this.stack,!1,!0)},redo:function(t){l("redo",this,this.stack,t)},redoAll:function(){l("redo",this,this.stack,!1,!0)},isAvailable:function(t){var e=this.stack,n=e.length;switch(t){case"undo":return n>0&&e.pointer>-1;case"redo":return n>0&&e.pointer<n-1;default:return!1}},merge:function(e){for(var n,r=t.isArray(e)?e:i(arguments);n=r.pop();)n instanceof y&&n.stack instanceof m&&(n.stack=this.stack)},addUndoType:function(t,e){d(0,t,e,this.undoTypes)},changeUndoType:function(t,e){d(1,t,e,this.undoTypes)},removeUndoType:function(t){d(2,t,void 0,this.undoTypes)},clear:function(){this.stack.reset(),this.stack.pointer=-1}});return t.extend(y,{defaults:function(e){t.extend(y.prototype.defaults,e)},addUndoType:function(t,e){d(0,t,e,g)},changeUndoType:function(t,e){d(1,t,e,g)},removeUndoType:function(t){d(2,t,void 0,g)}}),e.UndoManager=y})},function(t,e,n){(function(i){var r,o;!function(s){var a="object"==typeof self&&self.self==self&&self||"object"==typeof i&&i.global==i&&i;r=[n(1),n(9),e],o=function(t,e,n){a.Backbone=s(a,n,t,e)}.apply(e,r),!(void 0!==o&&(t.exports=o))}(function(t,e,n,i){var r=t.Backbone,o=[].slice;e.VERSION="1.2.1",e.$=i,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var s=function(t,e,i){switch(t){case 1:return function(){return n[e](this[i])};case 2:return function(t){return n[e](this[i],t)};case 3:return function(t,r){return n[e](this[i],t,r)};case 4:return function(t,r,o){return n[e](this[i],t,r,o)};default:return function(){var t=o.call(arguments);return t.unshift(this[i]),n[e].apply(n,t)}}},a=function(t,e,i){n.each(e,function(e,r){n[r]&&(t.prototype[r]=s(e,r,i))})},l=e.Events={},c=/\s+/,u=function(t,e,i,r,o){var s,a=0;if(i&&"object"==typeof i){void 0!==r&&"context"in o&&void 0===o.context&&(o.context=r);for(s=n.keys(i);a<s.length;a++)e=t(e,s[a],i[s[a]],o)}else if(i&&c.test(i))for(s=i.split(c);a<s.length;a++)e=t(e,s[a],r,o);else e=t(e,i,r,o);return e};l.on=function(t,e,n){return h(this,t,e,n)};var h=function(t,e,n,i,r){if(t._events=u(d,t._events||{},e,n,{context:i,ctx:t,listening:r}),r){var o=t._listeners||(t._listeners={});o[r.id]=r}return t};l.listenTo=function(t,e,i){if(!t)return this;var r=t._listenId||(t._listenId=n.uniqueId("l")),o=this._listeningTo||(this._listeningTo={}),s=o[r];if(!s){var a=this._listenId||(this._listenId=n.uniqueId("l"));s=o[r]={obj:t,objId:r,id:a,listeningTo:o,count:0}}return h(t,e,i,this,s),this};var d=function(t,e,n,i){if(n){var r=t[e]||(t[e]=[]),o=i.context,s=i.ctx,a=i.listening;a&&a.count++,r.push({callback:n,context:o,ctx:o||s,listening:a})}return t};l.off=function(t,e,n){return this._events?(this._events=u(f,this._events,t,e,{context:n,listeners:this._listeners}),this):this},l.stopListening=function(t,e,i){var r=this._listeningTo;if(!r)return this;for(var o=t?[t._listenId]:n.keys(r),s=0;s<o.length;s++){var a=r[o[s]];if(!a)break;a.obj.off(e,i,this)}return n.isEmpty(r)&&(this._listeningTo=void 0),this};var f=function(t,e,i,r){if(t){var o,s=0,a=r.context,l=r.listeners;if(e||i||a){for(var c=e?[e]:n.keys(t);s<c.length;s++){e=c[s];var u=t[e];if(!u)break;for(var h=[],d=0;d<u.length;d++){var f=u[d];i&&i!==f.callback&&i!==f.callback._callback||a&&a!==f.context?h.push(f):(o=f.listening,o&&0===--o.count&&(delete l[o.id],delete o.listeningTo[o.objId]))}h.length?t[e]=h:delete t[e]}return n.size(t)?t:void 0}for(var p=n.keys(l);s<p.length;s++)o=l[p[s]],delete l[o.id],delete o.listeningTo[o.objId]}};l.once=function(t,e,i){var r=u(p,{},t,e,n.bind(this.off,this));return this.on(r,void 0,i)},l.listenToOnce=function(t,e,i){var r=u(p,{},e,i,n.bind(this.stopListening,this,t));return this.listenTo(t,r)};var p=function(t,e,i,r){if(i){var o=t[e]=n.once(function(){r(e,o),i.apply(this,arguments)});o._callback=i}return t};l.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),n=Array(e),i=0;i<e;i++)n[i]=arguments[i+1];return u(g,this._events,t,void 0,n),this};var g=function(t,e,n,i){if(t){var r=t[e],o=t.all;r&&o&&(o=o.slice()),r&&v(r,i),o&&v(o,[e].concat(i))}return t},v=function(t,e){var n,i=-1,r=t.length,o=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++i<r;)(n=t[i]).callback.call(n.ctx);return;case 1:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o);return;case 2:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o,s);return;case 3:for(;++i<r;)(n=t[i]).callback.call(n.ctx,o,s,a);return;default:for(;++i<r;)(n=t[i]).callback.apply(n.ctx,e);return}};l.bind=l.on,l.unbind=l.off,n.extend(e,l);var m=e.Model=function(t,e){var i=t||{};e||(e={}),this.cid=n.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(i=this.parse(i,e)||{}),i=n.defaults({},i,n.result(this,"defaults")),this.set(i,e),this.changed={},this.initialize.apply(this,arguments)};n.extend(m.prototype,l,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return n.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return n.escape(this.get(t))},has:function(t){return null!=this.get(t)},matches:function(t){return!!n.iteratee(t,this)(this.attributes)},set:function(t,e,i){if(null==t)return this;var r;if("object"==typeof t?(r=t,i=e):(r={})[t]=e,i||(i={}),!this._validate(r,i))return!1;var o=i.unset,s=i.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=n.clone(this.attributes),this.changed={});var c=this.attributes,u=this.changed,h=this._previousAttributes;this.idAttribute in r&&(this.id=r[this.idAttribute]);for(var d in r)e=r[d],n.isEqual(c[d],e)||a.push(d),n.isEqual(h[d],e)?delete u[d]:u[d]=e,o?delete c[d]:c[d]=e;if(!s){a.length&&(this._pending=i);for(var f=0;f<a.length;f++)this.trigger("change:"+a[f],this,c[a[f]],i)}if(l)return this;if(!s)for(;this._pending;)i=this._pending,this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(t,e){return this.set(t,void 0,n.extend({},e,{unset:!0}))},clear:function(t){var e={};for(var i in this.attributes)e[i]=void 0;return this.set(e,n.extend({},t,{unset:!0}))},hasChanged:function(t){return null==t?!n.isEmpty(this.changed):n.has(this.changed,t)},changedAttributes:function(t){if(!t)return!!this.hasChanged()&&n.clone(this.changed);var e=this._changing?this._previousAttributes:this.attributes,i={};for(var r in t){var o=t[r];n.isEqual(e[r],o)||(i[r]=o)}return!!n.size(i)&&i},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(t){t=n.extend({parse:!0},t);var e=this,i=t.success;return t.success=function(n){var r=t.parse?e.parse(n,t):n;return!!e.set(r,t)&&(i&&i.call(t.context,e,n,t),void e.trigger("sync",e,n,t))},$(this,t),this.sync("read",this,t)},save:function(t,e,i){var r;null==t||"object"==typeof t?(r=t,i=e):(r={})[t]=e,i=n.extend({validate:!0,parse:!0},i);var o=i.wait;if(r&&!o){if(!this.set(r,i))return!1}else if(!this._validate(r,i))return!1;var s=this,a=i.success,l=this.attributes;i.success=function(t){s.attributes=l;var e=i.parse?s.parse(t,i):t;return o&&(e=n.extend({},r,e)),!(e&&!s.set(e,i))&&(a&&a.call(i.context,s,t,i),void s.trigger("sync",s,t,i))},$(this,i),r&&o&&(this.attributes=n.extend({},l,r));var c=this.isNew()?"create":i.patch?"patch":"update";"patch"!==c||i.attrs||(i.attrs=r);var u=this.sync(c,this,i);return this.attributes=l,u},destroy:function(t){t=t?n.clone(t):{};var e=this,i=t.success,r=t.wait,o=function(){e.stopListening(),e.trigger("destroy",e,e.collection,t)};t.success=function(n){r&&o(),i&&i.call(t.context,e,n,t),e.isNew()||e.trigger("sync",e,n,t)};var s=!1;return this.isNew()?n.defer(t.success):($(this,t),s=this.sync("delete",this,t)),r||o(),s},url:function(){var t=n.result(this,"urlRoot")||n.result(this.collection,"url")||R();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},n.defaults({validate:!0},t))},_validate:function(t,e){if(!e.validate||!this.validate)return!0;t=n.extend({},this.attributes,t);var i=this.validationError=this.validate(t,e)||null;return!i||(this.trigger("invalid",this,i,n.extend(e,{validationError:i})),!1)}});var y={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};a(m,y,"attributes");var b=e.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),void 0!==e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,n.extend({silent:!0},e))},x={add:!0,remove:!0,merge:!0},w={add:!0,remove:!1};n.extend(b.prototype,l,{model:m,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,n.extend({merge:!1},e,w))},remove:function(t,e){e=n.extend({},e);var i=!n.isArray(t);t=i?[t]:n.clone(t);var r=this._removeModels(t,e);return!e.silent&&r&&this.trigger("update",this,e),i?r[0]:r},set:function(t,e){e=n.defaults({},e,x),e.parse&&!this._isModel(t)&&(t=this.parse(t,e));var i=!n.isArray(t);t=i?t?[t]:[]:t.slice();var r,o,s,a,l,c=e.at;null!=c&&(c=+c),c<0&&(c+=this.length+1);for(var u=this.comparator&&null==c&&e.sort!==!1,h=n.isString(this.comparator)?this.comparator:null,d=[],f=[],p={},g=e.add,v=e.merge,m=e.remove,y=!(u||!g||!m)&&[],b=!1,w=0;w<t.length;w++){if(s=t[w],a=this.get(s))m&&(p[a.cid]=!0),v&&s!==a&&(s=this._isModel(s)?s.attributes:s,e.parse&&(s=a.parse(s,e)),a.set(s,e),u&&!l&&a.hasChanged(h)&&(l=!0)),
t[w]=a;else if(g){if(o=t[w]=this._prepareModel(s,e),!o)continue;d.push(o),this._addReference(o,e)}o=a||o,o&&(r=this.modelId(o.attributes),!y||!o.isNew()&&p[r]||(y.push(o),b=b||!this.models[w]||o.cid!==this.models[w].cid),p[r]=!0)}if(m){for(var w=0;w<this.length;w++)p[(o=this.models[w]).cid]||f.push(o);f.length&&this._removeModels(f,e)}if(d.length||b)if(u&&(l=!0),this.length+=d.length,null!=c)for(var w=0;w<d.length;w++)this.models.splice(c+w,0,d[w]);else{y&&(this.models.length=0);for(var C=y||d,w=0;w<C.length;w++)this.models.push(C[w])}if(l&&this.sort({silent:!0}),!e.silent){for(var k=null!=c?n.clone(e):e,w=0;w<d.length;w++)null!=c&&(k.index=c+w),(o=d[w]).trigger("add",o,this,k);(l||b)&&this.trigger("sort",this,e),(d.length||f.length)&&this.trigger("update",this,e)}return i?t[0]:t},reset:function(t,e){e=e?n.clone(e):{};for(var i=0;i<this.models.length;i++)this._removeReference(this.models[i],e);return e.previousModels=this.models,this._reset(),t=this.add(t,n.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),t},push:function(t,e){return this.add(t,n.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,n.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(null!=t){var e=this.modelId(this._isModel(t)?t.attributes:t);return this._byId[t]||this._byId[e]||this._byId[t.cid]}},at:function(t){return t<0&&(t+=this.length),this.models[t]},where:function(t,e){var i=n.matches(t);return this[e?"find":"filter"](function(t){return i(t.attributes)})},findWhere:function(t){return this.where(t,!0)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return t||(t={}),n.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(n.bind(this.comparator,this)),t.silent||this.trigger("sort",this,t),this},pluck:function(t){return n.invoke(this.models,"get",t)},fetch:function(t){t=n.extend({parse:!0},t);var e=t.success,i=this;return t.success=function(n){var r=t.reset?"reset":"set";i[r](n,t),e&&e.call(t.context,i,n,t),i.trigger("sync",i,n,t)},$(this,t),this.sync("read",this,t)},create:function(t,e){e=e?n.clone(e):{};var i=e.wait;if(t=this._prepareModel(t,e),!t)return!1;i||this.add(t,e);var r=this,o=e.success;return e.success=function(t,e,n){i&&r.add(t,n),o&&o.call(n.context,t,e,n)},t.save(null,e),t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(this._isModel(t))return t.collection||(t.collection=this),t;e=e?n.clone(e):{},e.collection=this;var i=new this.model(t,e);return i.validationError?(this.trigger("invalid",this,i.validationError,e),!1):i},_removeModels:function(t,e){for(var n=[],i=0;i<t.length;i++){var r=this.get(t[i]);if(r){var o=this.indexOf(r);this.models.splice(o,1),this.length--,e.silent||(e.index=o,r.trigger("remove",r,this,e)),n.push(r),this._removeReference(r,e)}}return!!n.length&&n},_isModel:function(t){return t instanceof m},_addReference:function(t,e){this._byId[t.cid]=t;var n=this.modelId(t.attributes);null!=n&&(this._byId[n]=t),t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var n=this.modelId(t.attributes);null!=n&&delete this._byId[n],this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,n,i){if("add"!==t&&"remove"!==t||n===this){if("destroy"===t&&this.remove(e,i),"change"===t){var r=this.modelId(e.previousAttributes()),o=this.modelId(e.attributes);r!==o&&(null!=r&&delete this._byId[r],null!=o&&(this._byId[o]=e))}this.trigger.apply(this,arguments)}}});var C={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:2,contains:2,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3};a(b,C,"models");var k=["groupBy","countBy","sortBy","indexBy"];n.each(k,function(t){n[t]&&(b.prototype[t]=function(e,i){var r=n.isFunction(e)?e:function(t){return t.get(e)};return n[t](this.models,r,i)})});var S=e.View=function(t){this.cid=n.uniqueId("view"),n.extend(this,n.pick(t,E)),this._ensureElement(),this.initialize.apply(this,arguments)},T=/^(\S+)\s*(.*)$/,E=["model","collection","el","id","attributes","className","tagName","events"];n.extend(S.prototype,l,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(t){return this.undelegateEvents(),this._setElement(t),this.delegateEvents(),this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t),this.el=this.$el[0]},delegateEvents:function(t){if(t||(t=n.result(this,"events")),!t)return this;this.undelegateEvents();for(var e in t){var i=t[e];if(n.isFunction(i)||(i=this[i]),i){var r=e.match(T);this.delegate(r[1],r[2],n.bind(i,this))}}return this},delegate:function(t,e,n){return this.$el.on(t+".delegateEvents"+this.cid,e,n),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(t,e,n){return this.$el.off(t+".delegateEvents"+this.cid,e,n),this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(this.el)this.setElement(n.result(this,"el"));else{var t=n.extend({},n.result(this,"attributes"));this.id&&(t.id=n.result(this,"id")),this.className&&(t["class"]=n.result(this,"className")),this.setElement(this._createElement(n.result(this,"tagName"))),this._setAttributes(t)}},_setAttributes:function(t){this.$el.attr(t)}}),e.sync=function(t,i,r){var o=M[t];n.defaults(r||(r={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var s={type:o,dataType:"json"};if(r.url||(s.url=n.result(i,"url")||R()),null!=r.data||!i||"create"!==t&&"update"!==t&&"patch"!==t||(s.contentType="application/json",s.data=JSON.stringify(r.attrs||i.toJSON(r))),r.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),r.emulateHTTP&&("PUT"===o||"DELETE"===o||"PATCH"===o)){s.type="POST",r.emulateJSON&&(s.data._method=o);var a=r.beforeSend;r.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",o),a)return a.apply(this,arguments)}}"GET"===s.type||r.emulateJSON||(s.processData=!1);var l=r.error;r.error=function(t,e,n){r.textStatus=e,r.errorThrown=n,l&&l.call(r.context,t,e,n)};var c=r.xhr=e.ajax(n.extend(s,r));return i.trigger("request",i,c,r),c};var M={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var P=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},A=/\((.*?)\)/g,O=/(\(\?)?:\w+/g,L=/\*\w+/g,N=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(P.prototype,l,{initialize:function(){},route:function(t,i,r){n.isRegExp(t)||(t=this._routeToRegExp(t)),n.isFunction(i)&&(r=i,i=""),r||(r=this[i]);var o=this;return e.history.route(t,function(n){var s=o._extractParameters(t,n);o.execute(r,s,i)!==!1&&(o.trigger.apply(o,["route:"+i].concat(s)),o.trigger("route",i,s),e.history.trigger("route",o,i,s))}),this},execute:function(t,e,n){t&&t.apply(this,e)},navigate:function(t,n){return e.history.navigate(t,n),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var t,e=n.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(N,"\\$&").replace(A,"(?:$1)?").replace(O,function(t,e){return e?t:"([^/?]+)"}).replace(L,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return n.map(i,function(t,e){return e===i.length-1?t||null:t?decodeURIComponent(t):null})}});var D=e.History=function(){this.handlers=[],n.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},I=/^[#\/]|\s+$/g,_=/^\/+|\/+$/g,F=/#.*$/;D.started=!1,n.extend(D.prototype,l,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname),e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===t.charAt(0)?t.slice(1):t},getFragment:function(t){return null==t&&(t=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),t.replace(I,"")},start:function(t){if(D.started)throw new Error("Backbone.history has already been started");if(D.started=!0,this.options=n.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window,this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(_,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var i=document.body,r=i.insertBefore(this.iframe,i.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var o=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),D.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e!==this.fragment&&(this.iframe&&this.navigate(e),void this.loadUrl())},loadUrl:function(t){return!!this.matchRoot()&&(t=this.fragment=this.getFragment(t),n.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0}))},navigate:function(t,e){if(!D.started)return!1;e&&e!==!0||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;""!==t&&"?"!==t.charAt(0)||(n=n.slice(0,-1)||"/");var i=n+t;if(t=this.decodeFragment(t.replace(F,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var r=this.iframe.contentWindow;e.replace||(r.document.open(),r.document.close()),this._updateHash(r.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var i=t.href.replace(/(javascript:|#).*$/,"");t.replace(i+"#"+e)}else t.hash="#"+e}}),e.history=new D;var z=function(t,e){var i,r=this;i=t&&n.has(t,"constructor")?t.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,e);var o=function(){this.constructor=i};return o.prototype=r.prototype,i.prototype=new o,t&&n.extend(i.prototype,t),i.__super__=r.prototype,i};m.extend=b.extend=P.extend=S.extend=D.extend=z;var R=function(){throw new Error('A "url" property or function must be specified')},$=function(t,e){var n=e.error;e.error=function(i){n&&n.call(e.context,t,i,e),t.trigger("error",t,i,e)}};return e})}).call(e,n(16))},function(t,e,n){"use strict";t.exports=function(){var t={},e=n(72),i=n(73),r=n(74),o={},s={};return{name:"StorageManager",init:function(n){t=n||{};for(var o in e)o in t||(t[o]=e[o]);return s.remote=new r(t),s.local=new i(t),t.currentStorage=t.type,this.loadDefaultProviders().setCurrent(t.type),this},isAutosave:function(){return!!t.autosave},setAutosave:function(e){return t.autosave=!!e,this},getStepsBeforeSave:function(){return t.stepsBeforeSave},setStepsBeforeSave:function(e){return t.stepsBeforeSave=e,this},add:function(t,e){return o[t]=e,this},get:function(t){return o[t]||null},getStorages:function(){return o},getCurrent:function(){return t.currentStorage},setCurrent:function(e){return t.currentStorage=e,this},store:function(e,n){var i=this.get(this.getCurrent()),r={};for(var o in e)r[t.id+o]=e[o];return i?i.store(r,n):null},load:function(e,n){var i=this.get(this.getCurrent()),r=[],o={};"string"==typeof e&&(e=[e]);for(var s=0,a=e.length;s<a;s++)r.push(t.id+e[s]);i&&i.load(r,function(e){var i=new RegExp("^"+t.id);for(var r in e){var s=r.replace(i,"");o[s]=e[r]}n&&n(o)})},loadDefaultProviders:function(){for(var t in s)this.add(t,s[t]);return this},getConfig:function(){return t}}}},function(t,e,n){"use strict";t.exports={id:"gjs-",autosave:1,autoload:1,type:"local",stepsBeforeSave:1,storeComponents:1,storeStyles:1,storeHtml:1,storeCss:1,checkLocal:1,params:{},headers:{},urlStore:"",urlLoad:"",beforeSend:function(t,e){},onComplete:function(t,e){},contentTypeJson:!1}},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({defaults:{checkLocal:!0},store:function(t,e){this.checkStorageEnvironment();for(var n in t)localStorage.setItem(n,t[n]);"function"==typeof e&&e()},load:function(t,e){this.checkStorageEnvironment();for(var n={},i=0,r=t.length;i<r;i++){var o=localStorage.getItem(t[i]);o&&(n[t[i]]=o)}return"function"==typeof e&&e(n),n},remove:function(t){this.checkStorageEnvironment();for(var e=0,n=t.length;e<n;e++)localStorage.removeItem(t[e])},checkStorageEnvironment:function(){this.get("checkLocal")&&!localStorage}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=n(24),o=i(r),s=n(1);t.exports=n(0).Model.extend({fetch:o["default"],defaults:{urlStore:"",urlLoad:"",params:{},beforeSend:function(){},onComplete:function(){},contentTypeJson:!1},onStart:function(){var t=this.get("em"),e=this.get("beforeSend");e&&e(),t&&t.trigger("storage:start")},onError:function(t){var e=this.get("em");e&&e.trigger("storage:error",t),this.onEnd(t)},onEnd:function(t){var e=this.get("em");e&&e.trigger("storage:end",t)},onResponse:function(t,e){var n=this.get("em"),i=this.get("onComplete"),r=this.get("contentTypeJson"),o=t&&"string"==typeof t,s=r&&o?JSON.parse(t):t;i&&i(s),e&&e(s),n&&n.trigger("storage:response",s),this.onEnd(t)},store:function(t,e){var n={};for(var i in t)n[i]=t[i];this.request(this.get("urlStore"),{body:n},e)},load:function(t,e){this.request(this.get("urlLoad"),{method:"get"},e)},request:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.get("contentTypeJson"),o=this.get("headers")||{},a=this.get("params"),l="X-Requested-With",c="Content-Type",u=n.body||{},h=void 0,d=void 0;for(var f in a)u[f]=a[f];if((0,s.isUndefined)(o[l])&&(o[l]="XMLHttpRequest"),(0,s.isUndefined)(o[c])&&r&&(o[c]="application/json; charset=utf-8"),r)d=JSON.stringify(u);else{d=new FormData;for(var p in u)d.append(p,u[p])}h={method:n.method||"post",credentials:"include",headers:o},"post"===h.method&&(h.body=d),this.onStart(),this.fetch(t,h).then(function(t){return 1==(t.status/200|0)?t.text():t.text().then(function(t){return Promise.reject(t)})}).then(function(t){return e.onResponse(t,i)})["catch"](function(t){return e.onError(t)})}})},function(t,e,n){(function(e){!function(n){function i(){}function r(t,e){return function(){t.apply(e,arguments)}}function o(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function s(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void o._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._state?a:l)(e.promise,t._value);var i;try{i=n(t._value)}catch(r){return void l(e.promise,r)}a(e.promise,i)}))}function a(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof o)return t._state=3,t._value=e,void c(t);if("function"==typeof n)return void h(r(n,e),t)}t._state=1,t._value=e,c(t)}catch(i){l(t,i)}}function l(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn(function(){t._handled||o._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)s(t,t._deferreds[e]);t._deferreds=null}function u(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function h(t,e){var n=!1;try{t(function(t){n||(n=!0,a(e,t))},function(t){n||(n=!0,l(e,t))})}catch(i){if(n)return;n=!0,l(e,i)}}var d=setTimeout;o.prototype["catch"]=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(i);return s(this,new u(t,e,n)),n},o.all=function(t){var e=Array.prototype.slice.call(t);return new o(function(t,n){function i(o,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){i(o,t)},n)}e[o]=s,0===--r&&t(e)}catch(l){n(l)}}if(0===e.length)return t([]);for(var r=e.length,o=0;o<e.length;o++)i(o,e[o])})},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o(function(e){e(t)})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){for(var i=0,r=t.length;i<r;i++)t[i].then(e,n)})},o._immediateFn="function"==typeof e&&function(t){e(t)}||function(t){d(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console},o._setImmediateFn=function(t){o._immediateFn=t},o._setUnhandledRejectionFn=function(t){o._unhandledRejectionFn=t},"undefined"!=typeof t&&t.exports?t.exports=o:n.Promise||(n.Promise=o)}(this)}).call(e,n(76).setImmediate)},function(t,e,n){function i(t,e){this._id=t,this._clearFn=e}var r=Function.prototype.apply;e.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(77),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function i(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return g[p]=i,f(p),p++}function r(t){delete g[t]}function o(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(n,i)}}function s(t){if(v)setTimeout(s,0,t);else{var e=g[t];if(e){v=!0;try{o(e)}finally{r(t),v=!1}}}}function a(){f=function(t){e.nextTick(function(){s(t)})}}function l(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}function c(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&s(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),f=function(n){t.postMessage(e+n,"*")}}function u(){var t=new MessageChannel;t.port1.onmessage=function(t){var e=t.data;s(e)},f=function(e){t.port2.postMessage(e)}}function h(){var t=m.documentElement;f=function(e){var n=m.createElement("script");n.onreadystatechange=function(){s(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}function d(){f=function(t){setTimeout(s,0,t)}}if(!t.setImmediate){var f,p=1,g={},v=!1,m=t.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(t);y=y&&y.setTimeout?y:t,"[object process]"==={}.toString.call(t.process)?a():l()?c():t.MessageChannel?u():m&&"onreadystatechange"in m.createElement("script")?h():d(),y.setImmediate=i,y.clearImmediate=r}}("undefined"==typeof self?"undefined"==typeof t?this:t:self)}).call(e,n(16),n(78))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function r(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function o(t){if(h===clearTimeout)return clearTimeout(t);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){g&&f&&(g=!1,f.length?p=f.concat(p):v=-1,p.length&&a())}function a(){if(!g){var t=r(s);g=!0;for(var e=p.length;e;){for(f=p,p=[];++v<e;)f&&f[v].run();v=-1,e=p.length}f=null,g=!1,o(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var u,h,d=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{h="function"==typeof clearTimeout?clearTimeout:i}catch(t){h=i}}();var f,p=[],g=!1,v=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.push(new l(t,e)),1!==p.length||g||r(a)},l.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){"use strict";t.exports=function(){var t,e,i={},r=n(80),o=n(81),s=n(83);return{name:"DeviceManager",init:function(n){i=n||{};for(var a in r)a in i||(i[a]=r[a]);return t=new o(i.devices),e=new s({collection:t,config:i}),this},add:function(e,n,i){var r=i||{};return r.name=e,r.width=n,t.add(r)},get:function(e){return t.get(e)},getAll:function(){return t},render:function(){return e.render().el}}}},function(t,e,n){"use strict";t.exports={devices:[],deviceLabel:"Device"}},function(t,e,n){"use strict";var i=n(0),r=n(82);t.exports=i.Collection.extend({model:r})},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({idAttribute:"name",defaults:{name:"",width:"",height:"",widthMedia:null},initialize:function(){null==this.get("widthMedia")&&this.set("widthMedia",this.get("width"))}})},function(t,e,n){"use strict";(function(e){var i=n(0);t.exports=i.View.extend({template:e.template('\n <div class="<%= ppfx %>device-label"><%= deviceLabel %></div>\n <div class="<%= ppfx %>field <%= ppfx %>select">\n <span id="<%= ppfx %>input-holder">\n <select class="<%= ppfx %>devices"></select>\n </span>\n <div class="<%= ppfx %>sel-arrow">\n <div class="<%= ppfx %>d-s-arrow"></div>\n </div>\n </div>\n <button style="display:none" class="<%= ppfx %>add-trasp">+</button>'),events:{change:"updateDevice"},initialize:function(t){this.config=t.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 t=this.em;if(t){var e=this.devicesEl,n=e?e.val():"";t.set("device",n)}},updateSelect:function(){var t=this.em,e=this.devicesEl;if(t&&t.getDeviceModel&&e){var n=t.getDeviceModel(),i=n?n.get("name"):"";e.val(i)}},getOptions:function(){var t="";return this.collection.each(function(e){var n=e.get("name");t+='<option value="'+n+'">'+n+"</option>"}),t},render:function(){var t=this.ppfx;return this.$el.html(this.template({ppfx:t,deviceLabel:this.config.deviceLabel})),this.devicesEl=this.$el.find("."+t+"devices"),this.devicesEl.append(this.getOptions()),this.el.className=t+"devices-c",this}})}).call(e,n(1))},function(t,e,n){"use strict";t.exports=function(){var t,e,i={},r=n(85),o=n(86),s=n(25);return{compTypes:"",name:"Parser",init:function(n){i=n||{};for(var a in r)a in i||(i[a]=r[a]);return t=new s(i),e=new o(i),this},parseHtml:function(n){return t.compTypes=this.compTypes,t.parse(n,e)},parseCss:function(t){return e.parse(t)}}}},function(t,e,n){"use strict";t.exports={textTags:["br","b","i","u","a","ul","ol"]}},function(t,e,n){"use strict";var i=n(1),r={4:"media",5:"font-face",6:"page",7:"keyframes",11:"counter-style",12:"supports",13:"document",14:"font-feature-values",15:"viewport"},o=(0,i.keys)(r),s=["5","6","11","15"];t.exports=function(t){return{parseSelector:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=[],n=[],i=t.split(","),r=0,o=i.length;r<o;r++){var s=i[r].trim();if(/^(\.{1}[\w\-]+)+(:{1,2}[\w\-()]+)?$/gi.test(s)){var a=s.split(".").filter(Boolean);n.push(a)}else e.push(s)}return{result:n,add:e}},parseStyle:function(t){for(var e=t.style,n={},i=0,r=e.length;i<r;i++){var o=e[i],s=e.getPropertyValue(o),a=e.getPropertyPriority(o);n[o]=""+s+(a?" !"+a:"")}return n},parseCondition:function(t){var e=t.conditionText||t.media&&t.media.mediaText||t.name||t.selectorText||"";return e.trim()},parseNode:function(t){for(var e=[],n=t.cssRules||[],i=0,a=n.length;i<a;i++){var l=n[i],c=l.type.toString(),u=0,h="",d="",f=l.selectorText||l.keyText,p=s.indexOf(c)>=0;if(p)u=1,h=r[c],d=this.parseCondition(l);else if(o.indexOf(c)>=0){var g=this.parseNode(l);d=this.parseCondition(l);for(var v=0,m=g.length;v<m;v++){var y=g[v];d&&(y.mediaText=d),y.atRuleType=r[c]}e=e.concat(g)}if(f||p){var b=this.parseStyle(l),x=this.parseSelector(f),w=x.add;f=x.result;for(var C=void 0,k=0,S=f.length;k<S;k++){var T=f[k],E={};u&&(E.singleAtRule=u),h&&(E.atRuleType=h);var M=T[T.length-1].split(/:(.+)/);M[1]&&(T[T.length-1]=M[0],E.state=M[1],M.splice(M.length-1,1)),E.selectors=T,E.style=b,C=E,e.push(E)}if(w.length){var P=w.join(", ");if(C)C.selectorsAdd=P;else{var A={selectors:[],selectorsAdd:P,style:b};u&&(A.singleAtRule=u),h&&(A.atRuleType=h),d&&(A.mediaText=d),e.push(A)}}}}return e},parse:function(t){var e=document.createElement("style");e.innerHTML=t,document.head.appendChild(e);var n=e.sheet;document.head.removeChild(e);var i=this.parseNode(n);return 1==i.length?i[0]:i}}}},function(t,e,n){"use strict";var i="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=n(1);t.exports=function(t){var e,o,s=t||{},a=n(88),l=n(7),c=n(10),u=n(89);return{Selector:l,Selectors:c,name:"SelectorManager",init:function(t){s=t||{};for(var n in a)n in s||(s[n]=a[n]);var i=s.em,r=s.pStylePrefix;return r&&(s.stylePrefix=r+s.stylePrefix),o=new u({collection:new c([],{em:i,config:s}),config:s}),e=new c(s.selectors),e.on("add",function(t){return i.trigger("selector:add",t)}),this},add:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"==("undefined"==typeof t?"undefined":i(t))?n=t:n.name=t,n.label&&!n.name&&(n.name=l.escapeName(n.label));var r=n.name,o=r?this.get(r,n.type):e.where(n)[0];return o?o:e.add(n)},addClass:function(t){var n=[];return(0,r.isString)(t)&&(t=t.trim().split(" ")),t.forEach(function(t){return n.push(e.add({name:t}))}),n},get:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.TYPE_CLASS;return e.where({name:t,type:n})[0]},getAll:function(){return e},render:function(t){if(t){var e=new u({collection:new c(t),config:s});return e.render().el}return o.render().el}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"clm-",selectors:[],label:"Classes",statesLabel:"- State -",selectedLabel:"Selected",states:[{name:"hover",label:"Hover"},{name:"active",label:"Click"},{name:"nth-of-type(2n)",label:"Even/Odd"}]}},function(t,e,n){"use strict";(function(e){var i=n(0),r=n(90);t.exports=i.View.extend({template:e.template('\n <div id="<%= pfx %>up">\n <div id="<%= pfx %>label"><%= label %></div>\n <div id="<%= pfx %>status-c">\n <span id="<%= pfx %>input-c">\n <div class="<%= ppfx %>field <%= ppfx %>select">\n <span id="<%= ppfx %>input-holder">\n <select id="<%= pfx %>states">\n <option value=""><%= statesLabel %></option>\n </select>\n </span>\n <div class="<%= ppfx %>sel-arrow">\n <div class="<%= ppfx %>d-s-arrow"></div>\n </div>\n </div>\n </span>\n </div>\n </div>\n <div id="<%= pfx %>tags-field" class="<%= ppfx %>field">\n <div id="<%= pfx %>tags-c"></div>\n <input id="<%= pfx %>new" />\n <span id="<%= pfx %>add-tag" class="fa fa-plus"></span>\n </div>\n <div id="<%= pfx %>sel-help">\n <div id="<%= pfx %>label"><%= selectedLabel %></div>\n <div id="<%= pfx %>sel"></div>\n <div style="clear:both"></div>\n </div>'),events:{},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config=t.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.em=this.target,this.listenTo(this.target,"change:selectedComponent",this.componentChanged),this.listenTo(this.target,"component:update:classes",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(t){this.updateStateVis()},getStateOptions:function(){for(var t="",e=0;e<this.states.length;e++)t+='<option value="'+this.states[e].name+'">'+this.states[e].label+"</option>";
return t},addNew:function(t){this.addToClasses(t)},startNewTag:function(t){this.$addBtn.get(0).style.display="none",this.$input.show().focus()},endNewTag:function(t){this.$addBtn.get(0).style.display="",this.$input.hide().val("")},onInputKeyUp:function(t){13===t.keyCode?this.addNewTag(this.$input.val()):27===t.keyCode&&this.endNewTag()},componentChanged:function(t){this.compTarget=this.target.get("selectedComponent");var e=this.compTarget,n=[];e&&(this.getStates().val(e.get("state")),n=e.get("classes").getValid()),this.collection.reset(n),this.updateStateVis()},updateStateVis:function(){var t=this.em,e=t&&t.getConfig("avoidInlineStyle");this.collection.length||e?this.getStatesC().css("display","block"):this.getStatesC().css("display","none"),this.updateSelector()},updateSelector:function(){var t=this.target.getSelected();if(this.compTarget=t,t&&t.get){var e=t.get("state"),n=this.collection,i=n.getFullString(n.getStyleable());i=i||"#"+t.getId(),i+=e?":"+e:"";var r=this.el.querySelector("#"+this.pfx+"sel");r&&(r.innerHTML=i)}},stateChanged:function(t){this.compTarget&&(this.compTarget.set("state",this.$states.val()),this.updateSelector())},addNewTag:function(t){var e=this.target,n=this.compTarget;if(t.trim()){if(e){var i=e.get("SelectorManager"),r=i.add({label:t});if(n){var o=n.get("classes");o.length;o.add(r);o.length;this.collection.add(r),this.updateStateVis()}}this.endNewTag()}},addToClasses:function(t,e){var n=e||null,i=new r({model:t,config:this.config,coll:this.collection}),o=i.render().el;return n?n.appendChild(o):this.getClasses().append(o),o},renderClasses:function(){var t=document.createDocumentFragment();return this.collection.each(function(e){this.addToClasses(e,t)},this),this.getClasses()&&this.getClasses().empty().append(t),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(){var t=this.config;return this.$el.html(this.template({selectedLabel:t.selectedLabel,statesLabel:t.statesLabel,label:t.label,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}})}).call(e,n(1))},function(t,e,n){"use strict";var i=n(7),r="contentEditable";t.exports=n(0).View.extend({template:function(){var t=this.pfx,e=(this.ppfx,this.model.get("label")||"");return'\n <span id="'+t+'checkbox" class="fa" data-tag-status></span>\n <span id="'+t+'tag-label" data-tag-name>'+e+'</span>\n <span id="'+t+'close" data-tag-remove>\n &Cross;\n </span>\n '},events:{"click [data-tag-remove]":"removeTag","click [data-tag-status]":"changeStatus","dblclick [data-tag-name]":"startEditTag","focusout [data-tag-name]":"endEditTag"},initialize:function(t){this.config=t.config||{},this.coll=t.coll||null,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=this.config.em,this.listenTo(this.model,"change:active",this.updateStatus)},getInputEl:function(){return this.inputEl||(this.inputEl=this.el.querySelector("[data-tag-name]")),this.inputEl},startEditTag:function(){var t=this.getInputEl();t[r]=!0,t.focus()},endEditTag:function(){var t=this.model,e=this.getInputEl(),n=e.textContent,o=i.escapeName(n),s=this.target,a=s&&s.get("SelectorManager");e[r]=!1,a&&(a.get(o)?e.innerText=t.get("label"):t.set({name:o,label:n}))},changeStatus:function(){this.model.set("active",!this.model.get("active"))},removeTag:function(t){var e=this,n=this.target,i=this.model,r=this.coll,o=(this.el,n&&n.get("selectedComponent"));o&&o.get&o.get("classes").remove(i),r&&r.remove(i),setTimeout(function(){return e.remove()},0)},updateStatus:function(){var t="fa-check-square-o",e="fa-square-o";this.$chk||(this.$chk=this.$el.find("#"+this.pfx+"checkbox")),this.model.get("active")?(this.$chk.removeClass(e).addClass(t),this.$el.removeClass("opac50")):(this.$chk.removeClass(t).addClass(e),this.$el.addClass("opac50"))},render:function(){var t=this.pfx,e=this.ppfx;return this.$el.html(this.template()),this.$el.attr("class",t+"tag "+e+"three-bg"),this.updateStatus(),this}})},function(t,e,n){"use strict";t.exports=function(){var t,e,i={},r=n(92),o=n(93),s=n(94);return{name:"Modal",init:function(n){i=n||{};for(var a in r)a in i||(i[a]=r[a]);var l=i.pStylePrefix;return l&&(i.stylePrefix=l+i.stylePrefix),t=new o(i),e=new s({model:t,config:i}),this},postRender:function(t){this.render().appendTo(t.el)},open:function(){return e.show(),this},close:function(){return e.hide(),this},isOpen:function(){return!!t.get("open")},setTitle:function(e){return t.set("title",e),this},getTitle:function(){return t.get("title")},setContent:function(e){return t.set("content"," "),t.set("content",e),this},getContent:function(){return t.get("content")},getContentEl:function(){return e.getContent().get(0)},getModel:function(){return t},render:function(){return e.render().$el}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"mdl-",title:"",content:"",backdrop:!0}},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({defaults:{title:"",content:"",open:!1}})},function(t,e,n){"use strict";t.exports=n(0).View.extend({template:function(t){var e=t.pfx,n=t.ppfx,i=t.content,r=t.title;return'<div class="'+e+"dialog "+n+'one-bg">\n <div class="'+e+'header">\n <div class="'+e+'title">'+r+'</div>\n <div class="'+e+'btn-close">&Cross;</div>\n </div>\n <div class="'+e+'content">\n <div id="'+e+'c">'+i+'</div>\n <div style="clear:both"></div>\n </div>\n </div>\n <div class="'+e+'backlayer"></div>\n <div class="'+e+'collector" style="display: none"></div>'},events:{},initialize:function(t){var e=this.model,n=t.config||{},i=n.stylePrefix||"",r=n.backdrop;this.config=n,this.pfx=i,this.ppfx=n.pStylePrefix||"",this.listenTo(e,"change:open",this.updateOpen),this.listenTo(e,"change:title",this.updateTitle),this.listenTo(e,"change:content",this.updateContent),this.events["click ."+i+"btn-close"]="hide",r&&(this.events["click ."+i+"backlayer"]="hide"),this.delegateEvents()},getCollector:function(){return this.$collector||(this.$collector=this.$el.find("."+this.pfx+"collector")),this.$collector},getContent:function(){var t=this.pfx;return this.$content||(this.$content=this.$el.find("."+t+"content #"+t+"c")),this.$content},getTitle:function(){return this.$title||(this.$title=this.$el.find("."+this.pfx+"title")),this.$title.get(0)},updateContent:function(){var t=this.getContent(),e=t.children(),n=this.getCollector(),i=this.model.get("content");e.length&&n.append(e),t.empty().append(i)},updateTitle:function(){var t=this.getTitle();t&&(t.innerHTML=this.model.get("title"))},updateOpen:function(){this.el.style.display=this.model.get("open")?"":"none"},hide:function(){this.model.set("open",0)},show:function(){this.model.set("open",1)},render:function(){var t=this.$el,e=this.pfx,n=(this.ppfx,this.model.toJSON());return n.pfx=this.pfx,n.ppfx=this.ppfx,t.html(this.template(n)),t.attr("class",e+"container"),this.updateOpen(),this}})},function(t,e,n){"use strict";t.exports=function(){var t={},e=n(96),i=n(97),r=n(98),o=n(99),s=n(100),a=n(101),l=n(106),c={},u={},h={},d={};return{getConfig:function(){return t},config:t,EditorView:l,name:"CodeManager",init:function(n){t=n||{};for(var l in e)l in t||(t[l]=e[l]);var c=t.pStylePrefix;return c&&(t.stylePrefix=c+t.stylePrefix),u.html=new i,u.css=new r,u.json=new o,u.js=new s,d.CodeMirror=new a,this.loadDefaultGenerators().loadDefaultViewers(),this},addGenerator:function(t,e){return c[t]=e,this},getGenerator:function(t){return c[t]||null},getGenerators:function(){return c},addViewer:function(t,e){return h[t]=e,this},getViewer:function(t){return h[t]||null},getViewers:function(){return h},updateViewer:function(t,e){t.setContent(e)},getCode:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.em=t.em;var r=this.getGenerator(n);return r?r.build(e,i):""},loadDefaultGenerators:function(){for(var t in u)this.addGenerator(t,u[t]);return this},loadDefaultViewers:function(){for(var t in d)this.addViewer(t,d[t]);return this}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"cm-",inlineCss:!1}},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({build:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.get("components");return e.exportWrapper?e.wrappesIsBody?"<body>"+this.buildModels(n)+"</body>":t.toHTML():this.buildModels(n)},buildModels:function(t){var e="";return t.each(function(t){e+=t.toHTML()}),e}})},function(t,e,n){"use strict";t.exports=n(0).Model.extend({initialize:function(){this.compCls=[],this.ids=[]},buildFromModel:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="",r=this.em,o=r&&r.getConfig("avoidInlineStyle"),s=t.styleToString(),a=t.get("classes"),l=n.wrappesIsBody,c=t.get("wrapper");if(this.ids.push("#"+t.getId()),a.each(function(t){return e.compCls.push(t.getFullName())}),(!o||c)&&s){var u="#"+t.getId();u=l&&c?"body":u,i=u+"{"+s+"}"}var h=t.components();return h.each(function(t){return i+=e.buildFromModel(t,n)}),i},build:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.cssc,r=n.em||"";this.em=r,this.compCls=[],this.ids=[];var o=this.buildFromModel(t,n);return i&&!function(){var t=i.getAll(),n={},s=[];t.each(function(t){var i=t.getAtRule();if(i){var r=n[i];return void(r?r.push(t):n[i]=[t])}o+=e.buildFromRule(t,s)});for(var a in n){var l="",c=n[a];c.forEach(function(t){return l+=e.buildFromRule(t,s)}),l&&(o+=a+"{"+l+"}")}r&&r.getConfig("clearStyles")&&t.remove(s)}(),o},buildFromRule:function(t,e){var n=this,i="",r=t.selectorsToString({skipAdd:1}),o=t.get("selectorsAdd"),s=t.get("singleAtRule"),a=void 0;if(t.get("selectors").each(function(t){var e=t.getFullName();(n.compCls.indexOf(e)>=0||n.ids.indexOf(e)>=0)&&(a=1)}),r&&a||o||s){var l=t.getDeclaration();l&&(i+=l)}else e.push(t);return i}})},function(t,e,n){"use strict";(function(e){var i=n(0);t.exports=i.Model.extend({build:function(t){var n=t.toJSON();return this.beforeEach(n),e.each(n,function(t,e){var r=n[e];if(r instanceof i.Model)n[e]=this.build(r);else if(r instanceof i.Collection){var o=r;n[e]=[],o.length&&o.each(function(t,i){n[e][i]=this.build(t)},this)}},this),n},beforeEach:function(t){delete t.status}})}).call(e,n(1))},function(t,e,n){"use strict";(function(e){var i=n(0);t.exports=i.Model.extend({mapModel:function(t){var n="",i=t.get("script"),r=t.get("type"),o=t.get("components"),s=t.getId();if(i){var a=t.get("attributes");a=e.extend({},a,{id:s}),t.set("attributes",a);var l=t.getScriptString();if(t.get("scriptUpdated"))this.mapJs[r+"-"+s]={ids:[s],code:l};else{var c=this.mapJs[r];c?c.ids.push(s):this.mapJs[r]={ids:[s],code:l}}}return o.each(function(t){n+=this.mapModel(t)},this),n},build:function(t){this.mapJs={},this.mapModel(t);var e="";for(var n in this.mapJs){var i=this.mapJs[n],r="#"+i.ids.join(", #");e+="\n var items = document.querySelectorAll('"+r+"');\n for (var i = 0, len = items.length; i < len; i++) {\n (function(){"+i.code+"}.bind(items[i]))();\n }"}return e}})}).call(e,n(1))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(0),o=n(6);n(102),n(26),n(105);t.exports=r.Model.extend({defaults:{input:"",label:"",codeName:"",theme:"",readOnly:!0,lineNumbers:!0},init:function(t){return this.editor=o.fromTextArea(t,i({dragDrop:!1,lineWrapping:!0,mode:this.get("codeName")},this.attributes)),this},setContent:function(t){this.editor&&(this.editor.setValue(t),this.editor.autoFormatRange&&(o.commands.selectAll(this.editor),this.editor.autoFormatRange(this.editor.getCursor(!0),this.editor.getCursor(!1)),o.commands.goDocStart(this.editor)))}})},function(t,e,n){!function(t){t(n(6),n(103),n(104),n(26))}(function(t){"use strict";function e(t,e,n){var i=t.current(),r=i.search(e);return r>-1?t.backUp(i.length-r):i.match(/<\/?$/)&&(t.backUp(i.length),t.match(e,!1)||t.match(i)),n}function n(t){var e=l[t];return e?e:l[t]=new RegExp("\\s+"+t+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function i(t,e){var i=t.match(n(e));return i?/^\s*(.*?)\s*$/.exec(i[2])[1]:""}function r(t,e){return new RegExp((e?"^":"")+"</s*"+t+"s*>","i")}function o(t,e){for(var n in t)for(var i=e[n]||(e[n]=[]),r=t[n],o=r.length-1;o>=0;o--)i.unshift(r[o])}function s(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(!r[0]||r[1].test(i(e,r[0])))return r[2]}}var a={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},l={};t.defineMode("htmlmixed",function(n,i){function l(i,o){var a,h=c.token(i,o.htmlState),d=/\btag\b/.test(h);if(d&&!/[<>\s\/]/.test(i.current())&&(a=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(a))o.inTag=a+" ";else if(o.inTag&&d&&/>$/.test(i.current())){var f=/^([\S]+) (.*)/.exec(o.inTag);o.inTag=null;var p=">"==i.current()&&s(u[f[1]],f[2]),g=t.getMode(n,p),v=r(f[1],!0),m=r(f[1],!1);o.token=function(t,n){return t.match(v,!1)?(n.token=l,n.localState=n.localMode=null,null):e(t,m,n.localMode.token(t,n.localState))},o.localMode=g,o.localState=t.startState(g,c.indent(o.htmlState,""))}else o.inTag&&(o.inTag+=i.current(),i.eol()&&(o.inTag+=" "));return h}var c=t.getMode(n,{name:"xml",htmlMode:!0,multilineTagIndentFactor:i.multilineTagIndentFactor,multilineTagIndentPastTag:i.multilineTagIndentPastTag}),u={},h=i&&i.tags,d=i&&i.scriptTypes;if(o(a,u),h&&o(h,u),d)for(var f=d.length-1;f>=0;f--)u.script.unshift(["type",d[f].matches,d[f].mode]);return{startState:function(){var e=t.startState(c);return{token:l,inTag:null,localMode:null,localState:null,htmlState:e}},copyState:function(e){var n;return e.localState&&(n=t.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:n,htmlState:t.copyState(c,e.htmlState)}},token:function(t,e){return e.token(t,e)},indent:function(e,n,i){return!e.localMode||/^\s*<\//.test(n)?c.indent(e.htmlState,n):e.localMode.indent?e.localMode.indent(e.localState,n,i):t.Pass},innerMode:function(t){return{state:t.localState||t.htmlState,mode:t.localMode||c}}}},"xml","javascript","css"),t.defineMIME("text/html","htmlmixed")})},function(t,e,n){!function(t){t(n(6))}(function(t){"use strict";var e={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},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};t.defineMode("xml",function(i,r){function o(t,e){function n(n){return e.tokenize=n,n(t,e)}var i=t.next();if("<"==i)return t.eat("!")?t.eat("[")?t.match("CDATA[")?n(l("atom","]]>")):null:t.match("--")?n(l("comment","-->")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(c(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=l("meta","?>"),"meta"):(E=t.eat("/")?"closeTag":"openTag",e.tokenize=s,"tag bracket");if("&"==i){var r;return r=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"),r?"atom":"error"}return t.eatWhile(/[^&<]/),null}function s(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=o,E=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return E="equals",null;if("<"==n){e.tokenize=o,e.state=f,e.tagName=e.tagStart=null;var i=e.tokenize(t,e);return i?i+" tag error":"tag error"}return/[\'\"]/.test(n)?(e.tokenize=a(n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function a(t){var e=function(e,n){for(;!e.eol();)if(e.next()==t){n.tokenize=s;break}return"string"};return e.isInAttribute=!0,e}function l(t,e){return function(n,i){for(;!n.eol();){if(n.match(e)){i.tokenize=o;break}n.next()}return t}}function c(t){return function(e,n){for(var i;null!=(i=e.next());){if("<"==i)return n.tokenize=c(t+1),n.tokenize(e,n);if(">"==i){if(1==t){n.tokenize=o;break}return n.tokenize=c(t-1),n.tokenize(e,n)}}return"meta"}}function u(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(k.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function h(t){t.context&&(t.context=t.context.prev)}function d(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!k.contextGrabbers.hasOwnProperty(n)||!k.contextGrabbers[n].hasOwnProperty(e))return;h(t)}}function f(t,e,n){return"openTag"==t?(n.tagStart=e.column(),p):"closeTag"==t?g:f}function p(t,e,n){return"word"==t?(n.tagName=e.current(),M="tag",y):(M="error",p)}function g(t,e,n){if("word"==t){var i=e.current();return n.context&&n.context.tagName!=i&&k.implicitlyClosed.hasOwnProperty(n.context.tagName)&&h(n),n.context&&n.context.tagName==i||k.matchClosing===!1?(M="tag",v):(M="tag error",m)}return M="error",m}function v(t,e,n){return"endTag"!=t?(M="error",v):(h(n),f)}function m(t,e,n){return M="error",v(t,e,n)}function y(t,e,n){if("word"==t)return M="attribute",b;if("endTag"==t||"selfcloseTag"==t){var i=n.tagName,r=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||k.autoSelfClosers.hasOwnProperty(i)?d(n,i):(d(n,i),n.context=new u(n,i,r==n.indented)),f}return M="error",y}function b(t,e,n){return"equals"==t?x:(k.allowMissing||(M="error"),y(t,e,n))}function x(t,e,n){return"string"==t?w:"word"==t&&k.allowUnquoted?(M="string",y):(M="error",y(t,e,n))}function w(t,e,n){return"string"==t?w:y(t,e,n)}var C=i.indentUnit,k={},S=r.htmlMode?e:n;for(var T in S)k[T]=S[T];for(var T in r)k[T]=r[T];var E,M;return o.isInText=!0,{startState:function(t){var e={tokenize:o,state:f,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;E=null;var n=e.tokenize(t,e);return(n||E)&&"comment"!=n&&(M=null,e.state=e.state(E||n,t,e),M&&(n="error"==M?n+" error":M)),n},indent:function(e,n,i){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+C;if(r&&r.noIndent)return t.Pass;if(e.tokenize!=s&&e.tokenize!=o)return i?i.match(/^(\s*)/)[0].length:0;if(e.tagName)return k.multilineTagIndentPastTag!==!1?e.tagStart+e.tagName.length+2:e.tagStart+C*(k.multilineTagIndentFactor||1);if(k.alignCDATA&&/<!\[CDATA\[/.test(n))return 0;var a=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(a&&a[1])for(;r;){if(r.tagName==a[2]){r=r.prev;break}if(!k.implicitlyClosed.hasOwnProperty(r.tagName))break;r=r.prev}else if(a)for(;r;){var l=k.contextGrabbers[r.tagName];if(!l||!l.hasOwnProperty(a[2]))break;r=r.prev}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+C:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:k.htmlMode?"html":"xml",helperType:k.htmlMode?"html":"xml",skipAttribute:function(t){t.state==x&&(t.state=y)}}}),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})})},function(t,e,n){!function(t){t(n(6))}(function(t){"use strict";t.defineMode("javascript",function(e,n){function i(t){for(var e,n=!1,i=!1;null!=(e=t.next());){if(!n){if("/"==e&&!i)return;"["==e?i=!0:i&&"]"==e&&(i=!1)}n=!n&&"\\"==e}}function r(t,e,n){return Tt=t,Et=n,e}function o(t,e){var n=t.next();if('"'==n||"'"==n)return e.tokenize=s(n),e.tokenize(t,e);if("."==n&&t.match(/^\d+(?:[eE][+\-]?\d+)?/))return r("number","number");if("."==n&&t.match(".."))return r("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return r(n);if("="==n&&t.eat(">"))return r("=>","operator");if("0"==n&&t.eat(/x/i))return t.eatWhile(/[\da-f]/i),r("number","number");if("0"==n&&t.eat(/o/i))return t.eatWhile(/[0-7]/i),r("number","number");if("0"==n&&t.eat(/b/i))return t.eatWhile(/[01]/i),r("number","number");if(/\d/.test(n))return t.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),r("number","number");if("/"==n)return t.eat("*")?(e.tokenize=a,a(t,e)):t.eat("/")?(t.skipToEnd(),r("comment","comment")):St(t,e,1)?(i(t),t.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),r("regexp","string-2")):(t.eat("="),r("operator","operator",t.current()));if("`"==n)return e.tokenize=l,l(t,e);if("#"==n)return t.skipToEnd(),r("error","error");if(It.test(n))return">"==n&&e.lexical&&">"==e.lexical.type||(t.eat("=")?"!"!=n&&"="!=n||t.eat("="):/[<>*+\-]/.test(n)&&(t.eat(n),">"==n&&t.eat(n))),r("operator","operator",t.current());if(Nt.test(n)){t.eatWhile(Nt);var o=t.current();if("."!=e.lastType){if(Dt.propertyIsEnumerable(o)){var c=Dt[o];return r(c.type,c.style,o)}if("async"==o&&t.match(/^\s*[\(\w]/,!1))return r("async","keyword",o)}return r("variable","variable",o)}}function s(t){return function(e,n){var i,s=!1;if(At&&"@"==e.peek()&&e.match(_t))return n.tokenize=o,r("jsonld-keyword","meta");for(;null!=(i=e.next())&&(i!=t||s);)s=!s&&"\\"==i;return s||(n.tokenize=o),r("string","string")}}function a(t,e){for(var n,i=!1;n=t.next();){if("/"==n&&i){e.tokenize=o;break}i="*"==n}return r("comment","comment")}function l(t,e){for(var n,i=!1;null!=(n=t.next());){if(!i&&("`"==n||"$"==n&&t.eat("{"))){e.tokenize=o;break}i=!i&&"\\"==n}return r("quasi","string-2",t.current())}function c(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var n=t.string.indexOf("=>",t.start);if(!(n<0)){if(Lt){var i=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(t.string.slice(t.start,n));i&&(n=i.index)}for(var r=0,o=!1,s=n-1;s>=0;--s){var a=t.string.charAt(s),l=Ft.indexOf(a);if(l>=0&&l<3){if(!r){++s;break}if(0==--r){"("==a&&(o=!0);break}}else if(l>=3&&l<6)++r;else if(Nt.test(a))o=!0;else{if(/["'\/]/.test(a))return;if(o&&!r){++s;break}}}o&&!r&&(e.fatArrowAt=s)}}function u(t,e,n,i,r,o){this.indented=t,this.column=e,this.type=n,this.prev=r,this.info=o,null!=i&&(this.align=i)}function h(t,e){for(var n=t.localVars;n;n=n.next)if(n.name==e)return!0;for(var i=t.context;i;i=i.prev)for(var n=i.vars;n;n=n.next)if(n.name==e)return!0}function d(t,e,n,i,r){var o=t.cc;for(Rt.state=t,Rt.stream=r,Rt.marked=null,Rt.cc=o,Rt.style=e,t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);;){var s=o.length?o.pop():Ot?C:w;if(s(n,i)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Rt.marked?Rt.marked:"variable"==n&&h(t,i)?"variable-2":e}}}function f(){for(var t=arguments.length-1;t>=0;t--)Rt.cc.push(arguments[t])}function p(){return f.apply(null,arguments),!0}function g(t){function e(e){for(var n=e;n;n=n.next)if(n.name==t)return!0;return!1}var i=Rt.state;if(Rt.marked="def",i.context){if(e(i.localVars))return;i.localVars={name:t,next:i.localVars}}else{if(e(i.globalVars))return;n.globalVars&&(i.globalVars={name:t,next:i.globalVars})}}function v(){Rt.state.context={prev:Rt.state.context,vars:Rt.state.localVars},Rt.state.localVars=$t}function m(){Rt.state.localVars=Rt.state.context.vars,Rt.state.context=Rt.state.context.prev}function y(t,e){var n=function(){var n=Rt.state,i=n.indented;if("stat"==n.lexical.type)i=n.lexical.indented;else for(var r=n.lexical;r&&")"==r.type&&r.align;r=r.prev)i=r.indented;n.lexical=new u(i,Rt.stream.column(),t,null,n.lexical,e)};return n.lex=!0,n}function b(){var t=Rt.state;t.lexical.prev&&(")"==t.lexical.type&&(t.indented=t.lexical.indented),t.lexical=t.lexical.prev)}function x(t){function e(n){return n==t?p():";"==t?f():p(e)}return e}function w(t,e){return"var"==t?p(y("vardef",e.length),J,x(";"),b):"keyword a"==t?p(y("form"),S,w,b):"keyword b"==t?p(y("form"),w,b):"keyword d"==t?Rt.stream.match(/^\s*$/,!1)?p():p(y("stat"),E,x(";"),b):"debugger"==t?p(x(";")):"{"==t?p(y("}"),B,b):";"==t?p():"if"==t?("else"==Rt.state.lexical.info&&Rt.state.cc[Rt.state.cc.length-1]==b&&Rt.state.cc.pop()(),p(y("form"),S,w,b,nt)):"function"==t?p(lt):"for"==t?p(y("form"),it,w,b):"variable"==t?Lt&&"type"==e?(Rt.marked="keyword",p(U,x("operator"),U,x(";"))):Lt&&"declare"==e?(Rt.marked="keyword",p(w)):p(y("stat"),F):"switch"==t?p(y("form"),S,x("{"),y("}","switch"),B,b,b):"case"==t?p(C,x(":")):"default"==t?p(x(":")):"catch"==t?p(y("form"),v,x("("),ct,x(")"),w,b,m):"class"==t?p(y("form"),ht,b):"export"==t?p(y("stat"),gt,b):"import"==t?p(y("stat"),mt,b):"module"==t?p(y("form"),Z,x("{"),y("}"),B,b,b):"async"==t?p(w):"@"==e?p(C,w):f(y("stat"),C,x(";"),b)}function C(t){return T(t,!1)}function k(t){return T(t,!0)}function S(t){return"("!=t?f():p(y(")"),C,x(")"),b)}function T(t,e){if(Rt.state.fatArrowAt==Rt.stream.start){var n=e?N:L;if("("==t)return p(v,y(")"),H(ct,")"),b,x("=>"),n,m);if("variable"==t)return f(v,Z,x("=>"),n,m)}var i=e?P:M;return zt.hasOwnProperty(t)?p(i):"function"==t?p(lt,i):"class"==t?p(y("form"),ut,b):"keyword c"==t||"async"==t?p(e?k:C):"("==t?p(y(")"),E,x(")"),b,i):"operator"==t||"spread"==t?p(e?k:C):"["==t?p(y("]"),Ct,b,i):"{"==t?j(R,"}",null,i):"quasi"==t?f(A,i):"new"==t?p(D(e)):p()}function E(t){return t.match(/[;\}\)\],]/)?f():f(C)}function M(t,e){return","==t?p(C):P(t,e,!1)}function P(t,e,n){var i=0==n?M:P,r=0==n?C:k;return"=>"==t?p(v,n?N:L,m):"operator"==t?/\+\+|--/.test(e)||Lt&&"!"==e?p(i):"?"==e?p(C,x(":"),r):p(r):"quasi"==t?f(A,i):";"!=t?"("==t?j(k,")","call",i):"."==t?p(z,i):"["==t?p(y("]"),E,x("]"),b,i):Lt&&"as"==e?(Rt.marked="keyword",p(U,i)):"regexp"==t?(Rt.state.lastType=Rt.marked="operator",Rt.stream.backUp(Rt.stream.pos-Rt.stream.start-1),p(r)):void 0:void 0}function A(t,e){return"quasi"!=t?f():"${"!=e.slice(e.length-2)?p(A):p(C,O)}function O(t){if("}"==t)return Rt.marked="string-2",Rt.state.tokenize=l,p(A)}function L(t){return c(Rt.stream,Rt.state),f("{"==t?w:C)}function N(t){return c(Rt.stream,Rt.state),f("{"==t?w:k)}function D(t){return function(e){return"."==e?p(t?_:I):"variable"==e&&Lt?p(X,t?P:M):f(t?k:C)}}function I(t,e){if("target"==e)return Rt.marked="keyword",p(M)}function _(t,e){if("target"==e)return Rt.marked="keyword",p(P)}function F(t){return":"==t?p(b,w):f(M,x(";"),b)}function z(t){if("variable"==t)return Rt.marked="property",p()}function R(t,e){if("async"==t)return Rt.marked="property",p(R);if("variable"==t||"keyword"==Rt.style){if(Rt.marked="property","get"==e||"set"==e)return p($);var n;return Lt&&Rt.state.fatArrowAt==Rt.stream.start&&(n=Rt.stream.match(/^\s*:\s*/,!1))&&(Rt.state.fatArrowAt=Rt.stream.pos+n[0].length),p(V)}return"number"==t||"string"==t?(Rt.marked=At?"property":Rt.style+" property",p(V)):"jsonld-keyword"==t?p(V):"modifier"==t?p(R):"["==t?p(C,x("]"),V):"spread"==t?p(k,V):"*"==e?(Rt.marked="keyword",p(R)):":"==t?f(V):void 0}function $(t){return"variable"!=t?f(V):(Rt.marked="property",p(lt))}function V(t){return":"==t?p(k):"("==t?f(lt):void 0}function H(t,e,n){function i(r,o){if(n?n.indexOf(r)>-1:","==r){var s=Rt.state.lexical;return"call"==s.info&&(s.pos=(s.pos||0)+1),p(function(n,i){return n==e||i==e?f():f(t)},i)}return r==e||o==e?p():p(x(e))}return function(n,r){return n==e||r==e?p():f(t,i)}}function j(t,e,n){for(var i=3;i<arguments.length;i++)Rt.cc.push(arguments[i]);return p(y(e,n),H(t,e),b)}function B(t){return"}"==t?p():f(w,B)}function W(t,e){if(Lt){if(":"==t)return p(U);if("?"==e)return p(W)}}function U(t,e){return"variable"==t||"void"==e?"keyof"==e?(Rt.marked="keyword",p(U)):(Rt.marked="type",p(Y)):"string"==t||"number"==t||"atom"==t?p(Y):"["==t?p(y("]"),H(U,"]",","),b,Y):"{"==t?p(y("}"),H(K,"}",",;"),b,Y):"("==t?p(H(G,")"),q):void 0}function q(t){if("=>"==t)return p(U)}function K(t,e){return"variable"==t||"keyword"==Rt.style?(Rt.marked="property",p(K)):"?"==e?p(K):":"==t?p(U):"["==t?p(C,W,x("]"),K):void 0}function G(t){return"variable"==t?p(G):":"==t?p(U):void 0}function Y(t,e){return"<"==e?p(y(">"),H(U,">"),b,Y):"|"==e||"."==t?p(U):"["==t?p(x("]"),Y):"extends"==e?p(U):void 0}function X(t,e){if("<"==e)return p(y(">"),H(U,">"),b,Y)}function J(){return f(Z,W,tt,et)}function Z(t,e){return"modifier"==t?p(Z):"variable"==t?(g(e),p()):"spread"==t?p(Z):"["==t?j(Z,"]"):"{"==t?j(Q,"}"):void 0}function Q(t,e){return"variable"!=t||Rt.stream.match(/^\s*:/,!1)?("variable"==t&&(Rt.marked="property"),"spread"==t?p(Z):"}"==t?f():p(x(":"),Z,tt)):(g(e),p(tt))}function tt(t,e){if("="==e)return p(k)}function et(t){if(","==t)return p(J)}function nt(t,e){if("keyword b"==t&&"else"==e)return p(y("form","else"),w,b)}function it(t){if("("==t)return p(y(")"),rt,x(")"),b)}function rt(t){return"var"==t?p(J,x(";"),st):";"==t?p(st):"variable"==t?p(ot):f(C,x(";"),st)}function ot(t,e){return"in"==e||"of"==e?(Rt.marked="keyword",p(C)):p(M,st)}function st(t,e){return";"==t?p(at):"in"==e||"of"==e?(Rt.marked="keyword",p(C)):f(C,x(";"),at)}function at(t){")"!=t&&p(C)}function lt(t,e){return"*"==e?(Rt.marked="keyword",p(lt)):"variable"==t?(g(e),p(lt)):"("==t?p(v,y(")"),H(ct,")"),b,W,w,m):Lt&&"<"==e?p(y(">"),H(U,">"),b,lt):void 0}function ct(t,e){return"@"==e&&p(C,ct),"spread"==t||"modifier"==t?p(ct):f(Z,W,tt)}function ut(t,e){return"variable"==t?ht(t,e):dt(t,e)}function ht(t,e){if("variable"==t)return g(e),p(dt)}function dt(t,e){return"<"==e?p(y(">"),H(U,">"),b,dt):"extends"==e||"implements"==e||Lt&&","==t?p(Lt?U:C,dt):"{"==t?p(y("}"),ft,b):void 0}function ft(t,e){return"modifier"==t||"async"==t||"variable"==t&&("static"==e||"get"==e||"set"==e)&&Rt.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(Rt.marked="keyword",p(ft)):"variable"==t||"keyword"==Rt.style?(Rt.marked="property",p(Lt?pt:lt,ft)):"["==t?p(C,x("]"),Lt?pt:lt,ft):"*"==e?(Rt.marked="keyword",p(ft)):";"==t?p(ft):"}"==t?p():"@"==e?p(C,ft):void 0}function pt(t,e){return"?"==e?p(pt):":"==t?p(U,tt):"="==e?p(k):f(lt)}function gt(t,e){return"*"==e?(Rt.marked="keyword",p(wt,x(";"))):"default"==e?(Rt.marked="keyword",p(C,x(";"))):"{"==t?p(H(vt,"}"),wt,x(";")):f(w)}function vt(t,e){return"as"==e?(Rt.marked="keyword",p(x("variable"))):"variable"==t?f(k,vt):void 0}function mt(t){return"string"==t?p():f(yt,bt,wt)}function yt(t,e){return"{"==t?j(yt,"}"):("variable"==t&&g(e),"*"==e&&(Rt.marked="keyword"),p(xt))}function bt(t){if(","==t)return p(yt,bt)}function xt(t,e){if("as"==e)return Rt.marked="keyword",p(yt)}function wt(t,e){if("from"==e)return Rt.marked="keyword",p(C)}function Ct(t){return"]"==t?p():f(H(k,"]"))}function kt(t,e){return"operator"==t.lastType||","==t.lastType||It.test(e.charAt(0))||/[,.]/.test(e.charAt(0))}function St(t,e,n){return e.tokenize==o&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(e.lastType)||"quasi"==e.lastType&&/\{\s*$/.test(t.string.slice(0,t.pos-(n||0)))}var Tt,Et,Mt=e.indentUnit,Pt=n.statementIndent,At=n.jsonld,Ot=n.json||At,Lt=n.typescript,Nt=n.wordCharacters||/[\w$\xa1-\uffff]/,Dt=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),n=t("keyword b"),i=t("keyword c"),r=t("keyword d"),o=t("operator"),s={type:"atom",style:"atom"},a={"if":t("if"),"while":e,"with":e,
"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":t("new"),"delete":i,"void":i,"throw":i,"debugger":t("debugger"),"var":t("var"),"const":t("var"),"let":t("var"),"function":t("function"),"catch":t("catch"),"for":t("for"),"switch":t("switch"),"case":t("case"),"default":t("default"),"in":o,"typeof":o,"instanceof":o,"true":s,"false":s,"null":s,undefined:s,NaN:s,Infinity:s,"this":t("this"),"class":t("class"),"super":t("atom"),"yield":i,"export":t("export"),"import":t("import"),"extends":i,await:i};if(Lt){var l={type:"variable",style:"type"},c={"interface":t("class"),"implements":i,namespace:i,module:t("module"),"enum":t("module"),"public":t("modifier"),"private":t("modifier"),"protected":t("modifier"),"abstract":t("modifier"),readonly:t("modifier"),string:l,number:l,"boolean":l,any:l};for(var u in c)a[u]=c[u]}return a}(),It=/[+\-*&%=<>!?|~^@]/,_t=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ft="([{}])",zt={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Rt={state:null,column:null,marked:null,cc:null},$t={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(t){var e={tokenize:o,lastType:"sof",cc:[],lexical:new u((t||0)-Mt,0,"block",(!1)),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:t||0};return n.globalVars&&"object"==typeof n.globalVars&&(e.globalVars=n.globalVars),e},token:function(t,e){if(t.sol()&&(e.lexical.hasOwnProperty("align")||(e.lexical.align=!1),e.indented=t.indentation(),c(t,e)),e.tokenize!=a&&t.eatSpace())return null;var n=e.tokenize(t,e);return"comment"==Tt?n:(e.lastType="operator"!=Tt||"++"!=Et&&"--"!=Et?Tt:"incdec",d(e,n,Tt,Et,t))},indent:function(e,i){if(e.tokenize==a)return t.Pass;if(e.tokenize!=o)return 0;var r,s=i&&i.charAt(0),l=e.lexical;if(!/^\s*else\b/.test(i))for(var c=e.cc.length-1;c>=0;--c){var u=e.cc[c];if(u==b)l=l.prev;else if(u!=nt)break}for(;("stat"==l.type||"form"==l.type)&&("}"==s||(r=e.cc[e.cc.length-1])&&(r==M||r==P)&&!/^[,\.=+\-*:?[\(]/.test(i));)l=l.prev;Pt&&")"==l.type&&"stat"==l.prev.type&&(l=l.prev);var h=l.type,d=s==h;return"vardef"==h?l.indented+("operator"==e.lastType||","==e.lastType?l.info+1:0):"form"==h&&"{"==s?l.indented:"form"==h?l.indented+Mt:"stat"==h?l.indented+(kt(e,i)?Pt||Mt:0):"switch"!=l.info||d||0==n.doubleIndentSwitch?l.align?l.column+(d?0:1):l.indented+(d?0:Mt):l.indented+(/^(?:case|default)\b/.test(i)?Mt:2*Mt)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ot?null:"/*",blockCommentEnd:Ot?null:"*/",blockCommentContinue:Ot?null:" * ",lineComment:Ot?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ot?"json":"javascript",jsonldMode:At,jsonMode:Ot,expressionAllowed:St,skipExpression:function(t){var e=t.cc[t.cc.length-1];e!=C&&e!=k||t.cc.pop()}}}),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},function(t,e,n){!function(t){t(n(6))}(function(t){t.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(t,e){return/^[;{}]$/.test(e)}}),t.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(t,e,n,i){return this.jsonMode?/^[\[,{]$/.test(e)||/^}/.test(n):(";"!=e||!i.lexical||")"!=i.lexical.type)&&(/^[;{}]$/.test(e)&&!/^;/.test(n))}});var e=/^(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)$/;t.extendMode("xml",{commentStart:"<!--",commentEnd:"-->",newlineAfterToken:function(t,n,i,r){var o=!1;return"html"==this.configuration&&(o=!!r.context&&e.test(r.context.tagName)),!o&&("tag"==t&&/>$/.test(n)&&r.context||/^</.test(i))}}),t.defineExtension("commentRange",function(e,n,i){var r=this,o=t.innerMode(r.getMode(),r.getTokenAt(n).state).mode;r.operation(function(){if(e)r.replaceRange(o.commentEnd,i),r.replaceRange(o.commentStart,n),n.line==i.line&&n.ch==i.ch&&r.setCursor(n.line,n.ch+o.commentStart.length);else{var t=r.getRange(n,i),s=t.indexOf(o.commentStart),a=t.lastIndexOf(o.commentEnd);s>-1&&a>-1&&a>s&&(t=t.substr(0,s)+t.substring(s+o.commentStart.length,a)+t.substr(a+o.commentEnd.length)),r.replaceRange(t,n,i)}})}),t.defineExtension("autoIndentRange",function(t,e){var n=this;this.operation(function(){for(var i=t.line;i<=e.line;i++)n.indentLine(i,"smart")})}),t.defineExtension("autoFormatRange",function(e,n){function i(){c+="\n",h=!0,++u}for(var r=this,o=r.getMode(),s=r.getRange(e,n).split("\n"),a=t.copyState(o,r.getTokenAt(e).state),l=r.getOption("tabSize"),c="",u=0,h=0===e.ch,d=0;d<s.length;++d){for(var f=new t.StringStream(s[d],l);!f.eol();){var p=t.innerMode(o,a),g=o.token(f,a),v=f.current();f.start=f.pos,h&&!/\S/.test(v)||(c+=v,h=!1),!h&&p.mode.newlineAfterToken&&p.mode.newlineAfterToken(g,v,f.string.slice(f.pos)||s[d+1]||"",p.state)&&i()}!f.pos&&o.blankLine&&o.blankLine(a),!h&&d<s.length-1&&i()}r.operation(function(){r.replaceRange(c,e,n);for(var t=e.line+1,i=e.line+u;t<=i;++t)r.indentLine(t,"smart");r.setSelection(e,r.getCursor(!1))})})})},function(t,e,n){"use strict";(function(e){var i=n(0);t.exports=i.View.extend({template:e.template('\n <div class="<%= pfx %>editor" id="<%= pfx %><%= codeName %>">\n \t<div id="<%= pfx %>title"><%= label %></div>\n \t<div id="<%= pfx %>code"></div>\n </div>'),initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix},render:function(){var t=this.model.toJSON();return t.pfx=this.pfx,this.$el.html(this.template(t)),this.$el.attr("class",this.pfx+"editor-c"),this.$el.find("#"+this.pfx+"code").append(this.model.get("input")),this}})}).call(e,n(1))},function(t,e,n){"use strict";t.exports=function(){var t,e,i={},r=n(108),o=n(27),s=n(110),a=(n(29),n(112));return{name:"Panels",init:function(n){i=n||{};for(var o in r)o in i||(i[o]=r[o]);var l=i.pStylePrefix;return l&&(i.stylePrefix=l+i.stylePrefix),t=new s(i.defaults),e=new a({collection:t,config:i}),this},getPanels:function(){return t},getPanelsEl:function(){return e.el},addPanel:function(e){return t.add(e)},removePanel:function(e){return t.remove(e)},getPanel:function(e){var n=t.where({id:e});return n.length?n[0]:null},addButton:function(t,e){var n=this.getPanel(t);return n?n.get("buttons").add(e):null},removeButton:function(t,e){var n=this.getPanel(t);return n&&n.get("buttons").remove(e)},getButton:function(t,e){var n=this.getPanel(t);if(n){var i=n.get("buttons").where({id:e});return i.length?i[0]:null}return null},render:function(){return e.render().el},active:function(){this.getPanels().each(function(t){t.get("buttons").each(function(t){t.get("active")&&t.trigger("updateActive")})})},disableButtons:function(){this.getPanels().each(function(t){t.get("buttons").each(function(t){t.get("disable")&&t.trigger("change:disable")})})},Panel:o}}},function(t,e,n){"use strict";var i="sw-visibility",r="export-template",o="open-sm",s="open-tm",a="open-layers",l="open-blocks",c="fullscreen",u="preview";t.exports={stylePrefix:"pn-",defaults:[{id:"commands",buttons:[{}]},{id:"options",buttons:[{active:!0,id:i,className:"fa fa-square-o",command:i,context:i,attributes:{title:"View components"}},{id:u,className:"fa fa-eye",command:u,context:u,attributes:{title:"Preview"}},{id:c,className:"fa fa-arrows-alt",command:c,context:c,attributes:{title:"Fullscreen"}},{id:r,className:"fa fa-code",command:r,attributes:{title:"View code"}}]},{id:"views",buttons:[{id:o,className:"fa fa-paint-brush",command:o,active:!0,attributes:{title:"Open Style Manager"}},{id:s,className:"fa fa-cog",command:s,attributes:{title:"Settings"}},{id:a,className:"fa fa-bars",command:a,attributes:{title:"Open Layer Manager"}},{id:l,className:"fa fa-th-large",command:l,attributes:{title:"Open Blocks"}}]}],em:null,delayBtnsShow:300}},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({defaults:{id:"",className:"",command:"",context:"",buttons:[],attributes:{},options:{},active:!1,dragDrop:!1,runDefaultCommand:!0,stopDefaultCommand:!1,disable:!1},initialize:function(t){if(this.get("buttons").length){var e=n(28);this.set("buttons",new e(this.get("buttons")))}}})},function(t,e,n){"use strict";var i=n(0),r=n(27);t.exports=i.Collection.extend({model:r})},function(t,e,n){"use strict";(function(e,i){var r=n(1),o=e.$;t.exports=e.View.extend({tagName:"span",initialize:function(t){i.bindAll(this,"startTimer","stopTimer","showButtons","hideButtons","closeOnKeyPress","onDrop","initSorter","stopDrag");var e=this.model.get("className");this.config=t.config||{},this.em=this.config.em||{};var n=this.config.stylePrefix||"",r=this.config.pStylePrefix||"";this.pfx=n,this.ppfx=this.config.pStylePrefix||"",this.id=n+this.model.get("id"),this.activeCls=n+"active "+r+"four-color",this.disableCls=n+"active",this.btnsVisCls=n+"visible",this.parentM=t.parentM||null,this.className=n+"btn"+(e?" "+e:""),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.listenTo(this.model,"change:disable",this.updateDisable),this.model.get("buttons").length&&(this.$el.on("mousedown",this.startTimer),this.$el.append(o("<div>",{"class":n+"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 t=this.em.Canvas;this.canvasEl=t.getBody(),this.sorter=new this.em.Utils.Sorter({container:this.canvasEl,placer:t.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,onMove:this.onDrag,onEndMove:this.onDrop,document:t.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1});var e=t.getOffset();this.sorter.offTop=e.top,this.sorter.offLeft=e.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",o(document).on("mouseup",this.stopDrag)},stopDrag:function(){o(document).off("mouseup",this.stopDrag),this.sorter.endMove()},onDrag:function(t){},onDrop:function(t){this.canvasEl.style.cursor="default"},updateClassName:function(){var t=this.model.get("className");this.$el.attr("class",this.pfx+"btn"+(t?" "+t:""))},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),o(document).on("mouseup",this.stopTimer)},stopTimer:function(){o(document).off("mouseup",this.stopTimer),this.timeout&&clearTimeout(this.timeout)},showButtons:function(){clearTimeout(this.timeout),this.model.set("bntsVis",!0),o(document).on("mousedown",this.hideButtons),o(document).on("keypress",this.closeOnKeyPress)},hideButtons:function(t){t&&o(t.target).trigger("click"),this.model.set("bntsVis",!1),o(document).off("mousedown",this.hideButtons),o(document).off("keypress",this.closeOnKeyPress)},closeOnKeyPress:function(t){var e=t.which||t.keyCode;27==e&&this.hideButtons()},updateActive:function(){var t=this.model,e=t.get("context"),n=this.parentM,i={},o=this.em&&this.em.get?this.em.get("Editor"):null,s=t.get("command");this.commands&&(0,r.isString)(s)?i=this.commands.get(s)||{}:(0,r.isFunction)(s)?i={run:s}:null!==s&&(0,r.isObject)(s)&&(i=s),t.get("active")?(t.collection.deactivateAll(e),t.set("active",!0,{silent:!0}).trigger("checkActive"),n&&n.set("active",!0,{silent:!0}).trigger("checkActive"),i.run&&(i.run(o,t,t.get("options")),o.trigger("run:"+s)),!i.stop&&t.set("active",!1)):(this.$el.removeClass(this.activeCls),t.collection.deactivateAll(e),n&&n.set("active",!1,{silent:!0}).trigger("checkActive"),i.stop&&(i.stop(o,t,t.get("options")),o.trigger("stop:"+s)))},updateDisable:function(){this.model.get("disable")?this.$el.addClass(this.disableCls):this.$el.removeClass(this.disableCls)},checkActive:function(){this.model.get("active")?this.$el.addClass(this.activeCls):this.$el.removeClass(this.activeCls)},clicked:function(t){this.model.get("bntsVis")||this.model.get("disable")||this.toogleActive()},toogleActive:function(){this.parentM&&this.swapParent();var t=this.model.get("active");this.model.set("active",!t);this.em.get("Commands").get("select-comp");t?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 t=n(30),e=new t({collection:this.model.get("buttons"),config:this.config,parentM:this.model});this.$buttons=e.render().$el,this.$buttons.append(o("<div>",{"class":this.pfx+"arrow-l"})),this.$el.append(this.$buttons)}return this}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";var i=n(0),r=n(29);t.exports=i.View.extend({initialize:function(t){this.opt=t||{},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(t){this.addToCollection(t)},addToCollection:function(t,e){var n=e||null,i=new r({model:t,config:this.config}),o=i.render().el,s=t.get("appendTo");if(s){var a=document.querySelector(s);a.appendChild(o)}else n?n.appendChild(o):this.$el.append(o);return i.initResize(),o},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",this.className),this}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=n(114),o=i(r),s=n(2);t.exports=function(){var t={},e=n(115),i=void 0,r=void 0,a=void 0,l=void 0,c=function(){var t=i.style,e="-100px";t.top=e,t.left=e,t.display="none"};return{customRte:null,name:"RichTextEditor",init:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=n;for(var o in e)o in t||(t[o]=e[o]);var a=t.pStylePrefix;return a&&(t.stylePrefix=a+t.stylePrefix),this.pfx=t.stylePrefix,r=t.actions||[],i=document.createElement("div"),i.className=a+"rte-toolbar "+a+"one-bg",l=this.initRte(document.createElement("div")),(0,s.on)(i,"mousedown",function(t){return t.stopPropagation()}),this},postRender:function(t){var e=t.model.get("Canvas");i.style.pointerEvents="all",c(),e.getToolsEl().appendChild(i)},initRte:function(e){var n=this.pfx,r=i,s=this.actionbar,a=this.actions||t.actions,c={actionbar:n+"actionbar",button:n+"action",active:n+"active"},u=new o["default"]({el:e,classes:c,actions:a,actionbar:s,actionbarContainer:r});return l&&l.setEl(e),u.actionbar&&(this.actionbar=u.actionbar),u.actions&&(this.actions=u.actions),u},add:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.name=t,l.addAction(e,{sync:1})},get:function(t){var e=void 0;return l.getActions().forEach(function(n){n.name==t&&(e=n)}),e},getAll:function(){return l.getActions()},remove:function(t){var e=this.getAll(),n=this.get(t);if(n){var i=n.btn,r=e.indexOf(n);i.parentNode.removeChild(i),e.splice(r,1)}return n},getToolbarEl:function(){return i},udpatePosition:function(){var e="px",n=t.em.get("Canvas"),r=n.getTargetToElementDim(i,a,{event:"rteToolbarPosUpdate"});t.adjustToolbar&&r.top<=r.canvasTop&&(r.top=r.elementTop+r.elementHeight);var o=i.style;o.top=r.top+e,o.left=r.left+e},enable:function(e,n){a=e.el;var r=t.em,o=e.getChildrenContainer(),s=this.customRte;if(i.style.display="",n=s?s.enable(o,n):this.initRte(o).enable(),r){setTimeout(this.udpatePosition.bind(this),0);var l="change:canvasOffset canvasScroll";r.off(l,this.udpatePosition,this),r.on(l,this.udpatePosition,this),r.trigger("rte:enable",e,n)}return n},disable:function(e,n){var i=t.em,r=this.customRte,o=e.getChildrenContainer();r?r.disable(o,n):n&&n.disable(),c(),i&&i.trigger("rte:disable",e,n)}}}},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(2),a="_rte",l={bold:{name:"bold",icon:"<b>B</b>",attributes:{title:"Bold"},result:function(t){return t.exec("bold")}},italic:{name:"italic",icon:"<i>I</i>",attributes:{title:"Italic"},result:function(t){return t.exec("italic")}},underline:{name:"underline",icon:"<u>U</u>",attributes:{title:"Underline"},result:function(t){return t.exec("underline")}},strikethrough:{name:"strikethrough",icon:"<strike>S</strike>",attributes:{title:"Strike-through"},result:function(t){return t.exec("strikeThrough")}},link:{icon:'<span style="transform:rotate(45deg)">&supdsub;</span>',name:"link",attributes:{style:"font-size:1.4rem;padding:0 4px 2px;",title:"Link"},result:function(t){return t.insertHTML('<a class="link" href="">'+t.selection()+"</a>")}}},c=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t);var o=n.el;if(o[a])return o[a];o[a]=this,this.setEl(o),this.updateActiveActions=this.updateActiveActions.bind(this);var s=n.actions||[];s.forEach(function(t,e){"string"==typeof t?t=l[t]:l[t.name]&&(t=r({},l[t.name],t)),s[e]=t});var c=s.length?s:Object.keys(l).map(function(t){return l[t]});n.classes=r({actionbar:"actionbar",button:"action",active:"active"},n.classes);var u=n.classes,h=n.actionbar;if(this.actionbar=h,this.settings=n,this.classes=u,this.actions=c,!h){var d=n.actionbarContainer;h=document.createElement("div"),h.className=u.actionbar,d.appendChild(h),this.actionbar=h,c.forEach(function(t){return e.addAction(t)})}return n.styleWithCSS&&this.exec("styleWithCSS"),this.syncActions(),this}return o(t,[{key:"setEl",value:function(t){this.el=t,this.doc=t.ownerDocument}},{key:"updateActiveActions",value:function(){var t=this;this.getActions().forEach(function(e){var n=e.btn,i=e.update,r=t.classes.active,o=e.name,s=t.doc;n.className=n.className.replace(r,"").trim(),s.queryCommandState(o)&&(n.className+=" "+r),i&&i(t,e)})}},{key:"enable",value:function(){return this.enabled?this:(this.actionbarEl().style.display="",this.el.contentEditable=!0,(0,s.on)(this.el,"mouseup keyup",this.updateActiveActions),this.syncActions(),this.updateActiveActions(),this.el.focus(),this.enabled=1,this)}},{key:"disable",value:function(){return this.actionbarEl().style.display="none",this.el.contentEditable=!1,(0,s.off)(this.el,"mouseup keyup",this.updateActiveActions),this.enabled=0,this}},{key:"syncActions",value:function(){var t=this;this.getActions().forEach(function(e){var n=e.event||"click";e.btn["on"+n]=function(n){e.result(t,e),t.updateActiveActions()}})}},{key:"addAction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.sync,i=document.createElement("span"),r=t.icon,o=t.attributes||{};i.className=this.classes.button,t.btn=i;for(var s in o)i.setAttribute(s,o[s]);"string"==typeof r?i.innerHTML=r:i.appendChild(r),this.actionbarEl().appendChild(i),n&&(this.actions.push(t),this.syncActions())}},{key:"getActions",value:function(){return this.actions}},{key:"selection",value:function(){return this.doc.getSelection()}},{key:"exec",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.doc.execCommand(t,!1,e)}},{key:"actionbarEl",value:function(){return this.actionbar}},{key:"insertHTML",value:function(t){var e=void 0,n=this.doc,i=n.getSelection();if(i&&i.rangeCount){var r=n.createElement("div"),o=i.getRangeAt(0);o.deleteContents(),r.innerHTML=t,Array.prototype.slice.call(r.childNodes).forEach(function(t){o.insertNode(t),e=t}),i.removeAllRanges(),i.addRange(o),this.el.focus()}}}]),t}();e["default"]=c},function(t,e,n){"use strict";t.exports={stylePrefix:"rte-",adjustToolbar:1,actions:["bold","italic","underline","strikethrough","link"]}},function(t,e,n){"use strict";t.exports={stylePrefix:"sm-",sectors:[],textNoElement:"Select an element before using Style Manager",hideNotStylable:!0,highlightChanged:!0,highlightComputed:!0,showComputed:!0,clearProperties:0,avoidComputed:["width","height"]}},function(t,e,n){"use strict";var i=n(118);t.exports=n(0).Collection.extend({model:i})},function(t,e,n){"use strict";var i=n(1),r=n(0),o=n(11),s=n(127);t.exports=r.Model.extend({defaults:{id:"",name:"",open:!0,buildProps:"",extendBuilded:1,properties:[]},initialize:function(t){var e=t||{},n=[],i=this.buildProperties(e.buildProps);!this.get("id")&&this.set("id",this.get("name")),n=i?this.extendProperties(i):this.get("properties");var r=new o(n);r.sector=this,this.set("properties",r)},extendProperties:function(t,e,n){for(var r=t.length,o=e||this.get("properties"),s=this.get("extendBuilded"),a=[],l=0,c=o.length;l<c;l++){for(var u=o[l],h=0,d=0;d<r;d++){var f=t[d];if(u.property!=f.property&&u.id!=f.property);else{var p=u.properties;p&&p.length&&(u.properties=this.extendProperties(f.properties,p,1)),t[d]=s?(0,i.extend)(f,u):u,a[d]=t[d],h=1}}h||(t.push(u),a.push(u))}return n?a:t},buildProperties:function(t){var e,n=t||[];if(n.length)return this.propFactory||(this.propFactory=new s),e=this.propFactory.build(n)}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(33),o=n(120);t.exports=r.extend({defaults:i({},r.prototype.defaults,{layers:[],preview:0}),init:function(){r.prototype.init.apply(this,arguments);var t=this.get("layers"),e=new o(t);e.properties=this.get("properties"),this.set("layers",e)},getFullValue:function(){return this.get("detached")?"":this.get("layers").getFullValue()}})},function(t,e,n){"use strict";(function(e){var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(121);t.exports=e.Collection.extend({model:r,initialize:function(){this.idx=1,this.on("add",this.onAdd),this.on("reset",this.onReset)},onAdd:function(t,e,n){n.noIncrement||t.set("index",this.idx++)},onReset:function(){this.idx=1},getLayersFromValue:function(t){var e=this,n=[];t.replace(/\(([\w\s,.]*)\)/g,function(e){var n=e.replace(/,\s*/g,",");t=t.replace(e,n)});var i=t?t.split(", "):[];return i.forEach(function(t){n.push({properties:e.properties.parseValue(t)})}),n},getLayersFromStyle:function(t){var e=[],n=this.properties;n.pluck("property");return n.each(function(n){var r=t[n.get("property")],o=r?r.split(", "):[];o.forEach(function(t,r){t=n.parseValue(t.trim()).value;var o=e[r],s=i({},n.attributes,{value:t});o?o.properties.push(s):e[r]={properties:[s]}})}),e.forEach(function(t){var e=t.properties.map(function(t){return t.property});n.each(function(n){var r=n.get("property");e.indexOf(r)<0&&t.properties.push(i({},n.attributes))})}),e},active:function(t){this.each(function(t){return t.set("active",0)});var e=this.at(t);e&&e.set("active",1)},getFullValue:function(){var t=[];return this.each(function(e){return t.push(e.getFullValue())}),t.join(", ")},getPropertyValues:function(t){var e=[];return this.each(function(n){var i=n.getPropertyValue(t);i&&e.push(i)}),e.join(", ")}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){t.exports=e.Model.extend({defaults:{index:"",value:"",values:{},active:!1,preview:!1,properties:[]},initialize:function(){var t=n(11),e=this.get("properties"),i=this.get("value");if(this.set("properties",e instanceof t?e:new t(e)),!i){var r="",o=this.get("values");for(var s in o)r+=" "+o[s];this.set("value",r.trim())}},getPropertyValue:function(t){var e="";return this.get("properties").each(function(n){n.get("property")==t&&(e=n.getFullValue())}),e},getFullValue:function(){var t=[];return this.get("properties").each(function(e){return t.push(e.getFullValue())}),t.join(" ")}})}).call(e,n(0))},function(t,e,n){"use strict";(function(t){var e="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};!function(e){e(t.$)}(function(t,n){function i(e,n,i,r){for(var o=[],s=0;s<e.length;s++){var a=e[s];if(a){var l=lt(a),c=l.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";c+=lt.equals(n,a)?" sp-thumb-active":"";var u=l.toString(r.preferredFormat||"rgb"),h=X?"background-color:"+l.toRgbString():"filter:"+l.toFilter();o.push('<span title="'+u+'" data-color="'+l.toRgbString()+'" class="'+c+'"><span class="sp-thumb-inner" style="'+h+';"></span></span>')}else{var d="sp-clear-display";o.push(t("<div />").append(t('<span data-color="" style="background-color:transparent;" class="'+d+'"></span>').attr("title",r.noColorSelectedText)).html())}}return"<div class='sp-cf "+i+"'>"+o.join("")+"</div>"}function r(){for(var t=0;t<G.length;t++)G[t]&&G[t].hide()}function o(e,n){var i=t.extend({},K,e);return i.callbacks={move:u(i.move,n),change:u(i.change,n),show:u(i.show,n),hide:u(i.hide,n),beforeShow:u(i.beforeShow,n)},i}function s(e,s){function l(){if(H.showPaletteOnly&&(H.showPalette=!0),$t.text(H.showPaletteOnly?H.togglePaletteMoreText:H.togglePaletteLessText),H.palette){pt=H.palette.slice(0),gt=t.isArray(pt[0])?pt:[pt],vt={};for(var e=0;e<gt.length;e++)for(var n=0;n<gt[e].length;n++){var i=lt(gt[e][n]).toRgbString();vt[i]=!0}}St.toggleClass("sp-flat",j),St.toggleClass("sp-input-disabled",!H.showInput),St.toggleClass("sp-alpha-enabled",H.showAlpha),St.toggleClass("sp-clear-enabled",Jt),St.toggleClass("sp-buttons-disabled",!H.showButtons),St.toggleClass("sp-palette-buttons-disabled",!H.togglePaletteOnly),St.toggleClass("sp-palette-disabled",!H.showPalette),St.toggleClass("sp-palette-only",H.showPaletteOnly),St.toggleClass("sp-initial-disabled",!H.showInitial),St.addClass(H.className).addClass(H.containerClassName),_()}function u(){function e(e){return e.data&&e.data.ignore?(P(t(e.target).closest(".sp-thumb-el").data("color")),L()):(P(t(e.target).closest(".sp-thumb-el").data("color")),L(),I(!0),H.hideAfterPaletteSelect&&E()),!1}if(Y&&St.find("*:not(input)").attr("unselectable","on"),l(),jt&&Ct.after(Bt).hide(),Jt||zt.hide(),j)Ct.after(St).hide();else{var n="parent"===H.appendTo?Ct.parent():t(H.appendTo);1!==n.length&&(n=t("body")),n.append(St)}p(),Wt.bind("click.spectrum touchstart.spectrum",function(e){kt||C(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(Ct.is(":disabled")||H.disabled===!0)&&$(),St.click(c),Dt.change(w),Dt.bind("paste",function(){setTimeout(w,1)}),Dt.keydown(function(t){13==t.keyCode&&w()}),Ft.text(H.cancelText),Ft.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),M(),E()}),zt.attr("title",H.clearText),zt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Xt=!0,L(),j&&I(!0)}),Rt.text(H.chooseText),Rt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Y&&Dt.is(":focus")&&Dt.trigger("change"),O()&&(I(!0),E())}),$t.text(H.showPaletteOnly?H.togglePaletteMoreText:H.togglePaletteLessText),$t.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),H.showPaletteOnly=!H.showPaletteOnly,H.showPaletteOnly||j||St.css("left","-="+(Tt.outerWidth(!0)+5)),l()}),h(Lt,function(t,e,n){ft=t/st,Xt=!1,n.shiftKey&&(ft=Math.round(10*ft)/10),L()},b,x),h(Pt,function(t,e){ut=parseFloat(e/rt),Xt=!1,H.showAlpha||(ft=1),L()},b,x),h(Et,function(t,e,n){if(n.shiftKey){if(!xt){var i=ht*et,r=nt-dt*nt,o=Math.abs(t-i)>Math.abs(e-r);xt=o?"x":"y"}}else xt=null;var s=!xt||"x"===xt,a=!xt||"y"===xt;s&&(ht=parseFloat(t/et)),a&&(dt=parseFloat((nt-e)/nt)),Xt=!1,H.showAlpha||(ft=1),L()},b,x),qt?(P(qt),N(),Gt=H.preferredFormat||lt(qt).format,g(qt)):N(),j&&k();var i=Y?"mousedown.spectrum":"click.spectrum touchstart.spectrum";It.delegate(".sp-thumb-el",i,e),_t.delegate(".sp-thumb-el:nth-child(1)",i,{ignore:!0},e)}function p(){if(W&&window.localStorage){try{var e=window.localStorage[W].split(",#");e.length>1&&(delete window.localStorage[W],t.each(e,function(t,e){g(e)}))}catch(n){}try{mt=window.localStorage[W].split(";")}catch(n){}}}function g(e){if(B){var n=lt(e).toRgbString();if(!vt[n]&&t.inArray(n,mt)===-1)for(mt.push(n);mt.length>yt;)mt.shift();if(W&&window.localStorage)try{window.localStorage[W]=mt.join(";")}catch(i){}}}function v(){var t=[];if(H.showPalette)for(var e=0;e<mt.length;e++){var n=lt(mt[e]).toRgbString();vt[n]||t.push(mt[e])}return t.reverse().slice(0,H.maxSelectionSize)}function m(){var e=A(),n=t.map(gt,function(t,n){return i(t,e,"sp-palette-row sp-palette-row-"+n,H)});p(),mt&&n.push(i(v(),e,"sp-palette-row sp-palette-row-selection",H)),It.html(n.join(""))}function y(){if(H.showInitial){var t=Kt,e=A();_t.html(i([t,e],e,"sp-palette-row-initial",H))}}function b(){(nt<=0||et<=0||rt<=0)&&_(),tt=!0,St.addClass(bt),xt=null,Ct.trigger("dragstart.spectrum",[A()])}function x(){tt=!1,St.removeClass(bt),Ct.trigger("dragstop.spectrum",[A()])}function w(){var t=Dt.val();if(null!==t&&""!==t||!Jt){var e=lt(t);e.isValid()?(P(e),I(!0)):Dt.addClass("sp-validation-error")}else P(null),I(!0)}function C(){Q?E():k()}function k(){var e=t.Event("beforeShow.spectrum");if(Q)return void _();if(Ct.trigger(e,[A()]),q.beforeShow(A())!==!1&&!e.isDefaultPrevented()){r(),Q=!0;var n=t(wt);n.bind("keydown.spectrum",S),n.bind("click.spectrum",T),t(window).bind("resize.spectrum",K),Bt.addClass("sp-active"),St.removeClass("sp-hidden"),_(),N(),Kt=A(),y(),q.show(Kt),Ct.trigger("show.spectrum",[Kt])}}function S(t){27===t.keyCode&&E()}function T(t){2!=t.button&&(tt||(Yt?I(!0):M(),E()))}function E(){Q&&!j&&(Q=!1,t(wt).unbind("keydown.spectrum",S),t(wt).unbind("click.spectrum",T),t(window).unbind("resize.spectrum",K),Bt.removeClass("sp-active"),St.addClass("sp-hidden"),q.hide(A()),Ct.trigger("hide.spectrum",[A()]))}function M(){P(Kt,!0)}function P(t,e){if(lt.equals(t,A()))return void N();var n,i;!t&&Jt?Xt=!0:(Xt=!1,n=lt(t),i=n.toHsv(),ut=i.h%360/360,ht=i.s,dt=i.v,ft=i.a),N(),n&&n.isValid()&&!e&&(Gt=H.preferredFormat||n.getFormat())}function A(t){return t=t||{},Jt&&Xt?null:lt.fromRatio({h:ut,s:ht,v:dt,a:Math.round(100*ft)/100},{format:t.format||Gt})}function O(){return!Dt.hasClass("sp-validation-error")}function L(){N(),q.move(A()),Ct.trigger("move.spectrum",[A()])}function N(){Dt.removeClass("sp-validation-error"),D();var t=lt.fromRatio({h:ut,s:1,v:1});Et.css("background-color",t.toHexString());var e=Gt;ft<1&&(0!==ft||"name"!==e)&&("hex"!==e&&"hex3"!==e&&"hex6"!==e&&"name"!==e||(e="rgb"));
var n=A({format:e}),i="";if(Ut.removeClass("sp-clear-display"),Ut.css("background-color","transparent"),!n&&Jt)Ut.addClass("sp-clear-display");else{var r=n.toHexString(),o=n.toRgbString();if(X||1===n.alpha?Ut.css("background-color",o):(Ut.css("background-color","transparent"),Ut.css("filter",n.toFilter())),H.showAlpha){var s=n.toRgb();s.a=0;var a=lt(s).toRgbString(),l="linear-gradient(left, "+a+", "+r+")";Y?Ot.css("filter",lt(a).toFilter({gradientType:1},r)):(Ot.css("background","-webkit-"+l),Ot.css("background","-moz-"+l),Ot.css("background","-ms-"+l),Ot.css("background","linear-gradient(to right, "+a+", "+r+")"))}i=n.toString(e)}H.showInput&&Dt.val(i),H.showPalette&&m(),y()}function D(){var t=ht,e=dt;if(Jt&&Xt)Nt.hide(),At.hide(),Mt.hide();else{Nt.show(),At.show(),Mt.show();var n=t*et,i=nt-e*nt;n=Math.max(-it,Math.min(et-it,n-it)),i=Math.max(-it,Math.min(nt-it,i-it)),Mt.css({top:i+"px",left:n+"px"});var r=ft*st;Nt.css({left:r-at/2+"px"});var o=ut*rt;At.css({top:o-ct+"px"})}}function I(t){var e=A(),n="",i=!lt.equals(e,Kt);e&&(n=e.toString(Gt),g(e)),Vt&&Ct.val(n),t&&i&&(q.change(e),Ct.trigger("change",[e]))}function _(){Q&&(et=Et.width(),nt=Et.height(),it=Mt.height(),ot=Pt.width(),rt=Pt.height(),ct=At.height(),st=Lt.width(),at=Nt.width(),j||(St.css("position","absolute"),H.offset?St.offset(H.offset):St.offset(a(St,Wt))),D(),H.showPalette&&m(),Ct.trigger("reflow.spectrum"))}function F(){Ct.show(),Wt.unbind("click.spectrum touchstart.spectrum"),St.remove(),Bt.remove(),G[Zt.id]=null}function z(e,i){return e===n?t.extend({},H):i===n?H[e]:(H[e]=i,"preferredFormat"===e&&(Gt=H.preferredFormat),void l())}function R(){kt=!1,Ct.attr("disabled",!1),Wt.removeClass("sp-disabled")}function $(){E(),kt=!0,Ct.attr("disabled",!0),Wt.addClass("sp-disabled")}function V(t){H.offset=t,_()}var H=o(s,e),j=H.flat,B=H.showSelectionPalette,W=H.localStorageKey,U=H.theme,q=H.callbacks,K=d(_,10),Q=!1,tt=!1,et=0,nt=0,it=0,rt=0,ot=0,st=0,at=0,ct=0,ut=0,ht=0,dt=0,ft=1,pt=[],gt=[],vt={},mt=H.selectionPalette.slice(0),yt=H.maxSelectionSize,bt="sp-dragging",xt=null,wt=e.ownerDocument,Ct=(wt.body,t(e)),kt=!1,St=t(Z,wt).addClass(U),Tt=St.find(".sp-picker-container"),Et=St.find(".sp-color"),Mt=St.find(".sp-dragger"),Pt=St.find(".sp-hue"),At=St.find(".sp-slider"),Ot=St.find(".sp-alpha-inner"),Lt=St.find(".sp-alpha"),Nt=St.find(".sp-alpha-handle"),Dt=St.find(".sp-input"),It=St.find(".sp-palette"),_t=St.find(".sp-initial"),Ft=St.find(".sp-cancel"),zt=St.find(".sp-clear"),Rt=St.find(".sp-choose"),$t=St.find(".sp-palette-toggle"),Vt=Ct.is("input"),Ht=Vt&&"color"===Ct.attr("type")&&f(),jt=Vt&&!j,Bt=jt?t(J).addClass(U).addClass(H.className).addClass(H.replacerClassName):t([]),Wt=jt?Bt:Ct,Ut=Bt.find(".sp-preview-inner"),qt=H.color||Vt&&Ct.val(),Kt=!1,Gt=H.preferredFormat,Yt=!H.showButtons||H.clickoutFiresChange,Xt=!qt,Jt=H.allowEmpty&&!Ht;u();var Zt={show:k,hide:E,toggle:C,reflow:_,option:z,enable:R,disable:$,offset:V,set:function(t){P(t),I()},get:A,destroy:F,container:St};return Zt.id=G.push(Zt)-1,Zt}function a(e,n){var i=0,r=e.outerWidth(),o=e.outerHeight(),s=n.outerHeight(),a=e[0].ownerDocument,l=a.documentElement,c=l.clientWidth,u=l.clientHeight,h=t(a).scrollLeft(),d=t(a).scrollTop(),f=c+h,p=u+d,g=n.offset();return g.top+=s,g.left-=Math.min(g.left,g.left+r>f&&f>r?Math.abs(g.left+r-f):0),g.top-=Math.min(g.top,g.top+o>p&&p>o?Math.abs(o+s-i):i),g}function l(){}function c(t){t.stopPropagation()}function u(t,e){var n=Array.prototype.slice,i=n.call(arguments,2);return function(){return t.apply(e,i.concat(n.call(arguments)))}}function h(e,n,i,r){function o(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function s(t){if(u){if(Y&&c.documentMode<9&&!t.button)return l();var i=t.originalEvent&&t.originalEvent.touches&&t.originalEvent.touches[0],r=i&&i.pageX||t.pageX,s=i&&i.pageY||t.pageY,a=Math.max(0,Math.min(r-h.left,f)),g=Math.max(0,Math.min(s-h.top,d));p&&o(t),n.apply(e,[a,g,t])}}function a(n){var r=n.which?3==n.which:2==n.button;r||u||i.apply(e,arguments)!==!1&&(u=!0,d=t(e).height(),f=t(e).width(),h=t(e).offset(),t(c).bind(g),t(c.body).addClass("sp-dragging"),s(n),o(n))}function l(){u&&(t(c).unbind(g),t(c.body).removeClass("sp-dragging"),setTimeout(function(){r.apply(e,arguments)},0)),u=!1}n=n||function(){},i=i||function(){},r=r||function(){};var c=document,u=!1,h={},d=0,f=0,p="ontouchstart"in window,g={};g.selectstart=o,g.dragstart=o,g["touchmove mousemove"]=s,g["touchend mouseup"]=l,t(e).bind("touchstart mousedown",a)}function d(t,e,n){var i;return function(){var r=this,o=arguments,s=function(){i=null,t.apply(r,o)};n&&clearTimeout(i),!n&&i||(i=setTimeout(s,e))}}function f(){return t.fn.spectrum.inputTypeColorSupport()}function p(t){var n={r:0,g:0,b:0},i=1,r=!1,o=!1;return"string"==typeof t&&(t=q(t)),"object"==("undefined"==typeof t?"undefined":e(t))&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(n=g(t.r,t.g,t.b),r=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=B(t.s),t.v=B(t.v),n=b(t.h,t.s,t.v),r=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=B(t.s),t.l=B(t.l),n=m(t.h,t.s,t.l),r=!0,o="hsl"),t.hasOwnProperty("a")&&(i=t.a)),i=F(i),{ok:r,format:t.format||o,r:ot(255,st(n.r,0)),g:ot(255,st(n.g,0)),b:ot(255,st(n.b,0)),a:i}}function g(t,e,n){return{r:255*z(t,255),g:255*z(e,255),b:255*z(n,255)}}function v(t,e,n){t=z(t,255),e=z(e,255),n=z(n,255);var i,r,o=st(t,e,n),s=ot(t,e,n),a=(o+s)/2;if(o==s)i=r=0;else{var l=o-s;switch(r=a>.5?l/(2-o-s):l/(o+s),o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return{h:i,s:r,l:a}}function m(t,e,n){function i(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}var r,o,s;if(t=z(t,360),e=z(e,100),n=z(n,100),0===e)r=o=s=n;else{var a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;r=i(l,a,t+1/3),o=i(l,a,t),s=i(l,a,t-1/3)}return{r:255*r,g:255*o,b:255*s}}function y(t,e,n){t=z(t,255),e=z(e,255),n=z(n,255);var i,r,o=st(t,e,n),s=ot(t,e,n),a=o,l=o-s;if(r=0===o?0:l/o,o==s)i=0;else{switch(o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return{h:i,s:r,v:a}}function b(t,e,n){t=6*z(t,360),e=z(e,100),n=z(n,100);var i=it.floor(t),r=t-i,o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),l=i%6,c=[n,s,o,o,a,n][l],u=[a,n,n,s,o,o][l],h=[o,o,a,n,n,s][l];return{r:255*c,g:255*u,b:255*h}}function x(t,e,n,i){var r=[j(rt(t).toString(16)),j(rt(e).toString(16)),j(rt(n).toString(16))];return i&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function w(t,e,n,i){var r=[j(W(i)),j(rt(t).toString(16)),j(rt(e).toString(16)),j(rt(n).toString(16))];return r.join("")}function C(t,e){e=0===e?0:e||10;var n=lt(t).toHsl();return n.s-=e/100,n.s=R(n.s),lt(n)}function k(t,e){e=0===e?0:e||10;var n=lt(t).toHsl();return n.s+=e/100,n.s=R(n.s),lt(n)}function S(t){return lt(t).desaturate(100)}function T(t,e){e=0===e?0:e||10;var n=lt(t).toHsl();return n.l+=e/100,n.l=R(n.l),lt(n)}function E(t,e){e=0===e?0:e||10;var n=lt(t).toRgb();return n.r=st(0,ot(255,n.r-rt(255*-(e/100)))),n.g=st(0,ot(255,n.g-rt(255*-(e/100)))),n.b=st(0,ot(255,n.b-rt(255*-(e/100)))),lt(n)}function M(t,e){e=0===e?0:e||10;var n=lt(t).toHsl();return n.l-=e/100,n.l=R(n.l),lt(n)}function P(t,e){var n=lt(t).toHsl(),i=(rt(n.h)+e)%360;return n.h=i<0?360+i:i,lt(n)}function A(t){var e=lt(t).toHsl();return e.h=(e.h+180)%360,lt(e)}function O(t){var e=lt(t).toHsl(),n=e.h;return[lt(t),lt({h:(n+120)%360,s:e.s,l:e.l}),lt({h:(n+240)%360,s:e.s,l:e.l})]}function L(t){var e=lt(t).toHsl(),n=e.h;return[lt(t),lt({h:(n+90)%360,s:e.s,l:e.l}),lt({h:(n+180)%360,s:e.s,l:e.l}),lt({h:(n+270)%360,s:e.s,l:e.l})]}function N(t){var e=lt(t).toHsl(),n=e.h;return[lt(t),lt({h:(n+72)%360,s:e.s,l:e.l}),lt({h:(n+216)%360,s:e.s,l:e.l})]}function D(t,e,n){e=e||6,n=n||30;var i=lt(t).toHsl(),r=360/n,o=[lt(t)];for(i.h=(i.h-(r*e>>1)+720)%360;--e;)i.h=(i.h+r)%360,o.push(lt(i));return o}function I(t,e){e=e||6;for(var n=lt(t).toHsv(),i=n.h,r=n.s,o=n.v,s=[],a=1/e;e--;)s.push(lt({h:i,s:r,v:o})),o=(o+a)%1;return s}function _(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function F(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function z(t,e){V(t)&&(t="100%");var n=H(t);return t=ot(e,st(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),it.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function R(t){return ot(1,st(0,t))}function $(t){return parseInt(t,16)}function V(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function H(t){return"string"==typeof t&&t.indexOf("%")!=-1}function j(t){return 1==t.length?"0"+t:""+t}function B(t){return t<=1&&(t=100*t+"%"),t}function W(t){return Math.round(255*parseFloat(t)).toString(16)}function U(t){return $(t)/255}function q(t){t=t.replace(tt,"").replace(et,"").toLowerCase();var e=!1;if(ct[t])t=ct[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=ht.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=ht.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=ht.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=ht.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=ht.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=ht.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=ht.hex8.exec(t))?{a:U(n[1]),r:$(n[2]),g:$(n[3]),b:$(n[4]),format:e?"name":"hex8"}:(n=ht.hex6.exec(t))?{r:$(n[1]),g:$(n[2]),b:$(n[3]),format:e?"name":"hex"}:!!(n=ht.hex3.exec(t))&&{r:$(n[1]+""+n[1]),g:$(n[2]+""+n[2]),b:$(n[3]+""+n[3]),format:e?"name":"hex"}}var K={beforeShow:l,move:l,change:l,show:l,hide:l,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},G=[],Y=!!/msie/i.exec(window.navigator.userAgent),X=function(){function t(t,e){return!!~(""+t).indexOf(e)}var e=document.createElement("div"),n=e.style;return n.cssText="background-color:rgba(0,0,0,.5)",t(n.backgroundColor,"rgba")||t(n.backgroundColor,"hsla")}(),J=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),Z=function(){var t="";if(Y)for(var e=1;e<=6;e++)t+="<div class='sp-"+e+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",t,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}(),Q="spectrum.id";t.fn.spectrum=function(e,n){if("string"==typeof e){var i=this,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var n=G[t(this).data(Q)];if(n){var o=n[e];if(!o)throw new Error("Spectrum: no such method: '"+e+"'");"get"==e?i=n.get():"container"==e?i=n.container:"option"==e?i=n.option.apply(n,r):"destroy"==e?(n.destroy(),t(this).removeData(Q)):o.apply(n,r)}}),i}return this.spectrum("destroy").each(function(){var n=t.extend({},e,t(this).data()),i=s(this,n);t(this).data(Q,i.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=h,t.fn.spectrum.defaults=K,t.fn.spectrum.inputTypeColorSupport=function dt(){if("undefined"==typeof dt._cachedResult){var e=t("<input type='color'/>")[0];dt._cachedResult="color"===e.type&&""!==e.value}return dt._cachedResult},t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.fn.spectrum.processNativeColorInputs=function(){var e=t("input[type=color]");e.length&&!f()&&e.spectrum({preferredFormat:"hex6"})};var tt=/^[\s,#]+/,et=/\s+$/,nt=0,it=Math,rt=it.round,ot=it.min,st=it.max,at=it.random,lt=function ft(t,e){if(t=t?t:"",e=e||{},t instanceof ft)return t;if(!(this instanceof ft))return new ft(t,e);var n=p(t);this._originalInput=t,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=rt(100*this._a)/100,this._format=e.format||n.format,this._gradientType=e.gradientType,this._r<1&&(this._r=rt(this._r)),this._g<1&&(this._g=rt(this._g)),this._b<1&&(this._b=rt(this._b)),this._ok=n.ok,this._tc_id=nt++};lt.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 t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},setAlpha:function(t){return this._a=F(t),this._roundA=rt(100*this._a)/100,this},toHsv:function(){var t=y(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=y(this._r,this._g,this._b),e=rt(360*t.h),n=rt(100*t.s),i=rt(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+i+"%)":"hsva("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=v(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=v(this._r,this._g,this._b),e=rt(360*t.h),n=rt(100*t.s),i=rt(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+i+"%)":"hsla("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return x(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return w(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:rt(this._r),g:rt(this._g),b:rt(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+rt(this._r)+", "+rt(this._g)+", "+rt(this._b)+")":"rgba("+rt(this._r)+", "+rt(this._g)+", "+rt(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:rt(100*z(this._r,255))+"%",g:rt(100*z(this._g,255))+"%",b:rt(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+rt(100*z(this._r,255))+"%, "+rt(100*z(this._g,255))+"%, "+rt(100*z(this._b,255))+"%)":"rgba("+rt(100*z(this._r,255))+"%, "+rt(100*z(this._g,255))+"%, "+rt(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(ut[x(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+w(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var r=lt(t);n=r.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,i=this._a<1&&this._a>=0,r=!e&&i&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return r?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(E,arguments)},darken:function(){return this._applyModification(M,arguments)},desaturate:function(){return this._applyModification(C,arguments)},saturate:function(){return this._applyModification(k,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(P,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(D,arguments)},complement:function(){return this._applyCombination(A,arguments)},monochromatic:function(){return this._applyCombination(I,arguments)},splitcomplement:function(){return this._applyCombination(N,arguments)},triad:function(){return this._applyCombination(O,arguments)},tetrad:function(){return this._applyCombination(L,arguments)}},lt.fromRatio=function(t,n){if("object"==("undefined"==typeof t?"undefined":e(t))){var i={};for(var r in t)t.hasOwnProperty(r)&&("a"===r?i[r]=t[r]:i[r]=B(t[r]));t=i}return lt(t,n)},lt.equals=function(t,e){return!(!t||!e)&&lt(t).toRgbString()==lt(e).toRgbString()},lt.random=function(){return lt.fromRatio({r:at(),g:at(),b:at()})},lt.mix=function(t,e,n){n=0===n?0:n||50;var i,r=lt(t).toRgb(),o=lt(e).toRgb(),s=n/100,a=2*s-1,l=o.a-r.a;i=a*l==-1?a:(a+l)/(1+a*l),i=(i+1)/2;var c=1-i,u={r:o.r*i+r.r*c,g:o.g*i+r.g*c,b:o.b*i+r.b*c,a:o.a*s+r.a*(1-s)};return lt(u)},lt.readability=function(t,e){var n=lt(t),i=lt(e),r=n.toRgb(),o=i.toRgb(),s=n.getBrightness(),a=i.getBrightness(),l=Math.max(r.r,o.r)-Math.min(r.r,o.r)+Math.max(r.g,o.g)-Math.min(r.g,o.g)+Math.max(r.b,o.b)-Math.min(r.b,o.b);return{brightness:Math.abs(s-a),color:l}},lt.isReadable=function(t,e){var n=lt.readability(t,e);return n.brightness>125&&n.color>500},lt.mostReadable=function(t,e){for(var n=null,i=0,r=!1,o=0;o<e.length;o++){var s=lt.readability(t,e[o]),a=s.brightness>125&&s.color>500,l=3*(s.brightness/125)+s.color/500;(a&&!r||a&&r&&l>i||!a&&!r&&l>i)&&(r=a,i=l,n=lt(e[o]))}return n};var ct=lt.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"},ut=lt.hexNames=_(ct),ht=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+r),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=lt,t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})})}).call(e,n(0))},function(t,e,n){"use strict";var i=n(0),r=n(124);t.exports=i.View.extend({initialize:function(t){this.config=t.config||{},this.stackModel=t.stackModel,this.preview=t.preview,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.propsConfig=t.propsConfig;var e=this.pfx,n=this.ppfx,i=this.collection;this.className=e+"layers "+n+"field",this.listenTo(i,"add",this.addTo),this.listenTo(i,"deselectAll",this.deselectAll),this.listenTo(i,"reset",this.render);var r=this.config.em||"",o=r?r.get("Utils"):"";this.sorter=o?new o.Sorter({container:this.el,ignoreViewChildren:1,containerSel:"."+e+"layers",itemSel:"."+e+"layer",pfx:this.config.pStylePrefix}):"",i.view=this,this.$el.data("model",i),this.$el.data("collection",i)},addTo:function(t){var e=this.collection.indexOf(t);this.addToCollection(t,null,e)},addToCollection:function(t,e,n){var i=e||null,o=this.stackModel,s=this.config,a=this.sorter,l=this.propsConfig;"undefined"!=typeof this.preview&&t.set("preview",this.preview);var c=new r({model:t,config:s,sorter:a,stackModel:o,propsConfig:l}),u=c.render().el;if(i)i.appendChild(u);else if("undefined"!=typeof n){var h="before";this.$el.children().length==n&&(n--,h="after"),n<0?this.$el.append(u):this.$el.children().eq(n)[h](u)}else this.$el.append(u);return u},deselectAll:function(){this.$el.find("."+this.pfx+"layer").removeClass(this.pfx+"active")},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.append(t),this.$el.attr("class",this.className),this.sorter&&(this.sorter.plh=null),this}})},function(t,e,n){"use strict";(function(e){t.exports=e.View.extend({events:{click:"active","click [data-close-layer]":"remove","mousedown [data-move-layer]":"initSorter"},template:function(t){var e=this.pfx,n="Layer "+t.get("index");return'\n <div id="'+e+'move" data-move-layer>\n <i class="fa fa-arrows"></i>\n </div>\n <div id="'+e+'label">'+n+'</div>\n <div id="'+e+'preview-box">\n \t<div id="'+e+'preview" data-preview></div>\n </div>\n <div id="'+e+'close-layer" class="'+e+'btn-close" data-close-layer>\n &Cross;\n </div>\n <div id="'+e+'inputs" data-properties></div>\n <div style="clear:both"></div>\n '},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.model;this.stackModel=t.stackModel||{},this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.sorter=t.sorter||null,this.propsConfig=t.propsConfig||{},this.customPreview=t.onPreview,this.listenTo(e,"destroy remove",this.remove),this.listenTo(e,"change:active",this.updateVisibility),this.listenTo(e.get("properties"),"change",this.updatePreview),e.get("preview")||this.$el.addClass(this.pfx+"no-preview"),e.view=this,e.set({droppable:0,draggable:1}),this.$el.data("model",e)},initSorter:function(t){this.sorter&&this.sorter.startSort(this.el)},remove:function(t){t&&t.stopPropagation&&t.stopPropagation();var n=this.model,i=n.collection,r=this.stackModel;e.View.prototype.remove.apply(this,arguments),i.contains(n)&&i.remove(n),r&&r.set&&(r.set({stackIndex:null},{silent:!0}),r.trigger("updateValue"))},onPreview:function(t){var e=t.split(" "),n=3,i=[];return this.model.get("properties").each(function(t,r){var o=e[r]||"";if(o&&"integer"==t.get("type")){var s=parseInt(o,10),a=o.replace(s,"");s=isNaN(s)?0:s,s=s>n?n:s,s=s<-n?-n:s,o=s+a}i.push(o)}),i.join(" ")},updatePreview:function(){var t=this.stackModel,e=this.customPreview,n=this.getPreviewEl(),i=this.model.getFullValue(),r=e?e(i):this.onPreview(i);r&&t&&n&&(n.style[t.get("property")]=r)},getPropertiesWrapper:function(){return this.propsWrapEl||(this.propsWrapEl=this.el.querySelector("[data-properties]")),this.propsWrapEl},getPreviewEl:function(){return this.previewEl||(this.previewEl=this.el.querySelector("[data-preview]")),this.previewEl},active:function(){var t=this.model,e=t.collection;e.active(e.indexOf(t))},updateVisibility:function(){var t=this.pfx,e=this.getPropertiesWrapper(),n=this.model.get("active");e.style.display=n?"":"none",this.$el[n?"addClass":"removeClass"](t+"active")},render:function(){var t=n(13),e=this.propsConfig,i=this.pfx+"layer",r=this.model,o=this.el,s=new t({collection:r.get("properties"),config:this.config,target:e.target,customValue:e.customValue,propTarget:e.propTarget,onChange:e.onChange}).render().el;return o.innerHTML=this.template(r),o.className=i,this.getPropertiesWrapper().appendChild(s),this.updateVisibility(),this.updatePreview(),this}})}).call(e,n(0))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(42);t.exports=r.extend({defaults:i({},r.prototype.defaults,{showInput:1})})},function(t,e,n){"use strict";var i=n(14);t.exports=i.extend({events:{"change [type=range]":"inputValueChanged","input [type=range]":"inputValueChangedSoft"},templateInput:function(t){var e=this.ppfx;return'\n <div class="'+e+"field "+e+'field-range">\n <input type="range"\n min="'+t.get("min")+'"\n max="'+t.get("max")+'"\n step="'+t.get("step")+'"/>\n </div>\n '},getSliderEl:function(){return this.slider||(this.slider=this.el.querySelector("input[type=range]")),this.slider},inputValueChanged:function(){var t=this.model,e=t.get("step");this.getInputEl().value=this.getSliderEl().value;var n=this.getInputValue()-e;t.set("value",n,{avoidStore:1}).set("value",n+e),this.elementUpdated()},inputValueChangedSoft:function(){this.getInputEl().value=this.getSliderEl().value,this.model.set("value",this.getInputValue(),{avoidStore:1}),this.elementUpdated()},setValue:function(t){this.getSliderEl().value=t,this.inputInst.setValue(t,{silent:1})},onRender:function(){i.prototype.onRender.apply(this,arguments),this.model.get("showInput")||(this.inputInst.el.style.display="none")}})},function(t,e,n){"use strict";n(0);t.exports=function(){return{build:function(t){var e=[];"string"==typeof t&&(t=[t]);for(var n=0,i=t.length;n<i;n++){var r={},o=t[n];switch(r.property=o,o){case"border-radius-c":r.property="border-radius"}switch(o){case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"width":case"max-width":case"min-width":case"height":case"max-height":case"min-height":r.fixedValues=["initial","inherit","auto"];break;case"font-size":r.fixedValues=["medium","xx-small","x-small","small","large","x-large","xx-large","smaller","larger","length","initial","inherit"];break;case"letter-spacing":case"line-height":r.fixedValues=["normal","initial","inherit"]}switch(o){case"float":case"position":case"text-align":r.type="radio";break;case"display":case"font-family":case"font-weight":case"border-style":case"box-shadow-type":case"background-repeat":case"background-position":case"background-attachment":case"background-size":case"transition-property":case"transition-timing-function":case"cursor":case"overflow":r.type="select";break;case"top":case"right":case"bottom":case"left":case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"font-size":case"letter-spacing":case"line-height":case"text-shadow-h":case"text-shadow-v":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"border-width":case"box-shadow-h":case"box-shadow-v":case"box-shadow-blur":case"box-shadow-spread":case"transition-duration":case"perspective":case"transform-rotate-x":case"transform-rotate-y":case"transform-rotate-z":case"transform-scale-x":case"transform-scale-y":case"transform-scale-z":r.type="integer";break;case"margin":case"padding":case"border-radius":case"border":case"transform":r.type="composite";break;case"color":case"text-shadow-color":case"background-color":case"border-color":case"box-shadow-color":r.type="color";break;case"text-shadow":case"box-shadow":case"background":case"transition":r.type="stack";break;case"background-image":r.type="file"}switch(o){case"float":case"background-color":case"background-image":case"text-shadow":r.defaults="none";break;case"display":r.defaults="block";break;case"position":r.defaults="static";break;case"top":case"right":case"bottom":case"left":case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"text-shadow-h":case"text-shadow-v":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"box-shadow-h":case"box-shadow-v":case"box-shadow-spread":case"perspective":case"transform-rotate-x":case"transform-rotate-y":case"transform-rotate-z":r.defaults=0;break;case"transform-scale-x":case"transform-scale-y":case"transform-scale-z":r.defaults=1;break;case"box-shadow-blur":r.defaults="5px";break;case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"background-size":case"cursor":r.defaults="auto";break;case"font-family":r.defaults="Arial, Helvetica, sans-serif";break;case"font-size":case"border-width":r.defaults="medium";break;case"font-weight":r.defaults="400";break;case"letter-spacing":case"line-height":r.defaults="normal";break;case"color":case"text-shadow-color":case"border-color":case"box-shadow-color":r.defaults="black";break;case"text-align":r.defaults="left";break;case"border-style":r.defaults="solid";break;case"box-shadow-type":r.defaults="";break;case"background-repeat":r.defaults="repeat";break;case"background-position":r.defaults="left top";break;case"background-attachment":r.defaults="scroll";break;case"transition-property":r.defaults="width";break;case"transition-duration":r.defaults="2";
break;case"transition-timing-function":r.defaults="ease";break;case"overflow":r.defaults="visible"}switch(o){case"top":case"right":case"bottom":case"left":case"margin-top":case"margin-right":case"margin-bottom":case"margin-left":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"text-shadow-h":case"text-shadow-v":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"box-shadow-h":case"box-shadow-v":r.units=["px","%"];break;case"font-size":case"letter-spacing":case"line-height":r.units=["px","em","rem","%"];break;case"border-width":r.units=["px","em"];break;case"box-shadow-blur":case"box-shadow-spread":case"perspective":r.units=["px"];break;case"transition-duration":r.units=["s"];break;case"transform-rotate-x":case"transform-rotate-y":case"transform-rotate-z":r.units=["deg"]}switch(o){case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"min-height":case"min-width":case"max-height":case"max-width":case"width":case"height":case"font-size":case"text-shadow-blur":case"border-radius-c":case"border-top-left-radius":case"border-top-right-radius":case"border-bottom-left-radius":case"border-bottom-right-radius":case"border-width":case"box-shadow-blur":case"transition-duration":case"perspective":r.min=0}switch(o){case"text-shadow":case"box-shadow":case"background":r.preview=!0}switch(o){case"background":r.detached=!0}switch(o){case"transform-rotate-x":r.functionName="rotateX";break;case"transform-rotate-y":r.functionName="rotateY";break;case"transform-rotate-z":r.functionName="rotateZ";break;case"transform-scale-x":r.functionName="scaleX";break;case"transform-scale-y":r.functionName="scaleY";break;case"transform-scale-z":r.functionName="scaleZ";break;case"background-image":r.functionName="url"}switch(o){case"float":r.list=[{value:"none"},{value:"left"},{value:"right"}];break;case"display":r.list=[{value:"block"},{value:"inline"},{value:"inline-block"},{value:"none"}];break;case"position":r.list=[{value:"static"},{value:"relative"},{value:"absolute"},{value:"fixed"}];break;case"font-family":var s=", sans-serif",a=["Arial, Helvetica"+s,"Arial Black, Gadget"+s,"Brush Script MT"+s,"Comic Sans MS, cursive"+s,"Courier New, Courier, monospace","Georgia, serif","Helvetica, serif","Impact, Charcoal"+s,"Lucida Sans Unicode, Lucida Grande"+s,"Tahoma, Geneva"+s,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+s,"Verdana, Geneva"+s];r.list=[];for(var l=0,c=a.length;l<c;l++){var u={};u.value=a[l],u.name=a[l].split(",")[0],r.list.push(u)}break;case"font-weight":r.list=[{value:"100",name:"Thin"},{value:"200",name:"Extra-Light"},{value:"300",name:"Light"},{value:"400",name:"Normal"},{value:"500",name:"Medium"},{value:"600",name:"Semi-Bold"},{value:"700",name:"Bold"},{value:"800",name:"Extra-Bold"},{value:"900",name:"Ultra-Bold"}];break;case"text-align":r.list=[{value:"left"},{value:"center"},{value:"right"},{value:"justify"}];break;case"border-style":r.list=[{value:"none"},{value:"solid"},{value:"dotted"},{value:"dashed"},{value:"double"},{value:"groove"},{value:"ridge"},{value:"inset"},{value:"outset"}];break;case"box-shadow-type":r.list=[{value:"",name:"Outside"},{value:"inset",name:"Inside"}];break;case"background-repeat":r.list=[{value:"repeat"},{value:"repeat-x"},{value:"repeat-y"},{value:"no-repeat"}];break;case"background-position":r.list=[{value:"left top"},{value:"left center"},{value:"left bottom"},{value:"right top"},{value:"right center"},{value:"right bottom"},{value:"center top"},{value:"center center"},{value:"center bottom"}];break;case"background-attachment":r.list=[{value:"scroll"},{value:"fixed"},{value:"local"}];break;case"background-size":r.list=[{value:"auto"},{value:"cover"},{value:"contain"}];break;case"transition-property":r.list=[{value:"all"},{value:"width"},{value:"height"},{value:"background-color"},{value:"transform"},{value:"box-shadow"},{value:"opacity"}];break;case"transition-timing-function":r.list=[{value:"linear"},{value:"ease"},{value:"ease-in"},{value:"ease-out"},{value:"ease-in-out"}];break;case"cursor":r.list=[{value:"auto"},{value:"pointer"},{value:"copy"},{value:"crosshair"},{value:"grab"},{value:"grabbing"},{value:"help"},{value:"move"},{value:"text"}];break;case"overflow":r.list=[{value:"visible"},{value:"hidden"},{value:"scroll"},{value:"auto"}]}switch(o){case"margin":r.properties=this.build(["margin-top","margin-right","margin-bottom","margin-left"]);break;case"padding":r.properties=this.build(["padding-top","padding-right","padding-bottom","padding-left"]);break;case"text-shadow":r.properties=this.build(["text-shadow-h","text-shadow-v","text-shadow-blur","text-shadow-color"]);break;case"border":r.properties=this.build(["border-width","border-style","border-color"]);break;case"border-radius":r.properties=this.build(["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"]);break;case"box-shadow":r.properties=this.build(["box-shadow-h","box-shadow-v","box-shadow-blur","box-shadow-spread","box-shadow-color","box-shadow-type"]);break;case"background":r.properties=this.build(["background-image","background-repeat","background-position","background-attachment","background-size"]);break;case"transition":r.properties=this.build(["transition-property","transition-duration","transition-timing-function"]);break;case"transform":r.properties=this.build(["transform-rotate-x","transform-rotate-y","transform-rotate-z","transform-scale-x","transform-scale-y","transform-scale-z"])}e.push(r)}return e}}}},function(t,e,n){"use strict";(function(e){var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(1),o=n(129);t.exports=e.View.extend({initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=t.target||{};var n={};(0,r.extend)(n,e.Events);var o=document.body,s=document.createElement("el-"+(new Date).getTime());o.appendChild(s),n.computedDefault=i({},window.getComputedStyle(s)),o.removeChild(s),this.propTarget=n;var a=this.collection,l="change:selectedComponent component:update:classes component:update:state change:device";this.listenTo(a,"add",this.addTo),this.listenTo(a,"reset",this.render),this.listenTo(this.target,l,this.targetUpdated)},addTo:function(t){this.addToCollection(t)},targetUpdated:function(){var t=this.target,e=this.propTarget,n=t.getSelected();if(n){var i=t.get("Config"),r=i.devicePreviewMode?"":n.get("state"),o=n.getEl();if(e.helper=null,o){var s=r?":"+r:null;e.computed=window.getComputedStyle(o,s)}var a=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.get("CssComposer"),r="hc-state",o=i.getAll(),s=i.getClassRule(r);s?(o.remove(s),o.add(s)):s=i.setClassRule(r),s.set("important",1),s.setStyle(n),e.helper=s};n=t.get("StyleManager").getModelToStyle(n),r&&a(n.getStyle()),e.model=n,e.trigger("update")}},addToCollection:function(t,e){var n=e||null,i=new o({model:t,id:this.pfx+t.get("name").replace(" ","_").toLowerCase(),name:t.get("name"),properties:t.get("properties"),target:this.target,propTarget:this.propTarget,config:this.config}),r=i.render().el;return n?n.appendChild(r):this.$el.append(r),r},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.each(function(e){this.addToCollection(e,t)},this),this.$el.attr("id",this.pfx+"sectors"),this.$el.append(t),this}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=n(0),r=n(13);t.exports=i.View.extend({template:e.template('\n <div class="<%= pfx %>title" data-sector-title>\n <i id="<%= pfx %>caret" class="fa"></i>\n <%= label %>\n </div>'),events:{"click [data-sector-title]":"toggle"},initialize:function(t){this.config=t.config||{},this.pfx=this.config.stylePrefix||"",this.target=t.target||{},this.propTarget=t.propTarget||{},this.caretR="fa-caret-right",this.caretD="fa-caret-down";var e=this.model;this.listenTo(e,"change:open",this.updateOpen),this.listenTo(e,"updateVisibility",this.updateVisibility),this.listenTo(e,"destroy remove",this.remove)},updateVisibility:function(){var t;this.model.get("properties").each(function(e){e.get("visible")&&(t=1)}),this.el.style.display=t?"block":"none"},updateOpen:function(){this.model.get("open")?this.show():this.hide()},show:function(){this.$el.addClass(this.pfx+"open"),this.getPropertiesEl().style.display="",this.$caret.removeClass(this.caretR).addClass(this.caretD)},hide:function(){this.$el.removeClass(this.pfx+"open"),this.getPropertiesEl().style.display="none",this.$caret.removeClass(this.caretD).addClass(this.caretR)},getPropertiesEl:function(){return this.$el.find("."+this.pfx+"properties").get(0)},toggle:function(t){var e=this.model.get("open")?0:1;this.model.set("open",e)},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 t=this.model.get("properties");if(t){var e=new r({collection:t,target:this.target,propTarget:this.propTarget,config:this.config});this.$el.append(e.render().el)}}})}).call(e,n(1))},function(t,e,n){"use strict";t.exports=function(){var t={},e=n(131),i=n(132),r=n(135),o=n(45),s=void 0,a=void 0,l=void 0;return{name:"AssetManager",storageKey:"assets",getConfig:function(){return t},init:function(n){var c=this;t=n||{};for(var u in e)u in t||(t[u]=e[u]);var h=t.pStylePrefix,d=t.em;h&&(t.stylePrefix=h+t.stylePrefix),s=new i([]);var f={collection:new i([]),globalCollection:s,config:t};return l=new o(f),f.fu=l,a=new r(f),s.listenTo(s,"add",function(t){c.getAllVisible().add(t),d&&d.trigger("asset:add",t)}),s.listenTo(s,"remove",function(t){c.getAllVisible().remove(t),d&&d.trigger("asset:remove",t)}),this},add:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"undefined"==typeof e.at&&(e.at=0),s.add(t,e)},get:function(t){return s.where({src:t})[0]},getAll:function(){return s},getAllVisible:function(){return a.collection},remove:function(t){var e=this.get(t);return this.getAll().remove(e),this},store:function(e){var n={},i=JSON.stringify(this.getAll().toJSON());return n[this.storageKey]=i,!e&&t.stm&&t.stm.store(n),n},load:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.storageKey,n=t[e]||[];if("string"==typeof n)try{n=JSON.parse(t[e])}catch(i){}return n&&n.length&&this.getAll().reset(n),n},getContainer:function(){return a.el},getAssetsEl:function(){return a.el.querySelector("[data-el=assets]")},render:function(t){var e=t||this.getAll().models;return a.rendered||a.render(),a.collection.reset(e),this.getContainer()},addType:function(t,e){this.getAll().addType(t,e)},getType:function(t){return this.getAll().getType(t)},getTypes:function(){return this.getAll().getTypes()},AssetsView:function(){return a},FileUploader:function(){return l},onLoad:function(){this.getAll().reset(t.assets)},postRender:function(e){t.dropzone&&l.initDropzone(e)},setTarget:function(t){a.collection.target=t},onSelect:function(t){a.collection.onSelect=t},onClick:function(e){t.onClick=e},onDblClick:function(e){t.onDblClick=e}}}},function(t,e,n){"use strict";t.exports={assets:[],noAssets:"",stylePrefix:"am-",upload:0,uploadName:"files",headers:{},params:{},autoAdd:1,uploadText:"Drop files here or click to upload",addBtnText:"Add image",uploadFile:"",handleAdd:"",dropzone:0,openAssetsOnDrop:1,dropzoneContent:"",modalTitle:"Select Image",inputPlaceholder:"http://path/to/the/image.jpg"}},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=n(32),o=i(r);t.exports=n(0).Collection.extend(o["default"]).extend({types:[{id:"image",model:n(133),view:n(43),isType:function(t){return"string"==typeof t?{type:"image",src:t}:t}}]})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(134);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"image",unitDim:"px",height:0,width:0})})},function(t,e,n){"use strict";t.exports=n(0).Model.extend({idAttribute:"src",defaults:{type:"",src:""},getFilename:function(){return this.get("src").split("/").pop()},getExtension:function(){return this.getFilename().split(".").pop()}})},function(t,e,n){"use strict";(function(e){n(44),n(43),n(45);t.exports=e.View.extend({events:{submit:"handleSubmit"},template:function(t){var e=t.pfx,n=t.ppfx;return'\n <div class="'+e+'assets-cont">\n <div class="'+e+'assets-header">\n <form class="'+e+'add-asset">\n <div class="'+n+"field "+e+'add-field">\n <input placeholder="'+t.config.inputPlaceholder+'"/>\n </div>\n <button class="'+n+'btn-prim">'+t.config.addBtnText+'</button>\n <div style="clear:both"></div>\n </form>\n <div class="'+e+'dips" style="display:none">\n <button class="fa fa-th <%'+n+'btnt"></button>\n <button class="fa fa-th-list <%'+n+'btnt"></button>\n </div>\n </div>\n <div class="'+e+'assets" data-el="assets"></div>\n <div style="clear:both"></div>\n </div>\n '},initialize:function(t){this.options=t,this.config=t.config,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"";var e=this.collection;this.listenTo(e,"reset",this.renderAssets),this.listenTo(e,"add",this.addToAsset),this.listenTo(e,"remove",this.removedAsset),this.listenTo(e,"deselectAll",this.deselectAll)},handleSubmit:function(t){t.preventDefault();var e=this.getAddInput(),n=e.value.trim(),i=this.config.handleAdd;n&&(e.value="",this.getAssetsEl().scrollTop=0,i?i(n):this.options.globalCollection.add(n,{at:0}))},getAssetsEl:function(){return this.el.querySelector("."+this.pfx+"assets")},getAddInput:function(){return this.inputUrl&&this.inputUrl.value||(this.inputUrl=this.el.querySelector("."+this.pfx+"add-asset input")),this.inputUrl},removedAsset:function(t){this.collection.length||this.toggleNoAssets()},addToAsset:function(t){1==this.collection.length&&this.toggleNoAssets(1),this.addAsset(t)},addAsset:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e,i=this.collection,r=this.config,o=new t.typeView({model:t,collection:i,config:r}).render().el;if(n)n.appendChild(o);else{var s=this.getAssetsEl();s&&s.insertBefore(o,s.firstChild)}return o},toggleNoAssets:function(t){var e=this.$el.find("."+this.pfx+"assets");if(t)e.empty();else{var n=this.config.noAssets;n&&e.append(n)}},deselectAll:function(){var t=this.pfx;this.$el.find("."+t+"highlight").removeClass(t+"highlight")},renderAssets:function(){var t=this,e=document.createDocumentFragment(),n=this.$el.find("."+this.pfx+"assets");n.empty(),this.toggleNoAssets(this.collection.length),this.collection.each(function(n){return t.addAsset(n,e)}),n.append(e)},render:function(){var t=this.options.fu.render().el;return this.$el.empty(),this.$el.append(t).append(this.template(this)),this.el.className=this.ppfx+"asset-manager",this.renderAssets(),this.rendered=1,this}})}).call(e,n(0))},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};t.exports=function(){var t,e,r=void 0,o={},s=n(137),a=n(46),l=n(138),c=n(139),u=n(10),h=n(7);return{Selectors:u,name:"CssComposer",storageKey:function(){var t=[],e=o.stm&&o.stm.getConfig()||{};return e.storeCss&&t.push("css"),e.storeStyles&&t.push("styles"),t},init:function(n){o=n||{};for(var i in s)i in o||(o[i]=s[i]);var a=o.pStylePrefix;a&&(o.stylePrefix=a+o.stylePrefix);var u=o.em&&o.em.config.style||"";return o.rules=u||o.rules,r=o.em,t=new l([],o),e=new c({collection:t,config:o}),this},onLoad:function(){t.add(o.rules)},postLoad:function(t){var e=this,n="add remove",i=this.getAll();t.stopListening(i,n,this.handleChange),t.listenTo(i,n,this.handleChange),i.each(function(t){return e.handleChange(t)})},handleChange:function(t){var e="change:style",n=r.get("UndoManager");n&&n.add(t);var i=r.handleUpdates.bind(r);r.stopListening(t,e,i),r.listenTo(t,e,i)},load:function(e){var n=e||"";!n&&o.stm&&(n=o.em.getCacheLoad());var i=n.styles||"";if(n.styles)try{i=JSON.parse(n.styles)}catch(r){}else n.css&&(i=o.em.get("Parser").parseCss(n.css));return i&&t.reset(i),i},store:function(e){if(o.stm){var n={},i=this.storageKey();return i.indexOf("css")>=0&&(n.css=o.em.getCss()),i.indexOf("styles")>=0&&(n.styles=JSON.stringify(t)),e||o.stm.store(n),n}},add:function(e,n,i,r){var s=n||"",l=i||"",c=r||{},u=this.get(e,s,l,c);return u?u:(c.state=s,c.mediaText=l,c.selectors="",u=new a(c,o),u.get("selectors").add(e),t.add(u),u)},get:function(e,n,i,r){var o=null;return t.each(function(t){o||t.compare(e,n,i,r)&&(o=t)}),o},getAll:function(){return t},clear:function(){return this.getAll().reset(),this},addCollection:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=t instanceof Array?t:[t],s=0,a=r.length;s<a;s++){var l=r[s]||{};if(l.selectors){for(var c=o.em&&o.em.get("SelectorManager"),u=l.selectors,h=u instanceof Array?u:[u],d=[],f=0,p=h.length;f<p;f++){var g=c.add(h[f]);d.push(g)}var v=this.get(d,l.state,l.mediaText,l),m=this.add(d,l.state,l.mediaText,l),y=!v||!e.avoidUpdateStyle,b=l.style||{};if(y){var x=e.extend?i({},m.get("style"),b):b;m.set("style",x)}n.push(m)}}return n},setIdRule:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.state||"",o=n.mediaText||r.getCurrentMedia(),s=r.get("SelectorManager"),a=s.add({name:t,type:h.TYPE_ID}),l=this.add(a,i,o);return l.setStyle(e,n),l},getIdRule:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.state||"",i=e.mediaText||r.getCurrentMedia(),o=r.get("SelectorManager").get(t,h.TYPE_ID);return o&&this.get(o,n,i)},setClassRule:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.state||"",o=n.mediaText||r.getCurrentMedia(),s=r.get("SelectorManager"),a=s.add({name:t,type:h.TYPE_CLASS}),l=this.add(a,i,o);return l.setStyle(e,n),l},getClassRule:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.state||"",i=e.mediaText||r.getCurrentMedia(),o=r.get("SelectorManager").get(t,h.TYPE_CLASS);return o&&this.get(o,n,i)},render:function(){return e.render().el}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"css-",staticRules:"",rules:[]}},function(t,e,n){"use strict";var i=n(0),r=n(46);t.exports=i.Collection.extend({initialize:function(t,e){e&&e.em&&(this.editor=e.em),this.model=function(t,n){var i;return!n.em&&e&&e.em&&(n.em=e.em),i=new r(t,n)}},add:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t&&(t=this.editor.get("Parser").parseCss(t)),e.em=this.editor,i.Collection.prototype.add.apply(this,[t,e])}})},function(t,e,n){"use strict";var i=n(48),r=n(140);t.exports=n(0).View.extend({initialize:function(t){var e=t.config||{};this.atRules={},this.config=e,this.em=e.em,this.pfx=e.stylePrefix||"",this.className=this.pfx+"rules";var n=this.collection;this.listenTo(n,"add",this.addTo),this.listenTo(n,"reset",this.render)},addTo:function(t){this.addToCollection(t)},addToCollection:function(t,e){var n=e||null,o=this.config,s=void 0,a=void 0,l={model:t,config:o};if("keyframes"==t.get("atRuleType")){var c=t.getAtRule(),u=this.atRules[c];if(!u){var h=document.createElement("style");u=document.createTextNode(""),h.appendChild(document.createTextNode(c+"{")),h.appendChild(u),h.appendChild(document.createTextNode("}")),this.atRules[c]=u,s=h}a=new r(l),u.appendData(a.render().el.textContent)}else a=new i(l),s=a.render().el;return s&&(n?n.appendChild(s):this.$el.append(s)),s},render:function(){var t=this;this.atRules={};var e=this.$el,n=document.createDocumentFragment();return e.empty(),this.collection.each(function(e){return t.addToCollection(e,n)}),e.append(n),e.attr("class",this.className),this}})},function(t,e,n){"use strict";t.exports=n(48).extend({_createElement:function(t){return document.createTextNode("")},render:function(){var t=this.model,e=t.get("important");return this.el.textContent=t.getDeclaration({important:e}),this}})},function(t,e,n){"use strict";var i=n(1);t.exports=function(){var t={},e=n(142),r=n(143),o=void 0;return{TraitsView:r,name:"TraitManager",getConfig:function(){return t},init:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=n,(0,i.defaults)(t,e);var s=t.pStylePrefix;return s&&(t.stylePrefix=""+s+t.stylePrefix),o=new r({collection:[],editor:t.em,config:t}),this},getTraitsViewer:function(){return o},addType:function(t,e){var n=o.itemView;o.itemsView[t]=n.extend(e)},getType:function(t){return o.itemsView[t]}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"trt-",labelContainer:"Component settings",labelPlhText:"eg. Text here",labelPlhHref:"eg. https://google.com",optionsTarget:[{value:"",name:"This window"},{value:"_blank",name:"New window"}]}},function(t,e,n){"use strict";var i=n(49),r=n(8),o=n(144),s=n(145),a=n(146),l=n(147);t.exports=i.extend({itemView:r,itemsView:{text:r,number:a,select:o,checkbox:s,color:l},initialize:function(t){this.config=t.config||{},this.em=t.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 t=this.em.get("selectedComponent");t&&(this.collection=t.get("traits"),this.render())}})},function(t,e,n){"use strict";(function(e,i){var r=n(8),o=e.$;t.exports=r.extend({initialize:function(t){r.prototype.initialize.apply(this,arguments);var e=this.ppfx;this.tmpl='<div class="'+this.fieldClass+'"><div class="'+this.inputhClass+'"></div><div class="'+e+'sel-arrow"><div class="'+e+'d-s-arrow"></div></div> </div>'},getInputEl:function(){if(!this.$input){var t=this.model,e=t.get("options")||[],n="<select>";e.length&&i.each(e,function(t){var e,i,r,o="";"string"==typeof t?(e=t,i=t):(e=t.name?t.name:t.value,i=t.value.replace(/"/g,"&quot;"),r=t.style?t.style.replace(/"/g,"&quot;"):"",o+=r?'style="'+r+'"':""),n+='<option value="'+i+'" '+o+">"+e+"</option>"}),n+="</select>",this.input=n,this.$input=o(this.input);var r=this.target,s=t.get("name"),a=t.get("value");if(t.get("changeProp"))a=a||r.get(s);else{var l=r.get("attributes");a=l[s]}a&&this.$input.val(a)}return this.$input.get(0)}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";var i=n(8);t.exports=i.extend({initialize:function(t){i.prototype.initialize.apply(this,arguments);var e=this.ppfx+"chk-icon";this.tmpl='<div class="'+this.fieldClass+'"><label class="'+this.inputhClass+'"><i class="'+e+'"></i></label></div>'},onChange:function(){this.model.set("value",this.getInputEl().checked)},getInputEl:function(){var t;this.$input||(t=1);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=i.prototype.getInputEl.apply(this,n);if(t){var s=this.model,a=s.get("name"),l=this.target;if(s.get("changeProp"))o.checked=l.get(a);else{var c=l.get("attributes");o.checked=!!c[a]}}return o}})},function(t,e,n){"use strict";var i=n(8),r=n(18);t.exports=i.extend({getValueForTarget:function(){var t=this.model,e=t.get("value"),n=t.get("unit");return e?e+n:""},getInputEl:function(){if(!this.$input){var t=this.getModelValue(),e=new r({contClass:this.ppfx+"field-int",model:this.model,ppfx:this.ppfx});this.input=e.render(),this.$input=this.input.inputEl,this.$unit=this.input.unitEl,this.model.set("value",t),this.$input.val(t)}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))}})},function(t,e,n){"use strict";var i=n(8),r=n(39);t.exports=i.extend({getInputEl:function(){if(!this.$input){var t=this.getModelValue(),e=new r({target:this.config.em,contClass:this.ppfx+"field-color",model:this.model,ppfx:this.ppfx});this.input=e.render(),this.$input=this.input.colorEl,t=t||"",this.model.set("value",t).trigger("change:value"),this.input.setValue(t)}return this.$input.get(0)},renderField:function(){this.$input||(this.getInputEl(),this.$el.append(this.input.el))}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};t.exports=function(){var t,e,r={},o=void 0,s=n(149),a=n(4),l=n(3),c=n(50),u=n(51),h=[{id:"cell",model:n(153),view:n(154)},{id:"row",model:n(155),view:n(156)},{id:"table",model:n(157),view:n(158)},{id:"thead",model:n(159),view:n(160)},{id:"tbody",model:n(19),view:n(161)},{id:"tfoot",model:n(162),view:n(163)},{id:"map",model:n(164),view:n(165)},{id:"link",model:n(166),view:n(167)},{id:"video",model:n(168),view:n(169)},{id:"image",model:n(20),view:n(15)},{id:"script",model:n(170),view:n(171)},{id:"svg",model:n(172),view:n(173)},{id:"textnode",model:n(174),view:n(175)},{id:"text",model:n(52),view:n(53)},{id:"default",model:a,view:l}];return{Component:a,Components:c,ComponentsView:u,componentTypes:h,name:"DomComponents",getConfig:function(){return r},storageKey:function(){var t=[],e=r.stm&&r.stm.getConfig()||{};return e.storeHtml&&t.push("html"),e.storeComponents&&t.push("components"),t},init:function(n){r=n||{},o=r.em,o&&(r.components=o.config.components||r.components);for(var c in s)c in r||(r[c]=s[c]);var u=r.pStylePrefix;u&&(r.stylePrefix=u+r.stylePrefix),o&&(r.modal=o.get("Modal")||"",r.am=o.get("AssetManager")||"",o.get("Parser").compTypes=h,o.on("change:selectedComponent",this.componentChanged,this));var d=r.components,f=i({},r.wrapper);return f["custom-name"]=r.wrapperName,f.wrapper=1,d&&d.constructor===Object&&d.wrapper&&(f=i({},d),d=d.components||[],f.components=[],o&&(o.config.components=d,r.components=d)),t=new a(f,{em:o,config:r,componentTypes:h}),t.set({attributes:{id:"wrapper"}}),e=new l({model:t,config:r,componentTypes:h}),this},onLoad:function(){this.setComponents(r.components)},postLoad:function(t){this.handleChanges(this.getWrapper(),null,{avoidStore:1})},handleChanges:function d(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.components(),s=o.get("UndoManager"),a=o.handleUpdates.bind(o),d=this.handleChanges.bind(this),l=this.handleRemoves.bind(this);s&&s.add(t),s&&r&&s.add(r);var c="change:style change:content change:attributes change:src";[[t,c,a],[r,"add",d],[r,"remove",l],[t.get("classes"),"add remove",a]].forEach(function(t){o.stopListening(t[0],t[1],t[2]),o.listenTo(t[0],t[1],t[2])}),!i.avoidStore&&a("","",i),r.each(function(t){return n.handleChanges(t,e,i)})},handleRemoves:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!n.avoidStore&&o.handleUpdates(t,e,n)},load:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e="";if(!t&&r.stm&&(t=r.em.getCacheLoad()),t.components)try{e=JSON.parse(t.components)}catch(n){}else t.html&&(e=t.html);var i=e&&e.constructor===Object;return(e&&e.length||i)&&(this.clear(),this.getComponents().reset(),i?this.getWrapper().set(e).initComponents().initClasses().loadTraits():this.getComponents().add(e)),e},store:function(t){if(r.stm){var e={},n=this.storageKey();if(n.indexOf("html")>=0&&(e.html=r.em.getHtml()),n.indexOf("components")>=0){var i=r.storeWrapper?this.getWrapper():this.getComponents();e.components=JSON.stringify(i)}return t||r.stm.store(e),e}},getComponent:function(){return t},getWrapper:function(){return this.getComponent()},getComponents:function(){return this.getWrapper().get("components")},addComponent:function(t){return this.getComponents().add(t)},render:function(){return e.render().el},clear:function(){for(var t=this.getComponents(),e=0,n=t.length;e<n;e++)t.pop();return this},setComponents:function(t){this.clear().addComponent(t)},addType:function(t,e){var n=this.getType(t);n?(n.model=e.model,n.view=e.view):(e.id=t,h.unshift(e))},getType:function(t){for(var e=h,n=0;n<e.length;n++){var i=e[n].id;if(i==t)return e[n]}},componentChanged:function(){var t=r.em,e=t.get("selectedComponent"),n=t.previous("selectedComponent");n&&n.set({status:"",state:""}),e&&e.set("status","selected")}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"comp-",wrapperId:"wrapper",wrapperName:"Body",wrapper:{removable:!1,copyable:!1,draggable:!1,components:[],traits:[],stylable:["background","background-color","background-image","background-repeat","background-attachment","background-position","background-size"]},components:[],imageCompClass:"fa fa-picture-o",oAssetsOnCreate:!0,storeWrapper:0,voidElements:["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]}},function(t,e,n){"use strict";var i=n(1),r=n(0),o=n(151),s=n(152);t.exports=r.Collection.extend({model:o,initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.em=e.em||""},setTarget:function(t){this.target=t},add:function(t,e){var n=this.em;if((0,i.isString)(t)||(0,i.isArray)(t)){var o=n&&n.get&&n.get("TraitManager"),a=o&&o.getConfig(),l=s(a);(0,i.isString)(t)&&(t=[t]);for(var c=0,u=t.length;c<u;c++){var h=t[c],d=(0,i.isString)(h)?l.build(h)[0]:h;d.target=this.target,t[c]=d}}return r.Collection.prototype.add.apply(this,[t,e])}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(1);t.exports=n(0).Model.extend({defaults:{type:"text",label:"",name:"",min:"",max:"",unit:"",step:1,value:"",target:"","default":"",placeholder:"",changeProp:0,options:[]},initialize:function(){var t=this.get("target"),e=this.get("name"),n=this.get("changeProp");if(t){this.target=t,this.unset("target");var i=n?"change:"+e:"change:attributes:"+e;this.listenTo(t,i,this.targetUpdated)}},targetUpdated:function(){var t=this.getTargetValue();!(0,r.isUndefined)(t)&&this.set({value:t},{fromTarget:1})},getTargetValue:function(){var t=this.get("name"),e=this.target,n=this.get("changeProp");if(e)return n?e.get(t):e.getAttributes()[t]},setTargetValue:function(t){var e=this.target,n=this.get("name");if(!(0,r.isUndefined)(t))if(this.get("changeProp"))e.set(n,t);else{var o=i({},e.get("attributes"));o[n]=t,e.set("attributes",o)}},setValueFromInput:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={value:t};this.set(r,i({},n,{avoidStore:1})),e&&(this.set("value","",n),this.set(r,n))},getInitValue:function(){var t=this.target,e=this.get("name"),n=void 0;if(t){var i=t.get("attributes");n=this.get("changeProp")?t.get(e):i[e]}return n||this.get("value")||this.get("default")}})},function(t,e,n){"use strict";t.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{build:function(e){var n=[];"string"==typeof e&&(e=[e]);for(var i=0;i<e.length;i++){var r={},o=e[i];switch(r.name=o,o){case"target":r.type="select"}switch(o){case"title":case"alt":case"id":r.placeholder=t.labelPlhText;break;case"href":r.placeholder=t.labelPlhHref}switch(o){case"target":r.options=t.optionsTarget}n.push(r)}return n}}}},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(4);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"cell",tagName:"td",
draggable:["tr"]})},{isComponent:function(t){var e="",n=t.tagName;return"TD"!=n&&"TH"!=n||(e={type:"cell",tagName:n.toLowerCase()}),e}})},function(t,e,n){"use strict";var i=(n(0),n(3));t.exports=i.extend({})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(4);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"row",tagName:"tr",draggable:["thead","tbody","tfoot"],droppable:["th","td"]}),initialize:function(t,e){r.prototype.initialize.apply(this,arguments);var n=[],i=this.get("components");i.each(function(t){return t.is("cell")&&n.push(t)}),i.reset(n)}},{isComponent:function(t){var e="";return"TR"==t.tagName&&(e={type:"row"}),e}})},function(t,e,n){"use strict";var i=(n(0),n(3));t.exports=i.extend({})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(4);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"table",tagName:"table",droppable:["tbody","thead","tfoot"]}),initialize:function(t,e){r.prototype.initialize.apply(this,arguments);var n=this.get("components");!n.length&&n.add({type:"tbody"})}},{isComponent:function(t){var e="";return"TABLE"==t.tagName&&(e={type:"table"}),e}})},function(t,e,n){"use strict";var i=(n(0),n(3));t.exports=i.extend({events:{}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(19);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"thead",tagName:"thead"})},{isComponent:function(t){var e="";return"THEAD"==t.tagName&&(e={type:"thead"}),e}})},function(t,e,n){"use strict";var i=(n(0),n(3));t.exports=i.extend({})},function(t,e,n){"use strict";var i=(n(0),n(3));t.exports=i.extend({})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(19);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"tfoot",tagName:"tfoot"})},{isComponent:function(t){var e="";return"TFOOT"==t.tagName&&(e={type:"tfoot"}),e}})},function(t,e,n){"use strict";var i=(n(0),n(3));t.exports=i.extend({})},function(t,e,n){"use strict";(function(e){var i=n(20),r=n(4);t.exports=i.extend({defaults:e.extend({},i.prototype.defaults,{type:"map","void":0,mapUrl:"https://maps.google.com/maps",tagName:"iframe",mapType:"q",address:"",zoom:"1",attributes:{frameborder:0},toolbar:r.prototype.defaults.toolbar,traits:[{label:"Address",name:"address",placeholder:"eg. London, UK",changeProp:1},{type:"select",label:"Map type",name:"mapType",changeProp:1,options:[{value:"q",name:"Roadmap"},{value:"w",name:"Satellite"}]},{label:"Zoom",name:"zoom",type:"range",min:"1",max:"20",changeProp:1}]}),initialize:function(t,e){this.get("src")?this.parseFromSrc():this.updateSrc(),i.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:address change:zoom change:mapType",this.updateSrc)},updateSrc:function(){this.set("src",this.getMapUrl())},getMapUrl:function(){var t=this,e=t.get("address"),n=t.get("zoom"),i=t.get("mapType");e=e?"&q="+e:"",n=n?"&z="+n:"",i=i?"&t="+i:"";var r=t.get("mapUrl")+"?"+e+n+i;return r+="&output=embed"},parseFromSrc:function(){var t=this.parseUri(this.get("src")),e=t.query;e.q&&this.set("address",e.q),e.z&&this.set("zoom",e.z),e.t&&this.set("mapType",e.t)}},{isComponent:function(t){var e="";return"IFRAME"==t.tagName&&/maps\.google\.com/.test(t.src)&&(e={type:"map",src:t.src}),e}})}).call(e,n(1))},function(t,e,n){"use strict";var i=(n(0),n(15));t.exports=i.extend({tagName:"div",events:{},initialize:function(t){i.prototype.initialize.apply(this,arguments),this.classEmpty=this.ppfx+"plh-map"},updateSrc:function(){this.getIframe().src=this.model.get("src")},getIframe:function(){if(!this.iframe){var t=document.createElement("iframe");t.src=this.model.get("src"),t.frameBorder=0,t.style.height="100%",t.style.width="100%",t.className=this.ppfx+"no-pointer",this.iframe=t}return this.iframe},render:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i.prototype.render.apply(this,e),this.updateClasses(),this.el.appendChild(this.getIframe()),this}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(52);t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"link",tagName:"a",traits:["title","href","target"]}),getAttrToHTML:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=r.prototype.getAttrToHTML.apply(this,e);return delete i.onmousedown,i}},{isComponent:function(t){var e=void 0;if("A"==t.tagName){e={type:"link",editable:0};var n=t.childNodes,i=n.length;i||delete e.editable;for(var r=0;r<i;r++){var o=n[r];if(3==o.nodeType&&""!=o.textContent.trim()){delete e.editable;break}}}return e}})},function(t,e,n){"use strict";var i=(n(0),n(53));t.exports=i.extend({render:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i.prototype.render.apply(this,e),this.el.addEventListener("click",this.prevDef,!0),this}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(20),o=n(4),s="yt",a="vi";t.exports=r.extend({defaults:i({},r.prototype.defaults,{type:"video",tagName:"video",videoId:"","void":0,provider:"",ytUrl:"https://www.youtube.com/embed/",viUrl:"https://player.vimeo.com/video/",loop:0,muted:0,autoplay:0,controls:1,color:"",sources:[],attributes:{allowfullscreen:"allowfullscreen"},toolbar:o.prototype.defaults.toolbar}),initialize:function(t,e){var n=[],i=this.get("provider");switch(i){case s:n=this.getYoutubeTraits();break;case a:n=this.getVimeoTraits();break;default:n=this.getSourceTraits()}this.get("src")&&this.parseFromSrc(),this.set("traits",n),r.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:provider",this.updateTraits),this.listenTo(this,"change:videoId",this.updateSrc)},initToolbar:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];o.prototype.initToolbar.apply(this,e)},parseFromSrc:function(){var t=this.get("provider"),e=this.parseUri(this.get("src")),n=e.query;switch(t){case s:case a:var i=e.pathname.split("/").pop();this.set("videoId",i),n.autoplay&&this.set("autoplay",1),n.loop&&this.set("loop",1),0===parseInt(n.controls)&&this.set("controls",0),n.color&&this.set("color",n.color)}},updateSrc:function(){var t=this.get("provider");switch(t){case s:this.set("src",this.getYoutubeSrc());break;case a:this.set("src",this.getVimeoSrc())}},getAttrToHTML:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=r.prototype.getAttrToHTML.apply(this,e),o=this.get("provider");switch(o){case s:case a:break;default:this.get("loop")&&(i.loop="loop"),this.get("autoplay")&&(i.autoplay="autoplay"),this.get("controls")&&(i.controls="controls")}return i},updateTraits:function(){var t=this.get("provider"),e=this.getSourceTraits();switch(t){case s:this.set("tagName","iframe"),e=this.getYoutubeTraits();break;case a:this.set("tagName","iframe"),e=this.getVimeoTraits();break;default:this.set("tagName","video")}this.loadTraits(e),this.em.trigger("change:selectedComponent")},getProviderTrait:function(){return{type:"select",label:"Provider",name:"provider",changeProp:1,value:this.get("provider"),options:[{value:"so",name:"HTML5 Source"},{value:s,name:"Youtube"},{value:a,name:"Vimeo"}]}},getSourceTraits:function(){return[this.getProviderTrait(),{label:"Source",name:"src",placeholder:"eg. ./media/video.mp4",changeProp:1},this.getAutoplayTrait(),this.getLoopTrait(),this.getControlsTrait()]},getYoutubeTraits:function(){return[this.getProviderTrait(),{label:"Video ID",name:"videoId",placeholder:"eg. jNQXAC9IVRw",changeProp:1},this.getAutoplayTrait(),this.getLoopTrait(),this.getControlsTrait()]},getVimeoTraits:function(){return[this.getProviderTrait(),{label:"Video ID",name:"videoId",placeholder:"eg. 123456789",changeProp:1},{label:"Color",name:"color",placeholder:"eg. FF0000",changeProp:1},this.getAutoplayTrait(),this.getLoopTrait(),this.getControlsTrait()]},getAutoplayTrait:function(){return{type:"checkbox",label:"Autoplay",name:"autoplay",changeProp:1}},getLoopTrait:function(){return{type:"checkbox",label:"Loop",name:"loop",changeProp:1}},getControlsTrait:function(){return{type:"checkbox",label:"Controls",name:"controls",changeProp:1}},getYoutubeSrc:function(){var t=this.get("ytUrl");return t+=this.get("videoId")+"?",t+=this.get("autoplay")?"&autoplay=1":"",t+=this.get("controls")?"":"&controls=0",t+=this.get("loop")?"&loop=1":""},getVimeoSrc:function(){var t=this.get("viUrl");return t+=this.get("videoId")+"?",t+=this.get("autoplay")?"&autoplay=1":"",t+=this.get("loop")?"&loop=1":"",t+=this.get("controls")?"":"&title=0&portrait=0&badge=0",t+=this.get("color")?"&color="+this.get("color"):""}},{isComponent:function(t){var e="",n=/youtube\.com\/embed/.test(t.src),i=/player\.vimeo\.com\/video/.test(t.src),r=n||i;return("VIDEO"==t.tagName||"IFRAME"==t.tagName&&r)&&(e={type:"video"},t.src&&(e.src=t.src),r&&(n?e.provider=s:i&&(e.provider=a))),e}})},function(t,e,n){"use strict";var i=(n(0),n(15)),r=n(3);t.exports=i.extend({tagName:"div",events:{},initialize:function(t){r.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:src",this.updateSrc),this.listenTo(this.model,"change:loop change:autoplay change:controls change:color",this.updateVideo),this.listenTo(this.model,"change:provider",this.updateProvider)},updateProvider:function(){var t=this.model.get("provider");this.el.innerHTML="",this.el.appendChild(this.renderByProvider(t))},updateSrc:function(){var t=this.model.get("provider"),e=this.model.get("src");switch(t){case"yt":e=this.model.getYoutubeSrc();break;case"vi":e=this.model.getVimeoSrc()}this.videoEl.src=e},updateVideo:function(){var t=this.model.get("provider"),e=this.videoEl,n=this.model;switch(t){case"yt":case"vi":this.model.trigger("change:videoId");break;default:e.loop=n.get("loop"),e.autoplay=n.get("autoplay"),e.controls=n.get("controls")}},renderByProvider:function(t){var e;switch(t){case"yt":e=this.renderYoutube();break;case"vi":e=this.renderVimeo();break;default:e=this.renderSource()}return this.videoEl=e,e},renderSource:function(){var t=document.createElement("video");return t.src=this.model.get("src"),this.initVideoEl(t),t},renderYoutube:function(){var t=document.createElement("iframe");return t.src=this.model.getYoutubeSrc(),t.frameBorder=0,t.setAttribute("allowfullscreen",!0),this.initVideoEl(t),t},renderVimeo:function(){var t=document.createElement("iframe");return t.src=this.model.getVimeoSrc(),t.frameBorder=0,t.setAttribute("allowfullscreen",!0),this.initVideoEl(t),t},initVideoEl:function(t){t.className=this.ppfx+"no-pointer",t.style.height="100%",t.style.width="100%"},render:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.prototype.render.apply(this,e),this.updateClasses();var r=this.model.get("provider");return this.el.appendChild(this.renderByProvider(r)),this}})},function(t,e,n){"use strict";(function(e){var i=n(4);t.exports=i.extend({defaults:e.extend({},i.prototype.defaults,{type:"script",droppable:!1,draggable:!1,layerable:!1})},{isComponent:function(t){if("SCRIPT"==t.tagName){var e={type:"script"};return t.src&&(e.src=t.src,e.onload=t.onload),e}}})}).call(e,n(1))},function(t,e,n){"use strict";var i=(n(0),n(15));t.exports=i.extend({tagName:"script",events:{},render:function(){var t=this.model,e=t.get("src"),n=this.em,i=n&&n.get("scriptCount")?n.get("scriptCount"):0,r="";if(e){var o=t.get("onload"),s="script"+i,a="script"+(i+1);r="var "+s+" = document.createElement('script');\n"+s+".onload = function(){\n"+(o?o+"();\n":"")+"typeof "+a+"Start == 'function' && "+a+"Start();\n};\n"+s+".src = '"+e+"';\nfunction "+s+"Start() { document.body.appendChild("+s+"); };\n"+(i?"":s+"Start();"),n&&n.set("scriptCount",i+1)}else r=t.get("content");return this.el.innerHTML=r,this}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},r=n(4);t.exports=r.extend({defaults:i({},r.prototype.defaults,{highlightable:0}),getName:function(){var t=this.get("tagName"),e=this.get("custom-name");return t=t.charAt(0).toUpperCase()+t.slice(1),e||t}},{isComponent:function(t){if(SVGElement&&t instanceof SVGElement){var e=t.tagName,n="svg"==e;return{tagName:e,type:"svg",resizable:n}}}})},function(t,e,n){"use strict";var i=n(3);t.exports=i.extend({_createElement:function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}})},function(t,e,n){"use strict";(function(e){var i=n(4);t.exports=i.extend({defaults:e.extend({},i.prototype.defaults,{droppable:!1,editable:!0}),toHTML:function(){return this.get("content")}},{isComponent:function(t){var e="";return 3===t.nodeType&&(e={type:"textnode",content:t.textContent}),e}})}).call(e,n(1))},function(t,e,n){"use strict";t.exports=n(0).View.extend({})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=n(2),o=n(177),s=i(o);t.exports=function(){var t,e,i={},o=n(178),a=n(179),l=n(181);return{getCanvasView:function(){return l},name:"Canvas",init:function(e){i=e||{};for(var n in o)n in i||(i[n]=o[n]);var r=i.pStylePrefix;r&&(i.stylePrefix=r+i.stylePrefix),t=new a(e),l=new l({model:t,config:i});var s=i.em.get("DomComponents");return s&&this.setWrapper(s),this.startAutoscroll=this.startAutoscroll.bind(this),this.stopAutoscroll=this.stopAutoscroll.bind(this),this.autoscroll=this.autoscroll.bind(this),this},getConfig:function(){return i},setWrapper:function(e){t.set("wrapper",e)},getElement:function(){return l.el},getFrameEl:function(){return l.frame.el},getBody:function(){return l.frame.el.contentDocument.body},getWrapperEl:function(){return this.getBody().querySelector("#wrapper")},getToolsEl:function(){return l.toolsEl},getHighlighter:function(){return l.hlEl},getBadgeEl:function(){return l.badgeEl},getPlacerEl:function(){return l.placerEl},getGhostEl:function(){return l.ghostEl},getToolbarEl:function(){return l.toolbarEl},getResizerEl:function(){return l.resizerEl},getOffsetViewerEl:function(){return l.offsetEl},getFixedOffsetViewerEl:function(){return l.fixedOffsetEl},render:function(){return l.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){return l.offset(t)},setCustomBadgeLabel:function(t){i.customBadgeLabel=t},getElementPos:function(t,e){return l.getElementPos(t,e)},getTargetToElementDim:function(t,e,n){var r=n||{},o=l.getPosition(),s=r.elPos||l.getElementPos(e),a=n.toRight||0,c=r.targetHeight||t.offsetHeight,u=r.targetWidth||t.offsetWidth,h=r.event||null,d=s.top-c,f=s.left;f+=a?s.width:0,f=a?f-u:f;var p=f<o.left?o.left:f,g=d<o.top?o.top:d;g=g>s.top+s.height?s.top+s.height:g;var v={top:g,left:p,elementTop:s.top,elementLeft:s.left,elementWidth:s.width,elementHeight:s.height,targetWidth:t.offsetWidth,targetHeight:t.offsetHeight,canvasTop:o.top,canvasLeft:o.left};return h&&i.em&&i.em.trigger(h,v),v},getMouseRelativePos:function(t,e){var n=e||{},i=0,r=0,o=n.subWinOffset,s=t.target.ownerDocument,a=s.defaultView||s.parentWindow,l=a.frameElement,c=o?a.pageYOffset:0,u=o?a.pageXOffset:0;if(l){var h=l.getBoundingClientRect();i=h.top||0,r=h.left||0}return{y:t.clientY+i-c,x:t.clientX+r-u}},getMouseRelativeCanvas:function(t,e){var n=this.getFrameEl(),i=this.getBody(),r=n.offsetTop||0,o=n.offsetLeft||0,s=i.scrollTop||0,a=i.scrollLeft||0;return{y:t.clientY+r+s,x:t.clientX+o+a}},isInputFocused:function(){return"BODY"!==this.getFrameEl().contentDocument.activeElement.tagName},startAutoscroll:function(){var t=this;this.dragging=1;var n=this.getScrollListeners();e=l.getFrameOffset(1),setTimeout(function(){(0,r.on)(n,"mousemove",t.autoscroll),(0,r.on)(n,"mouseup",t.stopAutoscroll)},0)},autoscroll:function(t){if(t.preventDefault(),this.dragging){var n=this.getFrameEl().contentWindow,i=n.document.body.scrollTop,r=i,o=t.clientY,s=50,a=e.height-s;o<s&&(r-=s-o),o>a&&(r+=o-a),n.scrollTo(0,r)}},stopAutoscroll:function(){this.dragging=0;var t=this.getScrollListeners();(0,r.off)(t,"mousemove",this.autoscroll),(0,r.off)(t,"mouseup",this.stopAutoscroll)},getScrollListeners:function(){return[this.getFrameEl().contentWindow,this.getElement()]},postRender:function(){(0,r.hasDnd)(i.em)&&(this.droppable=new s["default"](i.em))},getFrameWrapperEl:function(){return l.frame.getWrapper()}}}},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(2),s=n(1),a=function(){function t(e){i(this,t),this.em=e;var n=e.get("DomComponents").getWrapper().getEl();return this.el=n,this.counter=0,(0,s.bindAll)(this,"handleDragEnter","handleDragOver","handleDrop","handleDragLeave"),(0,o.on)(n,"dragenter",this.handleDragEnter),(0,o.on)(n,"dragover",this.handleDragOver),(0,o.on)(n,"drop",this.handleDrop),(0,o.on)(n,"dragleave",this.handleDragLeave),this}return r(t,[{key:"endDrop",value:function(t,e){var n=this.em;this.counter=0,this.over=0;var i=this.sorter;t&&(i.moved=0),i.endMove(),n.trigger("canvas:dragend",e)}},{key:"handleDragLeave",value:function(t){this.updateCounter(-1,t)}},{key:"updateCounter",value:function(t,e){this.counter+=t,0===this.counter&&this.endDrop(1,e)}},{key:"handleDragEnter",value:function(t){var e=this.em,n=t.dataTransfer;if(this.updateCounter(1,t),!this.over){this.over=1;var i=e.get("Utils"),r=e.get("Canvas");this.sorter=new i.Sorter({em:e,wmargin:1,nested:1,canvasRelative:1,direction:"a",container:r.getBody(),placer:r.getPlacerEl(),eventMoving:"mousemove dragover",containerSel:"*",itemSel:"*",pfx:"gjs-",onStart:function(){return e.stopDefault()},onEndMove:function(t){e.runDefault(),t&&t.get&&t.get("activeOnRender")&&(t.trigger("active"),t.set("activeOnRender",0)),t&&e.trigger("canvas:drop",n,t)},document:r.getFrameEl().contentDocument});var o=e.get("dragContent")||"<br>";this.sorter.setDropContent(o),this.sorter.startSort(),e.trigger("canvas:dragenter",n,o)}}},{key:"handleDragOver",value:function(t){t.preventDefault(),this.em.trigger("canvas:dragover",t)}},{key:"handleDrop",value:function(t){t.preventDefault();var e=t.dataTransfer,n=this.getContentByData(e).content;t.target.style.border="",n?this.sorter.setDropContent(n):this.sorter.moved=0,this.endDrop(0,t)}},{key:"getContentByData",value:function(t){var e=this.em,n=t.types,i=t.files,r=e.get("dragContent"),o=t.getData("text");if(i.length){o=[];for(var s=0;s<i.length;s++){var a=i[s],l=a.type.split("/")[0];"image"==l&&o.push({type:l,file:a,attributes:{alt:a.name}})}}else if(r)o=r;else if(n.indexOf("text/html")>=0)o=t.getData("text/html").replace(/<\/?meta[^>]*>/g,"");else if(n.indexOf("text/uri-list")>=0)o={type:"link",attributes:{href:o},content:o};else if(n.indexOf("text/json")>=0){var c=t.getData("text/json");c&&(o=JSON.parse(c))}var u={content:o};return e.trigger("canvas:dragdata",t,u),u}}]),t}();e["default"]=a},function(t,e,n){"use strict";t.exports={stylePrefix:"cv-",rulers:!1,scripts:[],styles:[],customBadgeLabel:""}},function(t,e,n){"use strict";var i=n(0),r=n(180);t.exports=i.Model.extend({defaults:{frame:"",wrapper:"",rulers:!1},initialize:function(t){var e=this.conf||{};this.set("frame",new r(e.frame))}})},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({defaults:{wrapper:"",width:"",height:"",attributes:{}}})},function(t,e,n){"use strict";(function(e,i){var r=n(2),o=n(182),s=e.$;t.exports=e.View.extend({initialize:function(t){i.bindAll(this,"renderBody","onFrameScroll","clearOff"),(0,r.on)(window,"scroll resize",this.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 o({model:this.model.get("frame"),config:this.config})},isElInViewport:function(t){var e=t.getBoundingClientRect(),n=this.getFrameOffset(1),i=e.top,r=e.left;return i>=0&&r>=0&&i<=n.height&&r<=n.width},onFrameScroll:function(){var t="px",e=this.frame.el.contentDocument.body;this.toolsEl.style.top="-"+e.scrollTop+t,this.toolsEl.style.left="-"+e.scrollLeft+t,this.em.trigger("canvasScroll")},renderScripts:function(){var t=this.frame,e=this;t.el.onload=function(){function n(i){if(i.length>0){var r=document.createElement("script");r.type="text/javascript",r.src=i.shift(),r.onerror=r.onload=n.bind(null,i),t.el.contentDocument.head.appendChild(r)}else e.renderBody()}var i=e.config.scripts.slice(0);n(i)}},renderBody:function(){var t=this.model.get("frame").get("wrapper"),e=this.config.em;if(t){var n=this.ppfx,i=s(this.frame.el.contentWindow.document.body),r=e.get("CssComposer"),o=e.get("Config"),a=this.config,l=o.protectedCss,c="";a.styles.forEach(function(t){c+='<link rel="stylesheet" href="'+t+'"/>'});var u="#ffca6f",h="\n * {\n box-sizing: border-box;\n }\n html, body, #wrapper {\n min-height: 100%;\n }\n body {\n margin: 0;\n height: 100%;\n background-color: #fff\n }\n #wrapper {\n overflow: auto;\n overflow-x: hidden;\n }\n ",d="\n "+h+"\n\n ."+n+"dashed *[data-highlightable] {\n outline: 1px dashed rgba(170,170,170,0.7);\n outline-offset: -3px\n }\n\n ."+n+"comp-selected {\n outline: 3px solid #3b97e3 !important;\n }\n\n ."+n+"comp-selected-parent {\n outline: 2px solid "+u+" !important\n }\n\n ."+n+"no-select {\n user-select: none;\n -webkit-user-select:none;\n -moz-user-select: none;\n }\n\n ."+n+"freezed {\n opacity: 0.5;\n pointer-events: none;\n }\n\n ."+n+"no-pointer {\n pointer-events: none;\n }\n\n ."+n+"plh-image {\n background: #f5f5f5;\n border: none;\n height: 50px;\n width: 50px;\n display: block;\n outline: 3px solid #ffca6f;\n cursor: pointer;\n outline-offset: -2px\n }\n\n ."+n+"grabbing {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n }\n\n * ::-webkit-scrollbar-track {\n background: rgba(0, 0, 0, 0.1)\n }\n\n * ::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.2)\n }\n\n * ::-webkit-scrollbar {\n width: 10px\n }\n\n "+(o.canvasCss||"")+"\n "+(l||"")+"\n ";c&&i.append(c),i.append("<style>"+d+"</style>"),i.append(t.render()).append(r.render()),i.append(this.getJsContainer()),e.trigger("loaded"),this.frame.el.contentWindow.onscroll=this.onFrameScroll,this.frame.udpateOffset();var f=document,p=this.frame.el.contentDocument,g=function(t){var e=new KeyboardEvent(t.type,t);return e.keyCodeVal=t.keyCode,["keyCode","which"].forEach(function(t){Object.defineProperty(e,t,{get:function(){return this.keyCodeVal}})}),e};p.addEventListener("keydown",function(t){f.dispatchEvent(g(t))}),p.addEventListener("keyup",function(t){f.dispatchEvent(g(t))})}},offset:function(t){var e=t.getBoundingClientRect(),n=t.ownerDocument.body;return{top:e.top+n.scrollTop,left:e.left+n.scrollLeft,width:e.width,height:e.height}},clearOff:function(){this.frmOff=null,this.cvsOff=null},getFrameOffset:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.frmOff&&!t||(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,e){var n=e||{},i=this.getFrameOffset(),r=this.getCanvasOffset(),o=this.offset(t),s=n.avoidFrameOffset?0:i.top,a=n.avoidFrameOffset?0:i.left,l=o.top+s-r.top,c=o.left+a-r.left,u=t.offsetHeight||t.clientHeight,h=t.offsetWidth||t.clientWidth;return{top:l,left:c,height:u,width:h}},getPosition:function(){var t=this.frame.el.contentDocument.body,e=this.getFrameOffset(),n=this.getCanvasOffset();return{top:e.top+t.scrollTop-n.top,left:e.left+t.scrollLeft-n.left}},updateScript:function(t){t.scriptContainer||(t.scriptContainer=s("<div>"),this.getJsContainer().append(t.scriptContainer.get(0)));var e=t.model,n=e.getId();t.el.id=n,t.scriptContainer.html("");var i=document.createElement("script");i.innerText="\n setTimeout(function() {\n var item = document.getElementById('"+n+"');\n if (!item) return;\n (function(){\n "+e.getScriptString()+";\n }.bind(item))()\n }, 1);",t.scriptContainer.get(0).appendChild(i)},getJsContainer:function(){return this.jsContainer||(this.jsContainer=s('<div 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 t=this.frame;0===this.config.scripts.length?t.el.onload=this.renderBody:this.renderScripts()}var e=this.ppfx;this.$el.append('\n <div id="'+e+'tools" style="pointer-events:none">\n <div class="'+e+'highlighter"></div>\n <div class="'+e+'badge"></div>\n <div class="'+e+'placeholder">\n <div class="'+e+'placeholder-int"></div>\n </div>\n <div class="'+e+'ghost"></div>\n <div class="'+e+'toolbar" style="pointer-events:all"></div>\n <div class="'+e+'resizer"></div>\n <div class="'+e+'offset-v"></div>\n <div class="'+e+'offset-fixed-v"></div>\n </div>\n ');var n=this.el,i=n.querySelector("#"+e+"tools");return this.hlEl=n.querySelector("."+e+"highlighter"),this.badgeEl=n.querySelector("."+e+"badge"),this.placerEl=n.querySelector("."+e+"placeholder"),this.ghostEl=n.querySelector("."+e+"ghost"),this.toolbarEl=n.querySelector("."+e+"toolbar"),this.resizerEl=n.querySelector("."+e+"resizer"),this.offsetEl=n.querySelector("."+e+"offset-v"),this.fixedOffsetEl=n.querySelector("."+e+"offset-fixed-v"),this.toolsEl=i,this.el.className=this.className,this}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";var i=n(1),r="transitionend oTransitionEnd transitionend webkitTransitionEnd";t.exports=n(0).View.extend({tagName:"iframe",attributes:{allowfullscreen:"allowfullscreen"},initialize:function(t){(0,i.bindAll)(this,"udpateOffset"),this.config=t.config||{},this.ppfx=this.config.pStylePrefix||"",this.em=this.config.em,this.listenTo(this.em,"change:device",this.updateDim)},updateDim:function(t){var e=this.em,n=e.getDeviceModel(),i=this.el.style,o=i.width||"",s=i.height||"",a=n?n.get("width"):"",l=n?n.get("height"):"",c=o==a&&s==l;i.width=a,i.height=l,this.udpateOffset(),e.stopDefault({preserveSelected:1}),c?this.udpateOffset():this.$el.on(r,this.udpateOffset)},udpateOffset:function(){var t=this.em,e=t.get("Canvas").getOffset();t.set("canvasOffset",e),t.runDefault({preserveSelected:1}),this.$el.off(r,this.udpateOffset)},getBody:function(){this.$el.contents().find("body")},getWrapper:function(){return this.$el.contents().find("body > div")},render:function(){return this.$el.attr({"class":this.ppfx+"frame"}),this}})},function(t,e,n){"use strict";var i=n(1);t.exports=function(){var t=void 0,e={},r={},o={},s=n(184),a=n(185),l=function(t,e){return(0,i.isFunction)(e)&&(e={run:e}),delete e.initialize,r[t]=a.extend(e),this};return{name:"Commands",init:function(i){e=i||{};for(var r in s)r in e||(e[r]=s[r]);t=e.em;var a=e.pStylePrefix;a&&(e.stylePrefix=a+e.stylePrefix);for(var l in e.defaults){var c=e.defaults[l];c.id&&this.add(c.id,c)}var u=n(186);return o["select-comp"]=n(21),o["create-comp"]=n(22),o["delete-comp"]=n(191),o["image-comp"]=n(192),o["move-comp"]=n(193),o["text-comp"]=n(194),o["insert-custom"]=n(55),o["export-template"]=u,o["sw-visibility"]=n(195),o["open-layers"]=n(196),o["open-sm"]=n(199),o["open-tm"]=n(200),o["open-blocks"]=n(201),o["open-assets"]=n(202),o["show-offset"]=n(203),o["select-parent"]=n(204),o.fullscreen=n(205),o.preview=n(206),o.resize=n(207),o.drag=n(208),o["tlb-delete"]={run:function(t){var e=t.getSelected();e&&e.get("removable")&&(t.select(null),e.destroy())}},o["tlb-clone"]={run:function(t){var e=t.getSelected();if(e&&e.get("copyable")){var n=e.collection,i=n.indexOf(e),r=n.add(e.clone(),{at:i+1});e.emitUpdate(),t.trigger("component:clone",r)}}},o["tlb-move"]={run:function(t,e,n){var i=void 0,r=t.getModel(),o=n&&n.event,s=t.getSelected(),a=t.Canvas.getToolbarEl().style,l="dragstart"==o.type,c=function(){a.display="none",r.stopDefault()};if(s&&s.get("draggable")){l?setTimeout(function(){return c},0):c();var u=function(t,e){var n=e.el;n.style.position="absolute",n.style.margin=0},h=function(t,e){r.runDefault(),r.setSelected(s),s.emitUpdate(),i&&i.blur()},d=function(t,e){};if(r.get("designerMode"))i=editor.runCommand("drag",{el:s.view.el,options:{event:o,onStart:u,onDrag:d,onEnd:h}});else{l&&o.dataTransfer.setDragImage(s.view.el,0,0);var f=t.Commands.get("move-comp");f.onEndMoveFromModel=h,f.initSorterFromModel(s)}s.set("status","selected")}}},o["core:undo"]=function(t){return t.UndoManager.undo()},o["core:redo"]=function(t){return t.UndoManager.redo()},o["core:canvas-clear"]=function(t){t.DomComponents.clear(),t.CssComposer.clear()},o["core:copy"]=function(t){var e=t.getModel(),n=t.getSelected();n&&n.get("copyable")&&!t.Canvas.isInputFocused()&&e.set("clipboard",n)},o["core:paste"]=function(t){var e=t.getModel(),n=e.get("clipboard"),i=t.getSelected(),r=i&&i.collection;if(r&&n&&!t.Canvas.isInputFocused()){var o=r.indexOf(i)+1;r.add(n.clone(),{at:o})}},e.em&&(e.model=e.em.get("Canvas")),this.loadDefaultCommands(),this},add:l,get:function(t){var n=r[t];return"function"==typeof n&&(n=new n(e),r[t]=n),n},has:function(t){return!!r[t]},loadDefaultCommands:function(){for(var t in o)this.add(t,o[t]);return this}}}},function(t,e,n){"use strict";t.exports={ESCAPE_KEY:27,stylePrefix:"com-",defaults:[],em:null,firstCentered:!0,newFixedH:!1,minComponentH:50,minComponentW:50}},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports=e.View.extend({initialize:function(t){this.config=t||{},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=n(this.getCanvasWrapper()),this.frameEl=this.canvas.getFrameEl(),this.canvasTool=this.getCanvasTools(),this.bodyEl=this.getCanvasBody()),this.init(this.config)},onFrameScroll:function(t){},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(t){var e=t.getBoundingClientRect();return{top:e.top+t.ownerDocument.body.scrollTop,left:e.left+t.ownerDocument.body.scrollLeft}},init:function(t){},run:function(t,e){},
stop:function(t,e){}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports={run:function(t,e){arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e&&e.set&&e.set("active",0);var i=t.getConfig(),r=t.Modal,o=i.stylePrefix;if(this.cm=t.CodeManager||null,!this.$editors){var s=this.buildEditor("htmlmixed","hopscotch","HTML"),a=this.buildEditor("css","hopscotch","CSS");this.htmlEditor=s.el,this.cssEditor=a.el;var l=n('<div class="'+o+'export-dl"></div>');l.append(s.$el).append(a.$el),this.$editors=l}r.setTitle(i.textViewCode),r.setContent(this.$editors),r.open(),this.htmlEditor.setContent(t.getHtml()),this.cssEditor.setContent(t.getCss())},stop:function(t){var e=t.Modal;e&&e.close()},buildEditor:function(t,e,n){var i=document.createElement("textarea");!this.codeMirror&&(this.codeMirror=this.cm.getViewer("CodeMirror"));var r=this.codeMirror.clone().set({label:n,codeName:t,theme:e,input:i}),o=new this.cm.EditorView({model:r,config:this.cm.getConfig()}).render().$el;return r.init(i),{el:r,$el:o}}}}).call(e,n(0))},function(t,e,n){"use strict";var i=(n(0),n(49)),r=n(188);t.exports=i.extend({itemView:r,initialize:function(t){this.config={editor:t.editor||""},this.listenTo(this.collection,"reset",this.render)}})},function(t,e,n){"use strict";var i=n(0);t.exports=i.View.extend({events:function(){return this.model.get("events")||{mousedown:"handleClick"}},attributes:function(){return this.model.get("attributes")},initialize:function(t){this.editor=t.config.editor},handleClick:function(t){t.preventDefault(),t.stopPropagation(),this.execCommand(t)},execCommand:function(t){var e={event:t},n=this.model.get("command"),i=this.editor;"function"==typeof n&&n(i,null,e),"string"==typeof n&&i.runCommand(n,e)},render:function(){var t=this.editor.getConfig();return this.el.className+=" "+t.stylePrefix+"toolbar-item",this}})},function(t,e,n){"use strict";var i=n(0),r=n(190);t.exports=i.Collection.extend({model:r})},function(t,e,n){"use strict";var i=n(0);t.exports=i.Model.extend({defaults:{command:"",attributes:{}}})},function(t,e,n){"use strict";(function(e,i){var r=n(21),o=e.$;t.exports=i.extend({},r,{init:function(t){i.bindAll(this,"startDelete","stopDelete","onDelete"),this.hoverClass=this.pfx+"hover-delete",this.badgeClass=this.pfx+"badge-red"},enable:function(){this.$el.find("*").mouseover(this.startDelete).mouseout(this.stopDelete).click(this.onDelete)},startDelete:function(t){t.stopPropagation();var e=o(t.target);e.data("model").get("removable")&&(e.addClass(this.hoverClass),this.attachBadge(e.get(0)))},stopDelete:function(t){t.stopPropagation();var e=o(t.target);e.removeClass(this.hoverClass),this.badge&&this.badge.css({left:-1e3,top:-1e3})},onDelete:function(t){t.stopPropagation();var e=o(t.target);e.data("model").get("removable")&&(e.data("model").destroy(),this.removeBadge(),this.clean())},updateBadgeLabel:function(t){this.badge.html("Remove "+t.getName())}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";(function(e){var i=(n(0),n(55));t.exports=e.extend({},i,{beforeInsert:function(t){t.type="image",t.style={},t.attributes={},t.attributes.onmousedown="return false",this.config.firstCentered&&this.getCanvasWrapper()==this.sorter.target&&(t.style.margin="0 auto")},afterInsert:function(t){t.trigger("dblclick"),this.sender&&this.sender.set("active",!1)}})}).call(e,n(1))},function(t,e,n){"use strict";(function(e,i){var r=n(2),o=n(21),s=n(54),a=e.$;t.exports=i.extend({},s,o,{init:function(t){o.init.apply(this,arguments),i.bindAll(this,"initSorter","rollback","onEndMove"),this.opt=t,this.hoverClass=this.ppfx+"highlighter-warning",this.badgeClass=this.ppfx+"badge-warning",this.noSelClass=this.ppfx+"no-select"},enable:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];o.enable.apply(this,e),this.getBadgeEl().addClass(this.badgeClass),this.getHighlighterEl().addClass(this.hoverClass);var i=this.$wrapper;i.css("cursor","move"),i.on("mousedown",this.initSorter),i.addClass(this.noSelClass)},toggleClipboard:function(){},initSorter:function(t){var e=a(t.target).data("model"),n=e.get("draggable");n&&(this.cacheEl=null,this.startSelectPosition(t.target,this.frameEl.contentDocument),this.sorter.draggable=n,this.sorter.onEndMove=this.onEndMove.bind(this),this.stopSelectComponent(),this.$wrapper.off("mousedown",this.initSorter),(0,r.on)(this.getContentWindow(),"keydown",this.rollback))},initSorterFromModel:function(t){var e=t.get("draggable");if(e){this.cacheEl=null;var n=t.view.el;this.startSelectPosition(n,this.frameEl.contentDocument),this.sorter.draggable=e,this.sorter.onEndMove=this.onEndMoveFromModel.bind(this),this.stopSelectComponent(),(0,r.on)(this.getContentWindow(),"keydown",this.rollback)}},onEndMoveFromModel:function(){(0,r.off)(this.getContentWindow(),"keydown",this.rollback)},onEndMove:function(){this.enable(),(0,r.off)(this.getContentWindow(),"keydown",this.rollback)},onSelect:function(t,e){},rollback:function(t,e){var n=t.which||t.keyCode;(n==this.opt.ESCAPE_KEY||e)&&(this.sorter.moved=!1,this.sorter.endMove())},getBadgeEl:function(){return this.$badge||(this.$badge=a(this.getBadge())),this.$badge},getHighlighterEl:function(){return this.$hl||(this.$hl=a(this.canvas.getHighlighter())),this.$hl},stop:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];o.stop.apply(this,e),this.getBadgeEl().removeClass(this.badgeClass),this.getHighlighterEl().removeClass(this.hoverClass);var i=this.$wrapper;i.css("cursor","").unbind().removeClass(this.noSelClass)}})}).call(e,n(0),n(1))},function(t,e,n){"use strict";(function(e){var i=(n(0),n(22));t.exports=e.extend({},i,{beforeDraw:function(t){t.type="text",t.style||(t.style={}),t.style.padding="10px"},afterDraw:function(t){t&&t.set&&(t.trigger("focus"),this.sender&&this.sender.set("active",!1))}})}).call(e,n(1))},function(t,e,n){"use strict";t.exports={run:function(t){t.Canvas.getBody().className=this.ppfx+"dashed"},stop:function(t){t.Canvas.getBody().className=""}}},function(t,e,n){"use strict";(function(e){var i=n(197),r=e.$;t.exports={run:function(t,e){if(!this.toAppend){var n=t.DomComponents.getComponent().get("components"),o=t.getConfig(),s=o.stylePrefix,a=t.Panels,l=o.layers.stylePrefix||"nv-";o.layers.stylePrefix=o.stylePrefix+l,o.layers.pStylePrefix=o.stylePrefix,o.layers.em=t.editor,o.layers.opened=t.editor.get("opened"),a.getPanel("views-container")?this.panel=a.getPanel("views-container"):this.panel=a.addPanel({id:"views-container"});var c=r('<div class="'+s+'layers"></div>');this.panel.set("appendContent",c).trigger("change:appendContent"),o.layers.sortContainer=c.get(0);var u=(new i).init(n,o.layers);this.$layers=u.render(),c.append(this.$layers),this.toAppend=c}this.toAppend.show()},stop:function(){this.toAppend&&this.toAppend.hide()}}}).call(e,n(0))},function(t,e,n){"use strict";t.exports=function(){var t=void 0,e={},i=n(198),r=n(56),o=n(57);return{init:function(n,s){e=s||e;var a=e.em;for(var l in i)l in e||(e[l]=i[l]);var c=o,u=0,h=s.opened||{},d={level:u,config:e,opened:h};return e.showWrapper&&n.parent?(c=r,d.model=n.parent):d.collection=n,t=new c(d),a&&a.on("change:selectedComponent",this.componentChanged),this.componentChanged(),this},componentChanged:function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!i.fromLayers){var r=e.em,o=r.get("opened"),s=r.get("selectedComponent"),a=s&&s.collection?s.collection.parent:null;for(var l in o)o[l].set("open",0);for(;a;)a.set("open",1),o[a.cid]=a,a=a.collection?a.collection.parent:null}},render:function(){return t.render().$el}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"nv-",sortable:1,hidable:1,hideTextnode:1,showWrapper:1}},function(t,e,n){"use strict";var i=(n(31),n(0)),r=i.$;t.exports={run:function(t,e){if(this.sender=e,!this.$cn){var n=t.getConfig(),i=t.Panels;this.$cn=r("<div></div>"),this.$cn2=r("<div></div>"),this.$cn.append(this.$cn2);var o=t.DeviceManager;if(o&&n.showDevices){var s=i.addPanel({id:"devices-c"});s.set("appendContent",o.render()).trigger("change:appendContent")}var a=t.SelectorManager;a&&this.$cn2.append(a.render([])),this.$cn2.append(t.StyleManager.render());var l=t.StyleManager.getConfig(),c=l.stylePrefix;this.$header=r('<div class="'+c+'header">'+l.textNoElement+"</div>"),this.$cn.append(this.$header),i.getPanel("views-container")?this.panel=i.getPanel("views-container"):this.panel=i.addPanel({id:"views-container"}),this.panel.set("appendContent",this.$cn).trigger("change:appendContent"),this.target=t.editor,this.listenTo(this.target,"change:selectedComponent",this.toggleSm)}this.toggleSm()},toggleSm:function(){var t=this.sender;t&&t.get&&!t.get("active")||(this.target.get("selectedComponent")?(this.$cn2.show(),this.$header.hide()):(this.$cn2.hide(),this.$header.show()))},stop:function(){this.$cn2&&this.$cn2.hide(),this.$header&&this.$header.hide()}}},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports={run:function(t,e){var i,r=t.Config,o=r.stylePrefix,s=t.TraitManager;if(!this.obj){var a=s.getTraitsViewer(),l=s.getConfig();this.obj=n("<div></div>").append('<div class="'+o+'traits-label">'+l.labelContainer+"</div>").get(0),this.obj.appendChild(a.render().el);var c=t.Panels;i=c.getPanel("views-container")?c.getPanel("views-container"):c.addPanel({id:"views-container"}),i.set("appendContent",this.obj).trigger("change:appendContent")}this.obj.style.display="block"},stop:function(){this.obj&&(this.obj.style.display="none")}}}).call(e,n(0))},function(t,e,n){"use strict";t.exports={run:function(t,e){var n=t.BlockManager,i=t.Panels;if(!this.blocks){n.render();var r="views-container",o=document.createElement("div"),s=i.getPanel(r)||i.addPanel({id:r});o.appendChild(n.getContainer()),s.set("appendContent",o).trigger("change:appendContent"),this.blocks=o}this.blocks.style.display="block"},stop:function(){var t=this.blocks;t&&(t.style.display="none")}}},function(t,e,n){"use strict";t.exports={run:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.Modal,r=t.AssetManager,o=r.getConfig(),s=n.modalTitle||o.modalTitle||"";r.setTarget(n.target),r.onClick(n.onClick),r.onDblClick(n.onDblClick),r.onSelect(n.onSelect),this.rendered||(r.render(r.getAll().filter(function(t){return"image"==t.get("type")})),this.rendered=1),i.setTitle(s),i.setContent(r.getContainer()),i.open()}}},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports={getOffsetMethod:function(t){var e=t||"";return"get"+e+"OffsetViewerEl"},run:function(t,e,i){var r=i||{},o=r.state||"",s=t.getConfig();if(s.showOffsets&&(s.showOffsetsSelected||"Fixed"!=o)){var a=t.Canvas,l=r.el||"",c=r.elPos||a.getElementPos(l),u=window.getComputedStyle(l),h=this.ppfx,d=o+"State",f=this.getOffsetMethod(o),p=a[f]();p.style.display="block";var g=this["marginT"+o],v=this["marginB"+o],m=this["marginL"+o],y=this["marginR"+o],b=this["padT"+o],x=this["padB"+o],w=this["padL"+o],C=this["padR"+o];if(!this[d]){var k=o.toLowerCase(),S=k+"margin-v",T=k+"padding-v",E=n('<div class="'+h+'marginName">').get(0),M=n('<div class="'+h+'paddingName">').get(0),P=h+S+"-el",A=h+T+"-el",O=P+" "+(h+S),L=A+" "+(h+T);g=n('<div class="'+O+'-top"></div>').get(0),v=n('<div class="'+O+'-bottom"></div>').get(0),m=n('<div class="'+O+'-left"></div>').get(0),y=n('<div class="'+O+'-right"></div>').get(0),b=n('<div class="'+L+'-top"></div>').get(0),x=n('<div class="'+L+'-bottom"></div>').get(0),w=n('<div class="'+L+'-left"></div>').get(0),C=n('<div class="'+L+'-right"></div>').get(0),this["marginT"+o]=g,this["marginB"+o]=v,this["marginL"+o]=m,this["marginR"+o]=y,this["padT"+o]=b,this["padB"+o]=x,this["padL"+o]=w,this["padR"+o]=C,E.appendChild(g),E.appendChild(v),E.appendChild(m),E.appendChild(y),M.appendChild(b),M.appendChild(x),M.appendChild(w),M.appendChild(C),p.appendChild(E),p.appendChild(M),this[d]="1"}var N="px",D=u.marginLeft.replace(N,""),I=parseInt(u.marginTop.replace(N,"")),_=parseInt(u.marginBottom.replace(N,"")),F=g.style,z=v.style,R=m.style,$=y.style,V=b.style,H=x.style,j=w.style,B=C.style,W=parseInt(c.left);F.height=u.marginTop,F.width=u.width,F.top=c.top-u.marginTop.replace(N,"")+N,F.left=W+N,z.height=u.marginBottom,z.width=u.width,z.top=c.top+c.height+N,z.left=W+N;var U=c.height+I+_+N,q=c.top-I+N;R.height=U,R.width=u.marginLeft,R.top=q,R.left=W-D+N,$.height=U,$.width=u.marginRight,$.top=q,$.left=W+c.width+N;var K=parseInt(u.paddingTop.replace(N,""));V.height=u.paddingTop,V.width=u.width,V.top=c.top+N,V.left=W+N;var G=parseInt(u.paddingBottom.replace(N,""));H.height=u.paddingBottom,H.width=u.width,H.top=c.top+c.height-G+N,H.left=W+N;var Y=c.height-G-K+N,X=c.top+K+N;j.height=Y,j.width=u.paddingLeft,j.top=X,j.left=c.left+N;var J=parseInt(u.paddingRight.replace(N,""));B.height=Y,B.width=u.paddingRight,B.top=X,B.left=c.left+c.width-J+N}},stop:function(t,e,n){var i=n||{},r=i.state||"",o=this.getOffsetMethod(r),s=t.Canvas,a=s[o]();a.style.display="none"}}}).call(e,n(0))},function(t,e,n){"use strict";t.exports={run:function(t){for(var e=t.getSelected(),n=e&&e.parent();n&&!n.get("selectable");)n=n.parent();n&&t.select(n)}}},function(t,e,n){"use strict";t.exports={isEnabled:function(){var t=document;return t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement?1:0},enable:function(t){var e="";return t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?(e="webkit",t.webkitRequestFullscreen()):t.mozRequestFullScreen?(e="moz",t.mozRequestFullScreen()):t.msRequestFullscreen&&t.msRequestFullscreen(),e},disable:function(){var t=document;t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen?t.webkitExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.msExitFullscreen&&t.msExitFullscreen()},fsChanged:function(t,e){var n=(document,(t||"")+"fullscreenchange");this.isEnabled()||(this.stop(null,this.sender),document.removeEventListener(n,this.fsChanged))},run:function(t,e){this.sender=e;var n=this.enable(t.getContainer());this.fsChanged=this.fsChanged.bind(this,n),document.addEventListener(n+"fullscreenchange",this.fsChanged),t&&t.trigger("change:canvasOffset")},stop:function(t,e){e&&e.set&&e.set("active",!1),this.disable(),t&&t.trigger("change:canvasOffset")}}},function(t,e,n){"use strict";(function(e){t.exports={getPanels:function(t){return this.panels||(this.panels=t.Panels.getPanelsEl()),this.panels},tglPointers:function(t,n){var i=t.Canvas.getBody().querySelectorAll("."+this.ppfx+"no-pointer");e.each(i,function(t){t.style.pointerEvents=n?"":"all"})},run:function(t,e){e&&e.set&&e.set("active",!1),t.stopCommand("sw-visibility"),t.getModel().stopDefault();var n=this.getPanels(t),i=t.Canvas.getElement(),r=t.getEl(),o=t.Config.stylePrefix;this.helper||(this.helper=document.createElement("span"),this.helper.className=o+"off-prv fa fa-eye-slash",r.appendChild(this.helper),this.helper.onclick=function(){t.stopCommand("preview")}),this.helper.style.display="inline-block",this.tglPointers(t),n.style.display="none";var s=i.style;s.width="100%",s.height="100%",s.top="0",s.left="0",s.padding="0",s.margin="0",t.trigger("change:canvasOffset")},stop:function(t,e){var n=this.getPanels(t);t.runCommand("sw-visibility"),t.getModel().runDefault(),n.style.display="block";var i=t.Canvas.getElement();i.setAttribute("style",""),this.helper&&(this.helper.style.display="none"),t.trigger("change:canvasOffset"),this.tglPointers(t,1)}}}).call(e,n(1))},function(t,e,n){"use strict";t.exports={run:function(t,e,n){var i=n||{},r=i.el||"",o=t.Canvas,s=this.canvasResizer,a=i.options||{},l=o.getCanvasView();return a.ratioDefault=1,a.appendTo=o.getResizerEl(),a.prefix=t.getConfig().stylePrefix,a.posFetcher=l.getElementPos.bind(l),a.mousePosFetcher=o.getMouseRelativePos,s&&!i.forceNew||(this.canvasResizer=t.Utils.Resizer.init(a),s=this.canvasResizer),s.setOptions(a),s.focus(r),s},stop:function(){var t=this.canvasResizer;t&&t.blur()}}},function(t,e,n){"use strict";t.exports={run:function(t,e,n){var i=n&&n.el||"",r=t.Canvas,o=this.dragger,s=n.options||{},a=r.getCanvasView();return s.prefix=t.getConfig().stylePrefix,s.mousePosFetcher=r.getMouseRelativePos,s.posFetcher=a.getElementPos.bind(a),o||(o=t.Utils.Dragger.init(s),this.dragger=o),o.setOptions(s),o.focus(i),s.event&&o.start(s.event),o},stop:function(){this.canvasResizer&&this.canvasResizer.blur()}}},function(t,e,n){"use strict";t.exports=function(){var t,e,i,r={},o=n(210),s=n(211),a=n(213),l=n(214),c=[];return{name:"BlockManager",init:function(n){r=n||{};var u=r.em;for(var h in o)h in r||(r[h]=o[h]);return t=new s([]),e=new s([]),c=new a,i=new l({collection:e,categories:c},r),t.listenTo(t,"add",function(t){e.add(t),u&&u.trigger("block:add",t)}),t.listenTo(t,"remove",function(t){e.remove(t),u&&u.trigger("block:remove",t)}),t.listenTo(t,"reset",function(t){e.reset(t.models)}),this},getConfig:function(){return r},onLoad:function(){var t=this.getAll();!t.length&&t.reset(r.blocks)},add:function(e,n){var i=n||{};return i.id=e,t.add(i)},get:function(e){return t.get(e)},getAll:function(){return t},getAllVisible:function(){return e},remove:function(e){return t.remove(e)},getCategories:function(){return c},getContainer:function(){return i.el},render:function(t){var e=t||this.getAll().models;i.rendered||(i.render(),i.rendered=1),i.collection.reset(e)}}}},function(t,e,n){"use strict";t.exports={blocks:[],appendTo:""}},function(t,e,n){"use strict";var i=n(0),r=n(212);t.exports=i.Collection.extend({model:r})},function(t,e,n){"use strict";var i=n(0),r=n(58);t.exports=i.Model.extend({defaults:{label:"",content:"",category:"",attributes:{}},initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},this.get("category"));if(t&&"string"==typeof t){new r({id:t,label:t})}}})},function(t,e,n){"use strict";var i=n(0);t.exports=i.Collection.extend({model:n(58)})},function(t,e,n){"use strict";(function(e){var i=n(1),r=n(215),o=n(216);t.exports=n(0).View.extend({initialize:function(t,n){e.bindAll(this,"getSorter","onDrag","onDrop"),this.config=n||{},this.categories=t.categories||"",this.renderedCategories=[];var i=this.config.pStylePrefix||"";this.ppfx=i,this.noCatClass=i+"blocks-no-cat",this.blockContClass=i+"blocks-c",this.catsClass=i+"block-categories";var r=this.collection;this.listenTo(r,"add",this.addTo),this.listenTo(r,"reset",this.render),this.em=this.config.em,this.tac="test-tac",this.grabbingCls=this.ppfx+"grabbing",this.em&&(this.config.getSorter=this.getSorter,this.canvas=this.em.get("Canvas"))},getSorter:function(){if(this.em){if(!this.sorter){var t=this.em.get("Utils"),e=this.canvas;this.sorter=new t.Sorter({container:e.getBody(),placer:e.getPlacerEl(),containerSel:"*",itemSel:"*",pfx:this.ppfx,onStart:this.onDrag,onEndMove:this.onDrop,onMove:this.onMove,document:e.getFrameEl().contentDocument,direction:"a",wmargin:1,nested:1,em:this.em,canvasRelative:1})}return this.sorter}},onDrag:function(t){this.em.stopDefault(),this.em.trigger("block:drag:start",t)},onMove:function(t){this.em.trigger("block:drag:move",t)},onDrop:function(t){var e=this.em;e.runDefault(),t&&t.get&&(t.get("activeOnRender")&&(t.trigger("active"),t.set("activeOnRender",0)),e.trigger("block:drag:stop",t))},addTo:function(t){this.add(t)},add:function(t,e){var n=e||null,s=new r({model:t,attributes:t.get("attributes")},this.config),a=s.render().el,l=t.get("category");if(l&&this.categories){(0,i.isString)(l)?l={id:l,label:l}:(0,i.isObject)(l)&&!l.id&&(l.id=l.label);var c=this.categories.add(l),u=c.get("id"),h=this.renderedCategories[u],d=this.getCategoriesEl();return t.set("category",c),!h&&d&&(h=new o({model:c},this.config).render(),this.renderedCategories[u]=h,d.appendChild(h.el)),void(h&&h.append(a))}n?n.appendChild(a):this.append(a)},getCategoriesEl:function(){return this.catsEl||(this.catsEl=this.el.querySelector("."+this.catsClass)),this.catsEl},getBlocksEl:function(){return this.blocksEl||(this.blocksEl=this.el.querySelector("."+this.noCatClass+" ."+this.blockContClass)),this.blocksEl},append:function(t){var e=this.getBlocksEl();e&&e.appendChild(t)},render:function(){var t=this,e=document.createDocumentFragment();return this.catsEl=null,this.blocksEl=null,this.renderedCategories=[],this.el.innerHTML='\n <div class="'+this.catsClass+'"></div>\n <div class="'+this.noCatClass+'">\n <div class="'+this.blockContClass+'"></div>\n </div>\n ',this.collection.each(function(n){return t.add(n,e)}),this.append(e),this.$el.addClass(this.blockContClass+"s"),this}})}).call(e,n(1))},function(t,e,n){"use strict";(function(e){var i=n(1),r=n(2);t.exports=e.View.extend({events:{mousedown:"startDrag",dragstart:"handleDragStart",dragend:"handleDragEnd"},initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.em=e.em,this.config=e,this.endDrag=this.endDrag.bind(this),this.ppfx=e.pStylePrefix||"",this.listenTo(this.model,"destroy remove",this.remove)},startDrag:function(t){var e=this.config;if(0===t.button&&e.getSorter&&!this.el.draggable){e.em.refreshCanvas();var n=e.getSorter();n.setDragHelper(this.el,t),n.setDropContent(this.model.get("content")),n.startSort(this.el),(0,r.on)(document,"mouseup",this.endDrag)}},handleDragStart:function(t){var e=this.model.get("content"),n=(0,i.isObject)(e),r=n?"text/json":"text",o=n?JSON.stringify(e):e;t.dataTransfer.setData(r,o),this.em.set("dragContent",e)},handleDragEnd:function(){this.em.set("dragContent","")},endDrag:function(t){(0,r.off)(document,"mouseup",this.endDrag);var e=this.config.getSorter();e.moved=0,e.endMove()},render:function(){var t=this.el,e=this.ppfx,n=e+"block",i=this.model.get("label");return t.className+=" "+n+" "+e+"one-bg "+e+"four-color-h",t.innerHTML='<div class="'+n+'-label">'+i+"</div>",(0,r.hasDnd)(this.em)&&t.setAttribute("draggable",!0),this}})}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var i=n(0);t.exports=i.View.extend({template:e.template('\n <div class="<%= pfx %>title">\n <i class="<%= pfx %>caret-icon"></i>\n <%= label %>\n </div>\n <div class="<%= pfx %>blocks-c"></div>\n '),events:{},initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});this.config=t;var e=this.config.pStylePrefix||"";this.pfx=e,this.caretR="fa fa-caret-right",this.caretD="fa fa-caret-down",this.iconClass=e+"caret-icon",this.activeClass=e+"open",this.className=e+"block-category",this.events["click ."+e+"title"]="toggle",this.listenTo(this.model,"change:open",this.updateVisibility),this.delegateEvents()},updateVisibility:function(){this.model.get("open")?this.open():this.close()},open:function(){this.el.className=this.className+" "+this.activeClass,this.getIconEl().className=this.iconClass+" "+this.caretD,this.getBlocksEl().style.display=""},close:function(){this.el.className=this.className,this.getIconEl().className=this.iconClass+" "+this.caretR,this.getBlocksEl().style.display="none"},toggle:function(){var t=this.model;t.set("open",!t.get("open"))},getIconEl:function(){return this.iconEl||(this.iconEl=this.el.querySelector("."+this.iconClass)),this.iconEl},getBlocksEl:function(){return this.blocksEl||(this.blocksEl=this.el.querySelector("."+this.pfx+"blocks-c")),this.blocksEl},append:function(t){this.getBlocksEl().appendChild(t)},render:function(){return this.el.innerHTML=this.template({pfx:this.pfx,label:this.model.get("label")}),this.el.className=this.className,this.$el.css({order:this.model.get("order")}),this.updateVisibility(),this}})}).call(e,n(1))},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){var e=t.$,n=t.Backbone;if(n){var r=n.View.prototype,o={};r.eventNsMap=o,r.delegate=function(t,e,n){var i=".delegateEvents"+this.cid;this.$el.on(t,e,n);var r=o[i];return r||(r=[],o[i]=r),r.push({eventName:t,selector:e,listener:n}),this},r.undelegateEvents=function(){var t=this,e=".delegateEvents"+this.cid;if(this.$el){var n=o[e];n&&n.forEach(function(e){var n=e.eventName;e.selector,e.listener;t.$el.off(n)})}return this},r.undelegate=function(t,e,n){var i=this,r=".delegateEvents"+this.cid,s=o[r];return s&&s.forEach(function(n){var r=n.eventName,o=n.selector;n.listener;r==t&&o==e&&i.$el.off(r)}),this}}if(e&&"jQuery"!==e.prototype.constructor.name){var s=e.fn,a=e.prototype.on,l=e.prototype.off,c=e.prototype.trigger,u=e.prototype.offset,h=function(t){return t.split(/[,\s]+/g)},d=function(t){return t.split(".")};s.on=function(t,e,n,i){var r=this;if("string"==typeof t){var o=h(t);if(1==o.length){t=o[0];var s=d(t);if(0!==t.indexOf(".")&&(t=s[0]),s=s.slice(1),s.length){this.data("_cashNs")||[];this.data("_cashNs",s)}return a.call(this,t,e,n,i)}return o.forEach(function(t){return r.on(t,e,n,i)}),this}return a.call(this,t,e,n,i)},s.off=function(t,e){var n=this;if("string"==typeof t){var i=h(t);if(1==i.length){t=i[0];var r=d(t);return 0!==t.indexOf(".")&&(t=r[0]),r=r.slice(1),r.length,l.call(this,t,e)}return i.forEach(function(t){return n.off(t,e)}),this}return l.call(this,t,e)},s.trigger=function(t,n){var i=this;if(t instanceof e.Event)return this.trigger(t.type,n);if("string"==typeof t){var r=h(t);if(1==r.length){t=r[0];var o=d(t);return 0!==t.indexOf(".")&&(t=o[0]),o=o.slice(1),o.length,c.call(this,t,n)}return r.forEach(function(t){return i.trigger(t,n)}),this}return c.call(this,t,n)},s.hide=function(){return this.css("display","none")},s.show=function(){return this.css("display","block")},s.focus=function(){var t=this.get(0);return t&&t.focus(),this},s.remove=function(){return this.each(function(t){return t.parentNode&&t.parentNode.removeChild(t)})},s.bind=function(t,e){return this.on(t,e)},s.unbind=function(t,e){if((0,i.isObject)(t)){for(var n in t)t.hasOwnProperty(n)&&this.off(n,t[n]);return this}return this.off(t,e)},s.click=function(t){return t?this.on("click",t):this.trigger("click")},s.change=function(t){return t?this.on("change",t):this.trigger("change")},s.keydown=function(t){return t?this.on("keydown",t):this.trigger("keydown")},s.delegate=function(t,e,n,i){return i||(i=n),this.on(e,t,function(t){t.data=n,i(t)})},s.scrollLeft=function(){var t=this.get(0);t=9==t.nodeType?t.defaultView:t;var e=t instanceof Window?t:null;return e?e.pageXOffset:t.scrollLeft||0},s.scrollTop=function(){var t=this.get(0);t=9==t.nodeType?t.defaultView:t;var e=t instanceof Window?t:null;return e?e.pageYOffset:t.scrollTop||0},s.offset=function(t){var e=void 0,n=void 0;return t&&(e=t.top,n=t.left),"undefined"!=typeof e&&this.css("top",e+"px"),"undefined"!=typeof n&&this.css("left",n+"px"),u.call(this)},e.map=function(t,e){for(var n=[],i=0;i<t.length;i++)n.push(e(t[i],i));return n};var f=Array.prototype.indexOf;e.inArray=function(t,e,n){return null==e?-1:f.call(e,t,n)},e.Event=function(t,n){return this instanceof e.Event?(this.type=t,void(this.isDefaultPrevented=function(){return!1})):new e.Event(t,n)}}}},function(t,e,n){"use strict";(function(e){var n=e.$;t.exports=e.View.extend({initialize:function(){var t=this,e=this.model;e.view=this,this.conf=e.config,this.pn=e.get("Panels"),e.on("loaded",function(){t.pn.active(),t.pn.disableButtons(),e.runDefault(),setTimeout(function(){return e.trigger("load")},0)})},render:function(){var t=this.model,e=this.$el,i=this.conf,r=n(i.el||"body "+i.container),o=i.stylePrefix;return e.empty(),i.width&&r.css("width",i.width),i.height&&r.css("height",i.height),e.append(t.get("Canvas").render()),e.append(this.pn.render()),e.attr("class",o+"editor "+o+"one-bg "+o+"two-color"),r.addClass(o+"editor-cont").empty().append(e),this}})}).call(e,n(0))},function(t,e,n){"use strict";t.exports=function(t){var e=t||{},i=n(220);for(var r in i)r in e||(e[r]=i[r]);var o={};return{add:function(t,e){return o[t]?o[t]:(o[t]=e,e)},get:function(t){return o[t]},getAll:function(){return o}}}},function(t,e,n){"use strict";t.exports={plugins:[]}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=function(){var t=function(){for(var t=void 0,e=window.navigator.userAgent,n=[["edge",/Edge\/([0-9\._]+)/],["ie",/MSIE\s(7\.0)/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/]],i=0;i<n.length;i++){var r=n[i];if(t=r[1].exec(e))break}return!!t};if(t()){var e=DOMImplementation.prototype.createHTMLDocument;DOMImplementation.prototype.createHTMLDocument=function(t){return t||(t=""),e.apply(document.implementation,[t])}}}}])});
//# sourceMappingURL=grapesjs.min.js.map