@beeintel/batch-image 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FONT-LICENSE.txt +93 -0
- package/README.md +181 -2
- package/dist/assets/11st-D7qGO5e4.webp +0 -0
- package/dist/assets/UPNG-CPfdwFSy.js +2298 -0
- package/dist/assets/adjust-card-B63b81iV.webp +0 -0
- package/dist/assets/adjust-final.worker-C2JbTvv5.js +6945 -0
- package/dist/assets/amazon-CjTtpZTq.webp +0 -0
- package/dist/assets/ascii_art-B4UGbtGs.webp +0 -0
- package/dist/assets/auction-j26eVUQO.webp +0 -0
- package/dist/assets/background-DGdZUdkL.webp +0 -0
- package/dist/assets/background-card-wK7DRpvM.png +0 -0
- package/dist/assets/body-CUFdRg8w.webp +0 -0
- package/dist/assets/bounded-cutout.worker-BZR6mbaI.js +9615 -0
- package/dist/assets/brand-mark-card-cFUeDeO2.webp +0 -0
- package/dist/assets/buyma-dAxYNjow.webp +0 -0
- package/dist/assets/codec.worker-7W6hmsm6.js +7349 -0
- package/dist/assets/contour_lines-C_CqrgV1.webp +0 -0
- package/dist/assets/creema-B1tWyCPx.webp +0 -0
- package/dist/assets/crop-final.worker-Owin7TvX.js +7035 -0
- package/dist/assets/cutout-CzMvV5An.webp +0 -0
- package/dist/assets/cutout-card-CN4gNFBz.png +0 -0
- package/dist/assets/cutout.worker-DyH6Prbn.js +3894 -0
- package/dist/assets/depop-CkVC5Fn1.webp +0 -0
- package/dist/assets/dewrinkle-kFzP6LqD.webp +0 -0
- package/dist/assets/dither-CcxmO2e6.webp +0 -0
- package/dist/assets/douyin-CP_HwBDF.webp +0 -0
- package/dist/assets/download.worker-DnGSB6P_.js +17779 -0
- package/dist/assets/duotone-Cdg_3fQf.webp +0 -0
- package/dist/assets/ebay-CxLfrRAf.webp +0 -0
- package/dist/assets/edit-Cv-txfZm.webp +0 -0
- package/dist/assets/effect.worker-qu1eCcII.js +9227 -0
- package/dist/assets/engraving-BENh1O2O.webp +0 -0
- package/dist/assets/etsy-CSvz9GpY.webp +0 -0
- package/dist/assets/expand-C60VE9nK.webp +0 -0
- package/dist/assets/facebook-Ca2nJJiQ.webp +0 -0
- package/dist/assets/film_stock-Bqauwcq4.webp +0 -0
- package/dist/assets/final.worker-BnzJ3N5C.js +7035 -0
- package/dist/assets/final.worker-Csc1zoYS.js +7054 -0
- package/dist/assets/final.worker-DzBFT9xk.js +6922 -0
- package/dist/assets/final.worker-XpgKnlaz.js +7217 -0
- package/dist/assets/flatlay-CPiVmlAa.webp +0 -0
- package/dist/assets/flatlay-fold-B-CRYy87.webp +0 -0
- package/dist/assets/flatlay-open-Dzas8okC.webp +0 -0
- package/dist/assets/g-market-DXuYK_JH.webp +0 -0
- package/dist/assets/ghost-BCEAx_Zx.webp +0 -0
- package/dist/assets/ghost-front-WFgA4sUo.webp +0 -0
- package/dist/assets/ghost-three-quarter-Rt8cXj34.webp +0 -0
- package/dist/assets/gif-CObOIITx.js +303 -0
- package/dist/assets/glass_tiles-3IXP-Hmg.webp +0 -0
- package/dist/assets/glitch_art-D1i3qben.webp +0 -0
- package/dist/assets/glitch_blur-C4q_9zyq.webp +0 -0
- package/dist/assets/glow-Bv9EHBU5.webp +0 -0
- package/dist/assets/gradient_map-BR-UVYMP.webp +0 -0
- package/dist/assets/halftone-CWdKu2_6.webp +0 -0
- package/dist/assets/holo_sticker-BQDikLg2.webp +0 -0
- package/dist/assets/idus-7diqRNPs.webp +0 -0
- package/dist/assets/imagetracer.worker-CgunQTPG.js +7096 -0
- package/dist/assets/instagram-Bf0IVidT.webp +0 -0
- package/dist/assets/kakao-talk-Df79L_Mv.webp +0 -0
- package/dist/assets/kaleidoscope-BxqMZuWo.webp +0 -0
- package/dist/assets/karrot-BXFPhDwt.webp +0 -0
- package/dist/assets/kaufland-BDDy6e0C.webp +0 -0
- package/dist/assets/lazada-ConR4e1O.webp +0 -0
- package/dist/assets/lens_flare-DgyiAv_j.webp +0 -0
- package/dist/assets/light_leak-kUdpoFuC.webp +0 -0
- package/dist/assets/line-Dr1j___B.webp +0 -0
- package/dist/assets/linkedin-4s_9Wh03.webp +0 -0
- package/dist/assets/lo_fi-DSdl3yY_.webp +0 -0
- package/dist/assets/logo-preparation.worker-D9oa7SME.js +420 -0
- package/dist/assets/mercado-libre-C8CskEiS.webp +0 -0
- package/dist/assets/mercari-jp-DHj7nz4O.webp +0 -0
- package/dist/assets/metadata.worker-B_9_BgN1.js +6456 -0
- package/dist/assets/mirror_collage-JtSKCeSh.webp +0 -0
- package/dist/assets/model-BbeF-fsf.webp +0 -0
- package/dist/assets/model-BjWhieit.webp +0 -0
- package/dist/assets/momo-BWXO_8Df.webp +0 -0
- package/dist/assets/motion_blur-B8YUHeSg.webp +0 -0
- package/dist/assets/naver-xQKL8lWg.webp +0 -0
- package/dist/assets/nuvemshop-DPt6rnA-.webp +0 -0
- package/dist/assets/olx-B87gp-Il.webp +0 -0
- package/dist/assets/orient-card-Da0ii6mX.webp +0 -0
- package/dist/assets/orient-final.worker-CdF5Y5zD.js +6909 -0
- package/dist/assets/orientation-preview.worker-B7uFzz3J.js +6865 -0
- package/dist/assets/ort.bundle.min-CreFV8V1.js +9311 -0
- package/dist/assets/ort.webgpu.bundle.min-CAudaHZO.js +9311 -0
- package/dist/assets/otto-market-DWZyNKJn.webp +0 -0
- package/dist/assets/paper_texture-CXphyIrs.webp +0 -0
- package/dist/assets/pinterest-ByZqih2J.webp +0 -0
- package/dist/assets/polish-DFy6LNG7.webp +0 -0
- package/dist/assets/poshmark-DnZi2vA1.webp +0 -0
- package/dist/assets/posterize-SpLVGq1s.webp +0 -0
- package/dist/assets/preview.worker-DcrCKKWl.js +380 -0
- package/dist/assets/qoo10-C1pq81Jx.webp +0 -0
- package/dist/assets/rakuten-ulYog1hL.webp +0 -0
- package/dist/assets/recolor-mBX7vdFT.webp +0 -0
- package/dist/assets/resize-DVEAl0Um.webp +0 -0
- package/dist/assets/runtime-0663b902fb3937883a34.wasm +0 -0
- package/dist/assets/runtime-355a5c80c7bfdf8737de.mjs +2817 -0
- package/dist/assets/runtime-49871f5a4409519797e1.wasm +0 -0
- package/dist/assets/runtime-74cf72f9a2b7befc115a.mjs +2817 -0
- package/dist/assets/shadow-card-DTZEH60r.png +0 -0
- package/dist/assets/shopee-Bxfei6sj.webp +0 -0
- package/dist/assets/shopify-wVaBafcF.webp +0 -0
- package/dist/assets/shopline-DMoaJ7Bh.webp +0 -0
- package/dist/assets/sparkle-CD5GSGip.webp +0 -0
- package/dist/assets/ssg-DQoFx5u5.webp +0 -0
- package/dist/assets/staging-CIc8pQJ6.webp +0 -0
- package/dist/assets/standard-cutout.worker-BYLzdpR-.js +1261 -0
- package/dist/assets/text-DQW2mBGp.webp +0 -0
- package/dist/assets/textured_glass-D2coxp7n.webp +0 -0
- package/dist/assets/tga-VGxWDes0.js +752 -0
- package/dist/assets/tilt_shift-BKs46yeX.webp +0 -0
- package/dist/assets/transformers.web-DB57cIO5.js +28891 -0
- package/dist/assets/tritone-CcR4qizk.webp +0 -0
- package/dist/assets/upscale-BrLadyUk.webp +0 -0
- package/dist/assets/upscale-creative-DnZnQufJ.webp +0 -0
- package/dist/assets/upscale-crisp-Ckdmbsnn.webp +0 -0
- package/dist/assets/vinted-1QDsxvC6.webp +0 -0
- package/dist/assets/watercolor-CV67zYNE.webp +0 -0
- package/dist/assets/watermark-CpPrxaT5.webp +0 -0
- package/dist/assets/wave_distortion-CV5jVfK4.webp +0 -0
- package/dist/assets/whatsapp-CWJxqzR6.webp +0 -0
- package/dist/assets/worker-DfrCFP3O.js +55 -0
- package/dist/assets/xerox_noise-CbbHY1S1.webp +0 -0
- package/dist/assets/youtube-DS12d5mi.webp +0 -0
- package/dist/assets/zalando-CenfWOwz.webp +0 -0
- package/dist/browser-adapter.d.ts +4 -0
- package/dist/browser-cutout-capability.d.ts +4 -0
- package/dist/browser-cutout-resources.d.ts +3 -0
- package/dist/browser-local-capabilities.d.ts +5 -0
- package/dist/capabilities.d.ts +18 -0
- package/dist/chunks/AdjustToolPanel-B6dtlFlj.js +195 -0
- package/dist/chunks/BackgroundToolPanel-C3Rr9d4S.js +41 -0
- package/dist/chunks/BatchMaterials-DDoJTaS5.js +806 -0
- package/dist/chunks/BatchModeChoices-DeBARgvY.js +111 -0
- package/dist/chunks/BatchOutputColorPicker-D7WIDS4_.js +75 -0
- package/dist/chunks/BatchReferenceFields-Cr5WgFRJ.js +316 -0
- package/dist/chunks/BeautifyToolPanel-DDZXDQKM.js +215 -0
- package/dist/chunks/BrandMarkToolPanel-vKobk_R3.js +1179 -0
- package/dist/chunks/ContentTrimControl-BKCJEst5.js +297 -0
- package/dist/chunks/CropToolPanel-C_sW5tWL.js +218 -0
- package/dist/chunks/CutoutToolPanel-B7ObmiWd.js +73 -0
- package/dist/chunks/DisclosureToolPanel-F3ccFJIF.js +76 -0
- package/dist/chunks/ExpandToolPanel-BKjj5UJA.js +67 -0
- package/dist/chunks/ImageEffectsToolPanel-CsDIBpT6.js +966 -0
- package/dist/chunks/IpAuditToolPanel-CduDfFh-.js +96 -0
- package/dist/chunks/ListingToolPanel-8pJ2_zvI.js +783 -0
- package/dist/chunks/MaterialSelectionPlate-CW7HaS6v.js +30 -0
- package/dist/chunks/MetadataToolPanel-C8XJOamN.js +104 -0
- package/dist/chunks/OrientToolPanel-C1AzQchm.js +161 -0
- package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-BGe419qz.js +102 -0
- package/dist/chunks/ResizeToolPanel-DWikcj2G.js +1178 -0
- package/dist/chunks/RetouchToolPanel-B4eQKk2W.js +350 -0
- package/dist/chunks/ShadowToolPanel-Bbj76hQd.js +254 -0
- package/dist/chunks/SvgExportToolPanel-BRxpzd7q.js +219 -0
- package/dist/chunks/TranslationToolPanel-Bxv8U2WY.js +125 -0
- package/dist/chunks/UpscaleToolPanel-BRIgpszs.js +127 -0
- package/dist/chunks/engine-D-T-1RSx.js +69 -0
- package/dist/chunks/entry-CboOSe2r.js +42945 -0
- package/dist/chunks/gpu-CScw5MNG.js +231 -0
- package/dist/chunks/hosted-resources-COzZ7nZY.js +8196 -0
- package/dist/chunks/loader-circle-CylCgDqP.js +16 -0
- package/dist/chunks/motionFeatures-D67ghPG1.js +4405 -0
- package/dist/chunks/search-BwsDnulU.js +18 -0
- package/dist/chunks/standard-cutout-vPpP6xBc.js +45 -0
- package/dist/chunks/static-logo-2F9ORZWc.js +34 -0
- package/dist/config.d.ts +66 -0
- package/dist/contracts.d.ts +272 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +13 -0
- package/dist/node/catalog.mjs +45 -0
- package/dist/node/cli.mjs +11 -0
- package/dist/node/index.d.mts +20 -0
- package/dist/node/index.mjs +2 -0
- package/dist/node/prepare.mjs +114 -0
- package/dist/node/vite.mjs +46 -0
- package/dist/processing.d.ts +1 -0
- package/dist/processing.js +12105 -0
- package/dist/remote-contracts.d.ts +114 -0
- package/dist/resource-contracts.d.ts +40 -0
- package/dist/resources/cutout/9ae2e5375a34fa413530954dc20d085d175faffc86108c13619220d0557f80bf.json +1 -0
- package/dist/resources/cutout/f119dabecc64bc436d3d08425dde96ec2598fd40541eba97d8d53a4e8bbdcaea.json +1 -0
- package/dist/resources/cutout/resources.json +195 -0
- package/dist/resources/cutout/sources.json +294 -0
- package/dist/resources.json +1191 -0
- package/dist/service-contracts.d.ts +43 -0
- package/dist/slots.d.ts +21 -0
- package/dist/style.css +1 -0
- package/dist/types/batch/api.d.ts +89 -0
- package/dist/types/batch/cutout-output.d.ts +2 -0
- package/dist/types/batch/features/background/engine.d.mts +12 -0
- package/dist/types/batch/features/basic-edit/contracts.d.ts +87 -0
- package/dist/types/batch/features/basic-edit/engine.d.mts +96 -0
- package/dist/types/batch/features/brand-mark/contracts.d.ts +84 -0
- package/dist/types/batch/features/brand-mark/engine.d.mts +68 -0
- package/dist/types/batch/features/export-compression/contracts.d.ts +44 -0
- package/dist/types/batch/features/export-compression/gifenc.d.ts +33 -0
- package/dist/types/batch/features/export-compression/plan.d.ts +45 -0
- package/dist/types/batch/features/export-compression/presentation.d.ts +70 -0
- package/dist/types/batch/features/export-compression/upng.d.ts +6 -0
- package/dist/types/batch/features/final-image/resize.d.mts +15 -0
- package/dist/types/batch/features/image-effects/contracts.d.ts +58 -0
- package/dist/types/batch/features/image-effects/gpu-pixel-runtime.d.ts +15 -0
- package/dist/types/batch/features/image-effects/photo-audit.d.ts +21 -0
- package/dist/types/batch/features/image-effects/photo-v7-cpu.d.ts +9 -0
- package/dist/types/batch/features/image-effects/profiles-v4.d.ts +157 -0
- package/dist/types/batch/features/image-effects/profiles-v5.d.ts +20 -0
- package/dist/types/batch/features/image-effects/profiles-v6.d.ts +14 -0
- package/dist/types/batch/features/image-effects/profiles-v7.d.ts +53 -0
- package/dist/types/batch/features/image-effects/profiles-v8.d.ts +113 -0
- package/dist/types/batch/features/image-effects/profiles-v9.d.ts +20 -0
- package/dist/types/batch/features/image-translation/params.d.ts +257 -0
- package/dist/types/batch/features/listing-remake/transport.d.ts +21 -0
- package/dist/types/batch/features/metadata/bytes.d.mts +13 -0
- package/dist/types/batch/features/metadata/containers.d.mts +20 -0
- package/dist/types/batch/features/metadata/declaration.d.mts +5 -0
- package/dist/types/batch/features/metadata/engine.d.mts +9 -0
- package/dist/types/batch/features/metadata/exchange.d.mts +48 -0
- package/dist/types/batch/features/shadow/contracts.d.ts +43 -0
- package/dist/types/batch/features/shadow/engine.d.mts +33 -0
- package/dist/types/batch/features/svg-export/download-contract.d.ts +33 -0
- package/dist/types/batch/features/svg-export/download-prepare.d.ts +2 -0
- package/dist/types/batch/features/svg-export/download.d.ts +7 -0
- package/dist/types/batch/features/svg-export/imagetracer.d.ts +6 -0
- package/dist/types/batch/features/svg-export/optimizer.d.ts +2 -0
- package/dist/types/batch/ids.d.ts +1 -0
- package/dist/types/batch/model.d.ts +317 -0
- package/dist/types/batch/public/config.d.ts +66 -0
- package/dist/types/batch/public/contracts.d.ts +272 -0
- package/dist/types/batch/public/remote-contracts.d.ts +114 -0
- package/dist/types/batch/public/resource-contracts.d.ts +40 -0
- package/dist/types/batch/public/service-contracts.d.ts +43 -0
- package/dist/types/batch/queue.d.ts +34 -0
- package/dist/types/batch/receipts.d.ts +85 -0
- package/dist/types/batch/retention.d.ts +13 -0
- package/dist/types/onnxruntime-web.d.ts +5 -0
- package/dist/types/plugins/cutout/core/hosted-resources.d.ts +11 -0
- package/dist/types/processing.d.ts +18 -0
- package/dist/types/shared/svg-security.d.mts +4 -0
- package/dist/types/workspace-worker.d.ts +2 -0
- package/package.json +91 -3
|
@@ -0,0 +1,4405 @@
|
|
|
1
|
+
import { n as W, f as M, M as Y, a as we, b as ds, c as z, p as nt, i as Ae, d as q, e as S, g as Kn, h as Ot, t as Ve, j as bt, k as I, l as _n, v as $n, m as Gn, o as Ze, q as Hn, r as De, s as ps, u as Wn, w as ms, x as zn, y as Xn, z as Yn, A as Ut, B as ys, C as qn } from "./entry-CboOSe2r.js";
|
|
2
|
+
function Ce(t, e) {
|
|
3
|
+
t.indexOf(e) === -1 && t.push(e);
|
|
4
|
+
}
|
|
5
|
+
function Rt(t, e) {
|
|
6
|
+
const i = t.indexOf(e);
|
|
7
|
+
i > -1 && t.splice(i, 1);
|
|
8
|
+
}
|
|
9
|
+
function Je(t, e) {
|
|
10
|
+
return e ? `${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}` : t;
|
|
11
|
+
}
|
|
12
|
+
let St = () => {
|
|
13
|
+
}, ot = () => {
|
|
14
|
+
};
|
|
15
|
+
typeof process < "u" && process.env?.NODE_ENV !== "production" && (St = (t, e, i) => {
|
|
16
|
+
!t && typeof console < "u" && console.warn(Je(e, i));
|
|
17
|
+
}, ot = (t, e, i) => {
|
|
18
|
+
if (!t)
|
|
19
|
+
throw new Error(Je(e, i));
|
|
20
|
+
});
|
|
21
|
+
const Ee = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), gs = (t) => typeof t == "object" && t !== null, Me = (t) => /^0[^.\s]+$/u.test(t);
|
|
22
|
+
// @__NO_SIDE_EFFECTS__
|
|
23
|
+
function vs(t) {
|
|
24
|
+
let e;
|
|
25
|
+
return () => (e === void 0 && (e = t()), e);
|
|
26
|
+
}
|
|
27
|
+
const wt = (...t) => t.reduce((e, i) => (s) => i(e(s))), gt = /* @__NO_SIDE_EFFECTS__ */ (t, e, i) => {
|
|
28
|
+
const s = e - t;
|
|
29
|
+
return s ? (i - t) / s : 1;
|
|
30
|
+
};
|
|
31
|
+
class Lt {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.subscriptions = [];
|
|
34
|
+
}
|
|
35
|
+
add(e) {
|
|
36
|
+
return Ce(this.subscriptions, e), () => this.remove(e);
|
|
37
|
+
}
|
|
38
|
+
remove(e) {
|
|
39
|
+
Rt(this.subscriptions, e);
|
|
40
|
+
}
|
|
41
|
+
notify(e, i, s) {
|
|
42
|
+
const n = this.subscriptions.length;
|
|
43
|
+
if (n)
|
|
44
|
+
if (n === 1)
|
|
45
|
+
this.subscriptions[0](e, i, s);
|
|
46
|
+
else
|
|
47
|
+
for (let r = 0; r < n; r++) {
|
|
48
|
+
const o = this.subscriptions[r];
|
|
49
|
+
o && o(e, i, s);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
getSize() {
|
|
53
|
+
return this.subscriptions.length;
|
|
54
|
+
}
|
|
55
|
+
clear() {
|
|
56
|
+
this.subscriptions.length = 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const K = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, U = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3, xs = /* @__NO_SIDE_EFFECTS__ */ (t, e) => e ? t * (1e3 / e) : 0, Ts = (t, e, i) => (((1 - 3 * i + 3 * e) * t + (3 * i - 6 * e)) * t + 3 * e) * t, Zn = 1e-7, Jn = 12;
|
|
60
|
+
function Qn(t, e, i, s, n) {
|
|
61
|
+
let r, o, a = 0;
|
|
62
|
+
do
|
|
63
|
+
o = e + (i - e) / 2, r = Ts(o, s, n) - t, r > 0 ? i = o : e = o;
|
|
64
|
+
while (Math.abs(r) > Zn && ++a < Jn);
|
|
65
|
+
return o;
|
|
66
|
+
}
|
|
67
|
+
// @__NO_SIDE_EFFECTS__
|
|
68
|
+
function At(t, e, i, s) {
|
|
69
|
+
if (t === e && i === s)
|
|
70
|
+
return W;
|
|
71
|
+
const n = (r) => Qn(r, 0, 1, t, i);
|
|
72
|
+
return (r) => r === 0 || r === 1 ? r : Ts(n(r), e, s);
|
|
73
|
+
}
|
|
74
|
+
const Ps = /* @__NO_SIDE_EFFECTS__ */ (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, bs = /* @__NO_SIDE_EFFECTS__ */ (t) => (e) => 1 - t(1 - e), Ss = /* @__PURE__ */ At(0.33, 1.53, 0.69, 0.99), Re = /* @__PURE__ */ bs(Ss), ws = /* @__PURE__ */ Ps(Re), As = (t) => t >= 1 ? 1 : (t *= 2) < 1 ? 0.5 * Re(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Le = (t) => 1 - Math.sin(Math.acos(t)), Vs = /* @__PURE__ */ bs(Le), Ds = /* @__PURE__ */ Ps(Le), to = /* @__PURE__ */ At(0.42, 0, 1, 1), eo = /* @__PURE__ */ At(0, 0, 0.58, 1), ke = /* @__PURE__ */ At(0.42, 0, 0.58, 1), io = /* @__NO_SIDE_EFFECTS__ */ (t) => Array.isArray(t) && typeof t[0] != "number", Cs = /* @__NO_SIDE_EFFECTS__ */ (t) => Array.isArray(t) && typeof t[0] == "number", Qe = {
|
|
75
|
+
linear: W,
|
|
76
|
+
easeIn: to,
|
|
77
|
+
easeInOut: ke,
|
|
78
|
+
easeOut: eo,
|
|
79
|
+
circIn: Le,
|
|
80
|
+
circInOut: Ds,
|
|
81
|
+
circOut: Vs,
|
|
82
|
+
backIn: Re,
|
|
83
|
+
backInOut: ws,
|
|
84
|
+
backOut: Ss,
|
|
85
|
+
anticipate: As
|
|
86
|
+
}, so = (t) => typeof t == "string", ti = (t) => {
|
|
87
|
+
if (/* @__PURE__ */ Cs(t)) {
|
|
88
|
+
ot(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
|
|
89
|
+
const [e, i, s, n] = t;
|
|
90
|
+
return /* @__PURE__ */ At(e, i, s, n);
|
|
91
|
+
} else if (so(t))
|
|
92
|
+
return ot(Qe[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), Qe[t];
|
|
93
|
+
return t;
|
|
94
|
+
};
|
|
95
|
+
let Dt;
|
|
96
|
+
function no() {
|
|
97
|
+
Dt = void 0;
|
|
98
|
+
}
|
|
99
|
+
const B = {
|
|
100
|
+
now: () => (Dt === void 0 && B.set(M.isProcessing || Y.useManualTiming ? M.timestamp : performance.now()), Dt),
|
|
101
|
+
set: (t) => {
|
|
102
|
+
Dt = t, queueMicrotask(no);
|
|
103
|
+
}
|
|
104
|
+
}, ct = (t) => Math.round(t * 1e5) / 1e5, Be = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
|
|
105
|
+
function oo(t) {
|
|
106
|
+
return t == null;
|
|
107
|
+
}
|
|
108
|
+
const ro = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Fe = (t, e) => (i) => !!(typeof i == "string" && ro.test(i) && i.startsWith(t) || e && !oo(i) && Object.prototype.hasOwnProperty.call(i, e)), Es = (t, e, i) => (s) => {
|
|
109
|
+
if (typeof s != "string")
|
|
110
|
+
return s;
|
|
111
|
+
const [n, r, o, a] = s.match(Be);
|
|
112
|
+
return {
|
|
113
|
+
[t]: parseFloat(n),
|
|
114
|
+
[e]: parseFloat(r),
|
|
115
|
+
[i]: parseFloat(o),
|
|
116
|
+
alpha: a !== void 0 ? parseFloat(a) : 1
|
|
117
|
+
};
|
|
118
|
+
}, ao = (t) => z(0, 255, t), Kt = {
|
|
119
|
+
...we,
|
|
120
|
+
transform: (t) => Math.round(ao(t))
|
|
121
|
+
}, tt = {
|
|
122
|
+
test: /* @__PURE__ */ Fe("rgb", "red"),
|
|
123
|
+
parse: /* @__PURE__ */ Es("red", "green", "blue"),
|
|
124
|
+
transform: ({ red: t, green: e, blue: i, alpha: s = 1 }) => "rgba(" + Kt.transform(t) + ", " + Kt.transform(e) + ", " + Kt.transform(i) + ", " + ct(ds.transform(s)) + ")"
|
|
125
|
+
};
|
|
126
|
+
function lo(t) {
|
|
127
|
+
let e = "", i = "", s = "", n = "";
|
|
128
|
+
return t.length > 5 ? (e = t.substring(1, 3), i = t.substring(3, 5), s = t.substring(5, 7), n = t.substring(7, 9)) : (e = t.substring(1, 2), i = t.substring(2, 3), s = t.substring(3, 4), n = t.substring(4, 5), e += e, i += i, s += s, n += n), {
|
|
129
|
+
red: parseInt(e, 16),
|
|
130
|
+
green: parseInt(i, 16),
|
|
131
|
+
blue: parseInt(s, 16),
|
|
132
|
+
alpha: n ? parseInt(n, 16) / 255 : 1
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const ee = {
|
|
136
|
+
test: /* @__PURE__ */ Fe("#"),
|
|
137
|
+
parse: lo,
|
|
138
|
+
transform: tt.transform
|
|
139
|
+
}, at = {
|
|
140
|
+
test: /* @__PURE__ */ Fe("hsl", "hue"),
|
|
141
|
+
parse: /* @__PURE__ */ Es("hue", "saturation", "lightness"),
|
|
142
|
+
transform: ({ hue: t, saturation: e, lightness: i, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + nt.transform(ct(e)) + ", " + nt.transform(ct(i)) + ", " + ct(ds.transform(s)) + ")"
|
|
143
|
+
}, R = {
|
|
144
|
+
test: (t) => tt.test(t) || ee.test(t) || at.test(t),
|
|
145
|
+
parse: (t) => tt.test(t) ? tt.parse(t) : at.test(t) ? at.parse(t) : ee.parse(t),
|
|
146
|
+
transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? tt.transform(t) : at.transform(t),
|
|
147
|
+
getAnimatableNone: (t) => {
|
|
148
|
+
const e = R.parse(t);
|
|
149
|
+
return e.alpha = 0, R.transform(e);
|
|
150
|
+
}
|
|
151
|
+
}, co = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu, Ms = /* @__PURE__ */ new RegExp(Be.source), Rs = /* @__PURE__ */ new RegExp(co.source, "i");
|
|
152
|
+
function uo(t) {
|
|
153
|
+
return isNaN(t) && typeof t == "string" && (Ms.test(t) || Rs.test(t));
|
|
154
|
+
}
|
|
155
|
+
const Ls = "number", ks = "color", ho = "var", fo = "var(", ei = "${}", po = /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;
|
|
156
|
+
function mo(t) {
|
|
157
|
+
const e = t.toString();
|
|
158
|
+
return Ms.test(e) || Rs.test(e);
|
|
159
|
+
}
|
|
160
|
+
function vt(t) {
|
|
161
|
+
const e = t.toString(), i = [], s = {
|
|
162
|
+
color: [],
|
|
163
|
+
number: [],
|
|
164
|
+
var: []
|
|
165
|
+
}, n = [];
|
|
166
|
+
let r = 0;
|
|
167
|
+
const a = e.replace(po, (l) => (R.test(l) ? (s.color.push(r), n.push(ks), i.push(R.parse(l))) : l.startsWith(fo) ? (s.var.push(r), n.push(ho), i.push(l)) : (s.number.push(r), n.push(Ls), i.push(parseFloat(l))), ++r, ei)).split(ei);
|
|
168
|
+
return { values: i, split: a, indexes: s, types: n };
|
|
169
|
+
}
|
|
170
|
+
function yo(t) {
|
|
171
|
+
return vt(t).values;
|
|
172
|
+
}
|
|
173
|
+
function Bs({ split: t, types: e }) {
|
|
174
|
+
const i = t.length;
|
|
175
|
+
return (s) => {
|
|
176
|
+
let n = "";
|
|
177
|
+
for (let r = 0; r < i; r++)
|
|
178
|
+
if (n += t[r], s[r] !== void 0) {
|
|
179
|
+
const o = e[r];
|
|
180
|
+
o === Ls ? n += ct(s[r]) : o === ks ? n += R.transform(s[r]) : n += s[r];
|
|
181
|
+
}
|
|
182
|
+
return n;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function go(t) {
|
|
186
|
+
return Bs(vt(t));
|
|
187
|
+
}
|
|
188
|
+
const vo = (t) => typeof t == "number" ? 0 : R.test(t) ? R.getAnimatableNone(t) : t, xo = (t, e) => typeof t == "number" ? e?.trim().endsWith("/") ? t : 0 : vo(t);
|
|
189
|
+
function To(t) {
|
|
190
|
+
const e = vt(t);
|
|
191
|
+
return Bs(e)(e.values.map((s, n) => xo(s, e.split[n])));
|
|
192
|
+
}
|
|
193
|
+
const j = {
|
|
194
|
+
test: uo,
|
|
195
|
+
parse: yo,
|
|
196
|
+
createTransformer: go,
|
|
197
|
+
getAnimatableNone: To
|
|
198
|
+
};
|
|
199
|
+
function _t(t, e, i) {
|
|
200
|
+
return i < 0 && (i += 1), i > 1 && (i -= 1), i < 1 / 6 ? t + (e - t) * 6 * i : i < 1 / 2 ? e : i < 2 / 3 ? t + (e - t) * (2 / 3 - i) * 6 : t;
|
|
201
|
+
}
|
|
202
|
+
function Po({ hue: t, saturation: e, lightness: i, alpha: s }) {
|
|
203
|
+
t /= 360, e /= 100, i /= 100;
|
|
204
|
+
let n = 0, r = 0, o = 0;
|
|
205
|
+
if (!e)
|
|
206
|
+
n = r = o = i;
|
|
207
|
+
else {
|
|
208
|
+
const a = i < 0.5 ? i * (1 + e) : i + e - i * e, l = 2 * i - a;
|
|
209
|
+
n = _t(l, a, t + 1 / 3), r = _t(l, a, t), o = _t(l, a, t - 1 / 3);
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
red: Math.round(n * 255),
|
|
213
|
+
green: Math.round(r * 255),
|
|
214
|
+
blue: Math.round(o * 255),
|
|
215
|
+
alpha: s
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function kt(t, e) {
|
|
219
|
+
return (i) => i > 0 ? e : t;
|
|
220
|
+
}
|
|
221
|
+
const w = (t, e, i) => t + (e - t) * i, $t = (t, e, i) => {
|
|
222
|
+
const s = t * t, n = i * (e * e - s) + s;
|
|
223
|
+
return n < 0 ? 0 : Math.sqrt(n);
|
|
224
|
+
}, bo = [ee, tt, at], So = (t) => bo.find((e) => e.test(t));
|
|
225
|
+
function ii(t) {
|
|
226
|
+
const e = So(t);
|
|
227
|
+
if (!e)
|
|
228
|
+
return St(!1, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !1;
|
|
229
|
+
let i = e.parse(t);
|
|
230
|
+
return e === at && (i = Po(i)), i;
|
|
231
|
+
}
|
|
232
|
+
const si = (t, e) => {
|
|
233
|
+
const i = ii(t), s = ii(e);
|
|
234
|
+
if (!i || !s)
|
|
235
|
+
return kt(t, e);
|
|
236
|
+
const n = { ...i };
|
|
237
|
+
return (r) => (n.red = $t(i.red, s.red, r), n.green = $t(i.green, s.green, r), n.blue = $t(i.blue, s.blue, r), n.alpha = w(i.alpha, s.alpha, r), tt.transform(n));
|
|
238
|
+
}, ie = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
239
|
+
function wo(t, e) {
|
|
240
|
+
return ie.has(t) ? (i) => i <= 0 ? t : e : (i) => i >= 1 ? e : t;
|
|
241
|
+
}
|
|
242
|
+
function Ao(t, e) {
|
|
243
|
+
return (i) => w(t, e, i);
|
|
244
|
+
}
|
|
245
|
+
function Ie(t) {
|
|
246
|
+
return typeof t == "number" ? Ao : typeof t == "string" ? Ae(t) ? kt : R.test(t) ? si : Co : Array.isArray(t) ? Fs : typeof t == "object" ? R.test(t) ? si : Vo : kt;
|
|
247
|
+
}
|
|
248
|
+
function Fs(t, e) {
|
|
249
|
+
const i = [...t], s = i.length, n = t.map((r, o) => Ie(r)(r, e[o]));
|
|
250
|
+
return (r) => {
|
|
251
|
+
for (let o = 0; o < s; o++)
|
|
252
|
+
i[o] = n[o](r);
|
|
253
|
+
return i;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function Vo(t, e) {
|
|
257
|
+
const i = { ...t, ...e }, s = {};
|
|
258
|
+
for (const n in i)
|
|
259
|
+
t[n] !== void 0 && e[n] !== void 0 && (s[n] = Ie(t[n])(t[n], e[n]));
|
|
260
|
+
return (n) => {
|
|
261
|
+
for (const r in s)
|
|
262
|
+
i[r] = s[r](n);
|
|
263
|
+
return i;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function Do(t, e) {
|
|
267
|
+
const i = [], s = { color: 0, var: 0, number: 0 };
|
|
268
|
+
for (let n = 0; n < e.values.length; n++) {
|
|
269
|
+
const r = e.types[n], o = t.indexes[r][s[r]], a = t.values[o] ?? 0;
|
|
270
|
+
i[n] = a, s[r]++;
|
|
271
|
+
}
|
|
272
|
+
return i;
|
|
273
|
+
}
|
|
274
|
+
const Co = (t, e) => {
|
|
275
|
+
const i = j.createTransformer(e), s = vt(t), n = vt(e);
|
|
276
|
+
return s.indexes.var.length === n.indexes.var.length && s.indexes.color.length === n.indexes.color.length && s.indexes.number.length >= n.indexes.number.length ? ie.has(t) && !n.values.length || ie.has(e) && !s.values.length ? wo(t, e) : wt(Fs(Do(s, n), n.values), i) : (St(!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.`, "complex-values-different"), kt(t, e));
|
|
277
|
+
}, ni = /^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;
|
|
278
|
+
function Eo(t, e) {
|
|
279
|
+
const i = ni.exec(t);
|
|
280
|
+
if (!i)
|
|
281
|
+
return;
|
|
282
|
+
const s = ni.exec(e);
|
|
283
|
+
if (!s || i[2] !== s[2])
|
|
284
|
+
return;
|
|
285
|
+
const n = i[2], r = parseFloat(i[1]), o = parseFloat(s[1]);
|
|
286
|
+
return (a) => ct(w(r, o, a)) + n;
|
|
287
|
+
}
|
|
288
|
+
function je(t, e, i) {
|
|
289
|
+
if (typeof t == "number" && typeof e == "number" && typeof i == "number")
|
|
290
|
+
return w(t, e, i);
|
|
291
|
+
if (typeof t == "string" && typeof e == "string") {
|
|
292
|
+
const n = Eo(t, e);
|
|
293
|
+
if (n)
|
|
294
|
+
return n;
|
|
295
|
+
}
|
|
296
|
+
return Ie(t)(t, e);
|
|
297
|
+
}
|
|
298
|
+
const Mo = (t) => {
|
|
299
|
+
const e = ({ timestamp: i }) => t(i);
|
|
300
|
+
return {
|
|
301
|
+
start: (i = !0) => S.update(e, i),
|
|
302
|
+
stop: () => q(e),
|
|
303
|
+
/**
|
|
304
|
+
* If we're processing this frame we can use the
|
|
305
|
+
* framelocked timestamp to keep things in sync.
|
|
306
|
+
*/
|
|
307
|
+
now: () => M.isProcessing ? M.timestamp : B.now()
|
|
308
|
+
};
|
|
309
|
+
}, Is = (t, e, i = 10) => {
|
|
310
|
+
let s = "";
|
|
311
|
+
const n = Math.max(Math.round(e / i), 2);
|
|
312
|
+
for (let r = 0; r < n; r++)
|
|
313
|
+
s += Math.round(t(r / (n - 1)) * 1e4) / 1e4 + ", ";
|
|
314
|
+
return `linear(${s.substring(0, s.length - 2)})`;
|
|
315
|
+
}, Oe = 2e4;
|
|
316
|
+
function Ne(t, e = 50, i = Oe, s) {
|
|
317
|
+
let n = 0, r = t.next(n);
|
|
318
|
+
for (; !r.done && n < i; )
|
|
319
|
+
n += e, r = t.next(n);
|
|
320
|
+
return n >= i ? 1 / 0 : n;
|
|
321
|
+
}
|
|
322
|
+
function Ro(t, e = 100, i) {
|
|
323
|
+
const s = i({ ...t, keyframes: [0, e] }), n = Math.min(Ne(s), Oe);
|
|
324
|
+
return {
|
|
325
|
+
type: "keyframes",
|
|
326
|
+
ease: (r) => s.next(n * r).value / e,
|
|
327
|
+
duration: /* @__PURE__ */ U(n)
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const L = {
|
|
331
|
+
// Default spring physics
|
|
332
|
+
stiffness: 100,
|
|
333
|
+
damping: 10,
|
|
334
|
+
mass: 1,
|
|
335
|
+
// Default duration/bounce-based options
|
|
336
|
+
duration: 800,
|
|
337
|
+
// in ms
|
|
338
|
+
bounce: 0.3,
|
|
339
|
+
visualDuration: 0.3,
|
|
340
|
+
// in seconds
|
|
341
|
+
// Rest thresholds
|
|
342
|
+
restSpeed: {
|
|
343
|
+
granular: 0.01,
|
|
344
|
+
default: 2
|
|
345
|
+
},
|
|
346
|
+
restDelta: {
|
|
347
|
+
granular: 5e-3,
|
|
348
|
+
default: 0.5
|
|
349
|
+
},
|
|
350
|
+
// Limits
|
|
351
|
+
minDuration: 0.01,
|
|
352
|
+
// in seconds
|
|
353
|
+
maxDuration: 10,
|
|
354
|
+
// in seconds
|
|
355
|
+
minDamping: 0.05,
|
|
356
|
+
maxDamping: 1
|
|
357
|
+
};
|
|
358
|
+
function se(t, e) {
|
|
359
|
+
return t * Math.sqrt(1 - e * e);
|
|
360
|
+
}
|
|
361
|
+
const Lo = 12;
|
|
362
|
+
function ko(t, e, i) {
|
|
363
|
+
let s = i;
|
|
364
|
+
for (let n = 1; n < Lo; n++)
|
|
365
|
+
s = s - t(s) / e(s);
|
|
366
|
+
return s;
|
|
367
|
+
}
|
|
368
|
+
const Gt = 1e-3;
|
|
369
|
+
function Bo({ duration: t = L.duration, bounce: e = L.bounce }) {
|
|
370
|
+
let i, s;
|
|
371
|
+
St(t <= /* @__PURE__ */ K(L.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
372
|
+
let n = 1 - e;
|
|
373
|
+
n = z(L.minDamping, L.maxDamping, n), t = z(L.minDuration, L.maxDuration, /* @__PURE__ */ U(t)), n < 1 ? (i = (l) => {
|
|
374
|
+
const u = l * n, c = u * t, h = se(l, n), f = Math.exp(-c);
|
|
375
|
+
return Gt - u / h * f;
|
|
376
|
+
}, s = (l) => {
|
|
377
|
+
const c = l * n * t, h = n * n * l * l * t, f = Math.exp(-c), m = se(l * l, n);
|
|
378
|
+
return (-i(l) + Gt > 0 ? -1 : 1) * -h * f / m;
|
|
379
|
+
}) : (i = (l) => {
|
|
380
|
+
const u = Math.exp(-l * t), c = l * t + 1;
|
|
381
|
+
return -Gt + u * c;
|
|
382
|
+
}, s = (l) => {
|
|
383
|
+
const u = Math.exp(-l * t), c = -l * (t * t);
|
|
384
|
+
return u * c;
|
|
385
|
+
});
|
|
386
|
+
const r = 5 / t, o = ko(i, s, r), a = o * o;
|
|
387
|
+
return {
|
|
388
|
+
stiffness: a,
|
|
389
|
+
damping: n * 2 * Math.sqrt(a),
|
|
390
|
+
duration: /* @__PURE__ */ K(t)
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
const ne = (t, e) => (e ? t >= 0 : t > 0) && t < 1 / 0;
|
|
394
|
+
function Ht(t, e) {
|
|
395
|
+
if (ne(t, e))
|
|
396
|
+
return t;
|
|
397
|
+
}
|
|
398
|
+
function Fo(t) {
|
|
399
|
+
const e = Ht(t.stiffness), i = Ht(t.damping, !0), s = Ht(t.mass), n = {
|
|
400
|
+
...t,
|
|
401
|
+
stiffness: e ?? L.stiffness,
|
|
402
|
+
damping: i ?? L.damping,
|
|
403
|
+
mass: s ?? L.mass,
|
|
404
|
+
isResolvedFromDuration: !1,
|
|
405
|
+
// stiffness/damping/mass overrides duration/bounce
|
|
406
|
+
isTimeDefined: (e ?? i ?? s) === void 0 && (t.duration !== void 0 || t.bounce !== void 0)
|
|
407
|
+
};
|
|
408
|
+
if (n.isTimeDefined) {
|
|
409
|
+
if (t.visualDuration) {
|
|
410
|
+
const r = 2 * Math.PI / (t.visualDuration * 1.2);
|
|
411
|
+
n.stiffness = r * r, n.damping = 2 * z(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(n.stiffness);
|
|
412
|
+
} else
|
|
413
|
+
Object.assign(n, Bo(n)), n.isResolvedFromDuration = !0;
|
|
414
|
+
(!ne(n.stiffness) || !ne(n.damping, !0)) && (n.stiffness = L.stiffness, n.damping = L.damping);
|
|
415
|
+
}
|
|
416
|
+
return n;
|
|
417
|
+
}
|
|
418
|
+
function Bt(t = L.visualDuration, e = L.bounce) {
|
|
419
|
+
const i = typeof t != "object" ? {
|
|
420
|
+
visualDuration: t,
|
|
421
|
+
keyframes: [0, 1],
|
|
422
|
+
bounce: e
|
|
423
|
+
} : t, s = i.keyframes[0], n = i.keyframes[i.keyframes.length - 1], r = { done: !1, value: s }, { stiffness: o, damping: a, mass: l, duration: u, isResolvedFromDuration: c, isTimeDefined: h } = Fo({ ...i }), f = (y) => h ? 0 : -/* @__PURE__ */ U(y), m = a / (2 * Math.sqrt(o * l)), d = /* @__PURE__ */ U(Math.sqrt(o / l)), v = m * d, p = {
|
|
424
|
+
target: n,
|
|
425
|
+
delta: n - s,
|
|
426
|
+
velocity: f(i.velocity || 0) || 0,
|
|
427
|
+
restSpeed: 0,
|
|
428
|
+
restDelta: 0
|
|
429
|
+
}, x = () => {
|
|
430
|
+
const y = Math.abs(p.delta) < 5;
|
|
431
|
+
p.restSpeed = i.restSpeed || (y ? L.restSpeed.granular : L.restSpeed.default), p.restDelta = i.restDelta || (y ? L.restDelta.granular : L.restDelta.default);
|
|
432
|
+
};
|
|
433
|
+
x();
|
|
434
|
+
let T, P, b;
|
|
435
|
+
if (m < 1) {
|
|
436
|
+
const y = se(d, m), g = { A: 0, sinC: 0, cosC: 0, t: -1, env: 0, sin: 0, cos: 0 };
|
|
437
|
+
b = () => {
|
|
438
|
+
g.A = (p.velocity + v * p.delta) / y, g.sinC = v * g.A + p.delta * y, g.cosC = v * p.delta - g.A * y;
|
|
439
|
+
};
|
|
440
|
+
const C = (V) => {
|
|
441
|
+
V !== g.t && (g.t = V, g.env = Math.exp(-v * V), g.sin = Math.sin(y * V), g.cos = Math.cos(y * V));
|
|
442
|
+
};
|
|
443
|
+
T = (V) => (C(V), p.target - g.env * (g.A * g.sin + p.delta * g.cos)), P = (V) => (C(V), g.env * (g.sinC * g.sin + g.cosC * g.cos));
|
|
444
|
+
} else if (m === 1) {
|
|
445
|
+
T = (g) => p.target - Math.exp(-d * g) * (p.delta + (p.velocity + d * p.delta) * g);
|
|
446
|
+
const y = { C: 0 };
|
|
447
|
+
b = () => {
|
|
448
|
+
y.C = p.velocity + d * p.delta;
|
|
449
|
+
}, P = (g) => Math.exp(-d * g) * (d * y.C * g - p.velocity);
|
|
450
|
+
} else {
|
|
451
|
+
const y = d * Math.sqrt(m * m - 1);
|
|
452
|
+
T = (C) => {
|
|
453
|
+
const V = Math.exp(-v * C), O = Math.min(y * C, 300);
|
|
454
|
+
return p.target - V * ((p.velocity + v * p.delta) * Math.sinh(O) + y * p.delta * Math.cosh(O)) / y;
|
|
455
|
+
};
|
|
456
|
+
const g = { P: 0, sinh: 0, cosh: 0 };
|
|
457
|
+
b = () => {
|
|
458
|
+
g.P = (p.velocity + v * p.delta) / y, g.sinh = v * g.P - p.delta * y, g.cosh = v * p.delta - g.P * y;
|
|
459
|
+
}, P = (C) => {
|
|
460
|
+
const V = Math.exp(-v * C), O = Math.min(y * C, 300);
|
|
461
|
+
return V * (g.sinh * Math.sinh(O) + g.cosh * Math.cosh(O));
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
b();
|
|
465
|
+
const A = c && u || null, D = {
|
|
466
|
+
calculatedDuration: A,
|
|
467
|
+
/**
|
|
468
|
+
* Aim the spring at a new target from its current position and
|
|
469
|
+
* velocity, reusing the resolved physics and closures.
|
|
470
|
+
*/
|
|
471
|
+
retarget: (y, g) => {
|
|
472
|
+
p.target = y[y.length - 1], p.delta = p.target - y[0], p.velocity = f(g), i.restSpeed && i.restDelta || x(), D.calculatedDuration = A, r.done = !1, b();
|
|
473
|
+
},
|
|
474
|
+
velocity: (y) => /* @__PURE__ */ K(P(y)),
|
|
475
|
+
next: (y) => {
|
|
476
|
+
const g = T(y);
|
|
477
|
+
if (c)
|
|
478
|
+
r.done = y >= u;
|
|
479
|
+
else {
|
|
480
|
+
const C = /* @__PURE__ */ K(P(y));
|
|
481
|
+
r.done = Math.abs(C) <= p.restSpeed && Math.abs(p.target - g) <= p.restDelta;
|
|
482
|
+
}
|
|
483
|
+
return r.value = r.done ? p.target : g, r;
|
|
484
|
+
},
|
|
485
|
+
toString: () => {
|
|
486
|
+
const y = Math.min(Ne(D), Oe), g = Is((C) => D.next(y * C).value, y, 30);
|
|
487
|
+
return y + "ms " + g;
|
|
488
|
+
},
|
|
489
|
+
toTransition: () => {
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
return D;
|
|
493
|
+
}
|
|
494
|
+
Bt.applyToOptions = (t) => {
|
|
495
|
+
const e = Ro(t, 100, Bt);
|
|
496
|
+
return t.ease = e.ease, t.duration = /* @__PURE__ */ K(e.duration), t.type = "keyframes", t;
|
|
497
|
+
};
|
|
498
|
+
function oe({ keyframes: t, velocity: e = 0, power: i = 0.8, timeConstant: s = 325, bounceDamping: n = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: l, restDelta: u = 0.5, restSpeed: c }) {
|
|
499
|
+
const h = t[0], f = {
|
|
500
|
+
done: !1,
|
|
501
|
+
value: h
|
|
502
|
+
}, m = (y) => y < a || y > l, d = (y) => a === void 0 ? l : l === void 0 || Math.abs(a - y) < Math.abs(l - y) ? a : l;
|
|
503
|
+
let v = i * e;
|
|
504
|
+
const p = h + v, x = o === void 0 ? p : o(p);
|
|
505
|
+
x !== p && (v = x - h);
|
|
506
|
+
const T = (y) => -v * Math.exp(-y / s), P = (y) => {
|
|
507
|
+
const g = T(y);
|
|
508
|
+
f.done = Math.abs(g) <= u, f.value = f.done ? x : x + g;
|
|
509
|
+
};
|
|
510
|
+
let b, A;
|
|
511
|
+
const D = (y) => {
|
|
512
|
+
m(f.value) && (b = y, A = Bt({
|
|
513
|
+
keyframes: [f.value, d(f.value)],
|
|
514
|
+
/**
|
|
515
|
+
* The friction curve is target + calcDelta(t), so its exact
|
|
516
|
+
* derivative is -calcDelta(t) / timeConstant in units/ms,
|
|
517
|
+
* converted here to the units/second expected by spring.
|
|
518
|
+
*/
|
|
519
|
+
velocity: -T(y) / s * 1e3,
|
|
520
|
+
damping: n,
|
|
521
|
+
stiffness: r,
|
|
522
|
+
restDelta: u,
|
|
523
|
+
restSpeed: c
|
|
524
|
+
}));
|
|
525
|
+
};
|
|
526
|
+
return D(0), {
|
|
527
|
+
calculatedDuration: null,
|
|
528
|
+
next: (y) => {
|
|
529
|
+
let g = !1;
|
|
530
|
+
return !A && b === void 0 && (g = !0, P(y), D(y)), b !== void 0 && y >= b ? A.next(y - b) : (!g && P(y), f);
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function Io(t, e, i) {
|
|
535
|
+
const s = [], n = i || Y.mix || je, r = t.length - 1;
|
|
536
|
+
for (let o = 0; o < r; o++) {
|
|
537
|
+
let a = n(t[o], t[o + 1]);
|
|
538
|
+
if (e) {
|
|
539
|
+
const l = Array.isArray(e) ? e[o] || W : e;
|
|
540
|
+
a = wt(l, a);
|
|
541
|
+
}
|
|
542
|
+
s.push(a);
|
|
543
|
+
}
|
|
544
|
+
return s;
|
|
545
|
+
}
|
|
546
|
+
function jo(t, e, { clamp: i = !0, ease: s, mixer: n } = {}) {
|
|
547
|
+
const r = t.length;
|
|
548
|
+
if (ot(r === e.length, "Both input and output ranges must be the same length", "range-length"), r === 1)
|
|
549
|
+
return () => e[0];
|
|
550
|
+
if (r === 2 && e[0] === e[1])
|
|
551
|
+
return () => e[1];
|
|
552
|
+
const o = t[0] === t[1];
|
|
553
|
+
t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
|
|
554
|
+
const a = Io(e, s, n), l = a.length, u = (c) => {
|
|
555
|
+
if (o && c < t[0])
|
|
556
|
+
return e[0];
|
|
557
|
+
let h = 0;
|
|
558
|
+
if (l > 1)
|
|
559
|
+
for (; h < t.length - 2 && !(c < t[h + 1]); h++)
|
|
560
|
+
;
|
|
561
|
+
const f = /* @__PURE__ */ gt(t[h], t[h + 1], c);
|
|
562
|
+
return a[h](f);
|
|
563
|
+
};
|
|
564
|
+
return i ? (c) => u(z(t[0], t[r - 1], c)) : u;
|
|
565
|
+
}
|
|
566
|
+
function Oo(t, e) {
|
|
567
|
+
const i = t[t.length - 1];
|
|
568
|
+
for (let s = 1; s <= e; s++) {
|
|
569
|
+
const n = /* @__PURE__ */ gt(0, e, s);
|
|
570
|
+
t.push(w(i, 1, n));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function No(t) {
|
|
574
|
+
const e = [0];
|
|
575
|
+
return Oo(e, t.length - 1), e;
|
|
576
|
+
}
|
|
577
|
+
function Uo(t, e) {
|
|
578
|
+
return t.map((i) => i * e);
|
|
579
|
+
}
|
|
580
|
+
function Ko(t, e) {
|
|
581
|
+
return t.map(() => e || ke).splice(0, t.length - 1);
|
|
582
|
+
}
|
|
583
|
+
function pt({ duration: t = 300, keyframes: e, times: i, ease: s = "easeInOut" }) {
|
|
584
|
+
const n = /* @__PURE__ */ io(s) ? s.map(ti) : ti(s) || ke, r = {
|
|
585
|
+
done: !1,
|
|
586
|
+
value: e[0]
|
|
587
|
+
};
|
|
588
|
+
if (e.length === 2 && !Array.isArray(n) && (!i || i.length !== 2 || i[0] === 0 && i[1] === 1)) {
|
|
589
|
+
const [l, u] = e, c = l === u ? void 0 : (Y.mix || je)(l, u);
|
|
590
|
+
return {
|
|
591
|
+
calculatedDuration: t,
|
|
592
|
+
next: (h) => (r.value = c ? c(n(t > 0 ? z(0, 1, h / t) : 1)) : u, r.done = h >= t, r)
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
const o = Uo(
|
|
596
|
+
// Only use the provided offsets if they're the correct length
|
|
597
|
+
// TODO Maybe we should warn here if there's a length mismatch
|
|
598
|
+
i && i.length === e.length ? i : No(e),
|
|
599
|
+
t
|
|
600
|
+
), a = jo(o, e, {
|
|
601
|
+
ease: Array.isArray(n) ? n : Ko(e, n)
|
|
602
|
+
});
|
|
603
|
+
return {
|
|
604
|
+
calculatedDuration: t,
|
|
605
|
+
next: (l) => (r.value = a(l), r.done = l >= t, r)
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
const _o = 5;
|
|
609
|
+
function $o(t, e, i) {
|
|
610
|
+
const s = Math.max(e - _o, 0);
|
|
611
|
+
return /* @__PURE__ */ xs(i - t(s), e - s);
|
|
612
|
+
}
|
|
613
|
+
function Go(t, e, i = 0) {
|
|
614
|
+
return e <= 0 ? i : t.velocity ? t.velocity(e) : $o((s) => t.next(s).value, e, t.next(e).value);
|
|
615
|
+
}
|
|
616
|
+
const Ho = (t) => t !== null;
|
|
617
|
+
function Nt(t, { repeat: e, repeatType: i = "loop" }, s, n = 1) {
|
|
618
|
+
const r = t.filter(Ho), a = n < 0 || e && i !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
|
|
619
|
+
return !a || s === void 0 ? r[a] : s;
|
|
620
|
+
}
|
|
621
|
+
const Wo = {
|
|
622
|
+
decay: oe,
|
|
623
|
+
inertia: oe,
|
|
624
|
+
tween: pt,
|
|
625
|
+
keyframes: pt,
|
|
626
|
+
spring: Bt
|
|
627
|
+
};
|
|
628
|
+
function js(t) {
|
|
629
|
+
typeof t.type == "string" && (t.type = Wo[t.type]);
|
|
630
|
+
}
|
|
631
|
+
function Os(t, e) {
|
|
632
|
+
return {
|
|
633
|
+
kind: t,
|
|
634
|
+
animation: e,
|
|
635
|
+
timestamp: B.now(),
|
|
636
|
+
frameTimestamp: M.timestamp,
|
|
637
|
+
frameIsProcessing: M.isProcessing
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function Ns(t, e, i) {
|
|
641
|
+
const s = globalThis.__MOTION_INSPECT__;
|
|
642
|
+
if (s)
|
|
643
|
+
try {
|
|
644
|
+
s({
|
|
645
|
+
...Os("animation-start", t),
|
|
646
|
+
options: i ? { ...e, ...i } : e
|
|
647
|
+
});
|
|
648
|
+
} catch {
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
function zo(t, e) {
|
|
652
|
+
const i = globalThis.__MOTION_INSPECT__;
|
|
653
|
+
if (i)
|
|
654
|
+
try {
|
|
655
|
+
i({
|
|
656
|
+
...Os("layout-animation-start", t),
|
|
657
|
+
node: e
|
|
658
|
+
});
|
|
659
|
+
} catch {
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
class Ue {
|
|
663
|
+
constructor() {
|
|
664
|
+
this.isResolved = !1;
|
|
665
|
+
}
|
|
666
|
+
get finished() {
|
|
667
|
+
return this._finished || (this._finished = this.isResolved ? Promise.resolve() : new Promise((e) => {
|
|
668
|
+
this._resolve = e;
|
|
669
|
+
})), this._finished;
|
|
670
|
+
}
|
|
671
|
+
updateFinished() {
|
|
672
|
+
this._finished = this._resolve = void 0, this.isResolved = !1;
|
|
673
|
+
}
|
|
674
|
+
notifyFinished() {
|
|
675
|
+
this.isResolved = !0, this._resolve?.();
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Allows the animation to be awaited.
|
|
679
|
+
*
|
|
680
|
+
* @deprecated Use `finished` instead.
|
|
681
|
+
*/
|
|
682
|
+
then(e, i) {
|
|
683
|
+
return this.finished.then(e, i);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const Xo = (t) => t / 100;
|
|
687
|
+
class Ft extends Ue {
|
|
688
|
+
constructor(e) {
|
|
689
|
+
super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.delayState = {
|
|
690
|
+
done: !1,
|
|
691
|
+
value: void 0
|
|
692
|
+
}, this.stop = () => {
|
|
693
|
+
const { motionValue: i } = this.options;
|
|
694
|
+
i && i.updatedAt !== B.now() && this.tick(B.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
|
|
695
|
+
}, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause(), Ns(this, this.options);
|
|
696
|
+
}
|
|
697
|
+
initAnimation() {
|
|
698
|
+
const { options: e } = this;
|
|
699
|
+
js(e);
|
|
700
|
+
const { type: i = pt, repeat: s = 0, repeatDelay: n = 0, repeatType: r, velocity: o = 0 } = e;
|
|
701
|
+
let { keyframes: a } = e;
|
|
702
|
+
const l = i || pt;
|
|
703
|
+
l !== pt && typeof a[0] != "number" && (this.mixKeyframes = wt(Xo, je(a[0], a[1])), a = [0, 100]);
|
|
704
|
+
const u = l(a === e.keyframes ? e : { ...e, keyframes: a });
|
|
705
|
+
r === "mirror" && (this.mirroredGenerator = l({
|
|
706
|
+
...e,
|
|
707
|
+
keyframes: [...a].reverse(),
|
|
708
|
+
velocity: -o
|
|
709
|
+
})), u.calculatedDuration === null && (u.calculatedDuration = Ne(u));
|
|
710
|
+
const { calculatedDuration: c } = u;
|
|
711
|
+
this.calculatedDuration = c, this.resolvedDuration = c + n, this.totalDuration = this.resolvedDuration * (s + 1) - n, this.generator = u;
|
|
712
|
+
}
|
|
713
|
+
updateTime(e) {
|
|
714
|
+
const i = Math.round(e - this.startTime) * this.playbackSpeed;
|
|
715
|
+
this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = i;
|
|
716
|
+
}
|
|
717
|
+
tick(e, i = !1) {
|
|
718
|
+
const { generator: s, totalDuration: n, mixKeyframes: r, mirroredGenerator: o, resolvedDuration: a, calculatedDuration: l } = this;
|
|
719
|
+
if (this.startTime === null)
|
|
720
|
+
return s.next(0);
|
|
721
|
+
const { delay: u = 0, keyframes: c, repeat: h, repeatType: f, repeatDelay: m, type: d, onUpdate: v, finalKeyframe: p } = this.options;
|
|
722
|
+
this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - n / this.speed, this.startTime)), i ? this.currentTime = e : this.updateTime(e);
|
|
723
|
+
const x = this.currentTime - u * (this.playbackSpeed >= 0 ? 1 : -1), T = this.playbackSpeed >= 0 ? x < 0 : x > n;
|
|
724
|
+
this.currentTime = Math.max(x, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = n);
|
|
725
|
+
let P = this.currentTime, b = s;
|
|
726
|
+
if (h) {
|
|
727
|
+
const g = Math.min(this.currentTime, n) / a;
|
|
728
|
+
let C = Math.floor(g), V = g % 1;
|
|
729
|
+
!V && g >= 1 && (V = 1), V === 1 && C--, C = Math.min(C, h + 1), !!(C % 2) && (f === "reverse" ? (V = 1 - V, m && (V -= m / a)) : f === "mirror" && (b = o)), P = z(0, 1, V) * a;
|
|
730
|
+
}
|
|
731
|
+
let A;
|
|
732
|
+
T ? (this.delayState.value = c[0], A = this.delayState) : A = b.next(P), r && !T && (A.value = r(A.value));
|
|
733
|
+
let { done: D } = A;
|
|
734
|
+
!T && l !== null && (D = this.playbackSpeed >= 0 ? this.currentTime >= n : this.currentTime <= 0);
|
|
735
|
+
const y = this.holdTime === null && (this.state === "finished" || this.state === "running" && D);
|
|
736
|
+
return y && d !== oe && (A.value = Nt(c, this.options, p, this.speed)), v && v(A.value), y && this.finish(), A;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
740
|
+
* resolves when the animation finishes at all but in a future update could/should
|
|
741
|
+
* reject if its cancels.
|
|
742
|
+
*/
|
|
743
|
+
then(e, i) {
|
|
744
|
+
return this.finished.then(e, i);
|
|
745
|
+
}
|
|
746
|
+
get duration() {
|
|
747
|
+
return /* @__PURE__ */ U(this.calculatedDuration);
|
|
748
|
+
}
|
|
749
|
+
get iterationDuration() {
|
|
750
|
+
const { delay: e = 0 } = this.options || {};
|
|
751
|
+
return this.duration + /* @__PURE__ */ U(e);
|
|
752
|
+
}
|
|
753
|
+
get time() {
|
|
754
|
+
return /* @__PURE__ */ U(this.currentTime);
|
|
755
|
+
}
|
|
756
|
+
set time(e) {
|
|
757
|
+
e = /* @__PURE__ */ K(e), this.currentTime = e, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.playbackSpeed), this.driver ? this.driver.start(!1) : (this.startTime = 0, this.state = "paused", this.holdTime = e, this.tick(e));
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Returns the generator's velocity at the current time in units/second.
|
|
761
|
+
* Uses the analytical derivative when available (springs), avoiding
|
|
762
|
+
* the MotionValue's frame-dependent velocity estimation.
|
|
763
|
+
*/
|
|
764
|
+
getGeneratorVelocity() {
|
|
765
|
+
return Go(this.generator, this.currentTime, this.options.velocity);
|
|
766
|
+
}
|
|
767
|
+
get speed() {
|
|
768
|
+
return this.playbackSpeed;
|
|
769
|
+
}
|
|
770
|
+
set speed(e) {
|
|
771
|
+
const i = this.playbackSpeed !== e;
|
|
772
|
+
i && this.driver && this.updateTime(B.now()), this.playbackSpeed = e, i && this.driver && (this.time = /* @__PURE__ */ U(this.currentTime));
|
|
773
|
+
}
|
|
774
|
+
play() {
|
|
775
|
+
if (this.isStopped)
|
|
776
|
+
return;
|
|
777
|
+
const { driver: e = Mo, startTime: i } = this.options;
|
|
778
|
+
this.driver || (this.driver = e((n) => this.tick(n))), this.options.onPlay?.();
|
|
779
|
+
const s = this.driver.now();
|
|
780
|
+
this.state === "finished" ? (this.updateFinished(), this.startTime = s) : this.holdTime !== null ? this.startTime = s - this.holdTime : this.startTime || (this.startTime = i ?? s), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
|
|
781
|
+
}
|
|
782
|
+
pause() {
|
|
783
|
+
this.state = "paused", this.updateTime(B.now()), this.holdTime = this.currentTime;
|
|
784
|
+
}
|
|
785
|
+
complete() {
|
|
786
|
+
this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
|
|
787
|
+
}
|
|
788
|
+
finish() {
|
|
789
|
+
this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
|
|
790
|
+
}
|
|
791
|
+
cancel() {
|
|
792
|
+
this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
|
|
793
|
+
}
|
|
794
|
+
teardown() {
|
|
795
|
+
this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
|
|
796
|
+
}
|
|
797
|
+
stopDriver() {
|
|
798
|
+
this.driver && (this.driver.stop(), this.driver = void 0);
|
|
799
|
+
}
|
|
800
|
+
sample(e) {
|
|
801
|
+
return this.startTime = 0, this.tick(e, !0);
|
|
802
|
+
}
|
|
803
|
+
attachTimeline(e) {
|
|
804
|
+
return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
const Yo = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
808
|
+
function qo(t) {
|
|
809
|
+
const [e, i] = t.slice(0, -1).split("(");
|
|
810
|
+
if (e === "drop-shadow")
|
|
811
|
+
return t;
|
|
812
|
+
const [s] = i.match(Be) || [];
|
|
813
|
+
if (!s)
|
|
814
|
+
return t;
|
|
815
|
+
const n = i.replace(s, "");
|
|
816
|
+
let r = Yo.has(e) ? 1 : 0;
|
|
817
|
+
return s !== i && (r *= 100), e + "(" + r + n + ")";
|
|
818
|
+
}
|
|
819
|
+
const Zo = /\b([a-z-]*)\(.*?\)/gu, re = {
|
|
820
|
+
...j,
|
|
821
|
+
getAnimatableNone: (t) => {
|
|
822
|
+
const e = t.match(Zo);
|
|
823
|
+
return e ? e.map(qo).join(" ") : t;
|
|
824
|
+
}
|
|
825
|
+
}, ae = {
|
|
826
|
+
...j,
|
|
827
|
+
getAnimatableNone: (t) => {
|
|
828
|
+
const e = j.parse(t);
|
|
829
|
+
return j.createTransformer(t)(e.map((s) => typeof s == "number" ? 0 : typeof s == "object" ? { ...s, alpha: 1 } : s));
|
|
830
|
+
}
|
|
831
|
+
}, Jo = {
|
|
832
|
+
...Kn,
|
|
833
|
+
// Color props
|
|
834
|
+
color: R,
|
|
835
|
+
backgroundColor: R,
|
|
836
|
+
outlineColor: R,
|
|
837
|
+
fill: R,
|
|
838
|
+
stroke: R,
|
|
839
|
+
// Border props
|
|
840
|
+
borderColor: R,
|
|
841
|
+
borderTopColor: R,
|
|
842
|
+
borderRightColor: R,
|
|
843
|
+
borderBottomColor: R,
|
|
844
|
+
borderLeftColor: R,
|
|
845
|
+
filter: re,
|
|
846
|
+
WebkitFilter: re,
|
|
847
|
+
mask: ae,
|
|
848
|
+
WebkitMask: ae
|
|
849
|
+
}, Us = (t) => Jo[t], Qo = /* @__PURE__ */ new Set([re, ae]);
|
|
850
|
+
function Ke(t, e) {
|
|
851
|
+
let i = Us(t);
|
|
852
|
+
return Qo.has(i) || (i = j), i.getAnimatableNone ? i.getAnimatableNone(e) : void 0;
|
|
853
|
+
}
|
|
854
|
+
function tr(t) {
|
|
855
|
+
for (let e = 1; e < t.length; e++)
|
|
856
|
+
t[e] ?? (t[e] = t[e - 1]);
|
|
857
|
+
}
|
|
858
|
+
const et = (t) => t * 180 / Math.PI, le = (t) => {
|
|
859
|
+
const e = et(Math.atan2(t[1], t[0]));
|
|
860
|
+
return ce(e);
|
|
861
|
+
}, er = {
|
|
862
|
+
x: 4,
|
|
863
|
+
y: 5,
|
|
864
|
+
translateX: 4,
|
|
865
|
+
translateY: 5,
|
|
866
|
+
scaleX: 0,
|
|
867
|
+
scaleY: 3,
|
|
868
|
+
scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
|
|
869
|
+
rotate: le,
|
|
870
|
+
rotateZ: le,
|
|
871
|
+
skewX: (t) => et(Math.atan(t[1])),
|
|
872
|
+
skewY: (t) => et(Math.atan(t[2])),
|
|
873
|
+
skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
|
|
874
|
+
}, ce = (t) => (t = t % 360, t < 0 && (t += 360), t), oi = le, ri = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), ai = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), ir = {
|
|
875
|
+
x: 12,
|
|
876
|
+
y: 13,
|
|
877
|
+
z: 14,
|
|
878
|
+
translateX: 12,
|
|
879
|
+
translateY: 13,
|
|
880
|
+
translateZ: 14,
|
|
881
|
+
scaleX: ri,
|
|
882
|
+
scaleY: ai,
|
|
883
|
+
scale: (t) => (ri(t) + ai(t)) / 2,
|
|
884
|
+
rotateX: (t) => ce(et(Math.atan2(t[6], t[5]))),
|
|
885
|
+
rotateY: (t) => ce(et(Math.atan2(-t[2], t[0]))),
|
|
886
|
+
rotateZ: oi,
|
|
887
|
+
rotate: oi,
|
|
888
|
+
skewX: (t) => et(Math.atan(t[4])),
|
|
889
|
+
skewY: (t) => et(Math.atan(t[1])),
|
|
890
|
+
skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
|
|
891
|
+
};
|
|
892
|
+
function ue(t) {
|
|
893
|
+
return t.includes("scale") ? 1 : 0;
|
|
894
|
+
}
|
|
895
|
+
function he(t, e) {
|
|
896
|
+
if (!t || t === "none")
|
|
897
|
+
return ue(e);
|
|
898
|
+
const i = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
899
|
+
let s, n;
|
|
900
|
+
if (i)
|
|
901
|
+
s = ir, n = i;
|
|
902
|
+
else {
|
|
903
|
+
const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
904
|
+
s = er, n = a;
|
|
905
|
+
}
|
|
906
|
+
if (!n)
|
|
907
|
+
return ue(e);
|
|
908
|
+
const r = s[e], o = n[1].split(",").map(nr);
|
|
909
|
+
return typeof r == "function" ? r(o) : o[r];
|
|
910
|
+
}
|
|
911
|
+
const sr = (t, e) => {
|
|
912
|
+
const { transform: i = "none" } = getComputedStyle(t);
|
|
913
|
+
return he(i, e);
|
|
914
|
+
};
|
|
915
|
+
function nr(t) {
|
|
916
|
+
return parseFloat(t.trim());
|
|
917
|
+
}
|
|
918
|
+
const li = (t) => t === we || t === Ot, or = /* @__PURE__ */ new Set(["x", "y", "z"]), rr = Ve.filter((t) => !or.has(t));
|
|
919
|
+
function ar(t) {
|
|
920
|
+
const e = [];
|
|
921
|
+
return rr.forEach((i) => {
|
|
922
|
+
const s = t.getValue(i);
|
|
923
|
+
if (s !== void 0) {
|
|
924
|
+
const n = s.get(), r = i.startsWith("scale") ? 1 : 0;
|
|
925
|
+
if (n === r)
|
|
926
|
+
return;
|
|
927
|
+
e.push([i, n]), s.set(r);
|
|
928
|
+
}
|
|
929
|
+
}), e;
|
|
930
|
+
}
|
|
931
|
+
const lr = /* @__PURE__ */ new Set(["bottom", "right"]);
|
|
932
|
+
function ci(t, e, i, s, n, r) {
|
|
933
|
+
const o = parseFloat(t);
|
|
934
|
+
if (!isNaN(o))
|
|
935
|
+
return o;
|
|
936
|
+
const { min: a, max: l } = e()[i], u = l - a;
|
|
937
|
+
return r === "border-box" ? u : u - parseFloat(s) - parseFloat(n);
|
|
938
|
+
}
|
|
939
|
+
const it = {
|
|
940
|
+
// Dimensions
|
|
941
|
+
width: ({ width: t, paddingLeft: e = "0", paddingRight: i = "0", boxSizing: s }, n) => ci(t, n, "x", e, i, s),
|
|
942
|
+
height: ({ height: t, paddingTop: e = "0", paddingBottom: i = "0", boxSizing: s }, n) => ci(t, n, "y", e, i, s),
|
|
943
|
+
top: ({ top: t }) => parseFloat(t),
|
|
944
|
+
left: ({ left: t }) => parseFloat(t),
|
|
945
|
+
bottom: ({ top: t }, e) => {
|
|
946
|
+
const { y: i } = e();
|
|
947
|
+
return parseFloat(t) + (i.max - i.min);
|
|
948
|
+
},
|
|
949
|
+
right: ({ left: t }, e) => {
|
|
950
|
+
const { x: i } = e();
|
|
951
|
+
return parseFloat(t) + (i.max - i.min);
|
|
952
|
+
},
|
|
953
|
+
// Transform
|
|
954
|
+
x: ({ transform: t }) => he(t, "x"),
|
|
955
|
+
y: ({ transform: t }) => he(t, "y")
|
|
956
|
+
};
|
|
957
|
+
it.translateX = it.x;
|
|
958
|
+
it.translateY = it.y;
|
|
959
|
+
const st = /* @__PURE__ */ new Set();
|
|
960
|
+
let fe = !1, de = !1, pe = !1;
|
|
961
|
+
function Ks() {
|
|
962
|
+
if (de) {
|
|
963
|
+
const t = [], e = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
964
|
+
st.forEach((n) => {
|
|
965
|
+
n.needsMeasurement && (t.push(n), e.add(n.element), lr.has(n.name) && i.add(n.element));
|
|
966
|
+
});
|
|
967
|
+
const s = /* @__PURE__ */ new Map();
|
|
968
|
+
i.forEach((n) => {
|
|
969
|
+
const r = ar(n);
|
|
970
|
+
r.length && (s.set(n, r), n.render());
|
|
971
|
+
}), t.forEach((n) => n.measureInitialState()), e.forEach((n) => {
|
|
972
|
+
n.render();
|
|
973
|
+
const r = s.get(n);
|
|
974
|
+
r && r.forEach(([o, a]) => {
|
|
975
|
+
n.getValue(o)?.set(a);
|
|
976
|
+
});
|
|
977
|
+
}), t.forEach((n) => n.measureEndState()), t.forEach((n) => {
|
|
978
|
+
n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY);
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
de = !1, fe = !1, st.forEach((t) => t.complete(pe)), st.clear();
|
|
982
|
+
}
|
|
983
|
+
function _s() {
|
|
984
|
+
st.forEach((t) => {
|
|
985
|
+
t.readKeyframes(), t.needsMeasurement && (de = !0);
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
function cr() {
|
|
989
|
+
pe = !0, _s(), Ks(), pe = !1;
|
|
990
|
+
}
|
|
991
|
+
function ur(t, e, i) {
|
|
992
|
+
if (typeof t == "string") {
|
|
993
|
+
if (Ee(t) || Me(t))
|
|
994
|
+
return parseFloat(t);
|
|
995
|
+
if (!j.test(t) && j.test(i))
|
|
996
|
+
return Ke(e, i);
|
|
997
|
+
}
|
|
998
|
+
return t ?? void 0;
|
|
999
|
+
}
|
|
1000
|
+
class _e {
|
|
1001
|
+
constructor(e, i, s, n, r, o = !1) {
|
|
1002
|
+
this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = i, this.name = s, this.motionValue = n, this.element = r, this.isAsync = o;
|
|
1003
|
+
}
|
|
1004
|
+
scheduleResolve() {
|
|
1005
|
+
this.state = "scheduled", this.isAsync ? (st.add(this), fe || (fe = !0, S.read(_s), S.resolveKeyframes(Ks))) : (this.readKeyframes(), this.complete());
|
|
1006
|
+
}
|
|
1007
|
+
readKeyframes() {
|
|
1008
|
+
const { unresolvedKeyframes: e, name: i, element: s, motionValue: n } = this;
|
|
1009
|
+
if (e[0] === null) {
|
|
1010
|
+
const r = n?.get(), o = e[e.length - 1];
|
|
1011
|
+
if (r !== void 0)
|
|
1012
|
+
e[0] = r;
|
|
1013
|
+
else if (s && i) {
|
|
1014
|
+
const a = ur(s.readValue(i, o), i, o);
|
|
1015
|
+
a !== void 0 && (e[0] = a);
|
|
1016
|
+
}
|
|
1017
|
+
e[0] === void 0 && (e[0] = o), n && r === void 0 && n.set(e[0]);
|
|
1018
|
+
}
|
|
1019
|
+
tr(e);
|
|
1020
|
+
}
|
|
1021
|
+
setFinalKeyframe() {
|
|
1022
|
+
}
|
|
1023
|
+
measureInitialState() {
|
|
1024
|
+
}
|
|
1025
|
+
renderEndStyles() {
|
|
1026
|
+
}
|
|
1027
|
+
measureEndState() {
|
|
1028
|
+
}
|
|
1029
|
+
complete(e = !1) {
|
|
1030
|
+
this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), st.delete(this);
|
|
1031
|
+
}
|
|
1032
|
+
cancel() {
|
|
1033
|
+
this.state === "scheduled" && (st.delete(this), this.state = "pending");
|
|
1034
|
+
}
|
|
1035
|
+
resume() {
|
|
1036
|
+
this.state === "pending" && this.scheduleResolve();
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
const hr = (t) => t.startsWith("--");
|
|
1040
|
+
function $s(t, e, i) {
|
|
1041
|
+
hr(e) ? t.style.setProperty(e, i) : t.style[e] = i;
|
|
1042
|
+
}
|
|
1043
|
+
const fr = {};
|
|
1044
|
+
function Gs(t, e) {
|
|
1045
|
+
const i = /* @__PURE__ */ vs(t);
|
|
1046
|
+
return () => fr[e] ?? i();
|
|
1047
|
+
}
|
|
1048
|
+
const dr = /* @__PURE__ */ Gs(() => window.ScrollTimeline !== void 0, "scrollTimeline"), Hs = /* @__PURE__ */ Gs(() => {
|
|
1049
|
+
try {
|
|
1050
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
1051
|
+
} catch {
|
|
1052
|
+
return !1;
|
|
1053
|
+
}
|
|
1054
|
+
return !0;
|
|
1055
|
+
}, "linearEasing"), ft = ([t, e, i, s]) => `cubic-bezier(${t}, ${e}, ${i}, ${s})`, ui = {
|
|
1056
|
+
linear: "linear",
|
|
1057
|
+
ease: "ease",
|
|
1058
|
+
easeIn: "ease-in",
|
|
1059
|
+
easeOut: "ease-out",
|
|
1060
|
+
easeInOut: "ease-in-out",
|
|
1061
|
+
circIn: /* @__PURE__ */ ft([0, 0.65, 0.55, 1]),
|
|
1062
|
+
circOut: /* @__PURE__ */ ft([0.55, 0, 1, 0.45]),
|
|
1063
|
+
backIn: /* @__PURE__ */ ft([0.31, 0.01, 0.66, -0.59]),
|
|
1064
|
+
backOut: /* @__PURE__ */ ft([0.33, 1.53, 0.69, 0.99])
|
|
1065
|
+
};
|
|
1066
|
+
function Ws(t, e) {
|
|
1067
|
+
if (t)
|
|
1068
|
+
return typeof t == "function" ? Hs() ? Is(t, e) : "ease-out" : /* @__PURE__ */ Cs(t) ? ft(t) : Array.isArray(t) ? t.map((i) => Ws(i, e) || ui.easeOut) : ui[t];
|
|
1069
|
+
}
|
|
1070
|
+
function pr(t, e, i, { delay: s = 0, duration: n = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeOut", times: l } = {}, u = void 0) {
|
|
1071
|
+
const c = {
|
|
1072
|
+
[e]: i
|
|
1073
|
+
};
|
|
1074
|
+
l && (c.offset = l);
|
|
1075
|
+
const h = Ws(a, n);
|
|
1076
|
+
Array.isArray(h) && (c.easing = h);
|
|
1077
|
+
const f = {
|
|
1078
|
+
delay: s,
|
|
1079
|
+
duration: n,
|
|
1080
|
+
easing: Array.isArray(h) ? "linear" : h,
|
|
1081
|
+
fill: "both",
|
|
1082
|
+
iterations: r + 1,
|
|
1083
|
+
direction: o === "reverse" ? "alternate" : "normal"
|
|
1084
|
+
};
|
|
1085
|
+
return u && (f.pseudoElement = u), t.animate(c, f);
|
|
1086
|
+
}
|
|
1087
|
+
function zs(t) {
|
|
1088
|
+
return typeof t == "function" && "applyToOptions" in t;
|
|
1089
|
+
}
|
|
1090
|
+
function mr({ type: t, ...e }) {
|
|
1091
|
+
return zs(t) && Hs() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
|
|
1092
|
+
}
|
|
1093
|
+
class Xs extends Ue {
|
|
1094
|
+
constructor(e) {
|
|
1095
|
+
if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !e)
|
|
1096
|
+
return;
|
|
1097
|
+
const { element: i, name: s, keyframes: n, pseudoElement: r, allowFlatten: o = !1, finalKeyframe: a, onComplete: l } = e;
|
|
1098
|
+
this.isPseudoElement = !!r, this.allowFlatten = o, this.options = e, ot(typeof e.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
|
|
1099
|
+
const u = mr(e);
|
|
1100
|
+
this.animation = pr(i, s, n, u, r), u.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
|
|
1101
|
+
if (this.finishedTime = this.time, !r) {
|
|
1102
|
+
const c = Nt(n, this.options, a, this.speed);
|
|
1103
|
+
this.updateMotionValue && this.updateMotionValue(c), $s(i, s, c), this.animation.cancel();
|
|
1104
|
+
}
|
|
1105
|
+
l?.(), this.notifyFinished();
|
|
1106
|
+
}, Ns(this, e, u);
|
|
1107
|
+
}
|
|
1108
|
+
play() {
|
|
1109
|
+
this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished());
|
|
1110
|
+
}
|
|
1111
|
+
pause() {
|
|
1112
|
+
this.animation.pause();
|
|
1113
|
+
}
|
|
1114
|
+
complete() {
|
|
1115
|
+
this.animation.finish?.();
|
|
1116
|
+
}
|
|
1117
|
+
cancel() {
|
|
1118
|
+
try {
|
|
1119
|
+
this.animation.cancel();
|
|
1120
|
+
} catch {
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
stop() {
|
|
1124
|
+
if (this.isStopped)
|
|
1125
|
+
return;
|
|
1126
|
+
this.isStopped = !0;
|
|
1127
|
+
const { state: e } = this;
|
|
1128
|
+
e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
1132
|
+
*
|
|
1133
|
+
* In this method, we commit styles back to the DOM before cancelling
|
|
1134
|
+
* the animation.
|
|
1135
|
+
*
|
|
1136
|
+
* This is designed to be overridden by NativeAnimationExtended, which
|
|
1137
|
+
* will create a renderless JS animation and sample it twice to calculate
|
|
1138
|
+
* its current value, "previous" value, and therefore allow
|
|
1139
|
+
* Motion to also correctly calculate velocity for any subsequent animation
|
|
1140
|
+
* while deferring the commit until the next animation frame.
|
|
1141
|
+
*/
|
|
1142
|
+
commitStyles() {
|
|
1143
|
+
const e = this.options?.element;
|
|
1144
|
+
!this.isPseudoElement && e?.isConnected && this.animation.commitStyles?.();
|
|
1145
|
+
}
|
|
1146
|
+
get duration() {
|
|
1147
|
+
const e = this.animation.effect?.getComputedTiming?.().duration || 0;
|
|
1148
|
+
return /* @__PURE__ */ U(Number(e));
|
|
1149
|
+
}
|
|
1150
|
+
get iterationDuration() {
|
|
1151
|
+
const { delay: e = 0 } = this.options || {};
|
|
1152
|
+
return this.duration + /* @__PURE__ */ U(e);
|
|
1153
|
+
}
|
|
1154
|
+
get time() {
|
|
1155
|
+
return /* @__PURE__ */ U(Number(this.animation.currentTime) || 0);
|
|
1156
|
+
}
|
|
1157
|
+
set time(e) {
|
|
1158
|
+
const i = this.finishedTime !== null;
|
|
1159
|
+
this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ K(e), i && this.animation.pause();
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* The playback speed of the animation.
|
|
1163
|
+
* 1 = normal speed, 2 = double speed, 0.5 = half speed.
|
|
1164
|
+
*/
|
|
1165
|
+
get speed() {
|
|
1166
|
+
return this.animation.playbackRate;
|
|
1167
|
+
}
|
|
1168
|
+
set speed(e) {
|
|
1169
|
+
e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
|
|
1170
|
+
}
|
|
1171
|
+
get state() {
|
|
1172
|
+
return this.finishedTime !== null ? "finished" : this.animation.playState;
|
|
1173
|
+
}
|
|
1174
|
+
get startTime() {
|
|
1175
|
+
return this.manualStartTime ?? Number(this.animation.startTime);
|
|
1176
|
+
}
|
|
1177
|
+
set startTime(e) {
|
|
1178
|
+
this.manualStartTime = this.animation.startTime = e;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Attaches a timeline to the animation, for instance the `ScrollTimeline`.
|
|
1182
|
+
*/
|
|
1183
|
+
attachTimeline({ timeline: e, rangeStart: i, rangeEnd: s, observe: n }) {
|
|
1184
|
+
return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && dr() ? (this.animation.timeline = e, i && (this.animation.rangeStart = i), s && (this.animation.rangeEnd = s), W) : n(this);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
const Ys = {
|
|
1188
|
+
anticipate: As,
|
|
1189
|
+
backInOut: ws,
|
|
1190
|
+
circInOut: Ds
|
|
1191
|
+
};
|
|
1192
|
+
function yr(t) {
|
|
1193
|
+
return t in Ys;
|
|
1194
|
+
}
|
|
1195
|
+
function gr(t) {
|
|
1196
|
+
typeof t.ease == "string" && yr(t.ease) && (t.ease = Ys[t.ease]);
|
|
1197
|
+
}
|
|
1198
|
+
const Wt = 10;
|
|
1199
|
+
class vr extends Xs {
|
|
1200
|
+
constructor(e) {
|
|
1201
|
+
gr(e), js(e), super(e), e.startTime !== void 0 && e.autoplay !== !1 && (this.startTime = e.startTime), this.options = e;
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
1205
|
+
*
|
|
1206
|
+
* Rather than read committed styles back out of the DOM, we can
|
|
1207
|
+
* create a renderless JS animation and sample it twice to calculate
|
|
1208
|
+
* its current value, "previous" value, and therefore allow
|
|
1209
|
+
* Motion to calculate velocity for any subsequent animation.
|
|
1210
|
+
*/
|
|
1211
|
+
updateMotionValue(e) {
|
|
1212
|
+
const { motionValue: i, onUpdate: s, onComplete: n, element: r, ...o } = this.options;
|
|
1213
|
+
if (!i)
|
|
1214
|
+
return;
|
|
1215
|
+
if (e !== void 0) {
|
|
1216
|
+
i.set(e);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
const a = new Ft({
|
|
1220
|
+
...o,
|
|
1221
|
+
autoplay: !1
|
|
1222
|
+
}), l = Math.max(Wt, B.now() - this.startTime), u = z(0, Wt, l - Wt), c = a.sample(l).value, { name: h } = this.options;
|
|
1223
|
+
r && h && $s(r, h, c), i.setWithVelocity(a.sample(Math.max(0, l - u)).value, c, u), a.stop();
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
const hi = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
|
|
1227
|
+
(j.test(t) || t === "0") && // And it contains numbers and/or colors
|
|
1228
|
+
!t.startsWith("url("));
|
|
1229
|
+
function xr(t) {
|
|
1230
|
+
const e = t[0];
|
|
1231
|
+
if (t.length === 1)
|
|
1232
|
+
return !0;
|
|
1233
|
+
for (let i = 0; i < t.length; i++)
|
|
1234
|
+
if (t[i] !== e)
|
|
1235
|
+
return !0;
|
|
1236
|
+
}
|
|
1237
|
+
function Tr(t, e, i, s) {
|
|
1238
|
+
const n = t[0];
|
|
1239
|
+
if (n === null)
|
|
1240
|
+
return !1;
|
|
1241
|
+
if (e === "display" || e === "visibility")
|
|
1242
|
+
return !0;
|
|
1243
|
+
const r = t[t.length - 1], o = hi(n, e), a = hi(r, e);
|
|
1244
|
+
return !o || !a ? (o !== a && St(!1, `You are trying to animate ${e} from "${n}" to "${r}". "${o ? r : n}" is not an animatable value.`, "value-not-animatable"), !1) : xr(t) || (i === "spring" || zs(i)) && s;
|
|
1245
|
+
}
|
|
1246
|
+
function me(t) {
|
|
1247
|
+
t.duration = 0, t.type = "keyframes";
|
|
1248
|
+
}
|
|
1249
|
+
const ye = /* @__PURE__ */ new Set([
|
|
1250
|
+
"opacity",
|
|
1251
|
+
"clipPath",
|
|
1252
|
+
"filter",
|
|
1253
|
+
"transform",
|
|
1254
|
+
"backgroundColor"
|
|
1255
|
+
]), Pr = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;
|
|
1256
|
+
function br(t) {
|
|
1257
|
+
for (let e = 0; e < t.length; e++)
|
|
1258
|
+
if (typeof t[e] == "string" && Pr.test(t[e]))
|
|
1259
|
+
return !0;
|
|
1260
|
+
return !1;
|
|
1261
|
+
}
|
|
1262
|
+
const fi = /* @__PURE__ */ new Set([
|
|
1263
|
+
"color",
|
|
1264
|
+
"backgroundColor",
|
|
1265
|
+
"outlineColor",
|
|
1266
|
+
"fill",
|
|
1267
|
+
"stroke",
|
|
1268
|
+
"borderColor",
|
|
1269
|
+
"borderTopColor",
|
|
1270
|
+
"borderRightColor",
|
|
1271
|
+
"borderBottomColor",
|
|
1272
|
+
"borderLeftColor"
|
|
1273
|
+
]), Sr = /* @__PURE__ */ vs(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
1274
|
+
function wr(t) {
|
|
1275
|
+
const { motionValue: e, name: i, repeatDelay: s, repeatType: n, damping: r, type: o, keyframes: a } = t;
|
|
1276
|
+
if (!i || !(ye.has(i) || fi.has(i)))
|
|
1277
|
+
return !1;
|
|
1278
|
+
const l = e?.owner?.current;
|
|
1279
|
+
if (!(l instanceof HTMLElement) && !(l instanceof SVGElement))
|
|
1280
|
+
return !1;
|
|
1281
|
+
const { onUpdate: u, transformTemplate: c } = e.owner.getProps();
|
|
1282
|
+
return Sr() && /**
|
|
1283
|
+
* Force WAAPI for color properties with browser-only color formats
|
|
1284
|
+
* (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.
|
|
1285
|
+
*/
|
|
1286
|
+
(ye.has(i) || fi.has(i) && br(a)) && (i !== "transform" || !c) && /**
|
|
1287
|
+
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
1288
|
+
* no way to read the value from WAAPI every frame.
|
|
1289
|
+
*/
|
|
1290
|
+
!u && !s && n !== "mirror" && r !== 0 && o !== "inertia";
|
|
1291
|
+
}
|
|
1292
|
+
const Ar = 40;
|
|
1293
|
+
class Vr extends Ue {
|
|
1294
|
+
constructor(e) {
|
|
1295
|
+
super(), this.stop = () => {
|
|
1296
|
+
this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
|
|
1297
|
+
}, this.createdAt = B.now();
|
|
1298
|
+
const { keyframes: i, name: s, motionValue: n, element: r } = e, o = e;
|
|
1299
|
+
o.autoplay ?? (o.autoplay = !0), o.delay ?? (o.delay = 0), o.type ?? (o.type = "keyframes"), o.repeat ?? (o.repeat = 0), o.repeatDelay ?? (o.repeatDelay = 0), o.repeatType ?? (o.repeatType = "loop");
|
|
1300
|
+
const a = r?.KeyframeResolver || _e;
|
|
1301
|
+
this.keyframeResolver = new a(i, (l, u, c) => this.onKeyframesResolved(l, u, o, !c), s, n, r), this.keyframeResolver?.scheduleResolve();
|
|
1302
|
+
}
|
|
1303
|
+
onKeyframesResolved(e, i, s, n) {
|
|
1304
|
+
this.keyframeResolver = void 0;
|
|
1305
|
+
const { name: r, type: o, velocity: a, delay: l, isHandoff: u, onUpdate: c } = s;
|
|
1306
|
+
this.resolvedAt = B.now();
|
|
1307
|
+
let h = !0;
|
|
1308
|
+
Tr(e, r, o, a) || (h = !1, (Y.instantAnimations || !l) && c?.(Nt(e, s, i)), e[0] = e[e.length - 1], me(s), s.repeat = 0);
|
|
1309
|
+
const f = n ? this.resolvedAt ? this.resolvedAt - this.createdAt > Ar ? this.resolvedAt : this.createdAt : this.createdAt : void 0, { onComplete: m } = s;
|
|
1310
|
+
s.startTime ?? (s.startTime = f), s.finalKeyframe = i, s.keyframes = e, s.onComplete = () => {
|
|
1311
|
+
m?.(), this.notifyFinished();
|
|
1312
|
+
};
|
|
1313
|
+
const d = h && !u && wr(s);
|
|
1314
|
+
let v;
|
|
1315
|
+
if (d) {
|
|
1316
|
+
s.element = s.motionValue?.owner?.current;
|
|
1317
|
+
try {
|
|
1318
|
+
v = new vr(s);
|
|
1319
|
+
} catch {
|
|
1320
|
+
v = new Ft(s);
|
|
1321
|
+
}
|
|
1322
|
+
} else
|
|
1323
|
+
v = new Ft(s);
|
|
1324
|
+
this.pendingTimeline && (this.stopTimeline = v.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = v;
|
|
1325
|
+
}
|
|
1326
|
+
get finished() {
|
|
1327
|
+
return this._animation ? this._animation.finished : super.finished;
|
|
1328
|
+
}
|
|
1329
|
+
then(e, i) {
|
|
1330
|
+
return this.finished.finally(e).then(() => {
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
get animation() {
|
|
1334
|
+
return this._animation || (this.keyframeResolver?.resume(), cr()), this._animation;
|
|
1335
|
+
}
|
|
1336
|
+
get duration() {
|
|
1337
|
+
return this.animation.duration;
|
|
1338
|
+
}
|
|
1339
|
+
get iterationDuration() {
|
|
1340
|
+
return this.animation.iterationDuration;
|
|
1341
|
+
}
|
|
1342
|
+
get time() {
|
|
1343
|
+
return this.animation.time;
|
|
1344
|
+
}
|
|
1345
|
+
set time(e) {
|
|
1346
|
+
this.animation.time = e;
|
|
1347
|
+
}
|
|
1348
|
+
get speed() {
|
|
1349
|
+
return this.animation.speed;
|
|
1350
|
+
}
|
|
1351
|
+
get state() {
|
|
1352
|
+
return this.animation.state;
|
|
1353
|
+
}
|
|
1354
|
+
set speed(e) {
|
|
1355
|
+
this.animation.speed = e;
|
|
1356
|
+
}
|
|
1357
|
+
get startTime() {
|
|
1358
|
+
return this.animation.startTime;
|
|
1359
|
+
}
|
|
1360
|
+
attachTimeline(e) {
|
|
1361
|
+
return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
|
|
1362
|
+
}
|
|
1363
|
+
play() {
|
|
1364
|
+
this.animation.play();
|
|
1365
|
+
}
|
|
1366
|
+
pause() {
|
|
1367
|
+
this.animation.pause();
|
|
1368
|
+
}
|
|
1369
|
+
complete() {
|
|
1370
|
+
this.animation.complete();
|
|
1371
|
+
}
|
|
1372
|
+
cancel() {
|
|
1373
|
+
this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
function qs(t, e, i, s = 0, n = 1) {
|
|
1377
|
+
const r = Array.from(t).sort((u, c) => u.sortNodePosition(c)).indexOf(e), o = t.size, a = (o - 1) * s;
|
|
1378
|
+
return typeof i == "function" ? i(r, o) : n === 1 ? r * s : a - r * s;
|
|
1379
|
+
}
|
|
1380
|
+
const di = 30, Dr = (t) => !isNaN(parseFloat(t));
|
|
1381
|
+
class Cr {
|
|
1382
|
+
/**
|
|
1383
|
+
* @param init - The initiating value
|
|
1384
|
+
* @param config - Optional configuration options
|
|
1385
|
+
*
|
|
1386
|
+
* - `transformer`: A function to transform incoming values with.
|
|
1387
|
+
*/
|
|
1388
|
+
constructor(e, i = {}) {
|
|
1389
|
+
this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s) => {
|
|
1390
|
+
const n = B.now();
|
|
1391
|
+
if (this.updatedAt !== n && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && (this.notifyChange(), this.dependents))
|
|
1392
|
+
for (const r of this.dependents)
|
|
1393
|
+
r.dirty();
|
|
1394
|
+
}, this.hasAnimated = !1, this.setCurrent(e), this.owner = i.owner;
|
|
1395
|
+
}
|
|
1396
|
+
setCurrent(e) {
|
|
1397
|
+
this.current = e, this.updatedAt = B.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = Dr(this.current));
|
|
1398
|
+
}
|
|
1399
|
+
setPrevFrameValue(e = this.current) {
|
|
1400
|
+
this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
1404
|
+
*
|
|
1405
|
+
* It returns a function that, when called, will cancel the subscription.
|
|
1406
|
+
*
|
|
1407
|
+
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
1408
|
+
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
1409
|
+
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
1410
|
+
*
|
|
1411
|
+
* ```jsx
|
|
1412
|
+
* export const MyComponent = () => {
|
|
1413
|
+
* const x = useMotionValue(0)
|
|
1414
|
+
* const y = useMotionValue(0)
|
|
1415
|
+
* const opacity = useMotionValue(1)
|
|
1416
|
+
*
|
|
1417
|
+
* useEffect(() => {
|
|
1418
|
+
* function updateOpacity() {
|
|
1419
|
+
* const maxXY = Math.max(x.get(), y.get())
|
|
1420
|
+
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
1421
|
+
* opacity.set(newOpacity)
|
|
1422
|
+
* }
|
|
1423
|
+
*
|
|
1424
|
+
* const unsubscribeX = x.on("change", updateOpacity)
|
|
1425
|
+
* const unsubscribeY = y.on("change", updateOpacity)
|
|
1426
|
+
*
|
|
1427
|
+
* return () => {
|
|
1428
|
+
* unsubscribeX()
|
|
1429
|
+
* unsubscribeY()
|
|
1430
|
+
* }
|
|
1431
|
+
* }, [])
|
|
1432
|
+
*
|
|
1433
|
+
* return <motion.div style={{ x }} />
|
|
1434
|
+
* }
|
|
1435
|
+
* ```
|
|
1436
|
+
*
|
|
1437
|
+
* @param subscriber - A function that receives the latest value.
|
|
1438
|
+
* @returns A function that, when called, will cancel this subscription.
|
|
1439
|
+
*
|
|
1440
|
+
* @deprecated
|
|
1441
|
+
*/
|
|
1442
|
+
onChange(e) {
|
|
1443
|
+
return this.on("change", e);
|
|
1444
|
+
}
|
|
1445
|
+
on(e, i) {
|
|
1446
|
+
var s;
|
|
1447
|
+
return e === "change" ? this.onChangeSubscribe(i) : ((s = this.events)[e] || (s[e] = new Lt())).add(i);
|
|
1448
|
+
}
|
|
1449
|
+
onChangeSubscribe(e) {
|
|
1450
|
+
const { events: i } = this;
|
|
1451
|
+
return !i.change && !this.changeSubscriber ? this.changeSubscriber = e : (i.change || (i.change = new Lt(), i.change.add(this.changeSubscriber), this.changeSubscriber = void 0), i.change.add(e)), () => {
|
|
1452
|
+
this.changeSubscriber === e ? this.changeSubscriber = void 0 : i.change?.remove(e), this.stopIfUnobserved();
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* If we have no more change listeners by the start
|
|
1457
|
+
* of the next frame, stop active animations.
|
|
1458
|
+
*/
|
|
1459
|
+
stopIfUnobserved() {
|
|
1460
|
+
S.read(() => {
|
|
1461
|
+
!this.changeSubscriber && !this.events.change?.getSize() && this.stop();
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
clearListeners() {
|
|
1465
|
+
this.changeSubscriber = void 0;
|
|
1466
|
+
for (const e in this.events)
|
|
1467
|
+
this.events[e].clear();
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Attaches a passive effect to the `MotionValue`.
|
|
1471
|
+
*/
|
|
1472
|
+
attach(e, i) {
|
|
1473
|
+
this.passiveEffect = e, this.stopPassiveEffect = i;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Sets the state of the `MotionValue`.
|
|
1477
|
+
*
|
|
1478
|
+
* @remarks
|
|
1479
|
+
*
|
|
1480
|
+
* ```jsx
|
|
1481
|
+
* const x = useMotionValue(0)
|
|
1482
|
+
* x.set(10)
|
|
1483
|
+
* ```
|
|
1484
|
+
*
|
|
1485
|
+
* @param latest - Latest value to set.
|
|
1486
|
+
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
1487
|
+
*
|
|
1488
|
+
* @public
|
|
1489
|
+
*/
|
|
1490
|
+
set(e) {
|
|
1491
|
+
this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
|
|
1492
|
+
}
|
|
1493
|
+
setWithVelocity(e, i, s) {
|
|
1494
|
+
this.set(i), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Set the state of the `MotionValue`, stopping any active animations,
|
|
1498
|
+
* effects, and resets velocity to `0`.
|
|
1499
|
+
*/
|
|
1500
|
+
jump(e, i = !0) {
|
|
1501
|
+
this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, i && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1502
|
+
}
|
|
1503
|
+
dirty() {
|
|
1504
|
+
this.notifyChange();
|
|
1505
|
+
}
|
|
1506
|
+
notifyChange() {
|
|
1507
|
+
const { current: e, changeSubscriber: i } = this;
|
|
1508
|
+
i ? i(e) : this.events.change?.notify(e);
|
|
1509
|
+
}
|
|
1510
|
+
addDependent(e) {
|
|
1511
|
+
this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(e);
|
|
1512
|
+
}
|
|
1513
|
+
removeDependent(e) {
|
|
1514
|
+
this.dependents && this.dependents.delete(e);
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Returns the latest state of `MotionValue`
|
|
1518
|
+
*
|
|
1519
|
+
* @returns - The latest state of `MotionValue`
|
|
1520
|
+
*
|
|
1521
|
+
* @public
|
|
1522
|
+
*/
|
|
1523
|
+
get() {
|
|
1524
|
+
return this.current;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* @public
|
|
1528
|
+
*/
|
|
1529
|
+
getPrevious() {
|
|
1530
|
+
return this.prev;
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Returns the latest velocity of `MotionValue`
|
|
1534
|
+
*
|
|
1535
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
1536
|
+
*
|
|
1537
|
+
* @public
|
|
1538
|
+
*/
|
|
1539
|
+
getVelocity() {
|
|
1540
|
+
const e = B.now();
|
|
1541
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > di)
|
|
1542
|
+
return 0;
|
|
1543
|
+
const i = Math.min(this.updatedAt - this.prevUpdatedAt, di);
|
|
1544
|
+
return /* @__PURE__ */ xs(parseFloat(this.current) - parseFloat(this.prevFrameValue), i);
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Registers a new animation to control this `MotionValue`. Only one
|
|
1548
|
+
* animation can drive a `MotionValue` at one time.
|
|
1549
|
+
*
|
|
1550
|
+
* ```jsx
|
|
1551
|
+
* value.start()
|
|
1552
|
+
* ```
|
|
1553
|
+
*
|
|
1554
|
+
* @param animation - A function that starts the provided animation
|
|
1555
|
+
*/
|
|
1556
|
+
start(e) {
|
|
1557
|
+
return this.stop(), new Promise((i) => {
|
|
1558
|
+
this.hasAnimated = !0;
|
|
1559
|
+
let s = !1, n;
|
|
1560
|
+
n = e(() => {
|
|
1561
|
+
s = !0, this.events.animationComplete?.notify(), this.animation === n && this.clearAnimation(), i();
|
|
1562
|
+
}), s || (this.animation = n), this.events.animationStart?.notify();
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Stop the currently active animation.
|
|
1567
|
+
*
|
|
1568
|
+
* @public
|
|
1569
|
+
*/
|
|
1570
|
+
stop() {
|
|
1571
|
+
this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Returns `true` if this value is currently animating.
|
|
1575
|
+
*
|
|
1576
|
+
* @public
|
|
1577
|
+
*/
|
|
1578
|
+
isAnimating() {
|
|
1579
|
+
return !!this.animation;
|
|
1580
|
+
}
|
|
1581
|
+
clearAnimation() {
|
|
1582
|
+
this.animation = void 0;
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
1586
|
+
*
|
|
1587
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
1588
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
1589
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
1590
|
+
*
|
|
1591
|
+
* @public
|
|
1592
|
+
*/
|
|
1593
|
+
destroy() {
|
|
1594
|
+
this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
function ht(t, e) {
|
|
1598
|
+
return new Cr(t, e);
|
|
1599
|
+
}
|
|
1600
|
+
function Zs(t, e) {
|
|
1601
|
+
if (t?.inherit && e) {
|
|
1602
|
+
const { inherit: i, ...s } = t;
|
|
1603
|
+
return { ...e, ...s };
|
|
1604
|
+
}
|
|
1605
|
+
return t;
|
|
1606
|
+
}
|
|
1607
|
+
function $e(t, e) {
|
|
1608
|
+
const i = t?.[e] ?? t?.default ?? t;
|
|
1609
|
+
return i !== t ? Zs(i, t) : i;
|
|
1610
|
+
}
|
|
1611
|
+
const Er = {
|
|
1612
|
+
type: "spring",
|
|
1613
|
+
stiffness: 500,
|
|
1614
|
+
damping: 25,
|
|
1615
|
+
restSpeed: 10
|
|
1616
|
+
}, Mr = (t) => ({
|
|
1617
|
+
type: "spring",
|
|
1618
|
+
stiffness: 550,
|
|
1619
|
+
damping: t === 0 ? 2 * Math.sqrt(550) : 30,
|
|
1620
|
+
restSpeed: 10
|
|
1621
|
+
}), Rr = {
|
|
1622
|
+
type: "keyframes",
|
|
1623
|
+
duration: 0.8
|
|
1624
|
+
}, Lr = {
|
|
1625
|
+
type: "keyframes",
|
|
1626
|
+
ease: [0.25, 0.1, 0.35, 1],
|
|
1627
|
+
duration: 0.3
|
|
1628
|
+
}, kr = (t, { keyframes: e }) => e.length > 2 ? Rr : bt.has(t) ? t.startsWith("scale") ? Mr(e[1]) : Er : Lr, Br = /* @__PURE__ */ new Set([
|
|
1629
|
+
"when",
|
|
1630
|
+
"delay",
|
|
1631
|
+
"delayChildren",
|
|
1632
|
+
"staggerChildren",
|
|
1633
|
+
"staggerDirection",
|
|
1634
|
+
"repeat",
|
|
1635
|
+
"repeatType",
|
|
1636
|
+
"repeatDelay",
|
|
1637
|
+
"from",
|
|
1638
|
+
"elapsed"
|
|
1639
|
+
]);
|
|
1640
|
+
function Fr(t) {
|
|
1641
|
+
for (const e in t)
|
|
1642
|
+
if (!Br.has(e))
|
|
1643
|
+
return !0;
|
|
1644
|
+
return !1;
|
|
1645
|
+
}
|
|
1646
|
+
const Ge = (t, e, i, s = {}, n, r) => (o) => {
|
|
1647
|
+
const a = $e(s, t) || {}, l = a.delay || s.delay || 0;
|
|
1648
|
+
let { elapsed: u = 0 } = s;
|
|
1649
|
+
u = u - /* @__PURE__ */ K(l);
|
|
1650
|
+
const c = {
|
|
1651
|
+
keyframes: Array.isArray(i) ? i : [null, i],
|
|
1652
|
+
ease: "easeOut",
|
|
1653
|
+
velocity: e.getVelocity(),
|
|
1654
|
+
...a,
|
|
1655
|
+
delay: -u,
|
|
1656
|
+
onUpdate: (f) => {
|
|
1657
|
+
e.set(f), a.onUpdate && a.onUpdate(f);
|
|
1658
|
+
},
|
|
1659
|
+
onComplete: () => {
|
|
1660
|
+
o(), a.onComplete && a.onComplete();
|
|
1661
|
+
},
|
|
1662
|
+
name: t,
|
|
1663
|
+
motionValue: e,
|
|
1664
|
+
element: r ? void 0 : n
|
|
1665
|
+
};
|
|
1666
|
+
Fr(a) || Object.assign(c, kr(t, c)), c.duration && (c.duration = /* @__PURE__ */ K(c.duration)), c.repeatDelay && (c.repeatDelay = /* @__PURE__ */ K(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
|
|
1667
|
+
let h = !1;
|
|
1668
|
+
if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (me(c), c.delay === 0 && (h = !0)), (Y.instantAnimations || Y.skipAnimations || n?.shouldSkipAnimations || a.skipAnimations) && (h = !0, me(c), c.delay = 0), c.allowFlatten = !a.type && !a.ease, h && !r && e.get() !== void 0) {
|
|
1669
|
+
const f = Nt(c.keyframes, a);
|
|
1670
|
+
if (f !== void 0) {
|
|
1671
|
+
S.update(() => {
|
|
1672
|
+
c.onUpdate(f), c.onComplete();
|
|
1673
|
+
});
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
return a.isSync ? new Ft(c) : new Vr(c);
|
|
1678
|
+
}, Ir = (
|
|
1679
|
+
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
|
|
1680
|
+
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
|
|
1681
|
+
);
|
|
1682
|
+
function jr(t) {
|
|
1683
|
+
const e = Ir.exec(t);
|
|
1684
|
+
if (!e)
|
|
1685
|
+
return [,];
|
|
1686
|
+
const [, i, s, n] = e;
|
|
1687
|
+
return [`--${i ?? s}`, n];
|
|
1688
|
+
}
|
|
1689
|
+
const Or = 4;
|
|
1690
|
+
function Js(t, e, i = 1) {
|
|
1691
|
+
ot(i <= Or, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
1692
|
+
const [s, n] = jr(t);
|
|
1693
|
+
if (!s)
|
|
1694
|
+
return;
|
|
1695
|
+
const r = window.getComputedStyle(e).getPropertyValue(s);
|
|
1696
|
+
if (r) {
|
|
1697
|
+
const o = r.trim();
|
|
1698
|
+
return Ee(o) ? parseFloat(o) : o;
|
|
1699
|
+
}
|
|
1700
|
+
return Ae(n) ? Js(n, e, i + 1) : n;
|
|
1701
|
+
}
|
|
1702
|
+
function pi(t) {
|
|
1703
|
+
const e = [{}, {}];
|
|
1704
|
+
return t?.values.forEach((i, s) => {
|
|
1705
|
+
e[0][s] = i.get(), e[1][s] = i.getVelocity();
|
|
1706
|
+
}), e;
|
|
1707
|
+
}
|
|
1708
|
+
function Qs(t, e, i, s) {
|
|
1709
|
+
if (typeof e == "function") {
|
|
1710
|
+
const [n, r] = pi(s);
|
|
1711
|
+
e = e(i !== void 0 ? i : t.custom, n, r);
|
|
1712
|
+
}
|
|
1713
|
+
if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
|
|
1714
|
+
const [n, r] = pi(s);
|
|
1715
|
+
e = e(i !== void 0 ? i : t.custom, n, r);
|
|
1716
|
+
}
|
|
1717
|
+
return e;
|
|
1718
|
+
}
|
|
1719
|
+
function ut(t, e, i) {
|
|
1720
|
+
const s = t.getProps();
|
|
1721
|
+
return Qs(s, e, i !== void 0 ? i : s.custom, t);
|
|
1722
|
+
}
|
|
1723
|
+
const tn = /* @__PURE__ */ new Set([
|
|
1724
|
+
"width",
|
|
1725
|
+
"height",
|
|
1726
|
+
"top",
|
|
1727
|
+
"left",
|
|
1728
|
+
"right",
|
|
1729
|
+
"bottom",
|
|
1730
|
+
...Ve
|
|
1731
|
+
]), Nr = (t) => Array.isArray(t);
|
|
1732
|
+
function Ur(t, e, i) {
|
|
1733
|
+
t.hasValue(e) ? t.getValue(e).set(i) : t.addValue(e, ht(i));
|
|
1734
|
+
}
|
|
1735
|
+
function Kr(t) {
|
|
1736
|
+
return Nr(t) ? t[t.length - 1] || 0 : t;
|
|
1737
|
+
}
|
|
1738
|
+
function _r(t, e) {
|
|
1739
|
+
const i = ut(t, e);
|
|
1740
|
+
let { transitionEnd: s = {}, transition: n = {}, ...r } = i || {};
|
|
1741
|
+
r = { ...r, ...s };
|
|
1742
|
+
for (const o in r) {
|
|
1743
|
+
const a = Kr(r[o]);
|
|
1744
|
+
Ur(t, o, a);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
function $r(t) {
|
|
1748
|
+
return !!(I(t) && t.add);
|
|
1749
|
+
}
|
|
1750
|
+
function ge(t, e) {
|
|
1751
|
+
const i = t.getValue("willChange");
|
|
1752
|
+
if ($r(i))
|
|
1753
|
+
return i.add(e);
|
|
1754
|
+
if (!i && Y.WillChange) {
|
|
1755
|
+
const s = new Y.WillChange("auto");
|
|
1756
|
+
t.addValue("willChange", s), s.add(e);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
function He(t) {
|
|
1760
|
+
return t.replace(/([A-Z])/g, (e) => `-${e.toLowerCase()}`);
|
|
1761
|
+
}
|
|
1762
|
+
const Gr = "framerAppearId", Hr = "data-" + He(Gr);
|
|
1763
|
+
function en(t) {
|
|
1764
|
+
return t.props[Hr];
|
|
1765
|
+
}
|
|
1766
|
+
const Wr = typeof window < "u";
|
|
1767
|
+
function zr({ protectedKeys: t, needsAnimating: e }, i) {
|
|
1768
|
+
const s = t.hasOwnProperty(i) && e[i] !== !0;
|
|
1769
|
+
return e[i] = !1, s;
|
|
1770
|
+
}
|
|
1771
|
+
function sn(t, e, { delay: i = 0, transitionOverride: s, type: n } = {}) {
|
|
1772
|
+
let { transition: r, transitionEnd: o, ...a } = e;
|
|
1773
|
+
const l = t.getDefaultTransition();
|
|
1774
|
+
r = r ? Zs(r, l) : l;
|
|
1775
|
+
const u = r?.reduceMotion, c = r?.skipAnimations;
|
|
1776
|
+
s && (r = s);
|
|
1777
|
+
const h = [], f = n && t.animationState && t.animationState.getState()[n], m = r?.path;
|
|
1778
|
+
m && m.animateVisualElement(t, a, r, i, h);
|
|
1779
|
+
for (const d in a) {
|
|
1780
|
+
const v = t.getValue(d, t.latestValues[d] ?? null), p = a[d];
|
|
1781
|
+
if (p === void 0 || f && zr(f, d))
|
|
1782
|
+
continue;
|
|
1783
|
+
const x = {
|
|
1784
|
+
delay: i,
|
|
1785
|
+
...$e(r || {}, d)
|
|
1786
|
+
};
|
|
1787
|
+
c && (x.skipAnimations = !0);
|
|
1788
|
+
const T = v.get();
|
|
1789
|
+
if (T !== void 0 && !v.isAnimating() && !Array.isArray(p) && p === T && !x.velocity) {
|
|
1790
|
+
S.update(() => v.set(p));
|
|
1791
|
+
continue;
|
|
1792
|
+
}
|
|
1793
|
+
let P = !1;
|
|
1794
|
+
if (Wr && window.MotionHandoffAnimation) {
|
|
1795
|
+
const D = en(t);
|
|
1796
|
+
if (D) {
|
|
1797
|
+
const y = window.MotionHandoffAnimation(D, d, S);
|
|
1798
|
+
y !== null && (x.startTime = y, P = !0);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
ge(t, d);
|
|
1802
|
+
const b = u ?? t.shouldReduceMotion;
|
|
1803
|
+
v.start(Ge(d, v, p, b && tn.has(d) ? { type: !1 } : x, t, P));
|
|
1804
|
+
const A = v.animation;
|
|
1805
|
+
A && h.push(A);
|
|
1806
|
+
}
|
|
1807
|
+
if (o) {
|
|
1808
|
+
const d = () => S.update(() => {
|
|
1809
|
+
o && _r(t, o);
|
|
1810
|
+
});
|
|
1811
|
+
h.length ? Promise.all(h).then(d) : d();
|
|
1812
|
+
}
|
|
1813
|
+
return h;
|
|
1814
|
+
}
|
|
1815
|
+
function ve(t, e, i = {}) {
|
|
1816
|
+
const s = ut(t, e, i.type === "exit" ? t.presenceContext?.custom : void 0);
|
|
1817
|
+
let { transition: n = t.getDefaultTransition() || {} } = s || {};
|
|
1818
|
+
i.transitionOverride && (n = i.transitionOverride);
|
|
1819
|
+
const r = s ? () => Promise.all(sn(t, s, i)) : () => Promise.resolve(), o = t.variantChildren && t.variantChildren.size ? (l = 0) => {
|
|
1820
|
+
const { delayChildren: u = 0, staggerChildren: c, staggerDirection: h } = n;
|
|
1821
|
+
return Xr(t, e, l, u, c, h, i);
|
|
1822
|
+
} : () => Promise.resolve(), { when: a } = n;
|
|
1823
|
+
if (a) {
|
|
1824
|
+
const [l, u] = a === "beforeChildren" ? [r, o] : [o, r];
|
|
1825
|
+
return l().then(() => u());
|
|
1826
|
+
} else
|
|
1827
|
+
return Promise.all([r(), o(i.delay)]);
|
|
1828
|
+
}
|
|
1829
|
+
function Xr(t, e, i = 0, s = 0, n = 0, r = 1, o) {
|
|
1830
|
+
const a = [];
|
|
1831
|
+
for (const l of t.variantChildren)
|
|
1832
|
+
l.notify("AnimationStart", e), a.push(ve(l, e, {
|
|
1833
|
+
...o,
|
|
1834
|
+
delay: i + (typeof s == "function" ? 0 : s) + qs(t.variantChildren, l, s, n, r)
|
|
1835
|
+
}).then(() => l.notify("AnimationComplete", e)));
|
|
1836
|
+
return Promise.all(a);
|
|
1837
|
+
}
|
|
1838
|
+
function Yr(t, e, i = {}) {
|
|
1839
|
+
t.notify("AnimationStart", e);
|
|
1840
|
+
let s;
|
|
1841
|
+
if (Array.isArray(e)) {
|
|
1842
|
+
const n = e.map((r) => ve(t, r, i));
|
|
1843
|
+
s = Promise.all(n);
|
|
1844
|
+
} else if (typeof e == "string")
|
|
1845
|
+
s = ve(t, e, i);
|
|
1846
|
+
else {
|
|
1847
|
+
const n = typeof e == "function" ? ut(t, e, i.custom) : e;
|
|
1848
|
+
s = Promise.all(sn(t, n, i));
|
|
1849
|
+
}
|
|
1850
|
+
return s.then(() => {
|
|
1851
|
+
t.notify("AnimationComplete", e);
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
const qr = {
|
|
1855
|
+
test: (t) => t === "auto",
|
|
1856
|
+
parse: (t) => t
|
|
1857
|
+
}, Zr = (t) => (e) => e.test(t), Jr = [we, Ot, nt, _n, $n, Gn, qr], mi = (t) => Jr.find(Zr(t));
|
|
1858
|
+
function Qr(t) {
|
|
1859
|
+
return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Me(t) : !0;
|
|
1860
|
+
}
|
|
1861
|
+
const ta = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
1862
|
+
function ea(t, e, i) {
|
|
1863
|
+
let s = 0, n;
|
|
1864
|
+
for (; s < t.length && !n; ) {
|
|
1865
|
+
const r = t[s];
|
|
1866
|
+
typeof r == "string" && !ta.has(r) && mo(r) && (n = t[s]), s++;
|
|
1867
|
+
}
|
|
1868
|
+
if (n && i)
|
|
1869
|
+
for (const r of e)
|
|
1870
|
+
t[r] !== n && (t[r] = Ke(i, n));
|
|
1871
|
+
}
|
|
1872
|
+
class ia extends _e {
|
|
1873
|
+
constructor(e, i, s, n, r) {
|
|
1874
|
+
super(e, i, s, n, r, !0);
|
|
1875
|
+
}
|
|
1876
|
+
readKeyframes() {
|
|
1877
|
+
const { unresolvedKeyframes: e, element: i, name: s } = this;
|
|
1878
|
+
if (!i || !i.current)
|
|
1879
|
+
return;
|
|
1880
|
+
super.readKeyframes();
|
|
1881
|
+
for (let c = 0; c < e.length; c++) {
|
|
1882
|
+
let h = e[c];
|
|
1883
|
+
if (typeof h == "string" && (h = h.trim(), Ae(h))) {
|
|
1884
|
+
const f = Js(h, i.current);
|
|
1885
|
+
f !== void 0 && (e[c] = f), c === e.length - 1 && (this.finalKeyframe = h);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
if (this.resolveNoneKeyframes(), !tn.has(s) || e.length !== 2)
|
|
1889
|
+
return;
|
|
1890
|
+
const [n, r] = e;
|
|
1891
|
+
if (typeof n == "number" && typeof r == "number")
|
|
1892
|
+
return;
|
|
1893
|
+
const o = mi(n), a = mi(r), l = Ze(n), u = Ze(r);
|
|
1894
|
+
if (l !== u && it[s]) {
|
|
1895
|
+
this.needsMeasurement = !0;
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
if (o !== a)
|
|
1899
|
+
if (li(o) && li(a))
|
|
1900
|
+
for (let c = 0; c < e.length; c++) {
|
|
1901
|
+
const h = e[c];
|
|
1902
|
+
typeof h == "string" && (e[c] = parseFloat(h));
|
|
1903
|
+
}
|
|
1904
|
+
else it[s] && (this.needsMeasurement = !0);
|
|
1905
|
+
}
|
|
1906
|
+
resolveNoneKeyframes() {
|
|
1907
|
+
const { unresolvedKeyframes: e, name: i } = this, s = [];
|
|
1908
|
+
for (let n = 0; n < e.length; n++)
|
|
1909
|
+
(e[n] === null || Qr(e[n])) && s.push(n);
|
|
1910
|
+
s.length && ea(e, s, i);
|
|
1911
|
+
}
|
|
1912
|
+
measure() {
|
|
1913
|
+
const { element: e, name: i } = this;
|
|
1914
|
+
return it[i](window.getComputedStyle(e.current), () => e.measureViewportBox());
|
|
1915
|
+
}
|
|
1916
|
+
measureInitialState() {
|
|
1917
|
+
const { element: e, unresolvedKeyframes: i, name: s } = this;
|
|
1918
|
+
if (!e || !e.current)
|
|
1919
|
+
return;
|
|
1920
|
+
s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = this.measure(), i[0] = this.measuredOrigin;
|
|
1921
|
+
const n = i[i.length - 1];
|
|
1922
|
+
n !== void 0 && this.motionValue?.jump(n, !1);
|
|
1923
|
+
}
|
|
1924
|
+
measureEndState() {
|
|
1925
|
+
const { element: e, unresolvedKeyframes: i } = this;
|
|
1926
|
+
if (!e || !e.current)
|
|
1927
|
+
return;
|
|
1928
|
+
this.motionValue?.jump(this.measuredOrigin, !1);
|
|
1929
|
+
const s = i.length - 1, n = i[s];
|
|
1930
|
+
i[s] = this.measure(), n !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = n), this.removedTransforms?.length && this.removedTransforms.forEach(([r, o]) => {
|
|
1931
|
+
e.getValue(r).set(o);
|
|
1932
|
+
}), this.resolveNoneKeyframes();
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
const We = [
|
|
1936
|
+
"borderTopLeftRadius",
|
|
1937
|
+
"borderTopRightRadius",
|
|
1938
|
+
"borderBottomRightRadius",
|
|
1939
|
+
"borderBottomLeftRadius"
|
|
1940
|
+
];
|
|
1941
|
+
function sa(t) {
|
|
1942
|
+
return gs(t) && "offsetHeight" in t && !("ownerSVGElement" in t);
|
|
1943
|
+
}
|
|
1944
|
+
function nn(t) {
|
|
1945
|
+
return gs(t) && "ownerSVGElement" in t;
|
|
1946
|
+
}
|
|
1947
|
+
function on(t, e, i) {
|
|
1948
|
+
if (t == null)
|
|
1949
|
+
return [];
|
|
1950
|
+
if (t instanceof EventTarget)
|
|
1951
|
+
return [t];
|
|
1952
|
+
if (typeof t == "string") {
|
|
1953
|
+
let s = document;
|
|
1954
|
+
const n = i?.[t] ?? s.querySelectorAll(t);
|
|
1955
|
+
return n ? Array.from(n) : [];
|
|
1956
|
+
}
|
|
1957
|
+
return Array.from(t).filter((s) => s != null);
|
|
1958
|
+
}
|
|
1959
|
+
function rn({ top: t, left: e, right: i, bottom: s }) {
|
|
1960
|
+
return {
|
|
1961
|
+
x: { min: e, max: i },
|
|
1962
|
+
y: { min: t, max: s }
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
function na({ x: t, y: e }) {
|
|
1966
|
+
return { top: e.min, right: t.max, bottom: e.max, left: t.min };
|
|
1967
|
+
}
|
|
1968
|
+
function oa(t, e) {
|
|
1969
|
+
if (!e)
|
|
1970
|
+
return t;
|
|
1971
|
+
const i = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
|
|
1972
|
+
return {
|
|
1973
|
+
top: i.y,
|
|
1974
|
+
left: i.x,
|
|
1975
|
+
bottom: s.y,
|
|
1976
|
+
right: s.x
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
function zt(t) {
|
|
1980
|
+
return t === void 0 || t === 1;
|
|
1981
|
+
}
|
|
1982
|
+
function xe({ scale: t, scaleX: e, scaleY: i }) {
|
|
1983
|
+
return !zt(t) || !zt(e) || !zt(i);
|
|
1984
|
+
}
|
|
1985
|
+
function Q(t) {
|
|
1986
|
+
return xe(t) || an(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY;
|
|
1987
|
+
}
|
|
1988
|
+
function an(t) {
|
|
1989
|
+
return yi(t.x) || yi(t.y);
|
|
1990
|
+
}
|
|
1991
|
+
function yi(t) {
|
|
1992
|
+
return t && t !== "0%";
|
|
1993
|
+
}
|
|
1994
|
+
function It(t, e, i) {
|
|
1995
|
+
const s = t - i, n = e * s;
|
|
1996
|
+
return i + n;
|
|
1997
|
+
}
|
|
1998
|
+
function gi(t, e, i, s, n) {
|
|
1999
|
+
return n !== void 0 && (t = It(t, n, s)), It(t, i, s) + e;
|
|
2000
|
+
}
|
|
2001
|
+
function Te(t, e = 0, i = 1, s, n) {
|
|
2002
|
+
t.min = gi(t.min, e, i, s, n), t.max = gi(t.max, e, i, s, n);
|
|
2003
|
+
}
|
|
2004
|
+
function ln(t, { x: e, y: i }) {
|
|
2005
|
+
Te(t.x, e.translate, e.scale, e.originPoint), Te(t.y, i.translate, i.scale, i.originPoint);
|
|
2006
|
+
}
|
|
2007
|
+
const vi = 0.999999999999, xi = 1.0000000000001;
|
|
2008
|
+
function ra(t, e, i, s = !1) {
|
|
2009
|
+
const n = i.length;
|
|
2010
|
+
if (!n)
|
|
2011
|
+
return;
|
|
2012
|
+
e.x = e.y = 1;
|
|
2013
|
+
let r, o;
|
|
2014
|
+
for (let a = 0; a < n; a++) {
|
|
2015
|
+
r = i[a], o = r.projectionDelta;
|
|
2016
|
+
const { visualElement: l } = r.options;
|
|
2017
|
+
l && l.props.style && l.props.style.display === "contents" || (s && r.options.layoutScroll && r.scroll && r !== r.root && (G(t.x, -r.scroll.offset.x), G(t.y, -r.scroll.offset.y)), o && (e.x *= o.x.scale, e.y *= o.y.scale, ln(t, o)), s && Q(r.latestValues) && Ct(t, r.latestValues, r.layout?.layoutBox));
|
|
2018
|
+
}
|
|
2019
|
+
e.x < xi && e.x > vi && (e.x = 1), e.y < xi && e.y > vi && (e.y = 1);
|
|
2020
|
+
}
|
|
2021
|
+
function G(t, e) {
|
|
2022
|
+
t.min += e, t.max += e;
|
|
2023
|
+
}
|
|
2024
|
+
function Ti(t, e, i, s, n = 0.5) {
|
|
2025
|
+
const r = w(t.min, t.max, n);
|
|
2026
|
+
Te(t, e, i, r, s);
|
|
2027
|
+
}
|
|
2028
|
+
function Pi(t, e) {
|
|
2029
|
+
return typeof t == "string" ? parseFloat(t) / 100 * (e.max - e.min) : t;
|
|
2030
|
+
}
|
|
2031
|
+
function Ct(t, e, i) {
|
|
2032
|
+
const s = i ?? t;
|
|
2033
|
+
Ti(t.x, Pi(e.x, s.x), e.scaleX, e.scale, e.originX), Ti(t.y, Pi(e.y, s.y), e.scaleY, e.scale, e.originY);
|
|
2034
|
+
}
|
|
2035
|
+
function cn(t, e) {
|
|
2036
|
+
return rn(oa(t.getBoundingClientRect(), e));
|
|
2037
|
+
}
|
|
2038
|
+
function aa(t, e, i) {
|
|
2039
|
+
const s = cn(t, i), { scroll: n } = e;
|
|
2040
|
+
return n && (G(s.x, n.offset.x), G(s.y, n.offset.y)), s;
|
|
2041
|
+
}
|
|
2042
|
+
const { schedule: un } = /* @__PURE__ */ Hn(queueMicrotask, !1), la = {
|
|
2043
|
+
y: !1
|
|
2044
|
+
};
|
|
2045
|
+
function ca() {
|
|
2046
|
+
return la.y;
|
|
2047
|
+
}
|
|
2048
|
+
function hn(t, e) {
|
|
2049
|
+
const i = on(t), s = new AbortController(), n = {
|
|
2050
|
+
passive: !0,
|
|
2051
|
+
...e,
|
|
2052
|
+
signal: s.signal
|
|
2053
|
+
};
|
|
2054
|
+
return [i, n, () => s.abort()];
|
|
2055
|
+
}
|
|
2056
|
+
function ua(t) {
|
|
2057
|
+
return !(t.pointerType === "touch" || ca());
|
|
2058
|
+
}
|
|
2059
|
+
function ha(t, e, i = {}) {
|
|
2060
|
+
const [s, n, r] = hn(t, i);
|
|
2061
|
+
return s.forEach((o) => {
|
|
2062
|
+
let a = !1, l = !1, u;
|
|
2063
|
+
const c = () => {
|
|
2064
|
+
o.removeEventListener("pointerleave", d);
|
|
2065
|
+
}, h = (p) => {
|
|
2066
|
+
u && (u(p), u = void 0), c();
|
|
2067
|
+
}, f = (p) => {
|
|
2068
|
+
a = !1, window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", f), l && (l = !1, h(p));
|
|
2069
|
+
}, m = () => {
|
|
2070
|
+
a = !0, window.addEventListener("pointerup", f, n), window.addEventListener("pointercancel", f, n);
|
|
2071
|
+
}, d = (p) => {
|
|
2072
|
+
if (p.pointerType !== "touch") {
|
|
2073
|
+
if (a) {
|
|
2074
|
+
l = !0;
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
2077
|
+
h(p);
|
|
2078
|
+
}
|
|
2079
|
+
}, v = (p) => {
|
|
2080
|
+
if (!ua(p))
|
|
2081
|
+
return;
|
|
2082
|
+
l = !1;
|
|
2083
|
+
const x = e(o, p);
|
|
2084
|
+
typeof x == "function" && (u = x, o.addEventListener("pointerleave", d, n));
|
|
2085
|
+
};
|
|
2086
|
+
o.addEventListener("pointerenter", v, n), o.addEventListener("pointerdown", m, n);
|
|
2087
|
+
}), r;
|
|
2088
|
+
}
|
|
2089
|
+
const fn = (t, e) => e ? t === e ? !0 : fn(t, e.parentElement) : !1, fa = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, da = /* @__PURE__ */ new Set([
|
|
2090
|
+
"BUTTON",
|
|
2091
|
+
"INPUT",
|
|
2092
|
+
"SELECT",
|
|
2093
|
+
"TEXTAREA",
|
|
2094
|
+
"A"
|
|
2095
|
+
]);
|
|
2096
|
+
function pa(t) {
|
|
2097
|
+
return da.has(t.tagName) || t.isContentEditable === !0;
|
|
2098
|
+
}
|
|
2099
|
+
const Et = /* @__PURE__ */ new WeakSet();
|
|
2100
|
+
function bi(t) {
|
|
2101
|
+
return (e) => {
|
|
2102
|
+
e.key === "Enter" && t(e);
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
function Xt(t, e) {
|
|
2106
|
+
t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
|
|
2107
|
+
}
|
|
2108
|
+
const ma = (t, e) => {
|
|
2109
|
+
const i = t.currentTarget;
|
|
2110
|
+
if (!i)
|
|
2111
|
+
return;
|
|
2112
|
+
const s = bi(() => {
|
|
2113
|
+
if (Et.has(i))
|
|
2114
|
+
return;
|
|
2115
|
+
Xt(i, "down");
|
|
2116
|
+
const n = bi(() => {
|
|
2117
|
+
Xt(i, "up");
|
|
2118
|
+
}), r = () => Xt(i, "cancel");
|
|
2119
|
+
i.addEventListener("keyup", n, e), i.addEventListener("blur", r, e);
|
|
2120
|
+
});
|
|
2121
|
+
i.addEventListener("keydown", s, e), i.addEventListener("blur", () => i.removeEventListener("keydown", s), e);
|
|
2122
|
+
};
|
|
2123
|
+
function Si(t) {
|
|
2124
|
+
return fa(t) && !0;
|
|
2125
|
+
}
|
|
2126
|
+
const wi = /* @__PURE__ */ new WeakSet();
|
|
2127
|
+
function ya(t, e, i = {}) {
|
|
2128
|
+
const [s, n, r] = hn(t, i), o = (a) => {
|
|
2129
|
+
const l = a.currentTarget;
|
|
2130
|
+
if (!Si(a) || wi.has(a))
|
|
2131
|
+
return;
|
|
2132
|
+
Et.add(l), i.stopPropagation && wi.add(a);
|
|
2133
|
+
const u = e(l, a), c = { ...n, capture: !0 }, h = (d, v) => {
|
|
2134
|
+
window.removeEventListener("pointerup", f, c), window.removeEventListener("pointercancel", m, c), Et.has(l) && Et.delete(l), Si(d) && typeof u == "function" && u(d, { success: v });
|
|
2135
|
+
}, f = (d) => {
|
|
2136
|
+
h(d, l === window || l === document || i.useGlobalTarget || fn(l, d.target));
|
|
2137
|
+
}, m = (d) => {
|
|
2138
|
+
h(d, !1);
|
|
2139
|
+
};
|
|
2140
|
+
window.addEventListener("pointerup", f, c), window.addEventListener("pointercancel", m, c);
|
|
2141
|
+
};
|
|
2142
|
+
return s.forEach((a) => {
|
|
2143
|
+
(i.useGlobalTarget ? window : a).addEventListener("pointerdown", o, n), sa(a) && (a.addEventListener("focus", (u) => ma(u, n)), !pa(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
|
|
2144
|
+
}), r;
|
|
2145
|
+
}
|
|
2146
|
+
function ga(t) {
|
|
2147
|
+
return nn(t) && t.tagName === "svg";
|
|
2148
|
+
}
|
|
2149
|
+
const Ai = () => ({
|
|
2150
|
+
translate: 0,
|
|
2151
|
+
scale: 1,
|
|
2152
|
+
origin: 0,
|
|
2153
|
+
originPoint: 0
|
|
2154
|
+
}), lt = () => ({
|
|
2155
|
+
x: Ai(),
|
|
2156
|
+
y: Ai()
|
|
2157
|
+
}), Vi = () => ({ min: 0, max: 0 }), E = () => ({
|
|
2158
|
+
x: Vi(),
|
|
2159
|
+
y: Vi()
|
|
2160
|
+
}), va = /* @__PURE__ */ new WeakMap();
|
|
2161
|
+
function ze(t) {
|
|
2162
|
+
return t !== null && typeof t == "object" && typeof t.start == "function";
|
|
2163
|
+
}
|
|
2164
|
+
const xa = [
|
|
2165
|
+
"animate",
|
|
2166
|
+
"whileInView",
|
|
2167
|
+
"whileFocus",
|
|
2168
|
+
"whileHover",
|
|
2169
|
+
"whileTap",
|
|
2170
|
+
"whileDrag",
|
|
2171
|
+
"exit"
|
|
2172
|
+
], Di = ["initial", ...xa];
|
|
2173
|
+
function dn(t) {
|
|
2174
|
+
if (ze(t.animate))
|
|
2175
|
+
return !0;
|
|
2176
|
+
for (let e = 0; e < Di.length; e++)
|
|
2177
|
+
if (De(t[Di[e]]))
|
|
2178
|
+
return !0;
|
|
2179
|
+
return !1;
|
|
2180
|
+
}
|
|
2181
|
+
function Ta(t) {
|
|
2182
|
+
return !!(dn(t) || t.variants);
|
|
2183
|
+
}
|
|
2184
|
+
function Pa(t, e, i) {
|
|
2185
|
+
for (const s in e) {
|
|
2186
|
+
const n = e[s], r = i[s];
|
|
2187
|
+
if (I(n))
|
|
2188
|
+
t.addValue(s, n);
|
|
2189
|
+
else if (I(r))
|
|
2190
|
+
t.addValue(s, ht(n, { owner: t }));
|
|
2191
|
+
else if (r !== n)
|
|
2192
|
+
if (t.hasValue(s)) {
|
|
2193
|
+
const o = t.getValue(s);
|
|
2194
|
+
o.liveStyle === !0 ? o.jump(n) : o.hasAnimated || o.set(n);
|
|
2195
|
+
} else {
|
|
2196
|
+
const o = t.getStaticValue(s);
|
|
2197
|
+
t.addValue(s, ht(o !== void 0 ? o : n, { owner: t }));
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
for (const s in i)
|
|
2201
|
+
e[s] === void 0 && t.removeValue(s);
|
|
2202
|
+
return e;
|
|
2203
|
+
}
|
|
2204
|
+
const Pe = { current: null }, pn = { current: !1 }, ba = typeof window < "u";
|
|
2205
|
+
function Sa() {
|
|
2206
|
+
if (pn.current = !0, !!ba)
|
|
2207
|
+
if (window.matchMedia) {
|
|
2208
|
+
const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Pe.current = t.matches;
|
|
2209
|
+
t.addEventListener("change", e), e();
|
|
2210
|
+
} else
|
|
2211
|
+
Pe.current = !1;
|
|
2212
|
+
}
|
|
2213
|
+
const Ci = [
|
|
2214
|
+
"AnimationStart",
|
|
2215
|
+
"AnimationComplete",
|
|
2216
|
+
"Update",
|
|
2217
|
+
"BeforeLayoutMeasure",
|
|
2218
|
+
"LayoutMeasure",
|
|
2219
|
+
"LayoutAnimationStart",
|
|
2220
|
+
"LayoutAnimationComplete"
|
|
2221
|
+
];
|
|
2222
|
+
let Ei = {};
|
|
2223
|
+
class wa {
|
|
2224
|
+
/**
|
|
2225
|
+
* This method takes React props and returns found MotionValues. For example, HTML
|
|
2226
|
+
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
|
|
2227
|
+
*
|
|
2228
|
+
* This isn't an abstract method as it needs calling in the constructor, but it is
|
|
2229
|
+
* intended to be one.
|
|
2230
|
+
*/
|
|
2231
|
+
scrapeMotionValuesFromProps(e, i, s) {
|
|
2232
|
+
return {};
|
|
2233
|
+
}
|
|
2234
|
+
constructor({ parent: e, props: i, presenceContext: s, reducedMotionConfig: n, skipAnimations: r, blockInitialAnimation: o, visualState: a }, l = {}) {
|
|
2235
|
+
this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.shouldSkipAnimations = !1, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = _e, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.hasBeenMounted = !1, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
|
|
2236
|
+
this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
|
|
2237
|
+
}, this.renderScheduledAt = 0, this.scheduleRender = () => {
|
|
2238
|
+
const m = B.now();
|
|
2239
|
+
this.renderScheduledAt < m && (this.renderScheduledAt = m, S.render(this.render, !1, !0));
|
|
2240
|
+
};
|
|
2241
|
+
const { latestValues: u, renderState: c } = a;
|
|
2242
|
+
this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = i.initial ? { ...u } : {}, this.renderState = c, this.parent = e, this.props = i, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = n, this.skipAnimationsConfig = r, this.options = l, this.blockInitialAnimation = !!o, this.isControllingVariants = dn(i), this.isVariantNode = Ta(i), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
|
|
2243
|
+
const { willChange: h, ...f } = this.scrapeMotionValuesFromProps(i, {}, this);
|
|
2244
|
+
for (const m in f) {
|
|
2245
|
+
const d = f[m];
|
|
2246
|
+
u[m] !== void 0 && I(d) && d.set(u[m]);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
mount(e) {
|
|
2250
|
+
if (this.hasBeenMounted)
|
|
2251
|
+
for (const i in this.initialValues)
|
|
2252
|
+
this.values.get(i)?.jump(this.initialValues[i]), this.latestValues[i] = this.initialValues[i];
|
|
2253
|
+
this.current = e, va.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((i, s) => this.bindToMotionValue(s, i)), this.reducedMotionConfig === "never" ? this.shouldReduceMotion = !1 : this.reducedMotionConfig === "always" ? this.shouldReduceMotion = !0 : (pn.current || Sa(), this.shouldReduceMotion = Pe.current), this.shouldSkipAnimations = this.skipAnimationsConfig ?? !1, this.parent?.addChild(this), this.update(this.props, this.presenceContext), this.hasBeenMounted = !0;
|
|
2254
|
+
}
|
|
2255
|
+
unmount() {
|
|
2256
|
+
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?.removeChild(this);
|
|
2257
|
+
for (const e in this.events)
|
|
2258
|
+
this.events[e].clear();
|
|
2259
|
+
for (const e in this.features) {
|
|
2260
|
+
const i = this.features[e];
|
|
2261
|
+
i && (i.unmount(), i.isMounted = !1);
|
|
2262
|
+
}
|
|
2263
|
+
this.current = null;
|
|
2264
|
+
}
|
|
2265
|
+
addChild(e) {
|
|
2266
|
+
this.children.add(e), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(e);
|
|
2267
|
+
}
|
|
2268
|
+
removeChild(e) {
|
|
2269
|
+
this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
|
|
2270
|
+
}
|
|
2271
|
+
bindToMotionValue(e, i) {
|
|
2272
|
+
if (this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)(), i.accelerate && ye.has(e) && this.current instanceof HTMLElement) {
|
|
2273
|
+
const { factory: o, keyframes: a, times: l, ease: u, duration: c } = i.accelerate, h = new Xs({
|
|
2274
|
+
element: this.current,
|
|
2275
|
+
name: e,
|
|
2276
|
+
keyframes: a,
|
|
2277
|
+
times: l,
|
|
2278
|
+
ease: u,
|
|
2279
|
+
duration: /* @__PURE__ */ K(c)
|
|
2280
|
+
}), f = o(h);
|
|
2281
|
+
this.valueSubscriptions.set(e, () => {
|
|
2282
|
+
f(), h.cancel();
|
|
2283
|
+
});
|
|
2284
|
+
return;
|
|
2285
|
+
}
|
|
2286
|
+
const s = bt.has(e);
|
|
2287
|
+
s && this.onBindTransform && this.onBindTransform();
|
|
2288
|
+
const n = i.on("change", (o) => {
|
|
2289
|
+
this.latestValues[e] = o, this.props.onUpdate && S.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
|
|
2290
|
+
});
|
|
2291
|
+
let r;
|
|
2292
|
+
typeof window < "u" && window.MotionCheckAppearSync && (r = window.MotionCheckAppearSync(this, e, i)), this.valueSubscriptions.set(e, () => {
|
|
2293
|
+
n(), r && r();
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
sortNodePosition(e) {
|
|
2297
|
+
return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
|
|
2298
|
+
}
|
|
2299
|
+
updateFeatures() {
|
|
2300
|
+
let e = "animation";
|
|
2301
|
+
for (e in Ei) {
|
|
2302
|
+
const i = Ei[e];
|
|
2303
|
+
if (!i)
|
|
2304
|
+
continue;
|
|
2305
|
+
const { isEnabled: s, Feature: n } = i;
|
|
2306
|
+
if (!this.features[e] && n && s(this.props) && (this.features[e] = new n(this)), this.features[e]) {
|
|
2307
|
+
const r = this.features[e];
|
|
2308
|
+
r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
triggerBuild() {
|
|
2313
|
+
this.build(this.renderState, this.latestValues, this.props);
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* Measure the current viewport box with or without transforms.
|
|
2317
|
+
* Only measures axis-aligned boxes, rotate and skew must be manually
|
|
2318
|
+
* removed with a re-render to work.
|
|
2319
|
+
*/
|
|
2320
|
+
measureViewportBox() {
|
|
2321
|
+
return this.current ? this.measureInstanceViewportBox(this.current, this.props) : E();
|
|
2322
|
+
}
|
|
2323
|
+
getStaticValue(e) {
|
|
2324
|
+
return this.latestValues[e];
|
|
2325
|
+
}
|
|
2326
|
+
setStaticValue(e, i) {
|
|
2327
|
+
this.latestValues[e] = i;
|
|
2328
|
+
}
|
|
2329
|
+
/**
|
|
2330
|
+
* Update the provided props. Ensure any newly-added motion values are
|
|
2331
|
+
* added to our map, old ones removed, and listeners updated.
|
|
2332
|
+
*/
|
|
2333
|
+
update(e, i) {
|
|
2334
|
+
(e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = i;
|
|
2335
|
+
for (let s = 0; s < Ci.length; s++) {
|
|
2336
|
+
const n = Ci[s];
|
|
2337
|
+
this.propEventSubscriptions[n] && (this.propEventSubscriptions[n](), delete this.propEventSubscriptions[n]);
|
|
2338
|
+
const r = "on" + n, o = e[r];
|
|
2339
|
+
o && (this.propEventSubscriptions[n] = this.on(n, o));
|
|
2340
|
+
}
|
|
2341
|
+
this.prevMotionValues = Pa(this, this.scrapeMotionValuesFromProps(e, this.prevProps || {}, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
|
|
2342
|
+
}
|
|
2343
|
+
getProps() {
|
|
2344
|
+
return this.props;
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* Returns the variant definition with a given name.
|
|
2348
|
+
*/
|
|
2349
|
+
getVariant(e) {
|
|
2350
|
+
return this.props.variants ? this.props.variants[e] : void 0;
|
|
2351
|
+
}
|
|
2352
|
+
/**
|
|
2353
|
+
* Returns the defined default transition on this component.
|
|
2354
|
+
*/
|
|
2355
|
+
getDefaultTransition() {
|
|
2356
|
+
return this.props.transition;
|
|
2357
|
+
}
|
|
2358
|
+
getTransformPagePoint() {
|
|
2359
|
+
return this.props.transformPagePoint;
|
|
2360
|
+
}
|
|
2361
|
+
getClosestVariantNode() {
|
|
2362
|
+
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
2363
|
+
}
|
|
2364
|
+
/**
|
|
2365
|
+
* Add a child visual element to our set of children.
|
|
2366
|
+
*/
|
|
2367
|
+
addVariantChild(e) {
|
|
2368
|
+
const i = this.getClosestVariantNode();
|
|
2369
|
+
if (i)
|
|
2370
|
+
return i.variantChildren && i.variantChildren.add(e), () => i.variantChildren.delete(e);
|
|
2371
|
+
}
|
|
2372
|
+
/**
|
|
2373
|
+
* Add a motion value and bind it to this visual element.
|
|
2374
|
+
*/
|
|
2375
|
+
addValue(e, i) {
|
|
2376
|
+
const s = this.values.get(e);
|
|
2377
|
+
i !== s && (s && this.removeValue(e), this.bindToMotionValue(e, i), this.values.set(e, i), this.latestValues[e] = i.get());
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* Remove a motion value and unbind any active subscriptions.
|
|
2381
|
+
*/
|
|
2382
|
+
removeValue(e) {
|
|
2383
|
+
this.values.delete(e);
|
|
2384
|
+
const i = this.valueSubscriptions.get(e);
|
|
2385
|
+
i && (i(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Check whether we have a motion value for this key
|
|
2389
|
+
*/
|
|
2390
|
+
hasValue(e) {
|
|
2391
|
+
return this.values.has(e);
|
|
2392
|
+
}
|
|
2393
|
+
getValue(e, i) {
|
|
2394
|
+
if (this.props.values && this.props.values[e])
|
|
2395
|
+
return this.props.values[e];
|
|
2396
|
+
let s = this.values.get(e);
|
|
2397
|
+
return s === void 0 && i !== void 0 && (s = ht(i === null ? void 0 : i, { owner: this }), this.addValue(e, s)), s;
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* If we're trying to animate to a previously unencountered value,
|
|
2401
|
+
* we need to check for it in our state and as a last resort read it
|
|
2402
|
+
* directly from the instance (which might have performance implications).
|
|
2403
|
+
*/
|
|
2404
|
+
readValue(e, i) {
|
|
2405
|
+
let s = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
|
|
2406
|
+
return s != null && (typeof s == "string" && (Ee(s) || Me(s)) ? s = parseFloat(s) : (
|
|
2407
|
+
/**
|
|
2408
|
+
* If the value as read isn't animatable (e.g. "none") but
|
|
2409
|
+
* the target is, derive an animatable none from the target.
|
|
2410
|
+
* A value is animatable if it's a number or contains a
|
|
2411
|
+
* number or color, which is cheaper to check than trying
|
|
2412
|
+
* every value type in turn.
|
|
2413
|
+
*/
|
|
2414
|
+
typeof s != "number" && !j.test(s) && j.test(i) && (s = Ke(e, i))
|
|
2415
|
+
), this.setBaseTarget(e, I(s) ? s.get() : s)), I(s) ? s.get() : s;
|
|
2416
|
+
}
|
|
2417
|
+
/**
|
|
2418
|
+
* Set the base target to later animate back to. This is currently
|
|
2419
|
+
* only hydrated on creation and when we first read a value.
|
|
2420
|
+
*/
|
|
2421
|
+
setBaseTarget(e, i) {
|
|
2422
|
+
this.baseTarget[e] = i;
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Find the base target for a value thats been removed from all animation
|
|
2426
|
+
* props.
|
|
2427
|
+
*/
|
|
2428
|
+
getBaseTarget(e) {
|
|
2429
|
+
const { initial: i } = this.props;
|
|
2430
|
+
let s;
|
|
2431
|
+
if (typeof i == "string" || typeof i == "object") {
|
|
2432
|
+
const r = Qs(this.props, i, this.presenceContext?.custom);
|
|
2433
|
+
r && (s = r[e]);
|
|
2434
|
+
}
|
|
2435
|
+
if (i && s !== void 0)
|
|
2436
|
+
return s;
|
|
2437
|
+
const n = this.getBaseTargetFromProps(this.props, e);
|
|
2438
|
+
return n !== void 0 && !I(n) ? n : this.initialValues[e] !== void 0 && s === void 0 ? void 0 : this.baseTarget[e];
|
|
2439
|
+
}
|
|
2440
|
+
on(e, i) {
|
|
2441
|
+
return this.events[e] || (this.events[e] = new Lt()), this.events[e].add(i);
|
|
2442
|
+
}
|
|
2443
|
+
notify(e, ...i) {
|
|
2444
|
+
this.events[e] && this.events[e].notify(...i);
|
|
2445
|
+
}
|
|
2446
|
+
scheduleRenderMicrotask() {
|
|
2447
|
+
un.render(this.render);
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
class mn extends wa {
|
|
2451
|
+
constructor() {
|
|
2452
|
+
super(...arguments), this.KeyframeResolver = ia;
|
|
2453
|
+
}
|
|
2454
|
+
sortInstanceNodePosition(e, i) {
|
|
2455
|
+
return e.compareDocumentPosition(i) & 2 ? 1 : -1;
|
|
2456
|
+
}
|
|
2457
|
+
getBaseTargetFromProps(e, i) {
|
|
2458
|
+
const s = e.style;
|
|
2459
|
+
return s ? s[i] : void 0;
|
|
2460
|
+
}
|
|
2461
|
+
removeValueFromRenderState(e, { vars: i, style: s }) {
|
|
2462
|
+
delete i[e], delete s[e];
|
|
2463
|
+
}
|
|
2464
|
+
handleChildMotionValue() {
|
|
2465
|
+
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
|
2466
|
+
const { children: e } = this.props;
|
|
2467
|
+
I(e) && (this.childSubscription = e.on("change", (i) => {
|
|
2468
|
+
this.current && (this.current.textContent = `${i}`);
|
|
2469
|
+
}));
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
function yn(t, { style: e, vars: i }, s, n) {
|
|
2473
|
+
const r = t.style;
|
|
2474
|
+
let o;
|
|
2475
|
+
for (o in e)
|
|
2476
|
+
r[o] = e[o];
|
|
2477
|
+
n?.applyProjectionStyles(r, s);
|
|
2478
|
+
for (o in i)
|
|
2479
|
+
r.setProperty(o, i[o]);
|
|
2480
|
+
}
|
|
2481
|
+
function Mi(t, e) {
|
|
2482
|
+
return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
|
|
2483
|
+
}
|
|
2484
|
+
const H = {
|
|
2485
|
+
correct: (t, e) => {
|
|
2486
|
+
if (!e.target)
|
|
2487
|
+
return t;
|
|
2488
|
+
if (typeof t == "string")
|
|
2489
|
+
if (Ot.test(t))
|
|
2490
|
+
t = parseFloat(t);
|
|
2491
|
+
else
|
|
2492
|
+
return t;
|
|
2493
|
+
const i = Mi(t, e.target.x), s = Mi(t, e.target.y);
|
|
2494
|
+
return `${i}% ${s}%`;
|
|
2495
|
+
}
|
|
2496
|
+
}, gn = {
|
|
2497
|
+
correct: (t, { treeScale: e, projectionDelta: i }) => {
|
|
2498
|
+
const s = t, n = j.parse(t);
|
|
2499
|
+
if (n.length > 5)
|
|
2500
|
+
return s;
|
|
2501
|
+
const r = j.createTransformer(t), o = typeof n[0] != "number" ? 1 : 0, a = i.x.scale * e.x, l = i.y.scale * e.y;
|
|
2502
|
+
n[0 + o] /= a, n[1 + o] /= l;
|
|
2503
|
+
const u = w(a, l, 0.5);
|
|
2504
|
+
return typeof n[2 + o] == "number" && (n[2 + o] /= u), typeof n[3 + o] == "number" && (n[3 + o] /= u), r(n);
|
|
2505
|
+
}
|
|
2506
|
+
}, xt = {
|
|
2507
|
+
borderRadius: {
|
|
2508
|
+
...H,
|
|
2509
|
+
applyTo: [...We]
|
|
2510
|
+
},
|
|
2511
|
+
borderTopLeftRadius: H,
|
|
2512
|
+
borderTopRightRadius: H,
|
|
2513
|
+
borderBottomLeftRadius: H,
|
|
2514
|
+
borderBottomRightRadius: H,
|
|
2515
|
+
boxShadow: gn
|
|
2516
|
+
};
|
|
2517
|
+
function vn(t) {
|
|
2518
|
+
for (const e in t)
|
|
2519
|
+
xt[e] = t[e], ps(e) && (xt[e].isCSSVariable = !0);
|
|
2520
|
+
}
|
|
2521
|
+
function Aa(t, { layout: e, layoutId: i }) {
|
|
2522
|
+
return bt.has(t) || t.startsWith("origin") || (e || i !== void 0) && (!!xt[t] || t === "opacity");
|
|
2523
|
+
}
|
|
2524
|
+
function xn(t, e, i) {
|
|
2525
|
+
const s = t.style, n = e?.style, r = {};
|
|
2526
|
+
if (!s)
|
|
2527
|
+
return r;
|
|
2528
|
+
for (const o in s)
|
|
2529
|
+
(I(s[o]) || n && I(n[o]) || Aa(o, t) || i?.getValue(o)?.liveStyle !== void 0) && (r[o] = s[o]);
|
|
2530
|
+
return r;
|
|
2531
|
+
}
|
|
2532
|
+
function Va(t) {
|
|
2533
|
+
return window.getComputedStyle(t);
|
|
2534
|
+
}
|
|
2535
|
+
class Da extends mn {
|
|
2536
|
+
constructor() {
|
|
2537
|
+
super(...arguments), this.type = "html", this.renderInstance = yn;
|
|
2538
|
+
}
|
|
2539
|
+
mount(e) {
|
|
2540
|
+
ot(!!e.style, "motion.create() components must forward their ref to a HTML or SVG element", "custom-component-ref"), super.mount(e);
|
|
2541
|
+
}
|
|
2542
|
+
readValueFromInstance(e, i) {
|
|
2543
|
+
if (bt.has(i))
|
|
2544
|
+
return this.projection?.isProjecting ? ue(i) : sr(e, i);
|
|
2545
|
+
{
|
|
2546
|
+
const s = Va(e), n = (ps(i) ? s.getPropertyValue(i) : s[i]) || 0;
|
|
2547
|
+
return typeof n == "string" ? n.trim() : n;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
measureInstanceViewportBox(e, { transformPagePoint: i }) {
|
|
2551
|
+
return cn(e, i);
|
|
2552
|
+
}
|
|
2553
|
+
build(e, i, s) {
|
|
2554
|
+
Wn(e, i, s.transformTemplate);
|
|
2555
|
+
}
|
|
2556
|
+
scrapeMotionValuesFromProps(e, i, s) {
|
|
2557
|
+
return xn(e, i, s);
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
function Ca(t, e, i, s) {
|
|
2561
|
+
yn(t, e, void 0, s);
|
|
2562
|
+
for (const n in e.attrs)
|
|
2563
|
+
t.setAttribute(ms.has(n) ? n : He(n), e.attrs[n]);
|
|
2564
|
+
}
|
|
2565
|
+
function Ea(t, e, i) {
|
|
2566
|
+
const s = xn(t, e, i);
|
|
2567
|
+
for (const n in t)
|
|
2568
|
+
if (I(t[n]) || I(e[n])) {
|
|
2569
|
+
const r = Ve.indexOf(n) !== -1 ? "attr" + n.charAt(0).toUpperCase() + n.substring(1) : n;
|
|
2570
|
+
s[r] = t[n];
|
|
2571
|
+
}
|
|
2572
|
+
return s;
|
|
2573
|
+
}
|
|
2574
|
+
class Ma extends mn {
|
|
2575
|
+
constructor() {
|
|
2576
|
+
super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = E;
|
|
2577
|
+
}
|
|
2578
|
+
getBaseTargetFromProps(e, i) {
|
|
2579
|
+
return e[i];
|
|
2580
|
+
}
|
|
2581
|
+
readValueFromInstance(e, i) {
|
|
2582
|
+
if (bt.has(i)) {
|
|
2583
|
+
const s = Us(i);
|
|
2584
|
+
return s && s.default || 0;
|
|
2585
|
+
}
|
|
2586
|
+
if (zn.includes(i)) {
|
|
2587
|
+
const n = getComputedStyle(e)[i];
|
|
2588
|
+
if (typeof n == "string" && n)
|
|
2589
|
+
return n.trim();
|
|
2590
|
+
}
|
|
2591
|
+
return i = ms.has(i) ? i : He(i), e.getAttribute(i);
|
|
2592
|
+
}
|
|
2593
|
+
scrapeMotionValuesFromProps(e, i, s) {
|
|
2594
|
+
return Ea(e, i, s);
|
|
2595
|
+
}
|
|
2596
|
+
build(e, i, s) {
|
|
2597
|
+
Xn(e, i, this.isSVGTag, s.transformTemplate, s.style);
|
|
2598
|
+
}
|
|
2599
|
+
renderInstance(e, i, s, n) {
|
|
2600
|
+
Ca(e, i, s, n);
|
|
2601
|
+
}
|
|
2602
|
+
mount(e) {
|
|
2603
|
+
this.isSVGTag = Yn(e.tagName), super.mount(e);
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
function be(t, e) {
|
|
2607
|
+
t.min = e.min, t.max = e.max;
|
|
2608
|
+
}
|
|
2609
|
+
function _(t, e) {
|
|
2610
|
+
be(t.x, e.x), be(t.y, e.y);
|
|
2611
|
+
}
|
|
2612
|
+
function Ri(t, e) {
|
|
2613
|
+
t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
|
|
2614
|
+
}
|
|
2615
|
+
const Tn = 1e-4, Ra = 1 - Tn, La = 1 + Tn, Pn = 0.01, ka = 0 - Pn, Ba = 0 + Pn;
|
|
2616
|
+
function F(t) {
|
|
2617
|
+
return t.max - t.min;
|
|
2618
|
+
}
|
|
2619
|
+
function Fa(t, e, i) {
|
|
2620
|
+
return Math.abs(t - e) <= i;
|
|
2621
|
+
}
|
|
2622
|
+
function Li(t, e, i, s = 0.5) {
|
|
2623
|
+
t.origin = s, t.originPoint = w(e.min, e.max, t.origin), t.scale = F(i) / F(e), t.translate = w(i.min, i.max, t.origin) - t.originPoint, (t.scale >= Ra && t.scale <= La || isNaN(t.scale)) && (t.scale = 1), (t.translate >= ka && t.translate <= Ba || isNaN(t.translate)) && (t.translate = 0);
|
|
2624
|
+
}
|
|
2625
|
+
function mt(t, e, i, s) {
|
|
2626
|
+
Li(t.x, e.x, i.x, s ? s.originX : void 0), Li(t.y, e.y, i.y, s ? s.originY : void 0);
|
|
2627
|
+
}
|
|
2628
|
+
function ki(t, e, i, s = 0) {
|
|
2629
|
+
const n = s ? w(i.min, i.max, s) : i.min;
|
|
2630
|
+
t.min = n + e.min, t.max = t.min + F(e);
|
|
2631
|
+
}
|
|
2632
|
+
function Ia(t, e, i, s) {
|
|
2633
|
+
ki(t.x, e.x, i.x, s?.x), ki(t.y, e.y, i.y, s?.y);
|
|
2634
|
+
}
|
|
2635
|
+
function Bi(t, e, i, s = 0) {
|
|
2636
|
+
const n = s ? w(i.min, i.max, s) : i.min;
|
|
2637
|
+
t.min = e.min - n, t.max = t.min + F(e);
|
|
2638
|
+
}
|
|
2639
|
+
function jt(t, e, i, s) {
|
|
2640
|
+
Bi(t.x, e.x, i.x, s?.x), Bi(t.y, e.y, i.y, s?.y);
|
|
2641
|
+
}
|
|
2642
|
+
function Fi(t, e, i, s, n) {
|
|
2643
|
+
return t -= e, t = It(t, 1 / i, s), n !== void 0 && (t = It(t, 1 / n, s)), t;
|
|
2644
|
+
}
|
|
2645
|
+
function ja(t, e = 0, i = 1, s = 0.5, n, r = t, o = t) {
|
|
2646
|
+
if (nt.test(e) && (e = parseFloat(e), e = w(o.min, o.max, e / 100) - o.min), typeof e != "number")
|
|
2647
|
+
return;
|
|
2648
|
+
let a = w(r.min, r.max, s);
|
|
2649
|
+
t === r && (a -= e), t.min = Fi(t.min, e, i, a, n), t.max = Fi(t.max, e, i, a, n);
|
|
2650
|
+
}
|
|
2651
|
+
function Ii(t, e, [i, s, n], r, o) {
|
|
2652
|
+
ja(t, e[i], e[s], e[n], e.scale, r, o);
|
|
2653
|
+
}
|
|
2654
|
+
const Oa = ["x", "scaleX", "originX"], Na = ["y", "scaleY", "originY"];
|
|
2655
|
+
function ji(t, e, i, s) {
|
|
2656
|
+
Ii(t.x, e, Oa, i ? i.x : void 0, s ? s.x : void 0), Ii(t.y, e, Na, i ? i.y : void 0, s ? s.y : void 0);
|
|
2657
|
+
}
|
|
2658
|
+
function Oi(t) {
|
|
2659
|
+
return t.translate === 0 && t.scale === 1;
|
|
2660
|
+
}
|
|
2661
|
+
function bn(t) {
|
|
2662
|
+
return Oi(t.x) && Oi(t.y);
|
|
2663
|
+
}
|
|
2664
|
+
function Ni(t, e) {
|
|
2665
|
+
return t.min === e.min && t.max === e.max;
|
|
2666
|
+
}
|
|
2667
|
+
function Ua(t, e) {
|
|
2668
|
+
return Ni(t.x, e.x) && Ni(t.y, e.y);
|
|
2669
|
+
}
|
|
2670
|
+
function Ui(t, e) {
|
|
2671
|
+
return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
|
|
2672
|
+
}
|
|
2673
|
+
function Sn(t, e) {
|
|
2674
|
+
return Ui(t.x, e.x) && Ui(t.y, e.y);
|
|
2675
|
+
}
|
|
2676
|
+
function Ki(t) {
|
|
2677
|
+
return F(t.x) / F(t.y);
|
|
2678
|
+
}
|
|
2679
|
+
function _i(t, e) {
|
|
2680
|
+
return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
|
|
2681
|
+
}
|
|
2682
|
+
function $(t) {
|
|
2683
|
+
return [t("x"), t("y")];
|
|
2684
|
+
}
|
|
2685
|
+
function Ka(t, e, i) {
|
|
2686
|
+
let s = "";
|
|
2687
|
+
const n = t.x.translate / e.x, r = t.y.translate / e.y, o = i?.z || 0;
|
|
2688
|
+
if ((n || r || o) && (s = `translate3d(${n}px, ${r}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (s += `scale(${1 / e.x}, ${1 / e.y}) `), i) {
|
|
2689
|
+
const { transformPerspective: u, rotate: c, pathRotation: h, rotateX: f, rotateY: m, skewX: d, skewY: v } = i;
|
|
2690
|
+
u && (s = `perspective(${u}px) ${s}`), c && (s += `rotate(${c}deg) `), h && (s += `rotate(${h}deg) `), f && (s += `rotateX(${f}deg) `), m && (s += `rotateY(${m}deg) `), d && (s += `skewX(${d}deg) `), v && (s += `skewY(${v}deg) `);
|
|
2691
|
+
}
|
|
2692
|
+
const a = t.x.scale * e.x, l = t.y.scale * e.y;
|
|
2693
|
+
return (a !== 1 || l !== 1) && (s += `scale(${a}, ${l})`), s || "none";
|
|
2694
|
+
}
|
|
2695
|
+
const _a = We.length, $i = (t) => typeof t == "string" ? parseFloat(t) : t, Gi = (t) => typeof t == "number" || Ot.test(t);
|
|
2696
|
+
function $a(t, e, i, s, n, r) {
|
|
2697
|
+
n ? (t.opacity = w(0, i.opacity ?? 1, Ga(s)), t.opacityExit = w(e.opacity ?? 1, 0, Ha(s))) : r && (t.opacity = w(e.opacity ?? 1, i.opacity ?? 1, s));
|
|
2698
|
+
for (let o = 0; o < _a; o++) {
|
|
2699
|
+
const a = We[o];
|
|
2700
|
+
let l = Hi(e, a), u = Hi(i, a);
|
|
2701
|
+
if (l === void 0 && u === void 0)
|
|
2702
|
+
continue;
|
|
2703
|
+
l || (l = 0), u || (u = 0), l === 0 || u === 0 || Gi(l) === Gi(u) ? (t[a] = Math.max(w($i(l), $i(u), s), 0), (nt.test(u) || nt.test(l)) && (t[a] += "%")) : t[a] = u;
|
|
2704
|
+
}
|
|
2705
|
+
(e.rotate || i.rotate) && (t.rotate = w(e.rotate || 0, i.rotate || 0, s));
|
|
2706
|
+
}
|
|
2707
|
+
function Hi(t, e) {
|
|
2708
|
+
return t[e] !== void 0 ? t[e] : t.borderRadius;
|
|
2709
|
+
}
|
|
2710
|
+
const Ga = /* @__PURE__ */ wn(0, 0.5, Vs), Ha = /* @__PURE__ */ wn(0.5, 0.95, W);
|
|
2711
|
+
function wn(t, e, i) {
|
|
2712
|
+
return (s) => s < t ? 0 : s > e ? 1 : i(/* @__PURE__ */ gt(t, e, s));
|
|
2713
|
+
}
|
|
2714
|
+
function Wa(t, e, i) {
|
|
2715
|
+
const s = I(t) ? t : ht(t);
|
|
2716
|
+
return s.start(Ge("", s, e, i)), s.animation;
|
|
2717
|
+
}
|
|
2718
|
+
function Tt(t, e, i, s = { passive: !0 }) {
|
|
2719
|
+
return t.addEventListener(e, i, s), () => t.removeEventListener(e, i, s);
|
|
2720
|
+
}
|
|
2721
|
+
const za = (t, e) => t.depth - e.depth;
|
|
2722
|
+
class Xa {
|
|
2723
|
+
constructor() {
|
|
2724
|
+
this.children = [], this.isDirty = !1;
|
|
2725
|
+
}
|
|
2726
|
+
add(e) {
|
|
2727
|
+
Ce(this.children, e), this.isDirty = !0;
|
|
2728
|
+
}
|
|
2729
|
+
remove(e) {
|
|
2730
|
+
Rt(this.children, e), this.isDirty = !0;
|
|
2731
|
+
}
|
|
2732
|
+
forEach(e) {
|
|
2733
|
+
this.isDirty && this.children.sort(za), this.isDirty = !1, this.children.forEach(e);
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
function Ya(t, e) {
|
|
2737
|
+
const i = B.now(), s = ({ timestamp: n }) => {
|
|
2738
|
+
const r = n - i;
|
|
2739
|
+
r >= e && (q(s), t(r - e));
|
|
2740
|
+
};
|
|
2741
|
+
return S.setup(s, !0), () => q(s);
|
|
2742
|
+
}
|
|
2743
|
+
function Yt(t) {
|
|
2744
|
+
return I(t) ? t.get() : t;
|
|
2745
|
+
}
|
|
2746
|
+
class qa {
|
|
2747
|
+
constructor() {
|
|
2748
|
+
this.members = [];
|
|
2749
|
+
}
|
|
2750
|
+
add(e) {
|
|
2751
|
+
Ce(this.members, e);
|
|
2752
|
+
for (let i = this.members.length - 1; i >= 0; i--) {
|
|
2753
|
+
const s = this.members[i];
|
|
2754
|
+
if (s === e || s === this.lead || s === this.prevLead)
|
|
2755
|
+
continue;
|
|
2756
|
+
const n = s.instance;
|
|
2757
|
+
(!n || n.isConnected === !1) && !s.snapshot && (Rt(this.members, s), s.unmount());
|
|
2758
|
+
}
|
|
2759
|
+
e.scheduleRender();
|
|
2760
|
+
}
|
|
2761
|
+
remove(e) {
|
|
2762
|
+
if (Rt(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
|
|
2763
|
+
const i = this.members[this.members.length - 1];
|
|
2764
|
+
i && this.promote(i);
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
relegate(e) {
|
|
2768
|
+
for (let i = this.members.indexOf(e) - 1; i >= 0; i--) {
|
|
2769
|
+
const s = this.members[i];
|
|
2770
|
+
if (s.isPresent !== !1 && s.instance?.isConnected !== !1)
|
|
2771
|
+
return this.promote(s), !0;
|
|
2772
|
+
}
|
|
2773
|
+
return !1;
|
|
2774
|
+
}
|
|
2775
|
+
promote(e, i) {
|
|
2776
|
+
const s = this.lead;
|
|
2777
|
+
if (e !== s && (this.prevLead = s, this.lead = e, e.show(), s)) {
|
|
2778
|
+
s.updateSnapshot(), e.scheduleRender();
|
|
2779
|
+
const { layoutDependency: n } = s.options, { layoutDependency: r } = e.options;
|
|
2780
|
+
(n === void 0 || n !== r) && (e.resumeFrom = s, i && (s.preserveOpacity = !0), s.snapshot && (e.snapshot = s.snapshot, e.snapshot.latestValues = s.animationValues || s.latestValues), e.root?.isUpdating && (e.isLayoutDirty = !0)), e.options.crossfade === !1 && s.hide();
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
exitAnimationComplete() {
|
|
2784
|
+
this.members.forEach((e) => {
|
|
2785
|
+
e.options.onExitComplete?.(), e.resumingFrom?.options.onExitComplete?.();
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
scheduleRender() {
|
|
2789
|
+
this.members.forEach((e) => e.instance && e.scheduleRender(!1));
|
|
2790
|
+
}
|
|
2791
|
+
removeLeadSnapshot() {
|
|
2792
|
+
this.lead?.snapshot && (this.lead.snapshot = void 0);
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
const Mt = {
|
|
2796
|
+
/**
|
|
2797
|
+
* Global flag as to whether the tree has animated since the last time
|
|
2798
|
+
* we resized the window
|
|
2799
|
+
*/
|
|
2800
|
+
hasAnimatedSinceResize: !0,
|
|
2801
|
+
/**
|
|
2802
|
+
* We set this to true once, on the first update. Any nodes added to the tree beyond that
|
|
2803
|
+
* update will be given a `data-projection-id` attribute.
|
|
2804
|
+
*/
|
|
2805
|
+
hasEverUpdated: !1
|
|
2806
|
+
}, qt = ["", "X", "Y", "Z"], Za = 1e3;
|
|
2807
|
+
let Ja = 0;
|
|
2808
|
+
function Zt(t, e, i, s) {
|
|
2809
|
+
const { latestValues: n } = e;
|
|
2810
|
+
n[t] && (i[t] = n[t], e.setStaticValue(t, 0), s && (s[t] = 0));
|
|
2811
|
+
}
|
|
2812
|
+
function An(t) {
|
|
2813
|
+
if (t.hasCheckedOptimisedAppear = !0, t.root === t)
|
|
2814
|
+
return;
|
|
2815
|
+
const { visualElement: e } = t.options;
|
|
2816
|
+
if (!e)
|
|
2817
|
+
return;
|
|
2818
|
+
const i = en(e);
|
|
2819
|
+
if (window.MotionHasOptimisedAnimation(i, "transform")) {
|
|
2820
|
+
const { layout: n, layoutId: r } = t.options;
|
|
2821
|
+
window.MotionCancelOptimisedAnimation(i, "transform", S, !(n || r));
|
|
2822
|
+
}
|
|
2823
|
+
const { parent: s } = t;
|
|
2824
|
+
s && !s.hasCheckedOptimisedAppear && An(s);
|
|
2825
|
+
}
|
|
2826
|
+
function Vn({ attachResizeListener: t, defaultParent: e, measureScroll: i, checkIsScrollRoot: s, resetTransform: n }) {
|
|
2827
|
+
return class {
|
|
2828
|
+
constructor(o = {}, a = e?.()) {
|
|
2829
|
+
this.id = Ja++, this.animationId = 0, this.animationCommitId = 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 = () => {
|
|
2830
|
+
this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
|
|
2831
|
+
}, this.updateProjection = () => {
|
|
2832
|
+
this.projectionUpdateScheduled = !1, this.nodes.forEach(el), this.nodes.forEach(ll), this.nodes.forEach(cl), this.nodes.forEach(il);
|
|
2833
|
+
}, 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;
|
|
2834
|
+
for (let l = 0; l < this.path.length; l++)
|
|
2835
|
+
this.path[l].shouldResetTransform = !0;
|
|
2836
|
+
this.root === this && (this.nodes = new Xa());
|
|
2837
|
+
}
|
|
2838
|
+
addEventListener(o, a) {
|
|
2839
|
+
return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Lt()), this.eventHandlers.get(o).add(a);
|
|
2840
|
+
}
|
|
2841
|
+
notifyListeners(o, ...a) {
|
|
2842
|
+
const l = this.eventHandlers.get(o);
|
|
2843
|
+
l && l.notify(...a);
|
|
2844
|
+
}
|
|
2845
|
+
hasListeners(o) {
|
|
2846
|
+
return this.eventHandlers.has(o);
|
|
2847
|
+
}
|
|
2848
|
+
/**
|
|
2849
|
+
* Lifecycles
|
|
2850
|
+
*/
|
|
2851
|
+
mount(o) {
|
|
2852
|
+
if (this.instance)
|
|
2853
|
+
return;
|
|
2854
|
+
this.isSVG = nn(o) && !ga(o), this.instance = o;
|
|
2855
|
+
const { layoutId: a, layout: l, visualElement: u } = this.options;
|
|
2856
|
+
if (u && !u.current && u.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (l || a) && (this.isLayoutDirty = !0), t) {
|
|
2857
|
+
let c, h = 0;
|
|
2858
|
+
const f = () => this.root.updateBlockedByResize = !1;
|
|
2859
|
+
S.read(() => {
|
|
2860
|
+
h = window.innerWidth;
|
|
2861
|
+
}), t(o, () => {
|
|
2862
|
+
const m = window.innerWidth;
|
|
2863
|
+
m !== h && (h = m, this.root.updateBlockedByResize = !0, c && c(), c = Ya(f, 250), Mt.hasAnimatedSinceResize && (Mt.hasAnimatedSinceResize = !1, this.nodes.forEach(Xi)));
|
|
2864
|
+
});
|
|
2865
|
+
}
|
|
2866
|
+
a && this.root.registerSharedNode(a, this), this.options.animate !== !1 && u && (a || l) && this.addEventListener("didUpdate", ({ delta: c, hasLayoutChanged: h, hasRelativeLayoutChanged: f, layout: m }) => {
|
|
2867
|
+
if (this.isTreeAnimationBlocked()) {
|
|
2868
|
+
this.target = void 0, this.relativeTarget = void 0;
|
|
2869
|
+
return;
|
|
2870
|
+
}
|
|
2871
|
+
const d = this.options.transition || u.getDefaultTransition() || pl, { onLayoutAnimationStart: v, onLayoutAnimationComplete: p } = u.getProps(), x = !this.targetLayout || !Sn(this.targetLayout, m), T = !h && f;
|
|
2872
|
+
if (this.options.layoutRoot || this.resumeFrom || T || h && (x || !this.currentAnimation)) {
|
|
2873
|
+
this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
|
|
2874
|
+
const P = {
|
|
2875
|
+
...$e(d, "layout"),
|
|
2876
|
+
onPlay: v,
|
|
2877
|
+
onComplete: p
|
|
2878
|
+
};
|
|
2879
|
+
(u.shouldReduceMotion || this.options.layoutRoot) && (P.delay = 0, P.type = !1), this.startAnimation(P), this.setAnimationOrigin(c, T, P.path);
|
|
2880
|
+
} else
|
|
2881
|
+
h || Xi(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
|
|
2882
|
+
this.targetLayout = m;
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
unmount() {
|
|
2886
|
+
this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
|
|
2887
|
+
const o = this.getStack();
|
|
2888
|
+
o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), q(this.updateProjection);
|
|
2889
|
+
}
|
|
2890
|
+
// only on the root
|
|
2891
|
+
blockUpdate() {
|
|
2892
|
+
this.updateManuallyBlocked = !0;
|
|
2893
|
+
}
|
|
2894
|
+
unblockUpdate() {
|
|
2895
|
+
this.updateManuallyBlocked = !1;
|
|
2896
|
+
}
|
|
2897
|
+
isUpdateBlocked() {
|
|
2898
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
2899
|
+
}
|
|
2900
|
+
isTreeAnimationBlocked() {
|
|
2901
|
+
return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
|
|
2902
|
+
}
|
|
2903
|
+
// Note: currently only running on root node
|
|
2904
|
+
startUpdate() {
|
|
2905
|
+
this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(ul), this.animationId++);
|
|
2906
|
+
}
|
|
2907
|
+
getTransformTemplate() {
|
|
2908
|
+
const { visualElement: o } = this.options;
|
|
2909
|
+
return o && o.getProps().transformTemplate;
|
|
2910
|
+
}
|
|
2911
|
+
willUpdate(o = !0) {
|
|
2912
|
+
if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
|
|
2913
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
2914
|
+
return;
|
|
2915
|
+
}
|
|
2916
|
+
if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && An(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
|
|
2917
|
+
return;
|
|
2918
|
+
this.isLayoutDirty = !0;
|
|
2919
|
+
for (let c = 0; c < this.path.length; c++) {
|
|
2920
|
+
const h = this.path[c];
|
|
2921
|
+
h.shouldResetTransform = !0, (typeof h.latestValues.x == "string" || typeof h.latestValues.y == "string") && (h.isLayoutDirty = !0), h.updateScroll("snapshot"), h.options.layoutRoot && h.willUpdate(!1);
|
|
2922
|
+
}
|
|
2923
|
+
const { layoutId: a, layout: l } = this.options;
|
|
2924
|
+
if (a === void 0 && !l)
|
|
2925
|
+
return;
|
|
2926
|
+
const u = this.getTransformTemplate();
|
|
2927
|
+
this.prevTransformTemplateValue = u ? u(this.latestValues, "") : void 0, this.updateSnapshot(), o && this.notifyListeners("willUpdate");
|
|
2928
|
+
}
|
|
2929
|
+
update() {
|
|
2930
|
+
if (this.updateScheduled = !1, this.isUpdateBlocked()) {
|
|
2931
|
+
const l = this.updateBlockedByResize;
|
|
2932
|
+
this.unblockUpdate(), this.updateBlockedByResize = !1, this.clearAllSnapshots(), l && this.nodes.forEach(nl), this.nodes.forEach(Wi);
|
|
2933
|
+
return;
|
|
2934
|
+
}
|
|
2935
|
+
if (this.animationId <= this.animationCommitId) {
|
|
2936
|
+
this.nodes.forEach(zi);
|
|
2937
|
+
return;
|
|
2938
|
+
}
|
|
2939
|
+
this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(ol), this.nodes.forEach(rl), this.nodes.forEach(al), this.nodes.forEach(Qa), this.nodes.forEach(tl)) : this.nodes.forEach(zi), this.clearAllSnapshots();
|
|
2940
|
+
const a = B.now();
|
|
2941
|
+
M.delta = z(0, 1e3 / 60, a - M.timestamp), M.timestamp = a, M.isProcessing = !0, Ut.update.process(M), Ut.preRender.process(M), Ut.render.process(M), M.isProcessing = !1;
|
|
2942
|
+
}
|
|
2943
|
+
didUpdate() {
|
|
2944
|
+
this.updateScheduled || (this.updateScheduled = !0, un.read(this.scheduleUpdate));
|
|
2945
|
+
}
|
|
2946
|
+
clearAllSnapshots() {
|
|
2947
|
+
this.nodes.forEach(sl), this.sharedNodes.forEach(hl);
|
|
2948
|
+
}
|
|
2949
|
+
scheduleUpdateProjection() {
|
|
2950
|
+
this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, S.preRender(this.updateProjection, !1, !0));
|
|
2951
|
+
}
|
|
2952
|
+
scheduleCheckAfterUnmount() {
|
|
2953
|
+
S.postRender(() => {
|
|
2954
|
+
this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* Update measurements
|
|
2959
|
+
*/
|
|
2960
|
+
updateSnapshot() {
|
|
2961
|
+
this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !F(this.snapshot.measuredBox.x) && !F(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
|
|
2962
|
+
}
|
|
2963
|
+
updateLayout() {
|
|
2964
|
+
if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
|
|
2965
|
+
return;
|
|
2966
|
+
if (this.resumeFrom && !this.resumeFrom.instance)
|
|
2967
|
+
for (let l = 0; l < this.path.length; l++)
|
|
2968
|
+
this.path[l].updateScroll();
|
|
2969
|
+
const o = this.layout;
|
|
2970
|
+
this.layout = this.measure(!1), this.layoutCorrected || (this.layoutCorrected = E()), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
|
|
2971
|
+
const { visualElement: a } = this.options;
|
|
2972
|
+
a && a.notify("LayoutMeasure", this.layout.layoutBox, o ? o.layoutBox : void 0);
|
|
2973
|
+
}
|
|
2974
|
+
updateScroll(o = "measure") {
|
|
2975
|
+
let a = !!(this.options.layoutScroll && this.instance);
|
|
2976
|
+
if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === o && (a = !1), a && this.instance) {
|
|
2977
|
+
const l = s(this.instance);
|
|
2978
|
+
this.scroll = {
|
|
2979
|
+
animationId: this.root.animationId,
|
|
2980
|
+
phase: o,
|
|
2981
|
+
isRoot: l,
|
|
2982
|
+
offset: i(this.instance),
|
|
2983
|
+
wasRoot: this.scroll ? this.scroll.isRoot : l
|
|
2984
|
+
};
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
resetTransform() {
|
|
2988
|
+
if (!n)
|
|
2989
|
+
return;
|
|
2990
|
+
const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !bn(this.projectionDelta), l = this.getTransformTemplate(), u = l ? l(this.latestValues, "") : void 0, c = u !== this.prevTransformTemplateValue;
|
|
2991
|
+
o && this.instance && (a || Q(this.latestValues) || c) && (n(this.instance, u), this.shouldResetTransform = !1, this.scheduleRender());
|
|
2992
|
+
}
|
|
2993
|
+
measure(o = !0) {
|
|
2994
|
+
const a = this.measurePageBox();
|
|
2995
|
+
let l = this.removeElementScroll(a);
|
|
2996
|
+
return o && (l = this.removeTransform(l)), ml(l), {
|
|
2997
|
+
animationId: this.root.animationId,
|
|
2998
|
+
measuredBox: a,
|
|
2999
|
+
layoutBox: l,
|
|
3000
|
+
latestValues: {},
|
|
3001
|
+
source: this.id
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
measurePageBox() {
|
|
3005
|
+
const { visualElement: o } = this.options;
|
|
3006
|
+
if (!o)
|
|
3007
|
+
return E();
|
|
3008
|
+
const a = o.measureViewportBox();
|
|
3009
|
+
if (!(this.scroll?.wasRoot || this.path.some(yl))) {
|
|
3010
|
+
const { scroll: u } = this.root;
|
|
3011
|
+
u && (G(a.x, u.offset.x), G(a.y, u.offset.y));
|
|
3012
|
+
}
|
|
3013
|
+
return a;
|
|
3014
|
+
}
|
|
3015
|
+
removeElementScroll(o) {
|
|
3016
|
+
const a = E();
|
|
3017
|
+
if (_(a, o), this.scroll?.wasRoot)
|
|
3018
|
+
return a;
|
|
3019
|
+
for (let l = 0; l < this.path.length; l++) {
|
|
3020
|
+
const u = this.path[l], { scroll: c, options: h } = u;
|
|
3021
|
+
u !== this.root && c && h.layoutScroll && (c.wasRoot && _(a, o), G(a.x, c.offset.x), G(a.y, c.offset.y));
|
|
3022
|
+
}
|
|
3023
|
+
return a;
|
|
3024
|
+
}
|
|
3025
|
+
applyTransform(o, a = !1, l) {
|
|
3026
|
+
const u = l || E();
|
|
3027
|
+
_(u, o);
|
|
3028
|
+
for (let c = 0; c < this.path.length; c++) {
|
|
3029
|
+
const h = this.path[c];
|
|
3030
|
+
!a && h.options.layoutScroll && h.scroll && h !== h.root && (G(u.x, -h.scroll.offset.x), G(u.y, -h.scroll.offset.y)), Q(h.latestValues) && Ct(u, h.latestValues, h.layout?.layoutBox);
|
|
3031
|
+
}
|
|
3032
|
+
return Q(this.latestValues) && Ct(u, this.latestValues, this.layout?.layoutBox), u;
|
|
3033
|
+
}
|
|
3034
|
+
removeTransform(o) {
|
|
3035
|
+
const a = E();
|
|
3036
|
+
_(a, o);
|
|
3037
|
+
for (let l = 0; l < this.path.length; l++) {
|
|
3038
|
+
const u = this.path[l];
|
|
3039
|
+
if (!Q(u.latestValues))
|
|
3040
|
+
continue;
|
|
3041
|
+
let c;
|
|
3042
|
+
u.instance && (xe(u.latestValues) && u.updateSnapshot(), c = E(), _(c, u.measurePageBox())), ji(a, u.latestValues, u.snapshot?.layoutBox, c);
|
|
3043
|
+
}
|
|
3044
|
+
return Q(this.latestValues) && ji(a, this.latestValues), a;
|
|
3045
|
+
}
|
|
3046
|
+
setTargetDelta(o) {
|
|
3047
|
+
this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
|
|
3048
|
+
}
|
|
3049
|
+
setOptions(o) {
|
|
3050
|
+
this.options = {
|
|
3051
|
+
...this.options,
|
|
3052
|
+
...o,
|
|
3053
|
+
crossfade: o.crossfade !== void 0 ? o.crossfade : !0
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
clearMeasurements() {
|
|
3057
|
+
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;
|
|
3058
|
+
}
|
|
3059
|
+
forceRelativeParentToResolveTarget() {
|
|
3060
|
+
this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== M.timestamp && this.relativeParent.resolveTargetDelta(!0);
|
|
3061
|
+
}
|
|
3062
|
+
resolveTargetDelta(o = !1) {
|
|
3063
|
+
const a = this.getLead();
|
|
3064
|
+
this.isProjectionDirty || (this.isProjectionDirty = a.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = a.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = a.isSharedProjectionDirty);
|
|
3065
|
+
const l = !!this.resumingFrom || this !== a;
|
|
3066
|
+
if (!(o || l && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
|
|
3067
|
+
return;
|
|
3068
|
+
const { layout: c, layoutId: h } = this.options;
|
|
3069
|
+
if (!this.layout || !(c || h))
|
|
3070
|
+
return;
|
|
3071
|
+
this.resolvedRelativeTargetAt = M.timestamp;
|
|
3072
|
+
const f = this.getClosestProjectingParent();
|
|
3073
|
+
!this.targetDelta && !this.relativeTarget && (this.options.layoutAnchor !== !1 && f && f.layout ? this.createRelativeTarget(f, this.layout.layoutBox, f.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = E(), this.targetWithTransforms = E()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Ia(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0)) : this.targetDelta ? (this.resumingFrom ? this.applyTransform(this.layout.layoutBox, !1, this.target) : _(this.target, this.layout.layoutBox), ln(this.target, this.targetDelta)) : _(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, this.options.layoutAnchor !== !1 && f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? this.createRelativeTarget(f, this.target, f.target) : this.relativeParent = this.relativeTarget = void 0));
|
|
3074
|
+
}
|
|
3075
|
+
getClosestProjectingParent() {
|
|
3076
|
+
if (!(!this.parent || xe(this.parent.latestValues) || an(this.parent.latestValues)))
|
|
3077
|
+
return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
|
|
3078
|
+
}
|
|
3079
|
+
isProjecting() {
|
|
3080
|
+
return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
3081
|
+
}
|
|
3082
|
+
createRelativeTarget(o, a, l) {
|
|
3083
|
+
this.relativeParent = o, this.forceRelativeParentToResolveTarget(), this.relativeTarget = E(), this.relativeTargetOrigin = E(), jt(this.relativeTargetOrigin, a, l, this.options.layoutAnchor || void 0), _(this.relativeTarget, this.relativeTargetOrigin);
|
|
3084
|
+
}
|
|
3085
|
+
removeRelativeTarget() {
|
|
3086
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
3087
|
+
}
|
|
3088
|
+
calcProjection() {
|
|
3089
|
+
const o = this.getLead(), a = !!this.resumingFrom || this !== o;
|
|
3090
|
+
let l = !0;
|
|
3091
|
+
if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (l = !1), a && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === M.timestamp && (l = !1), l)
|
|
3092
|
+
return;
|
|
3093
|
+
const { layout: u, layoutId: c } = this.options;
|
|
3094
|
+
if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(u || c))
|
|
3095
|
+
return;
|
|
3096
|
+
_(this.layoutCorrected, this.layout.layoutBox);
|
|
3097
|
+
const h = this.treeScale.x, f = this.treeScale.y;
|
|
3098
|
+
ra(this.layoutCorrected, this.treeScale, this.path, a), o.layout && !o.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (o.target = o.layout.layoutBox, o.targetWithTransforms = E());
|
|
3099
|
+
const { target: m } = o;
|
|
3100
|
+
if (!m) {
|
|
3101
|
+
this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
3104
|
+
!this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (Ri(this.prevProjectionDelta.x, this.projectionDelta.x), Ri(this.prevProjectionDelta.y, this.projectionDelta.y)), mt(this.projectionDelta, this.layoutCorrected, m, this.latestValues), (this.treeScale.x !== h || this.treeScale.y !== f || !_i(this.projectionDelta.x, this.prevProjectionDelta.x) || !_i(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", m));
|
|
3105
|
+
}
|
|
3106
|
+
hide() {
|
|
3107
|
+
this.isVisible = !1;
|
|
3108
|
+
}
|
|
3109
|
+
show() {
|
|
3110
|
+
this.isVisible = !0;
|
|
3111
|
+
}
|
|
3112
|
+
scheduleRender(o = !0) {
|
|
3113
|
+
if (this.options.visualElement?.scheduleRender(), o) {
|
|
3114
|
+
const a = this.getStack();
|
|
3115
|
+
a && a.scheduleRender();
|
|
3116
|
+
}
|
|
3117
|
+
this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
|
|
3118
|
+
}
|
|
3119
|
+
createProjectionDeltas() {
|
|
3120
|
+
this.prevProjectionDelta = lt(), this.projectionDelta = lt(), this.projectionDeltaWithTransform = lt();
|
|
3121
|
+
}
|
|
3122
|
+
setAnimationOrigin(o, a = !1, l) {
|
|
3123
|
+
const u = this.snapshot, c = u ? u.latestValues : {}, h = { ...this.latestValues }, f = lt();
|
|
3124
|
+
(!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
|
|
3125
|
+
const m = E(), d = u ? u.source : void 0, v = this.layout ? this.layout.source : void 0, p = d !== v, x = this.getStack(), T = !x || x.members.length <= 1, P = !!(p && !T && this.options.crossfade === !0 && !this.path.some(dl));
|
|
3126
|
+
this.animationProgress = 0;
|
|
3127
|
+
let b;
|
|
3128
|
+
const A = l?.interpolateProjection(o);
|
|
3129
|
+
this.mixTargetDelta = (D) => {
|
|
3130
|
+
const y = D / 1e3, g = A?.(y);
|
|
3131
|
+
g ? (f.x.translate = g.x, f.x.scale = w(o.x.scale, 1, y), f.x.origin = o.x.origin, f.x.originPoint = o.x.originPoint, f.y.translate = g.y, f.y.scale = w(o.y.scale, 1, y), f.y.origin = o.y.origin, f.y.originPoint = o.y.originPoint) : (Yi(f.x, o.x, y), Yi(f.y, o.y, y)), this.setTargetDelta(f), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (jt(m, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0), fl(this.relativeTarget, this.relativeTargetOrigin, m, y), b && Ua(this.relativeTarget, b) && (this.isProjectionDirty = !1), b || (b = E()), _(b, this.relativeTarget)), p && (this.animationValues = h, $a(h, c, this.latestValues, y, P, T)), g && g.rotate !== void 0 && (this.animationValues || (this.animationValues = h), this.animationValues.pathRotation = g.rotate), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = y;
|
|
3132
|
+
}, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
3133
|
+
}
|
|
3134
|
+
startAnimation(o) {
|
|
3135
|
+
this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (q(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = S.update(() => {
|
|
3136
|
+
Mt.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = ht(0)), this.motionValue.jump(0, !1), this.currentAnimation = Wa(this.motionValue, [0, 1e3], {
|
|
3137
|
+
...o,
|
|
3138
|
+
velocity: 0,
|
|
3139
|
+
isSync: !0,
|
|
3140
|
+
onUpdate: (a) => {
|
|
3141
|
+
this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a);
|
|
3142
|
+
},
|
|
3143
|
+
onComplete: () => {
|
|
3144
|
+
o.onComplete && o.onComplete(), this.completeAnimation();
|
|
3145
|
+
}
|
|
3146
|
+
}), zo(this.currentAnimation, this), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3149
|
+
completeAnimation() {
|
|
3150
|
+
this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
|
|
3151
|
+
const o = this.getStack();
|
|
3152
|
+
o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
|
|
3153
|
+
}
|
|
3154
|
+
finishAnimation() {
|
|
3155
|
+
this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(Za), this.currentAnimation.stop()), this.completeAnimation();
|
|
3156
|
+
}
|
|
3157
|
+
applyTransformsToTarget() {
|
|
3158
|
+
const o = this.getLead(), { targetWithTransforms: a, layout: l, latestValues: u } = o;
|
|
3159
|
+
let { target: c } = o;
|
|
3160
|
+
if (!(!a || !c || !l)) {
|
|
3161
|
+
if (this !== o && this.layout && l && Dn(this.options.animationType, this.layout.layoutBox, l.layoutBox)) {
|
|
3162
|
+
c = this.target || E();
|
|
3163
|
+
const h = F(this.layout.layoutBox.x);
|
|
3164
|
+
c.x.min = o.target.x.min, c.x.max = c.x.min + h;
|
|
3165
|
+
const f = F(this.layout.layoutBox.y);
|
|
3166
|
+
c.y.min = o.target.y.min, c.y.max = c.y.min + f;
|
|
3167
|
+
}
|
|
3168
|
+
_(a, c), Ct(a, u), mt(this.projectionDeltaWithTransform, this.layoutCorrected, a, u);
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
registerSharedNode(o, a) {
|
|
3172
|
+
this.sharedNodes.has(o) || this.sharedNodes.set(o, new qa()), this.sharedNodes.get(o).add(a);
|
|
3173
|
+
const u = a.options.initialPromotionConfig;
|
|
3174
|
+
a.promote({
|
|
3175
|
+
transition: u ? u.transition : void 0,
|
|
3176
|
+
preserveFollowOpacity: u && u.shouldPreserveFollowOpacity ? u.shouldPreserveFollowOpacity(a) : void 0
|
|
3177
|
+
});
|
|
3178
|
+
}
|
|
3179
|
+
isLead() {
|
|
3180
|
+
const o = this.getStack();
|
|
3181
|
+
return o ? o.lead === this : !0;
|
|
3182
|
+
}
|
|
3183
|
+
getLead() {
|
|
3184
|
+
const { layoutId: o } = this.options;
|
|
3185
|
+
return o ? this.getStack()?.lead || this : this;
|
|
3186
|
+
}
|
|
3187
|
+
getPrevLead() {
|
|
3188
|
+
const { layoutId: o } = this.options;
|
|
3189
|
+
return o ? this.getStack()?.prevLead : void 0;
|
|
3190
|
+
}
|
|
3191
|
+
getStack() {
|
|
3192
|
+
const { layoutId: o } = this.options;
|
|
3193
|
+
if (o)
|
|
3194
|
+
return this.root.sharedNodes.get(o);
|
|
3195
|
+
}
|
|
3196
|
+
promote({ needsReset: o, transition: a, preserveFollowOpacity: l } = {}) {
|
|
3197
|
+
const u = this.getStack();
|
|
3198
|
+
u && u.promote(this, l), o && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a });
|
|
3199
|
+
}
|
|
3200
|
+
relegate() {
|
|
3201
|
+
const o = this.getStack();
|
|
3202
|
+
return o ? o.relegate(this) : !1;
|
|
3203
|
+
}
|
|
3204
|
+
resetSkewAndRotation() {
|
|
3205
|
+
const { visualElement: o } = this.options;
|
|
3206
|
+
if (!o)
|
|
3207
|
+
return;
|
|
3208
|
+
let a = !1;
|
|
3209
|
+
const { latestValues: l } = o;
|
|
3210
|
+
if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (a = !0), !a)
|
|
3211
|
+
return;
|
|
3212
|
+
const u = {};
|
|
3213
|
+
l.z && Zt("z", o, u, this.animationValues);
|
|
3214
|
+
for (let c = 0; c < qt.length; c++)
|
|
3215
|
+
Zt(`rotate${qt[c]}`, o, u, this.animationValues), Zt(`skew${qt[c]}`, o, u, this.animationValues);
|
|
3216
|
+
o.render();
|
|
3217
|
+
for (const c in u)
|
|
3218
|
+
o.setStaticValue(c, u[c]), this.animationValues && (this.animationValues[c] = u[c]);
|
|
3219
|
+
o.scheduleRender();
|
|
3220
|
+
}
|
|
3221
|
+
applyProjectionStyles(o, a) {
|
|
3222
|
+
if (!this.instance || this.isSVG)
|
|
3223
|
+
return;
|
|
3224
|
+
if (!this.isVisible) {
|
|
3225
|
+
o.visibility = "hidden";
|
|
3226
|
+
return;
|
|
3227
|
+
}
|
|
3228
|
+
const l = this.getTransformTemplate();
|
|
3229
|
+
if (this.needsReset) {
|
|
3230
|
+
this.needsReset = !1, o.visibility = "", o.opacity = "", o.pointerEvents = Yt(a?.pointerEvents) || "", o.transform = l ? l(this.latestValues, "") : "none";
|
|
3231
|
+
return;
|
|
3232
|
+
}
|
|
3233
|
+
const u = this.getLead();
|
|
3234
|
+
if (!this.projectionDelta || !this.layout || !u.target) {
|
|
3235
|
+
this.options.layoutId && (o.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, o.pointerEvents = Yt(a?.pointerEvents) || ""), this.hasProjected && !Q(this.latestValues) && (o.transform = l ? l({}, "") : "none", this.hasProjected = !1);
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
o.visibility = "";
|
|
3239
|
+
const c = u.animationValues || u.latestValues;
|
|
3240
|
+
this.applyTransformsToTarget();
|
|
3241
|
+
let h = Ka(this.projectionDeltaWithTransform, this.treeScale, c);
|
|
3242
|
+
l && (h = l(c, h)), o.transform = h;
|
|
3243
|
+
const { x: f, y: m } = this.projectionDelta;
|
|
3244
|
+
o.transformOrigin = `${f.origin * 100}% ${m.origin * 100}% 0`, u.animationValues ? o.opacity = u === this ? c.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : c.opacityExit : o.opacity = u === this ? c.opacity !== void 0 ? c.opacity : "" : c.opacityExit !== void 0 ? c.opacityExit : 0;
|
|
3245
|
+
for (const d in xt) {
|
|
3246
|
+
if (c[d] === void 0)
|
|
3247
|
+
continue;
|
|
3248
|
+
const { correct: v, applyTo: p, isCSSVariable: x } = xt[d], T = h === "none" ? c[d] : v(c[d], u);
|
|
3249
|
+
if (p) {
|
|
3250
|
+
const P = p.length;
|
|
3251
|
+
for (let b = 0; b < P; b++)
|
|
3252
|
+
o[p[b]] = T;
|
|
3253
|
+
} else
|
|
3254
|
+
x ? this.options.visualElement.renderState.vars[d] = T : o[d] = T;
|
|
3255
|
+
}
|
|
3256
|
+
this.options.layoutId && (o.pointerEvents = u === this ? Yt(a?.pointerEvents) || "" : "none");
|
|
3257
|
+
}
|
|
3258
|
+
clearSnapshot() {
|
|
3259
|
+
this.resumeFrom = this.snapshot = void 0;
|
|
3260
|
+
}
|
|
3261
|
+
// Only run on root
|
|
3262
|
+
resetTree() {
|
|
3263
|
+
this.root.nodes.forEach((o) => o.currentAnimation?.stop()), this.root.nodes.forEach(Wi), this.root.sharedNodes.clear();
|
|
3264
|
+
}
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
function Qa(t) {
|
|
3268
|
+
t.updateLayout();
|
|
3269
|
+
}
|
|
3270
|
+
function tl(t) {
|
|
3271
|
+
const e = t.resumeFrom?.snapshot || t.snapshot;
|
|
3272
|
+
if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
|
|
3273
|
+
const { layoutBox: i, measuredBox: s } = t.layout, { animationType: n } = t.options, r = e.source !== t.layout.source;
|
|
3274
|
+
if (n === "size")
|
|
3275
|
+
$((c) => {
|
|
3276
|
+
const h = r ? e.measuredBox[c] : e.layoutBox[c], f = F(h);
|
|
3277
|
+
h.min = i[c].min, h.max = h.min + f;
|
|
3278
|
+
});
|
|
3279
|
+
else if (n === "x" || n === "y") {
|
|
3280
|
+
const c = n === "x" ? "y" : "x";
|
|
3281
|
+
be(r ? e.measuredBox[c] : e.layoutBox[c], i[c]);
|
|
3282
|
+
} else Dn(n, e.layoutBox, i) && $((c) => {
|
|
3283
|
+
const h = r ? e.measuredBox[c] : e.layoutBox[c], f = F(i[c]);
|
|
3284
|
+
h.max = h.min + f, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[c].max = t.relativeTarget[c].min + f);
|
|
3285
|
+
});
|
|
3286
|
+
const o = lt();
|
|
3287
|
+
mt(o, i, e.layoutBox);
|
|
3288
|
+
const a = lt();
|
|
3289
|
+
r ? mt(a, t.applyTransform(s, !0), e.measuredBox) : mt(a, i, e.layoutBox);
|
|
3290
|
+
const l = !bn(o);
|
|
3291
|
+
let u = !1;
|
|
3292
|
+
if (!t.resumeFrom) {
|
|
3293
|
+
const c = t.getClosestProjectingParent();
|
|
3294
|
+
if (c && !c.resumeFrom) {
|
|
3295
|
+
const { snapshot: h, layout: f } = c;
|
|
3296
|
+
if (h && f) {
|
|
3297
|
+
const m = t.options.layoutAnchor || void 0, d = E();
|
|
3298
|
+
jt(d, e.layoutBox, h.layoutBox, m);
|
|
3299
|
+
const v = E();
|
|
3300
|
+
jt(v, i, f.layoutBox, m), Sn(d, v) || (u = !0), c.options.layoutRoot && (t.relativeTarget = v, t.relativeTargetOrigin = d, t.relativeParent = c);
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
t.notifyListeners("didUpdate", {
|
|
3305
|
+
layout: i,
|
|
3306
|
+
snapshot: e,
|
|
3307
|
+
delta: a,
|
|
3308
|
+
layoutDelta: o,
|
|
3309
|
+
hasLayoutChanged: l,
|
|
3310
|
+
hasRelativeLayoutChanged: u
|
|
3311
|
+
});
|
|
3312
|
+
} else if (t.isLead()) {
|
|
3313
|
+
const { onExitComplete: i } = t.options;
|
|
3314
|
+
i && i();
|
|
3315
|
+
}
|
|
3316
|
+
t.options.transition = void 0;
|
|
3317
|
+
}
|
|
3318
|
+
function el(t) {
|
|
3319
|
+
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));
|
|
3320
|
+
}
|
|
3321
|
+
function il(t) {
|
|
3322
|
+
t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
|
|
3323
|
+
}
|
|
3324
|
+
function sl(t) {
|
|
3325
|
+
t.clearSnapshot();
|
|
3326
|
+
}
|
|
3327
|
+
function Wi(t) {
|
|
3328
|
+
t.clearMeasurements();
|
|
3329
|
+
}
|
|
3330
|
+
function nl(t) {
|
|
3331
|
+
t.isLayoutDirty = !0, t.updateLayout();
|
|
3332
|
+
}
|
|
3333
|
+
function zi(t) {
|
|
3334
|
+
t.isLayoutDirty = !1;
|
|
3335
|
+
}
|
|
3336
|
+
function ol(t) {
|
|
3337
|
+
t.isAnimationBlocked && t.layout && !t.isLayoutDirty && (t.snapshot = t.layout, t.isLayoutDirty = !0);
|
|
3338
|
+
}
|
|
3339
|
+
function rl(t) {
|
|
3340
|
+
t.relativeTarget && t.relativeParent?.isLayoutDirty && (t.currentAnimation ? t.isLayoutDirty = !0 : (t.targetDelta = void 0, t.removeRelativeTarget()));
|
|
3341
|
+
}
|
|
3342
|
+
function al(t) {
|
|
3343
|
+
const { visualElement: e } = t.options;
|
|
3344
|
+
e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
|
|
3345
|
+
}
|
|
3346
|
+
function Xi(t) {
|
|
3347
|
+
t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
|
|
3348
|
+
}
|
|
3349
|
+
function ll(t) {
|
|
3350
|
+
t.resolveTargetDelta();
|
|
3351
|
+
}
|
|
3352
|
+
function cl(t) {
|
|
3353
|
+
t.calcProjection();
|
|
3354
|
+
}
|
|
3355
|
+
function ul(t) {
|
|
3356
|
+
t.resetSkewAndRotation();
|
|
3357
|
+
}
|
|
3358
|
+
function hl(t) {
|
|
3359
|
+
t.removeLeadSnapshot();
|
|
3360
|
+
}
|
|
3361
|
+
function Yi(t, e, i) {
|
|
3362
|
+
t.translate = w(e.translate, 0, i), t.scale = w(e.scale, 1, i), t.origin = e.origin, t.originPoint = e.originPoint;
|
|
3363
|
+
}
|
|
3364
|
+
function qi(t, e, i, s) {
|
|
3365
|
+
t.min = w(e.min, i.min, s), t.max = w(e.max, i.max, s);
|
|
3366
|
+
}
|
|
3367
|
+
function fl(t, e, i, s) {
|
|
3368
|
+
qi(t.x, e.x, i.x, s), qi(t.y, e.y, i.y, s);
|
|
3369
|
+
}
|
|
3370
|
+
function dl(t) {
|
|
3371
|
+
return t.animationValues && t.animationValues.opacityExit !== void 0;
|
|
3372
|
+
}
|
|
3373
|
+
const pl = {
|
|
3374
|
+
duration: 0.45,
|
|
3375
|
+
ease: [0.4, 0, 0.1, 1]
|
|
3376
|
+
}, Zi = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Ji = Zi("applewebkit/") && !Zi("chrome/") ? Math.round : W;
|
|
3377
|
+
function Qi(t) {
|
|
3378
|
+
t.min = Ji(t.min), t.max = Ji(t.max);
|
|
3379
|
+
}
|
|
3380
|
+
function ml(t) {
|
|
3381
|
+
Qi(t.x), Qi(t.y);
|
|
3382
|
+
}
|
|
3383
|
+
function Dn(t, e, i) {
|
|
3384
|
+
return t === "position" || t === "preserve-aspect" && !Fa(Ki(e), Ki(i), 0.2);
|
|
3385
|
+
}
|
|
3386
|
+
function yl(t) {
|
|
3387
|
+
return t !== t.root && t.scroll?.wasRoot;
|
|
3388
|
+
}
|
|
3389
|
+
const gl = Vn({
|
|
3390
|
+
attachResizeListener: (t, e) => Tt(t, "resize", e),
|
|
3391
|
+
measureScroll: () => ({
|
|
3392
|
+
x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0,
|
|
3393
|
+
y: document.documentElement.scrollTop || document.body?.scrollTop || 0
|
|
3394
|
+
}),
|
|
3395
|
+
checkIsScrollRoot: () => !0
|
|
3396
|
+
}), Jt = {
|
|
3397
|
+
current: void 0
|
|
3398
|
+
}, vl = Vn({
|
|
3399
|
+
measureScroll: (t) => ({
|
|
3400
|
+
x: t.scrollLeft,
|
|
3401
|
+
y: t.scrollTop
|
|
3402
|
+
}),
|
|
3403
|
+
defaultParent: () => {
|
|
3404
|
+
if (!Jt.current) {
|
|
3405
|
+
const t = new gl({});
|
|
3406
|
+
t.mount(window), t.setOptions({ layoutScroll: !0 }), Jt.current = t;
|
|
3407
|
+
}
|
|
3408
|
+
return Jt.current;
|
|
3409
|
+
},
|
|
3410
|
+
resetTransform: (t, e) => {
|
|
3411
|
+
t.style.transform = e !== void 0 ? e : "none";
|
|
3412
|
+
},
|
|
3413
|
+
checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
|
|
3414
|
+
}), xl = {
|
|
3415
|
+
some: 0,
|
|
3416
|
+
all: 1
|
|
3417
|
+
};
|
|
3418
|
+
function Tl(t, e, { root: i, margin: s, amount: n = "some" } = {}) {
|
|
3419
|
+
const r = on(t), o = /* @__PURE__ */ new WeakMap(), a = (u) => {
|
|
3420
|
+
u.forEach((c) => {
|
|
3421
|
+
const h = o.get(c.target);
|
|
3422
|
+
if (c.isIntersecting !== !!h)
|
|
3423
|
+
if (c.isIntersecting) {
|
|
3424
|
+
const f = e(c.target, c);
|
|
3425
|
+
typeof f == "function" ? o.set(c.target, f) : l.unobserve(c.target);
|
|
3426
|
+
} else typeof h == "function" && (h(c), o.delete(c.target));
|
|
3427
|
+
});
|
|
3428
|
+
}, l = new IntersectionObserver(a, {
|
|
3429
|
+
root: i,
|
|
3430
|
+
rootMargin: s,
|
|
3431
|
+
threshold: typeof n == "number" ? n : xl[n]
|
|
3432
|
+
});
|
|
3433
|
+
return r.forEach((u) => l.observe(u)), () => l.disconnect();
|
|
3434
|
+
}
|
|
3435
|
+
const ts = (t, e) => Math.abs(t - e);
|
|
3436
|
+
function Pl(t, e) {
|
|
3437
|
+
const i = ts(t.x, e.x), s = ts(t.y, e.y);
|
|
3438
|
+
return Math.sqrt(i ** 2 + s ** 2);
|
|
3439
|
+
}
|
|
3440
|
+
function Cn({ current: t }) {
|
|
3441
|
+
return t ? t.ownerDocument.defaultView : null;
|
|
3442
|
+
}
|
|
3443
|
+
var X = class {
|
|
3444
|
+
constructor(t) {
|
|
3445
|
+
this.isMount = !1, this.state = t;
|
|
3446
|
+
}
|
|
3447
|
+
mount() {
|
|
3448
|
+
}
|
|
3449
|
+
beforeUnmount() {
|
|
3450
|
+
}
|
|
3451
|
+
unmount() {
|
|
3452
|
+
}
|
|
3453
|
+
update() {
|
|
3454
|
+
}
|
|
3455
|
+
getSnapshot(t) {
|
|
3456
|
+
}
|
|
3457
|
+
};
|
|
3458
|
+
const En = [
|
|
3459
|
+
"initial",
|
|
3460
|
+
"animate",
|
|
3461
|
+
"exit",
|
|
3462
|
+
"whileHover",
|
|
3463
|
+
"whileDrag",
|
|
3464
|
+
"whileFocus",
|
|
3465
|
+
"whilePress"
|
|
3466
|
+
];
|
|
3467
|
+
var bl = En.length;
|
|
3468
|
+
function Mn(t) {
|
|
3469
|
+
if (!t) return;
|
|
3470
|
+
if (!t.isControllingVariants) {
|
|
3471
|
+
const i = t.parent ? Mn(t.parent) || {} : {};
|
|
3472
|
+
return t.props.initial !== void 0 && (i.initial = t.props.initial), i;
|
|
3473
|
+
}
|
|
3474
|
+
const e = {};
|
|
3475
|
+
for (let i = 0; i < bl; i++) {
|
|
3476
|
+
const s = En[i], n = t.props[s];
|
|
3477
|
+
(De(n) || n === !1) && (e[s] = n);
|
|
3478
|
+
}
|
|
3479
|
+
return e;
|
|
3480
|
+
}
|
|
3481
|
+
var Rn = [
|
|
3482
|
+
"animate",
|
|
3483
|
+
"whileInView",
|
|
3484
|
+
"whileFocus",
|
|
3485
|
+
"whileHover",
|
|
3486
|
+
"whilePress",
|
|
3487
|
+
"whileDrag",
|
|
3488
|
+
"exit"
|
|
3489
|
+
], Sl = [...Rn].reverse(), wl = Rn.length;
|
|
3490
|
+
function J(t = !1) {
|
|
3491
|
+
return {
|
|
3492
|
+
isActive: t,
|
|
3493
|
+
protectedKeys: {},
|
|
3494
|
+
needsAnimating: {},
|
|
3495
|
+
prevResolvedValues: {}
|
|
3496
|
+
};
|
|
3497
|
+
}
|
|
3498
|
+
function es() {
|
|
3499
|
+
return {
|
|
3500
|
+
animate: J(!0),
|
|
3501
|
+
whileInView: J(),
|
|
3502
|
+
whileHover: J(),
|
|
3503
|
+
whilePress: J(),
|
|
3504
|
+
whileDrag: J(),
|
|
3505
|
+
whileFocus: J(),
|
|
3506
|
+
exit: J()
|
|
3507
|
+
};
|
|
3508
|
+
}
|
|
3509
|
+
function Al(t, e) {
|
|
3510
|
+
return typeof e == "string" ? e !== t : Array.isArray(e) ? !ys(e, t) : !1;
|
|
3511
|
+
}
|
|
3512
|
+
function is(t) {
|
|
3513
|
+
return Array.isArray(t);
|
|
3514
|
+
}
|
|
3515
|
+
function Vl(t) {
|
|
3516
|
+
return (e) => Promise.all(e.map(({ animation: i, options: s }) => Yr(t, i, s)));
|
|
3517
|
+
}
|
|
3518
|
+
function Dl(t) {
|
|
3519
|
+
let e = Vl(t), i = es(), s = !0;
|
|
3520
|
+
const n = (l) => (u, c) => {
|
|
3521
|
+
const h = ut(t, c, l === "exit" ? t.presenceContext?.custom : void 0);
|
|
3522
|
+
if (h) {
|
|
3523
|
+
const { transition: f, transitionEnd: m, ...d } = h;
|
|
3524
|
+
u = {
|
|
3525
|
+
...u,
|
|
3526
|
+
...d,
|
|
3527
|
+
...m
|
|
3528
|
+
};
|
|
3529
|
+
}
|
|
3530
|
+
return u;
|
|
3531
|
+
};
|
|
3532
|
+
function r(l) {
|
|
3533
|
+
e = l(t);
|
|
3534
|
+
}
|
|
3535
|
+
function o(l) {
|
|
3536
|
+
const u = t.props, c = Mn(t.parent) || {}, h = [], f = /* @__PURE__ */ new Set();
|
|
3537
|
+
let m = {}, d = 1 / 0;
|
|
3538
|
+
for (let p = 0; p < wl; p++) {
|
|
3539
|
+
const x = Sl[p], T = i[x], P = u[x] !== void 0 ? u[x] : c[x], b = De(P), A = x === l ? T.isActive : null;
|
|
3540
|
+
A === !1 && (d = p);
|
|
3541
|
+
let D = P === c[x] && P !== u[x] && b;
|
|
3542
|
+
if (D && s && t.manuallyAnimateOnMount && (D = !1), T.protectedKeys = { ...m }, !T.isActive && A === null || !P && !T.prevProp || ze(P) || typeof P == "boolean") continue;
|
|
3543
|
+
const y = Al(T.prevProp, P);
|
|
3544
|
+
let g = y || x === l && T.isActive && !D && b || p > d && b, C = !1;
|
|
3545
|
+
const V = Array.isArray(P) ? P : [P];
|
|
3546
|
+
let O = V.reduce(n(x), {});
|
|
3547
|
+
A === !1 && (O = {});
|
|
3548
|
+
const { prevResolvedValues: Xe = {} } = T, Nn = {
|
|
3549
|
+
...Xe,
|
|
3550
|
+
...O
|
|
3551
|
+
}, Ye = (k) => {
|
|
3552
|
+
g = !0, f.has(k) && (C = !0, f.delete(k)), T.needsAnimating[k] = !0;
|
|
3553
|
+
const N = t.getValue(k);
|
|
3554
|
+
N && (N.liveStyle = !1);
|
|
3555
|
+
};
|
|
3556
|
+
for (const k in Nn) {
|
|
3557
|
+
const N = O[k], Z = Xe[k];
|
|
3558
|
+
if (Object.hasOwnProperty.call(m, k)) continue;
|
|
3559
|
+
let rt = !1;
|
|
3560
|
+
is(N) && is(Z) ? rt = !ys(N, Z) : rt = N !== Z, rt ? N != null ? Ye(k) : f.add(k) : N !== void 0 && f.has(k) ? Ye(k) : T.protectedKeys[k] = !0;
|
|
3561
|
+
}
|
|
3562
|
+
T.prevProp = P, T.prevResolvedValues = O, T.isActive && (m = {
|
|
3563
|
+
...m,
|
|
3564
|
+
...O
|
|
3565
|
+
}), s && t.blockInitialAnimation && (g = !1);
|
|
3566
|
+
const qe = D && y;
|
|
3567
|
+
g && (!qe || C) && h.push(...V.map((k) => {
|
|
3568
|
+
const N = { type: x };
|
|
3569
|
+
if (typeof k == "string" && s && !qe && t.manuallyAnimateOnMount && t.parent) {
|
|
3570
|
+
const { parent: Z } = t, rt = ut(Z, k);
|
|
3571
|
+
if (Z.enteringChildren && rt) {
|
|
3572
|
+
const { delayChildren: Un } = rt.transition || {};
|
|
3573
|
+
N.delay = qs(Z.enteringChildren, t, Un);
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
return {
|
|
3577
|
+
animation: k,
|
|
3578
|
+
options: N
|
|
3579
|
+
};
|
|
3580
|
+
}));
|
|
3581
|
+
}
|
|
3582
|
+
if (f.size) {
|
|
3583
|
+
const p = {};
|
|
3584
|
+
if (typeof u.initial != "boolean") {
|
|
3585
|
+
const x = ut(t, Array.isArray(u.initial) ? u.initial[0] : u.initial);
|
|
3586
|
+
x && x.transition && (p.transition = x.transition);
|
|
3587
|
+
}
|
|
3588
|
+
f.forEach((x) => {
|
|
3589
|
+
const T = t.getBaseTarget(x), P = t.getValue(x);
|
|
3590
|
+
P && (P.liveStyle = !0), p[x] = T ?? null;
|
|
3591
|
+
}), h.push({ animation: p });
|
|
3592
|
+
}
|
|
3593
|
+
let v = !!h.length;
|
|
3594
|
+
return s && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (v = !1), s = !1, v ? e(h) : Promise.resolve();
|
|
3595
|
+
}
|
|
3596
|
+
function a(l, u) {
|
|
3597
|
+
if (i[l].isActive === u) return Promise.resolve();
|
|
3598
|
+
t.variantChildren?.forEach((h) => {
|
|
3599
|
+
h.animationState?.setActive(l, u);
|
|
3600
|
+
}), i[l].isActive = u;
|
|
3601
|
+
const c = o(l);
|
|
3602
|
+
for (const h in i) i[h].protectedKeys = {};
|
|
3603
|
+
return c;
|
|
3604
|
+
}
|
|
3605
|
+
return {
|
|
3606
|
+
animateChanges: o,
|
|
3607
|
+
setActive: a,
|
|
3608
|
+
setAnimateFunction: r,
|
|
3609
|
+
getState: () => i,
|
|
3610
|
+
reset: () => {
|
|
3611
|
+
i = es(), s = !0;
|
|
3612
|
+
}
|
|
3613
|
+
};
|
|
3614
|
+
}
|
|
3615
|
+
function Ln(t) {
|
|
3616
|
+
return t.style.display === "none" || t.offsetParent === null && window.getComputedStyle(t).position !== "fixed";
|
|
3617
|
+
}
|
|
3618
|
+
var Cl = class extends X {
|
|
3619
|
+
static #t = this.key = "animation";
|
|
3620
|
+
constructor(t) {
|
|
3621
|
+
super(t);
|
|
3622
|
+
const e = t.visualElement;
|
|
3623
|
+
e.animationState ||= Dl(e);
|
|
3624
|
+
}
|
|
3625
|
+
updateAnimationControlsSubscription() {
|
|
3626
|
+
const { animate: t } = this.state.options;
|
|
3627
|
+
ze(t) && (this.unmountControls = t.subscribe(this.state.visualElement));
|
|
3628
|
+
}
|
|
3629
|
+
mount() {
|
|
3630
|
+
Ln(this.state.element) ? this.state.setActive("exit", !0) : this.state.visualElement.animationState?.animateChanges(), this.updateAnimationControlsSubscription();
|
|
3631
|
+
}
|
|
3632
|
+
update() {
|
|
3633
|
+
this.state.visualElement.animationState?.animateChanges();
|
|
3634
|
+
const { animate: t } = this.state.visualElement.getProps(), { animate: e } = this.state.visualElement.prevProps || {};
|
|
3635
|
+
t !== e && this.updateAnimationControlsSubscription();
|
|
3636
|
+
}
|
|
3637
|
+
unmount() {
|
|
3638
|
+
this.state.visualElement.animationState.reset(), this.unmountControls?.();
|
|
3639
|
+
}
|
|
3640
|
+
}, El = class extends X {
|
|
3641
|
+
constructor(...t) {
|
|
3642
|
+
super(...t), this.exitGeneration = 0;
|
|
3643
|
+
}
|
|
3644
|
+
static #t = this.key = "exit";
|
|
3645
|
+
exit() {
|
|
3646
|
+
const t = ++this.exitGeneration, e = this.state;
|
|
3647
|
+
e.isExiting = !0;
|
|
3648
|
+
const i = new Promise((n) => {
|
|
3649
|
+
this.pendingExit = { resolve: n };
|
|
3650
|
+
}), s = e.visualElement?.animationState?.setActive("exit", !0);
|
|
3651
|
+
return s ? s.then(() => {
|
|
3652
|
+
t === this.exitGeneration && (e.isExiting = !1, e.options?.layoutId ? S.postRender(() => this.tryCompleteExit(t)) : this.tryCompleteExit(t));
|
|
3653
|
+
}) : (e.isExiting = !1, this.tryCompleteExit(t)), e.getSnapshot(!1), i;
|
|
3654
|
+
}
|
|
3655
|
+
reenter() {
|
|
3656
|
+
this.exitGeneration++, this.settleExit(), this.state.isExiting = !1, this.state.setActive("exit", !1), this.state.getSnapshot(!0);
|
|
3657
|
+
}
|
|
3658
|
+
completeExitFromProjection() {
|
|
3659
|
+
this.tryCompleteExit(this.exitGeneration);
|
|
3660
|
+
}
|
|
3661
|
+
tryCompleteExit(t) {
|
|
3662
|
+
t !== this.exitGeneration || this.state.isExiting || this.state.options?.layoutId && this.state.visualElement.projection?.currentAnimation?.state === "running" || this.settleExit();
|
|
3663
|
+
}
|
|
3664
|
+
settleExit() {
|
|
3665
|
+
this.pendingExit?.resolve(), this.pendingExit = void 0;
|
|
3666
|
+
}
|
|
3667
|
+
mount() {
|
|
3668
|
+
this.state.options.presenceContext?.register?.(this.state);
|
|
3669
|
+
}
|
|
3670
|
+
unmount() {
|
|
3671
|
+
this.state.options.presenceContext?.unregister?.(this.state), this.settleExit();
|
|
3672
|
+
}
|
|
3673
|
+
};
|
|
3674
|
+
function Ml(t, e) {
|
|
3675
|
+
return qn(t) ? new Ma(e) : new Da(e);
|
|
3676
|
+
}
|
|
3677
|
+
function ss(t) {
|
|
3678
|
+
return { point: {
|
|
3679
|
+
x: t.pageX,
|
|
3680
|
+
y: t.pageY
|
|
3681
|
+
} };
|
|
3682
|
+
}
|
|
3683
|
+
var Rl = class extends X {
|
|
3684
|
+
static #t = this.key = "press";
|
|
3685
|
+
constructor(t) {
|
|
3686
|
+
super(t);
|
|
3687
|
+
}
|
|
3688
|
+
isActive() {
|
|
3689
|
+
const { whilePress: t, onPress: e, onPressCancel: i, onPressStart: s } = this.state.options;
|
|
3690
|
+
return !!(t || e || i || s);
|
|
3691
|
+
}
|
|
3692
|
+
register() {
|
|
3693
|
+
const t = this.state.element;
|
|
3694
|
+
!t || !this.isActive() || (this.removePress?.(), this.removePress = ya(t, (e, i) => {
|
|
3695
|
+
const s = this.state.options;
|
|
3696
|
+
return this.state.setActive("whilePress", !0), s.onPressStart && S.postRender(() => s.onPressStart(i, ss(i))), (n, { success: r }) => {
|
|
3697
|
+
this.state.setActive("whilePress", !1);
|
|
3698
|
+
const o = r ? "onPress" : "onPressCancel", a = this.state.options[o];
|
|
3699
|
+
a && S.postRender(() => a(n, ss(n)));
|
|
3700
|
+
};
|
|
3701
|
+
}, { useGlobalTarget: this.state.options.globalPressTarget }));
|
|
3702
|
+
}
|
|
3703
|
+
mount() {
|
|
3704
|
+
this.register();
|
|
3705
|
+
}
|
|
3706
|
+
update() {
|
|
3707
|
+
const t = this.state.visualElement.prevProps;
|
|
3708
|
+
!(t?.whilePress || t?.whileTap || t?.onPress || t?.onPressCancel || t?.onPressStart) && this.isActive() && this.register();
|
|
3709
|
+
}
|
|
3710
|
+
unmount() {
|
|
3711
|
+
this.removePress?.(), this.removePress = void 0;
|
|
3712
|
+
}
|
|
3713
|
+
};
|
|
3714
|
+
function kn(t) {
|
|
3715
|
+
return t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1;
|
|
3716
|
+
}
|
|
3717
|
+
function Pt(t, e = "page") {
|
|
3718
|
+
return { point: {
|
|
3719
|
+
x: t[`${e}X`],
|
|
3720
|
+
y: t[`${e}Y`]
|
|
3721
|
+
} };
|
|
3722
|
+
}
|
|
3723
|
+
function Ll(t) {
|
|
3724
|
+
return (e) => kn(e) && t(e, Pt(e));
|
|
3725
|
+
}
|
|
3726
|
+
var kl = class extends X {
|
|
3727
|
+
static #t = this.key = "hover";
|
|
3728
|
+
constructor(t) {
|
|
3729
|
+
super(t);
|
|
3730
|
+
}
|
|
3731
|
+
isActive() {
|
|
3732
|
+
const { whileHover: t, onHoverStart: e, onHoverEnd: i } = this.state.options;
|
|
3733
|
+
return !!(t || e || i);
|
|
3734
|
+
}
|
|
3735
|
+
register() {
|
|
3736
|
+
const t = this.state.element;
|
|
3737
|
+
!t || !this.isActive() || (this.removeHover?.(), this.removeHover = ha(t, (e, i) => {
|
|
3738
|
+
const s = this.state.options;
|
|
3739
|
+
return this.state.setActive("whileHover", !0), s.onHoverStart && S.postRender(() => s.onHoverStart(i, Pt(i))), (n) => {
|
|
3740
|
+
this.state.setActive("whileHover", !1);
|
|
3741
|
+
const r = this.state.options.onHoverEnd;
|
|
3742
|
+
r && S.postRender(() => r(n, Pt(n)));
|
|
3743
|
+
};
|
|
3744
|
+
}));
|
|
3745
|
+
}
|
|
3746
|
+
mount() {
|
|
3747
|
+
this.register();
|
|
3748
|
+
}
|
|
3749
|
+
update() {
|
|
3750
|
+
const t = this.state.visualElement.prevProps;
|
|
3751
|
+
!(t?.whileHover || t?.onHoverStart || t?.onHoverEnd) && this.isActive() && this.register();
|
|
3752
|
+
}
|
|
3753
|
+
unmount() {
|
|
3754
|
+
this.removeHover?.(), this.removeHover = void 0;
|
|
3755
|
+
}
|
|
3756
|
+
}, Bl = class extends X {
|
|
3757
|
+
static #t = this.key = "inView";
|
|
3758
|
+
constructor(t) {
|
|
3759
|
+
super(t);
|
|
3760
|
+
}
|
|
3761
|
+
isActive() {
|
|
3762
|
+
const { whileInView: t, onViewportEnter: e, onViewportLeave: i } = this.state.options;
|
|
3763
|
+
return !!(t || e || i);
|
|
3764
|
+
}
|
|
3765
|
+
startObserver() {
|
|
3766
|
+
const t = this.state.element;
|
|
3767
|
+
if (!t || !this.isActive()) return;
|
|
3768
|
+
this.removeObserver?.();
|
|
3769
|
+
const { once: e, ...i } = this.state.options.inViewOptions || {};
|
|
3770
|
+
this.removeObserver = Tl(t, (s, n) => {
|
|
3771
|
+
const r = this.state.options;
|
|
3772
|
+
if (this.state.setActive("whileInView", !0), r.onViewportEnter && S.postRender(() => r.onViewportEnter(n)), !e) return () => {
|
|
3773
|
+
this.state.setActive("whileInView", !1);
|
|
3774
|
+
const o = this.state.options.onViewportLeave;
|
|
3775
|
+
o && S.postRender(() => o(n));
|
|
3776
|
+
};
|
|
3777
|
+
}, i);
|
|
3778
|
+
}
|
|
3779
|
+
mount() {
|
|
3780
|
+
this.startObserver();
|
|
3781
|
+
}
|
|
3782
|
+
update() {
|
|
3783
|
+
const { props: t, prevProps: e } = this.state.visualElement;
|
|
3784
|
+
[
|
|
3785
|
+
"amount",
|
|
3786
|
+
"margin",
|
|
3787
|
+
"root"
|
|
3788
|
+
].some((i) => t.inViewOptions?.[i] !== e?.inViewOptions?.[i]) && this.startObserver();
|
|
3789
|
+
}
|
|
3790
|
+
unmount() {
|
|
3791
|
+
this.removeObserver?.(), this.removeObserver = void 0;
|
|
3792
|
+
}
|
|
3793
|
+
}, Fl = class extends X {
|
|
3794
|
+
static #t = this.key = "focus";
|
|
3795
|
+
constructor(t) {
|
|
3796
|
+
super(t), this.isFocused = !1;
|
|
3797
|
+
}
|
|
3798
|
+
onFocus() {
|
|
3799
|
+
let t = !1;
|
|
3800
|
+
try {
|
|
3801
|
+
t = this.state.element.matches(":focus-visible");
|
|
3802
|
+
} catch {
|
|
3803
|
+
t = !0;
|
|
3804
|
+
}
|
|
3805
|
+
t && (this.state.setActive("whileFocus", !0), this.isFocused = !0);
|
|
3806
|
+
}
|
|
3807
|
+
onBlur() {
|
|
3808
|
+
this.isFocused && (this.state.setActive("whileFocus", !1), this.isFocused = !1);
|
|
3809
|
+
}
|
|
3810
|
+
mount() {
|
|
3811
|
+
const t = this.state.element;
|
|
3812
|
+
this.removeFocus = wt(Tt(t, "focus", () => this.onFocus()), Tt(t, "blur", () => this.onBlur()));
|
|
3813
|
+
}
|
|
3814
|
+
unmount() {
|
|
3815
|
+
this.removeFocus?.(), this.removeFocus = void 0;
|
|
3816
|
+
}
|
|
3817
|
+
};
|
|
3818
|
+
function Bn(t) {
|
|
3819
|
+
if (t)
|
|
3820
|
+
return t.options.allowProjection !== !1 ? t.projection : Bn(t.parent);
|
|
3821
|
+
}
|
|
3822
|
+
const Fn = {
|
|
3823
|
+
borderRadius: {
|
|
3824
|
+
...H,
|
|
3825
|
+
applyTo: [
|
|
3826
|
+
"borderTopLeftRadius",
|
|
3827
|
+
"borderTopRightRadius",
|
|
3828
|
+
"borderBottomLeftRadius",
|
|
3829
|
+
"borderBottomRightRadius"
|
|
3830
|
+
]
|
|
3831
|
+
},
|
|
3832
|
+
borderTopLeftRadius: H,
|
|
3833
|
+
borderTopRightRadius: H,
|
|
3834
|
+
borderBottomLeftRadius: H,
|
|
3835
|
+
borderBottomRightRadius: H,
|
|
3836
|
+
boxShadow: gn
|
|
3837
|
+
};
|
|
3838
|
+
function dt(t) {
|
|
3839
|
+
return typeof t == "object" && t !== null && "nodeType" in t;
|
|
3840
|
+
}
|
|
3841
|
+
const Il = typeof window > "u";
|
|
3842
|
+
var jl = class extends X {
|
|
3843
|
+
static #t = this.key = "projection";
|
|
3844
|
+
constructor(t) {
|
|
3845
|
+
super(t), vn(Fn), Il || this.initProjection();
|
|
3846
|
+
}
|
|
3847
|
+
initProjection() {
|
|
3848
|
+
const t = this.state.options;
|
|
3849
|
+
this.state.visualElement.projection = new vl(this.state.visualElement.latestValues, t["data-framer-portal-id"] ? void 0 : Bn(this.state.visualElement.parent)), this.projection = this.state.visualElement.projection, this.projection.isPresent = !0, this.setOptions();
|
|
3850
|
+
}
|
|
3851
|
+
setOptions() {
|
|
3852
|
+
const t = this.state.options, { layoutId: e, layout: i, drag: s = !1, dragConstraints: n = !1 } = t;
|
|
3853
|
+
this.projection?.setOptions({
|
|
3854
|
+
layout: i,
|
|
3855
|
+
layoutId: e,
|
|
3856
|
+
alwaysMeasureLayout: !!e || !!s || n && dt(n),
|
|
3857
|
+
visualElement: this.state.visualElement,
|
|
3858
|
+
animationType: typeof t.layout == "string" ? t.layout : "both",
|
|
3859
|
+
layoutRoot: t.layoutRoot,
|
|
3860
|
+
layoutScroll: t.layoutScroll,
|
|
3861
|
+
crossfade: t.crossfade,
|
|
3862
|
+
onExitComplete: () => {
|
|
3863
|
+
!this.projection?.isPresent && this.state.options.layoutId && !this.state.isExiting && queueMicrotask(() => {
|
|
3864
|
+
this.state.getFeature("exit")?.completeExitFromProjection();
|
|
3865
|
+
});
|
|
3866
|
+
}
|
|
3867
|
+
});
|
|
3868
|
+
}
|
|
3869
|
+
update() {
|
|
3870
|
+
this.setOptions();
|
|
3871
|
+
}
|
|
3872
|
+
mount() {
|
|
3873
|
+
this.projection?.mount(this.state.element);
|
|
3874
|
+
}
|
|
3875
|
+
};
|
|
3876
|
+
function yt(t, e, i, s) {
|
|
3877
|
+
return Tt(t, e, Ll(i), s);
|
|
3878
|
+
}
|
|
3879
|
+
var ns = /* @__PURE__ */ new Set(["auto", "scroll"]), In = class {
|
|
3880
|
+
constructor(t, e, { transformPagePoint: i, contextWindow: s, dragSnapToOrigin: n = !1, element: r } = {}) {
|
|
3881
|
+
if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.scrollPositions = /* @__PURE__ */ new Map(), this.onElementScroll = (c) => {
|
|
3882
|
+
this.handleScroll(c.target);
|
|
3883
|
+
}, this.onWindowScroll = () => {
|
|
3884
|
+
this.handleScroll(window);
|
|
3885
|
+
}, this.updatePoint = () => {
|
|
3886
|
+
if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return;
|
|
3887
|
+
const c = te(this.lastMoveEventInfo, this.history), h = this.startEvent !== null, f = Pl(c.offset, {
|
|
3888
|
+
x: 0,
|
|
3889
|
+
y: 0
|
|
3890
|
+
}) >= 3;
|
|
3891
|
+
if (!h && !f) return;
|
|
3892
|
+
const { point: m } = c, { timestamp: d } = M;
|
|
3893
|
+
this.history.push({
|
|
3894
|
+
...m,
|
|
3895
|
+
timestamp: d
|
|
3896
|
+
});
|
|
3897
|
+
const { onStart: v, onMove: p } = this.handlers;
|
|
3898
|
+
h || (v && v(this.lastMoveEvent, c), this.startEvent = this.lastMoveEvent), p && p(this.lastMoveEvent, c);
|
|
3899
|
+
}, this.handlePointerMove = (c, h) => {
|
|
3900
|
+
this.lastMoveEvent = c, this.lastMoveEventInfo = Qt(h, this.transformPagePoint), S.update(this.updatePoint, !0);
|
|
3901
|
+
}, this.handlePointerUp = (c, h) => {
|
|
3902
|
+
this.end();
|
|
3903
|
+
const { onEnd: f, onSessionEnd: m, resumeAnimation: d } = this.handlers;
|
|
3904
|
+
if ((this.dragSnapToOrigin || !this.startEvent) && d && d(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return;
|
|
3905
|
+
const v = te(c.type === "pointercancel" ? this.lastMoveEventInfo : Qt(h, this.transformPagePoint), this.history);
|
|
3906
|
+
this.startEvent && f && f(c, v), m && m(c, v);
|
|
3907
|
+
}, !kn(t)) return;
|
|
3908
|
+
this.dragSnapToOrigin = n, this.handlers = e, this.transformPagePoint = i, this.contextWindow = s || window;
|
|
3909
|
+
const o = Qt(Pt(t), this.transformPagePoint), { point: a } = o, { timestamp: l } = M;
|
|
3910
|
+
this.history = [{
|
|
3911
|
+
...a,
|
|
3912
|
+
timestamp: l
|
|
3913
|
+
}];
|
|
3914
|
+
const { onSessionStart: u } = e;
|
|
3915
|
+
u && u(t, te(o, this.history)), this.removeListeners = wt(yt(this.contextWindow, "pointermove", this.handlePointerMove), yt(this.contextWindow, "pointerup", this.handlePointerUp), yt(this.contextWindow, "pointercancel", this.handlePointerUp)), r && this.startScrollTracking(r);
|
|
3916
|
+
}
|
|
3917
|
+
isScrollable(t) {
|
|
3918
|
+
const e = window.getComputedStyle(t);
|
|
3919
|
+
return e.overflow === "auto" || e.overflow === "scroll" || e.overflowX === "auto" || e.overflowX === "scroll" || e.overflowY === "auto" || e.overflowY === "scroll";
|
|
3920
|
+
}
|
|
3921
|
+
startScrollTracking(t) {
|
|
3922
|
+
let e = t.parentElement;
|
|
3923
|
+
for (; e; ) {
|
|
3924
|
+
const i = getComputedStyle(e);
|
|
3925
|
+
(ns.has(i.overflowX) || ns.has(i.overflowY)) && this.scrollPositions.set(e, {
|
|
3926
|
+
x: e.scrollLeft,
|
|
3927
|
+
y: e.scrollTop
|
|
3928
|
+
}), e = e.parentElement;
|
|
3929
|
+
}
|
|
3930
|
+
this.scrollPositions.set(window, {
|
|
3931
|
+
x: window.scrollX,
|
|
3932
|
+
y: window.scrollY
|
|
3933
|
+
}), window.addEventListener("scroll", this.onElementScroll, {
|
|
3934
|
+
capture: !0,
|
|
3935
|
+
passive: !0
|
|
3936
|
+
}), window.addEventListener("scroll", this.onWindowScroll, { passive: !0 }), this.removeScrollListeners = () => {
|
|
3937
|
+
window.removeEventListener("scroll", this.onElementScroll, { capture: !0 }), window.removeEventListener("scroll", this.onWindowScroll);
|
|
3938
|
+
};
|
|
3939
|
+
}
|
|
3940
|
+
handleScroll(t) {
|
|
3941
|
+
const e = this.scrollPositions.get(t);
|
|
3942
|
+
if (!e) return;
|
|
3943
|
+
const i = t === window, s = i ? {
|
|
3944
|
+
x: window.scrollX,
|
|
3945
|
+
y: window.scrollY
|
|
3946
|
+
} : {
|
|
3947
|
+
x: t.scrollLeft,
|
|
3948
|
+
y: t.scrollTop
|
|
3949
|
+
}, n = {
|
|
3950
|
+
x: s.x - e.x,
|
|
3951
|
+
y: s.y - e.y
|
|
3952
|
+
};
|
|
3953
|
+
n.x === 0 && n.y === 0 || (i ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += n.x, this.lastMoveEventInfo.point.y += n.y) : this.history.length > 0 && (this.history[0].x -= n.x, this.history[0].y -= n.y), this.scrollPositions.set(t, s), S.update(this.updatePoint, !0));
|
|
3954
|
+
}
|
|
3955
|
+
updateHandlers(t) {
|
|
3956
|
+
this.handlers = t;
|
|
3957
|
+
}
|
|
3958
|
+
end() {
|
|
3959
|
+
this.removeListeners && this.removeListeners(), this.removeScrollListeners?.(), this.scrollPositions.clear(), q(this.updatePoint);
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
function Qt(t, e) {
|
|
3963
|
+
return e ? { point: e(t.point) } : t;
|
|
3964
|
+
}
|
|
3965
|
+
function os(t, e) {
|
|
3966
|
+
return {
|
|
3967
|
+
x: t.x - e.x,
|
|
3968
|
+
y: t.y - e.y
|
|
3969
|
+
};
|
|
3970
|
+
}
|
|
3971
|
+
function te({ point: t }, e) {
|
|
3972
|
+
return {
|
|
3973
|
+
point: t,
|
|
3974
|
+
delta: os(t, jn(e)),
|
|
3975
|
+
offset: os(t, Ol(e)),
|
|
3976
|
+
velocity: Nl(e, 0.1)
|
|
3977
|
+
};
|
|
3978
|
+
}
|
|
3979
|
+
function Ol(t) {
|
|
3980
|
+
return t[0];
|
|
3981
|
+
}
|
|
3982
|
+
function jn(t) {
|
|
3983
|
+
return t[t.length - 1];
|
|
3984
|
+
}
|
|
3985
|
+
function Nl(t, e) {
|
|
3986
|
+
if (t.length < 2) return {
|
|
3987
|
+
x: 0,
|
|
3988
|
+
y: 0
|
|
3989
|
+
};
|
|
3990
|
+
let i = t.length - 1, s = null;
|
|
3991
|
+
const n = jn(t);
|
|
3992
|
+
for (; i >= 0 && (s = t[i], !(n.timestamp - s.timestamp > /* @__PURE__ */ K(e))); )
|
|
3993
|
+
i--;
|
|
3994
|
+
if (!s) return {
|
|
3995
|
+
x: 0,
|
|
3996
|
+
y: 0
|
|
3997
|
+
};
|
|
3998
|
+
const r = /* @__PURE__ */ U(n.timestamp - s.timestamp);
|
|
3999
|
+
if (r === 0) return {
|
|
4000
|
+
x: 0,
|
|
4001
|
+
y: 0
|
|
4002
|
+
};
|
|
4003
|
+
const o = {
|
|
4004
|
+
x: (n.x - s.x) / r,
|
|
4005
|
+
y: (n.y - s.y) / r
|
|
4006
|
+
};
|
|
4007
|
+
return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o;
|
|
4008
|
+
}
|
|
4009
|
+
function rs(t) {
|
|
4010
|
+
return (e, i) => {
|
|
4011
|
+
t && S.postRender(() => t(e, i));
|
|
4012
|
+
};
|
|
4013
|
+
}
|
|
4014
|
+
var Ul = class extends X {
|
|
4015
|
+
constructor(...t) {
|
|
4016
|
+
super(...t), this.removePointerDownListener = W;
|
|
4017
|
+
}
|
|
4018
|
+
static #t = this.key = "pan";
|
|
4019
|
+
onPointerDown(t) {
|
|
4020
|
+
this.session = new In(t, this.createPanHandlers(), {
|
|
4021
|
+
transformPagePoint: this.state.visualElement.getTransformPagePoint(),
|
|
4022
|
+
contextWindow: Cn(this.state.visualElement)
|
|
4023
|
+
});
|
|
4024
|
+
}
|
|
4025
|
+
createPanHandlers() {
|
|
4026
|
+
return {
|
|
4027
|
+
onSessionStart: rs((t, e) => {
|
|
4028
|
+
const { onPanSessionStart: i } = this.state.options;
|
|
4029
|
+
i && i(t, e);
|
|
4030
|
+
}),
|
|
4031
|
+
onStart: rs((t, e) => {
|
|
4032
|
+
const { onPanStart: i } = this.state.options;
|
|
4033
|
+
i && i(t, e);
|
|
4034
|
+
}),
|
|
4035
|
+
onMove: (t, e) => {
|
|
4036
|
+
const { onPan: i } = this.state.options;
|
|
4037
|
+
i && i(t, e);
|
|
4038
|
+
},
|
|
4039
|
+
onEnd: (t, e) => {
|
|
4040
|
+
const { onPanEnd: i } = this.state.options;
|
|
4041
|
+
delete this.session, i && S.postRender(() => i(t, e));
|
|
4042
|
+
}
|
|
4043
|
+
};
|
|
4044
|
+
}
|
|
4045
|
+
mount() {
|
|
4046
|
+
this.removePointerDownListener = yt(this.state.element, "pointerdown", this.onPointerDown.bind(this));
|
|
4047
|
+
}
|
|
4048
|
+
update() {
|
|
4049
|
+
}
|
|
4050
|
+
unmount() {
|
|
4051
|
+
this.removePointerDownListener(), this.session && this.session.end();
|
|
4052
|
+
}
|
|
4053
|
+
};
|
|
4054
|
+
function On(t) {
|
|
4055
|
+
let e = null;
|
|
4056
|
+
return () => {
|
|
4057
|
+
const i = () => {
|
|
4058
|
+
e = null;
|
|
4059
|
+
};
|
|
4060
|
+
return e === null ? (e = t, i) : !1;
|
|
4061
|
+
};
|
|
4062
|
+
}
|
|
4063
|
+
var as = On("dragHorizontal"), ls = On("dragVertical");
|
|
4064
|
+
function Kl(t) {
|
|
4065
|
+
let e = !1;
|
|
4066
|
+
if (t === "y") e = ls();
|
|
4067
|
+
else if (t === "x") e = as();
|
|
4068
|
+
else {
|
|
4069
|
+
const i = as(), s = ls();
|
|
4070
|
+
i && s ? e = () => {
|
|
4071
|
+
i(), s();
|
|
4072
|
+
} : (i && i(), s && s());
|
|
4073
|
+
}
|
|
4074
|
+
return e;
|
|
4075
|
+
}
|
|
4076
|
+
function _l(t, { min: e, max: i }, s) {
|
|
4077
|
+
return e !== void 0 && t < e ? t = s ? w(e, t, s.min) : Math.max(t, e) : i !== void 0 && t > i && (t = s ? w(i, t, s.max) : Math.min(t, i)), t;
|
|
4078
|
+
}
|
|
4079
|
+
const Se = 0.35;
|
|
4080
|
+
function $l(t, { top: e, left: i, bottom: s, right: n }) {
|
|
4081
|
+
return {
|
|
4082
|
+
x: cs(t.x, i, n),
|
|
4083
|
+
y: cs(t.y, e, s)
|
|
4084
|
+
};
|
|
4085
|
+
}
|
|
4086
|
+
function cs(t, e, i) {
|
|
4087
|
+
return {
|
|
4088
|
+
min: e !== void 0 ? t.min + e : void 0,
|
|
4089
|
+
max: i !== void 0 ? t.max + i - (t.max - t.min) : void 0
|
|
4090
|
+
};
|
|
4091
|
+
}
|
|
4092
|
+
function Gl(t = Se) {
|
|
4093
|
+
return t === !1 ? t = 0 : t === !0 && (t = Se), {
|
|
4094
|
+
x: us(t, "left", "right"),
|
|
4095
|
+
y: us(t, "top", "bottom")
|
|
4096
|
+
};
|
|
4097
|
+
}
|
|
4098
|
+
function us(t, e, i) {
|
|
4099
|
+
return {
|
|
4100
|
+
min: hs(t, e),
|
|
4101
|
+
max: hs(t, i)
|
|
4102
|
+
};
|
|
4103
|
+
}
|
|
4104
|
+
function hs(t, e) {
|
|
4105
|
+
return typeof t == "number" ? t : t[e] || 0;
|
|
4106
|
+
}
|
|
4107
|
+
function Hl(t, e) {
|
|
4108
|
+
const i = {};
|
|
4109
|
+
return e.min !== void 0 && (i.min = e.min - t.min), e.max !== void 0 && (i.max = e.max - t.min), i;
|
|
4110
|
+
}
|
|
4111
|
+
function Wl(t, e) {
|
|
4112
|
+
return {
|
|
4113
|
+
x: fs(t.x, e.x),
|
|
4114
|
+
y: fs(t.y, e.y)
|
|
4115
|
+
};
|
|
4116
|
+
}
|
|
4117
|
+
function fs(t, e) {
|
|
4118
|
+
let i = e.min - t.min, s = e.max - t.max;
|
|
4119
|
+
return e.max - e.min < t.max - t.min && ([i, s] = [s, i]), {
|
|
4120
|
+
min: i,
|
|
4121
|
+
max: s
|
|
4122
|
+
};
|
|
4123
|
+
}
|
|
4124
|
+
function zl(t, e) {
|
|
4125
|
+
let i = 0.5;
|
|
4126
|
+
const s = F(t), n = F(e);
|
|
4127
|
+
return n > s ? i = /* @__PURE__ */ gt(e.min, e.max - s, t.min) : s > n && (i = /* @__PURE__ */ gt(t.min, t.max - n, e.min)), z(0, 1, i);
|
|
4128
|
+
}
|
|
4129
|
+
const Xl = /* @__PURE__ */ new WeakMap();
|
|
4130
|
+
var Yl = class {
|
|
4131
|
+
constructor(t) {
|
|
4132
|
+
this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = {
|
|
4133
|
+
x: 0,
|
|
4134
|
+
y: 0
|
|
4135
|
+
}, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = E(), this.state = t;
|
|
4136
|
+
}
|
|
4137
|
+
get visualElement() {
|
|
4138
|
+
return this.state.visualElement;
|
|
4139
|
+
}
|
|
4140
|
+
start(t, { snapToCursor: e = !1 } = {}) {
|
|
4141
|
+
const i = (l) => {
|
|
4142
|
+
e && this.snapToCursor(Pt(l, "page").point), this.stopAnimation();
|
|
4143
|
+
}, s = (l, u) => {
|
|
4144
|
+
this.stopAnimation();
|
|
4145
|
+
const { drag: c, dragPropagation: h, onDragStart: f } = this.getProps();
|
|
4146
|
+
c && !h && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = Kl(c), !this.openGlobalLock) || (this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), $((m) => {
|
|
4147
|
+
let d = this.getAxisMotionValue(m).get() || 0;
|
|
4148
|
+
if (nt.test(d)) {
|
|
4149
|
+
const { projection: v } = this.visualElement;
|
|
4150
|
+
if (v && v.layout) {
|
|
4151
|
+
const p = v.layout.layoutBox[m];
|
|
4152
|
+
p && (d = F(p) * (parseFloat(d) / 100));
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
this.originPoint[m] = d;
|
|
4156
|
+
}), f && S.postRender(() => f(l, u)), ge(this.visualElement, "transform"), this.state.setActive("whileDrag", !0));
|
|
4157
|
+
}, n = (l, u) => {
|
|
4158
|
+
const { dragPropagation: c, dragDirectionLock: h, onDirectionLock: f, onDrag: m } = this.getProps();
|
|
4159
|
+
if (!c && !this.openGlobalLock) return;
|
|
4160
|
+
const { offset: d } = u;
|
|
4161
|
+
if (h && this.currentDirection === null) {
|
|
4162
|
+
this.currentDirection = ql(d), this.currentDirection !== null && f && f(this.currentDirection);
|
|
4163
|
+
return;
|
|
4164
|
+
}
|
|
4165
|
+
this.updateAxis("x", u.point, d), this.updateAxis("y", u.point, d), this.visualElement.render(), m && m(l, u);
|
|
4166
|
+
}, r = (l, u) => this.stop(l, u), o = () => {
|
|
4167
|
+
const { dragSnapToOrigin: l } = this.getProps();
|
|
4168
|
+
(l || this.constraints) && this.startAnimation({
|
|
4169
|
+
x: 0,
|
|
4170
|
+
y: 0
|
|
4171
|
+
});
|
|
4172
|
+
}, { dragSnapToOrigin: a } = this.getProps();
|
|
4173
|
+
this.panSession = new In(t, {
|
|
4174
|
+
onSessionStart: i,
|
|
4175
|
+
onStart: s,
|
|
4176
|
+
onMove: n,
|
|
4177
|
+
onSessionEnd: r,
|
|
4178
|
+
resumeAnimation: o
|
|
4179
|
+
}, {
|
|
4180
|
+
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
4181
|
+
dragSnapToOrigin: a,
|
|
4182
|
+
contextWindow: Cn(this.visualElement),
|
|
4183
|
+
element: this.state.element
|
|
4184
|
+
});
|
|
4185
|
+
}
|
|
4186
|
+
stop(t, e) {
|
|
4187
|
+
const i = this.isDragging;
|
|
4188
|
+
if (this.cancel(), !i) return;
|
|
4189
|
+
const { velocity: s } = e;
|
|
4190
|
+
this.startAnimation(s);
|
|
4191
|
+
const { onDragEnd: n } = this.getProps();
|
|
4192
|
+
n && S.postRender(() => n(t, e));
|
|
4193
|
+
}
|
|
4194
|
+
cancel() {
|
|
4195
|
+
this.isDragging = !1;
|
|
4196
|
+
const { projection: t } = this.visualElement;
|
|
4197
|
+
t && (t.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
|
|
4198
|
+
const { dragPropagation: e } = this.getProps();
|
|
4199
|
+
!e && this.openGlobalLock && (this.openGlobalLock(), this.openGlobalLock = null), this.state.setActive("whileDrag", !1);
|
|
4200
|
+
}
|
|
4201
|
+
updateAxis(t, e, i) {
|
|
4202
|
+
const { drag: s } = this.getProps();
|
|
4203
|
+
if (!i || !Vt(t, s, this.currentDirection)) return;
|
|
4204
|
+
const n = this.getAxisMotionValue(t);
|
|
4205
|
+
let r = this.originPoint[t] + i[t];
|
|
4206
|
+
this.constraints && this.constraints[t] && (r = _l(r, this.constraints[t], this.elastic[t])), n.set(r);
|
|
4207
|
+
}
|
|
4208
|
+
resolveConstraints() {
|
|
4209
|
+
const { dragConstraints: t, dragElastic: e } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, s = this.constraints;
|
|
4210
|
+
t && dt(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && i ? this.constraints = $l(i.layoutBox, t) : this.constraints = !1, this.elastic = Gl(e), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && $((n) => {
|
|
4211
|
+
this.constraints !== !1 && this.getAxisMotionValue(n) && (this.constraints[n] = Hl(i.layoutBox[n], this.constraints[n]));
|
|
4212
|
+
});
|
|
4213
|
+
}
|
|
4214
|
+
resolveRefConstraints() {
|
|
4215
|
+
const { dragConstraints: t, onMeasureDragConstraints: e } = this.getProps();
|
|
4216
|
+
if (!t || !dt(t)) return !1;
|
|
4217
|
+
const i = t, { projection: s } = this.visualElement;
|
|
4218
|
+
if (!s || !s.layout) return !1;
|
|
4219
|
+
const n = aa(i, s.root, this.visualElement.getTransformPagePoint());
|
|
4220
|
+
let r = Wl(s.layout.layoutBox, n);
|
|
4221
|
+
if (e) {
|
|
4222
|
+
const o = e(na(r));
|
|
4223
|
+
this.hasMutatedConstraints = !!o, o && (r = rn(o));
|
|
4224
|
+
}
|
|
4225
|
+
return r;
|
|
4226
|
+
}
|
|
4227
|
+
startAnimation(t) {
|
|
4228
|
+
const { drag: e, dragMomentum: i, dragElastic: s, dragTransition: n, dragSnapToOrigin: r, onDragTransitionEnd: o } = this.getProps(), a = this.constraints || {}, l = $((u) => {
|
|
4229
|
+
if (!Vt(u, e, this.currentDirection)) return;
|
|
4230
|
+
let c = a && a[u] || {};
|
|
4231
|
+
r && (c = {
|
|
4232
|
+
min: 0,
|
|
4233
|
+
max: 0
|
|
4234
|
+
});
|
|
4235
|
+
const h = s ? 200 : 1e6, f = s ? 40 : 1e7, m = {
|
|
4236
|
+
type: "inertia",
|
|
4237
|
+
velocity: i ? t[u] : 0,
|
|
4238
|
+
bounceStiffness: h,
|
|
4239
|
+
bounceDamping: f,
|
|
4240
|
+
timeConstant: 750,
|
|
4241
|
+
restDelta: 1,
|
|
4242
|
+
restSpeed: 10,
|
|
4243
|
+
...n,
|
|
4244
|
+
...c
|
|
4245
|
+
};
|
|
4246
|
+
return this.startAxisValueAnimation(u, m);
|
|
4247
|
+
});
|
|
4248
|
+
return Promise.all(l).then(o);
|
|
4249
|
+
}
|
|
4250
|
+
startAxisValueAnimation(t, e) {
|
|
4251
|
+
const i = this.getAxisMotionValue(t);
|
|
4252
|
+
return ge(this.visualElement, t), i.start(Ge(t, i, 0, e, this.visualElement, !1));
|
|
4253
|
+
}
|
|
4254
|
+
stopAnimation() {
|
|
4255
|
+
this.visualElement.projection?.isPresent && $((t) => this.getAxisMotionValue(t).stop());
|
|
4256
|
+
}
|
|
4257
|
+
getAxisMotionValue(t) {
|
|
4258
|
+
const e = `_drag${t.toUpperCase()}`, i = this.visualElement.getProps();
|
|
4259
|
+
return i[e] || this.visualElement.getValue(t, (i.initial ? i.initial[t] : void 0) || 0);
|
|
4260
|
+
}
|
|
4261
|
+
snapToCursor(t) {
|
|
4262
|
+
$((e) => {
|
|
4263
|
+
const { drag: i } = this.getProps();
|
|
4264
|
+
if (!Vt(e, i, this.currentDirection)) return;
|
|
4265
|
+
const { projection: s } = this.visualElement, n = this.getAxisMotionValue(e);
|
|
4266
|
+
if (s && s.layout) {
|
|
4267
|
+
const { min: r, max: o } = s.layout.layoutBox[e];
|
|
4268
|
+
n.set(t[e] - w(r, o, 0.5));
|
|
4269
|
+
}
|
|
4270
|
+
});
|
|
4271
|
+
}
|
|
4272
|
+
scalePositionWithinConstraints() {
|
|
4273
|
+
if (!this.visualElement.current) return;
|
|
4274
|
+
const { drag: t, dragConstraints: e } = this.getProps(), { projection: i } = this.visualElement;
|
|
4275
|
+
if (!dt(e) || !i || !this.constraints) return;
|
|
4276
|
+
this.stopAnimation();
|
|
4277
|
+
const s = {
|
|
4278
|
+
x: 0,
|
|
4279
|
+
y: 0
|
|
4280
|
+
};
|
|
4281
|
+
$((r) => {
|
|
4282
|
+
const o = this.getAxisMotionValue(r);
|
|
4283
|
+
if (o && this.constraints !== !1) {
|
|
4284
|
+
const a = o.get();
|
|
4285
|
+
s[r] = zl({
|
|
4286
|
+
min: a,
|
|
4287
|
+
max: a
|
|
4288
|
+
}, this.constraints[r]);
|
|
4289
|
+
}
|
|
4290
|
+
});
|
|
4291
|
+
const { transformTemplate: n } = this.visualElement.getProps();
|
|
4292
|
+
this.state.element.style.transform = n ? n({}, "") : "none", i.root && i.root.updateScroll(), i.updateLayout(), this.resolveConstraints(), $((r) => {
|
|
4293
|
+
if (!Vt(r, t, null)) return;
|
|
4294
|
+
const o = this.getAxisMotionValue(r), { min: a, max: l } = this.constraints[r];
|
|
4295
|
+
o.set(w(a, l, s[r]));
|
|
4296
|
+
});
|
|
4297
|
+
}
|
|
4298
|
+
addListeners() {
|
|
4299
|
+
if (!this.state.element) return;
|
|
4300
|
+
Xl.set(this.visualElement, this);
|
|
4301
|
+
const t = this.state.element, e = yt(t, "pointerdown", (a) => {
|
|
4302
|
+
const { drag: l, dragListener: u = !0 } = this.getProps();
|
|
4303
|
+
l && u && this.start(a);
|
|
4304
|
+
}), i = () => {
|
|
4305
|
+
const { dragConstraints: a } = this.getProps();
|
|
4306
|
+
dt(a) && (this.constraints = this.resolveRefConstraints());
|
|
4307
|
+
}, { projection: s } = this.visualElement, n = s.addEventListener("measure", i);
|
|
4308
|
+
s && !s.layout && (s.root && s.root.updateScroll(), s.updateLayout()), S.read(i);
|
|
4309
|
+
const r = Tt(window, "resize", () => this.scalePositionWithinConstraints()), o = s.addEventListener("didUpdate", (({ delta: a, hasLayoutChanged: l }) => {
|
|
4310
|
+
this.isDragging && l && ($((u) => {
|
|
4311
|
+
const c = this.getAxisMotionValue(u);
|
|
4312
|
+
c && (this.originPoint[u] += a[u].translate, c.set(c.get() + a[u].translate));
|
|
4313
|
+
}), this.visualElement.render());
|
|
4314
|
+
}));
|
|
4315
|
+
return () => {
|
|
4316
|
+
r(), e(), n(), o && o();
|
|
4317
|
+
};
|
|
4318
|
+
}
|
|
4319
|
+
getProps() {
|
|
4320
|
+
const t = this.visualElement.getProps(), { drag: e = !1, dragDirectionLock: i = !1, dragPropagation: s = !1, dragConstraints: n = !1, dragElastic: r = Se, dragMomentum: o = !0 } = t;
|
|
4321
|
+
return {
|
|
4322
|
+
...t,
|
|
4323
|
+
drag: e,
|
|
4324
|
+
dragDirectionLock: i,
|
|
4325
|
+
dragPropagation: s,
|
|
4326
|
+
dragConstraints: n,
|
|
4327
|
+
dragElastic: r,
|
|
4328
|
+
dragMomentum: o
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
};
|
|
4332
|
+
function Vt(t, e, i) {
|
|
4333
|
+
return (e === !0 || e === t) && (i === null || i === t);
|
|
4334
|
+
}
|
|
4335
|
+
function ql(t, e = 10) {
|
|
4336
|
+
let i = null;
|
|
4337
|
+
return Math.abs(t.y) > e ? i = "y" : Math.abs(t.x) > e && (i = "x"), i;
|
|
4338
|
+
}
|
|
4339
|
+
var Zl = class extends X {
|
|
4340
|
+
static #t = this.key = "drag";
|
|
4341
|
+
constructor(t) {
|
|
4342
|
+
super(t), this.removeGroupControls = W, this.removeListeners = W, this.controls = new Yl(t);
|
|
4343
|
+
}
|
|
4344
|
+
mount() {
|
|
4345
|
+
const { dragControls: t } = this.state.options;
|
|
4346
|
+
t && (this.removeGroupControls = t.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || W;
|
|
4347
|
+
}
|
|
4348
|
+
unmount() {
|
|
4349
|
+
this.removeGroupControls(), this.removeListeners();
|
|
4350
|
+
}
|
|
4351
|
+
}, Jl = class extends X {
|
|
4352
|
+
static #t = this.key = "layout";
|
|
4353
|
+
constructor(t) {
|
|
4354
|
+
super(t), vn(Fn);
|
|
4355
|
+
}
|
|
4356
|
+
updatePrevLead(t) {
|
|
4357
|
+
const e = this.state.visualElement.projection;
|
|
4358
|
+
e.isPresent !== t && (e.isPresent = t, t ? !e.isLead() && e?.promote() : e.isLead() && e?.relegate());
|
|
4359
|
+
}
|
|
4360
|
+
didUpdate() {
|
|
4361
|
+
(this.state.options.layout || this.state.options.layoutId || this.state.options.drag) && this.state.visualElement.projection?.root?.didUpdate();
|
|
4362
|
+
}
|
|
4363
|
+
mount() {
|
|
4364
|
+
const t = this.state.options, e = this.state.options.layoutGroup;
|
|
4365
|
+
if (t.layout || t.layoutId) {
|
|
4366
|
+
const i = this.state.visualElement.projection;
|
|
4367
|
+
if (t.layoutId) {
|
|
4368
|
+
const s = !Ln(this.state.element);
|
|
4369
|
+
i.isPresent = s, s ? i?.promote() : i?.relegate();
|
|
4370
|
+
}
|
|
4371
|
+
e?.group?.add(i), Mt.hasEverUpdated = !0;
|
|
4372
|
+
}
|
|
4373
|
+
this.didUpdate();
|
|
4374
|
+
}
|
|
4375
|
+
unmount() {
|
|
4376
|
+
const t = this.state.options.layoutGroup, e = this.state.visualElement.projection;
|
|
4377
|
+
e && t?.group && (this.state.options.layout || this.state.options.layoutId) && t.group.remove(e);
|
|
4378
|
+
}
|
|
4379
|
+
getSnapshot(t) {
|
|
4380
|
+
const e = this.state.visualElement.projection, { layout: i, layoutId: s, drag: n, layoutDependency: r } = this.state.visualElement.props, o = this.state.visualElement.prevProps;
|
|
4381
|
+
!e || !i && !s && !n || ((n || o.layoutDependency !== r || r === void 0 || t !== e.isPresent) && e.willUpdate(), s && this.updatePrevLead(t), this.didUpdate());
|
|
4382
|
+
}
|
|
4383
|
+
refreshRootScroll() {
|
|
4384
|
+
const t = this.state.visualElement?.projection?.root;
|
|
4385
|
+
t && this.state.options.layoutId && (t.scroll = void 0, t.updateScroll?.());
|
|
4386
|
+
}
|
|
4387
|
+
};
|
|
4388
|
+
const ec = {
|
|
4389
|
+
renderer: Ml,
|
|
4390
|
+
features: [
|
|
4391
|
+
Cl,
|
|
4392
|
+
El,
|
|
4393
|
+
Rl,
|
|
4394
|
+
kl,
|
|
4395
|
+
Bl,
|
|
4396
|
+
Fl,
|
|
4397
|
+
jl,
|
|
4398
|
+
Ul,
|
|
4399
|
+
Zl,
|
|
4400
|
+
Jl
|
|
4401
|
+
]
|
|
4402
|
+
};
|
|
4403
|
+
export {
|
|
4404
|
+
ec as default
|
|
4405
|
+
};
|