fansunited-frontend-components 0.0.71 → 0.0.73

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.
@@ -1,4819 +0,0 @@
1
- import { jsx as x, jsxs as ho, Fragment as fo } from "react/jsx-runtime";
2
- import { l as V } from "./PrizeCard-CyVJJLo1.js";
3
- import * as Oe from "react";
4
- import { createContext as Tt, useContext as O, useId as Ie, useEffect as ke, useCallback as Fe, Component as po, useLayoutEffect as mo, useRef as J, useInsertionEffect as Fs, useMemo as lt, forwardRef as go, Fragment as Bs, createElement as yo, Children as vo, isValidElement as To, useState as Tn } from "react";
5
- const qc = V(/* @__PURE__ */ x("path", {
6
- d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m-.22-13h-.06c-.4 0-.72.32-.72.72v4.72c0 .35.18.68.49.86l4.15 2.49c.34.2.78.1.98-.24.21-.34.1-.79-.25-.99l-3.87-2.3V7.72c0-.4-.32-.72-.72-.72"
7
- }), "AccessTimeRounded"), Zc = V(/* @__PURE__ */ x("path", {
8
- d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
9
- }), "Add"), Jc = V(/* @__PURE__ */ x("path", {
10
- d: "M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"
11
- }), "AddCircleOutline"), Qc = V(/* @__PURE__ */ x("path", {
12
- d: "M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z"
13
- }), "AppsOutlined"), tu = V(/* @__PURE__ */ x("path", {
14
- d: "M17.77 3.77 16 2 6 12l10 10 1.77-1.77L9.54 12z"
15
- }), "ArrowBackIosNew"), eu = V(/* @__PURE__ */ x("path", {
16
- d: "M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"
17
- }), "ArrowForwardIos"), nu = V(/* @__PURE__ */ x("path", {
18
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"
19
- }), "BlockOutlined"), su = V(/* @__PURE__ */ x("path", {
20
- d: "M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"
21
- }), "CalendarTodayOutlined"), iu = V(/* @__PURE__ */ x("path", {
22
- d: "M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2m-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1M9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m11 15H4v-2h16zm0-5H4V8h5.08L7 10.83 8.62 12 12 7.4l3.38 4.6L17 10.83 14.92 8H20z"
23
- }), "CardGiftcardOutlined"), ou = V(/* @__PURE__ */ x("path", {
24
- d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
25
- }), "Check"), ru = V(/* @__PURE__ */ x("path", {
26
- d: "M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01"
27
- }), "ChevronRightRounded"), au = V(/* @__PURE__ */ x("path", {
28
- d: "M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59 7.11 5.7a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"
29
- }), "CloseRounded"), lu = V(/* @__PURE__ */ x("path", {
30
- d: "M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"
31
- }), "CompareArrowsOutlined"), cu = V(/* @__PURE__ */ x("path", {
32
- d: "M9.01 14H3c-.55 0-1 .45-1 1s.45 1 1 1h6.01v1.79c0 .45.54.67.85.35l2.78-2.79c.19-.2.19-.51 0-.71l-2.78-2.79c-.31-.32-.85-.09-.85.35zm5.98-2.21V10H21c.55 0 1-.45 1-1s-.45-1-1-1h-6.01V6.21c0-.45-.54-.67-.85-.35l-2.78 2.79c-.19.2-.19.51 0 .71l2.78 2.79c.31.31.85.09.85-.36"
33
- }), "CompareArrowsRounded"), uu = V(/* @__PURE__ */ x("path", {
34
- d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
35
- }), "ContentCopy"), hu = V(/* @__PURE__ */ x("path", {
36
- d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
37
- }), "ContentCopyOutlined"), du = V(/* @__PURE__ */ x("path", {
38
- d: "M19 5h-2V3H7v2H5c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94.63 1.5 1.98 2.63 3.61 2.96V19H7v2h10v-2h-4v-3.1c1.63-.33 2.98-1.46 3.61-2.96C19.08 12.63 21 10.55 21 8V7c0-1.1-.9-2-2-2M5 8V7h2v3.82C5.84 10.4 5 9.3 5 8m7 6c-1.65 0-3-1.35-3-3V5h6v6c0 1.65-1.35 3-3 3m7-6c0 1.3-.84 2.4-2 2.82V7h2z"
39
- }), "EmojiEventsOutlined"), fu = V(/* @__PURE__ */ x("path", {
40
- d: "M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5M4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12m0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7m7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44M15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35"
41
- }), "GroupOutlined"), pu = V(/* @__PURE__ */ x("path", {
42
- d: "M4 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m1.13 1.1c-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29M20 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m4 3.43c0-.81-.48-1.53-1.22-1.85-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24zm-7.76-2.78c-1.17-.52-2.61-.9-4.24-.9s-3.07.39-4.24.9C6.68 14.13 6 15.21 6 16.39V18h12v-1.61c0-1.18-.68-2.26-1.76-2.74M8.07 16c.09-.23.13-.39.91-.69.97-.38 1.99-.56 3.02-.56s2.05.18 3.02.56c.77.3.81.46.91.69zM12 8c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m0-2c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"
43
- }), "GroupsOutlined"), mu = V(/* @__PURE__ */ x("path", {
44
- d: "M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2zm10 14.5V20H8v-3.5l4-4zm-4-5-4-4V4h8v3.5z"
45
- }), "HourglassEmptyOutlined"), gu = V(/* @__PURE__ */ x("path", {
46
- d: "M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"
47
- }), "LockOutlined"), yu = V(/* @__PURE__ */ x("path", {
48
- d: "m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"
49
- }), "Logout"), vu = V(/* @__PURE__ */ x("path", {
50
- d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"
51
- }), "MoreHoriz"), Tu = V(/* @__PURE__ */ x("path", {
52
- d: "M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"
53
- }), "NotificationsOutlined"), Pu = V(/* @__PURE__ */ x("path", {
54
- d: "M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5M4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12m0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7m7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44M15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35"
55
- }), "PeopleOutlined"), xu = V(/* @__PURE__ */ x("path", {
56
- d: "M13 8c0-2.21-1.79-4-4-4S5 5.79 5 8s1.79 4 4 4 4-1.79 4-4m-2 0c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2M1 18v2h16v-2c0-2.66-5.33-4-8-4s-8 1.34-8 4m2 0c.2-.71 3.3-2 6-2 2.69 0 5.78 1.28 6 2zm17-3v-3h3v-2h-3V7h-2v3h-3v2h3v3z"
57
- }), "PersonAddAlt1Outlined"), Su = V(/* @__PURE__ */ x("path", {
58
- d: "M14 8c0-2.21-1.79-4-4-4S6 5.79 6 8s1.79 4 4 4 4-1.79 4-4m-2 0c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2M2 18v2h16v-2c0-2.66-5.33-4-8-4s-8 1.34-8 4m2 0c.2-.71 3.3-2 6-2 2.69 0 5.77 1.28 6 2zm13-8h6v2h-6z"
59
- }), "PersonRemoveOutlined"), Vu = V(/* @__PURE__ */ x("path", {
60
- d: "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"
61
- }), "Refresh"), Au = V(/* @__PURE__ */ x("path", {
62
- d: "M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
63
- }), "Send"), wu = V(/* @__PURE__ */ x("path", {
64
- d: "M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25z"
65
- }), "ShieldOutlined"), bu = V(/* @__PURE__ */ x("path", {
66
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 3.3 1.35-.95c1.82.56 3.37 1.76 4.38 3.34l-.39 1.34-1.35.46L13 6.7zm-3.35-.95L11 5.3v1.4L7.01 9.49l-1.35-.46-.39-1.34c1.01-1.57 2.56-2.77 4.38-3.34M7.08 17.11l-1.14.1C4.73 15.81 4 13.99 4 12c0-.12.01-.23.02-.35l1-.73 1.38.48 1.46 4.34zm7.42 2.48c-.79.26-1.63.41-2.5.41s-1.71-.15-2.5-.41l-.69-1.49.64-1.1h5.11l.64 1.11zM14.27 15H9.73l-1.35-4.02L12 8.44l3.63 2.54zm3.79 2.21-1.14-.1-.79-1.37 1.46-4.34 1.39-.47 1 .73c.01.11.02.22.02.34 0 1.99-.73 3.81-1.94 5.21"
67
- }), "SportsSoccer"), Cu = V(/* @__PURE__ */ x("path", {
68
- d: "m12 17.27 4.15 2.51c.76.46 1.69-.22 1.49-1.08l-1.1-4.72 3.67-3.18c.67-.58.31-1.68-.57-1.75l-4.83-.41-1.89-4.46c-.34-.81-1.5-.81-1.84 0L9.19 8.63l-4.83.41c-.88.07-1.24 1.17-.57 1.75l3.67 3.18-1.1 4.72c-.2.86.73 1.54 1.49 1.08z"
69
- }), "StarRounded"), Mu = V(/* @__PURE__ */ x("path", {
70
- d: "m19.07 4.93-1.41 1.41C19.1 7.79 20 9.79 20 12c0 4.42-3.58 8-8 8s-8-3.58-8-8c0-4.08 3.05-7.44 7-7.93v2.02C8.16 6.57 6 9.03 6 12c0 3.31 2.69 6 6 6s6-2.69 6-6c0-1.66-.67-3.16-1.76-4.24l-1.41 1.41C15.55 9.9 16 10.9 16 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86v2.14c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72V2h-1C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-2.76-1.12-5.26-2.93-7.07"
71
- }), "TrackChanges"), Ru = V(/* @__PURE__ */ x("path", {
72
- d: "M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm7 10c0 4.52-2.98 8.69-7 9.93-4.02-1.24-7-5.41-7-9.93V6.3l7-3.11 7 3.11zm-11.59.59L6 13l4 4 8-8-1.41-1.42L10 14.17z"
73
- }), "VerifiedUserOutlined"), Du = V(/* @__PURE__ */ x("path", {
74
- d: "M22 19h-6v-4h-2.68c-1.14 2.42-3.6 4-6.32 4-3.86 0-7-3.14-7-7s3.14-7 7-7c2.72 0 5.17 1.58 6.32 4H24v6h-2zm-4-2h2v-4h2v-2H11.94l-.23-.67C11.01 8.34 9.11 7 7 7c-2.76 0-5 2.24-5 5s2.24 5 5 5c2.11 0 4.01-1.34 4.71-3.33l.23-.67H18zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3m0-4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1"
75
- }), "VpnKeyOutlined"), Lu = V([/* @__PURE__ */ x("path", {
76
- d: "M12 5.99 19.53 19H4.47zM12 2 1 21h22z"
77
- }, "0"), /* @__PURE__ */ x("path", {
78
- d: "M13 16h-2v2h2zm0-6h-2v5h2z"
79
- }, "1")], "WarningAmber"), Eu = V(/* @__PURE__ */ x("path", {
80
- d: "M12 5.99 19.53 19H4.47zM2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1m0 5h2v2h-2z"
81
- }), "WarningAmberRounded"), Ou = V(/* @__PURE__ */ x("path", {
82
- d: "M9.68 13.69 12 11.93l2.31 1.76-.88-2.85L15.75 9h-2.84L12 6.19 11.09 9H8.25l2.31 1.84zM20 10c0-4.42-3.58-8-8-8s-8 3.58-8 8c0 2.03.76 3.87 2 5.28V23l6-2 6 2v-7.72c1.24-1.41 2-3.25 2-5.28m-8-6c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6 2.69-6 6-6m0 15-4 1.02v-3.1c1.18.68 2.54 1.08 4 1.08s2.82-.4 4-1.08v3.1z"
83
- }), "WorkspacePremiumOutlined"), Pn = /* @__PURE__ */ new Set();
84
- function Xt(t, e, n) {
85
- t || Pn.has(e) || (console.warn(e), Pn.add(e));
86
- }
87
- function Po(t) {
88
- if (typeof Proxy > "u")
89
- return t;
90
- const e = /* @__PURE__ */ new Map(), n = (...s) => (process.env.NODE_ENV !== "production" && Xt(!1, "motion() is deprecated. Use motion.create() instead."), t(...s));
91
- return new Proxy(n, {
92
- /**
93
- * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
94
- * The prop name is passed through as `key` and we can use that to generate a `motion`
95
- * DOM component with that name.
96
- */
97
- get: (s, i) => i === "create" ? t : (e.has(i) || e.set(i, t(i)), e.get(i))
98
- });
99
- }
100
- function qt(t) {
101
- return t !== null && typeof t == "object" && typeof t.start == "function";
102
- }
103
- const ve = (t) => Array.isArray(t);
104
- function js(t, e) {
105
- if (!Array.isArray(e))
106
- return !1;
107
- const n = e.length;
108
- if (n !== t.length)
109
- return !1;
110
- for (let s = 0; s < n; s++)
111
- if (e[s] !== t[s])
112
- return !1;
113
- return !0;
114
- }
115
- function Mt(t) {
116
- return typeof t == "string" || Array.isArray(t);
117
- }
118
- function xn(t) {
119
- const e = [{}, {}];
120
- return t == null || t.values.forEach((n, s) => {
121
- e[0][s] = n.get(), e[1][s] = n.getVelocity();
122
- }), e;
123
- }
124
- function Be(t, e, n, s) {
125
- if (typeof e == "function") {
126
- const [i, r] = xn(s);
127
- e = e(n !== void 0 ? n : t.custom, i, r);
128
- }
129
- if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
130
- const [i, r] = xn(s);
131
- e = e(n !== void 0 ? n : t.custom, i, r);
132
- }
133
- return e;
134
- }
135
- function Zt(t, e, n) {
136
- const s = t.getProps();
137
- return Be(s, e, n !== void 0 ? n : s.custom, t);
138
- }
139
- const je = [
140
- "animate",
141
- "whileInView",
142
- "whileFocus",
143
- "whileHover",
144
- "whileTap",
145
- "whileDrag",
146
- "exit"
147
- ], ze = ["initial", ...je], Et = [
148
- "transformPerspective",
149
- "x",
150
- "y",
151
- "z",
152
- "translateX",
153
- "translateY",
154
- "translateZ",
155
- "scale",
156
- "scaleX",
157
- "scaleY",
158
- "rotate",
159
- "rotateX",
160
- "rotateY",
161
- "rotateZ",
162
- "skew",
163
- "skewX",
164
- "skewY"
165
- ], ct = new Set(Et), H = (t) => t * 1e3, G = (t) => t / 1e3, xo = {
166
- type: "spring",
167
- stiffness: 500,
168
- damping: 25,
169
- restSpeed: 10
170
- }, So = (t) => ({
171
- type: "spring",
172
- stiffness: 550,
173
- damping: t === 0 ? 2 * Math.sqrt(550) : 30,
174
- restSpeed: 10
175
- }), Vo = {
176
- type: "keyframes",
177
- duration: 0.8
178
- }, Ao = {
179
- type: "keyframes",
180
- ease: [0.25, 0.1, 0.35, 1],
181
- duration: 0.3
182
- }, wo = (t, { keyframes: e }) => e.length > 2 ? Vo : ct.has(t) ? t.startsWith("scale") ? So(e[1]) : xo : Ao;
183
- function Ne(t, e) {
184
- return t ? t[e] || t.default || t : void 0;
185
- }
186
- const bo = {
187
- skipAnimations: !1,
188
- useManualTiming: !1
189
- }, Co = (t) => t !== null;
190
- function Jt(t, { repeat: e, repeatType: n = "loop" }, s) {
191
- const i = t.filter(Co), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
192
- return !r || s === void 0 ? i[r] : s;
193
- }
194
- const L = (t) => t;
195
- function Mo(t) {
196
- let e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = !1, i = !1;
197
- const r = /* @__PURE__ */ new WeakSet();
198
- let o = {
199
- delta: 0,
200
- timestamp: 0,
201
- isProcessing: !1
202
- };
203
- function a(c) {
204
- r.has(c) && (l.schedule(c), t()), c(o);
205
- }
206
- const l = {
207
- /**
208
- * Schedule a process to run on the next frame.
209
- */
210
- schedule: (c, u = !1, h = !1) => {
211
- const f = h && s ? e : n;
212
- return u && r.add(c), f.has(c) || f.add(c), c;
213
- },
214
- /**
215
- * Cancel the provided callback from running on the next frame.
216
- */
217
- cancel: (c) => {
218
- n.delete(c), r.delete(c);
219
- },
220
- /**
221
- * Execute all schedule callbacks.
222
- */
223
- process: (c) => {
224
- if (o = c, s) {
225
- i = !0;
226
- return;
227
- }
228
- s = !0, [e, n] = [n, e], n.clear(), e.forEach(a), s = !1, i && (i = !1, l.process(c));
229
- }
230
- };
231
- return l;
232
- }
233
- const kt = [
234
- "read",
235
- // Read
236
- "resolveKeyframes",
237
- // Write/Read/Write/Read
238
- "update",
239
- // Compute
240
- "preRender",
241
- // Compute
242
- "render",
243
- // Write
244
- "postRender"
245
- // Compute
246
- ], Ro = 40;
247
- function zs(t, e) {
248
- let n = !1, s = !0;
249
- const i = {
250
- delta: 0,
251
- timestamp: 0,
252
- isProcessing: !1
253
- }, r = () => n = !0, o = kt.reduce((g, v) => (g[v] = Mo(r), g), {}), { read: a, resolveKeyframes: l, update: c, preRender: u, render: h, postRender: d } = o, f = () => {
254
- const g = performance.now();
255
- n = !1, i.delta = s ? 1e3 / 60 : Math.max(Math.min(g - i.timestamp, Ro), 1), i.timestamp = g, i.isProcessing = !0, a.process(i), l.process(i), c.process(i), u.process(i), h.process(i), d.process(i), i.isProcessing = !1, n && e && (s = !1, t(f));
256
- }, p = () => {
257
- n = !0, s = !0, i.isProcessing || t(f);
258
- };
259
- return { schedule: kt.reduce((g, v) => {
260
- const m = o[v];
261
- return g[v] = (S, A = !1, M = !1) => (n || p(), m.schedule(S, A, M)), g;
262
- }, {}), cancel: (g) => {
263
- for (let v = 0; v < kt.length; v++)
264
- o[kt[v]].cancel(g);
265
- }, state: i, steps: o };
266
- }
267
- const { schedule: b, cancel: Q, state: D, steps: oe } = zs(typeof requestAnimationFrame < "u" ? requestAnimationFrame : L, !0), Ns = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Do = 1e-7, Lo = 12;
268
- function Eo(t, e, n, s, i) {
269
- let r, o, a = 0;
270
- do
271
- o = e + (n - e) / 2, r = Ns(o, s, i) - t, r > 0 ? n = o : e = o;
272
- while (Math.abs(r) > Do && ++a < Lo);
273
- return o;
274
- }
275
- function Ot(t, e, n, s) {
276
- if (t === e && n === s)
277
- return L;
278
- const i = (r) => Eo(r, 0, 1, t, n);
279
- return (r) => r === 0 || r === 1 ? r : Ns(i(r), e, s);
280
- }
281
- const Us = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, Hs = (t) => (e) => 1 - t(1 - e), _s = /* @__PURE__ */ Ot(0.33, 1.53, 0.69, 0.99), Ue = /* @__PURE__ */ Hs(_s), Ks = /* @__PURE__ */ Us(Ue), Ws = (t) => (t *= 2) < 1 ? 0.5 * Ue(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), He = (t) => 1 - Math.sin(Math.acos(t)), $s = Hs(He), Gs = Us(He), Ys = (t) => /^0[^.\s]+$/u.test(t);
282
- function Oo(t) {
283
- return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Ys(t) : !0;
284
- }
285
- let Pt = L, q = L;
286
- process.env.NODE_ENV !== "production" && (Pt = (t, e) => {
287
- !t && typeof console < "u" && console.warn(e);
288
- }, q = (t, e) => {
289
- if (!t)
290
- throw new Error(e);
291
- });
292
- const Xs = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), qs = (t) => (e) => typeof e == "string" && e.startsWith(t), Zs = /* @__PURE__ */ qs("--"), Io = /* @__PURE__ */ qs("var(--"), _e = (t) => Io(t) ? ko.test(t.split("/*")[0].trim()) : !1, ko = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, Fo = (
293
- // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
294
- /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
295
- );
296
- function Bo(t) {
297
- const e = Fo.exec(t);
298
- if (!e)
299
- return [,];
300
- const [, n, s, i] = e;
301
- return [`--${n ?? s}`, i];
302
- }
303
- const jo = 4;
304
- function Js(t, e, n = 1) {
305
- q(n <= jo, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);
306
- const [s, i] = Bo(t);
307
- if (!s)
308
- return;
309
- const r = window.getComputedStyle(e).getPropertyValue(s);
310
- if (r) {
311
- const o = r.trim();
312
- return Xs(o) ? parseFloat(o) : o;
313
- }
314
- return _e(i) ? Js(i, e, n + 1) : i;
315
- }
316
- const tt = (t, e, n) => n > e ? e : n < t ? t : n, xt = {
317
- test: (t) => typeof t == "number",
318
- parse: parseFloat,
319
- transform: (t) => t
320
- }, Rt = {
321
- ...xt,
322
- transform: (t) => tt(0, 1, t)
323
- }, Ft = {
324
- ...xt,
325
- default: 1
326
- }, It = (t) => ({
327
- test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
328
- parse: parseFloat,
329
- transform: (e) => `${e}${t}`
330
- }), Z = /* @__PURE__ */ It("deg"), _ = /* @__PURE__ */ It("%"), P = /* @__PURE__ */ It("px"), zo = /* @__PURE__ */ It("vh"), No = /* @__PURE__ */ It("vw"), Sn = {
331
- ..._,
332
- parse: (t) => _.parse(t) / 100,
333
- transform: (t) => _.transform(t * 100)
334
- }, Uo = /* @__PURE__ */ new Set([
335
- "width",
336
- "height",
337
- "top",
338
- "left",
339
- "right",
340
- "bottom",
341
- "x",
342
- "y",
343
- "translateX",
344
- "translateY"
345
- ]), Vn = (t) => t === xt || t === P, An = (t, e) => parseFloat(t.split(", ")[e]), wn = (t, e) => (n, { transform: s }) => {
346
- if (s === "none" || !s)
347
- return 0;
348
- const i = s.match(/^matrix3d\((.+)\)$/u);
349
- if (i)
350
- return An(i[1], e);
351
- {
352
- const r = s.match(/^matrix\((.+)\)$/u);
353
- return r ? An(r[1], t) : 0;
354
- }
355
- }, Ho = /* @__PURE__ */ new Set(["x", "y", "z"]), _o = Et.filter((t) => !Ho.has(t));
356
- function Ko(t) {
357
- const e = [];
358
- return _o.forEach((n) => {
359
- const s = t.getValue(n);
360
- s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
361
- }), e;
362
- }
363
- const gt = {
364
- // Dimensions
365
- width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
366
- height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
367
- top: (t, { top: e }) => parseFloat(e),
368
- left: (t, { left: e }) => parseFloat(e),
369
- bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
370
- right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
371
- // Transform
372
- x: wn(4, 13),
373
- y: wn(5, 14)
374
- };
375
- gt.translateX = gt.x;
376
- gt.translateY = gt.y;
377
- const Qs = (t) => (e) => e.test(t), Wo = {
378
- test: (t) => t === "auto",
379
- parse: (t) => t
380
- }, ti = [xt, P, _, Z, No, zo, Wo], bn = (t) => ti.find(Qs(t)), at = /* @__PURE__ */ new Set();
381
- let Te = !1, Pe = !1;
382
- function ei() {
383
- if (Pe) {
384
- const t = Array.from(at).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
385
- e.forEach((s) => {
386
- const i = Ko(s);
387
- i.length && (n.set(s, i), s.render());
388
- }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
389
- s.render();
390
- const i = n.get(s);
391
- i && i.forEach(([r, o]) => {
392
- var a;
393
- (a = s.getValue(r)) === null || a === void 0 || a.set(o);
394
- });
395
- }), t.forEach((s) => s.measureEndState()), t.forEach((s) => {
396
- s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
397
- });
398
- }
399
- Pe = !1, Te = !1, at.forEach((t) => t.complete()), at.clear();
400
- }
401
- function ni() {
402
- at.forEach((t) => {
403
- t.readKeyframes(), t.needsMeasurement && (Pe = !0);
404
- });
405
- }
406
- function $o() {
407
- ni(), ei();
408
- }
409
- class Ke {
410
- constructor(e, n, s, i, r, o = !1) {
411
- this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = o;
412
- }
413
- scheduleResolve() {
414
- this.isScheduled = !0, this.isAsync ? (at.add(this), Te || (Te = !0, b.read(ni), b.resolveKeyframes(ei))) : (this.readKeyframes(), this.complete());
415
- }
416
- readKeyframes() {
417
- const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
418
- for (let r = 0; r < e.length; r++)
419
- if (e[r] === null)
420
- if (r === 0) {
421
- const o = i == null ? void 0 : i.get(), a = e[e.length - 1];
422
- if (o !== void 0)
423
- e[0] = o;
424
- else if (s && n) {
425
- const l = s.readValue(n, a);
426
- l != null && (e[0] = l);
427
- }
428
- e[0] === void 0 && (e[0] = a), i && o === void 0 && i.set(e[0]);
429
- } else
430
- e[r] = e[r - 1];
431
- }
432
- setFinalKeyframe() {
433
- }
434
- measureInitialState() {
435
- }
436
- renderEndStyles() {
437
- }
438
- measureEndState() {
439
- }
440
- complete() {
441
- this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), at.delete(this);
442
- }
443
- cancel() {
444
- this.isComplete || (this.isScheduled = !1, at.delete(this));
445
- }
446
- resume() {
447
- this.isComplete || this.scheduleResolve();
448
- }
449
- }
450
- const wt = (t) => Math.round(t * 1e5) / 1e5, We = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
451
- function Go(t) {
452
- return t == null;
453
- }
454
- const Yo = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, $e = (t, e) => (n) => !!(typeof n == "string" && Yo.test(n) && n.startsWith(t) || e && !Go(n) && Object.prototype.hasOwnProperty.call(n, e)), si = (t, e, n) => (s) => {
455
- if (typeof s != "string")
456
- return s;
457
- const [i, r, o, a] = s.match(We);
458
- return {
459
- [t]: parseFloat(i),
460
- [e]: parseFloat(r),
461
- [n]: parseFloat(o),
462
- alpha: a !== void 0 ? parseFloat(a) : 1
463
- };
464
- }, Xo = (t) => tt(0, 255, t), re = {
465
- ...xt,
466
- transform: (t) => Math.round(Xo(t))
467
- }, rt = {
468
- test: /* @__PURE__ */ $e("rgb", "red"),
469
- parse: /* @__PURE__ */ si("red", "green", "blue"),
470
- transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + re.transform(t) + ", " + re.transform(e) + ", " + re.transform(n) + ", " + wt(Rt.transform(s)) + ")"
471
- };
472
- function qo(t) {
473
- let e = "", n = "", s = "", i = "";
474
- return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), s = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), s = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, s += s, i += i), {
475
- red: parseInt(e, 16),
476
- green: parseInt(n, 16),
477
- blue: parseInt(s, 16),
478
- alpha: i ? parseInt(i, 16) / 255 : 1
479
- };
480
- }
481
- const xe = {
482
- test: /* @__PURE__ */ $e("#"),
483
- parse: qo,
484
- transform: rt.transform
485
- }, ht = {
486
- test: /* @__PURE__ */ $e("hsl", "hue"),
487
- parse: /* @__PURE__ */ si("hue", "saturation", "lightness"),
488
- transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + _.transform(wt(e)) + ", " + _.transform(wt(n)) + ", " + wt(Rt.transform(s)) + ")"
489
- }, E = {
490
- test: (t) => rt.test(t) || xe.test(t) || ht.test(t),
491
- parse: (t) => rt.test(t) ? rt.parse(t) : ht.test(t) ? ht.parse(t) : xe.parse(t),
492
- transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? rt.transform(t) : ht.transform(t)
493
- }, Zo = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
494
- function Jo(t) {
495
- var e, n;
496
- return isNaN(t) && typeof t == "string" && (((e = t.match(We)) === null || e === void 0 ? void 0 : e.length) || 0) + (((n = t.match(Zo)) === null || n === void 0 ? void 0 : n.length) || 0) > 0;
497
- }
498
- const ii = "number", oi = "color", Qo = "var", tr = "var(", Cn = "${}", er = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
499
- function Dt(t) {
500
- const e = t.toString(), n = [], s = {
501
- color: [],
502
- number: [],
503
- var: []
504
- }, i = [];
505
- let r = 0;
506
- const a = e.replace(er, (l) => (E.test(l) ? (s.color.push(r), i.push(oi), n.push(E.parse(l))) : l.startsWith(tr) ? (s.var.push(r), i.push(Qo), n.push(l)) : (s.number.push(r), i.push(ii), n.push(parseFloat(l))), ++r, Cn)).split(Cn);
507
- return { values: n, split: a, indexes: s, types: i };
508
- }
509
- function ri(t) {
510
- return Dt(t).values;
511
- }
512
- function ai(t) {
513
- const { split: e, types: n } = Dt(t), s = e.length;
514
- return (i) => {
515
- let r = "";
516
- for (let o = 0; o < s; o++)
517
- if (r += e[o], i[o] !== void 0) {
518
- const a = n[o];
519
- a === ii ? r += wt(i[o]) : a === oi ? r += E.transform(i[o]) : r += i[o];
520
- }
521
- return r;
522
- };
523
- }
524
- const nr = (t) => typeof t == "number" ? 0 : t;
525
- function sr(t) {
526
- const e = ri(t);
527
- return ai(t)(e.map(nr));
528
- }
529
- const et = {
530
- test: Jo,
531
- parse: ri,
532
- createTransformer: ai,
533
- getAnimatableNone: sr
534
- }, ir = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
535
- function or(t) {
536
- const [e, n] = t.slice(0, -1).split("(");
537
- if (e === "drop-shadow")
538
- return t;
539
- const [s] = n.match(We) || [];
540
- if (!s)
541
- return t;
542
- const i = n.replace(s, "");
543
- let r = ir.has(e) ? 1 : 0;
544
- return s !== n && (r *= 100), e + "(" + r + i + ")";
545
- }
546
- const rr = /\b([a-z-]*)\(.*?\)/gu, Se = {
547
- ...et,
548
- getAnimatableNone: (t) => {
549
- const e = t.match(rr);
550
- return e ? e.map(or).join(" ") : t;
551
- }
552
- }, ar = {
553
- // Border props
554
- borderWidth: P,
555
- borderTopWidth: P,
556
- borderRightWidth: P,
557
- borderBottomWidth: P,
558
- borderLeftWidth: P,
559
- borderRadius: P,
560
- radius: P,
561
- borderTopLeftRadius: P,
562
- borderTopRightRadius: P,
563
- borderBottomRightRadius: P,
564
- borderBottomLeftRadius: P,
565
- // Positioning props
566
- width: P,
567
- maxWidth: P,
568
- height: P,
569
- maxHeight: P,
570
- top: P,
571
- right: P,
572
- bottom: P,
573
- left: P,
574
- // Spacing props
575
- padding: P,
576
- paddingTop: P,
577
- paddingRight: P,
578
- paddingBottom: P,
579
- paddingLeft: P,
580
- margin: P,
581
- marginTop: P,
582
- marginRight: P,
583
- marginBottom: P,
584
- marginLeft: P,
585
- // Misc
586
- backgroundPositionX: P,
587
- backgroundPositionY: P
588
- }, lr = {
589
- rotate: Z,
590
- rotateX: Z,
591
- rotateY: Z,
592
- rotateZ: Z,
593
- scale: Ft,
594
- scaleX: Ft,
595
- scaleY: Ft,
596
- scaleZ: Ft,
597
- skew: Z,
598
- skewX: Z,
599
- skewY: Z,
600
- distance: P,
601
- translateX: P,
602
- translateY: P,
603
- translateZ: P,
604
- x: P,
605
- y: P,
606
- z: P,
607
- perspective: P,
608
- transformPerspective: P,
609
- opacity: Rt,
610
- originX: Sn,
611
- originY: Sn,
612
- originZ: P
613
- }, Mn = {
614
- ...xt,
615
- transform: Math.round
616
- }, Ge = {
617
- ...ar,
618
- ...lr,
619
- zIndex: Mn,
620
- size: P,
621
- // SVG
622
- fillOpacity: Rt,
623
- strokeOpacity: Rt,
624
- numOctaves: Mn
625
- }, cr = {
626
- ...Ge,
627
- // Color props
628
- color: E,
629
- backgroundColor: E,
630
- outlineColor: E,
631
- fill: E,
632
- stroke: E,
633
- // Border props
634
- borderColor: E,
635
- borderTopColor: E,
636
- borderRightColor: E,
637
- borderBottomColor: E,
638
- borderLeftColor: E,
639
- filter: Se,
640
- WebkitFilter: Se
641
- }, Ye = (t) => cr[t];
642
- function li(t, e) {
643
- let n = Ye(t);
644
- return n !== Se && (n = et), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
645
- }
646
- const ur = /* @__PURE__ */ new Set(["auto", "none", "0"]);
647
- function hr(t, e, n) {
648
- let s = 0, i;
649
- for (; s < t.length && !i; ) {
650
- const r = t[s];
651
- typeof r == "string" && !ur.has(r) && Dt(r).values.length && (i = t[s]), s++;
652
- }
653
- if (i && n)
654
- for (const r of e)
655
- t[r] = li(n, i);
656
- }
657
- class ci extends Ke {
658
- constructor(e, n, s, i, r) {
659
- super(e, n, s, i, r, !0);
660
- }
661
- readKeyframes() {
662
- const { unresolvedKeyframes: e, element: n, name: s } = this;
663
- if (!n || !n.current)
664
- return;
665
- super.readKeyframes();
666
- for (let l = 0; l < e.length; l++) {
667
- let c = e[l];
668
- if (typeof c == "string" && (c = c.trim(), _e(c))) {
669
- const u = Js(c, n.current);
670
- u !== void 0 && (e[l] = u), l === e.length - 1 && (this.finalKeyframe = c);
671
- }
672
- }
673
- if (this.resolveNoneKeyframes(), !Uo.has(s) || e.length !== 2)
674
- return;
675
- const [i, r] = e, o = bn(i), a = bn(r);
676
- if (o !== a)
677
- if (Vn(o) && Vn(a))
678
- for (let l = 0; l < e.length; l++) {
679
- const c = e[l];
680
- typeof c == "string" && (e[l] = parseFloat(c));
681
- }
682
- else
683
- this.needsMeasurement = !0;
684
- }
685
- resolveNoneKeyframes() {
686
- const { unresolvedKeyframes: e, name: n } = this, s = [];
687
- for (let i = 0; i < e.length; i++)
688
- Oo(e[i]) && s.push(i);
689
- s.length && hr(e, s, n);
690
- }
691
- measureInitialState() {
692
- const { element: e, unresolvedKeyframes: n, name: s } = this;
693
- if (!e || !e.current)
694
- return;
695
- s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = gt[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
696
- const i = n[n.length - 1];
697
- i !== void 0 && e.getValue(s, i).jump(i, !1);
698
- }
699
- measureEndState() {
700
- var e;
701
- const { element: n, name: s, unresolvedKeyframes: i } = this;
702
- if (!n || !n.current)
703
- return;
704
- const r = n.getValue(s);
705
- r && r.jump(this.measuredOrigin, !1);
706
- const o = i.length - 1, a = i[o];
707
- i[o] = gt[s](n.measureViewportBox(), window.getComputedStyle(n.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([l, c]) => {
708
- n.getValue(l).set(c);
709
- }), this.resolveNoneKeyframes();
710
- }
711
- }
712
- function Xe(t) {
713
- return typeof t == "function";
714
- }
715
- let zt;
716
- function dr() {
717
- zt = void 0;
718
- }
719
- const K = {
720
- now: () => (zt === void 0 && K.set(D.isProcessing || bo.useManualTiming ? D.timestamp : performance.now()), zt),
721
- set: (t) => {
722
- zt = t, queueMicrotask(dr);
723
- }
724
- }, Rn = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
725
- (et.test(t) || t === "0") && // And it contains numbers and/or colors
726
- !t.startsWith("url("));
727
- function fr(t) {
728
- const e = t[0];
729
- if (t.length === 1)
730
- return !0;
731
- for (let n = 0; n < t.length; n++)
732
- if (t[n] !== e)
733
- return !0;
734
- }
735
- function pr(t, e, n, s) {
736
- const i = t[0];
737
- if (i === null)
738
- return !1;
739
- if (e === "display" || e === "visibility")
740
- return !0;
741
- const r = t[t.length - 1], o = Rn(i, e), a = Rn(r, e);
742
- return Pt(o === a, `You are trying to animate ${e} from "${i}" to "${r}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${r} via the \`style\` property.`), !o || !a ? !1 : fr(t) || (n === "spring" || Xe(n)) && s;
743
- }
744
- const mr = 40;
745
- class ui {
746
- constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", ...a }) {
747
- this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = K.now(), this.options = {
748
- autoplay: e,
749
- delay: n,
750
- type: s,
751
- repeat: i,
752
- repeatDelay: r,
753
- repeatType: o,
754
- ...a
755
- }, this.updateFinishedPromise();
756
- }
757
- /**
758
- * This method uses the createdAt and resolvedAt to calculate the
759
- * animation startTime. *Ideally*, we would use the createdAt time as t=0
760
- * as the following frame would then be the first frame of the animation in
761
- * progress, which would feel snappier.
762
- *
763
- * However, if there's a delay (main thread work) between the creation of
764
- * the animation and the first commited frame, we prefer to use resolvedAt
765
- * to avoid a sudden jump into the animation.
766
- */
767
- calcStartTime() {
768
- return this.resolvedAt ? this.resolvedAt - this.createdAt > mr ? this.resolvedAt : this.createdAt : this.createdAt;
769
- }
770
- /**
771
- * A getter for resolved data. If keyframes are not yet resolved, accessing
772
- * this.resolved will synchronously flush all pending keyframe resolvers.
773
- * This is a deoptimisation, but at its worst still batches read/writes.
774
- */
775
- get resolved() {
776
- return !this._resolved && !this.hasAttemptedResolve && $o(), this._resolved;
777
- }
778
- /**
779
- * A method to be called when the keyframes resolver completes. This method
780
- * will check if its possible to run the animation and, if not, skip it.
781
- * Otherwise, it will call initPlayback on the implementing class.
782
- */
783
- onKeyframesResolved(e, n) {
784
- this.resolvedAt = K.now(), this.hasAttemptedResolve = !0;
785
- const { name: s, type: i, velocity: r, delay: o, onComplete: a, onUpdate: l, isGenerator: c } = this.options;
786
- if (!c && !pr(e, s, i, r))
787
- if (o)
788
- this.options.duration = 0;
789
- else {
790
- l == null || l(Jt(e, this.options, n)), a == null || a(), this.resolveFinishedPromise();
791
- return;
792
- }
793
- const u = this.initPlayback(e, n);
794
- u !== !1 && (this._resolved = {
795
- keyframes: e,
796
- finalKeyframe: n,
797
- ...u
798
- }, this.onPostResolved());
799
- }
800
- onPostResolved() {
801
- }
802
- /**
803
- * Allows the returned animation to be awaited or promise-chained. Currently
804
- * resolves when the animation finishes at all but in a future update could/should
805
- * reject if its cancels.
806
- */
807
- then(e, n) {
808
- return this.currentFinishedPromise.then(e, n);
809
- }
810
- updateFinishedPromise() {
811
- this.currentFinishedPromise = new Promise((e) => {
812
- this.resolveFinishedPromise = e;
813
- });
814
- }
815
- }
816
- function hi(t, e) {
817
- return e ? t * (1e3 / e) : 0;
818
- }
819
- const gr = 5;
820
- function di(t, e, n) {
821
- const s = Math.max(e - gr, 0);
822
- return hi(n - t(s), e - s);
823
- }
824
- const ae = 1e-3, yr = 0.01, Dn = 10, vr = 0.05, Tr = 1;
825
- function Pr({ duration: t = 800, bounce: e = 0.25, velocity: n = 0, mass: s = 1 }) {
826
- let i, r;
827
- Pt(t <= H(Dn), "Spring duration must be 10 seconds or less");
828
- let o = 1 - e;
829
- o = tt(vr, Tr, o), t = tt(yr, Dn, G(t)), o < 1 ? (i = (c) => {
830
- const u = c * o, h = u * t, d = u - n, f = Ve(c, o), p = Math.exp(-h);
831
- return ae - d / f * p;
832
- }, r = (c) => {
833
- const h = c * o * t, d = h * n + n, f = Math.pow(o, 2) * Math.pow(c, 2) * t, p = Math.exp(-h), y = Ve(Math.pow(c, 2), o);
834
- return (-i(c) + ae > 0 ? -1 : 1) * ((d - f) * p) / y;
835
- }) : (i = (c) => {
836
- const u = Math.exp(-c * t), h = (c - n) * t + 1;
837
- return -ae + u * h;
838
- }, r = (c) => {
839
- const u = Math.exp(-c * t), h = (n - c) * (t * t);
840
- return u * h;
841
- });
842
- const a = 5 / t, l = Sr(i, r, a);
843
- if (t = H(t), isNaN(l))
844
- return {
845
- stiffness: 100,
846
- damping: 10,
847
- duration: t
848
- };
849
- {
850
- const c = Math.pow(l, 2) * s;
851
- return {
852
- stiffness: c,
853
- damping: o * 2 * Math.sqrt(s * c),
854
- duration: t
855
- };
856
- }
857
- }
858
- const xr = 12;
859
- function Sr(t, e, n) {
860
- let s = n;
861
- for (let i = 1; i < xr; i++)
862
- s = s - t(s) / e(s);
863
- return s;
864
- }
865
- function Ve(t, e) {
866
- return t * Math.sqrt(1 - e * e);
867
- }
868
- const Vr = ["duration", "bounce"], Ar = ["stiffness", "damping", "mass"];
869
- function Ln(t, e) {
870
- return e.some((n) => t[n] !== void 0);
871
- }
872
- function wr(t) {
873
- let e = {
874
- velocity: 0,
875
- stiffness: 100,
876
- damping: 10,
877
- mass: 1,
878
- isResolvedFromDuration: !1,
879
- ...t
880
- };
881
- if (!Ln(t, Ar) && Ln(t, Vr)) {
882
- const n = Pr(t);
883
- e = {
884
- ...e,
885
- ...n,
886
- mass: 1
887
- }, e.isResolvedFromDuration = !0;
888
- }
889
- return e;
890
- }
891
- function fi({ keyframes: t, restDelta: e, restSpeed: n, ...s }) {
892
- const i = t[0], r = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: l, mass: c, duration: u, velocity: h, isResolvedFromDuration: d } = wr({
893
- ...s,
894
- velocity: -G(s.velocity || 0)
895
- }), f = h || 0, p = l / (2 * Math.sqrt(a * c)), y = r - i, T = G(Math.sqrt(a / c)), g = Math.abs(y) < 5;
896
- n || (n = g ? 0.01 : 2), e || (e = g ? 5e-3 : 0.5);
897
- let v;
898
- if (p < 1) {
899
- const m = Ve(T, p);
900
- v = (S) => {
901
- const A = Math.exp(-p * T * S);
902
- return r - A * ((f + p * T * y) / m * Math.sin(m * S) + y * Math.cos(m * S));
903
- };
904
- } else if (p === 1)
905
- v = (m) => r - Math.exp(-T * m) * (y + (f + T * y) * m);
906
- else {
907
- const m = T * Math.sqrt(p * p - 1);
908
- v = (S) => {
909
- const A = Math.exp(-p * T * S), M = Math.min(m * S, 300);
910
- return r - A * ((f + p * T * y) * Math.sinh(M) + m * y * Math.cosh(M)) / m;
911
- };
912
- }
913
- return {
914
- calculatedDuration: d && u || null,
915
- next: (m) => {
916
- const S = v(m);
917
- if (d)
918
- o.done = m >= u;
919
- else {
920
- let A = 0;
921
- p < 1 && (A = m === 0 ? H(f) : di(v, m, S));
922
- const M = Math.abs(A) <= n, B = Math.abs(r - S) <= e;
923
- o.done = M && B;
924
- }
925
- return o.value = o.done ? r : S, o;
926
- }
927
- };
928
- }
929
- function En({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: l, restDelta: c = 0.5, restSpeed: u }) {
930
- const h = t[0], d = {
931
- done: !1,
932
- value: h
933
- }, f = (w) => a !== void 0 && w < a || l !== void 0 && w > l, p = (w) => a === void 0 ? l : l === void 0 || Math.abs(a - w) < Math.abs(l - w) ? a : l;
934
- let y = n * e;
935
- const T = h + y, g = o === void 0 ? T : o(T);
936
- g !== T && (y = g - h);
937
- const v = (w) => -y * Math.exp(-w / s), m = (w) => g + v(w), S = (w) => {
938
- const j = v(w), z = m(w);
939
- d.done = Math.abs(j) <= c, d.value = d.done ? g : z;
940
- };
941
- let A, M;
942
- const B = (w) => {
943
- f(d.value) && (A = w, M = fi({
944
- keyframes: [d.value, p(d.value)],
945
- velocity: di(m, w, d.value),
946
- // TODO: This should be passing * 1000
947
- damping: i,
948
- stiffness: r,
949
- restDelta: c,
950
- restSpeed: u
951
- }));
952
- };
953
- return B(0), {
954
- calculatedDuration: null,
955
- next: (w) => {
956
- let j = !1;
957
- return !M && A === void 0 && (j = !0, S(w), B(w)), A !== void 0 && w >= A ? M.next(w - A) : (!j && S(w), d);
958
- }
959
- };
960
- }
961
- const br = /* @__PURE__ */ Ot(0.42, 0, 1, 1), Cr = /* @__PURE__ */ Ot(0, 0, 0.58, 1), pi = /* @__PURE__ */ Ot(0.42, 0, 0.58, 1), Mr = (t) => Array.isArray(t) && typeof t[0] != "number", qe = (t) => Array.isArray(t) && typeof t[0] == "number", On = {
962
- linear: L,
963
- easeIn: br,
964
- easeInOut: pi,
965
- easeOut: Cr,
966
- circIn: He,
967
- circInOut: Gs,
968
- circOut: $s,
969
- backIn: Ue,
970
- backInOut: Ks,
971
- backOut: _s,
972
- anticipate: Ws
973
- }, In = (t) => {
974
- if (qe(t)) {
975
- q(t.length === 4, "Cubic bezier arrays must contain four numerical values.");
976
- const [e, n, s, i] = t;
977
- return Ot(e, n, s, i);
978
- } else if (typeof t == "string")
979
- return q(On[t] !== void 0, `Invalid easing type '${t}'`), On[t];
980
- return t;
981
- }, Rr = (t, e) => (n) => e(t(n)), Y = (...t) => t.reduce(Rr), yt = (t, e, n) => {
982
- const s = e - t;
983
- return s === 0 ? 1 : (n - t) / s;
984
- }, C = (t, e, n) => t + (e - t) * n;
985
- function le(t, e, n) {
986
- return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
987
- }
988
- function Dr({ hue: t, saturation: e, lightness: n, alpha: s }) {
989
- t /= 360, e /= 100, n /= 100;
990
- let i = 0, r = 0, o = 0;
991
- if (!e)
992
- i = r = o = n;
993
- else {
994
- const a = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - a;
995
- i = le(l, a, t + 1 / 3), r = le(l, a, t), o = le(l, a, t - 1 / 3);
996
- }
997
- return {
998
- red: Math.round(i * 255),
999
- green: Math.round(r * 255),
1000
- blue: Math.round(o * 255),
1001
- alpha: s
1002
- };
1003
- }
1004
- function Ht(t, e) {
1005
- return (n) => n > 0 ? e : t;
1006
- }
1007
- const ce = (t, e, n) => {
1008
- const s = t * t, i = n * (e * e - s) + s;
1009
- return i < 0 ? 0 : Math.sqrt(i);
1010
- }, Lr = [xe, rt, ht], Er = (t) => Lr.find((e) => e.test(t));
1011
- function kn(t) {
1012
- const e = Er(t);
1013
- if (Pt(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e)
1014
- return !1;
1015
- let n = e.parse(t);
1016
- return e === ht && (n = Dr(n)), n;
1017
- }
1018
- const Fn = (t, e) => {
1019
- const n = kn(t), s = kn(e);
1020
- if (!n || !s)
1021
- return Ht(t, e);
1022
- const i = { ...n };
1023
- return (r) => (i.red = ce(n.red, s.red, r), i.green = ce(n.green, s.green, r), i.blue = ce(n.blue, s.blue, r), i.alpha = C(n.alpha, s.alpha, r), rt.transform(i));
1024
- }, Ae = /* @__PURE__ */ new Set(["none", "hidden"]);
1025
- function Or(t, e) {
1026
- return Ae.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
1027
- }
1028
- function Ir(t, e) {
1029
- return (n) => C(t, e, n);
1030
- }
1031
- function Ze(t) {
1032
- return typeof t == "number" ? Ir : typeof t == "string" ? _e(t) ? Ht : E.test(t) ? Fn : Br : Array.isArray(t) ? mi : typeof t == "object" ? E.test(t) ? Fn : kr : Ht;
1033
- }
1034
- function mi(t, e) {
1035
- const n = [...t], s = n.length, i = t.map((r, o) => Ze(r)(r, e[o]));
1036
- return (r) => {
1037
- for (let o = 0; o < s; o++)
1038
- n[o] = i[o](r);
1039
- return n;
1040
- };
1041
- }
1042
- function kr(t, e) {
1043
- const n = { ...t, ...e }, s = {};
1044
- for (const i in n)
1045
- t[i] !== void 0 && e[i] !== void 0 && (s[i] = Ze(t[i])(t[i], e[i]));
1046
- return (i) => {
1047
- for (const r in s)
1048
- n[r] = s[r](i);
1049
- return n;
1050
- };
1051
- }
1052
- function Fr(t, e) {
1053
- var n;
1054
- const s = [], i = { color: 0, var: 0, number: 0 };
1055
- for (let r = 0; r < e.values.length; r++) {
1056
- const o = e.types[r], a = t.indexes[o][i[o]], l = (n = t.values[a]) !== null && n !== void 0 ? n : 0;
1057
- s[r] = l, i[o]++;
1058
- }
1059
- return s;
1060
- }
1061
- const Br = (t, e) => {
1062
- const n = et.createTransformer(e), s = Dt(t), i = Dt(e);
1063
- return s.indexes.var.length === i.indexes.var.length && s.indexes.color.length === i.indexes.color.length && s.indexes.number.length >= i.indexes.number.length ? Ae.has(t) && !i.values.length || Ae.has(e) && !s.values.length ? Or(t, e) : Y(mi(Fr(s, i), i.values), n) : (Pt(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), Ht(t, e));
1064
- };
1065
- function gi(t, e, n) {
1066
- return typeof t == "number" && typeof e == "number" && typeof n == "number" ? C(t, e, n) : Ze(t)(t, e);
1067
- }
1068
- function jr(t, e, n) {
1069
- const s = [], i = n || gi, r = t.length - 1;
1070
- for (let o = 0; o < r; o++) {
1071
- let a = i(t[o], t[o + 1]);
1072
- if (e) {
1073
- const l = Array.isArray(e) ? e[o] || L : e;
1074
- a = Y(l, a);
1075
- }
1076
- s.push(a);
1077
- }
1078
- return s;
1079
- }
1080
- function zr(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
1081
- const r = t.length;
1082
- if (q(r === e.length, "Both input and output ranges must be the same length"), r === 1)
1083
- return () => e[0];
1084
- if (r === 2 && t[0] === t[1])
1085
- return () => e[1];
1086
- t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
1087
- const o = jr(e, s, i), a = o.length, l = (c) => {
1088
- let u = 0;
1089
- if (a > 1)
1090
- for (; u < t.length - 2 && !(c < t[u + 1]); u++)
1091
- ;
1092
- const h = yt(t[u], t[u + 1], c);
1093
- return o[u](h);
1094
- };
1095
- return n ? (c) => l(tt(t[0], t[r - 1], c)) : l;
1096
- }
1097
- function Nr(t, e) {
1098
- const n = t[t.length - 1];
1099
- for (let s = 1; s <= e; s++) {
1100
- const i = yt(0, e, s);
1101
- t.push(C(n, 1, i));
1102
- }
1103
- }
1104
- function Ur(t) {
1105
- const e = [0];
1106
- return Nr(e, t.length - 1), e;
1107
- }
1108
- function Hr(t, e) {
1109
- return t.map((n) => n * e);
1110
- }
1111
- function _r(t, e) {
1112
- return t.map(() => e || pi).splice(0, t.length - 1);
1113
- }
1114
- function _t({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
1115
- const i = Mr(s) ? s.map(In) : In(s), r = {
1116
- done: !1,
1117
- value: e[0]
1118
- }, o = Hr(
1119
- // Only use the provided offsets if they're the correct length
1120
- // TODO Maybe we should warn here if there's a length mismatch
1121
- n && n.length === e.length ? n : Ur(e),
1122
- t
1123
- ), a = zr(o, e, {
1124
- ease: Array.isArray(i) ? i : _r(e, i)
1125
- });
1126
- return {
1127
- calculatedDuration: t,
1128
- next: (l) => (r.value = a(l), r.done = l >= t, r)
1129
- };
1130
- }
1131
- const Bn = 2e4;
1132
- function Kr(t) {
1133
- let e = 0;
1134
- const n = 50;
1135
- let s = t.next(e);
1136
- for (; !s.done && e < Bn; )
1137
- e += n, s = t.next(e);
1138
- return e >= Bn ? 1 / 0 : e;
1139
- }
1140
- const Wr = (t) => {
1141
- const e = ({ timestamp: n }) => t(n);
1142
- return {
1143
- start: () => b.update(e, !0),
1144
- stop: () => Q(e),
1145
- /**
1146
- * If we're processing this frame we can use the
1147
- * framelocked timestamp to keep things in sync.
1148
- */
1149
- now: () => D.isProcessing ? D.timestamp : K.now()
1150
- };
1151
- }, $r = {
1152
- decay: En,
1153
- inertia: En,
1154
- tween: _t,
1155
- keyframes: _t,
1156
- spring: fi
1157
- }, Gr = (t) => t / 100;
1158
- class Je extends ui {
1159
- constructor(e) {
1160
- super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => {
1161
- if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
1162
- return;
1163
- this.teardown();
1164
- const { onStop: l } = this.options;
1165
- l && l();
1166
- };
1167
- const { name: n, motionValue: s, element: i, keyframes: r } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Ke, a = (l, c) => this.onKeyframesResolved(l, c);
1168
- this.resolver = new o(r, a, n, s, i), this.resolver.scheduleResolve();
1169
- }
1170
- initPlayback(e) {
1171
- const { type: n = "keyframes", repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = this.options, a = Xe(n) ? n : $r[n] || _t;
1172
- let l, c;
1173
- a !== _t && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && q(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), l = Y(Gr, gi(e[0], e[1])), e = [0, 100]);
1174
- const u = a({ ...this.options, keyframes: e });
1175
- r === "mirror" && (c = a({
1176
- ...this.options,
1177
- keyframes: [...e].reverse(),
1178
- velocity: -o
1179
- })), u.calculatedDuration === null && (u.calculatedDuration = Kr(u));
1180
- const { calculatedDuration: h } = u, d = h + i, f = d * (s + 1) - i;
1181
- return {
1182
- generator: u,
1183
- mirroredGenerator: c,
1184
- mapPercentToKeyframes: l,
1185
- calculatedDuration: h,
1186
- resolvedDuration: d,
1187
- totalDuration: f
1188
- };
1189
- }
1190
- onPostResolved() {
1191
- const { autoplay: e = !0 } = this.options;
1192
- this.play(), this.pendingPlayState === "paused" || !e ? this.pause() : this.state = this.pendingPlayState;
1193
- }
1194
- tick(e, n = !1) {
1195
- const { resolved: s } = this;
1196
- if (!s) {
1197
- const { keyframes: w } = this.options;
1198
- return { done: !0, value: w[w.length - 1] };
1199
- }
1200
- const { finalKeyframe: i, generator: r, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: l, calculatedDuration: c, totalDuration: u, resolvedDuration: h } = s;
1201
- if (this.startTime === null)
1202
- return r.next(0);
1203
- const { delay: d, repeat: f, repeatType: p, repeatDelay: y, onUpdate: T } = this.options;
1204
- this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - u / this.speed, this.startTime)), n ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed;
1205
- const g = this.currentTime - d * (this.speed >= 0 ? 1 : -1), v = this.speed >= 0 ? g < 0 : g > u;
1206
- this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = u);
1207
- let m = this.currentTime, S = r;
1208
- if (f) {
1209
- const w = Math.min(this.currentTime, u) / h;
1210
- let j = Math.floor(w), z = w % 1;
1211
- !z && w >= 1 && (z = 1), z === 1 && j--, j = Math.min(j, f + 1), !!(j % 2) && (p === "reverse" ? (z = 1 - z, y && (z -= y / h)) : p === "mirror" && (S = o)), m = tt(0, 1, z) * h;
1212
- }
1213
- const A = v ? { done: !1, value: l[0] } : S.next(m);
1214
- a && (A.value = a(A.value));
1215
- let { done: M } = A;
1216
- !v && c !== null && (M = this.speed >= 0 ? this.currentTime >= u : this.currentTime <= 0);
1217
- const B = this.holdTime === null && (this.state === "finished" || this.state === "running" && M);
1218
- return B && i !== void 0 && (A.value = Jt(l, this.options, i)), T && T(A.value), B && this.finish(), A;
1219
- }
1220
- get duration() {
1221
- const { resolved: e } = this;
1222
- return e ? G(e.calculatedDuration) : 0;
1223
- }
1224
- get time() {
1225
- return G(this.currentTime);
1226
- }
1227
- set time(e) {
1228
- e = H(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed);
1229
- }
1230
- get speed() {
1231
- return this.playbackSpeed;
1232
- }
1233
- set speed(e) {
1234
- const n = this.playbackSpeed !== e;
1235
- this.playbackSpeed = e, n && (this.time = G(this.currentTime));
1236
- }
1237
- play() {
1238
- if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) {
1239
- this.pendingPlayState = "running";
1240
- return;
1241
- }
1242
- if (this.isStopped)
1243
- return;
1244
- const { driver: e = Wr, onPlay: n, startTime: s } = this.options;
1245
- this.driver || (this.driver = e((r) => this.tick(r))), n && n();
1246
- const i = this.driver.now();
1247
- this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = s ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start();
1248
- }
1249
- pause() {
1250
- var e;
1251
- if (!this._resolved) {
1252
- this.pendingPlayState = "paused";
1253
- return;
1254
- }
1255
- this.state = "paused", this.holdTime = (e = this.currentTime) !== null && e !== void 0 ? e : 0;
1256
- }
1257
- complete() {
1258
- this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null;
1259
- }
1260
- finish() {
1261
- this.teardown(), this.state = "finished";
1262
- const { onComplete: e } = this.options;
1263
- e && e();
1264
- }
1265
- cancel() {
1266
- this.cancelTime !== null && this.tick(this.cancelTime), this.teardown(), this.updateFinishedPromise();
1267
- }
1268
- teardown() {
1269
- this.state = "idle", this.stopDriver(), this.resolveFinishedPromise(), this.updateFinishedPromise(), this.startTime = this.cancelTime = null, this.resolver.cancel();
1270
- }
1271
- stopDriver() {
1272
- this.driver && (this.driver.stop(), this.driver = void 0);
1273
- }
1274
- sample(e) {
1275
- return this.startTime = 0, this.tick(e, !0);
1276
- }
1277
- }
1278
- const Yr = /* @__PURE__ */ new Set([
1279
- "opacity",
1280
- "clipPath",
1281
- "filter",
1282
- "transform"
1283
- // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
1284
- // or until we implement support for linear() easing.
1285
- // "background-color"
1286
- ]), Xr = 10, qr = (t, e) => {
1287
- let n = "";
1288
- const s = Math.max(Math.round(e / Xr), 2);
1289
- for (let i = 0; i < s; i++)
1290
- n += t(yt(0, s - 1, i)) + ", ";
1291
- return `linear(${n.substring(0, n.length - 2)})`;
1292
- };
1293
- function Qe(t) {
1294
- let e;
1295
- return () => (e === void 0 && (e = t()), e);
1296
- }
1297
- const Zr = {
1298
- linearEasing: void 0
1299
- };
1300
- function Jr(t, e) {
1301
- const n = Qe(t);
1302
- return () => {
1303
- var s;
1304
- return (s = Zr[e]) !== null && s !== void 0 ? s : n();
1305
- };
1306
- }
1307
- const Kt = /* @__PURE__ */ Jr(() => {
1308
- try {
1309
- document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1310
- } catch {
1311
- return !1;
1312
- }
1313
- return !0;
1314
- }, "linearEasing");
1315
- function yi(t) {
1316
- return !!(typeof t == "function" && Kt() || !t || typeof t == "string" && (t in we || Kt()) || qe(t) || Array.isArray(t) && t.every(yi));
1317
- }
1318
- const Vt = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, we = {
1319
- linear: "linear",
1320
- ease: "ease",
1321
- easeIn: "ease-in",
1322
- easeOut: "ease-out",
1323
- easeInOut: "ease-in-out",
1324
- circIn: /* @__PURE__ */ Vt([0, 0.65, 0.55, 1]),
1325
- circOut: /* @__PURE__ */ Vt([0.55, 0, 1, 0.45]),
1326
- backIn: /* @__PURE__ */ Vt([0.31, 0.01, 0.66, -0.59]),
1327
- backOut: /* @__PURE__ */ Vt([0.33, 1.53, 0.69, 0.99])
1328
- };
1329
- function vi(t, e) {
1330
- if (t)
1331
- return typeof t == "function" && Kt() ? qr(t, e) : qe(t) ? Vt(t) : Array.isArray(t) ? t.map((n) => vi(n, e) || we.easeOut) : we[t];
1332
- }
1333
- function Qr(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a, times: l } = {}) {
1334
- const c = { [e]: n };
1335
- l && (c.offset = l);
1336
- const u = vi(a, i);
1337
- return Array.isArray(u) && (c.easing = u), t.animate(c, {
1338
- delay: s,
1339
- duration: i,
1340
- easing: Array.isArray(u) ? "linear" : u,
1341
- fill: "both",
1342
- iterations: r + 1,
1343
- direction: o === "reverse" ? "alternate" : "normal"
1344
- });
1345
- }
1346
- function jn(t, e) {
1347
- t.timeline = e, t.onfinish = null;
1348
- }
1349
- const ta = /* @__PURE__ */ Qe(() => Object.hasOwnProperty.call(Element.prototype, "animate")), Wt = 10, ea = 2e4;
1350
- function na(t) {
1351
- return Xe(t.type) || t.type === "spring" || !yi(t.ease);
1352
- }
1353
- function sa(t, e) {
1354
- const n = new Je({
1355
- ...e,
1356
- keyframes: t,
1357
- repeat: 0,
1358
- delay: 0,
1359
- isGenerator: !0
1360
- });
1361
- let s = { done: !1, value: t[0] };
1362
- const i = [];
1363
- let r = 0;
1364
- for (; !s.done && r < ea; )
1365
- s = n.sample(r), i.push(s.value), r += Wt;
1366
- return {
1367
- times: void 0,
1368
- keyframes: i,
1369
- duration: r - Wt,
1370
- ease: "linear"
1371
- };
1372
- }
1373
- const Ti = {
1374
- anticipate: Ws,
1375
- backInOut: Ks,
1376
- circInOut: Gs
1377
- };
1378
- function ia(t) {
1379
- return t in Ti;
1380
- }
1381
- class zn extends ui {
1382
- constructor(e) {
1383
- super(e);
1384
- const { name: n, motionValue: s, element: i, keyframes: r } = this.options;
1385
- this.resolver = new ci(r, (o, a) => this.onKeyframesResolved(o, a), n, s, i), this.resolver.scheduleResolve();
1386
- }
1387
- initPlayback(e, n) {
1388
- var s;
1389
- let { duration: i = 300, times: r, ease: o, type: a, motionValue: l, name: c, startTime: u } = this.options;
1390
- if (!(!((s = l.owner) === null || s === void 0) && s.current))
1391
- return !1;
1392
- if (typeof o == "string" && Kt() && ia(o) && (o = Ti[o]), na(this.options)) {
1393
- const { onComplete: d, onUpdate: f, motionValue: p, element: y, ...T } = this.options, g = sa(e, T);
1394
- e = g.keyframes, e.length === 1 && (e[1] = e[0]), i = g.duration, r = g.times, o = g.ease, a = "keyframes";
1395
- }
1396
- const h = Qr(l.owner.current, c, e, { ...this.options, duration: i, times: r, ease: o });
1397
- return h.startTime = u ?? this.calcStartTime(), this.pendingTimeline ? (jn(h, this.pendingTimeline), this.pendingTimeline = void 0) : h.onfinish = () => {
1398
- const { onComplete: d } = this.options;
1399
- l.set(Jt(e, this.options, n)), d && d(), this.cancel(), this.resolveFinishedPromise();
1400
- }, {
1401
- animation: h,
1402
- duration: i,
1403
- times: r,
1404
- type: a,
1405
- ease: o,
1406
- keyframes: e
1407
- };
1408
- }
1409
- get duration() {
1410
- const { resolved: e } = this;
1411
- if (!e)
1412
- return 0;
1413
- const { duration: n } = e;
1414
- return G(n);
1415
- }
1416
- get time() {
1417
- const { resolved: e } = this;
1418
- if (!e)
1419
- return 0;
1420
- const { animation: n } = e;
1421
- return G(n.currentTime || 0);
1422
- }
1423
- set time(e) {
1424
- const { resolved: n } = this;
1425
- if (!n)
1426
- return;
1427
- const { animation: s } = n;
1428
- s.currentTime = H(e);
1429
- }
1430
- get speed() {
1431
- const { resolved: e } = this;
1432
- if (!e)
1433
- return 1;
1434
- const { animation: n } = e;
1435
- return n.playbackRate;
1436
- }
1437
- set speed(e) {
1438
- const { resolved: n } = this;
1439
- if (!n)
1440
- return;
1441
- const { animation: s } = n;
1442
- s.playbackRate = e;
1443
- }
1444
- get state() {
1445
- const { resolved: e } = this;
1446
- if (!e)
1447
- return "idle";
1448
- const { animation: n } = e;
1449
- return n.playState;
1450
- }
1451
- get startTime() {
1452
- const { resolved: e } = this;
1453
- if (!e)
1454
- return null;
1455
- const { animation: n } = e;
1456
- return n.startTime;
1457
- }
1458
- /**
1459
- * Replace the default DocumentTimeline with another AnimationTimeline.
1460
- * Currently used for scroll animations.
1461
- */
1462
- attachTimeline(e) {
1463
- if (!this._resolved)
1464
- this.pendingTimeline = e;
1465
- else {
1466
- const { resolved: n } = this;
1467
- if (!n)
1468
- return L;
1469
- const { animation: s } = n;
1470
- jn(s, e);
1471
- }
1472
- return L;
1473
- }
1474
- play() {
1475
- if (this.isStopped)
1476
- return;
1477
- const { resolved: e } = this;
1478
- if (!e)
1479
- return;
1480
- const { animation: n } = e;
1481
- n.playState === "finished" && this.updateFinishedPromise(), n.play();
1482
- }
1483
- pause() {
1484
- const { resolved: e } = this;
1485
- if (!e)
1486
- return;
1487
- const { animation: n } = e;
1488
- n.pause();
1489
- }
1490
- stop() {
1491
- if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
1492
- return;
1493
- this.resolveFinishedPromise(), this.updateFinishedPromise();
1494
- const { resolved: e } = this;
1495
- if (!e)
1496
- return;
1497
- const { animation: n, keyframes: s, duration: i, type: r, ease: o, times: a } = e;
1498
- if (n.playState === "idle" || n.playState === "finished")
1499
- return;
1500
- if (this.time) {
1501
- const { motionValue: c, onUpdate: u, onComplete: h, element: d, ...f } = this.options, p = new Je({
1502
- ...f,
1503
- keyframes: s,
1504
- duration: i,
1505
- type: r,
1506
- ease: o,
1507
- times: a,
1508
- isGenerator: !0
1509
- }), y = H(this.time);
1510
- c.setWithVelocity(p.sample(y - Wt).value, p.sample(y).value, Wt);
1511
- }
1512
- const { onStop: l } = this.options;
1513
- l && l(), this.cancel();
1514
- }
1515
- complete() {
1516
- const { resolved: e } = this;
1517
- e && e.animation.finish();
1518
- }
1519
- cancel() {
1520
- const { resolved: e } = this;
1521
- e && e.animation.cancel();
1522
- }
1523
- static supports(e) {
1524
- const { motionValue: n, name: s, repeatDelay: i, repeatType: r, damping: o, type: a } = e;
1525
- return ta() && s && Yr.has(s) && n && n.owner && n.owner.current instanceof HTMLElement && /**
1526
- * If we're outputting values to onUpdate then we can't use WAAPI as there's
1527
- * no way to read the value from WAAPI every frame.
1528
- */
1529
- !n.owner.getProps().onUpdate && !i && r !== "mirror" && o !== 0 && a !== "inertia";
1530
- }
1531
- }
1532
- const oa = Qe(() => window.ScrollTimeline !== void 0);
1533
- class ra {
1534
- constructor(e) {
1535
- this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
1536
- }
1537
- then(e, n) {
1538
- return Promise.all(this.animations).then(e).catch(n);
1539
- }
1540
- /**
1541
- * TODO: Filter out cancelled or stopped animations before returning
1542
- */
1543
- getAll(e) {
1544
- return this.animations[0][e];
1545
- }
1546
- setAll(e, n) {
1547
- for (let s = 0; s < this.animations.length; s++)
1548
- this.animations[s][e] = n;
1549
- }
1550
- attachTimeline(e, n) {
1551
- const s = this.animations.map((i) => oa() && i.attachTimeline ? i.attachTimeline(e) : n(i));
1552
- return () => {
1553
- s.forEach((i, r) => {
1554
- i && i(), this.animations[r].stop();
1555
- });
1556
- };
1557
- }
1558
- get time() {
1559
- return this.getAll("time");
1560
- }
1561
- set time(e) {
1562
- this.setAll("time", e);
1563
- }
1564
- get speed() {
1565
- return this.getAll("speed");
1566
- }
1567
- set speed(e) {
1568
- this.setAll("speed", e);
1569
- }
1570
- get startTime() {
1571
- return this.getAll("startTime");
1572
- }
1573
- get duration() {
1574
- let e = 0;
1575
- for (let n = 0; n < this.animations.length; n++)
1576
- e = Math.max(e, this.animations[n].duration);
1577
- return e;
1578
- }
1579
- runAll(e) {
1580
- this.animations.forEach((n) => n[e]());
1581
- }
1582
- play() {
1583
- this.runAll("play");
1584
- }
1585
- pause() {
1586
- this.runAll("pause");
1587
- }
1588
- cancel() {
1589
- this.runAll("cancel");
1590
- }
1591
- complete() {
1592
- this.runAll("complete");
1593
- }
1594
- }
1595
- function aa({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: l, elapsed: c, ...u }) {
1596
- return !!Object.keys(u).length;
1597
- }
1598
- const tn = (t, e, n, s = {}, i, r) => (o) => {
1599
- const a = Ne(s, t) || {}, l = a.delay || s.delay || 0;
1600
- let { elapsed: c = 0 } = s;
1601
- c = c - H(l);
1602
- let u = {
1603
- keyframes: Array.isArray(n) ? n : [null, n],
1604
- ease: "easeOut",
1605
- velocity: e.getVelocity(),
1606
- ...a,
1607
- delay: -c,
1608
- onUpdate: (d) => {
1609
- e.set(d), a.onUpdate && a.onUpdate(d);
1610
- },
1611
- onComplete: () => {
1612
- o(), a.onComplete && a.onComplete();
1613
- },
1614
- name: t,
1615
- motionValue: e,
1616
- element: r ? void 0 : i
1617
- };
1618
- aa(a) || (u = {
1619
- ...u,
1620
- ...wo(t, u)
1621
- }), u.duration && (u.duration = H(u.duration)), u.repeatDelay && (u.repeatDelay = H(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
1622
- let h = !1;
1623
- if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (u.duration = 0, u.delay === 0 && (h = !0)), h && !r && e.get() !== void 0) {
1624
- const d = Jt(u.keyframes, a);
1625
- if (d !== void 0)
1626
- return b.update(() => {
1627
- u.onUpdate(d), u.onComplete();
1628
- }), new ra([]);
1629
- }
1630
- return !r && zn.supports(u) ? new zn(u) : new Je(u);
1631
- }, la = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), ca = (t) => ve(t) ? t[t.length - 1] || 0 : t;
1632
- function en(t, e) {
1633
- t.indexOf(e) === -1 && t.push(e);
1634
- }
1635
- function nn(t, e) {
1636
- const n = t.indexOf(e);
1637
- n > -1 && t.splice(n, 1);
1638
- }
1639
- class sn {
1640
- constructor() {
1641
- this.subscriptions = [];
1642
- }
1643
- add(e) {
1644
- return en(this.subscriptions, e), () => nn(this.subscriptions, e);
1645
- }
1646
- notify(e, n, s) {
1647
- const i = this.subscriptions.length;
1648
- if (i)
1649
- if (i === 1)
1650
- this.subscriptions[0](e, n, s);
1651
- else
1652
- for (let r = 0; r < i; r++) {
1653
- const o = this.subscriptions[r];
1654
- o && o(e, n, s);
1655
- }
1656
- }
1657
- getSize() {
1658
- return this.subscriptions.length;
1659
- }
1660
- clear() {
1661
- this.subscriptions.length = 0;
1662
- }
1663
- }
1664
- const Nn = 30, ua = (t) => !isNaN(parseFloat(t));
1665
- class ha {
1666
- /**
1667
- * @param init - The initiating value
1668
- * @param config - Optional configuration options
1669
- *
1670
- * - `transformer`: A function to transform incoming values with.
1671
- *
1672
- * @internal
1673
- */
1674
- constructor(e, n = {}) {
1675
- this.version = "11.11.11", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
1676
- const r = K.now();
1677
- this.updatedAt !== r && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current);
1678
- }, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
1679
- }
1680
- setCurrent(e) {
1681
- this.current = e, this.updatedAt = K.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = ua(this.current));
1682
- }
1683
- setPrevFrameValue(e = this.current) {
1684
- this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
1685
- }
1686
- /**
1687
- * Adds a function that will be notified when the `MotionValue` is updated.
1688
- *
1689
- * It returns a function that, when called, will cancel the subscription.
1690
- *
1691
- * When calling `onChange` inside a React component, it should be wrapped with the
1692
- * `useEffect` hook. As it returns an unsubscribe function, this should be returned
1693
- * from the `useEffect` function to ensure you don't add duplicate subscribers..
1694
- *
1695
- * ```jsx
1696
- * export const MyComponent = () => {
1697
- * const x = useMotionValue(0)
1698
- * const y = useMotionValue(0)
1699
- * const opacity = useMotionValue(1)
1700
- *
1701
- * useEffect(() => {
1702
- * function updateOpacity() {
1703
- * const maxXY = Math.max(x.get(), y.get())
1704
- * const newOpacity = transform(maxXY, [0, 100], [1, 0])
1705
- * opacity.set(newOpacity)
1706
- * }
1707
- *
1708
- * const unsubscribeX = x.on("change", updateOpacity)
1709
- * const unsubscribeY = y.on("change", updateOpacity)
1710
- *
1711
- * return () => {
1712
- * unsubscribeX()
1713
- * unsubscribeY()
1714
- * }
1715
- * }, [])
1716
- *
1717
- * return <motion.div style={{ x }} />
1718
- * }
1719
- * ```
1720
- *
1721
- * @param subscriber - A function that receives the latest value.
1722
- * @returns A function that, when called, will cancel this subscription.
1723
- *
1724
- * @deprecated
1725
- */
1726
- onChange(e) {
1727
- return process.env.NODE_ENV !== "production" && Xt(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
1728
- }
1729
- on(e, n) {
1730
- this.events[e] || (this.events[e] = new sn());
1731
- const s = this.events[e].add(n);
1732
- return e === "change" ? () => {
1733
- s(), b.read(() => {
1734
- this.events.change.getSize() || this.stop();
1735
- });
1736
- } : s;
1737
- }
1738
- clearListeners() {
1739
- for (const e in this.events)
1740
- this.events[e].clear();
1741
- }
1742
- /**
1743
- * Attaches a passive effect to the `MotionValue`.
1744
- *
1745
- * @internal
1746
- */
1747
- attach(e, n) {
1748
- this.passiveEffect = e, this.stopPassiveEffect = n;
1749
- }
1750
- /**
1751
- * Sets the state of the `MotionValue`.
1752
- *
1753
- * @remarks
1754
- *
1755
- * ```jsx
1756
- * const x = useMotionValue(0)
1757
- * x.set(10)
1758
- * ```
1759
- *
1760
- * @param latest - Latest value to set.
1761
- * @param render - Whether to notify render subscribers. Defaults to `true`
1762
- *
1763
- * @public
1764
- */
1765
- set(e, n = !0) {
1766
- !n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify);
1767
- }
1768
- setWithVelocity(e, n, s) {
1769
- this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
1770
- }
1771
- /**
1772
- * Set the state of the `MotionValue`, stopping any active animations,
1773
- * effects, and resets velocity to `0`.
1774
- */
1775
- jump(e, n = !0) {
1776
- this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1777
- }
1778
- /**
1779
- * Returns the latest state of `MotionValue`
1780
- *
1781
- * @returns - The latest state of `MotionValue`
1782
- *
1783
- * @public
1784
- */
1785
- get() {
1786
- return this.current;
1787
- }
1788
- /**
1789
- * @public
1790
- */
1791
- getPrevious() {
1792
- return this.prev;
1793
- }
1794
- /**
1795
- * Returns the latest velocity of `MotionValue`
1796
- *
1797
- * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
1798
- *
1799
- * @public
1800
- */
1801
- getVelocity() {
1802
- const e = K.now();
1803
- if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > Nn)
1804
- return 0;
1805
- const n = Math.min(this.updatedAt - this.prevUpdatedAt, Nn);
1806
- return hi(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1807
- }
1808
- /**
1809
- * Registers a new animation to control this `MotionValue`. Only one
1810
- * animation can drive a `MotionValue` at one time.
1811
- *
1812
- * ```jsx
1813
- * value.start()
1814
- * ```
1815
- *
1816
- * @param animation - A function that starts the provided animation
1817
- *
1818
- * @internal
1819
- */
1820
- start(e) {
1821
- return this.stop(), new Promise((n) => {
1822
- this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
1823
- }).then(() => {
1824
- this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1825
- });
1826
- }
1827
- /**
1828
- * Stop the currently active animation.
1829
- *
1830
- * @public
1831
- */
1832
- stop() {
1833
- this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1834
- }
1835
- /**
1836
- * Returns `true` if this value is currently animating.
1837
- *
1838
- * @public
1839
- */
1840
- isAnimating() {
1841
- return !!this.animation;
1842
- }
1843
- clearAnimation() {
1844
- delete this.animation;
1845
- }
1846
- /**
1847
- * Destroy and clean up subscribers to this `MotionValue`.
1848
- *
1849
- * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
1850
- * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
1851
- * created a `MotionValue` via the `motionValue` function.
1852
- *
1853
- * @public
1854
- */
1855
- destroy() {
1856
- this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1857
- }
1858
- }
1859
- function Lt(t, e) {
1860
- return new ha(t, e);
1861
- }
1862
- function da(t, e, n) {
1863
- t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, Lt(n));
1864
- }
1865
- function fa(t, e) {
1866
- const n = Zt(t, e);
1867
- let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
1868
- r = { ...r, ...s };
1869
- for (const o in r) {
1870
- const a = ca(r[o]);
1871
- da(t, o, a);
1872
- }
1873
- }
1874
- const on = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), pa = "framerAppearId", Pi = "data-" + on(pa);
1875
- function xi(t) {
1876
- return t.props[Pi];
1877
- }
1878
- const I = (t) => !!(t && t.getVelocity);
1879
- function ma(t) {
1880
- return !!(I(t) && t.add);
1881
- }
1882
- function be(t, e) {
1883
- const n = t.getValue("willChange");
1884
- if (ma(n))
1885
- return n.add(e);
1886
- }
1887
- function ga({ protectedKeys: t, needsAnimating: e }, n) {
1888
- const s = t.hasOwnProperty(n) && e[n] !== !0;
1889
- return e[n] = !1, s;
1890
- }
1891
- function Si(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
1892
- var r;
1893
- let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...l } = e;
1894
- s && (o = s);
1895
- const c = [], u = i && t.animationState && t.animationState.getState()[i];
1896
- for (const h in l) {
1897
- const d = t.getValue(h, (r = t.latestValues[h]) !== null && r !== void 0 ? r : null), f = l[h];
1898
- if (f === void 0 || u && ga(u, h))
1899
- continue;
1900
- const p = {
1901
- delay: n,
1902
- ...Ne(o || {}, h)
1903
- };
1904
- let y = !1;
1905
- if (window.MotionHandoffAnimation) {
1906
- const g = xi(t);
1907
- if (g) {
1908
- const v = window.MotionHandoffAnimation(g, h, b);
1909
- v !== null && (p.startTime = v, y = !0);
1910
- }
1911
- }
1912
- be(t, h), d.start(tn(h, d, f, t.shouldReduceMotion && ct.has(h) ? { type: !1 } : p, t, y));
1913
- const T = d.animation;
1914
- T && c.push(T);
1915
- }
1916
- return a && Promise.all(c).then(() => {
1917
- b.update(() => {
1918
- a && fa(t, a);
1919
- });
1920
- }), c;
1921
- }
1922
- function Ce(t, e, n = {}) {
1923
- var s;
1924
- const i = Zt(t, e, n.type === "exit" ? (s = t.presenceContext) === null || s === void 0 ? void 0 : s.custom : void 0);
1925
- let { transition: r = t.getDefaultTransition() || {} } = i || {};
1926
- n.transitionOverride && (r = n.transitionOverride);
1927
- const o = i ? () => Promise.all(Si(t, i, n)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (c = 0) => {
1928
- const { delayChildren: u = 0, staggerChildren: h, staggerDirection: d } = r;
1929
- return ya(t, e, u + c, h, d, n);
1930
- } : () => Promise.resolve(), { when: l } = r;
1931
- if (l) {
1932
- const [c, u] = l === "beforeChildren" ? [o, a] : [a, o];
1933
- return c().then(() => u());
1934
- } else
1935
- return Promise.all([o(), a(n.delay)]);
1936
- }
1937
- function ya(t, e, n = 0, s = 0, i = 1, r) {
1938
- const o = [], a = (t.variantChildren.size - 1) * s, l = i === 1 ? (c = 0) => c * s : (c = 0) => a - c * s;
1939
- return Array.from(t.variantChildren).sort(va).forEach((c, u) => {
1940
- c.notify("AnimationStart", e), o.push(Ce(c, e, {
1941
- ...r,
1942
- delay: n + l(u)
1943
- }).then(() => c.notify("AnimationComplete", e)));
1944
- }), Promise.all(o);
1945
- }
1946
- function va(t, e) {
1947
- return t.sortNodePosition(e);
1948
- }
1949
- function Ta(t, e, n = {}) {
1950
- t.notify("AnimationStart", e);
1951
- let s;
1952
- if (Array.isArray(e)) {
1953
- const i = e.map((r) => Ce(t, r, n));
1954
- s = Promise.all(i);
1955
- } else if (typeof e == "string")
1956
- s = Ce(t, e, n);
1957
- else {
1958
- const i = typeof e == "function" ? Zt(t, e, n.custom) : e;
1959
- s = Promise.all(Si(t, i, n));
1960
- }
1961
- return s.then(() => {
1962
- t.notify("AnimationComplete", e);
1963
- });
1964
- }
1965
- const Pa = ze.length;
1966
- function Vi(t) {
1967
- if (!t)
1968
- return;
1969
- if (!t.isControllingVariants) {
1970
- const n = t.parent ? Vi(t.parent) || {} : {};
1971
- return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
1972
- }
1973
- const e = {};
1974
- for (let n = 0; n < Pa; n++) {
1975
- const s = ze[n], i = t.props[s];
1976
- (Mt(i) || i === !1) && (e[s] = i);
1977
- }
1978
- return e;
1979
- }
1980
- const xa = [...je].reverse(), Sa = je.length;
1981
- function Va(t) {
1982
- return (e) => Promise.all(e.map(({ animation: n, options: s }) => Ta(t, n, s)));
1983
- }
1984
- function Aa(t) {
1985
- let e = Va(t), n = Un(), s = !0;
1986
- const i = (l) => (c, u) => {
1987
- var h;
1988
- const d = Zt(t, u, l === "exit" ? (h = t.presenceContext) === null || h === void 0 ? void 0 : h.custom : void 0);
1989
- if (d) {
1990
- const { transition: f, transitionEnd: p, ...y } = d;
1991
- c = { ...c, ...y, ...p };
1992
- }
1993
- return c;
1994
- };
1995
- function r(l) {
1996
- e = l(t);
1997
- }
1998
- function o(l) {
1999
- const { props: c } = t, u = Vi(t.parent) || {}, h = [], d = /* @__PURE__ */ new Set();
2000
- let f = {}, p = 1 / 0;
2001
- for (let T = 0; T < Sa; T++) {
2002
- const g = xa[T], v = n[g], m = c[g] !== void 0 ? c[g] : u[g], S = Mt(m), A = g === l ? v.isActive : null;
2003
- A === !1 && (p = T);
2004
- let M = m === u[g] && m !== c[g] && S;
2005
- if (M && s && t.manuallyAnimateOnMount && (M = !1), v.protectedKeys = { ...f }, // If it isn't active and hasn't *just* been set as inactive
2006
- !v.isActive && A === null || // If we didn't and don't have any defined prop for this animation type
2007
- !m && !v.prevProp || // Or if the prop doesn't define an animation
2008
- qt(m) || typeof m == "boolean")
2009
- continue;
2010
- const B = wa(v.prevProp, m);
2011
- let w = B || // If we're making this variant active, we want to always make it active
2012
- g === l && v.isActive && !M && S || // If we removed a higher-priority variant (i is in reverse order)
2013
- T > p && S, j = !1;
2014
- const z = Array.isArray(m) ? m : [m];
2015
- let ut = z.reduce(i(g), {});
2016
- A === !1 && (ut = {});
2017
- const { prevResolvedValues: yn = {} } = v, uo = {
2018
- ...yn,
2019
- ...ut
2020
- }, vn = (k) => {
2021
- w = !0, d.has(k) && (j = !0, d.delete(k)), v.needsAnimating[k] = !0;
2022
- const W = t.getValue(k);
2023
- W && (W.liveStyle = !1);
2024
- };
2025
- for (const k in uo) {
2026
- const W = ut[k], se = yn[k];
2027
- if (f.hasOwnProperty(k))
2028
- continue;
2029
- let ie = !1;
2030
- ve(W) && ve(se) ? ie = !js(W, se) : ie = W !== se, ie ? W != null ? vn(k) : d.add(k) : W !== void 0 && d.has(k) ? vn(k) : v.protectedKeys[k] = !0;
2031
- }
2032
- v.prevProp = m, v.prevResolvedValues = ut, v.isActive && (f = { ...f, ...ut }), s && t.blockInitialAnimation && (w = !1), w && (!(M && B) || j) && h.push(...z.map((k) => ({
2033
- animation: k,
2034
- options: { type: g }
2035
- })));
2036
- }
2037
- if (d.size) {
2038
- const T = {};
2039
- d.forEach((g) => {
2040
- const v = t.getBaseTarget(g), m = t.getValue(g);
2041
- m && (m.liveStyle = !0), T[g] = v ?? null;
2042
- }), h.push({ animation: T });
2043
- }
2044
- let y = !!h.length;
2045
- return s && (c.initial === !1 || c.initial === c.animate) && !t.manuallyAnimateOnMount && (y = !1), s = !1, y ? e(h) : Promise.resolve();
2046
- }
2047
- function a(l, c) {
2048
- var u;
2049
- if (n[l].isActive === c)
2050
- return Promise.resolve();
2051
- (u = t.variantChildren) === null || u === void 0 || u.forEach((d) => {
2052
- var f;
2053
- return (f = d.animationState) === null || f === void 0 ? void 0 : f.setActive(l, c);
2054
- }), n[l].isActive = c;
2055
- const h = o(l);
2056
- for (const d in n)
2057
- n[d].protectedKeys = {};
2058
- return h;
2059
- }
2060
- return {
2061
- animateChanges: o,
2062
- setActive: a,
2063
- setAnimateFunction: r,
2064
- getState: () => n,
2065
- reset: () => {
2066
- n = Un(), s = !0;
2067
- }
2068
- };
2069
- }
2070
- function wa(t, e) {
2071
- return typeof e == "string" ? e !== t : Array.isArray(e) ? !js(e, t) : !1;
2072
- }
2073
- function st(t = !1) {
2074
- return {
2075
- isActive: t,
2076
- protectedKeys: {},
2077
- needsAnimating: {},
2078
- prevResolvedValues: {}
2079
- };
2080
- }
2081
- function Un() {
2082
- return {
2083
- animate: st(!0),
2084
- whileInView: st(),
2085
- whileHover: st(),
2086
- whileTap: st(),
2087
- whileDrag: st(),
2088
- whileFocus: st(),
2089
- exit: st()
2090
- };
2091
- }
2092
- class nt {
2093
- constructor(e) {
2094
- this.isMounted = !1, this.node = e;
2095
- }
2096
- update() {
2097
- }
2098
- }
2099
- class ba extends nt {
2100
- /**
2101
- * We dynamically generate the AnimationState manager as it contains a reference
2102
- * to the underlying animation library. We only want to load that if we load this,
2103
- * so people can optionally code split it out using the `m` component.
2104
- */
2105
- constructor(e) {
2106
- super(e), e.animationState || (e.animationState = Aa(e));
2107
- }
2108
- updateAnimationControlsSubscription() {
2109
- const { animate: e } = this.node.getProps();
2110
- qt(e) && (this.unmountControls = e.subscribe(this.node));
2111
- }
2112
- /**
2113
- * Subscribe any provided AnimationControls to the component's VisualElement
2114
- */
2115
- mount() {
2116
- this.updateAnimationControlsSubscription();
2117
- }
2118
- update() {
2119
- const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
2120
- e !== n && this.updateAnimationControlsSubscription();
2121
- }
2122
- unmount() {
2123
- var e;
2124
- this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this);
2125
- }
2126
- }
2127
- let Ca = 0;
2128
- class Ma extends nt {
2129
- constructor() {
2130
- super(...arguments), this.id = Ca++;
2131
- }
2132
- update() {
2133
- if (!this.node.presenceContext)
2134
- return;
2135
- const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
2136
- if (!this.node.animationState || e === s)
2137
- return;
2138
- const i = this.node.animationState.setActive("exit", !e);
2139
- n && !e && i.then(() => n(this.id));
2140
- }
2141
- mount() {
2142
- const { register: e } = this.node.presenceContext || {};
2143
- e && (this.unmount = e(this.id));
2144
- }
2145
- unmount() {
2146
- }
2147
- }
2148
- const Ra = {
2149
- animation: {
2150
- Feature: ba
2151
- },
2152
- exit: {
2153
- Feature: Ma
2154
- }
2155
- }, Ai = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1;
2156
- function Qt(t, e = "page") {
2157
- return {
2158
- point: {
2159
- x: t[`${e}X`],
2160
- y: t[`${e}Y`]
2161
- }
2162
- };
2163
- }
2164
- const Da = (t) => (e) => Ai(e) && t(e, Qt(e));
2165
- function $(t, e, n, s = { passive: !0 }) {
2166
- return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
2167
- }
2168
- function X(t, e, n, s) {
2169
- return $(t, e, Da(n), s);
2170
- }
2171
- const Hn = (t, e) => Math.abs(t - e);
2172
- function La(t, e) {
2173
- const n = Hn(t.x, e.x), s = Hn(t.y, e.y);
2174
- return Math.sqrt(n ** 2 + s ** 2);
2175
- }
2176
- class wi {
2177
- constructor(e, n, { transformPagePoint: s, contextWindow: i, dragSnapToOrigin: r = !1 } = {}) {
2178
- if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
2179
- if (!(this.lastMoveEvent && this.lastMoveEventInfo))
2180
- return;
2181
- const h = he(this.lastMoveEventInfo, this.history), d = this.startEvent !== null, f = La(h.offset, { x: 0, y: 0 }) >= 3;
2182
- if (!d && !f)
2183
- return;
2184
- const { point: p } = h, { timestamp: y } = D;
2185
- this.history.push({ ...p, timestamp: y });
2186
- const { onStart: T, onMove: g } = this.handlers;
2187
- d || (T && T(this.lastMoveEvent, h), this.startEvent = this.lastMoveEvent), g && g(this.lastMoveEvent, h);
2188
- }, this.handlePointerMove = (h, d) => {
2189
- this.lastMoveEvent = h, this.lastMoveEventInfo = ue(d, this.transformPagePoint), b.update(this.updatePoint, !0);
2190
- }, this.handlePointerUp = (h, d) => {
2191
- this.end();
2192
- const { onEnd: f, onSessionEnd: p, resumeAnimation: y } = this.handlers;
2193
- if (this.dragSnapToOrigin && y && y(), !(this.lastMoveEvent && this.lastMoveEventInfo))
2194
- return;
2195
- const T = he(h.type === "pointercancel" ? this.lastMoveEventInfo : ue(d, this.transformPagePoint), this.history);
2196
- this.startEvent && f && f(h, T), p && p(h, T);
2197
- }, !Ai(e))
2198
- return;
2199
- this.dragSnapToOrigin = r, this.handlers = n, this.transformPagePoint = s, this.contextWindow = i || window;
2200
- const o = Qt(e), a = ue(o, this.transformPagePoint), { point: l } = a, { timestamp: c } = D;
2201
- this.history = [{ ...l, timestamp: c }];
2202
- const { onSessionStart: u } = n;
2203
- u && u(e, he(a, this.history)), this.removeListeners = Y(X(this.contextWindow, "pointermove", this.handlePointerMove), X(this.contextWindow, "pointerup", this.handlePointerUp), X(this.contextWindow, "pointercancel", this.handlePointerUp));
2204
- }
2205
- updateHandlers(e) {
2206
- this.handlers = e;
2207
- }
2208
- end() {
2209
- this.removeListeners && this.removeListeners(), Q(this.updatePoint);
2210
- }
2211
- }
2212
- function ue(t, e) {
2213
- return e ? { point: e(t.point) } : t;
2214
- }
2215
- function _n(t, e) {
2216
- return { x: t.x - e.x, y: t.y - e.y };
2217
- }
2218
- function he({ point: t }, e) {
2219
- return {
2220
- point: t,
2221
- delta: _n(t, bi(e)),
2222
- offset: _n(t, Ea(e)),
2223
- velocity: Oa(e, 0.1)
2224
- };
2225
- }
2226
- function Ea(t) {
2227
- return t[0];
2228
- }
2229
- function bi(t) {
2230
- return t[t.length - 1];
2231
- }
2232
- function Oa(t, e) {
2233
- if (t.length < 2)
2234
- return { x: 0, y: 0 };
2235
- let n = t.length - 1, s = null;
2236
- const i = bi(t);
2237
- for (; n >= 0 && (s = t[n], !(i.timestamp - s.timestamp > H(e))); )
2238
- n--;
2239
- if (!s)
2240
- return { x: 0, y: 0 };
2241
- const r = G(i.timestamp - s.timestamp);
2242
- if (r === 0)
2243
- return { x: 0, y: 0 };
2244
- const o = {
2245
- x: (i.x - s.x) / r,
2246
- y: (i.y - s.y) / r
2247
- };
2248
- return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o;
2249
- }
2250
- function Ci(t) {
2251
- let e = null;
2252
- return () => {
2253
- const n = () => {
2254
- e = null;
2255
- };
2256
- return e === null ? (e = t, n) : !1;
2257
- };
2258
- }
2259
- const Kn = Ci("dragHorizontal"), Wn = Ci("dragVertical");
2260
- function Mi(t) {
2261
- let e = !1;
2262
- if (t === "y")
2263
- e = Wn();
2264
- else if (t === "x")
2265
- e = Kn();
2266
- else {
2267
- const n = Kn(), s = Wn();
2268
- n && s ? e = () => {
2269
- n(), s();
2270
- } : (n && n(), s && s());
2271
- }
2272
- return e;
2273
- }
2274
- function Ri() {
2275
- const t = Mi(!0);
2276
- return t ? (t(), !1) : !0;
2277
- }
2278
- function dt(t) {
2279
- return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
2280
- }
2281
- const Di = 1e-4, Ia = 1 - Di, ka = 1 + Di, Li = 0.01, Fa = 0 - Li, Ba = 0 + Li;
2282
- function F(t) {
2283
- return t.max - t.min;
2284
- }
2285
- function ja(t, e, n) {
2286
- return Math.abs(t - e) <= n;
2287
- }
2288
- function $n(t, e, n, s = 0.5) {
2289
- t.origin = s, t.originPoint = C(e.min, e.max, t.origin), t.scale = F(n) / F(e), t.translate = C(n.min, n.max, t.origin) - t.originPoint, (t.scale >= Ia && t.scale <= ka || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Fa && t.translate <= Ba || isNaN(t.translate)) && (t.translate = 0);
2290
- }
2291
- function bt(t, e, n, s) {
2292
- $n(t.x, e.x, n.x, s ? s.originX : void 0), $n(t.y, e.y, n.y, s ? s.originY : void 0);
2293
- }
2294
- function Gn(t, e, n) {
2295
- t.min = n.min + e.min, t.max = t.min + F(e);
2296
- }
2297
- function za(t, e, n) {
2298
- Gn(t.x, e.x, n.x), Gn(t.y, e.y, n.y);
2299
- }
2300
- function Yn(t, e, n) {
2301
- t.min = e.min - n.min, t.max = t.min + F(e);
2302
- }
2303
- function Ct(t, e, n) {
2304
- Yn(t.x, e.x, n.x), Yn(t.y, e.y, n.y);
2305
- }
2306
- function Na(t, { min: e, max: n }, s) {
2307
- return e !== void 0 && t < e ? t = s ? C(e, t, s.min) : Math.max(t, e) : n !== void 0 && t > n && (t = s ? C(n, t, s.max) : Math.min(t, n)), t;
2308
- }
2309
- function Xn(t, e, n) {
2310
- return {
2311
- min: e !== void 0 ? t.min + e : void 0,
2312
- max: n !== void 0 ? t.max + n - (t.max - t.min) : void 0
2313
- };
2314
- }
2315
- function Ua(t, { top: e, left: n, bottom: s, right: i }) {
2316
- return {
2317
- x: Xn(t.x, n, i),
2318
- y: Xn(t.y, e, s)
2319
- };
2320
- }
2321
- function qn(t, e) {
2322
- let n = e.min - t.min, s = e.max - t.max;
2323
- return e.max - e.min < t.max - t.min && ([n, s] = [s, n]), { min: n, max: s };
2324
- }
2325
- function Ha(t, e) {
2326
- return {
2327
- x: qn(t.x, e.x),
2328
- y: qn(t.y, e.y)
2329
- };
2330
- }
2331
- function _a(t, e) {
2332
- let n = 0.5;
2333
- const s = F(t), i = F(e);
2334
- return i > s ? n = yt(e.min, e.max - s, t.min) : s > i && (n = yt(t.min, t.max - i, e.min)), tt(0, 1, n);
2335
- }
2336
- function Ka(t, e) {
2337
- const n = {};
2338
- return e.min !== void 0 && (n.min = e.min - t.min), e.max !== void 0 && (n.max = e.max - t.min), n;
2339
- }
2340
- const Me = 0.35;
2341
- function Wa(t = Me) {
2342
- return t === !1 ? t = 0 : t === !0 && (t = Me), {
2343
- x: Zn(t, "left", "right"),
2344
- y: Zn(t, "top", "bottom")
2345
- };
2346
- }
2347
- function Zn(t, e, n) {
2348
- return {
2349
- min: Jn(t, e),
2350
- max: Jn(t, n)
2351
- };
2352
- }
2353
- function Jn(t, e) {
2354
- return typeof t == "number" ? t : t[e] || 0;
2355
- }
2356
- const Qn = () => ({
2357
- translate: 0,
2358
- scale: 1,
2359
- origin: 0,
2360
- originPoint: 0
2361
- }), ft = () => ({
2362
- x: Qn(),
2363
- y: Qn()
2364
- }), ts = () => ({ min: 0, max: 0 }), R = () => ({
2365
- x: ts(),
2366
- y: ts()
2367
- });
2368
- function U(t) {
2369
- return [t("x"), t("y")];
2370
- }
2371
- function Ei({ top: t, left: e, right: n, bottom: s }) {
2372
- return {
2373
- x: { min: e, max: n },
2374
- y: { min: t, max: s }
2375
- };
2376
- }
2377
- function $a({ x: t, y: e }) {
2378
- return { top: e.min, right: t.max, bottom: e.max, left: t.min };
2379
- }
2380
- function Ga(t, e) {
2381
- if (!e)
2382
- return t;
2383
- const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
2384
- return {
2385
- top: n.y,
2386
- left: n.x,
2387
- bottom: s.y,
2388
- right: s.x
2389
- };
2390
- }
2391
- function de(t) {
2392
- return t === void 0 || t === 1;
2393
- }
2394
- function Re({ scale: t, scaleX: e, scaleY: n }) {
2395
- return !de(t) || !de(e) || !de(n);
2396
- }
2397
- function it(t) {
2398
- return Re(t) || Oi(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY;
2399
- }
2400
- function Oi(t) {
2401
- return es(t.x) || es(t.y);
2402
- }
2403
- function es(t) {
2404
- return t && t !== "0%";
2405
- }
2406
- function $t(t, e, n) {
2407
- const s = t - n, i = e * s;
2408
- return n + i;
2409
- }
2410
- function ns(t, e, n, s, i) {
2411
- return i !== void 0 && (t = $t(t, i, s)), $t(t, n, s) + e;
2412
- }
2413
- function De(t, e = 0, n = 1, s, i) {
2414
- t.min = ns(t.min, e, n, s, i), t.max = ns(t.max, e, n, s, i);
2415
- }
2416
- function Ii(t, { x: e, y: n }) {
2417
- De(t.x, e.translate, e.scale, e.originPoint), De(t.y, n.translate, n.scale, n.originPoint);
2418
- }
2419
- const ss = 0.999999999999, is = 1.0000000000001;
2420
- function Ya(t, e, n, s = !1) {
2421
- const i = n.length;
2422
- if (!i)
2423
- return;
2424
- e.x = e.y = 1;
2425
- let r, o;
2426
- for (let a = 0; a < i; a++) {
2427
- r = n[a], o = r.projectionDelta;
2428
- const { visualElement: l } = r.options;
2429
- l && l.props.style && l.props.style.display === "contents" || (s && r.options.layoutScroll && r.scroll && r !== r.root && mt(t, {
2430
- x: -r.scroll.offset.x,
2431
- y: -r.scroll.offset.y
2432
- }), o && (e.x *= o.x.scale, e.y *= o.y.scale, Ii(t, o)), s && it(r.latestValues) && mt(t, r.latestValues));
2433
- }
2434
- e.x < is && e.x > ss && (e.x = 1), e.y < is && e.y > ss && (e.y = 1);
2435
- }
2436
- function pt(t, e) {
2437
- t.min = t.min + e, t.max = t.max + e;
2438
- }
2439
- function os(t, e, n, s, i = 0.5) {
2440
- const r = C(t.min, t.max, i);
2441
- De(t, e, n, r, s);
2442
- }
2443
- function mt(t, e) {
2444
- os(t.x, e.x, e.scaleX, e.scale, e.originX), os(t.y, e.y, e.scaleY, e.scale, e.originY);
2445
- }
2446
- function ki(t, e) {
2447
- return Ei(Ga(t.getBoundingClientRect(), e));
2448
- }
2449
- function Xa(t, e, n) {
2450
- const s = ki(t, n), { scroll: i } = e;
2451
- return i && (pt(s.x, i.offset.x), pt(s.y, i.offset.y)), s;
2452
- }
2453
- const Fi = ({ current: t }) => t ? t.ownerDocument.defaultView : null, qa = /* @__PURE__ */ new WeakMap();
2454
- class Za {
2455
- constructor(e) {
2456
- this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = R(), this.visualElement = e;
2457
- }
2458
- start(e, { snapToCursor: n = !1 } = {}) {
2459
- const { presenceContext: s } = this.visualElement;
2460
- if (s && s.isPresent === !1)
2461
- return;
2462
- const i = (u) => {
2463
- const { dragSnapToOrigin: h } = this.getProps();
2464
- h ? this.pauseAnimation() : this.stopAnimation(), n && this.snapToCursor(Qt(u, "page").point);
2465
- }, r = (u, h) => {
2466
- const { drag: d, dragPropagation: f, onDragStart: p } = this.getProps();
2467
- if (d && !f && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = Mi(d), !this.openGlobalLock))
2468
- return;
2469
- this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), U((T) => {
2470
- let g = this.getAxisMotionValue(T).get() || 0;
2471
- if (_.test(g)) {
2472
- const { projection: v } = this.visualElement;
2473
- if (v && v.layout) {
2474
- const m = v.layout.layoutBox[T];
2475
- m && (g = F(m) * (parseFloat(g) / 100));
2476
- }
2477
- }
2478
- this.originPoint[T] = g;
2479
- }), p && b.postRender(() => p(u, h)), be(this.visualElement, "transform");
2480
- const { animationState: y } = this.visualElement;
2481
- y && y.setActive("whileDrag", !0);
2482
- }, o = (u, h) => {
2483
- const { dragPropagation: d, dragDirectionLock: f, onDirectionLock: p, onDrag: y } = this.getProps();
2484
- if (!d && !this.openGlobalLock)
2485
- return;
2486
- const { offset: T } = h;
2487
- if (f && this.currentDirection === null) {
2488
- this.currentDirection = Ja(T), this.currentDirection !== null && p && p(this.currentDirection);
2489
- return;
2490
- }
2491
- this.updateAxis("x", h.point, T), this.updateAxis("y", h.point, T), this.visualElement.render(), y && y(u, h);
2492
- }, a = (u, h) => this.stop(u, h), l = () => U((u) => {
2493
- var h;
2494
- return this.getAnimationState(u) === "paused" && ((h = this.getAxisMotionValue(u).animation) === null || h === void 0 ? void 0 : h.play());
2495
- }), { dragSnapToOrigin: c } = this.getProps();
2496
- this.panSession = new wi(e, {
2497
- onSessionStart: i,
2498
- onStart: r,
2499
- onMove: o,
2500
- onSessionEnd: a,
2501
- resumeAnimation: l
2502
- }, {
2503
- transformPagePoint: this.visualElement.getTransformPagePoint(),
2504
- dragSnapToOrigin: c,
2505
- contextWindow: Fi(this.visualElement)
2506
- });
2507
- }
2508
- stop(e, n) {
2509
- const s = this.isDragging;
2510
- if (this.cancel(), !s)
2511
- return;
2512
- const { velocity: i } = n;
2513
- this.startAnimation(i);
2514
- const { onDragEnd: r } = this.getProps();
2515
- r && b.postRender(() => r(e, n));
2516
- }
2517
- cancel() {
2518
- this.isDragging = !1;
2519
- const { projection: e, animationState: n } = this.visualElement;
2520
- e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
2521
- const { dragPropagation: s } = this.getProps();
2522
- !s && this.openGlobalLock && (this.openGlobalLock(), this.openGlobalLock = null), n && n.setActive("whileDrag", !1);
2523
- }
2524
- updateAxis(e, n, s) {
2525
- const { drag: i } = this.getProps();
2526
- if (!s || !Bt(e, i, this.currentDirection))
2527
- return;
2528
- const r = this.getAxisMotionValue(e);
2529
- let o = this.originPoint[e] + s[e];
2530
- this.constraints && this.constraints[e] && (o = Na(o, this.constraints[e], this.elastic[e])), r.set(o);
2531
- }
2532
- resolveConstraints() {
2533
- var e;
2534
- const { dragConstraints: n, dragElastic: s } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, r = this.constraints;
2535
- n && dt(n) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : n && i ? this.constraints = Ua(i.layoutBox, n) : this.constraints = !1, this.elastic = Wa(s), r !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && U((o) => {
2536
- this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = Ka(i.layoutBox[o], this.constraints[o]));
2537
- });
2538
- }
2539
- resolveRefConstraints() {
2540
- const { dragConstraints: e, onMeasureDragConstraints: n } = this.getProps();
2541
- if (!e || !dt(e))
2542
- return !1;
2543
- const s = e.current;
2544
- q(s !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
2545
- const { projection: i } = this.visualElement;
2546
- if (!i || !i.layout)
2547
- return !1;
2548
- const r = Xa(s, i.root, this.visualElement.getTransformPagePoint());
2549
- let o = Ha(i.layout.layoutBox, r);
2550
- if (n) {
2551
- const a = n($a(o));
2552
- this.hasMutatedConstraints = !!a, a && (o = Ei(a));
2553
- }
2554
- return o;
2555
- }
2556
- startAnimation(e) {
2557
- const { drag: n, dragMomentum: s, dragElastic: i, dragTransition: r, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), l = this.constraints || {}, c = U((u) => {
2558
- if (!Bt(u, n, this.currentDirection))
2559
- return;
2560
- let h = l && l[u] || {};
2561
- o && (h = { min: 0, max: 0 });
2562
- const d = i ? 200 : 1e6, f = i ? 40 : 1e7, p = {
2563
- type: "inertia",
2564
- velocity: s ? e[u] : 0,
2565
- bounceStiffness: d,
2566
- bounceDamping: f,
2567
- timeConstant: 750,
2568
- restDelta: 1,
2569
- restSpeed: 10,
2570
- ...r,
2571
- ...h
2572
- };
2573
- return this.startAxisValueAnimation(u, p);
2574
- });
2575
- return Promise.all(c).then(a);
2576
- }
2577
- startAxisValueAnimation(e, n) {
2578
- const s = this.getAxisMotionValue(e);
2579
- return be(this.visualElement, e), s.start(tn(e, s, 0, n, this.visualElement, !1));
2580
- }
2581
- stopAnimation() {
2582
- U((e) => this.getAxisMotionValue(e).stop());
2583
- }
2584
- pauseAnimation() {
2585
- U((e) => {
2586
- var n;
2587
- return (n = this.getAxisMotionValue(e).animation) === null || n === void 0 ? void 0 : n.pause();
2588
- });
2589
- }
2590
- getAnimationState(e) {
2591
- var n;
2592
- return (n = this.getAxisMotionValue(e).animation) === null || n === void 0 ? void 0 : n.state;
2593
- }
2594
- /**
2595
- * Drag works differently depending on which props are provided.
2596
- *
2597
- * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
2598
- * - Otherwise, we apply the delta to the x/y motion values.
2599
- */
2600
- getAxisMotionValue(e) {
2601
- const n = `_drag${e.toUpperCase()}`, s = this.visualElement.getProps(), i = s[n];
2602
- return i || this.visualElement.getValue(e, (s.initial ? s.initial[e] : void 0) || 0);
2603
- }
2604
- snapToCursor(e) {
2605
- U((n) => {
2606
- const { drag: s } = this.getProps();
2607
- if (!Bt(n, s, this.currentDirection))
2608
- return;
2609
- const { projection: i } = this.visualElement, r = this.getAxisMotionValue(n);
2610
- if (i && i.layout) {
2611
- const { min: o, max: a } = i.layout.layoutBox[n];
2612
- r.set(e[n] - C(o, a, 0.5));
2613
- }
2614
- });
2615
- }
2616
- /**
2617
- * When the viewport resizes we want to check if the measured constraints
2618
- * have changed and, if so, reposition the element within those new constraints
2619
- * relative to where it was before the resize.
2620
- */
2621
- scalePositionWithinConstraints() {
2622
- if (!this.visualElement.current)
2623
- return;
2624
- const { drag: e, dragConstraints: n } = this.getProps(), { projection: s } = this.visualElement;
2625
- if (!dt(n) || !s || !this.constraints)
2626
- return;
2627
- this.stopAnimation();
2628
- const i = { x: 0, y: 0 };
2629
- U((o) => {
2630
- const a = this.getAxisMotionValue(o);
2631
- if (a && this.constraints !== !1) {
2632
- const l = a.get();
2633
- i[o] = _a({ min: l, max: l }, this.constraints[o]);
2634
- }
2635
- });
2636
- const { transformTemplate: r } = this.visualElement.getProps();
2637
- this.visualElement.current.style.transform = r ? r({}, "") : "none", s.root && s.root.updateScroll(), s.updateLayout(), this.resolveConstraints(), U((o) => {
2638
- if (!Bt(o, e, null))
2639
- return;
2640
- const a = this.getAxisMotionValue(o), { min: l, max: c } = this.constraints[o];
2641
- a.set(C(l, c, i[o]));
2642
- });
2643
- }
2644
- addListeners() {
2645
- if (!this.visualElement.current)
2646
- return;
2647
- qa.set(this.visualElement, this);
2648
- const e = this.visualElement.current, n = X(e, "pointerdown", (l) => {
2649
- const { drag: c, dragListener: u = !0 } = this.getProps();
2650
- c && u && this.start(l);
2651
- }), s = () => {
2652
- const { dragConstraints: l } = this.getProps();
2653
- dt(l) && l.current && (this.constraints = this.resolveRefConstraints());
2654
- }, { projection: i } = this.visualElement, r = i.addEventListener("measure", s);
2655
- i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), b.read(s);
2656
- const o = $(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: l, hasLayoutChanged: c }) => {
2657
- this.isDragging && c && (U((u) => {
2658
- const h = this.getAxisMotionValue(u);
2659
- h && (this.originPoint[u] += l[u].translate, h.set(h.get() + l[u].translate));
2660
- }), this.visualElement.render());
2661
- });
2662
- return () => {
2663
- o(), n(), r(), a && a();
2664
- };
2665
- }
2666
- getProps() {
2667
- const e = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: s = !1, dragPropagation: i = !1, dragConstraints: r = !1, dragElastic: o = Me, dragMomentum: a = !0 } = e;
2668
- return {
2669
- ...e,
2670
- drag: n,
2671
- dragDirectionLock: s,
2672
- dragPropagation: i,
2673
- dragConstraints: r,
2674
- dragElastic: o,
2675
- dragMomentum: a
2676
- };
2677
- }
2678
- }
2679
- function Bt(t, e, n) {
2680
- return (e === !0 || e === t) && (n === null || n === t);
2681
- }
2682
- function Ja(t, e = 10) {
2683
- let n = null;
2684
- return Math.abs(t.y) > e ? n = "y" : Math.abs(t.x) > e && (n = "x"), n;
2685
- }
2686
- class Qa extends nt {
2687
- constructor(e) {
2688
- super(e), this.removeGroupControls = L, this.removeListeners = L, this.controls = new Za(e);
2689
- }
2690
- mount() {
2691
- const { dragControls: e } = this.node.getProps();
2692
- e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || L;
2693
- }
2694
- unmount() {
2695
- this.removeGroupControls(), this.removeListeners();
2696
- }
2697
- }
2698
- const rs = (t) => (e, n) => {
2699
- t && b.postRender(() => t(e, n));
2700
- };
2701
- class tl extends nt {
2702
- constructor() {
2703
- super(...arguments), this.removePointerDownListener = L;
2704
- }
2705
- onPointerDown(e) {
2706
- this.session = new wi(e, this.createPanHandlers(), {
2707
- transformPagePoint: this.node.getTransformPagePoint(),
2708
- contextWindow: Fi(this.node)
2709
- });
2710
- }
2711
- createPanHandlers() {
2712
- const { onPanSessionStart: e, onPanStart: n, onPan: s, onPanEnd: i } = this.node.getProps();
2713
- return {
2714
- onSessionStart: rs(e),
2715
- onStart: rs(n),
2716
- onMove: s,
2717
- onEnd: (r, o) => {
2718
- delete this.session, i && b.postRender(() => i(r, o));
2719
- }
2720
- };
2721
- }
2722
- mount() {
2723
- this.removePointerDownListener = X(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
2724
- }
2725
- update() {
2726
- this.session && this.session.updateHandlers(this.createPanHandlers());
2727
- }
2728
- unmount() {
2729
- this.removePointerDownListener(), this.session && this.session.end();
2730
- }
2731
- }
2732
- const te = Tt(null);
2733
- function el() {
2734
- const t = O(te);
2735
- if (t === null)
2736
- return [!0, null];
2737
- const { isPresent: e, onExitComplete: n, register: s } = t, i = Ie();
2738
- ke(() => s(i), []);
2739
- const r = Fe(() => n && n(i), [i, n]);
2740
- return !e && n ? [!1, r] : [!0];
2741
- }
2742
- const rn = Tt({}), Bi = Tt({}), Nt = {
2743
- /**
2744
- * Global flag as to whether the tree has animated since the last time
2745
- * we resized the window
2746
- */
2747
- hasAnimatedSinceResize: !0,
2748
- /**
2749
- * We set this to true once, on the first update. Any nodes added to the tree beyond that
2750
- * update will be given a `data-projection-id` attribute.
2751
- */
2752
- hasEverUpdated: !1
2753
- };
2754
- function as(t, e) {
2755
- return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
2756
- }
2757
- const St = {
2758
- correct: (t, e) => {
2759
- if (!e.target)
2760
- return t;
2761
- if (typeof t == "string")
2762
- if (P.test(t))
2763
- t = parseFloat(t);
2764
- else
2765
- return t;
2766
- const n = as(t, e.target.x), s = as(t, e.target.y);
2767
- return `${n}% ${s}%`;
2768
- }
2769
- }, nl = {
2770
- correct: (t, { treeScale: e, projectionDelta: n }) => {
2771
- const s = t, i = et.parse(t);
2772
- if (i.length > 5)
2773
- return s;
2774
- const r = et.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = n.x.scale * e.x, l = n.y.scale * e.y;
2775
- i[0 + o] /= a, i[1 + o] /= l;
2776
- const c = C(a, l, 0.5);
2777
- return typeof i[2 + o] == "number" && (i[2 + o] /= c), typeof i[3 + o] == "number" && (i[3 + o] /= c), r(i);
2778
- }
2779
- }, Gt = {};
2780
- function sl(t) {
2781
- Object.assign(Gt, t);
2782
- }
2783
- const { schedule: an, cancel: Iu } = zs(queueMicrotask, !1);
2784
- class il extends po {
2785
- /**
2786
- * This only mounts projection nodes for components that
2787
- * need measuring, we might want to do it for all components
2788
- * in order to incorporate transforms
2789
- */
2790
- componentDidMount() {
2791
- const { visualElement: e, layoutGroup: n, switchLayoutGroup: s, layoutId: i } = this.props, { projection: r } = e;
2792
- sl(ol), r && (n.group && n.group.add(r), s && s.register && i && s.register(r), r.root.didUpdate(), r.addEventListener("animationComplete", () => {
2793
- this.safeToRemove();
2794
- }), r.setOptions({
2795
- ...r.options,
2796
- onExitComplete: () => this.safeToRemove()
2797
- })), Nt.hasEverUpdated = !0;
2798
- }
2799
- getSnapshotBeforeUpdate(e) {
2800
- const { layoutDependency: n, visualElement: s, drag: i, isPresent: r } = this.props, o = s.projection;
2801
- return o && (o.isPresent = r, i || e.layoutDependency !== n || n === void 0 ? o.willUpdate() : this.safeToRemove(), e.isPresent !== r && (r ? o.promote() : o.relegate() || b.postRender(() => {
2802
- const a = o.getStack();
2803
- (!a || !a.members.length) && this.safeToRemove();
2804
- }))), null;
2805
- }
2806
- componentDidUpdate() {
2807
- const { projection: e } = this.props.visualElement;
2808
- e && (e.root.didUpdate(), an.postRender(() => {
2809
- !e.currentAnimation && e.isLead() && this.safeToRemove();
2810
- }));
2811
- }
2812
- componentWillUnmount() {
2813
- const { visualElement: e, layoutGroup: n, switchLayoutGroup: s } = this.props, { projection: i } = e;
2814
- i && (i.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(i), s && s.deregister && s.deregister(i));
2815
- }
2816
- safeToRemove() {
2817
- const { safeToRemove: e } = this.props;
2818
- e && e();
2819
- }
2820
- render() {
2821
- return null;
2822
- }
2823
- }
2824
- function ji(t) {
2825
- const [e, n] = el(), s = O(rn);
2826
- return x(il, { ...t, layoutGroup: s, switchLayoutGroup: O(Bi), isPresent: e, safeToRemove: n });
2827
- }
2828
- const ol = {
2829
- borderRadius: {
2830
- ...St,
2831
- applyTo: [
2832
- "borderTopLeftRadius",
2833
- "borderTopRightRadius",
2834
- "borderBottomLeftRadius",
2835
- "borderBottomRightRadius"
2836
- ]
2837
- },
2838
- borderTopLeftRadius: St,
2839
- borderTopRightRadius: St,
2840
- borderBottomLeftRadius: St,
2841
- borderBottomRightRadius: St,
2842
- boxShadow: nl
2843
- }, zi = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], rl = zi.length, ls = (t) => typeof t == "string" ? parseFloat(t) : t, cs = (t) => typeof t == "number" || P.test(t);
2844
- function al(t, e, n, s, i, r) {
2845
- i ? (t.opacity = C(
2846
- 0,
2847
- // TODO Reinstate this if only child
2848
- n.opacity !== void 0 ? n.opacity : 1,
2849
- ll(s)
2850
- ), t.opacityExit = C(e.opacity !== void 0 ? e.opacity : 1, 0, cl(s))) : r && (t.opacity = C(e.opacity !== void 0 ? e.opacity : 1, n.opacity !== void 0 ? n.opacity : 1, s));
2851
- for (let o = 0; o < rl; o++) {
2852
- const a = `border${zi[o]}Radius`;
2853
- let l = us(e, a), c = us(n, a);
2854
- if (l === void 0 && c === void 0)
2855
- continue;
2856
- l || (l = 0), c || (c = 0), l === 0 || c === 0 || cs(l) === cs(c) ? (t[a] = Math.max(C(ls(l), ls(c), s), 0), (_.test(c) || _.test(l)) && (t[a] += "%")) : t[a] = c;
2857
- }
2858
- (e.rotate || n.rotate) && (t.rotate = C(e.rotate || 0, n.rotate || 0, s));
2859
- }
2860
- function us(t, e) {
2861
- return t[e] !== void 0 ? t[e] : t.borderRadius;
2862
- }
2863
- const ll = /* @__PURE__ */ Ni(0, 0.5, $s), cl = /* @__PURE__ */ Ni(0.5, 0.95, L);
2864
- function Ni(t, e, n) {
2865
- return (s) => s < t ? 0 : s > e ? 1 : n(yt(t, e, s));
2866
- }
2867
- function hs(t, e) {
2868
- t.min = e.min, t.max = e.max;
2869
- }
2870
- function N(t, e) {
2871
- hs(t.x, e.x), hs(t.y, e.y);
2872
- }
2873
- function ds(t, e) {
2874
- t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
2875
- }
2876
- function fs(t, e, n, s, i) {
2877
- return t -= e, t = $t(t, 1 / n, s), i !== void 0 && (t = $t(t, 1 / i, s)), t;
2878
- }
2879
- function ul(t, e = 0, n = 1, s = 0.5, i, r = t, o = t) {
2880
- if (_.test(e) && (e = parseFloat(e), e = C(o.min, o.max, e / 100) - o.min), typeof e != "number")
2881
- return;
2882
- let a = C(r.min, r.max, s);
2883
- t === r && (a -= e), t.min = fs(t.min, e, n, a, i), t.max = fs(t.max, e, n, a, i);
2884
- }
2885
- function ps(t, e, [n, s, i], r, o) {
2886
- ul(t, e[n], e[s], e[i], e.scale, r, o);
2887
- }
2888
- const hl = ["x", "scaleX", "originX"], dl = ["y", "scaleY", "originY"];
2889
- function ms(t, e, n, s) {
2890
- ps(t.x, e, hl, n ? n.x : void 0, s ? s.x : void 0), ps(t.y, e, dl, n ? n.y : void 0, s ? s.y : void 0);
2891
- }
2892
- function gs(t) {
2893
- return t.translate === 0 && t.scale === 1;
2894
- }
2895
- function Ui(t) {
2896
- return gs(t.x) && gs(t.y);
2897
- }
2898
- function ys(t, e) {
2899
- return t.min === e.min && t.max === e.max;
2900
- }
2901
- function fl(t, e) {
2902
- return ys(t.x, e.x) && ys(t.y, e.y);
2903
- }
2904
- function vs(t, e) {
2905
- return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
2906
- }
2907
- function Hi(t, e) {
2908
- return vs(t.x, e.x) && vs(t.y, e.y);
2909
- }
2910
- function Ts(t) {
2911
- return F(t.x) / F(t.y);
2912
- }
2913
- function Ps(t, e) {
2914
- return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
2915
- }
2916
- class pl {
2917
- constructor() {
2918
- this.members = [];
2919
- }
2920
- add(e) {
2921
- en(this.members, e), e.scheduleRender();
2922
- }
2923
- remove(e) {
2924
- if (nn(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
2925
- const n = this.members[this.members.length - 1];
2926
- n && this.promote(n);
2927
- }
2928
- }
2929
- relegate(e) {
2930
- const n = this.members.findIndex((i) => e === i);
2931
- if (n === 0)
2932
- return !1;
2933
- let s;
2934
- for (let i = n; i >= 0; i--) {
2935
- const r = this.members[i];
2936
- if (r.isPresent !== !1) {
2937
- s = r;
2938
- break;
2939
- }
2940
- }
2941
- return s ? (this.promote(s), !0) : !1;
2942
- }
2943
- promote(e, n) {
2944
- const s = this.lead;
2945
- if (e !== s && (this.prevLead = s, this.lead = e, e.show(), s)) {
2946
- s.instance && s.scheduleRender(), e.scheduleRender(), e.resumeFrom = s, n && (e.resumeFrom.preserveOpacity = !0), s.snapshot && (e.snapshot = s.snapshot, e.snapshot.latestValues = s.animationValues || s.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
2947
- const { crossfade: i } = e.options;
2948
- i === !1 && s.hide();
2949
- }
2950
- }
2951
- exitAnimationComplete() {
2952
- this.members.forEach((e) => {
2953
- const { options: n, resumingFrom: s } = e;
2954
- n.onExitComplete && n.onExitComplete(), s && s.options.onExitComplete && s.options.onExitComplete();
2955
- });
2956
- }
2957
- scheduleRender() {
2958
- this.members.forEach((e) => {
2959
- e.instance && e.scheduleRender(!1);
2960
- });
2961
- }
2962
- /**
2963
- * Clear any leads that have been removed this render to prevent them from being
2964
- * used in future animations and to prevent memory leaks
2965
- */
2966
- removeLeadSnapshot() {
2967
- this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
2968
- }
2969
- }
2970
- function ml(t, e, n) {
2971
- let s = "";
2972
- const i = t.x.translate / e.x, r = t.y.translate / e.y, o = (n == null ? void 0 : n.z) || 0;
2973
- if ((i || r || o) && (s = `translate3d(${i}px, ${r}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (s += `scale(${1 / e.x}, ${1 / e.y}) `), n) {
2974
- const { transformPerspective: c, rotate: u, rotateX: h, rotateY: d, skewX: f, skewY: p } = n;
2975
- c && (s = `perspective(${c}px) ${s}`), u && (s += `rotate(${u}deg) `), h && (s += `rotateX(${h}deg) `), d && (s += `rotateY(${d}deg) `), f && (s += `skewX(${f}deg) `), p && (s += `skewY(${p}deg) `);
2976
- }
2977
- const a = t.x.scale * e.x, l = t.y.scale * e.y;
2978
- return (a !== 1 || l !== 1) && (s += `scale(${a}, ${l})`), s || "none";
2979
- }
2980
- const gl = (t, e) => t.depth - e.depth;
2981
- class yl {
2982
- constructor() {
2983
- this.children = [], this.isDirty = !1;
2984
- }
2985
- add(e) {
2986
- en(this.children, e), this.isDirty = !0;
2987
- }
2988
- remove(e) {
2989
- nn(this.children, e), this.isDirty = !0;
2990
- }
2991
- forEach(e) {
2992
- this.isDirty && this.children.sort(gl), this.isDirty = !1, this.children.forEach(e);
2993
- }
2994
- }
2995
- function Ut(t) {
2996
- const e = I(t) ? t.get() : t;
2997
- return la(e) ? e.toValue() : e;
2998
- }
2999
- function vl(t, e) {
3000
- const n = K.now(), s = ({ timestamp: i }) => {
3001
- const r = i - n;
3002
- r >= e && (Q(s), t(r - e));
3003
- };
3004
- return b.read(s, !0), () => Q(s);
3005
- }
3006
- function Tl(t) {
3007
- return t instanceof SVGElement && t.tagName !== "svg";
3008
- }
3009
- function Pl(t, e, n) {
3010
- const s = I(t) ? t : Lt(t);
3011
- return s.start(tn("", s, e, n)), s.animation;
3012
- }
3013
- const ot = {
3014
- type: "projectionFrame",
3015
- totalNodes: 0,
3016
- resolvedTargetDeltas: 0,
3017
- recalculatedProjection: 0
3018
- }, At = typeof window < "u" && window.MotionDebug !== void 0, fe = ["", "X", "Y", "Z"], xl = { visibility: "hidden" }, xs = 1e3;
3019
- let Sl = 0;
3020
- function pe(t, e, n, s) {
3021
- const { latestValues: i } = e;
3022
- i[t] && (n[t] = i[t], e.setStaticValue(t, 0), s && (s[t] = 0));
3023
- }
3024
- function _i(t) {
3025
- if (t.hasCheckedOptimisedAppear = !0, t.root === t)
3026
- return;
3027
- const { visualElement: e } = t.options;
3028
- if (!e)
3029
- return;
3030
- const n = xi(e);
3031
- if (window.MotionHasOptimisedAnimation(n, "transform")) {
3032
- const { layout: i, layoutId: r } = t.options;
3033
- window.MotionCancelOptimisedAnimation(n, "transform", b, !(i || r));
3034
- }
3035
- const { parent: s } = t;
3036
- s && !s.hasCheckedOptimisedAppear && _i(s);
3037
- }
3038
- function Ki({ attachResizeListener: t, defaultParent: e, measureScroll: n, checkIsScrollRoot: s, resetTransform: i }) {
3039
- return class {
3040
- constructor(o = {}, a = e == null ? void 0 : e()) {
3041
- this.id = Sl++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
3042
- this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
3043
- }, this.updateProjection = () => {
3044
- this.projectionUpdateScheduled = !1, At && (ot.totalNodes = ot.resolvedTargetDeltas = ot.recalculatedProjection = 0), this.nodes.forEach(wl), this.nodes.forEach(Dl), this.nodes.forEach(Ll), this.nodes.forEach(bl), At && window.MotionDebug.record(ot);
3045
- }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0;
3046
- for (let l = 0; l < this.path.length; l++)
3047
- this.path[l].shouldResetTransform = !0;
3048
- this.root === this && (this.nodes = new yl());
3049
- }
3050
- addEventListener(o, a) {
3051
- return this.eventHandlers.has(o) || this.eventHandlers.set(o, new sn()), this.eventHandlers.get(o).add(a);
3052
- }
3053
- notifyListeners(o, ...a) {
3054
- const l = this.eventHandlers.get(o);
3055
- l && l.notify(...a);
3056
- }
3057
- hasListeners(o) {
3058
- return this.eventHandlers.has(o);
3059
- }
3060
- /**
3061
- * Lifecycles
3062
- */
3063
- mount(o, a = this.root.hasTreeAnimated) {
3064
- if (this.instance)
3065
- return;
3066
- this.isSVG = Tl(o), this.instance = o;
3067
- const { layoutId: l, layout: c, visualElement: u } = this.options;
3068
- if (u && !u.current && u.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (c || l) && (this.isLayoutDirty = !0), t) {
3069
- let h;
3070
- const d = () => this.root.updateBlockedByResize = !1;
3071
- t(o, () => {
3072
- this.root.updateBlockedByResize = !0, h && h(), h = vl(d, 250), Nt.hasAnimatedSinceResize && (Nt.hasAnimatedSinceResize = !1, this.nodes.forEach(Vs));
3073
- });
3074
- }
3075
- l && this.root.registerSharedNode(l, this), this.options.animate !== !1 && u && (l || c) && this.addEventListener("didUpdate", ({ delta: h, hasLayoutChanged: d, hasRelativeTargetChanged: f, layout: p }) => {
3076
- if (this.isTreeAnimationBlocked()) {
3077
- this.target = void 0, this.relativeTarget = void 0;
3078
- return;
3079
- }
3080
- const y = this.options.transition || u.getDefaultTransition() || Fl, { onLayoutAnimationStart: T, onLayoutAnimationComplete: g } = u.getProps(), v = !this.targetLayout || !Hi(this.targetLayout, p) || f, m = !d && f;
3081
- if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || m || d && (v || !this.currentAnimation)) {
3082
- this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(h, m);
3083
- const S = {
3084
- ...Ne(y, "layout"),
3085
- onPlay: T,
3086
- onComplete: g
3087
- };
3088
- (u.shouldReduceMotion || this.options.layoutRoot) && (S.delay = 0, S.type = !1), this.startAnimation(S);
3089
- } else
3090
- d || Vs(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
3091
- this.targetLayout = p;
3092
- });
3093
- }
3094
- unmount() {
3095
- this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
3096
- const o = this.getStack();
3097
- o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, Q(this.updateProjection);
3098
- }
3099
- // only on the root
3100
- blockUpdate() {
3101
- this.updateManuallyBlocked = !0;
3102
- }
3103
- unblockUpdate() {
3104
- this.updateManuallyBlocked = !1;
3105
- }
3106
- isUpdateBlocked() {
3107
- return this.updateManuallyBlocked || this.updateBlockedByResize;
3108
- }
3109
- isTreeAnimationBlocked() {
3110
- return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
3111
- }
3112
- // Note: currently only running on root node
3113
- startUpdate() {
3114
- this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(El), this.animationId++);
3115
- }
3116
- getTransformTemplate() {
3117
- const { visualElement: o } = this.options;
3118
- return o && o.getProps().transformTemplate;
3119
- }
3120
- willUpdate(o = !0) {
3121
- if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
3122
- this.options.onExitComplete && this.options.onExitComplete();
3123
- return;
3124
- }
3125
- if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && _i(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
3126
- return;
3127
- this.isLayoutDirty = !0;
3128
- for (let u = 0; u < this.path.length; u++) {
3129
- const h = this.path[u];
3130
- h.shouldResetTransform = !0, h.updateScroll("snapshot"), h.options.layoutRoot && h.willUpdate(!1);
3131
- }
3132
- const { layoutId: a, layout: l } = this.options;
3133
- if (a === void 0 && !l)
3134
- return;
3135
- const c = this.getTransformTemplate();
3136
- this.prevTransformTemplateValue = c ? c(this.latestValues, "") : void 0, this.updateSnapshot(), o && this.notifyListeners("willUpdate");
3137
- }
3138
- update() {
3139
- if (this.updateScheduled = !1, this.isUpdateBlocked()) {
3140
- this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Ss);
3141
- return;
3142
- }
3143
- this.isUpdating || this.nodes.forEach(Ml), this.isUpdating = !1, this.nodes.forEach(Rl), this.nodes.forEach(Vl), this.nodes.forEach(Al), this.clearAllSnapshots();
3144
- const a = K.now();
3145
- D.delta = tt(0, 1e3 / 60, a - D.timestamp), D.timestamp = a, D.isProcessing = !0, oe.update.process(D), oe.preRender.process(D), oe.render.process(D), D.isProcessing = !1;
3146
- }
3147
- didUpdate() {
3148
- this.updateScheduled || (this.updateScheduled = !0, an.read(this.scheduleUpdate));
3149
- }
3150
- clearAllSnapshots() {
3151
- this.nodes.forEach(Cl), this.sharedNodes.forEach(Ol);
3152
- }
3153
- scheduleUpdateProjection() {
3154
- this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, b.preRender(this.updateProjection, !1, !0));
3155
- }
3156
- scheduleCheckAfterUnmount() {
3157
- b.postRender(() => {
3158
- this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
3159
- });
3160
- }
3161
- /**
3162
- * Update measurements
3163
- */
3164
- updateSnapshot() {
3165
- this.snapshot || !this.instance || (this.snapshot = this.measure());
3166
- }
3167
- updateLayout() {
3168
- if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
3169
- return;
3170
- if (this.resumeFrom && !this.resumeFrom.instance)
3171
- for (let l = 0; l < this.path.length; l++)
3172
- this.path[l].updateScroll();
3173
- const o = this.layout;
3174
- this.layout = this.measure(!1), this.layoutCorrected = R(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
3175
- const { visualElement: a } = this.options;
3176
- a && a.notify("LayoutMeasure", this.layout.layoutBox, o ? o.layoutBox : void 0);
3177
- }
3178
- updateScroll(o = "measure") {
3179
- let a = !!(this.options.layoutScroll && this.instance);
3180
- if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === o && (a = !1), a) {
3181
- const l = s(this.instance);
3182
- this.scroll = {
3183
- animationId: this.root.animationId,
3184
- phase: o,
3185
- isRoot: l,
3186
- offset: n(this.instance),
3187
- wasRoot: this.scroll ? this.scroll.isRoot : l
3188
- };
3189
- }
3190
- }
3191
- resetTransform() {
3192
- if (!i)
3193
- return;
3194
- const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !Ui(this.projectionDelta), l = this.getTransformTemplate(), c = l ? l(this.latestValues, "") : void 0, u = c !== this.prevTransformTemplateValue;
3195
- o && (a || it(this.latestValues) || u) && (i(this.instance, c), this.shouldResetTransform = !1, this.scheduleRender());
3196
- }
3197
- measure(o = !0) {
3198
- const a = this.measurePageBox();
3199
- let l = this.removeElementScroll(a);
3200
- return o && (l = this.removeTransform(l)), Bl(l), {
3201
- animationId: this.root.animationId,
3202
- measuredBox: a,
3203
- layoutBox: l,
3204
- latestValues: {},
3205
- source: this.id
3206
- };
3207
- }
3208
- measurePageBox() {
3209
- var o;
3210
- const { visualElement: a } = this.options;
3211
- if (!a)
3212
- return R();
3213
- const l = a.measureViewportBox();
3214
- if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(jl))) {
3215
- const { scroll: u } = this.root;
3216
- u && (pt(l.x, u.offset.x), pt(l.y, u.offset.y));
3217
- }
3218
- return l;
3219
- }
3220
- removeElementScroll(o) {
3221
- var a;
3222
- const l = R();
3223
- if (N(l, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot)
3224
- return l;
3225
- for (let c = 0; c < this.path.length; c++) {
3226
- const u = this.path[c], { scroll: h, options: d } = u;
3227
- u !== this.root && h && d.layoutScroll && (h.wasRoot && N(l, o), pt(l.x, h.offset.x), pt(l.y, h.offset.y));
3228
- }
3229
- return l;
3230
- }
3231
- applyTransform(o, a = !1) {
3232
- const l = R();
3233
- N(l, o);
3234
- for (let c = 0; c < this.path.length; c++) {
3235
- const u = this.path[c];
3236
- !a && u.options.layoutScroll && u.scroll && u !== u.root && mt(l, {
3237
- x: -u.scroll.offset.x,
3238
- y: -u.scroll.offset.y
3239
- }), it(u.latestValues) && mt(l, u.latestValues);
3240
- }
3241
- return it(this.latestValues) && mt(l, this.latestValues), l;
3242
- }
3243
- removeTransform(o) {
3244
- const a = R();
3245
- N(a, o);
3246
- for (let l = 0; l < this.path.length; l++) {
3247
- const c = this.path[l];
3248
- if (!c.instance || !it(c.latestValues))
3249
- continue;
3250
- Re(c.latestValues) && c.updateSnapshot();
3251
- const u = R(), h = c.measurePageBox();
3252
- N(u, h), ms(a, c.latestValues, c.snapshot ? c.snapshot.layoutBox : void 0, u);
3253
- }
3254
- return it(this.latestValues) && ms(a, this.latestValues), a;
3255
- }
3256
- setTargetDelta(o) {
3257
- this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
3258
- }
3259
- setOptions(o) {
3260
- this.options = {
3261
- ...this.options,
3262
- ...o,
3263
- crossfade: o.crossfade !== void 0 ? o.crossfade : !0
3264
- };
3265
- }
3266
- clearMeasurements() {
3267
- this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
3268
- }
3269
- forceRelativeParentToResolveTarget() {
3270
- this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== D.timestamp && this.relativeParent.resolveTargetDelta(!0);
3271
- }
3272
- resolveTargetDelta(o = !1) {
3273
- var a;
3274
- const l = this.getLead();
3275
- this.isProjectionDirty || (this.isProjectionDirty = l.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = l.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = l.isSharedProjectionDirty);
3276
- const c = !!this.resumingFrom || this !== l;
3277
- if (!(o || c && this.isSharedProjectionDirty || this.isProjectionDirty || !((a = this.parent) === null || a === void 0) && a.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
3278
- return;
3279
- const { layout: h, layoutId: d } = this.options;
3280
- if (!(!this.layout || !(h || d))) {
3281
- if (this.resolvedRelativeTargetAt = D.timestamp, !this.targetDelta && !this.relativeTarget) {
3282
- const f = this.getClosestProjectingParent();
3283
- f && f.layout && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = R(), this.relativeTargetOrigin = R(), Ct(this.relativeTargetOrigin, this.layout.layoutBox, f.layout.layoutBox), N(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
3284
- }
3285
- if (!(!this.relativeTarget && !this.targetDelta)) {
3286
- if (this.target || (this.target = R(), this.targetWithTransforms = R()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), za(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : N(this.target, this.layout.layoutBox), Ii(this.target, this.targetDelta)) : N(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) {
3287
- this.attemptToResolveRelativeTarget = !1;
3288
- const f = this.getClosestProjectingParent();
3289
- f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = R(), this.relativeTargetOrigin = R(), Ct(this.relativeTargetOrigin, this.target, f.target), N(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
3290
- }
3291
- At && ot.resolvedTargetDeltas++;
3292
- }
3293
- }
3294
- }
3295
- getClosestProjectingParent() {
3296
- if (!(!this.parent || Re(this.parent.latestValues) || Oi(this.parent.latestValues)))
3297
- return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
3298
- }
3299
- isProjecting() {
3300
- return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
3301
- }
3302
- calcProjection() {
3303
- var o;
3304
- const a = this.getLead(), l = !!this.resumingFrom || this !== a;
3305
- let c = !0;
3306
- if ((this.isProjectionDirty || !((o = this.parent) === null || o === void 0) && o.isProjectionDirty) && (c = !1), l && (this.isSharedProjectionDirty || this.isTransformDirty) && (c = !1), this.resolvedRelativeTargetAt === D.timestamp && (c = !1), c)
3307
- return;
3308
- const { layout: u, layoutId: h } = this.options;
3309
- if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(u || h))
3310
- return;
3311
- N(this.layoutCorrected, this.layout.layoutBox);
3312
- const d = this.treeScale.x, f = this.treeScale.y;
3313
- Ya(this.layoutCorrected, this.treeScale, this.path, l), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = R());
3314
- const { target: p } = a;
3315
- if (!p) {
3316
- this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
3317
- return;
3318
- }
3319
- !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (ds(this.prevProjectionDelta.x, this.projectionDelta.x), ds(this.prevProjectionDelta.y, this.projectionDelta.y)), bt(this.projectionDelta, this.layoutCorrected, p, this.latestValues), (this.treeScale.x !== d || this.treeScale.y !== f || !Ps(this.projectionDelta.x, this.prevProjectionDelta.x) || !Ps(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", p)), At && ot.recalculatedProjection++;
3320
- }
3321
- hide() {
3322
- this.isVisible = !1;
3323
- }
3324
- show() {
3325
- this.isVisible = !0;
3326
- }
3327
- scheduleRender(o = !0) {
3328
- var a;
3329
- if ((a = this.options.visualElement) === null || a === void 0 || a.scheduleRender(), o) {
3330
- const l = this.getStack();
3331
- l && l.scheduleRender();
3332
- }
3333
- this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
3334
- }
3335
- createProjectionDeltas() {
3336
- this.prevProjectionDelta = ft(), this.projectionDelta = ft(), this.projectionDeltaWithTransform = ft();
3337
- }
3338
- setAnimationOrigin(o, a = !1) {
3339
- const l = this.snapshot, c = l ? l.latestValues : {}, u = { ...this.latestValues }, h = ft();
3340
- (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
3341
- const d = R(), f = l ? l.source : void 0, p = this.layout ? this.layout.source : void 0, y = f !== p, T = this.getStack(), g = !T || T.members.length <= 1, v = !!(y && !g && this.options.crossfade === !0 && !this.path.some(kl));
3342
- this.animationProgress = 0;
3343
- let m;
3344
- this.mixTargetDelta = (S) => {
3345
- const A = S / 1e3;
3346
- As(h.x, o.x, A), As(h.y, o.y, A), this.setTargetDelta(h), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Ct(d, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Il(this.relativeTarget, this.relativeTargetOrigin, d, A), m && fl(this.relativeTarget, m) && (this.isProjectionDirty = !1), m || (m = R()), N(m, this.relativeTarget)), y && (this.animationValues = u, al(u, c, this.latestValues, A, v, g)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = A;
3347
- }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
3348
- }
3349
- startAnimation(o) {
3350
- this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Q(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = b.update(() => {
3351
- Nt.hasAnimatedSinceResize = !0, this.currentAnimation = Pl(0, xs, {
3352
- ...o,
3353
- onUpdate: (a) => {
3354
- this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a);
3355
- },
3356
- onComplete: () => {
3357
- o.onComplete && o.onComplete(), this.completeAnimation();
3358
- }
3359
- }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
3360
- });
3361
- }
3362
- completeAnimation() {
3363
- this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
3364
- const o = this.getStack();
3365
- o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
3366
- }
3367
- finishAnimation() {
3368
- this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(xs), this.currentAnimation.stop()), this.completeAnimation();
3369
- }
3370
- applyTransformsToTarget() {
3371
- const o = this.getLead();
3372
- let { targetWithTransforms: a, target: l, layout: c, latestValues: u } = o;
3373
- if (!(!a || !l || !c)) {
3374
- if (this !== o && this.layout && c && Wi(this.options.animationType, this.layout.layoutBox, c.layoutBox)) {
3375
- l = this.target || R();
3376
- const h = F(this.layout.layoutBox.x);
3377
- l.x.min = o.target.x.min, l.x.max = l.x.min + h;
3378
- const d = F(this.layout.layoutBox.y);
3379
- l.y.min = o.target.y.min, l.y.max = l.y.min + d;
3380
- }
3381
- N(a, l), mt(a, u), bt(this.projectionDeltaWithTransform, this.layoutCorrected, a, u);
3382
- }
3383
- }
3384
- registerSharedNode(o, a) {
3385
- this.sharedNodes.has(o) || this.sharedNodes.set(o, new pl()), this.sharedNodes.get(o).add(a);
3386
- const c = a.options.initialPromotionConfig;
3387
- a.promote({
3388
- transition: c ? c.transition : void 0,
3389
- preserveFollowOpacity: c && c.shouldPreserveFollowOpacity ? c.shouldPreserveFollowOpacity(a) : void 0
3390
- });
3391
- }
3392
- isLead() {
3393
- const o = this.getStack();
3394
- return o ? o.lead === this : !0;
3395
- }
3396
- getLead() {
3397
- var o;
3398
- const { layoutId: a } = this.options;
3399
- return a ? ((o = this.getStack()) === null || o === void 0 ? void 0 : o.lead) || this : this;
3400
- }
3401
- getPrevLead() {
3402
- var o;
3403
- const { layoutId: a } = this.options;
3404
- return a ? (o = this.getStack()) === null || o === void 0 ? void 0 : o.prevLead : void 0;
3405
- }
3406
- getStack() {
3407
- const { layoutId: o } = this.options;
3408
- if (o)
3409
- return this.root.sharedNodes.get(o);
3410
- }
3411
- promote({ needsReset: o, transition: a, preserveFollowOpacity: l } = {}) {
3412
- const c = this.getStack();
3413
- c && c.promote(this, l), o && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a });
3414
- }
3415
- relegate() {
3416
- const o = this.getStack();
3417
- return o ? o.relegate(this) : !1;
3418
- }
3419
- resetSkewAndRotation() {
3420
- const { visualElement: o } = this.options;
3421
- if (!o)
3422
- return;
3423
- let a = !1;
3424
- const { latestValues: l } = o;
3425
- if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (a = !0), !a)
3426
- return;
3427
- const c = {};
3428
- l.z && pe("z", o, c, this.animationValues);
3429
- for (let u = 0; u < fe.length; u++)
3430
- pe(`rotate${fe[u]}`, o, c, this.animationValues), pe(`skew${fe[u]}`, o, c, this.animationValues);
3431
- o.render();
3432
- for (const u in c)
3433
- o.setStaticValue(u, c[u]), this.animationValues && (this.animationValues[u] = c[u]);
3434
- o.scheduleRender();
3435
- }
3436
- getProjectionStyles(o) {
3437
- var a, l;
3438
- if (!this.instance || this.isSVG)
3439
- return;
3440
- if (!this.isVisible)
3441
- return xl;
3442
- const c = {
3443
- visibility: ""
3444
- }, u = this.getTransformTemplate();
3445
- if (this.needsReset)
3446
- return this.needsReset = !1, c.opacity = "", c.pointerEvents = Ut(o == null ? void 0 : o.pointerEvents) || "", c.transform = u ? u(this.latestValues, "") : "none", c;
3447
- const h = this.getLead();
3448
- if (!this.projectionDelta || !this.layout || !h.target) {
3449
- const y = {};
3450
- return this.options.layoutId && (y.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, y.pointerEvents = Ut(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !it(this.latestValues) && (y.transform = u ? u({}, "") : "none", this.hasProjected = !1), y;
3451
- }
3452
- const d = h.animationValues || h.latestValues;
3453
- this.applyTransformsToTarget(), c.transform = ml(this.projectionDeltaWithTransform, this.treeScale, d), u && (c.transform = u(d, c.transform));
3454
- const { x: f, y: p } = this.projectionDelta;
3455
- c.transformOrigin = `${f.origin * 100}% ${p.origin * 100}% 0`, h.animationValues ? c.opacity = h === this ? (l = (a = d.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && l !== void 0 ? l : 1 : this.preserveOpacity ? this.latestValues.opacity : d.opacityExit : c.opacity = h === this ? d.opacity !== void 0 ? d.opacity : "" : d.opacityExit !== void 0 ? d.opacityExit : 0;
3456
- for (const y in Gt) {
3457
- if (d[y] === void 0)
3458
- continue;
3459
- const { correct: T, applyTo: g } = Gt[y], v = c.transform === "none" ? d[y] : T(d[y], h);
3460
- if (g) {
3461
- const m = g.length;
3462
- for (let S = 0; S < m; S++)
3463
- c[g[S]] = v;
3464
- } else
3465
- c[y] = v;
3466
- }
3467
- return this.options.layoutId && (c.pointerEvents = h === this ? Ut(o == null ? void 0 : o.pointerEvents) || "" : "none"), c;
3468
- }
3469
- clearSnapshot() {
3470
- this.resumeFrom = this.snapshot = void 0;
3471
- }
3472
- // Only run on root
3473
- resetTree() {
3474
- this.root.nodes.forEach((o) => {
3475
- var a;
3476
- return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop();
3477
- }), this.root.nodes.forEach(Ss), this.root.sharedNodes.clear();
3478
- }
3479
- };
3480
- }
3481
- function Vl(t) {
3482
- t.updateLayout();
3483
- }
3484
- function Al(t) {
3485
- var e;
3486
- const n = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot;
3487
- if (t.isLead() && t.layout && n && t.hasListeners("didUpdate")) {
3488
- const { layoutBox: s, measuredBox: i } = t.layout, { animationType: r } = t.options, o = n.source !== t.layout.source;
3489
- r === "size" ? U((h) => {
3490
- const d = o ? n.measuredBox[h] : n.layoutBox[h], f = F(d);
3491
- d.min = s[h].min, d.max = d.min + f;
3492
- }) : Wi(r, n.layoutBox, s) && U((h) => {
3493
- const d = o ? n.measuredBox[h] : n.layoutBox[h], f = F(s[h]);
3494
- d.max = d.min + f, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[h].max = t.relativeTarget[h].min + f);
3495
- });
3496
- const a = ft();
3497
- bt(a, s, n.layoutBox);
3498
- const l = ft();
3499
- o ? bt(l, t.applyTransform(i, !0), n.measuredBox) : bt(l, s, n.layoutBox);
3500
- const c = !Ui(a);
3501
- let u = !1;
3502
- if (!t.resumeFrom) {
3503
- const h = t.getClosestProjectingParent();
3504
- if (h && !h.resumeFrom) {
3505
- const { snapshot: d, layout: f } = h;
3506
- if (d && f) {
3507
- const p = R();
3508
- Ct(p, n.layoutBox, d.layoutBox);
3509
- const y = R();
3510
- Ct(y, s, f.layoutBox), Hi(p, y) || (u = !0), h.options.layoutRoot && (t.relativeTarget = y, t.relativeTargetOrigin = p, t.relativeParent = h);
3511
- }
3512
- }
3513
- }
3514
- t.notifyListeners("didUpdate", {
3515
- layout: s,
3516
- snapshot: n,
3517
- delta: l,
3518
- layoutDelta: a,
3519
- hasLayoutChanged: c,
3520
- hasRelativeTargetChanged: u
3521
- });
3522
- } else if (t.isLead()) {
3523
- const { onExitComplete: s } = t.options;
3524
- s && s();
3525
- }
3526
- t.options.transition = void 0;
3527
- }
3528
- function wl(t) {
3529
- At && ot.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
3530
- }
3531
- function bl(t) {
3532
- t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
3533
- }
3534
- function Cl(t) {
3535
- t.clearSnapshot();
3536
- }
3537
- function Ss(t) {
3538
- t.clearMeasurements();
3539
- }
3540
- function Ml(t) {
3541
- t.isLayoutDirty = !1;
3542
- }
3543
- function Rl(t) {
3544
- const { visualElement: e } = t.options;
3545
- e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
3546
- }
3547
- function Vs(t) {
3548
- t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
3549
- }
3550
- function Dl(t) {
3551
- t.resolveTargetDelta();
3552
- }
3553
- function Ll(t) {
3554
- t.calcProjection();
3555
- }
3556
- function El(t) {
3557
- t.resetSkewAndRotation();
3558
- }
3559
- function Ol(t) {
3560
- t.removeLeadSnapshot();
3561
- }
3562
- function As(t, e, n) {
3563
- t.translate = C(e.translate, 0, n), t.scale = C(e.scale, 1, n), t.origin = e.origin, t.originPoint = e.originPoint;
3564
- }
3565
- function ws(t, e, n, s) {
3566
- t.min = C(e.min, n.min, s), t.max = C(e.max, n.max, s);
3567
- }
3568
- function Il(t, e, n, s) {
3569
- ws(t.x, e.x, n.x, s), ws(t.y, e.y, n.y, s);
3570
- }
3571
- function kl(t) {
3572
- return t.animationValues && t.animationValues.opacityExit !== void 0;
3573
- }
3574
- const Fl = {
3575
- duration: 0.45,
3576
- ease: [0.4, 0, 0.1, 1]
3577
- }, bs = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Cs = bs("applewebkit/") && !bs("chrome/") ? Math.round : L;
3578
- function Ms(t) {
3579
- t.min = Cs(t.min), t.max = Cs(t.max);
3580
- }
3581
- function Bl(t) {
3582
- Ms(t.x), Ms(t.y);
3583
- }
3584
- function Wi(t, e, n) {
3585
- return t === "position" || t === "preserve-aspect" && !ja(Ts(e), Ts(n), 0.2);
3586
- }
3587
- function jl(t) {
3588
- var e;
3589
- return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot);
3590
- }
3591
- const zl = Ki({
3592
- attachResizeListener: (t, e) => $(t, "resize", e),
3593
- measureScroll: () => ({
3594
- x: document.documentElement.scrollLeft || document.body.scrollLeft,
3595
- y: document.documentElement.scrollTop || document.body.scrollTop
3596
- }),
3597
- checkIsScrollRoot: () => !0
3598
- }), me = {
3599
- current: void 0
3600
- }, $i = Ki({
3601
- measureScroll: (t) => ({
3602
- x: t.scrollLeft,
3603
- y: t.scrollTop
3604
- }),
3605
- defaultParent: () => {
3606
- if (!me.current) {
3607
- const t = new zl({});
3608
- t.mount(window), t.setOptions({ layoutScroll: !0 }), me.current = t;
3609
- }
3610
- return me.current;
3611
- },
3612
- resetTransform: (t, e) => {
3613
- t.style.transform = e !== void 0 ? e : "none";
3614
- },
3615
- checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
3616
- }), Nl = {
3617
- pan: {
3618
- Feature: tl
3619
- },
3620
- drag: {
3621
- Feature: Qa,
3622
- ProjectionNode: $i,
3623
- MeasureLayout: ji
3624
- }
3625
- };
3626
- function Rs(t, e) {
3627
- const n = e ? "pointerenter" : "pointerleave", s = e ? "onHoverStart" : "onHoverEnd", i = (r, o) => {
3628
- if (r.pointerType === "touch" || Ri())
3629
- return;
3630
- const a = t.getProps();
3631
- t.animationState && a.whileHover && t.animationState.setActive("whileHover", e);
3632
- const l = a[s];
3633
- l && b.postRender(() => l(r, o));
3634
- };
3635
- return X(t.current, n, i, {
3636
- passive: !t.getProps()[s]
3637
- });
3638
- }
3639
- class Ul extends nt {
3640
- mount() {
3641
- this.unmount = Y(Rs(this.node, !0), Rs(this.node, !1));
3642
- }
3643
- unmount() {
3644
- }
3645
- }
3646
- class Hl extends nt {
3647
- constructor() {
3648
- super(...arguments), this.isActive = !1;
3649
- }
3650
- onFocus() {
3651
- let e = !1;
3652
- try {
3653
- e = this.node.current.matches(":focus-visible");
3654
- } catch {
3655
- e = !0;
3656
- }
3657
- !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
3658
- }
3659
- onBlur() {
3660
- !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
3661
- }
3662
- mount() {
3663
- this.unmount = Y($(this.node.current, "focus", () => this.onFocus()), $(this.node.current, "blur", () => this.onBlur()));
3664
- }
3665
- unmount() {
3666
- }
3667
- }
3668
- const Gi = (t, e) => e ? t === e ? !0 : Gi(t, e.parentElement) : !1;
3669
- function ge(t, e) {
3670
- if (!e)
3671
- return;
3672
- const n = new PointerEvent("pointer" + t);
3673
- e(n, Qt(n));
3674
- }
3675
- class _l extends nt {
3676
- constructor() {
3677
- super(...arguments), this.removeStartListeners = L, this.removeEndListeners = L, this.removeAccessibleListeners = L, this.startPointerPress = (e, n) => {
3678
- if (this.isPressing)
3679
- return;
3680
- this.removeEndListeners();
3681
- const s = this.node.getProps(), r = X(window, "pointerup", (a, l) => {
3682
- if (!this.checkPressEnd())
3683
- return;
3684
- const { onTap: c, onTapCancel: u, globalTapTarget: h } = this.node.getProps(), d = !h && !Gi(this.node.current, a.target) ? u : c;
3685
- d && b.update(() => d(a, l));
3686
- }, {
3687
- passive: !(s.onTap || s.onPointerUp)
3688
- }), o = X(window, "pointercancel", (a, l) => this.cancelPress(a, l), {
3689
- passive: !(s.onTapCancel || s.onPointerCancel)
3690
- });
3691
- this.removeEndListeners = Y(r, o), this.startPress(e, n);
3692
- }, this.startAccessiblePress = () => {
3693
- const e = (r) => {
3694
- if (r.key !== "Enter" || this.isPressing)
3695
- return;
3696
- const o = (a) => {
3697
- a.key !== "Enter" || !this.checkPressEnd() || ge("up", (l, c) => {
3698
- const { onTap: u } = this.node.getProps();
3699
- u && b.postRender(() => u(l, c));
3700
- });
3701
- };
3702
- this.removeEndListeners(), this.removeEndListeners = $(this.node.current, "keyup", o), ge("down", (a, l) => {
3703
- this.startPress(a, l);
3704
- });
3705
- }, n = $(this.node.current, "keydown", e), s = () => {
3706
- this.isPressing && ge("cancel", (r, o) => this.cancelPress(r, o));
3707
- }, i = $(this.node.current, "blur", s);
3708
- this.removeAccessibleListeners = Y(n, i);
3709
- };
3710
- }
3711
- startPress(e, n) {
3712
- this.isPressing = !0;
3713
- const { onTapStart: s, whileTap: i } = this.node.getProps();
3714
- i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), s && b.postRender(() => s(e, n));
3715
- }
3716
- checkPressEnd() {
3717
- return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !Ri();
3718
- }
3719
- cancelPress(e, n) {
3720
- if (!this.checkPressEnd())
3721
- return;
3722
- const { onTapCancel: s } = this.node.getProps();
3723
- s && b.postRender(() => s(e, n));
3724
- }
3725
- mount() {
3726
- const e = this.node.getProps(), n = X(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, {
3727
- passive: !(e.onTapStart || e.onPointerStart)
3728
- }), s = $(this.node.current, "focus", this.startAccessiblePress);
3729
- this.removeStartListeners = Y(n, s);
3730
- }
3731
- unmount() {
3732
- this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners();
3733
- }
3734
- }
3735
- const Le = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Kl = (t) => {
3736
- const e = Le.get(t.target);
3737
- e && e(t);
3738
- }, Wl = (t) => {
3739
- t.forEach(Kl);
3740
- };
3741
- function $l({ root: t, ...e }) {
3742
- const n = t || document;
3743
- ye.has(n) || ye.set(n, {});
3744
- const s = ye.get(n), i = JSON.stringify(e);
3745
- return s[i] || (s[i] = new IntersectionObserver(Wl, { root: t, ...e })), s[i];
3746
- }
3747
- function Gl(t, e, n) {
3748
- const s = $l(e);
3749
- return Le.set(t, n), s.observe(t), () => {
3750
- Le.delete(t), s.unobserve(t);
3751
- };
3752
- }
3753
- const Yl = {
3754
- some: 0,
3755
- all: 1
3756
- };
3757
- class Xl extends nt {
3758
- constructor() {
3759
- super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
3760
- }
3761
- startObserver() {
3762
- this.unmount();
3763
- const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, o = {
3764
- root: n ? n.current : void 0,
3765
- rootMargin: s,
3766
- threshold: typeof i == "number" ? i : Yl[i]
3767
- }, a = (l) => {
3768
- const { isIntersecting: c } = l;
3769
- if (this.isInView === c || (this.isInView = c, r && !c && this.hasEnteredView))
3770
- return;
3771
- c && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", c);
3772
- const { onViewportEnter: u, onViewportLeave: h } = this.node.getProps(), d = c ? u : h;
3773
- d && d(l);
3774
- };
3775
- return Gl(this.node.current, o, a);
3776
- }
3777
- mount() {
3778
- this.startObserver();
3779
- }
3780
- update() {
3781
- if (typeof IntersectionObserver > "u")
3782
- return;
3783
- const { props: e, prevProps: n } = this.node;
3784
- ["amount", "margin", "root"].some(ql(e, n)) && this.startObserver();
3785
- }
3786
- unmount() {
3787
- }
3788
- }
3789
- function ql({ viewport: t = {} }, { viewport: e = {} } = {}) {
3790
- return (n) => t[n] !== e[n];
3791
- }
3792
- const Zl = {
3793
- inView: {
3794
- Feature: Xl
3795
- },
3796
- tap: {
3797
- Feature: _l
3798
- },
3799
- focus: {
3800
- Feature: Hl
3801
- },
3802
- hover: {
3803
- Feature: Ul
3804
- }
3805
- }, Jl = {
3806
- layout: {
3807
- ProjectionNode: $i,
3808
- MeasureLayout: ji
3809
- }
3810
- }, ln = Tt({
3811
- transformPagePoint: (t) => t,
3812
- isStatic: !1,
3813
- reducedMotion: "never"
3814
- }), ee = Tt({}), cn = typeof window < "u", Yi = cn ? mo : ke, Xi = Tt({ strict: !1 });
3815
- function Ql(t, e, n, s, i) {
3816
- var r, o;
3817
- const { visualElement: a } = O(ee), l = O(Xi), c = O(te), u = O(ln).reducedMotion, h = J();
3818
- s = s || l.renderer, !h.current && s && (h.current = s(t, {
3819
- visualState: e,
3820
- parent: a,
3821
- props: n,
3822
- presenceContext: c,
3823
- blockInitialAnimation: c ? c.initial === !1 : !1,
3824
- reducedMotionConfig: u
3825
- }));
3826
- const d = h.current, f = O(Bi);
3827
- d && !d.projection && i && (d.type === "html" || d.type === "svg") && tc(h.current, n, i, f);
3828
- const p = J(!1);
3829
- Fs(() => {
3830
- d && p.current && d.update(n, c);
3831
- });
3832
- const y = n[Pi], T = J(!!y && !(!((r = window.MotionHandoffIsComplete) === null || r === void 0) && r.call(window, y)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, y)));
3833
- return Yi(() => {
3834
- d && (p.current = !0, window.MotionIsMounted = !0, d.updateFeatures(), an.render(d.render), T.current && d.animationState && d.animationState.animateChanges());
3835
- }), ke(() => {
3836
- d && (!T.current && d.animationState && d.animationState.animateChanges(), T.current && (queueMicrotask(() => {
3837
- var g;
3838
- (g = window.MotionHandoffMarkAsComplete) === null || g === void 0 || g.call(window, y);
3839
- }), T.current = !1));
3840
- }), d;
3841
- }
3842
- function tc(t, e, n, s) {
3843
- const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: l, layoutRoot: c } = e;
3844
- t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : qi(t.parent)), t.projection.setOptions({
3845
- layoutId: i,
3846
- layout: r,
3847
- alwaysMeasureLayout: !!o || a && dt(a),
3848
- visualElement: t,
3849
- /**
3850
- * TODO: Update options in an effect. This could be tricky as it'll be too late
3851
- * to update by the time layout animations run.
3852
- * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
3853
- * ensuring it gets called if there's no potential layout animations.
3854
- *
3855
- */
3856
- animationType: typeof r == "string" ? r : "both",
3857
- initialPromotionConfig: s,
3858
- layoutScroll: l,
3859
- layoutRoot: c
3860
- });
3861
- }
3862
- function qi(t) {
3863
- if (t)
3864
- return t.options.allowProjection !== !1 ? t.projection : qi(t.parent);
3865
- }
3866
- function ec(t, e, n) {
3867
- return Fe(
3868
- (s) => {
3869
- s && t.mount && t.mount(s), e && (s ? e.mount(s) : e.unmount()), n && (typeof n == "function" ? n(s) : dt(n) && (n.current = s));
3870
- },
3871
- /**
3872
- * Only pass a new ref callback to React if we've received a visual element
3873
- * factory. Otherwise we'll be mounting/remounting every time externalRef
3874
- * or other dependencies change.
3875
- */
3876
- [e]
3877
- );
3878
- }
3879
- function ne(t) {
3880
- return qt(t.animate) || ze.some((e) => Mt(t[e]));
3881
- }
3882
- function Zi(t) {
3883
- return !!(ne(t) || t.variants);
3884
- }
3885
- function nc(t, e) {
3886
- if (ne(t)) {
3887
- const { initial: n, animate: s } = t;
3888
- return {
3889
- initial: n === !1 || Mt(n) ? n : void 0,
3890
- animate: Mt(s) ? s : void 0
3891
- };
3892
- }
3893
- return t.inherit !== !1 ? e : {};
3894
- }
3895
- function sc(t) {
3896
- const { initial: e, animate: n } = nc(t, O(ee));
3897
- return lt(() => ({ initial: e, animate: n }), [Ds(e), Ds(n)]);
3898
- }
3899
- function Ds(t) {
3900
- return Array.isArray(t) ? t.join(" ") : t;
3901
- }
3902
- const Ls = {
3903
- animation: [
3904
- "animate",
3905
- "variants",
3906
- "whileHover",
3907
- "whileTap",
3908
- "exit",
3909
- "whileInView",
3910
- "whileFocus",
3911
- "whileDrag"
3912
- ],
3913
- exit: ["exit"],
3914
- drag: ["drag", "dragControls"],
3915
- focus: ["whileFocus"],
3916
- hover: ["whileHover", "onHoverStart", "onHoverEnd"],
3917
- tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
3918
- pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
3919
- inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
3920
- layout: ["layout", "layoutId"]
3921
- }, vt = {};
3922
- for (const t in Ls)
3923
- vt[t] = {
3924
- isEnabled: (e) => Ls[t].some((n) => !!e[n])
3925
- };
3926
- function ic(t) {
3927
- for (const e in t)
3928
- vt[e] = {
3929
- ...vt[e],
3930
- ...t[e]
3931
- };
3932
- }
3933
- const oc = Symbol.for("motionComponentSymbol");
3934
- function rc({ preloadedFeatures: t, createVisualElement: e, useRender: n, useVisualState: s, Component: i }) {
3935
- t && ic(t);
3936
- function r(a, l) {
3937
- let c;
3938
- const u = {
3939
- ...O(ln),
3940
- ...a,
3941
- layoutId: ac(a)
3942
- }, { isStatic: h } = u, d = sc(a), f = s(a, h);
3943
- if (!h && cn) {
3944
- lc(u, t);
3945
- const p = cc(u);
3946
- c = p.MeasureLayout, d.visualElement = Ql(i, f, u, e, p.ProjectionNode);
3947
- }
3948
- return ho(ee.Provider, { value: d, children: [c && d.visualElement ? x(c, { visualElement: d.visualElement, ...u }) : null, n(i, a, ec(f, d.visualElement, l), f, h, d.visualElement)] });
3949
- }
3950
- const o = go(r);
3951
- return o[oc] = i, o;
3952
- }
3953
- function ac({ layoutId: t }) {
3954
- const e = O(rn).id;
3955
- return e && t !== void 0 ? e + "-" + t : t;
3956
- }
3957
- function lc(t, e) {
3958
- const n = O(Xi).strict;
3959
- if (process.env.NODE_ENV !== "production" && e && n) {
3960
- const s = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
3961
- t.ignoreStrict ? Pt(!1, s) : q(!1, s);
3962
- }
3963
- }
3964
- function cc(t) {
3965
- const { drag: e, layout: n } = vt;
3966
- if (!e && !n)
3967
- return {};
3968
- const s = { ...e, ...n };
3969
- return {
3970
- MeasureLayout: e != null && e.isEnabled(t) || n != null && n.isEnabled(t) ? s.MeasureLayout : void 0,
3971
- ProjectionNode: s.ProjectionNode
3972
- };
3973
- }
3974
- const uc = [
3975
- "animate",
3976
- "circle",
3977
- "defs",
3978
- "desc",
3979
- "ellipse",
3980
- "g",
3981
- "image",
3982
- "line",
3983
- "filter",
3984
- "marker",
3985
- "mask",
3986
- "metadata",
3987
- "path",
3988
- "pattern",
3989
- "polygon",
3990
- "polyline",
3991
- "rect",
3992
- "stop",
3993
- "switch",
3994
- "symbol",
3995
- "svg",
3996
- "text",
3997
- "tspan",
3998
- "use",
3999
- "view"
4000
- ];
4001
- function un(t) {
4002
- return (
4003
- /**
4004
- * If it's not a string, it's a custom React component. Currently we only support
4005
- * HTML custom React components.
4006
- */
4007
- typeof t != "string" || /**
4008
- * If it contains a dash, the element is a custom HTML webcomponent.
4009
- */
4010
- t.includes("-") ? !1 : (
4011
- /**
4012
- * If it's in our list of lowercase SVG tags, it's an SVG component
4013
- */
4014
- !!(uc.indexOf(t) > -1 || /**
4015
- * If it contains a capital letter, it's an SVG component
4016
- */
4017
- /[A-Z]/u.test(t))
4018
- )
4019
- );
4020
- }
4021
- function Ji(t, { style: e, vars: n }, s, i) {
4022
- Object.assign(t.style, e, i && i.getProjectionStyles(s));
4023
- for (const r in n)
4024
- t.style.setProperty(r, n[r]);
4025
- }
4026
- const Qi = /* @__PURE__ */ new Set([
4027
- "baseFrequency",
4028
- "diffuseConstant",
4029
- "kernelMatrix",
4030
- "kernelUnitLength",
4031
- "keySplines",
4032
- "keyTimes",
4033
- "limitingConeAngle",
4034
- "markerHeight",
4035
- "markerWidth",
4036
- "numOctaves",
4037
- "targetX",
4038
- "targetY",
4039
- "surfaceScale",
4040
- "specularConstant",
4041
- "specularExponent",
4042
- "stdDeviation",
4043
- "tableValues",
4044
- "viewBox",
4045
- "gradientTransform",
4046
- "pathLength",
4047
- "startOffset",
4048
- "textLength",
4049
- "lengthAdjust"
4050
- ]);
4051
- function to(t, e, n, s) {
4052
- Ji(t, e, void 0, s);
4053
- for (const i in e.attrs)
4054
- t.setAttribute(Qi.has(i) ? i : on(i), e.attrs[i]);
4055
- }
4056
- function eo(t, { layout: e, layoutId: n }) {
4057
- return ct.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!Gt[t] || t === "opacity");
4058
- }
4059
- function hn(t, e, n) {
4060
- var s;
4061
- const { style: i } = t, r = {};
4062
- for (const o in i)
4063
- (I(i[o]) || e.style && I(e.style[o]) || eo(o, t) || ((s = n == null ? void 0 : n.getValue(o)) === null || s === void 0 ? void 0 : s.liveStyle) !== void 0) && (r[o] = i[o]);
4064
- return r;
4065
- }
4066
- function no(t, e, n) {
4067
- const s = hn(t, e, n);
4068
- for (const i in t)
4069
- if (I(t[i]) || I(e[i])) {
4070
- const r = Et.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
4071
- s[r] = t[i];
4072
- }
4073
- return s;
4074
- }
4075
- function dn(t) {
4076
- const e = J(null);
4077
- return e.current === null && (e.current = t()), e.current;
4078
- }
4079
- function hc({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: n }, s, i, r) {
4080
- const o = {
4081
- latestValues: dc(s, i, r, t),
4082
- renderState: e()
4083
- };
4084
- return n && (o.mount = (a) => n(s, a, o)), o;
4085
- }
4086
- const so = (t) => (e, n) => {
4087
- const s = O(ee), i = O(te), r = () => hc(t, e, s, i);
4088
- return n ? r() : dn(r);
4089
- };
4090
- function dc(t, e, n, s) {
4091
- const i = {}, r = s(t, {});
4092
- for (const d in r)
4093
- i[d] = Ut(r[d]);
4094
- let { initial: o, animate: a } = t;
4095
- const l = ne(t), c = Zi(t);
4096
- e && c && !l && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate));
4097
- let u = n ? n.initial === !1 : !1;
4098
- u = u || o === !1;
4099
- const h = u ? a : o;
4100
- if (h && typeof h != "boolean" && !qt(h)) {
4101
- const d = Array.isArray(h) ? h : [h];
4102
- for (let f = 0; f < d.length; f++) {
4103
- const p = Be(t, d[f]);
4104
- if (p) {
4105
- const { transitionEnd: y, transition: T, ...g } = p;
4106
- for (const v in g) {
4107
- let m = g[v];
4108
- if (Array.isArray(m)) {
4109
- const S = u ? m.length - 1 : 0;
4110
- m = m[S];
4111
- }
4112
- m !== null && (i[v] = m);
4113
- }
4114
- for (const v in y)
4115
- i[v] = y[v];
4116
- }
4117
- }
4118
- }
4119
- return i;
4120
- }
4121
- const fn = () => ({
4122
- style: {},
4123
- transform: {},
4124
- transformOrigin: {},
4125
- vars: {}
4126
- }), io = () => ({
4127
- ...fn(),
4128
- attrs: {}
4129
- }), oo = (t, e) => e && typeof t == "number" ? e.transform(t) : t, fc = {
4130
- x: "translateX",
4131
- y: "translateY",
4132
- z: "translateZ",
4133
- transformPerspective: "perspective"
4134
- }, pc = Et.length;
4135
- function mc(t, e, n) {
4136
- let s = "", i = !0;
4137
- for (let r = 0; r < pc; r++) {
4138
- const o = Et[r], a = t[o];
4139
- if (a === void 0)
4140
- continue;
4141
- let l = !0;
4142
- if (typeof a == "number" ? l = a === (o.startsWith("scale") ? 1 : 0) : l = parseFloat(a) === 0, !l || n) {
4143
- const c = oo(a, Ge[o]);
4144
- if (!l) {
4145
- i = !1;
4146
- const u = fc[o] || o;
4147
- s += `${u}(${c}) `;
4148
- }
4149
- n && (e[o] = c);
4150
- }
4151
- }
4152
- return s = s.trim(), n ? s = n(e, i ? "" : s) : i && (s = "none"), s;
4153
- }
4154
- function pn(t, e, n) {
4155
- const { style: s, vars: i, transformOrigin: r } = t;
4156
- let o = !1, a = !1;
4157
- for (const l in e) {
4158
- const c = e[l];
4159
- if (ct.has(l)) {
4160
- o = !0;
4161
- continue;
4162
- } else if (Zs(l)) {
4163
- i[l] = c;
4164
- continue;
4165
- } else {
4166
- const u = oo(c, Ge[l]);
4167
- l.startsWith("origin") ? (a = !0, r[l] = u) : s[l] = u;
4168
- }
4169
- }
4170
- if (e.transform || (o || n ? s.transform = mc(e, t.transform, n) : s.transform && (s.transform = "none")), a) {
4171
- const { originX: l = "50%", originY: c = "50%", originZ: u = 0 } = r;
4172
- s.transformOrigin = `${l} ${c} ${u}`;
4173
- }
4174
- }
4175
- function Es(t, e, n) {
4176
- return typeof t == "string" ? t : P.transform(e + n * t);
4177
- }
4178
- function gc(t, e, n) {
4179
- const s = Es(e, t.x, t.width), i = Es(n, t.y, t.height);
4180
- return `${s} ${i}`;
4181
- }
4182
- const yc = {
4183
- offset: "stroke-dashoffset",
4184
- array: "stroke-dasharray"
4185
- }, vc = {
4186
- offset: "strokeDashoffset",
4187
- array: "strokeDasharray"
4188
- };
4189
- function Tc(t, e, n = 1, s = 0, i = !0) {
4190
- t.pathLength = 1;
4191
- const r = i ? yc : vc;
4192
- t[r.offset] = P.transform(-s);
4193
- const o = P.transform(e), a = P.transform(n);
4194
- t[r.array] = `${o} ${a}`;
4195
- }
4196
- function mn(t, {
4197
- attrX: e,
4198
- attrY: n,
4199
- attrScale: s,
4200
- originX: i,
4201
- originY: r,
4202
- pathLength: o,
4203
- pathSpacing: a = 1,
4204
- pathOffset: l = 0,
4205
- // This is object creation, which we try to avoid per-frame.
4206
- ...c
4207
- }, u, h) {
4208
- if (pn(t, c, h), u) {
4209
- t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
4210
- return;
4211
- }
4212
- t.attrs = t.style, t.style = {};
4213
- const { attrs: d, style: f, dimensions: p } = t;
4214
- d.transform && (p && (f.transform = d.transform), delete d.transform), p && (i !== void 0 || r !== void 0 || f.transform) && (f.transformOrigin = gc(p, i !== void 0 ? i : 0.5, r !== void 0 ? r : 0.5)), e !== void 0 && (d.x = e), n !== void 0 && (d.y = n), s !== void 0 && (d.scale = s), o !== void 0 && Tc(d, o, a, l, !1);
4215
- }
4216
- const gn = (t) => typeof t == "string" && t.toLowerCase() === "svg", Pc = {
4217
- useVisualState: so({
4218
- scrapeMotionValuesFromProps: no,
4219
- createRenderState: io,
4220
- onMount: (t, e, { renderState: n, latestValues: s }) => {
4221
- b.read(() => {
4222
- try {
4223
- n.dimensions = typeof e.getBBox == "function" ? e.getBBox() : e.getBoundingClientRect();
4224
- } catch {
4225
- n.dimensions = {
4226
- x: 0,
4227
- y: 0,
4228
- width: 0,
4229
- height: 0
4230
- };
4231
- }
4232
- }), b.render(() => {
4233
- mn(n, s, gn(e.tagName), t.transformTemplate), to(e, n);
4234
- });
4235
- }
4236
- })
4237
- }, xc = {
4238
- useVisualState: so({
4239
- scrapeMotionValuesFromProps: hn,
4240
- createRenderState: fn
4241
- })
4242
- };
4243
- function ro(t, e, n) {
4244
- for (const s in e)
4245
- !I(e[s]) && !eo(s, n) && (t[s] = e[s]);
4246
- }
4247
- function Sc({ transformTemplate: t }, e) {
4248
- return lt(() => {
4249
- const n = fn();
4250
- return pn(n, e, t), Object.assign({}, n.vars, n.style);
4251
- }, [e]);
4252
- }
4253
- function Vc(t, e) {
4254
- const n = t.style || {}, s = {};
4255
- return ro(s, n, t), Object.assign(s, Sc(t, e)), s;
4256
- }
4257
- function Ac(t, e) {
4258
- const n = {}, s = Vc(t, e);
4259
- return t.drag && t.dragListener !== !1 && (n.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = s, n;
4260
- }
4261
- const wc = /* @__PURE__ */ new Set([
4262
- "animate",
4263
- "exit",
4264
- "variants",
4265
- "initial",
4266
- "style",
4267
- "values",
4268
- "variants",
4269
- "transition",
4270
- "transformTemplate",
4271
- "custom",
4272
- "inherit",
4273
- "onBeforeLayoutMeasure",
4274
- "onAnimationStart",
4275
- "onAnimationComplete",
4276
- "onUpdate",
4277
- "onDragStart",
4278
- "onDrag",
4279
- "onDragEnd",
4280
- "onMeasureDragConstraints",
4281
- "onDirectionLock",
4282
- "onDragTransitionEnd",
4283
- "_dragX",
4284
- "_dragY",
4285
- "onHoverStart",
4286
- "onHoverEnd",
4287
- "onViewportEnter",
4288
- "onViewportLeave",
4289
- "globalTapTarget",
4290
- "ignoreStrict",
4291
- "viewport"
4292
- ]);
4293
- function Yt(t) {
4294
- return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || wc.has(t);
4295
- }
4296
- let ao = (t) => !Yt(t);
4297
- function bc(t) {
4298
- t && (ao = (e) => e.startsWith("on") ? !Yt(e) : t(e));
4299
- }
4300
- try {
4301
- bc(require("@emotion/is-prop-valid").default);
4302
- } catch {
4303
- }
4304
- function Cc(t, e, n) {
4305
- const s = {};
4306
- for (const i in t)
4307
- i === "values" && typeof t.values == "object" || (ao(i) || n === !0 && Yt(i) || !e && !Yt(i) || // If trying to use native HTML drag events, forward drag listeners
4308
- t.draggable && i.startsWith("onDrag")) && (s[i] = t[i]);
4309
- return s;
4310
- }
4311
- function Mc(t, e, n, s) {
4312
- const i = lt(() => {
4313
- const r = io();
4314
- return mn(r, e, gn(s), t.transformTemplate), {
4315
- ...r.attrs,
4316
- style: { ...r.style }
4317
- };
4318
- }, [e]);
4319
- if (t.style) {
4320
- const r = {};
4321
- ro(r, t.style, t), i.style = { ...r, ...i.style };
4322
- }
4323
- return i;
4324
- }
4325
- function Rc(t = !1) {
4326
- return (n, s, i, { latestValues: r }, o) => {
4327
- const l = (un(n) ? Mc : Ac)(s, r, o, n), c = Cc(s, typeof n == "string", t), u = n !== Bs ? { ...c, ...l, ref: i } : {}, { children: h } = s, d = lt(() => I(h) ? h.get() : h, [h]);
4328
- return yo(n, {
4329
- ...u,
4330
- children: d
4331
- });
4332
- };
4333
- }
4334
- function Dc(t, e) {
4335
- return function(s, { forwardMotionProps: i } = { forwardMotionProps: !1 }) {
4336
- const o = {
4337
- ...un(s) ? Pc : xc,
4338
- preloadedFeatures: t,
4339
- useRender: Rc(i),
4340
- createVisualElement: e,
4341
- Component: s
4342
- };
4343
- return rc(o);
4344
- };
4345
- }
4346
- const Ee = { current: null }, lo = { current: !1 };
4347
- function Lc() {
4348
- if (lo.current = !0, !!cn)
4349
- if (window.matchMedia) {
4350
- const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Ee.current = t.matches;
4351
- t.addListener(e), e();
4352
- } else
4353
- Ee.current = !1;
4354
- }
4355
- function Ec(t, e, n) {
4356
- for (const s in e) {
4357
- const i = e[s], r = n[s];
4358
- if (I(i))
4359
- t.addValue(s, i), process.env.NODE_ENV === "development" && Xt(i.version === "11.11.11", `Attempting to mix Framer Motion versions ${i.version} with 11.11.11 may not work as expected.`);
4360
- else if (I(r))
4361
- t.addValue(s, Lt(i, { owner: t }));
4362
- else if (r !== i)
4363
- if (t.hasValue(s)) {
4364
- const o = t.getValue(s);
4365
- o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
4366
- } else {
4367
- const o = t.getStaticValue(s);
4368
- t.addValue(s, Lt(o !== void 0 ? o : i, { owner: t }));
4369
- }
4370
- }
4371
- for (const s in n)
4372
- e[s] === void 0 && t.removeValue(s);
4373
- return e;
4374
- }
4375
- const Os = /* @__PURE__ */ new WeakMap(), Oc = [...ti, E, et], Ic = (t) => Oc.find(Qs(t)), Is = [
4376
- "AnimationStart",
4377
- "AnimationComplete",
4378
- "Update",
4379
- "BeforeLayoutMeasure",
4380
- "LayoutMeasure",
4381
- "LayoutAnimationStart",
4382
- "LayoutAnimationComplete"
4383
- ];
4384
- class kc {
4385
- /**
4386
- * This method takes React props and returns found MotionValues. For example, HTML
4387
- * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
4388
- *
4389
- * This isn't an abstract method as it needs calling in the constructor, but it is
4390
- * intended to be one.
4391
- */
4392
- scrapeMotionValuesFromProps(e, n, s) {
4393
- return {};
4394
- }
4395
- constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
4396
- this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Ke, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
4397
- this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
4398
- }, this.renderScheduledAt = 0, this.scheduleRender = () => {
4399
- const d = K.now();
4400
- this.renderScheduledAt < d && (this.renderScheduledAt = d, b.render(this.render, !1, !0));
4401
- };
4402
- const { latestValues: l, renderState: c } = o;
4403
- this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = c, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = ne(n), this.isVariantNode = Zi(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
4404
- const { willChange: u, ...h } = this.scrapeMotionValuesFromProps(n, {}, this);
4405
- for (const d in h) {
4406
- const f = h[d];
4407
- l[d] !== void 0 && I(f) && f.set(l[d], !1);
4408
- }
4409
- }
4410
- mount(e) {
4411
- this.current = e, Os.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), lo.current || Lc(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Ee.current, process.env.NODE_ENV !== "production" && Xt(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext);
4412
- }
4413
- unmount() {
4414
- Os.delete(this.current), this.projection && this.projection.unmount(), Q(this.notifyUpdate), Q(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
4415
- for (const e in this.events)
4416
- this.events[e].clear();
4417
- for (const e in this.features) {
4418
- const n = this.features[e];
4419
- n && (n.unmount(), n.isMounted = !1);
4420
- }
4421
- this.current = null;
4422
- }
4423
- bindToMotionValue(e, n) {
4424
- this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
4425
- const s = ct.has(e), i = n.on("change", (a) => {
4426
- this.latestValues[e] = a, this.props.onUpdate && b.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
4427
- }), r = n.on("renderRequest", this.scheduleRender);
4428
- let o;
4429
- window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
4430
- i(), r(), o && o(), n.owner && n.stop();
4431
- });
4432
- }
4433
- sortNodePosition(e) {
4434
- return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
4435
- }
4436
- updateFeatures() {
4437
- let e = "animation";
4438
- for (e in vt) {
4439
- const n = vt[e];
4440
- if (!n)
4441
- continue;
4442
- const { isEnabled: s, Feature: i } = n;
4443
- if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
4444
- const r = this.features[e];
4445
- r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
4446
- }
4447
- }
4448
- }
4449
- triggerBuild() {
4450
- this.build(this.renderState, this.latestValues, this.props);
4451
- }
4452
- /**
4453
- * Measure the current viewport box with or without transforms.
4454
- * Only measures axis-aligned boxes, rotate and skew must be manually
4455
- * removed with a re-render to work.
4456
- */
4457
- measureViewportBox() {
4458
- return this.current ? this.measureInstanceViewportBox(this.current, this.props) : R();
4459
- }
4460
- getStaticValue(e) {
4461
- return this.latestValues[e];
4462
- }
4463
- setStaticValue(e, n) {
4464
- this.latestValues[e] = n;
4465
- }
4466
- /**
4467
- * Update the provided props. Ensure any newly-added motion values are
4468
- * added to our map, old ones removed, and listeners updated.
4469
- */
4470
- update(e, n) {
4471
- (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
4472
- for (let s = 0; s < Is.length; s++) {
4473
- const i = Is[s];
4474
- this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
4475
- const r = "on" + i, o = e[r];
4476
- o && (this.propEventSubscriptions[i] = this.on(i, o));
4477
- }
4478
- this.prevMotionValues = Ec(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
4479
- }
4480
- getProps() {
4481
- return this.props;
4482
- }
4483
- /**
4484
- * Returns the variant definition with a given name.
4485
- */
4486
- getVariant(e) {
4487
- return this.props.variants ? this.props.variants[e] : void 0;
4488
- }
4489
- /**
4490
- * Returns the defined default transition on this component.
4491
- */
4492
- getDefaultTransition() {
4493
- return this.props.transition;
4494
- }
4495
- getTransformPagePoint() {
4496
- return this.props.transformPagePoint;
4497
- }
4498
- getClosestVariantNode() {
4499
- return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
4500
- }
4501
- /**
4502
- * Add a child visual element to our set of children.
4503
- */
4504
- addVariantChild(e) {
4505
- const n = this.getClosestVariantNode();
4506
- if (n)
4507
- return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
4508
- }
4509
- /**
4510
- * Add a motion value and bind it to this visual element.
4511
- */
4512
- addValue(e, n) {
4513
- const s = this.values.get(e);
4514
- n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
4515
- }
4516
- /**
4517
- * Remove a motion value and unbind any active subscriptions.
4518
- */
4519
- removeValue(e) {
4520
- this.values.delete(e);
4521
- const n = this.valueSubscriptions.get(e);
4522
- n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
4523
- }
4524
- /**
4525
- * Check whether we have a motion value for this key
4526
- */
4527
- hasValue(e) {
4528
- return this.values.has(e);
4529
- }
4530
- getValue(e, n) {
4531
- if (this.props.values && this.props.values[e])
4532
- return this.props.values[e];
4533
- let s = this.values.get(e);
4534
- return s === void 0 && n !== void 0 && (s = Lt(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
4535
- }
4536
- /**
4537
- * If we're trying to animate to a previously unencountered value,
4538
- * we need to check for it in our state and as a last resort read it
4539
- * directly from the instance (which might have performance implications).
4540
- */
4541
- readValue(e, n) {
4542
- var s;
4543
- let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (s = this.getBaseTargetFromProps(this.props, e)) !== null && s !== void 0 ? s : this.readValueFromInstance(this.current, e, this.options);
4544
- return i != null && (typeof i == "string" && (Xs(i) || Ys(i)) ? i = parseFloat(i) : !Ic(i) && et.test(n) && (i = li(e, n)), this.setBaseTarget(e, I(i) ? i.get() : i)), I(i) ? i.get() : i;
4545
- }
4546
- /**
4547
- * Set the base target to later animate back to. This is currently
4548
- * only hydrated on creation and when we first read a value.
4549
- */
4550
- setBaseTarget(e, n) {
4551
- this.baseTarget[e] = n;
4552
- }
4553
- /**
4554
- * Find the base target for a value thats been removed from all animation
4555
- * props.
4556
- */
4557
- getBaseTarget(e) {
4558
- var n;
4559
- const { initial: s } = this.props;
4560
- let i;
4561
- if (typeof s == "string" || typeof s == "object") {
4562
- const o = Be(this.props, s, (n = this.presenceContext) === null || n === void 0 ? void 0 : n.custom);
4563
- o && (i = o[e]);
4564
- }
4565
- if (s && i !== void 0)
4566
- return i;
4567
- const r = this.getBaseTargetFromProps(this.props, e);
4568
- return r !== void 0 && !I(r) ? r : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
4569
- }
4570
- on(e, n) {
4571
- return this.events[e] || (this.events[e] = new sn()), this.events[e].add(n);
4572
- }
4573
- notify(e, ...n) {
4574
- this.events[e] && this.events[e].notify(...n);
4575
- }
4576
- }
4577
- class co extends kc {
4578
- constructor() {
4579
- super(...arguments), this.KeyframeResolver = ci;
4580
- }
4581
- sortInstanceNodePosition(e, n) {
4582
- return e.compareDocumentPosition(n) & 2 ? 1 : -1;
4583
- }
4584
- getBaseTargetFromProps(e, n) {
4585
- return e.style ? e.style[n] : void 0;
4586
- }
4587
- removeValueFromRenderState(e, { vars: n, style: s }) {
4588
- delete n[e], delete s[e];
4589
- }
4590
- }
4591
- function Fc(t) {
4592
- return window.getComputedStyle(t);
4593
- }
4594
- class Bc extends co {
4595
- constructor() {
4596
- super(...arguments), this.type = "html", this.renderInstance = Ji;
4597
- }
4598
- readValueFromInstance(e, n) {
4599
- if (ct.has(n)) {
4600
- const s = Ye(n);
4601
- return s && s.default || 0;
4602
- } else {
4603
- const s = Fc(e), i = (Zs(n) ? s.getPropertyValue(n) : s[n]) || 0;
4604
- return typeof i == "string" ? i.trim() : i;
4605
- }
4606
- }
4607
- measureInstanceViewportBox(e, { transformPagePoint: n }) {
4608
- return ki(e, n);
4609
- }
4610
- build(e, n, s) {
4611
- pn(e, n, s.transformTemplate);
4612
- }
4613
- scrapeMotionValuesFromProps(e, n, s) {
4614
- return hn(e, n, s);
4615
- }
4616
- handleChildMotionValue() {
4617
- this.childSubscription && (this.childSubscription(), delete this.childSubscription);
4618
- const { children: e } = this.props;
4619
- I(e) && (this.childSubscription = e.on("change", (n) => {
4620
- this.current && (this.current.textContent = `${n}`);
4621
- }));
4622
- }
4623
- }
4624
- class jc extends co {
4625
- constructor() {
4626
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = R;
4627
- }
4628
- getBaseTargetFromProps(e, n) {
4629
- return e[n];
4630
- }
4631
- readValueFromInstance(e, n) {
4632
- if (ct.has(n)) {
4633
- const s = Ye(n);
4634
- return s && s.default || 0;
4635
- }
4636
- return n = Qi.has(n) ? n : on(n), e.getAttribute(n);
4637
- }
4638
- scrapeMotionValuesFromProps(e, n, s) {
4639
- return no(e, n, s);
4640
- }
4641
- build(e, n, s) {
4642
- mn(e, n, this.isSVGTag, s.transformTemplate);
4643
- }
4644
- renderInstance(e, n, s, i) {
4645
- to(e, n, s, i);
4646
- }
4647
- mount(e) {
4648
- this.isSVGTag = gn(e.tagName), super.mount(e);
4649
- }
4650
- }
4651
- const zc = (t, e) => un(t) ? new jc(e) : new Bc(e, {
4652
- allowProjection: t !== Bs
4653
- }), Nc = /* @__PURE__ */ Dc({
4654
- ...Ra,
4655
- ...Zl,
4656
- ...Nl,
4657
- ...Jl
4658
- }, zc), Fu = /* @__PURE__ */ Po(Nc);
4659
- class Uc extends Oe.Component {
4660
- getSnapshotBeforeUpdate(e) {
4661
- const n = this.props.childRef.current;
4662
- if (n && e.isPresent && !this.props.isPresent) {
4663
- const s = this.props.sizeRef.current;
4664
- s.height = n.offsetHeight || 0, s.width = n.offsetWidth || 0, s.top = n.offsetTop, s.left = n.offsetLeft;
4665
- }
4666
- return null;
4667
- }
4668
- /**
4669
- * Required with getSnapshotBeforeUpdate to stop React complaining.
4670
- */
4671
- componentDidUpdate() {
4672
- }
4673
- render() {
4674
- return this.props.children;
4675
- }
4676
- }
4677
- function Hc({ children: t, isPresent: e }) {
4678
- const n = Ie(), s = J(null), i = J({
4679
- width: 0,
4680
- height: 0,
4681
- top: 0,
4682
- left: 0
4683
- }), { nonce: r } = O(ln);
4684
- return Fs(() => {
4685
- const { width: o, height: a, top: l, left: c } = i.current;
4686
- if (e || !s.current || !o || !a)
4687
- return;
4688
- s.current.dataset.motionPopId = n;
4689
- const u = document.createElement("style");
4690
- return r && (u.nonce = r), document.head.appendChild(u), u.sheet && u.sheet.insertRule(`
4691
- [data-motion-pop-id="${n}"] {
4692
- position: absolute !important;
4693
- width: ${o}px !important;
4694
- height: ${a}px !important;
4695
- top: ${l}px !important;
4696
- left: ${c}px !important;
4697
- }
4698
- `), () => {
4699
- document.head.removeChild(u);
4700
- };
4701
- }, [e]), x(Uc, { isPresent: e, childRef: s, sizeRef: i, children: Oe.cloneElement(t, { ref: s }) });
4702
- }
4703
- const _c = ({ children: t, initial: e, isPresent: n, onExitComplete: s, custom: i, presenceAffectsLayout: r, mode: o }) => {
4704
- const a = dn(Kc), l = Ie(), c = Fe((h) => {
4705
- a.set(h, !0);
4706
- for (const d of a.values())
4707
- if (!d)
4708
- return;
4709
- s && s();
4710
- }, [a, s]), u = lt(
4711
- () => ({
4712
- id: l,
4713
- initial: e,
4714
- isPresent: n,
4715
- custom: i,
4716
- onExitComplete: c,
4717
- register: (h) => (a.set(h, !1), () => a.delete(h))
4718
- }),
4719
- /**
4720
- * If the presence of a child affects the layout of the components around it,
4721
- * we want to make a new context value to ensure they get re-rendered
4722
- * so they can detect that layout change.
4723
- */
4724
- r ? [Math.random(), c] : [n, c]
4725
- );
4726
- return lt(() => {
4727
- a.forEach((h, d) => a.set(d, !1));
4728
- }, [n]), Oe.useEffect(() => {
4729
- !n && !a.size && s && s();
4730
- }, [n]), o === "popLayout" && (t = x(Hc, { isPresent: n, children: t })), x(te.Provider, { value: u, children: t });
4731
- };
4732
- function Kc() {
4733
- return /* @__PURE__ */ new Map();
4734
- }
4735
- const jt = (t) => t.key || "";
4736
- function ks(t) {
4737
- const e = [];
4738
- return vo.forEach(t, (n) => {
4739
- To(n) && e.push(n);
4740
- }), e;
4741
- }
4742
- const Bu = ({ children: t, exitBeforeEnter: e, custom: n, initial: s = !0, onExitComplete: i, presenceAffectsLayout: r = !0, mode: o = "sync" }) => {
4743
- q(!e, "Replace exitBeforeEnter with mode='wait'");
4744
- const a = lt(() => ks(t), [t]), l = a.map(jt), c = J(!0), u = J(a), h = dn(() => /* @__PURE__ */ new Map()), [d, f] = Tn(a), [p, y] = Tn(a);
4745
- Yi(() => {
4746
- c.current = !1, u.current = a;
4747
- for (let v = 0; v < p.length; v++) {
4748
- const m = jt(p[v]);
4749
- l.includes(m) ? h.delete(m) : h.get(m) !== !0 && h.set(m, !1);
4750
- }
4751
- }, [p, l.length, l.join("-")]);
4752
- const T = [];
4753
- if (a !== d) {
4754
- let v = [...a];
4755
- for (let m = 0; m < p.length; m++) {
4756
- const S = p[m], A = jt(S);
4757
- l.includes(A) || (v.splice(m, 0, S), T.push(S));
4758
- }
4759
- o === "wait" && T.length && (v = T), y(ks(v)), f(a);
4760
- return;
4761
- }
4762
- process.env.NODE_ENV !== "production" && o === "wait" && p.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
4763
- const { forceRender: g } = O(rn);
4764
- return x(fo, { children: p.map((v) => {
4765
- const m = jt(v), S = a === p || l.includes(m), A = () => {
4766
- if (h.has(m))
4767
- h.set(m, !0);
4768
- else
4769
- return;
4770
- let M = !0;
4771
- h.forEach((B) => {
4772
- B || (M = !1);
4773
- }), M && (g == null || g(), y(u.current), i && i());
4774
- };
4775
- return x(_c, { isPresent: S, initial: !c.current || s ? void 0 : !1, custom: S ? void 0 : n, presenceAffectsLayout: r, mode: o, onExitComplete: S ? void 0 : A, children: v }, m);
4776
- }) });
4777
- };
4778
- export {
4779
- Qc as A,
4780
- nu as B,
4781
- cu as C,
4782
- du as E,
4783
- fu as G,
4784
- mu as H,
4785
- yu as L,
4786
- vu as M,
4787
- Tu as N,
4788
- xu as P,
4789
- Vu as R,
4790
- wu as S,
4791
- Mu as T,
4792
- Ru as V,
4793
- Ou as W,
4794
- Cu as a,
4795
- lu as b,
4796
- Bu as c,
4797
- qc as d,
4798
- bu as e,
4799
- au as f,
4800
- su as g,
4801
- Du as h,
4802
- ou as i,
4803
- hu as j,
4804
- Au as k,
4805
- Eu as l,
4806
- Fu as m,
4807
- Pu as n,
4808
- Su as o,
4809
- Zc as p,
4810
- ru as q,
4811
- uu as r,
4812
- Jc as s,
4813
- pu as t,
4814
- iu as u,
4815
- gu as v,
4816
- tu as w,
4817
- eu as x,
4818
- Lu as y
4819
- };