sunpeak 0.5.12 → 0.5.13

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 (87) hide show
  1. package/bin/sunpeak.js +11 -1
  2. package/package.json +1 -1
  3. package/template/_gitignore +47 -0
  4. package/template/dist/chatgpt/albums.js +49 -0
  5. package/template/dist/chatgpt/carousel.js +49 -0
  6. package/template/dist/chatgpt/counter.js +49 -0
  7. package/template/node_modules/.bin/eslint +21 -0
  8. package/template/node_modules/.bin/eslint-config-prettier +21 -0
  9. package/template/node_modules/.bin/nodemon +21 -0
  10. package/template/node_modules/.bin/prettier +21 -0
  11. package/template/node_modules/.bin/sunpeak +21 -0
  12. package/template/node_modules/.bin/ts-node +21 -0
  13. package/template/node_modules/.bin/ts-node-cwd +21 -0
  14. package/template/node_modules/.bin/ts-node-esm +21 -0
  15. package/template/node_modules/.bin/ts-node-script +21 -0
  16. package/template/node_modules/.bin/ts-node-transpile-only +21 -0
  17. package/template/node_modules/.bin/ts-script +21 -0
  18. package/template/node_modules/.bin/tsc +21 -0
  19. package/template/node_modules/.bin/tsserver +21 -0
  20. package/template/node_modules/.bin/tsx +21 -0
  21. package/template/node_modules/.bin/vite +21 -0
  22. package/template/node_modules/.bin/vitest +21 -0
  23. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js +20 -0
  24. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js.map +7 -0
  25. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Checkbox.js +33 -0
  26. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Checkbox.js.map +7 -0
  27. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Icon.js +1498 -0
  28. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Icon.js.map +7 -0
  29. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Input.js +13 -0
  30. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Input.js.map +7 -0
  31. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js +103 -0
  32. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js.map +7 -0
  33. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +1019 -0
  34. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js.map +7 -0
  35. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js +95 -0
  36. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js.map +7 -0
  37. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_theme.js +45 -0
  38. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_theme.js.map +7 -0
  39. package/template/node_modules/.vite/deps/_metadata.json +151 -0
  40. package/template/node_modules/.vite/deps/chunk-4TLBUCVB.js +1004 -0
  41. package/template/node_modules/.vite/deps/chunk-4TLBUCVB.js.map +7 -0
  42. package/template/node_modules/.vite/deps/chunk-BAG6OO6S.js +115 -0
  43. package/template/node_modules/.vite/deps/chunk-BAG6OO6S.js.map +7 -0
  44. package/template/node_modules/.vite/deps/chunk-CNYJBM5F.js +21 -0
  45. package/template/node_modules/.vite/deps/chunk-CNYJBM5F.js.map +7 -0
  46. package/template/node_modules/.vite/deps/chunk-CQ3GYAYB.js +112 -0
  47. package/template/node_modules/.vite/deps/chunk-CQ3GYAYB.js.map +7 -0
  48. package/template/node_modules/.vite/deps/chunk-EGRHWZRV.js +1 -0
  49. package/template/node_modules/.vite/deps/chunk-EGRHWZRV.js.map +7 -0
  50. package/template/node_modules/.vite/deps/chunk-EVJ3DVH5.js +628 -0
  51. package/template/node_modules/.vite/deps/chunk-EVJ3DVH5.js.map +7 -0
  52. package/template/node_modules/.vite/deps/chunk-ILHRZGIS.js +46 -0
  53. package/template/node_modules/.vite/deps/chunk-ILHRZGIS.js.map +7 -0
  54. package/template/node_modules/.vite/deps/chunk-KFGKZMLK.js +280 -0
  55. package/template/node_modules/.vite/deps/chunk-KFGKZMLK.js.map +7 -0
  56. package/template/node_modules/.vite/deps/chunk-PTVT3RFX.js +292 -0
  57. package/template/node_modules/.vite/deps/chunk-PTVT3RFX.js.map +7 -0
  58. package/template/node_modules/.vite/deps/chunk-QPJAV452.js +13 -0
  59. package/template/node_modules/.vite/deps/chunk-QPJAV452.js.map +7 -0
  60. package/template/node_modules/.vite/deps/chunk-SGWD4VEU.js +15195 -0
  61. package/template/node_modules/.vite/deps/chunk-SGWD4VEU.js.map +7 -0
  62. package/template/node_modules/.vite/deps/chunk-XB525PXG.js +4480 -0
  63. package/template/node_modules/.vite/deps/chunk-XB525PXG.js.map +7 -0
  64. package/template/node_modules/.vite/deps/chunk-YOJ6QPGS.js +231 -0
  65. package/template/node_modules/.vite/deps/chunk-YOJ6QPGS.js.map +7 -0
  66. package/template/node_modules/.vite/deps/clsx.js +10 -0
  67. package/template/node_modules/.vite/deps/clsx.js.map +7 -0
  68. package/template/node_modules/.vite/deps/embla-carousel-react.js +1712 -0
  69. package/template/node_modules/.vite/deps/embla-carousel-react.js.map +7 -0
  70. package/template/node_modules/.vite/deps/embla-carousel-wheel-gestures.js +589 -0
  71. package/template/node_modules/.vite/deps/embla-carousel-wheel-gestures.js.map +7 -0
  72. package/template/node_modules/.vite/deps/package.json +3 -0
  73. package/template/node_modules/.vite/deps/react-dom.js +7 -0
  74. package/template/node_modules/.vite/deps/react-dom.js.map +7 -0
  75. package/template/node_modules/.vite/deps/react-dom_client.js +20217 -0
  76. package/template/node_modules/.vite/deps/react-dom_client.js.map +7 -0
  77. package/template/node_modules/.vite/deps/react.js +6 -0
  78. package/template/node_modules/.vite/deps/react.js.map +7 -0
  79. package/template/node_modules/.vite/deps/react_jsx-dev-runtime.js +278 -0
  80. package/template/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
  81. package/template/node_modules/.vite/deps/react_jsx-runtime.js +7 -0
  82. package/template/node_modules/.vite/deps/react_jsx-runtime.js.map +7 -0
  83. package/template/node_modules/.vite/deps/tailwind-merge.js +3095 -0
  84. package/template/node_modules/.vite/deps/tailwind-merge.js.map +7 -0
  85. package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  86. /package/template/{.prettierignore → _prettierignore} +0 -0
  87. /package/template/{.prettierrc → _prettierrc} +0 -0
