2161 lines
87 KiB
JavaScript
2161 lines
87 KiB
JavaScript
/******/ (() => { // webpackBootstrap
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/OverloadYield.js":
|
|
/*!***************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/OverloadYield.js ***!
|
|
\***************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _OverloadYield(e, d) {
|
|
this.v = e, this.k = d;
|
|
}
|
|
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
|
/*!***********************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
|
\***********************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _assertThisInitialized(e) {
|
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
return e;
|
|
}
|
|
module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js":
|
|
/*!******************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
|
|
\******************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
try {
|
|
var i = n[a](c),
|
|
u = i.value;
|
|
} catch (n) {
|
|
return void e(n);
|
|
}
|
|
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
}
|
|
function _asyncToGenerator(n) {
|
|
return function () {
|
|
var t = this,
|
|
e = arguments;
|
|
return new Promise(function (r, o) {
|
|
var a = n.apply(t, e);
|
|
function _next(n) {
|
|
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
}
|
|
function _throw(n) {
|
|
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
}
|
|
_next(void 0);
|
|
});
|
|
};
|
|
}
|
|
module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js":
|
|
/*!****************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***!
|
|
\****************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _classCallCheck(a, n) {
|
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/createClass.js":
|
|
/*!*************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/createClass.js ***!
|
|
\*************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
|
|
function _defineProperties(e, r) {
|
|
for (var t = 0; t < r.length; t++) {
|
|
var o = r[t];
|
|
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
}
|
|
}
|
|
function _createClass(e, r, t) {
|
|
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
writable: !1
|
|
}), e;
|
|
}
|
|
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/defineProperty.js":
|
|
/*!****************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/defineProperty.js ***!
|
|
\****************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
|
|
function _defineProperty(e, r, t) {
|
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
value: t,
|
|
enumerable: !0,
|
|
configurable: !0,
|
|
writable: !0
|
|
}) : e[r] = t, e;
|
|
}
|
|
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/get.js":
|
|
/*!*****************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/get.js ***!
|
|
\*****************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var superPropBase = __webpack_require__(/*! ./superPropBase.js */ "../node_modules/@babel/runtime/helpers/superPropBase.js");
|
|
function _get() {
|
|
return module.exports = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
|
|
var p = superPropBase(e, t);
|
|
if (p) {
|
|
var n = Object.getOwnPropertyDescriptor(p, t);
|
|
return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
|
|
}
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _get.apply(null, arguments);
|
|
}
|
|
module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js":
|
|
/*!****************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
|
|
\****************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _getPrototypeOf(t) {
|
|
return module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _getPrototypeOf(t);
|
|
}
|
|
module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/inherits.js":
|
|
/*!**********************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/inherits.js ***!
|
|
\**********************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js");
|
|
function _inherits(t, e) {
|
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
t.prototype = Object.create(e && e.prototype, {
|
|
constructor: {
|
|
value: t,
|
|
writable: !0,
|
|
configurable: !0
|
|
}
|
|
}), Object.defineProperty(t, "prototype", {
|
|
writable: !1
|
|
}), e && setPrototypeOf(t, e);
|
|
}
|
|
module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js":
|
|
/*!***********************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
|
|
\***********************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _interopRequireDefault(e) {
|
|
return e && e.__esModule ? e : {
|
|
"default": e
|
|
};
|
|
}
|
|
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
|
/*!***************************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
|
\***************************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
|
|
var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js");
|
|
function _possibleConstructorReturn(t, e) {
|
|
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
|
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
return assertThisInitialized(t);
|
|
}
|
|
module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regenerator.js":
|
|
/*!*************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regenerator.js ***!
|
|
\*************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var regeneratorDefine = __webpack_require__(/*! ./regeneratorDefine.js */ "../node_modules/@babel/runtime/helpers/regeneratorDefine.js");
|
|
function _regenerator() {
|
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
var e,
|
|
t,
|
|
r = "function" == typeof Symbol ? Symbol : {},
|
|
n = r.iterator || "@@iterator",
|
|
o = r.toStringTag || "@@toStringTag";
|
|
function i(r, n, o, i) {
|
|
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
u = Object.create(c.prototype);
|
|
return regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
var i,
|
|
c,
|
|
u,
|
|
f = 0,
|
|
p = o || [],
|
|
y = !1,
|
|
G = {
|
|
p: 0,
|
|
n: 0,
|
|
v: e,
|
|
a: d,
|
|
f: d.bind(e, 4),
|
|
d: function d(t, r) {
|
|
return i = t, c = 0, u = e, G.n = r, a;
|
|
}
|
|
};
|
|
function d(r, n) {
|
|
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
var o,
|
|
i = p[t],
|
|
d = G.p,
|
|
l = i[2];
|
|
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
}
|
|
if (o || r > 1) return a;
|
|
throw y = !0, n;
|
|
}
|
|
return function (o, p, l) {
|
|
if (f > 1) throw TypeError("Generator is already running");
|
|
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
try {
|
|
if (f = 2, i) {
|
|
if (c || (o = "next"), t = i[o]) {
|
|
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
if (!t.done) return t;
|
|
u = t.value, c < 2 && (c = 0);
|
|
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
i = e;
|
|
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
} catch (t) {
|
|
i = e, c = 1, u = t;
|
|
} finally {
|
|
f = 1;
|
|
}
|
|
}
|
|
return {
|
|
value: t,
|
|
done: y
|
|
};
|
|
};
|
|
}(r, o, i), !0), u;
|
|
}
|
|
var a = {};
|
|
function Generator() {}
|
|
function GeneratorFunction() {}
|
|
function GeneratorFunctionPrototype() {}
|
|
t = Object.getPrototypeOf;
|
|
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () {
|
|
return this;
|
|
}), t),
|
|
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
function f(e) {
|
|
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
}
|
|
return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function () {
|
|
return this;
|
|
}), regeneratorDefine(u, "toString", function () {
|
|
return "[object Generator]";
|
|
}), (module.exports = _regenerator = function _regenerator() {
|
|
return {
|
|
w: i,
|
|
m: f
|
|
};
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
}
|
|
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regeneratorAsync.js":
|
|
/*!******************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regeneratorAsync.js ***!
|
|
\******************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var regeneratorAsyncGen = __webpack_require__(/*! ./regeneratorAsyncGen.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js");
|
|
function _regeneratorAsync(n, e, r, t, o) {
|
|
var a = regeneratorAsyncGen(n, e, r, t, o);
|
|
return a.next().then(function (n) {
|
|
return n.done ? n.value : a.next();
|
|
});
|
|
}
|
|
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js":
|
|
/*!*********************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js ***!
|
|
\*********************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var regenerator = __webpack_require__(/*! ./regenerator.js */ "../node_modules/@babel/runtime/helpers/regenerator.js");
|
|
var regeneratorAsyncIterator = __webpack_require__(/*! ./regeneratorAsyncIterator.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js");
|
|
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
|
|
}
|
|
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js":
|
|
/*!**************************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js ***!
|
|
\**************************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var OverloadYield = __webpack_require__(/*! ./OverloadYield.js */ "../node_modules/@babel/runtime/helpers/OverloadYield.js");
|
|
var regeneratorDefine = __webpack_require__(/*! ./regeneratorDefine.js */ "../node_modules/@babel/runtime/helpers/regeneratorDefine.js");
|
|
function AsyncIterator(t, e) {
|
|
function n(r, o, i, f) {
|
|
try {
|
|
var c = t[r](o),
|
|
u = c.value;
|
|
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
n("next", t, i, f);
|
|
}, function (t) {
|
|
n("throw", t, i, f);
|
|
}) : e.resolve(u).then(function (t) {
|
|
c.value = t, i(c);
|
|
}, function (t) {
|
|
return n("throw", t, i, f);
|
|
});
|
|
} catch (t) {
|
|
f(t);
|
|
}
|
|
}
|
|
var r;
|
|
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
return this;
|
|
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
function f() {
|
|
return new e(function (e, r) {
|
|
n(t, i, e, r);
|
|
});
|
|
}
|
|
return r = r ? r.then(f, f) : f();
|
|
}, !0);
|
|
}
|
|
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regeneratorDefine.js":
|
|
/*!*******************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regeneratorDefine.js ***!
|
|
\*******************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _regeneratorDefine(e, r, n, t) {
|
|
var i = Object.defineProperty;
|
|
try {
|
|
i({}, "", {});
|
|
} catch (e) {
|
|
i = 0;
|
|
}
|
|
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
|
|
function o(r, n) {
|
|
_regeneratorDefine(e, r, function (e) {
|
|
return this._invoke(r, n, e);
|
|
});
|
|
}
|
|
r ? i ? i(e, r, {
|
|
value: n,
|
|
enumerable: !t,
|
|
configurable: !t,
|
|
writable: !t
|
|
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
|
|
}
|
|
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regeneratorKeys.js":
|
|
/*!*****************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regeneratorKeys.js ***!
|
|
\*****************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _regeneratorKeys(e) {
|
|
var n = Object(e),
|
|
r = [];
|
|
for (var t in n) r.unshift(t);
|
|
return function e() {
|
|
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
return e.done = !0, e;
|
|
};
|
|
}
|
|
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regeneratorRuntime.js":
|
|
/*!********************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
|
|
\********************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var OverloadYield = __webpack_require__(/*! ./OverloadYield.js */ "../node_modules/@babel/runtime/helpers/OverloadYield.js");
|
|
var regenerator = __webpack_require__(/*! ./regenerator.js */ "../node_modules/@babel/runtime/helpers/regenerator.js");
|
|
var regeneratorAsync = __webpack_require__(/*! ./regeneratorAsync.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsync.js");
|
|
var regeneratorAsyncGen = __webpack_require__(/*! ./regeneratorAsyncGen.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js");
|
|
var regeneratorAsyncIterator = __webpack_require__(/*! ./regeneratorAsyncIterator.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js");
|
|
var regeneratorKeys = __webpack_require__(/*! ./regeneratorKeys.js */ "../node_modules/@babel/runtime/helpers/regeneratorKeys.js");
|
|
var regeneratorValues = __webpack_require__(/*! ./regeneratorValues.js */ "../node_modules/@babel/runtime/helpers/regeneratorValues.js");
|
|
function _regeneratorRuntime() {
|
|
"use strict";
|
|
|
|
var r = regenerator(),
|
|
e = r.m(_regeneratorRuntime),
|
|
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
function n(r) {
|
|
var e = "function" == typeof r && r.constructor;
|
|
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
}
|
|
var o = {
|
|
"throw": 1,
|
|
"return": 2,
|
|
"break": 3,
|
|
"continue": 3
|
|
};
|
|
function a(r) {
|
|
var e, t;
|
|
return function (n) {
|
|
e || (e = {
|
|
stop: function stop() {
|
|
return t(n.a, 2);
|
|
},
|
|
"catch": function _catch() {
|
|
return n.v;
|
|
},
|
|
abrupt: function abrupt(r, e) {
|
|
return t(n.a, o[r], e);
|
|
},
|
|
delegateYield: function delegateYield(r, o, a) {
|
|
return e.resultName = o, t(n.d, regeneratorValues(r), a);
|
|
},
|
|
finish: function finish(r) {
|
|
return t(n.f, r);
|
|
}
|
|
}, t = function t(r, _t, o) {
|
|
n.p = e.prev, n.n = e.next;
|
|
try {
|
|
return r(_t, o);
|
|
} finally {
|
|
e.next = n.n;
|
|
}
|
|
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
try {
|
|
return r.call(this, e);
|
|
} finally {
|
|
n.p = e.prev, n.n = e.next;
|
|
}
|
|
};
|
|
}
|
|
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
return {
|
|
wrap: function wrap(e, t, n, o) {
|
|
return r.w(a(e), t, n, o && o.reverse());
|
|
},
|
|
isGeneratorFunction: n,
|
|
mark: r.m,
|
|
awrap: function awrap(r, e) {
|
|
return new OverloadYield(r, e);
|
|
},
|
|
AsyncIterator: regeneratorAsyncIterator,
|
|
async: function async(r, e, t, o, u) {
|
|
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
|
|
},
|
|
keys: regeneratorKeys,
|
|
values: regeneratorValues
|
|
};
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
}
|
|
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/regeneratorValues.js":
|
|
/*!*******************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/regeneratorValues.js ***!
|
|
\*******************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
|
|
function _regeneratorValues(e) {
|
|
if (null != e) {
|
|
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
r = 0;
|
|
if (t) return t.call(e);
|
|
if ("function" == typeof e.next) return e;
|
|
if (!isNaN(e.length)) return {
|
|
next: function next() {
|
|
return e && r >= e.length && (e = void 0), {
|
|
value: e && e[r++],
|
|
done: !e
|
|
};
|
|
}
|
|
};
|
|
}
|
|
throw new TypeError(_typeof(e) + " is not iterable");
|
|
}
|
|
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js":
|
|
/*!****************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
|
|
\****************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _setPrototypeOf(t, e) {
|
|
return module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
return t.__proto__ = e, t;
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _setPrototypeOf(t, e);
|
|
}
|
|
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/superPropBase.js":
|
|
/*!***************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/superPropBase.js ***!
|
|
\***************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js");
|
|
function _superPropBase(t, o) {
|
|
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t)););
|
|
return t;
|
|
}
|
|
module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js":
|
|
/*!*************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***!
|
|
\*************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
|
|
function toPrimitive(t, r) {
|
|
if ("object" != _typeof(t) || !t) return t;
|
|
var e = t[Symbol.toPrimitive];
|
|
if (void 0 !== e) {
|
|
var i = e.call(t, r || "default");
|
|
if ("object" != _typeof(i)) return i;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return ("string" === r ? String : Number)(t);
|
|
}
|
|
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js":
|
|
/*!***************************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
|
|
\***************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
|
|
var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js");
|
|
function toPropertyKey(t) {
|
|
var i = toPrimitive(t, "string");
|
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
}
|
|
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/helpers/typeof.js":
|
|
/*!********************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/helpers/typeof.js ***!
|
|
\********************************************************/
|
|
/***/ ((module) => {
|
|
|
|
function _typeof(o) {
|
|
"@babel/helpers - typeof";
|
|
|
|
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
return typeof o;
|
|
} : function (o) {
|
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
}
|
|
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/@babel/runtime/regenerator/index.js":
|
|
/*!***********************************************************!*\
|
|
!*** ../node_modules/@babel/runtime/regenerator/index.js ***!
|
|
\***********************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
// TODO(Babel 8): Remove this file.
|
|
|
|
var runtime = __webpack_require__(/*! ../helpers/regeneratorRuntime */ "../node_modules/@babel/runtime/helpers/regeneratorRuntime.js")();
|
|
module.exports = runtime;
|
|
|
|
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
try {
|
|
regeneratorRuntime = runtime;
|
|
} catch (accidentalStrictMode) {
|
|
if (typeof globalThis === "object") {
|
|
globalThis.regeneratorRuntime = runtime;
|
|
} else {
|
|
Function("r", "regeneratorRuntime = r")(runtime);
|
|
}
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/apply-style.js":
|
|
/*!*******************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/apply-style.js ***!
|
|
\*******************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ applyStyle: () => (/* binding */ applyStyle)
|
|
/* harmony export */ });
|
|
function applyStyle(node, options) {
|
|
const { style } = node;
|
|
if (options.backgroundColor) {
|
|
style.backgroundColor = options.backgroundColor;
|
|
}
|
|
if (options.width) {
|
|
style.width = `${options.width}px`;
|
|
}
|
|
if (options.height) {
|
|
style.height = `${options.height}px`;
|
|
}
|
|
const manual = options.style;
|
|
if (manual != null) {
|
|
Object.keys(manual).forEach((key) => {
|
|
style[key] = manual[key];
|
|
});
|
|
}
|
|
return node;
|
|
}
|
|
//# sourceMappingURL=apply-style.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/clone-node.js":
|
|
/*!******************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/clone-node.js ***!
|
|
\******************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ cloneNode: () => (/* binding */ cloneNode)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _clone_pseudos__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clone-pseudos */ "../node_modules/html-to-image/es/clone-pseudos.js");
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js");
|
|
/* harmony import */ var _mimes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mimes */ "../node_modules/html-to-image/es/mimes.js");
|
|
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js");
|
|
|
|
|
|
|
|
|
|
async function cloneCanvasElement(canvas) {
|
|
const dataURL = canvas.toDataURL();
|
|
if (dataURL === 'data:,') {
|
|
return canvas.cloneNode(false);
|
|
}
|
|
return (0,_util__WEBPACK_IMPORTED_MODULE_1__.createImage)(dataURL);
|
|
}
|
|
async function cloneVideoElement(video, options) {
|
|
if (video.currentSrc) {
|
|
const canvas = document.createElement('canvas');
|
|
const ctx = canvas.getContext('2d');
|
|
canvas.width = video.clientWidth;
|
|
canvas.height = video.clientHeight;
|
|
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
const dataURL = canvas.toDataURL();
|
|
return (0,_util__WEBPACK_IMPORTED_MODULE_1__.createImage)(dataURL);
|
|
}
|
|
const poster = video.poster;
|
|
const contentType = (0,_mimes__WEBPACK_IMPORTED_MODULE_2__.getMimeType)(poster);
|
|
const dataURL = await (0,_dataurl__WEBPACK_IMPORTED_MODULE_3__.resourceToDataURL)(poster, contentType, options);
|
|
return (0,_util__WEBPACK_IMPORTED_MODULE_1__.createImage)(dataURL);
|
|
}
|
|
async function cloneIFrameElement(iframe, options) {
|
|
var _a;
|
|
try {
|
|
if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
|
|
return (await cloneNode(iframe.contentDocument.body, options, true));
|
|
}
|
|
}
|
|
catch (_b) {
|
|
// Failed to clone iframe
|
|
}
|
|
return iframe.cloneNode(false);
|
|
}
|
|
async function cloneSingleNode(node, options) {
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(node, HTMLCanvasElement)) {
|
|
return cloneCanvasElement(node);
|
|
}
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(node, HTMLVideoElement)) {
|
|
return cloneVideoElement(node, options);
|
|
}
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(node, HTMLIFrameElement)) {
|
|
return cloneIFrameElement(node, options);
|
|
}
|
|
return node.cloneNode(isSVGElement(node));
|
|
}
|
|
const isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === 'SLOT';
|
|
const isSVGElement = (node) => node.tagName != null && node.tagName.toUpperCase() === 'SVG';
|
|
async function cloneChildren(nativeNode, clonedNode, options) {
|
|
var _a, _b;
|
|
if (isSVGElement(clonedNode)) {
|
|
return clonedNode;
|
|
}
|
|
let children = [];
|
|
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
|
|
children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(nativeNode.assignedNodes());
|
|
}
|
|
else if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLIFrameElement) &&
|
|
((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(nativeNode.contentDocument.body.childNodes);
|
|
}
|
|
else {
|
|
children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
|
|
}
|
|
if (children.length === 0 ||
|
|
(0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLVideoElement)) {
|
|
return clonedNode;
|
|
}
|
|
await children.reduce((deferred, child) => deferred
|
|
.then(() => cloneNode(child, options))
|
|
.then((clonedChild) => {
|
|
if (clonedChild) {
|
|
clonedNode.appendChild(clonedChild);
|
|
}
|
|
}), Promise.resolve());
|
|
return clonedNode;
|
|
}
|
|
function cloneCSSStyle(nativeNode, clonedNode, options) {
|
|
const targetStyle = clonedNode.style;
|
|
if (!targetStyle) {
|
|
return;
|
|
}
|
|
const sourceStyle = window.getComputedStyle(nativeNode);
|
|
if (sourceStyle.cssText) {
|
|
targetStyle.cssText = sourceStyle.cssText;
|
|
targetStyle.transformOrigin = sourceStyle.transformOrigin;
|
|
}
|
|
else {
|
|
(0,_util__WEBPACK_IMPORTED_MODULE_1__.getStyleProperties)(options).forEach((name) => {
|
|
let value = sourceStyle.getPropertyValue(name);
|
|
if (name === 'font-size' && value.endsWith('px')) {
|
|
const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
|
|
value = `${reducedFont}px`;
|
|
}
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLIFrameElement) &&
|
|
name === 'display' &&
|
|
value === 'inline') {
|
|
value = 'block';
|
|
}
|
|
if (name === 'd' && clonedNode.getAttribute('d')) {
|
|
value = `path(${clonedNode.getAttribute('d')})`;
|
|
}
|
|
targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
|
|
});
|
|
}
|
|
}
|
|
function cloneInputValue(nativeNode, clonedNode) {
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLTextAreaElement)) {
|
|
clonedNode.innerHTML = nativeNode.value;
|
|
}
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLInputElement)) {
|
|
clonedNode.setAttribute('value', nativeNode.value);
|
|
}
|
|
}
|
|
function cloneSelectValue(nativeNode, clonedNode) {
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLSelectElement)) {
|
|
const clonedSelect = clonedNode;
|
|
const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute('value'));
|
|
if (selectedOption) {
|
|
selectedOption.setAttribute('selected', '');
|
|
}
|
|
}
|
|
}
|
|
function decorate(nativeNode, clonedNode, options) {
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, Element)) {
|
|
cloneCSSStyle(nativeNode, clonedNode, options);
|
|
(0,_clone_pseudos__WEBPACK_IMPORTED_MODULE_0__.clonePseudoElements)(nativeNode, clonedNode, options);
|
|
cloneInputValue(nativeNode, clonedNode);
|
|
cloneSelectValue(nativeNode, clonedNode);
|
|
}
|
|
return clonedNode;
|
|
}
|
|
async function ensureSVGSymbols(clone, options) {
|
|
const uses = clone.querySelectorAll ? clone.querySelectorAll('use') : [];
|
|
if (uses.length === 0) {
|
|
return clone;
|
|
}
|
|
const processedDefs = {};
|
|
for (let i = 0; i < uses.length; i++) {
|
|
const use = uses[i];
|
|
const id = use.getAttribute('xlink:href');
|
|
if (id) {
|
|
const exist = clone.querySelector(id);
|
|
const definition = document.querySelector(id);
|
|
if (!exist && definition && !processedDefs[id]) {
|
|
// eslint-disable-next-line no-await-in-loop
|
|
processedDefs[id] = (await cloneNode(definition, options, true));
|
|
}
|
|
}
|
|
}
|
|
const nodes = Object.values(processedDefs);
|
|
if (nodes.length) {
|
|
const ns = 'http://www.w3.org/1999/xhtml';
|
|
const svg = document.createElementNS(ns, 'svg');
|
|
svg.setAttribute('xmlns', ns);
|
|
svg.style.position = 'absolute';
|
|
svg.style.width = '0';
|
|
svg.style.height = '0';
|
|
svg.style.overflow = 'hidden';
|
|
svg.style.display = 'none';
|
|
const defs = document.createElementNS(ns, 'defs');
|
|
svg.appendChild(defs);
|
|
for (let i = 0; i < nodes.length; i++) {
|
|
defs.appendChild(nodes[i]);
|
|
}
|
|
clone.appendChild(svg);
|
|
}
|
|
return clone;
|
|
}
|
|
async function cloneNode(node, options, isRoot) {
|
|
if (!isRoot && options.filter && !options.filter(node)) {
|
|
return null;
|
|
}
|
|
return Promise.resolve(node)
|
|
.then((clonedNode) => cloneSingleNode(clonedNode, options))
|
|
.then((clonedNode) => cloneChildren(node, clonedNode, options))
|
|
.then((clonedNode) => decorate(node, clonedNode, options))
|
|
.then((clonedNode) => ensureSVGSymbols(clonedNode, options));
|
|
}
|
|
//# sourceMappingURL=clone-node.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/clone-pseudos.js":
|
|
/*!*********************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/clone-pseudos.js ***!
|
|
\*********************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ clonePseudoElements: () => (/* binding */ clonePseudoElements)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js");
|
|
|
|
function formatCSSText(style) {
|
|
const content = style.getPropertyValue('content');
|
|
return `${style.cssText} content: '${content.replace(/'|"/g, '')}';`;
|
|
}
|
|
function formatCSSProperties(style, options) {
|
|
return (0,_util__WEBPACK_IMPORTED_MODULE_0__.getStyleProperties)(options)
|
|
.map((name) => {
|
|
const value = style.getPropertyValue(name);
|
|
const priority = style.getPropertyPriority(name);
|
|
return `${name}: ${value}${priority ? ' !important' : ''};`;
|
|
})
|
|
.join(' ');
|
|
}
|
|
function getPseudoElementStyle(className, pseudo, style, options) {
|
|
const selector = `.${className}:${pseudo}`;
|
|
const cssText = style.cssText
|
|
? formatCSSText(style)
|
|
: formatCSSProperties(style, options);
|
|
return document.createTextNode(`${selector}{${cssText}}`);
|
|
}
|
|
function clonePseudoElement(nativeNode, clonedNode, pseudo, options) {
|
|
const style = window.getComputedStyle(nativeNode, pseudo);
|
|
const content = style.getPropertyValue('content');
|
|
if (content === '' || content === 'none') {
|
|
return;
|
|
}
|
|
const className = (0,_util__WEBPACK_IMPORTED_MODULE_0__.uuid)();
|
|
try {
|
|
clonedNode.className = `${clonedNode.className} ${className}`;
|
|
}
|
|
catch (err) {
|
|
return;
|
|
}
|
|
const styleElement = document.createElement('style');
|
|
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style, options));
|
|
clonedNode.appendChild(styleElement);
|
|
}
|
|
function clonePseudoElements(nativeNode, clonedNode, options) {
|
|
clonePseudoElement(nativeNode, clonedNode, ':before', options);
|
|
clonePseudoElement(nativeNode, clonedNode, ':after', options);
|
|
}
|
|
//# sourceMappingURL=clone-pseudos.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/dataurl.js":
|
|
/*!***************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/dataurl.js ***!
|
|
\***************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ fetchAsDataURL: () => (/* binding */ fetchAsDataURL),
|
|
/* harmony export */ isDataUrl: () => (/* binding */ isDataUrl),
|
|
/* harmony export */ makeDataUrl: () => (/* binding */ makeDataUrl),
|
|
/* harmony export */ resourceToDataURL: () => (/* binding */ resourceToDataURL)
|
|
/* harmony export */ });
|
|
function getContentFromDataUrl(dataURL) {
|
|
return dataURL.split(/,/)[1];
|
|
}
|
|
function isDataUrl(url) {
|
|
return url.search(/^(data:)/) !== -1;
|
|
}
|
|
function makeDataUrl(content, mimeType) {
|
|
return `data:${mimeType};base64,${content}`;
|
|
}
|
|
async function fetchAsDataURL(url, init, process) {
|
|
const res = await fetch(url, init);
|
|
if (res.status === 404) {
|
|
throw new Error(`Resource "${res.url}" not found`);
|
|
}
|
|
const blob = await res.blob();
|
|
return new Promise((resolve, reject) => {
|
|
const reader = new FileReader();
|
|
reader.onerror = reject;
|
|
reader.onloadend = () => {
|
|
try {
|
|
resolve(process({ res, result: reader.result }));
|
|
}
|
|
catch (error) {
|
|
reject(error);
|
|
}
|
|
};
|
|
reader.readAsDataURL(blob);
|
|
});
|
|
}
|
|
const cache = {};
|
|
function getCacheKey(url, contentType, includeQueryParams) {
|
|
let key = url.replace(/\?.*/, '');
|
|
if (includeQueryParams) {
|
|
key = url;
|
|
}
|
|
// font resource
|
|
if (/ttf|otf|eot|woff2?/i.test(key)) {
|
|
key = key.replace(/.*\//, '');
|
|
}
|
|
return contentType ? `[${contentType}]${key}` : key;
|
|
}
|
|
async function resourceToDataURL(resourceUrl, contentType, options) {
|
|
const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
|
|
if (cache[cacheKey] != null) {
|
|
return cache[cacheKey];
|
|
}
|
|
// ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
|
|
if (options.cacheBust) {
|
|
// eslint-disable-next-line no-param-reassign
|
|
resourceUrl += (/\?/.test(resourceUrl) ? '&' : '?') + new Date().getTime();
|
|
}
|
|
let dataURL;
|
|
try {
|
|
const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
|
|
if (!contentType) {
|
|
// eslint-disable-next-line no-param-reassign
|
|
contentType = res.headers.get('Content-Type') || '';
|
|
}
|
|
return getContentFromDataUrl(result);
|
|
});
|
|
dataURL = makeDataUrl(content, contentType);
|
|
}
|
|
catch (error) {
|
|
dataURL = options.imagePlaceholder || '';
|
|
let msg = `Failed to fetch resource: ${resourceUrl}`;
|
|
if (error) {
|
|
msg = typeof error === 'string' ? error : error.message;
|
|
}
|
|
if (msg) {
|
|
console.warn(msg);
|
|
}
|
|
}
|
|
cache[cacheKey] = dataURL;
|
|
return dataURL;
|
|
}
|
|
//# sourceMappingURL=dataurl.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/embed-images.js":
|
|
/*!********************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/embed-images.js ***!
|
|
\********************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ embedImages: () => (/* binding */ embedImages)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _embed_resources__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./embed-resources */ "../node_modules/html-to-image/es/embed-resources.js");
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js");
|
|
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js");
|
|
/* harmony import */ var _mimes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mimes */ "../node_modules/html-to-image/es/mimes.js");
|
|
|
|
|
|
|
|
|
|
async function embedProp(propName, node, options) {
|
|
var _a;
|
|
const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
|
|
if (propValue) {
|
|
const cssString = await (0,_embed_resources__WEBPACK_IMPORTED_MODULE_0__.embedResources)(propValue, null, options);
|
|
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
async function embedBackground(clonedNode, options) {
|
|
;
|
|
(await embedProp('background', clonedNode, options)) ||
|
|
(await embedProp('background-image', clonedNode, options));
|
|
(await embedProp('mask', clonedNode, options)) ||
|
|
(await embedProp('-webkit-mask', clonedNode, options)) ||
|
|
(await embedProp('mask-image', clonedNode, options)) ||
|
|
(await embedProp('-webkit-mask-image', clonedNode, options));
|
|
}
|
|
async function embedImageNode(clonedNode, options) {
|
|
const isImageElement = (0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, HTMLImageElement);
|
|
if (!(isImageElement && !(0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.isDataUrl)(clonedNode.src)) &&
|
|
!((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, SVGImageElement) &&
|
|
!(0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.isDataUrl)(clonedNode.href.baseVal))) {
|
|
return;
|
|
}
|
|
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
|
|
const dataURL = await (0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.resourceToDataURL)(url, (0,_mimes__WEBPACK_IMPORTED_MODULE_3__.getMimeType)(url), options);
|
|
await new Promise((resolve, reject) => {
|
|
clonedNode.onload = resolve;
|
|
clonedNode.onerror = options.onImageErrorHandler
|
|
? (...attributes) => {
|
|
try {
|
|
resolve(options.onImageErrorHandler(...attributes));
|
|
}
|
|
catch (error) {
|
|
reject(error);
|
|
}
|
|
}
|
|
: reject;
|
|
const image = clonedNode;
|
|
if (image.decode) {
|
|
image.decode = resolve;
|
|
}
|
|
if (image.loading === 'lazy') {
|
|
image.loading = 'eager';
|
|
}
|
|
if (isImageElement) {
|
|
clonedNode.srcset = '';
|
|
clonedNode.src = dataURL;
|
|
}
|
|
else {
|
|
clonedNode.href.baseVal = dataURL;
|
|
}
|
|
});
|
|
}
|
|
async function embedChildren(clonedNode, options) {
|
|
const children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(clonedNode.childNodes);
|
|
const deferreds = children.map((child) => embedImages(child, options));
|
|
await Promise.all(deferreds).then(() => clonedNode);
|
|
}
|
|
async function embedImages(clonedNode, options) {
|
|
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, Element)) {
|
|
await embedBackground(clonedNode, options);
|
|
await embedImageNode(clonedNode, options);
|
|
await embedChildren(clonedNode, options);
|
|
}
|
|
}
|
|
//# sourceMappingURL=embed-images.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/embed-resources.js":
|
|
/*!***********************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/embed-resources.js ***!
|
|
\***********************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ embed: () => (/* binding */ embed),
|
|
/* harmony export */ embedResources: () => (/* binding */ embedResources),
|
|
/* harmony export */ parseURLs: () => (/* binding */ parseURLs),
|
|
/* harmony export */ shouldEmbed: () => (/* binding */ shouldEmbed)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js");
|
|
/* harmony import */ var _mimes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mimes */ "../node_modules/html-to-image/es/mimes.js");
|
|
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js");
|
|
|
|
|
|
|
|
const URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
const URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
|
|
const FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
function toRegex(url) {
|
|
// eslint-disable-next-line no-useless-escape
|
|
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1');
|
|
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, 'g');
|
|
}
|
|
function parseURLs(cssText) {
|
|
const urls = [];
|
|
cssText.replace(URL_REGEX, (raw, quotation, url) => {
|
|
urls.push(url);
|
|
return raw;
|
|
});
|
|
return urls.filter((url) => !(0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.isDataUrl)(url));
|
|
}
|
|
async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
|
|
try {
|
|
const resolvedURL = baseURL ? (0,_util__WEBPACK_IMPORTED_MODULE_0__.resolveUrl)(resourceURL, baseURL) : resourceURL;
|
|
const contentType = (0,_mimes__WEBPACK_IMPORTED_MODULE_1__.getMimeType)(resourceURL);
|
|
let dataURL;
|
|
if (getContentFromUrl) {
|
|
const content = await getContentFromUrl(resolvedURL);
|
|
dataURL = (0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.makeDataUrl)(content, contentType);
|
|
}
|
|
else {
|
|
dataURL = await (0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.resourceToDataURL)(resolvedURL, contentType, options);
|
|
}
|
|
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
|
}
|
|
catch (error) {
|
|
// pass
|
|
}
|
|
return cssText;
|
|
}
|
|
function filterPreferredFontFormat(str, { preferredFontFormat }) {
|
|
return !preferredFontFormat
|
|
? str
|
|
: str.replace(FONT_SRC_REGEX, (match) => {
|
|
// eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
|
|
if (!format) {
|
|
return '';
|
|
}
|
|
if (format === preferredFontFormat) {
|
|
return `src: ${src};`;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function shouldEmbed(url) {
|
|
return url.search(URL_REGEX) !== -1;
|
|
}
|
|
async function embedResources(cssText, baseUrl, options) {
|
|
if (!shouldEmbed(cssText)) {
|
|
return cssText;
|
|
}
|
|
const filteredCSSText = filterPreferredFontFormat(cssText, options);
|
|
const urls = parseURLs(filteredCSSText);
|
|
return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
|
|
}
|
|
//# sourceMappingURL=embed-resources.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/embed-webfonts.js":
|
|
/*!**********************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/embed-webfonts.js ***!
|
|
\**********************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ embedWebFonts: () => (/* binding */ embedWebFonts),
|
|
/* harmony export */ getWebFontCSS: () => (/* binding */ getWebFontCSS)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js");
|
|
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js");
|
|
/* harmony import */ var _embed_resources__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./embed-resources */ "../node_modules/html-to-image/es/embed-resources.js");
|
|
|
|
|
|
|
|
const cssFetchCache = {};
|
|
async function fetchCSS(url) {
|
|
let cache = cssFetchCache[url];
|
|
if (cache != null) {
|
|
return cache;
|
|
}
|
|
const res = await fetch(url);
|
|
const cssText = await res.text();
|
|
cache = { url, cssText };
|
|
cssFetchCache[url] = cache;
|
|
return cache;
|
|
}
|
|
async function embedFonts(data, options) {
|
|
let cssText = data.cssText;
|
|
const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
|
|
const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
|
|
const loadFonts = fontLocs.map(async (loc) => {
|
|
let url = loc.replace(regexUrl, '$1');
|
|
if (!url.startsWith('https://')) {
|
|
url = new URL(url, data.url).href;
|
|
}
|
|
return (0,_dataurl__WEBPACK_IMPORTED_MODULE_1__.fetchAsDataURL)(url, options.fetchRequestInit, ({ result }) => {
|
|
cssText = cssText.replace(loc, `url(${result})`);
|
|
return [loc, result];
|
|
});
|
|
});
|
|
return Promise.all(loadFonts).then(() => cssText);
|
|
}
|
|
function parseCSS(source) {
|
|
if (source == null) {
|
|
return [];
|
|
}
|
|
const result = [];
|
|
const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
|
|
// strip out comments
|
|
let cssText = source.replace(commentsRegex, '');
|
|
// eslint-disable-next-line prefer-regex-literals
|
|
const keyframesRegex = new RegExp('((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})', 'gi');
|
|
// eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
const matches = keyframesRegex.exec(cssText);
|
|
if (matches === null) {
|
|
break;
|
|
}
|
|
result.push(matches[0]);
|
|
}
|
|
cssText = cssText.replace(keyframesRegex, '');
|
|
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
|
|
// to match css & media queries together
|
|
const combinedCSSRegex = '((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]' +
|
|
'*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})';
|
|
// unified regex
|
|
const unifiedRegex = new RegExp(combinedCSSRegex, 'gi');
|
|
// eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
let matches = importRegex.exec(cssText);
|
|
if (matches === null) {
|
|
matches = unifiedRegex.exec(cssText);
|
|
if (matches === null) {
|
|
break;
|
|
}
|
|
else {
|
|
importRegex.lastIndex = unifiedRegex.lastIndex;
|
|
}
|
|
}
|
|
else {
|
|
unifiedRegex.lastIndex = importRegex.lastIndex;
|
|
}
|
|
result.push(matches[0]);
|
|
}
|
|
return result;
|
|
}
|
|
async function getCSSRules(styleSheets, options) {
|
|
const ret = [];
|
|
const deferreds = [];
|
|
// First loop inlines imports
|
|
styleSheets.forEach((sheet) => {
|
|
if ('cssRules' in sheet) {
|
|
try {
|
|
(0,_util__WEBPACK_IMPORTED_MODULE_0__.toArray)(sheet.cssRules || []).forEach((item, index) => {
|
|
if (item.type === CSSRule.IMPORT_RULE) {
|
|
let importIndex = index + 1;
|
|
const url = item.href;
|
|
const deferred = fetchCSS(url)
|
|
.then((metadata) => embedFonts(metadata, options))
|
|
.then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
try {
|
|
sheet.insertRule(rule, rule.startsWith('@import')
|
|
? (importIndex += 1)
|
|
: sheet.cssRules.length);
|
|
}
|
|
catch (error) {
|
|
console.error('Error inserting rule from remote css', {
|
|
rule,
|
|
error,
|
|
});
|
|
}
|
|
}))
|
|
.catch((e) => {
|
|
console.error('Error loading remote css', e.toString());
|
|
});
|
|
deferreds.push(deferred);
|
|
}
|
|
});
|
|
}
|
|
catch (e) {
|
|
const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
|
|
if (sheet.href != null) {
|
|
deferreds.push(fetchCSS(sheet.href)
|
|
.then((metadata) => embedFonts(metadata, options))
|
|
.then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
inline.insertRule(rule, inline.cssRules.length);
|
|
}))
|
|
.catch((err) => {
|
|
console.error('Error loading remote stylesheet', err);
|
|
}));
|
|
}
|
|
console.error('Error inlining remote css file', e);
|
|
}
|
|
}
|
|
});
|
|
return Promise.all(deferreds).then(() => {
|
|
// Second loop parses rules
|
|
styleSheets.forEach((sheet) => {
|
|
if ('cssRules' in sheet) {
|
|
try {
|
|
(0,_util__WEBPACK_IMPORTED_MODULE_0__.toArray)(sheet.cssRules || []).forEach((item) => {
|
|
ret.push(item);
|
|
});
|
|
}
|
|
catch (e) {
|
|
console.error(`Error while reading CSS rules from ${sheet.href}`, e);
|
|
}
|
|
}
|
|
});
|
|
return ret;
|
|
});
|
|
}
|
|
function getWebFontRules(cssRules) {
|
|
return cssRules
|
|
.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE)
|
|
.filter((rule) => (0,_embed_resources__WEBPACK_IMPORTED_MODULE_2__.shouldEmbed)(rule.style.getPropertyValue('src')));
|
|
}
|
|
async function parseWebFontRules(node, options) {
|
|
if (node.ownerDocument == null) {
|
|
throw new Error('Provided element is not within a Document');
|
|
}
|
|
const styleSheets = (0,_util__WEBPACK_IMPORTED_MODULE_0__.toArray)(node.ownerDocument.styleSheets);
|
|
const cssRules = await getCSSRules(styleSheets, options);
|
|
return getWebFontRules(cssRules);
|
|
}
|
|
function normalizeFontFamily(font) {
|
|
return font.trim().replace(/["']/g, '');
|
|
}
|
|
function getUsedFonts(node) {
|
|
const fonts = new Set();
|
|
function traverse(node) {
|
|
const fontFamily = node.style.fontFamily || getComputedStyle(node).fontFamily;
|
|
fontFamily.split(',').forEach((font) => {
|
|
fonts.add(normalizeFontFamily(font));
|
|
});
|
|
Array.from(node.children).forEach((child) => {
|
|
if (child instanceof HTMLElement) {
|
|
traverse(child);
|
|
}
|
|
});
|
|
}
|
|
traverse(node);
|
|
return fonts;
|
|
}
|
|
async function getWebFontCSS(node, options) {
|
|
const rules = await parseWebFontRules(node, options);
|
|
const usedFonts = getUsedFonts(node);
|
|
const cssTexts = await Promise.all(rules
|
|
.filter((rule) => usedFonts.has(normalizeFontFamily(rule.style.fontFamily)))
|
|
.map((rule) => {
|
|
const baseUrl = rule.parentStyleSheet
|
|
? rule.parentStyleSheet.href
|
|
: null;
|
|
return (0,_embed_resources__WEBPACK_IMPORTED_MODULE_2__.embedResources)(rule.cssText, baseUrl, options);
|
|
}));
|
|
return cssTexts.join('\n');
|
|
}
|
|
async function embedWebFonts(clonedNode, options) {
|
|
const cssText = options.fontEmbedCSS != null
|
|
? options.fontEmbedCSS
|
|
: options.skipFonts
|
|
? null
|
|
: await getWebFontCSS(clonedNode, options);
|
|
if (cssText) {
|
|
const styleNode = document.createElement('style');
|
|
const sytleContent = document.createTextNode(cssText);
|
|
styleNode.appendChild(sytleContent);
|
|
if (clonedNode.firstChild) {
|
|
clonedNode.insertBefore(styleNode, clonedNode.firstChild);
|
|
}
|
|
else {
|
|
clonedNode.appendChild(styleNode);
|
|
}
|
|
}
|
|
}
|
|
//# sourceMappingURL=embed-webfonts.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/index.js":
|
|
/*!*************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/index.js ***!
|
|
\*************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ getFontEmbedCSS: () => (/* binding */ getFontEmbedCSS),
|
|
/* harmony export */ toBlob: () => (/* binding */ toBlob),
|
|
/* harmony export */ toCanvas: () => (/* binding */ toCanvas),
|
|
/* harmony export */ toJpeg: () => (/* binding */ toJpeg),
|
|
/* harmony export */ toPixelData: () => (/* binding */ toPixelData),
|
|
/* harmony export */ toPng: () => (/* binding */ toPng),
|
|
/* harmony export */ toSvg: () => (/* binding */ toSvg)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _clone_node__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clone-node */ "../node_modules/html-to-image/es/clone-node.js");
|
|
/* harmony import */ var _embed_images__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./embed-images */ "../node_modules/html-to-image/es/embed-images.js");
|
|
/* harmony import */ var _apply_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./apply-style */ "../node_modules/html-to-image/es/apply-style.js");
|
|
/* harmony import */ var _embed_webfonts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./embed-webfonts */ "../node_modules/html-to-image/es/embed-webfonts.js");
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js");
|
|
|
|
|
|
|
|
|
|
|
|
async function toSvg(node, options = {}) {
|
|
const { width, height } = (0,_util__WEBPACK_IMPORTED_MODULE_4__.getImageSize)(node, options);
|
|
const clonedNode = (await (0,_clone_node__WEBPACK_IMPORTED_MODULE_0__.cloneNode)(node, options, true));
|
|
await (0,_embed_webfonts__WEBPACK_IMPORTED_MODULE_3__.embedWebFonts)(clonedNode, options);
|
|
await (0,_embed_images__WEBPACK_IMPORTED_MODULE_1__.embedImages)(clonedNode, options);
|
|
(0,_apply_style__WEBPACK_IMPORTED_MODULE_2__.applyStyle)(clonedNode, options);
|
|
const datauri = await (0,_util__WEBPACK_IMPORTED_MODULE_4__.nodeToDataURL)(clonedNode, width, height);
|
|
return datauri;
|
|
}
|
|
async function toCanvas(node, options = {}) {
|
|
const { width, height } = (0,_util__WEBPACK_IMPORTED_MODULE_4__.getImageSize)(node, options);
|
|
const svg = await toSvg(node, options);
|
|
const img = await (0,_util__WEBPACK_IMPORTED_MODULE_4__.createImage)(svg);
|
|
const canvas = document.createElement('canvas');
|
|
const context = canvas.getContext('2d');
|
|
const ratio = options.pixelRatio || (0,_util__WEBPACK_IMPORTED_MODULE_4__.getPixelRatio)();
|
|
const canvasWidth = options.canvasWidth || width;
|
|
const canvasHeight = options.canvasHeight || height;
|
|
canvas.width = canvasWidth * ratio;
|
|
canvas.height = canvasHeight * ratio;
|
|
if (!options.skipAutoScale) {
|
|
(0,_util__WEBPACK_IMPORTED_MODULE_4__.checkCanvasDimensions)(canvas);
|
|
}
|
|
canvas.style.width = `${canvasWidth}`;
|
|
canvas.style.height = `${canvasHeight}`;
|
|
if (options.backgroundColor) {
|
|
context.fillStyle = options.backgroundColor;
|
|
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
}
|
|
context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
return canvas;
|
|
}
|
|
async function toPixelData(node, options = {}) {
|
|
const { width, height } = (0,_util__WEBPACK_IMPORTED_MODULE_4__.getImageSize)(node, options);
|
|
const canvas = await toCanvas(node, options);
|
|
const ctx = canvas.getContext('2d');
|
|
return ctx.getImageData(0, 0, width, height).data;
|
|
}
|
|
async function toPng(node, options = {}) {
|
|
const canvas = await toCanvas(node, options);
|
|
return canvas.toDataURL();
|
|
}
|
|
async function toJpeg(node, options = {}) {
|
|
const canvas = await toCanvas(node, options);
|
|
return canvas.toDataURL('image/jpeg', options.quality || 1);
|
|
}
|
|
async function toBlob(node, options = {}) {
|
|
const canvas = await toCanvas(node, options);
|
|
const blob = await (0,_util__WEBPACK_IMPORTED_MODULE_4__.canvasToBlob)(canvas);
|
|
return blob;
|
|
}
|
|
async function getFontEmbedCSS(node, options = {}) {
|
|
return (0,_embed_webfonts__WEBPACK_IMPORTED_MODULE_3__.getWebFontCSS)(node, options);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/mimes.js":
|
|
/*!*************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/mimes.js ***!
|
|
\*************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ getMimeType: () => (/* binding */ getMimeType)
|
|
/* harmony export */ });
|
|
const WOFF = 'application/font-woff';
|
|
const JPEG = 'image/jpeg';
|
|
const mimes = {
|
|
woff: WOFF,
|
|
woff2: WOFF,
|
|
ttf: 'application/font-truetype',
|
|
eot: 'application/vnd.ms-fontobject',
|
|
png: 'image/png',
|
|
jpg: JPEG,
|
|
jpeg: JPEG,
|
|
gif: 'image/gif',
|
|
tiff: 'image/tiff',
|
|
svg: 'image/svg+xml',
|
|
webp: 'image/webp',
|
|
};
|
|
function getExtension(url) {
|
|
const match = /\.([^./]*?)$/g.exec(url);
|
|
return match ? match[1] : '';
|
|
}
|
|
function getMimeType(url) {
|
|
const extension = getExtension(url).toLowerCase();
|
|
return mimes[extension] || '';
|
|
}
|
|
//# sourceMappingURL=mimes.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../node_modules/html-to-image/es/util.js":
|
|
/*!************************************************!*\
|
|
!*** ../node_modules/html-to-image/es/util.js ***!
|
|
\************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ canvasToBlob: () => (/* binding */ canvasToBlob),
|
|
/* harmony export */ checkCanvasDimensions: () => (/* binding */ checkCanvasDimensions),
|
|
/* harmony export */ createImage: () => (/* binding */ createImage),
|
|
/* harmony export */ delay: () => (/* binding */ delay),
|
|
/* harmony export */ getImageSize: () => (/* binding */ getImageSize),
|
|
/* harmony export */ getPixelRatio: () => (/* binding */ getPixelRatio),
|
|
/* harmony export */ getStyleProperties: () => (/* binding */ getStyleProperties),
|
|
/* harmony export */ isInstanceOfElement: () => (/* binding */ isInstanceOfElement),
|
|
/* harmony export */ nodeToDataURL: () => (/* binding */ nodeToDataURL),
|
|
/* harmony export */ resolveUrl: () => (/* binding */ resolveUrl),
|
|
/* harmony export */ svgToDataURL: () => (/* binding */ svgToDataURL),
|
|
/* harmony export */ toArray: () => (/* binding */ toArray),
|
|
/* harmony export */ uuid: () => (/* binding */ uuid)
|
|
/* harmony export */ });
|
|
function resolveUrl(url, baseUrl) {
|
|
// url is absolute already
|
|
if (url.match(/^[a-z]+:\/\//i)) {
|
|
return url;
|
|
}
|
|
// url is absolute already, without protocol
|
|
if (url.match(/^\/\//)) {
|
|
return window.location.protocol + url;
|
|
}
|
|
// dataURI, mailto:, tel:, etc.
|
|
if (url.match(/^[a-z]+:/i)) {
|
|
return url;
|
|
}
|
|
const doc = document.implementation.createHTMLDocument();
|
|
const base = doc.createElement('base');
|
|
const a = doc.createElement('a');
|
|
doc.head.appendChild(base);
|
|
doc.body.appendChild(a);
|
|
if (baseUrl) {
|
|
base.href = baseUrl;
|
|
}
|
|
a.href = url;
|
|
return a.href;
|
|
}
|
|
const uuid = (() => {
|
|
// generate uuid for className of pseudo elements.
|
|
// We should not use GUIDs, otherwise pseudo elements sometimes cannot be captured.
|
|
let counter = 0;
|
|
// ref: http://stackoverflow.com/a/6248722/2519373
|
|
const random = () =>
|
|
// eslint-disable-next-line no-bitwise
|
|
`0000${((Math.random() * 36 ** 4) << 0).toString(36)}`.slice(-4);
|
|
return () => {
|
|
counter += 1;
|
|
return `u${random()}${counter}`;
|
|
};
|
|
})();
|
|
function delay(ms) {
|
|
return (args) => new Promise((resolve) => {
|
|
setTimeout(() => resolve(args), ms);
|
|
});
|
|
}
|
|
function toArray(arrayLike) {
|
|
const arr = [];
|
|
for (let i = 0, l = arrayLike.length; i < l; i++) {
|
|
arr.push(arrayLike[i]);
|
|
}
|
|
return arr;
|
|
}
|
|
let styleProps = null;
|
|
function getStyleProperties(options = {}) {
|
|
if (styleProps) {
|
|
return styleProps;
|
|
}
|
|
if (options.includeStyleProperties) {
|
|
styleProps = options.includeStyleProperties;
|
|
return styleProps;
|
|
}
|
|
styleProps = toArray(window.getComputedStyle(document.documentElement));
|
|
return styleProps;
|
|
}
|
|
function px(node, styleProperty) {
|
|
const win = node.ownerDocument.defaultView || window;
|
|
const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
|
|
return val ? parseFloat(val.replace('px', '')) : 0;
|
|
}
|
|
function getNodeWidth(node) {
|
|
const leftBorder = px(node, 'border-left-width');
|
|
const rightBorder = px(node, 'border-right-width');
|
|
return node.clientWidth + leftBorder + rightBorder;
|
|
}
|
|
function getNodeHeight(node) {
|
|
const topBorder = px(node, 'border-top-width');
|
|
const bottomBorder = px(node, 'border-bottom-width');
|
|
return node.clientHeight + topBorder + bottomBorder;
|
|
}
|
|
function getImageSize(targetNode, options = {}) {
|
|
const width = options.width || getNodeWidth(targetNode);
|
|
const height = options.height || getNodeHeight(targetNode);
|
|
return { width, height };
|
|
}
|
|
function getPixelRatio() {
|
|
let ratio;
|
|
let FINAL_PROCESS;
|
|
try {
|
|
FINAL_PROCESS = process;
|
|
}
|
|
catch (e) {
|
|
// pass
|
|
}
|
|
const val = FINAL_PROCESS && FINAL_PROCESS.env
|
|
? FINAL_PROCESS.env.devicePixelRatio
|
|
: null;
|
|
if (val) {
|
|
ratio = parseInt(val, 10);
|
|
if (Number.isNaN(ratio)) {
|
|
ratio = 1;
|
|
}
|
|
}
|
|
return ratio || window.devicePixelRatio || 1;
|
|
}
|
|
// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#maximum_canvas_size
|
|
const canvasDimensionLimit = 16384;
|
|
function checkCanvasDimensions(canvas) {
|
|
if (canvas.width > canvasDimensionLimit ||
|
|
canvas.height > canvasDimensionLimit) {
|
|
if (canvas.width > canvasDimensionLimit &&
|
|
canvas.height > canvasDimensionLimit) {
|
|
if (canvas.width > canvas.height) {
|
|
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
canvas.width = canvasDimensionLimit;
|
|
}
|
|
else {
|
|
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
canvas.height = canvasDimensionLimit;
|
|
}
|
|
}
|
|
else if (canvas.width > canvasDimensionLimit) {
|
|
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
canvas.width = canvasDimensionLimit;
|
|
}
|
|
else {
|
|
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
canvas.height = canvasDimensionLimit;
|
|
}
|
|
}
|
|
}
|
|
function canvasToBlob(canvas, options = {}) {
|
|
if (canvas.toBlob) {
|
|
return new Promise((resolve) => {
|
|
canvas.toBlob(resolve, options.type ? options.type : 'image/png', options.quality ? options.quality : 1);
|
|
});
|
|
}
|
|
return new Promise((resolve) => {
|
|
const binaryString = window.atob(canvas
|
|
.toDataURL(options.type ? options.type : undefined, options.quality ? options.quality : undefined)
|
|
.split(',')[1]);
|
|
const len = binaryString.length;
|
|
const binaryArray = new Uint8Array(len);
|
|
for (let i = 0; i < len; i += 1) {
|
|
binaryArray[i] = binaryString.charCodeAt(i);
|
|
}
|
|
resolve(new Blob([binaryArray], {
|
|
type: options.type ? options.type : 'image/png',
|
|
}));
|
|
});
|
|
}
|
|
function createImage(url) {
|
|
return new Promise((resolve, reject) => {
|
|
const img = new Image();
|
|
img.onload = () => {
|
|
img.decode().then(() => {
|
|
requestAnimationFrame(() => resolve(img));
|
|
});
|
|
};
|
|
img.onerror = reject;
|
|
img.crossOrigin = 'anonymous';
|
|
img.decoding = 'async';
|
|
img.src = url;
|
|
});
|
|
}
|
|
async function svgToDataURL(svg) {
|
|
return Promise.resolve()
|
|
.then(() => new XMLSerializer().serializeToString(svg))
|
|
.then(encodeURIComponent)
|
|
.then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
|
|
}
|
|
async function nodeToDataURL(node, width, height) {
|
|
const xmlns = 'http://www.w3.org/2000/svg';
|
|
const svg = document.createElementNS(xmlns, 'svg');
|
|
const foreignObject = document.createElementNS(xmlns, 'foreignObject');
|
|
svg.setAttribute('width', `${width}`);
|
|
svg.setAttribute('height', `${height}`);
|
|
svg.setAttribute('viewBox', `0 0 ${width} ${height}`);
|
|
foreignObject.setAttribute('width', '100%');
|
|
foreignObject.setAttribute('height', '100%');
|
|
foreignObject.setAttribute('x', '0');
|
|
foreignObject.setAttribute('y', '0');
|
|
foreignObject.setAttribute('externalResourcesRequired', 'true');
|
|
svg.appendChild(foreignObject);
|
|
foreignObject.appendChild(node);
|
|
return svgToDataURL(svg);
|
|
}
|
|
const isInstanceOfElement = (node, instance) => {
|
|
if (node instanceof instance)
|
|
return true;
|
|
const nodePrototype = Object.getPrototypeOf(node);
|
|
if (nodePrototype === null)
|
|
return false;
|
|
return (nodePrototype.constructor.name === instance.name ||
|
|
isInstanceOfElement(nodePrototype, instance));
|
|
};
|
|
//# sourceMappingURL=util.js.map
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
/************************************************************************/
|
|
/******/ // The module cache
|
|
/******/ var __webpack_module_cache__ = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/ // Check if module is in cache
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
/******/ if (cachedModule !== undefined) {
|
|
/******/ return cachedModule.exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
/******/ // no module.id needed
|
|
/******/ // no module.loaded needed
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/************************************************************************/
|
|
/******/ /* webpack/runtime/define property getters */
|
|
/******/ (() => {
|
|
/******/ // define getter functions for harmony exports
|
|
/******/ __webpack_require__.d = (exports, definition) => {
|
|
/******/ for(var key in definition) {
|
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
/******/ }
|
|
/******/ }
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
/******/ (() => {
|
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/make namespace object */
|
|
/******/ (() => {
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = (exports) => {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/************************************************************************/
|
|
var __webpack_exports__ = {};
|
|
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
|
|
(() => {
|
|
"use strict";
|
|
/*!****************************************************************!*\
|
|
!*** ../modules/cloud-library/assets/js/preview/screenshot.js ***!
|
|
\****************************************************************/
|
|
|
|
|
|
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js"));
|
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
|
|
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
|
|
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
|
|
var _htmlToImage = __webpack_require__(/*! html-to-image */ "../node_modules/html-to-image/es/index.js");
|
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
/* global ElementorScreenshotConfig */
|
|
var Screenshot = /*#__PURE__*/function (_elementorModules$Vie) {
|
|
function Screenshot() {
|
|
(0, _classCallCheck2.default)(this, Screenshot);
|
|
return _callSuper(this, Screenshot, arguments);
|
|
}
|
|
(0, _inherits2.default)(Screenshot, _elementorModules$Vie);
|
|
return (0, _createClass2.default)(Screenshot, [{
|
|
key: "getDefaultSettings",
|
|
value: function getDefaultSettings() {
|
|
return _objectSpread({
|
|
timeout: 15000,
|
|
// Wait until screenshot taken or fail in 15 secs.
|
|
render_timeout: 5000,
|
|
// Wait until all the element will be loaded or 5 sec and then take screenshot.
|
|
image_quality: 0.15,
|
|
// Image quality for WebP compression
|
|
image_placeholder: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
|
}, ElementorScreenshotConfig);
|
|
}
|
|
}, {
|
|
key: "getDefaultElements",
|
|
value: function getDefaultElements() {
|
|
var $elementor = jQuery(ElementorScreenshotConfig.selector);
|
|
return {
|
|
$elementor: $elementor
|
|
};
|
|
}
|
|
}, {
|
|
key: "onInit",
|
|
value: function onInit() {
|
|
var _this = this;
|
|
_superPropGet(Screenshot, "onInit", this, 3)([]);
|
|
|
|
/**
|
|
* Hold the timeout timer
|
|
*
|
|
* @type {number|null}
|
|
*/
|
|
this.timeoutTimer = setTimeout(function () {
|
|
_this.screenshotFailed(new Error('Screenshot timeout reached'));
|
|
}, this.getSettings('timeout'));
|
|
return this.captureScreenshot();
|
|
}
|
|
|
|
/**
|
|
* The main method for this class.
|
|
*/
|
|
}, {
|
|
key: "captureScreenshot",
|
|
value: function captureScreenshot() {
|
|
var _this2 = this;
|
|
return Promise.resolve().then(function () {
|
|
return _this2.createImage();
|
|
}).then(function (imageData) {
|
|
return _this2.save(imageData);
|
|
}).then(function (url) {
|
|
return _this2.screenshotSucceed(url);
|
|
}).catch(function (error) {
|
|
return _this2.screenshotFailed(error);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a WebP image using html-to-image library.
|
|
*
|
|
* @return {Promise<string>} URI containing image data
|
|
*/
|
|
}, {
|
|
key: "createImage",
|
|
value: (function () {
|
|
var _createImage = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
var _this3 = this;
|
|
var pageLoadedPromise, timeOutPromise, $elementorElement, bodyStyle, bodyBackgroundColor, canvas;
|
|
return _regenerator.default.wrap(function (_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
pageLoadedPromise = new Promise(function (resolve) {
|
|
window.addEventListener('load', function () {
|
|
return resolve();
|
|
});
|
|
});
|
|
timeOutPromise = new Promise(function (resolve) {
|
|
setTimeout(function () {
|
|
return resolve();
|
|
}, _this3.getSettings('render_timeout'));
|
|
});
|
|
_context.next = 1;
|
|
return Promise.race([pageLoadedPromise, timeOutPromise]);
|
|
case 1:
|
|
$elementorElement = this.elements.$elementor;
|
|
if (!$elementorElement.length) {
|
|
$elementorElement = jQuery(ElementorScreenshotConfig.selector);
|
|
}
|
|
if (!$elementorElement.length) {
|
|
$elementorElement = jQuery('body > div.elementor:not(.elementor-location-header):not(.elementor-location-footer)');
|
|
}
|
|
if ($elementorElement.length) {
|
|
_context.next = 2;
|
|
break;
|
|
}
|
|
throw new Error('Elementor container not found. Selector: ' + ElementorScreenshotConfig.selector);
|
|
case 2:
|
|
this.preprocessLazyImages($elementorElement);
|
|
bodyStyle = window.getComputedStyle(document.body);
|
|
bodyBackgroundColor = bodyStyle.backgroundColor;
|
|
_context.next = 3;
|
|
return (0, _htmlToImage.toCanvas)($elementorElement[0], {
|
|
quality: this.getSettings('image_quality'),
|
|
imagePlaceholder: this.getSettings('image_placeholder'),
|
|
backgroundColor: bodyBackgroundColor || null,
|
|
style: {
|
|
transform: 'scale(1)',
|
|
transformOrigin: 'top left'
|
|
}
|
|
});
|
|
case 3:
|
|
canvas = _context.sent;
|
|
return _context.abrupt("return", canvas.toDataURL('image/webp', this.getSettings('image_quality')));
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee, this);
|
|
}));
|
|
function createImage() {
|
|
return _createImage.apply(this, arguments);
|
|
}
|
|
return createImage;
|
|
}())
|
|
}, {
|
|
key: "preprocessLazyImages",
|
|
value: function preprocessLazyImages($element) {
|
|
var lazyImages = $element.find('img[data-src], img.swiper-lazy, img.lazy');
|
|
lazyImages.each(function (index, img) {
|
|
var $img = jQuery(img);
|
|
if ($img.attr('data-src')) {
|
|
$img.attr('src', $img.attr('data-src'));
|
|
$img.removeAttr('data-src');
|
|
}
|
|
$img.removeClass('swiper-lazy lazy swiper-slide-image');
|
|
$img.removeAttr('loading');
|
|
$img.removeAttr('data-srcset');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Send the image to the server.
|
|
*
|
|
* @param {string} dataUrl
|
|
* @return {Promise<string>} Screenshot URL
|
|
*/
|
|
}, {
|
|
key: "save",
|
|
value: function save(dataUrl) {
|
|
var _this$getSaveAction = this.getSaveAction(),
|
|
key = _this$getSaveAction.key,
|
|
action = _this$getSaveAction.action;
|
|
var data = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, key, this.getSettings(key)), "screenshot", dataUrl);
|
|
return new Promise(function (resolve, reject) {
|
|
if ('kit_id' === key) {
|
|
return resolve(data.screenshot);
|
|
}
|
|
elementorCommon.ajax.addRequest(action, {
|
|
data: data,
|
|
success: function success(url) {
|
|
return resolve(url);
|
|
},
|
|
error: function error() {
|
|
return reject();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Mark this post screenshot as failed.
|
|
* @param {Error} e
|
|
*/
|
|
}, {
|
|
key: "markAsFailed",
|
|
value: function markAsFailed(e) {
|
|
var _this4 = this;
|
|
return new Promise(function (resolve, reject) {
|
|
var templateId = _this4.getSettings('template_id');
|
|
var postId = _this4.getSettings('post_id');
|
|
var kitId = _this4.getSettings('kit_id');
|
|
if (kitId) {
|
|
resolve();
|
|
} else {
|
|
var route = templateId ? 'template_screenshot_failed' : 'screenshot_failed';
|
|
var data = templateId ? {
|
|
template_id: templateId,
|
|
error: e.message || e.toString()
|
|
} : {
|
|
post_id: postId
|
|
};
|
|
elementorCommon.ajax.addRequest(route, {
|
|
data: data,
|
|
success: function success() {
|
|
return resolve();
|
|
},
|
|
error: function error() {
|
|
return reject();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Notify that the screenshot has been succeed.
|
|
*
|
|
* @param {string} imageUrl
|
|
*/
|
|
}, {
|
|
key: "screenshotSucceed",
|
|
value: function screenshotSucceed(imageUrl) {
|
|
this.screenshotDone(true, imageUrl);
|
|
}
|
|
|
|
/**
|
|
* Notify that the screenshot has been failed.
|
|
*
|
|
* @param {Error} e
|
|
*/
|
|
}, {
|
|
key: "screenshotFailed",
|
|
value: function screenshotFailed(e) {
|
|
var _this5 = this;
|
|
this.markAsFailed(e).then(function () {
|
|
return _this5.screenshotDone(false);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Final method of the screenshot.
|
|
*
|
|
* @param {boolean} success
|
|
* @param {string} imageUrl
|
|
*/
|
|
}, {
|
|
key: "screenshotDone",
|
|
value: function screenshotDone(success) {
|
|
var imageUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
clearTimeout(this.timeoutTimer);
|
|
this.timeoutTimer = null;
|
|
var _this$getSaveAction2 = this.getSaveAction(),
|
|
message = _this$getSaveAction2.message,
|
|
key = _this$getSaveAction2.key;
|
|
|
|
// Send the message to the parent window and not to the top.
|
|
// e.g: The `Theme builder` is loaded into an iFrame so the message of the screenshot
|
|
// should be sent to the `Theme builder` window and not to the top window.
|
|
window.parent.postMessage({
|
|
name: message,
|
|
success: success,
|
|
id: this.getSettings(key),
|
|
imageUrl: imageUrl
|
|
}, '*');
|
|
}
|
|
}, {
|
|
key: "getSaveAction",
|
|
value: function getSaveAction() {
|
|
var config = this.getSettings();
|
|
if (config.kit_id) {
|
|
return {
|
|
message: 'kit-screenshot-done',
|
|
action: 'update_kit_preview',
|
|
key: 'kit_id'
|
|
};
|
|
}
|
|
if (config.template_id) {
|
|
return {
|
|
message: 'library/capture-screenshot-done',
|
|
action: 'save_template_screenshot',
|
|
key: 'template_id'
|
|
};
|
|
}
|
|
return {
|
|
message: 'capture-screenshot-done',
|
|
action: 'screenshot_save',
|
|
key: 'post_id'
|
|
};
|
|
}
|
|
}]);
|
|
}(elementorModules.ViewModule);
|
|
jQuery(function () {
|
|
new Screenshot();
|
|
});
|
|
})();
|
|
|
|
/******/ })()
|
|
;
|
|
//# sourceMappingURL=cloud-library-screenshot.js.map
|