@zync/zync-screnplay-player 0.1.187

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.
Files changed (133) hide show
  1. package/dist/ZyncScreenplayPlayer.js +35 -0
  2. package/dist/bundle.js +2 -0
  3. package/dist/bundle.js.LICENSE.txt +54 -0
  4. package/dist/index.js +4 -0
  5. package/dist/screenplay/RemotionRenderer/RemotionRenderer.js +281 -0
  6. package/dist/screenplay/RemotionRenderer/Root.js +22 -0
  7. package/dist/screenplay/RemotionRenderer/components/LottieAnimationGlobal.js +116 -0
  8. package/dist/screenplay/RemotionRenderer/components/backgrounds/VirtualBackground.js +26 -0
  9. package/dist/screenplay/RemotionRenderer/components/backgrounds/VirtualBackgroundUnderlay.js +41 -0
  10. package/dist/screenplay/RemotionRenderer/components/captions/CaptionSimple.js +12 -0
  11. package/dist/screenplay/RemotionRenderer/components/effects/BrollFullscreen.js +27 -0
  12. package/dist/screenplay/RemotionRenderer/components/effects/GlitchText.js +22 -0
  13. package/dist/screenplay/RemotionRenderer/components/effects/HandoffNametag.js +7 -0
  14. package/dist/screenplay/RemotionRenderer/components/effects/LottieAnimation.js +64 -0
  15. package/dist/screenplay/RemotionRenderer/components/effects/Nametag.js +9 -0
  16. package/dist/screenplay/RemotionRenderer/components/effects/PhraseRainbowEffect.js +34 -0
  17. package/dist/screenplay/RemotionRenderer/components/effects/Sentence.js +50 -0
  18. package/dist/screenplay/RemotionRenderer/components/effects/Title.js +12 -0
  19. package/dist/screenplay/RemotionRenderer/components/layouts/BrollGreenScreen.js +742 -0
  20. package/dist/screenplay/RemotionRenderer/components/layouts/BrollSplitScreen.js +714 -0
  21. package/dist/screenplay/RemotionRenderer/components/layouts/BrollStudioBackdrop.js +620 -0
  22. package/dist/screenplay/RemotionRenderer/components/layouts/DynamicTriangle.js +618 -0
  23. package/dist/screenplay/RemotionRenderer/components/layouts/Handoff.js +161 -0
  24. package/dist/screenplay/RemotionRenderer/components/layouts/IntroVideo.js +1330 -0
  25. package/dist/screenplay/RemotionRenderer/components/layouts/KeyPointOverlayDepth.js +397 -0
  26. package/dist/screenplay/RemotionRenderer/components/layouts/Keyword.js +539 -0
  27. package/dist/screenplay/RemotionRenderer/components/layouts/KeywordStudioBackdrop.js +714 -0
  28. package/dist/screenplay/RemotionRenderer/components/layouts/MotionStill.js +381 -0
  29. package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillFullScreen.js +178 -0
  30. package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillGreenScreen.js +568 -0
  31. package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillGreenScreenV2.js +731 -0
  32. package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillStudioBackdrop.js +588 -0
  33. package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrame.js +183 -0
  34. package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameBroll.js +181 -0
  35. package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameSentence.js +17 -0
  36. package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameZoomCut.js +13 -0
  37. package/dist/screenplay/RemotionRenderer/components/layouts/TextWithVideo.js +373 -0
  38. package/dist/screenplay/RemotionRenderer/components/layouts/quote-bubble-animation.json +1 -0
  39. package/dist/screenplay/RemotionRenderer/components/utils/BlurOverlay.js +19 -0
  40. package/dist/screenplay/RemotionRenderer/components/utils/ChromaKeyedVideo.js +59 -0
  41. package/dist/screenplay/RemotionRenderer/components/utils/FaceCenteredVideo.js +562 -0
  42. package/dist/screenplay/RemotionRenderer/components/utils/PausableImg.js +124 -0
  43. package/dist/screenplay/RemotionRenderer/components/utils/README.md +80 -0
  44. package/dist/screenplay/RemotionRenderer/components/utils/SafeZones.js +69 -0
  45. package/dist/screenplay/RemotionRenderer/components/utils/StretchText.js +124 -0
  46. package/dist/screenplay/RemotionRenderer/components/utils/StretchTextDemo.js +66 -0
  47. package/dist/screenplay/RemotionRenderer/config.js +8 -0
  48. package/dist/screenplay/RemotionRenderer/development.js +1370 -0
  49. package/dist/screenplay/RemotionRenderer/helpers/cleanFacemetadata.js +29 -0
  50. package/dist/screenplay/RemotionRenderer/helpers/convertToSeconds.js +14 -0
  51. package/dist/screenplay/RemotionRenderer/helpers/faceBasedVideoStyles.js +212 -0
  52. package/dist/screenplay/RemotionRenderer/helpers/faceCenteredVideoTransforms.js +468 -0
  53. package/dist/screenplay/RemotionRenderer/helpers/getContrastColor.js +15 -0
  54. package/dist/screenplay/RemotionRenderer/helpers/getVideoOrientation.js +21 -0
  55. package/dist/screenplay/RemotionRenderer/helpers/hexToRgb.js +48 -0
  56. package/dist/screenplay/RemotionRenderer/hooks/useLottieReplaceColor.js +45 -0
  57. package/dist/screenplay/RemotionRenderer/hooks/useOrientationBased.js +29 -0
  58. package/dist/screenplay/RemotionRenderer/hooks/useTimeInterpolate.js +54 -0
  59. package/dist/screenplay/RemotionRenderer/hooks/useVirtualBackground.js +38 -0
  60. package/dist/screenplay/RemotionRenderer/index.js +3 -0
  61. package/dist/screenplay/RemotionRenderer/main/lib/Sequence.js +76 -0
  62. package/dist/screenplay/RemotionRenderer/main/lib/layouts/DefaultLayout.js +72 -0
  63. package/dist/screenplay/RemotionRenderer/main/lib/layouts/DynamicTriangleLayout.js +54 -0
  64. package/dist/screenplay/RemotionRenderer/main/lib/layouts/HandoffLayout.js +50 -0
  65. package/dist/screenplay/RemotionRenderer/main/lib/layouts/IntroVideoLayout.js +33 -0
  66. package/dist/screenplay/RemotionRenderer/main/lib/layouts/KeywordLayout.js +36 -0
  67. package/dist/screenplay/RemotionRenderer/main/lib/layouts/LayoutFactory.js +68 -0
  68. package/dist/screenplay/RemotionRenderer/main/lib/layouts/MotionStillLayout.js +36 -0
  69. package/dist/screenplay/RemotionRenderer/main/lib/layouts/SimpleFrameLayout.js +43 -0
  70. package/dist/screenplay/RemotionRenderer/main/lib/layouts/TextWithVideoLayout.js +52 -0
  71. package/dist/screenplay/RemotionRenderer/main/screenplaySchema.js +92 -0
  72. package/dist/screenplay/RemotionRenderer/registeredComponents.js +91 -0
  73. package/dist/screenplay/RemotionRenderer/theme/config.js +8 -0
  74. package/dist/screenplay/RemotionRenderer/theme/hooks/useTheme.js +24 -0
  75. package/dist/screenplay/RemotionRenderer/theme/hooks/useThemedComponents.js +101 -0
  76. package/dist/screenplay/RemotionRenderer/theme/themes/bigbold/BigBoldNameTag.js +147 -0
  77. package/dist/screenplay/RemotionRenderer/theme/themes/bigbold/BigBoldSentence.js +138 -0
  78. package/dist/screenplay/RemotionRenderer/theme/themes/bigbold/BigBoldTitle.js +136 -0
  79. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionColor.js +67 -0
  80. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionColorInverse.js +67 -0
  81. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionColorShadow.js +66 -0
  82. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionElegant.js +134 -0
  83. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionEmphasis.js +122 -0
  84. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionPunctuated.js +84 -0
  85. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBoom.js +88 -0
  86. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBubble.js +91 -0
  87. package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordPopup.js +118 -0
  88. package/dist/screenplay/RemotionRenderer/theme/themes/default/DefaultCaption.js +62 -0
  89. package/dist/screenplay/RemotionRenderer/theme/themes/default/HandoffNametag/handoffNametagConfig.js +59 -0
  90. package/dist/screenplay/RemotionRenderer/theme/themes/default/HandoffNametag.js +173 -0
  91. package/dist/screenplay/RemotionRenderer/theme/themes/default/Nametag.js +129 -0
  92. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/AnimatedSentence.js +20 -0
  93. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/AnimatedSentenceDefault.js +29 -0
  94. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/SentenceSimple.helpers.js +61 -0
  95. package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence.js +86 -0
  96. package/dist/screenplay/RemotionRenderer/theme/themes/default/Title.js +112 -0
  97. package/dist/screenplay/RemotionRenderer/theme/themes/default/constants.js +1 -0
  98. package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Nametag.js +134 -0
  99. package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Sentence.js +49 -0
  100. package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Title.js +108 -0
  101. package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/animations.js +30 -0
  102. package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/config.js +9 -0
  103. package/dist/screenplay/RemotionRenderer/theme/themes/glitch/GlitchNametag.js +252 -0
  104. package/dist/screenplay/RemotionRenderer/theme/themes/glitch/GlitchSentence.js +156 -0
  105. package/dist/screenplay/RemotionRenderer/theme/themes/glitch/GlitchTitle.js +142 -0
  106. package/dist/screenplay/RemotionRenderer/theme/themes/glitch/components/DisplacedText.js +66 -0
  107. package/dist/screenplay/RemotionRenderer/theme/themes/glitch/components/GlitchAnimatedLine.js +38 -0
  108. package/dist/screenplay/RemotionRenderer/theme/themes/glitch/components/SplitSentence.js +80 -0
  109. package/dist/screenplay/RemotionRenderer/theme/themes/glitch/helpers.js +32 -0
  110. package/dist/screenplay/RemotionRenderer/theme/themes/none/Nametag.js +3 -0
  111. package/dist/screenplay/RemotionRenderer/theme/themes/none/Title.js +3 -0
  112. package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/PushPullNametag.js +165 -0
  113. package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/PushPullSentence.js +94 -0
  114. package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/PushPullTitle.js +98 -0
  115. package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/designs/sentence.js +92 -0
  116. package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/designs/title.js +119 -0
  117. package/dist/screenplay/RemotionRenderer/theme/themes/sports/Nametag.js +122 -0
  118. package/dist/screenplay/RemotionRenderer/theme/themes/sports/SportsCaption.js +93 -0
  119. package/dist/screenplay/RemotionRenderer/theme/themes/sports/SportsSentence.js +76 -0
  120. package/dist/screenplay/RemotionRenderer/theme/themes/sports/Title.js +90 -0
  121. package/dist/screenplay/RemotionRenderer/theme/themes/sports/shared.js +62 -0
  122. package/dist/screenplay/RemotionRenderer/theme/themes/sportsbounce/Nametag.js +145 -0
  123. package/dist/screenplay/RemotionRenderer/theme/themes/sportsbounce/SportsBounceSentence.js +148 -0
  124. package/dist/screenplay/RemotionRenderer/theme/themes/sportsbounce/Title.js +160 -0
  125. package/dist/screenplay/RemotionRenderer/tracks/AudioTrack.js +23 -0
  126. package/dist/screenplay/RemotionRenderer/tracks/CaptionsVideoTrack.js +23 -0
  127. package/dist/screenplay/RemotionRenderer/tracks/DynamicVideoComposition.js +31 -0
  128. package/dist/screenplay/RemotionRenderer/tracks/EffectsVideoTrack.js +23 -0
  129. package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +141 -0
  130. package/dist/screenplay/RemotionRenderer/tracks/Soundtrack.js +16 -0
  131. package/dist/screenplay/RemotionRenderer/tracks/Watermark.js +23 -0
  132. package/dist/screenplay/RemotionRenderer/tracks/transitions/GlitchOne.js +92 -0
  133. package/package.json +45 -0
