PageRenderTime 76ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 2ms

/default/js/dist/mura.js

http://github.com/blueriver/MuraCMS
JavaScript | 9409 lines | 7137 code | 1017 blank | 1255 comment | 1738 complexity | a44c762b60a9a3c40dca090502bf5d3f MD5 | raw file
Possible License(s): GPL-3.0, ISC, GPL-2.0, MPL-2.0-no-copyleft-exception, MIT, BSD-3-Clause, CPL-1.0, Apache-2.0, 0BSD, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. if (!Object.create) {
  2. Object.create = function(proto, props) {
  3. if (typeof props !== "undefined") {
  4. throw "The multiple-argument version of Object.create is not provided by this browser and cannot be shimmed.";
  5. }
  6. function ctor() { }
  7. ctor.prototype = proto;
  8. return new ctor();
  9. };
  10. }
  11. if (!Array.isArray) {
  12. Array.isArray = function(arg) {
  13. return Object.prototype.toString.call(arg) === '[object Array]';
  14. };
  15. }
  16. // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
  17. if (!Object.keys) {
  18. Object.keys = (function() {
  19. 'use strict';
  20. var hasOwnProperty = Object.prototype.hasOwnProperty,
  21. hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
  22. dontEnums = [
  23. 'toString',
  24. 'toLocaleString',
  25. 'valueOf',
  26. 'hasOwnProperty',
  27. 'isPrototypeOf',
  28. 'propertyIsEnumerable',
  29. 'constructor'
  30. ],
  31. dontEnumsLength = dontEnums.length;
  32. return function(obj) {
  33. if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
  34. throw new TypeError('Object.keys called on non-object');
  35. }
  36. var result = [], prop, i;
  37. for (prop in obj) {
  38. if (hasOwnProperty.call(obj, prop)) {
  39. result.push(prop);
  40. }
  41. }
  42. if (hasDontEnumBug) {
  43. for (i = 0; i < dontEnumsLength; i++) {
  44. if (hasOwnProperty.call(obj, dontEnums[i])) {
  45. result.push(dontEnums[i]);
  46. }
  47. }
  48. }
  49. return result;
  50. };
  51. }());
  52. }
  53. !window.addEventListener && (function (WindowPrototype, DocumentPrototype, ElementPrototype, addEventListener, removeEventListener, dispatchEvent, registry) {
  54. WindowPrototype[addEventListener] = DocumentPrototype[addEventListener] = ElementPrototype[addEventListener] = function (type, listener) {
  55. var target = this;
  56. registry.unshift([target, type, listener, function (event) {
  57. event.currentTarget = target;
  58. event.preventDefault = function () { event.returnValue = false };
  59. event.stopPropagation = function () { event.cancelBubble = true };
  60. event.target = event.srcElement || target;
  61. listener.call(target, event);
  62. }]);
  63. this.attachEvent("on" + type, registry[0][3]);
  64. };
  65. WindowPrototype[removeEventListener] = DocumentPrototype[removeEventListener] = ElementPrototype[removeEventListener] = function (type, listener) {
  66. for (var index = 0, register; register = registry[index]; ++index) {
  67. if (register[0] == this && register[1] == type && register[2] == listener) {
  68. return this.detachEvent("on" + type, registry.splice(index, 1)[0][3]);
  69. }
  70. }
  71. };
  72. WindowPrototype[dispatchEvent] = DocumentPrototype[dispatchEvent] = ElementPrototype[dispatchEvent] = function (eventObject) {
  73. return this.fireEvent("on" + eventObject.type, eventObject);
  74. };
  75. })(Window.prototype, HTMLDocument.prototype, Element.prototype, "addEventListener", "removeEventListener", "dispatchEvent", []);
  76. if (!Array.prototype.forEach) {
  77. Array.prototype.forEach = function(callback, thisArg) {
  78. var T, k;
  79. if (this == null) {
  80. throw new TypeError(' this is null or not defined');
  81. }
  82. // 1. Let O be the result of calling toObject() passing the
  83. // |this| value as the argument.
  84. var O = Object(this);
  85. // 2. Let lenValue be the result of calling the Get() internal
  86. // method of O with the argument "length".
  87. // 3. Let len be toUint32(lenValue).
  88. var len = O.length >>> 0;
  89. // 4. If isCallable(callback) is false, throw a TypeErrorexception.
  90. // See: http://es5.github.com/#x9.11
  91. if (typeof callback !== "function") {
  92. throw new TypeError(callback + ' is not a function');
  93. }
  94. // 5. If thisArg was supplied, let T be thisArg; else let
  95. // T be undefined.
  96. if (arguments.length > 1) {
  97. T = thisArg;
  98. }
  99. // 6. Let k be 0
  100. k = 0;
  101. // 7. Repeat, while k < len
  102. while (k < len) {
  103. var kValue;
  104. // a. Let Pk be ToString(k).
  105. // This is implicit for LHS operands of the in operator
  106. // b. Let kPresent be the result of calling the HasProperty
  107. // internal method of O with argument Pk.
  108. // This step can be combined with c
  109. // c. If kPresent is true, then
  110. if (k in O) {
  111. // i. Let kValue be the result of calling the Get internal
  112. // method of O with argument Pk.
  113. kValue = O[k];
  114. // ii. Call the Call internal method of callback with T as
  115. // the this value and argument list containing kValue, k, and O.
  116. callback.call(T, kValue, k, O);
  117. }
  118. // d. Increase k by 1.
  119. k++;
  120. }
  121. // 8. return undefined
  122. };
  123. }
  124. if (!Array.prototype.filter) {
  125. Array.prototype.filter = function(fun/*, thisArg*/) {
  126. 'use strict';
  127. if (this === void 0 || this === null) {
  128. throw new TypeError();
  129. }
  130. var t = Object(this);
  131. var len = t.length >>> 0;
  132. if (typeof fun !== 'function') {
  133. throw new TypeError();
  134. }
  135. var res = [];
  136. var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
  137. for (var i = 0; i < len; i++) {
  138. if (i in t) {
  139. var val = t[i];
  140. // NOTE: Technically this should Object.defineProperty at
  141. // the next index, as push can be affected by
  142. // properties on Object.prototype and Array.prototype.
  143. // But that method's new, and collisions should be
  144. // rare, so use the more-compatible alternative.
  145. if (fun.call(thisArg, val, i, t)) {
  146. res.push(val);
  147. }
  148. }
  149. }
  150. return res;
  151. };
  152. }
  153. // Production steps of ECMA-262, Edition 5, 15.4.4.19
  154. // Reference: http://es5.github.io/#x15.4.4.19
  155. if (!Array.prototype.map) {
  156. Array.prototype.map = function(callback, thisArg) {
  157. var T, A, k;
  158. if (this == null) {
  159. throw new TypeError(' this is null or not defined');
  160. }
  161. // 1. Let O be the result of calling ToObject passing the |this|
  162. // value as the argument.
  163. var O = Object(this);
  164. // 2. Let lenValue be the result of calling the Get internal
  165. // method of O with the argument "length".
  166. // 3. Let len be ToUint32(lenValue).
  167. var len = O.length >>> 0;
  168. // 4. If IsCallable(callback) is false, throw a TypeError exception.
  169. // See: http://es5.github.com/#x9.11
  170. if (typeof callback !== 'function') {
  171. throw new TypeError(callback + ' is not a function');
  172. }
  173. // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
  174. if (arguments.length > 1) {
  175. T = thisArg;
  176. }
  177. // 6. Let A be a new array created as if by the expression new Array(len)
  178. // where Array is the standard built-in constructor with that name and
  179. // len is the value of len.
  180. A = new Array(len);
  181. // 7. Let k be 0
  182. k = 0;
  183. // 8. Repeat, while k < len
  184. while (k < len) {
  185. var kValue, mappedValue;
  186. // a. Let Pk be ToString(k).
  187. // This is implicit for LHS operands of the in operator
  188. // b. Let kPresent be the result of calling the HasProperty internal
  189. // method of O with argument Pk.
  190. // This step can be combined with c
  191. // c. If kPresent is true, then
  192. if (k in O) {
  193. // i. Let kValue be the result of calling the Get internal
  194. // method of O with argument Pk.
  195. kValue = O[k];
  196. // ii. Let mappedValue be the result of calling the Call internal
  197. // method of callback with T as the this value and argument
  198. // list containing kValue, k, and O.
  199. mappedValue = callback.call(T, kValue, k, O);
  200. // iii. Call the DefineOwnProperty internal method of A with arguments
  201. // Pk, Property Descriptor
  202. // { Value: mappedValue,
  203. // Writable: true,
  204. // Enumerable: true,
  205. // Configurable: true },
  206. // and false.
  207. // In browsers that support Object.defineProperty, use the following:
  208. // Object.defineProperty(A, k, {
  209. // value: mappedValue,
  210. // writable: true,
  211. // enumerable: true,
  212. // configurable: true
  213. // });
  214. // For best browser support, use the following:
  215. A[k] = mappedValue;
  216. }
  217. // d. Increase k by 1.
  218. k++;
  219. }
  220. // 9. return A
  221. return A;
  222. };
  223. }
  224. /*!
  225. * @overview es6-promise - a tiny implementation of Promises/A+.
  226. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  227. * @license Licensed under MIT license
  228. * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  229. * @version 2.3.0
  230. */
  231. (function() {
  232. "use strict";
  233. function lib$es6$promise$utils$$objectOrFunction(x) {
  234. return typeof x === 'function' || (typeof x === 'object' && x !== null);
  235. }
  236. function lib$es6$promise$utils$$isFunction(x) {
  237. return typeof x === 'function';
  238. }
  239. function lib$es6$promise$utils$$isMaybeThenable(x) {
  240. return typeof x === 'object' && x !== null;
  241. }
  242. var lib$es6$promise$utils$$_isArray;
  243. if (!Array.isArray) {
  244. lib$es6$promise$utils$$_isArray = function (x) {
  245. return Object.prototype.toString.call(x) === '[object Array]';
  246. };
  247. } else {
  248. lib$es6$promise$utils$$_isArray = Array.isArray;
  249. }
  250. var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
  251. var lib$es6$promise$asap$$len = 0;
  252. var lib$es6$promise$asap$$toString = {}.toString;
  253. var lib$es6$promise$asap$$vertxNext;
  254. var lib$es6$promise$asap$$customSchedulerFn;
  255. var lib$es6$promise$asap$$asap = function asap(callback, arg) {
  256. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
  257. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
  258. lib$es6$promise$asap$$len += 2;
  259. if (lib$es6$promise$asap$$len === 2) {
  260. // If len is 2, that means that we need to schedule an async flush.
  261. // If additional callbacks are queued before the queue is flushed, they
  262. // will be processed by this flush that we are scheduling.
  263. if (lib$es6$promise$asap$$customSchedulerFn) {
  264. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  265. } else {
  266. lib$es6$promise$asap$$scheduleFlush();
  267. }
  268. }
  269. }
  270. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  271. lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
  272. }
  273. function lib$es6$promise$asap$$setAsap(asapFn) {
  274. lib$es6$promise$asap$$asap = asapFn;
  275. }
  276. var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
  277. var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
  278. var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  279. var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  280. // test for web worker but not in IE10
  281. var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
  282. typeof importScripts !== 'undefined' &&
  283. typeof MessageChannel !== 'undefined';
  284. // node
  285. function lib$es6$promise$asap$$useNextTick() {
  286. var nextTick = process.nextTick;
  287. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  288. // setImmediate should be used instead instead
  289. var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  290. if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
  291. nextTick = setImmediate;
  292. }
  293. return function() {
  294. nextTick(lib$es6$promise$asap$$flush);
  295. };
  296. }
  297. // vertx
  298. function lib$es6$promise$asap$$useVertxTimer() {
  299. return function() {
  300. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  301. };
  302. }
  303. function lib$es6$promise$asap$$useMutationObserver() {
  304. var iterations = 0;
  305. var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  306. var node = document.createTextNode('');
  307. observer.observe(node, { characterData: true });
  308. return function() {
  309. node.data = (iterations = ++iterations % 2);
  310. };
  311. }
  312. // web worker
  313. function lib$es6$promise$asap$$useMessageChannel() {
  314. var channel = new MessageChannel();
  315. channel.port1.onmessage = lib$es6$promise$asap$$flush;
  316. return function () {
  317. channel.port2.postMessage(0);
  318. };
  319. }
  320. function lib$es6$promise$asap$$useSetTimeout() {
  321. return function() {
  322. setTimeout(lib$es6$promise$asap$$flush, 1);
  323. };
  324. }
  325. var lib$es6$promise$asap$$queue = new Array(1000);
  326. function lib$es6$promise$asap$$flush() {
  327. for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
  328. var callback = lib$es6$promise$asap$$queue[i];
  329. var arg = lib$es6$promise$asap$$queue[i+1];
  330. callback(arg);
  331. lib$es6$promise$asap$$queue[i] = undefined;
  332. lib$es6$promise$asap$$queue[i+1] = undefined;
  333. }
  334. lib$es6$promise$asap$$len = 0;
  335. }
  336. function lib$es6$promise$asap$$attemptVertex() {
  337. try {
  338. var r = require;
  339. var vertx = r('vertx');
  340. lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
  341. return lib$es6$promise$asap$$useVertxTimer();
  342. } catch(e) {
  343. return lib$es6$promise$asap$$useSetTimeout();
  344. }
  345. }
  346. var lib$es6$promise$asap$$scheduleFlush;
  347. // Decide what async method to use to triggering processing of queued callbacks:
  348. if (lib$es6$promise$asap$$isNode) {
  349. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
  350. } else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  351. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
  352. } else if (lib$es6$promise$asap$$isWorker) {
  353. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
  354. } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
  355. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex();
  356. } else {
  357. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
  358. }
  359. function lib$es6$promise$$internal$$noop() {}
  360. var lib$es6$promise$$internal$$PENDING = void 0;
  361. var lib$es6$promise$$internal$$FULFILLED = 1;
  362. var lib$es6$promise$$internal$$REJECTED = 2;
  363. var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
  364. function lib$es6$promise$$internal$$selfFullfillment() {
  365. return new TypeError("You cannot resolve a promise with itself");
  366. }
  367. function lib$es6$promise$$internal$$cannotReturnOwn() {
  368. return new TypeError('A promises callback cannot return that same promise.');
  369. }
  370. function lib$es6$promise$$internal$$getThen(promise) {
  371. try {
  372. return promise.then;
  373. } catch(error) {
  374. lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
  375. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  376. }
  377. }
  378. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  379. try {
  380. then.call(value, fulfillmentHandler, rejectionHandler);
  381. } catch(e) {
  382. return e;
  383. }
  384. }
  385. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  386. lib$es6$promise$asap$$asap(function(promise) {
  387. var sealed = false;
  388. var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
  389. if (sealed) { return; }
  390. sealed = true;
  391. if (thenable !== value) {
  392. lib$es6$promise$$internal$$resolve(promise, value);
  393. } else {
  394. lib$es6$promise$$internal$$fulfill(promise, value);
  395. }
  396. }, function(reason) {
  397. if (sealed) { return; }
  398. sealed = true;
  399. lib$es6$promise$$internal$$reject(promise, reason);
  400. }, 'Settle: ' + (promise._label || ' unknown promise'));
  401. if (!sealed && error) {
  402. sealed = true;
  403. lib$es6$promise$$internal$$reject(promise, error);
  404. }
  405. }, promise);
  406. }
  407. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  408. if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
  409. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  410. } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
  411. lib$es6$promise$$internal$$reject(promise, thenable._result);
  412. } else {
  413. lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
  414. lib$es6$promise$$internal$$resolve(promise, value);
  415. }, function(reason) {
  416. lib$es6$promise$$internal$$reject(promise, reason);
  417. });
  418. }
  419. }
  420. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  421. if (maybeThenable.constructor === promise.constructor) {
  422. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  423. } else {
  424. var then = lib$es6$promise$$internal$$getThen(maybeThenable);
  425. if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
  426. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  427. } else if (then === undefined) {
  428. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  429. } else if (lib$es6$promise$utils$$isFunction(then)) {
  430. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  431. } else {
  432. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  433. }
  434. }
  435. }
  436. function lib$es6$promise$$internal$$resolve(promise, value) {
  437. if (promise === value) {
  438. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  439. } else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  440. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  441. } else {
  442. lib$es6$promise$$internal$$fulfill(promise, value);
  443. }
  444. }
  445. function lib$es6$promise$$internal$$publishRejection(promise) {
  446. if (promise._onerror) {
  447. promise._onerror(promise._result);
  448. }
  449. lib$es6$promise$$internal$$publish(promise);
  450. }
  451. function lib$es6$promise$$internal$$fulfill(promise, value) {
  452. if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
  453. promise._result = value;
  454. promise._state = lib$es6$promise$$internal$$FULFILLED;
  455. if (promise._subscribers.length !== 0) {
  456. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  457. }
  458. }
  459. function lib$es6$promise$$internal$$reject(promise, reason) {
  460. if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
  461. promise._state = lib$es6$promise$$internal$$REJECTED;
  462. promise._result = reason;
  463. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  464. }
  465. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  466. var subscribers = parent._subscribers;
  467. var length = subscribers.length;
  468. parent._onerror = null;
  469. subscribers[length] = child;
  470. subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
  471. subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
  472. if (length === 0 && parent._state) {
  473. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  474. }
  475. }
  476. function lib$es6$promise$$internal$$publish(promise) {
  477. var subscribers = promise._subscribers;
  478. var settled = promise._state;
  479. if (subscribers.length === 0) { return; }
  480. var child, callback, detail = promise._result;
  481. for (var i = 0; i < subscribers.length; i += 3) {
  482. child = subscribers[i];
  483. callback = subscribers[i + settled];
  484. if (child) {
  485. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  486. } else {
  487. callback(detail);
  488. }
  489. }
  490. promise._subscribers.length = 0;
  491. }
  492. function lib$es6$promise$$internal$$ErrorObject() {
  493. this.error = null;
  494. }
  495. var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
  496. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  497. try {
  498. return callback(detail);
  499. } catch(e) {
  500. console.error(e);
  501. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
  502. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  503. }
  504. }
  505. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  506. var hasCallback = lib$es6$promise$utils$$isFunction(callback),
  507. value, error, succeeded, failed;
  508. if (hasCallback) {
  509. value = lib$es6$promise$$internal$$tryCatch(callback, detail);
  510. if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  511. failed = true;
  512. error = value.error;
  513. value = null;
  514. } else {
  515. succeeded = true;
  516. }
  517. if (promise === value) {
  518. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  519. return;
  520. }
  521. } else {
  522. value = detail;
  523. succeeded = true;
  524. }
  525. if (promise._state !== lib$es6$promise$$internal$$PENDING) {
  526. // noop
  527. } else if (hasCallback && succeeded) {
  528. lib$es6$promise$$internal$$resolve(promise, value);
  529. } else if (failed) {
  530. lib$es6$promise$$internal$$reject(promise, error);
  531. } else if (settled === lib$es6$promise$$internal$$FULFILLED) {
  532. lib$es6$promise$$internal$$fulfill(promise, value);
  533. } else if (settled === lib$es6$promise$$internal$$REJECTED) {
  534. lib$es6$promise$$internal$$reject(promise, value);
  535. }
  536. }
  537. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  538. try {
  539. resolver(function resolvePromise(value){
  540. lib$es6$promise$$internal$$resolve(promise, value);
  541. }, function rejectPromise(reason) {
  542. lib$es6$promise$$internal$$reject(promise, reason);
  543. });
  544. } catch(e) {
  545. lib$es6$promise$$internal$$reject(promise, e);
  546. }
  547. }
  548. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  549. var enumerator = this;
  550. enumerator._instanceConstructor = Constructor;
  551. enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);
  552. if (enumerator._validateInput(input)) {
  553. enumerator._input = input;
  554. enumerator.length = input.length;
  555. enumerator._remaining = input.length;
  556. enumerator._init();
  557. if (enumerator.length === 0) {
  558. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  559. } else {
  560. enumerator.length = enumerator.length || 0;
  561. enumerator._enumerate();
  562. if (enumerator._remaining === 0) {
  563. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  564. }
  565. }
  566. } else {
  567. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  568. }
  569. }
  570. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) {
  571. return lib$es6$promise$utils$$isArray(input);
  572. };
  573. lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
  574. return new Error('Array Methods must be provided an Array');
  575. };
  576. lib$es6$promise$enumerator$$Enumerator.prototype._init = function() {
  577. this._result = new Array(this.length);
  578. };
  579. var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
  580. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
  581. var enumerator = this;
  582. var length = enumerator.length;
  583. var promise = enumerator.promise;
  584. var input = enumerator._input;
  585. for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
  586. enumerator._eachEntry(input[i], i);
  587. }
  588. };
  589. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
  590. var enumerator = this;
  591. var c = enumerator._instanceConstructor;
  592. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  593. if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {
  594. entry._onerror = null;
  595. enumerator._settledAt(entry._state, i, entry._result);
  596. } else {
  597. enumerator._willSettleAt(c.resolve(entry), i);
  598. }
  599. } else {
  600. enumerator._remaining--;
  601. enumerator._result[i] = entry;
  602. }
  603. };
  604. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
  605. var enumerator = this;
  606. var promise = enumerator.promise;
  607. if (promise._state === lib$es6$promise$$internal$$PENDING) {
  608. enumerator._remaining--;
  609. if (state === lib$es6$promise$$internal$$REJECTED) {
  610. lib$es6$promise$$internal$$reject(promise, value);
  611. } else {
  612. enumerator._result[i] = value;
  613. }
  614. }
  615. if (enumerator._remaining === 0) {
  616. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  617. }
  618. };
  619. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
  620. var enumerator = this;
  621. lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
  622. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  623. }, function(reason) {
  624. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  625. });
  626. };
  627. function lib$es6$promise$promise$all$$all(entries) {
  628. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  629. }
  630. var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
  631. function lib$es6$promise$promise$race$$race(entries) {
  632. /*jshint validthis:true */
  633. var Constructor = this;
  634. var promise = new Constructor(lib$es6$promise$$internal$$noop);
  635. if (!lib$es6$promise$utils$$isArray(entries)) {
  636. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  637. return promise;
  638. }
  639. var length = entries.length;
  640. function onFulfillment(value) {
  641. lib$es6$promise$$internal$$resolve(promise, value);
  642. }
  643. function onRejection(reason) {
  644. lib$es6$promise$$internal$$reject(promise, reason);
  645. }
  646. for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
  647. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  648. }
  649. return promise;
  650. }
  651. var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
  652. function lib$es6$promise$promise$resolve$$resolve(object) {
  653. /*jshint validthis:true */
  654. var Constructor = this;
  655. if (object && typeof object === 'object' && object.constructor === Constructor) {
  656. return object;
  657. }
  658. var promise = new Constructor(lib$es6$promise$$internal$$noop);
  659. lib$es6$promise$$internal$$resolve(promise, object);
  660. return promise;
  661. }
  662. var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
  663. function lib$es6$promise$promise$reject$$reject(reason) {
  664. /*jshint validthis:true */
  665. var Constructor = this;
  666. var promise = new Constructor(lib$es6$promise$$internal$$noop);
  667. lib$es6$promise$$internal$$reject(promise, reason);
  668. return promise;
  669. }
  670. var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
  671. var lib$es6$promise$promise$$counter = 0;
  672. function lib$es6$promise$promise$$needsResolver() {
  673. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  674. }
  675. function lib$es6$promise$promise$$needsNew() {
  676. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  677. }
  678. var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
  679. /**
  680. Promise objects represent the eventual result of an asynchronous operation. The
  681. primary way of interacting with a promise is through its `then` method, which
  682. registers callbacks to receive either a promise's eventual value or the reason
  683. why the promise cannot be fulfilled.
  684. Terminology
  685. -----------
  686. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  687. - `thenable` is an object or function that defines a `then` method.
  688. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  689. - `exception` is a value that is thrown using the throw statement.
  690. - `reason` is a value that indicates why a promise was rejected.
  691. - `settled` the final resting state of a promise, fulfilled or rejected.
  692. A promise can be in one of three states: pending, fulfilled, or rejected.
  693. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  694. state. Promises that are rejected have a rejection reason and are in the
  695. rejected state. A fulfillment value is never a thenable.
  696. Promises can also be said to *resolve* a value. If this value is also a
  697. promise, then the original promise's settled state will match the value's
  698. settled state. So a promise that *resolves* a promise that rejects will
  699. itself reject, and a promise that *resolves* a promise that fulfills will
  700. itself fulfill.
  701. Basic Usage:
  702. ------------
  703. ```js
  704. var promise = new Promise(function(resolve, reject) {
  705. // on success
  706. resolve(value);
  707. // on failure
  708. reject(reason);
  709. });
  710. promise.then(function(value) {
  711. // on fulfillment
  712. }, function(reason) {
  713. // on rejection
  714. });
  715. ```
  716. Advanced Usage:
  717. ---------------
  718. Promises shine when abstracting away asynchronous interactions such as
  719. `XMLHttpRequest`s.
  720. ```js
  721. function getJSON(url) {
  722. return new Promise(function(resolve, reject){
  723. var xhr = new XMLHttpRequest();
  724. xhr.open('GET', url);
  725. xhr.onreadystatechange = handler;
  726. xhr.responseType = 'json';
  727. xhr.setRequestHeader('Accept', 'application/json');
  728. xhr.send();
  729. function handler() {
  730. if (this.readyState === this.DONE) {
  731. if (this.status === 200) {
  732. resolve(this.response);
  733. } else {
  734. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  735. }
  736. }
  737. };
  738. });
  739. }
  740. getJSON('/posts.json').then(function(json) {
  741. // on fulfillment
  742. }, function(reason) {
  743. // on rejection
  744. });
  745. ```
  746. Unlike callbacks, promises are great composable primitives.
  747. ```js
  748. Promise.all([
  749. getJSON('/posts'),
  750. getJSON('/comments')
  751. ]).then(function(values){
  752. values[0] // => postsJSON
  753. values[1] // => commentsJSON
  754. return values;
  755. });
  756. ```
  757. @class Promise
  758. @param {function} resolver
  759. Useful for tooling.
  760. @constructor
  761. */
  762. function lib$es6$promise$promise$$Promise(resolver) {
  763. this._id = lib$es6$promise$promise$$counter++;
  764. this._state = undefined;
  765. this._result = undefined;
  766. this._subscribers = [];
  767. if (lib$es6$promise$$internal$$noop !== resolver) {
  768. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  769. lib$es6$promise$promise$$needsResolver();
  770. }
  771. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  772. lib$es6$promise$promise$$needsNew();
  773. }
  774. lib$es6$promise$$internal$$initializePromise(this, resolver);
  775. }
  776. }
  777. lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
  778. lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
  779. lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
  780. lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
  781. lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
  782. lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
  783. lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
  784. lib$es6$promise$promise$$Promise.prototype = {
  785. constructor: lib$es6$promise$promise$$Promise,
  786. /**
  787. The primary way of interacting with a promise is through its `then` method,
  788. which registers callbacks to receive either a promise's eventual value or the
  789. reason why the promise cannot be fulfilled.
  790. ```js
  791. findUser().then(function(user){
  792. // user is available
  793. }, function(reason){
  794. // user is unavailable, and you are given the reason why
  795. });
  796. ```
  797. Chaining
  798. --------
  799. The return value of `then` is itself a promise. This second, 'downstream'
  800. promise is resolved with the return value of the first promise's fulfillment
  801. or rejection handler, or rejected if the handler throws an exception.
  802. ```js
  803. findUser().then(function (user) {
  804. return user.name;
  805. }, function (reason) {
  806. return 'default name';
  807. }).then(function (userName) {
  808. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  809. // will be `'default name'`
  810. });
  811. findUser().then(function (user) {
  812. throw new Error('Found user, but still unhappy');
  813. }, function (reason) {
  814. throw new Error('`findUser` rejected and we're unhappy');
  815. }).then(function (value) {
  816. // never reached
  817. }, function (reason) {
  818. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  819. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  820. });
  821. ```
  822. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  823. ```js
  824. findUser().then(function (user) {
  825. throw new PedagogicalException('Upstream error');
  826. }).then(function (value) {
  827. // never reached
  828. }).then(function (value) {
  829. // never reached
  830. }, function (reason) {
  831. // The `PedgagocialException` is propagated all the way down to here
  832. });
  833. ```
  834. Assimilation
  835. ------------
  836. Sometimes the value you want to propagate to a downstream promise can only be
  837. retrieved asynchronously. This can be achieved by returning a promise in the
  838. fulfillment or rejection handler. The downstream promise will then be pending
  839. until the returned promise is settled. This is called *assimilation*.
  840. ```js
  841. findUser().then(function (user) {
  842. return findCommentsByAuthor(user);
  843. }).then(function (comments) {
  844. // The user's comments are now available
  845. });
  846. ```
  847. If the assimliated promise rejects, then the downstream promise will also reject.
  848. ```js
  849. findUser().then(function (user) {
  850. return findCommentsByAuthor(user);
  851. }).then(function (comments) {
  852. // If `findCommentsByAuthor` fulfills, we'll have the value here
  853. }, function (reason) {
  854. // If `findCommentsByAuthor` rejects, we'll have the reason here
  855. });
  856. ```
  857. Simple Example
  858. --------------
  859. Synchronous Example
  860. ```javascript
  861. var result;
  862. try {
  863. result = findResult();
  864. // success
  865. } catch(reason) {
  866. // failure
  867. }
  868. ```
  869. Errback Example
  870. ```js
  871. findResult(function(result, err){
  872. if (err) {
  873. // failure
  874. } else {
  875. // success
  876. }
  877. });
  878. ```
  879. Promise Example;
  880. ```javascript
  881. findResult().then(function(result){
  882. // success
  883. }, function(reason){
  884. // failure
  885. });
  886. ```
  887. Advanced Example
  888. --------------
  889. Synchronous Example
  890. ```javascript
  891. var author, books;
  892. try {
  893. author = findAuthor();
  894. books = findBooksByAuthor(author);
  895. // success
  896. } catch(reason) {
  897. // failure
  898. }
  899. ```
  900. Errback Example
  901. ```js
  902. function foundBooks(books) {
  903. }
  904. function failure(reason) {
  905. }
  906. findAuthor(function(author, err){
  907. if (err) {
  908. failure(err);
  909. // failure
  910. } else {
  911. try {
  912. findBoooksByAuthor(author, function(books, err) {
  913. if (err) {
  914. failure(err);
  915. } else {
  916. try {
  917. foundBooks(books);
  918. } catch(reason) {
  919. failure(reason);
  920. }
  921. }
  922. });
  923. } catch(error) {
  924. failure(err);
  925. }
  926. // success
  927. }
  928. });
  929. ```
  930. Promise Example;
  931. ```javascript
  932. findAuthor().
  933. then(findBooksByAuthor).
  934. then(function(books){
  935. // found books
  936. }).catch(function(reason){
  937. // something went wrong
  938. });
  939. ```
  940. @method then
  941. @param {Function} onFulfilled
  942. @param {Function} onRejected
  943. Useful for tooling.
  944. @return {Promise}
  945. */
  946. then: function(onFulfillment, onRejection) {
  947. var parent = this;
  948. var state = parent._state;
  949. if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
  950. return this;
  951. }
  952. var child = new this.constructor(lib$es6$promise$$internal$$noop);
  953. var result = parent._result;
  954. if (state) {
  955. var callback = arguments[state - 1];
  956. lib$es6$promise$asap$$asap(function(){
  957. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  958. });
  959. } else {
  960. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  961. }
  962. return child;
  963. },
  964. /**
  965. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  966. as the catch block of a try/catch statement.
  967. ```js
  968. function findAuthor(){
  969. throw new Error('couldn't find that author');
  970. }
  971. // synchronous
  972. try {
  973. findAuthor();
  974. } catch(reason) {
  975. // something went wrong
  976. }
  977. // async with promises
  978. findAuthor().catch(function(reason){
  979. // something went wrong
  980. });
  981. ```
  982. @method catch
  983. @param {Function} onRejection
  984. Useful for tooling.
  985. @return {Promise}
  986. */
  987. 'catch': function(onRejection) {
  988. return this.then(null, onRejection);
  989. }
  990. };
  991. function lib$es6$promise$polyfill$$polyfill() {
  992. var local;
  993. if (typeof global !== 'undefined') {
  994. local = global;
  995. } else if (typeof self !== 'undefined') {
  996. local = self;
  997. } else {
  998. try {
  999. local = Function('return this')();
  1000. } catch (e) {
  1001. throw new Error('polyfill failed because global object is unavailable in this environment');
  1002. }
  1003. }
  1004. var P = local.Promise;
  1005. if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
  1006. return;
  1007. }
  1008. local.Promise = lib$es6$promise$promise$$default;
  1009. }
  1010. var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
  1011. var lib$es6$promise$umd$$ES6Promise = {
  1012. 'Promise': lib$es6$promise$promise$$default,
  1013. 'polyfill': lib$es6$promise$polyfill$$default
  1014. };
  1015. /* global define:true module:true window: true */
  1016. if (typeof define === 'function' && define['amd']) {
  1017. define(function() { return lib$es6$promise$umd$$ES6Promise; });
  1018. } else if (typeof module !== 'undefined' && module['exports']) {
  1019. module['exports'] = lib$es6$promise$umd$$ES6Promise;
  1020. } else if (typeof this !== 'undefined') {
  1021. this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
  1022. }
  1023. lib$es6$promise$polyfill$$default();
  1024. }).call(this);
  1025. // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
  1026. // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
  1027. // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
  1028. // refactored by Yannick Albert
  1029. // MIT license
  1030. (function(window) {
  1031. var equestAnimationFrame = 'equestAnimationFrame',
  1032. requestAnimationFrame = 'r' + equestAnimationFrame,
  1033. ancelAnimationFrame = 'ancelAnimationFrame',
  1034. cancelAnimationFrame = 'c' + ancelAnimationFrame,
  1035. expectedTime = 0,
  1036. vendors = ['moz', 'ms', 'o', 'webkit'],
  1037. vendor;
  1038. while(!window[requestAnimationFrame] && (vendor = vendors.pop())) {
  1039. window[requestAnimationFrame] = window[vendor + 'R' + equestAnimationFrame];
  1040. window[cancelAnimationFrame] = window[vendor + 'C' + ancelAnimationFrame] || window[vendor + 'CancelR' + equestAnimationFrame];
  1041. }
  1042. if(!window[requestAnimationFrame]) {
  1043. window[requestAnimationFrame] = function(callback) {
  1044. var currentTime = new Date().getTime(),
  1045. adjustedDelay = 16 - (currentTime - expectedTime),
  1046. delay = adjustedDelay > 0 ? adjustedDelay : 0;
  1047. expectedTime = currentTime + delay;
  1048. return setTimeout(function() {
  1049. callback(expectedTime);
  1050. }, delay);
  1051. };
  1052. window[cancelAnimationFrame] = clearTimeout;
  1053. }
  1054. }(this));
  1055. //https://gist.github.com/jonathantneal/3062955
  1056. this.Element && function(ElementPrototype) {
  1057. ElementPrototype.matchesSelector = ElementPrototype.matchesSelector ||
  1058. ElementPrototype.mozMatchesSelector ||
  1059. ElementPrototype.msMatchesSelector ||
  1060. ElementPrototype.oMatchesSelector ||
  1061. ElementPrototype.webkitMatchesSelector ||
  1062. function (selector) {
  1063. var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1;
  1064. while (nodes[++i] && nodes[i] != node);
  1065. return !!nodes[i];
  1066. }
  1067. }(Element.prototype);
  1068. // EventListener | MIT/GPL2 | github.com/jonathantneal/EventListener
  1069. this.Element && Element.prototype.attachEvent && !Element.prototype.addEventListener && (function () {
  1070. function addToPrototype(name, method) {
  1071. Window.prototype[name] = HTMLDocument.prototype[name] = Element.prototype[name] = method;
  1072. }
  1073. // add
  1074. addToPrototype("addEventListener", function (type, listener) {
  1075. var
  1076. target = this,
  1077. listeners = target.addEventListener.listeners = target.addEventListener.listeners || {},
  1078. typeListeners = listeners[type] = listeners[type] || [];
  1079. // if no events exist, attach the listener
  1080. if (!typeListeners.length) {
  1081. target.attachEvent("on" + type, typeListeners.event = function (event) {
  1082. var documentElement = target.document && target.document.documentElement || target.documentElement || { scrollLeft: 0, scrollTop: 0 };
  1083. // polyfill w3c properties and methods
  1084. event.currentTarget = target;
  1085. event.pageX = event.clientX + documentElement.scrollLeft;
  1086. event.pageY = event.clientY + documentElement.scrollTop;
  1087. event.preventDefault = function () { event.returnValue = false };
  1088. event.relatedTarget = event.fromElement || null;
  1089. event.stopImmediatePropagation = function () { immediatePropagation = false; event.cancelBubble = true };
  1090. event.stopPropagation = function () { event.cancelBubble = true };
  1091. event.relatedTarget = event.fromElement || null;
  1092. event.target = event.srcElement || target;
  1093. event.timeStamp = +new Date;
  1094. // create an cached list of the master events list (to protect this loop from breaking when an event is removed)
  1095. for (var i = 0, typeListenersCache = [].concat(typeListeners), typeListenerCache, immediatePropagation = true; immediatePropagation && (typeListenerCache = typeListenersCache[i]); ++i) {
  1096. // check to see if the cached event still exists in the master events list
  1097. for (var ii = 0, typeListener; typeListener = typeListeners[ii]; ++ii) {
  1098. if (typeListener == typeListenerCache) {
  1099. typeListener.call(target, event);
  1100. break;
  1101. }
  1102. }
  1103. }
  1104. });
  1105. }
  1106. // add the event to the master event list
  1107. typeListeners.push(listener);
  1108. });
  1109. // remove
  1110. addToPrototype("removeEventListener", function (type, listener) {
  1111. var
  1112. target = this,
  1113. listeners = target.addEventListener.listeners = target.addEventListener.listeners || {},
  1114. typeListeners = listeners[type] = listeners[type] || [];
  1115. // remove the newest matching event from the master event list
  1116. for (var i = typeListeners.length - 1, typeListener; typeListener = typeListeners[i]; --i) {
  1117. if (typeListener == listener) {
  1118. typeListeners.splice(i, 1);
  1119. break;
  1120. }
  1121. }
  1122. // if no events exist, detach the listener
  1123. if (!typeListeners.length && typeListeners.event) {
  1124. target.detachEvent("on" + type, typeListeners.event);
  1125. }
  1126. });
  1127. // dispatch
  1128. addToPrototype("dispatchEvent", function (eventObject) {
  1129. var
  1130. target = this,
  1131. type = eventObject.type,
  1132. listeners = target.addEventListener.listeners = target.addEventListener.listeners || {},
  1133. typeListeners = listeners[type] = listeners[type] || [];
  1134. try {
  1135. return target.fireEvent("on" + type, eventObject);
  1136. } catch (error) {
  1137. if (typeListeners.event) {
  1138. typeListeners.event(eventObject);
  1139. }
  1140. return;
  1141. }
  1142. });
  1143. // CustomEvent
  1144. Object.defineProperty(Window.prototype, "CustomEvent", {
  1145. get: function () {
  1146. var self = this;
  1147. return function CustomEvent(type, detail) {
  1148. detail = detail || {};
  1149. var event = self.document.createEventObject(), key;
  1150. event.type = type;
  1151. event.returnValue = !detail.cancelable;
  1152. event.cancelBubble = !detail.bubbles;
  1153. for (key in detail) {
  1154. event[key] = detail[key];
  1155. }
  1156. return event;
  1157. };
  1158. }
  1159. });
  1160. // ready
  1161. function ready(event) {
  1162. if (ready.interval && document.body) {
  1163. ready.interval = clearInterval(ready.interval);
  1164. document.dispatchEvent(new CustomEvent("DOMContentLoaded"));
  1165. }
  1166. }
  1167. ready.interval = setInterval(ready, 1);
  1168. window.addEventListener("load", ready);
  1169. })();
  1170. ;/*!
  1171. handlebars v4.0.5
  1172. Copyright (C) 2011-2015 by Yehuda Katz
  1173. Permission is hereby granted, free of charge, to any person obtaining a copy
  1174. of this software and associated documentation files (the "Software"), to deal
  1175. in the Software without restriction, including without limitation the rights
  1176. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1177. copies of the Software, and to permit persons to whom the Software is
  1178. furnished to do so, subject to the following conditions:
  1179. The above copyright notice and this permission notice shall be included in
  1180. all copies or substantial portions of the Software.
  1181. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1182. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1183. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1184. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1185. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1186. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1187. THE SOFTWARE.
  1188. @license
  1189. */
  1190. (function webpackUniversalModuleDefinition(root, factory) {
  1191. if(typeof exports === 'object' && typeof module === 'object')
  1192. module.exports = factory();
  1193. else if(typeof define === 'function' && define.amd)
  1194. define([], factory);
  1195. else if(typeof exports === 'object')
  1196. exports["Handlebars"] = factory();
  1197. else
  1198. root["Handlebars"] = factory();
  1199. })(this, function() {
  1200. return /******/ (function(modules) { // webpackBootstrap
  1201. /******/ // The module cache
  1202. /******/ var installedModules = {};
  1203. /******/ // The require function
  1204. /******/ function __webpack_require__(moduleId) {
  1205. /******/ // Check if module is in cache
  1206. /******/ if(installedModules[moduleId])
  1207. /******/ return installedModules[moduleId].exports;
  1208. /******/ // Create a new module (and put it into the cache)
  1209. /******/ var module = installedModules[moduleId] = {
  1210. /******/ exports: {},
  1211. /******/ id: moduleId,
  1212. /******/ loaded: false
  1213. /******/ };
  1214. /******/ // Execute the module function
  1215. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1216. /******/ // Flag the module as loaded
  1217. /******/ module.loaded = true;
  1218. /******/ // Return the exports of the module
  1219. /******/ return module.exports;
  1220. /******/ }
  1221. /******/ // expose the modules object (__webpack_modules__)
  1222. /******/ __webpack_require__.m = modules;
  1223. /******/ // expose the module cache
  1224. /******/ __webpack_require__.c = installedModules;
  1225. /******/ // __webpack_public_path__
  1226. /******/ __webpack_require__.p = "";
  1227. /******/ // Load entry module and return exports
  1228. /******/ return __webpack_require__(0);
  1229. /******/ })
  1230. /**********************************************…

Large files files are truncated, but you can click here to view the full file