@cuemath/leap 3.2.24-mb → 3.2.25-m

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.
@@ -0,0 +1,129 @@
1
+ import { jsxs as w, jsx as l } from "react/jsx-runtime";
2
+ import { useEffect as e } from "react";
3
+ import x, { keyframes as A, css as I } from "styled-components";
4
+ import T from "../../assets/line-icons/icons/cross.js";
5
+ import W from "../ui/layout/flex-view.js";
6
+ import k from "../ui/text/text.js";
7
+ const C = ({ $position: r, $verticalDist: o }) => A`
8
+ ${(r === "top-right" || r === "top-left") && `
9
+ 0% {
10
+ top: 0;
11
+ }
12
+ 100% {
13
+ top: ${o}px;
14
+ }
15
+ `};
16
+ ${(r === "bottom-left" || r === "bottom-right") && `
17
+ 0% {
18
+ bottom: 0;
19
+ }
20
+ 100% {
21
+ bottom: ${o}px;
22
+ }
23
+ `};
24
+ `, E = ({ $position: r, $verticalDist: o, $horizontalDist: t }) => I`
25
+ ${r === "top-right" && `
26
+ top: ${o}px;
27
+ right: ${t}px;
28
+ `};
29
+ ${r === "top-left" && `
30
+ top: ${o}px;
31
+ left: ${t}px;
32
+ `};
33
+ ${r === "bottom-left" && `
34
+ bottom: ${o}px;
35
+ left: ${t}px;
36
+ `};
37
+ ${r === "bottom-right" && `
38
+ bottom: ${o}px;
39
+ right: ${t}px;
40
+ `};
41
+ `, m = x.div`
42
+ position: fixed;
43
+ width: 310px;
44
+ padding: ${({ $gap: r, $gutter: o }) => `${r}px ${o}px`};
45
+ box-shadow: 0px 4px 8px 4px rgba(0, 0, 0, 0.05);
46
+ border-radius: 16px;
47
+ ${E};
48
+ animation: ${C} 0.5s ease-in;
49
+ z-index: 105;
50
+ background: ${({ $notificationTheme: r, theme: o }) => {
51
+ var t, p;
52
+ return r === "white" ? (t = o == null ? void 0 : o.colors) == null ? void 0 : t.WHITE : (p = o == null ? void 0 : o.colors) == null ? void 0 : p.BLACK;
53
+ }};
54
+ color: ${({ $notificationTheme: r, theme: o }) => {
55
+ var t, p;
56
+ return r === "white" ? (t = o == null ? void 0 : o.colors) == null ? void 0 : t.BLACK : (p = o == null ? void 0 : o.colors) == null ? void 0 : p.WHITE;
57
+ }};
58
+ `, B = x.div`
59
+ width: 48px;
60
+ height: 48px;
61
+ background: ${({ $src: r }) => `url(${r})`};
62
+ border-radius: 50%;
63
+ border: 2px solid #ffffff;
64
+ position: absolute;
65
+ bottom: 88%;
66
+ `, H = x(W)`
67
+ position: absolute;
68
+ top: -40px;
69
+ right: 0;
70
+ cursor: pointer;
71
+ `, K = x(k)`
72
+ white-space: pre-wrap;
73
+ `, L = ({
74
+ avatarUrl: r = null,
75
+ Component: o = null,
76
+ componentProps: t = {},
77
+ duration: p = null,
78
+ gap: f = 24,
79
+ gutter: u = 16,
80
+ hideNotification: c = () => null,
81
+ horizontalDist: $ = 50,
82
+ notificationTheme: s = "black",
83
+ position: i = "bottom-right",
84
+ showCloseIcon: b = !1,
85
+ text: d = null,
86
+ verticalDist: a = 60,
87
+ visible: n = !1
88
+ }) => (e(() => {
89
+ if (p && n) {
90
+ const g = setTimeout(() => {
91
+ c();
92
+ }, p * 1e3);
93
+ return () => {
94
+ clearTimeout(g);
95
+ };
96
+ }
97
+ return () => {
98
+ };
99
+ }, [p, c, n]), n ? /* @__PURE__ */ w(
100
+ m,
101
+ {
102
+ $gap: f,
103
+ $gutter: u,
104
+ $horizontalDist: $,
105
+ $notificationTheme: s,
106
+ $position: i,
107
+ $verticalDist: a,
108
+ children: [
109
+ b && /* @__PURE__ */ l(
110
+ H,
111
+ {
112
+ onClick: c,
113
+ $background: s === "white" ? "WHITE" : "BLACK",
114
+ $borderRadiusX: 10,
115
+ $gutter: 2,
116
+ $gap: 2,
117
+ children: /* @__PURE__ */ l(T, { color: s === "white" ? "BLACK" : "WHITE" })
118
+ }
119
+ ),
120
+ r && /* @__PURE__ */ l(B, { $src: r }),
121
+ d && /* @__PURE__ */ l(K, { $renderAs: "ub3", $color: s === "white" ? "BLACK" : "WHITE", children: d }),
122
+ o && /* @__PURE__ */ l(o, { ...t })
123
+ ]
124
+ }
125
+ ) : null), V = L;
126
+ export {
127
+ V as default
128
+ };
129
+ //# sourceMappingURL=notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.js","sources":["../../../src/features/notification/notification.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport styled, { keyframes, css } from 'styled-components';\n\nimport CrossIcon from '../../assets/line-icons/icons/cross';\nimport FlexView from '../ui/layout/flex-view';\nimport Text from '../ui/text/text';\n\ntype Position = 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right';\ntype NotificationTheme = 'white' | 'black';\n\ninterface SlideProps {\n $position: Position;\n $verticalDist: number;\n}\n\ninterface PositionProps {\n $position: Position;\n $verticalDist: number;\n $horizontalDist: number;\n}\n\ninterface WrapperProps extends PositionProps {\n $gap: number;\n $gutter: number;\n $notificationTheme: NotificationTheme;\n}\n\ninterface AvatarWrapperProps {\n $src: string;\n}\n\ninterface NotificationProps {\n avatarUrl?: string | null;\n Component?: React.ComponentType<Record<string, unknown>> | null;\n componentProps?: Record<string, unknown>;\n duration?: number | null;\n gap?: number;\n gutter?: number;\n hideNotification?: () => void;\n horizontalDist?: number;\n notificationTheme?: NotificationTheme;\n position?: Position;\n showCloseIcon?: boolean;\n text?: string | null;\n verticalDist?: number;\n visible?: boolean;\n}\n\nconst slide = ({ $position, $verticalDist }: SlideProps) => keyframes`\n ${\n ($position === 'top-right' || $position === 'top-left') &&\n `\n 0% {\n top: 0;\n }\n 100% {\n top: ${$verticalDist}px;\n }\n `\n };\n ${\n ($position === 'bottom-left' || $position === 'bottom-right') &&\n `\n 0% {\n bottom: 0;\n }\n 100% {\n bottom: ${$verticalDist}px;\n }\n `\n };\n`;\n\nconst notificationPostion = ({ $position, $verticalDist, $horizontalDist }: PositionProps) => css`\n ${$position === 'top-right' &&\n `\n top: ${$verticalDist}px;\n right: ${$horizontalDist}px;\n `};\n ${$position === 'top-left' &&\n `\n\ttop: ${$verticalDist}px;\n left: ${$horizontalDist}px;\n `};\n ${$position === 'bottom-left' &&\n `\n bottom: ${$verticalDist}px;\n left: ${$horizontalDist}px;\n `};\n ${$position === 'bottom-right' &&\n `\n bottom: ${$verticalDist}px;\n right: ${$horizontalDist}px;\n `};\n`;\n\nconst Wrapper = styled.div<WrapperProps>`\n position: fixed;\n width: 310px;\n padding: ${({ $gap, $gutter }) => `${$gap}px ${$gutter}px`};\n box-shadow: 0px 4px 8px 4px rgba(0, 0, 0, 0.05);\n border-radius: 16px;\n ${notificationPostion};\n animation: ${slide} 0.5s ease-in;\n z-index: 105;\n background: ${({ $notificationTheme, theme }) =>\n $notificationTheme === 'white' ? theme?.colors?.WHITE : theme?.colors?.BLACK};\n color: ${({ $notificationTheme, theme }) =>\n $notificationTheme === 'white' ? theme?.colors?.BLACK : theme?.colors?.WHITE};\n`;\n\nconst AvatarWrapper = styled.div<AvatarWrapperProps>`\n width: 48px;\n height: 48px;\n background: ${({ $src }) => `url(${$src})`};\n border-radius: 50%;\n border: 2px solid #ffffff;\n position: absolute;\n bottom: 88%;\n`;\n\nconst StyledIcon = styled(FlexView)`\n position: absolute;\n top: -40px;\n right: 0;\n cursor: pointer;\n`;\n\nconst StyledText = styled(Text)`\n white-space: pre-wrap;\n`;\n\nconst Notification: React.FC<NotificationProps> = ({\n avatarUrl = null,\n Component = null,\n componentProps = {},\n duration = null,\n gap = 24,\n gutter = 16,\n hideNotification = () => null,\n horizontalDist = 50,\n notificationTheme = 'black',\n position = 'bottom-right',\n showCloseIcon = false,\n text = null,\n verticalDist = 60,\n visible = false,\n}) => {\n useEffect(() => {\n if (duration && visible) {\n const countdown = setTimeout(() => {\n hideNotification();\n }, duration * 1000);\n\n return () => {\n clearTimeout(countdown);\n };\n }\n\n return () => {};\n }, [duration, hideNotification, visible]);\n\n if (!visible) return null;\n\n return (\n <Wrapper\n $gap={gap}\n $gutter={gutter}\n $horizontalDist={horizontalDist}\n $notificationTheme={notificationTheme}\n $position={position}\n $verticalDist={verticalDist}\n >\n {showCloseIcon && (\n <StyledIcon\n onClick={hideNotification}\n $background={notificationTheme === 'white' ? 'WHITE' : 'BLACK'}\n $borderRadiusX={10}\n $gutter={2}\n $gap={2}\n >\n <CrossIcon color={notificationTheme === 'white' ? 'BLACK' : 'WHITE'} />\n </StyledIcon>\n )}\n {avatarUrl && <AvatarWrapper $src={avatarUrl} />}\n {text && (\n <StyledText $renderAs=\"ub3\" $color={notificationTheme === 'white' ? 'BLACK' : 'WHITE'}>\n {text}\n </StyledText>\n )}\n {Component && <Component {...componentProps} />}\n </Wrapper>\n );\n};\n\nexport default Notification;\n"],"names":["slide","$position","$verticalDist","keyframes","notificationPostion","$horizontalDist","css","Wrapper","styled","$gap","$gutter","$notificationTheme","theme","_a","_b","AvatarWrapper","$src","StyledIcon","FlexView","StyledText","Text","Notification","avatarUrl","Component","componentProps","duration","gap","gutter","hideNotification","horizontalDist","notificationTheme","position","showCloseIcon","text","verticalDist","visible","useEffect","countdown","jsxs","jsx","CrossIcon","Notification$1"],"mappings":";;;;;;AAgDA,MAAMA,IAAQ,CAAC,EAAE,WAAAC,GAAW,eAAAC,QAAgCC;AAAA,KAEvDF,MAAc,eAAeA,MAAc,eAC5C;AAAA;AAAA;AAAA;AAAA;AAAA,eAKWC,CAAa;AAAA;AAAA,GAG1B;AAAA,KAEGD,MAAc,iBAAiBA,MAAc,mBAC9C;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKcC,CAAa;AAAA;AAAA,GAG7B;AAAA,GAGIE,IAAsB,CAAC,EAAE,WAAAH,GAAW,eAAAC,GAAe,iBAAAG,QAAqCC;AAAA,IAC1FL,MAAc,eAChB;AAAA,WACSC,CAAa;AAAA,aACXG,CAAe;AAAA,GACzB;AAAA,IACCJ,MAAc,cAChB;AAAA,QACMC,CAAa;AAAA,YACTG,CAAe;AAAA,GACxB;AAAA,IACCJ,MAAc,iBAChB;AAAA,cACYC,CAAa;AAAA,YACfG,CAAe;AAAA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,EAChB,MAAAC,IAAO;AAAA,EACP,cAAAC,IAAe;AAAA,EACf,SAAAC,IAAU;AACZ,OACEC,EAAU,MAAM;AACd,MAAIX,KAAYU,GAAS;AACjB,UAAAE,IAAY,WAAW,MAAM;AAChB,MAAAT;IAAA,GAChBH,IAAW,GAAI;AAElB,WAAO,MAAM;AACX,mBAAaY,CAAS;AAAA,IAAA;AAAA,EAE1B;AAEA,SAAO,MAAM;AAAA,EAAA;AACZ,GAAA,CAACZ,GAAUG,GAAkBO,CAAO,CAAC,GAEnCA,IAGH,gBAAAG;AAAA,EAAC/B;AAAA,EAAA;AAAA,IACC,MAAMmB;AAAA,IACN,SAASC;AAAA,IACT,iBAAiBE;AAAA,IACjB,oBAAoBC;AAAA,IACpB,WAAWC;AAAA,IACX,eAAeG;AAAA,IAEd,UAAA;AAAA,MACCF,KAAA,gBAAAO;AAAA,QAACtB;AAAA,QAAA;AAAA,UACC,SAASW;AAAA,UACT,aAAaE,MAAsB,UAAU,UAAU;AAAA,UACvD,gBAAgB;AAAA,UAChB,SAAS;AAAA,UACT,MAAM;AAAA,UAEN,4BAACU,GAAU,EAAA,OAAOV,MAAsB,UAAU,UAAU,SAAS;AAAA,QAAA;AAAA,MACvE;AAAA,MAEDR,KAAa,gBAAAiB,EAACxB,GAAc,EAAA,MAAMO,EAAW,CAAA;AAAA,MAC7CW,KACE,gBAAAM,EAAApB,GAAA,EAAW,WAAU,OAAM,QAAQW,MAAsB,UAAU,UAAU,SAC3E,UACHG,EAAA,CAAA;AAAA,MAEDV,KAAa,gBAAAgB,EAAChB,GAAW,EAAA,GAAGC,EAAgB,CAAA;AAAA,IAAA;AAAA,EAAA;AAAA,IA5B5B,OAiCvBiB,IAAepB;"}
@@ -1,13 +1,19 @@
1
1
  const o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2
