· 6 years ago · Apr 04, 2020, 04:44 AM
1/**
2 * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
3 * v1.5.3
4 *
5 * Copyright 2013, Moxiecode Systems AB
6 * Released under GPL License.
7 *
8 * License: http://www.plupload.com/license
9 * Contributing: http://www.plupload.com/contributing
10 *
11 * Date: 2017-02-02
12 */
13!function (e, t) {
14 var i = function () {
15 var e = {
16 };
17 return t.apply(e, arguments),
18 e.moxie
19 };
20 'function' == typeof define && define.amd ? define('moxie', [
21 ], i) : 'object' == typeof module && module.exports ? module.exports = i() : e.moxie = i()
22}(this || window, function () {
23 !function (e, t) {
24 'use strict';
25 function i(e, t) {
26 for (var i, n = [
27 ], r = 0; r < e.length; ++r) {
28 if (i = s[e[r]] || o(e[r]), !i) throw 'module definition dependecy not found: ' + e[r];
29 n.push(i)
30 }
31 t.apply(null, n)
32 }
33 function n(e, n, r) {
34 if ('string' != typeof e) throw 'invalid module definition, module id must be defined and be a string';
35 if (n === t) throw 'invalid module definition, dependencies must be specified';
36 if (r === t) throw 'invalid module definition, definition function must be specified';
37 i(n, function () {
38 s[e] = r.apply(null, arguments)
39 })
40 }
41 function r(e) {
42 return !!s[e]
43 }
44 function o(t) {
45 for (var i = e, n = t.split(/[.\/]/), r = 0; r < n.length; ++r) {
46 if (!i[n[r]]) return;
47 i = i[n[r]]
48 }
49 return i
50 }
51 function a(i) {
52 for (var n = 0; n < i.length; n++) {
53 for (var r = e, o = i[n], a = o.split(/[.\/]/), u = 0; u < a.length - 1; ++u) r[a[u]] === t && (r[a[u]] = {
54 }),
55 r = r[a[u]];
56 r[a[a.length - 1]] = s[o]
57 }
58 }
59 var s = {
60 };
61 n('moxie/core/utils/Basic', [
62 ], function () {
63 function e(e) {
64 var t;
65 return e === t ? 'undefined' : null === e ? 'null' : e.nodeType ? 'node' : {
66 }.toString.call(e).match(/\s([a-z|A-Z]+)/) [1].toLowerCase()
67 }
68 function t() {
69 return a(!1, !1, arguments)
70 }
71 function i() {
72 return a(!0, !1, arguments)
73 }
74 function n() {
75 return a(!1, !0, arguments)
76 }
77 function r() {
78 return a(!0, !0, arguments)
79 }
80 function o(i) {
81 switch (e(i)) {
82 case 'array':
83 return Array.prototype.slice.call(i);
84 case 'object':
85 return t({
86 }, i)
87 }
88 return i
89 }
90 function a(t, i, n) {
91 var r,
92 s = n[0];
93 return u(n, function (n, c) {
94 c > 0 && u(n, function (n, u) {
95 var c = - 1 !== m(e(n), [
96 'array',
97 'object'
98 ]);
99 return n === r || t && s[u] === r ? !0 : (c && i && (n = o(n)), e(s[u]) === e(n) && c ? a(t, i, [
100 s[u],
101 n
102 ]) : s[u] = n, void 0)
103 })
104 }),
105 s
106 }
107 function s(e, t) {
108 function i() {
109 this.constructor = e
110 }
111 for (var n in t) ({
112 }).hasOwnProperty.call(t, n) && (e[n] = t[n]);
113 return i.prototype = t.prototype,
114 e.prototype = new i,
115 e.__parent__ = t.prototype,
116 e
117 }
118 function u(e, t) {
119 var i,
120 n,
121 r,
122 o;
123 if (e) {
124 try {
125 i = e.length
126 } catch (a) {
127 i = o
128 }
129 if (i === o || 'number' != typeof i) {
130 for (n in e) if (e.hasOwnProperty(n) && t(e[n], n) === !1) return
131 } else for (r = 0; i > r; r++) if (t(e[r], r) === !1) return
132 }
133 }
134 function c(t) {
135 var i;
136 if (!t || 'object' !== e(t)) return !0;
137 for (i in t) return !1;
138 return !0
139 }
140 function l(t, i) {
141 function n(r) {
142 'function' === e(t[r]) && t[r](function (e) {
143 ++r < o && !e ? n(r) : i(e)
144 })
145 }
146 var r = 0,
147 o = t.length;
148 'function' !== e(i) && (i = function () {
149 }),
150 t && t.length || i(),
151 n(r)
152 }
153 function d(e, t) {
154 var i = 0,
155 n = e.length,
156 r = new Array(n);
157 u(e, function (e, o) {
158 e(function (e) {
159 if (e) return t(e);
160 var a = [
161 ].slice.call(arguments);
162 a.shift(),
163 r[o] = a,
164 i++,
165 i === n && (r.unshift(null), t.apply(this, r))
166 })
167 })
168 }
169 function m(e, t) {
170 if (t) {
171 if (Array.prototype.indexOf) return Array.prototype.indexOf.call(t, e);
172 for (var i = 0, n = t.length; n > i; i++) if (t[i] === e) return i
173 }
174 return - 1
175 }
176 function h(t, i) {
177 var n = [
178 ];
179 'array' !== e(t) && (t = [
180 t
181 ]),
182 'array' !== e(i) && (i = [
183 i
184 ]);
185 for (var r in t) - 1 === m(t[r], i) && n.push(t[r]);
186 return n.length ? n : !1
187 }
188 function f(e, t) {
189 var i = [
190 ];
191 return u(e, function (e) {
192 - 1 !== m(e, t) && i.push(e)
193 }),
194 i.length ? i : null
195 }
196 function p(e) {
197 var t,
198 i = [
199 ];
200 for (t = 0; t < e.length; t++) i[t] = e[t];
201 return i
202 }
203 function g(e) {
204 return e ? String.prototype.trim ? String.prototype.trim.call(e) : e.toString().replace(/^\s*/, '').replace(/\s*$/, '') : e
205 }
206 function x(e) {
207 if ('string' != typeof e) return e;
208 var t,
209 i = {
210 t: 1099511627776,
211 g: 1073741824,
212 m: 1048576,
213 k: 1024
214 };
215 return e = /^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g, '')),
216 t = e[2],
217 e = + e[1],
218 i.hasOwnProperty(t) && (e *= i[t]),
219 Math.floor(e)
220 }
221 function v(t) {
222 var i = [
223 ].slice.call(arguments, 1);
224 return t.replace(/%[a-z]/g, function () {
225 var t = i.shift();
226 return 'undefined' !== e(t) ? t : ''
227 })
228 }
229 function w(e, t) {
230 var i = this;
231 setTimeout(function () {
232 e.call(i)
233 }, t || 1)
234 }
235 var y = function () {
236 var e = 0;
237 return function (t) {
238 var i,
239 n = (new Date).getTime().toString(32);
240 for (i = 0; 5 > i; i++) n += Math.floor(65535 * Math.random()).toString(32);
241 return (t || 'o_') + n + (e++).toString(32)
242 }
243 }();
244 return {
245 guid: y,
246 typeOf: e,
247 extend: t,
248 extendIf: i,
249 extendImmutable: n,
250 extendImmutableIf: r,
251 inherit: s,
252 each: u,
253 isEmptyObj: c,
254 inSeries: l,
255 inParallel: d,
256 inArray: m,
257 arrayDiff: h,
258 arrayIntersect: f,
259 toArray: p,
260 trim: g,
261 sprintf: v,
262 parseSizeStr: x,
263 delay: w
264 }
265 }), n('moxie/core/utils/Encode', [
266 ], function () {
267 var e = function (e) {
268 return unescape(encodeURIComponent(e))
269 },
270 t = function (e) {
271 return decodeURIComponent(escape(e))
272 },
273 i = function (e, i) {
274 if ('function' == typeof window.atob) return i ? t(window.atob(e)) : window.atob(e);
275 var n,
276 r,
277 o,
278 a,
279 s,
280 u,
281 c,
282 l,
283 d = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
284 m = 0,
285 h = 0,
286 f = '',
287 p = [
288 ];
289 if (!e) return e;
290 e += '';
291 do a = d.indexOf(e.charAt(m++)),
292 s = d.indexOf(e.charAt(m++)),
293 u = d.indexOf(e.charAt(m++)),
294 c = d.indexOf(e.charAt(m++)),
295 l = a << 18 | s << 12 | u << 6 | c,
296 n = 255 & l >> 16,
297 r = 255 & l >> 8,
298 o = 255 & l,
299 p[h++] = 64 == u ? String.fromCharCode(n) : 64 == c ? String.fromCharCode(n, r) : String.fromCharCode(n, r, o);
300 while (m < e.length);
301 return f = p.join(''),
302 i ? t(f) : f
303 },
304 n = function (t, i) {
305 if (i && (t = e(t)), 'function' == typeof window.btoa) return window.btoa(t);
306 var n,
307 r,
308 o,
309 a,
310 s,
311 u,
312 c,
313 l,
314 d = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
315 m = 0,
316 h = 0,
317 f = '',
318 p = [
319 ];
320 if (!t) return t;
321 do n = t.charCodeAt(m++),
322 r = t.charCodeAt(m++),
323 o = t.charCodeAt(m++),
324 l = n << 16 | r << 8 | o,
325 a = 63 & l >> 18,
326 s = 63 & l >> 12,
327 u = 63 & l >> 6,
328 c = 63 & l,
329 p[h++] = d.charAt(a) + d.charAt(s) + d.charAt(u) + d.charAt(c);
330 while (m < t.length);
331 f = p.join('');
332 var g = t.length % 3;
333 return (g ? f.slice(0, g - 3) : f) + '==='.slice(g || 3)
334 };
335 return {
336 utf8_encode: e,
337 utf8_decode: t,
338 atob: i,
339 btoa: n
340 }
341 }), n('moxie/core/utils/Env', [
342 'moxie/core/utils/Basic'
343 ], function (e) {
344 function t(e, t, i) {
345 var n = 0,
346 r = 0,
347 o = 0,
348 a = {
349 dev: - 6,
350 alpha: - 5,
351 a: - 5,
352 beta: - 4,
353 b: - 4,
354 RC: - 3,
355 rc: - 3,
356 '#': - 2,
357 p: 1,
358 pl: 1
359 },
360 s = function (e) {
361 return e = ('' + e).replace(/[_\-+]/g, '.'),
362 e = e.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.'),
363 e.length ? e.split('.') : [
364 - 8
365 ]
366 },
367 u = function (e) {
368 return e ? isNaN(e) ? a[e] || - 7 : parseInt(e, 10) : 0
369 };
370 for (e = s(e), t = s(t), r = Math.max(e.length, t.length), n = 0; r > n; n++) if (e[n] != t[n]) {
371 if (e[n] = u(e[n]), t[n] = u(t[n]), e[n] < t[n]) {
372 o = - 1;
373 break
374 }
375 if (e[n] > t[n]) {
376 o = 1;
377 break
378 }
379 }
380 if (!i) return o;
381 switch (i) {
382 case '>':
383 case 'gt':
384 return o > 0;
385 case '>=':
386 case 'ge':
387 return o >= 0;
388 case '<=':
389 case 'le':
390 return 0 >= o;
391 case '==':
392 case '=':
393 case 'eq':
394 return 0 === o;
395 case '<>':
396 case '!=':
397 case 'ne':
398 return 0 !== o;
399 case '':
400 case '<':
401 case 'lt':
402 return 0 > o;
403 default:
404 return null
405 }
406 }
407 var i = function (e) {
408 var t = '',
409 i = '?',
410 n = 'function',
411 r = 'undefined',
412 o = 'object',
413 a = 'name',
414 s = 'version',
415 u = {
416 has: function (e, t) {
417 return - 1 !== t.toLowerCase().indexOf(e.toLowerCase())
418 },
419 lowerize: function (e) {
420 return e.toLowerCase()
421 }
422 },
423 c = {
424 rgx: function () {
425 for (var t, i, a, s, u, c, l, d = 0, m = arguments; d < m.length; d += 2) {
426 var h = m[d],
427 f = m[d + 1];
428 if (typeof t === r) {
429 t = {
430 };
431 for (s in f) u = f[s],
432 typeof u === o ? t[u[0]] = e : t[u] = e
433 }
434 for (i = a = 0; i < h.length; i++) if (c = h[i].exec(this.getUA())) {
435 for (s = 0; s < f.length; s++) l = c[++a],
436 u = f[s],
437 typeof u === o && u.length > 0 ? 2 == u.length ? t[u[0]] = typeof u[1] == n ? u[1].call(this, l) : u[1] : 3 == u.length ? t[u[0]] = typeof u[1] !== n || u[1].exec && u[1].test ? l ? l.replace(u[1], u[2]) : e : l ? u[1].call(this, l, u[2]) : e : 4 == u.length && (t[u[0]] = l ? u[3].call(this, l.replace(u[1], u[2])) : e) : t[u] = l ? l : e;
438 break
439 }
440 if (c) break
441 }
442 return t
443 },
444 str: function (t, n) {
445 for (var r in n) if (typeof n[r] === o && n[r].length > 0) {
446 for (var a = 0; a < n[r].length; a++) if (u.has(n[r][a], t)) return r === i ? e : r
447 } else if (u.has(n[r], t)) return r === i ? e : r;
448 return t
449 }
450 },
451 l = {
452 browser: {
453 oldsafari: {
454 major: {
455 1: [
456 '/8',
457 '/1',
458 '/3'
459 ],
460 2: '/4',
461 '?': '/'
462 },
463 version: {
464 '1.0': '/8',
465 1.2: '/1',
466 1.3: '/3',
467 '2.0': '/412',
468 '2.0.2': '/416',
469 '2.0.3': '/417',
470 '2.0.4': '/419',
471 '?': '/'
472 }
473 }
474 },
475 device: {
476 sprint: {
477 model: {
478 'Evo Shift 4G': '7373KT'
479 },
480 vendor: {
481 HTC: 'APA',
482 Sprint: 'Sprint'
483 }
484 }
485 },
486 os: {
487 windows: {
488 version: {
489 ME: '4.90',
490 'NT 3.11': 'NT3.51',
491 'NT 4.0': 'NT4.0',
492 2000: 'NT 5.0',
493 XP: [
494 'NT 5.1',
495 'NT 5.2'
496 ],
497 Vista: 'NT 6.0',
498 7: 'NT 6.1',
499 8: 'NT 6.2',
500 8.1: 'NT 6.3',
501 RT: 'ARM'
502 }
503 }
504 }
505 },
506 d = {
507 browser: [
508 [/(opera\smini)\/([\w\.-]+)/i,
509 /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,
510 /(opera).+version\/([\w\.]+)/i,
511 /(opera)[\/\s]+([\w\.]+)/i],
512 [
513 a,
514 s
515 ],
516 [
517 /\s(opr)\/([\w\.]+)/i
518 ],
519 [
520 [a,
521 'Opera'],
522 s
523 ],
524 [
525 /(kindle)\/([\w\.]+)/i,
526 /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,
527 /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,
528 /(?:ms|\()(ie)\s([\w\.]+)/i,
529 /(rekonq)\/([\w\.]+)*/i,
530 /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i
531 ],
532 [
533 a,
534 s
535 ],
536 [
537 /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i
538 ],
539 [
540 [a,
541 'IE'],
542 s
543 ],
544 [
545 /(edge)\/((\d+)?[\w\.]+)/i
546 ],
547 [
548 a,
549 s
550 ],
551 [
552 /(yabrowser)\/([\w\.]+)/i
553 ],
554 [
555 [a,
556 'Yandex'],
557 s
558 ],
559 [
560 /(comodo_dragon)\/([\w\.]+)/i
561 ],
562 [
563 [a,
564 /_/g,
565 ' '],
566 s
567 ],
568 [
569 /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,
570 /(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i
571 ],
572 [
573 a,
574 s
575 ],
576 [
577 /(dolfin)\/([\w\.]+)/i
578 ],
579 [
580 [a,
581 'Dolphin'],
582 s
583 ],
584 [
585 /((?:android.+)crmo|crios)\/([\w\.]+)/i
586 ],
587 [
588 [a,
589 'Chrome'],
590 s
591 ],
592 [
593 /XiaoMi\/MiuiBrowser\/([\w\.]+)/i
594 ],
595 [
596 s,
597 [
598 a,
599 'MIUI Browser'
600 ]
601 ],
602 [
603 /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i
604 ],
605 [
606 s,
607 [
608 a,
609 'Android Browser'
610 ]
611 ],
612 [
613 /FBAV\/([\w\.]+);/i
614 ],
615 [
616 s,
617 [
618 a,
619 'Facebook'
620 ]
621 ],
622 [
623 /version\/([\w\.]+).+?mobile\/\w+\s(safari)/i
624 ],
625 [
626 s,
627 [
628 a,
629 'Mobile Safari'
630 ]
631 ],
632 [
633 /version\/([\w\.]+).+?(mobile\s?safari|safari)/i
634 ],
635 [
636 s,
637 a
638 ],
639 [
640 /webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i
641 ],
642 [
643 a,
644 [
645 s,
646 c.str,
647 l.browser.oldsafari.version
648 ]
649 ],
650 [
651 /(konqueror)\/([\w\.]+)/i,
652 /(webkit|khtml)\/([\w\.]+)/i
653 ],
654 [
655 a,
656 s
657 ],
658 [
659 /(navigator|netscape)\/([\w\.-]+)/i
660 ],
661 [
662 [a,
663 'Netscape'],
664 s
665 ],
666 [
667 /(swiftfox)/i,
668 /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,
669 /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,
670 /(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,
671 /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,
672 /(links)\s\(([\w\.]+)/i,
673 /(gobrowser)\/?([\w\.]+)*/i,
674 /(ice\s?browser)\/v?([\w\._]+)/i,
675 /(mosaic)[\/\s]([\w\.]+)/i
676 ],
677 [
678 a,
679 s
680 ]
681 ],
682 engine: [
683 [/windows.+\sedge\/([\w\.]+)/i],
684 [
685 s,
686 [
687 a,
688 'EdgeHTML'
689 ]
690 ],
691 [
692 /(presto)\/([\w\.]+)/i,
693 /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,
694 /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,
695 /(icab)[\/\s]([23]\.[\d\.]+)/i
696 ],
697 [
698 a,
699 s
700 ],
701 [
702 /rv\:([\w\.]+).*(gecko)/i
703 ],
704 [
705 s,
706 a
707 ]
708 ],
709 os: [
710 [/microsoft\s(windows)\s(vista|xp)/i],
711 [
712 a,
713 s
714 ],
715 [
716 /(windows)\snt\s6\.2;\s(arm)/i,
717 /(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
718 ],
719 [
720 a,
721 [
722 s,
723 c.str,
724 l.os.windows.version
725 ]
726 ],
727 [
728 /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
729 ],
730 [
731 [a,
732 'Windows'],
733 [
734 s,
735 c.str,
736 l.os.windows.version
737 ]
738 ],
739 [
740 /\((bb)(10);/i
741 ],
742 [
743 [a,
744 'BlackBerry'],
745 s
746 ],
747 [
748 /(blackberry)\w*\/?([\w\.]+)*/i,
749 /(tizen)[\/\s]([\w\.]+)/i,
750 /(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,
751 /linux;.+(sailfish);/i
752 ],
753 [
754 a,
755 s
756 ],
757 [
758 /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i
759 ],
760 [
761 [a,
762 'Symbian'],
763 s
764 ],
765 [
766 /\((series40);/i
767 ],
768 [
769 a
770 ],
771 [
772 /mozilla.+\(mobile;.+gecko.+firefox/i
773 ],
774 [
775 [a,
776 'Firefox OS'],
777 s
778 ],
779 [
780 /(nintendo|playstation)\s([wids3portablevu]+)/i,
781 /(mint)[\/\s\(]?(\w+)*/i,
782 /(mageia|vectorlinux)[;\s]/i,
783 /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,
784 /(hurd|linux)\s?([\w\.]+)*/i,
785 /(gnu)\s?([\w\.]+)*/i
786 ],
787 [
788 a,
789 s
790 ],
791 [
792 /(cros)\s[\w]+\s([\w\.]+\w)/i
793 ],
794 [
795 [a,
796 'Chromium OS'],
797 s
798 ],
799 [
800 /(sunos)\s?([\w\.]+\d)*/i
801 ],
802 [
803 [a,
804 'Solaris'],
805 s
806 ],
807 [
808 /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i
809 ],
810 [
811 a,
812 s
813 ],
814 [
815 /(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i
816 ],
817 [
818 [a,
819 'iOS'],
820 [
821 s,
822 /_/g,
823 '.'
824 ]
825 ],
826 [
827 /(mac\sos\sx)\s?([\w\s\.]+\w)*/i,
828 /(macintosh|mac(?=_powerpc)\s)/i
829 ],
830 [
831 [a,
832 'Mac OS'],
833 [
834 s,
835 /_/g,
836 '.'
837 ]
838 ],
839 [
840 /((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,
841 /(haiku)\s(\w+)/i,
842 /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,
843 /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,
844 /(unix)\s?([\w\.]+)*/i
845 ],
846 [
847 a,
848 s
849 ]
850 ]
851 },
852 m = function (e) {
853 var i = e || (window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : t);
854 this.getBrowser = function () {
855 return c.rgx.apply(this, d.browser)
856 },
857 this.getEngine = function () {
858 return c.rgx.apply(this, d.engine)
859 },
860 this.getOS = function () {
861 return c.rgx.apply(this, d.os)
862 },
863 this.getResult = function () {
864 return {
865 ua: this.getUA(),
866 browser: this.getBrowser(),
867 engine: this.getEngine(),
868 os: this.getOS()
869 }
870 },
871 this.getUA = function () {
872 return i
873 },
874 this.setUA = function (e) {
875 return i = e,
876 this
877 },
878 this.setUA(i)
879 };
880 return m
881 }(),
882 n = function () {
883 var t = {
884 define_property: function () {
885 return !1
886 }(),
887 create_canvas: function () {
888 var e = document.createElement('canvas');
889 return !(!e.getContext || !e.getContext('2d'))
890 }(),
891 return_response_type: function (t) {
892 try {
893 if ( - 1 !== e.inArray(t, [
894 '',
895 'text',
896 'document'
897 ])) return !0;
898 if (window.XMLHttpRequest) {
899 var i = new XMLHttpRequest;
900 if (i.open('get', '/'), 'responseType' in i) return i.responseType = t,
901 i.responseType !== t ? !1 : !0
902 }
903 } catch (n) {
904 }
905 return !1
906 },
907 use_data_uri: function () {
908 var e = new Image;
909 return e.onload = function () {
910 t.use_data_uri = 1 === e.width && 1 === e.height
911 },
912 setTimeout(function () {
913 e.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=='
914 }, 1),
915 !1
916 }(),
917 use_data_uri_over32kb: function () {
918 return t.use_data_uri && ('IE' !== o.browser || o.version >= 9)
919 },
920 use_data_uri_of: function (e) {
921 return t.use_data_uri && 33000 > e || t.use_data_uri_over32kb()
922 },
923 use_fileinput: function () {
924 if (navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)) return !1;
925 var e = document.createElement('input');
926 return e.setAttribute('type', 'file'),
927 !e.disabled
928 }
929 };
930 return function (i) {
931 var n = [
932 ].slice.call(arguments);
933 return n.shift(),
934 'function' === e.typeOf(t[i]) ? t[i].apply(this, n) : !!t[i]
935 }
936 }(),
937 r = (new i).getResult(),
938 o = {
939 can: n,
940 uaParser: i,
941 browser: r.browser.name,
942 version: r.browser.version,
943 os: r.os.name,
944 osVersion: r.os.version,
945 verComp: t,
946 swf_url: '../flash/Moxie.swf',
947 xap_url: '../silverlight/Moxie.xap',
948 global_event_dispatcher: 'moxie.core.EventTarget.instance.dispatchEvent'
949 };
950 return o.OS = o.os,
951 o
952 }), n('moxie/core/Exceptions', [
953 'moxie/core/utils/Basic'
954 ], function (e) {
955 function t(e, t) {
956 var i;
957 for (i in e) if (e[i] === t) return i;
958 return null
959 }
960 return {
961 RuntimeError: function () {
962 function i(e, i) {
963 this.code = e,
964 this.name = t(n, e),
965 this.message = this.name + (i || ': RuntimeError ' + this.code)
966 }
967 var n = {
968 NOT_INIT_ERR: 1,
969 EXCEPTION_ERR: 3,
970 NOT_SUPPORTED_ERR: 9,
971 JS_ERR: 4
972 };
973 return e.extend(i, n),
974 i.prototype = Error.prototype,
975 i
976 }(),
977 OperationNotAllowedException: function () {
978 function t(e) {
979 this.code = e,
980 this.name = 'OperationNotAllowedException'
981 }
982 return e.extend(t, {
983 NOT_ALLOWED_ERR: 1
984 }),
985 t.prototype = Error.prototype,
986 t
987 }(),
988 ImageError: function () {
989 function i(e) {
990 this.code = e,
991 this.name = t(n, e),
992 this.message = this.name + ': ImageError ' + this.code
993 }
994 var n = {
995 WRONG_FORMAT: 1,
996 MAX_RESOLUTION_ERR: 2,
997 INVALID_META_ERR: 3
998 };
999 return e.extend(i, n),
1000 i.prototype = Error.prototype,
1001 i
1002 }(),
1003 FileException: function () {
1004 function i(e) {
1005 this.code = e,
1006 this.name = t(n, e),
1007 this.message = this.name + ': FileException ' + this.code
1008 }
1009 var n = {
1010 NOT_FOUND_ERR: 1,
1011 SECURITY_ERR: 2,
1012 ABORT_ERR: 3,
1013 NOT_READABLE_ERR: 4,
1014 ENCODING_ERR: 5,
1015 NO_MODIFICATION_ALLOWED_ERR: 6,
1016 INVALID_STATE_ERR: 7,
1017 SYNTAX_ERR: 8
1018 };
1019 return e.extend(i, n),
1020 i.prototype = Error.prototype,
1021 i
1022 }(),
1023 DOMException: function () {
1024 function i(e) {
1025 this.code = e,
1026 this.name = t(n, e),
1027 this.message = this.name + ': DOMException ' + this.code
1028 }
1029 var n = {
1030 INDEX_SIZE_ERR: 1,
1031 DOMSTRING_SIZE_ERR: 2,
1032 HIERARCHY_REQUEST_ERR: 3,
1033 WRONG_DOCUMENT_ERR: 4,
1034 INVALID_CHARACTER_ERR: 5,
1035 NO_DATA_ALLOWED_ERR: 6,
1036 NO_MODIFICATION_ALLOWED_ERR: 7,
1037 NOT_FOUND_ERR: 8,
1038 NOT_SUPPORTED_ERR: 9,
1039 INUSE_ATTRIBUTE_ERR: 10,
1040 INVALID_STATE_ERR: 11,
1041 SYNTAX_ERR: 12,
1042 INVALID_MODIFICATION_ERR: 13,
1043 NAMESPACE_ERR: 14,
1044 INVALID_ACCESS_ERR: 15,
1045 VALIDATION_ERR: 16,
1046 TYPE_MISMATCH_ERR: 17,
1047 SECURITY_ERR: 18,
1048 NETWORK_ERR: 19,
1049 ABORT_ERR: 20,
1050 URL_MISMATCH_ERR: 21,
1051 QUOTA_EXCEEDED_ERR: 22,
1052 TIMEOUT_ERR: 23,
1053 INVALID_NODE_TYPE_ERR: 24,
1054 DATA_CLONE_ERR: 25
1055 };
1056 return e.extend(i, n),
1057 i.prototype = Error.prototype,
1058 i
1059 }(),
1060 EventException: function () {
1061 function t(e) {
1062 this.code = e,
1063 this.name = 'EventException'
1064 }
1065 return e.extend(t, {
1066 UNSPECIFIED_EVENT_TYPE_ERR: 0
1067 }),
1068 t.prototype = Error.prototype,
1069 t
1070 }()
1071 }
1072 }), n('moxie/core/utils/Dom', [
1073 'moxie/core/utils/Env'
1074 ], function (e) {
1075 var t = function (e) {
1076 return 'string' != typeof e ? e : document.getElementById(e)
1077 },
1078 i = function (e, t) {
1079 if (!e.className) return !1;
1080 var i = new RegExp('(^|\\s+)' + t + '(\\s+|$)');
1081 return i.test(e.className)
1082 },
1083 n = function (e, t) {
1084 i(e, t) || (e.className = e.className ? e.className.replace(/\s+$/, '') + ' ' + t : t)
1085 },
1086 r = function (e, t) {
1087 if (e.className) {
1088 var i = new RegExp('(^|\\s+)' + t + '(\\s+|$)');
1089 e.className = e.className.replace(i, function (e, t, i) {
1090 return ' ' === t && ' ' === i ? ' ' : ''
1091 })
1092 }
1093 },
1094 o = function (e, t) {
1095 return e.currentStyle ? e.currentStyle[t] : window.getComputedStyle ? window.getComputedStyle(e, null) [t] : void 0
1096 },
1097 a = function (t, i) {
1098 function n(e) {
1099 var t,
1100 i,
1101 n = 0,
1102 r = 0;
1103 return e && (i = e.getBoundingClientRect(), t = 'CSS1Compat' === c.compatMode ? c.documentElement : c.body, n = i.left + t.scrollLeft, r = i.top + t.scrollTop),
1104 {
1105 x: n,
1106 y: r
1107 }
1108 }
1109 var r,
1110 o,
1111 a,
1112 s = 0,
1113 u = 0,
1114 c = document;
1115 if (t = t, i = i || c.body, t && t.getBoundingClientRect && 'IE' === e.browser && (!c.documentMode || c.documentMode < 8)) return o = n(t),
1116 a = n(i),
1117 {
1118 x: o.x - a.x,
1119 y: o.y - a.y
1120 };
1121 for (r = t; r && r != i && r.nodeType; ) s += r.offsetLeft || 0,
1122 u += r.offsetTop || 0,
1123 r = r.offsetParent;
1124 for (r = t.parentNode; r && r != i && r.nodeType; ) s -= r.scrollLeft || 0,
1125 u -= r.scrollTop || 0,
1126 r = r.parentNode;
1127 return {
1128 x: s,
1129 y: u
1130 }
1131 },
1132 s = function (e) {
1133 return {
1134 w: e.offsetWidth || e.clientWidth,
1135 h: e.offsetHeight || e.clientHeight
1136 }
1137 };
1138 return {
1139 get: t,
1140 hasClass: i,
1141 addClass: n,
1142 removeClass: r,
1143 getStyle: o,
1144 getPos: a,
1145 getSize: s
1146 }
1147 }), n('moxie/core/EventTarget', [
1148 'moxie/core/utils/Env',
1149 'moxie/core/Exceptions',
1150 'moxie/core/utils/Basic'
1151 ], function (e, t, i) {
1152 function n() {
1153 this.uid = i.guid()
1154 }
1155 var r = {
1156 };
1157 return i.extend(n.prototype, {
1158 init: function () {
1159 this.uid || (this.uid = i.guid('uid_'))
1160 },
1161 addEventListener: function (e, t, n, o) {
1162 var a,
1163 s = this;
1164 return this.hasOwnProperty('uid') || (this.uid = i.guid('uid_')),
1165 e = i.trim(e),
1166 /\s/.test(e) ? (i.each(e.split(/\s+/), function (e) {
1167 s.addEventListener(e, t, n, o)
1168 }), void 0) : (e = e.toLowerCase(), n = parseInt(n, 10) || 0, a = r[this.uid] && r[this.uid][e] || [
1169 ], a.push({
1170 fn: t,
1171 priority: n,
1172 scope: o || this
1173 }), r[this.uid] || (r[this.uid] = {
1174 }), r[this.uid][e] = a, void 0)
1175 },
1176 hasEventListener: function (e) {
1177 var t;
1178 return e ? (e = e.toLowerCase(), t = r[this.uid] && r[this.uid][e]) : t = r[this.uid],
1179 t ? t : !1
1180 },
1181 removeEventListener: function (e, t) {
1182 var n,
1183 o,
1184 a = this;
1185 if (e = e.toLowerCase(), /\s/.test(e)) return i.each(e.split(/\s+/), function (e) {
1186 a.removeEventListener(e, t)
1187 }),
1188 void 0;
1189 if (n = r[this.uid] && r[this.uid][e]) {
1190 if (t) {
1191 for (o = n.length - 1; o >= 0; o--) if (n[o].fn === t) {
1192 n.splice(o, 1);
1193 break
1194 }
1195 } else n = [
1196 ];
1197 n.length || (delete r[this.uid][e], i.isEmptyObj(r[this.uid]) && delete r[this.uid])
1198 }
1199 },
1200 removeAllEventListeners: function () {
1201 r[this.uid] && delete r[this.uid]
1202 },
1203 dispatchEvent: function (e) {
1204 var n,
1205 o,
1206 a,
1207 s,
1208 u,
1209 c = {
1210 },
1211 l = !0;
1212 if ('string' !== i.typeOf(e)) {
1213 if (s = e, 'string' !== i.typeOf(s.type)) throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
1214 e = s.type,
1215 s.total !== u && s.loaded !== u && (c.total = s.total, c.loaded = s.loaded),
1216 c.async = s.async || !1
1217 }
1218 if ( - 1 !== e.indexOf('::') ? function (t) {
1219 n = t[0],
1220 e = t[1]
1221 }(e.split('::')) : n = this.uid, e = e.toLowerCase(), o = r[n] && r[n][e]) {
1222 o.sort(function (e, t) {
1223 return t.priority - e.priority
1224 }),
1225 a = [
1226 ].slice.call(arguments),
1227 a.shift(),
1228 c.type = e,
1229 a.unshift(c);
1230 var d = [
1231 ];
1232 i.each(o, function (e) {
1233 a[0].target = e.scope,
1234 c.async ? d.push(function (t) {
1235 setTimeout(function () {
1236 t(e.fn.apply(e.scope, a) === !1)
1237 }, 1)
1238 }) : d.push(function (t) {
1239 t(e.fn.apply(e.scope, a) === !1)
1240 })
1241 }),
1242 d.length && i.inSeries(d, function (e) {
1243 l = !e
1244 })
1245 }
1246 return l
1247 },
1248 bindOnce: function (e, t, i, n) {
1249 var r = this;
1250 r.bind.call(this, e, function o() {
1251 return r.unbind(e, o),
1252 t.apply(this, arguments)
1253 }, i, n)
1254 },
1255 bind: function () {
1256 this.addEventListener.apply(this, arguments)
1257 },
1258 unbind: function () {
1259 this.removeEventListener.apply(this, arguments)
1260 },
1261 unbindAll: function () {
1262 this.removeAllEventListeners.apply(this, arguments)
1263 },
1264 trigger: function () {
1265 return this.dispatchEvent.apply(this, arguments)
1266 },
1267 handleEventProps: function (e) {
1268 var t = this;
1269 this.bind(e.join(' '), function (e) {
1270 var t = 'on' + e.type.toLowerCase();
1271 'function' === i.typeOf(this[t]) && this[t].apply(this, arguments)
1272 }),
1273 i.each(e, function (e) {
1274 e = 'on' + e.toLowerCase(e),
1275 'undefined' === i.typeOf(t[e]) && (t[e] = null)
1276 })
1277 }
1278 }),
1279 n.instance = new n,
1280 n
1281 }), n('moxie/runtime/Runtime', [
1282 'moxie/core/utils/Env',
1283 'moxie/core/utils/Basic',
1284 'moxie/core/utils/Dom',
1285 'moxie/core/EventTarget'
1286 ], function (e, t, i, n) {
1287 function r(e, n, o, s, u) {
1288 var c,
1289 l = this,
1290 d = t.guid(n + '_'),
1291 m = u || 'browser';
1292 e = e || {
1293 },
1294 a[d] = this,
1295 o = t.extend({
1296 access_binary: !1,
1297 access_image_binary: !1,
1298 display_media: !1,
1299 do_cors: !1,
1300 drag_and_drop: !1,
1301 filter_by_extension: !0,
1302 resize_image: !1,
1303 report_upload_progress: !1,
1304 return_response_headers: !1,
1305 return_response_type: !1,
1306 return_status_code: !0,
1307 send_custom_headers: !1,
1308 select_file: !1,
1309 select_folder: !1,
1310 select_multiple: !0,
1311 send_binary_string: !1,
1312 send_browser_cookies: !0,
1313 send_multipart: !0,
1314 slice_blob: !1,
1315 stream_upload: !1,
1316 summon_file_dialog: !1,
1317 upload_filesize: !0,
1318 use_http_method: !0
1319 }, o),
1320 e.preferred_caps && (m = r.getMode(s, e.preferred_caps, m)),
1321 c = function () {
1322 var e = {
1323 };
1324 return {
1325 exec: function (t, i, n, r) {
1326 return c[i] && (e[t] || (e[t] = {
1327 context: this,
1328 instance: new c[i]
1329 }), e[t].instance[n]) ? e[t].instance[n].apply(this, r) : void 0
1330 },
1331 removeInstance: function (t) {
1332 delete e[t]
1333 },
1334 removeAllInstances: function () {
1335 var i = this;
1336 t.each(e, function (e, n) {
1337 'function' === t.typeOf(e.instance.destroy) && e.instance.destroy.call(e.context),
1338 i.removeInstance(n)
1339 })
1340 }
1341 }
1342 }(),
1343 t.extend(this, {
1344 initialized: !1,
1345 uid: d,
1346 type: n,
1347 mode: r.getMode(s, e.required_caps, m),
1348 shimid: d + '_container',
1349 clients: 0,
1350 options: e,
1351 can: function (e, i) {
1352 var n = arguments[2] || o;
1353 if ('string' === t.typeOf(e) && 'undefined' === t.typeOf(i) && (e = r.parseCaps(e)), 'object' === t.typeOf(e)) {
1354 for (var a in e) if (!this.can(a, e[a], n)) return !1;
1355 return !0
1356 }
1357 return 'function' === t.typeOf(n[e]) ? n[e].call(this, i) : i === n[e]
1358 },
1359 getShimContainer: function () {
1360 var e,
1361 n = i.get(this.shimid);
1362 return n || (e = i.get(this.options.container) || document.body, n = document.createElement('div'), n.id = this.shimid, n.className = 'moxie-shim moxie-shim-' + this.type, t.extend(n.style, {
1363 position: 'absolute',
1364 top: '0px',
1365 left: '0px',
1366 width: '1px',
1367 height: '1px',
1368 overflow: 'hidden'
1369 }), e.appendChild(n), e = null),
1370 n
1371 },
1372 getShim: function () {
1373 return c
1374 },
1375 shimExec: function (e, t) {
1376 var i = [
1377 ].slice.call(arguments, 2);
1378 return l.getShim().exec.call(this, this.uid, e, t, i)
1379 },
1380 exec: function (e, t) {
1381 var i = [
1382 ].slice.call(arguments, 2);
1383 return l[e] && l[e][t] ? l[e][t].apply(this, i) : l.shimExec.apply(this, arguments)
1384 },
1385 destroy: function () {
1386 if (l) {
1387 var e = i.get(this.shimid);
1388 e && e.parentNode.removeChild(e),
1389 c && c.removeAllInstances(),
1390 this.unbindAll(),
1391 delete a[this.uid],
1392 this.uid = null,
1393 d = l = c = e = null
1394 }
1395 }
1396 }),
1397 this.mode && e.required_caps && !this.can(e.required_caps) && (this.mode = !1)
1398 }
1399 var o = {
1400 },
1401 a = {
1402 };
1403 return r.order = 'html5,flash,silverlight,html4',
1404 r.getRuntime = function (e) {
1405 return a[e] ? a[e] : !1
1406 },
1407 r.addConstructor = function (e, t) {
1408 t.prototype = n.instance,
1409 o[e] = t
1410 },
1411 r.getConstructor = function (e) {
1412 return o[e] || null
1413 },
1414 r.getInfo = function (e) {
1415 var t = r.getRuntime(e);
1416 return t ? {
1417 uid: t.uid,
1418 type: t.type,
1419 mode: t.mode,
1420 can: function () {
1421 return t.can.apply(t, arguments)
1422 }
1423 }
1424 : null
1425 },
1426 r.parseCaps = function (e) {
1427 var i = {
1428 };
1429 return 'string' !== t.typeOf(e) ? e || {
1430 }
1431 : (t.each(e.split(','), function (e) {
1432 i[e] = !0
1433 }), i)
1434 },
1435 r.can = function (e, t) {
1436 var i,
1437 n,
1438 o = r.getConstructor(e);
1439 return o ? (i = new o({
1440 required_caps: t
1441 }), n = i.mode, i.destroy(), !!n) : !1
1442 },
1443 r.thatCan = function (e, t) {
1444 var i = (t || r.order).split(/\s*,\s*/);
1445 for (var n in i) if (r.can(i[n], e)) return i[n];
1446 return null
1447 },
1448 r.getMode = function (e, i, n) {
1449 var r = null;
1450 if ('undefined' === t.typeOf(n) && (n = 'browser'), i && !t.isEmptyObj(e)) {
1451 if (t.each(i, function (i, n) {
1452 if (e.hasOwnProperty(n)) {
1453 var o = e[n](i);
1454 if ('string' == typeof o && (o = [
1455 o
1456 ]), r) {
1457 if (!(r = t.arrayIntersect(r, o))) return r = !1
1458 } else r = o
1459 }
1460 }), r) return - 1 !== t.inArray(n, r) ? n : r[0];
1461 if (r === !1) return !1
1462 }
1463 return n
1464 },
1465 r.capTrue = function () {
1466 return !0
1467 },
1468 r.capFalse = function () {
1469 return !1
1470 },
1471 r.capTest = function (e) {
1472 return function () {
1473 return !!e
1474 }
1475 },
1476 r
1477 }), n('moxie/runtime/RuntimeClient', [
1478 'moxie/core/utils/Env',
1479 'moxie/core/Exceptions',
1480 'moxie/core/utils/Basic',
1481 'moxie/runtime/Runtime'
1482 ], function (e, t, i, n) {
1483 return function () {
1484 var e;
1485 i.extend(this, {
1486 connectRuntime: function (r) {
1487 function o(i) {
1488 var a,
1489 u;
1490 return i.length ? (a = i.shift().toLowerCase(), (u = n.getConstructor(a)) ? (e = new u(r), e.bind('Init', function () {
1491 e.initialized = !0,
1492 setTimeout(function () {
1493 e.clients++,
1494 s.ruid = e.uid,
1495 s.trigger('RuntimeInit', e)
1496 }, 1)
1497 }), e.bind('Error', function () {
1498 e.destroy(),
1499 o(i)
1500 }), e.bind('Exception', function (e, i) {
1501 var n = i.name + '(#' + i.code + ')' + (i.message ? ', from: ' + i.message : '');
1502 s.trigger('RuntimeError', new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR, n))
1503 }), e.mode ? (e.init(), void 0) : (e.trigger('Error'), void 0)) : (o(i), void 0)) : (s.trigger('RuntimeError', new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)), e = null, void 0)
1504 }
1505 var a,
1506 s = this;
1507 if ('string' === i.typeOf(r) ? a = r : 'string' === i.typeOf(r.ruid) && (a = r.ruid), a) {
1508 if (e = n.getRuntime(a)) return s.ruid = a,
1509 e.clients++,
1510 e;
1511 throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)
1512 }
1513 o((r.runtime_order || n.order).split(/\s*,\s*/))
1514 },
1515 disconnectRuntime: function () {
1516 e && --e.clients <= 0 && e.destroy(),
1517 e = null
1518 },
1519 getRuntime: function () {
1520 return e && e.uid ? e : e = null
1521 },
1522 exec: function () {
1523 return e ? e.exec.apply(this, arguments) : null
1524 },
1525 can: function (t) {
1526 return e ? e.can(t) : !1
1527 }
1528 })
1529 }
1530 }), n('moxie/file/Blob', [
1531 'moxie/core/utils/Basic',
1532 'moxie/core/utils/Encode',
1533 'moxie/runtime/RuntimeClient'
1534 ], function (e, t, i) {
1535 function n(o, a) {
1536 function s(t, i, o) {
1537 var a,
1538 s = r[this.uid];
1539 return 'string' === e.typeOf(s) && s.length ? (a = new n(null, {
1540 type: o,
1541 size: i - t
1542 }), a.detach(s.substr(t, a.size)), a) : null
1543 }
1544 i.call(this),
1545 o && this.connectRuntime(o),
1546 a ? 'string' === e.typeOf(a) && (a = {
1547 data: a
1548 }) : a = {
1549 },
1550 e.extend(this, {
1551 uid: a.uid || e.guid('uid_'),
1552 ruid: o,
1553 size: a.size || 0,
1554 type: a.type || '',
1555 slice: function (e, t, i) {
1556 return this.isDetached() ? s.apply(this, arguments) : this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), e, t, i)
1557 },
1558 getSource: function () {
1559 return r[this.uid] ? r[this.uid] : null
1560 },
1561 detach: function (e) {
1562 if (this.ruid && (this.getRuntime().exec.call(this, 'Blob', 'destroy'), this.disconnectRuntime(), this.ruid = null), e = e || '', 'data:' == e.substr(0, 5)) {
1563 var i = e.indexOf(';base64,');
1564 this.type = e.substring(5, i),
1565 e = t.atob(e.substring(i + 8))
1566 }
1567 this.size = e.length,
1568 r[this.uid] = e
1569 },
1570 isDetached: function () {
1571 return !this.ruid && 'string' === e.typeOf(r[this.uid])
1572 },
1573 destroy: function () {
1574 this.detach(),
1575 delete r[this.uid]
1576 }
1577 }),
1578 a.data ? this.detach(a.data) : r[this.uid] = a
1579 }
1580 var r = {
1581 };
1582 return n
1583 }), n('moxie/core/I18n', [
1584 'moxie/core/utils/Basic'
1585 ], function (e) {
1586 var t = {
1587 };
1588 return {
1589 addI18n: function (i) {
1590 return e.extend(t, i)
1591 },
1592 translate: function (e) {
1593 return t[e] || e
1594 },
1595 _: function (e) {
1596 return this.translate(e)
1597 },
1598 sprintf: function (t) {
1599 var i = [
1600 ].slice.call(arguments, 1);
1601 return t.replace(/%[a-z]/g, function () {
1602 var t = i.shift();
1603 return 'undefined' !== e.typeOf(t) ? t : ''
1604 })
1605 }
1606 }
1607 }), n('moxie/core/utils/Mime', [
1608 'moxie/core/utils/Basic',
1609 'moxie/core/I18n'
1610 ], function (e, t) {
1611 var i = 'application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe',
1612 n = {
1613 mimes: {
1614 },
1615 extensions: {
1616 },
1617 addMimeType: function (e) {
1618 var t,
1619 i,
1620 n,
1621 r = e.split(/,/);
1622 for (t = 0; t < r.length; t += 2) {
1623 for (n = r[t + 1].split(/ /), i = 0; i < n.length; i++) this.mimes[n[i]] = r[t];
1624 this.extensions[r[t]] = n
1625 }
1626 },
1627 extList2mimes: function (t, i) {
1628 var n,
1629 r,
1630 o,
1631 a,
1632 s = this,
1633 u = [
1634 ];
1635 for (r = 0; r < t.length; r++) for (n = t[r].extensions.toLowerCase().split(/\s*,\s*/), o = 0; o < n.length; o++) {
1636 if ('*' === n[o]) return [];
1637 if (a = s.mimes[n[o]], i && /^\w+$/.test(n[o])) u.push('.' + n[o]);
1638 else if (a && - 1 === e.inArray(a, u)) u.push(a);
1639 else if (!a) return []
1640 }
1641 return u
1642 },
1643 mimes2exts: function (t) {
1644 var i = this,
1645 n = [
1646 ];
1647 return e.each(t, function (t) {
1648 if (t = t.toLowerCase(), '*' === t) return n = [
1649 ],
1650 !1;
1651 var r = t.match(/^(\w+)\/(\*|\w+)$/);
1652 r && ('*' === r[2] ? e.each(i.extensions, function (e, t) {
1653 new RegExp('^' + r[1] + '/').test(t) && [
1654 ].push.apply(n, i.extensions[t])
1655 }) : i.extensions[t] && [
1656 ].push.apply(n, i.extensions[t]))
1657 }),
1658 n
1659 },
1660 mimes2extList: function (i) {
1661 var n = [
1662 ],
1663 r = [
1664 ];
1665 return 'string' === e.typeOf(i) && (i = e.trim(i).split(/\s*,\s*/)),
1666 r = this.mimes2exts(i),
1667 n.push({
1668 title: t.translate('Files'),
1669 extensions: r.length ? r.join(',') : '*'
1670 }),
1671 n.mimes = i,
1672 n
1673 },
1674 getFileExtension: function (e) {
1675 var t = e && e.match(/\.([^.]+)$/);
1676 return t ? t[1].toLowerCase() : ''
1677 },
1678 getFileMime: function (e) {
1679 return this.mimes[this.getFileExtension(e)] || ''
1680 }
1681 };
1682 return n.addMimeType(i),
1683 n
1684 }), n('moxie/file/FileInput', [
1685 'moxie/core/utils/Basic',
1686 'moxie/core/utils/Env',
1687 'moxie/core/utils/Mime',
1688 'moxie/core/utils/Dom',
1689 'moxie/core/Exceptions',
1690 'moxie/core/EventTarget',
1691 'moxie/core/I18n',
1692 'moxie/runtime/Runtime',
1693 'moxie/runtime/RuntimeClient'
1694 ], function (e, t, i, n, r, o, a, s, u) {
1695 function c(t) {
1696 var o,
1697 c,
1698 d;
1699 if ( - 1 !== e.inArray(e.typeOf(t), [
1700 'string',
1701 'node'
1702 ]) && (t = {
1703 browse_button: t
1704 }), c = n.get(t.browse_button), !c) throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);
1705 d = {
1706 accept: [
1707 {
1708 title: a.translate('All Files'),
1709 extensions: '*'
1710 }
1711 ],
1712 multiple: !1,
1713 required_caps: !1,
1714 container: c.parentNode || document.body
1715 },
1716 t = e.extend({
1717 }, d, t),
1718 'string' == typeof t.required_caps && (t.required_caps = s.parseCaps(t.required_caps)),
1719 'string' == typeof t.accept && (t.accept = i.mimes2extList(t.accept)),
1720 o = n.get(t.container),
1721 o || (o = document.body),
1722 'static' === n.getStyle(o, 'position') && (o.style.position = 'relative'),
1723 o = c = null,
1724 u.call(this),
1725 e.extend(this, {
1726 uid: e.guid('uid_'),
1727 ruid: null,
1728 shimid: null,
1729 files: null,
1730 init: function () {
1731 var i = this;
1732 i.bind('RuntimeInit', function (r, o) {
1733 i.ruid = o.uid,
1734 i.shimid = o.shimid,
1735 i.bind('Ready', function () {
1736 i.trigger('Refresh')
1737 }, 999),
1738 i.bind('Refresh', function () {
1739 var i,
1740 r,
1741 a,
1742 s,
1743 u;
1744 a = n.get(t.browse_button),
1745 s = n.get(o.shimid),
1746 a && (i = n.getPos(a, n.get(t.container)), r = n.getSize(a), u = parseInt(n.getStyle(a, 'z-index'), 10) || 0, s && e.extend(s.style, {
1747 top: i.y + 'px',
1748 left: i.x + 'px',
1749 width: r.w + 'px',
1750 height: r.h + 'px',
1751 zIndex: u + 1
1752 })),
1753 s = a = null
1754 }),
1755 o.exec.call(i, 'FileInput', 'init', t)
1756 }),
1757 i.connectRuntime(e.extend({
1758 }, t, {
1759 required_caps: {
1760 select_file: !0
1761 }
1762 }))
1763 },
1764 getOption: function (e) {
1765 return t[e]
1766 },
1767 setOption: function (e, n) {
1768 if (t.hasOwnProperty(e)) {
1769 var o = t[e];
1770 switch (e) {
1771 case 'accept':
1772 'string' == typeof n && (n = i.mimes2extList(n));
1773 break;
1774 case 'container':
1775 case 'required_caps':
1776 throw new r.FileException(r.FileException.NO_MODIFICATION_ALLOWED_ERR)
1777 }
1778 t[e] = n,
1779 this.exec('FileInput', 'setOption', e, n),
1780 this.trigger('OptionChanged', e, n, o)
1781 }
1782 },
1783 disable: function (t) {
1784 var i = this.getRuntime();
1785 i && this.exec('FileInput', 'disable', 'undefined' === e.typeOf(t) ? !0 : t)
1786 },
1787 refresh: function () {
1788 this.trigger('Refresh')
1789 },
1790 destroy: function () {
1791 var t = this.getRuntime();
1792 t && (t.exec.call(this, 'FileInput', 'destroy'), this.disconnectRuntime()),
1793 'array' === e.typeOf(this.files) && e.each(this.files, function (e) {
1794 e.destroy()
1795 }),
1796 this.files = null,
1797 this.unbindAll()
1798 }
1799 }), this.handleEventProps(l)
1800 }
1801 var l = [
1802 'ready',
1803 'change',
1804 'cancel',
1805 'mouseenter',
1806 'mouseleave',
1807 'mousedown',
1808 'mouseup'
1809 ];
1810 return c.prototype = o.instance,
1811 c
1812 }), n('moxie/file/File', [
1813 'moxie/core/utils/Basic',
1814 'moxie/core/utils/Mime',
1815 'moxie/file/Blob'
1816 ], function (e, t, i) {
1817 function n(n, r) {
1818 r || (r = {
1819 }),
1820 i.apply(this, arguments),
1821 this.type || (this.type = t.getFileMime(r.name));
1822 var o;
1823 if (r.name) o = r.name.replace(/\\/g, '/'),
1824 o = o.substr(o.lastIndexOf('/') + 1);
1825 else if (this.type) {
1826 var a = this.type.split('/') [0];
1827 o = e.guid(('' !== a ? a : 'file') + '_'),
1828 t.extensions[this.type] && (o += '.' + t.extensions[this.type][0])
1829 }
1830 e.extend(this, {
1831 name: o || e.guid('file_'),
1832 relativePath: '',
1833 lastModifiedDate: r.lastModifiedDate || (new Date).toLocaleString()
1834 })
1835 }
1836 return n.prototype = i.prototype,
1837 n
1838 }), n('moxie/file/FileDrop', [
1839 'moxie/core/I18n',
1840 'moxie/core/utils/Dom',
1841 'moxie/core/Exceptions',
1842 'moxie/core/utils/Basic',
1843 'moxie/core/utils/Env',
1844 'moxie/file/File',
1845 'moxie/runtime/RuntimeClient',
1846 'moxie/core/EventTarget',
1847 'moxie/core/utils/Mime'
1848 ], function (e, t, i, n, r, o, a, s, u) {
1849 function c(i) {
1850 var r,
1851 o = this;
1852 'string' == typeof i && (i = {
1853 drop_zone: i
1854 }),
1855 r = {
1856 accept: [
1857 {
1858 title: e.translate('All Files'),
1859 extensions: '*'
1860 }
1861 ],
1862 required_caps: {
1863 drag_and_drop: !0
1864 }
1865 },
1866 i = 'object' == typeof i ? n.extend({
1867 }, r, i) : r,
1868 i.container = t.get(i.drop_zone) || document.body,
1869 'static' === t.getStyle(i.container, 'position') && (i.container.style.position = 'relative'),
1870 'string' == typeof i.accept && (i.accept = u.mimes2extList(i.accept)),
1871 a.call(o),
1872 n.extend(o, {
1873 uid: n.guid('uid_'),
1874 ruid: null,
1875 files: null,
1876 init: function () {
1877 o.bind('RuntimeInit', function (e, t) {
1878 o.ruid = t.uid,
1879 t.exec.call(o, 'FileDrop', 'init', i),
1880 o.dispatchEvent('ready')
1881 }),
1882 o.connectRuntime(i)
1883 },
1884 destroy: function () {
1885 var e = this.getRuntime();
1886 e && (e.exec.call(this, 'FileDrop', 'destroy'), this.disconnectRuntime()),
1887 this.files = null,
1888 this.unbindAll()
1889 }
1890 }),
1891 this.handleEventProps(l)
1892 }
1893 var l = [
1894 'ready',
1895 'dragenter',
1896 'dragleave',
1897 'drop',
1898 'error'
1899 ];
1900 return c.prototype = s.instance,
1901 c
1902 }), n('moxie/file/FileReader', [
1903 'moxie/core/utils/Basic',
1904 'moxie/core/utils/Encode',
1905 'moxie/core/Exceptions',
1906 'moxie/core/EventTarget',
1907 'moxie/file/Blob',
1908 'moxie/runtime/RuntimeClient'
1909 ], function (e, t, i, n, r, o) {
1910 function a() {
1911 function n(e, n) {
1912 if (this.trigger('loadstart'), this.readyState === a.LOADING) return this.trigger('error', new i.DOMException(i.DOMException.INVALID_STATE_ERR)),
1913 this.trigger('loadend'),
1914 void 0;
1915 if (!(n instanceof r)) return this.trigger('error', new i.DOMException(i.DOMException.NOT_FOUND_ERR)),
1916 this.trigger('loadend'),
1917 void 0;
1918 if (this.result = null, this.readyState = a.LOADING, n.isDetached()) {
1919 var o = n.getSource();
1920 switch (e) {
1921 case 'readAsText':
1922 case 'readAsBinaryString':
1923 this.result = o;
1924 break;
1925 case 'readAsDataURL':
1926 this.result = 'data:' + n.type + ';base64,' + t.btoa(o)
1927 }
1928 this.readyState = a.DONE,
1929 this.trigger('load'),
1930 this.trigger('loadend')
1931 } else this.connectRuntime(n.ruid),
1932 this.exec('FileReader', 'read', e, n)
1933 }
1934 o.call(this),
1935 e.extend(this, {
1936 uid: e.guid('uid_'),
1937 readyState: a.EMPTY,
1938 result: null,
1939 error: null,
1940 readAsBinaryString: function (e) {
1941 n.call(this, 'readAsBinaryString', e)
1942 },
1943 readAsDataURL: function (e) {
1944 n.call(this, 'readAsDataURL', e)
1945 },
1946 readAsText: function (e) {
1947 n.call(this, 'readAsText', e)
1948 },
1949 abort: function () {
1950 this.result = null,
1951 - 1 === e.inArray(this.readyState, [
1952 a.EMPTY,
1953 a.DONE
1954 ]) && (this.readyState === a.LOADING && (this.readyState = a.DONE), this.exec('FileReader', 'abort'), this.trigger('abort'), this.trigger('loadend'))
1955 },
1956 destroy: function () {
1957 this.abort(),
1958 this.exec('FileReader', 'destroy'),
1959 this.disconnectRuntime(),
1960 this.unbindAll()
1961 }
1962 }),
1963 this.handleEventProps(s),
1964 this.bind('Error', function (e, t) {
1965 this.readyState = a.DONE,
1966 this.error = t
1967 }, 999),
1968 this.bind('Load', function () {
1969 this.readyState = a.DONE
1970 }, 999)
1971 }
1972 var s = [
1973 'loadstart',
1974 'progress',
1975 'load',
1976 'abort',
1977 'error',
1978 'loadend'
1979 ];
1980 return a.EMPTY = 0,
1981 a.LOADING = 1,
1982 a.DONE = 2,
1983 a.prototype = n.instance,
1984 a
1985 }), n('moxie/core/utils/Url', [
1986 'moxie/core/utils/Basic'
1987 ], function (e) {
1988 var t = function (i, n) {
1989 var r,
1990 o = [
1991 'source',
1992 'scheme',
1993 'authority',
1994 'userInfo',
1995 'user',
1996 'pass',
1997 'host',
1998 'port',
1999 'relative',
2000 'path',
2001 'directory',
2002 'file',
2003 'query',
2004 'fragment'
2005 ],
2006 a = o.length,
2007 s = {
2008 http: 80,
2009 https: 443
2010 },
2011 u = {
2012 },
2013 c = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,
2014 l = c.exec(i || ''),
2015 d = /^\/\/\w/.test(i);
2016 switch (e.typeOf(n)) {
2017 case 'undefined':
2018 n = t(document.location.href, !1);
2019 break;
2020 case 'string':
2021 n = t(n, !1)
2022 }
2023 for (; a--; ) l[a] && (u[o[a]] = l[a]);
2024 if (r = !d && !u.scheme, (d || r) && (u.scheme = n.scheme), r) {
2025 u.host = n.host,
2026 u.port = n.port;
2027 var m = '';
2028 /^[^\/]/.test(u.path) && (m = n.path, m = /\/[^\/]*\.[^\/]*$/.test(m) ? m.replace(/\/[^\/]+$/, '/') : m.replace(/\/?$/, '/')),
2029 u.path = m + (u.path || '')
2030 }
2031 return u.port || (u.port = s[u.scheme] || 80),
2032 u.port = parseInt(u.port, 10),
2033 u.path || (u.path = '/'),
2034 delete u.source,
2035 u
2036 },
2037 i = function (e) {
2038 var i = {
2039 http: 80,
2040 https: 443
2041 },
2042 n = 'object' == typeof e ? e : t(e);
2043 return n.scheme + '://' + n.host + (n.port !== i[n.scheme] ? ':' + n.port : '') + n.path + (n.query ? n.query : '')
2044 },
2045 n = function (e) {
2046 function i(e) {
2047 return [e.scheme,
2048 e.host,
2049 e.port].join('/')
2050 }
2051 return 'string' == typeof e && (e = t(e)),
2052 i(t()) === i(e)
2053 };
2054 return {
2055 parseUrl: t,
2056 resolveUrl: i,
2057 hasSameOrigin: n
2058 }
2059 }), n('moxie/runtime/RuntimeTarget', [
2060 'moxie/core/utils/Basic',
2061 'moxie/runtime/RuntimeClient',
2062 'moxie/core/EventTarget'
2063 ], function (e, t, i) {
2064 function n() {
2065 this.uid = e.guid('uid_'),
2066 t.call(this),
2067 this.destroy = function () {
2068 this.disconnectRuntime(),
2069 this.unbindAll()
2070 }
2071 }
2072 return n.prototype = i.instance,
2073 n
2074 }), n('moxie/file/FileReaderSync', [
2075 'moxie/core/utils/Basic',
2076 'moxie/runtime/RuntimeClient',
2077 'moxie/core/utils/Encode'
2078 ], function (e, t, i) {
2079 return function () {
2080 function n(e, t) {
2081 if (!t.isDetached()) {
2082 var n = this.connectRuntime(t.ruid).exec.call(this, 'FileReaderSync', 'read', e, t);
2083 return this.disconnectRuntime(),
2084 n
2085 }
2086 var r = t.getSource();
2087 switch (e) {
2088 case 'readAsBinaryString':
2089 return r;
2090 case 'readAsDataURL':
2091 return 'data:' + t.type + ';base64,' + i.btoa(r);
2092 case 'readAsText':
2093 for (var o = '', a = 0, s = r.length; s > a; a++) o += String.fromCharCode(r[a]);
2094 return o
2095 }
2096 }
2097 t.call(this),
2098 e.extend(this, {
2099 uid: e.guid('uid_'),
2100 readAsBinaryString: function (e) {
2101 return n.call(this, 'readAsBinaryString', e)
2102 },
2103 readAsDataURL: function (e) {
2104 return n.call(this, 'readAsDataURL', e)
2105 },
2106 readAsText: function (e) {
2107 return n.call(this, 'readAsText', e)
2108 }
2109 })
2110 }
2111 }), n('moxie/xhr/FormData', [
2112 'moxie/core/Exceptions',
2113 'moxie/core/utils/Basic',
2114 'moxie/file/Blob'
2115 ], function (e, t, i) {
2116 function n() {
2117 var e,
2118 n = [
2119 ];
2120 t.extend(this, {
2121 append: function (r, o) {
2122 var a = this,
2123 s = t.typeOf(o);
2124 o instanceof i ? e = {
2125 name: r,
2126 value: o
2127 }
2128 : 'array' === s ? (r += '[]', t.each(o, function (e) {
2129 a.append(r, e)
2130 })) : 'object' === s ? t.each(o, function (e, t) {
2131 a.append(r + '[' + t + ']', e)
2132 }) : 'null' === s || 'undefined' === s || 'number' === s && isNaN(o) ? a.append(r, 'false') : n.push({
2133 name: r,
2134 value: o.toString()
2135 })
2136 },
2137 hasBlob: function () {
2138 return !!this.getBlob()
2139 },
2140 getBlob: function () {
2141 return e && e.value || null
2142 },
2143 getBlobName: function () {
2144 return e && e.name || null
2145 },
2146 each: function (i) {
2147 t.each(n, function (e) {
2148 i(e.value, e.name)
2149 }),
2150 e && i(e.value, e.name)
2151 },
2152 destroy: function () {
2153 e = null,
2154 n = [
2155 ]
2156 }
2157 })
2158 }
2159 return n
2160 }), n('moxie/xhr/XMLHttpRequest', [
2161 'moxie/core/utils/Basic',
2162 'moxie/core/Exceptions',
2163 'moxie/core/EventTarget',
2164 'moxie/core/utils/Encode',
2165 'moxie/core/utils/Url',
2166 'moxie/runtime/Runtime',
2167 'moxie/runtime/RuntimeTarget',
2168 'moxie/file/Blob',
2169 'moxie/file/FileReaderSync',
2170 'moxie/xhr/FormData',
2171 'moxie/core/utils/Env',
2172 'moxie/core/utils/Mime'
2173 ], function (e, t, i, n, r, o, a, s, u, c, l, d) {
2174 function m() {
2175 this.uid = e.guid('uid_')
2176 }
2177 function h() {
2178 function i(e, t) {
2179 return I.hasOwnProperty(e) ? 1 === arguments.length ? l.can('define_property') ? I[e] : A[e] : (l.can('define_property') ? I[e] = t : A[e] = t, void 0) : void 0
2180 }
2181 function u(t) {
2182 function n() {
2183 R && (R.destroy(), R = null),
2184 s.dispatchEvent('loadend'),
2185 s = null
2186 }
2187 function r(r) {
2188 R.bind('LoadStart', function (e) {
2189 i('readyState', h.LOADING),
2190 s.dispatchEvent('readystatechange'),
2191 s.dispatchEvent(e),
2192 L && s.upload.dispatchEvent(e)
2193 }),
2194 R.bind('Progress', function (e) {
2195 i('readyState') !== h.LOADING && (i('readyState', h.LOADING), s.dispatchEvent('readystatechange')),
2196 s.dispatchEvent(e)
2197 }),
2198 R.bind('UploadProgress', function (e) {
2199 L && s.upload.dispatchEvent({
2200 type: 'progress',
2201 lengthComputable: !1,
2202 total: e.total,
2203 loaded: e.loaded
2204 })
2205 }),
2206 R.bind('Load', function (t) {
2207 i('readyState', h.DONE),
2208 i('status', Number(r.exec.call(R, 'XMLHttpRequest', 'getStatus') || 0)),
2209 i('statusText', f[i('status')] || ''),
2210 i('response', r.exec.call(R, 'XMLHttpRequest', 'getResponse', i('responseType'))),
2211 ~e.inArray(i('responseType'), [
2212 'text',
2213 ''
2214 ]) ? i('responseText', i('response')) : 'document' === i('responseType') && i('responseXML', i('response')),
2215 U = r.exec.call(R, 'XMLHttpRequest', 'getAllResponseHeaders'),
2216 s.dispatchEvent('readystatechange'),
2217 i('status') > 0 ? (L && s.upload.dispatchEvent(t), s.dispatchEvent(t)) : (F = !0, s.dispatchEvent('error')),
2218 n()
2219 }),
2220 R.bind('Abort', function (e) {
2221 s.dispatchEvent(e),
2222 n()
2223 }),
2224 R.bind('Error', function (e) {
2225 F = !0,
2226 i('readyState', h.DONE),
2227 s.dispatchEvent('readystatechange'),
2228 M = !0,
2229 s.dispatchEvent(e),
2230 n()
2231 }),
2232 r.exec.call(R, 'XMLHttpRequest', 'send', {
2233 url: x,
2234 method: v,
2235 async: T,
2236 user: w,
2237 password: y,
2238 headers: S,
2239 mimeType: D,
2240 encoding: O,
2241 responseType: s.responseType,
2242 withCredentials: s.withCredentials,
2243 options: k
2244 }, t)
2245 }
2246 var s = this;
2247 E = (new Date).getTime(),
2248 R = new a,
2249 'string' == typeof k.required_caps && (k.required_caps = o.parseCaps(k.required_caps)),
2250 k.required_caps = e.extend({
2251 }, k.required_caps, {
2252 return_response_type: s.responseType
2253 }),
2254 t instanceof c && (k.required_caps.send_multipart = !0),
2255 e.isEmptyObj(S) || (k.required_caps.send_custom_headers = !0),
2256 B || (k.required_caps.do_cors = !0),
2257 k.ruid ? r(R.connectRuntime(k)) : (R.bind('RuntimeInit', function (e, t) {
2258 r(t)
2259 }), R.bind('RuntimeError', function (e, t) {
2260 s.dispatchEvent('RuntimeError', t)
2261 }), R.connectRuntime(k))
2262 }
2263 function g() {
2264 i('responseText', ''),
2265 i('responseXML', null),
2266 i('response', null),
2267 i('status', 0),
2268 i('statusText', ''),
2269 E = b = null
2270 }
2271 var x,
2272 v,
2273 w,
2274 y,
2275 E,
2276 b,
2277 R,
2278 _,
2279 A = this,
2280 I = {
2281 timeout: 0,
2282 readyState: h.UNSENT,
2283 withCredentials: !1,
2284 status: 0,
2285 statusText: '',
2286 responseType: '',
2287 responseXML: null,
2288 responseText: null,
2289 response: null
2290 },
2291 T = !0,
2292 S = {
2293 },
2294 O = null,
2295 D = null,
2296 N = !1,
2297 C = !1,
2298 L = !1,
2299 M = !1,
2300 F = !1,
2301 B = !1,
2302 P = null,
2303 H = null,
2304 k = {
2305 },
2306 U = '';
2307 e.extend(this, I, {
2308 uid: e.guid('uid_'),
2309 upload: new m,
2310 open: function (o, a, s, u, c) {
2311 var l;
2312 if (!o || !a) throw new t.DOMException(t.DOMException.SYNTAX_ERR);
2313 if (/[\u0100-\uffff]/.test(o) || n.utf8_encode(o) !== o) throw new t.DOMException(t.DOMException.SYNTAX_ERR);
2314 if (~e.inArray(o.toUpperCase(), [
2315 'CONNECT',
2316 'DELETE',
2317 'GET',
2318 'HEAD',
2319 'OPTIONS',
2320 'POST',
2321 'PUT',
2322 'TRACE',
2323 'TRACK'
2324 ]) && (v = o.toUpperCase()), ~e.inArray(v, [
2325 'CONNECT',
2326 'TRACE',
2327 'TRACK'
2328 ])) throw new t.DOMException(t.DOMException.SECURITY_ERR);
2329 if (a = n.utf8_encode(a), l = r.parseUrl(a), B = r.hasSameOrigin(l), x = r.resolveUrl(a), (u || c) && !B) throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);
2330 if (w = u || l.user, y = c || l.pass, T = s || !0, T === !1 && (i('timeout') || i('withCredentials') || '' !== i('responseType'))) throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);
2331 N = !T,
2332 C = !1,
2333 S = {
2334 },
2335 g.call(this),
2336 i('readyState', h.OPENED),
2337 this.dispatchEvent('readystatechange')
2338 },
2339 setRequestHeader: function (r, o) {
2340 var a = [
2341 'accept-charset',
2342 'accept-encoding',
2343 'access-control-request-headers',
2344 'access-control-request-method',
2345 'connection',
2346 'content-length',
2347 'cookie',
2348 'cookie2',
2349 'content-transfer-encoding',
2350 'date',
2351 'expect',
2352 'host',
2353 'keep-alive',
2354 'origin',
2355 'referer',
2356 'te',
2357 'trailer',
2358 'transfer-encoding',
2359 'upgrade',
2360 'user-agent',
2361 'via'
2362 ];
2363 if (i('readyState') !== h.OPENED || C) throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);
2364 if (/[\u0100-\uffff]/.test(r) || n.utf8_encode(r) !== r) throw new t.DOMException(t.DOMException.SYNTAX_ERR);
2365 return r = e.trim(r).toLowerCase(),
2366 ~e.inArray(r, a) || /^(proxy\-|sec\-)/.test(r) ? !1 : (S[r] ? S[r] += ', ' + o : S[r] = o, !0)
2367 },
2368 hasRequestHeader: function (e) {
2369 return e && S[e.toLowerCase()] || !1
2370 },
2371 getAllResponseHeaders: function () {
2372 return U || ''
2373 },
2374 getResponseHeader: function (t) {
2375 return t = t.toLowerCase(),
2376 F || ~e.inArray(t, [
2377 'set-cookie',
2378 'set-cookie2'
2379 ]) ? null : U && '' !== U && (_ || (_ = {
2380 }, e.each(U.split(/\r\n/), function (t) {
2381 var i = t.split(/:\s+/);
2382 2 === i.length && (i[0] = e.trim(i[0]), _[i[0].toLowerCase()] = {
2383 header: i[0],
2384 value: e.trim(i[1])
2385 })
2386 })), _.hasOwnProperty(t)) ? _[t].header + ': ' + _[t].value : null
2387 },
2388 overrideMimeType: function (n) {
2389 var r,
2390 o;
2391 if (~e.inArray(i('readyState'), [
2392 h.LOADING,
2393 h.DONE
2394 ])) throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);
2395 if (n = e.trim(n.toLowerCase()), /;/.test(n) && (r = n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/)) && (n = r[1], r[2] && (o = r[2])), !d.mimes[n]) throw new t.DOMException(t.DOMException.SYNTAX_ERR);
2396 P = n,
2397 H = o
2398 },
2399 send: function (i, r) {
2400 if (k = 'string' === e.typeOf(r) ? {
2401 ruid: r
2402 }
2403 : r ? r : {
2404 }, this.readyState !== h.OPENED || C) throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);
2405 if (i instanceof s) k.ruid = i.ruid,
2406 D = i.type || 'application/octet-stream';
2407 else if (i instanceof c) {
2408 if (i.hasBlob()) {
2409 var o = i.getBlob();
2410 k.ruid = o.ruid,
2411 D = o.type || 'application/octet-stream'
2412 }
2413 } else 'string' == typeof i && (O = 'UTF-8', D = 'text/plain;charset=UTF-8', i = n.utf8_encode(i));
2414 this.withCredentials || (this.withCredentials = k.required_caps && k.required_caps.send_browser_cookies && !B),
2415 L = !N && this.upload.hasEventListener(),
2416 F = !1,
2417 M = !i,
2418 N || (C = !0),
2419 u.call(this, i)
2420 },
2421 abort: function () {
2422 if (F = !0, N = !1, ~e.inArray(i('readyState'), [
2423 h.UNSENT,
2424 h.OPENED,
2425 h.DONE
2426 ])) i('readyState', h.UNSENT);
2427 else {
2428 if (i('readyState', h.DONE), C = !1, !R) throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);
2429 R.getRuntime().exec.call(R, 'XMLHttpRequest', 'abort', M),
2430 M = !0
2431 }
2432 },
2433 destroy: function () {
2434 R && ('function' === e.typeOf(R.destroy) && R.destroy(), R = null),
2435 this.unbindAll(),
2436 this.upload && (this.upload.unbindAll(), this.upload = null)
2437 }
2438 }),
2439 this.handleEventProps(p.concat(['readystatechange'])),
2440 this.upload.handleEventProps(p)
2441 }
2442 var f = {
2443 100: 'Continue',
2444 101: 'Switching Protocols',
2445 102: 'Processing',
2446 200: 'OK',
2447 201: 'Created',
2448 202: 'Accepted',
2449 203: 'Non-Authoritative Information',
2450 204: 'No Content',
2451 205: 'Reset Content',
2452 206: 'Partial Content',
2453 207: 'Multi-Status',
2454 226: 'IM Used',
2455 300: 'Multiple Choices',
2456 301: 'Moved Permanently',
2457 302: 'Found',
2458 303: 'See Other',
2459 304: 'Not Modified',
2460 305: 'Use Proxy',
2461 306: 'Reserved',
2462 307: 'Temporary Redirect',
2463 400: 'Bad Request',
2464 401: 'Unauthorized',
2465 402: 'Payment Required',
2466 403: 'Forbidden',
2467 404: 'Not Found',
2468 405: 'Method Not Allowed',
2469 406: 'Not Acceptable',
2470 407: 'Proxy Authentication Required',
2471 408: 'Request Timeout',
2472 409: 'Conflict',
2473 410: 'Gone',
2474 411: 'Length Required',
2475 412: 'Precondition Failed',
2476 413: 'Request Entity Too Large',
2477 414: 'Request-URI Too Long',
2478 415: 'Unsupported Media Type',
2479 416: 'Requested Range Not Satisfiable',
2480 417: 'Expectation Failed',
2481 422: 'Unprocessable Entity',
2482 423: 'Locked',
2483 424: 'Failed Dependency',
2484 426: 'Upgrade Required',
2485 500: 'Internal Server Error',
2486 501: 'Not Implemented',
2487 502: 'Bad Gateway',
2488 503: 'Service Unavailable',
2489 504: 'Gateway Timeout',
2490 505: 'HTTP Version Not Supported',
2491 506: 'Variant Also Negotiates',
2492 507: 'Insufficient Storage',
2493 510: 'Not Extended'
2494 };
2495 m.prototype = i.instance;
2496 var p = [
2497 'loadstart',
2498 'progress',
2499 'abort',
2500 'error',
2501 'load',
2502 'timeout',
2503 'loadend'
2504 ];
2505 return h.UNSENT = 0,
2506 h.OPENED = 1,
2507 h.HEADERS_RECEIVED = 2,
2508 h.LOADING = 3,
2509 h.DONE = 4,
2510 h.prototype = i.instance,
2511 h
2512 }), n('moxie/runtime/Transporter', [
2513 'moxie/core/utils/Basic',
2514 'moxie/core/utils/Encode',
2515 'moxie/runtime/RuntimeClient',
2516 'moxie/core/EventTarget'
2517 ], function (e, t, i, n) {
2518 function r() {
2519 function n() {
2520 l = d = 0,
2521 c = this.result = null
2522 }
2523 function o(t, i) {
2524 var n = this;
2525 u = i,
2526 n.bind('TransportingProgress', function (t) {
2527 d = t.loaded,
2528 l > d && - 1 === e.inArray(n.state, [
2529 r.IDLE,
2530 r.DONE
2531 ]) && a.call(n)
2532 }, 999),
2533 n.bind('TransportingComplete', function () {
2534 d = l,
2535 n.state = r.DONE,
2536 c = null,
2537 n.result = u.exec.call(n, 'Transporter', 'getAsBlob', t || '')
2538 }, 999),
2539 n.state = r.BUSY,
2540 n.trigger('TransportingStarted'),
2541 a.call(n)
2542 }
2543 function a() {
2544 var e,
2545 i = this,
2546 n = l - d;
2547 m > n && (m = n),
2548 e = t.btoa(c.substr(d, m)),
2549 u.exec.call(i, 'Transporter', 'receive', e, l)
2550 }
2551 var s,
2552 u,
2553 c,
2554 l,
2555 d,
2556 m;
2557 i.call(this),
2558 e.extend(this, {
2559 uid: e.guid('uid_'),
2560 state: r.IDLE,
2561 result: null,
2562 transport: function (t, i, r) {
2563 var a = this;
2564 if (r = e.extend({
2565 chunk_size: 204798
2566 }, r), (s = r.chunk_size % 3) && (r.chunk_size += 3 - s), m = r.chunk_size, n.call(this), c = t, l = t.length, 'string' === e.typeOf(r) || r.ruid) o.call(a, i, this.connectRuntime(r));
2567 else {
2568 var u = function (e, t) {
2569 a.unbind('RuntimeInit', u),
2570 o.call(a, i, t)
2571 };
2572 this.bind('RuntimeInit', u),
2573 this.connectRuntime(r)
2574 }
2575 },
2576 abort: function () {
2577 var e = this;
2578 e.state = r.IDLE,
2579 u && (u.exec.call(e, 'Transporter', 'clear'), e.trigger('TransportingAborted')),
2580 n.call(e)
2581 },
2582 destroy: function () {
2583 this.unbindAll(),
2584 u = null,
2585 this.disconnectRuntime(),
2586 n.call(this)
2587 }
2588 })
2589 }
2590 return r.IDLE = 0,
2591 r.BUSY = 1,
2592 r.DONE = 2,
2593 r.prototype = n.instance,
2594 r
2595 }), n('moxie/image/Image', [
2596 'moxie/core/utils/Basic',
2597 'moxie/core/utils/Dom',
2598 'moxie/core/Exceptions',
2599 'moxie/file/FileReaderSync',
2600 'moxie/xhr/XMLHttpRequest',
2601 'moxie/runtime/Runtime',
2602 'moxie/runtime/RuntimeClient',
2603 'moxie/runtime/Transporter',
2604 'moxie/core/utils/Env',
2605 'moxie/core/EventTarget',
2606 'moxie/file/Blob',
2607 'moxie/file/File',
2608 'moxie/core/utils/Encode'
2609 ], function (e, t, i, n, r, o, a, s, u, c, l, d, m) {
2610 function h() {
2611 function n(e) {
2612 try {
2613 return e || (e = this.exec('Image', 'getInfo')),
2614 this.size = e.size,
2615 this.width = e.width,
2616 this.height = e.height,
2617 this.type = e.type,
2618 this.meta = e.meta,
2619 '' === this.name && (this.name = e.name),
2620 !0
2621 } catch (t) {
2622 return this.trigger('error', t.code),
2623 !1
2624 }
2625 }
2626 function c(t) {
2627 var n = e.typeOf(t);
2628 alert();
2629 try {
2630 if (t instanceof h) {
2631 if (!t.size) throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);
2632 p.apply(this, arguments)
2633 } else if (t instanceof l) {
2634 if (!~e.inArray(t.type, [
2635 'image/jpeg',
2636 'image/png'
2637 ])) throw new i.ImageError(i.ImageError.WRONG_FORMAT);
2638 g.apply(this, arguments)
2639 } else if ( - 1 !== e.inArray(n, [
2640 'blob',
2641 'file'
2642 ])) c.call(this, new d(null, t), arguments[1]);
2643 else if ('string' === n) 'data:' === t.substr(0, 5) ? c.call(this, new l(null, {
2644 data: t
2645 }), arguments[1]) : x.apply(this, arguments);
2646 else {
2647 if ('node' !== n || 'img' !== t.nodeName.toLowerCase()) throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);
2648 c.call(this, t.src, arguments[1])
2649 }
2650 } catch (r) {
2651 this.trigger('error', r.code)
2652 }
2653 }
2654 function p(t, i) {
2655 var n = this.connectRuntime(t.ruid);
2656 this.ruid = n.uid,
2657 n.exec.call(this, 'Image', 'loadFromImage', t, 'undefined' === e.typeOf(i) ? !0 : i)
2658 }
2659 function g(t, i) {
2660 function n(e) {
2661 r.ruid = e.uid,
2662 e.exec.call(r, 'Image', 'loadFromBlob', t)
2663 }
2664 var r = this;
2665 r.name = t.name || '',
2666 t.isDetached() ? (this.bind('RuntimeInit', function (e, t) {
2667 n(t)
2668 }), i && 'string' == typeof i.required_caps && (i.required_caps = o.parseCaps(i.required_caps)), this.connectRuntime(e.extend({
2669 required_caps: {
2670 access_image_binary: !0,
2671 resize_image: !0
2672 }
2673 }, i))) : n(this.connectRuntime(t.ruid))
2674 }
2675 function x(e, t) {
2676 var i,
2677 n = this;
2678 i = new r,
2679 i.open('get', e),
2680 i.responseType = 'blob',
2681 i.onprogress = function (e) {
2682 n.trigger(e)
2683 },
2684 i.onload = function () {
2685 g.call(n, i.response, !0)
2686 },
2687 i.onerror = function (e) {
2688 n.trigger(e)
2689 },
2690 i.onloadend = function () {
2691 i.destroy()
2692 },
2693 i.bind('RuntimeError', function (e, t) {
2694 n.trigger('RuntimeError', t)
2695 }),
2696 i.send(null, t)
2697 }
2698 a.call(this),
2699 e.extend(this, {
2700 uid: e.guid('uid_'),
2701 ruid: null,
2702 name: '',
2703 size: 0,
2704 width: 0,
2705 height: 0,
2706 type: '',
2707 meta: {
2708 },
2709 clone: function () {
2710 this.load.apply(this, arguments)
2711 },
2712 load: function () {
2713 c.apply(this, arguments)
2714 },
2715 resize: function (t) {
2716 var n,
2717 r,
2718 o = this,
2719 a = {
2720 x: 0,
2721 y: 0,
2722 width: o.width,
2723 height: o.height
2724 },
2725 s = e.extendIf({
2726 width: o.width,
2727 height: o.height,
2728 type: o.type || 'image/jpeg',
2729 quality: 90,
2730 crop: !1,
2731 fit: !0,
2732 preserveHeaders: !0,
2733 resample: 'default',
2734 multipass: !0
2735 }, t);
2736 try {
2737 if (!o.size) throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);
2738 if (o.width > h.MAX_RESIZE_WIDTH || o.height > h.MAX_RESIZE_HEIGHT) throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);
2739 if (n = o.meta && o.meta.tiff && o.meta.tiff.Orientation || 1, - 1 !== e.inArray(n, [
2740 5,
2741 6,
2742 7,
2743 8
2744 ])) {
2745 var u = s.width;
2746 s.width = s.height,
2747 s.height = u
2748 }
2749 if (s.crop) {
2750 switch (r = Math.max(s.width / o.width, s.height / o.height), t.fit ? (a.width = Math.min(Math.ceil(s.width / r), o.width), a.height = Math.min(Math.ceil(s.height / r), o.height), r = s.width / a.width) : (a.width = Math.min(s.width, o.width), a.height = Math.min(s.height, o.height), r = 1), 'boolean' == typeof s.crop && (s.crop = 'cc'), s.crop.toLowerCase().replace(/_/, '-')) {
2751 case 'rb':
2752 case 'right-bottom':
2753 a.x = o.width - a.width,
2754 a.y = o.height - a.height;
2755 break;
2756 case 'cb':
2757 case 'center-bottom':
2758 a.x = Math.floor((o.width - a.width) / 2),
2759 a.y = o.height - a.height;
2760 break;
2761 case 'lb':
2762 case 'left-bottom':
2763 a.x = 0,
2764 a.y = o.height - a.height;
2765 break;
2766 case 'lt':
2767 case 'left-top':
2768 a.x = 0,
2769 a.y = 0;
2770 break;
2771 case 'ct':
2772 case 'center-top':
2773 a.x = Math.floor((o.width - a.width) / 2),
2774 a.y = 0;
2775 break;
2776 case 'rt':
2777 case 'right-top':
2778 a.x = o.width - a.width,
2779 a.y = 0;
2780 break;
2781 case 'rc':
2782 case 'right-center':
2783 case 'right-middle':
2784 a.x = o.width - a.width,
2785 a.y = Math.floor((o.height - a.height) / 2);
2786 break;
2787 case 'lc':
2788 case 'left-center':
2789 case 'left-middle':
2790 a.x = 0,
2791 a.y = Math.floor((o.height - a.height) / 2);
2792 break;
2793 case 'cc':
2794 case 'center-center':
2795 case 'center-middle':
2796 default:
2797 a.x = Math.floor((o.width - a.width) / 2),
2798 a.y = Math.floor((o.height - a.height) / 2)
2799 }
2800 a.x = Math.max(a.x, 0),
2801 a.y = Math.max(a.y, 0)
2802 } else r = Math.min(s.width / o.width, s.height / o.height);
2803 this.exec('Image', 'resize', a, r, s)
2804 } catch (c) {
2805 o.trigger('error', c.code)
2806 }
2807 },
2808 downsize: function (t) {
2809 var i,
2810 n = {
2811 width: this.width,
2812 height: this.height,
2813 type: this.type || 'image/jpeg',
2814 quality: 90,
2815 crop: !1,
2816 preserveHeaders: !0,
2817 resample: 'default'
2818 };
2819 i = 'object' == typeof t ? e.extend(n, t) : e.extend(n, {
2820 width: arguments[0],
2821 height: arguments[1],
2822 crop: arguments[2],
2823 preserveHeaders: arguments[3]
2824 }),
2825 this.resize(i)
2826 },
2827 crop: function (e, t, i) {
2828 this.downsize(e, t, !0, i)
2829 },
2830 getAsCanvas: function () {
2831 if (!u.can('create_canvas')) throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);
2832 return this.exec('Image', 'getAsCanvas')
2833 },
2834 getAsBlob: function (e, t) {
2835 if (!this.size) throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);
2836 return this.exec('Image', 'getAsBlob', e || 'image/jpeg', t || 90)
2837 },
2838 getAsDataURL: function (e, t) {
2839 if (!this.size) throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);
2840 return this.exec('Image', 'getAsDataURL', e || 'image/jpeg', t || 90)
2841 },
2842 getAsBinaryString: function (e, t) {
2843 var i = this.getAsDataURL(e, t);
2844 return m.atob(i.substring(i.indexOf('base64,') + 7))
2845 },
2846 embed: function (n, r) {
2847 function o(t, r) {
2848 var o = this;
2849 if (u.can('create_canvas')) {
2850 var l = o.getAsCanvas();
2851 if (l) return n.appendChild(l),
2852 l = null,
2853 o.destroy(),
2854 c.trigger('embedded'),
2855 void 0
2856 }
2857 var d = o.getAsDataURL(t, r);
2858 if (!d) throw new i.ImageError(i.ImageError.WRONG_FORMAT);
2859 if (u.can('use_data_uri_of', d.length)) n.innerHTML = '<img src="' + d + '" width="' + o.width + '" height="' + o.height + '" />',
2860 o.destroy(),
2861 c.trigger('embedded');
2862 else {
2863 var h = new s;
2864 h.bind('TransportingComplete', function () {
2865 a = c.connectRuntime(this.result.ruid),
2866 c.bind('Embedded', function () {
2867 e.extend(a.getShimContainer().style, {
2868 top: '0px',
2869 left: '0px',
2870 width: o.width + 'px',
2871 height: o.height + 'px'
2872 }),
2873 a = null
2874 }, 999),
2875 a.exec.call(c, 'ImageView', 'display', this.result.uid, width, height),
2876 o.destroy()
2877 }),
2878 h.transport(m.atob(d.substring(d.indexOf('base64,') + 7)), t, {
2879 required_caps: {
2880 display_media: !0
2881 },
2882 runtime_order: 'flash,silverlight',
2883 container: n
2884 })
2885 }
2886 }
2887 var a,
2888 c = this,
2889 l = e.extend({
2890 width: this.width,
2891 height: this.height,
2892 type: this.type || 'image/jpeg',
2893 quality: 90
2894 }, r);
2895 try {
2896 if (!(n = t.get(n))) throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);
2897 if (!this.size) throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);
2898 this.width > h.MAX_RESIZE_WIDTH || this.height > h.MAX_RESIZE_HEIGHT;
2899 var d = new h;
2900 return d.bind('Resize', function () {
2901 o.call(this, l.type, l.quality)
2902 }),
2903 d.bind('Load', function () {
2904 this.downsize(l)
2905 }),
2906 this.meta.thumb && this.meta.thumb.width >= l.width && this.meta.thumb.height >= l.height ? d.load(this.meta.thumb.data) : d.clone(this, !1),
2907 d
2908 } catch (f) {
2909 this.trigger('error', f.code)
2910 }
2911 },
2912 destroy: function () {
2913 this.ruid && (this.getRuntime().exec.call(this, 'Image', 'destroy'), this.disconnectRuntime()),
2914 this.meta && this.meta.thumb && this.meta.thumb.data.destroy(),
2915 this.unbindAll()
2916 }
2917 }), this.handleEventProps(f), this.bind('Load Resize', function () {
2918 return n.call(this)
2919 }, 999)
2920 }
2921 var f = [
2922 'progress',
2923 'load',
2924 'error',
2925 'resize',
2926 'embedded'
2927 ];
2928 return h.MAX_RESIZE_WIDTH = 8192,
2929 h.MAX_RESIZE_HEIGHT = 8192,
2930 h.prototype = c.instance,
2931 h
2932 }), n('moxie/runtime/html5/Runtime', [
2933 'moxie/core/utils/Basic',
2934 'moxie/core/Exceptions',
2935 'moxie/runtime/Runtime',
2936 'moxie/core/utils/Env'
2937 ], function (e, t, i, n) {
2938 function o(t) {
2939 var o = this,
2940 u = i.capTest,
2941 c = i.capTrue,
2942 l = e.extend({
2943 access_binary: u(window.FileReader || window.File && window.File.getAsDataURL),
2944 access_image_binary: function () {
2945 return o.can('access_binary') && !!s.Image
2946 },
2947 display_media: u((n.can('create_canvas') || n.can('use_data_uri_over32kb')) && r('moxie/image/Image')),
2948 do_cors: u(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest),
2949 drag_and_drop: u(function () {
2950 var e = document.createElement('div');
2951 return ('draggable' in e || 'ondragstart' in e && 'ondrop' in e) && ('IE' !== n.browser || n.verComp(n.version, 9, '>'))
2952 }()),
2953 filter_by_extension: u(function () {
2954 return !('Chrome' === n.browser && n.verComp(n.version, 28, '<') || 'IE' === n.browser && n.verComp(n.version, 10, '<') || 'Safari' === n.browser && n.verComp(n.version, 7, '<') || 'Firefox' === n.browser && n.verComp(n.version, 37, '<'))
2955 }()),
2956 return_response_headers: c,
2957 return_response_type: function (e) {
2958 return 'json' === e && window.JSON ? !0 : n.can('return_response_type', e)
2959 },
2960 return_status_code: c,
2961 report_upload_progress: u(window.XMLHttpRequest && (new XMLHttpRequest).upload),
2962 resize_image: function () {
2963 return o.can('access_binary') && n.can('create_canvas')
2964 },
2965 select_file: function () {
2966 return n.can('use_fileinput') && window.File
2967 },
2968 select_folder: function () {
2969 return o.can('select_file') && ('Chrome' === n.browser && n.verComp(n.version, 21, '>=') || 'Firefox' === n.browser && n.verComp(n.version, 42, '>='))
2970 },
2971 select_multiple: function () {
2972 return !(!o.can('select_file') || 'Safari' === n.browser && 'Windows' === n.os || 'iOS' === n.os && n.verComp(n.osVersion, '7.0.0', '>') && n.verComp(n.osVersion, '8.0.0', '<'))
2973 },
2974 send_binary_string: u(window.XMLHttpRequest && ((new XMLHttpRequest).sendAsBinary || window.Uint8Array && window.ArrayBuffer)),
2975 send_custom_headers: u(window.XMLHttpRequest),
2976 send_multipart: function () {
2977 return !!(window.XMLHttpRequest && (new XMLHttpRequest).upload && window.FormData) || o.can('send_binary_string')
2978 },
2979 slice_blob: u(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)),
2980 stream_upload: function () {
2981 return o.can('slice_blob') && o.can('send_multipart')
2982 },
2983 summon_file_dialog: function () {
2984 return o.can('select_file') && ('Firefox' === n.browser && n.verComp(n.version, 4, '>=') || 'Opera' === n.browser && n.verComp(n.version, 12, '>=') || 'IE' === n.browser && n.verComp(n.version, 10, '>=') || !!~e.inArray(n.browser, [
2985 'Chrome',
2986 'Safari',
2987 'Edge'
2988 ]))
2989 },
2990 upload_filesize: c,
2991 use_http_method: c
2992 }, arguments[2]);
2993 i.call(this, t, arguments[1] || a, l),
2994 e.extend(this, {
2995 init: function () {
2996 this.trigger('Init')
2997 },
2998 destroy: function (e) {
2999 return function () {
3000 e.call(o),
3001 e = o = null
3002 }
3003 }(this.destroy)
3004 }),
3005 e.extend(this.getShim(), s)
3006 }
3007 var a = 'html5',
3008 s = {
3009 };
3010 return i.addConstructor(a, o),
3011 s
3012 }), n('moxie/runtime/html5/file/Blob', [
3013 'moxie/runtime/html5/Runtime',
3014 'moxie/file/Blob'
3015 ], function (e, t) {
3016 function i() {
3017 function e(e, t, i) {
3018 var n;
3019 if (!window.File.prototype.slice) return (n = window.File.prototype.webkitSlice || window.File.prototype.mozSlice) ? n.call(e, t, i) : null;
3020 try {
3021 return e.slice(),
3022 e.slice(t, i)
3023 } catch (r) {
3024 return e.slice(t, i - t)
3025 }
3026 }
3027 this.slice = function () {
3028 return new t(this.getRuntime().uid, e.apply(this, arguments))
3029 }
3030 }
3031 return e.Blob = i
3032 }), n('moxie/core/utils/Events', [
3033 'moxie/core/utils/Basic'
3034 ], function (e) {
3035 function t() {
3036 this.returnValue = !1
3037 }
3038 function i() {
3039 this.cancelBubble = !0
3040 }
3041 var n = {
3042 },
3043 r = 'moxie_' + e.guid(),
3044 o = function (o, a, s, u) {
3045 var c,
3046 l;
3047 a = a.toLowerCase(),
3048 o.addEventListener ? (c = s, o.addEventListener(a, c, !1)) : o.attachEvent && (c = function () {
3049 var e = window.event;
3050 e.target || (e.target = e.srcElement),
3051 e.preventDefault = t,
3052 e.stopPropagation = i,
3053 s(e)
3054 }, o.attachEvent('on' + a, c)),
3055 o[r] || (o[r] = e.guid()),
3056 n.hasOwnProperty(o[r]) || (n[o[r]] = {
3057 }),
3058 l = n[o[r]],
3059 l.hasOwnProperty(a) || (l[a] = [
3060 ]),
3061 l[a].push({
3062 func: c,
3063 orig: s,
3064 key: u
3065 })
3066 },
3067 a = function (t, i, o) {
3068 var a,
3069 s;
3070 if (i = i.toLowerCase(), t[r] && n[t[r]] && n[t[r]][i]) {
3071 a = n[t[r]][i];
3072 for (var u = a.length - 1; u >= 0 && (a[u].orig !== o && a[u].key !== o || (t.removeEventListener ? t.removeEventListener(i, a[u].func, !1) : t.detachEvent && t.detachEvent('on' + i, a[u].func), a[u].orig = null, a[u].func = null, a.splice(u, 1), o === s)); u--);
3073 if (a.length || delete n[t[r]][i], e.isEmptyObj(n[t[r]])) {
3074 delete n[t[r]];
3075 try {
3076 delete t[r]
3077 } catch (c) {
3078 t[r] = s
3079 }
3080 }
3081 }
3082 },
3083 s = function (t, i) {
3084 t && t[r] && e.each(n[t[r]], function (e, n) {
3085 a(t, n, i)
3086 })
3087 };
3088 return {
3089 addEvent: o,
3090 removeEvent: a,
3091 removeAllEvents: s
3092 }
3093 }), n('moxie/runtime/html5/file/FileInput', [
3094 'moxie/runtime/html5/Runtime',
3095 'moxie/file/File',
3096 'moxie/core/utils/Basic',
3097 'moxie/core/utils/Dom',
3098 'moxie/core/utils/Events',
3099 'moxie/core/utils/Mime',
3100 'moxie/core/utils/Env'
3101 ], function (e, t, i, n, r, o, a) {
3102 function s() {
3103 var e,
3104 s;
3105 i.extend(this, {
3106 init: function (u) {
3107 var c,
3108 l,
3109 d,
3110 m,
3111 h,
3112 f,
3113 p = this,
3114 g = p.getRuntime();
3115 e = u,
3116 d = e.accept.mimes || o.extList2mimes(e.accept, g.can('filter_by_extension')),
3117 l = g.getShimContainer(),
3118 l.innerHTML = '<input id="' + g.uid + '" type="file" style="font-size:999px;opacity:0;"' + (e.multiple && g.can('select_multiple') ? 'multiple' : '') + (e.directory && g.can('select_folder') ? 'webkitdirectory directory' : '') + (d ? ' accept="' + d.join(',') + '"' : '') + ' />',
3119 c = n.get(g.uid),
3120 i.extend(c.style, {
3121 position: 'absolute',
3122 top: 0,
3123 left: 0,
3124 width: '100%',
3125 height: '100%'
3126 }),
3127 m = n.get(e.browse_button),
3128 s = n.getStyle(m, 'z-index') || 'auto',
3129 g.can('summon_file_dialog') && ('static' === n.getStyle(m, 'position') && (m.style.position = 'relative'), r.addEvent(m, 'click', function (e) {
3130 var t = n.get(g.uid);
3131 t && !t.disabled && t.click(),
3132 e.preventDefault()
3133 }, p.uid), p.bind('Refresh', function () {
3134 h = parseInt(s, 10) || 1,
3135 n.get(e.browse_button).style.zIndex = h,
3136 this.getRuntime().getShimContainer().style.zIndex = h - 1
3137 })),
3138 f = g.can('summon_file_dialog') ? m : l,
3139 r.addEvent(f, 'mouseover', function () {
3140 p.trigger('mouseenter')
3141 }, p.uid),
3142 r.addEvent(f, 'mouseout', function () {
3143 p.trigger('mouseleave')
3144 }, p.uid),
3145 r.addEvent(f, 'mousedown', function () {
3146 p.trigger('mousedown')
3147 }, p.uid),
3148 r.addEvent(n.get(e.container), 'mouseup', function () {
3149 p.trigger('mouseup')
3150 }, p.uid),
3151 c.onchange = function x() {
3152 if (p.files = [
3153 ], i.each(this.files, function (i) {
3154 var n = '';
3155 return e.directory && '.' == i.name ? !0 : (i.webkitRelativePath && (n = '/' + i.webkitRelativePath.replace(/^\//, '')), i = new t(g.uid, i), i.relativePath = n, p.files.push(i), void 0)
3156 }), 'IE' !== a.browser && 'IEMobile' !== a.browser) this.value = '';
3157 else {
3158 var n = this.cloneNode(!0);
3159 this.parentNode.replaceChild(n, this),
3160 n.onchange = x
3161 }
3162 p.files.length && p.trigger('change')
3163 },
3164 p.trigger({
3165 type: 'ready',
3166 async: !0
3167 }),
3168 l = null
3169 },
3170 setOption: function (e, t) {
3171 var i = this.getRuntime(),
3172 r = n.get(i.uid);
3173 switch (e) {
3174 case 'accept':
3175 if (t) {
3176 var a = t.mimes || o.extList2mimes(t, i.can('filter_by_extension'));
3177 r.setAttribute('accept', a.join(','))
3178 } else r.removeAttribute('accept');
3179 break;
3180 case 'directory':
3181 t && i.can('select_folder') ? (r.setAttribute('directory', ''), r.setAttribute('webkitdirectory', '')) : (r.removeAttribute('directory'), r.removeAttribute('webkitdirectory'));
3182 break;
3183 case 'multiple':
3184 t && i.can('select_multiple') ? r.setAttribute('multiple', '') : r.removeAttribute('multiple')
3185 }
3186 },
3187 disable: function (e) {
3188 var t,
3189 i = this.getRuntime();
3190 (t = n.get(i.uid)) && (t.disabled = !!e)
3191 },
3192 destroy: function () {
3193 var t = this.getRuntime(),
3194 i = t.getShim(),
3195 o = t.getShimContainer(),
3196 a = e && n.get(e.container),
3197 u = e && n.get(e.browse_button);
3198 a && r.removeAllEvents(a, this.uid),
3199 u && (r.removeAllEvents(u, this.uid), u.style.zIndex = s),
3200 o && (r.removeAllEvents(o, this.uid), o.innerHTML = ''),
3201 i.removeInstance(this.uid),
3202 e = o = a = u = i = null
3203 }
3204 })
3205 }
3206 return e.FileInput = s
3207 }), n('moxie/runtime/html5/file/FileDrop', [
3208 'moxie/runtime/html5/Runtime',
3209 'moxie/file/File',
3210 'moxie/core/utils/Basic',
3211 'moxie/core/utils/Dom',
3212 'moxie/core/utils/Events',
3213 'moxie/core/utils/Mime'
3214 ], function (e, t, i, n, r, o) {
3215 function a() {
3216 function e(e) {
3217 if (!e.dataTransfer || !e.dataTransfer.types) return !1;
3218 var t = i.toArray(e.dataTransfer.types || [
3219 ]);
3220 return - 1 !== i.inArray('Files', t) || - 1 !== i.inArray('public.file-url', t) || - 1 !== i.inArray('application/x-moz-file', t)
3221 }
3222 function a(e, i) {
3223 if (u(e)) {
3224 var n = new t(f, e);
3225 n.relativePath = i || '',
3226 p.push(n)
3227 }
3228 }
3229 function s(e) {
3230 for (var t = [
3231 ], n = 0; n < e.length; n++) [].push.apply(t, e[n].extensions.split(/\s*,\s*/));
3232 return - 1 === i.inArray('*', t) ? t : [
3233 ]
3234 }
3235 function u(e) {
3236 if (!g.length) return !0;
3237 var t = o.getFileExtension(e.name);
3238 return !t || - 1 !== i.inArray(t, g)
3239 }
3240 function c(e, t) {
3241 var n = [
3242 ];
3243 i.each(e, function (e) {
3244 var t = e.webkitGetAsEntry();
3245 t && (t.isFile ? a(e.getAsFile(), t.fullPath) : n.push(t))
3246 }),
3247 n.length ? l(n, t) : t()
3248 }
3249 function l(e, t) {
3250 var n = [
3251 ];
3252 i.each(e, function (e) {
3253 n.push(function (t) {
3254 d(e, t)
3255 })
3256 }),
3257 i.inSeries(n, function () {
3258 t()
3259 })
3260 }
3261 function d(e, t) {
3262 e.isFile ? e.file(function (i) {
3263 a(i, e.fullPath),
3264 t()
3265 }, function () {
3266 t()
3267 }) : e.isDirectory ? m(e, t) : t()
3268 }
3269 function m(e, t) {
3270 function i(e) {
3271 r.readEntries(function (t) {
3272 t.length ? ([].push.apply(n, t), i(e)) : e()
3273 }, e)
3274 }
3275 var n = [
3276 ],
3277 r = e.createReader();
3278 i(function () {
3279 l(n, t)
3280 })
3281 }
3282 var h,
3283 f,
3284 p = [
3285 ],
3286 g = [
3287 ];
3288 i.extend(this, {
3289 init: function (t) {
3290 var n,
3291 o = this;
3292 h = t,
3293 f = o.ruid,
3294 g = s(h.accept),
3295 n = h.container,
3296 r.addEvent(n, 'dragover', function (t) {
3297 e(t) && (t.preventDefault(), t.dataTransfer.dropEffect = 'copy')
3298 }, o.uid),
3299 r.addEvent(n, 'drop', function (t) {
3300 e(t) && (t.preventDefault(), p = [
3301 ], t.dataTransfer.items && t.dataTransfer.items[0].webkitGetAsEntry ? c(t.dataTransfer.items, function () {
3302 o.files = p,
3303 o.trigger('drop')
3304 }) : (i.each(t.dataTransfer.files, function (e) {
3305 a(e)
3306 }), o.files = p, o.trigger('drop')))
3307 }, o.uid),
3308 r.addEvent(n, 'dragenter', function () {
3309 o.trigger('dragenter')
3310 }, o.uid),
3311 r.addEvent(n, 'dragleave', function () {
3312 o.trigger('dragleave')
3313 }, o.uid)
3314 },
3315 destroy: function () {
3316 r.removeAllEvents(h && n.get(h.container), this.uid),
3317 f = p = g = h = null
3318 }
3319 })
3320 }
3321 return e.FileDrop = a
3322 }), n('moxie/runtime/html5/file/FileReader', [
3323 'moxie/runtime/html5/Runtime',
3324 'moxie/core/utils/Encode',
3325 'moxie/core/utils/Basic'
3326 ], function (e, t, i) {
3327 function n() {
3328 function e(e) {
3329 return t.atob(e.substring(e.indexOf('base64,') + 7))
3330 }
3331 var n,
3332 r = !1;
3333 i.extend(this, {
3334 read: function (t, o) {
3335 var a = this;
3336 a.result = '',
3337 n = new window.FileReader,
3338 n.addEventListener('progress', function (e) {
3339 a.trigger(e)
3340 }),
3341 n.addEventListener('load', function (t) {
3342 a.result = r ? e(n.result) : n.result,
3343 a.trigger(t)
3344 }),
3345 n.addEventListener('error', function (e) {
3346 a.trigger(e, n.error)
3347 }),
3348 n.addEventListener('loadend', function (e) {
3349 n = null,
3350 a.trigger(e)
3351 }),
3352 'function' === i.typeOf(n[t]) ? (r = !1, n[t](o.getSource())) : 'readAsBinaryString' === t && (r = !0, n.readAsDataURL(o.getSource()))
3353 },
3354 abort: function () {
3355 n && n.abort()
3356 },
3357 destroy: function () {
3358 n = null
3359 }
3360 })
3361 }
3362 return e.FileReader = n
3363 }), n('moxie/runtime/html5/xhr/XMLHttpRequest', [
3364 'moxie/runtime/html5/Runtime',
3365 'moxie/core/utils/Basic',
3366 'moxie/core/utils/Mime',
3367 'moxie/core/utils/Url',
3368 'moxie/file/File',
3369 'moxie/file/Blob',
3370 'moxie/xhr/FormData',
3371 'moxie/core/Exceptions',
3372 'moxie/core/utils/Env'
3373 ], function (e, t, i, n, r, o, a, s, u) {
3374 function c() {
3375 function e(e, t) {
3376 var i,
3377 n,
3378 r = this;
3379 i = t.getBlob().getSource(),
3380 n = new window.FileReader,
3381 n.onload = function () {
3382 t.append(t.getBlobName(), new o(null, {
3383 type: i.type,
3384 data: n.result
3385 })),
3386 f.send.call(r, e, t)
3387 },
3388 n.readAsBinaryString(i)
3389 }
3390 function c() {
3391 return !window.XMLHttpRequest || 'IE' === u.browser && u.verComp(u.version, 8, '<') ? function () {
3392 for (var e = [
3393 'Msxml2.XMLHTTP.6.0',
3394 'Microsoft.XMLHTTP'
3395 ], t = 0; t < e.length; t++) try {
3396 return new ActiveXObject(e[t])
3397 } catch (i) {
3398 }
3399 }() : new window.XMLHttpRequest
3400 }
3401 function l(e) {
3402 var t = e.responseXML,
3403 i = e.responseText;
3404 return 'IE' === u.browser && i && t && !t.documentElement && /[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader('Content-Type')) && (t = new window.ActiveXObject('Microsoft.XMLDOM'), t.async = !1, t.validateOnParse = !1, t.loadXML(i)),
3405 t && ('IE' === u.browser && 0 !== t.parseError || !t.documentElement || 'parsererror' === t.documentElement.tagName) ? null : t
3406 }
3407 function d(e) {
3408 var t = '----moxieboundary' + (new Date).getTime(),
3409 i = '--',
3410 n = '\r\n',
3411 r = '',
3412 a = this.getRuntime();
3413 if (!a.can('send_binary_string')) throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);
3414 return m.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + t),
3415 e.each(function (e, a) {
3416 r += e instanceof o ? i + t + n + 'Content-Disposition: form-data; name="' + a + '"; filename="' + unescape(encodeURIComponent(e.name || 'blob')) + '"' + n + 'Content-Type: ' + (e.type || 'application/octet-stream') + n + n + e.getSource() + n : i + t + n + 'Content-Disposition: form-data; name="' + a + '"' + n + n + unescape(encodeURIComponent(e)) + n
3417 }),
3418 r += i + t + i + n
3419 }
3420 var m,
3421 h,
3422 f = this;
3423 t.extend(this, {
3424 send: function (i, r) {
3425 var s = this,
3426 l = 'Mozilla' === u.browser && u.verComp(u.version, 4, '>=') && u.verComp(u.version, 7, '<'),
3427 f = 'Android Browser' === u.browser,
3428 p = !1;
3429 if (h = i.url.replace(/^.+?\/([\w\-\.]+)$/, '$1').toLowerCase(), m = c(), m.open(i.method, i.url, i.async, i.user, i.password), r instanceof o) r.isDetached() && (p = !0),
3430 r = r.getSource();
3431 else if (r instanceof a) {
3432 if (r.hasBlob()) if (r.getBlob().isDetached()) r = d.call(s, r),
3433 p = !0;
3434 else if ((l || f) && 'blob' === t.typeOf(r.getBlob().getSource()) && window.FileReader) return e.call(s, i, r),
3435 void 0;
3436 if (r instanceof a) {
3437 var g = new window.FormData;
3438 r.each(function (e, t) {
3439 e instanceof o ? g.append(t, e.getSource()) : g.append(t, e)
3440 }),
3441 r = g
3442 }
3443 }
3444 m.upload ? (i.withCredentials && (m.withCredentials = !0), m.addEventListener('load', function (e) {
3445 s.trigger(e)
3446 }), m.addEventListener('error', function (e) {
3447 s.trigger(e)
3448 }), m.addEventListener('progress', function (e) {
3449 s.trigger(e)
3450 }), m.upload.addEventListener('progress', function (e) {
3451 s.trigger({
3452 type: 'UploadProgress',
3453 loaded: e.loaded,
3454 total: e.total
3455 })
3456 })) : m.onreadystatechange = function () {
3457 switch (m.readyState) {
3458 case 1:
3459 break;
3460 case 2:
3461 break;
3462 case 3:
3463 var e,
3464 t;
3465 try {
3466 n.hasSameOrigin(i.url) && (e = m.getResponseHeader('Content-Length') || 0),
3467 m.responseText && (t = m.responseText.length)
3468 } catch (r) {
3469 e = t = 0
3470 }
3471 s.trigger({
3472 type: 'progress',
3473 lengthComputable: !!e,
3474 total: parseInt(e, 10),
3475 loaded: t
3476 });
3477 break;
3478 case 4:
3479 m.onreadystatechange = function () {
3480 },
3481 0 === m.status ? s.trigger('error') : s.trigger('load')
3482 }
3483 },
3484 t.isEmptyObj(i.headers) || t.each(i.headers, function (e, t) {
3485 m.setRequestHeader(t, e)
3486 }),
3487 '' !== i.responseType && 'responseType' in m && (m.responseType = 'json' !== i.responseType || u.can('return_response_type', 'json') ? i.responseType : 'text'),
3488 p ? m.sendAsBinary ? m.sendAsBinary(r) : function () {
3489 for (var e = new Uint8Array(r.length), t = 0; t < r.length; t++) e[t] = 255 & r.charCodeAt(t);
3490 m.send(e.buffer)
3491 }() : m.send(r),
3492 s.trigger('loadstart')
3493 },
3494 getStatus: function () {
3495 try {
3496 if (m) return m.status
3497 } catch (e) {
3498 }
3499 return 0
3500 },
3501 getResponse: function (e) {
3502 var t = this.getRuntime();
3503 try {
3504 switch (e) {
3505 case 'blob':
3506 var n = new r(t.uid, m.response),
3507 o = m.getResponseHeader('Content-Disposition');
3508 if (o) {
3509 var a = o.match(/filename=([\'\"'])([^\1]+)\1/);
3510 a && (h = a[2])
3511 }
3512 return n.name = h,
3513 n.type || (n.type = i.getFileMime(h)),
3514 n;
3515 case 'json':
3516 return u.can('return_response_type', 'json') ? m.response : 200 === m.status && window.JSON ? JSON.parse(m.responseText) : null;
3517 case 'document':
3518 return l(m);
3519 default:
3520 return '' !== m.responseText ? m.responseText : null
3521 }
3522 } catch (s) {
3523 return null
3524 }
3525 },
3526 getAllResponseHeaders: function () {
3527 try {
3528 return m.getAllResponseHeaders()
3529 } catch (e) {
3530 }
3531 return ''
3532 },
3533 abort: function () {
3534 m && m.abort()
3535 },
3536 destroy: function () {
3537 f = h = null
3538 }
3539 })
3540 }
3541 return e.XMLHttpRequest = c
3542 }),
3543 n('moxie/runtime/html5/utils/BinaryReader', [
3544 'moxie/core/utils/Basic'
3545 ], function (e) {
3546 function t(e) {
3547 e instanceof ArrayBuffer ? i.apply(this, arguments) : n.apply(this, arguments)
3548 }
3549 function i(t) {
3550 var i = new DataView(t);
3551 e.extend(this, {
3552 readByteAt: function (e) {
3553 return i.getUint8(e)
3554 },
3555 writeByteAt: function (e, t) {
3556 i.setUint8(e, t)
3557 },
3558 SEGMENT: function (e, n, r) {
3559 switch (arguments.length) {
3560 case 2:
3561 return t.slice(e, e + n);
3562 case 1:
3563 return t.slice(e);
3564 case 3:
3565 if (null === r && (r = new ArrayBuffer), r instanceof ArrayBuffer) {
3566 var o = new Uint8Array(this.length() - n + r.byteLength);
3567 e > 0 && o.set(new Uint8Array(t.slice(0, e)), 0),
3568 o.set(new Uint8Array(r), e),
3569 o.set(new Uint8Array(t.slice(e + n)), e + r.byteLength),
3570 this.clear(),
3571 t = o.buffer,
3572 i = new DataView(t);
3573 break
3574 }
3575 default:
3576 return t
3577 }
3578 },
3579 length: function () {
3580 return t ? t.byteLength : 0
3581 },
3582 clear: function () {
3583 i = t = null
3584 }
3585 })
3586 }
3587 function n(t) {
3588 function i(e, i, n) {
3589 n = 3 === arguments.length ? n : t.length - i - 1,
3590 t = t.substr(0, i) + e + t.substr(n + i)
3591 }
3592 e.extend(this, {
3593 readByteAt: function (e) {
3594 return t.charCodeAt(e)
3595 },
3596 writeByteAt: function (e, t) {
3597 i(String.fromCharCode(t), e, 1)
3598 },
3599 SEGMENT: function (e, n, r) {
3600 switch (arguments.length) {
3601 case 1:
3602 return t.substr(e);
3603 case 2:
3604 return t.substr(e, n);
3605 case 3:
3606 i(null !== r ? r : '', e, n);
3607 break;
3608 default:
3609 return t
3610 }
3611 },
3612 length: function () {
3613 return t ? t.length : 0
3614 },
3615 clear: function () {
3616 t = null
3617 }
3618 })
3619 }
3620 return e.extend(t.prototype, {
3621 littleEndian: !1,
3622 read: function (e, t) {
3623 var i,
3624 n,
3625 r;
3626 if (e + t > this.length()) throw new Error('You are trying to read outside the source boundaries.');
3627 for (n = this.littleEndian ? 0 : - 8 * (t - 1), r = 0, i = 0; t > r; r++) i |= this.readByteAt(e + r) << Math.abs(n + 8 * r);
3628 return i
3629 },
3630 write: function (e, t, i) {
3631 var n,
3632 r;
3633 if (e > this.length()) throw new Error('You are trying to write outside the source boundaries.');
3634 for (n = this.littleEndian ? 0 : - 8 * (i - 1), r = 0; i > r; r++) this.writeByteAt(e + r, 255 & t >> Math.abs(n + 8 * r))
3635 },
3636 BYTE: function (e) {
3637 return this.read(e, 1)
3638 },
3639 SHORT: function (e) {
3640 return this.read(e, 2)
3641 },
3642 LONG: function (e) {
3643 return this.read(e, 4)
3644 },
3645 SLONG: function (e) {
3646 var t = this.read(e, 4);
3647 return t > 2147483647 ? t - 4294967296 : t
3648 },
3649 CHAR: function (e) {
3650 return String.fromCharCode(this.read(e, 1))
3651 },
3652 STRING: function (e, t) {
3653 return this.asArray('CHAR', e, t).join('')
3654 },
3655 asArray: function (e, t, i) {
3656 for (var n = [
3657 ], r = 0; i > r; r++) n[r] = this[e](t + r);
3658 return n
3659 }
3660 }),
3661 t
3662 }),
3663 n('moxie/runtime/html5/image/JPEGHeaders', [
3664 'moxie/runtime/html5/utils/BinaryReader',
3665 'moxie/core/Exceptions'
3666 ], function (e, t) {
3667 return function i(n) {
3668 var r,
3669 o,
3670 a,
3671 s = [
3672 ],
3673 u = 0;
3674 if (r = new e(n), 65496 !== r.SHORT(0)) throw r.clear(),
3675 new t.ImageError(t.ImageError.WRONG_FORMAT);
3676 for (o = 2; o <= r.length(); ) if (a = r.SHORT(o), a >= 65488 && 65495 >= a) o += 2;
3677 else {
3678 if (65498 === a || 65497 === a) break;
3679 u = r.SHORT(o + 2) + 2,
3680 a >= 65505 && 65519 >= a && s.push({
3681 hex: a,
3682 name: 'APP' + (15 & a),
3683 start: o,
3684 length: u,
3685 segment: r.SEGMENT(o, u)
3686 }),
3687 o += u
3688 }
3689 return r.clear(),
3690 {
3691 headers: s,
3692 restore: function (t) {
3693 var i,
3694 n,
3695 r;
3696 for (r = new e(t), o = 65504 == r.SHORT(2) ? 4 + r.SHORT(4) : 2, n = 0, i = s.length; i > n; n++) r.SEGMENT(o, 0, s[n].segment),
3697 o += s[n].length;
3698 return t = r.SEGMENT(),
3699 r.clear(),
3700 t
3701 },
3702 strip: function (t) {
3703 var n,
3704 r,
3705 o,
3706 a;
3707 for (o = new i(t), r = o.headers, o.purge(), n = new e(t), a = r.length; a--; ) n.SEGMENT(r[a].start, r[a].length, '');
3708 return t = n.SEGMENT(),
3709 n.clear(),
3710 t
3711 },
3712 get: function (e) {
3713 for (var t = [
3714 ], i = 0, n = s.length; n > i; i++) s[i].name === e.toUpperCase() && t.push(s[i].segment);
3715 return t
3716 },
3717 set: function (e, t) {
3718 var i,
3719 n,
3720 r,
3721 o = [
3722 ];
3723 for ('string' == typeof t ? o.push(t) : o = t, i = n = 0, r = s.length; r > i && (s[i].name === e.toUpperCase() && (s[i].segment = o[n], s[i].length = o[n].length, n++), !(n >= o.length)); i++);
3724 },
3725 purge: function () {
3726 this.headers = s = [
3727 ]
3728 }
3729 }
3730 }
3731 }),
3732 n('moxie/runtime/html5/image/ExifParser', [
3733 'moxie/core/utils/Basic',
3734 'moxie/runtime/html5/utils/BinaryReader',
3735 'moxie/core/Exceptions'
3736 ], function (e, i, n) {
3737 function r(o) {
3738 function a(i, r) {
3739 var o,
3740 a,
3741 s,
3742 u,
3743 c,
3744 m,
3745 h,
3746 f,
3747 p = this,
3748 g = [
3749 ],
3750 x = {
3751 },
3752 v = {
3753 1: 'BYTE',
3754 7: 'UNDEFINED',
3755 2: 'ASCII',
3756 3: 'SHORT',
3757 4: 'LONG',
3758 5: 'RATIONAL',
3759 9: 'SLONG',
3760 10: 'SRATIONAL'
3761 },
3762 w = {
3763 BYTE: 1,
3764 UNDEFINED: 1,
3765 ASCII: 1,
3766 SHORT: 2,
3767 LONG: 4,
3768 RATIONAL: 8,
3769 SLONG: 4,
3770 SRATIONAL: 8
3771 };
3772 for (o = p.SHORT(i), a = 0; o > a; a++) if (g = [
3773 ], h = i + 2 + 12 * a, s = r[p.SHORT(h)], s !== t) {
3774 if (u = v[p.SHORT(h += 2)], c = p.LONG(h += 2), m = w[u], !m) throw new n.ImageError(n.ImageError.INVALID_META_ERR);
3775 if (h += 4, m * c > 4 && (h = p.LONG(h) + d.tiffHeader), h + m * c >= this.length()) throw new n.ImageError(n.ImageError.INVALID_META_ERR);
3776 'ASCII' !== u ? (g = p.asArray(u, h, c), f = 1 == c ? g[0] : g, x[s] = l.hasOwnProperty(s) && 'object' != typeof f ? l[s][f] : f) : x[s] = e.trim(p.STRING(h, c).replace(/\0$/, ''))
3777 }
3778 return x
3779 }
3780 function s(e, t, i) {
3781 var n,
3782 r,
3783 o,
3784 a = 0;
3785 if ('string' == typeof t) {
3786 var s = c[e.toLowerCase()];
3787 for (var u in s) if (s[u] === t) {
3788 t = u;
3789 break
3790 }
3791 }
3792 n = d[e.toLowerCase() + 'IFD'],
3793 r = this.SHORT(n);
3794 for (var l = 0; r > l; l++) if (o = n + 12 * l + 2, this.SHORT(o) == t) {
3795 a = o + 8;
3796 break
3797 }
3798 if (!a) return !1;
3799 try {
3800 this.write(a, i, 4)
3801 } catch (m) {
3802 return !1
3803 }
3804 return !0
3805 }
3806 var u,
3807 c,
3808 l,
3809 d,
3810 m,
3811 h;
3812 if (i.call(this, o), c = {
3813 tiff: {
3814 274: 'Orientation',
3815 270: 'ImageDescription',
3816 271: 'Make',
3817 272: 'Model',
3818 305: 'Software',
3819 34665: 'ExifIFDPointer',
3820 34853: 'GPSInfoIFDPointer'
3821 },
3822 exif: {
3823 36864: 'ExifVersion',
3824 40961: 'ColorSpace',
3825 40962: 'PixelXDimension',
3826 40963: 'PixelYDimension',
3827 36867: 'DateTimeOriginal',
3828 33434: 'ExposureTime',
3829 33437: 'FNumber',
3830 34855: 'ISOSpeedRatings',
3831 37377: 'ShutterSpeedValue',
3832 37378: 'ApertureValue',
3833 37383: 'MeteringMode',
3834 37384: 'LightSource',
3835 37385: 'Flash',
3836 37386: 'FocalLength',
3837 41986: 'ExposureMode',
3838 41987: 'WhiteBalance',
3839 41990: 'SceneCaptureType',
3840 41988: 'DigitalZoomRatio',
3841 41992: 'Contrast',
3842 41993: 'Saturation',
3843 41994: 'Sharpness'
3844 },
3845 gps: {
3846 0: 'GPSVersionID',
3847 1: 'GPSLatitudeRef',
3848 2: 'GPSLatitude',
3849 3: 'GPSLongitudeRef',
3850 4: 'GPSLongitude'
3851 },
3852 thumb: {
3853 513: 'JPEGInterchangeFormat',
3854 514: 'JPEGInterchangeFormatLength'
3855 }
3856 }, l = {
3857 ColorSpace: {
3858 1: 'sRGB',
3859 0: 'Uncalibrated'
3860 },
3861 MeteringMode: {
3862 0: 'Unknown',
3863 1: 'Average',
3864 2: 'CenterWeightedAverage',
3865 3: 'Spot',
3866 4: 'MultiSpot',
3867 5: 'Pattern',
3868 6: 'Partial',
3869 255: 'Other'
3870 },
3871 LightSource: {
3872 1: 'Daylight',
3873 2: 'Fliorescent',
3874 3: 'Tungsten',
3875 4: 'Flash',
3876 9: 'Fine weather',
3877 10: 'Cloudy weather',
3878 11: 'Shade',
3879 12: 'Daylight fluorescent (D 5700 - 7100K)',
3880 13: 'Day white fluorescent (N 4600 -5400K)',
3881 14: 'Cool white fluorescent (W 3900 - 4500K)',
3882 15: 'White fluorescent (WW 3200 - 3700K)',
3883 17: 'Standard light A',
3884 18: 'Standard light B',
3885 19: 'Standard light C',
3886 20: 'D55',
3887 21: 'D65',
3888 22: 'D75',
3889 23: 'D50',
3890 24: 'ISO studio tungsten',
3891 255: 'Other'
3892 },
3893 Flash: {
3894 0: 'Flash did not fire',
3895 1: 'Flash fired',
3896 5: 'Strobe return light not detected',
3897 7: 'Strobe return light detected',
3898 9: 'Flash fired, compulsory flash mode',
3899 13: 'Flash fired, compulsory flash mode, return light not detected',
3900 15: 'Flash fired, compulsory flash mode, return light detected',
3901 16: 'Flash did not fire, compulsory flash mode',
3902 24: 'Flash did not fire, auto mode',
3903 25: 'Flash fired, auto mode',
3904 29: 'Flash fired, auto mode, return light not detected',
3905 31: 'Flash fired, auto mode, return light detected',
3906 32: 'No flash function',
3907 65: 'Flash fired, red-eye reduction mode',
3908 69: 'Flash fired, red-eye reduction mode, return light not detected',
3909 71: 'Flash fired, red-eye reduction mode, return light detected',
3910 73: 'Flash fired, compulsory flash mode, red-eye reduction mode',
3911 77: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',
3912 79: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',
3913 89: 'Flash fired, auto mode, red-eye reduction mode',
3914 93: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',
3915 95: 'Flash fired, auto mode, return light detected, red-eye reduction mode'
3916 },
3917 ExposureMode: {
3918 0: 'Auto exposure',
3919 1: 'Manual exposure',
3920 2: 'Auto bracket'
3921 },
3922 WhiteBalance: {
3923 0: 'Auto white balance',
3924 1: 'Manual white balance'
3925 },
3926 SceneCaptureType: {
3927 0: 'Standard',
3928 1: 'Landscape',
3929 2: 'Portrait',
3930 3: 'Night scene'
3931 },
3932 Contrast: {
3933 0: 'Normal',
3934 1: 'Soft',
3935 2: 'Hard'
3936 },
3937 Saturation: {
3938 0: 'Normal',
3939 1: 'Low saturation',
3940 2: 'High saturation'
3941 },
3942 Sharpness: {
3943 0: 'Normal',
3944 1: 'Soft',
3945 2: 'Hard'
3946 },
3947 GPSLatitudeRef: {
3948 N: 'North latitude',
3949 S: 'South latitude'
3950 },
3951 GPSLongitudeRef: {
3952 E: 'East longitude',
3953 W: 'West longitude'
3954 }
3955 }, d = {
3956 tiffHeader: 10
3957 }, m = d.tiffHeader, u = {
3958 clear: this.clear
3959 }, e.extend(this, {
3960 read: function () {
3961 try {
3962 return r.prototype.read.apply(this, arguments)
3963 } catch (e) {
3964 throw new n.ImageError(n.ImageError.INVALID_META_ERR)
3965 }
3966 },
3967 write: function () {
3968 try {
3969 return r.prototype.write.apply(this, arguments)
3970 } catch (e) {
3971 throw new n.ImageError(n.ImageError.INVALID_META_ERR)
3972 }
3973 },
3974 UNDEFINED: function () {
3975 return this.BYTE.apply(this, arguments)
3976 },
3977 RATIONAL: function (e) {
3978 return this.LONG(e) / this.LONG(e + 4)
3979 },
3980 SRATIONAL: function (e) {
3981 return this.SLONG(e) / this.SLONG(e + 4)
3982 },
3983 ASCII: function (e) {
3984 return this.CHAR(e)
3985 },
3986 TIFF: function () {
3987 return h || null
3988 },
3989 EXIF: function () {
3990 var t = null;
3991 if (d.exifIFD) {
3992 try {
3993 t = a.call(this, d.exifIFD, c.exif)
3994 } catch (i) {
3995 return null
3996 }
3997 if (t.ExifVersion && 'array' === e.typeOf(t.ExifVersion)) {
3998 for (var n = 0, r = ''; n < t.ExifVersion.length; n++) r += String.fromCharCode(t.ExifVersion[n]);
3999 t.ExifVersion = r
4000 }
4001 }
4002 return t
4003 },
4004 GPS: function () {
4005 var t = null;
4006 if (d.gpsIFD) {
4007 try {
4008 t = a.call(this, d.gpsIFD, c.gps)
4009 } catch (i) {
4010 return null
4011 }
4012 t.GPSVersionID && 'array' === e.typeOf(t.GPSVersionID) && (t.GPSVersionID = t.GPSVersionID.join('.'))
4013 }
4014 return t
4015 },
4016 thumb: function () {
4017 if (d.IFD1) try {
4018 var e = a.call(this, d.IFD1, c.thumb);
4019 if ('JPEGInterchangeFormat' in e) return this.SEGMENT(d.tiffHeader + e.JPEGInterchangeFormat, e.JPEGInterchangeFormatLength)
4020 } catch (t) {
4021 }
4022 return null
4023 },
4024 setExif: function (e, t) {
4025 return 'PixelXDimension' !== e && 'PixelYDimension' !== e ? !1 : s.call(this, 'exif', e, t)
4026 },
4027 clear: function () {
4028 u.clear(),
4029 o = c = l = h = d = u = null
4030 }
4031 }), 65505 !== this.SHORT(0) || 'EXIF\0' !== this.STRING(4, 5).toUpperCase()) throw new n.ImageError(n.ImageError.INVALID_META_ERR);
4032 if (this.littleEndian = 18761 == this.SHORT(m), 42 !== this.SHORT(m += 2)) throw new n.ImageError(n.ImageError.INVALID_META_ERR);
4033 d.IFD0 = d.tiffHeader + this.LONG(m += 2),
4034 h = a.call(this, d.IFD0, c.tiff),
4035 'ExifIFDPointer' in h && (d.exifIFD = d.tiffHeader + h.ExifIFDPointer, delete h.ExifIFDPointer),
4036 'GPSInfoIFDPointer' in h && (d.gpsIFD = d.tiffHeader + h.GPSInfoIFDPointer, delete h.GPSInfoIFDPointer),
4037 e.isEmptyObj(h) && (h = null);
4038 var f = this.LONG(d.IFD0 + 12 * this.SHORT(d.IFD0) + 2);
4039 f && (d.IFD1 = d.tiffHeader + f)
4040 }
4041 return r.prototype = i.prototype,
4042 r
4043 }),
4044 n('moxie/runtime/html5/image/JPEG', [
4045 'moxie/core/utils/Basic',
4046 'moxie/core/Exceptions',
4047 'moxie/runtime/html5/image/JPEGHeaders',
4048 'moxie/runtime/html5/utils/BinaryReader',
4049 'moxie/runtime/html5/image/ExifParser'
4050 ], function (e, t, i, n, r) {
4051 function o(o) {
4052 function a(e) {
4053 var t,
4054 i,
4055 n = 0;
4056 for (e || (e = c); n <= e.length(); ) {
4057 if (t = e.SHORT(n += 2), t >= 65472 && 65475 >= t) return n += 5,
4058 {
4059 height: e.SHORT(n),
4060 width: e.SHORT(n += 2)
4061 };
4062 i = e.SHORT(n += 2),
4063 n += i - 2
4064 }
4065 return null
4066 }
4067 function s() {
4068 var e,
4069 t,
4070 i = d.thumb();
4071 return i && (e = new n(i), t = a(e), e.clear(), t) ? (t.data = i, t) : null
4072 }
4073 function u() {
4074 d && l && c && (d.clear(), l.purge(), c.clear(), m = l = d = c = null)
4075 }
4076 var c,
4077 l,
4078 d,
4079 m;
4080 if (c = new n(o), 65496 !== c.SHORT(0)) throw new t.ImageError(t.ImageError.WRONG_FORMAT);
4081 l = new i(o);
4082 try {
4083 d = new r(l.get('app1') [0])
4084 } catch (h) {
4085 }
4086 m = a.call(this),
4087 e.extend(this, {
4088 type: 'image/jpeg',
4089 size: c.length(),
4090 width: m && m.width || 0,
4091 height: m && m.height || 0,
4092 setExif: function (t, i) {
4093 return d ? ('object' === e.typeOf(t) ? e.each(t, function (e, t) {
4094 d.setExif(t, e)
4095 }) : d.setExif(t, i), l.set('app1', d.SEGMENT()), void 0) : !1
4096 },
4097 writeHeaders: function () {
4098 return arguments.length ? l.restore(arguments[0]) : l.restore(o)
4099 },
4100 stripHeaders: function (e) {
4101 return l.strip(e)
4102 },
4103 purge: function () {
4104 u.call(this)
4105 }
4106 }),
4107 d && (this.meta = {
4108 tiff: d.TIFF(),
4109 exif: d.EXIF(),
4110 gps: d.GPS(),
4111 thumb: s()
4112 })
4113 }
4114 return o
4115 }),
4116 n('moxie/runtime/html5/image/PNG', [
4117 'moxie/core/Exceptions',
4118 'moxie/core/utils/Basic',
4119 'moxie/runtime/html5/utils/BinaryReader'
4120 ], function (e, t, i) {
4121 function n(n) {
4122 function r() {
4123 var e,
4124 t;
4125 return e = a.call(this, 8),
4126 'IHDR' == e.type ? (t = e.start, {
4127 width: s.LONG(t),
4128 height: s.LONG(t += 4)
4129 }) : null
4130 }
4131 function o() {
4132 s && (s.clear(), n = l = u = c = s = null)
4133 }
4134 function a(e) {
4135 var t,
4136 i,
4137 n,
4138 r;
4139 return t = s.LONG(e),
4140 i = s.STRING(e += 4, 4),
4141 n = e += 4,
4142 r = s.LONG(e + t),
4143 {
4144 length: t,
4145 type: i,
4146 start: n,
4147 CRC: r
4148 }
4149 }
4150 var s,
4151 u,
4152 c,
4153 l;
4154 s = new i(n),
4155 function () {
4156 var t = 0,
4157 i = 0,
4158 n = [
4159 35152,
4160 20039,
4161 3338,
4162 6666
4163 ];
4164 for (i = 0; i < n.length; i++, t += 2) if (n[i] != s.SHORT(t)) throw new e.ImageError(e.ImageError.WRONG_FORMAT)
4165 }(),
4166 l = r.call(this),
4167 t.extend(this, {
4168 type: 'image/png',
4169 size: s.length(),
4170 width: l.width,
4171 height: l.height,
4172 purge: function () {
4173 o.call(this)
4174 }
4175 }),
4176 o.call(this)
4177 }
4178 return n
4179 }),
4180 n('moxie/runtime/html5/image/ImageInfo', [
4181 'moxie/core/utils/Basic',
4182 'moxie/core/Exceptions',
4183 'moxie/runtime/html5/image/JPEG',
4184 'moxie/runtime/html5/image/PNG'
4185 ], function (e, t, i, n) {
4186 return function (r) {
4187 var o,
4188 a = [
4189 i,
4190 n
4191 ];
4192 o = function () {
4193 for (var e = 0; e < a.length; e++) try {
4194 return new a[e](r)
4195 } catch (i) {
4196 }
4197 throw new t.ImageError(t.ImageError.WRONG_FORMAT)
4198 }(),
4199 e.extend(this, {
4200 type: '',
4201 size: 0,
4202 width: 0,
4203 height: 0,
4204 setExif: function () {
4205 },
4206 writeHeaders: function (e) {
4207 return e
4208 },
4209 stripHeaders: function (e) {
4210 return e
4211 },
4212 purge: function () {
4213 r = null
4214 }
4215 }),
4216 e.extend(this, o),
4217 this.purge = function () {
4218 o.purge(),
4219 o = null
4220 }
4221 }
4222 }),
4223 n('moxie/runtime/html5/image/ResizerCanvas', [
4224 ], function () {
4225 function e(i, n) {
4226 var r = i.width,
4227 o = Math.floor(r * n),
4228 a = !1;
4229 (0.5 > n || n > 2) && (n = 0.5 > n ? 0.5 : 2, a = !0);
4230 var s = t(i, n);
4231 return a ? e(s, o / s.width) : s
4232 }
4233 function t(e, t) {
4234 var i = e.width,
4235 n = e.height,
4236 r = Math.floor(i * t),
4237 o = Math.floor(n * t),
4238 a = document.createElement('canvas');
4239 return a.width = r,
4240 a.height = o,
4241 a.getContext('2d').drawImage(e, 0, 0, i, n, 0, 0, r, o),
4242 e = null,
4243 a
4244 }
4245 return {
4246 scale: e
4247 }
4248 }),
4249 n('moxie/runtime/html5/image/Image', [
4250 'moxie/runtime/html5/Runtime',
4251 'moxie/core/utils/Basic',
4252 'moxie/core/Exceptions',
4253 'moxie/core/utils/Encode',
4254 'moxie/file/Blob',
4255 'moxie/file/File',
4256 'moxie/runtime/html5/image/ImageInfo',
4257 'moxie/runtime/html5/image/ResizerCanvas',
4258 'moxie/core/utils/Mime',
4259 'moxie/core/utils/Env'
4260 ], function (e, t, i, n, r, o, a, s, u) {
4261 function c() {
4262 function e() {
4263 if (!v && !g) throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);
4264 return v || g
4265 }
4266 function c() {
4267 var t = e();
4268 return 'canvas' == t.nodeName.toLowerCase() ? t : (v = document.createElement('canvas'), v.width = t.width, v.height = t.height, v.getContext('2d').drawImage(t, 0, 0), v)
4269 }
4270 function l(e) {
4271 return n.atob(e.substring(e.indexOf('base64,') + 7))
4272 }
4273 function d(e, t) {
4274 return 'data:' + (t || '') + ';base64,' + n.btoa(e)
4275 }
4276 function m(e) {
4277 var t = this;
4278 g = new Image,
4279 g.onerror = function () {
4280 p.call(this),
4281 t.trigger('error', i.ImageError.WRONG_FORMAT)
4282 },
4283 g.onload = function () {
4284 t.trigger('load')
4285 },
4286 g.src = 'data:' == e.substr(0, 5) ? e : d(e, y.type)
4287 }
4288 function h(e, t) {
4289 var n,
4290 r = this;
4291 return window.FileReader ? (n = new FileReader, n.onload = function () {
4292 t.call(r, this.result)
4293 }, n.onerror = function () {
4294 r.trigger('error', i.ImageError.WRONG_FORMAT)
4295 }, n.readAsDataURL(e), void 0) : t.call(this, e.getAsDataURL())
4296 }
4297 function f(e, i) {
4298 var n = Math.PI / 180,
4299 r = document.createElement('canvas'),
4300 o = r.getContext('2d'),
4301 a = e.width,
4302 s = e.height;
4303 switch (t.inArray(i, [
4304 5,
4305 6,
4306 7,
4307 8
4308 ]) > - 1 ? (r.width = s, r.height = a) : (r.width = a, r.height = s), i) {
4309 case 2:
4310 o.translate(a, 0),
4311 o.scale( - 1, 1);
4312 break;
4313 case 3:
4314 o.translate(a, s),
4315 o.rotate(180 * n);
4316 break;
4317 case 4:
4318 o.translate(0, s),
4319 o.scale(1, - 1);
4320 break;
4321 case 5:
4322 o.rotate(90 * n),
4323 o.scale(1, - 1);
4324 break;
4325 case 6:
4326 o.rotate(90 * n),
4327 o.translate(0, - s);
4328 break;
4329 case 7:
4330 o.rotate(90 * n),
4331 o.translate(a, - s),
4332 o.scale( - 1, 1);
4333 break;
4334 case 8:
4335 o.rotate( - 90 * n),
4336 o.translate( - a, 0)
4337 }
4338 return o.drawImage(e, 0, 0, a, s),
4339 r
4340 }
4341 function p() {
4342 x && (x.purge(), x = null),
4343 w = g = v = y = null,
4344 b = !1
4345 }
4346 var g,
4347 x,
4348 v,
4349 w,
4350 y,
4351 E = this,
4352 b = !1,
4353 R = !0;
4354 t.extend(this, {
4355 loadFromBlob: function (e) {
4356 var t = this.getRuntime(),
4357 n = arguments.length > 1 ? arguments[1] : !0;
4358 if (!t.can('access_binary')) throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);
4359 return y = e,
4360 e.isDetached() ? (w = e.getSource(), m.call(this, w), void 0) : (h.call(this, e.getSource(), function (e) {
4361 n && (w = l(e)),
4362 m.call(this, e)
4363 }), void 0)
4364 },
4365 loadFromImage: function (e, t) {
4366 this.meta = e.meta,
4367 y = new o(null, {
4368 name: e.name,
4369 size: e.size,
4370 type: e.type
4371 }),
4372 m.call(this, t ? w = e.getAsBinaryString() : e.getAsDataURL())
4373 },
4374 getInfo: function () {
4375 var t,
4376 i = this.getRuntime();
4377 return !x && w && i.can('access_image_binary') && (x = new a(w)),
4378 t = {
4379 width: e().width || 0,
4380 height: e().height || 0,
4381 type: y.type || u.getFileMime(y.name),
4382 size: w && w.length || y.size || 0,
4383 name: y.name || '',
4384 meta: null
4385 },
4386 R && (t.meta = x && x.meta || this.meta || {
4387 }, !t.meta || !t.meta.thumb || t.meta.thumb.data instanceof r || (t.meta.thumb.data = new r(null, {
4388 type: 'image/jpeg',
4389 data: t.meta.thumb.data
4390 }))),
4391 t
4392 },
4393 resize: function (t, i, n) {
4394 var r = document.createElement('canvas');
4395 if (r.width = t.width, r.height = t.height, r.getContext('2d').drawImage(e(), t.x, t.y, t.width, t.height, 0, 0, r.width, r.height), v = s.scale(r, i), R = n.preserveHeaders, !R) {
4396 var o = this.meta && this.meta.tiff && this.meta.tiff.Orientation || 1;
4397 v = f(v, o)
4398 }
4399 this.width = v.width,
4400 this.height = v.height,
4401 b = !0,
4402 this.trigger('Resize')
4403 },
4404 getAsCanvas: function () {
4405 return v || (v = c()),
4406 v.id = this.uid + '_canvas',
4407 v
4408 },
4409 getAsBlob: function (e, t) {
4410 return e !== this.type ? (b = !0, new o(null, {
4411 name: y.name || '',
4412 type: e,
4413 data: E.getAsDataURL(e, t)
4414 })) : new o(null, {
4415 name: y.name || '',
4416 type: e,
4417 data: E.getAsBinaryString(e, t)
4418 })
4419 },
4420 getAsDataURL: function (e) {
4421 var t = arguments[1] || 90;
4422 if (!b) return g.src;
4423 if (c(), 'image/jpeg' !== e) return v.toDataURL('image/png');
4424 try {
4425 return v.toDataURL('image/jpeg', t / 100)
4426 } catch (i) {
4427 return v.toDataURL('image/jpeg')
4428 }
4429 },
4430 getAsBinaryString: function (e, t) {
4431 if (!b) return w || (w = l(E.getAsDataURL(e, t))),
4432 w;
4433 if ('image/jpeg' !== e) w = l(E.getAsDataURL(e, t));
4434 else {
4435 var i;
4436 t || (t = 90),
4437 c();
4438 try {
4439 i = v.toDataURL('image/jpeg', t / 100)
4440 } catch (n) {
4441 i = v.toDataURL('image/jpeg')
4442 }
4443 w = l(i),
4444 x && (w = x.stripHeaders(w), R && (x.meta && x.meta.exif && x.setExif({
4445 PixelXDimension: this.width,
4446 PixelYDimension: this.height
4447 }), w = x.writeHeaders(w)), x.purge(), x = null)
4448 }
4449 return b = !1,
4450 w
4451 },
4452 destroy: function () {
4453 E = null,
4454 p.call(this),
4455 this.getRuntime().getShim().removeInstance(this.uid)
4456 }
4457 })
4458 }
4459 return e.Image = c
4460 }), n('moxie/runtime/flash/Runtime', [
4461 'moxie/core/utils/Basic',
4462 'moxie/core/utils/Env',
4463 'moxie/core/utils/Dom',
4464 'moxie/core/Exceptions',
4465 'moxie/runtime/Runtime'
4466 ], function (e, t, i, n, o) {
4467 function a() {
4468 var e;
4469 try {
4470 e = navigator.plugins['Shockwave Flash'],
4471 e = e.description
4472 } catch (t) {
4473 try {
4474 e = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version')
4475 } catch (i) {
4476 e = '0.0'
4477 }
4478 }
4479 return e = e.match(/\d+/g),
4480 parseFloat(e[0] + '.' + e[1])
4481 }
4482 function s(e) {
4483 var n = i.get(e);
4484 n && 'OBJECT' == n.nodeName && ('IE' === t.browser ? (n.style.display = 'none', function r() {
4485 4 == n.readyState ? u(e) : setTimeout(r, 10)
4486 }()) : n.parentNode.removeChild(n))
4487 }
4488 function u(e) {
4489 var t = i.get(e);
4490 if (t) {
4491 for (var n in t) 'function' == typeof t[n] && (t[n] = null);
4492 t.parentNode.removeChild(t)
4493 }
4494 }
4495 function c(u) {
4496 var c,
4497 m = this;
4498 u = e.extend({
4499 swf_url: t.swf_url
4500 }, u),
4501 o.call(this, u, l, {
4502 access_binary: function (e) {
4503 return e && 'browser' === m.mode
4504 },
4505 access_image_binary: function (e) {
4506 return e && 'browser' === m.mode
4507 },
4508 display_media: o.capTest(r('moxie/image/Image')),
4509 do_cors: o.capTrue,
4510 drag_and_drop: !1,
4511 report_upload_progress: function () {
4512 return 'client' === m.mode
4513 },
4514 resize_image: o.capTrue,
4515 return_response_headers: !1,
4516 return_response_type: function (t) {
4517 return 'json' === t && window.JSON ? !0 : !e.arrayDiff(t, [
4518 '',
4519 'text',
4520 'document'
4521 ]) || 'browser' === m.mode
4522 },
4523 return_status_code: function (t) {
4524 return 'browser' === m.mode || !e.arrayDiff(t, [
4525 200,
4526 404
4527 ])
4528 },
4529 select_file: o.capTrue,
4530 select_multiple: o.capTrue,
4531 send_binary_string: function (e) {
4532 return e && 'browser' === m.mode
4533 },
4534 send_browser_cookies: function (e) {
4535 return e && 'browser' === m.mode
4536 },
4537 send_custom_headers: function (e) {
4538 return e && 'browser' === m.mode
4539 },
4540 send_multipart: o.capTrue,
4541 slice_blob: function (e) {
4542 return e && 'browser' === m.mode
4543 },
4544 stream_upload: function (e) {
4545 return e && 'browser' === m.mode
4546 },
4547 summon_file_dialog: !1,
4548 upload_filesize: function (t) {
4549 return e.parseSizeStr(t) <= 2097152 || 'client' === m.mode
4550 },
4551 use_http_method: function (t) {
4552 return !e.arrayDiff(t, [
4553 'GET',
4554 'POST'
4555 ])
4556 }
4557 }, {
4558 access_binary: function (e) {
4559 return e ? 'browser' : 'client'
4560 },
4561 access_image_binary: function (e) {
4562 return e ? 'browser' : 'client'
4563 },
4564 report_upload_progress: function (e) {
4565 return e ? 'browser' : 'client'
4566 },
4567 return_response_type: function (t) {
4568 return e.arrayDiff(t, [
4569 '',
4570 'text',
4571 'json',
4572 'document'
4573 ]) ? 'browser' : [
4574 'client',
4575 'browser'
4576 ]
4577 },
4578 return_status_code: function (t) {
4579 return e.arrayDiff(t, [
4580 200,
4581 404
4582 ]) ? 'browser' : [
4583 'client',
4584 'browser'
4585 ]
4586 },
4587 send_binary_string: function (e) {
4588 return e ? 'browser' : 'client'
4589 },
4590 send_browser_cookies: function (e) {
4591 return e ? 'browser' : 'client'
4592 },
4593 send_custom_headers: function (e) {
4594 return e ? 'browser' : 'client'
4595 },
4596 slice_blob: function (e) {
4597 return e ? 'browser' : 'client'
4598 },
4599 stream_upload: function (e) {
4600 return e ? 'client' : 'browser'
4601 },
4602 upload_filesize: function (t) {
4603 return e.parseSizeStr(t) >= 2097152 ? 'client' : 'browser'
4604 }
4605 }, 'client'),
4606 a() < 11.3 && (this.mode = !1),
4607 e.extend(this, {
4608 getShim: function () {
4609 return i.get(this.uid)
4610 },
4611 shimExec: function (e, t) {
4612 var i = [
4613 ].slice.call(arguments, 2);
4614 return m.getShim().exec(this.uid, e, t, i)
4615 },
4616 init: function () {
4617 var i,
4618 r,
4619 o;
4620 o = this.getShimContainer(),
4621 e.extend(o.style, {
4622 position: 'absolute',
4623 top: '-8px',
4624 left: '-8px',
4625 width: '9px',
4626 height: '9px',
4627 overflow: 'hidden'
4628 }),
4629 i = '<object id="' + this.uid + '" type="application/x-shockwave-flash" data="' + u.swf_url + '" ',
4630 'IE' === t.browser && (i += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),
4631 i += 'width="100%" height="100%" style="outline:0"><param name="movie" value="' + u.swf_url + '" />' + '<param name="flashvars" value="uid=' + escape(this.uid) + '&target=' + t.global_event_dispatcher + '" />' + '<param name="wmode" value="transparent" />' + '<param name="allowscriptaccess" value="always" />' + '</object>',
4632 'IE' === t.browser ? (r = document.createElement('div'), o.appendChild(r), r.outerHTML = i, r = o = null) : o.innerHTML = i,
4633 c = setTimeout(function () {
4634 m && !m.initialized && m.trigger('Error', new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))
4635 }, 5000)
4636 },
4637 destroy: function (e) {
4638 return function () {
4639 s(m.uid),
4640 e.call(m),
4641 clearTimeout(c),
4642 u = c = e = m = null
4643 }
4644 }(this.destroy)
4645 }, d)
4646 }
4647 var l = 'flash',
4648 d = {
4649 };
4650 return o.addConstructor(l, c),
4651 d
4652 }), n('moxie/runtime/flash/file/Blob', [
4653 'moxie/runtime/flash/Runtime',
4654 'moxie/file/Blob'
4655 ], function (e, t) {
4656 var i = {
4657 slice: function (e, i, n, r) {
4658 var o = this.getRuntime();
4659 return 0 > i ? i = Math.max(e.size + i, 0) : i > 0 && (i = Math.min(i, e.size)),
4660 0 > n ? n = Math.max(e.size + n, 0) : n > 0 && (n = Math.min(n, e.size)),
4661 e = o.shimExec.call(this, 'Blob', 'slice', i, n, r || ''),
4662 e && (e = new t(o.uid, e)),
4663 e
4664 }
4665 };
4666 return e.Blob = i
4667 }), n('moxie/runtime/flash/file/FileInput', [
4668 'moxie/runtime/flash/Runtime',
4669 'moxie/file/File',
4670 'moxie/core/utils/Basic'
4671 ], function (e, t, i) {
4672 var n = {
4673 init: function (e) {
4674 var n = this,
4675 r = this.getRuntime();
4676 this.bind('Change', function () {
4677 var e = r.shimExec.call(n, 'FileInput', 'getFiles');
4678 n.files = [
4679 ],
4680 i.each(e, function (e) {
4681 n.files.push(new t(r.uid, e))
4682 })
4683 }, 999),
4684 this.getRuntime().shimExec.call(this, 'FileInput', 'init', {
4685 accept: e.accept,
4686 multiple: e.multiple
4687 }),
4688 this.trigger('ready')
4689 }
4690 };
4691 return e.FileInput = n
4692 }), n('moxie/runtime/flash/file/FileReader', [
4693 'moxie/runtime/flash/Runtime',
4694 'moxie/core/utils/Encode'
4695 ], function (e, t) {
4696 function i(e, i) {
4697 switch (i) {
4698 case 'readAsText':
4699 return t.atob(e, 'utf8');
4700 case 'readAsBinaryString':
4701 return t.atob(e);
4702 case 'readAsDataURL':
4703 return e
4704 }
4705 return null
4706 }
4707 var n = {
4708 read: function (e, t) {
4709 var n = this;
4710 return n.result = '',
4711 'readAsDataURL' === e && (n.result = 'data:' + (t.type || '') + ';base64,'),
4712 n.bind('Progress', function (t, r) {
4713 r && (n.result += i(r, e))
4714 }, 999),
4715 n.getRuntime().shimExec.call(this, 'FileReader', 'readAsBase64', t.uid)
4716 }
4717 };
4718 return e.FileReader = n
4719 }), n('moxie/runtime/flash/file/FileReaderSync', [
4720 'moxie/runtime/flash/Runtime',
4721 'moxie/core/utils/Encode'
4722 ], function (e, t) {
4723 function i(e, i) {
4724 switch (i) {
4725 case 'readAsText':
4726 return t.atob(e, 'utf8');
4727 case 'readAsBinaryString':
4728 return t.atob(e);
4729 case 'readAsDataURL':
4730 return e
4731 }
4732 return null
4733 }
4734 var n = {
4735 read: function (e, t) {
4736 var n,
4737 r = this.getRuntime();
4738 return (n = r.shimExec.call(this, 'FileReaderSync', 'readAsBase64', t.uid)) ? ('readAsDataURL' === e && (n = 'data:' + (t.type || '') + ';base64,' + n), i(n, e, t.type)) : null
4739 }
4740 };
4741 return e.FileReaderSync = n
4742 }), n('moxie/runtime/flash/runtime/Transporter', [
4743 'moxie/runtime/flash/Runtime',
4744 'moxie/file/Blob'
4745 ], function (e, t) {
4746 var i = {
4747 getAsBlob: function (e) {
4748 var i = this.getRuntime(),
4749 n = i.shimExec.call(this, 'Transporter', 'getAsBlob', e);
4750 return n ? new t(i.uid, n) : null
4751 }
4752 };
4753 return e.Transporter = i
4754 }), n('moxie/runtime/flash/xhr/XMLHttpRequest', [
4755 'moxie/runtime/flash/Runtime',
4756 'moxie/core/utils/Basic',
4757 'moxie/file/Blob',
4758 'moxie/file/File',
4759 'moxie/file/FileReaderSync',
4760 'moxie/runtime/flash/file/FileReaderSync',
4761 'moxie/xhr/FormData',
4762 'moxie/runtime/Transporter',
4763 'moxie/runtime/flash/runtime/Transporter'
4764 ], function (e, t, i, n, r, o, a, s) {
4765 var u = {
4766 send: function (e, n) {
4767 function r() {
4768 e.transport = l.mode,
4769 l.shimExec.call(c, 'XMLHttpRequest', 'send', e, n)
4770 }
4771 function o(e, t) {
4772 l.shimExec.call(c, 'XMLHttpRequest', 'appendBlob', e, t.uid),
4773 n = null,
4774 r()
4775 }
4776 function u(e, t) {
4777 var i = new s;
4778 i.bind('TransportingComplete', function () {
4779 t(this.result)
4780 }),
4781 i.transport(e.getSource(), e.type, {
4782 ruid: l.uid
4783 })
4784 }
4785 var c = this,
4786 l = c.getRuntime();
4787 if (t.isEmptyObj(e.headers) || t.each(e.headers, function (e, t) {
4788 l.shimExec.call(c, 'XMLHttpRequest', 'setRequestHeader', t, e.toString())
4789 }), n instanceof a) {
4790 var d;
4791 if (n.each(function (e, t) {
4792 e instanceof i ? d = t : l.shimExec.call(c, 'XMLHttpRequest', 'append', t, e)
4793 }), n.hasBlob()) {
4794 var m = n.getBlob();
4795 m.isDetached() ? u(m, function (e) {
4796 m.destroy(),
4797 o(d, e)
4798 }) : o(d, m)
4799 } else n = null,
4800 r()
4801 } else n instanceof i ? n.isDetached() ? u(n, function (e) {
4802 n.destroy(),
4803 n = e.uid,
4804 r()
4805 }) : (n = n.uid, r()) : r()
4806 },
4807 getResponse: function (e) {
4808 var i,
4809 o,
4810 a = this.getRuntime();
4811 if (o = a.shimExec.call(this, 'XMLHttpRequest', 'getResponseAsBlob')) {
4812 if (o = new n(a.uid, o), 'blob' === e) return o;
4813 try {
4814 if (i = new r, ~t.inArray(e, [
4815 '',
4816 'text'
4817 ])) return i.readAsText(o);
4818 if ('json' === e && window.JSON) return JSON.parse(i.readAsText(o))
4819 } finally {
4820 o.destroy()
4821 }
4822 }
4823 return null
4824 },
4825 abort: function () {
4826 var e = this.getRuntime();
4827 e.shimExec.call(this, 'XMLHttpRequest', 'abort'),
4828 this.dispatchEvent('readystatechange'),
4829 this.dispatchEvent('abort')
4830 }
4831 };
4832 return e.XMLHttpRequest = u
4833 }), n('moxie/runtime/flash/image/Image', [
4834 'moxie/runtime/flash/Runtime',
4835 'moxie/core/utils/Basic',
4836 'moxie/runtime/Transporter',
4837 'moxie/file/Blob',
4838 'moxie/file/FileReaderSync'
4839 ], function (e, t, i, n, r) {
4840 var o = {
4841 loadFromBlob: function (e) {
4842 function t(e) {
4843 r.shimExec.call(n, 'Image', 'loadFromBlob', e.uid),
4844 n = r = null
4845 }
4846 var n = this,
4847 r = n.getRuntime();
4848 if (e.isDetached()) {
4849 var o = new i;
4850 o.bind('TransportingComplete', function () {
4851 t(o.result.getSource())
4852 }),
4853 o.transport(e.getSource(), e.type, {
4854 ruid: r.uid
4855 })
4856 } else t(e.getSource())
4857 },
4858 loadFromImage: function (e) {
4859 var t = this.getRuntime();
4860 return t.shimExec.call(this, 'Image', 'loadFromImage', e.uid)
4861 },
4862 getInfo: function () {
4863 var e = this.getRuntime(),
4864 t = e.shimExec.call(this, 'Image', 'getInfo');
4865 return t.meta && t.meta.thumb && t.meta.thumb.data && !(e.meta.thumb.data instanceof n) && (t.meta.thumb.data = new n(e.uid, t.meta.thumb.data)),
4866 t
4867 },
4868 getAsBlob: function (e, t) {
4869 var i = this.getRuntime(),
4870 r = i.shimExec.call(this, 'Image', 'getAsBlob', e, t);
4871 return r ? new n(i.uid, r) : null
4872 },
4873 getAsDataURL: function () {
4874 var e,
4875 t = this.getRuntime(),
4876 i = t.Image.getAsBlob.apply(this, arguments);
4877 return i ? (e = new r, e.readAsDataURL(i)) : null
4878 }
4879 };
4880 return e.Image = o
4881 }), n('moxie/runtime/silverlight/Runtime', [
4882 'moxie/core/utils/Basic',
4883 'moxie/core/utils/Env',
4884 'moxie/core/utils/Dom',
4885 'moxie/core/Exceptions',
4886 'moxie/runtime/Runtime'
4887 ], function (e, t, i, n, o) {
4888 function a(e) {
4889 var t,
4890 i,
4891 n,
4892 r,
4893 o,
4894 a = !1,
4895 s = null,
4896 u = 0;
4897 try {
4898 try {
4899 s = new ActiveXObject('AgControl.AgControl'),
4900 s.IsVersionSupported(e) && (a = !0),
4901 s = null
4902 } catch (c) {
4903 var l = navigator.plugins['Silverlight Plug-In'];
4904 if (l) {
4905 for (t = l.description, '1.0.30226.2' === t && (t = '2.0.30226.2'), i = t.split('.'); i.length > 3; ) i.pop();
4906 for (; i.length < 4; ) i.push(0);
4907 for (n = e.split('.'); n.length > 4; ) n.pop();
4908 do r = parseInt(n[u], 10),
4909 o = parseInt(i[u], 10),
4910 u++;
4911 while (u < n.length && r === o);
4912 o >= r && !isNaN(r) && (a = !0)
4913 }
4914 }
4915 } catch (d) {
4916 a = !1
4917 }
4918 return a
4919 }
4920 function s(s) {
4921 var l,
4922 d = this;
4923 s = e.extend({
4924 xap_url: t.xap_url
4925 }, s),
4926 o.call(this, s, u, {
4927 access_binary: o.capTrue,
4928 access_image_binary: o.capTrue,
4929 display_media: o.capTest(r('moxie/image/Image')),
4930 do_cors: o.capTrue,
4931 drag_and_drop: !1,
4932 report_upload_progress: o.capTrue,
4933 resize_image: o.capTrue,
4934 return_response_headers: function (e) {
4935 return e && 'client' === d.mode
4936 },
4937 return_response_type: function (e) {
4938 return 'json' !== e ? !0 : !!window.JSON
4939 },
4940 return_status_code: function (t) {
4941 return 'client' === d.mode || !e.arrayDiff(t, [
4942 200,
4943 404
4944 ])
4945 },
4946 select_file: o.capTrue,
4947 select_multiple: o.capTrue,
4948 send_binary_string: o.capTrue,
4949 send_browser_cookies: function (e) {
4950 return e && 'browser' === d.mode
4951 },
4952 send_custom_headers: function (e) {
4953 return e && 'client' === d.mode
4954 },
4955 send_multipart: o.capTrue,
4956 slice_blob: o.capTrue,
4957 stream_upload: !0,
4958 summon_file_dialog: !1,
4959 upload_filesize: o.capTrue,
4960 use_http_method: function (t) {
4961 return 'client' === d.mode || !e.arrayDiff(t, [
4962 'GET',
4963 'POST'
4964 ])
4965 }
4966 }, {
4967 return_response_headers: function (e) {
4968 return e ? 'client' : 'browser'
4969 },
4970 return_status_code: function (t) {
4971 return e.arrayDiff(t, [
4972 200,
4973 404
4974 ]) ? 'client' : [
4975 'client',
4976 'browser'
4977 ]
4978 },
4979 send_browser_cookies: function (e) {
4980 return e ? 'browser' : 'client'
4981 },
4982 send_custom_headers: function (e) {
4983 return e ? 'client' : 'browser'
4984 },
4985 use_http_method: function (t) {
4986 return e.arrayDiff(t, [
4987 'GET',
4988 'POST'
4989 ]) ? 'client' : [
4990 'client',
4991 'browser'
4992 ]
4993 }
4994 }),
4995 a('2.0.31005.0') && 'Opera' !== t.browser || (this.mode = !1),
4996 e.extend(this, {
4997 getShim: function () {
4998 return i.get(this.uid).content.Moxie
4999 },
5000 shimExec: function (e, t) {
5001 var i = [
5002 ].slice.call(arguments, 2);
5003 return d.getShim().exec(this.uid, e, t, i)
5004 },
5005 init: function () {
5006 var e;
5007 e = this.getShimContainer(),
5008 e.innerHTML = '<object id="' + this.uid + '" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">' + '<param name="source" value="' + s.xap_url + '"/>' + '<param name="background" value="Transparent"/>' + '<param name="windowless" value="true"/>' + '<param name="enablehtmlaccess" value="true"/>' + '<param name="initParams" value="uid=' + this.uid + ',target=' + t.global_event_dispatcher + '"/>' + '</object>',
5009 l = setTimeout(function () {
5010 d && !d.initialized && d.trigger('Error', new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))
5011 }, 'Windows' !== t.OS ? 10000 : 5000)
5012 },
5013 destroy: function (e) {
5014 return function () {
5015 e.call(d),
5016 clearTimeout(l),
5017 s = l = e = d = null
5018 }
5019 }(this.destroy)
5020 }, c)
5021 }
5022 var u = 'silverlight',
5023 c = {
5024 };
5025 return o.addConstructor(u, s),
5026 c
5027 }), n('moxie/runtime/silverlight/file/Blob', [
5028 'moxie/runtime/silverlight/Runtime',
5029 'moxie/core/utils/Basic',
5030 'moxie/runtime/flash/file/Blob'
5031 ], function (e, t, i) {
5032 return e.Blob = t.extend({
5033 }, i)
5034 }), n('moxie/runtime/silverlight/file/FileInput', [
5035 'moxie/runtime/silverlight/Runtime',
5036 'moxie/file/File',
5037 'moxie/core/utils/Basic'
5038 ], function (e, t, i) {
5039 function n(e) {
5040 for (var t = '', i = 0; i < e.length; i++) t += ('' !== t ? '|' : '') + e[i].title + ' | *.' + e[i].extensions.replace(/,/g, ';*.');
5041 return t
5042 }
5043 var r = {
5044 init: function (e) {
5045 var r = this,
5046 o = this.getRuntime();
5047 this.bind('Change', function () {
5048 var e = o.shimExec.call(r, 'FileInput', 'getFiles');
5049 r.files = [
5050 ],
5051 i.each(e, function (e) {
5052 r.files.push(new t(o.uid, e))
5053 })
5054 }, 999),
5055 o.shimExec.call(this, 'FileInput', 'init', n(e.accept), e.multiple),
5056 this.trigger('ready')
5057 },
5058 setOption: function (e, t) {
5059 'accept' == e && (t = n(t)),
5060 this.getRuntime().shimExec.call(this, 'FileInput', 'setOption', e, t)
5061 }
5062 };
5063 return e.FileInput = r
5064 }), n('moxie/runtime/silverlight/file/FileDrop', [
5065 'moxie/runtime/silverlight/Runtime',
5066 'moxie/core/utils/Dom',
5067 'moxie/core/utils/Events'
5068 ], function (e, t, i) {
5069 var n = {
5070 init: function () {
5071 var e,
5072 n = this,
5073 r = n.getRuntime();
5074 return e = r.getShimContainer(),
5075 i.addEvent(e, 'dragover', function (e) {
5076 e.preventDefault(),
5077 e.stopPropagation(),
5078 e.dataTransfer.dropEffect = 'copy'
5079 }, n.uid),
5080 i.addEvent(e, 'dragenter', function (e) {
5081 e.preventDefault();
5082 var i = t.get(r.uid).dragEnter(e);
5083 i && e.stopPropagation()
5084 }, n.uid),
5085 i.addEvent(e, 'drop', function (e) {
5086 e.preventDefault();
5087 var i = t.get(r.uid).dragDrop(e);
5088 i && e.stopPropagation()
5089 }, n.uid),
5090 r.shimExec.call(this, 'FileDrop', 'init')
5091 }
5092 };
5093 return e.FileDrop = n
5094 }), n('moxie/runtime/silverlight/file/FileReader', [
5095 'moxie/runtime/silverlight/Runtime',
5096 'moxie/core/utils/Basic',
5097 'moxie/runtime/flash/file/FileReader'
5098 ], function (e, t, i) {
5099 return e.FileReader = t.extend({
5100 }, i)
5101 }), n('moxie/runtime/silverlight/file/FileReaderSync', [
5102 'moxie/runtime/silverlight/Runtime',
5103 'moxie/core/utils/Basic',
5104 'moxie/runtime/flash/file/FileReaderSync'
5105 ], function (e, t, i) {
5106 return e.FileReaderSync = t.extend({
5107 }, i)
5108 }), n('moxie/runtime/silverlight/runtime/Transporter', [
5109 'moxie/runtime/silverlight/Runtime',
5110 'moxie/core/utils/Basic',
5111 'moxie/runtime/flash/runtime/Transporter'
5112 ], function (e, t, i) {
5113 return e.Transporter = t.extend({
5114 }, i)
5115 }), n('moxie/runtime/silverlight/xhr/XMLHttpRequest', [
5116 'moxie/runtime/silverlight/Runtime',
5117 'moxie/core/utils/Basic',
5118 'moxie/runtime/flash/xhr/XMLHttpRequest',
5119 'moxie/runtime/silverlight/file/FileReaderSync',
5120 'moxie/runtime/silverlight/runtime/Transporter'
5121 ], function (e, t, i) {
5122 return e.XMLHttpRequest = t.extend({
5123 }, i)
5124 }), n('moxie/runtime/silverlight/image/Image', [
5125 'moxie/runtime/silverlight/Runtime',
5126 'moxie/core/utils/Basic',
5127 'moxie/file/Blob',
5128 'moxie/runtime/flash/image/Image'
5129 ], function (e, t, i, n) {
5130 return e.Image = t.extend({
5131 }, n, {
5132 getInfo: function () {
5133 var e = this.getRuntime(),
5134 n = [
5135 'tiff',
5136 'exif',
5137 'gps',
5138 'thumb'
5139 ],
5140 r = {
5141 meta: {
5142 }
5143 },
5144 o = e.shimExec.call(this, 'Image', 'getInfo');
5145 return o.meta && (t.each(n, function (e) {
5146 var t,
5147 i,
5148 n,
5149 a,
5150 s = o.meta[e];
5151 if (s && s.keys) for (r.meta[e] = {
5152 }, i = 0, n = s.keys.length; n > i; i++) t = s.keys[i],
5153 a = s[t],
5154 a && (/^(\d|[1-9]\d+)$/.test(a) ? a = parseInt(a, 10) : /^\d*\.\d+$/.test(a) && (a = parseFloat(a)), r.meta[e][t] = a)
5155 }), r.meta && r.meta.thumb && r.meta.thumb.data && !(e.meta.thumb.data instanceof i) && (r.meta.thumb.data = new i(e.uid, r.meta.thumb.data))),
5156 r.width = parseInt(o.width, 10),
5157 r.height = parseInt(o.height, 10),
5158 r.size = parseInt(o.size, 10),
5159 r.type = o.type,
5160 r.name = o.name,
5161 r
5162 },
5163 resize: function (e, t, i) {
5164 this.getRuntime().shimExec.call(this, 'Image', 'resize', e.x, e.y, e.width, e.height, t, i.preserveHeaders, i.resample)
5165 }
5166 })
5167 }), n('moxie/runtime/html4/Runtime', [
5168 'moxie/core/utils/Basic',
5169 'moxie/core/Exceptions',
5170 'moxie/runtime/Runtime',
5171 'moxie/core/utils/Env'
5172 ], function (e, t, i, n) {
5173 function o(t) {
5174 var o = this,
5175 u = i.capTest,
5176 c = i.capTrue;
5177 i.call(this, t, a, {
5178 access_binary: u(window.FileReader || window.File && File.getAsDataURL),
5179 access_image_binary: !1,
5180 display_media: u((n.can('create_canvas') || n.can('use_data_uri_over32kb')) && r('moxie/image/Image')),
5181 do_cors: !1,
5182 drag_and_drop: !1,
5183 filter_by_extension: u(function () {
5184 return !('Chrome' === n.browser && n.verComp(n.version, 28, '<') || 'IE' === n.browser && n.verComp(n.version, 10, '<') || 'Safari' === n.browser && n.verComp(n.version, 7, '<') || 'Firefox' === n.browser && n.verComp(n.version, 37, '<'))
5185 }()),
5186 resize_image: function () {
5187 return s.Image && o.can('access_binary') && n.can('create_canvas')
5188 },
5189 report_upload_progress: !1,
5190 return_response_headers: !1,
5191 return_response_type: function (t) {
5192 return 'json' === t && window.JSON ? !0 : !!~e.inArray(t, [
5193 'text',
5194 'document',
5195 ''
5196 ])
5197 },
5198 return_status_code: function (t) {
5199 return !e.arrayDiff(t, [
5200 200,
5201 404
5202 ])
5203 },
5204 select_file: function () {
5205 return n.can('use_fileinput')
5206 },
5207 select_multiple: !1,
5208 send_binary_string: !1,
5209 send_custom_headers: !1,
5210 send_multipart: !0,
5211 slice_blob: !1,
5212 stream_upload: function () {
5213 return o.can('select_file')
5214 },
5215 summon_file_dialog: function () {
5216 return o.can('select_file') && ('Firefox' === n.browser && n.verComp(n.version, 4, '>=') || 'Opera' === n.browser && n.verComp(n.version, 12, '>=') || 'IE' === n.browser && n.verComp(n.version, 10, '>=') || !!~e.inArray(n.browser, [
5217 'Chrome',
5218 'Safari'
5219 ]))
5220 },
5221 upload_filesize: c,
5222 use_http_method: function (t) {
5223 return !e.arrayDiff(t, [
5224 'GET',
5225 'POST'
5226 ])
5227 }
5228 }),
5229 e.extend(this, {
5230 init: function () {
5231 this.trigger('Init')
5232 },
5233 destroy: function (e) {
5234 return function () {
5235 e.call(o),
5236 e = o = null
5237 }
5238 }(this.destroy)
5239 }),
5240 e.extend(this.getShim(), s)
5241 }
5242 var a = 'html4',
5243 s = {
5244 };
5245 return i.addConstructor(a, o),
5246 s
5247 }), n('moxie/runtime/html4/file/FileInput', [
5248 'moxie/runtime/html4/Runtime',
5249 'moxie/file/File',
5250 'moxie/core/utils/Basic',
5251 'moxie/core/utils/Dom',
5252 'moxie/core/utils/Events',
5253 'moxie/core/utils/Mime',
5254 'moxie/core/utils/Env'
5255 ], function (e, t, i, n, r, o, a) {
5256 function s() {
5257 function e() {
5258 var o,
5259 c,
5260 d,
5261 m,
5262 h,
5263 f,
5264 p = this,
5265 g = p.getRuntime();
5266 f = i.guid('uid_'),
5267 o = g.getShimContainer(),
5268 s && (d = n.get(s + '_form'), d && i.extend(d.style, {
5269 top: '100%'
5270 })),
5271 m = document.createElement('form'),
5272 m.setAttribute('id', f + '_form'),
5273 m.setAttribute('method', 'post'),
5274 m.setAttribute('enctype', 'multipart/form-data'),
5275 m.setAttribute('encoding', 'multipart/form-data'),
5276 i.extend(m.style, {
5277 overflow: 'hidden',
5278 position: 'absolute',
5279 top: 0,
5280 left: 0,
5281 width: '100%',
5282 height: '100%'
5283 }),
5284 h = document.createElement('input'),
5285 h.setAttribute('id', f),
5286 h.setAttribute('type', 'file'),
5287 h.setAttribute('accept', l.join(',')),
5288 i.extend(h.style, {
5289 fontSize: '999px',
5290 opacity: 0
5291 }),
5292 m.appendChild(h),
5293 o.appendChild(m),
5294 i.extend(h.style, {
5295 position: 'absolute',
5296 top: 0,
5297 left: 0,
5298 width: '100%',
5299 height: '100%'
5300 }),
5301 'IE' === a.browser && a.verComp(a.version, 10, '<') && i.extend(h.style, {
5302 filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'
5303 }),
5304 h.onchange = function () {
5305 var i;
5306 if (this.value) {
5307 if (this.files) {
5308 if (i = this.files[0], 0 === i.size) return m.parentNode.removeChild(m),
5309 void 0
5310 } else i = {
5311 name: this.value
5312 };
5313 i = new t(g.uid, i),
5314 this.onchange = function () {
5315 },
5316 e.call(p),
5317 p.files = [
5318 i
5319 ],
5320 h.setAttribute('id', i.uid),
5321 m.setAttribute('id', i.uid + '_form'),
5322 p.trigger('change'),
5323 h = m = null
5324 }
5325 },
5326 g.can('summon_file_dialog') && (c = n.get(u.browse_button), r.removeEvent(c, 'click', p.uid), r.addEvent(c, 'click', function (e) {
5327 h && !h.disabled && h.click(),
5328 e.preventDefault()
5329 }, p.uid)),
5330 s = f,
5331 o = d = c = null
5332 }
5333 var s,
5334 u,
5335 c,
5336 l = [
5337 ];
5338 i.extend(this, {
5339 init: function (t) {
5340 var i,
5341 a = this,
5342 s = a.getRuntime();
5343 u = t,
5344 l = t.accept.mimes || o.extList2mimes(t.accept, s.can('filter_by_extension')),
5345 i = s.getShimContainer(),
5346 function () {
5347 var e,
5348 o,
5349 l;
5350 e = n.get(t.browse_button),
5351 c = n.getStyle(e, 'z-index') || 'auto',
5352 s.can('summon_file_dialog') && ('static' === n.getStyle(e, 'position') && (e.style.position = 'relative'), a.bind('Refresh', function () {
5353 o = parseInt(c, 10) || 1,
5354 n.get(u.browse_button).style.zIndex = o,
5355 this.getRuntime().getShimContainer().style.zIndex = o - 1
5356 })),
5357 l = s.can('summon_file_dialog') ? e : i,
5358 r.addEvent(l, 'mouseover', function () {
5359 a.trigger('mouseenter')
5360 }, a.uid),
5361 r.addEvent(l, 'mouseout', function () {
5362 a.trigger('mouseleave')
5363 }, a.uid),
5364 r.addEvent(l, 'mousedown', function () {
5365 a.trigger('mousedown')
5366 }, a.uid),
5367 r.addEvent(n.get(t.container), 'mouseup', function () {
5368 a.trigger('mouseup')
5369 }, a.uid),
5370 e = null
5371 }(),
5372 e.call(this),
5373 i = null,
5374 a.trigger({
5375 type: 'ready',
5376 async: !0
5377 })
5378 },
5379 setOption: function (e, t) {
5380 var i,
5381 r = this.getRuntime();
5382 'accept' == e && (l = t.mimes || o.extList2mimes(t, r.can('filter_by_extension'))),
5383 i = n.get(s),
5384 i && i.setAttribute('accept', l.join(','))
5385 },
5386 disable: function (e) {
5387 var t;
5388 (t = n.get(s)) && (t.disabled = !!e)
5389 },
5390 destroy: function () {
5391 var e = this.getRuntime(),
5392 t = e.getShim(),
5393 i = e.getShimContainer(),
5394 o = u && n.get(u.container),
5395 a = u && n.get(u.browse_button);
5396 o && r.removeAllEvents(o, this.uid),
5397 a && (r.removeAllEvents(a, this.uid), a.style.zIndex = c),
5398 i && (r.removeAllEvents(i, this.uid), i.innerHTML = ''),
5399 t.removeInstance(this.uid),
5400 s = l = u = i = o = a = t = null
5401 }
5402 })
5403 }
5404 return e.FileInput = s
5405 }), n('moxie/runtime/html4/file/FileReader', [
5406 'moxie/runtime/html4/Runtime',
5407 'moxie/runtime/html5/file/FileReader'
5408 ], function (e, t) {
5409 return e.FileReader = t
5410 }), n('moxie/runtime/html4/xhr/XMLHttpRequest', [
5411 'moxie/runtime/html4/Runtime',
5412 'moxie/core/utils/Basic',
5413 'moxie/core/utils/Dom',
5414 'moxie/core/utils/Url',
5415 'moxie/core/Exceptions',
5416 'moxie/core/utils/Events',
5417 'moxie/file/Blob',
5418 'moxie/xhr/FormData'
5419 ], function (e, t, i, n, r, o, a, s) {
5420 function u() {
5421 function e(e) {
5422 var t,
5423 n,
5424 r,
5425 a,
5426 s = this,
5427 u = !1;
5428 if (l) {
5429 if (t = l.id.replace(/_iframe$/, ''), n = i.get(t + '_form')) {
5430 for (r = n.getElementsByTagName('input'), a = r.length; a--; ) switch (r[a].getAttribute('type')) {
5431 case 'hidden':
5432 r[a].parentNode.removeChild(r[a]);
5433 break;
5434 case 'file':
5435 u = !0
5436 }
5437 r = [
5438 ],
5439 u || n.parentNode.removeChild(n),
5440 n = null
5441 }
5442 setTimeout(function () {
5443 o.removeEvent(l, 'load', s.uid),
5444 l.parentNode && l.parentNode.removeChild(l);
5445 var t = s.getRuntime().getShimContainer();
5446 t.children.length || t.parentNode.removeChild(t),
5447 t = l = null,
5448 e()
5449 }, 1)
5450 }
5451 }
5452 var u,
5453 c,
5454 l;
5455 t.extend(this, {
5456 send: function (d, m) {
5457 function h() {
5458 var i = w.getShimContainer() || document.body,
5459 r = document.createElement('div');
5460 r.innerHTML = '<iframe id="' + f + '_iframe" name="' + f + '_iframe" src="javascript:""" style="display:none"></iframe>',
5461 l = r.firstChild,
5462 i.appendChild(l),
5463 o.addEvent(l, 'load', function () {
5464 var i;
5465 try {
5466 i = l.contentWindow.document || l.contentDocument || window.frames[l.id].document,
5467 /^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title) ? u = i.title.replace(/^(\d+).*$/, '$1') : (u = 200, c = t.trim(i.body.innerHTML), v.trigger({
5468 type: 'progress',
5469 loaded: c.length,
5470 total: c.length
5471 }), x && v.trigger({
5472 type: 'uploadprogress',
5473 loaded: x.size || 1025,
5474 total: x.size || 1025
5475 }))
5476 } catch (r) {
5477 if (!n.hasSameOrigin(d.url)) return e.call(v, function () {
5478 v.trigger('error')
5479 }),
5480 void 0;
5481 u = 404
5482 }
5483 e.call(v, function () {
5484 v.trigger('load')
5485 })
5486 }, v.uid)
5487 }
5488 var f,
5489 p,
5490 g,
5491 x,
5492 v = this,
5493 w = v.getRuntime();
5494 if (u = c = null, m instanceof s && m.hasBlob()) {
5495 if (x = m.getBlob(), f = x.uid, g = i.get(f), p = i.get(f + '_form'), !p) throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)
5496 } else f = t.guid('uid_'),
5497 p = document.createElement('form'),
5498 p.setAttribute('id', f + '_form'),
5499 p.setAttribute('method', d.method),
5500 p.setAttribute('enctype', 'multipart/form-data'),
5501 p.setAttribute('encoding', 'multipart/form-data'),
5502 w.getShimContainer().appendChild(p);
5503 p.setAttribute('target', f + '_iframe'),
5504 m instanceof s && m.each(function (e, i) {
5505 if (e instanceof a) g && g.setAttribute('name', i);
5506 else {
5507 var n = document.createElement('input');
5508 t.extend(n, {
5509 type: 'hidden',
5510 name: i,
5511 value: e
5512 }),
5513 g ? p.insertBefore(n, g) : p.appendChild(n)
5514 }
5515 }),
5516 p.setAttribute('action', d.url),
5517 h(),
5518 p.submit(),
5519 v.trigger('loadstart')
5520 },
5521 getStatus: function () {
5522 return u
5523 },
5524 getResponse: function (e) {
5525 if ('json' === e && 'string' === t.typeOf(c) && window.JSON) try {
5526 return JSON.parse(c.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, ''))
5527 } catch (i) {
5528 return null
5529 }
5530 return c
5531 },
5532 abort: function () {
5533 var t = this;
5534 l && l.contentWindow && (l.contentWindow.stop ? l.contentWindow.stop() : l.contentWindow.document.execCommand ? l.contentWindow.document.execCommand('Stop') : l.src = 'about:blank'),
5535 e.call(this, function () {
5536 t.dispatchEvent('abort')
5537 })
5538 }
5539 })
5540 }
5541 return e.XMLHttpRequest = u
5542 }), n('moxie/runtime/html4/image/Image', [
5543 'moxie/runtime/html4/Runtime',
5544 'moxie/runtime/html5/image/Image'
5545 ], function (e, t) {
5546 return e.Image = t
5547 }), a(['moxie/core/utils/Basic',
5548 'moxie/core/utils/Encode',
5549 'moxie/core/utils/Env',
5550 'moxie/core/Exceptions',
5551 'moxie/core/utils/Dom',
5552 'moxie/core/EventTarget',
5553 'moxie/runtime/Runtime',
5554 'moxie/runtime/RuntimeClient',
5555 'moxie/file/Blob',
5556 'moxie/core/I18n',
5557 'moxie/core/utils/Mime',
5558 'moxie/file/FileInput',
5559 'moxie/file/File',
5560 'moxie/file/FileDrop',
5561 'moxie/file/FileReader',
5562 'moxie/core/utils/Url',
5563 'moxie/runtime/RuntimeTarget',
5564 'moxie/xhr/FormData',
5565 'moxie/xhr/XMLHttpRequest',
5566 'moxie/runtime/Transporter',
5567 'moxie/image/Image',
5568 'moxie/core/utils/Events',
5569 'moxie/runtime/html5/image/ResizerCanvas'])
5570}(this)
5571});/**
5572 * Plupload - multi-runtime File Uploader
5573 * v2.3.1
5574 *
5575 * Copyright 2013, Moxiecode Systems AB
5576 * Released under GPL License.
5577 *
5578 * License: http://www.plupload.com/license
5579 * Contributing: http://www.plupload.com/contributing
5580 *
5581 * Date: 2017-02-06
5582 */
5583!function (e, t) {
5584var i = function () {
5585 var e = {
5586 };
5587 return t.apply(e, arguments),
5588 e.plupload
5589};
5590'function' == typeof define && define.amd ? define('plupload', [
5591 './moxie'
5592], i) : 'object' == typeof module && module.exports ? module.exports = i(require('./moxie')) : e.plupload = i(e.moxie)
5593}(this || window, function (e) {
5594!function (e, t, i) {
5595 function n(e) {
5596 function t(e, t, i) {
5597 var r = {
5598 chunks: 'slice_blob',
5599 jpgresize: 'send_binary_string',
5600 pngresize: 'send_binary_string',
5601 progress: 'report_upload_progress',
5602 multi_selection: 'select_multiple',
5603 dragdrop: 'drag_and_drop',
5604 drop_element: 'drag_and_drop',
5605 headers: 'send_custom_headers',
5606 urlstream_upload: 'send_binary_string',
5607 canSendBinary: 'send_binary',
5608 triggerDialog: 'summon_file_dialog'
5609 };
5610 r[e] ? n[r[e]] = t : i || (n[e] = t)
5611 }
5612 var i = e.required_features,
5613 n = {
5614 };
5615 return 'string' == typeof i ? l.each(i.split(/\s*,\s*/), function (e) {
5616 t(e, !0)
5617 }) : 'object' == typeof i ? l.each(i, function (e, i) {
5618 t(i, e)
5619 }) : i === !0 && (e.chunk_size && e.chunk_size > 0 && (n.slice_blob = !0), l.isEmptyObj(e.resize) && e.multipart !== !1 || (n.send_binary_string = !0), e.http_method && (n.use_http_method = e.http_method), l.each(e, function (e, i) {
5620 t(i, !!e, !0)
5621 })),
5622 n
5623 }
5624 var r = window.setTimeout,
5625 s = {
5626 },
5627 a = t.core.utils,
5628 o = t.runtime.Runtime,
5629 l = {
5630 VERSION: '2.3.1',
5631 STOPPED: 1,
5632 STARTED: 2,
5633 QUEUED: 1,
5634 UPLOADING: 2,
5635 FAILED: 4,
5636 DONE: 5,
5637 GENERIC_ERROR: - 100,
5638 HTTP_ERROR: - 200,
5639 IO_ERROR: - 300,
5640 SECURITY_ERROR: - 400,
5641 INIT_ERROR: - 500,
5642 FILE_SIZE_ERROR: - 600,
5643 FILE_EXTENSION_ERROR: - 601,
5644 FILE_DUPLICATE_ERROR: - 602,
5645 IMAGE_FORMAT_ERROR: - 700,
5646 MEMORY_ERROR: - 701,
5647 IMAGE_DIMENSIONS_ERROR: - 702,
5648 mimeTypes: a.Mime.mimes,
5649 ua: a.Env,
5650 typeOf: a.Basic.typeOf,
5651 extend: a.Basic.extend,
5652 guid: a.Basic.guid,
5653 getAll: function (e) {
5654 var t,
5655 i = [
5656 ];
5657 'array' !== l.typeOf(e) && (e = [
5658 e
5659 ]);
5660 for (var n = e.length; n--; ) t = l.get(e[n]),
5661 t && i.push(t);
5662 return i.length ? i : null
5663 },
5664 get: a.Dom.get,
5665 each: a.Basic.each,
5666 getPos: a.Dom.getPos,
5667 getSize: a.Dom.getSize,
5668 xmlEncode: function (e) {
5669 var t = {
5670 '<': 'lt',
5671 '>': 'gt',
5672 '&': 'amp',
5673 '"': 'quot',
5674 '\'': '#39'
5675 },
5676 i = /[<>&\"\']/g;
5677 return e ? ('' + e).replace(i, function (e) {
5678 return t[e] ? '&' + t[e] + ';' : e
5679 }) : e
5680 },
5681 toArray: a.Basic.toArray,
5682 inArray: a.Basic.inArray,
5683 inSeries: a.Basic.inSeries,
5684 addI18n: t.core.I18n.addI18n,
5685 translate: t.core.I18n.translate,
5686 sprintf: a.Basic.sprintf,
5687 isEmptyObj: a.Basic.isEmptyObj,
5688 hasClass: a.Dom.hasClass,
5689 addClass: a.Dom.addClass,
5690 removeClass: a.Dom.removeClass,
5691 getStyle: a.Dom.getStyle,
5692 addEvent: a.Events.addEvent,
5693 removeEvent: a.Events.removeEvent,
5694 removeAllEvents: a.Events.removeAllEvents,
5695 cleanName: function (e) {
5696 var t,
5697 i;
5698 for (i = [
5699 /[\300-\306]/g,
5700 'A',
5701 /[\340-\346]/g,
5702 'a',
5703 /\307/g,
5704 'C',
5705 /\347/g,
5706 'c',
5707 /[\310-\313]/g,
5708 'E',
5709 /[\350-\353]/g,
5710 'e',
5711 /[\314-\317]/g,
5712 'I',
5713 /[\354-\357]/g,
5714 'i',
5715 /\321/g,
5716 'N',
5717 /\361/g,
5718 'n',
5719 /[\322-\330]/g,
5720 'O',
5721 /[\362-\370]/g,
5722 'o',
5723 /[\331-\334]/g,
5724 'U',
5725 /[\371-\374]/g,
5726 'u'
5727 ], t = 0; t < i.length; t += 2) e = e.replace(i[t], i[t + 1]);
5728 return e = e.replace(/\s+/g, '_'),
5729 e = e.replace(/[^a-z0-9_\-\.]+/gi, '')
5730 },
5731 buildUrl: function (e, t) {
5732 var i = '';
5733 return l.each(t, function (e, t) {
5734 i += (i ? '&' : '') + encodeURIComponent(t) + '=' + encodeURIComponent(e)
5735 }),
5736 i && (e += (e.indexOf('?') > 0 ? '&' : '?') + i),
5737 e
5738 },
5739 formatSize: function (e) {
5740 function t(e, t) {
5741 return Math.round(e * Math.pow(10, t)) / Math.pow(10, t)
5742 }
5743 if (e === i || /\D/.test(e)) return l.translate('N/A');
5744 var n = Math.pow(1024, 4);
5745 return e > n ? t(e / n, 1) + ' ' + l.translate('tb') : e > (n /= 1024) ? t(e / n, 1) + ' ' + l.translate('gb') : e > (n /= 1024) ? t(e / n, 1) + ' ' + l.translate('mb') : e > 1024 ? Math.round(e / 1024) + ' ' + l.translate('kb') : e + ' ' + l.translate('b')
5746 },
5747 parseSize: a.Basic.parseSizeStr,
5748 predictRuntime: function (e, t) {
5749 var i,
5750 n;
5751 return i = new l.Uploader(e),
5752 n = o.thatCan(i.getOption().required_features, t || e.runtimes),
5753 i.destroy(),
5754 n
5755 },
5756 addFileFilter: function (e, t) {
5757 s[e] = t
5758 }
5759 };
5760 l.addFileFilter('mime_types', function (e, t, i) {
5761 e.length && !e.regexp.test(t.name) ? (this.trigger('Error', {
5762 code: l.FILE_EXTENSION_ERROR,
5763 message: l.translate('File extension error.'),
5764 file: t
5765 }), i(!1)) : i(!0)
5766 }),
5767 l.addFileFilter('max_file_size', function (e, t, i) {
5768 var n;
5769 e = l.parseSize(e),
5770 t.size !== n && e && t.size > e ? (this.trigger('Error', {
5771 code: l.FILE_SIZE_ERROR,
5772 message: l.translate('File size error.'),
5773 file: t
5774 }), i(!1)) : i(!0)
5775 }),
5776 l.addFileFilter('prevent_duplicates', function (e, t, i) {
5777 if (e) for (var n = this.files.length; n--; ) if (t.name === this.files[n].name && t.size === this.files[n].size) return this.trigger('Error', {
5778 code: l.FILE_DUPLICATE_ERROR,
5779 message: l.translate('Duplicate file error.'),
5780 file: t
5781 }),
5782 i(!1),
5783 void 0;
5784 i(!0)
5785 }),
5786 l.Uploader = function (e) {
5787 function a() {
5788 var e,
5789 t,
5790 i = 0;
5791 if (this.state == l.STARTED) {
5792 for (t = 0; t < x.length; t++) e || x[t].status != l.QUEUED ? i++ : (e = x[t], this.trigger('BeforeUpload', e) && (e.status = l.UPLOADING, this.trigger('UploadFile', e)));
5793 i == x.length && (this.state !== l.STOPPED && (this.state = l.STOPPED, this.trigger('StateChanged')), this.trigger('UploadComplete', x))
5794 }
5795 }
5796 function u(e) {
5797 e.percent = e.size > 0 ? Math.ceil(100 * (e.loaded / e.size)) : 100,
5798 d()
5799 }
5800 function d() {
5801 var e,
5802 t,
5803 n,
5804 r = 0;
5805 for (w.reset(), e = 0; e < x.length; e++) t = x[e],
5806 t.size !== i ? (w.size += t.origSize, n = t.loaded * t.origSize / t.size, (!t.completeTimestamp || t.completeTimestamp > I) && (r += n), w.loaded += n) : w.size = i,
5807 t.status == l.DONE ? w.uploaded++ : t.status == l.FAILED ? w.failed++ : w.queued++;
5808 w.size === i ? w.percent = x.length > 0 ? Math.ceil(100 * (w.uploaded / x.length)) : 0 : (w.bytesPerSec = Math.ceil(r / (( + new Date - I || 1) / 1000)), w.percent = w.size > 0 ? Math.ceil(100 * (w.loaded / w.size)) : 0)
5809 }
5810 function c() {
5811 var e = U[0] || F[0];
5812 return e ? e.getRuntime().uid : !1
5813 }
5814 function f(e, t) {
5815 if (e.ruid) {
5816 var i = o.getInfo(e.ruid);
5817 if (i) return i.can(t)
5818 }
5819 return !1
5820 }
5821 function p() {
5822 this.bind('FilesAdded FilesRemoved', function (e) {
5823 e.trigger('QueueChanged'),
5824 e.refresh()
5825 }),
5826 this.bind('CancelUpload', y),
5827 this.bind('BeforeUpload', _),
5828 this.bind('UploadFile', E),
5829 this.bind('UploadProgress', v),
5830 this.bind('StateChanged', b),
5831 this.bind('QueueChanged', d),
5832 this.bind('Error', z),
5833 this.bind('FileUploaded', R),
5834 this.bind('Destroy', O)
5835 }
5836 function g(e, i) {
5837 var n = this,
5838 r = 0,
5839 s = [
5840 ],
5841 a = {
5842 runtime_order: e.runtimes,
5843 required_caps: e.required_features,
5844 preferred_caps: P,
5845 swf_url: e.flash_swf_url,
5846 xap_url: e.silverlight_xap_url
5847 };
5848 l.each(e.runtimes.split(/\s*,\s*/), function (t) {
5849 e[t] && (a[t] = e[t])
5850 }),
5851 e.browse_button && l.each(e.browse_button, function (i) {
5852 s.push(function (s) {
5853 var u = new t.file.FileInput(l.extend({
5854 }, a, {
5855 accept: e.filters.mime_types,
5856 name: e.file_data_name,
5857 multiple: e.multi_selection,
5858 container: e.container,
5859 browse_button: i
5860 }));
5861 u.onready = function () {
5862 var e = o.getInfo(this.ruid);
5863 l.extend(n.features, {
5864 chunks: e.can('slice_blob'),
5865 multipart: e.can('send_multipart'),
5866 multi_selection: e.can('select_multiple')
5867 }),
5868 r++,
5869 U.push(this),
5870 s()
5871 },
5872 u.onchange = function () {
5873 n.addFile(this.files)
5874 },
5875 u.bind('mouseenter mouseleave mousedown mouseup', function (t) {
5876 A || (e.browse_button_hover && ('mouseenter' === t.type ? l.addClass(i, e.browse_button_hover) : 'mouseleave' === t.type && l.removeClass(i, e.browse_button_hover)), e.browse_button_active && ('mousedown' === t.type ? l.addClass(i, e.browse_button_active) : 'mouseup' === t.type && l.removeClass(i, e.browse_button_active)))
5877 }),
5878 u.bind('mousedown', function () {
5879 n.trigger('Browse')
5880 }),
5881 u.bind('error runtimeerror', function () {
5882 u = null,
5883 s()
5884 }),
5885 u.init()
5886 })
5887 }),
5888 e.drop_element && l.each(e.drop_element, function (e) {
5889 s.push(function (i) {
5890 var s = new t.file.FileDrop(l.extend({
5891 }, a, {
5892 drop_zone: e
5893 }));
5894 s.onready = function () {
5895 var e = o.getInfo(this.ruid);
5896 l.extend(n.features, {
5897 chunks: e.can('slice_blob'),
5898 multipart: e.can('send_multipart'),
5899 dragdrop: e.can('drag_and_drop')
5900 }),
5901 r++,
5902 F.push(this),
5903 i()
5904 },
5905 s.ondrop = function () {
5906 n.addFile(this.files)
5907 },
5908 s.bind('error runtimeerror', function () {
5909 s = null,
5910 i()
5911 }),
5912 s.init()
5913 })
5914 }),
5915 l.inSeries(s, function () {
5916 'function' == typeof i && i(r)
5917 })
5918 }
5919 function h(e, n, r) {
5920 var s = new t.image.Image;
5921 try {
5922 s.onload = function () {
5923 return n.width > this.width && n.height > this.height && n.quality === i && n.preserve_headers && !n.crop ? (this.destroy(), r(e)) : (s.downsize(n.width, n.height, n.crop, n.preserve_headers), void 0)
5924 },
5925 s.onresize = function () {
5926 r(this.getAsBlob(e.type, n.quality)),
5927 this.destroy()
5928 },
5929 s.onerror = function () {
5930 r(e)
5931 },
5932 s.load(e)
5933 } catch (a) {
5934 r(e)
5935 }
5936 }
5937 function m(e, i, r) {
5938 function s(e, i, n) {
5939 var r = S[e];
5940 switch (e) {
5941 case 'max_file_size':
5942 'max_file_size' === e && (S.max_file_size = S.filters.max_file_size = i);
5943 break;
5944 case 'chunk_size':
5945 (i = l.parseSize(i)) && (S[e] = i, S.send_file_name = !0);
5946 break;
5947 case 'multipart':
5948 S[e] = i,
5949 i || (S.send_file_name = !0);
5950 break;
5951 case 'http_method':
5952 S[e] = 'PUT' === i.toUpperCase() ? 'PUT' : 'POST';
5953 break;
5954 case 'unique_names':
5955 S[e] = i,
5956 i && (S.send_file_name = !0);
5957 break;
5958 case 'filters':
5959 'array' === l.typeOf(i) && (i = {
5960 mime_types: i
5961 }),
5962 n ? l.extend(S.filters, i) : S.filters = i,
5963 i.mime_types && ('string' === l.typeOf(i.mime_types) && (i.mime_types = t.core.utils.Mime.mimes2extList(i.mime_types)), i.mime_types.regexp = function (e) {
5964 var t = [
5965 ];
5966 return l.each(e, function (e) {
5967 l.each(e.extensions.split(/,/), function (e) {
5968 /^\s*\*\s*$/.test(e) ? t.push('\\.*') : t.push('\\.' + e.replace(new RegExp('[' + '/^$.*+?|()[]{}\\'.replace(/./g, '\\$&') + ']', 'g'), '\\$&'))
5969 })
5970 }),
5971 new RegExp('(' + t.join('|') + ')$', 'i')
5972 }(i.mime_types), S.filters.mime_types = i.mime_types);
5973 break;
5974 case 'resize':
5975 S.resize = i ? l.extend({
5976 preserve_headers: !0,
5977 crop: !1
5978 }, i) : !1;
5979 break;
5980 case 'prevent_duplicates':
5981 S.prevent_duplicates = S.filters.prevent_duplicates = !!i;
5982 break;
5983 case 'container':
5984 case 'browse_button':
5985 case 'drop_element':
5986 i = 'container' === e ? l.get(i) : l.getAll(i);
5987 case 'runtimes':
5988 case 'multi_selection':
5989 case 'flash_swf_url':
5990 case 'silverlight_xap_url':
5991 S[e] = i,
5992 n || (u = !0);
5993 break;
5994 default:
5995 S[e] = i
5996 }
5997 n || a.trigger('OptionChanged', e, i, r)
5998 }
5999 var a = this,
6000 u = !1;
6001 'object' == typeof e ? l.each(e, function (e, t) {
6002 s(t, e, r)
6003 }) : s(e, i, r),
6004 r ? (S.required_features = n(l.extend({
6005 }, S)), P = n(l.extend({
6006 }, S, {
6007 required_features: !0
6008 }))) : u && (a.trigger('Destroy'), g.call(a, S, function (e) {
6009 e ? (a.runtime = o.getInfo(c()).type, a.trigger('Init', {
6010 runtime: a.runtime
6011 }), a.trigger('PostInit')) : a.trigger('Error', {
6012 code: l.INIT_ERROR,
6013 message: l.translate('Init error.')
6014 })
6015 }))
6016 }
6017 function _(e, t) {
6018 if (e.settings.unique_names) {
6019 var i = t.name.match(/\.([^.]+)$/),
6020 n = 'part';
6021 i && (n = i[1]),
6022 t.target_name = t.id + '.' + n
6023 }
6024 }
6025 function E(e, i) {
6026 function n() {
6027 c-- > 0 ? r(s, 1000) : (i.loaded = g, e.trigger('Error', {
6028 code: l.HTTP_ERROR,
6029 message: l.translate('HTTP Error.'),
6030 file: i,
6031 response: T.responseText,
6032 status: T.status,
6033 responseHeaders: T.getAllResponseHeaders()
6034 }))
6035 }
6036 function s() {
6037 var t,
6038 n,
6039 r = {
6040 };
6041 i.status === l.UPLOADING && e.state !== l.STOPPED && (e.settings.send_file_name && (r.name = i.target_name || i.name), d && p.chunks && o.size > d ? (n = Math.min(d, o.size - g), t = o.slice(g, g + n)) : (n = o.size, t = o), d && p.chunks && (e.settings.send_chunk_number ? (r.chunk = Math.ceil(g / d), r.chunks = Math.ceil(o.size / d)) : (r.offset = g, r.total = o.size)), e.trigger('BeforeChunkUpload', i, r, t, g) && a(r, t, n))
6042 }
6043 function a(a, d, f) {
6044 var h;
6045 T = new t.xhr.XMLHttpRequest,
6046 T.upload && (T.upload.onprogress = function (t) {
6047 i.loaded = Math.min(i.size, g + t.loaded),
6048 e.trigger('UploadProgress', i)
6049 }),
6050 T.onload = function () {
6051 return T.status >= 400 ? (n(), void 0) : (c = e.settings.max_retries, f < o.size ? (d.destroy(), g += f, i.loaded = Math.min(g, o.size), e.trigger('ChunkUploaded', i, {
6052 offset: i.loaded,
6053 total: o.size,
6054 response: T.responseText,
6055 status: T.status,
6056 responseHeaders: T.getAllResponseHeaders()
6057 }), 'Android Browser' === l.ua.browser && e.trigger('UploadProgress', i)) : i.loaded = i.size, d = h = null, !g || g >= o.size ? (i.size != i.origSize && (o.destroy(), o = null), e.trigger('UploadProgress', i), i.status = l.DONE, i.completeTimestamp = + new Date, e.trigger('FileUploaded', i, {
6058 response: T.responseText,
6059 status: T.status,
6060 responseHeaders: T.getAllResponseHeaders()
6061 })) : r(s, 1), void 0)
6062 },
6063 T.onerror = function () {
6064 n()
6065 },
6066 T.onloadend = function () {
6067 this.destroy(),
6068 T = null
6069 },
6070 e.settings.multipart && p.multipart ? (T.open(e.settings.http_method, u, !0), l.each(e.settings.headers, function (e, t) {
6071 T.setRequestHeader(t, e)
6072 }), h = new t.xhr.FormData, l.each(l.extend(a, e.settings.multipart_params), function (e, t) {
6073 h.append(t, e)
6074 }), h.append(e.settings.file_data_name, d), T.send(h, {
6075 runtime_order: e.settings.runtimes,
6076 required_caps: e.settings.required_features,
6077 preferred_caps: P,
6078 swf_url: e.settings.flash_swf_url,
6079 xap_url: e.settings.silverlight_xap_url
6080 })) : (u = l.buildUrl(e.settings.url, l.extend(a, e.settings.multipart_params)), T.open(e.settings.http_method, u, !0), l.each(e.settings.headers, function (e, t) {
6081 T.setRequestHeader(t, e)
6082 }), T.hasRequestHeader('Content-Type') || T.setRequestHeader('Content-Type', 'application/octet-stream'), T.send(d, {
6083 runtime_order: e.settings.runtimes,
6084 required_caps: e.settings.required_features,
6085 preferred_caps: P,
6086 swf_url: e.settings.flash_swf_url,
6087 xap_url: e.settings.silverlight_xap_url
6088 }))
6089 }
6090 var o,
6091 u = e.settings.url,
6092 d = e.settings.chunk_size,
6093 c = e.settings.max_retries,
6094 p = e.features,
6095 g = 0;
6096 i.loaded && (g = i.loaded = d ? d * Math.floor(i.loaded / d) : 0),
6097 o = i.getSource(),
6098 !l.isEmptyObj(e.settings.resize) && f(o, 'send_binary_string') && - 1 !== l.inArray(o.type, [
6099 'image/jpeg',
6100 'image/png'
6101 ]) ? h.call(this, o, e.settings.resize, function (e) {
6102 o = e,
6103 i.size = e.size,
6104 s()
6105 }) : s()
6106 }
6107 function v(e, t) {
6108 u(t)
6109 }
6110 function b(e) {
6111 if (e.state == l.STARTED) I = + new Date;
6112 else if (e.state == l.STOPPED) for (var t = e.files.length - 1; t >= 0; t--) e.files[t].status == l.UPLOADING && (e.files[t].status = l.QUEUED, d())
6113 }
6114 function y() {
6115 T && T.abort()
6116 }
6117 function R(e) {
6118 d(),
6119 r(function () {
6120 a.call(e)
6121 }, 1)
6122 }
6123 function z(e, t) {
6124 t.code === l.INIT_ERROR ? e.destroy() : t.code === l.HTTP_ERROR && (t.file.status = l.FAILED, t.file.completeTimestamp = + new Date, u(t.file), e.state == l.STARTED && (e.trigger('CancelUpload'), r(function () {
6125 a.call(e)
6126 }, 1)))
6127 }
6128 function O(e) {
6129 e.stop(),
6130 l.each(x, function (e) {
6131 e.destroy()
6132 }),
6133 x = [
6134 ],
6135 U.length && (l.each(U, function (e) {
6136 e.destroy()
6137 }), U = [
6138 ]),
6139 F.length && (l.each(F, function (e) {
6140 e.destroy()
6141 }), F = [
6142 ]),
6143 P = {
6144 },
6145 A = !1,
6146 I = T = null,
6147 w.reset()
6148 }
6149 var S,
6150 I,
6151 w,
6152 T,
6153 D = l.guid(),
6154 x = [
6155 ],
6156 P = {
6157 },
6158 U = [
6159 ],
6160 F = [
6161 ],
6162 A = !1;
6163 S = {
6164 chunk_size: 0,
6165 file_data_name: 'file',
6166 filters: {
6167 mime_types: [
6168 ],
6169 prevent_duplicates: !1,
6170 max_file_size: 0
6171 },
6172 flash_swf_url: 'js/Moxie.swf',
6173 http_method: 'POST',
6174 max_retries: 0,
6175 multipart: !0,
6176 multi_selection: !0,
6177 resize: !1,
6178 runtimes: o.order,
6179 send_file_name: !0,
6180 send_chunk_number: !0,
6181 silverlight_xap_url: 'js/Moxie.xap'
6182 },
6183 m.call(this, e, null, !0),
6184 w = new l.QueueProgress,
6185 l.extend(this, {
6186 id: D,
6187 uid: D,
6188 state: l.STOPPED,
6189 features: {
6190 },
6191 runtime: null,
6192 files: x,
6193 settings: S,
6194 total: w,
6195 init: function () {
6196 var e,
6197 t,
6198 i = this;
6199 return e = i.getOption('preinit'),
6200 'function' == typeof e ? e(i) : l.each(e, function (e, t) {
6201 i.bind(t, e)
6202 }),
6203 p.call(i),
6204 l.each(['container',
6205 'browse_button',
6206 'drop_element'], function (e) {
6207 return null === i.getOption(e) ? (t = {
6208 code: l.INIT_ERROR,
6209 message: l.sprintf(l.translate('%s specified, but cannot be found.'), e)
6210 }, !1) : void 0
6211 }),
6212 t ? i.trigger('Error', t) : S.browse_button || S.drop_element ? (g.call(i, S, function (e) {
6213 var t = i.getOption('init');
6214 'function' == typeof t ? t(i) : l.each(t, function (e, t) {
6215 i.bind(t, e)
6216 }),
6217 e ? (i.runtime = o.getInfo(c()).type, i.trigger('Init', {
6218 runtime: i.runtime
6219 }), i.trigger('PostInit')) : i.trigger('Error', {
6220 code: l.INIT_ERROR,
6221 message: l.translate('Init error.')
6222 })
6223 }), void 0) : i.trigger('Error', {
6224 code: l.INIT_ERROR,
6225 message: l.translate('You must specify either browse_button or drop_element.')
6226 })
6227 },
6228 setOption: function (e, t) {
6229 m.call(this, e, t, !this.runtime)
6230 },
6231 getOption: function (e) {
6232 return e ? S[e] : S
6233 },
6234 refresh: function () {
6235 U.length && l.each(U, function (e) {
6236 e.trigger('Refresh')
6237 }),
6238 this.trigger('Refresh')
6239 },
6240 start: function () {
6241 this.state != l.STARTED && (this.state = l.STARTED, this.trigger('StateChanged'), a.call(this))
6242 },
6243 stop: function () {
6244 this.state != l.STOPPED && (this.state = l.STOPPED, this.trigger('StateChanged'), this.trigger('CancelUpload'))
6245 },
6246 disableBrowse: function () {
6247 A = arguments[0] !== i ? arguments[0] : !0,
6248 U.length && l.each(U, function (e) {
6249 e.disable(A)
6250 }),
6251 this.trigger('DisableBrowse', A)
6252 },
6253 getFile: function (e) {
6254 var t;
6255 for (t = x.length - 1; t >= 0; t--) if (x[t].id === e) return x[t]
6256 },
6257 addFile: function (e, i) {
6258 function n(e, t) {
6259 var i = [
6260 ];
6261 l.each(u.settings.filters, function (t, n) {
6262 s[n] && i.push(function (i) {
6263 s[n].call(u, t, e, function (e) {
6264 i(!e)
6265 })
6266 })
6267 }),
6268 l.inSeries(i, t)
6269 }
6270 function a(e) {
6271 var s = l.typeOf(e);
6272 if (e instanceof t.file.File) {
6273 if (!e.ruid && !e.isDetached()) {
6274 if (!o) return !1;
6275 e.ruid = o,
6276 e.connectRuntime(o)
6277 }
6278 a(new l.File(e))
6279 } else e instanceof t.file.Blob ? (a(e.getSource()), e.destroy()) : e instanceof l.File ? (i && (e.name = i), d.push(function (t) {
6280 n(e, function (i) {
6281 i || (x.push(e), f.push(e), u.trigger('FileFiltered', e)),
6282 r(t, 1)
6283 })
6284 })) : - 1 !== l.inArray(s, [
6285 'file',
6286 'blob'
6287 ]) ? a(new t.file.File(null, e)) : 'node' === s && 'filelist' === l.typeOf(e.files) ? l.each(e.files, a) : 'array' === s && (i = null, l.each(e, a))
6288 }
6289 var o,
6290 u = this,
6291 d = [
6292 ],
6293 f = [
6294 ];
6295 o = c(),
6296 a(e),
6297 d.length && l.inSeries(d, function () {
6298 f.length && u.trigger('FilesAdded', f)
6299 })
6300 },
6301 removeFile: function (e) {
6302 for (var t = 'string' == typeof e ? e : e.id, i = x.length - 1; i >= 0; i--) if (x[i].id === t) return this.splice(i, 1) [0]
6303 },
6304 splice: function (e, t) {
6305 var n = x.splice(e === i ? 0 : e, t === i ? x.length : t),
6306 r = !1;
6307 return this.state == l.STARTED && (l.each(n, function (e) {
6308 return e.status === l.UPLOADING ? (r = !0, !1) : void 0
6309 }), r && this.stop()),
6310 this.trigger('FilesRemoved', n),
6311 l.each(n, function (e) {
6312 e.destroy()
6313 }),
6314 r && this.start(),
6315 n
6316 },
6317 dispatchEvent: function (e) {
6318 var t,
6319 i;
6320 if (e = e.toLowerCase(), t = this.hasEventListener(e)) {
6321 t.sort(function (e, t) {
6322 return t.priority - e.priority
6323 }),
6324 i = [
6325 ].slice.call(arguments),
6326 i.shift(),
6327 i.unshift(this);
6328 for (var n = 0; n < t.length; n++) if (t[n].fn.apply(t[n].scope, i) === !1) return !1
6329 }
6330 return !0
6331 },
6332 bind: function (e, t, i, n) {
6333 l.Uploader.prototype.bind.call(this, e, t, n, i)
6334 },
6335 destroy: function () {
6336 this.trigger('Destroy'),
6337 S = w = null,
6338 this.unbindAll()
6339 }
6340 })
6341 },
6342 l.Uploader.prototype = t.core.EventTarget.instance,
6343 l.File = function () {
6344 function e(e) {
6345 l.extend(this, {
6346 id: l.guid(),
6347 name: e.name || e.fileName,
6348 type: e.type || '',
6349 size: e.size || e.fileSize,
6350 origSize: e.size || e.fileSize,
6351 loaded: 0,
6352 percent: 0,
6353 status: l.QUEUED,
6354 lastModifiedDate: e.lastModifiedDate || (new Date).toLocaleString(),
6355 completeTimestamp: 0,
6356 getNative: function () {
6357 var e = this.getSource().getSource();
6358 return - 1 !== l.inArray(l.typeOf(e), [
6359 'blob',
6360 'file'
6361 ]) ? e : null
6362 },
6363 getSource: function () {
6364 return t[this.id] ? t[this.id] : null
6365 },
6366 destroy: function () {
6367 var e = this.getSource();
6368 e && (e.destroy(), delete t[this.id])
6369 }
6370 }),
6371 t[this.id] = e
6372 }
6373 var t = {
6374 };
6375 return e
6376 }(),
6377 l.QueueProgress = function () {
6378 var e = this;
6379 e.size = 0,
6380 e.loaded = 0,
6381 e.uploaded = 0,
6382 e.failed = 0,
6383 e.queued = 0,
6384 e.percent = 0,
6385 e.bytesPerSec = 0,
6386 e.reset = function () {
6387 e.size = e.loaded = e.uploaded = e.failed = e.queued = e.percent = e.bytesPerSec = 0
6388 }
6389 },
6390 e.plupload = l
6391}(this, e)
6392});