Agriculture-front-end/public/imou-player/imou-player.js
2023-11-08 11:15:41 +08:00

4690 lines
281 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

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

/*! For license information please see imou-player.js.LICENSE.txt */
!(function (t, e) {
'object' == typeof exports && 'object' == typeof module
? (module.exports = e())
: 'function' == typeof define && define.amd
? define([], e)
: 'object' == typeof exports
? (exports.library = e())
: (t.library = e());
})(self, () =>
(() => {
var t = {
132: (t, e, n) => {
var i;
function a(t) {
return (
(a =
'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;
}),
a(t)
);
}
!(function (t) {
var e,
n = t.document,
i = { modules: {}, status: {}, timeout: 10, event: {} },
o = function () {
this.v = '2.6.7';
},
r = t.LAYUI_GLOBAL || {},
s =
((e = n.currentScript
? n.currentScript.src
: (function () {
for (
var t, e = n.scripts, i = e.length - 1, a = i;
a > 0;
a--
)
if ('interactive' === e[a].readyState) {
t = e[a].src;
break;
}
return t || e[i].src;
})()),
(i.dir = r.dir || e.substring(0, e.lastIndexOf('/') + 1))),
c = function (e, n) {
(n = n || 'log'),
t.console &&
console[n] &&
console[n]('layui error hint: '.concat(e));
},
l =
'undefined' != typeof opera &&
'[object Opera]' === opera.toString(),
u = (i.builtin = {
lay: 'lay',
layer: 'layer',
laydate: 'laydate',
laypage: 'laypage',
laytpl: 'laytpl',
layedit: 'layedit',
form: 'form',
upload: 'upload',
dropdown: 'dropdown',
transfer: 'transfer',
tree: 'tree',
table: 'table',
element: 'element',
rate: 'rate',
colorpicker: 'colorpicker',
slider: 'slider',
carousel: 'carousel',
flow: 'flow',
util: 'util',
code: 'code',
jquery: 'jquery',
all: 'all',
'layui.all': 'layui.all',
});
(o.prototype.cache = i),
(o.prototype.define = function (t, e) {
return (
'function' == typeof t && ((e = t), (t = [])),
this.use(
t,
function () {
var t = function (t, e) {
(m[t] = e), (i.status[t] = !0);
};
return (
'function' == typeof e &&
e(function (n, a) {
t(n, a),
(i.callback[n] = function () {
e(t);
});
}),
this
);
},
null,
'define'
),
this
);
}),
(o.prototype.use = function (e, a, o, r) {
var d = this,
h = (i.dir = i.dir ? i.dir : s),
y = n.getElementsByTagName('head')[0];
(e =
'string' == typeof e
? [e]
: 'function' == typeof e
? ((a = e), ['all'])
: e),
t.jQuery &&
jQuery.fn.on &&
(d.each(e, function (t, n) {
'jquery' === n && e.splice(t, 1);
}),
(m.jquery = m.$ = jQuery));
var f = e[0],
p = 0;
function g(t, e) {
var n =
'PLaySTATION 3' === navigator.platform
? /^complete$/
: /^(complete|loaded)$/;
('load' === t.type ||
n.test((t.currentTarget || t.srcElement).readyState)) &&
((i.modules[f] = e),
y.removeChild(T),
(function t() {
if (++p > (1e3 * i.timeout) / 4)
return c(
''.concat(f, ' is not a valid module'),
'error'
);
i.status[f] ? v() : setTimeout(t, 4);
})());
}
function v() {
o.push(m[f]),
e.length > 1
? d.use(e.slice(1), a, o, r)
: 'function' == typeof a &&
(function () {
if (
m.jquery &&
'function' == typeof m.jquery &&
'define' !== r
)
return m.jquery(function () {
a.apply(m, o);
});
a.apply(m, o);
})();
}
if (
((o = o || []),
(i.host =
i.host ||
(h.match(/\/\/([\s\S]+?)\//) || [
'//'.concat(location.host, '/'),
])[0]),
0 === e.length || (m['layui.all'] && u[f]))
)
return v(), d;
var b,
w = ''.concat(
(u[f]
? ''.concat(h, 'modules/')
: /^\{\/\}/.test(d.modules[f])
? ''
: i.base || '') + (d.modules[f] || f),
'.js'
);
if (
((w = w.replace(/^\{\/\}/, '')),
!i.modules[f] && m[f] && (i.modules[f] = w),
i.modules[f])
)
!(function t() {
if (++p > (1e3 * i.timeout) / 4)
return c(
''.concat(f, ' is not a valid module'),
'error'
);
'string' == typeof i.modules[f] && i.status[f]
? v()
: setTimeout(t, 4);
})();
else {
var T = n.createElement('script');
(T.async = !0),
(T.charset = 'utf-8'),
(T.src =
w +
((b =
!0 === i.version
? i.v || new Date().getTime()
: i.version || '')
? '?v='.concat(b)
: '')),
y.appendChild(T),
!T.attachEvent ||
(T.attachEvent.toString &&
T.attachEvent.toString().indexOf('[native code') < 0) ||
l
? T.addEventListener(
'load',
function (t) {
g(t, w);
},
!1
)
: T.attachEvent('onreadystatechange', function (t) {
g(t, w);
}),
(i.modules[f] = w);
}
return d;
}),
(o.prototype.getStyle = function (e, n) {
var i = e.currentStyle
? e.currentStyle
: t.getComputedStyle(e, null);
return i[i.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](
n
);
}),
(o.prototype.link = function (t, e, a) {
var o = this,
r = n.getElementsByTagName('head')[0],
s = n.createElement('link');
'string' == typeof e && (a = e);
var l = (a || t).replace(/\.|\//g, ''),
u = (s.id = 'layuicss-'.concat(l)),
d = 'creating',
h = 0;
return (
(s.rel = 'stylesheet'),
(s.href =
t + (i.debug ? '?v='.concat(new Date().getTime()) : '')),
(s.media = 'all'),
n.getElementById(u) || r.appendChild(s),
'function' != typeof e ||
(function a(r) {
var s = n.getElementById(u);
if (++h > (1e3 * i.timeout) / 100)
return c(''.concat(t, ' timeout'));
1989 === parseInt(o.getStyle(s, 'width'))
? (r === d && s.removeAttribute('lay-status'),
s.getAttribute('lay-status') === d
? setTimeout(a, 100)
: e())
: (s.setAttribute('lay-status', d),
setTimeout(function () {
a(d);
}, 100));
})(),
o
);
}),
(o.prototype.addcss = function (t, e, n) {
return function () {};
}),
(i.callback = {}),
(o.prototype.factory = function (t) {
if (m[t])
return 'function' == typeof i.callback[t]
? i.callback[t]
: null;
}),
(o.prototype.img = function (t, e, n) {
var i = new Image();
if (((i.src = t), i.complete)) return e(i);
(i.onload = function () {
(i.onload = null), 'function' == typeof e && e(i);
}),
(i.onerror = function (t) {
(i.onerror = null), 'function' == typeof n && n(t);
});
}),
(o.prototype.config = function (t) {
for (var e in (t = t || {})) i[e] = t[e];
return this;
}),
(o.prototype.modules = (function () {
var t = {};
for (var e in u) t[e] = u[e];
return t;
})()),
(o.prototype.extend = function (t) {
var e = this;
for (var n in (t = t || {}))
e[n] || e.modules[n]
? c(''.concat(n, ' Module already exists'), 'error')
: (e.modules[n] = t[n]);
return e;
}),
(o.prototype.router = function (t) {
var e = {
path: [],
search: {},
hash:
((t = t || location.hash).match(/[^#](#.*$)/) || [])[1] ||
'',
};
return /^#\//.test(t)
? ((t = t.replace(/^#\//, '')),
(e.href = '/'.concat(t)),
(t = t.replace(/([^#])(#.*$)/, '$1').split('/') || []),
this.each(t, function (t, n) {
/^\w+=/.test(n)
? ((n = n.split('=')), (e.search[n[0]] = n[1]))
: e.path.push(n);
}),
e)
: e;
}),
(o.prototype.url = function (t) {
var e, n;
return {
pathname: (t
? ((t.match(/\.[^.]+?\/.+/) || [])[0] || '')
.replace(/^[^\/]+/, '')
.replace(/\?.+/, '')
: location.pathname
)
.replace(/^\//, '')
.split('/'),
search:
((e = {}),
(n = (
t
? ((t.match(/\?.+/) || [])[0] || '').replace(
/\#.+/,
''
)
: location.search
)
.replace(/^\?+/, '')
.split('&')),
this.each(n, function (t, n) {
var i = n.indexOf('='),
a =
i < 0
? n.substr(0, n.length)
: 0 !== i && n.substr(0, i);
a && (e[a] = i > 0 ? n.substr(i + 1) : null);
}),
e),
hash: this.router(
t ? (t.match(/#.+/) || [])[0] || '/' : location.hash
),
};
}),
(o.prototype.data = function (e, n, i) {
if (
((e = e || 'layui'),
(i = i || localStorage),
t.JSON && t.JSON.parse)
) {
if (null === n) return delete i[e];
n = 'object' === a(n) ? n : { key: n };
try {
var o = JSON.parse(i[e]);
} catch (t) {
o = {};
}
return (
'value' in n && (o[n.key] = n.value),
n.remove && delete o[n.key],
(i[e] = JSON.stringify(o)),
n.key ? o[n.key] : o
);
}
}),
(o.prototype.sessionData = function (t, e) {
return this.data(t, e, sessionStorage);
}),
(o.prototype.device = function (e) {
var n = navigator.userAgent.toLowerCase(),
i = function (t) {
var e = new RegExp(''.concat(t, '/([^\\s\\_\\-]+)'));
return (t = (n.match(e) || [])[1]) || !1;
},
a = {
os: /windows/.test(n)
? 'windows'
: /linux/.test(n)
? 'linux'
: /iphone|ipod|ipad|ios/.test(n)
? 'ios'
: /mac/.test(n)
? 'mac'
: void 0,
ie:
!(!t.ActiveXObject && !('ActiveXObject' in t)) &&
((n.match(/msie\s(\d+)/) || [])[1] || '11'),
weixin: i('micromessenger'),
};
return (
e && !a[e] && (a[e] = i(e)),
(a.android = /android/.test(n)),
(a.ios = 'ios' === a.os),
(a.mobile = !(!a.android && !a.ios)),
a
);
}),
(o.prototype.hint = function () {
return { error: c };
}),
(o.prototype._typeof = function (t) {
return null === t
? String(t)
: 'object' === a(t) || 'function' == typeof t
? ((e =
(e =
Object.prototype.toString
.call(t)
.match(/\s(.+)\]$/) || [])[1] || 'Object'),
new RegExp(
'\\b('.concat(
'Function|Array|Date|RegExp|Object|Error|Symbol',
')\\b'
)
).test(e)
? e.toLowerCase()
: 'object')
: a(t);
var e;
}),
(o.prototype._isArray = function (e) {
var n,
i = this._typeof(e);
return (
!(!e || 'object' !== a(e) || e === t) &&
((n = 'length' in e && e.length),
'array' === i ||
0 === n ||
('number' == typeof n && n > 0 && n - 1 in e))
);
}),
(o.prototype.each = function (t, e) {
var n,
i = this,
a = function (t, n) {
return e.call(n[t], t, n[t]);
};
if ('function' != typeof e) return i;
if (((t = t || []), i._isArray(t)))
for (n = 0; n < t.length && !a(n, t); n++);
else for (n in t) if (a(n, t)) break;
return i;
}),
(o.prototype.sort = function (t, e, n) {
var i = JSON.parse(JSON.stringify(t || []));
return e
? (i.sort(function (t, n) {
var i = /^-?\d+$/,
a = t[e],
o = n[e];
return (
i.test(a) && (a = parseFloat(a)),
i.test(o) && (o = parseFloat(o)),
a - o
);
}),
n && i.reverse(),
i)
: i;
}),
(o.prototype.stope = function (e) {
e = e || t.event;
try {
e.stopPropagation();
} catch (t) {
e.cancelBubble = !0;
}
});
var d = 'LAYUI-EVENT-REMOVE';
(o.prototype.onevent = function (t, e, n) {
return 'string' != typeof t || 'function' != typeof n
? this
: o.event(t, e, null, n);
}),
(o.prototype.event = o.event =
function (t, e, n, a) {
var o = this,
r = null,
s = (e || '').match(/\((.*)\)$/) || [],
c = ''.concat(t, '.').concat(e).replace(s[0], ''),
l = s[1] || '',
u = function (t, e) {
!1 === (e && e.call(o, n)) && null === r && (r = !1);
};
return n === d
? (delete (o.cache.event[c] || {})[l], o)
: a
? ((i.event[c] = i.event[c] || {}),
(i.event[c][l] = [a]),
this)
: (m.each(i.event[c], function (t, e) {
'{*}' !== l
? ('' === t && m.each(e, u),
l && t === l && m.each(e, u))
: m.each(e, u);
}),
r);
}),
(o.prototype.on = function (t, e, n) {
return this.onevent.call(this, e, t, n);
}),
(o.prototype.off = function (t, e) {
return this.event.call(this, e, t, d);
});
var h,
m = new o(),
y = window.document,
f = function (t) {
return new p(t);
},
p = function (t) {
for (
var e = 0,
n =
'object' === a(t)
? [t]
: ((this.selector = t),
y.querySelectorAll(t || null));
e < n.length;
e++
)
this.push(n[e]);
};
(p.prototype = []),
(p.prototype.constructor = p),
(f.extend = function () {
var t = 1,
e = arguments,
n = function t(e, n) {
for (var i in ((e =
e || (n.constructor === Array ? [] : {})),
n))
e[i] =
n[i] && n[i].constructor === Object
? t(e[i], n[i])
: n[i];
return e;
};
for (e[0] = 'object' === a(e[0]) ? e[0] : {}; t < e.length; t++)
'object' === a(e[t]) && n(e[0], e[t]);
return e[0];
}),
(f.v = '1.0.7'),
(f.ie =
((h = navigator.userAgent.toLowerCase()),
!(!window.ActiveXObject && !('ActiveXObject' in window)) &&
((h.match(/msie\s(\d+)/) || [])[1] || '11'))),
(f.layui = m),
(f.getPath = m.cache.dir),
(f.stope = m.stope),
(f.each = function () {
return m.each.apply(m, arguments), this;
}),
(f.digit = function (t, e, n) {
var i = '';
e = e || 2;
for (var a = (t = String(t)).length; a < e; a++) i += '0';
return t < Math.pow(10, e) ? i + (0 | t) : t;
}),
(f.elem = function (t, e) {
var n = y.createElement(t);
return (
f.each(e || {}, function (t, e) {
n.setAttribute(t, e);
}),
n
);
}),
(f.hasScrollbar = function () {
return (
y.body.scrollHeight >
(window.innerHeight || y.documentElement.clientHeight)
);
}),
(f.position = function (t, e, n) {
if (e) {
(n = n || {}),
(t !== y && t !== f('body')[0]) || (n.clickType = 'right');
var i,
a =
'right' === n.clickType
? {
left: (i = n.e || window.event || {}).clientX,
top: i.clientY,
right: i.clientX,
bottom: i.clientY,
}
: t.getBoundingClientRect(),
o = e.offsetWidth,
r = e.offsetHeight,
s = function (t) {
return (
(t = t ? 'scrollLeft' : 'scrollTop'),
y.body[t] | y.documentElement[t]
);
},
c = function (t) {
return y.documentElement[
t ? 'clientWidth' : 'clientHeight'
];
},
l = a.left,
u = a.bottom;
l + o + 5 > c('width') && (l = c('width') - o - 5),
u + r + 5 > c() &&
(a.top > r + 5
? (u = a.top - r - 10)
: 'right' === n.clickType &&
(u = c() - r - 10) < 0 &&
(u = 0));
var d = n.position;
if (
(d && (e.style.position = d),
(e.style.left = ''.concat(
l + ('fixed' === d ? 0 : s(1)),
'px'
)),
(e.style.top = ''.concat(
u + ('fixed' === d ? 0 : s()),
'px'
)),
!f.hasScrollbar())
) {
var h = e.getBoundingClientRect();
!n.SYSTEM_RELOAD &&
h.bottom + 5 > c() &&
((n.SYSTEM_RELOAD = !0),
setTimeout(function () {
f.position(t, e, n);
}, 50));
}
}
}),
(f.options = function (t, e) {
var n = f(t),
i = e || 'lay-options';
try {
return new Function('return '.concat(n.attr(i) || '{}'))();
} catch (t) {
return hint.error('parseerror'.concat(t), 'error'), {};
}
}),
(f.isTopElem = function (t) {
var e = [y, f('body')[0]],
n = !1;
return (
f.each(e, function (e, i) {
if (i === t) return (n = !0);
}),
n
);
}),
(p.addStr = function (t, e) {
return (
(t = t.replace(/\s+/, ' ')),
(e = e.replace(/\s+/, ' ').split(' ')),
f.each(e, function (e, n) {
new RegExp('\\b'.concat(n, '\\b')).test(t) ||
(t = ''.concat(t, ' ').concat(n));
}),
t.replace(/^\s|\s$/, '')
);
}),
(p.removeStr = function (t, e) {
return (
(t = t.replace(/\s+/, ' ')),
(e = e.replace(/\s+/, ' ').split(' ')),
f.each(e, function (e, n) {
var i = new RegExp('\\b'.concat(n, '\\b'));
i.test(t) && (t = t.replace(i, ''));
}),
t.replace(/\s+/, ' ').replace(/^\s|\s$/, '')
);
}),
(p.prototype.find = function (t) {
var e = this,
n = 0,
i = [],
o = 'object' === a(t);
return (
this.each(function (a, r) {
for (
var s = o
? r.contains(t)
: r.querySelectorAll(t || null);
n < s.length;
n++
)
i.push(s[n]);
e.shift();
}),
o ||
(e.selector =
(e.selector ? ''.concat(e.selector, ' ') : '') + t),
f.each(i, function (t, n) {
e.push(n);
}),
e
);
}),
(p.prototype.each = function (t) {
return f.each.call(this, this, t);
}),
(p.prototype.addClass = function (t, e) {
return this.each(function (n, i) {
i.className = p[e ? 'removeStr' : 'addStr'](i.className, t);
});
}),
(p.prototype.removeClass = function (t) {
return this.addClass(t, !0);
}),
(p.prototype.hasClass = function (t) {
var e = !1;
return (
this.each(function (n, i) {
new RegExp('\\b'.concat(t, '\\b')).test(i.className) &&
(e = !0);
}),
e
);
}),
(p.prototype.css = function (t, e) {
var n = this,
i = function (t) {
return isNaN(t) ? t : ''.concat(t, 'px');
};
return 'string' == typeof t && void 0 === e
? (function () {
if (n.length > 0) return n[0].style[t];
})()
: n.each(function (n, o) {
'object' === a(t)
? f.each(t, function (t, e) {
o.style[t] = i(e);
})
: (o.style[t] = i(e));
});
}),
(p.prototype.width = function (t) {
var e = this;
return void 0 === t
? (function () {
if (e.length > 0) return e[0].offsetWidth;
})()
: e.each(function (n, i) {
e.css('width', t);
});
}),
(p.prototype.height = function (t) {
var e = this;
return void 0 === t
? (function () {
if (e.length > 0) return e[0].offsetHeight;
})()
: e.each(function (n, i) {
e.css('height', t);
});
}),
(p.prototype.attr = function (t, e) {
var n = this;
return void 0 === e
? (function () {
if (n.length > 0) return n[0].getAttribute(t);
})()
: n.each(function (n, i) {
i.setAttribute(t, e);
});
}),
(p.prototype.removeAttr = function (t) {
return this.each(function (e, n) {
n.removeAttribute(t);
});
}),
(p.prototype.html = function (t) {
var e = this;
return void 0 === t
? (function () {
if (e.length > 0) return e[0].innerHTML;
})()
: this.each(function (e, n) {
n.innerHTML = t;
});
}),
(p.prototype.val = function (t) {
var e = this;
return void 0 === t
? (function () {
if (e.length > 0) return e[0].value;
})()
: this.each(function (e, n) {
n.value = t;
});
}),
(p.prototype.append = function (t) {
return this.each(function (e, n) {
'object' === a(t) ? n.appendChild(t) : (n.innerHTML += t);
});
}),
(p.prototype.remove = function (t) {
return this.each(function (e, n) {
t ? n.removeChild(t) : n.parentNode.removeChild(n);
});
}),
(p.prototype.on = function (t, e) {
return this.each(function (n, i) {
i.attachEvent
? i.attachEvent('on'.concat(t), function (t) {
(t.target = t.srcElement), e.call(i, t);
})
: i.addEventListener(t, e, !1);
});
}),
(p.prototype.off = function (t, e) {
return this.each(function (n, i) {
i.detachEvent
? i.detachEvent('on'.concat(t), e)
: i.removeEventListener(t, e, !1);
});
}),
(window.lay = f),
window.layui &&
m.define &&
m.define(function (t) {
t('lay', f);
});
})(window, window.document),
(function (a, o) {
var r = a.layui && layui.define,
s = {
getPath: a.lay && lay.getPath ? lay.getPath : '',
link: function (t, e, n) {
e();
},
},
c = a.LAYUI_GLOBAL || {},
l = {
v: '5.3.1',
config: {},
index: a.laydate && a.laydate.v ? 1e5 : 0,
path: c.laydate_dir || s.getPath,
set: function (t) {
var e = this;
return (e.config = lay.extend({}, e.config, t)), e;
},
ready: function (t) {
var e = 'laydate',
n = ''
.concat(
r ? 'modules/laydate/' : 'theme/',
'default/laydate.css?v='
)
.concat(l.v)
.concat('');
return r ? layui.addcss(n, t, e) : s.link(n, t, e), this;
},
},
u = function t() {
var e = this,
n = e.config.id;
return (
(t.that[n] = e),
{
hint: function (t) {
e.hint.call(e, t);
},
config: e.config,
}
);
},
d = 'laydate',
h = 'layui-this',
m = 'laydate-disabled',
y = [100, 2e5],
f = 'layui-laydate-static',
p = 'layui-laydate-list',
g = 'layui-laydate-hint',
v = '.laydate-btns-confirm',
b = 'laydate-time-text',
w = 'laydate-btns-time',
T = 'layui-laydate-preview',
_ = function (t) {
var e = this;
(e.index = ++l.index),
(e.config = lay.extend({}, e.config, l.config, t)),
((t = e.config).id = 'id' in t ? t.id : e.index),
l.ready(function () {
e.init();
});
},
x = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s';
(u.formatArr = function (t) {
return (t || '').match(new RegExp(''.concat(x, '|.'), 'g')) || [];
}),
(_.isLeapYear = function (t) {
return (t % 4 == 0 && t % 100 != 0) || t % 400 == 0;
}),
(_.prototype.config = {
type: 'date',
range: !1,
format: 'yyyy-MM-dd',
value: null,
isInitValue: !0,
min: '1900-1-1',
max: '2099-12-31',
trigger: 'click',
show: !1,
showBottom: !0,
isPreview: !0,
btns: ['clear', 'now', 'confirm'],
lang: 'cn',
theme: 'default',
position: null,
calendar: !1,
mark: {},
zIndex: null,
done: null,
change: null,
}),
(_.prototype.lang = function () {
var t = {
cn: {
weeks: ['日', '一', '二', '三', '四', '五', '六'],
time: ['时', '分', '秒'],
timeTips: '选择时间',
startTime: '开始时间',
endTime: '结束时间',
dateTips: '返回日期',
month: [
'一',
'二',
'三',
'四',
'五',
'六',
'七',
'八',
'九',
'十',
'十一',
'十二',
],
tools: { confirm: '确定', clear: '清空', now: '现在' },
timeout: '结束时间不能早于开始时间<br>请重新选择',
invalidDate: '不在有效日期或时间范围内',
formatError: [
'日期格式不合法<br>必须遵循下述格式:<br>',
'<br>已为你重置',
],
preview: '当前选中的结果',
},
en: {
weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
time: ['Hours', 'Minutes', 'Seconds'],
timeTips: 'Select Time',
startTime: 'Start Time',
endTime: 'End Time',
dateTips: 'Select Date',
month: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
tools: {
confirm: 'Confirm',
clear: 'Clear',
now: 'Now',
},
timeout:
'End time cannot be less than start Time<br>Please re-select',
invalidDate: 'Invalid date',
formatError: [
'The date format error<br>Must be followed<br>',
'<br>It has been reset',
],
preview: 'The selected result',
},
};
return t[this.config.lang] || t.cn;
}),
(_.prototype.init = function () {
var t = this,
e = t.config,
n = 'static' === e.position,
i = {
year: 'yyyy',
month: 'yyyy-MM',
date: 'yyyy-MM-dd',
time: 'HH:mm:ss',
datetime: 'yyyy-MM-dd HH:mm:ss',
};
(e.elem = lay(e.elem)),
(e.eventElem = lay(e.eventElem)),
e.elem[0] &&
((t.rangeStr = e.range
? 'string' == typeof e.range
? e.range
: '-'
: ''),
e.range &&
e.range.constructor === Array &&
(t.rangeElem = [lay(e.range[0]), lay(e.range[1])]),
i[e.type] ||
(a.console &&
console.error &&
console.error(
"laydate type error:'".concat(
e.type,
"' is not supported"
)
),
(e.type = 'date')),
e.format === i.date && (e.format = i[e.type] || i.date),
(t.format = u.formatArr(e.format)),
(t.EXP_IF = ''),
(t.EXP_SPLIT = ''),
lay.each(t.format, function (e, n) {
var i = new RegExp(x).test(n)
? '\\d{'.concat(
new RegExp(x).test(
t.format[0 === e ? e + 1 : e - 1] ||
''
)
? /^yyyy|y$/.test(n)
? 4
: n.length
: /^yyyy$/.test(n)
? '1,4'
: /^y$/.test(n)
? '1,308'
: '1,2',
'}'
)
: '\\'.concat(n);
(t.EXP_IF += i),
(t.EXP_SPLIT = ''
.concat(t.EXP_SPLIT, '(')
.concat(i, ')'));
}),
(t.EXP_IF_ONE = new RegExp('^'.concat(t.EXP_IF, '$'))),
(t.EXP_IF = new RegExp(
'^'.concat(
e.range
? ''
.concat(t.EXP_IF, '\\s\\')
.concat(t.rangeStr, '\\s')
.concat(t.EXP_IF)
: t.EXP_IF,
'$'
)
)),
(t.EXP_SPLIT = new RegExp(
'^'.concat(t.EXP_SPLIT, '$'),
''
)),
t.isInput(e.elem[0]) ||
('focus' === e.trigger && (e.trigger = 'click')),
e.elem.attr('lay-key') ||
(e.elem.attr('lay-key', t.index),
e.eventElem.attr('lay-key', t.index)),
(e.mark = lay.extend(
{},
e.calendar && 'cn' === e.lang
? {
'0-1-1': '元旦',
'0-2-14': '情人',
'0-3-8': '妇女',
'0-3-12': '植树',
'0-4-1': '愚人',
'0-5-1': '劳动',
'0-5-4': '青年',
'0-6-1': '儿童',
'0-9-10': '教师',
'0-9-18': '国耻',
'0-10-1': '国庆',
'0-12-25': '圣诞',
}
: {},
e.mark
)),
lay.each(['min', 'max'], function (t, n) {
var i = [],
a = [];
if ('number' == typeof e[n]) {
var o = e[n],
r = new Date().getTime(),
s = 864e5,
c = new Date(
o ? (o < s ? r + o * s : o) : r
);
(i = [
c.getFullYear(),
c.getMonth() + 1,
c.getDate(),
]),
o < s ||
(a = [
c.getHours(),
c.getMinutes(),
c.getSeconds(),
]);
} else (i = (e[n].match(/\d+-\d+-\d+/) || [''])[0].split('-')), (a = (e[n].match(/\d+:\d+:\d+/) || [''])[0].split(':'));
e[n] = {
year: 0 | i[0] || new Date().getFullYear(),
month: i[1]
? (0 | i[1]) - 1
: new Date().getMonth(),
date: 0 | i[2] || new Date().getDate(),
hours: 0 | a[0],
minutes: 0 | a[1],
seconds: 0 | a[2],
};
}),
(t.elemID = 'layui-laydate'.concat(
e.elem.attr('lay-key')
)),
(e.show || n) && t.render(),
n || t.events(),
e.value &&
e.isInitValue &&
(e.value.constructor === Date
? t.setValue(t.parse(0, t.systemDate(e.value)))
: t.setValue(e.value)));
}),
(_.prototype.render = function () {
var t,
e,
n = this,
i = n.config,
a = n.lang(),
r = 'static' === i.position,
s = (n.elem = lay.elem('div', {
id: n.elemID,
class: [
'layui-laydate',
i.range ? ' layui-laydate-range' : '',
r ? ' '.concat(f) : '',
i.theme &&
'default' !== i.theme &&
!/^#/.test(i.theme)
? ' laydate-theme-'.concat(i.theme)
: '',
].join(''),
})),
c = (n.elemMain = []),
u = (n.elemHeader = []),
d = (n.elemCont = []),
h = (n.table = []),
m = (n.footer = lay.elem('div', {
class: 'layui-laydate-footer',
}));
if (
(i.zIndex && (s.style.zIndex = i.zIndex),
lay.each(new Array(2), function (t) {
if (!i.range && t > 0) return !0;
var e = lay.elem('div', {
class: 'layui-laydate-header',
}),
n = [
(function () {
var t = lay.elem('i', {
class: 'layui-icon laydate-icon laydate-prev-y',
});
return (t.innerHTML = '<<'), t;
})(),
(function () {
var t = lay.elem('i', {
class: 'layui-icon laydate-icon laydate-prev-m',
});
return (t.innerHTML = '<'), t;
})(),
(function () {
var t = lay.elem('div', {
class: 'laydate-set-ym',
}),
e = lay.elem('span'),
n = lay.elem('span');
return (
t.appendChild(e), t.appendChild(n), t
);
})(),
(function () {
var t = lay.elem('i', {
class: 'layui-icon laydate-icon laydate-next-m',
});
return (t.innerHTML = '>'), t;
})(),
(function () {
var t = lay.elem('i', {
class: 'layui-icon laydate-icon laydate-next-y',
});
return (t.innerHTML = '>>'), t;
})(),
],
o = lay.elem('div', {
class: 'layui-laydate-content',
}),
r = lay.elem('table'),
s = lay.elem('thead'),
l = lay.elem('tr');
lay.each(n, function (t, n) {
e.appendChild(n);
}),
s.appendChild(l),
lay.each(new Array(6), function (t) {
var e = r.insertRow(0);
lay.each(new Array(7), function (n) {
if (0 === t) {
var i = lay.elem('th');
(i.innerHTML = a.weeks[n]),
l.appendChild(i);
}
e.insertCell(n);
});
}),
r.insertBefore(s, r.children[0]),
o.appendChild(r),
(c[t] = lay.elem('div', {
class: 'layui-laydate-main laydate-main-list-'.concat(
t
),
})),
c[t].appendChild(e),
c[t].appendChild(o),
u.push(n),
d.push(o),
h.push(r);
}),
lay(m).html(
((t = []),
(e = []),
'datetime' === i.type &&
t.push(
'<span lay-type="datetime" class="'
.concat(w, '">')
.concat(a.timeTips, '</span>')
),
(i.range || 'datetime' !== i.type) &&
t.push(
'<span class="'
.concat(T, '" title="')
.concat(a.preview, '"></span>')
),
lay.each(i.btns, function (t, n) {
var o = a.tools[n] || 'btn';
(i.range && 'now' === n) ||
(r &&
'clear' === n &&
(o = 'cn' === i.lang ? '重置' : 'Reset'),
e.push(
'<span lay-type="'
.concat(n, '" class="laydate-btns-')
.concat(n, '">')
.concat(o, '</span>')
));
}),
t.push(
'<div class="laydate-footer-btns">'.concat(
e.join(''),
'</div>'
)
),
t.join(''))
),
lay.each(c, function (t, e) {
s.appendChild(e);
}),
i.showBottom && s.appendChild(m),
/^#/.test(i.theme))
) {
var y = lay.elem('style'),
p = [
'#{{id}} .layui-laydate-header{background-color:{{theme}};}',
'#{{id}} .layui-this{background-color:{{theme}} !important;}',
]
.join('')
.replace(/{{id}}/g, n.elemID)
.replace(/{{theme}}/g, i.theme);
'styleSheet' in y
? (y.setAttribute('type', 'text/css'),
(y.styleSheet.cssText = p))
: (y.innerHTML = p),
lay(s).addClass('laydate-theme-molv'),
s.appendChild(y);
}
(l.thisId = i.id),
n.remove(_.thisElemDate),
r
? i.elem.append(s)
: (o.body.appendChild(s), n.position()),
n.checkDate().calendar(null, 0, 'init'),
n.changeEvent(),
(_.thisElemDate = n.elemID),
'function' == typeof i.ready &&
i.ready(
lay.extend({}, i.dateTime, {
month: i.dateTime.month + 1,
})
),
n.preview();
}),
(_.prototype.remove = function (t) {
var e = this,
n = (e.config, lay('#'.concat(t || e.elemID)));
return n[0]
? (n.hasClass(f) ||
e.checkDate(function () {
n.remove();
}),
e)
: e;
}),
(_.prototype.position = function () {
var t = this,
e = t.config;
return (
lay.position(t.bindElem || e.elem[0], t.elem, {
position: e.position,
}),
t
);
}),
(_.prototype.hint = function (t) {
var e = this,
n = (e.config, lay.elem('div', { class: g }));
e.elem &&
((n.innerHTML = t || ''),
lay(e.elem).find('.'.concat(g)).remove(),
e.elem.appendChild(n),
clearTimeout(e.hinTimer),
(e.hinTimer = setTimeout(function () {
lay(e.elem).find('.'.concat(g)).remove();
}, 3e3)));
}),
(_.prototype.getAsYM = function (t, e, n) {
return (
n ? e-- : e++,
e < 0 && ((e = 11), t--),
e > 11 && ((e = 0), t++),
[t, e]
);
}),
(_.prototype.systemDate = function (t) {
var e = t || new Date();
return {
year: e.getFullYear(),
month: e.getMonth(),
date: e.getDate(),
hours: t ? t.getHours() : 0,
minutes: t ? t.getMinutes() : 0,
seconds: t ? t.getSeconds() : 0,
};
}),
(_.prototype.checkDate = function (t) {
var e,
n,
i = this,
a = (new Date(), i.config),
o = i.lang(),
r = (a.dateTime = a.dateTime || i.systemDate()),
s = i.bindElem || a.elem[0],
c =
(i.isInput(s),
(function () {
if (i.rangeElem) {
var t = [
i.rangeElem[0].val(),
i.rangeElem[1].val(),
];
if (t[0] && t[1])
return t.join(' '.concat(i.rangeStr, ' '));
}
return i.isInput(s)
? s.value
: 'static' === a.position
? ''
: lay(s).attr('lay-date');
})()),
u = function (t) {
t.year > y[1] && ((t.year = y[1]), (n = !0)),
t.month > 11 && ((t.month = 11), (n = !0)),
t.hours > 23 && ((t.hours = 0), (n = !0)),
t.minutes > 59 &&
((t.minutes = 0), t.hours++, (n = !0)),
t.seconds > 59 &&
((t.seconds = 0), t.minutes++, (n = !0)),
(e = l.getEndDate(t.month + 1, t.year)),
t.date > e && ((t.date = e), (n = !0));
},
d = function (t, e, o) {
var r = ['startTime', 'endTime'];
(e = (e.match(i.EXP_SPLIT) || []).slice(1)),
(o = o || 0),
a.range && (i[r[o]] = i[r[o]] || {}),
lay.each(i.format, function (s, c) {
var l = parseFloat(e[s]);
e[s].length < c.length && (n = !0),
/yyyy|y/.test(c)
? (l < y[0] && ((l = y[0]), (n = !0)),
(t.year = l))
: /MM|M/.test(c)
? (l < 1 && ((l = 1), (n = !0)),
(t.month = l - 1))
: /dd|d/.test(c)
? (l < 1 && ((l = 1), (n = !0)),
(t.date = l))
: /HH|H/.test(c)
? (l < 1 && ((l = 0), (n = !0)),
(t.hours = l),
a.range && (i[r[o]].hours = l))
: /mm|m/.test(c)
? (l < 1 && ((l = 0), (n = !0)),
(t.minutes = l),
a.range && (i[r[o]].minutes = l))
: /ss|s/.test(c) &&
(l < 1 && ((l = 0), (n = !0)),
(t.seconds = l),
a.range && (i[r[o]].seconds = l));
}),
u(t);
};
if ('limit' === t) return u(r), i;
'string' == typeof (c = c || a.value) &&
(c = c.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''));
var h = function () {
a.range &&
(i.endDate =
i.endDate ||
lay.extend(
{},
a.dateTime,
(function () {
var t = {},
e = a.dateTime,
n = i.getAsYM(e.year, e.month);
return (
'year' === a.type
? (t.year = e.year + 1)
: 'time' !== a.type &&
((t.year = n[0]),
(t.month = n[1])),
('datetime' !== a.type &&
'time' !== a.type) ||
((t.hours = 23),
(t.minutes = t.seconds = 59)),
t
);
})()
));
};
h(),
'string' == typeof c && c
? i.EXP_IF.test(c)
? a.range
? ((c = c.split(' '.concat(i.rangeStr, ' '))),
lay.each(
[a.dateTime, i.endDate],
function (t, e) {
d(e, c[t], t);
}
))
: d(r, c)
: (i.hint(
o.formatError[0] +
(a.range
? ''
.concat(a.format, ' ')
.concat(i.rangeStr, ' ')
.concat(a.format)
: a.format) +
o.formatError[1]
),
(n = !0))
: c && c.constructor === Date
? (a.dateTime = i.systemDate(c))
: ((a.dateTime = i.systemDate()),
delete i.startTime,
delete i.endDate,
h(),
delete i.endTime),
(function () {
if (i.rangeElem) {
var t = [
i.rangeElem[0].val(),
i.rangeElem[1].val(),
],
e = [a.dateTime, i.endDate];
lay.each(t, function (t, n) {
i.EXP_IF_ONE.test(n) && d(e[t], n, t);
});
}
})(),
u(r),
a.range && u(i.endDate),
n &&
c &&
i.setValue(
a.range ? (i.endDate ? i.parse() : '') : i.parse()
);
var m = function (t) {
return i.newDate(t).getTime();
};
return (
(m(r) > m(a.max) || m(r) < m(a.min)) &&
(r = a.dateTime = lay.extend({}, a.min)),
a.range &&
(m(i.endDate) < m(a.min) || m(i.endDate) > m(a.max)) &&
(i.endDate = lay.extend({}, a.max)),
t && t(),
i
);
}),
(_.prototype.mark = function (t, e) {
var n,
i = this.config;
return (
lay.each(i.mark, function (t, i) {
var a = t.split('-');
(a[0] != e[0] && 0 != a[0]) ||
(a[1] != e[1] && 0 != a[1]) ||
a[2] != e[2] ||
(n = i || e[2]);
}),
n &&
t.html(
'<span class="laydate-day-mark">'.concat(
n,
'</span>'
)
),
this
);
}),
(_.prototype.limit = function (t, e, n, i) {
var a,
o = this,
r = o.config,
s = {},
c = r[n > 41 ? 'endDate' : 'dateTime'],
l = lay.extend({}, c, e || {});
return (
lay.each(
{ now: l, min: r.min, max: r.max },
function (t, e) {
var n;
s[t] = o
.newDate(
lay.extend(
{
year: e.year,
month: e.month,
date: e.date,
},
((n = {}),
lay.each(i, function (t, i) {
n[i] = e[i];
}),
n)
)
)
.getTime();
}
),
(a = s.now < s.min || s.now > s.max),
t && t[a ? 'addClass' : 'removeClass'](m),
a
);
}),
(_.prototype.thisDateTime = function (t) {
var e = this.config;
return t ? this.endDate : e.dateTime;
}),
(_.prototype.calendar = function (t, e, n) {
var i,
a,
o,
r = this,
s = r.config,
c = ((e = e ? 1 : 0), t || r.thisDateTime(e)),
u = new Date(),
d = r.lang(),
m = 'date' !== s.type && 'datetime' !== s.type,
f = lay(r.table[e]).find('td'),
p = lay(r.elemHeader[e][2]).find('span');
return (
c.year < y[0] && ((c.year = y[0]), r.hint(d.invalidDate)),
c.year > y[1] && ((c.year = y[1]), r.hint(d.invalidDate)),
r.firstDate || (r.firstDate = lay.extend({}, c)),
u.setFullYear(c.year, c.month, 1),
(i = u.getDay()),
(a = l.getEndDate(c.month || 12, c.year)),
(o = l.getEndDate(c.month + 1, c.year)),
lay.each(f, function (t, e) {
var n = [c.year, c.month],
s = 0;
(e = lay(e)).removeAttr('class'),
t < i
? ((s = a - i + t),
e.addClass('laydate-day-prev'),
(n = r.getAsYM(c.year, c.month, 'sub')))
: t >= i && t < o + i
? 1 + (s = t - i) === c.date && e.addClass(h)
: ((s = t - o - i),
e.addClass('laydate-day-next'),
(n = r.getAsYM(c.year, c.month))),
n[1]++,
(n[2] = s + 1),
e.attr('lay-ymd', n.join('-')).html(n[2]),
r
.mark(e, n)
.limit(
e,
{ year: n[0], month: n[1] - 1, date: n[2] },
t
);
}),
lay(p[0]).attr(
'lay-ym',
''.concat(c.year, '-').concat(c.month + 1)
),
lay(p[1]).attr(
'lay-ym',
''.concat(c.year, '-').concat(c.month + 1)
),
'cn' === s.lang
? (lay(p[0])
.attr('lay-type', 'year')
.html(''.concat(c.year, ' 年')),
lay(p[1])
.attr('lay-type', 'month')
.html(''.concat(c.month + 1, ' 月')))
: (lay(p[0])
.attr('lay-type', 'month')
.html(d.month[c.month]),
lay(p[1]).attr('lay-type', 'year').html(c.year)),
m &&
(s.range
? t &&
((r.listYM = [
[s.dateTime.year, s.dateTime.month + 1],
[r.endDate.year, r.endDate.month + 1],
]),
r.list(s.type, 0).list(s.type, 1),
'time' === s.type
? r.setBtnStatus(
'时间',
lay.extend(
{},
r.systemDate(),
r.startTime
),
lay.extend(
{},
r.systemDate(),
r.endTime
)
)
: r.setBtnStatus(!0))
: ((r.listYM = [[c.year, c.month + 1]]),
r.list(s.type, 0))),
s.range && 'init' === n && !t && r.calendar(r.endDate, 1),
s.range ||
r.limit(lay(r.footer).find(v), null, 0, [
'hours',
'minutes',
'seconds',
]),
r.setBtnStatus(),
r
);
}),
(_.prototype.list = function (t, e) {
var n = this,
i = n.config,
a = i.dateTime,
o = n.lang(),
r = i.range && 'date' !== i.type && 'datetime' !== i.type,
s = lay.elem('ul', {
class: ''
.concat(p, ' ')
.concat(
{
year: 'laydate-year-list',
month: 'laydate-month-list',
time: 'laydate-time-list',
}[t]
),
}),
c = n.elemHeader[e],
l = lay(c[2]).find('span'),
u = n.elemCont[e || 0],
d = lay(u).find('.'.concat(p))[0],
y = 'cn' === i.lang,
f = y ? '年' : '',
g = n.listYM[e] || {},
T = ['hours', 'minutes', 'seconds'],
_ = ['startTime', 'endTime'][e];
if ((g[0] < 1 && (g[0] = 1), 'year' === t)) {
var x,
E = (x = g[0] - 7);
E < 1 && (E = x = 1),
lay.each(new Array(15), function (t) {
var a = lay.elem('li', { 'lay-ym': x }),
o = { year: x };
x == g[0] && lay(a).addClass(h),
(a.innerHTML = x + f),
s.appendChild(a),
x < n.firstDate.year
? ((o.month = i.min.month),
(o.date = i.min.date))
: x >= n.firstDate.year &&
((o.month = i.max.month),
(o.date = i.max.date)),
n.limit(lay(a), o, e),
x++;
}),
lay(l[y ? 0 : 1])
.attr('lay-ym', ''.concat(x - 8, '-').concat(g[1]))
.html(''.concat(E + f, ' - ').concat(x - 1 + f));
} else if ('month' === t)
lay.each(new Array(12), function (t) {
var a = lay.elem('li', { 'lay-ym': t }),
r = { year: g[0], month: t };
t + 1 == g[1] && lay(a).addClass(h),
(a.innerHTML = o.month[t] + (y ? '月' : '')),
s.appendChild(a),
g[0] < n.firstDate.year
? (r.date = i.min.date)
: g[0] >= n.firstDate.year &&
(r.date = i.max.date),
n.limit(lay(a), r, e);
}),
lay(l[y ? 0 : 1])
.attr('lay-ym', ''.concat(g[0], '-').concat(g[1]))
.html(g[0] + f);
else if ('time' === t) {
var L = function () {
lay(s)
.find('ol')
.each(function (t, i) {
lay(i)
.find('li')
.each(function (i, a) {
n.limit(
lay(a),
[
{ hours: i },
{
hours: n[_].hours,
minutes: i,
},
{
hours: n[_].hours,
minutes: n[_].minutes,
seconds: i,
},
][t],
e,
[
['hours'],
['hours', 'minutes'],
['hours', 'minutes', 'seconds'],
][t]
);
});
}),
i.range ||
n.limit(lay(n.footer).find(v), n[_], 0, [
'hours',
'minutes',
'seconds',
]);
};
i.range
? n[_] || (n[_] = 'startTime' === _ ? a : n.endDate)
: (n[_] = a),
lay.each([24, 60, 60], function (t, e) {
var i = lay.elem('li'),
a = ['<p>'.concat(o.time[t], '</p><ol>')];
lay.each(new Array(e), function (e) {
a.push(
'<li'
.concat(
n[_][T[t]] === e
? ' class="'.concat(h, '"')
: '',
'>'
)
.concat(lay.digit(e, 2), '</li>')
);
}),
(i.innerHTML = ''.concat(a.join(''), '</ol>')),
s.appendChild(i);
}),
L();
}
if (
(d && u.removeChild(d),
u.appendChild(s),
'year' === t || 'month' === t)
)
lay(n.elemMain[e]).addClass('laydate-ym-show'),
lay(s)
.find('li')
.on('click', function () {
var o = 0 | lay(this).attr('lay-ym');
lay(this).hasClass(m) ||
(0 === e
? ((a[t] = o),
n.limit(
lay(n.footer).find(v),
null,
0
))
: (n.endDate[t] = o),
'year' === i.type || 'month' === i.type
? (lay(s)
.find('.'.concat(h))
.removeClass(h),
lay(this).addClass(h),
'month' === i.type &&
'year' === t &&
((n.listYM[e][0] = o),
r &&
((e ? n.endDate : a).year =
o),
n.list('month', e)))
: (n
.checkDate('limit')
.calendar(null, e),
n.closeList()),
n.setBtnStatus(),
i.range ||
((('month' === i.type &&
'month' === t) ||
('year' === i.type &&
'year' === t)) &&
n
.setValue(n.parse())
.remove()
.done()),
n.done(null, 'change'),
lay(n.footer)
.find('.'.concat(w))
.removeClass(m));
});
else {
var D = lay.elem('span', { class: b }),
k = function () {
lay(s)
.find('ol')
.each(function (t) {
var e = this,
i = lay(e).find('li');
(e.scrollTop = 30 * (n[_][T[t]] - 2)),
e.scrollTop <= 0 &&
i.each(function (t, n) {
if (!lay(this).hasClass(m))
return (
(e.scrollTop =
30 * (t - 2)),
!0
);
});
});
},
M = lay(c[2]).find('.'.concat(b));
k(),
(D.innerHTML = i.range
? [o.startTime, o.endTime][e]
: o.timeTips),
lay(n.elemMain[e]).addClass('laydate-time-show'),
M[0] && M.remove(),
c[2].appendChild(D),
lay(s)
.find('ol')
.each(function (t) {
var e = this;
lay(e)
.find('li')
.on('click', function () {
var o = 0 | this.innerHTML;
lay(this).hasClass(m) ||
(i.range
? (n[_][T[t]] = o)
: (a[T[t]] = o),
lay(e)
.find('.'.concat(h))
.removeClass(h),
lay(this).addClass(h),
L(),
k(),
(n.endDate || 'time' === i.type) &&
n.done(null, 'change'),
n.setBtnStatus());
});
});
}
return n;
}),
(_.prototype.listYM = []),
(_.prototype.closeList = function () {
var t = this;
t.config,
lay.each(t.elemCont, function (e, n) {
lay(this).find('.'.concat(p)).remove(),
lay(t.elemMain[e]).removeClass(
'laydate-ym-show laydate-time-show'
);
}),
lay(t.elem).find('.'.concat(b)).remove();
}),
(_.prototype.setBtnStatus = function (t, e, n) {
var i,
a = this,
o = a.config,
r = a.lang(),
s = lay(a.footer).find(v);
o.range &&
'time' !== o.type &&
((e = e || o.dateTime),
(n = n || a.endDate),
(i = a.newDate(e).getTime() > a.newDate(n).getTime()),
a.limit(null, e) || a.limit(null, n)
? s.addClass(m)
: s[i ? 'addClass' : 'removeClass'](m),
t &&
i &&
a.hint(
'string' == typeof t
? r.timeout.replace(/日期/g, t)
: r.timeout
));
}),
(_.prototype.parse = function (t, e) {
var n = this,
i = n.config,
a =
e ||
('end' == t
? lay.extend({}, n.endDate, n.endTime)
: i.range
? lay.extend({}, i.dateTime, n.startTime)
: i.dateTime),
o = l.parse(a, n.format, 1);
return i.range && void 0 === t
? ''
.concat(o, ' ')
.concat(n.rangeStr, ' ')
.concat(n.parse('end'))
: o;
}),
(_.prototype.newDate = function (t) {
return (
(t = t || {}),
new Date(
t.year || 1,
t.month || 0,
t.date || 1,
t.hours || 0,
t.minutes || 0,
t.seconds || 0
)
);
}),
(_.prototype.setValue = function (t) {
var e = this,
n = e.config,
i = e.bindElem || n.elem[0];
return (
'static' === n.position ||
((t = t || ''),
e.isInput(i)
? lay(i).val(t)
: e.rangeElem
? (e.rangeElem[0].val(t ? e.parse('start') : ''),
e.rangeElem[1].val(t ? e.parse('end') : ''))
: (0 === lay(i).find('*').length && lay(i).html(t),
lay(i).attr('lay-date', t))),
e
);
}),
(_.prototype.preview = function () {
var t = this,
e = t.config;
if (e.isPreview) {
var n = lay(t.elem).find('.'.concat(T)),
i = e.range ? (t.endDate ? t.parse() : '') : t.parse();
n.html(i).css({ color: '#5FB878', 'font-size': '14px;' }),
setTimeout(function () {
n.css({ color: '#666', 'font-size': '12px;' });
}, 300);
}
}),
(_.prototype.done = function (t, e) {
var n = this,
i = n.config,
a = lay.extend({}, lay.extend(i.dateTime, n.startTime)),
o = lay.extend({}, lay.extend(n.endDate, n.endTime));
return (
lay.each([a, o], function (t, e) {
'month' in e && lay.extend(e, { month: e.month + 1 });
}),
n.preview(),
(t = t || [n.parse(), a, o]),
'function' == typeof i[e || 'done'] &&
i[e || 'done'].apply(i, t),
n
);
}),
(_.prototype.choose = function (t, e) {
var n = this,
i = n.config,
a = n.thisDateTime(e),
o = (lay(n.elem).find('td'), t.attr('lay-ymd').split('-'));
(o = { year: 0 | o[0], month: (0 | o[1]) - 1, date: 0 | o[2] }),
t.hasClass(m) ||
(lay.extend(a, o),
i.range
? (lay.each(
['startTime', 'endTime'],
function (t, e) {
n[e] = n[e] || {
hours: 0,
minutes: 0,
seconds: 0,
};
}
),
n.calendar(null, e).done(null, 'change'))
: 'static' === i.position
? n.calendar().done().done(null, 'change')
: 'date' === i.type
? n.setValue(n.parse()).remove().done()
: 'datetime' === i.type &&
n.calendar().done(null, 'change'));
}),
(_.prototype.tool = function (t, e) {
var n = this,
i = n.config,
a = n.lang(),
o = i.dateTime,
r = 'static' === i.position,
s = {
datetime: function () {
lay(t).hasClass(m) ||
(n.list('time', 0),
i.range && n.list('time', 1),
lay(t)
.attr('lay-type', 'date')
.html(n.lang().dateTips));
},
date: function () {
n.closeList(),
lay(t)
.attr('lay-type', 'datetime')
.html(n.lang().timeTips);
},
clear: function () {
r && (lay.extend(o, n.firstDate), n.calendar()),
i.range &&
(delete i.dateTime,
delete n.endDate,
delete n.startTime,
delete n.endTime),
n.setValue('').remove(),
n.done(['', {}, {}]);
},
now: function () {
var t = new Date();
lay.extend(o, n.systemDate(), {
hours: t.getHours(),
minutes: t.getMinutes(),
seconds: t.getSeconds(),
}),
n.setValue(n.parse()).remove(),
r && n.calendar(),
n.done();
},
confirm: function () {
if (i.range) {
if (lay(t).hasClass(m))
return n.hint(
'time' === i.type
? a.timeout.replace(/日期/g, '时间')
: a.timeout
);
} else if (lay(t).hasClass(m))
return n.hint(a.invalidDate);
n.done(), n.setValue(n.parse()).remove();
},
};
s[e] && s[e]();
}),
(_.prototype.change = function (t) {
var e = this,
n = e.config,
i = e.thisDateTime(t),
a = n.range && ('year' === n.type || 'month' === n.type),
o = e.elemCont[t || 0],
r = e.listYM[t],
s = function (s) {
var c = lay(o).find('.laydate-year-list')[0],
l = lay(o).find('.laydate-month-list')[0];
return (
c &&
((r[0] = s ? r[0] - 15 : r[0] + 15),
e.list('year', t)),
l && (s ? r[0]-- : r[0]++, e.list('month', t)),
(c || l) &&
(lay.extend(i, { year: r[0] }),
a && (i.year = r[0]),
n.range || e.done(null, 'change'),
n.range ||
e.limit(lay(e.footer).find(v), {
year: r[0],
})),
e.setBtnStatus(),
c || l
);
};
return {
prevYear: function () {
s('sub') ||
(i.year--,
e.checkDate('limit').calendar(null, t),
e.done(null, 'change'));
},
prevMonth: function () {
var n = e.getAsYM(i.year, i.month, 'sub');
lay.extend(i, { year: n[0], month: n[1] }),
e.checkDate('limit').calendar(null, t),
e.done(null, 'change');
},
nextMonth: function () {
var n = e.getAsYM(i.year, i.month);
lay.extend(i, { year: n[0], month: n[1] }),
e.checkDate('limit').calendar(null, t),
e.done(null, 'change');
},
nextYear: function () {
s() ||
(i.year++,
e.checkDate('limit').calendar(null, t),
e.done(null, 'change'));
},
};
}),
(_.prototype.changeEvent = function () {
var t = this;
t.config,
lay(t.elem)
.on('click', function (t) {
lay.stope(t);
})
.on('mousedown', function (t) {
lay.stope(t);
}),
lay.each(t.elemHeader, function (e, n) {
lay(n[0]).on('click', function (n) {
t.change(e).prevYear();
}),
lay(n[1]).on('click', function (n) {
t.change(e).prevMonth();
}),
lay(n[2])
.find('span')
.on('click', function (n) {
var i = lay(this),
a = i.attr('lay-ym'),
o = i.attr('lay-type');
a &&
((a = a.split('-')),
(t.listYM[e] = [0 | a[0], 0 | a[1]]),
t.list(o, e),
lay(t.footer)
.find('.'.concat(w))
.addClass(m));
}),
lay(n[3]).on('click', function (n) {
t.change(e).nextMonth();
}),
lay(n[4]).on('click', function (n) {
t.change(e).nextYear();
});
}),
lay.each(t.table, function (e, n) {
lay(n)
.find('td')
.on('click', function () {
t.choose(lay(this), e);
});
}),
lay(t.footer)
.find('span')
.on('click', function () {
var e = lay(this).attr('lay-type');
t.tool(this, e);
});
}),
(_.prototype.isInput = function (t) {
return /input|textarea/.test(t.tagName.toLocaleLowerCase());
}),
(_.prototype.events = function () {
var t = this,
e = t.config,
n = function (n, i) {
n.on(e.trigger, function () {
i && (t.bindElem = this), t.render();
});
};
e.elem[0] &&
!e.elem[0].eventHandler &&
(n(e.elem, 'bind'),
n(e.eventElem),
(e.elem[0].eventHandler = !0));
}),
(u.that = {}),
(u.getThis = function (t) {
var e = u.that[t];
return (
e ||
hint.error(
t
? ''
.concat(d, " instance with ID '")
.concat(t, "' not found")
: 'ID argument required'
),
e
);
}),
(s.run = function (t) {
t(o)
.on('mousedown', function (e) {
if (l.thisId) {
var n = u.getThis(l.thisId);
if (n) {
var i = n.config;
e.target !== i.elem[0] &&
e.target !== i.eventElem[0] &&
e.target !== t(i.closeStop)[0] &&
n.remove();
}
}
})
.on('keydown', function (e) {
if (l.thisId) {
var n = u.getThis(l.thisId);
n &&
13 === e.keyCode &&
t('#'.concat(n.elemID))[0] &&
n.elemID === _.thisElemDate &&
(e.preventDefault(),
t(n.footer).find(v)[0].click());
}
}),
t(a).on('resize', function () {
if (l.thisId) {
var e = u.getThis(l.thisId);
if (e)
return (
!(!e.elem || !t('.layui-laydate')[0]) &&
void e.position()
);
}
});
}),
(l.render = function (t) {
var e = new _(t);
return u.call(e);
}),
(l.parse = function (t, e, n) {
return (
(t = t || {}),
'string' == typeof e && (e = u.formatArr(e)),
(e = (e || []).concat()),
lay.each(e, function (i, a) {
/yyyy|y/.test(a)
? (e[i] = lay.digit(t.year, a.length))
: /MM|M/.test(a)
? (e[i] = lay.digit(t.month + (n || 0), a.length))
: /dd|d/.test(a)
? (e[i] = lay.digit(t.date, a.length))
: /HH|H/.test(a)
? (e[i] = lay.digit(t.hours, a.length))
: /mm|m/.test(a)
? (e[i] = lay.digit(t.minutes, a.length))
: /ss|s/.test(a) &&
(e[i] = lay.digit(t.seconds, a.length));
}),
e.join('')
);
}),
(l.getEndDate = function (t, e) {
var n = new Date();
return (
n.setFullYear(
e || n.getFullYear(),
t || n.getMonth() + 1,
1
),
new Date(n.getTime() - 864e5).getDate()
);
}),
r
? (l.ready(),
layui.define('lay', function (t) {
(l.path = layui.cache.dir), s.run(lay), t(d, l);
}))
: void 0 ===
(i = function () {
return s.run(lay), l;
}.call(e, n, e, t)) || (t.exports = i);
})(window, window.document);
},
484: function (t) {
t.exports = (function () {
'use strict';
var t = 6e4,
e = 36e5,
n = 'millisecond',
i = 'second',
a = 'minute',
o = 'hour',
r = 'day',
s = 'week',
c = 'month',
l = 'quarter',
u = 'year',
d = 'date',
h = 'Invalid Date',
m =
/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,
y =
/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,
f = {
name: 'en',
weekdays:
'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
'_'
),
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
'_'
),
ordinal: function (t) {
var e = ['th', 'st', 'nd', 'rd'],
n = t % 100;
return '[' + t + (e[(n - 20) % 10] || e[n] || e[0]) + ']';
},
},
p = function (t, e, n) {
var i = String(t);
return !i || i.length >= e
? t
: '' + Array(e + 1 - i.length).join(n) + t;
},
g = {
s: p,
z: function (t) {
var e = -t.utcOffset(),
n = Math.abs(e),
i = Math.floor(n / 60),
a = n % 60;
return (e <= 0 ? '+' : '-') + p(i, 2, '0') + ':' + p(a, 2, '0');
},
m: function t(e, n) {
if (e.date() < n.date()) return -t(n, e);
var i = 12 * (n.year() - e.year()) + (n.month() - e.month()),
a = e.clone().add(i, c),
o = n - a < 0,
r = e.clone().add(i + (o ? -1 : 1), c);
return +(-(i + (n - a) / (o ? a - r : r - a)) || 0);
},
a: function (t) {
return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
},
p: function (t) {
return (
{
M: c,
y: u,
w: s,
d: r,
D: d,
h: o,
m: a,
s: i,
ms: n,
Q: l,
}[t] ||
String(t || '')
.toLowerCase()
.replace(/s$/, '')
);
},
u: function (t) {
return void 0 === t;
},
},
v = 'en',
b = {};
b[v] = f;
var w = function (t) {
return t instanceof E;
},
T = function t(e, n, i) {
var a;
if (!e) return v;
if ('string' == typeof e) {
var o = e.toLowerCase();
b[o] && (a = o), n && ((b[o] = n), (a = o));
var r = e.split('-');
if (!a && r.length > 1) return t(r[0]);
} else {
var s = e.name;
(b[s] = e), (a = s);
}
return !i && a && (v = a), a || (!i && v);
},
_ = function (t, e) {
if (w(t)) return t.clone();
var n = 'object' == typeof e ? e : {};
return (n.date = t), (n.args = arguments), new E(n);
},
x = g;
(x.l = T),
(x.i = w),
(x.w = function (t, e) {
return _(t, {
locale: e.$L,
utc: e.$u,
x: e.$x,
$offset: e.$offset,
});
});
var E = (function () {
function f(t) {
(this.$L = T(t.locale, null, !0)), this.parse(t);
}
var p = f.prototype;
return (
(p.parse = function (t) {
(this.$d = (function (t) {
var e = t.date,
n = t.utc;
if (null === e) return new Date(NaN);
if (x.u(e)) return new Date();
if (e instanceof Date) return new Date(e);
if ('string' == typeof e && !/Z$/i.test(e)) {
var i = e.match(m);
if (i) {
var a = i[2] - 1 || 0,
o = (i[7] || '0').substring(0, 3);
return n
? new Date(
Date.UTC(
i[1],
a,
i[3] || 1,
i[4] || 0,
i[5] || 0,
i[6] || 0,
o
)
)
: new Date(
i[1],
a,
i[3] || 1,
i[4] || 0,
i[5] || 0,
i[6] || 0,
o
);
}
}
return new Date(e);
})(t)),
(this.$x = t.x || {}),
this.init();
}),
(p.init = function () {
var t = this.$d;
(this.$y = t.getFullYear()),
(this.$M = t.getMonth()),
(this.$D = t.getDate()),
(this.$W = t.getDay()),
(this.$H = t.getHours()),
(this.$m = t.getMinutes()),
(this.$s = t.getSeconds()),
(this.$ms = t.getMilliseconds());
}),
(p.$utils = function () {
return x;
}),
(p.isValid = function () {
return !(this.$d.toString() === h);
}),
(p.isSame = function (t, e) {
var n = _(t);
return this.startOf(e) <= n && n <= this.endOf(e);
}),
(p.isAfter = function (t, e) {
return _(t) < this.startOf(e);
}),
(p.isBefore = function (t, e) {
return this.endOf(e) < _(t);
}),
(p.$g = function (t, e, n) {
return x.u(t) ? this[e] : this.set(n, t);
}),
(p.unix = function () {
return Math.floor(this.valueOf() / 1e3);
}),
(p.valueOf = function () {
return this.$d.getTime();
}),
(p.startOf = function (t, e) {
var n = this,
l = !!x.u(e) || e,
h = x.p(t),
m = function (t, e) {
var i = x.w(
n.$u
? Date.UTC(n.$y, e, t)
: new Date(n.$y, e, t),
n
);
return l ? i : i.endOf(r);
},
y = function (t, e) {
return x.w(
n
.toDate()
[t].apply(
n.toDate('s'),
(l
? [0, 0, 0, 0]
: [23, 59, 59, 999]
).slice(e)
),
n
);
},
f = this.$W,
p = this.$M,
g = this.$D,
v = 'set' + (this.$u ? 'UTC' : '');
switch (h) {
case u:
return l ? m(1, 0) : m(31, 11);
case c:
return l ? m(1, p) : m(0, p + 1);
case s:
var b = this.$locale().weekStart || 0,
w = (f < b ? f + 7 : f) - b;
return m(l ? g - w : g + (6 - w), p);
case r:
case d:
return y(v + 'Hours', 0);
case o:
return y(v + 'Minutes', 1);
case a:
return y(v + 'Seconds', 2);
case i:
return y(v + 'Milliseconds', 3);
default:
return this.clone();
}
}),
(p.endOf = function (t) {
return this.startOf(t, !1);
}),
(p.$set = function (t, e) {
var s,
l = x.p(t),
h = 'set' + (this.$u ? 'UTC' : ''),
m = ((s = {}),
(s[r] = h + 'Date'),
(s[d] = h + 'Date'),
(s[c] = h + 'Month'),
(s[u] = h + 'FullYear'),
(s[o] = h + 'Hours'),
(s[a] = h + 'Minutes'),
(s[i] = h + 'Seconds'),
(s[n] = h + 'Milliseconds'),
s)[l],
y = l === r ? this.$D + (e - this.$W) : e;
if (l === c || l === u) {
var f = this.clone().set(d, 1);
f.$d[m](y),
f.init(),
(this.$d = f.set(
d,
Math.min(this.$D, f.daysInMonth())
).$d);
} else m && this.$d[m](y);
return this.init(), this;
}),
(p.set = function (t, e) {
return this.clone().$set(t, e);
}),
(p.get = function (t) {
return this[x.p(t)]();
}),
(p.add = function (n, l) {
var d,
h = this;
n = Number(n);
var m = x.p(l),
y = function (t) {
var e = _(h);
return x.w(e.date(e.date() + Math.round(t * n)), h);
};
if (m === c) return this.set(c, this.$M + n);
if (m === u) return this.set(u, this.$y + n);
if (m === r) return y(1);
if (m === s) return y(7);
var f =
((d = {}), (d[a] = t), (d[o] = e), (d[i] = 1e3), d)[
m
] || 1,
p = this.$d.getTime() + n * f;
return x.w(p, this);
}),
(p.subtract = function (t, e) {
return this.add(-1 * t, e);
}),
(p.format = function (t) {
var e = this,
n = this.$locale();
if (!this.isValid()) return n.invalidDate || h;
var i = t || 'YYYY-MM-DDTHH:mm:ssZ',
a = x.z(this),
o = this.$H,
r = this.$m,
s = this.$M,
c = n.weekdays,
l = n.months,
u = function (t, n, a, o) {
return (t && (t[n] || t(e, i))) || a[n].slice(0, o);
},
d = function (t) {
return x.s(o % 12 || 12, t, '0');
},
m =
n.meridiem ||
function (t, e, n) {
var i = t < 12 ? 'AM' : 'PM';
return n ? i.toLowerCase() : i;
},
f = {
YY: String(this.$y).slice(-2),
YYYY: this.$y,
M: s + 1,
MM: x.s(s + 1, 2, '0'),
MMM: u(n.monthsShort, s, l, 3),
MMMM: u(l, s),
D: this.$D,
DD: x.s(this.$D, 2, '0'),
d: String(this.$W),
dd: u(n.weekdaysMin, this.$W, c, 2),
ddd: u(n.weekdaysShort, this.$W, c, 3),
dddd: c[this.$W],
H: String(o),
HH: x.s(o, 2, '0'),
h: d(1),
hh: d(2),
a: m(o, r, !0),
A: m(o, r, !1),
m: String(r),
mm: x.s(r, 2, '0'),
s: String(this.$s),
ss: x.s(this.$s, 2, '0'),
SSS: x.s(this.$ms, 3, '0'),
Z: a,
};
return i.replace(y, function (t, e) {
return e || f[t] || a.replace(':', '');
});
}),
(p.utcOffset = function () {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}),
(p.diff = function (n, d, h) {
var m,
y = x.p(d),
f = _(n),
p = (f.utcOffset() - this.utcOffset()) * t,
g = this - f,
v = x.m(this, f);
return (
(v =
((m = {}),
(m[u] = v / 12),
(m[c] = v),
(m[l] = v / 3),
(m[s] = (g - p) / 6048e5),
(m[r] = (g - p) / 864e5),
(m[o] = g / e),
(m[a] = g / t),
(m[i] = g / 1e3),
m)[y] || g),
h ? v : x.a(v)
);
}),
(p.daysInMonth = function () {
return this.endOf(c).$D;
}),
(p.$locale = function () {
return b[this.$L];
}),
(p.locale = function (t, e) {
if (!t) return this.$L;
var n = this.clone(),
i = T(t, e, !0);
return i && (n.$L = i), n;
}),
(p.clone = function () {
return x.w(this.$d, this);
}),
(p.toDate = function () {
return new Date(this.valueOf());
}),
(p.toJSON = function () {
return this.isValid() ? this.toISOString() : null;
}),
(p.toISOString = function () {
return this.$d.toISOString();
}),
(p.toString = function () {
return this.$d.toUTCString();
}),
f
);
})(),
L = E.prototype;
return (
(_.prototype = L),
[
['$ms', n],
['$s', i],
['$m', a],
['$H', o],
['$W', r],
['$M', c],
['$y', u],
['$D', d],
].forEach(function (t) {
L[t[1]] = function (e) {
return this.$g(e, t[0], t[1]);
};
}),
(_.extend = function (t, e) {
return t.$i || (t(e, E, _), (t.$i = !0)), _;
}),
(_.locale = T),
(_.isDayjs = w),
(_.unix = function (t) {
return _(1e3 * t);
}),
(_.en = b[v]),
(_.Ls = b),
(_.p = {}),
_
);
})();
},
},
e = {};
function n(i) {
var a = e[i];
if (void 0 !== a) return a.exports;
var o = (e[i] = { exports: {} });
return t[i].call(o.exports, o, o.exports, n), o.exports;
}
(n.n = t => {
var e = t && t.__esModule ? () => t.default : () => t;
return n.d(e, { a: e }), e;
}),
(n.d = (t, e) => {
for (var i in e)
n.o(e, i) &&
!n.o(t, i) &&
Object.defineProperty(t, i, { enumerable: !0, get: e[i] });
}),
(n.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e)),
(n.r = t => {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(t, '__esModule', { value: !0 });
});
var i = {};
return (
(() => {
'use strict';
n.r(i), n.d(i, { default: () => v });
var t = n(484),
e = n.n(t);
function a(t) {
var e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],
n = document.getElementById('imou_player_icon_root_'.concat(t)),
i = document.getElementById('imou_player_timeLine-web_'.concat(t)),
a = document.getElementById(
'imou_player_timeLine-celeContainer_'.concat(t)
);
e
? ((n.style.visibility = 'hidden'),
i && ((i.style.display = 'none'), (a.style.display = 'none')))
: ((n.style.visibility = ''),
i && ((i.style.display = ''), (a.style.display = '')));
}
var o = n(132),
r = n.n(o);
function s(t, e, n, i, a, o, r) {
t.beginPath(),
t.moveTo(e, n),
t.lineTo(i, a),
(t.strokeStyle = o),
(t.lineWidth = r),
t.closePath(),
t.stroke();
}
function c(t, e, n, i, a, o) {
(t.fillStyle = o), t.fillRect(e, n, i, a);
}
function l(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);
}
}
function u(t) {
var e = Math.floor(t / 3600),
n = Math.floor((t - 3600 * e) / 60),
i = t - 3600 * e - 60 * n;
return ''
.concat(e > 9 ? e : '0'.concat(e), ':')
.concat(n > 9 ? n : '0'.concat(n), ':')
.concat(i > 9 ? i : '0'.concat(i));
}
var d = (function () {
function t(e) {
var n = this,
i = e.elem,
a = e.width,
o = e.beginTime,
r = e.height,
s = e.Obj;
!(function (t, e) {
if (!(t instanceof e))
throw new TypeError('Cannot call a class as a function');
})(this, t),
(this.elem = i),
(this.ctx = i.getContext('2d')),
(this.width = a),
(this.height = r),
(i.width = a),
(i.height = r),
(this.record = []),
(this.beginTime = o),
(this.timestamp = o || 0),
(this.elem.onmousedown = function (t) {
n.onmousedown(t);
}),
(this.elem.ondragstart = function () {
return !1;
}),
(this.Obj = s),
(this.step = 10);
}
var e, n;
return (
(e = t),
(n = [
{
key: 'onmousedown',
value: function (t) {
var e = this;
this.stop(!1),
(this.startMoveX = t.offsetX),
(document.onmousemove = function (t) {
e.onmouseMove(t);
}),
(document.onmouseup = function (t) {
e.onmouseUp(t);
}),
(document.onmouseleave = function (t) {
e.onmouseUp(t);
});
},
},
{
key: 'onmouseMove',
value: function (t) {
var e = this.startMoveX - t.offsetX;
(this.moveTimestamp = Math.floor(this.timestamp + e)),
this.moveTimestamp < 0 && (this.moveTimestamp = 0),
this.moveTimestamp > 86399 && (this.moveTimestamp = 86399),
this.reDrawLine(
this.width / 2 - this.moveTimestamp * this.step,
this.record
);
},
},
{
key: 'onmouseUp',
value: function () {
(document.onmousemove = null),
(document.onmouseup = null),
(document.onmouseleave = null),
(this.timestamp = this.moveTimestamp),
this.Obj.changeImouUrl('beginTime', this.timestamp);
},
},
{
key: 'start',
value: function () {
this.loopLine();
},
},
{
key: 'loopLine',
value: function () {
var t = this;
this.reDrawLine(
this.width / 2 - this.timestamp * this.step,
this.record
),
(this.AnimationFrameId = setTimeout(function () {
t.loopLine();
}, 200));
},
},
{
key: 'stop',
value: function () {
var t =
arguments.length > 0 &&
void 0 !== arguments[0] &&
arguments[0];
this.AnimationFrameId && clearTimeout(this.AnimationFrameId),
this.timestampTimer && clearTimeout(this.timestampTimer),
(this.AnimationFrameId = null),
(this.timestampTimer = null),
t &&
((this.timestamp = 0),
(this.record = []),
this.reDrawLine(this.width / 2, []));
},
},
{
key: 'changeProp',
value: function (t, e) {
if ('timestamp' === t) {
var n = this.record,
i = this.timestamp,
a = this.step;
if (e < 0) return void (this.timestamp = 0);
if (!this.AnimationFrameId) return;
n.length > 0 &&
i >= n[n.length - 1].endTime &&
((this.Obj.status.message = '播放结束'),
this.Obj.stop(),
this.stop(),
this.reDrawLine(
this.width / 2 - n[n.length - 1].endTime * a,
n
));
}
(this[t] = e), 'width' === t && (this.elem.width = e);
},
},
{
key: 'reDrawLine',
value: function (t) {
var e =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: [],
n = this.ctx,
i = this.step;
n.clearRect(0, 0, this.width, this.height);
for (var a = 0; a < e.length; a++) {
var o = e[a],
r = t + o.beginTime * i,
l = t + o.endTime * i;
if (!(l < 0)) {
if (r > this.width) break;
(r > 0 || l > 0 || r < this.width || l < this.width) &&
c(
n,
t + o.beginTime * i,
0,
(o.endTime - o.beginTime) * i,
50,
'#384D65'
);
}
}
for (var d = 86400, h = 0; h < d; h += 1) {
var m = t + h * i;
if (!(m < 0)) {
if (m > this.width) break;
h % 10 == 0
? (s(n, m, 0, m, 50, '#808080', 2),
(n.font = '15px PingFang SC'),
(n.fillStyle = '#D8D8D8'),
n.fillText(u(h), m + 12, 20))
: s(n, m, 30, m, 50, '#808080', 2);
}
}
s(n, this.width / 2, 0, this.width / 2, 50, '#f18d00', 2);
},
},
]),
n && l(e.prototype, n),
Object.defineProperty(e, 'prototype', { writable: !1 }),
t
);
})();
function h(t) {
return (
(h =
'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;
}),
h(t)
);
}
function m() {
m = function () {
return t;
};
var t = {},
e = Object.prototype,
n = e.hasOwnProperty,
i = 'function' == typeof Symbol ? Symbol : {},
a = i.iterator || '@@iterator',
o = i.asyncIterator || '@@asyncIterator',
r = i.toStringTag || '@@toStringTag';
function s(t, e, n) {
return (
Object.defineProperty(t, e, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0,
}),
t[e]
);
}
try {
s({}, '');
} catch (t) {
s = function (t, e, n) {
return (t[e] = n);
};
}
function c(t, e, n, i) {
var a = e && e.prototype instanceof d ? e : d,
o = Object.create(a.prototype),
r = new L(i || []);
return (
(o._invoke = (function (t, e, n) {
var i = 'suspendedStart';
return function (a, o) {
if ('executing' === i)
throw new Error('Generator is already running');
if ('completed' === i) {
if ('throw' === a) throw o;
return { value: void 0, done: !0 };
}
for (n.method = a, n.arg = o; ; ) {
var r = n.delegate;
if (r) {
var s = _(r, n);
if (s) {
if (s === u) continue;
return s;
}
}
if ('next' === n.method) n.sent = n._sent = n.arg;
else if ('throw' === n.method) {
if ('suspendedStart' === i)
throw ((i = 'completed'), n.arg);
n.dispatchException(n.arg);
} else 'return' === n.method && n.abrupt('return', n.arg);
i = 'executing';
var c = l(t, e, n);
if ('normal' === c.type) {
if (
((i = n.done ? 'completed' : 'suspendedYield'),
c.arg === u)
)
continue;
return { value: c.arg, done: n.done };
}
'throw' === c.type &&
((i = 'completed'),
(n.method = 'throw'),
(n.arg = c.arg));
}
};
})(t, n, r)),
o
);
}
function l(t, e, n) {
try {
return { type: 'normal', arg: t.call(e, n) };
} catch (t) {
return { type: 'throw', arg: t };
}
}
t.wrap = c;
var u = {};
function d() {}
function y() {}
function f() {}
var p = {};
s(p, a, function () {
return this;
});
var g = Object.getPrototypeOf,
v = g && g(g(D([])));
v && v !== e && n.call(v, a) && (p = v);
var b = (f.prototype = d.prototype = Object.create(p));
function w(t) {
['next', 'throw', 'return'].forEach(function (e) {
s(t, e, function (t) {
return this._invoke(e, t);
});
});
}
function T(t, e) {
function i(a, o, r, s) {
var c = l(t[a], t, o);
if ('throw' !== c.type) {
var u = c.arg,
d = u.value;
return d && 'object' == h(d) && n.call(d, '__await')
? e.resolve(d.__await).then(
function (t) {
i('next', t, r, s);
},
function (t) {
i('throw', t, r, s);
}
)
: e.resolve(d).then(
function (t) {
(u.value = t), r(u);
},
function (t) {
return i('throw', t, r, s);
}
);
}
s(c.arg);
}
var a;
this._invoke = function (t, n) {
function o() {
return new e(function (e, a) {
i(t, n, e, a);
});
}
return (a = a ? a.then(o, o) : o());
};
}
function _(t, e) {
var n = t.iterator[e.method];
if (void 0 === n) {
if (((e.delegate = null), 'throw' === e.method)) {
if (
t.iterator.return &&
((e.method = 'return'),
(e.arg = void 0),
_(t, e),
'throw' === e.method)
)
return u;
(e.method = 'throw'),
(e.arg = new TypeError(
"The iterator does not provide a 'throw' method"
));
}
return u;
}
var i = l(n, t.iterator, e.arg);
if ('throw' === i.type)
return (e.method = 'throw'), (e.arg = i.arg), (e.delegate = null), u;
var a = i.arg;
return a
? a.done
? ((e[t.resultName] = a.value),
(e.next = t.nextLoc),
'return' !== e.method && ((e.method = 'next'), (e.arg = void 0)),
(e.delegate = null),
u)
: a
: ((e.method = 'throw'),
(e.arg = new TypeError('iterator result is not an object')),
(e.delegate = null),
u);
}
function x(t) {
var e = { tryLoc: t[0] };
1 in t && (e.catchLoc = t[1]),
2 in t && ((e.finallyLoc = t[2]), (e.afterLoc = t[3])),
this.tryEntries.push(e);
}
function E(t) {
var e = t.completion || {};
(e.type = 'normal'), delete e.arg, (t.completion = e);
}
function L(t) {
(this.tryEntries = [{ tryLoc: 'root' }]),
t.forEach(x, this),
this.reset(!0);
}
function D(t) {
if (t) {
var e = t[a];
if (e) return e.call(t);
if ('function' == typeof t.next) return t;
if (!isNaN(t.length)) {
var i = -1,
o = function e() {
for (; ++i < t.length; )
if (n.call(t, i))
return (e.value = t[i]), (e.done = !1), e;
return (e.value = void 0), (e.done = !0), e;
};
return (o.next = o);
}
}
return { next: k };
}
function k() {
return { value: void 0, done: !0 };
}
return (
(y.prototype = f),
s(b, 'constructor', f),
s(f, 'constructor', y),
(y.displayName = s(f, r, 'GeneratorFunction')),
(t.isGeneratorFunction = function (t) {
var e = 'function' == typeof t && t.constructor;
return (
!!e &&
(e === y || 'GeneratorFunction' === (e.displayName || e.name))
);
}),
(t.mark = function (t) {
return (
Object.setPrototypeOf
? Object.setPrototypeOf(t, f)
: ((t.__proto__ = f), s(t, r, 'GeneratorFunction')),
(t.prototype = Object.create(b)),
t
);
}),
(t.awrap = function (t) {
return { __await: t };
}),
w(T.prototype),
s(T.prototype, o, function () {
return this;
}),
(t.AsyncIterator = T),
(t.async = function (e, n, i, a, o) {
void 0 === o && (o = Promise);
var r = new T(c(e, n, i, a), o);
return t.isGeneratorFunction(n)
? r
: r.next().then(function (t) {
return t.done ? t.value : r.next();
});
}),
w(b),
s(b, r, 'Generator'),
s(b, a, function () {
return this;
}),
s(b, 'toString', function () {
return '[object Generator]';
}),
(t.keys = function (t) {
var e = [];
for (var n in t) e.push(n);
return (
e.reverse(),
function n() {
for (; e.length; ) {
var i = e.pop();
if (i in t) return (n.value = i), (n.done = !1), n;
}
return (n.done = !0), n;
}
);
}),
(t.values = D),
(L.prototype = {
constructor: L,
reset: function (t) {
if (
((this.prev = 0),
(this.next = 0),
(this.sent = this._sent = void 0),
(this.done = !1),
(this.delegate = null),
(this.method = 'next'),
(this.arg = void 0),
this.tryEntries.forEach(E),
!t)
)
for (var e in this)
't' === e.charAt(0) &&
n.call(this, e) &&
!isNaN(+e.slice(1)) &&
(this[e] = void 0);
},
stop: function () {
this.done = !0;
var t = this.tryEntries[0].completion;
if ('throw' === t.type) throw t.arg;
return this.rval;
},
dispatchException: function (t) {
if (this.done) throw t;
var e = this;
function i(n, i) {
return (
(r.type = 'throw'),
(r.arg = t),
(e.next = n),
i && ((e.method = 'next'), (e.arg = void 0)),
!!i
);
}
for (var a = this.tryEntries.length - 1; a >= 0; --a) {
var o = this.tryEntries[a],
r = o.completion;
if ('root' === o.tryLoc) return i('end');
if (o.tryLoc <= this.prev) {
var s = n.call(o, 'catchLoc'),
c = n.call(o, 'finallyLoc');
if (s && c) {
if (this.prev < o.catchLoc) return i(o.catchLoc, !0);
if (this.prev < o.finallyLoc) return i(o.finallyLoc);
} else if (s) {
if (this.prev < o.catchLoc) return i(o.catchLoc, !0);
} else {
if (!c)
throw new Error(
'try statement without catch or finally'
);
if (this.prev < o.finallyLoc) return i(o.finallyLoc);
}
}
}
},
abrupt: function (t, e) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var a = this.tryEntries[i];
if (
a.tryLoc <= this.prev &&
n.call(a, 'finallyLoc') &&
this.prev < a.finallyLoc
) {
var o = a;
break;
}
}
o &&
('break' === t || 'continue' === t) &&
o.tryLoc <= e &&
e <= o.finallyLoc &&
(o = null);
var r = o ? o.completion : {};
return (
(r.type = t),
(r.arg = e),
o
? ((this.method = 'next'), (this.next = o.finallyLoc), u)
: this.complete(r)
);
},
complete: function (t, e) {
if ('throw' === t.type) throw t.arg;
return (
'break' === t.type || 'continue' === t.type
? (this.next = t.arg)
: 'return' === t.type
? ((this.rval = this.arg = t.arg),
(this.method = 'return'),
(this.next = 'end'))
: 'normal' === t.type && e && (this.next = e),
u
);
},
finish: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var n = this.tryEntries[e];
if (n.finallyLoc === t)
return this.complete(n.completion, n.afterLoc), E(n), u;
}
},
catch: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var n = this.tryEntries[e];
if (n.tryLoc === t) {
var i = n.completion;
if ('throw' === i.type) {
var a = i.arg;
E(n);
}
return a;
}
}
throw new Error('illegal catch attempt');
},
delegateYield: function (t, e, n) {
return (
(this.delegate = { iterator: D(t), resultName: e, nextLoc: n }),
'next' === this.method && (this.arg = void 0),
u
);
},
}),
t
);
}
function y(t, e, n, i, a, o, r) {
try {
var s = t[o](r),
c = s.value;
} catch (t) {
return void n(t);
}
s.done ? e(c) : Promise.resolve(c).then(i, a);
}
function f(t, e) {
(null == e || e > t.length) && (e = t.length);
for (var n = 0, i = new Array(e); n < e; n++) i[n] = t[n];
return i;
}
function p(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);
}
}
var g = (function () {
function t(n) {
var i = this;
!(function (t, e) {
if (!(t instanceof e))
throw new TypeError('Cannot call a class as a function');
})(this, t);
var a = n.id,
o = n.token,
s = n.deviceId,
c = n.channelId,
l = n.width,
u = n.height,
h = n.code,
m = n.mute,
y = void 0 !== m && m,
p = n.beginTime || e()().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
g = n.endTime || e()(p).endOf('day').format('YYYY-MM-DD HH:mm:ss'),
v = {
id: a,
token: o,
deviceId: s,
channelId: c,
code: h || s,
width: l,
height: u,
playing: !1,
volume: !0,
type: parseInt(n.type) || 1,
clarity: n.streamId || 0,
fullPage: !1,
fullWebPage: !1,
talk: !1,
yuntai: !1,
message: '',
recordType: n.recordType || 'cloud',
beginTime: p,
endTime: g,
obj: this,
};
this.height = u;
var b = 'imou://open.lechange.com/'
.concat(v.deviceId, '/')
.concat(v.channelId, '/')
.concat(v.type, '?streamId=')
.concat(v.clarity, '&recordType=')
.concat(v.recordType, '&beginTime=')
.concat(v.beginTime, '&endTime=')
.concat(v.endTime);
(this.url = b),
(this.token = o),
(this.iframeId = 'imou-player-iframe-'.concat(Date.now())),
(this.root = document.getElementById(a)),
(this.root.style.backgroundColor = 'black'),
(this.root.style.position = 'relative'),
(this.root.style.width = ''.concat(v.width, 'px')),
(this.root.style.height = ''.concat(v.height, 'px')),
(this.root.style.userSelect = 'none'),
(this.domain =
'https://resource-public.oss-cn-hangzhou.aliyuncs.com/webFront/openweb/mini-player/index.html'),
(this.record = []),
(this.status = (function (t) {
return new Proxy(t, {
set: function (e, n, i) {
var a,
o = t.obj.iframeId;
try {
switch (n) {
case 'playing':
(a = document.getElementById(
'imou_player_icon_play_'.concat(o)
)),
i
? (a.classList.remove('icon-play'),
a.classList.add('icon-play_1'))
: (a.classList.add('icon-play'),
a.classList.remove('icon-play_1'));
break;
case 'volume':
(a = document.getElementById(
'imou_player_icon_voice_'.concat(o)
)),
i
? (a.classList.remove('icon-voice_1'),
a.classList.add('icon-voice'))
: (a.classList.remove('icon-voice'),
a.classList.add('icon-voice_1'));
break;
case 'talk':
(a = document.getElementById(
'imou_player_icon_talk_'.concat(o)
)),
i
? (a.classList.remove('icon-talk'),
a.classList.add('icon-talk_1'))
: (a.classList.remove('icon-talk_1'),
a.classList.add('icon-talk'));
break;
case 'clarity':
if (
!(a = document.getElementById(
'imou_player_icon_clarity_'.concat(o)
))
)
break;
i
? (a.classList.remove('icon-clarity'),
a.classList.add('icon-clarity_1'))
: (a.classList.remove('icon-clarity_1'),
a.classList.add('icon-clarity'));
break;
case 'message':
!(function (t, e) {
var n = document.getElementById(
'imou_player_message_root_'.concat(
t
)
),
i = document.getElementById(
'imou_player_icon_root_'.concat(t)
),
a = document.getElementById(
'imou_player_timeLine-web_'.concat(
t
)
),
o = document.getElementById(
'imou_player_timeLine-celeContainer_'.concat(
t
)
);
e
? ((n.innerText = e),
(n.style.display = ''),
'解密失败, 请重新输入秘钥' === e &&
((i.style.display = 'none'),
a &&
((a.style.display = 'none'),
(o.style.display = 'none'))))
: ((n.style.display = 'none'),
(i.style.display = ''),
a &&
((a.style.display = ''),
(o.style.display = '')));
})(t.obj.iframeId, i);
break;
case 'yuntai':
(a = document.getElementById(
'imou_player_PTZArea_'.concat(o)
)).style.display = i ? '' : 'none';
break;
case 'recordType':
'cloud' === i
? (((a = document.getElementById(
'imou_player_icon_YunLuXiang_'.concat(
o
)
)).style.color = 'blue'),
((a = document.getElementById(
'imou_player_icon_BenDiLuXiang_'.concat(
o
)
)).style.color = ''))
: (((a = document.getElementById(
'imou_player_icon_YunLuXiang_'.concat(
o
)
)).style.color = ''),
((a = document.getElementById(
'imou_player_icon_BenDiLuXiang_'.concat(
o
)
)).style.color = 'blue'));
break;
case 'fullPage':
i ? t.obj.fullScreen() : t.obj.exitFullScreen();
break;
case 'fullWebPage':
if (t.fullPage) return !0;
i
? t.obj.fullPageScreen()
: t.obj.exitFullPageScreen();
}
} catch (t) {}
return (e[n] = i), !0;
},
});
})(v));
var w,
T =
1 === (w = this).status.type
? (function (t) {
var e = new DocumentFragment(),
n = document.createElement('div');
n.setAttribute(
'id',
'imou_player_icon_root_'.concat(t.iframeId)
),
(n.style.display = 'none'),
(n.style.position = 'absolute'),
(n.style.width = '100%'),
(n.style.height = '100%'),
(n.style.zIndex = '99999');
var i = document.createElement('div');
(i.style.color = '#f18d00'),
(i.innerHTML = ''
.concat(t.status.deviceId, ' 通道 ')
.concat(t.status.channelId)),
i.setAttribute('class', 'topLeft'),
n.appendChild(i),
['play', 'voice', 'talk', 'capture'].forEach(
function (e, i) {
var a = document.createElement('div');
a.setAttribute(
'id',
'imou_player_icon_'
.concat(e, '_')
.concat(t.iframeId)
),
a.setAttribute(
'class',
'iconfont icon-'
.concat(e, ' icon position_left_')
.concat(i)
),
n.appendChild(a);
}
),
[
'fullPage',
'WangYeQuanPing',
'clarity',
'Icon_YunTai',
].forEach(function (e, i) {
var a = document.createElement('div');
if (
(a.setAttribute(
'id',
'imou_player_icon_'
.concat(e, '_')
.concat(t.iframeId)
),
a.setAttribute(
'class',
'iconfont icon-'
.concat(e, ' icon position_right_')
.concat(i)
),
'clarity' === e)
) {
var o = '0' == t.status.clarity ? '' : '_1';
a.setAttribute(
'class',
'iconfont icon-'
.concat(e)
.concat(o, ' icon position_right_')
.concat(i)
);
}
n.appendChild(a);
}),
e.appendChild(n),
n.addEventListener('click', function (e) {
switch (e.target.id) {
case 'imou_player_icon_play_'.concat(
t.iframeId
):
t.status.playing ? t.pause() : t.play();
break;
case 'imou_player_icon_capture_'.concat(
t.iframeId
):
t.capture();
break;
case 'imou_player_icon_talk_'.concat(
t.iframeId
):
t.talk(!t.status.talk);
break;
case 'imou_player_icon_voice_'.concat(
t.iframeId
):
t.volume(!t.status.volume);
break;
case 'imou_player_icon_fullPage_'.concat(
t.iframeId
):
t.status.fullPage = !t.status.fullPage;
break;
case 'imou_player_icon_WangYeQuanPing_'.concat(
t.iframeId
):
t.status.fullWebPage =
!t.status.fullWebPage;
break;
case 'imou_player_icon_clarity_'.concat(
t.iframeId
):
(t.status.message = '切换码流中...'),
t.changeImouUrl(
'clarity',
'0' == t.status.clarity ? 1 : 0
);
break;
case 'imou_player_icon_Icon_YunTai_'.concat(
t.iframeId
):
t.status.yuntai = !t.status.yuntai;
}
});
var a = document.createElement('div');
a.setAttribute(
'id',
'imou_player_message_root_'.concat(t.iframeId)
),
a.setAttribute(
'style',
'position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:1.2em;color:white;z-index:99999;'
),
(a.style.display = 'none'),
e.appendChild(a);
var o = document.createElement('div');
return (
(o.style.display = 'none'),
o.setAttribute(
'id',
'imou_player_PTZArea_'.concat(t.iframeId)
),
o.setAttribute('class', 'player__PTZArea'),
(o.style.zIndex = '99999'),
['up', 'down', 'left', 'right'].forEach(function (t) {
var e = document.createElement('div');
e.setAttribute('class', 'arrow-'.concat(t)),
o.appendChild(e);
}),
o.addEventListener('mousedown', function (e) {
var n = e.offsetX,
i = e.offsetY,
a = '';
n > 40
? n > 80
? i > 40 && i < 80 && (a = 'right')
: i < 40
? (a = 'up')
: i > 80 && (a = 'down')
: i > 40 && i < 80 && (a = 'left'),
a && t.ptzControl(a);
}),
o.addEventListener('mouseup', function () {
t.ptzControl('stop');
}),
e.appendChild(o),
e
);
})(w)
: (function (t) {
var n = new DocumentFragment(),
i = t.iframeId,
a = document.createElement('div');
a.setAttribute('id', 'imou_player_icon_root_'.concat(i)),
(a.style.display = 'none'),
(a.style.position = 'absolute'),
(a.style.width = '100%'),
(a.style.height = '100%'),
(a.style.zIndex = '99999');
var o = document.createElement('div');
(o.style.color = '#f18d00'),
(o.innerHTML = ''
.concat(t.status.deviceId, ' 通道 ')
.concat(t.status.channelId)),
o.setAttribute('class', 'topLeft'),
a.appendChild(o),
['play', 'voice', 'capture'].forEach(function (t, e) {
var n = document.createElement('div');
n.setAttribute(
'id',
'imou_player_icon_'.concat(t, '_').concat(i)
),
n.setAttribute(
'class',
'iconfont icon-'
.concat(
t,
' record-icon position_left_'
)
.concat(e)
),
a.appendChild(n);
}),
['fullPage', 'WangYeQuanPing'].forEach(function (
t,
e
) {
var n = document.createElement('div');
n.setAttribute(
'id',
'imou_player_icon_'.concat(t, '_').concat(i)
),
n.setAttribute(
'class',
'iconfont icon-'
.concat(
t,
' record-icon position_right_'
)
.concat(e)
),
a.appendChild(n);
}),
['BenDiLuXiang', 'YunLuXiang'].forEach(function (
e,
n
) {
var o = document.createElement('div');
o.setAttribute(
'id',
'imou_player_icon_'.concat(e, '_').concat(i)
),
o.setAttribute(
'class',
'iconfont icon-Icon_'
.concat(
e,
' record-icon topRight position_right_'
)
.concat(n)
),
'localRecord' === t.status.recordType &&
'BenDiLuXiang' === e &&
(o.style.color = 'blue'),
'localRecord' !== t.status.recordType &&
'YunLuXiang' === e &&
(o.style.color = 'blue'),
a.appendChild(o);
}),
n.appendChild(a),
a.addEventListener('click', function (e) {
switch (e.target.id) {
case 'imou_player_icon_play_'.concat(i):
t.status.playing ? t.pause() : t.play();
break;
case 'imou_player_icon_capture_'.concat(i):
t.capture();
break;
case 'imou_player_icon_voice_'.concat(i):
t.volume(!t.status.volume);
break;
case 'imou_player_icon_fullPage_'.concat(i):
t.status.fullPage = !t.status.fullPage;
break;
case 'imou_player_icon_WangYeQuanPing_'.concat(
i
):
t.status.fullWebPage =
!t.status.fullWebPage;
break;
case 'imou_player_icon_BenDiLuXiang_'.concat(
i
):
(t.status.message =
'切换录像至本地录像中...'),
t.changeImouUrl(
'recordType',
'localRecord'
);
break;
case 'imou_player_icon_YunLuXiang_'.concat(i):
(t.status.message =
'切换录像至云录像中...'),
t.changeImouUrl(
'recordType',
'cloud'
);
}
});
var s = document.createElement('div');
s.setAttribute(
'id',
'imou_player_message_root_'.concat(i)
),
s.setAttribute(
'style',
'position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:1.2em;color:white;z-index:99999;'
),
(s.style.display = 'none'),
n.appendChild(s);
var c = document.createElement('canvas');
c.setAttribute(
'id',
'imou_player_timeLine-web_'.concat(i)
),
c.setAttribute(
'style',
'display:none;position:absolute;bottom:0px;z-index:99999;background-color:rgba(60, 60, 60,1);'
);
var l = new d({
elem: c,
width: t.status.width,
height: 50,
Obj: t,
beginTime:
e()(t.status.beginTime).unix() -
e()(t.status.beginTime).startOf('day').unix(),
});
(t.timeLine = l), n.appendChild(c);
var u = document.createElement('div');
u.setAttribute(
'id',
'imou_player_timeLine-celeContainer_'.concat(i)
),
u.setAttribute(
'style',
'display:none;position:absolute;bottom:0px;padding-right:10px;right:0px;z-index:99999;width:35px;height:50px;background-color:rgb(60, 60, 60);'
);
var h = document.createElement('div');
h.setAttribute(
'class',
'iconfont icon-Console_icon_calendar record-icon'
),
h.setAttribute('style', 'bottom:10px;left:5px;'),
h.addEventListener('click', function () {
'' === m.style.display
? (m.style.display = 'none')
: (m.style.display = '');
});
var m = document.createElement('div');
return (
m.setAttribute(
'id',
'player_timeLine-cele_'.concat(i)
),
m.setAttribute(
'style',
'display:none;position:absolute;top:-332px;left:-274px;width:274px;height:322px;'
),
setTimeout(function () {
var n = t.status.beginTime.split(' ')[0],
a = e()().format('YYYY-MM-DD');
r().render({
elem: '#player_timeLine-cele_'.concat(i),
type: 'date',
position: 'static',
value: n,
max: a,
btns: [],
done: function (e) {
setTimeout(function () {
(m.style.display = 'none'),
t.changeImouUrl('beginTime x', e);
}, 100);
},
});
}, 3e3),
u.appendChild(h),
u.appendChild(m),
n.appendChild(u),
n
);
})(w);
this.root.appendChild(T),
y && (this.status.volume = !1),
this.crateIframe(b, o, h),
this.createHandleClick([
'play',
'pause',
'stop',
'capture',
'ptzControl',
'talk',
'volume',
]),
(this.listener = {
play: function () {},
stop: function () {},
pause: function () {},
audioChange: function () {},
talk: function () {},
capture: function () {},
error: function () {},
volume: function () {},
}),
(this.playStatus = !1),
(this.resizeObserver = new ResizeObserver(function (t) {
var e,
n = (function (t, e) {
var n =
('undefined' != typeof Symbol && t[Symbol.iterator]) ||
t['@@iterator'];
if (!n) {
if (
Array.isArray(t) ||
(n = (function (t, e) {
if (t) {
if ('string' == typeof t) return f(t, e);
var n = Object.prototype.toString
.call(t)
.slice(8, -1);
return (
'Object' === n &&
t.constructor &&
(n = t.constructor.name),
'Map' === n || 'Set' === n
? Array.from(t)
: 'Arguments' === n ||
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
n
)
? f(t, e)
: void 0
);
}
})(t)) ||
(e && t && 'number' == typeof t.length)
) {
n && (t = n);
var i = 0,
a = function () {};
return {
s: a,
n: function () {
return i >= t.length
? { done: !0 }
: { done: !1, value: t[i++] };
},
e: function (t) {
throw t;
},
f: a,
};
}
throw new TypeError(
'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
);
}
var o,
r = !0,
s = !1;
return {
s: function () {
n = n.call(t);
},
n: function () {
var t = n.next();
return (r = t.done), t;
},
e: function (t) {
(s = !0), (o = t);
},
f: function () {
try {
r || null == n.return || n.return();
} finally {
if (s) throw o;
}
},
};
})(t);
try {
for (n.s(); !(e = n.n()).done; ) {
var a = e.value;
a.contentRect &&
(function () {
var t = a.contentRect,
e = t.width,
n = t.height;
document.documentElement.clientWidth !== e &&
((i.status.width = e), (i.status.height = n)),
setTimeout(function () {
i.timeLine &&
i.timeLine.changeProp('width', e);
}, 50);
})();
}
} catch (t) {
n.e(t);
} finally {
n.f();
}
})),
this.resizeObserver.observe(this.root);
}
var n, i, o, s;
return (
(n = t),
(i = [
{
key: 'crateIframe',
value: function (t, e, n) {
var i = this,
a = 'url='
.concat(t, '&kitToken=')
.concat(e, '&code=')
.concat(encodeURIComponent(n)),
o = encodeURI(''.concat(this.domain, '?').concat(a));
this.iframeUrl = o;
var r = document.createElement('iframe');
(r.id = this.iframeId),
(r.src = o),
(r.width = '100%'),
(r.height = '100%'),
(r.style = 'border:0;position:absolute;'),
r.setAttribute(
'allow',
'autoplay;microphone;fullscreen;midi;encrypted-media;'
),
r.setAttribute('frameborder', 0),
this.root.appendChild(r),
(this.iframe = r),
(this.iframeId = r.id),
('' !== this.status.message &&
'播放结束' !== this.status.message) ||
(this.status.message = '加载中···'),
(this.addMessageListen = this.addMessageListen.bind(this)),
window.addEventListener('message', this.addMessageListen),
(r.onload = function () {
i.emitMessage({ id: r.id, type: 'init' });
});
var s = function () {
document.webkitIsFullScreen ||
document.mozFullScreen ||
document.msFullscreenElement ||
(i.status.fullPage = !1);
};
(this.exitHandler = s),
document.addEventListener('webkitfullscreenchange', s, !1),
document.addEventListener('mozfullscreenchange', s, !1),
document.addEventListener('fullscreenchange', s, !1),
document.addEventListener('MSFullscreenChange', s, !1);
},
},
{
key: 'addMessageListen',
value: function (t) {
var e = this,
n = t.data,
i = n.id,
o = n.code,
r = n.msg;
if (i === this.iframe.id)
switch (o) {
case '6001':
this.timeLine &&
this.timeLine.changeProp(
'timestamp',
t.data.timestamp
);
break;
case '2000':
if (this.playing) return;
(this.status.message = ''),
(this.playing = !0),
(this.status.playing = !0),
2 === this.status.type &&
(this.timeLine && this.timeLine.start(),
this.requestRecordList()),
this.listener.play(),
setTimeout(function () {
!/Mobi|Android|iPhone/i.test(
navigator.userAgent
) &&
e.status.volume &&
e.volume(1);
}, 1e3),
(this.mouseleaveFunc = function (t) {
var e = this;
a(this.iframeId, !1),
this.buttonShowOrHiddenFlag &&
clearTimeout(
this.buttonShowOrHiddenFlag
),
(this.buttonShowOrHiddenFlag =
setTimeout(function () {
a(e.iframeId);
}, 3e3));
}),
(this.mouseleaveFunc =
this.mouseleaveFunc.bind(this)),
this.root.addEventListener(
'mouseover',
this.mouseleaveFunc
),
(this.buttonShowOrHiddenFlag = setTimeout(
function () {
a(e.iframeId);
},
3e3
));
break;
case '2001':
(this.status.playing = !0),
this.listener.play &&
this.listener.play(t.data);
break;
case '2002':
(this.status.playing = !1),
this.listener.pause &&
this.listener.pause(t.data);
break;
case '2003':
(this.status.volume = !0),
this.listener.volume(t.data);
break;
case '4209':
this.listener.volume(t.data);
break;
case '2004':
(this.status.volume = !1),
this.listener.volume(t.data);
break;
case '2005':
(this.status.talk = !0), this.listener.talk(t.data);
break;
case '4000':
case '4102':
case '4104':
case '4105':
case '4107':
a(this.iframeId, !1),
(this.status.message = r),
this.listener.error(t.data);
break;
case '2006':
case '4201':
case '4202':
case '4203':
case '4204':
case '4205':
case '4206':
case '4207':
case '4208':
(this.status.talk = !1), this.listener.talk(t.data);
break;
case '6002':
this.doRequestRecordList(t.data.recordList);
}
},
},
{
key: 'emitMessage',
value: function (t) {
this.iframe.contentWindow.postMessage(t, this.domain);
},
},
{
key: 'on',
value: function (t, e) {
this.listener[t] && (this.listener[t] = e);
},
},
{
key: 'emit',
value:
((o = m().mark(function t(e, n) {
return m().wrap(
function (t) {
for (;;)
switch ((t.prev = t.next)) {
case 0:
if (this.listener[e]) {
t.next = 2;
break;
}
return t.abrupt('return');
case 2:
this.listener[e].forEach(function (t) {
return t();
});
case 3:
case 'end':
return t.stop();
}
},
t,
this
);
})),
(s = function () {
var t = this,
e = arguments;
return new Promise(function (n, i) {
var a = o.apply(t, e);
function r(t) {
y(a, n, i, r, s, 'next', t);
}
function s(t) {
y(a, n, i, r, s, 'throw', t);
}
r(void 0);
});
}),
function (t, e) {
return s.apply(this, arguments);
}),
},
{
key: 'createHandleClick',
value: function (t) {
var e = this;
t.forEach(function (t) {
e[t] = function (n) {
('play' !== t || e.playing) &&
e.emitMessage({
id: e.iframe.id,
type: ''.concat(t),
params: n,
});
};
});
},
},
{
key: 'fullScreen',
value: function () {
var t = this,
e = this.root;
(
e.requestFullScreen ||
e.webkitRequestFullScreen ||
e.mozRequestFullScreen ||
e.msRequestFullscreen
).call(e),
setTimeout(function () {
t.timeLine &&
t.timeLine.changeProp('width', window.screen.width);
}, 50);
},
},
{
key: 'exitFullScreen',
value: function () {
var t = this;
(
document.exitFullScreen ||
document.webkitCancelFullScreen ||
document.mozCancelFullScreen ||
document.msExitFullscreen
).call(document),
setTimeout(function () {
t.timeLine &&
t.timeLine.changeProp(
'width',
t.status.fullWebPage
? document.documentElement.clientWidth
: t.status.width
);
}, 100);
},
},
{
key: 'fullPageScreen',
value: function () {
var t = this;
window.scroll(0, 0), (document.body.style.overflow = 'hidden');
var e = document.documentElement.clientWidth,
n = document.documentElement.clientHeight;
(this.root.style.position = 'absolute'),
(this.root.style.left = '0'),
(this.root.style.top = '0'),
(this.root.style.width = ''.concat(e, 'px')),
(this.root.style.height = ''.concat(n, 'px')),
(this.root.style.zIndex = '999999'),
setTimeout(function () {
t.timeLine && t.timeLine.changeProp('width', e);
}, 100);
},
},
{
key: 'exitFullPageScreen',
value: function () {
var t = this;
(this.root.style.position = 'relative'),
(this.root.style.width = ''.concat(
this.status.width,
'px'
)),
(this.root.style.height = ''.concat(
this.status.height,
'px'
)),
(this.root.style.zIndex = ''),
(document.body.style.overflow = ''),
setTimeout(function () {
t.timeLine &&
t.timeLine.changeProp('width', t.status.width);
}, 0);
},
},
{
key: 'changeImouUrl',
value: function (t, n) {
switch ((this.destroy(!1), t)) {
case 'beginTime':
(this.status.beginTime = e()
.unix(
e()(this.status.beginTime)
.startOf('day')
.unix() + n
)
.format('YYYY-MM-DD HH:mm:ss')),
(this.status.endTime = e()(this.status.beginTime)
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'));
break;
case 'beginTime x':
(this.status.beginTime =
e()(n).format('YYYY-MM-DD HH:mm:ss')),
(this.status.endTime = e()(this.status.beginTime)
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss')),
(this.record = []),
this.timeLine && this.timeLine.stop(!0),
(this.status.message = '切换日期至'.concat(
n,
'中...'
));
break;
case 'recordType':
(this.status.beginTime = e()(this.status.beginTime)
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss')),
(this.status.endTime = e()(this.status.beginTime)
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss')),
(this.record = []),
this.timeLine && this.timeLine.stop(!0),
(this.status[t] = n);
break;
default:
this.status[t] = n;
}
(this.status.yuntai = !1),
(this.status.talk = !1),
(this.status.volume = 1),
(this.status.playing = !1);
var i = this.status,
a = 'imou://open.lechange.com/'
.concat(i.deviceId, '/')
.concat(i.channelId, '/')
.concat(i.type, '?streamId=')
.concat(i.clarity, '&recordType=')
.concat(i.recordType, '&beginTime=')
.concat(i.beginTime, '&endTime=')
.concat(i.endTime);
this.crateIframe(a, i.token, i.code);
},
},
{
key: 'destroy',
value: function () {
var t =
!(arguments.length > 0 && void 0 !== arguments[0]) ||
arguments[0],
e = this.iframe;
this.iframe.src = 'about:blank';
try {
e.contentWindow.document.write(''),
e.contentWindow.document.clear();
} catch (t) {
console.log(t);
}
if (
(e.parentNode.removeChild(e),
document.removeEventListener(
'webkitfullscreenchange',
this.exitHandler
),
document.removeEventListener(
'mozfullscreenchange',
this.exitHandler
),
document.removeEventListener(
'fullscreenchange',
this.exitHandler
),
document.removeEventListener(
'MSFullscreenChange',
this.exitHandler
),
window.removeEventListener(
'message',
this.addMessageListen
),
this.root.removeEventListener(
'mouseover',
this.mouseleaveFunc
),
this.buttonShowOrHiddenFlag &&
clearTimeout(this.buttonShowOrHiddenFlag),
this.recordListTimer && clearTimeout(this.recordListTimer),
this.timestampTimer && clearInterval(this.timestampTimer),
this.requestRecordListTimer &&
clearTimeout(this.requestRecordListTimer),
this.timeLine && this.timeLine.stop(),
(this.playing = !1),
t)
) {
for (
this.resizeObserver.unobserve(this.root);
this.root.firstChild;
)
this.root.removeChild(this.root.firstChild);
this.timeLine = null;
}
},
},
{
key: 'requestRecordList',
value: function () {
if (0 === this.record.length)
this.emitMessage({
type: 'getRecordList',
params: {
beginTime: this.status.beginTime,
endTime: this.status.endTime,
recordType: this.status.recordType,
},
});
else {
var t = e()(this.status.beginTime).startOf('day').unix();
this.emitMessage({
type: 'getRecordList',
params: {
beginTime: e()
.unix(
this.record[this.record.length - 1]
.endTime + t
)
.format('YYYY-MM-DD HH:mm:ss'),
endTime: this.status.endTime,
recordType: this.status.recordType,
},
});
}
},
},
{
key: 'doRequestRecordList',
value: function (t) {
var n = this,
i = e()(this.status.beginTime).startOf('day').unix();
(this.record = this.record.concat(
t.map(function (t) {
return {
beginTime: e()(t.beginTime).unix() - i,
endTime: e()(t.endTime).unix() - i,
};
})
)),
(('localRecord' === this.status.recordType &&
t.length >= 64) ||
t.length >= 99) &&
(this.requestRecordListTimer = setTimeout(function () {
n.requestRecordList();
}, 3e3)),
this.timeLine &&
this.timeLine.changeProp('record', this.record);
},
},
{
key: 'changeRootWidthAndHeight',
value: function (t, e) {
var n = this;
(this.root.style.width = ''.concat(t, 'px')),
(this.root.style.height = ''.concat(e, 'px')),
setTimeout(function () {
n.timeLine && n.timeLine.changeProp('width', t);
}, 100);
},
},
]),
i && p(n.prototype, i),
Object.defineProperty(n, 'prototype', { writable: !1 }),
t
);
})();
window && (window.imouPlayer = g);
const v = g;
})(),
i
);
})()
);