j-templates 5.0.35 → 5.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ export declare class StoreAsync {
4
4
  private diffAsync;
5
5
  private observableTree;
6
6
  private asyncWriter;
7
+ private asyncQueue;
7
8
  constructor(idFunc: {
8
9
  (val: any): string;
9
10
  }, init?: any);
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const observableTree_1 = require("../Tree/observableTree");
4
4
  const diffAsync_1 = require("../Diff/diffAsync");
5
5
  const storeAsyncWriter_1 = require("./storeAsyncWriter");
6
+ const asyncQueue_1 = require("../../Utils/asyncQueue");
6
7
  class StoreAsync {
7
8
  constructor(idFunc, init) {
8
9
  this.idFunc = idFunc;
9
10
  this.diffAsync = new diffAsync_1.DiffAsync(this.idFunc);
10
11
  this.observableTree = new observableTree_1.ObservableTree(diffAsync_1.DiffAsync.ReadKeyRef);
11
12
  this.asyncWriter = new storeAsyncWriter_1.StoreAsyncWriter(this.idFunc, this.diffAsync, this.observableTree);
13
+ this.asyncQueue = new asyncQueue_1.AsyncQueue();
12
14
  if (init) {
13
15
  var id = this.idFunc(init);
14
16
  this.observableTree.Write(id, init);
@@ -19,10 +21,12 @@ class StoreAsync {
19
21
  return this.observableTree.Scope(id, func);
20
22
  }
21
23
  async Action(id, action) {
22
- var node;
23
- if (id)
24
- node = this.observableTree.GetNode(id);
25
- await action(node && node.Proxy, this.asyncWriter);
24
+ await this.asyncQueue.Next(async () => {
25
+ var node;
26
+ if (id)
27
+ node = this.observableTree.GetNode(id);
28
+ await action(node && node.Proxy, this.asyncWriter);
29
+ });
26
30
  }
27
31
  async Write(data) {
28
32
  await this.Action(null, async (val, writer) => {
@@ -35,6 +39,7 @@ class StoreAsync {
35
39
  });
36
40
  }
37
41
  Destroy() {
42
+ this.asyncQueue.Stop();
38
43
  this.diffAsync.Destroy();
39
44
  this.observableTree.Destroy();
40
45
  }
@@ -0,0 +1,8 @@
1
+ export declare class AsyncQueue {
2
+ private running;
3
+ private queue;
4
+ Next<T>(callback: () => Promise<T>): Promise<T>;
5
+ Stop(): void;
6
+ private Start;
7
+ private ExecuteQueue;
8
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const list_1 = require("./list");
4
+ class AsyncQueue {
5
+ constructor() {
6
+ this.running = false;
7
+ this.queue = list_1.List.Create();
8
+ }
9
+ Next(callback) {
10
+ const ret = new Promise((resolve, reject) => {
11
+ list_1.List.Add(this.queue, async function () {
12
+ try {
13
+ const ret = await callback();
14
+ resolve(ret);
15
+ }
16
+ catch (e) {
17
+ reject(e);
18
+ }
19
+ });
20
+ });
21
+ this.Start();
22
+ return ret;
23
+ }
24
+ Stop() {
25
+ list_1.List.Clear(this.queue);
26
+ }
27
+ Start() {
28
+ if (this.running)
29
+ return;
30
+ this.running = true;
31
+ this.ExecuteQueue();
32
+ }
33
+ async ExecuteQueue() {
34
+ const callback = list_1.List.Pop(this.queue);
35
+ if (callback !== null) {
36
+ await callback();
37
+ this.ExecuteQueue();
38
+ }
39
+ else
40
+ this.running = false;
41
+ }
42
+ }
43
+ exports.AsyncQueue = AsyncQueue;
package/jTemplates.js CHANGED
@@ -1514,12 +1514,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
1514
1514
  const observableTree_1 = __webpack_require__(/*! ../Tree/observableTree */ "./src/Store/Tree/observableTree.ts");
1515
1515
  const diffAsync_1 = __webpack_require__(/*! ../Diff/diffAsync */ "./src/Store/Diff/diffAsync.ts");
1516
1516
  const storeAsyncWriter_1 = __webpack_require__(/*! ./storeAsyncWriter */ "./src/Store/Store/storeAsyncWriter.ts");
1517
+ const asyncQueue_1 = __webpack_require__(/*! ../../Utils/asyncQueue */ "./src/Utils/asyncQueue.ts");
1517
1518
  class StoreAsync {
1518
1519
  constructor(idFunc, init) {
1519
1520
  this.idFunc = idFunc;
1520
1521
  this.diffAsync = new diffAsync_1.DiffAsync(this.idFunc);
1521
1522
  this.observableTree = new observableTree_1.ObservableTree(diffAsync_1.DiffAsync.ReadKeyRef);
1522
1523
  this.asyncWriter = new storeAsyncWriter_1.StoreAsyncWriter(this.idFunc, this.diffAsync, this.observableTree);
1524
+ this.asyncQueue = new asyncQueue_1.AsyncQueue();
1523
1525
  if (init) {
1524
1526
  var id = this.idFunc(init);
1525
1527
  this.observableTree.Write(id, init);
@@ -1530,10 +1532,12 @@ class StoreAsync {
1530
1532
  return this.observableTree.Scope(id, func);
1531
1533
  }
1532
1534
  async Action(id, action) {
1533
- var node;
1534
- if (id)
1535
- node = this.observableTree.GetNode(id);
1536
- await action(node && node.Proxy, this.asyncWriter);
1535
+ await this.asyncQueue.Next(async () => {
1536
+ var node;
1537
+ if (id)
1538
+ node = this.observableTree.GetNode(id);
1539
+ await action(node && node.Proxy, this.asyncWriter);
1540
+ });
1537
1541
  }
1538
1542
  async Write(data) {
1539
1543
  await this.Action(null, async (val, writer) => {
@@ -1546,6 +1550,7 @@ class StoreAsync {
1546
1550
  });
1547
1551
  }
1548
1552
  Destroy() {
1553
+ this.asyncQueue.Stop();
1549
1554
  this.diffAsync.Destroy();
1550
1555
  this.observableTree.Destroy();
1551
1556
  }
@@ -2459,6 +2464,61 @@ class Animation {
2459
2464
  exports.Animation = Animation;
2460
2465
 
2461
2466
 
2467
+ /***/ }),
2468
+
2469
+ /***/ "./src/Utils/asyncQueue.ts":
2470
+ /*!*********************************!*\
2471
+ !*** ./src/Utils/asyncQueue.ts ***!
2472
+ \*********************************/
2473
+ /*! no static exports found */
2474
+ /***/ (function(module, exports, __webpack_require__) {
2475
+
2476
+ "use strict";
2477
+
2478
+ Object.defineProperty(exports, "__esModule", { value: true });
2479
+ const list_1 = __webpack_require__(/*! ./list */ "./src/Utils/list.ts");
2480
+ class AsyncQueue {
2481
+ constructor() {
2482
+ this.running = false;
2483
+ this.queue = list_1.List.Create();
2484
+ }
2485
+ Next(callback) {
2486
+ const ret = new Promise((resolve, reject) => {
2487
+ list_1.List.Add(this.queue, async function () {
2488
+ try {
2489
+ const ret = await callback();
2490
+ resolve(ret);
2491
+ }
2492
+ catch (e) {
2493
+ reject(e);
2494
+ }
2495
+ });
2496
+ });
2497
+ this.Start();
2498
+ return ret;
2499
+ }
2500
+ Stop() {
2501
+ list_1.List.Clear(this.queue);
2502
+ }
2503
+ Start() {
2504
+ if (this.running)
2505
+ return;
2506
+ this.running = true;
2507
+ this.ExecuteQueue();
2508
+ }
2509
+ async ExecuteQueue() {
2510
+ const callback = list_1.List.Pop(this.queue);
2511
+ if (callback !== null) {
2512
+ await callback();
2513
+ this.ExecuteQueue();
2514
+ }
2515
+ else
2516
+ this.running = false;
2517
+ }
2518
+ }
2519
+ exports.AsyncQueue = AsyncQueue;
2520
+
2521
+
2462
2522
  /***/ }),
2463
2523
 
2464
2524
  /***/ "./src/Utils/decorators.ts":
package/jTemplates.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/DOM/domNodeConfig.ts","webpack:///./src/DOM/elements.ts","webpack:///./src/DOM/index.ts","webpack:///./src/DOM/svgElements.ts","webpack:///./src/DOM/utils.ts","webpack:///./src/DOM/window.ts","webpack:///./src/Node/boundNode.ts","webpack:///./src/Node/component.ts","webpack:///./src/Node/componentNode.ts","webpack:///./src/Node/elementNode.ts","webpack:///./src/Node/nodeConfig.ts","webpack:///./src/Node/nodeRef.ts","webpack:///./src/Store/Diff/diffAsync.ts","webpack:///./src/Store/Diff/diffSync.ts","webpack:///./src/Store/Diff/diffTree.ts","webpack:///./src/Store/Diff/diffWorker.ts","webpack:///./src/Store/Diff/workerQueue.ts","webpack:///./src/Store/Store/store.ts","webpack:///./src/Store/Store/storeAsync.ts","webpack:///./src/Store/Store/storeAsyncWriter.ts","webpack:///./src/Store/Store/storeSync.ts","webpack:///./src/Store/Store/storeSyncWriter.ts","webpack:///./src/Store/Store/storeWriter.ts","webpack:///./src/Store/Tree/observableNode.ts","webpack:///./src/Store/Tree/observableProxy.ts","webpack:///./src/Store/Tree/observableScope.ts","webpack:///./src/Store/Tree/observableTree.ts","webpack:///./src/Store/index.ts","webpack:///./src/Utils/animation.ts","webpack:///./src/Utils/decorators.ts","webpack:///./src/Utils/emitter.ts","webpack:///./src/Utils/index.ts","webpack:///./src/Utils/injector.ts","webpack:///./src/Utils/list.ts","webpack:///./src/Utils/thread.ts","webpack:///./src/index.ts","webpack:///./src/web.export.ts","webpack:///./src/web.ts"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;AACb,8CAA8C,cAAc;AAC5D,iBAAiB,mBAAO,CAAC,qCAAU;AACnC,eAAe,mBAAO,CAAC,0CAAe;AACtC,gBAAgB,mBAAO,CAAC,mCAAS;AACjC,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;AC7Ea;AACb,8CAA8C,cAAc;AAC5D,sBAAsB,mBAAO,CAAC,sDAAqB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9Fa;AACb;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D,SAAS,mBAAO,CAAC,yCAAY;AAC7B,SAAS,mBAAO,CAAC,+CAAe;AAChC,SAAS,mBAAO,CAAC,mCAAS;;;;;;;;;;;;;ACPb;AACb,8CAA8C,cAAc;AAC5D,sBAAsB,mBAAO,CAAC,sDAAqB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACfa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC5Ca;AACb,8CAA8C,cAAc;AAC5D,8DAA8D,mBAAO,CAAC,+HAAO;;;;;;;;;;;;;ACFhE;AACb,8CAA8C,cAAc;AAC5D,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,mDAAmD,EAAE;AACnI,8EAA8E,mDAAmD,EAAE;AACnI,0EAA0E,2CAA2C,EAAE;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC,0DAA0D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACtFa;AACb,8CAA8C,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,wCAAW;AACrC,wBAAwB,mBAAO,CAAC,oDAAiB;AACjD,qBAAqB,mBAAO,CAAC,sDAAqB;AAClD,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,KAAK;AACrD;AACA;AACA;AACA,sDAAsD,eAAe;AACrE,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,0DAA0D;;;;;;;;;;;;;ACzE9C;AACb,8CAA8C,cAAc;AAC5D,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,kBAAkB,mBAAO,CAAC,wCAAW;AACrC,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,mBAAmB,mBAAO,CAAC,kDAAmB;AAC9C,qBAAqB,mBAAO,CAAC,sDAAqB;AAClD,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sEAAsE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA,mCAAmC,qBAAqB;AACxD;AACA;AACA;AACA;AACA,uCAAuC,qBAAqB;AAC5D;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA,iBAAiB;AACjB,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb,KAAK;AACL;;;;;;;;;;;;;ACjHa;AACb,8CAA8C,cAAc;AAC5D,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,mBAAmB,mBAAO,CAAC,kDAAmB;AAC9C,eAAe,mBAAO,CAAC,0CAAe;AACtC,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C,kBAAkB,mBAAO,CAAC,wCAAW;AACrC,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gEAAgE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,SAAS;AACT,KAAK;AACL;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA,2BAA2B,kBAAkB;AAC7C;AACA,SAAS;AACT;AACA,mBAAmB,iCAAiC;AACpD,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACrKa;AACb,8CAA8C,cAAc;AAC5D,wBAAwB,mBAAO,CAAC,wDAAsB;AACtD;;;;;;;;;;;;;ACHa;AACb,8CAA8C,cAAc;AAC5D,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,mBAAmB,mBAAO,CAAC,kDAAmB;AAC9C,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,sBAAsB,mBAAO,CAAC,gDAAe;AAC7C,wBAAwB,mBAAO,CAAC,oDAAiB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gEAAgE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA,CAAC,oDAAoD;;;;;;;;;;;;;AC1JxC;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,gDAAY;AACvC,sBAAsB,mBAAO,CAAC,sDAAe;AAC7C,qBAAqB,mBAAO,CAAC,oDAAc;AAC3C;AACA;AACA;AACA;AACA,+BAA+B,oDAAoD;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,+CAA+C;AAC3F;AACA;AACA,4CAA4C,yCAAyC;AACrF;AACA;AACA,qCAAqC,iDAAiD;AACtF;AACA;AACA,4CAA4C,uCAAuC;AACnF;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACjCa;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,gDAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACxBa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,KAAK,GAAG,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD,gDAAgD,KAAK,GAAG,EAAE,OAAO,EAAE;AACnE;AACA;AACA;AACA;AACA,wCAAwC,KAAK;AAC7C;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qCAAqC;AACpE;AACA,gDAAgD,KAAK,GAAG,OAAO,OAAO,OAAO;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,gDAAgD,KAAK,GAAG,IAAI,OAAO,IAAI;AACvE;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACrNa;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,gDAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,yBAAyB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,6DAA6D;;;;;;;;;;;;;ACjBjD;AACb,8CAA8C,cAAc;AAC5D,eAAe,mBAAO,CAAC,6CAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC/Ba;AACb,8CAA8C,cAAc;AAC5D,yBAAyB,mBAAO,CAAC,kEAAwB;AACzD,sBAAsB,mBAAO,CAAC,uDAAe;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9Ba;AACb,8CAA8C,cAAc;AAC5D,yBAAyB,mBAAO,CAAC,kEAAwB;AACzD,oBAAoB,mBAAO,CAAC,wDAAmB;AAC/C,2BAA2B,mBAAO,CAAC,iEAAoB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACzCa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU,SAAS,GAAG,IAAI,qBAAqB;AACvF;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,SAAS;AACrC;AACA,oDAAoD,SAAS,GAAG,OAAO;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACnDa;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,sDAAkB;AAC7C,yBAAyB,mBAAO,CAAC,kEAAwB;AACzD,0BAA0B,mBAAO,CAAC,+DAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AChCa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU,SAAS,GAAG,IAAI,qBAAqB;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,SAAS,GAAG,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Ca;AACb,8CAA8C,cAAc;AAC5D,0BAA0B,mBAAO,CAAC,oEAAyB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,SAAS,GAAG,IAAI;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9Ba;AACb,8CAA8C,cAAc;AAC5D,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACnJa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA,CAAC,2CAA2C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4EAA4E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACtHa;AACb,8CAA8C,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,mDAAqB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4EAA4E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;;;;;;;AChKa;AACb,8CAA8C,cAAc;AAC5D,yBAAyB,mBAAO,CAAC,4DAAkB;AACnD,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Fa;AACb,8CAA8C,cAAc;AAC5D,cAAc,mBAAO,CAAC,iDAAe;AACrC;AACA,kBAAkB,mBAAO,CAAC,yDAAmB;AAC7C;AACA,mBAAmB,mBAAO,CAAC,2DAAoB;AAC/C;AACA,wBAAwB,mBAAO,CAAC,mEAAwB;AACxD;;;;;;;;;;;;;ACTa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA,CAAC,sCAAsC;AACvC;AACA;AACA;AACA;AACA,CAAC,sEAAsE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mCAAmC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;;;;;;;;;;;;ACjGa;AACb,8CAA8C,cAAc;AAC5D,gBAAgB,mBAAO,CAAC,wDAAsB;AAC9C,gBAAgB,mBAAO,CAAC,sCAAU;AAClC,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,YAAY;AACvD,kDAAkD,YAAY;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,oEAAoE,2BAA2B;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA,qCAAqC,YAAY;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,YAAY;AAC5D,gDAAgD,YAAY;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,YAAY;AAC5D,gDAAgD,YAAY;AAC5D,0DAA0D,YAAY;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,wEAAwE,iCAAiC;AACzG;AACA;AACA,qCAAqC,iCAAiC;AACtE,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,oDAAoD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,yEAAyE;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,iDAAiD;AAClD;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Sa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,oDAAoD;;;;;;;;;;;;;ACtBxC;AACb;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D,SAAS,mBAAO,CAAC,+CAAc;AAC/B,SAAS,mBAAO,CAAC,6CAAa;;;;;;;;;;;;;ACNjB;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,uDAAuD;;;;;;;;;;;;;ACjC3C;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,2CAA2C;;;;;;;;;;;;;ACtH/B;AACb,8CAA8C,cAAc;AAC5D,eAAe,mBAAO,CAAC,mCAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,sBAAsB,EAAE;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;AC1Ga;AACb,8CAA8C,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,iDAAkB;AAC5C;;;;;;;;;;;;;ACHa;AACb;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D,SAAS,mBAAO,CAAC,+BAAS;AAC1B,SAAS,mBAAO,CAAC,qCAAS;AAC1B,cAAc,mBAAO,CAAC,qCAAS;AAC/B;AACA;AACA;AACA,SAAS,mBAAO,CAAC,iCAAO;;;;;;;;;;;;;ACXX;AACb,8CAA8C,cAAc;AAC5D,YAAY,mBAAO,CAAC,yCAAc;AAClC;AACA","file":"jTemplates.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/web.ts\");\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst window_1 = require(\"./window\");\r\nconst list_1 = require(\"../Utils/list\");\r\nconst utils_1 = require(\"./utils\");\r\nconst thread_1 = require(\"../Utils/thread\");\r\nvar pendingUpdates = list_1.List.Create();\r\nvar updateScheduled = false;\r\nfunction processUpdates() {\r\n list_1.List.Add(pendingUpdates, null);\r\n var callback;\r\n while ((callback = list_1.List.Pop(pendingUpdates)))\r\n thread_1.Synch(callback);\r\n if (pendingUpdates.size === 0)\r\n updateScheduled = false;\r\n else\r\n window_1.wndw.requestAnimationFrame(processUpdates);\r\n}\r\nconst htmlNs = \"http://www.w3.org/1999/xhtml\";\r\nexports.DOMNodeConfig = {\r\n createNode(type, namespace) {\r\n return type !== \"text\" ? window_1.wndw.document.createElementNS(namespace || htmlNs, type) : window_1.wndw.document.createTextNode(\"\");\r\n },\r\n scheduleUpdate(callback) {\r\n list_1.List.Add(pendingUpdates, callback);\r\n if (!updateScheduled) {\r\n updateScheduled = true;\r\n window_1.wndw.requestAnimationFrame(processUpdates);\r\n }\r\n },\r\n addListener(target, type, callback) {\r\n target.addEventListener(type, callback);\r\n },\r\n removeListener(target, type, callback) {\r\n target.removeEventListener(type, callback);\r\n },\r\n addChild(root, child) {\r\n root.appendChild(child);\r\n },\r\n addChildFirst(root, child) {\r\n exports.DOMNodeConfig.addChildBefore(root, root.firstChild, child);\r\n },\r\n addChildBefore(root, sibling, child) {\r\n if (!sibling) {\r\n exports.DOMNodeConfig.addChild(root, child);\r\n return;\r\n }\r\n if (child !== sibling)\r\n root.insertBefore(child, sibling);\r\n },\r\n addChildAfter(root, sibling, child) {\r\n if (!sibling) {\r\n exports.DOMNodeConfig.addChildFirst(root, child);\r\n return;\r\n }\r\n exports.DOMNodeConfig.addChildBefore(root, sibling.nextSibling, child);\r\n },\r\n removeChild(root, child) {\r\n root.removeChild(child);\r\n },\r\n remove(target) {\r\n target && target.parentNode && target.parentNode.removeChild(target);\r\n },\r\n setText(target, text) {\r\n target.textContent = text;\r\n },\r\n getAttribute(target, attribute) {\r\n return target.getAttribute(attribute);\r\n },\r\n setAttribute(target, attribute, value) {\r\n target.setAttribute(attribute, value);\r\n },\r\n fireEvent(target, event, data) {\r\n var cEvent = new CustomEvent(event, data);\r\n target.dispatchEvent(cEvent);\r\n },\r\n setProperties: utils_1.SetProperties\r\n};\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst elementNode_1 = require(\"../Node/elementNode\");\r\nfunction div(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"div\", null, nodeDef, children);\r\n}\r\nexports.div = div;\r\nfunction a(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"a\", null, nodeDef, children);\r\n}\r\nexports.a = a;\r\nfunction ul(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"ul\", null, nodeDef, children);\r\n}\r\nexports.ul = ul;\r\nfunction li(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"li\", null, nodeDef, children);\r\n}\r\nexports.li = li;\r\nfunction br(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"br\", null, nodeDef, null);\r\n}\r\nexports.br = br;\r\nfunction b(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"b\", null, nodeDef, children);\r\n}\r\nexports.b = b;\r\nfunction span(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"span\", null, nodeDef, children);\r\n}\r\nexports.span = span;\r\nfunction img(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"img\", null, nodeDef, null);\r\n}\r\nexports.img = img;\r\nfunction video(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"video\", null, nodeDef, children);\r\n}\r\nexports.video = video;\r\nfunction source(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"source\", null, nodeDef, null);\r\n}\r\nexports.source = source;\r\nfunction input(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"input\", null, nodeDef, null);\r\n}\r\nexports.input = input;\r\nfunction select(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"select\", null, nodeDef, children);\r\n}\r\nexports.select = select;\r\nfunction option(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"option\", null, nodeDef, children);\r\n}\r\nexports.option = option;\r\nfunction h1(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"h1\", null, nodeDef, children);\r\n}\r\nexports.h1 = h1;\r\nfunction h2(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"h2\", null, nodeDef, children);\r\n}\r\nexports.h2 = h2;\r\nfunction h3(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"h3\", null, nodeDef, children);\r\n}\r\nexports.h3 = h3;\r\nfunction p(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"p\", null, nodeDef, children);\r\n}\r\nexports.p = p;\r\nfunction style(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"style\", null, nodeDef, children);\r\n}\r\nexports.style = style;\r\nfunction button(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"button\", null, nodeDef, children);\r\n}\r\nexports.button = button;\r\nfunction table(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"table\", null, nodeDef, children);\r\n}\r\nexports.table = table;\r\nfunction th(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"th\", null, nodeDef, children);\r\n}\r\nexports.th = th;\r\nfunction tr(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"tr\", null, nodeDef, children);\r\n}\r\nexports.tr = tr;\r\nfunction td(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"td\", null, nodeDef, children);\r\n}\r\nexports.td = td;\r\n","\"use strict\";\r\nfunction __export(m) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__export(require(\"./elements\"));\r\n__export(require(\"./svgElements\"));\r\n__export(require(\"./utils\"));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst elementNode_1 = require(\"../Node/elementNode\");\r\nconst svgNs = \"http://www.w3.org/2000/svg\";\r\nfunction svg(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"svg\", svgNs, nodeDef, children);\r\n}\r\nexports.svg = svg;\r\nfunction g(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"g\", svgNs, nodeDef, children);\r\n}\r\nexports.g = g;\r\nfunction circle(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"circle\", svgNs, nodeDef, children);\r\n}\r\nexports.circle = circle;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction SetValue(target, value) {\r\n switch (target.nodeName) {\r\n case \"INPUT\":\r\n var start = target.selectionStart;\r\n var end = target.selectionEnd;\r\n target.value = value;\r\n if (target.ownerDocument.activeElement === target)\r\n target.setSelectionRange(start, end);\r\n break;\r\n default:\r\n target.value = value;\r\n }\r\n}\r\nfunction SetStyle(target, styleDef, lastStyleDef) {\r\n for (var key in styleDef)\r\n if (!lastStyleDef || lastStyleDef[key] !== styleDef[key])\r\n target.style[key] = styleDef[key];\r\n}\r\nfunction SetRootProperty(target, prop, value, lastValue) {\r\n switch (prop) {\r\n case \"value\":\r\n SetValue(target, value);\r\n break;\r\n case \"style\":\r\n SetStyle(target, value, lastValue);\r\n break;\r\n default:\r\n target[prop] = value;\r\n }\r\n}\r\nfunction SetChangedProperties(target, lastProperties, properties) {\r\n for (var key in properties) {\r\n (!lastProperties || lastProperties[key] !== properties[key]) &&\r\n SetRootProperty(target, key, properties[key], lastProperties && lastProperties[key]);\r\n }\r\n}\r\nfunction SetProperties(target, lastProperties, properties) {\r\n if (!lastProperties && target.nodeType === Node.TEXT_NODE)\r\n target.nodeValue = properties.nodeValue;\r\n else\r\n SetChangedProperties(target, lastProperties, properties);\r\n}\r\nexports.SetProperties = SetProperties;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.wndw = typeof window !== \"undefined\" ? window : (new (require(\"jsdom\").JSDOM(\"\")).window);\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nvar BoundNode;\r\n(function (BoundNode) {\r\n function Init(boundNode) {\r\n var nodeDef = boundNode.nodeDef;\r\n var propertiesScope = nodeDef.props ?\r\n observableScope_1.ObservableScope.Create(nodeDef.props) : null;\r\n var attributesScope = nodeDef.attrs ?\r\n observableScope_1.ObservableScope.Create(nodeDef.attrs) : null;\r\n var eventsScope = nodeDef.on ?\r\n observableScope_1.ObservableScope.Create(nodeDef.on) : null;\r\n observableScope_1.ObservableScope.Watch(propertiesScope, function () { ScheduleSetProperties(boundNode, propertiesScope); });\r\n observableScope_1.ObservableScope.Watch(attributesScope, function () { ScheduleSetAttributes(boundNode, attributesScope); });\r\n observableScope_1.ObservableScope.Watch(eventsScope, function () { ScheduleSetEvents(boundNode, eventsScope); });\r\n SetProperties(boundNode, observableScope_1.ObservableScope.Value(propertiesScope));\r\n SetAttributes(boundNode, observableScope_1.ObservableScope.Value(attributesScope));\r\n SetEvents(boundNode, observableScope_1.ObservableScope.Value(eventsScope));\r\n boundNode.destroyables.push({\r\n Destroy: function () {\r\n observableScope_1.ObservableScope.Destroy(propertiesScope);\r\n observableScope_1.ObservableScope.Destroy(attributesScope);\r\n observableScope_1.ObservableScope.Destroy(eventsScope);\r\n }\r\n });\r\n }\r\n BoundNode.Init = Init;\r\n})(BoundNode = exports.BoundNode || (exports.BoundNode = {}));\r\nfunction ScheduleSetProperties(node, scope) {\r\n if (node.setProperties)\r\n return;\r\n node.setProperties = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setProperties = false;\r\n if (node.destroyed)\r\n return;\r\n SetProperties(node, observableScope_1.ObservableScope.Value(scope));\r\n });\r\n}\r\nfunction SetProperties(node, properties) {\r\n if (!properties)\r\n return;\r\n nodeConfig_1.NodeConfig.setProperties(node.node, node.lastProperties, properties);\r\n node.lastProperties = properties;\r\n}\r\nfunction ScheduleSetAttributes(node, scope) {\r\n if (node.setAttributes)\r\n return;\r\n node.setAttributes = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setAttributes = false;\r\n if (node.destroyed)\r\n return;\r\n SetAttributes(node, observableScope_1.ObservableScope.Value(scope));\r\n });\r\n}\r\nfunction SetAttributes(node, attributes) {\r\n if (!attributes)\r\n return;\r\n for (var key in attributes) {\r\n var val = nodeConfig_1.NodeConfig.getAttribute(node.node, key);\r\n if (val !== attributes[key])\r\n nodeConfig_1.NodeConfig.setAttribute(node.node, key, attributes[key]);\r\n }\r\n}\r\nfunction ScheduleSetEvents(node, scope) {\r\n if (node.setEvents)\r\n return;\r\n node.setEvents = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setEvents = false;\r\n if (node.destroyed)\r\n return;\r\n SetEvents(node, observableScope_1.ObservableScope.Value(scope));\r\n });\r\n}\r\nfunction SetEvents(node, events) {\r\n if (!events)\r\n return;\r\n for (var key in node.lastEvents)\r\n nodeConfig_1.NodeConfig.removeListener(node.node, key, node.lastEvents[key]);\r\n for (var key in events)\r\n nodeConfig_1.NodeConfig.addListener(node.node, key, events[key]);\r\n node.lastEvents = events;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst nodeRef_1 = require(\"./nodeRef\");\r\nconst componentNode_1 = require(\"./componentNode\");\r\nconst decorators_1 = require(\"../Utils/decorators\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nclass Component {\r\n constructor(data, templates, nodeRef, componentEvents) {\r\n this.nodeRef = nodeRef;\r\n this.componentEvents = componentEvents;\r\n this.scope = new observableScope_1.ObservableScope(data);\r\n this.templates = templates || {};\r\n this.decoratorMap = new Map();\r\n }\r\n get Injector() {\r\n return this.nodeRef.injector;\r\n }\r\n get Destroyed() {\r\n return this.nodeRef.destroyed;\r\n }\r\n get DecoratorMap() {\r\n return this.decoratorMap;\r\n }\r\n get Scope() {\r\n return this.scope;\r\n }\r\n get Data() {\r\n return this.scope.Value;\r\n }\r\n get NodeRef() {\r\n return this.nodeRef;\r\n }\r\n get Templates() {\r\n return this.templates;\r\n }\r\n Template() {\r\n return [];\r\n }\r\n Bound() {\r\n }\r\n Fire(event, data) {\r\n var eventCallback = this.componentEvents && this.componentEvents[event];\r\n eventCallback && eventCallback(data);\r\n }\r\n Destroy() {\r\n decorators_1.Destroy.All(this);\r\n }\r\n}\r\nexports.Component = Component;\r\n(function (Component) {\r\n function ToFunction(type, namespace, constructor) {\r\n return componentNode_1.ComponentNode.ToFunction(type, namespace, constructor);\r\n }\r\n Component.ToFunction = ToFunction;\r\n function Register(name, constructor) {\r\n const componentFunction = ToFunction(`${name}-component`, undefined, constructor);\r\n class WebComponent extends HTMLElement {\r\n constructor() {\r\n super();\r\n const shadowRoot = this.attachShadow({ mode: 'open' });\r\n const node = componentFunction({});\r\n Attach(shadowRoot, node);\r\n }\r\n }\r\n customElements.define(name, WebComponent);\r\n }\r\n Component.Register = Register;\r\n function Attach(node, nodeRef) {\r\n nodeRef_1.NodeRef.Init(nodeRef);\r\n var rootRef = nodeRef_1.NodeRef.Wrap(node);\r\n nodeRef_1.NodeRef.AddChild(rootRef, nodeRef);\r\n }\r\n Component.Attach = Attach;\r\n})(Component = exports.Component || (exports.Component = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst boundNode_1 = require(\"./boundNode\");\r\nconst nodeRef_1 = require(\"./nodeRef\");\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst component_1 = require(\"./component\");\r\nconst injector_1 = require(\"../Utils/injector\");\r\nconst decorators_1 = require(\"../Utils/decorators\");\r\nconst thread_1 = require(\"../Utils/thread\");\r\nvar ComponentNode;\r\n(function (ComponentNode) {\r\n function Fire(event, data) {\r\n var eventCallback = this.componentEvents && this.componentEvents[event];\r\n eventCallback && eventCallback(data);\r\n }\r\n ComponentNode.Fire = Fire;\r\n function ToFunction(type, namespace, constructor) {\r\n return function (nodeDef, templates) {\r\n return Create(type, namespace, nodeDef, constructor, templates);\r\n };\r\n }\r\n ComponentNode.ToFunction = ToFunction;\r\n function Init(componentNode) {\r\n var nodeDef = componentNode.nodeDef;\r\n var events = nodeDef.on;\r\n nodeDef.on = null;\r\n componentNode.component = new componentNode.constructor(nodeDef.data, componentNode.templates, componentNode, events);\r\n SetChildren(componentNode);\r\n componentNode.destroyables.push(componentNode.component);\r\n boundNode_1.BoundNode.Init(componentNode);\r\n }\r\n ComponentNode.Init = Init;\r\n})(ComponentNode = exports.ComponentNode || (exports.ComponentNode = {}));\r\nfunction Create(type, namespace, nodeDef, constructor, templates) {\r\n var compNode = nodeRef_1.NodeRef.Create(type, namespace, nodeRef_1.NodeRefType.ComponentNode);\r\n compNode.nodeDef = nodeDef;\r\n compNode.constructor = constructor;\r\n compNode.templates = templates;\r\n return compNode;\r\n}\r\nfunction SetChildren(node) {\r\n if (decorators_1.PreReq.Has(node.component)) {\r\n AddPreReqTemplate(node).then(function () {\r\n AddTemplate(node, false);\r\n });\r\n }\r\n else\r\n AddTemplate(node, true);\r\n}\r\nfunction AddPreReqTemplate(node) {\r\n return new Promise(resolve => {\r\n thread_1.Thread(function () {\r\n var preNodes;\r\n injector_1.Injector.Scope(node.injector, () => preNodes = decorators_1.PreReqTemplate.Get(node.component));\r\n thread_1.Schedule(function () {\r\n if (node.destroyed)\r\n return;\r\n nodeRef_1.NodeRef.InitAll(preNodes);\r\n });\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < preNodes.length; x++)\r\n nodeRef_1.NodeRef.AddChild(node, preNodes[x]);\r\n decorators_1.PreReq.All(node.component).then(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < preNodes.length; x++)\r\n nodeRef_1.NodeRef.Destroy(preNodes[x]);\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < preNodes.length; x++)\r\n nodeRef_1.NodeRef.DetachChild(node, preNodes[x]);\r\n resolve();\r\n });\r\n });\r\n });\r\n });\r\n });\r\n}\r\nfunction AddTemplate(node, init) {\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n var nodes;\r\n injector_1.Injector.Scope(node.injector, function () {\r\n nodes = node.component.Template();\r\n });\r\n if (!Array.isArray(nodes))\r\n nodes = [nodes];\r\n thread_1.Schedule(function () {\r\n nodeRef_1.NodeRef.InitAll(nodes);\r\n });\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n if (init)\r\n for (var x = 0; x < nodes.length; x++)\r\n nodeRef_1.NodeRef.AddChild(node, nodes[x]);\r\n else\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < nodes.length; x++)\r\n nodeRef_1.NodeRef.AddChild(node, nodes[x]);\r\n });\r\n });\r\n if (node.component.Bound !== component_1.Component.prototype.Bound)\r\n thread_1.After(function () {\r\n nodeConfig_1.NodeConfig.scheduleUpdate(() => setTimeout(() => node.component.Bound(), 0));\r\n });\r\n });\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst boundNode_1 = require(\"./boundNode\");\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst injector_1 = require(\"../Utils/injector\");\r\nconst list_1 = require(\"../Utils/list\");\r\nconst thread_1 = require(\"../Utils/thread\");\r\nconst nodeRef_1 = require(\"./nodeRef\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nvar ElementNode;\r\n(function (ElementNode) {\r\n function Create(type, namespace, nodeDef, children) {\r\n var elemNode = nodeRef_1.NodeRef.Create(type, namespace, nodeRef_1.NodeRefType.ElementNode);\r\n elemNode.nodeDef = nodeDef;\r\n elemNode.childrenFunc = children;\r\n return elemNode;\r\n }\r\n ElementNode.Create = Create;\r\n function Init(elementNode) {\r\n if (elementNode.childrenFunc) {\r\n var nodeDef = elementNode.nodeDef;\r\n if (nodeDef.data) {\r\n const dataScope = observableScope_1.ObservableScope.Create(nodeDef.data);\r\n observableScope_1.ObservableScope.Watch(dataScope, function () {\r\n ScheduleSetData(elementNode, dataScope);\r\n });\r\n SetData(elementNode, GetValue(dataScope), true);\r\n elementNode.destroyables.push({\r\n Destroy: function () {\r\n observableScope_1.ObservableScope.Destroy(dataScope);\r\n }\r\n });\r\n }\r\n else\r\n SetDefaultData(elementNode);\r\n }\r\n boundNode_1.BoundNode.Init(elementNode);\r\n }\r\n ElementNode.Init = Init;\r\n})(ElementNode = exports.ElementNode || (exports.ElementNode = {}));\r\nconst valueDefault = [];\r\nfunction GetValue(dataScope) {\r\n var value = observableScope_1.ObservableScope.Value(dataScope);\r\n if (!value)\r\n return valueDefault;\r\n if (!Array.isArray(value))\r\n value = [value];\r\n return value;\r\n}\r\nfunction ScheduleSetData(node, scope) {\r\n if (node.setData)\r\n return;\r\n node.setData = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setData = false;\r\n if (node.destroyed)\r\n return;\r\n SetData(node, GetValue(scope));\r\n });\r\n}\r\nfunction SetDefaultData(node) {\r\n thread_1.Synch(function () {\r\n var nodes;\r\n injector_1.Injector.Scope(node.injector, function () {\r\n nodes = CreateNodeArray(node.childrenFunc, true);\r\n });\r\n if (nodes.length > 0) {\r\n thread_1.Schedule(function () {\r\n if (node.destroyed)\r\n return;\r\n nodeRef_1.NodeRef.InitAll(nodes);\r\n });\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n DetachAndAddNodes(node, [], [nodes]);\r\n });\r\n }\r\n });\r\n}\r\nfunction SetData(node, value, init = false) {\r\n thread_1.Synch(function () {\r\n var newNodesMap = new Map();\r\n var values = value || valueDefault;\r\n if (!Array.isArray(values))\r\n values = [values];\r\n var newNodesArrays = values.map(function (value) {\r\n var nodes;\r\n if (node.nodesMap) {\r\n var nodeArrayList = node.nodesMap.get(value);\r\n nodes = nodeArrayList && list_1.List.Remove(nodeArrayList);\r\n }\r\n var newNodeArrayList = newNodesMap.get(value);\r\n if (!newNodeArrayList) {\r\n newNodeArrayList = list_1.List.Create();\r\n newNodesMap.set(value, newNodeArrayList);\r\n }\r\n if (!nodes) {\r\n injector_1.Injector.Scope(node.injector, function () {\r\n nodes = CreateNodeArray(node.childrenFunc, value);\r\n });\r\n thread_1.Schedule(function () {\r\n if (node.destroyed || newNodesMap.size === 0)\r\n return;\r\n nodeRef_1.NodeRef.InitAll(nodes);\r\n list_1.List.Push(newNodeArrayList, nodes);\r\n });\r\n }\r\n else\r\n list_1.List.Push(newNodeArrayList, nodes);\r\n return nodes;\r\n });\r\n var detachNodes = [];\r\n if (node.nodesMap) {\r\n for (var nodeArrayList of node.nodesMap.values())\r\n nodeArrayList.size > 0 && detachNodes.push(DestroyNodeArrayList(nodeArrayList));\r\n node.nodesMap.clear();\r\n }\r\n node.nodesMap = newNodesMap;\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n if (init)\r\n DetachAndAddNodes(node, detachNodes, newNodesMap.size > 0 && newNodesArrays);\r\n else\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n if (node.destroyed)\r\n return;\r\n DetachAndAddNodes(node, detachNodes, newNodesMap.size > 0 && newNodesArrays);\r\n });\r\n });\r\n });\r\n}\r\nfunction DetachAndAddNodes(node, detachNodes, newNodes) {\r\n for (var x = 0; x < detachNodes.length; x++)\r\n list_1.List.ForEach(detachNodes[x], function (nodes) {\r\n for (var x = 0; x < nodes.length; x++)\r\n nodeRef_1.NodeRef.DetachChild(node, nodes[x]);\r\n });\r\n var previousNode = null;\r\n for (var x = 0; newNodes && x < newNodes.length; x++) {\r\n for (var y = 0; y < newNodes[x].length; y++) {\r\n nodeRef_1.NodeRef.AddChildAfter(node, previousNode, newNodes[x][y]);\r\n previousNode = newNodes[x][y];\r\n }\r\n }\r\n}\r\nfunction CreateNodeArray(childrenFunc, value) {\r\n var newNodes = childrenFunc(value);\r\n if (typeof newNodes === \"string\") {\r\n var textNode = nodeRef_1.NodeRef.Create(\"text\", null, nodeRef_1.NodeRefType.BoundNode);\r\n textNode.nodeDef = {\r\n props: function () {\r\n return { nodeValue: childrenFunc(value) };\r\n }\r\n };\r\n return [textNode];\r\n }\r\n if (Array.isArray(newNodes))\r\n return newNodes;\r\n return [newNodes];\r\n}\r\nfunction DestroyNodeArrayList(nodeArrayList) {\r\n list_1.List.ForEach(nodeArrayList, nodeRef_1.NodeRef.DestroyAll);\r\n return nodeArrayList;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst domNodeConfig_1 = require(\"../DOM/domNodeConfig\");\r\nexports.NodeConfig = domNodeConfig_1.DOMNodeConfig;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst injector_1 = require(\"../Utils/injector\");\r\nconst boundNode_1 = require(\"./boundNode\");\r\nconst elementNode_1 = require(\"./elementNode\");\r\nconst componentNode_1 = require(\"./componentNode\");\r\nvar NodeRefType;\r\n(function (NodeRefType) {\r\n NodeRefType[NodeRefType[\"NodeRef\"] = 0] = \"NodeRef\";\r\n NodeRefType[NodeRefType[\"BoundNode\"] = 1] = \"BoundNode\";\r\n NodeRefType[NodeRefType[\"ElementNode\"] = 2] = \"ElementNode\";\r\n NodeRefType[NodeRefType[\"ComponentNode\"] = 3] = \"ComponentNode\";\r\n})(NodeRefType = exports.NodeRefType || (exports.NodeRefType = {}));\r\nvar NodeRef;\r\n(function (NodeRef) {\r\n function Wrap(node) {\r\n var nodeRef = Create(null, null, NodeRefType.NodeRef);\r\n nodeRef.node = node;\r\n nodeRef.childNodes = new Set();\r\n return nodeRef;\r\n }\r\n NodeRef.Wrap = Wrap;\r\n function Create(nodeType, namespace, type) {\r\n switch (type) {\r\n case NodeRefType.NodeRef:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.NodeRef,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: []\r\n };\r\n case NodeRefType.BoundNode:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.BoundNode,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: [],\r\n lastProperties: null,\r\n lastEvents: null,\r\n setProperties: false,\r\n setAttributes: false,\r\n setEvents: false\r\n };\r\n case NodeRefType.ElementNode:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.ElementNode,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: [],\r\n lastProperties: null,\r\n lastEvents: null,\r\n setProperties: false,\r\n setAttributes: false,\r\n setEvents: false,\r\n childrenFunc: null,\r\n nodesMap: null,\r\n setData: false\r\n };\r\n case NodeRefType.ComponentNode:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.ComponentNode,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: [],\r\n lastProperties: null,\r\n lastEvents: null,\r\n setProperties: false,\r\n setAttributes: false,\r\n setEvents: false,\r\n component: null,\r\n componentEvents: null\r\n };\r\n }\r\n }\r\n NodeRef.Create = Create;\r\n function Init(nodeRef) {\r\n if (nodeRef.node)\r\n return;\r\n nodeRef.node = nodeConfig_1.NodeConfig.createNode(nodeRef.nodeType, nodeRef.nodeNamespace);\r\n nodeRef.childNodes = new Set();\r\n switch (nodeRef.type) {\r\n case NodeRefType.BoundNode:\r\n boundNode_1.BoundNode.Init(nodeRef);\r\n break;\r\n case NodeRefType.ElementNode:\r\n elementNode_1.ElementNode.Init(nodeRef);\r\n break;\r\n case NodeRefType.ComponentNode:\r\n componentNode_1.ComponentNode.Init(nodeRef);\r\n break;\r\n }\r\n }\r\n NodeRef.Init = Init;\r\n function InitAll(nodeRefs) {\r\n for (var x = 0; x < nodeRefs.length; x++)\r\n Init(nodeRefs[x]);\r\n }\r\n NodeRef.InitAll = InitAll;\r\n function AddChild(node, child) {\r\n child.parent = node;\r\n node.childNodes.add(child);\r\n nodeConfig_1.NodeConfig.addChild(node.node, child.node);\r\n }\r\n NodeRef.AddChild = AddChild;\r\n function AddChildAfter(node, currentChild, newChild) {\r\n if (currentChild && !node.childNodes.has(currentChild))\r\n throw \"currentChild is not valid\";\r\n newChild.parent = node;\r\n node.childNodes.add(newChild);\r\n nodeConfig_1.NodeConfig.addChildAfter(node.node, currentChild && currentChild.node, newChild.node);\r\n }\r\n NodeRef.AddChildAfter = AddChildAfter;\r\n function DetachChild(node, child) {\r\n if (node.childNodes.has(child)) {\r\n node.childNodes.delete(child);\r\n nodeConfig_1.NodeConfig.removeChild(node.node, child.node);\r\n child.parent = null;\r\n }\r\n }\r\n NodeRef.DetachChild = DetachChild;\r\n function Destroy(node) {\r\n if (node.destroyed)\r\n return;\r\n node.destroyed = true;\r\n node.childNodes.forEach(Destroy);\r\n node.destroyables.forEach(d => d && d.Destroy());\r\n }\r\n NodeRef.Destroy = Destroy;\r\n function DestroyAll(nodes) {\r\n for (var x = 0; x < nodes.length; x++)\r\n Destroy(nodes[x]);\r\n }\r\n NodeRef.DestroyAll = DestroyAll;\r\n})(NodeRef = exports.NodeRef || (exports.NodeRef = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffTree_1 = require(\"./diffTree\");\r\nconst workerQueue_1 = require(\"./workerQueue\");\r\nconst diffWorker_1 = require(\"./diffWorker\");\r\nconst diffCnstr = diffTree_1.DiffTreeScope();\r\nclass DiffAsync {\r\n constructor(keyFunc) {\r\n this.workerQueue = new workerQueue_1.WorkerQueue(diffWorker_1.DiffWorker.Create());\r\n this.workerQueue.Push({ method: \"create\", arguments: [keyFunc.toString()] });\r\n }\r\n static GetKeyRef(key) {\r\n return diffCnstr.GetKeyRef(key);\r\n }\r\n static ReadKeyRef(ref) {\r\n return diffCnstr.ReadKeyRef(ref);\r\n }\r\n async DiffPath(path, value) {\r\n return await this.workerQueue.Push({ method: \"diffpath\", arguments: [path, value] });\r\n }\r\n async DiffBatch(data) {\r\n return await this.workerQueue.Push({ method: \"diffbatch\", arguments: [data] });\r\n }\r\n async UpdatePath(path, value) {\r\n await this.workerQueue.Push({ method: \"updatepath\", arguments: [path, value] });\r\n }\r\n async GetPath(path) {\r\n return await this.workerQueue.Push({ method: \"getpath\", arguments: [path] });\r\n }\r\n Destroy() {\r\n this.workerQueue.Destroy();\r\n }\r\n}\r\nexports.DiffAsync = DiffAsync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffTree_1 = require(\"./diffTree\");\r\nconst diffCnstr = diffTree_1.DiffTreeScope();\r\nclass DiffSync {\r\n constructor(keyFunc) {\r\n this.diffTree = new diffCnstr(keyFunc);\r\n }\r\n static GetKeyRef(key) {\r\n return diffCnstr.GetKeyRef(key);\r\n }\r\n static ReadKeyRef(ref) {\r\n return diffCnstr.ReadKeyRef(ref);\r\n }\r\n DiffPath(path, value) {\r\n return this.diffTree.DiffPath(path, value);\r\n }\r\n DiffBatch(data) {\r\n return this.diffTree.DiffBatch(data);\r\n }\r\n UpdatePath(path, value) {\r\n this.diffTree.UpdatePath(path, value);\r\n }\r\n}\r\nexports.DiffSync = DiffSync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction DiffTreeScope(worker) {\r\n const ctx = this;\r\n if (ctx && worker) {\r\n let diffTree = null;\r\n ctx.onmessage = function (event) {\r\n var data = event.data;\r\n switch (data.method) {\r\n case \"create\":\r\n var keyFunc = data.arguments[0] ? eval(data.arguments[0]) : undefined;\r\n diffTree = new DiffTree(keyFunc);\r\n ctx.postMessage(null);\r\n break;\r\n case \"diffpath\":\r\n var diff = diffTree.DiffPath(data.arguments[0], data.arguments[1]);\r\n ctx.postMessage(diff);\r\n break;\r\n case \"diffbatch\":\r\n var diff = diffTree.DiffBatch(data.arguments[0]);\r\n ctx.postMessage(diff);\r\n break;\r\n case \"updatepath\":\r\n diffTree.UpdatePath(data.arguments[0], data.arguments[1]);\r\n ctx.postMessage(null);\r\n break;\r\n case \"getpath\":\r\n var ret = diffTree.GetPath(data.arguments[0]);\r\n ctx.postMessage(ret);\r\n break;\r\n }\r\n };\r\n }\r\n const jsonConstructor = {}.constructor;\r\n function IsValue(value) {\r\n if (!value)\r\n return true;\r\n return !(jsonConstructor === value.constructor || Array.isArray(value));\r\n }\r\n class DiffTree {\r\n constructor(keyFunc) {\r\n this.keyFunc = keyFunc;\r\n this.rootStateMap = new Map();\r\n }\r\n static GetKeyRef(key) {\r\n return `___DiffTreeKeyRef.${key}`;\r\n }\r\n static ReadKeyRef(ref) {\r\n if (!ref)\r\n return undefined;\r\n var matches = ref.match(/^___DiffTreeKeyRef\\.([^.]+$)/);\r\n if (!matches)\r\n return undefined;\r\n return matches[1];\r\n }\r\n DiffBatch(data) {\r\n var resp = [];\r\n ;\r\n for (var x = 0; x < data.length; x++)\r\n this.RunDiff(data[x].path, data[x].value, resp);\r\n return resp;\r\n }\r\n DiffPath(path, value) {\r\n var resp = [];\r\n this.RunDiff(path, value, resp);\r\n return resp;\r\n }\r\n UpdatePath(path, value) {\r\n this.SetPathValue(path, value);\r\n }\r\n GetPath(path) {\r\n return this.GetPathValue(path);\r\n }\r\n RunDiff(path, value, diffResp) {\r\n var breakupMap = this.GetBreakUpMap(path, value);\r\n var resp = diffResp || [];\r\n breakupMap.forEach((value, key) => {\r\n var currentValue = key.split(\".\").reduce((pre, curr, index) => {\r\n if (index === 0)\r\n return this.rootStateMap.get(curr);\r\n return pre && pre[curr];\r\n }, null);\r\n this.DiffJson(key, value, currentValue, resp);\r\n });\r\n for (var x = 0; x < resp.length; x++)\r\n this.SetPathValue(resp[x].path, resp[x].value);\r\n }\r\n GetPathValue(path) {\r\n var parts = path.split(\".\");\r\n var curr = this.rootStateMap.get(parts[0]);\r\n for (var x = 1; x < parts.length; x++)\r\n curr = curr && curr[parts[x]];\r\n return curr;\r\n }\r\n SetPathValue(path, value) {\r\n var parts = path.split(\".\");\r\n if (parts.length === 1)\r\n this.rootStateMap.set(parts[0], value);\r\n else {\r\n var curr = this.rootStateMap.get(parts[0]);\r\n for (var x = 1; x < parts.length - 1; x++)\r\n curr = curr[parts[x]];\r\n curr[parts[parts.length - 1]] = value;\r\n }\r\n }\r\n GetBreakUpMap(path, value) {\r\n if (!this.keyFunc)\r\n return new Map([[path, value]]);\r\n return this.BreakUpValue(path, value);\r\n }\r\n BreakUpValue(path, parent, prop, map) {\r\n var value = prop ? parent[prop] : parent;\r\n var isValue = IsValue(value);\r\n if (!map && isValue)\r\n return new Map([[path, value]]);\r\n map = map || new Map();\r\n if (isValue)\r\n return map;\r\n var key = this.keyFunc ? this.keyFunc(value) : null;\r\n var keyRef = key && DiffTree.GetKeyRef(key);\r\n if (key && key !== path) {\r\n if (prop)\r\n parent[prop] = keyRef;\r\n this.BreakUpValue(key, value, null, map);\r\n }\r\n else {\r\n for (var subProp in value) {\r\n var childPath = `${path}.${subProp}`;\r\n this.BreakUpValue(childPath, value, subProp, map);\r\n }\r\n }\r\n if (!prop)\r\n map.set(path, key === path ? value : keyRef || value);\r\n return map;\r\n }\r\n DiffJson(path, newValue, oldValue, resp) {\r\n const oldIsValue = IsValue(oldValue);\r\n const newIsValue = IsValue(newValue);\r\n if (oldIsValue || newIsValue) {\r\n if (oldValue !== newValue) {\r\n resp.push({\r\n path,\r\n value: newValue\r\n });\r\n return true;\r\n }\r\n return false;\r\n }\r\n let allChildrenChanged = true;\r\n let childDeleted = false;\r\n const oldIsArray = Array.isArray(oldValue);\r\n const newIsArray = Array.isArray(newValue);\r\n if (oldIsArray !== newIsArray) {\r\n resp.push({\r\n path,\r\n value: newValue\r\n });\r\n return true;\r\n }\r\n const changedPathLength = resp.length;\r\n if (oldIsArray && newIsArray) {\r\n if (oldValue.length === 0 && newValue.length === 0)\r\n return false;\r\n for (let y = 0; y < newValue.length; y++) {\r\n const arrayPath = path ? `${path}.${y}` : `${y}`;\r\n allChildrenChanged = this.DiffJson(arrayPath, newValue[y], oldValue[y], resp) && allChildrenChanged;\r\n }\r\n if (!allChildrenChanged && newValue.length < oldValue.length)\r\n resp.push({\r\n path: path ? `${path}.length` : 'length',\r\n value: newValue.length\r\n });\r\n }\r\n else {\r\n const oldKeys = Reflect.ownKeys(oldValue);\r\n const newKeys = Reflect.ownKeys(newValue);\r\n if (oldKeys && oldKeys.length === 0 && newKeys.length === 0)\r\n return false;\r\n const newKeysSet = new Set(newKeys);\r\n for (let x = 0; x < oldKeys.length && !childDeleted; x++) {\r\n const oldKey = oldKeys[x];\r\n const childPath = path ? `${path}.${oldKey}` : `${oldKey}`;\r\n if (newKeysSet.delete(oldKey))\r\n allChildrenChanged = this.DiffJson(childPath, newValue[oldKey], oldValue[oldKey], resp) && allChildrenChanged;\r\n else if (path)\r\n childDeleted = true;\r\n else\r\n resp.push({\r\n path: childPath,\r\n value: undefined\r\n });\r\n }\r\n newKeysSet.forEach(key => {\r\n const childPath = path ? `${path}.${key}` : `${key}`;\r\n resp.push({\r\n path: childPath,\r\n value: newValue[key]\r\n });\r\n });\r\n }\r\n if (path && (allChildrenChanged || childDeleted)) {\r\n resp.splice(changedPathLength);\r\n resp.push({\r\n path,\r\n value: newValue\r\n });\r\n return true;\r\n }\r\n return false;\r\n }\r\n }\r\n return DiffTree;\r\n}\r\nexports.DiffTreeScope = DiffTreeScope;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffTree_1 = require(\"./diffTree\");\r\nvar DiffWorker;\r\n(function (DiffWorker) {\r\n var workerConstructor = null;\r\n var workerParameter = null;\r\n if (typeof Worker !== 'undefined') {\r\n workerConstructor = Worker;\r\n workerParameter = URL.createObjectURL(new Blob([`(${diffTree_1.DiffTreeScope}).call(this, true)`]));\r\n }\r\n function Create() {\r\n if (!workerConstructor)\r\n throw \"Worker is not available\";\r\n return new workerConstructor(workerParameter);\r\n }\r\n DiffWorker.Create = Create;\r\n})(DiffWorker = exports.DiffWorker || (exports.DiffWorker = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst list_1 = require(\"../../Utils/list\");\r\nclass WorkerQueue {\r\n constructor(worker) {\r\n this.worker = worker;\r\n this.callbacks = list_1.List.Create();\r\n this.worker.onerror = (err) => {\r\n var cb = list_1.List.Pop(this.callbacks);\r\n cb && cb(null, err);\r\n };\r\n this.worker.onmessage = (message) => {\r\n var cb = list_1.List.Pop(this.callbacks);\r\n cb && cb(message.data);\r\n };\r\n }\r\n Push(message) {\r\n return new Promise((resolve, reject) => {\r\n list_1.List.Add(this.callbacks, function (data, err) {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve(data);\r\n });\r\n this.worker.postMessage(message);\r\n });\r\n }\r\n Destroy() {\r\n this.worker.terminate();\r\n }\r\n}\r\nexports.WorkerQueue = WorkerQueue;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableTree_1 = require(\"../Tree/observableTree\");\r\nconst storeWriter_1 = require(\"./storeWriter\");\r\nclass Store {\r\n constructor(init) {\r\n this.observableTree = new observableTree_1.ObservableTree();\r\n this.storeWriter = new storeWriter_1.StoreWriter(this.observableTree);\r\n this.rootScope = this.observableTree.Scope(\"ROOT\", root => root);\r\n if (init)\r\n this.Write(init);\r\n }\r\n get Root() {\r\n return this.rootScope;\r\n }\r\n Action(action) {\r\n var node = this.observableTree.GetNode(\"ROOT\");\r\n action(node.Proxy, this.storeWriter);\r\n }\r\n Write(data) {\r\n this.Action((root, writer) => writer.Write(root, data));\r\n }\r\n Merge(data) {\r\n this.Action((root, writer) => writer.Merge(root, data));\r\n }\r\n Destroy() {\r\n this.rootScope.Destroy();\r\n this.observableTree.Destroy();\r\n }\r\n}\r\nexports.Store = Store;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableTree_1 = require(\"../Tree/observableTree\");\r\nconst diffAsync_1 = require(\"../Diff/diffAsync\");\r\nconst storeAsyncWriter_1 = require(\"./storeAsyncWriter\");\r\nclass StoreAsync {\r\n constructor(idFunc, init) {\r\n this.idFunc = idFunc;\r\n this.diffAsync = new diffAsync_1.DiffAsync(this.idFunc);\r\n this.observableTree = new observableTree_1.ObservableTree(diffAsync_1.DiffAsync.ReadKeyRef);\r\n this.asyncWriter = new storeAsyncWriter_1.StoreAsyncWriter(this.idFunc, this.diffAsync, this.observableTree);\r\n if (init) {\r\n var id = this.idFunc(init);\r\n this.observableTree.Write(id, init);\r\n this.Write(init);\r\n }\r\n }\r\n Scope(id, func) {\r\n return this.observableTree.Scope(id, func);\r\n }\r\n async Action(id, action) {\r\n var node;\r\n if (id)\r\n node = this.observableTree.GetNode(id);\r\n await action(node && node.Proxy, this.asyncWriter);\r\n }\r\n async Write(data) {\r\n await this.Action(null, async (val, writer) => {\r\n await writer.Write(val, data);\r\n });\r\n }\r\n async Merge(id, data) {\r\n await this.Action(id, async (val, writer) => {\r\n await writer.Merge(val, data);\r\n });\r\n }\r\n Destroy() {\r\n this.diffAsync.Destroy();\r\n this.observableTree.Destroy();\r\n }\r\n}\r\nexports.StoreAsync = StoreAsync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nclass StoreAsyncWriter {\r\n constructor(idFunc, diffAsync, observableTree) {\r\n this.idFunc = idFunc;\r\n this.diffAsync = diffAsync;\r\n this.observableTree = observableTree;\r\n }\r\n async Write(source, data) {\r\n var path;\r\n if (source) {\r\n var proxy = source;\r\n path = proxy.___node.Path;\r\n }\r\n else {\r\n path = this.idFunc(data);\r\n if (!path)\r\n throw new Error(\"data must have an id\");\r\n }\r\n var diff = await this.diffAsync.DiffPath(path, data);\r\n this.ApplyChanges(diff);\r\n }\r\n async Merge(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var keys = Object.keys(data);\r\n var message = keys.map(key => ({ path: `${rootPath}.${key}`, value: data[key] }));\r\n var diff = await this.diffAsync.DiffBatch(message);\r\n this.ApplyChanges(diff);\r\n }\r\n async Push(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var lengthPath = `${rootPath}.length`;\r\n var length = await this.diffAsync.GetPath(lengthPath);\r\n var diff = await this.diffAsync.DiffPath(`${rootPath}.${length}`, data);\r\n this.ApplyChanges(diff);\r\n }\r\n async Splice(source, start, deleteCount, ...items) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var array = await this.diffAsync.GetPath(rootPath);\r\n array = array.slice();\r\n array.splice(start, deleteCount, ...items);\r\n var diff = await this.diffAsync.DiffPath(rootPath, array);\r\n this.ApplyChanges(diff);\r\n }\r\n ApplyChanges(diff) {\r\n this.observableTree.WriteAll(diff);\r\n }\r\n}\r\nexports.StoreAsyncWriter = StoreAsyncWriter;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffSync_1 = require(\"../Diff/diffSync\");\r\nconst observableTree_1 = require(\"../Tree/observableTree\");\r\nconst storeSyncWriter_1 = require(\"./storeSyncWriter\");\r\nclass StoreSync {\r\n constructor(init) {\r\n this.diffSync = new diffSync_1.DiffSync();\r\n this.observableTree = new observableTree_1.ObservableTree();\r\n this.storeWriter = new storeSyncWriter_1.StoreSyncWriter(this.diffSync, this.observableTree);\r\n this.rootScope = this.observableTree.Scope(\"ROOT\", root => root);\r\n if (init)\r\n this.Write(init);\r\n }\r\n get Root() {\r\n return this.rootScope;\r\n }\r\n Action(action) {\r\n var node = this.observableTree.GetNode(\"ROOT\");\r\n action(node.Proxy, this.storeWriter);\r\n }\r\n Write(data) {\r\n this.Action((root, writer) => writer.Write(root, data));\r\n }\r\n Merge(data) {\r\n this.Action((root, writer) => writer.Merge(root, data));\r\n }\r\n Destroy() {\r\n this.rootScope.Destroy();\r\n this.observableTree.Destroy();\r\n }\r\n}\r\nexports.StoreSync = StoreSync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nclass StoreSyncWriter {\r\n constructor(diffSync, observableTree) {\r\n this.diffSync = diffSync;\r\n this.observableTree = observableTree;\r\n }\r\n Write(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy && proxy.___node.Path || \"ROOT\";\r\n var diff = this.diffSync.DiffPath(rootPath, data);\r\n this.ApplyChanges(diff);\r\n }\r\n Merge(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var keys = Object.keys(data);\r\n var message = keys.map(key => ({ path: `${rootPath}.${key}`, value: data[key] }));\r\n var diff = this.diffSync.DiffBatch(message);\r\n this.ApplyChanges(diff);\r\n }\r\n Push(source, data) {\r\n var array = source;\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var length = array.length;\r\n this.diffSync.UpdatePath(`${rootPath}.${length}`, data);\r\n proxy.___node.Push(data);\r\n }\r\n Splice(source, start, deleteCount, ...items) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var array = this.observableTree.Get(rootPath);\r\n array = array.map(val => val);\r\n array.splice(start, deleteCount, ...items);\r\n this.diffSync.UpdatePath(rootPath, array);\r\n return proxy.___node.Splice(start, deleteCount, ...items);\r\n }\r\n ApplyChanges(diff) {\r\n this.observableTree.WriteAll(diff);\r\n }\r\n}\r\nexports.StoreSyncWriter = StoreSyncWriter;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableProxy_1 = require(\"../Tree/observableProxy\");\r\nclass StoreWriter {\r\n constructor(observableTree) {\r\n this.observableTree = observableTree;\r\n }\r\n Write(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy && proxy.___node.Path || \"ROOT\";\r\n this.observableTree.Write(rootPath, data);\r\n }\r\n Merge(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n if (observableProxy_1.ObservableProxy.TypeOf(data) === observableProxy_1.Type.Value)\r\n this.observableTree.Write(rootPath, data);\r\n else\r\n for (var key in data)\r\n this.observableTree.Write(`${rootPath}.${key}`, data[key]);\r\n }\r\n Push(source, data) {\r\n var proxy = source;\r\n proxy.___node.Push(data);\r\n }\r\n Splice(source, start, deleteCount, ...items) {\r\n var proxy = source;\r\n proxy.___node.Splice(start, deleteCount, ...items);\r\n }\r\n}\r\nexports.StoreWriter = StoreWriter;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableProxy_1 = require(\"./observableProxy\");\r\nconst observableScope_1 = require(\"./observableScope\");\r\nclass ObservableNode {\r\n constructor(tree, key, parent, valuePathResolver) {\r\n this.tree = tree;\r\n this.key = key;\r\n this.parent = parent;\r\n this.valuePathResolver = valuePathResolver;\r\n this.destroyed = false;\r\n this.children = new Map();\r\n this.path = undefined;\r\n this.scope = observableScope_1.ObservableScope.Create(() => {\r\n var value = this.tree.Get(this.Path);\r\n var type = observableProxy_1.ObservableProxy.TypeOf(value);\r\n var resolvedPath = this.valuePathResolver && type === observableProxy_1.Type.Value && typeof value === 'string' ? this.valuePathResolver(value) || this.Path : this.Path;\r\n var self = this.Path === resolvedPath ? this : this.tree.GetNode(resolvedPath);\r\n var proxy = this === self ?\r\n type === observableProxy_1.Type.Value ?\r\n value :\r\n observableProxy_1.ObservableProxy.CreateFrom(this, type) :\r\n self.Proxy;\r\n return {\r\n value: value,\r\n type: observableProxy_1.ObservableProxy.TypeOf(value),\r\n self: self,\r\n proxy: proxy\r\n };\r\n });\r\n }\r\n get Key() {\r\n return this.key;\r\n }\r\n get Path() {\r\n if (this.path === undefined)\r\n this.path = (this.parent ? this.parent.Path + \".\" : \"\") + this.key;\r\n return this.path;\r\n }\r\n get Value() {\r\n return observableScope_1.ObservableScope.Value(this.scope).value;\r\n }\r\n get Type() {\r\n return observableScope_1.ObservableScope.Value(this.scope).type;\r\n }\r\n get Self() {\r\n return observableScope_1.ObservableScope.Value(this.scope).self;\r\n }\r\n get Proxy() {\r\n return observableScope_1.ObservableScope.Value(this.scope).proxy;\r\n }\r\n get ProxyArray() {\r\n if (this.Type !== observableProxy_1.Type.Array) {\r\n this.arrayScope && this.arrayScope.Destroy();\r\n this.arrayScope = null;\r\n return null;\r\n }\r\n this.arrayScope = this.arrayScope || observableScope_1.ObservableScope.Create(() => this.Value.map((c, i) => this.EnsureChild(i.toString()).Proxy));\r\n return observableScope_1.ObservableScope.Value(this.arrayScope);\r\n }\r\n get Parent() {\r\n return this.parent;\r\n }\r\n get Children() {\r\n return this.children;\r\n }\r\n UpdateKey(newKey) {\r\n if (!this.parent)\r\n return;\r\n this.parent.children.delete(this.key);\r\n this.parent.children.set(newKey, this);\r\n this.key = newKey;\r\n this.path = undefined;\r\n }\r\n EnsureChild(key) {\r\n var child = this.children.get(key);\r\n if (!child) {\r\n child = new ObservableNode(this.tree, key, this, this.valuePathResolver);\r\n this.children.set(key, child);\r\n }\r\n return child;\r\n }\r\n Update() {\r\n this.children.clear();\r\n observableScope_1.ObservableScope.Update(this.scope);\r\n }\r\n ArrayUpdate() {\r\n observableScope_1.ObservableScope.Update(this.arrayScope);\r\n var lengthNode = this.children.get('length');\r\n if (lengthNode)\r\n lengthNode.Update();\r\n observableScope_1.ObservableScope.Emit(this.scope);\r\n }\r\n Destroy() {\r\n this.destroyed = true;\r\n this.parent && !this.parent.destroyed && this.parent.Children.delete(this.key);\r\n this.children.forEach(c => c.Destroy());\r\n observableScope_1.ObservableScope.Destroy(this.scope);\r\n observableScope_1.ObservableScope.Destroy(this.arrayScope);\r\n }\r\n Push(data) {\r\n var array = this.Value;\r\n if (!Array.isArray(array))\r\n throw new Error(\"Node value is not an array.\");\r\n var ret = array.push(data);\r\n this.ArrayUpdate();\r\n return ret;\r\n }\r\n Splice(start, deleteCount, ...items) {\r\n deleteCount = deleteCount || 0;\r\n var array = this.Value;\r\n if (!Array.isArray(array))\r\n throw new Error(\"Node value is not an array.\");\r\n var startLength = array.length;\r\n var ret = array.splice(start, deleteCount, ...items);\r\n var x = start;\r\n var key = null;\r\n var newKey = null;\r\n var child = null;\r\n for (; x < (start + deleteCount); x++) {\r\n key = x.toString();\r\n child = this.Children.get(key);\r\n if (child)\r\n child.Destroy();\r\n }\r\n if (startLength < array.length)\r\n for (var y = startLength - 1; y >= x; y--) {\r\n key = y.toString();\r\n child = this.Children.get(key);\r\n if (child) {\r\n newKey = (y - deleteCount + items.length).toString();\r\n child.UpdateKey(newKey);\r\n }\r\n }\r\n else\r\n for (; x < startLength; x++) {\r\n key = x.toString();\r\n child = this.Children.get(key);\r\n if (child) {\r\n newKey = (x - deleteCount + items.length).toString();\r\n child.UpdateKey(newKey);\r\n }\r\n }\r\n this.ArrayUpdate();\r\n return ret;\r\n }\r\n}\r\nexports.ObservableNode = ObservableNode;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Type;\r\n(function (Type) {\r\n Type[Type[\"Value\"] = 0] = \"Value\";\r\n Type[Type[\"Object\"] = 1] = \"Object\";\r\n Type[Type[\"Array\"] = 2] = \"Array\";\r\n})(Type = exports.Type || (exports.Type = {}));\r\nvar ObservableProxy;\r\n(function (ObservableProxy) {\r\n function TypeOf(value) {\r\n if (!value)\r\n return Type.Value;\r\n if (Array.isArray(value))\r\n return Type.Array;\r\n else if (typeof value === 'object')\r\n return Type.Object;\r\n return Type.Value;\r\n }\r\n ObservableProxy.TypeOf = TypeOf;\r\n function CreateFrom(node, type) {\r\n switch (type) {\r\n case Type.Array:\r\n return CreateArrayProxy(node);\r\n case Type.Object:\r\n return CreateObjectProxy(node);\r\n default:\r\n throw new Error(\"Can't create proxy from Value type\");\r\n }\r\n }\r\n ObservableProxy.CreateFrom = CreateFrom;\r\n function CopyValue(value) {\r\n var type = TypeOf(value);\r\n if (type === Type.Value)\r\n return value;\r\n if (typeof value.toJSON === 'function')\r\n return value.toJSON();\r\n if (type === Type.Array)\r\n return value.map(v => CopyValue(v));\r\n else if (type === Type.Object) {\r\n var ret = {};\r\n for (var key in value)\r\n ret[key] = CopyValue(value[key]);\r\n return ret;\r\n }\r\n return null;\r\n }\r\n ObservableProxy.CopyValue = CopyValue;\r\n})(ObservableProxy = exports.ObservableProxy || (exports.ObservableProxy = {}));\r\nfunction CreateArrayProxy(node) {\r\n return new Proxy([], {\r\n get: (obj, prop) => {\r\n switch (prop) {\r\n case '___type':\r\n return Type.Array;\r\n case '___storeProxy':\r\n return true;\r\n case '___node':\r\n return node;\r\n case 'toJSON':\r\n return () => {\r\n return CopyNode(node);\r\n };\r\n case 'length':\r\n return node.EnsureChild(prop).Value;\r\n default:\r\n if (typeof (prop) === 'symbol')\r\n return node.ProxyArray[prop];\r\n if (!isNaN(parseInt(prop)))\r\n return node.EnsureChild(prop).Proxy;\r\n var func = obj[prop];\r\n return func && func.bind(node.ProxyArray);\r\n }\r\n },\r\n ownKeys: () => {\r\n return Reflect.ownKeys(node.Value);\r\n }\r\n });\r\n}\r\nfunction CreateObjectProxy(node) {\r\n return new Proxy({}, {\r\n get: (obj, prop) => {\r\n switch (prop) {\r\n case '___type':\r\n return Type.Object;\r\n case '___storeProxy':\r\n return true;\r\n case '___node':\r\n return node;\r\n case 'toJSON':\r\n return () => {\r\n return CopyNode(node);\r\n };\r\n default:\r\n if (typeof (prop) !== 'symbol')\r\n return node.EnsureChild(prop).Proxy;\r\n return obj[prop];\r\n }\r\n },\r\n ownKeys: () => {\r\n return Reflect.ownKeys(node.Value);\r\n }\r\n });\r\n}\r\nfunction CopyNode(node) {\r\n if (node.Type === Type.Value)\r\n return node.Value;\r\n var ret = null;\r\n if (node.Type === Type.Array)\r\n ret = node.Value.map((v, i) => CopyNode(node.Self.EnsureChild(i.toString()).Self));\r\n else {\r\n ret = {};\r\n for (var key in node.Value) {\r\n var child = node.Self.EnsureChild(key);\r\n ret[key] = CopyNode(child.Self);\r\n }\r\n }\r\n return ret;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst emitter_1 = require(\"../../Utils/emitter\");\r\nclass ObservableScopeValue {\r\n constructor(scope) {\r\n this.scope = scope;\r\n }\r\n get Value() {\r\n return ObservableScope.Value(this.scope);\r\n }\r\n}\r\nexports.ObservableScopeValue = ObservableScopeValue;\r\nclass ObservableScopeWrapper extends ObservableScopeValue {\r\n constructor(scope) {\r\n super(scope);\r\n if (scope.emitter) {\r\n this.scopeEmitter = emitter_1.Emitter.Create();\r\n emitter_1.Emitter.On(scope.emitter, () => emitter_1.Emitter.Emit(this.scopeEmitter, this));\r\n }\r\n }\r\n Scope(callback) {\r\n return new ObservableScope(() => callback(this.Value));\r\n }\r\n Watch(callback) {\r\n if (!this.scopeEmitter)\r\n return;\r\n emitter_1.Emitter.On(this.scopeEmitter, callback);\r\n callback(this);\r\n }\r\n Unwatch(callback) {\r\n if (!this.scopeEmitter)\r\n return;\r\n emitter_1.Emitter.Remove(this.scopeEmitter, callback);\r\n }\r\n Destroy() {\r\n DestroyScope(this.scope);\r\n this.scopeEmitter && this.scopeEmitter.clear();\r\n }\r\n}\r\nexports.ObservableScopeWrapper = ObservableScopeWrapper;\r\nclass ObservableScope extends ObservableScopeWrapper {\r\n constructor(getFunction) {\r\n super(ObservableScope.Create(getFunction));\r\n }\r\n}\r\nexports.ObservableScope = ObservableScope;\r\nvar currentSet = null;\r\nvar watching = false;\r\nfunction WatchAction(action) {\r\n var parentSet = currentSet;\r\n currentSet = null;\r\n var parentWatching = watching;\r\n watching = true;\r\n action();\r\n var lastSet = currentSet;\r\n currentSet = parentSet;\r\n watching = parentWatching;\r\n return lastSet;\r\n}\r\n(function (ObservableScope) {\r\n function Create(valueFunction) {\r\n if (typeof valueFunction !== 'function')\r\n return {\r\n value: valueFunction,\r\n dirty: false,\r\n destroyed: false\r\n };\r\n var scope = {\r\n getFunction: valueFunction,\r\n async: valueFunction[Symbol.toStringTag] === 'AsyncFunction',\r\n value: null,\r\n dirty: true,\r\n emitter: emitter_1.Emitter.Create(),\r\n emitters: null,\r\n destroyed: false,\r\n setCallback: function () {\r\n OnSet(scope);\r\n }\r\n };\r\n return scope;\r\n }\r\n ObservableScope.Create = Create;\r\n function Register(emitter) {\r\n if (!watching || !emitter)\r\n return;\r\n currentSet = currentSet || new Set();\r\n currentSet.add(emitter);\r\n }\r\n ObservableScope.Register = Register;\r\n function Value(scope) {\r\n if (!scope)\r\n return undefined;\r\n Register(scope.emitter);\r\n UpdateValue(scope);\r\n return scope.value;\r\n }\r\n ObservableScope.Value = Value;\r\n function Watch(scope, callback) {\r\n if (!scope || !scope.emitter)\r\n return;\r\n emitter_1.Emitter.On(scope.emitter, callback);\r\n }\r\n ObservableScope.Watch = Watch;\r\n function Unwatch(scope, callback) {\r\n if (!scope || !scope.emitter)\r\n return;\r\n emitter_1.Emitter.Remove(scope.emitter, callback);\r\n }\r\n ObservableScope.Unwatch = Unwatch;\r\n function Update(scope) {\r\n OnSet(scope);\r\n }\r\n ObservableScope.Update = Update;\r\n function Emit(scope) {\r\n emitter_1.Emitter.Emit(scope.emitter);\r\n }\r\n ObservableScope.Emit = Emit;\r\n function Destroy(scope) {\r\n DestroyScope(scope);\r\n }\r\n ObservableScope.Destroy = Destroy;\r\n})(ObservableScope = exports.ObservableScope || (exports.ObservableScope = {}));\r\nfunction OnSet(scope) {\r\n if (!scope || scope.dirty)\r\n return;\r\n scope.dirty = true;\r\n emitter_1.Emitter.Emit(scope.emitter, scope);\r\n}\r\nfunction UpdateValue(scope) {\r\n if (!scope.dirty)\r\n return;\r\n scope.dirty = false;\r\n var value = null;\r\n var emitters = WatchAction(() => value = scope.getFunction());\r\n UpdateEmitters(scope, emitters);\r\n if (scope.async)\r\n Promise.resolve(value).then(val => {\r\n scope.value = val;\r\n emitter_1.Emitter.Emit(scope.emitter, scope);\r\n });\r\n else\r\n scope.value = value;\r\n}\r\nfunction DestroyScope(scope) {\r\n if (!scope)\r\n return;\r\n scope.emitters && scope.emitters.forEach(e => emitter_1.Emitter.Remove(e, scope.setCallback));\r\n scope.emitters && scope.emitters.clear();\r\n scope.emitter && scope.emitter.clear();\r\n scope.destroyed = true;\r\n}\r\nfunction UpdateEmitters(scope, newEmitters) {\r\n if (newEmitters)\r\n newEmitters.forEach(e => {\r\n if (!scope.emitters || !scope.emitters.delete(e))\r\n emitter_1.Emitter.On(e, scope.setCallback);\r\n });\r\n if (scope.emitters)\r\n scope.emitters.forEach(e => emitter_1.Emitter.Remove(e, scope.setCallback));\r\n scope.emitters = newEmitters;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableNode_1 = require(\"./observableNode\");\r\nconst observableProxy_1 = require(\"./observableProxy\");\r\nconst observableScope_1 = require(\"./observableScope\");\r\nclass ObservableTree {\r\n constructor(valuePathResolver) {\r\n this.valuePathResolver = valuePathResolver;\r\n this.rootStateMap = new Map();\r\n this.rootNodeMap = new Map();\r\n }\r\n Write(path, value) {\r\n this.WritePath(path, value);\r\n this.UpdatePathNode(path);\r\n }\r\n WriteAll(data) {\r\n for (var x = 0; x < data.length; x++)\r\n this.WritePath(data[x].path, data[x].value);\r\n for (var y = 0; y < data.length; y++)\r\n this.UpdatePathNode(data[y].path);\r\n }\r\n Get(path) {\r\n return path.split(\".\").reduce((pre, curr, index) => {\r\n if (index === 0)\r\n return this.rootStateMap.get(curr);\r\n return pre && pre[curr];\r\n }, null);\r\n }\r\n GetNode(path) {\r\n return path.split(\".\").reduce((pre, curr, index) => {\r\n if (index === 0) {\r\n var ret = this.rootNodeMap.get(curr);\r\n if (!ret) {\r\n ret = new observableNode_1.ObservableNode(this, curr, null, this.valuePathResolver);\r\n this.rootNodeMap.set(curr, ret);\r\n }\r\n return ret;\r\n }\r\n return pre.EnsureChild(curr);\r\n }, null);\r\n }\r\n Delete(path) {\r\n var node = this.GetNode(path);\r\n node.Destroy();\r\n }\r\n Destroy() {\r\n this.rootStateMap.clear();\r\n this.rootNodeMap.forEach(node => node.Destroy());\r\n this.rootNodeMap.clear();\r\n }\r\n Scope(path, func) {\r\n return new observableScope_1.ObservableScope(() => {\r\n var node = this.GetNode(path);\r\n return func && func(node.Proxy) || node.Proxy;\r\n });\r\n }\r\n WritePath(path, value) {\r\n var pathParts = path.split(\".\");\r\n var rootPart = pathParts[0];\r\n if (pathParts.length === 1)\r\n this.rootStateMap.set(rootPart, value);\r\n else {\r\n var curValue = this.rootStateMap.get(rootPart);\r\n for (var x = 1; x < pathParts.length - 1; x++) {\r\n if (!curValue)\r\n throw new Error(\"Unable to write path: \" + path + \". Falsey value found at: \" + pathParts.slice(0, x).join(\".\"));\r\n curValue = curValue[pathParts[x]];\r\n }\r\n if (!curValue)\r\n throw new Error(\"Unable to write path: \" + path + \". Falsey value found at: \" + pathParts.slice(0, x).join(\".\"));\r\n curValue[pathParts[x]] = value;\r\n }\r\n }\r\n UpdatePathNode(path) {\r\n var node = this.GetNode(path);\r\n node.Update();\r\n if (node.Parent && node.Parent.Type === observableProxy_1.Type.Array) {\r\n node.Parent.ArrayUpdate();\r\n if (node.Key === 'length') {\r\n var index = node.Value;\r\n var childNode = node.Parent.Children.get(index.toString());\r\n while (childNode) {\r\n childNode.Destroy();\r\n index++;\r\n childNode = node.Parent.Children.get(index.toString());\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.ObservableTree = ObservableTree;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar store_1 = require(\"./Store/store\");\r\nexports.Store = store_1.Store;\r\nvar storeSync_1 = require(\"./Store/storeSync\");\r\nexports.StoreSync = storeSync_1.StoreSync;\r\nvar storeAsync_1 = require(\"./Store/storeAsync\");\r\nexports.StoreAsync = storeAsync_1.StoreAsync;\r\nvar observableScope_1 = require(\"./Tree/observableScope\");\r\nexports.ObservableScope = observableScope_1.ObservableScope;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar StepFunctions;\r\n(function (StepFunctions) {\r\n function* EaseIn(count) {\r\n var diff = 1 / count;\r\n for (var t = diff, x = 0; x < count; x++, t += diff)\r\n yield (1 - t) * (1 - t) * (1 - t) * 0 + 3 * (1 - t) * (1 - t) * t * 1 + 3 * (1 - t) * t * t * 1 + t * t * t * 1;\r\n }\r\n StepFunctions.EaseIn = EaseIn;\r\n function* Linear(count) {\r\n var diff = 1 / count;\r\n for (var t = diff, x = 0; x < count; x++, t += diff)\r\n yield t;\r\n }\r\n StepFunctions.Linear = Linear;\r\n})(StepFunctions || (StepFunctions = {}));\r\nvar AnimationType;\r\n(function (AnimationType) {\r\n AnimationType[AnimationType[\"Linear\"] = 0] = \"Linear\";\r\n AnimationType[AnimationType[\"EaseIn\"] = 1] = \"EaseIn\";\r\n})(AnimationType = exports.AnimationType || (exports.AnimationType = {}));\r\nclass Animation {\r\n constructor(type, duration, update) {\r\n this.running = false;\r\n this.start = null;\r\n this.end = null;\r\n this.enabled = true;\r\n this.type = type;\r\n this.frameCount = Math.ceil((duration / 1000) * 60);\r\n this.frameTimings = [];\r\n var frameTime = duration / this.frameCount;\r\n for (var x = 0; x < this.frameCount; x++)\r\n this.frameTimings[x] = (x + 1) * frameTime;\r\n this.update = update;\r\n this.animationTimeouts = [];\r\n }\r\n get Running() {\r\n return this.running;\r\n }\r\n get Start() {\r\n return this.start;\r\n }\r\n get End() {\r\n return this.end;\r\n }\r\n get Enabled() {\r\n return this.enabled;\r\n }\r\n Animate(start, end) {\r\n if (!this.enabled)\r\n return;\r\n var diff = end - start;\r\n if (diff === 0)\r\n return;\r\n this.Cancel();\r\n this.running = true;\r\n this.start = start;\r\n this.end = end;\r\n return new Promise(resolve => {\r\n var stepFunc = StepFunctions[AnimationType[this.type]];\r\n var index = 0;\r\n for (var step of stepFunc(this.frameCount)) {\r\n var value = (step * diff) + start;\r\n this.SetTimeout(index, value, index === (this.frameCount - 1) ? resolve : null);\r\n index++;\r\n }\r\n }).then(() => {\r\n this.running = false;\r\n this.start = null;\r\n this.end = null;\r\n });\r\n }\r\n Disable() {\r\n this.Cancel();\r\n this.enabled = false;\r\n }\r\n Enable() {\r\n this.enabled = true;\r\n }\r\n Cancel() {\r\n for (var x = 0; x < this.animationTimeouts.length; x++)\r\n clearTimeout(this.animationTimeouts[x]);\r\n this.running = false;\r\n this.start = null;\r\n this.end = null;\r\n }\r\n Destroy() {\r\n this.Cancel();\r\n }\r\n SetTimeout(index, value, resolve) {\r\n this.animationTimeouts[index] = setTimeout(() => {\r\n this.update(value);\r\n resolve && resolve();\r\n }, this.frameTimings[index]);\r\n }\r\n}\r\nexports.Animation = Animation;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst store_1 = require(\"../Store/Store/store\");\r\nconst Store_1 = require(\"../Store\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nfunction State() {\r\n return StateDecorator;\r\n}\r\nexports.State = State;\r\nfunction StateDecorator(target, propertyKey) {\r\n const propKey = `StoreDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n return store ? store.Root.Value : null;\r\n },\r\n set: function (val) {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n if (!store)\r\n map.set(propKey, new store_1.Store(val));\r\n else\r\n store.Merge(val);\r\n }\r\n };\r\n}\r\nfunction StateSync() {\r\n return StateSyncDecorator;\r\n}\r\nexports.StateSync = StateSync;\r\nfunction StateSyncDecorator(target, propertyKey) {\r\n const propKey = `StoreSyncDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n return store ? store.Root.Value : null;\r\n },\r\n set: function (val) {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n if (!store)\r\n map.set(propKey, new Store_1.StoreSync(val));\r\n else\r\n store.Merge(val);\r\n }\r\n };\r\n}\r\nfunction StateAsync() {\r\n return StateAsyncDecorator;\r\n}\r\nexports.StateAsync = StateAsync;\r\nfunction StateAsyncDecorator(target, propertyKey) {\r\n const propKey = `StoreAsyncDecorator_${propertyKey}`;\r\n const scopeKey = `StoreAsyncDecorator_Scope_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n DestroyDecorator(target, scopeKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var scope = map.get(scopeKey);\r\n return scope ? scope.Value : null;\r\n },\r\n set: function (val) {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n if (!store) {\r\n store = new Store_1.StoreAsync((val) => val.___id, { ___id: \"ROOT\", data: val });\r\n map.set(propKey, store);\r\n map.set(scopeKey, store.Scope(\"ROOT\", val => val.data));\r\n }\r\n else\r\n store.Action(\"ROOT\", async (root, writer) => await writer.Merge(root.data, val));\r\n }\r\n };\r\n}\r\nfunction Scope() {\r\n return ScopeDecorator;\r\n}\r\nexports.Scope = Scope;\r\nfunction ScopeDecorator(target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"Scope decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"Scope decorator does not support setters\";\r\n const propKey = `ScopeDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var scope = map.get(propKey);\r\n if (!scope) {\r\n const getter = descriptor.get.bind(this);\r\n scope = new observableScope_1.ObservableScope(getter);\r\n map.set(propKey, scope);\r\n }\r\n return scope.Value;\r\n }\r\n };\r\n}\r\nfunction DestroyScope() {\r\n return DestroyScopeDecorator;\r\n}\r\nexports.DestroyScope = DestroyScope;\r\nfunction DestroyScopeDecorator(target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"Destroy Scope decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"Destroy Scope decorator does not support setters\";\r\n const propKey = `ScopeDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n const valKey = `ScopeDecorator_${propertyKey}_Value`;\r\n DestroyDecorator(target, valKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var scope = map.get(propKey);\r\n if (!scope) {\r\n const getter = descriptor.get.bind(this);\r\n scope = new observableScope_1.ObservableScope(getter);\r\n map.set(propKey, scope);\r\n scope.Watch(scope => {\r\n var lastValue = map.get(valKey);\r\n lastValue && lastValue.Destroy();\r\n map.set(valKey, scope.Value);\r\n });\r\n }\r\n return scope.Value;\r\n }\r\n };\r\n}\r\nfunction Computed() {\r\n return ComputedDecorator;\r\n}\r\nexports.Computed = Computed;\r\nfunction ComputedDecorator(target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"Computed decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"Computed decorator does not support setters\";\r\n const scopeKey = `ComputedDecorator_Scope_${propertyKey}`;\r\n const storeKey = `ComputedDecorator_Store_${propertyKey}`;\r\n DestroyDecorator(target, scopeKey);\r\n DestroyDecorator(target, storeKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var store = map.get(storeKey);\r\n if (!store) {\r\n const getter = descriptor.get.bind(this);\r\n const scope = new observableScope_1.ObservableScope(getter);\r\n store = new Store_1.StoreSync(scope.Value);\r\n scope.Watch(scope => {\r\n if (!this.Destroyed)\r\n store.Write(scope.Value);\r\n });\r\n map.set(scopeKey, scope);\r\n map.set(storeKey, store);\r\n }\r\n return store.Root.Value;\r\n }\r\n };\r\n}\r\nfunction ComputedAsync(idFunc) {\r\n return ComputedAsyncDecorator.bind(null, idFunc);\r\n}\r\nexports.ComputedAsync = ComputedAsync;\r\nfunction ComputedAsyncDecorator(idFunc, target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"ComputedAsync decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"ComputedAsync decorator does not support setters\";\r\n const scopeKey = `ComputedDecorator_Scope_${propertyKey}`;\r\n const storeKey = `ComputedDecorator_Store_${propertyKey}`;\r\n const storeScopeKey = `ComputedDecorator_StoreScope_${propertyKey}`;\r\n DestroyDecorator(target, scopeKey);\r\n DestroyDecorator(target, storeKey);\r\n DestroyDecorator(target, storeScopeKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var storeScope = map.get(storeScopeKey);\r\n if (!storeScope) {\r\n const getter = descriptor.get.bind(this);\r\n const scope = new observableScope_1.ObservableScope(() => {\r\n var value = getter();\r\n if (value && typeof value.toJSON === 'function')\r\n value = value.toJSON();\r\n return value;\r\n });\r\n const store = new Store_1.StoreAsync((val) => val._id, { _id: \"ROOT\", data: scope.Value });\r\n scope.Watch(scope => {\r\n if (!this.Destroyed)\r\n store.Write({ _id: \"ROOT\", data: scope.Value });\r\n });\r\n storeScope = store.Scope(\"ROOT\", (val) => val.data);\r\n map.set(storeScopeKey, storeScope);\r\n map.set(scopeKey, scope);\r\n map.set(storeKey, store);\r\n }\r\n return storeScope.Value;\r\n }\r\n };\r\n}\r\nfunction Inject(type) {\r\n return InjectorDecorator.bind(null, type);\r\n}\r\nexports.Inject = Inject;\r\nfunction InjectorDecorator(type, target, propertyKey, descriptor) {\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n return this.Injector.Get(type);\r\n },\r\n set: function (val) {\r\n this.Injector.Set(type, val);\r\n }\r\n };\r\n}\r\nfunction Destroy() {\r\n return DestroyDecorator;\r\n}\r\nexports.Destroy = Destroy;\r\n(function (Destroy) {\r\n function Get(value) {\r\n return value && value.DestroyDecorator_Destroys || [];\r\n }\r\n function All(value) {\r\n var arr = Get(value);\r\n arr.map(prop => (value[prop] || value.DecoratorMap.get(prop)))\r\n .filter(o => !!o)\r\n .forEach(o => o.Destroy());\r\n }\r\n Destroy.All = All;\r\n})(Destroy = exports.Destroy || (exports.Destroy = {}));\r\nfunction DestroyDecorator(target, propertyKey) {\r\n var proto = target;\r\n proto.DestroyDecorator_Destroys = proto.DestroyDecorator_Destroys || [];\r\n proto.DestroyDecorator_Destroys.push(propertyKey);\r\n}\r\nfunction PreReqTemplate(template) {\r\n return PreReqTemplateDecorator.bind(null, template);\r\n}\r\nexports.PreReqTemplate = PreReqTemplate;\r\n(function (PreReqTemplate) {\r\n function Get(value) {\r\n var func = value && value.PreReqTemplateDecorator_Template;\r\n var ret = func ? func() : [];\r\n if (!Array.isArray(ret))\r\n ret = [ret];\r\n return ret;\r\n }\r\n PreReqTemplate.Get = Get;\r\n})(PreReqTemplate = exports.PreReqTemplate || (exports.PreReqTemplate = {}));\r\nfunction PreReqTemplateDecorator(template, target) {\r\n var proto = target.prototype;\r\n proto.PreReqTemplateDecorator_Template = template;\r\n}\r\nfunction PreReq() {\r\n return PreReqDecorator;\r\n}\r\nexports.PreReq = PreReq;\r\n(function (PreReq) {\r\n function Get(value) {\r\n return value && value.PreReqDecorator_PreReqs || [];\r\n }\r\n function All(value) {\r\n var arr = Get(value).map((prop) => (value[prop] && value[prop].Init) || Promise.resolve());\r\n return Promise.all(arr);\r\n }\r\n PreReq.All = All;\r\n function Has(value) {\r\n return Get(value).length > 0;\r\n }\r\n PreReq.Has = Has;\r\n})(PreReq = exports.PreReq || (exports.PreReq = {}));\r\nfunction PreReqDecorator(target, propertyKey) {\r\n var proto = target;\r\n proto.PreReqDecorator_PreReqs = proto.PreReqDecorator_PreReqs || [];\r\n proto.PreReqDecorator_PreReqs.push(propertyKey);\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Emitter;\r\n(function (Emitter) {\r\n function Create() {\r\n return new Set();\r\n }\r\n Emitter.Create = Create;\r\n function On(emitter, callback) {\r\n emitter.add(callback);\r\n }\r\n Emitter.On = On;\r\n function Emit(emitter, ...args) {\r\n emitter.forEach(function (cb) {\r\n cb(...args);\r\n });\r\n }\r\n Emitter.Emit = Emit;\r\n function Remove(emitter, callback) {\r\n emitter.delete(callback);\r\n }\r\n Emitter.Remove = Remove;\r\n})(Emitter = exports.Emitter || (exports.Emitter = {}));\r\n","\"use strict\";\r\nfunction __export(m) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__export(require(\"./decorators\"));\r\n__export(require(\"./animation\"));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nclass Injector {\r\n constructor() {\r\n this.parent = Injector.Current();\r\n this.typeMap = new Map();\r\n }\r\n Get(type) {\r\n if (this.typeMap.size === 0)\r\n return this.parent && this.parent.Get(type);\r\n var ret = this.typeMap.get(type);\r\n if (!ret)\r\n ret = this.parent && this.parent.Get(type);\r\n return ret;\r\n }\r\n Set(type, instance) {\r\n this.typeMap.set(type, instance);\r\n }\r\n}\r\nexports.Injector = Injector;\r\n(function (Injector) {\r\n var scope = null;\r\n function Current() {\r\n return scope;\r\n }\r\n Injector.Current = Current;\r\n function Scope(injector, action) {\r\n var parent = Current();\r\n scope = injector;\r\n action();\r\n scope = parent;\r\n }\r\n Injector.Scope = Scope;\r\n})(Injector = exports.Injector || (exports.Injector = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar List;\r\n(function (List) {\r\n function Create() {\r\n return {\r\n head: null,\r\n tail: null,\r\n size: 0\r\n };\r\n }\r\n List.Create = Create;\r\n function Clear(list) {\r\n list.head = null;\r\n list.tail = null;\r\n list.size = 0;\r\n }\r\n List.Clear = Clear;\r\n function Push(list, data) {\r\n var node = { previous: null, next: null, data: data };\r\n if (list.size === 0) {\r\n list.head = node;\r\n list.tail = node;\r\n list.size = 1;\r\n }\r\n else {\r\n node.next = list.head;\r\n list.head.previous = node;\r\n list.head = node;\r\n list.size++;\r\n }\r\n return node;\r\n }\r\n List.Push = Push;\r\n function Pop(list) {\r\n if (list.size === 0)\r\n return null;\r\n var node = list.head;\r\n list.head = node.next;\r\n if (list.head)\r\n list.head.previous = null;\r\n list.size--;\r\n if (list.size === 0)\r\n list.tail = null;\r\n return node.data;\r\n }\r\n List.Pop = Pop;\r\n function Add(list, data) {\r\n var node = { previous: null, next: null, data: data };\r\n if (list.size === 0) {\r\n list.head = node;\r\n list.tail = node;\r\n list.size = 1;\r\n }\r\n else {\r\n node.previous = list.tail;\r\n list.tail.next = node;\r\n list.tail = node;\r\n list.size++;\r\n }\r\n return node;\r\n }\r\n List.Add = Add;\r\n function AddBefore(list, node, data) {\r\n if (!node)\r\n return List.Add(list, data);\r\n var newNode = { previous: null, next: null, data: data };\r\n var prevNode = node.previous;\r\n newNode.next = node;\r\n node.previous = newNode;\r\n if (list.head === node)\r\n list.head = newNode;\r\n if (prevNode) {\r\n prevNode.next = newNode;\r\n newNode.previous = prevNode;\r\n }\r\n list.size++;\r\n return newNode;\r\n }\r\n List.AddBefore = AddBefore;\r\n function AddAfter(list, node, data) {\r\n if (!node)\r\n return List.Push(list, data);\r\n var newNode = { previous: null, next: null, data: data };\r\n var nextNode = node.next;\r\n node.next = newNode;\r\n newNode.previous = node;\r\n if (list.tail === node)\r\n list.tail = newNode;\r\n if (nextNode) {\r\n nextNode.previous = newNode;\r\n newNode.next = nextNode;\r\n }\r\n list.size++;\r\n return newNode;\r\n }\r\n List.AddAfter = AddAfter;\r\n function Remove(list) {\r\n if (list.size === 0)\r\n return null;\r\n var node = list.tail;\r\n list.tail = node.previous;\r\n if (list.tail)\r\n list.tail.next = null;\r\n list.size--;\r\n if (list.size === 0)\r\n list.head = null;\r\n return node.data;\r\n }\r\n List.Remove = Remove;\r\n function ForEach(list, callback) {\r\n var node = list.head;\r\n while (node) {\r\n callback(node.data);\r\n node = node.next;\r\n }\r\n }\r\n List.ForEach = ForEach;\r\n})(List = exports.List || (exports.List = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst list_1 = require(\"./list\");\r\nconst workTimeMs = 16;\r\nconst contextQueue = list_1.List.Create();\r\nvar threadContext = null;\r\nvar timeoutRunning = false;\r\nfunction ProcessQueue() {\r\n var workStartTime = Date.now();\r\n var ctx;\r\n while ((Date.now() - workStartTime) < workTimeMs && (ctx = list_1.List.Pop(contextQueue)))\r\n DoWork(ctx, workStartTime);\r\n if (contextQueue.size > 0)\r\n setTimeout(ProcessQueue);\r\n else\r\n timeoutRunning = false;\r\n}\r\nfunction ScheduleWork(ctx) {\r\n list_1.List.Add(contextQueue, ctx);\r\n if (timeoutRunning)\r\n return;\r\n timeoutRunning = true;\r\n setTimeout(ProcessQueue);\r\n}\r\nfunction Invoke(ctx, callback) {\r\n var parent = ctx.workEndNode;\r\n ctx.workEndNode = ctx.workList.head;\r\n callback();\r\n ctx.workEndNode = parent;\r\n}\r\nfunction DoWork(ctx, workStartTime = Date.now()) {\r\n var parentContext = threadContext;\r\n threadContext = ctx;\r\n var async = ctx.async;\r\n var callback;\r\n while (async === ctx.async && (Date.now() - workStartTime) < workTimeMs && (callback = list_1.List.Pop(ctx.workList)))\r\n Invoke(ctx, callback);\r\n if (ctx.workList.size > 0)\r\n ScheduleWork(ctx);\r\n threadContext = parentContext;\r\n}\r\nfunction CreateContext() {\r\n return {\r\n async: false,\r\n workEndNode: null,\r\n workList: list_1.List.Create()\r\n };\r\n}\r\nfunction ScheduleCallback(callback, before, async) {\r\n threadContext = threadContext || CreateContext();\r\n threadContext.async = threadContext.async || async;\r\n if (before)\r\n list_1.List.AddBefore(threadContext.workList, threadContext.workEndNode, callback);\r\n else if (threadContext.workEndNode)\r\n list_1.List.AddAfter(threadContext.workList, threadContext.workEndNode, callback);\r\n else\r\n threadContext.workEndNode = list_1.List.Add(threadContext.workList, callback);\r\n}\r\nfunction SynchWithoutThread(callback) {\r\n var workStartTime = Date.now();\r\n callback();\r\n if (threadContext)\r\n if (threadContext.async)\r\n ScheduleWork(threadContext);\r\n else\r\n DoWork(threadContext, workStartTime);\r\n threadContext = null;\r\n}\r\nfunction Schedule(callback) {\r\n ScheduleCallback(callback, true, true);\r\n}\r\nexports.Schedule = Schedule;\r\nfunction After(callback) {\r\n ScheduleCallback(callback, false, false);\r\n}\r\nexports.After = After;\r\nfunction Callback(callback) {\r\n return function (a, b, c, d) {\r\n Schedule(function () { callback(a, b, c, d); });\r\n };\r\n}\r\nexports.Callback = Callback;\r\nvar inSynchCallback = false;\r\nfunction Synch(callback) {\r\n if (threadContext || inSynchCallback)\r\n callback();\r\n else {\r\n inSynchCallback = true;\r\n SynchWithoutThread(callback);\r\n inSynchCallback = false;\r\n }\r\n}\r\nexports.Synch = Synch;\r\nfunction Thread(callback) {\r\n if (threadContext)\r\n ScheduleCallback(callback, true, false);\r\n else\r\n Synch(callback);\r\n}\r\nexports.Thread = Thread;\r\nfunction ThreadAsync(callback) {\r\n return new Promise(resolve => Thread(function () {\r\n callback();\r\n Thread(resolve);\r\n }));\r\n}\r\nexports.ThreadAsync = ThreadAsync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar component_1 = require(\"./Node/component\");\r\nexports.Component = component_1.Component;\r\n","\"use strict\";\r\nfunction __export(m) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__export(require(\"./index\"));\r\n__export(require(\"./Utils\"));\r\nvar Store_1 = require(\"./Store\");\r\nexports.ObservableScope = Store_1.ObservableScope;\r\nexports.Store = Store_1.Store;\r\nexports.StoreAsync = Store_1.StoreAsync;\r\n__export(require(\"./DOM\"));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst Web = require(\"./web.export\");\r\nfor (var key in Web)\r\n window[key] = Web[key];\r\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/DOM/domNodeConfig.ts","webpack:///./src/DOM/elements.ts","webpack:///./src/DOM/index.ts","webpack:///./src/DOM/svgElements.ts","webpack:///./src/DOM/utils.ts","webpack:///./src/DOM/window.ts","webpack:///./src/Node/boundNode.ts","webpack:///./src/Node/component.ts","webpack:///./src/Node/componentNode.ts","webpack:///./src/Node/elementNode.ts","webpack:///./src/Node/nodeConfig.ts","webpack:///./src/Node/nodeRef.ts","webpack:///./src/Store/Diff/diffAsync.ts","webpack:///./src/Store/Diff/diffSync.ts","webpack:///./src/Store/Diff/diffTree.ts","webpack:///./src/Store/Diff/diffWorker.ts","webpack:///./src/Store/Diff/workerQueue.ts","webpack:///./src/Store/Store/store.ts","webpack:///./src/Store/Store/storeAsync.ts","webpack:///./src/Store/Store/storeAsyncWriter.ts","webpack:///./src/Store/Store/storeSync.ts","webpack:///./src/Store/Store/storeSyncWriter.ts","webpack:///./src/Store/Store/storeWriter.ts","webpack:///./src/Store/Tree/observableNode.ts","webpack:///./src/Store/Tree/observableProxy.ts","webpack:///./src/Store/Tree/observableScope.ts","webpack:///./src/Store/Tree/observableTree.ts","webpack:///./src/Store/index.ts","webpack:///./src/Utils/animation.ts","webpack:///./src/Utils/asyncQueue.ts","webpack:///./src/Utils/decorators.ts","webpack:///./src/Utils/emitter.ts","webpack:///./src/Utils/index.ts","webpack:///./src/Utils/injector.ts","webpack:///./src/Utils/list.ts","webpack:///./src/Utils/thread.ts","webpack:///./src/index.ts","webpack:///./src/web.export.ts","webpack:///./src/web.ts"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;AACb,8CAA8C,cAAc;AAC5D,iBAAiB,mBAAO,CAAC,qCAAU;AACnC,eAAe,mBAAO,CAAC,0CAAe;AACtC,gBAAgB,mBAAO,CAAC,mCAAS;AACjC,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;AC7Ea;AACb,8CAA8C,cAAc;AAC5D,sBAAsB,mBAAO,CAAC,sDAAqB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9Fa;AACb;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D,SAAS,mBAAO,CAAC,yCAAY;AAC7B,SAAS,mBAAO,CAAC,+CAAe;AAChC,SAAS,mBAAO,CAAC,mCAAS;;;;;;;;;;;;;ACPb;AACb,8CAA8C,cAAc;AAC5D,sBAAsB,mBAAO,CAAC,sDAAqB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACfa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC5Ca;AACb,8CAA8C,cAAc;AAC5D,8DAA8D,mBAAO,CAAC,+HAAO;;;;;;;;;;;;;ACFhE;AACb,8CAA8C,cAAc;AAC5D,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,mDAAmD,EAAE;AACnI,8EAA8E,mDAAmD,EAAE;AACnI,0EAA0E,2CAA2C,EAAE;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC,0DAA0D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACtFa;AACb,8CAA8C,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,wCAAW;AACrC,wBAAwB,mBAAO,CAAC,oDAAiB;AACjD,qBAAqB,mBAAO,CAAC,sDAAqB;AAClD,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,KAAK;AACrD;AACA;AACA;AACA,sDAAsD,eAAe;AACrE,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,0DAA0D;;;;;;;;;;;;;ACzE9C;AACb,8CAA8C,cAAc;AAC5D,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,kBAAkB,mBAAO,CAAC,wCAAW;AACrC,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,mBAAmB,mBAAO,CAAC,kDAAmB;AAC9C,qBAAqB,mBAAO,CAAC,sDAAqB;AAClD,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sEAAsE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA,mCAAmC,qBAAqB;AACxD;AACA;AACA;AACA;AACA,uCAAuC,qBAAqB;AAC5D;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA,iBAAiB;AACjB,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb,KAAK;AACL;;;;;;;;;;;;;ACjHa;AACb,8CAA8C,cAAc;AAC5D,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,mBAAmB,mBAAO,CAAC,kDAAmB;AAC9C,eAAe,mBAAO,CAAC,0CAAe;AACtC,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C,kBAAkB,mBAAO,CAAC,wCAAW;AACrC,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gEAAgE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,SAAS;AACT,KAAK;AACL;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA,2BAA2B,kBAAkB;AAC7C;AACA,SAAS;AACT;AACA,mBAAmB,iCAAiC;AACpD,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACrKa;AACb,8CAA8C,cAAc;AAC5D,wBAAwB,mBAAO,CAAC,wDAAsB;AACtD;;;;;;;;;;;;;ACHa;AACb,8CAA8C,cAAc;AAC5D,qBAAqB,mBAAO,CAAC,8CAAc;AAC3C,mBAAmB,mBAAO,CAAC,kDAAmB;AAC9C,oBAAoB,mBAAO,CAAC,4CAAa;AACzC,sBAAsB,mBAAO,CAAC,gDAAe;AAC7C,wBAAwB,mBAAO,CAAC,oDAAiB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gEAAgE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA,CAAC,oDAAoD;;;;;;;;;;;;;AC1JxC;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,gDAAY;AACvC,sBAAsB,mBAAO,CAAC,sDAAe;AAC7C,qBAAqB,mBAAO,CAAC,oDAAc;AAC3C;AACA;AACA;AACA;AACA,+BAA+B,oDAAoD;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,+CAA+C;AAC3F;AACA;AACA,4CAA4C,yCAAyC;AACrF;AACA;AACA,qCAAqC,iDAAiD;AACtF;AACA;AACA,4CAA4C,uCAAuC;AACnF;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACjCa;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,gDAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACxBa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,KAAK,GAAG,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD,gDAAgD,KAAK,GAAG,EAAE,OAAO,EAAE;AACnE;AACA;AACA;AACA;AACA,wCAAwC,KAAK;AAC7C;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qCAAqC;AACpE;AACA,gDAAgD,KAAK,GAAG,OAAO,OAAO,OAAO;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,gDAAgD,KAAK,GAAG,IAAI,OAAO,IAAI;AACvE;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACrNa;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,gDAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,yBAAyB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,6DAA6D;;;;;;;;;;;;;ACjBjD;AACb,8CAA8C,cAAc;AAC5D,eAAe,mBAAO,CAAC,6CAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC/Ba;AACb,8CAA8C,cAAc;AAC5D,yBAAyB,mBAAO,CAAC,kEAAwB;AACzD,sBAAsB,mBAAO,CAAC,uDAAe;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9Ba;AACb,8CAA8C,cAAc;AAC5D,yBAAyB,mBAAO,CAAC,kEAAwB;AACzD,oBAAoB,mBAAO,CAAC,wDAAmB;AAC/C,2BAA2B,mBAAO,CAAC,iEAAoB;AACvD,qBAAqB,mBAAO,CAAC,yDAAwB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9Ca;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU,SAAS,GAAG,IAAI,qBAAqB;AACvF;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,SAAS;AACrC;AACA,oDAAoD,SAAS,GAAG,OAAO;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACnDa;AACb,8CAA8C,cAAc;AAC5D,mBAAmB,mBAAO,CAAC,sDAAkB;AAC7C,yBAAyB,mBAAO,CAAC,kEAAwB;AACzD,0BAA0B,mBAAO,CAAC,+DAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AChCa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU,SAAS,GAAG,IAAI,qBAAqB;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,SAAS,GAAG,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Ca;AACb,8CAA8C,cAAc;AAC5D,0BAA0B,mBAAO,CAAC,oEAAyB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,SAAS,GAAG,IAAI;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9Ba;AACb,8CAA8C,cAAc;AAC5D,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACnJa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA,CAAC,2CAA2C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4EAA4E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACtHa;AACb,8CAA8C,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,mDAAqB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4EAA4E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;;;;;;;AChKa;AACb,8CAA8C,cAAc;AAC5D,yBAAyB,mBAAO,CAAC,4DAAkB;AACnD,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD,0BAA0B,mBAAO,CAAC,8DAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Fa;AACb,8CAA8C,cAAc;AAC5D,cAAc,mBAAO,CAAC,iDAAe;AACrC;AACA,kBAAkB,mBAAO,CAAC,yDAAmB;AAC7C;AACA,mBAAmB,mBAAO,CAAC,2DAAoB;AAC/C;AACA,wBAAwB,mBAAO,CAAC,mEAAwB;AACxD;;;;;;;;;;;;;ACTa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA,CAAC,sCAAsC;AACvC;AACA;AACA;AACA;AACA,CAAC,sEAAsE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mCAAmC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;;;;;;;;;;;;ACjGa;AACb,8CAA8C,cAAc;AAC5D,eAAe,mBAAO,CAAC,mCAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Ca;AACb,8CAA8C,cAAc;AAC5D,gBAAgB,mBAAO,CAAC,wDAAsB;AAC9C,gBAAgB,mBAAO,CAAC,sCAAU;AAClC,0BAA0B,mBAAO,CAAC,0EAA+B;AACjE;AACA;AACA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,YAAY;AACvD,kDAAkD,YAAY;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,oEAAoE,2BAA2B;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA,qCAAqC,YAAY;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,YAAY;AAC5D,gDAAgD,YAAY;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,YAAY;AAC5D,gDAAgD,YAAY;AAC5D,0DAA0D,YAAY;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,wEAAwE,iCAAiC;AACzG;AACA;AACA,qCAAqC,iCAAiC;AACtE,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,oDAAoD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,yEAAyE;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,iDAAiD;AAClD;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Sa;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,oDAAoD;;;;;;;;;;;;;ACtBxC;AACb;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D,SAAS,mBAAO,CAAC,+CAAc;AAC/B,SAAS,mBAAO,CAAC,6CAAa;;;;;;;;;;;;;ACNjB;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,uDAAuD;;;;;;;;;;;;;ACjC3C;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,2CAA2C;;;;;;;;;;;;;ACtH/B;AACb,8CAA8C,cAAc;AAC5D,eAAe,mBAAO,CAAC,mCAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,sBAAsB,EAAE;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;AC1Ga;AACb,8CAA8C,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,iDAAkB;AAC5C;;;;;;;;;;;;;ACHa;AACb;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D,SAAS,mBAAO,CAAC,+BAAS;AAC1B,SAAS,mBAAO,CAAC,qCAAS;AAC1B,cAAc,mBAAO,CAAC,qCAAS;AAC/B;AACA;AACA;AACA,SAAS,mBAAO,CAAC,iCAAO;;;;;;;;;;;;;ACXX;AACb,8CAA8C,cAAc;AAC5D,YAAY,mBAAO,CAAC,yCAAc;AAClC;AACA","file":"jTemplates.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/web.ts\");\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst window_1 = require(\"./window\");\r\nconst list_1 = require(\"../Utils/list\");\r\nconst utils_1 = require(\"./utils\");\r\nconst thread_1 = require(\"../Utils/thread\");\r\nvar pendingUpdates = list_1.List.Create();\r\nvar updateScheduled = false;\r\nfunction processUpdates() {\r\n list_1.List.Add(pendingUpdates, null);\r\n var callback;\r\n while ((callback = list_1.List.Pop(pendingUpdates)))\r\n thread_1.Synch(callback);\r\n if (pendingUpdates.size === 0)\r\n updateScheduled = false;\r\n else\r\n window_1.wndw.requestAnimationFrame(processUpdates);\r\n}\r\nconst htmlNs = \"http://www.w3.org/1999/xhtml\";\r\nexports.DOMNodeConfig = {\r\n createNode(type, namespace) {\r\n return type !== \"text\" ? window_1.wndw.document.createElementNS(namespace || htmlNs, type) : window_1.wndw.document.createTextNode(\"\");\r\n },\r\n scheduleUpdate(callback) {\r\n list_1.List.Add(pendingUpdates, callback);\r\n if (!updateScheduled) {\r\n updateScheduled = true;\r\n window_1.wndw.requestAnimationFrame(processUpdates);\r\n }\r\n },\r\n addListener(target, type, callback) {\r\n target.addEventListener(type, callback);\r\n },\r\n removeListener(target, type, callback) {\r\n target.removeEventListener(type, callback);\r\n },\r\n addChild(root, child) {\r\n root.appendChild(child);\r\n },\r\n addChildFirst(root, child) {\r\n exports.DOMNodeConfig.addChildBefore(root, root.firstChild, child);\r\n },\r\n addChildBefore(root, sibling, child) {\r\n if (!sibling) {\r\n exports.DOMNodeConfig.addChild(root, child);\r\n return;\r\n }\r\n if (child !== sibling)\r\n root.insertBefore(child, sibling);\r\n },\r\n addChildAfter(root, sibling, child) {\r\n if (!sibling) {\r\n exports.DOMNodeConfig.addChildFirst(root, child);\r\n return;\r\n }\r\n exports.DOMNodeConfig.addChildBefore(root, sibling.nextSibling, child);\r\n },\r\n removeChild(root, child) {\r\n root.removeChild(child);\r\n },\r\n remove(target) {\r\n target && target.parentNode && target.parentNode.removeChild(target);\r\n },\r\n setText(target, text) {\r\n target.textContent = text;\r\n },\r\n getAttribute(target, attribute) {\r\n return target.getAttribute(attribute);\r\n },\r\n setAttribute(target, attribute, value) {\r\n target.setAttribute(attribute, value);\r\n },\r\n fireEvent(target, event, data) {\r\n var cEvent = new CustomEvent(event, data);\r\n target.dispatchEvent(cEvent);\r\n },\r\n setProperties: utils_1.SetProperties\r\n};\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst elementNode_1 = require(\"../Node/elementNode\");\r\nfunction div(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"div\", null, nodeDef, children);\r\n}\r\nexports.div = div;\r\nfunction a(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"a\", null, nodeDef, children);\r\n}\r\nexports.a = a;\r\nfunction ul(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"ul\", null, nodeDef, children);\r\n}\r\nexports.ul = ul;\r\nfunction li(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"li\", null, nodeDef, children);\r\n}\r\nexports.li = li;\r\nfunction br(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"br\", null, nodeDef, null);\r\n}\r\nexports.br = br;\r\nfunction b(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"b\", null, nodeDef, children);\r\n}\r\nexports.b = b;\r\nfunction span(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"span\", null, nodeDef, children);\r\n}\r\nexports.span = span;\r\nfunction img(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"img\", null, nodeDef, null);\r\n}\r\nexports.img = img;\r\nfunction video(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"video\", null, nodeDef, children);\r\n}\r\nexports.video = video;\r\nfunction source(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"source\", null, nodeDef, null);\r\n}\r\nexports.source = source;\r\nfunction input(nodeDef) {\r\n return elementNode_1.ElementNode.Create(\"input\", null, nodeDef, null);\r\n}\r\nexports.input = input;\r\nfunction select(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"select\", null, nodeDef, children);\r\n}\r\nexports.select = select;\r\nfunction option(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"option\", null, nodeDef, children);\r\n}\r\nexports.option = option;\r\nfunction h1(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"h1\", null, nodeDef, children);\r\n}\r\nexports.h1 = h1;\r\nfunction h2(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"h2\", null, nodeDef, children);\r\n}\r\nexports.h2 = h2;\r\nfunction h3(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"h3\", null, nodeDef, children);\r\n}\r\nexports.h3 = h3;\r\nfunction p(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"p\", null, nodeDef, children);\r\n}\r\nexports.p = p;\r\nfunction style(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"style\", null, nodeDef, children);\r\n}\r\nexports.style = style;\r\nfunction button(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"button\", null, nodeDef, children);\r\n}\r\nexports.button = button;\r\nfunction table(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"table\", null, nodeDef, children);\r\n}\r\nexports.table = table;\r\nfunction th(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"th\", null, nodeDef, children);\r\n}\r\nexports.th = th;\r\nfunction tr(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"tr\", null, nodeDef, children);\r\n}\r\nexports.tr = tr;\r\nfunction td(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"td\", null, nodeDef, children);\r\n}\r\nexports.td = td;\r\n","\"use strict\";\r\nfunction __export(m) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__export(require(\"./elements\"));\r\n__export(require(\"./svgElements\"));\r\n__export(require(\"./utils\"));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst elementNode_1 = require(\"../Node/elementNode\");\r\nconst svgNs = \"http://www.w3.org/2000/svg\";\r\nfunction svg(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"svg\", svgNs, nodeDef, children);\r\n}\r\nexports.svg = svg;\r\nfunction g(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"g\", svgNs, nodeDef, children);\r\n}\r\nexports.g = g;\r\nfunction circle(nodeDef, children) {\r\n return elementNode_1.ElementNode.Create(\"circle\", svgNs, nodeDef, children);\r\n}\r\nexports.circle = circle;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction SetValue(target, value) {\r\n switch (target.nodeName) {\r\n case \"INPUT\":\r\n var start = target.selectionStart;\r\n var end = target.selectionEnd;\r\n target.value = value;\r\n if (target.ownerDocument.activeElement === target)\r\n target.setSelectionRange(start, end);\r\n break;\r\n default:\r\n target.value = value;\r\n }\r\n}\r\nfunction SetStyle(target, styleDef, lastStyleDef) {\r\n for (var key in styleDef)\r\n if (!lastStyleDef || lastStyleDef[key] !== styleDef[key])\r\n target.style[key] = styleDef[key];\r\n}\r\nfunction SetRootProperty(target, prop, value, lastValue) {\r\n switch (prop) {\r\n case \"value\":\r\n SetValue(target, value);\r\n break;\r\n case \"style\":\r\n SetStyle(target, value, lastValue);\r\n break;\r\n default:\r\n target[prop] = value;\r\n }\r\n}\r\nfunction SetChangedProperties(target, lastProperties, properties) {\r\n for (var key in properties) {\r\n (!lastProperties || lastProperties[key] !== properties[key]) &&\r\n SetRootProperty(target, key, properties[key], lastProperties && lastProperties[key]);\r\n }\r\n}\r\nfunction SetProperties(target, lastProperties, properties) {\r\n if (!lastProperties && target.nodeType === Node.TEXT_NODE)\r\n target.nodeValue = properties.nodeValue;\r\n else\r\n SetChangedProperties(target, lastProperties, properties);\r\n}\r\nexports.SetProperties = SetProperties;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.wndw = typeof window !== \"undefined\" ? window : (new (require(\"jsdom\").JSDOM(\"\")).window);\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nvar BoundNode;\r\n(function (BoundNode) {\r\n function Init(boundNode) {\r\n var nodeDef = boundNode.nodeDef;\r\n var propertiesScope = nodeDef.props ?\r\n observableScope_1.ObservableScope.Create(nodeDef.props) : null;\r\n var attributesScope = nodeDef.attrs ?\r\n observableScope_1.ObservableScope.Create(nodeDef.attrs) : null;\r\n var eventsScope = nodeDef.on ?\r\n observableScope_1.ObservableScope.Create(nodeDef.on) : null;\r\n observableScope_1.ObservableScope.Watch(propertiesScope, function () { ScheduleSetProperties(boundNode, propertiesScope); });\r\n observableScope_1.ObservableScope.Watch(attributesScope, function () { ScheduleSetAttributes(boundNode, attributesScope); });\r\n observableScope_1.ObservableScope.Watch(eventsScope, function () { ScheduleSetEvents(boundNode, eventsScope); });\r\n SetProperties(boundNode, observableScope_1.ObservableScope.Value(propertiesScope));\r\n SetAttributes(boundNode, observableScope_1.ObservableScope.Value(attributesScope));\r\n SetEvents(boundNode, observableScope_1.ObservableScope.Value(eventsScope));\r\n boundNode.destroyables.push({\r\n Destroy: function () {\r\n observableScope_1.ObservableScope.Destroy(propertiesScope);\r\n observableScope_1.ObservableScope.Destroy(attributesScope);\r\n observableScope_1.ObservableScope.Destroy(eventsScope);\r\n }\r\n });\r\n }\r\n BoundNode.Init = Init;\r\n})(BoundNode = exports.BoundNode || (exports.BoundNode = {}));\r\nfunction ScheduleSetProperties(node, scope) {\r\n if (node.setProperties)\r\n return;\r\n node.setProperties = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setProperties = false;\r\n if (node.destroyed)\r\n return;\r\n SetProperties(node, observableScope_1.ObservableScope.Value(scope));\r\n });\r\n}\r\nfunction SetProperties(node, properties) {\r\n if (!properties)\r\n return;\r\n nodeConfig_1.NodeConfig.setProperties(node.node, node.lastProperties, properties);\r\n node.lastProperties = properties;\r\n}\r\nfunction ScheduleSetAttributes(node, scope) {\r\n if (node.setAttributes)\r\n return;\r\n node.setAttributes = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setAttributes = false;\r\n if (node.destroyed)\r\n return;\r\n SetAttributes(node, observableScope_1.ObservableScope.Value(scope));\r\n });\r\n}\r\nfunction SetAttributes(node, attributes) {\r\n if (!attributes)\r\n return;\r\n for (var key in attributes) {\r\n var val = nodeConfig_1.NodeConfig.getAttribute(node.node, key);\r\n if (val !== attributes[key])\r\n nodeConfig_1.NodeConfig.setAttribute(node.node, key, attributes[key]);\r\n }\r\n}\r\nfunction ScheduleSetEvents(node, scope) {\r\n if (node.setEvents)\r\n return;\r\n node.setEvents = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setEvents = false;\r\n if (node.destroyed)\r\n return;\r\n SetEvents(node, observableScope_1.ObservableScope.Value(scope));\r\n });\r\n}\r\nfunction SetEvents(node, events) {\r\n if (!events)\r\n return;\r\n for (var key in node.lastEvents)\r\n nodeConfig_1.NodeConfig.removeListener(node.node, key, node.lastEvents[key]);\r\n for (var key in events)\r\n nodeConfig_1.NodeConfig.addListener(node.node, key, events[key]);\r\n node.lastEvents = events;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst nodeRef_1 = require(\"./nodeRef\");\r\nconst componentNode_1 = require(\"./componentNode\");\r\nconst decorators_1 = require(\"../Utils/decorators\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nclass Component {\r\n constructor(data, templates, nodeRef, componentEvents) {\r\n this.nodeRef = nodeRef;\r\n this.componentEvents = componentEvents;\r\n this.scope = new observableScope_1.ObservableScope(data);\r\n this.templates = templates || {};\r\n this.decoratorMap = new Map();\r\n }\r\n get Injector() {\r\n return this.nodeRef.injector;\r\n }\r\n get Destroyed() {\r\n return this.nodeRef.destroyed;\r\n }\r\n get DecoratorMap() {\r\n return this.decoratorMap;\r\n }\r\n get Scope() {\r\n return this.scope;\r\n }\r\n get Data() {\r\n return this.scope.Value;\r\n }\r\n get NodeRef() {\r\n return this.nodeRef;\r\n }\r\n get Templates() {\r\n return this.templates;\r\n }\r\n Template() {\r\n return [];\r\n }\r\n Bound() {\r\n }\r\n Fire(event, data) {\r\n var eventCallback = this.componentEvents && this.componentEvents[event];\r\n eventCallback && eventCallback(data);\r\n }\r\n Destroy() {\r\n decorators_1.Destroy.All(this);\r\n }\r\n}\r\nexports.Component = Component;\r\n(function (Component) {\r\n function ToFunction(type, namespace, constructor) {\r\n return componentNode_1.ComponentNode.ToFunction(type, namespace, constructor);\r\n }\r\n Component.ToFunction = ToFunction;\r\n function Register(name, constructor) {\r\n const componentFunction = ToFunction(`${name}-component`, undefined, constructor);\r\n class WebComponent extends HTMLElement {\r\n constructor() {\r\n super();\r\n const shadowRoot = this.attachShadow({ mode: 'open' });\r\n const node = componentFunction({});\r\n Attach(shadowRoot, node);\r\n }\r\n }\r\n customElements.define(name, WebComponent);\r\n }\r\n Component.Register = Register;\r\n function Attach(node, nodeRef) {\r\n nodeRef_1.NodeRef.Init(nodeRef);\r\n var rootRef = nodeRef_1.NodeRef.Wrap(node);\r\n nodeRef_1.NodeRef.AddChild(rootRef, nodeRef);\r\n }\r\n Component.Attach = Attach;\r\n})(Component = exports.Component || (exports.Component = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst boundNode_1 = require(\"./boundNode\");\r\nconst nodeRef_1 = require(\"./nodeRef\");\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst component_1 = require(\"./component\");\r\nconst injector_1 = require(\"../Utils/injector\");\r\nconst decorators_1 = require(\"../Utils/decorators\");\r\nconst thread_1 = require(\"../Utils/thread\");\r\nvar ComponentNode;\r\n(function (ComponentNode) {\r\n function Fire(event, data) {\r\n var eventCallback = this.componentEvents && this.componentEvents[event];\r\n eventCallback && eventCallback(data);\r\n }\r\n ComponentNode.Fire = Fire;\r\n function ToFunction(type, namespace, constructor) {\r\n return function (nodeDef, templates) {\r\n return Create(type, namespace, nodeDef, constructor, templates);\r\n };\r\n }\r\n ComponentNode.ToFunction = ToFunction;\r\n function Init(componentNode) {\r\n var nodeDef = componentNode.nodeDef;\r\n var events = nodeDef.on;\r\n nodeDef.on = null;\r\n componentNode.component = new componentNode.constructor(nodeDef.data, componentNode.templates, componentNode, events);\r\n SetChildren(componentNode);\r\n componentNode.destroyables.push(componentNode.component);\r\n boundNode_1.BoundNode.Init(componentNode);\r\n }\r\n ComponentNode.Init = Init;\r\n})(ComponentNode = exports.ComponentNode || (exports.ComponentNode = {}));\r\nfunction Create(type, namespace, nodeDef, constructor, templates) {\r\n var compNode = nodeRef_1.NodeRef.Create(type, namespace, nodeRef_1.NodeRefType.ComponentNode);\r\n compNode.nodeDef = nodeDef;\r\n compNode.constructor = constructor;\r\n compNode.templates = templates;\r\n return compNode;\r\n}\r\nfunction SetChildren(node) {\r\n if (decorators_1.PreReq.Has(node.component)) {\r\n AddPreReqTemplate(node).then(function () {\r\n AddTemplate(node, false);\r\n });\r\n }\r\n else\r\n AddTemplate(node, true);\r\n}\r\nfunction AddPreReqTemplate(node) {\r\n return new Promise(resolve => {\r\n thread_1.Thread(function () {\r\n var preNodes;\r\n injector_1.Injector.Scope(node.injector, () => preNodes = decorators_1.PreReqTemplate.Get(node.component));\r\n thread_1.Schedule(function () {\r\n if (node.destroyed)\r\n return;\r\n nodeRef_1.NodeRef.InitAll(preNodes);\r\n });\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < preNodes.length; x++)\r\n nodeRef_1.NodeRef.AddChild(node, preNodes[x]);\r\n decorators_1.PreReq.All(node.component).then(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < preNodes.length; x++)\r\n nodeRef_1.NodeRef.Destroy(preNodes[x]);\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < preNodes.length; x++)\r\n nodeRef_1.NodeRef.DetachChild(node, preNodes[x]);\r\n resolve();\r\n });\r\n });\r\n });\r\n });\r\n });\r\n}\r\nfunction AddTemplate(node, init) {\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n var nodes;\r\n injector_1.Injector.Scope(node.injector, function () {\r\n nodes = node.component.Template();\r\n });\r\n if (!Array.isArray(nodes))\r\n nodes = [nodes];\r\n thread_1.Schedule(function () {\r\n nodeRef_1.NodeRef.InitAll(nodes);\r\n });\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n if (init)\r\n for (var x = 0; x < nodes.length; x++)\r\n nodeRef_1.NodeRef.AddChild(node, nodes[x]);\r\n else\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n if (node.destroyed)\r\n return;\r\n for (var x = 0; x < nodes.length; x++)\r\n nodeRef_1.NodeRef.AddChild(node, nodes[x]);\r\n });\r\n });\r\n if (node.component.Bound !== component_1.Component.prototype.Bound)\r\n thread_1.After(function () {\r\n nodeConfig_1.NodeConfig.scheduleUpdate(() => setTimeout(() => node.component.Bound(), 0));\r\n });\r\n });\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst boundNode_1 = require(\"./boundNode\");\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst injector_1 = require(\"../Utils/injector\");\r\nconst list_1 = require(\"../Utils/list\");\r\nconst thread_1 = require(\"../Utils/thread\");\r\nconst nodeRef_1 = require(\"./nodeRef\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nvar ElementNode;\r\n(function (ElementNode) {\r\n function Create(type, namespace, nodeDef, children) {\r\n var elemNode = nodeRef_1.NodeRef.Create(type, namespace, nodeRef_1.NodeRefType.ElementNode);\r\n elemNode.nodeDef = nodeDef;\r\n elemNode.childrenFunc = children;\r\n return elemNode;\r\n }\r\n ElementNode.Create = Create;\r\n function Init(elementNode) {\r\n if (elementNode.childrenFunc) {\r\n var nodeDef = elementNode.nodeDef;\r\n if (nodeDef.data) {\r\n const dataScope = observableScope_1.ObservableScope.Create(nodeDef.data);\r\n observableScope_1.ObservableScope.Watch(dataScope, function () {\r\n ScheduleSetData(elementNode, dataScope);\r\n });\r\n SetData(elementNode, GetValue(dataScope), true);\r\n elementNode.destroyables.push({\r\n Destroy: function () {\r\n observableScope_1.ObservableScope.Destroy(dataScope);\r\n }\r\n });\r\n }\r\n else\r\n SetDefaultData(elementNode);\r\n }\r\n boundNode_1.BoundNode.Init(elementNode);\r\n }\r\n ElementNode.Init = Init;\r\n})(ElementNode = exports.ElementNode || (exports.ElementNode = {}));\r\nconst valueDefault = [];\r\nfunction GetValue(dataScope) {\r\n var value = observableScope_1.ObservableScope.Value(dataScope);\r\n if (!value)\r\n return valueDefault;\r\n if (!Array.isArray(value))\r\n value = [value];\r\n return value;\r\n}\r\nfunction ScheduleSetData(node, scope) {\r\n if (node.setData)\r\n return;\r\n node.setData = true;\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n node.setData = false;\r\n if (node.destroyed)\r\n return;\r\n SetData(node, GetValue(scope));\r\n });\r\n}\r\nfunction SetDefaultData(node) {\r\n thread_1.Synch(function () {\r\n var nodes;\r\n injector_1.Injector.Scope(node.injector, function () {\r\n nodes = CreateNodeArray(node.childrenFunc, true);\r\n });\r\n if (nodes.length > 0) {\r\n thread_1.Schedule(function () {\r\n if (node.destroyed)\r\n return;\r\n nodeRef_1.NodeRef.InitAll(nodes);\r\n });\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n DetachAndAddNodes(node, [], [nodes]);\r\n });\r\n }\r\n });\r\n}\r\nfunction SetData(node, value, init = false) {\r\n thread_1.Synch(function () {\r\n var newNodesMap = new Map();\r\n var values = value || valueDefault;\r\n if (!Array.isArray(values))\r\n values = [values];\r\n var newNodesArrays = values.map(function (value) {\r\n var nodes;\r\n if (node.nodesMap) {\r\n var nodeArrayList = node.nodesMap.get(value);\r\n nodes = nodeArrayList && list_1.List.Remove(nodeArrayList);\r\n }\r\n var newNodeArrayList = newNodesMap.get(value);\r\n if (!newNodeArrayList) {\r\n newNodeArrayList = list_1.List.Create();\r\n newNodesMap.set(value, newNodeArrayList);\r\n }\r\n if (!nodes) {\r\n injector_1.Injector.Scope(node.injector, function () {\r\n nodes = CreateNodeArray(node.childrenFunc, value);\r\n });\r\n thread_1.Schedule(function () {\r\n if (node.destroyed || newNodesMap.size === 0)\r\n return;\r\n nodeRef_1.NodeRef.InitAll(nodes);\r\n list_1.List.Push(newNodeArrayList, nodes);\r\n });\r\n }\r\n else\r\n list_1.List.Push(newNodeArrayList, nodes);\r\n return nodes;\r\n });\r\n var detachNodes = [];\r\n if (node.nodesMap) {\r\n for (var nodeArrayList of node.nodesMap.values())\r\n nodeArrayList.size > 0 && detachNodes.push(DestroyNodeArrayList(nodeArrayList));\r\n node.nodesMap.clear();\r\n }\r\n node.nodesMap = newNodesMap;\r\n thread_1.Thread(function () {\r\n if (node.destroyed)\r\n return;\r\n if (init)\r\n DetachAndAddNodes(node, detachNodes, newNodesMap.size > 0 && newNodesArrays);\r\n else\r\n nodeConfig_1.NodeConfig.scheduleUpdate(function () {\r\n if (node.destroyed)\r\n return;\r\n DetachAndAddNodes(node, detachNodes, newNodesMap.size > 0 && newNodesArrays);\r\n });\r\n });\r\n });\r\n}\r\nfunction DetachAndAddNodes(node, detachNodes, newNodes) {\r\n for (var x = 0; x < detachNodes.length; x++)\r\n list_1.List.ForEach(detachNodes[x], function (nodes) {\r\n for (var x = 0; x < nodes.length; x++)\r\n nodeRef_1.NodeRef.DetachChild(node, nodes[x]);\r\n });\r\n var previousNode = null;\r\n for (var x = 0; newNodes && x < newNodes.length; x++) {\r\n for (var y = 0; y < newNodes[x].length; y++) {\r\n nodeRef_1.NodeRef.AddChildAfter(node, previousNode, newNodes[x][y]);\r\n previousNode = newNodes[x][y];\r\n }\r\n }\r\n}\r\nfunction CreateNodeArray(childrenFunc, value) {\r\n var newNodes = childrenFunc(value);\r\n if (typeof newNodes === \"string\") {\r\n var textNode = nodeRef_1.NodeRef.Create(\"text\", null, nodeRef_1.NodeRefType.BoundNode);\r\n textNode.nodeDef = {\r\n props: function () {\r\n return { nodeValue: childrenFunc(value) };\r\n }\r\n };\r\n return [textNode];\r\n }\r\n if (Array.isArray(newNodes))\r\n return newNodes;\r\n return [newNodes];\r\n}\r\nfunction DestroyNodeArrayList(nodeArrayList) {\r\n list_1.List.ForEach(nodeArrayList, nodeRef_1.NodeRef.DestroyAll);\r\n return nodeArrayList;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst domNodeConfig_1 = require(\"../DOM/domNodeConfig\");\r\nexports.NodeConfig = domNodeConfig_1.DOMNodeConfig;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst nodeConfig_1 = require(\"./nodeConfig\");\r\nconst injector_1 = require(\"../Utils/injector\");\r\nconst boundNode_1 = require(\"./boundNode\");\r\nconst elementNode_1 = require(\"./elementNode\");\r\nconst componentNode_1 = require(\"./componentNode\");\r\nvar NodeRefType;\r\n(function (NodeRefType) {\r\n NodeRefType[NodeRefType[\"NodeRef\"] = 0] = \"NodeRef\";\r\n NodeRefType[NodeRefType[\"BoundNode\"] = 1] = \"BoundNode\";\r\n NodeRefType[NodeRefType[\"ElementNode\"] = 2] = \"ElementNode\";\r\n NodeRefType[NodeRefType[\"ComponentNode\"] = 3] = \"ComponentNode\";\r\n})(NodeRefType = exports.NodeRefType || (exports.NodeRefType = {}));\r\nvar NodeRef;\r\n(function (NodeRef) {\r\n function Wrap(node) {\r\n var nodeRef = Create(null, null, NodeRefType.NodeRef);\r\n nodeRef.node = node;\r\n nodeRef.childNodes = new Set();\r\n return nodeRef;\r\n }\r\n NodeRef.Wrap = Wrap;\r\n function Create(nodeType, namespace, type) {\r\n switch (type) {\r\n case NodeRefType.NodeRef:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.NodeRef,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: []\r\n };\r\n case NodeRefType.BoundNode:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.BoundNode,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: [],\r\n lastProperties: null,\r\n lastEvents: null,\r\n setProperties: false,\r\n setAttributes: false,\r\n setEvents: false\r\n };\r\n case NodeRefType.ElementNode:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.ElementNode,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: [],\r\n lastProperties: null,\r\n lastEvents: null,\r\n setProperties: false,\r\n setAttributes: false,\r\n setEvents: false,\r\n childrenFunc: null,\r\n nodesMap: null,\r\n setData: false\r\n };\r\n case NodeRefType.ComponentNode:\r\n return {\r\n node: null,\r\n nodeType: nodeType,\r\n nodeNamespace: namespace,\r\n type: NodeRefType.ComponentNode,\r\n injector: injector_1.Injector.Current() || new injector_1.Injector(),\r\n parent: null,\r\n childNodes: null,\r\n destroyed: false,\r\n destroyables: [],\r\n lastProperties: null,\r\n lastEvents: null,\r\n setProperties: false,\r\n setAttributes: false,\r\n setEvents: false,\r\n component: null,\r\n componentEvents: null\r\n };\r\n }\r\n }\r\n NodeRef.Create = Create;\r\n function Init(nodeRef) {\r\n if (nodeRef.node)\r\n return;\r\n nodeRef.node = nodeConfig_1.NodeConfig.createNode(nodeRef.nodeType, nodeRef.nodeNamespace);\r\n nodeRef.childNodes = new Set();\r\n switch (nodeRef.type) {\r\n case NodeRefType.BoundNode:\r\n boundNode_1.BoundNode.Init(nodeRef);\r\n break;\r\n case NodeRefType.ElementNode:\r\n elementNode_1.ElementNode.Init(nodeRef);\r\n break;\r\n case NodeRefType.ComponentNode:\r\n componentNode_1.ComponentNode.Init(nodeRef);\r\n break;\r\n }\r\n }\r\n NodeRef.Init = Init;\r\n function InitAll(nodeRefs) {\r\n for (var x = 0; x < nodeRefs.length; x++)\r\n Init(nodeRefs[x]);\r\n }\r\n NodeRef.InitAll = InitAll;\r\n function AddChild(node, child) {\r\n child.parent = node;\r\n node.childNodes.add(child);\r\n nodeConfig_1.NodeConfig.addChild(node.node, child.node);\r\n }\r\n NodeRef.AddChild = AddChild;\r\n function AddChildAfter(node, currentChild, newChild) {\r\n if (currentChild && !node.childNodes.has(currentChild))\r\n throw \"currentChild is not valid\";\r\n newChild.parent = node;\r\n node.childNodes.add(newChild);\r\n nodeConfig_1.NodeConfig.addChildAfter(node.node, currentChild && currentChild.node, newChild.node);\r\n }\r\n NodeRef.AddChildAfter = AddChildAfter;\r\n function DetachChild(node, child) {\r\n if (node.childNodes.has(child)) {\r\n node.childNodes.delete(child);\r\n nodeConfig_1.NodeConfig.removeChild(node.node, child.node);\r\n child.parent = null;\r\n }\r\n }\r\n NodeRef.DetachChild = DetachChild;\r\n function Destroy(node) {\r\n if (node.destroyed)\r\n return;\r\n node.destroyed = true;\r\n node.childNodes.forEach(Destroy);\r\n node.destroyables.forEach(d => d && d.Destroy());\r\n }\r\n NodeRef.Destroy = Destroy;\r\n function DestroyAll(nodes) {\r\n for (var x = 0; x < nodes.length; x++)\r\n Destroy(nodes[x]);\r\n }\r\n NodeRef.DestroyAll = DestroyAll;\r\n})(NodeRef = exports.NodeRef || (exports.NodeRef = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffTree_1 = require(\"./diffTree\");\r\nconst workerQueue_1 = require(\"./workerQueue\");\r\nconst diffWorker_1 = require(\"./diffWorker\");\r\nconst diffCnstr = diffTree_1.DiffTreeScope();\r\nclass DiffAsync {\r\n constructor(keyFunc) {\r\n this.workerQueue = new workerQueue_1.WorkerQueue(diffWorker_1.DiffWorker.Create());\r\n this.workerQueue.Push({ method: \"create\", arguments: [keyFunc.toString()] });\r\n }\r\n static GetKeyRef(key) {\r\n return diffCnstr.GetKeyRef(key);\r\n }\r\n static ReadKeyRef(ref) {\r\n return diffCnstr.ReadKeyRef(ref);\r\n }\r\n async DiffPath(path, value) {\r\n return await this.workerQueue.Push({ method: \"diffpath\", arguments: [path, value] });\r\n }\r\n async DiffBatch(data) {\r\n return await this.workerQueue.Push({ method: \"diffbatch\", arguments: [data] });\r\n }\r\n async UpdatePath(path, value) {\r\n await this.workerQueue.Push({ method: \"updatepath\", arguments: [path, value] });\r\n }\r\n async GetPath(path) {\r\n return await this.workerQueue.Push({ method: \"getpath\", arguments: [path] });\r\n }\r\n Destroy() {\r\n this.workerQueue.Destroy();\r\n }\r\n}\r\nexports.DiffAsync = DiffAsync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffTree_1 = require(\"./diffTree\");\r\nconst diffCnstr = diffTree_1.DiffTreeScope();\r\nclass DiffSync {\r\n constructor(keyFunc) {\r\n this.diffTree = new diffCnstr(keyFunc);\r\n }\r\n static GetKeyRef(key) {\r\n return diffCnstr.GetKeyRef(key);\r\n }\r\n static ReadKeyRef(ref) {\r\n return diffCnstr.ReadKeyRef(ref);\r\n }\r\n DiffPath(path, value) {\r\n return this.diffTree.DiffPath(path, value);\r\n }\r\n DiffBatch(data) {\r\n return this.diffTree.DiffBatch(data);\r\n }\r\n UpdatePath(path, value) {\r\n this.diffTree.UpdatePath(path, value);\r\n }\r\n}\r\nexports.DiffSync = DiffSync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nfunction DiffTreeScope(worker) {\r\n const ctx = this;\r\n if (ctx && worker) {\r\n let diffTree = null;\r\n ctx.onmessage = function (event) {\r\n var data = event.data;\r\n switch (data.method) {\r\n case \"create\":\r\n var keyFunc = data.arguments[0] ? eval(data.arguments[0]) : undefined;\r\n diffTree = new DiffTree(keyFunc);\r\n ctx.postMessage(null);\r\n break;\r\n case \"diffpath\":\r\n var diff = diffTree.DiffPath(data.arguments[0], data.arguments[1]);\r\n ctx.postMessage(diff);\r\n break;\r\n case \"diffbatch\":\r\n var diff = diffTree.DiffBatch(data.arguments[0]);\r\n ctx.postMessage(diff);\r\n break;\r\n case \"updatepath\":\r\n diffTree.UpdatePath(data.arguments[0], data.arguments[1]);\r\n ctx.postMessage(null);\r\n break;\r\n case \"getpath\":\r\n var ret = diffTree.GetPath(data.arguments[0]);\r\n ctx.postMessage(ret);\r\n break;\r\n }\r\n };\r\n }\r\n const jsonConstructor = {}.constructor;\r\n function IsValue(value) {\r\n if (!value)\r\n return true;\r\n return !(jsonConstructor === value.constructor || Array.isArray(value));\r\n }\r\n class DiffTree {\r\n constructor(keyFunc) {\r\n this.keyFunc = keyFunc;\r\n this.rootStateMap = new Map();\r\n }\r\n static GetKeyRef(key) {\r\n return `___DiffTreeKeyRef.${key}`;\r\n }\r\n static ReadKeyRef(ref) {\r\n if (!ref)\r\n return undefined;\r\n var matches = ref.match(/^___DiffTreeKeyRef\\.([^.]+$)/);\r\n if (!matches)\r\n return undefined;\r\n return matches[1];\r\n }\r\n DiffBatch(data) {\r\n var resp = [];\r\n ;\r\n for (var x = 0; x < data.length; x++)\r\n this.RunDiff(data[x].path, data[x].value, resp);\r\n return resp;\r\n }\r\n DiffPath(path, value) {\r\n var resp = [];\r\n this.RunDiff(path, value, resp);\r\n return resp;\r\n }\r\n UpdatePath(path, value) {\r\n this.SetPathValue(path, value);\r\n }\r\n GetPath(path) {\r\n return this.GetPathValue(path);\r\n }\r\n RunDiff(path, value, diffResp) {\r\n var breakupMap = this.GetBreakUpMap(path, value);\r\n var resp = diffResp || [];\r\n breakupMap.forEach((value, key) => {\r\n var currentValue = key.split(\".\").reduce((pre, curr, index) => {\r\n if (index === 0)\r\n return this.rootStateMap.get(curr);\r\n return pre && pre[curr];\r\n }, null);\r\n this.DiffJson(key, value, currentValue, resp);\r\n });\r\n for (var x = 0; x < resp.length; x++)\r\n this.SetPathValue(resp[x].path, resp[x].value);\r\n }\r\n GetPathValue(path) {\r\n var parts = path.split(\".\");\r\n var curr = this.rootStateMap.get(parts[0]);\r\n for (var x = 1; x < parts.length; x++)\r\n curr = curr && curr[parts[x]];\r\n return curr;\r\n }\r\n SetPathValue(path, value) {\r\n var parts = path.split(\".\");\r\n if (parts.length === 1)\r\n this.rootStateMap.set(parts[0], value);\r\n else {\r\n var curr = this.rootStateMap.get(parts[0]);\r\n for (var x = 1; x < parts.length - 1; x++)\r\n curr = curr[parts[x]];\r\n curr[parts[parts.length - 1]] = value;\r\n }\r\n }\r\n GetBreakUpMap(path, value) {\r\n if (!this.keyFunc)\r\n return new Map([[path, value]]);\r\n return this.BreakUpValue(path, value);\r\n }\r\n BreakUpValue(path, parent, prop, map) {\r\n var value = prop ? parent[prop] : parent;\r\n var isValue = IsValue(value);\r\n if (!map && isValue)\r\n return new Map([[path, value]]);\r\n map = map || new Map();\r\n if (isValue)\r\n return map;\r\n var key = this.keyFunc ? this.keyFunc(value) : null;\r\n var keyRef = key && DiffTree.GetKeyRef(key);\r\n if (key && key !== path) {\r\n if (prop)\r\n parent[prop] = keyRef;\r\n this.BreakUpValue(key, value, null, map);\r\n }\r\n else {\r\n for (var subProp in value) {\r\n var childPath = `${path}.${subProp}`;\r\n this.BreakUpValue(childPath, value, subProp, map);\r\n }\r\n }\r\n if (!prop)\r\n map.set(path, key === path ? value : keyRef || value);\r\n return map;\r\n }\r\n DiffJson(path, newValue, oldValue, resp) {\r\n const oldIsValue = IsValue(oldValue);\r\n const newIsValue = IsValue(newValue);\r\n if (oldIsValue || newIsValue) {\r\n if (oldValue !== newValue) {\r\n resp.push({\r\n path,\r\n value: newValue\r\n });\r\n return true;\r\n }\r\n return false;\r\n }\r\n let allChildrenChanged = true;\r\n let childDeleted = false;\r\n const oldIsArray = Array.isArray(oldValue);\r\n const newIsArray = Array.isArray(newValue);\r\n if (oldIsArray !== newIsArray) {\r\n resp.push({\r\n path,\r\n value: newValue\r\n });\r\n return true;\r\n }\r\n const changedPathLength = resp.length;\r\n if (oldIsArray && newIsArray) {\r\n if (oldValue.length === 0 && newValue.length === 0)\r\n return false;\r\n for (let y = 0; y < newValue.length; y++) {\r\n const arrayPath = path ? `${path}.${y}` : `${y}`;\r\n allChildrenChanged = this.DiffJson(arrayPath, newValue[y], oldValue[y], resp) && allChildrenChanged;\r\n }\r\n if (!allChildrenChanged && newValue.length < oldValue.length)\r\n resp.push({\r\n path: path ? `${path}.length` : 'length',\r\n value: newValue.length\r\n });\r\n }\r\n else {\r\n const oldKeys = Reflect.ownKeys(oldValue);\r\n const newKeys = Reflect.ownKeys(newValue);\r\n if (oldKeys && oldKeys.length === 0 && newKeys.length === 0)\r\n return false;\r\n const newKeysSet = new Set(newKeys);\r\n for (let x = 0; x < oldKeys.length && !childDeleted; x++) {\r\n const oldKey = oldKeys[x];\r\n const childPath = path ? `${path}.${oldKey}` : `${oldKey}`;\r\n if (newKeysSet.delete(oldKey))\r\n allChildrenChanged = this.DiffJson(childPath, newValue[oldKey], oldValue[oldKey], resp) && allChildrenChanged;\r\n else if (path)\r\n childDeleted = true;\r\n else\r\n resp.push({\r\n path: childPath,\r\n value: undefined\r\n });\r\n }\r\n newKeysSet.forEach(key => {\r\n const childPath = path ? `${path}.${key}` : `${key}`;\r\n resp.push({\r\n path: childPath,\r\n value: newValue[key]\r\n });\r\n });\r\n }\r\n if (path && (allChildrenChanged || childDeleted)) {\r\n resp.splice(changedPathLength);\r\n resp.push({\r\n path,\r\n value: newValue\r\n });\r\n return true;\r\n }\r\n return false;\r\n }\r\n }\r\n return DiffTree;\r\n}\r\nexports.DiffTreeScope = DiffTreeScope;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffTree_1 = require(\"./diffTree\");\r\nvar DiffWorker;\r\n(function (DiffWorker) {\r\n var workerConstructor = null;\r\n var workerParameter = null;\r\n if (typeof Worker !== 'undefined') {\r\n workerConstructor = Worker;\r\n workerParameter = URL.createObjectURL(new Blob([`(${diffTree_1.DiffTreeScope}).call(this, true)`]));\r\n }\r\n function Create() {\r\n if (!workerConstructor)\r\n throw \"Worker is not available\";\r\n return new workerConstructor(workerParameter);\r\n }\r\n DiffWorker.Create = Create;\r\n})(DiffWorker = exports.DiffWorker || (exports.DiffWorker = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst list_1 = require(\"../../Utils/list\");\r\nclass WorkerQueue {\r\n constructor(worker) {\r\n this.worker = worker;\r\n this.callbacks = list_1.List.Create();\r\n this.worker.onerror = (err) => {\r\n var cb = list_1.List.Pop(this.callbacks);\r\n cb && cb(null, err);\r\n };\r\n this.worker.onmessage = (message) => {\r\n var cb = list_1.List.Pop(this.callbacks);\r\n cb && cb(message.data);\r\n };\r\n }\r\n Push(message) {\r\n return new Promise((resolve, reject) => {\r\n list_1.List.Add(this.callbacks, function (data, err) {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve(data);\r\n });\r\n this.worker.postMessage(message);\r\n });\r\n }\r\n Destroy() {\r\n this.worker.terminate();\r\n }\r\n}\r\nexports.WorkerQueue = WorkerQueue;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableTree_1 = require(\"../Tree/observableTree\");\r\nconst storeWriter_1 = require(\"./storeWriter\");\r\nclass Store {\r\n constructor(init) {\r\n this.observableTree = new observableTree_1.ObservableTree();\r\n this.storeWriter = new storeWriter_1.StoreWriter(this.observableTree);\r\n this.rootScope = this.observableTree.Scope(\"ROOT\", root => root);\r\n if (init)\r\n this.Write(init);\r\n }\r\n get Root() {\r\n return this.rootScope;\r\n }\r\n Action(action) {\r\n var node = this.observableTree.GetNode(\"ROOT\");\r\n action(node.Proxy, this.storeWriter);\r\n }\r\n Write(data) {\r\n this.Action((root, writer) => writer.Write(root, data));\r\n }\r\n Merge(data) {\r\n this.Action((root, writer) => writer.Merge(root, data));\r\n }\r\n Destroy() {\r\n this.rootScope.Destroy();\r\n this.observableTree.Destroy();\r\n }\r\n}\r\nexports.Store = Store;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableTree_1 = require(\"../Tree/observableTree\");\r\nconst diffAsync_1 = require(\"../Diff/diffAsync\");\r\nconst storeAsyncWriter_1 = require(\"./storeAsyncWriter\");\r\nconst asyncQueue_1 = require(\"../../Utils/asyncQueue\");\r\nclass StoreAsync {\r\n constructor(idFunc, init) {\r\n this.idFunc = idFunc;\r\n this.diffAsync = new diffAsync_1.DiffAsync(this.idFunc);\r\n this.observableTree = new observableTree_1.ObservableTree(diffAsync_1.DiffAsync.ReadKeyRef);\r\n this.asyncWriter = new storeAsyncWriter_1.StoreAsyncWriter(this.idFunc, this.diffAsync, this.observableTree);\r\n this.asyncQueue = new asyncQueue_1.AsyncQueue();\r\n if (init) {\r\n var id = this.idFunc(init);\r\n this.observableTree.Write(id, init);\r\n this.Write(init);\r\n }\r\n }\r\n Scope(id, func) {\r\n return this.observableTree.Scope(id, func);\r\n }\r\n async Action(id, action) {\r\n await this.asyncQueue.Next(async () => {\r\n var node;\r\n if (id)\r\n node = this.observableTree.GetNode(id);\r\n await action(node && node.Proxy, this.asyncWriter);\r\n });\r\n }\r\n async Write(data) {\r\n await this.Action(null, async (val, writer) => {\r\n await writer.Write(val, data);\r\n });\r\n }\r\n async Merge(id, data) {\r\n await this.Action(id, async (val, writer) => {\r\n await writer.Merge(val, data);\r\n });\r\n }\r\n Destroy() {\r\n this.asyncQueue.Stop();\r\n this.diffAsync.Destroy();\r\n this.observableTree.Destroy();\r\n }\r\n}\r\nexports.StoreAsync = StoreAsync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nclass StoreAsyncWriter {\r\n constructor(idFunc, diffAsync, observableTree) {\r\n this.idFunc = idFunc;\r\n this.diffAsync = diffAsync;\r\n this.observableTree = observableTree;\r\n }\r\n async Write(source, data) {\r\n var path;\r\n if (source) {\r\n var proxy = source;\r\n path = proxy.___node.Path;\r\n }\r\n else {\r\n path = this.idFunc(data);\r\n if (!path)\r\n throw new Error(\"data must have an id\");\r\n }\r\n var diff = await this.diffAsync.DiffPath(path, data);\r\n this.ApplyChanges(diff);\r\n }\r\n async Merge(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var keys = Object.keys(data);\r\n var message = keys.map(key => ({ path: `${rootPath}.${key}`, value: data[key] }));\r\n var diff = await this.diffAsync.DiffBatch(message);\r\n this.ApplyChanges(diff);\r\n }\r\n async Push(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var lengthPath = `${rootPath}.length`;\r\n var length = await this.diffAsync.GetPath(lengthPath);\r\n var diff = await this.diffAsync.DiffPath(`${rootPath}.${length}`, data);\r\n this.ApplyChanges(diff);\r\n }\r\n async Splice(source, start, deleteCount, ...items) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var array = await this.diffAsync.GetPath(rootPath);\r\n array = array.slice();\r\n array.splice(start, deleteCount, ...items);\r\n var diff = await this.diffAsync.DiffPath(rootPath, array);\r\n this.ApplyChanges(diff);\r\n }\r\n ApplyChanges(diff) {\r\n this.observableTree.WriteAll(diff);\r\n }\r\n}\r\nexports.StoreAsyncWriter = StoreAsyncWriter;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst diffSync_1 = require(\"../Diff/diffSync\");\r\nconst observableTree_1 = require(\"../Tree/observableTree\");\r\nconst storeSyncWriter_1 = require(\"./storeSyncWriter\");\r\nclass StoreSync {\r\n constructor(init) {\r\n this.diffSync = new diffSync_1.DiffSync();\r\n this.observableTree = new observableTree_1.ObservableTree();\r\n this.storeWriter = new storeSyncWriter_1.StoreSyncWriter(this.diffSync, this.observableTree);\r\n this.rootScope = this.observableTree.Scope(\"ROOT\", root => root);\r\n if (init)\r\n this.Write(init);\r\n }\r\n get Root() {\r\n return this.rootScope;\r\n }\r\n Action(action) {\r\n var node = this.observableTree.GetNode(\"ROOT\");\r\n action(node.Proxy, this.storeWriter);\r\n }\r\n Write(data) {\r\n this.Action((root, writer) => writer.Write(root, data));\r\n }\r\n Merge(data) {\r\n this.Action((root, writer) => writer.Merge(root, data));\r\n }\r\n Destroy() {\r\n this.rootScope.Destroy();\r\n this.observableTree.Destroy();\r\n }\r\n}\r\nexports.StoreSync = StoreSync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nclass StoreSyncWriter {\r\n constructor(diffSync, observableTree) {\r\n this.diffSync = diffSync;\r\n this.observableTree = observableTree;\r\n }\r\n Write(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy && proxy.___node.Path || \"ROOT\";\r\n var diff = this.diffSync.DiffPath(rootPath, data);\r\n this.ApplyChanges(diff);\r\n }\r\n Merge(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var keys = Object.keys(data);\r\n var message = keys.map(key => ({ path: `${rootPath}.${key}`, value: data[key] }));\r\n var diff = this.diffSync.DiffBatch(message);\r\n this.ApplyChanges(diff);\r\n }\r\n Push(source, data) {\r\n var array = source;\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var length = array.length;\r\n this.diffSync.UpdatePath(`${rootPath}.${length}`, data);\r\n proxy.___node.Push(data);\r\n }\r\n Splice(source, start, deleteCount, ...items) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n var array = this.observableTree.Get(rootPath);\r\n array = array.map(val => val);\r\n array.splice(start, deleteCount, ...items);\r\n this.diffSync.UpdatePath(rootPath, array);\r\n return proxy.___node.Splice(start, deleteCount, ...items);\r\n }\r\n ApplyChanges(diff) {\r\n this.observableTree.WriteAll(diff);\r\n }\r\n}\r\nexports.StoreSyncWriter = StoreSyncWriter;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableProxy_1 = require(\"../Tree/observableProxy\");\r\nclass StoreWriter {\r\n constructor(observableTree) {\r\n this.observableTree = observableTree;\r\n }\r\n Write(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy && proxy.___node.Path || \"ROOT\";\r\n this.observableTree.Write(rootPath, data);\r\n }\r\n Merge(source, data) {\r\n var proxy = source;\r\n var rootPath = proxy.___node.Path;\r\n if (observableProxy_1.ObservableProxy.TypeOf(data) === observableProxy_1.Type.Value)\r\n this.observableTree.Write(rootPath, data);\r\n else\r\n for (var key in data)\r\n this.observableTree.Write(`${rootPath}.${key}`, data[key]);\r\n }\r\n Push(source, data) {\r\n var proxy = source;\r\n proxy.___node.Push(data);\r\n }\r\n Splice(source, start, deleteCount, ...items) {\r\n var proxy = source;\r\n proxy.___node.Splice(start, deleteCount, ...items);\r\n }\r\n}\r\nexports.StoreWriter = StoreWriter;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableProxy_1 = require(\"./observableProxy\");\r\nconst observableScope_1 = require(\"./observableScope\");\r\nclass ObservableNode {\r\n constructor(tree, key, parent, valuePathResolver) {\r\n this.tree = tree;\r\n this.key = key;\r\n this.parent = parent;\r\n this.valuePathResolver = valuePathResolver;\r\n this.destroyed = false;\r\n this.children = new Map();\r\n this.path = undefined;\r\n this.scope = observableScope_1.ObservableScope.Create(() => {\r\n var value = this.tree.Get(this.Path);\r\n var type = observableProxy_1.ObservableProxy.TypeOf(value);\r\n var resolvedPath = this.valuePathResolver && type === observableProxy_1.Type.Value && typeof value === 'string' ? this.valuePathResolver(value) || this.Path : this.Path;\r\n var self = this.Path === resolvedPath ? this : this.tree.GetNode(resolvedPath);\r\n var proxy = this === self ?\r\n type === observableProxy_1.Type.Value ?\r\n value :\r\n observableProxy_1.ObservableProxy.CreateFrom(this, type) :\r\n self.Proxy;\r\n return {\r\n value: value,\r\n type: observableProxy_1.ObservableProxy.TypeOf(value),\r\n self: self,\r\n proxy: proxy\r\n };\r\n });\r\n }\r\n get Key() {\r\n return this.key;\r\n }\r\n get Path() {\r\n if (this.path === undefined)\r\n this.path = (this.parent ? this.parent.Path + \".\" : \"\") + this.key;\r\n return this.path;\r\n }\r\n get Value() {\r\n return observableScope_1.ObservableScope.Value(this.scope).value;\r\n }\r\n get Type() {\r\n return observableScope_1.ObservableScope.Value(this.scope).type;\r\n }\r\n get Self() {\r\n return observableScope_1.ObservableScope.Value(this.scope).self;\r\n }\r\n get Proxy() {\r\n return observableScope_1.ObservableScope.Value(this.scope).proxy;\r\n }\r\n get ProxyArray() {\r\n if (this.Type !== observableProxy_1.Type.Array) {\r\n this.arrayScope && this.arrayScope.Destroy();\r\n this.arrayScope = null;\r\n return null;\r\n }\r\n this.arrayScope = this.arrayScope || observableScope_1.ObservableScope.Create(() => this.Value.map((c, i) => this.EnsureChild(i.toString()).Proxy));\r\n return observableScope_1.ObservableScope.Value(this.arrayScope);\r\n }\r\n get Parent() {\r\n return this.parent;\r\n }\r\n get Children() {\r\n return this.children;\r\n }\r\n UpdateKey(newKey) {\r\n if (!this.parent)\r\n return;\r\n this.parent.children.delete(this.key);\r\n this.parent.children.set(newKey, this);\r\n this.key = newKey;\r\n this.path = undefined;\r\n }\r\n EnsureChild(key) {\r\n var child = this.children.get(key);\r\n if (!child) {\r\n child = new ObservableNode(this.tree, key, this, this.valuePathResolver);\r\n this.children.set(key, child);\r\n }\r\n return child;\r\n }\r\n Update() {\r\n this.children.clear();\r\n observableScope_1.ObservableScope.Update(this.scope);\r\n }\r\n ArrayUpdate() {\r\n observableScope_1.ObservableScope.Update(this.arrayScope);\r\n var lengthNode = this.children.get('length');\r\n if (lengthNode)\r\n lengthNode.Update();\r\n observableScope_1.ObservableScope.Emit(this.scope);\r\n }\r\n Destroy() {\r\n this.destroyed = true;\r\n this.parent && !this.parent.destroyed && this.parent.Children.delete(this.key);\r\n this.children.forEach(c => c.Destroy());\r\n observableScope_1.ObservableScope.Destroy(this.scope);\r\n observableScope_1.ObservableScope.Destroy(this.arrayScope);\r\n }\r\n Push(data) {\r\n var array = this.Value;\r\n if (!Array.isArray(array))\r\n throw new Error(\"Node value is not an array.\");\r\n var ret = array.push(data);\r\n this.ArrayUpdate();\r\n return ret;\r\n }\r\n Splice(start, deleteCount, ...items) {\r\n deleteCount = deleteCount || 0;\r\n var array = this.Value;\r\n if (!Array.isArray(array))\r\n throw new Error(\"Node value is not an array.\");\r\n var startLength = array.length;\r\n var ret = array.splice(start, deleteCount, ...items);\r\n var x = start;\r\n var key = null;\r\n var newKey = null;\r\n var child = null;\r\n for (; x < (start + deleteCount); x++) {\r\n key = x.toString();\r\n child = this.Children.get(key);\r\n if (child)\r\n child.Destroy();\r\n }\r\n if (startLength < array.length)\r\n for (var y = startLength - 1; y >= x; y--) {\r\n key = y.toString();\r\n child = this.Children.get(key);\r\n if (child) {\r\n newKey = (y - deleteCount + items.length).toString();\r\n child.UpdateKey(newKey);\r\n }\r\n }\r\n else\r\n for (; x < startLength; x++) {\r\n key = x.toString();\r\n child = this.Children.get(key);\r\n if (child) {\r\n newKey = (x - deleteCount + items.length).toString();\r\n child.UpdateKey(newKey);\r\n }\r\n }\r\n this.ArrayUpdate();\r\n return ret;\r\n }\r\n}\r\nexports.ObservableNode = ObservableNode;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Type;\r\n(function (Type) {\r\n Type[Type[\"Value\"] = 0] = \"Value\";\r\n Type[Type[\"Object\"] = 1] = \"Object\";\r\n Type[Type[\"Array\"] = 2] = \"Array\";\r\n})(Type = exports.Type || (exports.Type = {}));\r\nvar ObservableProxy;\r\n(function (ObservableProxy) {\r\n function TypeOf(value) {\r\n if (!value)\r\n return Type.Value;\r\n if (Array.isArray(value))\r\n return Type.Array;\r\n else if (typeof value === 'object')\r\n return Type.Object;\r\n return Type.Value;\r\n }\r\n ObservableProxy.TypeOf = TypeOf;\r\n function CreateFrom(node, type) {\r\n switch (type) {\r\n case Type.Array:\r\n return CreateArrayProxy(node);\r\n case Type.Object:\r\n return CreateObjectProxy(node);\r\n default:\r\n throw new Error(\"Can't create proxy from Value type\");\r\n }\r\n }\r\n ObservableProxy.CreateFrom = CreateFrom;\r\n function CopyValue(value) {\r\n var type = TypeOf(value);\r\n if (type === Type.Value)\r\n return value;\r\n if (typeof value.toJSON === 'function')\r\n return value.toJSON();\r\n if (type === Type.Array)\r\n return value.map(v => CopyValue(v));\r\n else if (type === Type.Object) {\r\n var ret = {};\r\n for (var key in value)\r\n ret[key] = CopyValue(value[key]);\r\n return ret;\r\n }\r\n return null;\r\n }\r\n ObservableProxy.CopyValue = CopyValue;\r\n})(ObservableProxy = exports.ObservableProxy || (exports.ObservableProxy = {}));\r\nfunction CreateArrayProxy(node) {\r\n return new Proxy([], {\r\n get: (obj, prop) => {\r\n switch (prop) {\r\n case '___type':\r\n return Type.Array;\r\n case '___storeProxy':\r\n return true;\r\n case '___node':\r\n return node;\r\n case 'toJSON':\r\n return () => {\r\n return CopyNode(node);\r\n };\r\n case 'length':\r\n return node.EnsureChild(prop).Value;\r\n default:\r\n if (typeof (prop) === 'symbol')\r\n return node.ProxyArray[prop];\r\n if (!isNaN(parseInt(prop)))\r\n return node.EnsureChild(prop).Proxy;\r\n var func = obj[prop];\r\n return func && func.bind(node.ProxyArray);\r\n }\r\n },\r\n ownKeys: () => {\r\n return Reflect.ownKeys(node.Value);\r\n }\r\n });\r\n}\r\nfunction CreateObjectProxy(node) {\r\n return new Proxy({}, {\r\n get: (obj, prop) => {\r\n switch (prop) {\r\n case '___type':\r\n return Type.Object;\r\n case '___storeProxy':\r\n return true;\r\n case '___node':\r\n return node;\r\n case 'toJSON':\r\n return () => {\r\n return CopyNode(node);\r\n };\r\n default:\r\n if (typeof (prop) !== 'symbol')\r\n return node.EnsureChild(prop).Proxy;\r\n return obj[prop];\r\n }\r\n },\r\n ownKeys: () => {\r\n return Reflect.ownKeys(node.Value);\r\n }\r\n });\r\n}\r\nfunction CopyNode(node) {\r\n if (node.Type === Type.Value)\r\n return node.Value;\r\n var ret = null;\r\n if (node.Type === Type.Array)\r\n ret = node.Value.map((v, i) => CopyNode(node.Self.EnsureChild(i.toString()).Self));\r\n else {\r\n ret = {};\r\n for (var key in node.Value) {\r\n var child = node.Self.EnsureChild(key);\r\n ret[key] = CopyNode(child.Self);\r\n }\r\n }\r\n return ret;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst emitter_1 = require(\"../../Utils/emitter\");\r\nclass ObservableScopeValue {\r\n constructor(scope) {\r\n this.scope = scope;\r\n }\r\n get Value() {\r\n return ObservableScope.Value(this.scope);\r\n }\r\n}\r\nexports.ObservableScopeValue = ObservableScopeValue;\r\nclass ObservableScopeWrapper extends ObservableScopeValue {\r\n constructor(scope) {\r\n super(scope);\r\n if (scope.emitter) {\r\n this.scopeEmitter = emitter_1.Emitter.Create();\r\n emitter_1.Emitter.On(scope.emitter, () => emitter_1.Emitter.Emit(this.scopeEmitter, this));\r\n }\r\n }\r\n Scope(callback) {\r\n return new ObservableScope(() => callback(this.Value));\r\n }\r\n Watch(callback) {\r\n if (!this.scopeEmitter)\r\n return;\r\n emitter_1.Emitter.On(this.scopeEmitter, callback);\r\n callback(this);\r\n }\r\n Unwatch(callback) {\r\n if (!this.scopeEmitter)\r\n return;\r\n emitter_1.Emitter.Remove(this.scopeEmitter, callback);\r\n }\r\n Destroy() {\r\n DestroyScope(this.scope);\r\n this.scopeEmitter && this.scopeEmitter.clear();\r\n }\r\n}\r\nexports.ObservableScopeWrapper = ObservableScopeWrapper;\r\nclass ObservableScope extends ObservableScopeWrapper {\r\n constructor(getFunction) {\r\n super(ObservableScope.Create(getFunction));\r\n }\r\n}\r\nexports.ObservableScope = ObservableScope;\r\nvar currentSet = null;\r\nvar watching = false;\r\nfunction WatchAction(action) {\r\n var parentSet = currentSet;\r\n currentSet = null;\r\n var parentWatching = watching;\r\n watching = true;\r\n action();\r\n var lastSet = currentSet;\r\n currentSet = parentSet;\r\n watching = parentWatching;\r\n return lastSet;\r\n}\r\n(function (ObservableScope) {\r\n function Create(valueFunction) {\r\n if (typeof valueFunction !== 'function')\r\n return {\r\n value: valueFunction,\r\n dirty: false,\r\n destroyed: false\r\n };\r\n var scope = {\r\n getFunction: valueFunction,\r\n async: valueFunction[Symbol.toStringTag] === 'AsyncFunction',\r\n value: null,\r\n dirty: true,\r\n emitter: emitter_1.Emitter.Create(),\r\n emitters: null,\r\n destroyed: false,\r\n setCallback: function () {\r\n OnSet(scope);\r\n }\r\n };\r\n return scope;\r\n }\r\n ObservableScope.Create = Create;\r\n function Register(emitter) {\r\n if (!watching || !emitter)\r\n return;\r\n currentSet = currentSet || new Set();\r\n currentSet.add(emitter);\r\n }\r\n ObservableScope.Register = Register;\r\n function Value(scope) {\r\n if (!scope)\r\n return undefined;\r\n Register(scope.emitter);\r\n UpdateValue(scope);\r\n return scope.value;\r\n }\r\n ObservableScope.Value = Value;\r\n function Watch(scope, callback) {\r\n if (!scope || !scope.emitter)\r\n return;\r\n emitter_1.Emitter.On(scope.emitter, callback);\r\n }\r\n ObservableScope.Watch = Watch;\r\n function Unwatch(scope, callback) {\r\n if (!scope || !scope.emitter)\r\n return;\r\n emitter_1.Emitter.Remove(scope.emitter, callback);\r\n }\r\n ObservableScope.Unwatch = Unwatch;\r\n function Update(scope) {\r\n OnSet(scope);\r\n }\r\n ObservableScope.Update = Update;\r\n function Emit(scope) {\r\n emitter_1.Emitter.Emit(scope.emitter);\r\n }\r\n ObservableScope.Emit = Emit;\r\n function Destroy(scope) {\r\n DestroyScope(scope);\r\n }\r\n ObservableScope.Destroy = Destroy;\r\n})(ObservableScope = exports.ObservableScope || (exports.ObservableScope = {}));\r\nfunction OnSet(scope) {\r\n if (!scope || scope.dirty)\r\n return;\r\n scope.dirty = true;\r\n emitter_1.Emitter.Emit(scope.emitter, scope);\r\n}\r\nfunction UpdateValue(scope) {\r\n if (!scope.dirty)\r\n return;\r\n scope.dirty = false;\r\n var value = null;\r\n var emitters = WatchAction(() => value = scope.getFunction());\r\n UpdateEmitters(scope, emitters);\r\n if (scope.async)\r\n Promise.resolve(value).then(val => {\r\n scope.value = val;\r\n emitter_1.Emitter.Emit(scope.emitter, scope);\r\n });\r\n else\r\n scope.value = value;\r\n}\r\nfunction DestroyScope(scope) {\r\n if (!scope)\r\n return;\r\n scope.emitters && scope.emitters.forEach(e => emitter_1.Emitter.Remove(e, scope.setCallback));\r\n scope.emitters && scope.emitters.clear();\r\n scope.emitter && scope.emitter.clear();\r\n scope.destroyed = true;\r\n}\r\nfunction UpdateEmitters(scope, newEmitters) {\r\n if (newEmitters)\r\n newEmitters.forEach(e => {\r\n if (!scope.emitters || !scope.emitters.delete(e))\r\n emitter_1.Emitter.On(e, scope.setCallback);\r\n });\r\n if (scope.emitters)\r\n scope.emitters.forEach(e => emitter_1.Emitter.Remove(e, scope.setCallback));\r\n scope.emitters = newEmitters;\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst observableNode_1 = require(\"./observableNode\");\r\nconst observableProxy_1 = require(\"./observableProxy\");\r\nconst observableScope_1 = require(\"./observableScope\");\r\nclass ObservableTree {\r\n constructor(valuePathResolver) {\r\n this.valuePathResolver = valuePathResolver;\r\n this.rootStateMap = new Map();\r\n this.rootNodeMap = new Map();\r\n }\r\n Write(path, value) {\r\n this.WritePath(path, value);\r\n this.UpdatePathNode(path);\r\n }\r\n WriteAll(data) {\r\n for (var x = 0; x < data.length; x++)\r\n this.WritePath(data[x].path, data[x].value);\r\n for (var y = 0; y < data.length; y++)\r\n this.UpdatePathNode(data[y].path);\r\n }\r\n Get(path) {\r\n return path.split(\".\").reduce((pre, curr, index) => {\r\n if (index === 0)\r\n return this.rootStateMap.get(curr);\r\n return pre && pre[curr];\r\n }, null);\r\n }\r\n GetNode(path) {\r\n return path.split(\".\").reduce((pre, curr, index) => {\r\n if (index === 0) {\r\n var ret = this.rootNodeMap.get(curr);\r\n if (!ret) {\r\n ret = new observableNode_1.ObservableNode(this, curr, null, this.valuePathResolver);\r\n this.rootNodeMap.set(curr, ret);\r\n }\r\n return ret;\r\n }\r\n return pre.EnsureChild(curr);\r\n }, null);\r\n }\r\n Delete(path) {\r\n var node = this.GetNode(path);\r\n node.Destroy();\r\n }\r\n Destroy() {\r\n this.rootStateMap.clear();\r\n this.rootNodeMap.forEach(node => node.Destroy());\r\n this.rootNodeMap.clear();\r\n }\r\n Scope(path, func) {\r\n return new observableScope_1.ObservableScope(() => {\r\n var node = this.GetNode(path);\r\n return func && func(node.Proxy) || node.Proxy;\r\n });\r\n }\r\n WritePath(path, value) {\r\n var pathParts = path.split(\".\");\r\n var rootPart = pathParts[0];\r\n if (pathParts.length === 1)\r\n this.rootStateMap.set(rootPart, value);\r\n else {\r\n var curValue = this.rootStateMap.get(rootPart);\r\n for (var x = 1; x < pathParts.length - 1; x++) {\r\n if (!curValue)\r\n throw new Error(\"Unable to write path: \" + path + \". Falsey value found at: \" + pathParts.slice(0, x).join(\".\"));\r\n curValue = curValue[pathParts[x]];\r\n }\r\n if (!curValue)\r\n throw new Error(\"Unable to write path: \" + path + \". Falsey value found at: \" + pathParts.slice(0, x).join(\".\"));\r\n curValue[pathParts[x]] = value;\r\n }\r\n }\r\n UpdatePathNode(path) {\r\n var node = this.GetNode(path);\r\n node.Update();\r\n if (node.Parent && node.Parent.Type === observableProxy_1.Type.Array) {\r\n node.Parent.ArrayUpdate();\r\n if (node.Key === 'length') {\r\n var index = node.Value;\r\n var childNode = node.Parent.Children.get(index.toString());\r\n while (childNode) {\r\n childNode.Destroy();\r\n index++;\r\n childNode = node.Parent.Children.get(index.toString());\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.ObservableTree = ObservableTree;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar store_1 = require(\"./Store/store\");\r\nexports.Store = store_1.Store;\r\nvar storeSync_1 = require(\"./Store/storeSync\");\r\nexports.StoreSync = storeSync_1.StoreSync;\r\nvar storeAsync_1 = require(\"./Store/storeAsync\");\r\nexports.StoreAsync = storeAsync_1.StoreAsync;\r\nvar observableScope_1 = require(\"./Tree/observableScope\");\r\nexports.ObservableScope = observableScope_1.ObservableScope;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar StepFunctions;\r\n(function (StepFunctions) {\r\n function* EaseIn(count) {\r\n var diff = 1 / count;\r\n for (var t = diff, x = 0; x < count; x++, t += diff)\r\n yield (1 - t) * (1 - t) * (1 - t) * 0 + 3 * (1 - t) * (1 - t) * t * 1 + 3 * (1 - t) * t * t * 1 + t * t * t * 1;\r\n }\r\n StepFunctions.EaseIn = EaseIn;\r\n function* Linear(count) {\r\n var diff = 1 / count;\r\n for (var t = diff, x = 0; x < count; x++, t += diff)\r\n yield t;\r\n }\r\n StepFunctions.Linear = Linear;\r\n})(StepFunctions || (StepFunctions = {}));\r\nvar AnimationType;\r\n(function (AnimationType) {\r\n AnimationType[AnimationType[\"Linear\"] = 0] = \"Linear\";\r\n AnimationType[AnimationType[\"EaseIn\"] = 1] = \"EaseIn\";\r\n})(AnimationType = exports.AnimationType || (exports.AnimationType = {}));\r\nclass Animation {\r\n constructor(type, duration, update) {\r\n this.running = false;\r\n this.start = null;\r\n this.end = null;\r\n this.enabled = true;\r\n this.type = type;\r\n this.frameCount = Math.ceil((duration / 1000) * 60);\r\n this.frameTimings = [];\r\n var frameTime = duration / this.frameCount;\r\n for (var x = 0; x < this.frameCount; x++)\r\n this.frameTimings[x] = (x + 1) * frameTime;\r\n this.update = update;\r\n this.animationTimeouts = [];\r\n }\r\n get Running() {\r\n return this.running;\r\n }\r\n get Start() {\r\n return this.start;\r\n }\r\n get End() {\r\n return this.end;\r\n }\r\n get Enabled() {\r\n return this.enabled;\r\n }\r\n Animate(start, end) {\r\n if (!this.enabled)\r\n return;\r\n var diff = end - start;\r\n if (diff === 0)\r\n return;\r\n this.Cancel();\r\n this.running = true;\r\n this.start = start;\r\n this.end = end;\r\n return new Promise(resolve => {\r\n var stepFunc = StepFunctions[AnimationType[this.type]];\r\n var index = 0;\r\n for (var step of stepFunc(this.frameCount)) {\r\n var value = (step * diff) + start;\r\n this.SetTimeout(index, value, index === (this.frameCount - 1) ? resolve : null);\r\n index++;\r\n }\r\n }).then(() => {\r\n this.running = false;\r\n this.start = null;\r\n this.end = null;\r\n });\r\n }\r\n Disable() {\r\n this.Cancel();\r\n this.enabled = false;\r\n }\r\n Enable() {\r\n this.enabled = true;\r\n }\r\n Cancel() {\r\n for (var x = 0; x < this.animationTimeouts.length; x++)\r\n clearTimeout(this.animationTimeouts[x]);\r\n this.running = false;\r\n this.start = null;\r\n this.end = null;\r\n }\r\n Destroy() {\r\n this.Cancel();\r\n }\r\n SetTimeout(index, value, resolve) {\r\n this.animationTimeouts[index] = setTimeout(() => {\r\n this.update(value);\r\n resolve && resolve();\r\n }, this.frameTimings[index]);\r\n }\r\n}\r\nexports.Animation = Animation;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst list_1 = require(\"./list\");\r\nclass AsyncQueue {\r\n constructor() {\r\n this.running = false;\r\n this.queue = list_1.List.Create();\r\n }\r\n Next(callback) {\r\n const ret = new Promise((resolve, reject) => {\r\n list_1.List.Add(this.queue, async function () {\r\n try {\r\n const ret = await callback();\r\n resolve(ret);\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n });\r\n });\r\n this.Start();\r\n return ret;\r\n }\r\n Stop() {\r\n list_1.List.Clear(this.queue);\r\n }\r\n Start() {\r\n if (this.running)\r\n return;\r\n this.running = true;\r\n this.ExecuteQueue();\r\n }\r\n async ExecuteQueue() {\r\n const callback = list_1.List.Pop(this.queue);\r\n if (callback !== null) {\r\n await callback();\r\n this.ExecuteQueue();\r\n }\r\n else\r\n this.running = false;\r\n }\r\n}\r\nexports.AsyncQueue = AsyncQueue;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst store_1 = require(\"../Store/Store/store\");\r\nconst Store_1 = require(\"../Store\");\r\nconst observableScope_1 = require(\"../Store/Tree/observableScope\");\r\nfunction State() {\r\n return StateDecorator;\r\n}\r\nexports.State = State;\r\nfunction StateDecorator(target, propertyKey) {\r\n const propKey = `StoreDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n return store ? store.Root.Value : null;\r\n },\r\n set: function (val) {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n if (!store)\r\n map.set(propKey, new store_1.Store(val));\r\n else\r\n store.Merge(val);\r\n }\r\n };\r\n}\r\nfunction StateSync() {\r\n return StateSyncDecorator;\r\n}\r\nexports.StateSync = StateSync;\r\nfunction StateSyncDecorator(target, propertyKey) {\r\n const propKey = `StoreSyncDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n return store ? store.Root.Value : null;\r\n },\r\n set: function (val) {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n if (!store)\r\n map.set(propKey, new Store_1.StoreSync(val));\r\n else\r\n store.Merge(val);\r\n }\r\n };\r\n}\r\nfunction StateAsync() {\r\n return StateAsyncDecorator;\r\n}\r\nexports.StateAsync = StateAsync;\r\nfunction StateAsyncDecorator(target, propertyKey) {\r\n const propKey = `StoreAsyncDecorator_${propertyKey}`;\r\n const scopeKey = `StoreAsyncDecorator_Scope_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n DestroyDecorator(target, scopeKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var scope = map.get(scopeKey);\r\n return scope ? scope.Value : null;\r\n },\r\n set: function (val) {\r\n var map = this.DecoratorMap;\r\n var store = map.get(propKey);\r\n if (!store) {\r\n store = new Store_1.StoreAsync((val) => val.___id, { ___id: \"ROOT\", data: val });\r\n map.set(propKey, store);\r\n map.set(scopeKey, store.Scope(\"ROOT\", val => val.data));\r\n }\r\n else\r\n store.Action(\"ROOT\", async (root, writer) => await writer.Merge(root.data, val));\r\n }\r\n };\r\n}\r\nfunction Scope() {\r\n return ScopeDecorator;\r\n}\r\nexports.Scope = Scope;\r\nfunction ScopeDecorator(target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"Scope decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"Scope decorator does not support setters\";\r\n const propKey = `ScopeDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var scope = map.get(propKey);\r\n if (!scope) {\r\n const getter = descriptor.get.bind(this);\r\n scope = new observableScope_1.ObservableScope(getter);\r\n map.set(propKey, scope);\r\n }\r\n return scope.Value;\r\n }\r\n };\r\n}\r\nfunction DestroyScope() {\r\n return DestroyScopeDecorator;\r\n}\r\nexports.DestroyScope = DestroyScope;\r\nfunction DestroyScopeDecorator(target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"Destroy Scope decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"Destroy Scope decorator does not support setters\";\r\n const propKey = `ScopeDecorator_${propertyKey}`;\r\n DestroyDecorator(target, propKey);\r\n const valKey = `ScopeDecorator_${propertyKey}_Value`;\r\n DestroyDecorator(target, valKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var scope = map.get(propKey);\r\n if (!scope) {\r\n const getter = descriptor.get.bind(this);\r\n scope = new observableScope_1.ObservableScope(getter);\r\n map.set(propKey, scope);\r\n scope.Watch(scope => {\r\n var lastValue = map.get(valKey);\r\n lastValue && lastValue.Destroy();\r\n map.set(valKey, scope.Value);\r\n });\r\n }\r\n return scope.Value;\r\n }\r\n };\r\n}\r\nfunction Computed() {\r\n return ComputedDecorator;\r\n}\r\nexports.Computed = Computed;\r\nfunction ComputedDecorator(target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"Computed decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"Computed decorator does not support setters\";\r\n const scopeKey = `ComputedDecorator_Scope_${propertyKey}`;\r\n const storeKey = `ComputedDecorator_Store_${propertyKey}`;\r\n DestroyDecorator(target, scopeKey);\r\n DestroyDecorator(target, storeKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var store = map.get(storeKey);\r\n if (!store) {\r\n const getter = descriptor.get.bind(this);\r\n const scope = new observableScope_1.ObservableScope(getter);\r\n store = new Store_1.StoreSync(scope.Value);\r\n scope.Watch(scope => {\r\n if (!this.Destroyed)\r\n store.Write(scope.Value);\r\n });\r\n map.set(scopeKey, scope);\r\n map.set(storeKey, store);\r\n }\r\n return store.Root.Value;\r\n }\r\n };\r\n}\r\nfunction ComputedAsync(idFunc) {\r\n return ComputedAsyncDecorator.bind(null, idFunc);\r\n}\r\nexports.ComputedAsync = ComputedAsync;\r\nfunction ComputedAsyncDecorator(idFunc, target, propertyKey, descriptor) {\r\n if (!(descriptor && descriptor.get))\r\n throw \"ComputedAsync decorator requires a getter\";\r\n if (descriptor && descriptor.set)\r\n throw \"ComputedAsync decorator does not support setters\";\r\n const scopeKey = `ComputedDecorator_Scope_${propertyKey}`;\r\n const storeKey = `ComputedDecorator_Store_${propertyKey}`;\r\n const storeScopeKey = `ComputedDecorator_StoreScope_${propertyKey}`;\r\n DestroyDecorator(target, scopeKey);\r\n DestroyDecorator(target, storeKey);\r\n DestroyDecorator(target, storeScopeKey);\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n var map = this.DecoratorMap;\r\n var storeScope = map.get(storeScopeKey);\r\n if (!storeScope) {\r\n const getter = descriptor.get.bind(this);\r\n const scope = new observableScope_1.ObservableScope(() => {\r\n var value = getter();\r\n if (value && typeof value.toJSON === 'function')\r\n value = value.toJSON();\r\n return value;\r\n });\r\n const store = new Store_1.StoreAsync((val) => val._id, { _id: \"ROOT\", data: scope.Value });\r\n scope.Watch(scope => {\r\n if (!this.Destroyed)\r\n store.Write({ _id: \"ROOT\", data: scope.Value });\r\n });\r\n storeScope = store.Scope(\"ROOT\", (val) => val.data);\r\n map.set(storeScopeKey, storeScope);\r\n map.set(scopeKey, scope);\r\n map.set(storeKey, store);\r\n }\r\n return storeScope.Value;\r\n }\r\n };\r\n}\r\nfunction Inject(type) {\r\n return InjectorDecorator.bind(null, type);\r\n}\r\nexports.Inject = Inject;\r\nfunction InjectorDecorator(type, target, propertyKey, descriptor) {\r\n return {\r\n configurable: false,\r\n enumerable: true,\r\n get: function () {\r\n return this.Injector.Get(type);\r\n },\r\n set: function (val) {\r\n this.Injector.Set(type, val);\r\n }\r\n };\r\n}\r\nfunction Destroy() {\r\n return DestroyDecorator;\r\n}\r\nexports.Destroy = Destroy;\r\n(function (Destroy) {\r\n function Get(value) {\r\n return value && value.DestroyDecorator_Destroys || [];\r\n }\r\n function All(value) {\r\n var arr = Get(value);\r\n arr.map(prop => (value[prop] || value.DecoratorMap.get(prop)))\r\n .filter(o => !!o)\r\n .forEach(o => o.Destroy());\r\n }\r\n Destroy.All = All;\r\n})(Destroy = exports.Destroy || (exports.Destroy = {}));\r\nfunction DestroyDecorator(target, propertyKey) {\r\n var proto = target;\r\n proto.DestroyDecorator_Destroys = proto.DestroyDecorator_Destroys || [];\r\n proto.DestroyDecorator_Destroys.push(propertyKey);\r\n}\r\nfunction PreReqTemplate(template) {\r\n return PreReqTemplateDecorator.bind(null, template);\r\n}\r\nexports.PreReqTemplate = PreReqTemplate;\r\n(function (PreReqTemplate) {\r\n function Get(value) {\r\n var func = value && value.PreReqTemplateDecorator_Template;\r\n var ret = func ? func() : [];\r\n if (!Array.isArray(ret))\r\n ret = [ret];\r\n return ret;\r\n }\r\n PreReqTemplate.Get = Get;\r\n})(PreReqTemplate = exports.PreReqTemplate || (exports.PreReqTemplate = {}));\r\nfunction PreReqTemplateDecorator(template, target) {\r\n var proto = target.prototype;\r\n proto.PreReqTemplateDecorator_Template = template;\r\n}\r\nfunction PreReq() {\r\n return PreReqDecorator;\r\n}\r\nexports.PreReq = PreReq;\r\n(function (PreReq) {\r\n function Get(value) {\r\n return value && value.PreReqDecorator_PreReqs || [];\r\n }\r\n function All(value) {\r\n var arr = Get(value).map((prop) => (value[prop] && value[prop].Init) || Promise.resolve());\r\n return Promise.all(arr);\r\n }\r\n PreReq.All = All;\r\n function Has(value) {\r\n return Get(value).length > 0;\r\n }\r\n PreReq.Has = Has;\r\n})(PreReq = exports.PreReq || (exports.PreReq = {}));\r\nfunction PreReqDecorator(target, propertyKey) {\r\n var proto = target;\r\n proto.PreReqDecorator_PreReqs = proto.PreReqDecorator_PreReqs || [];\r\n proto.PreReqDecorator_PreReqs.push(propertyKey);\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Emitter;\r\n(function (Emitter) {\r\n function Create() {\r\n return new Set();\r\n }\r\n Emitter.Create = Create;\r\n function On(emitter, callback) {\r\n emitter.add(callback);\r\n }\r\n Emitter.On = On;\r\n function Emit(emitter, ...args) {\r\n emitter.forEach(function (cb) {\r\n cb(...args);\r\n });\r\n }\r\n Emitter.Emit = Emit;\r\n function Remove(emitter, callback) {\r\n emitter.delete(callback);\r\n }\r\n Emitter.Remove = Remove;\r\n})(Emitter = exports.Emitter || (exports.Emitter = {}));\r\n","\"use strict\";\r\nfunction __export(m) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__export(require(\"./decorators\"));\r\n__export(require(\"./animation\"));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nclass Injector {\r\n constructor() {\r\n this.parent = Injector.Current();\r\n this.typeMap = new Map();\r\n }\r\n Get(type) {\r\n if (this.typeMap.size === 0)\r\n return this.parent && this.parent.Get(type);\r\n var ret = this.typeMap.get(type);\r\n if (!ret)\r\n ret = this.parent && this.parent.Get(type);\r\n return ret;\r\n }\r\n Set(type, instance) {\r\n this.typeMap.set(type, instance);\r\n }\r\n}\r\nexports.Injector = Injector;\r\n(function (Injector) {\r\n var scope = null;\r\n function Current() {\r\n return scope;\r\n }\r\n Injector.Current = Current;\r\n function Scope(injector, action) {\r\n var parent = Current();\r\n scope = injector;\r\n action();\r\n scope = parent;\r\n }\r\n Injector.Scope = Scope;\r\n})(Injector = exports.Injector || (exports.Injector = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar List;\r\n(function (List) {\r\n function Create() {\r\n return {\r\n head: null,\r\n tail: null,\r\n size: 0\r\n };\r\n }\r\n List.Create = Create;\r\n function Clear(list) {\r\n list.head = null;\r\n list.tail = null;\r\n list.size = 0;\r\n }\r\n List.Clear = Clear;\r\n function Push(list, data) {\r\n var node = { previous: null, next: null, data: data };\r\n if (list.size === 0) {\r\n list.head = node;\r\n list.tail = node;\r\n list.size = 1;\r\n }\r\n else {\r\n node.next = list.head;\r\n list.head.previous = node;\r\n list.head = node;\r\n list.size++;\r\n }\r\n return node;\r\n }\r\n List.Push = Push;\r\n function Pop(list) {\r\n if (list.size === 0)\r\n return null;\r\n var node = list.head;\r\n list.head = node.next;\r\n if (list.head)\r\n list.head.previous = null;\r\n list.size--;\r\n if (list.size === 0)\r\n list.tail = null;\r\n return node.data;\r\n }\r\n List.Pop = Pop;\r\n function Add(list, data) {\r\n var node = { previous: null, next: null, data: data };\r\n if (list.size === 0) {\r\n list.head = node;\r\n list.tail = node;\r\n list.size = 1;\r\n }\r\n else {\r\n node.previous = list.tail;\r\n list.tail.next = node;\r\n list.tail = node;\r\n list.size++;\r\n }\r\n return node;\r\n }\r\n List.Add = Add;\r\n function AddBefore(list, node, data) {\r\n if (!node)\r\n return List.Add(list, data);\r\n var newNode = { previous: null, next: null, data: data };\r\n var prevNode = node.previous;\r\n newNode.next = node;\r\n node.previous = newNode;\r\n if (list.head === node)\r\n list.head = newNode;\r\n if (prevNode) {\r\n prevNode.next = newNode;\r\n newNode.previous = prevNode;\r\n }\r\n list.size++;\r\n return newNode;\r\n }\r\n List.AddBefore = AddBefore;\r\n function AddAfter(list, node, data) {\r\n if (!node)\r\n return List.Push(list, data);\r\n var newNode = { previous: null, next: null, data: data };\r\n var nextNode = node.next;\r\n node.next = newNode;\r\n newNode.previous = node;\r\n if (list.tail === node)\r\n list.tail = newNode;\r\n if (nextNode) {\r\n nextNode.previous = newNode;\r\n newNode.next = nextNode;\r\n }\r\n list.size++;\r\n return newNode;\r\n }\r\n List.AddAfter = AddAfter;\r\n function Remove(list) {\r\n if (list.size === 0)\r\n return null;\r\n var node = list.tail;\r\n list.tail = node.previous;\r\n if (list.tail)\r\n list.tail.next = null;\r\n list.size--;\r\n if (list.size === 0)\r\n list.head = null;\r\n return node.data;\r\n }\r\n List.Remove = Remove;\r\n function ForEach(list, callback) {\r\n var node = list.head;\r\n while (node) {\r\n callback(node.data);\r\n node = node.next;\r\n }\r\n }\r\n List.ForEach = ForEach;\r\n})(List = exports.List || (exports.List = {}));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst list_1 = require(\"./list\");\r\nconst workTimeMs = 16;\r\nconst contextQueue = list_1.List.Create();\r\nvar threadContext = null;\r\nvar timeoutRunning = false;\r\nfunction ProcessQueue() {\r\n var workStartTime = Date.now();\r\n var ctx;\r\n while ((Date.now() - workStartTime) < workTimeMs && (ctx = list_1.List.Pop(contextQueue)))\r\n DoWork(ctx, workStartTime);\r\n if (contextQueue.size > 0)\r\n setTimeout(ProcessQueue);\r\n else\r\n timeoutRunning = false;\r\n}\r\nfunction ScheduleWork(ctx) {\r\n list_1.List.Add(contextQueue, ctx);\r\n if (timeoutRunning)\r\n return;\r\n timeoutRunning = true;\r\n setTimeout(ProcessQueue);\r\n}\r\nfunction Invoke(ctx, callback) {\r\n var parent = ctx.workEndNode;\r\n ctx.workEndNode = ctx.workList.head;\r\n callback();\r\n ctx.workEndNode = parent;\r\n}\r\nfunction DoWork(ctx, workStartTime = Date.now()) {\r\n var parentContext = threadContext;\r\n threadContext = ctx;\r\n var async = ctx.async;\r\n var callback;\r\n while (async === ctx.async && (Date.now() - workStartTime) < workTimeMs && (callback = list_1.List.Pop(ctx.workList)))\r\n Invoke(ctx, callback);\r\n if (ctx.workList.size > 0)\r\n ScheduleWork(ctx);\r\n threadContext = parentContext;\r\n}\r\nfunction CreateContext() {\r\n return {\r\n async: false,\r\n workEndNode: null,\r\n workList: list_1.List.Create()\r\n };\r\n}\r\nfunction ScheduleCallback(callback, before, async) {\r\n threadContext = threadContext || CreateContext();\r\n threadContext.async = threadContext.async || async;\r\n if (before)\r\n list_1.List.AddBefore(threadContext.workList, threadContext.workEndNode, callback);\r\n else if (threadContext.workEndNode)\r\n list_1.List.AddAfter(threadContext.workList, threadContext.workEndNode, callback);\r\n else\r\n threadContext.workEndNode = list_1.List.Add(threadContext.workList, callback);\r\n}\r\nfunction SynchWithoutThread(callback) {\r\n var workStartTime = Date.now();\r\n callback();\r\n if (threadContext)\r\n if (threadContext.async)\r\n ScheduleWork(threadContext);\r\n else\r\n DoWork(threadContext, workStartTime);\r\n threadContext = null;\r\n}\r\nfunction Schedule(callback) {\r\n ScheduleCallback(callback, true, true);\r\n}\r\nexports.Schedule = Schedule;\r\nfunction After(callback) {\r\n ScheduleCallback(callback, false, false);\r\n}\r\nexports.After = After;\r\nfunction Callback(callback) {\r\n return function (a, b, c, d) {\r\n Schedule(function () { callback(a, b, c, d); });\r\n };\r\n}\r\nexports.Callback = Callback;\r\nvar inSynchCallback = false;\r\nfunction Synch(callback) {\r\n if (threadContext || inSynchCallback)\r\n callback();\r\n else {\r\n inSynchCallback = true;\r\n SynchWithoutThread(callback);\r\n inSynchCallback = false;\r\n }\r\n}\r\nexports.Synch = Synch;\r\nfunction Thread(callback) {\r\n if (threadContext)\r\n ScheduleCallback(callback, true, false);\r\n else\r\n Synch(callback);\r\n}\r\nexports.Thread = Thread;\r\nfunction ThreadAsync(callback) {\r\n return new Promise(resolve => Thread(function () {\r\n callback();\r\n Thread(resolve);\r\n }));\r\n}\r\nexports.ThreadAsync = ThreadAsync;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar component_1 = require(\"./Node/component\");\r\nexports.Component = component_1.Component;\r\n","\"use strict\";\r\nfunction __export(m) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__export(require(\"./index\"));\r\n__export(require(\"./Utils\"));\r\nvar Store_1 = require(\"./Store\");\r\nexports.ObservableScope = Store_1.ObservableScope;\r\nexports.Store = Store_1.Store;\r\nexports.StoreAsync = Store_1.StoreAsync;\r\n__export(require(\"./DOM\"));\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst Web = require(\"./web.export\");\r\nfor (var key in Web)\r\n window[key] = Web[key];\r\n"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "5.0.35",
3
+ "version": "5.0.37",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",