UNPKG

grapesjs

Version:

Free and Open Source Web Builder Framework

2 lines 1.11 MB
/*! grapesjs - 0.22.14 */ !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()}('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof window?window:this,(()=>(()=>{var t={4729:(t,e,n)=>{var o,r,i;1&&(r=[n(5706),n(4193)],void 0===(i='function'==typeof(o=function(t,e){var n=Array.prototype.slice;function o(t,e,n){return n.length<=4?t.call(e,n[0],n[1],n[2],n[3]):t.apply(e,n)}function r(t,e){return n.call(t,e)}function i(e,n){return null!=e&&(t.isArray(n)||(n=r(arguments,1)),t.all(n,(function(t){return t in e})))}var a=function(){var e=!1,n=-1;function o(){n++,e=!0,t.defer((function(){e=!1}))}return function(){return e||o(),n}}();function s(){this.registeredObjects=[],this.cidIndexes=[]}function l(e,n,o,r){for(var i,a=0,s=n.length;a<s;a++)if(i=n[a]){if("on"===e){if(!r.objectRegistry.register(i))continue}else if(!r.objectRegistry.unregister(i))continue;t.isFunction(i[e])&&i[e]("all",o,r)}}function c(e,n){var o=n.type,r=n.undoTypes,i=!r[o]||r[o][e];t.isFunction(i)&&i(n.object,n.before,n.after,n.options)}function u(e,o,r,i,a){if(!(r.isCurrentlyUndoRedoing||"undo"===e&&-1===r.pointer||"redo"===e&&r.pointer===r.length-1)){r.isCurrentlyUndoRedoing=!0;var s,l,c="undo"===e;for(a?l=c&&r.pointer===r.length-1||!c&&-1===r.pointer?t.clone(r.models):n.apply(r.models,c?[0,r.pointer]:[r.pointer,r.length-1]):(s=r.at(c?r.pointer:r.pointer+1),l=i?r.where({magicFusionIndex:s.get("magicFusionIndex")}):[s]),r.pointer+=(c?-1:1)*l.length;s=c?l.pop():l.shift();)s[e]();r.isCurrentlyUndoRedoing=!1,o.trigger(e,o)}}function p(t,e){var n=t.condition,r=typeof n;return"function"===r?!!o(n,t,e):"boolean"!==r||n}function d(t,e,n,r){if(t.track&&!t.isCurrentlyUndoRedoing&&e in r&&p(r[e],n)){var s=o(r[e]["on"],r[e],n);if(i(s,"object","before","after")){if(s.type=e,s.magicFusionIndex=a(),s.undoTypes=r,t.pointer<t.length-1)for(var l=t.length-t.pointer-1;l--;)t.pop();t.pointer=t.length,t.add(s),t.length>t.maximumStackLength&&(t.shift(),t.pointer--)}}}s.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 f={add:{undo:function(t,e,n,o){t.remove(n,o)},redo:function(t,e,n,o){o.index&&(o.at=o.index),t.add(n,o)},on:function(e,n,o){return{object:n,before:void 0,after:e,options:t.clone(o)}}},remove:{undo:function(t,e,n,o){"index"in o&&(o.at=o.index),t.add(e,o)},redo:function(t,e,n,o){t.remove(e,o)},on:function(e,n,o){return{object:n,before:e,after:void 0,options:t.clone(o)}}},change:{undo:function(e,n,o,r){t.isEmpty(n)?t.each(t.keys(o),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,o,r){t.isEmpty(o)?t.each(t.keys(n),e.unset,e):(e.set(o),r&&r.unsetData&&r.unsetData.after&&r.unsetData.after.length&&t.each(r.unsetData.after,e.unset,e))},on:function(e,n){var o=e.changedAttributes(),r=t.keys(o),i=t.pick(e.previousAttributes(),r),a=t.keys(i),s=(n||(n={})).unsetData={after:[],before:[]};return r.length!=a.length&&(r.length>a.length?t.each(r,(function(t){t in i||s.before.push(t)}),this):t.each(a,(function(t){t in o||s.after.push(t)}))),{object:e,before:i,after:o,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)}}}};function h(){}function v(e,n,o,r){if("object"==typeof n)return t.each(n,(function(t,n){2===e?v(e,t,o,r):v(e,n,t,o)}));switch(e){case 0:i(o,"undo","redo","on")&&t.all(t.pick(o,"undo","redo","on"),t.isFunction)&&(r[n]=o);break;case 1:r[n]&&t.isObject(o)&&(r[n]=t.extend({},r[n],o));break;case 2:delete r[n]}return this}h.prototype=f;var g=e.Model.extend({defaults:{type:null,object:null,before:null,after:null,magicFusionIndex:null},undo:function(t){c("undo",this.attributes)},redo:function(t){c("redo",this.attributes)}}),y=e.Collection.extend({model:g,pointer:-1,track:!1,isCurrentlyUndoRedoing:!1,maximumStackLength:1/0,setMaxLength:function(t){this.maximumStackLength=t}}),m=e.Model.extend({defaults:{maximumStackLength:1/0,track:!1},initialize:function(e){this.stack=new y,this.objectRegistry=new s,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)?o(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){d(this.stack,t,r(arguments,1),this.undoTypes)},register:function(){l("on",arguments,this._addToStack,this)},unregister:function(){l("off",arguments,this._addToStack,this)},unregisterAll:function(){o(this.unregister,this,this.objectRegistry.get())},undo:function(t){u("undo",this,this.stack,t)},undoAll:function(){u("undo",this,this.stack,!1,!0)},redo:function(t){u("redo",this,this.stack,t)},redoAll:function(){u("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,o=t.isArray(e)?e:r(arguments);n=o.pop();)n instanceof m&&n.stack instanceof y&&(n.stack=this.stack)},addUndoType:function(t,e){v(0,t,e,this.undoTypes)},changeUndoType:function(t,e){v(1,t,e,this.undoTypes)},removeUndoType:function(t){v(2,t,void 0,this.undoTypes)},clear:function(){this.stack.reset(),this.stack.pointer=-1}});return t.extend(m,{defaults:function(e){t.extend(m.prototype.defaults,e)},addUndoType:function(t,e){v(0,t,e,f)},changeUndoType:function(t,e){v(1,t,e,f)},removeUndoType:function(t){v(2,t,void 0,f)}}),e.UndoManager=m})?o.apply(e,r):o)||(t.exports=i))},4193:(t,e,n)=>{var o,r;!function(){var i='object'==typeof self&&self.self===self&&self||'object'==typeof n.g&&n.g.global===n.g&&n.g;if(1)o=[n(5706),n(7774),e],r=function(t,e,n){i.Backbone=function(t,e,n,o){var r=t.Backbone,i=Array.prototype.slice;e.VERSION='1.4.1',e.$=o,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var a,s=e.Events={},l=/\s+/,c=function(t,e,o,r,i){var a,s=0;if(o&&'object'==typeof o){void 0!==r&&'context'in i&&void 0===i.context&&(i.context=r);for(a=n.keys(o);s<a.length;s++)e=c(t,e,a[s],o[a[s]],i)}else if(o&&l.test(o))for(a=o.split(l);s<a.length;s++)e=t(e,a[s],r,i);else e=t(e,o,r,i);return e};s.on=function(t,e,n){(this._events=c(u,this._events||{},t,e,{context:n,ctx:this,listening:a}),a)&&((this._listeners||(this._listeners={}))[a.id]=a,a.interop=!1);return this},s.listenTo=function(t,e,o){if(!t)return this;var r=t._listenId||(t._listenId=n.uniqueId('l')),i=this._listeningTo||(this._listeningTo={}),s=a=i[r];s||(this._listenId||(this._listenId=n.uniqueId('l')),s=a=i[r]=new g(this,t));var l=p(t,e,o,this);if(a=void 0,l)throw l;return s.interop&&s.on(e,o),this};var u=function(t,e,n,o){if(n){var r=t[e]||(t[e]=[]),i=o.context,a=o.ctx,s=o.listening;s&&s.count++,r.push({callback:n,context:i,ctx:i||a,listening:s})}return t},p=function(t,e,n,o){try{t.on(e,n,o)}catch(t){return t}};s.off=function(t,e,n){return this._events?(this._events=c(d,this._events,t,e,{context:n,listeners:this._listeners}),this):this},s.stopListening=function(t,e,o){var r=this._listeningTo;if(!r)return this;for(var i=t?[t._listenId]:n.keys(r),a=0;a<i.length;a++){var s=r[i[a]];if(!s)break;s.obj.off(e,o,this),s.interop&&s.off(e,o)}return n.isEmpty(r)&&(this._listeningTo=void 0),this};var d=function(t,e,o,r){if(t){var i,a=r.context,s=r.listeners,l=0;if(e||a||o){for(i=e?[e]:n.keys(t);l<i.length;l++){var c=t[e=i[l]];if(!c)break;for(var u=[],p=0;p<c.length;p++){var d=c[p];if(o&&o!==d.callback&&o!==d.callback._callback||a&&a!==d.context)u.push(d);else{var f=d.listening;f&&f.off(e,o)}}u.length?t[e]=u:delete t[e]}return t}for(i=n.keys(s);l<i.length;l++)s[i[l]].cleanup()}};s.once=function(t,e,n){var o=c(f,{},t,e,this.off.bind(this));return'string'==typeof t&&null==n&&(e=void 0),this.on(o,e,n)},s.listenToOnce=function(t,e,n){var o=c(f,{},e,n,this.stopListening.bind(this,t));return this.listenTo(t,o)};var f=function(t,e,o,r){if(o){var i=t[e]=n.once((function(){r(e,i),o.apply(this,arguments)}));i._callback=o}return t};s.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),n=Array(e),o=0;o<e;o++)n[o]=arguments[o+1];return c(h,this._events,t,void 0,n),this};var h=function(t,e,n,o){if(t){var r=t[e],i=t.all;r&&i&&(i=i.slice()),r&&v(r,o),i&&v(i,[e].concat(o))}return t},v=function(t,e){var n,o=-1,r=t.length,i=e[0],a=e[1],s=e[2];switch(e.length){case 0:for(;++o<r;)(n=t[o]).callback.call(n.ctx);return;case 1:for(;++o<r;)(n=t[o]).callback.call(n.ctx,i);return;case 2:for(;++o<r;)(n=t[o]).callback.call(n.ctx,i,a);return;case 3:for(;++o<r;)(n=t[o]).callback.call(n.ctx,i,a,s);return;default:for(;++o<r;)(n=t[o]).callback.apply(n.ctx,e);return}},g=function(t,e){this.id=t._listenId,this.listener=t,this.obj=e,this.interop=!0,this.count=0,this._events=void 0};g.prototype.on=s.on,g.prototype.off=function(t,e){var n;this.interop?(this._events=c(d,this._events,t,e,{context:void 0,listeners:void 0}),n=!this._events):(this.count--,n=0===this.count),n&&this.cleanup()},g.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},s.bind=s.on,s.unbind=s.off,n.extend(e,s);var y=e.Model=function(t,e){var o=t||{};e||(e={}),this.preinitialize.apply(this,arguments),this.cid=n.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(o=this.parse(o,e)||{});var r=n.result(this,'defaults');o=n.defaults(n.extend({},r,o),r),this.set(o,e),this.changed={},this.initialize.apply(this,arguments)};n.extend(y.prototype,s,{changed:null,validationError:null,idAttribute:'id',cidPrefix:'c',preinitialize:function(){},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,o){if(null==t)return this;var r;if('object'==typeof t?(r=t,o=e):(r={})[t]=e,o||(o={}),!this._validate(r,o))return!1;var i=o.unset,a=o.silent,s=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=n.clone(this.attributes),this.changed={});var c=this.attributes,u=this.changed,p=this._previousAttributes;for(var d in r)e=r[d],n.isEqual(c[d],e)||s.push(d),n.isEqual(p[d],e)?delete u[d]:u[d]=e,i?delete c[d]:c[d]=e;if(this.idAttribute in r){var f=this.id;this.id=this.get(this.idAttribute),this.trigger('changeId',this,f,o)}if(!a){s.length&&(this._pending=o);for(var h=0;h<s.length;h++)this.trigger('change:'+s[h],this,c[s[h]],o)}if(l)return this;if(!a)for(;this._pending;)o=this._pending,this._pending=!1,this.trigger('change',this,o);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 o in this.attributes)e[o]=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,o=this._changing?this._previousAttributes:this.attributes,r={};for(var i in t){var a=t[i];n.isEqual(o[i],a)||(r[i]=a,e=!0)}return!!e&&r},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,o=t.success;return t.success=function(n){var r=t.parse?e.parse(n,t):n;if(!e.set(r,t))return!1;o&&o.call(t.context,e,n,t),e.trigger('sync',e,n,t)},K(this,t),this.sync('read',this,t)},save:function(t,e,o){var r;null==t||'object'==typeof t?(r=t,o=e):(r={})[t]=e;var i=(o=n.extend({validate:!0,parse:!0},o)).wait;if(r&&!i){if(!this.set(r,o))return!1}else if(!this._validate(r,o))return!1;var a=this,s=o.success,l=this.attributes;o.success=function(t){a.attributes=l;var e=o.parse?a.parse(t,o):t;if(i&&(e=n.extend({},r,e)),e&&!a.set(e,o))return!1;s&&s.call(o.context,a,t,o),a.trigger('sync',a,t,o)},K(this,o),r&&i&&(this.attributes=n.extend({},l,r));var c=this.isNew()?'create':o.patch?'patch':'update';'patch'!==c||o.attrs||(o.attrs=r);var u=this.sync(c,this,o);return this.attributes=l,u},destroy:function(t){t=t?n.clone(t):{};var e=this,o=t.success,r=t.wait,i=function(){e.stopListening(),e.trigger('destroy',e,e.collection,t)};t.success=function(n){r&&i(),o&&o.call(t.context,e,n,t),e.isNew()||e.trigger('sync',e,n,t)};var a=!1;return this.isNew()?n.defer(t.success):(K(this,t),a=this.sync('delete',this,t)),r||i(),a},url:function(){var t=n.result(this,'urlRoot')||n.result(this.collection,'url')||G();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 o=this.validationError=this.validate(t,e)||null;return!o||(this.trigger('invalid',this,o,n.extend(e,{validationError:o})),!1)}});var m=e.Collection=function(t,e){e||(e={}),this.preinitialize.apply(this,arguments),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))},b={add:!0,remove:!0,merge:!0},_={add:!0,remove:!1},w=function(t,e,n){n=Math.min(Math.max(n,0),t.length);var o,r=Array(t.length-n),i=e.length;for(o=0;o<r.length;o++)r[o]=t[o+n];for(o=0;o<i;o++)t[o+n]=e[o];for(o=0;o<r.length;o++)t[o+i+n]=r[o]};n.extend(m.prototype,s,{model:y,preinitialize:function(){},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,_))},remove:function(t,e){e=n.extend({},e);var o=!n.isArray(t);t=o?[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)),o?r[0]:r},set:function(t,e){if(null!=t){(e=n.extend({},b,e)).parse&&!this._isModel(t)&&(t=this.parse(t,e)||[]);var o=!n.isArray(t);t=o?[t]:t.slice();var r=e.at;null!=r&&(r=+r),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);var i,a,s=[],l=[],c=[],u=[],p={},d=e.add,f=e.merge,h=e.remove,v=!1,g=this.comparator&&null==r&&!1!==e.sort,y=n.isString(this.comparator)?this.comparator:null;for(a=0;a<t.length;a++){i=t[a];var m=this.get(i);if(m){if(f&&i!==m){var _=this._isModel(i)?i.attributes:i;e.parse&&(_=m.parse(_,e)),m.set(_,e),c.push(m),g&&!v&&(v=m.hasChanged(y))}p[m.cid]||(p[m.cid]=!0,s.push(m)),t[a]=m}else d&&(i=t[a]=this._prepareModel(i,e))&&(l.push(i),this._addReference(i,e),p[i.cid]=!0,s.push(i))}if(h){for(a=0;a<this.length;a++)p[(i=this.models[a]).cid]||u.push(i);u.length&&this._removeModels(u,e)}var C=!1,x=!g&&d&&h;if(s.length&&x?(C=this.length!==s.length||n.some(this.models,(function(t,e){return t!==s[e]})),this.models.length=0,w(this.models,s,0),this.length=this.models.length):l.length&&(g&&(v=!0),w(this.models,l,null==r?this.length:r),this.length=this.models.length),v&&this.sort({silent:!0}),!e.silent){for(a=0;a<l.length;a++)null!=r&&(e.index=r+a),(i=l[a]).trigger('add',i,this,e);(v||C)&&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 o?t[0]:t}},reset:function(t,e){e=e?n.clone(e):{};for(var o=0;o<this.models.length;o++)this._removeReference(this.models[o],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 i.apply(this.models,arguments)},get:function(t){if(null!=t)return this._byId[t]||this._byId[this.modelId(this._isModel(t)?t.attributes:t,t.idAttribute)]||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 o=e.length;return n.isFunction(e)&&(e=e.bind(this)),1===o||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){var e=(t=n.extend({parse:!0},t)).success,o=this;return t.success=function(n){var r=t.reset?'reset':'set';o[r](n,t),e&&e.call(t.context,o,n,t),o.trigger('sync',o,n,t)},K(this,t),this.sync('read',this,t)},create:function(t,e){var o=(e=e?n.clone(e):{}).wait;if(!(t=this._prepareModel(t,e)))return!1;o||this.add(t,e);var r=this,i=e.success;return e.success=function(t,e,n){o&&r.add(t,n),i&&i.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,e){return t[e||this.model.prototype.idAttribute||'id']},values:function(){return new x(this,S)},keys:function(){return new x(this,O)},entries:function(){return new x(this,T)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){return this._isModel(t)?(t.collection||(t.collection=this),t):((e=e?n.clone(e):{}).collection=this,(o=this.model.prototype?new this.model(t,e):this.model(t,e)).validationError?(this.trigger('invalid',this,o.validationError,e),!1):o);var o},_removeModels:function(t,e){for(var n=[],o=0;o<t.length;o++){var r=this.get(t[o]);if(r){var i=this.indexOf(r);this.models.splice(i,1),this.length--,delete this._byId[r.cid];var a=this.modelId(r.attributes,r.idAttribute);null!=a&&delete this._byId[a],e.silent||(e.index=i,r.trigger('remove',r,this,e)),n.push(r),this._removeReference(r,e)}}return n},_isModel:function(t){return t instanceof y},_addReference:function(t,e){this._byId[t.cid]=t;var n=this.modelId(t.attributes,t.idAttribute);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,t.idAttribute);null!=n&&delete this._byId[n],this===t.collection&&delete t.collection,t.off('all',this._onModelEvent,this)},_onModelEvent:function(t,e,n,o){if(e){if(('add'===t||'remove'===t)&&n!==this)return;if('destroy'===t&&this.remove(e,o),'changeId'===t){var r=this.modelId(e.previousAttributes(),e.idAttribute),i=this.modelId(e.attributes,e.idAttribute);null!=r&&delete this._byId[r],null!=i&&(this._byId[i]=e)}}this.trigger.apply(this,arguments)}});var C='function'==typeof Symbol&&Symbol.iterator;C&&(m.prototype[C]=m.prototype.values);var x=function(t,e){this._collection=t,this._kind=e,this._index=0},S=1,O=2,T=3;C&&(x.prototype[C]=function(){return this});x.prototype.next=function(){if(this._collection){if(this._index<this._collection.length){var t,e=this._collection.at(this._index);if(this._index++,this._kind===S)t=e;else{var n=this._collection.modelId(e.attributes,e.idAttribute);t=this._kind===O?n:[n,e]}return{value:t,done:!1}}this._collection=void 0}return{value:void 0,done:!0}};var P=e.View=function(t){this.cid=n.uniqueId('view'),this.preinitialize.apply(this,arguments),n.extend(this,n.pick(t,k)),this._ensureElement(),this.initialize.apply(this,arguments)},E=/^(\S+)\s*(.*)$/,k=['model','collection','el','id','attributes','className','tagName','events'];n.extend(P.prototype,s,{tagName:'div',$:function(t){return this.$el.find(t)},preinitialize:function(){},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;for(var e in this.undelegateEvents(),t){var o=t[e];if(n.isFunction(o)||(o=this[o]),o){var r=e.match(E);this.delegate(r[1],r[2],o.bind(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)}});var A=function(t,e,n,o){switch(e){case 1:return function(){return t[n](this[o])};case 2:return function(e){return t[n](this[o],e)};case 3:return function(e,r){return t[n](this[o],M(e,this),r)};case 4:return function(e,r,i){return t[n](this[o],M(e,this),r,i)};default:return function(){var e=i.call(arguments);return e.unshift(this[o]),t[n].apply(t,e)}}},j=function(t,e,o,r){n.each(o,(function(n,o){e[o]&&(t.prototype[o]=A(e,n,o,r))}))},M=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?D(t):n.isString(t)?function(e){return e.get(t)}:t},D=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},L={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},I={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};n.each([[m,L,'models'],[y,I,'attributes']],(function(t){var e=t[0],o=t[1],r=t[2];e.mixin=function(t){var o=n.reduce(n.functions(t),(function(t,e){return t[e]=0,t}),{});j(e,t,o,r)},j(e,n,o,r)})),e.sync=function(t,o,r){var i=N[t];n.defaults(r||(r={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:i,dataType:'json'};if(r.url||(a.url=n.result(o,'url')||G()),null!=r.data||!o||'create'!==t&&'update'!==t&&'patch'!==t||(a.contentType='application/json',a.data=JSON.stringify(r.attrs||o.toJSON(r))),r.emulateJSON&&(a.contentType='application/x-www-form-urlencoded',a.data=a.data?{model:a.data}:{}),r.emulateHTTP&&('PUT'===i||'DELETE'===i||'PATCH'===i)){a.type='POST',r.emulateJSON&&(a.data._method=i);var s=r.beforeSend;r.beforeSend=function(t){if(t.setRequestHeader('X-HTTP-Method-Override',i),s)return s.apply(this,arguments)}}'GET'===a.type||r.emulateJSON||(a.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(a,r));return o.trigger('request',o,c,r),c};var N={create:'POST',update:'PUT',patch:'PATCH',delete:'DELETE',read:'GET'};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var R=e.Router=function(t){t||(t={}),this.preinitialize.apply(this,arguments),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},V=/\((.*?)\)/g,F=/(\(\?)?:\w+/g,H=/\*\w+/g,U=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(R.prototype,s,{preinitialize:function(){},initialize:function(){},route:function(t,o,r){n.isRegExp(t)||(t=this._routeToRegExp(t)),n.isFunction(o)&&(r=o,o=''),r||(r=this[o]);var i=this;return e.history.route(t,(function(n){var a=i._extractParameters(t,n);!1!==i.execute(r,a,o)&&(i.trigger.apply(i,['route:'+o].concat(a)),i.trigger('route',o,a),e.history.trigger('route',i,o,a))})),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(U,'\\$&').replace(V,'(?:$1)?').replace(F,(function(t,e){return e?t:'([^/?]+)'})).replace(H,'([^?]*?)'),new RegExp('^'+t+'(?:\\?([\\s\\S]*))?$')},_extractParameters:function(t,e){var o=t.exec(e).slice(1);return n.map(o,(function(t,e){return e===o.length-1?t||null:t?decodeURIComponent(t):null}))}});var B=e.History=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),'undefined'!=typeof window&&(this.location=window.location,this.history=window.history)},z=/^[#\/]|\s+$/g,W=/^\/+|\/+$/g,$=/#.*$/;B.started=!1,n.extend(B.prototype,s,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,'$&/')===this.root&&!this.getSearch()},matchRoot:function(){return this.decodeFragment(this.location.pathname).slice(0,this.root.length-1)+'/'===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(z,'')},start:function(t){if(B.started)throw new Error('Backbone.history has already been started');if(B.started=!0,this.options=n.extend({root:'/'},this.options,t),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,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(W,'/'),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 o=document.body,r=o.insertBefore(this.iframe,o.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash='#'+this.fragment}var i=window.addEventListener||function(t,e){return attachEvent('on'+t,e)};if(this._usePushState?i('popstate',this.checkUrl,!1):this._useHashChange&&!this.iframe?i('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),B.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e===this.fragment)return!1;this.iframe&&this.navigate(e),this.loadUrl()},loadUrl:function(t){return!!this.matchRoot()&&(t=this.fragment=this.getFragment(t),n.some(this.handlers,(function(e){if(e.route.test(t))return e.callback(t),!0})))},navigate:function(t,e){if(!B.started)return!1;e&&!0!==e||(e={trigger:!!e}),t=this.getFragment(t||'');var n=this.root;''!==t&&'?'!==t.charAt(0)||(n=n.slice(0,-1)||'/');var o=n+t;t=t.replace($,'');var r=this.decodeFragment(t);if(this.fragment!==r){if(this.fragment=r,this._usePushState)this.history[e.replace?'replaceState':'pushState']({},document.title,o);else{if(!this._wantsHashChange)return this.location.assign(o);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var i=this.iframe.contentWindow;e.replace||(i.document.open(),i.document.close()),this._updateHash(i.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var o=t.href.replace(/(javascript:|#).*$/,'');t.replace(o+'#'+e)}else t.hash='#'+e}}),e.history=new B;var q=function(t,e){var o,r=this;return o=t&&n.has(t,'constructor')?t.constructor:function(){return r.apply(this,arguments)},n.extend(o,r,e),o.prototype=n.create(r.prototype,t),o.prototype.constructor=o,o.__super__=r.prototype,o};y.extend=m.extend=R.extend=P.extend=B.extend=q;var G=function(){throw new Error('A "url" property or function must be specified')},K=function(t,e){var n=e.error;e.error=function(o){n&&n.call(e.context,t,o,e),t.trigger('error',t,o,e)}};return e}(i,n,t,e)}.apply(e,o),void 0===r||(t.exports=r);else;}()},3640:(t,e,n)=>{1&&function(t){t.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(t,e){return/^[;{}]$/.test(e)}}),t.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(t,e,n,o){return this.jsonMode?/^[\[,{]$/.test(e)||/^}/.test(n):(";"!=e||!o.lexical||")"!=o.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:"\x3c!--",commentEnd:"--\x3e",newlineAfterToken:function(t,n,o,r){var i=!1;return"html"==this.configuration&&(i=!!r.context&&e.test(r.context.tagName)),!i&&("tag"==t&&/>$/.test(n)&&r.context||/^</.test(o))}}),t.defineExtension("commentRange",(function(e,n,o){var r=this,i=t.innerMode(r.getMode(),r.getTokenAt(n).state).mode;r.operation((function(){if(e)r.replaceRange(i.commentEnd,o),r.replaceRange(i.commentStart,n),n.line==o.line&&n.ch==o.ch&&r.setCursor(n.line,n.ch+i.commentStart.length);else{var t=r.getRange(n,o),a=t.indexOf(i.commentStart),s=t.lastIndexOf(i.commentEnd);a>-1&&s>-1&&s>a&&(t=t.substr(0,a)+t.substring(a+i.commentStart.length,s)+t.substr(s+i.commentEnd.length)),r.replaceRange(t,n,o)}}))})),t.defineExtension("autoIndentRange",(function(t,e){var n=this;this.operation((function(){for(var o=t.line;o<=e.line;o++)n.indentLine(o,"smart")}))})),t.defineExtension("autoFormatRange",(function(e,n){var o=this,r=o.getMode(),i=o.getRange(e,n).split("\n"),a=t.copyState(r,o.getTokenAt(e).state),s=o.getOption("tabSize"),l="",c=0,u=0===e.ch;function p(){l+="\n",u=!0,++c}for(var d=0;d<i.length;++d){for(var f=new t.StringStream(i[d],s);!f.eol();){var h=t.innerMode(r,a),v=r.token(f,a),g=f.current();f.start=f.pos,u&&!/\S/.test(g)||(l+=g,u=!1),!u&&h.mode.newlineAfterToken&&h.mode.newlineAfterToken(v,g,f.string.slice(f.pos)||i[d+1]||"",h.state)&&p()}!f.pos&&r.blankLine&&r.blankLine(a),!u&&d<i.length-1&&p()}o.operation((function(){o.replaceRange(l,e,n);for(var t=e.line+1,r=e.line+c;t<=r;++t)o.indentLine(t,"smart");o.setSelection(e,o.getCursor(!1))}))}))}(n(4408))},4408:function(t){1&&(t.exports=function(){'use strict';var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),o=/MSIE \d/.test(t),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),i=/Edge\/(\d+)/.exec(t),a=o||r||i,s=a&&(o?document.documentMode||6:+(i||r)[1]),l=!i&&/WebKit\//.test(t),c=l&&/Qt\/\d+\.\d+/.test(t),u=!i&&/Chrome\//.test(t),p=/Opera\//.test(t),d=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),h=/PhantomJS/.test(t),v=d&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),g=/Android/.test(t),y=v||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),m=v||/Mac/.test(e),b=/\bCrOS\b/.test(t),_=/win/i.test(e),w=p&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(p=!1,l=!0);var C=m&&(c||p&&(null==w||w<12.11)),x=n||a&&s>=9;function S(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var O,T=function(t,e){var n=t.className,o=S(e).exec(n);if(o){var r=n.slice(o.index+o[0].length);t.className=n.slice(0,o.index)+(r?o[1]+r:"")}};function P(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function E(t,e){return P(t).appendChild(e)}function k(t,e,n,o){var r=document.createElement(t);if(n&&(r.className=n),o&&(r.style.cssText=o),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var i=0;i<e.length;++i)r.appendChild(e[i]);return r}function A(t,e,n,o){var r=k(t,e,n,o);return r.setAttribute("role","presentation"),r}function j(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 M(){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 D(t,e){var n=t.className;S(e).test(n)||(t.className+=(n?" ":"")+e)}function L(t,e){for(var n=t.split(" "),o=0;o<n.length;o++)n[o]&&!S(n[o]).test(e)&&(e+=" "+n[o]);return e}O=document.createRange?function(t,e,n,o){var r=document.createRange();return r.setEnd(o||t,n),r.setStart(t,e),r}:function(t,e,n){var o=document.body.createTextRange();try{o.moveToElementText(t.parentNode)}catch(t){return o}return o.collapse(!0),o.moveEnd("character",n),o.moveStart("character",e),o};var I=function(t){t.select()};function N(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function R(t,e,n){for(var o in e||(e={}),t)!t.hasOwnProperty(o)||!1===n&&e.hasOwnProperty(o)||(e[o]=t[o]);return e}function V(t,e,n,o,r){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var i=o||0,a=r||0;;){var s=t.indexOf("\t",i);if(s<0||s>=e)return a+(e-i);a+=s-i,a+=n-a%n,i=s+1}}v?I=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:a&&(I=function(t){try{t.select()}catch(t){}});var F=function(){this.id=null,this.f=null,this.time=0,this.handler=N(this.onTimeout,this)};function H(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}F.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},F.prototype.set=function(t,e){this.f=e;var n=+new Date+t;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=n)};var U=50,B={toString:function(){return"CodeMirror.Pass"}},z={scroll:!1},W={origin:"*mouse"},$={origin:"+move"};function q(t,e,n){for(var o=0,r=0;;){var i=t.indexOf("\t",o);-1==i&&(i=t.length);var a=i-o;if(i==t.length||r+a>=e)return o+Math.min(a,e-r);if(r+=i-o,o=i+1,(r+=n-r%n)>=e)return o}}var G=[""];function K(t){for(;G.length<=t;)G.push(Y(G)+" ");return G[t]}function Y(t){return t[t.length-1]}function J(t,e){for(var n=[],o=0;o<t.length;o++)n[o]=e(t[o],o);return n}function X(t,e,n){for(var o=0,r=n(e);o<t.length&&n(t[o])<=r;)o++;t.splice(o,0,e)}function Z(){}function Q(t,e){var n;return Object.create?n=Object.create(t):(Z.prototype=t,n=new Z),e&&R(e,n),n}var tt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function et(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||tt.test(t))}function nt(t,e){return e?!!(e.source.indexOf("\\w")>-1&&et(t))||e.test(t):et(t)}function ot(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var rt=/[\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]/;function it(t){return t.charCodeAt(0)>=768&&rt.test(t)}function at(t,e,n){for(;(n<0?e>0:e<t.length)&&it(t.charAt(e));)e+=n;return e}function st(t,e,n){for(var o=e>n?-1:1;;){if(e==n)return e;var r=(e+n)/2,i=o<0?Math.ceil(r):Math.floor(r);if(i==e)return t(i)?e:n;t(i)?n=i:e=i+o}}function lt(t,e,n,o){if(!t)return o(e,n,"ltr",0);for(var r=!1,i=0;i<t.length;++i){var a=t[i];(a.from<n&&a.to>e||e==n&&a.to==e)&&(o(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",i),r=!0)}r||o(e,n,"ltr")}var ct=null;function ut(t,e,n){var o;ct=null;for(var r=0;r<t.length;++r){var i=t[r];if(i.from<e&&i.to>e)return r;i.to==e&&(i.from!=i.to&&"before"==n?o=r:ct=r),i.from==e&&(i.from!=i.to&&"before"!=n?o=r:ct=r)}return null!=o?o:ct}var pt=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?t.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?e.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var o=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,i=/[LRr]/,a=/[Lb1n]/,s=/[1n]/;function l(t,e,n){this.level=t,this.from=e,this.to=n}return function(t,e){var c="ltr"==e?"L":"R";if(0==t.length||"ltr"==e&&!o.test(t))return!1;for(var u=t.length,p=[],d=0;d<u;++d)p.push(n(t.charCodeAt(d)));for(var f=0,h=c;f<u;++f){var v=p[f];"m"==v?p[f]=h:h=v}for(var g=0,y=c;g<u;++g){var m=p[g];"1"==m&&"r"==y?p[g]="n":i.test(m)&&(y=m,"r"==m&&(p[g]="R"))}for(var b=1,_=p[0];b<u-1;++b){var w=p[b];"+"==w&&"1"==_&&"1"==p[b+1]?p[b]="1":","!=w||_!=p[b+1]||"1"!=_&&"n"!=_||(p[b]=_),_=w}for(var C=0;C<u;++C){var x=p[C];if(","==x)p[C]="N";else if("%"==x){var S=void 0;for(S=C+1;S<u&&"%"==p[S];++S);for(var O=C&&"!"==p[C-1]||S<u&&"1"==p[S]?"1":"N",T=C;T<S;++T)p[T]=O;C=S-1}}for(var P=0,E=c;P<u;++P){var k=p[P];"L"==E&&"1"==k?p[P]="L":i.test(k)&&(E=k)}for(var A=0;A<u;++A)if(r.test(p[A])){var j=void 0;for(j=A+1;j<u&&r.test(p[j]);++j);for(var M="L"==(A?p[A-1]:c),D=M==("L"==(j<u?p[j]:c))?M?"L":"R":c,L=A;L<j;++L)p[L]=D;A=j-1}for(var I,N=[],R=0;R<u;)if(a.test(p[R])){var V=R;for(++R;R<u&&a.test(p[R]);++R);N.push(new l(0,V,R))}else{var F=R,H=N.length,U="rtl"==e?1:0;for(++R;R<u&&"L"!=p[R];++R);for(var B=F;B<R;)if(s.test(p[B])){F<B&&(N.splice(H,0,new l(1,F,B)),H+=U);var z=B;for(++B;B<R&&s.test(p[B]);++B);N.splice(H,0,new l(2,z,B)),H+=U,F=B}else++B;F<R&&N.splice(H,0,new l(1,F,R))}return"ltr"==e&&(1==N[0].level&&(I=t.match(/^\s+/))&&(N[0].from=I[0].length,N.unshift(new l(0,0,I[0].length))),1==Y(N).level&&(I=t.match(/\s+$/))&&(Y(N).to-=I[0].length,N.push(new l(0,u-I[0].length,u)))),"rtl"==e?N.reverse():N}}();function dt(t,e){var n=t.order;return null==n&&(n=t.order=pt(t.text,e)),n}var ft=[],ht=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var o=t._handlers||(t._handlers={});o[e]=(o[e]||ft).concat(n)}};function vt(t,e){return t._handlers&&t._handlers[e]||ft}function gt(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var o=t._handlers,r=o&&o[e];if(r){var i=H(r,n);i>-1&&(o[e]=r.slice(0,i).concat(r.slice(i+1)))}}}function yt(t,e){var n=vt(t,e);if(n.length)for(var o=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,o)}function mt(t,e,n){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),yt(t,n||e.type,t,e),St(e)||e.codemirrorIgnore}function bt(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),o=0;o<e.length;++o)-1==H(n,e[o])&&n.push(e[o])}function _t(t,e){return vt(t,e).length>0}function wt(t){t.prototype.on=function(t,e){ht(this,t,e)},t.prototype.off=function(t,e){gt(this,t,e)}}function Ct(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function xt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function St(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Ot(t){Ct(t),xt(t)}function Tt(t){return t.target||t.srcElement}function Pt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),m&&t.ctrlKey&&1==e&&(e=3),e}var Et,kt,At=function(){if(a&&s<9)return!1;var t=k('div');return"draggable"in t||"dragDrop"in t}();function jt(t){if(null==Et){var e=k("span","​");E(t,k("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Et=e.offsetWidth<=1&&e.offsetHeight>2&&!(a&&s<8))}var n=Et?k("span","​"):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Mt(t){if(null!=kt)return kt;var e=E(t,document.createTextNode("AخA")),n=O(e,0,1).getBoundingClientRect(),o=O(e,1,2).getBoundingClientRect();return P(t),!(!n||n.left==n.right)&&(kt=o.right-n.right<3)}var Dt,Lt=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],o=t.length;e<=o;){var r=t.indexOf("\n",e);-1==r&&(r=t.length);var i=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),a=i.indexOf("\r");-1!=a?(n.push(i.slice(0,a)),e+=a+1):(n.push(i),e=r+1)}return n}:function(t){return t.split(/\r\n?|\n/)},It=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Nt="oncopy"in(Dt=k("div"))||(Dt.setAttribute("oncopy","return;"),"function"==typeof Dt.oncopy),Rt=null;function Vt(t){if(null!=Rt)return Rt;var e=E(t,k("span","x")),n=e.getBoundingClientRect(),o=O(e,0,1).getBoundingClientRect();return Rt=Math.abs(n.left-o.left)>1}var Ft={},Ht={};function Ut(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Ft[t]=e}function Bt(t,e){Ht[t]=e}function zt(t){if("string"==typeof t&&Ht.hasOwnProperty(t))t=Ht[t];else if(t&&"string"==typeof t.name&&Ht.hasOwnProperty(t.name)){var e=Ht[t.name];"string"==typeof e&&(e={name:e}),(t=Q(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return zt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return zt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Wt(t,e){e=zt(e);var n=Ft[e.name];if(!n)return Wt(t,"text/plain");var o=n(t,e);if($t.hasOwnProperty(e.name)){var r=$t[e.name];for(var i in r)r.hasOwnProperty(i)&&(o.hasOwnProperty(i)&&(o["_"+i]=o[i]),o[i]=r[i])}if(o.name=e.name,e.helperType&&(o.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)o[a]=e.modeProps[a];return o}var $t={};function qt(t,e){R(e,$t.hasOwnProperty(t)?$t[t]:$t[t]={})}function Gt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var o in e){var r=e[o];r instanceof Array&&(r=r.concat([])),n[o]=r}return n}function Kt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Yt(t,e,n){return!t.startState||t.startState(e,n)}var Jt=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};function Xt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var o=0;;++o){var r=n.children[o],i=r.chunkSize();if(e<i){n=r;break}e-=i}return n.lines[e]}function Zt(t,e,n){var o=[],r=e.line;return t.iter(e.line,n.line+1,(function(t){var i=t.text;r==n.line&&(i=i.slice(0,n.ch)),r==e.line&&(i=i.slice(e.ch)),o.push(i),++r})),o}function Qt(t,e,n){var o=[];return t.iter(e,n,(function(t){o.push(t.text)})),o}function te(t,e){var n=e-t.height;if(n)for(var o=t;o;o=o.parent)o.height+=n}function ee(t){if(null==t.parent)return null;for(var e=t.parent,n=H(e.lines,t),o=e.parent;o;e=o,o=o.parent)for(var r=0;o.children[r]!=e;++r)n+=o.children[r].chunkSize();return n+e.first}function ne(t,e){var n=t.first;t:do{for(var o=0;o<t.children.length;++o){var r=t.children[o],i=r.height;if(e<i){t=r;continue t}e-=i,n+=r.chunkSize()}return n}while(!t.lines);for(var a=0;a<t.lines.length;++a){var s=t.lines[a].height;if(e<s)break;e-=s}return n+a}function oe(t,e){return e>=t.first&&e<t.first+t.size}function re(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function ie(t,e,n){if(void 0===n&&(n=null),!(this instanceof ie))return new ie(t,e,n);this.line=t,this.ch=e,this.sticky=n}function ae(t,e){return t.line-e.line||t.ch-e.ch}function se(t,e){return t.sticky==e.sticky&&0==ae(t,e)}function le(t){return ie(t.line,t.ch)}function ce(t,e){return ae(t,e)<0?e:t}function ue(t,e){return ae(t,e)<0?t:e}function pe(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function de(t,e){if(e.line<t.first)return ie(t.first,0);var n=t.first+t.size-1;return e.line>n?ie(n,Xt(t,n).text.length):fe(e,Xt(t,e.line).text.length)}function fe(t,e){var n=t.ch;return null==n||n>e?ie(t.line,e):n<0?ie(t.line,0):t}function he(t,e){for(var n=[],o=0;o<e.length;o++)n[o]=de(t,e[o]);return n}Jt.prototype.eol=function(){return this.pos>=this.string.length},Jt.prototype.sol=function(){return this.pos==this.lineStart},Jt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Jt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Jt.prototype.eat=function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},Jt.prototype.eatWhile=function(t){for(var e=this.pos;this.eat(t););return this.pos>e},Jt.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Jt.prototype.skipToEnd=function(){this.pos=this.string.length},Jt.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Jt.prototype.backUp=function(t){this.pos-=t},Jt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=V(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Jt.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Jt.prototype.match=function(t,e,n){if("string"!=typeof t){var o=this.string.slice(this.pos).match(t);return o&&o.index>0?null:(o&&!1!==e&&(this.pos+=o[0].length),o)}var r=function(t){return n?t.toLowerCase():t};if(r(this.string.substr(this.pos,t.length))==r(t))return!1!==e&&(this.pos+=t.length),!0},Jt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Jt.prototype.hideFirstChars=function(t