| 1 |
/******/ (() => { // webpackBootstrap |
| 2 |
/******/ var __webpack_modules__ = ({ |
| 3 |
|
| 4 |
/***/ "../node_modules/@babel/runtime/helpers/OverloadYield.js": |
| 5 |
/*!***************************************************************!*\ |
| 6 |
!*** ../node_modules/@babel/runtime/helpers/OverloadYield.js ***! |
| 7 |
\***************************************************************/ |
| 8 |
/***/ ((module) => { |
| 9 |
|
| 10 |
function _OverloadYield(e, d) { |
| 11 |
this.v = e, this.k = d; |
| 12 |
} |
| 13 |
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 14 |
|
| 15 |
/***/ }), |
| 16 |
|
| 17 |
/***/ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js": |
| 18 |
/*!***********************************************************************!*\ |
| 19 |
!*** ../node_modules/@babel/runtime/helpers/assertThisInitialized.js ***! |
| 20 |
\***********************************************************************/ |
| 21 |
/***/ ((module) => { |
| 22 |
|
| 23 |
function _assertThisInitialized(e) { |
| 24 |
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
| 25 |
return e; |
| 26 |
} |
| 27 |
module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 28 |
|
| 29 |
/***/ }), |
| 30 |
|
| 31 |
/***/ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js": |
| 32 |
/*!******************************************************************!*\ |
| 33 |
!*** ../node_modules/@babel/runtime/helpers/asyncToGenerator.js ***! |
| 34 |
\******************************************************************/ |
| 35 |
/***/ ((module) => { |
| 36 |
|
| 37 |
function asyncGeneratorStep(n, t, e, r, o, a, c) { |
| 38 |
try { |
| 39 |
var i = n[a](c), |
| 40 |
u = i.value; |
| 41 |
} catch (n) { |
| 42 |
return void e(n); |
| 43 |
} |
| 44 |
i.done ? t(u) : Promise.resolve(u).then(r, o); |
| 45 |
} |
| 46 |
function _asyncToGenerator(n) { |
| 47 |
return function () { |
| 48 |
var t = this, |
| 49 |
e = arguments; |
| 50 |
return new Promise(function (r, o) { |
| 51 |
var a = n.apply(t, e); |
| 52 |
function _next(n) { |
| 53 |
asyncGeneratorStep(a, r, o, _next, _throw, "next", n); |
| 54 |
} |
| 55 |
function _throw(n) { |
| 56 |
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); |
| 57 |
} |
| 58 |
_next(void 0); |
| 59 |
}); |
| 60 |
}; |
| 61 |
} |
| 62 |
module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 63 |
|
| 64 |
/***/ }), |
| 65 |
|
| 66 |
/***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js": |
| 67 |
/*!****************************************************************!*\ |
| 68 |
!*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***! |
| 69 |
\****************************************************************/ |
| 70 |
/***/ ((module) => { |
| 71 |
|
| 72 |
function _classCallCheck(a, n) { |
| 73 |
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); |
| 74 |
} |
| 75 |
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 76 |
|
| 77 |
/***/ }), |
| 78 |
|
| 79 |
/***/ "../node_modules/@babel/runtime/helpers/createClass.js": |
| 80 |
/*!*************************************************************!*\ |
| 81 |
!*** ../node_modules/@babel/runtime/helpers/createClass.js ***! |
| 82 |
\*************************************************************/ |
| 83 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 84 |
|
| 85 |
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js"); |
| 86 |
function _defineProperties(e, r) { |
| 87 |
for (var t = 0; t < r.length; t++) { |
| 88 |
var o = r[t]; |
| 89 |
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); |
| 90 |
} |
| 91 |
} |
| 92 |
function _createClass(e, r, t) { |
| 93 |
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { |
| 94 |
writable: !1 |
| 95 |
}), e; |
| 96 |
} |
| 97 |
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 98 |
|
| 99 |
/***/ }), |
| 100 |
|
| 101 |
/***/ "../node_modules/@babel/runtime/helpers/defineProperty.js": |
| 102 |
/*!****************************************************************!*\ |
| 103 |
!*** ../node_modules/@babel/runtime/helpers/defineProperty.js ***! |
| 104 |
\****************************************************************/ |
| 105 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 106 |
|
| 107 |
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js"); |
| 108 |
function _defineProperty(e, r, t) { |
| 109 |
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { |
| 110 |
value: t, |
| 111 |
enumerable: !0, |
| 112 |
configurable: !0, |
| 113 |
writable: !0 |
| 114 |
}) : e[r] = t, e; |
| 115 |
} |
| 116 |
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 117 |
|
| 118 |
/***/ }), |
| 119 |
|
| 120 |
/***/ "../node_modules/@babel/runtime/helpers/get.js": |
| 121 |
/*!*****************************************************!*\ |
| 122 |
!*** ../node_modules/@babel/runtime/helpers/get.js ***! |
| 123 |
\*****************************************************/ |
| 124 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 125 |
|
| 126 |
var superPropBase = __webpack_require__(/*! ./superPropBase.js */ "../node_modules/@babel/runtime/helpers/superPropBase.js"); |
| 127 |
function _get() { |
| 128 |
return module.exports = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { |
| 129 |
var p = superPropBase(e, t); |
| 130 |
if (p) { |
| 131 |
var n = Object.getOwnPropertyDescriptor(p, t); |
| 132 |
return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; |
| 133 |
} |
| 134 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _get.apply(null, arguments); |
| 135 |
} |
| 136 |
module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 137 |
|
| 138 |
/***/ }), |
| 139 |
|
| 140 |
/***/ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js": |
| 141 |
/*!****************************************************************!*\ |
| 142 |
!*** ../node_modules/@babel/runtime/helpers/getPrototypeOf.js ***! |
| 143 |
\****************************************************************/ |
| 144 |
/***/ ((module) => { |
| 145 |
|
| 146 |
function _getPrototypeOf(t) { |
| 147 |
return module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { |
| 148 |
return t.__proto__ || Object.getPrototypeOf(t); |
| 149 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _getPrototypeOf(t); |
| 150 |
} |
| 151 |
module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 152 |
|
| 153 |
/***/ }), |
| 154 |
|
| 155 |
/***/ "../node_modules/@babel/runtime/helpers/inherits.js": |
| 156 |
/*!**********************************************************!*\ |
| 157 |
!*** ../node_modules/@babel/runtime/helpers/inherits.js ***! |
| 158 |
\**********************************************************/ |
| 159 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 160 |
|
| 161 |
var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js"); |
| 162 |
function _inherits(t, e) { |
| 163 |
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); |
| 164 |
t.prototype = Object.create(e && e.prototype, { |
| 165 |
constructor: { |
| 166 |
value: t, |
| 167 |
writable: !0, |
| 168 |
configurable: !0 |
| 169 |
} |
| 170 |
}), Object.defineProperty(t, "prototype", { |
| 171 |
writable: !1 |
| 172 |
}), e && setPrototypeOf(t, e); |
| 173 |
} |
| 174 |
module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 175 |
|
| 176 |
/***/ }), |
| 177 |
|
| 178 |
/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js": |
| 179 |
/*!***********************************************************************!*\ |
| 180 |
!*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! |
| 181 |
\***********************************************************************/ |
| 182 |
/***/ ((module) => { |
| 183 |
|
| 184 |
function _interopRequireDefault(e) { |
| 185 |
return e && e.__esModule ? e : { |
| 186 |
"default": e |
| 187 |
}; |
| 188 |
} |
| 189 |
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 190 |
|
| 191 |
/***/ }), |
| 192 |
|
| 193 |
/***/ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js": |
| 194 |
/*!***************************************************************************!*\ |
| 195 |
!*** ../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***! |
| 196 |
\***************************************************************************/ |
| 197 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 198 |
|
| 199 |
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); |
| 200 |
var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"); |
| 201 |
function _possibleConstructorReturn(t, e) { |
| 202 |
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; |
| 203 |
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); |
| 204 |
return assertThisInitialized(t); |
| 205 |
} |
| 206 |
module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 207 |
|
| 208 |
/***/ }), |
| 209 |
|
| 210 |
/***/ "../node_modules/@babel/runtime/helpers/regenerator.js": |
| 211 |
/*!*************************************************************!*\ |
| 212 |
!*** ../node_modules/@babel/runtime/helpers/regenerator.js ***! |
| 213 |
\*************************************************************/ |
| 214 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 215 |
|
| 216 |
var regeneratorDefine = __webpack_require__(/*! ./regeneratorDefine.js */ "../node_modules/@babel/runtime/helpers/regeneratorDefine.js"); |
| 217 |
function _regenerator() { |
| 218 |
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ |
| 219 |
var e, |
| 220 |
t, |
| 221 |
r = "function" == typeof Symbol ? Symbol : {}, |
| 222 |
n = r.iterator || "@@iterator", |
| 223 |
o = r.toStringTag || "@@toStringTag"; |
| 224 |
function i(r, n, o, i) { |
| 225 |
var c = n && n.prototype instanceof Generator ? n : Generator, |
| 226 |
u = Object.create(c.prototype); |
| 227 |
return regeneratorDefine(u, "_invoke", function (r, n, o) { |
| 228 |
var i, |
| 229 |
c, |
| 230 |
u, |
| 231 |
f = 0, |
| 232 |
p = o || [], |
| 233 |
y = !1, |
| 234 |
G = { |
| 235 |
p: 0, |
| 236 |
n: 0, |
| 237 |
v: e, |
| 238 |
a: d, |
| 239 |
f: d.bind(e, 4), |
| 240 |
d: function d(t, r) { |
| 241 |
return i = t, c = 0, u = e, G.n = r, a; |
| 242 |
} |
| 243 |
}; |
| 244 |
function d(r, n) { |
| 245 |
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { |
| 246 |
var o, |
| 247 |
i = p[t], |
| 248 |
d = G.p, |
| 249 |
l = i[2]; |
| 250 |
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)); |
| 251 |
} |
| 252 |
if (o || r > 1) return a; |
| 253 |
throw y = !0, n; |
| 254 |
} |
| 255 |
return function (o, p, l) { |
| 256 |
if (f > 1) throw TypeError("Generator is already running"); |
| 257 |
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { |
| 258 |
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); |
| 259 |
try { |
| 260 |
if (f = 2, i) { |
| 261 |
if (c || (o = "next"), t = i[o]) { |
| 262 |
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); |
| 263 |
if (!t.done) return t; |
| 264 |
u = t.value, c < 2 && (c = 0); |
| 265 |
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); |
| 266 |
i = e; |
| 267 |
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; |
| 268 |
} catch (t) { |
| 269 |
i = e, c = 1, u = t; |
| 270 |
} finally { |
| 271 |
f = 1; |
| 272 |
} |
| 273 |
} |
| 274 |
return { |
| 275 |
value: t, |
| 276 |
done: y |
| 277 |
}; |
| 278 |
}; |
| 279 |
}(r, o, i), !0), u; |
| 280 |
} |
| 281 |
var a = {}; |
| 282 |
function Generator() {} |
| 283 |
function GeneratorFunction() {} |
| 284 |
function GeneratorFunctionPrototype() {} |
| 285 |
t = Object.getPrototypeOf; |
| 286 |
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () { |
| 287 |
return this; |
| 288 |
}), t), |
| 289 |
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); |
| 290 |
function f(e) { |
| 291 |
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; |
| 292 |
} |
| 293 |
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 () { |
| 294 |
return this; |
| 295 |
}), regeneratorDefine(u, "toString", function () { |
| 296 |
return "[object Generator]"; |
| 297 |
}), (module.exports = _regenerator = function _regenerator() { |
| 298 |
return { |
| 299 |
w: i, |
| 300 |
m: f |
| 301 |
}; |
| 302 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports)(); |
| 303 |
} |
| 304 |
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 305 |
|
| 306 |
/***/ }), |
| 307 |
|
| 308 |
/***/ "../node_modules/@babel/runtime/helpers/regeneratorAsync.js": |
| 309 |
/*!******************************************************************!*\ |
| 310 |
!*** ../node_modules/@babel/runtime/helpers/regeneratorAsync.js ***! |
| 311 |
\******************************************************************/ |
| 312 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 313 |
|
| 314 |
var regeneratorAsyncGen = __webpack_require__(/*! ./regeneratorAsyncGen.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js"); |
| 315 |
function _regeneratorAsync(n, e, r, t, o) { |
| 316 |
var a = regeneratorAsyncGen(n, e, r, t, o); |
| 317 |
return a.next().then(function (n) { |
| 318 |
return n.done ? n.value : a.next(); |
| 319 |
}); |
| 320 |
} |
| 321 |
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 322 |
|
| 323 |
/***/ }), |
| 324 |
|
| 325 |
/***/ "../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js": |
| 326 |
/*!*********************************************************************!*\ |
| 327 |
!*** ../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js ***! |
| 328 |
\*********************************************************************/ |
| 329 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 330 |
|
| 331 |
var regenerator = __webpack_require__(/*! ./regenerator.js */ "../node_modules/@babel/runtime/helpers/regenerator.js"); |
| 332 |
var regeneratorAsyncIterator = __webpack_require__(/*! ./regeneratorAsyncIterator.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js"); |
| 333 |
function _regeneratorAsyncGen(r, e, t, o, n) { |
| 334 |
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise); |
| 335 |
} |
| 336 |
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 337 |
|
| 338 |
/***/ }), |
| 339 |
|
| 340 |
/***/ "../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js": |
| 341 |
/*!**************************************************************************!*\ |
| 342 |
!*** ../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js ***! |
| 343 |
\**************************************************************************/ |
| 344 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 345 |
|
| 346 |
var OverloadYield = __webpack_require__(/*! ./OverloadYield.js */ "../node_modules/@babel/runtime/helpers/OverloadYield.js"); |
| 347 |
var regeneratorDefine = __webpack_require__(/*! ./regeneratorDefine.js */ "../node_modules/@babel/runtime/helpers/regeneratorDefine.js"); |
| 348 |
function AsyncIterator(t, e) { |
| 349 |
function n(r, o, i, f) { |
| 350 |
try { |
| 351 |
var c = t[r](o), |
| 352 |
u = c.value; |
| 353 |
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) { |
| 354 |
n("next", t, i, f); |
| 355 |
}, function (t) { |
| 356 |
n("throw", t, i, f); |
| 357 |
}) : e.resolve(u).then(function (t) { |
| 358 |
c.value = t, i(c); |
| 359 |
}, function (t) { |
| 360 |
return n("throw", t, i, f); |
| 361 |
}); |
| 362 |
} catch (t) { |
| 363 |
f(t); |
| 364 |
} |
| 365 |
} |
| 366 |
var r; |
| 367 |
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () { |
| 368 |
return this; |
| 369 |
})), regeneratorDefine(this, "_invoke", function (t, o, i) { |
| 370 |
function f() { |
| 371 |
return new e(function (e, r) { |
| 372 |
n(t, i, e, r); |
| 373 |
}); |
| 374 |
} |
| 375 |
return r = r ? r.then(f, f) : f(); |
| 376 |
}, !0); |
| 377 |
} |
| 378 |
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 379 |
|
| 380 |
/***/ }), |
| 381 |
|
| 382 |
/***/ "../node_modules/@babel/runtime/helpers/regeneratorDefine.js": |
| 383 |
/*!*******************************************************************!*\ |
| 384 |
!*** ../node_modules/@babel/runtime/helpers/regeneratorDefine.js ***! |
| 385 |
\*******************************************************************/ |
| 386 |
/***/ ((module) => { |
| 387 |
|
| 388 |
function _regeneratorDefine(e, r, n, t) { |
| 389 |
var i = Object.defineProperty; |
| 390 |
try { |
| 391 |
i({}, "", {}); |
| 392 |
} catch (e) { |
| 393 |
i = 0; |
| 394 |
} |
| 395 |
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) { |
| 396 |
function o(r, n) { |
| 397 |
_regeneratorDefine(e, r, function (e) { |
| 398 |
return this._invoke(r, n, e); |
| 399 |
}); |
| 400 |
} |
| 401 |
r ? i ? i(e, r, { |
| 402 |
value: n, |
| 403 |
enumerable: !t, |
| 404 |
configurable: !t, |
| 405 |
writable: !t |
| 406 |
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); |
| 407 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t); |
| 408 |
} |
| 409 |
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 410 |
|
| 411 |
/***/ }), |
| 412 |
|
| 413 |
/***/ "../node_modules/@babel/runtime/helpers/regeneratorKeys.js": |
| 414 |
/*!*****************************************************************!*\ |
| 415 |
!*** ../node_modules/@babel/runtime/helpers/regeneratorKeys.js ***! |
| 416 |
\*****************************************************************/ |
| 417 |
/***/ ((module) => { |
| 418 |
|
| 419 |
function _regeneratorKeys(e) { |
| 420 |
var n = Object(e), |
| 421 |
r = []; |
| 422 |
for (var t in n) r.unshift(t); |
| 423 |
return function e() { |
| 424 |
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; |
| 425 |
return e.done = !0, e; |
| 426 |
}; |
| 427 |
} |
| 428 |
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 429 |
|
| 430 |
/***/ }), |
| 431 |
|
| 432 |
/***/ "../node_modules/@babel/runtime/helpers/regeneratorRuntime.js": |
| 433 |
/*!********************************************************************!*\ |
| 434 |
!*** ../node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***! |
| 435 |
\********************************************************************/ |
| 436 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 437 |
|
| 438 |
var OverloadYield = __webpack_require__(/*! ./OverloadYield.js */ "../node_modules/@babel/runtime/helpers/OverloadYield.js"); |
| 439 |
var regenerator = __webpack_require__(/*! ./regenerator.js */ "../node_modules/@babel/runtime/helpers/regenerator.js"); |
| 440 |
var regeneratorAsync = __webpack_require__(/*! ./regeneratorAsync.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsync.js"); |
| 441 |
var regeneratorAsyncGen = __webpack_require__(/*! ./regeneratorAsyncGen.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js"); |
| 442 |
var regeneratorAsyncIterator = __webpack_require__(/*! ./regeneratorAsyncIterator.js */ "../node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js"); |
| 443 |
var regeneratorKeys = __webpack_require__(/*! ./regeneratorKeys.js */ "../node_modules/@babel/runtime/helpers/regeneratorKeys.js"); |
| 444 |
var regeneratorValues = __webpack_require__(/*! ./regeneratorValues.js */ "../node_modules/@babel/runtime/helpers/regeneratorValues.js"); |
| 445 |
function _regeneratorRuntime() { |
| 446 |
"use strict"; |
| 447 |
|
| 448 |
var r = regenerator(), |
| 449 |
e = r.m(_regeneratorRuntime), |
| 450 |
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor; |
| 451 |
function n(r) { |
| 452 |
var e = "function" == typeof r && r.constructor; |
| 453 |
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); |
| 454 |
} |
| 455 |
var o = { |
| 456 |
"throw": 1, |
| 457 |
"return": 2, |
| 458 |
"break": 3, |
| 459 |
"continue": 3 |
| 460 |
}; |
| 461 |
function a(r) { |
| 462 |
var e, t; |
| 463 |
return function (n) { |
| 464 |
e || (e = { |
| 465 |
stop: function stop() { |
| 466 |
return t(n.a, 2); |
| 467 |
}, |
| 468 |
"catch": function _catch() { |
| 469 |
return n.v; |
| 470 |
}, |
| 471 |
abrupt: function abrupt(r, e) { |
| 472 |
return t(n.a, o[r], e); |
| 473 |
}, |
| 474 |
delegateYield: function delegateYield(r, o, a) { |
| 475 |
return e.resultName = o, t(n.d, regeneratorValues(r), a); |
| 476 |
}, |
| 477 |
finish: function finish(r) { |
| 478 |
return t(n.f, r); |
| 479 |
} |
| 480 |
}, t = function t(r, _t, o) { |
| 481 |
n.p = e.prev, n.n = e.next; |
| 482 |
try { |
| 483 |
return r(_t, o); |
| 484 |
} finally { |
| 485 |
e.next = n.n; |
| 486 |
} |
| 487 |
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; |
| 488 |
try { |
| 489 |
return r.call(this, e); |
| 490 |
} finally { |
| 491 |
n.p = e.prev, n.n = e.next; |
| 492 |
} |
| 493 |
}; |
| 494 |
} |
| 495 |
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() { |
| 496 |
return { |
| 497 |
wrap: function wrap(e, t, n, o) { |
| 498 |
return r.w(a(e), t, n, o && o.reverse()); |
| 499 |
}, |
| 500 |
isGeneratorFunction: n, |
| 501 |
mark: r.m, |
| 502 |
awrap: function awrap(r, e) { |
| 503 |
return new OverloadYield(r, e); |
| 504 |
}, |
| 505 |
AsyncIterator: regeneratorAsyncIterator, |
| 506 |
async: function async(r, e, t, o, u) { |
| 507 |
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u); |
| 508 |
}, |
| 509 |
keys: regeneratorKeys, |
| 510 |
values: regeneratorValues |
| 511 |
}; |
| 512 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports)(); |
| 513 |
} |
| 514 |
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 515 |
|
| 516 |
/***/ }), |
| 517 |
|
| 518 |
/***/ "../node_modules/@babel/runtime/helpers/regeneratorValues.js": |
| 519 |
/*!*******************************************************************!*\ |
| 520 |
!*** ../node_modules/@babel/runtime/helpers/regeneratorValues.js ***! |
| 521 |
\*******************************************************************/ |
| 522 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 523 |
|
| 524 |
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); |
| 525 |
function _regeneratorValues(e) { |
| 526 |
if (null != e) { |
| 527 |
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], |
| 528 |
r = 0; |
| 529 |
if (t) return t.call(e); |
| 530 |
if ("function" == typeof e.next) return e; |
| 531 |
if (!isNaN(e.length)) return { |
| 532 |
next: function next() { |
| 533 |
return e && r >= e.length && (e = void 0), { |
| 534 |
value: e && e[r++], |
| 535 |
done: !e |
| 536 |
}; |
| 537 |
} |
| 538 |
}; |
| 539 |
} |
| 540 |
throw new TypeError(_typeof(e) + " is not iterable"); |
| 541 |
} |
| 542 |
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 543 |
|
| 544 |
/***/ }), |
| 545 |
|
| 546 |
/***/ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js": |
| 547 |
/*!****************************************************************!*\ |
| 548 |
!*** ../node_modules/@babel/runtime/helpers/setPrototypeOf.js ***! |
| 549 |
\****************************************************************/ |
| 550 |
/***/ ((module) => { |
| 551 |
|
| 552 |
function _setPrototypeOf(t, e) { |
| 553 |
return module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { |
| 554 |
return t.__proto__ = e, t; |
| 555 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _setPrototypeOf(t, e); |
| 556 |
} |
| 557 |
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 558 |
|
| 559 |
/***/ }), |
| 560 |
|
| 561 |
/***/ "../node_modules/@babel/runtime/helpers/superPropBase.js": |
| 562 |
/*!***************************************************************!*\ |
| 563 |
!*** ../node_modules/@babel/runtime/helpers/superPropBase.js ***! |
| 564 |
\***************************************************************/ |
| 565 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 566 |
|
| 567 |
var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"); |
| 568 |
function _superPropBase(t, o) { |
| 569 |
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t));); |
| 570 |
return t; |
| 571 |
} |
| 572 |
module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 573 |
|
| 574 |
/***/ }), |
| 575 |
|
| 576 |
/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js": |
| 577 |
/*!*************************************************************!*\ |
| 578 |
!*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***! |
| 579 |
\*************************************************************/ |
| 580 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 581 |
|
| 582 |
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); |
| 583 |
function toPrimitive(t, r) { |
| 584 |
if ("object" != _typeof(t) || !t) return t; |
| 585 |
var e = t[Symbol.toPrimitive]; |
| 586 |
if (void 0 !== e) { |
| 587 |
var i = e.call(t, r || "default"); |
| 588 |
if ("object" != _typeof(i)) return i; |
| 589 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 590 |
} |
| 591 |
return ("string" === r ? String : Number)(t); |
| 592 |
} |
| 593 |
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 594 |
|
| 595 |
/***/ }), |
| 596 |
|
| 597 |
/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js": |
| 598 |
/*!***************************************************************!*\ |
| 599 |
!*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***! |
| 600 |
\***************************************************************/ |
| 601 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 602 |
|
| 603 |
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); |
| 604 |
var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js"); |
| 605 |
function toPropertyKey(t) { |
| 606 |
var i = toPrimitive(t, "string"); |
| 607 |
return "symbol" == _typeof(i) ? i : i + ""; |
| 608 |
} |
| 609 |
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 610 |
|
| 611 |
/***/ }), |
| 612 |
|
| 613 |
/***/ "../node_modules/@babel/runtime/helpers/typeof.js": |
| 614 |
/*!********************************************************!*\ |
| 615 |
!*** ../node_modules/@babel/runtime/helpers/typeof.js ***! |
| 616 |
\********************************************************/ |
| 617 |
/***/ ((module) => { |
| 618 |
|
| 619 |
function _typeof(o) { |
| 620 |
"@babel/helpers - typeof"; |
| 621 |
|
| 622 |
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { |
| 623 |
return typeof o; |
| 624 |
} : function (o) { |
| 625 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 626 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); |
| 627 |
} |
| 628 |
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 629 |
|
| 630 |
/***/ }), |
| 631 |
|
| 632 |
/***/ "../node_modules/@babel/runtime/regenerator/index.js": |
| 633 |
/*!***********************************************************!*\ |
| 634 |
!*** ../node_modules/@babel/runtime/regenerator/index.js ***! |
| 635 |
\***********************************************************/ |
| 636 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 637 |
|
| 638 |
// TODO(Babel 8): Remove this file. |
| 639 |
|
| 640 |
var runtime = __webpack_require__(/*! ../helpers/regeneratorRuntime */ "../node_modules/@babel/runtime/helpers/regeneratorRuntime.js")(); |
| 641 |
module.exports = runtime; |
| 642 |
|
| 643 |
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= |
| 644 |
try { |
| 645 |
regeneratorRuntime = runtime; |
| 646 |
} catch (accidentalStrictMode) { |
| 647 |
if (typeof globalThis === "object") { |
| 648 |
globalThis.regeneratorRuntime = runtime; |
| 649 |
} else { |
| 650 |
Function("r", "regeneratorRuntime = r")(runtime); |
| 651 |
} |
| 652 |
} |
| 653 |
|
| 654 |
|
| 655 |
/***/ }), |
| 656 |
|
| 657 |
/***/ "../node_modules/html-to-image/es/apply-style.js": |
| 658 |
/*!*******************************************************!*\ |
| 659 |
!*** ../node_modules/html-to-image/es/apply-style.js ***! |
| 660 |
\*******************************************************/ |
| 661 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 662 |
|
| 663 |
"use strict"; |
| 664 |
__webpack_require__.r(__webpack_exports__); |
| 665 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 666 |
/* harmony export */ applyStyle: () => (/* binding */ applyStyle) |
| 667 |
/* harmony export */ }); |
| 668 |
function applyStyle(node, options) { |
| 669 |
const { style } = node; |
| 670 |
if (options.backgroundColor) { |
| 671 |
style.backgroundColor = options.backgroundColor; |
| 672 |
} |
| 673 |
if (options.width) { |
| 674 |
style.width = `${options.width}px`; |
| 675 |
} |
| 676 |
if (options.height) { |
| 677 |
style.height = `${options.height}px`; |
| 678 |
} |
| 679 |
const manual = options.style; |
| 680 |
if (manual != null) { |
| 681 |
Object.keys(manual).forEach((key) => { |
| 682 |
style[key] = manual[key]; |
| 683 |
}); |
| 684 |
} |
| 685 |
return node; |
| 686 |
} |
| 687 |
//# sourceMappingURL=apply-style.js.map |
| 688 |
|
| 689 |
/***/ }), |
| 690 |
|
| 691 |
/***/ "../node_modules/html-to-image/es/clone-node.js": |
| 692 |
/*!******************************************************!*\ |
| 693 |
!*** ../node_modules/html-to-image/es/clone-node.js ***! |
| 694 |
\******************************************************/ |
| 695 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 696 |
|
| 697 |
"use strict"; |
| 698 |
__webpack_require__.r(__webpack_exports__); |
| 699 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 700 |
/* harmony export */ cloneNode: () => (/* binding */ cloneNode) |
| 701 |
/* harmony export */ }); |
| 702 |
/* harmony import */ var _clone_pseudos__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clone-pseudos */ "../node_modules/html-to-image/es/clone-pseudos.js"); |
| 703 |
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js"); |
| 704 |
/* harmony import */ var _mimes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mimes */ "../node_modules/html-to-image/es/mimes.js"); |
| 705 |
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js"); |
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
async function cloneCanvasElement(canvas) { |
| 711 |
const dataURL = canvas.toDataURL(); |
| 712 |
if (dataURL === 'data:,') { |
| 713 |
return canvas.cloneNode(false); |
| 714 |
} |
| 715 |
return (0,_util__WEBPACK_IMPORTED_MODULE_1__.createImage)(dataURL); |
| 716 |
} |
| 717 |
async function cloneVideoElement(video, options) { |
| 718 |
if (video.currentSrc) { |
| 719 |
const canvas = document.createElement('canvas'); |
| 720 |
const ctx = canvas.getContext('2d'); |
| 721 |
canvas.width = video.clientWidth; |
| 722 |
canvas.height = video.clientHeight; |
| 723 |
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height); |
| 724 |
const dataURL = canvas.toDataURL(); |
| 725 |
return (0,_util__WEBPACK_IMPORTED_MODULE_1__.createImage)(dataURL); |
| 726 |
} |
| 727 |
const poster = video.poster; |
| 728 |
const contentType = (0,_mimes__WEBPACK_IMPORTED_MODULE_2__.getMimeType)(poster); |
| 729 |
const dataURL = await (0,_dataurl__WEBPACK_IMPORTED_MODULE_3__.resourceToDataURL)(poster, contentType, options); |
| 730 |
return (0,_util__WEBPACK_IMPORTED_MODULE_1__.createImage)(dataURL); |
| 731 |
} |
| 732 |
async function cloneIFrameElement(iframe, options) { |
| 733 |
var _a; |
| 734 |
try { |
| 735 |
if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) { |
| 736 |
return (await cloneNode(iframe.contentDocument.body, options, true)); |
| 737 |
} |
| 738 |
} |
| 739 |
catch (_b) { |
| 740 |
// Failed to clone iframe |
| 741 |
} |
| 742 |
return iframe.cloneNode(false); |
| 743 |
} |
| 744 |
async function cloneSingleNode(node, options) { |
| 745 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(node, HTMLCanvasElement)) { |
| 746 |
return cloneCanvasElement(node); |
| 747 |
} |
| 748 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(node, HTMLVideoElement)) { |
| 749 |
return cloneVideoElement(node, options); |
| 750 |
} |
| 751 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(node, HTMLIFrameElement)) { |
| 752 |
return cloneIFrameElement(node, options); |
| 753 |
} |
| 754 |
return node.cloneNode(isSVGElement(node)); |
| 755 |
} |
| 756 |
const isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === 'SLOT'; |
| 757 |
const isSVGElement = (node) => node.tagName != null && node.tagName.toUpperCase() === 'SVG'; |
| 758 |
async function cloneChildren(nativeNode, clonedNode, options) { |
| 759 |
var _a, _b; |
| 760 |
if (isSVGElement(clonedNode)) { |
| 761 |
return clonedNode; |
| 762 |
} |
| 763 |
let children = []; |
| 764 |
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) { |
| 765 |
children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(nativeNode.assignedNodes()); |
| 766 |
} |
| 767 |
else if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLIFrameElement) && |
| 768 |
((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) { |
| 769 |
children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(nativeNode.contentDocument.body.childNodes); |
| 770 |
} |
| 771 |
else { |
| 772 |
children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes); |
| 773 |
} |
| 774 |
if (children.length === 0 || |
| 775 |
(0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLVideoElement)) { |
| 776 |
return clonedNode; |
| 777 |
} |
| 778 |
await children.reduce((deferred, child) => deferred |
| 779 |
.then(() => cloneNode(child, options)) |
| 780 |
.then((clonedChild) => { |
| 781 |
if (clonedChild) { |
| 782 |
clonedNode.appendChild(clonedChild); |
| 783 |
} |
| 784 |
}), Promise.resolve()); |
| 785 |
return clonedNode; |
| 786 |
} |
| 787 |
function cloneCSSStyle(nativeNode, clonedNode, options) { |
| 788 |
const targetStyle = clonedNode.style; |
| 789 |
if (!targetStyle) { |
| 790 |
return; |
| 791 |
} |
| 792 |
const sourceStyle = window.getComputedStyle(nativeNode); |
| 793 |
if (sourceStyle.cssText) { |
| 794 |
targetStyle.cssText = sourceStyle.cssText; |
| 795 |
targetStyle.transformOrigin = sourceStyle.transformOrigin; |
| 796 |
} |
| 797 |
else { |
| 798 |
(0,_util__WEBPACK_IMPORTED_MODULE_1__.getStyleProperties)(options).forEach((name) => { |
| 799 |
let value = sourceStyle.getPropertyValue(name); |
| 800 |
if (name === 'font-size' && value.endsWith('px')) { |
| 801 |
const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1; |
| 802 |
value = `${reducedFont}px`; |
| 803 |
} |
| 804 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLIFrameElement) && |
| 805 |
name === 'display' && |
| 806 |
value === 'inline') { |
| 807 |
value = 'block'; |
| 808 |
} |
| 809 |
if (name === 'd' && clonedNode.getAttribute('d')) { |
| 810 |
value = `path(${clonedNode.getAttribute('d')})`; |
| 811 |
} |
| 812 |
targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name)); |
| 813 |
}); |
| 814 |
} |
| 815 |
} |
| 816 |
function cloneInputValue(nativeNode, clonedNode) { |
| 817 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLTextAreaElement)) { |
| 818 |
clonedNode.innerHTML = nativeNode.value; |
| 819 |
} |
| 820 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLInputElement)) { |
| 821 |
clonedNode.setAttribute('value', nativeNode.value); |
| 822 |
} |
| 823 |
} |
| 824 |
function cloneSelectValue(nativeNode, clonedNode) { |
| 825 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(nativeNode, HTMLSelectElement)) { |
| 826 |
const clonedSelect = clonedNode; |
| 827 |
const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute('value')); |
| 828 |
if (selectedOption) { |
| 829 |
selectedOption.setAttribute('selected', ''); |
| 830 |
} |
| 831 |
} |
| 832 |
} |
| 833 |
function decorate(nativeNode, clonedNode, options) { |
| 834 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, Element)) { |
| 835 |
cloneCSSStyle(nativeNode, clonedNode, options); |
| 836 |
(0,_clone_pseudos__WEBPACK_IMPORTED_MODULE_0__.clonePseudoElements)(nativeNode, clonedNode, options); |
| 837 |
cloneInputValue(nativeNode, clonedNode); |
| 838 |
cloneSelectValue(nativeNode, clonedNode); |
| 839 |
} |
| 840 |
return clonedNode; |
| 841 |
} |
| 842 |
async function ensureSVGSymbols(clone, options) { |
| 843 |
const uses = clone.querySelectorAll ? clone.querySelectorAll('use') : []; |
| 844 |
if (uses.length === 0) { |
| 845 |
return clone; |
| 846 |
} |
| 847 |
const processedDefs = {}; |
| 848 |
for (let i = 0; i < uses.length; i++) { |
| 849 |
const use = uses[i]; |
| 850 |
const id = use.getAttribute('xlink:href'); |
| 851 |
if (id) { |
| 852 |
const exist = clone.querySelector(id); |
| 853 |
const definition = document.querySelector(id); |
| 854 |
if (!exist && definition && !processedDefs[id]) { |
| 855 |
// eslint-disable-next-line no-await-in-loop |
| 856 |
processedDefs[id] = (await cloneNode(definition, options, true)); |
| 857 |
} |
| 858 |
} |
| 859 |
} |
| 860 |
const nodes = Object.values(processedDefs); |
| 861 |
if (nodes.length) { |
| 862 |
const ns = 'http://www.w3.org/1999/xhtml'; |
| 863 |
const svg = document.createElementNS(ns, 'svg'); |
| 864 |
svg.setAttribute('xmlns', ns); |
| 865 |
svg.style.position = 'absolute'; |
| 866 |
svg.style.width = '0'; |
| 867 |
svg.style.height = '0'; |
| 868 |
svg.style.overflow = 'hidden'; |
| 869 |
svg.style.display = 'none'; |
| 870 |
const defs = document.createElementNS(ns, 'defs'); |
| 871 |
svg.appendChild(defs); |
| 872 |
for (let i = 0; i < nodes.length; i++) { |
| 873 |
defs.appendChild(nodes[i]); |
| 874 |
} |
| 875 |
clone.appendChild(svg); |
| 876 |
} |
| 877 |
return clone; |
| 878 |
} |
| 879 |
async function cloneNode(node, options, isRoot) { |
| 880 |
if (!isRoot && options.filter && !options.filter(node)) { |
| 881 |
return null; |
| 882 |
} |
| 883 |
return Promise.resolve(node) |
| 884 |
.then((clonedNode) => cloneSingleNode(clonedNode, options)) |
| 885 |
.then((clonedNode) => cloneChildren(node, clonedNode, options)) |
| 886 |
.then((clonedNode) => decorate(node, clonedNode, options)) |
| 887 |
.then((clonedNode) => ensureSVGSymbols(clonedNode, options)); |
| 888 |
} |
| 889 |
//# sourceMappingURL=clone-node.js.map |
| 890 |
|
| 891 |
/***/ }), |
| 892 |
|
| 893 |
/***/ "../node_modules/html-to-image/es/clone-pseudos.js": |
| 894 |
/*!*********************************************************!*\ |
| 895 |
!*** ../node_modules/html-to-image/es/clone-pseudos.js ***! |
| 896 |
\*********************************************************/ |
| 897 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 898 |
|
| 899 |
"use strict"; |
| 900 |
__webpack_require__.r(__webpack_exports__); |
| 901 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 902 |
/* harmony export */ clonePseudoElements: () => (/* binding */ clonePseudoElements) |
| 903 |
/* harmony export */ }); |
| 904 |
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js"); |
| 905 |
|
| 906 |
function formatCSSText(style) { |
| 907 |
const content = style.getPropertyValue('content'); |
| 908 |
return `${style.cssText} content: '${content.replace(/'|"/g, '')}';`; |
| 909 |
} |
| 910 |
function formatCSSProperties(style, options) { |
| 911 |
return (0,_util__WEBPACK_IMPORTED_MODULE_0__.getStyleProperties)(options) |
| 912 |
.map((name) => { |
| 913 |
const value = style.getPropertyValue(name); |
| 914 |
const priority = style.getPropertyPriority(name); |
| 915 |
return `${name}: ${value}${priority ? ' !important' : ''};`; |
| 916 |
}) |
| 917 |
.join(' '); |
| 918 |
} |
| 919 |
function getPseudoElementStyle(className, pseudo, style, options) { |
| 920 |
const selector = `.${className}:${pseudo}`; |
| 921 |
const cssText = style.cssText |
| 922 |
? formatCSSText(style) |
| 923 |
: formatCSSProperties(style, options); |
| 924 |
return document.createTextNode(`${selector}{${cssText}}`); |
| 925 |
} |
| 926 |
function clonePseudoElement(nativeNode, clonedNode, pseudo, options) { |
| 927 |
const style = window.getComputedStyle(nativeNode, pseudo); |
| 928 |
const content = style.getPropertyValue('content'); |
| 929 |
if (content === '' || content === 'none') { |
| 930 |
return; |
| 931 |
} |
| 932 |
const className = (0,_util__WEBPACK_IMPORTED_MODULE_0__.uuid)(); |
| 933 |
try { |
| 934 |
clonedNode.className = `${clonedNode.className} ${className}`; |
| 935 |
} |
| 936 |
catch (err) { |
| 937 |
return; |
| 938 |
} |
| 939 |
const styleElement = document.createElement('style'); |
| 940 |
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style, options)); |
| 941 |
clonedNode.appendChild(styleElement); |
| 942 |
} |
| 943 |
function clonePseudoElements(nativeNode, clonedNode, options) { |
| 944 |
clonePseudoElement(nativeNode, clonedNode, ':before', options); |
| 945 |
clonePseudoElement(nativeNode, clonedNode, ':after', options); |
| 946 |
} |
| 947 |
//# sourceMappingURL=clone-pseudos.js.map |
| 948 |
|
| 949 |
/***/ }), |
| 950 |
|
| 951 |
/***/ "../node_modules/html-to-image/es/dataurl.js": |
| 952 |
/*!***************************************************!*\ |
| 953 |
!*** ../node_modules/html-to-image/es/dataurl.js ***! |
| 954 |
\***************************************************/ |
| 955 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 956 |
|
| 957 |
"use strict"; |
| 958 |
__webpack_require__.r(__webpack_exports__); |
| 959 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 960 |
/* harmony export */ fetchAsDataURL: () => (/* binding */ fetchAsDataURL), |
| 961 |
/* harmony export */ isDataUrl: () => (/* binding */ isDataUrl), |
| 962 |
/* harmony export */ makeDataUrl: () => (/* binding */ makeDataUrl), |
| 963 |
/* harmony export */ resourceToDataURL: () => (/* binding */ resourceToDataURL) |
| 964 |
/* harmony export */ }); |
| 965 |
function getContentFromDataUrl(dataURL) { |
| 966 |
return dataURL.split(/,/)[1]; |
| 967 |
} |
| 968 |
function isDataUrl(url) { |
| 969 |
return url.search(/^(data:)/) !== -1; |
| 970 |
} |
| 971 |
function makeDataUrl(content, mimeType) { |
| 972 |
return `data:${mimeType};base64,${content}`; |
| 973 |
} |
| 974 |
async function fetchAsDataURL(url, init, process) { |
| 975 |
const res = await fetch(url, init); |
| 976 |
if (res.status === 404) { |
| 977 |
throw new Error(`Resource "${res.url}" not found`); |
| 978 |
} |
| 979 |
const blob = await res.blob(); |
| 980 |
return new Promise((resolve, reject) => { |
| 981 |
const reader = new FileReader(); |
| 982 |
reader.onerror = reject; |
| 983 |
reader.onloadend = () => { |
| 984 |
try { |
| 985 |
resolve(process({ res, result: reader.result })); |
| 986 |
} |
| 987 |
catch (error) { |
| 988 |
reject(error); |
| 989 |
} |
| 990 |
}; |
| 991 |
reader.readAsDataURL(blob); |
| 992 |
}); |
| 993 |
} |
| 994 |
const cache = {}; |
| 995 |
function getCacheKey(url, contentType, includeQueryParams) { |
| 996 |
let key = url.replace(/\?.*/, ''); |
| 997 |
if (includeQueryParams) { |
| 998 |
key = url; |
| 999 |
} |
| 1000 |
// font resource |
| 1001 |
if (/ttf|otf|eot|woff2?/i.test(key)) { |
| 1002 |
key = key.replace(/.*\//, ''); |
| 1003 |
} |
| 1004 |
return contentType ? `[${contentType}]${key}` : key; |
| 1005 |
} |
| 1006 |
async function resourceToDataURL(resourceUrl, contentType, options) { |
| 1007 |
const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams); |
| 1008 |
if (cache[cacheKey] != null) { |
| 1009 |
return cache[cacheKey]; |
| 1010 |
} |
| 1011 |
// ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache |
| 1012 |
if (options.cacheBust) { |
| 1013 |
// eslint-disable-next-line no-param-reassign |
| 1014 |
resourceUrl += (/\?/.test(resourceUrl) ? '&' : '?') + new Date().getTime(); |
| 1015 |
} |
| 1016 |
let dataURL; |
| 1017 |
try { |
| 1018 |
const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => { |
| 1019 |
if (!contentType) { |
| 1020 |
// eslint-disable-next-line no-param-reassign |
| 1021 |
contentType = res.headers.get('Content-Type') || ''; |
| 1022 |
} |
| 1023 |
return getContentFromDataUrl(result); |
| 1024 |
}); |
| 1025 |
dataURL = makeDataUrl(content, contentType); |
| 1026 |
} |
| 1027 |
catch (error) { |
| 1028 |
dataURL = options.imagePlaceholder || ''; |
| 1029 |
let msg = `Failed to fetch resource: ${resourceUrl}`; |
| 1030 |
if (error) { |
| 1031 |
msg = typeof error === 'string' ? error : error.message; |
| 1032 |
} |
| 1033 |
if (msg) { |
| 1034 |
console.warn(msg); |
| 1035 |
} |
| 1036 |
} |
| 1037 |
cache[cacheKey] = dataURL; |
| 1038 |
return dataURL; |
| 1039 |
} |
| 1040 |
//# sourceMappingURL=dataurl.js.map |
| 1041 |
|
| 1042 |
/***/ }), |
| 1043 |
|
| 1044 |
/***/ "../node_modules/html-to-image/es/embed-images.js": |
| 1045 |
/*!********************************************************!*\ |
| 1046 |
!*** ../node_modules/html-to-image/es/embed-images.js ***! |
| 1047 |
\********************************************************/ |
| 1048 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1049 |
|
| 1050 |
"use strict"; |
| 1051 |
__webpack_require__.r(__webpack_exports__); |
| 1052 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1053 |
/* harmony export */ embedImages: () => (/* binding */ embedImages) |
| 1054 |
/* harmony export */ }); |
| 1055 |
/* harmony import */ var _embed_resources__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./embed-resources */ "../node_modules/html-to-image/es/embed-resources.js"); |
| 1056 |
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js"); |
| 1057 |
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js"); |
| 1058 |
/* harmony import */ var _mimes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mimes */ "../node_modules/html-to-image/es/mimes.js"); |
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
async function embedProp(propName, node, options) { |
| 1064 |
var _a; |
| 1065 |
const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName); |
| 1066 |
if (propValue) { |
| 1067 |
const cssString = await (0,_embed_resources__WEBPACK_IMPORTED_MODULE_0__.embedResources)(propValue, null, options); |
| 1068 |
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName)); |
| 1069 |
return true; |
| 1070 |
} |
| 1071 |
return false; |
| 1072 |
} |
| 1073 |
async function embedBackground(clonedNode, options) { |
| 1074 |
; |
| 1075 |
(await embedProp('background', clonedNode, options)) || |
| 1076 |
(await embedProp('background-image', clonedNode, options)); |
| 1077 |
(await embedProp('mask', clonedNode, options)) || |
| 1078 |
(await embedProp('-webkit-mask', clonedNode, options)) || |
| 1079 |
(await embedProp('mask-image', clonedNode, options)) || |
| 1080 |
(await embedProp('-webkit-mask-image', clonedNode, options)); |
| 1081 |
} |
| 1082 |
async function embedImageNode(clonedNode, options) { |
| 1083 |
const isImageElement = (0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, HTMLImageElement); |
| 1084 |
if (!(isImageElement && !(0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.isDataUrl)(clonedNode.src)) && |
| 1085 |
!((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, SVGImageElement) && |
| 1086 |
!(0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.isDataUrl)(clonedNode.href.baseVal))) { |
| 1087 |
return; |
| 1088 |
} |
| 1089 |
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal; |
| 1090 |
const dataURL = await (0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.resourceToDataURL)(url, (0,_mimes__WEBPACK_IMPORTED_MODULE_3__.getMimeType)(url), options); |
| 1091 |
await new Promise((resolve, reject) => { |
| 1092 |
clonedNode.onload = resolve; |
| 1093 |
clonedNode.onerror = options.onImageErrorHandler |
| 1094 |
? (...attributes) => { |
| 1095 |
try { |
| 1096 |
resolve(options.onImageErrorHandler(...attributes)); |
| 1097 |
} |
| 1098 |
catch (error) { |
| 1099 |
reject(error); |
| 1100 |
} |
| 1101 |
} |
| 1102 |
: reject; |
| 1103 |
const image = clonedNode; |
| 1104 |
if (image.decode) { |
| 1105 |
image.decode = resolve; |
| 1106 |
} |
| 1107 |
if (image.loading === 'lazy') { |
| 1108 |
image.loading = 'eager'; |
| 1109 |
} |
| 1110 |
if (isImageElement) { |
| 1111 |
clonedNode.srcset = ''; |
| 1112 |
clonedNode.src = dataURL; |
| 1113 |
} |
| 1114 |
else { |
| 1115 |
clonedNode.href.baseVal = dataURL; |
| 1116 |
} |
| 1117 |
}); |
| 1118 |
} |
| 1119 |
async function embedChildren(clonedNode, options) { |
| 1120 |
const children = (0,_util__WEBPACK_IMPORTED_MODULE_1__.toArray)(clonedNode.childNodes); |
| 1121 |
const deferreds = children.map((child) => embedImages(child, options)); |
| 1122 |
await Promise.all(deferreds).then(() => clonedNode); |
| 1123 |
} |
| 1124 |
async function embedImages(clonedNode, options) { |
| 1125 |
if ((0,_util__WEBPACK_IMPORTED_MODULE_1__.isInstanceOfElement)(clonedNode, Element)) { |
| 1126 |
await embedBackground(clonedNode, options); |
| 1127 |
await embedImageNode(clonedNode, options); |
| 1128 |
await embedChildren(clonedNode, options); |
| 1129 |
} |
| 1130 |
} |
| 1131 |
//# sourceMappingURL=embed-images.js.map |
| 1132 |
|
| 1133 |
/***/ }), |
| 1134 |
|
| 1135 |
/***/ "../node_modules/html-to-image/es/embed-resources.js": |
| 1136 |
/*!***********************************************************!*\ |
| 1137 |
!*** ../node_modules/html-to-image/es/embed-resources.js ***! |
| 1138 |
\***********************************************************/ |
| 1139 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1140 |
|
| 1141 |
"use strict"; |
| 1142 |
__webpack_require__.r(__webpack_exports__); |
| 1143 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1144 |
/* harmony export */ embed: () => (/* binding */ embed), |
| 1145 |
/* harmony export */ embedResources: () => (/* binding */ embedResources), |
| 1146 |
/* harmony export */ parseURLs: () => (/* binding */ parseURLs), |
| 1147 |
/* harmony export */ shouldEmbed: () => (/* binding */ shouldEmbed) |
| 1148 |
/* harmony export */ }); |
| 1149 |
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js"); |
| 1150 |
/* harmony import */ var _mimes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mimes */ "../node_modules/html-to-image/es/mimes.js"); |
| 1151 |
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js"); |
| 1152 |
|
| 1153 |
|
| 1154 |
|
| 1155 |
const URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g; |
| 1156 |
const URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g; |
| 1157 |
const FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g; |
| 1158 |
function toRegex(url) { |
| 1159 |
// eslint-disable-next-line no-useless-escape |
| 1160 |
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1'); |
| 1161 |
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, 'g'); |
| 1162 |
} |
| 1163 |
function parseURLs(cssText) { |
| 1164 |
const urls = []; |
| 1165 |
cssText.replace(URL_REGEX, (raw, quotation, url) => { |
| 1166 |
urls.push(url); |
| 1167 |
return raw; |
| 1168 |
}); |
| 1169 |
return urls.filter((url) => !(0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.isDataUrl)(url)); |
| 1170 |
} |
| 1171 |
async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) { |
| 1172 |
try { |
| 1173 |
const resolvedURL = baseURL ? (0,_util__WEBPACK_IMPORTED_MODULE_0__.resolveUrl)(resourceURL, baseURL) : resourceURL; |
| 1174 |
const contentType = (0,_mimes__WEBPACK_IMPORTED_MODULE_1__.getMimeType)(resourceURL); |
| 1175 |
let dataURL; |
| 1176 |
if (getContentFromUrl) { |
| 1177 |
const content = await getContentFromUrl(resolvedURL); |
| 1178 |
dataURL = (0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.makeDataUrl)(content, contentType); |
| 1179 |
} |
| 1180 |
else { |
| 1181 |
dataURL = await (0,_dataurl__WEBPACK_IMPORTED_MODULE_2__.resourceToDataURL)(resolvedURL, contentType, options); |
| 1182 |
} |
| 1183 |
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`); |
| 1184 |
} |
| 1185 |
catch (error) { |
| 1186 |
// pass |
| 1187 |
} |
| 1188 |
return cssText; |
| 1189 |
} |
| 1190 |
function filterPreferredFontFormat(str, { preferredFontFormat }) { |
| 1191 |
return !preferredFontFormat |
| 1192 |
? str |
| 1193 |
: str.replace(FONT_SRC_REGEX, (match) => { |
| 1194 |
// eslint-disable-next-line no-constant-condition |
| 1195 |
while (true) { |
| 1196 |
const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || []; |
| 1197 |
if (!format) { |
| 1198 |
return ''; |
| 1199 |
} |
| 1200 |
if (format === preferredFontFormat) { |
| 1201 |
return `src: ${src};`; |
| 1202 |
} |
| 1203 |
} |
| 1204 |
}); |
| 1205 |
} |
| 1206 |
function shouldEmbed(url) { |
| 1207 |
return url.search(URL_REGEX) !== -1; |
| 1208 |
} |
| 1209 |
async function embedResources(cssText, baseUrl, options) { |
| 1210 |
if (!shouldEmbed(cssText)) { |
| 1211 |
return cssText; |
| 1212 |
} |
| 1213 |
const filteredCSSText = filterPreferredFontFormat(cssText, options); |
| 1214 |
const urls = parseURLs(filteredCSSText); |
| 1215 |
return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText)); |
| 1216 |
} |
| 1217 |
//# sourceMappingURL=embed-resources.js.map |
| 1218 |
|
| 1219 |
/***/ }), |
| 1220 |
|
| 1221 |
/***/ "../node_modules/html-to-image/es/embed-webfonts.js": |
| 1222 |
/*!**********************************************************!*\ |
| 1223 |
!*** ../node_modules/html-to-image/es/embed-webfonts.js ***! |
| 1224 |
\**********************************************************/ |
| 1225 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1226 |
|
| 1227 |
"use strict"; |
| 1228 |
__webpack_require__.r(__webpack_exports__); |
| 1229 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1230 |
/* harmony export */ embedWebFonts: () => (/* binding */ embedWebFonts), |
| 1231 |
/* harmony export */ getWebFontCSS: () => (/* binding */ getWebFontCSS) |
| 1232 |
/* harmony export */ }); |
| 1233 |
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js"); |
| 1234 |
/* harmony import */ var _dataurl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dataurl */ "../node_modules/html-to-image/es/dataurl.js"); |
| 1235 |
/* harmony import */ var _embed_resources__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./embed-resources */ "../node_modules/html-to-image/es/embed-resources.js"); |
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
const cssFetchCache = {}; |
| 1240 |
async function fetchCSS(url) { |
| 1241 |
let cache = cssFetchCache[url]; |
| 1242 |
if (cache != null) { |
| 1243 |
return cache; |
| 1244 |
} |
| 1245 |
const res = await fetch(url); |
| 1246 |
const cssText = await res.text(); |
| 1247 |
cache = { url, cssText }; |
| 1248 |
cssFetchCache[url] = cache; |
| 1249 |
return cache; |
| 1250 |
} |
| 1251 |
async function embedFonts(data, options) { |
| 1252 |
let cssText = data.cssText; |
| 1253 |
const regexUrl = /url\(["']?([^"')]+)["']?\)/g; |
| 1254 |
const fontLocs = cssText.match(/url\([^)]+\)/g) || []; |
| 1255 |
const loadFonts = fontLocs.map(async (loc) => { |
| 1256 |
let url = loc.replace(regexUrl, '$1'); |
| 1257 |
if (!url.startsWith('https://')) { |
| 1258 |
url = new URL(url, data.url).href; |
| 1259 |
} |
| 1260 |
return (0,_dataurl__WEBPACK_IMPORTED_MODULE_1__.fetchAsDataURL)(url, options.fetchRequestInit, ({ result }) => { |
| 1261 |
cssText = cssText.replace(loc, `url(${result})`); |
| 1262 |
return [loc, result]; |
| 1263 |
}); |
| 1264 |
}); |
| 1265 |
return Promise.all(loadFonts).then(() => cssText); |
| 1266 |
} |
| 1267 |
function parseCSS(source) { |
| 1268 |
if (source == null) { |
| 1269 |
return []; |
| 1270 |
} |
| 1271 |
const result = []; |
| 1272 |
const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi; |
| 1273 |
// strip out comments |
| 1274 |
let cssText = source.replace(commentsRegex, ''); |
| 1275 |
// eslint-disable-next-line prefer-regex-literals |
| 1276 |
const keyframesRegex = new RegExp('((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})', 'gi'); |
| 1277 |
// eslint-disable-next-line no-constant-condition |
| 1278 |
while (true) { |
| 1279 |
const matches = keyframesRegex.exec(cssText); |
| 1280 |
if (matches === null) { |
| 1281 |
break; |
| 1282 |
} |
| 1283 |
result.push(matches[0]); |
| 1284 |
} |
| 1285 |
cssText = cssText.replace(keyframesRegex, ''); |
| 1286 |
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi; |
| 1287 |
// to match css & media queries together |
| 1288 |
const combinedCSSRegex = '((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]' + |
| 1289 |
'*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})'; |
| 1290 |
// unified regex |
| 1291 |
const unifiedRegex = new RegExp(combinedCSSRegex, 'gi'); |
| 1292 |
// eslint-disable-next-line no-constant-condition |
| 1293 |
while (true) { |
| 1294 |
let matches = importRegex.exec(cssText); |
| 1295 |
if (matches === null) { |
| 1296 |
matches = unifiedRegex.exec(cssText); |
| 1297 |
if (matches === null) { |
| 1298 |
break; |
| 1299 |
} |
| 1300 |
else { |
| 1301 |
importRegex.lastIndex = unifiedRegex.lastIndex; |
| 1302 |
} |
| 1303 |
} |
| 1304 |
else { |
| 1305 |
unifiedRegex.lastIndex = importRegex.lastIndex; |
| 1306 |
} |
| 1307 |
result.push(matches[0]); |
| 1308 |
} |
| 1309 |
return result; |
| 1310 |
} |
| 1311 |
async function getCSSRules(styleSheets, options) { |
| 1312 |
const ret = []; |
| 1313 |
const deferreds = []; |
| 1314 |
// First loop inlines imports |
| 1315 |
styleSheets.forEach((sheet) => { |
| 1316 |
if ('cssRules' in sheet) { |
| 1317 |
try { |
| 1318 |
(0,_util__WEBPACK_IMPORTED_MODULE_0__.toArray)(sheet.cssRules || []).forEach((item, index) => { |
| 1319 |
if (item.type === CSSRule.IMPORT_RULE) { |
| 1320 |
let importIndex = index + 1; |
| 1321 |
const url = item.href; |
| 1322 |
const deferred = fetchCSS(url) |
| 1323 |
.then((metadata) => embedFonts(metadata, options)) |
| 1324 |
.then((cssText) => parseCSS(cssText).forEach((rule) => { |
| 1325 |
try { |
| 1326 |
sheet.insertRule(rule, rule.startsWith('@import') |
| 1327 |
? (importIndex += 1) |
| 1328 |
: sheet.cssRules.length); |
| 1329 |
} |
| 1330 |
catch (error) { |
| 1331 |
console.error('Error inserting rule from remote css', { |
| 1332 |
rule, |
| 1333 |
error, |
| 1334 |
}); |
| 1335 |
} |
| 1336 |
})) |
| 1337 |
.catch((e) => { |
| 1338 |
console.error('Error loading remote css', e.toString()); |
| 1339 |
}); |
| 1340 |
deferreds.push(deferred); |
| 1341 |
} |
| 1342 |
}); |
| 1343 |
} |
| 1344 |
catch (e) { |
| 1345 |
const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0]; |
| 1346 |
if (sheet.href != null) { |
| 1347 |
deferreds.push(fetchCSS(sheet.href) |
| 1348 |
.then((metadata) => embedFonts(metadata, options)) |
| 1349 |
.then((cssText) => parseCSS(cssText).forEach((rule) => { |
| 1350 |
inline.insertRule(rule, inline.cssRules.length); |
| 1351 |
})) |
| 1352 |
.catch((err) => { |
| 1353 |
console.error('Error loading remote stylesheet', err); |
| 1354 |
})); |
| 1355 |
} |
| 1356 |
console.error('Error inlining remote css file', e); |
| 1357 |
} |
| 1358 |
} |
| 1359 |
}); |
| 1360 |
return Promise.all(deferreds).then(() => { |
| 1361 |
// Second loop parses rules |
| 1362 |
styleSheets.forEach((sheet) => { |
| 1363 |
if ('cssRules' in sheet) { |
| 1364 |
try { |
| 1365 |
(0,_util__WEBPACK_IMPORTED_MODULE_0__.toArray)(sheet.cssRules || []).forEach((item) => { |
| 1366 |
ret.push(item); |
| 1367 |
}); |
| 1368 |
} |
| 1369 |
catch (e) { |
| 1370 |
console.error(`Error while reading CSS rules from ${sheet.href}`, e); |
| 1371 |
} |
| 1372 |
} |
| 1373 |
}); |
| 1374 |
return ret; |
| 1375 |
}); |
| 1376 |
} |
| 1377 |
function getWebFontRules(cssRules) { |
| 1378 |
return cssRules |
| 1379 |
.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE) |
| 1380 |
.filter((rule) => (0,_embed_resources__WEBPACK_IMPORTED_MODULE_2__.shouldEmbed)(rule.style.getPropertyValue('src'))); |
| 1381 |
} |
| 1382 |
async function parseWebFontRules(node, options) { |
| 1383 |
if (node.ownerDocument == null) { |
| 1384 |
throw new Error('Provided element is not within a Document'); |
| 1385 |
} |
| 1386 |
const styleSheets = (0,_util__WEBPACK_IMPORTED_MODULE_0__.toArray)(node.ownerDocument.styleSheets); |
| 1387 |
const cssRules = await getCSSRules(styleSheets, options); |
| 1388 |
return getWebFontRules(cssRules); |
| 1389 |
} |
| 1390 |
function normalizeFontFamily(font) { |
| 1391 |
return font.trim().replace(/["']/g, ''); |
| 1392 |
} |
| 1393 |
function getUsedFonts(node) { |
| 1394 |
const fonts = new Set(); |
| 1395 |
function traverse(node) { |
| 1396 |
const fontFamily = node.style.fontFamily || getComputedStyle(node).fontFamily; |
| 1397 |
fontFamily.split(',').forEach((font) => { |
| 1398 |
fonts.add(normalizeFontFamily(font)); |
| 1399 |
}); |
| 1400 |
Array.from(node.children).forEach((child) => { |
| 1401 |
if (child instanceof HTMLElement) { |
| 1402 |
traverse(child); |
| 1403 |
} |
| 1404 |
}); |
| 1405 |
} |
| 1406 |
traverse(node); |
| 1407 |
return fonts; |
| 1408 |
} |
| 1409 |
async function getWebFontCSS(node, options) { |
| 1410 |
const rules = await parseWebFontRules(node, options); |
| 1411 |
const usedFonts = getUsedFonts(node); |
| 1412 |
const cssTexts = await Promise.all(rules |
| 1413 |
.filter((rule) => usedFonts.has(normalizeFontFamily(rule.style.fontFamily))) |
| 1414 |
.map((rule) => { |
| 1415 |
const baseUrl = rule.parentStyleSheet |
| 1416 |
? rule.parentStyleSheet.href |
| 1417 |
: null; |
| 1418 |
return (0,_embed_resources__WEBPACK_IMPORTED_MODULE_2__.embedResources)(rule.cssText, baseUrl, options); |
| 1419 |
})); |
| 1420 |
return cssTexts.join('\n'); |
| 1421 |
} |
| 1422 |
async function embedWebFonts(clonedNode, options) { |
| 1423 |
const cssText = options.fontEmbedCSS != null |
| 1424 |
? options.fontEmbedCSS |
| 1425 |
: options.skipFonts |
| 1426 |
? null |
| 1427 |
: await getWebFontCSS(clonedNode, options); |
| 1428 |
if (cssText) { |
| 1429 |
const styleNode = document.createElement('style'); |
| 1430 |
const sytleContent = document.createTextNode(cssText); |
| 1431 |
styleNode.appendChild(sytleContent); |
| 1432 |
if (clonedNode.firstChild) { |
| 1433 |
clonedNode.insertBefore(styleNode, clonedNode.firstChild); |
| 1434 |
} |
| 1435 |
else { |
| 1436 |
clonedNode.appendChild(styleNode); |
| 1437 |
} |
| 1438 |
} |
| 1439 |
} |
| 1440 |
//# sourceMappingURL=embed-webfonts.js.map |
| 1441 |
|
| 1442 |
/***/ }), |
| 1443 |
|
| 1444 |
/***/ "../node_modules/html-to-image/es/index.js": |
| 1445 |
/*!*************************************************!*\ |
| 1446 |
!*** ../node_modules/html-to-image/es/index.js ***! |
| 1447 |
\*************************************************/ |
| 1448 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1449 |
|
| 1450 |
"use strict"; |
| 1451 |
__webpack_require__.r(__webpack_exports__); |
| 1452 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1453 |
/* harmony export */ getFontEmbedCSS: () => (/* binding */ getFontEmbedCSS), |
| 1454 |
/* harmony export */ toBlob: () => (/* binding */ toBlob), |
| 1455 |
/* harmony export */ toCanvas: () => (/* binding */ toCanvas), |
| 1456 |
/* harmony export */ toJpeg: () => (/* binding */ toJpeg), |
| 1457 |
/* harmony export */ toPixelData: () => (/* binding */ toPixelData), |
| 1458 |
/* harmony export */ toPng: () => (/* binding */ toPng), |
| 1459 |
/* harmony export */ toSvg: () => (/* binding */ toSvg) |
| 1460 |
/* harmony export */ }); |
| 1461 |
/* harmony import */ var _clone_node__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clone-node */ "../node_modules/html-to-image/es/clone-node.js"); |
| 1462 |
/* harmony import */ var _embed_images__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./embed-images */ "../node_modules/html-to-image/es/embed-images.js"); |
| 1463 |
/* harmony import */ var _apply_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./apply-style */ "../node_modules/html-to-image/es/apply-style.js"); |
| 1464 |
/* harmony import */ var _embed_webfonts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./embed-webfonts */ "../node_modules/html-to-image/es/embed-webfonts.js"); |
| 1465 |
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util */ "../node_modules/html-to-image/es/util.js"); |
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
async function toSvg(node, options = {}) { |
| 1472 |
const { width, height } = (0,_util__WEBPACK_IMPORTED_MODULE_4__.getImageSize)(node, options); |
| 1473 |
const clonedNode = (await (0,_clone_node__WEBPACK_IMPORTED_MODULE_0__.cloneNode)(node, options, true)); |
| 1474 |
await (0,_embed_webfonts__WEBPACK_IMPORTED_MODULE_3__.embedWebFonts)(clonedNode, options); |
| 1475 |
await (0,_embed_images__WEBPACK_IMPORTED_MODULE_1__.embedImages)(clonedNode, options); |
| 1476 |
(0,_apply_style__WEBPACK_IMPORTED_MODULE_2__.applyStyle)(clonedNode, options); |
| 1477 |
const datauri = await (0,_util__WEBPACK_IMPORTED_MODULE_4__.nodeToDataURL)(clonedNode, width, height); |
| 1478 |
return datauri; |
| 1479 |
} |
| 1480 |
async function toCanvas(node, options = {}) { |
| 1481 |
const { width, height } = (0,_util__WEBPACK_IMPORTED_MODULE_4__.getImageSize)(node, options); |
| 1482 |
const svg = await toSvg(node, options); |
| 1483 |
const img = await (0,_util__WEBPACK_IMPORTED_MODULE_4__.createImage)(svg); |
| 1484 |
const canvas = document.createElement('canvas'); |
| 1485 |
const context = canvas.getContext('2d'); |
| 1486 |
const ratio = options.pixelRatio || (0,_util__WEBPACK_IMPORTED_MODULE_4__.getPixelRatio)(); |
| 1487 |
const canvasWidth = options.canvasWidth || width; |
| 1488 |
const canvasHeight = options.canvasHeight || height; |
| 1489 |
canvas.width = canvasWidth * ratio; |
| 1490 |
canvas.height = canvasHeight * ratio; |
| 1491 |
if (!options.skipAutoScale) { |
| 1492 |
(0,_util__WEBPACK_IMPORTED_MODULE_4__.checkCanvasDimensions)(canvas); |
| 1493 |
} |
| 1494 |
canvas.style.width = `${canvasWidth}`; |
| 1495 |
canvas.style.height = `${canvasHeight}`; |
| 1496 |
if (options.backgroundColor) { |
| 1497 |
context.fillStyle = options.backgroundColor; |
| 1498 |
context.fillRect(0, 0, canvas.width, canvas.height); |
| 1499 |
} |
| 1500 |
context.drawImage(img, 0, 0, canvas.width, canvas.height); |
| 1501 |
return canvas; |
| 1502 |
} |
| 1503 |
async function toPixelData(node, options = {}) { |
| 1504 |
const { width, height } = (0,_util__WEBPACK_IMPORTED_MODULE_4__.getImageSize)(node, options); |
| 1505 |
const canvas = await toCanvas(node, options); |
| 1506 |
const ctx = canvas.getContext('2d'); |
| 1507 |
return ctx.getImageData(0, 0, width, height).data; |
| 1508 |
} |
| 1509 |
async function toPng(node, options = {}) { |
| 1510 |
const canvas = await toCanvas(node, options); |
| 1511 |
return canvas.toDataURL(); |
| 1512 |
} |
| 1513 |
async function toJpeg(node, options = {}) { |
| 1514 |
const canvas = await toCanvas(node, options); |
| 1515 |
return canvas.toDataURL('image/jpeg', options.quality || 1); |
| 1516 |
} |
| 1517 |
async function toBlob(node, options = {}) { |
| 1518 |
const canvas = await toCanvas(node, options); |
| 1519 |
const blob = await (0,_util__WEBPACK_IMPORTED_MODULE_4__.canvasToBlob)(canvas); |
| 1520 |
return blob; |
| 1521 |
} |
| 1522 |
async function getFontEmbedCSS(node, options = {}) { |
| 1523 |
return (0,_embed_webfonts__WEBPACK_IMPORTED_MODULE_3__.getWebFontCSS)(node, options); |
| 1524 |
} |
| 1525 |
//# sourceMappingURL=index.js.map |
| 1526 |
|
| 1527 |
/***/ }), |
| 1528 |
|
| 1529 |
/***/ "../node_modules/html-to-image/es/mimes.js": |
| 1530 |
/*!*************************************************!*\ |
| 1531 |
!*** ../node_modules/html-to-image/es/mimes.js ***! |
| 1532 |
\*************************************************/ |
| 1533 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1534 |
|
| 1535 |
"use strict"; |
| 1536 |
__webpack_require__.r(__webpack_exports__); |
| 1537 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1538 |
/* harmony export */ getMimeType: () => (/* binding */ getMimeType) |
| 1539 |
/* harmony export */ }); |
| 1540 |
const WOFF = 'application/font-woff'; |
| 1541 |
const JPEG = 'image/jpeg'; |
| 1542 |
const mimes = { |
| 1543 |
woff: WOFF, |
| 1544 |
woff2: WOFF, |
| 1545 |
ttf: 'application/font-truetype', |
| 1546 |
eot: 'application/vnd.ms-fontobject', |
| 1547 |
png: 'image/png', |
| 1548 |
jpg: JPEG, |
| 1549 |
jpeg: JPEG, |
| 1550 |
gif: 'image/gif', |
| 1551 |
tiff: 'image/tiff', |
| 1552 |
svg: 'image/svg+xml', |
| 1553 |
webp: 'image/webp', |
| 1554 |
}; |
| 1555 |
function getExtension(url) { |
| 1556 |
const match = /\.([^./]*?)$/g.exec(url); |
| 1557 |
return match ? match[1] : ''; |
| 1558 |
} |
| 1559 |
function getMimeType(url) { |
| 1560 |
const extension = getExtension(url).toLowerCase(); |
| 1561 |
return mimes[extension] || ''; |
| 1562 |
} |
| 1563 |
//# sourceMappingURL=mimes.js.map |
| 1564 |
|
| 1565 |
/***/ }), |
| 1566 |
|
| 1567 |
/***/ "../node_modules/html-to-image/es/util.js": |
| 1568 |
/*!************************************************!*\ |
| 1569 |
!*** ../node_modules/html-to-image/es/util.js ***! |
| 1570 |
\************************************************/ |
| 1571 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1572 |
|
| 1573 |
"use strict"; |
| 1574 |
__webpack_require__.r(__webpack_exports__); |
| 1575 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1576 |
/* harmony export */ canvasToBlob: () => (/* binding */ canvasToBlob), |
| 1577 |
/* harmony export */ checkCanvasDimensions: () => (/* binding */ checkCanvasDimensions), |
| 1578 |
/* harmony export */ createImage: () => (/* binding */ createImage), |
| 1579 |
/* harmony export */ delay: () => (/* binding */ delay), |
| 1580 |
/* harmony export */ getImageSize: () => (/* binding */ getImageSize), |
| 1581 |
/* harmony export */ getPixelRatio: () => (/* binding */ getPixelRatio), |
| 1582 |
/* harmony export */ getStyleProperties: () => (/* binding */ getStyleProperties), |
| 1583 |
/* harmony export */ isInstanceOfElement: () => (/* binding */ isInstanceOfElement), |
| 1584 |
/* harmony export */ nodeToDataURL: () => (/* binding */ nodeToDataURL), |
| 1585 |
/* harmony export */ resolveUrl: () => (/* binding */ resolveUrl), |
| 1586 |
/* harmony export */ svgToDataURL: () => (/* binding */ svgToDataURL), |
| 1587 |
/* harmony export */ toArray: () => (/* binding */ toArray), |
| 1588 |
/* harmony export */ uuid: () => (/* binding */ uuid) |
| 1589 |
/* harmony export */ }); |
| 1590 |
function resolveUrl(url, baseUrl) { |
| 1591 |
// url is absolute already |
| 1592 |
if (url.match(/^[a-z]+:\/\//i)) { |
| 1593 |
return url; |
| 1594 |
} |
| 1595 |
// url is absolute already, without protocol |
| 1596 |
if (url.match(/^\/\//)) { |
| 1597 |
return window.location.protocol + url; |
| 1598 |
} |
| 1599 |
// dataURI, mailto:, tel:, etc. |
| 1600 |
if (url.match(/^[a-z]+:/i)) { |
| 1601 |
return url; |
| 1602 |
} |
| 1603 |
const doc = document.implementation.createHTMLDocument(); |
| 1604 |
const base = doc.createElement('base'); |
| 1605 |
const a = doc.createElement('a'); |
| 1606 |
doc.head.appendChild(base); |
| 1607 |
doc.body.appendChild(a); |
| 1608 |
if (baseUrl) { |
| 1609 |
base.href = baseUrl; |
| 1610 |
} |
| 1611 |
a.href = url; |
| 1612 |
return a.href; |
| 1613 |
} |
| 1614 |
const uuid = (() => { |
| 1615 |
// generate uuid for className of pseudo elements. |
| 1616 |
// We should not use GUIDs, otherwise pseudo elements sometimes cannot be captured. |
| 1617 |
let counter = 0; |
| 1618 |
// ref: http://stackoverflow.com/a/6248722/2519373 |
| 1619 |
const random = () => |
| 1620 |
// eslint-disable-next-line no-bitwise |
| 1621 |
`0000${((Math.random() * 36 ** 4) << 0).toString(36)}`.slice(-4); |
| 1622 |
return () => { |
| 1623 |
counter += 1; |
| 1624 |
return `u${random()}${counter}`; |
| 1625 |
}; |
| 1626 |
})(); |
| 1627 |
function delay(ms) { |
| 1628 |
return (args) => new Promise((resolve) => { |
| 1629 |
setTimeout(() => resolve(args), ms); |
| 1630 |
}); |
| 1631 |
} |
| 1632 |
function toArray(arrayLike) { |
| 1633 |
const arr = []; |
| 1634 |
for (let i = 0, l = arrayLike.length; i < l; i++) { |
| 1635 |
arr.push(arrayLike[i]); |
| 1636 |
} |
| 1637 |
return arr; |
| 1638 |
} |
| 1639 |
let styleProps = null; |
| 1640 |
function getStyleProperties(options = {}) { |
| 1641 |
if (styleProps) { |
| 1642 |
return styleProps; |
| 1643 |
} |
| 1644 |
if (options.includeStyleProperties) { |
| 1645 |
styleProps = options.includeStyleProperties; |
| 1646 |
return styleProps; |
| 1647 |
} |
| 1648 |
styleProps = toArray(window.getComputedStyle(document.documentElement)); |
| 1649 |
return styleProps; |
| 1650 |
} |
| 1651 |
function px(node, styleProperty) { |
| 1652 |
const win = node.ownerDocument.defaultView || window; |
| 1653 |
const val = win.getComputedStyle(node).getPropertyValue(styleProperty); |
| 1654 |
return val ? parseFloat(val.replace('px', '')) : 0; |
| 1655 |
} |
| 1656 |
function getNodeWidth(node) { |
| 1657 |
const leftBorder = px(node, 'border-left-width'); |
| 1658 |
const rightBorder = px(node, 'border-right-width'); |
| 1659 |
return node.clientWidth + leftBorder + rightBorder; |
| 1660 |
} |
| 1661 |
function getNodeHeight(node) { |
| 1662 |
const topBorder = px(node, 'border-top-width'); |
| 1663 |
const bottomBorder = px(node, 'border-bottom-width'); |
| 1664 |
return node.clientHeight + topBorder + bottomBorder; |
| 1665 |
} |
| 1666 |
function getImageSize(targetNode, options = {}) { |
| 1667 |
const width = options.width || getNodeWidth(targetNode); |
| 1668 |
const height = options.height || getNodeHeight(targetNode); |
| 1669 |
return { width, height }; |
| 1670 |
} |
| 1671 |
function getPixelRatio() { |
| 1672 |
let ratio; |
| 1673 |
let FINAL_PROCESS; |
| 1674 |
try { |
| 1675 |
FINAL_PROCESS = process; |
| 1676 |
} |
| 1677 |
catch (e) { |
| 1678 |
// pass |
| 1679 |
} |
| 1680 |
const val = FINAL_PROCESS && FINAL_PROCESS.env |
| 1681 |
? FINAL_PROCESS.env.devicePixelRatio |
| 1682 |
: null; |
| 1683 |
if (val) { |
| 1684 |
ratio = parseInt(val, 10); |
| 1685 |
if (Number.isNaN(ratio)) { |
| 1686 |
ratio = 1; |
| 1687 |
} |
| 1688 |
} |
| 1689 |
return ratio || window.devicePixelRatio || 1; |
| 1690 |
} |
| 1691 |
// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#maximum_canvas_size |
| 1692 |
const canvasDimensionLimit = 16384; |
| 1693 |
function checkCanvasDimensions(canvas) { |
| 1694 |
if (canvas.width > canvasDimensionLimit || |
| 1695 |
canvas.height > canvasDimensionLimit) { |
| 1696 |
if (canvas.width > canvasDimensionLimit && |
| 1697 |
canvas.height > canvasDimensionLimit) { |
| 1698 |
if (canvas.width > canvas.height) { |
| 1699 |
canvas.height *= canvasDimensionLimit / canvas.width; |
| 1700 |
canvas.width = canvasDimensionLimit; |
| 1701 |
} |
| 1702 |
else { |
| 1703 |
canvas.width *= canvasDimensionLimit / canvas.height; |
| 1704 |
canvas.height = canvasDimensionLimit; |
| 1705 |
} |
| 1706 |
} |
| 1707 |
else if (canvas.width > canvasDimensionLimit) { |
| 1708 |
canvas.height *= canvasDimensionLimit / canvas.width; |
| 1709 |
canvas.width = canvasDimensionLimit; |
| 1710 |
} |
| 1711 |
else { |
| 1712 |
canvas.width *= canvasDimensionLimit / canvas.height; |
| 1713 |
canvas.height = canvasDimensionLimit; |
| 1714 |
} |
| 1715 |
} |
| 1716 |
} |
| 1717 |
function canvasToBlob(canvas, options = {}) { |
| 1718 |
if (canvas.toBlob) { |
| 1719 |
return new Promise((resolve) => { |
| 1720 |
canvas.toBlob(resolve, options.type ? options.type : 'image/png', options.quality ? options.quality : 1); |
| 1721 |
}); |
| 1722 |
} |
| 1723 |
return new Promise((resolve) => { |
| 1724 |
const binaryString = window.atob(canvas |
| 1725 |
.toDataURL(options.type ? options.type : undefined, options.quality ? options.quality : undefined) |
| 1726 |
.split(',')[1]); |
| 1727 |
const len = binaryString.length; |
| 1728 |
const binaryArray = new Uint8Array(len); |
| 1729 |
for (let i = 0; i < len; i += 1) { |
| 1730 |
binaryArray[i] = binaryString.charCodeAt(i); |
| 1731 |
} |
| 1732 |
resolve(new Blob([binaryArray], { |
| 1733 |
type: options.type ? options.type : 'image/png', |
| 1734 |
})); |
| 1735 |
}); |
| 1736 |
} |
| 1737 |
function createImage(url) { |
| 1738 |
return new Promise((resolve, reject) => { |
| 1739 |
const img = new Image(); |
| 1740 |
img.onload = () => { |
| 1741 |
img.decode().then(() => { |
| 1742 |
requestAnimationFrame(() => resolve(img)); |
| 1743 |
}); |
| 1744 |
}; |
| 1745 |
img.onerror = reject; |
| 1746 |
img.crossOrigin = 'anonymous'; |
| 1747 |
img.decoding = 'async'; |
| 1748 |
img.src = url; |
| 1749 |
}); |
| 1750 |
} |
| 1751 |
async function svgToDataURL(svg) { |
| 1752 |
return Promise.resolve() |
| 1753 |
.then(() => new XMLSerializer().serializeToString(svg)) |
| 1754 |
.then(encodeURIComponent) |
| 1755 |
.then((html) => `data:image/svg+xml;charset=utf-8,${html}`); |
| 1756 |
} |
| 1757 |
async function nodeToDataURL(node, width, height) { |
| 1758 |
const xmlns = 'http://www.w3.org/2000/svg'; |
| 1759 |
const svg = document.createElementNS(xmlns, 'svg'); |
| 1760 |
const foreignObject = document.createElementNS(xmlns, 'foreignObject'); |
| 1761 |
svg.setAttribute('width', `${width}`); |
| 1762 |
svg.setAttribute('height', `${height}`); |
| 1763 |
svg.setAttribute('viewBox', `0 0 ${width} ${height}`); |
| 1764 |
foreignObject.setAttribute('width', '100%'); |
| 1765 |
foreignObject.setAttribute('height', '100%'); |
| 1766 |
foreignObject.setAttribute('x', '0'); |
| 1767 |
foreignObject.setAttribute('y', '0'); |
| 1768 |
foreignObject.setAttribute('externalResourcesRequired', 'true'); |
| 1769 |
svg.appendChild(foreignObject); |
| 1770 |
foreignObject.appendChild(node); |
| 1771 |
return svgToDataURL(svg); |
| 1772 |
} |
| 1773 |
const isInstanceOfElement = (node, instance) => { |
| 1774 |
if (node instanceof instance) |
| 1775 |
return true; |
| 1776 |
const nodePrototype = Object.getPrototypeOf(node); |
| 1777 |
if (nodePrototype === null) |
| 1778 |
return false; |
| 1779 |
return (nodePrototype.constructor.name === instance.name || |
| 1780 |
isInstanceOfElement(nodePrototype, instance)); |
| 1781 |
}; |
| 1782 |
//# sourceMappingURL=util.js.map |
| 1783 |
|
| 1784 |
/***/ }) |
| 1785 |
|
| 1786 |
/******/ }); |
| 1787 |
/************************************************************************/ |
| 1788 |
/******/ // The module cache |
| 1789 |
/******/ var __webpack_module_cache__ = {}; |
| 1790 |
/******/ |
| 1791 |
/******/ // The require function |
| 1792 |
/******/ function __webpack_require__(moduleId) { |
| 1793 |
/******/ // Check if module is in cache |
| 1794 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 1795 |
/******/ if (cachedModule !== undefined) { |
| 1796 |
/******/ return cachedModule.exports; |
| 1797 |
/******/ } |
| 1798 |
/******/ // Create a new module (and put it into the cache) |
| 1799 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 1800 |
/******/ // no module.id needed |
| 1801 |
/******/ // no module.loaded needed |
| 1802 |
/******/ exports: {} |
| 1803 |
/******/ }; |
| 1804 |
/******/ |
| 1805 |
/******/ // Execute the module function |
| 1806 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 1807 |
/******/ |
| 1808 |
/******/ // Return the exports of the module |
| 1809 |
/******/ return module.exports; |
| 1810 |
/******/ } |
| 1811 |
/******/ |
| 1812 |
/************************************************************************/ |
| 1813 |
/******/ /* webpack/runtime/define property getters */ |
| 1814 |
/******/ (() => { |
| 1815 |
/******/ // define getter functions for harmony exports |
| 1816 |
/******/ __webpack_require__.d = (exports, definition) => { |
| 1817 |
/******/ for(var key in definition) { |
| 1818 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 1819 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 1820 |
/******/ } |
| 1821 |
/******/ } |
| 1822 |
/******/ }; |
| 1823 |
/******/ })(); |
| 1824 |
/******/ |
| 1825 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 1826 |
/******/ (() => { |
| 1827 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 1828 |
/******/ })(); |
| 1829 |
/******/ |
| 1830 |
/******/ /* webpack/runtime/make namespace object */ |
| 1831 |
/******/ (() => { |
| 1832 |
/******/ // define __esModule on exports |
| 1833 |
/******/ __webpack_require__.r = (exports) => { |
| 1834 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 1835 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 1836 |
/******/ } |
| 1837 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 1838 |
/******/ }; |
| 1839 |
/******/ })(); |
| 1840 |
/******/ |
| 1841 |
/************************************************************************/ |
| 1842 |
var __webpack_exports__ = {}; |
| 1843 |
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 1844 |
(() => { |
| 1845 |
"use strict"; |
| 1846 |
/*!****************************************************************!*\ |
| 1847 |
!*** ../modules/cloud-library/assets/js/preview/screenshot.js ***! |
| 1848 |
\****************************************************************/ |
| 1849 |
|
| 1850 |
|
| 1851 |
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 1852 |
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js")); |
| 1853 |
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js")); |
| 1854 |
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js")); |
| 1855 |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js")); |
| 1856 |
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js")); |
| 1857 |
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); |
| 1858 |
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js")); |
| 1859 |
var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js")); |
| 1860 |
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js")); |
| 1861 |
var _htmlToImage = __webpack_require__(/*! html-to-image */ "../node_modules/html-to-image/es/index.js"); |
| 1862 |
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; } |
| 1863 |
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; } |
| 1864 |
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)); } |
| 1865 |
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } |
| 1866 |
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; } |
| 1867 |
/* global ElementorScreenshotConfig */ |
| 1868 |
var Screenshot = /*#__PURE__*/function (_elementorModules$Vie) { |
| 1869 |
function Screenshot() { |
| 1870 |
(0, _classCallCheck2.default)(this, Screenshot); |
| 1871 |
return _callSuper(this, Screenshot, arguments); |
| 1872 |
} |
| 1873 |
(0, _inherits2.default)(Screenshot, _elementorModules$Vie); |
| 1874 |
return (0, _createClass2.default)(Screenshot, [{ |
| 1875 |
key: "getDefaultSettings", |
| 1876 |
value: function getDefaultSettings() { |
| 1877 |
return _objectSpread({ |
| 1878 |
timeout: 15000, |
| 1879 |
// Wait until screenshot taken or fail in 15 secs. |
| 1880 |
render_timeout: 5000, |
| 1881 |
// Wait until all the element will be loaded or 5 sec and then take screenshot. |
| 1882 |
image_quality: 0.15, |
| 1883 |
// Image quality for WebP compression |
| 1884 |
image_placeholder: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=' |
| 1885 |
}, ElementorScreenshotConfig); |
| 1886 |
} |
| 1887 |
}, { |
| 1888 |
key: "getDefaultElements", |
| 1889 |
value: function getDefaultElements() { |
| 1890 |
var $elementor = jQuery(ElementorScreenshotConfig.selector); |
| 1891 |
return { |
| 1892 |
$elementor: $elementor |
| 1893 |
}; |
| 1894 |
} |
| 1895 |
}, { |
| 1896 |
key: "onInit", |
| 1897 |
value: function onInit() { |
| 1898 |
var _this = this; |
| 1899 |
_superPropGet(Screenshot, "onInit", this, 3)([]); |
| 1900 |
|
| 1901 |
/** |
| 1902 |
* Hold the timeout timer |
| 1903 |
* |
| 1904 |
* @type {number|null} |
| 1905 |
*/ |
| 1906 |
this.timeoutTimer = setTimeout(function () { |
| 1907 |
_this.screenshotFailed(new Error('Screenshot timeout reached')); |
| 1908 |
}, this.getSettings('timeout')); |
| 1909 |
return this.captureScreenshot(); |
| 1910 |
} |
| 1911 |
|
| 1912 |
/** |
| 1913 |
* The main method for this class. |
| 1914 |
*/ |
| 1915 |
}, { |
| 1916 |
key: "captureScreenshot", |
| 1917 |
value: function captureScreenshot() { |
| 1918 |
var _this2 = this; |
| 1919 |
return Promise.resolve().then(function () { |
| 1920 |
return _this2.createImage(); |
| 1921 |
}).then(function (imageData) { |
| 1922 |
return _this2.save(imageData); |
| 1923 |
}).then(function (url) { |
| 1924 |
return _this2.screenshotSucceed(url); |
| 1925 |
}).catch(function (error) { |
| 1926 |
return _this2.screenshotFailed(error); |
| 1927 |
}); |
| 1928 |
} |
| 1929 |
|
| 1930 |
/** |
| 1931 |
* Creates a WebP image using html-to-image library. |
| 1932 |
* |
| 1933 |
* @return {Promise<string>} URI containing image data |
| 1934 |
*/ |
| 1935 |
}, { |
| 1936 |
key: "createImage", |
| 1937 |
value: (function () { |
| 1938 |
var _createImage = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() { |
| 1939 |
var _this3 = this; |
| 1940 |
var pageLoadedPromise, timeOutPromise, $elementorElement, bodyStyle, bodyBackgroundColor, canvas; |
| 1941 |
return _regenerator.default.wrap(function (_context) { |
| 1942 |
while (1) switch (_context.prev = _context.next) { |
| 1943 |
case 0: |
| 1944 |
pageLoadedPromise = new Promise(function (resolve) { |
| 1945 |
window.addEventListener('load', function () { |
| 1946 |
return resolve(); |
| 1947 |
}); |
| 1948 |
}); |
| 1949 |
timeOutPromise = new Promise(function (resolve) { |
| 1950 |
setTimeout(function () { |
| 1951 |
return resolve(); |
| 1952 |
}, _this3.getSettings('render_timeout')); |
| 1953 |
}); |
| 1954 |
_context.next = 1; |
| 1955 |
return Promise.race([pageLoadedPromise, timeOutPromise]); |
| 1956 |
case 1: |
| 1957 |
$elementorElement = this.elements.$elementor; |
| 1958 |
if (!$elementorElement.length) { |
| 1959 |
$elementorElement = jQuery(ElementorScreenshotConfig.selector); |
| 1960 |
} |
| 1961 |
if (!$elementorElement.length) { |
| 1962 |
$elementorElement = jQuery('body > div.elementor:not(.elementor-location-header):not(.elementor-location-footer)'); |
| 1963 |
} |
| 1964 |
if ($elementorElement.length) { |
| 1965 |
_context.next = 2; |
| 1966 |
break; |
| 1967 |
} |
| 1968 |
throw new Error('Elementor container not found. Selector: ' + ElementorScreenshotConfig.selector); |
| 1969 |
case 2: |
| 1970 |
this.preprocessLazyImages($elementorElement); |
| 1971 |
bodyStyle = window.getComputedStyle(document.body); |
| 1972 |
bodyBackgroundColor = bodyStyle.backgroundColor; |
| 1973 |
_context.next = 3; |
| 1974 |
return (0, _htmlToImage.toCanvas)($elementorElement[0], { |
| 1975 |
quality: this.getSettings('image_quality'), |
| 1976 |
imagePlaceholder: this.getSettings('image_placeholder'), |
| 1977 |
backgroundColor: bodyBackgroundColor || null, |
| 1978 |
style: { |
| 1979 |
transform: 'scale(1)', |
| 1980 |
transformOrigin: 'top left' |
| 1981 |
} |
| 1982 |
}); |
| 1983 |
case 3: |
| 1984 |
canvas = _context.sent; |
| 1985 |
return _context.abrupt("return", canvas.toDataURL('image/webp', this.getSettings('image_quality'))); |
| 1986 |
case 4: |
| 1987 |
case "end": |
| 1988 |
return _context.stop(); |
| 1989 |
} |
| 1990 |
}, _callee, this); |
| 1991 |
})); |
| 1992 |
function createImage() { |
| 1993 |
return _createImage.apply(this, arguments); |
| 1994 |
} |
| 1995 |
return createImage; |
| 1996 |
}()) |
| 1997 |
}, { |
| 1998 |
key: "preprocessLazyImages", |
| 1999 |
value: function preprocessLazyImages($element) { |
| 2000 |
var lazyImages = $element.find('img[data-src], img.swiper-lazy, img.lazy'); |
| 2001 |
lazyImages.each(function (index, img) { |
| 2002 |
var $img = jQuery(img); |
| 2003 |
if ($img.attr('data-src')) { |
| 2004 |
$img.attr('src', $img.attr('data-src')); |
| 2005 |
$img.removeAttr('data-src'); |
| 2006 |
} |
| 2007 |
$img.removeClass('swiper-lazy lazy swiper-slide-image'); |
| 2008 |
$img.removeAttr('loading'); |
| 2009 |
$img.removeAttr('data-srcset'); |
| 2010 |
}); |
| 2011 |
} |
| 2012 |
|
| 2013 |
/** |
| 2014 |
* Send the image to the server. |
| 2015 |
* |
| 2016 |
* @param {string} dataUrl |
| 2017 |
* @return {Promise<string>} Screenshot URL |
| 2018 |
*/ |
| 2019 |
}, { |
| 2020 |
key: "save", |
| 2021 |
value: function save(dataUrl) { |
| 2022 |
var _this$getSaveAction = this.getSaveAction(), |
| 2023 |
key = _this$getSaveAction.key, |
| 2024 |
action = _this$getSaveAction.action; |
| 2025 |
var data = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, key, this.getSettings(key)), "screenshot", dataUrl); |
| 2026 |
return new Promise(function (resolve, reject) { |
| 2027 |
if ('kit_id' === key) { |
| 2028 |
return resolve(data.screenshot); |
| 2029 |
} |
| 2030 |
elementorCommon.ajax.addRequest(action, { |
| 2031 |
data: data, |
| 2032 |
success: function success(url) { |
| 2033 |
return resolve(url); |
| 2034 |
}, |
| 2035 |
error: function error() { |
| 2036 |
return reject(); |
| 2037 |
} |
| 2038 |
}); |
| 2039 |
}); |
| 2040 |
} |
| 2041 |
|
| 2042 |
/** |
| 2043 |
* Mark this post screenshot as failed. |
| 2044 |
* @param {Error} e |
| 2045 |
*/ |
| 2046 |
}, { |
| 2047 |
key: "markAsFailed", |
| 2048 |
value: function markAsFailed(e) { |
| 2049 |
var _this4 = this; |
| 2050 |
return new Promise(function (resolve, reject) { |
| 2051 |
var templateId = _this4.getSettings('template_id'); |
| 2052 |
var postId = _this4.getSettings('post_id'); |
| 2053 |
var kitId = _this4.getSettings('kit_id'); |
| 2054 |
if (kitId) { |
| 2055 |
resolve(); |
| 2056 |
} else { |
| 2057 |
var route = templateId ? 'template_screenshot_failed' : 'screenshot_failed'; |
| 2058 |
var data = templateId ? { |
| 2059 |
template_id: templateId, |
| 2060 |
error: e.message || e.toString() |
| 2061 |
} : { |
| 2062 |
post_id: postId |
| 2063 |
}; |
| 2064 |
elementorCommon.ajax.addRequest(route, { |
| 2065 |
data: data, |
| 2066 |
success: function success() { |
| 2067 |
return resolve(); |
| 2068 |
}, |
| 2069 |
error: function error() { |
| 2070 |
return reject(); |
| 2071 |
} |
| 2072 |
}); |
| 2073 |
} |
| 2074 |
}); |
| 2075 |
} |
| 2076 |
|
| 2077 |
/** |
| 2078 |
* Notify that the screenshot has been succeed. |
| 2079 |
* |
| 2080 |
* @param {string} imageUrl |
| 2081 |
*/ |
| 2082 |
}, { |
| 2083 |
key: "screenshotSucceed", |
| 2084 |
value: function screenshotSucceed(imageUrl) { |
| 2085 |
this.screenshotDone(true, imageUrl); |
| 2086 |
} |
| 2087 |
|
| 2088 |
/** |
| 2089 |
* Notify that the screenshot has been failed. |
| 2090 |
* |
| 2091 |
* @param {Error} e |
| 2092 |
*/ |
| 2093 |
}, { |
| 2094 |
key: "screenshotFailed", |
| 2095 |
value: function screenshotFailed(e) { |
| 2096 |
var _this5 = this; |
| 2097 |
this.markAsFailed(e).then(function () { |
| 2098 |
return _this5.screenshotDone(false); |
| 2099 |
}); |
| 2100 |
} |
| 2101 |
|
| 2102 |
/** |
| 2103 |
* Final method of the screenshot. |
| 2104 |
* |
| 2105 |
* @param {boolean} success |
| 2106 |
* @param {string} imageUrl |
| 2107 |
*/ |
| 2108 |
}, { |
| 2109 |
key: "screenshotDone", |
| 2110 |
value: function screenshotDone(success) { |
| 2111 |
var imageUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; |
| 2112 |
clearTimeout(this.timeoutTimer); |
| 2113 |
this.timeoutTimer = null; |
| 2114 |
var _this$getSaveAction2 = this.getSaveAction(), |
| 2115 |
message = _this$getSaveAction2.message, |
| 2116 |
key = _this$getSaveAction2.key; |
| 2117 |
|
| 2118 |
// Send the message to the parent window and not to the top. |
| 2119 |
// e.g: The `Theme builder` is loaded into an iFrame so the message of the screenshot |
| 2120 |
// should be sent to the `Theme builder` window and not to the top window. |
| 2121 |
window.parent.postMessage({ |
| 2122 |
name: message, |
| 2123 |
success: success, |
| 2124 |
id: this.getSettings(key), |
| 2125 |
imageUrl: imageUrl |
| 2126 |
}, '*'); |
| 2127 |
} |
| 2128 |
}, { |
| 2129 |
key: "getSaveAction", |
| 2130 |
value: function getSaveAction() { |
| 2131 |
var config = this.getSettings(); |
| 2132 |
if (config.kit_id) { |
| 2133 |
return { |
| 2134 |
message: 'kit-screenshot-done', |
| 2135 |
action: 'update_kit_preview', |
| 2136 |
key: 'kit_id' |
| 2137 |
}; |
| 2138 |
} |
| 2139 |
if (config.template_id) { |
| 2140 |
return { |
| 2141 |
message: 'library/capture-screenshot-done', |
| 2142 |
action: 'save_template_screenshot', |
| 2143 |
key: 'template_id' |
| 2144 |
}; |
| 2145 |
} |
| 2146 |
return { |
| 2147 |
message: 'capture-screenshot-done', |
| 2148 |
action: 'screenshot_save', |
| 2149 |
key: 'post_id' |
| 2150 |
}; |
| 2151 |
} |
| 2152 |
}]); |
| 2153 |
}(elementorModules.ViewModule); |
| 2154 |
jQuery(function () { |
| 2155 |
new Screenshot(); |
| 2156 |
}); |
| 2157 |
})(); |
| 2158 |
|
| 2159 |
/******/ })() |
| 2160 |
; |
| 2161 |
//# sourceMappingURL=cloud-library-screenshot.js.map |