@@ -0,0 +1,1712 @@
1
+ import {
2
+ require_react
3
+ } from "./chunk-4TLBUCVB.js";
4
+ import {
5
+ __toESM
6
+ } from "./chunk-ILHRZGIS.js";
7
+
8
+ // ../node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.0/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js
9
+ var import_react = __toESM(require_react());
10
+
11
+ // ../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
12
+ function isObject(subject) {
13
+ return Object.prototype.toString.call(subject) === "[object Object]";
14
+ }
15
+ function isRecord(subject) {
16
+ return isObject(subject) || Array.isArray(subject);
17
+ }
18
+ function canUseDOM() {
19
+ return !!(typeof window !== "undefined" && window.document && window.document.createElement);
20
+ }
21
+ function areOptionsEqual(optionsA, optionsB) {
22
+ const optionsAKeys = Object.keys(optionsA);
23
+ const optionsBKeys = Object.keys(optionsB);
24
+ if (optionsAKeys.length !== optionsBKeys.length) return false;
25
+ const breakpointsA = JSON.stringify(Object.keys(optionsA.breakpoints || {}));
26
+ const breakpointsB = JSON.stringify(Object.keys(optionsB.breakpoints || {}));
27
+ if (breakpointsA !== breakpointsB) return false;
28
+ return optionsAKeys.every((key) => {
29
+ const valueA = optionsA[key];
30
+ const valueB = optionsB[key];
31
+ if (typeof valueA === "function") return `${valueA}` === `${valueB}`;
32
+ if (!isRecord(valueA) || !isRecord(valueB)) return valueA === valueB;
33
+ return areOptionsEqual(valueA, valueB);
34
+ });
35
+ }
36
+ function sortAndMapPluginToOptions(plugins) {
37
+ return plugins.concat().sort((a, b) => a.name > b.name ? 1 : -1).map((plugin) => plugin.options);
38
+ }
39
+ function arePluginsEqual(pluginsA, pluginsB) {
40
+ if (pluginsA.length !== pluginsB.length) return false;
41
+ const optionsA = sortAndMapPluginToOptions(pluginsA);
42
+ const optionsB = sortAndMapPluginToOptions(pluginsB);
43
+ return optionsA.every((optionA, index) => {
44
+ const optionB = optionsB[index];
45
+ return areOptionsEqual(optionA, optionB);
46
+ });
47
+ }
48
+
49
+ // ../node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js
50
+ function isNumber(subject) {
51
+ return typeof subject === "number";
52
+ }
53
+ function isString(subject) {
54
+ return typeof subject === "string";
55
+ }
56
+ function isBoolean(subject) {
57
+ return typeof subject === "boolean";
58
+ }
59
+ function isObject2(subject) {
60
+ return Object.prototype.toString.call(subject) === "[object Object]";
61
+ }
62
+ function mathAbs(n) {
63
+ return Math.abs(n);
64
+ }
65
+ function mathSign(n) {
66
+ return Math.sign(n);
67
+ }
68
+ function deltaAbs(valueB, valueA) {
69
+ return mathAbs(valueB - valueA);
70
+ }
71
+ function factorAbs(valueB, valueA) {
72
+ if (valueB === 0 || valueA === 0) return 0;
73
+ if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
74
+ const diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
75
+ return mathAbs(diff / valueB);
76
+ }
77
+ function roundToTwoDecimals(num) {
78
+ return Math.round(num * 100) / 100;
79
+ }
80
+ function arrayKeys(array) {
81
+ return objectKeys(array).map(Number);
82
+ }
83
+ function arrayLast(array) {
84
+ return array[arrayLastIndex(array)];
85
+ }
86
+ function arrayLastIndex(array) {
87
+ return Math.max(0, array.length - 1);
88
+ }
89
+ function arrayIsLastIndex(array, index) {
90
+ return index === arrayLastIndex(array);
91
+ }
92
+ function arrayFromNumber(n, startAt = 0) {
93
+ return Array.from(Array(n), (_, i) => startAt + i);
94
+ }
95
+ function objectKeys(object) {
96
+ return Object.keys(object);
97
+ }
98
+ function objectsMergeDeep(objectA, objectB) {
99
+ return [objectA, objectB].reduce((mergedObjects, currentObject) => {
100
+ objectKeys(currentObject).forEach((key) => {
101
+ const valueA = mergedObjects[key];
102
+ const valueB = currentObject[key];
103
+ const areObjects = isObject2(valueA) && isObject2(valueB);
104
+ mergedObjects[key] = areObjects ? objectsMergeDeep(valueA, valueB) : valueB;
105
+ });
106
+ return mergedObjects;
107
+ }, {});
108
+ }
109
+ function isMouseEvent(evt, ownerWindow) {
110
+ return typeof ownerWindow.MouseEvent !== "undefined" && evt instanceof ownerWindow.MouseEvent;
111
+ }
112
+ function Alignment(align, viewSize) {
113
+ const predefined = {
114
+ start,
115
+ center,
116
+ end
117
+ };
118
+ function start() {
119
+ return 0;
120
+ }
121
+ function center(n) {
122
+ return end(n) / 2;
123
+ }
124
+ function end(n) {
125
+ return viewSize - n;
126
+ }
127
+ function measure(n, index) {
128
+ if (isString(align)) return predefined[align](n);
129
+ return align(viewSize, n, index);
130
+ }
131
+ const self = {
132
+ measure
133
+ };
134
+ return self;
135
+ }
136
+ function EventStore() {
137
+ let listeners = [];
138
+ function add(node, type, handler, options = {
139
+ passive: true
140
+ }) {
141
+ let removeListener;
142
+ if ("addEventListener" in node) {
143
+ node.addEventListener(type, handler, options);
144
+ removeListener = () => node.removeEventListener(type, handler, options);
145
+ } else {
146
+ const legacyMediaQueryList = node;
147
+ legacyMediaQueryList.addListener(handler);
148
+ removeListener = () => legacyMediaQueryList.removeListener(handler);
149
+ }
150
+ listeners.push(removeListener);
151
+ return self;
152
+ }
153
+ function clear() {
154
+ listeners = listeners.filter((remove) => remove());
155
+ }
156
+ const self = {
157
+ add,
158
+ clear
159
+ };
160
+ return self;
161
+ }
162
+ function Animations(ownerDocument, ownerWindow, update, render) {
163
+ const documentVisibleHandler = EventStore();
164
+ const fixedTimeStep = 1e3 / 60;
165
+ let lastTimeStamp = null;
166
+ let accumulatedTime = 0;
167
+ let animationId = 0;
168
+ function init() {
169
+ documentVisibleHandler.add(ownerDocument, "visibilitychange", () => {
170
+ if (ownerDocument.hidden) reset();
171
+ });
172
+ }
173
+ function destroy() {
174
+ stop();
175
+ documentVisibleHandler.clear();
176
+ }
177
+ function animate(timeStamp) {
178
+ if (!animationId) return;
179
+ if (!lastTimeStamp) {
180
+ lastTimeStamp = timeStamp;
181
+ update();
182
+ update();
183
+ }
184
+ const timeElapsed = timeStamp - lastTimeStamp;
185
+ lastTimeStamp = timeStamp;
186
+ accumulatedTime += timeElapsed;
187
+ while (accumulatedTime >= fixedTimeStep) {
188
+ update();
189
+ accumulatedTime -= fixedTimeStep;
190
+ }
191
+ const alpha = accumulatedTime / fixedTimeStep;
192
+ render(alpha);
193
+ if (animationId) {
194
+ animationId = ownerWindow.requestAnimationFrame(animate);
195
+ }
196
+ }
197
+ function start() {
198
+ if (animationId) return;
199
+ animationId = ownerWindow.requestAnimationFrame(animate);
200
+ }
201
+ function stop() {
202
+ ownerWindow.cancelAnimationFrame(animationId);
203
+ lastTimeStamp = null;
204
+ accumulatedTime = 0;
205
+ animationId = 0;
206
+ }
207
+ function reset() {
208
+ lastTimeStamp = null;
209
+ accumulatedTime = 0;
210
+ }
211
+ const self = {
212
+ init,
213
+ destroy,
214
+ start,
215
+ stop,
216
+ update,
217
+ render
218
+ };
219
+ return self;
220
+ }
221
+ function Axis(axis, contentDirection) {
222
+ const isRightToLeft = contentDirection === "rtl";
223
+ const isVertical = axis === "y";
224
+ const scroll = isVertical ? "y" : "x";
225
+ const cross = isVertical ? "x" : "y";
226
+ const sign = !isVertical && isRightToLeft ? -1 : 1;
227
+ const startEdge = getStartEdge();
228
+ const endEdge = getEndEdge();
229
+ function measureSize(nodeRect) {
230
+ const {
231
+ height,
232
+ width
233
+ } = nodeRect;
234
+ return isVertical ? height : width;
235
+ }
236
+ function getStartEdge() {
237
+ if (isVertical) return "top";
238
+ return isRightToLeft ? "right" : "left";
239
+ }
240
+ function getEndEdge() {
241
+ if (isVertical) return "bottom";
242
+ return isRightToLeft ? "left" : "right";
243
+ }
244
+ function direction(n) {
245
+ return n * sign;
246
+ }
247
+ const self = {
248
+ scroll,
249
+ cross,
250
+ startEdge,
251
+ endEdge,
252
+ measureSize,
253
+ direction
254
+ };
255
+ return self;
256
+ }
257
+ function Limit(min = 0, max = 0) {
258
+ const length = mathAbs(min - max);
259
+ function reachedMin(n) {
260
+ return n < min;
261
+ }
262
+ function reachedMax(n) {
263
+ return n > max;
264
+ }
265
+ function reachedAny(n) {
266
+ return reachedMin(n) || reachedMax(n);
267
+ }
268
+ function constrain(n) {
269
+ if (!reachedAny(n)) return n;
270
+ return reachedMin(n) ? min : max;
271
+ }
272
+ function removeOffset(n) {
273
+ if (!length) return n;
274
+ return n - length * Math.ceil((n - max) / length);
275
+ }
276
+ const self = {
277
+ length,
278
+ max,
279
+ min,
280
+ constrain,
281
+ reachedAny,
282
+ reachedMax,
283
+ reachedMin,
284
+ removeOffset
285
+ };
286
+ return self;
287
+ }
288
+ function Counter(max, start, loop) {
289
+ const {
290
+ constrain
291
+ } = Limit(0, max);
292
+ const loopEnd = max + 1;
293
+ let counter = withinLimit(start);
294
+ function withinLimit(n) {
295
+ return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
296
+ }
297
+ function get() {
298
+ return counter;
299
+ }
300
+ function set(n) {
301
+ counter = withinLimit(n);
302
+ return self;
303
+ }
304
+ function add(n) {
305
+ return clone().set(get() + n);
306
+ }
307
+ function clone() {
308
+ return Counter(max, get(), loop);
309
+ }
310
+ const self = {
311
+ get,
312
+ set,
313
+ add,
314
+ clone
315
+ };
316
+ return self;
317
+ }
318
+ function DragHandler(axis, rootNode, ownerDocument, ownerWindow, target, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, baseFriction, watchDrag) {
319
+ const {
320
+ cross: crossAxis,
321
+ direction
322
+ } = axis;
323
+ const focusNodes = ["INPUT", "SELECT", "TEXTAREA"];
324
+ const nonPassiveEvent = {
325
+ passive: false
326
+ };
327
+ const initEvents = EventStore();
328
+ const dragEvents = EventStore();
329
+ const goToNextThreshold = Limit(50, 225).constrain(percentOfView.measure(20));
330
+ const snapForceBoost = {
331
+ mouse: 300,
332
+ touch: 400
333
+ };
334
+ const freeForceBoost = {
335
+ mouse: 500,
336
+ touch: 600
337
+ };
338
+ const baseSpeed = dragFree ? 43 : 25;
339
+ let isMoving = false;
340
+ let startScroll = 0;
341
+ let startCross = 0;
342
+ let pointerIsDown = false;
343
+ let preventScroll = false;
344
+ let preventClick = false;
345
+ let isMouse = false;
346
+ function init(emblaApi) {
347
+ if (!watchDrag) return;
348
+ function downIfAllowed(evt) {
349
+ if (isBoolean(watchDrag) || watchDrag(emblaApi, evt)) down(evt);
350
+ }
351
+ const node = rootNode;
352
+ 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);
353
+ }
354
+ function destroy() {
355
+ initEvents.clear();
356
+ dragEvents.clear();
357
+ }
358
+ function addDragEvents() {
359
+ const node = isMouse ? ownerDocument : rootNode;
360
+ dragEvents.add(node, "touchmove", move, nonPassiveEvent).add(node, "touchend", up).add(node, "mousemove", move, nonPassiveEvent).add(node, "mouseup", up);
361
+ }
362
+ function isFocusNode(node) {
363
+ const nodeName = node.nodeName || "";
364
+ return focusNodes.includes(nodeName);
365
+ }
366
+ function forceBoost() {
367
+ const boost = dragFree ? freeForceBoost : snapForceBoost;
368
+ const type = isMouse ? "mouse" : "touch";
369
+ return boost[type];
370
+ }
371
+ function allowedForce(force, targetChanged) {
372
+ const next = index.add(mathSign(force) * -1);
373
+ const baseForce = scrollTarget.byDistance(force, !dragFree).distance;
374
+ if (dragFree || mathAbs(force) < goToNextThreshold) return baseForce;
375
+ if (skipSnaps && targetChanged) return baseForce * 0.5;
376
+ return scrollTarget.byIndex(next.get(), 0).distance;
377
+ }
378
+ function down(evt) {
379
+ const isMouseEvt = isMouseEvent(evt, ownerWindow);
380
+ isMouse = isMouseEvt;
381
+ preventClick = dragFree && isMouseEvt && !evt.buttons && isMoving;
382
+ isMoving = deltaAbs(target.get(), location.get()) >= 2;
383
+ if (isMouseEvt && evt.button !== 0) return;
384
+ if (isFocusNode(evt.target)) return;
385
+ pointerIsDown = true;
386
+ dragTracker.pointerDown(evt);
387
+ scrollBody.useFriction(0).useDuration(0);
388
+ target.set(location);
389
+ addDragEvents();
390
+ startScroll = dragTracker.readPoint(evt);
391
+ startCross = dragTracker.readPoint(evt, crossAxis);
392
+ eventHandler.emit("pointerDown");
393
+ }
394
+ function move(evt) {
395
+ const isTouchEvt = !isMouseEvent(evt, ownerWindow);
396
+ if (isTouchEvt && evt.touches.length >= 2) return up(evt);
397
+ const lastScroll = dragTracker.readPoint(evt);
398
+ const lastCross = dragTracker.readPoint(evt, crossAxis);
399
+ const diffScroll = deltaAbs(lastScroll, startScroll);
400
+ const diffCross = deltaAbs(lastCross, startCross);
401
+ if (!preventScroll && !isMouse) {
402
+ if (!evt.cancelable) return up(evt);
403
+ preventScroll = diffScroll > diffCross;
404
+ if (!preventScroll) return up(evt);
405
+ }
406
+ const diff = dragTracker.pointerMove(evt);
407
+ if (diffScroll > dragThreshold) preventClick = true;
408
+ scrollBody.useFriction(0.3).useDuration(0.75);
409
+ animation.start();
410
+ target.add(direction(diff));
411
+ evt.preventDefault();
412
+ }
413
+ function up(evt) {
414
+ const currentLocation = scrollTarget.byDistance(0, false);
415
+ const targetChanged = currentLocation.index !== index.get();
416
+ const rawForce = dragTracker.pointerUp(evt) * forceBoost();
417
+ const force = allowedForce(direction(rawForce), targetChanged);
418
+ const forceFactor = factorAbs(rawForce, force);
419
+ const speed = baseSpeed - 10 * forceFactor;
420
+ const friction = baseFriction + forceFactor / 50;
421
+ preventScroll = false;
422
+ pointerIsDown = false;
423
+ dragEvents.clear();
424
+ scrollBody.useDuration(speed).useFriction(friction);
425
+ scrollTo.distance(force, !dragFree);
426
+ isMouse = false;
427
+ eventHandler.emit("pointerUp");
428
+ }
429
+ function click(evt) {
430
+ if (preventClick) {
431
+ evt.stopPropagation();
432
+ evt.preventDefault();
433
+ preventClick = false;
434
+ }
435
+ }
436
+ function pointerDown() {
437
+ return pointerIsDown;
438
+ }
439
+ const self = {
440
+ init,
441
+ destroy,
442
+ pointerDown
443
+ };
444
+ return self;
445
+ }
446
+ function DragTracker(axis, ownerWindow) {
447
+ const logInterval = 170;
448
+ let startEvent;
449
+ let lastEvent;
450
+ function readTime(evt) {
451
+ return evt.timeStamp;
452
+ }
453
+ function readPoint(evt, evtAxis) {
454
+ const property = evtAxis || axis.scroll;
455
+ const coord = `client${property === "x" ? "X" : "Y"}`;
456
+ return (isMouseEvent(evt, ownerWindow) ? evt : evt.touches[0])[coord];
457
+ }
458
+ function pointerDown(evt) {
459
+ startEvent = evt;
460
+ lastEvent = evt;
461
+ return readPoint(evt);
462
+ }
463
+ function pointerMove(evt) {
464
+ const diff = readPoint(evt) - readPoint(lastEvent);
465
+ const expired = readTime(evt) - readTime(startEvent) > logInterval;
466
+ lastEvent = evt;
467
+ if (expired) startEvent = evt;
468
+ return diff;
469
+ }
470
+ function pointerUp(evt) {
471
+ if (!startEvent || !lastEvent) return 0;
472
+ const diffDrag = readPoint(lastEvent) - readPoint(startEvent);
473
+ const diffTime = readTime(evt) - readTime(startEvent);
474
+ const expired = readTime(evt) - readTime(lastEvent) > logInterval;
475
+ const force = diffDrag / diffTime;
476
+ const isFlick = diffTime && !expired && mathAbs(force) > 0.1;
477
+ return isFlick ? force : 0;
478
+ }
479
+ const self = {
480
+ pointerDown,
481
+ pointerMove,
482
+ pointerUp,
483
+ readPoint
484
+ };
485
+ return self;
486
+ }
487
+ function NodeRects() {
488
+ function measure(node) {
489
+ const {
490
+ offsetTop,
491
+ offsetLeft,
492
+ offsetWidth,
493
+ offsetHeight
494
+ } = node;
495
+ const offset = {
496
+ top: offsetTop,
497
+ right: offsetLeft + offsetWidth,
498
+ bottom: offsetTop + offsetHeight,
499
+ left: offsetLeft,
500
+ width: offsetWidth,
501
+ height: offsetHeight
502
+ };
503
+ return offset;
504
+ }
505
+ const self = {
506
+ measure
507
+ };
508
+ return self;
509
+ }
510
+ function PercentOfView(viewSize) {
511
+ function measure(n) {
512
+ return viewSize * (n / 100);
513
+ }
514
+ const self = {
515
+ measure
516
+ };
517
+ return self;
518
+ }
519
+ function ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects) {
520
+ const observeNodes = [container].concat(slides);
521
+ let resizeObserver;
522
+ let containerSize;
523
+ let slideSizes = [];
524
+ let destroyed = false;
525
+ function readSize(node) {
526
+ return axis.measureSize(nodeRects.measure(node));
527
+ }
528
+ function init(emblaApi) {
529
+ if (!watchResize) return;
530
+ containerSize = readSize(container);
531
+ slideSizes = slides.map(readSize);
532
+ function defaultCallback(entries) {
533
+ for (const entry of entries) {
534
+ if (destroyed) return;
535
+ const isContainer = entry.target === container;
536
+ const slideIndex = slides.indexOf(entry.target);
537
+ const lastSize = isContainer ? containerSize : slideSizes[slideIndex];
538
+ const newSize = readSize(isContainer ? container : slides[slideIndex]);
539
+ const diffSize = mathAbs(newSize - lastSize);
540
+ if (diffSize >= 0.5) {
541
+ emblaApi.reInit();
542
+ eventHandler.emit("resize");
543
+ break;
544
+ }
545
+ }
546
+ }
547
+ resizeObserver = new ResizeObserver((entries) => {
548
+ if (isBoolean(watchResize) || watchResize(emblaApi, entries)) {
549
+ defaultCallback(entries);
550
+ }
551
+ });
552
+ ownerWindow.requestAnimationFrame(() => {
553
+ observeNodes.forEach((node) => resizeObserver.observe(node));
554
+ });
555
+ }
556
+ function destroy() {
557
+ destroyed = true;
558
+ if (resizeObserver) resizeObserver.disconnect();
559
+ }
560
+ const self = {
561
+ init,
562
+ destroy
563
+ };
564
+ return self;
565
+ }
566
+ function ScrollBody(location, offsetLocation, previousLocation, target, baseDuration, baseFriction) {
567
+ let scrollVelocity = 0;
568
+ let scrollDirection = 0;
569
+ let scrollDuration = baseDuration;
570
+ let scrollFriction = baseFriction;
571
+ let rawLocation = location.get();
572
+ let rawLocationPrevious = 0;
573
+ function seek() {
574
+ const displacement = target.get() - location.get();
575
+ const isInstant = !scrollDuration;
576
+ let scrollDistance = 0;
577
+ if (isInstant) {
578
+ scrollVelocity = 0;
579
+ previousLocation.set(target);
580
+ location.set(target);
581
+ scrollDistance = displacement;
582
+ } else {
583
+ previousLocation.set(location);
584
+ scrollVelocity += displacement / scrollDuration;
585
+ scrollVelocity *= scrollFriction;
586
+ rawLocation += scrollVelocity;
587
+ location.add(scrollVelocity);
588
+ scrollDistance = rawLocation - rawLocationPrevious;
589
+ }
590
+ scrollDirection = mathSign(scrollDistance);
591
+ rawLocationPrevious = rawLocation;
592
+ return self;
593
+ }
594
+ function settled() {
595
+ const diff = target.get() - offsetLocation.get();
596
+ return mathAbs(diff) < 1e-3;
597
+ }
598
+ function duration() {
599
+ return scrollDuration;
600
+ }
601
+ function direction() {
602
+ return scrollDirection;
603
+ }
604
+ function velocity() {
605
+ return scrollVelocity;
606
+ }
607
+ function useBaseDuration() {
608
+ return useDuration(baseDuration);
609
+ }
610
+ function useBaseFriction() {
611
+ return useFriction(baseFriction);
612
+ }
613
+ function useDuration(n) {
614
+ scrollDuration = n;
615
+ return self;
616
+ }
617
+ function useFriction(n) {
618
+ scrollFriction = n;
619
+ return self;
620
+ }
621
+ const self = {
622
+ direction,
623
+ duration,
624
+ velocity,
625
+ seek,
626
+ settled,
627
+ useBaseFriction,
628
+ useBaseDuration,
629
+ useFriction,
630
+ useDuration
631
+ };
632
+ return self;
633
+ }
634
+ function ScrollBounds(limit, location, target, scrollBody, percentOfView) {
635
+ const pullBackThreshold = percentOfView.measure(10);
636
+ const edgeOffsetTolerance = percentOfView.measure(50);
637
+ const frictionLimit = Limit(0.1, 0.99);
638
+ let disabled = false;
639
+ function shouldConstrain() {
640
+ if (disabled) return false;
641
+ if (!limit.reachedAny(target.get())) return false;
642
+ if (!limit.reachedAny(location.get())) return false;
643
+ return true;
644
+ }
645
+ function constrain(pointerDown) {
646
+ if (!shouldConstrain()) return;
647
+ const edge = limit.reachedMin(location.get()) ? "min" : "max";
648
+ const diffToEdge = mathAbs(limit[edge] - location.get());
649
+ const diffToTarget = target.get() - location.get();
650
+ const friction = frictionLimit.constrain(diffToEdge / edgeOffsetTolerance);
651
+ target.subtract(diffToTarget * friction);
652
+ if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
653
+ target.set(limit.constrain(target.get()));
654
+ scrollBody.useDuration(25).useBaseFriction();
655
+ }
656
+ }
657
+ function toggleActive(active) {
658
+ disabled = !active;
659
+ }
660
+ const self = {
661
+ shouldConstrain,
662
+ constrain,
663
+ toggleActive
664
+ };
665
+ return self;
666
+ }
667
+ function ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance) {
668
+ const scrollBounds = Limit(-contentSize + viewSize, 0);
669
+ const snapsBounded = measureBounded();
670
+ const scrollContainLimit = findScrollContainLimit();
671
+ const snapsContained = measureContained();
672
+ function usePixelTolerance(bound, snap) {
673
+ return deltaAbs(bound, snap) <= 1;
674
+ }
675
+ function findScrollContainLimit() {
676
+ const startSnap = snapsBounded[0];
677
+ const endSnap = arrayLast(snapsBounded);
678
+ const min = snapsBounded.lastIndexOf(startSnap);
679
+ const max = snapsBounded.indexOf(endSnap) + 1;
680
+ return Limit(min, max);
681
+ }
682
+ function measureBounded() {
683
+ return snapsAligned.map((snapAligned, index) => {
684
+ const {
685
+ min,
686
+ max
687
+ } = scrollBounds;
688
+ const snap = scrollBounds.constrain(snapAligned);
689
+ const isFirst = !index;
690
+ const isLast = arrayIsLastIndex(snapsAligned, index);
691
+ if (isFirst) return max;
692
+ if (isLast) return min;
693
+ if (usePixelTolerance(min, snap)) return min;
694
+ if (usePixelTolerance(max, snap)) return max;
695
+ return snap;
696
+ }).map((scrollBound) => parseFloat(scrollBound.toFixed(3)));
697
+ }
698
+ function measureContained() {
699
+ if (contentSize <= viewSize + pixelTolerance) return [scrollBounds.max];
700
+ if (containScroll === "keepSnaps") return snapsBounded;
701
+ const {
702
+ min,
703
+ max
704
+ } = scrollContainLimit;
705
+ return snapsBounded.slice(min, max);
706
+ }
707
+ const self = {
708
+ snapsContained,
709
+ scrollContainLimit
710
+ };
711
+ return self;
712
+ }
713
+ function ScrollLimit(contentSize, scrollSnaps, loop) {
714
+ const max = scrollSnaps[0];
715
+ const min = loop ? max - contentSize : arrayLast(scrollSnaps);
716
+ const limit = Limit(min, max);
717
+ const self = {
718
+ limit
719
+ };
720
+ return self;
721
+ }
722
+ function ScrollLooper(contentSize, limit, location, vectors) {
723
+ const jointSafety = 0.1;
724
+ const min = limit.min + jointSafety;
725
+ const max = limit.max + jointSafety;
726
+ const {
727
+ reachedMin,
728
+ reachedMax
729
+ } = Limit(min, max);
730
+ function shouldLoop(direction) {
731
+ if (direction === 1) return reachedMax(location.get());
732
+ if (direction === -1) return reachedMin(location.get());
733
+ return false;
734
+ }
735
+ function loop(direction) {
736
+ if (!shouldLoop(direction)) return;
737
+ const loopDistance = contentSize * (direction * -1);
738
+ vectors.forEach((v) => v.add(loopDistance));
739
+ }
740
+ const self = {
741
+ loop
742
+ };
743
+ return self;
744
+ }
745
+ function ScrollProgress(limit) {
746
+ const {
747
+ max,
748
+ length
749
+ } = limit;
750
+ function get(n) {
751
+ const currentLocation = n - max;
752
+ return length ? currentLocation / -length : 0;
753
+ }
754
+ const self = {
755
+ get
756
+ };
757
+ return self;
758
+ }
759
+ function ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll) {
760
+ const {
761
+ startEdge,
762
+ endEdge
763
+ } = axis;
764
+ const {
765
+ groupSlides
766
+ } = slidesToScroll;
767
+ const alignments = measureSizes().map(alignment.measure);
768
+ const snaps = measureUnaligned();
769
+ const snapsAligned = measureAligned();
770
+ function measureSizes() {
771
+ return groupSlides(slideRects).map((rects) => arrayLast(rects)[endEdge] - rects[0][startEdge]).map(mathAbs);
772
+ }
773
+ function measureUnaligned() {
774
+ return slideRects.map((rect) => containerRect[startEdge] - rect[startEdge]).map((snap) => -mathAbs(snap));
775
+ }
776
+ function measureAligned() {
777
+ return groupSlides(snaps).map((g) => g[0]).map((snap, index) => snap + alignments[index]);
778
+ }
779
+ const self = {
780
+ snaps,
781
+ snapsAligned
782
+ };
783
+ return self;
784
+ }
785
+ function SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes) {
786
+ const {
787
+ groupSlides
788
+ } = slidesToScroll;
789
+ const {
790
+ min,
791
+ max
792
+ } = scrollContainLimit;
793
+ const slideRegistry = createSlideRegistry();
794
+ function createSlideRegistry() {
795
+ const groupedSlideIndexes = groupSlides(slideIndexes);
796
+ const doNotContain = !containSnaps || containScroll === "keepSnaps";
797
+ if (scrollSnaps.length === 1) return [slideIndexes];
798
+ if (doNotContain) return groupedSlideIndexes;
799
+ return groupedSlideIndexes.slice(min, max).map((group, index, groups) => {
800
+ const isFirst = !index;
801
+ const isLast = arrayIsLastIndex(groups, index);
802
+ if (isFirst) {
803
+ const range = arrayLast(groups[0]) + 1;
804
+ return arrayFromNumber(range);
805
+ }
806
+ if (isLast) {
807
+ const range = arrayLastIndex(slideIndexes) - arrayLast(groups)[0] + 1;
808
+ return arrayFromNumber(range, arrayLast(groups)[0]);
809
+ }
810
+ return group;
811
+ });
812
+ }
813
+ const self = {
814
+ slideRegistry
815
+ };
816
+ return self;
817
+ }
818
+ function ScrollTarget(loop, scrollSnaps, contentSize, limit, targetVector) {
819
+ const {
820
+ reachedAny,
821
+ removeOffset,
822
+ constrain
823
+ } = limit;
824
+ function minDistance(distances) {
825
+ return distances.concat().sort((a, b) => mathAbs(a) - mathAbs(b))[0];
826
+ }
827
+ function findTargetSnap(target) {
828
+ const distance = loop ? removeOffset(target) : constrain(target);
829
+ const ascDiffsToSnaps = scrollSnaps.map((snap, index2) => ({
830
+ diff: shortcut(snap - distance, 0),
831
+ index: index2
832
+ })).sort((d1, d2) => mathAbs(d1.diff) - mathAbs(d2.diff));
833
+ const {
834
+ index
835
+ } = ascDiffsToSnaps[0];
836
+ return {
837
+ index,
838
+ distance
839
+ };
840
+ }
841
+ function shortcut(target, direction) {
842
+ const targets = [target, target + contentSize, target - contentSize];
843
+ if (!loop) return target;
844
+ if (!direction) return minDistance(targets);
845
+ const matchingTargets = targets.filter((t) => mathSign(t) === direction);
846
+ if (matchingTargets.length) return minDistance(matchingTargets);
847
+ return arrayLast(targets) - contentSize;
848
+ }
849
+ function byIndex(index, direction) {
850
+ const diffToSnap = scrollSnaps[index] - targetVector.get();
851
+ const distance = shortcut(diffToSnap, direction);
852
+ return {
853
+ index,
854
+ distance
855
+ };
856
+ }
857
+ function byDistance(distance, snap) {
858
+ const target = targetVector.get() + distance;
859
+ const {
860
+ index,
861
+ distance: targetSnapDistance
862
+ } = findTargetSnap(target);
863
+ const reachedBound = !loop && reachedAny(target);
864
+ if (!snap || reachedBound) return {
865
+ index,
866
+ distance
867
+ };
868
+ const diffToSnap = scrollSnaps[index] - targetSnapDistance;
869
+ const snapDistance = distance + shortcut(diffToSnap, 0);
870
+ return {
871
+ index,
872
+ distance: snapDistance
873
+ };
874
+ }
875
+ const self = {
876
+ byDistance,
877
+ byIndex,
878
+ shortcut
879
+ };
880
+ return self;
881
+ }
882
+ function ScrollTo(animation, indexCurrent, indexPrevious, scrollBody, scrollTarget, targetVector, eventHandler) {
883
+ function scrollTo(target) {
884
+ const distanceDiff = target.distance;
885
+ const indexDiff = target.index !== indexCurrent.get();
886
+ targetVector.add(distanceDiff);
887
+ if (distanceDiff) {
888
+ if (scrollBody.duration()) {
889
+ animation.start();
890
+ } else {
891
+ animation.update();
892
+ animation.render(1);
893
+ animation.update();
894
+ }
895
+ }
896
+ if (indexDiff) {
897
+ indexPrevious.set(indexCurrent.get());
898
+ indexCurrent.set(target.index);
899
+ eventHandler.emit("select");
900
+ }
901
+ }
902
+ function distance(n, snap) {
903
+ const target = scrollTarget.byDistance(n, snap);
904
+ scrollTo(target);
905
+ }
906
+ function index(n, direction) {
907
+ const targetIndex = indexCurrent.clone().set(n);
908
+ const target = scrollTarget.byIndex(targetIndex.get(), direction);
909
+ scrollTo(target);
910
+ }
911
+ const self = {
912
+ distance,
913
+ index
914
+ };
915
+ return self;
916
+ }
917
+ function SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus) {
918
+ const focusListenerOptions = {
919
+ passive: true,
920
+ capture: true
921
+ };
922
+ let lastTabPressTime = 0;
923
+ function init(emblaApi) {
924
+ if (!watchFocus) return;
925
+ function defaultCallback(index) {
926
+ const nowTime = (/* @__PURE__ */ new Date()).getTime();
927
+ const diffTime = nowTime - lastTabPressTime;
928
+ if (diffTime > 10) return;
929
+ eventHandler.emit("slideFocusStart");
930
+ root.scrollLeft = 0;
931
+ const group = slideRegistry.findIndex((group2) => group2.includes(index));
932
+ if (!isNumber(group)) return;
933
+ scrollBody.useDuration(0);
934
+ scrollTo.index(group, 0);
935
+ eventHandler.emit("slideFocus");
936
+ }
937
+ eventStore.add(document, "keydown", registerTabPress, false);
938
+ slides.forEach((slide, slideIndex) => {
939
+ eventStore.add(slide, "focus", (evt) => {
940
+ if (isBoolean(watchFocus) || watchFocus(emblaApi, evt)) {
941
+ defaultCallback(slideIndex);
942
+ }
943
+ }, focusListenerOptions);
944
+ });
945
+ }
946
+ function registerTabPress(event) {
947
+ if (event.code === "Tab") lastTabPressTime = (/* @__PURE__ */ new Date()).getTime();
948
+ }
949
+ const self = {
950
+ init
951
+ };
952
+ return self;
953
+ }
954
+ function Vector1D(initialValue) {
955
+ let value = initialValue;
956
+ function get() {
957
+ return value;
958
+ }
959
+ function set(n) {
960
+ value = normalizeInput(n);
961
+ }
962
+ function add(n) {
963
+ value += normalizeInput(n);
964
+ }
965
+ function subtract(n) {
966
+ value -= normalizeInput(n);
967
+ }
968
+ function normalizeInput(n) {
969
+ return isNumber(n) ? n : n.get();
970
+ }
971
+ const self = {
972
+ get,
973
+ set,
974
+ add,
975
+ subtract
976
+ };
977
+ return self;
978
+ }
979
+ function Translate(axis, container) {
980
+ const translate = axis.scroll === "x" ? x : y;
981
+ const containerStyle = container.style;
982
+ let previousTarget = null;
983
+ let disabled = false;
984
+ function x(n) {
985
+ return `translate3d(${n}px,0px,0px)`;
986
+ }
987
+ function y(n) {
988
+ return `translate3d(0px,${n}px,0px)`;
989
+ }
990
+ function to(target) {
991
+ if (disabled) return;
992
+ const newTarget = roundToTwoDecimals(axis.direction(target));
993
+ if (newTarget === previousTarget) return;
994
+ containerStyle.transform = translate(newTarget);
995
+ previousTarget = newTarget;
996
+ }
997
+ function toggleActive(active) {
998
+ disabled = !active;
999
+ }
1000
+ function clear() {
1001
+ if (disabled) return;
1002
+ containerStyle.transform = "";
1003
+ if (!container.getAttribute("style")) container.removeAttribute("style");
1004
+ }
1005
+ const self = {
1006
+ clear,
1007
+ to,
1008
+ toggleActive
1009
+ };
1010
+ return self;
1011
+ }
1012
+ function SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, location, slides) {
1013
+ const roundingSafety = 0.5;
1014
+ const ascItems = arrayKeys(slideSizesWithGaps);
1015
+ const descItems = arrayKeys(slideSizesWithGaps).reverse();
1016
+ const loopPoints = startPoints().concat(endPoints());
1017
+ function removeSlideSizes(indexes, from) {
1018
+ return indexes.reduce((a, i) => {
1019
+ return a - slideSizesWithGaps[i];
1020
+ }, from);
1021
+ }
1022
+ function slidesInGap(indexes, gap) {
1023
+ return indexes.reduce((a, i) => {
1024
+ const remainingGap = removeSlideSizes(a, gap);
1025
+ return remainingGap > 0 ? a.concat([i]) : a;
1026
+ }, []);
1027
+ }
1028
+ function findSlideBounds(offset) {
1029
+ return snaps.map((snap, index) => ({
1030
+ start: snap - slideSizes[index] + roundingSafety + offset,
1031
+ end: snap + viewSize - roundingSafety + offset
1032
+ }));
1033
+ }
1034
+ function findLoopPoints(indexes, offset, isEndEdge) {
1035
+ const slideBounds = findSlideBounds(offset);
1036
+ return indexes.map((index) => {
1037
+ const initial = isEndEdge ? 0 : -contentSize;
1038
+ const altered = isEndEdge ? contentSize : 0;
1039
+ const boundEdge = isEndEdge ? "end" : "start";
1040
+ const loopPoint = slideBounds[index][boundEdge];
1041
+ return {
1042
+ index,
1043
+ loopPoint,
1044
+ slideLocation: Vector1D(-1),
1045
+ translate: Translate(axis, slides[index]),
1046
+ target: () => location.get() > loopPoint ? initial : altered
1047
+ };
1048
+ });
1049
+ }
1050
+ function startPoints() {
1051
+ const gap = scrollSnaps[0];
1052
+ const indexes = slidesInGap(descItems, gap);
1053
+ return findLoopPoints(indexes, contentSize, false);
1054
+ }
1055
+ function endPoints() {
1056
+ const gap = viewSize - scrollSnaps[0] - 1;
1057
+ const indexes = slidesInGap(ascItems, gap);
1058
+ return findLoopPoints(indexes, -contentSize, true);
1059
+ }
1060
+ function canLoop() {
1061
+ return loopPoints.every(({
1062
+ index
1063
+ }) => {
1064
+ const otherIndexes = ascItems.filter((i) => i !== index);
1065
+ return removeSlideSizes(otherIndexes, viewSize) <= 0.1;
1066
+ });
1067
+ }
1068
+ function loop() {
1069
+ loopPoints.forEach((loopPoint) => {
1070
+ const {
1071
+ target,
1072
+ translate,
1073
+ slideLocation
1074
+ } = loopPoint;
1075
+ const shiftLocation = target();
1076
+ if (shiftLocation === slideLocation.get()) return;
1077
+ translate.to(shiftLocation);
1078
+ slideLocation.set(shiftLocation);
1079
+ });
1080
+ }
1081
+ function clear() {
1082
+ loopPoints.forEach((loopPoint) => loopPoint.translate.clear());
1083
+ }
1084
+ const self = {
1085
+ canLoop,
1086
+ clear,
1087
+ loop,
1088
+ loopPoints
1089
+ };
1090
+ return self;
1091
+ }
1092
+ function SlidesHandler(container, eventHandler, watchSlides) {
1093
+ let mutationObserver;
1094
+ let destroyed = false;
1095
+ function init(emblaApi) {
1096
+ if (!watchSlides) return;
1097
+ function defaultCallback(mutations) {
1098
+ for (const mutation of mutations) {
1099
+ if (mutation.type === "childList") {
1100
+ emblaApi.reInit();
1101
+ eventHandler.emit("slidesChanged");
1102
+ break;
1103
+ }
1104
+ }
1105
+ }
1106
+ mutationObserver = new MutationObserver((mutations) => {
1107
+ if (destroyed) return;
1108
+ if (isBoolean(watchSlides) || watchSlides(emblaApi, mutations)) {
1109
+ defaultCallback(mutations);
1110
+ }
1111
+ });
1112
+ mutationObserver.observe(container, {
1113
+ childList: true
1114
+ });
1115
+ }
1116
+ function destroy() {
1117
+ if (mutationObserver) mutationObserver.disconnect();
1118
+ destroyed = true;
1119
+ }
1120
+ const self = {
1121
+ init,
1122
+ destroy
1123
+ };
1124
+ return self;
1125
+ }
1126
+ function SlidesInView(container, slides, eventHandler, threshold) {
1127
+ const intersectionEntryMap = {};
1128
+ let inViewCache = null;
1129
+ let notInViewCache = null;
1130
+ let intersectionObserver;
1131
+ let destroyed = false;
1132
+ function init() {
1133
+ intersectionObserver = new IntersectionObserver((entries) => {
1134
+ if (destroyed) return;
1135
+ entries.forEach((entry) => {
1136
+ const index = slides.indexOf(entry.target);
1137
+ intersectionEntryMap[index] = entry;
1138
+ });
1139
+ inViewCache = null;
1140
+ notInViewCache = null;
1141
+ eventHandler.emit("slidesInView");
1142
+ }, {
1143
+ root: container.parentElement,
1144
+ threshold
1145
+ });
1146
+ slides.forEach((slide) => intersectionObserver.observe(slide));
1147
+ }
1148
+ function destroy() {
1149
+ if (intersectionObserver) intersectionObserver.disconnect();
1150
+ destroyed = true;
1151
+ }
1152
+ function createInViewList(inView) {
1153
+ return objectKeys(intersectionEntryMap).reduce((list, slideIndex) => {
1154
+ const index = parseInt(slideIndex);
1155
+ const {
1156
+ isIntersecting
1157
+ } = intersectionEntryMap[index];
1158
+ const inViewMatch = inView && isIntersecting;
1159
+ const notInViewMatch = !inView && !isIntersecting;
1160
+ if (inViewMatch || notInViewMatch) list.push(index);
1161
+ return list;
1162
+ }, []);
1163
+ }
1164
+ function get(inView = true) {
1165
+ if (inView && inViewCache) return inViewCache;
1166
+ if (!inView && notInViewCache) return notInViewCache;
1167
+ const slideIndexes = createInViewList(inView);
1168
+ if (inView) inViewCache = slideIndexes;
1169
+ if (!inView) notInViewCache = slideIndexes;
1170
+ return slideIndexes;
1171
+ }
1172
+ const self = {
1173
+ init,
1174
+ destroy,
1175
+ get
1176
+ };
1177
+ return self;
1178
+ }
1179
+ function SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow) {
1180
+ const {
1181
+ measureSize,
1182
+ startEdge,
1183
+ endEdge
1184
+ } = axis;
1185
+ const withEdgeGap = slideRects[0] && readEdgeGap;
1186
+ const startGap = measureStartGap();
1187
+ const endGap = measureEndGap();
1188
+ const slideSizes = slideRects.map(measureSize);
1189
+ const slideSizesWithGaps = measureWithGaps();
1190
+ function measureStartGap() {
1191
+ if (!withEdgeGap) return 0;
1192
+ const slideRect = slideRects[0];
1193
+ return mathAbs(containerRect[startEdge] - slideRect[startEdge]);
1194
+ }
1195
+ function measureEndGap() {
1196
+ if (!withEdgeGap) return 0;
1197
+ const style = ownerWindow.getComputedStyle(arrayLast(slides));
1198
+ return parseFloat(style.getPropertyValue(`margin-${endEdge}`));
1199
+ }
1200
+ function measureWithGaps() {
1201
+ return slideRects.map((rect, index, rects) => {
1202
+ const isFirst = !index;
1203
+ const isLast = arrayIsLastIndex(rects, index);
1204
+ if (isFirst) return slideSizes[index] + startGap;
1205
+ if (isLast) return slideSizes[index] + endGap;
1206
+ return rects[index + 1][startEdge] - rect[startEdge];
1207
+ }).map(mathAbs);
1208
+ }
1209
+ const self = {
1210
+ slideSizes,
1211
+ slideSizesWithGaps,
1212
+ startGap,
1213
+ endGap
1214
+ };
1215
+ return self;
1216
+ }
1217
+ function SlidesToScroll(axis, viewSize, slidesToScroll, loop, containerRect, slideRects, startGap, endGap, pixelTolerance) {
1218
+ const {
1219
+ startEdge,
1220
+ endEdge,
1221
+ direction
1222
+ } = axis;
1223
+ const groupByNumber = isNumber(slidesToScroll);
1224
+ function byNumber(array, groupSize) {
1225
+ return arrayKeys(array).filter((i) => i % groupSize === 0).map((i) => array.slice(i, i + groupSize));
1226
+ }
1227
+ function bySize(array) {
1228
+ if (!array.length) return [];
1229
+ return arrayKeys(array).reduce((groups, rectB, index) => {
1230
+ const rectA = arrayLast(groups) || 0;
1231
+ const isFirst = rectA === 0;
1232
+ const isLast = rectB === arrayLastIndex(array);
1233
+ const edgeA = containerRect[startEdge] - slideRects[rectA][startEdge];
1234
+ const edgeB = containerRect[startEdge] - slideRects[rectB][endEdge];
1235
+ const gapA = !loop && isFirst ? direction(startGap) : 0;
1236
+ const gapB = !loop && isLast ? direction(endGap) : 0;
1237
+ const chunkSize = mathAbs(edgeB - gapB - (edgeA + gapA));
1238
+ if (index && chunkSize > viewSize + pixelTolerance) groups.push(rectB);
1239
+ if (isLast) groups.push(array.length);
1240
+ return groups;
1241
+ }, []).map((currentSize, index, groups) => {
1242
+ const previousSize = Math.max(groups[index - 1] || 0);
1243
+ return array.slice(previousSize, currentSize);
1244
+ });
1245
+ }
1246
+ function groupSlides(array) {
1247
+ return groupByNumber ? byNumber(array, slidesToScroll) : bySize(array);
1248
+ }
1249
+ const self = {
1250
+ groupSlides
1251
+ };
1252
+ return self;
1253
+ }
1254
+ function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler) {
1255
+ const {
1256
+ align,
1257
+ axis: scrollAxis,
1258
+ direction,
1259
+ startIndex,
1260
+ loop,
1261
+ duration,
1262
+ dragFree,
1263
+ dragThreshold,
1264
+ inViewThreshold,
1265
+ slidesToScroll: groupSlides,
1266
+ skipSnaps,
1267
+ containScroll,
1268
+ watchResize,
1269
+ watchSlides,
1270
+ watchDrag,
1271
+ watchFocus
1272
+ } = options;
1273
+ const pixelTolerance = 2;
1274
+ const nodeRects = NodeRects();
1275
+ const containerRect = nodeRects.measure(container);
1276
+ const slideRects = slides.map(nodeRects.measure);
1277
+ const axis = Axis(scrollAxis, direction);
1278
+ const viewSize = axis.measureSize(containerRect);
1279
+ const percentOfView = PercentOfView(viewSize);
1280
+ const alignment = Alignment(align, viewSize);
1281
+ const containSnaps = !loop && !!containScroll;
1282
+ const readEdgeGap = loop || !!containScroll;
1283
+ const {
1284
+ slideSizes,
1285
+ slideSizesWithGaps,
1286
+ startGap,
1287
+ endGap
1288
+ } = SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow);
1289
+ const slidesToScroll = SlidesToScroll(axis, viewSize, groupSlides, loop, containerRect, slideRects, startGap, endGap, pixelTolerance);
1290
+ const {
1291
+ snaps,
1292
+ snapsAligned
1293
+ } = ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll);
1294
+ const contentSize = -arrayLast(snaps) + arrayLast(slideSizesWithGaps);
1295
+ const {
1296
+ snapsContained,
1297
+ scrollContainLimit
1298
+ } = ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance);
1299
+ const scrollSnaps = containSnaps ? snapsContained : snapsAligned;
1300
+ const {
1301
+ limit
1302
+ } = ScrollLimit(contentSize, scrollSnaps, loop);
1303
+ const index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
1304
+ const indexPrevious = index.clone();
1305
+ const slideIndexes = arrayKeys(slides);
1306
+ const update = ({
1307
+ dragHandler,
1308
+ scrollBody: scrollBody2,
1309
+ scrollBounds,
1310
+ options: {
1311
+ loop: loop2
1312
+ }
1313
+ }) => {
1314
+ if (!loop2) scrollBounds.constrain(dragHandler.pointerDown());
1315
+ scrollBody2.seek();
1316
+ };
1317
+ const render = ({
1318
+ scrollBody: scrollBody2,
1319
+ translate,
1320
+ location: location2,
1321
+ offsetLocation: offsetLocation2,
1322
+ previousLocation: previousLocation2,
1323
+ scrollLooper,
1324
+ slideLooper,
1325
+ dragHandler,
1326
+ animation: animation2,
1327
+ eventHandler: eventHandler2,
1328
+ scrollBounds,
1329
+ options: {
1330
+ loop: loop2
1331
+ }
1332
+ }, alpha) => {
1333
+ const shouldSettle = scrollBody2.settled();
1334
+ const withinBounds = !scrollBounds.shouldConstrain();
1335
+ const hasSettled = loop2 ? shouldSettle : shouldSettle && withinBounds;
1336
+ const hasSettledAndIdle = hasSettled && !dragHandler.pointerDown();
1337
+ if (hasSettledAndIdle) animation2.stop();
1338
+ const interpolatedLocation = location2.get() * alpha + previousLocation2.get() * (1 - alpha);
1339
+ offsetLocation2.set(interpolatedLocation);
1340
+ if (loop2) {
1341
+ scrollLooper.loop(scrollBody2.direction());
1342
+ slideLooper.loop();
1343
+ }
1344
+ translate.to(offsetLocation2.get());
1345
+ if (hasSettledAndIdle) eventHandler2.emit("settle");
1346
+ if (!hasSettled) eventHandler2.emit("scroll");
1347
+ };
1348
+ const animation = Animations(ownerDocument, ownerWindow, () => update(engine), (alpha) => render(engine, alpha));
1349
+ const friction = 0.68;
1350
+ const startLocation = scrollSnaps[index.get()];
1351
+ const location = Vector1D(startLocation);
1352
+ const previousLocation = Vector1D(startLocation);
1353
+ const offsetLocation = Vector1D(startLocation);
1354
+ const target = Vector1D(startLocation);
1355
+ const scrollBody = ScrollBody(location, offsetLocation, previousLocation, target, duration, friction);
1356
+ const scrollTarget = ScrollTarget(loop, scrollSnaps, contentSize, limit, target);
1357
+ const scrollTo = ScrollTo(animation, index, indexPrevious, scrollBody, scrollTarget, target, eventHandler);
1358
+ const scrollProgress = ScrollProgress(limit);
1359
+ const eventStore = EventStore();
1360
+ const slidesInView = SlidesInView(container, slides, eventHandler, inViewThreshold);
1361
+ const {
1362
+ slideRegistry
1363
+ } = SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes);
1364
+ const slideFocus = SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus);
1365
+ const engine = {
1366
+ ownerDocument,
1367
+ ownerWindow,
1368
+ eventHandler,
1369
+ containerRect,
1370
+ slideRects,
1371
+ animation,
1372
+ axis,
1373
+ dragHandler: DragHandler(axis, root, ownerDocument, ownerWindow, target, DragTracker(axis, ownerWindow), location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, friction, watchDrag),
1374
+ eventStore,
1375
+ percentOfView,
1376
+ index,
1377
+ indexPrevious,
1378
+ limit,
1379
+ location,
1380
+ offsetLocation,
1381
+ previousLocation,
1382
+ options,
1383
+ resizeHandler: ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects),
1384
+ scrollBody,
1385
+ scrollBounds: ScrollBounds(limit, offsetLocation, target, scrollBody, percentOfView),
1386
+ scrollLooper: ScrollLooper(contentSize, limit, offsetLocation, [location, offsetLocation, previousLocation, target]),
1387
+ scrollProgress,
1388
+ scrollSnapList: scrollSnaps.map(scrollProgress.get),
1389
+ scrollSnaps,
1390
+ scrollTarget,
1391
+ scrollTo,
1392
+ slideLooper: SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, offsetLocation, slides),
1393
+ slideFocus,
1394
+ slidesHandler: SlidesHandler(container, eventHandler, watchSlides),
1395
+ slidesInView,
1396
+ slideIndexes,
1397
+ slideRegistry,
1398
+ slidesToScroll,
1399
+ target,
1400
+ translate: Translate(axis, container)
1401
+ };
1402
+ return engine;
1403
+ }
1404
+ function EventHandler() {
1405
+ let listeners = {};
1406
+ let api;
1407
+ function init(emblaApi) {
1408
+ api = emblaApi;
1409
+ }
1410
+ function getListeners(evt) {
1411
+ return listeners[evt] || [];
1412
+ }
1413
+ function emit(evt) {
1414
+ getListeners(evt).forEach((e) => e(api, evt));
1415
+ return self;
1416
+ }
1417
+ function on(evt, cb) {
1418
+ listeners[evt] = getListeners(evt).concat([cb]);
1419
+ return self;
1420
+ }
1421
+ function off(evt, cb) {
1422
+ listeners[evt] = getListeners(evt).filter((e) => e !== cb);
1423
+ return self;
1424
+ }
1425
+ function clear() {
1426
+ listeners = {};
1427
+ }
1428
+ const self = {
1429
+ init,
1430
+ emit,
1431
+ off,
1432
+ on,
1433
+ clear
1434
+ };
1435
+ return self;
1436
+ }
1437
+ var defaultOptions = {
1438
+ align: "center",
1439
+ axis: "x",
1440
+ container: null,
1441
+ slides: null,
1442
+ containScroll: "trimSnaps",
1443
+ direction: "ltr",
1444
+ slidesToScroll: 1,
1445
+ inViewThreshold: 0,
1446
+ breakpoints: {},
1447
+ dragFree: false,
1448
+ dragThreshold: 10,
1449
+ loop: false,
1450
+ skipSnaps: false,
1451
+ duration: 25,
1452
+ startIndex: 0,
1453
+ active: true,
1454
+ watchDrag: true,
1455
+ watchResize: true,
1456
+ watchSlides: true,
1457
+ watchFocus: true
1458
+ };
1459
+ function OptionsHandler(ownerWindow) {
1460
+ function mergeOptions(optionsA, optionsB) {
1461
+ return objectsMergeDeep(optionsA, optionsB || {});
1462
+ }
1463
+ function optionsAtMedia(options) {
1464
+ const optionsAtMedia2 = options.breakpoints || {};
1465
+ const matchedMediaOptions = objectKeys(optionsAtMedia2).filter((media) => ownerWindow.matchMedia(media).matches).map((media) => optionsAtMedia2[media]).reduce((a, mediaOption) => mergeOptions(a, mediaOption), {});
1466
+ return mergeOptions(options, matchedMediaOptions);
1467
+ }
1468
+ function optionsMediaQueries(optionsList) {
1469
+ return optionsList.map((options) => objectKeys(options.breakpoints || {})).reduce((acc, mediaQueries) => acc.concat(mediaQueries), []).map(ownerWindow.matchMedia);
1470
+ }
1471
+ const self = {
1472
+ mergeOptions,
1473
+ optionsAtMedia,
1474
+ optionsMediaQueries
1475
+ };
1476
+ return self;
1477
+ }
1478
+ function PluginsHandler(optionsHandler) {
1479
+ let activePlugins = [];
1480
+ function init(emblaApi, plugins) {
1481
+ activePlugins = plugins.filter(({
1482
+ options
1483
+ }) => optionsHandler.optionsAtMedia(options).active !== false);
1484
+ activePlugins.forEach((plugin) => plugin.init(emblaApi, optionsHandler));
1485
+ return plugins.reduce((map, plugin) => Object.assign(map, {
1486
+ [plugin.name]: plugin
1487
+ }), {});
1488
+ }
1489
+ function destroy() {
1490
+ activePlugins = activePlugins.filter((plugin) => plugin.destroy());
1491
+ }
1492
+ const self = {
1493
+ init,
1494
+ destroy
1495
+ };
1496
+ return self;
1497
+ }
1498
+ function EmblaCarousel(root, userOptions, userPlugins) {
1499
+ const ownerDocument = root.ownerDocument;
1500
+ const ownerWindow = ownerDocument.defaultView;
1501
+ const optionsHandler = OptionsHandler(ownerWindow);
1502
+ const pluginsHandler = PluginsHandler(optionsHandler);
1503
+ const mediaHandlers = EventStore();
1504
+ const eventHandler = EventHandler();
1505
+ const {
1506
+ mergeOptions,
1507
+ optionsAtMedia,
1508
+ optionsMediaQueries
1509
+ } = optionsHandler;
1510
+ const {
1511
+ on,
1512
+ off,
1513
+ emit
1514
+ } = eventHandler;
1515
+ const reInit = reActivate;
1516
+ let destroyed = false;
1517
+ let engine;
1518
+ let optionsBase = mergeOptions(defaultOptions, EmblaCarousel.globalOptions);
1519
+ let options = mergeOptions(optionsBase);
1520
+ let pluginList = [];
1521
+ let pluginApis;
1522
+ let container;
1523
+ let slides;
1524
+ function storeElements() {
1525
+ const {
1526
+ container: userContainer,
1527
+ slides: userSlides
1528
+ } = options;
1529
+ const customContainer = isString(userContainer) ? root.querySelector(userContainer) : userContainer;
1530
+ container = customContainer || root.children[0];
1531
+ const customSlides = isString(userSlides) ? container.querySelectorAll(userSlides) : userSlides;
1532
+ slides = [].slice.call(customSlides || container.children);
1533
+ }
1534
+ function createEngine(options2) {
1535
+ const engine2 = Engine(root, container, slides, ownerDocument, ownerWindow, options2, eventHandler);
1536
+ if (options2.loop && !engine2.slideLooper.canLoop()) {
1537
+ const optionsWithoutLoop = Object.assign({}, options2, {
1538
+ loop: false
1539
+ });
1540
+ return createEngine(optionsWithoutLoop);
1541
+ }
1542
+ return engine2;
1543
+ }
1544
+ function activate(withOptions, withPlugins) {
1545
+ if (destroyed) return;
1546
+ optionsBase = mergeOptions(optionsBase, withOptions);
1547
+ options = optionsAtMedia(optionsBase);
1548
+ pluginList = withPlugins || pluginList;
1549
+ storeElements();
1550
+ engine = createEngine(options);
1551
+ optionsMediaQueries([optionsBase, ...pluginList.map(({
1552
+ options: options2
1553
+ }) => options2)]).forEach((query) => mediaHandlers.add(query, "change", reActivate));
1554
+ if (!options.active) return;
1555
+ engine.translate.to(engine.location.get());
1556
+ engine.animation.init();
1557
+ engine.slidesInView.init();
1558
+ engine.slideFocus.init(self);
1559
+ engine.eventHandler.init(self);
1560
+ engine.resizeHandler.init(self);
1561
+ engine.slidesHandler.init(self);
1562
+ if (engine.options.loop) engine.slideLooper.loop();
1563
+ if (container.offsetParent && slides.length) engine.dragHandler.init(self);
1564
+ pluginApis = pluginsHandler.init(self, pluginList);
1565
+ }
1566
+ function reActivate(withOptions, withPlugins) {
1567
+ const startIndex = selectedScrollSnap();
1568
+ deActivate();
1569
+ activate(mergeOptions({
1570
+ startIndex
1571
+ }, withOptions), withPlugins);
1572
+ eventHandler.emit("reInit");
1573
+ }
1574
+ function deActivate() {
1575
+ engine.dragHandler.destroy();
1576
+ engine.eventStore.clear();
1577
+ engine.translate.clear();
1578
+ engine.slideLooper.clear();
1579
+ engine.resizeHandler.destroy();
1580
+ engine.slidesHandler.destroy();
1581
+ engine.slidesInView.destroy();
1582
+ engine.animation.destroy();
1583
+ pluginsHandler.destroy();
1584
+ mediaHandlers.clear();
1585
+ }
1586
+ function destroy() {
1587
+ if (destroyed) return;
1588
+ destroyed = true;
1589
+ mediaHandlers.clear();
1590
+ deActivate();
1591
+ eventHandler.emit("destroy");
1592
+ eventHandler.clear();
1593
+ }
1594
+ function scrollTo(index, jump, direction) {
1595
+ if (!options.active || destroyed) return;
1596
+ engine.scrollBody.useBaseFriction().useDuration(jump === true ? 0 : options.duration);
1597
+ engine.scrollTo.index(index, direction || 0);
1598
+ }
1599
+ function scrollNext(jump) {
1600
+ const next = engine.index.add(1).get();
1601
+ scrollTo(next, jump, -1);
1602
+ }
1603
+ function scrollPrev(jump) {
1604
+ const prev = engine.index.add(-1).get();
1605
+ scrollTo(prev, jump, 1);
1606
+ }
1607
+ function canScrollNext() {
1608
+ const next = engine.index.add(1).get();
1609
+ return next !== selectedScrollSnap();
1610
+ }
1611
+ function canScrollPrev() {
1612
+ const prev = engine.index.add(-1).get();
1613
+ return prev !== selectedScrollSnap();
1614
+ }
1615
+ function scrollSnapList() {
1616
+ return engine.scrollSnapList;
1617
+ }
1618
+ function scrollProgress() {
1619
+ return engine.scrollProgress.get(engine.offsetLocation.get());
1620
+ }
1621
+ function selectedScrollSnap() {
1622
+ return engine.index.get();
1623
+ }
1624
+ function previousScrollSnap() {
1625
+ return engine.indexPrevious.get();
1626
+ }
1627
+ function slidesInView() {
1628
+ return engine.slidesInView.get();
1629
+ }
1630
+ function slidesNotInView() {
1631
+ return engine.slidesInView.get(false);
1632
+ }
1633
+ function plugins() {
1634
+ return pluginApis;
1635
+ }
1636
+ function internalEngine() {
1637
+ return engine;
1638
+ }
1639
+ function rootNode() {
1640
+ return root;
1641
+ }
1642
+ function containerNode() {
1643
+ return container;
1644
+ }
1645
+ function slideNodes() {
1646
+ return slides;
1647
+ }
1648
+ const self = {
1649
+ canScrollNext,
1650
+ canScrollPrev,
1651
+ containerNode,
1652
+ internalEngine,
1653
+ destroy,
1654
+ off,
1655
+ on,
1656
+ emit,
1657
+ plugins,
1658
+ previousScrollSnap,
1659
+ reInit,
1660
+ rootNode,
1661
+ scrollNext,
1662
+ scrollPrev,
1663
+ scrollProgress,
1664
+ scrollSnapList,
1665
+ scrollTo,
1666
+ selectedScrollSnap,
1667
+ slideNodes,
1668
+ slidesInView,
1669
+ slidesNotInView
1670
+ };
1671
+ activate(userOptions, userPlugins);
1672
+ setTimeout(() => eventHandler.emit("init"), 0);
1673
+ return self;
1674
+ }
1675
+ EmblaCarousel.globalOptions = void 0;
1676
+
1677
+ // ../node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.0/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js
1678
+ function useEmblaCarousel(options = {}, plugins = []) {
1679
+ const storedOptions = (0, import_react.useRef)(options);
1680
+ const storedPlugins = (0, import_react.useRef)(plugins);
1681
+ const [emblaApi, setEmblaApi] = (0, import_react.useState)();
1682
+ const [viewport, setViewport] = (0, import_react.useState)();
1683
+ const reInit = (0, import_react.useCallback)(() => {
1684
+ if (emblaApi) emblaApi.reInit(storedOptions.current, storedPlugins.current);
1685
+ }, [emblaApi]);
1686
+ (0, import_react.useEffect)(() => {
1687
+ if (areOptionsEqual(storedOptions.current, options)) return;
1688
+ storedOptions.current = options;
1689
+ reInit();
1690
+ }, [options, reInit]);
1691
+ (0, import_react.useEffect)(() => {
1692
+ if (arePluginsEqual(storedPlugins.current, plugins)) return;
1693
+ storedPlugins.current = plugins;
1694
+ reInit();
1695
+ }, [plugins, reInit]);
1696
+ (0, import_react.useEffect)(() => {
1697
+ if (canUseDOM() && viewport) {
1698
+ EmblaCarousel.globalOptions = useEmblaCarousel.globalOptions;
1699
+ const newEmblaApi = EmblaCarousel(viewport, storedOptions.current, storedPlugins.current);
1700
+ setEmblaApi(newEmblaApi);
1701
+ return () => newEmblaApi.destroy();
1702
+ } else {
1703
+ setEmblaApi(void 0);
1704
+ }
1705
+ }, [viewport, setEmblaApi]);
1706
+ return [setViewport, emblaApi];
1707
+ }
1708
+ useEmblaCarousel.globalOptions = void 0;
1709
+ export {
1710
+ useEmblaCarousel as default
1711
+ };
1712
+ //# sourceMappingURL=embla-carousel-react.js.map