@cntrl-site/components 1.0.97-1 → 1.0.97-4
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.
- package/dist/Components/Helix/Helix.d.ts +4 -1
- package/dist/Components/Hive/Hive.d.ts +4 -1
- package/dist/Components/List/List.d.ts +4 -1
- package/dist/Components/Marquee/Marquee.d.ts +4 -1
- package/dist/Components/Mercury/Mercury.d.ts +4 -1
- package/dist/Components/Pretext/Pretext.d.ts +5 -0
- package/dist/Components/Pretext/PretextColumn.d.ts +1 -1
- package/dist/Components/Pretext/hyphenation.d.ts +21 -0
- package/dist/Components/Pretext/textLayout.d.ts +3 -0
- package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
- package/dist/Components/utils/EmbedMediaFrame.d.ts +18 -0
- package/dist/Components/utils/embedMedia.d.ts +21 -0
- package/dist/Components/utils/index.d.ts +4 -0
- package/dist/EmbedMediaFrame-BqqoaiHc.mjs +236 -0
- package/dist/EmbedMediaFrame-C5O6lDaq.js +1 -0
- package/dist/export-contract-Ca9b5SgN.js +1 -0
- package/dist/export-contract-DQ4zqboX.mjs +282 -0
- package/dist/index-1HMblVmZ.js +1 -0
- package/dist/index-2JTNRDR1.js +1 -0
- package/dist/index-6Pkh3skU.mjs +45858 -0
- package/dist/index-7g44aFH6.mjs +2406 -0
- package/dist/index-B-0_dAcP.mjs +3966 -0
- package/dist/index-B0n2O6vm.mjs +2740 -0
- package/dist/index-B1vNL0m-.js +1 -0
- package/dist/index-B6E31HBG.js +1 -0
- package/dist/index-BA25un1c.mjs +457 -0
- package/dist/index-BK-G0i5L.js +1 -0
- package/dist/index-B_Fyqx22.mjs +28247 -0
- package/dist/index-BkmSPu6z.js +1 -0
- package/dist/index-BlAuAthm.js +1 -0
- package/dist/index-Bq8huKYW.mjs +2685 -0
- package/dist/index-BrL2zv3x.js +1 -0
- package/dist/index-By2pnaap.mjs +4107 -0
- package/dist/index-C-Y61Lcr.mjs +7087 -0
- package/dist/index-C0IKjloI.mjs +114 -0
- package/dist/index-C0cxTf5o.js +1 -0
- package/dist/index-C2kp589t.mjs +483 -0
- package/dist/index-C7aqOvnk.mjs +6479 -0
- package/dist/index-CADju5Cy.js +1 -0
- package/dist/index-CBQfJnR5.mjs +1469 -0
- package/dist/index-CDO1-R3j.js +1 -0
- package/dist/index-CG_43X7q.js +1 -0
- package/dist/index-CIgabTwE.js +1 -0
- package/dist/index-CJ0NMfJ3.js +1 -0
- package/dist/index-CNFsG2yO.js +1 -0
- package/dist/index-CNGjgoL-.mjs +648 -0
- package/dist/index-CbVelYDh.mjs +212 -0
- package/dist/index-CcAPGjN3.mjs +6188 -0
- package/dist/index-D5u4q2ir.mjs +5660 -0
- package/dist/index-D6ylLL_6.mjs +604 -0
- package/dist/index-DA8t6EZ4.mjs +255 -0
- package/dist/index-DEtZMhOE.mjs +3691 -0
- package/dist/index-DGU-dfFs.mjs +3786 -0
- package/dist/index-DVS4MiPy.mjs +114 -0
- package/dist/index-DapMA5nM.js +1 -0
- package/dist/index-DehKWXGA.js +1 -0
- package/dist/index-DmSeFq2X.mjs +811 -0
- package/dist/index-DtWVe73G.mjs +9278 -0
- package/dist/index-HhE2sJlU.js +1 -0
- package/dist/index-Rwqfce2n.js +1 -0
- package/dist/index-Ypt3vHbi.js +1 -0
- package/dist/index-gBhj9Tcu.js +1 -0
- package/dist/index-kFrlcZxC.js +1 -0
- package/dist/index-kjKI70JX.js +1 -0
- package/dist/index-x_p4zv7D.js +1 -0
- package/dist/index.js +372 -157
- package/dist/index.mjs +10731 -10185
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +18 -13
- package/package.json +3 -1
- package/dist/LinkWrapper-CM1Wd42k.js +0 -1
- package/dist/LinkWrapper-D4d13mZT.mjs +0 -137
|
@@ -2,7 +2,10 @@ import { CommonComponentProps } from '../props';
|
|
|
2
2
|
type HelixMedia = {
|
|
3
3
|
assetId?: string;
|
|
4
4
|
name?: string;
|
|
5
|
-
type?: 'image' | 'video';
|
|
5
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
6
|
+
thumbnail?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
6
9
|
};
|
|
7
10
|
export type HelixContentItem = {
|
|
8
11
|
image?: HelixMedia;
|
|
@@ -21,7 +21,10 @@ type HiveMedia = {
|
|
|
21
21
|
assetId: string;
|
|
22
22
|
name?: string;
|
|
23
23
|
objectFit?: 'cover' | 'contain';
|
|
24
|
-
type?: 'image' | 'video';
|
|
24
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
25
|
+
thumbnail?: string;
|
|
26
|
+
width?: number;
|
|
27
|
+
height?: number;
|
|
25
28
|
};
|
|
26
29
|
type HiveMediaPair = {
|
|
27
30
|
media: HiveMedia[];
|
|
@@ -121,7 +121,10 @@ type ListMedia = {
|
|
|
121
121
|
objectFit?: 'cover' | 'contain';
|
|
122
122
|
assetId: string;
|
|
123
123
|
name: string;
|
|
124
|
-
type?: 'image' | 'video';
|
|
124
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
125
|
+
thumbnail?: string;
|
|
126
|
+
width?: number;
|
|
127
|
+
height?: number;
|
|
125
128
|
};
|
|
126
129
|
type ListContentItem = {
|
|
127
130
|
AColumn?: string;
|
|
@@ -3,8 +3,11 @@ import { TextStyles } from '../utils/textStylesToCss';
|
|
|
3
3
|
type MercuryMedia = {
|
|
4
4
|
assetId: string;
|
|
5
5
|
name?: string;
|
|
6
|
-
type?: 'image' | 'video';
|
|
6
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
7
7
|
objectFit?: 'cover' | 'contain';
|
|
8
|
+
thumbnail?: string;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
8
11
|
};
|
|
9
12
|
type MercuryMediaPair = {
|
|
10
13
|
media: MercuryMedia[];
|
|
@@ -40,6 +40,8 @@ export type PretextSettings = {
|
|
|
40
40
|
fitText?: 'on' | 'off';
|
|
41
41
|
hyphenate?: 'on' | 'off';
|
|
42
42
|
padding?: number;
|
|
43
|
+
columns?: number;
|
|
44
|
+
columnGutter?: number;
|
|
43
45
|
dropCapLines?: number;
|
|
44
46
|
dropCapSize?: number;
|
|
45
47
|
image?: string | null;
|
|
@@ -180,6 +182,8 @@ export type ColumnProps = {
|
|
|
180
182
|
scale: number;
|
|
181
183
|
onFitScale: (scale: number) => void;
|
|
182
184
|
padding: string;
|
|
185
|
+
columns: number;
|
|
186
|
+
gutter: string;
|
|
183
187
|
hyphenate: boolean;
|
|
184
188
|
showOverflowIndicator: boolean;
|
|
185
189
|
dropCapLines: number;
|
|
@@ -191,6 +195,7 @@ export type ColumnProps = {
|
|
|
191
195
|
imageFocalY: number;
|
|
192
196
|
imageScale: number;
|
|
193
197
|
imageCustomPath: string;
|
|
198
|
+
imagePathEdited: boolean;
|
|
194
199
|
pathDragActive: boolean;
|
|
195
200
|
pathCarryImage: boolean;
|
|
196
201
|
onCarryImageConsumed?: () => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ColumnProps } from './Pretext';
|
|
2
|
-
export declare function PretextColumn({ P, item, shape, customPath, pathFit, viewBox, mode, align, allowOverflow, fitEnabled, scale, onFitScale, padding, hyphenate, showOverflowIndicator, dropCapLines, dropCapSize, showGuides, typography, imageUrl, imageFocalX, imageFocalY, imageScale, imageCustomPath, pathDragActive, pathCarryImage, onCarryImageConsumed, pathEditor, imageEditor, }: ColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function PretextColumn({ P, item, shape, customPath, pathFit, viewBox, mode, align, allowOverflow, fitEnabled, scale, onFitScale, padding, columns, gutter, hyphenate, showOverflowIndicator, dropCapLines, dropCapSize, showGuides, typography, imageUrl, imageFocalX, imageFocalY, imageScale, imageCustomPath, imagePathEdited, pathDragActive, pathCarryImage, onCarryImageConsumed, pathEditor, imageEditor, }: ColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type HyphenateSync = (text: string, options?: {
|
|
2
|
+
hyphenChar?: string;
|
|
3
|
+
minWordLength?: number;
|
|
4
|
+
}) => string;
|
|
5
|
+
export type Hyphenation = {
|
|
6
|
+
lang?: string;
|
|
7
|
+
hyphenateSync: HyphenateSync | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Detects the text's language (like RichTextItem's `lang`) and loads that
|
|
11
|
+
* language's hyphenation patterns. Undetected text falls back to the page's
|
|
12
|
+
* own `lang`, then English — what the browser would hyphenate with.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useHyphenation(enabled: boolean, text: string): Hyphenation;
|
|
15
|
+
/**
|
|
16
|
+
* Offsets inside `word` where a line may break: dictionary hyphenation points
|
|
17
|
+
* (a hyphen gets added) plus the spot right after an existing hyphen (nothing
|
|
18
|
+
* added), both kept away from the word's edges.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hyphenationPoints(word: string, hyphenateSync: HyphenateSync | null): number[] | undefined;
|
|
21
|
+
export {};
|
|
@@ -44,7 +44,10 @@ export type LayoutParams = {
|
|
|
44
44
|
capLines: number;
|
|
45
45
|
hyphenate?: boolean;
|
|
46
46
|
charWidths?: (number[] | undefined)[];
|
|
47
|
+
hyphenPoints?: (number[] | undefined)[];
|
|
47
48
|
hyphenWidth?: number;
|
|
48
49
|
shapeMargin?: number;
|
|
50
|
+
columns?: number;
|
|
51
|
+
columnGap?: number;
|
|
49
52
|
};
|
|
50
53
|
export declare function layoutText(params: LayoutParams): LayoutResult;
|
|
@@ -3,7 +3,10 @@ export type WaterfallMedia = {
|
|
|
3
3
|
assetId: string;
|
|
4
4
|
name?: string;
|
|
5
5
|
objectFit?: 'cover' | 'contain';
|
|
6
|
-
type?: 'image' | 'video';
|
|
6
|
+
type?: 'image' | 'video' | 'vimeo' | 'youtube';
|
|
7
|
+
thumbnail?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
7
10
|
};
|
|
8
11
|
export type WaterfallLightboxContentItem = {
|
|
9
12
|
title?: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { EmbedMediaLike, EmbedPlayerMode } from './embedMedia';
|
|
3
|
+
export interface EmbedMediaFrameProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
4
|
+
media: EmbedMediaLike;
|
|
5
|
+
mode: EmbedPlayerMode;
|
|
6
|
+
/** How the video fills the box, the way an image's object-fit would. */
|
|
7
|
+
fit: 'cover' | 'contain';
|
|
8
|
+
/** Whether the player takes the pointer; a background one leaves it to the box around it. */
|
|
9
|
+
interactive?: boolean;
|
|
10
|
+
/** Framed only while near the viewport, so a track of copies holds one player per visible card. */
|
|
11
|
+
lazy?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A Vimeo or YouTube video in the room of an image or a video: a box the caller sizes and places,
|
|
15
|
+
* showing the stored thumbnail until the player is framed over it. A box with no height of its own
|
|
16
|
+
* takes the video's aspect.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EmbedMediaFrame: FC<EmbedMediaFrameProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type EmbedProvider = 'vimeo' | 'youtube';
|
|
2
|
+
/** What a media value holds of a Vimeo or YouTube video: its player url, and the picture and size the player has none of. */
|
|
3
|
+
export type EmbedMediaLike = {
|
|
4
|
+
assetId?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
thumbnail?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
};
|
|
11
|
+
export type EmbedPlayerMode = 'background' | 'player';
|
|
12
|
+
/** The provider whose player a media is framed from, none for a file or a value that only claims to be one. */
|
|
13
|
+
export declare function getEmbedProvider(media: EmbedMediaLike | null | undefined): EmbedProvider | null;
|
|
14
|
+
export declare function isEmbedMedia(media: EmbedMediaLike | null | undefined): boolean;
|
|
15
|
+
/** Width over height of the video, 16:9 when the media does not say. */
|
|
16
|
+
export declare function getEmbedAspect(media: EmbedMediaLike): number;
|
|
17
|
+
/**
|
|
18
|
+
* The player url with the way it plays: `background` runs it the way a muted looping video does,
|
|
19
|
+
* `player` starts it with the provider's own controls.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getEmbedPlayerSrc(media: EmbedMediaLike, mode: EmbedPlayerMode): string;
|
|
@@ -11,3 +11,7 @@ export { getAvailableStatePanels, getUnavailableStates, isPanelAvailable, } from
|
|
|
11
11
|
export type { PanelAvailabilityContext } from './panelAvailability';
|
|
12
12
|
export { LinkWrapper } from './LinkWrapper';
|
|
13
13
|
export type { ContentLink } from '../../types/SchemaV1';
|
|
14
|
+
export { getEmbedAspect, getEmbedPlayerSrc, getEmbedProvider, isEmbedMedia } from './embedMedia';
|
|
15
|
+
export type { EmbedMediaLike, EmbedPlayerMode, EmbedProvider } from './embedMedia';
|
|
16
|
+
export { EmbedMediaFrame } from './EmbedMediaFrame';
|
|
17
|
+
export type { EmbedMediaFrameProps } from './EmbedMediaFrame';
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { useId as P, useRef as R, useState as x, useEffect as E } from "react";
|
|
2
|
+
import { jsx as g, Fragment as j, jsxs as L } from "react/jsx-runtime";
|
|
3
|
+
function Y(t, e = !1) {
|
|
4
|
+
return e ? `calc(var(--cntrl-article-width) * ${t})` : `${t * 100}vw`;
|
|
5
|
+
}
|
|
6
|
+
const z = (t, e, r, s, n) => {
|
|
7
|
+
const o = {};
|
|
8
|
+
for (const [a, l] of Object.entries(r))
|
|
9
|
+
o[`--${t}-${l}`] = e[a];
|
|
10
|
+
const i = new Set(s);
|
|
11
|
+
if (n)
|
|
12
|
+
for (const a of Object.keys(n))
|
|
13
|
+
i.add(a);
|
|
14
|
+
for (const a of i) {
|
|
15
|
+
const l = n == null ? void 0 : n[a];
|
|
16
|
+
if (l)
|
|
17
|
+
for (const [b, m] of Object.entries(r)) {
|
|
18
|
+
const c = l[b];
|
|
19
|
+
c !== void 0 && (o[`--${t}-${a}-${m}`] = c);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return o;
|
|
23
|
+
};
|
|
24
|
+
function M(t) {
|
|
25
|
+
const e = t.trim();
|
|
26
|
+
if (!e || e === "none") return 1;
|
|
27
|
+
if (e.endsWith("%")) {
|
|
28
|
+
const s = parseFloat(e);
|
|
29
|
+
return Number.isFinite(s) ? s / 100 : 1;
|
|
30
|
+
}
|
|
31
|
+
const r = parseFloat(e);
|
|
32
|
+
return Number.isFinite(r) ? r : 1;
|
|
33
|
+
}
|
|
34
|
+
function k(t) {
|
|
35
|
+
const e = t.lastIndexOf("/");
|
|
36
|
+
if (e !== -1)
|
|
37
|
+
return M(t.slice(e + 1));
|
|
38
|
+
}
|
|
39
|
+
function G(t) {
|
|
40
|
+
const e = t.trim().toLowerCase();
|
|
41
|
+
if (!e || e === "transparent") return 0;
|
|
42
|
+
const r = e.match(/^(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\((.+)\)$/);
|
|
43
|
+
if (r) {
|
|
44
|
+
const n = r[1], o = k(n);
|
|
45
|
+
if (o !== void 0) return o;
|
|
46
|
+
if (/^(?:rgba|hsla)$/.test(e.slice(0, 4))) {
|
|
47
|
+
const i = n.split(",").map((a) => parseFloat(a.trim()));
|
|
48
|
+
if (i.length === 4 && Number.isFinite(i[3]))
|
|
49
|
+
return i[3];
|
|
50
|
+
}
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
const s = e.match(/^#([0-9a-f]{4}|[0-9a-f]{8})$/);
|
|
54
|
+
if (s) {
|
|
55
|
+
const n = s[1], o = n.length === 4 ? n[3] + n[3] : n.slice(6, 8);
|
|
56
|
+
return parseInt(o, 16) / 255;
|
|
57
|
+
}
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
const C = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, W = (t) => C.test(t.trim()), _ = (t) => {
|
|
61
|
+
const e = t.replace(/\D/g, "");
|
|
62
|
+
return e.length >= 7 && e.length <= 15;
|
|
63
|
+
}, J = (t, e) => {
|
|
64
|
+
var r;
|
|
65
|
+
for (const s of t) {
|
|
66
|
+
const n = ((r = e[s.name]) == null ? void 0 : r.trim()) ?? "";
|
|
67
|
+
if (n) {
|
|
68
|
+
if (s.type === "email" && !W(n))
|
|
69
|
+
return "Please enter a valid email address.";
|
|
70
|
+
if (s.type === "phone" && !_(n))
|
|
71
|
+
return "Please enter a valid phone number.";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
};
|
|
76
|
+
function K() {
|
|
77
|
+
const e = `cf-${P().replace(/:/g, "")}`;
|
|
78
|
+
return {
|
|
79
|
+
prefix: e,
|
|
80
|
+
cls: (r) => `${e}-${r}`
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const Q = (t, e) => {
|
|
84
|
+
const r = Array.from(t.querySelectorAll('[data-testimonial-measure="text"]')).reduce(
|
|
85
|
+
(n, o) => Math.max(n, o.getBoundingClientRect().height),
|
|
86
|
+
0
|
|
87
|
+
), s = Array.from(t.querySelectorAll('[data-testimonial-measure="caption"]')).reduce(
|
|
88
|
+
(n, o) => Math.max(n, o.getBoundingClientRect().height),
|
|
89
|
+
0
|
|
90
|
+
);
|
|
91
|
+
e({ maxTextPx: r, maxCaptionPx: s });
|
|
92
|
+
};
|
|
93
|
+
function B(t, e) {
|
|
94
|
+
const r = t == null ? void 0 : t.availableWhen;
|
|
95
|
+
return r ? Object.entries(r).every(([s, n]) => {
|
|
96
|
+
if (!(n != null && n.length)) return !0;
|
|
97
|
+
const o = e[s];
|
|
98
|
+
return o === void 0 ? !0 : n.includes(o);
|
|
99
|
+
}) : !0;
|
|
100
|
+
}
|
|
101
|
+
function N(t, e) {
|
|
102
|
+
const r = t == null ? void 0 : t.statePanels;
|
|
103
|
+
return r != null && r.length ? r.filter((s) => {
|
|
104
|
+
var o;
|
|
105
|
+
const n = (o = t == null ? void 0 : t.panels) == null ? void 0 : o.find((i) => i.id === s);
|
|
106
|
+
return B(n, e);
|
|
107
|
+
}) : null;
|
|
108
|
+
}
|
|
109
|
+
function Z(t, e) {
|
|
110
|
+
const r = t == null ? void 0 : t.statePanels;
|
|
111
|
+
if (!(r != null && r.length)) return [];
|
|
112
|
+
const s = new Set(N(t, e) ?? []);
|
|
113
|
+
return r.filter((n) => !s.has(n));
|
|
114
|
+
}
|
|
115
|
+
const T = ["http://", "https://", "/", "mailto:", "tel:", "file:", "ftp:", "javascript", "#"];
|
|
116
|
+
function U(t) {
|
|
117
|
+
return T.some((e) => t.startsWith(e)) ? t : `//${t}`;
|
|
118
|
+
}
|
|
119
|
+
const tt = ({ link: t, className: e, style: r, children: s }) => {
|
|
120
|
+
if (!(t != null && t.value)) return /* @__PURE__ */ g(j, { children: s });
|
|
121
|
+
const n = t.target === "blank" || t.target === "_blank" ? { target: "_blank", rel: "noreferrer" } : {};
|
|
122
|
+
return /* @__PURE__ */ g("a", { href: U(t.value), className: e, style: r, ...n, children: s });
|
|
123
|
+
}, V = {
|
|
124
|
+
vimeo: /^player\.vimeo\.com$/i,
|
|
125
|
+
youtube: /^(?:www\.)?youtube(?:-nocookie)?\.com$/i
|
|
126
|
+
};
|
|
127
|
+
function $(t) {
|
|
128
|
+
if (!(t != null && t.assetId) || t.type !== "vimeo" && t.type !== "youtube") return null;
|
|
129
|
+
try {
|
|
130
|
+
const e = new URL(t.assetId);
|
|
131
|
+
return !V[t.type].test(e.hostname) || t.type === "youtube" && !e.pathname.startsWith("/embed/") ? null : t.type;
|
|
132
|
+
} catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function et(t) {
|
|
137
|
+
return $(t) !== null;
|
|
138
|
+
}
|
|
139
|
+
function O(t) {
|
|
140
|
+
const { width: e, height: r } = t;
|
|
141
|
+
return e && r && e > 0 && r > 0 ? e / r : 16 / 9;
|
|
142
|
+
}
|
|
143
|
+
function q(t, e) {
|
|
144
|
+
const r = $(t);
|
|
145
|
+
if (!r || !t.assetId) return t.assetId ?? "";
|
|
146
|
+
const s = new URL(t.assetId), n = s.searchParams;
|
|
147
|
+
return r === "vimeo" ? (n.set("autoplay", "1"), e === "background" && (n.set("background", "1"), n.set("muted", "1"), n.set("loop", "1"))) : (n.set("autoplay", "1"), n.set("playsinline", "1"), n.set("rel", "0"), e === "background" && (n.set("mute", "1"), n.set("loop", "1"), n.set("playlist", s.pathname.slice(7)), n.set("controls", "0"), n.set("modestbranding", "1"))), s.toString();
|
|
148
|
+
}
|
|
149
|
+
function H(t, e, r) {
|
|
150
|
+
const s = t.width / t.height, n = r === "cover" ? e <= s : e >= s, o = n ? t.width : t.height * e, i = n ? t.width / e : t.height;
|
|
151
|
+
return { width: o, height: i, left: (t.width - o) / 2, top: (t.height - i) / 2 };
|
|
152
|
+
}
|
|
153
|
+
const nt = ({
|
|
154
|
+
media: t,
|
|
155
|
+
mode: e,
|
|
156
|
+
fit: r,
|
|
157
|
+
interactive: s = e === "player",
|
|
158
|
+
lazy: n = !0,
|
|
159
|
+
style: o,
|
|
160
|
+
...i
|
|
161
|
+
}) => {
|
|
162
|
+
const a = R(null), [l, b] = x(null), [m, c] = x(!n), y = O(t);
|
|
163
|
+
E(() => {
|
|
164
|
+
const u = a.current;
|
|
165
|
+
if (!u || typeof ResizeObserver > "u") return;
|
|
166
|
+
const h = () => {
|
|
167
|
+
const { width: w, height: S } = u.getBoundingClientRect();
|
|
168
|
+
b((p) => p && p.width === w && p.height === S ? p : { width: w, height: S });
|
|
169
|
+
};
|
|
170
|
+
h();
|
|
171
|
+
const d = new ResizeObserver(h);
|
|
172
|
+
return d.observe(u), () => d.disconnect();
|
|
173
|
+
}, []), E(() => {
|
|
174
|
+
const u = a.current;
|
|
175
|
+
if (!n || !u || typeof IntersectionObserver > "u") {
|
|
176
|
+
c(!0);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const h = new IntersectionObserver(([d]) => c(d.isIntersecting), { rootMargin: "200px" });
|
|
180
|
+
return h.observe(u), () => h.disconnect();
|
|
181
|
+
}, [n]);
|
|
182
|
+
const f = l && l.width > 0 && l.height > 0 ? H(l, y, r) : null, { width: v, ...I } = o ?? {}, F = {
|
|
183
|
+
position: "relative",
|
|
184
|
+
overflow: "hidden",
|
|
185
|
+
aspectRatio: `${y}`,
|
|
186
|
+
width: v === void 0 || v === "auto" ? "100%" : v,
|
|
187
|
+
...I
|
|
188
|
+
}, A = {
|
|
189
|
+
position: "absolute",
|
|
190
|
+
inset: 0,
|
|
191
|
+
width: "100%",
|
|
192
|
+
height: "100%",
|
|
193
|
+
objectFit: r,
|
|
194
|
+
pointerEvents: "none"
|
|
195
|
+
};
|
|
196
|
+
return /* @__PURE__ */ L("div", { ref: a, "data-embed-frame": "", style: F, ...i, children: [
|
|
197
|
+
t.thumbnail && /* @__PURE__ */ g("img", { src: t.thumbnail, alt: t.name ?? "", draggable: !1, style: A }),
|
|
198
|
+
m && f && /* @__PURE__ */ g(
|
|
199
|
+
"iframe",
|
|
200
|
+
{
|
|
201
|
+
src: q(t, e),
|
|
202
|
+
title: t.name || "Embedded video",
|
|
203
|
+
allow: "autoplay; fullscreen; picture-in-picture",
|
|
204
|
+
allowFullScreen: !0,
|
|
205
|
+
style: {
|
|
206
|
+
position: "absolute",
|
|
207
|
+
left: f.left,
|
|
208
|
+
top: f.top,
|
|
209
|
+
width: f.width,
|
|
210
|
+
height: f.height,
|
|
211
|
+
border: 0,
|
|
212
|
+
pointerEvents: s ? "auto" : "none"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] });
|
|
217
|
+
};
|
|
218
|
+
export {
|
|
219
|
+
nt as E,
|
|
220
|
+
tt as L,
|
|
221
|
+
J as a,
|
|
222
|
+
z as b,
|
|
223
|
+
_ as c,
|
|
224
|
+
N as d,
|
|
225
|
+
Z as e,
|
|
226
|
+
B as f,
|
|
227
|
+
G as g,
|
|
228
|
+
O as h,
|
|
229
|
+
W as i,
|
|
230
|
+
q as j,
|
|
231
|
+
$ as k,
|
|
232
|
+
et as l,
|
|
233
|
+
Q as r,
|
|
234
|
+
Y as s,
|
|
235
|
+
K as u
|
|
236
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("react"),f=require("react/jsx-runtime");function C(t,e=!1){return e?`calc(var(--cntrl-article-width) * ${t})`:`${t*100}vw`}const L=(t,e,r,s,n)=>{const i={};for(const[a,l]of Object.entries(r))i[`--${t}-${l}`]=e[a];const o=new Set(s);if(n)for(const a of Object.keys(n))o.add(a);for(const a of o){const l=n==null?void 0:n[a];if(l)for(const[m,v]of Object.entries(r)){const h=l[m];h!==void 0&&(i[`--${t}-${a}-${v}`]=h)}}return i};function k(t){const e=t.trim();if(!e||e==="none")return 1;if(e.endsWith("%")){const s=parseFloat(e);return Number.isFinite(s)?s/100:1}const r=parseFloat(e);return Number.isFinite(r)?r:1}function T(t){const e=t.lastIndexOf("/");if(e!==-1)return k(t.slice(e+1))}function W(t){const e=t.trim().toLowerCase();if(!e||e==="transparent")return 0;const r=e.match(/^(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\((.+)\)$/);if(r){const n=r[1],i=T(n);if(i!==void 0)return i;if(/^(?:rgba|hsla)$/.test(e.slice(0,4))){const o=n.split(",").map(a=>parseFloat(a.trim()));if(o.length===4&&Number.isFinite(o[3]))return o[3]}return 1}const s=e.match(/^#([0-9a-f]{4}|[0-9a-f]{8})$/);if(s){const n=s[1],i=n.length===4?n[3]+n[3]:n.slice(6,8);return parseInt(i,16)/255}return 1}const U=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,F=t=>U.test(t.trim()),P=t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15},_=(t,e)=>{var r;for(const s of t){const n=((r=e[s.name])==null?void 0:r.trim())??"";if(n){if(s.type==="email"&&!F(n))return"Please enter a valid email address.";if(s.type==="phone"&&!P(n))return"Please enter a valid phone number."}}return null};function B(){const e=`cf-${c.useId().replace(/:/g,"")}`;return{prefix:e,cls:r=>`${e}-${r}`}}const N=(t,e)=>{const r=Array.from(t.querySelectorAll('[data-testimonial-measure="text"]')).reduce((n,i)=>Math.max(n,i.getBoundingClientRect().height),0),s=Array.from(t.querySelectorAll('[data-testimonial-measure="caption"]')).reduce((n,i)=>Math.max(n,i.getBoundingClientRect().height),0);e({maxTextPx:r,maxCaptionPx:s})};function A(t,e){const r=t==null?void 0:t.availableWhen;return r?Object.entries(r).every(([s,n])=>{if(!(n!=null&&n.length))return!0;const i=e[s];return i===void 0?!0:n.includes(i)}):!0}function $(t,e){const r=t==null?void 0:t.statePanels;return r!=null&&r.length?r.filter(s=>{var i;const n=(i=t==null?void 0:t.panels)==null?void 0:i.find(o=>o.id===s);return A(n,e)}):null}function q(t,e){const r=t==null?void 0:t.statePanels;if(!(r!=null&&r.length))return[];const s=new Set($(t,e)??[]);return r.filter(n=>!s.has(n))}const O=["http://","https://","/","mailto:","tel:","file:","ftp:","javascript","#"];function H(t){return O.some(e=>t.startsWith(e))?t:`//${t}`}const D=({link:t,className:e,style:r,children:s})=>{if(!(t!=null&&t.value))return f.jsx(f.Fragment,{children:s});const n=t.target==="blank"||t.target==="_blank"?{target:"_blank",rel:"noreferrer"}:{};return f.jsx("a",{href:H(t.value),className:e,style:r,...n,children:s})},X={vimeo:/^player\.vimeo\.com$/i,youtube:/^(?:www\.)?youtube(?:-nocookie)?\.com$/i};function w(t){if(!(t!=null&&t.assetId)||t.type!=="vimeo"&&t.type!=="youtube")return null;try{const e=new URL(t.assetId);return!X[t.type].test(e.hostname)||t.type==="youtube"&&!e.pathname.startsWith("/embed/")?null:t.type}catch{return null}}function Y(t){return w(t)!==null}function I(t){const{width:e,height:r}=t;return e&&r&&e>0&&r>0?e/r:16/9}function R(t,e){const r=w(t);if(!r||!t.assetId)return t.assetId??"";const s=new URL(t.assetId),n=s.searchParams;return r==="vimeo"?(n.set("autoplay","1"),e==="background"&&(n.set("background","1"),n.set("muted","1"),n.set("loop","1"))):(n.set("autoplay","1"),n.set("playsinline","1"),n.set("rel","0"),e==="background"&&(n.set("mute","1"),n.set("loop","1"),n.set("playlist",s.pathname.slice(7)),n.set("controls","0"),n.set("modestbranding","1"))),s.toString()}function z(t,e,r){const s=t.width/t.height,n=r==="cover"?e<=s:e>=s,i=n?t.width:t.height*e,o=n?t.width/e:t.height;return{width:i,height:o,left:(t.width-i)/2,top:(t.height-o)/2}}const G=({media:t,mode:e,fit:r,interactive:s=e==="player",lazy:n=!0,style:i,...o})=>{const a=c.useRef(null),[l,m]=c.useState(null),[v,h]=c.useState(!n),S=I(t);c.useEffect(()=>{const u=a.current;if(!u||typeof ResizeObserver>"u")return;const g=()=>{const{width:E,height:x}=u.getBoundingClientRect();m(b=>b&&b.width===E&&b.height===x?b:{width:E,height:x})};g();const p=new ResizeObserver(g);return p.observe(u),()=>p.disconnect()},[]),c.useEffect(()=>{const u=a.current;if(!n||!u||typeof IntersectionObserver>"u"){h(!0);return}const g=new IntersectionObserver(([p])=>h(p.isIntersecting),{rootMargin:"200px"});return g.observe(u),()=>g.disconnect()},[n]);const d=l&&l.width>0&&l.height>0?z(l,S,r):null,{width:y,...j}=i??{},M={position:"relative",overflow:"hidden",aspectRatio:`${S}`,width:y===void 0||y==="auto"?"100%":y,...j},V={position:"absolute",inset:0,width:"100%",height:"100%",objectFit:r,pointerEvents:"none"};return f.jsxs("div",{ref:a,"data-embed-frame":"",style:M,...o,children:[t.thumbnail&&f.jsx("img",{src:t.thumbnail,alt:t.name??"",draggable:!1,style:V}),v&&d&&f.jsx("iframe",{src:R(t,e),title:t.name||"Embedded video",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,style:{position:"absolute",left:d.left,top:d.top,width:d.width,height:d.height,border:0,pointerEvents:s?"auto":"none"}})]})};exports.EmbedMediaFrame=G;exports.LinkWrapper=D;exports.buildColorVars=L;exports.getAvailableStatePanels=$;exports.getColorAlpha=W;exports.getEmbedAspect=I;exports.getEmbedPlayerSrc=R;exports.getEmbedProvider=w;exports.getFormFieldValidationError=_;exports.getUnavailableStates=q;exports.isEmbedMedia=Y;exports.isPanelAvailable=A;exports.isValidEmailFormat=F;exports.isValidPhoneFormat=P;exports.readTestimonialTextMeasure=N;exports.scalingValue=C;exports.useScopedStyles=B;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ee(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var b={exports:{}},re=b.exports,j;function te(){return j||(j=1,(function(c){(function(g,y){c.exports?c.exports=y():g.createHyphenator=y()})(re,function(){function g(r){var n="",e="",t=0,a=r();return function(i){for(;t<i.length;){n=i.charAt(t++),e=i.charAt(t);var u=a(n,e);if(u!==void 0)return u}}}var y=RegExp.prototype.test.bind(/\s|(?![\'])[\!-\@\[-\`\{-\~\u2013-\u203C]/);function R(){var r=!1;return function(n,e){return r?e[0]===">"&&(n(),r=!1):e[0]==="<"&&(!y(e[1])||e[1]==="/")&&(r=!0),r}}function D(r){var n=!1;return function(e,t){return n?!y(t[0])&&y(t[1])&&(e(),n=!1):!y(t[0])&&t[1]===r&&(n=!0),n}}function U(r,n){return function(){var e="",t="";function a(){e+=t,t=""}function i(u){return e="",t="",u}return function(u,E){t+=u;var l=r.reduce(function(h,s){return h||s(a,[u,E])},!1);if(!l&&(y(u)&&!y(E)&&a(),!y(u)&&y(E))){if(t.length>=n)return i([e,t]);a()}if(E==="")return(t.length<n||l)&&a(),i([e,t])}}}function q(r){for(var n=[],e=0;e<r.length;e++)(r[e]&1)===1&&n.push(e);return n}function L(r,n,e){if(e.length===0)return r;var t=[r.slice(0,e[0])];if(e.length>1)for(var a=0,i=1;i<e.length;a++,i++)t.push(r.slice(e[a],e[i]));return t.push(r.slice(e[e.length-1])),t.join(n)}function H(r){return r.reduce(function(n,e){for(var t=0,a=[];(t=e.indexOf("-",t+1))>-1;)a.push(t);return n[e.toLocaleLowerCase().replace(/\-/g,"")]=a,n},{})}function Y(r){var n=0;function e(){return r[n++]}return e}function V(r){var n=0,e=r;function t(){if(e=r.slice(n++),!(e.length<3))return e}function a(){return n===2}return[t,a]}function W(r,i,e,t){for(var a=new Array(r.length+1),i=("."+i+".").split(""),u,E,l,h,s,o,v=-1,N,p,d,_,T=a.length;T--;)a[T]=0;for(N=V(i),p=N[0],d=N[1];u=p();)for(v++,d()&&v--,l=t,_=Y(u);(E=_())&&(h=l[E])!==void 0;){switch(l={},s=-1,Object.prototype.toString.call(h)){case"[object Array]":l=h[0],s=h[1];break;case"[object Object]":l=h;break;case"[object Number]":s=h;break}if(!(s<0)){o=e[s];for(var f=0;f<o.length;f++)a[v+f]=Math.max(o[f],a[v+f])}}return a[0]=a[1]=a[a.length-1]=a[a.length-2]=0,q(a)}function X(r,n,e,t,a,i,u,E,l){function h(){N(s)}var s="",o,v=g(U((u?[R()]:[]).concat(D(i)),E)),N=function(){};function p(){for(var d=new Date;(!l||new Date-d<10)&&(o=v(r));){if(o[1]){var _=o[1].length?"~"+o[1]:"";if(!Object.prototype.hasOwnProperty.call(t,_)){var T=o[1].toLocaleLowerCase();Object.prototype.hasOwnProperty.call(a,T)||(a[T]=W(o[1],T,n,e)),t[_]=L(o[1],i,a[T])}o[1]=t[_]}s+=o[0]+o[1]}o?setTimeout(p):h()}return l?(setTimeout(p),new Promise(function(d){N=d})):(p(),s)}var $=!1,S=[],z=!0,B="",J=5,K="async",A="exceptions",Q="html",M="hyphenChar",I="minWordLength",Z=typeof G=="object"?G:typeof window=="object"?window:typeof self=="object"?self:{};function w(r,n){r=r||{};for(var e in n)r[e]=n[e];return r}function m(r){return r instanceof Array}function x(r,n,e,t){return n in r&&(!t||t(r[n]))?r[n]:e}function O(r,n){var e={};for(var t in r)e["~"+t]=L(t,n,r[t]);return e}function F(r,n){return r.reduce(function(e,t){return e["~"+t.replace(/\-/g,"")]=t.replace(/\-/g,n),e},{})}function k(r,n){n=n||{};var e=x(n,K,$),t={},a={},i={},u=x(n,M,B),E=r[0],l=r[1],h=x(n,I,J)>>0,s=x(n,Q,z),o=x(n,A,S,m),v=u+h;if(i[v]={},r[2]&&(i[v]=O(r[2],u),a=r[2]),o&&o.length&&(i[v]=w(i[v],F(o,u)),a=w(a,H(o))),t[v]=w({},i[v]),e&&!("Promise"in Z))throw new Error("Failed to create hyphenator: Could not find global Promise object, needed for hyphenator to work in async mode");return function(N,p){p=p||{};var d=x(p,M,u),_=x(p,I,h)>>0,T=x(p,A,S,m),f=d+_;return!i[f]&&r[2]&&(i[f]=O(r[2],d),t[f]=w(t[f],i[f])),T&&T.length&&(i[f]=w(i[f],F(T,d)),a=w(a,H(T)),t[f]=w(t[f],i[f])),X(N,E,l,t[f],a,d,s,_,e)}}return k})})(b)),b.exports}var C,P;function ne(){if(P)return C;P=1;var c=te();return C=function(g){return{hyphenate:c(g,{async:!0}),hyphenateHTML:c(g,{async:!0,html:!0}),hyphenateHTMLSync:c(g,{html:!0}),hyphenateSync:c(g),patterns:g}},C}exports.getDefaultExportFromCjs=ee;exports.requireExportContract=ne;
|