Free and Open source Web Builder Framework. Next generation tool for building templates without coding
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32427 lines
1.2 MiB

/*! grapesjs - 0.14.21 */
!(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());
})(window, function () {
return (function (t) {
var e = {};
function n(i) {
if (e[i]) return e[i].exports;
var r = (e[i] = { i: i, l: !1, exports: {} });
return t[i].call(r.exports, r, r.exports, n), (r.l = !0), r.exports;
}
return (
(n.m = t),
(n.c = e),
(n.d = function (t, e, i) {
n.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: i });
}),
(n.r = function (t) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(t, '__esModule', { value: !0 });
}),
(n.t = function (t, e) {
if ((1 & e && (t = n(t)), 8 & e)) return t;
if (4 & e && 'object' == typeof t && t && t.__esModule) return t;
var i = Object.create(null);
if ((n.r(i), Object.defineProperty(i, 'default', { enumerable: !0, value: t }), 2 & e && 'string' != typeof t))
for (var r in t)
n.d(
i,
r,
function (e) {
return t[e];
}.bind(null, r),
);
return i;
}),
(n.n = function (t) {
var e =
t && t.__esModule
? function () {
return t.default;
}
: function () {
return t;
};
return n.d(e, 'a', e), e;
}),
(n.o = function (t, e) {
return Object.prototype.hasOwnProperty.call(t, e);
}),
(n.p = ''),
n((n.s = 235))
);
})([
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(20), e]),
void 0 ===
(o = function (t, e, n) {
a.Backbone = (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) {
n.each(e, function (e, r) {
n[r] &&
(t.prototype[r] = (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], a(t, this), r);
};
case 4:
return function (t, r, o) {
return n[e](this[i], a(t, this), r, o);
};
default:
return function () {
var t = o.call(arguments);
return t.unshift(this[i]), n[e].apply(n, t);
};
}
})(e, r, i));
});
},
a = function (t, e) {
return n.isFunction(t)
? t
: n.isObject(t) && !e._isModel(t)
? l(t)
: n.isString(t)
? function (e) {
return e.get(t);
}
: t;
},
l = function (t) {
var e = n.matches(t);
return function (t) {
return e(t.attributes);
};
},
c = (e.Events = {}),
u = /\s+/,
h = 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 = h(t, e, s[a], i[s[a]], o);
} else if (i && u.test(i)) for (s = i.split(u); a < s.length; a++) e = t(e, s[a], r, o);
else e = t(e, i, r, o);
return e;
};
c.on = function (t, e, n) {
return d(this, t, e, n);
};
var d = function (t, e, n, i, r) {
if (((t._events = h(f, t._events || {}, e, n, { context: i, ctx: t, listening: r })), r)) {
var o = t._listeners || (t._listeners = {});
o[r.id] = r;
}
return t;
};
c.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 d(t, e, i, this, s), this;
};
var f = 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;
};
(c.off = function (t, e, n) {
return this._events
? ((this._events = h(p, this._events, t, e, { context: n, listeners: this._listeners })), this)
: this;
}),
(c.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 p = 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) && 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];
}
};
(c.once = function (t, e, i) {
var r = h(g, {}, t, e, n.bind(this.off, this));
return 'string' == typeof t && null == i && (e = void 0), this.on(r, e, i);
}),
(c.listenToOnce = function (t, e, i) {
var r = h(g, {}, e, i, n.bind(this.stopListening, this, t));
return this.listenTo(t, r);
});
var g = 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;
};
c.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 h(v, this._events, t, void 0, n), this;
};
var v = function (t, e, n, i) {
if (t) {
var r = t[e],
o = t.all;
r && o && (o = o.slice()), r && m(r, i), o && m(o, [e].concat(i));
}
return t;
},
m = 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;
}
};
(c.bind = c.on), (c.unbind = c.off), n.extend(e, c);
var y = (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(y.prototype, c, {
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) {
var e = this,
i = (t = n.extend({ parse: !0 }, t)).success;
return (
(t.success = function (n) {
var r = t.parse ? e.parse(n, t) : n;
if (!e.set(r, t)) return !1;
i && i.call(t.context, e, n, t), e.trigger('sync', e, n, t);
}),
R(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);
var o = (i = n.extend({ validate: !0, parse: !0 }, 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;
if ((o && (e = n.extend({}, r, e)), e && !s.set(e, i))) return !1;
a && a.call(i.context, s, t, i), s.trigger('sync', s, t, i);
}),
R(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) {
var e = this,
i = (t = t ? n.clone(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) : (R(this, t), (s = this.sync('delete', this, t))),
r || o(),
s
);
},
url: function () {
var t = n.result(this, 'urlRoot') || n.result(this.collection, 'url') || F();
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);
},
}),
s(
y,
{ keys: 1, values: 1, pairs: 1, invert: 1, pick: 0, omit: 0, chain: 1, isEmpty: 1 },
'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 },
C = 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(b.prototype, c, {
model: y,
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] : 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({}, x, 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 && !1 !== e.sort,
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)) &&
(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 w = !1,
k = !v && d && p;
if (
(a.length && k
? ((w =
this.length !== a.length ||
n.some(this.models, function (t, e) {
return t !== a[e];
})),
(this.models.length = 0),
C(this.models, a, 0),
(this.length = this.models.length))
: l.length &&
(v && (g = !0),
C(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]).trigger('add', o, this, e);
(g || w) && 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) {
var e = (t = n.extend({ parse: !0 }, 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);
}),
R(this, t),
this.sync('read', this, t)
);
},
create: function (t, e) {
var i = (e = e ? n.clone(e) : {}).wait;
if (!(t = this._prepareModel(t, e))) 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) : {}).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 y;
},
_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);
},
}),
s(
b,
{
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,
},
'models',
);
var k = (e.View = function (t) {
(this.cid = n.uniqueId('view')),
n.extend(this, n.pick(t, T)),
this._ensureElement(),
this.initialize.apply(this, arguments);
}),
S = /^(\S+)\s*(.*)$/,
T = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
n.extend(k.prototype, c, {
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;
for (var e in (this.undelegateEvents(), t)) {
var i = t[e];
if ((n.isFunction(i) || (i = this[i]), i)) {
var r = e.match(S);
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 = E[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') || F()),
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 E = { create: 'POST', update: 'PUT', patch: 'PATCH', delete: 'DELETE', read: 'GET' };
e.ajax = function () {
return e.$.ajax.apply(e.$, arguments);
};
var M = (e.Router = function (t) {
t || (t = {}),
t.routes && (this.routes = t.routes),
this._bindRoutes(),
this.initialize.apply(this, arguments);
}),
A = /\((.*?)\)/g,
O = /(\(\?)?:\w+/g,
P = /\*\w+/g,
_ = /[\-{}\[\]+?.,\\\^$|#\s]/g;
n.extend(M.prototype, c, {
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);
!1 !== o.execute(r, s, i) &&
(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(_, '\\$&')
.replace(A, '(?:$1)?')
.replace(O, function (t, e) {
return e ? t : '([^/?]+)';
})
.replace(P, '([^?]*?)')),
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 L = (e.History = function () {
(this.handlers = []),
(this.checkUrl = n.bind(this.checkUrl, this)),
'undefined' != typeof window &&
((this.location = window.location), (this.history = window.history));
}),
N = /^[#\/]|\s+$/g,
D = /^\/+|\/+$/g,
I = /#.*$/;
(L.started = !1),
n.extend(L.prototype, c, {
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(N, '')
);
},
start: function (t) {
if (L.started) throw new Error('Backbone.history has already been started');
if (
((L.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(D, '/')),
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),
(L.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 (!L.started) return !1;
(e && !0 !== e) || (e = { trigger: !!e }), (t = this.getFragment(t || ''));
var n = this.root;
('' !== t && '?' !== t.charAt(0)) || (n = n.slice(0, -1) || '/');
var i = n + t;
if (((t = this.decodeFragment(t.replace(I, ''))), 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 L());
y.extend =
b.extend =
M.extend =
k.extend =
L.extend =
function (t, e) {
var i,
r = this;
i =
t && n.has(t, 'constructor')
? t.constructor
: function () {
return r.apply(this, arguments);
};
return (
n.extend(i, r, e),
(i.prototype = n.create(r.prototype, t)),
(i.prototype.constructor = i),
(i.__super__ = r.prototype),
i
);
};
var F = function () {
throw new Error('A "url" property or function must be specified');
},
R = function (t, e) {
var n = e.error;
e.error = function (i) {
n && n.call(e.context, t, i, e), t.trigger('error', t, i, e);
};
};
return e;
})(a, n, t, e);
}.apply(e, r)) || (t.exports = o);
})();
}).call(this, n(11));
},
function (t, e, n) {
(function (t, n) {
var i;
!(function () {
var r =
('object' == typeof self && self.self === self && self) ||
('object' == typeof t && t.global === t && t) ||
this ||
{},
o = r._,
s = Array.prototype,
a = Object.prototype,
l = 'undefined' != typeof Symbol ? Symbol.prototype : null,
c = s.push,
u = s.slice,
h = a.toString,
d = a.hasOwnProperty,
f = Array.isArray,
p = Object.keys,
g = Object.create,
v = function () {},
m = function (t) {
return t instanceof m ? t : this instanceof m ? void (this._wrapped = t) : new m(t);
};
void 0 === e || e.nodeType
? (r._ = m)
: (void 0 !== n && !n.nodeType && n.exports && (e = n.exports = m), (e._ = m)),
(m.VERSION = '1.9.0');
var y,
b = 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 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);
};
},
x = function (t, e, n) {
return m.iteratee !== y
? m.iteratee(t, e)
: null == t
? m.identity
: m.isFunction(t)
? b(t, e, n)
: m.isObject(t) && !m.isArray(t)
? m.matcher(t)
: m.property(t);
};
m.iteratee = y = function (t, e) {
return x(t, e, 1 / 0);
};
var w = function (t, e) {
return (
(e = null == e ? t.length - 1 : +e),
function () {
for (var n = Math.max(arguments.length - e, 0), i = Array(n), r = 0; r < n; r++)
i[r] = arguments[r + e];
switch (e) {
case 0:
return t.call(this, i);
case 1:
return t.call(this, arguments[0], i);
case 2:
return t.call(this, arguments[0], arguments[1], i);
}
var o = Array(e + 1);
for (r = 0; r < e; r++) o[r] = arguments[r];
return (o[e] = i), t.apply(this, o);
}
);
},
C = function (t) {
if (!m.isObject(t)) return {};
if (g) return g(t);
v.prototype = t;
var e = new v();
return (v.prototype = null), e;
},
k = function (t) {
return function (e) {
return null == e ? void 0 : e[t];
};
},
S = function (t, e) {
for (var n = e.length, i = 0; i < n; i++) {
if (null == t) return;
t = t[e[i]];
}
return n ? t : void 0;
},
T = Math.pow(2, 53) - 1,
E = k('length'),
M = function (t) {
var e = E(t);
return 'number' == typeof e && e >= 0 && e <= T;
};
(m.each = m.forEach =
function (t, e, n) {
var i, r;
if (((e = b(e, n)), M(t))) for (i = 0, r = t.length; i < r; i++) e(t[i], i, t);
else {
var o = m.keys(t);
for (i = 0, r = o.length; i < r; i++) e(t[o[i]], o[i], t);
}
return t;
}),
(m.map = m.collect =
function (t, e, n) {
e = x(e, n);
for (var i = !M(t) && m.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;
});
var A = function (t) {
return function (e, n, i, r) {
var o = arguments.length >= 3;
return (function (e, n, i, r) {
var o = !M(e) && m.keys(e),
s = (o || e).length,
a = t > 0 ? 0 : s - 1;
for (r || ((i = e[o ? o[a] : a]), (a += t)); a >= 0 && a < s; a += t) {
var l = o ? o[a] : a;
i = n(i, e[l], l, e);
}
return i;
})(e, b(n, r, 4), i, o);
};
};
(m.reduce = m.foldl = m.inject = A(1)),
(m.reduceRight = m.foldr = A(-1)),
(m.find = m.detect =
function (t, e, n) {
var i = (M(t) ? m.findIndex : m.findKey)(t, e, n);
if (void 0 !== i && -1 !== i) return t[i];
}),
(m.filter = m.select =
function (t, e, n) {
var i = [];
return (
(e = x(e, n)),
m.each(t, function (t, n, r) {
e(t, n, r) && i.push(t);
}),
i
);
}),
(m.reject = function (t, e, n) {
return m.filter(t, m.negate(x(e)), n);
}),
(m.every = m.all =
function (t, e, n) {
e = x(e, n);
for (var i = !M(t) && m.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;
}),
(m.some = m.any =
function (t, e, n) {
e = x(e, n);
for (var i = !M(t) && m.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;
}),
(m.contains =
m.includes =
m.include =
function (t, e, n, i) {
return M(t) || (t = m.values(t)), ('number' != typeof n || i) && (n = 0), m.indexOf(t, e, n) >= 0;
}),
(m.invoke = w(function (t, e, n) {
var i, r;
return (
m.isFunction(e) ? (r = e) : m.isArray(e) && ((i = e.slice(0, -1)), (e = e[e.length - 1])),
m.map(t, function (t) {
var o = r;
if (!o) {
if ((i && i.length && (t = S(t, i)), null == t)) return;
o = t[e];
}
return null == o ? o : o.apply(t, n);
})
);
})),
(m.pluck = function (t, e) {
return m.map(t, m.property(e));
}),
(m.where = function (t, e) {
return m.filter(t, m.matcher(e));
}),
(m.findWhere = function (t, e) {
return m.find(t, m.matcher(e));
}),
(m.max = function (t, e, n) {
var i,
r,
o = -1 / 0,
s = -1 / 0;
if (null == e || ('number' == typeof e && 'object' != typeof t[0] && null != t))
for (var a = 0, l = (t = M(t) ? t : m.values(t)).length; a < l; a++)
null != (i = t[a]) && i > o && (o = i);
else
(e = x(e, n)),
m.each(t, function (t, n, i) {
((r = e(t, n, i)) > s || (r === -1 / 0 && o === -1 / 0)) && ((o = t), (s = r));
});
return o;
}),
(m.min = function (t, e, n) {
var i,
r,
o = 1 / 0,
s = 1 / 0;
if (null == e || ('number' == typeof e && 'object' != typeof t[0] && null != t))
for (var a = 0, l = (t = M(t) ? t : m.values(t)).length; a < l; a++)
null != (i = t[a]) && i < o && (o = i);
else
(e = x(e, n)),
m.each(t, function (t, n, i) {
((r = e(t, n, i)) < s || (r === 1 / 0 && o === 1 / 0)) && ((o = t), (s = r));
});
return o;
}),
(m.shuffle = function (t) {
return m.sample(t, 1 / 0);
}),
(m.sample = function (t, e, n) {
if (null == e || n) return M(t) || (t = m.values(t)), t[m.random(t.length - 1)];
var i = M(t) ? m.clone(t) : m.values(t),
r = E(i);
e = Math.max(Math.min(e, r), 0);
for (var o = r - 1, s = 0; s < e; s++) {
var a = m.random(s, o),
l = i[s];
(i[s] = i[a]), (i[a] = l);
}
return i.slice(0, e);
}),
(m.sortBy = function (t, e, n) {
var i = 0;
return (
(e = x(e, n)),
m.pluck(
m
.map(t, function (t, n, r) {
return { value: t, index: i++, criteria: e(t, n, r) };
})
.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 O = function (t, e) {
return function (n, i, r) {
var o = e ? [[], []] : {};
return (
(i = x(i, r)),
m.each(n, function (e, r) {
var s = i(e, r, n);
t(o, e, s);
}),
o
);
};
};
(m.groupBy = O(function (t, e, n) {
m.has(t, n) ? t[n].push(e) : (t[n] = [e]);
})),
(m.indexBy = O(function (t, e, n) {
t[n] = e;
})),
(m.countBy = O(function (t, e, n) {
m.has(t, n) ? t[n]++ : (t[n] = 1);
}));
var P = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
(m.toArray = function (t) {
return t
? m.isArray(t)
? u.call(t)
: m.isString(t)
? t.match(P)
: M(t)
? m.map(t, m.identity)
: m.values(t)
: [];
}),
(m.size = function (t) {
return null == t ? 0 : M(t) ? t.length : m.keys(t).length;
}),
(m.partition = O(function (t, e, n) {
t[n ? 0 : 1].push(e);
}, !0)),
(m.first =
m.head =
m.take =
function (t, e, n) {
if (!(null == t || t.length < 1)) return null == e || n ? t[0] : m.initial(t, t.length - e);
}),
(m.initial = function (t, e, n) {
return u.call(t, 0, Math.max(0, t.length - (null == e || n ? 1 : e)));
}),
(m.last = function (t, e, n) {
if (!(null == t || t.length < 1))
return null == e || n ? t[t.length - 1] : m.rest(t, Math.max(0, t.length - e));
}),
(m.rest =
m.tail =
m.drop =
function (t, e, n) {
return u.call(t, null == e || n ? 1 : e);
}),
(m.compact = function (t) {
return m.filter(t, Boolean);
});
var _ = function (t, e, n, i) {
for (var r = (i = i || []).length, o = 0, s = E(t); o < s; o++) {
var a = t[o];
if (M(a) && (m.isArray(a) || m.isArguments(a)))
if (e) for (var l = 0, c = a.length; l < c; ) i[r++] = a[l++];
else _(a, e, n, i), (r = i.length);
else n || (i[r++] = a);
}
return i;
};
(m.flatten = function (t, e) {
return _(t, e, !1);
}),
(m.without = w(function (t, e) {
return m.difference(t, e);
})),
(m.uniq = m.unique =
function (t, e, n, i) {
m.isBoolean(e) || ((i = n), (n = e), (e = !1)), null != n && (n = x(n, i));
for (var r = [], o = [], s = 0, a = E(t); s < a; s++) {
var l = t[s],
c = n ? n(l, s, t) : l;
e && !n
? ((s && o === c) || r.push(l), (o = c))
: n
? m.contains(o, c) || (o.push(c), r.push(l))
: m.contains(r, l) || r.push(l);
}
return r;
}),
(m.union = w(function (t) {
return m.uniq(_(t, !0, !0));
})),
(m.intersection = function (t) {
for (var e = [], n = arguments.length, i = 0, r = E(t); i < r; i++) {
var o = t[i];
if (!m.contains(e, o)) {
var s;
for (s = 1; s < n && m.contains(arguments[s], o); s++);
s === n && e.push(o);
}
}
return e;
}),
(m.difference = w(function (t, e) {
return (
(e = _(e, !0, !0)),
m.filter(t, function (t) {
return !m.contains(e, t);
})
);
})),
(m.unzip = function (t) {
for (var e = (t && m.max(t, E).length) || 0, n = Array(e), i = 0; i < e; i++) n[i] = m.pluck(t, i);
return n;
}),
(m.zip = w(m.unzip)),
(m.object = function (t, e) {
for (var n = {}, i = 0, r = E(t); i < r; i++) e ? (n[t[i]] = e[i]) : (n[t[i][0]] = t[i][1]);
return n;
});
var L = function (t) {
return function (e, n, i) {
n = x(n, i);
for (var r = E(e), o = t > 0 ? 0 : r - 1; o >= 0 && o < r; o += t) if (n(e[o], o, e)) return o;
return -1;
};
};
(m.findIndex = L(1)),
(m.findLastIndex = L(-1)),
(m.sortedIndex = function (t, e, n, i) {
for (var r = (n = x(n, i, 1))(e), o = 0, s = E(t); o < s; ) {
var a = Math.floor((o + s) / 2);
n(t[a]) < r ? (o = a + 1) : (s = a);
}
return o;
});
var N = function (t, e, n) {
return function (i, r, o) {
var s = 0,
a = E(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 i[(o = n(i, r))] === r ? o : -1;
if (r != r) return (o = e(u.call(i, s, a), m.isNaN)) >= 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;
};
};
(m.indexOf = N(1, m.findIndex, m.sortedIndex)),
(m.lastIndexOf = N(-1, m.findLastIndex)),
(m.range = function (t, e, n) {
null == e && ((e = t || 0), (t = 0)), n || (n = e < t ? -1 : 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;
}),
(m.chunk = function (t, e) {
if (null == e || e < 1) return [];
for (var n = [], i = 0, r = t.length; i < r; ) n.push(u.call(t, i, (i += e)));
return n;
});
var D = function (t, e, n, i, r) {
if (!(i instanceof e)) return t.apply(n, r);
var o = C(t.prototype),
s = t.apply(o, r);
return m.isObject(s) ? s : o;
};
(m.bind = w(function (t, e, n) {
if (!m.isFunction(t)) throw new TypeError('Bind must be called on a function');
var i = w(function (r) {
return D(t, i, e, this, n.concat(r));
});
return i;
})),
(m.partial = w(function (t, e) {
var n = m.partial.placeholder,
i = function () {
for (var r = 0, o = e.length, s = Array(o), a = 0; a < o; a++)
s[a] = e[a] === n ? arguments[r++] : e[a];
for (; r < arguments.length; ) s.push(arguments[r++]);
return D(t, i, this, this, s);
};
return i;
})),
(m.partial.placeholder = m),
(m.bindAll = w(function (t, e) {
var n = (e = _(e, !1, !1)).length;
if (n < 1) throw new Error('bindAll must be passed function names');
for (; n--; ) {
var i = e[n];
t[i] = m.bind(t[i], t);
}
})),
(m.memoize = function (t, e) {
var n = function (i) {
var r = n.cache,
o = '' + (e ? e.apply(this, arguments) : i);
return m.has(r, o) || (r[o] = t.apply(this, arguments)), r[o];
};
return (n.cache = {}), n;
}),
(m.delay = w(function (t, e, n) {
return setTimeout(function () {
return t.apply(null, n);
}, e);
})),
(m.defer = m.partial(m.delay, m, 1)),
(m.throttle = function (t, e, n) {
var i,
r,
o,
s,
a = 0;
n || (n = {});
var l = function () {
(a = !1 === n.leading ? 0 : m.now()), (i = null), (s = t.apply(r, o)), i || (r = o = null);
},
c = function () {
var c = m.now();
a || !1 !== n.leading || (a = c);
var u = e - (c - a);
return (
(r = this),
(o = arguments),
u <= 0 || u > e
? (i && (clearTimeout(i), (i = null)), (a = c), (s = t.apply(r, o)), i || (r = o = null))
: i || !1 === n.trailing || (i = setTimeout(l, u)),
s
);
};
return (
(c.cancel = function () {
clearTimeout(i), (a = 0), (i = r = o = null);
}),
c
);
}),
(m.debounce = function (t, e, n) {
var i,
r,
o = function (e, n) {
(i = null), n && (r = t.apply(e, n));
},
s = w(function (s) {
if ((i && clearTimeout(i), n)) {
var a = !i;
(i = setTimeout(o, e)), a && (r = t.apply(this, s));
} else i = m.delay(o, e, this, s);
return r;
});
return (
(s.cancel = function () {
clearTimeout(i), (i = null);
}),
s
);
}),
(m.wrap = function (t, e) {
return m.partial(e, t);
}),
(m.negate = function (t) {
return function () {
return !t.apply(this, arguments);
};
}),
(m.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;
};
}),
(m.after = function (t, e) {
return function () {
if (--t < 1) return e.apply(this, arguments);
};
}),
(m.before = function (t, e) {
var n;
return function () {
return --t > 0 && (n = e.apply(this, arguments)), t <= 1 && (e = null), n;
};
}),
(m.once = m.partial(m.before, 2)),
(m.restArguments = w);
var I = !{ toString: null }.propertyIsEnumerable('toString'),
F = ['valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'],
R = function (t, e) {
var n = F.length,
i = t.constructor,
r = (m.isFunction(i) && i.prototype) || a,
o = 'constructor';
for (m.has(t, o) && !m.contains(e, o) && e.push(o); n--; )
(o = F[n]) in t && t[o] !== r[o] && !m.contains(e, o) && e.push(o);
};
(m.keys = function (t) {
if (!m.isObject(t)) return [];
if (p) return p(t);
var e = [];
for (var n in t) m.has(t, n) && e.push(n);
return I && R(t, e), e;
}),
(m.allKeys = function (t) {
if (!m.isObject(t)) return [];
var e = [];
for (var n in t) e.push(n);
return I && R(t, e), e;
}),
(m.values = function (t) {
for (var e = m.keys(t), n = e.length, i = Array(n), r = 0; r < n; r++) i[r] = t[e[r]];
return i;
}),
(m.mapObject = function (t, e, n) {
e = x(e, n);
for (var i = m.keys(t), r = i.length, o = {}, s = 0; s < r; s++) {
var a = i[s];
o[a] = e(t[a], a, t);
}
return o;
}),
(m.pairs = function (t) {
for (var e = m.keys(t), n = e.length, i = Array(n), r = 0; r < n; r++) i[r] = [e[r], t[e[r]]];
return i;
}),
(m.invert = function (t) {
for (var e = {}, n = m.keys(t), i = 0, r = n.length; i < r; i++) e[t[n[i]]] = n[i];
return e;
}),
(m.functions = m.methods =
function (t) {
var e = [];
for (var n in t) m.isFunction(t[n]) && e.push(n);
return e.sort();
});
var j = function (t, e) {
return function (n) {
var i = arguments.length;
if ((e && (n = Object(n)), 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;
};
};
(m.extend = j(m.allKeys)),
(m.extendOwn = m.assign = j(m.keys)),
(m.findKey = function (t, e, n) {
e = x(e, n);
for (var i, r = m.keys(t), o = 0, s = r.length; o < s; o++) if (e(t[(i = r[o])], i, t)) return i;
});
var z,
H,
V = function (t, e, n) {
return e in n;
};
(m.pick = w(function (t, e) {
var n = {},
i = e[0];
if (null == t) return n;
m.isFunction(i)
? (e.length > 1 && (i = b(i, e[1])), (e = m.allKeys(t)))
: ((i = V), (e = _(e, !1, !1)), (t = Object(t)));
for (var r = 0, o = e.length; r < o; r++) {
var s = e[r],
a = t[s];
i(a, s, t) && (n[s] = a);
}
return n;
})),
(m.omit = w(function (t, e) {
var n,
i = e[0];
return (
m.isFunction(i)
? ((i = m.negate(i)), e.length > 1 && (n = e[1]))
: ((e = m.map(_(e, !1, !1), String)),
(i = function (t, n) {
return !m.contains(e, n);
})),
m.pick(t, i, n)
);
})),
(m.defaults = j(m.allKeys, !0)),
(m.create = function (t, e) {
var n = C(t);
return e && m.extendOwn(n, e), n;
}),
(m.clone = function (t) {
return m.isObject(t) ? (m.isArray(t) ? t.slice() : m.extend({}, t)) : t;
}),
(m.tap = function (t, e) {
return e(t), t;
}),
(m.isMatch = function (t, e) {
var n = m.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;
}),
(z = function (t, e, n, i) {
if (t === e) return 0 !== t || 1 / t == 1 / e;
if (null == t || null == e) return !1;
if (t != t) return e != e;
var r = typeof t;
return ('function' === r || 'object' === r || 'object' == typeof e) && H(t, e, n, i);
}),
(H = function (t, e, n, i) {
t instanceof m && (t = t._wrapped), e instanceof m && (e = e._wrapped);
var r = h.call(t);
if (r !== h.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;
case '[object Symbol]':
return l.valueOf.call(t) === l.valueOf.call(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 &&
!(m.isFunction(s) && s instanceof s && m.isFunction(a) && a instanceof a) &&
'constructor' in t &&
'constructor' in e
)
return !1;
}
(n = n || []), (i = i || []);
for (var c = n.length; c--; ) if (n[c] === t) return i[c] === e;
if ((n.push(t), i.push(e), o)) {
if ((c = t.length) !== e.length) return !1;
for (; c--; ) if (!z(t[c], e[c], n, i)) return !1;
} else {
var u,
d = m.keys(t);
if (((c = d.length), m.keys(e).length !== c)) return !1;
for (; c--; ) if (((u = d[c]), !m.has(e, u) || !z(t[u], e[u], n, i))) return !1;
}
return n.pop(), i.pop(), !0;
}),
(m.isEqual = function (t, e) {
return z(t, e);
}),
(m.isEmpty = function (t) {
return (
null == t ||
(M(t) && (m.isArray(t) || m.isString(t) || m.isArguments(t)) ? 0 === t.length : 0 === m.keys(t).length)
);
}),
(m.isElement = function (t) {
return !(!t || 1 !== t.nodeType);
}),
(m.isArray =
f ||
function (t) {
return '[object Array]' === h.call(t);
}),
(m.isObject = function (t) {
var e = typeof t;
return 'function' === e || ('object' === e && !!t);
}),
m.each(
[
'Arguments',
'Function',
'String',
'Number',
'Date',
'RegExp',
'Error',
'Symbol',
'Map',
'WeakMap',
'Set',
'WeakSet',
],
function (t) {
m['is' + t] = function (e) {
return h.call(e) === '[object ' + t + ']';
};
},
),
m.isArguments(arguments) ||
(m.isArguments = function (t) {
return m.has(t, 'callee');
});
var $ = r.document && r.document.childNodes;
'function' != typeof /./ &&
'object' != typeof Int8Array &&
'function' != typeof $ &&
(m.isFunction = function (t) {
return 'function' == typeof t || !1;
}),
(m.isFinite = function (t) {
return !m.isSymbol(t) && isFinite(t) && !isNaN(parseFloat(t));
}),
(m.isNaN = function (t) {
return m.isNumber(t) && isNaN(t);
}),
(m.isBoolean = function (t) {
return !0 === t || !1 === t || '[object Boolean]' === h.call(t);
}),
(m.isNull = function (t) {
return null === t;
}),
(m.isUndefined = function (t) {
return void 0 === t;
}),
(m.has = function (t, e) {
if (!m.isArray(e)) return null != t && d.call(t, e);
for (var n = e.length, i = 0; i < n; i++) {
var r = e[i];
if (null == t || !d.call(t, r)) return !1;
t = t[r];
}
return !!n;
}),
(m.noConflict = function () {
return (r._ = o), this;
}),
(m.identity = function (t) {
return t;
}),
(m.constant = function (t) {
return function () {
return t;
};
}),
(m.noop = function () {}),
(m.property = function (t) {
return m.isArray(t)
? function (e) {
return S(e, t);
}
: k(t);
}),
(m.propertyOf = function (t) {
return null == t
? function () {}
: function (e) {
return m.isArray(e) ? S(t, e) : t[e];
};
}),
(m.matcher = m.matches =
function (t) {
return (
(t = m.extendOwn({}, t)),
function (e) {
return m.isMatch(e, t);
}
);
}),
(m.times = function (t, e, n) {
var i = Array(Math.max(0, t));
e = b(e, n, 1);
for (var r = 0; r < t; r++) i[r] = e(r);
return i;
}),
(m.random = function (t, e) {
return null == e && ((e = t), (t = 0)), t + Math.floor(Math.random() * (e - t + 1));
}),
(m.now =
Date.now ||
function () {
return new Date().getTime();
});
var B = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#x27;', '`': '&#x60;' },
W = m.invert(B),
U = function (t) {
var e = function (e) {
return t[e];
},
n = '(?:' + m.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;
};
};
(m.escape = U(B)),
(m.unescape = U(W)),
(m.result = function (t, e, n) {
m.isArray(e) || (e = [e]);
var i = e.length;
if (!i) return m.isFunction(n) ? n.call(t) : n;
for (var r = 0; r < i; r++) {
var o = null == t ? void 0 : t[e[r]];
void 0 === o && ((o = n), (r = i)), (t = m.isFunction(o) ? o.call(t) : o);
}
return t;
});
var q = 0;
(m.uniqueId = function (t) {
var e = ++q + '';
return t ? t + e : e;
}),
(m.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g,
});
var K = /(.)^/,
G = { "'": "'", '\\': '\\', '\r': 'r', '\n': 'n', '\u2028': 'u2028', '\u2029': 'u2029' },
Y = /\\|'|\r|\n|\u2028|\u2029/g,
X = function (t) {
return '\\' + G[t];
};
(m.template = function (t, e, n) {
!e && n && (e = n), (e = m.defaults({}, e, m.templateSettings));
var i,
r = RegExp(
[(e.escape || K).source, (e.interpolate || K).source, (e.evaluate || K).source].join('|') + '|$',
'g',
),
o = 0,
s = "__p+='";
t.replace(r, function (e, n, i, r, a) {
return (
(s += t.slice(o, a).replace(Y, X)),
(o = a + e.length),
n
? (s += "'+\n((__t=(" + n + "))==null?'':_.escape(__t))+\n'")
: i
? (s += "'+\n((__t=(" + i + "))==null?'':__t)+\n'")
: r && (s += "';\n" + r + "\n__p+='"),
e
);
}),
(s += "';\n"),
e.variable || (s = 'with(obj||{}){\n' + s + '}\n'),
(s =
"var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" +
s +
'return __p;\n');
try {
i = new Function(e.variable || 'obj', '_', s);
} catch (t) {
throw ((t.source = s), t);
}
var a = function (t) {
return i.call(this, t, m);
},
l = e.variable || 'obj';
return (a.source = 'function(' + l + '){\n' + s + '}'), a;
}),
(m.chain = function (t) {
var e = m(t);
return (e._chain = !0), e;
});
var J = function (t, e) {
return t._chain ? m(e).chain() : e;
};
(m.mixin = function (t) {
return (
m.each(m.functions(t), function (e) {
var n = (m[e] = t[e]);
m.prototype[e] = function () {
var t = [this._wrapped];
return c.apply(t, arguments), J(this, n.apply(m, t));
};
}),
m
);
}),
m.mixin(m),
m.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function (t) {
var e = s[t];
m.prototype[t] = function () {
var n = this._wrapped;
return (
e.apply(n, arguments), ('shift' !== t && 'splice' !== t) || 0 !== n.length || delete n[0], J(this, n)
);
};
}),
m.each(['concat', 'join', 'slice'], function (t) {
var e = s[t];
m.prototype[t] = function () {
return J(this, e.apply(this._wrapped, arguments));
};
}),
(m.prototype.value = function () {
return this._wrapped;
}),
(m.prototype.valueOf = m.prototype.toJSON = m.prototype.value),
(m.prototype.toString = function () {
return String(this._wrapped);
}),
void 0 ===
(i = function () {
return m;
}.apply(e, [])) || (n.exports = i);
})();
}).call(this, n(11), n(231)(t));
},
function (t, e, n) {
'use strict';
Object.defineProperty(e, '__esModule', { value: !0 }),
(e.getUnitFromValue =
e.normalizeFloat =
e.shallowDiff =
e.getElement =
e.camelCase =
e.getModel =
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) {
return t[0].toUpperCase() + t.toLowerCase().slice(1);
};
(e.on = 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);
}),
(e.off = 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);
}),
(e.hasDnd = function (t) {
return 'draggable' in document.createElement('i') && (t ? t.get('Config').nativeDnD : 1);
}),
(e.upFirst = s),
(e.matches = o),
(e.getModel = function (t, e) {
var n = t;
return (0, i.isElement)(t) && (n = e(t).data('model')), n;
}),
(e.camelCase = function (t) {
var e = t.split('-');
return e[0].toLowerCase() + e.slice(1).map(s);
}),
(e.getElement = function (t) {
return (0, i.isElement)(t) ? t : t && t.getEl ? t.getEl() : void 0;
}),
(e.shallowDiff = 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;
}),
(e.normalizeFloat = 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;
}),
(e.getUnitFromValue = function (t) {
return t.replace(parseFloat(t), '');
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
r = n(1);
var o = n(57);
t.exports = i.default.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, '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:content', this.updateContent),
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();
},
init: function () {},
handleChange: function () {
var t = this.model;
for (var e in (t.emitUpdate(), 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';
this.model.get('state') ? this.$el.addClass(e) : this.$el.removeClass(e);
},
updateStatus: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
e = (this.em, this.el),
n = this.model.get('status'),
i = this.pfx,
r = this.ppfx,
o = i + 'selected',
s = o + '-parent',
a = r + 'freezed',
l = r + 'hovered',
c = [o, s, a, l];
this.$el.removeClass(c.join(' '));
var u = e.getAttribute('class') || '',
h = '';
switch (n) {
case 'selected':
h = u + ' ' + o;
break;
case 'selected-parent':
h = u + ' ' + s;
break;
case 'freezed':
h = u + ' ' + a;
break;
case 'freezed-selected':
h = u + ' ' + a + ' ' + o;
break;
case 'hovered':
h = t.avoidHover ? '' : u + ' ' + l;
}
(h = h.trim()) && e.setAttribute('class', h);
},
updateHighlight: function () {
var t = this.model.get('highlightable');
this.setAttribute('data-highlightable', t ? 1 : '');
},
updateStyle: function () {
var t = this.em,
e = this.model;
if (t && t.get('avoidInlineStyle')) {
this.el.id = e.getId();
var n = e.getStyle();
!(0, r.isEmpty)(n) && e.setStyle(n);
} else 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').class || [];
return (t = (0, r.isArray)(t) ? t : [t]).length ? t.join(' ') : null;
},
updateAttributes: function () {
var t = this.model,
e = { 'data-gjs-type': t.get('type') || 'default' },
n = t.get('attributes'),
i = t.get('src');
for (var r in n) e[r] = n[r];
i && (e.src = i), this.$el.attr(e), this.updateHighlight(), this.updateStyle();
},
updateContent: function () {
this.getChildrenContainer().innerHTML = this.model.get('content');
},
prevDef: function (t) {
t.preventDefault();
},
updateScript: function () {
if (this.model.get('script')) {
var t = this.em;
if (t) t.get('Canvas').getCanvasView().updateScript(this);
}
},
getChildrenContainer: function () {
var t = this.el;
return (
'function' == typeof this.getChildrenSelector
? (t = this.el.querySelector(this.getChildrenSelector()))
: this.getTemplate,
t
);
},
renderChildren: function () {
var t = this.getChildrenContainer(),
e = new o({
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, r = n.length; i < r; i++)
t.appendChild(n.shift());
if (t !== this.el) {
!(function e(n) {
Array.prototype.slice.call(n.children).forEach(function (n) {
(n.style['pointer-events'] = 'none'), t !== n && e(n);
});
})(this.el);
}
},
renderAttributes: function () {
this.updateAttributes(), this.updateClasses();
},
render: function () {
return (
this.renderAttributes(),
this.updateContent(),
this.renderChildren(),
this.updateScript(),
this.onRender(),
this
);
},
onRender: function () {},
});
},
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(2),
s = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(61));
var a = n(0),
l = n(58),
c = n(10),
u = n(19),
h = n(141),
d = {},
f = 0,
p = function (t) {
return t.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
},
g = a.Model.extend(s.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] : {},
o = 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 = i({}, l, e)),
this.set(l);
}
var u = this.get('propagate');
u && this.set('propagate', (0, r.isArray)(u) ? u : [u]),
n && n.config && n.config.voidElements.indexOf(this.get('tagName')) >= 0 && this.set('void', !0),
(n.em = o),
(this.opt = n),
(this.em = o),
(this.config = n.config || {}),
(this.ccid = g.createId(this)),
this.set('attributes', this.get('attributes') || {}),
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', ''),
['classes', 'traits'].forEach(function (e) {
return t.listenTo(t.get(e), 'add remove change', function () {
return t.emitUpdate(e);
});
}),
this.init();
},
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).data('model');
r && e.push(r);
}),
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 });
},
replaceWith: function (t) {
var e = this.collection,
n = e.indexOf(this);
return e.remove(this), e.add(t, { at: n });
},
attrUpdated: function () {
var t = this,
e = i({}, this.previous('attributes')),
n = i({}, this.get('attributes')),
s = (0, o.shallowDiff)(e, n);
(0, r.keys)(s).forEach(function (e) {
return t.trigger('change:attributes:' + e);
});
},
setAttributes: function (t) {
var e = (t = i({}, 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 = i({}, 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').getIdRule(this.getId(), { state: e });
if (((this.rule = n), n)) return n.getStyle();
}
return s.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] : {},
a = this.em;
if (a && a.getConfig('avoidInlineStyle')) {
(e = (0, r.isString)(e) ? this.parseStyle(e) : e), (e = i({}, e, this.get('style')));
var l = this.get('state'),
c = a.get('CssComposer'),
u = this.getStyle();
this.rule = c.setIdRule(this.getId(), e, i({}, n, { state: l }));
var h = (0, o.shallowDiff)(u, e);
this.set('style', {}, { silent: 1 }),
(0, r.keys)(h).forEach(function (e) {
return t.trigger('change:style:' + e);
});
} else e = s.default.setStyle.apply(this, arguments);
return e;
},
getAttributes: function () {
var t = this.em,
e = [],
n = i({}, this.get('attributes')),
o = t && t.get('SelectorManager'),
s = this.getId();
return (
this.get('classes').each(function (t) {
return e.push(t.get('name'));
}),
e.length && (n.class = e.join(' ')),
!(0, r.has)(n, 'id') && o && o.get(s, o.Selector.TYPE_ID) && (n.id = this.getId()),
n
);
},
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, r.isArray)(t) ? t : [t];
var n = this.get('classes'),
i = c.TYPE_CLASS;
return (
t.forEach(function (t) {
t.split(' ').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 u(t)), this;
},
initComponents: function () {
var t = new l(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, r.isArray)(n) ? n : [n];
},
components: function (t) {
var e = this.get('components');
if ((0, r.isUndefined)(t)) return e;
e.reset(), t && this.append(t);
},
parent: function () {
var t = this.collection;
return t && t.parent;
},
scriptUpdated: function () {
this.set('scriptUpdated', 1);
},
traitsUpdated: function () {
var t = 0,
e = i({}, this.get('attributes')),
n = this.get('traits');
n instanceof h
? (n.each(function (n) {
if (((t = 1), !n.get('changeProp'))) {
var i = n.get('name'),
r = n.getInitValue();
i && r && (e[i] = r);
}
}),
t && this.set('attributes', e))
: this.loadTraits();
},
initToolbar: function () {
if (!this.get('toolbar')) {
var t = [];
this.collection && t.push({ attributes: { class: 'fa fa-arrow-up' }, command: 'select-parent' }),
this.get('draggable') &&
t.push({ attributes: { class: 'fa fa-arrows', draggable: !0 }, command: 'tlb-move' }),
this.get('copyable') && t.push({ attributes: { class: 'fa fa-clone' }, command: 'tlb-clone' }),
this.get('removable') && t.push({ attributes: { class: 'fa fa-trash-o' }, command: 'tlb-delete' }),
this.set('toolbar', t);
}
},
loadTraits: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = new h([], this.opt);
return (
n.setTarget(this), (t = t || this.get('traits')).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 = i({}, this.attributes),
o = i({}, this.opt);
return (
(n.attributes = i({}, 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 = ''),
(o.collection = null),
t && t.getConfig('avoidInlineStyle') && !(0, r.isEmpty)(e) && (n.style = e),
new this.constructor(n, o)
);
},
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 () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
e = [],
n = this.get('tagName'),
i = this.get('void'),
o = t.attributes,
s = this.getAttrToHTML();
for (var a in (o && ((0, r.isFunction)(o) ? (s = o(this, s) || {}) : (0, r.isObject)(o) && (s = o)), s)) {
var l = s[a],
c = (0, r.isString)(l) ? l.replace(/"/g, '&quot;') : l;
(0, r.isUndefined)(c) || ((0, r.isBoolean)(c) ? c && e.push(a) : e.push(a + '="' + c + '"'));
}
var u = '<' + n + (e.length ? ' ' + e.join(' ') : '') + (i ? '/' : '') + '>' + this.get('content');
return (
this.get('components').each(function (e) {
return (u += e.toHTML(t));
}),
!i && (u += '</' + n + '>'),
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 = a.Model.prototype.toJSON.apply(this, e);
if (
((i.attributes = this.getAttributes()),
delete i.attributes.class,
delete i.toolbar,
this.em.getConfig('avoidDefaults'))
) {
var o = (0, r.result)(this, 'defaults');
(0, r.forEach)(o, function (t, e) {
-1 === ['type', 'content'].indexOf(e) && i[e] === t && delete i[e];
}),
(0, r.isEmpty)(i.type) && delete i.type,
(0, r.forEach)(['attributes', 'style'], function (t) {
(0, r.isEmpty)(o[t]) && (0, r.isEmpty)(i[t]) && delete i[t];
}),
(0, r.forEach)(['classes', 'components'], function (t) {
(0, r.isEmpty)(o[t]) && !i[t].length && delete i[t];
});
}
return i;
},
getId: function () {
return (this.get('attributes') || {}).id || this.ccid || this.cid;
},
setId: function (t) {
var e = i({}, this.get('attributes'));
return (e.id = t), this.set('attributes', e), this;
},
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();
n = (i = i.replace(/^function[\s\w]*\(\)\s?\{/, '').replace(/\}$/, '')).trim();
}
var r = this.em.getConfig(),
o = p(r.tagVarStart || '{[ '),
s = p(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);
},
onAll: function (t) {
return (
(0, r.isFunction)(t) &&
(t(this),
this.components().forEach(function (e) {
return e.onAll(t);
})),
this
);
},
resetId: function () {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
var t = this.em,
e = this.getId();
if (e) {
var n = g.createId(this);
this.setId(n);
var i = t && t.get('CssComposer').getIdRule(e),
r = i && i.get('selectors').at(0);
return r && r.set('name', n), this;
}
},
},
{
isComponent: function (t) {
return { tagName: t.tagName ? t.tagName.toLowerCase() : '' };
},
createId: function (t) {
var e = (++f).toString().length + 2,
n = 'i' + (Math.random() + 1.1).toString(36).slice(-e);
return (d[n] = t), n;
},
getList: function () {
return d;
},
},
);
t.exports = g;
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
r = n(1),
o = n(2);
t.exports = i.default.View.extend({
template: function (t) {
return (
'\n <div class="' +
this.pfx +
'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;
return (
'\n <span class="' +
e +
'icon ' +
t.get('icon') +
'" title="' +
t.get('info') +
'">\n ' +
t.get('name') +
'\n </span>\n <b class="' +
e +
'clear" data-clear-style>&Cross;</b>\n '
);
},
templateInput: function (t) {
return (
'\n <div class="' +
this.ppfx +
'field">\n <input placeholder="' +
t.getDefaultValue() +
'"/>\n </div>\n '
);
},
events: (function (t, e, n) {
return (
e in t
? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 })
: (t[e] = n),
t
);
})({ change: 'inputValueChanged' }, 'click [data-clear-style]', '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 (t) {
t && t.stopPropagation(), this.model.clearValue(), this.targetUpdated();
},
getClearEl: function () {
return this.clearEl || (this.clearEl = this.el.querySelector('[data-clear-style]')), this.clearEl;
},
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')]) || e.ignoreDefault || (t = n.getDefaultValue()),
'function' == typeof r && !e.ignoreCustomValue)
) {
var o = r(this, n.collection.indexOf(n));
o && (t = o);
}
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.getSelected();
return !e || this.isTargetStylable(e);
},
setRawValue: function (t) {
this.setValue(this.model.parseValue(t));
},
setValue: function (t) {
var e = this.model,
n = (0, r.isUndefined)(t) ? e.getDefaultValue() : t,
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 });
},
});
},
function (t, e, n) {
t.exports = (function () {
'use strict';
var t = navigator.userAgent,
e = navigator.platform,
n = /gecko\/\d/i.test(t),
i = /MSIE \d/.test(t),
r = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),
o = /Edge\/(\d+)/.exec(t),
s = i || r || o,
a = s && (i ? document.documentMode || 6 : +(o || r)[1]),
l = !o && /WebKit\//.test(t),
c = l && /Qt\/\d+\.\d+/.test(t),
u = !o && /Chrome\//.test(t),
h = /Opera\//.test(t),
d = /Apple Computer/.test(navigator.vendor),
f = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),
p = /PhantomJS/.test(t),
g = !o && /AppleWebKit/.test(t) && /Mobile\/\w+/.test(t),
v = /Android/.test(t),
m = g || v || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),
y = g || /Mac/.test(e),
b = /\bCrOS\b/.test(t),
x = /win/i.test(e),
w = h && t.match(/Version\/(\d*\.\d*)/);
w && (w = Number(w[1])), w && w >= 15 && ((h = !1), (l = !0));
var C = y && (c || (h && (null == w || w < 12.11))),
k = n || (s && a >= 9);
function S(t) {
return new RegExp('(^|\\s)' + t + '(?:$|\\s)\\s*');
}
var T,
E = function (t, e) {
var n = t.className,
i = S(e).exec(n);
if (i) {
var r = n.slice(i.index + i[0].length);
t.className = n.slice(0, i.index) + (r ? i[1] + r : '');
}
};
function M(t) {
for (var e = t.childNodes.length; e > 0; --e) t.removeChild(t.firstChild);
return t;
}
function A(t, e) {
return M(t).appendChild(e);
}
function O(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 P(t, e, n, i) {
var r = O(t, e, n, i);
return r.setAttribute('role', 'presentation'), r;
}
function _(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 L() {
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 N(t, e) {
var n = t.className;
S(e).test(n) || (t.className += (n ? ' ' : '') + e);
}
function D(t, e) {
for (var n = t.split(' '), i = 0; i < n.length; i++) n[i] && !S(n[i]).test(e) && (e += ' ' + n[i]);
return e;
}
T = document.createRange
? function (t, e, n, i) {
var r = document.createRange();
return r.setEnd(i || t, n), r.setStart(t, e), r;
}
: function (t, e, n) {
var i = document.body.createTextRange();
try {
i.moveToElementText(t.parentNode);
} catch (t) {
return i;
}
return i.collapse(!0), i.moveEnd('character', n), i.moveStart('character', e), i;
};
var I = function (t) {
t.select();
};
function F(t) {
var e = Array.prototype.slice.call(arguments, 1);
return function () {
return t.apply(null, e);
};
}
function R(t, e, n) {
for (var i in (e || (e = {}), t)) !t.hasOwnProperty(i) || (!1 === n && e.hasOwnProperty(i)) || (e[i] = t[i]);
return e;
}
function j(t, e, n, i, r) {
null == e && -1 == (e = t.search(/[^\s\u00a0]/)) && (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);
}
}
g
? (I = function (t) {
(t.selectionStart = 0), (t.selectionEnd = t.value.length);
})
: s &&
(I = function (t) {
try {
t.select();
} catch (t) {}
});
var z = function () {
this.id = null;
};
function H(t, e) {
for (var n = 0; n < t.length; ++n) if (t[n] == e) return n;
return -1;
}
z.prototype.set = function (t, e) {
clearTimeout(this.id), (this.id = setTimeout(e, t));
};
var V = 30,
$ = {
toString: function () {
return 'CodeMirror.Pass';
},
},
B = { scroll: !1 },
W = { origin: '*mouse' },
U = { origin: '+move' };
function q(t, e, n) {
for (var i = 0, r = 0; ; ) {
var o = t.indexOf('\t', i);
-1 == o && (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), (i = o + 1), (r += n - (r % n)) >= e)) return i;
}
}
var K = [''];
function G(t) {
for (; K.length <= t; ) K.push(Y(K) + ' ');
return K[t];
}
function Y(t) {
return t[t.length - 1];
}
function X(t, e) {
for (var n = [], i = 0; i < t.length; i++) n[i] = e(t[i], i);
return n;
}
function J() {}
function Z(t, e) {
var n;
return Object.create ? (n = Object.create(t)) : ((J.prototype = t), (n = new J())), e && R(e, n), n;
}
var Q =
/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
function tt(t) {
return /\w/.test(t) || (t > '€' && (t.toUpperCase() != t.toLowerCase() || Q.test(t)));
}
function et(t, e) {
return e ? !!(e.source.indexOf('\\w') > -1 && tt(t)) || e.test(t) : tt(t);
}
function nt(t) {
for (var e in t) if (t.hasOwnProperty(e) && t[e]) return !1;
return !0;
}
var it =
/[\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 rt(t) {
return t.charCodeAt(0) >= 768 && it.test(t);
}
function ot(t, e, n) {
for (; (n < 0 ? e > 0 : e < t.length) && rt(t.charAt(e)); ) e += n;
return e;
}
function st(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 at(t, e) {
if ((e -= t.first) < 0 || e >= t.size)
throw new Error('There is no line ' + (e + t.first) + ' in the document.');
for (var n = t; !n.lines; )
for (var i = 0; ; ++i) {
var r = n.children[i],
o = r.chunkSize();
if (e < o) {
n = r;
break;
}
e -= o;
}
return n.lines[e];
}
function lt(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 ct(t, e, n) {
var i = [];
return (
t.iter(e, n, function (t) {
i.push(t.text);
}),
i
);
}
function ut(t, e) {
var n = e - t.height;
if (n) for (var i = t; i; i = i.parent) i.height += n;
}
function ht(t) {
if (null == t.parent) return null;
for (var e = t.parent, n = H(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 dt(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 ft(t, e) {
return e >= t.first && e < t.first + t.size;
}
function pt(t, e) {
return String(t.lineNumberFormatter(e + t.firstLineNumber));
}
function gt(t, e, n) {
if ((void 0 === n && (n = null), !(this instanceof gt))) return new gt(t, e, n);
(this.line = t), (this.ch = e), (this.sticky = n);
}
function vt(t, e) {
return t.line - e.line || t.ch - e.ch;
}
function mt(t, e) {
return t.sticky == e.sticky && 0 == vt(t, e);
}
function yt(t) {
return gt(t.line, t.ch);
}
function bt(t, e) {
return vt(t, e) < 0 ? e : t;
}
function xt(t, e) {
return vt(t, e) < 0 ? t : e;
}
function wt(t, e) {
return Math.max(t.first, Math.min(e, t.first + t.size - 1));
}
function Ct(t, e) {
if (e.line < t.first) return gt(t.first, 0);
var n = t.first + t.size - 1;
return e.line > n
? gt(n, at(t, n).text.length)
: (function (t, e) {
var n = t.ch;
return null == n || n > e ? gt(t.line, e) : n < 0 ? gt(t.line, 0) : t;
})(e, at(t, e.line).text.length);
}
function kt(t, e) {
for (var n = [], i = 0; i < e.length; i++) n[i] = Ct(t, e[i]);
return n;
}
var St = !1,
Tt = !1;
function Et(t, e, n) {
(this.marker = t), (this.from = e), (this.to = n);
}
function Mt(t, e) {
if (t)
for (var n = 0; n < t.length; ++n) {
var i = t[n];
if (i.marker == e) return i;
}
}
function At(t, e) {
for (var n, i = 0; i < t.length; ++i) t[i] != e && (n || (n = [])).push(t[i]);
return n;
}
function Ot(t, e) {
if (e.full) return null;
var n = ft(t, e.from.line) && at(t, e.from.line).markedSpans,
i = ft(t, e.to.line) && at(t, e.to.line).markedSpans;
if (!n && !i) return null;
var r = e.from.ch,
o = e.to.ch,
s = 0 == vt(e.from, e.to),
a = (function (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 Et(s, o.from, l ? null : o.to));
}
}
return i;
})(n, r, s),
l = (function (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 Et(s, l ? null : o.from - e, null == o.to ? null : o.to - e));
}
}
return i;
})(i, o, s),
c = 1 == e.text.length,
u = Y(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 = Mt(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 g = l[p];
if ((null != g.to && (g.to += u), null == g.from)) {
var v = Mt(a, g.marker);
v || ((g.from = u), c && (a || (a = [])).push(g));
} else (g.from += u), c && (a || (a = [])).push(g);
}
a && (a = Pt(a)), l && l != a && (l = Pt(l));
var m = [a];
if (!c) {
var y,
b = e.text.length - 2;
if (b > 0 && a)
for (var x = 0; x < a.length; ++x)
null == a[x].to && (y || (y = [])).push(new Et(a[x].marker, null, null));
for (var w = 0; w < b; ++w) m.push(y);
m.push(l);
}
return m;
}
function Pt(t) {
for (var e = 0; e < t.length; ++e) {
var n = t[e];
null != n.from && n.from == n.to && !1 !== n.marker.clearWhenEmpty && t.splice(e--, 1);
}
return t.length ? t : null;
}
function _t(t) {
var e = t.markedSpans;
if (e) {
for (var n = 0; n < e.length; ++n) e[n].marker.detachLine(t);
t.markedSpans = null;
}
}
function Lt(t, e) {
if (e) {
for (var n = 0; n < e.length; ++n) e[n].marker.attachLine(t);
t.markedSpans = e;
}
}
function Nt(t) {
return t.inclusiveLeft ? -1 : 0;
}
function Dt(t) {
return t.inclusiveRight ? 1 : 0;
}
function It(t, e) {
var n = t.lines.length - e.lines.length;
if (0 != n) return n;
var i = t.find(),
r = e.find(),
o = vt(i.from, r.from) || Nt(t) - Nt(e);
if (o) return -o;
var s = vt(i.to, r.to) || Dt(t) - Dt(e);
return s || e.id - t.id;
}
function Ft(t, e) {
var n,
i = Tt && t.markedSpans;
if (i)
for (var r = void 0, o = 0; o < i.length; ++o)
(r = i[o]).marker.collapsed &&
null == (e ? r.from : r.to) &&
(!n || It(n, r.marker) < 0) &&
(n = r.marker);
return n;
}
function Rt(t) {
return Ft(t, !0);
}
function jt(t) {
return Ft(t, !1);
}
function zt(t, e) {
var n,
i = Tt && t.markedSpans;
if (i)
for (var r = 0; r < i.length; ++r) {
var o = i[r];
o.marker.collapsed &&
(null == o.from || o.from < e) &&
(null == o.to || o.to > e) &&
(!n || It(n, o.marker) < 0) &&
(n = o.marker);
}
return n;
}
function Ht(t, e, n, i, r) {
var o = at(t, e),
s = Tt && 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 = vt(c.from, n) || Nt(l.marker) - Nt(r),
h = vt(c.to, i) || Dt(l.marker) - Dt(r);
if (
!((u >= 0 && h <= 0) || (u <= 0 && h >= 0)) &&
((u <= 0 && (l.marker.inclusiveRight && r.inclusiveLeft ? vt(c.to, n) >= 0 : vt(c.to, n) > 0)) ||
(u >= 0 && (l.marker.inclusiveRight && r.inclusiveLeft ? vt(c.from, i) <= 0 : vt(c.from, i) < 0)))
)
return !0;
}
}
}
function Vt(t) {
for (var e; (e = Rt(t)); ) t = e.find(-1, !0).line;
return t;
}
function $t(t, e) {
var n = at(t, e),
i = Vt(n);
return n == i ? e : ht(i);
}
function Bt(t, e) {
if (e > t.lastLine()) return e;
var n,
i = at(t, e);
if (!Wt(t, i)) return e;
for (; (n = jt(i)); ) i = n.find(1, !0).line;
return ht(i) + 1;
}
function Wt(t, e) {
var n = Tt && e.markedSpans;
if (n)
for (var i = void 0, r = 0; r < n.length; ++r)
if ((i = n[r]).marker.collapsed) {
if (null == i.from) return !0;
if (!i.marker.widgetNode && 0 == i.from && i.marker.inclusiveLeft && Ut(t, e, i)) return !0;
}
}
function Ut(t, e, n) {
if (null == n.to) {
var i = n.marker.find(1, !0);
return Ut(t, i.line, Mt(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]).marker.collapsed &&
!r.marker.widgetNode &&
r.from == n.to &&
(null == r.to || r.to != n.from) &&
(r.marker.inclusiveLeft || n.marker.inclusiveRight) &&
Ut(t, e, r)
)
return !0;
}
function qt(t) {
for (var e = 0, n = (t = Vt(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; o = (n = o).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 Kt(t) {
if (0 == t.height) return 0;
for (var e, n = t.text.length, i = t; (e = Rt(i)); ) {
var r = e.find(0, !0);
(i = r.from.line), (n += r.from.ch - r.to.ch);
}
for (i = t; (e = jt(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 Gt(t) {
var e = t.display,
n = t.doc;
(e.maxLine = at(n, n.first)),
(e.maxLineLength = Kt(e.maxLine)),
(e.maxLineChanged = !0),
n.iter(function (t) {
var n = Kt(t);
n > e.maxLineLength && ((e.maxLineLength = n), (e.maxLine = t));
});
}
var Yt = null;
function Xt(t, e, n) {
var i;
Yt = 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) : (Yt = r)),
o.from == e && (o.from != o.to && 'before' != n ? (i = r) : (Yt = r));
}
return null != i ? i : Yt;
}
var Jt = (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 i = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,
r = /[stwN]/,
o = /[LRr]/,
s = /[Lb1n]/,
a = /[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 && !i.test(t))) return !1;
for (var u = t.length, h = [], d = 0; d < u; ++d) h.push(n(t.charCodeAt(d)));
for (var f = 0, p = c; f < u; ++f) {
var g = h[f];
'm' == g ? (h[f] = p) : (p = g);
}
for (var v = 0, m = c; v < u; ++v) {
var y = h[v];
'1' == y && 'r' == m ? (h[v] = 'n') : o.test(y) && ((m = y), 'r' == y && (h[v] = 'R'));
}
for (var b = 1, x = h[0]; b < u - 1; ++b) {
var w = h[b];
'+' == w && '1' == x && '1' == h[b + 1]
? (h[b] = '1')
: ',' != w || x != h[b + 1] || ('1' != x && 'n' != x) || (h[b] = x),
(x = w);
}
for (var C = 0; C < u; ++C) {
var k = h[C];
if (',' == k) h[C] = 'N';
else if ('%' == k) {
var S = void 0;
for (S = C + 1; S < u && '%' == h[S]; ++S);
for (var T = (C && '!' == h[C - 1]) || (S < u && '1' == h[S]) ? '1' : 'N', E = C; E < S; ++E) h[E] = T;
C = S - 1;
}
}
for (var M = 0, A = c; M < u; ++M) {
var O = h[M];
'L' == A && '1' == O ? (h[M] = 'L') : o.test(O) && (A = O);
}
for (var P = 0; P < u; ++P)
if (r.test(h[P])) {
var _ = void 0;
for (_ = P + 1; _ < u && r.test(h[_]); ++_);
for (
var L = 'L' == (P ? h[P - 1] : c),
N = 'L' == (_ < u ? h[_] : c),
D = L == N ? (L ? 'L' : 'R') : c,
I = P;
I < _;
++I
)
h[I] = D;
P = _ - 1;
}
for (var F, R = [], j = 0; j < u; )
if (s.test(h[j])) {
var z = j;
for (++j; j < u && s.test(h[j]); ++j);
R.push(new l(0, z, j));
} else {
var H = j,
V = R.length;
for (++j; j < u && 'L' != h[j]; ++j);
for (var $ = H; $ < j; )
if (a.test(h[$])) {
H < $ && R.splice(V, 0, new l(1, H, $));
var B = $;
for (++$; $ < j && a.test(h[$]); ++$);
R.splice(V, 0, new l(2, B, $)), (H = $);
} else ++$;
H < j && R.splice(V, 0, new l(1, H, j));
}
return (
'ltr' == e &&
(1 == R[0].level &&
(F = t.match(/^\s+/)) &&
((R[0].from = F[0].length), R.unshift(new l(0, 0, F[0].length))),
1 == Y(R).level &&
(F = t.match(/\s+$/)) &&
((Y(R).to -= F[0].length), R.push(new l(0, u - F[0].length, u)))),
'rtl' == e ? R.reverse() : R
);
};
})();
function Zt(t, e) {
var n = t.order;
return null == n && (n = t.order = Jt(t.text, e)), n;
}
var Qt = [],
te = 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] || Qt).concat(n);
}
};
function ee(t, e) {
return (t._handlers && t._handlers[e]) || Qt;
}
function ne(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 = H(r, n);
o > -1 && (i[e] = r.slice(0, o).concat(r.slice(o + 1)));
}
}
}
function ie(t, e) {
var n = ee(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 re(t, e, n) {
return (
'string' == typeof e &&
(e = {
type: e,
preventDefault: function () {
this.defaultPrevented = !0;
},
}),
ie(t, n || e.type, t, e),
ue(e) || e.codemirrorIgnore
);
}
function oe(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
)
-1 == H(n, e[i]) && n.push(e[i]);
}
function se(t, e) {
return ee(t, e).length > 0;
}
function ae(t) {
(t.prototype.on = function (t, e) {
te(this, t, e);
}),
(t.prototype.off = function (t, e) {
ne(this, t, e);
});
}
function le(t) {
t.preventDefault ? t.preventDefault() : (t.returnValue = !1);
}
function ce(t) {
t.stopPropagation ? t.stopPropagation() : (t.cancelBubble = !0);
}
function ue(t) {
return null != t.defaultPrevented ? t.defaultPrevented : 0 == t.returnValue;
}
function he(t) {
le(t), ce(t);
}
function de(t) {
return t.target || t.srcElement;
}
function fe(t) {
var e = t.which;
return (
null == e && (1 & t.button ? (e = 1) : 2 & t.button ? (e = 3) : 4 & t.button && (e = 2)),
y && t.ctrlKey && 1 == e && (e = 3),
e
);
}
var pe,
ge,
ve = (function () {
if (s && a < 9) return !1;
var t = O('div');
return 'draggable' in t || 'dragDrop' in t;
})();
function me(t) {
if (null == pe) {
var e = O('span', '​');
A(t, O('span', [e, document.createTextNode('x')])),
0 != t.firstChild.offsetHeight && (pe = e.offsetWidth <= 1 && e.offsetHeight > 2 && !(s && a < 8));
}
var n = pe ? O('span', '​') : O('span', ' ', null, 'display: inline-block; width: 1px; margin-right: -1px');
return n.setAttribute('cm-text', ''), n;
}
function ye(t) {
if (null != ge) return ge;
var e = A(t, document.createTextNode('AخA')),
n = T(e, 0, 1).getBoundingClientRect(),
i = T(e, 1, 2).getBoundingClientRect();
return M(t), !(!n || n.left == n.right) && (ge = i.right - n.right < 3);
}
var be =
3 != '\n\nb'.split(/\n/).length
? function (t) {
for (var e = 0, n = [], i = t.length; e <= i; ) {
var r = t.indexOf('\n', e);
-1 == r && (r = t.length);
var o = t.slice(e, '\r' == t.charAt(r - 1) ? r - 1 : r),
s = o.indexOf('\r');
-1 != s ? (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/);
},
xe = 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);
},
we = (function () {
var t = O('div');
return 'oncopy' in t || (t.setAttribute('oncopy', 'return;'), 'function' == typeof t.oncopy);
})(),
Ce = null,
ke = {},
Se = {};
function Te(t) {
if ('string' == typeof t && Se.hasOwnProperty(t)) t = Se[t];
else if (t && 'string' == typeof t.name && Se.hasOwnProperty(t.name)) {
var e = Se[t.name];
'string' == typeof e && (e = { name: e }), ((t = Z(e, t)).name = e.name);
} else {
if ('string' == typeof t && /^[\w\-]+\/[\w\-]+\+xml$/.test(t)) return Te('application/xml');
if ('string' == typeof t && /^[\w\-]+\/[\w\-]+\+json$/.test(t)) return Te('application/json');
}
return 'string' == typeof t ? { name: t } : t || { name: 'null' };
}
function Ee(t, e) {
e = Te(e);
var n = ke[e.name];
if (!n) return Ee(t, 'text/plain');
var i = n(t, e);
if (Me.hasOwnProperty(e.name)) {
var r = Me[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;
}
var Me = {};
function Ae(t, e) {
var n = Me.hasOwnProperty(t) ? Me[t] : (Me[t] = {});
R(e, n);
}
function Oe(t, e) {
if (!0 === e) return e;
if (t.copyState) return t.copyState(e);
var n = {};
for (var i in e) {
var r = e[i];
r instanceof Array && (r = r.concat([])), (n[i] = r);
}
return n;
}
function Pe(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 _e(t, e, n) {
return !t.startState || t.startState(e, n);
}
var Le = 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);
};
(Le.prototype.eol = function () {
return this.pos >= this.string.length;
}),
(Le.prototype.sol = function () {
return this.pos == this.lineStart;
}),
(Le.prototype.peek = function () {
return this.string.charAt(this.pos) || void 0;
}),
(Le.prototype.next = function () {
if (this.pos < this.string.length) return this.string.charAt(this.pos++);
}),
(Le.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;
}),
(Le.prototype.eatWhile = function (t) {
for (var e = this.pos; this.eat(t); );
return this.pos > e;
}),
(Le.prototype.eatSpace = function () {
for (var t = this.pos; /[\s\u00a0]/.test(this.string.charAt(this.pos)); ) ++this.pos;
return this.pos > t;
}),
(Le.prototype.skipToEnd = function () {
this.pos = this.string.length;
}),
(Le.prototype.skipTo = function (t) {
var e = this.string.indexOf(t, this.pos);
if (e > -1) return (this.pos = e), !0;
}),
(Le.prototype.backUp = function (t) {
this.pos -= t;
}),
(Le.prototype.column = function () {
return (
this.lastColumnPos < this.start &&
((this.lastColumnValue = j(
this.string,
this.start,
this.tabSize,
this.lastColumnPos,
this.lastColumnValue,
)),
(this.lastColumnPos = this.start)),
this.lastColumnValue - (this.lineStart ? j(this.string, this.lineStart, this.tabSize) : 0)
);
}),
(Le.prototype.indentation = function () {
return (
j(this.string, null, this.tabSize) - (this.lineStart ? j(this.string, this.lineStart, this.tabSize) : 0)
);
}),
(Le.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 && !1 !== e && (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 !1 !== e && (this.pos += t.length), !0;
}),
(Le.prototype.current = function () {
return this.string.slice(this.start, this.pos);
}),
(Le.prototype.hideFirstChars = function (t, e) {
this.lineStart += t;
try {
return e();
} finally {
this.lineStart -= t;
}
}),
(Le.prototype.lookAhead = function (t) {
var e = this.lineOracle;
return e && e.lookAhead(t);
}),
(Le.prototype.baseToken = function () {
var t = this.lineOracle;
return t && t.baseToken(this.pos);
});
var Ne = function (t, e) {
(this.state = t), (this.lookAhead = e);
},
De = function (t, e, n, i) {
(this.state = e),
(this.doc = t),
(this.line = n),
(this.maxLookAhead = i || 0),
(this.baseTokens = null),
(this.baseTokenPos = 1);
};
function Ie(t, e, n, i) {
var r = [t.state.modeGen],
o = {};
We(
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),
We(
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 Fe(t, e, n) {
if (!e.styles || e.styles[0] != t.state.modeGen) {
var i = Re(t, ht(e)),
r = e.text.length > t.options.maxHighlightLength && Oe(t.doc.mode, i.state),
o = Ie(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 Re(t, e, n) {
var i = t.doc,
r = t.display;
if (!i.mode.startState) return new De(i, !0, e);
var o = (function (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 = at(o, a - 1),
c = l.stateAfter;
if (c && (!n || a + (c instanceof Ne ? c.lookAhead : 0) <= o.modeFrontier)) return a;
var u = j(l.text, null, t.options.tabSize);
(null == r || i > u) && ((r = a - 1), (i = u));
}
return r;
})(t, e, n),
s = o > i.first && at(i, o - 1).stateAfter,
a = s ? De.fromSaved(i, s, o) : new De(i, _e(i.mode), o);
return (
i.iter(o, e, function (n) {
je(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 je(t, e, n, i) {
var r = t.doc.mode,
o = new Le(e, t.options.tabSize, n);
for (o.start = o.pos = i || 0, '' == e && ze(r, n.state); !o.eol(); ) He(r, o, n.state), (o.start = o.pos);
}
function ze(t, e) {
if (t.blankLine) return t.blankLine(e);
if (t.innerMode) {
var n = Pe(t, e);
return n.mode.blankLine ? n.mode.blankLine(n.state) : void 0;
}
}
function He(t, e, n, i) {
for (var r = 0; r < 10; r++) {
i && (i[0] = Pe(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.');
}
(De.prototype.lookAhead = function (t) {
var e = this.doc.getLine(this.line + t);
return null != e && t > this.maxLookAhead && (this.maxLookAhead = t), e;
}),
(De.prototype.baseToken = function (t) {
if (!this.baseTokens) return null;
for (; this.baseTokens[this.baseTokenPos] <= t; ) this.baseTokenPos += 2;
var e = this.baseTokens[this.baseTokenPos + 1];
return { type: e && e.replace(/( |^)overlay .*/, ''), size: this.baseTokens[this.baseTokenPos] - t };
}),
(De.prototype.nextLine = function () {
this.line++, this.maxLookAhead > 0 && this.maxLookAhead--;
}),
(De.fromSaved = function (t, e, n) {
return e instanceof Ne ? new De(t, Oe(t.mode, e.state), n, e.lookAhead) : new De(t, Oe(t.mode, e), n);
}),
(De.prototype.save = function (t) {
var e = !1 !== t ? Oe(this.doc.mode, this.state) : this.state;
return this.maxLookAhead > 0 ? new Ne(e, this.maxLookAhead) : e;
});
var Ve = function (t, e, n) {
(this.start = t.start),
(this.end = t.pos),
(this.string = t.current()),
(this.type = e || null),
(this.state = n);
};
function $e(t, e, n, i) {
var r,
o = t.doc,
s = o.mode;
e = Ct(o, e);
var a,
l = at(o, e.line),
c = Re(t, e.line, n),
u = new Le(l.text, t.options.tabSize, c);
for (i && (a = []); (i || u.pos < e.ch) && !u.eol(); )
(u.start = u.pos), (r = He(s, u, c.state)), i && a.push(new Ve(u, r, Oe(o.mode, c.state)));
return i ? a : new Ve(u, r, c.state);
}
function Be(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 We(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 Le(e, t.options.tabSize, i),
d = t.options.addModeClass && [null];
for ('' == e && Be(ze(n, i.state), o); !h.eol(); ) {
if (
(h.pos > t.options.maxHighlightLength
? ((a = !1), s && je(t, e, i, h.pos), (h.pos = e.length), (l = null))
: (l = Be(He(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);
}
}
var Ue = function (t, e, n) {
(this.text = t), Lt(this, e), (this.height = n ? n(this) : 1);
};
function qe(t) {
(t.parent = null), _t(t);
}
(Ue.prototype.lineNo = function () {
return ht(this);
}),
ae(Ue);
var Ke = {},
Ge = {};
function Ye(t, e) {
if (!t || /^\s*$/.test(t)) return null;
var n = e.addModeClass ? Ge : Ke;
return n[t] || (n[t] = t.replace(/\S+/g, 'cm-$&'));
}
function Xe(t, e) {
var n = P('span', null, null, l ? 'padding-right: .1px' : null),
i = {
pre: P('pre', [n], 'CodeMirror-line'),
content: n,
col: 0,
pos: 0,
cm: t,
trailingSpace: !1,
splitSpaces: (s || l) && t.getOption('lineWrapping'),
};
e.measure = {};
for (var r = 0; r <= (e.rest ? e.rest.length : 0); r++) {
var o = r ? e.rest[r - 1] : e.line,
a = void 0;
(i.pos = 0),
(i.addToken = Ze),
ye(t.display.measure) && (a = Zt(o, t.doc.direction)) && (i.addToken = Qe(i.addToken, a)),
(i.map = []);
var c = e != t.display.externalMeasured && ht(o);
en(o, i, Fe(t, o, c)),
o.styleClasses &&
(o.styleClasses.bgClass && (i.bgClass = D(o.styleClasses.bgClass, i.bgClass || '')),
o.styleClasses.textClass && (i.textClass = D(o.styleClasses.textClass, i.textClass || ''))),
0 == i.map.length && i.map.push(0, 0, i.content.appendChild(me(t.display.measure))),
0 == r
? ((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 (l) {
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 (
ie(t, 'renderLine', t, e.line, i.pre),
i.pre.className && (i.textClass = D(i.pre.className, i.textClass || '')),
i
);
}
function Je(t) {
var e = O('span', '•', 'cm-invalidchar');
return (e.title = '\\u' + t.charCodeAt(0).toString(16)), e.setAttribute('aria-label', e.title), e;
}
function Ze(t, e, n, i, r, o, l) {
if (e) {
var c,
u = t.splitSpaces
? (function (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;
})(e, t.trailingSpace)
: e,
h = t.cm.state.specialChars,
d = !1;
if (h.test(e)) {
c = document.createDocumentFragment();
for (var f = 0; ; ) {
h.lastIndex = f;
var p = h.exec(e),
g = p ? p.index - f : e.length - f;
if (g) {
var v = document.createTextNode(u.slice(f, f + g));
s && a < 9 ? c.appendChild(O('span', [v])) : c.appendChild(v),
t.map.push(t.pos, t.pos + g, v),
(t.col += g),
(t.pos += g);
}
if (!p) break;
f += g + 1;
var m = void 0;
if ('\t' == p[0]) {
var y = t.cm.options.tabSize,
b = y - (t.col % y);
(m = c.appendChild(O('span', G(b), 'cm-tab'))).setAttribute('role', 'presentation'),
m.setAttribute('cm-text', '\t'),
(t.col += b);
} else
'\r' == p[0] || '\n' == p[0]
? ((m = c.appendChild(O('span', '\r' == p[0] ? '␍' : '␤', 'cm-invalidchar'))).setAttribute(
'cm-text',
p[0],
),
(t.col += 1))
: ((m = t.cm.options.specialCharPlaceholder(p[0])).setAttribute('cm-text', p[0]),
s && a < 9 ? c.appendChild(O('span', [m])) : c.appendChild(m),
(t.col += 1));
t.map.push(t.pos, t.pos + 1, m), t.pos++;
}
} else
(t.col += e.length),
(c = document.createTextNode(u)),
t.map.push(t.pos, t.pos + e.length, c),
s && a < 9 && (d = !0),
(t.pos += e.length);
if (((t.trailingSpace = 32 == u.charCodeAt(e.length - 1)), n || i || r || d || l)) {
var x = n || '';
i && (x += i), r && (x += r);
var w = O('span', [c], x, l);
return o && (w.title = o), t.content.appendChild(w);
}
t.content.appendChild(c);
}
}
function Qe(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]).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 tn(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 en(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 || It(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) tn(e, 0, y[S]);
if (d && (d.from || 0) == p) {
if ((tn(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 = Ye(n[g++], e.cm.options));
}
}
else for (var A = 1; A < n.length; A += 2) e.addToken(e, r.slice(o, (o = n[A])), Ye(n[A + 1], e.cm.options));
}
function nn(t, e, n) {
(this.line = e),
(this.rest = (function (t) {
for (var e, n; (e = jt(t)); ) (t = e.find(1, !0).line), (n || (n = [])).push(t);
return n;
})(e)),
(this.size = this.rest ? ht(Y(this.rest)) - n + 1 : 1),
(this.node = this.text = null),
(this.hidden = Wt(t, e));
}
function rn(t, e, n) {
for (var i, r = [], o = e; o < n; o = i) {
var s = new nn(t.doc, at(t.doc, o), o);
(i = o + s.size), r.push(s);
}
return r;
}
var on = null,
sn = null;
function an(t, e) {
var n = ee(t, e);
if (n.length) {
var i,
r = Array.prototype.slice.call(arguments, 2);
on ? (i = on.delayedCallbacks) : sn ? (i = sn) : ((i = sn = []), setTimeout(ln, 0));
for (
var o = function (t) {
i.push(function () {
return n[t].apply(null, r);
});
},
s = 0;
s < n.length;
++s
)
o(s);
}
}
function ln() {
var t = sn;
sn = null;
for (var e = 0; e < t.length; ++e) t[e]();
}
function cn(t, e, n, i) {
for (var r = 0; r < e.changes.length; r++) {
var o = e.changes[r];
'text' == o
? dn(t, e)
: 'gutter' == o
? pn(t, e, n, i)
: 'class' == o
? fn(t, e)
: 'widget' == o && gn(t, e, i);
}
e.changes = null;
}
function un(t) {
return (
t.node == t.text &&
((t.node = O('div', null, null, 'position: relative')),
t.text.parentNode && t.text.parentNode.replaceChild(t.node, t.text),
t.node.appendChild(t.text),
s && a < 8 && (t.node.style.zIndex = 2)),
t.node
);
}
function hn(t, e) {
var n = t.display.externalMeasured;
return n && n.line == e.line
? ((t.display.externalMeasured = null), (e.measure = n.measure), n.built)
: Xe(t, e);
}
function dn(t, e) {
var n = e.text.className,
i = hn(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), fn(t, e))
: n && (e.text.className = n);
}
function fn(t, e) {
!(function (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 i = un(e);
(e.background = i.insertBefore(O('div', null, n), i.firstChild)),
t.display.input.setUneditable(e.background);
}
})(t, e),
e.line.wrapClass ? (un(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 pn(t, e, n, i) {
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 r = un(e);
(e.gutterBackground = O(
'div',
null,
'CodeMirror-gutter-background ' + e.line.gutterClass,
'left: ' +
(t.options.fixedGutter ? i.fixedPos : -i.gutterTotalWidth) +
'px; width: ' +
i.gutterTotalWidth +
'px',
)),
t.display.input.setUneditable(e.gutterBackground),
r.insertBefore(e.gutterBackground, e.text);
}
var o = e.line.gutterMarkers;
if (t.options.lineNumbers || o) {
var s = un(e),
a = (e.gutter = O(
'div',
null,
'CodeMirror-gutter-wrapper',
'left: ' + (t.options.fixedGutter ? i.fixedPos : -i.gutterTotalWidth) + 'px',
));
if (
(t.display.input.setUneditable(a),
s.insertBefore(a, e.text),
e.line.gutterClass && (a.className += ' ' + e.line.gutterClass),
!t.options.lineNumbers ||
(o && o['CodeMirror-linenumbers']) ||
(e.lineNumber = a.appendChild(
O(
'div',
pt(t.options, n),
'CodeMirror-linenumber CodeMirror-gutter-elt',
'left: ' +
i.gutterLeft['CodeMirror-linenumbers'] +
'px; width: ' +
t.display.lineNumInnerWidth +
'px',
),
)),
o)
)
for (var l = 0; l < t.options.gutters.length; ++l) {
var c = t.options.gutters[l],
u = o.hasOwnProperty(c) && o[c];
u &&
a.appendChild(
O(
'div',
[u],
'CodeMirror-gutter-elt',
'left: ' + i.gutterLeft[c] + 'px; width: ' + i.gutterWidth[c] + 'px',
),
);
}
}
}
function gn(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);
mn(t, e, n);
}
function vn(t, e, n, i) {
var r = hn(t, e);
return (
(e.text = e.node = r.pre),
r.bgClass && (e.bgClass = r.bgClass),
r.textClass && (e.textClass = r.textClass),
fn(t, e),
pn(t, e, n, i),
mn(t, e, i),
e.node
);
}
function mn(t, e, n) {
if ((yn(t, e.line, e, n, !0), e.rest)) for (var i = 0; i < e.rest.length; i++) yn(t, e.rest[i], e, n, !1);
}
function yn(t, e, n, i, r) {
if (e.widgets)
for (var o = un(n), s = 0, a = e.widgets; s < a.length; ++s) {
var l = a[s],
c = O('div', [l.node], 'CodeMirror-linewidget');
l.handleMouseEvents || c.setAttribute('cm-ignore-events', 'true'),
bn(l, c, n, i),
t.display.input.setUneditable(c),
r && l.above ? o.insertBefore(c, n.gutter || n.text) : o.appendChild(c),
an(l, 'redraw');
}
}
function bn(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 xn(t) {
if (null != t.height) return t.height;
var e = t.doc.cm;
if (!e) return 0;
if (!_(document.body, t.node)) {
var n = 'position: relative;';
t.coverGutter && (n += 'margin-left: -' + e.display.gutters.offsetWidth + 'px;'),
t.noHScroll && (n += 'width: ' + e.display.wrapper.clientWidth + 'px;'),
A(e.display.measure, O('div', [t.node], null, n));
}
return (t.height = t.node.parentNode.offsetHeight);
}
function wn(t, e) {
for (var n = de(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 Cn(t) {
return t.lineSpace.offsetTop;
}
function kn(t) {
return t.mover.offsetHeight - t.lineSpace.offsetHeight;
}
function Sn(t) {
if (t.cachedPaddingH) return t.cachedPaddingH;
var e = A(t.measure, O('pre', 'x')),
n = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle,
i = { left: parseInt(n.paddingLeft), right: parseInt(n.paddingRight) };
return isNaN(i.left) || isNaN(i.right) || (t.cachedPaddingH = i), i;
}
function Tn(t) {
return V - t.display.nativeBarWidth;
}
function En(t) {
return t.display.scroller.clientWidth - Tn(t) - t.display.barWidth;
}
function Mn(t) {
return t.display.scroller.clientHeight - Tn(t) - t.display.barHeight;
}
function An(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 (ht(t.rest[r]) > n) return { map: t.measure.maps[r], cache: t.measure.caches[r], before: !0 };
}
function On(t, e, n, i) {
return Ln(t, _n(t, e), n, i);
}
function Pn(t, e) {
if (e >= t.display.viewFrom && e < t.display.viewTo) return t.display.view[ai(t, e)];
var n = t.display.externalMeasured;
return n && e >= n.lineN && e < n.lineN + n.size ? n : void 0;
}
function _n(t, e) {
var n = ht(e),
i = Pn(t, n);
i && !i.text ? (i = null) : i && i.changes && (cn(t, i, n, ni(t)), (t.curOp.forceUpdate = !0)),
i ||
(i = (function (t, e) {
var n = ht((e = Vt(e))),
i = (t.display.externalMeasured = new nn(t.doc, e, n));
i.lineN = n;
var r = (i.built = Xe(t, i));
return (i.text = r.pre), A(t.display.lineMeasure, r.pre), i;
})(t, e));
var r = An(i, e, n);
return { line: e, view: i, rect: null, map: r.map, cache: r.cache, before: r.before, hasHeights: !1 };
}
function Ln(t, e, n, i, r) {
e.before && (n = -1);
var o,
l = n + (i || '');
return (
e.cache.hasOwnProperty(l)
? (o = e.cache[l])
: (e.rect || (e.rect = e.view.text.getBoundingClientRect()),
e.hasHeights ||
((function (t, e, n) {
var i = t.options.lineWrapping,
r = i && En(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);
}
})(t, e.view, e.rect),
(e.hasHeights = !0)),
(o = (function (t, e, n, i) {
var r,
o = In(e.map, n, i),
l = o.node,
c = o.start,
u = o.end,
h = o.collapse;
if (3 == l.nodeType) {
for (var d = 0; d < 4; d++) {
for (; c && rt(e.line.text.charAt(o.coverStart + c)); ) --c;
for (; o.coverStart + u < o.coverEnd && rt(e.line.text.charAt(o.coverStart + u)); ) ++u;
if (
(r =
s && a < 9 && 0 == c && u == o.coverEnd - o.coverStart
? l.parentNode.getBoundingClientRect()
: Fn(T(l, c, u).getClientRects(), i)).left ||
r.right ||
0 == c
)
break;
(u = c), (c -= 1), (h = 'right');
}
s &&
a < 11 &&
(r = (function (t, e) {
if (
!window.screen ||
null == screen.logicalXDPI ||
screen.logicalXDPI == screen.deviceXDPI ||
!(function (t) {
if (null != Ce) return Ce;
var e = A(t, O('span', 'x')),
n = e.getBoundingClientRect(),
i = T(e, 0, 1).getBoundingClientRect();
return (Ce = Math.abs(n.left - i.left) > 1);
})(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 };
})(t.display.measure, r));
} else {
var f;
c > 0 && (h = i = 'right'),
(r =
t.options.lineWrapping && (f = l.getClientRects()).length > 1
? f['right' == i ? f.length - 1 : 0]
: l.getBoundingClientRect());
}
if (s && a < 9 && !c && (!r || (!r.left && !r.right))) {
var p = l.parentNode.getClientRects()[0];
r = p ? { left: p.left, right: p.left + ei(t.display), top: p.top, bottom: p.bottom } : Dn;
}
for (
var g = r.top - e.rect.top,
v = r.bottom - e.rect.top,
m = (g + v) / 2,
y = e.view.measure.heights,
b = 0;
b < y.length - 1 && !(m < y[b]);
b++
);
var x = b ? y[b - 1] : 0,
w = y[b],
C = {
left: ('right' == h ? r.right : r.left) - e.rect.left,
right: ('left' == h ? r.left : r.right) - e.rect.left,
top: x,
bottom: w,
};
return (
r.left || r.right || (C.bogus = !0),
t.options.singleCursorHeightPerLine || ((C.rtop = g), (C.rbottom = v)),
C
);
})(t, e, n, i)).bogus || (e.cache[l] = o)),
{ left: o.left, right: o.right, top: r ? o.rtop : o.top, bottom: r ? o.rbottom : o.bottom }
);
}
var Nn,
Dn = { left: 0, right: 0, top: 0, bottom: 0 };
function In(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
? (o = 1 + (r = e - a))
: (c == t.length - 3 || (e == l && t[c + 3] > e)) && ((r = (o = l - a) - 1), e >= l && (s = 'right')),
null != r)
) {
if (((i = t[c + 2]), a == l && n == (i.insertLeft ? 'left' : 'right') && (s = n), 'left' == n && 0 == r))
for (; c && t[c - 2] == t[c - 3] && t[c - 1].insertLeft; ) (i = t[2 + (c -= 3)]), (s = 'left');
if ('right' == n && r == l - a)
for (; c < 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 Fn(t, e) {
var n = Dn;
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 Rn(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 jn(t) {
(t.display.externalMeasure = null), M(t.display.lineMeasure);
for (var e = 0; e < t.display.view.length; e++) Rn(t.display.view[e]);
}
function zn(t) {
jn(t),
(t.display.cachedCharWidth = t.display.cachedTextHeight = t.display.cachedPaddingH = null),
t.options.lineWrapping || (t.display.maxLineChanged = !0),
(t.display.lineNumChars = null);
}
function Hn() {
return u && v
? -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft))
: window.pageXOffset || (document.documentElement || document.body).scrollLeft;
}
function Vn() {
return u && v
? -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop))
: window.pageYOffset || (document.documentElement || document.body).scrollTop;
}
function $n(t) {
var e = 0;
if (t.widgets) for (var n = 0; n < t.widgets.length; ++n) t.widgets[n].above && (e += xn(t.widgets[n]));
return e;
}
function Bn(t, e, n, i, r) {
if (!r) {
var o = $n(e);
(n.top += o), (n.bottom += o);
}
if ('line' == i) return n;
i || (i = 'local');
var s = qt(e);
if (('local' == i ? (s += Cn(t.display)) : (s -= t.display.viewOffset), 'page' == i || 'window' == i)) {
var a = t.display.lineSpace.getBoundingClientRect();
s += a.top + ('window' == i ? 0 : Vn());
var l = a.left + ('window' == i ? 0 : Hn());
(n.left += l), (n.right += l);
}
return (n.top += s), (n.bottom += s), n;
}
function Wn(t, e, n) {
if ('div' == n) return e;
var i = e.left,
r = e.top;
if ('page' == n) (i -= Hn()), (r -= Vn());
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 Un(t, e, n, i, r) {
return i || (i = at(t.doc, e.line)), Bn(t, i, On(t, i, e.ch, r), n);
}
function qn(t, e, n, i, r, o) {
function s(e, s) {
var a = Ln(t, r, e, s ? 'right' : 'left', o);
return s ? (a.left = a.right) : (a.right = a.left), Bn(t, i, a, n);
}
(i = i || at(t.doc, e.line)), r || (r = _n(t, i));
var a = Zt(i, t.doc.direction),
l = e.ch,
c = e.sticky;
if ((l >= i.text.length ? ((l = i.text.length), (c = 'before')) : l <= 0 && ((l = 0), (c = 'after')), !a))
return s('before' == c ? l - 1 : l, 'before' == c);
function u(t, e, n) {
var i = a[e],
r = 1 == i.level;
return s(n ? t - 1 : t, r != n);
}
var h = Xt(a, l, c),
d = Yt,
f = u(l, h, 'before' == c);
return null != d && (f.other = u(l, d, 'before' != c)), f;
}
function Kn(t, e) {
var n = 0;
(e = Ct(t.doc, e)), t.options.lineWrapping || (n = ei(t.display) * e.ch);
var i = at(t.doc, e.line),
r = qt(i) + Cn(t.display);
return { left: n, right: n, top: r, bottom: r + i.height };
}
function Gn(t, e, n, i, r) {
var o = gt(t, e, n);
return (o.xRel = r), i && (o.outside = !0), o;
}
function Yn(t, e, n) {
var i = t.doc;
if ((n += t.display.viewOffset) < 0) return Gn(i.first, 0, null, !0, -1);
var r = dt(i, n),
o = i.first + i.size - 1;
if (r > o) return Gn(i.first + i.size - 1, at(i, o).text.length, null, !0, 1);
e < 0 && (e = 0);
for (var s = at(i, r); ; ) {
var a = Qn(t, s, r, e, n),
l = zt(s, a.ch + (a.xRel > 0 ? 1 : 0));
if (!l) return a;
var c = l.find(1);
if (c.line == r) return c;
s = at(i, (r = c.line));
}
}
function Xn(t, e, n, i) {
i -= $n(e);
var r = e.text.length,
o = st(
function (e) {
return Ln(t, n, e - 1).bottom <= i;
},
r,
0,
);
return (
(r = st(
function (e) {
return Ln(t, n, e).top > i;
},
o,
r,
)),
{ begin: o, end: r }
);
}
function Jn(t, e, n, i) {
n || (n = _n(t, e));
var r = Bn(t, e, Ln(t, n, i), 'line').top;
return Xn(t, e, n, r);
}
function Zn(t, e, n, i) {
return !(t.bottom <= n) && (t.top > n || (i ? t.left : t.right) > e);
}
function Qn(t, e, n, i, r) {
r -= qt(e);
var o = _n(t, e),
s = $n(e),
a = 0,
l = e.text.length,
c = !0,
u = Zt(e, t.doc.direction);
if (u) {
var h = (
t.options.lineWrapping
? function (t, e, n, i, r, o, s) {
var a = Xn(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 = Ln(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 (t, e, n, i, r, o, s) {
var a = st(
function (a) {
var l = r[a],
c = 1 != l.level;
return Zn(qn(t, gt(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 = qn(t, gt(n, c ? l.from : l.to, c ? 'after' : 'before'), 'line', e, i);
Zn(u, o, s, !0) && u.top > s && (l = r[a - 1]);
}
return l;
}
)(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 = st(
function (e) {
var n = Ln(t, o, e);
return (
(n.top += s),
(n.bottom += s),
!!Zn(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'
: Ln(t, o, v - (c ? 1 : 0)).bottom + s <= r == c
? 'after'
: 'before');
var x = qn(t, gt(n, v, f), 'line', e, o);
(d = x.left), (m = r < x.top || r >= x.bottom);
}
return (v = ot(e.text, v, 1)), Gn(n, v, f, m, i - d);
}
function ti(t) {
if (null != t.cachedTextHeight) return t.cachedTextHeight;
if (null == Nn) {
Nn = O('pre');
for (var e = 0; e < 49; ++e) Nn.appendChild(document.createTextNode('x')), Nn.appendChild(O('br'));
Nn.appendChild(document.createTextNode('x'));
}
A(t.measure, Nn);
var n = Nn.offsetHeight / 50;
return n > 3 && (t.cachedTextHeight = n), M(t.measure), n || 1;
}
function ei(t) {
if (null != t.cachedCharWidth) return t.cachedCharWidth;
var e = O('span', 'xxxxxxxxxx'),
n = O('pre', [e]);
A(t.measure, n);
var i = e.getBoundingClientRect(),
r = (i.right - i.left) / 10;
return r > 2 && (t.cachedCharWidth = r), r || 10;
}
function ni(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: ii(e),
gutterTotalWidth: e.gutters.offsetWidth,
gutterLeft: n,
gutterWidth: i,
wrapperWidth: e.wrapper.clientWidth,
};
}
function ii(t) {
return t.scroller.getBoundingClientRect().left - t.sizer.getBoundingClientRect().left;
}
function ri(t) {
var e = ti(t.display),
n = t.options.lineWrapping,
i = n && Math.max(5, t.display.scroller.clientWidth / ei(t.display) - 3);
return function (r) {
if (Wt(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 oi(t) {
var e = t.doc,
n = ri(t);
e.iter(function (t) {
var e = n(t);
e != t.height && ut(t, e);
});
}
function si(t, e, n, i) {
var r = t.display;
if (!n && 'true' == de(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 = Yn(t, o, s);
if (i && 1 == c.xRel && (l = at(t.doc, c.line).text).length == c.ch) {
var u = j(l, l.length, t.options.tabSize) - l.length;
c = gt(c.line, Math.max(0, Math.round((o - Sn(t.display).left) / ei(t.display)) - u));
}
return c;
}
function ai(t, e) {
if (e >= t.display.viewTo) return null;
if ((e -= t.display.viewFrom) < 0) return null;
for (var n = t.display.view, i = 0; i < n.length; i++) if ((e -= n[i].size) < 0) return i;
}
function li(t) {
t.display.input.showSelection(t.display.input.prepareSelection());
}
function ci(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) && ui(t, a.head, r), l || di(t, a, o);
}
}
return i;
}
function ui(t, e, n) {
var i = qn(t, e, 'div', null, null, !t.options.singleCursorHeightPerLine),
r = n.appendChild(O('div', ' ', 'CodeMirror-cursor'));
if (
((r.style.left = i.left + 'px'),
(r.style.top = i.top + 'px'),
(r.style.height = Math.max(0, i.bottom - i.top) * t.options.cursorHeight + 'px'),
i.other)
) {
var o = n.appendChild(O('div', ' ', 'CodeMirror-cursor CodeMirror-secondarycursor'));
(o.style.display = ''),
(o.style.left = i.other.left + 'px'),
(o.style.top = i.other.top + 'px'),
(o.style.height = 0.85 * (i.other.bottom - i.other.top) + 'px');
}
}
function hi(t, e) {
return t.top - e.top || t.left - e.left;
}
function di(t, e, n) {
var i = t.display,
r = t.doc,
o = document.createDocumentFragment(),
s = Sn(t.display),
a = s.left,
l = Math.max(i.sizerWidth, En(t) - i.sizer.offsetLeft) - s.right,
c = 'ltr' == r.direction;
function u(t, e, n, i) {
e < 0 && (e = 0),
(e = Math.round(e)),
(i = Math.round(i)),
o.appendChild(
O(
'div',
null,
'CodeMirror-selected',
'position: absolute; left: ' +
t +
'px;\n top: ' +
e +
'px; width: ' +
(null == n ? l - t : n) +
'px;\n height: ' +
(i - e) +
'px',
),
);
}
function h(e, n, i) {
var o,
s,
h = at(r, e),
d = h.text.length;
function f(n, i) {
return Un(t, gt(e, n), 'div', h, i);
}
function p(e, n, i) {
var r = Jn(t, h, null, e),
o = ('ltr' == n) == ('after' == i) ? 'left' : 'right',
s = 'after' == i ? r.begin : r.end - (/\s/.test(h.text.charAt(r.end - 1)) ? 2 : 1);
return f(s, o)[o];
}
var g = Zt(h, r.direction);
return (
(function (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');
})(g, n || 0, null == i ? d : i, function (t, e, r, h) {
var v = 'ltr' == r,
m = f(t, v ? 'left' : 'right'),
y = f(e - 1, v ? 'right' : 'left'),
b = null == n && 0 == t,
x = null == i && e == d,
w = 0 == h,
C = !g || h == g.length - 1;
if (y.top - m.top <= 3) {
var k = (c ? b : x) && w,
S = (c ? x : b) && C,
T = k ? a : (v ? m : y).left,
E = S ? l : (v ? y : m).right;
u(T, m.top, E - T, m.bottom);
} else {
var M, A, O, P;
v
? ((M = c && b && w ? a : m.left),
(A = c ? l : p(t, r, 'before')),
(O = c ? a : p(e, r, 'after')),
(P = c && x && C ? l : y.right))
: ((M = c ? p(t, r, 'before') : a),
(A = !c && b && w ? l : m.right),
(O = !c && x && C ? a : y.left),
(P = c ? p(e, r, 'after') : l)),
u(M, m.top, A - M, m.bottom),
m.bottom < y.top && u(a, m.bottom, null, y.top),
u(O, y.top, P - O, y.bottom);
}
(!o || hi(m, o) < 0) && (o = m),
hi(y, o) < 0 && (o = y),
(!s || hi(m, s) < 0) && (s = m),
hi(y, s) < 0 && (s = y);
}),
{ start: o, end: s }
);
}
var d = e.from(),
f = e.to();
if (d.line == f.line) h(d.line, d.ch, f.ch);
else {
var p = at(r, d.line),
g = at(r, f.line),
v = Vt(p) == Vt(g),
m = h(d.line, d.ch, v ? p.text.length + 1 : null).end,
y = h(f.line, v ? 0 : null, f.ch).start;
v &&
(m.top < y.top - 2
? (u(m.right, m.top, null, m.bottom), u(a, y.top, y.left, y.bottom))
: u(m.right, m.top, y.left - m.right, m.bottom)),
m.bottom < y.top && u(a, m.bottom, null, y.top);
}
n.appendChild(o);
}
function fi(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 pi(t) {
t.state.focused || (t.display.input.focus(), vi(t));
}
function gi(t) {
(t.state.delayingBlurEvent = !0),
setTimeout(function () {
t.state.delayingBlurEvent && ((t.state.delayingBlurEvent = !1), mi(t));
}, 100);
}
function vi(t, e) {
t.state.delayingBlurEvent && (t.state.delayingBlurEvent = !1),
'nocursor' != t.options.readOnly &&
(t.state.focused ||
(ie(t, 'focus', t, e),
(t.state.focused = !0),
N(t.display.wrapper, 'CodeMirror-focused'),
t.curOp ||
t.display.selForContextMenu == t.doc.sel ||
(t.display.input.reset(),
l &&
setTimeout(function () {
return t.display.input.reset(!0);
}, 20)),
t.display.input.receivedFocus()),
fi(t));
}
function mi(t, e) {
t.state.delayingBlurEvent ||
(t.state.focused &&
(ie(t, 'blur', t, e), (t.state.focused = !1), E(t.display.wrapper, 'CodeMirror-focused')),
clearInterval(t.display.blinker),
setTimeout(function () {
t.state.focused || (t.display.shift = !1);
}, 150));
}
function yi(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 (s && a < 8) {
var l = r.node.offsetTop + r.node.offsetHeight;
(o = l - n), (n = l);
} else {
var c = r.node.getBoundingClientRect();
o = c.bottom - c.top;
}
var u = r.line.height - o;
if ((o < 2 && (o = ti(e)), (u > 0.005 || u < -0.005) && (ut(r.line, o), bi(r.line), r.rest)))
for (var h = 0; h < r.rest.length; h++) bi(r.rest[h]);
}
}
}
function bi(t) {
if (t.widgets)
for (var e = 0; e < t.widgets.length; ++e) {
var n = t.widgets[e],
i = n.node.parentNode;
i && (n.height = i.offsetHeight);
}
}
function xi(t, e, n) {
var i = n && null != n.top ? Math.max(0, n.top) : t.scroller.scrollTop;
i = Math.floor(i - Cn(t));
var r = n && null != n.bottom ? n.bottom : i + t.wrapper.clientHeight,
o = dt(e, i),
s = dt(e, r);
if (n && n.ensure) {
var a = n.ensure.from.line,
l = n.ensure.to.line;
a < o
? ((o = a), (s = dt(e, qt(at(e, a)) + t.wrapper.clientHeight)))
: Math.min(l, e.lastLine()) >= s && ((o = dt(e, qt(at(e, l)) - t.wrapper.clientHeight)), (s = l));
}
return { from: o, to: Math.max(s, o + 1) };
}
function wi(t) {
var e = t.display,
n = e.view;
if (e.alignWidgets || (e.gutters.firstChild && t.options.fixedGutter)) {
for (
var i = ii(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 Ci(t) {
if (!t.options.lineNumbers) return !1;
var e = t.doc,
n = pt(t.options, e.first + e.size - 1),
i = t.display;
if (n.length != i.lineNumChars) {
var r = i.measure.appendChild(O('div', [O('div', n)], 'CodeMirror-linenumber CodeMirror-gutter-elt')),
o = r.firstChild.offsetWidth,
s = r.offsetWidth - o;
return (
(i.lineGutter.style.width = ''),
(i.lineNumInnerWidth = Math.max(o, i.lineGutter.offsetWidth - s) + 1),
(i.lineNumWidth = i.lineNumInnerWidth + s),
(i.lineNumChars = i.lineNumInnerWidth ? n.length : -1),
(i.lineGutter.style.width = i.lineNumWidth + 'px'),
lr(t),
!0
);
}
return !1;
}
function ki(t, e) {
var n = t.display,
i = ti(t.display);
e.top < 0 && (e.top = 0);
var r = t.curOp && null != t.curOp.scrollTop ? t.curOp.scrollTop : n.scroller.scrollTop,
o = Mn(t),
s = {};
e.bottom - e.top > o && (e.bottom = e.top + o);
var a = t.doc.height + kn(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 = En(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 Si(t, e) {
null != e &&
(Mi(t), (t.curOp.scrollTop = (null == t.curOp.scrollTop ? t.doc.scrollTop : t.curOp.scrollTop) + e));
}
function Ti(t) {
Mi(t);
var e = t.getCursor();
t.curOp.scrollToPos = { from: e, to: e, margin: t.options.cursorScrollMargin };
}
function Ei(t, e, n) {
(null == e && null == n) || Mi(t),
null != e && (t.curOp.scrollLeft = e),
null != n && (t.curOp.scrollTop = n);
}
function Mi(t) {
var e = t.curOp.scrollToPos;
if (e) {
t.curOp.scrollToPos = null;
var n = Kn(t, e.from),
i = Kn(t, e.to);
Ai(t, n, i, e.margin);
}
}
function Ai(t, e, n, i) {
var r = ki(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,
});
Ei(t, r.scrollLeft, r.scrollTop);
}
function Oi(t, e) {
Math.abs(t.doc.scrollTop - e) < 2 || (n || ar(t, { top: e }), Pi(t, e, !0), n && ar(t), nr(t, 100));
}
function Pi(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 _i(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),
wi(t),
t.display.scroller.scrollLeft != e && (t.display.scroller.scrollLeft = e),
t.display.scrollbars.setScrollLeft(e));
}
function Li(t) {
var e = t.display,
n = e.gutters.offsetWidth,
i = Math.round(t.doc.height + kn(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 + Tn(t) + e.barHeight,
nativeBarWidth: e.nativeBarWidth,
gutterWidth: n,
};
}
var Ni = function (t, e, n) {
this.cm = n;
var i = (this.vert = O('div', [O('div', null, null, 'min-width: 1px')], 'CodeMirror-vscrollbar')),
r = (this.horiz = O(
'div',
[O('div', null, null, 'height: 100%; min-height: 1px')],
'CodeMirror-hscrollbar',
));
(i.tabIndex = r.tabIndex = -1),
t(i),
t(r),
te(i, 'scroll', function () {
i.clientHeight && e(i.scrollTop, 'vertical');
}),
te(r, 'scroll', function () {
r.clientWidth && e(r.scrollLeft, 'horizontal');
}),
(this.checkedZeroWidth = !1),
s && a < 8 && (this.horiz.style.minHeight = this.vert.style.minWidth = '18px');
};
(Ni.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 }
);
}),
(Ni.prototype.setScrollLeft = function (t) {
this.horiz.scrollLeft != t && (this.horiz.scrollLeft = t),
this.disableHoriz && this.enableZeroWidthBar(this.horiz, this.disableHoriz, 'horiz');
}),
(Ni.prototype.setScrollTop = function (t) {
this.vert.scrollTop != t && (this.vert.scrollTop = t),
this.disableVert && this.enableZeroWidthBar(this.vert, this.disableVert, 'vert');
}),
(Ni.prototype.zeroWidthHack = function () {
var t = y && !f ? '12px' : '18px';
(this.horiz.style.height = this.vert.style.width = t),
(this.horiz.style.pointerEvents = this.vert.style.pointerEvents = 'none'),
(this.disableHoriz = new z()),
(this.disableVert = new z());
}),
(Ni.prototype.enableZeroWidthBar = function (t, e, n) {
(t.style.pointerEvents = 'auto'),
e.set(1e3, 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);
});
}),
(Ni.prototype.clear = function () {
var t = this.horiz.parentNode;
t.removeChild(this.horiz), t.removeChild(this.vert);
});
var Di = function () {};
function Ii(t, e) {
e || (e = Li(t));
var n = t.display.barWidth,
i = t.display.barHeight;
Fi(t, e);
for (var r = 0; (r < 4 && n != t.display.barWidth) || i != t.display.barHeight; r++)
n != t.display.barWidth && t.options.lineWrapping && yi(t),
Fi(t, Li(t)),
(n = t.display.barWidth),
(i = t.display.barHeight);
}
function Fi(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 = '');
}
(Di.prototype.update = function () {
return { bottom: 0, right: 0 };
}),
(Di.prototype.setScrollLeft = function () {}),
(Di.prototype.setScrollTop = function () {}),
(Di.prototype.clear = function () {});
var Ri = { native: Ni, null: Di };
function ji(t) {
t.display.scrollbars &&
(t.display.scrollbars.clear(),
t.display.scrollbars.addClass && E(t.display.wrapper, t.display.scrollbars.addClass)),
(t.display.scrollbars = new Ri[t.options.scrollbarStyle](
function (e) {
t.display.wrapper.insertBefore(e, t.display.scrollbarFiller),
te(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 ? _i(t, e) : Oi(t, e);
},
t,
)),
t.display.scrollbars.addClass && N(t.display.wrapper, t.display.scrollbars.addClass);
}
var zi = 0;
function Hi(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: ++zi,
}),
(function (t) {
on ? on.ops.push(t) : (t.ownsGroup = on = { ops: [t], delayedCallbacks: [] });
})(t.curOp);
}
function Vi(t) {
var e = t.curOp;
!(function (t, e) {
var n = t.ownsGroup;
if (n)
try {
!(function (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);
})(n);
} finally {
(on = null), e(n);
}
})(e, function (t) {
for (var e = 0; e < t.ops.length; e++) t.ops[e].cm.curOp = null;
!(function (t) {
for (var e = t.ops, n = 0; n < e.length; n++) $i(e[n]);
for (var i = 0; i < e.length; i++) Bi(e[i]);
for (var r = 0; r < e.length; r++) Wi(e[r]);
for (var o = 0; o < e.length; o++) Ui(e[o]);
for (var s = 0; s < e.length; s++) qi(e[s]);
})(t);
});
}
function $i(t) {
var e = t.cm,
n = e.display;
!(function (t) {
var e = t.display;
!e.scrollbarsClipped &&
e.scroller.offsetWidth &&
((e.nativeBarWidth = e.scroller.offsetWidth - e.scroller.clientWidth),
(e.heightForcer.style.height = Tn(t) + 'px'),
(e.sizer.style.marginBottom = -e.nativeBarWidth + 'px'),
(e.sizer.style.borderRightWidth = Tn(t) + 'px'),
(e.scrollbarsClipped = !0));
})(e),
t.updateMaxLine && Gt(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 rr(e, t.mustUpdate && { top: t.scrollTop, ensure: t.scrollToPos }, t.forceUpdate));
}
function Bi(t) {
t.updatedDisplay = t.mustUpdate && or(t.cm, t.update);
}
function Wi(t) {
var e = t.cm,
n = e.display;
t.updatedDisplay && yi(e),
(t.barMeasure = Li(e)),
n.maxLineChanged &&
!e.options.lineWrapping &&
((t.adjustWidthTo = On(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 + Tn(e) + e.display.barWidth,
)),
(t.maxScrollLeft = Math.max(0, n.sizer.offsetLeft + t.adjustWidthTo - En(e)))),
(t.updatedDisplay || t.selectionChanged) && (t.preparedSelection = n.input.prepareSelection());
}
function Ui(t) {
var e = t.cm;
null != t.adjustWidthTo &&
((e.display.sizer.style.minWidth = t.adjustWidthTo + 'px'),
t.maxScrollLeft < e.doc.scrollLeft && _i(e, Math.min(e.display.scroller.scrollLeft, t.maxScrollLeft), !0),
(e.display.maxLineChanged = !1));
var n = t.focus && t.focus == L();
t.preparedSelection && e.display.input.showSelection(t.preparedSelection, n),
(t.updatedDisplay || t.startHeight != e.doc.height) && Ii(e, t.barMeasure),
t.updatedDisplay && cr(e, t.barMeasure),
t.selectionChanged && fi(e),
e.state.focused && t.updateInput && e.display.input.reset(t.typing),
n && pi(t.cm);
}
function qi(t) {
var e = t.cm,
n = e.display,
i = e.doc;
if (
(t.updatedDisplay && sr(e, t.update),
null == n.wheelStartX ||
(null == t.scrollTop && null == t.scrollLeft && !t.scrollToPos) ||
(n.wheelStartX = n.wheelStartY = null),
null != t.scrollTop && Pi(e, t.scrollTop, t.forceScroll),
null != t.scrollLeft && _i(e, t.scrollLeft, !0, !0),
t.scrollToPos)
) {
var r = (function (t, e, n, i) {
var r;
null == i && (i = 0),
t.options.lineWrapping ||
e != n ||
((e = e.ch ? gt(e.line, 'before' == e.sticky ? e.ch - 1 : e.ch, 'after') : e),
(n = 'before' == e.sticky ? gt(e.line, e.ch + 1, 'before') : e));
for (var o = 0; o < 5; o++) {
var s = !1,
a = qn(t, e),
l = n && n != e ? qn(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 = ki(t, r),
u = t.doc.scrollTop,
h = t.doc.scrollLeft;
if (
(null != c.scrollTop && (Oi(t, c.scrollTop), Math.abs(t.doc.scrollTop - u) > 1 && (s = !0)),
null != c.scrollLeft && (_i(t, c.scrollLeft), Math.abs(t.doc.scrollLeft - h) > 1 && (s = !0)),
!s)
)
break;
}
return r;
})(e, Ct(i, t.scrollToPos.from), Ct(i, t.scrollToPos.to), t.scrollToPos.margin);
!(function (t, e) {
if (!re(t, 'scrollCursorIntoView')) {
var n = t.display,
i = n.sizer.getBoundingClientRect(),
r = null;
if (
(e.top + i.top < 0
? (r = !0)
: e.bottom + i.top > (window.innerHeight || document.documentElement.clientHeight) && (r = !1),
null != r && !p)
) {
var o = O(
'div',
'​',
null,
'position: absolute;\n top: ' +
(e.top - n.viewOffset - Cn(t.display)) +
'px;\n height: ' +
(e.bottom - e.top + Tn(t) + n.barHeight) +
'px;\n left: ' +
e.left +
'px; width: ' +
Math.max(2, e.right - e.left) +
'px;',
);
t.display.lineSpace.appendChild(o), o.scrollIntoView(r), t.display.lineSpace.removeChild(o);
}
}
})(e, r);
}
var o = t.maybeHiddenMarkers,
s = t.maybeUnhiddenMarkers;
if (o) for (var a = 0; a < o.length; ++a) o[a].lines.length || ie(o[a], 'hide');
if (s) for (var l = 0; l < s.length; ++l) s[l].lines.length && ie(s[l], 'unhide');
n.wrapper.offsetHeight && (i.scrollTop = e.display.scroller.scrollTop),
t.changeObjs && ie(e, 'changes', e, t.changeObjs),
t.update && t.update.finish();
}
function Ki(t, e) {
if (t.curOp) return e();
Hi(t);
try {
return e();
} finally {
Vi(t);
}
}
function Gi(t, e) {
return function () {
if (t.curOp) return e.apply(t, arguments);
Hi(t);
try {
return e.apply(t, arguments);
} finally {
Vi(t);
}
};
}
function Yi(t) {
return function () {
if (this.curOp) return t.apply(this, arguments);
Hi(this);
try {
return t.apply(this, arguments);
} finally {
Vi(this);
}
};
}
function Xi(t) {
return function () {
var e = this.cm;
if (!e || e.curOp) return t.apply(this, arguments);
Hi(e);
try {
return t.apply(this, arguments);
} finally {
Vi(e);
}
};
}
function Ji(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)
)
Tt && $t(t.doc, e) < r.viewTo && Qi(t);
else if (n <= r.viewFrom) Tt && Bt(t.doc, n + i) > r.viewFrom ? Qi(t) : ((r.viewFrom += i), (r.viewTo += i));
else if (e <= r.viewFrom && n >= r.viewTo) Qi(t);
else if (e <= r.viewFrom) {
var o = tr(t, n, n + i, 1);
o ? ((r.view = r.view.slice(o.index)), (r.viewFrom = o.lineN), (r.viewTo += i)) : Qi(t);
} else if (n >= r.viewTo) {
var s = tr(t, e, e, -1);
s ? ((r.view = r.view.slice(0, s.index)), (r.viewTo = s.lineN)) : Qi(t);
} else {
var a = tr(t, e, e, -1),
l = tr(t, n, n + i, 1);
a && l
? ((r.view = r.view
.slice(0, a.index)
.concat(rn(t, a.lineN, l.lineN))
.concat(r.view.slice(l.index))),
(r.viewTo += i))
: Qi(t);
}
var c = r.externalMeasured;
c && (n < c.lineN ? (c.lineN += i) : e < c.lineN + c.size && (r.externalMeasured = null));
}
function Zi(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[ai(t, e)];
if (null != o.node) {
var s = o.changes || (o.changes = []);
-1 == H(s, n) && s.push(n);
}
}
}
function Qi(t) {
(t.display.viewFrom = t.display.viewTo = t.doc.first), (t.display.view = []), (t.display.viewOffset = 0);
}
function tr(t, e, n, i) {
var r,
o = ai(t, e),
s = t.display.view;
if (!Tt || 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 (; $t(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 er(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 nr(t, e) {
t.doc.highlightFrontier < t.display.viewTo && t.state.highlight.set(e, F(ir, t));
}
function ir(t) {
var e = t.doc;
if (!(e.highlightFrontier >= t.display.viewTo)) {
var n = +new Date() + t.options.workTime,
i = Re(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 ? Oe(e.mode, i.state) : null,
l = Ie(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 && je(t, o.text, i),
(o.stateAfter = i.line % 5 == 0 ? i.save() : null),
i.nextLine();
if (+new Date() > n) return nr(t, t.options.workDelay), !0;
}),
(e.highlightFrontier = i.line),
(e.modeFrontier = Math.max(e.modeFrontier, i.line)),
r.length &&
Ki(t, function () {
for (var e = 0; e < r.length; e++) Zi(t, r[e], 'text');
});
}
}
var rr = function (t, e, n) {
var i = t.display;
(this.viewport = e),
(this.visible = xi(i, t.doc, e)),
(this.editorIsHidden = !i.wrapper.offsetWidth),
(this.wrapperHeight = i.wrapper.clientHeight),
(this.wrapperWidth = i.wrapper.clientWidth),
(this.oldDisplayWidth = En(t)),
(this.force = n),
(this.dims = ni(t)),
(this.events = []);
};
function or(t, e) {
var n = t.display,
i = t.doc;
if (e.editorIsHidden) return Qi(t), !1;
if (
!e.force &&
e.visible.from >= n.viewFrom &&
e.visible.to <= n.viewTo &&
(null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo) &&
n.renderedView == n.view &&
0 == er(t)
)
return !1;
Ci(t) && (Qi(t), (e.dims = ni(t)));
var r = i.first + i.size,
o = Math.max(e.visible.from - t.options.viewportMargin, i.first),
s = Math.min(r, e.visible.to + t.options.viewportMargin);
n.viewFrom < o && o - n.viewFrom < 20 && (o = Math.max(i.first, n.viewFrom)),
n.viewTo > s && n.viewTo - s < 20 && (s = Math.min(r, n.viewTo)),
Tt && ((o = $t(t.doc, o)), (s = Bt(t.doc, s)));
var a =
o != n.viewFrom ||
s != n.viewTo ||
n.lastWrapHeight != e.wrapperHeight ||
n.lastWrapWidth != e.wrapperWidth;
!(function (t, e, n) {
var i = t.display;
0 == i.view.length || e >= i.viewTo || n <= i.viewFrom
? ((i.view = rn(t, e, n)), (i.viewFrom = e))
: (i.viewFrom > e
? (i.view = rn(t, e, i.viewFrom).concat(i.view))
: i.viewFrom < e && (i.view = i.view.slice(ai(t, e))),
(i.viewFrom = e),
i.viewTo < n
? (i.view = i.view.concat(rn(t, i.viewTo, n)))
: i.viewTo > n && (i.view = i.view.slice(0, ai(t, n)))),
(i.viewTo = n);
})(t, o, s),
(n.viewOffset = qt(at(t.doc, n.viewFrom))),
(t.display.mover.style.top = n.viewOffset + 'px');
var c = er(t);
if (
!a &&
0 == c &&
!e.force &&
n.renderedView == n.view &&
(null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo)
)
return !1;
var u = (function (t) {
if (t.hasFocus()) return null;
var e = L();
if (!e || !_(t.display.lineDiv, e)) return null;
var n = { activeElt: e };
if (window.getSelection) {
var i = window.getSelection();
i.anchorNode &&
i.extend &&
_(t.display.lineDiv, i.anchorNode) &&
((n.anchorNode = i.anchorNode),
(n.anchorOffset = i.anchorOffset),
(n.focusNode = i.focusNode),
(n.focusOffset = i.focusOffset));
}
return n;
})(t);
return (
c > 4 && (n.lineDiv.style.display = 'none'),
(function (t, e, n) {
var i = t.display,
r = t.options.lineNumbers,
o = i.lineDiv,
s = o.firstChild;
function a(e) {
var n = e.nextSibling;
return (
l && y && t.display.currentWheelTarget == e
? (e.style.display = 'none')
: e.parentNode.removeChild(e),
n
);
}
for (var c = i.view, u = i.viewFrom, h = 0; h < c.length; h++) {
var d = c[h];
if (d.hidden);
else if (d.node && d.node.parentNode == o) {
for (; s != d.node; ) s = a(s);
var f = r && null != e && e <= u && d.lineNumber;
d.changes && (H(d.changes, 'gutter') > -1 && (f = !1), cn(t, d, u, n)),
f && (M(d.lineNumber), d.lineNumber.appendChild(document.createTextNode(pt(t.options, u)))),
(s = d.node.nextSibling);
} else {
var p = vn(t, d, u, n);
o.insertBefore(p, s);
}
u += d.size;
}
for (; s; ) s = a(s);
})(t, n.updateLineNumbers, e.dims),
c > 4 && (n.lineDiv.style.display = ''),
(n.renderedView = n.view),
(function (t) {
if (
t &&
t.activeElt &&
t.activeElt != L() &&
(t.activeElt.focus(), t.anchorNode && _(document.body, t.anchorNode) && _(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);
}
})(u),
M(n.cursorDiv),
M(n.selectionDiv),
(n.gutters.style.height = n.sizer.style.minHeight = 0),
a && ((n.lastWrapHeight = e.wrapperHeight), (n.lastWrapWidth = e.wrapperWidth), nr(t, 400)),
(n.updateLineNumbers = null),
!0
);
}
function sr(t, e) {
for (
var n = e.viewport, i = !0;
((i && t.options.lineWrapping && e.oldDisplayWidth != En(t)) ||
(n && null != n.top && (n = { top: Math.min(t.doc.height + kn(t.display) - Mn(t), n.top) }),
(e.visible = xi(t.display, t.doc, n)),
!(e.visible.from >= t.display.viewFrom && e.visible.to <= t.display.viewTo))) &&
or(t, e);
i = !1
) {
yi(t);
var r = Li(t);
li(t), Ii(t, r), cr(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 ar(t, e) {
var n = new rr(t, e);
if (or(t, n)) {
yi(t), sr(t, n);
var i = Li(t);
li(t), Ii(t, i), cr(t, i), n.finish();
}
}
function lr(t) {
var e = t.display.gutters.offsetWidth;
t.display.sizer.style.marginLeft = e + 'px';
}
function cr(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 + Tn(t) + 'px');
}
function ur(t) {
var e = t.display.gutters,
n = t.options.gutters;
M(e);
for (var i = 0; i < n.length; ++i) {
var r = n[i],
o = e.appendChild(O('div', null, 'CodeMirror-gutter ' + r));
'CodeMirror-linenumbers' == r &&
((t.display.lineGutter = o), (o.style.width = (t.display.lineNumWidth || 1) + 'px'));
}
(e.style.display = i ? '' : 'none'), lr(t);
}
function hr(t) {
var e = H(t.gutters, 'CodeMirror-linenumbers');
-1 == e && t.lineNumbers
? (t.gutters = t.gutters.concat(['CodeMirror-linenumbers']))
: e > -1 && !t.lineNumbers && ((t.gutters = t.gutters.slice(0)), t.gutters.splice(e, 1));
}
(rr.prototype.signal = function (t, e) {
se(t, e) && this.events.push(arguments);
}),
(rr.prototype.finish = function () {
for (var t = 0; t < this.events.length; t++) ie.apply(null, this.events[t]);
});
var dr = 0,
fr = null;
function pr(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 gr(t) {
var e = pr(t);
return (e.x *= fr), (e.y *= fr), e;
}
function vr(t, e) {
var i = pr(e),
r = i.x,
o = i.y,
s = t.display,
a = s.scroller,
c = a.scrollWidth > a.clientWidth,
u = a.scrollHeight > a.clientHeight;
if ((r && c) || (o && u)) {
if (o && y && l)
t: for (var d = e.target, f = s.view; d != a; d = d.parentNode)
for (var p = 0; p < f.length; p++)
if (f[p].node == d) {
t.display.currentWheelTarget = d;
break t;
}
if (r && !n && !h && null != fr)
return (
o && u && Oi(t, Math.max(0, a.scrollTop + o * fr)),
_i(t, Math.max(0, a.scrollLeft + r * fr)),
(!o || (o && u)) && le(e),
void (s.wheelStartX = null)
);
if (o && null != fr) {
var g = o * fr,
v = t.doc.scrollTop,
m = v + s.wrapper.clientHeight;
g < 0 ? (v = Math.max(0, v + g - 50)) : (m = Math.min(t.doc.height, m + g + 50)),
ar(t, { top: v, bottom: m });
}
dr < 20 &&
(null == s.wheelStartX
? ((s.wheelStartX = a.scrollLeft),
(s.wheelStartY = a.scrollTop),
(s.wheelDX = r),
(s.wheelDY = o),
setTimeout(function () {
if (null != s.wheelStartX) {
var t = a.scrollLeft - s.wheelStartX,
e = a.scrollTop - s.wheelStartY,
n = (e && s.wheelDY && e / s.wheelDY) || (t && s.wheelDX && t / s.wheelDX);
(s.wheelStartX = s.wheelStartY = null), n && ((fr = (fr * dr + n) / (dr + 1)), ++dr);
}
}, 200))
: ((s.wheelDX += r), (s.wheelDY += o)));
}
}
s ? (fr = -0.53) : n ? (fr = 15) : u ? (fr = -0.7) : d && (fr = -1 / 3);
var mr = function (t, e) {
(this.ranges = t), (this.primIndex = e);
};
(mr.prototype.primary = function () {
return this.ranges[this.primIndex];
}),
(mr.prototype.equals = function (t) {
if (t == this) return !0;
if (t.primIndex != this.primIndex || t.ranges.length != this.ranges.length) return !1;
for (var e = 0; e < this.ranges.length; e++) {
var n = this.ranges[e],
i = t.ranges[e];
if (!mt(n.anchor, i.anchor) || !mt(n.head, i.head)) return !1;
}
return !0;
}),
(mr.prototype.deepCopy = function () {
for (var t = [], e = 0; e < this.ranges.length; e++)
t[e] = new yr(yt(this.ranges[e].anchor), yt(this.ranges[e].head));
return new mr(t, this.primIndex);
}),
(mr.prototype.somethingSelected = function () {
for (var t = 0; t < this.ranges.length; t++) if (!this.ranges[t].empty()) return !0;
return !1;
}),
(mr.prototype.contains = function (t, e) {
e || (e = t);
for (var n = 0; n < this.ranges.length; n++) {
var i = this.ranges[n];
if (vt(e, i.from()) >= 0 && vt(t, i.to()) <= 0) return n;
}
return -1;
});
var yr = function (t, e) {
(this.anchor = t), (this.head = e);
};
function br(t, e) {
var n = t[e];
t.sort(function (t, e) {
return vt(t.from(), e.from());
}),
(e = H(t, n));
for (var i = 1; i < t.length; i++) {
var r = t[i],
o = t[i - 1];
if (vt(o.to(), r.from()) >= 0) {
var s = xt(o.from(), r.from()),
a = bt(o.to(), r.to()),
l = o.empty() ? r.from() == r.head : o.from() == o.head;
i <= e && --e, t.splice(--i, 2, new yr(l ? a : s, l ? s : a));
}
}
return new mr(t, e);
}
function xr(t, e) {
return new mr([new yr(t, e || t)], 0);
}
function wr(t) {
return t.text
? gt(t.from.line + t.text.length - 1, Y(t.text).length + (1 == t.text.length ? t.from.ch : 0))
: t.to;
}
function Cr(t, e) {
if (vt(t, e.from) < 0) return t;
if (vt(t, e.to) <= 0) return wr(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 += wr(e).ch - e.to.ch), gt(n, i);
}
function kr(t, e) {
for (var n = [], i = 0; i < t.sel.ranges.length; i++) {
var r = t.sel.ranges[i];
n.push(new yr(Cr(r.anchor, e), Cr(r.head, e)));
}
return br(n, t.sel.primIndex);
}
function Sr(t, e, n) {
return t.line == e.line ? gt(n.line, t.ch - e.ch + n.ch) : gt(n.line + (t.line - e.line), t.ch);
}
function Tr(t) {
(t.doc.mode = Ee(t.options, t.doc.modeOption)), Er(t);
}
function Er(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),
nr(t, 100),
t.state.modeGen++,
t.curOp && Ji(t);
}
function Mr(t, e) {
return 0 == e.from.ch && 0 == e.to.ch && '' == Y(e.text) && (!t.cm || t.cm.options.wholeLineUpdateBefore);
}
function Ar(t, e, n, i) {
function r(t) {
return n ? n[t] : null;
}
function o(t, n, r) {
!(function (t, e, n, i) {
(t.text = e),
t.stateAfter && (t.stateAfter = null),
t.styles && (t.styles = null),
null != t.order && (t.order = null),
_t(t),
Lt(t, n);
var r = i ? i(t) : 1;
r != t.height && ut(t, r);
})(t, n, r, i),
an(t, 'change', t, e);
}
function s(t, e) {
for (var n = [], o = t; o < e; ++o) n.push(new Ue(c[o], r(o), i));
return n;
}
var a = e.from,
l = e.to,
c = e.text,
u = at(t, a.line),
h = at(t, l.line),
d = Y(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 (Mr(t, e)) {
var g = s(0, c.length - 1);
o(h, h.text, f), p && t.remove(a.line, p), g.length && t.insert(a.line, g);
} 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 v = s(1, c.length - 1);
v.push(new Ue(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, v);
}
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 m = s(1, c.length - 1);
p > 1 && t.remove(a.line + 1, p - 1), t.insert(a.line + 1, m);
}
an(t, 'change', t, e);
}
function Or(t, e, n) {
!(function t(i, r, o) {
if (i.linked)
for (var s = 0; s < i.linked.length; ++s) {
var a = i.linked[s];
if (a.doc != r) {
var l = o && a.sharedHist;
(n && !l) || (e(a.doc, l), t(a.doc, i, l));
}
}
})(t, null, !0);
}
function Pr(t, e) {
if (e.cm) throw new Error('This document is already in use.');
(t.doc = e),
(e.cm = t),
oi(t),
Tr(t),
_r(t),
t.options.lineWrapping || Gt(t),
(t.options.mode = e.modeOption),
Ji(t);
}
function _r(t) {
('rtl' == t.doc.direction ? N : E)(t.display.lineDiv, 'CodeMirror-rtl');
}
function Lr(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 Nr(t, e) {
var n = { from: yt(e.from), to: wr(e), text: lt(t, e.from, e.to) };
return (
jr(t, n, e.from.line, e.to.line + 1),
Or(
t,
function (t) {
return jr(t, n, e.from.line, e.to.line + 1);
},
!0,
),
n
);
}
function Dr(t) {
for (; t.length; ) {
var e = Y(t);
if (!e.ranges) break;
t.pop();
}
}
function Ir(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) && r.lastModTime > a - (t.cm ? t.cm.options.historyEventDelay : 500)) ||
'*' == e.origin.charAt(0)))) &&
(o = (function (t, e) {
return e
? (Dr(t.done), Y(t.done))
: t.done.length && !Y(t.done).ranges
? Y(t.done)
: t.done.length > 1 && !t.done[t.done.length - 2].ranges
? (t.done.pop(), Y(t.done))
: void 0;
})(r, r.lastOp == i))
)
(s = Y(o.changes)),
0 == vt(e.from, e.to) && 0 == vt(e.from, s.to) ? (s.to = wr(e)) : o.changes.push(Nr(t, e));
else {
var l = Y(r.done);
for (
(l && l.ranges) || Rr(t.sel, r.done),
o = { changes: [Nr(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 || ie(t, 'historyAdded');
}
function Fr(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) ||
(function (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))
);
})(t, o, Y(r.done), e)))
? (r.done[r.done.length - 1] = e)
: Rr(e, r.done),
(r.lastSelTime = +new Date()),
(r.lastSelOrigin = o),
(r.lastSelOp = n),
i && !1 !== i.clearRedo && Dr(r.undone);
}
function Rr(t, e) {
var n = Y(e);
(n && n.ranges && n.equals(t)) || e.push(t);
}
function jr(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 zr(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 Hr(t, e) {
var n = (function (t, e) {
var n = e['spans_' + t.id];
if (!n) return null;
for (var i = [], r = 0; r < e.text.length; ++r) i.push(zr(n[r]));
return i;
})(t, e),
i = Ot(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 Vr(t, e, n) {
for (var i = [], r = 0; r < t.length; ++r) {
var o = t[r];
if (o.ranges) i.push(n ? mr.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+)$/)) && H(e, Number(u[1])) > -1 && ((Y(a)[h] = c[h]), delete c[h]);
}
}
}
return i;
}
function $r(t, e, n, i) {
if (i) {
var r = t.anchor;
if (n) {
var o = vt(e, r) < 0;
o != vt(n, r) < 0 ? ((r = e), (e = n)) : o != vt(e, n) < 0 && (e = n);
}
return new yr(r, e);
}
return new yr(n || e, e);
}
function Br(t, e, n, i, r) {
null == r && (r = t.cm && (t.cm.display.shift || t.extend)),
Gr(t, new mr([$r(t.sel.primary(), e, n, r)], 0), i);
}
function Wr(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] = $r(t.sel.ranges[o], e[o], null, r);
var s = br(i, t.sel.primIndex);
Gr(t, s, n);
}
function Ur(t, e, n, i) {
var r = t.sel.ranges.slice(0);
(r[e] = n), Gr(t, br(r, t.sel.primIndex), i);
}
function qr(t, e, n, i) {
Gr(t, xr(e, n), i);
}
function Kr(t, e, n) {
var i = t.history.done,
r = Y(i);
r && r.ranges ? ((i[i.length - 1] = e), Yr(t, e, n)) : Gr(t, e, n);
}
function Gr(t, e, n) {
Yr(t, e, n), Fr(t, t.sel, t.cm ? t.cm.curOp.id : NaN, n);
}
function Yr(t, e, n) {
(se(t, 'beforeSelectionChange') || (t.cm && se(t.cm, 'beforeSelectionChange'))) &&
(e = (function (t, e, n) {
var i = {
ranges: e.ranges,
update: function (e) {
this.ranges = [];
for (var n = 0; n < e.length; n++) this.ranges[n] = new yr(Ct(t, e[n].anchor), Ct(t, e[n].head));
},
origin: n && n.origin,
};
return (
ie(t, 'beforeSelectionChange', t, i),
t.cm && ie(t.cm, 'beforeSelectionChange', t.cm, i),
i.ranges != e.ranges ? br(i.ranges, i.ranges.length - 1) : e
);
})(t, e, n));
var i = (n && n.bias) || (vt(e.primary().head, t.sel.primary().head) < 0 ? -1 : 1);
Xr(t, Zr(t, e, i, !0)), (n && !1 === n.scroll) || !t.cm || Ti(t.cm);
}
function Xr(t, e) {
e.equals(t.sel) ||
((t.sel = e),
t.cm && ((t.cm.curOp.updateInput = t.cm.curOp.selectionChanged = !0), oe(t.cm)),
an(t, 'cursorActivity', t));
}
function Jr(t) {
Xr(t, Zr(t, t.sel, null, !1));
}
function Zr(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 = to(t, s.anchor, a && a.anchor, n, i),
c = to(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 yr(l, c)));
}
return r ? br(r, e.primIndex) : e;
}
function Qr(t, e, n, i, r) {
var o = at(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 && (ie(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 = eo(t, c, -i, c && c.line == e.line ? o : null)),
c && c.line == e.line && (u = vt(c, n)) && (i < 0 ? u < 0 : u > 0))
)
return Qr(t, c, e, i, r);
}
var h = l.find(i < 0 ? -1 : 1);
return (
(i < 0 ? l.inclusiveLeft : l.inclusiveRight) && (h = eo(t, h, i, h.line == e.line ? o : null)),
h ? Qr(t, h, e, i, r) : null
);
}
}
return e;
}
function to(t, e, n, i, r) {
var o = i || 1,
s = Qr(t, e, n, o, r) || (!r && Qr(t, e, n, o, !0)) || Qr(t, e, n, -o, r) || (!r && Qr(t, e, n, -o, !0));
return s || ((t.cantEdit = !0), gt(t.first, 0));
}
function eo(t, e, n, i) {
return n < 0 && 0 == e.ch
? e.line > t.first
? Ct(t, gt(e.line - 1))
: null
: n > 0 && e.ch == (i || at(t, e.line)).text.length
? e.line < t.first + t.size - 1
? gt(e.line + 1, 0)
: null
: new gt(e.line, e.ch + n);
}
function no(t) {
t.setSelection(gt(t.firstLine(), 0), gt(t.lastLine()), B);
}
function io(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 = Ct(t, e)), n && (i.to = Ct(t, n)), r && (i.text = r), void 0 !== o && (i.origin = o);
}),
ie(t, 'beforeChange', t, i),
t.cm && ie(t.cm, 'beforeChange', t.cm, i),
i.canceled ? null : { from: i.from, to: i.to, text: i.text, origin: i.origin }
);
}
function ro(t, e, n) {
if (t.cm) {
if (!t.cm.curOp) return Gi(t.cm, ro)(t, e, n);
if (t.cm.state.suppressEdits) return;
}
if (!(se(t, 'beforeChange') || (t.cm && se(t.cm, 'beforeChange'))) || (e = io(t, e, !0))) {
var i =
St &&
!n &&
(function (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 && -1 != H(i, n)) || (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 (!(vt(c.to, a.from) < 0 || vt(c.from, a.to) > 0)) {
var u = [l, 1],
h = vt(c.from, a.from),
d = vt(c.to, a.to);
(h < 0 || (!s.inclusiveLeft && !h)) && u.push({ from: c.from, to: a.from }),
(d > 0 || (!s.inclusiveRight && !d)) && u.push({ from: a.to, to: c.to }),
r.splice.apply(r, u),
(l += u.length - 3);
}
}
return r;
})(t, e.from, e.to);
if (i)
for (var r = i.length - 1; r >= 0; --r)
oo(t, { from: i[r].from, to: i[r].to, text: r ? [''] : e.text, origin: e.origin });
else oo(t, e);
}
}
function oo(t, e) {
if (1 != e.text.length || '' != e.text[0] || 0 != vt(e.from, e.to)) {
var n = kr(t, e);
Ir(t, e, n, t.cm ? t.cm.curOp.id : NaN), lo(t, e, n, Ot(t, e));
var i = [];
Or(t, function (t, n) {
n || -1 != H(i, t.history) || (fo(t.history, e), i.push(t.history)), lo(t, e, null, Ot(t, e));
});
}
}
function so(t, e, n) {
var i = t.cm && t.cm.state.suppressEdits;
if (!i || n) {
for (
var r,
o = t.history,
s = t.sel,
a = 'undo' == e ? o.done : o.undone,
l = 'undo' == e ? o.undone : o.done,
c = 0;
c < a.length && ((r = a[c]), n ? !r.ranges || r.equals(t.sel) : r.ranges);
c++
);
if (c != a.length) {
for (o.lastOrigin = o.lastSelOrigin = null; ; ) {
if (!(r = a.pop()).ranges) {
if (i) return void a.push(r);
break;
}
if ((Rr(r, l), n && !r.equals(t.sel))) return void Gr(t, r, { clearRedo: !1 });
s = r;
}
var u = [];
Rr(s, l),
l.push({ changes: u, generation: o.generation }),
(o.generation = r.generation || ++o.maxGeneration);
for (
var h = se(t, 'beforeChange') || (t.cm && se(t.cm, 'beforeChange')),
d = function (n) {
var i = r.changes[n];
if (((i.origin = e), h && !io(t, i, !1))) return (a.length = 0), {};
u.push(Nr(t, i));
var o = n ? kr(t, i) : Y(a);
lo(t, i, o, Hr(t, i)), !n && t.cm && t.cm.scrollIntoView({ from: i.from, to: wr(i) });
var s = [];
Or(t, function (t, e) {
e || -1 != H(s, t.history) || (fo(t.history, i), s.push(t.history)), lo(t, i, null, Hr(t, i));
});
},
f = r.changes.length - 1;
f >= 0;
--f
) {
var p = d(f);
if (p) return p.v;
}
}
}
}
function ao(t, e) {
if (
0 != e &&
((t.first += e),
(t.sel = new mr(
X(t.sel.ranges, function (t) {
return new yr(gt(t.anchor.line + e, t.anchor.ch), gt(t.head.line + e, t.head.ch));
}),
t.sel.primIndex,
)),
t.cm)
) {
Ji(t.cm, t.first, t.first - e, e);
for (var n = t.cm.display, i = n.viewFrom; i < n.viewTo; i++) Zi(t.cm, i, 'gutter');
}
}
function lo(t, e, n, i) {
if (t.cm && !t.cm.curOp) return Gi(t.cm, lo)(t, e, n, i);
if (e.to.line < t.first) ao(t, e.text.length - 1 - (e.to.line - e.from.line));
else if (!(e.from.line > t.lastLine())) {
if (e.from.line < t.first) {
var r = e.text.length - 1 - (t.first - e.from.line);
ao(t, r),
(e = { from: gt(t.first, 0), to: gt(e.to.line + r, e.to.ch), text: [Y(e.text)], origin: e.origin });
}
var o = t.lastLine();
e.to.line > o &&
(e = { from: e.from, to: gt(o, at(t, o).text.length), text: [e.text[0]], origin: e.origin }),
(e.removed = lt(t, e.from, e.to)),
n || (n = kr(t, e)),
t.cm
? (function (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 = ht(Vt(at(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 && oe(t),
Ar(i, e, n, ri(t)),
t.options.lineWrapping ||
(i.iter(l, o.line + e.text.length, function (t) {
var e = Kt(t);
e > r.maxLineLength &&
((r.maxLine = t), (r.maxLineLength = e), (r.maxLineChanged = !0), (a = !1));
}),
a && (t.curOp.updateMaxLine = !0)),
(function (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 = at(t, i).stateAfter;
if (r && (!(r instanceof Ne) || i + r.lookAhead < e)) {
n = i + 1;
break;
}
}
t.highlightFrontier = Math.min(t.highlightFrontier, n);
}
})(i, o.line),
nr(t, 400);
var c = e.text.length - (s.line - o.line) - 1;
e.full
? Ji(t)
: o.line != s.line || 1 != e.text.length || Mr(t.doc, e)
? Ji(t, o.line, s.line + 1, c)
: Zi(t, o.line, 'text');
var u = se(t, 'changes'),
h = se(t, 'change');
if (h || u) {
var d = { from: o, to: s, text: e.text, removed: e.removed, origin: e.origin };
h && an(t, 'change', t, d), u && (t.curOp.changeObjs || (t.curOp.changeObjs = [])).push(d);
}
t.display.selForContextMenu = null;
})(t.cm, e, i)
: Ar(t, e, i),
Yr(t, n, B);
}
}
function co(t, e, n, i, r) {
var o;
i || (i = n),
vt(i, n) < 0 && ((n = (o = [i, n])[0]), (i = o[1])),
'string' == typeof e && (e = t.splitLines(e)),
ro(t, { from: n, to: i, text: e, origin: r });
}
function uo(t, e, n, i) {
n < t.line ? (t.line += i) : e < t.line && ((t.line = e), (t.ch = 0));
}
function ho(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()).copied = !0);
for (var a = 0; a < o.ranges.length; a++) uo(o.ranges[a].anchor, e, n, i), uo(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 = gt(c.from.line + i, c.from.ch)), (c.to = gt(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 fo(t, e) {
var n = e.from.line,
i = e.to.line,
r = e.text.length - (i - n) - 1;
ho(t.done, n, i, r), ho(t.undone, n, i, r);
}
function po(t, e, n, i) {
var r = e,
o = e;
return (
'number' == typeof e ? (o = at(t, wt(t, e))) : (r = ht(e)),
null == r ? null : (i(o, r) && t.cm && Zi(t.cm, r, n), o)
);
}
function go(t) {
(this.lines = t), (this.parent = null);
for (var e = 0, n = 0; n < t.length; ++n) (t[n].parent = this), (e += t[n].height);
this.height = e;
}
function vo(t) {
this.children = t;
for (var e = 0, n = 0, i = 0; i < t.length; ++i) {
var r = t[i];
(e += r.chunkSize()), (n += r.height), (r.parent = this);
}
(this.size = e), (this.height = n), (this.parent = null);
}
(yr.prototype.from = function () {
return xt(this.anchor, this.head);
}),
(yr.prototype.to = function () {
return bt(this.anchor, this.head);
}),
(yr.prototype.empty = function () {
return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;
}),
(go.prototype = {
chunkSize: function () {
return this.lines.length;
},
removeInner: function (t, e) {
for (var n = t, i = t + e; n < i; ++n) {
var r = this.lines[n];
(this.height -= r.height), qe(r), an(r, 'delete');
}
this.lines.splice(t, e);
},
collapse: function (t) {
t.push.apply(t, this.lines);
},
insertInner: function (t, e, n) {
(this.height += n), (this.lines = this.lines.slice(0, t).concat(e).concat(this.lines.slice(t)));
for (var i = 0; i < e.length; ++i) e[i].parent = this;
},
iterN: function (t, e, n) {
for (var i = t + e; t < i; ++t) if (n(this.lines[t])) return !0;
},
}),
(vo.prototype = {
chunkSize: function () {
return this.size;
},
removeInner: function (t, e) {
this.size -= e;
for (var n = 0; n < this.children.length; ++n) {
var i = this.children[n],
r = i.chunkSize();
if (t < r) {
var o = Math.min(e, r - t),
s = i.height;
if (
(i.removeInner(t, o),
(this.height -= s - i.height),
r == o && (this.children.splice(n--, 1), (i.parent = null)),
0 == (e -= o))
)
break;
t = 0;
} else t -= r;
}
if (this.size - e < 25 && (this.children.length > 1 || !(this.children[0] instanceof go))) {
var a = [];
this.collapse(a), (this.children = [new go(a)]), (this.children[0].parent = this);
}
},
collapse: function (t) {
for (var e = 0; e < this.children.length; ++e) this.children[e].collapse(t);
},
insertInner: function (t, e, n) {
(this.size += e.length), (this.height += n);
for (var i = 0; i < this.children.length; ++i) {
var r = this.children[i],
o = r.chunkSize();
if (t <= o) {
if ((r.insertInner(t, e, n), r.lines && r.lines.length > 50)) {
for (var s = (r.lines.length % 25) + 25, a = s; a < r.lines.length; ) {
var l = new go(r.lines.slice(a, (a += 25)));
(r.height -= l.height), this.children.splice(++i, 0, l), (l.parent = this);
}
(r.lines = r.lines.slice(0, s)), this.maybeSpill();
}
break;
}
t -= o;
}
},
maybeSpill: function () {
if (!(this.children.length <= 10)) {
var t = this;
do {
var e = t.children.splice(t.children.length - 5, 5),
n = new vo(e);
if (t.parent) {
(t.size -= n.size), (t.height -= n.height);
var i = H(t.parent.children, t);
t.parent.children.splice(i + 1, 0, n);
} else {
var r = new vo(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 = 0; i < this.children.length; ++i) {
var r = this.children[i],
o = r.chunkSize();
if (t < o) {
var s = Math.min(e, o - t);
if (r.iterN(t, s, n)) return !0;
if (0 == (e -= s)) break;
t = 0;
} else t -= o;
}
},
});
var mo = function (t, e, n) {
if (n) for (var i in n) n.hasOwnProperty(i) && (this[i] = n[i]);
(this.doc = t), (this.node = e);
};
function yo(t, e, n) {
qt(e) < ((t.curOp && t.curOp.scrollTop) || t.doc.scrollTop) && Si(t, n);
}
(mo.prototype.clear = function () {
var t = this.doc.cm,
e = this.line.widgets,
n = this.line,
i = ht(n);
if (null != i && e) {
for (var r = 0; r < e.length; ++r) e[r] == this && e.splice(r--, 1);
e.length || (n.widgets = null);
var o = xn(this);
ut(n, Math.max(0, n.height - o)),
t &&
(Ki(t, function () {
yo(t, n, -o), Zi(t, i, 'widget');
}),
an(t, 'lineWidgetCleared', t, this, i));
}
}),
(mo.prototype.changed = function () {
var t = this,
e = this.height,
n = this.doc.cm,
i = this.line;
this.height = null;
var r = xn(this) - e;
r &&
(ut(i, i.height + r),
n &&
Ki(n, function () {
(n.curOp.forceUpdate = !0), yo(n, i, r), an(n, 'lineWidgetChanged', n, t, ht(i));
}));
}),
ae(mo);
var bo = 0,
xo = function (t, e) {
(this.lines = []), (this.type = e), (this.doc = t), (this.id = ++bo);
};
function wo(t, e, n, i, r) {
if (i && i.shared)
return (function (t, e, n, i, r) {
(i = R(i)).shared = !1;
var o = [wo(t, e, n, i, r)],
s = o[0],
a = i.widgetNode;
return (
Or(t, function (t) {
a && (i.widgetNode = a.cloneNode(!0)), o.push(wo(t, Ct(t, e), Ct(t, n), i, r));
for (var l = 0; l < t.linked.length; ++l) if (t.linked[l].isParent) return;
s = Y(o);
}),
new Co(o, s)
);
})(t, e, n, i, r);
if (t.cm && !t.cm.curOp) return Gi(t.cm, wo)(t, e, n, i, r);
var o = new xo(t, r),
s = vt(e, n);
if ((i && R(i, o, !1), s > 0 || (0 == s && !1 !== o.clearWhenEmpty))) return o;
if (
(o.replacedWith &&
((o.collapsed = !0),
(o.widgetNode = P('span', [o.replacedWith], 'CodeMirror-widget')),
i.handleMouseEvents || o.widgetNode.setAttribute('cm-ignore-events', 'true'),
i.insertLeft && (o.widgetNode.insertLeft = !0)),
o.collapsed)
) {
if (Ht(t, e.line, e, n, o) || (e.line != n.line && Ht(t, n.line, e, n, o)))
throw new Error('Inserting collapsed marker partially overlapping an existing one');
Tt = !0;
}
o.addToHistory && Ir(t, { from: e, to: n, origin: 'markText' }, t.sel, NaN);
var a,
l = e.line,
c = t.cm;
if (
(t.iter(l, n.line + 1, function (t) {
c && o.collapsed && !c.options.lineWrapping && Vt(t) == c.display.maxLine && (a = !0),
o.collapsed && l != e.line && ut(t, 0),
(function (t, e) {
(t.markedSpans = t.markedSpans ? t.markedSpans.concat([e]) : [e]), e.marker.attachLine(t);
})(t, new Et(o, l == e.line ? e.ch : null, l == n.line ? n.ch : null)),
++l;
}),
o.collapsed &&
t.iter(e.line, n.line + 1, function (e) {
Wt(t, e) && ut(e, 0);
}),
o.clearOnEnter &&
te(o, 'beforeCursorEnter', function () {
return o.clear();
}),
o.readOnly && ((St = !0), (t.history.done.length || t.history.undone.length) && t.clearHistory()),
o.collapsed && ((o.id = ++bo), (o.atomic = !0)),
c)
) {
if ((a && (c.curOp.updateMaxLine = !0), o.collapsed)) Ji(c, e.line, n.line + 1);
else if (o.className || o.title || o.startStyle || o.endStyle || o.css)
for (var u = e.line; u <= n.line; u++) Zi(c, u, 'text');
o.atomic && Jr(c.doc), an(c, 'markerAdded', c, o);
}
return o;
}
(xo.prototype.clear = function () {
if (!this.explicitlyCleared) {
var t = this.doc.cm,
e = t && !t.curOp;
if ((e && Hi(t), se(this, 'clear'))) {
var n = this.find();
n && an(this, 'clear', n.from, n.to);
}
for (var i = null, r = null, o = 0; o < this.lines.length; ++o) {
var s = this.lines[o],
a = Mt(s.markedSpans, this);
t && !this.collapsed
? Zi(t, ht(s), 'text')
: t && (null != a.to && (r = ht(s)), null != a.from && (i = ht(s))),
(s.markedSpans = At(s.markedSpans, a)),
null == a.from && this.collapsed && !Wt(this.doc, s) && t && ut(s, ti(t.display));
}
if (t && this.collapsed && !t.options.lineWrapping)
for (var l = 0; l < this.lines.length; ++l) {
var c = Vt(this.lines[l]),
u = Kt(c);
u > t.display.maxLineLength &&
((t.display.maxLine = c), (t.display.maxLineLength = u), (t.display.maxLineChanged = !0));
}
null != i && t && this.collapsed && Ji(t, i, r + 1),
(this.lines.length = 0),
(this.explicitlyCleared = !0),
this.atomic && this.doc.cantEdit && ((this.doc.cantEdit = !1), t && Jr(t.doc)),
t && an(t, 'markerCleared', t, this, i, r),
e && Vi(t),
this.parent && this.parent.clear();
}
}),
(xo.prototype.find = function (t, e) {
var n, i;
null == t && 'bookmark' == this.type && (t = 1);
for (var r = 0; r < this.lines.length; ++r) {
var o = this.lines[r],
s = Mt(o.markedSpans, this);
if (null != s.from && ((n = gt(e ? o : ht(o), s.from)), -1 == t)) return n;
if (null != s.to && ((i = gt(e ? o : ht(o), s.to)), 1 == t)) return i;
}
return n && { from: n, to: i };
}),
(xo.prototype.changed = function () {
var t = this,
e = this.find(-1, !0),
n = this,
i = this.doc.cm;
e &&
i &&
Ki(i, function () {
var r = e.line,
o = ht(e.line),
s = Pn(i, o);
if (
(s && (Rn(s), (i.curOp.selectionChanged = i.curOp.forceUpdate = !0)),
(i.curOp.updateMaxLine = !0),
!Wt(n.doc, r) && null != n.height)
) {
var a = n.height;
n.height = null;
var l = xn(n) - a;
l && ut(r, r.height + l);
}
an(i, 'markerChanged', i, t);
});
}),
(xo.prototype.attachLine = function (t) {
if (!this.lines.length && this.doc.cm) {
var e = this.doc.cm.curOp;
(e.maybeHiddenMarkers && -1 != H(e.maybeHiddenMarkers, this)) ||
(e.maybeUnhiddenMarkers || (e.maybeUnhiddenMarkers = [])).push(this);
}
this.lines.push(t);
}),
(xo.prototype.detachLine = function (t) {
if ((this.lines.splice(H(this.lines, t), 1), !this.lines.length && this.doc.cm)) {
var e = this.doc.cm.curOp;
(e.maybeHiddenMarkers || (e.maybeHiddenMarkers = [])).push(this);
}
}),
ae(xo);
var Co = function (t, e) {
(this.markers = t), (this.primary = e);
for (var n = 0; n < t.length; ++n) t[n].parent = this;
};
function ko(t) {
return t.findMarks(gt(t.first, 0), t.clipPos(gt(t.lastLine())), function (t) {
return t.parent;
});
}
function So(t) {
for (
var e = function (e) {
var n = t[e],
i = [n.primary.doc];
Or(n.primary.doc, function (t) {
return i.push(t);
});
for (var r = 0; r < n.markers.length; r++) {
var o = n.markers[r];
-1 == H(i, o.doc) && ((o.parent = null), n.markers.splice(r--, 1));
}
},
n = 0;
n < t.length;
n++
)
e(n);
}
(Co.prototype.clear = function () {
if (!this.explicitlyCleared) {
this.explicitlyCleared = !0;
for (var t = 0; t < this.markers.length; ++t) this.markers[t].clear();
an(this, 'clear');
}
}),
(Co.prototype.find = function (t, e) {
return this.primary.find(t, e);
}),
ae(Co);
var To = 0,
Eo = function (t, e, n, i, r) {
if (!(this instanceof Eo)) return new Eo(t, e, n, i, r);
null == n && (n = 0),
vo.call(this, [new go([new Ue('', null)])]),
(this.first = n),
(this.scrollTop = this.scrollLeft = 0),
(this.cantEdit = !1),
(this.cleanGeneration = 1),
(this.modeFrontier = this.highlightFrontier = n);
var o = gt(n, 0);
(this.sel = xr(o)),
(this.history = new Lr(null)),
(this.id = ++To),
(this.modeOption = e),
(this.lineSep = i),
(this.direction = 'rtl' == r ? 'rtl' : 'ltr'),
(this.extend = !1),
'string' == typeof t && (t = this.splitLines(t)),
Ar(this, { from: o, to: o, text: t }),
Gr(this, xr(o), B);
};
(Eo.prototype = Z(vo.prototype, {
constructor: Eo,
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 = ct(this, this.first, this.first + this.size);
return !1 === t ? e : e.join(t || this.lineSeparator());
},
setValue: Xi(function (t) {
var e = gt(this.first, 0),
n = this.first + this.size - 1;
ro(
this,
{ from: e, to: gt(n, at(this, n).text.length), text: this.splitLines(t), origin: 'setValue', full: !0 },
!0,
),
this.cm && Ei(this.cm, 0, 0),
Gr(this, xr(e), B);
}),
replaceRange: function (t, e, n, i) {
(e = Ct(this, e)), (n = n ? Ct(this, n) : e), co(this, t, e, n, i);
},
getRange: function (t, e, n) {
var i = lt(this, Ct(this, t), Ct(this, e));
return !1 === n ? i : i.join(n || this.lineSeparator());
},
getLine: function (t) {
var e = this.getLineHandle(t);
return e && e.text;
},
getLineHandle: function (t) {
if (ft(this, t)) return at(this, t);
},
getLineNumber: function (t) {
return ht(t);
},
getLineHandleVisualStart: function (t) {
return 'number' == typeof t && (t = at(this, t)), Vt(t);
},
lineCount: function () {
return this.size;
},
firstLine: function () {
return this.first;
},
lastLine: function () {
return this.first + this.size - 1;
},
clipPos: function (t) {
return Ct(this, t);
},
getCursor: function (t) {
var e = this.sel.primary();
return null == t || 'head' == t
? e.head
: 'anchor' == t
? e.anchor
: 'end' == t || 'to' == t || !1 === t
? e.to()
: e.from();
},
listSelections: function () {
return this.sel.ranges;
},
somethingSelected: function () {
return this.sel.somethingSelected();
},
setCursor: Xi(function (t, e, n) {
qr(this, Ct(this, 'number' == typeof t ? gt(t, e || 0) : t), null, n);
}),
setSelection: Xi(function (t, e, n) {
qr(this, Ct(this, t), Ct(this, e || t), n);
}),
extendSelection: Xi(function (t, e, n) {
Br(this, Ct(this, t), e && Ct(this, e), n);
}),
extendSelections: Xi(function (t, e) {
Wr(this, kt(this, t), e);
}),
extendSelectionsBy: Xi(function (t, e) {
var n = X(this.sel.ranges, t);
Wr(this, kt(this, n), e);
}),
setSelections: Xi(function (t, e, n) {
if (t.length) {
for (var i = [], r = 0; r < t.length; r++) i[r] = new yr(Ct(this, t[r].anchor), Ct(this, t[r].head));
null == e && (e = Math.min(t.length - 1, this.sel.primIndex)), Gr(this, br(i, e), n);
}
}),
addSelection: Xi(function (t, e, n) {
var i = this.sel.ranges.slice(0);
i.push(new yr(Ct(this, t), Ct(this, e || t))), Gr(this, br(i, i.length - 1), n);
}),
getSelection: function (t) {
for (var e, n = this.sel.ranges, i = 0; i < n.length; i++) {
var r = lt(this, n[i].from(), n[i].to());
e = e ? e.concat(r) : r;
}
return !1 === t ? e : e.join(t || this.lineSeparator());
},
getSelections: function (t) {
for (var e = [], n = this.sel.ranges, i = 0; i < n.length; i++) {
var r = lt(this, n[i].from(), n[i].to());
!1 !== t && (r = r.join(t || this.lineSeparator())), (e[i] = r);
}
return e;
},
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: Xi(function (t, e, n) {
for (var i = [], r = this.sel, o = 0; o < r.ranges.length; o++) {
var s = r.ranges[o];
i[o] = { from: s.from(), to: s.to(), text: this.splitLines(t[o]), origin: n };
}
for (
var a =
e &&
'end' != e &&
(function (t, e, n) {
for (var i = [], r = gt(t.first, 0), o = r, s = 0; s < e.length; s++) {
var a = e[s],
l = Sr(a.from, r, o),
c = Sr(wr(a), r, o);
if (((r = a.to), (o = c), 'around' == n)) {
var u = t.sel.ranges[s],
h = vt(u.head, u.anchor) < 0;
i[s] = new yr(h ? c : l, h ? l : c);
} else i[s] = new yr(l, l);
}
return new mr(i, t.sel.primIndex);
})(this, i, e),
l = i.length - 1;
l >= 0;
l--
)
ro(this, i[l]);
a ? Kr(this, a) : this.cm && Ti(this.cm);
}),
undo: Xi(function () {
so(this, 'undo');
}),
redo: Xi(function () {
so(this, 'redo');
}),
undoSelection: Xi(function () {
so(this, 'undo', !0);
}),
redoSelection: Xi(function () {
so(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 Lr(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: Vr(this.history.done), undone: Vr(this.history.undone) };
},
setHistory: function (t) {
var e = (this.history = new Lr(this.history.maxGeneration));
(e.done = Vr(t.done.slice(0), null, !0)), (e.undone = Vr(t.undone.slice(0), null, !0));
},
setGutterMarker: Xi(function (t, e, n) {
return po(this, t, 'gutter', function (t) {
var i = t.gutterMarkers || (t.gutterMarkers = {});
return (i[e] = n), !n && nt(i) && (t.gutterMarkers = null), !0;
});
}),
clearGutter: Xi(function (t) {
var e = this;
this.iter(function (n) {
n.gutterMarkers &&
n.gutterMarkers[t] &&
po(e, n, 'gutter', function () {
return (n.gutterMarkers[t] = null), nt(n.gutterMarkers) && (n.gutterMarkers = null), !0;
});
});
}),
lineInfo: function (t) {
var e;
if ('number' == typeof t) {
if (!ft(this, t)) return null;
if (((e = t), !(t = at(this, t)))) return null;
} else if (null == (e = ht(t))) 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: Xi(function (t, e, n) {
return po(this, t, 'gutter' == e ? 'gutter' : 'class', function (t) {
var i =
'text' == e ? 'textClass' : 'background' == e ? 'bgClass' : 'gutter' == e ? 'gutterClass' : 'wrapClass';
if (t[i]) {
if (S(n).test(t[i])) return !1;
t[i] += ' ' + n;
} else t[i] = n;
return !0;
});
}),
removeLineClass: Xi(function (t, e, n) {
return po(this, t, 'gutter' == e ? 'gutter' : 'class', function (t) {
var i =
'text' == e
? 'textClass'
: 'background' == e
? 'bgClass'
: 'gutter' == e
? 'gutterClass'
: 'wrapClass',
r = t[i];
if (!r) return !1;
if (null == n) t[i] = null;
else {
var o = r.match(S(n));
if (!o) return !1;
var s = o.index + o[0].length;
t[i] = r.slice(0, o.index) + (o.index && s != r.length ? ' ' : '') + r.slice(s) || null;
}
return !0;
});
}),
addLineWidget: Xi(function (t, e, n) {
return (function (t, e, n, i) {
var r = new mo(t, n, i),
o = t.cm;
return (
o && r.noHScroll && (o.display.alignWidgets = !0),
po(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 && !Wt(t, e))
) {
var i = qt(e) < t.scrollTop;
ut(e, e.height + xn(r)), i && Si(o, r.height), (o.curOp.forceUpdate = !0);
}
return !0;
}),
o && an(o, 'lineWidgetAdded', o, r, 'number' == typeof e ? e : ht(e)),
r
);
})(this, t, e, n);
}),
removeLineWidget: function (t) {
t.clear();
},
markText: function (t, e, n) {
return wo(this, Ct(this, t), Ct(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 wo(this, (t = Ct(this, t)), t, n, 'bookmark');
},
findMarksAt: function (t) {
var e = [],
n = at(this, (t = Ct(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 = Ct(this, t)), (e = Ct(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;
if (o > t) return (e = t), !0;
(t -= o), ++n;
}),
Ct(this, gt(n, e))
);
},
indexFromPos: function (t) {
var e = (t = Ct(this, 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 Eo(
ct(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 Eo(ct(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 }]),
(function (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 (vt(o, s)) {
var a = wo(t, o, s, i.primary, i.primary.type);
i.markers.push(a), (a.parent = i);
}
}
})(i, ko(this)),
i
);
},
unlinkDoc: function (t) {
if ((t instanceof ks && (t = t.doc), this.linked))
for (var e = 0; e < this.linked.length; ++e) {
var n = this.linked[e];
if (n.doc == t) {
this.linked.splice(e, 1), t.unlinkDoc(this), So(ko(this));
break;
}
}
if (t.history == this.history) {
var i = [t.id];
Or(
t,
function (t) {
return i.push(t.id);
},
!0,
),
(t.history = new Lr(null)),
(t.history.done = Vr(this.history.done, i)),
(t.history.undone = Vr(this.history.undone, i));
}
},
iterLinkedDocs: function (t) {
Or(this, t);
},
getMode: function () {
return this.mode;
},
getEditor: function () {
return this.cm;
},
splitLines: function (t) {
return this.lineSep ? t.split(this.lineSep) : be(t);
},
lineSeparator: function () {
return this.lineSep || '\n';
},
setDirection: Xi(function (t) {
'rtl' != t && (t = 'ltr'),
t != this.direction &&
((this.direction = t),
this.iter(function (t) {
return (t.order = null);
}),
this.cm &&
(function (t) {
Ki(t, function () {
_r(t), Ji(t);
});
})(this.cm));
}),
})),
(Eo.prototype.eachLine = Eo.prototype.iter);
var Mo = 0;
function Ao(t) {
var e = this;
if ((Oo(e), !re(e, t) && !wn(e.display, t))) {
le(t), s && (Mo = +new Date());
var n = si(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),
a = 0,
l = function (t, i) {
if (!e.options.allowDropFileTypes || -1 != H(e.options.allowDropFileTypes, t.type)) {
var s = new FileReader();
(s.onload = Gi(e, function () {
var t = s.result;
if ((/[\x00-\x08\x0e-\x1f]{2}/.test(t) && (t = ''), (o[i] = t), ++a == r)) {
var l = {
from: (n = Ct(e.doc, n)),
to: n,
text: e.doc.splitLines(o.join(e.doc.lineSeparator())),
origin: 'paste',
};
ro(e.doc, l), Kr(e.doc, xr(n, wr(l)));
}
})),
s.readAsText(t);
}
},
c = 0;
c < r;
++c
)
l(i[c], c);
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 u = t.dataTransfer.getData('Text');
if (u) {
var h;
if (
(e.state.draggingText && !e.state.draggingText.copy && (h = e.listSelections()),
Yr(e.doc, xr(n, n)),
h)
)
for (var d = 0; d < h.length; ++d) co(e.doc, '', h[d].anchor, h[d].head, 'drag');
e.replaceSelection(u, 'around', 'paste'), e.display.input.focus();
}
} catch (t) {}
}
}
}
function Oo(t) {
t.display.dragCursor &&
(t.display.lineSpace.removeChild(t.display.dragCursor), (t.display.dragCursor = null));
}
function Po(t) {
if (document.getElementsByClassName)
for (var e = document.getElementsByClassName('CodeMirror'), n = 0; n < e.length; n++) {
var i = e[n].CodeMirror;
i && t(i);
}
}
var _o = !1;
function Lo() {
_o ||
((function () {
var t;
te(window, 'resize', function () {
null == t &&
(t = setTimeout(function () {
(t = null), Po(No);
}, 100));
}),
te(window, 'blur', function () {
return Po(mi);
});
})(),
(_o = !0));
}
function No(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());
}
for (
var Do = {
3: 'Pause',
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',
145: 'ScrollLock',
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',
},
Io = 0;
Io < 10;
Io++
)
Do[Io + 48] = Do[Io + 96] = String(Io);
for (var Fo = 65; Fo <= 90; Fo++) Do[Fo] = String.fromCharCode(Fo);
for (var Ro = 1; Ro <= 12; Ro++) Do[Ro + 111] = Do[Ro + 63235] = 'F' + Ro;
var jo = {};
function zo(t) {
var e,
n,
i,
r,
o = t.split(/-(?!$)/);
t = o[o.length - 1];
for (var s = 0; s < o.length - 1; s++) {
var a = o[s];
if (/^(cmd|meta|m)$/i.test(a)) r = !0;
else if (/^a(lt)?$/i.test(a)) e = !0;
else if (/^(c|ctrl|control)$/i.test(a)) n = !0;
else {
if (!/^s(hift)?$/i.test(a)) throw new Error('Unrecognized modifier name: ' + a);
i = !0;
}
}
return e && (t = 'Alt-' + t), n && (t = 'Ctrl-' + t), r && (t = 'Cmd-' + t), i && (t = 'Shift-' + t), t;
}
function Ho(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 = X(n.split(' '), zo), 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 Vo(t, e, n, i) {
var r = (e = Uo(e)).call ? e.call(t, i) : e[t];
if (!1 === r) 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 Vo(t, e.fallthrough, n, i);
for (var o = 0; o < e.fallthrough.length; o++) {
var s = Vo(t, e.fallthrough[o], n, i);
if (s) return s;
}
}
}
function $o(t) {
var e = 'string' == typeof t ? t : Do[t.keyCode];
return 'Ctrl' == e || 'Alt' == e || 'Shift' == e || 'Mod' == e;
}
function Bo(t, e, n) {
var i = t;
return (
e.altKey && 'Alt' != i && (t = 'Alt-' + t),
(C ? e.metaKey : e.ctrlKey) && 'Ctrl' != i && (t = 'Ctrl-' + t),
(C ? e.ctrlKey : e.metaKey) && 'Cmd' != i && (t = 'Cmd-' + t),
!n && e.shiftKey && 'Shift' != i && (t = 'Shift-' + t),
t
);
}
function Wo(t, e) {
if (h && 34 == t.keyCode && t.char) return !1;
var n = Do[t.keyCode];
return null != n && !t.altGraphKey && (3 == t.keyCode && t.code && (n = t.code), Bo(n, t, e));
}
function Uo(t) {
return 'string' == typeof t ? jo[t] : t;
}
function qo(t, e) {
for (var n = t.doc.sel.ranges, i = [], r = 0; r < n.length; r++) {
for (var o = e(n[r]); i.length && vt(o.from, Y(i).to) <= 0; ) {
var s = i.pop();
if (vt(s.from, o.from) < 0) {
o.from = s.from;
break;
}
}
i.push(o);
}
Ki(t, function () {
for (var e = i.length - 1; e >= 0; e--) co(t.doc, '', i[e].from, i[e].to, '+delete');
Ti(t);
});
}
function Ko(t, e, n) {
var i = ot(t.text, e + n, n);
return i < 0 || i > t.text.length ? null : i;
}
function Go(t, e, n) {
var i = Ko(t, e.ch, n);
return null == i ? null : new gt(e.line, i, n < 0 ? 'after' : 'before');
}
function Yo(t, e, n, i, r) {
if (t) {
var o = Zt(n, e.doc.direction);
if (o) {
var s,
a = r < 0 ? Y(o) : o[0],
l = r < 0 == (1 == a.level),
c = l ? 'after' : 'before';
if (a.level > 0 || 'rtl' == e.doc.direction) {
var u = _n(e, n);
s = r < 0 ? n.text.length - 1 : 0;
var h = Ln(e, u, s).top;
(s = st(
function (t) {
return Ln(e, u, t).top == h;
},
r < 0 == (1 == a.level) ? a.from : a.to - 1,
s,
)),
'before' == c && (s = Ko(n, s, 1));
} else s = r < 0 ? a.to : a.from;
return new gt(i, s, c);
}
}
return new gt(i, r < 0 ? n.text.length : 0, r < 0 ? 'before' : 'after');
}
(jo.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',
}),
(jo.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',
}),
(jo.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',
}),
(jo.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'],
}),
(jo.default = y ? jo.macDefault : jo.pcDefault);
var Xo = {
selectAll: no,
singleSelection: function (t) {
return t.setSelection(t.getCursor('anchor'), t.getCursor('head'), B);
},
killLine: function (t) {
return qo(t, function (e) {
if (e.empty()) {
var n = at(t.doc, e.head.line).text.length;
return e.head.ch == n && e.head.line < t.lastLine()
? { from: e.head, to: gt(e.head.line + 1, 0) }
: { from: e.head, to: gt(e.head.line, n) };
}
return { from: e.from(), to: e.to() };
});
},
deleteLine: function (t) {
return qo(t, function (e) {
return { from: gt(e.from().line, 0), to: Ct(t.doc, gt(e.to().line + 1, 0)) };
});
},
delLineLeft: function (t) {
return qo(t, function (t) {
return { from: gt(t.from().line, 0), to: t.from() };
});
},
delWrappedLineLeft: function (t) {
return qo(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 qo(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(gt(t.firstLine(), 0));
},
goDocEnd: function (t) {
return t.extendSelection(gt(t.lastLine()));
},
goLineStart: function (t) {
return t.extendSelectionsBy(
function (e) {
return Jo(t, e.head.line);
},
{ origin: '+move', bias: 1 },
);
},
goLineStartSmart: function (t) {
return t.extendSelectionsBy(
function (e) {
return Zo(t, e.head);
},
{ origin: '+move', bias: 1 },
);
},
goLineEnd: function (t) {
return t.extendSelectionsBy(
function (e) {
return (function (t, e) {
var n = at(t.doc, e),
i = (function (t) {
for (var e; (e = jt(t)); ) t = e.find(1, !0).line;
return t;
})(n);
return i != n && (e = ht(i)), Yo(!0, t, n, e, -1);
})(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');
}, U);
},
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');
}, U);
},
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/) ? Zo(t, e.head) : i;
}, U);
},
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 = j(t.getLine(o.line), o.ch, i);
e.push(G(i - (s % i)));
}
t.replaceSelections(e);
},
defaultTab: function (t) {
t.somethingSelected() ? t.indentSelection('add') : t.execCommand('insertTab');
},
transposeChars: function (t) {
return Ki(t, function () {
for (var e = t.listSelections(), n = [], i = 0; i < e.length; i++)
if (e[i].empty()) {
var r = e[i].head,
o = at(t.doc, r.line).text;
if (o)
if ((r.ch == o.length && (r = new gt(r.line, r.ch - 1)), r.ch > 0))
(r = new gt(r.line, r.ch + 1)),
t.replaceRange(o.charAt(r.ch - 1) + o.charAt(r.ch - 2), gt(r.line, r.ch - 2), r, '+transpose');
else if (r.line > t.doc.first) {
var s = at(t.doc, r.line - 1).text;
s &&
((r = new gt(r.line, 1)),
t.replaceRange(
o.charAt(0) + t.doc.lineSeparator() + s.charAt(s.length - 1),
gt(r.line - 1, s.length - 1),
r,
'+transpose',
));
}
n.push(new yr(r, r));
}
t.setSelections(n);
});
},
newlineAndIndent: function (t) {
return Ki(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);
Ti(t);
});
},
openLine: function (t) {
return t.replaceSelection('\n', 'start');
},
toggleOverwrite: function (t) {
return t.toggleOverwrite();
},
};
function Jo(t, e) {
var n = at(t.doc, e),
i = Vt(n);
return i != n && (e = ht(i)), Yo(!0, t, i, e, 1);
}
function Zo(t, e) {
var n = Jo(t, e.line),
i = at(t.doc, n.line),
r = Zt(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 gt(n.line, s ? 0 : o, n.sticky);
}
return n;
}
function Qo(t, e, n) {
if ('string' == typeof e && !(e = Xo[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) != $);
} finally {
(t.display.shift = i), (t.state.suppressEdits = !1);
}
return r;
}
var ts = new z();
function es(t, e, n, i) {
var r = t.state.keySeq;
if (r) {
if ($o(e)) return 'handled';
if (
(/\'$/.test(e)
? (t.state.keySeq = null)
: ts.set(50, function () {
t.state.keySeq == r && ((t.state.keySeq = null), t.display.input.reset());
}),
ns(t, r + ' ' + e, n, i))
)
return !0;
}
return ns(t, e, n, i);
}
function ns(t, e, n, i) {
var r = (function (t, e, n) {
for (var i = 0; i < t.state.keyMaps.length; i++) {
var r = Vo(e, t.state.keyMaps[i], n, t);
if (r) return r;
}
return (t.options.extraKeys && Vo(e, t.options.extraKeys, n, t)) || Vo(e, t.options.keyMap, n, t);
})(t, e, i);
return (
'multi' == r && (t.state.keySeq = e),
'handled' == r && an(t, 'keyHandled', t, e, n),
('handled' != r && 'multi' != r) || (le(n), fi(t)),
!!r
);
}
function is(t, e) {
var n = Wo(e, !0);
return (
!!n &&
(e.shiftKey && !t.state.keySeq
? es(t, 'Shift-' + n, e, function (e) {
return Qo(t, e, !0);
}) ||
es(t, n, e, function (e) {
if ('string' == typeof e ? /^go[A-Z]/.test(e) : e.motion) return Qo(t, e);
})
: es(t, n, e, function (e) {
return Qo(t, e);
}))
);
}
var rs = null;
function os(t) {
var e = this;
if (((e.curOp.focus = L()), !re(e, t))) {
s && a < 11 && 27 == t.keyCode && (t.returnValue = !1);
var n = t.keyCode;
e.display.shift = 16 == n || t.shiftKey;
var i = is(e, t);
h &&
((rs = i ? n : null),
!i && 88 == n && !we && (y ? t.metaKey : t.ctrlKey) && e.replaceSelection('', null, 'cut')),
18 != n ||
/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className) ||
(function (t) {
var e = t.display.lineDiv;
function n(t) {
(18 != t.keyCode && t.altKey) ||
(E(e, 'CodeMirror-crosshair'), ne(document, 'keyup', n), ne(document, 'mouseover', n));
}
N(e, 'CodeMirror-crosshair'), te(document, 'keyup', n), te(document, 'mouseover', n);
})(e);
}
}
function ss(t) {
16 == t.keyCode && (this.doc.sel.shift = !1), re(this, t);
}
function as(t) {
var e = this;
if (!(wn(e.display, t) || re(e, t) || (t.ctrlKey && !t.altKey) || (y && t.metaKey))) {
var n = t.keyCode,
i = t.charCode;
if (h && n == rs) return (rs = null), void le(t);
if (!h || (t.which && !(t.which < 10)) || !is(e, t)) {
var r = String.fromCharCode(null == i ? n : i);
'\b' != r &&
((function (t, e, n) {
return es(t, "'" + n + "'", e, function (e) {
return Qo(t, e, !0);
});
})(e, t, r) ||
e.display.input.onKeyPress(t));
}
}
}
var ls,
cs,
us = function (t, e, n) {
(this.time = t), (this.pos = e), (this.button = n);
};
function hs(t) {
var e = this,
n = e.display;
if (!(re(e, t) || (n.activeTouch && n.input.supportsTouch())))
if ((n.input.ensurePolled(), (n.shift = t.shiftKey), wn(n, t)))
l ||
((n.scroller.draggable = !1),
setTimeout(function () {
return (n.scroller.draggable = !0);
}, 100));
else if (!ps(e, t)) {
var i = si(e, t),
r = fe(t),
o = i
? (function (t, e) {
var n = +new Date();
return cs && cs.compare(n, t, e)
? ((ls = cs = null), 'triple')
: ls && ls.compare(n, t, e)
? ((cs = new us(n, t, e)), (ls = null), 'double')
: ((ls = new us(n, t, e)), (cs = null), 'single');
})(i, r)
: 'single';
window.focus(),
1 == r && e.state.selectingText && e.state.selectingText(t),
(i &&
(function (t, e, n, i, r) {
var o = 'Click';
return (
'double' == i ? (o = 'Double' + o) : 'triple' == i && (o = 'Triple' + o),
es(t, Bo((o = (1 == e ? 'Left' : 2 == e ? 'Middle' : 'Right') + o), r), r, function (e) {
if (('string' == typeof e && (e = Xo[e]), !e)) return !1;
var i = !1;
try {
t.isReadOnly() && (t.state.suppressEdits = !0), (i = e(t, n) != $);
} finally {
t.state.suppressEdits = !1;
}
return i;
})
);
})(e, r, i, o, t)) ||
(1 == r
? i
? (function (t, e, n, i) {
s ? setTimeout(F(pi, t), 0) : (t.curOp.focus = L());
var r,
o = (function (t, e, n) {
var i = t.getOption('configureMouse'),
r = i ? i(t, e, n) : {};
if (null == r.unit) {
var o = b ? 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 = y ? n.metaKey : n.ctrlKey),
null == r.moveOnDrag && (r.moveOnDrag = !(y ? n.altKey : n.ctrlKey)),
r
);
})(t, n, i),
c = t.doc.sel;
t.options.dragDrop &&
ve &&
!t.isReadOnly() &&
'single' == n &&
(r = c.contains(e)) > -1 &&
(vt((r = c.ranges[r]).from(), e) < 0 || e.xRel > 0) &&
(vt(r.to(), e) > 0 || e.xRel < 0)
? (function (t, e, n, i) {
var r = t.display,
o = !1,
c = Gi(t, function (e) {
l && (r.scroller.draggable = !1),
(t.state.draggingText = !1),
ne(r.wrapper.ownerDocument, 'mouseup', c),
ne(r.wrapper.ownerDocument, 'mousemove', u),
ne(r.scroller, 'dragstart', h),
ne(r.scroller, 'drop', c),
o ||
(le(e),
i.addNew || Br(t.doc, n, null, null, i.extend),
l || (s && 9 == a)
? setTimeout(function () {
r.wrapper.ownerDocument.body.focus(), r.input.focus();
}, 20)
: r.input.focus());
}),
u = function (t) {
o = o || Math.abs(e.clientX - t.clientX) + Math.abs(e.clientY - t.clientY) >= 10;
},
h = function () {
return (o = !0);
};
l && (r.scroller.draggable = !0),
(t.state.draggingText = c),
(c.copy = !i.moveOnDrag),
r.scroller.dragDrop && r.scroller.dragDrop(),
te(r.wrapper.ownerDocument, 'mouseup', c),
te(r.wrapper.ownerDocument, 'mousemove', u),
te(r.scroller, 'dragstart', h),
te(r.scroller, 'drop', c),
gi(t),
setTimeout(function () {
return r.input.focus();
}, 20);
})(t, i, e, o)
: (function (t, e, n, i) {
var r = t.display,
o = t.doc;
le(e);
var s,
a,
l = o.sel,
c = l.ranges;
if (
(i.addNew && !i.extend
? ((a = o.sel.contains(n)), (s = a > -1 ? c[a] : new yr(n, n)))
: ((s = o.sel.primary()), (a = o.sel.primIndex)),
'rectangle' == i.unit)
)
i.addNew || (s = new yr(n, n)), (n = si(t, e, !0, !0)), (a = -1);
else {
var u = ds(t, n, i.unit);
s = i.extend ? $r(s, u.anchor, u.head, i.extend) : u;
}
i.addNew
? -1 == a
? ((a = c.length), Gr(o, br(c.concat([s]), a), { scroll: !1, origin: '*mouse' }))
: c.length > 1 && c[a].empty() && 'char' == i.unit && !i.extend
? (Gr(o, br(c.slice(0, a).concat(c.slice(a + 1)), 0), {
scroll: !1,
origin: '*mouse',
}),
(l = o.sel))
: Ur(o, a, s, W)
: ((a = 0), Gr(o, new mr([s], 0), W), (l = o.sel));
var h = n;
function d(e) {
if (0 != vt(h, e))
if (((h = e), 'rectangle' == i.unit)) {
for (
var r = [],
c = t.options.tabSize,
u = j(at(o, n.line).text, n.ch, c),
d = j(at(o, e.line).text, e.ch, c),
f = Math.min(u, d),
p = Math.max(u, d),
g = Math.min(n.line, e.line),
v = Math.min(t.lastLine(), Math.max(n.line, e.line));
g <= v;
g++
) {
var m = at(o, g).text,
y = q(m, f, c);
f == p
? r.push(new yr(gt(g, y), gt(g, y)))
: m.length > y && r.push(new yr(gt(g, y), gt(g, q(m, p, c))));
}
r.length || r.push(new yr(n, n)),
Gr(o, br(l.ranges.slice(0, a).concat(r), a), { origin: '*mouse', scroll: !1 }),
t.scrollIntoView(e);
} else {
var b,
x = s,
w = ds(t, e, i.unit),
C = x.anchor;
vt(w.anchor, C) > 0
? ((b = w.head), (C = xt(x.from(), w.anchor)))
: ((b = w.anchor), (C = bt(x.to(), w.head)));
var k = l.ranges.slice(0);
(k[a] = (function (t, e) {
var n = e.anchor,
i = e.head,
r = at(t.doc, n.line);
if (0 == vt(n, i) && n.sticky == i.sticky) return e;
var o = Zt(r);
if (!o) return e;
var s = Xt(o, n.ch, n.sticky),
a = o[s];
if (a.from != n.ch && a.to != n.ch) return e;
var l,
c = s + ((a.from == n.ch) == (1 != a.level) ? 0 : 1);
if (0 == c || c == o.length) return e;
if (i.line != n.line)
l = (i.line - n.line) * ('ltr' == t.doc.direction ? 1 : -1) > 0;
else {
var u = Xt(o, i.ch, i.sticky),
h = u - s || (i.ch - n.ch) * (1 == a.level ? -1 : 1);
l = u == c - 1 || u == c ? h < 0 : h > 0;
}
var d = o[c + (l ? -1 : 0)],
f = l == (1 == d.level),
p = f ? d.from : d.to,
g = f ? 'after' : 'before';
return n.ch == p && n.sticky == g ? e : new yr(new gt(n.line, p, g), i);
})(t, new yr(Ct(o, C), b))),
Gr(o, br(k, a), W);
}
}
var f = r.wrapper.getBoundingClientRect(),
p = 0;
function g(e) {
(t.state.selectingText = !1),
(p = 1 / 0),
le(e),
r.input.focus(),
ne(r.wrapper.ownerDocument, 'mousemove', v),
ne(r.wrapper.ownerDocument, 'mouseup', m),
(o.history.lastSelOrigin = null);
}
var v = Gi(t, function (e) {
0 !== e.buttons && fe(e)
? (function e(n) {
var s = ++p,
a = si(t, n, !0, 'rectangle' == i.unit);
if (a)
if (0 != vt(a, h)) {
(t.curOp.focus = L()), d(a);
var l = xi(r, o);
(a.line >= l.to || a.line < l.from) &&
setTimeout(
Gi(t, function () {
p == s && e(n);
}),
150,
);
} else {
var c = n.clientY < f.top ? -20 : n.clientY > f.bottom ? 20 : 0;
c &&
setTimeout(
Gi(t, function () {
p == s && ((r.scroller.scrollTop += c), e(n));
}),
50,
);
}
})(e)
: g(e);
}),
m = Gi(t, g);
(t.state.selectingText = m),
te(r.wrapper.ownerDocument, 'mousemove', v),
te(r.wrapper.ownerDocument, 'mouseup', m);
})(t, i, e, o);
})(e, i, o, t)
: de(t) == n.scroller && le(t)
: 2 == r
? (i && Br(e.doc, i),
setTimeout(function () {
return n.input.focus();
}, 20))
: 3 == r && (k ? gs(e, t) : gi(e)));
}
}
function ds(t, e, n) {
if ('char' == n) return new yr(e, e);
if ('word' == n) return t.findWordAt(e);
if ('line' == n) return new yr(gt(e.line, 0), Ct(t.doc, gt(e.line + 1, 0)));
var i = n(t, e);
return new yr(i.from, i.to);
}
function fs(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 && le(e);
var s = t.display,
a = s.lineDiv.getBoundingClientRect();
if (o > a.bottom || !se(t, n)) return ue(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 = dt(t.doc, o),
h = t.options.gutters[l];
return ie(t, n, t, u, h, e), ue(e);
}
}
}
function ps(t, e) {
return fs(t, e, 'gutterClick', !0);
}
function gs(t, e) {
wn(t.display, e) ||
(function (t, e) {
return !!se(t, 'gutterContextMenu') && fs(t, e, 'gutterContextMenu', !1);
})(t, e) ||
re(t, e, 'contextmenu') ||
t.display.input.onContextMenu(e);
}
function vs(t) {
(t.display.wrapper.className =
t.display.wrapper.className.replace(/\s*cm-s-\S+/g, '') + t.options.theme.replace(/(^|\s)\s*/g, ' cm-s-')),
zn(t);
}
us.prototype.compare = function (t, e, n) {
return this.time + 400 > t && 0 == vt(e, this.pos) && n == this.button;
};
var ms = {
toString: function () {
return 'CodeMirror.Init';
},
},
ys = {},
bs = {};
function xs(t) {
ur(t), Ji(t), wi(t);
}
function ws(t, e, n) {
var i = n && n != ms;
if (!e != !i) {
var r = t.display.dragFunctions,
o = e ? te : ne;
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 Cs(t) {
t.options.lineWrapping
? (N(t.display.wrapper, 'CodeMirror-wrap'),
(t.display.sizer.style.minWidth = ''),
(t.display.sizerWidth = null))
: (E(t.display.wrapper, 'CodeMirror-wrap'), Gt(t)),
oi(t),
Ji(t),
zn(t),
setTimeout(function () {
return Ii(t);
}, 100);
}
function ks(t, e) {
var i = this;
if (!(this instanceof ks)) return new ks(t, e);
(this.options = e = e ? R(e) : {}), R(ys, e, !1), hr(e);
var r = e.value;
'string' == typeof r && (r = new Eo(r, e.mode, null, e.lineSeparator, e.direction)), (this.doc = r);
var o = new ks.inputStyles[e.inputStyle](this),
c = (this.display = new (function (t, e, i) {
var r = this;
(this.input = i),
(r.scrollbarFiller = O('div', null, 'CodeMirror-scrollbar-filler')),
r.scrollbarFiller.setAttribute('cm-not-content', 'true'),
(r.gutterFiller = O('div', null, 'CodeMirror-gutter-filler')),
r.gutterFiller.setAttribute('cm-not-content', 'true'),
(r.lineDiv = P('div', null, 'CodeMirror-code')),
(r.selectionDiv = O('div', null, null, 'position: relative; z-index: 1')),
(r.cursorDiv = O('div', null, 'CodeMirror-cursors')),
(r.measure = O('div', null, 'CodeMirror-measure')),
(r.lineMeasure = O('div', null, 'CodeMirror-measure')),
(r.lineSpace = P(
'div',
[r.measure, r.lineMeasure, r.selectionDiv, r.cursorDiv, r.lineDiv],
null,
'position: relative; outline: none',
));
var o = P('div', [r.lineSpace], 'CodeMirror-lines');
(r.mover = O('div', [o], null, 'position: relative')),
(r.sizer = O('div', [r.mover], 'CodeMirror-sizer')),
(r.sizerWidth = null),
(r.heightForcer = O('div', null, null, 'position: absolute; height: ' + V + 'px; width: 1px;')),
(r.gutters = O('div', null, 'CodeMirror-gutters')),
(r.lineGutter = null),
(r.scroller = O('div', [r.sizer, r.heightForcer, r.gutters], 'CodeMirror-scroll')),
r.scroller.setAttribute('tabIndex', '-1'),
(r.wrapper = O('div', [r.scrollbarFiller, r.gutterFiller, r.scroller], 'CodeMirror')),
s && a < 8 && ((r.gutters.style.zIndex = -1), (r.scroller.style.paddingRight = 0)),
l || (n && m) || (r.scroller.draggable = !0),
t && (t.appendChild ? t.appendChild(r.wrapper) : t(r.wrapper)),
(r.viewFrom = r.viewTo = e.first),
(r.reportedViewFrom = r.reportedViewTo = e.first),
(r.view = []),
(r.renderedView = null),
(r.externalMeasured = null),
(r.viewOffset = 0),
(r.lastWrapHeight = r.lastWrapWidth = 0),
(r.updateLineNumbers = null),
(r.nativeBarWidth = r.barHeight = r.barWidth = 0),
(r.scrollbarsClipped = !1),
(r.lineNumWidth = r.lineNumInnerWidth = r.lineNumChars = null),
(r.alignWidgets = !1),
(r.cachedCharWidth = r.cachedTextHeight = r.cachedPaddingH = null),
(r.maxLine = null),
(r.maxLineLength = 0),
(r.maxLineChanged = !1),
(r.wheelDX = r.wheelDY = r.wheelStartX = r.wheelStartY = null),
(r.shift = !1),
(r.selForContextMenu = null),
(r.activeTouch = null),
i.init(r);
})(t, r, o));
for (var u in ((c.wrapper.CodeMirror = this),
ur(this),
vs(this),
e.lineWrapping && (this.display.wrapper.className += ' CodeMirror-wrap'),
ji(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 z(),
keySeq: null,
specialChars: null,
}),
e.autofocus && !m && c.input.focus(),
s &&
a < 11 &&
setTimeout(function () {
return i.display.input.reset(!0);
}, 20),
(function (t) {
var e = t.display;
te(e.scroller, 'mousedown', Gi(t, hs)),
te(
e.scroller,
'dblclick',
s && a < 11
? Gi(t, function (e) {
if (!re(t, e)) {
var n = si(t, e);
if (n && !ps(t, e) && !wn(t.display, e)) {
le(e);
var i = t.findWordAt(n);
Br(t.doc, i.anchor, i.head);
}
}
})
: function (e) {
return re(t, e) || le(e);
},
),
k ||
te(e.scroller, 'contextmenu', function (e) {
return gs(t, e);
});
var n,
i = { end: 0 };
function r() {
e.activeTouch &&
((n = setTimeout(function () {
return (e.activeTouch = null);
}, 1e3)),
((i = e.activeTouch).end = +new Date()));
}
function o(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;
}
te(e.scroller, 'touchstart', function (r) {
if (
!re(t, r) &&
!(function (t) {
if (1 != t.touches.length) return !1;
var e = t.touches[0];
return e.radiusX <= 1 && e.radiusY <= 1;
})(r) &&
!ps(t, r)
) {
e.input.ensurePolled(), clearTimeout(n);
var o = +new Date();
(e.activeTouch = { start: o, moved: !1, prev: o - i.end <= 300 ? i : null }),
1 == r.touches.length &&
((e.activeTouch.left = r.touches[0].pageX), (e.activeTouch.top = r.touches[0].pageY));
}
}),
te(e.scroller, 'touchmove', function () {
e.activeTouch && (e.activeTouch.moved = !0);
}),
te(e.scroller, 'touchend', function (n) {
var i = e.activeTouch;
if (i && !wn(e, n) && null != i.left && !i.moved && new Date() - i.start < 300) {
var s,
a = t.coordsChar(e.activeTouch, 'page');
(s =
!i.prev || o(i, i.prev)
? new yr(a, a)
: !i.prev.prev || o(i, i.prev.prev)
? t.findWordAt(a)
: new yr(gt(a.line, 0), Ct(t.doc, gt(a.line + 1, 0)))),
t.setSelection(s.anchor, s.head),
t.focus(),
le(n);
}
r();
}),
te(e.scroller, 'touchcancel', r),
te(e.scroller, 'scroll', function () {
e.scroller.clientHeight &&
(Oi(t, e.scroller.scrollTop), _i(t, e.scroller.scrollLeft, !0), ie(t, 'scroll', t));
}),
te(e.scroller, 'mousewheel', function (e) {
return vr(t, e);
}),
te(e.scroller, 'DOMMouseScroll', function (e) {
return vr(t, e);
}),
te(e.wrapper, 'scroll', function () {
return (e.wrapper.scrollTop = e.wrapper.scrollLeft = 0);
}),
(e.dragFunctions = {
enter: function (e) {
re(t, e) || he(e);
},
over: function (e) {
re(t, e) ||
((function (t, e) {
var n = si(t, e);
if (n) {
var i = document.createDocumentFragment();
ui(t, n, i),
t.display.dragCursor ||
((t.display.dragCursor = O('div', null, 'CodeMirror-cursors CodeMirror-dragcursors')),
t.display.lineSpace.insertBefore(t.display.dragCursor, t.display.cursorDiv)),
A(t.display.dragCursor, i);
}
})(t, e),
he(e));
},
start: function (e) {
return (function (t, e) {
if (s && (!t.state.draggingText || +new Date() - Mo < 100)) he(e);
else if (
!re(t, e) &&
!wn(t.display, e) &&
(e.dataTransfer.setData('Text', t.getSelection()),
(e.dataTransfer.effectAllowed = 'copyMove'),
e.dataTransfer.setDragImage && !d)
) {
var n = O('img', null, null, 'position: fixed; left: 0; top: 0;');
(n.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='),
h && ((n.width = n.height = 1), t.display.wrapper.appendChild(n), (n._top = n.offsetTop)),
e.dataTransfer.setDragImage(n, 0, 0),
h && n.parentNode.removeChild(n);
}
})(t, e);
},
drop: Gi(t, Ao),
leave: function (e) {
re(t, e) || Oo(t);
},
});
var l = e.input.getField();
te(l, 'keyup', function (e) {
return ss.call(t, e);
}),
te(l, 'keydown', Gi(t, os)),
te(l, 'keypress', Gi(t, as)),
te(l, 'focus', function (e) {
return vi(t, e);
}),
te(l, 'blur', function (e) {
return mi(t, e);
});
})(this),
Lo(),
Hi(this),
(this.curOp.forceUpdate = !0),
Pr(this, r),
(e.autofocus && !m) || this.hasFocus() ? setTimeout(F(vi, this), 20) : mi(this),
bs))
bs.hasOwnProperty(u) && bs[u](i, e[u], ms);
Ci(this), e.finishInit && e.finishInit(this);
for (var f = 0; f < Ss.length; ++f) Ss[f](i);
Vi(this),
l &&
e.lineWrapping &&
'optimizelegibility' == getComputedStyle(c.lineDiv).textRendering &&
(c.lineDiv.style.textRendering = 'auto');
}
(ks.defaults = ys), (ks.optionHandlers = bs);
var Ss = [];
function Ts(t, e, n, i) {
var r,
o = t.doc;
null == n && (n = 'add'), 'smart' == n && (o.mode.indent ? (r = Re(t, e).state) : (n = 'prev'));
var s = t.options.tabSize,
a = at(o, e),
l = j(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 > 150)) {
if (!i) return;
n = 'prev';
}
} else (c = 0), (n = 'not');
'prev' == n
? (c = e > o.first ? j(at(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 h = '',
d = 0;
if (t.options.indentWithTabs) for (var f = Math.floor(c / s); f; --f) (d += s), (h += '\t');
if ((d < c && (h += G(c - d)), h != u))
return co(o, h, gt(e, 0), gt(e, u.length), '+input'), (a.stateAfter = null), !0;
for (var p = 0; p < o.sel.ranges.length; p++) {
var g = o.sel.ranges[p];
if (g.head.line == e && g.head.ch < u.length) {
var v = gt(e, u.length);
Ur(o, p, new yr(v, v));
break;
}
}
}
ks.defineInitHook = function (t) {
return Ss.push(t);
};
var Es = null;
function Ms(t) {
Es = t;
}
function As(t, e, n, i, r) {
var o = t.doc;
(t.display.shift = !1), i || (i = o.sel);
var s,
a = t.state.pasteIncoming || 'paste' == r,
l = be(e),
c = null;
if (a && i.ranges.length > 1)
if (Es && Es.text.join('\n') == e) {
if (i.ranges.length % Es.text.length == 0) {
c = [];
for (var u = 0; u < Es.text.length; u++) c.push(o.splitLines(Es.text[u]));
}
} else
l.length == i.ranges.length &&
t.options.pasteLinesPerSelection &&
(c = X(l, function (t) {
return [t];
}));
for (var 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 = gt(f.line, f.ch - n))
: t.state.overwrite && !a
? (p = gt(p.line, Math.min(at(o, p.line).text.length, p.ch + Y(l).length)))
: Es && Es.lineWise && Es.text.join('\n') == e && (f = p = gt(f.line, 0))),
(s = t.curOp.updateInput);
var g = {
from: f,
to: p,
text: c ? c[h % c.length] : l,
origin: r || (a ? 'paste' : t.state.cutIncoming ? 'cut' : '+input'),
};
ro(t.doc, g), an(t, 'inputRead', t, g);
}
e && !a && Ps(t, e),
Ti(t),
(t.curOp.updateInput = s),
(t.curOp.typing = !0),
(t.state.pasteIncoming = t.state.cutIncoming = !1);
}
function Os(t, e) {
var n = t.clipboardData && t.clipboardData.getData('Text');
if (n)
return (
t.preventDefault(),
e.isReadOnly() ||
e.options.disableInput ||
Ki(e, function () {
return As(e, n, 0, null, 'paste');
}),
!0
);
}
function Ps(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 = Ts(t, r.head.line, 'smart');
break;
}
} else
o.electricInput &&
o.electricInput.test(at(t.doc, r.head.line).text.slice(0, r.head.ch)) &&
(s = Ts(t, r.head.line, 'smart'));
s && an(t, 'electricInput', t, r.head.line);
}
}
}
function _s(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: gt(r, 0), head: gt(r + 1, 0) };
n.push(o), e.push(t.getRange(o.anchor, o.head));
}
return { text: e, ranges: n };
}
function Ls(t, e) {
t.setAttribute('autocorrect', 'off'),
t.setAttribute('autocapitalize', 'off'),
t.setAttribute('spellcheck', !!e);
}
function Ns() {
var t = O(
'textarea',
null,
null,
'position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none',
),
e = O('div', [t], null, 'overflow: hidden; position: relative; width: 3px; height: 0px;');
return (
l ? (t.style.width = '1000px') : t.setAttribute('wrap', 'off'),
g && (t.style.border = '1px solid black'),
Ls(t),
e
);
}
function Ds(t, e, n, i, r) {
var o = e,
s = n,
a = at(t, e.line);
function l(i) {
var o;
if (
null ==
(o = r
? (function (t, e, n, i) {
var r = Zt(e, t.doc.direction);
if (!r) return Go(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 = Xt(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 Go(e, n, i);
var a,
l = function (t, n) {
return Ko(e, t instanceof gt ? t.ch : t, n);
},
c = function (n) {
return t.options.lineWrapping
? ((a = a || _n(t, e)), Jn(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 gt(n.line, d, f);
}
}
var p = function (t, e, i) {
for (
var o = function (t, e) {
return e ? new gt(n.line, l(t, 1), 'before') : new gt(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;
})(t.cm, a, e, n)
: Go(a, e, n))
) {
if (
i ||
!(function () {
var i = e.line + n;
return !(i < t.first || i >= t.first + t.size) && ((e = new gt(i, e.ch, e.sticky)), (a = at(t, i)));
})()
)
return !1;
e = Yo(r, t.cm, a, e.line, n);
} else e = o;
return !0;
}
if ('char' == i) l();
else if ('column' == i) l(!0);
else if ('word' == i || 'group' == i)
for (
var c = null, u = 'group' == i, h = t.cm && t.cm.getHelper(e, 'wordChars'), d = !0;
!(n < 0) || l(!d);
d = !1
) {
var f = a.text.charAt(e.ch) || '\n',
p = et(f, h) ? 'w' : u && '\n' == f ? 'n' : !u || /\s/.test(f) ? null : 'p';
if ((!u || d || p || (p = 's'), c && c != p)) {
n < 0 && ((n = 1), l(), (e.sticky = 'after'));
break;
}
if ((p && (c = p), n > 0 && !l(!d))) break;
}
var g = to(t, e, o, s, !0);
return mt(o, g) && (g.hitSide = !0), g;
}
function Is(t, e, n, i) {
var r,
o,
s = t.doc,
a = e.left;
if ('page' == i) {
var l = Math.min(
t.display.wrapper.clientHeight,
window.innerHeight || document.documentElement.clientHeight,
),
c = Math.max(l - 0.5 * ti(t.display), 3);
r = (n > 0 ? e.bottom : e.top) + n * c;
} else 'line' == i && (r = n > 0 ? e.bottom + 3 : e.top - 3);
for (; (o = Yn(t, a, r)).outside; ) {
if (n < 0 ? r <= 0 : r >= s.height) {
o.hitSide = !0;
break;
}
r += 5 * n;
}
return o;
}
var Fs = function (t) {
(this.cm = t),
(this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null),
(this.polling = new z()),
(this.composing = null),
(this.gracePeriod = !1),
(this.readDOMTimeout = null);
};
function Rs(t, e) {
var n = Pn(t, e.line);
if (!n || n.hidden) return null;
var i = at(t.doc, e.line),
r = An(n, i, e.line),
o = Zt(i, t.doc.direction),
s = 'left';
if (o) {
var a = Xt(o, e.ch);
s = a % 2 ? 'right' : 'left';
}
var l = In(r.map, e.ch, s);
return (l.offset = 'right' == l.collapse ? l.end : l.start), l;
}
function js(t, e) {
return e && (t.bad = !0), t;
}
function zs(t, e, n) {
var i;
if (e == t.display.lineDiv) {
if (!(i = t.display.lineDiv.childNodes[n])) return js(t.clipPos(gt(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 Hs(o, e, n);
}
}
function Hs(t, e, n) {
var i = t.text.firstChild,
r = !1;
if (!e || !_(i, e)) return js(gt(ht(t.line), 0), !0);
if (e == i && ((r = !0), (e = i.childNodes[n]), (n = 0), !e)) {
var o = t.rest ? Y(t.rest) : t.line;
return js(gt(ht(o), o.text.length), r);
}
var s = 3 == e.nodeType ? e : null,
a = e;
for (
s ||
1 != e.childNodes.length ||
3 != e.firstChild.nodeType ||
((s = e.firstChild), n && (n = s.nodeValue.length));
a.parentNode != i;
)
a = a.parentNode;
var l = t.measure,
c = l.maps;
function u(e, n, i) {
for (var r = -1; r < (c ? c.length : 0); r++)
for (var o = r < 0 ? l.map : c[r], s = 0; s < o.length; s += 3) {
var a = o[s + 2];
if (a == e || a == n) {
var u = ht(r < 0 ? t.line : t.rest[r]),
h = o[s] + i;
return (i < 0 || a != e) && (h = o[s + (i ? 1 : 0)]), gt(u, h);
}
}
}
var h = u(s, a, n);
if (h) return js(h, r);
for (var d = a.nextSibling, f = s ? s.nodeValue.length - n : 0; d; d = d.nextSibling) {
if ((h = u(d, d.firstChild, 0))) return js(gt(h.line, h.ch - f), r);
f += d.textContent.length;
}
for (var p = a.previousSibling, g = n; p; p = p.previousSibling) {
if ((h = u(p, p.firstChild, -1))) return js(gt(h.line, h.ch + g), r);
g += p.textContent.length;
}
}
(Fs.prototype.init = function (t) {
var e = this,
n = this,
i = n.cm,
r = (n.div = t.lineDiv);
function o(t) {
if (!re(i, t)) {
if (i.somethingSelected())
Ms({ lineWise: !1, text: i.getSelections() }), 'cut' == t.type && i.replaceSelection('', null, 'cut');
else {
if (!i.options.lineWiseCopyCut) return;
var e = _s(i);
Ms({ lineWise: !0, text: e.text }),
'cut' == t.type &&
i.operation(function () {
i.setSelections(e.ranges, 0, B), i.replaceSelection('', null, 'cut');
});
}
if (t.clipboardData) {
t.clipboardData.clearData();
var o = Es.text.join('\n');
if ((t.clipboardData.setData('Text', o), t.clipboardData.getData('Text') == o))
return void t.preventDefault();
}
var s = Ns(),
a = s.firstChild;
i.display.lineSpace.insertBefore(s, i.display.lineSpace.firstChild), (a.value = Es.text.join('\n'));
var l = document.activeElement;
I(a),
setTimeout(function () {
i.display.lineSpace.removeChild(s), l.focus(), l == r && n.showPrimarySelection();
}, 50);
}
}
Ls(r, i.options.spellcheck),
te(r, 'paste', function (t) {
re(i, t) ||
Os(t, i) ||
(a <= 11 &&
setTimeout(
Gi(i, function () {
return e.updateFromDOM();
}),
20,
));
}),
te(r, 'compositionstart', function (t) {
e.composing = { data: t.data, done: !1 };
}),
te(r, 'compositionupdate', function (t) {
e.composing || (e.composing = { data: t.data, done: !1 });
}),
te(r, 'compositionend', function (t) {
e.composing && (t.data != e.composing.data && e.readFromDOMSoon(), (e.composing.done = !0));
}),
te(r, 'touchstart', function () {
return n.forceCompositionEnd();
}),
te(r, 'input', function () {
e.composing || e.readFromDOMSoon();
}),
te(r, 'copy', o),
te(r, 'cut', o);
}),
(Fs.prototype.prepareSelection = function () {
var t = ci(this.cm, !1);
return (t.focus = this.cm.state.focused), t;
}),
(Fs.prototype.showSelection = function (t, e) {
t &&
this.cm.display.view.length &&
((t.focus || e) && this.showPrimarySelection(), this.showMultipleSelections(t));
}),
(Fs.prototype.getSelection = function () {
return this.cm.display.wrapper.ownerDocument.getSelection();
}),
(Fs.prototype.showPrimarySelection = function () {
var t = this.getSelection(),
e = this.cm,
i = e.doc.sel.primary(),
r = i.from(),
o = i.to();
if (e.display.viewTo == e.display.viewFrom || r.line >= e.display.viewTo || o.line < e.display.viewFrom)
t.removeAllRanges();
else {
var s = zs(e, t.anchorNode, t.anchorOffset),
a = zs(e, t.focusNode, t.focusOffset);
if (!s || s.bad || !a || a.bad || 0 != vt(xt(s, a), r) || 0 != vt(bt(s, a), o)) {
var l = e.display.view,
c = (r.line >= e.display.viewFrom && Rs(e, r)) || { node: l[0].measure.map[2], offset: 0 },
u = o.line < e.display.viewTo && Rs(e, o);
if (!u) {
var h = l[l.length - 1].measure,
d = h.maps ? h.maps[h.maps.length - 1] : h.map;
u = { node: d[d.length - 1], offset: d[d.length - 2] - d[d.length - 3] };
}
if (c && u) {
var f,
p = t.rangeCount && t.getRangeAt(0);
try {
f = T(c.node, c.offset, u.offset, u.node);
} catch (t) {}
f &&
(!n && e.state.focused
? (t.collapse(c.node, c.offset), f.collapsed || (t.removeAllRanges(), t.addRange(f)))
: (t.removeAllRanges(), t.addRange(f)),
p && null == t.anchorNode ? t.addRange(p) : n && this.startGracePeriod()),
this.rememberSelection();
} else t.removeAllRanges();
}
}
}),
(Fs.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));
}),
(Fs.prototype.showMultipleSelections = function (t) {
A(this.cm.display.cursorDiv, t.cursors), A(this.cm.display.selectionDiv, t.selection);
}),
(Fs.prototype.rememberSelection = function () {
var t = this.getSelection();
(this.lastAnchorNode = t.anchorNode),
(this.lastAnchorOffset = t.anchorOffset),
(this.lastFocusNode = t.focusNode),
(this.lastFocusOffset = t.focusOffset);
}),
(Fs.prototype.selectionInEditor = function () {
var t = this.getSelection();
if (!t.rangeCount) return !1;
var e = t.getRangeAt(0).commonAncestorContainer;
return _(this.div, e);
}),
(Fs.prototype.focus = function () {
'nocursor' != this.cm.options.readOnly &&
(this.selectionInEditor() || this.showSelection(this.prepareSelection(), !0), this.div.focus());
}),
(Fs.prototype.blur = function () {
this.div.blur();
}),
(Fs.prototype.getField = function () {
return this.div;
}),
(Fs.prototype.supportsTouch = function () {
return !0;
}),
(Fs.prototype.receivedFocus = function () {
var t = this;
this.selectionInEditor()
? this.pollSelection()
: Ki(this.cm, function () {
return (t.cm.curOp.selectionChanged = !0);
}),
this.polling.set(this.cm.options.pollInterval, function e() {
t.cm.state.focused && (t.pollSelection(), t.polling.set(t.cm.options.pollInterval, e));
});
}),
(Fs.prototype.selectionChanged = function () {
var t = this.getSelection();
return (
t.anchorNode != this.lastAnchorNode ||
t.anchorOffset != this.lastAnchorOffset ||
t.focusNode != this.lastFocusNode ||
t.focusOffset != this.lastFocusOffset
);
}),
(Fs.prototype.pollSelection = function () {
if (null == this.readDOMTimeout && !this.gracePeriod && this.selectionChanged()) {
var t = this.getSelection(),
e = this.cm;
if (
v &&
u &&
this.cm.options.gutters.length &&
(function (t) {
for (var e = t; e; e = e.parentNode) if (/CodeMirror-gutter-wrapper/.test(e.className)) return !0;
return !1;
})(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 = zs(e, t.anchorNode, t.anchorOffset),
i = zs(e, t.focusNode, t.focusOffset);
n &&
i &&
Ki(e, function () {
Gr(e.doc, xr(n, i), B), (n.bad || i.bad) && (e.curOp.selectionChanged = !0);
});
}
}
}),
(Fs.prototype.pollContent = function () {
null != this.readDOMTimeout && (clearTimeout(this.readDOMTimeout), (this.readDOMTimeout = null));
var t,
e,
n,
i = this.cm,
r = i.display,
o = i.doc.sel.primary(),
s = o.from(),
a = o.to();
if (
(0 == s.ch && s.line > i.firstLine() && (s = gt(s.line - 1, at(i.doc, s.line - 1).length)),
a.ch == at(i.doc, a.line).text.length && a.line < i.lastLine() && (a = gt(a.line + 1, 0)),
s.line < r.viewFrom || a.line > r.viewTo - 1)
)
return !1;
s.line == r.viewFrom || 0 == (t = ai(i, s.line))
? ((e = ht(r.view[0].line)), (n = r.view[0].node))
: ((e = ht(r.view[t].line)), (n = r.view[t - 1].node.nextSibling));
var l,
c,
u = ai(i, a.line);
if (
(u == r.view.length - 1
? ((l = r.viewTo - 1), (c = r.lineDiv.lastChild))
: ((l = ht(r.view[u + 1].line) - 1), (c = r.view[u + 1].node.previousSibling)),
!n)
)
return !1;
for (
var h = i.doc.splitLines(
(function (t, e, n, i, r) {
var o = '',
s = !1,
a = t.doc.lineSeparator(),
l = !1;
function c() {
s && ((o += a), l && (o += a), (s = l = !1));
}
function u(t) {
t && (c(), (o += t));
}
function h(e) {
if (1 == e.nodeType) {
var n = e.getAttribute('cm-text');
if (n) return void u(n);
var o,
d = e.getAttribute('cm-marker');
if (d) {
var f = t.findMarks(
gt(i, 0),
gt(r + 1, 0),
(function (t) {
return function (e) {
return e.id == t;
};
})(+d),
);
return void (f.length && (o = f[0].find(0)) && u(lt(t.doc, o.from, o.to).join(a)));
}
if ('false' == e.getAttribute('contenteditable')) return;
var p = /^(pre|div|p|li|table|br)$/i.test(e.nodeName);
if (!/^br$/i.test(e.nodeName) && 0 == e.textContent.length) return;
p && c();
for (var g = 0; g < e.childNodes.length; g++) h(e.childNodes[g]);
/^(pre|p)$/i.test(e.nodeName) && (l = !0), p && (s = !0);
} else 3 == e.nodeType && u(e.nodeValue.replace(/\u200b/g, '').replace(/\u00a0/g, ' '));
}
for (; h(e), e != n; ) (e = e.nextSibling), (l = !1);
return o;
})(i, n, c, e, l),
),
d = lt(i.doc, gt(e, 0), gt(l, at(i.doc, l).text.length));
h.length > 1 && d.length > 1;
)
if (Y(h) == Y(d)) h.pop(), d.pop(), l--;
else {
if (h[0] != d[0]) break;
h.shift(), d.shift(), e++;
}
for (
var f = 0, p = 0, g = h[0], v = d[0], m = Math.min(g.length, v.length);
f < m && g.charCodeAt(f) == v.charCodeAt(f);
)
++f;
for (
var y = Y(h),
b = Y(d),
x = Math.min(y.length - (1 == h.length ? f : 0), b.length - (1 == d.length ? f : 0));
p < x && y.charCodeAt(y.length - p - 1) == b.charCodeAt(b.length - p - 1);
)
++p;
if (1 == h.length && 1 == d.length && e == s.line)
for (; f && f > s.ch && y.charCodeAt(y.length - p - 1) == b.charCodeAt(b.length - p - 1); ) f--, p++;
(h[h.length - 1] = y.slice(0, y.length - p).replace(/^\u200b+/, '')),
(h[0] = h[0].slice(f).replace(/\u200b+$/, ''));
var w = gt(e, f),
C = gt(l, d.length ? Y(d).length - p : 0);
return h.length > 1 || h[0] || vt(w, C) ? (co(i.doc, h, w, C, '+input'), !0) : void 0;
}),
(Fs.prototype.ensurePolled = function () {
this.forceCompositionEnd();
}),
(Fs.prototype.reset = function () {
this.forceCompositionEnd();
}),
(Fs.prototype.forceCompositionEnd = function () {
this.composing &&
(clearTimeout(this.readDOMTimeout),
(this.composing = null),
this.updateFromDOM(),
this.div.blur(),
this.div.focus());
}),
(Fs.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));
}),
(Fs.prototype.updateFromDOM = function () {
var t = this;
(!this.cm.isReadOnly() && this.pollContent()) ||
Ki(this.cm, function () {
return Ji(t.cm);
});
}),
(Fs.prototype.setUneditable = function (t) {
t.contentEditable = 'false';
}),
(Fs.prototype.onKeyPress = function (t) {
0 == t.charCode ||
this.composing ||
(t.preventDefault(),
this.cm.isReadOnly() ||
Gi(this.cm, As)(this.cm, String.fromCharCode(null == t.charCode ? t.keyCode : t.charCode), 0));
}),
(Fs.prototype.readOnlyChanged = function (t) {
this.div.contentEditable = String('nocursor' != t);
}),
(Fs.prototype.onContextMenu = function () {}),
(Fs.prototype.resetPosition = function () {}),
(Fs.prototype.needsContentAttribute = !0);
var Vs = function (t) {
(this.cm = t),
(this.prevInput = ''),
(this.pollingFast = !1),
(this.polling = new z()),
(this.hasSelection = !1),
(this.composing = null);
};
(Vs.prototype.init = function (t) {
var e = this,
n = this,
i = this.cm;
this.createField(t);
var r = this.textarea;
function o(t) {
if (!re(i, t)) {
if (i.somethingSelected()) Ms({ lineWise: !1, text: i.getSelections() });
else {
if (!i.options.lineWiseCopyCut) return;
var e = _s(i);
Ms({ lineWise: !0, text: e.text }),
'cut' == t.type
? i.setSelections(e.ranges, null, B)
: ((n.prevInput = ''), (r.value = e.text.join('\n')), I(r));
}
'cut' == t.type && (i.state.cutIncoming = !0);
}
}
t.wrapper.insertBefore(this.wrapper, t.wrapper.firstChild),
g && (r.style.width = '0px'),
te(r, 'input', function () {
s && a >= 9 && e.hasSelection && (e.hasSelection = null), n.poll();
}),
te(r, 'paste', function (t) {
re(i, t) || Os(t, i) || ((i.state.pasteIncoming = !0), n.fastPoll());
}),
te(r, 'cut', o),
te(r, 'copy', o),
te(t.scroller, 'paste', function (e) {
wn(t, e) || re(i, e) || ((i.state.pasteIncoming = !0), n.focus());
}),
te(t.lineSpace, 'selectstart', function (e) {
wn(t, e) || le(e);
}),
te(r, 'compositionstart', function () {
var t = i.getCursor('from');
n.composing && n.composing.range.clear(),
(n.composing = {
start: t,
range: i.markText(t, i.getCursor('to'), { className: 'CodeMirror-composing' }),
});
}),
te(r, 'compositionend', function () {
n.composing && (n.poll(), n.composing.range.clear(), (n.composing = null));
});
}),
(Vs.prototype.createField = function (t) {
(this.wrapper = Ns()), (this.textarea = this.wrapper.firstChild);
}),
(Vs.prototype.prepareSelection = function () {
var t = this.cm,
e = t.display,
n = t.doc,
i = ci(t);
if (t.options.moveInputWithCursor) {
var r = qn(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;
}),
(Vs.prototype.showSelection = function (t) {
var e = this.cm,
n = e.display;
A(n.cursorDiv, t.cursors),
A(n.selectionDiv, t.selection),
null != t.teTop &&
((this.wrapper.style.top = t.teTop + 'px'), (this.wrapper.style.left = t.teLeft + 'px'));
}),
(Vs.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 && I(this.textarea), s && a >= 9 && (this.hasSelection = n);
} else t || ((this.prevInput = this.textarea.value = ''), s && a >= 9 && (this.hasSelection = null));
}
}),
(Vs.prototype.getField = function () {
return this.textarea;
}),
(Vs.prototype.supportsTouch = function () {
return !1;
}),
(Vs.prototype.focus = function () {
if ('nocursor' != this.cm.options.readOnly && (!m || L() != this.textarea))
try {
this.textarea.focus();
} catch (t) {}
}),
(Vs.prototype.blur = function () {
this.textarea.blur();
}),
(Vs.prototype.resetPosition = function () {
this.wrapper.style.top = this.wrapper.style.left = 0;
}),
(Vs.prototype.receivedFocus = function () {
this.slowPoll();
}),
(Vs.prototype.slowPoll = function () {
var t = this;
this.pollingFast ||
this.polling.set(this.cm.options.pollInterval, function () {
t.poll(), t.cm.state.focused && t.slowPoll();
});
}),
(Vs.prototype.fastPoll = function () {
var t = !1,
e = this;
(e.pollingFast = !0),
e.polling.set(20, function n() {
var i = e.poll();
i || t ? ((e.pollingFast = !1), e.slowPoll()) : ((t = !0), e.polling.set(60, n));
});
}),
(Vs.prototype.poll = function () {
var t = this,
e = this.cm,
n = this.textarea,
i = this.prevInput;
if (
this.contextMenuPending ||
!e.state.focused ||
(xe(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 ((s && a >= 9 && this.hasSelection === r) || (y && /[\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 l = 0, c = Math.min(i.length, r.length); l < c && i.charCodeAt(l) == r.charCodeAt(l); ) ++l;
return (
Ki(e, function () {
As(e, r.slice(l), i.length - l, 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
);
}),
(Vs.prototype.ensurePolled = function () {
this.pollingFast && this.poll() && (this.pollingFast = !1);
}),
(Vs.prototype.onKeyPress = function () {
s && a >= 9 && (this.hasSelection = null), this.fastPoll();
}),
(Vs.prototype.onContextMenu = function (t) {
var e = this,
n = e.cm,
i = n.display,
r = e.textarea,
o = si(n, t),
c = i.scroller.scrollTop;
if (o && !h) {
var u = n.options.resetSelectionOnContextMenu;
u && -1 == n.doc.sel.contains(o) && Gi(n, Gr)(n.doc, xr(o), B);
var d = r.style.cssText,
f = e.wrapper.style.cssText;
e.wrapper.style.cssText = 'position: absolute';
var p,
g = e.wrapper.getBoundingClientRect();
if (
((r.style.cssText =
'position: absolute; width: 30px; height: 30px;\n top: ' +
(t.clientY - g.top - 5) +
'px; left: ' +
(t.clientX - g.left - 5) +
'px;\n z-index: 1000; background: ' +
(s ? 'rgba(255, 255, 255, .05)' : 'transparent') +
';\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);'),
l && (p = window.scrollY),
i.input.focus(),
l && window.scrollTo(null, p),
i.input.reset(),
n.somethingSelected() || (r.value = e.prevInput = ' '),
(e.contextMenuPending = !0),
(i.selForContextMenu = n.doc.sel),
clearTimeout(i.detectingSelectAll),
s && a >= 9 && m(),
k)
) {
he(t);
var v = function () {
ne(window, 'mouseup', v), setTimeout(y, 20);
};
te(window, 'mouseup', v);
} else setTimeout(y, 50);
}
function m() {
if (null != r.selectionStart) {
var t = n.somethingSelected(),
o = '​' + (t ? r.value : '');
(r.value = '⇚'),
(r.value = o),
(e.prevInput = t ? '' : '​'),
(r.selectionStart = 1),
(r.selectionEnd = o.length),
(i.selForContextMenu = n.doc.sel);
}
}
function y() {
if (
((e.contextMenuPending = !1),
(e.wrapper.style.cssText = f),
(r.style.cssText = d),
s && a < 9 && i.scrollbars.setScrollTop((i.scroller.scrollTop = c)),
null != r.selectionStart)
) {
(!s || (s && a < 9)) && m();
var t = 0,
o = function () {
i.selForContextMenu == n.doc.sel &&
0 == r.selectionStart &&
r.selectionEnd > 0 &&
'​' == e.prevInput
? Gi(n, no)(n)
: t++ < 10
? (i.detectingSelectAll = setTimeout(o, 500))
: ((i.selForContextMenu = null), i.input.reset());
};
i.detectingSelectAll = setTimeout(o, 200);
}
}
}),
(Vs.prototype.readOnlyChanged = function (t) {
t || this.reset(), (this.textarea.disabled = 'nocursor' == t);
}),
(Vs.prototype.setUneditable = function () {}),
(Vs.prototype.needsContentAttribute = !1),
(function (t) {
var e = t.optionHandlers;
function n(n, i, r, o) {
(t.defaults[n] = i),
r &&
(e[n] = o
? function (t, e, n) {
n != ms && r(t, e, n);
}
: r);
}
(t.defineOption = n),
(t.Init = ms),
n(
'value',
'',
function (t, e) {
return t.setValue(e);
},
!0,
),
n(
'mode',
null,
function (t, e) {
(t.doc.modeOption = e), Tr(t);
},
!0,
),
n('indentUnit', 2, Tr, !0),
n('indentWithTabs', !1),
n('smartIndent', !0),
n(
'tabSize',
4,
function (t) {
Er(t), zn(t), Ji(t);
},
!0,
),
n('lineSeparator', null, function (t, e) {
if (((t.doc.lineSep = e), e)) {
var n = [],
i = t.doc.first;
t.doc.iter(function (t) {
for (var r = 0; ; ) {
var o = t.text.indexOf(e, r);
if (-1 == o) break;
(r = o + e.length), n.push(gt(i, o));
}
i++;
});
for (var r = n.length - 1; r >= 0; r--) co(t.doc, e, n[r], gt(n[r].line, n[r].ch + e.length));
}
}),
n(
'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 != ms && t.refresh();
},
),
n(
'specialCharPlaceholder',
Je,
function (t) {
return t.refresh();
},
!0,
),
n('electricChars', !0),
n(
'inputStyle',
m ? 'contenteditable' : 'textarea',
function () {
throw new Error('inputStyle can not (yet) be changed in a running editor');
},
!0,
),
n(
'spellcheck',
!1,
function (t, e) {
return (t.getInputField().spellcheck = e);
},
!0,
),
n('rtlMoveVisually', !x),
n('wholeLineUpdateBefore', !0),
n(
'theme',
'default',
function (t) {
vs(t), xs(t);
},
!0,
),
n('keyMap', 'default', function (t, e, n) {
var i = Uo(e),
r = n != ms && Uo(n);
r && r.detach && r.detach(t, i), i.attach && i.attach(t, r || null);
}),
n('extraKeys', null),
n('configureMouse', null),
n('lineWrapping', !1, Cs, !0),
n(
'gutters',
[],
function (t) {
hr(t.options), xs(t);
},
!0,
),
n(
'fixedGutter',
!0,
function (t, e) {
(t.display.gutters.style.left = e ? ii(t.display) + 'px' : '0'), t.refresh();
},
!0,
),
n(
'coverGutterNextToScrollbar',
!1,
function (t) {
return Ii(t);
},
!0,
),
n(
'scrollbarStyle',
'native',
function (t) {
ji(t),
Ii(t),
t.display.scrollbars.setScrollTop(t.doc.scrollTop),
t.display.scrollbars.setScrollLeft(t.doc.scrollLeft);
},
!0,
),
n(
'lineNumbers',
!1,
function (t) {
hr(t.options), xs(t);
},
!0,
),
n('firstLineNumber', 1, xs, !0),
n(
'lineNumberFormatter',
function (t) {
return t;
},
xs,
!0,
),
n('showCursorWhenSelecting', !1, li, !0),
n('resetSelectionOnContextMenu', !0),
n('lineWiseCopyCut', !0),
n('pasteLinesPerSelection', !0),
n('readOnly', !1, function (t, e) {
'nocursor' == e && (mi(t), t.display.input.blur()), t.display.input.readOnlyChanged(e);
}),
n(
'disableInput',
!1,
function (t, e) {
e || t.display.input.reset();
},
!0,
),
n('dragDrop', !0, ws),
n('allowDropFileTypes', null),
n('cursorBlinkRate', 530),
n('cursorScrollMargin', 0),
n('cursorHeight', 1, li, !0),
n('singleCursorHeightPerLine', !0, li, !0),
n('workTime', 100),
n('workDelay', 100),
n('flattenSpans', !0, Er, !0),
n('addModeClass', !1, Er, !0),
n('pollInterval', 100),
n('undoDepth', 200, function (t, e) {
return (t.doc.history.undoDepth = e);
}),
n('historyEventDelay', 1250),
n(
'viewportMargin',
10,
function (t) {
return t.refresh();
},
!0,
),
n('maxHighlightLength', 1e4, Er, !0),
n('moveInputWithCursor', !0, function (t, e) {
e || t.display.input.resetPosition();
}),
n('tabindex', null, function (t, e) {
return (t.display.input.getField().tabIndex = e || '');
}),
n('autofocus', null),
n(
'direction',
'ltr',
function (t, e) {
return t.doc.setDirection(e);
},
!0,
);
})(ks),
(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) && Gi(this, e[t])(this, n, r), ie(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: Yi(function (e, n) {
var i = e.token ? e : t.getMode(this.options, e);
if (i.startState) throw new Error('Overlays may not be stateful.');
!(function (t, e, n) {
for (var i = 0, r = n(e); i < t.length && n(t[i]) <= r; ) i++;
t.splice(i, 0, e);
})(
this.state.overlays,
{ mode: i, modeSpec: e, opaque: n && n.opaque, priority: (n && n.priority) || 0 },
function (t) {
return t.priority;
},
),
this.state.modeGen++,
Ji(this);
}),
removeOverlay: Yi(function (t) {
for (var e = this.state.overlays, n = 0; n < e.length; ++n) {
var i = e[n].modeSpec;
if (i == t || ('string' == typeof t && i.name == t))
return e.splice(n, 1), this.state.modeGen++, void Ji(this);
}
}),
indentLine: Yi(function (t, e, n) {
'string' != typeof e &&
'number' != typeof e &&
(e = null == e ? (this.options.smartIndent ? 'smart' : 'prev') : e ? 'add' : 'subtract'),
ft(this.doc, t) && Ts(this, t, e, n);
}),
indentSelection: Yi(function (t) {
for (var e = this.doc.sel.ranges, n = -1, i = 0; i < e.length; i++) {
var r = e[i];
if (r.empty())
r.head.line > n &&
(Ts(this, r.head.line, t, !0), (n = r.head.line), i == this.doc.sel.primIndex && Ti(this));
else {
var o = r.from(),
s = r.to(),
a = Math.max(n, o.line);
n = Math.min(this.lastLine(), s.line - (s.ch ? 0 : 1)) + 1;
for (var l = a; l < n; ++l) Ts(this, l, t);
var c = this.doc.sel.ranges;
0 == o.ch && e.length == c.length && c[i].from().ch > 0 && Ur(this.doc, i, new yr(o, c[i].to()), B);
}
}
}),
getTokenAt: function (t, e) {
return $e(this, t, e);
},
getLineTokens: function (t, e) {
return $e(this, gt(t), e, !0);
},
getTokenTypeAt: function (t) {
t = Ct(this.doc, t);
var e,
n = Fe(this, at(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 = [];
if (!n.hasOwnProperty(e)) return i;
var r = n[e],
o = this.getModeAt(t);
if ('string' == typeof o[e]) r[o[e]] && i.push(r[o[e]]);
else if (o[e])
for (var s = 0; s < o[e].length; s++) {
var a = r[o[e][s]];
a && i.push(a);
}
else o.helperType && r[o.helperType] ? i.push(r[o.helperType]) : r[o.name] && i.push(r[o.name]);
for (var l = 0; l < r._global.length; l++) {
var c = r._global[l];
c.pred(o, this) && -1 == H(i, c.val) && i.push(c.val);
}
return i;
},
getStateAfter: function (t, e) {
var n = this.doc;
return Re(this, (t = wt(n, null == t ? n.first + n.size - 1 : t)) + 1, e).state;
},
cursorCoords: function (t, e) {
var n = this.doc.sel.primary();
return qn(
this,
null == t ? n.head : 'object' == typeof t ? Ct(this.doc, t) : t ? n.from() : n.to(),
e || 'page',
);
},
charCoords: function (t, e) {
return Un(this, Ct(this.doc, t), e || 'page');
},
coordsChar: function (t, e) {
return Yn(this, (t = Wn(this, t, e || 'page')).left, t.top);
},
lineAtHeight: function (t, e) {
return (t = Wn(this, { top: t, left: 0 }, e || 'page').top), dt(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 = at(this.doc, t));
} else i = t;
return Bn(this, i, { top: 0, left: 0 }, e || 'page', n || r).top + (r ? this.doc.height - qt(i) : 0);
},
defaultTextHeight: function () {
return ti(this.display);
},
defaultCharWidth: function () {
return ei(this.display);
},
getViewport: function () {
return { from: this.display.viewFrom, to: this.display.viewTo };
},
addWidget: function (t, e, n, i, r) {
var o = this.display,
s = (t = qn(this, Ct(this.doc, 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 &&
(function (t, e) {
var n = ki(t, e);
null != n.scrollTop && Oi(t, n.scrollTop), null != n.scrollLeft && _i(t, n.scrollLeft);
})(this, { left: a, top: s, right: a + e.offsetWidth, bottom: s + e.offsetHeight });
},
triggerOnKeyDown: Yi(os),
triggerOnKeyPress: Yi(as),
triggerOnKeyUp: ss,
triggerOnMouseDown: Yi(hs),
execCommand: function (t) {
if (Xo.hasOwnProperty(t)) return Xo[t].call(null, this);
},
triggerElectric: Yi(function (t) {
Ps(this, t);
}),
findPosH: function (t, e, n, i) {
var r = 1;
e < 0 && ((r = -1), (e = -e));
for (var o = Ct(this.doc, t), s = 0; s < e && !(o = Ds(this.doc, o, r, n, i)).hitSide; ++s);
return o;
},
moveH: Yi(function (t, e) {
var n = this;
this.extendSelectionsBy(function (i) {
return n.display.shift || n.doc.extend || i.empty()
? Ds(n.doc, i.head, t, e, n.options.rtlMoveVisually)
: t < 0
? i.from()
: i.to();
}, U);
}),
deleteH: Yi(function (t, e) {
var n = this.doc.sel,
i = this.doc;
n.somethingSelected()
? i.replaceSelection('', null, '+delete')
: qo(this, function (n) {
var r = Ds(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 = 1,
o = i;
e < 0 && ((r = -1), (e = -e));
for (var s = Ct(this.doc, t), a = 0; a < e; ++a) {
var l = qn(this, s, 'div');
if ((null == o ? (o = l.left) : (l.left = o), (s = Is(this, l, r, n)).hitSide)) break;
}
return s;
},
moveV: Yi(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 = qn(n, s.head, 'div');
null != s.goalColumn && (a.left = s.goalColumn), r.push(a.left);
var l = Is(n, a, t, e);
return 'page' == e && s == i.sel.primary() && Si(n, Un(n, l, 'div').top - a.top), l;
}, U),
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 = at(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 = et(s, o)
? function (t) {
return et(t, o);
}
: /\s/.test(s)
? function (t) {
return /\s/.test(t);
}
: function (t) {
return !/\s/.test(t) && !et(t);
};
i > 0 && a(n.charAt(i - 1));
)
--i;
for (; r < n.length && a(n.charAt(r)); ) ++r;
}
return new yr(gt(t.line, i), gt(t.line, r));
},
toggleOverwrite: function (t) {
(null != t && t == this.state.overwrite) ||
((this.state.overwrite = !this.state.overwrite)
? N(this.display.cursorDiv, 'CodeMirror-overwrite')
: E(this.display.cursorDiv, 'CodeMirror-overwrite'),
ie(this, 'overwriteToggle', this, this.state.overwrite));
},
hasFocus: function () {
return this.display.input.getField() == L();
},
isReadOnly: function () {
return !(!this.options.readOnly && !this.doc.cantEdit);
},
scrollTo: Yi(function (t, e) {
Ei(this, t, e);
}),
getScrollInfo: function () {
var t = this.display.scroller;
return {
left: t.scrollLeft,
top: t.scrollTop,
height: t.scrollHeight - Tn(this) - this.display.barHeight,
width: t.scrollWidth - Tn(this) - this.display.barWidth,
clientHeight: Mn(this),
clientWidth: En(this),
};
},
scrollIntoView: Yi(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: gt(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
? (function (t, e) {
Mi(t), (t.curOp.scrollToPos = e);
})(this, t)
: Ai(this, t.from, t.to, t.margin);
}),
setSize: Yi(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 && jn(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) {
Zi(n, r, 'widget');
break;
}
++r;
}),
(this.curOp.forceUpdate = !0),
ie(this, 'refresh', this);
}),
operation: function (t) {
return Ki(this, t);
},
startOperation: function () {
return Hi(this);
},
endOperation: function () {
return Vi(this);
},
refresh: Yi(function () {
var t = this.display.cachedTextHeight;
Ji(this),
(this.curOp.forceUpdate = !0),
zn(this),
Ei(this, this.doc.scrollLeft, this.doc.scrollTop),
lr(this),
(null == t || Math.abs(t - ti(this.display)) > 0.5) && oi(this),
ie(this, 'refresh', this);
}),
swapDoc: Yi(function (t) {
var e = this.doc;
return (
(e.cm = null),
Pr(this, t),
zn(this),
this.display.input.reset(),
Ei(this, t.scrollLeft, t.scrollTop),
(this.curOp.forceScroll = !0),
an(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;
},
}),
ae(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 });
});
})(ks);
var $s = 'iter insert remove copy getEditor constructor'.split(' ');
for (var Bs in Eo.prototype)
Eo.prototype.hasOwnProperty(Bs) &&
H($s, Bs) < 0 &&
(ks.prototype[Bs] = (function (t) {
return function () {
return t.apply(this.doc, arguments);
};
})(Eo.prototype[Bs]));
return (
ae(Eo),
(ks.inputStyles = { textarea: Vs, contenteditable: Fs }),
(ks.defineMode = function (t) {
ks.defaults.mode || 'null' == t || (ks.defaults.mode = t),
function (t, e) {
arguments.length > 2 && (e.dependencies = Array.prototype.slice.call(arguments, 2)), (ke[t] = e);
}.apply(this, arguments);
}),
(ks.defineMIME = function (t, e) {
Se[t] = e;
}),
ks.defineMode('null', function () {
return {
token: function (t) {
return t.skipToEnd();
},
};
}),
ks.defineMIME('text/plain', 'null'),
(ks.defineExtension = function (t, e) {
ks.prototype[t] = e;
}),
(ks.defineDocExtension = function (t, e) {
Eo.prototype[t] = e;
}),
(ks.fromTextArea = function (t, e) {
if (
(((e = e ? R(e) : {}).value = t.value),
!e.tabindex && t.tabIndex && (e.tabindex = t.tabIndex),
!e.placeholder && t.placeholder && (e.placeholder = t.placeholder),
null == e.autofocus)
) {
var n = L();
e.autofocus = n == t || (null != t.getAttribute('autofocus') && n == document.body);
}
function i() {
t.value = a.getValue();
}
var r;
if (t.form && (te(t.form, 'submit', i), !e.leaveSubmitMethodAlone)) {
var o = t.form;
r = o.submit;
try {
var s = (o.submit = function () {
i(), (o.submit = r), o.submit(), (o.submit = s);
});
} catch (t) {}
}
(e.finishInit = function (e) {
(e.save = i),
(e.getTextArea = function () {
return t;
}),
(e.toTextArea = function () {
(e.toTextArea = isNaN),
i(),
t.parentNode.removeChild(e.getWrapperElement()),
(t.style.display = ''),
t.form && (ne(t.form, 'submit', i), 'function' == typeof t.form.submit && (t.form.submit = r));
});
}),
(t.style.display = 'none');
var a = ks(function (e) {
return t.parentNode.insertBefore(e, t.nextSibling);
}, e);
return a;
}),
(function (t) {
(t.off = ne),
(t.on = te),
(t.wheelEventPixels = gr),
(t.Doc = Eo),
(t.splitLines = be),
(t.countColumn = j),
(t.findColumn = q),
(t.isWordChar = tt),
(t.Pass = $),
(t.signal = ie),
(t.Line = Ue),
(t.changeEnd = wr),
(t.scrollbarModel = Ri),
(t.Pos = gt),
(t.cmpPos = vt),
(t.modes = ke),
(t.mimeModes = Se),
(t.resolveMode = Te),
(t.getMode = Ee),
(t.modeExtensions = Me),
(t.extendMode = Ae),
(t.copyState = Oe),
(t.startState = _e),
(t.innerMode = Pe),
(t.commands = Xo),
(t.keyMap = jo),
(t.keyName = Wo),
(t.isModifierKey = $o),
(t.lookupKey = Vo),
(t.normalizeKeyMap = Ho),
(t.StringStream = Le),
(t.SharedTextMarker = Co),
(t.TextMarker = xo),
(t.LineWidget = mo),
(t.e_preventDefault = le),
(t.e_stopPropagation = ce),
(t.e_stop = he),
(t.addClass = N),
(t.contains = _),
(t.rmClass = E),
(t.keyNames = Do);
})(ks),
(ks.version = '5.38.0'),
ks
);
})();
},
function (t, e, n) {
'use strict';
var i = o(n(1)),
r = o(n(0));
function o(t) {
return t && t.__esModule ? t : { default: t };
}
var s = n(13),
a = r.default.$;
t.exports = i.default.extend({}, s, {
init: function (t) {
i.default.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];
s.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),
a(document)[e]('mouseup', this.endDraw),
a(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 o = r || {},
s = a(t),
l = s.data('model'),
c = s.data('collection'),
u = l ? l.get('droppable') : 1;
if (((o.at = n), c && u)) return c.add(e, o);
console.warn('Invalid target position');
},
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) {
((t.which || t.keyCode) == 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();
},
});
},
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(103),
l = n(101),
c = (n(85), n(0).$),
u = void 0;
t.exports = {
init: function (t) {
(0, o.bindAll)(this, 'onHover', 'onOut', 'onClick', '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 resize', this.onFrameScroll),
e[n]('component:toggled', this.onSelect, this),
e[n]('change:componentHovered', this.onHovered, this);
},
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 = comp.parent();
n = i;
}
this.em.setHovered(n, { forceChange: 1 });
},
onHovered: function (t, e) {
var n = e && e.getEl();
if (n) {
var i = this.getElementPos(n);
this.updateBadge(n, i), this.updateHighlighter(n, i), this.showElementOffset(n, i);
}
},
onOut: function (t) {
t.stopPropagation(), this.hideBadge(), this.hideHighlighter(), this.hideElementOffset();
},
showElementOffset: function (t, e) {
var n = c(t).data('model');
(n && 'selected' == n.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),
n = (this.editor, e.data('model'));
if (!n) for (var i = e.parent(); !n && i; ) (n = i.data('model')), (i = i.parent());
if (n)
if (n.get('selectable')) this.select(n, t);
else {
for (var r = n.parent(); r && !r.get('selectable'); ) r = r.parent();
this.select(r, t);
}
},
select: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if (t) {
var n = e.ctrlKey || e.metaKey,
i = e.shiftKey,
r = this.editor,
s = r.getConfig('multipleSelection'),
a = this.em;
if (n && s) r.selectToggle(t);
else if (i && s) {
a.clearSelection(r.Canvas.getWindow());
var l = t.collection,
c = l.indexOf(t),
u = (r.getSelectedAll(), void 0),
h = void 0;
if (
(r.getSelectedAll().forEach(function (t) {
var e = t.collection,
n = e.indexOf(t);
e === l &&
(n < c
? (u = (0, o.isUndefined)(u) ? n : Math.max(u, n))
: n > c && (h = (0, o.isUndefined)(h) ? n : Math.min(h, n)));
}),
!(0, o.isUndefined)(u))
)
for (; u !== c; ) r.selectAdd(l.at(u)), u++;
if (!(0, o.isUndefined)(h)) for (; h !== c; ) r.selectAdd(l.at(h)), h--;
r.selectAdd(t);
} else r.select(t);
this.initResize(t);
}
},
updateBadge: function (t, e) {
var n = c(t),
i = this.canvas,
r = i.getConfig().customBadgeLabel;
this.cacheEl = t;
var o = n.data('model');
if (o && o.get('badgable')) {
var s = this.getBadge(),
a = o.getIcon() + o.getName();
(a = r ? r(o) : a), (s.innerHTML = a);
var l = s.style;
l.display = 'block';
var u = i.getCanvasView().getPosition();
if (u) {
var h = s ? s.offsetHeight : 0,
d = s ? s.offsetWidth : 0,
f = e.top - h < u.top ? u.top : e.top - h,
p = e.left + d < u.left ? u.left : e.left;
(l.top = f + 'px'), (l.left = p + 'px');
}
}
},
updateHighlighter: function (t, e) {
var n = c(t).data('model');
if (n && n.get('hoverable') && 'selected' != n.get('status')) {
var i = this.canvas.getHighlighter().style;
(i.left = e.left + 'px'),
(i.top = e.top + 'px'),
(i.height = e.height + 'px'),
(i.width = e.width + 'px'),
(i.display = 'block');
}
},
onSelect: function () {
var t = this.em.getSelected();
if ((this.updateToolbar(t), t)) {
var e = t.view.el;
this.showFixedElementOffset(e), this.hideElementOffset(), this.hideHighlighter(), this.initResize(e);
} else this.editor.stopCommand('resize');
},
initResize: function (t) {
var e = this.em,
n = e ? e.get('Editor') : '',
a = (e ? e.get('Config') : '').stylePrefix || '',
l = a + 'resizing',
c = (0, o.isElement)(t) ? e.getSelected() : t,
h = c.get('resizable'),
d = (0, o.isElement)(t) ? t : c.getEl(),
f = {},
p = void 0,
g = 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 + ' ' + l : i.replace(l, '')).trim();
});
};
n && h
? ((f = {
onStart: function (t) {
var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
i = n.el,
r = n.config,
o = n.resizer,
a = r.keyHeight,
l = r.keyWidth,
h = r.currentUnit;
g('add', 0, n), (p = e.get('StyleManager').getModelToStyle(c));
var d = getComputedStyle(i),
f = p.getStyle(),
v = f[l] || d[l],
m = f[a] || d[a];
(o.startDim.w = parseFloat(v)),
(o.startDim.h = parseFloat(m)),
(u = 0),
h && ((r.unitHeight = (0, s.getUnitFromValue)(m)), (r.unitWidth = (0, s.getUnitFromValue)(v)));
},
onMove: function () {
n.trigger('change:canvasOffset');
},
onEnd: function (t, e) {
g('remove', 0, e), n.trigger('change:canvasOffset'), (u = 1);
},
updateTarget: function (t, n) {
var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
if (p) {
var r = i.store,
o = i.selectedHandler,
s = i.config,
a = s.keyHeight,
l = s.keyWidth,
c = ['tc', 'bc'].indexOf(o) >= 0,
u = ['cl', 'cr'].indexOf(o) >= 0,
h = p.getStyle();
c || (h[l] = n.w + s.unitWidth), u || (h[a] = n.h + s.unitHeight), p.setStyle(h, { avoidStore: 1 });
e && e.trigger('update:component:style:' + a + ' update:component:style:' + l),
r && p.trigger('change:style', p, h, {});
}
},
}),
'object' == (void 0 === h ? 'undefined' : r(h)) && (f = i({}, f, h)),
n.runCommand('resize', { el: d, options: f }))
: n.stopCommand('resize');
},
updateToolbar: function (t) {
var e = this.config.em,
n = t == e ? e.getSelected() : t,
i = this.canvas.getToolbarEl(),
r = i.style;
if (n) {
var o = n.get('toolbar');
this.ppfx;
if (e.get('Config').showToolbar && o && o.length) {
if (((r.opacity = ''), (r.display = ''), !this.toolbar)) {
(i.innerHTML = ''), (this.toolbar = new l(o));
var s = new a({ collection: this.toolbar, editor: this.editor });
i.appendChild(s.render().el);
}
this.toolbar.reset(o);
var c = n.view;
c && this.updateToolbarPos(c.el);
} else r.display = 'none';
} else r.opacity = 0;
},
updateToolbarPos: function (t, e) {
var n = this.canvas.getToolbarEl(),
i = n.style,
r = i.display;
i.display = 'block';
var o = this.canvas.getTargetToElementDim(n, t, { elPos: e, event: 'toolbarPosUpdate' });
if (o) {
var s = o.left + o.elementWidth - o.targetWidth;
(i.top = o.top + 'px'), (i.left = (s < 0 ? 0 : s) + 'px'), (i.display = r);
}
},
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.getSelected();
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);
},
};
},
function (t, e, n) {
'use strict';
var i = n(1),
r = n(0),
o = r.$;
t.exports = r.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),
(e.view = this),
(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, n);
}
},
renderLabel: function () {
var t = this.getLabel();
this.$el.html('<div class="' + this.labelClass + '" title="' + t + '">' + t + '</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 = t.get('placeholder') || t.get('default') || '',
n = t.get('type') || 'text',
i = t.get('min'),
r = t.get('max'),
s = this.getModelValue(),
a = o('<input type="' + n + '" placeholder="' + e + '">');
s && a.prop('value', s), i && a.prop('min', i), r && a.prop('max', r), (this.$input = a);
}
return this.$input.get(0);
},
getModelValue: function () {
var t = void 0,
e = this.model,
n = this.target,
r = e.get('name');
if (e.get('changeProp')) t = n.get(r);
else {
var o = n.get('attributes');
t = e.get('value') || o[r];
}
return (0, i.isUndefined)(t) ? '' : 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 = n(0).Model.extend(
{
idAttribute: 'name',
defaults: { name: '', label: '', type: 1, active: !0, private: !1, protected: !1 },
initialize: function () {
var t = this.get('name'),
e = this.get('label');
t ? e || this.set('label', t) : this.set('name', e), this.set('name', i.escapeName(this.get('name')));
},
getFullName: function () {
var t = '';
switch (this.get('type')) {
case 1:
t = '.';
break;
case 2:
t = '#';
}
return t + this.get('name');
},
},
{
TYPE_CLASS: 1,
TYPE_ID: 2,
escapeName: function (t) {
return ('' + t).trim().replace(/([^a-z0-9\w-]+)/gi, '-');
},
},
);
t.exports = i;
},
function (t, e) {
var n;
n = (function () {
return this;
})();
try {
n = n || Function('return this')() || (0, eval)('this');
} catch (t) {
'object' == typeof window && (n = window);
}
t.exports = n;
},
function (t, e, n) {
'use strict';
var i = r(n(1));
r(n(0));
function r(t) {
return t && t.__esModule ? t : { default: t };
}
var o = n(7);
t.exports = i.default.extend({}, o, {
init: function () {
for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n];
o.init.apply(this, e), i.default.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];
o.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 || {};
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)).default.$;
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,
})),
t && this.sorter.startSort(t);
},
getOffsetDim: function () {
var t = this.offset(this.canvas.getFrameEl()),
e = this.offset(this.canvas.getElement());
return { top: t.top - e.top, left: t.left - e.left };
},
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
? i(this.outsideElem)
: !this.posIsLastEl && this.cDim[this.posIndex]
? i(this.cDim[this.posIndex][5]).parent()
: i(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();
},
};
},
function (t, e, n) {
'use strict';
n(0);
var i = 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');
e &&
(this.em
.get('AssetManager')
.FileUploader()
.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,
e = this.classEmpty,
n = this.$el,
i = t.get('src');
t.addAttributes({ src: i }), n[i ? 'removeClass' : 'addClass'](e);
},
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,
types: ['image'],
accept: 'image/*',
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, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
n(42);
var r = n(5),
o = i.default.$;
t.exports = r.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) {
var e = this.model.parseValue(t);
(t = '' + e.value + e.unit), this.inputInst.setValue(t, { silent: 1 });
},
onRender: function () {
var t = this.ppfx;
if (!this.input) {
var e = this.model.input;
(e.ppfx = t),
e.render(),
this.el.querySelector('.' + t + 'fields').appendChild(e.el),
(this.$input = e.inputEl),
(this.unit = e.unitEl),
(this.$unit = o(this.unit)),
(this.input = this.$input.get(0)),
(this.inputInst = e);
}
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
n(5), n(15), n(72), n(71), n(70), n(68), n(43), n(74);
t.exports = i.default.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 || {}),
(this.properties = []);
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;
this.properties.push(n), e ? e.appendChild(i) : this.el.appendChild(i);
},
render: function () {
var t = this;
this.properties = [];
var 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
);
},
});
},
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: {
name: '',
property: '',
type: '',
defaults: '',
info: '',
value: '',
icon: '',
functionName: '',
status: '',
visible: !0,
fixedValues: ['initial', 'inherit'],
important: 0,
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();
},
clearValue: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return this.set({ value: void 0 }, t), this;
},
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 },
n = '!important';
if (
((0, r.isString)(t) && -1 !== t.indexOf(n) && ((e.value = t.replace(n, '').trim()), (e.important = 1)),
!this.get('functionName'))
)
return e;
var i = [],
o = '' + e.value,
s = o.indexOf('(') + 1,
a = o.lastIndexOf(')');
return i.push(s), a >= 0 && i.push(a), (e.value = String.prototype.substring.apply(o, i)), e;
},
getDefaultValue: function () {
return this.get('defaults');
},
getFullValue: function (t) {
var e = this.get('functionName'),
n = (0, r.isUndefined)(t) ? this.get('value') : t;
return (
e && !(0, r.isUndefined)(n) && (n = e + '(' + n + ')'),
this.get('important') && (n += ' !important'),
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 = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(76));
var o = n(17);
t.exports = n(0)
.Collection.extend(r.default)
.extend({
types: [
{
id: 'stack',
model: n(172),
view: n(74),
isType: function (t) {
if (t && 'stack' == t.type) return t;
},
},
{
id: 'composite',
model: n(75),
view: n(43),
isType: function (t) {
if (t && 'composite' == t.type) return t;
},
},
{
id: 'file',
model: o,
view: n(68),
isType: function (t) {
if (t && 'file' == t.type) return t;
},
},
{
id: 'color',
model: o,
view: n(70),
isType: function (t) {
if (t && 'color' == t.type) return t;
},
},
{
id: 'select',
model: n(67),
view: n(71),
isType: function (t) {
if (t && 'select' == t.type) return t;
},
},
{
id: 'radio',
model: n(67),
view: n(72),
isType: function (t) {
if (t && 'radio' == t.type) return t;
},
},
{
id: 'slider',
model: n(166),
view: n(165),
isType: function (t) {
if (t && 'slider' == t.type) return t;
},
},
{
id: 'integer',
model: n(66),
view: n(15),
isType: function (t) {
if (t && 'integer' == t.type) return t;
},
},
{
id: 'base',
model: o,
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 = [];
return (
t.split(' ').forEach(function (t, r) {
var o = e.at(r);
o && n.push(i({}, 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 = n(1),
r = n(10);
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 = [];
return (
(t || this).forEach(function (t) {
return e.push(t.getFullName());
}),
e.join('').trim()
);
},
});
},
function (t, e, n) {
'use strict';
var i, r;
/*! cash-dom 1.3.7, https://github.com/kenwheeler/cash @license MIT */ void 0 ===
(r =
'function' ==
typeof (i = function () {
var t,
e = document,
n = window,
i = Array.prototype,
r = i.slice,
o = i.filter,
s = i.push,
a = function () {},
l = function (t) {
return 'function' == typeof t && t.call;
},
c = function (t) {
return 'string' == typeof t;
},
u = /^#[\w-]*$/,
h = /^\.[\w-]*$/,
d = /<.+>/,
f = /^\w+$/;
function p(t, n) {
n = n || e;
var i = h.test(t)
? n.getElementsByClassName(t.slice(1))
: f.test(t)
? n.getElementsByTagName(t)
: n.querySelectorAll(t);
return i;
}
function g(n) {
if (!t) {
var i = (t = e.implementation.createHTMLDocument(null)).createElement('base');
(i.href = e.location.href), t.head.appendChild(i);
}
return (t.body.innerHTML = n), t.body.childNodes;
}
function v(t) {
'loading' !== e.readyState ? setTimeout(t) : e.addEventListener('DOMContentLoaded', t);
}
function m(t, i) {
if (!t) return this;
if (t.cash && t !== n) return t;
var r,
o = t,
s = 0;
if (c(t)) o = u.test(t) ? e.getElementById(t.slice(1)) : d.test(t) ? g(t) : p(t, i);
else if (l(t)) return v(t), this;
if (!o) return this;
if (o.nodeType || o === n) (this[0] = o), (this.length = 1);
else for (r = this.length = o.length; s < r; s++) this[s] = o[s];
return this;
}
function y(t, e) {
return new m(t, e);
}
var b =
(y.fn =
y.prototype =
m.prototype =
{ cash: !0, length: 0, push: s, splice: i.splice, map: i.map, init: m });
function x(t, e) {
for (var n = t.length, i = 0; i < n && !1 !== e.call(t[i], t[i], i, t); i++);
}
function w(t, e) {
var n =
t &&
(t.matches ||
t.webkitMatchesSelector ||
t.mozMatchesSelector ||
t.msMatchesSelector ||
t.oMatchesSelector);
return !!n && n.call(t, e);
}
function C(t) {
return c(t)
? w
: t.cash
? function (e) {
return t.is(e);
}
: function (t, e) {
return t === e;
};
}
function k(t) {
return y(
r.call(t).filter(function (t, e, n) {
return n.indexOf(t) === e;
}),
);
}
Object.defineProperty(b, 'constructor', { value: y }),
(y.parseHTML = g),
(y.noop = a),
(y.isFunction = l),
(y.isString = c),
(y.extend = b.extend =
function (t) {
t = t || {};
var e = r.call(arguments),
n = e.length,
i = 1;
for (1 === e.length && ((t = this), (i = 0)); i < n; i++)
if (e[i]) for (var o in e[i]) e[i].hasOwnProperty(o) && (t[o] = e[i][o]);
return t;
}),
y.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: x,
matches: w,
unique: k,
isArray: Array.isArray,
isNumeric: function (t) {
return !isNaN(parseFloat(t)) && isFinite(t);
},
});
var S = (y.uid = '_cash' + Date.now());
function T(t) {
return (t[S] = t[S] || {});
}
function E(t, e, n) {
return (T(t)[e] = n);
}
function M(t, e) {
var n = T(t);
return void 0 === n[e] && (n[e] = t.dataset ? t.dataset[e] : y(t).attr('data-' + e)), n[e];
}
b.extend({
data: function (t, e) {
if (c(t))
return void 0 === e
? M(this[0], t)
: this.each(function (n) {
return E(n, t, e);
});
for (var n in t) this.data(n, t[n]);
return this;
},
removeData: function (t) {
return this.each(function (e) {
return (function (t, e) {
var n = T(t);
n ? delete n[e] : t.dataset ? delete t.dataset[e] : y(t).removeAttr('data-' + name);
})(e, t);
});
},
});
var A = /\S+/g;
function O(t) {
return c(t) && t.match(A);
}
function P(t, e) {
return t.classList ? t.classList.contains(e) : new RegExp('(^| )' + e + '( |$)', 'gi').test(t.className);
}
function _(t, e) {
t.classList ? t.classList.add(e) : P(t, e) || (t.className += ' ' + e);
}
function L(t, e) {
t.classList ? t.classList.remove(e) : (t.className = t.className.replace(e, ''));
}
b.extend({
addClass: function (t) {
var e = O(t);
return e
? this.each(function (t) {
x(e, function (e) {
_(t, e);
});
})
: this;
},
attr: function (t, e) {
if (t) {
if (c(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 = O(t);
return (
n &&
n.length &&
this.each(function (t) {
return !(e = P(t, n[0]));
}),
e
);
},
prop: function (t, e) {
if (c(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 = O(t);
return e
? this.each(function (t) {
x(e, function (e) {
L(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 = O(t);
return n
? this.each(function (t) {
x(n, function (e) {
P(t, e) ? L(t, e) : _(t, e);
});
})
: this;
},
}),
b.extend({
add: function (t, e) {
return k(y.merge(this, y(t, e)));
},
each: function (t) {
return x(this, t), this;
},
eq: function (t) {
return y(this.get(t));
},
filter: function (t) {
if (!t) return this;
var e = l(t) ? t : C(t);
return y(
o.call(this, function (n) {
return e(n, t);
}),
);
},
first: function () {
return this.eq(0);
},
get: function (t) {
return void 0 === t ? r.call(this) : t < 0 ? this[t + this.length] : this[t];
},
index: function (t) {
var e = t ? y(t)[0] : this[0],
n = t ? this : y(e).parent().children();
return r.call(n).indexOf(e);
},
last: function () {
return this.eq(-1);
},
});
var N = (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, '');
};
})(),
D = (function () {
var t = {},
e = document,
n = e.createElement('div'),
i = n.style;
return function (e) {
if (((e = N(e)), t[e])) return t[e];
var n = e.charAt(0).toUpperCase() + e.slice(1),
r = (e + ' ' + ['webkit', 'moz', 'ms', 'o'].join(n + ' ') + n).split(' ');
return (
x(r, function (n) {
if (n in i) return (t[n] = e = t[e] = n), !1;
}),
t[e]
);
};
})();
function I(t, e) {
return parseInt(n.getComputedStyle(t[0], null)[e], 10) || 0;
}
function F(t, e, n) {
var i,
r = M(t, '_cashEvents'),
o = r && r[e];
o &&
(n
? (t.removeEventListener(e, n), (i = o.indexOf(n)) >= 0 && o.splice(i, 1))
: (x(o, function (n) {
t.removeEventListener(e, n);
}),
(o = [])));
}
function R(t, e) {
return '&' + encodeURIComponent(t) + '=' + encodeURIComponent(e).replace(/%20/g, '+');
}
function j(t) {
var e = t.type;
if (!e) return null;
switch (e.toLowerCase()) {
case 'select-one':
return (function (t) {
var e = t.selectedIndex;
return e >= 0 ? t.options[e].value : null;
})(t);
case 'select-multiple':
return (function (t) {
var e = [];
return (
x(t.options, function (t) {
t.selected && e.push(t.value);
}),
e.length ? e : null
);
})(t);
case 'radio':
case 'checkbox':
return t.checked ? t.value : null;
default:
return t.value ? t.value : null;
}
}
function z(t, e, n) {
var i = c(e);
i || !e.length
? x(
t,
i
? function (t) {
return t.insertAdjacentHTML(n ? 'afterbegin' : 'beforeend', e);
}
: function (t, i) {
return (function (t, e, n) {
if (n) {
var i = t.childNodes[0];
t.insertBefore(e, i);
} else t.appendChild(e);
})(t, 0 === i ? e : e.cloneNode(!0), n);
},
)
: x(e, function (e) {
return z(t, e, n);
});
}
(y.prefixedProp = D),
(y.camelCase = N),
b.extend({
css: function (t, e) {
if (c(t))
return (
(t = D(t)),
arguments.length > 1
? this.each(function (n) {
return (n.style[t] = e);
})
: n.getComputedStyle(this[0])[t]
);
for (var i in t) this.css(i, t[i]);
return this;
},
}),
x(['Width', 'Height'], function (t) {
var e = t.toLowerCase();
(b[e] = function () {
return this[0].getBoundingClientRect()[e];
}),
(b['inner' + t] = function () {
return this[0]['client' + t];
}),
(b['outer' + t] = function (e) {
return (
this[0]['offset' + t] +
(e
? I(this, 'margin' + ('Width' === t ? 'Left' : 'Top')) +
I(this, 'margin' + ('Width' === t ? 'Right' : 'Bottom'))
: 0)
);
});
}),
b.extend({
off: function (t, e) {
return this.each(function (n) {
return F(n, t, e);
});
},
on: function (t, e, n, i) {
var r;
if (!c(t)) {
for (var o in t) this.on(o, e, t[o]);
return this;
}
return (
l(e) && ((n = e), (e = null)),
'ready' === t
? (v(n), this)
: (e &&
((r = n),
(n = function (t) {
for (var n = t.target; !w(n, e); ) {
if (n === this) return (n = !1);
n = n.parentNode;
}
n && r.call(n, t);
})),
this.each(function (e) {
var r = n;
i &&
(r = function () {
n.apply(this, arguments), F(e, t, r);
}),
(function (t, e, n) {
var i = M(t, '_cashEvents') || E(t, '_cashEvents', {});
(i[e] = i[e] || []), i[e].push(n), t.addEventListener(e, n);
})(e, t, r);
}))
);
},
one: function (t, e, n) {
return this.on(t, e, n, !0);
},
ready: v,
trigger: function (t, n) {
var i = e.createEvent('HTMLEvents');
return (
(i.data = n),
i.initEvent(t, !0, !1),
this.each(function (t) {
return t.dispatchEvent(i);
})
);
},
}),
b.extend({
serialize: function () {
var t = '';
return (
x(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 = j(e);
null !== i &&
x(i, function (e) {
t += R(n, e);
});
break;
default:
var r = j(e);
null !== r && (t += R(n, r));
}
}
}),
t.substr(1)
);
},
val: function (t) {
return void 0 === t
? j(this[0])
: this.each(function (e) {
return (e.value = t);
});
},
}),
b.extend({
after: function (t) {
return y(t).insertAfter(this), this;
},
append: function (t) {
return z(this, t), this;
},
appendTo: function (t) {
return z(y(t), this), this;
},
before: function (t) {
return y(t).insertBefore(this), this;
},
clone: function () {
return y(
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 (
y(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 (
y(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 z(this, t, !0), this;
},
prependTo: function (t) {
return z(y(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 H = e.documentElement;
return (
b.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 + n.pageYOffset - H.clientTop, left: t.left + n.pageXOffset - H.clientLeft };
},
offsetParent: function () {
return y(this[0].offsetParent);
},
}),
b.extend({
children: function (t) {
var e = [];
return (
this.each(function (t) {
s.apply(e, t.children);
}),
(e = k(e)),
t
? e.filter(function (e) {
return w(e, t);
})
: e
);
},
closest: function (t) {
return !t || this.length < 1 ? y() : this.is(t) ? this.filter(t) : this.parent().closest(t);
},
is: function (t) {
if (!t) return !1;
var e = !1,
n = C(t);
return (
this.each(function (i) {
return !(e = n(i, t));
}),
e
);
},
find: function (t) {
if (!t || t.nodeType) return y(t && this.has(t).length ? t : null);
var e = [];
return (
this.each(function (n) {
s.apply(e, p(t, n));
}),
k(e)
);
},
has: function (t) {
var e = c(t)
? function (e) {
return 0 !== p(t, e).length;
}
: function (e) {
return e.contains(t);
};
return this.filter(e);
},
next: function () {
return y(this[0].nextElementSibling);
},
not: function (t) {
if (!t) return this;
var e = C(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);
}),
k(t)
);
},
parents: function (t) {
var n,
i = [];
return (
this.each(function (r) {
for (n = r; n && n.parentNode && n !== e.body.parentNode; )
(n = n.parentNode), (!t || (t && w(n, t))) && i.push(n);
}),
k(i)
);
},
prev: function () {
return y(this[0].previousElementSibling);
},
siblings: function () {
var t = this.parent().children(),
e = this[0];
return t.filter(function (t) {
return t !== e;
});
},
}),
y
);
})
? i.call(e, n, e, t)
: i) || (t.exports = r);
},
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 = {
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.blur(),
s.focus(r),
s
);
},
stop: function () {
var t = this.canvasResizer;
t && t.blur();
},
};
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(1));
t.exports = {
getPanels: function (t) {
return this.panels || (this.panels = t.Panels.getPanelsEl()), this.panels;
},
tglPointers: function (t, e) {
var n = t.Canvas.getBody().querySelectorAll('.' + this.ppfx + 'no-pointer');
i.default.each(n, function (t) {
t.style.pointerEvents = e ? '' : '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'),
t.Canvas.getElement().setAttribute('style', ''),
this.helper && (this.helper.style.display = 'none'),
t.trigger('change:canvasOffset'),
this.tglPointers(t, 1);
},
};
},
function (t, e, n) {
'use strict';
t.exports = {
isEnabled: function () {
var t = document;
return t.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement ? 1 : 0;
},
enable: function (t) {
var e = '';
return (
t.requestFullscreen
? t.requestFullscreen()
: t.webkitRequestFullscreen
? ((e = 'webkit'), t.webkitRequestFullscreen())
: t.mozRequestFullScreen
? ((e = 'moz'), t.mozRequestFullScreen())
: t.msRequestFullscreen
? t.msRequestFullscreen()
: console.warn('Fullscreen not supported'),
e
);
},
disable: function () {
var t = document;
t.exitFullscreen
? t.exitFullscreen()
: t.webkitExitFullscreen
? t.webkitExitFullscreen()
: t.mozCancelFullScreen
? t.mozCancelFullScreen()
: t.msExitFullscreen && t.msExitFullscreen();
},
fsChanged: function (t, e) {
document;
var n = (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';
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';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)).default.$;
t.exports = {
getOffsetMethod: function (t) {
return 'get' + (t || '') + 'OffsetViewerEl';
},
run: function (t, e, n) {
var r = n || {},
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 = a[this.getOffsetMethod(o)]();
f.style.display = 'block';
var p = 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];
if (!this[d]) {
var C = o.toLowerCase(),
k = C + 'margin-v',
S = C + 'padding-v',
T = i('<div class="' + h + 'marginName">').get(0),
E = i('<div class="' + h + 'paddingName">').get(0),
M = h + k + '-el' + ' ' + (h + k),
A = h + S + '-el' + ' ' + (h + S);
(p = i('<div class="' + M + '-top"></div>').get(0)),
(g = i('<div class="' + M + '-bottom"></div>').get(0)),
(v = i('<div class="' + M + '-left"></div>').get(0)),
(m = i('<div class="' + M + '-right"></div>').get(0)),
(y = i('<div class="' + A + '-top"></div>').get(0)),
(b = i('<div class="' + A + '-bottom"></div>').get(0)),
(x = i('<div class="' + A + '-left"></div>').get(0)),
(w = i('<div class="' + A + '-right"></div>').get(0)),
(this['marginT' + o] = p),
(this['marginB' + o] = g),
(this['marginL' + o] = v),
(this['marginR' + o] = m),
(this['padT' + o] = y),
(this['padB' + o] = b),
(this['padL' + o] = x),
(this['padR' + o] = w),
T.appendChild(p),
T.appendChild(g),
T.appendChild(v),
T.appendChild(m),
E.appendChild(y),
E.appendChild(b),
E.appendChild(x),
E.appendChild(w),
f.appendChild(T),
f.appendChild(E),
(this[d] = '1');
}
var O = u.marginLeft.replace('px', ''),
P = parseInt(u.marginTop.replace('px', '')),
_ = parseInt(u.marginBottom.replace('px', '')),
L = p.style,
N = g.style,
D = v.style,
I = m.style,
F = y.style,
R = b.style,
j = x.style,
z = w.style,
H = parseInt(c.left);
(L.height = u.marginTop),
(L.width = u.width),
(L.top = c.top - u.marginTop.replace('px', '') + 'px'),
(L.left = H + 'px'),
(N.height = u.marginBottom),
(N.width = u.width),
(N.top = c.top + c.height + 'px'),
(N.left = H + 'px');
var V = c.height + P + _ + 'px',
$ = c.top - P + 'px';
(D.height = V),
(D.width = u.marginLeft),
(D.top = $),
(D.left = H - O + 'px'),
(I.height = V),
(I.width = u.marginRight),
(I.top = $),
(I.left = H + c.width + 'px');
var B = parseInt(u.paddingTop.replace('px', ''));
(F.height = u.paddingTop), (F.width = u.width), (F.top = c.top + 'px'), (F.left = H + 'px');
var W = parseInt(u.paddingBottom.replace('px', ''));
(R.height = u.paddingBottom),
(R.width = u.width),
(R.top = c.top + c.height - W + 'px'),
(R.left = H + 'px');
var U = c.height - W - B + 'px',
q = c.top + B + 'px';
(j.height = U), (j.width = u.paddingLeft), (j.top = q), (j.left = c.left + 'px');
var K = parseInt(u.paddingRight.replace('px', ''));
(z.height = U), (z.width = u.paddingRight), (z.top = q), (z.left = c.left + c.width - K + 'px');
}
},
stop: function (t, e, n) {
var i = (n || {}).state || '',
r = this.getOffsetMethod(i);
t.Canvas[r]().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 = r.getContainer(),
a = n.modalTitle || o.modalTitle || '',
l = n.types,
c = n.accept;
if (
(r.setTarget(n.target),
r.onClick(n.onClick),
r.onDblClick(n.onDblClick),
r.onSelect(n.onSelect),
!this.rendered || l)
) {
var u = r.getAll();
l &&
(u = u.filter(function (t) {
return -1 !== l.indexOf(t.get('type'));
})),
r.render(u),
(this.rendered = 1);
}
if (c) {
var h = s.querySelector('input#' + o.stylePrefix + 'uploadFile');
h && h.setAttribute('accept', c);
}
i.setTitle(a), i.setContent(s), i.open();
},
};
},
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';
var i = n(0).$;
t.exports = {
run: function (t, e) {
this.sender = e;
var n = t.Config.stylePrefix,
r = t.TraitManager;
if (!this.$cn) {
var o = r.getTraitsViewer(),
s = r.getConfig();
(this.$cn = i('<div></div>')),
(this.$cn2 = i('<div></div>')),
this.$cn.append(this.$cn2),
(this.$header = i('<div>').append(
'<div class="' + s.stylePrefix + 'header">' + s.textNoElement + '</div>',
)),
this.$cn.append(this.$header),
this.$cn2.append('<div class="' + n + 'traits-label">' + s.labelContainer + '</div>'),
this.$cn2.append(o.render().el);
var a = t.Panels;
(a.getPanel('views-container') ? a.getPanel('views-container') : a.addPanel({ id: 'views-container' }))
.set('appendContent', this.$cn.get(0))
.trigger('change:appendContent'),
(this.target = t.getModel()),
this.listenTo(this.target, 'component:toggled', this.toggleTm);
}
this.toggleTm();
},
toggleTm: function () {
var t = this.sender;
(t && t.get && !t.get('active')) ||
(1 === this.target.getSelectedAll().length
? (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';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
n(77);
var r = i.default.$;
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)
i.addPanel({ id: 'devices-c' }).set('appendContent', o.render()).trigger('change:appendContent');
var s = t.SelectorManager;
s && this.$cn2.append(s.render([])), this.$cn2.append(t.StyleManager.render());
var a = t.StyleManager.getConfig(),
l = a.stylePrefix;
(this.$header = r('<div class="' + l + 'header">' + a.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, 'component:toggled', this.toggleSm);
}
this.toggleSm();
},
toggleSm: function () {
var t = this.target,
e = this.sender;
(e && e.get && !e.get('active')) ||
(1 === t.getSelectedAll().length
? (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';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
n(54), i.default.$;
t.exports = {
run: function (t) {
var e = t.LayerManager,
n = t.Panels;
if (!this.layers) {
var i = 'views-container',
r = document.createElement('div'),
o = n.getPanel(i) || n.addPanel({ id: i });
r.appendChild(e.render()), o.set('appendContent', r).trigger('change:appendContent'), (this.layers = r);
}
this.layers.style.display = 'block';
},
stop: function () {
var t = this.layers;
t && (t.style.display = 'none');
},
};
},
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';
var i = r(n(1));
r(n(0));
function r(t) {
return t && t.__esModule ? t : { default: t };
}
var o = n(7);
t.exports = i.default.extend({}, o, {
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));
},
});
},
function (t, e, n) {
'use strict';
var i = s(n(1)),
r = s(n(0)),
o = n(2);
function s(t) {
return t && t.__esModule ? t : { default: t };
}
var a = n(8),
l = n(13),
c = r.default.$;
t.exports = i.default.extend({}, l, a, {
init: function (t) {
a.init.apply(this, arguments),
i.default.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];
a.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 = c(t.target).data('model').get('draggable');
e &&
((this.cacheEl = null),
this.startSelectPosition(t.target, this.frameEl.contentDocument),
(this.sorter.draggable = e),
(this.sorter.onEndMove = this.onEndMove.bind(this)),
this.stopSelectComponent(),
this.$wrapper.off('mousedown', this.initSorter),
(0, o.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, o.on)(this.getContentWindow(), 'keydown', this.rollback);
}
},
initSorterFromModels: function (t) {
this.cacheEl = null;
var e = t[t.length - 1],
n = this.frameEl.contentDocument;
this.startSelectPosition(e.view.el, n),
(this.sorter.draggable = e.get('draggable')),
(this.sorter.toMove = t),
(this.sorter.onEndMove = this.onEndMoveFromModel.bind(this)),
this.stopSelectComponent(),
(0, o.on)(this.getContentWindow(), 'keydown', this.rollback);
},
onEndMoveFromModel: function () {
(0, o.off)(this.getContentWindow(), 'keydown', this.rollback);
},
onEndMove: function () {
this.enable(), (0, o.off)(this.getContentWindow(), 'keydown', this.rollback);
},
onSelect: function (t, e) {},
rollback: function (t, e) {
((t.which || t.keyCode) == this.opt.ESCAPE_KEY || e) && ((this.sorter.moved = !1), this.sorter.endMove());
},
getBadgeEl: function () {
return this.$badge || (this.$badge = c(this.getBadge())), this.$badge;
},
getHighlighterEl: function () {
return this.$hl || (this.$hl = c(this.canvas.getHighlighter())), this.$hl;
},
stop: function () {
for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n];
a.stop.apply(this, e),
this.getBadgeEl().removeClass(this.badgeClass),
this.getHighlighterEl().removeClass(this.hoverClass),
this.$wrapper.css('cursor', '').unbind().removeClass(this.noSelClass);
},
});
},
function (t, e, n) {
'use strict';
var i = r(n(1));
r(n(0));
function r(t) {
return t && t.__esModule ? t : { default: t };
}
var o = n(12);
t.exports = i.default.extend({}, o, {
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);
},
});
},
function (t, e, n) {
'use strict';
var i = o(n(1)),
r = o(n(0));
function o(t) {
return t && t.__esModule ? t : { default: t };
}
var s = n(8),
a = r.default.$;
t.exports = i.default.extend({}, s, {
init: function (t) {
i.default.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 = a(t.target);
e.data('model').get('removable') && (e.addClass(this.hoverClass), this.attachBadge(e.get(0)));
},
stopDelete: function (t) {
t.stopPropagation(),
a(t.target).removeClass(this.hoverClass),
this.badge && this.badge.css({ left: -1e3, top: -1e3 });
},
onDelete: function (t) {
t.stopPropagation();
var e = a(t.target);
e.data('model').get('removable') && (e.data('model').destroy(), this.removeBadge(), this.clean());
},
updateBadgeLabel: function (t) {
this.badge.html('Remove ' + t.getName());
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)).default.$;
t.exports = {
run: function (t, e) {
arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
e && e.set && e.set('active', 0);
var n = t.getConfig(),
r = t.Modal,
o = n.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 = i('<div class="' + o + 'export-dl"></div>');
l.append(s.$el).append(a.$el), (this.$editors = l);
}
r.setTitle(n.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 };
},
};
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = i.default.$;
t.exports = i.default.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 = r(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) {},
callRun: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = this.id;
if ((t.trigger('run:' + n + ':before', e), !e || !e.abort)) {
var i = this.run(t, t, e);
return t.trigger('run:' + n, i, e), i;
}
t.trigger('abort:' + n, e);
},
callStop: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = this.id;
t.trigger('stop:' + n + ':before', e);
var i = this.stop(t, t, e);
return t.trigger('stop:' + n, i, e), i;
},
run: function (t, e) {},
stop: function (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(4);
t.exports = r.extend({ defaults: i({}, r.prototype.defaults, { type: 'text', droppable: !1, editable: !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: '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) {
if (i.get('Commands').has('image-editor')) {
for (var o = !1, s = this.get('toolbar'), a = 0; a < s.length; a++)
if ('image-editor' === s[a].command) {
o = !0;
break;
}
o ||
(s.push({ attributes: { class: 'fa fa-pencil' }, command: 'image-editor' }), this.set('toolbar', s));
}
}
},
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 = 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';
(function (e) {
var i = n(1),
r = n(2),
o = n(73);
n(0).$;
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.get('step'),
i = 0;
if (isNaN(t)) return e;
if (((t = parseFloat(t)), Math.floor(t) !== t)) {
var r = n.toString().split('.')[1];
i = r ? r.length : 0;
}
return i ? parseFloat(t.toFixed(i)) : t;
},
validateInputValue: function (t, n) {
var r = 0,
o = n || {},
s = this.model,
a = (0, i.isUndefined)(t) ? '' : t,
l = s.get('units') || [],
c = s.get('unit') || (l.length && l[0]) || '',
u = s.get('max'),
h = s.get('min');
if (o.deepCheck) {
var d = s.get('fixedValues') || [];
if (a) {
var f = new RegExp('^' + d.join('|'), 'g');
if (d.length && f.test(a)) (a = a.match(f)[0]), (c = ''), (r = 1);
else {
var p = a + '';
(a += ''), (a = parseFloat(a.replace(',', '.'))), (a = isNaN(a) ? '' : a);
var g = p.replace(a, '');
e.indexOf(l, g) >= 0 && (c = g);
}
}
}
return (
(0, i.isUndefined)(u) || '' === u || (a = a > u ? u : a),
(0, i.isUndefined)(h) || '' === h || (a = a < h ? h : a),
{ force: r, value: a, unit: c }
);
},
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(this, n(1));
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(5),
o = i.default.$;
t.exports = r.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];
r.prototype.inputValueChanged.apply(this, e);
}
},
clear: function (t) {
var e = this.properties;
e &&
e.forEach(function (t) {
return t.clear();
}),
r.prototype.clear.apply(this, arguments);
},
onRender: function () {
var t = this.model,
e = t.get('properties') || [];
if (
((this.properties = []),
e.length &&
(this.$input || ((this.$input = o('<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), console.warn('Nested composite types not yet allowed.')),
(e.parent = t);
}, this);
var i = new (n(16))(this.getPropsConfig());
(this.$props = i.render().$el),
(this.properties = i.properties),
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 });
i ? (n = i.split(' ')[t]) : (n = e && e.getTargetValue({ ignoreCustomValue: 1, ignoreDefault: 1 }));
return e && (n = e.model.parseValue(n).value), n;
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.Model.extend({ defaults: { id: '', label: '', open: !0, attributes: {} } });
},
function (t, e, n) {
'use strict';
var i = n(1);
t.exports = {
run: function (t) {
var e = t.getModel(),
n = e.get('clipboard'),
r = t.getSelected();
n &&
r &&
!e.isEditing() &&
(t.getSelectedAll().forEach(function (e) {
if (e) {
var r = e.collection,
o = r.indexOf(e) + 1,
s = n.filter(function (t) {
return t.get('copyable');
}),
a = void 0;
(a =
(0, i.contains)(n, e) && e.get('copyable')
? r.add(e.clone(), { at: o })
: r.add(
s.map(function (t) {
return t.clone();
}),
{ at: o },
)),
(a = (0, i.isArray)(a) ? a : [a]).forEach(function (e) {
return t.trigger('component:clone', e);
});
}
}),
r.emitUpdate());
},
};
},
function (t, e, n) {
'use strict';
t.exports = {
run: function (t) {
var e = t.getModel(),
n = [].concat(
(function (t) {
if (Array.isArray(t)) {
for (var e = 0, n = Array(t.length); e < t.length; e++) n[e] = t[e];
return n;
}
return Array.from(t);
})(t.getSelectedAll()),
);
n.length && !e.isEditing() && e.set('clipboard', n);
},
};
},
function (t, e, n) {
'use strict';
t.exports = {
run: function (t) {
if (t.Canvas.hasFocus() && !t.getModel().isEditing()) {
var e = [];
t.getSelectedAll().forEach(function (t) {
var n = t.collection,
i = n.indexOf(t),
r = n.at(i - 1);
e.push(r && i - 1 >= 0 ? r : t);
}),
e.length && t.select(e);
}
},
};
},
function (t, e, n) {
'use strict';
t.exports = {
run: function (t) {
if (t.Canvas.hasFocus() && !t.getModel().isEditing()) {
var e = [];
t.getSelectedAll().forEach(function (t) {
var n = t.collection,
i = n.indexOf(t),
r = n.at(i + 1);
e.push(r || t);
}),
e.length && t.select(e);
}
},
};
},
function (t, e, n) {
'use strict';
t.exports = {
run: function (t) {
if (t.Canvas.hasFocus() && !t.getModel().isEditing()) {
var e = [];
t.getSelectedAll().forEach(function (t) {
var n = t.parent();
n && e.push(n);
}),
e.length && t.select(e);
}
},
};
},
function (t, e, n) {
'use strict';
t.exports = {
run: function (t) {
if (t.Canvas.hasFocus() && !t.getModel().isEditing()) {
var e = [];
t.getSelectedAll().forEach(function (t) {
var n = t.components(),
i = n && n.at(0);
i && e.push(i);
}),
e.length && t.select(e);
}
},
};
},
function (t, e, n) {
'use strict';
var i = n(1);
t.exports = {
run: function (t, e) {
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
if (t.Canvas.hasFocus() && !t.getModel().isEditing()) {
var r = n.component || t.getSelectedAll();
return (
(r = (0, i.isArray)(r)
? [].concat(
(function (t) {
if (Array.isArray(t)) {
for (var e = 0, n = Array(t.length); e < t.length; e++) n[e] = t[e];
return n;
}
return Array.from(t);
})(r),
)
: [r]),
t.select(null),
r.forEach(function (t) {
if (t && t.get('removable')) {
if (t) {
var e = t.collection;
e && e.remove(t);
}
} else console.warn('The element is not removable', t);
}),
r
);
}
},
};
},
function (t, e, n) {
'use strict';
t.exports = {
run: function (t) {
t.DomComponents.clear(), t.CssComposer.clear();
},
};
},
function (t, e, n) {
'use strict';
var i = n(1),
r = n(2),
o = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var s = n(3),
a = o.default.$,
l = void 0;
t.exports = o.default.View.extend({
events: {
'mousedown [data-toggle-move]': 'startSort',
'click [data-toggle-visible]': 'toggleVisibility',
'click [data-toggle-select]': 'handleSelect',
'mouseover [data-toggle-select]': 'handleHover',
'click [data-toggle-open]': 'toggleOpening',
'dblclick [data-name]': 'handleEdit',
'focusout [data-name]': 'handleEditEnd',
},
template: function (t) {
var e = this.pfx,
n = this.ppfx,
i = this.config.hidable,
r = this.countChildren(t),
o = r ? '' : this.clsNoChild,
s = this.clsTitle + ' ' + o,
a = this.clsTitleC + ' ' + n + 'one-bg',
l = this.clsCaret + ' fa fa-chevron-right',
c = this.inputNameCls + ' ' + n + 'no-app',
u = 30 + 10 * (this.level + 1) + 'px',
h = t.getName();
return (
'\n ' +
(i
? '<i class="' +
e +
'layer-vis fa fa-eye ' +
(this.isVisible() ? '' : 'fa-eye-slash') +
'" data-toggle-visible></i>'
: '') +
'\n <div class="' +
a +
'">\n <div class="' +
s +
'" style="padding-left: ' +
u +
'" data-toggle-select>\n <div class="' +
e +
'layer-title-inn">\n <i class="' +
l +
'" data-toggle-open></i>\n ' +
t.getIcon() +
'\n <span class="' +
c +
'" data-name>' +
h +
'</span>\n </div>\n </div>\n </div>\n <div class="' +
this.clsCount +
'">' +
(r || '') +
'</div>\n <div class="' +
this.clsMove +
'" data-toggle-move>\n <i class="fa fa-arrows"></i>\n </div>\n <div class="' +
this.clsChildren +
'"></div>'
);
},
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, 'change:status', this.updateStatus),
this.listenTo(i, 'change:open', this.updateOpening),
this.listenTo(i, 'change:style:display', this.updateVisibility),
(this.className = e + 'layer no-select ' + n + 'two-color'),
(this.inputNameCls = n + 'layer-name'),
(this.clsTitleC = e + 'layer-title-c'),
(this.clsTitle = e + 'layer-title'),
(this.clsCaret = e + 'layer-caret'),
(this.clsCount = e + 'layer-count'),
(this.clsMove = e + 'layer-move'),
(this.clsChildren = e + 'layer-children'),
(this.clsNoChild = e + 'layer-no-chld'),
this.$el.data('model', i),
this.$el.data('collection', r),
(i.viewLayer = this);
},
getVisibilityEl: function () {
return this.eyeEl || (this.eyeEl = this.$el.children('.' + this.pfx + 'layer-vis')), this.eyeEl;
},
updateVisibility: function () {
var t = this.pfx + 'layer-hidden',
e = 'none' == this.model.getStyle().display ? 'addClass' : 'removeClass';
this.$el[e](t), this.getVisibilityEl()[e]('fa-eye-slash');
},
toggleVisibility: function (t) {
t && t.stopPropagation();
var e = this.model,
n = e.getStyle();
'none' == n.display ? delete n.display : (n.display = 'none'), e.setStyle(n);
},
handleEdit: function (t) {
t && t.stopPropagation();
var e = this.getInputName();
(e.contentEditable = !0), e.focus();
},
handleEditEnd: function (t) {
t && t.stopPropagation();
var e = this.getInputName(),
n = e.textContent;
(e.contentEditable = !1), this.model.set({ name: n });
},
getInputName: function () {
return this.inputName || (this.inputName = this.el.querySelector('.' + this.inputNameCls)), this.inputName;
},
updateOpening: function () {
var t = this.opt.opened || {},
e = this.model;
e.get('open')
? (this.$el.addClass('open'), this.getCaret().addClass('fa-chevron-down'), (t[e.cid] = e))
: (this.$el.removeClass('open'), this.getCaret().removeClass('fa-chevron-down'), 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();
var e = this.em,
n = this.config;
if (e) {
var i = this.model;
e.setSelected(i, { fromLayers: 1 });
var r = n.scrollCanvas;
r && e.get('Canvas').scrollTo(i, r);
}
},
handleHover: function (t) {
t.stopPropagation();
var e = this.em,
n = this.config,
i = this.model;
e && n.showHover && e.setHovered(i, { fromLayers: 1 });
},
startSort: function (t) {
t.stopPropagation();
var e = this.sorter;
0 === t.button && e && e.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) {
s.prototype.updateStatus.apply(this, [{ avoidHover: !this.config.highlightHover }]);
},
isVisible: function () {
var t = this.model.get('style').display;
if (!t || 'none' != t) return 1;
},
checkChildren: function () {
var t = this.model,
e = this.countChildren(t),
n = (this.pfx, this.clsNoChild),
i = this.$el.children('.' + this.clsTitleC).children('.' + this.clsTitle);
this.cnt || (this.cnt = this.$el.children('.' + this.clsCount)),
e ? (i.removeClass(n), this.cnt.html(e)) : (i.addClass(n), this.cnt.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 || !this.caret.length) {
this.pfx;
this.caret = this.$el.children('.' + this.clsTitleC).find('.' + this.clsCaret);
}
return this.caret;
},
setRoot: function (t) {
t = (0, i.isString)(t) ? this.em.getWrapper().find(t)[0] : t;
var e = (0, r.getModel)(t, a);
e && (this.stopListening(), (this.model = e), this.initialize(this.opt), this.render());
},
render: function () {
var t = this.model,
e = this.pfx,
r = this.isVisible(),
o = this.$el.empty(),
s = this.level + 1;
(0, i.isUndefined)(l) && (l = n(113));
var a = new l({
collection: t.get('components'),
config: this.config,
sorter: this.sorter,
opened: this.opt.opened,
parent: t,
level: s,
}).render().$el;
return (
this.config.showWrapper || 1 !== s
? (o.html(this.template(t)), o.find('.' + this.clsChildren).append(a))
: o.append(a),
(t.get('draggable') && this.config.sortable) || o.children('.' + this.clsMove).remove(),
!r && (this.className += ' ' + e + 'hide'),
o.attr('class', this.className),
this.updateOpening(),
this.updateStatus(),
this.updateVisibility(),
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 = a(n(114)),
o = a(n(53)),
s = n(1);
function a(t) {
return t && t.__esModule ? t : { default: t };
}
t.exports = function () {
var t = void 0,
e = void 0,
n = {};
return {
name: 'LayerManager',
init: function () {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return ((n = i({}, r.default, e)).stylePrefix = e.pStylePrefix), (t = n.em), this;
},
getConfig: function () {
return n;
},
onLoad: function () {
(e = new o.default({
level: 0,
config: n,
opened: n.opened || {},
model: t.get('DomComponents').getWrapper(),
})),
t && t.on('component:selected', this.componentChanged),
this.componentChanged();
},
postRender: function () {
var t = n.appendTo,
e = n.root;
(e && this.setRoot(e), t) &&
((0, s.isElement)(t) ? t : document.querySelector(t)).appendChild(this.render());
},
setRoot: function (t) {
return e.setRoot(t), this;
},
getRoot: function () {
return e.model;
},
getAll: function () {
return e;
},
componentChanged: function (e) {
if (!(arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}).fromLayers) {
var i = t.get('opened'),
r = t.getSelected(),
o = n.scrollLayers,
s = r && r.collection ? r.collection.parent : null;
for (var a in i) i[a].set('open', 0);
for (; s; ) s.set('open', 1), (i[s.cid] = s), (s = s.collection ? s.collection.parent : null);
if (r && o) {
var l = r.viewLayer && r.viewLayer.el;
l && l.scrollIntoView(o);
}
}
},
render: function () {
return e.render().el;
},
};
};
},
function (t, e, n) {
'use strict';
var i = n(2),
r = n(3);
t.exports = r.extend({
events: { dblclick: 'enableEditing', input: 'onInput' },
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 (t) {
t && t.stopPropagation && t.stopPropagation();
var e = this.rte;
if (!this.rteEnabled && this.model.get('editable')) {
if (e)
try {
this.activeRte = e.enable(this, this.activeRte);
} catch (t) {
console.error(t);
}
(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 (t) {
console.error(t);
}
var i = this.getChildrenContainer().innerHTML,
r = t.get('components');
if ((r.length && r.reset(), t.set('content', ''), n.customRte)) t.set('content', i);
else {
t.trigger('change:content', t),
r.add(i),
r.each(function (t) {
return (function t(e) {
e.set({ editable: 0, highlightable: 0, removable: 0, draggable: 0, copyable: 0, toolbar: '' }),
e.get('components').each(function (e) {
return t(e);
});
})(t);
}),
r.trigger('resetNavigator');
}
}
(this.rteEnabled = 0), this.toggleEvents();
},
onInput: function (t) {
var e = this.em;
e && e.trigger('change:canvasOffset');
},
disablePropagation: function (t) {
t.stopPropagation();
},
toggleEvents: function (t) {
var e = t ? 'on' : 'off',
n = { on: i.on, off: i.off };
this.em.setEditing(t);
var 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';
n(0);
var i = n(55);
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 = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
r = n(1);
t.exports = i.default.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),
this.listenTo(e, 'remove', this.removeChildren);
},
removeChildren: function (t) {
var e = this.config.em,
n = t.view;
if (n) {
n.remove.apply(n);
var i = n.childrenView;
i && i.stopListening(), e && e.trigger('component:remove', t);
}
},
addTo: function (t) {
arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
var e = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
n = this.config.em,
i = this.collection.indexOf(t);
this.addToCollection(t, null, i), n && !e.temporary && n.trigger('component:add', t);
},
addToCollection: function (t, e, i) {
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++
) {
if (a[c].id == l) {
s = a[c].view;
break;
}
}
var u = new s({ model: t, config: this.config, componentTypes: a }),
h = u.render().el;
if (('textnode' == u.model.get('type') && (h = document.createTextNode(u.model.get('content'))), o))
o.appendChild(h);
else {
var d = this.parentEl,
f = d.childNodes;
if ((0, r.isUndefined)(i)) d.appendChild(h);
else {
var p = f.length == i;
p && i--, p || !f.length ? d.appendChild(h) : d.insertBefore(h, f[i]);
}
}
return h;
},
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
);
},
});
},
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++) {
if (r[o].id == 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('CssComposer'),
i = this.em.get('Parser').parseHtml(t);
if (((t = i.html), i.css && n)) {
var o = e.avoidUpdateStyle;
n.addCollection(i.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';
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).render().el;
n ? n.appendChild(o) : this.$el.append(o);
},
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';
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;
this.listenTo(e, 'change:style change:state change:mediaText', this.render),
this.listenTo(e, 'destroy remove', this.remove),
this.listenTo(e.get('selectors'), 'change', this.render);
},
render: function () {
var t = this.model.get('important');
return (this.el.innerHTML = this.model.toCSS({ important: t })), this;
},
});
},
function (t, e, n) {
'use strict';
Object.defineProperty(e, '__esModule', { value: !0 });
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(2);
var s = (0,
(function (t) {
return t && t.__esModule ? t : { default: t };
})(n(82)).default)().parseStyle;
e.default = {
parseStyle: s,
extendStyle: function (t) {
return i({}, this.getStyle(), t);
},
getStyle: function () {
return i({}, 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, r.isString)(e) && (e = s(e));
var a = this.getStyle(),
l = i({}, e);
this.set('style', l, n);
var c = (0, o.shallowDiff)(a, l);
return (
(0, r.keys)(c).forEach(function (e) {
var n = t.em;
t.trigger('change:style:' + e),
n && (n.trigger('styleable:change', t, e), n.trigger('styleable:change:' + e, t, e));
}),
l
);
},
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 o = t.important,
s = (0, r.isArray)(o) ? o.indexOf(i) >= 0 : o,
a = n[i] + (s ? ' !important' : '');
a && e.push(i + ':' + a + ';');
}
return e.join('');
},
};
},
function (t, e, n) {
'use strict';
var i = n(1),
r = a(i),
o = a(n(0)),
s = a(n(61));
function a(t) {
return t && t.__esModule ? t : { default: t };
}
var l = n(19);
t.exports = o.default.Model.extend(s.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 l(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;
},
toJSON: function () {
for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n];
var r = o.default.Model.prototype.toJSON.apply(this, e);
if (this.em.getConfig('avoidDefaults')) {
var s = this.defaults;
(0, i.forEach)(s, function (t, e) {
r[e] === t && delete r[e];
}),
(0, i.isEmpty)(r.selectors) && delete r.selectors,
(0, i.isEmpty)(r.style) && delete r.style;
}
return r;
},
compare: function (t, e, n) {
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
o = e || '',
s = n || '',
a = i.selectorsAdd || '',
l = i.atRuleType || '';
t instanceof Array || t.models || (t = [t]);
var c = r.default.map(t.models || t, function (t) {
return t.get('name');
}),
u = r.default.map(this.get('selectors').models, function (t) {
return t.get('name');
});
if (c.length !== u.length) return !1;
for (var h = 0; h < c.length; h++) {
for (var d = 0, f = 0; f < u.length; f++) c[h] === u[f] && (d = 1);
if (0 === d) return !1;
}
return (
this.get('state') === o &&
this.get('mediaText') === s &&
this.get('selectorsAdd') === a &&
this.get('atRuleType') === l
);
},
});
},
function (t, e, n) {
'use strict';
var i = s(n(1)),
r = s(n(0)),
o = s(n(83));
function s(t) {
return t && t.__esModule ? t : { default: t };
}
t.exports = r.default.View.extend(
{
template: i.default.template(
'\n <form>\n <div id="<%= pfx %>title"><%= title %></div>\n <input type="file" id="<%= uploadId %>" name="file" accept="*/*" <%= 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;
console.error(t), 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(),
s = this.config,
a = s.params,
l = 0;
l < i.length;
l++
)
r.append(s.uploadName + '[]', i[l]);
for (var c in a) r.append(c, a[c]);
this.target;
var u = s.upload,
h = s.headers;
if ((void 0 === h['X-Requested-With'] && (h['X-Requested-With'] = 'XMLHttpRequest'), u))
return (
this.onUploadStart(),
(0, o.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) {
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 ('image' === (o = l ? l[1] : t.type)) {
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) {
a(h.value);
}
} catch (t) {
(c = !0), (u = t);
} 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);
},
);
} else this.onUploadError(new Error('Unsupported platform, FileReader is not defined'));
},
},
);
},
function (t, e, n) {
'use strict';
(function (e) {
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.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', e.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(this, n(1));
},
function (t, e, n) {
'use strict';
t.exports = n(64).extend({
events: { 'click [data-toggle=asset-remove]': 'onRemove', click: 'onClick', dblclick: 'onDblClick' },
getPreview: function () {
var t = this.pfx;
return (
'\n <div class="' +
t +
'preview" style="background-image: url(\'' +
this.model.get('src') +
'\');"></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 <div class="' +
t +
'name">' +
(n = n || e.getFilename()) +
'</div>\n <div class="' +
t +
'dimensions">' +
s +
'</div>\n '
);
},
init: function (t) {
var e = this.pfx;
this.className += ' ' + e + 'asset-image';
},
onClick: function () {
var t = this.config.onClick,
e = this.model;
this.collection.trigger('deselectAll'),
this.$el.addClass(this.pfx + 'highlight'),
'function' == typeof t ? t(e) : this.updateTarget(this.collection.target);
},
onDblClick: function () {
var t = this.em,
e = this.config.onDblClick,
n = this.model;
'function' == typeof e ? e(n) : (this.updateTarget(this.collection.target), t && t.get('Modal').close());
var i = this.collection.onSelect;
'function' == typeof i && i(this.model);
},
onRemove: function (t) {
t.stopImmediatePropagation(), this.model.collection.remove(this.model);
},
});
},
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(17),
s = n(42);
t.exports = o.extend({
defaults: i({}, o.prototype.defaults, { units: [], unit: '', step: 1, min: '', max: '' }),
init: function () {
var t = this.get('unit'),
e = this.get('units');
(this.input = new s({ model: this })), e.length && !t && this.set('unit', e[0]);
},
clearValue: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return this.set({ value: void 0, unit: void 0 }, t), this;
},
parseValue: function (t) {
var e = o.prototype.parseValue.apply(this, arguments),
n = this.input.validateInputValue(e.value, { deepCheck: 1 }),
i = n.value,
r = n.unit;
return (e.value = i), (e.unit = r), e;
},
getFullValue: function () {
var t = this.get('value'),
e = this.get('unit');
return (
(t = '' + (t = (0, r.isUndefined)(t) ? '' : t) + (e = !(0, r.isUndefined)(e) && t ? e : '')),
o.prototype.getFullValue.apply(this, [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;
};
var r = n(17);
t.exports = r.extend({
defaults: function () {
return i({}, r.prototype.defaults, { options: [] });
},
initialize: function () {
for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n];
r.prototype.initialize.apply(this, e), this.listenTo(this, 'change:options', this.onOptionChange);
},
onOptionChange: function () {
this.set('list', this.get('options'));
},
getOptions: function () {
var t = this.attributes,
e = t.options,
n = t.list;
return e && e.length ? e : n;
},
setOptions: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
return this.set('options', t), this;
},
addOption: function (t) {
if (t) {
var e = this.getOptions();
this.setOptions(
[].concat(
(function (t) {
if (Array.isArray(t)) {
for (var e = 0, n = Array(t.length); e < t.length; e++) n[e] = t[e];
return n;
}
return Array.from(t);
})(e),
[t],
),
);
}
return this;
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(5),
o = i.default.$;
t.exports = r.extend({
templateInput: function () {
var t = this.pfx;
this.ppfx;
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 ' +
(this.config.assetsLabel || 'Images') +
'\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 = o('<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) {
r.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];
r.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'));
},
}));
},
});
},
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 = a(n(0)),
o = n(1),
s = a(n(169));
function a(t) {
return t && t.__esModule ? t : { default: t };
}
var l = n(73),
c = r.default.$;
(0, s.default)(c),
(t.exports = l.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.get('defaults'),
i = (0, o.isUndefined)(t) ? ((0, o.isUndefined)(n) ? '' : n) : t,
r = this.getInputEl(),
s = this.getColorEl(),
a = 'none' != i ? i : '';
(r.value = i),
(s.get(0).style.backgroundColor = a),
e.fromTarget && (s.spectrum('set', a), (this.noneColor = 'none' == i));
},
getColorEl: function () {
if (!this.colorEl) {
var t = this,
e = this.ppfx,
n = this.model,
r = c('<div class="' + this.ppfx + 'field-color-picker"></div>'),
o = r.get(0).style,
s = this.em && this.em.config ? this.em.config.el : '',
a = (this.em && this.em.getConfig && this.em.getConfig('colorPicker')) || {},
l = function (t) {
return (1 == t.getAlpha() ? t.toHexString() : t.toRgbString()).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: s || 'body',
maxSelectionSize: 8,
showPalette: !0,
showAlpha: !0,
chooseText: 'Ok',
cancelText: '⨯',
palette: [],
},
a,
{
move: function (t) {
var e = l(t);
(o.backgroundColor = e), n.setValueFromInput(e, 0);
},
change: function (e) {
u = 1;
var i = l(e);
(o.backgroundColor = i), n.setValueFromInput(i), (t.noneColor = 0);
},
show: function (t) {
(u = 0), (h = l(t));
},
hide: function (e) {
!u &&
h &&
(t.noneColor && (h = ''),
(o.backgroundColor = h),
r.spectrum('set', h),
n.setValueFromInput(h, 0));
},
},
),
),
(this.colorEl = r);
}
return this.colorEl;
},
render: function () {
return l.prototype.render.call(this), this.getColorEl(), 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(69);
t.exports = n(15).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 }).render();
this.el.querySelector('.' + t + 'fields').appendChild(e.el),
(this.$input = e.inputEl),
(this.$color = e.colorEl),
(this.input = this.$input.get(0)),
(this.inputInst = e);
}
},
});
},
function (t, e, n) {
'use strict';
var i = o(n(0)),
r = o(n(5));
function o(t) {
return t && t.__esModule ? t : { default: t };
}
i.default.$;
t.exports = r.default.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 '
);
},
initialize: function () {
for (var t = arguments.length, e = Array(t), n = 0; n < t; n++) e[n] = arguments[n];
r.default.prototype.initialize.apply(this, e),
this.listenTo(this.model, 'change:options', this.updateOptions);
},
updateOptions: function () {
(this.input = null), this.onRender();
},
onRender: function () {
var t = this.pfx,
e = this.model.getOptions();
if (!this.input) {
var n = '';
e.forEach(function (t) {
var e = t.name || t.value,
i = t.style ? t.style.replace(/"/g, '&quot;') : '',
r = i ? 'style="' + i + '"' : '',
o = t.value.replace(/"/g, '&quot;');
n += '<option value="' + o + '" ' + r + '>' + e + '</option>';
});
var i = this.el.querySelector('#' + t + 'input-holder');
(i.innerHTML = '<select>' + n + '</select>'), (this.input = i.firstChild);
}
},
});
},
function (t, e, n) {
'use strict';
t.exports = n(5).extend({
templateInput: function () {
this.pfx;
var t = 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';
var i = n(0),
r = i.$;
t.exports = i.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();
var e = this.getInputEl().value;
this.model.set({ value: e }, { fromInput: 1 }), this.elementUpdated();
},
getInputEl: function () {
if (!this.inputEl) {
var t = this.model.get('defaults') || '';
this.inputEl = r('<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
);
},
});
},
function (t, e, n) {
'use strict';
var i = n(43),
r = n(168);
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();
},
clear: function (t) {
t && t.stopPropagation(), this.model.get('layers').reset(), this.model.clearValue(), this.targetUpdated();
},
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();
if (e.get('detached')) {
var i = this.getTarget(),
r = i ? i.getStyle() : {};
t = n.getLayersFromStyle(r);
} else {
var o = this.getTargetValue();
(o = o == e.getDefaultValue() ? '' : o), (t = n.getLayersFromValue(o));
}
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(16),
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';
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(17);
t.exports = r.extend({
defaults: i({}, r.prototype.defaults, { detached: 0, properties: [], separator: ' ' }),
init: function () {
var t = this.get('properties') || [],
e = n(18);
this.set('properties', new e(t)), this.listenTo(this, 'change:value', this.updateValues);
},
clearValue: function () {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
return (
this.get('properties').each(function (t) {
return t.clearValue();
}),
r.prototype.clearValue.apply(this, arguments)
);
},
updateValues: function () {
var t = this.getFullValue().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');
return e && !t
? e
: ((e = ''),
this.get('properties').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';
(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();
(i = (o = n.getType(t.type)) ? o.model : s.model), (r = o ? o.view : s.view);
} else {
var a = n.recognizeType(t);
(i = (o = a.type).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(this, 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(1);
t.exports = function () {
var t,
e,
o = {},
s = n(175),
a = n(174),
l = n(18),
c = n(163),
u = void 0;
return {
name: 'StyleManager',
getConfig: function () {
return o;
},
init: function (n) {
for (var i in ((o = n || {}), s)) i in o || (o[i] = s[i]);
var r = o.pStylePrefix;
return (
r && (o.stylePrefix = r + o.stylePrefix),
(u = new l()),
(t = new a(o.sectors, o)),
(e = new c({ collection: t, target: o.em, config: o })),
this
);
},
postRender: function () {
var t = this.getConfig().appendTo;
t && ((0, r.isElement)(t) ? t : document.querySelector(t)).appendChild(this.render());
},
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 = 1 == (n = i.get('properties').where({ property: e })).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 = o.em,
n = t.get('classes'),
i = t.getId();
if (e) {
var r = e.getConfig(),
s = e.get('UndoManager'),
a = e.get('CssComposer'),
l = r.devicePreviewMode ? '' : t.get('state'),
c = n.getStyleable(),
u = c.length,
h = { state: l },
d = void 0;
if ((s.stop(), u)) {
var f = e.getCurrentMedia();
(d = a.get(c, l, f)) || ((d = a.add(c, l, f)).setStyle(t.getStyle()), t.setStyle({}));
} else r.avoidInlineStyle && !(d = a.getIdRule(i, h)) && (d = a.setIdRule(i, {}, h));
d && (t = d), s.start();
}
return t;
},
addType: function (t, e) {
u.addType(t, e);
},
getType: function (t) {
return u.getType(t);
},
getTypes: function () {
return u.getTypes();
},
createType: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = e.model,
r = 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(r), config: o }, a));
},
render: function () {
return e.render().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;
},
r = n(0),
o = n(181);
t.exports = r.View.extend({
initialize: function (t) {
var e = t.config || {},
n = this.model;
(this.config = e),
(this.pfx = e.stylePrefix || ''),
(this.ppfx = e.pStylePrefix || ''),
(this.buttons = n.get('buttons')),
(this.className = this.pfx + 'panel'),
(this.id = this.pfx + n.get('id')),
this.listenTo(n, 'change:appendContent', this.appendContent),
this.listenTo(n, 'change:content', this.updateContent),
(n.view = this);
},
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 r,
o,
s,
a = !0 === n ? [1, 1, 1, 1] : n,
l = a.length,
c = 0;
2 == l
? ((r = a[0]), (s = a[0]), (o = a[1]), (c = a[1]))
: 4 == l && ((r = a[0]), (o = a[1]), (s = a[2]), (c = a[3]));
var u = e.Utils.Resizer.init(
i(
{
tc: r,
cr: o,
bc: s,
cl: c,
tl: 0,
tr: 0,
bl: 0,
br: 0,
appendTo: this.el,
silentFrames: 1,
avoidContainerUpdate: 1,
prefix: e.getConfig().stylePrefix,
onEnd: function () {
t && t.trigger('change:canvasOffset');
},
posFetcher: function (t, e) {
var n = e.target,
i = t.style,
r = u.getConfig(),
o = r.keyWidth,
s = r.keyHeight,
a = t.getBoundingClientRect(),
l = 'container' == n,
c = i[o],
h = i[s];
return {
left: 0,
top: 0,
width: c && !l ? parseFloat(c) : a.width,
height: h && !l ? parseFloat(h) : a.height,
};
},
},
n,
),
);
(u.blur = function () {}), u.focus(this.el);
}
},
render: function () {
var t = this.$el,
e = this.ppfx,
n = this.className + ' ' + this.id + ' ' + e + 'one-bg ' + e + 'two-color';
if ((t.addClass(n), this.buttons.length)) {
var i = new o({ collection: this.buttons, config: this.config });
t.append(i.render().el);
}
return t.append(this.model.get('content')), this;
},
});
},
function (t, e, n) {
'use strict';
var i = n(0),
r = n(183);
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(79);
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) {
!(function (t) {
'use strict';
function e(t) {
for (var e = {}, n = 0; n < t.length; ++n) e[t[n].toLowerCase()] = !0;
return e;
}
t.defineMode('css', function (e, n) {
var i = n.inline;
n.propertyKeywords || (n = t.resolveMode('text/css'));
var r,
o,
s = e.indentUnit,
a = n.tokenHooks,
l = n.documentTypes || {},
c = n.mediaTypes || {},
u = n.mediaFeatures || {},
h = n.mediaValueKeywords || {},
d = n.propertyKeywords || {},
f = n.nonStandardPropertyKeywords || {},
p = n.fontProperties || {},
g = n.counterDescriptors || {},
v = n.colorKeywords || {},
m = n.valueKeywords || {},
y = n.allowNested,
b = n.lineComment,
x = !0 === n.supportsAtComponent;
function w(t, e) {
return (r = e), t;
}
function C(t) {
return function (e, n) {
for (var i, r = !1; null != (i = e.next()); ) {
if (i == t && !r) {
')' == t && e.backUp(1);
break;
}
r = !r && '\\' == i;
}
return (i == t || (!r && ')' != t)) && (n.tokenize = null), w('string', 'string');
};
}
function k(t, e) {
return t.next(), t.match(/\s*[\"\')]/, !1) ? (e.tokenize = null) : (e.tokenize = C(')')), w(null, '(');
}
function S(t, e, n) {
(this.type = t), (this.indent = e), (this.prev = n);
}
function T(t, e, n, i) {
return (t.context = new S(n, e.indentation() + (!1 === i ? 0 : s), t.context)), n;
}
function E(t) {
return t.context.prev && (t.context = t.context.prev), t.context.type;
}
function M(t, e, n) {
return P[n.context.type](t, e, n);
}
function A(t, e, n, i) {
for (var r = i || 1; r > 0; r--) n.context = n.context.prev;
return M(t, e, n);
}
function O(t) {
var e = t.current().toLowerCase();
o = m.hasOwnProperty(e) ? 'atom' : v.hasOwnProperty(e) ? 'keyword' : 'variable';
}
var P = {
top: function (t, e, n) {
if ('{' == t) return T(n, e, 'block');
if ('}' == t && n.context.prev) return E(n);
if (x && /@component/i.test(t)) return T(n, e, 'atComponentBlock');
if (/^@(-moz-)?document$/i.test(t)) return T(n, e, 'documentTypes');
if (/^@(media|supports|(-moz-)?document|import)$/i.test(t)) return T(n, e, 'atBlock');
if (/^@(font-face|counter-style)/i.test(t)) return (n.stateArg = t), 'restricted_atBlock_before';
if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(t)) return 'keyframes';
if (t && '@' == t.charAt(0)) return T(n, e, 'at');
if ('hash' == t) o = 'builtin';
else if ('word' == t) o = 'tag';
else {
if ('variable-definition' == t) return 'maybeprop';
if ('interpolation' == t) return T(n, e, 'interpolation');
if (':' == t) return 'pseudo';
if (y && '(' == t) return T(n, e, 'parens');
}
return n.context.type;
},
block: function (t, e, n) {
if ('word' == t) {
var i = e.current().toLowerCase();
return d.hasOwnProperty(i)
? ((o = 'property'), 'maybeprop')
: f.hasOwnProperty(i)
? ((o = 'string-2'), 'maybeprop')
: y
? ((o = e.match(/^\s*:(?:\s|$)/, !1) ? 'property' : 'tag'), 'block')
: ((o += ' error'), 'maybeprop');
}
return 'meta' == t
? 'block'
: y || ('hash' != t && 'qualifier' != t)
? P.top(t, e, n)
: ((o = 'error'), 'block');
},
maybeprop: function (t, e, n) {
return ':' == t ? T(n, e, 'prop') : M(t, e, n);
},
prop: function (t, e, n) {
if (';' == t) return E(n);
if ('{' == t && y) return T(n, e, 'propBlock');
if ('}' == t || '{' == t) return A(t, e, n);
if ('(' == t) return T(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) O(e);
else if ('interpolation' == t) return T(n, e, 'interpolation');
} else o += ' error';
return 'prop';
},
propBlock: function (t, e, n) {
return '}' == t ? E(n) : 'word' == t ? ((o = 'property'), 'maybeprop') : n.context.type;
},
parens: function (t, e, n) {
return '{' == t || '}' == t
? A(t, e, n)
: ')' == t
? E(n)
: '(' == t
? T(n, e, 'parens')
: 'interpolation' == t
? T(n, e, 'interpolation')
: ('word' == t && O(e), 'parens');
},
pseudo: function (t, e, n) {
return 'meta' == t ? 'pseudo' : 'word' == t ? ((o = 'variable-3'), n.context.type) : M(t, e, n);
},
documentTypes: function (t, e, n) {
return 'word' == t && l.hasOwnProperty(e.current()) ? ((o = 'tag'), n.context.type) : P.atBlock(t, e, n);
},
atBlock: function (t, e, n) {
if ('(' == t) return T(n, e, 'atBlock_parens');
if ('}' == t || ';' == t) return A(t, e, n);
if ('{' == t) return E(n) && T(n, e, y ? 'block' : 'top');
if ('interpolation' == t) return T(n, e, 'interpolation');
if ('word' == t) {
var i = e.current().toLowerCase();
o =
'only' == i || 'not' == i || 'and' == i || 'or' == i
? 'keyword'
: c.hasOwnProperty(i)
? 'attribute'
: u.hasOwnProperty(i)
? 'property'
: h.hasOwnProperty(i)
? 'keyword'
: d.hasOwnProperty(i)
? 'property'
: f.hasOwnProperty(i)
? 'string-2'
: m.hasOwnProperty(i)
? 'atom'
: v.hasOwnProperty(i)
? 'keyword'
: 'error';
}
return n.context.type;
},
atComponentBlock: function (t, e, n) {
return '}' == t
? A(t, e, n)
: '{' == t
? E(n) && T(n, e, y ? 'block' : 'top', !1)
: ('word' == t && (o = 'error'), n.context.type);
},
atBlock_parens: function (t, e, n) {
return ')' == t ? E(n) : '{' == t || '}' == t ? A(t, e, n, 2) : P.atBlock(t, e, n);
},
restricted_atBlock_before: function (t, e, n) {
return '{' == t
? T(n, e, 'restricted_atBlock')
: 'word' == t && '@counter-style' == n.stateArg
? ((o = 'variable'), 'restricted_atBlock_before')
: M(t, e, n);
},
restricted_atBlock: function (t, e, n) {
return '}' == t
? ((n.stateArg = null), E(n))
: 'word' == t
? ((o =
('@font-face' == n.stateArg && !p.hasOwnProperty(e.current().toLowerCase())) ||
('@counter-style' == n.stateArg && !g.hasOwnProperty(e.current().toLowerCase()))
? 'error'
: 'property'),
'maybeprop')
: 'restricted_atBlock';
},
keyframes: function (t, e, n) {
return 'word' == t ? ((o = 'variable'), 'keyframes') : '{' == t ? T(n, e, 'top') : M(t, e, n);
},
at: function (t, e, n) {
return ';' == t
? E(n)
: '{' == t || '}' == t
? A(t, e, n)
: ('word' == t ? (o = 'tag') : 'hash' == t && (o = 'builtin'), 'at');
},
interpolation: function (t, e, n) {
return '}' == t
? E(n)
: '{' == t || ';' == t
? A(t, e, n)
: ('word' == t ? (o = 'variable') : 'variable' != t && '(' != t && ')' != t && (o = 'error'),
'interpolation');
},
};
return {
startState: function (t) {
return {
tokenize: null,
state: i ? 'block' : 'top',
stateArg: null,
context: new S(i ? 'block' : 'top', t || 0, null),
};
},
token: function (t, e) {
if (!e.tokenize && t.eatSpace()) return null;
var n = (
e.tokenize ||
function (t, e) {
var n = t.next();
if (a[n]) {
var i = a[n](t, e);
if (!1 !== i) return i;
}
return '@' == n
? (t.eatWhile(/[\w\\\-]/), w('def', t.current()))
: '=' == n || (('~' == n || '|' == n) && t.eat('='))
? w(null, 'compare')
: '"' == n || "'" == n
? ((e.tokenize = C(n)), e.tokenize(t, e))
: '#' == n
? (t.eatWhile(/[\w\\\-]/), w('atom', 'hash'))
: '!' == n
? (t.match(/^\s*\w*/), w('keyword', 'important'))
: /\d/.test(n) || ('.' == n && t.eat(/\d/))
? (t.eatWhile(/[\w.%]/), w('number', 'unit'))
: '-' !== n
? /[,+>*\/]/.test(n)
? w(null, 'select-op')
: '.' == n && t.match(/^-?[_a-z][_a-z0-9-]*/i)
? w('qualifier', 'qualifier')
: /[:;{}\[\]\(\)]/.test(n)
? w(null, n)
: (('u' == n || 'U' == n) && t.match(/rl(-prefix)?\(/i)) ||
(('d' == n || 'D' == n) && t.match('omain(', !0, !0)) ||
(('r' == n || 'R' == n) && t.match('egexp(', !0, !0))
? (t.backUp(1), (e.tokenize = k), w('property', 'word'))
: /[\w\\\-]/.test(n)
? (t.eatWhile(/[\w\\\-]/), w('property', 'word'))
: w(null, null)
: /[\d.]/.test(t.peek())
? (t.eatWhile(/[\w.%]/), w('number', 'unit'))
: t.match(/^-[\w\\\-]+/)
? (t.eatWhile(/[\w\\\-]/),
t.match(/^\s*:/, !1)
? w('variable-2', 'variable-definition')
: w('variable-2', 'variable'))
: t.match(/^\w+-/)
? w('meta', 'meta')
: void 0;
}
)(t, e);
return (
n && 'object' == typeof n && ((r = n[1]), (n = n[0])),
(o = n),
'comment' != r && (e.state = P[e.state](r, t, e)),
o
);
},
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 - s))
: ((n = n.prev), (r = n.indent))),
r
);
},
electricChars: '}',
blockCommentStart: '/*',
blockCommentEnd: '*/',
blockCommentContinue: ' * ',
lineComment: b,
fold: 'brace',
};
});
var n = ['domain', 'regexp', 'url', 'url-prefix'],
i = e(n),
r = ['all', 'aural', 'braille', 'handheld', 'print', 'projection', 'screen', 'tty', 'tv', 'embossed'],
o = e(r),
s = [
'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',
],
a = e(s),
l = ['landscape', 'portrait', 'none', 'coarse', 'fine', 'on-demand', 'hover', 'interlace', 'progressive'],
c = e(l),
u = [
'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',
],
h = e(u),
d = [
'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',
],
f = e(d),
p = e([
'font-family',
'src',
'unicode-range',
'font-variant',
'font-feature-settings',
'font-stretch',
'font-weight',
'font-style',
]),
g = e([
'additive-symbols',
'fallback',
'negative',
'pad',
'prefix',
'range',
'speak-as',
'suffix',
'symbols',
'system',
]),
v = [
'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',
],
m = e(v),
y = [
'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',
],
b = e(y),
x = n.concat(r).concat(s).concat(l).concat(u).concat(d).concat(v).concat(y);
function w(t, e) {
for (var n, i = !1; null != (n = t.next()); ) {
if (i && '/' == n) {
e.tokenize = null;
break;
}
i = '*' == n;
}
return ['comment', 'comment'];
}
t.registerHelper('hintWords', 'css', x),
t.defineMIME('text/css', {
documentTypes: i,
mediaTypes: o,
mediaFeatures: a,
mediaValueKeywords: c,
propertyKeywords: h,
nonStandardPropertyKeywords: f,
fontProperties: p,
counterDescriptors: g,
colorKeywords: m,
valueKeywords: b,
tokenHooks: {
'/': function (t, e) {
return !!t.eat('*') && ((e.tokenize = w), w(t, e));
},
},
name: 'css',
}),
t.defineMIME('text/x-scss', {
mediaTypes: o,
mediaFeatures: a,
mediaValueKeywords: c,
propertyKeywords: h,
nonStandardPropertyKeywords: f,
colorKeywords: m,
valueKeywords: b,
fontProperties: p,
allowNested: !0,
lineComment: '//',
tokenHooks: {
'/': function (t, e) {
return t.eat('/')
? (t.skipToEnd(), ['comment', 'comment'])
: t.eat('*')
? ((e.tokenize = w), w(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: o,
mediaFeatures: a,
mediaValueKeywords: c,
propertyKeywords: h,
nonStandardPropertyKeywords: f,
colorKeywords: m,
valueKeywords: b,
fontProperties: p,
allowNested: !0,
lineComment: '//',
tokenHooks: {
'/': function (t, e) {
return t.eat('/')
? (t.skipToEnd(), ['comment', 'comment'])
: t.eat('*')
? ((e.tokenize = w), w(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/i,
!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: i,
mediaTypes: o,
mediaFeatures: a,
propertyKeywords: h,
nonStandardPropertyKeywords: f,
fontProperties: p,
counterDescriptors: g,
colorKeywords: m,
valueKeywords: b,
supportsAtComponent: !0,
tokenHooks: {
'/': function (t, e) {
return !!t.eat('*') && ((e.tokenize = w), w(t, e));
},
},
name: 'css',
helperType: 'gss',
});
})(n(6));
},
function (t, e, n) {
'use strict';
t.exports = function (t) {
var e = t;
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 e = [], n = t.split(' '), i = 0, r = n.length; i < r; i++) {
var o = n[i].trim();
o && e.push(o);
}
return e;
},
parseNode: function (n) {
for (var i = [], r = n.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) {
var p = '',
g = a.getAttribute && a.getAttribute('data-gjs-type');
if (g) f = { type: g };
else {
for (var v = 0; v < d.length && !(p = d[v].model.isComponent(a)); v++);
f = p;
}
}
f.tagName || (f.tagName = a.tagName ? a.tagName.toLowerCase() : ''), c && (f.attributes = {});
for (var m = 0; m < c; m++) {
var y = l[m].nodeName,
b = l[m].nodeValue;
if ('style' == y) f.style = this.parseStyle(b);
else if ('class' == y) f.classes = this.parseClass(b);
else {
if ('contenteditable' == y) continue;
if (0 === y.indexOf('data-gjs-')) {
var x = y.replace('data-gjs-', ''),
w = b.length,
C = b && b.substr(0, 1),
k = b && b.substr(w - 1);
b = 'false' !== (b = 'true' === b || b) && b;
try {
b = ('{' == C && '}' == k) || ('[' == C && ']' == k) ? JSON.parse(b) : b;
} catch (t) {}
f[x] = b;
} else f.attributes[y] = b;
}
}
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;
}
if (!t.keepEmptyTextNodes) {
var T = a.nodeValue;
if (' ' != T && !T.trim()) continue;
}
}
var E = f.components;
if (!f.type && E) {
for (var M = 1, A = 0, O = 0; O < E.length; O++) {
var P = E[O],
_ = P.type;
if (['text', 'textnode'].indexOf(_) < 0 && e.textTags.indexOf(P.tagName) < 0) {
M = 0;
break;
}
'textnode' == _ && (A = 1);
}
M && A && (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) {
'use strict';
Object.defineProperty(e, '__esModule', { value: !0 });
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(218));
(window.Promise = window.Promise || i.default),
(e.default =
'function' == typeof fetch
? fetch.bind()
: function (t, e) {
return new i.default(function (n, r) {
var o = new XMLHttpRequest();
for (var s in (o.open(e.method || 'get', t),
(o.withCredentials = 'include' == e.credentials),
e.headers || {}))
o.setRequestHeader(s, e.headers[s]);
(o.onload = function (t) {
return n({
status: o.status,
statusText: o.statusText,
text: function () {
return i.default.resolve(o.responseText);
},
});
}),
(o.onerror = r),
o.upload && e.onProgress && (o.upload.onprogress = e.onProgress),
e.body ? o.send(e.body) : o.send();
});
});
},
function (t, e, n) {
var i;
(function () {
var n = this,
r = n._,
o = Array.prototype,
s = Object.prototype,
a = Function.prototype,
l = o.push,
c = o.slice,
u = s.toString,
h = s.hasOwnProperty,
d = Array.isArray,
f = Object.keys,
p = a.bind,
g = Object.create,
v = function () {},
m = function (t) {
return t instanceof m ? t : this instanceof m ? void (this._wrapped = t) : new m(t);
};
void 0 !== t && t.exports && (e = t.exports = m), (e._ = m), (m.VERSION = '1.8.3');
var y = 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);
};
},
b = function (t, e, n) {
return null == t ? m.identity : m.isFunction(t) ? y(t, e, n) : m.isObject(t) ? m.matcher(t) : m.property(t);
};
m.iteratee = function (t, e) {
return b(t, e, 1 / 0);
};
var x = 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;
};
},
w = function (t) {
if (!m.isObject(t)) return {};
if (g) return g(t);
v.prototype = t;
var e = new v();
return (v.prototype = null), e;
},
C = function (t) {
return function (e) {
return null == e ? void 0 : e[t];
};
},
k = Math.pow(2, 53) - 1,
S = C('length'),
T = function (t) {
var e = S(t);
return 'number' == typeof e && e >= 0 && e <= k;
};
function E(t) {
return function (e, n, i, r) {
n = y(n, r, 4);
var o = !T(e) && m.keys(e),
s = (o || e).length,
a = t > 0 ? 0 : s - 1;
return (
arguments.length < 3 && ((i = e[o ? o[a] : a]), (a += t)),
(function (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;
})(e, n, i, o, a, s)
);
};
}
(m.each = m.forEach =
function (t, e, n) {
var i, r;
if (((e = y(e, n)), T(t))) for (i = 0, r = t.length; i < r; i++) e(t[i], i, t);
else {
var o = m.keys(t);
for (i = 0, r = o.length; i < r; i++) e(t[o[i]], o[i], t);
}
return t;
}),
(m.map = m.collect =
function (t, e, n) {
e = b(e, n);
for (var i = !T(t) && m.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;
}),
(m.reduce = m.foldl = m.inject = E(1)),
(m.reduceRight = m.foldr = E(-1)),
(m.find = m.detect =
function (t, e, n) {
var i;
if (void 0 !== (i = T(t) ? m.findIndex(t, e, n) : m.findKey(t, e, n)) && -1 !== i) return t[i];
}),
(m.filter = m.select =
function (t, e, n) {
var i = [];
return (
(e = b(e, n)),
m.each(t, function (t, n, r) {
e(t, n, r) && i.push(t);
}),
i
);
}),
(m.reject = function (t, e, n) {
return m.filter(t, m.negate(b(e)), n);
}),
(m.every = m.all =
function (t, e, n) {
e = b(e, n);
for (var i = !T(t) && m.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;
}),
(m.some = m.any =
function (t, e, n) {
e = b(e, n);
for (var i = !T(t) && m.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;
}),
(m.contains =
m.includes =
m.include =
function (t, e, n, i) {
return T(t) || (t = m.values(t)), ('number' != typeof n || i) && (n = 0), m.indexOf(t, e, n) >= 0;
}),
(m.invoke = function (t, e) {
var n = c.call(arguments, 2),
i = m.isFunction(e);
return m.map(t, function (t) {
var r = i ? e : t[e];
return null == r ? r : r.apply(t, n);
});
}),
(m.pluck = function (t, e) {
return m.map(t, m.property(e));
}),
(m.where = function (t, e) {
return m.filter(t, m.matcher(e));
}),
(m.findWhere = function (t, e) {
return m.find(t, m.matcher(e));
}),
(m.max = function (t, e, n) {
var i,
r,
o = -1 / 0,
s = -1 / 0;
if (null == e && null != t)
for (var a = 0, l = (t = T(t) ? t : m.values(t)).length; a < l; a++) (i = t[a]) > o && (o = i);
else
(e = b(e, n)),
m.each(t, function (t, n, i) {
((r = e(t, n, i)) > s || (r === -1 / 0 && o === -1 / 0)) && ((o = t), (s = r));
});
return o;
}),
(m.min = function (t, e, n) {
var i,
r,
o = 1 / 0,
s = 1 / 0;
if (null == e && null != t)
for (var a = 0, l = (t = T(t) ? t : m.values(t)).length; a < l; a++) (i = t[a]) < o && (o = i);
else
(e = b(e, n)),
m.each(t, function (t, n, i) {
((r = e(t, n, i)) < s || (r === 1 / 0 && o === 1 / 0)) && ((o = t), (s = r));
});
return o;
}),
(m.shuffle = function (t) {
for (var e, n = T(t) ? t : m.values(t), i = n.length, r = Array(i), o = 0; o < i; o++)
(e = m.random(0, o)) !== o && (r[o] = r[e]), (r[e] = n[o]);
return r;
}),
(m.sample = function (t, e, n) {
return null == e || n
? (T(t) || (t = m.values(t)), t[m.random(t.length - 1)])
: m.shuffle(t).slice(0, Math.max(0, e));
}),
(m.sortBy = function (t, e, n) {
return (
(e = b(e, n)),
m.pluck(
m
.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 M = function (t) {
return function (e, n, i) {
var r = {};
return (
(n = b(n, i)),
m.each(e, function (i, o) {
var s = n(i, o, e);
t(r, i, s);
}),
r
);
};
};
(m.groupBy = M(function (t, e, n) {
m.has(t, n) ? t[n].push(e) : (t[n] = [e]);
})),
(m.indexBy = M(function (t, e, n) {
t[n] = e;
})),
(m.countBy = M(function (t, e, n) {
m.has(t, n) ? t[n]++ : (t[n] = 1);
})),
(m.toArray = function (t) {
return t ? (m.isArray(t) ? c.call(t) : T(t) ? m.map(t, m.identity) : m.values(t)) : [];
}),
(m.size = function (t) {
return null == t ? 0 : T(t) ? t.length : m.keys(t).length;
}),
(m.partition = function (t, e, n) {
e = b(e, n);
var i = [],
r = [];
return (
m.each(t, function (t, n, o) {
(e(t, n, o) ? i : r).push(t);
}),
[i, r]
);
}),
(m.first =
m.head =
m.take =
function (t, e, n) {
if (null != t) return null == e || n ? t[0] : m.initial(t, t.length - e);
}),
(m.initial = function (t, e, n) {
return c.call(t, 0, Math.max(0, t.length - (null == e || n ? 1 : e)));
}),
(m.last = function (t, e, n) {
if (null != t) return null == e || n ? t[t.length - 1] : m.rest(t, Math.max(0, t.length - e));
}),
(m.rest =
m.tail =
m.drop =
function (t, e, n) {
return c.call(t, null == e || n ? 1 : e);
}),
(m.compact = function (t) {
return m.filter(t, m.identity);
});
var A = function (t, e, n, i) {
for (var r = [], o = 0, s = i || 0, a = S(t); s < a; s++) {
var l = t[s];
if (T(l) && (m.isArray(l) || m.isArguments(l))) {
e || (l = A(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;
};
function O(t) {
return function (e, n, i) {
n = b(n, i);
for (var r = S(e), o = t > 0 ? 0 : r - 1; o >= 0 && o < r; o += t) if (n(e[o], o, e)) return o;
return -1;
};
}
function P(t, e, n) {
return function (i, r, o) {
var s = 0,
a = S(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 i[(o = n(i, r))] === r ? o : -1;
if (r != r) return (o = e(c.call(i, s, a), m.isNaN)) >= 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;
};
}
(m.flatten = function (t, e) {
return A(t, e, !1);
}),
(m.without = function (t) {
return m.difference(t, c.call(arguments, 1));
}),
(m.uniq = m.unique =
function (t, e, n, i) {
m.isBoolean(e) || ((i = n), (n = e), (e = !1)), null != n && (n = b(n, i));
for (var r = [], o = [], s = 0, a = S(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
? m.contains(o, c) || (o.push(c), r.push(l))
: m.contains(r, l) || r.push(l);
}
return r;
}),
(m.union = function () {
return m.uniq(A(arguments, !0, !0));
}),
(m.intersection = function (t) {
for (var e = [], n = arguments.length, i = 0, r = S(t); i < r; i++) {
var o = t[i];
if (!m.contains(e, o)) {
for (var s = 1; s < n && m.contains(arguments[s], o); s++);
s === n && e.push(o);
}
}
return e;
}),
(m.difference = function (t) {
var e = A(arguments, !0, !0, 1);
return m.filter(t, function (t) {
return !m.contains(e, t);
});
}),
(m.zip = function () {
return m.unzip(arguments);
}),
(m.unzip = function (t) {
for (var e = (t && m.max(t, S).length) || 0, n = Array(e), i = 0; i < e; i++) n[i] = m.pluck(t, i);
return n;
}),
(m.object = function (t, e) {
for (var n = {}, i = 0, r = S(t); i < r; i++) e ? (n[t[i]] = e[i]) : (n[t[i][0]] = t[i][1]);
return n;
}),
(m.findIndex = O(1)),
(m.findLastIndex = O(-1)),
(m.sortedIndex = function (t, e, n, i) {
for (var r = (n = b(n, i, 1))(e), o = 0, s = S(t); o < s; ) {
var a = Math.floor((o + s) / 2);
n(t[a]) < r ? (o = a + 1) : (s = a);
}
return o;
}),
(m.indexOf = P(1, m.findIndex, m.sortedIndex)),
(m.lastIndexOf = P(-1, m.findLastIndex)),
(m.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 _ = function (t, e, n, i, r) {
if (!(i instanceof e)) return t.apply(n, r);
var o = w(t.prototype),
s = t.apply(o, r);
return m.isObject(s) ? s : o;
};
(m.bind = function (t, e) {
if (p && t.bind === p) return p.apply(t, c.call(arguments, 1));
if (!m.isFunction(t)) throw new TypeError('Bind must be called on a function');
var n = c.call(arguments, 2),
i = function () {
return _(t, i, e, this, n.concat(c.call(arguments)));
};
return i;
}),
(m.partial = function (t) {
var e = c.call(arguments, 1),
n = function () {
for (var i = 0, r = e.length, o = Array(r), s = 0; s < r; s++)
o[s] = e[s] === m ? arguments[i++] : e[s];
for (; i < arguments.length; ) o.push(arguments[i++]);
return _(t, n, this, this, o);
};
return n;
}),
(m.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++) t[(n = arguments[e])] = m.bind(t[n], t);
return t;
}),
(m.memoize = function (t, e) {
var n = function (i) {
var r = n.cache,
o = '' + (e ? e.apply(this, arguments) : i);
return m.has(r, o) || (r[o] = t.apply(this, arguments)), r[o];
};
return (n.cache = {}), n;
}),
(m.delay = function (t, e) {
var n = c.call(arguments, 2);
return setTimeout(function () {
return t.apply(null, n);
}, e);
}),
(m.defer = m.partial(m.delay, m, 1)),
(m.throttle = function (t, e, n) {
var i,
r,
o,
s = null,
a = 0;
n || (n = {});
var l = function () {
(a = !1 === n.leading ? 0 : m.now()), (s = null), (o = t.apply(i, r)), s || (i = r = null);
};
return function () {
var c = m.now();
a || !1 !== n.leading || (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 || !1 === n.trailing || (s = setTimeout(l, u)),
o
);
};
}),
(m.debounce = function (t, e, n) {
var i,
r,
o,
s,
a,
l = function () {
var c = m.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 = m.now());
var c = n && !i;
return i || (i = setTimeout(l, e)), c && ((a = t.apply(o, r)), (o = r = null)), a;
};
}),
(m.wrap = function (t, e) {
return m.partial(e, t);
}),
(m.negate = function (t) {
return function () {
return !t.apply(this, arguments);
};
}),
(m.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;
};
}),
(m.after = function (t, e) {
return function () {
if (--t < 1) return e.apply(this, arguments);
};
}),
(m.before = function (t, e) {
var n;
return function () {
return --t > 0 && (n = e.apply(this, arguments)), t <= 1 && (e = null), n;
};
}),
(m.once = m.partial(m.before, 2));
var L = !{ toString: null }.propertyIsEnumerable('toString'),
N = ['valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
function D(t, e) {
var n = N.length,
i = t.constructor,
r = (m.isFunction(i) && i.prototype) || s,
o = 'constructor';
for (m.has(t, o) && !m.contains(e, o) && e.push(o); n--; )
(o = N[n]) in t && t[o] !== r[o] && !m.contains(e, o) && e.push(o);
}
(m.keys = function (t) {
if (!m.isObject(t)) return [];
if (f) return f(t);
var e = [];
for (var n in t) m.has(t, n) && e.push(n);
return L && D(t, e), e;
}),
(m.allKeys = function (t) {
if (!m.isObject(t)) return [];
var e = [];
for (var n in t) e.push(n);
return L && D(t, e), e;
}),
(m.values = function (t) {
for (var e = m.keys(t), n = e.length, i = Array(n), r = 0; r < n; r++) i[r] = t[e[r]];
return i;
}),
(m.mapObject = function (t, e, n) {
e = b(e, n);
for (var i, r = m.keys(t), o = r.length, s = {}, a = 0; a < o; a++) s[(i = r[a])] = e(t[i], i, t);
return s;
}),
(m.pairs = function (t) {
for (var e = m.keys(t), n = e.length, i = Array(n), r = 0; r < n; r++) i[r] = [e[r], t[e[r]]];
return i;
}),
(m.invert = function (t) {
for (var e = {}, n = m.keys(t), i = 0, r = n.length; i < r; i++) e[t[n[i]]] = n[i];
return e;
}),
(m.functions = m.methods =
function (t) {
var e = [];
for (var n in t) m.isFunction(t[n]) && e.push(n);
return e.sort();
}),
(m.extend = x(m.allKeys)),
(m.extendOwn = m.assign = x(m.keys)),
(m.findKey = function (t, e, n) {
e = b(e, n);
for (var i, r = m.keys(t), o = 0, s = r.length; o < s; o++) if (e(t[(i = r[o])], i, t)) return i;
}),
(m.pick = function (t, e, n) {
var i,
r,
o = {},
s = t;
if (null == s) return o;
m.isFunction(e)
? ((r = m.allKeys(s)), (i = y(e, n)))
: ((r = A(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;
}),
(m.omit = function (t, e, n) {
if (m.isFunction(e)) e = m.negate(e);
else {
var i = m.map(A(arguments, !1, !1, 1), String);
e = function (t, e) {
return !m.contains(i, e);
};
}
return m.pick(t, e, n);
}),
(m.defaults = x(m.allKeys, !0)),
(m.create = function (t, e) {
var n = w(t);
return e && m.extendOwn(n, e), n;
}),
(m.clone = function (t) {
return m.isObject(t) ? (m.isArray(t) ? t.slice() : m.extend({}, t)) : t;
}),
(m.tap = function (t, e) {
return e(t), t;
}),
(m.isMatch = function (t, e) {
var n = m.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 I = 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 m && (t = t._wrapped), e instanceof m && (e = e._wrapped);
var r = u.call(t);
if (r !== u.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 &&
!(m.isFunction(s) && s instanceof s && m.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) !== e.length) return !1;
for (; l--; ) if (!I(t[l], e[l], n, i)) return !1;
} else {
var c,
h = m.keys(t);
if (((l = h.length), m.keys(e).length !== l)) return !1;
for (; l--; ) if (((c = h[l]), !m.has(e, c) || !I(t[c], e[c], n, i))) return !1;
}
return n.pop(), i.pop(), !0;
};
(m.isEqual = function (t, e) {
return I(t, e);
}),
(m.isEmpty = function (t) {
return (
null == t ||
(T(t) && (m.isArray(t) || m.isString(t) || m.isArguments(t)) ? 0 === t.length : 0 === m.keys(t).length)
);
}),
(m.isElement = function (t) {
return !(!t || 1 !== t.nodeType);
}),
(m.isArray =
d ||
function (t) {
return '[object Array]' === u.call(t);
}),
(m.isObject = function (t) {
var e = typeof t;
return 'function' === e || ('object' === e && !!t);
}),
m.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function (t) {
m['is' + t] = function (e) {
return u.call(e) === '[object ' + t + ']';
};
}),
m.isArguments(arguments) ||
(m.isArguments = function (t) {
return m.has(t, 'callee');
}),
'function' != typeof /./ &&
'object' != typeof Int8Array &&
(m.isFunction = function (t) {
return 'function' == typeof t || !1;
}),
(m.isFinite = function (t) {
return isFinite(t) && !isNaN(parseFloat(t));
}),
(m.isNaN = function (t) {
return m.isNumber(t) && t !== +t;
}),
(m.isBoolean = function (t) {
return !0 === t || !1 === t || '[object Boolean]' === u.call(t);
}),
(m.isNull = function (t) {
return null === t;
}),
(m.isUndefined = function (t) {
return void 0 === t;
}),
(m.has = function (t, e) {
return null != t && h.call(t, e);
}),
(m.noConflict = function () {
return (n._ = r), this;
}),
(m.identity = function (t) {
return t;
}),
(m.constant = function (t) {
return function () {
return t;
};
}),
(m.noop = function () {}),
(m.property = C),
(m.propertyOf = function (t) {
return null == t
? function () {}
: function (e) {
return t[e];
};
}),
(m.matcher = m.matches =
function (t) {
return (
(t = m.extendOwn({}, t)),
function (e) {
return m.isMatch(e, t);
}
);
}),
(m.times = function (t, e, n) {
var i = Array(Math.max(0, t));
e = y(e, n, 1);
for (var r = 0; r < t; r++) i[r] = e(r);
return i;
}),
(m.random = function (t, e) {
return null == e && ((e = t), (t = 0)), t + Math.floor(Math.random() * (e - t + 1));
}),
(m.now =
Date.now ||
function () {
return new Date().getTime();
});
var F = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#x27;', '`': '&#x60;' },
R = m.invert(F),
j = function (t) {
var e = function (e) {
return t[e];
},
n = '(?:' + m.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;
};
};
(m.escape = j(F)),
(m.unescape = j(R)),
(m.result = function (t, e, n) {
var i = null == t ? void 0 : t[e];
return void 0 === i && (i = n), m.isFunction(i) ? i.call(t) : i;
});
var z = 0;
(m.uniqueId = function (t) {
var e = ++z + '';
return t ? t + e : e;
}),
(m.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g,
});
var H = /(.)^/,
V = { "'": "'", '\\': '\\', '\r': 'r', '\n': 'n', '\u2028': 'u2028', '\u2029': 'u2029' },
$ = /\\|'|\r|\n|\u2028|\u2029/g,
B = function (t) {
return '\\' + V[t];
};
(m.template = function (t, e, n) {
!e && n && (e = n), (e = m.defaults({}, e, m.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)),
(r = a + e.length),
n
? (o += "'+\n((__t=(" + n + "))==null?'':_.escape(__t))+\n'")
: i
? (o += "'+\n((__t=(" + i + "))==null?'':__t)+\n'")
: s && (o += "';\n" + s + "\n__p+='"),
e
);
}),
(o += "';\n"),
e.variable || (o = 'with(obj||{}){\n' + o + '}\n'),
(o =
"var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" +
o +
'return __p;\n');
try {
var s = new Function(e.variable || 'obj', '_', o);
} catch (t) {
throw ((t.source = o), t);
}
var a = function (t) {
return s.call(this, t, m);
},
l = e.variable || 'obj';
return (a.source = 'function(' + l + '){\n' + o + '}'), a;
}),
(m.chain = function (t) {
var e = m(t);
return (e._chain = !0), e;
});
var W = function (t, e) {
return t._chain ? m(e).chain() : e;
};
(m.mixin = function (t) {
m.each(m.functions(t), function (e) {
var n = (m[e] = t[e]);
m.prototype[e] = function () {
var t = [this._wrapped];
return l.apply(t, arguments), W(this, n.apply(m, t));
};
});
}),
m.mixin(m),
m.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function (t) {
var e = o[t];
m.prototype[t] = function () {
var n = this._wrapped;
return (
e.apply(n, arguments), ('shift' !== t && 'splice' !== t) || 0 !== n.length || delete n[0], W(this, n)
);
};
}),
m.each(['concat', 'join', 'slice'], function (t) {
var e = o[t];
m.prototype[t] = function () {
return W(this, e.apply(this._wrapped, arguments));
};
}),
(m.prototype.value = function () {
return this._wrapped;
}),
(m.prototype.valueOf = m.prototype.toJSON = m.prototype.value),
(m.prototype.toString = function () {
return '' + this._wrapped;
}),
void 0 ===
(i = function () {
return m;
}.apply(e, [])) || (t.exports = i);
}).call(this);
},
function (t, e, n) {
!(function (e) {
var n,
i = {},
r = { 16: !1, 18: !1, 17: !1, 91: !1 },
o = 'all',
s = {
'⇧': 16,
shift: 16,
'⌥': 18,
alt: 18,
option: 18,
'⌃': 17,
ctrl: 17,
control: 17,
'⌘': 91,
command: 91,
},
a = {
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,
},
l = function (t) {
return a[t] || t.toUpperCase().charCodeAt(0);
},
c = [];
for (n = 1; n < 20; n++) a['f' + n] = 111 + n;
function u(t, e) {
for (var n = t.length; n--; ) if (t[n] === e) return n;
return -1;
}
function h(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;
}
var d = { 16: 'shiftKey', 18: 'altKey', 17: 'ctrlKey', 91: 'metaKey' };
function f(t) {
for (n in r) r[n] = t[d[n]];
}
function p(t, e, n) {
var r, o;
(r = v(t)), void 0 === n && ((n = e), (e = 'all'));
for (var s = 0; s < r.length; s++)
(o = []),
(t = r[s].split('+')).length > 1 && ((o = m(t)), (t = [t[t.length - 1]])),
(t = t[0]),
(t = l(t)) in i || (i[t] = []),
i[t].push({ shortcut: r[s], scope: e, method: n, key: r[s], mods: o });
}
for (n in s) p[n] = !1;
function g() {
return o || 'all';
}
function v(t) {
var e;
return '' == (e = (t = t.replace(/\s/g, '')).split(','))[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);
});
}
y(document, 'keydown', function (t) {
!(function (t) {
var e, n, o, a, l, h;
if (((e = t.keyCode), -1 == u(c, e) && c.push(e), (93 != e && 224 != e) || (e = 91), e in r))
for (o in ((r[e] = !0), s)) s[o] == e && (p[o] = !0);
else if ((f(t), p.filter.call(this, t) && e in i))
for (h = g(), a = 0; a < i[e].length; a++)
if ((n = i[e][a]).scope == h || 'all' == n.scope) {
for (o in ((l = n.mods.length > 0), r))
((!r[o] && u(n.mods, +o) > -1) || (r[o] && -1 == u(n.mods, +o))) && (l = !1);
((0 != n.mods.length || r[16] || r[18] || r[17] || r[91]) && !l) ||
(!1 === n.method(t, n) &&
(t.preventDefault ? t.preventDefault() : (t.returnValue = !1),
t.stopPropagation && t.stopPropagation(),
t.cancelBubble && (t.cancelBubble = !0)));
}
})(t);
}),
y(document, 'keyup', function (t) {
var e,
n = t.keyCode,
i = u(c, n);
if ((i >= 0 && c.splice(i, 1), (93 != n && 224 != n) || (n = 91), n in r))
for (e in ((r[n] = !1), s)) s[e] == n && (p[e] = !1);
}),
y(window, 'focus', function () {
for (n in r) r[n] = !1;
for (n in s) p[n] = !1;
});
var b = e.key;
(e.key = p),
(e.key.setScope = function (t) {
o = t || 'all';
}),
(e.key.getScope = g),
(e.key.deleteScope = function (t) {
var e, n, r;
for (e in i) for (n = i[e], r = 0; r < n.length; ) n[r].scope === t ? n.splice(r, 1) : r++;
}),
(e.key.filter = function (t) {
var e = (t.target || t.srcElement).tagName;
return !('INPUT' == e || 'SELECT' == e || 'TEXTAREA' == e);
}),
(e.key.isPressed = function (t) {
return 'string' == typeof t && (t = l(t)), -1 != u(c, t);
}),
(e.key.getPressedKeyCodes = function () {
return c.slice(0);
}),
(e.key.noConflict = function () {
var t = e.key;
return (e.key = b), t;
}),
(e.key.unbind = function (t, e) {
var n,
r,
o,
s,
a,
c = [];
for (n = v(t), s = 0; s < n.length; s++) {
if (
((r = n[s].split('+')).length > 1 && ((c = m(r)), (t = r[r.length - 1])),
(t = l(t)),
void 0 === e && (e = g()),
!i[t])
)
return;
for (o = 0; o < i[t].length; o++) (a = i[t][o]).scope === e && h(a.mods, c) && (i[t][o] = {});
}
}),
(t.exports = p);
})(this);
},
function (t, e, n) {
'use strict';
t.exports = { plugins: [] };
},
function (t, e, n) {
'use strict';
t.exports = function (t) {
var e = t || {},
i = n(86);
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';
Object.defineProperty(e, '__esModule', { value: !0 }),
(e.default = function () {
if (
(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 && !(t = n[i][1].exec(e));
i++
);
return !!t;
})()
) {
var t = DOMImplementation.prototype.createHTMLDocument;
DOMImplementation.prototype.createHTMLDocument = function (e) {
return e || (e = ''), t.apply(document.implementation, [e]);
};
}
});
},
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(this, n(0));
},
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)).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)).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)).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.removeClass = function (t) {
if (!arguments.length) return this.attr('class', '');
var e = (0, i.isString)(t) && t.match(/\S+/g);
return e
? this.each(function (t) {
(0, i.each)(e, function (e) {
if (t.classList) t.classList.remove(e);
else {
var n = t.className,
r = t.className.baseVal;
(0, i.isUndefined)(r) ? (t.className = n.replace(e, '')) : (n.baseVal = r.replace(e, ''));
}
});
})
: 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),
e = (t = 9 == t.nodeType ? t.defaultView : t) instanceof Window ? t : null;
return e ? e.pageXOffset : t.scrollLeft || 0;
}),
(s.scrollTop = function () {
var t = this.get(0),
e = (t = 9 == t.nodeType ? t.defaultView : 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)),
void 0 !== e && this.css('top', e + 'px'),
void 0 !== 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) {
if (!(this instanceof e.Event)) return new e.Event(t, n);
(this.type = t),
(this.isDefaultPrevented = function () {
return !1;
});
});
}
};
},
function (t, e, n) {
'use strict';
var i = o(n(1)),
r = o(n(0));
function o(t) {
return t && t.__esModule ? t : { default: t };
}
t.exports = r.default.View.extend({
template: i.default.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 () {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
var t = 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
);
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
r = n(1),
o = n(2);
t.exports = i.default.View.extend({
events: { mousedown: 'startDrag', dragstart: 'handleDragStart', drag: 'handleDrag', 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, o.on)(document, 'mouseup', this.endDrag);
}
},
handleDragStart: function (t) {
var e = this.em,
n = this.model,
i = n.get('content'),
o = (0, r.isObject)(i),
s = o ? JSON.stringify(i) : i;
t.dataTransfer.setData('text', s), e.set('dragContent', i), e.trigger('block:drag:start', n, t);
},
handleDrag: function (t) {
this.em.trigger('block:drag', this.model, t);
},
handleDragEnd: function () {
var t = this.em,
e = this.model,
n = t.get('dragResult');
if (n) {
var i = n.get && n.get('activeOnRender');
(e.get('activate') || i) && (n.trigger('active'), n.set('activeOnRender', 0)),
e.get('select') && t.setSelected(n),
e.get('resetId') &&
n.onAll(function (t) {
return t.resetId();
});
}
t.set({ dragResult: null, dragContent: null }), t.trigger('block:drag:stop', n, e);
},
endDrag: function (t) {
(0, o.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>'),
(t.title = t.textContent.trim()),
(0, o.hasDnd)(this.em) && t.setAttribute('draggable', !0),
this
);
},
});
},
function (t, e, n) {
'use strict';
var i = n(1),
r = n(92),
o = n(91);
t.exports = n(0).View.extend({
initialize: function (t, e) {
(0, i.bindAll)(this, 'getSorter', 'onDrag', 'onDrop'),
(this.config = e || {}),
(this.categories = t.categories || ''),
(this.renderedCategories = []);
var n = this.config.pStylePrefix || '';
(this.ppfx = n),
(this.noCatClass = n + 'blocks-no-cat'),
(this.blockContClass = n + 'blocks-c'),
(this.catsClass = n + '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).render().el,
a = t.get('category');
if (a && this.categories) {
(0, i.isString)(a) ? (a = { id: a, label: a }) : (0, i.isObject)(a) && !a.id && (a.id = a.label);
var l = this.categories.add(a),
c = l.get('id'),
u = this.renderedCategories[c],
h = this.getCategoriesEl();
return (
t.set('category', l),
!u &&
h &&
((u = new o({ model: l }, this.config).render()),
(this.renderedCategories[c] = u),
h.appendChild(u.el)),
void (u && u.append(s))
);
}
n ? n.appendChild(s) : this.append(s);
},
getCategoriesEl: function () {
return this.catsEl || (this.catsEl = this.el.querySelector('.' + this.catsClass)), this.catsEl;
},
getBlocksEl: function () {
return (
this.blocksEl ||
(this.blocksEl = this.el.querySelector('.' + this.noCatClass + ' .' + this.blockContClass)),
this.blocksEl
);
},
append: function (t) {
var e = this.getBlocksEl();
e && e.appendChild(t);
},
render: function () {
var t = this,
e = this.ppfx,
n = document.createDocumentFragment();
(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 (e) {
return t.add(e, n);
}),
this.append(n);
var i = this.blockContClass + 's ' + e + 'one-bg ' + e + 'two-color';
return this.$el.addClass(i), this;
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.Collection.extend({ model: n(44) });
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(44);
t.exports = i.default.Model.extend({
defaults: { activate: 0, select: 0, resetId: 0, label: '', content: '', category: '', attributes: {} },
initialize: function () {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
var t = this.get('category');
if (t && 'string' == typeof t) new r({ id: t, label: t });
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(95);
t.exports = i.default.Collection.extend({ model: r });
},
function (t, e, n) {
'use strict';
t.exports = { appendTo: '', blocks: [] };
},
function (t, e, n) {
'use strict';
var i = n(1);
t.exports = function () {
var t,
e,
r,
o = {},
s = n(97),
a = n(96),
l = n(94),
c = n(93),
u = [];
return {
name: 'BlockManager',
init: function (n) {
var i = (o = n || {}).em;
for (var h in s) h in o || (o[h] = s[h]);
return (
(t = new a([])),
(e = new a([])),
(u = new l()),
(r = new c({ collection: e, categories: u }, o)),
t.listenTo(t, 'add', function (t) {
e.add(t), i && i.trigger('block:add', t);
}),
t.listenTo(t, 'remove', function (t) {
e.remove(t), i && i.trigger('block:remove', t);
}),
t.listenTo(t, 'reset', function (t) {
e.reset(t.models);
}),
this
);
},
getConfig: function () {
return o;
},
onLoad: function () {
var t = this.getAll();
!t.length && t.reset(o.blocks);
},
postRender: function () {
var t = this.getConfig().appendTo;
t && ((0, i.isElement)(t) ? t : document.querySelector(t)).appendChild(this.render());
},
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 u;
},
getContainer: function () {
return r.el;
},
render: function (t) {
var e = t || this.getAll().models;
return r.rendered || (r.render(), (r.rendered = 1)), r.collection.reset(e), this.getContainer();
},
};
};
},
function (t, e, n) {
var i = {
'./CanvasClear': 52,
'./CanvasClear.js': 52,
'./CommandAbstract': 38,
'./CommandAbstract.js': 38,
'./ComponentDelete': 51,
'./ComponentDelete.js': 51,
'./ComponentEnter': 50,
'./ComponentEnter.js': 50,
'./ComponentExit': 49,
'./ComponentExit.js': 49,
'./ComponentNext': 48,
'./ComponentNext.js': 48,
'./ComponentPrev': 47,
'./ComponentPrev.js': 47,
'./CopyComponent': 46,
'./CopyComponent.js': 46,
'./CreateComponent': 7,
'./CreateComponent.js': 7,
'./DeleteComponent': 36,
'./DeleteComponent.js': 36,
'./Drag': 21,
'./Drag.js': 21,
'./ExportTemplate': 37,
'./ExportTemplate.js': 37,
'./Fullscreen': 24,
'./Fullscreen.js': 24,
'./ImageComponent': 35,
'./ImageComponent.js': 35,
'./InsertCustom': 12,
'./InsertCustom.js': 12,
'./MoveComponent': 34,
'./MoveComponent.js': 34,
'./OpenAssets': 27,
'./OpenAssets.js': 27,
'./OpenBlocks': 28,
'./OpenBlocks.js': 28,
'./OpenLayers': 31,
'./OpenLayers.js': 31,
'./OpenStyleManager': 30,
'./OpenStyleManager.js': 30,
'./OpenTraitManager': 29,
'./OpenTraitManager.js': 29,
'./PasteComponent': 45,
'./PasteComponent.js': 45,
'./Preview': 23,
'./Preview.js': 23,
'./Resize': 22,
'./Resize.js': 22,
'./SelectComponent': 8,
'./SelectComponent.js': 8,
'./SelectParent': 25,
'./SelectParent.js': 25,
'./SelectPosition': 13,
'./SelectPosition.js': 13,
'./ShowOffset': 26,
'./ShowOffset.js': 26,
'./SwitchVisibility': 32,
'./SwitchVisibility.js': 32,
'./TextComponent': 33,
'./TextComponent.js': 33,
};
function r(t) {
var e = o(t);
return n(e);
}
function o(t) {
var e = i[t];
if (!(e + 1)) {
var n = new Error("Cannot find module '" + t + "'");
throw ((n.code = 'MODULE_NOT_FOUND'), n);
}
return e;
}
(r.keys = function () {
return Object.keys(i);
}),
(r.resolve = o),
(t.exports = r),
(r.id = 99);
},
function (t, e, n) {
'use strict';
var i = n(0);
t.exports = i.Model.extend({ defaults: { command: '', attributes: {} } });
},
function (t, e, n) {
'use strict';
var i = n(0),
r = n(100);
t.exports = i.Collection.extend({ model: r });
},
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';
n(0);
var i = n(59),
r = n(102);
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';
t.exports = {
ESCAPE_KEY: 27,
stylePrefix: 'com-',
defaults: [],
em: null,
firstCentered: !0,
newFixedH: !1,
minComponentH: 50,
minComponentW: 50,
};
},
function (t, e, n) {
'use strict';
var i = n(1);
t.exports = function () {
var t = {},
e = {},
r = {},
o = n(104),
s = n(38);
return {
name: 'Commands',
init: function (e) {
for (var i in ((t = e || {}), o)) i in t || (t[i] = o[i]);
t.em;
var s = t.pStylePrefix;
for (var a in (s && (t.stylePrefix = s + t.stylePrefix), t.defaults)) {
var l = t.defaults[a];
l.id && this.add(l.id, l);
}
var c = n(37);
return (
(r['select-comp'] = n(8)),
(r['create-comp'] = n(7)),
(r['delete-comp'] = n(36)),
(r['image-comp'] = n(35)),
(r['move-comp'] = n(34)),
(r['text-comp'] = n(33)),
(r['insert-custom'] = n(12)),
(r['export-template'] = c),
(r['sw-visibility'] = n(32)),
(r['open-layers'] = n(31)),
(r['open-sm'] = n(30)),
(r['open-tm'] = n(29)),
(r['open-blocks'] = n(28)),
(r['open-assets'] = n(27)),
(r['show-offset'] = n(26)),
(r['select-parent'] = n(25)),
(r.fullscreen = n(24)),
(r.preview = n(23)),
(r.resize = n(22)),
(r.drag = n(21)),
(r['tlb-delete'] = {
run: function (t) {
return t.runCommand('core:component-delete');
},
}),
(r['tlb-clone'] = {
run: function (t) {
t.runCommand('core:copy'), t.runCommand('core:paste');
},
}),
(r['tlb-move'] = {
run: function (t, e, n) {
var i = void 0,
r = t.getModel(),
o = n && n.event,
s = t.getSelected(),
a = [].concat(
(function (t) {
if (Array.isArray(t)) {
for (var e = 0, n = Array(t.length); e < t.length; e++) n[e] = t[e];
return n;
}
return Array.from(t);
})(t.getSelectedAll()),
),
l = t.Canvas.getToolbarEl().style,
c = o && 'dragstart' == o.type,
u = { preserveSelected: 1 },
h = function () {
(l.display = 'none'), r.stopDefault(u);
};
if (s && s.get('draggable')) {
c
? setTimeout(function () {
return h;
}, 0)
: h();
var d = function (e, n) {
r.runDefault(u),
a.forEach(function (t) {
return t.set('status', 'selected');
}),
t.select(a),
s.emitUpdate(),
i && i.blur();
};
if (r.get('designerMode'))
i = editor.runCommand('drag', {
el: s.view.el,
options: {
event: o,
onStart: function (t, e) {
console.log('start mouse pos ', e.start), console.log('el rect ', e.elRect);
var n = e.el;
(n.style.position = 'absolute'), (n.style.margin = 0);
},
onDrag: function (t, e) {
console.log('Delta ', e.delta), console.log('Current ', e.current);
},
onEnd: d,
},
});
else {
c && o.dataTransfer.setDragImage(s.view.el, 0, 0);
var f = t.Commands.get('move-comp');
(f.onEndMoveFromModel = d), f.initSorterFromModels(a);
}
a.forEach(function (t) {
return t.set('status', 'freezed-selected');
});
} else console.warn('The element is not draggable');
},
}),
(r['core:undo'] = function (t) {
return t.UndoManager.undo();
}),
(r['core:redo'] = function (t) {
return t.UndoManager.redo();
}),
[
['copy', 'CopyComponent'],
['paste', 'PasteComponent'],
['component-next', 'ComponentNext'],
['component-prev', 'ComponentPrev'],
['component-enter', 'ComponentEnter'],
['component-exit', 'ComponentExit'],
['canvas-clear', 'CanvasClear'],
['component-delete', 'ComponentDelete'],
].forEach(function (t) {
return (r['core:' + t[0]] = n(99)('./' + t[1]).run);
}),
t.em && (t.model = t.em.get('Canvas')),
this.loadDefaultCommands(),
this
);
},
add: function (t, n) {
return (
(0, i.isFunction)(n) && (n = { run: n }), delete n.initialize, (n.id = t), (e[t] = s.extend(n)), this
);
},
get: function (n) {
var i = e[n];
return 'function' == typeof i && ((i = new i(t)), (e[n] = i)), i;
},
has: function (t) {
return !!e[t];
},
loadDefaultCommands: function () {
for (var t in r) this.add(t, r[t]);
return this;
},
};
};
},
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';
(function (e) {
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
r = n(2);
var o = n(106),
s = i.default.$;
t.exports = i.default.View.extend({
initialize: function (t) {
e.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 = (0, r.getElement)(t).getBoundingClientRect(),
n = this.getFrameOffset(1),
i = e.top,
o = e.left;
return i >= 0 && o >= 0 && i <= n.height && o <= n.width;
},
onFrameScroll: function () {
var t = this.frame.el.contentDocument.body;
(this.toolsEl.style.top = '-' + t.scrollTop + 'px'),
(this.toolsEl.style.left = '-' + t.scrollLeft + 'px'),
this.em.trigger('canvasScroll');
},
renderScripts: function () {
var t = this.frame,
e = this;
t.el.onload = function () {
!(function 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();
})(e.config.scripts.slice(0));
};
},
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 =
'\n ' +
(e.config.baseCss || '') +
'\n\n .' +
n +
'dashed *[data-highlightable] {\n outline: 1px dashed rgba(170,170,170,0.7);\n outline-offset: -2px;\n }\n\n .' +
n +
'comp-selected {\n outline: 3px solid #3b97e3 !important;\n outline-offset: -3px;\n }\n\n .' +
n +
'comp-selected-parent {\n outline: 2px solid #ffca6f !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 ' +
(o.canvasCss || '') +
'\n ' +
(l || '') +
'\n ';
c && i.append(c),
i.append('<style>' + u + '</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 h = document,
d = this.frame.el.contentDocument;
[{ event: 'keydown keyup', class: 'KeyboardEvent' }].forEach(function (t) {
return t.event.split(' ').forEach(function (e) {
d.addEventListener(e, function (e) {
return h.dispatchEvent(
(function (t, e) {
var n = void 0;
try {
n = new window[e](t.type, t);
} catch (t) {
(n = document.createEvent(e)).initEvent(t.type, !0, !0);
}
return (
(n.keyCodeVal = t.keyCode),
['keyCode', 'which'].forEach(function (t) {
Object.defineProperty(n, t, {
get: function () {
return this.keyCodeVal;
},
});
}),
n
);
})(e, t.class),
);
});
});
});
}
},
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;
return {
top: o.top + s - r.top,
left: o.left + a - r.left,
height: t.offsetHeight || t.clientHeight,
width: t.offsetWidth || t.clientWidth,
};
},
getPosition: function () {
var t = this.frame.el.contentDocument;
if (t) {
var e = t.body,
n = this.getFrameOffset(),
i = this.getCanvasOffset();
return { top: n.top + e.scrollTop - i.top, left: n.left + e.scrollLeft - i.left };
}
},
updateScript: function (t) {
t.scriptContainer ||
((t.scriptContainer = s('<div>')), this.getJsContainer().appendChild(t.scriptContainer.get(0)));
var e = t.model,
n = e.getId();
(t.el.id = n), t.scriptContainer.html('');
var i = document.createElement('script');
(i.innerHTML =
"\n setTimeout(function() {\n var item = document.getElementById('" +
n +
"');\n if (!item) return;\n (function(){\n " +
e.getScriptString() +
';\n }.bind(item))()\n }, 1);'),
setTimeout(function () {
return t.scriptContainer.get(0).appendChild(i);
}, 0);
},
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(this, n(1));
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.Model.extend({ defaults: { wrapper: '', width: '', height: '', attributes: {} } });
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(108);
t.exports = i.default.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';
t.exports = { stylePrefix: 'cv-', rulers: !1, scripts: [], styles: [], customBadgeLabel: '' };
},
function (t, e, n) {
'use strict';
Object.defineProperty(e, '__esModule', { value: !0 });
var i = (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;
};
})(),
r = n(2),
o = n(1);
var s = (function () {
function t(e) {
!(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function');
})(this, t),
(this.em = e);
var n = e.get('DomComponents').getWrapper().getEl();
return (
(this.el = n),
(this.counter = 0),
(0, o.bindAll)(this, 'handleDragEnter', 'handleDragOver', 'handleDrop', 'handleDragLeave'),
(0, r.on)(n, 'dragenter', this.handleDragEnter),
(0, r.on)(n, 'dragover', this.handleDragOver),
(0, r.on)(n, 'drop', this.handleDrop),
(0, r.on)(n, 'dragleave', this.handleDragLeave),
this
);
}
return (
i(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(), e.set('dragResult', t), 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'),
s = t.getData('text');
if (i.length) {
s = [];
for (var a = 0; a < i.length; a++) {
var l = i[a],
c = l.type.split('/')[0];
'image' == c && s.push({ type: c, file: l, attributes: { alt: l.name } });
}
} else if (r) s = r;
else if ((0, o.indexOf)(n, 'text/html') >= 0) s = t.getData('text/html').replace(/<\/?meta[^>]*>/g, '');
else if ((0, o.indexOf)(n, 'text/uri-list') >= 0)
s = { type: 'link', attributes: { href: s }, content: s };
else if ((0, o.indexOf)(n, 'text/json') >= 0) {
var u = t.getData('text/json');
u && (s = JSON.parse(u));
}
var h = { content: s };
return e.trigger('canvas:dragdata', t, h), h;
},
},
]),
t
);
})();
e.default = s;
},
function (t, e, n) {
'use strict';
var i = n(2),
r = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(111));
t.exports = function () {
var t,
e,
o = {},
s = n(110),
a = n(109),
l = n(107);
return {
getCanvasView: function () {
return l;
},
name: 'Canvas',
init: function (e) {
for (var n in ((o = e || {}), s)) n in o || (o[n] = s[n]);
var i = o.pStylePrefix;
i && (o.stylePrefix = i + o.stylePrefix), (t = new a(e)), (l = new l({ model: t, config: o }));
var r = o.em.get('DomComponents');
return (
r && this.setWrapper(r),
(this.startAutoscroll = this.startAutoscroll.bind(this)),
(this.stopAutoscroll = this.stopAutoscroll.bind(this)),
(this.autoscroll = this.autoscroll.bind(this)),
this
);
},
getConfig: function () {
return o;
},
setWrapper: function (e) {
t.set('wrapper', e);
},
getElement: function () {
return l.el;
},
getFrameEl: function () {
return l.frame.el;
},
getDocument: function () {
return this.getFrameEl().contentDocument;
},
getWindow: function () {
return this.getFrameEl().contentWindow;
},
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) {
o.customBadgeLabel = t;
},
getElementPos: function (t, e) {
return l.getElementPos(t, e);
},
getTargetToElementDim: function (t, e, n) {
var i = n || {},
r = l.getPosition();
if (r) {
var s = i.elPos || l.getElementPos(e),
a = n.toRight || 0,
c = i.targetHeight || t.offsetHeight,
u = i.targetWidth || t.offsetWidth,
h = i.event || null,
d = s.top - c,
f = s.left;
f += a ? s.width : 0;
var p = (f = a ? f - u : f) < r.left ? r.left : f,
g = d < r.top ? r.top : d,
v = {
top: (g = g > s.top + s.height ? s.top + s.height : g),
left: p,
elementTop: s.top,
elementLeft: s.left,
elementWidth: s.width,
elementHeight: s.height,
targetWidth: t.offsetWidth,
targetHeight: t.offsetHeight,
canvasTop: r.top,
canvasLeft: r.left,
};
return h && o.em && o.em.trigger(h, v), v;
}
},
getMouseRelativePos: function (t, e) {
var n = 0,
i = 0,
r = (e || {}).subWinOffset,
o = t.target.ownerDocument,
s = o.defaultView || o.parentWindow,
a = s.frameElement,
l = r ? s.pageYOffset : 0,
c = r ? s.pageXOffset : 0;
if (a) {
var u = a.getBoundingClientRect();
(n = u.top || 0), (i = u.left || 0);
}
return { y: t.clientY + n - l, x: t.clientX + i - c };
},
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 };
},
hasFocus: function () {
return this.getDocument().hasFocus();
},
isInputFocused: function () {
return 'BODY' !== this.getFrameEl().contentDocument.activeElement.tagName;
},
scrollTo: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = (0, i.getElement)(t);
(this.getCanvasView().isElInViewport(n) && !e.force) || n.scrollIntoView(e);
},
startAutoscroll: function () {
var t = this;
this.dragging = 1;
var n = this.getScrollListeners();
(e = l.getFrameOffset(1)),
setTimeout(function () {
(0, i.on)(n, 'mousemove', t.autoscroll), (0, i.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 = t.clientY,
o = e.height - 50;
r < 50 && (i -= 50 - r), r > o && (i += r - o), n.scrollTo(0, i);
}
},
stopAutoscroll: function () {
this.dragging = 0;
var t = this.getScrollListeners();
(0, i.off)(t, 'mousemove', this.autoscroll), (0, i.off)(t, 'mouseup', this.stopAutoscroll);
},
getScrollListeners: function () {
return [this.getFrameEl().contentWindow, this.getElement()];
},
postRender: function () {
(0, i.hasDnd)(o.em) && (this.droppable = new r.default(o.em));
},
getFrameWrapperEl: function () {
return l.frame.getWrapper();
},
};
};
},
function (t, e, n) {
'use strict';
var i = n(53);
t.exports = n(0).View.extend({
initialize: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
this.opt = t;
var e = t.config || {};
(this.level = t.level),
(this.config = e),
(this.preview = t.preview),
(this.ppfx = e.pStylePrefix || ''),
(this.pfx = e.stylePrefix || ''),
(this.parent = t.parent);
var n = this.pfx,
i = this.ppfx,
r = this.parent,
o = this.collection;
this.listenTo(o, 'add', this.addTo),
this.listenTo(o, 'reset resetNavigator', this.render),
this.listenTo(o, 'remove', this.removeChildren),
(this.className = n + 'layers');
var s = e.em;
if (e.sortable && !this.opt.sorter) {
var a = s.get('Utils');
this.opt.sorter = new a.Sorter({
container: e.sortContainer || this.el,
containerSel: '.' + this.className,
itemSel: '.' + n + 'layer',
ignoreViewChildren: 1,
onEndMove: function (t, e) {
var n = e.getSourceModel();
s.setSelected(n, { forceChange: 1 });
},
avoidSelectOnEnd: 1,
nested: 1,
ppfx: i,
pfx: n,
});
}
(this.sorter = this.opt.sorter || ''), this.$el.data('collection', o), r && this.$el.data('model', r);
},
removeChildren: function (t) {
var e = t.viewLayer;
e && e.remove.apply(e);
},
addTo: function (t) {
var e = this.collection.indexOf(t);
this.addToCollection(t, null, e);
},
addToCollection: function (t, e, n) {
var r = this.level,
o = e || null,
s = i;
if (this.isCountable(t, this.config.hideTextnode)) {
var a = new s({
level: r,
model: t,
config: this.config,
sorter: this.sorter,
isCountable: this.isCountable,
opened: this.opt.opened,
}).render().el;
if (o) o.appendChild(a);
else if (void 0 !== n) {
var l = 'before';
this.$el.children().length == n && (n--, (l = 'after')),
n < 0 ? this.$el.append(a) : this.$el.children().eq(n)[l](a);
} else this.$el.append(a);
return a;
}
},
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(),
n = this.el;
return (
(n.innerHTML = ''),
this.collection.each(function (n) {
return t.addToCollection(n, e);
}),
n.appendChild(e),
(n.className = this.className),
this
);
},
});
},
function (t, e, n) {
'use strict';
t.exports = {
stylePrefix: '',
appendTo: '',
sortable: 1,
hidable: 1,
hideTextnode: 1,
root: '',
showWrapper: 1,
showHover: 1,
scrollCanvas: { behavior: 'smooth' },
scrollLayers: 1,
highlightHover: 1,
};
},
function (t, e, n) {
'use strict';
t.exports = n(0).View.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, { 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;
},
},
);
},
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';
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;
return { tagName: e, type: 'svg', resizable: 'svg' == e };
}
},
},
);
},
function (t, e, n) {
'use strict';
n(0);
var i = n(14);
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, { 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;
}
},
},
);
},
function (t, e, n) {
'use strict';
n(0);
var i = n(14),
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';
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(40),
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 = [];
switch (this.get('provider')) {
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 () {
switch (this.get('provider')) {
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);
switch (this.get('provider')) {
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('component:toggled');
},
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(),
];
},
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('videoId'),
e = this.get('ytUrl');
return (
(e += t + '?'),
(e += this.get('autoplay') ? '&autoplay=1' : ''),
(e += this.get('controls') ? '' : '&controls=0&showinfo=0'),
(e += this.get('loop') ? '&loop=1&playlist=' + t : '')
);
},
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';
t.exports = n(56).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 = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(39));
t.exports = r.default.extend(
{ defaults: i({}, r.default.prototype.defaults, { tagName: 'label', traits: ['id', 'title', 'for'] }) },
{
isComponent: function (t) {
if ('LABEL' == t.tagName) return { type: 'label' };
},
},
);
},
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 = 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';
n(0);
var i = n(14);
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(40),
o = n(4);
t.exports = r.extend(
{
defaults: i({}, r.prototype.defaults, {
type: 'map',
void: 0,
mapUrl: 'https://maps.google.com/maps',
tagName: 'iframe',
mapType: 'q',
address: '',
zoom: '1',
attributes: { frameborder: 0 },
toolbar: o.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(),
r.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.get('address'),
e = this.get('zoom'),
n = this.get('mapType');
(t = t ? '&q=' + t : ''), (e = e ? '&z=' + e : ''), (n = n ? '&t=' + n : '');
var i = this.get('mapUrl') + '?' + t + e + n;
return (i += '&output=embed');
},
parseFromSrc: function () {
var t = this.parseUri(this.get('src')).query;
t.q && this.set('address', t.q), t.z && this.set('zoom', t.z), t.t && this.set('mapType', t.t);
},
},
{
isComponent: function (t) {
var e = '';
return 'IFRAME' == t.tagName && /maps\.google\.com/.test(t.src) && (e = { type: 'map', src: t.src }), e;
},
},
);
},
function (t, e, n) {
'use strict';
n(0);
var i = 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(41);
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';
n(0);
var i = n(3);
t.exports = i.extend({});
},
function (t, e, n) {
'use strict';
n(0);
var i = 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(41);
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';
n(0);
var i = 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(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';
n(0);
var i = 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';
n(0);
var i = 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: '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';
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(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();
this.set({ value: t }, { fromTarget: 1 });
},
getTargetValue: function () {
var t = this.get('name'),
e = this.target,
n = void 0;
return (n = this.get('changeProp') ? e.get(t) : e.getAttributes()[t]), (0, r.isUndefined)(n) ? '' : n;
},
setTargetValue: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = this.target,
o = this.get('name');
if (!(0, r.isUndefined)(t))
if (this.get('changeProp')) n.set(o, t, e);
else {
var s = i({}, n.get('attributes'));
(s[o] = t), n.set('attributes', s, e);
}
},
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';
var i = n(1),
r = n(0),
o = n(140),
s = n(139);
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 || ''), this.listenTo(this, 'add', this.handleAdd);
},
handleAdd: function (t) {
var e = this.target;
e && (t.target = e);
},
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';
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 =
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 = function () {
var t,
e,
o = {},
s = void 0,
a = n(142),
l = n(4),
c = n(3),
u = n(58),
h = n(57),
d = [
{ id: 'cell', model: n(138), view: n(137) },
{ id: 'row', model: n(136), view: n(135) },
{ id: 'table', model: n(134), view: n(133) },
{ id: 'thead', model: n(132), view: n(131) },
{ id: 'tbody', model: n(41), view: n(130) },
{ id: 'tfoot', model: n(129), view: n(128) },
{ id: 'map', model: n(127), view: n(126) },
{ id: 'link', model: n(125), view: n(56) },
{ id: 'label', model: n(124), view: n(123) },
{ id: 'video', model: n(122), view: n(121) },
{ id: 'image', model: n(40), view: n(14) },
{ id: 'script', model: n(120), view: n(119) },
{ id: 'svg', model: n(118), view: n(117) },
{ id: 'textnode', model: n(116), view: n(115) },
{ id: 'text', model: n(39), view: n(55) },
{ id: 'default', model: l, view: c },
];
return {
Component: l,
Components: u,
ComponentsView: h,
componentTypes: d,
name: 'DomComponents',
getConfig: function () {
return o;
},
storageKey: function () {
var t = [],
e = (o.stm && o.stm.getConfig()) || {};
return e.storeHtml && t.push('html'), e.storeComponents && t.push('components'), t;
},
init: function (n) {
var r = this;
for (var u in ((s = (o = n || {}).em),
(this.em = s),
s && (o.components = s.config.components || o.components),
a))
u in o || (o[u] = a[u]);
var h = o.pStylePrefix;
if ((h && (o.stylePrefix = h + o.stylePrefix), s)) {
(o.modal = s.get('Modal') || ''),
(o.am = s.get('AssetManager') || ''),
(s.get('Parser').compTypes = d),
s.on('change:componentHovered', this.componentHovered, this);
var f = s.get('selected');
s.listenTo(f, 'add', function (t, e, n) {
return r.selectAdd(t, n);
}),
s.listenTo(f, 'remove', function (t, e, n) {
return r.selectRemove(t, n);
});
}
var p = o.components,
g = i({}, o.wrapper);
return (
(g['custom-name'] = o.wrapperName),
(g.wrapper = 1),
p &&
p.constructor === Object &&
p.wrapper &&
((g = i({}, p)),
(p = p.components || []),
(g.components = []),
s && ((s.config.components = p), (o.components = p))),
(t = new l(g, { em: s, config: o, componentTypes: d })).set({ attributes: { id: 'wrapper' } }),
(e = new c({ model: t, config: o, componentTypes: d })),
this
);
},
onLoad: function () {
this.setComponents(o.components);
},
postLoad: function (t) {
this.handleChanges(this.getWrapper(), null, { avoidStore: 1 });
},
handleChanges: function (t, e) {
var n = this,
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
r = t.components(),
o = s.get('UndoManager'),
a = s.handleUpdates.bind(s),
l = this.handleChanges.bind(this),
c = this.handleRemoves.bind(this);
o && o.add(t), o && r && o.add(r);
[
[t, 'change:style change:content change:attributes change:src', a],
[r, 'add', l],
[r, 'remove', c],
[t.get('classes'), 'add remove', a],
].forEach(function (t) {
s.stopListening(t[0], t[1], t[2]), s.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 && s.handleUpdates(t, e, n);
},
load: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '',
e = '';
if ((!t && o.stm && (t = o.em.getCacheLoad()), t.components))
try {
e = JSON.parse(t.components);
} catch (t) {}
else t.html && (e = t.html);
var n = e && e.constructor === Object;
return (
((e && e.length) || n) &&
(this.clear(),
this.getComponents().reset(),
n ? this.getWrapper().set(e).initComponents().initClasses().loadTraits() : this.getComponents().add(e)),
e
);
},
store: function (t) {
if (o.stm) {
var e = {},
n = this.storageKey();
if ((n.indexOf('html') >= 0 && (e.html = o.em.getHtml()), n.indexOf('components') >= 0)) {
var i = o.storeWrapper ? this.getWrapper() : this.getComponents();
e.components = JSON.stringify(i);
}
return t || o.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 () {
return this.getComponents().reset(), 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), d.unshift(e));
},
getType: function (t) {
for (var e = d, n = 0; n < e.length; n++) {
if (e[n].id == t) return e[n];
}
},
selectAdd: function (t) {
var e = this,
n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
t &&
(t.set({ status: 'selected' }),
['component:selected', 'component:toggled'].forEach(function (i) {
return e.em.trigger(i, t, n);
}));
},
selectRemove: function (t) {
var e = this,
n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if (t) {
this.em;
t.set({ status: '', state: '' }),
['component:deselected', 'component:toggled'].forEach(function (i) {
return e.em.trigger(i, t, n);
});
}
},
componentHovered: function () {
var t = o.em,
e = t.get('componentHovered'),
n = t.previous('componentHovered');
n && 'hovered' == n.get('status') && n.set({ status: '', state: '' }),
e && (0, r.isEmpty)(e.get('status')) && e.set('status', 'hovered');
},
};
};
},
function (t, e, n) {
'use strict';
var i = n(9),
r = n(69);
t.exports = i.extend({
getInputEl: function () {
if (!this.$input) {
var t = this.model,
e = this.getModelValue(),
n = new r({
model: t,
target: this.config.em,
contClass: this.ppfx + 'field-color',
ppfx: this.ppfx,
}).render();
(this.$input = n.colorEl), n.setValue(e, { fromTarget: 1 }), (this.input = n);
}
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 = n(9),
r = n(42);
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(9);
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';
(function (e) {
var i = n(9),
r = n(0).$;
t.exports = i.extend({
initialize: function (t) {
i.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,
n = t.get('options') || [],
i = '<select>';
n.length &&
e.each(n, function (t) {
var e,
n,
r,
o = '';
'string' == typeof t
? ((e = t), (n = t))
: ((e = t.name ? t.name : t.value),
(n = t.value.replace(/"/g, '&quot;')),
(o += (r = t.style ? t.style.replace(/"/g, '&quot;') : '') ? 'style="' + r + '"' : '')),
(i += '<option value="' + n + '" ' + o + '>' + e + '</option>');
}),
(i += '</select>'),
(this.input = i),
(this.$input = r(this.input));
var o = this.target,
s = t.get('name'),
a = t.get('value');
if (t.get('changeProp')) a = a || o.get(s);
else a = o.get('attributes')[s];
a && this.$input.val(a);
}
return this.$input.get(0);
},
});
}).call(this, n(1));
},
function (t, e, n) {
'use strict';
var i = n(59),
r = n(9),
o = n(147),
s = n(146),
a = n(145),
l = n(144);
t.exports = i.extend({
itemView: r,
itemsView: { text: r, number: a, select: o, checkbox: s, color: l },
initialize: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
e = t.config || {};
(this.config = e),
(this.em = t.editor),
(this.pfx = e.stylePrefix || ''),
(this.ppfx = e.pStylePrefix || ''),
(this.className = this.pfx + 'traits');
this.listenTo(this.em, 'component:toggled', this.updatedCollection), this.updatedCollection();
},
updatedCollection: function () {
var t = this.ppfx,
e = this.em.getSelected();
(this.el.className = this.className + ' ' + t + 'one-bg ' + t + 'two-color'),
e && ((this.collection = e.get('traits')), this.render());
},
});
},
function (t, e, n) {
'use strict';
t.exports = {
stylePrefix: 'trt-',
appendTo: '',
labelContainer: 'Component settings',
labelPlhText: 'eg. Text here',
labelPlhHref: 'eg. https://google.com',
optionsTarget: [
{ value: '', name: 'This window' },
{ value: '_blank', name: 'New window' },
],
textNoElement: 'Select an element before using Trait Manager',
};
},
function (t, e, n) {
'use strict';
var i = n(1),
r = n(149),
o = n(148);
t.exports = function () {
var t = {},
e = void 0;
return {
TraitsView: o,
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, r);
var s = t.pStylePrefix;
return (
s && (t.stylePrefix = '' + s + t.stylePrefix),
(e = new o({ collection: [], editor: t.em, config: t })),
this
);
},
postRender: function () {
var t = this.getConfig().appendTo;
t && ((0, i.isElement)(t) ? t : document.querySelector(t)).appendChild(this.render());
},
getTraitsViewer: function () {
return e;
},
addType: function (t, n) {
var i = e.itemView;
e.itemsView[t] = i.extend(n);
},
getType: function (t) {
return e.itemsView[t];
},
render: function () {
return e.render().el;
},
};
};
},
function (t, e, n) {
'use strict';
t.exports = n(60).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 = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(60),
o = n(151),
s = i.default.$,
a = function (t, e) {
return t + (e ? '-' + e.replace('%', 'pc') : '');
};
t.exports = i.default.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) {
if (this.renderStarted) {
var n = e || null,
i = void 0,
s = void 0,
l = { model: t, config: this.config };
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),
(i = h);
}
(s = new o(l)), u.appendData(s.render().el.textContent);
} else i = (s = new r(l)).render().el;
var d = this.className,
f = t.get('mediaText'),
p = a(d),
g = p;
if ((f && (g = a(d, this.getMediaWidth(f))), i)) {
var v = n || this.el,
m = void 0;
try {
m = v.querySelector('#' + g);
} catch (t) {}
m || (m = v.querySelector('#' + p)), m.appendChild(i);
}
return i;
}
},
getMediaWidth: function (t) {
return t && t.replace('(' + this.em.getConfig('mediaCondition') + ': ', '').replace(')', '');
},
render: function () {
var t = this;
(this.renderStarted = 1), (this.atRules = {});
var e = this.$el,
n = document.createDocumentFragment(),
i = this.className;
return (
e.empty(),
this.em
.get('DeviceManager')
.getAll()
.map(function (t) {
return t.get('widthMedia');
})
.sort(function (t, e) {
return (
((e && e.replace('px', '')) || Number.MAX_VALUE) - ((t && t.replace('px', '')) || Number.MAX_VALUE)
);
})
.forEach(function (t) {
s('<div id="' + a(i, t) + '"></div>').appendTo(n);
}),
this.collection.each(function (e) {
return t.addToCollection(e, n);
}),
e.append(n),
e.attr('class', i),
this
);
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(62);
t.exports = i.default.Collection.extend({
initialize: function (t, e) {
e && e.em && (this.editor = e.em),
(this.model = function (t, n) {
return !n.em && e && e.em && (n.em = e.em), 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.default.Collection.prototype.add.apply(this, [t, e])
);
},
});
},
function (t, e, n) {
'use strict';
t.exports = { stylePrefix: 'css-', staticRules: '', rules: [] };
},
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 = function () {
var t,
e,
o = void 0,
s = {},
a = n(154),
l = n(62),
c = n(153),
u = n(152),
h = n(19),
d = n(10);
return {
Selectors: h,
name: 'CssComposer',
storageKey: function () {
var t = [],
e = (s.stm && s.stm.getConfig()) || {};
return e.storeCss && t.push('css'), e.storeStyles && t.push('styles'), t;
},
init: function (n) {
for (var i in ((s = n || {}), a)) i in s || (s[i] = a[i]);
var r = s.pStylePrefix;
r && (s.stylePrefix = r + s.stylePrefix);
var l = (s.em && s.em.config.style) || '';
return (
(s.rules = l || s.rules), (o = s.em), (t = new c([], s)), (e = new u({ collection: t, config: s })), this
);
},
onLoad: function () {
t.add(s.rules);
},
postLoad: function (t) {
var e = this,
n = 'add remove',
i = this.getAll(),
r = t.get('UndoManager');
r && r.add(i),
t.stopListening(i, n, this.handleChange),
t.listenTo(i, n, this.handleChange),
i.each(function (t) {
return e.handleChange(t, { avoidStore: 1 });
});
},
handleChange: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = 'change:style',
i = o.get('UndoManager');
i && i.add(t);
var r = o.handleUpdates.bind(o);
o.stopListening(t, n, r), o.listenTo(t, n, r), !e.avoidStore && r('', '', e);
},
load: function (e) {
var n = e || '';
!n && s.stm && (n = s.em.getCacheLoad());
var i = n.styles || '';
if (n.styles)
try {
i = JSON.parse(n.styles);
} catch (t) {}
else n.css && (i = s.em.get('Parser').parseCss(n.css));
return (0, r.isArray)(i) ? i.length && t.reset(i) : i && t.reset(i), i;
},
store: function (e) {
if (s.stm) {
var n = {},
i = this.storageKey();
return (
i.indexOf('css') >= 0 && (n.css = s.em.getCss()),
i.indexOf('styles') >= 0 && (n.styles = JSON.stringify(t)),
e || s.stm.store(n),
n
);
}
},
add: function (e, n, r) {
var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
a = n || '',
c = r || '',
u = i({}, o),
h = this.get(e, a, c, u);
return h && h.config && !h.config.atRuleType
? h
: ((u.state = a),
(u.mediaText = c),
(u.selectors = ''),
(h = new l(u, s)).get('selectors').add(e),
t.add(h),
h);
},
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],
o = 0,
a = r.length;
o < a;
o++
) {
var l = r[o] || {};
if (l.selectors) {
var c = s.em && s.em.get('SelectorManager');
c || console.warn('Selector Manager not found');
for (var 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 || '',
r = n.mediaText || o.getCurrentMedia(),
s = o.get('SelectorManager').add({ name: t, type: d.TYPE_ID }),
a = this.add(s, i, r);
return a.setStyle(e, n), a;
},
getIdRule: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = e.state || '',
i = e.mediaText || o.getCurrentMedia(),
r = o.get('SelectorManager').get(t, d.TYPE_ID);
return r && this.get(r, 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 || '',
r = n.mediaText || o.getCurrentMedia(),
s = o.get('SelectorManager').add({ name: t, type: d.TYPE_CLASS }),
a = this.add(s, i, r);
return a.setStyle(e, n), a;
},
getClassRule: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = e.state || '',
i = e.mediaText || o.getCurrentMedia(),
r = o.get('SelectorManager').get(t, d.TYPE_CLASS);
return r && this.get(r, n, i);
},
render: function () {
return e.render().el;
},
};
};
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
n(64), n(65), n(63);
t.exports = i.default.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>\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.bind(this)(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 = this.collection,
i = this.config,
r = new t.typeView({ model: t, collection: n, config: i }).render().el;
if (e) e.appendChild(r);
else {
var o = this.getAssetsEl();
o && o.insertBefore(r, o.firstChild);
}
return r;
},
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
);
},
});
},
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';
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(157);
t.exports = r.extend({
defaults: i({}, r.prototype.defaults, { type: 'image', unitDim: 'px', height: 0, width: 0 }),
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(76));
t.exports = n(0)
.Collection.extend(i.default)
.extend({
types: [
{
id: 'image',
model: n(158),
view: n(65),
isType: function (t) {
return 'string' == typeof t ? { type: 'image', src: t } : t;
},
},
],
});
},
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';
t.exports = function () {
var t = {},
e = n(160),
i = n(159),
r = n(156),
o = n(63),
s = void 0,
a = void 0,
l = void 0;
return {
name: 'AssetManager',
storageKey: 'assets',
getConfig: function () {
return t;
},
init: function (n) {
var c = this;
for (var u in ((t = n || {}), 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 void 0 === 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 (t) {}
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';
var i = o(n(1)),
r = o(n(0));
function o(t) {
return t && t.__esModule ? t : { default: t };
}
var s = n(16);
t.exports = r.default.View.extend({
template: i.default.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 s({ collection: t, target: this.target, propTarget: this.propTarget, config: this.config });
this.$el.append(e.render().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;
},
r = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
o = n(1);
var s = n(162);
t.exports = r.default.View.extend({
initialize: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
e = t.config || {};
(this.pfx = e.stylePrefix || ''),
(this.ppfx = e.pStylePrefix || ''),
(this.target = t.target || {}),
(this.config = e);
var n = {};
(0, o.extend)(n, r.default.Events);
var s = document.body,
a = document.createElement('el-' + new Date().getTime());
s.appendChild(a),
(n.computedDefault = i({}, window.getComputedStyle(a))),
s.removeChild(a),
(this.propTarget = n);
var l = this.collection;
this.listenTo(l, 'add', this.addTo),
this.listenTo(l, 'reset', this.render),
this.listenTo(
this.target,
'component:toggled component:update:classes component:update:state change:device',
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').devicePreviewMode ? '' : n.get('state'),
r = n.getEl();
if (((e.helper = null), r)) {
var o = i ? ':' + i : null;
e.computed = window.getComputedStyle(r, o);
}
(n = t.get('StyleManager').getModelToStyle(n)),
i &&
(function () {
var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
i = t.get('CssComposer'),
r = i.getAll(),
o = i.getClassRule('hc-state');
o ? (r.remove(o), r.add(o)) : (o = i.setClassRule('hc-state')),
o.set('important', 1),
o.setStyle(n),
(e.helper = o);
})(n.getStyle()),
(e.model = n),
e.trigger('update');
}
},
addToCollection: function (t, e) {
var n = e || null,
i = new s({
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,
}).render().el;
return n ? n.appendChild(i) : this.$el.append(i), i;
},
render: function () {
var t = this,
e = document.createDocumentFragment(),
n = this.$el,
i = this.pfx,
r = this.ppfx;
return (
n.empty(),
this.collection.each(function (n) {
return t.addToCollection(n, e);
}),
n.append(e),
n.addClass(i + 'sectors ' + r + 'one-bg ' + r + 'two-color'),
this
);
},
});
},
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';
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(15);
t.exports = r.extend({
events: function () {
return i({}, r.prototype.events, {
'change [type=range]': 'inputValueChanged',
'input [type=range]': 'inputValueChangedSoft',
change: '',
});
},
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 () {
r.prototype.onRender.apply(this, arguments),
this.model.get('showInput') || (this.inputInst.el.style.display = 'none');
},
});
},
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(66);
t.exports = r.extend({ defaults: i({}, r.prototype.defaults, { showInput: 1 }) });
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.View.extend({
events: { click: 'active', 'click [data-close-layer]': 'remove', 'mousedown [data-move-layer]': 'initSorter' },
template: function (t) {
var e = this.pfx;
return (
'\n <div id="' +
e +
'move" data-move-layer>\n <i class="fa fa-arrows"></i>\n </div>\n <div id="' +
e +
'label">' +
('Layer ' + t.get('index')) +
'</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 e = this.model,
n = e.collection,
r = this.stackModel;
i.default.View.prototype.remove.apply(this, arguments),
n.contains(e) && n.remove(e),
r && r.set && (r.set({ stackIndex: null }, { silent: !0 }), r.trigger('updateValue'));
},
onPreview: function (t) {
var e = t.split(' '),
n = [];
return (
this.model.get('properties').each(function (t, i) {
var r = e[i] || '';
if (r && 'integer' == t.get('type')) {
var o = parseInt(r, 10),
s = r.replace(o, '');
r = (o = (o = (o = isNaN(o) ? 0 : o) > 3 ? 3 : o) < -3 ? -3 : o) + s;
}
n.push(r);
}),
n.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(16),
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
);
},
});
},
function (t, e, n) {
'use strict';
var i = n(0),
r = n(167);
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;
void 0 !== this.preview && t.set('preview', this.preview);
var c = new r({ model: t, config: s, sorter: a, stackModel: o, propsConfig: l }).render().el;
if (i) i.appendChild(c);
else if (void 0 !== n) {
var u = 'before';
this.$el.children().length == n && (n--, (u = 'after')),
n < 0 ? this.$el.append(c) : this.$el.children().eq(n)[u](c);
} else this.$el.append(c);
return c;
},
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';
Object.defineProperty(e, '__esModule', { value: !0 });
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;
};
e.default = function (t, e) {
var n = {
beforeShow: h,
move: h,
change: h,
show: h,
hide: h,
color: !1,
flat: !1,
showInput: !1,
allowEmpty: !1,
showButtons: !0,
clickoutFiresChange: !0,
showInitial: !1,
showPalette: !1,
showPaletteOnly: !1,
hideAfterPaletteSelect: !1,
togglePaletteOnly: !1,
showSelectionPalette: !0,
localStorageKey: !1,
appendTo: 'body',
maxSelectionSize: 7,
cancelText: 'cancel',
chooseText: 'choose',
togglePaletteMoreText: 'more',
togglePaletteLessText: 'less',
clearText: 'Clear Color Selection',
noColorSelectedText: 'No Color Selected',
preferredFormat: !1,
className: '',
containerClassName: '',
replacerClassName: '',
showAlpha: !1,
theme: 'sp-light',
palette: [
['#ffffff', '#000000', '#ff0000', '#ff8000', '#ffff00', '#008000', '#0000ff', '#4b0082', '#9400d3'],
],
selectionPalette: [],
disabled: !1,
offset: null,
},
r = [],
o = !!/msie/i.exec(window.navigator.userAgent),
s = (function () {
function t(t, e) {
return !!~('' + t).indexOf(e);
}
var e = document.createElement('div').style;
return (
(e.cssText = 'background-color:rgba(0,0,0,.5)'),
t(e.backgroundColor, 'rgba') || t(e.backgroundColor, 'hsla')
);
})(),
a = [
"<div class='sp-replacer'>",
"<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
"<div class='sp-dd'>&#9660;</div>",
'</div>',
].join(''),
l = (function () {
var t = '';
if (o) 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('');
})();
function c(e, n, i, r) {
for (var o = [], a = 0; a < e.length; a++) {
var l = e[a];
if (l) {
var c = S(l),
u = c.toHsl().l < 0.5 ? 'sp-thumb-el sp-thumb-dark' : 'sp-thumb-el sp-thumb-light';
u += S.equals(n, l) ? ' sp-thumb-active' : '';
var h = c.toString(r.preferredFormat || 'rgb'),
d = s ? 'background-color:' + c.toRgbString() : 'filter:' + c.toFilter();
o.push(
'<span title="' +
h +
'" data-color="' +
c.toRgbString() +
'" class="' +
u +
'"><span class="sp-thumb-inner" style="' +
d +
';"></span></span>',
);
} else {
o.push(
t('<div />')
.append(
t(
'<span data-color="" style="background-color:transparent;" class="sp-clear-display"></span>',
).attr('title', r.noColorSelectedText),
)
.html(),
);
}
}
return "<div class='sp-cf " + i + "'>" + o.join('') + '</div>';
}
function u(i, u) {
var h = (function (e, i) {
var r = t.extend({}, n, e);
return (
(r.callbacks = {
move: f(r.move, i),
change: f(r.change, i),
show: f(r.show, i),
hide: f(r.hide, i),
beforeShow: f(r.beforeShow, i),
}),
r
);
})(u, i),
v = h.flat,
m = h.showSelectionPalette,
y = h.localStorageKey,
b = h.theme,
x = h.callbacks,
w = (function (t, e, n) {
var i;
return function () {
var r = this,
o = arguments;
n && clearTimeout(i),
(!n && i) ||
(i = setTimeout(function () {
(i = null), t.apply(r, o);
}, e));
};
})(Ht, 10),
C = !1,
k = !1,
T = 0,
E = 0,
M = 0,
A = 0,
O = 0,
P = 0,
_ = 0,
L = 0,
N = 0,
D = 0,
I = 1,
F = [],
R = [],
j = {},
z = h.selectionPalette.slice(0),
H = h.maxSelectionSize,
V = 'sp-dragging',
$ = null,
B = i.ownerDocument,
W = (B.body, t(i)),
U = !1,
q = t(l, B).addClass(b),
K = q.find('.sp-picker-container'),
G = q.find('.sp-color'),
Y = q.find('.sp-dragger'),
X = q.find('.sp-hue'),
J = q.find('.sp-slider'),
Z = q.find('.sp-alpha-inner'),
Q = q.find('.sp-alpha'),
tt = q.find('.sp-alpha-handle'),
et = q.find('.sp-input'),
nt = q.find('.sp-palette'),
it = q.find('.sp-initial'),
rt = q.find('.sp-cancel'),
ot = q.find('.sp-clear'),
st = q.find('.sp-choose'),
at = q.find('.sp-palette-toggle'),
lt = W.is('input'),
ct = lt && 'color' === W.attr('type') && g(),
ut = lt && !v,
ht = ut ? t(a).addClass(b).addClass(h.className).addClass(h.replacerClassName) : t([]),
dt = ut ? ht : W,
ft = ht.find('.sp-preview-inner'),
pt = h.color || (lt && W.val()),
gt = !1,
vt = h.preferredFormat,
mt = !h.showButtons || h.clickoutFiresChange,
yt = !pt,
bt = h.allowEmpty && !ct;
function xt() {
if (
(h.showPaletteOnly && (h.showPalette = !0),
at.text(h.showPaletteOnly ? h.togglePaletteMoreText : h.togglePaletteLessText),
h.palette)
) {
(F = h.palette.slice(0)), (R = t.isArray(F[0]) ? F : [F]), (j = {});
for (var e = 0; e < R.length; e++)
for (var n = 0; n < R[e].length; n++) {
var i = S(R[e][n]).toRgbString();
j[i] = !0;
}
}
q.toggleClass('sp-flat', v),
q.toggleClass('sp-input-disabled', !h.showInput),
q.toggleClass('sp-alpha-enabled', h.showAlpha),
q.toggleClass('sp-clear-enabled', bt),
q.toggleClass('sp-buttons-disabled', !h.showButtons),
q.toggleClass('sp-palette-buttons-disabled', !h.togglePaletteOnly),
q.toggleClass('sp-palette-disabled', !h.showPalette),
q.toggleClass('sp-palette-only', h.showPaletteOnly),
q.toggleClass('sp-initial-disabled', !h.showInitial),
q.addClass(h.className).addClass(h.containerClassName),
Ht();
}
function wt() {
if (y && window.localStorage) {
try {
var e = window.localStorage[y].split(',#');
e.length > 1 &&
(delete window.localStorage[y],
t.each(e, function (t, e) {
Ct(e);
}));
} catch (t) {}
try {
z = window.localStorage[y].split(';');
} catch (t) {}
}
}
function Ct(e) {
if (m) {
var n = S(e).toRgbString();
if (!j[n] && -1 === t.inArray(n, z)) for (z.push(n); z.length > H; ) z.shift();
if (y && window.localStorage)
try {
window.localStorage[y] = z.join(';');
} catch (t) {}
}
}
function kt() {
var e = It(),
n = t.map(R, function (t, n) {
return c(t, e, 'sp-palette-row sp-palette-row-' + n, h);
});
wt(),
z &&
n.push(
c(
(function () {
var t = [];
if (h.showPalette)
for (var e = 0; e < z.length; e++) {
var n = S(z[e]).toRgbString();
j[n] || t.push(z[e]);
}
return t.reverse().slice(0, h.maxSelectionSize);
})(),
e,
'sp-palette-row sp-palette-row-selection',
h,
),
),
nt.html(n.join(''));
}
function St() {
if (h.showInitial) {
var t = gt,
e = It();
it.html(c([t, e], e, 'sp-palette-row-initial', h));
}
}
function Tt() {
(E <= 0 || T <= 0 || A <= 0) && Ht(),
(k = !0),
q.addClass(V),
($ = null),
W.trigger('dragstart.spectrum', [It()]);
}
function Et() {
(k = !1), q.removeClass(V), W.trigger('dragstop.spectrum', [It()]);
}
function Mt() {
var t = et.val();
if ((null !== t && '' !== t) || !bt) {
var e = S(t);
e.isValid() ? (Dt(e), zt(!0)) : et.addClass('sp-validation-error');
} else Dt(null), zt(!0);
}
function At() {
C ? Lt() : Ot();
}
function Ot() {
var e = t.Event('beforeShow.spectrum');
if (C) Ht();
else if ((W.trigger(e, [It()]), !1 !== x.beforeShow(It()) && !e.isDefaultPrevented())) {
!(function () {
for (var t = 0; t < r.length; t++) r[t] && r[t].hide();
})(),
(C = !0);
var n = t(B);
n.bind('keydown.spectrum', Pt),
n.bind('click.spectrum', _t),
t(window).bind('resize.spectrum', w),
ht.addClass('sp-active'),
q.removeClass('sp-hidden'),
Ht(),
Rt(),
(gt = It()),
St(),
x.show(gt),
W.trigger('show.spectrum', [gt]);
}
}
function Pt(t) {
27 === t.keyCode && Lt();
}
function _t(t) {
2 != t.button && (k || (mt ? zt(!0) : Nt(), Lt()));
}
function Lt() {
C &&
!v &&
((C = !1),
t(B).unbind('keydown.spectrum', Pt),
t(B).unbind('click.spectrum', _t),
t(window).unbind('resize.spectrum', w),
ht.removeClass('sp-active'),
q.addClass('sp-hidden'),
x.hide(It()),
W.trigger('hide.spectrum', [It()]));
}
function Nt() {
Dt(gt, !0);
}
function Dt(t, e) {
var n, i;
S.equals(t, It())
? Rt()
: (!t && bt
? (yt = !0)
: ((yt = !1), (i = (n = S(t)).toHsv()), (L = (i.h % 360) / 360), (N = i.s), (D = i.v), (I = i.a)),
Rt(),
n && n.isValid() && !e && (vt = h.preferredFormat || n.getFormat()));
}
function It(t) {
return (
(t = t || {}),
bt && yt
? null
: S.fromRatio({ h: L, s: N, v: D, a: Math.round(100 * I) / 100 }, { format: t.format || vt })
);
}
function Ft() {
Rt(), x.move(It()), W.trigger('move.spectrum', [It()]);
}
function Rt() {
et.removeClass('sp-validation-error'), jt();
var t = S.fromRatio({ h: L, s: 1, v: 1 });
G.css('background-color', t.toHexString());
var e = vt;
I < 1 &&
(0 !== I || 'name' !== e) &&
(('hex' !== e && 'hex3' !== e && 'hex6' !== e && 'name' !== e) || (e = 'rgb'));
var n = It({ format: e }),
i = '';
if ((ft.removeClass('sp-clear-display'), ft.css('background-color', 'transparent'), !n && bt))
ft.addClass('sp-clear-display');
else {
var r = n.toHexString(),
a = n.toRgbString();
if (
(s || 1 === n.alpha
? ft.css('background-color', a)
: (ft.css('background-color', 'transparent'), ft.css('filter', n.toFilter())),
h.showAlpha)
) {
var l = n.toRgb();
l.a = 0;
var c = S(l).toRgbString(),
u = 'linear-gradient(left, ' + c + ', ' + r + ')';
o
? Z.css('filter', S(c).toFilter({ gradientType: 1 }, r))
: (Z.css('background', '-webkit-' + u),
Z.css('background', '-moz-' + u),
Z.css('background', '-ms-' + u),
Z.css('background', 'linear-gradient(to right, ' + c + ', ' + r + ')'));
}
i = n.toString(e);
}
h.showInput && et.val(i), h.showPalette && kt(), St();
}
function jt() {
var t = N,
e = D;
if (bt && yt) tt.hide(), J.hide(), Y.hide();
else {
tt.show(), J.show(), Y.show();
var n = t * T,
i = E - e * E;
(n = Math.max(-M, Math.min(T - M, n - M))),
(i = Math.max(-M, Math.min(E - M, i - M))),
Y.css({ top: i + 'px', left: n + 'px' });
var r = I * O;
tt.css({ left: r - P / 2 + 'px' });
var o = L * A;
J.css({ top: o - _ + 'px' });
}
}
function zt(t) {
var e = It(),
n = '',
i = !S.equals(e, gt);
e && ((n = e.toString(vt)), Ct(e)), lt && W.val(n), t && i && (x.change(e), W.trigger('change', [e]));
}
function Ht() {
C &&
((T = G.width()),
(E = G.height()),
(M = Y.height()),
X.width(),
(A = X.height()),
(_ = J.height()),
(O = Q.width()),
(P = tt.width()),
v ||
(q.css('position', 'absolute'),
h.offset
? q.offset(h.offset)
: q.offset(
(function (e, n) {
var i = e.outerWidth(),
r = e.outerHeight(),
o = n.outerHeight(),
s = e[0].ownerDocument,
a = s.documentElement,
l = a.clientWidth,
c = a.clientHeight,
u = t(s).scrollLeft(),
h = t(s).scrollTop(),
d = l + u,
f = c + h,
p = n.offset();
return (
(p.top += o),
(p.left -= Math.min(p.left, p.left + i > d && d > i ? Math.abs(p.left + i - d) : 0)),
(p.top -= Math.min(p.top, p.top + r > f && f > r ? Math.abs(r + o - 0) : 0)),
p
);
})(q, dt),
)),
jt(),
h.showPalette && kt(),
W.trigger('reflow.spectrum'));
}
function Vt() {
Lt(), (U = !0), W.attr('disabled', !0), dt.addClass('sp-disabled');
}
!(function () {
if (
(o && q.find('*:not(input)').attr('unselectable', 'on'),
xt(),
ut && W.after(ht).hide(),
bt || ot.hide(),
v)
)
W.after(q).hide();
else {
var e = 'parent' === h.appendTo ? W.parent() : t(h.appendTo);
1 !== e.length && (e = t('body')), e.append(q);
}
function n(e) {
return (
e.data && e.data.ignore
? (Dt(t(e.target).closest('.sp-thumb-el').data('color')), Ft())
: (Dt(t(e.target).closest('.sp-thumb-el').data('color')),
Ft(),
zt(!0),
h.hideAfterPaletteSelect && Lt()),
!1
);
}
wt(),
dt.bind('click.spectrum touchstart.spectrum', function (e) {
U || At(), e.stopPropagation(), t(e.target).is('input') || e.preventDefault();
}),
(W.is(':disabled') || !0 === h.disabled) && Vt(),
q.click(d),
et.change(Mt),
et.bind('paste', function () {
setTimeout(Mt, 1);
}),
et.keydown(function (t) {
13 == t.keyCode && Mt();
}),
rt.text(h.cancelText),
rt.bind('click.spectrum', function (t) {
t.stopPropagation(), t.preventDefault(), Nt(), Lt();
}),
ot.attr('title', h.clearText),
ot.bind('click.spectrum', function (t) {
t.stopPropagation(), t.preventDefault(), (yt = !0), Ft(), v && zt(!0);
}),
st.text(h.chooseText),
st.bind('click.spectrum', function (t) {
t.stopPropagation(),
t.preventDefault(),
o && et.is(':focus') && et.trigger('change'),
et.hasClass('sp-validation-error') || (zt(!0), Lt());
}),
at.text(h.showPaletteOnly ? h.togglePaletteMoreText : h.togglePaletteLessText),
at.bind('click.spectrum', function (t) {
t.stopPropagation(),
t.preventDefault(),
(h.showPaletteOnly = !h.showPaletteOnly),
h.showPaletteOnly || v || q.css('left', '-=' + (K.outerWidth(!0) + 5)),
xt();
}),
p(
Q,
function (t, e, n) {
(I = t / O), (yt = !1), n.shiftKey && (I = Math.round(10 * I) / 10), Ft();
},
Tt,
Et,
),
p(
X,
function (t, e) {
(L = parseFloat(e / A)), (yt = !1), h.showAlpha || (I = 1), Ft();
},
Tt,
Et,
),
p(
G,
function (t, e, n) {
if (n.shiftKey) {
if (!$) {
var i = N * T,
r = E - D * E,
o = Math.abs(t - i) > Math.abs(e - r);
$ = o ? 'x' : 'y';
}
} else $ = null;
var s = !$ || 'y' === $;
(!$ || 'x' === $) && (N = parseFloat(t / T)),
s && (D = parseFloat((E - e) / E)),
(yt = !1),
h.showAlpha || (I = 1),
Ft();
},
Tt,
Et,
),
pt ? (Dt(pt), Rt(), (vt = h.preferredFormat || S(pt).format), Ct(pt)) : Rt(),
v && Ot();
var i = o ? 'mousedown.spectrum' : 'click.spectrum touchstart.spectrum';
nt.delegate('.sp-thumb-el', i, n), it.delegate('.sp-thumb-el:nth-child(1)', i, { ignore: !0 }, n);
})();
var $t = {
show: Ot,
hide: Lt,
toggle: At,
reflow: Ht,
option: function (n, i) {
return n === e
? t.extend({}, h)
: i === e
? h[n]
: ((h[n] = i), 'preferredFormat' === n && (vt = h.preferredFormat), void xt());
},
enable: function () {
(U = !1), W.attr('disabled', !1), dt.removeClass('sp-disabled');
},
disable: Vt,
offset: function (t) {
(h.offset = t), Ht();
},
set: function (t) {
Dt(t), zt();
},
get: It,
destroy: function () {
W.show(), dt.unbind('click.spectrum touchstart.spectrum'), q.remove(), ht.remove(), (r[$t.id] = null);
},
container: q,
};
return ($t.id = r.push($t) - 1), $t;
}
function h() {}
function d(t) {
t.stopPropagation();
}
function f(t, e) {
var n = Array.prototype.slice,
i = n.call(arguments, 2);
return function () {
return t.apply(e, i.concat(n.call(arguments)));
};
}
function p(e, n, i, r) {
(n = n || function () {}), (i = i || function () {}), (r = r || function () {});
var s = document,
a = !1,
l = {},
c = 0,
u = 0,
h = 'ontouchstart' in window,
d = {};
function f(t) {
t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault(), (t.returnValue = !1);
}
function p(t) {
if (a) {
if (o && s.documentMode < 9 && !t.button) return g();
var i = t.originalEvent && t.originalEvent.touches && t.originalEvent.touches[0],
r = (i && i.pageX) || t.pageX,
d = (i && i.pageY) || t.pageY,
p = Math.max(0, Math.min(r - l.left, u)),
v = Math.max(0, Math.min(d - l.top, c));
h && f(t), n.apply(e, [p, v, t]);
}
}
function g() {
a &&
(t(s).unbind(d),
t(s.body).removeClass('sp-dragging'),
setTimeout(function () {
r.apply(e, arguments);
}, 0)),
(a = !1);
}
(d.selectstart = f),
(d.dragstart = f),
(d['touchmove mousemove'] = p),
(d['touchend mouseup'] = g),
t(e).bind('touchstart mousedown', function (n) {
(n.which ? 3 == n.which : 2 == n.button) ||
a ||
(!1 !== i.apply(e, arguments) &&
((a = !0),
(c = t(e).height()),
(u = t(e).width()),
(l = t(e).offset()),
t(s).bind(d),
t(s.body).addClass('sp-dragging'),
p(n),
f(n)));
});
}
function g() {
return t.fn.spectrum.inputTypeColorSupport();
}
(t.fn.spectrum = function (e, n) {
if ('string' == typeof e) {
var i = this,
o = Array.prototype.slice.call(arguments, 1);
return (
this.each(function () {
var n = r[t(this).data('spectrum.id')];
if (n) {
var s = n[e];
if (!s) 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, o))
: 'destroy' == e
? (n.destroy(), t(this).removeData('spectrum.id'))
: s.apply(n, o);
}
}),
i
);
}
return this.spectrum('destroy').each(function () {
var n = u(this, t.extend({}, e, t(this).data()));
t(this).data('spectrum.id', n.id);
});
}),
(t.fn.spectrum.load = !0),
(t.fn.spectrum.loadOpts = {}),
(t.fn.spectrum.draggable = p),
(t.fn.spectrum.defaults = n),
(t.fn.spectrum.inputTypeColorSupport = function e() {
if (void 0 === e._cachedResult) {
var n = t("<input type='color'/>")[0];
e._cachedResult = 'color' === n.type && '' !== n.value;
}
return e._cachedResult;
}),
(t.spectrum = {}),
(t.spectrum.localization = {}),
(t.spectrum.palettes = {}),
(t.fn.spectrum.processNativeColorInputs = function () {
var e = t('input[type=color]');
e.length && !g() && e.spectrum({ preferredFormat: 'hex6' });
});
var v = /^[\s,#]+/,
m = /\s+$/,
y = 0,
b = Math,
x = b.round,
w = b.min,
C = b.max,
k = b.random,
S = function t(e, n) {
if (((e = e || ''), (n = n || {}), e instanceof t)) return e;
if (!(this instanceof t)) return new t(e, n);
var r = (function (t) {
var e = { r: 0, g: 0, b: 0 },
n = 1,
r = !1,
o = !1;
'string' == typeof t &&
(t = (function (t) {
t = t.replace(v, '').replace(m, '').toLowerCase();
var e,
n = !1;
if ($[t]) (t = $[t]), (n = !0);
else if ('transparent' == t) return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
if ((e = X.rgb.exec(t))) return { r: e[1], g: e[2], b: e[3] };
if ((e = X.rgba.exec(t))) return { r: e[1], g: e[2], b: e[3], a: e[4] };
if ((e = X.hsl.exec(t))) return { h: e[1], s: e[2], l: e[3] };
if ((e = X.hsla.exec(t))) return { h: e[1], s: e[2], l: e[3], a: e[4] };
if ((e = X.hsv.exec(t))) return { h: e[1], s: e[2], v: e[3] };
if ((e = X.hsva.exec(t))) return { h: e[1], s: e[2], v: e[3], a: e[4] };
if ((e = X.hex8.exec(t)))
return {
a: (function (t) {
return K(t) / 255;
})(e[1]),
r: K(e[2]),
g: K(e[3]),
b: K(e[4]),
format: n ? 'name' : 'hex8',
};
if ((e = X.hex6.exec(t))) return { r: K(e[1]), g: K(e[2]), b: K(e[3]), format: n ? 'name' : 'hex' };
if ((e = X.hex3.exec(t)))
return {
r: K(e[1] + '' + e[1]),
g: K(e[2] + '' + e[2]),
b: K(e[3] + '' + e[3]),
format: n ? 'name' : 'hex',
};
return !1;
})(t));
'object' == (void 0 === t ? 'undefined' : i(t)) &&
(t.hasOwnProperty('r') && t.hasOwnProperty('g') && t.hasOwnProperty('b')
? ((e = (function (t, e, n) {
return { r: 255 * U(t, 255), g: 255 * U(e, 255), b: 255 * U(n, 255) };
})(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 = Y(t.s)),
(t.v = Y(t.v)),
(e = (function (t, e, n) {
(t = 6 * U(t, 360)), (e = U(e, 100)), (n = U(n, 100));
var i = b.floor(t),
r = t - i,
o = n * (1 - e),
s = n * (1 - r * e),
a = n * (1 - (1 - r) * e),
l = i % 6;
return {
r: 255 * [n, s, o, o, a, n][l],
g: 255 * [a, n, n, s, o, o][l],
b: 255 * [o, o, a, n, n, s][l],
};
})(t.h, t.s, t.v)),
(r = !0),
(o = 'hsv'))
: t.hasOwnProperty('h') &&
t.hasOwnProperty('s') &&
t.hasOwnProperty('l') &&
((t.s = Y(t.s)),
(t.l = Y(t.l)),
(e = (function (t, e, n) {
var i, r, o;
function s(t, e, n) {
return (
n < 0 && (n += 1),
n > 1 && (n -= 1),
n < 1 / 6
? t + 6 * (e - t) * n
: n < 0.5
? e
: n < 2 / 3
? t + (e - t) * (2 / 3 - n) * 6
: t
);
}
if (((t = U(t, 360)), (e = U(e, 100)), (n = U(n, 100)), 0 === e)) i = r = o = n;
else {
var a = n < 0.5 ? n * (1 + e) : n + e - n * e,
l = 2 * n - a;
(i = s(l, a, t + 1 / 3)), (r = s(l, a, t)), (o = s(l, a, t - 1 / 3));
}
return { r: 255 * i, g: 255 * r, b: 255 * o };
})(t.h, t.s, t.l)),
(r = !0),
(o = 'hsl')),
t.hasOwnProperty('a') && (n = t.a));
return (
(n = W(n)),
{ ok: r, format: t.format || o, r: w(255, C(e.r, 0)), g: w(255, C(e.g, 0)), b: w(255, C(e.b, 0)), a: n }
);
})(e);
(this._originalInput = e),
(this._r = r.r),
(this._g = r.g),
(this._b = r.b),
(this._a = r.a),
(this._roundA = x(100 * this._a) / 100),
(this._format = n.format || r.format),
(this._gradientType = n.gradientType),
this._r < 1 && (this._r = x(this._r)),
this._g < 1 && (this._g = x(this._g)),
this._b < 1 && (this._b = x(this._b)),
(this._ok = r.ok),
(this._tc_id = y++);
};
function T(t, e, n) {
(t = U(t, 255)), (e = U(e, 255)), (n = U(n, 255));
var i,
r,
o = C(t, e, n),
s = w(t, e, n),
a = (o + s) / 2;
if (o == s) i = r = 0;
else {
var l = o - s;
switch (((r = a > 0.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 E(t, e, n) {
(t = U(t, 255)), (e = U(e, 255)), (n = U(n, 255));
var i,
r,
o = C(t, e, n),
s = w(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 M(t, e, n, i) {
var r = [G(x(t).toString(16)), G(x(e).toString(16)), G(x(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 A(t, e, n, i) {
return [
G(
(function (t) {
return Math.round(255 * parseFloat(t)).toString(16);
})(i),
),
G(x(t).toString(16)),
G(x(e).toString(16)),
G(x(n).toString(16)),
].join('');
}
function O(t, e) {
e = 0 === e ? 0 : e || 10;
var n = S(t).toHsl();
return (n.s -= e / 100), (n.s = q(n.s)), S(n);
}
function P(t, e) {
e = 0 === e ? 0 : e || 10;
var n = S(t).toHsl();
return (n.s += e / 100), (n.s = q(n.s)), S(n);
}
function _(t) {
return S(t).desaturate(100);
}
function L(t, e) {
e = 0 === e ? 0 : e || 10;
var n = S(t).toHsl();
return (n.l += e / 100), (n.l = q(n.l)), S(n);
}
function N(t, e) {
e = 0 === e ? 0 : e || 10;
var n = S(t).toRgb();
return (
(n.r = C(0, w(255, n.r - x((-e / 100) * 255)))),
(n.g = C(0, w(255, n.g - x((-e / 100) * 255)))),
(n.b = C(0, w(255, n.b - x((-e / 100) * 255)))),
S(n)
);
}
function D(t, e) {
e = 0 === e ? 0 : e || 10;
var n = S(t).toHsl();
return (n.l -= e / 100), (n.l = q(n.l)), S(n);
}
function I(t, e) {
var n = S(t).toHsl(),
i = (x(n.h) + e) % 360;
return (n.h = i < 0 ? 360 + i : i), S(n);
}
function F(t) {
var e = S(t).toHsl();
return (e.h = (e.h + 180) % 360), S(e);
}
function R(t) {
var e = S(t).toHsl(),
n = e.h;
return [S(t), S({ h: (n + 120) % 360, s: e.s, l: e.l }), S({ h: (n + 240) % 360, s: e.s, l: e.l })];
}
function j(t) {
var e = S(t).toHsl(),
n = e.h;
return [
S(t),
S({ h: (n + 90) % 360, s: e.s, l: e.l }),
S({ h: (n + 180) % 360, s: e.s, l: e.l }),
S({ h: (n + 270) % 360, s: e.s, l: e.l }),
];
}
function z(t) {
var e = S(t).toHsl(),
n = e.h;
return [S(t), S({ h: (n + 72) % 360, s: e.s, l: e.l }), S({ h: (n + 216) % 360, s: e.s, l: e.l })];
}
function H(t, e, n) {
(e = e || 6), (n = n || 30);
var i = S(t).toHsl(),
r = 360 / n,
o = [S(t)];
for (i.h = (i.h - ((r * e) >> 1) + 720) % 360; --e; ) (i.h = (i.h + r) % 360), o.push(S(i));
return o;
}
function V(t, e) {
e = e || 6;
for (var n = S(t).toHsv(), i = n.h, r = n.s, o = n.v, s = [], a = 1 / e; e--; )
s.push(S({ h: i, s: r, v: o })), (o = (o + a) % 1);
return s;
}
(S.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 = W(t)), (this._roundA = x(100 * this._a) / 100), this;
},
toHsv: function () {
var t = E(this._r, this._g, this._b);
return { h: 360 * t.h, s: t.s, v: t.v, a: this._a };
},
toHsvString: function () {
var t = E(this._r, this._g, this._b),
e = x(360 * t.h),
n = x(100 * t.s),
i = x(100 * t.v);
return 1 == this._a
? 'hsv(' + e + ', ' + n + '%, ' + i + '%)'
: 'hsva(' + e + ', ' + n + '%, ' + i + '%, ' + this._roundA + ')';
},
toHsl: function () {
var t = T(this._r, this._g, this._b);
return { h: 360 * t.h, s: t.s, l: t.l, a: this._a };
},
toHslString: function () {
var t = T(this._r, this._g, this._b),
e = x(360 * t.h),
n = x(100 * t.s),
i = x(100 * t.l);
return 1 == this._a
? 'hsl(' + e + ', ' + n + '%, ' + i + '%)'
: 'hsla(' + e + ', ' + n + '%, ' + i + '%, ' + this._roundA + ')';
},
toHex: function (t) {
return M(this._r, this._g, this._b, t);
},
toHexString: function (t) {
return '#' + this.toHex(t);
},
toHex8: function () {
return A(this._r, this._g, this._b, this._a);
},
toHex8String: function () {
return '#' + this.toHex8();
},
toRgb: function () {
return { r: x(this._r), g: x(this._g), b: x(this._b), a: this._a };
},
toRgbString: function () {
return 1 == this._a
? 'rgb(' + x(this._r) + ', ' + x(this._g) + ', ' + x(this._b) + ')'
: 'rgba(' + x(this._r) + ', ' + x(this._g) + ', ' + x(this._b) + ', ' + this._roundA + ')';
},
toPercentageRgb: function () {
return {
r: x(100 * U(this._r, 255)) + '%',
g: x(100 * U(this._g, 255)) + '%',
b: x(100 * U(this._b, 255)) + '%',
a: this._a,
};
},
toPercentageRgbString: function () {
return 1 == this._a
? 'rgb(' +
x(100 * U(this._r, 255)) +
'%, ' +
x(100 * U(this._g, 255)) +
'%, ' +
x(100 * U(this._b, 255)) +
'%)'
: 'rgba(' +
x(100 * U(this._r, 255)) +
'%, ' +
x(100 * U(this._g, 255)) +
'%, ' +
x(100 * U(this._b, 255)) +
'%, ' +
this._roundA +
')';
},
toName: function () {
return 0 === this._a ? 'transparent' : !(this._a < 1) && (B[M(this._r, this._g, this._b, !0)] || !1);
},
toFilter: function (t) {
var e = '#' + A(this._r, this._g, this._b, this._a),
n = e,
i = this._gradientType ? 'GradientType = 1, ' : '';
t && (n = S(t).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;
return e || !i || ('hex' !== t && 'hex6' !== t && 'hex3' !== t && 'name' !== t)
? ('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())
: 'name' === t && 0 === this._a
? this.toName()
: this.toRgbString();
},
_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(L, arguments);
},
brighten: function () {
return this._applyModification(N, arguments);
},
darken: function () {
return this._applyModification(D, arguments);
},
desaturate: function () {
return this._applyModification(O, arguments);
},
saturate: function () {
return this._applyModification(P, arguments);
},
greyscale: function () {
return this._applyModification(_, arguments);
},
spin: function () {
return this._applyModification(I, arguments);
},
_applyCombination: function (t, e) {
return t.apply(null, [this].concat([].slice.call(e)));
},
analogous: function () {
return this._applyCombination(H, arguments);
},
complement: function () {
return this._applyCombination(F, arguments);
},
monochromatic: function () {
return this._applyCombination(V, arguments);
},
splitcomplement: function () {
return this._applyCombination(z, arguments);
},
triad: function () {
return this._applyCombination(R, arguments);
},
tetrad: function () {
return this._applyCombination(j, arguments);
},
}),
(S.fromRatio = function (t, e) {
if ('object' == (void 0 === t ? 'undefined' : i(t))) {
var n = {};
for (var r in t) t.hasOwnProperty(r) && (n[r] = 'a' === r ? t[r] : Y(t[r]));
t = n;
}
return S(t, e);
}),
(S.equals = function (t, e) {
return !(!t || !e) && S(t).toRgbString() == S(e).toRgbString();
}),
(S.random = function () {
return S.fromRatio({ r: k(), g: k(), b: k() });
}),
(S.mix = function (t, e, n) {
n = 0 === n ? 0 : n || 50;
var i,
r = S(t).toRgb(),
o = S(e).toRgb(),
s = n / 100,
a = 2 * s - 1,
l = o.a - r.a,
c = 1 - (i = ((i = a * l == -1 ? a : (a + l) / (1 + a * l)) + 1) / 2),
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 S(u);
}),
(S.readability = function (t, e) {
var n = S(t),
i = S(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 };
}),
(S.isReadable = function (t, e) {
var n = S.readability(t, e);
return n.brightness > 125 && n.color > 500;
}),
(S.mostReadable = function (t, e) {
for (var n = null, i = 0, r = !1, o = 0; o < e.length; o++) {
var s = S.readability(t, e[o]),
a = s.brightness > 125 && s.color > 500,
l = (s.brightness / 125) * 3 + s.color / 500;
((a && !r) || (a && r && l > i) || (!a && !r && l > i)) && ((r = a), (i = l), (n = S(e[o])));
}
return n;
});
var $ = (S.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',
}),
B = (S.hexNames = (function (t) {
var e = {};
for (var n in t) t.hasOwnProperty(n) && (e[t[n]] = n);
return e;
})($));
function W(t) {
return (t = parseFloat(t)), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
}
function U(t, e) {
(function (t) {
return 'string' == typeof t && -1 != t.indexOf('.') && 1 === parseFloat(t);
})(t) && (t = '100%');
var n = (function (t) {
return 'string' == typeof t && -1 != t.indexOf('%');
})(t);
return (
(t = w(e, C(0, parseFloat(t)))),
n && (t = parseInt(t * e, 10) / 100),
b.abs(t - e) < 1e-6 ? 1 : (t % e) / parseFloat(e)
);
}
function q(t) {
return w(1, C(0, t));
}
function K(t) {
return parseInt(t, 16);
}
function G(t) {
return 1 == t.length ? '0' + t : '' + t;
}
function Y(t) {
return t <= 1 && (t = 100 * t + '%'), t;
}
var X = (function () {
var t = '(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)',
e = '[\\s|\\(]+(' + t + ')[,|\\s]+(' + t + ')[,|\\s]+(' + t + ')\\s*\\)?',
n = '[\\s|\\(]+(' + t + ')[,|\\s]+(' + t + ')[,|\\s]+(' + t + ')[,|\\s]+(' + t + ')\\s*\\)?';
return {
rgb: new RegExp('rgb' + e),
rgba: new RegExp('rgba' + n),
hsl: new RegExp('hsl' + e),
hsla: new RegExp('hsla' + n),
hsv: new RegExp('hsv' + e),
hsva: new RegExp('hsva' + n),
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 = S),
t(function () {
t.fn.spectrum.load && t.fn.spectrum.processNativeColorInputs();
});
};
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.Model.extend({
defaults: { index: '', value: '', values: {}, active: !1, preview: !1, properties: [] },
initialize: function () {
var t = n(18),
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(' ')
);
},
});
},
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 (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var o = n(170);
t.exports = r.default.Collection.extend({
model: o,
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 = [];
return (
t.replace(/\(([\w\s,.]*)\)/g, function (e) {
var n = e.replace(/,\s*/g, ',');
t = t.replace(e, n);
}),
(t ? t.split(', ') : []).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')];
(r ? r.split(', ') : []).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(', ')
);
},
});
},
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(75),
o = n(171);
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';
var i = n(1),
r = n(0),
o = n(18),
s = n(164);
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 = t || [];
if (e.length) return this.propFactory || (this.propFactory = new s()), this.propFactory.build(e);
},
});
},
function (t, e, n) {
'use strict';
var i = n(173);
t.exports = n(0).Collection.extend({ model: i });
},
function (t, e, n) {
'use strict';
t.exports = {
stylePrefix: 'sm-',
sectors: [],
appendTo: '',
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';
t.exports = {
stylePrefix: 'rte-',
adjustToolbar: 1,
actions: ['bold', 'italic', 'underline', 'strikethrough', 'link'],
};
},
function (t, e, n) {
'use strict';
Object.defineProperty(e, '__esModule', { value: !0 });
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 () {
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);
var s = '_rte',
a = {
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>');
},
},
},
l = (function () {
function t() {
var e = this,
n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
!(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function');
})(this, t);
var r = n.el;
if (r[s]) return r[s];
(r[s] = this), this.setEl(r), (this.updateActiveActions = this.updateActiveActions.bind(this));
var o = n.actions || [];
o.forEach(function (t, e) {
'string' == typeof t ? (t = a[t]) : a[t.name] && (t = i({}, a[t.name], t)), (o[e] = t);
});
var l = o.length
? o
: Object.keys(a).map(function (t) {
return a[t];
});
n.classes = i({ actionbar: 'actionbar', button: 'action', active: 'active' }, n.classes);
var c = n.classes,
u = n.actionbar;
if (((this.actionbar = u), (this.settings = n), (this.classes = c), (this.actions = l), !u)) {
var h = n.actionbarContainer;
((u = document.createElement('div')).className = c.actionbar),
h.appendChild(u),
(this.actionbar = u),
l.forEach(function (t) {
return e.addAction(t);
});
}
return n.styleWithCSS && this.exec('styleWithCSS'), this.syncActions(), this;
}
return (
r(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.queryCommandSupported(o) && 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, o.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, o.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] : {}).sync,
n = document.createElement('span'),
i = t.icon,
r = t.attributes || {};
for (var o in ((n.className = this.classes.button), (t.btn = n), r)) n.setAttribute(o, r[o]);
'string' == typeof i ? (n.innerHTML = i) : n.appendChild(i),
this.actionbarEl().appendChild(n),
e && (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 = this.doc,
n = e.getSelection();
if (n && n.rangeCount) {
var i = e.createElement('div'),
r = n.getRangeAt(0);
r.deleteContents(),
(i.innerHTML = t),
Array.prototype.slice.call(i.childNodes).forEach(function (t) {
r.insertNode(t), t;
}),
n.removeAllRanges(),
n.addRange(r),
this.el.focus();
}
},
},
]),
t
);
})();
e.default = l;
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(177)),
r = n(2);
t.exports = function () {
var t = {},
e = n(176),
o = void 0,
s = void 0,
a = void 0,
l = function () {
var t = o.style;
(t.top = '-100px'), (t.left = '-100px'), (t.display = 'none');
};
return {
customRte: null,
name: 'RichTextEditor',
init: function () {
var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
for (var i in ((t = n), e)) i in t || (t[i] = e[i]);
var s = t.pStylePrefix;
return (
s && (t.stylePrefix = s + t.stylePrefix),
(this.pfx = t.stylePrefix),
t.actions || [],
((o = document.createElement('div')).className = s + 'rte-toolbar ' + s + 'one-bg'),
(a = this.initRte(document.createElement('div'))),
(0, r.on)(o, 'mousedown', function (t) {
return t.stopPropagation();
}),
this
);
},
postRender: function (t) {
var e = t.model.get('Canvas');
(o.style.pointerEvents = 'all'), l(), e.getToolsEl().appendChild(o);
},
initRte: function (e) {
var n = this.pfx,
r = o,
s = this.actionbar,
l = this.actions || t.actions,
c = { actionbar: n + 'actionbar', button: n + 'action', active: n + 'active' },
u = new i.default({ el: e, classes: c, actions: l, actionbar: s, actionbarContainer: r });
return (
a && a.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), a.addAction(e, { sync: 1 });
},
get: function (t) {
var e = void 0;
return (
a.getActions().forEach(function (n) {
n.name == t && (e = n);
}),
e
);
},
getAll: function () {
return a.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 o;
},
udpatePosition: function () {
var e = t.em.get('Canvas').getTargetToElementDim(o, s, { event: 'rteToolbarPosUpdate' });
if (e) {
t.adjustToolbar && e.top <= e.canvasTop && (e.top = e.elementTop + e.elementHeight);
var n = o.style;
(n.top = e.top + 'px'), (n.left = e.left + 'px');
}
},
enable: function (e, n) {
s = e.el;
var i = t.em,
r = e.getChildrenContainer(),
a = this.customRte;
if (((o.style.display = ''), (n = a ? a.enable(r, n) : this.initRte(r).enable()), i)) {
setTimeout(this.udpatePosition.bind(this), 0);
var l = 'change:canvasOffset canvasScroll';
i.off(l, this.udpatePosition, this), i.on(l, this.udpatePosition, this), i.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(), l(), i && i.trigger('rte:disable', e, n);
},
};
};
},
function (t, e, n) {
'use strict';
var i = n(0),
r = n(78);
t.exports = i.View.extend({
initialize: function (t) {
(this.opt = t || {}), (this.config = this.opt.config || {}), (this.pfx = this.config.stylePrefix || '');
var e = this.collection;
this.listenTo(e, 'add', this.addTo),
this.listenTo(e, 'reset', this.render),
this.listenTo(e, 'remove', this.onRemove),
(this.className = this.pfx + 'panels');
},
onRemove: function (t) {
var e = t.view;
e && e.remove();
},
addTo: function (t) {
this.addToCollection(t);
},
addToCollection: function (t, e) {
var n = e || null,
i = this.config,
o = t.get('el'),
s = new r({ el: o, model: t, config: i }),
a = s.render().el,
l = t.get('appendTo');
if (o);
else if (l) {
document.querySelector(l).appendChild(a);
} else n ? n.appendChild(a) : this.$el.append(a);
return s.initResize(), a;
},
render: function () {
var t = this,
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';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
r = n(1);
i.default.$;
t.exports = i.default.View.extend({
tagName: 'span',
events: { click: 'clicked' },
initialize: function (t) {
var e = this.model.get('className');
(this.config = t.config || {}), (this.em = this.config.em || {});
var n = this.config.stylePrefix || '',
i = this.config.pStylePrefix || '';
(this.pfx = n),
(this.ppfx = this.config.pStylePrefix || ''),
(this.id = n + this.model.get('id')),
(this.activeCls = n + 'active ' + i + 'four-color'),
(this.disableCls = n + 'active'),
(this.btnsVisCls = n + 'visible'),
(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.em && this.em.get && (this.commands = this.em.get('Commands'));
},
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));
},
updateActive: function () {
var t = this.model,
e = t.get('context'),
n = {},
i = this.em && this.em.get ? this.em.get('Editor') : null,
o = t.get('command');
this.commands && (0, r.isString)(o)
? (n = this.commands.get(o) || {})
: (0, r.isFunction)(o)
? (n = { run: o })
: null !== o && (0, r.isObject)(o) && (n = o),
t.get('active')
? (t.collection.deactivateAll(e),
t.set('active', !0, { silent: !0 }).trigger('checkActive'),
n.run && (n.run(i, t, t.get('options')), i.trigger('run:' + o)),
!n.stop && t.set('active', !1))
: (this.$el.removeClass(this.activeCls),
t.collection.deactivateAll(e),
n.stop && (n.stop(i, t, t.get('options')), i.trigger('stop:' + o)));
},
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 () {
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();
},
render: function () {
var t = this.model.get('label'),
e = this.$el;
return this.updateAttributes(), e.attr('class', this.className), t && e.append(t), this;
},
});
},
function (t, e, n) {
'use strict';
(function (e) {
var i = n(0),
r = n(180);
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 remove', this.render),
(this.className = this.pfx + 'buttons');
},
addTo: function (t) {
this.addToCollection(t);
},
addToCollection: function (t, e) {
var n = e || null,
i = new r({ model: t, config: this.config, parentM: this.parentM }).render().el;
return n ? n.appendChild(i) : this.$el.append(i), i;
},
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(this, n(1));
},
function (t, e, n) {
'use strict';
var i = n(0),
r = n(80);
t.exports = i.Collection.extend({ model: r });
},
function (t, e, n) {
'use strict';
var i = n(0);
t.exports = i.Model.extend({
defaults: {
id: '',
label: '',
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(79);
this.set('buttons', new e(this.get('buttons')));
}
},
});
},
function (t, e, n) {
'use strict';
var i = 'sw-visibility',
r = 'export-template',
o = 'open-layers',
s = 'open-blocks',
a = 'fullscreen',
l = '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: l, className: 'fa fa-eye', command: l, context: l, attributes: { title: 'Preview' } },
{ id: a, className: 'fa fa-arrows-alt', command: a, context: a, attributes: { title: 'Fullscreen' } },
{ id: r, className: 'fa fa-code', command: r, attributes: { title: 'View code' } },
],
},
{
id: 'views',
buttons: [
{
id: 'open-sm',
className: 'fa fa-paint-brush',
command: 'open-sm',
active: !0,
attributes: { title: 'Open Style Manager' },
},
{ id: 'open-tm', className: 'fa fa-cog', command: 'open-tm', attributes: { title: 'Settings' } },
{ id: o, className: 'fa fa-bars', command: o, attributes: { title: 'Open Layer Manager' } },
{ id: s, className: 'fa fa-th-large', command: s, attributes: { title: 'Open Blocks' } },
],
},
],
em: null,
delayBtnsShow: 300,
};
},
function (t, e, n) {
'use strict';
t.exports = function () {
var t,
e,
i = {},
r = n(184),
o = n(80),
s = n(182),
a = (n(78), n(179));
return {
name: 'Panels',
init: function (n) {
for (var o in ((i = n || {}), 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 = n(1),
r = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = r.default.View.extend({
template: (0, i.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
);
},
});
},
function (t, e, n) {
!(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: '\x3c!--',
commentEnd: '--\x3e',
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) {
var i = this,
r = i.getMode(),
o = i.getRange(e, n).split('\n'),
s = t.copyState(r, i.getTokenAt(e).state),
a = i.getOption('tabSize'),
l = '',
c = 0,
u = 0 === e.ch;
function h() {
(l += '\n'), (u = !0), ++c;
}
for (var d = 0; d < o.length; ++d) {
for (var f = new t.StringStream(o[d], a); !f.eol(); ) {
var p = t.innerMode(r, s),
g = r.token(f, s),
v = f.current();
(f.start = f.pos),
(u && !/\S/.test(v)) || ((l += v), (u = !1)),
!u &&
p.mode.newlineAfterToken &&
p.mode.newlineAfterToken(g, v, f.string.slice(f.pos) || o[d + 1] || '', p.state) &&
h();
}
!f.pos && r.blankLine && r.blankLine(s), !u && d < o.length - 1 && h();
}
i.operation(function () {
i.replaceRange(l, e, n);
for (var t = e.line + 1, r = e.line + c; t <= r; ++t) i.indentLine(t, 'smart');
i.setSelection(e, i.getCursor(!1));
});
});
})(n(6));
},
function (t, e, n) {
!(function (t) {
'use strict';
t.defineMode('javascript', function (e, n) {
var i,
r,
o = e.indentUnit,
s = n.statementIndent,
a = n.jsonld,
l = n.json || a,
c = n.typescript,
u = n.wordCharacters || /[\w$\xa1-\uffff]/,
h = (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' };
return {
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,
};
})(),
d = /[+\-*&%=<>!?|~^@]/,
f = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
function p(t, e, n) {
return (i = t), (r = n), e;
}
function g(t, e) {
var n = t.next();
if ('"' == n || "'" == n)
return (
(e.tokenize = (function (t) {
return function (e, n) {
var i,
r = !1;
if (a && '@' == e.peek() && e.match(f)) return (n.tokenize = g), p('jsonld-keyword', 'meta');
for (; null != (i = e.next()) && (i != t || r); ) r = !r && '\\' == i;
return r || (n.tokenize = g), p('string', 'string');
};
})(n)),
e.tokenize(t, e)
);
if ('.' == n && t.match(/^\d+(?:[eE][+\-]?\d+)?/)) return p('number', 'number');
if ('.' == n && t.match('..')) return p('spread', 'meta');
if (/[\[\]{}\(\),;\:\.]/.test(n)) return p(n);
if ('=' == n && t.eat('>')) return p('=>', 'operator');
if ('0' == n && t.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i)) return p('number', 'number');
if (/\d/.test(n)) return t.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/), p('number', 'number');
if ('/' == n)
return t.eat('*')
? ((e.tokenize = v), v(t, e))
: t.eat('/')
? (t.skipToEnd(), p('comment', 'comment'))
: qt(t, e, 1)
? ((function (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;
}
})(t),
t.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),
p('regexp', 'string-2'))
: (t.eat('='), p('operator', 'operator', t.current()));
if ('`' == n) return (e.tokenize = m), m(t, e);
if ('#' == n) return t.skipToEnd(), p('error', 'error');
if (d.test(n))
return (
('>' == n && e.lexical && '>' == e.lexical.type) ||
(t.eat('=')
? ('!' != n && '=' != n) || t.eat('=')
: /[<>*+\-]/.test(n) && (t.eat(n), '>' == n && t.eat(n))),
p('operator', 'operator', t.current())
);
if (u.test(n)) {
t.eatWhile(u);
var i = t.current();
if ('.' != e.lastType) {
if (h.propertyIsEnumerable(i)) {
var r = h[i];
return p(r.type, r.style, i);
}
if ('async' == i && t.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, !1)) return p('async', 'keyword', i);
}
return p('variable', 'variable', i);
}
}
function v(t, e) {
for (var n, i = !1; (n = t.next()); ) {
if ('/' == n && i) {
e.tokenize = g;
break;
}
i = '*' == n;
}
return p('comment', 'comment');
}
function m(t, e) {
for (var n, i = !1; null != (n = t.next()); ) {
if (!i && ('`' == n || ('$' == n && t.eat('{')))) {
e.tokenize = g;
break;
}
i = !i && '\\' == n;
}
return p('quasi', 'string-2', t.current());
}
var y = '([{}])';
function b(t, e) {
e.fatArrowAt && (e.fatArrowAt = null);
var n = t.string.indexOf('=>', t.start);
if (!(n < 0)) {
if (c) {
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 = y.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 (u.test(a)) o = !0;
else {
if (/["'\/]/.test(a)) return;
if (o && !r) {
++s;
break;
}
}
}
o && !r && (e.fatArrowAt = s);
}
}
var x = { atom: !0, number: !0, variable: !0, string: !0, regexp: !0, this: !0, 'jsonld-keyword': !0 };
function w(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 C(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;
}
var k = { state: null, column: null, marked: null, cc: null };
function S() {
for (var t = arguments.length - 1; t >= 0; t--) k.cc.push(arguments[t]);
}
function T() {
return S.apply(null, arguments), !0;
}
function E(t, e) {
for (var n = e; n; n = n.next) if (n.name == t) return !0;
return !1;
}
function M(t) {
var e = k.state;
if (((k.marked = 'def'), e.context))
if ('var' == e.lexical.info && e.context && e.context.block) {
var i = (function t(e, n) {
if (n) {
if (n.block) {
var i = t(e, n.prev);
return i ? (i == n.prev ? n : new O(i, n.vars, !0)) : null;
}
return E(e, n.vars) ? n : new O(n.prev, new P(e, n.vars), !1);
}
return null;
})(t, e.context);
if (null != i) return void (e.context = i);
} else if (!E(t, e.localVars)) return void (e.localVars = new P(t, e.localVars));
n.globalVars && !E(t, e.globalVars) && (e.globalVars = new P(t, e.globalVars));
}
function A(t) {
return 'public' == t || 'private' == t || 'protected' == t || 'abstract' == t || 'readonly' == t;
}
function O(t, e, n) {
(this.prev = t), (this.vars = e), (this.block = n);
}
function P(t, e) {
(this.name = t), (this.next = e);
}
var _ = new P('this', new P('arguments', null));
function L() {
(k.state.context = new O(k.state.context, k.state.localVars, !1)), (k.state.localVars = _);
}
function N() {
(k.state.context = new O(k.state.context, k.state.localVars, !0)), (k.state.localVars = null);
}
function D() {
(k.state.localVars = k.state.context.vars), (k.state.context = k.state.context.prev);
}
function I(t, e) {
var n = function () {
var n = k.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 w(i, k.stream.column(), t, null, n.lexical, e);
};
return (n.lex = !0), n;
}
function F() {
var t = k.state;
t.lexical.prev &&
(')' == t.lexical.type && (t.indented = t.lexical.indented), (t.lexical = t.lexical.prev));
}
function R(t) {
return function e(n) {
return n == t ? T() : ';' == t ? S() : T(e);
};
}
function j(t, e) {
return 'var' == t
? T(I('vardef', e), yt, R(';'), F)
: 'keyword a' == t
? T(I('form'), $, j, F)
: 'keyword b' == t
? T(I('form'), j, F)
: 'keyword d' == t
? k.stream.match(/^\s*$/, !1)
? T()
: T(I('stat'), W, R(';'), F)
: 'debugger' == t
? T(R(';'))
: '{' == t
? T(I('}'), N, st, F, D)
: ';' == t
? T()
: 'if' == t
? ('else' == k.state.lexical.info &&
k.state.cc[k.state.cc.length - 1] == F &&
k.state.cc.pop()(),
T(I('form'), $, j, F, kt))
: 'function' == t
? T(Ot)
: 'for' == t
? T(I('form'), St, j, F)
: 'class' == t || (c && 'interface' == e)
? ((k.marked = 'keyword'), T(I('form'), Lt, F))
: 'variable' == t
? c && 'declare' == e
? ((k.marked = 'keyword'), T(j))
: c &&
('module' == e || 'enum' == e || 'type' == e) &&
k.stream.match(/^\s*\w/, !1)
? ((k.marked = 'keyword'),
'enum' == e
? T(Wt)
: 'type' == e
? T(ut, R('operator'), ut, R(';'))
: T(I('form'), bt, R('{'), I('}'), st, F, F))
: c && 'namespace' == e
? ((k.marked = 'keyword'), T(I('form'), H, st, F))
: c && 'abstract' == e
? ((k.marked = 'keyword'), T(j))
: T(I('stat'), Q)
: 'switch' == t
? T(I('form'), $, R('{'), I('}', 'switch'), N, st, F, F, D)
: 'case' == t
? T(H, R(':'))
: 'default' == t
? T(R(':'))
: 'catch' == t
? T(I('form'), L, z, j, F, D)
: 'export' == t
? T(I('stat'), Ft, F)
: 'import' == t
? T(I('stat'), jt, F)
: 'async' == t
? T(j)
: '@' == e
? T(H, j)
: S(I('stat'), H, R(';'), F);
}
function z(t) {
if ('(' == t) return T(Pt, R(')'));
}
function H(t, e) {
return B(t, e, !1);
}
function V(t, e) {
return B(t, e, !0);
}
function $(t) {
return '(' != t ? S() : T(I(')'), H, R(')'), F);
}
function B(t, e, n) {
if (k.state.fatArrowAt == k.stream.start) {
var i = n ? X : Y;
if ('(' == t) return T(L, I(')'), rt(Pt, ')'), F, R('=>'), i, D);
if ('variable' == t) return S(L, bt, R('=>'), i, D);
}
var r = n ? q : U;
return x.hasOwnProperty(t)
? T(r)
: 'function' == t
? T(Ot, r)
: 'class' == t || (c && 'interface' == e)
? ((k.marked = 'keyword'), T(I('form'), _t, F))
: 'keyword c' == t || 'async' == t
? T(n ? V : H)
: '(' == t
? T(I(')'), W, R(')'), F, r)
: 'operator' == t || 'spread' == t
? T(n ? V : H)
: '[' == t
? T(I(']'), Bt, F, r)
: '{' == t
? ot(et, '}', null, r)
: 'quasi' == t
? S(K, r)
: 'new' == t
? T(
(function (t) {
return function (e) {
return '.' == e
? T(t ? Z : J)
: 'variable' == e && c
? T(gt, t ? q : U)
: S(t ? V : H);
};
})(n),
)
: 'import' == t
? T(H)
: T();
}
function W(t) {
return t.match(/[;\}\)\],]/) ? S() : S(H);
}
function U(t, e) {
return ',' == t ? T(H) : q(t, e, !1);
}
function q(t, e, n) {
var i = 0 == n ? U : q,
r = 0 == n ? H : V;
return '=>' == t
? T(L, n ? X : Y, D)
: 'operator' == t
? /\+\+|--/.test(e) || (c && '!' == e)
? T(i)
: c && '<' == e && k.stream.match(/^([^>]|<.*?>)*>\s*\(/, !1)
? T(I('>'), rt(ut, '>'), F, i)
: '?' == e
? T(H, R(':'), r)
: T(r)
: 'quasi' == t
? S(K, i)
: ';' != t
? '(' == t
? ot(V, ')', 'call', i)
: '.' == t
? T(tt, i)
: '[' == t
? T(I(']'), W, R(']'), F, i)
: c && 'as' == e
? ((k.marked = 'keyword'), T(ut, i))
: 'regexp' == t
? ((k.state.lastType = k.marked = 'operator'),
k.stream.backUp(k.stream.pos - k.stream.start - 1),
T(r))
: void 0
: void 0;
}
function K(t, e) {
return 'quasi' != t ? S() : '${' != e.slice(e.length - 2) ? T(K) : T(H, G);
}
function G(t) {
if ('}' == t) return (k.marked = 'string-2'), (k.state.tokenize = m), T(K);
}
function Y(t) {
return b(k.stream, k.state), S('{' == t ? j : H);
}
function X(t) {
return b(k.stream, k.state), S('{' == t ? j : V);
}
function J(t, e) {
if ('target' == e) return (k.marked = 'keyword'), T(U);
}
function Z(t, e) {
if ('target' == e) return (k.marked = 'keyword'), T(q);
}
function Q(t) {
return ':' == t ? T(F, j) : S(U, R(';'), F);
}
function tt(t) {
if ('variable' == t) return (k.marked = 'property'), T();
}
function et(t, e) {
if ('async' == t) return (k.marked = 'property'), T(et);
if ('variable' == t || 'keyword' == k.style) {
return (
(k.marked = 'property'),
'get' == e || 'set' == e
? T(nt)
: (c &&
k.state.fatArrowAt == k.stream.start &&
(n = k.stream.match(/^\s*:\s*/, !1)) &&
(k.state.fatArrowAt = k.stream.pos + n[0].length),
T(it))
);
var n;
} else {
if ('number' == t || 'string' == t) return (k.marked = a ? 'property' : k.style + ' property'), T(it);
if ('jsonld-keyword' == t) return T(it);
if (c && A(e)) return (k.marked = 'keyword'), T(et);
if ('[' == t) return T(H, at, R(']'), it);
if ('spread' == t) return T(V, it);
if ('*' == e) return (k.marked = 'keyword'), T(et);
if (':' == t) return S(it);
}
}
function nt(t) {
return 'variable' != t ? S(it) : ((k.marked = 'property'), T(Ot));
}
function it(t) {
return ':' == t ? T(V) : '(' == t ? S(Ot) : void 0;
}
function rt(t, e, n) {
function i(r, o) {
if (n ? n.indexOf(r) > -1 : ',' == r) {
var s = k.state.lexical;
return (
'call' == s.info && (s.pos = (s.pos || 0) + 1),
T(function (n, i) {
return n == e || i == e ? S() : S(t);
}, i)
);
}
return r == e || o == e ? T() : T(R(e));
}
return function (n, r) {
return n == e || r == e ? T() : S(t, i);
};
}
function ot(t, e, n) {
for (var i = 3; i < arguments.length; i++) k.cc.push(arguments[i]);
return T(I(e, n), rt(t, e), F);
}
function st(t) {
return '}' == t ? T() : S(j, st);
}
function at(t, e) {
if (c) {
if (':' == t) return T(ut);
if ('?' == e) return T(at);
}
}
function lt(t) {
if (c && ':' == t) return k.stream.match(/^\s*\w+\s+is\b/, !1) ? T(H, ct, ut) : T(ut);
}
function ct(t, e) {
if ('is' == e) return (k.marked = 'keyword'), T();
}
function ut(t, e) {
return 'keyof' == e || 'typeof' == e
? ((k.marked = 'keyword'), T('keyof' == e ? ut : V))
: 'variable' == t || 'void' == e
? ((k.marked = 'type'), T(pt))
: 'string' == t || 'number' == t || 'atom' == t
? T(pt)
: '[' == t
? T(I(']'), rt(ut, ']', ','), F, pt)
: '{' == t
? T(I('}'), rt(dt, '}', ',;'), F, pt)
: '(' == t
? T(rt(ft, ')'), ht)
: '<' == t
? T(rt(ut, '>'), ut)
: void 0;
}
function ht(t) {
if ('=>' == t) return T(ut);
}
function dt(t, e) {
return 'variable' == t || 'keyword' == k.style
? ((k.marked = 'property'), T(dt))
: '?' == e
? T(dt)
: ':' == t
? T(ut)
: '[' == t
? T(H, at, R(']'), dt)
: void 0;
}
function ft(t, e) {
return ('variable' == t && k.stream.match(/^\s*[?:]/, !1)) || '?' == e ? T(ft) : ':' == t ? T(ut) : S(ut);
}
function pt(t, e) {
return '<' == e
? T(I('>'), rt(ut, '>'), F, pt)
: '|' == e || '.' == t || '&' == e
? T(ut)
: '[' == t
? T(R(']'), pt)
: 'extends' == e || 'implements' == e
? ((k.marked = 'keyword'), T(ut))
: void 0;
}
function gt(t, e) {
if ('<' == e) return T(I('>'), rt(ut, '>'), F, pt);
}
function vt() {
return S(ut, mt);
}
function mt(t, e) {
if ('=' == e) return T(ut);
}
function yt(t, e) {
return 'enum' == e ? ((k.marked = 'keyword'), T(Wt)) : S(bt, at, wt, Ct);
}
function bt(t, e) {
return c && A(e)
? ((k.marked = 'keyword'), T(bt))
: 'variable' == t
? (M(e), T())
: 'spread' == t
? T(bt)
: '[' == t
? ot(bt, ']')
: '{' == t
? ot(xt, '}')
: void 0;
}
function xt(t, e) {
return 'variable' != t || k.stream.match(/^\s*:/, !1)
? ('variable' == t && (k.marked = 'property'), 'spread' == t ? T(bt) : '}' == t ? S() : T(R(':'), bt, wt))
: (M(e), T(wt));
}
function wt(t, e) {
if ('=' == e) return T(V);
}
function Ct(t) {
if (',' == t) return T(yt);
}
function kt(t, e) {
if ('keyword b' == t && 'else' == e) return T(I('form', 'else'), j, F);
}
function St(t, e) {
return 'await' == e ? T(St) : '(' == t ? T(I(')'), Tt, R(')'), F) : void 0;
}
function Tt(t) {
return 'var' == t ? T(yt, R(';'), Mt) : ';' == t ? T(Mt) : 'variable' == t ? T(Et) : S(H, R(';'), Mt);
}
function Et(t, e) {
return 'in' == e || 'of' == e ? ((k.marked = 'keyword'), T(H)) : T(U, Mt);
}
function Mt(t, e) {
return ';' == t ? T(At) : 'in' == e || 'of' == e ? ((k.marked = 'keyword'), T(H)) : S(H, R(';'), At);
}
function At(t) {
')' != t && T(H);
}
function Ot(t, e) {
return '*' == e
? ((k.marked = 'keyword'), T(Ot))
: 'variable' == t
? (M(e), T(Ot))
: '(' == t
? T(L, I(')'), rt(Pt, ')'), F, lt, j, D)
: c && '<' == e
? T(I('>'), rt(vt, '>'), F, Ot)
: void 0;
}
function Pt(t, e) {
return (
'@' == e && T(H, Pt), 'spread' == t ? T(Pt) : c && A(e) ? ((k.marked = 'keyword'), T(Pt)) : S(bt, at, wt)
);
}
function _t(t, e) {
return 'variable' == t ? Lt(t, e) : Nt(t, e);
}
function Lt(t, e) {
if ('variable' == t) return M(e), T(Nt);
}
function Nt(t, e) {
return '<' == e
? T(I('>'), rt(vt, '>'), F, Nt)
: 'extends' == e || 'implements' == e || (c && ',' == t)
? ('implements' == e && (k.marked = 'keyword'), T(c ? ut : H, Nt))
: '{' == t
? T(I('}'), Dt, F)
: void 0;
}
function Dt(t, e) {
return 'async' == t ||
('variable' == t &&
('static' == e || 'get' == e || 'set' == e || (c && A(e))) &&
k.stream.match(/^\s+[\w$\xa1-\uffff]/, !1))
? ((k.marked = 'keyword'), T(Dt))
: 'variable' == t || 'keyword' == k.style
? ((k.marked = 'property'), T(c ? It : Ot, Dt))
: '[' == t
? T(H, at, R(']'), c ? It : Ot, Dt)
: '*' == e
? ((k.marked = 'keyword'), T(Dt))
: ';' == t
? T(Dt)
: '}' == t
? T()
: '@' == e
? T(H, Dt)
: void 0;
}
function It(t, e) {
return '?' == e ? T(It) : ':' == t ? T(ut, wt) : '=' == e ? T(V) : S(Ot);
}
function Ft(t, e) {
return '*' == e
? ((k.marked = 'keyword'), T($t, R(';')))
: 'default' == e
? ((k.marked = 'keyword'), T(H, R(';')))
: '{' == t
? T(rt(Rt, '}'), $t, R(';'))
: S(j);
}
function Rt(t, e) {
return 'as' == e ? ((k.marked = 'keyword'), T(R('variable'))) : 'variable' == t ? S(V, Rt) : void 0;
}
function jt(t) {
return 'string' == t ? T() : '(' == t ? S(H) : S(zt, Ht, $t);
}
function zt(t, e) {
return '{' == t ? ot(zt, '}') : ('variable' == t && M(e), '*' == e && (k.marked = 'keyword'), T(Vt));
}
function Ht(t) {
if (',' == t) return T(zt, Ht);
}
function Vt(t, e) {
if ('as' == e) return (k.marked = 'keyword'), T(zt);
}
function $t(t, e) {
if ('from' == e) return (k.marked = 'keyword'), T(H);
}
function Bt(t) {
return ']' == t ? T() : S(rt(V, ']'));
}
function Wt() {
return S(I('form'), bt, R('{'), I('}'), rt(Ut, '}'), F, F);
}
function Ut() {
return S(bt, wt);
}
function qt(t, e, n) {
return (
(e.tokenize == g &&
/^(?: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))))
);
}
return (
(D.lex = !0),
(F.lex = !0),
{
startState: function (t) {
var e = {
tokenize: g,
lastType: 'sof',
cc: [],
lexical: new w((t || 0) - o, 0, 'block', !1),
localVars: n.localVars,
context: n.localVars && new O(null, null, !1),
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()),
b(t, e)),
e.tokenize != v && t.eatSpace())
)
return null;
var n = e.tokenize(t, e);
return 'comment' == i
? n
: ((e.lastType = 'operator' != i || ('++' != r && '--' != r) ? i : 'incdec'),
(function (t, e, n, i, r) {
var o = t.cc;
for (
k.state = t,
k.stream = r,
k.marked = null,
k.cc = o,
k.style = e,
t.lexical.hasOwnProperty('align') || (t.lexical.align = !0);
;
) {
var s = o.length ? o.pop() : l ? H : j;
if (s(n, i)) {
for (; o.length && o[o.length - 1].lex; ) o.pop()();
return k.marked ? k.marked : 'variable' == n && C(t, i) ? 'variable-2' : e;
}
}
})(e, n, i, r, t));
},
indent: function (e, i) {
if (e.tokenize == v) return t.Pass;
if (e.tokenize != g) return 0;
var r,
a = 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 == F) l = l.prev;
else if (u != kt) break;
}
for (
;
('stat' == l.type || 'form' == l.type) &&
('}' == a || ((r = e.cc[e.cc.length - 1]) && (r == U || r == q) && !/^[,\.=+\-*:?[\(]/.test(i)));
)
l = l.prev;
s && ')' == l.type && 'stat' == l.prev.type && (l = l.prev);
var h = l.type,
f = a == h;
return 'vardef' == h
? l.indented + ('operator' == e.lastType || ',' == e.lastType ? l.info.length + 1 : 0)
: 'form' == h && '{' == a
? l.indented
: 'form' == h
? l.indented + o
: 'stat' == h
? l.indented +
((function (t, e) {
return (
'operator' == t.lastType ||
',' == t.lastType ||
d.test(e.charAt(0)) ||
/[,.]/.test(e.charAt(0))
);
})(e, i)
? s || o
: 0)
: 'switch' != l.info || f || 0 == n.doubleIndentSwitch
? l.align
? l.column + (f ? 0 : 1)
: l.indented + (f ? 0 : o)
: l.indented + (/^(?:case|default)\b/.test(i) ? o : 2 * o);
},
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
blockCommentStart: l ? null : '/*',
blockCommentEnd: l ? null : '*/',
blockCommentContinue: l ? null : ' * ',
lineComment: l ? null : '//',
fold: 'brace',
closeBrackets: '()[]{}\'\'""``',
helperType: l ? 'json' : 'javascript',
jsonldMode: a,
jsonMode: l,
expressionAllowed: qt,
skipExpression: function (t) {
var e = t.cc[t.cc.length - 1];
(e != H && e != V) || 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 });
})(n(6));
},
function (t, e, n) {
!(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,
allowMissingTagName: !1,
caseFold: !1,
};
t.defineMode('xml', function (i, r) {
var o,
s,
a = i.indentUnit,
l = {},
c = r.htmlMode ? e : n;
for (var u in c) l[u] = c[u];
for (var u in r) l[u] = r[u];
function h(t, e) {
function n(n) {
return (e.tokenize = n), n(t, e);
}
var i = t.next();
return '<' == i
? t.eat('!')
? t.eat('[')
? t.match('CDATA[')
? n(f('atom', ']]>'))
: null
: t.match('--')
? n(f('comment', '--\x3e'))
: t.match('DOCTYPE', !0, !0)
? (t.eatWhile(/[\w\._\-]/),
n(
(function t(e) {
return function (n, i) {
for (var r; null != (r = n.next()); ) {
if ('<' == r) return (i.tokenize = t(e + 1)), i.tokenize(n, i);
if ('>' == r) {
if (1 == e) {
i.tokenize = h;
break;
}
return (i.tokenize = t(e - 1)), i.tokenize(n, i);
}
}
return 'meta';
};
})(1),
))
: null
: t.eat('?')
? (t.eatWhile(/[\w\._\-]/), (e.tokenize = f('meta', '?>')), 'meta')
: ((o = t.eat('/') ? 'closeTag' : 'openTag'), (e.tokenize = d), 'tag bracket')
: '&' == i
? (
t.eat('#')
? t.eat('x')
? t.eatWhile(/[a-fA-F\d]/) && t.eat(';')
: t.eatWhile(/[\d]/) && t.eat(';')
: t.eatWhile(/[\w\.\-:]/) && t.eat(';')
)
? 'atom'
: 'error'
: (t.eatWhile(/[^&<]/), null);
}
function d(t, e) {
var n = t.next();
if ('>' == n || ('/' == n && t.eat('>')))
return (e.tokenize = h), (o = '>' == n ? 'endTag' : 'selfcloseTag'), 'tag bracket';
if ('=' == n) return (o = 'equals'), null;
if ('<' == n) {
(e.tokenize = h), (e.state = v), (e.tagName = e.tagStart = null);
var i = e.tokenize(t, e);
return i ? i + ' tag error' : 'tag error';
}
return /[\'\"]/.test(n)
? ((e.tokenize = (function (t) {
var e = function (e, n) {
for (; !e.eol(); )
if (e.next() == t) {
n.tokenize = d;
break;
}
return 'string';
};
return (e.isInAttribute = !0), e;
})(n)),
(e.stringStartCol = t.column()),
e.tokenize(t, e))
: (t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/), 'word');
}
function f(t, e) {
return function (n, i) {
for (; !n.eol(); ) {
if (n.match(e)) {
i.tokenize = h;
break;
}
n.next();
}
return t;
};
}
function p(t) {
t.context && (t.context = t.context.prev);
}
function g(t, e) {
for (var n; ; ) {
if (!t.context) return;
if (
((n = t.context.tagName),
!l.contextGrabbers.hasOwnProperty(n) || !l.contextGrabbers[n].hasOwnProperty(e))
)
return;
p(t);
}
}
function v(t, e, n) {
return 'openTag' == t ? ((n.tagStart = e.column()), m) : 'closeTag' == t ? y : v;
}
function m(t, e, n) {
return 'word' == t
? ((n.tagName = e.current()), (s = 'tag'), w)
: l.allowMissingTagName && 'endTag' == t
? ((s = 'tag bracket'), w(t, 0, n))
: ((s = 'error'), m);
}
function y(t, e, n) {
if ('word' == t) {
var i = e.current();
return (
n.context && n.context.tagName != i && l.implicitlyClosed.hasOwnProperty(n.context.tagName) && p(n),
(n.context && n.context.tagName == i) || !1 === l.matchClosing
? ((s = 'tag'), b)
: ((s = 'tag error'), x)
);
}
return l.allowMissingTagName && 'endTag' == t ? ((s = 'tag bracket'), b(t, 0, n)) : ((s = 'error'), x);
}
function b(t, e, n) {
return 'endTag' != t ? ((s = 'error'), b) : (p(n), v);
}
function x(t, e, n) {
return (s = 'error'), b(t, 0, n);
}
function w(t, e, n) {
if ('word' == t) return (s = 'attribute'), C;
if ('endTag' == t || 'selfcloseTag' == t) {
var i = n.tagName,
r = n.tagStart;
return (
(n.tagName = n.tagStart = null),
'selfcloseTag' == t || l.autoSelfClosers.hasOwnProperty(i)
? g(n, i)
: (g(n, i),
(n.context = new (function (t, e, n) {
(this.prev = t.context),
(this.tagName = e),
(this.indent = t.indented),
(this.startOfLine = n),
(l.doNotIndent.hasOwnProperty(e) || (t.context && t.context.noIndent)) && (this.noIndent = !0);
})(n, i, r == n.indented))),
v
);
}
return (s = 'error'), w;
}
function C(t, e, n) {
return 'equals' == t ? k : (l.allowMissing || (s = 'error'), w(t, 0, n));
}
function k(t, e, n) {
return 'string' == t
? S
: 'word' == t && l.allowUnquoted
? ((s = 'string'), w)
: ((s = 'error'), w(t, 0, n));
}
function S(t, e, n) {
return 'string' == t ? S : w(t, 0, n);
}
return (
(h.isInText = !0),
{
startState: function (t) {
var e = { tokenize: h, state: v, 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;
o = null;
var n = e.tokenize(t, e);
return (
(n || o) &&
'comment' != n &&
((s = null), (e.state = e.state(o || n, t, e)), s && (n = 'error' == s ? n + ' error' : s)),
n
);
},
indent: function (e, n, i) {
var r = e.context;
if (e.tokenize.isInAttribute) return e.tagStart == e.indented ? e.stringStartCol + 1 : e.indented + a;
if (r && r.noIndent) return t.Pass;
if (e.tokenize != d && e.tokenize != h) return i ? i.match(/^(\s*)/)[0].length : 0;
if (e.tagName)
return !1 !== l.multilineTagIndentPastTag
? e.tagStart + e.tagName.length + 2
: e.tagStart + a * (l.multilineTagIndentFactor || 1);
if (l.alignCDATA && /<!\[CDATA\[/.test(n)) return 0;
var o = n && /^<(\/)?([\w_:\.-]*)/.exec(n);
if (o && o[1])
for (; r; ) {
if (r.tagName == o[2]) {
r = r.prev;
break;
}
if (!l.implicitlyClosed.hasOwnProperty(r.tagName)) break;
r = r.prev;
}
else if (o)
for (; r; ) {
var s = l.contextGrabbers[r.tagName];
if (!s || !s.hasOwnProperty(o[2])) break;
r = r.prev;
}
for (; r && r.prev && !r.startOfLine; ) r = r.prev;
return r ? r.indent + a : e.baseIndent || 0;
},
electricInput: /<\/[\s\w:]+>$/,
blockCommentStart: '\x3c!--',
blockCommentEnd: '--\x3e',
configuration: l.htmlMode ? 'html' : 'xml',
helperType: l.htmlMode ? 'html' : 'xml',
skipAttribute: function (t) {
t.state == k && (t.state = w);
},
}
);
}),
t.defineMIME('text/xml', 'xml'),
t.defineMIME('application/xml', 'xml'),
t.mimeModes.hasOwnProperty('text/html') || t.defineMIME('text/html', { name: 'xml', htmlMode: !0 });
})(n(6));
},
function (t, e, n) {
!(function (t) {
'use strict';
var e = {
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'],
],
},
n = {};
function i(t, e) {
var i = t.match(
(function (t) {
var e = n[t];
return e || (n[t] = new RegExp('\\s+' + t + '\\s*=\\s*(\'|")?([^\'"]+)(\'|")?\\s*'));
})(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]);
}
t.defineMode(
'htmlmixed',
function (n, s) {
var a = t.getMode(n, {
name: 'xml',
htmlMode: !0,
multilineTagIndentFactor: s.multilineTagIndentFactor,
multilineTagIndentPastTag: s.multilineTagIndentPastTag,
}),
l = {},
c = s && s.tags,
u = s && s.scriptTypes;
if ((o(e, l), c && o(c, l), u))
for (var h = u.length - 1; h >= 0; h--) l.script.unshift(['type', u[h].matches, u[h].mode]);
function d(e, o) {
var s,
c = a.token(e, o.htmlState),
u = /\btag\b/.test(c);
if (
u &&
!/[<>\s\/]/.test(e.current()) &&
(s = o.htmlState.tagName && o.htmlState.tagName.toLowerCase()) &&
l.hasOwnProperty(s)
)
o.inTag = s + ' ';
else if (o.inTag && u && />$/.test(e.current())) {
var h = /^([\S]+) (.*)/.exec(o.inTag);
o.inTag = null;
var f =
'>' == e.current() &&
(function (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];
}
})(l[h[1]], h[2]),
p = t.getMode(n, f),
g = r(h[1], !0),
v = r(h[1], !1);
(o.token = function (t, e) {
return t.match(g, !1)
? ((e.token = d), (e.localState = e.localMode = null), null)
: (function (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
);
})(t, v, e.localMode.token(t, e.localState));
}),
(o.localMode = p),
(o.localState = t.startState(p, a.indent(o.htmlState, '')));
} else o.inTag && ((o.inTag += e.current()), e.eol() && (o.inTag += ' '));
return c;
}
return {
startState: function () {
var e = t.startState(a);
return { token: d, 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(a, e.htmlState),
}
);
},
token: function (t, e) {
return e.token(t, e);
},
indent: function (e, n, i) {
return !e.localMode || /^\s*<\//.test(n)
? a.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 || a };
},
};
},
'xml',
'javascript',
'css',
),
t.defineMIME('text/html', 'htmlmixed');
})(n(6), n(189), n(188), n(81));
},
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 (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var o = n(6);
n(190), n(81), n(187);
t.exports = r.default.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) {
'use strict';
var i = n(1),
r = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = r.default.Model.extend({
mapModel: function (t) {
var e = '',
n = t.get('script'),
r = t.get('type'),
o = t.get('components'),
s = t.getId();
if (n) {
var a = t.get('attributes');
(a = (0, i.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) {
e += this.mapModel(t);
}, this),
e
);
},
build: function (t) {
(this.mapJs = {}), this.mapModel(t);
var e = '';
for (var n in this.mapJs) {
var i = this.mapJs[n];
e +=
"\n var items = document.querySelectorAll('" +
('#' + i.ids.join(', #')) +
"');\n for (var i = 0, len = items.length; i < len; i++) {\n (function(){" +
i.code +
'}.bind(items[i]))();\n }';
}
return e;
},
});
},
function (t, e, n) {
'use strict';
var i = n(1),
r = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = r.default.Model.extend({
build: function (t) {
var e = t.toJSON();
return (
this.beforeEach(e),
(0, i.each)(
e,
function (t, n) {
var i = e[n];
if (i instanceof r.default.Model) e[n] = this.build(i);
else if (i instanceof r.default.Collection) {
var o = i;
(e[n] = []),
o.length &&
o.each(function (t, i) {
e[n][i] = this.build(t);
}, this);
}
},
this,
),
e
);
},
beforeEach: function (t) {
delete t.status;
},
});
},
function (t, e, n) {
'use strict';
var i = n(1);
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();
i = (u = l && c ? 'body' : u) + '{' + s + '}';
}
return (
t.components().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] : {},
r = n.cssc,
o = n.em || '';
(this.em = o), (this.compCls = []), (this.ids = []);
var s = this.buildFromModel(t, n),
a = (0, i.isUndefined)(n.clearStyles) && o ? o.getConfig('clearStyles') : n.clearStyles;
return (
r &&
(function () {
var t = r.getAll(),
i = {},
l = [];
for (var c in (t.each(function (t) {
var r = t.getAtRule();
if (r) {
var o = i[r];
o ? o.push(t) : (i[r] = [t]);
} else s += e.buildFromRule(t, l, n);
}),
i)) {
var u = '';
i[c].forEach(function (t) {
return (u += e.buildFromRule(t, l, n));
}),
u && (s += c + '{' + u + '}');
}
o && a && t.remove(l);
})(),
s
);
},
buildFromRule: function (t, e) {
var n = this,
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
r = '',
o = t.selectorsToString({ skipAdd: 1 }),
s = t.get('selectorsAdd'),
a = t.get('singleAtRule'),
l = void 0;
if (
(t.get('selectors').each(function (t) {
var e = t.getFullName();
(n.compCls.indexOf(e) >= 0 || n.ids.indexOf(e) >= 0 || i.keepUnusedStyles) && (l = 1);
}),
(o && l) || s || a)
) {
var c = t.getDeclaration();
c && (r += c);
} else e.push(t);
return r;
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.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 = { stylePrefix: 'cm-', inlineCss: !1 };
},
function (t, e, n) {
'use strict';
t.exports = function () {
var t = {},
e = n(196),
i = n(195),
r = n(194),
o = n(193),
s = n(192),
a = n(191),
l = n(186),
c = {},
u = {},
h = {},
d = {};
return {
getConfig: function () {
return t;
},
config: t,
EditorView: l,
name: 'CodeManager',
init: function (n) {
for (var l in ((t = n || {}), 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 = n(0).View.extend({
template: function (t) {
var e = t.pfx,
n = t.ppfx,
i = t.content;
return (
'<div class="' +
e +
'dialog ' +
n +
'one-bg ' +
n +
'two-color">\n <div class="' +
e +
'header">\n <div class="' +
e +
'title">' +
t.title +
'</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';
var i = n(0);
t.exports = i.Model.extend({ defaults: { title: '', content: '', open: !1 } });
},
function (t, e, n) {
'use strict';
t.exports = { stylePrefix: 'mdl-', title: '', content: '', backdrop: !0 };
},
function (t, e, n) {
'use strict';
t.exports = function () {
var t,
e,
i = {},
r = n(200),
o = n(199),
s = n(198);
return {
name: 'Modal',
init: function (n) {
for (var a in ((i = n || {}), 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) {
var e = t.model.getConfig().el || t.el;
this.render().appendTo(e);
},
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';
var i = n(10);
t.exports = n(0).View.extend({
template: function () {
var t = this.pfx;
this.ppfx;
return (
'\n <span id="' +
t +
'checkbox" class="fa" data-tag-status></span>\n <span id="' +
t +
'tag-label" data-tag-name>' +
(this.model.get('label') || '') +
'</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.contentEditable = !0), t.focus();
},
endEditTag: function () {
var t = this.model,
e = this.getInputEl(),
n = e.textContent,
r = i.escapeName(n),
o = this.target,
s = o && o.get('SelectorManager');
(e.contentEditable = !1), s && (s.get(r) ? (e.innerText = t.get('label')) : t.set({ name: r, 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.getSelected());
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';
this.$chk || (this.$chk = this.$el.find('#' + this.pfx + 'checkbox')),
this.model.get('active')
? (this.$chk.removeClass('fa-square-o').addClass(t), this.$el.removeClass('opac50'))
: (this.$chk.removeClass(t).addClass('fa-square-o'), 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';
var i = o(n(1)),
r = o(n(0));
function o(t) {
return t && t.__esModule ? t : { default: t };
}
var s = n(202);
t.exports = r.default.View.extend({
template: i.default.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, 'component:toggled', 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.getSelected();
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').add({ label: t });
if (n) {
var r = n.get('classes');
r.length;
r.add(i);
r.length;
this.collection.add(i), this.updateStateVis();
}
}
this.endNewTag();
}
},
addToClasses: function (t, e) {
var n = e || null,
i = new s({ model: t, config: this.config, coll: this.collection }).render().el;
return n ? n.appendChild(i) : this.getClasses().append(i), i;
},
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.ppfx,
e = this.config,
n = this.$el;
return (
n.html(
this.template({
selectedLabel: e.selectedLabel,
statesLabel: e.statesLabel,
label: e.label,
pfx: this.pfx,
ppfx: this.ppfx,
}),
),
(this.$input = n.find('input#' + this.newInputId)),
(this.$addBtn = n.find('#' + this.addBtnId)),
(this.$classes = n.find('#' + this.pfx + 'tags-c')),
(this.$states = n.find('#' + this.stateInputId)),
(this.$statesC = n.find('#' + this.stateInputC)),
this.$states.append(this.getStateOptions()),
this.renderClasses(),
n.attr('class', this.className + ' ' + t + 'one-bg ' + t + 'two-color'),
this
);
},
});
},
function (t, e, n) {
'use strict';
t.exports = {
stylePrefix: 'clm-',
appendTo: '',
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';
var i = n(1);
function r(t, e, n) {
return (
e in t
? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 })
: (t[e] = n),
t
);
}
var o = function (t) {
return (0, i.isString)(t) && '#' == t[0];
};
t.exports = function (t) {
var e,
s,
a,
l = t || {},
c = n(204),
u = n(10),
h = n(19),
d = n(203);
return (
r(
(e = {
Selector: u,
Selectors: h,
name: 'SelectorManager',
getConfig: function () {
return l;
},
}),
'getConfig',
function () {
return l;
},
),
r(e, 'init', function (t) {
for (var e in ((l = t || {}), c)) e in l || (l[e] = c[e]);
var n = l.em,
i = l.pStylePrefix;
return (
i && (l.stylePrefix = i + l.stylePrefix),
(a = new d({ collection: new h([], { em: n, config: l }), config: l })),
(s = new h(l.selectors)).on('add', function (t) {
return n.trigger('selector:add', t);
}),
this
);
}),
r(e, 'postRender', function () {
var t = this.getConfig().appendTo;
t && ((0, i.isElement)(t) ? t : document.querySelector(t)).appendChild(this.render([]));
}),
r(e, 'add', function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
(0, i.isObject)(t) ? (e = t) : (e.name = t),
o(e.name) && ((e.name = e.name.substr(1)), (e.type = u.TYPE_ID)),
e.label && !e.name && (e.name = u.escapeName(e.label));
var n = e.name,
r = n ? this.get(n, e.type) : s.where(e)[0];
return r || s.add(e);
}),
r(e, 'addClass', function (t) {
var e = [];
return (
(0, i.isString)(t) && (t = t.trim().split(' ')),
t.forEach(function (t) {
return e.push(s.add({ name: t }));
}),
e
);
}),
r(e, 'get', function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : u.TYPE_CLASS;
return o(t) && ((t = t.substr(1)), (e = u.TYPE_ID)), s.where({ name: t, type: e })[0];
}),
r(e, 'getAll', function () {
return s;
}),
r(e, 'render', function (t) {
return t ? new d({ collection: new h(t), config: l }).render().el : a.render().el;
}),
e
);
};
},
function (t, e, n) {
'use strict';
var i = {
4: 'media',
5: 'font-face',
6: 'page',
7: 'keyframes',
11: 'counter-style',
12: 'supports',
13: 'document',
14: 'font-feature-values',
15: 'viewport',
},
r = (0, n(1).keys)(i),
o = ['5', '6', '11', '15'];
t.exports = function (t) {
return {
parseSelector: function () {
for (
var t = [],
e = [],
n = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '').split(','),
i = 0,
r = n.length;
i < r;
i++
) {
var o = n[i].trim();
if (/^(\.{1}[\w\-]+)+(:{1,2}[\w\-()]+)?$/gi.test(o) || /^(#{1}[\w\-]+){1}(:{1,2}[\w\-()]+)?$/gi.test(o)) {
var s = o.split('.').filter(Boolean);
e.push(s);
} else t.push(o);
}
return { result: e, add: t };
},
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) {
return (t.conditionText || (t.media && t.media.mediaText) || t.name || t.selectorText || '').trim();
},
parseNode: function (t) {
for (var e = [], n = t.cssRules || [], s = 0, a = n.length; s < a; s++) {
var l = n[s],
c = l.type.toString(),
u = 0,
h = '',
d = '',
f = l.selectorText || l.keyText,
p = o.indexOf(c) >= 0;
if (p) (u = 1), (h = i[c]), (d = this.parseCondition(l));
else if (r.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 = i[c]);
}
e = e.concat(g);
}
if (f || p) {
for (
var b = this.parseStyle(l),
x = this.parseSelector(f),
w = x.add,
C = void 0,
k = 0,
S = (f = x.result).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 A = w.join(', ');
if (C) C.selectorsAdd = A;
else {
var O = { selectors: [], selectorsAdd: A, style: b };
u && (O.singleAtRule = u), h && (O.atRuleType = h), d && (O.mediaText = d), e.push(O);
}
}
}
}
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';
t.exports = { textTags: ['br', 'b', 'i', 'u', 'a', 'ul', 'ol'] };
},
function (t, e, n) {
'use strict';
t.exports = function () {
var t,
e,
i = {},
r = n(207),
o = n(206),
s = n(82);
return {
compTypes: '',
name: 'Parser',
init: function (n) {
for (var a in ((i = n || {}), 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';
var i = o(n(1)),
r = o(n(0));
function o(t) {
return t && t.__esModule ? t : { default: t };
}
t.exports = r.default.View.extend({
template: i.default.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
);
},
});
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
t.exports = i.default.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';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0));
var r = n(210);
t.exports = i.default.Collection.extend({ model: r });
},
function (t, e, n) {
'use strict';
t.exports = { devices: [], deviceLabel: 'Device' };
},
function (t, e, n) {
'use strict';
t.exports = function () {
var t,
e,
i = {},
r = n(212),
o = n(211),
s = n(209);
return {
name: 'DeviceManager',
init: function (n) {
for (var a in ((i = n || {}), 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';
Object.defineProperty(e, '__esModule', { value: !0 }),
(e.default = function (t) {
var e = this.constructor;
return this.then(
function (n) {
return e.resolve(t()).then(function () {
return n;
});
},
function (n) {
return e.resolve(t()).then(function () {
return e.reject(n);
});
},
);
});
},
function (t, e) {
var n,
i,
r = (t.exports = {});
function o() {
throw new Error('setTimeout has not been defined');
}
function s() {
throw new Error('clearTimeout has not been defined');
}
function a(t) {
if (n === setTimeout) return setTimeout(t, 0);
if ((n === o || !n) && setTimeout) return (n = setTimeout), setTimeout(t, 0);
try {
return n(t, 0);
} catch (e) {
try {
return n.call(null, t, 0);
} catch (e) {
return n.call(this, t, 0);
}
}
}
!(function () {
try {
n = 'function' == typeof setTimeout ? setTimeout : o;
} catch (t) {
n = o;
}
try {
i = 'function' == typeof clearTimeout ? clearTimeout : s;
} catch (t) {
i = s;
}
})();
var l,
c = [],
u = !1,
h = -1;
function d() {
u && l && ((u = !1), l.length ? (c = l.concat(c)) : (h = -1), c.length && f());
}
function f() {
if (!u) {
var t = a(d);
u = !0;
for (var e = c.length; e; ) {
for (l = c, c = []; ++h < e; ) l && l[h].run();
(h = -1), (e = c.length);
}
(l = null),
(u = !1),
(function (t) {
if (i === clearTimeout) return clearTimeout(t);
if ((i === s || !i) && clearTimeout) return (i = clearTimeout), clearTimeout(t);
try {
i(t);
} catch (e) {
try {
return i.call(null, t);
} catch (e) {
return i.call(this, t);
}
}
})(t);
}
}
function p(t, e) {
(this.fun = t), (this.array = e);
}
function g() {}
(r.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];
c.push(new p(t, e)), 1 !== c.length || u || a(f);
}),
(p.prototype.run = function () {
this.fun.apply(null, this.array);
}),
(r.title = 'browser'),
(r.browser = !0),
(r.env = {}),
(r.argv = []),
(r.version = ''),
(r.versions = {}),
(r.on = g),
(r.addListener = g),
(r.once = g),
(r.off = g),
(r.removeListener = g),
(r.removeAllListeners = g),
(r.emit = g),
(r.prependListener = g),
(r.prependOnceListener = g),
(r.listeners = function (t) {
return [];
}),
(r.binding = function (t) {
throw new Error('process.binding is not supported');
}),
(r.cwd = function () {
return '/';
}),
(r.chdir = function (t) {
throw new Error('process.chdir is not supported');
}),
(r.umask = function () {
return 0;
});
},
function (t, e, n) {
(function (t, e) {
!(function (t, n) {
'use strict';
if (!t.setImmediate) {
var i,
r = 1,
o = {},
s = !1,
a = t.document,
l = Object.getPrototypeOf && Object.getPrototypeOf(t);
(l = l && l.setTimeout ? l : t),
'[object process]' === {}.toString.call(t.process)
? (i = function (t) {
e.nextTick(function () {
u(t);
});
})
: (function () {
if (t.postMessage && !t.importScripts) {
var e = !0,
n = t.onmessage;
return (
(t.onmessage = function () {
e = !1;
}),
t.postMessage('', '*'),
(t.onmessage = n),
e
);
}
})()
? (function () {
var e = 'setImmediate$' + Math.random() + '$',
n = function (n) {
n.source === t &&
'string' == typeof n.data &&
0 === n.data.indexOf(e) &&
u(+n.data.slice(e.length));
};
t.addEventListener ? t.addEventListener('message', n, !1) : t.attachEvent('onmessage', n),
(i = function (n) {
t.postMessage(e + n, '*');
});
})()
: t.MessageChannel
? (function () {
var t = new MessageChannel();
(t.port1.onmessage = function (t) {
u(t.data);
}),
(i = function (e) {
t.port2.postMessage(e);
});
})()
: a && 'onreadystatechange' in a.createElement('script')
? (function () {
var t = a.documentElement;
i = function (e) {
var n = a.createElement('script');
(n.onreadystatechange = function () {
u(e), (n.onreadystatechange = null), t.removeChild(n), (n = null);
}),
t.appendChild(n);
};
})()
: (i = function (t) {
setTimeout(u, 0, t);
}),
(l.setImmediate = function (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 s = { callback: t, args: e };
return (o[r] = s), i(r), r++;
}),
(l.clearImmediate = c);
}
function c(t) {
delete o[t];
}
function u(t) {
if (s) setTimeout(u, 0, t);
else {
var e = o[t];
if (e) {
s = !0;
try {
!(function (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);
}
})(e);
} finally {
c(t), (s = !1);
}
}
}
}
})('undefined' == typeof self ? (void 0 === t ? this : t) : self);
}).call(this, n(11), n(215));
},
function (t, e, n) {
(function (t) {
var i = (void 0 !== t && t) || ('undefined' != typeof self && self) || window,
r = Function.prototype.apply;
function o(t, e) {
(this._id = t), (this._clearFn = e);
}
(e.setTimeout = function () {
return new o(r.call(setTimeout, i, arguments), clearTimeout);
}),
(e.setInterval = function () {
return new o(r.call(setInterval, i, arguments), clearInterval);
}),
(e.clearTimeout = e.clearInterval =
function (t) {
t && t.close();
}),
(o.prototype.unref = o.prototype.ref = function () {}),
(o.prototype.close = function () {
this._clearFn.call(i, 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(216),
(e.setImmediate =
('undefined' != typeof self && self.setImmediate) ||
(void 0 !== t && t.setImmediate) ||
(this && this.setImmediate)),
(e.clearImmediate =
('undefined' != typeof self && self.clearImmediate) ||
(void 0 !== t && t.clearImmediate) ||
(this && this.clearImmediate));
}).call(this, n(11));
},
function (t, e, n) {
'use strict';
(function (t) {
Object.defineProperty(e, '__esModule', { value: !0 });
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 = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(214));
var o = setTimeout;
function s() {}
function a(t) {
if (!(this instanceof a)) 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 = []), d(t, this);
}
function l(t, e) {
for (; 3 === t._state; ) t = t._value;
0 !== t._state
? ((t._handled = !0),
a._immediateFn(function () {
var n = 1 === t._state ? e.onFulfilled : e.onRejected;
if (null !== n) {
var i;
try {
i = n(t._value);
} catch (t) {
return void u(e.promise, t);
}
c(e.promise, i);
} else (1 === t._state ? c : u)(e.promise, t._value);
}))
: t._deferreds.push(e);
}
function c(t, e) {
try {
if (e === t) throw new TypeError('A promise cannot be resolved with itself.');
if (e && ('object' === (void 0 === e ? 'undefined' : i(e)) || 'function' == typeof e)) {
var n = e.then;
if (e instanceof a) return (t._state = 3), (t._value = e), void h(t);
if ('function' == typeof n)
return void d(
(function (t, e) {
return function () {
t.apply(e, arguments);
};
})(n, e),
t,
);
}
(t._state = 1), (t._value = e), h(t);
} catch (e) {
u(t, e);
}
}
function u(t, e) {
(t._state = 2), (t._value = e), h(t);
}
function h(t) {
2 === t._state &&
0 === t._deferreds.length &&
a._immediateFn(function () {
t._handled || a._unhandledRejectionFn(t._value);
});
for (var e = 0, n = t._deferreds.length; e < n; e++) l(t, t._deferreds[e]);
t._deferreds = null;
}
function d(t, e) {
var n = !1;
try {
t(
function (t) {
n || ((n = !0), c(e, t));
},
function (t) {
n || ((n = !0), u(e, t));
},
);
} catch (t) {
if (n) return;
(n = !0), u(e, t);
}
}
(a.prototype.catch = function (t) {
return this.then(null, t);
}),
(a.prototype.then = function (t, e) {
var n = new this.constructor(s);
return (
l(
this,
new (function (t, e, n) {
(this.onFulfilled = 'function' == typeof t ? t : null),
(this.onRejected = 'function' == typeof e ? e : null),
(this.promise = n);
})(t, e, n),
),
n
);
}),
(a.prototype.finally = r.default),
(a.all = function (t) {
return new a(function (e, n) {
if (!t || void 0 === t.length) throw new TypeError('Promise.all accepts an array');
var r = Array.prototype.slice.call(t);
if (0 === r.length) return e([]);
var o = r.length;
function s(t, a) {
try {
if (a && ('object' === (void 0 === a ? 'undefined' : i(a)) || 'function' == typeof a)) {
var l = a.then;
if ('function' == typeof l)
return void l.call(
a,
function (e) {
s(t, e);
},
n,
);
}
(r[t] = a), 0 == --o && e(r);
} catch (t) {
n(t);
}
}
for (var a = 0; a < r.length; a++) s(a, r[a]);
});
}),
(a.resolve = function (t) {
return t && 'object' === (void 0 === t ? 'undefined' : i(t)) && t.constructor === a
? t
: new a(function (e) {
e(t);
});
}),
(a.reject = function (t) {
return new a(function (e, n) {
n(t);
});
}),
(a.race = function (t) {
return new a(function (e, n) {
for (var i = 0, r = t.length; i < r; i++) t[i].then(e, n);
});
}),
(a._immediateFn =
('function' == typeof t &&
function (e) {
t(e);
}) ||
function (t) {
o(t, 0);
}),
(a._unhandledRejectionFn = function (t) {
'undefined' != typeof console && console && console.warn('Possible Unhandled Promise Rejection:', t);
}),
(e.default = a);
}).call(this, n(217).setImmediate);
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(83)),
r = n(1);
t.exports = n(0).Model.extend({
fetch: i.default,
defaults: {
urlStore: '',
urlLoad: '',
params: {},
beforeSend: function () {},
onComplete: function () {},
contentTypeJson: !1,
},
onStart: function () {
this.get('em');
var t = this.get('beforeSend');
t && t();
},
onError: function (t, e) {
if (e) e(t);
else {
var n = this.get('em');
console.error(t), n && n.trigger('storage:error', t);
}
},
onResponse: function (t, e) {
var n = this.get('em'),
i = this.get('onComplete'),
r = this.get('contentTypeJson') && t && 'string' == typeof t ? JSON.parse(t) : t;
i && i(r), e && e(r), n && n.trigger('storage:response', r);
},
store: function (t, e, n) {
var i = {};
for (var r in t) i[r] = t[r];
this.request(this.get('urlStore'), { body: i }, e, n);
},
load: function (t, e, n) {
this.request(this.get('urlLoad'), { method: 'get' }, e, n);
},
request: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = this,
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null,
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null,
s = this.get('contentTypeJson'),
a = this.get('headers') || {},
l = this.get('params'),
c = e.body || {},
u = void 0,
h = void 0;
for (var d in l) c[d] = l[d];
if (
((0, r.isUndefined)(a['X-Requested-With']) && (a['X-Requested-With'] = 'XMLHttpRequest'),
(0, r.isUndefined)(a['Content-Type']) && s && (a['Content-Type'] = 'application/json; charset=utf-8'),
s)
)
h = JSON.stringify(c);
else for (var f in ((h = new FormData()), c)) h.append(f, c[f]);
'post' === (u = { method: e.method || 'post', credentials: 'include', headers: a }).method && (u.body = h),
this.onStart(),
this.fetch(t, u)
.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.onResponse(t, i);
})
.catch(function (t) {
return n.onError(t, o);
});
},
});
},
function (t, e, n) {
'use strict';
var i = n(0);
t.exports = i.Model.extend({
defaults: { checkLocal: !0 },
store: function (t, e) {
for (var n in (this.checkStorageEnvironment(), 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 && console.warn("Your browser doesn't support localStorage");
},
});
},
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';
t.exports = function () {
var t = {},
e = n(221),
i = n(220),
r = n(219),
o = void 0,
s = {},
a = {};
return {
name: 'StorageManager',
init: function (n) {
for (var s in ((o = (t = n || {}).em), e)) s in t || (t[s] = e[s]);
return (
(a.remote = new r(t)),
(a.local = new i(t)),
(t.currentStorage = t.type),
this.loadDefaultProviders().setCurrent(t.type),
this
);
},
getConfig: function () {
return t;
},
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 (s[t] = e), this;
},
get: function (t) {
return s[t] || null;
},
getStorages: function () {
return s;
},
getCurrent: function () {
return t.currentStorage;
},
setCurrent: function (e) {
return (t.currentStorage = e), this;
},
store: function (e, n) {
var i = this,
r = this.get(this.getCurrent()),
o = {};
for (var s in (this.onStart('store', e), e)) o[t.id + s] = e[s];
return r
? r.store(
o,
function (t) {
n && n(t), i.onEnd('store', t);
},
function (t) {
i.onError('store', t);
},
)
: null;
},
load: function (e, n) {
var i = this,
r = this.get(this.getCurrent()),
o = [],
s = {};
'string' == typeof e && (e = [e]), this.onStart('load', e);
for (var a = 0, l = e.length; a < l; a++) o.push(t.id + e[a]);
r
? r.load(
o,
function (e) {
var r = new RegExp('^' + t.id);
for (var o in e) {
var a = o.replace(r, '');
s[a] = e[o];
}
n && n(s), i.onEnd('load', s);
},
function (t) {
i.onError('load', t);
},
)
: n && n(s);
},
loadDefaultProviders: function () {
for (var t in a) this.add(t, a[t]);
return this;
},
getCurrentStorage: function () {
return this.get(this.getCurrent());
},
onStart: function (t, e) {
o && (o.trigger('storage:start'), t && o.trigger('storage:start:' + t, e));
},
onEnd: function (t, e) {
o && (o.trigger('storage:end'), t && o.trigger('storage:end:' + t, e));
},
onError: function (t, e) {
o && (o.trigger('storage:error', e), t && o.trigger('storage:error:' + t, e), this.onEnd(t, e));
},
canAutoload: function () {
return this.getCurrentStorage() && this.getConfig().autoload;
},
};
};
},
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(84), n(20), e]),
void 0 ===
(o = function (t, e, n) {
a.Backbone = (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) {
n.each(e, function (e, r) {
n[r] &&
(t.prototype[r] = (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);
};
}
})(e, r, i));
});
},
a = (e.Events = {}),
l = /\s+/,
c = 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 && l.test(i)) for (s = i.split(l); a < s.length; a++) e = t(e, s[a], r, o);
else e = t(e, i, r, o);
return e;
};
a.on = function (t, e, n) {
return u(this, t, e, n);
};
var u = function (t, e, n, i, r) {
if (((t._events = c(h, t._events || {}, e, n, { context: i, ctx: t, listening: r })), r)) {
var o = t._listeners || (t._listeners = {});
o[r.id] = r;
}
return t;
};
a.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 u(t, e, i, this, s), this;
};
var h = 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;
};
(a.off = function (t, e, n) {
return this._events
? ((this._events = c(d, this._events, t, e, { context: n, listeners: this._listeners })), this)
: this;
}),
(a.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 d = 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) && 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];
}
};
(a.once = function (t, e, i) {
var r = c(f, {}, t, e, n.bind(this.off, this));
return this.on(r, void 0, i);
}),
(a.listenToOnce = function (t, e, i) {
var r = c(f, {}, e, i, n.bind(this.stopListening, this, t));
return this.listenTo(t, r);
});
var f = 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;
};
a.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 c(p, this._events, t, void 0, n), this;
};
var p = function (t, e, n, i) {
if (t) {
var r = t[e],
o = t.all;
r && o && (o = o.slice()), r && g(r, i), o && g(o, [e].concat(i));
}
return t;
},
g = 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;
}
};
(a.bind = a.on), (a.unbind = a.off), n.extend(e, a);
var v = (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(v.prototype, a, {
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 (this.idAttribute in r && (this.id = r[this.idAttribute]), 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) {
var e = this,
i = (t = n.extend({ parse: !0 }, t)).success;
return (
(t.success = function (n) {
var r = t.parse ? e.parse(n, t) : n;
if (!e.set(r, t)) return !1;
i && i.call(t.context, e, n, t), e.trigger('sync', e, n, t);
}),
D(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);
var o = (i = n.extend({ validate: !0, parse: !0 }, 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;
if ((o && (e = n.extend({}, r, e)), e && !s.set(e, i))) return !1;
a && a.call(i.context, s, t, i), s.trigger('sync', s, t, i);
}),
D(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) {
var e = this,
i = (t = t ? n.clone(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) : (D(this, t), (s = this.sync('delete', this, t))),
r || o(),
s
);
},
url: function () {
var t = n.result(this, 'urlRoot') || n.result(this.collection, 'url') || N();
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);
},
}),
s(
v,
{ keys: 1, values: 1, pairs: 1, invert: 1, pick: 0, omit: 0, chain: 1, isEmpty: 1 },
'attributes',
);
var m = (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));
}),
y = { add: !0, remove: !0, merge: !0 },
b = { add: !0, remove: !1 };
n.extend(m.prototype, a, {
model: v,
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, b));
},
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, y)).parse && !this._isModel(t) && (t = this.parse(t, e));
var i,
r,
o,
s,
a,
l = !n.isArray(t);
t = l ? (t ? [t] : []) : t.slice();
var c = e.at;
null != c && (c = +c), c < 0 && (c += this.length + 1);
for (
var u = this.comparator && null == c && !1 !== e.sort,
h = n.isString(this.comparator) ? this.comparator : null,
d = [],
f = [],
p = {},
g = e.add,
v = e.merge,
m = e.remove,
b = !(u || !g || !m) && [],
x = !1,
w = 0;
w < t.length;
w++
) {
if (((o = t[w]), (s = this.get(o))))
m && (p[s.cid] = !0),
v &&
o !== s &&
((o = this._isModel(o) ? o.attributes : o),
e.parse && (o = s.parse(o, e)),
s.set(o, e),
u && !a && s.hasChanged(h) && (a = !0)),
(t[w] = s);
else if (g) {
if (!(r = t[w] = this._prepareModel(o, e))) continue;
d.push(r), this._addReference(r, e);
}
(r = s || r) &&
((i = this.modelId(r.attributes)),
!b ||
(!r.isNew() && p[i]) ||
(b.push(r), (x = x || !this.models[w] || r.cid !== this.models[w].cid)),
(p[i] = !0));
}
if (m) {
for (var w = 0; w < this.length; w++) p[(r = this.models[w]).cid] || f.push(r);
f.length && this._removeModels(f, e);
}
if (d.length || x)
if ((u && (a = !0), (this.length += d.length), null != c))
for (var w = 0; w < d.length; w++) this.models.splice(c + w, 0, d[w]);
else {
b && (this.models.length = 0);
for (var C = b || d, w = 0; w < C.length; w++) this.models.push(C[w]);
}
if ((a && 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), (r = d[w]).trigger('add', r, this, k);
(a || x) && this.trigger('sort', this, e),
(d.length || f.length) && this.trigger('update', this, e);
}
return l ? 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) {
var e = (t = n.extend({ parse: !0 }, 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);
}),
D(this, t),
this.sync('read', this, t)
);
},
create: function (t, e) {
var i = (e = e ? n.clone(e) : {}).wait;
if (!(t = this._prepareModel(t, e))) 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) : {}).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 v;
},
_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);
}
},
}),
s(
m,
{
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,
},
'models',
);
n.each(['groupBy', 'countBy', 'sortBy', 'indexBy'], function (t) {
n[t] &&
(m.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 x = (e.View = function (t) {
(this.cid = n.uniqueId('view')),
n.extend(this, n.pick(t, C)),
this._ensureElement(),
this.initialize.apply(this, arguments);
}),
w = /^(\S+)\s*(.*)$/,
C = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
n.extend(x.prototype, a, {
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;
for (var e in (this.undelegateEvents(), t)) {
var i = t[e];
if ((n.isFunction(i) || (i = this[i]), i)) {
var r = e.match(w);
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 = k[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') || N()),
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 k = { create: 'POST', update: 'PUT', patch: 'PATCH', delete: 'DELETE', read: 'GET' };
e.ajax = function () {
return e.$.ajax.apply(e.$, arguments);
};
var S = (e.Router = function (t) {
t || (t = {}),
t.routes && (this.routes = t.routes),
this._bindRoutes(),
this.initialize.apply(this, arguments);
}),
T = /\((.*?)\)/g,
E = /(\(\?)?:\w+/g,
M = /\*\w+/g,
A = /[\-{}\[\]+?.,\\\^$|#\s]/g;
n.extend(S.prototype, a, {
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);
!1 !== o.execute(r, s, i) &&
(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(A, '\\$&')
.replace(T, '(?:$1)?')
.replace(E, function (t, e) {
return e ? t : '([^/?]+)';
})
.replace(M, '([^?]*?)')),
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 O = (e.History = function () {
(this.handlers = []),
n.bindAll(this, 'checkUrl'),
'undefined' != typeof window &&
((this.location = window.location), (this.history = window.history));
}),
P = /^[#\/]|\s+$/g,
_ = /^\/+|\/+$/g,
L = /#.*$/;
(O.started = !1),
n.extend(O.prototype, a, {
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(P, '')
);
},
start: function (t) {
if (O.started) throw new Error('Backbone.history has already been started');
if (
((O.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),
(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),
(O.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.any(this.handlers, function (e) {
if (e.route.test(t)) return e.callback(t), !0;
}))
);
},
navigate: function (t, e) {
if (!O.started) return !1;
(e && !0 !== e) || (e = { trigger: !!e }), (t = this.getFragment(t || ''));
var n = this.root;
('' !== t && '?' !== t.charAt(0)) || (n = n.slice(0, -1) || '/');
var i = n + t;
if (((t = this.decodeFragment(t.replace(L, ''))), 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 O());
v.extend =
m.extend =
S.extend =
x.extend =
O.extend =
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;
};
(o.prototype = r.prototype), (i.prototype = new o()), t && n.extend(i.prototype, t);
return (i.__super__ = r.prototype), i;
};
var N = function () {
throw new Error('A "url" property or function must be specified');
},
D = 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;
})(a, n, t, e);
}.apply(e, r)) || (t.exports = o);
})();
}).call(this, n(11));
},
function (t, e, n) {
var i, r, o;
/*!
* Backbone.Undo.js v0.2
*
* Copyright (c)2013 Oliver Sartun
* Released under the MIT License
*
* Documentation and full license available at
* https://github.com/osartun/Backbone.Undo.js
*/ (r = [n(84), n(223)]),
void 0 ===
(o =
'function' ==
typeof (i = function (t, e) {
var n = Array.prototype.slice;
function i(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 o(e, n) {
return (
null != e &&
(t.isArray(n) || (n = r(arguments, 1)),
t.all(n, function (t) {
return t in e;
}))
);
}
var s = (function () {
var e = !1,
n = -1;
return function () {
return (
e ||
(n++,
(e = !0),
t.defer(function () {
e = !1;
})),
n
);
};
})();
function a() {
(this.registeredObjects = []), (this.cidIndexes = []);
}
function l(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 c(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 u(e, i, r, o, s) {
if (
!(
r.isCurrentlyUndoRedoing ||
('undo' === e && -1 === r.pointer) ||
('redo' === e && r.pointer === r.length - 1)
)
) {
r.isCurrentlyUndoRedoing = !0;
var a,
l,
c = 'undo' === e;
for (
s
? (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]))
: ((a = r.at(c ? r.pointer : r.pointer + 1)),
(l = o ? r.where({ magicFusionIndex: a.get('magicFusionIndex') }) : [a])),
r.pointer += (c ? -1 : 1) * l.length;
(a = c ? l.pop() : l.shift());
)
a[e]();
(r.isCurrentlyUndoRedoing = !1), i.trigger(e, i);
}
}
function h(t, e, n, r) {
if (
t.track &&
!t.isCurrentlyUndoRedoing &&
e in r &&
(function (t, e) {
var n = t.condition,
r = typeof n;
return 'function' === r ? !!i(n, t, e) : 'boolean' !== r || n;
})(r[e], n)
) {
var a = i(r[e].on, r[e], n);
if (o(a, 'object', 'before', 'after')) {
if (((a.type = e), (a.magicFusionIndex = s()), (a.undoTypes = r), t.pointer < t.length - 1))
for (var l = t.length - t.pointer - 1; l--; ) t.pop();
(t.pointer = t.length), t.add(a), t.length > t.maximumStackLength && (t.shift(), t.pointer--);
}
}
}
a.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 d = {
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) };
},
},
};
function f() {}
function p(e, n, i, r) {
if ('object' == typeof n)
return t.each(n, function (t, n) {
2 === e ? p(e, t, i, r) : p(e, n, t, i);
});
switch (e) {
case 0:
o(i, 'undo', 'redo', 'on') && t.all(t.pick(i, 'undo', 'redo', 'on'), t.isFunction) && (r[n] = i);
break;
case 1:
r[n] && t.isObject(i) && (r[n] = t.extend({}, r[n], i));
break;
case 2:
delete r[n];
}
return this;
}
f.prototype = d;
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);
},
}),
v = 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 v()),
(this.objectRegistry = new a()),
(this.undoTypes = new f()),
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)
? i(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) {
h(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 () {
i(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, i = t.isArray(e) ? e : r(arguments); (n = i.pop()); )
n instanceof m && n.stack instanceof v && (n.stack = this.stack);
},
addUndoType: function (t, e) {
p(0, t, e, this.undoTypes);
},
changeUndoType: function (t, e) {
p(1, t, e, this.undoTypes);
},
removeUndoType: function (t) {
p(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) {
p(0, t, e, d);
},
changeUndoType: function (t, e) {
p(1, t, e, d);
},
removeUndoType: function (t) {
p(2, t, void 0, d);
},
}),
(e.UndoManager = m)
);
})
? i.apply(e, r)
: i) || (t.exports = o);
},
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 (t) {
return t && t.__esModule ? t : { default: t };
})(n(224));
t.exports = function () {
var t = void 0,
e = void 0,
n = void 0,
o = void 0,
s = {};
return {
name: 'UndoManager',
init: function () {
var a = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
(n = i({}, a, s)),
(t = n.em),
(this.em = t),
(e = new r.default({ track: !0, register: [] })).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: i({}, 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: i({}, n) };
},
});
var l = {
on: function (t, e) {
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
if ((!o && (o = t.previousAttributes()), !n.avoidStore)) {
var i = { object: t, before: o, after: t.toJSON() };
return (o = null), i;
}
},
undo: function (t, e, n, i) {
t.set(e);
},
redo: function (t, e, n, i) {
t.set(n);
},
};
return (
['style', 'attributes', 'content', 'src'].forEach(function (t) {
return e.addUndoType('change:' + t, l);
}),
e.on('undo redo', function () {
return t.trigger('component:toggled 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) {
'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(85);
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' },
'core:component-next': { keys: 's', handler: 'core:component-next' },
'core:component-prev': { keys: 'w', handler: 'core:component-prev' },
'core:component-enter': { keys: 'd', handler: 'core:component-enter' },
'core:component-exit': { keys: 'a', handler: 'core:component-exit' },
'core:component-delete': { keys: 'backspace, delete', handler: 'core:component-delete' },
},
};
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 };
return (
n[t] && this.remove(t),
(n[t] = u),
s(e, function (e, n) {
'object' == (void 0 === (r = (0, o.isString)(r) ? l.get(r) : 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';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)).default.$;
t.exports = {
setKey: function (t, e) {},
getElementRect: function (t) {
var e = this.opts.posFetcher || '';
return e
? e(t, { avoidFrameOffset: 1 })
: (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);
},
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) {
t = t || this.el;
if (!this.$doc) {
var e = [document];
t && e.push(t.ownerDocument), (this.$doc = i(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');
},
};
},
function (t, e, n) {
'use strict';
var i = (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;
};
})(),
r = n(1),
o = n(2);
var s = {
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,
silentFrames: 0,
avoidContainerUpdate: 0,
tl: 1,
tc: 1,
tr: 1,
cl: 1,
cr: 1,
bl: 1,
bc: 1,
br: 1,
},
a = (function () {
function t() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return (
(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function');
})(this, t),
this.setOptions(e),
(0, r.bindAll)(this, 'handleKeyDown', 'handleMouseDown', 'move', 'stop'),
this
);
}
return (
i(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, r.defaults)(t, s)), 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')).className = e + 'resizer-c'),
n.appendChild(i),
(this.container = i));
i.firstChild;
)
i.removeChild(i.firstChild);
var r = {};
for (var o in (['tl', 'tc', 'tr', 'cl', 'cr', 'bl', 'bc', 'br'].forEach(function (e) {
return (r[e] = t[e]
? (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
);
})(e, t)
: '');
}),
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: 'toggleFrames',
value: function (t) {
if (this.opts.silentFrames) {
var e = document.querySelectorAll('iframe');
(0, r.each)(e, function (e) {
return (e.style.pointerEvents = t ? 'none' : '');
});
}
},
},
{
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 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = this.posFetcher || '';
return n
? n(t, e)
: (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);
},
},
{
key: 'focus',
value: function (t) {
if (!t || t !== this.el) {
this.el = t;
var e = this.opts,
n = this.getElementPos(t, { target: 'container' }),
i = this.container.style;
e.avoidContainerUpdate ||
((i.left = n.left + 'px'),
(i.top = n.top + 'px'),
(i.width = n.width + 'px'),
(i.height = n.height + 'px'),
(i.display = 'block')),
(0, o.on)(this.getDocumentEl(), 'mousedown', this.handleMouseDown);
}
},
},
{
key: 'blur',
value: function () {
(this.container.style.display = 'none'),
this.el && ((0, o.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.opts || {},
i = 'data-' + n.prefix + 'handler',
s = this.getElementPos(e, { target: 'el' });
(this.handlerAttr = t.target.getAttribute(i)),
(this.clickedHandler = t.target),
(this.startDim = { t: s.top, l: s.left, w: s.width, h: s.height }),
(this.rectDim = { t: s.top, l: s.left, w: s.width, h: s.height }),
(this.startPos = { x: t.clientX, y: t.clientY });
var a = this.getDocumentEl();
(0, o.on)(a, 'mousemove', this.move),
(0, o.on)(a, 'keydown', this.handleKeyDown),
(0, o.on)(a, 'mouseup', this.stop),
(0, r.isFunction)(this.onStart) && this.onStart(t, { docs: a, config: n, el: e, resizer: this }),
this.toggleFrames(1),
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, o.off)(n, 'mousemove', this.move),
(0, o.off)(n, 'keydown', this.handleKeyDown),
(0, o.off)(n, 'mouseup', this.stop),
this.updateRect(1),
this.toggleFrames(),
(0, r.isFunction)(this.onEnd) && this.onEnd(t, { docs: n, config: e });
},
},
{
key: 'updateRect',
value: function (t) {
var e = this.el,
n = this.opts,
i = this.rectDim,
o = this.container.style,
s = this.updateTarget,
a = this.getSelectedHandler(),
l = n.unitHeight,
c = n.unitWidth,
u = n.keyWidth,
h = n.keyHeight;
if ((0, r.isFunction)(s)) s(e, i, { store: t, selectedHandler: a, resizer: this, config: n });
else {
var d = e.style;
(d[u] = i.w + c), (d[h] = i.h + l);
}
var f = this.getElementPos(e, { target: 'container' });
n.avoidContainerUpdate ||
((o.left = f.left + 'px'),
(o.top = f.top + 'px'),
(o.width = f.width + 'px'),
(o.height = f.height + 'px'));
},
},
{
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,
s = 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, o.normalizeFloat)(u + l * i, i)),
(e = Math.max(s, e)),
a && (e = Math.min(a, e)),
(d.w = e)),
~f.indexOf('b') &&
((e = (0, o.normalizeFloat)(h + c * i, i)),
(e = Math.max(s, e)),
a && (e = Math.min(a, e)),
(d.h = e)),
~f.indexOf('l') &&
((e = (0, o.normalizeFloat)(u - l * i, i)),
(e = Math.max(s, e)),
a && (e = Math.min(a, e)),
(d.w = e)),
~f.indexOf('t') &&
((e = (0, o.normalizeFloat)(h - c * i, i)),
(e = Math.max(s, 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 a(t);
},
};
},
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 = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(0)),
o = n(1),
s = n(2);
var a = r.default.$;
t.exports = r.default.View.extend({
initialize: function (t) {
(this.opt = t || {}),
e.bindAll(this, 'startSort', 'onMove', 'endMove', 'rollback', 'udpateOffset', 'moveDragHelper');
var n = t || {};
(this.elT = 0), (this.elL = 0), (this.borderOffset = n.borderOffset || 10);
var i = n.container;
(this.el = 'string' == typeof i ? document.querySelector(i) : i),
(this.$el = a(this.el)),
(this.containerSel = n.containerSel || 'div'),
(this.itemSel = n.itemSel || 'div'),
(this.draggable = n.draggable || !0),
(this.nested = n.nested || 0),
(this.pfx = n.pfx || ''),
(this.ppfx = n.ppfx || ''),
(this.freezeClass = n.freezeClass || this.pfx + 'freezed'),
(this.onStart = n.onStart || ''),
(this.onEndMove = n.onEndMove || ''),
(this.direction = n.direction || 'v'),
(this.onMoveClb = n.onMove || ''),
(this.relative = n.relative || 0),
(this.ignoreViewChildren = n.ignoreViewChildren || 0),
(this.ignoreModels = n.ignoreModels || 0),
(this.plh = n.placer || ''),
(this.wmargin = n.wmargin || 0),
(this.offTop = n.offsetTop || 0),
(this.offLeft = n.offsetLeft || 0),
(this.document = n.document || document),
(this.$document = a(this.document)),
(this.dropContent = null),
(this.em = n.em || ''),
(this.dragHelper = null),
(this.canvasRelative = n.canvasRelative || 0),
(this.selectOnEnd = !n.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).frameElement,
a = this.dragHelper.style;
if (s) {
var l = s.getBoundingClientRect();
(r = l.top + document.documentElement.scrollTop),
(o = l.left + document.documentElement.scrollLeft),
(n = t.clientY),
(i = t.clientX);
}
(a.top = n + r + 'px'), (a.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.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 r.default.Collection)) {
var e = this.targetModel;
e && e.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 = t;
return n.offsetHeight, !!this.styleInFlow(n, 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, e) {
var n = this.getSourceModel(e);
e = n && n.view && n.view.el;
var i = this.getTargetModel(t),
s = { valid: !0, src: e, srcModel: n, trg: (t = i && i.view && i.view.el), trgModel: i };
if (!e || !t) return (s.valid = !1), s;
var a = i.get('droppable');
(a = (a = a instanceof r.default.Collection ? 1 : a) instanceof Array ? a.join(', ') : a),
(s.dropInfo = a),
(a = (0, o.isString)(a) ? this.matches(e, 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)) && this.validTarget(n).valid && (e = n), e;
},
nearElBorders: function (t) {
var e = t.getBoundingClientRect(),
n = t.ownerDocument.body,
i = this.getCurrentPos(),
r = i.x,
o = i.y,
s = e.top + n.scrollTop,
a = e.left + n.scrollLeft,
l = e.width,
c = e.height;
if (o < s + 10 || o > s + c - 10 || r < a + 10 || r > a + l - 10) return 1;
},
getCurrentPos: function () {
var t = this.eventMove;
return { x: t.pageX || 0, y: t.pageY || 0 };
},
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 (
((s = (h = t[d])[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 = 'px',
c = n.method,
u = e[n.index];
if (
((t.style.borderColor = 'transparent #62c462'),
(t.style.borderWidth = '3px 5px'),
(t.style.margin = '-3px 0 0'),
u)
)
u[4]
? ((s = u[3] + l), (a = 'auto'), (r = 'before' == c ? u[0] - 0 : u[0] + u[2] - 0), (o = u[1]))
: ((s = 'auto'),
(a = u[2] - 0 + l),
(r = u[0] + 0),
(o = 'before' == c ? u[1] - 0 : u[1] + u[3] - 0),
(t.style.borderColor = '#62c462 transparent'),
(t.style.borderWidth = '5px 3px'),
(t.style.margin = '0 0 0 -3px'));
else {
if (!this.nested) return void (t.style.display = 'none');
i && ((r = i[0] + 5), (o = i[1] + 5), (s = parseInt(i[3]) - 10 + l), (a = 'auto'));
}
(t.style.top = r + l), (t.style.left = o + l), s && (t.style.width = s), a && (t.style.height = a);
},
endMove: function (t) {
var e = this,
n = [null],
i = this.getDocuments(),
r = this.getContainerEl(),
a = this.onEndMove,
l = this.target,
c = this.lastPos;
(0, s.off)(r, 'mousemove dragover', this.onMove),
(0, s.off)(i, 'mouseup dragend', this.endMove),
(0, s.off)(i, 'keydown', this.rollback),
(this.plh.style.display = 'none');
new RegExp('(?:^|\\s)' + this.freezeClass + '(?!\\S)', 'gi');
var u = this.eV;
if (u && this.selectOnEnd) {
var h = this.getSourceModel();
h && h.set && (h.set('status', ''), h.set('status', 'selected'));
}
if (this.moved) {
var d = this.toMove;
((0, o.isArray)(d) ? d : d ? [d] : [u]).forEach(function (t) {
n.push(e.move(l, t, c));
});
}
this.plh && (this.plh.style.display = 'none');
var f = this.dragHelper;
f && (f.parentNode.removeChild(f), (this.dragHelper = null)),
this.selectTargetModel(),
this.toggleSortCursor(),
(this.toMove = null),
(0, o.isFunction)(a) &&
n.forEach(function (t) {
return a(t, e);
});
},
move: function (t, e, n) {
var o = this.em,
l = (0, s.getElement)(e);
o && o.trigger('component:dragEnd:before', t, l, n);
var c,
u,
h,
d = [],
f = n.index,
p = this.validTarget(t, l),
g = a(t).data('collection'),
v = p.srcModel,
m = p.droppable,
y = p.draggable,
b = p.dropInfo,
x = p.dragInfo,
w = this.dropContent;
if (((m = p.trgModel instanceof r.default.Collection ? 1 : m), g && m && y)) {
var C = { at: (f = 'after' === n.method ? f + 1 : f), noIncrement: 1 };
w
? ((c = w), (C.silent = !1), (C.avoidUpdateStyle = 1))
: ((C.temporary = 1), (u = g.add({}, i({}, C))), v && (c = v.collection.remove(v))),
(h = g.add(c, C)),
w ? (this.dropContent = null) : g.remove(u),
(this.prevTarget = null);
} else
g || d.push('Target collection not found'),
m || d.push('Target is not droppable, accepts [' + b + ']'),
y || d.push('Component not draggable, acceptable by [' + x + ']'),
console.warn('Invalid target position: ' + d.join(', '));
return o && o.trigger('component:dragEnd', g, c, d), o && o.trigger('sorter:drag:end', g, c, d), h;
},
rollback: function (t) {
(0, s.off)(this.getDocuments(), 'keydown', this.rollback),
27 == (t.which || t.keyCode) && ((this.moved = 0), this.endMove());
},
});
}).call(this, n(1));
},
function (t, e, n) {
'use strict';
t.exports = function () {
return {
name: 'Utils',
init: function () {
return this;
},
Sorter: n(229),
Resizer: n(228),
Dragger: n(227),
};
};
},
function (t, e) {
t.exports = function (t) {
return (
t.webpackPolyfill ||
((t.deprecate = function () {}),
(t.paths = []),
t.children || (t.children = []),
Object.defineProperty(t, 'loaded', {
enumerable: !0,
get: function () {
return t.l;
},
}),
Object.defineProperty(t, 'id', {
enumerable: !0,
get: function () {
return t.i;
},
}),
(t.webpackPolyfill = 1)),
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(1),
o = n(2);
var s = [
n(230),
n(226),
n(225),
n(222),
n(213),
n(208),
n(205),
n(201),
n(197),
n(185),
n(178),
n(77),
n(161),
n(155),
n(150),
n(143),
n(54),
n(112),
n(105),
n(98),
],
a = n(0),
l = a.Collection,
c = void 0;
n(90)({ Backbone: a, $: a.$ });
var u = a.$;
t.exports = a.Model.extend({
defaults: function () {
return {
editing: 0,
selected: new l(),
clipboard: null,
designerMode: !1,
componentHovered: 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', []),
this.set('storables', []),
e.el && e.fromElement && (this.config.components = e.el.innerHTML),
(this.attrsOrig = e.el
? []
.concat(
(function (t) {
if (Array.isArray(t)) {
for (var e = 0, n = Array(t.length); e < t.length; e++) n[e] = t[e];
return n;
}
return Array.from(t);
})(e.el.attributes),
)
.reduce(function (t, e) {
return (t[e.nodeName] = e.nodeValue), t;
}, {})
: ''),
s.forEach(function (e) {
return t.loadModule(e);
}),
this.on('change:componentHovered', this.componentHovered, this),
this.on('change:changesCount', this.updateChanges, this),
[{ from: 'change:selectedComponent', to: 'component:toggled' }].forEach(function (e) {
var n = e.from,
i = e.to;
t.listenTo(t, n, function () {
for (var e = arguments.length, r = Array(e), o = 0; o < e; o++) r[o] = arguments[o];
t.trigger.apply(t, [i].concat(r)),
console.warn("The event '" + n + "' is deprecated, replace it with '" + i + "'");
});
});
},
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 () {
t.get('modules').forEach(function (e) {
return e.postLoad && e.postLoad(t);
}),
e && e();
};
n && n.canAutoload() ? 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 = e[n.name.charAt(0).toLowerCase() + n.name.slice(1)] || e[n.name] || {};
r.pStylePrefix = e.pStylePrefix || '';
var o = this.get('StorageManager');
if (n.storageKey && n.store && n.load && o) {
r.stm = o;
var s = this.get('storables');
s.push(n), this.set('storables', s);
}
return (
(r.em = this),
n.init(i({}, r)),
!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 ||
(c && clearInterval(c),
(c = setTimeout(function () {
i.avoidStore || n.set('changesCount', n.get('changesCount') + 1, i);
}, 0)));
},
componentHovered: function (t, e, n) {
var i = this.previous('componentHovered');
i && this.trigger('component:unhovered', i, n), e && this.trigger('component:hovered', e, n);
},
getSelected: function () {
return this.get('selected').last();
},
getSelectedAll: function () {
return this.get('selected').models;
},
setSelected: function (t) {
var e = this,
n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
i = (0, r.isArray)(t),
s = i ? t : [t],
a = this.get('selected');
i &&
this.removeSelected(
a.filter(function (t) {
return !(0, r.contains)(s, t);
}),
),
s.forEach(function (t) {
var r = (0, o.getModel)(t, u);
(r && !r.get('selectable')) ||
(!i &&
e.removeSelected(
a.filter(function (t) {
return t !== r;
}),
),
e.addSelected(r, n));
});
},
addSelected: function (t) {
var e = this,
n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
i = (0, o.getModel)(t, u);
((0, r.isArray)(i) ? i : [i]).forEach(function (t) {
(t && !t.get('selectable')) || e.get('selected').push(t, n);
});
},
removeSelected: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
this.get('selected').remove((0, o.getModel)(t, u), e);
},
toggleSelected: function (t) {
var e = this,
n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
i = (0, o.getModel)(t, u);
((0, r.isArray)(i) ? i : [i]).forEach(function (t) {
e.get('selected').contains(t) ? e.removeSelected(t, n) : e.addSelected(t, n);
});
},
setHovered: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = (0, o.getModel)(t, u);
(n && !n.get('hoverable')) ||
(e.forceChange && this.set('componentHovered', ''), this.set('componentHovered', 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,
o = (0, r.isUndefined)(t.keepUnusedStyles) ? e.keepUnusedStyles : t.keepUnusedStyles,
s = this.get('CssComposer'),
a = this.get('DomComponents').getComponent();
return (
(i ? '' : e.protectedCss) +
this.get('CodeManager').getCode(a, 'css', { cssc: s, wrappesIsBody: n, keepUnusedStyles: o })
);
},
getJs: function () {
var t = this.get('DomComponents').getWrapper();
return this.get('CodeManager').getCode(t, 'js').trim();
},
store: function (t) {
var e = this,
n = this.get('StorageManager'),
i = {};
if (n)
return (
this.get('storables').forEach(function (t) {
var e = t.store(1);
for (var n in e) i[n] = e[n];
}),
n.store(i, function (n) {
t && t(n), e.set('changesCount', 0), e.trigger('storage:store', i);
}),
i
);
},
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 = [];
if (!r) return {};
this.get('storables').forEach(function (t) {
var e = t.storageKey;
((e = 'function' == typeof e ? e() : e) instanceof Array ? e : [e]).forEach(function (t) {
o.push(t);
});
}),
r.load(o, function (t) {
(n.cacheLoad = t),
e && e(t),
setTimeout(function () {
return n.trigger('storage:load', t);
}, 0);
});
},
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) {
(t || window).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 + ')' : '';
},
getWrapper: function () {
return this.get('DomComponents').getWrapper();
},
getDirtyCount: function () {
return this.get('changesCount');
},
destroyAll: function () {
var t = this.attributes,
e = t.DomComponents,
n = t.CssComposer,
i = t.UndoManager,
r = t.Panels,
o = t.Canvas;
e.clear(),
n.clear(),
i.clear().removeAll(),
r.getPanels().reset(),
o.getCanvasView().remove(),
this.view.remove(),
this.stopListening(),
u(this.config.el).empty().attr(this.attrsOrig);
},
setEditing: function (t) {
return this.set('editing', t), this;
},
isEditing: function () {
return !!this.get('editing');
},
data: function (t, e, n) {
if ((t['_gjs-data'] || (t['_gjs-data'] = {}), (0, r.isUndefined)(n))) return t['_gjs-data'][e];
t['_gjs-data'][e] = n;
},
});
},
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%',
baseCss:
'\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\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 ',
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: ' ]}',
keepEmptyTextNodes: 0,
jsInHtml: !0,
nativeDnD: 1,
multipleSelection: 1,
exportWrapper: 0,
wrappesIsBody: 1,
avoidInlineStyle: 0,
avoidDefaults: 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: {},
traitManager: {},
textViewCode: 'Code',
keepUnusedStyles: 0,
};
},
function (t, e, n) {
'use strict';
var i = (function (t) {
return t && t.__esModule ? t : { default: t };
})(n(20));
t.exports = function (t) {
var e = t || {},
r = n(233),
o = n(232),
s = n(89);
for (var a in r) a in e || (e[a] = r[a]);
e.pStylePrefix = e.stylePrefix;
var l = new o(e),
c = new s({ model: l, config: e });
return {
$: i.default,
editor: l,
DomComponents: l.get('DomComponents'),
LayerManager: l.get('LayerManager'),
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();
},
getSelectedAll: function () {
return l.getSelectedAll();
},
getSelectedToStyle: function () {
var t = l.getSelected();
if (t) return this.StyleManager.getModelToStyle(t);
},
select: function (t) {
return l.setSelected(t), this;
},
selectAdd: function (t) {
return l.addSelected(t), this;
},
selectRemove: function (t) {
return l.removeSelected(t), this;
},
selectToggle: function (t) {
return l.toggleSelected(t), this;
},
setDevice: function (t) {
return l.set('device', t), this;
},
getDevice: function () {
return l.get('device');
},
runCommand: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = void 0,
i = l.get('Commands').get(t);
return i && (n = i.callRun(this, e)), n;
},
stopCommand: function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = void 0,
i = l.get('Commands').get(t);
return i && (n = i.callStop(this, e)), n;
},
store: function (t) {
return l.store(t);
},
load: function (t) {
return l.load(t);
},
getContainer: function () {
return e.el;
},
getDirtyCount: function () {
return l.getDirtyCount();
},
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);
},
destroy: function () {
return l.destroyAll();
},
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';
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 = c(n(20)),
o = c(n(234)),
s = n(1),
a = c(n(88)),
l = c(n(87));
function c(t) {
return t && t.__esModule ? t : { default: t };
}
(0, a.default)(),
(t.exports = (function () {
var t = new l.default(),
e = [],
n = { autorender: 1, plugins: [], pluginsOpts: {} };
return {
$: r.default,
editors: e,
plugins: t,
version: '0.14.21',
init: function () {
var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
a = r.container;
if (!a) throw new Error("'container' is required");
(r = i({}, n, r)).el = (0, s.isElement)(a) ? a : document.querySelector(a);
var l = new o.default(r).init();
return (
r.plugins.forEach(function (e) {
var n = t.get(e);
n ? n(l, r.pluginsOpts[e] || {}) : console.warn('Plugin ' + e + ' not found');
}),
l.getModel().loadOnStart(),
r.autorender && l.render(),
e.push(l),
l
);
},
};
})());
},
]);
});