@wix/editor-react-components 1.2786.0 → 1.2788.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -144,6 +144,7 @@ const manifest = {
144
144
  archetype: Archetype.Audio,
145
145
  layout: {
146
146
  resizeDirection: LAYOUT.RESIZE_DIRECTION.horizontalAndVertical,
147
+ contentResizeDirection: LAYOUT.CONTENT_RESIZE_DIRECTION.none,
147
148
  disableStretching: true,
148
149
  disablePositioning: false
149
150
  },
@@ -4,10 +4,109 @@ import { a as getDataAttributes, c as getExternalImageUrl, n as normalizeWixUri
4
4
  import { e as getTabIndexAttribute } from "../chunks/a11y.js";
5
5
  import { L as Link } from "../chunks/Link.js";
6
6
  import * as React from "react";
7
- import { a as getData, g as getPlaceholder, S as STATIC_MEDIA_URL$1 } from "../chunks/index6.js";
8
- import { g as getMediaSizeQueryString, c as camelToKebab, a as getMediaUrlByContext, i as initCustomElement } from "../chunks/customElementInit.js";
7
+ import { a as getData, c as getFileExtension, d as fileType, b as alignTypes, f as fittingTypes, M as MEDIA_ROOT_URL$1, S as STATIC_MEDIA_URL$1, g as getPlaceholder } from "../chunks/index6.js";
8
+ import { f as fastdom } from "../chunks/fastdom.js";
9
9
  import { useService } from "@wix/services-manager-react";
10
10
  import { R as RenderingContextDefinition } from "../chunks/index3.js";
11
+ const camelToKebab = (str) => str.replace(/[A-Z]+(?![^A-Z])|[A-Z]/g, (a, b) => (b ? "-" : "") + a.toLowerCase());
12
+ const CSS_NUMERIC_VALUES = {
13
+ columnCount: 1,
14
+ columns: 1,
15
+ fontWeight: 1,
16
+ lineHeight: 1,
17
+ opacity: 1,
18
+ zIndex: 1,
19
+ zoom: 1
20
+ };
21
+ const pick = (obj, props) => {
22
+ const propsArr = Array.isArray(props) ? props : [props];
23
+ return propsArr.reduce((subObj, prop) => {
24
+ const val = obj[prop];
25
+ return val !== void 0 ? Object.assign(subObj, { [prop]: val }) : subObj;
26
+ }, {});
27
+ };
28
+ const addDefaultUnitIfNeeded = (prop, value) => typeof value === "number" && !CSS_NUMERIC_VALUES[prop] ? `${value}px` : value.toString();
29
+ const setStyle = (node, styleProperties) => node && styleProperties && Object.keys(styleProperties).forEach((prop) => {
30
+ const styleProp = prop;
31
+ const propValue = styleProperties[styleProp];
32
+ if (propValue !== void 0) {
33
+ node.style[styleProp] = addDefaultUnitIfNeeded(styleProp, propValue);
34
+ } else {
35
+ node.style.removeProperty(styleProp);
36
+ }
37
+ });
38
+ const getScreenHeight = (heightOverride) => heightOverride || document.documentElement.clientHeight || window.innerHeight || 0;
39
+ const matchesUserDomainMediaPrefix = (uri, prefixes) => prefixes.some((prefix) => uri.startsWith(`${prefix}_`));
40
+ const ensureTrailingSlash = (value) => value.endsWith("/") ? value : `${value}/`;
41
+ const resolveStaticMediaBaseUrl = ({ uri, envConsts }) => {
42
+ const { externalBaseUrl, userDomainMediaPrefixes = [], staticMediaUrl } = envConsts;
43
+ if (matchesUserDomainMediaPrefix(uri, userDomainMediaPrefixes) && externalBaseUrl) {
44
+ return `${ensureTrailingSlash(externalBaseUrl)}_media/`;
45
+ }
46
+ return ensureTrailingSlash(staticMediaUrl);
47
+ };
48
+ const getImageComputedProperties = (extendedImageInfo, envConsts, htmlTag) => {
49
+ if (!extendedImageInfo.targetWidth || !extendedImageInfo.targetHeight || !extendedImageInfo.imageData.uri) {
50
+ return { uri: "", css: {}, transformed: false };
51
+ }
52
+ const { imageData } = extendedImageInfo;
53
+ const fittingType = extendedImageInfo.displayMode || fittingTypes.SCALE_TO_FILL;
54
+ const imageOptions = Object.assign(pick(imageData, ["upscaleMethod"]), pick(extendedImageInfo, [
55
+ "filters",
56
+ "encoding",
57
+ "allowFullGIFTransformation",
58
+ "allowWebpAvifTransforms"
59
+ ]), extendedImageInfo.quality || imageData.quality, {
60
+ hasAnimation: (extendedImageInfo == null ? void 0 : extendedImageInfo.hasAnimation) || (imageData == null ? void 0 : imageData.hasAnimation)
61
+ });
62
+ const devicePixelRatioFromData = extendedImageInfo.imageData.devicePixelRatio || envConsts.devicePixelRatio;
63
+ const devicePixelRatio = getDevicePixelRatio$1(devicePixelRatioFromData);
64
+ const src = Object.assign(pick(imageData, ["width", "height", "crop", "name", "focalPoint"]), { id: imageData.uri });
65
+ const target = {
66
+ width: extendedImageInfo.targetWidth,
67
+ height: extendedImageInfo.targetHeight,
68
+ htmlTag,
69
+ pixelAspectRatio: devicePixelRatio,
70
+ alignment: extendedImageInfo.alignType || alignTypes.CENTER
71
+ };
72
+ const imageComputedProperties = getData(fittingType, src, target, imageOptions);
73
+ const staticMediaUrl = imageData.userDomainMediaURL ? imageData.userDomainMediaURL : resolveStaticMediaBaseUrl({
74
+ uri: imageData.uri,
75
+ envConsts
76
+ });
77
+ imageComputedProperties.uri = getMediaUrlByContext(imageComputedProperties.uri, staticMediaUrl, envConsts.mediaRootUrl);
78
+ return imageComputedProperties;
79
+ };
80
+ const getMediaUrlByContext = (imageUri, staticMediaUrl, mediaRootUrl) => {
81
+ var _a;
82
+ const isExternalUrl = /(^https?)|(^data)|(^blob)|(^\/\/)/.test(imageUri);
83
+ if (isExternalUrl) {
84
+ return imageUri;
85
+ }
86
+ let path = ensureTrailingSlash(staticMediaUrl);
87
+ if (imageUri) {
88
+ if (/^micons\//.test(imageUri)) {
89
+ path = ensureTrailingSlash(mediaRootUrl);
90
+ } else if (((_a = /[^.]+$/.exec(imageUri)) == null ? void 0 : _a[0]) === "ico") {
91
+ path = path.replace("media", "ficons");
92
+ }
93
+ }
94
+ return path + imageUri;
95
+ };
96
+ const getDevicePixelRatio$1 = (devicePixelRatio) => {
97
+ const queryParams = window.location.search.split("&").map((query) => query.split("="));
98
+ const devicePixelRatioQueryParam = queryParams.find((query) => {
99
+ var _a;
100
+ return (_a = query[0]) == null ? void 0 : _a.toLowerCase().includes("devicepixelratio");
101
+ });
102
+ const devicePixelRatioValueForceFromUrl = (devicePixelRatioQueryParam == null ? void 0 : devicePixelRatioQueryParam[1]) ? Number(devicePixelRatioQueryParam[1]) : null;
103
+ return devicePixelRatioValueForceFromUrl || devicePixelRatio || 1;
104
+ };
105
+ const getImageSrc = (imageNode) => imageNode.getAttribute("src");
106
+ const imageIsAnimated = (uri, hasAnimation) => getFileExtension(uri) === fileType.GIF || getFileExtension(uri) === fileType.WEBP && hasAnimation;
107
+ const getMediaSizeQueryString = (media) => {
108
+ return Object.entries(media).filter(([_, value]) => value || value === 0).map(([key, value]) => `(${camelToKebab(key)}: ${value}px)`).join(" and ");
109
+ };
11
110
  const image = "image__iWj48";
12
111
  const styles = {
13
112
  image
@@ -84,6 +183,394 @@ const ImageNG = (props) => {
84
183
  React.createElement("img", { ...priority === "high" ? { fetchpriority: "high" } : { loading: "lazy" }, ...decorative && { "aria-hidden": true }, src: fullSizeSrc, alt: decorative ? "" : alt, role, width: image2.width, height: image2.height })
85
184
  );
86
185
  };
186
+ const MOBILE_SAFE_ADDRESSBAR_HEIGHT = 80;
187
+ function getHeightOverride(height, mediaHeightOverrideType) {
188
+ return mediaHeightOverrideType === "fixed" || mediaHeightOverrideType === "viewport" ? document.documentElement.clientHeight + MOBILE_SAFE_ADDRESSBAR_HEIGHT : height;
189
+ }
190
+ function computeScaleOverrides(imageStyle, targetScale = 1) {
191
+ return targetScale !== 1 ? {
192
+ ...imageStyle,
193
+ width: "100%",
194
+ height: "100%"
195
+ } : imageStyle;
196
+ }
197
+ function computeStyleOverrides(mediaHeightOverrideType, imageStyle, displayMode, targetScale, isResponsive) {
198
+ const styleWithScale = computeScaleOverrides(imageStyle, targetScale);
199
+ if (isResponsive) {
200
+ delete styleWithScale.height;
201
+ styleWithScale.width = "100%";
202
+ }
203
+ if (!mediaHeightOverrideType) {
204
+ return styleWithScale;
205
+ }
206
+ const style2 = { ...styleWithScale };
207
+ if (displayMode === "fill") {
208
+ style2.position = "absolute";
209
+ style2.top = "0";
210
+ } else if (displayMode === "fit") {
211
+ style2.height = "100%";
212
+ }
213
+ if (mediaHeightOverrideType === "fixed") {
214
+ style2["will-change"] = "transform";
215
+ }
216
+ if (style2.objectPosition) {
217
+ style2.objectPosition = imageStyle.objectPosition.replace(/(center|bottom)$/, "top");
218
+ }
219
+ return style2;
220
+ }
221
+ function getSourceSetsTargetHeightByEffect(sourceSets, offsetWidth, offsetHeight, screenHeight, services) {
222
+ const sourceSetsTargetHeights = {};
223
+ sourceSets.forEach(({ mediaQuery, scrollEffect }) => {
224
+ var _a;
225
+ sourceSetsTargetHeights[mediaQuery] = ((_a = services.getMediaDimensionsByEffect) == null ? void 0 : _a.call(services, scrollEffect, offsetWidth, offsetHeight, screenHeight).height) || offsetHeight;
226
+ });
227
+ return sourceSetsTargetHeights;
228
+ }
229
+ function computeSrcSets(measures, imageInfo, envConsts) {
230
+ const { sourceSets } = imageInfo;
231
+ if (!sourceSets || !sourceSets.length) {
232
+ return;
233
+ }
234
+ const mediaToUri = {};
235
+ sourceSets.forEach(({ mediaQuery, crop, focalPoint }) => {
236
+ const imageInfoClone = {
237
+ ...imageInfo,
238
+ targetHeight: (measures.sourceSetsTargetHeights || {})[mediaQuery] || 0,
239
+ imageData: {
240
+ ...imageInfo.imageData,
241
+ crop,
242
+ focalPoint
243
+ }
244
+ };
245
+ const imageComputedProperties = getImageComputedProperties(imageInfoClone, envConsts, "img");
246
+ mediaToUri[mediaQuery] = imageComputedProperties.uri || "";
247
+ });
248
+ return mediaToUri;
249
+ }
250
+ function measure(id, measures, domNodes, { containerElm, bgEffect = "none", sourceSets }, services) {
251
+ var _a, _b;
252
+ const innerImage = domNodes.image;
253
+ const wixImage = domNodes[id];
254
+ const screenHeight = getScreenHeight((_a = services.getScreenHeightOverride) == null ? void 0 : _a.call(services));
255
+ const mediaHeightOverrideType = containerElm == null ? void 0 : containerElm.dataset.mediaHeightOverrideType;
256
+ const hasBgEffect = bgEffect && bgEffect !== "none" || sourceSets && sourceSets.some((srcset) => srcset.scrollEffect);
257
+ const sourceOfDimensions = containerElm && hasBgEffect ? containerElm : wixImage;
258
+ const cssBgEffect = window.getComputedStyle(wixImage).getPropertyValue("--bg-scrub-effect");
259
+ const { width, height } = ((_b = services.getMediaDimensionsByEffect) == null ? void 0 : _b.call(services, cssBgEffect || bgEffect, sourceOfDimensions.offsetWidth, sourceOfDimensions.offsetHeight, screenHeight)) || {
260
+ width: wixImage.offsetWidth,
261
+ height: wixImage.offsetHeight
262
+ };
263
+ if (sourceSets) {
264
+ measures.sourceSetsTargetHeights = getSourceSetsTargetHeightByEffect(sourceSets, sourceOfDimensions.offsetWidth, sourceOfDimensions.offsetHeight, screenHeight, services);
265
+ }
266
+ if (!innerImage) {
267
+ return;
268
+ }
269
+ const imgSrc = getImageSrc(innerImage);
270
+ if (cssBgEffect) {
271
+ measures.top = 0.5 * (wixImage.offsetHeight - height);
272
+ measures.left = 0.5 * (wixImage.offsetWidth - width);
273
+ }
274
+ measures.width = width;
275
+ measures.height = getHeightOverride(height, mediaHeightOverrideType);
276
+ measures.screenHeight = screenHeight;
277
+ measures.imgSrc = imgSrc;
278
+ measures.boundingRect = wixImage.getBoundingClientRect();
279
+ measures.mediaHeightOverrideType = mediaHeightOverrideType;
280
+ measures.srcset = innerImage.srcset;
281
+ }
282
+ function patch(id, measures, domNodes, imageInfo, services, envConsts, loadImage, isResponsive, bgEffect, loadImageImmediately) {
283
+ var _a, _b, _c;
284
+ if (!Object.keys(measures).length) {
285
+ return;
286
+ }
287
+ const { imageData } = imageInfo;
288
+ const wixImageNode = domNodes[id];
289
+ const image2 = domNodes.image;
290
+ if (bgEffect) {
291
+ imageData.devicePixelRatio = 1;
292
+ }
293
+ const targetScale = imageInfo.targetScale || 1;
294
+ const allowFullGIFTransformation = (_a = services.isExperimentOpen) == null ? void 0 : _a.call(services, "specs.thunderbolt.allowFullGIFTransformation");
295
+ const allowWebpAvifTransforms = (_b = services.isExperimentOpen) == null ? void 0 : _b.call(services, "specs.thunderbolt.allowWebpAvifTransforms");
296
+ const extendedImageInfo = {
297
+ ...imageInfo,
298
+ ...!imageInfo.skipMeasure && {
299
+ targetWidth: (measures.width || 0) * targetScale,
300
+ targetHeight: (measures.height || 0) * targetScale
301
+ },
302
+ displayMode: imageData.displayMode,
303
+ allowFullGIFTransformation,
304
+ allowWebpAvifTransforms
305
+ };
306
+ const imageComputedProperties = getImageComputedProperties(extendedImageInfo, envConsts, "img");
307
+ const computedStyle = ((_c = imageComputedProperties == null ? void 0 : imageComputedProperties.css) == null ? void 0 : _c.img) || {};
308
+ const imageStyle = computeStyleOverrides(measures.mediaHeightOverrideType, computedStyle, imageData.displayMode, targetScale, isResponsive);
309
+ setStyle(image2, imageStyle);
310
+ if (measures.top || measures.left) {
311
+ setStyle(wixImageNode, {
312
+ top: `${measures.top}px`,
313
+ left: `${measures.left}px`
314
+ });
315
+ }
316
+ const src = (imageComputedProperties == null ? void 0 : imageComputedProperties.uri) || "";
317
+ const hasAnimation = (imageData == null ? void 0 : imageData.hasAnimation) || (imageInfo == null ? void 0 : imageInfo.hasAnimation);
318
+ const mediaToUri = computeSrcSets(measures, extendedImageInfo, envConsts);
319
+ if (loadImageImmediately) {
320
+ image2.dataset.ssrSrcDone = "true";
321
+ }
322
+ if (imageInfo.isLQIP && imageInfo.lqipTransition && !("transitioned" in wixImageNode.dataset)) {
323
+ wixImageNode.dataset.transitioned = "";
324
+ if (image2.complete) {
325
+ image2.onload = function() {
326
+ image2.dataset.loadDone = "";
327
+ };
328
+ } else {
329
+ image2.onload = function() {
330
+ if (image2.complete) {
331
+ image2.dataset.loadDone = "";
332
+ } else {
333
+ image2.onload = function() {
334
+ image2.dataset.loadDone = "";
335
+ };
336
+ }
337
+ };
338
+ }
339
+ }
340
+ if (loadImage) {
341
+ if (imageIsAnimated(imageData.uri, hasAnimation)) {
342
+ image2.setAttribute("fetchpriority", "low");
343
+ image2.setAttribute("loading", "lazy");
344
+ image2.setAttribute("decoding", "async");
345
+ } else {
346
+ image2.setAttribute("fetchpriority", "high");
347
+ }
348
+ image2.currentSrc !== src && image2.setAttribute("src", src);
349
+ const srcIsMissingFromSrcset = measures.srcset && !measures.srcset.split(", ").some((source) => source.split(" ")[0] === src);
350
+ if (srcIsMissingFromSrcset) {
351
+ image2.setAttribute("srcset", src);
352
+ }
353
+ if (domNodes.picture && extendedImageInfo.sourceSets) {
354
+ Array.from(domNodes.picture.querySelectorAll("source")).forEach((sourceNode) => {
355
+ const mediaQuery = sourceNode.media || "";
356
+ const uri = mediaToUri == null ? void 0 : mediaToUri[mediaQuery];
357
+ if (sourceNode.srcset !== uri) {
358
+ sourceNode.setAttribute("srcset", uri || "");
359
+ }
360
+ });
361
+ }
362
+ }
363
+ }
364
+ const imageLayout = {
365
+ measure,
366
+ patch
367
+ };
368
+ const TIMEOUT = 250;
369
+ const imageEffectMap = {
370
+ parallax: "ImageParallax",
371
+ fixed: "ImageReveal"
372
+ };
373
+ function wowImageFactory(services, environmentConsts, contextWindow) {
374
+ return class WowImage extends contextWindow.HTMLElement {
375
+ constructor() {
376
+ super();
377
+ this.childListObserver = null;
378
+ this.timeoutId = null;
379
+ }
380
+ attributeChangedCallback(_, oldValue) {
381
+ if (oldValue) {
382
+ this.reLayout();
383
+ }
384
+ }
385
+ connectedCallback() {
386
+ if (environmentConsts.disableImagesLazyLoading) {
387
+ this.reLayout();
388
+ } else {
389
+ this.observeIntersect();
390
+ }
391
+ }
392
+ disconnectedCallback() {
393
+ this.unobserveResize();
394
+ this.unobserveIntersect();
395
+ this.unobserveChildren();
396
+ }
397
+ static get observedAttributes() {
398
+ return ["data-image-info"];
399
+ }
400
+ reLayout() {
401
+ const domNodes = {};
402
+ const measures = {};
403
+ const imageId = this.getAttribute("id");
404
+ const imageInfo = JSON.parse(this.dataset.imageInfo || "");
405
+ const isResponsive = this.dataset.isResponsive === "true";
406
+ const { bgEffectName } = this.dataset;
407
+ const { scrollEffect } = imageInfo.imageData;
408
+ const { sourceSets } = imageInfo;
409
+ const bgEffect = bgEffectName || scrollEffect && imageEffectMap[scrollEffect];
410
+ if (sourceSets && sourceSets.length) {
411
+ sourceSets.forEach((sourceSet) => {
412
+ if (sourceSet.scrollEffect) {
413
+ sourceSet.scrollEffect = imageEffectMap[sourceSet.scrollEffect];
414
+ }
415
+ });
416
+ }
417
+ domNodes[imageId] = this;
418
+ if (imageInfo.containerId) {
419
+ domNodes[imageInfo.containerId] = contextWindow.document.getElementById(`${imageInfo.containerId}`);
420
+ }
421
+ const containerElm = imageInfo.containerId ? domNodes[imageInfo.containerId] : void 0;
422
+ domNodes.image = this.querySelector("img");
423
+ domNodes.picture = this.querySelector("picture");
424
+ if (!domNodes.image) {
425
+ const target = this;
426
+ this.observeChildren(target);
427
+ return;
428
+ }
429
+ this.unobserveChildren();
430
+ this.observeChildren(this);
431
+ services.mutationService.measure(() => {
432
+ imageLayout.measure(imageId, measures, domNodes, {
433
+ containerElm,
434
+ bgEffect,
435
+ sourceSets
436
+ }, services);
437
+ });
438
+ const patchImage = (shouldLoadImage, loadImageImmediately2) => {
439
+ services.mutationService.mutate(() => {
440
+ imageLayout.patch(imageId, measures, domNodes, imageInfo, services, environmentConsts, shouldLoadImage, isResponsive, bgEffect, loadImageImmediately2);
441
+ });
442
+ };
443
+ const imageElement = domNodes.image;
444
+ const ssrSrcNeedProcessing = this.dataset.hasSsrSrc && !imageElement.dataset.ssrSrcDone;
445
+ const loadImageImmediately = !getImageSrc(imageElement) || ssrSrcNeedProcessing;
446
+ if (loadImageImmediately) {
447
+ patchImage(true, true);
448
+ } else {
449
+ this.debounceImageLoad(patchImage);
450
+ }
451
+ }
452
+ /**
453
+ * Debounce consecutive image loads
454
+ *
455
+ * @param {function} patchImage closure for patching the image
456
+ */
457
+ debounceImageLoad(patchImage) {
458
+ clearTimeout(this.timeoutId);
459
+ this.timeoutId = contextWindow.setTimeout(() => {
460
+ patchImage(true);
461
+ }, TIMEOUT);
462
+ patchImage(false);
463
+ }
464
+ observeResize() {
465
+ var _a;
466
+ (_a = services.resizeService) == null ? void 0 : _a.observe(this);
467
+ }
468
+ unobserveResize() {
469
+ var _a;
470
+ (_a = services.resizeService) == null ? void 0 : _a.unobserve(this);
471
+ }
472
+ observeIntersect() {
473
+ var _a;
474
+ (_a = services.intersectionService) == null ? void 0 : _a.observe(this);
475
+ }
476
+ unobserveIntersect() {
477
+ var _a;
478
+ (_a = services.intersectionService) == null ? void 0 : _a.unobserve(this);
479
+ }
480
+ /**
481
+ * Observe DOM mutations to wait for addition of missing children
482
+ *
483
+ * @param {HTMLElement} parent
484
+ */
485
+ observeChildren(parent) {
486
+ if (!this.childListObserver) {
487
+ this.childListObserver = new contextWindow.MutationObserver(() => {
488
+ this.reLayout();
489
+ });
490
+ }
491
+ this.childListObserver.observe(parent, { childList: true });
492
+ }
493
+ /**
494
+ * Remove DOM MutationObserver if one was created
495
+ */
496
+ unobserveChildren() {
497
+ if (this.childListObserver) {
498
+ this.childListObserver.disconnect();
499
+ this.childListObserver = null;
500
+ }
501
+ }
502
+ };
503
+ }
504
+ function init(contextWindow, services) {
505
+ const elementName = "wow-image";
506
+ contextWindow = contextWindow || window;
507
+ if (contextWindow.customElements.get(elementName) === void 0) {
508
+ let resizeObserver;
509
+ if (contextWindow.ResizeObserver) {
510
+ resizeObserver = new contextWindow.ResizeObserver((entries) => entries.map((entry) => entry.target.reLayout()));
511
+ }
512
+ let intersectionObserver;
513
+ if (contextWindow.IntersectionObserver) {
514
+ intersectionObserver = new IntersectionObserver((entries) => entries.map((entry) => {
515
+ if (entry.isIntersecting) {
516
+ const wowImage2 = entry.target;
517
+ wowImage2.unobserveIntersect();
518
+ wowImage2.observeResize();
519
+ }
520
+ return entry;
521
+ }), {
522
+ /**
523
+ * old: 50% from 1080 (desktop) is 540px, 800 (mobile) 400px
524
+ * new: 150% from 1080 (desktop) is 1620, 800 (mobile) 1200
525
+ * chrome [loading=lazy]: 4g - 1250px, lower then 3g - 2500px
526
+ * @see https://web.dev/articles/browser-level-image-lazy-loading#improved-thresholds
527
+ */
528
+ rootMargin: "150% 100%"
529
+ });
530
+ }
531
+ return function(env) {
532
+ const WowImage = wowImageFactory({
533
+ resizeService: resizeObserver,
534
+ intersectionService: intersectionObserver,
535
+ mutationService: fastdom,
536
+ ...services
537
+ }, env, contextWindow);
538
+ contextWindow.customElements.define(elementName, WowImage);
539
+ };
540
+ }
541
+ return;
542
+ }
543
+ const getDevicePixelRatio = () => {
544
+ const isMSMobileDevice = /iemobile/i.test(navigator.userAgent);
545
+ if (isMSMobileDevice) {
546
+ return Math.round(window.screen.availWidth / (window.screen.width || window.document.documentElement.clientWidth));
547
+ }
548
+ return window.devicePixelRatio;
549
+ };
550
+ const getIsImagesLazyLoadingDisabled = () => {
551
+ try {
552
+ return new URL(window.location.href).searchParams.get("disableLazyLoading") === "true";
553
+ } catch {
554
+ return false;
555
+ }
556
+ };
557
+ function initCustomElement(services = {}, contextWindow = null, envConsts = {}) {
558
+ if (typeof window === "undefined") {
559
+ return;
560
+ }
561
+ const env = {
562
+ staticMediaUrl: STATIC_MEDIA_URL$1,
563
+ mediaRootUrl: MEDIA_ROOT_URL$1,
564
+ experiments: {},
565
+ devicePixelRatio: getDevicePixelRatio(),
566
+ disableImagesLazyLoading: getIsImagesLazyLoadingDisabled(),
567
+ ...envConsts
568
+ };
569
+ const define = init(contextWindow, services);
570
+ if (define) {
571
+ define(env);
572
+ }
573
+ }
87
574
  const root = "root__FuiJG";
88
575
  const image3 = "image3__6ufCe";
89
576
  const fitWidth = "fitWidth__0L5O4";
@@ -2,8 +2,164 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c as clsx } from "../chunks/clsx.js";
3
3
  import { a as getDataAttributes } from "../chunks/dataUtils.js";
4
4
  import { d as defaultLogoUrl, D as DEFAULT_LOGO_SIZE } from "../chunks/constants30.js";
5
- import { I as Image$1 } from "../chunks/Image.js";
5
+ import * as React from "react";
6
+ import { i as imageKit, g as getPlaceholder } from "../chunks/index6.js";
6
7
  import { L as Link } from "../chunks/Link.js";
8
+ const image$1 = "image__WopE9";
9
+ const styles$2 = {
10
+ image: image$1
11
+ };
12
+ const { STATIC_MEDIA_URL } = imageKit;
13
+ const fetchLQIP = ({ fittingType, src, target, options }) => {
14
+ const placeholder = getPlaceholder(fittingType, src, target, {
15
+ ...options,
16
+ autoEncode: true
17
+ });
18
+ if ((placeholder == null ? void 0 : placeholder.uri) && !/^[a-z]+:/.test(placeholder.uri)) {
19
+ placeholder.uri = `${STATIC_MEDIA_URL}${placeholder.uri}`;
20
+ }
21
+ return placeholder;
22
+ };
23
+ const SCHEME_RE = /^[a-z]+:/;
24
+ const Image$1 = (props) => {
25
+ var _a, _b;
26
+ const { id, containerId, uri, alt, name = "", role, width, height, displayMode, devicePixelRatio, quality, alignType, bgEffectName = "", focalPoint, upscaleMethod, className = "", crop, imageStyles = {}, targetWidth, targetHeight, targetScale, onLoad = () => {
27
+ }, onError = () => {
28
+ }, shouldUseLQIP, containerWidth, containerHeight, getPlaceholder: getPlaceholder2, isInFirstFold, placeholderTransition, socialAttrs, isSEOBot, skipMeasure, hasAnimation, encoding, isFluidLayout, baseHostURL } = props;
29
+ const imageRef = React.useRef(null);
30
+ let hasSsrSrc = "";
31
+ const hasBlurTransition = placeholderTransition === "blur";
32
+ const ssrImageData = React.useRef(null);
33
+ if (!ssrImageData.current) {
34
+ if (getPlaceholder2 || shouldUseLQIP || isInFirstFold || isSEOBot) {
35
+ const options = {
36
+ upscaleMethod,
37
+ ...quality ? quality : {},
38
+ shouldLoadHQImage: isInFirstFold,
39
+ isSEOBot,
40
+ hasAnimation,
41
+ encoding,
42
+ baseHostURL
43
+ };
44
+ ssrImageData.current = (getPlaceholder2 || fetchLQIP)({
45
+ fittingType: displayMode,
46
+ src: {
47
+ id: uri,
48
+ width,
49
+ height,
50
+ crop,
51
+ name,
52
+ focalPoint
53
+ },
54
+ target: {
55
+ width: containerWidth,
56
+ height: containerHeight,
57
+ alignment: alignType,
58
+ htmlTag: "img"
59
+ },
60
+ options
61
+ });
62
+ hasSsrSrc = !ssrImageData.current.transformed || isInFirstFold || isSEOBot ? "" : "true";
63
+ } else {
64
+ ssrImageData.current = {
65
+ uri: void 0,
66
+ css: { img: {} },
67
+ attr: { img: {}, container: {} },
68
+ transformed: false
69
+ };
70
+ }
71
+ }
72
+ const isLQIP = !isSEOBot && (getPlaceholder2 || shouldUseLQIP) && !isInFirstFold && ssrImageData.current.transformed;
73
+ const imageInfo = React.useMemo(() => JSON.stringify({
74
+ containerId,
75
+ ...containerId && { containerId },
76
+ ...alignType && { alignType },
77
+ ...skipMeasure && { skipMeasure: true },
78
+ displayMode,
79
+ ...containerWidth && { targetWidth: containerWidth },
80
+ ...containerHeight && { targetHeight: containerHeight },
81
+ ...targetWidth && { targetWidth },
82
+ ...targetHeight && { targetHeight },
83
+ ...targetScale && { targetScale },
84
+ isLQIP,
85
+ isSEOBot,
86
+ lqipTransition: placeholderTransition,
87
+ encoding,
88
+ imageData: {
89
+ width,
90
+ height,
91
+ uri,
92
+ name,
93
+ displayMode,
94
+ hasAnimation,
95
+ ...quality && { quality },
96
+ ...devicePixelRatio && { devicePixelRatio },
97
+ ...focalPoint && { focalPoint },
98
+ ...crop && { crop },
99
+ ...upscaleMethod && { upscaleMethod }
100
+ }
101
+ }), [
102
+ containerId,
103
+ alignType,
104
+ skipMeasure,
105
+ displayMode,
106
+ containerWidth,
107
+ containerHeight,
108
+ targetWidth,
109
+ targetHeight,
110
+ targetScale,
111
+ isLQIP,
112
+ isSEOBot,
113
+ placeholderTransition,
114
+ encoding,
115
+ width,
116
+ height,
117
+ uri,
118
+ name,
119
+ hasAnimation,
120
+ quality,
121
+ devicePixelRatio,
122
+ focalPoint,
123
+ crop,
124
+ upscaleMethod
125
+ ]);
126
+ const ssrResult = ssrImageData.current;
127
+ const src = ssrResult == null ? void 0 : ssrResult.uri;
128
+ const srcset = ssrResult == null ? void 0 : ssrResult.srcset;
129
+ const placeholderStyle = (_a = ssrResult.css) == null ? void 0 : _a.img;
130
+ const classNames = `${styles$2.image} ${className}`;
131
+ React.useEffect(() => {
132
+ const imgElement = imageRef.current;
133
+ if (onLoad && (imgElement == null ? void 0 : imgElement.currentSrc) && (imgElement == null ? void 0 : imgElement.complete)) {
134
+ onLoad({
135
+ target: imgElement
136
+ });
137
+ }
138
+ }, []);
139
+ const maxWidth = ssrResult && !(ssrResult == null ? void 0 : ssrResult.transformed) ? `max(${width}px, 100%)` : targetWidth ? `${targetWidth}px` : null;
140
+ return React.createElement(
141
+ "wow-image",
142
+ { id, class: classNames, "data-image-info": imageInfo, "data-motion-part": `BG_IMG ${containerId}`, "data-bg-effect-name": bgEffectName, "data-has-ssr-src": hasSsrSrc, "data-animate-blur": !isSEOBot && isLQIP && hasBlurTransition ? "" : void 0, "data-is-responsive": isFluidLayout ? "true" : void 0, style: maxWidth ? { "--wix-img-max-width": maxWidth } : {} },
143
+ React.createElement("img", {
144
+ src,
145
+ ref: imageRef,
146
+ alt: alt || "",
147
+ role,
148
+ style: { ...placeholderStyle, ...imageStyles },
149
+ onLoad,
150
+ onError,
151
+ width: containerWidth ? containerWidth : void 0,
152
+ height: containerHeight ? containerHeight : void 0,
153
+ ...socialAttrs,
154
+ srcSet: isInFirstFold ? (_b = srcset == null ? void 0 : srcset.dpr) == null ? void 0 : _b.map((s) => SCHEME_RE.test(s) ? s : `${STATIC_MEDIA_URL}${s}`).join(", ") : void 0,
155
+ // @ts-expect-error fetchpriority type should work in react > 18.3 https://github.com/facebook/react/pull/25927
156
+ fetchpriority: isInFirstFold ? "high" : void 0,
157
+ loading: isInFirstFold === false ? "lazy" : void 0,
158
+ // The src attribute triggers a mismatch warning because wow-image updates its src outside of the React lifecycle. This causes React to retain the old value in the virtual DOM, which could potentially lead to a bug where the old value is re-rendered during updates. However, we’re confident that this issue is not reproducing in current (16-18) React versions
159
+ suppressHydrationWarning: true
160
+ })
161
+ );
162
+ };
7
163
  const logo = "logo__Y9w6a";
8
164
  const linkLayer = "linkLayer__KtYh-";
9
165
  const styles$1 = {