@riverbankcms/sdk 0.72.0 → 0.75.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.
Files changed (146) hide show
  1. package/README.md +1 -1
  2. package/dist/{PreviewEditorSidebar-44T64SAR.mjs → PreviewEditorSidebar-U2IHCBYN.mjs} +3 -3
  3. package/dist/{PreviewEditorUI-4WKHZTXW.mjs → PreviewEditorUI-ZGH2RQNP.mjs} +3 -3
  4. package/dist/SdkPreviewModeRuntime-MTUGBTLQ.mjs +8 -0
  5. package/dist/_dts/ai/src/contracts/proposals.d.ts +10 -10
  6. package/dist/_dts/api/src/cache-tags.d.ts +22 -0
  7. package/dist/_dts/api/src/contentRuntime.d.ts +1 -0
  8. package/dist/_dts/api/src/endpoints.d.ts +24 -24
  9. package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +2 -1
  10. package/dist/_dts/block-form/src/blockDraftSaveability.d.ts +4 -1
  11. package/dist/_dts/blocks/src/client/booking-form.d.ts +2 -0
  12. package/dist/_dts/blocks/src/client/carousel.d.ts +1 -0
  13. package/dist/_dts/blocks/src/client/course-registration.d.ts +2 -0
  14. package/dist/_dts/blocks/src/client/events.d.ts +4 -0
  15. package/dist/_dts/blocks/src/client/form.d.ts +2 -0
  16. package/dist/_dts/blocks/src/client/header.d.ts +1 -0
  17. package/dist/_dts/blocks/src/client/location-map.d.ts +1 -0
  18. package/dist/_dts/blocks/src/client/newsletter-form.d.ts +2 -0
  19. package/dist/_dts/blocks/src/client/shop.d.ts +6 -0
  20. package/dist/_dts/blocks/src/lib/video.d.ts +2 -0
  21. package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +21 -1
  22. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +6 -6
  23. package/dist/_dts/blocks/src/system/node/fragments/backgroundLayer.d.ts +15 -1
  24. package/dist/_dts/blocks/src/system/node/fragments/styledSection.d.ts +11 -0
  25. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +1 -0
  26. package/dist/_dts/blocks/src/system/runtime/header/enhanceHeaderSection.d.ts +13 -0
  27. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +3 -2
  28. package/dist/_dts/blocks/src/system/runtime/nodes/events/index.d.ts +3 -0
  29. package/dist/_dts/blocks/src/system/runtime/nodes/header-section.client.d.ts +1 -0
  30. package/dist/_dts/blocks/src/system/runtime/nodes/header-section.server.d.ts +1 -0
  31. package/dist/_dts/blocks/src/system/runtime/nodes/media.d.ts +6 -0
  32. package/dist/_dts/content-editor/src/hooks/validateBlocksForPublish.d.ts +5 -0
  33. package/dist/_dts/preview-next/src/client/preview/SiteChromeEditableSurface.d.ts +12 -2
  34. package/dist/_dts/sdk/src/public-api/contracts.d.ts +1 -0
  35. package/dist/_dts/sdk/src/rendering/components/Layout.d.ts +2 -2
  36. package/dist/_dts/sdk/src/rendering/islands/deferredVideoEmbeds.d.ts +2 -0
  37. package/dist/_dts/sdk/src/rendering/islands/enhancers/accordion.d.ts +1 -0
  38. package/dist/_dts/sdk/src/rendering/islands/enhancers/bookingForm.d.ts +1 -0
  39. package/dist/_dts/sdk/src/rendering/islands/enhancers/carousel.d.ts +1 -0
  40. package/dist/_dts/sdk/src/rendering/islands/enhancers/cart.d.ts +1 -0
  41. package/dist/_dts/sdk/src/rendering/islands/enhancers/checkout.d.ts +1 -0
  42. package/dist/_dts/sdk/src/rendering/islands/enhancers/courseRegistration.d.ts +1 -0
  43. package/dist/_dts/sdk/src/rendering/islands/enhancers/eventCalendar.d.ts +1 -0
  44. package/dist/_dts/sdk/src/rendering/islands/enhancers/eventCombined.d.ts +1 -0
  45. package/dist/_dts/sdk/src/rendering/islands/enhancers/eventDetails.d.ts +1 -0
  46. package/dist/_dts/sdk/src/rendering/islands/enhancers/eventListing.d.ts +1 -0
  47. package/dist/_dts/sdk/src/rendering/islands/enhancers/eventRegistration.d.ts +1 -0
  48. package/dist/_dts/sdk/src/rendering/islands/enhancers/form.d.ts +1 -0
  49. package/dist/_dts/sdk/src/rendering/islands/enhancers/headerSection.d.ts +1 -0
  50. package/dist/_dts/sdk/src/rendering/islands/enhancers/locationMap.d.ts +1 -0
  51. package/dist/_dts/sdk/src/rendering/islands/enhancers/newsletterForm.d.ts +1 -0
  52. package/dist/_dts/sdk/src/rendering/islands/enhancers/productDetail.d.ts +1 -0
  53. package/dist/_dts/sdk/src/rendering/islands/enhancers/productList.d.ts +1 -0
  54. package/dist/_dts/sdk/src/rendering/islands/enhancers/shop.d.ts +1 -0
  55. package/dist/_dts/sdk/src/rendering/islands/hydrateBlocksIslands.d.ts +2 -2
  56. package/dist/_dts/sdk/src/rendering/islands/propsDecoder.d.ts +7 -0
  57. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +9 -0
  58. package/dist/_dts/sdk/src/rendering/server.d.ts +3 -0
  59. package/dist/_dts/sdk/src/version.d.ts +1 -1
  60. package/dist/_dts/theme-core/src/accordions/types.d.ts +3 -3
  61. package/dist/_dts/theme-core/src/buttons/personalities/types.d.ts +7 -7
  62. package/dist/_dts/theme-core/src/buttons/types.d.ts +20 -20
  63. package/dist/_dts/theme-core/src/cards/types.d.ts +2 -2
  64. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  65. package/dist/_dts/theme-core/src/header/navDropdownSizing.d.ts +7 -0
  66. package/dist/_dts/theme-core/src/inputs/types.d.ts +3 -3
  67. package/dist/_dts/theme-core/src/interactive/baseSchema.d.ts +1 -1
  68. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +156 -156
  69. package/dist/_dts/theme-core/src/navigation/types.d.ts +1 -1
  70. package/dist/_dts/theme-core/src/palette/variants/types.d.ts +4 -4
  71. package/dist/_dts/theme-core/src/schema.d.ts +178 -178
  72. package/dist/_dts/theme-core/src/shared/componentStyles.d.ts +2 -2
  73. package/dist/_dts/theme-core/src/site-styles/designState.d.ts +8 -8
  74. package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +5 -5
  75. package/dist/_dts/theme-core/src/tokens/themeColorTokens.d.ts +2 -2
  76. package/dist/{chunk-G4NLITC2.mjs → chunk-BGMNDF6T.mjs} +7 -7
  77. package/dist/{chunk-3YNCQG5N.mjs → chunk-GFE74WRD.mjs} +457 -98
  78. package/dist/{chunk-HV745JYE.mjs → chunk-RWXQBRQZ.mjs} +1 -1
  79. package/dist/{chunk-7RX72SK2.mjs → chunk-VX7B5VAC.mjs} +36 -25
  80. package/dist/{chunk-YRJKZEQ3.mjs → chunk-Z7JLNTJR.mjs} +1 -1
  81. package/dist/{chunk-KWQPAJYS.mjs → chunk-ZSHFGFUG.mjs} +2 -2
  82. package/dist/cli/index.mjs +3498 -3826
  83. package/dist/client/accordion-T2UD2ZTH.mjs +120 -0
  84. package/dist/client/altcha-LIGLPZS5.mjs +2755 -0
  85. package/dist/client/bookingForm-GUP75FKN.mjs +3022 -0
  86. package/dist/client/bookings.mjs +32 -10
  87. package/dist/client/carousel-2NQA6V57.mjs +47 -0
  88. package/dist/client/cart-5TFIAFDS.mjs +18 -0
  89. package/dist/client/checkout-TP4WAHZE.mjs +18 -0
  90. package/dist/client/chunk-2PHQZ666.mjs +383 -0
  91. package/dist/client/chunk-3DCJ45Z2.mjs +36 -0
  92. package/dist/client/chunk-3PEDD5KJ.mjs +146 -0
  93. package/dist/client/chunk-CY2ZTSE5.mjs +204 -0
  94. package/dist/client/chunk-F7LHOKEH.mjs +146 -0
  95. package/dist/client/chunk-FU2QRZMX.mjs +7617 -0
  96. package/dist/client/chunk-I2MMZO53.mjs +6 -0
  97. package/dist/client/chunk-II7O4XN3.mjs +2206 -0
  98. package/dist/client/chunk-M3L3KYYR.mjs +1181 -0
  99. package/dist/client/chunk-N7PBWBWQ.mjs +26 -0
  100. package/dist/client/chunk-NWOUL6JY.mjs +1378 -0
  101. package/dist/client/chunk-OJPZEZU2.mjs +31 -0
  102. package/dist/client/chunk-PMAIXMAB.mjs +1960 -0
  103. package/dist/client/chunk-RTZ3JKKX.mjs +178 -0
  104. package/dist/client/chunk-TQ5MSPDX.mjs +74 -0
  105. package/dist/client/chunk-VUAOE3AG.mjs +5592 -0
  106. package/dist/client/chunk-WJXXNDSE.mjs +245 -0
  107. package/dist/client/chunk-YLMKMCSJ.mjs +86 -0
  108. package/dist/client/chunk-ZLMS67RR.mjs +106 -0
  109. package/dist/client/client.mjs +51865 -52071
  110. package/dist/client/courseRegistration-5DPU6PDY.mjs +1737 -0
  111. package/dist/client/eventCalendar-F3GZGTEF.mjs +40 -0
  112. package/dist/client/eventCombined-BQOB6QMY.mjs +37 -0
  113. package/dist/client/eventDetails-PEM2EJWE.mjs +25 -0
  114. package/dist/client/eventListing-YMIQPVME.mjs +40 -0
  115. package/dist/client/eventRegistration-4I6ZNDUF.mjs +40 -0
  116. package/dist/client/form-ZJVAYZ6G.mjs +300 -0
  117. package/dist/client/headerSection-TOT5MGTF.mjs +729 -0
  118. package/dist/client/hooks.mjs +91 -42
  119. package/dist/client/locationMap-J66NZREU.mjs +227 -0
  120. package/dist/client/newsletterForm-ET2XUMRO.mjs +208 -0
  121. package/dist/client/productDetail-C2XIH7C5.mjs +18 -0
  122. package/dist/client/productList-T2AZLFTP.mjs +18 -0
  123. package/dist/client/rendering/client.mjs +12796 -18295
  124. package/dist/client/rendering/islands.mjs +108 -44022
  125. package/dist/client/rendering.mjs +45141 -45346
  126. package/dist/client/shop-UZ6IUZXD.mjs +20 -0
  127. package/dist/preview-next/before-render.mjs +37 -25
  128. package/dist/preview-next/client/runtime.mjs +5 -5
  129. package/dist/preview-next/middleware.mjs +37 -25
  130. package/dist/{sdk-runtime-NGDWSWOS.mjs → sdk-runtime-JCUQM63Y.mjs} +6 -6
  131. package/dist/server/components.mjs +472 -276
  132. package/dist/server/config-validation.mjs +91 -42
  133. package/dist/server/config.mjs +91 -42
  134. package/dist/server/data.mjs +91 -42
  135. package/dist/server/index.mjs +45 -33
  136. package/dist/server/next.mjs +468 -272
  137. package/dist/server/page-converter.mjs +41 -17
  138. package/dist/server/prebuild.mjs +1 -1
  139. package/dist/server/rendering/server.mjs +556 -275
  140. package/dist/server/rendering.mjs +474 -278
  141. package/dist/server/routing.mjs +99 -43
  142. package/dist/server/server.mjs +92 -43
  143. package/dist/server/theme-bridge.mjs +29 -0
  144. package/dist/styles/index.css +16 -0
  145. package/package.json +2 -1
  146. package/dist/SdkPreviewModeRuntime-FO6V7YVY.mjs +0 -8