- async function s(e) {
3
- if (o.has(e))
4
- return o.get(e);
5
- if (n.has(e))
6
- return n.get(e);
7
- const r = fetch(e).then((t) => t.ok ? t.json() : null).then((t) => (t && o.set(e, t), n.delete(e), t)).catch((t) => (console.error("Lottie preload error:", t), n.delete(e), null));
8
- return n.set(e, r), r;
2
+ async function r(t) {
3
+ if (o.has(t))
4
+ return o.get(t);
5
+ if (n.has(t))
6
+ return n.get(t);
7
+ const i = fetch(t).then(async (e) => {
8
+ if (!e.ok) return null;
9
+ const a = t.endsWith(".lottie") ? await e.arrayBuffer() : await e.json();
10
+ return o.set(t, a), a;
11
+ }).catch((e) => (console.error("Lottie preload error:", e), null)).finally(() => {
12
+ n.delete(t);
13
+ });
14
+ return n.set(t, i), i;
9
15
  }
10
16
  export {
11
- s as preloadLottieFile
17
+ r as preloadLottieFile
12
18
  };
13
19
  //# sourceMappingURL=stickers-cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stickers-cache.js","sources":["../../../../src/features/stickers/stickers-effects/stickers-cache.ts"],"sourcesContent":["const lottieCache = new Map<string, object>();\nconst lottiePromises = new Map<string, Promise<object | null>>();\n\nexport async function preloadLottieFile(url: string): Promise<object | null> {\n if (lottieCache.has(url)) {\n return lottieCache.get(url)!;\n }\n\n if (lottiePromises.has(url)) {\n return lottiePromises.get(url)!;\n }\n\n const fetchPromise = fetch(url)\n .then(res => (res.ok ? res.json() : null))\n .then(data => {\n if (data) lottieCache.set(url, data);\n lottiePromises.delete(url);\n\n return data;\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.error('Lottie preload error:', err);\n lottiePromises.delete(url);\n\n return null;\n });\n\n lottiePromises.set(url, fetchPromise);\n\n return fetchPromise;\n}\n"],"names":["lottieCache","lottiePromises","preloadLottieFile","url","fetchPromise","res","data","err"],"mappings":"AAAA,MAAMA,wBAAkB,OAClBC,wBAAqB;AAE3B,eAAsBC,EAAkBC,GAAqC;AACvE,MAAAH,EAAY,IAAIG,CAAG;AACd,WAAAH,EAAY,IAAIG,CAAG;AAGxB,MAAAF,EAAe,IAAIE,CAAG;AACjB,WAAAF,EAAe,IAAIE,CAAG;AAG/B,QAAMC,IAAe,MAAMD,CAAG,EAC3B,KAAK,CAAQE,MAAAA,EAAI,KAAKA,EAAI,KAAK,IAAI,IAAK,EACxC,KAAK,CAAQC,OACRA,KAAMN,EAAY,IAAIG,GAAKG,CAAI,GACnCL,EAAe,OAAOE,CAAG,GAElBG,EACR,EACA,MAAM,CAAOC,OAEJ,QAAA,MAAM,yBAAyBA,CAAG,GAC1CN,EAAe,OAAOE,CAAG,GAElB,KACR;AAEY,SAAAF,EAAA,IAAIE,GAAKC,CAAY,GAE7BA;AACT;"}
1
+ {"version":3,"file":"stickers-cache.js","sources":["../../../../src/features/stickers/stickers-effects/stickers-cache.ts"],"sourcesContent":["import type { Data } from '@lottiefiles/dotlottie-web';\n\nconst lottieCache = new Map<string, Data>();\nconst lottiePromises = new Map<string, Promise<Data | null>>();\n\nexport async function preloadLottieFile(url: string): Promise<Data | null> {\n if (lottieCache.has(url)) {\n return lottieCache.get(url)!;\n }\n\n if (lottiePromises.has(url)) {\n return lottiePromises.get(url)!;\n }\n\n const fetchPromise = fetch(url)\n .then(async res => {\n if (!res.ok) return null;\n\n const isLottieFile = url.endsWith('.lottie');\n const data = isLottieFile ? await res.arrayBuffer() : await res.json();\n\n lottieCache.set(url, data);\n\n return data;\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.error('Lottie preload error:', err);\n\n return null;\n })\n .finally(() => {\n lottiePromises.delete(url);\n });\n\n lottiePromises.set(url, fetchPromise);\n\n return fetchPromise;\n}\n"],"names":["lottieCache","lottiePromises","preloadLottieFile","url","fetchPromise","res","data","err"],"mappings":"AAEA,MAAMA,wBAAkB,OAClBC,wBAAqB;AAE3B,eAAsBC,EAAkBC,GAAmC;AACrE,MAAAH,EAAY,IAAIG,CAAG;AACd,WAAAH,EAAY,IAAIG,CAAG;AAGxB,MAAAF,EAAe,IAAIE,CAAG;AACjB,WAAAF,EAAe,IAAIE,CAAG;AAG/B,QAAMC,IAAe,MAAMD,CAAG,EAC3B,KAAK,OAAME,MAAO;AACb,QAAA,CAACA,EAAI,GAAW,QAAA;AAGd,UAAAC,IADeH,EAAI,SAAS,SAAS,IACf,MAAME,EAAI,gBAAgB,MAAMA,EAAI;AAEpD,WAAAL,EAAA,IAAIG,GAAKG,CAAI,GAElBA;AAAA,EAAA,CACR,EACA,MAAM,CAAOC,OAEJ,QAAA,MAAM,yBAAyBA,CAAG,GAEnC,KACR,EACA,QAAQ,MAAM;AACb,IAAAN,EAAe,OAAOE,CAAG;AAAA,EAAA,CAC1B;AAEY,SAAAF,EAAA,IAAIE,GAAKC,CAAY,GAE7BA;AACT;"}
@@ -1,27 +1,27 @@
1
- import { jsx as c, Fragment as E } from "react/jsx-runtime";
2
- import { memo as u, useState as f, useEffect as h } from "react";
3
- import F from "../../ui/lottie-animation/lottie-animation.js";
1
+ import { jsx as s, Fragment as E } from "react/jsx-runtime";
2
+ import { memo as u, useState as f, useEffect as d } from "react";
3
+ import F from "../../ui/dot-lottie-animations/dot-lottie-animation.js";
4
4
  import { preloadLottieFile as g } from "./stickers-cache.js";
5
5
  import { generateStickerData as z } from "./stickers-effects-helper.js";
6
6
  import { Container as L, Sticker as T } from "./stickers-effects-styled.js";
7
- const $ = u(({ url: t, sticker: o, size: s }) => {
7
+ const $ = u(({ url: t, sticker: o, size: a }) => {
8
8
  const [i, m] = f(), [n, e] = f(!1);
9
- return h(() => {
9
+ return d(() => {
10
10
  let r = !0;
11
11
  if (t)
12
- return g(t).then((a) => {
13
- r && (a ? m(a) : e(!0));
12
+ return g(t).then((c) => {
13
+ r && (c ? m(c) : e(!0));
14
14
  }).catch(() => {
15
15
  r && e(!0);
16
16
  }), () => {
17
17
  r = !1;
18
18
  };
19
- }, [t]), !t || n || !i ? /* @__PURE__ */ c(E, { children: o }) : /* @__PURE__ */ c(F, { src: i, width: s, height: s, onError: () => e(!0) });
20
- }), b = ({ stickers: t, effect: o, count: s, duration: i }) => {
19
+ }, [t]), !t || n || !i ? /* @__PURE__ */ s(E, { children: o }) : /* @__PURE__ */ s(F, { data: i, width: a, height: a, onError: () => e(!0) });
20
+ }), b = ({ stickers: t, effect: o, count: a, duration: i }) => {
21
21
  const [m, n] = f([]);
22
- return h(() => {
22
+ return d(() => {
23
23
  const e = z({
24
- count: s,
24
+ count: a,
25
25
  effect: o,
26
26
  stickers: t,
27
27
  minSize: 32,
@@ -30,21 +30,21 @@ const $ = u(({ url: t, sticker: o, size: s }) => {
30
30
  n(e);
31
31
  const r = setTimeout(() => n([]), i);
32
32
  return () => clearTimeout(r);
33
- }, [t, o, s, i]), /* @__PURE__ */ c(L, { children: m.map((e, r) => {
34
- const { id: a, sticker: k, lottie: p, x: S, y: d, size: l, fromX: x, fromY: D } = e;
35
- return /* @__PURE__ */ c(
33
+ }, [t, o, a, i]), /* @__PURE__ */ s(L, { children: m.map((e, r) => {
34
+ const { id: c, sticker: h, lottie: k, x: p, y: S, size: l, fromX: D, fromY: x } = e;
35
+ return /* @__PURE__ */ s(
36
36
  T,
37
37
  {
38
38
  effect: o,
39
39
  duration: i,
40
- fromX: x,
41
- fromY: D,
42
- x: S,
43
- y: d,
40
+ fromX: D,
41
+ fromY: x,
42
+ x: p,
43
+ y: S,
44
44
  size: l,
45
- children: /* @__PURE__ */ c($, { url: p, sticker: k, size: l })
45
+ children: /* @__PURE__ */ s($, { url: k, sticker: h, size: l })
46
46
  },
47
- `${a}-${r}`
47
+ `${c}-${r}`
48
48
  );
49
49
  }) });
50
50
  }, W = u(b);
@@ -1 +1 @@
1
- {"version":3,"file":"stickers-effects.js","sources":["../../../../src/features/stickers/stickers-effects/stickers-effects.tsx"],"sourcesContent":["import type { TStickerData, IStickersProps } from './stickers-effects-types';\n\nimport React, { memo, useEffect, useState } from 'react';\n\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { preloadLottieFile } from './stickers-cache';\nimport { generateStickerData } from './stickers-effects-helper';\nimport * as S from './stickers-effects-styled';\n\nconst StickerWithFallback: React.FC<{\n url?: string;\n sticker: string;\n size: number;\n}> = memo(({ url, sticker, size }) => {\n const [src, setSrc] = useState<string | object | undefined>();\n const [failed, setFailed] = useState(false);\n\n useEffect(() => {\n let isMounted = true;\n\n if (!url) return;\n\n preloadLottieFile(url)\n .then(result => {\n if (isMounted) {\n if (result) {\n setSrc(result);\n } else {\n setFailed(true);\n }\n }\n })\n .catch(() => {\n if (isMounted) setFailed(true);\n });\n\n return () => {\n isMounted = false;\n };\n }, [url]);\n\n if (!url || failed || !src) {\n return <>{sticker}</>;\n }\n\n return <LottieAnimation src={src} width={size} height={size} onError={() => setFailed(true)} />;\n});\n\nconst StickersEffects: React.FC<IStickersProps> = ({ stickers, effect, count, duration }) => {\n const [stickersData, setStickersData] = useState<ReturnType<typeof generateStickerData>>([]);\n\n useEffect(() => {\n const stickerData = generateStickerData({\n count,\n effect,\n stickers,\n minSize: 32,\n maxSize: 48,\n });\n\n setStickersData(stickerData);\n\n const timeout = setTimeout(() => setStickersData([]), duration);\n\n return () => clearTimeout(timeout);\n }, [stickers, effect, count, duration]);\n\n return (\n <S.Container>\n {stickersData.map((data: TStickerData, i) => {\n const { id, sticker, lottie, x, y, size, fromX, fromY } = data;\n\n return (\n <S.Sticker\n key={`${id}-${i}`}\n effect={effect}\n duration={duration}\n fromX={fromX}\n fromY={fromY}\n x={x}\n y={y}\n size={size}\n >\n <StickerWithFallback url={lottie} sticker={sticker} size={size} />\n </S.Sticker>\n );\n })}\n </S.Container>\n );\n};\n\nexport default memo(StickersEffects);\n"],"names":["StickerWithFallback","memo","url","sticker","size","src","setSrc","useState","failed","setFailed","useEffect","isMounted","preloadLottieFile","result","jsx","LottieAnimation","StickersEffects","stickers","effect","count","duration","stickersData","setStickersData","stickerData","generateStickerData","timeout","S.Container","data","i","id","lottie","x","y","fromX","fromY","S.Sticker","stickersEffects"],"mappings":";;;;;;AASA,MAAMA,IAIDC,EAAK,CAAC,EAAE,KAAAC,GAAK,SAAAC,GAAS,MAAAC,QAAW;AACpC,QAAM,CAACC,GAAKC,CAAM,IAAIC,EAAsC,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GxD,WAAA,gBAAAb;AAAA,MAACqB;AAAAA,MAAA;AAAA,QAEC,QAAAjB;AAAA,QACA,UAAAE;AAAA,QACA,OAAAa;AAAA,QACA,OAAAC;AAAA,QACA,GAAAH;AAAA,QACA,GAAAC;AAAA,QACA,MAAA5B;AAAA,QAEA,UAAC,gBAAAU,EAAAd,GAAA,EAAoB,KAAK8B,GAAQ,SAAA3B,GAAkB,MAAAC,GAAY;AAAA,MAAA;AAAA,MAT3D,GAAGyB,CAAE,IAAID,CAAC;AAAA,IAAA;AAAA,EAYpB,CAAA,EACH,CAAA;AAEJ,GAEeQ,IAAAnC,EAAKe,CAAe;"}
1
+ {"version":3,"file":"stickers-effects.js","sources":["../../../../src/features/stickers/stickers-effects/stickers-effects.tsx"],"sourcesContent":["import type { TStickerData, IStickersProps } from './stickers-effects-types';\nimport type { Data } from '@lottiefiles/dotlottie-web';\n\nimport React, { memo, useEffect, useState } from 'react';\n\nimport DotLottieAnimation from '../../ui/dot-lottie-animations/dot-lottie-animation';\nimport { preloadLottieFile } from './stickers-cache';\nimport { generateStickerData } from './stickers-effects-helper';\nimport * as S from './stickers-effects-styled';\n\nconst StickerWithFallback: React.FC<{\n url?: string;\n sticker: string;\n size: number;\n}> = memo(({ url, sticker, size }) => {\n const [data, setData] = useState<Data>();\n const [failed, setFailed] = useState(false);\n\n useEffect(() => {\n let isMounted = true;\n\n if (!url) return;\n\n preloadLottieFile(url)\n .then(result => {\n if (isMounted) {\n if (result) {\n setData(result);\n } else {\n setFailed(true);\n }\n }\n })\n .catch(() => {\n if (isMounted) setFailed(true);\n });\n\n return () => {\n isMounted = false;\n };\n }, [url]);\n\n if (!url || failed || !data) {\n return <>{sticker}</>;\n }\n\n return (\n <DotLottieAnimation data={data} width={size} height={size} onError={() => setFailed(true)} />\n );\n});\n\nconst StickersEffects: React.FC<IStickersProps> = ({ stickers, effect, count, duration }) => {\n const [stickersData, setStickersData] = useState<ReturnType<typeof generateStickerData>>([]);\n\n useEffect(() => {\n const stickerData = generateStickerData({\n count,\n effect,\n stickers,\n minSize: 32,\n maxSize: 48,\n });\n\n setStickersData(stickerData);\n\n const timeout = setTimeout(() => setStickersData([]), duration);\n\n return () => clearTimeout(timeout);\n }, [stickers, effect, count, duration]);\n\n return (\n <S.Container>\n {stickersData.map((data: TStickerData, i) => {\n const { id, sticker, lottie, x, y, size, fromX, fromY } = data;\n\n return (\n <S.Sticker\n key={`${id}-${i}`}\n effect={effect}\n duration={duration}\n fromX={fromX}\n fromY={fromY}\n x={x}\n y={y}\n size={size}\n >\n <StickerWithFallback url={lottie} sticker={sticker} size={size} />\n </S.Sticker>\n );\n })}\n </S.Container>\n );\n};\n\nexport default memo(StickersEffects);\n"],"names":["StickerWithFallback","memo","url","sticker","size","data","setData","useState","failed","setFailed","useEffect","isMounted","preloadLottieFile","result","jsx","DotLottieAnimation","StickersEffects","stickers","effect","count","duration","stickersData","setStickersData","stickerData","generateStickerData","timeout","S.Container","i","id","lottie","x","y","fromX","fromY","S.Sticker","stickersEffects"],"mappings":";;;;;;AAUA,MAAMA,IAIDC,EAAK,CAAC,EAAE,KAAAC,GAAK,SAAAC,GAAS,MAAAC,QAAW;AACpC,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAe,GACjC,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK;AA0B1C,SAxBAG,EAAU,MAAM;AACd,QAAIC,IAAY;AAEhB,QAAKT;AAEa,aAAAU,EAAAV,CAAG,EAClB,KAAK,CAAUW,MAAA;AACd,QAAIF,MACEE,IACFP,EAAQO,CAAM,IAEdJ,EAAU,EAAI;AAAA,MAElB,CACD,EACA,MAAM,MAAM;AACP,QAAAE,OAAqB,EAAI;AAAA,MAAA,CAC9B,GAEI,MAAM;AACC,QAAAA,IAAA;AAAA,MAAA;AAAA,EACd,GACC,CAACT,CAAG,CAAC,GAEJ,CAACA,KAAOM,KAAU,CAACH,2BACX,UAAQF,EAAA,CAAA,IAIlB,gBAAAW,EAACC,GAAmB,EAAA,MA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${({ $renderWidth: o }) => typeof o == "number" ? `width: ${o}px;` : `width: ${o};`}
4
+ ${({ $renderHeight: o }) => typeof o == "number" ? `height: ${o}px;` : `height: ${o};`}
5
+ `;
6
+ export {
7
+ a as Canvas
8
+ };
9
+ //# sourceMappingURL=dot-lottie-animation-styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot-lottie-animation-styled.js","sources":["../../../../src/features/ui/dot-lottie-animations/dot-lottie-animation-styled.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const Canvas = styled.canvas<{\n $renderWidth: string | number;\n $renderHeight: string | number;\n}>`\n ${({ $renderWidth }) =>\n typeof $renderWidth === 'number' ? `width: ${$renderWidth}px;` : `width: ${$renderWidth};`}\n ${({ $renderHeight }) =>\n typeof $renderHeight === 'number' ? `height: ${$renderHeight}px;` : `height: ${$renderHeight};`}\n`;\n"],"names":["Canvas","styled","$renderWidth","$renderHeight"],"mappings":";AAEO,MAAMA,IAASC,EAAO;AAAA,IAIzB,CAAC,EAAE,cAAAC,EAAa,MAChB,OAAOA,KAAiB,WAAW,UAAUA,CAAY,QAAQ,UAAUA,CAAY,GAAG;AAAA,IAC1F,CAAC,EAAE,eAAAC,EAAc,MACjB,OAAOA,KAAkB,WAAW,WAAWA,CAAa,QAAQ,WAAWA,CAAa,GAAG;AAAA;"}
@@ -0,0 +1,93 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { DotLottieWorker as v } from "../../../node_modules/@lottiefiles/dotlottie-web/dist/index.js";
3
+ import { memo as w, forwardRef as x, useRef as p, useImperativeHandle as A, useEffect as h } from "react";
4
+ import R from "../layout/flex-view.js";
5
+ import { Canvas as $ } from "./dot-lottie-animation-styled.js";
6
+ const E = x(
7
+ (y, g) => {
8
+ const {
9
+ src: s,
10
+ data: f,
11
+ width: i = "100%",
12
+ height: a = "100%",
13
+ settings: l,
14
+ eventListeners: o,
15
+ onRender: u,
16
+ onError: c
17
+ } = y, m = p(null), t = p(null);
18
+ return A(
19
+ g,
20
+ () => ({
21
+ play: () => {
22
+ var e;
23
+ (e = t.current) == null || e.play();
24
+ },
25
+ pause: () => {
26
+ var e;
27
+ (e = t.current) == null || e.pause();
28
+ },
29
+ playSegments: (e) => {
30
+ var r, n;
31
+ (r = t.current) == null || r.setSegment(e[0], e[1]), (n = t.current) == null || n.play();
32
+ },
33
+ setFrame: (e) => {
34
+ var r;
35
+ (r = t.current) == null || r.setFrame(e);
36
+ }
37
+ }),
38
+ []
39
+ ), h(() => {
40
+ if (!m.current) return;
41
+ let e = !1;
42
+ return (() => {
43
+ try {
44
+ t.current = new v({
45
+ src: s,
46
+ data: f,
47
+ canvas: m.current,
48
+ autoplay: !0,
49
+ loop: !1,
50
+ renderConfig: {
51
+ autoResize: !0,
52
+ devicePixelRatio: window.devicePixelRatio,
53
+ freezeOnOffscreen: !0
54
+ },
55
+ ...l
56
+ }), requestAnimationFrame(() => {
57
+ e || u == null || u();
58
+ });
59
+ } catch (n) {
60
+ console.log(n), c == null || c();
61
+ }
62
+ })(), () => {
63
+ e = !0, t.current && (t.current.destroy(), t.current = null);
64
+ };
65
+ }, [s, l, u, c, f]), h(() => (o == null || o.forEach(
66
+ ({ name: e, callback: r }) => {
67
+ var n;
68
+ return (n = t.current) == null ? void 0 : n.addEventListener(e, r);
69
+ }
70
+ ), () => {
71
+ o == null || o.forEach(
72
+ ({ name: e, callback: r }) => {
73
+ var n;
74
+ return (n = t.current) == null ? void 0 : n.removeEventListener(e, r);
75
+ }
76
+ );
77
+ }), [o]), /* @__PURE__ */ d(R, { $width: i, $height: a, children: /* @__PURE__ */ d(
78
+ $,
79
+ {
80
+ ref: m,
81
+ $renderWidth: i,
82
+ $renderHeight: a,
83
+ width: typeof i == "number" ? i : void 0,
84
+ height: typeof a == "number" ? a : void 0
85
+ },
86
+ s
87
+ ) });
88
+ }
89
+ ), C = w(E);
90
+ export {
91
+ C as default
92
+ };
93
+ //# sourceMappingURL=dot-lottie-animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot-lottie-animation.js","sources":["../../../../src/features/ui/dot-lottie-animations/dot-lottie-animation.tsx"],"sourcesContent":["import type {\n AnimationSegment,\n IDotLottieAnimationProps,\n IDotLottieAnimationRef,\n} from './dot-lottie-types';\n\nimport { DotLottieWorker } from '@lottiefiles/dotlottie-web';\nimport { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport * as Styled from './dot-lottie-animation-styled';\n\nconst DotLottieAnimation = forwardRef<IDotLottieAnimationRef, IDotLottieAnimationProps>(\n (props, ref) => {\n const {\n src,\n data,\n width = '100%',\n height = '100%',\n settings,\n eventListeners,\n onRender,\n onError,\n } = props;\n\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const animationInstance = useRef<DotLottieWorker | null>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n play: () => {\n animationInstance.current?.play();\n },\n pause: () => {\n animationInstance.current?.pause();\n },\n playSegments: (segments: AnimationSegment) => {\n animationInstance.current?.setSegment(segments[0], segments[1]);\n animationInstance.current?.play();\n },\n setFrame: (frame: number) => {\n animationInstance.current?.setFrame(frame);\n },\n }),\n [],\n );\n\n useEffect(() => {\n if (!canvasRef.current) return;\n\n let destroyed = false;\n\n const loadAnimation = () => {\n try {\n animationInstance.current = new DotLottieWorker({\n src,\n data,\n canvas: canvasRef.current!,\n autoplay: true,\n loop: false,\n renderConfig: {\n autoResize: true,\n devicePixelRatio: window.devicePixelRatio,\n freezeOnOffscreen: true,\n },\n ...settings,\n });\n\n requestAnimationFrame(() => {\n if (destroyed) return;\n onRender?.();\n });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(err);\n onError?.();\n }\n };\n\n loadAnimation();\n\n return () => {\n destroyed = true;\n if (animationInstance.current) {\n animationInstance.current.destroy();\n animationInstance.current = null;\n }\n };\n }, [src, settings, onRender, onError, data]);\n\n useEffect(() => {\n eventListeners?.forEach(\n ({ name, callback }) => animationInstance.current?.addEventListener(name, callback),\n );\n\n return () => {\n eventListeners?.forEach(\n ({ name, callback }) => animationInstance.current?.removeEventListener(name, callback),\n );\n };\n }, [eventListeners]);\n\n const isNumW = typeof width === 'number';\n const isNumH = typeof height === 'number';\n\n return (\n <FlexView $width={width} $height={height}>\n <Styled.Canvas\n key={src}\n ref={canvasRef}\n $renderWidth={width}\n $renderHeight={height}\n width={isNumW ? width : undefined}\n height={isNumH ? height : undefined}\n />\n </FlexView>\n );\n },\n);\n\nexport default memo(DotLottieAnimation);\n"],"names":["DotLottieAnimation","forwardRef","props","ref","src","data","width","height","settings","eventListeners","onRender","onError","canvasRef","useRef","animationInstance","useImperativeHandle","_a","segments","_b","frame","useEffect","destroyed","DotLottieWorker","err","name","callback","jsx","FlexView","Styled.Canvas","DotLottieAnimation$1","memo"],"mappings":";;;;;AAYA,MAAMA,IAAqBC;AAAA,EACzB,CAACC,GAAOC,MAAQ;AACR,UAAA;AAAA,MACJ,KAAAC;AAAA,MACA,MAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,QAAAC,IAAS;AAAA,MACT,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,UAAAC;AAAA,MACA,SAAAC;AAAA,IACE,IAAAT,GAEEU,IAAYC,EAA0B,IAAI,GAC1CC,IAAoBD,EAA+B,IAAI;AAE7D,WAAAE;AAAA,MACEZ;AAAA,MACA,OAAO;AAAA,QACL,MAAM,MAAM;;AACV,WAAAa,IAAAF,EAAkB,YAAlB,QAAAE,EAA2B;AAAA,QAC7B;AAAA,QACA,OAAO,MAAM;;AACX,WAAAA,IAAAF,EAAkB,YAAlB,QAAAE,EAA2B;AAAA,QAC7B;AAAA,QACA,cAAc,CAACC,MAA+B;;AAC5C,WAAAD,IAAAF,EAAkB,YAAlB,QAAAE,EAA2B,WAAWC,EAAS,CAAC,GAAGA,EAAS,CAAC,KAC7DC,IAAAJ,EAAkB,YAAlB,QAAAI,EAA2B;AAAA,QAC7B;AAAA,QACA,UAAU,CAACC,MAAkB;;AAC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GAAO,SAASC,GAChC,UAAA,gBAAAmB;AAAA,MAACE;AAAAA,MAAA;AAAA,QAEC,KAAKhB;AAAA,QACL,cAAcN;AAAA,QACd,eAAeC;AAAA,QACf,OAVS,OAAOD,KAAU,WAUVA,IAAQ;AAAA,QACxB,QAVS,OAAOC,KAAW,WAUVA,IAAS;AAAA,MAAA;AAAA,MALrBH;AAAA,IAOT,EAAA,CAAA;AAAA,EAEJ;AACF,GAEeyB,IAAAC,EAAK9B,CAAkB;"}
@@ -1,114 +1,124 @@
1
- import { jsxs as k, jsx as t } from "react/jsx-runtime";
2
- import { useMemo as W, useRef as T, useCallback as d } from "react";
3
- import X from "../../../../assets/line-icons/icons/cross.js";
4
- import H from "../../hooks/use-context-menu-click-handler.js";
5
- import q from "../base-input/base-input.js";
6
- import { Input as G } from "../text-input/text-input-styled.js";
7
- import { Container as J, OptionsContainer as K, OptionsWrapper as N, StyledChevronDownIcon as P, StyledDownIcon as Q } from "./base-select-input-styled.js";
8
- import U from "./select-option/select-option.js";
9
- import Y from "./select-section/select-section.js";
10
- const ae = (y) => {
1
+ import { jsxs as V, jsx as t } from "react/jsx-runtime";
2
+ import { useMemo as G, useRef as A, useCallback as d } from "react";
3
+ import J from "../../../../assets/line-icons/icons/cross.js";
4
+ import K from "../../hooks/use-context-menu-click-handler.js";
5
+ import N from "../base-input/base-input.js";
6
+ import { Input as P } from "../text-input/text-input-styled.js";
7
+ import { Container as Q, OptionsContainer as U, OptionsWrapper as Y, StyledChevronDownIcon as Z, StyledDownIcon as _ } from "./base-select-input-styled.js";
8
+ import ee from "./select-option/select-option.js";
9
+ import ne from "./select-section/select-section.js";
10
+ const he = (E) => {
11
11
  const {
12
- label: C,
13
- value: r,
12
+ label: b,
13
+ value: i,
14
14
  options: u,
15
15
  searchable: n = !1,
16
16
  searchText: g,
17
- onCloseWithoutSelection: V,
18
- onSearchTextChange: o,
19
- onChange: b,
17
+ onCloseWithoutSelection: L,
18
+ onSearchTextChange: r,
19
+ onChange: v,
20
20
  renderAs: h,
21
- width: A,
22
- widthX: E,
21
+ width: R,
22
+ widthX: j,
23
23
  disabled: p,
24
- willShowMessage: R,
25
- mandatory: j,
26
- size: v = "regular",
24
+ willShowMessage: z,
25
+ mandatory: B,
26
+ size: w = "regular",
27
27
  shape: m,
28
28
  theme: f = "light",
29
- isTransparent: w = !1,
29
+ isTransparent: S = !1,
30
30
  renderOptionsAs: $ = "list",
31
- errorMessage: z
32
- } = y, i = $ === "section-list" && u, s = $ === "list" && u, I = W(() => {
33
- var e, c;
31
+ errorMessage: D,
32
+ inputLabelOverrides: C
33
+ } = E, s = $ === "section-list" && u, l = $ === "list" && u, I = G(() => {
34
+ var e;
34
35
  if (n) return g;
35
- if (i)
36
- return (e = i.flatMap((l) => l.data).find(({ id: l }) => l === r)) == null ? void 0 : e.label;
37
- if (s) return (c = s.find((l) => l.id === r)) == null ? void 0 : c.label;
38
- }, [n, g, i, s, r]), S = T(null), x = T(null), { menuVisible: a, onMenuClick: B, hideMenu: M } = H(
39
- S,
36
+ if (s) {
37
+ let o, a;
38
+ for (const T of s) {
39
+ const y = T.data.find(({ id: q }) => q === i);
40
+ if (y) {
41
+ o = T, a = y;
42
+ break;
43
+ }
44
+ }
45
+ return o && C ? C(o, a) : (a == null ? void 0 : a.label) || "";
46
+ }
47
+ if (l) return (e = l.find((o) => o.id === i)) == null ? void 0 : e.label;
48
+ }, [n, g, s, l, C, i]), k = A(null), x = A(null), { menuVisible: c, onMenuClick: F, hideMenu: O } = K(
49
+ k,
40
50
  void 0,
41
51
  !n,
42
- V,
52
+ L,
43
53
  p
44
- ), D = d(
54
+ ), W = d(
45
55
  (e) => {
46
- n && o && o(e.target.value);
56
+ n && r && r(e.target.value);
47
57
  },
48
- [o, n]
49
- ), O = d(
50
- (e, c) => {
51
- M(), b(e, c);
58
+ [r, n]
59
+ ), M = d(
60
+ (e, o) => {
61
+ O(), v(e, o);
52
62
  },
53
- [M, b]
54
- ), F = d((e) => {
63
+ [O, v]
64
+ ), X = d((e) => {
55
65
  e.target.select(), setTimeout(() => {
56
66
  e.target.scrollIntoView({
57
67
  behavior: "smooth"
58
68
  });
59
69
  }, 300);
60
- }, []), L = d(() => {
70
+ }, []), H = d(() => {
61
71
  var e;
62
- o && (o(""), (e = x.current) == null || e.focus());
63
- }, [o]);
64
- return /* @__PURE__ */ k(J, { ref: S, $width: A, $widthX: E, onClick: B, children: [
72
+ r && (r(""), (e = x.current) == null || e.focus());
73
+ }, [r]);
74
+ return /* @__PURE__ */ V(Q, { ref: k, $width: R, $widthX: j, onClick: F, children: [
65
75
  /* @__PURE__ */ t(
66
- q,
76
+ N,
67
77
  {
68
78
  renderAs: h,
69
- label: C,
79
+ label: b,
70
80
  stickyLabel: !0,
71
81
  disabled: p,
72
- willShowMessage: R,
73
- size: v,
74
- mandatory: j,
82
+ willShowMessage: z,
83
+ size: w,
84
+ mandatory: B,
75
85
  shape: m,
76
- isTransparent: w,
86
+ isTransparent: S,
77
87
  inputElement: /* @__PURE__ */ t(
78
- G,
88
+ P,
79
89
  {
80
90
  ref: x,
81
91
  $renderAs: h,
82
- $size: v,
83
- placeholder: I ? "" : C,
92
+ $size: w,
93
+ placeholder: I ? "" : b,
84
94
  disabled: p,
85
95
  readOnly: !n,
86
96
  value: I ?? "",
87
- onFocus: n ? F : void 0,
88
- onChange: n ? D : void 0,
89
- $isTransparent: w
97
+ onFocus: n ? X : void 0,
98
+ onChange: n ? W : void 0,
99
+ $isTransparent: S
90
100
  }
91
101
  ),
92
- siblingElement: n && a ? /* @__PURE__ */ t(X, { onClick: L }) : m === "curved" || m === "borderLess" ? /* @__PURE__ */ t(P, { $menuVisible: a, pointerEvents: "none" }) : /* @__PURE__ */ t(Q, { $menuVisible: a, pointerEvents: "none" }),
93
- errorMessage: z
102
+ siblingElement: n && c ? /* @__PURE__ */ t(J, { onClick: H }) : m === "curved" || m === "borderLess" ? /* @__PURE__ */ t(Z, { $menuVisible: c, pointerEvents: "none" }) : /* @__PURE__ */ t(_, { $menuVisible: c, pointerEvents: "none" }),
103
+ errorMessage: D
94
104
  }
95
105
  ),
96
- u.length > 0 && /* @__PURE__ */ t(K, { $visible: a, children: /* @__PURE__ */ k(N, { $renderAs: h, $theme: f, children: [
97
- i && /* @__PURE__ */ t(
98
- Y,
106
+ u.length > 0 && /* @__PURE__ */ t(U, { $visible: c, children: /* @__PURE__ */ V(Y, { $renderAs: h, $theme: f, children: [
107
+ s && /* @__PURE__ */ t(
108
+ ne,
99
109
  {
100
- sectionOptions: i,
110
+ sectionOptions: s,
101
111
  theme: f,
102
- value: r,
103
- onChange: O
112
+ value: i,
113
+ onChange: M
104
114
  }
105
115
  ),
106
- s && s.map((e) => /* @__PURE__ */ t(
107
- U,
116
+ l && l.map((e) => /* @__PURE__ */ t(
117
+ ee,
108
118
  {
109
119
  option: e,
110
- selected: e.id === r,
111
- onChange: O,
120
+ selected: e.id === i,
121
+ onChange: M,
112
122
  theme: f
113
123
  },
114
124
  e.id
@@ -117,6 +127,6 @@ const ae = (y) => {
117
127
  ] });
118
128
  };
119
129
  export {
120
- ae as default
130
+ he as default
121
131
  };
122
132
  //# sourceMappingURL=base-select-input.js.map