@tamagui/alert-dialog 2.0.0-rc.8 → 2.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/dist/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var index_exports = {};
13
- module.exports = __toCommonJS(index_exports);
14
- __reExport(index_exports, require("./AlertDialog"), module.exports);
15
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,0BAAd;",
5
- "names": []
6
- }
@@ -1,209 +0,0 @@
1
- import { useComposedRefs } from "@tamagui/compose-refs";
2
- import { isWeb } from "@tamagui/constants";
3
- import {
4
- Slottable,
5
- View,
6
- createStyledContext,
7
- styled
8
- } from "@tamagui/core";
9
- import {
10
- Dialog,
11
- DialogClose,
12
- DialogContent,
13
- DialogDescription,
14
- DialogOverlay,
15
- DialogOverlayFrame,
16
- DialogPortal,
17
- DialogTitle,
18
- DialogTrigger,
19
- DialogWarningProvider
20
- } from "@tamagui/dialog";
21
- import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
22
-
23
- import * as React from "react";
24
-
25
- import { jsx, jsxs } from "react/jsx-runtime";
26
- const getAlertDialogScope = (scope) => scope, ROOT_NAME = "AlertDialog", TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = styled(View, {
27
- name: TRIGGER_NAME
28
- }), AlertDialogTrigger = NativeAlertDialogTriggerFrame.styleable(
29
- function(props, forwardedRef) {
30
- if (props.__native) {
31
- const { __native, onPress, __onPress, ...rest } = props;
32
- return /* @__PURE__ */ jsx(
33
- NativeAlertDialogTriggerFrame,
34
- {
35
- ...rest,
36
- onPress: composeEventHandlers(onPress, __onPress)
37
- }
38
- );
39
- }
40
- const { scope, ...triggerProps } = props;
41
- return /* @__PURE__ */ jsx(
42
- DialogTrigger,
43
- {
44
- scope: getAlertDialogScope(scope),
45
- ...triggerProps,
46
- ref: forwardedRef
47
- }
48
- );
49
- }
50
- );
51
- const AlertDialogPortal = function(props) {
52
- const { scope, ...portalProps } = props;
53
- return /* @__PURE__ */ jsx(DialogPortal, { scope: getAlertDialogScope(scope), ...portalProps });
54
- }, OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = styled(DialogOverlayFrame, {
55
- name: OVERLAY_NAME
56
- }), AlertDialogOverlay = AlertDialogOverlayFrame.styleable(
57
- function(props, forwardedRef) {
58
- const { scope, ...overlayProps } = props;
59
- return /* @__PURE__ */ jsx(
60
- DialogOverlay,
61
- {
62
- scope: getAlertDialogScope(scope),
63
- ...overlayProps,
64
- ref: forwardedRef
65
- }
66
- );
67
- }
68
- ), CONTENT_NAME = "AlertDialogContent", {
69
- Provider: AlertDialogContextProvider,
70
- useStyledContext: useAlertDialogContentContext
71
- } = createStyledContext({}, "AlertDialogContext"), AlertDialogContent = React.forwardRef(
72
- function(props, forwardedRef) {
73
- const { scope, children, ...contentProps } = props, dialogScope = getAlertDialogScope(scope), contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, contentRef), cancelRef = React.useRef(null), destructiveRef = React.useRef(null);
74
- return /* @__PURE__ */ jsx(
75
- DialogWarningProvider,
76
- {
77
- contentName: CONTENT_NAME,
78
- titleName: TITLE_NAME,
79
- docsSlug: "alert-dialog",
80
- children: /* @__PURE__ */ jsx(
81
- AlertDialogContextProvider,
82
- {
83
- scope,
84
- cancelRef,
85
- destructiveRef,
86
- children: /* @__PURE__ */ jsxs(
87
- DialogContent,
88
- {
89
- role: "alertdialog",
90
- "aria-modal": !0,
91
- scope: dialogScope,
92
- ...contentProps,
93
- ref: composedRefs,
94
- onOpenAutoFocus: composeEventHandlers(
95
- contentProps.onOpenAutoFocus,
96
- (event) => {
97
- event.preventDefault(), isWeb && cancelRef.current?.focus({ preventScroll: !0 });
98
- }
99
- ),
100
- onPointerDownOutside: (event) => event.preventDefault(),
101
- onInteractOutside: (event) => event.preventDefault(),
102
- children: [
103
- /* @__PURE__ */ jsx(Slottable, { children }),
104
- process.env.NODE_ENV === "development" && /* @__PURE__ */ jsx(DescriptionWarning, { contentRef })
105
- ]
106
- }
107
- )
108
- }
109
- )
110
- }
111
- );
112
- }
113
- ), TITLE_NAME = "AlertDialogTitle", AlertDialogTitleFrame = styled(View, {
114
- name: TITLE_NAME
115
- }), AlertDialogTitle = AlertDialogTitleFrame.styleable(
116
- function(props, forwardedRef) {
117
- const { scope, ...titleProps } = props;
118
- return /* @__PURE__ */ jsx(
119
- DialogTitle,
120
- {
121
- scope: getAlertDialogScope(scope),
122
- ...titleProps,
123
- ref: forwardedRef
124
- }
125
- );
126
- }
127
- ), DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescriptionFrame = styled(View, {
128
- name: DESCRIPTION_NAME
129
- }), AlertDialogDescription = AlertDialogDescriptionFrame.styleable(
130
- function(props, forwardedRef) {
131
- const { scope, ...descriptionProps } = props;
132
- return /* @__PURE__ */ jsx(
133
- DialogDescription,
134
- {
135
- scope: getAlertDialogScope(scope),
136
- ...descriptionProps,
137
- ref: forwardedRef
138
- }
139
- );
140
- }
141
- ), ACTION_NAME = "AlertDialogAction", AlertDialogActionFrame = styled(View, {
142
- name: ACTION_NAME
143
- }), AlertDialogAction = AlertDialogActionFrame.styleable(
144
- function(props, forwardedRef) {
145
- const { scope, ...actionProps } = props;
146
- return /* @__PURE__ */ jsx(
147
- DialogClose,
148
- {
149
- scope: getAlertDialogScope(scope),
150
- ...actionProps,
151
- ref: forwardedRef
152
- }
153
- );
154
- }
155
- ), CANCEL_NAME = "AlertDialogCancel", AlertDialogCancelFrame = styled(View, {
156
- name: CANCEL_NAME
157
- }), AlertDialogCancel = AlertDialogCancelFrame.styleable(
158
- function(props, forwardedRef) {
159
- const { scope, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(scope), ref = useComposedRefs(forwardedRef, cancelRef);
160
- return /* @__PURE__ */ jsx(DialogClose, { scope: getAlertDialogScope(scope), ...cancelProps, ref });
161
- }
162
- ), DESTRUCTIVE_NAME = "AlertDialogDestructive", AlertDialogDestructiveFrame = styled(View, {
163
- name: DESTRUCTIVE_NAME
164
- }), AlertDialogDestructive = AlertDialogDestructiveFrame.styleable(
165
- function(props, forwardedRef) {
166
- const { scope, ...destructiveProps } = props, { destructiveRef } = useAlertDialogContentContext(scope), ref = useComposedRefs(forwardedRef, destructiveRef);
167
- return /* @__PURE__ */ jsx(DialogClose, { scope: getAlertDialogScope(scope), ...destructiveProps, ref });
168
- }
169
- ), DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
170
- if (!isWeb) return;
171
- document.getElementById(
172
- // @ts-ignore
173
- contentRef.current?.getAttribute("aria-describedby")
174
- ) || console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
175
-
176
- You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
177
-
178
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
179
-
180
- For more information, see https://tamagui.dev/docs/components/alert-dialog`);
181
- }, [contentRef]), null), AlertDialogInner = (props) => {
182
- const { scope, native, ...alertDialogProps } = props, dialogScope = getAlertDialogScope(scope);
183
- return /* @__PURE__ */ jsx(Dialog, { scope: dialogScope, ...alertDialogProps, modal: !0 });
184
- };
185
- const AlertDialog = withStaticProperties(AlertDialogInner, {
186
- Trigger: AlertDialogTrigger,
187
- Portal: AlertDialogPortal,
188
- Overlay: AlertDialogOverlay,
189
- Content: AlertDialogContent,
190
- Action: AlertDialogAction,
191
- Cancel: AlertDialogCancel,
192
- Destructive: AlertDialogDestructive,
193
- Title: AlertDialogTitle,
194
- Description: AlertDialogDescription
195
- });
196
- AlertDialog.displayName = ROOT_NAME;
197
- export {
198
- AlertDialog,
199
- AlertDialogAction,
200
- AlertDialogCancel,
201
- AlertDialogContent,
202
- AlertDialogDescription,
203
- AlertDialogDestructive,
204
- AlertDialogOverlay,
205
- AlertDialogPortal,
206
- AlertDialogTitle,
207
- AlertDialogTrigger
208
- };
209
- //# sourceMappingURL=AlertDialog.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/AlertDialog.tsx"],
4
- "mappings": "AAGA,SAAS,uBAAuB;AAChC,SAAS,aAAwC;AAEjD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAYP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB,4BAA4B;AAC3D,OAAqC;AACrC,YAAY,WAAW;AACvB,OAAsB;AAoCZ,cAmGA,YAnGA;AAlCV,MAAM,sBAAsB,CAAC,UAAmB,OAM1C,YAAY,eAcZ,eAAe,sBAIf,gCAAgC,OAAO,MAAM;AAAA,EACjD,MAAM;AACR,CAAC,GAEK,qBACJ,8BAA8B;AA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AY,qBAAqB,gBAAgB;AAAA;AAAA,oKAEsE,YAAY;AAAA;AAAA,mFAE7F;AAE/E,GAAG,CAAC,UAAU,CAAC,GAGV,OAGH,mBAA+C,CAAC,UAAU;AAC9D,QAAM,EAAE,OAAO,QAAQ,GAAG,iBAAiB,IAAI,OACzC,cAAc,oBAAoB,KAAK;AAoF7C,SAAO,oBAAC,UAAO,OAAO,aAAc,GAAG,kBAAkB,OAAK,IAAC;AACjE;AA6BA,MAAM,cAAc,qBAAqB,kBAAkB;AAAA,EACzD,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAED,YAAY,cAAc;",
5
- "names": []
6
- }
@@ -1,209 +0,0 @@
1
- import { useComposedRefs } from "@tamagui/compose-refs";
2
- import { isWeb } from "@tamagui/constants";
3
- import {
4
- Slottable,
5
- View,
6
- createStyledContext,
7
- styled
8
- } from "@tamagui/core";
9
- import {
10
- Dialog,
11
- DialogClose,
12
- DialogContent,
13
- DialogDescription,
14
- DialogOverlay,
15
- DialogOverlayFrame,
16
- DialogPortal,
17
- DialogTitle,
18
- DialogTrigger,
19
- DialogWarningProvider
20
- } from "@tamagui/dialog";
21
- import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
22
-
23
- import * as React from "react";
24
-
25
- import { jsx, jsxs } from "react/jsx-runtime";
26
- const getAlertDialogScope = (scope) => scope, ROOT_NAME = "AlertDialog", TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = styled(View, {
27
- name: TRIGGER_NAME
28
- }), AlertDialogTrigger = NativeAlertDialogTriggerFrame.styleable(
29
- function(props, forwardedRef) {
30
- if (props.__native) {
31
- const { __native, onPress, __onPress, ...rest } = props;
32
- return /* @__PURE__ */ jsx(
33
- NativeAlertDialogTriggerFrame,
34
- {
35
- ...rest,
36
- onPress: composeEventHandlers(onPress, __onPress)
37
- }
38
- );
39
- }
40
- const { scope, ...triggerProps } = props;
41
- return /* @__PURE__ */ jsx(
42
- DialogTrigger,
43
- {
44
- scope: getAlertDialogScope(scope),
45
- ...triggerProps,
46
- ref: forwardedRef
47
- }
48
- );
49
- }
50
- );
51
- const AlertDialogPortal = function(props) {
52
- const { scope, ...portalProps } = props;
53
- return /* @__PURE__ */ jsx(DialogPortal, { scope: getAlertDialogScope(scope), ...portalProps });
54
- }, OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = styled(DialogOverlayFrame, {
55
- name: OVERLAY_NAME
56
- }), AlertDialogOverlay = AlertDialogOverlayFrame.styleable(
57
- function(props, forwardedRef) {
58
- const { scope, ...overlayProps } = props;
59
- return /* @__PURE__ */ jsx(
60
- DialogOverlay,
61
- {
62
- scope: getAlertDialogScope(scope),
63
- ...overlayProps,
64
- ref: forwardedRef
65
- }
66
- );
67
- }
68
- ), CONTENT_NAME = "AlertDialogContent", {
69
- Provider: AlertDialogContextProvider,
70
- useStyledContext: useAlertDialogContentContext
71
- } = createStyledContext({}, "AlertDialogContext"), AlertDialogContent = React.forwardRef(
72
- function(props, forwardedRef) {
73
- const { scope, children, ...contentProps } = props, dialogScope = getAlertDialogScope(scope), contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, contentRef), cancelRef = React.useRef(null), destructiveRef = React.useRef(null);
74
- return /* @__PURE__ */ jsx(
75
- DialogWarningProvider,
76
- {
77
- contentName: CONTENT_NAME,
78
- titleName: TITLE_NAME,
79
- docsSlug: "alert-dialog",
80
- children: /* @__PURE__ */ jsx(
81
- AlertDialogContextProvider,
82
- {
83
- scope,
84
- cancelRef,
85
- destructiveRef,
86
- children: /* @__PURE__ */ jsxs(
87
- DialogContent,
88
- {
89
- role: "alertdialog",
90
- "aria-modal": !0,
91
- scope: dialogScope,
92
- ...contentProps,
93
- ref: composedRefs,
94
- onOpenAutoFocus: composeEventHandlers(
95
- contentProps.onOpenAutoFocus,
96
- (event) => {
97
- event.preventDefault(), isWeb && cancelRef.current?.focus({ preventScroll: !0 });
98
- }
99
- ),
100
- onPointerDownOutside: (event) => event.preventDefault(),
101
- onInteractOutside: (event) => event.preventDefault(),
102
- children: [
103
- /* @__PURE__ */ jsx(Slottable, { children }),
104
- process.env.NODE_ENV === "development" && /* @__PURE__ */ jsx(DescriptionWarning, { contentRef })
105
- ]
106
- }
107
- )
108
- }
109
- )
110
- }
111
- );
112
- }
113
- ), TITLE_NAME = "AlertDialogTitle", AlertDialogTitleFrame = styled(View, {
114
- name: TITLE_NAME
115
- }), AlertDialogTitle = AlertDialogTitleFrame.styleable(
116
- function(props, forwardedRef) {
117
- const { scope, ...titleProps } = props;
118
- return /* @__PURE__ */ jsx(
119
- DialogTitle,
120
- {
121
- scope: getAlertDialogScope(scope),
122
- ...titleProps,
123
- ref: forwardedRef
124
- }
125
- );
126
- }
127
- ), DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescriptionFrame = styled(View, {
128
- name: DESCRIPTION_NAME
129
- }), AlertDialogDescription = AlertDialogDescriptionFrame.styleable(
130
- function(props, forwardedRef) {
131
- const { scope, ...descriptionProps } = props;
132
- return /* @__PURE__ */ jsx(
133
- DialogDescription,
134
- {
135
- scope: getAlertDialogScope(scope),
136
- ...descriptionProps,
137
- ref: forwardedRef
138
- }
139
- );
140
- }
141
- ), ACTION_NAME = "AlertDialogAction", AlertDialogActionFrame = styled(View, {
142
- name: ACTION_NAME
143
- }), AlertDialogAction = AlertDialogActionFrame.styleable(
144
- function(props, forwardedRef) {
145
- const { scope, ...actionProps } = props;
146
- return /* @__PURE__ */ jsx(
147
- DialogClose,
148
- {
149
- scope: getAlertDialogScope(scope),
150
- ...actionProps,
151
- ref: forwardedRef
152
- }
153
- );
154
- }
155
- ), CANCEL_NAME = "AlertDialogCancel", AlertDialogCancelFrame = styled(View, {
156
- name: CANCEL_NAME
157
- }), AlertDialogCancel = AlertDialogCancelFrame.styleable(
158
- function(props, forwardedRef) {
159
- const { scope, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(scope), ref = useComposedRefs(forwardedRef, cancelRef);
160
- return /* @__PURE__ */ jsx(DialogClose, { scope: getAlertDialogScope(scope), ...cancelProps, ref });
161
- }
162
- ), DESTRUCTIVE_NAME = "AlertDialogDestructive", AlertDialogDestructiveFrame = styled(View, {
163
- name: DESTRUCTIVE_NAME
164
- }), AlertDialogDestructive = AlertDialogDestructiveFrame.styleable(
165
- function(props, forwardedRef) {
166
- const { scope, ...destructiveProps } = props, { destructiveRef } = useAlertDialogContentContext(scope), ref = useComposedRefs(forwardedRef, destructiveRef);
167
- return /* @__PURE__ */ jsx(DialogClose, { scope: getAlertDialogScope(scope), ...destructiveProps, ref });
168
- }
169
- ), DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
170
- if (!isWeb) return;
171
- document.getElementById(
172
- // @ts-ignore
173
- contentRef.current?.getAttribute("aria-describedby")
174
- ) || console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
175
-
176
- You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
177
-
178
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
179
-
180
- For more information, see https://tamagui.dev/docs/components/alert-dialog`);
181
- }, [contentRef]), null), AlertDialogInner = (props) => {
182
- const { scope, native, ...alertDialogProps } = props, dialogScope = getAlertDialogScope(scope);
183
- return /* @__PURE__ */ jsx(Dialog, { scope: dialogScope, ...alertDialogProps, modal: !0 });
184
- };
185
- const AlertDialog = withStaticProperties(AlertDialogInner, {
186
- Trigger: AlertDialogTrigger,
187
- Portal: AlertDialogPortal,
188
- Overlay: AlertDialogOverlay,
189
- Content: AlertDialogContent,
190
- Action: AlertDialogAction,
191
- Cancel: AlertDialogCancel,
192
- Destructive: AlertDialogDestructive,
193
- Title: AlertDialogTitle,
194
- Description: AlertDialogDescription
195
- });
196
- AlertDialog.displayName = ROOT_NAME;
197
- export {
198
- AlertDialog,
199
- AlertDialogAction,
200
- AlertDialogCancel,
201
- AlertDialogContent,
202
- AlertDialogDescription,
203
- AlertDialogDestructive,
204
- AlertDialogOverlay,
205
- AlertDialogPortal,
206
- AlertDialogTitle,
207
- AlertDialogTrigger
208
- };
209
- //# sourceMappingURL=AlertDialog.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/AlertDialog.tsx"],
4
- "mappings": "AAGA,SAAS,uBAAuB;AAChC,SAAS,aAAwC;AAEjD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAYP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB,4BAA4B;AAC3D,OAAqC;AACrC,YAAY,WAAW;AACvB,OAAsB;AAoCZ,cAmGA,YAnGA;AAlCV,MAAM,sBAAsB,CAAC,UAAmB,OAM1C,YAAY,eAcZ,eAAe,sBAIf,gCAAgC,OAAO,MAAM;AAAA,EACjD,MAAM;AACR,CAAC,GAEK,qBACJ,8BAA8B;AAAA,EAC5B,SAA4B,OAAO,cAAc;AAC/C,QAAI,MAAM,UAAa;AACrB,YAAM,EAAE,UAAU,SAAS,WAAW,GAAG,KAAK,IAAI;AAClD,aACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACJ,SAAS,qBAAqB,SAAS,SAAS;AAAA;AAAA,MAClD;AAAA,IAEJ;AAEA,UAAM,EAAE,OAAO,GAAG,aAAa,IAAI;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,oBAAoB,KAAK;AAAA,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