asterui 0.10.2 → 0.11.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/README.md +12 -9
- package/dist/components/Segmented.d.ts +37 -0
- package/dist/components/Tour.d.ts +61 -0
- package/dist/hooks/useClickOutside.d.ts +17 -0
- package/dist/hooks/useClipboard.d.ts +20 -0
- package/dist/hooks/useDebounce.d.ts +18 -0
- package/dist/hooks/useDisclosure.d.ts +20 -0
- package/dist/hooks/useHover.d.ts +18 -0
- package/dist/hooks/useKeyPress.d.ts +40 -0
- package/dist/hooks/useLocalStorage.d.ts +12 -0
- package/dist/hooks/usePrevious.d.ts +15 -0
- package/dist/hooks/useWindowSize.d.ts +21 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +143 -120
- package/dist/index.js.map +1 -1
- package/dist/index100.js +5 -21
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +41 -23
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +2 -20
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +6 -99
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +149 -357
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +28 -23
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +28 -71
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +2 -16
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +71 -65
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +34 -139
- package/dist/index109.js.map +1 -1
- package/dist/index110.js +26 -2
- package/dist/index110.js.map +1 -1
- package/dist/index111.js +20 -55
- package/dist/index111.js.map +1 -1
- package/dist/index112.js +24 -2
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +20 -2
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +100 -2
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +360 -2
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +25 -2
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +73 -2
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +16 -2
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +66 -2
- package/dist/index119.js.map +1 -1
- package/dist/index120.js +140 -28
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +2 -2
- package/dist/index122.js +55 -7
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +2 -2
- package/dist/index124.js +2 -2
- package/dist/index125.js +2 -21
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +2 -2
- package/dist/index127.js +2 -24
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +2 -71
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +2 -21
- package/dist/index129.js.map +1 -1
- package/dist/index130.js +31 -33
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -70
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +8 -2
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +2 -22
- package/dist/index133.js.map +1 -1
- package/dist/index135.js +21 -2
- package/dist/index135.js.map +1 -1
- package/dist/index137.js +24 -2
- package/dist/index137.js.map +1 -1
- package/dist/index138.js +70 -3
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +24 -0
- package/dist/index139.js.map +1 -0
- package/dist/index14.js +1 -1
- package/dist/index140.js +37 -0
- package/dist/index140.js.map +1 -0
- package/dist/index141.js +73 -0
- package/dist/index141.js.map +1 -0
- package/dist/index142.js +5 -0
- package/dist/index142.js.map +1 -0
- package/dist/index143.js +5 -0
- package/dist/index143.js.map +1 -0
- package/dist/index144.js +25 -0
- package/dist/index144.js.map +1 -0
- package/dist/index145.js +5 -0
- package/dist/index145.js.map +1 -0
- package/dist/index146.js +5 -0
- package/dist/index146.js.map +1 -0
- package/dist/index147.js +5 -0
- package/dist/index147.js.map +1 -0
- package/dist/index148.js +5 -0
- package/dist/index148.js.map +1 -0
- package/dist/index149.js +7 -0
- package/dist/index149.js.map +1 -0
- package/dist/index59.js +1 -1
- package/dist/index66.js +66 -19
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +18 -43
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +44 -132
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +132 -50
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +51 -21
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +19 -19
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +20 -327
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +323 -50
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +56 -40
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +40 -95
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +88 -123
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +123 -154
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +159 -63
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +65 -35
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +35 -34
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +222 -198
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +34 -213
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +190 -275
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +202 -167
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +263 -226
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +176 -12
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +257 -32
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +13 -10792
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +33 -5
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +5 -41
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +14 -2
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +45 -6
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +11 -150
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +13 -28
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +7 -29
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +13 -2
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +30 -71
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +16 -37
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +10792 -25
- package/dist/index99.js.map +1 -1
- package/package.json +2 -2
package/dist/index149.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index149.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/dist/index59.js
CHANGED
package/dist/index66.js
CHANGED
|
@@ -1,24 +1,71 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as b, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useCallback as S, createContext as j, useContext as v } from "react";
|
|
3
|
+
const C = j(null), I = () => {
|
|
4
|
+
const e = v(C);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error("Segmented.Item must be used within a Segmented component");
|
|
7
|
+
return e;
|
|
8
|
+
}, V = {
|
|
9
|
+
xs: "btn-xs",
|
|
10
|
+
sm: "btn-sm",
|
|
11
|
+
md: "",
|
|
12
|
+
lg: "btn-lg"
|
|
13
|
+
}, k = ({
|
|
14
|
+
value: e,
|
|
15
|
+
disabled: o = !1,
|
|
16
|
+
icon: n,
|
|
17
|
+
children: l,
|
|
18
|
+
className: a = ""
|
|
11
19
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
const { value: i, onChange: d, size: r, disabled: c } = I(), s = i === e, t = c || o, m = () => {
|
|
21
|
+
t || d?.(e);
|
|
22
|
+
}, u = [
|
|
23
|
+
"join-item",
|
|
24
|
+
"btn",
|
|
25
|
+
V[r],
|
|
26
|
+
s ? "btn-active" : "",
|
|
27
|
+
a
|
|
28
|
+
].filter(Boolean).join(" ");
|
|
29
|
+
return /* @__PURE__ */ h(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
className: u,
|
|
34
|
+
disabled: t,
|
|
35
|
+
onClick: m,
|
|
36
|
+
"aria-pressed": s,
|
|
37
|
+
"data-testid": `segmented-item-${e}`,
|
|
38
|
+
children: [
|
|
39
|
+
n && /* @__PURE__ */ b("span", { className: "mr-1", children: n }),
|
|
40
|
+
l
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}, w = ({
|
|
45
|
+
value: e,
|
|
46
|
+
defaultValue: o,
|
|
47
|
+
onChange: n,
|
|
48
|
+
size: l = "md",
|
|
49
|
+
block: a = !1,
|
|
50
|
+
disabled: i = !1,
|
|
51
|
+
className: d = "",
|
|
52
|
+
children: r
|
|
53
|
+
}) => {
|
|
54
|
+
const [c, s] = p(o), t = e !== void 0, m = t ? e : c, u = S(
|
|
55
|
+
(g) => {
|
|
56
|
+
t || s(g), n?.(g);
|
|
57
|
+
},
|
|
58
|
+
[t, n]
|
|
59
|
+
), f = {
|
|
60
|
+
value: m,
|
|
61
|
+
onChange: u,
|
|
62
|
+
size: l,
|
|
63
|
+
disabled: i
|
|
64
|
+
}, x = ["join", a ? "w-full [&>.join-item]:flex-1" : "", d].filter(Boolean).join(" ");
|
|
65
|
+
return /* @__PURE__ */ b(C.Provider, { value: f, children: /* @__PURE__ */ b("div", { className: x, role: "group", "data-testid": "segmented", children: r }) });
|
|
20
66
|
};
|
|
67
|
+
w.Item = k;
|
|
21
68
|
export {
|
|
22
|
-
|
|
69
|
+
w as Segmented
|
|
23
70
|
};
|
|
24
71
|
//# sourceMappingURL=index66.js.map
|
package/dist/index66.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index66.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index66.js","sources":["../src/components/Segmented.tsx"],"sourcesContent":["import React, { useState, useCallback, createContext, useContext } from 'react'\n\nexport type SegmentedValue = string | number\n\ninterface SegmentedContextValue {\n value?: SegmentedValue\n onChange?: (value: SegmentedValue) => void\n size: 'xs' | 'sm' | 'md' | 'lg'\n disabled: boolean\n}\n\nconst SegmentedContext = createContext<SegmentedContextValue | null>(null)\n\nconst useSegmentedContext = () => {\n const context = useContext(SegmentedContext)\n if (!context) {\n throw new Error('Segmented.Item must be used within a Segmented component')\n }\n return context\n}\n\nexport interface SegmentedItemProps {\n /** Option value */\n value: SegmentedValue\n /** Disable this option */\n disabled?: boolean\n /** Icon to display before label */\n icon?: React.ReactNode\n /** Label content */\n children: React.ReactNode\n /** Additional CSS class */\n className?: string\n}\n\nconst sizeClasses = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: '',\n lg: 'btn-lg',\n}\n\nconst SegmentedItem: React.FC<SegmentedItemProps> = ({\n value,\n disabled: itemDisabled = false,\n icon,\n children,\n className = '',\n}) => {\n const { value: selectedValue, onChange, size, disabled: groupDisabled } = useSegmentedContext()\n\n const isSelected = selectedValue === value\n const isDisabled = groupDisabled || itemDisabled\n\n const handleClick = () => {\n if (!isDisabled) {\n onChange?.(value)\n }\n }\n\n const buttonClasses = [\n 'join-item',\n 'btn',\n sizeClasses[size],\n isSelected ? 'btn-active' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <button\n type=\"button\"\n className={buttonClasses}\n disabled={isDisabled}\n onClick={handleClick}\n aria-pressed={isSelected}\n data-testid={`segmented-item-${value}`}\n >\n {icon && <span className=\"mr-1\">{icon}</span>}\n {children}\n </button>\n )\n}\n\nexport interface SegmentedProps {\n /** Currently selected value (controlled) */\n value?: SegmentedValue\n /** Default selected value (uncontrolled) */\n defaultValue?: SegmentedValue\n /** Callback when selection changes */\n onChange?: (value: SegmentedValue) => void\n /** Size variant */\n size?: 'xs' | 'sm' | 'md' | 'lg'\n /** Take full width of container */\n block?: boolean\n /** Disable all options */\n disabled?: boolean\n /** Additional CSS class */\n className?: string\n /** Segmented.Item children */\n children: React.ReactNode\n}\n\nexport const Segmented: React.FC<SegmentedProps> & { Item: typeof SegmentedItem } = ({\n value,\n defaultValue,\n onChange,\n size = 'md',\n block = false,\n disabled = false,\n className = '',\n children,\n}) => {\n const [internalValue, setInternalValue] = useState<SegmentedValue | undefined>(defaultValue)\n\n const isControlled = value !== undefined\n const currentValue = isControlled ? value : internalValue\n\n const handleChange = useCallback(\n (newValue: SegmentedValue) => {\n if (!isControlled) {\n setInternalValue(newValue)\n }\n onChange?.(newValue)\n },\n [isControlled, onChange]\n )\n\n const contextValue: SegmentedContextValue = {\n value: currentValue,\n onChange: handleChange,\n size,\n disabled,\n }\n\n const containerClasses = ['join', block ? 'w-full [&>.join-item]:flex-1' : '', className]\n .filter(Boolean)\n .join(' ')\n\n return (\n <SegmentedContext.Provider value={contextValue}>\n <div className={containerClasses} role=\"group\" data-testid=\"segmented\">\n {children}\n </div>\n </SegmentedContext.Provider>\n )\n}\n\nSegmented.Item = SegmentedItem\n"],"names":["SegmentedContext","createContext","useSegmentedContext","context","useContext","sizeClasses","SegmentedItem","value","itemDisabled","icon","children","className","selectedValue","onChange","size","groupDisabled","isSelected","isDisabled","handleClick","buttonClasses","jsxs","jsx","Segmented","defaultValue","block","disabled","internalValue","setInternalValue","useState","isControlled","currentValue","handleChange","useCallback","newValue","contextValue","containerClasses"],"mappings":";;AAWA,MAAMA,IAAmBC,EAA4C,IAAI,GAEnEC,IAAsB,MAAM;AAChC,QAAMC,IAAUC,EAAWJ,CAAgB;AAC3C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,0DAA0D;AAE5E,SAAOA;AACT,GAeME,IAAc;AAAA,EAClB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAA8C,CAAC;AAAA,EACnD,OAAAC;AAAA,EACA,UAAUC,IAAe;AAAA,EACzB,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,I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AA,IACA,UAAAW;AAAA,EAAA,GAGIU,IAAmB,CAAC,QAAQX,IAAQ,iCAAiC,IAAIb,CAAS,EACrF,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SACE,gBAAAU,EAACrB,EAAiB,UAAjB,EAA0B,OAAOkC,GAChC,UAAA,gBAAAb,EAAC,OAAA,EAAI,WAAWc,GAAkB,MAAK,SAAQ,eAAY,aACxD,UAAAzB,GACH,GACF;AAEJ;AAEAY,EAAU,OAAOhB;"}
|
package/dist/index67.js
CHANGED
|
@@ -1,49 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
center: "items-center",
|
|
12
|
-
baseline: "items-baseline",
|
|
13
|
-
stretch: "items-stretch"
|
|
14
|
-
}, j = {
|
|
15
|
-
start: "justify-start",
|
|
16
|
-
end: "justify-end",
|
|
17
|
-
center: "justify-center",
|
|
18
|
-
between: "justify-between",
|
|
19
|
-
around: "justify-around",
|
|
20
|
-
evenly: "justify-evenly"
|
|
21
|
-
}, h = ({
|
|
22
|
-
direction: n = "horizontal",
|
|
23
|
-
size: s = "md",
|
|
24
|
-
align: e,
|
|
25
|
-
justify: t,
|
|
26
|
-
wrap: l = !1,
|
|
27
|
-
className: o = "",
|
|
28
|
-
style: r,
|
|
29
|
-
children: i,
|
|
30
|
-
...c
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
const i = ({
|
|
3
|
+
width: s,
|
|
4
|
+
height: t,
|
|
5
|
+
circle: o = !1,
|
|
6
|
+
variant: l = "default",
|
|
7
|
+
className: n = "",
|
|
8
|
+
children: r,
|
|
9
|
+
style: f,
|
|
10
|
+
...u
|
|
31
11
|
}) => {
|
|
32
|
-
const
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
l ? "flex-wrap" : "",
|
|
39
|
-
o
|
|
40
|
-
].filter(Boolean).join(" "), u = {
|
|
41
|
-
...r,
|
|
42
|
-
...a ? { gap: `${s}px` } : {}
|
|
12
|
+
const p = () => {
|
|
13
|
+
const e = ["skeleton"];
|
|
14
|
+
return l === "text" && e.push("skeleton-text"), o && e.push("rounded-full"), n && e.push(n), e.join(" ");
|
|
15
|
+
}, c = () => {
|
|
16
|
+
const e = {};
|
|
17
|
+
return s && (e.width = typeof s == "number" ? `${s}px` : s), t && (e.height = typeof t == "number" ? `${t}px` : t), Object.keys(e).length > 0 ? e : void 0;
|
|
43
18
|
};
|
|
44
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ x("div", { className: p(), style: { ...c(), ...f }, ...u, children: r });
|
|
45
20
|
};
|
|
46
21
|
export {
|
|
47
|
-
|
|
22
|
+
i as Skeleton
|
|
48
23
|
};
|
|
49
24
|
//# sourceMappingURL=index67.js.map
|
package/dist/index67.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index67.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index67.js","sources":["../src/components/Skeleton.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n width?: string | number\n height?: string | number\n circle?: boolean\n variant?: 'default' | 'text'\n children?: React.ReactNode\n}\n\nexport const Skeleton: React.FC<SkeletonProps> = ({\n width,\n height,\n circle = false,\n variant = 'default',\n className = '',\n children,\n style,\n ...rest\n}) => {\n const getClasses = () => {\n const classes = ['skeleton']\n\n if (variant === 'text') {\n classes.push('skeleton-text')\n }\n\n if (circle) {\n classes.push('rounded-full')\n }\n\n if (className) {\n classes.push(className)\n }\n\n return classes.join(' ')\n }\n\n const getStyles = () => {\n const styles: React.CSSProperties = {}\n\n if (width) {\n styles.width = typeof width === 'number' ? `${width}px` : width\n }\n\n if (height) {\n styles.height = typeof height === 'number' ? `${height}px` : height\n }\n\n return Object.keys(styles).length > 0 ? styles : undefined\n }\n\n return (\n <div className={getClasses()} style={{ ...getStyles(), ...style }} {...rest}>\n {children}\n </div>\n )\n}\n"],"names":["Skeleton","width","height","circle","variant","className","children","style","rest","getClasses","classes","getStyles","styles","jsx"],"mappings":";AAUO,MAAMA,IAAoC,CAAC;AAAA,EAChD,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAa,MAAM;AACvB,UAAMC,IAAU,CAAC,UAAU;AAE3B,WAAIN,MAAY,UACdM,EAAQ,KAAK,eAAe,GAG1BP,KACFO,EAAQ,KAAK,cAAc,GAGzBL,KACFK,EAAQ,KAAKL,CAAS,GAGjBK,EAAQ,KAAK,GAAG;AAAA,EACzB,GAEMC,IAAY,MAAM;AACtB,UAAMC,IAA8B,CAAA;AAEpC,WAAIX,MACFW,EAAO,QAAQ,OAAOX,KAAU,WAAW,GAAGA,CAAK,OAAOA,IAGxDC,MACFU,EAAO,SAAS,OAAOV,KAAW,WAAW,GAAGA,CAAM,OAAOA,IAGxD,OAAO,KAAKU,CAAM,EAAE,SAAS,IAAIA,IAAS;AAAA,EACnD;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAWJ,EAAA,GAAc,OAAO,EAAE,GAAGE,EAAA,GAAa,GAAGJ,EAAA,GAAU,GAAGC,GACpE,UAAAF,EAAA,CACH;AAEJ;"}
|
package/dist/index68.js
CHANGED
|
@@ -1,137 +1,49 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
const g = {
|
|
3
|
+
xs: "gap-1",
|
|
4
|
+
sm: "gap-2",
|
|
5
|
+
md: "gap-4",
|
|
6
|
+
lg: "gap-6",
|
|
7
|
+
xl: "gap-8"
|
|
8
|
+
}, C = {
|
|
9
|
+
start: "items-start",
|
|
10
|
+
end: "items-end",
|
|
11
|
+
center: "items-center",
|
|
12
|
+
baseline: "items-baseline",
|
|
13
|
+
stretch: "items-stretch"
|
|
14
|
+
}, j = {
|
|
15
|
+
start: "justify-start",
|
|
16
|
+
end: "justify-end",
|
|
17
|
+
center: "justify-center",
|
|
18
|
+
between: "justify-between",
|
|
19
|
+
around: "justify-around",
|
|
20
|
+
evenly: "justify-evenly"
|
|
21
|
+
}, h = ({
|
|
22
|
+
direction: n = "horizontal",
|
|
23
|
+
size: s = "md",
|
|
24
|
+
align: e,
|
|
25
|
+
justify: t,
|
|
26
|
+
wrap: l = !1,
|
|
27
|
+
className: o = "",
|
|
28
|
+
style: r,
|
|
29
|
+
children: i,
|
|
30
|
+
...c
|
|
12
31
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
g || j(n), I?.(n);
|
|
27
|
-
},
|
|
28
|
-
[g, I]
|
|
29
|
-
), V = x(
|
|
30
|
-
(n, e) => {
|
|
31
|
-
e.preventDefault();
|
|
32
|
-
const a = c === "horizontal" ? e.clientX : e.clientY;
|
|
33
|
-
b.current = {
|
|
34
|
-
index: n,
|
|
35
|
-
startPos: a,
|
|
36
|
-
startSizes: [...p]
|
|
37
|
-
};
|
|
38
|
-
const r = (w) => {
|
|
39
|
-
if (!b.current || !$.current) return;
|
|
40
|
-
const { index: t, startPos: P, startSizes: s } = b.current, K = $.current.getBoundingClientRect(), O = c === "horizontal" ? K.width : K.height, Q = c === "horizontal" ? w.clientX : w.clientY, T = (l - 1) * z, v = O - T, F = (Q - P) / v * 100, U = h[t]?.props || {}, X = h[t + 1]?.props || {}, W = U.minSize ?? R, Z = X.minSize ?? R, A = W / v * 100, L = Z / v * 100;
|
|
41
|
-
let i = s[t] + F, u = s[t + 1] - F;
|
|
42
|
-
i < A && (i = A, u = s[t] + s[t + 1] - A), u < L && (u = L, i = s[t] + s[t + 1] - L);
|
|
43
|
-
const Y = U.maxSize, q = X.maxSize;
|
|
44
|
-
if (Y) {
|
|
45
|
-
const m = Y / v * 100;
|
|
46
|
-
i > m && (i = m, u = s[t] + s[t + 1] - m);
|
|
47
|
-
}
|
|
48
|
-
if (q) {
|
|
49
|
-
const m = q / v * 100;
|
|
50
|
-
u > m && (u = m, i = s[t] + s[t + 1] - m);
|
|
51
|
-
}
|
|
52
|
-
const M = [...s];
|
|
53
|
-
M[t] = i, M[t + 1] = u, S(M);
|
|
54
|
-
}, o = () => {
|
|
55
|
-
b.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
56
|
-
};
|
|
57
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o), document.body.style.cursor = c === "horizontal" ? "col-resize" : "row-resize", document.body.style.userSelect = "none";
|
|
58
|
-
},
|
|
59
|
-
[c, p, l, z, h, R, S]
|
|
60
|
-
), J = x(
|
|
61
|
-
(n, e) => {
|
|
62
|
-
const a = e.shiftKey ? 10 : 1;
|
|
63
|
-
let r = 0;
|
|
64
|
-
if (c === "horizontal" ? e.key === "ArrowLeft" ? r = -a : e.key === "ArrowRight" && (r = a) : e.key === "ArrowUp" ? r = -a : e.key === "ArrowDown" && (r = a), r !== 0) {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
const o = [...p], w = 5;
|
|
67
|
-
let t = o[n] + r, P = o[n + 1] - r;
|
|
68
|
-
t >= w && P >= w && (o[n] = t, o[n + 1] = P, S(o));
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
[c, p, S]
|
|
72
|
-
), d = c === "horizontal";
|
|
73
|
-
return /* @__PURE__ */ f(
|
|
74
|
-
"div",
|
|
75
|
-
{
|
|
76
|
-
ref: $,
|
|
77
|
-
className: `flex ${d ? "flex-row" : "flex-col"} h-full w-full ${G}`,
|
|
78
|
-
children: h.map((n, e) => {
|
|
79
|
-
const a = n.props, r = e === h.length - 1;
|
|
80
|
-
return /* @__PURE__ */ B(C.Fragment, { children: [
|
|
81
|
-
/* @__PURE__ */ f(
|
|
82
|
-
"div",
|
|
83
|
-
{
|
|
84
|
-
ref: (o) => {
|
|
85
|
-
H.current[e] = o;
|
|
86
|
-
},
|
|
87
|
-
className: `overflow-auto ${a.className || ""}`,
|
|
88
|
-
style: {
|
|
89
|
-
[d ? "width" : "height"]: `calc(${p[e]}% - ${(l - 1) * z / l}px)`,
|
|
90
|
-
flexShrink: 0
|
|
91
|
-
},
|
|
92
|
-
children: a.children
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
!r && /* @__PURE__ */ f(
|
|
96
|
-
"div",
|
|
97
|
-
{
|
|
98
|
-
role: "separator",
|
|
99
|
-
"aria-orientation": d ? "vertical" : "horizontal",
|
|
100
|
-
"aria-valuenow": Math.round(p[e]),
|
|
101
|
-
tabIndex: 0,
|
|
102
|
-
className: `
|
|
103
|
-
flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50
|
|
104
|
-
transition-colors duration-150 relative group
|
|
105
|
-
${d ? "cursor-col-resize" : "cursor-row-resize"}
|
|
106
|
-
`,
|
|
107
|
-
style: {
|
|
108
|
-
[d ? "width" : "height"]: `${z}px`
|
|
109
|
-
},
|
|
110
|
-
onMouseDown: (o) => V(e, o),
|
|
111
|
-
onKeyDown: (o) => J(e, o),
|
|
112
|
-
children: /* @__PURE__ */ B(
|
|
113
|
-
"div",
|
|
114
|
-
{
|
|
115
|
-
className: `
|
|
116
|
-
absolute inset-0 flex items-center justify-center
|
|
117
|
-
${d ? "flex-col gap-0.5" : "flex-row gap-0.5"}
|
|
118
|
-
`,
|
|
119
|
-
children: [
|
|
120
|
-
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
121
|
-
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" }),
|
|
122
|
-
/* @__PURE__ */ f("div", { className: "w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60" })
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
] }, e);
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
);
|
|
32
|
+
const a = typeof s == "number", p = a ? "" : g[s], f = e ? C[e] : "", m = t ? j[t] : "", d = [
|
|
33
|
+
"flex",
|
|
34
|
+
n === "horizontal" ? "flex-row" : "flex-col",
|
|
35
|
+
p,
|
|
36
|
+
f,
|
|
37
|
+
m,
|
|
38
|
+
l ? "flex-wrap" : "",
|
|
39
|
+
o
|
|
40
|
+
].filter(Boolean).join(" "), u = {
|
|
41
|
+
...r,
|
|
42
|
+
...a ? { gap: `${s}px` } : {}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ y("div", { className: d, style: u, ...c, children: i });
|
|
132
45
|
};
|
|
133
|
-
oe.Panel = ne;
|
|
134
46
|
export {
|
|
135
|
-
|
|
47
|
+
h as Space
|
|
136
48
|
};
|
|
137
49
|
//# sourceMappingURL=index68.js.map
|
package/dist/index68.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index68.js","sources":["../src/components/Splitter.tsx"],"sourcesContent":["import React, { useState, useRef, useCallback, useEffect } from 'react'\n\nexport interface SplitterPanelProps {\n children: React.ReactNode\n defaultSize?: number\n size?: number\n minSize?: number\n maxSize?: number\n collapsible?: boolean\n collapsed?: boolean\n onCollapse?: (collapsed: boolean) => void\n className?: string\n}\n\nexport interface SplitterProps {\n children: React.ReactNode\n direction?: 'horizontal' | 'vertical'\n sizes?: number[]\n defaultSizes?: number[]\n onSizesChange?: (sizes: number[]) => void\n gutterSize?: number\n minSize?: number\n className?: string\n}\n\nconst Panel: React.FC<SplitterPanelProps> = ({ children }) => {\n return <>{children}</>\n}\n\nexport const Splitter: React.FC<SplitterProps> & { Panel: typeof Panel } = ({\n children,\n direction = 'horizontal',\n sizes,\n defaultSizes,\n onSizesChange,\n gutterSize = 8,\n minSize = 50,\n className = '',\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const panelsRef = useRef<(HTMLDivElement | null)[]>([])\n const draggingRef = useRef<{ index: number; startPos: number; startSizes: number[] } | null>(null)\n\n // Extract panel props from children\n const panels = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<SplitterPanelProps> =>\n React.isValidElement(child)\n )\n\n const panelCount = panels.length\n\n // Initialize sizes\n const getInitialSizes = useCallback(() => {\n if (defaultSizes && defaultSizes.length === panelCount) {\n return defaultSizes\n }\n // Equal distribution\n const equalSize = 100 / panelCount\n return Array(panelCount).fill(equalSize)\n }, [defaultSizes, panelCount])\n\n const [internalSizes, setInternalSizes] = useState<number[]>(getInitialSizes)\n const currentSizes = sizes || internalSizes\n\n // Update internal sizes when panel count changes\n useEffect(() => {\n if (!sizes && internalSizes.length !== panelCount) {\n setInternalSizes(getInitialSizes())\n }\n }, [panelCount, sizes, internalSizes.length, getInitialSizes])\n\n const updateSizes = useCallback(\n (newSizes: number[]) => {\n if (!sizes) {\n setInternalSizes(newSizes)\n }\n onSizesChange?.(newSizes)\n },\n [sizes, onSizesChange]\n )\n\n const handleMouseDown = useCallback(\n (index: number, e: React.MouseEvent) => {\n e.preventDefault()\n const startPos = direction === 'horizontal' ? e.clientX : e.clientY\n draggingRef.current = {\n index,\n startPos,\n startSizes: [...currentSizes],\n }\n\n const handleMouseMove = (moveEvent: MouseEvent) => {\n if (!draggingRef.current || !containerRef.current) return\n\n const { index: dragIndex, startPos: dragStartPos, startSizes } = draggingRef.current\n const containerRect = containerRef.current.getBoundingClientRect()\n const containerSize = direction === 'horizontal' ? containerRect.width : containerRect.height\n const currentPos = direction === 'horizontal' ? moveEvent.clientX : moveEvent.clientY\n\n // Calculate delta as percentage\n const gutterCount = panelCount - 1\n const totalGutterSize = gutterCount * gutterSize\n const availableSize = containerSize - totalGutterSize\n const deltaPixels = currentPos - dragStartPos\n const deltaPercent = (deltaPixels / availableSize) * 100\n\n // Get min sizes for panels\n const panel1Props = panels[dragIndex]?.props || {}\n const panel2Props = panels[dragIndex + 1]?.props || {}\n const minSize1 = panel1Props.minSize ?? minSize\n const minSize2 = panel2Props.minSize ?? minSize\n const minPercent1 = (minSize1 / availableSize) * 100\n const minPercent2 = (minSize2 / availableSize) * 100\n\n // Calculate new sizes\n let newSize1 = startSizes[dragIndex] + deltaPercent\n let newSize2 = startSizes[dragIndex + 1] - deltaPercent\n\n // Apply min constraints\n if (newSize1 < minPercent1) {\n newSize1 = minPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent1\n }\n if (newSize2 < minPercent2) {\n newSize2 = minPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - minPercent2\n }\n\n // Apply max constraints\n const maxSize1 = panel1Props.maxSize\n const maxSize2 = panel2Props.maxSize\n if (maxSize1) {\n const maxPercent1 = (maxSize1 / availableSize) * 100\n if (newSize1 > maxPercent1) {\n newSize1 = maxPercent1\n newSize2 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent1\n }\n }\n if (maxSize2) {\n const maxPercent2 = (maxSize2 / availableSize) * 100\n if (newSize2 > maxPercent2) {\n newSize2 = maxPercent2\n newSize1 = startSizes[dragIndex] + startSizes[dragIndex + 1] - maxPercent2\n }\n }\n\n const newSizes = [...startSizes]\n newSizes[dragIndex] = newSize1\n newSizes[dragIndex + 1] = newSize2\n updateSizes(newSizes)\n }\n\n const handleMouseUp = () => {\n draggingRef.current = null\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = direction === 'horizontal' ? 'col-resize' : 'row-resize'\n document.body.style.userSelect = 'none'\n },\n [direction, currentSizes, panelCount, gutterSize, panels, minSize, updateSizes]\n )\n\n const handleKeyDown = useCallback(\n (index: number, e: React.KeyboardEvent) => {\n const step = e.shiftKey ? 10 : 1\n let delta = 0\n\n if (direction === 'horizontal') {\n if (e.key === 'ArrowLeft') delta = -step\n else if (e.key === 'ArrowRight') delta = step\n } else {\n if (e.key === 'ArrowUp') delta = -step\n else if (e.key === 'ArrowDown') delta = step\n }\n\n if (delta !== 0) {\n e.preventDefault()\n const newSizes = [...currentSizes]\n const minPercent = 5 // Minimum 5% when using keyboard\n\n let newSize1 = newSizes[index] + delta\n let newSize2 = newSizes[index + 1] - delta\n\n if (newSize1 >= minPercent && newSize2 >= minPercent) {\n newSizes[index] = newSize1\n newSizes[index + 1] = newSize2\n updateSizes(newSizes)\n }\n }\n },\n [direction, currentSizes, updateSizes]\n )\n\n const isHorizontal = direction === 'horizontal'\n\n return (\n <div\n ref={containerRef}\n className={`flex ${isHorizontal ? 'flex-row' : 'flex-col'} h-full w-full ${className}`}\n >\n {panels.map((panel, index) => {\n const panelProps = panel.props\n const isLast = index === panels.length - 1\n\n return (\n <React.Fragment key={index}>\n <div\n ref={(el) => {\n panelsRef.current[index] = el\n }}\n className={`overflow-auto ${panelProps.className || ''}`}\n style={{\n [isHorizontal ? 'width' : 'height']: `calc(${currentSizes[index]}% - ${\n ((panelCount - 1) * gutterSize) / panelCount\n }px)`,\n flexShrink: 0,\n }}\n >\n {panelProps.children}\n </div>\n {!isLast && (\n <div\n role=\"separator\"\n aria-orientation={isHorizontal ? 'vertical' : 'horizontal'}\n aria-valuenow={Math.round(currentSizes[index])}\n tabIndex={0}\n className={`\n flex-shrink-0 bg-base-300 hover:bg-primary/30 active:bg-primary/50\n transition-colors duration-150 relative group\n ${isHorizontal ? 'cursor-col-resize' : 'cursor-row-resize'}\n `}\n style={{\n [isHorizontal ? 'width' : 'height']: `${gutterSize}px`,\n }}\n onMouseDown={(e) => handleMouseDown(index, e)}\n onKeyDown={(e) => handleKeyDown(index, e)}\n >\n {/* Grip indicator */}\n <div\n className={`\n absolute inset-0 flex items-center justify-center\n ${isHorizontal ? 'flex-col gap-0.5' : 'flex-row gap-0.5'}\n `}\n >\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n <div className=\"w-1 h-1 rounded-full bg-base-content/30 group-hover:bg-primary/60\" />\n </div>\n </div>\n )}\n </React.Fragment>\n )\n })}\n </div>\n )\n}\n\nSplitter.Panel = Panel\n"],"names":["Panel","children","Splitter","direction","sizes","defaultSizes","onSizesChange","gutterSize","minSize","className","containerRef","useRef","panelsRef","draggingRef","panels","React","child","panelCount","getInitialSizes","useCallback","equalSize","internalSizes","setInternalSizes","useState","currentSizes","useEffect","updateSizes","newSizes","handleMouseDown","index","startPos","handleMouseMove","moveEvent","dragIndex","dragStartPos","startSizes","containerRect","containerSize","currentPos","totalGutterSize","availableSize","deltaPercent","panel1Props","panel2Props","minSize1","minSize2","minPercent1","minPercent2","newSize1","newSize2","maxSize1","maxSize2","maxPercent1","maxPercent2","handleMouseUp","handleKeyDown","step","delta","minPercent","isHorizontal","jsx","panel","panelProps","isLast","jsxs","el","e"],"mappings":";;AAyBA,MAAMA,KAAsC,CAAC,EAAE,UAAAC,+BACnC,UAAAA,GAAS,GAGRC,KAA8D,CAAC;AAAA,EAC1E,UAAAD;AAAA,EACA,WAAAE,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY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I,WAAU,oEAAA,CAAoE;AAAA,oBACnF,gBAAAA,EAAC,OAAA,EAAI,WAAU,oEAAA,CAAoE;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACrF;AAAA,UAAA;AAAA,QACF,EAAA,GA3CiB/B,CA6CrB;AAAA,MAEJ,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA3B,GAAS,QAAQF;"}
|
|
1
|
+
{"version":3,"file":"index68.js","sources":["../src/components/Space.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface SpaceProps extends React.HTMLAttributes<HTMLDivElement> {\n direction?: 'horizontal' | 'vertical'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number\n align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch'\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'\n wrap?: boolean\n children: React.ReactNode\n}\n\nconst gapClasses = {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8',\n} as const\n\nconst alignClasses = {\n start: 'items-start',\n end: 'items-end',\n center: 'items-center',\n baseline: 'items-baseline',\n stretch: 'items-stretch',\n} as const\n\nconst justifyClasses = {\n start: 'justify-start',\n end: 'justify-end',\n center: 'justify-center',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n} as const\n\nexport const Space: React.FC<SpaceProps> = ({\n direction = 'horizontal',\n size = 'md',\n align,\n justify,\n wrap = false,\n className = '',\n style,\n children,\n ...rest\n}) => {\n const isNumericSize = typeof size === 'number'\n const gapClass = isNumericSize ? '' : gapClasses[size]\n const alignClass = align ? alignClasses[align] : ''\n const justifyClass = justify ? justifyClasses[justify] : ''\n const wrapClass = wrap ? 'flex-wrap' : ''\n const directionClass = direction === 'horizontal' ? 'flex-row' : 'flex-col'\n\n const classes = [\n 'flex',\n directionClass,\n gapClass,\n alignClass,\n justifyClass,\n wrapClass,\n className\n ].filter(Boolean).join(' ')\n\n const combinedStyle: React.CSSProperties = {\n ...style,\n ...(isNumericSize ? { gap: `${size}px` } : {}),\n }\n\n return <div className={classes} style={combinedStyle} {...rest}>{children}</div>\n}\n"],"names":["gapClasses","alignClasses","justifyClasses","Space","direction","size","align","justify","wrap","className","style","children","rest","isNumericSize","gapClass","alignClass","justifyClass","classes","combinedStyle","jsx"],"mappings":";AAWA,MAAMA,IAAa;AAAA,EACjB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAe;AAAA,EACnB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AACX,GAEMC,IAAiB;AAAA,EACrB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV,GAEaC,IAA8B,CAAC;AAAA,EAC1C,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgB,OAAOR,KAAS,UAChCS,IAAWD,IAAgB,KAAKb,EAAWK,CAAI,GAC/CU,IAAaT,IAAQL,EAAaK,CAAK,IAAI,IAC3CU,IAAeT,IAAUL,EAAeK,CAAO,IAAI,IAInDU,IAAU;AAAA,IACd;AAAA,IAHqBb,MAAc,eAAe,aAAa;AAAA,IAK/DU;AAAA,IACAC;AAAA,IACAC;AAAA,IARgBR,IAAO,cAAc;AAAA,IAUrCC;AAAA,EAAA,EACA,OAAO,OAAO,EAAE,KAAK,GAAG,GAEpBS,IAAqC;AAAA,IACzC,GAAGR;AAAA,IACH,GAAIG,IAAgB,EAAE,KAAK,GAAGR,CAAI,SAAS,CAAA;AAAA,EAAC;AAG9C,SAAO,gBAAAc,EAAC,SAAI,WAAWF,GAAS,OAAOC,GAAgB,GAAGN,GAAO,UAAAD,GAAS;AAC5E;"}
|