PageSourceSearch

https://www.samoens.com/wp-content/plugins/yata-elements/public/li…?ver=280e88117e2214535cbc4142c2b19baf

js samoens.com collected 2026-10-02 07:55:27 UTC 722,480 bytes, 14,250 lines download raw bytes

vendor: 5,281 bytes, lines 1-160
1/******/ (function (modules) { // webpackBootstrap
2/******/ 	// The module cache
3/******/ 	var installedModules = {};
4/******/
5/******/ 	// The require function
6/******/ 	function __webpack_require__(moduleId) {
7/******/
8/******/ 		// Check if module is in cache
9/******/ 		if (installedModules[moduleId]) {
10/******/ 			return installedModules[moduleId].exports;
11            /******/
12}
13/******/ 		// Create a new module (and put it into the cache)
14/******/ 		var module = installedModules[moduleId] = {
15/******/ 			i: moduleId,
16/******/ 			l: false,
17/******/ 			exports: {}
18            /******/
19};
20/******/
21/******/ 		// Execute the module function
22/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
23/******/
24/******/ 		// Flag the module as loaded
25/******/ 		module.l = true;
26/******/
27/******/ 		// Return the exports of the module
28/******/ 		return module.exports;
29        /******/
30}
31/******/
32/******/
33/******/ 	// expose the modules object (__webpack_modules__)
34/******/ 	__webpack_require__.m = modules;
35/******/
36/******/ 	// expose the module cache
37/******/ 	__webpack_require__.c = installedModules;
38/******/
39/******/ 	// identity function for calling harmony imports with the correct context
40/******/ 	__webpack_require__.i = function (value) { return value; };
41/******/
42/******/ 	// define getter function for harmony exports
43/******/ 	__webpack_require__.d = function (exports, name, getter) {
44/******/ 		if (!__webpack_require__.o(exports, name)) {
45/******/ 			Object.defineProperty(exports, name, {
46/******/ 				configurable: false,
47/******/ 				enumerable: true,
48/******/ 				get: getter
49    /******/
50});
51            /******/
52}
53        /******/
54};
55/******/
56/******/ 	// getDefaultExport function for compatibility with non-harmony modules
57/******/ 	__webpack_require__.n = function (module) {
58/******/ 		var getter = module && module.__esModule ?
59/******/ 			function getDefault() { return module['default']; } :
60/******/ 			function getModuleExports() { return module; };
61/******/ 		__webpack_require__.d(getter, 'a', getter);
62/******/ 		return getter;
63        /******/
64};
65/******/
66/******/ 	// Object.prototype.hasOwnProperty.call
67/******/ 	__webpack_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68/******/
69/******/ 	// __webpack_public_path__
70/******/ 	__webpack_require__.p = "";
71/******/
72/******/ 	// Load entry module and return exports
73/******/ 	return __webpack_require__(__webpack_require__.s = 3);
74    /******/
75})
76/************************************************************************/
77/******/([
78/* 0 */
79/***/ (function (module, exports, __webpack_require__) {
80
81        "use strict";
82
83
84        exports.__esModule = true;
85
86        var _libs = __webpack_require__(2);
87
88        __webpack_require__(1);
89
90        exports.default = _libs.$;
91
92        /***/
93}),
94/* 1 */
95/***/ (function (module, exports, __webpack_require__) {
96
97        "use strict";
98
99
100        var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
101
102/******/(function (modules) {
103  // webpackBootstrap
104  /******/ // The module cache
105  /******/var installedModules = {};
106  /******/
107  /******/ // The require function
108  /******/function __webpack_require__(moduleId) {
109    /******/
110    /******/ // Check if module is in cache
111    /******/if (installedModules[moduleId])
112      /******/return installedModules[moduleId].exports;
113    /******/
114    /******/ // Create a new module (and put it into the cache)
115    /******/var module = installedModules[moduleId] = {
116      /******/i: moduleId,
117      /******/l: false,
118      /******/exports: {}
119                    /******/
120};
121    /******/
122    /******/ // Execute the module function
123    /******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
124    /******/
125    /******/ // Flag the module as loaded
126    /******/module.l = true;
127    /******/
128    /******/ // Return the exports of the module
129    /******/return module.exports;
130                /******/
131            }
132  /******/
133  /******/
134  /******/ // expose the modules object (__webpack_modules__)
135  /******/__webpack_require__.m = modules;
136  /******/
137  /******/ // expose the module cache
138  /******/__webpack_require__.c = installedModules;
139  /******/
140  /******/ // identity function for calling harmony imports with the correct context
141  /******/__webpack_require__.i = function (value) {
142                return value;
143            };
144  /******/
145  /******/ // define getter function for harmony exports
146  /******/__webpack_require__.d = function (exports, name, getter) {
147    /******/if (!__webpack_require__.o(exports, name)) {
148      /******/Object.defineProperty(exports, name, {
149        /******/configurable: false,
150        /******/enumerable: true,
151        /******/get: getter
152                /******/
153});
154                    /******/
155                }
156                /******/
157            };
158  /******/
159  /******/ // getDefaultExport function for compatibility with non-harmony modules
160  /******/__webpack_require__.n = function (module) {
161    /******/var getter = module && module.__esModule ?
162    /******/function getDefault() {
163                        return module['default'];
164                    } :
165    /******/function getModuleExports() {
166                        return module;
167                    };
168    /******/__webpack_require__.d(getter, 'a', getter);
169    /******/return getter;
170                /******/
171            };
172  /******/
173  /******/ // Object.prototype.hasOwnProperty.call
174  /******/__webpack_require__.o = function (object, property) {
175                return Object.prototype.hasOwnProperty.call(object, property);
176            };
177  /******/
178  /******/ // __webpack_public_path__
179  /******/__webpack_require__.p = "";
180  /******/
181  /******/ // Load entry module and return exports
182  /******/return __webpack_require__(__webpack_require__.s = 72);
183            /******/
184        })(
185/************************************************************************/
186/******/[
187/* 0 */
188/***/function (module, exports, __webpack_require__) {
189
190                    "use strict";
191                    'use strict';
192
193                    exports.__esModule = true;
194                    var _$ = true ? window.jQuery : require('jquery'),
195                        _html2canvas = true ? window.html2canvas : require('html2canvas'),
196                        _THREE = true ? window.THREE : require('three'),
197                        _React = true ? window.React : require('react'),
198                        _ReactDOM = true ? window.ReactDOM : require('react-dom'),
199                        _PDFJS = true ? window.PDFJS : require('pdfjs'),
200                        _tr = function _tr(s) {
201                            return (window.iberezansky || {}).tr && window.iberezansky.tr(s) || s;
202                        };
203
204                    exports.$ = _$;
205                    exports.html2canvas = _html2canvas;
206                    exports.THREE = _THREE;
207                    exports.React = _React;
208                    exports.ReactDOM = _ReactDOM;
209                    exports.PDFJS = _PDFJS;
210                    exports.tr = _tr;
211
212                    /***/
213                },
214/* 1 */
215/***/function (module, exports, __webpack_require__) {
216
217                    "use strict";
218                    'use strict';
219
220                    exports.__esModule = true;
221
222                    var _extends = Object.assign || function (target) {
223                        for (var i = 1; i < arguments.length; i++) {
224                            var source = arguments[i]; for (var key in source) {
225                                if (Object.prototype.hasOwnProperty.call(source, key)) {
226                                    target[key] = source[key];
227                                }
228                            }
229                        } return target;
230                    };
231
232                    var _$ = true ? window.jQuery : require('jquery'),
233                        _html2canvas = true ? window.html2canvas : require('html2canvas'),
234                        _THREE = true ? window.THREE : require('three'),
235                        _PDFJS = true ? window.PDFJS : require('pdfjs'),
236                        _tr = function _tr(s) {
237                            return (window.iberezansky || {}).tr && window.iberezansky.tr(s) || s;
238                        };
239
240                    if (window.FB3D_LOCALE) {
241                        window.iberezansky = _extends({}, window.iberezansky, {
242                            tr: function tr(s) {
243                                return (FB3D_LOCALE.dictionary || {})[s] || s;
244                            }
245                        });
246                    }
247
248                    exports.$ = _$;
249                    exports.html2canvas = _html2canvas;
250                    exports.THREE = _THREE;
251                    exports.PDFJS = _PDFJS;
252                    exports.tr = _tr;
253
254                    /***/
255                },
256/* 2 */
257/***/function (module, exports) {
258
259                    "use strict";
260                    'use strict';
261
262                    exports.__esModule = true;
263
264                    function _classCallCheck(instance, Constructor) {
265                        if (!(instance instanceof Constructor)) {
266                            throw new TypeError("Cannot call a class as a function");
267                        }
268                    }
269
270                    var BaseMathUtils = function () {
271                        function BaseMathUtils() {
272                            _classCallCheck(this, BaseMathUtils);
273                        }
274
275                        BaseMathUtils.sum1 = function sum1(ka, a, kb, b) {
276                            return [ka * a[0] + kb * b[0]];
277                        };
278
279                        BaseMathUtils.sum2 = function sum2(ka, a, kb, b) {
280                            return [ka * a[0] + kb * b[0], ka * a[1] + kb * b[1]];
281                        };
282
283                        BaseMathUtils.sum3 = function sum3(ka, a, kb, b) {
284                            return [ka * a[0] + kb * b[0], ka * a[1] + kb * b[1], ka * a[2] + kb * b[2]];
285                        };
286
287                        BaseMathUtils.sum4 = function sum4(ka, a, kb, b) {
288                            return [ka * a[0] + kb * b[0], ka * a[1] + kb * b[1], ka * a[2] + kb * b[2], ka * a[3] + kb * b[3]];
289                        };
290
291                        BaseMathUtils.rk4 = function rk4(dy, t, dt, y) {
292                            var sum = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : BaseMathUtils.sum[y.length - 1];
293
294                            var k1 = dy(t, y),
295                                k2 = dy(t + dt / 2, sum(1, y, dt / 2, k1)),
296                                k3 = dy(t + dt / 2, sum(1, y, dt / 2, k2)),
297                                k4 = dy(t + dt, sum(1, y, dt, k3));
298                            return sum(1, y, dt / 6, sum(1, sum(1, k1, 2, k2), 1, sum(2, k3, 1, k4)));
299                        };
300
301                        BaseMathUtils.extrapolateLinear = function extrapolateLinear(x, y, xi) {
302                            return y[0] + (y[1] - y[0]) / (x[1] - x[0]) * (xi - x[0]);
303                        };
304
305                        BaseMathUtils.interpolateLinear = function interpolateLinear(x, y, xi) {
306                            var yi = void 0;
307                            if (x[0] > x[1]) {
308                                x = x.reverse();
309                                y = y.reverse();
310                            }
311                            if (xi < x[0]) {
312                                yi = y[0];
313                            } else if (xi > x[1]) {
314                                yi = y[1];
315                            } else {
316                                yi = BaseMathUtils.extrapolateLinear(x, y, xi);
317                            }
318                            return yi;
319                        };
320
321                        BaseMathUtils.calcScale = function calcScale(srcW, srcH, dstW, dstH) {
322                            return Math.min(dstW / srcW, dstH / srcH);
323                        };
324
325                        BaseMathUtils.mulM = function mulM(a, b) {
326                            var r = [];
327                            for (var i = 0; i < a.length; ++i) {
328                                r.push([]);
329                                for (var j = 0; j < b[0].length; ++j) {
330                                    r[i][j] = 0;
331                                    for (var k = 0; k < b.length; ++k) {
332                                        r[i][j] += a[i][k] * b[k][j];
333                                    }
334                                }
335                            }
336                            return r;
337                        };
338
339                        BaseMathUtils.transM = function transM(m) {
340                            var r = [];
341                            for (var i = 0; i < m.length; ++i) {
342                                for (var j = 0; j < m[0].length; ++j) {
343                                    if (!r[j]) {
344                                        r[j] = [];
345                                    }
346                                    r[j][i] = m[i][j];
347                                }
348                            }
349                            return r;
350                        };
351
352                        BaseMathUtils.mat = function mat(data) {
353                            var s = 0;
354                            for (var _iterator = data, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
355                                var _ref;
356
357                                if (_isArray) {
358                                    if (_i >= _iterator.length) break;
359                                    _ref = _iterator[_i++];
360                                } else {
361                                    _i = _iterator.next();
362                                    if (_i.done) break;
363                                    _ref = _i.value;
364                                }
365
366                                var x = _ref;
367
368                                s += x;
369                            }
370                            return s / data.length;
371                        };
372
373                        BaseMathUtils.disp = function disp(data) {
374                            var M = BaseMathUtils.mat(data);
375                            var s = 0;
376                            for (var _iterator2 = data, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
377                                var _ref2;
378
379                                if (_isArray2) {
380                                    if (_i2 >= _iterator2.length) break;
381                                    _ref2 = _iterator2[_i2++];
382                                } else {
383                                    _i2 = _iterator2.next();
384                                    if (_i2.done) break;
385                                    _ref2 = _i2.value;
386                                }
387
388                                var x = _ref2;
389
390                                s += (x - M) * (x - M);
391                            }
392                            return s / data.length;
393                        };
394
395                        BaseMathUtils.predict = function predict(data, num) {
396                            var r = [],
397                                l = data.length,
398                                D = BaseMathUtils.disp(data);
399                            if (D < l && l > 1) {
400                                var am = [],
401                                    bm = [];
402                                for (var i = 0; i < l; ++i) {
403                                    am.push([i, 1]);
404                                    bm.push([data[i]]);
405                                }
406                                var ta = BaseMathUtils.transM(am),
407                                    a = BaseMathUtils.mulM(ta, am),
408                                    b = BaseMathUtils.mulM(ta, bm),
409                                    d = a[0][0] * a[1][1] - a[1][0] * a[0][1],
410                                    p = [-(a[0][1] * b[1][0] - b[0][0] * a[1][1]) / d, (a[0][0] * b[1][0] - a[1][0] * b[0][0]) / d];
411                                for (var _i3 = 0; _i3 < num; ++_i3) {
412                                    var v = Math.round(p[0] * (_i3 + l) + p[1]);
413                                    if (r.indexOf(v) === -1) {
414                                        r.push(v);
415                                    }
416                                }
417                            }
418                            return r;
419                        };
420
421                        BaseMathUtils.getUnique = function getUnique() {
422                            return Math.ceil(1e9 * Math.random());
423                        };
424
425                        BaseMathUtils.setSplinePoints = function setSplinePoints(spline, ps) {
426                            if (spline.points.length !== ps.x.length) {
427                                console.warn('setSplinePoints: bad points');
428                            }
429                            for (var i = 0; i < spline.points.length; ++i) {
430                                spline.points[i].set(ps.x[i], ps.y[i], ps.z ? ps.z[i] : 0);
431                            }
432                        };
433
434                        BaseMathUtils.mapl2L = function mapl2L(ls, len, n, f) {
435                            var dL = len / (n - 1);
436                            var L = 0;
437                            for (var i = 0, d = ls[0]; i < ls.length - 1 && L < len + 0.1 * dL; ++i, d += ls[i]) {
438                                if (Math.abs(L - d) < Math.abs(L - d - ls[i + 1])
438) {
439                                    f(i, L);
440                                    L += dL;
441                                }
442                            }
443                            if (L < len + 0.1 * dL) {
444                                console.warn('mapl2L: ls is not enought');
445                            }
446                        };
447
448                        BaseMathUtils.det2 = function det2(a, b, c, d) {
449                            return a * d - b * c;
450                        };
451
452                        BaseMathUtils.solve2Lin = function solve2Lin(a1, b1, a2, b2) {
453                            var res = void 0;
454                            var d = BaseMathUtils.det2(a1[0], a1[1], a2[0], a2[1]);
455                            if (Math.abs(d) > BaseMathUtils.eps) {
456                                var dx = BaseMathUtils.det2(b1, a1[1], b2, a2[1]),
457                                    dy = BaseMathUtils.det2(a1[0], b1, a2[0], b2);
458                                res = {
459                                    x: dx / d,
460                                    y: dy / d
461                                };
462                            }
463                            return res;
464                        };
465
466                        BaseMathUtils.isInsidePoly = function isInsidePoly(ps, p) {
467                            var done = false,
468                                ct = void 0;
469                            for (var i = 0; i < ps.length; ++i) {
470                                if (BaseMathUtils.v2dist(p, ps[i]) < BaseMathUtils.eps) {
471                                    ct = 1;
472                                    done = true;
473                                    break;
474                                }
475                            }
476                            while (!done) {
477                                done = true;
478                                ct = 0;
479                                var np = { x: p.x + Math.random() - 0.5, y: p.y + Math.random() - 0.5 },
480                                    rn = { x: np.x - p.x, y: np.y - p.y },
481                                    a1 = [rn.y, -rn.x],
482                                    b1 = p.x * rn.y - p.y * rn.x;
483                                for (var _i4 = 0; _i4 < ps.length; ++_i4) {
484                                    var p0 = ps[_i4],
485                                        p1 = ps[(_i4 + 1) % ps.length],
486                                        n = { x: p1.x - p0.x, y: p1.y - p0.y },
487                                        a2 = [n.y, -n.x],
488                                        b2 = p0.x * n.y - p0.y * n.x,
489                                        ip = BaseMathUtils.solve2Lin(a1, b1, a2, b2);
490                                    if (ip) {
491                                        if (BaseMathUtils.v2dist(ip, p0) < BaseMathUtils.eps || BaseMathUtils.v2dist(ip, p1) < BaseMathUtils.eps) {
492                                            done = false;
493                                            break;
494                                        } else if (ip.x > Math.min(p0.x, p1.x) - BaseMathUtils.eps && ip.x < Math.max(p0.x, p1.x) + BaseMathUtils.eps && ip.y > Math.min(p0.y, p1.y) - BaseMathUtils.eps && ip.y < Math.max(p0.y, p1.y) + BaseMathUtils.eps) {
495                                            if (BaseMathUtils.v2dist(ip, p) < BaseMathUtils.eps) {
496                                                ct = 1;
497                                                break;
498                                            } else {
499                                                var tn = { x: ip.x - p.x, y: ip.y - p.y };
500                                                ct += tn.x * rn.x + tn.y * rn.y > 0;
501                                            }
502                                        }
503                                    }
504                                }
505                            }
506                            return ct % 2;
507                        };
508
509                        BaseMathUtils.isInsideConvPoly = function isInsideConvPoly(ps, p) {
510                            var sg = [0, 0];
511                            for (var i = 0; i < ps.length; ++i) {
512                                var p0 = ps[i],
513                                    p1 = ps[(i + 1) % ps.length],
514                                    a = { x: p0.x - p.x, y: p0.y - p.y },
515                                    b = { x: p1.x - p.x, y: p1.y - p.y };
516                                ++sg[(a.x * b.y - a.y * b.x < 0) + 0];
517                            }
518                            return ~sg.indexOf(ps.length);
519                        };
520
521                        BaseMathUtils.v2len = function v2len(v2) {
522                            return Math.sqrt(v2.x * v2.x + v2.y * v2.y);
523                        };
524
525                        BaseMathUtils.v2dist = function v2dist(v21, v22) {
526                            return BaseMathUtils.v2len({
527                                x: v22.x - v21.x,
528                                y: v22.y - v21.y
529                            });
530                        };
531
532                        BaseMathUtils.computeSquare = function computeSquare(ps) {
533                            var a = [];
534                            var p = 0;
535                            for (var i = 0; i < ps.length; ++i) {
536                                a.push(BaseMathUtils.v2dist(ps[i], ps[(i + 1) % ps.length]));
537                                p += 0.5 * a[i];
538                            }
539                            return Math.sqrt(p * (p - a[0]) * (p - a[1]) * (p - a[2]));
540                        };
541
542                        BaseMathUtils.computeInterpCoefs = function computeInterpCoefs(tri, p) {
543                            var s = BaseMathUtils.computeSquare(tri),
544                                coefs = [],
545                                l = tri.length;
546                            for (var i = 0; i < l; ++i) {
547                                coefs[i] = BaseMathUtils.computeSquare([p, tri[(i + 1) % l], tri[(i + 2) % l]]) / s;
548                            }
549                            return coefs;
550                        };
551
552                        return BaseMathUtils;
553                    }();
554
555                    BaseMathUtils.sum = [BaseMathUtils.sum1, BaseMathUtils.sum2, BaseMathUtils.sum3, BaseMathUtils.sum4];
556                    BaseMathUtils.eps = 1e-4;
557                    exports.default = BaseMathUtils;
558
559                    /***/
560                },
561/* 3 */
562/***/function (module, exports, __webpack_require__) {
563
564                    "use strict";
565                    'use strict';
566
567                    exports.__esModule = true;
568
569                    var _libs = __webpack_require__(0);
570
571                    var _BaseMathUtils2 = __webpack_require__(2);
572
573                    var _BaseMathUtils3 = _interopRequireDefault(_BaseMathUtils2);
574
575                    function _interopRequireDefault(obj) {
576                        return obj && obj.__esModule ? obj : { default: obj };
577                    }
578
579                    function _classCallCheck(instance, Constructor) {
580                        if (!(instance instanceof Constructor)) {
581                            throw new TypeError("Cannot call a class as a function");
582                        }
583                    }
584
585                    function _possibleConstructorReturn(self, call) {
586                        if (!self) {
587                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
588                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
589                    }
590
591                    function _inherits(subClass, superClass) {
592                        if (typeof superClass !== "function" && superClass !== null) {
593                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
594                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
594onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
595                    }
596
597                    var MathUtils = function (_BaseMathUtils) {
598                        _inherits(MathUtils, _BaseMathUtils);
599
600                        function MathUtils() {
601                            _classCallCheck(this, MathUtils);
602
603                            return _possibleConstructorReturn(this, _BaseMathUtils.apply(this, arguments));
604                        }
605
606                        MathUtils.splitSpline = function splitSpline(spline, N) {
607                            var o = { len: 0, ls: [0] },
608                                dl = 1 / N;
609                            for (var i = 0; i <= N; ++i) {
610                                var p = spline.getPoint(i * dl);
611                                if (i) {
612                                    var d = MathUtils.v1.distanceTo(p);
613                                    o.len += d;
614                                    o.ls.push(d);
615                                }
616                                MathUtils.v1.copy(p);
617                            }
618                            return o;
619                        };
620
621                        MathUtils.getLinearIndeces = function getLinearIndeces(spline, n) {
622                            var del = 5000,
623                                dDel = 1 / del;
624                            var ls = [0];
625                            var l = 0;
626                            for (var i = 0; i <= del; ++i) {
627                                var p = spline.getPoint(i * dDel);
628                                if (i) {
629                                    var d = MathUtils.v1.distanceTo(p);
630                                    l += d;
631                                    ls.push(d);
632                                }
633                                MathUtils.v1.copy(p);
634                            }
635                            ls.push(1e7);
636
637                            var res = [],
638                                dl = l / (n - 1);
639                            for (var _i = 0, L = 0, _d = ls[0]; _i < ls.length - 1; ++_i, _d += ls[_i]) {
640                                if (Math.abs(L - _d) < Math.abs(L - _d - ls[_i + 1])) {
641                                    res.push(_i * dDel);
642                                    L += dl;
643                                }
644                            }
645
646                            return res;
647                        };
648
649                        MathUtils.refinePoly = function refinePoly(poly, maxDl) {
650                            var res = [];
651                            for (var i = 0; i < poly.length; ++i) {
652                                var p0 = poly[i],
653                                    p1 = poly[(i + 1) % poly.length],
654                                    l = _BaseMathUtils3.default.v2dist(p0, p1),
655                                    n = Math.ceil(l / maxDl),
656                                    dl = l / n;
657                                res.push(p0);
658                                for (var j = 1; j < n; ++j) {
659                                    res.push(new _libs.THREE.Vector2(p0.x + j * dl * (p1.x - p0.x) / l, p0.y + j * dl * (p1.y - p0.y) / l));
660                                }
661                            }
662                            return res;
663                        };
664
665                        return MathUtils;
666                    }(_BaseMathUtils3.default);
667
668                    MathUtils.v1 = new _libs.THREE.Vector3();
669                    exports.default = MathUtils;
670
671                    /***/
672                },
673/* 4 */
674/***/function (module, exports) {
675
676                    "use strict";
677                    'use strict';
678
679                    exports.__esModule = true;
680
681                    function _classCallCheck(instance, Constructor) {
682                        if (!(instance instanceof Constructor)) {
683                            throw new TypeError("Cannot call a class as a function");
684                        }
685                    }
686
687                    var Utils = function () {
688                        function Utils() {
689                            _classCallCheck(this, Utils);
690                        }
691
692                        Utils.normalizeUrl = function normalizeUrl(url) {
693                            function split(s) {
694                                return s.replace(/\\/g, '/').split('/');
695                            }
696                            var base = split(window.location.href);
697                            url = split(url);
698                            if (base[2] === url[2]) {
699                                url[0] = base[0];
700                            }
701                            return url.join('/');
702                        };
703
704                        Utils.extends = function _extends(der, base) {
705                            for (var name in base) {
706                                if (!der.hasOwnProperty(name)) {
707                                    der[name] = base[name];
708                                }
709                            }
710                        };
711
712                        Utils.defaultCmp = function defaultCmp(a, b) {
713                            return a - b;
714                        };
715
716                        Utils.lowerBound = function lowerBound(a, x, cmp) {
717                            cmp = cmp || Utils.defaultCmp;
718                            var l = 0,
719                                h = a.length - 1;
720                            while (h - l > 1) {
721                                var mid = Math.floor((l + h) / 2);
722                                if (cmp(x, a[mid]) < 0) {
723                                    h = mid;
724                                } else {
725                                    l = mid;
726                                }
727                            }
728                            return cmp(x, a[h]) >= 0 ? h : l;
729                        };
730
731                        return Utils;
732                    }();
733
734                    exports.default = Utils;
735
736                    /***/
737                },
738/* 5 */
739/***/function (module, exports, __webpack_require__) {
740
741                    "use strict";
742                    'use strict';
743
744                    exports.__esModule = true;
745
746                    var _libs = __webpack_require__(0);
747
748                    var _GraphUtils = __webpack_require__(7);
749
750                    var _GraphUtils2 = _interopRequireDefault(_GraphUtils);
751
752                    function _interopRequireDefault(obj) {
753                        return obj && obj.__esModule ? obj : { default: obj };
754                    }
755
756                    function _classCallCheck(instance, Constructor) {
757                        if (!(instance instanceof Constructor)) {
758                            throw new TypeError("Cannot call a class as a function");
759                        }
760                    }
761
762                    var ImageBase = function () {
763                        function ImageBase(context, width, height, color) {
764                            _classCallCheck(this, ImageBase);
765
766                            this.context = context;
767                            this.wnd = context.wnd;
768                            this.doc = context.doc;
769                            this.element = context.element || context.doc.body;
770                            this.c = context.renderCanvas || ImageBase.renderCanvas;
771                            this.ctx = context.renderCanvasCtx || ImageBase.renderCanvasCtx;
772                            this.resW = this.width = width;
773                            this.resH = this.height = height;
774                            this.color = color;
775                        }
776
777                        ImageBase.prototype.setResolution = function setResolution(res) {
778                            this.resW = res.width;
779                            this.resH = res.height;
780                        };
781
782                        ImageBase.prototype.dispose = function dispose() { };
783
784                        ImageBase.prototype.renderBlankPage = function renderBlankPage() {
785                            this.ctx.beginPath();
786                            this.ctx.fillStyle = _GraphUtils2.default.color2Rgba(this.color, 1);
787                            this.ctx.rect(0, 0, this.c.width, this.c.height);
788                            this.ctx.fill();
789                        };
790
791                        ImageBase.prototype.renderImage = function renderImage(image) {
792                            this.pushCtx();
793                            this.ctx.drawImage(image, 0, 0);
794                            this.popCtx();
795                        };
796
797                        ImageBase.prototype.normToConv = function normToConv(p) {
798                            return {
799                                x: p.x * this.c.width,
800                                y: (1 - p.y) * this.c.height
801                            };
802                        };
803
804                        ImageBase.prototype.renderHit = function renderHit(poly) {
805                            var ctx = this.ctx;
806                            ctx.fillStyle = 'rgba(255,255,0,0.4)';
807                            ctx.beginPath();
808                            var p = this.normToConv(poly[0]);
809                            ctx.moveTo(p.x, p.y);
810                            for (var i = 1; i < poly.length; ++i) {
811                                p = this.normToConv(poly[i]);
812                                ctx.lineTo(p.x, p.y);
813                            }
814                            ctx.closePath();
815                            ctx.fill();
816                        };
817
818                        ImageBase.prototype.pushCtx = function pushCtx() {
819                            if (this.resW != this.c.width) {
820                                this.c.width = this.resW;
821                            }
822                            if (this.resH != this.c.height) {
823                                this.c.height = this.resH;
824                            }
825                            this.ctx.save();
826                            this.ctx.scale(this.c.width / this.width, this.c.height / this.height);
827                            return this.ctx;
828                        };
829
830                        ImageBase.prototype.popCtx = function popCtx() {
831                            this.ctx.restore();
832                        };
833
834                        ImageBase.prototype.renderNotFoundPage = function renderNotFoundPage() {
835                            this.renderBlankPage();
836                        };
837
838                        ImageBase.prototype.finishRender = function finishRender() {
839                            if (this.onChange) {
840                                this.onChange(this.c);
841                            }
842                        };
843
844                        ImageBase.prototype.finishLoad = function finishLoad() {
845                            if (this.onLoad) {
846                                this.onLoad();
847                            } else {
848                                this.startRender();
849                            }
850                        };
851
852                        ImageBase.prototype.getSimulatedDoc = function getSimulatedDoc() {
853                            return undefined;
854                        };
855
856                        return ImageBase;
857                    }();
858
859                    ImageBase.renderCanvas = (0, _libs.$)('<canvas>')[0];
860                    ImageBase.renderCanvasCtx = ImageBase.renderCanvas.getContext('2d');
861                    exports.default = ImageBase;
862
863                    /***/
864                },
865/* 6 */
866/***/function (module, exports, __webpack_require__) {
867
868                    "use strict";
869                    'use strict';
870
871                    exports.__esModule = true;
872
873                    var _extends = Object.assign || function (target) {
874                        for (var i = 1; i < arguments.length; i++) {
875                            var source = arguments[i]; for (var key in source) {
876                                if (Object.prototype.hasOwnProperty.call(source, key)) {
877                                    target[key] = source[key];
878                                }
879                            }
880                        } return target;
881                    };
882
883                    var _libs = __webpack_require__(0);
884
885                    function _classCallCheck(instance, Constructor) {
886                        if (!(instance instanceof Constructor)) {
887                            throw new TypeError("Cannot call a class as a function");
888                        }
889                    }
890
891                    var EventConverter = function () {
892
893                        // virtuals
894                        // getObject(e, data);
895                        // getCallback(object);
896                        // test(object1, object1);
897
898                        function EventConverter(wnd, doc) {
899                            _classCallCheck(this, EventConverter);
900
901                            this.wnd = wnd;
902                            this.doc = doc;
903                            this.enabled = true;
904                        }
905
906                        EventConverter.prototype.setEnable = function setEnable(vl) {
907                            if (!vl) {
908                                if (this.mCapObject) {
909                                    this.notify(this.mCapObject, _libs.$.Event('mouseup'), 'mouseup');
910                                    this.mCapObject = undefined;
911                                }
912                                if (this.mHovObject) {
913                                    this.notify(this.mHovObject, _libs.$.Event('mouseout'), 'mouseout');
914                                    this.mHovObject = undefined;
915                                }
916                            }
917                            this.enabled = vl;
918                        };
919
920                        EventConverter.prototype.getCallback = function getCallback(object) {
921                            return undefined;
922                        };
923
924                        EventConverter.prototype.notify = function notify(object, e, type) {
925                            var callback = this.getCallback(object);
926                            if (callback) {
927                                var props = _extends({}, e, {
928                                    type: type,
929                                    view: this.wnd
930                                });
931                                var jE = _libs.$.Event(type, props);
932                                callback(jE, object);
933                            }
934                        };
935
936                        EventConverter.prototype.convert = function convert(e, data) {
937                            if (!this.enabled) return;
938
939                            if (this.filter) {
940                                e = this.filter(this.element, e);
941                            }
942
943                            var object = this.getObject(e, data),
944                                notify = ~e.type.indexOf('touch') ? this.convertTouch(e, data, object) : this.convertMouse(e, data, object);
945                            if (notify && object) {
946                                this.notify(object, e, e.type);
947                            }
948                        };
949
950                        EventConverter.prototype.convertTouch = function convertTouch(e, data, object) {
951                            var notify = true;
952                            switch (e.type) {
953                                case 'touchstart':
954                                    {
955                                        if (this.tCapObject) {
956                                            this.notify(this.tCapObject, e, 'touchend');
957                                        }
958                                        this.tCapObject = object;
959                                        break;
960                                    }
961                                case 'touchend':
962                                    {
963                                        if (this.tCapObject && !this.test(this.tCapObject, object)) {
964                                            this.notify(this.tCapObject, e, 'touchend');
965                                            notify = false;
966                                        } else if (object && this.test(this.tCapObject, object)) {
967                                            this.notify(object, e, 'touchtap');
968                                        }
969                                        this.tCapObject = undefined;
970                                        break;
971                                    }
972                                case 'touchtap':
973                                    {
974                                        notify = false;
975                                        break;
976                                    }
977                            }
978                            return notify;
979                        };
980
981                        EventConverter.prototype.convertMouse = function convertMouse(e, data, object) {
982                            var notify = true;
983                            switch (e.type) {
984                                case 'mousedown':
985                                    {
986                                        if (this.mCapObject) {
987                                            this.notify(this.mCapObject, e, 'mouseup');
988                                        }
989                                        this.mCapObject = object;
990                                        break;
991                                    }
992                                case 'mouseup':
993                                    {
994                                        if (this.mCapObject && !this.test(this.mCapObject, object)) {
995                                            this.notify(this.mCapObject, e, 'mouseup');
996                                            notify = false;
997                                        }
998                                        break;
999                                    }
1000                                case 'click':
1001                                    {
1002                                        notify = this.test(this.mCapObject, object);
1003                                        this.mCapObject = undefined;
1004                                        break;
1005                                    }
1006                                case 'mouseenter':
1007                                case 'mouseover':
1008                                case 'mousemove':
1009                                    {
1010                                        if (!this.test(this.mHovObject, object) && this.mHovObject) {
1011                                            this.notify(this.mHovObject, e, 'mouseout');
1012                                            this.mHovObject = undefined;
1013                                        }
1014                                        if (!this.mHovObject && object) {
1015                                            this.notify(object, e, 'mouseover');
1016                                            this.mHovObject = object;
1017                                        }
1018                                        notify = e.type === 'mousemove';
1019                                        break;
1020                                    }
1021                                case 'mouseleave':
1022                                case 'mouseout':
1023                                    {
1024                                        if (this.mHovObject) {
1025                                            this.notify(this.mHovObject, e, 'mouseout');
1026                                            this.mHovObject = undefined;
1027                                        }
1028                                        notify = false;
1029                                        break;
1030                                    }
1031                            }
1032                            return notify;
1033                        };
1034
1035                        return EventConverter;
1036                    }();
1037
1038                    exports.default = EventConverter;
1039
1040                    /***/
1041                },
1042/* 7 */
1043/***/function (module, exports) {
1044
1045                    "use strict";
1046                    'use strict';
1047
1048                    exports.__esModule = true;
1049
1050                    function _classCallCheck(instance, Constructor) {
1051                        if (!(instance instanceof Constructor)) {
1052                            throw new TypeError("Cannot call a class as a function");
1053                        }
1054                    }
1055
1056                    var GraphUtils = function () {
1057                        function GraphUtils() {
1058                            _classCallCheck(this, GraphUtils);
1059                        }
1060
1061                        GraphUtils.extrapolateLinear = function extrapolateLinear(x, y, xi) {
1062                            return y[0] + (y[1] - y[0]) / (x[1] - x[0]) * (xi - x[0]);
1063                        };
1064
1065                        GraphUtils.interpolate01 = function interpolate01(y1, y2, t) {
1066                            return GraphUtils.extrapolateLinear([0, 1], [y1, y2], t);
1067                        };
1068
1069                        GraphUtils.getColorBytes = function getColorBytes(color) {
1070                            return [color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF];
1071                        };
1072
1073                        GraphUtils.inverseColor = function inverseColor(color) {
1074                            var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1075
1076                            var bs = GraphUtils.getColorBytes(color),
1077                                ibs = [0xFF - bs[0], 0xFF - bs[1], 0xFF - bs[2]],
1078                                nbs = [Math.round(GraphUtils.interpolate01(bs[0], ibs[0], t)), Math.round(GraphUtils.interpolate01(bs[1], ibs[1], t)), Math.round(GraphUtils.interpolate01(bs[2], ibs[2], t))];
1079                            return GraphUtils.bytes2Color(nbs);
1080                        };
1081
1082                        GraphUtils.color2Rgba = function color2Rgba(color, a) {
1083                            return GraphUtils.bytes2Rgba(GraphUtils.getColorBytes(color), a);
1084                        };
1085
1086                        GraphUtils.bytes2Rgba = function bytes2Rgba(bs, a) {
1087                            return 'rgba(' + bs.join(',') + ',' + a + ')';
1088                        };
1089
1090                        GraphUtils.bytes2Color = function bytes2Color(bs) {
1091                            return bs[2] | bs[1] << 8 | bs[0] << 16;
1092                        };
1093
1094                        return GraphUtils;
1095                    }();
1096
1097                    exports.default = GraphUtils;
1098
1099                    /***/
1100                },
1101/* 8 */
1102/***/function (module, exports, __webpack_require__) {
1103
1104                    "use strict";
1105                    'use strict';
1106
1107                    exports.__esModule = true;
1108
1109                    var _Cache = __webpack_require__(14);
1110
1111                    var _Cache2 = _interopRequireDefault(_Cache);
1112
1113                    var _BlankImage = __webpack_require__(43);
1114
1115                    var _BlankImage2 = _interopRequireDefault(_BlankImage);
1116
1117                    var _StaticImage = __webpack_require__(59);
1118
1119                    var _StaticImage2 = _interopRequireDefault(_StaticImage);
1120
1121                    var _PdfImage = __webpack_require__(57);
1122
1123                    var _PdfImage2 = _interopRequireDefault(_PdfImage);
1124
1125                    var _InteractiveImage = __webpack_require__(51);
1126
1127                    var _InteractiveImage2 = _interopRequireDefault(_InteractiveImage);
1128
1129                    function _interopRequireDefault(obj) {
1130                        return obj && obj.__esModule ? obj : { default: obj };
1131                    }
1132
1133                    function _classCallCheck(instance, Constructor) {
1134                        if (!(instance instanceof Constructor)) {
1135                            throw new TypeError("Cannot call a class as a function");
1136                        }
1137                    }
1138
1139                    var ImageFactory = function () {
1140                        function ImageFactory(context, cache) {
1141                            _classCallCheck(this, ImageFactory);
1142
1143                            this.context = context;
1144                            this.cache = cache || new _Cache2.default();
1145                        }
1146
1147                        ImageFactory.prototype.build = function build(info) {
1148                            var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1149                            var widthTexels = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 210;
1150                            var heightTexels = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 297;
1151                            var color = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0xFFFFFF;
1152                            var injector = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
1153
1154                            var image = void 0;
1155                            switch (info.type) {
1156                                case 'html':
1157                                    {
1158                                        image = new _InteractiveImage2.default(this.context, widthTexels, heightTexels, color, info.src, this.cache, injector);
1159                                        break;
1160                                    }
1161                                case 'image':
1162                                    {
1163                                        image = new _StaticImage2.default(this.context, widthTexels, heightTexels, color, info.src);
1164                                        break;
1165                                    }
1166                                case 'pdf':
1167                                    {
1168                                        image = new _PdfImage2.default(this.context, widthTexels, heightTexels, color, info.src, n);
1169                                        break;
1170                                    }
1171                                case 'blank':
1172                                default:
1173                                    {
1174                                        image = new _BlankImage2.default(this.context, widthTexels, heightTexels, color);
1175                                        break;
1176                                    }
1177                            }
1178                            return image;
1179                        };
1180
1181                        return ImageFactory;
1182                    }();
1183
1184                    exports.default = ImageFactory;
1185
1186                    /***/
1187                },
1188/* 9 */
1189/***/function (module, exports, __webpack_require__) {
1190
1191                    "use strict";
1192                    'use strict';
1193
1194                    exports.__esModule = true;
1195
1196                    var _extends = Object.assign || function (target) {
1197                        for (var i = 1; i < arguments.length; i++) {
1198                            var source = arguments[i]; for (var key in source) {
1199                                if (Object.prototype.hasOwnProperty.call(source, key)) {
1200                                    target[key] = source[key];
1201                                }
1202                            }
1203                        } return target;
1204                    };
1205
1206                    var _book = __webpack_require__(11);
1207
1208                    var _BaseMathUtils = __webpack_require__(2);
1209
1210                    var _BaseMathUtils2 = _interopRequireDefault(_BaseMathUtils);
1211
1212                    function _interopRequireDefault(obj) {
1213                        return obj && obj.__esModule ? obj : { default: obj };
1214                    }
1215
1216                    function _classCallCheck(instance, Constructor) {
1217                        if (!(instance instanceof Constructor)) {
1218                            throw new TypeError("Cannot call a class as a function");
1219                        }
1220                    }
1221
1222                    var BookPropsBuilder = function () {
1223                        function BookPropsBuilder(onReady) {
1224                            _classCallCheck(this, BookPropsBuilder);
1225
1226                            this.onReady = onReady;
1227                            this.defaults = (0, _book.props)();
1228                        }
1229
1230                        BookPropsBuilder.prototype.dispose = function dispose() { };
1231
1232                        BookPropsBuilder.prototype.calcSize = function calcSize(width, height) {
1233                            var scale = _BaseMathUtils2.default.calcScale(width, height, this.defaults.width, this.defaults.height);
1234                            return {
1235                                width: scale * width,
1236                                height: scale * height
1237                            };
1238                        };
1239
1240                        BookPropsBuilder.prototype.calcTexels = function calcTexels(width, height) {
1241                            var sheet = this.defaults.sheet,
1242                                scale = _BaseMathUtils2.default.calcScale(width, height, sheet.widthTexels, sheet.heightTexels);
1243                            return {
1244                                widthTexels: scale * width,
1245                                heightTexels: scale * height
1246                            };
1247                        };
1248
1249                        BookPropsBuilder.prototype.calcProps = function calcProps(width, height) {
1250                            this.props = _extends({}, this.defaults, this.calcSize(width, height), {
1251                                sheet: _extends({}, this.defaults.sheet, this.calcTexels(width, height)),
1252                                cover: _extends({}, this.defaults.cover),
1253                                page: _extends({}, this.defaults.page)
1254                            });
1255                        };
1256
1257                        BookPropsBuilder.prototype.calcSheets = function calcSheets(pages) {
1258                            return this.sheets = Math.ceil(Math.max(0, pages - 4) / 2);
1259                        };
1260
1261                        BookPropsBuilder.prototype.getSheets = function getSheets() {
1262                            return this.sheets;
1263                        };
1264
1265                        BookPropsBuilder.prototype.getProps = function getProps() {
1266                            return this.props;
1267                        };
1268
1269                        BookPropsBuilder.prototype.getPageCallback = function getPageCallback() {
1270                            return this.binds.pageCallback;
1271                        };
1272
1273                        BookPropsBuilder.prototype.ready = function ready() {
1274                            if (this.onReady) {
1275                                this.onReady(this.getProps(), this.get
1275Sheets(), this.getPageCallback());
1276                            }
1277                        };
1278
1279                        return BookPropsBuilder;
1280                    }();
1281
1282                    exports.default = BookPropsBuilder;
1283
1284                    /***/
1285                },
1286/* 10 */
1287/***/function (module, exports, __webpack_require__) {
1288
1289                    "use strict";
1290                    'use strict';
1291
1292                    exports.__esModule = true;
1293
1294                    var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
1295                        return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
1296                    } : function (obj) {
1297                        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
1298                    };
1299
1300                    var _extends = Object.assign || function (target) {
1301                        for (var i = 1; i < arguments.length; i++) {
1302                            var source = arguments[i]; for (var key in source) {
1303                                if (Object.prototype.hasOwnProperty.call(source, key)) {
1304                                    target[key] = source[key];
1305                                }
1306                            }
1307                        } return target;
1308                    };
1309
1310                    var _libs = __webpack_require__(1);
1311
1312                    var _sheetBlock = __webpack_require__(41);
1313
1314                    var _sheetBlock2 = _interopRequireDefault(_sheetBlock);
1315
1316                    var _MathUtils = __webpack_require__(3);
1317
1318                    var _MathUtils2 = _interopRequireDefault(_MathUtils);
1319
1320                    var _ThreeUtils = __webpack_require__(20);
1321
1322                    var _ThreeUtils2 = _interopRequireDefault(_ThreeUtils);
1323
1324                    function _interopRequireDefault(obj) {
1325                        return obj && obj.__esModule ? obj : { default: obj };
1326                    }
1327
1328                    function _classCallCheck(instance, Constructor) {
1329                        if (!(instance instanceof Constructor)) {
1330                            throw new TypeError("Cannot call a class as a function");
1331                        }
1332                    }
1333
1334                    // import ThreeMarkup from './ThreeMarkup';
1335
1336                    var SheetBlock = function () {
1337                        function SheetBlock(visual, p, first, last) {
1338                            var angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1339
1340                            var _this = this;
1341
1342                            var state = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'closed';
1343                            var height = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
1344
1345                            _classCallCheck(this, SheetBlock);
1346
1347                            this.visual = visual;
1348                            this.p = _extends({}, p, {
1349                                first: first,
1350                                last: last
1351                            });
1352                            var props = this.getProps();
1353
1354                            var loadedPoints = this.loadPoints();
1355                            Object.keys(loadedPoints).map(function (k) {
1356                                _this[k] = loadedPoints[k][props.shape] || loadedPoints[k][0];
1357                            });
1358
1359                            this.pSpline = new _libs.THREE.Spline([]);
1360                            for (var i = 0; i < this.interpolationPoints.x[0].length; ++i) {
1361                                this.pSpline.points.push(new _libs.THREE.Vector3());
1362                            }
1363
1364                            this.iSpline = new _libs.THREE.Spline([]);
1365                            for (var _i = 0; _i < _sheetBlock2.default.resX; ++_i) {
1366                                this.iSpline.points.push(new _libs.THREE.Vector3());
1367                            }
1368
1369                            this.aSplines = [];
1370
1371                            //this.three = new THREE.Object3D();
1372
1373                            this.geometry = _sheetBlock2.default.geometry.clone();
1374
1375                            this.p.sideFaces = [{
1376                                first: 0,
1377                                last: _sheetBlock2.default.faces[0]
1378                            }, {
1379                                first: _sheetBlock2.default.faces[0],
1380                                last: _sheetBlock2.default.faces[1]
1381                            }];
1382
1383                            this.sideTexture = new _libs.THREE.Texture();
1384                            this.sideTexture.wrapT = _libs.THREE.RepeatWrapping;
1385                            this.sideTexture.repeat.set(0, last - first);
1386                            this.sideTexture.image = props.sideTexture;
1387                            this.sideTexture.needsUpdate = true;
1388
1389                            this.materials = [new _libs.THREE.MeshPhongMaterial(), new _libs.THREE.MeshPhongMaterial(), new _libs.THREE.MeshPhongMaterial({ map: this.sideTexture }), new _libs.THREE.MeshPhongMaterial({ map: this.sideTexture }), new _libs.THREE.MeshPhongMaterial({ map: this.sideTexture }), new _libs.THREE.MeshPhongMaterial({ map: this.sideTexture })];
1390
1391                            this.p.setTexture(this.materials[0], 2 * first);
1392                            this.p.setTexture(this.materials[1], 2 * last - 1);
1393
1394                            this.mesh = new _libs.THREE.Mesh(this.geometry, new _libs.THREE.MeshFaceMaterial(this.materials));
1395                            this.mesh.castShadow = false;
1396                            this.mesh.receiveShadow = false;
1397                            // this.mesh.frustumCulled = true;
1398
1399                            //this.three.add(this.mesh);
1400                            this.three = this.mesh;
1401                            this.three.userData.self = this;
1402
1403                            this.markers = [];
1404                            if (this.p.marker.use) {
1405                                var l = this.geometry.vertices.length;
1406                                var is = void 0;
1407                                // is = [0, sheetBlock.resX-1, (sheetBlock.resZ-1)*sheetBlock.resX, sheetBlock.resZ*sheetBlock.resX-1];
1408                                is = Array.apply(0, Array(l)).map(function (_, i) {
1409                                    return i;
1410                                });
1411
1412                                for (var _iterator = is, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
1413                                    var _ref;
1414
1415                                    if (_isArray) {
1416                                        if (_i2 >= _iterator.length) break;
1417                                        _ref = _iterator[_i2++];
1418                                    } else {
1419                                        _i2 = _iterator.next();
1420                                        if (_i2.done) break;
1421                                        _ref = _i2.value;
1422                                    }
1423
1424                                    var _i3 = _ref;
1425
1426                                    var marker = _ThreeUtils2.default.createMarker(this.geometry.vertices[_i3], _i3 < l / 2 ? 0xFF0000 : 0x00FF00, this.p.marker.size);
1427                                    this.markers.push({
1428                                        marker: marker,
1429                                        vertex: _i3
1430                                    });
1431                                    this.three.add(marker);
1432                                }
1433                            }
1434
1435                            this.corner = {
1436                                use: true,
1437                                height: 0,
1438                                maxDistance: 0,
1439                                points: [],
1440                                OZ: new _libs.THREE.Vector3(0, 0, 1),
1441                                axis: new _libs.THREE.Vector3()
1442                            };
1443                            this.set(0, 'closed', height, first, last); // calculate corner points
1444
1445                            this.set(angle, state, height, first, last); // init position
1446
1447                            // if(!SheetBlock.markup) {
1448                            //   SheetBlock.markup=true;
1449                            //   this.markup = new ThreeMarkup(this, 0, [{
1450                            //     x: 0,
1451                            //     y: 0,
1452                            //   }, {
1453                            //     x: 0.5,
1454                            //     y: 1
1455                            //   }, {
1456                            //     x: 1,
1457                            //     y: 0
1458                            //   }].map((p)=>new THREE.Vector2(p.x, p.y)), {});
1459                            // }
1460                        }
1461
1462                        SheetBlock.prototype.dispose = function dispose() {
1463                            for (var _iterator2 = this.materials, _isArray2 = Array.isArray(_iterator2), _i4 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
1464                                var _ref2;
1465
1466                                if (_isArray2) {
1467                                    if (_i4 >= _iterator2.length) break;
1468                                    _ref2 = _iterator2[_i4++];
1469                                } else {
1470                                    _i4 = _iterator2.next();
1471                                    if (_i4.done) break;
1472                                    _ref2 = _i4.value;
1473                                }
1474
1475                                var m = _ref2;
1476
1477                                if (m.map) {
1478                                    m.map = null;
1479                                    m.needsUpdate = true;
1480                                }
1481                                m.dispose();
1482                            }
1483                            delete this.materials;
1484                            this.geometry.dispose();
1485                        };
1486
1487                        SheetBlock.prototype.getSize = function getSize() {
1488                            return this.p.last - this.p.first;
1489                        };
1490
1491                        SheetBlock.prototype.getProps = function getProps() {
1492                            return _extends({}, this.p.page, {
1493                                sheets: this.p.sheets
1494                            });
1495                        };
1496
1497                        SheetBlock.prototype.getTopCerners = function getTopCerners() {
1498                            var off = this.angle > Math.PI / 2 ? this.geometry.vertices.length / 2 : 0;
1499                            return [this.geometry.vertices[off], this.geometry.vertices[_sheetBlock2.default.resX - 1 + off], this.geometry.vertices[(_sheetBlock2.default.resZ - 1) * _sheetBlock2.default.resX + off], this.geometry.vertices[_sheetBlock2.default.resZ * _sheetBlock2.default.resX - 1 + off]];
1500                        };
1501
1502                        SheetBlock.prototype.getTopSize = function getTopSize() {
1503                            // const l=this.geometry.vertices.length, off = this.angle>Math.PI/2? l/2: 0,
1504                            //   v0 = this.geometry.vertices[off], v1 = this.geometry.vertices[sheetBlock.resZ*sheetBlock.resX-1+off];
1505                            // // is = [0, sheetBlock.resX-1, (sheetBlock.resZ-1)*sheetBlock.resX, sheetBlock.resZ*sheetBlock.resX-1];
1506                            // return {
1507                            //   width: Math.abs(v1.x-v0.x),
1508                            //   height: Math.abs(v1.z-v0.z)
1509                            // };
1510                            var vs = this.getTopCerners();
1511                            return {
1512                                width: vs[0].distanceTo(vs[1]),
1513                                height: vs[0].distanceTo(vs[2])
1514                            };
1515                        };
1516
1517                        SheetBlock.prototype.getTopWorldRotation = function getTopWorldRotation(q) {
1518                            q.x = -Math.PI / 2;
1519                            return q;
1520                        };
1521
1522                        SheetBlock.prototype.getTopWorldPosition = function getTopWorldPosition(v) {
1523                            var l = this.geometry.vertices.length,
1524                                off = this.angle > Math.PI / 2 ? l / 2 : 0,
1525                                vs = [this.geometry.vertices[off], this.geometry.vertices[_sheetBlock2.default.resX - 1 + off], this.geometry.vertices[(_sheetBlock2.default.resZ - 1) * _sheetBlock2.default.resX + off], this.geometry.vertices[_sheetBlock2.default.resZ * _sheetBlock2.default.resX - 1 + off]];
1526                            v.set(0, 0, 0);
1527                            for (var _iterator3 = vs, _isArray3 = Array.isArray(_iterator3), _i5 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
1528                                var _ref3;
1529
1530                                if (_isArray3) {
1531                                    if (_i5 >= _iterator3.length) break;
1532                                    _ref3 = _iterator3[_i5++];
1533                                } else {
1534                                    _i5 = _iterator3.next();
1535                                    if (_i5.done) break;
1536                                    _ref3 = _i5.value;
1537                                }
1538
1539                                var vi = _ref3;
1540
1541                                v.x += 0.25 * vi.x;
1542                                v.y += 0.25 * vi.y;
1543                                v.z += 0.25 * vi.z;
1544                            }
1545                            this.three.localToWorld(v);
1546                            return v;
1547                        };
1548
1549                        SheetBlock.prototype.getInterpolationPoints = function getInterpolationPoints(inds, mod) {
1550                            var ps = { x: [], y: [] },
1551                                K = this.getProps().wave;
1552                            for (var _iterator4 = inds, _isArray4 = Array.isArray(_iterator4), _i6 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
1553                                var _ref4;
1554
1555                                if (_isArray4) {
1556                                    if (_i6 >= _iterator4.length) break;
1557                                    _ref4 = _iterator4[_i6++];
1558                                } else {
1559                                    _i6 = _iterator4.next();
1560                                    if (_i6.done) break;
1561                                    _ref4 = _i6.value;
1562                                }
1563
1564                                var i = _ref4;
1565
1566                                ps.x.push([].concat(this.interpolationPoints.x[i]));
1567                                ps.y.push(~mod.indexOf(i) ? this.interpolationPoints.y[i].map(function (n) {
1568                                    return K * n;
1569                                }) : [].concat(this.interpolationPoints.y[i]));
1570                            }
1571                            return ps;
1572                        };
1573
1574                        SheetBlock.prototype.set = function set(angle) {
1575                            var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state;
1576                            var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.corner.height;
1577                            var first = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.p.first;
1578                            var last = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.p.last;
1579
1580                            var PI = Math.PI;
1581                            this.state = state;
1582                            var closedAngle = void 0,
1583                                binderTurn = void 0;
1584                            if ((typeof angle === 'undefined' ? 'undefined' : _typeof(angle)) === 'object') {
1585                                this.angle = angle.openedAngle;
1586                                closedAngle = angle.closedAngle;
1587                                binderTurn = angle.binderTurn > PI / 2 ? PI - angle.binderTurn : angle.binderTurn;
1588                            } else {
1589                                this.angle = angle;
1590                            }
1591                            this.corner.height = height;
1592                            if (this.p.first !== first || this.p.last !== last) {
1593                                this.sideTexture.repeat.set(0, last - first);
1594                                this.sideTexture.needsUpdate = true;
1595                                if (this.p.first !== first) {
1596                                    this.p.setTexture(this.materials[0], 2 * first);
1597                                }
1598                                if (this.p.last !== last) {
1599                                    this.p.setTexture(this.materials[1], 2 * last - 1);
1600                                }
1601                            }
1602                            this.p.first = first;
1603                            this.p.last = last;
1604                            var points = void 0;
1605                            var props = this.getProps();
1606                            if (this.state === 'closed') {
1607                                points = this.getInterpolationPoints(this.closedInterpolationIndeces, this.closedInterpolationIndeces);
1608                            } else if (this.state === 'opened') {
1609                                if (closedAngle !== undefined && Math.abs(closedAngle - PI / 2) > 1e-2) {
1610                                    points = this.getInterpolationPoints(this.flatInterpolationIndeces, []);
1611                                    var ps = this.getPointsAtAngle(this.getInterpolationPoints(this.closedInterpolationIndeces, this.closedInterpolationIndeces), closedAngle > PI / 2 ? PI - closedAngle : closedAngle);
1612                                    points.x = [ps.x].concat(points.x);
1613                                    points.y = [ps.y].concat(points.y);
1614                                    // console.log(ps);
1615                                } else {
1616                                    points = this.getInterpolationPoints(this.openedInterpolationIndeces, this.closedInterpolationIndeces);
1617                                }
1618                            }
1619                            var hl = void 0,
1620                                hr = void 0,
1621                                offset = 0.5 * props.sheets * props.depth;
1622                            if (this.state === 'closed') {
1623                                offset -= 7e-6 * this.p.scale;
1624                            }
1625                            if (this.angle <= PI / 2) {
1626                                hl = (props.sheets - first) * props.depth;
1627                                hr = (props.sheets - last) * props.depth;
1628                            } else {
1629                                hl = first * props.depth;
1630                                hr = last * props.depth;
1631                            }
1632
1633                            var inAngle = this.angle > PI / 2 ? PI - this.angle : this.angle,
1634                                hAngle = this.state === 'closed' ? inAngle : binderTurn === undefined ? PI / 2 : binderTurn;
1635
1636                            var _getPointsAtAngleAndH = this.getPointsAtAngleAndHs(points, inAngle, hAngle, [hl / props.width, hr / props.width]),
1637                                left = _getPointsAtAngleAndH[0],
1638                                right = _getPointsAtAngleAndH[1];
1639
1640                            if (this.angle > PI / 2) {
1641                                this.inverse(left);
1642                                this.inverse(right);
1643                                offset = -offset;
1644                            }
1645                            this.setPoints(left, right, offset);
1646                        };
1647
1648                        SheetBlock.prototype.setPoints = function setPoints(left, right, offset) {
1649                            var _this2 = this;
1650
1651                            var p = this.getProps();
1652                            var i = 0;
1653
1654                            var ys = [right, left];
1655                            for (var y = 0; y < _sheetBlock2.default.resY; ++y) {
1656                                for (var z = 0; z < _sheetBlock2.default.resZ; ++z) {
1657                                    for (var x = 0; x < _sheetBlock2.default.resX; ++x) {
1658                                        this.geometry.vertices[i++].set(ys[y].x[x] * p.width + offset, ys[y].y[x] * p.width, z * p.height / (_sheetBlock2.default.resZ - 1) - 0.5 * p.height);
1659                                    }
1660                                }
1661                            }
1662                            if (i !== this.geometry.vertices.length) {
1663                                console.warn('setPoints: bad mapping!');
1664                            }
1665
1666                            if (this.corner.use && !this.corner.points.length) {
1667                                var plane = new _libs.THREE.Plane(),
1668                                    normal = plane.normal,
1669                                    planeOffset = (1 - this.getProps().flexibleCorner) * Math.min(p.width, p.height),
1670                                    proj = new _libs.THREE.Vector3();
1671                                plane.setFromNormalAndCoplanarPoint(new _libs.THREE.Vector3(-1, 0, -1).normalize(), new _libs.THREE.Vector3(planeOffset + offset, 0, 0.5 * p.height));
1672                                for (var _i7 = 0, l = this.geometry.vertices.length; _i7 < l; ++_i7) {
1673                                    plane.projectPoint(this.geometry.vertices[_i7], proj);
1674                                    proj.sub(this.geometry.vertices[_i7]);
1675                                    if (proj.x * normal.x + proj.y * normal.y + proj.z * normal.z > 0) {
1676                                        var d = proj.length() / planeOffset;
1677                                        this.corner.maxDistance = Math.max(this.corner.maxDistance, d);
1678                                        this.corner.points.push({ vertex: _i7, distance: d });
1679                                    }
1680                                }
1681                            }
1682
1683                            if (this.corner.use && Math.abs(this.corner.height) > 1e-3) {
1684                                var d2Angle = function d2Angle(d) {
1685                                    return p.cornerDeviation * _this2.corner.height / (1 + Math.exp(-p.bending * (d - 0.5 * _this2.corner.maxDistance)));
1686                                };
1687                                this.corner.axis.set(-1, 0, 1).normalize();
1688                                this.corner.axis.applyAxisAngle(this.corner.OZ, this.angle);
1689                                for (var _iterator5 = this.corner.points, _isArray5 = Array.isArray(_iterator5), _i8 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator](); ;) {
1690                                    var _ref5;
1691
1692                                    if (_isArray5) {
1693                                        if (_i8 >= _iterator5.length) break;
1694                                        _ref5 = _iterator5[_i8++];
1695                                    } else {
1696                                        _i8 = _iterator5.next();
1697                                        if (_i8.done) break;
1698                                        _ref5 = _i8.value;
1699                                    }
1700
1701                                    var point = _ref5;
1702
1703                                    this.geometry.vertices[point.vertex].applyAxisAngle(this.corner.axis, d2Angle(point.distance));
1704                                }
1705                            }
1706
1707                            for (var _iterator6 = this.markers, _isArray6 = Array.isArray(_iterator6), _i9 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator](); ;) {
1708                                var _ref6;
1709
1710                                if (_isArray6) {
1711                                    if (_i9 >= _iterator6.length) break;
1712                                    _ref6 = _iterator6[_i9++];
1713                                } else {
1714                                    _i9 = _iterator6.next();
1715                                    if (_i9.done) break;
1716                                    _ref6 = _i9.value;
1717                                }
1718
1719                                var m = _ref6;
1720
1721                                m.marker.position.copy(this.geometry.vertices[m.vertex]);
1722                            }
1723
1724                            this.geometry.computeVertexNormals();
1725                            //this.geometry.computeFaceNormals();
1726                            this.geometry.computeBoundingSphere();
1727                            //this.geometry.computeBoundingBox();
1728                            this.geometry.verticesNeedUpdate = true;
1729
1730                            if (this.markup) {
1731                                this.markup.computeVertices();
1732                            }
1733                        };
1734
1735                        SheetBlock.prototype.inverse = function inverse(ps) {
1736                            for (var i = 0; i < ps.x.length; ++i) {
1737                                ps.x[i] = -ps.x[i];
1738                            }
1739                            return ps;
1740                        };
1741
1742                        SheetBlock.prototype.getPointsAtHs = function getPointsAtHs(ps, angle, hs) {
1743                            var _this3 = this;
1744
1745                            var N = 1000;
1746                            _MathUtils2.default.setSplinePoints(this.pSpline, ps);
1747                            var bl = _MathUtils2.default.splitSpline(this.pSpline, N),
1748                                r = [];
1749                            {
1750                                var p1 = _extends({}, this.pSpline.getPoint((N - 1) / N)),
1751                                    p2 = _extends({}, this.pSpline.getPoint(1)),
1752                                    dp = { x: p2.x - p1.x, y: p2.y 
1752- p1.y },
1753                                    ln = Math.sqrt(dp.x * dp.x + dp.y * dp.y),
1754                                    sp = this.pSpline.points[this.pSpline.points.length - 1];
1755                                sp.set(sp.x + 0.1 * dp.x / ln, sp.y + 0.1 * dp.y / ln, 0);
1756                                bl = _MathUtils2.default.splitSpline(this.pSpline, N);
1757                            }
1758                            bl.ls.push(1e7);
1759                            _MathUtils2.default.mapl2L(bl.ls, bl.len, _sheetBlock2.default.resX, function (i) {
1760                                for (var j = 0; j < hs.length; ++j) {
1761                                    if (!i) {
1762                                        r[j] = { x: [-hs[j] * Math.sin(angle)], y: [hs[j] * Math.cos(angle)] };
1763                                    } else {
1764                                        var p0 = _extends({}, _this3.pSpline.getPoint((i - 1) / N)),
1765                                            _p = _this3.pSpline.getPoint(i / N),
1766                                            x = -(_p.y - p0.y),
1767                                            y = _p.x - p0.x,
1768                                            l = Math.sqrt(x * x + y * y);
1769                                        r[j].x.push(_p.x + x / l * hs[j]);
1770                                        r[j].y.push(_p.y + y / l * hs[j]);
1771                                    }
1772                                }
1773                            });
1774
1775                            var nps = [];
1776
1777                            var _loop = function _loop(j) {
1778                                nps[j] = { x: [], y: [] };
1779                                _MathUtils2.default.setSplinePoints(_this3.iSpline, r[j]);
1780                                var l = _MathUtils2.default.splitSpline(_this3.iSpline, N);
1781                                l.ls.push(1e7);
1782                                _MathUtils2.default.mapl2L(l.ls, 1, _sheetBlock2.default.resX, function (i) {
1783                                    var p = _this3.iSpline.getPoint(i / N);
1784                                    nps[j].x.push(p.x);
1785                                    nps[j].y.push(p.y);
1786                                });
1787                            };
1788
1789                            for (var j = 0; j < hs.length; ++j) {
1790                                _loop(j);
1791                            }
1792                            return nps;
1793                        };
1794
1795                        SheetBlock.prototype.getPointsAtAngleAndHs = function getPointsAtAngleAndHs(points, angle, hAngle, hs) {
1796                            var ps = this.getPointsAtAngle(points, angle);
1797                            return this.getPointsAtHs(ps, hAngle, hs);
1798                        };
1799
1800                        SheetBlock.prototype.getPointsAtAngle = function getPointsAtAngle(points, angle) {
1801                            var ps = { x: [], y: [] },
1802                                angles = [];
1803                            angle /= Math.PI / 2;
1804                            for (var j = 0; j < points.x.length; ++j) {
1805                                angles.push(j / (points.x.length - 1));
1806                            }
1807                            for (var i = 0; i < points.x[0].length; ++i) {
1808                                var xps = [],
1809                                    yps = [];
1810                                for (var _j = 0; _j < points.x.length; ++_j) {
1811                                    xps.push(points.x[_j][i]);
1812                                    yps.push(points.y[_j][i]);
1813                                }
1814                                ps.x.push(this.interpolate(angles, xps, angle));
1815                                ps.y.push(this.interpolate(angles, yps, angle));
1816                            }
1817                            return ps;
1818                        };
1819
1820                        SheetBlock.prototype.interpolate = function interpolate(x, y, xi) {
1821                            if (!this.aSplines[x.length]) {
1822                                this.aSplines[x.length] = new _libs.THREE.Spline([]);
1823                                var ps = this.aSplines[x.length].points;
1824                                for (var i = 0; i < x.length; ++i) {
1825                                    ps.push(new _libs.THREE.Vector3());
1826                                }
1827                            }
1828                            var spline = this.aSplines[x.length];
1829                            for (var _i10 = 0; _i10 < x.length; ++_i10) {
1830                                spline.points[_i10].set(x[_i10], y[_i10], 0);
1831                            }
1832                            return spline.getPoint(Math.min(1, Math.max(xi, 0))).y;
1833                        };
1834
1835                        SheetBlock.prototype.loadPoints = function loadPoints() {
1836                            var x = [],
1837                                y = [];
1838                            var _arr = [0, 0.2877, 0.6347, 0.8174, 1.0000];
1839                            for (var _i11 = 0; _i11 < _arr.length; _i11++) {
1840                                var r = _arr[_i11];
1841                                x.push(r * Math.cos(0.9 * Math.PI / 4));
1842                                y.push(r * Math.sin(0.9 * Math.PI / 4));
1843                            }
1844
1845                            var openedInterpolationIndeces = [[2, 3, 4], [2, 3, 4, 5, 6]],
1846                                closedInterpolationIndeces = [[0, 1, 2], [0, 1, 2]],
1847                                flatInterpolationIndeces = [[5, 4], [7, 6]],
1848                                interpolationPoints = [{
1849                                    x: [[0, 0.2877, 0.6347, 0.8174, 1.0000], [0.000, 0.286, 0.632, 0.815, 0.997], [0.000, 0.279, 0.623, 0.806, 0.988], [0.000, 0.126, 0.411, 0.593, 0.774], [0, 0, 0, 0, 0], x],
1850                                    y: [[0, 0, 0, 0, 0], [0.000, 0.030, 0.010, 0.002, 0.000], [0.000, 0.060, 0.017, 0.004, 0.000], [0.000, 0.259, 0.440, 0.446, 0.429], [0, 0.2877, 0.6347, 0.8174, 1.0000], y]
1851                                }, {
1852                                    x: [[0, 0.2877, 0.6347, 0.8174, 1.0000], [0.000, 0.286, 0.632, 0.815, 0.997], [0.000, 0.279, 0.623, 0.806, 0.988], [0.000, 0.233, 0.563, 0.746, 0.927], [0.000, 0.144, 0.433, 0.613, 0.796], [0.000, 0.070, 0.288, 0.455, 0.626], [0, 0, 0, 0, 0], x],
1853                                    y: [[0, 0, 0, 0, 0], [0.000, 0.030, 0.010, 0.002, 0.000], [0.000, 0.060, 0.017, 0.004, 0.000], [0.000, 0.168, 0.269, 0.270, 0.255], [0.000, 0.245, 0.435, 0.458, 0.460], [0.000, 0.278, 0.544, 0.614, 0.673], [0, 0.2877, 0.6347, 0.8174, 1.0000], y]
1854                                }];
1855
1856                            return {
1857                                interpolationPoints: interpolationPoints,
1858                                openedInterpolationIndeces: openedInterpolationIndeces,
1859                                closedInterpolationIndeces: closedInterpolationIndeces,
1860                                flatInterpolationIndeces: flatInterpolationIndeces
1861                            };
1862                        };
1863
1864                        return SheetBlock;
1865                    }();
1866
1867                    exports.default = SheetBlock;
1868
1869                    /***/
1870                },
1871/* 11 */
1872/***/function (module, exports) {
1873
1874                    "use strict";
1875                    'use strict';
1876
1877                    exports.__esModule = true;
1878                    exports.props = props;
1879                    function props() {
1880                        // const props = {
1881                        //   height,
1882                        //   width,
1883                        //   gravity,
1884                        //   injector,
1885                        //   cachedPages,
1886                        //   renderInactivePages,
1887                        //   renderWhileFlipping,
1888                        //   pagesForPredicting,
1889                        //   preloadPages,
1890                        //   sheet: {
1891                        //     startVelocity,
1892                        //     cornerDeviation,
1893                        //     flexibility,
1894                        //     flexibleCorner,
1895                        //     bending,
1896                        //     wave,
1897                        //     shape,
1898                        //     widthTexels,
1899                        //     heightTexels,
1900                        //     color,
1901                        //     sideTexture
1902                        //   },
1903                        //   cover: {
1904                        //     ...sheet,
1905                        //     padding,
1906                        //     binderTexture,
1907                        //     depth,
1908                        //     mass
1909                        //   },
1910                        //   page: {
1911                        //     ...sheet,
1912                        //     depth,
1913                        //     mass
1914                        //   }
1915                        // };
1916
1917                        return {
1918                            height: 0.297,
1919                            width: 0.21,
1920                            gravity: 1,
1921                            cachedPages: 50,
1922                            renderInactivePages: true,
1923                            renderInactivePagesOnMobile: false,
1924                            renderWhileFlipping: false,
1925                            pagesForPredicting: 5,
1926                            preloadPages: 5,
1927                            rtl: false,
1928                            sheet: {
1929                                startVelocity: 0.9,
1930                                cornerDeviation: 0.25,
1931                                flexibility: 10,
1932                                flexibleCorner: 0.5,
1933                                bending: 11,
1934                                wave: 0.5,
1935                                shape: 0,
1936                                widthTexels: 5 * 210,
1937                                heightTexels: 5 * 297,
1938                                color: 0xFFFFFF
1939                            },
1940                            cover: {
1941                                binderTexture: '',
1942                                depth: 0.0003,
1943                                padding: 0,
1944                                mass: 0.003
1945                            },
1946                            page: {
1947                                depth: 0.0001,
1948                                mass: 0.001
1949                            },
1950                            cssLayerProps: {
1951                                width: 1024
1952                            }
1953                        };
1954                    };
1955
1956                    /***/
1957                },
1958/* 12 */
1959/***/function (module, exports, __webpack_require__) {
1960
1961                    "use strict";
1962                    'use strict';
1963
1964                    exports.__esModule = true;
1965                    exports.CSS3DSprite = exports.CSS3DObject = undefined;
1966
1967                    var _libs = __webpack_require__(0);
1968
1969                    function _classCallCheck(instance, Constructor) {
1970                        if (!(instance instanceof Constructor)) {
1971                            throw new TypeError("Cannot call a class as a function");
1972                        }
1973                    }
1974
1975                    function _possibleConstructorReturn(self, call) {
1976                        if (!self) {
1977                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1978                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
1979                    }
1980
1981                    function _inherits(subClass, superClass) {
1982                        if (typeof superClass !== "function" && superClass !== null) {
1983                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
1984                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
1984onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1985                    }
1986
1987                    _libs.THREE.CSS3DObject = function (_THREE$Object3D) {
1988                        _inherits(CSS3DObject, _THREE$Object3D);
1989
1990                        function CSS3DObject() {
1991                            var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
1992
1993                            _classCallCheck(this, CSS3DObject);
1994
1995                            var _this = _possibleConstructorReturn(this, _THREE$Object3D.call(this));
1996
1997                            if (element) {
1998                                _this.set(element);
1999                            }
2000                            return _this;
2001                        }
2002
2003                        CSS3DObject.prototype.set = function set(element) {
2004                            this.element = element;
2005                            this.element.style.position = 'absolute';
2006
2007                            this.addEventListener('removed', function () {
2008                                if (this.element.parentNode !== null) {
2009                                    this.element.parentNode.removeChild(this.element);
2010                                }
2011                            });
2012                        };
2013
2014                        return CSS3DObject;
2015                    }(_libs.THREE.Object3D);
2016
2017                    _libs.THREE.CSS3DSprite = function (_THREE$CSS3DObject) {
2018                        _inherits(CSS3DSprite, _THREE$CSS3DObject);
2019
2020                        function CSS3DSprite(element) {
2021                            _classCallCheck(this, CSS3DSprite);
2022
2023                            return _possibleConstructorReturn(this, _THREE$CSS3DObject.call(this, element));
2024                        }
2025
2026                        return CSS3DSprite;
2027                    }(_libs.THREE.CSS3DObject);
2028
2029                    _libs.THREE.CSS3DRenderer = function CSS3DRenderer() {
2030                        _classCallCheck(this, CSS3DRenderer);
2031
2032                        var _width, _height;
2033                        var _widthHalf, _heightHalf;
2034
2035                        var matrix = new _libs.THREE.Matrix4();
2036
2037                        var cache = {
2038                            camera: { fov: 0, style: '' },
2039                            objects: {}
2040                        };
2041
2042                        var domElement = document.createElement('div');
2043                        domElement.style.overflow = 'hidden';
2044
2045                        this.domElement = domElement;
2046
2047                        var cameraElement = document.createElement('div');
2048
2049                        cameraElement.style.WebkitTransformStyle = 'preserve-3d';
2050                        cameraElement.style.MozTransformStyle = 'preserve-3d';
2051                        cameraElement.style.transformStyle = 'preserve-3d';
2052
2053                        domElement.appendChild(cameraElement);
2054
2055                        var isIE = /Trident/i.test(navigator.userAgent);
2056
2057                        this.setClearColor = function () { };
2058
2059                        this.getSize = function () {
2060
2061                            return {
2062                                width: _width,
2063                                height: _height
2064                            };
2065                        };
2066
2067                        this.setSize = function (width, height) {
2068
2069                            _width = width;
2070                            _height = height;
2071                            _widthHalf = _width / 2;
2072                            _heightHalf = _height / 2;
2073
2074                            domElement.style.width = width + 'px';
2075                            domElement.style.height = height + 'px';
2076
2077                            cameraElement.style.width = width + 'px';
2078                            cameraElement.style.height = height + 'px';
2079                        };
2080
2081                        function epsilon(value) {
2082
2083                            return Math.abs(value) < 1e-10 ? 0 : value;
2084                        }
2085
2086                        function getCameraCSSMatrix(matrix) {
2087
2088                            var elements = matrix.elements;
2089
2090                            return 'matrix3d(' + epsilon(elements[0]) + ',' + epsilon(-elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(elements[6]) + ',' + epsilon(elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(-elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(-elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';
2091                        }
2092
2093                        function getObjectCSSMatrix(matrix, cameraCSSMatrix) {
2094
2095                            var elements = matrix.elements;
2096                            var matrix3d = 'matrix3d(' + epsilon(elements[0]) + ',' + epsilon(elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(-elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(-elements[6]) + ',' + epsilon(-elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';
2097
2098                            if (isIE) {
2099
2100                                return 'translate(-50%,-50%)' + 'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)' + cameraCSSMatrix + matrix3d;
2101                            }
2102
2103                            return 'translate(-50%,-50%)' + matrix3d;
2104                        }
2105
2106                        function renderObject(object, camera, cameraCSSMatrix) {
2107
2108                            if (object instanceof _libs.THREE.CSS3DObject) {
2109
2110                                var style;
2111
2112                                if (object instanceof _libs.THREE.CSS3DSprite) {
2113                                    matrix.copy(camera.matrixWorldInverse);
2114                                    matrix.transpose();
2115                                    matrix.copyPosition(object.matrixWorld);
2116                                    matrix.scale(object.scale);
2117
2118                                    matrix.elements[3] = 0;
2119                                    matrix.elements[7] = 0;
2120                                    matrix.elements[11] = 0;
2121                                    matrix.elements[15] = 1;
2122
2123                                    style = getObjectCSSMatrix(matrix, cameraCSSMatrix);
2124                                } else {
2125
2126                                    style = getObjectCSSMatrix(object.matrixWorld, cameraCSSMatrix);
2127                                }
2128
2129                                var element = object.element;
2130                                var cachedStyle = cache.objects[object.id] && cache.objects[object.id].style;
2131
2132                                if (cachedStyle === undefined || cachedStyle !== style) {
2133                                    element.style.WebkitTransform = style;
2134                                    element.style.MozTransform = style;
2135                                    element.style.transform = style;
2136
2137                                    cache.objects[object.id] = { style: style };
2138                                    if (isIE) {
2139                                        cache.objects[object.id].distanceToCameraSquared = getDistanceToSquared(camera, object);
2140                                    }
2141                                }
2142
2143                                if (element.parentNode !== cameraElement) {
2144                                    cameraElement.appendChild(element);
2145                                }
2146                            }
2147
2148                            for (var i = 0, l = object.children.length; i < l; i++) {
2149
2150                                renderObject(object.children[i], camera, cameraCSSMatrix);
2151                            }
2152                        }
2153
2154                        var getDistanceToSquared = function () {
2155
2156                            var a = new _libs.THREE.Vector3();
2157                            var b = new _libs.THREE.Vector3();
2158
2159                            return function (object1, object2) {
2160
2161                                a.setFromMatrixPosition(object1.matrixWorld);
2162                                b.setFromMatrixPosition(object2.matrixWorld);
2163
2164                                return a.distanceToSquared(b);
2165                            };
2166                        }();
2167
2168                        function zOrder(scene) {
2169
2170                            var order = Object.keys(cache.objects).sort(function (a, b) {
2171
2172                                return cache.objects[a].distanceToCameraSquared - cache.objects[b].distanceToCameraSquared;
2173                            });
2174                            var zMax = order.length;
2175
2176                            scene.traverse(function (object) {
2177
2178                                var index = order.indexOf(object.id + '');
2179
2180                                if (index !== -1) {
2181
2182                                    object.element.style.zIndex = zMax - index;
2183                                }
2184                            });
2185                        }
2186
2187                        this.render = function (scene, camera) {
2188
2189                            var fov = camera.projectionMatrix.elements[5] * _heightHalf;
2190
2191                            if (cache.camera.fov !== fov) {
2192
2193                                domElement.style.WebkitPerspective = fov + 'px';
2194                                domElement.style.MozPerspective = fov + 'px';
2195                                domElement.style.perspective = fov + 'px';
2196
2197                                cache.camera.fov = fov;
2198                            }
2199
2200                            scene.updateMatrixWorld();
2201
2202                            if (camera.parent === null) camera.updateMatrixWorld();
2203
2204                            var cameraCSSMatrix = 'translateZ(' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse);
2205
2206                            var style = cameraCSSMatrix + 'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)';
2207
2208                            if (cache.camera.style !== style && !isIE) {
2209
2210                                cameraElement.style.WebkitTransform = style;
2211                                cameraElement.style.MozTransform = style;
2212                                cameraElement.style.transform = style;
2213
2214                                cache.camera.style = style;
2215                            }
2216
2217                            renderObject(scene, camera, cameraCSSMatrix);
2218
2219                            if (isIE) {
2220
2221                                // IE10 and 11 does not support 'preserve-3d'.
2222                                // Thus, z-order in 3D will not work.
2223                                // We have to calc z-order manually and set CSS z-index for IE.
2224                                // FYI: z-index can't handle object intersection
2225                                zOrder(scene);
2226                            }
2227                        };
2228                    };
2229
2230                    exports.default = _libs.THREE.CSS3DRenderer;
2231
2232                    var _CSS3DObject = _libs.THREE.CSS3DObject,
2233                        _CSS3DSprite = _libs.THREE.CSS3DSprite;
2234                    exports.CSS3DObject = _CSS3DObject;
2235                    exports.CSS3DSprite = _CSS3DSprite;
2236
2237                    /***/
2238                },
2239/* 13 */
2240/***/function (module, exports, __webpack_require__) {
2241
2242                    "use strict";
2243                    'use strict';
2244
2245                    exports.__esModule = true;
2246
2247                    var _libs = __webpack_require__(0);
2248
2249                    var _CSS3DRenderer = __webpack_require__(12);
2250
2251                    function _classCallCheck(instance, Constructor) {
2252                        if (!(instance instanceof Constructor)) {
2253                            throw new TypeError("Cannot call a class as a function");
2254                        }
2255                    }
2256
2257                    function _possibleConstructorReturn(self, call) {
2258                        if (!self) {
2259                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2260                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
2261                    }
2262
2263                    function _inherits(subClass, superClass) {
2264                        if (typeof superClass !== "function" && superClass !== null) {
2265                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
2266                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
2266onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2267                    }
2268
2269                    var CSSLayer = function (_CSS3DObject) {
2270                        _inherits(CSSLayer, _CSS3DObject);
2271
2272                        CSSLayer.init = function init(doc) {
2273                            var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 150;
2274
2275                            CSSLayer.delay = delay;
2276                            CSSLayer.style = (0, _libs.$)('<style type=text/css>\n      .css-layer {\n    \t\topacity: 1;\n    \t\ttransition: opacity ' + delay + 'ms ease-out;\n        visibility: visible;\n        overflow: hidden;\n    \t}\n    \t.css-layer.hidden {\n    \t\ttransition: opacity ' + delay + 'ms ease-in, visibility ' + delay + 'ms step-end;\n    \t\topacity: 0;\n        visibility: hidden;\n      }\n    </style>').appendTo(doc.head);
2277                        };
2278
2279                        CSSLayer.dispose = function dispose() {
2280                            CSSLayer.style.remove();
2281                        };
2282
2283                        function CSSLayer(width, height, props) {
2284                            _classCallCheck(this, CSSLayer);
2285
2286                            var _this = _possibleConstructorReturn(this, _CSS3DObject.call(this));
2287
2288                            _this.props = props;
2289                            _this.jContainer = (0, _libs.$)('<div class="hidden css-layer"></div>');
2290                            var widthPxs = props.width,
2291                                heightPxs = height / width * widthPxs;
2292                            _this.jContainer.width(widthPxs).height(heightPxs);
2293                            _this.scale.x /= widthPxs / width;
2294                            _this.scale.y /= widthPxs / width;
2295
2296                            _this.setData();
2297                            _this.set(_this.jContainer[0]);
2298                            return _this;
2299                        }
2300
2301                        CSSLayer.prototype.callInternal = function callInternal(name) {
2302                            if (this.object && this.object[name]) {
2303                                try {
2304                                    this.object[name]();
2305                                } catch (e) {
2306                                    console.error(e);
2307                                }
2308                            }
2309                        };
2310
2311                        CSSLayer.prototype.dispose = function dispose() {
2312                            this.clearInternals();
2313                        };
2314
2315                        CSSLayer.prototype.clearInternals = function clearInternals() {
2316                            this.callInternal('dispose');
2317                            !this.css || this.css.remove();
2318                            !this.html || this.html.remove();
2319                        };
2320
2321                        CSSLayer.prototype.setData = function setData() {
2322                            var css = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2323                            var html = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2324                            var js = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
2325
2326                            this.clearInternals();
2327
2328                            this.css = (0, _libs.$)('<style type="text/css">' + css + '</style>').appendTo(this.jContainer);
2329                            this.html = (0, _libs.$)(html).appendTo(this.jContainer);
2330                            var init = eval(js);
2331                            if (init) {
2332                                this.object = init(this.jContainer, this.props) || {};
2333                            }
2334                        };
2335
2336                        CSSLayer.prototype.pendedCall = function pendedCall(clb) {
2337                            var _this2 = this;
2338
2339                            var timestamp = this.timestamp = Date.now();
2340                            setTimeout(function () {
2341                                if (timestamp === _this2.timestamp) {
2342                                    clb();
2343                                }
2344                            }, CSSLayer.delay);
2345                        };
2346
2347                        CSSLayer.prototype.isHidden = function isHidden() {
2348                            return this.jContainer.hasClass('hidden');
2349                        };
2350
2351                        CSSLayer.prototype.hide = function hide() {
2352                            var _this3 = this;
2353
2354                            var res = void 0;
2355                            if (!this.isHidden()) {
2356                                this.jContainer.addClass('hidden');
2357                                this.callInternal('hide');
2358                                res = new Promise(function (resolve) {
2359                                    _this3.pendedCall(function () {
2360                                        _this3.callInternal('hidden');
2361                                        resolve();
2362                                    });
2363                                });
2364                            } else {
2365                                res = Promise.resolve();
2366                            }
2367                            return res;
2368                        };
2369
2370                        CSSLayer.prototype.show = function show() {
2371                            var _this4 = this;
2372
2373                            var res = void 0;
2374                            if (this.isHidden()) {
2375                                this.jContainer.removeClass('hidden');
2376                                this.callInternal('show');
2377                                res = new Promise(function (resolve) {
2378                                    _this4.pendedCall(function () {
2379                                        _this4.callInternal('shown');
2380                                        resolve();
2381                                    });
2382                                });
2383                            } else {
2384                                res = Promise.resolve();
2385                            }
2386                            return res;
2387                        };
2388
2389                        return CSSLayer;
2390                    }(_CSS3DRenderer.CSS3DObject);
2391
2392                    exports.default = CSSLayer;
2393
2394                    /***/
2395                },
2396/* 14 */
2397/***/function (module, exports) {
2398
2399                    "use strict";
2400                    "use strict";
2401
2402                    exports.__esModule = true;
2403
2404                    function _classCallCheck(instance, Constructor) {
2405                        if (!(instance instanceof Constructor)) {
2406                            throw new TypeError("Cannot call a class as a function");
2407                        }
2408                    }
2409
2410                    var Cache = function () {
2411                        function Cache() {
2412                            var maxSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;
2413                            var sizeof = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Cache.countSizeof;
2414
2415                            _classCallCheck(this, Cache);
2416
2417                            this.os = new Map();
2418                            this.sizeof = sizeof;
2419                            this.maxSize = maxSize;
2420                            this.size = 0;
2421                        }
2422
2423                        Cache.prototype.forEach = function forEach(clb) {
2424                            this.os.forEach(function (v, k) {
2425                                return clb([k, v]);
2426                            });
2427                        };
2428
2429                        Cache.countSizeof = function countSizeof(value) {
2430                            return 1;
2431                        };
2432
2433                        Cache.prototype.remove = function remove(k) {
2434                            var res = false;
2435                            var v = this.os.get(k);
2436                            if (!v.locked || !v.locked(k)) {
2437                                this.size -= this.sizeof(v);
2438                                if (v.dispose) {
2439                                    v.dispose();
2440                                }
2441                                this.os.delete(k);
2442                                res = true;
2443                            }
2444                            return res;
2445                        };
2446
2447                        Cache.prototype.freeSpace = function freeSpace() {
2448                            var arr = [];
2449                            for (var _iterator = this.os, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
2450                                var _ref;
2451
2452                                if (_isArray) {
2453                                    if (_i >= _iterator.length) break;
2454                                    _ref = _iterator[_i++];
2455                                } else {
2456                                    _i = _iterator.next();
2457                                    if (_i.done) break;
2458                                    _ref = _i.value;
2459                                }
2460
2461                                var p = _ref;
2462
2463                                arr.push({ timestamp: p[1].timestamp, key: p[0] });
2464                            }
2465                            arr.sort(function (a, b) {
2466                                return a.timestamp - b.timestamp;
2467                            });
2468                            for (var i = 0; i < arr.length && this.size > 3 * this.maxSize / 4; ++i) {
2469                                this.remove(arr[i].key);
2470                            }
2471                        };
2472
2473                        Cache.prototype.dispose = function dispose() {
2474                            var arr = [];
2475                            for (var _iterator2 = this.os, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
2476                                var _ref2;
2477
2478                                if (_isArray2) {
2479                                    if (_i2 >= _iterator2.length) break;
2480                                    _ref2 = _iterator2[_i2++];
2481                                } else {
2482                                    _i2 = _iterator2.next();
2483                                    if (_i2.done) break;
2484                                    _ref2 = _i2.value;
2485                                }
2486
2487                                var p = _ref2;
2488
2489                                arr.push({ v: p[1], k: p[0] });
2490                            }
2491                            for (var _iterator3 = arr, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
2492                                var _ref3;
2493
2494                                if (_isArray3) {
2495                                    if (_i3 >= _iterator3.length) break;
2496                                    _ref3 = _iterator3[_i3++];
2497                                } else {
2498                                    _i3 = _iterator3.next();
2499                                    if (_i3.done) break;
2500                                    _ref3 = _i3.value;
2501                                }
2502
2503                                var o = _ref3;
2504
2505                                if (o.v.dispose) {
2506                                    o.v.dispose();
2507                                }
2508                                this.os.delete(o.k);
2509                            }
2510                        };
2511
2512                        Cache.recursionSizeof = function recursionSizeof(value) {
2513                            var size = 0;
2514                            if (value) {
2515                                ++size;
2516                                var len = value.length;
2517                                if (len === undefined) {
2518                                    for (var p in value) {
2519                                        if (value.hasOwnProperty(p)) {
2520                                            size += Cache.recursionSizeof(value[p]);
2521                                        }
2522                                    }
2523                                } else {
2524                                    size += len;
2525                                }
2526                            }
2527                            return size;
2528                        };
2529
2530                        Cache.prototype.getTimestamp = function getTimestamp() {
2531                            return Date.now();
2532                        };
2533
2534                        Cache.prototype.get = function get(key) {
2535                            var value = this.os.get(key);
2536                            if (value) {
2537                                value.timestamp = this.getTimestamp();
2538                            }
2539                            return value;
2540                        };
2541
2542                        Cache.prototype.put = function put(key, value) {
2543                            value.timestamp = this.getTimestamp();
2544                            this.os.set(key, value);
2545                            this.size += this.sizeof(value);
2546                            if (this.size > this.maxSize) {
2547                                this.freeSpace();
2548                            }
2549                            return value;
2550                        };
2551
2552                        return Cache;
2553                    }();
2554
2555                    exports.default = Cache;
2556
2557                    /***/
2558                },
2559/* 15 */
2560/***/function (module, exports, __webpack_require__) {
2561
2562                    "use strict";
2563                    'use strict';
2564
2565                    exports.__esModule = true;
2566
2567                    var _libs = __webpack_require__(0);
2568
2569                    function _classCallCheck(instance, Constructor) {
2570                        if (!(instance instanceof Constructor)) {
2571                            throw new TypeError("Cannot call a class as a function");
2572                        }
2573                    }
2574
2575                    function _possibleConstructorReturn(self, call) {
2576                        if (!self) {
2577                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2578                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
2579                    }
2580
2581                    function _inherits(subClass, superClass) {
2582                        if (typeof superClass !== "function" && superClass !== null) {
2583                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
2584                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2585                    }
2586
2587                    var Controller = function (_THREE$EventDispatche) {
2588                        _inherits(Controller, _THREE$EventDispatche);
2589
2590                        function Controller() {
2591                            _classCallCheck(this, Controller);
2592
2593                            return _possibleConstructorReturn(this, _THREE$EventDispatche.apply(this, arguments));
2594                        }
2595
2596                        Controller.prototype.handleDefault = function handleDefault(id, e, data) {
2597                            //console.log(id+'-'+e.type+'-'+data);
2598                        };
2599
2600                        Controller.prototype.dispatchAsync = function dispatchAsync(e) {
2601                            var _this2 = this;
2602
2603                            Promise.resolve().then(function () {
2604                                return _this2.dispatchEvent(e);
2605                            });
2606                        };
2607
2608                        Controller.prototype.dispose = function dispose() { };
2609
2610                        return Controller;
2611                    }(_libs.THREE.EventDispatcher);
2612
2613                    exports.default = Controller;
2614
2615                    /***/
2616                },
2617/* 16 */
2618/***/function (module, exports, __webpack_require__) {
2619
2620                    "use strict";
2621                    'use strict';
2622
2623                    exports.__esModule = true;
2624
2625                    var _EventConverter2 = __webpack_require__(6);
2626
2627                    var _EventConverter3 = _interopRequireDefault(_EventConverter2);
2628
2629                    function _interopRequireDefault(obj) {
2630                        return obj && obj.__esModule ? obj : { default: obj };
2631                    }
2632
2633                    function _classCallCheck(instance, Constructor) {
2634                        if (!(instance instanceof Constructor)) {
2635                            throw new TypeError("Cannot call a class as a function");
2636                        }
2637                    }
2638
2639                    function _possibleConstructorReturn(self, call) {
2640                        if (!self) {
2641                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2642                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
2643                    }
2644
2645                    function _inherits(subClass, superClass) {
2646                        if (typeof superClass !== "function" && superClass !== null) {
2647                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
2648                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
2648onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2649                    }
2650
2651                    var CustomEventConverter = function (_EventConverter) {
2652                        _inherits(CustomEventConverter, _EventConverter);
2653
2654                        // custom
2655                        // testIntersection(e, data);
2656                        // custom.object
2657                        // test(object);
2658
2659                        function CustomEventConverter(wnd, doc) {
2660                            var customTest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
2661                                return false;
2662                            };
2663                            var eDoc = arguments[3];
2664
2665                            _classCallCheck(this, CustomEventConverter);
2666
2667                            var _this = _possibleConstructorReturn(this, _EventConverter.call(this, wnd, doc));
2668
2669                            _this.eDoc = eDoc;
2670                            _this.customTest = customTest;
2671                            _this.customs = [];
2672                            return _this;
2673                        }
2674
2675                        CustomEventConverter.prototype.test = function test(object1, object2) {
2676                            return object1 && object2 ? this.customTest(object1, object2) : false;
2677                        };
2678
2679                        CustomEventConverter.prototype.getCallback = function getCallback(object) {
2680                            return object.target.callback;
2681                        };
2682
2683                        CustomEventConverter.prototype.addCustom = function addCustom(custom) {
2684                            this.customs.push(custom);
2685                        };
2686
2687                        CustomEventConverter.prototype.getObject = function getObject(e, data) {
2688                            var object = void 0;
2689                            if (data.doc === this.eDoc) {
2690                                for (var _iterator = this.customs, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
2691                                    var _ref;
2692
2693                                    if (_isArray) {
2694                                        if (_i >= _iterator.length) break;
2695                                        _ref = _iterator[_i++];
2696                                    } else {
2697                                        _i = _iterator.next();
2698                                        if (_i.done) break;
2699                                        _ref = _i.value;
2700                                    }
2701
2702                                    var custom = _ref;
2703
2704                                    object = custom.testIntersection(e, data);
2705                                    if (object) {
2706                                        break;
2707                                    }
2708                                }
2709                            }
2710                            return object;
2711                        };
2712
2713                        return CustomEventConverter;
2714                    }(_EventConverter3.default);
2715
2716                    exports.default = CustomEventConverter;
2717
2718                    /***/
2719                },
2720/* 17 */
2721/***/function (module, exports, __webpack_require__) {
2722
2723                    "use strict";
2724                    'use strict';
2725
2726                    exports.__esModule = true;
2727
2728                    var _extends = Object.assign || function (target) {
2729                        for (var i = 1; i < arguments.length; i++) {
2730                            var source = arguments[i]; for (var key in source) {
2731                                if (Object.prototype.hasOwnProperty.call(source, key)) {
2732                                    target[key] = source[key];
2733                                }
2734                            }
2735                        } return target;
2736                    };
2737
2738                    var _Utils = __webpack_require__(4);
2739
2740                    var _Utils2 = _interopRequireDefault(_Utils);
2741
2742                    function _interopRequireDefault(obj) {
2743                        return obj && obj.__esModule ? obj : { default: obj };
2744                    }
2745
2746                    function _classCallCheck(instance, Constructor) {
2747                        if (!(instance instanceof Constructor)) {
2748                            throw new TypeError("Cannot call a class as a function");
2749                        }
2750                    }
2751
2752                    var Finder = function () {
2753                        Finder.isDelimetr = function isDelimetr(s) {
2754                            return s === Finder.DELIMITER;
2755                        };
2756
2757                        Finder.prototype.merge = function merge() {
2758                            var as = [],
2759                                map = [],
2760                                strs = this.strs;
2761                            var p = 0;
2762                            for (var i = 0; i < strs.length; ++i) {
2763                                if (strs[i].length) {
2764                                    map.push({
2765                                        base: i,
2766                                        offset: p
2767                                    });
2768                                    as.push(strs[i]);
2769                                    p += strs[i].length;
2770                                    if (i < strs.length - 1 && !Finder.isDelimetr(strs[i].charAt(strs[i].length - 1)) && !Finder.isDelimetr(strs[i + 1].charAt(0))) {
2771                                        as.push(Finder.DELIMITER);
2772                                        ++p;
2773                                    }
2774                                }
2775                            }
2776                            this.map = map;
2777                            this.str = as.join('');
2778                        };
2779
2780                        Finder.prototype.addHits = function addHits(p) {
2781                            var info = this.map[_Utils2.default.lowerBound(this.map, { offset: p }, function (a, b) {
2782                                return a.offset - b.offset;
2783                            })];
2784                            var chars = this.pattern.length,
2785                                i = info.base;
2786                            p -= info.offset;
2787                            while (chars) {
2788                                if (this.strs[i].length) {
2789                                    var delimeter = i < this.strs.length - 1 && !Finder.isDelimetr(this.strs[i].charAt(this.strs[i].length - 1)) && !Finder.isDelimetr(this.strs[i + 1].charAt(0)),
2790                                        length = Math.min(this.strs[i].length + (delimeter ? 1 : 0) - p, chars);
2791                                    if (p < this.strs[i].length) {
2792                                        this.hits.push({
2793                                            index: i,
2794                                            offset: p,
2795                                            length: Math.min(length, this.strs[i].length - p)
2796                                        });
2797                                    }
2798                                    chars -= length;
2799                                    ++i;
2800                                    p = 0;
2801                                }
2802                            }
2803                        };
2804
2805                        Finder.prototype.addContext = function addContext(p) {
2806                            var f = p,
2807                                l = p + this.pattern.length - 1,
2808                                dels = this.props.contextLength,
2809                                prevDels = dels + 1;
2810                            while (dels && prevDels - dels) {
2811                                prevDels = dels;
2812                                if (dels % 2) {
2813                                    for (var i = f - 2; i >= 0; --i) {
2814                                        if (Finder.isDelimetr(this.str[i]) || i === 0) {
2815                                            f = i === 0 ? 0 : i + 1;
2816                                            --dels;
2817                                            break;
2818                                        }
2819                                    }
2820                                } else {
2821                                    for (var _i = l + 2; _i < this.str.length; ++_i) {
2822                                        if (Finder.isDelimetr(this.str[_i]) || _i === this.str.length - 1) {
2823                                            l = _i === this.str.length - 1 ? _i === this.str.length - 1 : _i - 1;
2824                                            --dels;
2825                                            break;
2826                                        }
2827                                    }
2828                                }
2829                            }
2830                            this.contexts.push(this.str.substr(f, l - f + 1));
2831                        };
2832
2833                        Finder.prototype.getHits = function getHits() {
2834                            return this.hits;
2835                        };
2836
2837                        Finder.prototype.getContexts = function getContexts() {
2838                            return this.contexts;
2839                        };
2840
2841                        function Finder(strs, pattern, props) {
2842                            _classCallCheck(this, Finder);
2843
2844                            this.props = _extends({}, Finder.defaults, props);
2845                            this.strs = strs;
2846                            var data = this.merge(strs);
2847                            this.hits = [];
2848                            this.contexts = [];
2849                            this.pattern = pattern.toLowerCase();
2850                            this.lstr = this.str.toLowerCase();
2851                            var p = 0;
2852                            while (true) {
2853                                p = this.lstr.indexOf(this.pattern, p);
2854                                if (p === -1) {
2855                                    break;
2856                                } else {
2857                                    this.addHits(p);
2858                                    this.addContext(p);
2859                                    p += this.pattern.length;
2860                                }
2861                            }
2862                        }
2863
2864                        return Finder;
2865                    }();
2866
2867                    Finder.DELIMITER = ' ';
2868                    Finder.defaults = {
2869                        contextLength: 7,
2870                        hits: true,
2871                        contexts: true
2872                    };
2873                    exports.default = Finder;
2874
2875                    /***/
2876                },
2877/* 18 */
2878/***/function (module, exports, __webpack_require__) {
2879
2880                    "use strict";
2881                    'use strict';
2882
2883                    exports.__esModule = true;
2884
2885                    var _libs = __webpack_require__(0);
2886
2887                    var _Utils = __webpack_require__(4);
2888
2889                    var _Utils2 = _interopRequireDefault(_Utils);
2890
2891                    function _interopRequireDefault(obj) {
2892                        return obj && obj.__esModule ? obj : { default: obj };
2893                    }
2894
2895                    function _classCallCheck(instance, Constructor) {
2896                        if (!(instance instanceof Constructor)) {
2897                            throw new TypeError("Cannot call a class as a function");
2898                        }
2899                    }
2900
2901                    _libs.PDFJS.workerSrc = (window.PDFJS_LOCALE ? PDFJS_LOCALE : { "pdfJsWorker": "/wp-content/plugins/vc-brochures/lib/js/pdf.worker.js", "pdfJsCMapUrl": "cmaps/" }).pdfJsWorker;
2902                    _libs.PDFJS.cMapUrl = (window.PDFJS_LOCALE ? PDFJS_LOCALE : { "pdfJsWorker": "/wp-content/plugins/vc-brochures/lib/js/pdf.worker.js", "pdfJsCMapUrl": "cmaps/" }).pdfJsCMapUrl;
2903                    _libs.PDFJS.cMapPacked = true;
2904
2905                    var Pdf = function () {
2906                        function Pdf(src, loadingProgress) {
2907                            var _this = this;
2908
2909                            _classCallCheck(this, Pdf);
2910
2911                            this.src = _Utils2.default.normalizeUrl(src);
2912                            this.handlerQueue = [];
2913                            this.progresData = { loaded: -1, total: 1 };
2914                            this.loadingProgress = loadingProgress;
2915
2916                            _libs.PDFJS.getDocument({
2917                                url: this.src,
2918                                rangeChunkSize: 512 * 1024
2919                            }, null, null, function (data) {
2920                                if (_this.loadingProgress) {
2921                                    var cur = Math.floor(100 * data.loaded / data.total),
2922                                        old = Math.floor(100 * _this.progresData.loaded / _this.progresData.total);
2923                                    if (cur !== old) {
2924                                        cur = isNaN(cur) ? 0 : cur;
2925                                        cur = cur > 100 ? 100 : cur;
2926                                        _this.loadingProgress(cur);
2927                                    }
2928                                }
2929                                _this.progresData = data;
2930                            }).then(function (handler) {
2931                                if (handler.numPages > 1) {
2932                                    Promise.all([handler.getPage(1), handler.getPage(2)]).then(function (pages) {
2933                                        _this.init(handler, pages);
2934                                    });
2935                                } else {
2936                                    _this.init(handler);
2937                                }
2938                            });
2939                        }
2940
2941                        Pdf.prototype.init = function init(handler, pages) {
2942                            this.handler = handler;
2943                            this.doubledPages = pages ? Math.abs(2 * Pdf.getPageSize(pages[0]).width - Pdf.getPageSize(pages[1]).width) / Pdf.getPageSize(pages[0]).width < 1e-4 : false;
2944                            var done = Promise.resolve(handler);
2945
2946                            var _loop = function _loop() {
2947                                if (_isArray) {
2948                                    if (_i >= _iterator.length) return 'break';
2949                                    _ref = _iterator[_i++];
2950                                } else {
2951                                    _i = _iterator.next();
2952                                    if (_i.done) return 'break';
2953                                    _ref = _i.value;
2954                                }
2955
2956                                var clb = _ref;
2957
2958                                done = done.then(function (handler) {
2959                                    clb(handler);
2960                                    return handler;
2961                                });
2962                            };
2963
2964                            for (var _iterator = this.handlerQueue.reverse(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
2965                                var _ref;
2966
2967                                var _ret = _loop();
2968
2969                                if (_ret === 'break') break;
2970                            }
2971                        };
2972
2973                        Pdf.prototype.getPageType = function getPageType(n) {
2974                            return !this.doubledPages || n === 0 || n === this.getPagesNum() - 1 ? 'full' : n & 1 ? 'left' : 'right';
2975                        };
2976
2977                        Pdf.prototype.getPage = function getPage(n) {
2978                            return this.handler.getPage(this.doubledPages ? Math.ceil(n / 2) + 1 : n + 1);
2979                        };
2980
2981                        Pdf.prototype.dispose = function dispose() {
2982                            this.handlerQueue.splice(0, this.handlerQueue.length);
2983                            delete this.handler;
2984                        };
2985
2986                        Pdf.prototype.setLoadingProgressClb = function setLoadingProgressClb(clb) {
2987                            this.loadingProgress = clb;
2988                        };
2989
2990                        Pdf.prototype.getPagesNum = function getPagesNum() {
2991                            return this.handler ? this.doubledPages ? 2 * (this.handler.numPages - 1) : this.handler.numPages : undefined;
2992                        };
2993
2994                        Pdf.getPageSize = function getPageSize(page) {
2995                            return {
2996                                width: page.view[2] - page.view[0],
2997                                height: page.view[3] - page.view[1]
2998                            };
2999                        };
3000
3001                        //   if(pages>1) {
3002                        //   handler.getPage(2).
3003                        //   then((page)=> {
3004                        //     const size1 = Pdf.getPageSize(page);
3005                        //     this.props.doubledPages = 2*size0.width===size1.width;
3006                        //     this.ready();
3007                        //   }).
3008                        //   catch(()=> this.ready());
3009                        // }
3010                        // else {
3011
3012                        Pdf.prototype.getHandler = function getHandler(clb) {
3013                            if (this.handler) {
3014                                clb(this.handler);
3015                            } else {
3016                                this.handlerQueue.push(clb);
3017                            }
3018                        };
3019
3020                        return Pdf;
3021                    }();
3022
3023                    exports.default = Pdf;
3024
3025                    /***/
3026                },
3027/* 19 */
3028/***/function (module, exports, __webpack_require__) {
3029
3030                    "use strict";
3031                    'use strict';
3032
3033                    exports.__esModule = true;
3034
3035                    var _libs = __webpack_require__(0);
3036
3037                    function _classCallCheck(instance, Constructor) {
3038                        if (!(instance instanceof Constructor)) {
3039                            throw new TypeError("Cannot call a class as a function");
3040                        }
3041                    }
3042
3043                    var ThreeEventConverterFs = function () {
3044                        ThreeEventConverterFs.objectsTest = function objectsTest(object1, object2) {
3045                            return object1 && object2 ? object1.object === object2.object : false;
3046                        };
3047
3048                        ThreeEventConverterFs.objectsAndFacesTest = function objectsAndFacesTest(object1, object2) {
3049                            return object1 && object2 ? object1.object === object2.object && object1.face.materialIndex === object2.face.materialIndex : false;
3050                        };
3051
3052                        function ThreeEventConverterFs(visualWorld) {
3053                            var test = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ThreeEventConverterFs.objectsAndFacesTest;
3054
3055                            _classCallCheck(this, ThreeEventConverterFs);
3056
3057                            this.visual = visualWorld;
3058                            this.coords = new _libs.THREE.Vector2();
3059                            this.raycaster = this.visual.raycaster;
3060                            this.camera = this.visual.camera;
3061                            this.threes = [];
3062                            this.test = test;
3063                        }
3064
3065                        ThreeEventConverterFs.prototype.addThree = function addThree(three) {
3066                            this.threes.push(three);
3067                        };
3068
3069                        ThreeEventConverterFs.prototype.removeThree = function removeThree(three) {
3070                            var i = this.threes.indexOf(three);
3071                            if (~i) {
3072                                this.threes.splice(i, 1);
3073                            }
3074                        };
3075
3076                        ThreeEventConverterFs.prototype.getObject = function getObject(e) {
3077                            this.setCoordsFromEvent(e);
3078                            this.raycaster.setFromCamera(this.coords, this.camera);
3079                            var intersects = this.raycaster.intersectObjects(this.threes);
3080                            return intersects[0];
3081                        };
3082
3083                        return ThreeEventConverterFs;
3084                    }();
3085
3086                    exports.default = ThreeEventConverterFs;
3087
3088                    /***/
3089                },
3090/* 20 */
3091/***/function (module, exports, __webpack_require__) {
3092
3093                    "use strict";
3094                    'use strict';
3095
3096                    exports.__esModule = true;
3097
3098                    var _BaseMathUtils = __webpack_require__(2);
3099
3100                    var _BaseMathUtils2 = _interopRequireDefault(_BaseMathUtils);
3101
3102                    function _interopRequireDefault(obj) {
3103                        return obj && obj.__esModule ? obj : { default: obj };
3104                    }
3105
3106                    function _classCallCheck(instance, Constructor) {
3107                        if (!(instance instanceof Constructor)) {
3108                            throw new TypeError("Cannot call a class as a function");
3109                        }
3110                    }
3111
3112                    var ThreeUtils = function () {
3113                        function ThreeUtils() {
3114                            _classCallCheck(this, ThreeUtils);
3115                        }
3116
3117                        ThreeUtils.vertices2UVs = function vertices2UVs(vertices, indeces, first, last, converClb) {
3118                            var r = [];
3119                            for (var i = first; i < last; ++i) {
3120                                var vis = [indeces[i].a, indeces[i].b, indeces[i].c];
3121                                for (var j = 0; j < vis.length; ++j) {
3122                                    if (!r[vis[j]]) {
3123                                        r[vis[j]] = converClb(vertices[vis[j]]);
3124                                    }
3125                                }
3126                            }
3127                            return r;
3128                        };
3129
3130                        ThreeUtils.computeFaceVertexUvs = function computeFaceVertexUvs(geometry, faces) {
3131                            var uvs = [ThreeUtils.vertices2UVs(geometry.vertices, geometry.faces, 0, faces[0], function (p) {
3132                                return new THREE.Vector2(p.x, 1 - p.z);
3133                            }), ThreeUtils.vertices2UVs(geometry.vertices, geometry.faces, faces[0], faces[1], function (p) {
3134                                return new THREE.Vector2(1 - p.x, 1 - p.z);
3135                            }), ThreeUtils.vertices2UVs(geometry.vertices, geometry.faces, faces[1], faces[2], function (p) {
3136                                return new THREE.Vector2(p.x, p.y);
3137                            }), ThreeUtils.vertices2UVs(geometry.vertices, geometry.faces, faces[2], faces[3], function (p) {
3138                                return new THREE.Vector2(1 - p.x, p.y);
3139                            }), ThreeUtils.vertices2UVs(geometry.vertices, geometry.faces, faces[3], faces[4], function (p) {
3140                                return new THREE.Vector2(p.z, p.y);
3141                            }), ThreeUtils.vertices2UVs(geometry.vertices, geometry.faces, faces[4], geometry.faces.length, function (p) {
3142                                return new THREE.Vector2(1 - p.z, p.y);
3143                            })];
3144
3145                            var uvsi = 0;
3146                            for (var i = 0; i < geometry.faces.length; ++i) {
3147                                uvsi += faces[uvsi] === i;
3148                                var f = geometry.faces[i];
3149                                f.materialIndex = uvsi;
3150                                geometry.faceVertexUvs[0][i] = [uvs[uvsi][f.a], uvs[uvsi][f.b], uvs[uvsi][f.c]];
3151                            }
3152                        };
3153
3154                        ThreeUtils.createMarker = function createMarker(p, c, size) {
3155                            var marker = new THREE.Mesh(new THREE.SphereGeometry(size), new THREE.MeshPhongMaterial({ color: c }));
3156                            marker.position.set(p.x, p.y, p.z);
3157                            return marker;
3158                        };
3159
3160                        ThreeUtils.findUvTris = function findUvTris(geometry, ps, first, last) {
3161                            var res = [];
3162                            for (var _iterator = ps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
3163                                var _ref;
3164
3165                                if (_isArray) {
3166                                    if (_i >= _iterator.length) break;
3167                                    _ref = _iterator[_i++];
3168                                } else {
3169                                    _i = _iterator.next();
3170                                    if (_i.done) break;
3171                                    _ref = _i.value;
3172                                }
3173
3174                                var p = _ref;
3175
3176                                var found = false;
3177                                for (var i = first; i < last && !found; ++i) {
3178                                    var tri = geometry.faceVertexUvs[0][i];
3179                                    if (_BaseMathUtils2.default.isInsideConvPoly(tri, p)) {
3180                                        res.push({
3181                                            coefs: _BaseMathUtils2.default.computeInterpCoefs(tri, p),
3182                                            i: i
3183                                        });
3184                                        found = true;
3185                                    }
3186                                }
3187                                if (!found) {
3188                                    console.error('Bad point');
3189                                    res.push(undefined);
3190                                }
3191                            }
3192                            return res;
3193                        };
3194
3195                        ThreeUtils.findInternalVertices = function findInternalVertices(geometry, ps, first, last) {
3196                            var res = {};
3197                            for (var i = first; i < last; ++i) {
3198                                var tri = geometry.faceVertexUvs[0][i],
3199                                    f = geometry.faces[i],
3200                                    vs = [f.a, f.b, f.c];
3201                                for (var j = 0; j < tri.length; ++j) {
3202                                    if (res[vs[j]] === undefined && _BaseMathUtils2.default.isInsidePoly(ps, tri[j])) {
3203                                        res[vs[j]] = {
3204                                            p: tri[j],
3205                                            i: vs[j],
3206                                            n: f.vertexNormals[j]
3207                                        };
3208                                    }
3209                                }
3210                            }
3211                            return Object.values(res);
3212                        };
3213
3214                        return ThreeUtils;
3215                    }();
3216
3217                    exports.default = ThreeUtils;
3218
3219                    /***/
3220                },
3221/* 21 */
3222/***/function (module, exports) {
3223
3224                    "use strict";
3225                    "use strict";
3226
3227                    exports.__esModule = true;
3228
3229                    function _classCallCheck(instance, Constructor) {
3230                        if (!(instance instanceof Constructor)) {
3231                            throw new TypeError("Cannot call a class as a function");
3232                        }
3233                    }
3234
3235                    var Target = function () {
3236                        function Target() {
3237                            _classCallCheck(this, Target);
3238                        }
3239
3240                        Target.test = function test(object1, object2) {
3241                            return object1.target === object2.target;
3242                        };
3243
3244                        return Target;
3245                    }();
3246
3247                    exports.default = Target;
3248
3249                    /***/
3250                },
3251/* 22 */
3252/***/function (module, exports, __webpack_require__) {
3253
3254                    "use strict";
3255                    'use strict';
3256
3257                    var _extends = Object.assign || function (target) {
3258                        for (var i = 1; i < arguments.length; i++) {
3259                            var source = arguments[i]; for (var key in source) {
3260                                if (Object.prototype.hasOwnProperty.call(source, key)) {
3261                                    target[key] = source[key];
3262                                }
3263                            }
3264                        } return target;
3265                    };
3266
3267                    var _libs = __webpack_require__(1);
3268
3269                    var _Detector = __webpack_require__(45);
3270
3271                    var _Detector2 = _interopRequireDefault(_Detector);
3272
3273                    var _VisualWorld = __webpack_require__(66);
3274
3275                    var _VisualWorld2 = _interopRequireDefault(_VisualWorld);
3276
3277                    var _PdfLinksHandler = __webpack_require__(35);
3278
3279                    var _PdfLinksHandler2 = _interopRequireDefault(_PdfLinksHandler);
3280
3281                    var _Book = __webpack_require__(26);
3282
3283                    var _Book2 = _interopRequireDefault(_Book);
3284
3285                    var _BookView = __webpack_require__(29);
3286
3287                    var _BookView2 = _interopRequireDefault(_BookView);
3288
3289                    var _BookController = __webpack_require__(27);
3290
3291                    var _BookController2 = _interopRequireDefault(_BookController);
3292
3293                    var _PdfBookPropsBuilder = __webpack_require__(34);
3294
3295                    var _PdfBookPropsBuilder2 = _interopRequireDefault(_PdfBookPropsBuilder);
3296
3297                    var _ClbBookPropsBuilder = __webpack_require__(30);
3298
3299                    var _ClbBookPropsBuilder2 = _interopRequireDefault(_ClbBookPropsBuilder);
3300
3301                    var _LoadingController = __webpack_require__(53);
3302
3303                    var _LoadingController2 = _interopRequireDefault(_LoadingController);
3304
3305                    var _Search = __webpack_require__(58);
3306
3307                    var _Search2 = _interopRequireDefault(_Search);
3308
3309                    var _Bookmarks = __webpack_require__(44);
3310
3311                    var _Bookmarks2 = _interopRequireDefault(_Bookmarks);
3312
3313                    var _Thumbnails = __webpack_require__(63);
3314
3315                    var _Thumbnails2 = _interopRequireDefault(_Thumbnails);
3316
3317                    var _TocController = __webpack_require__(40);
3318
3319                    var _TocController2 = _interopRequireDefault(_TocController);
3320
3321                    var _BookPrinter = __webpack_require__(28);
3322
3323                    var _BookPrinter2 = _interopRequireDefault(_BookPrinter);
3324
3325                    var _AutoNavigator = __webpack_require__(24);
3326
3327                    var _AutoNavigator2 = _interopRequireDefault(_AutoNavigator);
3328
3329                    var _SoundsEnviroment = __webpack_require__(39);
3330
3331                    var _SoundsEnviroment2 = _interopRequireDefault(_SoundsEnviroment);
3332
3333                    function _interopRequireDefault(obj) {
3334                        return obj && obj.__esModule ? obj : { default: obj };
3335                    }
3336
3337                    _libs.$.fn.FlipBook = function (options) {
3338                        var scene = {
3339                            dispose: function dispose() {
3340                                if (this.ready) {
3341                                    !scene.pdfLinksHandler || scene.pdfLinksHandler.dispose();
3342                                    delete scene.pdfLinksHandler;
3343                                    scene.sounds.dispose();
3344                                    delete scene.sounds;
3345                                    scene.tocCtrl.dispose();
3346                                    delete scene.tocCtrl;
3347                                    scene.thumbnails.dispose();
3348                                    delete scene.thumbnails;
3349                                    !scene.bookmarks || scene.bookmarks.dispose();
3350                                    delete scene.bookmarks;
3351                                    scene.ctrl.dispose();
3352                                    delete scene.ctrl;
3353                                    scene.bookPrinter.dispose();
3354                                    delete scene.bookPrinter;
3355                                    scene.book.dispose();
3356                                    delete scene.book;
3357                                    scene.propsBuilder.dispose();
3358                                    delete scene.propsBuilder;
3359                                    delete scene.bookBuilder;
3360                                    scene.visual.dispose();
3361                                    delete scene.visual;
3362                                    scene.view.dispose();
3363                                    delete scene.view;
3364                                    delete scene.dispose;
3365                                } else {
3366                                    this.pendingDispose = true;
3367                                }
3368                            }
3369                        };
3370                        options = _extends({}, options);
3371                        scene.view = new _BookView2.default(this.length ? this[0] : (0, _libs.$)('<div>').appendTo('body'), function () {
3372                            if (!_Detector2.default.webgl) {
3373                                _Detector2.default.addGetWebGLMessage({ parent: scene.view.getView() });
3374                            } else {
3375                                scene.loadingCtrl = new _LoadingController2.default(scene.view, true, function (progress) {
3376                                    return progress === 0 ? (0, _libs.tr)('Please wait... the Application is Loading') : (0, _libs.tr)('PDF is Loading:') + ' ' + progress + '%';
3377                                });
3378                                scene.visual = new _VisualWorld2.default(scene.view.getContainer().ownerDocument.defaultView, scene.view.getContainer().ownerDocument, scene.view.getView());
3379                                scene.bookBuilder = function (props, sheets, pageCallback) {
3380                                    props.cssLayerProps = _extends({}, props.cssLayerProps, {
3381                                        scene: scene
3382                                    });
3383                                    if (options.propertiesCallback) {
3384                                        props = options.propertiesCallback(props);
3385                                    }
3386                                    scene.book = new _Book2.default(scene.visual, sheets, pageCallback, props);
3387                                    scene.bookPrinter = new _BookPrinter2.default(scene.visual, scene.book, (options.template || {}).printStyle);
3388                                    scene.loadingCtrl.dispose();
3389                                    delete scene.loadingCtrl;
3390                                    scene.ctrl = new _BookController2.default(scene.book, scene.view, options.controlsProps);
3391                                    scene.book.setInjector(function (w) {
3392                                        w.jQuery = w.$ = _libs.$;
3393                                        w.book = scene.book;
3394                                        w.bookCtrl = scene.ctrl;
3395                                        if (props.injector) {
3396                                            props.injector(w);
3397                                        }
3398                                    });
3399                                    scene.view.addHandler(scene.ctrl);
3400                                    scene.ctrl.setPrinter(scene.bookPrinter);
3401                                    var test = pageCallback(0);
3402
3403                                    scene.search = new _Search2.default(scene.view.getSearchView(), scene.book.getPages());
3404                                    scene.search.onQuery = scene.book.setQuery.bind(scene.book);
3405                                    scene.book.addEventListener('searchResults', function (e) {
3406                                        scene.search.setResults(e.results, e.lastPage);
3407                                    });
3408
3409                                    scene.thumbnails = new _Thumbnails2.default(scene.visual, scene.view.getThumbnailsView(), pageCallback, 2 * (sheets + 2), { kWtoH: props.width / props.height });
3410                                    scene.tocCtrl = new _TocController2.default(scene.view, scene.ctrl);
3411                                    scene.tocCtrl.setThumbnails(scene.thumbnails);
3412                                    scene.tocCtrl.setSearch(scene.search);
3413                                    scene.ctrl.setTocCtrl(scene.tocCtrl);
3414                                    scene.view.addHandler(scene.tocCtrl);
3415
3416                                    if (test.type === 'pdf') {
3417                                        scene.pdfLinksHandler = new _PdfLinksHandler2.default(test.src, scene.ctrl, scene.visual.element);
3418                                        scene.book.addEventListener('pdfAnnotation', scene.pdfLinksHandler.handleEvent.bind(scene.pdfLinksHandler));
3419                                        test.src.getHandler(function (handler) {
3420                                            handler.getOutline().then(function (outline) {
3421                                                scene.bookmarks = new _Bookmarks2.default(scene.view.getBookmarksView(), outline);
3422                                                scene.tocCtrl.setBookmarks(scene.bookmarks, test.
3422src);
3423                                            });
3424                                        });
3425                                        if (options.pdfLinks && options.pdfLinks.handler) {
3426                                            scene.pdfLinksHandler.setHandler(options.pdfLinks.handler);
3427                                        }
3428                                    }
3429
3430                                    scene.sounds = new _SoundsEnviroment2.default(options.template);
3431                                    scene.ctrl.setSounds(scene.sounds);
3432                                    scene.sounds.subscribeFlips(scene.ctrl);
3433
3434                                    scene.ready = true;
3435                                    new _AutoNavigator2.default(scene.visual, scene.ctrl, options.autoNavigation).dispose();
3436                                    if (options.ready) {
3437                                        options.ready(scene);
3438                                    }
3439                                    if (scene.pendingDispose) {
3440                                        scene.dispose();
3441                                    }
3442                                };
3443                                if (options.pdf) {
3444                                    scene.propsBuilder = new _PdfBookPropsBuilder2.default(options.pdf, scene.bookBuilder);
3445                                    scene.propsBuilder.pdf.setLoadingProgressClb(scene.loadingCtrl.setProgress.bind(scene.loadingCtrl));
3446                                } else if (options.pageCallback) {
3447                                    scene.propsBuilder = new _ClbBookPropsBuilder2.default(scene.visual, options.pageCallback, options.pages, scene.bookBuilder);
3448                                } else {
3449                                    scene.propsBuilder = new _ClbBookPropsBuilder2.default(scene.visual, _Book2.default.pageCallback, 6, scene.bookBuilder);
3450                                }
3451                            }
3452                        }, options.template);
3453                        return scene;
3454                    };
3455
3456                    (0, _libs.$)(function () {
3457                        var containers = (0, _libs.$)('.flip-book-container');
3458                        for (var i = 0; i < containers.length; ++i) {
3459                            var jContainer = (0, _libs.$)(containers[i]),
3460                                src = jContainer.attr('src');
3461                            if (!!src) {
3462                                jContainer.FlipBook({ pdf: src });
3463                            }
3464                        }
3465                    });
3466
3467                    window.jQuery = window.$ = _libs.$;
3468
3469                    /***/
3470                },
3471/* 23 */
3472/***/function (module, exports) {
3473
3474                    "use strict";
3475                    'use strict';
3476
3477                    if (!Array.prototype.fill) {
3478                        Array.prototype.fill = function (value) {
3479
3480                            // Шаги 1-2.
3481                            if (this == null) {
3482                                throw new TypeError('this is null or not defined');
3483                            }
3484
3485                            var O = Object(this);
3486
3487                            // Шаги 3-5.
3488                            var len = O.length >>> 0;
3489
3490                            // Шаги 6-7.
3491                            var start = arguments[1];
3492                            var relativeStart = start >> 0;
3493
3494                            // Шаг 8.
3495                            var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);
3496
3497                            // Шаги 9-10.
3498                            var end = arguments[2];
3499                            var relativeEnd = end === undefined ? len : end >> 0;
3500
3501                            // Шаг 11.
3502                            var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);
3503
3504                            // Шаг 12.
3505                            while (k < final) {
3506                                O[k] = value;
3507                                k++;
3508                            }
3509
3510                            // Шаг 13.
3511                            return O;
3512                        };
3513                    }
3514
3515                    if (!Array.prototype.find) {
3516                        Object.defineProperty(Array.prototype, 'find', {
3517                            value: function value(predicate) {
3518                                'use strict';
3519
3520                                if (this == null) {
3521                                    throw new TypeError('Array.prototype.find called on null or undefined');
3522                                }
3523                                if (typeof predicate !== 'function') {
3524                                    throw new TypeError('predicate must be a function');
3525                                }
3526                                var list = Object(this);
3527                                var length = list.length >>> 0;
3528                                var thisArg = arguments[1];
3529                                var value;
3530
3531                                for (var i = 0; i < length; i++) {
3532                                    value = list[i];
3533                                    if (predicate.call(thisArg, value, i, list)) {
3534                                        return value;
3535                                    }
3536                                }
3537                                return undefined;
3538                            }
3539                        });
3540                    }
3541
3542                    if (!Array.prototype.findIndex) {
3543                        Array.prototype.findIndex = function (predicate) {
3544                            if (this == null) {
3545                                throw new TypeError('Array.prototype.findIndex called on null or undefined');
3546                            }
3547                            if (typeof predicate !== 'function') {
3548                                throw new TypeError('predicate must be a function');
3549                            }
3550                            var list = Object(this);
3551                            var length = list.length >>> 0;
3552                            var thisArg = arguments[1];
3553                            var value;
3554
3555                            for (var i = 0; i < length; i++) {
3556                                value = list[i];
3557                                if (predicate.call(thisArg, value, i, list)) {
3558                                    return i;
3559                                }
3560                            }
3561                            return -1;
3562                        };
3563                    }
3564
3565                    if (!Object.values) {
3566                        Object.values = function values(O) {
3567                            return Object.keys(O).map(function (name) {
3568                                return O[name];
3569                            }) || [];
3570                        };
3571                    }
3572
3573                    /***/
3574                },
3575/* 24 */
3576/***/function (module, exports) {
3577
3578                    "use strict";
3579                    'use strict';
3580
3581                    exports.__esModule = true;
3582
3583                    var _extends = Object.assign || function (target) {
3584                        for (var i = 1; i < arguments.length; i++) {
3585                            var source = arguments[i]; for (var key in source) {
3586                                if (Object.prototype.hasOwnProperty.call(source, key)) {
3587                                    target[key] = source[key];
3588                                }
3589                            }
3590                        } return target;
3591                    };
3592
3593                    function _classCallCheck(instance, Constructor) {
3594                        if (!(instance instanceof Constructor)) {
3595                            throw new TypeError("Cannot call a class as a function");
3596                        }
3597                    }
3598
3599                    var AutoNavigator = function () {
3600                        function AutoNavigator(context, bookCtrl) {
3601                            var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3602
3603                            _classCallCheck(this, AutoNavigator);
3604
3605                            props = _extends({}, props, {
3606                                urlParam: props.urlParam || 'fb3d-page',
3607                                navigates: props.navigates === undefined ? 1 : props.navigates
3608                            });
3609                            this.props = props;
3610                            this.context = context;
3611                            this.bookCtrl = bookCtrl;
3612                            this.urlParam = props.urlParam;
3613                            this.wnd = context.wnd;
3614
3615                            this.wnd.fb3d = _extends({}, this.wnd.fb3d);
3616                            this.wnd.fb3d.navigator = _extends({}, this.wnd.fb3d.navigator);
3617                            this.navigator = this.wnd.fb3d.navigator[this.urlParam] = _extends({}, this.wnd.fb3d.navigator[this.urlParam]);
3618                            this.navigator.instances = (this.navigator.instances || 0) + 1;
3619
3620                            if (this.navigator.instances <= this.props.navigates) {
3621                                this.bookCtrl.goToPage(this.getPageNumber());
3622                            }
3623                        }
3624
3625                        AutoNavigator.prototype.dispose = function dispose() { };
3626
3627                        AutoNavigator.prototype.getParameterByName = function getParameterByName(name, url) {
3628                            if (!url) {
3629                                url = window.location.href;
3630                            }
3631                            name = name.replace(/[\[\]]/g, '\\$&');
3632                            var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)'),
3633                                results = regex.exec(url);
3634                            if (!results) return null;
3635                            if (!results[2]) return '';
3636                            return decodeURIComponent(results[2].replace(/\+/g, ' '));
3637                        };
3638
3639                        AutoNavigator.prototype.getPageNumber = function getPageNumber() {
3640                            var number = this.getParameterByName(this.urlParam);
3641                            number = parseInt(number);
3642                            if (isNaN(number)) {
3643                                number = 1;
3644                            }
3645                            return number - 1;
3646                        };
3647
3648                        return AutoNavigator;
3649                    }();
3650
3651                    exports.default = AutoNavigator;
3652
3653                    /***/
3654                },
3655/* 25 */
3656/***/function (module, exports, __webpack_require__) {
3657
3658                    "use strict";
3659                    'use strict';
3660
3661                    exports.__esModule = true;
3662
3663                    var _extends = Object.assign || function (target) {
3664                        for (var i = 1; i < arguments.length; i++) {
3665                            var source = arguments[i]; for (var key in source) {
3666                                if (Object.prototype.hasOwnProperty.call(source, key)) {
3667                                    target[key] = source[key];
3668                                }
3669                            }
3670                        } return target;
3671                    };
3672
3673                    var _libs = __webpack_require__(1);
3674
3675                    var _MathUtils = __webpack_require__(3);
3676
3677                    var _MathUtils2 = _interopRequireDefault(_MathUtils);
3678
3679                    function _interopRequireDefault(obj) {
3680                        return obj && obj.__esModule ? obj : { default: obj };
3681                    }
3682
3683                    function _classCallCheck(instance, Constructor) {
3684                        if (!(instance instanceof Constructor)) {
3685                            throw new TypeError("Cannot call a class as a function");
3686                        }
3687                    }
3688
3689                    var Binder = function () {
3690                        function Binder(visual, p) {
3691                            var _this = this;
3692
3693                            _classCallCheck(this, Binder);
3694
3695                            this.visual = visual;
3696                            this.p = _extends({}, p, {
3697                                backSize: 2 * p.cover.depth + p.sheets * p.page.depth
3698                            });
3699                            this.OZ = new _libs.THREE.Vector3(0, 0, 1);
3700
3701                            this.backG = new _libs.THREE.BoxGeometry(p.cover.depth, this.p.backSize, p.cover.height);
3702
3703                            this.materials = [new _libs.THREE.MeshPhongMaterial({ color: p.cover.color }), new _libs.THREE.MeshPhongMaterial({ color: p.cover.color }), new _libs.THREE.MeshPhongMaterial({ color: p.cover.color }), new _libs.THREE.MeshPhongMaterial({ color: p.cover.color }), new _libs.THREE.MeshPhongMaterial({ color: p.cover.color }), new _libs.THREE.MeshPhongMaterial({ color: p.cover.color })];
3704
3705                            var backM = new _libs.THREE.Mesh(this.backG, new _libs.THREE.MeshFaceMaterial(this.materials));
3706
3707                            if (p.cover.binderTexture !== '') {
3708                                this.visual.textureLoader.load(p.cover.binderTexture, function (texture) {
3709                                    _this.materials[1].color.setHex(0xFFFFFF);
3710                                    _this.materials[1].map = texture;
3711                                    texture.minFilter = _libs.THREE.LinearFilter;
3712                                    texture.needsUpdate = true;
3713                                    _this.materials[1].needsUpdate = true;
3714                                });
3715                            }
3716
3717                            this.three = new _libs.THREE.Object3D();
3718                            this.back = new _libs.THREE.Object3D();
3719                            this.backRT = new _libs.THREE.Object3D();
3720                            this.backRR = new _libs.THREE.Object3D();
3721                            this.backLT = new _libs.THREE.Object3D();
3722                            this.backLR = new _libs.THREE.Object3D();
3723                            this.leftPivot = new _libs.THREE.Object3D();
3724                            this.rightPivot = new _libs.THREE.Object3D();
3725
3726                            this.back.add(backM);
3727                            this.back.add(this.leftPivot);
3728                            this.back.add(this.rightPivot);
3729                            this.backRT.add(this.back);
3730                            this.backRR.add(this.backRT);
3731                            this.backLT.add(this.backRR);
3732                            this.backLR.add(this.backLT);
3733                            this.three.add(this.backLR);
3734                        }
3735
3736                        Binder.prototype.dispose = function dispose() {
3737                            for (var _iterator = this.materials, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
3738                                var _ref;
3739
3740                                if (_isArray) {
3741                                    if (_i >= _iterator.length) break;
3742                                    _ref = _iterator[_i++];
3743                                } else {
3744                                    _i = _iterator.next();
3745                                    if (_i.done) break;
3746                                    _ref = _i.value;
3747                                }
3748
3749                                var m = _ref;
3750
3751                                if (m.map) {
3752                                    m.map = null;
3753                                    m.needsUpdate = true;
3754                                }
3755                                m.dispose();
3756                            }
3757                            delete this.materials;
3758                            this.backG.dispose();
3759                        };
3760
3761                        Binder.prototype.set = function set(angle) {
3762                            var right = void 0,
3763                                left = void 0;
3764                            if (angle > Math.PI / 2) {
3765                                right = Math.PI / 2;
3766                                left = angle - Math.PI / 2;
3767                            } else {
3768                                right = angle;
3769                                left = 0;
3770                            }
3771                            var p = this.p,
3772                                tr1 = { x: -0.5 * p.cover.depth, y: 0.5 * p.backSize - p.cover.depth };
3773                            this.backRT.position.set(tr1.x, tr1.y, 0);
3774                            this.backRR.position.set(-tr1.x, -tr1.y, 0);
3775                            this.backRR.quaternion.setFromAxisAngle(this.OZ, right);
3776
3777                            var tr2 = { x: p.backSize - 2 * p.cover.depth - 0.5 * p.cover.depth, y: 0.5 * p.backSize - p.cover.depth };
3778                            this.backLT.position.set(tr2.x, tr2.y, 0);
3779                            this.backLR.position.set(-tr2.x, -tr2.y, 0);
3780                            this.backLR.quaternion.setFromAxisAngle(this.OZ, left);
3781                        };
3782
3783                        Binder.prototype.setLeft = function setLeft(angle) {
3784                            var PI = Math.PI;
3785                            this.leftPivot.position.set(_MathUtils2.default.interpolateLinear([-PI, -PI / 2], [0, this.p.cover.depth], angle), 0.5 * this.p.backSize - 0.5 * this.p.cover.depth, 0);
3786                            this.leftPivot.quaternion.setFromAxisAngle(this.OZ, angle);
3787                        };
3788
3789                        Binder.prototype.setRight = function setRight(angle) {
3790                            var PI = Math.PI;
3791                            this.rightPivot.position.set(_MathUtils2.default.interpolateLinear([-PI / 2, 0], [this.p.cover.depth, 0], angle), -0.5 * this.p.backSize + 0.5 * this.p.cover.depth, 0);
3792                            this.rightPivot.quaternion.setFromAxisAngle(this.OZ, angle);
3793                        };
3794
3795                        Binder.prototype.joinLeftCover = function joinLeftCover(cover) {
3796                            cover.three.position.set(0, -0.5 * this.p.cover.depth, 0);
3797                            this.leftPivot.add(cover.three);
3798                        };
3799
3800                        Binder.prototype.disconnectLeftCover = function disconnectLeftCover(cover) {
3801                            this.leftPivot.remove(cover.three);
3802                        };
3803
3804                        Binder.prototype.joinRightCover = function joinRightCover(cover) {
3805                            cover.three.position.set(0, -0.5 * this.p.cover.depth, 0);
3806                            this.rightPivot.add(cover.three);
3807                        };
3808
3809                        Binder.prototype.disconnectRightCover = function disconnectRightCover(cover) {
3810                            this.rightPivot.remove(cover.three);
3811                        };
3812
3813                        return Binder;
3814                    }();
3815
3816                    exports.default = Binder;
3817
3818                    /***/
3819                },
3820/* 26 */
3821/***/function (module, exports, __webpack_require__) {
3822
3823                    "use strict";
3824                    'use strict';
3825
3826                    exports.__esModule = true;
3827
3828                    var _extends = Object.assign || function (target) {
3829                        for (var i = 1; i < arguments.length; i++) {
3830                            var source = arguments[i]; for (var key in source) {
3831                                if (Object.prototype.hasOwnProperty.call(source, key)) {
3832                                    target[key] = source[key];
3833                                }
3834                            }
3835                        } return target;
3836                    };
3837
3838                    var _libs = __webpack_require__(1);
3839
3840                    var _book = __webpack_require__(11);
3841
3842                    var _GraphUtils = __webpack_require__(7);
3843
3844                    var _GraphUtils2 = _interopRequireDefault(_GraphUtils);
3845
3846                    var _Binder = __webpack_require__(25);
3847
3848                    var _Binder2 = _interopRequireDefault(_Binder);
3849
3850                    var _Cover = __webpack_require__(31);
3851
3852                    var _Cover2 = _interopRequireDefault(_Cover);
3853
3854                    var _SheetBlock = __webpack_require__(10);
3855
3856                    var _SheetBlock2 = _interopRequireDefault(_SheetBlock);
3857
3858                    var _SheetPhysics = __webpack_require__(38);
3859
3860                    var _SheetPhysics2 = _interopRequireDefault(_SheetPhysics);
3861
3862                    var _PageManager = __webpack_require__(33);
3863
3864                    var _PageManager2 = _interopRequireDefault(_PageManager);
3865
3866                    var _CSSLayer = __webpack_require__(13);
3867
3868                    var _CSSLayer2 = _interopRequireDefault(_CSSLayer);
3869
3870                    var _CssLayersManager = __webpack_require__(32);
3871
3872                    var _CssLayersManager2 = _interopRequireDefault(_CssLayersManager);
3873
3874                    var _SearchEngine = __webpack_require__(36);
3875
3876                    var _SearchEngine2 = _interopRequireDefault(_SearchEngine);
3877
3878                    var _CustomEventConverter = __webpack_require__(16);
3879
3880                    var _CustomEventConverter2 = _interopRequireDefault(_CustomEventConverter);
3881
3882                    var _CircleTarget = __webpack_require__(68);
3883
3884                    var _CircleTarget2 = _interopRequireDefault(_CircleTarget);
3885
3886                    function _interopRequireDefault(obj) {
3887                        return obj && obj.__esModule ? obj : { default: obj };
3888                    }
3889
3890                    function _classCallCheck(instance, Constructor) {
3891                        if (!(instance instanceof Constructor)) {
3892                            throw new TypeError("Cannot call a class as a function");
3893                        }
3894                    }
3895
3896                    function _possibleConstructorReturn(self, call) {
3897                        if (!self) {
3898                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3899                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
3900                    }
3901
3902                    function _inherits(subClass, superClass) {
3903                        if (typeof superClass !== "function" && superClass !== null) {
3904                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
3905                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
3905onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
3906                    }
3907
3908                    var Book = function (_THREE$EventDispatche) {
3909                        _inherits(Book, _THREE$EventDispatche);
3910
3911                        // pageCallback samples
3912
3913                        // (n)=> ({
3914                        //   type: 'image',
3915                        //   src: 'sample.png',
3916                        //   interactive: false
3917                        // });
3918                        //
3919                        // (n)=> ({
3920                        //   type: 'html',
3921                        //   src: 'sample.html',
3922                        //   interactive: true
3923                        // });
3924                        //
3925                        // const pdf = new Pdf('sample.pdf');
3926                        // (n)=> ({
3927                        //   type: 'pdf',
3928                        //   src: pdf,
3929                        //   interactive: false
3930                        // });
3931
3932                        function Book(visual, sheets, pageCallback, props) {
3933                            _classCallCheck(this, Book);
3934
3935                            var _this = _possibleConstructorReturn(this, _THREE$EventDispatche.call(this));
3936
3937                            // sheets = Math.min(3, sheets);
3938                            // visual.jContainer.append('\n      <style type="text/css">\n        .demo-msg {\n          position: absolute;\n          top: 10px;\n          right: 10px;\n          padding: 10px;\n          background-color: #ffe4e1;\n          border-radius: 3px;\n        }\n      </style>\n      <div class="demo-msg">\n        This is the demo version, only 10 pages are available. Use the <a href="http://3dflipbook.net/download-jq" target="_blank">full version</a>.\n      </div>\n    ');
3939                            _this.visual = visual;
3940                            _this.mouseController = true;
3941                            _this.p = _extends({}, Book.prepareProps(props), {
3942                                sheets: sheets,
3943                                pageCallback: pageCallback,
3944                                zoom: 1,
3945                                singlePage: false,
3946                                autoResolution: {
3947                                    enable: false,
3948                                    k: 1.5
3949                                }
3950                            });
3951                            _this.pageManager = new _PageManager2.default(visual, _this, _this.p);
3952                            _CSSLayer2.default.init(visual.doc);
3953                            _this.layerManager = new _CssLayersManager2.default(_this);
3954                            _this.searchEngine = new _SearchEngine2.default(pageCallback, 2 * (sheets + 2));
3955                            _this.searchEngine.onPageHitsChanged = function (page, query) {
3956                                _this.pageManager.refreshPageQuery(page, query);
3957                                _this.dispatchEvent({
3958                                    type: 'searchResults',
3959                                    results: _this.searchEngine.results,
3960                                    lastPage: page,
3961                                    query: query
3962                                });
3963                            };
3964
3965                            _this.three = new _libs.THREE.Object3D();
3966
3967                            _this.binder = new _Binder2.default(visual, _this.p);
3968                            _this.three.add(_this.binder.three);
3969
3970                            _this.leftCover = new _Cover2.default(visual, _extends({}, _this.p, { setTexture: _this.setLeftCoverTexture.bind(_this) }), Math.PI / 2, 'opened');
3971                            _this.binder.joinLeftCover(_this.leftCover);
3972                            _this.subscribeSheetBlock(_this.leftCover, 0);
3973                            _this.rightCover = new _Cover2.default(visual, _extends({}, _this.p, { setTexture: _this.setRightCoverTexture.bind(_this) }), 0, 'closed');
3974                            _this.binder.joinRightCover(_this.rightCover);
3975                            _this.subscribeSheetBlock(_this.rightCover, 2 * (_this.p.sheets + 1));
3976
3977                            _this.threeSheetBlocks = new _libs.THREE.Object3D();
3978                            _this.three.add(_this.threeSheetBlocks);
3979                            _this.threeSheetBlocks.position.set(0.5 * _this.p.cover.depth - 0.5 * sheets * _this.p.page.depth, -0.5 * sheets * _this.p.page.depth, 0);
3980
3981                            _this.sheetBlocks = [];
3982                            if (sheets > 0) {
3983                                _this.addSheetBlock(0, new _SheetBlock2.default(visual, _extends({}, _this.p, { setTexture: _this.setPageTexture.bind(_this) }), 0, sheets, 0, 'closed'));
3984                            }
3985
3986                            _this.angle = _this.p.rtl ? Math.PI : 0;
3987                            _this.closedAngle = 0;
3988                            _this.set(_this.angle, 0);
3989                            _this.lastMousePos = {
3990                                t: 0
3991                            };
3992
3993                            _this.three.position.set(-0.5 * _this.p.cover.depth + 0.5 * sheets * _this.p.page.depth, 0, 0);
3994                            _this.sheetPhysics = new _SheetPhysics2.default(_this.p.page.width / _this.p.scale, _this.p.gravity, _this.p.page.cornerDeviation);
3995
3996                            _this.binds = {
3997                                update: _this.update.bind(_this),
3998                                lastMousePos: function lastMousePos(e) {
3999                                    _this.lastMousePos = _extends({}, _this.lastMousePos, {
4000                                        pageX: e.pageX,
4001                                        pageY: e.pageY
4002                                    });
4003                                }
4004                            };
4005                            _this.visual.addRenderCallback(_this.binds.update);
4006                            (0, _libs.$)(_this.visual.element).on('mousemove', _this.binds.lastMousePos);
4007
4008                            _this.binds.onPickCallback = _this.onPickCallback.bind(_this);
4009                            _this.visual.drag.onPickCallback = _this.binds.onPickCallback;
4010                            _this.binds.onDragCallback = _this.onDragCallback.bind(_this);
4011                            _this.visual.drag.onDragCallback = _this.binds.onDragCallback;
4012                            _this.binds.onReleaseCallback = _this.onReleaseCallback.bind(_this);
4013                            _this.visual.drag.onReleaseCallback = _this.binds.onReleaseCallback;
4014
4015                            _this.dragAngle = 0.05;
4016                            _this.tmp = {
4017                                boxs: [new _libs.THREE.Box3(), new _libs.THREE.Box3()]
4018                            };
4019
4020                            _this.visual.addObject(_this.three);
4021                            _this.visual.addEventListener('resize', _this.pageManager.refreshZoom.bind(_this.pageManager));
4022
4023                            setTimeout(function () {
4024                                _this.notifyBeforeAnimation();
4025                                _this.notifyAfterAnimation();
4026                            }, 100);
4027                            return _this;
4028                        }
4029
4030                        Book.prototype.dispose = function dispose() {
4031                            this.visual.removeObject(this.three);
4032                            this.sheetPhysics.dispose();
4033                            delete this.visual.drag.onPickCallback;
4034                            delete this.visual.drag.onDragCallback;
4035                            delete this.visual.drag.onReleaseCallback;
4036                            (0, _libs.$)(this.visual.element).off('mousemove', this.binds.lastMousePos);
4037                            this.visual.removeRenderCallback(this.binds.update);
4038                            this.removeSheetBlocks(0, this.sheetBlocks.length);
4039                            this.binder.disconnectLeftCover(this.leftCover);
4040                            this.removeSheetBlock(this.leftCover);
4041                            this.binder.disconnectRightCover(this.rightCover);
4042                            this.removeSheetBlock(this.rightCover);
4043                            this.binder.dispose();
4044                            this.layerManager.dispose();
4045                            _CSSLayer2.default.dispose();
4046                            this.pageManager.dispose();
4047                        };
4048
4049                        // publics {
4050
4051                        Book.prototype.setAutoResolution = function setAutoResolution(enable) {
4052                            var k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1.5;
4053
4054                            this.p.autoResolution = _extends({}, this.p.autoResolution, {
4055                                enable: enable,
4056                                k: k
4057                            });
4058                        };
4059
4060                        Book.prototype.setZoom = function setZoom(zoom, singlePage) {
4061                            if (Math.abs(this.p.zoom - zoom) > 1e-3 || singlePage !== this.p.singlePage) {
4062                                this.p.zoom = zoom;
4063                                this.p.singlePage = singlePage;
4064                                this.pageManager.refreshZoom();
4065                            }
4066                        };
4067
4068                        Book.prototype.getPageCallback = function getPageCallback() {
4069                            return this.p.pageCallback;
4070                        };
4071
4072                        Book.prototype.setQuery = function setQuery(query) {
4073                            this.searchEngine.setQuery(query);
4074                        };
4075
4076                        Book.prototype.isProcessing = function isProcessing() {
4077                            return this.sheetPhysics.getSize() !== 0;
4078                        };
4079
4080                        Book.prototype.getPages = function getPages() {
4081                            return 4 + 2 * this.p.sheets;
4082                        };
4083
4084                        Book.prototype.setFlipProgressClb = function setFlipProgressClb(clb) {
4085                            this.p.flipProgressClb = clb;
4086                        };
4087
4088                        Book.prototype.setInjector = function setInjector(injector) {
4089                            this.p.injector = injector;
4090                        };
4091
4092                        Book.prototype.isActivePage = function isActivePage(n) {
4093                            var res = true;
4094                            if (n > 1 && n < this.getPages() - 2) {
4095                                for (var _iterator = this.sheetBlocks, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
4096                                    var _ref;
4097
4098                                    if (_isArray) {
4099                                        if (_i >= _iterator.length) break;
4100                                        _ref = _iterator[_i++];
4101                                    } else {
4102                                        _i = _iterator.next();
4103                                        if (_i.done) break;
4104                                        _ref = _i.value;
4105                                    }
4106
4107                                    var b = _ref;
4108
4109                                    if (n - 2 > 2 * b.p.first && n - 2 < 2 * b.p.last - 1) {
4110                                        res = false;
4111                                        break;
4112                                    }
4113                                }
4114                            }
4115                            return res;
4116                        };
4117
4118                        Book.prototype.getBlockByPage = function getBlockByPage(n) {
4119                            var block = void 0;
4120                            if (n < 2) {
4121                                block = this.leftCover;
4122                            } else if (n < 2 * (this.p.sheets + 1)) {
4123                                for (var _iterator2 = this.sheetBlocks, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
4124                                    var _ref2;
4125
4126                                    if (_isArray2) {
4127                                        if (_i2 >= _iterator2.length) break;
4128                                        _ref2 = _iterator2[_i2++];
4129                                    } else {
4130                                        _i2 = _iterator2.next();
4131                                        if (_i2.done) break;
4132                                        _ref2 = _i2.value;
4133                                    }
4134
4135                                    var b = _ref2;
4136
4137                                    if (n - 2 >= 2 * b.p.first && n - 2 < 2 * b.p.last) {
4138                                        block = b;
4139                                        break;
4140                                    }
4141                                }
4142                            } else {
4143                                block = this.rightCover;
4144                            }
4145                            return block;
4146                        };
4147
4148                        Book.prototype.getBlockPages = function getBlockPages(block) {
4149                            var range = void 0;
4150                            switch (block) {
4151                                case this.leftCover:
4152                                    {
4153                                        range = [0, 1];
4154                                        break;
4155                                    }
4156                                case this.rightCover:
4157                                    {
4158                                        range = [2 * (this.p.sheets + 1), 2 * (this.p.sheets + 1) + 1];
4159                                        break;
4160                                    }
4161                                default:
4162                                    {
4163                                        range = block ? [2 * (block.p.first + 1), 2 * (block.p.last + 1) - 1] : undefined;
4164                                    }
4165                            }
4166                            return range;
4167                        };
4168
4169                        Book.prototype.getPage = function getPage() {
4170                            var PI = Math.PI;
4171                            var p = void 0;
4172                            if (this.angle === PI / 2 || this.angle === 3 * PI / 2) {
4173                                for (var _iterator3 = this.sheetBlocks, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
4174                                    var _ref3;
4175
4176                                    if (_isArray3) {
4177                                        if (_i3 >= _iterator3.length) break;
4178                                        _ref3 = _iterator3[_i3++];
4179                                    } else {
4180                                        _i3 = _iterator3.next();
4181                                        if (_i3.done) break;
4182                                        _ref3 = _i3.value;
4183                                    }
4184
4185                                    var block = _ref3;
4186
4187                                    if (block.angle <= PI / 2) {
4188                                        p = this.getBlockPages(block)[0] - 1;
4189                                        break;
4190                                    }
4191                                }
4192                                if (!p) {
4193                                    p = this.getPages() - 3;
4194                                }
4195                            } else if (this.angle < PI / 2) {
4196                                p = 0;
4197                            } else if (this.angle > 3 * PI / 2) {
4198                                p = 1;
4199                            } else if (this.angle < PI) {
4200                                p = this.getPages() - 3;
4201                            } else if (this.angle >= PI) {
4202                                p = this.getPages() - 1;
4203                            }
4204                            return p;
4205                        };
4206
4207                        Book.prototype.getTopPages = function getTopPages() {
4208                            var p = this.getPage();
4209                            return p === 0 || p === this.getPages() - 1 ? [p] : [p, p + 1];
4210                        };
4211
4212                        Book.prototype.getPageState = function getPageState(n) {
4213                            return this.pageManager.getPageState(n);
4214                        };
4215
4216                        Book.prototype.enableLoadingAnimation = function enableLoadingAnimation(enable) {
4217                            this.pageManager.enableLoadingAnimation(enable);
4218                        };
4219
4220                        Book.prototype.getLeftFlipping = function getLeftFlipping() {
4221                            var block = void 0;
4222                            var left = this.sheetBlocks[0],
4223                                PI = Math.PI;
4224                            if (this.angle === PI) {
4225                                block = this.rightCover;
4226                            } else {
4227                                if (left && left.state === 'closed' && left.angle > PI / 2) {
4228                                    block = left;
4229                                } else if (this.angle === PI / 2 || this.angle === 3 * PI / 2) {
4230                                    block = this.leftCover;
4231                                }
4232                            }
4233                            return block;
4234                        };
4235
4236                        Book.prototype.getRightFlipping = function getRightFlipping() {
4237                            var block = void 0;
4238                            var right = this.sheetBlocks[this.sheetBlocks.length - 1],
4239                                PI = Math.PI;
4240                            if (this.angle === 0) {
4241                                block = this.leftCover;
4242                            } else {
4243                                if (right && right.state === 'closed' && right.angle <= PI / 2) {
4244                                    block = right;
4245                                } else if (this.angle === PI / 2 || this.angle === 3 * PI / 2) {
4246                                    block = this.rightCover;
4247                                }
4248                            }
4249                            return block;
4250                        };
4251
4252                        Book.prototype.getClosedBlockAngle = function getClosedBlockAngle(angle) {
4253                            var closedAngle = void 0,
4254                                PI = Math.PI;
4255
4256                            if (this.leftCover.physicId) {
4257                                var test = void 0;
4258                                try {
4259                                    test = Math.abs(this.sheetPhysics.getParametr(this.leftCover.physicId, 'angle') - angle);
4260                                } catch (e) {
4261                                    test = 0;
4262                                }
4263                                closedAngle = angle > PI / 2 || test > PI / 6 ? PI / 2 : this.closedAngle;
4264                            } else if (this.rightCover.physicId) {
4265                                var _test = void 0;
4266                                try {
4267                                    _test = Math.abs(this.sheetPhysics.getParametr(this.rightCover.physicId, 'angle') - angle);
4268                                } catch (e) {
4269                                    _test = 0;
4270                                }
4271                                closedAngle = angle < PI / 2 || _test > PI / 6 ? PI / 2 + 1e-7 : this.closedAngle;
4272                            } else {
4273                                closedAngle = PI / 2 + (angle !== 0) * 1e-7;
4274                            }
4275
4276                            return {
4277                                openedAngle: angle,
4278                                closedAngle: closedAngle,
4279                                binderTurn: this.closedAngle
4280                            };
4281                        };
4282
4283                        Book.prototype.flipLeft = function flipLeft() {
4284                            var _this2 = this;
4285
4286                            var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
4287                            var progressClb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.p.flipProgressClb;
4288
4289                            var block = void 0,
4290                                res = void 0;
4291                            if (this.sheetPhysics.getSize() < 25) {
4292                                (function () {
4293                                    var left = _this2.sheetBlocks[0],
4294                                        PI = Math.PI;
4295                                    if (_this2.angle === PI) {
4296                                        res = _this2.connectPhysics(block = _this2.rightCover, _this2.p.cover.mass, PI, -_this2.p.cover.startVelocity, _this2.p.cover.flexibility, 0, function (angle, height) {
4297                                            return _this2.set(3 * PI / 2 - angle / 2, height);
4298                                        }, function (angle, height) {
4299                                            _this2.set(3 * PI / 2 - angle / 2, 0);
4300                                            _this2.setSheetBlocks(angle ? PI 
4300: PI / 2 + 1e-7, 'closed');
4301                                        }, progressClb);
4302                                    } else {
4303                                        if (left && left.state === 'closed' && left.angle > PI / 2) {
4304                                            block = size < left.getSize() ? _this2.splitSheetBlock(0, left.getSize() - size)[1] : left;
4305                                            res = _this2.connectPhysics(block, _this2.p.page.mass * block.getSize(), PI, -_this2.p.page.startVelocity, _this2.p.page.flexibility, 0, function (angle, height) {
4306                                                return block.set(_this2.getClosedBlockAngle(angle), 'opened', height);
4307                                            }, Book.finishAnimationClb.bind({ book: _this2, block: block }), progressClb);
4308                                        } else if (_this2.angle === PI / 2 || _this2.angle === 3 * PI / 2) {
4309                                            res = _this2.connectPhysics(block = _this2.leftCover, _this2.p.cover.mass, PI, -_this2.p.cover.startVelocity, _this2.p.cover.flexibility, 0, function (angle, height) {
4310                                                _this2.set(2 * PI - angle / 2, height);
4311                                                if (angle > PI / 2) {
4312                                                    _this2.setSheetBlocks(angle ? PI / 2 : 0, 'closed');
4313                                                }
4314                                            }, function (angle, height) {
4315                                                return _this2.set(angle === 0 ? 0 : 2 * PI - angle / 2, 0);
4316                                            }, progressClb);
4317                                        }
4318                                    }
4319                                })();
4320                            }
4321                            return res;
4322                        };
4323
4324                        Book.prototype.flipRight = function flipRight() {
4325                            var _this3 = this;
4326
4327                            var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
4328                            var progressClb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.p.flipProgressClb;
4329
4330                            var block = void 0,
4331                                res = void 0;
4332                            if (this.sheetPhysics.getSize() < 25) {
4333                                (function () {
4334                                    var right = _this3.sheetBlocks[_this3.sheetBlocks.length - 1],
4335                                        PI = Math.PI;
4336                                    if (_this3.angle === 0) {
4337                                        res = _this3.connectPhysics(block = _this3.leftCover, _this3.p.cover.mass, 0, _this3.p.cover.startVelocity, _this3.p.cover.flexibility, 0, function (angle, height) {
4338                                            return _this3.set(angle / 2, height);
4339                                        }, function (angle, height) {
4340                                            _this3.set(angle / 2, 0);
4341                                            _this3.setSheetBlocks(angle ? PI / 2 : 0, 'closed');
4342                                        }, progressClb);
4343                                    } else {
4344                                        if (right && right.state === 'closed' && right.angle <= PI / 2) {
4345                                            block = size < right.getSize() ? _this3.splitSheetBlock(_this3.sheetBlocks.length - 1, size)[0] : right;
4346                                            res = _this3.connectPhysics(block, _this3.p.page.mass * block.getSize(), 0, _this3.p.page.startVelocity, _this3.p.page.flexibility, 0, function (angle, height) {
4347                                                return block.set(_this3.getClosedBlockAngle(angle), 'opened', height);
4348                                            }, Book.finishAnimationClb.bind({ book: _this3, block: block }), progressClb);
4349                                        } else if (_this3.angle === PI / 2 || _this3.angle === 3 * PI / 2) {
4350                                            res = _this3.connectPhysics(block = _this3.rightCover, _this3.p.cover.mass, 0, _this3.p.cover.startVelocity, _this3.p.cover.flexibility, 0, function (angle, height) {
4351                                                _this3.set(PI / 2 + angle / 2, height);
4352                                                if (angle < PI / 2) {
4353                                                    _this3.setSheetBlocks(PI / 2 + 1e-7, 'closed');
4354                                                }
4355                                            }, function (angle, height) {
4356                                                return _this3.set(PI / 2 + angle / 2, 0);
4357                                            }, progressClb);
4358                                        }
4359                                    }
4360                                })();
4361                            }
4362                            return res;
4363                        };
4364
4365                        // }
4366
4367                        Book.prototype.clearHoverInfo = function clearHoverInfo() {
4368                            this.pageManager.turnOnEvents();
4369                            delete this.hoverInfo.block.force;
4370                            delete this.hoverInfo.block.cornerForce;
4371                            delete this.hoverInfo;
4372                        };
4373
4374                        Book.prototype.xSegment = function xSegment() {
4375                            var boxs = this.tmp.boxs,
4376                                res = {};
4377                            if (this.leftCover.physicId) {
4378                                boxs[0].setFromObject(this.rightCover.three);
4379                                res.min = -(res.max = boxs[0].max.x);
4380                            } else if (this.rightCover.physicId) {
4381                                boxs[0].setFromObject(this.leftCover.three);
4382                                res.max = -(res.min = boxs[0].min.x);
4383                            } else {
4384                                boxs[0].setFromObject(this.leftCover.three);
4385                                boxs[1].setFromObject(this.rightCover.three);
4386                                boxs[0].union(boxs[1]);
4387                                res.min = boxs[0].min.x;
4388                                res.max = boxs[0].max.x;
4389                            }
4390                            return res;
4391                        };
4392
4393                        Book.prototype.computeTarget = function computeTarget(point) {
4394                            var x = point.x,
4395                                y = point.y,
4396                                seg = this.xSegment(),
4397                                angle = void 0;
4398
4399                            angle = (seg.max - x) / (seg.max - seg.min) * Math.PI;
4400                            // angle = Math.acos(x/Math.sqrt(x*x+y*y));
4401                            return Math.max(this.dragAngle, Math.min(Math.PI - this.dragAngle, angle));
4402                        };
4403
4404                        Book.prototype.onPickCallback = function onPickCallback(object) {
4405                            var res = false;
4406                            var block = object.object.userData.self,
4407                                p = _extends({}, object.uv),
4408                                i = object.face.materialIndex;
4409                            if (i < 2) {
4410                                p.x = i === 0 ? p.x : 1 - p.x;
4411                                if (block.cornerTarget.testIntersection(null, p) && block.physicId) {
4412                                    if (this.hoverInfo) {
4413                                        this.clearHoverInfo();
4414                                    }
4415                                    block.force = _SheetPhysics2.default.dragForceClb;
4416                                    block.cornerForce = _SheetPhysics2.default.getDragCornerForceClb(this.computeTarget(object.point));
4417                                    this.dragInfo = {
4418                                        object: object,
4419                                        block: block
4420                                    };
4421                                    res = true;
4422                                    this.pageManager.turnOffEvents();
4423                                }
4424                            }
4425                            return res;
4426                        };
4427
4428                        Book.prototype.onDragCallback = function onDragCallback(point) {
4429                            var block = this.dragInfo.block,
4430                                p = block.getProps();
4431                            block.force = _SheetPhysics2.default.dragForceClb;
4432                            block.cornerForce = _SheetPhysics2.default.getDragCornerForceClb(this.computeTarget(point));
4433                            return true;
4434                        };
4435
4436                        Book.prototype.onReleaseCallback = function onReleaseCallback() {
4437                            delete this.dragInfo.block.force;
4438                            delete this.dragInfo.block.cornerForce;
4439                            delete this.dragInfo;
4440                            this.pageManager.turnOnEvents();
4441                        };
4442
4443                        Book.prototype.getFlipping = function getFlipping(i) {
4444                            return i ? this.getLeftFlipping() : this.getRightFlipping();
4445                        };
4446
4447                        Book.prototype.flip = function flip(i) {
4448                            var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
4449
4450                            return i ? this.flipLeft(size) : this.flipRight(size);
4451                        };
4452
4453                        Book.prototype.enableMouse = function enableMouse(enable) {
4454                            this.mouseController = enable;
4455                        };
4456
4457                        Book.prototype.cornerCallback = function cornerCallback(e, data) {
4458                            var _this4 = this;
4459
4460                            if (this.mouseController) {
4461                                (function () {
4462                                    var _data$data = data.data,
4463                                        i = _data$data.i,
4464                                        n = _data$data.n;
4465
4466                                    if (e.type === 'mouseover') {
4467                                        if (_this4.hoverInfo && _this4.hoverInfo.pendings !== undefined) {
4468                                            ++_this4.hoverInfo.pendings;
4469                                        } else {
4470                                            if (_this4.hoverInfo) {
4471                                                console.warn('Wrong state: element is already hover');
4472                                                if (_this4.hoverInfo.n !== n) {
4473                                                    _this4.clearHoverInfo();
4474                                                }
4475                                            }
4476                                            if (!_this4.hoverInfo && !_this4.dragInfo) {
4477                                                (function () {
4478                                                    var res = Promise.resolve(undefined);
4479                                                    var hoverAngle = 0.02,
4480                                                        hover = _this4.getBlockByPage(n),
4481                                                        possible = _this4.getFlipping(i);
4482                                                    if (n > 1 && n < 2 * (_this4.p.sheets + 1) && hover.physicId && (hover.angle < hoverAngle || hover.angle > Math.PI - hoverAngle)) {
4483                                                        res = Promise.resolve(hover);
4484                                                    } else if (hover === possible) {
4485                                                        var sheetBlocks = [_this4.leftCover].concat(_this4.sheetBlocks, [_this4.rightCover]);
4486                                                        var j = sheetBlocks.indexOf(hover),
4487                                                            nextBlock = ~j ? sheetBlocks[j + 2 * i - 1] : undefined;
4488                                                        if (!nextBlock || !nextBlock.physicId || nextBlock.angle > hoverAngle && nextBlock.angle < Math.PI - hoverAngle) {
4489                                                            res = _this4.flip(i, 1).then(function (block) {
4490                                                                if (!block) {
4491                                                                    delete _this4.hoverInfo;
4492                                                                } else {
4493                                                                    _this4.sheetPhysics.setParametr(block.physicId, 'velocity', 0);
4494                                                                }
4495                                                                return block;
4496                                                            });
4497                                                            _this4.hoverInfo = {
4498                                                                pendings: 1
4499                                                            };
4500                                                        }
4501                                                    }
4502                                                    res.then(function (block) {
4503                                                        if (_this4.hoverInfo && _this4.hoverInfo.pendings < 1) {
4504                                                            block = undefined;
4505                                                            delete _this4.hoverInfo;
4506                                                        }
4507                                                        if (block) {
4508                                                            _this4.pageManager.turnOffEvents();
4509                                                            var p = block.getProps();
4510                                                            block.force = _this4.sheetPhysics.getTargetForceClb(p.mass * block.getSize(), i ? Math.PI - hoverAngle : hoverAngle);
4511                                                            block.cornerForce = function () {
4512                                                                return (i ? -1 : 1) * _SheetPhysics2.default.hoverCornerForceClb();
4513                                                            };
4514                                                            _this4.sheetPhysics.setParametr(block.physicId, 'angle', i ? Math.PI - 0.5 * hoverAngle : 0.5 * hoverAngle);
4515                                                            _this4.hoverInfo = {
4516                                                                n: n,
4517                                                                block: block
4518                                                            };
4519                                                            _this4.update(1 / 30);
4520                                                        }
4521                                                    });
4522                                                })();
4523                                            }
4524                                        }
4525                                    } else if (_this4.hoverInfo && e.type === 'mouseout') {
4526                                        if (_this4.hoverInfo.pendings !== undefined) {
4527                                            --_this4.hoverInfo.pendings;
4528                                        } else if (n === _this4.hoverInfo.n) {
4529                                            _this4.clearHoverInfo();
4530                                        }
4531                                    } else if (e.type === 'mousedown') {
4532                                        _this4.cornerClickData = {
4533                                            x: e.pageX,
4534                                            y: e.pageY
4535                                        };
4536                                    } else if (e.type === 'click') {
4537                                        if (Math.sqrt(Math.pow(_this4.cornerClickData.x - e.pageX, 2) + Math.pow(_this4.cornerClickData.y - e.pageY, 2)) < 5) {
4538                                            var hover = _this4.getBlockByPage(n);
4539                                            if (hover.physicId) {
4540                                                var id = hover.physicId,
4541                                                    props = hover.getProps();
4542                                                _this4.sheetPhysics.setParametr(id, 'velocity', (i ? -1 : 1) * props.startVelocity);
4543                                            }
4544                                        }
4545                                        delete _this4.cornerClickData;
4546                                    }
4547                                })();
4548                            }
4549                        };
4550
4551                        Book.prototype.addSheetBlock = function addSheetBlock(p, block) {
4552                            this.sheetBlocks.splice(p, 0, block);
4553                            this.subscribeSheetBlock(block, 2);
4554                            this.threeSheetBlocks.add(block.three);
4555                        };
4556
4557                        Book.prototype.subscribeSheetBlock = function subscribeSheetBlock(block, offset) {
4558                            var _this5 = this;
4559
4560                            var eventConverter = new _CustomEventConverter2.default(this.visual.wnd, this.visual.doc, _CircleTarget2.default.test),
4561                                r = 0.15,
4562                                target = new _CircleTarget2.default(1 - 0.5 * r, 
45620.5 * r, r);
4563                            target.block = block;
4564                            target.callback = this.cornerCallback.bind(this);
4565                            eventConverter.addCustom(target);
4566                            block.cornerTarget = target;
4567                            block.three.userData.mouseCallback = function (e, data) {
4568                                var i = data.face.materialIndex;
4569                                if (i < 2) {
4570                                    var n = i === 0 ? offset + 2 * block.p.first : offset + 2 * block.p.last - 1;
4571                                    eventConverter.convert(e, { x: i === 0 ? data.uv.x : 1 - data.uv.x, y: data.uv.y, i: i, n: n });
4572                                    _this5.pageManager.transferEventToTexture(n, e, data);
4573                                }
4574                            };
4575                            block.three.userData.touchCallback = function (e, data) {
4576                                var i = data.face.materialIndex;
4577                                if (i < 2) {
4578                                    var n = i === 0 ? offset + 2 * block.p.first : offset + 2 * block.p.last - 1;
4579                                    _this5.pageManager.transferEventToTexture(n, e, data);
4580                                }
4581                            };
4582                            this.visual.drag.addThree(block.three);
4583                            this.visual.mouseEvents.addThree(block.three);
4584                            this.visual.touchEvents.addThree(block.three);
4585                        };
4586
4587                        Book.prototype.removeSheetBlock = function removeSheetBlock(block) {
4588                            this.visual.mouseEvents.removeThree(block.three);
4589                            this.visual.touchEvents.removeThree(block.three);
4590                            this.visual.drag.removeThree(block.three);
4591                            this.threeSheetBlocks.remove(block.three);
4592                            block.dispose();
4593                        };
4594
4595                        Book.prototype.removeSheetBlocks = function removeSheetBlocks(first, size) {
4596                            var blocks = this.sheetBlocks.splice(first, size);
4597                            for (var _iterator4 = blocks, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
4598                                var _ref4;
4599
4600                                if (_isArray4) {
4601                                    if (_i4 >= _iterator4.length) break;
4602                                    _ref4 = _iterator4[_i4++];
4603                                } else {
4604                                    _i4 = _iterator4.next();
4605                                    if (_i4.done) break;
4606                                    _ref4 = _i4.value;
4607                                }
4608
4609                                var block = _ref4;
4610
4611                                this.removeSheetBlock(block);
4612                            }
4613                        };
4614
4615                        Book.prototype.setTexture = function setTexture(material, n) {
4616                            this.pageManager.setTexture(material, n);
4617                        };
4618
4619                        Book.prototype.setPageTexture = function setPageTexture(material, n) {
4620                            this.setTexture(material, n + 2);
4621                        };
4622
4623                        Book.prototype.setLeftCoverTexture = function setLeftCoverTexture(material, n) {
4624                            this.setTexture(material, n);
4625                        };
4626
4627                        Book.prototype.setRightCoverTexture = function setRightCoverTexture(material, n) {
4628                            this.setTexture(material, n + 2 * (this.p.sheets + 1));
4629                        };
4630
4631                        Book.finishAnimationClb = function finishAnimationClb(angle) {
4632                            this.block.set(this.book.getClosedBlockAngle(angle).closedAngle, 'closed', 0);
4633                            var i = this.book.sheetBlocks.indexOf(this.block);
4634                            if (~i) {
4635                                if (angle === 0) {
4636                                    this.book.mergeSheetBlocks(i, this.book.sheetBlocks.length - i);
4637                                } else {
4638                                    this.book.mergeSheetBlocks(0, i + 1);
4639                                }
4640                            }
4641                        };
4642
4643                        Book.prototype.calcBlockForce = function calcBlockForce(block, object, angle, velocity, cornerHeight) {
4644                            return block.force ? block.force(object, angle, velocity, cornerHeight) : 0;
4645                        };
4646
4647                        Book.prototype.calcBlockCornerForce = function calcBlockCornerForce(block, object, angle, velocity, cornerHeight) {
4648                            return block.cornerForce ? block.cornerForce(object, angle, velocity, cornerHeight) : 0;
4649                        };
4650
4651                        Book.prototype.notifyBeforeAnimation = function notifyBeforeAnimation() {
4652                            var res = void 0;
4653                            if (this.animationNotification) {
4654                                res = Promise.reject();
4655                            } else {
4656                                this.animationNotification = true;
4657                                this.dispatchEvent({
4658                                    type: 'beforeAnimation'
4659                                });
4660                                res = this.layerManager.hide();
4661                            }
4662                            return res;
4663                        };
4664
4665                        Book.prototype.notifyAfterAnimation = function notifyAfterAnimation() {
4666                            if (this.animationNotification) {
4667                                delete this.animationNotification;
4668                                this.layerManager.show();
4669                                this.dispatchEvent({
4670                                    type: 'afterAnimation'
4671                                });
4672                            }
4673                        };
4674
4675                        Book.prototype.connectPhysics = function connectPhysics(block, mass, angle, velocity, flexibility, coverHeight, simulateClb, removeClb, progressClb) {
4676                            var _this6 = this;
4677
4678                            var type = function type() {
4679                                return _this6.hoverInfo ? 'hover' : _this6.dragInfo ? 'drag' : 'free';
4680                            },
4681                                res = this.sheetPhysics.getSize() ? Promise.resolve() : this.notifyBeforeAnimation();
4682                            return res.then(function () {
4683                                block.physicId = _this6.sheetPhysics.addObject(mass, angle, velocity, flexibility, coverHeight, function (angl, ch) {
4684                                    simulateClb(angl, ch);
4685                                    progressClb(block, Math.abs(angle - angl) / Math.PI, 'process', type());
4686                                }, function (angl, ch) {
4687                                    removeClb(angl, ch);
4688                                    delete block.physicId;
4689                                    progressClb(block, Math.abs(angle - angl) / Math.PI, 'finish', type());
4690                                    Promise.resolve().then(function () {
4691                                        if (!_this6.sheetPhysics.getSize()) {
4692                                            _this6.notifyAfterAnimation();
4693                                        }
4694                                    });
4695                                }, function (object, angle, velocity, cornerHeight) {
4696                                    return _this6.calcBlockForce(block, object, angle, velocity, cornerHeight);
4697                                }, function (object, angle, velocity, cornerHeight) {
4698                                    return _this6.calcBlockCornerForce(block, object, angle, velocity, cornerHeight);
4699                                });
4700                                progressClb(block, 0, 'init', type());
4701                                return block;
4702                            }).catch(function () {
4703                                return undefined;
4704                            });
4705                        };
4706
4707                        Book.prototype.update = function update(dt) {
4708                            var _this7 = this;
4709
4710                            this.lastMousePos.t += dt;
4711                            if (this.isProcessing() && this.lastMousePos.pageX !== undefined && this.lastMousePos.t - (this.lastMousePos.lastT || 0) > 0.25 && !this.hoverInfo && !this.dragInfo) {
4712                                this.lastMousePos.lastT = this.lastMousePos.t;
4713                                Promise.resolve().then(function () {
4714                                    (0, _libs.$)(_this7.visual.element).trigger(_libs.$.Event('mousemove', _this7.lastMousePos));
4715                                });
4716                            }
4717                            this.sheetPhysics.simulate(dt);
4718                        };
4719
4720                        Book.prototype.splitSheetBlock = function splitSheetBlock(i, leftSize) {
4721                            var block = this.sheetBlocks[i];
4722                            if (block && leftSize < block.getSize()) {
4723                                var newBlock = new _SheetBlock2.default(this.visual, _extends({}, this.p, { setTexture: this.setPageTexture.bind(this) }), block.p.first, block.p.first + leftSize, block.angle, block.state);
4724                                block.set(block.angle, block.state, block.corner.height, block.p.first + leftSize, block.p.last);
4725                                this.addSheetBlock(i, newBlock);
4726                                return [newBlock, block];
4727                            }
4728                        };
4729
4730                        Book.prototype.mergeSheetBlocks = function mergeSheetBlocks(first, size) {
4731                            if (first < this.sheetBlocks.length) {
4732                                size = Math.min(this.sheetBlocks.length - first, size);
4733                                var firstBlock = this.sheetBlocks[first],
4734                                    lastBlock = this.sheetBlocks[first + size - 1];
4735                                firstBlock.set(firstBlock.angle, firstBlock.state, firstBlock.corner.height, firstBlock.p.first, lastBlock.p.last);
4736                                this.removeSheetBlocks(first + 1, size - 1);
4737                            }
4738                        };
4739
4740                        Book.prototype.setSheetBlocks = function setSheetBlocks(angle, state) {
4741                            if (state === 'closed') {
4742                                this.closedAngle = angle;
4743                            }
4744                            this.sheetBlocks.forEach(function (s) {
4745                                if (!s.physicId) {
4746                                    s.set(angle, state);
4747                                }
4748                            });
4749                        };
4750
4751                        Book.prototype.set = function set(angle) {
4752                            var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4753
4754                            this.angle = angle;
4755                            var PI = Math.PI;
4756                            if (angle < PI / 4) {
4757                                this.binder.set(0);
4758
4759                                this.binder.setLeft(-PI / 2 + 2 * angle);
4760                                this.leftCover.set(PI / 2, 'opened', height);
4761
4762                                this.setSheetBlocks(0, 'closed');
4763
4764                                this.binder.setRight(0);
4765                                this.rightCover.set(0, 'closed', 0);
4766                            } else if (angle < 2 * PI / 4) {
4767                                var a = 2 * (angle - PI / 4);
4768                                this.binder.set(a);
4769
4770                                this.binder.setLeft(-a);
4771                                this.leftCover.set(PI / 2 + a, 'opened', height);
4772
4773                                this.setSheetBlocks(a, 'closed');
4774
4775                                this.binder.setRight(-a);
4776                                this.rightCover.set(a, 'closed', 0);
4777                            } else if (angle < 3 * PI / 4) {
4778                                var _a = 2 * (angle - PI / 2);
4779                                this.binder.set(PI / 2);
4780
4781                                this.binder.setLeft(-PI / 2);
4782                                this.leftCover.set(PI, 'opened', 0);
4783
4784                                this.binder.setRight(-PI / 2);
4785                                this.rightCover.set(_a, 'opened', height);
4786                            } else if (angle < 4 * PI / 4) {
4787                                var _a2 = 2 * (angle - 3 * PI / 4) + PI / 2;
4788                                this.binder.set(_a2);
4789
4790                                this.binder.setLeft(-_a2);
4791                                this.leftCover.set(_a2, 'closed', 0);
4792
4793                                this.setSheetBlocks(_a2, 'closed');
4794
4795                                this.binder.setRight(-PI / 2);
4796                                this.rightCover.set(PI / 2, 'opened', height);
4797                            } else if (angle < 5 * PI / 4) {
4798                                this.binder.set(PI);
4799
4800                                this.binder.setLeft(-PI);
4801                                this.leftCover.set(PI, 'closed', 0);
4802
4803                                this.setSheetBlocks(PI, 'closed');
4804
4805                                this.binder.setRight(-PI / 2 - 2 * (angle - PI));
4806                                this.rightCover.set(PI / 2, 'opened', height);
4807                            } else if (angle < 6 * PI / 4) {
4808                                var _a3 = 2 * (angle - 5 * PI / 4);
4809                                this.binder.set(PI - _a3);
4810
4811                                this.binder.setLeft(-PI + _a3);
4812                                this.leftCover.set(PI - _a3, 'closed', 0);
4813
4814                                this.setSheetBlocks(PI - _a3, 'closed');
4815
4816                                this.binder.setRight(-PI + _a3);
4817                                this.rightCover.set(PI / 2 - _a3, 'opened', height);
4818                            } else if (angle < 7 * PI / 4) {
4819                                var _a4 = 2 * (angle - 6 * PI / 4);
4820                                this.binder.set(PI / 2);
4821
4822                                this.binder.setLeft(-PI / 2);
4823                                this.leftCover.set(PI - _a4, 'opened', height);
4824
4825                                this.binder.setRight(-PI / 2);
4826                                this.rightCover.set(0, 'opened', 0);
4827                            } else if (angle < 8 * PI / 4) {
4828                                var _a5 = 2 * (angle - 7 * PI / 4);
4829                                this.binder.set(PI / 2 - _a5);
4830
4831                                this.binder.setLeft(-PI / 2);
4832                                this.leftCover.set(PI / 2, 'opened', height);
4833
4834                                this.setSheetBlocks(PI / 2 - _a5, 'closed');
4835
4836                                this.binder.setRight(-PI / 2 + _a5);
4837                                this.rightCover.set(PI / 2 - _a5, 'closed', 0);
4838                            }
4839                        };
4840
4841                        Book.createSideTexture = function createSideTexture(color) {
4842                            var jC = (0, _libs.$)('<canvas width="8" height="8"></canvas>');
4843                            var ctx = jC[0].getContext('2d');
4844                            ctx.beginPath();
4845                            ctx.fillStyle = _GraphUtils2.default.color2Rgba(color, 1);
4846                            ctx.rect(0, 0, 8, 7);
4847                            ctx.fill();
4848                            ctx.beginPath();
4849                            ctx.fillStyle = _GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(color, 0.5), 1);
4850                            ctx.rect(0, 7, 8, 1);
4851                            ctx.fill();
4852                            return jC[0];
4853                        };
4854
4855                        Book.prepareProps = function prepareProps(props) {
4856                            return Book.calcProps(Book.mergeProps((0, _book.props)(), props));
4857                        };
4858
4859                        Book.mergeProps = function mergeProps(first, second) {
4860                            second = second || {};
4861                            return _extends({}, first, second, {
4862                                sheet: _extends({}, first.sheet, second.sheet),
4863                                cover: _extends({}, first.cover, second.cover),
4864                                page: _extends({}, first.page, second.page),
4865                                cssLayerProps: _extends({}, first.cssLayerProps, second.cssLayerProps)
4866                            });
4867                        };
4868
4869                        Book.calcProps = function calcProps(props) {
4870                            var p = _extends({}, props, {
4871                                sheet: _extends({}, props.sheet),
4872                                cover: _extends({}, props.sheet, props.cover),
4873                                page: _extends({}, props.sheet, props.page),
4874                                cssLayerProps: _extends({}, props.cssLayerProps, {
4875                                    $: _libs.$
4876                                })
4877                            }),
4878                                scale = 10,
4879                                height = scale * p.height,
4880                                width = scale * p.width,
4881                                flipProgressClb = function flipProgressClb() {
4882                                    return undefined;
4883                                },
4884                                sheet = {
4885                                    sideTexture: p.sheet.sideTexture || Book.createSideTexture(p.sheet.color)
4886                                },
4887                                cover = _extends({}, sheet, p.cover, {
4888                                    depth: scale * p.cover.depth,
4889                                    width: width,
4890                                    height: height,
4891                                    padding: scale * p.cover.padding
4892                                }),
4893                                page = _extends({}, sheet, p.page, {
4894                                    depth: scale * p.page.depth,
4895                                    width: cover.width - cover.padding,
4896                                    height: cover.height - 2 * cover.padding
4897                                }),
4898                                marker = {
4899                                    use: false,
4900                                    color: 0XFF0000,
4901                                    size: scale * 0.001
4902                                };
4903                            if (cover.color !== sheet.color && !p.cover.sideTexture) {
4904                                cover.sideTexture = Book.createSideTexture(cover.color);
4905                            }
4906                            if (page.color !== sheet.color && !p.page.sideTexture) {
4907                                page.sideTexture = Book.createSideTexture(page.color);
4908                            }
4909                            return _extends({}, p, { scale: scale, height: height, width: width, flipProgressClb: flipProgressClb, cover: cover, page: page, marker: marker });
4910                        };
4911
4912                        return Book;
4913                    }(_libs.THREE.EventDispatcher);
4914
4915                    exports.default = Book;
4916
4917                    /***/
4918                },
4919/* 27 */
4920/***/function (module, exports, __webpack_require__) {
4921
4922                    "use strict";
4923                    'use strict';
4924
4925                    exports.__esModule = true;
4926
4927                    var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
4928                        return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
4929                    } : function (obj) {
4930                        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
4931                    };
4932
4933                    var _extends = Object.assign || function (target) {
4934                        for (var i = 1; i < arguments.length; i++) {
4935                            var source = arguments[i]; for (var key in source) {
4936                                if (Object.prototype.hasOwnProperty.call(source, key)) {
4937                                    target[key] = source[key];
4938                                }
4939                            }
4940                        } return target;
4941                    };
4942
4943                    var _libs = __webpack_require__(1);
4944
4945                    var _Controller2 = __webpack_require__(15);
4946
4947                    var _Controller3 = _interopRequireDefault(_Controller2);
4948
4949                    var _bookController = __webpack_require__(42);
4950
4951                    var _EventsToActions = __webpack_require__(49);
4952
4953                    var _EventsToActions2 = _interopRequireDefault(_EventsToActions);
4954
4955                    var _stats = __webpack_require__(70);
4956
4957                    var _stats2 = _interopRequireDefault(_stats);
4958
4959                    var _Object3DWatcher = __webpack_require__(55);
4960
4961                    var _Object3DWatcher2 = _interopRequireDefault(_Object3DWatcher);
4962
4963                    var _FullScreen = __webpack_require__(50);
4964
4965                    var _FullScreen2 = _interopRequireDefault(_FullScreen);
4966
4967                    function _interopRequireDefault(obj) {
4968                        return obj && obj.__esModule ? obj : { default: obj };
4969                    }
4970
4971                    function _classCallCheck(instance, Constructor) {
4972                        if (!(instance instanceof Constructor)) {
4973                            throw new TypeError("Cannot call a class as a function");
4974                        }
4975                    }
4976
4977                    function _possibleConstructorReturn(self, call) {
4978                        if (!self) {
4979                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4980                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
4981                    }
4982
4983                    function _inherits(subClass, superClass) {
4984                        if (typeof superClass !== "function" && superClass !== null) {
4985                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
4986                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
4986onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
4987                    }
4988
4989                    var BookController = function (_Controller) {
4990                        _inherits(BookController, _Controller);
4991
4992                        function BookController(book, view, props) {
4993                            _classCallCheck(this, BookController);
4994
4995                            var _this = _possibleConstructorReturn(this, _Controller.call(this));
4996
4997                            _this.navigationControls = true;
4998                            _this.book = book;
4999                            _this.visual = book.visual;
5000                            _this.p = BookController.prepareProps(props);
5001                            _this.p.rtl = book.p.rtl;
5002                            _this.devicePixelRatio = _this.visual.wnd.devicePixelRatio || 1;
5003
5004                            _this.orbit = book.visual.getOrbit();
5005                            book.setFlipProgressClb(_this.updateViewIfState.bind(_this));
5006                            _this.view = view;
5007                            _this.bindActions();
5008
5009                            _this.state = {
5010                                smartPan: !_this.actions['cmdSmartPan'].active,
5011                                singlePage: _this.actions['cmdSinglePage'].active || _this.actions['cmdSinglePage'].activeForMobile && _this.devicePixelRatio > 1,
5012                                stats: _this.actions['cmdStats'].active,
5013                                lighting: _this.p.lighting.default,
5014                                activeSide: 1
5015                            };
5016
5017                            _this.boxs = [new _libs.THREE.Box3(), new _libs.THREE.Box3()];
5018                            _this.bookWatcher = new _Object3DWatcher2.default(_this.visual, function () {
5019                                if (_this.state.singlePage) {
5020                                    if (_this.state.activeSide) {
5021                                        _this.boxs[0].setFromObject(book.rightCover.three);
5022                                    } else {
5023                                        _this.boxs[0].setFromObject(book.leftCover.three);
5024                                    }
5025                                } else {
5026                                    _this.boxs[0].setFromObject(book.leftCover.three);
5027                                    _this.boxs[1].setFromObject(book.rightCover.three);
5028                                    _this.boxs[0].union(_this.boxs[1]);
5029                                }
5030                                return _this.boxs[0];
5031                            });
5032                            _this.bookWatcher.scale = _this.p.scale.default;
5033                            _this.book.setZoom(_this.bookWatcher.scale, _this.state.singlePage);
5034
5035                            _this.Stats = new _stats2.default();
5036                            _this.Stats.domElement.style.position = 'absolute';
5037                            _this.Stats.domElement.style.top = '0px';
5038
5039                            _this.visual.setExtraLighting(_this.state.lighting);
5040                            _this.binds = {
5041                                onScreenModeChanged: _this.onScreenModeChanged.bind(_this),
5042                                stats: _this.Stats.update.bind(_this.Stats),
5043                                onUpdateView: _this.updateView.bind(_this)
5044                            };
5045                            _FullScreen2.default.addEventListener(_this.view.getParentContainer().ownerDocument, _this.binds.onScreenModeChanged);
5046
5047                            _this.cmdSmartPan();
5048
5049                            if (_this.view.templateObject.appLoaded) {
5050                                Promise.resolve().then(_this.view.templateObject.appLoaded);
5051                            }
5052
5053                            _this.book.enableLoadingAnimation(_this.p.loadingAnimation.book);
5054                            if (_this.p.loadingAnimation.skin) {
5055                                _this.initLoadingAnimation();
5056                            }
5057
5058                            _this.book.enableLoadingAnimation(_this.p.loadingAnimation.book);
5059                            _this.book.setAutoResolution(_this.p.autoResolution.enabled, _this.p.autoResolution.coefficient);
5060                            return _this;
5061                        }
5062
5063                        BookController.prototype.dispose = function dispose() {
5064                            _FullScreen2.default.removeEventListener(this.view.getParentContainer().ownerDocument, this.binds.onScreenMo
5064deChanged);
5065                            delete this.book;
5066                            delete this.view;
5067                            delete this.visual;
5068                        };
5069
5070                        BookController.prototype.initLoadingAnimation = function initLoadingAnimation() {
5071                            var _this2 = this;
5072
5073                            var handler = function handler() {
5074                                var pages = _this2.book.getTopPages();
5075                                var visible = false;
5076                                for (var _iterator = pages, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
5077                                    var _ref;
5078
5079                                    if (_isArray) {
5080                                        if (_i >= _iterator.length) break;
5081                                        _ref = _iterator[_i++];
5082                                    } else {
5083                                        _i = _iterator.next();
5084                                        if (_i.done) break;
5085                                        _ref = _i.value;
5086                                    }
5087
5088                                    var n = _ref;
5089
5090                                    var state = _this2.book.getPageState(n);
5091                                    visible = state === undefined || state === 'loading';
5092                                    if (visible) {
5093                                        break;
5094                                    }
5095                                }
5096                                _this2.view.setState('widLoading', {
5097                                    visible: visible
5098                                });
5099                            };
5100                            this.book.addEventListener('beforeAnimation', handler);
5101                            this.book.addEventListener('afterAnimation', handler);
5102                            this.book.addEventListener('loadPage', handler);
5103                            this.book.addEventListener('loadedPage', handler);
5104                        };
5105
5106                        BookController.prototype.enableNavigation = function enableNavigation(enable) {
5107                            this.navigationControls = enable;
5108                        };
5109
5110                        BookController.prototype.setTocCtrl = function setTocCtrl(tocCtrl) {
5111                            this.tocCtrl = tocCtrl;
5112                            this.tocCtrl.onChange = this.updateView.bind(this);
5113                            this.updateView();
5114                        };
5115
5116                        BookController.prototype.setPrinter = function setPrinter(printer) {
5117                            this.printer = printer;
5118                            this.updateView();
5119                        };
5120
5121                        BookController.prototype.setSounds = function setSounds(sounds) {
5122                            this.sounds = sounds;
5123                            sounds.setEnabled(this.actions['cmdSounds'].active);
5124                            this.updateView();
5125                        };
5126
5127                        BookController.prototype.onScreenModeChanged = function onScreenModeChanged(e) {
5128                            this.updateView();
5129                        };
5130
5131                        BookController.prototype.canZoomIn = function canZoomIn() {
5132                            return !this.state.smartPan || Math.abs(this.bookWatcher.scale - this.p.scale.max) > this.p.eps;
5133                        };
5134
5135                        BookController.prototype.canZoomOut = function canZoomOut() {
5136                            return !this.state.smartPan || Math.abs(this.bookWatcher.scale - this.p.scale.min) > this.p.eps;
5137                        };
5138
5139                        BookController.prototype.canDefaultZoom = function canDefaultZoom() {
5140                            return this.state.smartPan;
5141                        };
5142
5143                        BookController.prototype.setBookZoom = function setBookZoom(scale) {
5144                            var _this3 = this;
5145
5146                            setTimeout(function () {
5147                                if (_this3.bookWatcher.scale === scale) {
5148                                    _this3.book.setZoom(scale, _this3.state.singlePage);
5149                                }
5150                            }, 1000);
5151                        };
5152
5153                        BookController.prototype.cmdZoomIn = function cmdZoomIn() {
5154                            if (this.state.smartPan) {
5155                                this.bookWatcher.scale = Math.min(this.p.scale.max, this.bookWatcher.scale + this.p.scale.delta);
5156                                this.setBookZoom(this.bookWatcher.scale);
5157                            } else {
5158                                this.orbit.zoomIn(6.6 * this.p.scale.delta / 0.32);
5159                            }
5160                            this.updateView();
5161                        };
5162
5163                        BookController.prototype.cmdZoomOut = function cmdZoomOut() {
5164                            if (this.state.smartPan) {
5165                                this.bookWatcher.scale = Math.max(this.p.scale.min, this.bookWatcher.scale - this.p.scale.delta);
5166                                this.setBookZoom(this.bookWatcher.scale);
5167                            } else {
5168                                this.orbit.zoomOut(6.6 * this.p.scale.delta / 0.32);
5169                            }
5170                            this.updateView();
5171                        };
5172
5173                        BookController.prototype.cmdDefaultZoom = function cmdDefaultZoom() {
5174                            if (this.state.smartPan) {
5175                                this.bookWatcher.scale = this.p.scale.default;
5176                                this.setBookZoom(this.bookWatcher.scale);
5177                                this.updateView();
5178                            }
5179                        };
5180
5181                        BookController.prototype.cmdToc = function cmdToc() {
5182                            if (this.tocCtrl) {
5183                                this.tocCtrl.togle();
5184                            }
5185                        };
5186
5187                        BookController.prototype.cmdFastBackward = function cmdFastBackward() {
5188                            this.startFlip(this.book.flipLeft(5));
5189                        };
5190
5191                        BookController.prototype.cmdBackward = function cmdBackward() {
5192                            var _this4 = this;
5193
5194                            if (this.state.singlePage) {
5195                                this.state.activeSide = (this.getPage() + 1) % 2;
5196                                if (this.state.activeSide) {
5197                                    this.state.activeSide = 0;
5198                                    this.updateView();
5199                                } else {
5200                                    this.startFlip(this.book.flipLeft(1)).then(function (block) {
5201                                        if (block) {
5202                                            _this4.state.activeSide = 1;
5203                                        }
5204                                    });
5205                                }
5206                            } else {
5207                                this.startFlip(this.book.flipLeft(1));
5208                            }
5209                        };
5210
5211                        BookController.prototype.cmdForward = function cmdForward() {
5212                            var _this5 = this;
5213
5214                            if (this.state.singlePage) {
5215                                this.state.activeSide = (this.getPage() + 1) % 2;
5216                                if (!this.state.activeSide) {
5217                                    this.state.activeSide = 1;
5218                                    this.updateView();
5219                                } else {
5220                                    this.startFlip(this.book.flipRight(1)).then(function (block) {
5221                                        if (block) {
5222                                            _this5.state.activeSide = 0;
5223                                        }
5224                                    });
5225                                }
5226                            } else {
5227                                this.startFlip(this.book.flipRight(1));
5228                            }
5229                        };
5230
5231                        BookController.prototype.cmdFastForward = function cmdFastForward() {
5232                            this.startFlip(this.book.flipRight(5));
5233                        };
5234
5235                        BookController.prototype.cmdSave = function cmdSave() {
5236                            window.open(this.p.downloadURL, '_blank');
5237                        };
5238
5239                        BookController.prototype.cmdPrint = function cmdPrint() {
5240                            this.printer.print();
5241                        };
5242
5243                        BookController.prototype.cmdFullScreen = function cmdFullScreen() {
5244                            if (!_FullScreen2.default.activated()) {
5245                                _FullScreen2.default.request(this.view.getParentContainer());
5246                            } else {
5247                                _FullScreen2.default.cancel();
5248                            }
5249                        };
5250
5251                        BookController.prototype.cmdSmartPan = function cmdSmartPan() {
5252                            this.state.smartPan = !this.state.smartPan;
5253                            if (this.state.smartPan) {
5254                                this.orbit.minAzimuthAngle = 0;
5255                                this.orbit.maxAzimuthAngle = 0;
5256                                this.orbit.minPolarAngle = 0;
5257                                this.orbit.maxPolarAngle = Math.PI / 4;
5258                                this.bookWatcher.enabled = true;
5259                            } else {
5260                                this.orbit.minAzimuthAngle = -Infinity;
5261                                this.orbit.maxAzimuthAngle = Infinity;
5262                                this.orbit.minPolarAngle = 0;
5263                                this.orbit.maxPolarAngle = Math.PI;
5264                                this.bookWatcher.enabled = false;
5265                            }
5266                            this.updateView();
5267                        };
5268
5269                        BookController.prototype.cmdSinglePage = function cmdSinglePage() {
5270                            this.state.singlePage = !this.state.singlePage;
5271                            this.setBookZoom(this.bookWatcher.scale);
5272                            this.updateView();
5273                        };
5274
5275                        BookController.prototype.cmdSounds = function cmdSounds() {
5276                            if (this.sounds) {
5277                                this.sounds.togle();
5278                            }
5279                            this.updateView();
5280                        };
5281
5282                        BookController.prototype.cmdStats = function cmdStats() {
5283                            this.state.stats = !this.state.stats;
5284                            if (this.state.stats) {
5285                                (0, _libs.$)(this.view.getContainer()).append(this.Stats.domElement);
5286                                this.visual.addRenderCallback(this.binds.stats);
5287                            } else {
5288                                (0, _libs.$)(this.view.getContainer()).find(this.Stats.domElement).remove();
5289                                this.visual.removeRenderCallback(this.binds.stats);
5290                            }
5291                            this.updateView();
5292                        };
5293
5294                        BookController.prototype.cmdLightingUp = function cmdLightingUp() {
5295                            this.state.lighting = Math.min(this.state.lighting + this.p.lighting.delta, this.p.lighting.max);
5296                            this.visual.setExtraLighting(this.state.lighting);
5297                            this.updateView();
5298                        };
5299
5300                        BookController.prototype.cmdLightingDown = function cmdLightingDown() {
5301                            this.state.lighting = Math.max(this.state.lighting - this.p.lighting.delta, this.p.lighting.min);
5302                            this.visual.setExtraLighting(this.state.lighting);
5303                            this.updateView();
5304                        };
5305
5306                        BookController.prototype.goToPage = function goToPage(page) {
5307                            var _this6 = this;
5308
5309                            if (this.p.rtl) {
5310                                page = this.book.getPages() - 1 - page;
5311                            }
5312                            var pageNum = Math.max(Math.min(page, this.book.getPages() - 1), 0);
5313                            this.state.activeSide = (pageNum + 1) % 2;
5314                            var target = Math.max(Math.min(page - 1 + page % 2, this.book.getPages() - 1), 0),
5315                                current = this.book.getPage(),
5316                                flips = [],
5317                                covs = 0;;
5318                            if (target != current) {
5319                                if (current === 0) {
5320                                    flips.push(1);
5321                                    current += 1;
5322                                    ++covs;
5323                                } else if (current === this.book.getPages() - 1) {
5324                                    flips.push(-1);
5325                                    current -= 2;
5326                                    ++covs;
5327                                }
5328                                var cv = 0;
5329                                if (target === 0) {
5330                                    cv = -1;
5331                                    target += 1;
5332                                    ++covs;
5333                                } else if (target === this.book.getPages() - 1) {
5334                                    cv = 1;
5335                                    target -= 2;
5336                                    ++covs;
5337                                }
5338                                if (target - current) {
5339                                    flips.push(Math.ceil((target - current) / 2));
5340                                }
5341                                if (cv) {
5342                                    flips.push(cv);
5343                                }
5344                            }
5345
5346                            var setClb = function setClb(fl, time, clb) {
5347                                setTimeout(function () {
5348                                    if (fl < 0) {
5349                                        _this6.startFlip(_this6.book.flipLeft(-fl, clb));
5350                                    } else {
5351                                        _this6.startFlip(_this6.book.flipRight(fl, clb));
5352                                    }
5353                                }, time);
5354                            };
5355
5356                            if (covs === 2) {
5357                                setClb(flips[0], 0, function (block, progress, state) {
5358                                    if (state == 'finish' && progress == 1) {
5359                                        setClb(flips[flips.length - 1], 0);
5360                                    }
5361                                });
5362                                setClb(flips[1], 500);
5363                            } else {
5364                                var time = 0;
5365                                for (var _iterator2 = flips, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
5366                                    var _ref2;
5367
5368                                    if (_isArray2) {
5369                                        if (_i2 >= _iterator2.length) break;
5370                                        _ref2 = _iterator2[_i2++];
5371                                    } else {
5372                                        _i2 = _iterator2.next();
5373                                        if (_i2.done) break;
5374                                        _ref2 = _i2.value;
5375                                    }
5376
5377                                    var fl = _ref2;
5378
5379                                    setClb(fl, time);
5380                                    time += 250;
5381                                }
5382                            }
5383                        };
5384
5385                        BookController.prototype.startFlip = function startFlip(flipRes) {
5386                            var _this7 = this;
5387
5388                            return flipRes ? flipRes.then(function (block) {
5389                                if (block) {
5390                                    _this7.dispatchAsync({
5391                                        type: 'startFlip'
5392                                    });
5393                                }
5394                                return block;
5395                            }) : Promise.resolve(undefined);
5396                        };
5397
5398                        BookController.prototype.endFlip = function endFlip(block) {
5399                            this.dispatchAsync({
5400                                type: 'endFlip'
5401                            });
5402                            return block;
5403                        };
5404
5405                        BookController.prototype.getPage = function getPage() {
5406                            var page = this.book.getPage();
5407                            return page ? Math.min(this.book.getPage() + this.state.activeSide, this.book.getPages() - 1) : 0;
5408                        };
5409
5410                        BookController.prototype.getPageForGUI = function getPageForGUI() {
5411                            var n = (this.state.singlePage ? this.getPage() : this.book.getPage()) + 1;
5412                            if (this.p.rtl) {
5413                                n = this.book.getPages() - n + 1;
5414                            }
5415                            return n;
5416                        };
5417
5418                        BookController.prototype.inpPage = function inpPage(e, data) {
5419                            this.goToPage(data - 1);
5420                        };
5421
5422                        BookController.prototype.updateViewIfState = function updateViewIfState(block, progress, state, type) {
5423                            if (state === 'init' || state === 'finish') {
5424                                setTimeout(this.updateView.bind(this), 100);
5425                            }
5426                            if (state === 'finish') {
5427                                this.endFlip(block);
5428                            }
5429                        };
5430
5431                        BookController.prototype.updateViewState = function updateViewState() {
5432                            this.viewState = {
5433                                'cmdZoomIn': {
5434                                    enable: this.canZoomIn(),
5435                                    visible: this.actions['cmdZoomIn'].enabled,
5436                                    active: false
5437                                },
5438                                'cmdZoomOut': {
5439                                    enable: this.canZoomOut(),
5440                                    visible: this.actions['cmdZoomOut'].enabled,
5441                                    active: false
5442                                },
5443                                'cmdDefaultZoom': {
5444                                    enable: this.canDefaultZoom(),
5445                                    visible: this.actions['cmdDefaultZoom'].enabled,
5446                                    active: this.canDefaultZoom() && Math.abs(this.bookWatcher.scale - this.p.scale.default) < this.p.eps
5447                                },
5448                                'cmdToc': {
5449                                    enable: !!this.tocCtrl,
5450                                    visible: this.actions['cmdToc'].enabled && this.tocCtrl,
5451                                    active: this.tocCtrl && this.tocCtrl.visible
5452                                },
5453                                'inpPages': {
5454                                    visible: true,
5455                                    value: this.book.getPages()
5456                                },
5457                                'inpPage': {
5458                                    visible: true,
5459                                    enable: !this.book.isProcessing() && this.navigationControls,
5460                                    value: this.getPageForGUI()
5461                                },
5462                                'cmdSave': {
5463                                    enable: true,
5464                                    visible: this.actions['cmdSave'].enabled && !!this.p.downloadURL,
5465                                    active: false
5466                                },
5467                                'cmdPrint': {
5468                                    enable: true,
5469                                    visible: this.actions['cmdPrint'].enabled && !!this.printer,
5470                                    active: false
5471                                },
5472                                'cmdFullScreen': {
5473                                    enable: _FullScreen2.default.available(),
5474                                    visible: this.actions['cmdFullScreen'].enabled,
5475                                    active: _FullScreen2.default.available() && _FullScreen2.default.activated()
5476                                },
5477                                'widSettings': {
5478                                    enable: true,
5479                                    visible: this.actions['widSettings'].enabled,
5480                                    active: false
5481                                },
5482                                'cmdSmartPan': {
5483                                    enable: true,
5484                                    visible: this.actions['cmdSmartPan'].enabled,
5485                                    active: this.state.smartPan
5486                                },
5487                                'cmdSinglePage': {
5488                                    enable: true,
5489                                    visible: this.actions['cmdSinglePage'].enabled,
5490                                    active: this.state.singlePage
5491                                },
5492                                'cmdSounds': {
5493                                    enable: true,
5494                                    visible: this.actions['cmdSounds'].enabled && !!this.sounds,
5495                                    active: !!this.sounds && this.sounds.enabled
5496                                },
5497                                'cmdStats': {
5498                                    enable: true,
5499                                    visible: this.actions['cmdStats'].enabled,
5500                                    active: this.state.stats
5501                                },
5502                                'cmdLightingUp': {
5503                                    enable: Math.abs(this.state.lighting - this.p.lighting.max) > this.p.eps,
5504                                    visible: this.actions['cmdLightingUp'].enabled,
5505                                    active: false
5506                                },
5507                                'cmdLightingDown': {
5508                                    enable: Math.abs(this.state.lighting - this.p.lighting.min) > this.p.eps,
5509                                    visible: this.actions['cmdLightingDown'].enabled,
5510                                    active: false
5511                                }
5512                            };
5513
5514                            var left = this.book.getLeftFlipping(),
5515                                right = this.book.getRightFlipping();
5516                            var flippersEnable = {
5517                                cmdFastBackward: !!left && this.navigationControls,
5518                                cmdBackward: !!left && this.navigationControls,
5519                                cmdForward: !!right && this.navigationControls,
5520                                cmdFastForward: !!right && this.navigationControls
5521                            };
5522                            for (var _iterator3 = Object.keys(flippersEnable), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
5523                                var _ref3;
5524
5525                                if (_isArray3) {
5526                                    if (_i3 >= _iterator3.length) break;
5527                                    _ref3 = _iterator3[_i3++];
5528                                } else {
5529                                    _i3 = _iterator3.next();
5530                                    if (_i3.done) break;
5531                                    _ref3 = _i3.value;
5532                                }
5533
5534                                var name = _ref3;
5535
5536                                this.viewState[name] = {
5537                                    enable: flippersEnable[name],
5538                                    visible: this.actions[name].enabled,
5539                                    active: false
5540                                };
5541                            };
5542                        };
5543
5544                        BookController.prototype.updateView = function updateView() {
5545                            if (this.view) {
5546                                this.updateViewState();
5547                                for (var _iterator4 = Object.keys(this.viewState), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
5548                                    var _ref4;
5549
5550                                    if (_isArray4) {
5551                                        if (_i4 >= _iterator4.length) break;
5552                                        _ref4 = _iterator4[_i4++];
5553                                    } else {
5554                                        _i4 = _iterator4.next();
5555                                        if (_i4.done) break;
5556                                        _ref4 = _i4.value;
5557                                    }
5558
5559                                    var name = _ref4;
5560
5561                                    this.view.setState(name, this.viewState[name]);
5562                                }
5563                            }
5564                        };
5565
5566                        BookController.prototype.getActions = function getActions() {
5567                            var _this8 = this;
5568
5569                            var isSwipping = function isSwipping(name) {
5570                                return _this8.actions.touchCmdSwipe.enabled && _this8.actions.touchCmdSwipe.code === _this8.actio
5570ns[name].code && _this8.state.smartPan && _this8.bookWatcher.scale <= 1;
5571                            },
5572                                cmds = {};
5573
5574                            var _loop = function _loop(name) {
5575                                if (name.indexOf('cmd') === 0) {
5576                                    cmds[name] = {
5577                                        activate: function activate() {
5578                                            if (_this8.viewState && _this8.viewState[name].enable) {
5579                                                _this8[name].apply(_this8, arguments);
5580                                            }
5581                                        }
5582                                    };
5583                                }
5584                            };
5585
5586                            for (var name in this) {
5587                                _loop(name);
5588                            }
5589
5590                            return _extends({}, cmds, {
5591                                cmdPanLeft: {
5592                                    activate: function activate(e) {
5593                                        return _this8.orbit.actions.pan(e, {
5594                                            state: 'move',
5595                                            dx: -_this8.p.pan.speed,
5596                                            dy: 0
5597                                        });
5598                                    }
5599                                },
5600                                cmdPanRight: {
5601                                    activate: function activate(e) {
5602                                        return _this8.orbit.actions.pan(e, {
5603                                            state: 'move',
5604                                            dx: _this8.p.pan.speed,
5605                                            dy: 0
5606                                        });
5607                                    }
5608                                },
5609                                cmdPanUp: {
5610                                    activate: function activate(e) {
5611                                        return _this8.orbit.actions.pan(e, {
5612                                            state: 'move',
5613                                            dx: 0,
5614                                            dy: -_this8.p.pan.speed
5615                                        });
5616                                    }
5617                                },
5618                                cmdPanDown: {
5619                                    activate: function activate(e) {
5620                                        return _this8.orbit.actions.pan(e, {
5621                                            state: 'move',
5622                                            dx: 0,
5623                                            dy: _this8.p.pan.speed
5624                                        });
5625                                    }
5626                                },
5627                                mouseCmdRotate: {
5628                                    activate: this.orbit.actions.rotate
5629                                },
5630                                mouseCmdDragZoom: {
5631                                    activate: function activate(e, data) {
5632                                        if (data.dy > 0) {
5633                                            _this8.cmdZoomOut();
5634                                        } else if (data.dy < 0) {
5635                                            _this8.cmdZoomIn();
5636                                        }
5637                                    }
5638                                },
5639                                mouseCmdPan: {
5640                                    activate: this.orbit.actions.pan
5641                                },
5642                                mouseCmdWheelZoom: {
5643                                    activate: function activate(e) {
5644                                        e.preventDefault();
5645                                        if (e.deltaY < 0) {
5646                                            _this8.cmdZoomOut();
5647                                        } else if (e.deltaY > 0) {
5648                                            _this8.cmdZoomIn();
5649                                        }
5650                                    }
5651                                },
5652                                touchCmdRotate: {
5653                                    activate: function activate(e, data) {
5654                                        if (!isSwipping('touchCmdRotate')) {
5655                                            e.preventDefault();
5656                                            _this8.orbit.actions.rotate(e, data);
5657                                        }
5658                                    }
5659                                },
5660                                touchCmdZoom: {
5661                                    activate: function activate(e, data) {
5662                                        if (!isSwipping('touchCmdZoom')) {
5663                                            e.preventDefault();
5664                                            if (data.dy > 0) {
5665                                                _this8.cmdZoomOut();
5666                                            } else if (data.dy < 0) {
5667                                                _this8.cmdZoomIn();
5668                                            }
5669                                        }
5670                                    }
5671                                },
5672                                touchCmdPan: {
5673                                    activate: function activate(e, data) {
5674                                        if (!isSwipping('touchCmdPan')) {
5675                                            e.preventDefault();
5676                                            _this8.orbit.actions.pan(e, data);
5677                                        }
5678                                    }
5679                                },
5680                                touchCmdSwipe: {
5681                                    activate: function activate(e, data) {
5682                                        if (isSwipping('touchCmdSwipe')) {
5683                                            e.preventDefault();
5684                                            if (data.state === 'start') {
5685                                                var touch = (e.touches || e.originalEvent.touches)[_this8.actions.touchCmdSwipe.code - 1];
5686                                                _this8.swipeData = {
5687                                                    handled: false,
5688                                                    x0: touch.pageX,
5689                                                    y0: touch.pageY,
5690                                                    x: touch.pageX,
5691                                                    y: touch.pageY
5692                                                };
5693                                            } else if (data.state === 'move') {
5694                                                if (!_this8.swipeData.handled) {
5695                                                    _this8.swipeData = _extends({}, _this8.swipeData, {
5696                                                        x: _this8.swipeData.x + data.dx,
5697                                                        y: _this8.swipeData.y + data.dy
5698                                                    });
5699                                                    if (Math.abs(_this8.swipeData.x0 - _this8.swipeData.x) > 100) {
5700                                                        _this8.swipeData.x0 > _this8.swipeData.x ? _this8.cmdForward() : _this8.cmdBackward();
5701                                                        _this8.swipeData.handled = true;
5702                                                    }
5703                                                }
5704                                            } else {
5705                                                delete _this8.swipeData;
5706                                            }
5707                                        }
5708                                    }
5709                                },
5710                                widSettings: {
5711                                    activate: function activate() {
5712                                        return undefined;
5713                                    }
5714                                }
5715                            });
5716                        };
5717
5718                        BookController.prototype.bindActions = function bindActions() {
5719                            this.eToA = new _EventsToActions2.default((0, _libs.$)(this.visual.element));
5720                            this.eToA.addAction(function (e) {
5721                                return e.preventDefault();
5722                            }, 'contextmenu', _EventsToActions2.default.mouseButtons.Right, 0);
5723
5724                            this.actions = this.getActions();
5725                            for (var _iterator5 = Object.keys(this.actions), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator](); ;) {
5726                                var _ref5;
5727
5728                                if (_isArray5) {
5729                                    if (_i5 >= _iterator5.length) break;
5730                                    _ref5 = _iterator5[_i5++];
5731                                } else {
5732                                    _i5 = _iterator5.next();
5733                                    if (_i5.done) break;
5734                                    _ref5 = _i5.value;
5735                                }
5736
5737                                var name = _ref5;
5738
5739                                var action = _extends({}, this.actions[name], this.p.actions[name]);
5740                                this.actions[name] = action;
5741                                if (action.enabled) {
5742                                    var flags = action.flags || 0;
5743                                    if (action.type) {
5744                                        this.eToA.addAction(action.activate, action.type, action.code, flags);
5745                                    } else if (action.code !== undefined) {
5746                                        this.eToA.addAction(action.activate, 'keydown', action.code, flags);
5747                                    }
5748                                }
5749                            }
5750                        };
5751
5752                        BookController.prepareProps = function prepareProps(props) {
5753                            return BookController.calcProps(BookController.mergeProps((0, _bookController.props)(), props));
5754                        };
5755
5756                        BookController.setActions = function setActions(props, actions) {
5757                            for (var _iterator6 = Object.keys(actions || {}), _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator](); ;) {
5758                                var _ref6;
5759
5760                                if (_isArray6) {
5761                                    if (_i6 >= _iterator6.length) break;
5762                                    _ref6 = _iterator6[_i6++];
5763                                } else {
5764                                    _i6 = _iterator6.next();
5765                                    if (_i6.done) break;
5766                                    _ref6 = _i6.value;
5767                                }
5768
5769                                var name = _ref6;
5770
5771                                props.actions[name] = _extends({}, props.actions[name], actions[name]);
5772                            }
5773                        };
5774
5775                        BookController.mergeProps = function mergeProps(first, second) {
5776                            second = second || {};
5777                            function merge(first, second) {
5778                                second = second || {};
5779                                var props = _extends({}, first, second);
5780                                for (var _iterator7 = Object.keys(first), _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator](); ;) {
5781                                    var _ref7;
5782
5783                                    if (_isArray7) {
5784                                        if (_i7 >= _iterator7.length) break;
5785                                        _ref7 = _iterator7[_i7++];
5786                                    } else {
5787                                        _i7 = _iterator7.next();
5788                                        if (_i7.done) break;
5789                                        _ref7 = _i7.value;
5790                                    }
5791
5792                                    var name = _ref7;
5793
5794                                    if (_typeof(first[name]) === 'object') {
5795                                        props[name] = merge(first[name], second[name]);
5796                                    }
5797                                }
5798                                return props;
5799                            }
5800                            var props = merge(first, second);
5801                            BookController.setActions(props, first.actions);
5802                            BookController.setActions(props, second.actions);
5803                            return props;
5804                        };
5805
5806                        BookController.calcProps = function calcProps(props) {
5807                            props.scale.delta = (props.scale.max - props.scale.min) / props.scale.levels;
5808                            props.lighting.delta = (props.lighting.max - props.lighting.min) / props.lighting.levels;
5809                            return props;
5810                        };
5811
5812                        return BookController;
5813                    }(_Controller3.default);
5814
5815                    exports.default = BookController;
5816
5817                    /***/
5818                },
5819/* 28 */
5820/***/function (module, exports, __webpack_require__) {
5821
5822                    "use strict";
5823                    'use strict';
5824
5825                    exports.__esModule = true;
5826
5827                    var _libs = __webpack_require__(1);
5828
5829                    function _classCallCheck(instance, Constructor) {
5830                        if (!(instance instanceof Constructor)) {
5831                            throw new TypeError("Cannot call a class as a function");
5832                        }
5833                    }
5834
5835                    var BookPrinter = function () {
5836                        function BookPrinter(context, book, styleSheet) {
5837                            _classCallCheck(this, BookPrinter);
5838
5839                            this.book = book;
5840                            this.styleSheet = styleSheet;
5841                            this.wnd = context.wnd;
5842                            this.doc = context.doc;
5843                            this.pageCallback = book.getPageCallback();
5844                            var test = this.pageCallback(0);
5845                            this.type = test.type;
5846                            if (this.type === 'pdf') {
5847                                this.pdfSrc = test.src.src;
5848                            }
5849                        }
5850
5851                        BookPrinter.prototype.cancel = function cancel() {
5852                            this.canceled = true;
5853                        };
5854
5855                        BookPrinter.prototype.dispose = function dispose() {
5856                            if (this.frame) {
5857                                this.frame.remove();
5858                                delete this.frame;
5859                            }
5860                        };
5861
5862                        BookPrinter.prototype.print = function print() {
5863                            var _this = this;
5864
5865                            delete this.canceled;
5866                            if (this.type === 'pdf') {
5867                                (function () {
5868                                    var printWnd = void 0,
5869                                        callManually = false;
5870                                    if (_this.useIFrame()) {
5871                                        callManually = !!_this.frame;
5872                                        if (!_this.frame) {
5873                                            _this.frame = (0, _libs.$)('<iframe src="' + _this.pdfSrc + '" style="display: none;"></iframe>').appendTo(_this.doc.body);
5874                                        }
5875                                        printWnd = _this.frame[0].contentWindow;
5876                                    } else {
5877                                        printWnd = _this.wnd.open(_this.pdfSrc);
5878                                    }
5879                                    if (callManually) {
5880                                        printWnd.print();
5881                                    } else {
5882                                        (0, _libs.$)(printWnd).on('load', function () {
5883                                            try {
5884                                                printWnd.print();
5885                                            } catch (e) {
5886                                                console.error(e);
5887                                            }
5888                                        });
5889                                    }
5890                                })();
5891                            } else {
5892                                this.renderContent().then(function (content) {
5893                                    var printWnd = _this.wnd.open(),
5894                                        printDoc = printWnd.document,
5895                                        html = '\n            <!DOCTYPE html>\n            <html>\n              <head>\n                <meta charset="utf-8">\n                <title>3D FlipBook - Printing</title>\n                ' + content.head + '\n                <script type="text/javascript">\n                  function printDocument() {\n                    window.print();\n                    window.close();\n                  }\n                  function init() {\n                    setTimeout(printDocument, 100);\n                  }\n                </script>\n              </head>\n              <body onload="init()">\n                ' + content.body + '\n              </body>\n            </html>\n          ';
5896                                    printDoc.open();
5897                                    printDoc.write(html);
5898                                    printDoc.close();
5899                                }).catch(function (e) {
5900                                    return console.warn('3D FlipBook - Printing was canceled');
5901                                });
5902                            }
5903                        };
5904
5905                        BookPrinter.prototype.progress = function progress(v) {
5906                            if (this.canceled) {
5907                                throw 'Cancel Printing';
5908                            }
5909                            if (this.onProgress) {
5910                                this.onProgress(Math.floor(v * 100));
5911                            }
5912                        };
5913
5914                        BookPrinter.prototype.renderContent = function renderContent() {
5915                            var _this2 = this;
5916
5917                            var pages = this.book.getPages(),
5918                                head = new Set(),
5919                                body = [];
5920                            var done = Promise.resolve();
5921
5922                            var _loop = function _loop(page) {
5923                                var info = _this2.pageCallback(page);
5924                                if (info.type === 'image') {
5925                                    done = done.then(function () {
5926                                        _this2.progress(page / pages);
5927                                        return _this2.renderImage(head, body, info.src);
5928                                    });
5929                                } else if (info.type === 'html') {
5930                                    done = done.then(function () {
5931                                        _this2.progress(page / pages);
5932                                        return _this2.renderHtml(head, body, info.src);
5933                                    });
5934                                }
5935                            };
5936
5937                            for (var page = 0; page < pages; ++page) {
5938                                _loop(page);
5939                            }
5940                            return done.then(function () {
5941                                _this2.progress(1);
5942                                return { head: _this2.renderHead(head), body: body.join('\n') };
5943                            });
5944                        };
5945
5946                        BookPrinter.wrap = function wrap(content) {
5947                            return '<div class="fb3d-printer-page">' + content + '</div>';
5948                        };
5949
5950                        BookPrinter.prototype.renderImage = function renderImage(head, body, src) {
5951                            body.push(BookPrinter.wrap('<img src="' + src + '" />'));
5952                        };
5953
5954                        BookPrinter.prototype.renderHtml = function renderHtml(head, body, src) {
5955                            return new Promise(function (resolve, reject) {
5956                                _libs.$.get(src, function (html) {
5957                                    var links = html.match(/<link.*?>/ig) || [];
5958                                    for (var _iterator = links, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
5959                                        var _ref;
5960
5961                                        if (_isArray) {
5962                                            if (_i >= _iterator.length) break;
5963                                            _ref = _iterator[_i++];
5964                                        } else {
5965                                            _i = _iterator.next();
5966                                            if (_i.done) break;
5967                                            _ref = _i.value;
5968                                        }
5969
5970                                        var link = _ref;
5971
5972                                        if (link.match(/stylesheet/i)) {
5973                                            var href = link.match(/href\s*=\s*['"](.*)['"]/i);
5974                                            if (href) {
5975                                                head.add(href[1]);
5976                                            }
5977                                        }
5978                                    }
5979                                    var content = html.match(/<body.*?>([\S\s]*)<\/body>/i);
5980                                    if (content) {
5981                                        body.push(BookPrinter.wrap(content[1]));
5982                                    }
5983                                    resolve();
5984                                }).fail(function (e) {
5985                                    console.error(e.responseText);
5986                                    reject();
5987                                });
5988                            });
5989                        };
5990
5991                        BookPrinter.prototype.renderHead = function renderHead(head) {
5992                            var content = [];
5993                            head.forEach(function (k) {
5994                                return content.push('<link rel="stylesheet" href="' + k + '">');
5995                            });
5996                            content.push(this.styleSheet ? '<link rel="stylesheet" href="' + this.styleSheet + '">' : BookPrinter.defaultStyleSheet());
5997                            return content.join('\n');
5998                        };
5999
6000                        BookPrinter.prototype.useIFrame = function useIFrame() {
6001                            var isChromium = this.wnd.chrome,
6002                                winNav = this.wnd.navigator,
6003                                vendorName = winNav.vendor,
6004                                isIEedge = winNav.userAgent.indexOf("Edge") > -1,
6005                                isIOSChrome = winNav.userAgent.match("CriOS");
6006                            var use = void 0;
6007                            if (isIOSChrome) {
6008                                use = true;
6009                            } else if (isChromium && vendorName === 'Google Inc.' && !isIEedge) {
6010                                use = true;
6011                            } else {
6012                                use = false;
6013                            }
6014                            return use;
6015                        };
6016
6017                        BookPrinter.defaultStyleSheet = function defaultStyleSheet() {
6018                            return '\n      <style type="text/css">\n        body {\n          margin: 0;\n          padding: 0;\n        }\n        .fb3d-printer-page {\n          page-break-after: always;\n        }\n      </style>\n    ';
6019                        };
6020
6021                        return BookPrinter;
6022                    }();
6023
6024                    exports.default = BookPrinter;
6025
6026                    /***/
6027                },
6028/* 29 */
6029/***/function (module, exports, __webpack_require__) {
6030
6031                    "use strict";
6032                    'use strict';
6033
6034                    exports.__esModule = true;
6035
6036                    var _libs = __webpack_require__(1);
6037
6038                    var _View2 = __webpack_require__(65);
6039
6040                    var _View3 = _interopRequireDefault(_View2);
6041
6042                    function _interopRequireDefault(obj) {
6043                        return obj && obj.__esModule ? obj : { default: obj };
6044                    }
6045
6046                    function _classCallCheck(instance, Constructor) {
6047                        if (!(instance instanceof Constructor)) {
6048                            throw new TypeError("Cannot call a class as a function");
6049                        }
6050                    }
6051
6052                    function _possibleConstructorReturn(self, call) {
6053                        if (!self) {
6054                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
6055                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
6056                    }
6057
6058                    function _inherits(subClass, superClass) {
6059                        if (typeof superClass !== "function" && superClass !== null) {
6060                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
6061                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
6062                    }
6063
6064                    var BookView = function (_View) {
6065                        _inherits(BookView, _View);
6066
6067                        function BookView(container, onLoad, template, handler) {
6068                            _classCallCheck(this, BookView);
6069
6070                            return _possibleConstructorReturn(this, _View.call(this, container, onLoad, template, handler));
6071                        }
6072
6073                        BookView.prototype.initView = function initView() {
6074                            this.view = this.container.find('.view');
6075                            this.bookmarksView = this.container.find('.widBookmarks');
6076                            this.thumbnailsView = this.container.find('.widThumbnails');
6077                            this.searchView = this.container.find('.widSearch');
6078                        };
6079
6080                        BookView.prototype.getHandlers = function getHandlers(id) {
6081                            var _this2 = this;
6082
6083                            var handlers = void 0;
6084                            if (id === 'inpPage') {
6085                                handlers = [{
6086                                    inpPage: function inpPage(e, data) {
6087                                        return _this2.callLater(_View.prototype.getHandlers.call(_this2, id), id, e, data, BookView.PAGE_HANDLER_DELAY);
6088                                    }
6089                                }];
6090                            } else {
6091                                handlers = _View.prototype.getHandlers.call(this, id);
6092                            }
6093                            return handlers;
6094                        };
6095
6096                        BookView.prototype.onItemStateChanged = function onItemStateChanged(id, state) {
6097                            if (id === 'cmdFullScreen') {
6098                                if (state.active) {
6099                                    this.parentContainer.addClass('fullscreen');
6100                                } else {
6101                                    this.parentContainer.removeClass('fullscreen');
6102                                }
6103                            }
6104                        };
6105
6106                        BookView.prototype.getView = function getView() {
6107                            return this.view;
6108                        };
6109
6110                        BookView.prototype.getBookmarksView = function getBookmarksView() {
6111                            return this.bookmarksView;
6112                        };
6113
6114                        BookView.prototype.getThumbnailsView = function getThumbnailsView() {
6115                            return this.thumbnailsView;
6116                        };
6117
6118                        BookView.prototype.getSearchView = function getSearchView() {
6119                            return this.searchView;
6120                        };
6121
6122                        BookView.prototype.getForms = function getForms() {
6123                            return [];
6124                        };
6125
6126                        BookView.prototype.getLinks = function getLinks() {
6127                            return ['cmdZoomIn', 'cmdZoomOut', 'cmdDefaultZoom', 'cmdToc', 'cmdFastBackward', 'cmdBackward', 'cmdForward', 'cmdFastForward', 'cmdSave', 'cmdPrint', 'cmdFullScreen', 'cmdSmartPan', 'cmdSinglePage', 'cmdSounds', 'cmdStats', 'cmdLightingUp', 'cmdLightingDown', 'cmdCloseToc', 'cmdBookmarks', 'cmdSearch', 'cmdThumbnails'];
6128                        };
6129
6130                        BookView.prototype.getWidgets = function getWidgets() {
6131                            return ['widLoadingProgress', 'widFloatWnd', 'widTocMenu', 'widBookmarks', 'widThumbnails', 'widSearch', 'widSettings', 'widLoading'];
6132                        };
6133
6134                        BookView.prototype.getInputs = function getInputs() {
6135                            return ['inpPage', 'inpPages'];
6136                        };
6137
6138                        BookView.prototype.getTexts = function getTexts() {
6139                            return ['txtLoadingProgress'];
6140                        };
6141
6142                        BookView.prototype.getTemplate = function getTemplate() {
6143                            return {
6144                                html: '/wp-content/plugins/vc-brochures/lib/templates/default-book-view.html',
6145                                styles: ['/wp-content/plugins/vc-brochures/lib/css/black-book-view.css'],
6146                                links: [{
6147                                    rel: 'stylesheet',
6148                                    href: '/wp-content/plugins/vc-brochures/lib/css/font-awesome.min.css'
6149                                }],
6150                                script: '/wp-content/plugins/vc-brochures/lib/js/default-book-view.js'
6151                            };
6152                        };
6153
6154                        return BookView;
6155                    }(_View3.default);
6156
6157                    BookView.PAGE_HANDLER_DELAY = 1000;
6158                    exports.default = BookView;
6159
6160                    /***/
6161                },
6162/* 30 */
6163/***/function (module, exports, __webpack_require__) {
6164
6165                    "use strict";
6166                    'use strict';
6167
6168                    exports.__esModule = true;
6169
6170                    var _BookPropsBuilder2 = __webpack_require__(9);
6171
6172                    var _BookPropsBuilder3 = _interopRequireDefault(_BookPropsBuilder2);
6173
6174                    var _ImageFactory = __webpack_require__(8);
6175
6176                    var _ImageFactory2 = _interopRequireDefault(_ImageFactory);
6177
6178                    function _interopRequireDefault(obj) {
6179                        return obj && obj.__esModule ? obj : { default: obj };
6180                    }
6181
6182                    function _classCallCheck(instance, Constructor) {
6183                        if (!(instance instanceof Constructor)) {
6184                            throw new TypeError("Cannot call a class as a function");
6185                        }
6186                    }
6187
6188                    function _possibleConstructorReturn(self, call) {
6189                        if (!self) {
6190                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
6191                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
6192                    }
6193
6194                    function _inherits(subClass, superClass) {
6195                        if (typeof superClass !== "function" && superClass !== null) {
6196                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
6197                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
6197onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
6198                    }
6199
6200                    var ClbBookPropsBuilder = function (_BookPropsBuilder) {
6201                        _inherits(ClbBookPropsBuilder, _BookPropsBuilder);
6202
6203                        function ClbBookPropsBuilder(context, pageCallback, pages, onReady) {
6204                            _classCallCheck(this, ClbBookPropsBuilder);
6205
6206                            var _this = _possibleConstructorReturn(this, _BookPropsBuilder.call(this, onReady));
6207
6208                            _this.calcSheets(pages);
6209                            _this.pageCallback = pageCallback;
6210                            _this.binds = {
6211                                pageCallback: pageCallback.bind(_this)
6212                            };
6213                            _this.imageFactory = new _ImageFactory2.default(context);
6214
6215                            if (pages > 0) {
6216                                (function () {
6217                                    var test = _this.imageFactory.build(pageCallback(0), 0, _this.defaults.sheet.widthTexels, _this.defaults.sheet.heightTexels, _this.defaults.sheet.color);
6218                                    test.onLoad = function () {
6219                                        _this.calcProps(test.width, test.height);
6220                                        test.dispose();
6221                                        _this.ready();
6222                                    };
6223                                })();
6224                            } else {
6225                                _this.props = _this.defaults;
6226                                _this.ready();
6227                            }
6228                            return _this;
6229                        }
6230
6231                        return ClbBookPropsBuilder;
6232                    }(_BookPropsBuilder3.default);
6233
6234                    exports.default = ClbBookPropsBuilder;
6235
6236                    /***/
6237                },
6238/* 31 */
6239/***/function (module, exports, __webpack_require__) {
6240
6241                    "use strict";
6242                    'use strict';
6243
6244                    exports.__esModule = true;
6245
6246                    var _extends = Object.assign || function (target) {
6247                        for (var i = 1; i < arguments.length; i++) {
6248                            var source = arguments[i]; for (var key in source) {
6249                                if (Object.prototype.hasOwnProperty.call(source, key)) {
6250                                    target[key] = source[key];
6251                                }
6252                            }
6253                        } return target;
6254                    };
6255
6256                    var _SheetBlock2 = __webpack_require__(10);
6257
6258                    var _SheetBlock3 = _interopRequireDefault(_SheetBlock2);
6259
6260                    function _interopRequireDefault(obj) {
6261                        return obj && obj.__esModule ? obj : { default: obj };
6262                    }
6263
6264                    function _classCallCheck(instance, Constructor) {
6265                        if (!(instance instanceof Constructor)) {
6266                            throw new TypeError("Cannot call a class as a function");
6267                        }
6268                    }
6269
6270                    function _possibleConstructorReturn(self, call) {
6271                        if (!self) {
6272                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
6273                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
6274                    }
6275
6276                    function _inherits(subClass, superClass) {
6277                        if (typeof superClass !== "function" && superClass !== null) {
6278                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
6279                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
6279onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
6280                    }
6281
6282                    var Cover = function (_SheetBlock) {
6283                        _inherits(Cover, _SheetBlock);
6284
6285                        function Cover(visual, p, angle, state) {
6286                            _classCallCheck(this, Cover);
6287
6288                            return _possibleConstructorReturn(this, _SheetBlock.call(this, visual, p, 0, 1, angle, state));
6289                        }
6290
6291                        Cover.prototype.getProps = function getProps() {
6292                            return _extends({}, this.p.cover, {
6293                                sheets: 1
6294                            });
6295                        };
6296
6297                        Cover.prototype.loadPoints = function loadPoints() {
6298                            var openedInterpolationIndeces = [[2, 3, 4], [2, 3, 4, 5, 6]],
6299                                closedInterpolationIndeces = [[0, 1, 2], [0, 1, 2]],
6300                                interpolationPoints = [{
6301                                    x: [[0, 0.2877, 0.6347, 0.8174, 1.0000], [0, 0.2831, 0.6256, 0.8082, 0.9909], [0, 0.2603, 0.5936, 0.7763, 0.9589], [0, 0.1370, 0.3881, 0.5342, 0.6758], [0, 0, 0, 0, 0]],
6302                                    y: [[0, 0, 0, 0, 0], [0, 0.02, 0.005, -0.001, -0.0025], [0, 0.04, 0.01, -0.002, -0.005], [0, 0.2466, 0.4795, 0.5708, 0.6758], [0, 0.2877, 0.6347, 0.8174, 1.0000]]
6303                                }, {
6304                                    x: [[0, 0.2877, 0.6347, 0.8174, 1.0000], [0, 0.2831, 0.6256, 0.8082, 0.9909], [0, 0.2603, 0.5936, 0.7763, 0.9589], [0.000, 0.233, 0.563, 0.746, 0.927], [0.000, 0.144, 0.433, 0.613, 0.796], [0.000, 0.070, 0.288, 0.455, 0.626], [0, 0, 0, 0, 0]],
6305                                    y: [[0, 0, 0, 0, 0], [0, 0.02, 0.005, -0.001, -0.0025], [0, 0.04, 0.01, -0.002, -0.005], [0.000, 0.168, 0.269, 0.270, 0.255], [0.000, 0.245, 0.435, 0.458, 0.460], [0.000, 0.278, 0.544, 0.614, 0.673], [0, 0.2877, 0.6347, 0.8174, 1.0000]]
6306                                }];
6307                            return {
6308                                interpolationPoints: interpolationPoints,
6309                                openedInterpolationIndeces: openedInterpolationIndeces,
6310                                closedInterpolationIndeces: closedInterpolationIndeces
6311                            };
6312                        };
6313
6314                        return Cover;
6315                    }(_SheetBlock3.default);
6316
6317                    exports.default = Cover;
6318
6319                    /***/
6320                },
6321/* 32 */
6322/***/function (module, exports, __webpack_require__) {
6323
6324                    "use strict";
6325                    'use strict';
6326
6327                    exports.__esModule = true;
6328
6329                    var _SheetCssLayer = __webpack_require__(37);
6330
6331                    var _SheetCssLayer2 = _interopRequireDefault(_SheetCssLayer);
6332
6333                    function _interopRequireDefault(obj) {
6334                        return obj && obj.__esModule ? obj : { default: obj };
6335                    }
6336
6337                    function _classCallCheck(instance, Constructor) {
6338                        if (!(instance instanceof Constructor)) {
6339                            throw new TypeError("Cannot call a class as a function");
6340                        }
6341                    }
6342
6343                    var CssLayersManager = function () {
6344                        function CssLayersManager(book) {
6345                            _classCallCheck(this, CssLayersManager);
6346
6347                            this.book = book;
6348                            this.props = book.p.cssLayerProps;
6349                            this.visual = book.visual;
6350                            this.pageManager = book.pageManager;
6351                            this.wrappers = {};
6352                        }
6353
6354                        CssLayersManager.prototype.getActives = function getActives() {
6355                            var page = this.book.getPage(),
6356                                pages = this.book.getPages();
6357                            return page === 0 || page === pages - 1 ? [page] : [page, page + 1];
6358                        };
6359
6360                        CssLayersManager.prototype.dispose = function dispose() {
6361                            for (var _iterator = Object.values(this.wrappers), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
6362                                var _ref;
6363
6364                                if (_isArray) {
6365                                    if (_i >= _iterator.length) break;
6366                                    _ref = _iterator[_i++];
6367                                } else {
6368                                    _i = _iterator.next();
6369                                    if (_i.done) break;
6370                                    _ref = _i.value;
6371                                }
6372
6373                                var w = _ref;
6374
6375                                w.layers.forEach(function (l) {
6376                                    return l.dispose();
6377                                });
6378                            }
6379                            delete this.wrappers;
6380                        };
6381
6382                        CssLayersManager.prototype.show = function show() {
6383                            var _this = this;
6384
6385                            this.hidden = false;
6386
6387                            var _loop = function _loop() {
6388                                if (_isArray2) {
6389                                    if (_i2 >= _iterator2.length) return 'break';
6390                                    _ref2 = _iterator2[_i2++];
6391                                } else {
6392                                    _i2 = _iterator2.next();
6393                                    if (_i2.done) return 'break';
6394                                    _ref2 = _i2.value;
6395                                }
6396
6397                                var n = _ref2;
6398
6399                                var w = _this.wrappers[n];
6400                                if (w) {
6401                                    if (w.state === 'ready' && w.layers.length) {
6402                                        (function () {
6403                                            var block = _this.book.getBlockByPage(n);
6404                                            w.layers.forEach(function (l) {
6405                                                if (l.isHidden()) {
6406                                                    l.update(block);
6407                                                    l.show();
6408                                                }
6409                                            });
6410                                        })();
6411                                    }
6412                                } else {
6413                                    (function () {
6414                                        var w = _this.wrappers[n] = {
6415                                            state: 'loading',
6416                                            layers: []
6417                                        };
6418                                        Promise.resolve().then(function () {
6419                                            _this.pageManager.getLayers(n, function (layers) {
6420                                                if (layers.length && _this.wrappers) {
6421                                                    var block = _this.book.getBlockByPage(n);
6422                                                    for (var _iterator3 = layers, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
6423                                                        var _ref3;
6424
6425                                                        if (_isArray3) {
6426                                                            if (_i3 >= _iterator3.length) break;
6427                                                            _ref3 = _iterator3[_i3++];
6428                                                        } else {
6429                                                            _i3 = _iterator3.next();
6430                                                            if (_i3.done) break;
6431                                                            _ref3 = _i3.value;
6432                                                        }
6433
6434                                                        var l = _ref3;
6435
6436                                                        var sl = new _SheetCssLayer2.default(_this.visual, block, _this.props);
6437                                                        w.layers.push(sl);
6438                                                        sl.set(l.css, l.html, l.js);
6439                                                    }
6440                                                    setTimeout(function () {
6441                                                        if (!_this.hidden && ~_this.getActives().indexOf(n)) {
6442                                                            w.layers.forEach(function (l) {
6443                                                                return l.show();
6444                                                            });
6445                                                        }
6446                                                    }, 10);
6447                                                }
6448                                                w.state = 'ready';
6449                                            });
6450                                        });
6451                                    })();
6452                                }
6453                            };
6454
6455                            for (var _iterator2 = this.getActives(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
6456                                var _ref2;
6457
6458                                var _ret = _loop();
6459
6460                                if (_ret === 'break') break;
6461                            }
6462                        };
6463
6464                        CssLayersManager.prototype.hide = function hide() {
6465                            this.hidden = true;
6466                            var wait = [];
6467                            for (var _iterator4 = Object.values(this.wrappers), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
6468                                var _ref4;
6469
6470                                if (_isArray4) {
6471                                    if (_i4 >= _iterator4.length) break;
6472                                    _ref4 = _iterator4[_i4++];
6473                                } else {
6474                                    _i4 = _iterator4.next();
6475                                    if (_i4.done) break;
6476                                    _ref4 = _i4.value;
6477                                }
6478
6479                                var _w = _ref4;
6480
6481                                _w.layers.forEach(function (l) {
6482                                    return wait.push(l.hide());
6483                                });
6484                            }
6485                            return Promise.all(wait);
6486                        };
6487
6488                        return CssLayersManager;
6489                    }();
6490
6491                    exports.default = CssLayersManager;
6492
6493                    /***/
6494                },
6495/* 33 */
6496/***/function (module, exports, __webpack_require__) {
6497
6498                    "use strict";
6499                    'use strict';
6500
6501                    exports.__esModule = true;
6502
6503                    var _extends = Object.assign || function (target) {
6504                        for (var i = 1; i < arguments.length; i++) {
6505                            var source = arguments[i]; for (var key in source) {
6506                                if (Object.prototype.hasOwnProperty.call(source, key)) {
6507                                    target[key] = source[key];
6508                                }
6509                            }
6510                        } return target;
6511                    };
6512
6513                    var _libs = __webpack_require__(1);
6514
6515                    var _Cache = __webpack_require__(14);
6516
6517                    var _Cache2 = _interopRequireDefault(_Cache);
6518
6519                    var _LoadingAnimation = __webpack_require__(52);
6520
6521                    var _LoadingAnimation2 = _interopRequireDefault(_LoadingAnimation);
6522
6523                    var _ImageFactory = __webpack_require__(8);
6524
6525                    var _ImageFactory2 = _interopRequireDefault(_ImageFactory);
6526
6527                    var _BaseMathUtils = __webpack_require__(2);
6528
6529                    var _BaseMathUtils2 = _interopRequireDefault(_BaseMathUtils);
6530
6531                    var _TextureAnimator = __webpack_require__(60);
6532
6533                    var _TextureAnimator2 = _interopRequireDefault(_TextureAnimator);
6534
6535                    function _interopRequireDefault(obj) {
6536                        return obj && obj.__esModule ? obj : { default: obj };
6537                    }
6538
6539                    function _classCallCheck(instance, Constructor) {
6540                        if (!(instance instanceof Constructor)) {
6541                            throw new TypeError("Cannot call a class as a function");
6542                        }
6543                    }
6544
6545                    var PageManager = function () {
6546                        function PageManager(visual, book, p) {
6547                            _classCallCheck(this, PageManager);
6548
6549                            this.visual = visual;
6550                            this.book = book;
6551                            this.pageQuery = '';
6552                            this.p = p;
6553                            this.pageCache = new _Cache2.default(p.cachedPages);
6554                            this.resourcesCache = new _Cache2.default();
6555                            this.canvas = (0, _libs.$)('<canvas>')[0];
6556                            this.imageFactory = new _ImageFactory2.default(_extends({}, visual, { dispatchEvent: book.dispatchEvent.bind(book), renderCanvas: this.canvas, renderCanvasCtx: this.canvas.getContext('2d') }), this.resourcesCache);
6557
6558                            this.loadings = [];
6559                            this.renderQueue = [];
6560                            this.pageRequests = [];
6561                            this.predictedRequests = [];
6562
6563                            this.tmpMaterial = new _libs.THREE.MeshBasicMaterial();
6564                            visual.addObject(new _libs.THREE.Mesh(new _libs.THREE.PlaneGeometry(0, 0), this.tmpMaterial));
6565
6566                            this.loadingAnimation = true;
6567                            this.loading = {};
6568                            this.loading[p.cover.color] = this.createLoadingTexture(p.cover);
6569                            if (p.page.color !== p.cover.color) {
6570                                this.loading[p.page.color] = this.createLoadingTexture(p.page);
6571                            }
6572
6573                            this.turnOnEvents();
6574
6575                            visual.addRenderCallback(this.update.bind(this));
6576
6577                            setTimeout(this.updateRenderQueue.bind(this), 250);
6578                        }
6579
6580                        PageManager.prototype.createLoadingTexture = function createLoadingTexture(p) {
6581                            var spriteTiles = 6,
6582                                scale = Math.sqrt(4.5 * 210 * 4.5 * 297 / (p.widthTexels * p.heightTexels)),
6583                                animation = new _LoadingAnimation2.default(scale * p.widthTexels, scale * p.heightTexels, p.color),
6584                                animator = new _TextureAnimator2.default(animation.createSprite(spriteTiles), spriteTiles, 1, spriteTiles, 0.2);
6585                            animation.dispose();
6586                            return animator;
6587                        };
6588
6589                        PageManager.prototype.dispose = function dispose() {
6590                            this.turnOffEvents();
6591                            for (var _iterator = Object.keys(this.loading), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
6592                                var _ref;
6593
6594                                if (_isArray) {
6595                                    if (_i >= _iterator.length) break;
6596                                    _ref = _iterator[_i++];
6597                                } else {
6598                                    _i = _iterator.next();
6599                                    if (_i.done) break;
6600                                    _ref = _i.value;
6601                                }
6602
6603                                var color = _ref;
6604
6605                                this.loading[color].dispose();
6606                            }
6607                            delete this.loading;
6608                            this.resourcesCache.dispose();
6609                            this.pageCache.dispose();
6610                            this.canvas.height = this.canvas.width = 0;
6611                            delete this.canvas;
6612                        };
6613
6614                        PageManager.prototype.isCover = function isCover(n) {
6615                            return n < 2 || n >= 2 * (this.p.sheets + 1);
6616                        };
6617
6618                        PageManager.prototype.isMobile = function isMobile() {
6619                            return (this.visual.wnd.devicePixelRatio || 1) > 1;
6620                        };
6621
6622                        PageManager.prototype.getPageState = function getPageState(n) {
6623                            var object = this.pageCache.get(n);
6624                            return object ? object.state : undefined;
6625                        };
6626
6627                        PageManager.prototype.enableLoadingAnimation = function enableLoadingAnimation(enable) {
6628                            this.loadingAnimation = enable;
6629                            for (var _iterator2 = this.loadings, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
6630                                var _ref2;
6631
6632                                if (_isArray2) {
6633                                    if (_i2 >= _iterator2.length) break;
6634                                    _ref2 = _iterator2[_i2++];
6635                                } else {
6636                                    _i2 = _iterator2.next();
6637                                    if (_i2.done) break;
6638                                    _ref2 = _i2.value;
6639                                }
6640
6641                                var o = _ref2;
6642
6643                                this.setupMaterial(o);
6644                            }
6645                        };
6646
6647                        PageManager.prototype.update = function update(dt) {
6648                            if (this.loadingAnimation) {
6649                                var loading = {};
6650                                for (var _iterator3 = this.loadings, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
6651                                    var _ref3;
6652
6653                                    if (_isArray3) {
6654                                        if (_i3 >= _iterator3.length) break;
6655                                        _ref3 = _iterator3[_i3++];
6656                                    } else {
6657                                        _i3 = _iterator3.next();
6658                                        if (_i3.done) break;
6659                                        _ref3 = _i3.value;
6660                                    }
6661
6662                                    var o = _ref3;
6663
6664                                    if (o.isActive()) {
6665                                        loading[o.color] = true;;
6666                                    }
6667                                }
6668                                for (var _iterator4 = Object.keys(loading), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
6669                                    var _ref4;
6670
6671                                    if (_isArray4) {
6672                                        if (_i4 >= _iterator4.length) break;
6673                                        _ref4 = _iterator4[_i4++];
6674                                    } else {
6675                                        _i4 = _iterator4.next();
6676                                        if (_i4.done) break;
6677                                        _ref4 = _i4.value;
6678                                    }
6679
6680                                    var color = _ref4;
6681
6682                                    this.loading[color].update(dt);
6683                                }
6684                            }
6685                        };
6686
6687                        PageManager.prototype.removeFromLoadings = function removeFromLoadings(o) {
6688                            var i = this.loadings.indexOf(o);
6689                            if (~i) {
6690                                this.loadings.splice(i, 1);
6691                            }
6692                        };
6693
6694                        PageManager.prototype.removeFromRenderQueue = function removeFromRenderQueue(o) {
6695                            var i = this.renderQueue.indexOf(o);
6696                            if (~i) {
6697                                this.renderQueue.splice(i, 1);
6698                            }
6699                        };
6700
6701                        PageManager.prototype.refreshPageQuery = function refreshPageQuery(n) {
6702                            var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
6703
6704                            this.pageQuery = query;
6705                            var object = this.pageCache.get(n);
6706                            if (object && object.wrapper && object.wrapper.setQuery) {
6707                                if (!this.pageCache.remove(n)) {
6708                                    object.wrapper.setQuery(query);
6709                                    this.pushInRenderQueue(object);
6710                                }
6711                            }
6712                        };
6713
6714                        PageManager.prototype.refreshZoom = function refreshZoom() {
6715                            var _this = this;
6716
6717                            if (this.p.autoResolution.enable) {
6718                                (function () {
6719                                    var es = [];
6720                                    _this.pageCache.forEach(function (e) {
6721                                        es.push(e);
6722                                    });
6723                                    es.forEach(function (e) {
6724                                        var object = e[1];
6725                                        if (object && object.wrapper) {
6726                                            if (!_this.pageCache.remove(e[0])) {
6727                                                _this.pushInRenderQueue(object);
6728                                            }
6729                                        }
6730                                    });
6731                                })();
6732                            }
6733                        };
6734
6735                        PageManager.prototype.getLayers = function getLayers(n, clb) {
6736                            var _this2 = this;
6737
6738                            if (this.p.cssLayersLoader) {
6739                                this.p.cssLayersLoader(n, function () {
6740                                    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
6741                                        args[_key] = arguments[_key];
6742                                    }
6743
6744                                    var object = _this2.pageCache.get(n);
6745                                    if (object) {
6746                                        if (object.state !== 'active') {
6747                                            object.pendings.push({ clb: clb, args: args });
6748                                        } else {
6749                                            clb.apply(undefined, args);
6750                                        }
6751                                    }
6752                                });
6753                            } else {
6754                                clb([]);
6755                            }
6756                        };
6757
6758                        PageManager.prototype.resolvePendings = function resolvePendings(pendings) {
6759                            for (var _iterator5 = pendings, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator](); ;) {
6760                                var _ref5;
6761
6762                                if (_isArray5) {
6763                                    if (_i5 >= _iterator5.length) break;
6764                                    _ref5 = _iterator5[_i5++];
6765                                } else {
6766                                    _i5 = _iterator5.next();
6767                                    if (_i5.done) break;
6768                                    _ref5 = _i5.value;
6769                                }
6770
6771                                var p = _ref5;
6772
6773                                try {
6774                                    p.clb.apply(p, p.args);
6775                                } catch (e) {
6776                                    console.error(e);
6777                                }
6778                            }
6779                            pendings.splice(0, pendings.length);
6780                        };
6781
6782                        PageManager.prototype.rtlPageN = function rtlPageN(n) {
6783                            return this.p.rtl ? 2 * (this.p.sheets + 2) - 1 - n : n;
6784                        };
6785
6786                        PageManager.prototype.load = function load(material, n) {
6787                            var _this3 = this;
6788
6789                            var pi = this.p.pageCallback(this.rtlPageN(n)),
6790                                p = this.isCover(n) ? this.p.cover : this.p.page;
6791                            var o = {
6792                                n: n,
6793                                texture: new _libs.THREE.Texture(),
6794                                wrapper: null,
6795                                state: 'loading',
6796                                locked: function locked(n) {
6797                                    return o.state === 'loading' || o.state === 'rendering' || _this3.book.isActivePage(n);
6798                                },
6799                                color: p.color,
6800                                isActive: function isActive() {
6801                                    return _this3.book.isActivePage(n);
6802                                },
6803                                isTop: function isTop() {
6804                                    return ~_this3.book.getTopPages().indexOf(n);
6805                                },
6806                                dispose: function dispose() {
6807                                    _this3.removeFromLoadings(o);
6808                                    _this3.removeFromRenderQueue(o);
6809                                    if (o.wrapper && o.wrapper.dispose) {
6810                                        o.wrapper.dispose();
6811                                    }
6812                                    o.texture.dispose();
6813                                    delete o.texture;
6814                                    delete o.wrapper;
6815                                },
6816                                pendings: []
6817                            };
6818                            o.texture.minFilter = _libs.THREE.LinearFilter;
6819                            this.loadings.push(o);
6820                            this.setMaterial(o, material);
6821
6822                            Promise.resolve().then(function () {
6823                                if (o.texture) {
6824                                    o.widthTexels = pi.widthTexels || p.widthTexels;
6825                                    o.heightTexels = pi.heightTexels || p.heightTexels;
6826                                    var res = _this3.calcResolution(o);
6827                                    o.wrapper = _this3.imageFactory.build(pi, pi.number === undefined ? n : pi.number, res.width, res.height, p.color, _this3.p.injector);
6828                                    if (o.wrapper.setQuery) {
6829                                        o.wrapper.setQuery(_this3.pageQuery);
6830                                    }
6831                                    o.simulate = pi.interactive ? (o.wrapper.simulate || function () {
6832                                        return undefined;
6833                                    }).bind(o.wrapper) : undefined;
6834                                    o.wrapper.onLoad = function () {
6835                                        _this3.pushInRenderQueue(o);
6836                                        _this3.book.dispatchEvent({
6837                                            type: 'loadedPage',
6838                                            page: n
6839                                        });
6840                                    };
6841                                    o.wrapper.onChange = function (image) {
6842                                        if (o.texture) {
6843                                            _this3.removeFromLoadings(o);
6844                                            if (o.material) {
6845                                                o.material.map = o.texture;
6846                                                o.material.color = new _libs.THREE.Color(0xFFFFFF);
6847                                                o.material.needsUpdate = true;
6848                                            }
6849                                            o.texture.image = image;
6850                                            o.texture.needsUpdate = true;
6851                                            o.texture.onUpdate = function () {
6852                                                if (o.state !== 'queuedForRender') {
6853                                                    o.state = 'active';
6854                                                    _this3.resolvePendings(o.pendings);
6855                                                }
6856                                                delete _this3.rendering;
6857                                                //this.updateRenderQueue();
6858                                            };
6859                                            _this3.tmpMaterial.map = o.texture;
6860                                            _this3.tmpMaterial.needsUpdate = true;
6861                                        }
6862                                    };
6863                                }
6864                            });
6865                            this.book.dispatchEvent({
6866                                type: 'loadPage',
6867                                page: n
6868                            });
6869                            return this.pageCache.put(n, o);
6870                        };
6871
6872                        PageManager.prototype.isSinglePage = function isSinglePage(o) {
6873                            return this.p.singlePage || !o.n || o.n === this.book.getPages() - 1;
6874                        };
6875
6876                        PageManager.prototype.calcResolution = function calcResolution(o) {
6877                            var res = void 0;
6878                            if (this.p.autoResolution.enable) {
6879                                var k = Math.min((this.isSinglePage(
6879o) ? 1 : 0.5) * this.visual.width() / o.widthTexels, this.visual.height() / o.heightTexels);
6880                                res = {
6881                                    width: this.p.autoResolution.k * this.p.zoom * k * o.widthTexels,
6882                                    height: this.p.autoResolution.k * this.p.zoom * k * o.heightTexels
6883                                };
6884                            } else {
6885                                res = {
6886                                    width: o.widthTexels,
6887                                    height: o.heightTexels
6888                                };
6889                            }
6890                            return res;
6891                        };
6892
6893                        PageManager.prototype.pushInRenderQueue = function pushInRenderQueue(o) {
6894                            if (o.state !== 'queuedForRender') {
6895                                o.state = 'queuedForRender';
6896                                this.renderQueue.push(o);
6897                                // this.updateRenderQueue();
6898                            }
6899                        };
6900
6901                        PageManager.prototype.updateRenderQueue = function updateRenderQueue() {
6902                            if (this.canvas) {
6903                                var p = this.p;
6904                                if (!this.rendering && (p.renderWhileFlipping || !this.book.isProcessing())) {
6905                                    var active = void 0,
6906                                        top = void 0;
6907                                    for (var _iterator6 = this.renderQueue, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator](); ;) {
6908                                        var _ref6;
6909
6910                                        if (_isArray6) {
6911                                            if (_i6 >= _iterator6.length) break;
6912                                            _ref6 = _iterator6[_i6++];
6913                                        } else {
6914                                            _i6 = _iterator6.next();
6915                                            if (_i6.done) break;
6916                                            _ref6 = _i6.value;
6917                                        }
6918
6919                                        var o = _ref6;
6920
6921                                        if (!active && o.isActive()) {
6922                                            active = o;
6923                                        }
6924                                        if (o.isTop()) {
6925                                            top = o;
6926                                            break;
6927                                        }
6928                                    }
6929                                    this.rendering = top || active;
6930                                    if (this.isMobile() && p.renderInactivePagesOnMobile || !this.isMobile() && p.renderInactivePages) {
6931                                        this.rendering = this.rendering || this.renderQueue[0];
6932                                    }
6933                                    if (this.rendering) {
6934                                        if (this.rendering.wrapper.startRender) {
6935                                            this.removeFromRenderQueue(this.rendering);
6936                                            this.rendering.state = 'rendering';
6937                                            this.rendering.wrapper.setResolution(this.calcResolution(this.rendering));
6938                                            this.rendering.wrapper.startRender();
6939                                        } else {
6940                                            delete this.rendering;
6941                                        }
6942                                    }
6943                                }
6944                                setTimeout(this.updateRenderQueue.bind(this), 250);
6945                            }
6946                        };
6947
6948                        PageManager.prototype.turnOnEvents = function turnOnEvents() {
6949                            this.transferEvents = true;
6950                        };
6951
6952                        PageManager.prototype.turnOffEvents = function turnOffEvents() {
6953                            var mouseup = _libs.$.Event('mouseup'),
6954                                mouseout = _libs.$.Event('mouseout');
6955                            this.pageCache.forEach(function (ent) {
6956                                var object = ent[1];
6957                                if (object.simulate) {
6958                                    object.simulate(mouseup, undefined, 0, 0);
6959                                    object.simulate(mouseout, undefined, 0, 0);
6960                                }
6961                            });
6962                            this.transferEvents = false;
6963                        };
6964
6965                        PageManager.prototype.transferEventToTexture = function transferEventToTexture(n, e, data) {
6966                            var _this4 = this;
6967
6968                            if (this.transferEvents) {
6969                                var toObject = this.getOrLoadTextureObject(undefined, n);
6970                                if (toObject.wrapper) {
6971                                    (function () {
6972                                        var uv = data.uv,
6973                                            toDoc = toObject.wrapper.getSimulatedDoc();
6974                                        _this4.pageCache.forEach(function (ent) {
6975                                            var object = ent[1];
6976                                            if (object.simulate) {
6977                                                object.simulate(e, toDoc, uv.x, uv.y);
6978                                            }
6979                                        });
6980                                    })();
6981                                }
6982                            }
6983                        };
6984
6985                        PageManager.prototype.loadPredictedPages = function loadPredictedPages() {
6986                            this.predictedRequests = _BaseMathUtils2.default.predict(this.pageRequests, this.p.preloadPages);
6987                            for (var _iterator7 = this.predictedRequests, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator](); ;) {
6988                                var _ref7;
6989
6990                                if (_isArray7) {
6991                                    if (_i7 >= _iterator7.length) break;
6992                                    _ref7 = _iterator7[_i7++];
6993                                } else {
6994                                    _i7 = _iterator7.next();
6995                                    if (_i7.done) break;
6996                                    _ref7 = _i7.value;
6997                                }
6998
6999                                var p = _ref7;
7000
7001                                if (p < this.book.getPages() && !this.pageCache.get(p)) {
7002                                    this.load(undefined, p);
7003                                }
7004                            }
7005                        };
7006
7007                        PageManager.prototype.addPageRequest = function addPageRequest(n) {
7008                            this.pageRequests.push(n);
7009                            if (this.pageRequests.length > this.p.pagesForPredicting) {
7010                                this.pageRequests.shift();
7011                            }
7012                            Promise.resolve().then(this.loadPredictedPages.bind(this));
7013                        };
7014
7015                        PageManager.prototype.setMaterial = function setMaterial(o, material) {
7016                            this.pageCache.forEach(function (e) {
7017                                var ob = e[1];
7018                                if (o !== ob && ob.material === material) {
7019                                    delete ob.material;
7020                                }
7021                            });
7022                            if (material && material !== o.material) {
7023                                o.material = material;
7024                                this.setupMaterial(o);
7025                            }
7026                        };
7027
7028                        PageManager.prototype.setupMaterial = function setupMaterial(o) {
7029                            o.material.map = o.texture.image ? o.texture : this.loadingAnimation ? this.loading[o.color].texture : null;
7030                            if (!o.material.map) {
7031                                o.material.color = new _libs.THREE.Color(o.color);
7032                            }
7033                            o.material.needsUpdate = true;
7034                        };
7035
7036                        PageManager.prototype.getOrLoadTextureObject = function getOrLoadTextureObject(material, n) {
7037                            var object = this.pageCache.get(n);
7038                            if (!object) {
7039                                object = this.load(material, n);
7040                                this.addPageRequest(n);
7041                            } else {
7042                                this.setMaterial(object, material);
7043                            }
7044
7045                            return object;
7046                        };
7047
7048                        PageManager.prototype.setTexture = function setTexture(material, n) {
7049                            if (~this.predictedRequests.indexOf(n)) {
7050                                this.addPageRequest(n);
7051                            }
7052                            this.getOrLoadTextureObject(material, n);
7053                        };
7054
7055                        return PageManager;
7056                    }();
7057
7058                    exports.default = PageManager;
7059
7060                    /***/
7061                },
7062/* 34 */
7063/***/function (module, exports, __webpack_require__) {
7064
7065                    "use strict";
7066                    'use strict';
7067
7068                    exports.__esModule = true;
7069
7070                    var _BookPropsBuilder2 = __webpack_require__(9);
7071
7072                    var _BookPropsBuilder3 = _interopRequireDefault(_BookPropsBuilder2);
7073
7074                    var _Pdf = __webpack_require__(18);
7075
7076                    var _Pdf2 = _interopRequireDefault(_Pdf);
7077
7078                    function _interopRequireDefault(obj) {
7079                        return obj && obj.__esModule ? obj : { default: obj };
7080                    }
7081
7082                    function _classCallCheck(instance, Constructor) {
7083                        if (!(instance instanceof Constructor)) {
7084                            throw new TypeError("Cannot call a class as a function");
7085                        }
7086                    }
7087
7088                    function _possibleConstructorReturn(self, call) {
7089                        if (!self) {
7090                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7091                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
7092                    }
7093
7094                    function _inherits(subClass, superClass) {
7095                        if (typeof superClass !== "function" && superClass !== null) {
7096                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
7097                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
7097onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
7098                    }
7099
7100                    var PdfBookPropsBuilder = function (_BookPropsBuilder) {
7101                        _inherits(PdfBookPropsBuilder, _BookPropsBuilder);
7102
7103                        function PdfBookPropsBuilder(src, onReady) {
7104                            _classCallCheck(this, PdfBookPropsBuilder);
7105
7106                            var _this = _possibleConstructorReturn(this, _BookPropsBuilder.call(this, onReady));
7107
7108                            _this.pdf = new _Pdf2.default(src);
7109                            _this.pageDescription = {
7110                                type: 'pdf',
7111                                src: _this.pdf,
7112                                interactive: true
7113                            };
7114                            _this.binds = {
7115                                pageCallback: _this.pageCallback.bind(_this)
7116                            };
7117                            _this.pdf.getHandler(_this.init.bind(_this));
7118                            return _this;
7119                        }
7120
7121                        PdfBookPropsBuilder.prototype.dispose = function dispose() {
7122                            this.pdf.dispose();
7123                            _BookPropsBuilder.prototype.dispose.call(this);
7124                        };
7125
7126                        PdfBookPropsBuilder.prototype.init = function init(handler) {
7127                            var _this2 = this;
7128
7129                            var pages = this.pdf.getPagesNum();
7130                            this.calcSheets(pages);
7131                            if (pages > 0) {
7132                                handler.getPage(1).then(function (page) {
7133                                    var size = _Pdf2.default.getPageSize(page);
7134                                    _this2.calcProps(size.width, size.height);
7135                                    _this2.ready();
7136                                }).catch(function (e) {
7137                                    console.error(e);
7138                                });
7139                            } else {
7140                                this.props = this.defaults;
7141                                this.ready();
7142                            }
7143                        };
7144
7145                        PdfBookPropsBuilder.prototype.pageCallback = function pageCallback(n) {
7146                            return this.pageDescription;
7147                        };
7148
7149                        return PdfBookPropsBuilder;
7150                    }(_BookPropsBuilder3.default);
7151
7152                    exports.default = PdfBookPropsBuilder;
7153
7154                    /***/
7155                },
7156/* 35 */
7157/***/function (module, exports, __webpack_require__) {
7158
7159                    "use strict";
7160                    'use strict';
7161
7162                    exports.__esModule = true;
7163
7164                    var _libs = __webpack_require__(1);
7165
7166                    function _classCallCheck(instance, Constructor) {
7167                        if (!(instance instanceof Constructor)) {
7168                            throw new TypeError("Cannot call a class as a function");
7169                        }
7170                    }
7171
7172                    var PdfLinksHandler = function () {
7173                        function PdfLinksHandler(pdf, ctrl, element) {
7174                            _classCallCheck(this, PdfLinksHandler);
7175
7176                            this.pdf = pdf;
7177                            this.ctrl = ctrl;
7178                            this.element = (0, _libs.$)(element);
7179                            this.cursors = [];
7180                        }
7181
7182                        PdfLinksHandler.prototype.dispose = function dispose() { };
7183
7184                        PdfLinksHandler.prototype.setHandler = function setHandler(handler) {
7185                            this.handler = handler;
7186                        };
7187
7188                        PdfLinksHandler.prototype.defaultHandler = function defaultHandler(type, destination) {
7189                            if (type === 'internal') {
7190                                this.ctrl.goToPage(destination);
7191                            } else if (type === 'external') {
7192                                window.open(destination, '_blank');
7193                            }
7194                        };
7195
7196                        PdfLinksHandler.prototype.callHandlers = function callHandlers(type, destination) {
7197                            if (!this.handler || !this.handler(type, destination)) {
7198                                this.defaultHandler(type, destination);
7199                            }
7200                        };
7201
7202                        PdfLinksHandler.prototype.handleEvent = function handleEvent(data) {
7203                            var _this = this;
7204
7205                            var e = data.event,
7206                                anno = data.annotation;
7207                            switch (e.type) {
7208                                case 'mouseover':
7209                                    {
7210                                        this.cursors.push(this.element.css('cursor'));
7211                                        this.element.css('cursor', 'pointer');
7212                                        break;
7213                                    }
7214                                case 'mouseout':
7215                                    {
7216                                        this.element.css('cursor', this.cursors.pop() || '');
7217                                        break;
7218                                    }
7219                                case 'touchtap':
7220                                case 'click':
7221                                    {
7222                                        if (anno.url) {
7223                                            this.callHandlers('external', anno.url);
7224                                        } else if (anno.dest) {
7225                                            var destPromise = void 0;
7226                                            if (typeof anno.dest === 'string') {
7227                                                destPromise = this.pdf.handler.getDestination(anno.dest);
7228                                            } else {
7229                                                destPromise = Promise.resolve(anno.dest);
7230                                            }
7231                                            destPromise.then(function (dest) {
7232                                                return typeof dest[0] === 'number' ? dest[0] : _this.pdf.handler.getPageIndex(dest[0]);
7233                                            }).then(function (number) {
7234                                                return _this.callHandlers('internal', number);
7235                                            }).catch(function () {
7236                                                return console.error('Bad link');
7237                                            });
7238                                        }
7239                                        break;
7240                                    }
7241                            }
7242                        };
7243
7244                        return PdfLinksHandler;
7245                    }();
7246
7247                    exports.default = PdfLinksHandler;
7248
7249                    /***/
7250                },
7251/* 36 */
7252/***/function (module, exports, __webpack_require__) {
7253
7254                    "use strict";
7255                    'use strict';
7256
7257                    exports.__esModule = true;
7258
7259                    var _Finder = __webpack_require__(17);
7260
7261                    var _Finder2 = _interopRequireDefault(_Finder);
7262
7263                    function _interopRequireDefault(obj) {
7264                        return obj && obj.__esModule ? obj : { default: obj };
7265                    }
7266
7267                    function _classCallCheck(instance, Constructor) {
7268                        if (!(instance instanceof Constructor)) {
7269                            throw new TypeError("Cannot call a class as a function");
7270                        }
7271                    }
7272
7273                    var SearchEngine = function () {
7274                        function SearchEngine(pageCallback, pages) {
7275                            _classCallCheck(this, SearchEngine);
7276
7277                            this.pageCallback = pageCallback;
7278                            this.pages = pages;
7279                            this.results = [];
7280                        }
7281
7282                        SearchEngine.prototype.setQuery = function setQuery(query) {
7283                            this.query = query;
7284                            this.update = true;
7285                            this.process();
7286                        };
7287
7288                        SearchEngine.prototype.process = function process() {
7289                            var _this = this;
7290
7291                            if (this.update) {
7292                                var results = this.results;
7293                                this.results = [];
7294                                if (this.onPageHitsChanged) {
7295                                    for (var _iterator = results, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
7296                                        var _ref;
7297
7298                                        if (_isArray) {
7299                                            if (_i >= _iterator.length) break;
7300                                            _ref = _iterator[_i++];
7301                                        } else {
7302                                            _i = _iterator.next();
7303                                            if (_i.done) break;
7304                                            _ref = _i.value;
7305                                        }
7306
7307                                        var res = _ref;
7308
7309                                        this.onPageHitsChanged(undefined, '');
7310                                    }
7311                                }
7312                                this.update = false;
7313                                this.page = 0;
7314                                this.stamp = Date.now();
7315                                if (this.query.length > 1) {
7316                                    this.process();
7317                                }
7318                            } else {
7319                                if (this.page < this.pages) {
7320                                    (function () {
7321                                        var stamp = _this.stamp;
7322                                        _this.find(_this.pageCallback(_this.page)).then(function (contexts) {
7323                                            if (stamp === _this.stamp) {
7324                                                if (contexts.length) {
7325                                                    _this.results.push({
7326                                                        page: _this.page,
7327                                                        contexts: contexts
7328                                                    });
7329                                                }
7330                                                ++_this.page;
7331                                                if (_this.onPageHitsChanged) {
7332                                                    _this.onPageHitsChanged(_this.page, _this.query);
7333                                                }
7334                                                _this.process();
7335                                            }
7336                                        });
7337                                    })();
7338                                }
7339                            }
7340                        };
7341
7342                        SearchEngine.prototype.find = function find(pi) {
7343                            var _this2 = this;
7344
7345                            var next = void 0;
7346                            if (pi.type === 'pdf') {
7347                                next = new Promise(function (resolve) {
7348                                    pi.src.getHandler(function () {
7349                                        var n = pi.number === undefined ? _this2.page : pi.number;
7350                                        if (pi.src.getPageType(n) === 'right') {
7351                                            resolve([]);
7352                                        } else {
7353                                            pi.src.getPage(n).then(function (page) {
7354                                                page.getTextContent().then(function (textContent) {
7355                                                    resolve(new _Finder2.default(textContent.items.map(function (item) {
7356                                                        return item.str;
7357                                                    }), _this2.query, { hits: false }).getContexts());
7358                                                });
7359                                            }).catch(function () {
7360                                                return resolve([]);
7361                                            });
7362                                        }
7363                                    });
7364                                });
7365                            } else {
7366                                next = Promise.resolve([]);
7367                            }
7368                            return next;
7369                        };
7370
7371                        return SearchEngine;
7372                    }();
7373
7374                    exports.default = SearchEngine;
7375
7376                    /***/
7377                },
7378/* 37 */
7379/***/function (module, exports, __webpack_require__) {
7380
7381                    "use strict";
7382                    'use strict';
7383
7384                    exports.__esModule = true;
7385
7386                    var _CSSLayer = __webpack_require__(13);
7387
7388                    var _CSSLayer2 = _interopRequireDefault(_CSSLayer);
7389
7390                    function _interopRequireDefault(obj) {
7391                        return obj && obj.__esModule ? obj : { default: obj };
7392                    }
7393
7394                    function _classCallCheck(instance, Constructor) {
7395                        if (!(instance instanceof Constructor)) {
7396                            throw new TypeError("Cannot call a class as a function");
7397                        }
7398                    }
7399
7400                    var SheetCssLayer = function () {
7401                        function SheetCssLayer(visual, block, props) {
7402                            _classCallCheck(this, SheetCssLayer);
7403
7404                            this.visual = visual;
7405                            var size = block.getTopSize();
7406                            this.layer = new _CSSLayer2.default(size.width, size.height, props);
7407
7408                            this.update(block);
7409                            this.visual.addCssObject(this.layer);
7410                        }
7411
7412                        SheetCssLayer.prototype.dispose = function dispose() {
7413                            this.layer.dispose();
7414                            this.visual.removeCssObject(this.layer);
7415                        };
7416
7417                        SheetCssLayer.prototype.isHidden = function isHidden() {
7418                            return this.layer.isHidden();
7419                        };
7420
7421                        SheetCssLayer.prototype.hide = function hide() {
7422                            return this.layer.hide();
7423                        };
7424
7425                        SheetCssLayer.prototype.show = function show() {
7426                            return this.layer.show();
7427                        };
7428
7429                        SheetCssLayer.prototype.set = function set(css, html, js) {
7430                            this.layer.setData(css, html, js);
7431                        };
7432
7433                        SheetCssLayer.prototype.update = function update(block) {
7434                            this.block = block;
7435                            this.block.getTopWorldRotation(this.layer.rotation);
7436                            this.block.getTopWorldPosition(this.layer.position);
7437                        };
7438
7439                        return SheetCssLayer;
7440                    }();
7441
7442                    exports.default = SheetCssLayer;
7443
7444                    /***/
7445                },
7446/* 38 */
7447/***/function (module, exports, __webpack_require__) {
7448
7449                    "use strict";
7450                    'use strict';
7451
7452                    exports.__esModule = true;
7453
7454                    var _extends = Object.assign || function (target) {
7455                        for (var i = 1; i < arguments.length; i++) {
7456                            var source = arguments[i]; for (var key in source) {
7457                                if (Object.prototype.hasOwnProperty.call(source, key)) {
7458                                    target[key] = source[key];
7459                                }
7460                            }
7461                        } return target;
7462                    };
7463
7464                    var _MathUtils = __webpack_require__(3);
7465
7466                    var _MathUtils2 = _interopRequireDefault(_MathUtils);
7467
7468                    function _interopRequireDefault(obj) {
7469                        return obj && obj.__esModule ? obj : { default: obj };
7470                    }
7471
7472                    function _classCallCheck(instance, Constructor) {
7473                        if (!(instance instanceof Constructor)) {
7474                            throw new TypeError("Cannot call a class as a function");
7475                        }
7476                    }
7477
7478                    var SheetPhysics = function () {
7479                        SheetPhysics.targetForceClb = function targetForceClb(o, a, v, ch) {
7480                            var l = a * this.r;
7481                            return 100 * this.m * this.g * (2 / (1 + Math.exp(10 * (l - this.tl))) - 1) - this.m * 40 * v;
7482                        };
7483
7484                        SheetPhysics.hoverCornerForceClb = function hoverCornerForceClb(o, v, l, ch) {
7485                            return 5;
7486                        };
7487
7488                        SheetPhysics.prototype.getTargetForceClb = function getTargetForceClb(mass, targetAngle) {
7489                            return SheetPhysics.targetForceClb.bind({
7490                                g: this.p.gravity,
7491                                m: mass,
7492                                tl: targetAngle * this.p.r,
7493                                r: this.p.r
7494                            });
7495                        };
7496
7497                        SheetPhysics.dragForceClb = function dragForceClb(o, a, v, ch) {
7498                            return o.flbt * o.m * (10 * o.g * ch - 50 * v / (1 + Math.exp(3.5 * Math.abs(ch))));
7499                        };
7500
7501                        SheetPhysics.dragCornerForceClb = function dragCornerForceClb(o, a, v, ch) {
7502                            return 15 * (2 / (1 + Math.exp(10 * (a - this.ta) * o.r)) - 1);
7503                        };
7504
7505                        SheetPhysics.getDragCornerForceClb = function getDragCornerForceClb(targetAngle) {
7506                            return SheetPhysics.dragCornerForceClb.bind({
7507                                ta: targetAngle
7508                            });
7509                        };
7510
7511                        function SheetPhysics() {
7512                            var r = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
7513                            var gravity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
7514                            var cornerDeviation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.15;
7515                            var fps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 240;
7516
7517                            _classCallCheck(this, SheetPhysics);
7518
7519                            this.p = {
7520                                r: r,
7521                                cornerDeviation: cornerDeviation,
7522                                l: Math.PI * r,
7523                                startDt: 1 / fps,
7524                                gravity: gravity,
7525                                margin: 0.002 * r,
7526                                infM: 1e4,
7527                                attempts: 16,
7528                                maxIterations: 100
7529                            };
7530                            this.os = [];
7531                        }
7532
7533                        SheetPhysics.prototype.dispose = function dispose() {
7534                            this.os = [];
7535                        };
7536
7537                        SheetPhysics.prototype.getSize = function getSize() {
7538                            return this.os.length;
7539                        };
7540
7541                        SheetPhysics.prototype.addObject = function addObject(mass, angle, velocity, flexibility, cornerHeight, simulateClb, removeClb) {
7542                            var forceClb = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : function () {
7543                                return 0;
7544                            };
7545                            var cornerForceClb = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : function () {
7546                                return 0;
7547                            };
7548
7549                            var no = {
7550                                id: _MathUtils2.default.getUnique(),
7551                                m: mass,
7552                                v: velocity,
7553                                l: angle * this.p.r,
7554                                f: forceClb,
7555                                cf: cornerForceClb,
7556                                ch: cornerHeight,
7557                                flbt: flexibility,
7558                                simulateClb: simulateClb,
7559                                removeClb: removeClb
7560                            };
7561                            var i = this.os.findIndex(function (o) {
7562                                return no.l <= o.l;
7563                            });
7564                            i = ~i ? i : this.os.length;
7565                            this.os.splice(i, 0, no);
7566                            return no.id;
7567                        };
7568
7569                        SheetPhysics.prototype.getParametrMap = function getParametrMap(name) {
7570                            var map = {
7571                                mass: 'm',
7572                                velocity: 'v',
7573                                flexibility: 'flbt',
7574                                cornerHeight: 'ch',
7575                                simulateClb: 'simulateClb',
7576                                removeClb: 'removeClb',
7577                                forceClb: 'f',
7578                                cornerForceClb: 'cf'
7579                            };
7580                            return map[name];
7581                        };
7582
7583                        SheetPhysics.prototype.setParametr = function setParametr(id, name, value) {
7584                            var o = this.os.find(function (o) {
7585                                return o.id === id;
7586                            });
7587                            if (name === 'angle') {
7588                                o.l = value * this.p.r;
7589                            } else {
7590                                o[this.getParametrMap(name)] = value;
7591                            }
7592                        };
7593
7594                        SheetPhysics.prototype.getParametr = function getParametr(id, name) {
7595                            var o = this.os.find(function (o) {
7596                                return o.id === id;
7597                            });
7598                            var value = void 0;
7599                            if (name === 'angle') {
7600                                value = o.l / this.p.r;
7601                            } else {
7602                                value = o[this.getParametrMap(name)];
7603                            }
7604                            return value;
7605                        };
7606
7607                        SheetPhysics.prototype.simulate = function simulate(T) {
7608                            var t = 0,
7609                                dt = this.p.startDt,
7610                                attempt = 0,
7611                                it = 0;
7612
7613                            while (t < T && it < this.p.maxIterations) {
7614                                if (dt > T - t) {
7615                                    dt = T - t;
7616                                }
7617                                var nos = this.integrate(this.os, dt),
7618                                    ci = this.findCollisions(nos);
7619                                if (ci.num > 1 && attempt < this.p.attempts) {
7620                                    dt /= 2;
7621                                    ++attempt;
7622                                } else {
7623                                    if (ci.num === 1) {
7624                                        var scos = this.solveCollision(nos[ci.last - 1], nos[ci.last]);
7625                                        nos[ci.last - 1] = scos[0];
7626                                        nos[ci.last] = scos[1];
7627                                    } else if (ci.num > 1) {
7628                                        var gs = [];
7629                                        var last = -2;
7630                                        for (var _iterator = ci.all, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
7631                                            var _ref;
7632
7633                                            if (_isArray) {
7634                                                if (_i >= _iterator.length) break;
7635                                                _ref = _iterator[_i++];
7636                                            } else {
7637                                                _i = _iterator.next();
7638                                                if (_i.done) break;
7639                                                _ref = _i.value;
7640                                            }
7641
7642                                            var i = _ref;
7643
7644                                            if (i - last > 1) {
7645                                                gs.push([]);
7646                                            }
7647                                            gs[gs.length - 1].push(i);
7648                                            last = i;
7649                                        }
7650                                        for (var _iterator2 = gs, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
7651                                            var _ref2;
7652
7653                                            if (_isArray2) {
7654                                                if (_i2 >= _iterator2.length) break;
7655                                                _ref2 = _iterator2[_i2++];
7656                                            } else {
7657                                                _i2 = _iterator2.next();
7658                                                if (_i2.done) break;
7659                                                _ref2 = _i2.value;
7660                                            }
7661
7662                                            var g = _ref2;
7663
7664                                            var sg = void 0,
7665                                                i0 = void 0;
7666                                            if (nos[g[0]].l > Math.PI / 2 * this.p.r) {
7667                                                sg = -1;
7668                                                i0 = g[g.length - 1];
7669                                            } else {
7670                                                sg = 1;
7671                                                i0 = g[0];
7672                                            }
7673                                            for (var _i3 = i0; _i3 < nos.length && _i3 > -1; _i3 += sg) {
7674                                                var o = nos[_i3 + sg];
7675                                                if (o && sg * (o.l - nos[_i3].l) <= this.p.margin) {
7676                                                    o.l = nos[_i3].l + sg * 2 * this.p.margin;
7677                                                    if (o.l > this.p.l || o.l < 0) {
7678                                                        o.l = o.l > this.p.l ? this.p.l : 0;
7679                                                        o.ch = 0;
7680                                                        o.v = 0;
7681                                                        console.error('Bad collision');
7682                                                    }
7683                                                } else {
7684                                                    break;
7685                                                }
7686                                            }
7687                                        }
7688                                    }
7689                                    this.os = nos;
7690                                    this.findAndSolveCornerCollisions();
7691                                    t += dt;
7692                                    dt = this.p.startDt;
7693                                    attempt = 0;
7694                                }
7695                                ++it;
7696                            }
7697
7698                            this.removeStatics();
7699                        };
7700
7701                        SheetPhysics.prototype.removeStatics = function removeStatics() {
7702                            var nos = [],
7703                                notify = [[], []];
7704                            for (var _iterator3 = this.os, _isArray3 = Array.isArray(_iterator3), _i4 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
7705                                var _ref3;
7706
7707                                if (_isArray3) {
7708                                    if (_i4 >= _iterator3.length) break;
7709                                    _ref3 = _iterator3[_i4++];
7710                                } else {
7711                                    _i4 = _iterator3.next();
7712                                    if (_i4.done) break;
7713                                    _ref3 = _i4.value;
7714                                }
7715
7716                                var o = _ref3;
7717
7718                                if (o.simulateClb) {
7719                                    o.simulateClb(o.l / this.p.r, o.ch);
7720                                }
7721                                if ((o.l === this.p.l || o.l === 0) && o.v === 0) {
7722                                    if (o.removeClb !== undefined) {
7723                                        notify[(o.l !== this.p.l) + 0].push(o);
7724                                    }
7725                                } else {
7726                                    nos.push(o);
7727                                }
7728                            }
7729                            this.os = nos;
7730                            for (var _iterator4 = notify[0].reverse(), _isArray4 = Array.isArray(_iterator4), _i5 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
7731                                var _ref4;
7732
7733                                if (_isArray4) {
7734                                    if (_i5 >= _iterator4.length) break;
7735                                    _ref4 = _iterator4[_i5++];
7736                                } else {
7737                                    _i5 = _iterator4.next();
7738                                    if (_i5.done) break;
7739                                    _ref4 = _i5.value;
7740                                }
7741
7742                                var _o = _ref4;
7743
7744                                _o.removeClb(Math.PI, _o.ch);
7745                            }
7746                            for (var _iterator5 = notify[1], _isArray5 = Array.isArray(_iterator5), _i6 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator](); ;) {
7747                                var _ref5;
7748
7749                                if (_isArray5) {
7750                                    if (_i6 >= _iterator5.length) break;
7751                                    _ref5 = _iterator5[_i6++];
7752                                } else {
7753                                    _i6 = _iterator5.next();
7754                                    if (_i6.done) break;
7755                                    _ref5 = _i6.value;
7756                                }
7757
7758                                var _o2 = _ref5;
7759
7760                                _o2.removeClb(0, _o2.ch);
7761                            }
7762                        };
7763
7764                        SheetPhysics.prototype.findAndSolveCornerCollisions = function findAndSolveCornerCollisions() {
7765                            if (this.os.length) {
7766                                var os = [_extends({}, this.os[0], {
7767                                    l: 0,
7768                                    m: this.p.infM,
7769                                    ch: 0
7770                                })].concat(this.os, [_extends({}, this.os[0], {
7771                                    l: 1.05 * this.p.l,
7772                                    m: this.p.infM,
7773                                    ch: 0
7774                                })]);
7775
7776                                for (var i = 1; i < os.length; ++i) {
7777                                    var a = os[i - 1],
7778                                        b = os[i],
7779                                        al = a.l + this.p.cornerDeviation * a.ch * this.p.r,
7780                                        bl = b.l + this.p.cornerDeviation * b.ch * this.p.r;
7781                                    if (1.05 * al > bl && a.ch > b.ch) {
7782                                        var dCh = a.ch - b.ch,
7783                                            dv = a.m / a.flbt + b.m / b.flbt,
7784                                            ka = a.m / a.flbt / dv,
7785                                            kb = b.m / b.flbt / dv;
7786                                        a.ch = a.ch - kb * dCh;
7787                                        b.ch = b.ch + ka * dCh;
7788                                    }
7789                                }
7790                            }
7791                        };
7792
7793                        SheetPhysics.prototype.solveCollision = function solveCollision(a, b) {
7794                            var mm = b.m + a.m,
7795                                av = (-a.v * b.m + a.m * a.v + 2 * b.m * b.v) / mm,
7796                                bv = (b.m * b.v - b.v * a.m + 2 * a.m * a.v) / mm;
7797                            return [_extends({}, a, { v: av }), _extends({}, b, { v: bv })];
7798                        };
7799
7800                        SheetPhysics.prototype.findCollisions = function findCollisions(os) {
7801                            var ci = {
7802                                num: 0,
7803                                last: 0,
7804                                all: []
7805                            };
7806                            for (var i = 1; i < os.length && ci.num < 2; ++i) {
7807                                if (os[i - 1].l > os[i].l || this.isCollision(os[i - 1], os[i])) {
7808                                    if (os[i - 1].l > os[i].l) {
7809                                        ++ci.num;
7810                                    }
7811                                    ++ci.num;
7812                                    ci.last = i;
7813                                    if (ci.all.indexOf(i - 1) === -1) {
7814                                        ci.all.push(i - 1);
7815                                    }
7816                                    if (ci.all.indexOf(i) === -1) {
7817                                        ci.all.push(i);
7818                                    }
7819                                }
7820                            }
7821                            return ci;
7822                        };
7823
7824                        SheetPhysics.prototype.isCollision = function isCollision(a, b) {
7825                            return Math.abs(a.l - b.l) < this.p.margin && a.v > b.v;
7826                        };
7827
7828                        SheetPhysics.prototype.integrate = function integrate(os, dt) {
7829                            var nos = [];
7830                            for (var _iterator6 = os, _isArray6 = Array.isArray(_iterator6), _i7 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator](); ;) {
7831                                var _ref6;
7832
7833                                if (_isArray6) {
7834                                    if (_i7 >= _iterator6.length) break;
7835                                    _ref6 = _iterator6[_i7++];
7836                                } else {
7837                                    _i7 = _iterator6.next();
7838                                    if (_i7.done) break;
7839                                    _ref6 = _i7.value;
7840                                }
7841
7842                                var o = _ref6;
7843
7844                                var vl = _MathUtils2.default.rk4(this.dy.bind({
7845                                    g: this.p.gravity,
7846                                    r: this.p.r,
7847                                    m: o.m,
7848                                    f: o.f,
7849                                    cf: o.cf,
7850                                    ch: o.ch,
7851                                    flbt: o.flbt
7852                                }), 0, dt, [o.v, o.l, o.ch]);
7853                                var no = _extends({}, o, {
7854                                    v: vl[0],
7855                                    l: vl[1],
7856                                    ch: vl[2]
7857                                });
7858                                if (no.l <= 0 || no.l >= this.p.l) {
7859                                    no.l = no.l <= 0 ? 0 : this.p.l;
7860                                    no.v = 0;
7861                                    no.ch = 0;
7862                                }
7863                                nos.push(no);
7864                            }
7865                            return nos;
7866                        };
7867
7868                        SheetPhysics.prototype.dy = function dy(t, y) {
7869                            var v = y[0],
7870                                l = y[1],
7871                                ch = y[2],
7872                                f = this.f(this, l / this.r, v, ch),
7873                                cf = this.cf(this, l / this.r, v, ch);
7874                            return [(-this.g * Math.cos(l / this.r) * this.m + f) / this.m, v + 0.01 * (Math.random() - 0.5), this.flbt * ((2 / (1 + Math.exp(-0.2 * cf)) - 1) * (1 - 2 / (1 + Math.exp(-5 * (Math.abs(ch) - 2)))) - ch)];
7875                        };
7876
7877                        return SheetPhysics;
7878                    }();
7879
7880                    exports.default = SheetPhysics;
7881
7882                    /***/
7883                },
7884/* 39 */
7885/***/function (module, exports) {
7886
7887                    "use strict";
7888                    'use strict';
7889
7890                    exports.__esModule = true;
7891
7892                    function _classCallCheck(instance, Constructor) {
7893                        if (!(instance instanceof Constructor)) {
7894                            throw new TypeError("Cannot call a class as a function");
7895                        }
7896                    }
7897
7898                    var SoundsEnviroment = function () {
7899                        function SoundsEnviroment() {
7900                            var template = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7901
7902                            _classCallCheck(this, SoundsEnviroment);
7903
7904                            this.sounds = template.sounds || {};
7905                            this.audio = {};
7906                            if (this.sounds.startFlip) {
7907                                this.audio.startFlip = new Audio(this.sounds.startFlip);
7908                            }
7909                            if (this.sounds.endFlip) {
7910                                this.audio.endFlip = new Audio(this.sounds.endFlip);
7911                            }
7912                        }
7913
7914                        SoundsEnviroment.prototype.setEnabled = function setEnabled(enabled) {
7915                            this.enabled = enabled;
7916                        };
7917
7918                        SoundsEnviroment.prototype.togle = function togle() {
7919                            this.enabled = !this.enabled;
7920                        };
7921
7922                        SoundsEnviroment.prototype.dispose = function dispose() {
7923                            delete this.audio.startFlip;
7924                            delete this.audio.endFlip;
7925                        };
7926
7927                        SoundsEnviroment.prototype.startFlip = function startFlip() {
7928                            if (this.enabled && this.audio.startFlip) {
7929                                this.audio.startFlip.play();
7930                            }
7931                        };
7932
7933                        SoundsEnviroment.prototype.endFlip = function endFlip() {
7934                            if (this.enabled && this.audio.startFlip) {
7935                                this.audio.startFlip.pause();
7936                                this.audio.startFlip.currentTime = 0;
7937                            }
7938                            if (this.enabled && this.audio.endFlip) {
7939                                this.audio.endFlip.play();
7940                            }
7941                        };
7942
7943                        SoundsEnviroment.prototype.subscribeFlips = function subscribeFlips(emitter) {
7944                            emitter.addEventListener('startFlip', this.startFlip.bind(this));
7945                            emitter.addEventListener('endFlip', this.endFlip.bind(this));
7946                        };
7947
7948                        return SoundsEnviroment;
7949                    }();
7950
7951                    exports.default = SoundsEnviroment;
7952
7953                    /***/
7954                },
7955/* 40 */
7956/***/function (module, exports, __webpack_require__) {
7957
7958                    "use strict";
7959                    'use strict';
7960
7961                    exports.__esModule = true;
7962
7963                    var _WidgetController2 = __webpack_require__(67);
7964
7965                    var _WidgetController3 = _interopRequireDefault(_WidgetController2);
7966
7967                    function _interopRequireDefault(obj) {
7968                        return obj && obj.__esModule ? obj : { default: obj };
7969                    }
7970
7971                    function _classCallCheck(instance, Constructor) {
7972                        if (!(instance instanceof Constructor)) {
7973                            throw new TypeError("Cannot call a class as a function");
7974                        }
7975                    }
7976
7977                    function _possibleConstructorReturn(self, call) {
7978                        if (!self) {
7979                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7980                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
7981                    }
7982
7983                    function _inherits(subClass, superClass) {
7984                        if (typeof superClass !== "function" && superClass !== null) {
7985                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
7986                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
7986onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
7987                    }
7988
7989                    var TocController = function (_WidgetController) {
7990                        _inherits(TocController, _WidgetController);
7991
7992                        function TocController(view, bookCtrl) {
7993                            _classCallCheck(this, TocController);
7994
7995                            var _this = _possibleConstructorReturn(this, _WidgetController.call(this, view));
7996
7997                            _this.bookCtrl = bookCtrl;
7998                            _this.tab = 'none';
7999                            return _this;
8000                        }
8001
8002                        TocController.prototype.setThumbnails = function setThumbnails(thumbnails) {
8003                            this.thumbnails = thumbnails;
8004                            thumbnails.onNavigate = this.navigateThumbnails.bind(this);
8005                            if (this.tab === 'none') {
8006                                this.tab = 'thumbnails';
8007                            }
8008                            this.fireChange();
8009                        };
8010
8011                        TocController.prototype.setSearch = function setSearch(search) {
8012                            this.search = search;
8013                            search.onNavigate = this.navigateSearch.bind(this);
8014                            this.fireChange();
8015                        };
8016
8017                        TocController.prototype.setBookmarks = function setBookmarks(bookmarks, pdf) {
8018                            this.bookmarks = bookmarks;
8019                            this.pdf = pdf;
8020                            bookmarks.onNavigate = this.navigateBookmarks.bind(this);
8021                            if (bookmarks.getSize()) {
8022                                this.tab = 'bookmarks';
8023                                this.isBookmarks = true;
8024                            }
8025                            this.fireChange();
8026                        };
8027
8028                        TocController.prototype.cmdBookmarks = function cmdBookmarks() {
8029                            this.tab = 'bookmarks';
8030                            this.fireChange();
8031                        };
8032
8033                        TocController.prototype.cmdThumbnails = function cmdThumbnails() {
8034                            this.tab = 'thumbnails';
8035                            this.fireChange();
8036                        };
8037
8038                        TocController.prototype.cmdSearch = function cmdSearch() {
8039                            this.tab = 'search';
8040                            this.fireChange();
8041                        };
8042
8043                        TocController.prototype.cmdCloseToc = function cmdCloseToc() {
8044                            this.hide();
8045                        };
8046
8047                        TocController.prototype.navigateThumbnails = function navigateThumbnails(number) {
8048                            this.bookCtrl.goToPage(number);
8049                        };
8050
8051                        TocController.prototype.navigateSearch = function navigateSearch(number) {
8052                            this.bookCtrl.goToPage(number);
8053                        };
8054
8055                        TocController.prototype.navigateBookmarks = function navigateBookmarks(item) {
8056                            var _this2 = this;
8057
8058                            if (item.url) {
8059                                window.open(item.url, '_blank');
8060                            } else if (item.dest) {
8061                                var destPromise = void 0;
8062                                if (typeof item.dest === 'string') {
8063                                    destPromise = this.pdf.handler.getDestination(item.dest);
8064                                } else {
8065                                    destPromise = Promise.resolve(item.dest);
8066                                }
8067                                destPromise.then(function (dest) {
8068                                    return _this2.pdf.handler.getPageIndex(dest[0]);
8069                                }).then(function (number) {
8070                                    return _this2.bookCtrl.goToPage(number);
8071                                }).catch(function () {
8072                                    return console.error('Bad bookmark');
8073                                });
8074                            }
8075                        };
8076
8077                        TocController.prototype.updateView = function updateView() {
8078                            var _this3 = this;
8079
8080                            if (this.view) {
8081                                this.view.setState('widTocMenu', {
8082                                    enable: true,
8083                                    visible: true,
8084                                    active: false
8085                                });
8086                                this.view.setState('widThumbnails', {
8087                                    enable: true,
8088                                    visible: this.tab === 'thumbnails',
8089                                    active: false
8090                                });
8091                                this.view.setState('widSearch', {
8092                                    enable: true,
8093                                    visible: this.tab === 'search',
8094                                    active: false
8095                                });
8096                                this.view.setState('widBookmarks', {
8097                                    enable: true,
8098                                    visible: this.tab === 'bookmarks',
8099                                    active: false
8100                                });
8101                                this.view.setState('cmdBookmarks', {
8102                                    enable: true,
8103                                    visible: true,
8104                                    active: this.tab === 'bookmarks'
8105                                });
8106                                this.view.setState('cmdCloseToc', {
8107                                    enable: true,
8108                                    visible: true,
8109                                    active: false
8110                                });
8111                                this.view.setState('cmdThumbnails', {
8112                                    enable: true,
8113                                    visible: true,
8114                                    active: this.tab === 'thumbnails'
8115                                });
8116                                this.view.setState('cmdSearch', {
8117                                    enable: true,
8118                                    visible: true,
8119                                    active: this.tab === 'search'
8120                                });
8121                                Promise.resolve().then(function () {
8122                                    return _this3.thumbnails.setEnable(_this3.visible && _this3.tab === 'thumbnails');
8123                                });
8124                                _WidgetController.prototype.updateView.call(this);
8125                            }
8126                        };
8127
8128                        return TocController;
8129                    }(_WidgetController3.default);
8130
8131                    exports.default = TocController;
8132
8133                    /***/
8134                },
8135/* 41 */
8136/***/function (module, exports, __webpack_require__) {
8137
8138                    "use strict";
8139                    'use strict';
8140
8141                    exports.__esModule = true;
8142
8143                    var _libs = __webpack_require__(1);
8144
8145                    var _ThreeUtils = __webpack_require__(20);
8146
8147                    var _ThreeUtils2 = _interopRequireDefault(_ThreeUtils);
8148
8149                    function _interopRequireDefault(obj) {
8150                        return obj && obj.__esModule ? obj : { default: obj };
8151                    }
8152
8153                    var resX = 11,
8154                        resY = 2,
8155                        resZ = 15,
8156                        scale = 1,
8157                        faces = [];
8158
8159                    var frontGeometry = new _libs.THREE.PlaneGeometry(scale, scale, resX - 1, resY - 1);
8160                    frontGeometry.translate(0.5 * scale, 0.5 * scale, scale);
8161                    var backGeometry = new _libs.THREE.PlaneGeometry(scale, scale, resX - 1, resY - 1);
8162                    backGeometry.rotateY(Math.PI);
8163                    backGeometry.translate(0.5 * scale, 0.5 * scale, 0);
8164                    var leftGeometry = new _libs.THREE.PlaneGeometry(scale, scale, resZ - 1, resY - 1);
8165                    leftGeometry.rotateY(-Math.PI / 2);
8166                    leftGeometry.translate(0, 0.5 * scale, 0.5 * scale);
8167                    var rightGeometry = new _libs.THREE.PlaneGeometry(scale, scale, resZ - 1, resY - 1);
8168                    rightGeometry.rotateY(Math.PI / 2);
8169                    rightGeometry.translate(scale, 0.5 * scale, 0.5 * scale);
8170                    var topGeometry = new _libs.THREE.PlaneGeometry(scale, scale, resX - 1, resZ - 1);
8171                    topGeometry.rotateX(-Math.PI / 2);
8172                    topGeometry.translate(0.5 * scale, scale, 0.5 * scale);
8173                    var bottomGeometry = topGeometry.clone();
8174                    bottomGeometry.translate(0, -scale, 0);
8175                    for (var _iterator = bottomGeometry.faces, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
8176                        var _ref;
8177
8178                        if (_isArray) {
8179                            if (_i >= _iterator.length) break;
8180                            _ref = _iterator[_i++];
8181                        } else {
8182                            _i = _iterator.next();
8183                            if (_i.done) break;
8184                            _ref = _i.value;
8185                        }
8186
8187                        var f = _ref;
8188                        var _ref3 = [f.b, f.a];
8189                        f.a = _ref3[0];
8190                        f.b = _ref3[1];
8191                    }
8192
8193                    var geometry = new _libs.THREE.Geometry();
8194                    geometry.vertices = [].concat(bottomGeometry.vertices, topGeometry.vertices);
8195
8196                    var addFaces = function addFaces(fs, map) {
8197                        for (var _iterator2 = fs, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
8198                            var _ref2;
8199
8200                            if (_isArray2) {
8201                                if (_i2 >= _iterator2.length) break;
8202                                _ref2 = _iterator2[_i2++];
8203                            } else {
8204                                _i2 = _iterator2.next();
8205                                if (_i2.done) break;
8206                                _ref2 = _i2.value;
8207                            }
8208
8209                            var f = _ref2;
8210
8211                            geometry.faces.push(new _libs.THREE.Face3(map(f.a), map(f.b), map(f.c)));
8212                        }
8213                        faces.push(geometry.faces.length);
8214                    };
8215
8216                    var mapVertices = function mapVertices(src, dst) {
8217                        var map = [];
8218                        var eq = function eq(a, b) {
8219                            return Math.abs(a.x - b.x) + Math.abs(a.y - b.y) + Math.abs(a.z - b.z) < 1e-4;
8220                        };
8221                        for (var i = 0; i < src.length; ++i) {
8222                            for (var j = 0; j < dst.length; ++j) {
8223                                if (eq(src[i], dst[j])) {
8224                                    map[i] = j;
8225                                    break;
8226                                }
8227                            }
8228                        }
8229                        return map;
8230                    };
8231
8232                    var frontMap = mapVertices(frontGeometry.vertices, geometry.vertices);
8233                    var backMap = mapVertices(backGeometry.vertices, geometry.vertices);
8234                    var leftMap = mapVertices(leftGeometry.vertices, geometry.vertices);
8235                    var rightMap = mapVertices(rightGeometry.vertices, geometry.vertices);
8236
8237                    addFaces(topGeometry.faces, function (i) {
8238                        return i + bottomGeometry.vertices.length;
8239                    });
8240                    addFaces(bottomGeometry.faces, function (i) {
8241                        return i;
8242                    });
8243                    addFaces(frontGeometry.faces, function (i) {
8244                        return frontMap[i];
8245                    });
8246                    addFaces(backGeometry.faces, function (i) {
8247                        return backMap[i];
8248                    });
8249                    addFaces(leftGeometry.faces, function (i) {
8250                        return leftMap[i];
8251                    });
8252                    addFaces(rightGeometry.faces, function (i) {
8253                        return rightMap[i];
8254                    });
8255                    faces.pop();
8256
8257                    _ThreeUtils2.default.computeFaceVertexUvs(geometry, faces);
8258
8259                    geometry.computeVertexNormals();
8260                    //geometry.computeFaceNormals();
8261                    geometry.computeBoundingSphere();
8262                    //geometry.computeBoundingBox();
8263                    geometry.verticesNeedUpdate = true;
8264
8265                    exports.default = {
8266                        resX: resX,
8267                        resY: resY,
8268                        resZ: resZ,
8269                        faces: faces,
8270                        geometry: geometry
8271                    };
8272
8273                    /***/
8274                },
8275/* 42 */
8276/***/function (module, exports) {
8277
8278                    "use strict";
8279                    'use strict';
8280
8281                    exports.__esModule = true;
8282                    exports.props = props;
8283                    var mouseButtons = {
8284                        Left: 0,
8285                        Middle: 1,
8286                        Right: 2
8287                    };
8288
8289                    function props() {
8290                        return {
8291                            eps: 1e-4,
8292                            skin: {
8293                                default: 'short-white-book-view'
8294                            },
8295                            scale: {
8296                                default: 0.9,
8297                                min: 0.9,
8298                                max: 2.5,
8299                                levels: 7
8300                            },
8301                            lighting: {
8302                                default: 0.7,
8303                                min: 0,
8304                                max: 1,
8305                                levels: 7
8306                            },
8307                            pan: {
8308                                speed: 50
8309                            },
8310                            loadingAnimation: {
8311                                skin: false,
8312                                book: true
8313                            },
8314                            autoResolution: {
8315                                enabled: true,
8316                                coefficient: 1.5
8317                            },
8318                            actions: {
8319                                cmdZoomIn: {
8320                                    enabled: true
8321                                },
8322                                cmdZoomOut: {
8323                                    enabled: true
8324                                },
8325                                cmdDefaultZoom: {
8326                                    enabled: true,
8327                                    type: 'dblclick',
8328                                    code: 0
8329                                },
8330                                cmdToc: {
8331                                    enabled: true
8332                                },
8333                                cmdFastBackward: {
8334                                    enabled: false
8335                                },
8336                                cmdBackward: {
8337                                    enabled: true
8338                                },
8339                                cmdForward: {
8340                                    enabled: true
8341                                },
8342                                cmdFastForward: {
8343                                    enabled: false
8344                                },
8345                                cmdSave: {
8346                                    enabled: true
8347                                },
8348                                cmdPrint: {
8349                                    enabled: true
8350                                },
8351                                cmdFullScreen: {
8352                                    enabled: true
8353                                },
8354                                widSettings: {
8355                                    enabled: true
8356                                },
8357                                cmdSmartPan: {
8358                                    enabled: true,
8359                                    active: true
8360                                },
8361                                cmdSinglePage: {
8362                                    enabled: true,
8363                                    active: false,
8364                                    activeForMobile: false
8365                                },
8366                                cmdSounds: {
8367                                    enabled: true,
8368                                    active: true
8369                                },
8370                                cmdStats: {
8371                                    enabled: true,
8372                                    active: false
8373                                },
8374                                cmdLightingUp: {
8375                                    enabled: true
8376                                },
8377                                cmdLightingDown: {
8378                                    enabled: true
8379                                },
8380                                cmdPanLeft: {
8381                                    enabled: false
8382                                },
8383                                cmdPanRight: {
8384                                    enabled: false
8385                                },
8386                                cmdPanUp: {
8387                                    enabled: false
8388                                },
8389                                cmdPanDown: {
8390                                    enabled: false
8391                                },
8392                                mouseCmdRotate: {
8393                                    enabled: true,
8394                                    type: 'mousedrag',
8395                                    code: mouseButtons.Right
8396                                },
8397                                mouseCmdDragZoom: {
8398                                    enabled: true,
8399                                    type: 'mousedrag',
8400                                    code: mouseButtons.Middle
8401                                },
8402                                mouseCmdPan: {
8403                                    enabled: true,
8404                                    type: 'mousedrag',
8405                                    code: mouseButtons.Left
8406                                },
8407                                mouseCmdWheelZoom: {
8408                                    enabled: true,
8409                                    type: 'mousewheel',
8410                                    code: 0
8411                                },
8412                                touchCmdRotate: {
8413                                    enabled: true,
8414                                    type: 'touchdrag',
8415                                    code: 3
8416                                },
8417                                touchCmdZoom: {
8418                                    enabled: true,
8419                                    type: 'touchdrag',
8420                                    code: 2
8421                                },
8422                                touchCmdPan: {
8423                                    enabled: true,
8424                                    type: 'touchdrag',
8425                                    code: 1
8426                                },
8427                                touchCmdSwipe: {
8428                                    enabled: true,
8429                                    type: 'touchdrag',
8430                                    code: 1
8431                                }
8432                            }
8433                        };
8434                    };
8435
8436                    /***/
8437                },
8438/* 43 */
8439/***/function (module, exports, __webpack_require__) {
8440
8441                    "use strict";
8442                    'use strict';
8443
8444                    exports.__esModule = true;
8445
8446                    var _libs = __webpack_require__(0);
8447
8448                    var _ImageBase2 = __webpack_require__(5);
8449
8450                    var _ImageBase3 = _interopRequireDefault(_ImageBase2);
8451
8452                    function _interopRequireDefault(obj) {
8453                        return obj && obj.__esModule ? obj : { default: obj };
8454                    }
8455
8456                    function _classCallCheck(instance, Constructor) {
8457                        if (!(instance instanceof Constructor)) {
8458                            throw new TypeError("Cannot call a class as a function");
8459                        }
8460                    }
8461
8462                    function _possibleConstructorReturn(self, call) {
8463                        if (!self) {
8464                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8465                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
8466                    }
8467
8468                    function _inherits(subClass, superClass) {
8469                        if (typeof superClass !== "function" && superClass !== null) {
8470                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
8471                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
8472                    }
8473
8474                    var BlankImage = function (_ImageBase) {
8475                        _inherits(BlankImage, _ImageBase);
8476
8477                        function BlankImage(context, width, height, color) {
8478                            _classCallCheck(this, BlankImage);
8479
8480                            var _this = _possibleConstructorReturn(this, _ImageBase.call(this, context, width, height, color));
8481
8482                            Promise.resolve().then(function () {
8483                                _this.startRender = function () {
8484                                    _this.renderBlankPage();
8485                                    _this.finishRender();
8486                                };
8487                                _this.finishLoad();
8488                            });
8489                            return _this;
8490                        }
8491
8492                        return BlankImage;
8493                    }(_ImageBase3.default);
8494
8495                    exports.default = BlankImage;
8496
8497                    /***/
8498                },
8499/* 44 */
8500/***/function (module, exports, __webpack_require__) {
8501
8502                    "use strict";
8503                    'use strict';
8504
8505                    exports.__esModule = true;
8506
8507                    var _libs = __webpack_require__(0);
8508
8509                    function _classCallCheck(instance, Constructor) {
8510                        if (!(instance instanceof Constructor)) {
8511                            throw new TypeError("Cannot call a class as a function");
8512                        }
8513                    }
8514
8515                    var Bookmarks = function () {
8516                        function Bookmarks(container, items) {
8517                            var _this = this;
8518
8519                            var getTitle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (i) {
8520                                return i.title;
8521                            };
8522                            var getItems = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (i) {
8523                                return i.items;
8524                            };
8525
8526                            _classCallCheck(this, Bookmarks);
8527
8528                            this.container = container;
8529                            this.map = [];
8530                            this.getTitle = getTitle;
8531                            this.getItems = getItems;
8532                            this.nodes = this.mapNodes(items, this.map);
8533
8534                            this.binds = {
8535                                togle: function togle(e) {
8536                                    e.preventDefault();
8537                                    var li = (0, _libs.$)(e.target);
8538                                    while (li[0] && li[0] !== container[0] && !li.hasClass('item')) {
8539                                        li = (0, _libs.$)(li[0].parentNode);
8540                                    }
8541                                    if (li.hasClass('item')) {
8542                                        var cmd = (0, _libs.$)(e.target);
8543                                        while (cmd[0] && cmd[0] !== li[0] && !cmd.hasClass('cmd')) {
8544                                            cmd = (0, _libs.$)(cmd[0].parentNode);
8545                                        }
8546                                        if (cmd.hasClass('cmd')) {
8547                                            var node = _this.map[li.attr('data-id')];
8548                                            if (cmd.hasClass('togle')) {
8549                                                node.minimized = !node.minimized;
8550                                                if (node.minimized) {
8551                                                    li.find('ul').remove();
8552                                                    li.find('.togle').addClass('minimized');
8553                                                } else {
8554                                                    li.find('.togle').removeClass('minimized');
8555                                                    li.append((_this.renderNode(node).match(/<ul.*<\/ul>/) || [''])[0]);
8556                                                }
8557                                            } else {
8558                                                if (_this.onNavigate) {
8559                                                    _this.onNavigate(node.item);
8560                                                }
8561                                            }
8562                                        }
8563                                    }
8564                                }
8565                            };
8566
8567                            container.on('click', this.binds.togle);
8568                            this.update();
8569                        }
8570
8571                        Bookmarks.prototype.getSize = function getSize() {
8572                            return this.map.length;
8573                        };
8574
8575                        Bookmarks.prototype.dispose = function dispose() {
8576                            this.container.off('click', this.binds.togle);
8577                            this.container.html('');
8578                        };
8579
8580                        Bookmarks.prototype.update = function update(
8580) {
8581                            this.container.html(this.renderNodes(this.nodes));
8582                        };
8583
8584                        Bookmarks.prototype.forEach = function forEach(f) {
8585                            var nodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.nodes;
8586
8587                            for (var _iterator = nodes || [], _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
8588                                var _ref;
8589
8590                                if (_isArray) {
8591                                    if (_i >= _iterator.length) break;
8592                                    _ref = _iterator[_i++];
8593                                } else {
8594                                    _i = _iterator.next();
8595                                    if (_i.done) break;
8596                                    _ref = _i.value;
8597                                }
8598
8599                                var node = _ref;
8600
8601                                f(node);
8602                                this.forEach(f, node.children);
8603                            }
8604                        };
8605
8606                        Bookmarks.prototype.expand = function expand() {
8607                            this.forEach(function (n) {
8608                                return n.minimized = false;
8609                            });
8610                            this.update();
8611                        };
8612
8613                        Bookmarks.prototype.minimize = function minimize() {
8614                            this.forEach(function (n) {
8615                                return n.minimized = true;
8616                            });
8617                            this.update();
8618                        };
8619
8620                        Bookmarks.prototype.renderNode = function renderNode(node) {
8621                            return ['<div class="area">', node.children ? '<a href="#" class="cmd togle' + (node.minimized ? ' minimized' : '') + '"><i class="fa fa-angle-right"></i></a> ' : '<i class="white-space"></i> ', '<a class="cmd" title="', node.title, '" href="#">', node.title, '</a></div>', node.minimized ? '' : this.renderNodes(node.children)].join('');
8622                        };
8623
8624                        Bookmarks.prototype.renderNodes = function renderNodes(nodes) {
8625                            var res = ['<div class="bookmarks">'];
8626                            if (nodes && nodes.length) {
8627                                res.push('<ul class="level-', nodes[0].level, '">');
8628                                for (var _iterator2 = nodes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
8629                                    var _ref2;
8630
8631                                    if (_isArray2) {
8632                                        if (_i2 >= _iterator2.length) break;
8633                                        _ref2 = _iterator2[_i2++];
8634                                    } else {
8635                                        _i2 = _iterator2.next();
8636                                        if (_i2.done) break;
8637                                        _ref2 = _i2.value;
8638                                    }
8639
8640                                    var node = _ref2;
8641
8642                                    res.push(['<li class="item" data-id="', node.id, '">', this.renderNode(node), '</li>'].join(''));
8643                                }
8644                                res.push('</ul>');
8645                            }
8646                            res.push('</div>');
8647                            return res.join('');
8648                        };
8649
8650                        Bookmarks.prototype.mapNodes = function mapNodes(items) {
8651                            var map = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
8652                            var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8653
8654                            var nodes = null;
8655                            if (items && items.length) {
8656                                nodes = [];
8657                                for (var _iterator3 = items, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
8658                                    var _ref3;
8659
8660                                    if (_isArray3) {
8661                                        if (_i3 >= _iterator3.length) break;
8662                                        _ref3 = _iterator3[_i3++];
8663                                    } else {
8664                                        _i3 = _iterator3.next();
8665                                        if (_i3.done) break;
8666                                        _ref3 = _i3.value;
8667                                    }
8668
8669                                    var item = _ref3;
8670
8671                                    var id = map.length;
8672                                    map.push(undefined);
8673                                    var node = {
8674                                        id: id,
8675                                        title: this.getTitle(item),
8676                                        level: level,
8677                                        item: item,
8678                                        minimized: true,
8679                                        children: this.mapNodes(this.getItems(item), map, level + 1)
8680                                    };
8681                                    nodes.push(node);
8682                                    map[id] = node;
8683                                }
8684                            }
8685                            return nodes;
8686                        };
8687
8688                        return Bookmarks;
8689                    }();
8690
8691                    exports.default = Bookmarks;
8692
8693                    /***/
8694                },
8695/* 45 */
8696/***/function (module, exports, __webpack_require__) {
8697
8698                    "use strict";
8699                    'use strict';
8700
8701                    exports.__esModule = true;
8702
8703                    var _libs = __webpack_require__(0);
8704
8705                    function _classCallCheck(instance, Constructor) {
8706                        if (!(instance instanceof Constructor)) {
8707                            throw new TypeError("Cannot call a class as a function");
8708                        }
8709                    }
8710
8711                    var Detector = function () {
8712                        function Detector() {
8713                            _classCallCheck(this, Detector);
8714                        }
8715
8716                        Detector.getWebGLErrorMessage = function getWebGLErrorMessage() {
8717                            var element = document.createElement('div');
8718                            element.id = 'webgl-error-message';
8719                            element.style.fontFamily = 'monospace';
8720                            element.style.fontSize = '13px';
8721                            element.style.fontWeight = 'normal';
8722                            element.style.textAlign = 'center';
8723                            element.style.background = '#fff';
8724                            element.style.color = '#000';
8725                            element.style.padding = '1.5em';
8726                            element.style.width = '400px';
8727                            element.style.margin = '5em auto 0';
8728
8729                            if (!Detector.webgl) {
8730                                element.innerHTML = window.WebGLRenderingContext ? ['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />', 'Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join('\n') : ['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>', 'Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join('\n');
8731                            }
8732                            return element;
8733                        };
8734
8735                        Detector.addGetWebGLMessage = function addGetWebGLMessage(parameters) {
8736                            var parent = void 0,
8737                                id = void 0,
8738                                element = void 0;
8739                            parameters = parameters || {};
8740
8741                            parent = parameters.parent || (0, _libs.$)(document.body);
8742                            id = parameters.id || 'oldie';
8743
8744                            element = Detector.getWebGLErrorMessage();
8745                            //element.id = id;
8746
8747                            parent.append(element);
8748                        };
8749
8750                        return Detector;
8751                    }();
8752
8753                    Detector.canvas = !!window.CanvasRenderingContext2D;
8754
8755                    Detector.webgl = function () {
8756                        try {
8757                            var canvas = document.createElement('canvas');
8758                            return !!(window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')));
8759                        } catch (e) {
8760                            return false;
8761                        }
8762                    }();
8763
8764                    Detector.workers = !!window.Worker;
8765                    Detector.fileapi = window.File && window.FileReader && window.FileList && window.Blob;
8766                    exports.default = Detector;
8767
8768                    /***/
8769                },
8770/* 46 */
8771/***/function (module, exports, __webpack_require__) {
8772
8773                    "use strict";
8774                    'use strict';
8775
8776                    exports.__esModule = true;
8777
8778                    var _libs = __webpack_require__(0);
8779
8780                    function _classCallCheck(instance, Constructor) {
8781                        if (!(instance instanceof Constructor)) {
8782                            throw new TypeError("Cannot call a class as a function");
8783                        }
8784                    }
8785
8786                    var DocMouseSimulator = function () {
8787                        function DocMouseSimulator(jFrame, element) {
8788                            var bElement = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.body;
8789
8790                            _classCallCheck(this, DocMouseSimulator);
8791
8792                            this.jFrame = jFrame;
8793                            this.wnd = jFrame[0].contentWindow;
8794                            this.doc = jFrame[0].contentDocument;
8795                            this.element = element || doc.body;
8796                            this.bElement = bElement;
8797                            this.resendProperties = this.getDefaultResendProperties();
8798                            this.undefinedProperties = this.getDefaultUndefinedProperties();
8799                            this.cursors = [];
8800                            this.onDocChangeClbs = [];
8801                            var terms = [{
8802                                find: ':hover',
8803                                replace: '.' + DocMouseSimulator.HOVER
8804                            }, {
8805                                find: ':active',
8806                                replace: '.' + DocMouseSimulator.ACTIVE
8807                            }];
8808                            var style = ['<style type="text/css">'];
8809                            for (var i = 0; i < this.doc.styleSheets.length; ++i) {
8810                                var ss = this.doc.styleSheets[i];
8811                                for (var j = 0; j < ss.cssRules.length; ++j) {
8812                                    var r = ss.cssRules[j],
8813                                        cssText = void 0;
8814                                    for (var _iterator = terms, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
8815                                        var _ref;
8816
8817                                        if (_isArray) {
8818                                            if (_i >= _iterator.length) break;
8819                                            _ref = _iterator[_i++];
8820                                        } else {
8821                                            _i = _iterator.next();
8822                                            if (_i.done) break;
8823                                            _ref = _i.value;
8824                                        }
8825
8826                                        var term = _ref;
8827
8828                                        if (~r.selectorText.indexOf(term.find)) {
8829                                            cssText = (cssText || r.cssText).replace(new RegExp(term.find, 'g'), term.replace);
8830                                        }
8831                                    }
8832                                    if (cssText) {
8833                                        style.push(cssText);
8834                                    }
8835                                }
8836                            }
8837                            style.push('</style>');
8838                            (0, _libs.$)(this.doc.head).append((0, _libs.$)(style.join('')));
8839                        }
8840
8841                        DocMouseSimulator.prototype.convertCoords = function convertCoords(x, y) {
8842                            var jElement = (0, _libs.$)(this.element);
8843                            var offset = jElement.offset();
8844                            return {
8845                                x: offset.left + jElement.width() * x,
8846                                y: offset.top + jElement.height() * (1 - y)
8847                            };
8848                        };
8849
8850                        DocMouseSimulator.prototype.triggerEvent = function triggerEvent(element, e, p, type, advancedProps) {
8851                            var props = {};
8852                            for (var _iterator2 = this.resendProperties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
8853                                var _ref2;
8854
8855                                if (_isArray2) {
8856                                    if (_i2 >= _iterator2.length) break;
8857                                    _ref2 = _iterator2[_i2++];
8858                                } else {
8859                                    _i2 = _iterator2.next();
8860                                    if (_i2.done) break;
8861                                    _ref2 = _i2.value;
8862                                }
8863
8864                                var _n = _ref2;
8865
8866                                props[_n] = e[_n];
8867                            }
8868                            for (var _iterator3 = this.undefinedProperties, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
8869                                var _ref3;
8870
8871                                if (_isArray3) {
8872                                    if (_i3 >= _iterator3.length) break;
8873                                    _ref3 = _iterator3[_i3++];
8874                                } else {
8875                                    _i3 = _iterator3.next();
8876                                    if (_i3.done) break;
8877                                    _ref3 = _i3.value;
8878                                }
8879
8880                                var _n2 = _ref3;
8881
8882                                props[_n2] = undefined;
8883                            }
8884                            for (var n in advancedProps) {
8885                                if (advancedProps.hasOwnProperty(n)) {
8886                                    props[n] = advancedProps[n];
8887                                }
8888                            }
8889                            props.view = this.wnd;
8890                            props.pageX = p.x;
8891                            props.pageY = p.y;
8892                            var jE = _libs.$.Event(type, props);
8893                            jE.timeStamp = e.timeStamp;
8894                            (0, _libs.$)(element).trigger(jE);
8895                        };
8896
8897                        DocMouseSimulator.prototype.addClass = function addClass(element, name) {
8898                            (0, _libs.$)(element).addClass(name);
8899                            var style = this.wnd.getComputedStyle(element);
8900                            this.cursors.push((0, _libs.$)(this.bElement).css('cursor'));
8901                            (0, _libs.$)(this.bElement).css('cursor', style.getPropertyValue('cursor'));
8902                        };
8903
8904                        DocMouseSimulator.prototype.removeClass = function removeClass(element, name) {
8905                            (0, _libs.$)(element).removeClass(name);
8906                            (0, _libs.$)(this.bElement).css('cursor', this.cursors.pop());
8907                        };
8908
8909                        DocMouseSimulator.prototype.enterElement = function enterElement(element) {
8910                            this.addClass(element, DocMouseSimulator.HOVER);
8911                        };
8912
8913                        DocMouseSimulator.prototype.leaveElement = function leaveElement(element) {
8914                            this.removeClass(element, DocMouseSimulator.HOVER);
8915                        };
8916
8917                        DocMouseSimulator.prototype.activateElement = function activateElement(element) {
8918                            this.addClass(element, DocMouseSimulator.ACTIVE);
8919                        };
8920
8921                        DocMouseSimulator.prototype.deactivateElement = function deactivateElement(element) {
8922                            this.removeClass(element, DocMouseSimulator.ACTIVE);
8923                        };
8924
8925                        DocMouseSimulator.prototype.addDocChangeClb = function addDocChangeClb(clb) {
8926                            this.onDocChangeClbs.push(clb);
8927                        };
8928
8929                        DocMouseSimulator.prototype.notify = function notify() {
8930                            for (var _iterator4 = this.onDocChangeClbs, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
8931                                var _ref4;
8932
8933                                if (_isArray4) {
8934                                    if (_i4 >= _iterator4.length) break;
8935                                    _ref4 = _iterator4[_i4++];
8936                                } else {
8937                                    _i4 = _iterator4.next();
8938                                    if (_i4.done) break;
8939                                    _ref4 = _i4.value;
8940                                }
8941
8942                                var clb = _ref4;
8943
8944                                clb(this.wnd, this.doc);
8945                            }
8946                        };
8947
8948                        DocMouseSimulator.prototype.elementFromPoint = function elementFromPoint(p) {
8949                            var node = this.doc.body,
8950                                next = true;
8951                            while (next) {
8952                                next = false;
8953                                for (var i = 0; i < node.childNodes.length; ++i) {
8954                                    var child = node.childNodes[i];
8955                                    if (child instanceof this.wnd.Element) {
8956                                        var jC = (0, _libs.$)(child),
8957                                            offset = jC.offset(),
8958                                            height = jC.height(),
8959                                            width = jC.width();
8960                                        if (p.x > offset.left && p.x < offset.left + width && p.y > offset.top && p.y < offset.top + height) {
8961                                            node = child;
8962                                            next = true;
8963                                            break;
8964                                        }
8965                                    }
8966                                }
8967                            }
8968                            return node;
8969                        };
8970
8971                        DocMouseSimulator.prototype.getElement = function getElement(p) {
8972                            var off0 = this.jFrame.offset();
8973                            this.jFrame.offset({ left: 0.5 * window.innerWidth - p.x, top: 0.5 * window.innerHeight - p.y });
8974                            var element = this.doc.elementFromPoint(p.x, p.y);
8975                            if (!element) {
8976                                // it isn't a joke it's IE
8977                                element = this.doc.elementFromPoint(p.x, p.y);
8978                            }
8979                            this.jFrame.offset(off0);
8980                            return element ? element : this.elementFromPoint(p);
8981                        };
8982
8983                        DocMouseSimulator.prototype.simulate = function simulate(e, doc, x, y) {
8984                            var p = this.convertCoords(x, y),
8985                                element = doc === this.doc ? this.getElement(p) : undefined;
8986                            var trigger = element !== undefined,
8987                                notify = false;
8988
8989                            switch (e.type) {
8990                                case 'mousedown':
8991                                    {
8992                                        if (this.capElement) {
8993                                            this.deactivateElement(this.capElement);
8994                                            notify = true;
8995                                        }
8996                                        this.capElement = element;
8997                                        if (this.capElement) {
8998                                            this.activateElement(this.capElement);
8999                                            notify = true;
9000                                        }
9001                                        break;
9002                                    }
9003                                case 'mouseup':
9004                                    {
9005                                        if (this.capElement) {
9006                                            this.deactivateElement(this.capElement);
9007                                            notify = true;
9008                                        }
9009                                        this.timeStamp = e.timeStamp;
9010                                        break;
9011                                    }
9012                                case 'click':
9013                                    {
9014                                        trigger = element && this.capElement === element && e.timeStamp === this.timeStamp;
9015                                        this.capElement = undefined;
9016                                        break;
9017                                    }
9018                                case 'mouseenter':
9019                                case 'mouseover':
9020                                case 'mousemove':
9021                                    {
9022                                        var leaved = null;
9023                                        if (this.hovElement !== element && this.hovElement) {
9024                                            this.triggerEvent(this.hovElement, e, p, 'mouseout', { relatedTarget: element ? element : null });
9025                                            this.leaveElement(this.hovElement);
9026                                            leaved = this.hovElement;
9027                                            this.hovElement = undefined;
9028                                            notify = true;
9029                                        }
9030                                        if (!this.hovElement && element) {
9031                                            this.triggerEvent(element, e, p, 'mouseover', { relatedTarget: leaved });
9032                                            this.enterElement(element);
9033                                            this.hovElement = element;
9034                                            notify = true;
9035                                        }
9036                                        trigger = element && e.type === 'mousemove';
9037                                        break;
9038                                    }
9039                                case 'mouseleave':
9040                                case 'mouseout':
9041                                    {
9042                                        if (this.hovElement) {
9043                                            this.triggerEvent(this.hovElement, e, p, 'mouseout', { relatedTarget: e.relatedTarget });
9044                                            this.leaveElement(this.hovElement);
9045                                            this.hovElement = undefined;
9046                                            notify = true;
9047                                        }
9048                                        trigger = false;
9049                                        break;
9050                                    }
9051                            }
9052                            if (trigger) {
9053                                this.triggerEvent(element, e, p, e.type);
9054                            }
9055                            if (notify) {
9056                                this.notify();
9057                            }
9058                        };
9059
9060                        DocMouseSimulator.prototype.getDefaultUndefinedProperties = function getDefaultUndefinedProperties() {
9061                            return ['clientX', 'clientY', 'offsetX', 'offsetY', 'screenX', 'screenY'];
9062                        };
9063
9064                        DocMouseSimulator.prototype.getDefaultResendProperties = function getDefaultResendProperties() {
9065                            return ['altKey', 'bubbles', 'button', 'buttons', 'cancelable', 'changedTouches', 'char', 'charCode', 'ctrlKey', 'data', 'detail', 'eventPhase', 'isDefaultPrevented', 'key', 'keyCode', 'metaKey', 'pointerId', 'pointerType', 'shiftKey', 'targetTouches', 'touches', 'which'];
9066                        };
9067
9068                        return DocMouseSimulator;
9069                    }();
9070
9071                    /*
9072                    altKey,
9073                    bubbles,
9074                    button,
9075                    buttons,
9076                    cancelable,
9077                    changedTouches,
9078                    char,
9079                    charCode,
9080                    clientX,
9081                    clientY,
9082                    ctrlKey,
9083                    currentTarget,
9084                    data,
9085                    delegateTarget,
9086                    detail,
9087                    eventPhase,
9088                    handleObj,
9089                    isDefaultPrevented,
9090                    key,
9091                    keyCode,
9092                    metaKey,
9093                    offsetX,
9094                    offsetY,
9095                    originalEvent,
9096                    pageX,
9097                    pageY,
9098                    pointerId,
9099                    pointerType,
9100                    relatedTarget,
9101                    screenX,
9102                    screenY,
9103                    shiftKey,
9104                    target,
9105                    targetTouches,
9106                    timeStamp,
9107                    toElement,
9108                    touches,
9109                    type,
9110                    view,
9111                    which
9112                    */
9113
9114                    DocMouseSimulator.HOVER = 'SIMULATED-HOVER';
9115                    DocMouseSimulator.ACTIVE = 'SIMULATED-ACTIVE';
9116                    exports.default = DocMouseSimulator;
9117
9118                    /***/
9119                },
9120/* 47 */
9121/***/function (module, exports) {
9122
9123                    "use strict";
9124                    'use strict';
9125
9126                    exports.__esModule = true;
9127
9128                    function _classCallCheck(instance, Constructor) {
9129                        if (!(instance instanceof Constructor)) {
9130                            throw new TypeError("Cannot call a class as a function");
9131                        }
9132                    }
9133
9134                    var Dom2Image = function Dom2Image(wnd, doc, cache) {
9135                        _classCallCheck(this, Dom2Image);
9136
9137                        var self = this;
9138                        this.window = wnd;
9139                        this.document = doc;
9140                        this.cache = cache;
9141
9142                        var util = newUtil();
9143                        var inliner = newInliner();
9144                        var fontFaces = newFontFaces();
9145                        var images = newImages();
9146
9147                        this.toSvg = toSvg;
9148                        this.toPng = toPng;
9149                        this.toJpeg = toJpeg;
9150                        this.toBlob = toBlob;
9151                        this.toPixelData = toPixelData;
9152                        this.impl = {
9153                            fontFaces: fontFaces,
9154                            images: images,
9155                            util: util,
9156                            inliner: inliner
9157                        };
9158
9159                        /**
9160                         * @param {Node} node - The DOM Node object to render
9161                         * @param {Object} options - Rendering options
9162                         * @param {Function} options.filter - Should return true if passed node should be included in the output
9163                         *          (excluding node means excluding it's children as well). Not called on the root node.
9164                         * @param {String} options.bgcolor - color for the background, any valid CSS color value.
9165                         * @param {Number} options.width - width to be applied to node before rendering.
9166                         * @param {Number} options.height - height to be applied to node before rendering.
9167                         * @param {Object} options.style - an object whose properties to be copied to node's style before rendering.
9168                         * @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only),
9169                                    defaults to 1.0.
9170                         * @return {Promise} - A promise that is fulfilled with a SVG image data URL
9171                         * */
9172
9173                        function toSvg(node, options) {
9174                            options = options || {};
9175                            return Promise.resolve(node).then(function (node) {
9176                                return cloneNode(node, options.filter, true);
9177                            }).then(embedFonts).then(inlineImages).then(applyOptions).then(function (clone) {
9178                                return makeSvgDataUri(clone, options.width || util.width(node), options.height || util.height(node));
9179                            });
9180
9181                            function applyOptions(clone) {
9182                                if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
9183
9184                                if (options.width) clone.style.width = options.width + 'px';
9185                                if (options.height) clone.style.height = options.height + 'px';
9186
9187                                if (options.style) self.window.Object.keys(options.style).forEach(function (property) {
9188                                    clone.style[property] = options.style[property];
9189                                });
9190
9191                                return clone;
9192                            }
9193                        }
9194
9195                        /**
9196                         * @param {Node} node - The DOM Node object to render
9197                         * @param {Object} options - Rendering options, @see {@link toSvg}
9198                         * @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data.
9199                         * */
9200                        function toPixelData(node, options) {
9201                            return draw(node, options || {}).then(function (canvas) {
9202                                return canvas.getContext('2d').getImageData(0, 0, util.width(node), util.height(node)).data;
9203                            });
9204                        }
9205
9206                        /**
9207                         * @param {Node} node - The DOM Node object to render
9208                         * @param {Object} options - Rendering options, @see {@link toSvg}
9209                         * @return {Promise} - A promise that is fulfilled with a PNG image data URL
9210                         * */
9211                        function toPng(node, options) {
9212                            return draw(node, options || {}).then(function (canvas) {
9213                                return canvas.toDataURL();
9214                            });
9215                        }
9216
9217                        /**
9218                         * @param {Node} node - The DOM Node object to render
9219                         * @param {Object} options - Rendering options, @see {@link toSvg}
9220                         * @return {Promise} - A promise that is fulfilled with a JPEG image data URL
9221                         * */
9222                        function toJpeg(node, options) {
9223                            options = options || {};
9224                            return draw(node, options).then(function (canvas) {
9225                                return canvas.toDataURL('image/jpeg', options.quality || 1.0);
9226                            });
9227                        }
9228
9229                        /**
9230                         * @param {Node} node - The DOM Node object to render
9231                         * @param {Object} options - Rendering options, @see {@link toSvg}
9232                         * @return {Promise} - A promise that is fulfilled with a PNG image blob
9233                         * */
9234                        function toBlob(node, options) {
9235                            return draw(node, options || {}).then(util.canvasToBlob);
9236                        }
9237
9238                        function draw(domNode, options) {
9239                            return toSvg(domNode, options).then(util.makeImage).then(util.delay(100)).then(function (image) {
9240                                var canvas = newCanvas(domNode);
9241                                canvas.getContext('2d').drawImage(image, 0, 0
9241);
9242                                return canvas;
9243                            });
9244
9245                            function newCanvas(domNode) {
9246                                var canvas = self.document.createElement('canvas');
9247                                canvas.width = options.width || util.width(domNode);
9248                                canvas.height = options.height || util.height(domNode);
9249
9250                                if (options.bgcolor) {
9251                                    var ctx = canvas.getContext('2d');
9252                                    ctx.fillStyle = options.bgcolor;
9253                                    ctx.fillRect(0, 0, canvas.width, canvas.height);
9254                                }
9255
9256                                return canvas;
9257                            }
9258                        }
9259
9260                        function cloneNode(node, filter, root) {
9261                            if (!root && filter && !filter(node)) return Promise.resolve();
9262
9263                            return Promise.resolve(node).then(makeNodeCopy).then(function (clone) {
9264                                return cloneChildren(node, clone, filter);
9265                            }).then(function (clone) {
9266                                return processClone(node, clone);
9267                            });
9268
9269                            function makeNodeCopy(node) {
9270                                if (util.isCanvas(node)) return util.makeImage(node.toDataURL());
9271                                return node.cloneNode(false);
9272                            }
9273
9274                            function cloneChildren(original, clone, filter) {
9275                                var children = original.childNodes;
9276                                if (children.length === 0) return Promise.resolve(clone);
9277
9278                                return cloneChildrenInOrder(clone, util.asArray(children), filter).then(function () {
9279                                    return clone;
9280                                });
9281
9282                                function cloneChildrenInOrder(parent, children, filter) {
9283                                    var done = Promise.resolve();
9284                                    children.forEach(function (child) {
9285                                        done = done.then(function () {
9286                                            return cloneNode(child, filter);
9287                                        }).then(function (childClone) {
9288                                            if (childClone) parent.appendChild(childClone);
9289                                        });
9290                                    });
9291                                    return done;
9292                                }
9293                            }
9294
9295                            function processClone(original, clone) {
9296                                if (!util.isElement(clone)) return clone;
9297
9298                                return Promise.resolve().then(cloneStyle).then(clonePseudoElements).then(copyUserInput).then(fixSvg).then(function () {
9299                                    return clone;
9300                                });
9301
9302                                function cloneStyle() {
9303                                    copyStyle(self.window.getComputedStyle(original), clone.style);
9304
9305                                    function copyStyle(source, target) {
9306                                        if (source.cssText) target.cssText = source.cssText; else copyProperties(source, target);
9307
9308                                        function copyProperties(source, target) {
9309                                            util.asArray(source).forEach(function (name) {
9310                                                target.setProperty(name, source.getPropertyValue(name), source.getPropertyPriority(name));
9311                                            });
9312                                        }
9313                                    }
9314                                }
9315
9316                                function clonePseudoElements() {
9317                                    [':before', ':after'].forEach(function (element) {
9318                                        clonePseudoElement(element);
9319                                    });
9320
9321                                    function clonePseudoElement(element) {
9322                                        var style = self.window.getComputedStyle(original, element);
9323                                        var content = style.getPropertyValue('content');
9324
9325                                        if (content === '' || content === 'none') return;
9326
9327                                        var className = util.uid();
9328                                        clone.className = clone.className + ' ' + className;
9329                                        var styleElement = self.document.createElement('style');
9330                                        styleElement.appendChild(formatPseudoElementStyle(className, element, style));
9331                                        clone.appendChild(styleElement);
9332
9333                                        function formatPseudoElementStyle(className, element, style) {
9334                                            var selector = '.' + className + ':' + element;
9335                                            var cssText = style.cssText ? formatCssText(style) : formatCssProperties(style);
9336                                            return self.document.createTextNode(selector + '{' + cssText + '}');
9337
9338                                            function formatCssText(style) {
9339                                                var content = style.getPropertyValue('content');
9340                                                return style.cssText + ' content: ' + content + ';';
9341                                            }
9342
9343                                            function formatCssProperties(style) {
9344
9345                                                return util.asArray(style).map(formatProperty).join('; ') + ';';
9346
9347                                                function formatProperty(name) {
9348                                                    return name + ': ' + style.getPropertyValue(name) + (style.getPropertyPriority(name) ? ' !important' : '');
9349                                                }
9350                                            }
9351                                        }
9352                                    }
9353                                }
9354
9355                                function copyUserInput() {
9356                                    if (util.isTextArea(original)) clone.innerHTML = original.value;
9357                                    if (util.isInput(original)) clone.setAttribute("value", original.value);
9358                                }
9359
9360                                function fixSvg() {
9361                                    if (!util.isSVG(clone)) return;
9362                                    clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
9363
9364                                    if (!util.isSVGRect(clone)) return;
9365                                    ['width', 'height'].forEach(function (attribute) {
9366                                        var value = clone.getAttribute(attribute);
9367                                        if (!value) return;
9368
9369                                        clone.style.setProperty(attribute, value);
9370                                    });
9371                                }
9372                            }
9373                        }
9374
9375                        function embedFonts(node) {
9376                            return fontFaces.resolveAll().then(function (cssText) {
9377                                var styleNode = self.document.createElement('style');
9378                                node.appendChild(styleNode);
9379                                styleNode.appendChild(self.document.createTextNode(cssText));
9380                                return node;
9381                            });
9382                        }
9383
9384                        function inlineImages(node) {
9385                            return images.inlineAll(node).then(function () {
9386                                return node;
9387                            });
9388                        }
9389
9390                        function makeSvgDataUri(node, width, height) {
9391                            return Promise.resolve(node).then(function (node) {
9392                                node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
9393                                return new self.window.XMLSerializer().serializeToString(node);
9394                            }).then(util.escapeXhtml).then(function (xhtml) {
9395                                return ['data:image/svg+xml;charset=utf-8,', '<svg xmlns="http://www.w3.org/2000/svg" width="', width, '" height="', height, '">', '<foreignObject x="0" y="0" width="100%" height="100%">', xhtml, '</foreignObject>', '</svg>'].join('');
9396                            });
9397                        }
9398
9399                        function newUtil() {
9400                            return {
9401                                escape: escape,
9402                                parseExtension: parseExtension,
9403                                mimeType: mimeType,
9404                                dataAsUrl: dataAsUrl,
9405                                isDataUrl: isDataUrl,
9406                                canvasToBlob: canvasToBlob,
9407                                resolveUrl: resolveUrl,
9408                                getAndEncode: getAndEncode,
9409                                uid: uid(),
9410                                delay: delay,
9411                                asArray: asArray,
9412                                escapeXhtml: escapeXhtml,
9413                                makeImage: makeImage,
9414                                width: width,
9415                                height: height,
9416
9417                                isElement: isElement,
9418                                isCanvas: isCanvas,
9419                                isTextArea: isTextArea,
9420                                isInput: isInput,
9421                                isSVG: isSVG,
9422                                isSVGRect: isSVGRect,
9423                                isImage: isImage
9424                            };
9425
9426                            function mimes() {
9427                                /*
9428                                 * Only WOFF and EOT mime types for fonts are 'real'
9429                                 * see http://www.iana.org/assignments/media-types/media-types.xhtml
9430                                 */
9431                                var WOFF = 'application/font-woff';
9432                                var JPEG = 'image/jpeg';
9433
9434                                return {
9435                                    'woff': WOFF,
9436                                    'woff2': WOFF,
9437                                    'ttf': 'application/font-truetype',
9438                                    'eot': 'application/vnd.ms-fontobject',
9439                                    'png': 'image/png',
9440                                    'jpg': JPEG,
9441                                    'jpeg': JPEG,
9442                                    'gif': 'image/gif',
9443                                    'tiff': 'image/tiff',
9444                                    'svg': 'image/svg+xml'
9445                                };
9446                            }
9447
9448                            function parseExtension(url) {
9449                                var match = /\.([^\.\/]*?)$/g.exec(url);
9450                                if (match) return match[1]; else return '';
9451                            }
9452
9453                            function mimeType(url) {
9454                                var extension = parseExtension(url).toLowerCase();
9455                                return mimes()[extension] || '';
9456                            }
9457
9458                            function isDataUrl(url) {
9459                                return url.search(/^(data:)/) !== -1;
9460                            }
9461
9462                            function toBlob(canvas) {
9463                                return new Promise(function (resolve) {
9464                                    var binaryString = self.window.atob(canvas.toDataURL().split(',')[1]);
9465                                    var length = binaryString.length;
9466                                    var binaryArray = new self.window.Uint8Array(length);
9467
9468                                    for (var i = 0; i < length; i++) {
9469                                        binaryArray[i] = binaryString.charCodeAt(i);
9470                                    } resolve(new self.window.Blob([binaryArray], {
9471                                        type: 'image/png'
9472                                    }));
9473                                });
9474                            }
9475
9476                            function canvasToBlob(canvas) {
9477                                if (canvas.toBlob) return new Promise(function (resolve) {
9478                                    canvas.toBlob(resolve);
9479                                });
9480
9481                                return toBlob(canvas);
9482                            }
9483
9484                            function resolveUrl(url, baseUrl) {
9485                                var doc = self.document.implementation.createHTMLDocument();
9486                                var base = doc.createElement('base');
9487                                doc.head.appendChild(base);
9488                                var a = doc.createElement('a');
9489                                doc.body.appendChild(a);
9490                                base.href = baseUrl;
9491                                a.href = url;
9492                                return a.href;
9493                            }
9494
9495                            function uid() {
9496                                var index = 0;
9497
9498                                return function () {
9499                                    return 'u' + fourRandomChars() + index++;
9500
9501                                    function fourRandomChars() {
9502                                        /* see http://stackoverflow.com/a/6248722/2519373 */
9503                                        return ('0000' + (self.window.Math.random() * self.window.Math.pow(36, 4) << 0).toString(36)).slice(-4);
9504                                    }
9505                                };
9506                            }
9507
9508                            function makeImage(uri) {
9509                                return new Promise(function (resolve, reject) {
9510                                    var image = new self.window.Image();
9511                                    image.onload = function () {
9512                                        resolve(image);
9513                                    };
9514                                    image.onerror = reject;
9515                                    image.src = uri;
9516                                });
9517                            }
9518
9519                            function getAndEncode(url) {
9520                                var data = self.cache.get(url);
9521                                if (data) {
9522                                    if (data.content) {
9523                                        return data.content;
9524                                    } else {
9525                                        return new Promise(function (resolve) {
9526                                            if (data.content) {
9527                                                resolve(data.content);
9528                                            } else {
9529                                                data.pendings.push(resolve);
9530                                            }
9531                                        });
9532                                    }
9533                                } else {
9534                                    data = self.cache.put(url, { pendings: [] });
9535
9536                                    var TIMEOUT = 30000;
9537
9538                                    return new Promise(function (resolve) {
9539                                        var request = new self.window.XMLHttpRequest();
9540
9541                                        request.onreadystatechange = done;
9542                                        request.ontimeout = timeout;
9543                                        request.responseType = 'blob';
9544                                        request.timeout = TIMEOUT;
9545                                        request.open('GET', url, true);
9546                                        request.send();
9547
9548                                        function done() {
9549                                            if (request.readyState !== 4) return;
9550
9551                                            if (request.status !== 200) {
9552                                                fail('cannot fetch resource: ' + url + ', status: ' + request.status);
9553                                                return;
9554                                            }
9555
9556                                            var encoder = new self.window.FileReader();
9557                                            encoder.onloadend = function () {
9558                                                data.content = encoder.result.split(/,/)[1];
9559                                                for (var _iterator = data.pendings, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
9560                                                    var _ref;
9561
9562                                                    if (_isArray) {
9563                                                        if (_i >= _iterator.length) break;
9564                                                        _ref = _iterator[_i++];
9565                                                    } else {
9566                                                        _i = _iterator.next();
9567                                                        if (_i.done) break;
9568                                                        _ref = _i.value;
9569                                                    }
9570
9571                                                    var _resolve = _ref;
9572
9573                                                    _resolve(data.content);
9574                                                }
9575                                                data.pendings = [];
9576                                                resolve(data.content);
9577                                            };
9578                                            encoder.readAsDataURL(request.response);
9579                                        }
9580
9581                                        function timeout() {
9582                                            fail('timeout of ' + TIMEOUT + 'ms occured while fetching resource: ' + url);
9583                                        }
9584
9585                                        function fail(message) {
9586                                            console.error(message);
9587                                            resolve('');
9588                                        }
9589                                    });
9590                                }
9591                            }
9592
9593                            function dataAsUrl(content, type) {
9594                                return ['data:', type, ';base64,', content].join('');
9595                            }
9596
9597                            function escape(string) {
9598                                return string.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1');
9599                            }
9600
9601                            function delay(ms) {
9602                                return function (arg) {
9603                                    return new Promise(function (resolve) {
9604                                        setTimeout(function () {
9605                                            resolve(arg);
9606                                        }, ms);
9607                                    });
9608                                };
9609                            }
9610
9611                            function asArray(arrayLike) {
9612                                var array = [];
9613                                var length = arrayLike.length;
9614                                for (var i = 0; i < length; i++) {
9615                                    array.push(arrayLike[i]);
9616                                } return array;
9617                            }
9618
9619                            function escapeXhtml(string) {
9620                                return string.replace(/(#|\n)/g, function (c) {
9621                                    return c === '#' ? '%23' : '%0A';
9622                                });
9623                            }
9624
9625                            function width(node) {
9626                                var leftBorder = px(node, 'border-left-width');
9627                                var rightBorder = px(node, 'border-right-width');
9628                                return node.scrollWidth + leftBorder + rightBorder;
9629                            }
9630
9631                            function height(node) {
9632                                var topBorder = px(node, 'border-top-width');
9633                                var bottomBorder = px(node, 'border-bottom-width');
9634                                return node.scrollHeight + topBorder + bottomBorder;
9635                            }
9636
9637                            function px(node, styleProperty) {
9638                                var value = self.window.getComputedStyle(node).getPropertyValue(styleProperty);
9639                                return parseFloat(value.replace('px', ''));
9640                            }
9641
9642                            function isElement(node) {
9643                                return node instanceof self.window.Element;
9644                            }
9645
9646                            function isCanvas(node) {
9647                                return node instanceof self.window.HTMLCanvasElement;
9648                            }
9649
9650                            function isTextArea(node) {
9651                                return node instanceof self.window.HTMLTextAreaElement;
9652                            }
9653
9654                            function isInput(node) {
9655                                return node instanceof self.window.HTMLInputElement;
9656                            }
9657
9658                            function isSVG(node) {
9659                                return node instanceof self.window.SVGElement;
9660                            }
9661
9662                            function isSVGRect(node) {
9663                                return node instanceof self.window.SVGRectElement;
9664                            }
9665
9666                            function isImage(node) {
9667                                return node instanceof self.window.HTMLImageElement;
9668                            }
9669                        }
9670
9671                        function newInliner() {
9672                            var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
9673
9674                            return {
9675                                inlineAll: inlineAll,
9676                                shouldProcess: shouldProcess,
9677                                impl: {
9678                                    readUrls: readUrls,
9679                                    inline: inline
9680                                }
9681                            };
9682
9683                            function shouldProcess(string) {
9684                                return string.search(URL_REGEX) !== -1;
9685                            }
9686
9687                            function readUrls(string) {
9688                                var result = [];
9689                                var match = void 0;
9690                                while ((match = URL_REGEX.exec(string)) !== null) {
9691                                    result.push(match[1]);
9692                                }
9693                                return result.filter(function (url) {
9694                                    return !util.isDataUrl(url);
9695                                });
9696                            }
9697
9698                            function inline(string, url, baseUrl, get) {
9699                                return Promise.resolve(url).then(function (url) {
9700                                    return baseUrl ? util.resolveUrl(url, baseUrl) : url;
9701                                }).then(get || util.getAndEncode).then(function (data) {
9702                                    return util.dataAsUrl(data, util.mimeType(url));
9703                                }).then(function (dataUrl) {
9704                                    return string.replace(urlAsRegex(url), ['$1', dataUrl, '$3'].join(''));
9705                                });
9706
9707                                function urlAsRegex(url) {
9708                                    return new self.window.RegExp(['(url\\([\'"]?)(', util.escape(url), ')([\'"]?\\))'].join(''), 'g');
9709                                }
9710                            }
9711
9712                            function inlineAll(string, baseUrl, get) {
9713                                if (nothingToInline()) return Promise.resolve(string);
9714
9715                                return Promise.resolve(string).then(readUrls).then(function (urls) {
9716                                    var done = Promise.resolve(string);
9717                                    urls.forEach(function (url) {
9718                                        done = done.then(function (string) {
9719                                            return inline(string, url, baseUrl, get);
9720                                        });
9721                                    });
9722                                    return done;
9723                                });
9724
9725                                function nothingToInline() {
9726                                    return !shouldProcess(string);
9727                                }
9728                            }
9729                        }
9730
9731                        function newFontFaces() {
9732                            return {
9733                                resolveAll: resolveAll,
9734                                impl: {
9735                                    readAll: readAll
9736                                }
9737                            };
9738
9739                            function resolveAll() {
9740                                return readAll(self.document).then(function (webFonts) {
9741                                    return Promise.all(webFonts.map(function (webFont) {
9742                                        return webFont.resolve();
9743                                    }));
9744                                }).then(function (cssStrings) {
9745                                    return cssStrings.join('\n');
9746                                });
9747                            }
9748
9749                            function readAll() {
9750                                return Promise.resolve(util.asArray(self.document.styleSheets)).then(getCssRules).then(selectWebFontRules).then(function (rules) {
9751                                    return rules.map(newWebFont);
9752                                });
9753
9754                                function selectWebFontRules(cssRules) {
9755                                    return cssRules.filter(function (rule) {
9756                                        return rule.type === CSSRule.FONT_FACE_RULE;
9757                                    }).filter(function (rule) {
9758                                        return inliner.shouldProcess(rule.style.getPropertyValue('src'));
9759                                    });
9760                                }
9761
9762                                function getCssRules(styleSheets) {
9763                                    var cssRules = [];
9764                                    styleSheets.forEach(function (sheet) {
9765                                        try {
9766                                            util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
9767                                        } catch (e) {
9768                                            console.log('Error while reading CSS rules from ' + sheet.href, e.toString());
9769                                        }
9770                                    });
9771                                    return cssRules;
9772                                }
9773
9774                                function newWebFont(webFontRule) {
9775                                    return {
9776                                        resolve: function resolve() {
9777                                            var baseUrl = (webFontRule.parentStyleSheet || {}).href;
9778                                            return inliner.inlineAll(webFontRule.cssText, baseUrl);
9779                                        },
9780                                        src: function src() {
9781                                            return webFontRule.style.getPropertyValue('src');
9782                                        }
9783                                    };
9784                                }
9785                            }
9786                        }
9787
9788                        function newImages() {
9789                            return {
9790                                inlineAll: inlineAll,
9791                                impl: {
9792                                    newImage: newImage
9793                                }
9794                            };
9795
9796                            function newImage(element) {
9797                                return {
9798                                    inline: inline
9799                                };
9800
9801                                function inline(get) {
9802                                    if (util.isDataUrl(element.src)) return Promise.resolve();
9803
9804                                    return Promise.resolve(element.src).then(get || util.getAndEncode).then(function (data) {
9805                                        return util.dataAsUrl(data, util.mimeType(element.src));
9806                                    }).then(function (dataUrl) {
9807                                        return new Promise(function (resolve, reject) {
9808                                            element.onload = resolve;
9809                                            element.onerror = reject;
9810                                            element.src = dataUrl;
9811                                        });
9812                                    });
9813                                }
9814                            }
9815
9816                            function inlineAll(node) {
9817                                if (!util.isElement(node)) return Promise.resolve(node);
9818
9819                                return inlineBackground(node).then(function () {
9820                                    if (util.isImage(node)) return newImage(node).inline(); else return Promise.all(util.asArray(node.childNodes).map(function (child) {
9821                                        return inlineAll(child);
9822                                    }));
9823                                });
9824
9825                                function inlineBackground(node) {
9826                                    var background = node.style.getPropertyValue('background');
9827
9828                                    if (!background) return Promise.resolve(node);
9829
9830                                    return inliner.inlineAll(background).then(function (inlined) {
9831                                        node.style.setProperty('background', inlined, node.style.getPropertyPriority('background'));
9832                                    }).then(function () {
9833                                        return node;
9834                                    });
9835                                }
9836                            }
9837                        }
9838                    };
9839
9840                    exports.default = Dom2Image;
9841
9842                    /***/
9843                },
9844/* 48 */
9845/***/function (module, exports, __webpack_require__) {
9846
9847                    "use strict";
9848                    'use strict';
9849
9850                    exports.__esModule = true;
9851
9852                    var _libs = __webpack_require__(0);
9853
9854                    function _classCallCheck(instance, Constructor) {
9855                        if (!(instance instanceof Constructor)) {
9856                            throw new TypeError("Cannot call a class as a function");
9857                        }
9858                    }
9859
9860                    var Drag = function () {
9861                        function Drag(wnd, doc, visualWorld) {
9862                            _classCallCheck(this, Drag);
9863
9864                            this.wnd = wnd;
9865                            this.doc = doc;
9866                            this.visual = visualWorld;
9867                            this.coords = new _libs.THREE.Vector2();
9868                            this.intersection = new _libs.THREE.Vector3();
9869                            this.raycaster = this.visual.raycaster;
9870                            this.camera = this.visual.camera;
9871                            this.plane = new _libs.THREE.Plane();
9872                            this.threes = [];
9873                            this.selected = null;
9874                            this.enabled = true;
9875                            this.controlsState = this.visual.getControlsState();
9876
9877                            this.element = this.visual.element;
9878                            this.binds = {
9879                                onMouseMove: this.onMouseMove.bind(this),
9880                                onMouseDown: this.onMouseDown.bind(this),
9881                                onMouseUp: this.onMouseUp.bind(this)
9882                            };
9883                            (0, _libs.$)(this.element).on('mousemove', this.binds.onMouseMove);
9884                            (0, _libs.$)(this.element).on('mousedown', this.binds.onMouseDown);
9885                            (0, _libs.$)(this.doc).on('mouseup', this.binds.onMouseUp);
9886                        }
9887
9888                        Drag.prototype.addThree = function addThree(three) {
9889                            this.threes.push(three);
9890                        };
9891
9892                        Drag.prototype.removeThree = function removeThree(three) {
9893                            var i = this.threes.indexOf(three);
9894                            if (~i) {
9895                                this.threes.splice(i, 1);
9896                            }
9897                        };
9898
9899                        Drag.prototype.onPickCallback = function onPickCallback() {
9900                            return true;
9901                        };
9902
9903                        Drag.prototype.onDragCallback = function onDragCallback() {
9904                            return true;
9905                        };
9906
9907                        Drag.prototype.onReleaseCallback = function onReleaseCallback() { };
9908
9909                        Drag.prototype.dispose = function dispose() {
9910                            (0, _libs.$)(this.element).off('mousemove', this.binds.onMouseMove);
9911                            (0, _libs.$)(this.element).off('mousedown', this.binds.onMouseDown);
9912                            (0, _libs.$)(this.doc).off('mouseup', this.binds.onMouseUp);
9913                        };
9914
9915                        Drag.prototype.setCoordsFromEvent = function setCoordsFromEvent(e) {
9916                            var jElement = (0, _libs.$)(this.element);
9917                            var offset = jElement.offset();
9918                            this.coords.x = (e.pageX - offset.left) / jElement.width() * 2 - 1;
9919                            this.coords.y = -((e.pageY - offset.top) / jElement.height()) * 2 + 1;
9920                            return this.coords;
9921                        };
9922
9923                        Drag.prototype.onMouseDown = function onMouseDown(e) {
9924                            if (!this.enabled) return;
9925
9926                            if (this.selected) this.onMouseUp(e);
9927
9928                            this.setCoordsFromEvent(e);
9929                            this.raycaster.setFromCamera(this.coords, this.camera);
9930
9931                            var intersects = this.raycaster.intersectObjects(this.threes);
9932                            if (intersects.length > 0) {
9933                                var selected = intersects[0].object;
9934                                if (!this.onPickCallback(intersects[0])) return;
9935                                var v = intersects[0].point.clone();
9936                                this.distance = v.sub(this.raycaster.ray.origin).length();;
9937                                this.controlsState = this.visual.getControlsState();
9938                                this.visual.setControlsState(false);
9939                                this.plane.setFromNormalAndCoplanarPoint(this.visual.camera.getWorldDirection(this.plane.normal), intersects[0].point);
9940                                //this.plane.setFromNormalAndCoplanarPoint(this.plane.normal.set(0,0,1), new THREE.Vector3(0,0,0));
9941                                this.selected = selected;
9942                            }
9943                        };
9944
9945                        Drag.prototype.onMouseMove = function onMouseMove(e) {
9946                            if (!this.enabled) return;
9947                            e.preventDefault();
9948
9949                            if (this.selected) {
9950                                this.setCoordsFromEvent(e);
9951                                this.raycaster.setFromCamera(this.coords, this.camera);
9952                                if (this.raycaster.ray.intersectPlane(this.plane, this.intersection)) {
9953                                    if (!this.onDragCallback(this.intersection)) this.onMouseUp(e);
9954                                } /**/
9955                                //this.intersection.copy(this.raycaster.ray.direction).normalize().multiplyScalar(this.distance).add(this.raycaster.ray.origin);/**/
9956                                //if(!this.onDragCallback(this.selected, this.intersection)) this.onMouseUp(e);
9957                            }
9958                        };
9959
9960                        Drag.prototype.onMouseUp = function onMouseUp(e) {
9961                            if (this.selected) {
9962                                this.onReleaseCallback();
9963                                this.selected = null;
9964                                this.visual.setControlsState(this.controlsState);
9965                            }
9966                            if (!this.enabled) return;
9967                            e.preventDefault();
9968                        };
9969
9970                        return Drag;
9971                    }();
9972
9973                    exports.default = Drag;
9974
9975                    /***/
9976                },
9977/* 49 */
9978/***/function (module, exports, __webpack_require__) {
9979
9980                    "use strict";
9981                    'use strict';
9982
9983                    exports.__esModule = true;
9984
9985                    var _extends = Object.assign || function (target) {
9986                        for (var i = 1; i < arguments.length; i++) {
9987                            var source = arguments[i]; for (var key in source) {
9988                                if (Object.prototype.hasOwnProperty.call(source, key)) {
9989                                    target[key] = source[key];
9990                                }
9991                            }
9992                        } return target;
9993                    };
9994
9995                    var _libs = __webpack_require__(0);
9996
9997                    function _classCallCheck(instance, Constructor) {
9998                        if (!(instance instanceof Constructor)) {
9999                            throw new TypeError("Cannot call a class as a function");
10000                        }
10001                    }
10002
10003                    __webpack_require__(71)(_libs.$);
10004
10005                    var EventsToActions = function () {
10006                        EventsToActions.getEventFlags = function getEventFlags(e) {
10007                            return e.ctrlKey << 0 | e.shiftKey << 1 | e.altKey << 2;
10008                        };
10009
10010                        EventsToActions.getPosition = function getPosition(touches) {
10011                            var x = void 0,
10012                                y = void 0;
10013                            if (touches.length === 2) {
10014                                x = touches[1].pageX - touches[0].pageX;
10015                                y = touches[1].pageY - touches[0].pageY;
10016                                y = -Math.sqrt(x * x + y * y);
10017                                x = 0;
10018                            } else {
10019                                x = touches[0].pageX;
10020                                y = touches[0].pageY;
10021                            }
10022                            return {
10023                                x: x,
10024                                y: y
10025                            };
10026                        };
10027
10028                        function EventsToActions(element, actions) {
10029                            _classCallCheck(this, EventsToActions);
10030
10031                            this.actions = actions || {};
10032                            this.element = element;
10033                            this.doc = element[0].ownerDocument;
10034                            this.wnd = this.doc.defaultView;
10035                            this.enabled = true;
10036
10037                            this.binds = {
10038                                contextMenu: this.contextMenu.bind(this),
10039
10040                                mouseDown: this.mouseDown.bind(this),
10041                                mouseMove: this.mouseMove.bind(this),
10042                                mouseUp: this.mouseUp.bind(this),
10043                                mouseWheel: this.mouseWheel.bind(this),
10044
10045                                mouseMoveDoc: this.mouseMoveDoc.bind(this),
10046                                mouseUpDoc: this.mouseUpDoc.bind(this),
10047
10048                                click: this.click.bind(this),
10049                                dblclick: this.dblclick.bind(this),
10050
10051                                touchStart: this.touchStart.bind(this),
10052                                touchMove: this.touchMove.bind(this),
10053                                touchEnd: this.touchEnd.bind(this),
10054
10055                                keyDown: this.keyDown.bind(this),
10056                                keyPress: this.keyPress.bind(this),
10057                                keyUp: this.keyUp.bind(this)
10058                            };
10059
10060                            this.element.on('contextmenu', this.binds.contextMenu);
10061
10062                            this.element.on('mousedown', this.binds.mouseDown);
10063                            this.element.on('mousemove', this.binds.mouseMove);
10064                            this.element.on('mouseup', this.binds.mouseUp);
10065                            this.element.on('mousewheel', this.binds.mouseWheel);
10066
10067                            (0, _libs.$)(this.doc).on('mousemove', this.binds.mouseMoveDoc);
10068                            (0, _libs.$)(this.doc).on('mouseup', this.binds.mouseUpDoc);
10069
10070                            this.element.on('click', this.binds.click);
10071                            this.element.on('dblclick', this.binds.dblclick);
10072
10073                            this.element.on('touchstart', this.binds.touchStart);
10074                            this.element.on('touchmove', this.binds.touchMove);
10075                            this.element.on('touchend', this.binds.touchEnd);
10076
10077                            (0, _libs.$)(this.wnd).on('keydown', this.binds.keyDown);
10078                            (0, _libs.$)(this.wnd).on('keypress', this.binds.keyPress);
10079                            (0, _libs.$)(this.wnd).on('keyup', this.binds.keyUp);
10080                        }
10081
10082                        EventsToActions.prototype.addAction = function addAction(action, type, code, flags) {
10083                            type = type.toLowerCase();
10084                            if (!this.actions[type]) {
10085                                this.actions[type] = {};
10086                            }
10087                            if (!this.actions[type][code]) {
10088                                this.actions[type][code] = {};
10089                            }
10090                            if (!this.actions[type][code][flags]) {
10091                                this.actions[type][code][flags] = [];
10092                            }
10093                            this.actions[type][code][flags].push(action);
10094                        };
10095
10096                        EventsToActions.prototype.getActions = function getActions(type, co
10096de, flags) {
10097                            return ((this.actions[type] || {})[code] || {})[flags] || [];
10098                        };
10099
10100                        EventsToActions.prototype.fireActions = function fireActions(actions, e, data) {
10101                            for (var _iterator = actions, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
10102                                var _ref;
10103
10104                                if (_isArray) {
10105                                    if (_i >= _iterator.length) break;
10106                                    _ref = _iterator[_i++];
10107                                } else {
10108                                    _i = _iterator.next();
10109                                    if (_i.done) break;
10110                                    _ref = _i.value;
10111                                }
10112
10113                                var action = _ref;
10114
10115                                action(e, data);
10116                            }
10117                        };
10118
10119                        EventsToActions.prototype.contextMenu = function contextMenu(e) {
10120                            if (this.enabled) {
10121                                var flags = EventsToActions.getEventFlags(e);
10122                                this.fireActions(this.getActions('contextmenu', e.button, flags), e);
10123                            }
10124                        };
10125
10126                        EventsToActions.prototype.mouseDown = function mouseDown(e) {
10127                            if (this.picked) {
10128                                this.mouseUpDoc();
10129                            }
10130                            if (this.enabled) {
10131                                var flags = EventsToActions.getEventFlags(e);
10132                                this.fireActions(this.getActions('mousedown', e.button, flags), e);
10133                                this.picked = {
10134                                    x: e.pageX,
10135                                    y: e.pageY,
10136                                    actions: this.getActions('mousedrag', e.button, flags)
10137                                };
10138                                this.fireActions(this.picked.actions, e, {
10139                                    state: 'start'
10140                                });
10141                            }
10142                        };
10143
10144                        EventsToActions.prototype.mouseMove = function mouseMove(e) {
10145                            if (this.enabled) {
10146                                var flags = EventsToActions.getEventFlags(e);
10147                                this.fireActions(this.getActions('mousemove', e.button, flags), e);
10148                            }
10149                        };
10150
10151                        EventsToActions.prototype.mouseMoveDoc = function mouseMoveDoc(e) {
10152                            if (this.enabled && this.picked) {
10153                                this.fireActions(this.picked.actions, e, {
10154                                    state: 'move',
10155                                    dx: e.pageX - this.picked.x,
10156                                    dy: e.pageY - this.picked.y
10157                                });
10158                                this.picked = {
10159                                    x: e.pageX,
10160                                    y: e.pageY,
10161                                    actions: this.picked.actions
10162                                };
10163                            }
10164                        };
10165
10166                        EventsToActions.prototype.mouseUp = function mouseUp(e) {
10167                            if (this.enabled) {
10168                                var flags = EventsToActions.getEventFlags(e);
10169                                this.fireActions(this.getActions('mouseup', e.button, flags), e);
10170                            }
10171                        };
10172
10173                        EventsToActions.prototype.mouseUpDoc = function mouseUpDoc(e) {
10174                            if (this.picked) {
10175                                this.fireActions(this.picked.actions, e, {
10176                                    state: 'end'
10177                                });
10178                                delete this.picked;
10179                            }
10180                        };
10181
10182                        EventsToActions.prototype.mouseWheel = function mouseWheel(e) {
10183                            if (this.enabled) {
10184                                var flags = EventsToActions.getEventFlags(e);
10185                                this.fireActions(this.getActions('mousewheel', 0, flags), e);
10186                            }
10187                        };
10188
10189                        EventsToActions.prototype.clicks = function clicks(e, type) {
10190                            if (this.enabled) {
10191                                var flags = EventsToActions.getEventFlags(e);
10192                                this.fireActions(this.getActions(type, e.button, flags), e);
10193                            }
10194                        };
10195
10196                        EventsToActions.prototype.click = function click(e) {
10197                            this.clicks(e, 'click');
10198                        };
10199
10200                        EventsToActions.prototype.dblclick = function dblclick(e) {
10201                            this.clicks(e, 'dblclick');
10202                        };
10203
10204                        EventsToActions.prototype.touchPick = function touchPick(e, flags, touches) {
10205                            this.touchPicked = _extends({}, EventsToActions.getPosition(touches), {
10206                                actions: this.getActions('touchdrag', touches.length, flags),
10207                                code: touches.length,
10208                                flags: flags
10209                            });
10210                            this.fireActions(this.touchPicked.actions, e, {
10211                                state: 'start'
10212                            });
10213                        };
10214
10215                        EventsToActions.prototype.touchStart = function touchStart(e) {
10216                            if (this.touchPicked) {
10217                                this.touchEnd(e);
10218                            }
10219                            if (this.enabled) {
10220                                var flags = EventsToActions.getEventFlags(e),
10221                                    touches = e.touches || e.originalEvent.touches;
10222                                this.fireActions(this.getActions('touchstart', touches.length, flags), e);
10223                                this.touchPick(e, flags, touches);
10224                            }
10225                        };
10226
10227                        EventsToActions.prototype.touchMove = function touchMove(e) {
10228                            if (this.enabled) {
10229                                var flags = EventsToActions.getEventFlags(e),
10230                                    touches = e.touches || e.originalEvent.touches;
10231                                this.fireActions(this.getActions('touchmove', touches.length, flags), e);
10232                                if (this.touchPicked) {
10233                                    if (this.touchPicked.code === touches.length && this.touchPicked.flags === flags) {
10234                                        var pos = EventsToActions.getPosition(touches);
10235                                        this.fireActions(this.touchPicked.actions, e, {
10236                                            state: 'move',
10237                                            dx: pos.x - this.touchPicked.x,
10238                                            dy: pos.y - this.touchPicked.y
10239                                        });
10240                                        this.touchPicked = _extends({}, this.touchPicked, pos);
10241                                    } else {
10242                                        this.touchEnd(e);
10243                                        this.touchPick(e, flags, touches);
10244                                    }
10245                                }
10246                            }
10247                        };
10248
10249                        EventsToActions.prototype.touchEnd = function touchEnd(e) {
10250                            if (this.touchPicked) {
10251                                this.fireActions(this.touchPicked.actions, e, {
10252                                    state: 'end'
10253                                });
10254                                delete this.touchPicked;
10255                            }
10256                        };
10257
10258                        EventsToActions.prototype.key = function key(e, type) {
10259                            if (this.enabled) {
10260                                var flags = EventsToActions.getEventFlags(e);
10261                                this.fireActions(this.getActions(type, e.keyCode, flags), e);
10262                            }
10263                        };
10264
10265                        EventsToActions.prototype.keyDown = function keyDown(e) {
10266                            this.key(e, 'keydown');
10267                        };
10268
10269                        EventsToActions.prototype.keyPress = function keyPress(e) {
10270                            this.key(e, 'keypress');
10271                        };
10272
10273                        EventsToActions.prototype.keyUp = function keyUp(e) {
10274                            this.key(e, 'keyup');
10275                        };
10276
10277                        EventsToActions.prototype.dispose = function dispose() {
10278                            this.element.off('contextmenu', this.binds.contextMenu);
10279
10280                            this.element.off('mousedown', this.binds.mouseDown);
10281                            this.element.off('mousemove', this.binds.mouseMove);
10282                            this.element.off('mouseup', this.binds.mouseUp);
10283                            this.element.off('mousewheel', this.binds.mouseWheel);
10284
10285                            (0, _libs.$)(this.doc).off('mousemove', this.binds.mouseMoveDoc);
10286                            (0, _libs.$)(this.doc).off('mouseup', this.binds.mouseUpDoc);
10287
10288                            this.element.off('click', this.binds.click);
10289                            this.element.off('dblclick', this.binds.dblclick);
10290
10291                            this.element.off('touchstart', this.binds.touchStart);
10292                            this.element.off('touchmove', this.binds.touchMove);
10293                            this.element.off('touchend', this.binds.touchEnd);
10294
10295                            (0, _libs.$)(this.wnd).off('keydown', this.binds.keyDown);
10296                            (0, _libs.$)(this.wnd).off('keypress', this.binds.keyPress);
10297                            (0, _libs.$)(this.wnd).off('keyup', this.binds.keyUp);
10298                        };
10299
10300                        return EventsToActions;
10301                    }();
10302
10303                    EventsToActions.modKeys = {
10304                        Ctrl: 1,
10305                        Shift: 2,
10306                        Alt: 4
10307                    };
10308                    EventsToActions.mouseButtons = {
10309                        Left: 0,
10310                        Middle: 1,
10311                        Right: 2
10312                    };
10313                    exports.default = EventsToActions;
10314
10315                    /***/
10316                },
10317/* 50 */
10318/***/function (module, exports) {
10319
10320                    "use strict";
10321                    'use strict';
10322
10323                    exports.__esModule = true;
10324
10325                    function _classCallCheck(instance, Constructor) {
10326                        if (!(instance instanceof Constructor)) {
10327                            throw new TypeError("Cannot call a class as a function");
10328                        }
10329                    }
10330
10331                    var FullScreen = function () {
10332                        function FullScreen() {
10333                            _classCallCheck(this, FullScreen);
10334                        }
10335
10336                        FullScreen.available = function available() {
10337                            return FullScreen._hasWebkitFullScreen || FullScreen._hasMozFullScreen || FullScreen._hasMsFullscreen;
10338                        };
10339
10340                        FullScreen.activated = function activated() {
10341                            if (FullScreen._hasWebkitFullScreen) {
10342                                return document.webkitIsFullScreen;
10343                            } else if (FullScreen._hasMozFullScreen) {
10344                                return document.mozFullScreen;
10345                            } else if (FullScreen._hasMsFullscreen) {
10346                                return !!document.msFullscreenElement;
10347                            } else {
10348                                console.assert(false);
10349                            }
10350                        };
10351
10352                        FullScreen.addEventListener = function addEventListener(element, handler) {
10353                            if (element.addEventListener) {
10354                                element.addEventListener('webkitfullscreenchange', handler, false);
10355                                element.addEventListener('mozfullscreenchange', handler, false);
10356                                element.addEventListener('fullscreenchange', handler, false);
10357                                element.addEventListener('MSFullscreenChange', handler, false);
10358                            }
10359                        };
10360
10361                        FullScreen.removeEventListener = function removeEventListener(element, handler) {
10362                            if (element.removeEventListener) {
10363                                element.removeEventListener('webkitfullscreenchange', handler, false);
10364                                element.removeEventListener('mozfullscreenchange', handler, false);
10365                                element.removeEventListener('fullscreenchange', handler, false);
10366                                element.removeEventListener('MSFullscreenChange', handler, false);
10367                            }
10368                        };
10369
10370                        FullScreen.request = function request(element) {
10371                            element = element || document.body;
10372                            if (FullScreen._hasWebkitFullScreen) {
10373                                element.webkitRequestFullScreen();
10374                            } else if (FullScreen._hasMozFullScreen) {
10375                                element.mozRequestFullScreen();
10376                            } else if (FullScreen._hasMsFullscreen) {
10377                                element.msRequestFullscreen();
10378                            } else {
10379                                console.assert(false);
10380                            }
10381                        };
10382
10383                        FullScreen.cancel = function cancel() {
10384                            if (FullScreen._hasWebkitFullScreen) {
10385                                document.webkitCancelFullScreen();
10386                            } else if (FullScreen._hasMozFullScreen) {
10387                                document.mozCancelFullScreen();
10388                            } else if (FullScreen._hasMsFullscreen) {
10389                                document.msExitFullscreen();
10390                            } else {
10391                                console.assert(false);
10392                            }
10393                        };
10394
10395                        return FullScreen;
10396                    }();
10397
10398                    FullScreen._hasWebkitFullScreen = !!document.webkitCancelFullScreen;
10399                    FullScreen._hasMozFullScreen = !!document.mozCancelFullScreen;
10400                    FullScreen._hasMsFullscreen = !!document.documentElement.msRequestFullscreen;
10401                    exports.default = FullScreen;
10402
10403                    /***/
10404                },
10405/* 51 */
10406/***/function (module, exports, __webpack_require__) {
10407
10408                    "use strict";
10409                    'use strict';
10410
10411                    exports.__esModule = true;
10412
10413                    var _libs = __webpack_require__(0);
10414
10415                    var _ImageBase2 = __webpack_require__(5);
10416
10417                    var _ImageBase3 = _interopRequireDefault(_ImageBase2);
10418
10419                    var _BaseMathUtils = __webpack_require__(2);
10420
10421                    var _BaseMathUtils2 = _interopRequireDefault(_BaseMathUtils);
10422
10423                    var _Dom2Image = __webpack_require__(47);
10424
10425                    var _Dom2Image2 = _interopRequireDefault(_Dom2Image);
10426
10427                    var _DocMouseSimulator = __webpack_require__(46);
10428
10429                    var _DocMouseSimulator2 = _interopRequireDefault(_DocMouseSimulator);
10430
10431                    function _interopRequireDefault(obj) {
10432                        return obj && obj.__esModule ? obj : { default: obj };
10433                    }
10434
10435                    function _classCallCheck(instance, Constructor) {
10436                        if (!(instance instanceof Constructor)) {
10437                            throw new TypeError("Cannot call a class as a function");
10438                        }
10439                    }
10440
10441                    function _possibleConstructorReturn(self, call) {
10442                        if (!self) {
10443                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
10444                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
10445                    }
10446
10447                    function _inherits(subClass, superClass) {
10448                        if (typeof superClass !== "function" && superClass !== null) {
10449                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
10450                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
10450onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
10451                    }
10452
10453                    var InteractiveImage = function (_ImageBase) {
10454                        _inherits(InteractiveImage, _ImageBase);
10455
10456                        function InteractiveImage(context, width, height, color, src, cache, injector) {
10457                            _classCallCheck(this, InteractiveImage);
10458
10459                            var _this = _possibleConstructorReturn(this, _ImageBase.call(this, context, width, height, color));
10460
10461                            _this.iId = 'i' + _BaseMathUtils2.default.getUnique();
10462                            var jFrame = (0, _libs.$)('<iframe id="' + _this.iId + '" src="' + src + '" style="position: fixed; left: -1000px;"></iframe>');
10463                            (0, _libs.$)(_this.doc.body).append(jFrame);
10464                            _this.frame = jFrame[0];
10465
10466                            _this.binds = {};
10467
10468                            if (injector) {
10469                                injector(_this.frame.contentWindow);
10470                            }
10471
10472                            if (_this.doc.implementation.hasFeature('www.http://w3.org/TR/SVG11/feature#Extensibility', '1.1')) {
10473                                // svg foreignObject renderer
10474                                _this.image = new Image();
10475                                _this.binds.imageLoad = function () {
10476                                    _this.renderImage(_this.image);
10477                                    _this.finishRender();
10478                                };
10479                                (0, _libs.$)(_this.image).on('load', _this.binds.imageLoad);
10480                                _this.svgRender = new _Dom2Image2.default(_this.frame.contentWindow, _this.frame.contentDocument, cache);
10481                            } // otherwise - html2canvas
10482
10483                            _this.binds.frameLoad = function () {
10484                                if (~_this.frame.contentDocument.title.indexOf('404')) {
10485                                    _this.startRender = function () {
10486                                        _this.renderNotFoundPage();
10487                                        _this.finishRender();
10488                                    };
10489                                    _this.finishLoad();
10490                                } else {
10491                                    setTimeout(function () {
10492                                        if (_this.frame) {
10493                                            _this.width = (0, _libs.$)(_this.frame.contentDocument.body).width();
10494                                            _this.height = (0, _libs.$)(_this.frame.contentDocument.body).height();
10495                                            jFrame.css('width', _this.width + 'px').css('height', _this.height + 'px');
10496                                            jFrame.offset({ left: -_this.width - 100, top: 0 });
10497                                            if (_this.svgRender) {
10498                                                _this.simulator = new _DocMouseSimulator2.default(jFrame, _this.frame.contentDocument.body, _this.element);
10499                                                _this.simulator.addDocChangeClb(_this.finishLoad.bind(_this));
10500                                            }
10501                                            _this.startRender = function () {
10502                                                _this.render();
10503                                            };
10504                                            _this.finishLoad();
10505                                        }
10506                                    }, 500);
10507                                }
10508                            };
10509                            (0, _libs.$)(_this.frame.contentWindow).on('load', _this.binds.frameLoad);
10510                            return _this;
10511                        }
10512
10513                        InteractiveImage.prototype.getSimulatedDoc = function getSimulatedDoc() {
10514                            return this.frame.contentDocument;
10515                        };
10516
10517                        InteractiveImage.prototype.render = function render() {
10518                            var _this2 = this;
10519
10520                            if (this.svgRender) {
10521                                this.svgRender.toSvg(this.simulator.element, { height: this.height + 'px', width: this.width + 'px' }).then(function (dataUrl) {
10522                                    _this2.image.src = dataUrl;
10523                                }).catch(function (error) {
10524                                    console.error('Dom2Image: ', error);
10525                                    _this2.renderBlankPage();
10526                                    _this2.finishRender();
10527                                });
10528                            } else {
10529                                (0, _libs.html2canvas)(this.frame.contentDocument.body, { timeout: 30000 }).then(function (canvas) {
10530                                    _this2.renderImage(canvas);
10531                                    _this2.finishRender();
10532                                });
10533                            }
10534                        };
10535
10536                        InteractiveImage.prototype.dispose = function dispose() {
10537                            (0, _libs.$)(this.image).off('load', this.binds.imageLoad);
10538                            (0, _libs.$)(this.frame.contentWindow).off('load', this.binds.frameLoad);
10539                            (0, _libs.$)(this.doc.body).find('#' + this.iId).remove();
10540                            if (this.image) {
10541                                this.image.src = '';
10542                                delete this.image;
10543                            }
10544                            this.frame.src = '';
10545                            delete this.frame;
10546                            _ImageBase.prototype.dispose.call(this);
10547                        };
10548
10549                        InteractiveImage.prototype.simulate = function simulate(e, doc, x, y) {
10550                            if (this.simulator) {
10551                                this.simulator.simulate(e, doc, x, y);
10552                            }
10553                        };
10554
10555                        return InteractiveImage;
10556                    }(_ImageBase3.default);
10557
10558                    exports.default = InteractiveImage;
10559
10560                    /***/
10561                },
10562/* 52 */
10563/***/function (module, exports, __webpack_require__) {
10564
10565                    "use strict";
10566                    'use strict';
10567
10568                    exports.__esModule = true;
10569
10570                    var _libs = __webpack_require__(0);
10571
10572                    var _GraphUtils = __webpack_require__(7);
10573
10574                    var _GraphUtils2 = _interopRequireDefault(_GraphUtils);
10575
10576                    var _MathUtils = __webpack_require__(3);
10577
10578                    var _MathUtils2 = _interopRequireDefault(_MathUtils);
10579
10580                    function _interopRequireDefault(obj) {
10581                        return obj && obj.__esModule ? obj : { default: obj };
10582                    }
10583
10584                    function _classCallCheck(instance, Constructor) {
10585                        if (!(instance instanceof Constructor)) {
10586                            throw new TypeError("Cannot call a class as a function");
10587                        }
10588                    }
10589
10590                    var LoadingAnimation = function () {
10591                        LoadingAnimation.prototype.dy = function dy(t, y) {
10592                            var w = y[0],
10593                                a = y[1];
10594                            return [-this.g * Math.cos(a), w];
10595                        };
10596
10597                        LoadingAnimation.prototype.integrate = function integrate(T) {
10598                            var t = 0,
10599                                dt = this.p.dt,
10600                                os = this.os;
10601                            while (t < T) {
10602                                if (t + dt > T) {
10603                                    dt = T - t;
10604                                }
10605                                os = _MathUtils2.default.rk4(this.dy.bind({ g: this.p.g }), 0, dt, os);
10606                                t += dt;
10607                            }
10608                            return os;
10609                        };
10610
10611                        LoadingAnimation.prototype.calcTimeTo = function calcTimeTo(target) {
10612                            var t = 0,
10613                                dt = this.p.dt,
10614                                os = this.os;
10615                            while (Math.abs(os[1] - target) > 1e-4) {
10616                                var nos = _MathUtils2.default.rk4(this.dy.bind({ g: this.p.g }), 0, dt, os);
10617                                if (nos[0] < 0 && nos[1] < target || nos[0] > 0 && nos[1] > target) {
10618                                    dt /= 2;
10619                                } else {
10620                                    os = nos;
10621                                    t += dt;
10622                                }
10623                            }
10624                            return t;
10625                        };
10626
10627                        LoadingAnimation.prototype.update = function update(T) {
10628                            this.os = this.integrate(T);
10629
10630                            this.t += T;
10631                            if (this.t >= this.p.updateInterval) {
10632                                this.t = 0;
10633                                var r = 0.06 * Math.min(this.c.width, this.c.height),
10634                                    a = this.os[1],
10635                                    x0 = 0.5 * this.c.width,
10636                                    y0 = 0.5 * this.c.height,
10637                                    ctx = this.ctx;
10638
10639                                ctx.clearRect(0, 0, this.c.width, this.c.height);
10640                                ctx.beginPath();
10641                                ctx.fillStyle = _GraphUtils2.default.color2Rgba(this.p.color, 1);
10642                                ctx.rect(0, 0, this.c.width, this.c.height);
10643                                ctx.fill();
10644
10645                                ctx.beginPath();
10646                                ctx.shadowBlur = 50;
10647                                ctx.fillStyle = _GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(this.p.color, 0.9), Math.abs(this.os[0] / 6.36));
10648                                ctx.shadowColor = _GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(this.p.color, 1), 0.9);
10649                                ctx.shadowOffsetX = 0;
10650                                ctx.shadowOffsetY = 0;
10651                                ctx.font = 'bold ' + Math.round(0.25 * r) + 'px Arial';
10652                                ctx.textAlign = 'center';
10653                                ctx.textBaseline = 'middle';
10654                                ctx.fillText((0, _libs.tr)('Loading...'), x0, y0);
10655
10656                                var ps = 10,
10657                                    da = 2 * Math.PI / ps; //2.5*_r/r
10658                                ctx.shadowColor = _GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(this.p.color, 1), 0.7);
10659                                for (var i = 0, _a = a, _r = 0.2 * r; i < ps; ++i, _r *= 0.9, _a += da) {
10660                                    ctx.beginPath();
10661                                    ctx.fillStyle = _GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(this.p.color, (ps - i) / ps), 0.7 * (ps - i) / ps);
10662                                    var cx = x0 + r * Math.cos(_a),
10663                                        cy = y0 - r * Math.sin(_a),
10664                                        nx = x0 + r * Math.cos(_a + da),
10665                                        ny = y0 - r * Math.sin(_a + da);
10666                                    ctx.shadowOffsetX = 0.2 * (nx - cx);
10667                                    ctx.shadowOffsetY = 0.2 * (ny - cy);
10668                                    ctx.arc(cx, cy, _r, 0, Math.PI * 2, 1);
10669                                    ctx.fill();
10670                                }
10671                                if (this.onChange) {
10672                                    this.onChange(this.c, this.p.color);
10673                                }
10674                            }
10675                        };
10676
10677                        LoadingAnimation.prototype.getImage = function getImage() {
10678                            return this.c;
10679                        };
10680
10681                        LoadingAnimation.prototype.dispose = function dispose() {
10682                            this.c.width = 0;
10683                            this.c.height = 0;
10684                            delete this.ctx;
10685                            delete this.c;
10686                        };
10687
10688                        LoadingAnimation.prototype.createSprite = function createSprite(n) {
10689                            var c = (0, _libs.$)('<canvas width="' + this.c.width * n + '" height="' + this.c.height + '"></canvas>')[0],
10690                                ctx = c.getContext('2d'),
10691                                t = this.calcTimeTo(this.os[1] + Math.sign(this.os[0]) * 2 * Math.PI),
10692                                dt = t / (n + 1);
10693                            var updateInterval = this.p.updateInterval;
10694
10695                            this.p.updateInterval = 0;
10696                            for (var i = 0; i < n; ++i) {
10697                                this.update(dt);
10698                                ctx.drawImage(this.c, i * this.c.width, 0);
10699                            }
10700                            this.p.updateInterval = updateInterval;
10701                            return c;
10702                        };
10703
10704                        function LoadingAnimation(width, height, color) {
10705                            _classCallCheck(this, LoadingAnimation);
10706
10707                            var jC = (0, _libs.$)('<canvas width="' + width + '" height="' + height + '"></canvas>');
10708                            this.c = jC[0];
10709                            this.p = {
10710                                g: 9.8,
10711                                dt: 1 / 60,
10712                                color: color,
10713                                updateInterval: 0.25
10714                            };
10715                            this.ctx = this.c.getContext('2d');
10716                            this.os = [-2, Math.PI / 2];
10717                            this.t = this.p.updateInterval;
10718                        }
10719
10720                        return LoadingAnimation;
10721                    }();
10722
10723                    exports.default = LoadingAnimation;
10724
10725                    /***/
10726                },
10727/* 53 */
10728/***/function (module, exports, __webpack_require__) {
10729
10730                    "use strict";
10731                    'use strict';
10732
10733                    exports.__esModule = true;
10734
10735                    var _libs = __webpack_require__(0);
10736
10737                    function _classCallCheck(instance, Constructor) {
10738                        if (!(instance instanceof Constructor)) {
10739                            throw new TypeError("Cannot call a class as a function");
10740                        }
10741                    }
10742
10743                    var LoadingController = function () {
10744                        function LoadingController(view) {
10745                            var showProgress = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
10746                            var loadingMsg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
10747
10748                            _classCallCheck(this, LoadingController);
10749
10750                            this.view = view;
10751                            this.progress = 0;
10752                            this.showProgress = showProgress;
10753                            this.getLoadingMsg = loadingMsg || LoadingController.defaultLoadingMsg;
10754                            this.updateView();
10755                        }
10756
10757                        LoadingController.defaultLoadingMsg = function defaultLoadingMsg(progress) {
10758                            return ['Please wait... the Application is Loading: ', progress, '%'].join('');
10759                        };
10760
10761                        LoadingController.prototype.dispose = function dispose() {
10762                            this.showProgress = false;
10763                            this.updateView();
10764                            delete this.view;
10765                        };
10766
10767                        LoadingController.prototype.setProgress = function setProgress(v) {
10768                            this.progress = v;
10769                            this.updateView();
10770                        };
10771
10772                        LoadingController.prototype.updateView = function updateView() {
10773                            if (this.view) {
10774
10775                                this.view.setState('widLoadingProgress', {
10776                                    enable: true,
10777                                    visible: this.showProgress,
10778                                    active: false
10779                                });
10780
10781                                this.view.setState('txtLoadingProgress', {
10782                                    value: this.getLoadingMsg(this.progress),
10783                                    visible: true
10784                                });
10785
10786                                for (var _iterator = this.view.getLinks(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
10787                                    var _ref;
10788
10789                                    if (_isArray) {
10790                                        if (_i >= _iterator.length) break;
10791                                        _ref = _iterator[_i++];
10792                                    } else {
10793                                        _i = _iterator.next();
10794                                        if (_i.done) break;
10795                                        _ref = _i.value;
10796                                    }
10797
10798                                    var name = _ref;
10799
10800                                    this.view.setState(name, {
10801                                        enable: false,
10802                                        visible: true,
10803                                        active: false
10804                                    });
10805                                }
10806
10807                                this.view.setState('inpPages', {
10808                                    visible: true,
10809                                    value: ''
10810                                });
10811
10812                                this.view.setState('inpPage', {
10813                                    visible: true,
10814                                    enable: false,
10815                                    value: ''
10816                                });
10817                            }
10818                        };
10819
10820                        return LoadingController;
10821                    }();
10822
10823                    exports.default = LoadingController;
10824
10825                    /***/
10826                },
10827/* 54 */
10828/***/function (module, exports, __webpack_require__) {
10829
10830                    "use strict";
10831                    'use strict';
10832
10833                    exports.__esModule = true;
10834
10835                    var _libs = __webpack_require__(0);
10836
10837                    var _EventConverter2 = __webpack_require__(6);
10838
10839                    var _EventConverter3 = _interopRequireDefault(_EventConverter2);
10840
10841                    function _interopRequireDefault(obj) {
10842                        return obj && obj.__esModule ? obj : { default: obj };
10843                    }
10844
10845                    function _classCallCheck(instance, Constructor) {
10846                        if (!(instance instanceof Constructor)) {
10847                            throw new TypeError("Cannot call a class as a function");
10848                        }
10849                    }
10850
10851                    function _possibleConstructorReturn(self, call) {
10852                        if (!self) {
10853                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
10854                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
10855                    }
10856
10857                    function _inherits(subClass, superClass) {
10858                        if (typeof superClass !== "function" && superClass !== null) {
10859                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
10860                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
10861                    }
10862
10863                    var MouseEventConverter = function (_EventConverter) {
10864                        _inherits(MouseEventConverter, _EventConverter);
10865
10866                        function MouseEventConverter(wnd, doc, element) {
10867                            _classCallCheck(this, MouseEventConverter);
10868
10869                            var _this = _possibleConstructorReturn(this, _EventConverter.call(this, wnd, doc));
10870
10871                            _this.element = element;
10872                            _this.binds = {
10873                                convert: _this.convert.bind(_this)
10874                            };
10875                            (0, _libs.$)(_this.element).on('mousemove mousedown mouseover mouseout click', _this.binds.convert);
10876                            (0, _libs.$)(_this.doc).on('mouseup', _this.binds.convert);
10877                            return _this;
10878                        }
10879
10880                        MouseEventConverter.prototype.dispose = function dispose() {
10881                            (0, _libs.$)(this.element).off('mousemove mousedown mouseover mouseout click', this.binds.convert);
10882                            (0, _libs.$)(this.doc).off('mouseup', this.binds.convert);
10883                        };
10884
10885                        return MouseEventConverter;
10886                    }(_EventConverter3.default);
10887
10888                    exports.default = MouseEventConverter;
10889
10890                    /***/
10891                },
10892/* 55 */
10893/***/function (module, exports, __webpack_require__) {
10894
10895                    "use strict";
10896                    'use strict';
10897
10898                    exports.__esModule = true;
10899
10900                    var _extends = Object.assign || function (target) {
10901                        for (var i = 1; i < arguments.length; i++) {
10902                            var source = arguments[i]; for (var key in source) {
10903                                if (Object.prototype.hasOwnProperty.call(source, key)) {
10904                                    target[key] = source[key];
10905                                }
10906                            }
10907                        } return target;
10908                    };
10909
10910                    var _libs = __webpack_require__(0);
10911
10912                    var _MathUtils = __webpack_require__(3);
10913
10914                    var _MathUtils2 = _interopRequireDefault(_MathUtils);
10915
10916                    function _interopRequireDefault(obj) {
10917                        return obj && obj.__esModule ? obj : { default: obj };
10918                    }
10919
10920                    function _classCallCheck(instance, Constructor) {
10921                        if (!(instance instanceof Constructor)) {
10922                            throw new TypeError("Cannot call a class as a function");
10923                        }
10924                    }
10925
10926                    var Object3DWatcher = function () {
10927                        function Object3DWatcher(visual, boundBoxClb) {
10928                            var testScale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.testScale;
10929
10930                            _classCallCheck(this, Object3DWatcher);
10931
10932                            this.visual = visual;
10933                            this.boundBoxClb = boundBoxClb;
10934                            this.testScale = testScale;
10935                            this.camera = visual.camera;
10936                            this.element = this.visual.element;
10937                            this.elementSize = { w: 1, h: 1 };
10938                            this.devicePixelRatio = this.visual.wnd.devicePixelRatio || 1;
10939                            this.orbit = visual.getOrbit();
10940                            this.scale = 1;
10941
10942                            this.eps = 1e-4;
10943                            this.v = new _libs.THREE.Vector3();
10944                            this.dv = new _libs.THREE.Vector2();
10945
10946                            this.enabled = false;
10947
10948                            visual.addRenderCallback(this.update.bind(this));
10949
10950                            this.os = {
10951                                vx: 0,
10952                                vy: 0,
10953                                x: 0,
10954                                y: 0
10955                            };
10956                            this.orbit.update();
10957                            this.camera.updateMatrixWorld();
10958                            var box = this.computeClientBoundBox(),
10959                                k = 1.11;
10960                            this.movePan({ x: -k * box.mid.x, y: -k * box.mid.y });
10961                        }
10962
10963                        Object3DWatcher.prototype.movePan = function movePan(dv) {
10964                            this.orbit.pan(dv.x * this.visual.width(), -dv.y * this.visual.height());
10965                        };
10966
10967                        Object3DWatcher.prototype.vToCamera = function vToCamera(v) {
10968                            v.project(this.camera);
10969                            return {
10970                                x: 0.5 * v.x,
10971                                y: 0.5 * v.y
10972                            };
10973                        };
10974
10975                        Object3DWatcher.prototype.computeClientBoundBox = function computeClientBoundBox() {
10976                            var box = this.boundBoxClb(),
10977                                xs = [box.min.x, box.max.x],
10978                                ys = [0, 0],
10979                                zs = [box.min.z, box.max.z];
10980
10981                            var ps = [],
10982                                res = { max: {}, min: {} };
10983                            for (var _iterator = xs, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
10984                                var _ref;
10985
10986                                if (_isArray) {
10987                                    if (_i >= _iterator.length) break;
10988                                    _ref = _iterator[_i++];
10989                                } else {
10990                                    _i = _iterator.next();
10991                                    if (_i.done) break;
10992                                    _ref = _i.value;
10993                                }
10994
10995                                var x = _ref;
10996
10997                                for (var _iterator2 = ys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
10998                                    var _ref2;
10999
11000                                    if (_isArray2) {
11001                                        if (_i2 >= _iterator2.length) break;
11002                                        _ref2 = _iterator2[_i2++];
11003                                    } else {
11004                                        _i2 = _iterator2.next();
11005                                        if (_i2.done) break;
11006                                        _ref2 = _i2.value;
11007                                    }
11008
11009                                    var y = _ref2;
11010
11011                                    for (var _iterator3 = zs, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
11012                                        var _ref3;
11013
11014                                        if (_isArray3) {
11015                                            if (_i3 >= _iterator3.length) break;
11016                                            _ref3 = _iterator3[_i3++];
11017                                        } else {
11018                                            _i3 = _iterator3.next();
11019                                            if (_i3.done) break;
11020                                            _ref3 = _i3.value;
11021                                        }
11022
11023                                        var z = _ref3;
11024
11025                                        ps.push(this.vToCamera(this.v.set(x, y, z)));
11026                                    }
11027                                }
11028                            }
11029
11030                            ps.sort(function (p1, p2) {
11031                                return p1.x - p2.x;
11032                            });
11033                            res.min.x = ps[0].x;
11034                            res.max.x = ps[ps.length - 1].x;
11035                            ps.sort(function (p1, p2) {
11036                                return p1.y - p2.y;
11037                            });
11038                            res.min.y = ps[0].y;
11039                            res.max.y = ps[ps.length - 1].y;
11040
11041                            res.width = res.max.x - res.min.x;
11042                            res.height = res.max.y - res.min.y;
11043
11044                            res.mid = {
11045                                x: 0.5 * (res.max.x + res.min.x),
11046                                y: 0.5 * (res.max.y + res.min.y)
11047                            };
11048
11049                            return res;
11050                        };
11051
11052                        Object3DWatcher.prototype.setObject = function setObject(boundBoxClb) {
11053                            this.boundBoxClb = boundBoxClb;
11054                        };
11055
11056                        Object3DWatcher.prototype.testScale = function testScale() {
11057                            return true;
11058                        };
11059
11060                        Object3DWatcher.prototype.computeCorr = function computeCorr(K, min, max) {
11061                            var corr = 0;
11062                            if (K < 1) {
11063                                if (min > -0.5) {
11064                                    corr = -0.5 - min;
11065                                } else if (max < 0.5) {
11066                                    corr = 0.5 - max;
11067                                }
11068                            } else {
11069                                if (min < -0.5) {
11070                                    corr = -0.5 - min;
11071                                } else if (max > 0.5) {
11072                                    corr = 0.5 - max;
11073                                }
11074                            }
11075                            return corr;
11076                        };
11077
11078                        Object3DWatcher.prototype.getScale = function getScale() {
11079                            var box = this.computeClientBoundBox(),
11080                                Kx = this.elementSize.w / box.width,
11081                                Ky = this.elementSize.h / box.height;
11082                            return 1 / Math.min(Kx, Ky);
11083                        };
11084
11085                        Object3DWatcher.prototype.centerView = function centerView(T) {
11086                            var _this = this;
11087
11088                            var box = this.computeClientBoundBox(),
11089                                Kx = this.elementSize.w / box.width,
11090                                Ky = this.elementSize.h / box.height,
11091                                K = Math.min(Kx, Ky);
11092
11093                            if (this.testScale() && Math.abs(1 / K - this.scale) > this.eps) {
11094                                var scale = 1 / K + 0.2 * (this.scale - 1 / K);
11095                                this.orbit.setScale(this.orbit.getScale() / (K * scale));
11096                                this.orbit.update();
11097                                this.camera.updateMatrixWorld();
11098                                box = this.computeClientBoundBox();
11099                                Kx = this.elementSize.w / box.width;
11100                                Ky = this.elementSize.h / box.height;
11101                                K = Math.min(Kx, Ky);
11102                            }
11103
11104                            var dv = this.dv;
11105                            if (K > 1 - this.eps) {
11106                                dv.set(-box.mid.x, -box.mid.y);
11107                            } else {
11108                                dv.set(this.computeCorr(Kx, box.min.x, box.max.x), this.computeCorr(Ky, box.min.y, box.max.y));
11109                            }
11110
11111                            if (Math.sqrt(this.os.vx * this.os.vx + this.os.vy * this.os.vy) > 0.003 || dv.length() > 0.003) {
11112                                var dt = 1 / 60,
11113                                    t = 0,
11114                                    os = _extends({}, this.os, {
11115                                        x: 0,
11116                                        y: 0
11117                                    });
11118                                os.tf = function (vx, vy, x, y) {
11119                                    return {
11120                                        x: 75 * (dv.x - x) / Math.pow(_this.devicePixelRatio, 1.0),
11121                                        y: 75 * (dv.y - y) / Math.pow(_this.devicePixelRatio, 1.0)
11122                                    };
11123                                };
11124                                while (t < T) {
11125                                    if (t + dt > T) {
11126                                        dt = T - t;
11127                                    }
11128                                    os = this.integrate(os, dt);
11129                                    t += dt;
11130                                }
11131                                this.movePan(os);
11132                                this.os = os;
11133                            }
11134                        };
11135
11136                        Object3DWatcher.prototype.integrate = function integrate(os, dt) {
11137                            var _MathUtils$rk = _MathUtils2.default.rk4(this.dy.bind(os), 0, dt, [os.vx, os.vy, os.x, os.y]),
11138                                vx = _MathUtils$rk[0],
11139                                vy = _MathUtils$rk[1],
11140                                x = _MathUtils$rk[2],
11141                                y = _MathUtils$rk[3];
11142
11143                            return _extends({}, os, {
11144                                vx: vx, vy: vy, x: x, y: y
11145                            });
11146                        };
11147
11148                        Object3DWatcher.prototype.dy = function dy(t, Y) {
11149                            var vx = Y[0],
11150                                vy = Y[1],
11151                                x = Y[2],
11152                                y = Y[3],
11153                                vd = 15,
11154                                tf = this.tf(vx, vy, x, y);
11155
11156                            return [tf.x - vd * vx, tf.y - vd * vy, vx, vy];
11157                        };
11158
11159                        Object3DWatcher.prototype.update = function update(dt) {
11160                            if (this.enabled && this.boundBoxClb) {
11161                                this.centerView(dt);
11162                            }
11163                        };
11164
11165                        return Object3DWatcher;
11166                    }();
11167
11168                    exports.default = Object3DWatcher;
11169
11170                    /***/
11171                },
11172/* 56 */
11173/***/function (module, exports, __webpack_require__) {
11174
11175                    "use strict";
11176                    'use strict';
11177
11178                    exports.__esModule = true;
11179
11180                    var _libs = __webpack_require__(0);
11181
11182                    function _classCallCheck(instance, Constructor) {
11183                        if (!(instance instanceof Constructor)) {
11184                            throw new TypeError("Cannot call a class as a function");
11185                        }
11186                    }
11187
11188                    function _possibleConstructorReturn(self, call) {
11189                        if (!self) {
11190                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11191                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
11192                    }
11193
11194                    function _inherits(subClass, superClass) {
11195                        if (typeof superClass !== "function" && superClass !== null) {
11196                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
11197                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
11197onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
11198                    }
11199
11200                    var Orbit = function (_THREE$EventDispatche) {
11201                        _inherits(Orbit, _THREE$EventDispatche);
11202
11203                        function Orbit(object, domElement) {
11204                            _classCallCheck(this, Orbit);
11205
11206                            var _this = _possibleConstructorReturn(this, _THREE$EventDispatche.call(this));
11207
11208                            _this.object = object;
11209                            _this.domElement = domElement || document.body;
11210
11211                            // Set to false to disable this control
11212                            _this.enabled = true;
11213
11214                            // "target" sets the location of focus, where the object orbits around
11215                            _this.target = new _libs.THREE.Vector3();
11216
11217                            // How far you can dolly in and out(PerspectiveCamera only)
11218                            _this.minDistance = 0;
11219                            _this.maxDistance = Infinity;
11220
11221                            // How far you can zoom in and out(OrthographicCamera only)
11222                            _this.minZoom = 0;
11223                            _this.maxZoom = Infinity;
11224
11225                            // How far you can orbit vertically, upper and lower limits.
11226                            // Range is 0 to Math.PI radians.
11227                            _this.minPolarAngle = 0; // radians
11228                            _this.maxPolarAngle = Math.PI; // radians
11229
11230                            // How far you can orbit horizontally, upper and lower limits.
11231                            // If set, must be a sub-interval of the interval [-Math.PI, Math.PI ].
11232                            _this.minAzimuthAngle = -Infinity; // radians
11233                            _this.maxAzimuthAngle = Infinity; // radians
11234
11235                            // Set to true to enable damping (inertia)
11236                            // If damping is enabled, you must call controls.update() in your animation loop
11237                            _this.enableDamping = false;
11238                            _this.dampingFactor = 0.25;
11239
11240                            // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
11241                            // Set to false to disable zooming
11242                            _this.enableZoom = true;
11243                            _this.zoomSpeed = 1.0;
11244
11245                            // Set to false to disable rotating
11246                            _this.enableRotate = true;
11247                            _this.rotateSpeed = 1.0;
11248
11249                            // Set to false to disable panning
11250                            _this.enablePan = true;
11251
11252                            // Set to true to automatically rotate around the target
11253                            // If auto-rotate is enabled, you must call controls.update() in your animation loop
11254                            _this.autoRotate = false;
11255                            _this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
11256
11257                            // for reset
11258                            _this.target0 = _this.target.clone();
11259                            _this.position0 = _this.object.position.clone();
11260                            _this.zoom0 = _this.object.zoom;
11261
11262                            //
11263                            // public methods
11264                            //
11265                            _this.getPolarAngle = function () {
11266                                return spherical.phi;
11267                            };
11268
11269                            _this.getAzimuthalAngle = function () {
11270                                return spherical.theta;
11271                            };
11272
11273                            _this.reset = function () {
11274                                scope.target.copy(scope.target0);
11275                                scope.object.position.copy(scope.position0);
11276                                scope.object.zoom = scope.zoom0;
11277
11278                                scope.object.updateProjectionMatrix();
11279                                scope.dispatchEvent(changeEvent);
11280
11281                                scope.update();
11282                            };
11283
11284                            _this.zoomOut = function () {
11285                                var speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.zoomSpeed;
11286
11287                                var _speed = this.zoomSpeed;
11288                                this.zoomSpeed = speed;
11289                                dollyIn(getZoomScale());
11290                                this.zoomSpeed = _speed;
11291                            };
11292
11293                            _this.zoomIn = function () {
11294                                var speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.zoomSpeed;
11295
11296                                var _speed = this.zoomSpeed;
11297                                this.zoomSpeed = speed;
11298                                dollyOut(getZoomScale());
11299                                this.zoomSpeed = _speed;
11300                            };
11301
11302                            _this.getScale = function () {
11303                                return scale;
11304                            };
11305
11306                            _this.setScale = function (newScale) {
11307                                scale = newScale;
11308                            };
11309
11310                            // this method is exposed, but perhaps it would be better if we can make it private...
11311                            _this.update = function () {
11312                                var offset = new _libs.THREE.Vector3();
11313                                // so camera.up is the orbit axis
11314                                var quat = new _libs.THREE.Quaternion().setFromUnitVectors(object.up, new _libs.THREE.Vector3(0, 1, 0));
11315                                var quatInverse = quat.clone().inverse();
11316                                var lastPosition = new _libs.THREE.Vector3();
11317                                var lastQuaternion = new _libs.THREE.Quaternion();
11318
11319                                return function update() {
11320                                    var position = scope.object.position;
11321                                    offset.copy(position).sub(scope.target);
11322                                    // rotate offset to "y-axis-is-up" space
11323                                    offset.applyQuaternion(quat);
11324                                    // angle from z-axis around y-axis
11325                                    spherical.setFromVector3(offset);
11326                                    if (scope.autoRotate) {
11327                                        rotateLeft(getAutoRotationAngle());
11328                                    }
11329                                    spherical.theta += sphericalDelta.theta;
11330                                    spherical.phi += sphericalDelta.phi;
11331                                    // restrict theta to be between desired limits
11332                                    spherical.theta = Math.max(scope.minAzimuthAngle, Math.min(scope.maxAzimuthAngle, spherical.theta));
11333                                    // restrict phi to be between desired limits
11334                                    spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));
11335                                    spherical.makeSafe();
11336                                    spherical.radius *= scale;
11337                                    // restrict radius to be between desired limits
11338                                    spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));
11339                                    // move target to panned location
11340                                    scope.target.add(panOffset);
11341                                    offset.setFromSpherical(spherical);
11342                                    // rotate offset back to "camera-up-vector-is-up" space
11343                                    offset.applyQuaternion(quatInverse);
11344                                    position.copy(scope.target).add(offset);
11345                                    scope.object.lookAt(scope.target);
11346
11347                                    if (scope.enableDamping === true) {
11348                                        sphericalDelta.theta *= 1 - scope.dampingFactor;
11349                                        sphericalDelta.phi *= 1 - scope.dampingFactor;
11350                                    } else {
11351                                        sphericalDelta.set(0, 0, 0);
11352                                    }
11353
11354                                    scale = 1;
11355                                    panOffset.set(0, 0, 0);
11356
11357                                    // update condition is:
11358                                    // min(camera displacement, camera rotation in radians)^2 > EPS
11359                                    // using small-angle approximation cos(x/2) = 1-x^2 / 8
11360
11361                                    if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {
11362
11363                                        scope.dispatchEvent(changeEvent);
11364
11365                                        lastPosition.copy(scope.object.position);
11366                                        lastQuaternion.copy(scope.object.quaternion);
11367                                        zoomChanged = false;
11368
11369                                        return true;
11370                                    }
11371                                    return false;
11372                                };
11373                            }();
11374
11375                            _this.dispose = function () { };
11376
11377                            //
11378                            // internals
11379                            //
11380                            var scope = _this;
11381                            var changeEvent = { type: 'change' };
11382                            var EPS = 1e-6;
11383                            // current position in spherical coordinates
11384                            var spherical = new _libs.THREE.Spherical();
11385                            var sphericalDelta = new _libs.THREE.Spherical();
11386
11387                            var scale = 1;
11388                            var panOffset = new _libs.THREE.Vector3();
11389                            var zoomChanged = false;
11390
11391                            function getAutoRotationAngle() {
11392                                return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
11393                            }
11394
11395                            function getZoomScale() {
11396                                return Math.pow(0.95, scope.zoomSpeed);
11397                            }
11398
11399                            function rotateLeft(angle) {
11400                                sphericalDelta.theta -= angle;
11401                            }
11402
11403                            function rotateUp(angle) {
11404                                sphericalDelta.phi -= angle;
11405                            }
11406
11407                            var panLeft = function () {
11408                                var v = new _libs.THREE.Vector3();
11409                                return function panLeft(distance, objectMatrix) {
11410                                    v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix
11411                                    v.multiplyScalar(-distance);
11412                                    panOffset.add(v);
11413                                };
11414                            }();
11415
11416                            var panUp = function () {
11417                                var v = new _libs.THREE.Vector3();
11418                                return function panUp(distance, objectMatrix) {
11419                                    v.setFromMatrixColumn(objectMatrix, 1); // get Y column of objectMatrix
11420                                    v.multiplyScalar(distance);
11421                                    panOffset.add(v);
11422                                };
11423                            }();
11424
11425                            // deltaX and deltaY are in pixels; right and down are positive
11426                            scope.pan = function () {
11427                                var offset = new _libs.THREE.Vector3();
11428                                return function pan(deltaX, deltaY) {
11429                                    var element = scope.domElement;
11430                                    if (scope.object instanceof _libs.THREE.PerspectiveCamera) {
11431                                        // perspective
11432                                        var position = scope.object.position;
11433                                        offset.copy(position).sub(scope.target);
11434                                        var targetDistance = offset.length();
11435                                        // half of the fov is center to top of screen
11436                                        targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0);
11437                                        // we actually don't use screenWidth, since perspective camera is fixed to screen height
11438                                        panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);
11439                                        panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);
11440                                    } else if (scope.object instanceof _libs.THREE.OrthographicCamera) {
11441                                        // orthographic
11442                                        panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, scope.object.matrix);
11443                                        panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, scope.object.matrix);
11444                                    } else {
11445                                        // camera neither orthographic nor perspective
11446                                        console.warn('WARNING: OrbitControls.js encountered an unknown camera type-pan disabled.');
11447                                        scope.enablePan = false;
11448                                    }
11449                                };
11450                            }();
11451
11452                            function dollyIn(dollyScale) {
11453                                if (scope.object instanceof _libs.THREE.PerspectiveCamera) {
11454                                    scale /= dollyScale;
11455                                } else if (scope.object instanceof _libs.THREE.OrthographicCamera) {
11456                                    scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));
11457                                    scope.object.updateProjectionMatrix();
11458                                    zoomChanged = true;
11459                                } else {
11460                                    console.warn('WARNING: OrbitControls.js encountered an unknown camera type-dolly/zoom disabled.');
11461                                    scope.enableZoom = false;
11462                                }
11463                            }
11464
11465                            function dollyOut(dollyScale) {
11466                                if (scope.object instanceof _libs.THREE.PerspectiveCamera) {
11467                                    scale *= dollyScale;
11468                                } else if (scope.object instanceof _libs.THREE.OrthographicCamera) {
11469                                    scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));
11470                                    scope.object.updateProjectionMatrix();
11471                                    zoomChanged = true;
11472                                } else {
11473                                    console.warn('WARNING: OrbitControls.js encountered an unknown camera type-dolly/zoom disabled.');
11474                                    scope.enableZoom = false;
11475                                }
11476                            }
11477
11478                            /* Actions */
11479
11480                            function rotate(event, data) {
11481                                if (scope.enabled && scope.enableRotate && data.state === 'move') {
11482                                    var element = scope.domElement;
11483                                    // rotating across whole screen goes 360 degrees around
11484                                    rotateLeft(2 * Math.PI * data.dx / element.clientWidth * scope.rotateSpeed);
11485                                    // rotating up and down along whole screen attempts to go 360, but limited to 180
11486                                    rotateUp(2 * Math.PI * data.dy / element.clientHeight * scope.rotateSpeed);
11487                                    scope.update();
11488                                }
11489                            }
11490
11491                            function pan(event, data) {
11492                                if (scope.enabled && scope.enablePan && data.state === 'move') {
11493                                    scope.pan(data.dx, data.dy);
11494                                    scope.update();
11495                                }
11496                            }
11497
11498                            function offsetDolly(event, data) {
11499                                if (scope.enabled && scope.enableZoom && data.state === 'move') {
11500                                    if (data.dy > 0) {
11501                                        dollyIn(getZoomScale());
11502                                    } else if (data.dy < 0) {
11503                                        dollyOut(getZoomScale());
11504                                    }
11505                                    scope.update();
11506                                }
11507                            }
11508
11509                            function wheelDolly(event) {
11510                                if (scope.enabled && scope.enableZoom) {
11511                                    if (event.deltaY > 0) {
11512                                        dollyOut(getZoomScale());
11513                                    } else if (event.deltaY < 0) {
11514                                        dollyIn(getZoomScale());
11515                                    }
11516                                    scope.update();
11517                                }
11518                            }
11519
11520                            _this.actions = {
11521                                rotate: rotate,
11522                                pan: pan,
11523                                offsetDolly: offsetDolly,
11524                                wheelDolly: wheelDolly
11525                            };
11526
11527                            // force an update at start
11528                            _this.update();
11529                            return _this;
11530                        }
11531
11532                        return Orbit;
11533                    }(_libs.THREE.EventDispatcher);
11534
11535                    exports.default = Orbit;
11536
11537                    /***/
11538                },
11539/* 57 */
11540/***/function (module, exports, __webpack_require__) {
11541
11542                    "use strict";
11543                    'use strict';
11544
11545                    exports.__esModule = true;
11546
11547                    var _libs = __webpack_require__(0);
11548
11549                    var _ImageBase2 = __webpack_require__(5);
11550
11551                    var _ImageBase3 = _interopRequireDefault(_ImageBase2);
11552
11553                    var _Pdf = __webpack_require__(18);
11554
11555                    var _Pdf2 = _interopRequireDefault(_Pdf);
11556
11557                    var _BaseMathUtils = __webpack_require__(2);
11558
11559                    var _BaseMathUtils2 = _interopRequireDefault(_BaseMathUtils);
11560
11561                    var _CustomEventConverter = __webpack_require__(16);
11562
11563                    var _CustomEventConverter2 = _interopRequireDefault(_CustomEventConverter);
11564
11565                    var _PolyTarget = __webpack_require__(69);
11566
11567                    var _PolyTarget2 = _interopRequireDefault(_PolyTarget);
11568
11569                    var _Finder = __webpack_require__(17);
11570
11571                    var _Finder2 = _interopRequireDefault(_Finder);
11572
11573                    function _interopRequireDefault(obj) {
11574                        return obj && obj.__esModule ? obj : { default: obj };
11575                    }
11576
11577                    function _classCallCheck(instance, Constructor) {
11578                        if (!(instance instanceof Constructor)) {
11579                            throw new TypeError("Cannot call a class as a function");
11580                        }
11581                    }
11582
11583                    function _possibleConstructorReturn(self, call) {
11584                        if (!self) {
11585                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11586                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
11587                    }
11588
11589                    function _inherits(subClass, superClass) {
11590                        if (typeof superClass !== "function" && superClass !== null) {
11591                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
11592                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
11592onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
11593                    }
11594
11595                    var PdfImage = function (_ImageBase) {
11596                        _inherits(PdfImage, _ImageBase);
11597
11598                        function PdfImage(context, width, height, color, pdf, n) {
11599                            _classCallCheck(this, PdfImage);
11600
11601                            var _this = _possibleConstructorReturn(this, _ImageBase.call(this, context, width, height, color));
11602
11603                            _this.query = '';
11604                            _this.n = n;
11605                            _this.pdf = pdf;
11606                            _this.v = {
11607                                x: 0, y: 0, z: 0, set: function set(x, y, z) {
11608                                    this.x = x; this.y = y; this.z = z;
11609                                    return this;
11610                                }, transform: function transform(m) {
11611                                    var x = m.m[0][0] * this.x + m.m[1][0] * this.y + m.m[2][0] * this.z,
11612                                        y = m.m[0][1] * this.x + m.m[1][1] * this.y + m.m[2][1] * this.z,
11613                                        z = m.m[0][2] * this.x + m.m[0][2] * this.y + m.m[2][0] * this.z;
11614                                    this.x = x;
11615                                    this.y = y;
11616                                    this.z = z;
11617                                    return this;
11618                                }
11619                            };
11620                            _this.m = {
11621                                m: [[1, 0, 0], [0, 1, 0], [0, 0, 1]], set: function set(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
11622                                    this.m = [[m00, m01, m02], [m10, m11, m12], [m20, m21, m22]];
11623                                    return this;
11624                                }
11625                            };
11626
11627                            _this.startRender = function () {
11628                                _this.pdf.getHandler(_this.render.bind(_this));
11629                            };
11630                            Promise.resolve().then(function () {
11631                                return _this.pdf.getHandler(_this.init.bind(_this));
11632                            });
11633                            return _this;
11634                        }
11635
11636                        PdfImage.prototype.setQuery = function setQuery(query) {
11637                            this.query = query.trim();
11638                            if (this.textContent) {
11639                                this.setHits(this.textContent);
11640                                // this.finishLoad();
11641                            }
11642                        };
11643
11644                        PdfImage.prototype.rectSize = function rectSize(r) {
11645                            return {
11646                                width: r[2] - r[0],
11647                                height: r[3] - r[1]
11648                            };
11649                        };
11650
11651                        PdfImage.prototype.createPoly = function createPoly(m, p, s) {
11652                            var poly = [],
11653                                v = this.v;
11654                            v.set(p.x, p.y, 1).transform(m);
11655                            poly.push({ x: v.x, y: v.y });
11656                            v.set(p.x, p.y + s.height, 1).transform(m);
11657                            poly.push({ x: v.x, y: v.y });
11658                            v.set(p.x + s.width, p.y + s.height, 1).transform(m);
11659                            poly.push({ x: v.x, y: v.y });
11660                            v.set(p.x + s.width, p.y, 1).transform(m);
11661                            poly.push({ x: v.x, y: v.y });
11662                            return poly;
11663                        };
11664
11665                        PdfImage.prototype.getSimulatedDoc = function getSimulatedDoc() {
11666                            return this.page;
11667                        };
11668
11669                        PdfImage.prototype.simulate = function simulate(e, doc, x, y) {
11670                            if (this.eventConverter) {
11671                                this.eventConverter.convert(e, { doc: doc, x: x, y: y });
11672                            }
11673                        };
11674
11675                        PdfImage.prototype.setAnnotations = function setAnnotations(annos) {
11676                            var _this2 = this;
11677
11678                            var t = this.viewport.transform,
11679                                targets = [];
11680                            this.m.set(t[0], t[1], 0, t[2], t[3], 0, t[4], t[5], 1);
11681
11682                            for (var _iterator = annos, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
11683                                var _ref;
11684
11685                                if (_isArray) {
11686                                    if (_i >= _iterator.length) break;
11687                                    _ref = _iterator[_i++];
11688                                } else {
11689                                    _i = _iterator.next();
11690                                    if (_i.done) break;
11691                                    _ref = _i.value;
11692                                }
11693
11694                                var anno = _ref;
11695
11696                                if (anno.subtype === 'Link') {
11697                                    var rect = anno.rect,
11698                                        aPos = {
11699                                            x: rect[0],
11700                                            y: rect[1]
11701                                        },
11702                                        aSz = this.rectSize(rect);
11703                                    var _target = new _PolyTarget2.default(this.createPoly(this.m, aPos, aSz).map(function (p) {
11704                                        return { x: p.x / _this2.viewport.width, y: 1 - p.y / _this2.viewport.height };
11705                                    }));
11706                                    _target.anno = anno;
11707                                    _target.callback = this.annoClb.bind(this);
11708                                    targets.push(_target);
11709                                }
11710                            }
11711                            if (targets.length) {
11712                                this.eventConverter = new _CustomEventConverter2.default(this.wnd, this.doc, _PolyTarget2.default.test, this.page);
11713                                for (var _iterator2 = targets, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
11714                                    var _ref2;
11715
11716                                    if (_isArray2) {
11717                                        if (_i2 >= _iterator2.length) break;
11718                                        _ref2 = _iterator2[_i2++];
11719                                    } else {
11720                                        _i2 = _iterator2.next();
11721                                        if (_i2.done) break;
11722                                        _ref2 = _i2.value;
11723                                    }
11724
11725                                    var target = _ref2;
11726
11727                                    this.eventConverter.addCustom(target);
11728                                }
11729                            }
11730                        };
11731
11732                        PdfImage.prototype.setHits = function setHits(textContent) {
11733                            this.textContent = textContent;
11734                            if (this.query !== '') {
11735                                this.finder = new _Finder2.default(textContent.items.map(function (item) {
11736                                    return item.str;
11737                                }), this.query, { contexts: false });
11738                            }
11739                        };
11740
11741                        PdfImage.prototype.renderHits = function renderHits() {
11742                            var _this3 = this;
11743
11744                            if (this.finder) {
11745                                var view = this.page.view,
11746                                    testSz = (0, _libs.$)('<div style="position: absolute; visibility: hidden;"></div>').appendTo('body'),
11747                                    textDiv = testSz[0],
11748                                    baseOffset = testSz.offset().left;
11749                                for (var _iterator3 = this.finder.getHits(), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
11750                                    var _ref3;
11751
11752                                    if (_isArray3) {
11753                                        if (_i3 >= _iterator3.length) break;
11754                                        _ref3 = _iterator3[_i3++];
11755                                    } else {
11756                                        _i3 = _iterator3.next();
11757                                        if (_i3.done) break;
11758                                        _ref3 = _i3.value;
11759                                    }
11760
11761                                    var hit = _ref3;
11762
11763                                    var item = this.textContent.items[hit.index],
11764                                        t = PDFJS.Util.transform(this.viewport.transform, item.transform),
11765                                        style = this.textContent.styles[item.fontName],
11766                                        angle = Math.atan2(t[1], t[0]) + (style.vertical ? Math.PI / 2 : 0),
11767                                        fontHeight = Math.sqrt(t[2] * t[2] + t[3] * t[3]),
11768                                        fontAscent = style.ascent ? style.ascent * fontHeight : style.descent ? (1 + style.descent) * fontHeight : fontHeight;
11769                                    testSz.html(item.str.substr(0, hit.offset) + '<span>' + item.str.substr(hit.offset, hit.length) + '</span>' + item.str.substr(hit.offset + hit.length));
11770
11771                                    textDiv.style.fontSize = fontHeight + 'px';
11772                                    textDiv.style.fontFamily = style.fontFamily;
11773
11774                                    var testSpan = testSz.find('span'),
11775                                        iwidth = style.vertical ? item.height * this.viewport.scale : item.width * this.viewport.scale,
11776                                        width = testSz.width(),
11777                                        relativeOffset = (testSpan.offset().left - baseOffset) / width;
11778                                    this.m.set(1, 0, 0, 0, 1, 0, t[4] + fontAscent * Math.sin(angle), t[5] - fontAscent * Math.cos(angle), 1);
11779                                    var poly = this.createPoly(this.m, { x: relativeOffset * iwidth, y: 0 }, { width: iwidth * testSpan.width() / width, height: testSpan.height() });
11780                                    poly = poly.map(function (p) {
11781                                        return { x: p.x / _this3.viewport.width, y: 1 - p.y / _this3.viewport.height };
11782                                    });
11783                                    this.renderHit(poly);
11784                                }
11785                                testSz.remove();
11786                            }
11787                        };
11788
11789                        PdfImage.prototype.annoClb = function annoClb(e, data) {
11790                            if (this.context.dispatchEvent) {
11791                                this.context.dispatchEvent({
11792                                    type: 'pdfAnnotation',
11793                                    event: e,
11794                                    annotation: data.target.anno
11795                                });
11796                            }
11797                        };
11798
11799                        PdfImage.prototype.calcViewport = function calcViewport() {
11800                            var scale = _BaseMathUtils2.default.calcScale(this.size.width, this.size.height, this.resW, this.resH);
11801                            if (!this.viewport || Math.abs(this.viewport.scale - scale) > 1e-4) {
11802                                this.viewport = this.page.getViewport(scale);
11803                                if (this.type !== 'full') {
11804                                    if (this.type === 'right') {
11805                                        this.viewport.offsetX += 0.5 * this.viewport.width;
11806                                        this.viewport.transform[4] -= 0.5 * this.viewport.width;
11807                                    }
11808                                    this.viewport.width /= 2;
11809                                }
11810                                this.resW = this.width = this.viewport.width;
11811                                this.resH = this.height = this.viewport.height;
11812                            }
11813                        };
11814
11815                        PdfImage.prototype.init = function init() {
11816                            var _this4 = this;
11817
11818                            this.type = this.pdf.getPageType(this.n);
11819                            this.pdf.getPage(this.n).then(function (page) {
11820                                _this4.page = page;
11821                                _this4.size = _Pdf2.default.getPageSize(page);
11822                                if (_this4.type !== 'full') {
11823                                    _this4.size.width /= 2;
11824                                }
11825                                page.getAnnotations().then(_this4.setAnnotations.bind(_this4));
11826                                page.getTextContent().then(_this4.setHits.bind(_this4));
11827                                _this4.calcViewport();
11828                                _this4.finishLoad();
11829                            }).catch(function (e) {
11830                                console.error('Cannot load PDF page: ' + (_this4.n + 1));
11831                                _this4.finishLoad();
11832                            });
11833                        };
11834
11835                        PdfImage.prototype.setResolution = function setResolution(res) {
11836                            _ImageBase.prototype.setResolution.call(this, res);
11837                            if (this.page) {
11838                                this.calcViewport();
11839                            }
11840                        };
11841
11842                        PdfImage.prototype.render = function render(handler) {
11843                            var _this5 = this;
11844
11845                            if (this.page) {
11846                                this.page.render({
11847                                    canvasContext: this.pushCtx(),
11848                                    viewport: this.viewport
11849                                }).then(function () {
11850                                    _this5.renderHits();
11851                                    _this5.popCtx();
11852                                    _this5.finishRender();
11853                                });
11854                            } else {
11855                                this.renderBlankPage();
11856                                this.finishRender();
11857                            }
11858                        };
11859
11860                        return PdfImage;
11861                    }(_ImageBase3.default);
11862
11863                    exports.default = PdfImage;
11864
11865                    /***/
11866                },
11867/* 58 */
11868/***/function (module, exports, __webpack_require__) {
11869
11870                    "use strict";
11871                    'use strict';
11872
11873                    exports.__esModule = true;
11874
11875                    var _libs = __webpack_require__(0);
11876
11877                    function _classCallCheck(instance, Constructor) {
11878                        if (!(instance instanceof Constructor)) {
11879                            throw new TypeError("Cannot call a class as a function");
11880                        }
11881                    }
11882
11883                    var Search = function () {
11884                        function Search(container, pages) {
11885                            _classCallCheck(this, Search);
11886
11887                            this.container = container;
11888                            this.pages = pages;
11889                            this.prevResults = [];
11890                            container.html('\n      <div class="search">\n        <div class="query">\n          <input class="inpQuery" type="text" maxlength="30" value="" />\n        </div>\n        <div class="results">\n        </div>\n        <div class="status">\n\n        </div>\n      </div>\n    ');
11891                            this.query = container.find('.query input');
11892                            this.results = container.find('.results');
11893                            this.status = container.find('.status');
11894
11895                            this.binds = {
11896                                navigate: this.navigate.bind(this),
11897                                doQuery: this.doQuery.bind(this)
11898                            };
11899
11900                            this.query.on('keydown', this.binds.doQuery);
11901                            this.results.on('click', this.binds.navigate);
11902                        }
11903
11904                        Search.prototype.dispose = function dispose() {
11905                            this.results.off('click', this.binds.navigate);
11906                            this.query.off('keydown', this.binds.doQuery);
11907                        };
11908
11909                        Search.prototype.navigate = function navigate(e) {
11910                            e.preventDefault();
11911                            if (this.onNavigate !== undefined) {
11912                                var target = (0, _libs.$)(e.target);
11913                                if (!target.hasClass('result')) {
11914                                    var t = target.find('.result');
11915                                    if (t.length) {
11916                                        target = t;
11917                                    } else {
11918                                        while (target.length && !target.hasClass('result')) {
11919                                            target = (0, _libs.$)(target[0].parentNode);
11920                                        }
11921                                    }
11922                                }
11923                                var page = target.attr('data');
11924                                if (page !== undefined) {
11925                                    this.onNavigate(parseInt(page));
11926                                }
11927                            }
11928                        };
11929
11930                        Search.prototype.doQuery = function doQuery() {
11931                            var _this = this;
11932
11933                            if (this.onQuery) {
11934                                var queryStamp = this.queryStamp = Date.now();
11935                                setTimeout(function () {
11936                                    if (queryStamp === _this.queryStamp) {
11937                                        _this.onQuery(_this.query[0].value.trim());
11938                                    }
11939                                }, 1000);
11940                            }
11941                        };
11942
11943                        Search.prototype.setResults = function setResults(results, lastPage) {
11944                            if (this.prevResults.length && results[0] !== this.prevResults[0]) {
11945                                this.prevResults = [];
11946                                this.results.html('');
11947                            }
11948                            var htmls = [];
11949                            for (var i = this.prevResults.length; i < results.length; ++i) {
11950                                var result = results[i];
11951                                htmls.push('<div class="result" data="' + result.page + '">');
11952                                htmls.push('<a href="#">');
11953                                htmls.push('<div>' + result.contexts.join('</div><div>') + '</div>');
11954                                htmls.push('</a>');
11955                                htmls.push('</div>');
11956                            }
11957                            (0, _libs.$)(htmls.join('')).appendTo(this.results);
11958                            this.prevResults = [].concat(results);
11959                            if (lastPage === undefined) {
11960                                this.status.html('');
11961                            } else {
11962                                this.status.html(lastPage + ' of ' + this.pages);
11963                            }
11964                        };
11965
11966                        return Search;
11967                    }();
11968
11969                    exports.default = Search;
11970
11971                    /***/
11972                },
11973/* 59 */
11974/***/function (module, exports, __webpack_require__) {
11975
11976                    "use strict";
11977                    'use strict';
11978
11979                    exports.__esModule = true;
11980
11981                    var _libs = __webpack_require__(0);
11982
11983                    var _ImageBase2 = __webpack_require__(5);
11984
11985                    var _ImageBase3 = _interopRequireDefault(_ImageBase2);
11986
11987                    var _Utils = __webpack_require__(4);
11988
11989                    var _Utils2 = _interopRequireDefault(_Utils);
11990
11991                    function _interopRequireDefault(obj) {
11992                        return obj && obj.__esModule ? obj : { default: obj };
11993                    }
11994
11995                    function _classCallCheck(instance, Constructor) {
11996                        if (!(instance instanceof Constructor)) {
11997                            throw new TypeError("Cannot call a class as a function");
11998                        }
11999                    }
12000
12001                    function _possibleConstructorReturn(self, call) {
12002                        if (!self) {
12003                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12004                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
12005                    }
12006
12007                    function _inherits(subClass, superClass) {
12008                        if (typeof superClass !== "function" && superClass !== null) {
12009                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
12010                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
12010onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
12011                    }
12012
12013                    var StaticImage = function (_ImageBase) {
12014                        _inherits(StaticImage, _ImageBase);
12015
12016                        function StaticImage(context, width, height, color, src) {
12017                            _classCallCheck(this, StaticImage);
12018
12019                            var _this = _possibleConstructorReturn(this, _ImageBase.call(this, context, width, height, color));
12020
12021                            _this.binds = {};
12022                            _this.image = new Image();
12023                            _this.image.crossOrigin = 'Anonymous';
12024                            _this.binds.imageLoad = function () {
12025                                _this.width = _this.image.width;
12026                                _this.height = _this.image.height;
12027                                _this.startRender = function () {
12028                                    _this.renderImage(_this.image);
12029                                    _this.finishRender();
12030                                };
12031                                _this.finishLoad();
12032                            };
12033                            _this.binds.imageError = function () {
12034                                _this.startRender = function () {
12035                                    _this.renderNotFoundPage();
12036                                    _this.finishRender();
12037                                };
12038                                _this.finishLoad();
12039                            };
12040                            (0, _libs.$)(_this.image).on('load', _this.binds.imageLoad).on('error', _this.binds.imageError);
12041                            _this.image.src = _Utils2.default.normalizeUrl(src);
12042                            return _this;
12043                        }
12044
12045                        StaticImage.prototype.dispose = function dispose() {
12046                            (0, _libs.$)(this.image).off('load', this.binds.imageLoad).off('error', this.binds.imageError);
12047                            this.image.src = '';
12048                            delete this.image;
12049                            _ImageBase.prototype.dispose.call(this);
12050                        };
12051
12052                        return StaticImage;
12053                    }(_ImageBase3.default);
12054
12055                    exports.default = StaticImage;
12056
12057                    /***/
12058                },
12059/* 60 */
12060/***/function (module, exports, __webpack_require__) {
12061
12062                    "use strict";
12063                    'use strict';
12064
12065                    exports.__esModule = true;
12066
12067                    var _libs = __webpack_require__(0);
12068
12069                    function _classCallCheck(instance, Constructor) {
12070                        if (!(instance instanceof Constructor)) {
12071                            throw new TypeError("Cannot call a class as a function");
12072                        }
12073                    }
12074
12075                    var TextureAnimator = function () {
12076                        function TextureAnimator(img, tilesHoriz, tilesVert, numTiles, tileDispDuration) {
12077                            _classCallCheck(this, TextureAnimator);
12078
12079                            var texture = new _libs.THREE.Texture();
12080                            texture.minFilter = _libs.THREE.LinearFilter;
12081                            texture.image = img;
12082                            texture.needsUpdate = true;
12083
12084                            // note: texture passed by reference, will be updated by the update function.
12085                            this.texture = texture;
12086                            this.tilesHorizontal = tilesHoriz;
12087                            this.tilesVertical = tilesVert;
12088                            // how many images does this spritesheet contain?
12089                            //  usually equals tilesHoriz * tilesVert, but not necessarily,
12090                            //  if there at blank tiles at the bottom of the spritesheet.
12091                            this.numberOfTiles = numTiles;
12092                            texture.repeat.set(1 / this.tilesHorizontal, 1 / this.tilesVertical);
12093
12094                            // how long should each image be displayed?
12095                            this.tileDisplayDuration = tileDispDuration;
12096
12097                            // how long has the current image been displayed?
12098                            this.currentDisplayTime = 0;
12099
12100                            // which image is currently being displayed?
12101                            this.currentTile = 0;
12102                        }
12103
12104                        TextureAnimator.prototype.update = function update(milliSec) {
12105                            this.currentDisplayTime += milliSec;
12106                            while (this.currentDisplayTime > this.tileDisplayDuration) {
12107                                this.currentDisplayTime -= this.tileDisplayDuration;
12108                                ++this.currentTile;
12109                                if (this.currentTile == this.numberOfTiles) this.currentTile = 0;
12110                                var currentColumn = this.currentTile % this.tilesHorizontal;
12111                                this.texture.offset.x = currentColumn / this.tilesHorizontal;
12112                                var currentRow = Math.floor(this.currentTile / this.tilesHorizontal);
12113                                this.texture.offset.y = currentRow / this.tilesVertical;
12114                            }
12115                        };
12116
12117                        TextureAnimator.prototype.dispose = function dispose() {
12118                            var img = this.texture.image;
12119                            img.height = img.width = 0;
12120                            this.texture.dispose();
12121                        };
12122
12123                        return TextureAnimator;
12124                    }();
12125
12126                    exports.default = TextureAnimator;
12127
12128                    /***/
12129                },
12130/* 61 */
12131/***/function (module, exports, __webpack_require__) {
12132
12133                    "use strict";
12134                    'use strict';
12135
12136                    exports.__esModule = true;
12137
12138                    var _libs = __webpack_require__(0);
12139
12140                    var _Utils = __webpack_require__(4);
12141
12142                    var _Utils2 = _interopRequireDefault(_Utils);
12143
12144                    var _MouseEventConverter2 = __webpack_require__(54);
12145
12146                    var _MouseEventConverter3 = _interopRequireDefault(_MouseEventConverter2);
12147
12148                    var _ThreeEventConverter = __webpack_require__(19);
12149
12150                    var _ThreeEventConverter2 = _interopRequireDefault(_ThreeEventConverter);
12151
12152                    function _interopRequireDefault(obj) {
12153                        return obj && obj.__esModule ? obj : { default: obj };
12154                    }
12155
12156                    function _classCallCheck(instance, Constructor) {
12157                        if (!(instance instanceof Constructor)) {
12158                            throw new TypeError("Cannot call a class as a function");
12159                        }
12160                    }
12161
12162                    function _possibleConstructorReturn(self, call) {
12163                        if (!self) {
12164                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12165                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
12166                    }
12167
12168                    function _inherits(subClass, superClass) {
12169                        if (typeof superClass !== "function" && superClass !== null) {
12170                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
12171                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
12172                    }
12173
12174                    var ThreeMouseEventConverter = function (_MouseEventConverter) {
12175                        _inherits(ThreeMouseEventConverter, _MouseEventConverter);
12176
12177                        function ThreeMouseEventConverter(wnd, doc, visualWorld, test) {
12178                            _classCallCheck(this, ThreeMouseEventConverter);
12179
12180                            var _this = _possibleConstructorReturn(this, _MouseEventConverter.call(this, wnd, doc, visualWorld.element));
12181
12182                            _Utils2.default.extends(_this, new _ThreeEventConverter2.default(visualWorld, test));
12183                            return _this;
12184                        }
12185
12186                        ThreeMouseEventConverter.prototype.getCallback = function getCallback(object) {
12187                            return object.object.userData.mouseCallback;
12188                        };
12189
12190                        ThreeMouseEventConverter.prototype.setCoordsFromEvent = function setCoordsFromEvent(e) {
12191                            var jElement = (0, _libs.$)(this.element);
12192                            var offset = jElement.offset();
12193                            this.coords.x = (e.pageX - offset.left) / jElement.width() * 2 - 1;
12194                            this.coords.y = -((e.pageY - offset.top) / jElement.height()) * 2 + 1;
12195                            return this.coords;
12196                        };
12197
12198                        return ThreeMouseEventConverter;
12199                    }(_MouseEventConverter3.default);
12200
12201                    exports.default = ThreeMouseEventConverter;
12202
12203                    /***/
12204                },
12205/* 62 */
12206/***/function (module, exports, __webpack_require__) {
12207
12208                    "use strict";
12209                    'use strict';
12210
12211                    exports.__esModule = true;
12212
12213                    var _libs = __webpack_require__(0);
12214
12215                    var _Utils = __webpack_require__(4);
12216
12217                    var _Utils2 = _interopRequireDefault(_Utils);
12218
12219                    var _TouchEventConverter2 = __webpack_require__(64);
12220
12221                    var _TouchEventConverter3 = _interopRequireDefault(_TouchEventConverter2);
12222
12223                    var _ThreeEventConverter = __webpack_require__(19);
12224
12225                    var _ThreeEventConverter2 = _interopRequireDefault(_ThreeEventConverter);
12226
12227                    function _interopRequireDefault(obj) {
12228                        return obj && obj.__esModule ? obj : { default: obj };
12229                    }
12230
12231                    function _classCallCheck(instance, Constructor) {
12232                        if (!(instance instanceof Constructor)) {
12233                            throw new TypeError("Cannot call a class as a function");
12234                        }
12235                    }
12236
12237                    function _possibleConstructorReturn(self, call) {
12238                        if (!self) {
12239                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12240                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
12241                    }
12242
12243                    function _inherits(subClass, superClass) {
12244                        if (typeof superClass !== "function" && superClass !== null) {
12245                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
12246                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
12246onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
12247                    }
12248
12249                    var ThreeTouchEventConverter = function (_TouchEventConverter) {
12250                        _inherits(ThreeTouchEventConverter, _TouchEventConverter);
12251
12252                        function ThreeTouchEventConverter(wnd, doc, visualWorld, test) {
12253                            _classCallCheck(this, ThreeTouchEventConverter);
12254
12255                            var _this = _possibleConstructorReturn(this, _TouchEventConverter.call(this, wnd, doc, visualWorld.element));
12256
12257                            _Utils2.default.extends(_this, new _ThreeEventConverter2.default(visualWorld, test));
12258                            return _this;
12259                        }
12260
12261                        ThreeTouchEventConverter.prototype.getCallback = function getCallback(object) {
12262                            return object.object.userData.touchCallback;
12263                        };
12264
12265                        ThreeTouchEventConverter.prototype.setCoordsFromEvent = function setCoordsFromEvent(e) {
12266                            var jElement = (0, _libs.$)(this.element),
12267                                offset = jElement.offset(),
12268                                touches = e.touches || e.originalEvent.touches,
12269                                touch = touches.length ? touches[0] : (this.lastTouches || [{ pageX: 0, pageY: 0 }])[0],
12270                                pageX = touch.pageX,
12271                                pageY = touch.pageY;
12272                            this.lastTouches = touches.length ? touches : this.lastTouches;
12273                            this.coords.x = (pageX - offset.left) / jElement.width() * 2 - 1;
12274                            this.coords.y = -((pageY - offset.top) / jElement.height()) * 2 + 1;
12275                            return this.coords;
12276                        };
12277
12278                        return ThreeTouchEventConverter;
12279                    }(_TouchEventConverter3.default);
12280
12281                    exports.default = ThreeTouchEventConverter;
12282
12283                    /***/
12284                },
12285/* 63 */
12286/***/function (module, exports, __webpack_require__) {
12287
12288                    "use strict";
12289                    'use strict';
12290
12291                    exports.__esModule = true;
12292
12293                    var _extends = Object.assign || function (target) {
12294                        for (var i = 1; i < arguments.length; i++) {
12295                            var source = arguments[i]; for (var key in source) {
12296                                if (Object.prototype.hasOwnProperty.call(source, key)) {
12297                                    target[key] = source[key];
12298                                }
12299                            }
12300                        } return target;
12301                    };
12302
12303                    var _libs = __webpack_require__(0);
12304
12305                    var _ImageFactory = __webpack_require__(8);
12306
12307                    var _ImageFactory2 = _interopRequireDefault(_ImageFactory);
12308
12309                    function _interopRequireDefault(obj) {
12310                        return obj && obj.__esModule ? obj : { default: obj };
12311                    }
12312
12313                    function _classCallCheck(instance, Constructor) {
12314                        if (!(instance instanceof Constructor)) {
12315                            throw new TypeError("Cannot call a class as a function");
12316                        }
12317                    }
12318
12319                    var Thumbnails = function () {
12320                        function Thumbnails(context, container, thumbnailsClb, size) {
12321                            var _this = this;
12322
12323                            var props = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { kWtoH: 210 / 297 };
12324
12325                            _classCallCheck(this, Thumbnails);
12326
12327                            this.container = container;
12328                            this.p = props;
12329                            this.thumbnailsClb = thumbnailsClb;
12330                            this.size = size;
12331                            this.canvas = (0, _libs.$)('<canvas>')[0];
12332                            this.imageFactory = new _ImageFactory2.default(_extends({}, context, {
12333                                renderCanvas: this.canvas,
12334                                renderCanvasCtx: this.canvas.getContext('2d')
12335                            }));
12336                            this.thumbnails = [];
12337                            for (var i = 0; i < size; ++i) {
12338                                var info = this.thumbnailsClb(i);
12339                                this.thumbnails.push(_extends({}, info, {
12340                                    index: i,
12341                                    loaded: info.type === 'thumbnail-image',
12342                                    heading: null,
12343                                    thumbnail: null,
12344                                    title: info.title || i
12345                                }));
12346                            }
12347
12348                            this.binds = {
12349                                update: this.update.bind(this),
12350                                navigate: function navigate(e) {
12351                                    e.preventDefault();
12352                                    if (_this.onNavigate) {
12353                                        var node = e.target;
12354                                        while (node && !node.dataThumbnail) {
12355                                            node = node.parentNode;
12356                                        }
12357                                        _this.onNavigate(node.dataThumbnail.index);
12358                                    }
12359                                }
12360                            };
12361                            this.container.on('scroll', this.binds.update);
12362                        }
12363
12364                        Thumbnails.prototype.getSize = function getSize() {
12365                            return this.size;
12366                        };
12367
12368                        Thumbnails.prototype.setEnable = function setEnable(enable) {
12369                            this.enable = enable;
12370                            this.update();
12371                        };
12372
12373                        Thumbnails.prototype.dispose = function dispose() {
12374                            this.container.find('a').off('click', this.binds.navigate);
12375                            this.container.off('scroll', this.binds.update);
12376                            this.container.html('');
12377                            this.canvas.height = this.canvas.width = 0;
12378                            delete this.canvas;
12379                        };
12380
12381                        Thumbnails.prototype.load = function load(thumbnail) {
12382                            var _this2 = this;
12383
12384                            this.loading = true;
12385                            var wrapper = this.imageFactory.build(thumbn
12385ail, thumbnail.number === undefined ? thumbnail.index : thumbnail.number, this.p.kWtoH * 300, 300);
12386                            wrapper.onChange = function (canvas) {
12387                                _this2.setImage(thumbnail, canvas.toDataURL('image/png'));
12388                                thumbnail.loaded = true;
12389                                wrapper.dispose();
12390                                _this2.loading = false;
12391                                Promise.resolve().then(function () {
12392                                    return _this2.update();
12393                                });
12394                            };
12395                        };
12396
12397                        Thumbnails.prototype.getActive = function getActive() {
12398                            var first = this.container.scrollTop(),
12399                                last = first + this.container.height(),
12400                                res = [];
12401                            for (var _iterator = this.thumbnails, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
12402                                var _ref;
12403
12404                                if (_isArray) {
12405                                    if (_i >= _iterator.length) break;
12406                                    _ref = _iterator[_i++];
12407                                } else {
12408                                    _i = _iterator.next();
12409                                    if (_i.done) break;
12410                                    _ref = _i.value;
12411                                }
12412
12413                                var thumbnail = _ref;
12414
12415                                if (Math.max(thumbnail.first, first) < Math.min(thumbnail.last, last)) {
12416                                    res.push(thumbnail);
12417                                }
12418                            }
12419                            return res;
12420                        };
12421
12422                        Thumbnails.prototype.update = function update() {
12423                            if (!this.loading && this.canvas && this.enable) {
12424                                if (!this.built) {
12425                                    this.render();
12426                                }
12427                                var active = this.getActive();
12428                                for (var _iterator2 = active, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
12429                                    var _ref2;
12430
12431                                    if (_isArray2) {
12432                                        if (_i2 >= _iterator2.length) break;
12433                                        _ref2 = _iterator2[_i2++];
12434                                    } else {
12435                                        _i2 = _iterator2.next();
12436                                        if (_i2.done) break;
12437                                        _ref2 = _i2.value;
12438                                    }
12439
12440                                    var thumbnail = _ref2;
12441
12442                                    if (!thumbnail.loaded) {
12443                                        this.load(thumbnail);
12444                                        break;
12445                                    }
12446                                }
12447                            }
12448                        };
12449
12450                        Thumbnails.prototype.setImage = function setImage(thumbnail, img) {
12451                            thumbnail.img = img;
12452                            thumbnail.thumbnail.css('background-image', ['url(\'', img, '\')'].join(''));
12453                            thumbnail.thumbnail.removeClass('loading');
12454                        };
12455
12456                        Thumbnails.prototype.render = function render() {
12457                            var elements = ['<div class="thumbnails">'];
12458                            for (var i = 0; i < this.size; ++i) {
12459                                elements.push(['<div class="item"><a href="#"><div class="thumbnail loading"></div></a><div class="heading"><a href="#" title="', i + 1, '">', i + 1, '</a></div></div>'].join(''));
12460                            }
12461                            elements.push('</div>');
12462                            this.container.append(elements.join(''));
12463                            var items = this.container.find('.item'),
12464                                base = this.container.find('.thumbnails').offset().top;
12465                            for (var _i3 = 0; _i3 < items.length; ++_i3) {
12466                                var item = (0, _libs.$)(items[_i3]);
12467                                this.thumbnails[_i3].heading = item.find('.heading');
12468                                this.thumbnails[_i3].thumbnail = item.find('.thumbnail');
12469                                this.thumbnails[_i3].first = item.offset().top - base;
12470                                this.thumbnails[_i3].last = this.thumbnails[_i3].first + item.height();
12471                                if (this.thumbnails[_i3].loaded) {
12472                                    this.setImage(this.thumbnails[_i3], this.thumbnails[_i3].src);
12473                                }
12474                                var as = item.find('a');
12475                                for (var j = 0; j < as.length; ++j) {
12476                                    var a = as[j];
12477                                    a.dataThumbnail = this.thumbnails[_i3];
12478                                }
12479                            }
12480                            this.container.find('a').on('click', this.binds.navigate);
12481                            this.built = true;
12482                        };
12483
12484                        return Thumbnails;
12485                    }();
12486
12487                    exports.default = Thumbnails;
12488
12489                    /***/
12490                },
12491/* 64 */
12492/***/function (module, exports, __webpack_require__) {
12493
12494                    "use strict";
12495                    'use strict';
12496
12497                    exports.__esModule = true;
12498
12499                    var _libs = __webpack_require__(0);
12500
12501                    var _EventConverter2 = __webpack_require__(6);
12502
12503                    var _EventConverter3 = _interopRequireDefault(_EventC
12503onverter2);
12504
12505                    function _interopRequireDefault(obj) {
12506                        return obj && obj.__esModule ? obj : { default: obj };
12507                    }
12508
12509                    function _classCallCheck(instance, Constructor) {
12510                        if (!(instance instanceof Constructor)) {
12511                            throw new TypeError("Cannot call a class as a function");
12512                        }
12513                    }
12514
12515                    function _possibleConstructorReturn(self, call) {
12516                        if (!self) {
12517                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12518                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
12519                    }
12520
12521                    function _inherits(subClass, superClass) {
12522                        if (typeof superClass !== "function" && superClass !== null) {
12523                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
12524                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
12525                    }
12526
12527                    var TouchConverter = function (_EventConverter) {
12528                        _inherits(TouchConverter, _EventConverter);
12529
12530                        function TouchConverter(wnd, doc, element) {
12531                            _classCallCheck(this, TouchConverter);
12532
12533                            var _this = _possibleConstructorReturn(this, _EventConverter.call(this, wnd, doc));
12534
12535                            _this.element = element;
12536                            _this.binds = {
12537                                convert: _this.convert.bind(_this)
12538                            };
12539                            (0, _libs.$)(_this.element).on('touchstart touchmove', _this.binds.convert);
12540                            (0, _libs.$)(_this.doc).on('touchend', _this.binds.convert);
12541                            return _this;
12542                        }
12543
12544                        TouchConverter.prototype.dispose = function dispose() {
12545                            (0, _libs.$)(this.element).off('touchstart touchmove', this.binds.convert);
12546                            (0, _libs.$)(this.doc).off('touchend', this.binds.convert);
12547                        };
12548
12549                        return TouchConverter;
12550                    }(_EventConverter3.default);
12551
12552                    exports.default = TouchConverter;
12553
12554                    /***/
12555                },
12556/* 65 */
12557/***/function (module, exports, __webpack_require__) {
12558
12559                    "use strict";
12560                    'use strict';
12561
12562                    exports.__esModule = true;
12563
12564                    var _extends = Object.assign || function (target) {
12565                        for (var i = 1; i < arguments.length; i++) {
12566                            var source = arguments[i]; for (var key in source) {
12567                                if (Object.prototype.hasOwnProperty.call(source, key)) {
12568                                    target[key] = source[key];
12569                                }
12570                            }
12571                        } return target;
12572                    };
12573
12574                    var _libs = __webpack_require__(0);
12575
12576                    function _classCallCheck(instance, Constructor) {
12577                        if (!(instance instanceof Constructor)) {
12578                            throw new TypeError("Cannot call a class as a function");
12579                        }
12580                    }
12581
12582                    var View = function () {
12583                        View.classProperty = function classProperty(ctrl, className, value) {
12584                            if (value) {
12585                                ctrl.addClass(className);
12586                            } else {
12587                                ctrl.removeClass(className);
12588                            }
12589                        };
12590
12591                        View.attributeProperty = function attributeProperty(ctrl, attributeName, value) {
12592                            if (value) {
12593                                ctrl.attr(attributeName, value);
12594                            } else {
12595                                ctrl.removeAttr(attributeName);
12596                            }
12597                        };
12598
12599                        View.callHandlers = function callHandlers(handlers, id, e, data) {
12600                            for (var _iterator = handlers, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
12601                                var _ref;
12602
12603                                if (_isArray) {
12604                                    if (_i >= _iterator.length) break;
12605                                    _ref = _iterator[_i++];
12606                                } else {
12607                                    _i = _iterator.next();
12608                                    if (_i.done) break;
12609                                    _ref = _i.value;
12610                                }
12611
12612                                var handler = _ref;
12613
12614                                if (handler[id]) {
12615                                    handler[id](e, data);
12616                                } else if (handler.handleDefault) {
12617                                    handler.handleDefault(id, e, data);
12618                                }
12619                            }
12620                        };
12621
12622                        View.handleEvent = function handleEvent(id, getHandlers, e, data) {
12623                            View.callHandlers(getHandlers(id), id, e, data);
12624                        };
12625
12626                        View.handleLinkEvent = function handleLinkEvent(e) {
12627                            e.preventDefault();
12628                            if (!this.ctrl.hasClass('disabled')) {
12629                                View.handleEvent(this.id, this.getHandlers, e);
12630                            }
12631                        };
12632
12633                        View.handleInputEvent = function handleInputEvent(e) {
12634                            View.handleEvent(this.id, this.getHandlers, e, e.target.value);
12635                        };
12636
12637                        View.handleFormEvent = function handleFormEvent(e) {
12638                            e.preventDefault();
12639                            View.handleEvent(this.id, this.getHandlers, e);
12640                        };
12641
12642                        // virtual functions {
12643
12644
12645                        View.prototype.getLinks = function getLinks() {
12646                            return null;
12647                        };
12648
12649                        View.prototype.getWidgets = function getWidgets() {
12650                            return null;
12651                        };
12652
12653                        View.prototype.getInputs = function getInputs() {
12654                            return null;
12655                        };
12656
12657                        View.prototype.getTexts = function getTexts() {
12658                            return null;
12659                        };
12660
12661                        View.prototype.getTemplate = function getTemplate() {
12662                            return {};
12663                        };
12664
12665                        View.prototype.getHandlers = function getHandlers(id) {
12666                            return this.handlers;
12667                        };
12668                        // }
12669
12670                        View.prototype.callLater = function callLater(handlers, id, e, data, ms) {
12671                            var _this = this;
12672
12673                            this.pendings[id] = {
12674                                timestamp: new Date().getTime()
12675                            };
12676                            setTimeout(function () {
12677                                var timestamp = new Date().getTime(),
12678                                    pending = _this.pendings[id];
12679                                if (pending && timestamp - pending.timestamp >= ms) {
12680                                    View.callHandlers(handlers, id, e, data);
12681                                    delete _this.pendings[id];
12682                                }
12683                            }, ms);
12684                        };
12685
12686                        // loadFiles(urls, ready, failure) {
12687                        //   let done = Promise.resolve();
12688                        //   for(let url of urls) {
12689                        //     done = done.then(()=> {
12690                        //       return new Promise((resolve, reject)=> {
12691                        //         $.get(url, (res)=> {
12692                        //           ready(res, url);
12693                        //           resolve();
12694                        //         }).fail((res)=> {
12695                        //           if(failure && failure(res, url)) {
12696                        //             resolve();
12697                        //           }
12698                        //           else {
12699                        //             reject(res);
12700                        //           }
12701                        //         });
12702                        //       });
12703                        //     });
12704                        //   }
12705                        //   return done;
12706                        // }
12707
12708                        View.prototype.loadFiles = function loadFiles(urls, files) {
12709                            var tasks = [];
12710
12711                            var _loop = function _loop() {
12712                                if (_isArray2) {
12713                                    if (_i2 >= _iterator2.length) return 'break';
12714                                    _ref2 = _iterator2[_i2++];
12715                                } else {
12716                                    _i2 = _iterator2.next();
12717                                    if (_i2.done) return 'break';
12718                                    _ref2 = _i2.value;
12719                                }
12720
12721                                var name = _ref2;
12722
12723                                files[name] = [];
12724
12725                                var _loop2 = function _loop2() {
12726                                    if (_isArray3) {
12727                                        if (_i3 >= _iterator3.length) return 'break';
12728                                        _ref3 = _iterator3[_i3++];
12729                                    } else {
12730                                        _i3 = _iterator3.next();
12731                                        if (_i3.done) return 'break';
12732                                        _ref3 = _i3.value;
12733                                    }
12734
12735                                    var url = _ref3;
12736
12737                                    tasks.push(new Promise(function (resolve, reject) {
12738                                        _libs.$.get(url, function (data) {
12739                                            files[name].push({ url: url, data: data });
12740                                            resolve();
12741                                        }).fail(function (res) {
12742                                            reject(res);
12743                                        });
12744                                    }));
12745                                };
12746
12747                                for (var _iterator3 = urls[name], _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ;) {
12748                                    var _ref3;
12749
12750                                    var _ret2 = _loop2();
12751
12752                                    if (_ret2 === 'break') break;
12753                                }
12754                            };
12755
12756                            for (var _iterator2 = Object.keys(urls), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ;) {
12757                                var _ref2;
12758
12759                                var _ret = _loop();
12760
12761                                if (_ret === 'break') break;
12762                            }
12763                            return Promise.all(tasks);
12764                        };
12765
12766                        View.prototype.urlResolver = function urlResolver(baseUrl, url) {
12767                            url = url.replace(/\\/g, '/');
12768                            if (url.charAt(0) !== '/') {
12769                                baseUrl = baseUrl.replace(/\\/g, '/');
12770                                var p = baseUrl.lastIndexOf('/');
12771                                url = (~p ? baseUrl.substr(0, p + 1) : '') + url;
12772
12773                                var parts = url.split('/');
12774                                url = [];
12775                                for (var _iterator4 = parts, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ;) {
12776                                    var _ref4;
12777
12778                                    if (_isArray4) {
12779                                        if (_i4 >= _iterator4.length) break;
12780                                        _ref4 = _iterator4[_i4++];
12781                                    } else {
12782                                        _i4 = _iterator4.next();
12783                                        if (_i4.done) break;
12784                                        _ref4 = _i4.value;
12785                                    }
12786
12787                                    var part = _ref4;
12788
12789                                    if (part === '.') { } else if (part === '..') {
12790                                        if (url.length && !(url.length === 1 && url[0] === '')) {
12791                                            url.pop();
12792                                        }
12793                                    } else {
12794                                        url.push(part);
12795                                    }
12796                                }
12797                                url = url.join('/');
12798                            }
12799
12800                            return url;
12801                        };
12802
12803                        View.prototype.objToAttrsStr = function objToAttrsStr(o) {
12804                            var res = [];
12805                            for (var _iterator5 = Object.keys(o), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator](); ;) {
12806                                var _ref5;
12807
12808                                if (_isArray5) {
12809                                    if (_i5 >= _iterator5.length) break;
12810                                    _ref5 = _iterator5[_i5++];
12811                                } else {
12812                                    _i5 = _iterator5.next();
12813                                    if (_i5.done) break;
12814                                    _ref5 = _i5.value;
12815                                }
12816
12817                                var _name = _ref5;
12818
12819                                res.push([_name, '="', o[_name], '"'].join(''));
12820                            }
12821                            return res.join(' ');
12822                        };
12823
12824                        View.prototype.checkIframeSize = function checkIframeSize() {
12825                            if (this.frame) {
12826                                if (Math.abs(this.frame.width - this.parentContainer.width()) > 1 || Math.abs(this.frame.height - this.parentContainer.height()) > 1) {
12827                                    this.onResize();
12828                                }
12829                                setTimeout(this.checkIframeSize.bind(this), 250);
12830                            }
12831                        };
12832
12833                        View.prototype.onResize = function onResize() {
12834                            this.frame.width = this.parentContainer.width();
12835                            this.frame.height = this.parentContainer.height();
12836                        };
12837
12838                        View.prototype.translate = function translate(html) {
12839                            return html.replace(/<\$tr>(.*)<\/\$tr>/gi, function (s0, s1) {
12840                                return (0, _libs.tr)(s1);
12841                            });
12842                        };
12843
12844                        View.prototype.fireLinksOnLoadEvent = function fireLinksOnLoadEvent() {
12845                            var _this2 = this;
12846
12847                            if (this.templateObject && this.templateObject.linkLoaded) {
12848                                var loaded = true;
12849
12850                                var _loop3 = function _loop3() {
12851                                    if (_isArray6) {
12852                                        if (_i6 >= _iterator6.length) return 'break';
12853                                        _ref6 = _iterator6[_i6++];
12854                                    } else {
12855                                        _i6 = _iterator6.next();
12856                                        if (_i6.done) return 'break';
12857                                        _ref6 = _i6.value;
12858                                    }
12859
12860                                    var jLink = _ref6;
12861
12862                                    var link = jLink[0];
12863                                    var img = new Image();
12864                                    img.onerror = function () {
12865                                        return _this2.templateObject.linkLoaded(link);
12866                                    };
12867                                    img.src = link.href;
12868                                };
12869
12870                                for (var _iterator6 = this.jLinks, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator](); ;) {
12871                                    var _ref6;
12872
12873                                    var _ret3 = _loop3();
12874
12875                                    if (_ret3 === 'break') break;
12876                                }
12877                            }
12878                        };
12879
12880                        function View(parentContainer, onLoad) {
12881                            var _this3 = this;
12882
12883                            var template = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12884
12885                            _classCallCheck(this, View);
12886
12887                            this.pendings = {};
12888                            this.binds = {
12889                                onResize: this.onResize.bind(this)
12890                            };
12891                            this.parentContainer = (0, _libs.$)(parentContainer);
12892                            this.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
12893                            this.parentContainer.html('<iframe style="border: 0;' + (this.isIOS ? '' : ' width: 100%; height: 100%') + '" scrolling="no"></iframe>');
12894
12895                            this.frame = this.parentContainer.find('iframe')[0];
12896                            if (this.frame.contentWindow.stop) {
12897                                this.frame.contentWindow.stop();
12898                            }
12899                            if (this.isIOS) {
12900                                (0, _libs.$)(this.parentContainer[0].ownerDocument.defaultView).on('resize', this.binds.onResize);
12901                                this.onResize();
12902                                setTimeout(this.checkIframeSize.bind(this), 250);
12903                            }
12904
12905                            this.container = (0, _libs.$)(this.frame.contentDocument.body);
12906                            this.container.css('margin', '0');
12907                            this.head = (0, _libs.$)(this.frame.contentDocument.head);
12908                            this.onLoad = onLoad;
12909                            this.handlers = [];
12910
12911                            var script = template.html ? template.script : this.getTemplate().script;
12912                            var urls = {
12913                                styles: template.styles || this.getTemplate().styles,
12914                                html: [template.html || this.getTemplate().html],
12915                                script: script ? [script] : []
12916                            },
12917                                files = {},
12918                                links = template.links || this.getTemplate().links;
12919
12920                            this.loadFiles(urls, files).then(function () {
12921                                var _loop4 = function _loop4() {
12922                                    if (_isArray7) {
12923                                        if (_i7 >= _iterator7.length) return 'break';
12924                                        _ref7 = _iterator7[_i7++];
12925                                    } else {
12926                                        _i7 = _iterator7.next();
12927                                        if (_i7.done) return 'break';
12928                                        _ref7 = _i7.value;
12929                                    }
12930
12931                                    var style = _ref7;
12932
12933                                    var textCss = style.data,
12934                                        url = style.url;
12935                                    textCss = textCss.replace(/url\(['"](.*?)["']\)/g, function (r, r1) {
12936                                        return ['url(', _this3.urlResolver(url, r1), ')'].join('');
12937                                    });
12938                                    (0, _libs.$)('<style type="text/css">' + textCss + '</style>').appendTo(_this3.head);
12939                                };
12940
12941                                for (var _iterator7 = files.styles, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator](); ;) {
12942                                    var _ref7;
12943
12944                                    var _ret4 = _loop4();
12945
12946                                    if (_ret4 === 'break') break;
12947                                }
12948
12949                                _this3.container.html(_this3.translate(files.html[0].data));
12950
12951                                _this3.jLinks = [];
12952                                for (var _iterator8 = links, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator](); ;) {
12953                                    var _ref8;
12954
12955                                    if (_isArray8) {
12956                                        if (_i8 >= _iterator8.length) break;
12957                                        _ref8 = _iterator8[_i8++];
12958                                    } else {
12959                                        _i8 = _iterator8.next();
12960                                        if (_i8.done) break;
12961                                        _ref8 = _i8.value;
12962                                    }
12963
12964                                    var _link = _ref8;
12965
12966                                    _this3.jLinks.push((0, _libs.$)(['<link ', _this3.objToAttrsStr(_link), '>'].join('')).appendTo(_this3.head));
12967                                }
12968
12969                                if (files.script[0]) {
12970                                    var init = eval(files.script[0].data);
12971                                    _this3.templateObject = init(_this3.container);
12972                                } else {
12973                                    _this3.templateObject = {};
12974                                }
12975
12976                                _this3.linkControls = {};
12977                                for (var _iterator9 = _this3.getLinks(), _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator](); ;) {
12978                                    var _ref9;
12979
12980                                    if (_isArray9) {
12981                                        if (_i9 >= _iterator9.length) break;
12982                                        _ref9 = _iterator9[_i9++];
12983                                    } else {
12984                                        _i9 = _iterator9.next();
12985                                        if (_i9.done) break;
12986                                        _ref9 = _i9.value;
12987                                    }
12988
12989                                    var id = _ref9;
12990
12991                                    _this3.linkControls[id] = _this3.container.find('.' + id);
12992                                    _this3.binds[id] = View.handleLinkEvent.bind({ getHandlers: _this3.getHandlers.bind(_this3), id: id, ctrl: _this3.linkControls[id] });
12993                                    _this3.linkControls[id].on('click', _this3.binds[id]);
12994                                }
12995
12996                                _this3.widgetControls = {};
12997                                for (var _iterator10 = _this3.getWidgets(), _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator](); ;) {
12998                                    var _ref10;
12999
13000                                    if (_isArray10) {
13001                                        if (_i10 >= _iterator10.length) break;
13002                                        _ref10 = _iterator10[_i10++];
13003                                    } else {
13004                                        _i10 = _iterator10.next();
13005                                        if (_i10.done) break;
13006                                        _ref10 = _i10.value;
13007                                    }
13008
13009                                    var _id = _ref10;
13010
13011                                    _this3.widgetControls[_id] = _this3.container.find('.' + _id);
13012                                }
13013
13014                                _this3.inputControls = {};
13015                                for (var _iterator11 = _this3.getInputs(), _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator](); ;) {
13016                                    var _ref11;
13017
13018                                    if (_isArray11) {
13019                                        if (_i11 >= _iterator11.length) break;
13020                                        _ref11 = _iterator11[_i11++];
13021                                    } else {
13022                                        _i11 = _iterator11.next();
13023                                        if (_i11.done) break;
13024                                        _ref11 = _i11.value;
13025                                    }
13026
13027                                    var _id2 = _ref11;
13028
13029                                    _this3.inputControls[_id2] = _this3.container.find('.' + _id2);
13030                                    _this3.binds[_id2] = View.handleInputEvent.bind({ getHandlers: _this3.getHandlers.bind(_this3), id: _id2, ctrl: _this3.inputControls[_id2] });
13031                                    _this3.inputControls[_id2].on('keyup', _this3.binds[_id2]);
13032                                }
13033
13034                                _this3.formControls = {};
13035                                for (var _iterator12 = _this3.getForms(), _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator](); ;) {
13036                                    var _ref12;
13037
13038                                    if (_isArray12) {
13039                                        if (_i12 >= _iterator12.length) break;
13040                                        _ref12 = _iterator12[_i12++];
13041                                    } else {
13042                                        _i12 = _iterator12.next();
13043                                        if (_i12.done) break;
13044                                        _ref12 = _i12.value;
13045                                    }
13046
13047                                    var _id3 = _ref12;
13048
13049                                    _this3.formControls[_id3] = _this3.container.find('.' + _id3);
13050                                    _this3.binds[_id3] = View.handleFormEvent.bind({ getHandlers: _this3.getHandlers.bind(_this3), id: _id3, ctrl: _this3.formControls[_id3] });
13051                                    _this3.formControls[_id3].on('submit', _this3.binds[_id3]);
13052                                }
13053
13054                                _this3.textControls = {};
13055                                for (var _iterator13 = _this3.getTexts(), _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator](); ;) {
13056                                    var _ref13;
13057
13058                                    if (_isArray13) {
13059                                        if (_i13 >= _iterator13.length) break;
13060                                        _ref13 = _iterator13[_i13++];
13061                                    } else {
13062                                        _i13 = _iterator13.next();
13063                                        if (_i13.done) break;
13064                                        _ref13 = _i13.value;
13065                                    }
13066
13067                                    var _id4 = _ref13;
13068
13069                                    _this3.textControls[_id4] = _this3.container.find('.' + _id4);
13070                                }
13071
13072                                _this3.stateSetters = [{
13073                                    map: _this3.linkControls,
13074                                    setter: _this3.setLinkControlState.bind(_this3)
13075                                }, {
13076                                    map: _this3.widgetControls,
13077                                    setter: _this3.setWidgetControlState.bind(_this3)
13078                                }, {
13079                                    map: _this3.inputControls,
13080                                    setter: _this3.setInputControlState.bind(_this3)
13081                                }, {
13082                                    map: _this3.textControls,
13083                                    setter: _this3.setTextControlState.bind(_this3)
13084                                }];
13085
13086                                _this3.initView();
13087
13088                                if (_this3.onLoad) {
13089                                    _this3.onLoad();
13090                                }
13091
13092                                _this3.fireLinksOnLoadEvent();
13093                            }).catch(function (res) {
13094                                return console.error(res);
13095                            });
13096                        }
13097
13098                        View.prototype.dispose = function dispose() {
13099                            delete this.textControls;
13100                            for (var _iterator14 = this.getLinks(), _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator](); ;) {
13101                                var _ref14;
13102
13103                                if (_isArray14) {
13104                                    if (_i14 >= _iterator14.length) break;
13105                                    _ref14 = _iterator14[_i14++];
13106                                } else {
13107                                    _i14 = _iterator14.next();
13108                                    if (_i14.done) break;
13109                                    _ref14 = _i14.value;
13110                                }
13111
13112                                var id = _ref14;
13113
13114                                this.linkControls[id].off('click', this.binds[id]);
13115                            }
13116                            delete this.linkControls;
13117                            delete this.widgetControls;
13118                            for (var _iterator15 = this.getInputs(), _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator](); ;) {
13119                                var _ref15;
13120
13121                                if (_isArray15) {
13122                                    if (_i15 >= _iterator15.length) break;
13123                                    _ref15 = _iterator15[_i15++];
13124                                } else {
13125                                    _i15 = _iterator15.next();
13126                                    if (_i15.done) break;
13127                                    _ref15 = _i15.value;
13128                                }
13129
13130                                var _id5 = _ref15;
13131
13132                                this.inputControls[_id5].off('keyup', this.binds[_id5]);
13133                            }
13134                            delete this.inputControls;
13135                            for (var _iterator16 = this.getForms(), _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : _iterator16[Symbol.iterator](); ;) {
13136                                var _ref16;
13137
13138                                if (_isArray16) {
13139                                    if (_i16 >= _iterator16.length) break;
13140                                    _ref16 = _iterator16[_i16++];
13141                                } else {
13142                                    _i16 = _iterator16.next();
13143                                    if (_i16.done) break;
13144                                    _ref16 = _i16.value;
13145                                }
13146
13147                                var _id6 = _ref16;
13148
13149                                this.formControls[_id6].off('submit', this.binds[_id6]);
13150                            }
13151                            delete this.formControls;
13152
13153                            !this.templateObject.dispose || this.templateObject.dispose();
13154                            delete this.templateObject;
13155
13156                            if (this.isIOS) {
13157                                (0, _libs.$)(this.parentContainer[0].ownerDocument.defaultView).off('resize', this.binds.onResize);
13158                            }
13159                            this.parentContainer.html('');
13160                            delete this.frame;
13161                        };
13162
13163                        View.prototype.getContainer = function getContainer() {
13164                            return this.container[0];
13165                        };
13166
13167                        View.prototype.getParentContainer = function getParentContainer() {
13168                            return this.parentContainer[0];
13169                        };
13170
13171                        View.prototype.addHandler = function addHandler(handler) {
13172                            this.handlers.push(handler);
13173                        };
13174
13175                        View.prototype.initView = function initView() { };
13176
13177                        View.setControlState = function setControlState(ctrl, defaults, state, stateHandlers) {
13178                            if (ctrl) {
13179                                var st = _extends({}, defaults, state);
13180                                for (var _name2 in st) {
13181                                    if (st.hasOwnProperty(_name2) && stateHandlers[_name2]) {
13182                                        stateHandlers[_name2](ctrl, st[_name2]);
13183                                    }
13184                                }
13185                            }
13186                        };
13187
13188                        View.prototype.setLinkControlState = function setLinkControlState(id, state) {
13189                            View.setControlState(this.linkControls[id], {
13190                                visible: true,
13191                                active: false,
13192                                enable: true
13193                            }, state, View.linkStateHandlers);
13194                        };
13195
13196                        View.prototype.setWidgetControlState = function setWidgetControlState(id, state) {
13197                            View.setControlState(this.widgetControls[id], {
13198                                visible: true,
13199                                active: false,
13200                                enable: true
13201                            }, state, View.widgetStateHandlers);
13202                        };
13203
13204                        View.prototype.setInputControlState = function setInputControlState(id, state) {
13205                            View.setControlState(this.inputControls[id], {
13206                                visible: true,
13207                                enable: true,
13208                                value: ''
13209                            }, state, View.inputStateHandlers);
13210                        };
13211
13212                        View.prototype.setTextControlState = function setTextControlState(id, state) {
13213                            View.setControlState(this.textControls[id], {
13214                                visible: true,
13215                                value: ''
13216                            }, state, View.textStateHandlers);
13217                        };
13218
13219                        View.prototype.onItemStateChanged = function onItemStateChanged() { };
13220
13221                        View.prototype.setState = function setState(id, state) {
13222                            for (var _iterator17 = this.stateSetters, _isArray17 = Array.isArray(_iterator17), _i17 = 0, _iterator17 = _isArray17 ? _iterator17 : _iterator17[Symbol.iterator](); ;) {
13223                                var _ref17;
13224
13225                                if (_isArray17) {
13226                                    if (_i17 >= _iterator17.length) break;
13227                                    _ref17 = _iterator17[_i17++];
13228                                } else {
13229                                    _i17 = _iterator17.next();
13230                                    if (_i17.done) break;
13231                                    _ref17 = _i17.value;
13232                                }
13233
13234                                var item = _ref17;
13235
13236                                if (item.map[id]) {
13237                                    item.setter(id, state);
13238                                    this.onItemStateChanged(id, state);
13239                                    break;
13240                                }
13241                            }
13242                        };
13243
13244                        return View;
13245                    }();
13246
13247                    View.linkStateHandlers = {
13248                        visible: function visible(ctrl, value) {
13249                            return View.classProperty(ctrl, 'hidden', !value);
13250                        },
13251                        active: function active(ctrl, value) {
13252                            return View.classProperty(ctrl, 'active', value);
13253                        },
13254                        enable: function enable(ctrl, value) {
13255                            return View.classProperty(ctrl, 'disabled', !value);
13256                        }
13257                    };
13258                    View.widgetStateHandlers = {
13259                        visible: function visible(ctrl, value) {
13260                            return View.classProperty(ctrl, 'hidden', !value);
13261                        },
13262                        active: function active(ctrl, value) {
13263                            return View.classProperty(ctrl, 'active', value);
13264                        },
13265                        enable: function enable(ctrl, value) {
13266                            return View.classProperty(ctrl, 'disabled', !value);
13267                        }
13268                    };
13269                    View.inputStateHandlers = {
13270                        visible: function visible(ctrl, value) {
13271                            return View.classProperty(ctrl, 'hidden', !value);
13272                        },
13273                        value: function value(ctrl, _value) {
13274                            return ctrl[0].value = _value;
13275                        },
13276                        enable: function enable(ctrl, value) {
13277                            return View.attributeProperty(ctrl, 'disabled', !value);
13278                        }
13279                    };
13280                    View.textStateHandlers = {
13281                        visible: function visible(ctrl, value) {
13282                            return View.classProperty(ctrl, 'hidden', !value);
13283                        },
13284                        value: function value(ctrl, _value2) {
13285                            return ctrl.text(_value2);
13286                        }
13287                    };
13288                    exports.default = View;
13289
13290                    /***/
13291                },
13292/* 66 */
13293/***/function (module, exports, __webpack_require__) {
13294
13295                    "use strict";
13296                    'use strict';
13297
13298                    exports.__esModule = true;
13299
13300                    var _extends = Object.assign || function (target) {
13301                        for (var i = 1; i < arguments.length; i++) {
13302                            var source = arguments[i]; for (var key in source) {
13303                                if (Object.prototype.hasOwnProperty.call(source, key)) {
13304                                    target[key] = source[key];
13305                                }
13306                            }
13307                        } return target;
13308                    };
13309
13310                    var _libs = __webpack_require__(0);
13311
13312                    var _Orbit = __webpack_require__(56);
13313
13314                    var _Orbit2 = _interopRequireDefault(_Orbit);
13315
13316                    var _ThreeMouseEventConverter = __webpack_require__(61);
13317
13318                    var _ThreeMouseEventConverter2 = _interopRequireDefault(_ThreeMouseEventConverter);
13319
13320                    var _ThreeTouchEventConverter = __webpack_require__(62);
13321
13322                    var _ThreeTouchEventConverter2 = _interopRequireDefault(_ThreeTouchEventConverter);
13323
13324                    var _Drag = __webpack_require__(48);
13325
13326                    var _Drag2 = _interopRequireDefault(_Drag);
13327
13328                    var _CSS3DRenderer = __webpack_require__(12);
13329
13330                    var _CSS3DRenderer2 = _interopRequireDefault(_CSS3DRenderer);
13331
13332                    function _interopRequireDefault(obj) {
13333                        return obj && obj.__esModule ? obj : { default: obj };
13334                    }
13335
13336                    function _classCallCheck(instance, Constructor) {
13337                        if (!(instance instanceof Constructor)) {
13338                            throw new TypeError("Cannot call a class as a function");
13339                        }
13340                    }
13341
13342                    function _possibleConstructorReturn(self, call) {
13343                        if (!self) {
13344                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13345                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
13346                    }
13347
13348                    function _inherits(subClass, superClass) {
13349                        if (typeof superClass !== "function" && superClass !== null) {
13350                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
13351                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
13352                    }
13353
13354                    var VisualWorld = function (_THREE$EventDispatche) {
13355                        _inherits(VisualWorld, _THREE$EventDispatche);
13356
13357                        function VisualWorld(wnd, doc, container) {
13358                            var useHelpers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
13359
13360                            _classCallCheck(this, VisualWorld);
13361
13362                            var _this = _possibleConstructorReturn(this, _THREE$EventDispatche.call(this));
13363
13364                            _this.wnd = wnd;
13365                            _this.doc = doc;
13366                            _this.jContainer = container;
13367                            _this.renderCallbacks = [];
13368
13369                            _this.clock = new _libs.THREE.Clock();
13370
13371                            _this.raycaster = new _libs.THREE.Raycaster();
13372
13373                            _this.scene = new _libs.THREE.Scene();
13374                            _this.cssScene = new _libs.THREE.Scene();
13375
13376                            _this.camera = new _libs.THREE.PerspectiveCamera(30, _this.width() / _this.height(), 0.2, 2000);
13377                            var scale = 1;
13378
13379                            _this.camera.position.x = 0;
13380                            _this.camera.position.y = 5.5 * scale;
13381                            _this.camera.position.z = 0;
13382
13383                            _this.renderer = new _libs.THREE.WebGLRenderer({ alpha: true, antialias: true });
13384                            _this.renderer.setClearColor(0x000000, 0);
13385                            _this.renderer.setPixelRatio(_this.wnd.devicePixelRatio);
13386                            _this.renderer.setSize(_this.width(), _this.height());
13387
13388                            _this.jContainer.append(_this.renderer.domElement);
13389
13390                            _this.cssRenderer = new _CSS3DRenderer2.default();
13391                            _this.cssRenderer.setSize(_this.width(), _this.height());
13392                            (0, _libs.$)(_this.cssRenderer.domElement).css({
13393                                position: 'absolute',
13394                                top: 0,
13395                                margin: 0,
13396                                padding: 0
13397                            });
13398                            _this.jContainer.append(_this.cssRenderer.domElement);
13399
13400                            _this.element = _this.cssRenderer.domElement;
13401
13402                            _this.controls = new _Orbit2.default(_this.camera, _this.element);
13403                            _this.controls.target.y = 0.5;
13404
13405                            var cssScene = (0, _libs.$)(_this.cssRenderer.domElement).find('div'),
13406                                tmpVector = new _libs.THREE.Vector3();
13407                            _this.controls.addEventListener('change', function () {
13408                                _this.camera.getWorldDirection(tmpVector);
13409                                cssScene.css('display', tmpVector.y - _this.camera.position.y > 0 ? 'none' : 'block');
13410                            });
13411
13412                            _this.textureLoader = new _libs.THREE.TextureLoader();
13413
13414                            _this.scene.add(new _libs.THREE.AmbientLight(0xD0D0D0)); //0xC0C0C0
13415
13416                            _this.light = new _libs.THREE.DirectionalLight(0x404040, 1);
13417                            _this.light.position.set(0, 6 * scale, 0);
13418                            _this.light.castShadow = false;
13419                            // const d = 20*scale;
13420                            // this.light.shadow.camera.left = -d;
13421                            // this.light.shadow.camera.right = d;
13422                            // this.light.shadow.camera.top = d;
13423                            // this.light.shadow.camera.bottom = -d;
13424                            // this.light.shadow.camera.near = 1*scale;
13425                            // this.light.shadow.camera.far = 25*scale;
13426                            // this.light.shadow.mapSize.x = 1024;
13427                            // this.light.shadow.mapSize.y = 1024;
13428                            _this.scene.add(_this.light);
13429
13430                            if (useHelpers) {
13431                                _this.scene.add(new _libs.THREE.AxisHelper(5));
13432                            }
13433
13434                            _this.binds = {
13435                                onWindowResize: _this.onWindowResize.bind(_this),
13436                                animate: _this.animate.bind(_this)
13437                            };
13438
13439                            (0, _libs.$)(_this.wnd).on('resize', _this.binds.onWindowResize);
13440
13441                            _this.mouseEvents = new _ThreeMouseEventConverter2.default(_this.wnd, _this.doc, _this);
13442                            _this.touchEvents = new _ThreeTouchEventConverter2.default(_this.wnd, _this.doc, _this);
13443                            var filterData = { type: 'mousemove' };
13444                            _this.mouseEvents.filter = function (element, e) {
13445                                var types = ['mouseenter', 'mouseover', 'mouseleave', 'mouseout'],
13446                                    contains = function contains(p, c) {
13447                                        return p === c || _libs.$.contains(p, c);
13448                                    };
13449                                if (e.type === 'mousemove') {
13450                                    filterData.pageX = e.pageX;
13451                                    filterData.pageY = e.pageY;
13452                                }
13453                                return e.relatedTarget && ~types.indexOf(e.type) && contains(element, e.target) && contains(element, e.relatedTarget) ? _extends({}, e, filterData) : e;
13454                            };
13455                            _this.drag = new _Drag2.default(_this.wnd, _this.doc, _this);
13456
13457                            _this.animate();
13458                            return _this;
13459                        }
13460
13461                        VisualWorld.prototype.dispose = function dispose() {
13462                            delete this.binds.animate;
13463                            (0, _libs.$)(this.wnd).off('resize', this.binds.onWindowResize);
13464                            this.mouseEvents.dispose();
13465                            this.touchEvents.dispose();
13466                            this.drag.dispose();
13467                            this.controls.dispose();
13468                        };
13469
13470                        VisualWorld.prototype.width = function width() {
13471                            return this.jContainer.width();
13472                        };
13473
13474                        VisualWorld.prototype.height = function height() {
13475                            return this.jContainer.height();
13476                        };
13477
13478                        VisualWorld.prototype.setExtraLighting = function setExtraLighting(v) {
13479                            this.light.intensity = v;
13480                        };
13481
13482                        VisualWorld.prototype.getOrbit = function getOrbit() {
13483                            return this.controls;
13484                        };
13485
13486                        VisualWorld.prototype.setControlsState = function setControlsState(state) {
13487                            this.controls.enabled = state;
13488                        };
13489
13490                        VisualWorld.prototype.getControlsState = function getControlsState() {
13491                            return this.controls.enabled;
13492                        };
13493
13494                        VisualWorld.prototype.onWindowResize = function onWindowResize() {
13495                            var _this2 = this;
13496
13497                            var updateCamera = function updateCamera(camera) {
13498                                camera.aspect = _this2.width() / _this2.height();
13499                                camera.updateProjectionMatrix();
13500                            },
13501                                updateRenderer = function updateRenderer(renderer) {
13502                                    renderer.setSize(_this2.width(), _this2.height());
13503                                };
13504
13505                            updateCamera(this.camera);
13506                            updateRenderer(this.renderer);
13507                            updateRenderer(this.cssRenderer);
13508
13509                            this.dispatchEvent({ type: 'resize' });
13510                        };
13511
13512                        VisualWorld.prototype.addObject = function addObject(object) {
13513                            this.scene.add(object);
13514                        };
13515
13516                        VisualWorld.prototype.addCssObject = function addCssObject(object) {
13517                            this.cssScene.add(object);
13518                        };
13519
13520                        VisualWorld.prototype.removeCssObject = function removeCssObject(object) {
13521                            this.cssScene.remove(object);
13522                        };
13523
13524                        VisualWorld.prototype.removeObject = function removeObject(object) {
13525                            this.scene.remove(object);
13526                        };
13527
13528                        VisualWorld.prototype.animate = function animate() {
13529                            if (this.binds.animate) {
13530                                requestAnimationFrame(this.binds.animate);
13531                            }
13532                            this.render();
13533                        };
13534
13535                        VisualWorld.prototype.addRenderCallback = function addRenderCallback(clb) {
13536                            this.renderCallbacks.push(clb);
13537                        };
13538
13539                        VisualWorld.prototype.removeRenderCallback = function removeRenderCallback(clb) {
13540                            var i = this.renderCallbacks.indexOf(clb);
13541                            if (~i) {
13542                                this.renderCallbacks.splice(i, 1);
13543                            }
13544                        };
13545
13546                        VisualWorld.prototype.render = function render() {
13547                            var deltaTime = this.clock.getDelta();
13548                            this.controls.update(deltaTime);
13549                            for (var _iterator = this.renderCallbacks, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) {
13550                                var _ref;
13551
13552                                if (_isArray) {
13553                                    if (_i >= _iterator.length) break;
13554                                    _ref = _iterator[_i++];
13555                                } else {
13556                                    _i = _iterator.next();
13557                                    if (_i.done) break;
13558                                    _ref = _i.value;
13559                                }
13560
13561                                var clb = _ref;
13562
13563                                clb(deltaTime);
13564                            }
13565                            this.cssRenderer.render(this.cssScene, this.camera);
13566                            this.renderer.render(this.scene, this.camera);
13567                        };
13568
13569                        VisualWorld.prototype.processGeometry = function processGeometry(bufGeometry, mesh) {
13570                            mesh.geometry = bufGeometry;
13571                            // Obtain a Geometry
13572                            var geometry = new _libs.THREE.Geometry().fromBufferGeometry(bufGeometry);
13573                            // Merge the vertices so the triangle soup is converted to indexed triangles
13574                            geometry.mergeVertices();
13575                            // Convert again to BufferGeometry, indexed
13576                            var indexedBufferGeom = this.createIndexedBufferGeometryFromGeometry(geometry);
13577                            // Create index arrays mapping the indexed vertices to bufGeometry vertices
13578                            return this.mapIndices(bufGeometry, indexedBufferGeom);
13579                        };
13580
13581                        VisualWorld.prototype.createIndexedBufferGeometryFromGeometry = function createIndexedBufferGeometryFromGeometry(geometry) {
13582                            var numVertices = geometry.vertices.length;
13583                            var numFaces = geometry.faces.length;
13584
13585                            var bufferGeom = new _libs.THREE.BufferGeometry();
13586                            var vertices = new Float32Array(numVertices * 3);
13587                            var indices = new (numFaces * 3 > 65535 ? Uint32Array : Uint16Array)(numFaces * 3);
13588
13589                            for (var i = 0; i < numVertices; i++) {
13590                                var p = geometry.vertices[i];
13591                                var i3 = i * 3;
13592                                vertices[i3] = p.x;
13593                                vertices[i3 + 1] = p.y;
13594                                vertices[i3 + 2] = p.z;
13595                            }
13596
13597                            for (var _i2 = 0; _i2 < numFaces; _i2++) {
13598                                var f = geometry.faces[_i2];
13599                                var _i3 = _i2 * 3;
13600                                indices[_i3] = f.a;
13601                                indices[_i3 + 1] = f.b;
13602                                indices[_i3 + 2] = f.c;
13603                            }
13604
13605                            bufferGeom.setIndex(new _libs.THREE.BufferAttribute(indices, 1));
13606                            bufferGeom.addAttribute('position', new _libs.THREE.BufferAttribute(vertices, 3));
13607
13608                            return bufferGeom;
13609                        };
13610
13611                        VisualWorld.prototype.isEqual = function isEqual(x1, y1, z1, x2, y2, z2) {
13612                            var delta = 0.000001;
13613                            return Math.abs(x2 - x1) < delta && Math.abs(y2 - y1) < delta && Math.abs(z2 - z1) < delta;
13614                        };
13615
13616                        VisualWorld.prototype.mapIndices = function mapIndices(bufGeometry, indexedBufferGeom) {
13617                            // Creates mappedVertices, mappedIndices and mappedAssociation in bufGeometry
13618                            var vertices = bufGeometry.attributes.position.array;
13619                            var idxVertices = indexedBufferGeom.attributes.position.array;
13620                            var indices = indexedBufferGeom.index.array;
13621
13622                            var numIdxVertices = idxVertices.length / 3;
13623                            var numVertices = vertices.length / 3;
13624
13625                            bufGeometry.mappedVertices = idxVertices;
13626                            bufGeometry.mappedIndices = indices;
13627                            bufGeometry.mappedAssociation = [];
13628
13629                            for (var i = 0; i < numIdxVertices; i++) {
13630                                var association = [];
13631                                bufGeometry.mappedAssociation.push(association);
13632                                var i3 = i * 3;
13633                                for (var j = 0; j < numVertices; j++) {
13634                                    var j3 = j * 3;
13635                                    if (this.isEqual(idxVertices[i3], idxVertices[i3 + 1], idxVertices[i3 + 2], vertices[j3], vertices[j3 + 1], vertices[j3 + 2])) {
13636                                        association.push(j3);
13637                                    }
13638                                }
13639                            }
13640                            return { vertices: bufGeometry.mappedVertices, indices: bufGeometry.mappedIndices };
13641                        };
13642
13643                        VisualWorld.prototype.oneNodePositionCallback = function oneNodePositionCallback(p, q) {
13644                            this.position.set(p.x, p.y, p.z);
13645                            this.quaternion.set(q.x, q.y, q.z, q.w);
13646                        };
13647
13648                        VisualWorld.prototype.multyNodePositionCallback = function multyNodePositionCallback(node, p, n) {
13649                            var geometry = this.geometry;
13650                            var volumePositions = geometry.attributes.position.array;
13651                            var volumeNormals = geometry.attributes.normal.array;
13652                            var assocVertex = geometry.mappedAssociation[node];
13653
13654                            for (var k = 0; k < assocVertex.length; k++) {
13655                                var indexVertex = assocVertex[k];
13656                                volumePositions[indexVertex] = p.x;
13657                                volumeNormals[indexVertex] = n.x;
13658                                ++indexVertex;
13659                                volumePositions[indexVertex] = p.y;
13660                                volumeNormals[indexVertex] = n.y;
13661                                ++indexVertex;
13662                                volumePositions[indexVertex] = p.z;
13663                                volumeNormals[indexVertex] = n.z;
13664                            }
13665                        };
13666
13667                        VisualWorld.prototype.multyNodePositionPostCallback = function multyNodePositionPostCallback() {
13668                            var geometry = this.geometry;
13669                            geometry.attributes.position.needsUpdate = true;
13670                            geometry.attributes.normal.needsUpdate = true;
13671                        };
13672
13673                        VisualWorld.prototype.pathPositionCallback = function pathPositionCallback(node, p) {
13674                            var positions = this.geometry.attributes.position.array;
13675                            var i = 3 * node;
13676                            positions[i++] = p.x;
13677                            positions[i++] = p.y;
13678                            positions[i] = p.z;
13679                        };
13680
13681                        VisualWorld.prototype.pathPositionPostCallback = function pathPositionPostCallback() {
13682                            var geometry = this.geometry;
13683                            geometry.computeVertexNormals();
13684                            geometry.attributes.position.needsUpdate = true;
13685                            geometry.attributes.normal.needsUpdate = true;
13686                        };
13687
13688                        return VisualWorld;
13689                    }(_libs.THREE.EventDispatcher);
13690
13691                    exports.default = VisualWorld;
13692
13693                    /***/
13694                },
13695/* 67 */
13696/***/function (module, exports, __webpack_require__) {
13697
13698                    "use strict";
13699                    'use strict';
13700
13701                    exports.__esModule = true;
13702
13703                    var _Controller2 = __webpack_require__(15);
13704
13705                    var _Controller3 = _interopRequireDefault(_Controller2);
13706
13707                    function _interopRequireDefault(obj) {
13708                        return obj && obj.__esModule ? obj : { default: obj };
13709                    }
13710
13711                    function _classCallCheck(instance, Constructor) {
13712                        if (!(instance instanceof Constructor)) {
13713                            throw new TypeError("Cannot call a class as a function");
13714                        }
13715                    }
13716
13717                    function _possibleConstructorReturn(self, call) {
13718                        if (!self) {
13719                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13720                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
13721                    }
13722
13723                    function _inherits(subClass, superClass) {
13724                        if (typeof superClass !== "function" && superClass !== null) {
13725                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
13726                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
13727                    }
13728
13729                    var WidgetController = function (_Controller) {
13730                        _inherits(WidgetController, _Controller);
13731
13732                        function WidgetController(view) {
13733                            _classCallCheck(this, WidgetController);
13734
13735                            var _this = _possibleConstructorReturn(this, _Controller.call(this));
13736
13737                            _this.view = view;
13738                            _this.visible = false;
13739                            return _this;
13740                        }
13741
13742                        WidgetController.prototype.togle = function togle() {
13743                            this.visible = !this.visible;
13744                            this.fireChange();
13745                        };
13746
13747                        WidgetController.prototype.hide = function hide() {
13748                            this.visible = false;
13749                            this.fireChange();
13750                        };
13751
13752                        WidgetController.prototype.fireChange = function fireChange() {
13753                            if (this.onChange) {
13754                                this.onChange();
13755                            }
13756                            this.updateView();
13757                        };
13758
13759                        WidgetController.prototype.updateView = function updateView() {
13760                            if (this.view) {
13761                                this.view.setState('widFloatWnd', {
13762                                    enable: true,
13763                                    visible: this.visible,
13764                                    active: false
13765                                });
13766                            }
13767                        };
13768
13769                        return WidgetController;
13770                    }(_Controller3.default);
13771
13772                    exports.default = WidgetController;
13773
13774                    /***/
13775                },
13776/* 68 */
13777/***/function (module, exports, __webpack_require__) {
13778
13779                    "use strict";
13780                    'use strict';
13781
13782                    exports.__esModule = true;
13783
13784                    var _Target2 = __webpack_require__(21);
13785
13786                    var _Target3 = _interopRequireDefault(_Target2);
13787
13788                    function _interopRequireDefault(obj) {
13789                        return obj && obj.__esModule ? obj : { default: obj };
13790                    }
13791
13792                    function _classCallCheck(instance, Constructor) {
13793                        if (!(instance instanceof Constructor)) {
13794                            throw new TypeError("Cannot call a class as a function");
13795                        }
13796                    }
13797
13798                    function _possibleConstructorReturn(self, call) {
13799                        if (!self) {
13800                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13801                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
13802                    }
13803
13804                    function _inherits(subClass, superClass) {
13805                        if (typeof superClass !== "function" && superClass !== null) {
13806                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
13807                        } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
13808                    }
13809
13810                    var CircleTarget = function (_Target) {
13811                        _inherits(CircleTarget, _Target);
13812
13813                        function CircleTarget(x, y, r) {
13814                            _classCallCheck(this, CircleTarget);
13815
13816                            var _this = _possibleConstructorReturn(this, _Target.call(this));
13817
13818                            _this.p = {
13819                                x: x,
13820                                y: y,
13821                                r: r
13822                            };
13823                            return _this;
13824                        }
13825
13826                        CircleTarget.prototype.testIntersection = function testIntersection(e, data) {
13827                            var res = void 0;
13828                            var x = data.x,
13829                                y = data.y,
13830                                p = this.p;
13831
13832                            if ((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y) <= p.r * p.r) {
13833                                res = {
13834                                    target: this,
13835                                    data: data
13836                                };
13837                            }
13838                            return res;
13839                        };
13840
13841                        return CircleTarget;
13842                    }(_Target3.default);
13843
13844                    exports.default = CircleTarget;
13845
13846                    /***/
13847                },
13848/* 69 */
13849/***/function (module, exports, __webpack_require__) {
13850
13851                    "use strict";
13852                    'use strict';
13853
13854                    exports.__esModule = true;
13855
13856                    var _Target2 = __webpack_require__(21);
13857
13858                    var _Target3 = _interopRequireDefault(_Target2);
13859
13860                    var _BaseMathUtils = __webpack_require__(2);
13861
13862                    var _BaseMathUtils2 = _interopRequireDefault(_BaseMathUtils);
13863
13864                    function _interopRequireDefault(obj) {
13865                        return obj && obj.__esModule ? obj : { default: obj };
13866                    }
13867
13868                    function _classCallCheck(instance, Constructor) {
13869                        if (!(instance instanceof Constructor)) {
13870                            throw new TypeError("Cannot call a class as a function");
13871                        }
13872                    }
13873
13874                    function _possibleConstructorReturn(self, call) {
13875                        if (!self) {
13876                            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13877                        } return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
13878                    }
13879
13880                    function _inherits(subClass, superClass) {
13881                        if (typeof superClass !== "function" && superClass !== null) {
13882                            throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass)));
13883                        } subClass.prototype = Object.create(superClass && superClass.prototype, { c
13883onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
13884                    }
13885
13886                    var PolyTarget = function (_Target) {
13887                        _inherits(PolyTarget, _Target);
13888
13889                        function PolyTarget(poly) {
13890                            _classCallCheck(this, PolyTarget);
13891
13892                            var _this = _possibleConstructorReturn(this, _Target.call(this));
13893
13894                            _this.poly = poly;
13895                            return _this;
13896                        }
13897
13898                        PolyTarget.prototype.testIntersection = function testIntersection(e, p) {
13899                            return _BaseMathUtils2.default.isInsidePoly(this.poly, p) ? {
13900                                target: this,
13901                                data: p
13902                            } : undefined;
13903                        };
13904
13905                        return PolyTarget;
13906                    }(_Target3.default);
13907
13908                    exports.default = PolyTarget;
13909
13910                    /***/
13911                },
13912/* 70 */
13913/***/function (module, exports, __webpack_require__) {
13914
13915                    // stats.js - http://github.com/mrdoob/stats.js
13916                    (function (f, e) {
13917                        true ? module.exports = e() : "function" === typeof define && define.amd ? define(e) : f.Stats = e();
13918                    })(this, function () {
13919                        var f = function f() {
13920                            function e(a) {
13921                                c.appendChild(a.dom); return a;
13922                            } function u(a) {
13923                                for (var d = 0; d < c.children.length; d++) {
13924                                    c.children[d].style.display = d === a ? "block" : "none";
13925                                } l = a;
13926                            } var l = 0,
13927                                c = document.createElement("div"); c.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000"; c.addEventListener("click", function (a) {
13928                                    a.preventDefault();
13929                                    u(++l % c.children.length);
13930                                }, !1); var k = (performance || Date).now(),
13931                                    g = k,
13932                                    a = 0,
13933                                    r = e(new f.Panel("FPS", "#0ff", "#002")),
13934                                    h = e(new f.Panel("MS", "#0f0", "#020")); if (self.performance && self.performance.memory) var t = e(new f.Panel("MB", "#f08", "#201")); u(0); return {
13935                                        REVISION: 16, dom: c, addPanel: e, showPanel: u, begin: function begin() {
13936                                            k = (performance || Date).now();
13937                                        }, end: function end() {
13938                                            a++; var c = (performance || Date).now(); h.update(c - k, 200); if (c > g + 1E3 && (r.update(1E3 * a / (c - g), 100), g = c, a = 0, t)) {
13939                                                var d = performance.memory; t.update(d.usedJSHeapSize / 1048576, d.jsHeapSizeLimit / 1048576);
13940                                            } return c;
13941                                        }, update: function update() {
13942                                            k = this.end();
13943                                        }, domElement: c, setMode: u
13944                                    };
13945                        }; f.Panel = function (e, f, l) {
13946                            var c = Infinity,
13947                                k = 0,
13948                                g = Math.round,
13949                                a = g(window.devicePixelRatio || 1),
13950                                r = 80 * a,
13951                                h = 48 * a,
13952                                t = 3 * a,
13953                                v = 2 * a,
13954                                d = 3 * a,
13955                                m = 15 * a,
13956                                n = 74 * a,
13957                                p = 30 * a,
13958                                q = document.createElement("canvas"); q.width = r; q.height = h; q.style.cssText = "width:80px;height:48px"; var b = q.getContext("2d"); b.font = "bold " + 9 * a + "px Helvetica,Arial,sans-serif"; b.textBaseline = "top"; b.fillStyle = l; b.fillRect(0, 0, r, h); b.fillStyle = f; b.fillText(e, t, v);
13959                            b.fillRect(d, m, n, p); b.fillStyle = l; b.globalAlpha = .9; b.fillRect(d, m, n, p); return {
13960                                dom: q, update: function update(h, w) {
13961                                    c = Math.min(c, h); k = Math.max(k, h); b.fillStyle = l; b.globalAlpha = 1; b.fillRect(0, 0, r, m); b.fillStyle = f; b.fillText(g(h) + " " + e + " (" + g(c) + "-" + g(k) + ")", t, v); b.drawImage(q, d + a, m, n - a, p, d, m, n - a, p);
vendor: 11,425 bytes, lines 13961-14184
13961 b.fillRect(d + n - a, m, a, p); b.fillStyle = l; b.globalAlpha = .9; b.fillRect(d + n - a, m, a, g((1 - h / w) * p));
13962                                }
13963                            };
13964                        }; return f;
13965                    });
13966
13967                    /***/
13968                },
13969/* 71 */
13970/***/function (module, exports, __webpack_require__) {
13971
13972                    /*** IMPORTS FROM imports-loader ***/
13973                    var define = false;
13974
13975                    /*!
13976                     * jQuery Mousewheel 3.1.13
13977                     *
13978                     * Copyright jQuery Foundation and other contributors
13979                     * Released under the MIT license
13980                     * http://jquery.org/license
13981                     */
13982
13983                    (function (factory) {
13984                        if (typeof define === 'function' && define.amd) {
13985                            // AMD. Register as an anonymous module.
13986                            define(['jquery'], factory);
13987                        } else if (true) {
13988                            // Node/CommonJS style for Browserify
13989                            module.exports = factory;
13990                        } else {
13991                            // Browser globals
13992                            factory(jQuery);
13993                        }
13994                    })(function ($) {
13995
13996                        var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
13997                            toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
13998                            slice = Array.prototype.slice,
13999                            nullLowestDeltaTimeout,
14000                            lowestDelta;
14001
14002                        if ($.event.fixHooks) {
14003                            for (var i = toFix.length; i;) {
14004                                $.event.fixHooks[toFix[--i]] = $.event.mouseHooks;
14005                            }
14006                        }
14007
14008                        var special = $.event.special.mousewheel = {
14009                            version: '3.1.12',
14010
14011                            setup: function setup() {
14012                                if (this.addEventListener) {
14013                                    for (var i = toBind.length; i;) {
14014                                        this.addEventListener(toBind[--i], handler, false);
14015                                    }
14016                                } else {
14017                                    this.onmousewheel = handler;
14018                                }
14019                                // Store the line height and page height for this particular element
14020                                $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
14021                                $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
14022                            },
14023
14024                            teardown: function teardown() {
14025                                if (this.removeEventListener) {
14026                                    for (var i = toBind.length; i;) {
14027                                        this.removeEventListener(toBind[--i], handler, false);
14028                                    }
14029                                } else {
14030                                    this.onmousewheel = null;
14031                                }
14032                                // Clean up the data we added to the element
14033                                $.removeData(this, 'mousewheel-line-height');
14034                                $.removeData(this, 'mousewheel-page-height');
14035                            },
14036
14037                            getLineHeight: function getLineHeight(elem) {
14038                                var $elem = $(elem),
14039                                    $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
14040                                if (!$parent.length) {
14041                                    $parent = $('body');
14042                                }
14043                                return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
14044                            },
14045
14046                            getPageHeight: function getPageHeight(elem) {
14047                                return $(elem).height();
14048                            },
14049
14050                            settings: {
14051                                adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
14052                                normalizeOffset: true // calls getBoundingClientRect for each event
14053                            }
14054                        };
14055
14056                        $.fn.extend({
14057                            mousewheel: function mousewheel(fn) {
14058                                return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
14059                            },
14060
14061                            unmousewheel: function unmousewheel(fn) {
14062                                return this.unbind('mousewheel', fn);
14063                            }
14064                        });
14065
14066                        function handler(event) {
14067                            var orgEvent = event || window.event,
14068                                args = slice.call(arguments, 1),
14069                                delta = 0,
14070                                deltaX = 0,
14071                                deltaY = 0,
14072                                absDelta = 0,
14073                                offsetX = 0,
14074                                offsetY = 0;
14075                            event = $.event.fix(orgEvent);
14076                            event.type = 'mousewheel';
14077
14078                            // Old school scrollwheel delta
14079                            if ('detail' in orgEvent) {
14080                                deltaY = orgEvent.detail * -1;
14081                            }
14082                            if ('wheelDelta' in orgEvent) {
14083                                deltaY = orgEvent.wheelDelta;
14084                            }
14085                            if ('wheelDeltaY' in orgEvent) {
14086                                deltaY = orgEvent.wheelDeltaY;
14087                            }
14088                            if ('wheelDeltaX' in orgEvent) {
14089                                deltaX = orgEvent.wheelDeltaX * -1;
14090                            }
14091
14092                            // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
14093                            if ('axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS) {
14094                                deltaX = deltaY * -1;
14095                                deltaY = 0;
14096                            }
14097
14098                            // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
14099                            delta = deltaY === 0 ? deltaX : deltaY;
14100
14101                            // New school wheel delta (wheel event)
14102                            if ('deltaY' in orgEvent) {
14103                                deltaY = orgEvent.deltaY * -1;
14104                                delta = deltaY;
14105                            }
14106                            if ('deltaX' in orgEvent) {
14107                                deltaX = orgEvent.deltaX;
14108                                if (deltaY === 0) {
14109                                    delta = deltaX * -1;
14110                                }
14111                            }
14112
14113                            // No change actually happened, no reason to go any further
14114                            if (deltaY === 0 && deltaX === 0) {
14115                                return;
14116                            }
14117
14118                            // Need to convert lines and pages to pixels if we aren't already in pixels
14119                            // There are three delta modes:
14120                            //   * deltaMode 0 is by pixels, nothing to do
14121                            //   * deltaMode 1 is by lines
14122                            //   * deltaMode 2 is by pages
14123                            if (orgEvent.deltaMode === 1) {
14124                                var lineHeight = $.data(this, 'mousewheel-line-height');
14125                                delta *= lineHeight;
14126                                deltaY *= lineHeight;
14127                                deltaX *= lineHeight;
14128                            } else if (orgEvent.deltaMode === 2) {
14129                                var pageHeight = $.data(this, 'mousewheel-page-height');
14130                                delta *= pageHeight;
14131                                deltaY *= pageHeight;
14132                                deltaX *= pageHeight;
14133                            }
14134
14135                            // Store lowest absolute delta to normalize the delta values
14136                            absDelta = Math.max(Math.abs(deltaY), Math.abs(deltaX));
14137
14138                            if (!lowestDelta || absDelta < lowestDelta) {
14139                                lowestDelta = absDelta;
14140
14141                                // Adjust older deltas if necessary
14142                                if (shouldAdjustOldDeltas(orgEvent, absDelta)) {
14143                                    lowestDelta /= 40;
14144                                }
14145                            }
14146
14147                            // Adjust older deltas if necessary
14148                            if (shouldAdjustOldDeltas(orgEvent, absDelta)) {
14149                                // Divide all the things by 40!
14150                                delta /= 40;
14151                                deltaX /= 40;
14152                                deltaY /= 40;
14153                            }
14154
14155                            // Get a whole, normalized value for the deltas
14156                            delta = Math[delta >= 1 ? 'floor' : 'ceil'](delta / lowestDelta);
14157                            deltaX = Math[deltaX >= 1 ? 'floor' : 'ceil'](deltaX / lowestDelta);
14158                            deltaY = Math[deltaY >= 1 ? 'floor' : 'ceil'](deltaY / lowestDelta);
14159
14160                            // Normalise offsetX and offsetY properties
14161                            if (special.settings.normalizeOffset && this.getBoundingClientRect) {
14162                                var boundingRect = this.getBoundingClientRect();
14163                                offsetX = event.clientX - boundingRect.left;
14164                                offsetY = event.clientY - boundingRect.top;
14165                            }
14166
14167                            // Add information to the event object
14168                            event.deltaX = deltaX;
14169                            event.deltaY = deltaY;
14170                            event.deltaFactor = lowestDelta;
14171                            event.offsetX = offsetX;
14172                            event.offsetY = offsetY;
14173                            // Go ahead and set deltaMode to 0 since we converted to pixels
14174                            // Although this is a little odd since we overwrite the deltaX/Y
14175                            // properties with normalized deltas.
14176                            event.deltaMode = 0;
14177
14178                            // Add event and delta to the front of the arguments
14179                            args.unshift(event, delta, deltaX, deltaY);
14180
14181                            // Clearout lowestDelta after sometime to better
14182                            // handle multiple device types that give different
14183                            // a different lowestDelta
14184                            // Ex: trackpad = 3 and mouse wheel = 120
14185                            if (nullLowestDeltaTimeout) {
14186                                clearTimeout(nullLowestDeltaTimeout);
14187                            }
14188                            nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
14189
14190                            return ($.event.dispatch || $.event.handle).apply(this, args);
14191                        }
14192
14193                        function nullLowestDelta() {
14194                            lowestDelta = null;
14195                        }
14196
14197                        function shouldAdjustOldDeltas(orgEvent, absDelta) {
14198                            // If this is an older event and the delta is divisable by 120,
14199                            // then we are assuming that the browser is treating this as an
14200                            // older mouse wheel event and that we should divide the deltas
14201                            // by 40 to try and get a more usable deltaFactor.
14202                            // Side note, this actually impacts the reported scroll distance
14203                            // in older browsers and can cause scrolling to be slower than native.
14204                            // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
14205                            return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
14206                        }
14207                    });
14208
14209                    /***/
14210                },
14211/* 72 */
14212/***/function (module, exports, __webpack_require__) {
14213
14214                    __webpack_require__(23);
14215                    module.exports = __webpack_require__(22);
14216
14217                    /***/
14218                }
14219/******/]);
14220
14221        /***/
14222}),
14223/* 2 */
14224/***/ (function (module, exports, __webpack_require__) {
14225
14226        "use strict";
14227
14228
14229        exports.__esModule = true;
14230        var _$ = true ? window.jQuery : require('jquery'),
14231            _html2canvas = true ? window.html2canvas : require('html2canvas'),
14232            _THREE = true ? window.THREE : require('three'),
14233            _PDFJS = true ? window.PDFJS : require('pdfjs');
14234
14235        exports.$ = _$;
14236        exports.html2canvas = _html2canvas;
14237        exports.THREE = _THREE;
14238        exports.PDFJS = _PDFJS;
14239
14240        /***/
14241}),
14242/* 3 */
14243/***/ (function (module, exports, __webpack_require__) {
14244
14245        module.exports = __webpack_require__(0);
14246
14247
14248        /***/
14249})
14250/******/]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.