PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.0-dev3
Elementor Website Builder – more than just a page builder v3.32.0-dev3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / assets / js / cloud-library-screenshot.js

cloud-library-screenshot.js in Elementor Website Builder – more than just a page builder 3.32.0-dev3, at assets/js/cloud-library-screenshot.js

902 lines 36.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! elementor - v3.32.0 - 08-09-2025 */
2 /******/ (() => { // webpackBootstrap
3 /******/ var __webpack_modules__ = ({
4
5 /***/ "../node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
6 /*!******************************************************************!*\
7 !*** ../node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
8 \******************************************************************/
9 /***/ ((module) => {
10
11 function _arrayLikeToArray(r, a) {
12 (null == a || a > r.length) && (a = r.length);
13 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
14 return n;
15 }
16 module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
17
18 /***/ }),
19
20 /***/ "../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
21 /*!*******************************************************************!*\
22 !*** ../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
23 \*******************************************************************/
24 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25
26 var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "../node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
27 function _arrayWithoutHoles(r) {
28 if (Array.isArray(r)) return arrayLikeToArray(r);
29 }
30 module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
31
32 /***/ }),
33
34 /***/ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js":
35 /*!***********************************************************************!*\
36 !*** ../node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
37 \***********************************************************************/
38 /***/ ((module) => {
39
40 function _assertThisInitialized(e) {
41 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
42 return e;
43 }
44 module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
45
46 /***/ }),
47
48 /***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js":
49 /*!****************************************************************!*\
50 !*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***!
51 \****************************************************************/
52 /***/ ((module) => {
53
54 function _classCallCheck(a, n) {
55 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
56 }
57 module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
58
59 /***/ }),
60
61 /***/ "../node_modules/@babel/runtime/helpers/createClass.js":
62 /*!*************************************************************!*\
63 !*** ../node_modules/@babel/runtime/helpers/createClass.js ***!
64 \*************************************************************/
65 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
66
67 var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
68 function _defineProperties(e, r) {
69 for (var t = 0; t < r.length; t++) {
70 var o = r[t];
71 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
72 }
73 }
74 function _createClass(e, r, t) {
75 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
76 writable: !1
77 }), e;
78 }
79 module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
80
81 /***/ }),
82
83 /***/ "../node_modules/@babel/runtime/helpers/defineProperty.js":
84 /*!****************************************************************!*\
85 !*** ../node_modules/@babel/runtime/helpers/defineProperty.js ***!
86 \****************************************************************/
87 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
88
89 var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
90 function _defineProperty(e, r, t) {
91 return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
92 value: t,
93 enumerable: !0,
94 configurable: !0,
95 writable: !0
96 }) : e[r] = t, e;
97 }
98 module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
99
100 /***/ }),
101
102 /***/ "../node_modules/@babel/runtime/helpers/get.js":
103 /*!*****************************************************!*\
104 !*** ../node_modules/@babel/runtime/helpers/get.js ***!
105 \*****************************************************/
106 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
107
108 var superPropBase = __webpack_require__(/*! ./superPropBase.js */ "../node_modules/@babel/runtime/helpers/superPropBase.js");
109 function _get() {
110 return module.exports = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
111 var p = superPropBase(e, t);
112 if (p) {
113 var n = Object.getOwnPropertyDescriptor(p, t);
114 return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
115 }
116 }, module.exports.__esModule = true, module.exports["default"] = module.exports, _get.apply(null, arguments);
117 }
118 module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
119
120 /***/ }),
121
122 /***/ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js":
123 /*!****************************************************************!*\
124 !*** ../node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
125 \****************************************************************/
126 /***/ ((module) => {
127
128 function _getPrototypeOf(t) {
129 return module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
130 return t.__proto__ || Object.getPrototypeOf(t);
131 }, module.exports.__esModule = true, module.exports["default"] = module.exports, _getPrototypeOf(t);
132 }
133 module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
134
135 /***/ }),
136
137 /***/ "../node_modules/@babel/runtime/helpers/inherits.js":
138 /*!**********************************************************!*\
139 !*** ../node_modules/@babel/runtime/helpers/inherits.js ***!
140 \**********************************************************/
141 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
142
143 var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js");
144 function _inherits(t, e) {
145 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
146 t.prototype = Object.create(e && e.prototype, {
147 constructor: {
148 value: t,
149 writable: !0,
150 configurable: !0
151 }
152 }), Object.defineProperty(t, "prototype", {
153 writable: !1
154 }), e && setPrototypeOf(t, e);
155 }
156 module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
157
158 /***/ }),
159
160 /***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js":
161 /*!***********************************************************************!*\
162 !*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
163 \***********************************************************************/
164 /***/ ((module) => {
165
166 function _interopRequireDefault(e) {
167 return e && e.__esModule ? e : {
168 "default": e
169 };
170 }
171 module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
172
173 /***/ }),
174
175 /***/ "../node_modules/@babel/runtime/helpers/iterableToArray.js":
176 /*!*****************************************************************!*\
177 !*** ../node_modules/@babel/runtime/helpers/iterableToArray.js ***!
178 \*****************************************************************/
179 /***/ ((module) => {
180
181 function _iterableToArray(r) {
182 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
183 }
184 module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
185
186 /***/ }),
187
188 /***/ "../node_modules/@babel/runtime/helpers/nonIterableSpread.js":
189 /*!*******************************************************************!*\
190 !*** ../node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
191 \*******************************************************************/
192 /***/ ((module) => {
193
194 function _nonIterableSpread() {
195 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
196 }
197 module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
198
199 /***/ }),
200
201 /***/ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
202 /*!***************************************************************************!*\
203 !*** ../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
204 \***************************************************************************/
205 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
206
207 var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
208 var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js");
209 function _possibleConstructorReturn(t, e) {
210 if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
211 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
212 return assertThisInitialized(t);
213 }
214 module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
215
216 /***/ }),
217
218 /***/ "../node_modules/@babel/runtime/helpers/readOnlyError.js":
219 /*!***************************************************************!*\
220 !*** ../node_modules/@babel/runtime/helpers/readOnlyError.js ***!
221 \***************************************************************/
222 /***/ ((module) => {
223
224 function _readOnlyError(r) {
225 throw new TypeError('"' + r + '" is read-only');
226 }
227 module.exports = _readOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports;
228
229 /***/ }),
230
231 /***/ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js":
232 /*!****************************************************************!*\
233 !*** ../node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
234 \****************************************************************/
235 /***/ ((module) => {
236
237 function _setPrototypeOf(t, e) {
238 return module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
239 return t.__proto__ = e, t;
240 }, module.exports.__esModule = true, module.exports["default"] = module.exports, _setPrototypeOf(t, e);
241 }
242 module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
243
244 /***/ }),
245
246 /***/ "../node_modules/@babel/runtime/helpers/superPropBase.js":
247 /*!***************************************************************!*\
248 !*** ../node_modules/@babel/runtime/helpers/superPropBase.js ***!
249 \***************************************************************/
250 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
251
252 var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js");
253 function _superPropBase(t, o) {
254 for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t)););
255 return t;
256 }
257 module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
258
259 /***/ }),
260
261 /***/ "../node_modules/@babel/runtime/helpers/toConsumableArray.js":
262 /*!*******************************************************************!*\
263 !*** ../node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
264 \*******************************************************************/
265 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
266
267 var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js");
268 var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "../node_modules/@babel/runtime/helpers/iterableToArray.js");
269 var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
270 var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "../node_modules/@babel/runtime/helpers/nonIterableSpread.js");
271 function _toConsumableArray(r) {
272 return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread();
273 }
274 module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
275
276 /***/ }),
277
278 /***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js":
279 /*!*************************************************************!*\
280 !*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***!
281 \*************************************************************/
282 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
283
284 var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
285 function toPrimitive(t, r) {
286 if ("object" != _typeof(t) || !t) return t;
287 var e = t[Symbol.toPrimitive];
288 if (void 0 !== e) {
289 var i = e.call(t, r || "default");
290 if ("object" != _typeof(i)) return i;
291 throw new TypeError("@@toPrimitive must return a primitive value.");
292 }
293 return ("string" === r ? String : Number)(t);
294 }
295 module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
296
297 /***/ }),
298
299 /***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js":
300 /*!***************************************************************!*\
301 !*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
302 \***************************************************************/
303 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
304
305 var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
306 var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js");
307 function toPropertyKey(t) {
308 var i = toPrimitive(t, "string");
309 return "symbol" == _typeof(i) ? i : i + "";
310 }
311 module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
312
313 /***/ }),
314
315 /***/ "../node_modules/@babel/runtime/helpers/typeof.js":
316 /*!********************************************************!*\
317 !*** ../node_modules/@babel/runtime/helpers/typeof.js ***!
318 \********************************************************/
319 /***/ ((module) => {
320
321 function _typeof(o) {
322 "@babel/helpers - typeof";
323
324 return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
325 return typeof o;
326 } : function (o) {
327 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
328 }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
329 }
330 module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
331
332 /***/ }),
333
334 /***/ "../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
335 /*!****************************************************************************!*\
336 !*** ../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
337 \****************************************************************************/
338 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
339
340 var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "../node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
341 function _unsupportedIterableToArray(r, a) {
342 if (r) {
343 if ("string" == typeof r) return arrayLikeToArray(r, a);
344 var t = {}.toString.call(r).slice(8, -1);
345 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;
346 }
347 }
348 module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
349
350 /***/ })
351
352 /******/ });
353 /************************************************************************/
354 /******/ // The module cache
355 /******/ var __webpack_module_cache__ = {};
356 /******/
357 /******/ // The require function
358 /******/ function __webpack_require__(moduleId) {
359 /******/ // Check if module is in cache
360 /******/ var cachedModule = __webpack_module_cache__[moduleId];
361 /******/ if (cachedModule !== undefined) {
362 /******/ return cachedModule.exports;
363 /******/ }
364 /******/ // Create a new module (and put it into the cache)
365 /******/ var module = __webpack_module_cache__[moduleId] = {
366 /******/ // no module.id needed
367 /******/ // no module.loaded needed
368 /******/ exports: {}
369 /******/ };
370 /******/
371 /******/ // Execute the module function
372 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
373 /******/
374 /******/ // Return the exports of the module
375 /******/ return module.exports;
376 /******/ }
377 /******/
378 /************************************************************************/
379 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
380 (() => {
381 "use strict";
382 /*!****************************************************************!*\
383 !*** ../modules/cloud-library/assets/js/preview/screenshot.js ***!
384 \****************************************************************/
385
386
387 var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
388 var _readOnlyError2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/readOnlyError */ "../node_modules/@babel/runtime/helpers/readOnlyError.js"));
389 var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js"));
390 var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
391 var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
392 var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
393 var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
394 var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
395 var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
396 var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
397 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; }
398 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; }
399 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)); }
400 function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
401 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; }
402 /* global ElementorScreenshotConfig */
403 var Screenshot = /*#__PURE__*/function (_elementorModules$Vie) {
404 function Screenshot() {
405 (0, _classCallCheck2.default)(this, Screenshot);
406 return _callSuper(this, Screenshot, arguments);
407 }
408 (0, _inherits2.default)(Screenshot, _elementorModules$Vie);
409 return (0, _createClass2.default)(Screenshot, [{
410 key: "getDefaultSettings",
411 value: function getDefaultSettings() {
412 var _ElementorScreenshotC, _ElementorScreenshotC2;
413 return _objectSpread({
414 empty_content_headline: 'Empty Content.',
415 crop: {
416 width: ((_ElementorScreenshotC = ElementorScreenshotConfig) === null || _ElementorScreenshotC === void 0 || (_ElementorScreenshotC = _ElementorScreenshotC.crop) === null || _ElementorScreenshotC === void 0 ? void 0 : _ElementorScreenshotC.width) || 1200,
417 height: ((_ElementorScreenshotC2 = ElementorScreenshotConfig) === null || _ElementorScreenshotC2 === void 0 || (_ElementorScreenshotC2 = _ElementorScreenshotC2.crop) === null || _ElementorScreenshotC2 === void 0 ? void 0 : _ElementorScreenshotC2.height) || 1500
418 },
419 excluded_external_css_urls: ['https://kit-pro.fontawesome.com'],
420 external_images_urls: ['https://i.ytimg.com' // Youtube images domain.
421 ],
422 timeout: 15000,
423 // Wait until screenshot taken or fail in 15 secs.
424 render_timeout: 5000,
425 // Wait until all the element will be loaded or 5 sec and then take screenshot.
426 timerLabel: null,
427 timer_label: "".concat(ElementorScreenshotConfig.post_id, " - timer"),
428 image_placeholder: 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=',
429 isDebug: elementorCommonConfig.isElementorDebug,
430 isDebugSvg: false
431 }, ElementorScreenshotConfig);
432 }
433 }, {
434 key: "getDefaultElements",
435 value: function getDefaultElements() {
436 var $elementor = jQuery(ElementorScreenshotConfig.selector);
437 var $sections = $elementor.find('.elementor-section-wrap > .elementor-section, .elementor > .elementor-section');
438 return {
439 $elementor: $elementor,
440 $sections: $sections,
441 $firstSection: $sections.first(),
442 $notElementorElements: elementorCommon.elements.$body.find('> *:not(style, link)').not($elementor),
443 $head: jQuery('head')
444 };
445 }
446 }, {
447 key: "onInit",
448 value: function onInit() {
449 _superPropGet(Screenshot, "onInit", this, 3)([]);
450 this.log('Screenshot init', 'time');
451
452 /**
453 * Hold the timeout timer
454 *
455 * @type {number|null}
456 */
457 this.timeoutTimer = setTimeout(this.screenshotFailed.bind(this), this.getSettings('timeout'));
458 return this.captureScreenshot();
459 }
460
461 /**
462 * The main method for this class.
463 */
464 }, {
465 key: "captureScreenshot",
466 value: function captureScreenshot() {
467 if (!this.elements.$elementor.length && !this.getSettings('kit_id')) {
468 elementorCommon.helpers.consoleWarn('Screenshots: The content of this page is empty, the module will create a fake conent just for this screenshot.');
469 this.createFakeContent();
470 }
471 this.removeUnnecessaryElements();
472 this.handleIFrames();
473 this.removeFirstSectionMargin();
474 this.handleLinks();
475 this.loadExternalCss();
476 this.loadExternalImages();
477 return Promise.resolve().then(this.createImage.bind(this)).then(this.createImageElement.bind(this)).then(this.cropCanvas.bind(this)).then(this.save.bind(this)).then(this.screenshotSucceed.bind(this)).catch(this.screenshotFailed.bind(this));
478 }
479
480 /**
481 * Fake content for documents that dont have any content.
482 */
483 }, {
484 key: "createFakeContent",
485 value: function createFakeContent() {
486 this.elements.$elementor = jQuery('<div>').css({
487 height: this.getSettings('crop.height'),
488 width: this.getSettings('crop.width'),
489 display: 'flex',
490 alignItems: 'center',
491 justifyContent: 'center'
492 });
493 this.elements.$elementor.append(jQuery('<h1>').css({
494 fontSize: '85px'
495 }).html(this.getSettings('empty_content_headline')));
496 document.body.prepend(this.elements.$elementor);
497 }
498
499 /**
500 * CSS from another server cannot be loaded with the current dom to image library.
501 * this method take all the links from another domain and proxy them.
502 */
503 }, {
504 key: "loadExternalCss",
505 value: function loadExternalCss() {
506 var _this = this;
507 var excludedUrls = [this.getSettings('home_url')].concat((0, _toConsumableArray2.default)(this.getSettings('excluded_external_css_urls')));
508 var notSelector = excludedUrls.map(function (url) {
509 return "[href^=\"".concat(url, "\"]");
510 }).join(', ');
511 jQuery('link').not(notSelector).each(function (index, el) {
512 var $link = jQuery(el),
513 $newLink = $link.clone();
514 $newLink.attr('href', _this.getScreenshotProxyUrl($link.attr('href')));
515 _this.elements.$head.append($newLink);
516 $link.remove();
517 });
518 }
519
520 /**
521 * Make a proxy to images urls that has some problems with cross origin (like youtube).
522 */
523 }, {
524 key: "loadExternalImages",
525 value: function loadExternalImages() {
526 var _this2 = this;
527 var selector = this.getSettings('external_images_urls').map(function (url) {
528 return "img[src^=\"".concat(url, "\"]");
529 }).join(', ');
530 jQuery(selector).each(function (index, el) {
531 var $img = jQuery(el);
532 $img.attr('src', _this2.getScreenshotProxyUrl($img.attr('src')));
533 });
534 }
535
536 /**
537 * Html to images libraries can not snapshot IFrames
538 * this method convert all the IFrames to some other elements.
539 */
540 }, {
541 key: "handleIFrames",
542 value: function handleIFrames() {
543 this.elements.$elementor.find('iframe').each(function (index, el) {
544 var $iframe = jQuery(el),
545 $iframeMask = jQuery('<div />', {
546 css: {
547 background: 'gray',
548 width: $iframe.width(),
549 height: $iframe.height()
550 }
551 });
552 $iframe.before($iframeMask);
553 $iframe.remove();
554 });
555 }
556
557 /**
558 * Remove all the sections that should not be in the screenshot.
559 */
560 }, {
561 key: "removeUnnecessaryElements",
562 value: function removeUnnecessaryElements() {
563 var _this3 = this;
564 var currentHeight = 0;
565
566 // We need to keep all elements as for Kit we render the entire homepage
567 if (this.getSettings('kit_id')) {
568 return;
569 }
570 this.elements.$sections.filter(function (index, el) {
571 var shouldBeRemoved = false;
572 if (currentHeight >= _this3.getSettings('crop.height')) {
573 shouldBeRemoved = true;
574 }
575 currentHeight += jQuery(el).outerHeight();
576 return shouldBeRemoved;
577 }).each(function (index, el) {
578 el.remove();
579 });
580
581 // Some 3rd party plugins inject elements into the dom, so this method removes all
582 // the elements that was injected, to make sure that it capture a screenshot only of the post itself.
583 this.elements.$notElementorElements.remove();
584 }
585
586 /**
587 * Some urls make some problems to the svg parser.
588 * this method convert all the urls to just '/'.
589 */
590 }, {
591 key: "handleLinks",
592 value: function handleLinks() {
593 elementorCommon.elements.$body.find('a').attr('href', '/');
594 }
595
596 /**
597 * Remove unnecessary margin from the first element of the post (singles and footers).
598 */
599 }, {
600 key: "removeFirstSectionMargin",
601 value: function removeFirstSectionMargin() {
602 this.elements.$firstSection.css({
603 marginTop: 0
604 });
605 }
606
607 /**
608 * Creates a png image.
609 *
610 * @return {Promise<unknown>} URI containing image data
611 */
612 }, {
613 key: "createImage",
614 value: function createImage() {
615 var _this4 = this;
616 var pageLoadedPromise = new Promise(function (resolve) {
617 window.addEventListener('load', function () {
618 resolve();
619 });
620 });
621 var timeOutPromise = new Promise(function (resolve) {
622 setTimeout(function () {
623 resolve();
624 }, _this4.getSettings('render_timeout'));
625 });
626 return Promise.race([pageLoadedPromise, timeOutPromise]).then(function () {
627 _this4.log('Start creating screenshot.');
628 if (_this4.getSettings('isDebugSvg')) {
629 domtoimage.toSvg(document.body, {
630 imagePlaceholder: _this4.getSettings('image_placeholder')
631 }).then(function (svg) {
632 return _this4.download(svg);
633 });
634 return Promise.reject('Debug SVG.');
635 }
636
637 // TODO: Extract to util function.
638 var isSafari = /^((?!chrome|android).)*safari/i.test(window.userAgent);
639
640 // Safari browser has some problems with the images that dom-to-images
641 // library creates, so in this specific case the screenshot uses html2canvas.
642 // Note that dom-to-image creates more accurate screenshot in "not safari" browsers.
643 if (isSafari) {
644 _this4.log('Creating screenshot with "html2canvas"');
645 return html2canvas(document.body).then(function (canvas) {
646 return canvas.toDataURL('image/png');
647 });
648 }
649 _this4.log('Creating screenshot with "dom-to-image"');
650 return domtoimage.toPng(document.body, {
651 imagePlaceholder: _this4.getSettings('image_placeholder')
652 }).catch(function () {
653 return html2canvas(document.body).then(function (canvas) {
654 return canvas.toDataURL('image/png');
655 });
656 });
657 });
658 }
659
660 /**
661 * Download a uri, use for debugging the svg that created from dom to image libraries.
662 *
663 * @param {string} uri
664 */
665 }, {
666 key: "download",
667 value: function download(uri) {
668 var $link = jQuery('<a/>', {
669 href: uri,
670 download: 'debugSvg.svg',
671 html: 'Download SVG'
672 });
673 elementorCommon.elements.$body.append($link);
674 $link.trigger('click');
675 }
676
677 /**
678 * Creates fake image element to get the size of the image later on.
679 *
680 * @param {string} dataUrl
681 * @return {Promise<HTMLImageElement>} Image Element
682 */
683 }, {
684 key: "createImageElement",
685 value: function createImageElement(dataUrl) {
686 var image = new Image();
687 image.src = dataUrl;
688 return new Promise(function (resolve) {
689 image.onload = function () {
690 return resolve(image);
691 };
692 });
693 }
694
695 /**
696 * Crop the image to requested sizes.
697 *
698 * @param {HTMLImageElement} image
699 * @return {Promise<unknown>} Canvas
700 */
701 }, {
702 key: "cropCanvas",
703 value: function cropCanvas(image) {
704 var width = this.getSettings('crop.width');
705 var height = this.getSettings('crop.height');
706 var cropCanvas = document.createElement('canvas'),
707 cropContext = cropCanvas.getContext('2d'),
708 ratio = width / image.width;
709 cropCanvas.width = width;
710 cropCanvas.height = height > image.height ? image.height : height;
711 cropContext.drawImage(image, 0, 0, image.width, image.height, 0, 0, image.width * ratio, image.height * ratio);
712 return Promise.resolve(cropCanvas);
713 }
714
715 /**
716 * Send the image to the server.
717 *
718 * @param {HTMLCanvasElement} canvas
719 * @return {Promise<unknown>} Screenshot URL
720 */
721 }, {
722 key: "save",
723 value: function save(canvas) {
724 var _this5 = this;
725 var _this$getSaveAction = this.getSaveAction(),
726 key = _this$getSaveAction.key,
727 action = _this$getSaveAction.action;
728 var data = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, key, this.getSettings(key)), "screenshot", canvas.toDataURL('image/png'));
729 return new Promise(function (resolve, reject) {
730 if ('kit_id' === key) {
731 return resolve(data.screenshot);
732 }
733 elementorCommon.ajax.addRequest(action, {
734 data: data,
735 success: function success(url) {
736 _this5.log("Screenshot created: ".concat(encodeURI(url)));
737 resolve(url);
738 },
739 error: function error() {
740 _this5.log('Failed to create screenshot.');
741 reject();
742 }
743 });
744 });
745 }
746
747 /**
748 * Mark this post screenshot as failed.
749 * @param {Error} e
750 */
751 }, {
752 key: "markAsFailed",
753 value: function markAsFailed(e) {
754 var _this6 = this;
755 return new Promise(function (resolve, reject) {
756 var templateId = _this6.getSettings('template_id');
757 var postId = _this6.getSettings('post_id');
758 var kitId = _this6.getSettings('kit_id');
759 if (kitId) {
760 resolve();
761 } else {
762 var route = templateId ? 'template_screenshot_failed' : 'screenshot_failed';
763 var data = templateId ? {
764 template_id: templateId,
765 error: e.message || e.toString()
766 } : {
767 post_id: postId
768 };
769 elementorCommon.ajax.addRequest(route, {
770 data: data,
771 success: function success() {
772 _this6.log("Marked as failed.");
773 resolve();
774 },
775 error: function error() {
776 _this6.log('Failed to mark this screenshot as failed.');
777 reject();
778 }
779 });
780 }
781 });
782 }
783
784 /**
785 * @param {string} url
786 * @return {string} Screenshot Proxy URL
787 */
788 }, {
789 key: "getScreenshotProxyUrl",
790 value: function getScreenshotProxyUrl(url) {
791 return "".concat(this.getSettings('home_url'), "?screenshot_proxy&nonce=").concat(this.getSettings('nonce'), "&href=").concat(url);
792 }
793
794 /**
795 * Notify that the screenshot has been succeed.
796 *
797 * @param {string} imageUrl
798 */
799 }, {
800 key: "screenshotSucceed",
801 value: function screenshotSucceed(imageUrl) {
802 this.screenshotDone(true, imageUrl);
803 }
804
805 /**
806 * Notify that the screenshot has been failed.
807 *
808 * @param {Error} e
809 */
810 }, {
811 key: "screenshotFailed",
812 value: function screenshotFailed(e) {
813 var _this7 = this;
814 this.log(e, null);
815 this.markAsFailed(e).then(function () {
816 return _this7.screenshotDone(false);
817 });
818 }
819
820 /**
821 * Final method of the screenshot.
822 *
823 * @param {boolean} success
824 * @param {string} imageUrl
825 */
826 }, {
827 key: "screenshotDone",
828 value: function screenshotDone(success) {
829 var imageUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
830 clearTimeout(this.timeoutTimer);
831 this.timeoutTimer = null;
832 var _this$getSaveAction2 = this.getSaveAction(),
833 message = _this$getSaveAction2.message,
834 key = _this$getSaveAction2.key;
835
836 // Send the message to the parent window and not to the top.
837 // e.g: The `Theme builder` is loaded into an iFrame so the message of the screenshot
838 // should be sent to the `Theme builder` window and not to the top window.
839 window.parent.postMessage({
840 name: message,
841 success: success,
842 id: this.getSettings(key),
843 imageUrl: imageUrl
844 }, '*');
845 this.log("Screenshot ".concat(success ? 'Succeed' : 'Failed', "."), 'timeEnd');
846 }
847
848 /**
849 * Log messages for debugging.
850 *
851 * @param {any} message
852 * @param {string?} timerMethod
853 */
854 }, {
855 key: "log",
856 value: function log(message) {
857 var timerMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'timeLog';
858 if (!this.getSettings('isDebug')) {
859 return;
860 }
861
862 // eslint-disable-next-line no-console
863 console.log('string' === typeof message ? "".concat(this.getSettings('post_id'), " - ").concat(message) : message);
864 if (timerMethod) {
865 // eslint-disable-next-line no-console
866 console[timerMethod](this.getSettings('timer_label'));
867 }
868 }
869 }, {
870 key: "getSaveAction",
871 value: function getSaveAction() {
872 var config = this.getSettings();
873 if (config.kit_id) {
874 return {
875 message: 'kit-screenshot-done',
876 action: 'update_kit_preview',
877 key: 'kit_id'
878 };
879 }
880 if (config.template_id) {
881 return {
882 message: 'library/capture-screenshot-done',
883 action: 'save_template_screenshot',
884 key: 'template_id'
885 };
886 }
887 return {
888 message: 'capture-screenshot-done',
889 action: 'screenshot_save',
890 key: 'post_id'
891 };
892 }
893 }]);
894 }(elementorModules.ViewModule);
895 jQuery(function () {
896 new Screenshot();
897 });
898 })();
899
900 /******/ })()
901 ;
902 //# sourceMappingURL=cloud-library-screenshot.js.map