@@ -0,0 +1,714 @@
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); 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; } }
4
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ import React from "react";
8
+ import { AbsoluteFill, Audio, OffthreadVideo, useCurrentFrame, useVideoConfig, spring, interpolate, Easing } from "remotion";
9
+ import { loadFont } from "@remotion/google-fonts/Poppins";
10
+ import { useOrientationBased } from "../../hooks/useOrientationBased.js";
11
+ import { CHROME_PADDING } from "../../config.js";
12
+ import FaceCenteredVideo from "../utils/FaceCenteredVideo";
13
+ import PausableImg from "../utils/PausableImg";
14
+ import { BlurOverlay } from "../utils/BlurOverlay";
15
+ import { useVirtualBackground } from "../../hooks/useVirtualBackground";
16
+ import { VirtualBackground } from "../backgrounds/VirtualBackground";
17
+ import { distributeTextToFit } from "../../theme/themes/default/Sentence/SentenceSimple.helpers.js";
18
+
19
+ // Simple deterministic PRNG from a string seed
20
+ var seedFromString = function seedFromString(str) {
21
+ var h = 2166136261 >>> 0;
22
+ for (var i = 0; i < str.length; i++) {
23
+ h ^= str.charCodeAt(i);
24
+ h = Math.imul(h, 16777619);
25
+ }
26
+ return h >>> 0;
27
+ };
28
+ var mulberry32 = function mulberry32(a) {
29
+ return function () {
30
+ var t = a += 0x6d2b79f5;
31
+ t = Math.imul(t ^ t >>> 15, t | 1);
32
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
33
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
34
+ };
35
+ };
36
+ var seededRand = function seededRand(key) {
37
+ return mulberry32(seedFromString(key))();
38
+ };
39
+ var seededShuffle = function seededShuffle(arr, key) {
40
+ var rng = mulberry32(seedFromString(key));
41
+ var a = _toConsumableArray(arr);
42
+ for (var i = a.length - 1; i > 0; i--) {
43
+ var j = Math.floor(rng() * (i + 1));
44
+ var _ref = [a[j], a[i]];
45
+ a[i] = _ref[0];
46
+ a[j] = _ref[1];
47
+ }
48
+ return a;
49
+ };
50
+ var _loadFont = loadFont(),
51
+ fontFamily = _loadFont.fontFamily;
52
+
53
+ // Reuse the rotating words treatment from Keyword.jsx, but with
54
+ // spring-in + continuous sine/cos drift and better fitting.
55
+ var Word = function Word(_ref2) {
56
+ var word = _ref2.word,
57
+ index = _ref2.index,
58
+ fitParams = _ref2.fitParams,
59
+ _ref2$initialOffset = _ref2.initialOffset,
60
+ initialOffset = _ref2$initialOffset === void 0 ? {
61
+ x: 0,
62
+ y: 0
63
+ } : _ref2$initialOffset,
64
+ _ref2$driftScale = _ref2.driftScale,
65
+ driftScale = _ref2$driftScale === void 0 ? 1 : _ref2$driftScale;
66
+ // Fit lines similar to Keyword.jsx for backdrop usage
67
+ var _ref3 = fitParams || {},
68
+ maxWidth = _ref3.maxWidth,
69
+ maxHeight = _ref3.maxHeight,
70
+ maxFontSize = _ref3.maxFontSize;
71
+ var _distributeTextToFit = distributeTextToFit(word, maxWidth !== null && maxWidth !== void 0 ? maxWidth : 350, maxHeight !== null && maxHeight !== void 0 ? maxHeight : 120, maxFontSize !== null && maxFontSize !== void 0 ? maxFontSize : 54),
72
+ lines = _distributeTextToFit.lines,
73
+ fontSize = _distributeTextToFit.fontSize;
74
+ var frame = useCurrentFrame();
75
+ var _useVideoConfig = useVideoConfig(),
76
+ fps = _useVideoConfig.fps;
77
+
78
+ // Per-index delayed linear fade-in to avoid fast motion on start
79
+ var delay = index * 6;
80
+ var t = Math.max(0, frame - delay);
81
+ var opacityIn = interpolate(t, [0, 12], [0, 1], {
82
+ easing: Easing.linear,
83
+ extrapolateLeft: "clamp",
84
+ extrapolateRight: "clamp"
85
+ });
86
+
87
+ // Gentle continuous drift to keep the backdrop alive
88
+ var tSeconds = (frame + index * 10) / fps; // seconds
89
+ var amp = 26 * driftScale; // base amplitude with per-word scale
90
+ var driftX = amp * Math.sin(tSeconds * 0.7 + index);
91
+ var driftY = amp * 0.6 * Math.cos(tSeconds * 0.9 + index * 0.5);
92
+ return /*#__PURE__*/React.createElement("div", {
93
+ style: {
94
+ transform: "translate(".concat(((initialOffset.x || 0) + driftX).toFixed(2), "px, ").concat(((initialOffset.y || 0) + driftY).toFixed(2), "px)"),
95
+ display: "flex",
96
+ alignItems: "center",
97
+ gap: 30,
98
+ willChange: "transform",
99
+ opacity: opacityIn
100
+ }
101
+ }, /*#__PURE__*/React.createElement("div", {
102
+ style: {
103
+ position: "relative",
104
+ width: 3,
105
+ height: 3,
106
+ borderRadius: "100%",
107
+ backgroundColor: "white",
108
+ border: "1px solid white",
109
+ padding: 9,
110
+ opacity: 0.85
111
+ }
112
+ }, /*#__PURE__*/React.createElement("div", {
113
+ style: {
114
+ position: "absolute",
115
+ top: "50%",
116
+ left: "50%",
117
+ width: 45,
118
+ height: 45,
119
+ transform: "translate(-50%, -50%)",
120
+ borderRadius: "100%",
121
+ border: "1px solid white",
122
+ opacity: 0.6
123
+ }
124
+ })), /*#__PURE__*/React.createElement("p", {
125
+ style: {
126
+ color: "white",
127
+ textTransform: "uppercase",
128
+ fontWeight: 300,
129
+ letterSpacing: "10px",
130
+ fontSize: fontSize,
131
+ margin: 0,
132
+ height: 80,
133
+ display: "flex",
134
+ alignItems: "center",
135
+ gap: 20,
136
+ opacity: 0.95
137
+ }
138
+ }, lines.map(function (line, i) {
139
+ return /*#__PURE__*/React.createElement("span", {
140
+ key: i,
141
+ style: {
142
+ willChange: "transform"
143
+ }
144
+ }, line);
145
+ })));
146
+ };
147
+ var RotatingWordsContainer = /*#__PURE__*/React.memo(function (_ref4) {
148
+ var _ref4$words = _ref4.words,
149
+ words = _ref4$words === void 0 ? [] : _ref4$words,
150
+ cloudMargins = _ref4.cloudMargins,
151
+ cloudMinDistancePct = _ref4.cloudMinDistancePct,
152
+ cloudSpreadDurationSeconds = _ref4.cloudSpreadDurationSeconds;
153
+ var frame = useCurrentFrame();
154
+ var _useVideoConfig2 = useVideoConfig(),
155
+ fps = _useVideoConfig2.fps,
156
+ durationInFrames = _useVideoConfig2.durationInFrames;
157
+ // Determine output orientation to adjust layout behavior
158
+ var _useOrientationBased = useOrientationBased({
159
+ portrait: {},
160
+ landscape: {},
161
+ square: {}
162
+ }),
163
+ orientation = _useOrientationBased.orientation;
164
+ var isWide = orientation === "landscape";
165
+
166
+ // Orientation-based fitting for words and randomization settings
167
+ var fitBase = React.useMemo(function () {
168
+ if (orientation === "landscape") {
169
+ return {
170
+ maxWidth: 1920,
171
+ maxHeight: 1080,
172
+ baseMaxFontSize: 110
173
+ };
174
+ }
175
+ if (orientation === "portrait") {
176
+ // Smaller to accommodate doubled words and free layout
177
+ return {
178
+ maxWidth: 1080,
179
+ maxHeight: 1920,
180
+ baseMaxFontSize: 90
181
+ };
182
+ }
183
+ // square: even smaller to accommodate tripled words
184
+ return {
185
+ maxWidth: 1080,
186
+ maxHeight: 1080,
187
+ baseMaxFontSize: 80
188
+ };
189
+ }, [orientation]);
190
+
191
+ // Build repeated and shuffled words list for portrait/square
192
+ var repeats = isWide ? 1 : orientation === "portrait" ? 3 : 3;
193
+ var displayWords = React.useMemo(function () {
194
+ if (!(words !== null && words !== void 0 && words.length)) return [];
195
+ var base = [];
196
+ for (var r = 0; r < repeats; r++) {
197
+ for (var i = 0; i < words.length; i++) base.push(words[i]);
198
+ }
199
+ if (repeats === 1) return base;
200
+ return seededShuffle(base, "kw-cloud-".concat(orientation, "-").concat(words.join("|")));
201
+ }, [words, repeats, orientation]);
202
+
203
+ // Generate non-overlapping-ish positions for portrait/square using a
204
+ // deterministic Poisson-like rejection sampling on percentage space.
205
+ var cloudPositions = React.useMemo(function () {
206
+ var _cloudMargins$x, _cloudMargins$y;
207
+ if (isWide) return [];
208
+ var n = (displayWords === null || displayWords === void 0 ? void 0 : displayWords.length) || 0;
209
+ if (!n) return [];
210
+ var rng = mulberry32(seedFromString("kw-positions-".concat(orientation, "-").concat(displayWords.join("|"))));
211
+ var marginX = (_cloudMargins$x = cloudMargins === null || cloudMargins === void 0 ? void 0 : cloudMargins.x) !== null && _cloudMargins$x !== void 0 ? _cloudMargins$x : 28; // %
212
+ var marginY = (_cloudMargins$y = cloudMargins === null || cloudMargins === void 0 ? void 0 : cloudMargins.y) !== null && _cloudMargins$y !== void 0 ? _cloudMargins$y : orientation === "portrait" ? 10 : 38; // %
213
+ var baseDist = cloudMinDistancePct !== null && cloudMinDistancePct !== void 0 ? cloudMinDistancePct : orientation === "portrait" ? 14 : 11; // % center distance
214
+ var scale = Math.min(1, Math.sqrt(18 / Math.max(n, 1)));
215
+ var minDist = baseDist * scale; // %
216
+ var attemptsPerItem = 80;
217
+ var taken = [];
218
+ var positions = [];
219
+ for (var i = 0; i < n; i++) {
220
+ var placed = false;
221
+ for (var a = 0; a < attemptsPerItem; a++) {
222
+ var x = marginX + rng() * (100 - marginX * 2);
223
+ var y = marginY + rng() * (100 - marginY * 2);
224
+ var ok = true;
225
+ for (var j = 0; j < taken.length; j++) {
226
+ var dx = x - taken[j].x;
227
+ var dy = y - taken[j].y;
228
+ var dist = Math.hypot(dx, dy);
229
+ if (dist < minDist) {
230
+ ok = false;
231
+ break;
232
+ }
233
+ }
234
+ if (ok) {
235
+ taken.push({
236
+ x: x,
237
+ y: y
238
+ });
239
+ positions.push({
240
+ x: x,
241
+ y: y
242
+ });
243
+ placed = true;
244
+ break;
245
+ }
246
+ }
247
+ if (!placed) {
248
+ // Fallback: place on a ring with slightly smaller spacing
249
+ var angle = rng() * Math.PI * 2;
250
+ var r = 40 + rng() * 8; // 40-48% radius ring
251
+ var _x = 50 + r * Math.cos(angle) * 0.9;
252
+ var _y = 50 + r * Math.sin(angle) * 0.9;
253
+ taken.push({
254
+ x: _x,
255
+ y: _y
256
+ });
257
+ positions.push({
258
+ x: _x,
259
+ y: _y
260
+ });
261
+ }
262
+ }
263
+ return positions;
264
+ }, [isWide, displayWords, orientation, cloudMargins, cloudMinDistancePct]);
265
+ return /*#__PURE__*/React.createElement("div", {
266
+ style: {
267
+ fontFamily: fontFamily,
268
+ position: "absolute",
269
+ inset: 0
270
+ }
271
+ }, /*#__PURE__*/React.createElement("div", {
272
+ style: {
273
+ display: isWide ? "flex" : undefined,
274
+ flexDirection: isWide ? "column" : undefined,
275
+ position: isWide ? undefined : "relative",
276
+ height: "100%",
277
+ width: "100%",
278
+ justifyContent: isWide ? "space-evenly" : undefined,
279
+ alignItems: isWide ? "center" : undefined,
280
+ padding: isWide ? "4% 6%" : "2% 6%"
281
+ }
282
+ }, (isWide ? words : displayWords).map(function (word, index) {
283
+ var t = (frame + index * 8) / fps;
284
+ var sideParallaxY = Math.sin(t) * 12; // gentle vertical parallax
285
+ var sideParallaxYOpp = Math.cos(t * 0.9) * 10; // opposite phase for other side
286
+
287
+ // Deterministic per-word jitter for max font and initial offset
288
+ var seedKey = "".concat(word, "-").concat(index);
289
+ var r1 = seededRand(seedKey + "-a");
290
+ var r2 = seededRand(seedKey + "-b");
291
+ var r3 = seededRand(seedKey + "-c");
292
+ var r4 = seededRand(seedKey + "-d");
293
+
294
+ // Slight font jitter (+/-6%)
295
+ var fontJitter = 0.94 + r1 * 0.12; // [0.94, 1.06]
296
+ var fitParams = {
297
+ maxWidth: fitBase.maxWidth,
298
+ maxHeight: fitBase.maxHeight,
299
+ maxFontSize: Math.round(fitBase.baseMaxFontSize * fontJitter)
300
+ };
301
+
302
+ // Landscape: small initial offsets; Portrait/Square use absolute layout below
303
+ var initialOffset = isWide ? {
304
+ x: (r2 - 0.5) * 120,
305
+ // [-60, 60] px
306
+ y: (r3 - 0.5) * 60 // [-30, 30] px
307
+ } : {
308
+ x: 0,
309
+ y: 0
310
+ };
311
+
312
+ // Per-word drift scale, wider range for free layout cloud
313
+ var driftScale = isWide ? 1 : 0.7 + r4 * 0.9; // [0.7, 1.6]
314
+
315
+ return isWide ? /*#__PURE__*/React.createElement("div", {
316
+ key: "".concat(word, "-").concat(index),
317
+ style: {
318
+ position: "relative",
319
+ display: "flex",
320
+ alignItems: "center",
321
+ width: "100%",
322
+ minHeight: 80,
323
+ gap: "30px",
324
+ justifyContent: "flex-start"
325
+ }
326
+ }, /*#__PURE__*/React.createElement(Word, {
327
+ word: word,
328
+ index: index,
329
+ fitParams: fitParams,
330
+ initialOffset: initialOffset,
331
+ driftScale: driftScale
332
+ }), /*#__PURE__*/React.createElement("div", {
333
+ style: {
334
+ position: "absolute",
335
+ top: 0,
336
+ left: "75%",
337
+ transform: "translateY(".concat(sideParallaxY.toFixed(2), "px)"),
338
+ willChange: "transform",
339
+ pointerEvents: "none"
340
+ }
341
+ }, /*#__PURE__*/React.createElement(Word, {
342
+ word: word,
343
+ index: index,
344
+ fitParams: fitParams,
345
+ initialOffset: initialOffset,
346
+ driftScale: driftScale
347
+ })), /*#__PURE__*/React.createElement("div", {
348
+ style: {
349
+ position: "absolute",
350
+ top: 0,
351
+ left: "-75%",
352
+ transform: "translateY(".concat(sideParallaxYOpp.toFixed(2), "px)"),
353
+ willChange: "transform",
354
+ pointerEvents: "none"
355
+ }
356
+ }, /*#__PURE__*/React.createElement(Word, {
357
+ word: word,
358
+ index: index,
359
+ fitParams: fitParams,
360
+ initialOffset: initialOffset,
361
+ driftScale: driftScale
362
+ }))) :
363
+ /*#__PURE__*/
364
+ // Portrait/Square: absolute keyword cloud
365
+ React.createElement("div", {
366
+ key: "".concat(word, "-").concat(index),
367
+ style: {
368
+ position: "absolute",
369
+ // Time-evolving radial positions away from center; constant direction
370
+ left: function (_cloudMargins$x2, _cloudMargins$y2) {
371
+ var p = cloudPositions[index] || {
372
+ x: 50,
373
+ y: 50
374
+ };
375
+ var dx = p.x - 50;
376
+ var dy = p.y - 50;
377
+ var len = Math.hypot(dx, dy) || 1;
378
+ var ux = dx / len;
379
+ var uy = dy / len;
380
+ if (!isFinite(ux) || !isFinite(uy)) {
381
+ ux = 0.7071;
382
+ uy = 0.7071;
383
+ }
384
+ var marginX = (_cloudMargins$x2 = cloudMargins === null || cloudMargins === void 0 ? void 0 : cloudMargins.x) !== null && _cloudMargins$x2 !== void 0 ? _cloudMargins$x2 : 10;
385
+ var marginY = (_cloudMargins$y2 = cloudMargins === null || cloudMargins === void 0 ? void 0 : cloudMargins.y) !== null && _cloudMargins$y2 !== void 0 ? _cloudMargins$y2 : orientation === "portrait" ? 0 : 8;
386
+ var seconds = frame / fps;
387
+ var moveTime = Math.max(0.1, cloudSpreadDurationSeconds !== null && cloudSpreadDurationSeconds !== void 0 ? cloudSpreadDurationSeconds : durationInFrames / fps * 2);
388
+ var targetX = ux >= 0 ? 100 - marginX : marginX;
389
+ var targetY = uy >= 0 ? 100 - marginY : marginY;
390
+ var distX = Math.abs((targetX - p.x) / (ux || 1e-6));
391
+ var distY = Math.abs((targetY - p.y) / (uy || 1e-6));
392
+ var dAlong = Math.min(distX, distY);
393
+ var speedPct = dAlong / moveTime; // % per second along direction
394
+ var x = p.x + ux * seconds * speedPct;
395
+ var clamped = Math.max(marginX, Math.min(100 - marginX, x));
396
+ return "".concat(clamped.toFixed(2), "%");
397
+ }(),
398
+ top: function (_cloudMargins$x3, _cloudMargins$y3) {
399
+ var p = cloudPositions[index] || {
400
+ x: 50,
401
+ y: 50
402
+ };
403
+ var dx = p.x - 50;
404
+ var dy = p.y - 50;
405
+ var len = Math.hypot(dx, dy) || 1;
406
+ var ux = dx / len;
407
+ var uy = dy / len;
408
+ if (!isFinite(ux) || !isFinite(uy)) {
409
+ ux = 0.7071;
410
+ uy = 0.7071;
411
+ }
412
+ var marginX = (_cloudMargins$x3 = cloudMargins === null || cloudMargins === void 0 ? void 0 : cloudMargins.x) !== null && _cloudMargins$x3 !== void 0 ? _cloudMargins$x3 : 8;
413
+ var marginY = (_cloudMargins$y3 = cloudMargins === null || cloudMargins === void 0 ? void 0 : cloudMargins.y) !== null && _cloudMargins$y3 !== void 0 ? _cloudMargins$y3 : orientation === "portrait" ? 10 : 8;
414
+ var seconds = frame / fps;
415
+ var moveTime = Math.max(0.1, cloudSpreadDurationSeconds !== null && cloudSpreadDurationSeconds !== void 0 ? cloudSpreadDurationSeconds : durationInFrames / fps - 0.25);
416
+ var targetX = ux >= 0 ? 100 - marginX : marginX;
417
+ var targetY = uy >= 0 ? 100 - marginY : marginY;
418
+ var distX = Math.abs((targetX - p.x) / (ux || 1e-6));
419
+ var distY = Math.abs((targetY - p.y) / (uy || 1e-6));
420
+ var dAlong = Math.min(distX, distY);
421
+ var speedPct = dAlong / moveTime; // % per second along direction
422
+ var y = p.y + uy * seconds * speedPct;
423
+ var clamped = Math.max(marginY, Math.min(100 - marginY, y));
424
+ return "".concat(clamped.toFixed(2), "%");
425
+ }(),
426
+ transform: "translate(-50%, -50%)",
427
+ pointerEvents: "none"
428
+ }
429
+ }, /*#__PURE__*/React.createElement(Word, {
430
+ word: word,
431
+ index: index,
432
+ fitParams: fitParams,
433
+ initialOffset: initialOffset,
434
+ driftScale: 0
435
+ }));
436
+ })));
437
+ });
438
+ var BackdropFrame = function BackdropFrame(_ref5) {
439
+ var children = _ref5.children,
440
+ width = _ref5.width,
441
+ height = _ref5.height,
442
+ startVideoFrom = _ref5.startVideoFrom,
443
+ videoUrl = _ref5.videoUrl,
444
+ noBackgroundVideoUrl = _ref5.noBackgroundVideoUrl,
445
+ sourceVideoOrientation = _ref5.sourceVideoOrientation,
446
+ faceMetadata = _ref5.faceMetadata,
447
+ noBackgroundVideoEffects = _ref5.noBackgroundVideoEffects,
448
+ logoUrl = _ref5.logoUrl,
449
+ logoLeft = _ref5.logoLeft,
450
+ logoTop = _ref5.logoTop,
451
+ frameColor = _ref5.frameColor,
452
+ words = _ref5.words,
453
+ cloudMargins = _ref5.cloudMargins,
454
+ cloudMinDistancePct = _ref5.cloudMinDistancePct,
455
+ cloudSpreadDurationSeconds = _ref5.cloudSpreadDurationSeconds,
456
+ _ref5$containerInset = _ref5.containerInset,
457
+ containerInset = _ref5$containerInset === void 0 ? {
458
+ top: 0.1,
459
+ side: 0.05
460
+ } : _ref5$containerInset,
461
+ _ref5$backdropProgres = _ref5.backdropProgress,
462
+ backdropProgress = _ref5$backdropProgres === void 0 ? 1 : _ref5$backdropProgres,
463
+ showVirtual = _ref5.showVirtual,
464
+ virtualBgUrl = _ref5.virtualBgUrl;
465
+ // Backdrop container dimensions similar to StudioBackdrop
466
+ var containerWidth = width * (1 - containerInset.side * 2);
467
+ var containerHeight = height * (1 - containerInset.top * 2);
468
+ var aspect = 16 / 9;
469
+ var maxBackdropWidth = Math.min(containerWidth, containerHeight * aspect);
470
+ var finalBackdropHeight = maxBackdropWidth / aspect;
471
+ var currentBackdropHeight = finalBackdropHeight * backdropProgress;
472
+ var backdropTop = height * containerInset.top;
473
+ var backdropLeft = width * containerInset.side + (containerWidth - maxBackdropWidth) / 2;
474
+ return /*#__PURE__*/React.createElement(AbsoluteFill, {
475
+ style: {
476
+ backgroundColor: frameColor || "transparent",
477
+ padding: 0,
478
+ isolation: "isolate"
479
+ }
480
+ }, /*#__PURE__*/React.createElement("div", {
481
+ style: {
482
+ position: "absolute",
483
+ overflow: "hidden",
484
+ width: width,
485
+ height: height,
486
+ top: 0,
487
+ left: 0,
488
+ zIndex: 1
489
+ }
490
+ }, showVirtual && virtualBgUrl ? /*#__PURE__*/React.createElement(VirtualBackground, {
491
+ url: virtualBgUrl,
492
+ zIndex: 1
493
+ }) : null, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
494
+ startFrom: startVideoFrom,
495
+ src: videoUrl,
496
+ muted: true,
497
+ transparent: false,
498
+ faceMetadata: faceMetadata,
499
+ containerWidth: width,
500
+ containerHeight: height,
501
+ useAveragePosition: true,
502
+ centerHorizontally: false
503
+ }) : /*#__PURE__*/React.createElement(OffthreadVideo, {
504
+ startFrom: startVideoFrom,
505
+ src: videoUrl,
506
+ muted: true,
507
+ transparent: false,
508
+ style: {
509
+ height: "100%",
510
+ objectFit: "cover",
511
+ width: "100%",
512
+ objectPosition: sourceVideoOrientation === "portrait" ? "0% 30%" : undefined
513
+ }
514
+ })), /*#__PURE__*/React.createElement(BlurOverlay, {
515
+ show: !showVirtual && (noBackgroundVideoEffects === null || noBackgroundVideoEffects === void 0 ? void 0 : noBackgroundVideoEffects.backgroundBlur) && noBackgroundVideoUrl,
516
+ width: width,
517
+ height: height,
518
+ zIndex: 1
519
+ }), backdropProgress > 0 && /*#__PURE__*/React.createElement("div", {
520
+ style: {
521
+ position: "absolute",
522
+ overflow: "hidden",
523
+ top: 0,
524
+ left: 0,
525
+ width: width,
526
+ height: height,
527
+ zIndex: 2,
528
+ opacity: 0.85 * backdropProgress,
529
+ borderRadius: "14px",
530
+ border: "16px solid rgba(255, 255, 255, 0.2)",
531
+ boxShadow: "0 10px 36px rgba(0, 0, 0, 0.35)",
532
+ backdropFilter: "blur(1.5px)",
533
+ WebkitBackdropFilter: "blur(1.5px)"
534
+ }
535
+ }, /*#__PURE__*/React.createElement(OffthreadVideo, {
536
+ style: {
537
+ objectFit: "cover",
538
+ width: "100%",
539
+ height: "100%",
540
+ mixBlendMode: "screen",
541
+ opacity: 0.35 // softer integration
542
+ },
543
+ src: "https://storage.googleapis.com/zync-media/assets/static/plexus1.mov",
544
+ startFrom: 120,
545
+ muted: true
546
+ }), /*#__PURE__*/React.createElement(RotatingWordsContainer, {
547
+ words: words,
548
+ cloudMargins: cloudMargins,
549
+ cloudMinDistancePct: cloudMinDistancePct,
550
+ cloudSpreadDurationSeconds: cloudSpreadDurationSeconds
551
+ }), /*#__PURE__*/React.createElement("div", {
552
+ style: {
553
+ position: "absolute",
554
+ inset: 0,
555
+ pointerEvents: "none",
556
+ background: "radial-gradient(80% 80% at 50% 50%, rgba(255,255,255,0) 60%, rgba(0,0,0,0.25) 100%)",
557
+ mixBlendMode: "soft-light"
558
+ }
559
+ })), /*#__PURE__*/React.createElement("div", {
560
+ style: {
561
+ position: "absolute",
562
+ overflow: "hidden",
563
+ width: width,
564
+ height: height,
565
+ top: 0,
566
+ left: 0,
567
+ zIndex: 3
568
+ }
569
+ }, faceMetadata ? /*#__PURE__*/React.createElement(FaceCenteredVideo, {
570
+ startFrom: startVideoFrom,
571
+ src: noBackgroundVideoUrl,
572
+ muted: false,
573
+ transparent: true,
574
+ faceMetadata: faceMetadata,
575
+ containerWidth: width,
576
+ containerHeight: height,
577
+ useAveragePosition: true,
578
+ centerHorizontally: false,
579
+ noBackgroundVideoEffects: noBackgroundVideoEffects
580
+ }) : /*#__PURE__*/React.createElement(OffthreadVideo, {
581
+ startFrom: startVideoFrom,
582
+ src: noBackgroundVideoUrl,
583
+ muted: false,
584
+ transparent: true,
585
+ style: {
586
+ height: "100%",
587
+ objectFit: "cover",
588
+ width: "100%",
589
+ filter: noBackgroundVideoEffects !== null && noBackgroundVideoEffects !== void 0 && noBackgroundVideoEffects.facePop && noBackgroundVideoUrl ? "brightness(1.1) contrast(1.15) saturate(1.05)" : undefined,
590
+ objectPosition: sourceVideoOrientation === "portrait" ? "0% 30%" : undefined
591
+ }
592
+ })), /*#__PURE__*/React.createElement(AbsoluteFill, {
593
+ style: {
594
+ zIndex: 14
595
+ }
596
+ }, children), logoUrl ? /*#__PURE__*/React.createElement("div", {
597
+ style: {
598
+ position: "fixed",
599
+ left: logoLeft,
600
+ top: logoTop,
601
+ padding: 20,
602
+ zIndex: 10
603
+ }
604
+ }, /*#__PURE__*/React.createElement(PausableImg, {
605
+ delayRenderTimeoutInMilliseconds: 61000,
606
+ style: {
607
+ width: "225px",
608
+ maxHeight: "auto",
609
+ objectFit: "contain"
610
+ },
611
+ src: logoUrl
612
+ })) : null);
613
+ };
614
+ var KeywordStudioBackdrop = function KeywordStudioBackdrop(_ref6) {
615
+ var videoUrl = _ref6.videoUrl,
616
+ startVideoFrom = _ref6.startVideoFrom,
617
+ _ref6$words = _ref6.words,
618
+ words = _ref6$words === void 0 ? [] : _ref6$words,
619
+ frameColor = _ref6.frameColor,
620
+ logoUrl = _ref6.logoUrl,
621
+ children = _ref6.children,
622
+ sourceVideoOrientation = _ref6.sourceVideoOrientation,
623
+ _ref6$disableTransiti = _ref6.disableTransitionSounds,
624
+ disableTransitionSounds = _ref6$disableTransiti === void 0 ? false : _ref6$disableTransiti,
625
+ noBackgroundVideoUrl = _ref6.noBackgroundVideoUrl,
626
+ durationInFrames = _ref6.durationInFrames,
627
+ faceMetadata = _ref6.faceMetadata,
628
+ muted = _ref6.muted,
629
+ noBackgroundVideoEffects = _ref6.noBackgroundVideoEffects,
630
+ cloudMargins = _ref6.cloudMargins,
631
+ cloudMinDistancePct = _ref6.cloudMinDistancePct,
632
+ cloudSpreadDurationSeconds = _ref6.cloudSpreadDurationSeconds;
633
+ var _useVideoConfig3 = useVideoConfig(),
634
+ width = _useVideoConfig3.width,
635
+ height = _useVideoConfig3.height,
636
+ fps = _useVideoConfig3.fps;
637
+ var frame = useCurrentFrame();
638
+ var _useVirtualBackground = useVirtualBackground(),
639
+ isVirtual = _useVirtualBackground.isVirtual,
640
+ virtualBgUrl = _useVirtualBackground.url;
641
+ var showVirtual = isVirtual && !!noBackgroundVideoUrl;
642
+ var _useOrientationBased2 = useOrientationBased({
643
+ portrait: {
644
+ logoTop: CHROME_PADDING * 2,
645
+ logoLeft: CHROME_PADDING * 2
646
+ },
647
+ landscape: {
648
+ logoTop: CHROME_PADDING * 2,
649
+ logoLeft: CHROME_PADDING * 2
650
+ },
651
+ square: {
652
+ logoTop: CHROME_PADDING * 2,
653
+ logoLeft: CHROME_PADDING * 2
654
+ }
655
+ }),
656
+ logoTop = _useOrientationBased2.logoTop,
657
+ logoLeft = _useOrientationBased2.logoLeft;
658
+
659
+ // Spring entrance/exit for backdrop reveal
660
+ var entranceEndFrame = fps * 0.5; // 0.5s
661
+ var exitStartFrame = Math.max(0, (durationInFrames || fps * 2) - fps * 1.5); // 1.5s before end
662
+
663
+ var backdropProgress = 0;
664
+ if (frame <= entranceEndFrame) {
665
+ backdropProgress = spring({
666
+ frame: frame,
667
+ fps: fps,
668
+ config: {
669
+ damping: 100,
670
+ stiffness: 160,
671
+ mass: 1
672
+ }
673
+ });
674
+ } else if (frame >= exitStartFrame) {
675
+ var exitFrame = frame - exitStartFrame;
676
+ var exitSpring = spring({
677
+ frame: exitFrame,
678
+ fps: fps,
679
+ config: {
680
+ damping: 300,
681
+ stiffness: 80,
682
+ mass: 4
683
+ }
684
+ });
685
+ backdropProgress = 1 - exitSpring;
686
+ } else {
687
+ backdropProgress = 1;
688
+ }
689
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !disableTransitionSounds && /*#__PURE__*/React.createElement(Audio, {
690
+ src: "https://cdn.zync.ai/assets/static/swoosh.mp3",
691
+ volume: 0.25
692
+ }), /*#__PURE__*/React.createElement(BackdropFrame, {
693
+ width: width,
694
+ height: height,
695
+ startVideoFrom: startVideoFrom,
696
+ videoUrl: videoUrl,
697
+ noBackgroundVideoUrl: noBackgroundVideoUrl,
698
+ sourceVideoOrientation: sourceVideoOrientation,
699
+ faceMetadata: faceMetadata,
700
+ noBackgroundVideoEffects: noBackgroundVideoEffects,
701
+ logoUrl: logoUrl,
702
+ logoLeft: logoLeft,
703
+ logoTop: logoTop,
704
+ frameColor: frameColor,
705
+ words: words,
706
+ cloudMargins: cloudMargins,
707
+ cloudMinDistancePct: cloudMinDistancePct,
708
+ cloudSpreadDurationSeconds: cloudSpreadDurationSeconds,
709
+ backdropProgress: backdropProgress,
710
+ showVirtual: showVirtual,
711
+ virtualBgUrl: virtualBgUrl
712
+ }, children));
713
+ };
714
+ export { KeywordStudioBackdrop };