@@ -0,0 +1,2206 @@
1
+ "use client";
2
+ import { ChevronLeft, ChevronRight } from './chunk-RTZ3JKKX.mjs';
3
+ import { clsx_default } from './chunk-PMAIXMAB.mjs';
4
+ import React, { useRef, useState, useCallback, useEffect } from 'react';
5
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
6
+
7
+ // ../../node_modules/.pnpm/embla-carousel-autoplay@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-autoplay/esm/embla-carousel-autoplay.esm.js
8
+ var defaultOptions = {
9
+ active: true,
10
+ breakpoints: {},
11
+ delay: 4e3,
12
+ jump: false,
13
+ playOnInit: true,
14
+ stopOnFocusIn: true,
15
+ stopOnInteraction: true,
16
+ stopOnMouseEnter: false,
17
+ stopOnLastSnap: false,
18
+ rootNode: null
19
+ };
20
+ function normalizeDelay(emblaApi, delay) {
21
+ const scrollSnaps = emblaApi.scrollSnapList();
22
+ if (typeof delay === "number") {
23
+ return scrollSnaps.map(() => delay);
24
+ }
25
+ return delay(scrollSnaps, emblaApi);
26
+ }
27
+ function getAutoplayRootNode(emblaApi, rootNode) {
28
+ const emblaRootNode = emblaApi.rootNode();
29
+ return rootNode && rootNode(emblaRootNode) || emblaRootNode;
30
+ }
31
+ function Autoplay(userOptions = {}) {
32
+ let options;
33
+ let emblaApi;
34
+ let destroyed;
35
+ let delay;
36
+ let timerStartTime = null;
37
+ let timerId = 0;
38
+ let autoplayActive = false;
39
+ let mouseIsOver = false;
40
+ let playOnDocumentVisible = false;
41
+ let jump = false;
42
+ function init(emblaApiInstance, optionsHandler) {
43
+ emblaApi = emblaApiInstance;
44
+ const {
45
+ mergeOptions,
46
+ optionsAtMedia
47
+ } = optionsHandler;
48
+ const optionsBase = mergeOptions(defaultOptions, Autoplay.globalOptions);
49
+ const allOptions = mergeOptions(optionsBase, userOptions);
50
+ options = optionsAtMedia(allOptions);
51
+ if (emblaApi.scrollSnapList().length <= 1) return;
52
+ jump = options.jump;
53
+ destroyed = false;
54
+ delay = normalizeDelay(emblaApi, options.delay);
55
+ const {
56
+ eventStore,
57
+ ownerDocument
58
+ } = emblaApi.internalEngine();
59
+ const isDraggable = !!emblaApi.internalEngine().options.watchDrag;
60
+ const root = getAutoplayRootNode(emblaApi, options.rootNode);
61
+ eventStore.add(ownerDocument, "visibilitychange", visibilityChange);
62
+ if (isDraggable) {
63
+ emblaApi.on("pointerDown", pointerDown);
64
+ }
65
+ if (isDraggable && !options.stopOnInteraction) {
66
+ emblaApi.on("pointerUp", pointerUp);
67
+ }
68
+ if (options.stopOnMouseEnter) {
69
+ eventStore.add(root, "mouseenter", mouseEnter);
70
+ }
71
+ if (options.stopOnMouseEnter && !options.stopOnInteraction) {
72
+ eventStore.add(root, "mouseleave", mouseLeave);
73
+ }
74
+ if (options.stopOnFocusIn) {
75
+ emblaApi.on("slideFocusStart", stopAutoplay);
76
+ }
77
+ if (options.stopOnFocusIn && !options.stopOnInteraction) {
78
+ eventStore.add(emblaApi.containerNode(), "focusout", startAutoplay);
79
+ }
80
+ if (options.playOnInit) startAutoplay();
81
+ }
82
+ function destroy() {
83
+ emblaApi.off("pointerDown", pointerDown).off("pointerUp", pointerUp).off("slideFocusStart", stopAutoplay);
84
+ stopAutoplay();
85
+ destroyed = true;
86
+ autoplayActive = false;
87
+ }
88
+ function setTimer() {
89
+ const {
90
+ ownerWindow
91
+ } = emblaApi.internalEngine();
92
+ ownerWindow.clearTimeout(timerId);
93
+ timerId = ownerWindow.setTimeout(next, delay[emblaApi.selectedScrollSnap()]);
94
+ timerStartTime = (/* @__PURE__ */ new Date()).getTime();
95
+ emblaApi.emit("autoplay:timerset");
96
+ }
97
+ function clearTimer() {
98
+ const {
99
+ ownerWindow
100
+ } = emblaApi.internalEngine();
101
+ ownerWindow.clearTimeout(timerId);
102
+ timerId = 0;
103
+ timerStartTime = null;
104
+ emblaApi.emit("autoplay:timerstopped");
105
+ }
106
+ function startAutoplay() {
107
+ if (destroyed) return;
108
+ if (documentIsHidden()) {
109
+ playOnDocumentVisible = true;
110
+ return;
111
+ }
112
+ if (!autoplayActive) emblaApi.emit("autoplay:play");
113
+ setTimer();
114
+ autoplayActive = true;
115
+ }
116
+ function stopAutoplay() {
117
+ if (destroyed) return;
118
+ if (autoplayActive) emblaApi.emit("autoplay:stop");
119
+ clearTimer();
120
+ autoplayActive = false;
121
+ }
122
+ function visibilityChange() {
123
+ if (documentIsHidden()) {
124
+ playOnDocumentVisible = autoplayActive;
125
+ return stopAutoplay();
126
+ }
127
+ if (playOnDocumentVisible) startAutoplay();
128
+ }
129
+ function documentIsHidden() {
130
+ const {
131
+ ownerDocument
132
+ } = emblaApi.internalEngine();
133
+ return ownerDocument.visibilityState === "hidden";
134
+ }
135
+ function pointerDown() {
136
+ if (!mouseIsOver) stopAutoplay();
137
+ }
138
+ function pointerUp() {
139
+ if (!mouseIsOver) startAutoplay();
140
+ }
141
+ function mouseEnter() {
142
+ mouseIsOver = true;
143
+ stopAutoplay();
144
+ }
145
+ function mouseLeave() {
146
+ mouseIsOver = false;
147
+ startAutoplay();
148
+ }
149
+ function play(jumpOverride) {
150
+ if (typeof jumpOverride !== "undefined") jump = jumpOverride;
151
+ startAutoplay();
152
+ }
153
+ function stop() {
154
+ if (autoplayActive) stopAutoplay();
155
+ }
156
+ function reset() {
157
+ if (autoplayActive) startAutoplay();
158
+ }
159
+ function isPlaying() {
160
+ return autoplayActive;
161
+ }
162
+ function next() {
163
+ const {
164
+ index
165
+ } = emblaApi.internalEngine();
166
+ const nextIndex = index.clone().add(1).get();
167
+ const lastIndex = emblaApi.scrollSnapList().length - 1;
168
+ const kill = options.stopOnLastSnap && nextIndex === lastIndex;
169
+ if (emblaApi.canScrollNext()) {
170
+ emblaApi.scrollNext(jump);
171
+ } else {
172
+ emblaApi.scrollTo(0, jump);
173
+ }
174
+ emblaApi.emit("autoplay:select");
175
+ if (kill) return stopAutoplay();
176
+ startAutoplay();
177
+ }
178
+ function timeUntilNext() {
179
+ if (!timerStartTime) return null;
180
+ const currentDelay = delay[emblaApi.selectedScrollSnap()];
181
+ const timePastSinceStart = (/* @__PURE__ */ new Date()).getTime() - timerStartTime;
182
+ return currentDelay - timePastSinceStart;
183
+ }
184
+ const self = {
185
+ name: "autoplay",
186
+ options: userOptions,
187
+ init,
188
+ destroy,
189
+ play,
190
+ stop,
191
+ reset,
192
+ isPlaying,
193
+ timeUntilNext
194
+ };
195
+ return self;
196
+ }
197
+ Autoplay.globalOptions = void 0;
198
+
199
+ // ../../node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js
200
+ function isObject(subject) {
201
+ return Object.prototype.toString.call(subject) === "[object Object]";
202
+ }
203
+ function isRecord(subject) {
204
+ return isObject(subject) || Array.isArray(subject);
205
+ }
206
+ function canUseDOM() {
207
+ return !!(typeof window !== "undefined" && window.document && window.document.createElement);
208
+ }
209
+ function areOptionsEqual(optionsA, optionsB) {
210
+ const optionsAKeys = Object.keys(optionsA);
211
+ const optionsBKeys = Object.keys(optionsB);
212
+ if (optionsAKeys.length !== optionsBKeys.length) return false;
213
+ const breakpointsA = JSON.stringify(Object.keys(optionsA.breakpoints || {}));
214
+ const breakpointsB = JSON.stringify(Object.keys(optionsB.breakpoints || {}));
215
+ if (breakpointsA !== breakpointsB) return false;
216
+ return optionsAKeys.every((key) => {
217
+ const valueA = optionsA[key];
218
+ const valueB = optionsB[key];
219
+ if (typeof valueA === "function") return `${valueA}` === `${valueB}`;
220
+ if (!isRecord(valueA) || !isRecord(valueB)) return valueA === valueB;
221
+ return areOptionsEqual(valueA, valueB);
222
+ });
223
+ }
224
+ function sortAndMapPluginToOptions(plugins) {
225
+ return plugins.concat().sort((a, b) => a.name > b.name ? 1 : -1).map((plugin) => plugin.options);
226
+ }
227
+ function arePluginsEqual(pluginsA, pluginsB) {
228
+ if (pluginsA.length !== pluginsB.length) return false;
229
+ const optionsA = sortAndMapPluginToOptions(pluginsA);
230
+ const optionsB = sortAndMapPluginToOptions(pluginsB);
231
+ return optionsA.every((optionA, index) => {
232
+ const optionB = optionsB[index];
233
+ return areOptionsEqual(optionA, optionB);
234
+ });
235
+ }
236
+
237
+ // ../../node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js
238
+ function isNumber(subject) {
239
+ return typeof subject === "number";
240
+ }
241
+ function isString(subject) {
242
+ return typeof subject === "string";
243
+ }
244
+ function isBoolean(subject) {
245
+ return typeof subject === "boolean";
246
+ }
247
+ function isObject2(subject) {
248
+ return Object.prototype.toString.call(subject) === "[object Object]";
249
+ }
250
+ function mathAbs(n) {
251
+ return Math.abs(n);
252
+ }
253
+ function mathSign(n) {
254
+ return Math.sign(n);
255
+ }
256
+ function deltaAbs(valueB, valueA) {
257
+ return mathAbs(valueB - valueA);
258
+ }
259
+ function factorAbs(valueB, valueA) {
260
+ if (valueB === 0 || valueA === 0) return 0;
261
+ if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
262
+ const diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
263
+ return mathAbs(diff / valueB);
264
+ }
265
+ function roundToTwoDecimals(num) {
266
+ return Math.round(num * 100) / 100;
267
+ }
268
+ function arrayKeys(array) {
269
+ return objectKeys(array).map(Number);
270
+ }
271
+ function arrayLast(array) {
272
+ return array[arrayLastIndex(array)];
273
+ }
274
+ function arrayLastIndex(array) {
275
+ return Math.max(0, array.length - 1);
276
+ }
277
+ function arrayIsLastIndex(array, index) {
278
+ return index === arrayLastIndex(array);
279
+ }
280
+ function arrayFromNumber(n, startAt = 0) {
281
+ return Array.from(Array(n), (_, i) => startAt + i);
282
+ }
283
+ function objectKeys(object) {
284
+ return Object.keys(object);
285
+ }
286
+ function objectsMergeDeep(objectA, objectB) {
287
+ return [objectA, objectB].reduce((mergedObjects, currentObject) => {
288
+ objectKeys(currentObject).forEach((key) => {
289
+ const valueA = mergedObjects[key];
290
+ const valueB = currentObject[key];
291
+ const areObjects = isObject2(valueA) && isObject2(valueB);
292
+ mergedObjects[key] = areObjects ? objectsMergeDeep(valueA, valueB) : valueB;
293
+ });
294
+ return mergedObjects;
295
+ }, {});
296
+ }
297
+ function isMouseEvent(evt, ownerWindow) {
298
+ return typeof ownerWindow.MouseEvent !== "undefined" && evt instanceof ownerWindow.MouseEvent;
299
+ }
300
+ function Alignment(align, viewSize) {
301
+ const predefined = {
302
+ start,
303
+ center,
304
+ end
305
+ };
306
+ function start() {
307
+ return 0;
308
+ }
309
+ function center(n) {
310
+ return end(n) / 2;
311
+ }
312
+ function end(n) {
313
+ return viewSize - n;
314
+ }
315
+ function measure(n, index) {
316
+ if (isString(align)) return predefined[align](n);
317
+ return align(viewSize, n, index);
318
+ }
319
+ const self = {
320
+ measure
321
+ };
322
+ return self;
323
+ }
324
+ function EventStore() {
325
+ let listeners = [];
326
+ function add(node, type, handler, options = {
327
+ passive: true
328
+ }) {
329
+ let removeListener;
330
+ if ("addEventListener" in node) {
331
+ node.addEventListener(type, handler, options);
332
+ removeListener = () => node.removeEventListener(type, handler, options);
333
+ } else {
334
+ const legacyMediaQueryList = node;
335
+ legacyMediaQueryList.addListener(handler);
336
+ removeListener = () => legacyMediaQueryList.removeListener(handler);
337
+ }
338
+ listeners.push(removeListener);
339
+ return self;
340
+ }
341
+ function clear() {
342
+ listeners = listeners.filter((remove) => remove());
343
+ }
344
+ const self = {
345
+ add,
346
+ clear
347
+ };
348
+ return self;
349
+ }
350
+ function Animations(ownerDocument, ownerWindow, update, render) {
351
+ const documentVisibleHandler = EventStore();
352
+ const fixedTimeStep = 1e3 / 60;
353
+ let lastTimeStamp = null;
354
+ let accumulatedTime = 0;
355
+ let animationId = 0;
356
+ function init() {
357
+ documentVisibleHandler.add(ownerDocument, "visibilitychange", () => {
358
+ if (ownerDocument.hidden) reset();
359
+ });
360
+ }
361
+ function destroy() {
362
+ stop();
363
+ documentVisibleHandler.clear();
364
+ }
365
+ function animate(timeStamp) {
366
+ if (!animationId) return;
367
+ if (!lastTimeStamp) {
368
+ lastTimeStamp = timeStamp;
369
+ update();
370
+ update();
371
+ }
372
+ const timeElapsed = timeStamp - lastTimeStamp;
373
+ lastTimeStamp = timeStamp;
374
+ accumulatedTime += timeElapsed;
375
+ while (accumulatedTime >= fixedTimeStep) {
376
+ update();
377
+ accumulatedTime -= fixedTimeStep;
378
+ }
379
+ const alpha = accumulatedTime / fixedTimeStep;
380
+ render(alpha);
381
+ if (animationId) {
382
+ animationId = ownerWindow.requestAnimationFrame(animate);
383
+ }
384
+ }
385
+ function start() {
386
+ if (animationId) return;
387
+ animationId = ownerWindow.requestAnimationFrame(animate);
388
+ }
389
+ function stop() {
390
+ ownerWindow.cancelAnimationFrame(animationId);
391
+ lastTimeStamp = null;
392
+ accumulatedTime = 0;
393
+ animationId = 0;
394
+ }
395
+ function reset() {
396
+ lastTimeStamp = null;
397
+ accumulatedTime = 0;
398
+ }
399
+ const self = {
400
+ init,
401
+ destroy,
402
+ start,
403
+ stop,
404
+ update,
405
+ render
406
+ };
407
+ return self;
408
+ }
409
+ function Axis(axis, contentDirection) {
410
+ const isRightToLeft = contentDirection === "rtl";
411
+ const isVertical = axis === "y";
412
+ const scroll = isVertical ? "y" : "x";
413
+ const cross = isVertical ? "x" : "y";
414
+ const sign = !isVertical && isRightToLeft ? -1 : 1;
415
+ const startEdge = getStartEdge();
416
+ const endEdge = getEndEdge();
417
+ function measureSize(nodeRect) {
418
+ const {
419
+ height,
420
+ width
421
+ } = nodeRect;
422
+ return isVertical ? height : width;
423
+ }
424
+ function getStartEdge() {
425
+ if (isVertical) return "top";
426
+ return isRightToLeft ? "right" : "left";
427
+ }
428
+ function getEndEdge() {
429
+ if (isVertical) return "bottom";
430
+ return isRightToLeft ? "left" : "right";
431
+ }
432
+ function direction(n) {
433
+ return n * sign;
434
+ }
435
+ const self = {
436
+ scroll,
437
+ cross,
438
+ startEdge,
439
+ endEdge,
440
+ measureSize,
441
+ direction
442
+ };
443
+ return self;
444
+ }
445
+ function Limit(min = 0, max = 0) {
446
+ const length = mathAbs(min - max);
447
+ function reachedMin(n) {
448
+ return n < min;
449
+ }
450
+ function reachedMax(n) {
451
+ return n > max;
452
+ }
453
+ function reachedAny(n) {
454
+ return reachedMin(n) || reachedMax(n);
455
+ }
456
+ function constrain(n) {
457
+ if (!reachedAny(n)) return n;
458
+ return reachedMin(n) ? min : max;
459
+ }
460
+ function removeOffset(n) {
461
+ if (!length) return n;
462
+ return n - length * Math.ceil((n - max) / length);
463
+ }
464
+ const self = {
465
+ length,
466
+ max,
467
+ min,
468
+ constrain,
469
+ reachedAny,
470
+ reachedMax,
471
+ reachedMin,
472
+ removeOffset
473
+ };
474
+ return self;
475
+ }
476
+ function Counter(max, start, loop) {
477
+ const {
478
+ constrain
479
+ } = Limit(0, max);
480
+ const loopEnd = max + 1;
481
+ let counter = withinLimit(start);
482
+ function withinLimit(n) {
483
+ return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
484
+ }
485
+ function get() {
486
+ return counter;
487
+ }
488
+ function set(n) {
489
+ counter = withinLimit(n);
490
+ return self;
491
+ }
492
+ function add(n) {
493
+ return clone().set(get() + n);
494
+ }
495
+ function clone() {
496
+ return Counter(max, get(), loop);
497
+ }
498
+ const self = {
499
+ get,
500
+ set,
501
+ add,
502
+ clone
503
+ };
504
+ return self;
505
+ }
506
+ function DragHandler(axis, rootNode, ownerDocument, ownerWindow, target, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, baseFriction, watchDrag) {
507
+ const {
508
+ cross: crossAxis,
509
+ direction
510
+ } = axis;
511
+ const focusNodes = ["INPUT", "SELECT", "TEXTAREA"];
512
+ const nonPassiveEvent = {
513
+ passive: false
514
+ };
515
+ const initEvents = EventStore();
516
+ const dragEvents = EventStore();
517
+ const goToNextThreshold = Limit(50, 225).constrain(percentOfView.measure(20));
518
+ const snapForceBoost = {
519
+ mouse: 300,
520
+ touch: 400
521
+ };
522
+ const freeForceBoost = {
523
+ mouse: 500,
524
+ touch: 600
525
+ };
526
+ const baseSpeed = dragFree ? 43 : 25;
527
+ let isMoving = false;
528
+ let startScroll = 0;
529
+ let startCross = 0;
530
+ let pointerIsDown = false;
531
+ let preventScroll = false;
532
+ let preventClick = false;
533
+ let isMouse = false;
534
+ function init(emblaApi) {
535
+ if (!watchDrag) return;
536
+ function downIfAllowed(evt) {
537
+ if (isBoolean(watchDrag) || watchDrag(emblaApi, evt)) down(evt);
538
+ }
539
+ const node = rootNode;
540
+ initEvents.add(node, "dragstart", (evt) => evt.preventDefault(), nonPassiveEvent).add(node, "touchmove", () => void 0, nonPassiveEvent).add(node, "touchend", () => void 0).add(node, "touchstart", downIfAllowed).add(node, "mousedown", downIfAllowed).add(node, "touchcancel", up).add(node, "contextmenu", up).add(node, "click", click, true);
541
+ }
542
+ function destroy() {
543
+ initEvents.clear();
544
+ dragEvents.clear();
545
+ }
546
+ function addDragEvents() {
547
+ const node = isMouse ? ownerDocument : rootNode;
548
+ dragEvents.add(node, "touchmove", move, nonPassiveEvent).add(node, "touchend", up).add(node, "mousemove", move, nonPassiveEvent).add(node, "mouseup", up);
549
+ }
550
+ function isFocusNode(node) {
551
+ const nodeName = node.nodeName || "";
552
+ return focusNodes.includes(nodeName);
553
+ }
554
+ function forceBoost() {
555
+ const boost = dragFree ? freeForceBoost : snapForceBoost;
556
+ const type = isMouse ? "mouse" : "touch";
557
+ return boost[type];
558
+ }
559
+ function allowedForce(force, targetChanged) {
560
+ const next = index.add(mathSign(force) * -1);
561
+ const baseForce = scrollTarget.byDistance(force, !dragFree).distance;
562
+ if (dragFree || mathAbs(force) < goToNextThreshold) return baseForce;
563
+ if (skipSnaps && targetChanged) return baseForce * 0.5;
564
+ return scrollTarget.byIndex(next.get(), 0).distance;
565
+ }
566
+ function down(evt) {
567
+ const isMouseEvt = isMouseEvent(evt, ownerWindow);
568
+ isMouse = isMouseEvt;
569
+ preventClick = dragFree && isMouseEvt && !evt.buttons && isMoving;
570
+ isMoving = deltaAbs(target.get(), location.get()) >= 2;
571
+ if (isMouseEvt && evt.button !== 0) return;
572
+ if (isFocusNode(evt.target)) return;
573
+ pointerIsDown = true;
574
+ dragTracker.pointerDown(evt);
575
+ scrollBody.useFriction(0).useDuration(0);
576
+ target.set(location);
577
+ addDragEvents();
578
+ startScroll = dragTracker.readPoint(evt);
579
+ startCross = dragTracker.readPoint(evt, crossAxis);
580
+ eventHandler.emit("pointerDown");
581
+ }
582
+ function move(evt) {
583
+ const isTouchEvt = !isMouseEvent(evt, ownerWindow);
584
+ if (isTouchEvt && evt.touches.length >= 2) return up(evt);
585
+ const lastScroll = dragTracker.readPoint(evt);
586
+ const lastCross = dragTracker.readPoint(evt, crossAxis);
587
+ const diffScroll = deltaAbs(lastScroll, startScroll);
588
+ const diffCross = deltaAbs(lastCross, startCross);
589
+ if (!preventScroll && !isMouse) {
590
+ if (!evt.cancelable) return up(evt);
591
+ preventScroll = diffScroll > diffCross;
592
+ if (!preventScroll) return up(evt);
593
+ }
594
+ const diff = dragTracker.pointerMove(evt);
595
+ if (diffScroll > dragThreshold) preventClick = true;
596
+ scrollBody.useFriction(0.3).useDuration(0.75);
597
+ animation.start();
598
+ target.add(direction(diff));
599
+ evt.preventDefault();
600
+ }
601
+ function up(evt) {
602
+ const currentLocation = scrollTarget.byDistance(0, false);
603
+ const targetChanged = currentLocation.index !== index.get();
604
+ const rawForce = dragTracker.pointerUp(evt) * forceBoost();
605
+ const force = allowedForce(direction(rawForce), targetChanged);
606
+ const forceFactor = factorAbs(rawForce, force);
607
+ const speed = baseSpeed - 10 * forceFactor;
608
+ const friction = baseFriction + forceFactor / 50;
609
+ preventScroll = false;
610
+ pointerIsDown = false;
611
+ dragEvents.clear();
612
+ scrollBody.useDuration(speed).useFriction(friction);
613
+ scrollTo.distance(force, !dragFree);
614
+ isMouse = false;
615
+ eventHandler.emit("pointerUp");
616
+ }
617
+ function click(evt) {
618
+ if (preventClick) {
619
+ evt.stopPropagation();
620
+ evt.preventDefault();
621
+ preventClick = false;
622
+ }
623
+ }
624
+ function pointerDown() {
625
+ return pointerIsDown;
626
+ }
627
+ const self = {
628
+ init,
629
+ destroy,
630
+ pointerDown
631
+ };
632
+ return self;
633
+ }
634
+ function DragTracker(axis, ownerWindow) {
635
+ const logInterval = 170;
636
+ let startEvent;
637
+ let lastEvent;
638
+ function readTime(evt) {
639
+ return evt.timeStamp;
640
+ }
641
+ function readPoint(evt, evtAxis) {
642
+ const property = evtAxis || axis.scroll;
643
+ const coord = `client${property === "x" ? "X" : "Y"}`;
644
+ return (isMouseEvent(evt, ownerWindow) ? evt : evt.touches[0])[coord];
645
+ }
646
+ function pointerDown(evt) {
647
+ startEvent = evt;
648
+ lastEvent = evt;
649
+ return readPoint(evt);
650
+ }
651
+ function pointerMove(evt) {
652
+ const diff = readPoint(evt) - readPoint(lastEvent);
653
+ const expired = readTime(evt) - readTime(startEvent) > logInterval;
654
+ lastEvent = evt;
655
+ if (expired) startEvent = evt;
656
+ return diff;
657
+ }
658
+ function pointerUp(evt) {
659
+ if (!startEvent || !lastEvent) return 0;
660
+ const diffDrag = readPoint(lastEvent) - readPoint(startEvent);
661
+ const diffTime = readTime(evt) - readTime(startEvent);
662
+ const expired = readTime(evt) - readTime(lastEvent) > logInterval;
663
+ const force = diffDrag / diffTime;
664
+ const isFlick = diffTime && !expired && mathAbs(force) > 0.1;
665
+ return isFlick ? force : 0;
666
+ }
667
+ const self = {
668
+ pointerDown,
669
+ pointerMove,
670
+ pointerUp,
671
+ readPoint
672
+ };
673
+ return self;
674
+ }
675
+ function NodeRects() {
676
+ function measure(node) {
677
+ const {
678
+ offsetTop,
679
+ offsetLeft,
680
+ offsetWidth,
681
+ offsetHeight
682
+ } = node;
683
+ const offset = {
684
+ top: offsetTop,
685
+ right: offsetLeft + offsetWidth,
686
+ bottom: offsetTop + offsetHeight,
687
+ left: offsetLeft,
688
+ width: offsetWidth,
689
+ height: offsetHeight
690
+ };
691
+ return offset;
692
+ }
693
+ const self = {
694
+ measure
695
+ };
696
+ return self;
697
+ }
698
+ function PercentOfView(viewSize) {
699
+ function measure(n) {
700
+ return viewSize * (n / 100);
701
+ }
702
+ const self = {
703
+ measure
704
+ };
705
+ return self;
706
+ }
707
+ function ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects) {
708
+ const observeNodes = [container].concat(slides);
709
+ let resizeObserver;
710
+ let containerSize;
711
+ let slideSizes = [];
712
+ let destroyed = false;
713
+ function readSize(node) {
714
+ return axis.measureSize(nodeRects.measure(node));
715
+ }
716
+ function init(emblaApi) {
717
+ if (!watchResize) return;
718
+ containerSize = readSize(container);
719
+ slideSizes = slides.map(readSize);
720
+ function defaultCallback(entries) {
721
+ for (const entry of entries) {
722
+ if (destroyed) return;
723
+ const isContainer = entry.target === container;
724
+ const slideIndex = slides.indexOf(entry.target);
725
+ const lastSize = isContainer ? containerSize : slideSizes[slideIndex];
726
+ const newSize = readSize(isContainer ? container : slides[slideIndex]);
727
+ const diffSize = mathAbs(newSize - lastSize);
728
+ if (diffSize >= 0.5) {
729
+ emblaApi.reInit();
730
+ eventHandler.emit("resize");
731
+ break;
732
+ }
733
+ }
734
+ }
735
+ resizeObserver = new ResizeObserver((entries) => {
736
+ if (isBoolean(watchResize) || watchResize(emblaApi, entries)) {
737
+ defaultCallback(entries);
738
+ }
739
+ });
740
+ ownerWindow.requestAnimationFrame(() => {
741
+ observeNodes.forEach((node) => resizeObserver.observe(node));
742
+ });
743
+ }
744
+ function destroy() {
745
+ destroyed = true;
746
+ if (resizeObserver) resizeObserver.disconnect();
747
+ }
748
+ const self = {
749
+ init,
750
+ destroy
751
+ };
752
+ return self;
753
+ }
754
+ function ScrollBody(location, offsetLocation, previousLocation, target, baseDuration, baseFriction) {
755
+ let scrollVelocity = 0;
756
+ let scrollDirection = 0;
757
+ let scrollDuration = baseDuration;
758
+ let scrollFriction = baseFriction;
759
+ let rawLocation = location.get();
760
+ let rawLocationPrevious = 0;
761
+ function seek() {
762
+ const displacement = target.get() - location.get();
763
+ const isInstant = !scrollDuration;
764
+ let scrollDistance = 0;
765
+ if (isInstant) {
766
+ scrollVelocity = 0;
767
+ previousLocation.set(target);
768
+ location.set(target);
769
+ scrollDistance = displacement;
770
+ } else {
771
+ previousLocation.set(location);
772
+ scrollVelocity += displacement / scrollDuration;
773
+ scrollVelocity *= scrollFriction;
774
+ rawLocation += scrollVelocity;
775
+ location.add(scrollVelocity);
776
+ scrollDistance = rawLocation - rawLocationPrevious;
777
+ }
778
+ scrollDirection = mathSign(scrollDistance);
779
+ rawLocationPrevious = rawLocation;
780
+ return self;
781
+ }
782
+ function settled() {
783
+ const diff = target.get() - offsetLocation.get();
784
+ return mathAbs(diff) < 1e-3;
785
+ }
786
+ function duration() {
787
+ return scrollDuration;
788
+ }
789
+ function direction() {
790
+ return scrollDirection;
791
+ }
792
+ function velocity() {
793
+ return scrollVelocity;
794
+ }
795
+ function useBaseDuration() {
796
+ return useDuration(baseDuration);
797
+ }
798
+ function useBaseFriction() {
799
+ return useFriction(baseFriction);
800
+ }
801
+ function useDuration(n) {
802
+ scrollDuration = n;
803
+ return self;
804
+ }
805
+ function useFriction(n) {
806
+ scrollFriction = n;
807
+ return self;
808
+ }
809
+ const self = {
810
+ direction,
811
+ duration,
812
+ velocity,
813
+ seek,
814
+ settled,
815
+ useBaseFriction,
816
+ useBaseDuration,
817
+ useFriction,
818
+ useDuration
819
+ };
820
+ return self;
821
+ }
822
+ function ScrollBounds(limit, location, target, scrollBody, percentOfView) {
823
+ const pullBackThreshold = percentOfView.measure(10);
824
+ const edgeOffsetTolerance = percentOfView.measure(50);
825
+ const frictionLimit = Limit(0.1, 0.99);
826
+ let disabled = false;
827
+ function shouldConstrain() {
828
+ if (disabled) return false;
829
+ if (!limit.reachedAny(target.get())) return false;
830
+ if (!limit.reachedAny(location.get())) return false;
831
+ return true;
832
+ }
833
+ function constrain(pointerDown) {
834
+ if (!shouldConstrain()) return;
835
+ const edge = limit.reachedMin(location.get()) ? "min" : "max";
836
+ const diffToEdge = mathAbs(limit[edge] - location.get());
837
+ const diffToTarget = target.get() - location.get();
838
+ const friction = frictionLimit.constrain(diffToEdge / edgeOffsetTolerance);
839
+ target.subtract(diffToTarget * friction);
840
+ if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
841
+ target.set(limit.constrain(target.get()));
842
+ scrollBody.useDuration(25).useBaseFriction();
843
+ }
844
+ }
845
+ function toggleActive(active) {
846
+ disabled = !active;
847
+ }
848
+ const self = {
849
+ shouldConstrain,
850
+ constrain,
851
+ toggleActive
852
+ };
853
+ return self;
854
+ }
855
+ function ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance) {
856
+ const scrollBounds = Limit(-contentSize + viewSize, 0);
857
+ const snapsBounded = measureBounded();
858
+ const scrollContainLimit = findScrollContainLimit();
859
+ const snapsContained = measureContained();
860
+ function usePixelTolerance(bound, snap) {
861
+ return deltaAbs(bound, snap) <= 1;
862
+ }
863
+ function findScrollContainLimit() {
864
+ const startSnap = snapsBounded[0];
865
+ const endSnap = arrayLast(snapsBounded);
866
+ const min = snapsBounded.lastIndexOf(startSnap);
867
+ const max = snapsBounded.indexOf(endSnap) + 1;
868
+ return Limit(min, max);
869
+ }
870
+ function measureBounded() {
871
+ return snapsAligned.map((snapAligned, index) => {
872
+ const {
873
+ min,
874
+ max
875
+ } = scrollBounds;
876
+ const snap = scrollBounds.constrain(snapAligned);
877
+ const isFirst = !index;
878
+ const isLast = arrayIsLastIndex(snapsAligned, index);
879
+ if (isFirst) return max;
880
+ if (isLast) return min;
881
+ if (usePixelTolerance(min, snap)) return min;
882
+ if (usePixelTolerance(max, snap)) return max;
883
+ return snap;
884
+ }).map((scrollBound) => parseFloat(scrollBound.toFixed(3)));
885
+ }
886
+ function measureContained() {
887
+ if (contentSize <= viewSize + pixelTolerance) return [scrollBounds.max];
888
+ if (containScroll === "keepSnaps") return snapsBounded;
889
+ const {
890
+ min,
891
+ max
892
+ } = scrollContainLimit;
893
+ return snapsBounded.slice(min, max);
894
+ }
895
+ const self = {
896
+ snapsContained,
897
+ scrollContainLimit
898
+ };
899
+ return self;
900
+ }
901
+ function ScrollLimit(contentSize, scrollSnaps, loop) {
902
+ const max = scrollSnaps[0];
903
+ const min = loop ? max - contentSize : arrayLast(scrollSnaps);
904
+ const limit = Limit(min, max);
905
+ const self = {
906
+ limit
907
+ };
908
+ return self;
909
+ }
910
+ function ScrollLooper(contentSize, limit, location, vectors) {
911
+ const jointSafety = 0.1;
912
+ const min = limit.min + jointSafety;
913
+ const max = limit.max + jointSafety;
914
+ const {
915
+ reachedMin,
916
+ reachedMax
917
+ } = Limit(min, max);
918
+ function shouldLoop(direction) {
919
+ if (direction === 1) return reachedMax(location.get());
920
+ if (direction === -1) return reachedMin(location.get());
921
+ return false;
922
+ }
923
+ function loop(direction) {
924
+ if (!shouldLoop(direction)) return;
925
+ const loopDistance = contentSize * (direction * -1);
926
+ vectors.forEach((v) => v.add(loopDistance));
927
+ }
928
+ const self = {
929
+ loop
930
+ };
931
+ return self;
932
+ }
933
+ function ScrollProgress(limit) {
934
+ const {
935
+ max,
936
+ length
937
+ } = limit;
938
+ function get(n) {
939
+ const currentLocation = n - max;
940
+ return length ? currentLocation / -length : 0;
941
+ }
942
+ const self = {
943
+ get
944
+ };
945
+ return self;
946
+ }
947
+ function ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll) {
948
+ const {
949
+ startEdge,
950
+ endEdge
951
+ } = axis;
952
+ const {
953
+ groupSlides
954
+ } = slidesToScroll;
955
+ const alignments = measureSizes().map(alignment.measure);
956
+ const snaps = measureUnaligned();
957
+ const snapsAligned = measureAligned();
958
+ function measureSizes() {
959
+ return groupSlides(slideRects).map((rects) => arrayLast(rects)[endEdge] - rects[0][startEdge]).map(mathAbs);
960
+ }
961
+ function measureUnaligned() {
962
+ return slideRects.map((rect) => containerRect[startEdge] - rect[startEdge]).map((snap) => -mathAbs(snap));
963
+ }
964
+ function measureAligned() {
965
+ return groupSlides(snaps).map((g) => g[0]).map((snap, index) => snap + alignments[index]);
966
+ }
967
+ const self = {
968
+ snaps,
969
+ snapsAligned
970
+ };
971
+ return self;
972
+ }
973
+ function SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes) {
974
+ const {
975
+ groupSlides
976
+ } = slidesToScroll;
977
+ const {
978
+ min,
979
+ max
980
+ } = scrollContainLimit;
981
+ const slideRegistry = createSlideRegistry();
982
+ function createSlideRegistry() {
983
+ const groupedSlideIndexes = groupSlides(slideIndexes);
984
+ const doNotContain = !containSnaps || containScroll === "keepSnaps";
985
+ if (scrollSnaps.length === 1) return [slideIndexes];
986
+ if (doNotContain) return groupedSlideIndexes;
987
+ return groupedSlideIndexes.slice(min, max).map((group, index, groups) => {
988
+ const isFirst = !index;
989
+ const isLast = arrayIsLastIndex(groups, index);
990
+ if (isFirst) {
991
+ const range = arrayLast(groups[0]) + 1;
992
+ return arrayFromNumber(range);
993
+ }
994
+ if (isLast) {
995
+ const range = arrayLastIndex(slideIndexes) - arrayLast(groups)[0] + 1;
996
+ return arrayFromNumber(range, arrayLast(groups)[0]);
997
+ }
998
+ return group;
999
+ });
1000
+ }
1001
+ const self = {
1002
+ slideRegistry
1003
+ };
1004
+ return self;
1005
+ }
1006
+ function ScrollTarget(loop, scrollSnaps, contentSize, limit, targetVector) {
1007
+ const {
1008
+ reachedAny,
1009
+ removeOffset,
1010
+ constrain
1011
+ } = limit;
1012
+ function minDistance(distances) {
1013
+ return distances.concat().sort((a, b) => mathAbs(a) - mathAbs(b))[0];
1014
+ }
1015
+ function findTargetSnap(target) {
1016
+ const distance = loop ? removeOffset(target) : constrain(target);
1017
+ const ascDiffsToSnaps = scrollSnaps.map((snap, index2) => ({
1018
+ diff: shortcut(snap - distance, 0),
1019
+ index: index2
1020
+ })).sort((d1, d2) => mathAbs(d1.diff) - mathAbs(d2.diff));
1021
+ const {
1022
+ index
1023
+ } = ascDiffsToSnaps[0];
1024
+ return {
1025
+ index,
1026
+ distance
1027
+ };
1028
+ }
1029
+ function shortcut(target, direction) {
1030
+ const targets = [target, target + contentSize, target - contentSize];
1031
+ if (!loop) return target;
1032
+ if (!direction) return minDistance(targets);
1033
+ const matchingTargets = targets.filter((t) => mathSign(t) === direction);
1034
+ if (matchingTargets.length) return minDistance(matchingTargets);
1035
+ return arrayLast(targets) - contentSize;
1036
+ }
1037
+ function byIndex(index, direction) {
1038
+ const diffToSnap = scrollSnaps[index] - targetVector.get();
1039
+ const distance = shortcut(diffToSnap, direction);
1040
+ return {
1041
+ index,
1042
+ distance
1043
+ };
1044
+ }
1045
+ function byDistance(distance, snap) {
1046
+ const target = targetVector.get() + distance;
1047
+ const {
1048
+ index,
1049
+ distance: targetSnapDistance
1050
+ } = findTargetSnap(target);
1051
+ const reachedBound = !loop && reachedAny(target);
1052
+ if (!snap || reachedBound) return {
1053
+ index,
1054
+ distance
1055
+ };
1056
+ const diffToSnap = scrollSnaps[index] - targetSnapDistance;
1057
+ const snapDistance = distance + shortcut(diffToSnap, 0);
1058
+ return {
1059
+ index,
1060
+ distance: snapDistance
1061
+ };
1062
+ }
1063
+ const self = {
1064
+ byDistance,
1065
+ byIndex,
1066
+ shortcut
1067
+ };
1068
+ return self;
1069
+ }
1070
+ function ScrollTo(animation, indexCurrent, indexPrevious, scrollBody, scrollTarget, targetVector, eventHandler) {
1071
+ function scrollTo(target) {
1072
+ const distanceDiff = target.distance;
1073
+ const indexDiff = target.index !== indexCurrent.get();
1074
+ targetVector.add(distanceDiff);
1075
+ if (distanceDiff) {
1076
+ if (scrollBody.duration()) {
1077
+ animation.start();
1078
+ } else {
1079
+ animation.update();
1080
+ animation.render(1);
1081
+ animation.update();
1082
+ }
1083
+ }
1084
+ if (indexDiff) {
1085
+ indexPrevious.set(indexCurrent.get());
1086
+ indexCurrent.set(target.index);
1087
+ eventHandler.emit("select");
1088
+ }
1089
+ }
1090
+ function distance(n, snap) {
1091
+ const target = scrollTarget.byDistance(n, snap);
1092
+ scrollTo(target);
1093
+ }
1094
+ function index(n, direction) {
1095
+ const targetIndex = indexCurrent.clone().set(n);
1096
+ const target = scrollTarget.byIndex(targetIndex.get(), direction);
1097
+ scrollTo(target);
1098
+ }
1099
+ const self = {
1100
+ distance,
1101
+ index
1102
+ };
1103
+ return self;
1104
+ }
1105
+ function SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus) {
1106
+ const focusListenerOptions = {
1107
+ passive: true,
1108
+ capture: true
1109
+ };
1110
+ let lastTabPressTime = 0;
1111
+ function init(emblaApi) {
1112
+ if (!watchFocus) return;
1113
+ function defaultCallback(index) {
1114
+ const nowTime = (/* @__PURE__ */ new Date()).getTime();
1115
+ const diffTime = nowTime - lastTabPressTime;
1116
+ if (diffTime > 10) return;
1117
+ eventHandler.emit("slideFocusStart");
1118
+ root.scrollLeft = 0;
1119
+ const group = slideRegistry.findIndex((group2) => group2.includes(index));
1120
+ if (!isNumber(group)) return;
1121
+ scrollBody.useDuration(0);
1122
+ scrollTo.index(group, 0);
1123
+ eventHandler.emit("slideFocus");
1124
+ }
1125
+ eventStore.add(document, "keydown", registerTabPress, false);
1126
+ slides.forEach((slide, slideIndex) => {
1127
+ eventStore.add(slide, "focus", (evt) => {
1128
+ if (isBoolean(watchFocus) || watchFocus(emblaApi, evt)) {
1129
+ defaultCallback(slideIndex);
1130
+ }
1131
+ }, focusListenerOptions);
1132
+ });
1133
+ }
1134
+ function registerTabPress(event) {
1135
+ if (event.code === "Tab") lastTabPressTime = (/* @__PURE__ */ new Date()).getTime();
1136
+ }
1137
+ const self = {
1138
+ init
1139
+ };
1140
+ return self;
1141
+ }
1142
+ function Vector1D(initialValue) {
1143
+ let value = initialValue;
1144
+ function get() {
1145
+ return value;
1146
+ }
1147
+ function set(n) {
1148
+ value = normalizeInput(n);
1149
+ }
1150
+ function add(n) {
1151
+ value += normalizeInput(n);
1152
+ }
1153
+ function subtract(n) {
1154
+ value -= normalizeInput(n);
1155
+ }
1156
+ function normalizeInput(n) {
1157
+ return isNumber(n) ? n : n.get();
1158
+ }
1159
+ const self = {
1160
+ get,
1161
+ set,
1162
+ add,
1163
+ subtract
1164
+ };
1165
+ return self;
1166
+ }
1167
+ function Translate(axis, container) {
1168
+ const translate = axis.scroll === "x" ? x : y;
1169
+ const containerStyle = container.style;
1170
+ let previousTarget = null;
1171
+ let disabled = false;
1172
+ function x(n) {
1173
+ return `translate3d(${n}px,0px,0px)`;
1174
+ }
1175
+ function y(n) {
1176
+ return `translate3d(0px,${n}px,0px)`;
1177
+ }
1178
+ function to(target) {
1179
+ if (disabled) return;
1180
+ const newTarget = roundToTwoDecimals(axis.direction(target));
1181
+ if (newTarget === previousTarget) return;
1182
+ containerStyle.transform = translate(newTarget);
1183
+ previousTarget = newTarget;
1184
+ }
1185
+ function toggleActive(active) {
1186
+ disabled = !active;
1187
+ }
1188
+ function clear() {
1189
+ if (disabled) return;
1190
+ containerStyle.transform = "";
1191
+ if (!container.getAttribute("style")) container.removeAttribute("style");
1192
+ }
1193
+ const self = {
1194
+ clear,
1195
+ to,
1196
+ toggleActive
1197
+ };
1198
+ return self;
1199
+ }
1200
+ function SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, location, slides) {
1201
+ const roundingSafety = 0.5;
1202
+ const ascItems = arrayKeys(slideSizesWithGaps);
1203
+ const descItems = arrayKeys(slideSizesWithGaps).reverse();
1204
+ const loopPoints = startPoints().concat(endPoints());
1205
+ function removeSlideSizes(indexes, from) {
1206
+ return indexes.reduce((a, i) => {
1207
+ return a - slideSizesWithGaps[i];
1208
+ }, from);
1209
+ }
1210
+ function slidesInGap(indexes, gap) {
1211
+ return indexes.reduce((a, i) => {
1212
+ const remainingGap = removeSlideSizes(a, gap);
1213
+ return remainingGap > 0 ? a.concat([i]) : a;
1214
+ }, []);
1215
+ }
1216
+ function findSlideBounds(offset) {
1217
+ return snaps.map((snap, index) => ({
1218
+ start: snap - slideSizes[index] + roundingSafety + offset,
1219
+ end: snap + viewSize - roundingSafety + offset
1220
+ }));
1221
+ }
1222
+ function findLoopPoints(indexes, offset, isEndEdge) {
1223
+ const slideBounds = findSlideBounds(offset);
1224
+ return indexes.map((index) => {
1225
+ const initial = isEndEdge ? 0 : -contentSize;
1226
+ const altered = isEndEdge ? contentSize : 0;
1227
+ const boundEdge = isEndEdge ? "end" : "start";
1228
+ const loopPoint = slideBounds[index][boundEdge];
1229
+ return {
1230
+ index,
1231
+ loopPoint,
1232
+ slideLocation: Vector1D(-1),
1233
+ translate: Translate(axis, slides[index]),
1234
+ target: () => location.get() > loopPoint ? initial : altered
1235
+ };
1236
+ });
1237
+ }
1238
+ function startPoints() {
1239
+ const gap = scrollSnaps[0];
1240
+ const indexes = slidesInGap(descItems, gap);
1241
+ return findLoopPoints(indexes, contentSize, false);
1242
+ }
1243
+ function endPoints() {
1244
+ const gap = viewSize - scrollSnaps[0] - 1;
1245
+ const indexes = slidesInGap(ascItems, gap);
1246
+ return findLoopPoints(indexes, -contentSize, true);
1247
+ }
1248
+ function canLoop() {
1249
+ return loopPoints.every(({
1250
+ index
1251
+ }) => {
1252
+ const otherIndexes = ascItems.filter((i) => i !== index);
1253
+ return removeSlideSizes(otherIndexes, viewSize) <= 0.1;
1254
+ });
1255
+ }
1256
+ function loop() {
1257
+ loopPoints.forEach((loopPoint) => {
1258
+ const {
1259
+ target,
1260
+ translate,
1261
+ slideLocation
1262
+ } = loopPoint;
1263
+ const shiftLocation = target();
1264
+ if (shiftLocation === slideLocation.get()) return;
1265
+ translate.to(shiftLocation);
1266
+ slideLocation.set(shiftLocation);
1267
+ });
1268
+ }
1269
+ function clear() {
1270
+ loopPoints.forEach((loopPoint) => loopPoint.translate.clear());
1271
+ }
1272
+ const self = {
1273
+ canLoop,
1274
+ clear,
1275
+ loop,
1276
+ loopPoints
1277
+ };
1278
+ return self;
1279
+ }
1280
+ function SlidesHandler(container, eventHandler, watchSlides) {
1281
+ let mutationObserver;
1282
+ let destroyed = false;
1283
+ function init(emblaApi) {
1284
+ if (!watchSlides) return;
1285
+ function defaultCallback(mutations) {
1286
+ for (const mutation of mutations) {
1287
+ if (mutation.type === "childList") {
1288
+ emblaApi.reInit();
1289
+ eventHandler.emit("slidesChanged");
1290
+ break;
1291
+ }
1292
+ }
1293
+ }
1294
+ mutationObserver = new MutationObserver((mutations) => {
1295
+ if (destroyed) return;
1296
+ if (isBoolean(watchSlides) || watchSlides(emblaApi, mutations)) {
1297
+ defaultCallback(mutations);
1298
+ }
1299
+ });
1300
+ mutationObserver.observe(container, {
1301
+ childList: true
1302
+ });
1303
+ }
1304
+ function destroy() {
1305
+ if (mutationObserver) mutationObserver.disconnect();
1306
+ destroyed = true;
1307
+ }
1308
+ const self = {
1309
+ init,
1310
+ destroy
1311
+ };
1312
+ return self;
1313
+ }
1314
+ function SlidesInView(container, slides, eventHandler, threshold) {
1315
+ const intersectionEntryMap = {};
1316
+ let inViewCache = null;
1317
+ let notInViewCache = null;
1318
+ let intersectionObserver;
1319
+ let destroyed = false;
1320
+ function init() {
1321
+ intersectionObserver = new IntersectionObserver((entries) => {
1322
+ if (destroyed) return;
1323
+ entries.forEach((entry) => {
1324
+ const index = slides.indexOf(entry.target);
1325
+ intersectionEntryMap[index] = entry;
1326
+ });
1327
+ inViewCache = null;
1328
+ notInViewCache = null;
1329
+ eventHandler.emit("slidesInView");
1330
+ }, {
1331
+ root: container.parentElement,
1332
+ threshold
1333
+ });
1334
+ slides.forEach((slide) => intersectionObserver.observe(slide));
1335
+ }
1336
+ function destroy() {
1337
+ if (intersectionObserver) intersectionObserver.disconnect();
1338
+ destroyed = true;
1339
+ }
1340
+ function createInViewList(inView) {
1341
+ return objectKeys(intersectionEntryMap).reduce((list, slideIndex) => {
1342
+ const index = parseInt(slideIndex);
1343
+ const {
1344
+ isIntersecting
1345
+ } = intersectionEntryMap[index];
1346
+ const inViewMatch = inView && isIntersecting;
1347
+ const notInViewMatch = !inView && !isIntersecting;
1348
+ if (inViewMatch || notInViewMatch) list.push(index);
1349
+ return list;
1350
+ }, []);
1351
+ }
1352
+ function get(inView = true) {
1353
+ if (inView && inViewCache) return inViewCache;
1354
+ if (!inView && notInViewCache) return notInViewCache;
1355
+ const slideIndexes = createInViewList(inView);
1356
+ if (inView) inViewCache = slideIndexes;
1357
+ if (!inView) notInViewCache = slideIndexes;
1358
+ return slideIndexes;
1359
+ }
1360
+ const self = {
1361
+ init,
1362
+ destroy,
1363
+ get
1364
+ };
1365
+ return self;
1366
+ }
1367
+ function SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow) {
1368
+ const {
1369
+ measureSize,
1370
+ startEdge,
1371
+ endEdge
1372
+ } = axis;
1373
+ const withEdgeGap = slideRects[0] && readEdgeGap;
1374
+ const startGap = measureStartGap();
1375
+ const endGap = measureEndGap();
1376
+ const slideSizes = slideRects.map(measureSize);
1377
+ const slideSizesWithGaps = measureWithGaps();
1378
+ function measureStartGap() {
1379
+ if (!withEdgeGap) return 0;
1380
+ const slideRect = slideRects[0];
1381
+ return mathAbs(containerRect[startEdge] - slideRect[startEdge]);
1382
+ }
1383
+ function measureEndGap() {
1384
+ if (!withEdgeGap) return 0;
1385
+ const style = ownerWindow.getComputedStyle(arrayLast(slides));
1386
+ return parseFloat(style.getPropertyValue(`margin-${endEdge}`));
1387
+ }
1388
+ function measureWithGaps() {
1389
+ return slideRects.map((rect, index, rects) => {
1390
+ const isFirst = !index;
1391
+ const isLast = arrayIsLastIndex(rects, index);
1392
+ if (isFirst) return slideSizes[index] + startGap;
1393
+ if (isLast) return slideSizes[index] + endGap;
1394
+ return rects[index + 1][startEdge] - rect[startEdge];
1395
+ }).map(mathAbs);
1396
+ }
1397
+ const self = {
1398
+ slideSizes,
1399
+ slideSizesWithGaps,
1400
+ startGap,
1401
+ endGap
1402
+ };
1403
+ return self;
1404
+ }
1405
+ function SlidesToScroll(axis, viewSize, slidesToScroll, loop, containerRect, slideRects, startGap, endGap, pixelTolerance) {
1406
+ const {
1407
+ startEdge,
1408
+ endEdge,
1409
+ direction
1410
+ } = axis;
1411
+ const groupByNumber = isNumber(slidesToScroll);
1412
+ function byNumber(array, groupSize) {
1413
+ return arrayKeys(array).filter((i) => i % groupSize === 0).map((i) => array.slice(i, i + groupSize));
1414
+ }
1415
+ function bySize(array) {
1416
+ if (!array.length) return [];
1417
+ return arrayKeys(array).reduce((groups, rectB, index) => {
1418
+ const rectA = arrayLast(groups) || 0;
1419
+ const isFirst = rectA === 0;
1420
+ const isLast = rectB === arrayLastIndex(array);
1421
+ const edgeA = containerRect[startEdge] - slideRects[rectA][startEdge];
1422
+ const edgeB = containerRect[startEdge] - slideRects[rectB][endEdge];
1423
+ const gapA = !loop && isFirst ? direction(startGap) : 0;
1424
+ const gapB = !loop && isLast ? direction(endGap) : 0;
1425
+ const chunkSize = mathAbs(edgeB - gapB - (edgeA + gapA));
1426
+ if (index && chunkSize > viewSize + pixelTolerance) groups.push(rectB);
1427
+ if (isLast) groups.push(array.length);
1428
+ return groups;
1429
+ }, []).map((currentSize, index, groups) => {
1430
+ const previousSize = Math.max(groups[index - 1] || 0);
1431
+ return array.slice(previousSize, currentSize);
1432
+ });
1433
+ }
1434
+ function groupSlides(array) {
1435
+ return groupByNumber ? byNumber(array, slidesToScroll) : bySize(array);
1436
+ }
1437
+ const self = {
1438
+ groupSlides
1439
+ };
1440
+ return self;
1441
+ }
1442
+ function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler) {
1443
+ const {
1444
+ align,
1445
+ axis: scrollAxis,
1446
+ direction,
1447
+ startIndex,
1448
+ loop,
1449
+ duration,
1450
+ dragFree,
1451
+ dragThreshold,
1452
+ inViewThreshold,
1453
+ slidesToScroll: groupSlides,
1454
+ skipSnaps,
1455
+ containScroll,
1456
+ watchResize,
1457
+ watchSlides,
1458
+ watchDrag,
1459
+ watchFocus
1460
+ } = options;
1461
+ const pixelTolerance = 2;
1462
+ const nodeRects = NodeRects();
1463
+ const containerRect = nodeRects.measure(container);
1464
+ const slideRects = slides.map(nodeRects.measure);
1465
+ const axis = Axis(scrollAxis, direction);
1466
+ const viewSize = axis.measureSize(containerRect);
1467
+ const percentOfView = PercentOfView(viewSize);
1468
+ const alignment = Alignment(align, viewSize);
1469
+ const containSnaps = !loop && !!containScroll;
1470
+ const readEdgeGap = loop || !!containScroll;
1471
+ const {
1472
+ slideSizes,
1473
+ slideSizesWithGaps,
1474
+ startGap,
1475
+ endGap
1476
+ } = SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow);
1477
+ const slidesToScroll = SlidesToScroll(axis, viewSize, groupSlides, loop, containerRect, slideRects, startGap, endGap, pixelTolerance);
1478
+ const {
1479
+ snaps,
1480
+ snapsAligned
1481
+ } = ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll);
1482
+ const contentSize = -arrayLast(snaps) + arrayLast(slideSizesWithGaps);
1483
+ const {
1484
+ snapsContained,
1485
+ scrollContainLimit
1486
+ } = ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance);
1487
+ const scrollSnaps = containSnaps ? snapsContained : snapsAligned;
1488
+ const {
1489
+ limit
1490
+ } = ScrollLimit(contentSize, scrollSnaps, loop);
1491
+ const index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
1492
+ const indexPrevious = index.clone();
1493
+ const slideIndexes = arrayKeys(slides);
1494
+ const update = ({
1495
+ dragHandler,
1496
+ scrollBody: scrollBody2,
1497
+ scrollBounds,
1498
+ options: {
1499
+ loop: loop2
1500
+ }
1501
+ }) => {
1502
+ if (!loop2) scrollBounds.constrain(dragHandler.pointerDown());
1503
+ scrollBody2.seek();
1504
+ };
1505
+ const render = ({
1506
+ scrollBody: scrollBody2,
1507
+ translate,
1508
+ location: location2,
1509
+ offsetLocation: offsetLocation2,
1510
+ previousLocation: previousLocation2,
1511
+ scrollLooper,
1512
+ slideLooper,
1513
+ dragHandler,
1514
+ animation: animation2,
1515
+ eventHandler: eventHandler2,
1516
+ scrollBounds,
1517
+ options: {
1518
+ loop: loop2
1519
+ }
1520
+ }, alpha) => {
1521
+ const shouldSettle = scrollBody2.settled();
1522
+ const withinBounds = !scrollBounds.shouldConstrain();
1523
+ const hasSettled = loop2 ? shouldSettle : shouldSettle && withinBounds;
1524
+ const hasSettledAndIdle = hasSettled && !dragHandler.pointerDown();
1525
+ if (hasSettledAndIdle) animation2.stop();
1526
+ const interpolatedLocation = location2.get() * alpha + previousLocation2.get() * (1 - alpha);
1527
+ offsetLocation2.set(interpolatedLocation);
1528
+ if (loop2) {
1529
+ scrollLooper.loop(scrollBody2.direction());
1530
+ slideLooper.loop();
1531
+ }
1532
+ translate.to(offsetLocation2.get());
1533
+ if (hasSettledAndIdle) eventHandler2.emit("settle");
1534
+ if (!hasSettled) eventHandler2.emit("scroll");
1535
+ };
1536
+ const animation = Animations(ownerDocument, ownerWindow, () => update(engine), (alpha) => render(engine, alpha));
1537
+ const friction = 0.68;
1538
+ const startLocation = scrollSnaps[index.get()];
1539
+ const location = Vector1D(startLocation);
1540
+ const previousLocation = Vector1D(startLocation);
1541
+ const offsetLocation = Vector1D(startLocation);
1542
+ const target = Vector1D(startLocation);
1543
+ const scrollBody = ScrollBody(location, offsetLocation, previousLocation, target, duration, friction);
1544
+ const scrollTarget = ScrollTarget(loop, scrollSnaps, contentSize, limit, target);
1545
+ const scrollTo = ScrollTo(animation, index, indexPrevious, scrollBody, scrollTarget, target, eventHandler);
1546
+ const scrollProgress = ScrollProgress(limit);
1547
+ const eventStore = EventStore();
1548
+ const slidesInView = SlidesInView(container, slides, eventHandler, inViewThreshold);
1549
+ const {
1550
+ slideRegistry
1551
+ } = SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes);
1552
+ const slideFocus = SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus);
1553
+ const engine = {
1554
+ ownerDocument,
1555
+ ownerWindow,
1556
+ eventHandler,
1557
+ containerRect,
1558
+ slideRects,
1559
+ animation,
1560
+ axis,
1561
+ dragHandler: DragHandler(axis, root, ownerDocument, ownerWindow, target, DragTracker(axis, ownerWindow), location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, friction, watchDrag),
1562
+ eventStore,
1563
+ percentOfView,
1564
+ index,
1565
+ indexPrevious,
1566
+ limit,
1567
+ location,
1568
+ offsetLocation,
1569
+ previousLocation,
1570
+ options,
1571
+ resizeHandler: ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects),
1572
+ scrollBody,
1573
+ scrollBounds: ScrollBounds(limit, offsetLocation, target, scrollBody, percentOfView),
1574
+ scrollLooper: ScrollLooper(contentSize, limit, offsetLocation, [location, offsetLocation, previousLocation, target]),
1575
+ scrollProgress,
1576
+ scrollSnapList: scrollSnaps.map(scrollProgress.get),
1577
+ scrollSnaps,
1578
+ scrollTarget,
1579
+ scrollTo,
1580
+ slideLooper: SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, offsetLocation, slides),
1581
+ slideFocus,
1582
+ slidesHandler: SlidesHandler(container, eventHandler, watchSlides),
1583
+ slidesInView,
1584
+ slideIndexes,
1585
+ slideRegistry,
1586
+ slidesToScroll,
1587
+ target,
1588
+ translate: Translate(axis, container)
1589
+ };
1590
+ return engine;
1591
+ }
1592
+ function EventHandler() {
1593
+ let listeners = {};
1594
+ let api;
1595
+ function init(emblaApi) {
1596
+ api = emblaApi;
1597
+ }
1598
+ function getListeners(evt) {
1599
+ return listeners[evt] || [];
1600
+ }
1601
+ function emit(evt) {
1602
+ getListeners(evt).forEach((e) => e(api, evt));
1603
+ return self;
1604
+ }
1605
+ function on(evt, cb) {
1606
+ listeners[evt] = getListeners(evt).concat([cb]);
1607
+ return self;
1608
+ }
1609
+ function off(evt, cb) {
1610
+ listeners[evt] = getListeners(evt).filter((e) => e !== cb);
1611
+ return self;
1612
+ }
1613
+ function clear() {
1614
+ listeners = {};
1615
+ }
1616
+ const self = {
1617
+ init,
1618
+ emit,
1619
+ off,
1620
+ on,
1621
+ clear
1622
+ };
1623
+ return self;
1624
+ }
1625
+ var defaultOptions2 = {
1626
+ align: "center",
1627
+ axis: "x",
1628
+ container: null,
1629
+ slides: null,
1630
+ containScroll: "trimSnaps",
1631
+ direction: "ltr",
1632
+ slidesToScroll: 1,
1633
+ inViewThreshold: 0,
1634
+ breakpoints: {},
1635
+ dragFree: false,
1636
+ dragThreshold: 10,
1637
+ loop: false,
1638
+ skipSnaps: false,
1639
+ duration: 25,
1640
+ startIndex: 0,
1641
+ active: true,
1642
+ watchDrag: true,
1643
+ watchResize: true,
1644
+ watchSlides: true,
1645
+ watchFocus: true
1646
+ };
1647
+ function OptionsHandler(ownerWindow) {
1648
+ function mergeOptions(optionsA, optionsB) {
1649
+ return objectsMergeDeep(optionsA, optionsB || {});
1650
+ }
1651
+ function optionsAtMedia(options) {
1652
+ const optionsAtMedia2 = options.breakpoints || {};
1653
+ const matchedMediaOptions = objectKeys(optionsAtMedia2).filter((media) => ownerWindow.matchMedia(media).matches).map((media) => optionsAtMedia2[media]).reduce((a, mediaOption) => mergeOptions(a, mediaOption), {});
1654
+ return mergeOptions(options, matchedMediaOptions);
1655
+ }
1656
+ function optionsMediaQueries(optionsList) {
1657
+ return optionsList.map((options) => objectKeys(options.breakpoints || {})).reduce((acc, mediaQueries) => acc.concat(mediaQueries), []).map(ownerWindow.matchMedia);
1658
+ }
1659
+ const self = {
1660
+ mergeOptions,
1661
+ optionsAtMedia,
1662
+ optionsMediaQueries
1663
+ };
1664
+ return self;
1665
+ }
1666
+ function PluginsHandler(optionsHandler) {
1667
+ let activePlugins = [];
1668
+ function init(emblaApi, plugins) {
1669
+ activePlugins = plugins.filter(({
1670
+ options
1671
+ }) => optionsHandler.optionsAtMedia(options).active !== false);
1672
+ activePlugins.forEach((plugin) => plugin.init(emblaApi, optionsHandler));
1673
+ return plugins.reduce((map, plugin) => Object.assign(map, {
1674
+ [plugin.name]: plugin
1675
+ }), {});
1676
+ }
1677
+ function destroy() {
1678
+ activePlugins = activePlugins.filter((plugin) => plugin.destroy());
1679
+ }
1680
+ const self = {
1681
+ init,
1682
+ destroy
1683
+ };
1684
+ return self;
1685
+ }
1686
+ function EmblaCarousel(root, userOptions, userPlugins) {
1687
+ const ownerDocument = root.ownerDocument;
1688
+ const ownerWindow = ownerDocument.defaultView;
1689
+ const optionsHandler = OptionsHandler(ownerWindow);
1690
+ const pluginsHandler = PluginsHandler(optionsHandler);
1691
+ const mediaHandlers = EventStore();
1692
+ const eventHandler = EventHandler();
1693
+ const {
1694
+ mergeOptions,
1695
+ optionsAtMedia,
1696
+ optionsMediaQueries
1697
+ } = optionsHandler;
1698
+ const {
1699
+ on,
1700
+ off,
1701
+ emit
1702
+ } = eventHandler;
1703
+ const reInit = reActivate;
1704
+ let destroyed = false;
1705
+ let engine;
1706
+ let optionsBase = mergeOptions(defaultOptions2, EmblaCarousel.globalOptions);
1707
+ let options = mergeOptions(optionsBase);
1708
+ let pluginList = [];
1709
+ let pluginApis;
1710
+ let container;
1711
+ let slides;
1712
+ function storeElements() {
1713
+ const {
1714
+ container: userContainer,
1715
+ slides: userSlides
1716
+ } = options;
1717
+ const customContainer = isString(userContainer) ? root.querySelector(userContainer) : userContainer;
1718
+ container = customContainer || root.children[0];
1719
+ const customSlides = isString(userSlides) ? container.querySelectorAll(userSlides) : userSlides;
1720
+ slides = [].slice.call(customSlides || container.children);
1721
+ }
1722
+ function createEngine(options2) {
1723
+ const engine2 = Engine(root, container, slides, ownerDocument, ownerWindow, options2, eventHandler);
1724
+ if (options2.loop && !engine2.slideLooper.canLoop()) {
1725
+ const optionsWithoutLoop = Object.assign({}, options2, {
1726
+ loop: false
1727
+ });
1728
+ return createEngine(optionsWithoutLoop);
1729
+ }
1730
+ return engine2;
1731
+ }
1732
+ function activate(withOptions, withPlugins) {
1733
+ if (destroyed) return;
1734
+ optionsBase = mergeOptions(optionsBase, withOptions);
1735
+ options = optionsAtMedia(optionsBase);
1736
+ pluginList = withPlugins || pluginList;
1737
+ storeElements();
1738
+ engine = createEngine(options);
1739
+ optionsMediaQueries([optionsBase, ...pluginList.map(({
1740
+ options: options2
1741
+ }) => options2)]).forEach((query) => mediaHandlers.add(query, "change", reActivate));
1742
+ if (!options.active) return;
1743
+ engine.translate.to(engine.location.get());
1744
+ engine.animation.init();
1745
+ engine.slidesInView.init();
1746
+ engine.slideFocus.init(self);
1747
+ engine.eventHandler.init(self);
1748
+ engine.resizeHandler.init(self);
1749
+ engine.slidesHandler.init(self);
1750
+ if (engine.options.loop) engine.slideLooper.loop();
1751
+ if (container.offsetParent && slides.length) engine.dragHandler.init(self);
1752
+ pluginApis = pluginsHandler.init(self, pluginList);
1753
+ }
1754
+ function reActivate(withOptions, withPlugins) {
1755
+ const startIndex = selectedScrollSnap();
1756
+ deActivate();
1757
+ activate(mergeOptions({
1758
+ startIndex
1759
+ }, withOptions), withPlugins);
1760
+ eventHandler.emit("reInit");
1761
+ }
1762
+ function deActivate() {
1763
+ engine.dragHandler.destroy();
1764
+ engine.eventStore.clear();
1765
+ engine.translate.clear();
1766
+ engine.slideLooper.clear();
1767
+ engine.resizeHandler.destroy();
1768
+ engine.slidesHandler.destroy();
1769
+ engine.slidesInView.destroy();
1770
+ engine.animation.destroy();
1771
+ pluginsHandler.destroy();
1772
+ mediaHandlers.clear();
1773
+ }
1774
+ function destroy() {
1775
+ if (destroyed) return;
1776
+ destroyed = true;
1777
+ mediaHandlers.clear();
1778
+ deActivate();
1779
+ eventHandler.emit("destroy");
1780
+ eventHandler.clear();
1781
+ }
1782
+ function scrollTo(index, jump, direction) {
1783
+ if (!options.active || destroyed) return;
1784
+ engine.scrollBody.useBaseFriction().useDuration(jump === true ? 0 : options.duration);
1785
+ engine.scrollTo.index(index, direction || 0);
1786
+ }
1787
+ function scrollNext(jump) {
1788
+ const next = engine.index.add(1).get();
1789
+ scrollTo(next, jump, -1);
1790
+ }
1791
+ function scrollPrev(jump) {
1792
+ const prev = engine.index.add(-1).get();
1793
+ scrollTo(prev, jump, 1);
1794
+ }
1795
+ function canScrollNext() {
1796
+ const next = engine.index.add(1).get();
1797
+ return next !== selectedScrollSnap();
1798
+ }
1799
+ function canScrollPrev() {
1800
+ const prev = engine.index.add(-1).get();
1801
+ return prev !== selectedScrollSnap();
1802
+ }
1803
+ function scrollSnapList() {
1804
+ return engine.scrollSnapList;
1805
+ }
1806
+ function scrollProgress() {
1807
+ return engine.scrollProgress.get(engine.offsetLocation.get());
1808
+ }
1809
+ function selectedScrollSnap() {
1810
+ return engine.index.get();
1811
+ }
1812
+ function previousScrollSnap() {
1813
+ return engine.indexPrevious.get();
1814
+ }
1815
+ function slidesInView() {
1816
+ return engine.slidesInView.get();
1817
+ }
1818
+ function slidesNotInView() {
1819
+ return engine.slidesInView.get(false);
1820
+ }
1821
+ function plugins() {
1822
+ return pluginApis;
1823
+ }
1824
+ function internalEngine() {
1825
+ return engine;
1826
+ }
1827
+ function rootNode() {
1828
+ return root;
1829
+ }
1830
+ function containerNode() {
1831
+ return container;
1832
+ }
1833
+ function slideNodes() {
1834
+ return slides;
1835
+ }
1836
+ const self = {
1837
+ canScrollNext,
1838
+ canScrollPrev,
1839
+ containerNode,
1840
+ internalEngine,
1841
+ destroy,
1842
+ off,
1843
+ on,
1844
+ emit,
1845
+ plugins,
1846
+ previousScrollSnap,
1847
+ reInit,
1848
+ rootNode,
1849
+ scrollNext,
1850
+ scrollPrev,
1851
+ scrollProgress,
1852
+ scrollSnapList,
1853
+ scrollTo,
1854
+ selectedScrollSnap,
1855
+ slideNodes,
1856
+ slidesInView,
1857
+ slidesNotInView
1858
+ };
1859
+ activate(userOptions, userPlugins);
1860
+ setTimeout(() => eventHandler.emit("init"), 0);
1861
+ return self;
1862
+ }
1863
+ EmblaCarousel.globalOptions = void 0;
1864
+
1865
+ // ../../node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.4/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js
1866
+ function useEmblaCarousel(options = {}, plugins = []) {
1867
+ const storedOptions = useRef(options);
1868
+ const storedPlugins = useRef(plugins);
1869
+ const [emblaApi, setEmblaApi] = useState();
1870
+ const [viewport, setViewport] = useState();
1871
+ const reInit = useCallback(() => {
1872
+ if (emblaApi) emblaApi.reInit(storedOptions.current, storedPlugins.current);
1873
+ }, [emblaApi]);
1874
+ useEffect(() => {
1875
+ if (areOptionsEqual(storedOptions.current, options)) return;
1876
+ storedOptions.current = options;
1877
+ reInit();
1878
+ }, [options, reInit]);
1879
+ useEffect(() => {
1880
+ if (arePluginsEqual(storedPlugins.current, plugins)) return;
1881
+ storedPlugins.current = plugins;
1882
+ reInit();
1883
+ }, [plugins, reInit]);
1884
+ useEffect(() => {
1885
+ if (canUseDOM() && viewport) {
1886
+ EmblaCarousel.globalOptions = useEmblaCarousel.globalOptions;
1887
+ const newEmblaApi = EmblaCarousel(viewport, storedOptions.current, storedPlugins.current);
1888
+ setEmblaApi(newEmblaApi);
1889
+ return () => newEmblaApi.destroy();
1890
+ } else {
1891
+ setEmblaApi(void 0);
1892
+ }
1893
+ }, [viewport, setEmblaApi]);
1894
+ return [setViewport, emblaApi];
1895
+ }
1896
+ useEmblaCarousel.globalOptions = void 0;
1897
+
1898
+ // ../blocks/src/system/runtime/nodes/carousel.shared.ts
1899
+ function normalizeSlidesCount(value) {
1900
+ const parsed = typeof value === "string" ? Number.parseInt(value, 10) : typeof value === "number" ? value : 1;
1901
+ if (!Number.isFinite(parsed) || parsed <= 0) return 1;
1902
+ return Math.max(1, Math.min(6, parsed));
1903
+ }
1904
+ function isBreakpointSet(value) {
1905
+ return value !== void 0 && value !== null && value !== "";
1906
+ }
1907
+ function normalizeSlidesToShow(value) {
1908
+ if (value && typeof value === "object") {
1909
+ const mobile = normalizeSlidesCount(value.mobile ?? 1);
1910
+ const tablet = isBreakpointSet(value.tablet) ? normalizeSlidesCount(value.tablet) : void 0;
1911
+ const desktop = isBreakpointSet(value.desktop) ? normalizeSlidesCount(value.desktop) : void 0;
1912
+ return {
1913
+ mobile,
1914
+ ...tablet !== void 0 ? { tablet } : {},
1915
+ ...desktop !== void 0 ? { desktop } : {}
1916
+ };
1917
+ }
1918
+ return normalizeSlidesCount(value);
1919
+ }
1920
+ function resolveSlidesToShowMobile(value) {
1921
+ return typeof value === "number" ? value : value.mobile;
1922
+ }
1923
+ function getCarouselSlidesToShowCssVars(value) {
1924
+ if (typeof value === "number") {
1925
+ return { "--rb-carousel-slides-to-show-mobile": value };
1926
+ }
1927
+ return {
1928
+ "--rb-carousel-slides-to-show-mobile": value.mobile,
1929
+ ...value.tablet !== void 0 ? { "--rb-carousel-slides-to-show-tablet": value.tablet } : {},
1930
+ ...value.desktop !== void 0 ? { "--rb-carousel-slides-to-show-desktop": value.desktop } : {}
1931
+ };
1932
+ }
1933
+ function normalizeCarouselProps(input) {
1934
+ const transition = input.transition === "fade" ? "fade" : "slide";
1935
+ const arrowVisibility = input.arrowVisibility === "never" ? "never" : input.arrowVisibility === "hover" ? "hover" : "always";
1936
+ const showControls = arrowVisibility === "never" ? false : normalizeBoolean(input.showControls, true);
1937
+ const showDots = normalizeBoolean(input.showDots, false);
1938
+ const autoplay = normalizeBoolean(input.autoplay, false);
1939
+ const loop = normalizeBoolean(input.loop, true);
1940
+ const autoplayDelay = normalizeNumber(input.autoplayDelay, 5e3);
1941
+ const normalizedSlidesToShow = normalizeSlidesToShow(input.slidesToShow);
1942
+ return {
1943
+ slidesToShow: normalizedSlidesToShow,
1944
+ transition,
1945
+ showControls,
1946
+ showDots,
1947
+ arrowVisibility,
1948
+ autoplay,
1949
+ autoplayDelay,
1950
+ loop
1951
+ };
1952
+ }
1953
+ var CarouselNodeClient = ({
1954
+ children,
1955
+ className,
1956
+ renderRoot = true,
1957
+ slidesToShow,
1958
+ transition,
1959
+ showControls,
1960
+ showDots,
1961
+ arrowVisibility,
1962
+ autoplay,
1963
+ autoplayDelay,
1964
+ loop
1965
+ }) => {
1966
+ const slides = React.Children.toArray(children).filter(Boolean);
1967
+ const normalized = React.useMemo(
1968
+ () => normalizeCarouselProps({
1969
+ slidesToShow,
1970
+ transition,
1971
+ showControls,
1972
+ showDots,
1973
+ arrowVisibility,
1974
+ autoplay,
1975
+ autoplayDelay,
1976
+ loop
1977
+ }),
1978
+ [
1979
+ slidesToShow,
1980
+ transition,
1981
+ showControls,
1982
+ showDots,
1983
+ arrowVisibility,
1984
+ autoplay,
1985
+ autoplayDelay,
1986
+ loop
1987
+ ]
1988
+ );
1989
+ const resolvedSlides = resolveSlidesToShowMobile(normalized.slidesToShow);
1990
+ const cssVars = React.useMemo(
1991
+ () => getCarouselSlidesToShowCssVars(normalized.slidesToShow),
1992
+ [normalized.slidesToShow]
1993
+ );
1994
+ const plugins = React.useMemo(() => {
1995
+ if (!normalized.autoplay) return void 0;
1996
+ return [
1997
+ Autoplay({
1998
+ delay: normalized.autoplayDelay,
1999
+ stopOnMouseEnter: true,
2000
+ stopOnFocusIn: true,
2001
+ stopOnInteraction: false
2002
+ // Continue after manual navigation
2003
+ })
2004
+ ];
2005
+ }, [normalized.autoplay, normalized.autoplayDelay]);
2006
+ const [viewportRef, api] = useEmblaCarousel(
2007
+ {
2008
+ align: "start",
2009
+ axis: "x",
2010
+ slidesToScroll: 1,
2011
+ containScroll: normalized.loop ? false : "trimSnaps",
2012
+ loop: normalized.loop
2013
+ },
2014
+ plugins
2015
+ );
2016
+ const [selectedIndex, setSelectedIndex] = React.useState(0);
2017
+ const [scrollSnaps, setScrollSnaps] = React.useState([]);
2018
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
2019
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
2020
+ React.useEffect(() => {
2021
+ if (!api) return;
2022
+ const onInit = () => {
2023
+ setScrollSnaps(api.scrollSnapList());
2024
+ };
2025
+ const onSelect = () => {
2026
+ setSelectedIndex(api.selectedScrollSnap());
2027
+ setCanScrollPrev(api.canScrollPrev());
2028
+ setCanScrollNext(api.canScrollNext());
2029
+ };
2030
+ api.on("init", onInit);
2031
+ api.on("reInit", onInit);
2032
+ api.on("select", onSelect);
2033
+ api.on("reInit", onSelect);
2034
+ onInit();
2035
+ onSelect();
2036
+ return () => {
2037
+ api.off("init", onInit);
2038
+ api.off("reInit", onInit);
2039
+ api.off("select", onSelect);
2040
+ api.off("reInit", onSelect);
2041
+ };
2042
+ }, [api]);
2043
+ React.useEffect(() => {
2044
+ if (!api || !normalized.autoplay) return;
2045
+ const autoplayPlugin = api.plugins()?.autoplay;
2046
+ if (!autoplayPlugin) return;
2047
+ const handleVisibility = () => {
2048
+ if (document.hidden) autoplayPlugin.stop();
2049
+ else autoplayPlugin.play();
2050
+ };
2051
+ document.addEventListener("visibilitychange", handleVisibility);
2052
+ return () => document.removeEventListener("visibilitychange", handleVisibility);
2053
+ }, [api, normalized.autoplay]);
2054
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
2055
+ /* @__PURE__ */ jsx("div", { className: "carousel-frame rb-overflow-hidden rb-w-full", children: /* @__PURE__ */ jsx(
2056
+ "div",
2057
+ {
2058
+ ref: viewportRef,
2059
+ className: "carousel-viewport rb-overflow-hidden rb-w-full",
2060
+ children: /* @__PURE__ */ jsx("div", { className: "carousel-track rb-flex rb-will-change-transform", children: slides.map((slide, index) => /* @__PURE__ */ jsx(
2061
+ CarouselSlide,
2062
+ {
2063
+ index,
2064
+ transition: normalized.transition,
2065
+ selectedIndex,
2066
+ children: slide
2067
+ },
2068
+ index
2069
+ )) })
2070
+ }
2071
+ ) }),
2072
+ normalized.showControls && /* @__PURE__ */ jsx(
2073
+ CarouselArrows,
2074
+ {
2075
+ slidesCount: slides.length,
2076
+ resolvedSlides,
2077
+ api,
2078
+ canScrollPrev,
2079
+ canScrollNext
2080
+ }
2081
+ ),
2082
+ normalized.showDots && scrollSnaps.length > 1 && /* @__PURE__ */ jsx(
2083
+ CarouselDots,
2084
+ {
2085
+ api,
2086
+ scrollSnaps,
2087
+ selectedIndex
2088
+ }
2089
+ )
2090
+ ] });
2091
+ if (!renderRoot) {
2092
+ return inner;
2093
+ }
2094
+ return /* @__PURE__ */ jsx(
2095
+ "div",
2096
+ {
2097
+ className: clsx_default("carousel-root rb-relative", className),
2098
+ style: cssVars,
2099
+ "data-slides-to-show": resolvedSlides,
2100
+ "data-transition": normalized.transition,
2101
+ "data-show-controls": normalized.showControls ? "true" : "false",
2102
+ "data-show-dots": normalized.showDots ? "true" : "false",
2103
+ "data-arrow-visibility": normalized.arrowVisibility,
2104
+ "data-autoplay": normalized.autoplay ? "true" : "false",
2105
+ "data-loop": normalized.loop ? "true" : "false",
2106
+ children: inner
2107
+ }
2108
+ );
2109
+ };
2110
+ var CarouselArrows = ({
2111
+ slidesCount,
2112
+ resolvedSlides,
2113
+ api,
2114
+ canScrollPrev,
2115
+ canScrollNext
2116
+ }) => {
2117
+ if (slidesCount <= resolvedSlides) return null;
2118
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2119
+ /* @__PURE__ */ jsx(
2120
+ "button",
2121
+ {
2122
+ type: "button",
2123
+ className: "carousel-nav-btn carousel-nav-btn--prev",
2124
+ disabled: !canScrollPrev,
2125
+ "aria-disabled": !canScrollPrev,
2126
+ "aria-label": "Previous slide",
2127
+ onClick: () => api?.scrollPrev(),
2128
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "carousel-nav-icon", "aria-hidden": "true" })
2129
+ }
2130
+ ),
2131
+ /* @__PURE__ */ jsx(
2132
+ "button",
2133
+ {
2134
+ type: "button",
2135
+ className: "carousel-nav-btn carousel-nav-btn--next",
2136
+ disabled: !canScrollNext,
2137
+ "aria-disabled": !canScrollNext,
2138
+ "aria-label": "Next slide",
2139
+ onClick: () => api?.scrollNext(),
2140
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "carousel-nav-icon", "aria-hidden": "true" })
2141
+ }
2142
+ )
2143
+ ] });
2144
+ };
2145
+ var CarouselSlide = ({
2146
+ index,
2147
+ transition,
2148
+ selectedIndex,
2149
+ children
2150
+ }) => {
2151
+ const isActive = selectedIndex === index;
2152
+ return /* @__PURE__ */ jsx(
2153
+ "div",
2154
+ {
2155
+ "data-active": isActive,
2156
+ "data-carousel-slide": true,
2157
+ role: "group",
2158
+ "aria-roledescription": "slide",
2159
+ className: clsx_default(
2160
+ "carousel-slide rb-min-w-0",
2161
+ transition === "fade" && "rb-transition-opacity rb-duration-500 rb-ease-in-out",
2162
+ transition === "fade" && !isActive ? "rb-opacity-0 rb-pointer-events-none" : "rb-opacity-100"
2163
+ ),
2164
+ children
2165
+ }
2166
+ );
2167
+ };
2168
+ var CarouselDots = ({
2169
+ api,
2170
+ scrollSnaps,
2171
+ selectedIndex
2172
+ }) => {
2173
+ return /* @__PURE__ */ jsx(
2174
+ "div",
2175
+ {
2176
+ role: "tablist",
2177
+ "aria-label": "Carousel navigation",
2178
+ className: "carousel-dots",
2179
+ children: scrollSnaps.map((_, index) => /* @__PURE__ */ jsx(
2180
+ "button",
2181
+ {
2182
+ type: "button",
2183
+ role: "tab",
2184
+ "aria-selected": index === selectedIndex,
2185
+ "aria-label": `Go to slide ${index + 1}`,
2186
+ "data-active": index === selectedIndex ? "true" : "false",
2187
+ className: "carousel-dot",
2188
+ onClick: () => api?.scrollTo(index)
2189
+ },
2190
+ index
2191
+ ))
2192
+ }
2193
+ );
2194
+ };
2195
+ function normalizeNumber(value, fallback) {
2196
+ const parsed = typeof value === "string" ? Number.parseInt(value, 10) : typeof value === "number" ? value : fallback;
2197
+ if (!Number.isFinite(parsed)) return fallback;
2198
+ return parsed;
2199
+ }
2200
+ function normalizeBoolean(value, fallback) {
2201
+ if (typeof value === "boolean") return value;
2202
+ if (typeof value === "string") return value !== "false";
2203
+ return fallback;
2204
+ }
2205
+
2206
+ export { CarouselNodeClient, normalizeCarouselProps };