@pgy-eu/react-native-tour-guide 0.0.0-stage → 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/LICENSE +20 -0
- package/README.md +993 -2
- package/lib/commonjs/SpotlightOverlay.js +712 -0
- package/lib/commonjs/SpotlightOverlay.js.map +1 -0
- package/lib/commonjs/Tooltip.js +593 -0
- package/lib/commonjs/Tooltip.js.map +1 -0
- package/lib/commonjs/TourGuideContext.js +535 -0
- package/lib/commonjs/TourGuideContext.js.map +1 -0
- package/lib/commonjs/TourGuideOverlay.js +1173 -0
- package/lib/commonjs/TourGuideOverlay.js.map +1 -0
- package/lib/commonjs/TourTarget.js +80 -0
- package/lib/commonjs/TourTarget.js.map +1 -0
- package/lib/commonjs/accessibility.js +49 -0
- package/lib/commonjs/accessibility.js.map +1 -0
- package/lib/commonjs/dev.js +48 -0
- package/lib/commonjs/dev.js.map +1 -0
- package/lib/commonjs/events.js +56 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/index.js +169 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/shapes.js +158 -0
- package/lib/commonjs/shapes.js.map +1 -0
- package/lib/commonjs/storage.js +116 -0
- package/lib/commonjs/storage.js.map +1 -0
- package/lib/commonjs/themes.js +86 -0
- package/lib/commonjs/themes.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useTourPersistence.js +135 -0
- package/lib/commonjs/useTourPersistence.js.map +1 -0
- package/lib/commonjs/useTourScroll.js +46 -0
- package/lib/commonjs/useTourScroll.js.map +1 -0
- package/lib/commonjs/utils.js +372 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/validation.js +143 -0
- package/lib/commonjs/validation.js.map +1 -0
- package/lib/module/SpotlightOverlay.js +707 -0
- package/lib/module/SpotlightOverlay.js.map +1 -0
- package/lib/module/Tooltip.js +588 -0
- package/lib/module/Tooltip.js.map +1 -0
- package/lib/module/TourGuideContext.js +529 -0
- package/lib/module/TourGuideContext.js.map +1 -0
- package/lib/module/TourGuideOverlay.js +1167 -0
- package/lib/module/TourGuideOverlay.js.map +1 -0
- package/lib/module/TourTarget.js +74 -0
- package/lib/module/TourTarget.js.map +1 -0
- package/lib/module/accessibility.js +43 -0
- package/lib/module/accessibility.js.map +1 -0
- package/lib/module/dev.js +40 -0
- package/lib/module/dev.js.map +1 -0
- package/lib/module/events.js +51 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +25 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/shapes.js +152 -0
- package/lib/module/shapes.js.map +1 -0
- package/lib/module/storage.js +111 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/themes.js +81 -0
- package/lib/module/themes.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useTourPersistence.js +130 -0
- package/lib/module/useTourPersistence.js.map +1 -0
- package/lib/module/useTourScroll.js +41 -0
- package/lib/module/useTourScroll.js.map +1 -0
- package/lib/module/utils.js +361 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/validation.js +138 -0
- package/lib/module/validation.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/SpotlightOverlay.d.ts +46 -0
- package/lib/typescript/commonjs/src/SpotlightOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Tooltip.d.ts +9 -0
- package/lib/typescript/commonjs/src/Tooltip.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TourGuideContext.d.ts +46 -0
- package/lib/typescript/commonjs/src/TourGuideContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TourGuideOverlay.d.ts +22 -0
- package/lib/typescript/commonjs/src/TourGuideOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TourTarget.d.ts +36 -0
- package/lib/typescript/commonjs/src/TourTarget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/accessibility.d.ts +22 -0
- package/lib/typescript/commonjs/src/accessibility.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/dev.d.ts +22 -0
- package/lib/typescript/commonjs/src/dev.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/events.d.ts +57 -0
- package/lib/typescript/commonjs/src/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +21 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/shapes.d.ts +50 -0
- package/lib/typescript/commonjs/src/shapes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/storage.d.ts +15 -0
- package/lib/typescript/commonjs/src/storage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/themes.d.ts +10 -0
- package/lib/typescript/commonjs/src/themes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +599 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useTourPersistence.d.ts +63 -0
- package/lib/typescript/commonjs/src/useTourPersistence.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useTourScroll.d.ts +36 -0
- package/lib/typescript/commonjs/src/useTourScroll.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils.d.ts +97 -0
- package/lib/typescript/commonjs/src/utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/validation.d.ts +11 -0
- package/lib/typescript/commonjs/src/validation.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/SpotlightOverlay.d.ts +46 -0
- package/lib/typescript/module/src/SpotlightOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/Tooltip.d.ts +9 -0
- package/lib/typescript/module/src/Tooltip.d.ts.map +1 -0
- package/lib/typescript/module/src/TourGuideContext.d.ts +46 -0
- package/lib/typescript/module/src/TourGuideContext.d.ts.map +1 -0
- package/lib/typescript/module/src/TourGuideOverlay.d.ts +22 -0
- package/lib/typescript/module/src/TourGuideOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/TourTarget.d.ts +36 -0
- package/lib/typescript/module/src/TourTarget.d.ts.map +1 -0
- package/lib/typescript/module/src/accessibility.d.ts +22 -0
- package/lib/typescript/module/src/accessibility.d.ts.map +1 -0
- package/lib/typescript/module/src/dev.d.ts +22 -0
- package/lib/typescript/module/src/dev.d.ts.map +1 -0
- package/lib/typescript/module/src/events.d.ts +57 -0
- package/lib/typescript/module/src/events.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +21 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/shapes.d.ts +50 -0
- package/lib/typescript/module/src/shapes.d.ts.map +1 -0
- package/lib/typescript/module/src/storage.d.ts +15 -0
- package/lib/typescript/module/src/storage.d.ts.map +1 -0
- package/lib/typescript/module/src/themes.d.ts +10 -0
- package/lib/typescript/module/src/themes.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +599 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/useTourPersistence.d.ts +63 -0
- package/lib/typescript/module/src/useTourPersistence.d.ts.map +1 -0
- package/lib/typescript/module/src/useTourScroll.d.ts +36 -0
- package/lib/typescript/module/src/useTourScroll.d.ts.map +1 -0
- package/lib/typescript/module/src/utils.d.ts +97 -0
- package/lib/typescript/module/src/utils.d.ts.map +1 -0
- package/lib/typescript/module/src/validation.d.ts +11 -0
- package/lib/typescript/module/src/validation.d.ts.map +1 -0
- package/llms.txt +62 -0
- package/package.json +281 -4
- package/src/SpotlightOverlay.tsx +742 -0
- package/src/Tooltip.tsx +638 -0
- package/src/TourGuideContext.tsx +644 -0
- package/src/TourGuideOverlay.tsx +1382 -0
- package/src/TourTarget.tsx +74 -0
- package/src/accessibility.ts +60 -0
- package/src/dev.ts +39 -0
- package/src/events.ts +76 -0
- package/src/index.tsx +64 -0
- package/src/shapes.ts +184 -0
- package/src/storage.ts +114 -0
- package/src/themes.ts +83 -0
- package/src/types.ts +648 -0
- package/src/useTourPersistence.ts +147 -0
- package/src/useTourScroll.ts +60 -0
- package/src/utils.ts +401 -0
- package/src/validation.ts +248 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateRef = exports.scrollRefToY = exports.resolveSafeAreaInsets = exports.resolvePlatformConfig = exports.resolveInsets = exports.osValue = exports.isLightColor = exports.extractBorderRadius = exports.computeTooltipPosition = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _dev = require("./dev.js");
|
|
9
|
+
const ZERO_INSETS = {
|
|
10
|
+
top: 0,
|
|
11
|
+
bottom: 0,
|
|
12
|
+
left: 0,
|
|
13
|
+
right: 0
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Compute the best tooltip position based on available screen space.
|
|
18
|
+
* Prefers: bottom > top > right > left.
|
|
19
|
+
* `insets` shrink the usable area so the tour avoids system chrome.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const computeTooltipPosition = ({
|
|
23
|
+
target,
|
|
24
|
+
screenWidth,
|
|
25
|
+
screenHeight,
|
|
26
|
+
tooltipWidth,
|
|
27
|
+
tooltipHeight = 150,
|
|
28
|
+
offset = 20,
|
|
29
|
+
insets = ZERO_INSETS
|
|
30
|
+
}) => {
|
|
31
|
+
const spaceAbove = target.y - offset - insets.top;
|
|
32
|
+
const spaceBelow = screenHeight - insets.bottom - (target.y + target.height + offset);
|
|
33
|
+
const spaceLeft = target.x - offset - insets.left;
|
|
34
|
+
const spaceRight = screenWidth - insets.right - (target.x + target.width + offset);
|
|
35
|
+
if (spaceBelow >= tooltipHeight) return 'bottom';
|
|
36
|
+
if (spaceAbove >= tooltipHeight) return 'top';
|
|
37
|
+
if (spaceRight >= tooltipWidth * 0.6) return 'right';
|
|
38
|
+
if (spaceLeft >= tooltipWidth * 0.6) return 'left';
|
|
39
|
+
return spaceBelow >= spaceAbove ? 'bottom' : 'top';
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Cache the safe-area lookup from react-native-safe-area-context (optional dep).
|
|
43
|
+
// `undefined` = not resolved yet, `null` = lib unavailable.
|
|
44
|
+
exports.computeTooltipPosition = computeTooltipPosition;
|
|
45
|
+
let _autoInsets;
|
|
46
|
+
const getAutoInsets = () => {
|
|
47
|
+
if (_autoInsets === undefined) {
|
|
48
|
+
try {
|
|
49
|
+
// initialWindowMetrics is a synchronous snapshot — no hook required, so
|
|
50
|
+
// this works from plain functions and is set once at app launch.
|
|
51
|
+
|
|
52
|
+
const mod = require('react-native-safe-area-context');
|
|
53
|
+
const metricsInsets = mod?.initialWindowMetrics?.insets;
|
|
54
|
+
_autoInsets = metricsInsets ? {
|
|
55
|
+
top: metricsInsets.top ?? 0,
|
|
56
|
+
bottom: metricsInsets.bottom ?? 0,
|
|
57
|
+
left: metricsInsets.left ?? 0,
|
|
58
|
+
right: metricsInsets.right ?? 0
|
|
59
|
+
} : null;
|
|
60
|
+
} catch {
|
|
61
|
+
_autoInsets = null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (_autoInsets) return _autoInsets;
|
|
65
|
+
// Fallback: Android status-bar height for the top edge; nothing reliable for
|
|
66
|
+
// the bottom without the safe-area lib, so consumers should pass `insets`.
|
|
67
|
+
const top = _reactNative.Platform.OS === 'android' ? _reactNative.StatusBar.currentHeight ?? 0 : 0;
|
|
68
|
+
return {
|
|
69
|
+
top,
|
|
70
|
+
bottom: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
right: 0
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Resolve just the safe-area insets (auto-detected, or overridden via
|
|
78
|
+
* `config.insets`) — WITHOUT any `extraInsets`. This is the value that mirrors
|
|
79
|
+
* system chrome like the status bar, and is what corrects `measureInWindow`
|
|
80
|
+
* coordinates on Android (see TourGuideOverlay).
|
|
81
|
+
*/
|
|
82
|
+
const resolveSafeAreaInsets = config => {
|
|
83
|
+
const auto = getAutoInsets();
|
|
84
|
+
return {
|
|
85
|
+
top: config?.insets?.top ?? auto.top,
|
|
86
|
+
bottom: config?.insets?.bottom ?? auto.bottom,
|
|
87
|
+
left: config?.insets?.left ?? auto.left,
|
|
88
|
+
right: config?.insets?.right ?? auto.right
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Resolve the effective insets the tour should respect for layout/clamping:
|
|
94
|
+
* the safe area plus any `config.extraInsets` for app chrome like tab bars and
|
|
95
|
+
* headers.
|
|
96
|
+
*/
|
|
97
|
+
exports.resolveSafeAreaInsets = resolveSafeAreaInsets;
|
|
98
|
+
const resolveInsets = config => {
|
|
99
|
+
const base = resolveSafeAreaInsets(config);
|
|
100
|
+
const extra = config?.extraInsets;
|
|
101
|
+
return {
|
|
102
|
+
top: base.top + (extra?.top ?? 0),
|
|
103
|
+
bottom: base.bottom + (extra?.bottom ?? 0),
|
|
104
|
+
left: base.left + (extra?.left ?? 0),
|
|
105
|
+
right: base.right + (extra?.right ?? 0)
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Validate that a ref is valid and points to a mounted component.
|
|
111
|
+
* Returns true if valid, false otherwise.
|
|
112
|
+
*/
|
|
113
|
+
exports.resolveInsets = resolveInsets;
|
|
114
|
+
const validateRef = (ref, stepId) => {
|
|
115
|
+
// No ref at all is an intentional, supported case: a centered tooltip with no
|
|
116
|
+
// spotlight (e.g. a welcome/finish step). Don't warn — it's not a mistake.
|
|
117
|
+
if (!ref) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// A ref was provided but points to nothing — this usually IS a mistake
|
|
122
|
+
// (component not mounted yet / wrong ref), so it's worth a dev warning.
|
|
123
|
+
if (!ref.current) {
|
|
124
|
+
(0, _dev.warnOnce)(`Step "${stepId}" has a targetRef whose .current is null, so there is nothing to highlight. Showing a centered tooltip instead.`, 'Attach the ref to a rendered host component (e.g. <View ref={ref}>) and make sure it is mounted before startTour() runs.');
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Extract border radius values from a View style.
|
|
132
|
+
* Returns a SpotlightBorderRadius (number if uniform, object if per-corner),
|
|
133
|
+
* or undefined if no border radius is specified.
|
|
134
|
+
*
|
|
135
|
+
* Percentage radii (e.g. `'50%'`, supported by React Native 0.76+) are resolved
|
|
136
|
+
* against the target's shorter side when `target` dimensions are provided — this
|
|
137
|
+
* is what keeps a circular avatar (`borderRadius: '50%'`) round instead of square.
|
|
138
|
+
* Without `target`, percentages fall back to the numeric base/0.
|
|
139
|
+
*/
|
|
140
|
+
exports.validateRef = validateRef;
|
|
141
|
+
const extractBorderRadius = (style, target) => {
|
|
142
|
+
if (!style) return undefined;
|
|
143
|
+
const flat = _reactNative.StyleSheet.flatten(style);
|
|
144
|
+
if (!flat) return undefined;
|
|
145
|
+
const {
|
|
146
|
+
borderRadius,
|
|
147
|
+
borderTopLeftRadius,
|
|
148
|
+
borderTopRightRadius,
|
|
149
|
+
borderBottomLeftRadius,
|
|
150
|
+
borderBottomRightRadius
|
|
151
|
+
} = flat;
|
|
152
|
+
|
|
153
|
+
// No border radius properties at all
|
|
154
|
+
if (borderRadius === undefined && borderTopLeftRadius === undefined && borderTopRightRadius === undefined && borderBottomLeftRadius === undefined && borderBottomRightRadius === undefined) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// The shorter side: a radius of `minDim / 2` produces a circle (square target)
|
|
159
|
+
// or a pill (rectangular target), which is exactly how RN renders `'50%'`.
|
|
160
|
+
const minDim = target ? Math.min(target.width, target.height) : 0;
|
|
161
|
+
|
|
162
|
+
// Coerce to a number, resolving percentage strings against the target.
|
|
163
|
+
const toNum = (v, fallback) => {
|
|
164
|
+
if (typeof v === 'number') return v;
|
|
165
|
+
if (typeof v === 'string') {
|
|
166
|
+
const trimmed = v.trim();
|
|
167
|
+
if (trimmed.endsWith('%')) {
|
|
168
|
+
const pct = parseFloat(trimmed);
|
|
169
|
+
if (!Number.isNaN(pct) && minDim > 0) return pct / 100 * minDim;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return fallback;
|
|
173
|
+
};
|
|
174
|
+
const base = toNum(borderRadius, 0);
|
|
175
|
+
const tl = toNum(borderTopLeftRadius, base);
|
|
176
|
+
const tr = toNum(borderTopRightRadius, base);
|
|
177
|
+
const br = toNum(borderBottomRightRadius, base);
|
|
178
|
+
const bl = toNum(borderBottomLeftRadius, base);
|
|
179
|
+
|
|
180
|
+
// All corners the same → return number for smooth rect animation
|
|
181
|
+
if (tl === tr && tr === br && br === bl) {
|
|
182
|
+
return tl;
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
topLeft: tl,
|
|
186
|
+
topRight: tr,
|
|
187
|
+
bottomRight: br,
|
|
188
|
+
bottomLeft: bl
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Scroll a scrollable ref to an absolute Y offset.
|
|
194
|
+
*
|
|
195
|
+
* Consumers pass all kinds of scrollables, and each exposes a different imperative
|
|
196
|
+
* API — assuming `scrollTo` crashes with `scrollTo is not a function` on the most
|
|
197
|
+
* common one (`FlatList`). This normalises across:
|
|
198
|
+
*
|
|
199
|
+
* - `ScrollView` (and gesture-handler / Animated wrappers) → `scrollTo`
|
|
200
|
+
* - `FlatList` / `VirtualizedList` → `scrollToOffset`
|
|
201
|
+
* - `SectionList` and other list wrappers → `getScrollResponder()` / `getScrollRef()`
|
|
202
|
+
* - legacy `Animated.ScrollView` → `getNode()`
|
|
203
|
+
* - `KeyboardAwareScrollView` → `scrollToPosition`
|
|
204
|
+
*
|
|
205
|
+
* @returns true if a scroll was actually issued, false if the ref exposes no
|
|
206
|
+
* usable scroll method (the caller should then continue without scrolling
|
|
207
|
+
* rather than leaving the tour stuck).
|
|
208
|
+
*/
|
|
209
|
+
exports.extractBorderRadius = extractBorderRadius;
|
|
210
|
+
const scrollRefToY = (scrollRef, y, animated) => {
|
|
211
|
+
const node = scrollRef?.current;
|
|
212
|
+
if (!node) return false;
|
|
213
|
+
const targetY = Math.max(0, y);
|
|
214
|
+
|
|
215
|
+
// Unwrap legacy Animated.ScrollView / list wrappers that hide the real
|
|
216
|
+
// scrollable behind a getter.
|
|
217
|
+
const candidates = [node];
|
|
218
|
+
for (const getter of ['getNode', 'getScrollResponder', 'getScrollRef']) {
|
|
219
|
+
try {
|
|
220
|
+
if (typeof node[getter] === 'function') {
|
|
221
|
+
const inner = node[getter]();
|
|
222
|
+
if (inner) candidates.push(inner);
|
|
223
|
+
}
|
|
224
|
+
} catch {
|
|
225
|
+
// A getter that throws (unmounted inner list) is not usable — skip it.
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
for (const c of candidates) {
|
|
229
|
+
try {
|
|
230
|
+
if (typeof c.scrollTo === 'function') {
|
|
231
|
+
c.scrollTo({
|
|
232
|
+
x: 0,
|
|
233
|
+
y: targetY,
|
|
234
|
+
animated
|
|
235
|
+
});
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
if (typeof c.scrollToOffset === 'function') {
|
|
239
|
+
c.scrollToOffset({
|
|
240
|
+
offset: targetY,
|
|
241
|
+
animated
|
|
242
|
+
});
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
if (typeof c.scrollToPosition === 'function') {
|
|
246
|
+
c.scrollToPosition(0, targetY, animated);
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
} catch {
|
|
250
|
+
// Try the next candidate rather than taking the whole tour down.
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return false;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// ─── Color parsing for readable-by-default tooltips ──────────────────────────
|
|
257
|
+
exports.scrollRefToY = scrollRefToY;
|
|
258
|
+
const NAMED_COLORS = {
|
|
259
|
+
white: '#ffffff',
|
|
260
|
+
black: '#000000',
|
|
261
|
+
gray: '#808080',
|
|
262
|
+
grey: '#808080',
|
|
263
|
+
red: '#ff0000',
|
|
264
|
+
blue: '#0000ff',
|
|
265
|
+
green: '#008000',
|
|
266
|
+
yellow: '#ffff00',
|
|
267
|
+
orange: '#ffa500',
|
|
268
|
+
purple: '#800080',
|
|
269
|
+
transparent: '#00000000'
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Whether a background color is light (true), dark (false), or unparseable
|
|
274
|
+
* (null). Supports #rgb/#rgba/#rrggbb/#rrggbbaa, rgb()/rgba(), and a handful of
|
|
275
|
+
* common named colors — enough for the tooltip-background use case; anything
|
|
276
|
+
* exotic returns null and callers keep their existing defaults.
|
|
277
|
+
*
|
|
278
|
+
* Used to pick readable default text colors when a consumer sets a custom
|
|
279
|
+
* tooltip background: a pale background used to get the built-in white title
|
|
280
|
+
* text, which is invisible.
|
|
281
|
+
*/
|
|
282
|
+
const isLightColor = color => {
|
|
283
|
+
if (typeof color !== 'string') return null;
|
|
284
|
+
let c = color.trim().toLowerCase();
|
|
285
|
+
c = NAMED_COLORS[c] ?? c;
|
|
286
|
+
let r, g, b;
|
|
287
|
+
const rgbMatch = c.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/);
|
|
288
|
+
if (rgbMatch) {
|
|
289
|
+
r = parseFloat(rgbMatch[1]);
|
|
290
|
+
g = parseFloat(rgbMatch[2]);
|
|
291
|
+
b = parseFloat(rgbMatch[3]);
|
|
292
|
+
} else if (/^#[0-9a-f]{3,8}$/.test(c)) {
|
|
293
|
+
const hex = c.slice(1);
|
|
294
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
295
|
+
r = parseInt(hex[0] + hex[0], 16);
|
|
296
|
+
g = parseInt(hex[1] + hex[1], 16);
|
|
297
|
+
b = parseInt(hex[2] + hex[2], 16);
|
|
298
|
+
} else if (hex.length === 6 || hex.length === 8) {
|
|
299
|
+
r = parseInt(hex.slice(0, 2), 16);
|
|
300
|
+
g = parseInt(hex.slice(2, 4), 16);
|
|
301
|
+
b = parseInt(hex.slice(4, 6), 16);
|
|
302
|
+
} else {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
if ([r, g, b].some(v => Number.isNaN(v) || v < 0 || v > 255)) return null;
|
|
309
|
+
|
|
310
|
+
// Perceived brightness (ITU-R BT.601), same scale tinycolor uses: 0-255.
|
|
311
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
312
|
+
return brightness > 180;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// ─── Per-platform config values ──────────────────────────────────────────────
|
|
316
|
+
exports.isLightColor = isLightColor;
|
|
317
|
+
const OS_KEYS = new Set(['ios', 'android', 'web', 'default']);
|
|
318
|
+
const isOSConfig = value => {
|
|
319
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;
|
|
320
|
+
const keys = Object.keys(value);
|
|
321
|
+
return keys.length > 0 && keys.every(k => OS_KEYS.has(k));
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Resolve a possibly per-platform value for the running OS.
|
|
326
|
+
* `{ ios: 12, default: 8 }` → 12 on iOS, 8 elsewhere.
|
|
327
|
+
*/
|
|
328
|
+
const osValue = value => {
|
|
329
|
+
if (value === undefined || !isOSConfig(value)) return value;
|
|
330
|
+
const perOS = value;
|
|
331
|
+
return perOS[_reactNative.Platform.OS] ?? perOS.default;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
// A typo'd OS key ({ iOS: 320 } or { web: 12, macos: 10 }) makes the object
|
|
335
|
+
// fail the OS-config signature check, so it passes through UNRESOLVED and
|
|
336
|
+
// reaches layout math as a raw object. Diagnose that in dev.
|
|
337
|
+
exports.osValue = osValue;
|
|
338
|
+
const warnIfMalformedOSConfig = (field, value) => {
|
|
339
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value) || isOSConfig(value)) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const keys = Object.keys(value);
|
|
343
|
+
// Only flag objects that LOOK like an attempted per-platform value.
|
|
344
|
+
if (keys.some(k => OS_KEYS.has(k)) || keys.some(k => /^(ios|android|web)$/i.test(k))) {
|
|
345
|
+
(0, _dev.warnOnce)(`config.${field} looks like a per-platform value but has unrecognised keys (${keys.join(', ')}), so it was not resolved.`, 'Use exactly { ios, android, web, default } — lowercase — e.g. { ios: 320, default: 300 }.');
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Resolve every PerPlatform field of a tour config for the running OS.
|
|
351
|
+
* Called once in startTour, so everything downstream reads plain values.
|
|
352
|
+
*/
|
|
353
|
+
const resolvePlatformConfig = config => {
|
|
354
|
+
if (!config) return config;
|
|
355
|
+
warnIfMalformedOSConfig('animationDuration', config.animationDuration);
|
|
356
|
+
warnIfMalformedOSConfig('motion', config.motion);
|
|
357
|
+
warnIfMalformedOSConfig('safeZoneOffset', config.safeZoneOffset);
|
|
358
|
+
warnIfMalformedOSConfig('tooltipWidth', config.tooltipWidth);
|
|
359
|
+
warnIfMalformedOSConfig('triangleSize', config.triangleSize);
|
|
360
|
+
warnIfMalformedOSConfig('tooltipOffset', config.tooltipOffset);
|
|
361
|
+
return {
|
|
362
|
+
...config,
|
|
363
|
+
animationDuration: osValue(config.animationDuration),
|
|
364
|
+
motion: osValue(config.motion),
|
|
365
|
+
safeZoneOffset: osValue(config.safeZoneOffset),
|
|
366
|
+
tooltipWidth: osValue(config.tooltipWidth),
|
|
367
|
+
triangleSize: osValue(config.triangleSize),
|
|
368
|
+
tooltipOffset: osValue(config.tooltipOffset)
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
exports.resolvePlatformConfig = resolvePlatformConfig;
|
|
372
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_dev","ZERO_INSETS","top","bottom","left","right","computeTooltipPosition","target","screenWidth","screenHeight","tooltipWidth","tooltipHeight","offset","insets","spaceAbove","y","spaceBelow","height","spaceLeft","x","spaceRight","width","exports","_autoInsets","getAutoInsets","undefined","mod","metricsInsets","initialWindowMetrics","Platform","OS","StatusBar","currentHeight","resolveSafeAreaInsets","config","auto","resolveInsets","base","extra","extraInsets","validateRef","ref","stepId","current","warnOnce","extractBorderRadius","style","flat","StyleSheet","flatten","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","minDim","Math","min","toNum","v","fallback","trimmed","trim","endsWith","pct","parseFloat","Number","isNaN","tl","tr","br","bl","topLeft","topRight","bottomRight","bottomLeft","scrollRefToY","scrollRef","animated","node","targetY","max","candidates","getter","inner","push","c","scrollTo","scrollToOffset","scrollToPosition","NAMED_COLORS","white","black","gray","grey","red","blue","green","yellow","orange","purple","transparent","isLightColor","color","toLowerCase","r","g","b","rgbMatch","match","test","hex","slice","length","parseInt","some","brightness","OS_KEYS","Set","isOSConfig","value","Array","isArray","keys","Object","every","k","has","osValue","perOS","default","warnIfMalformedOSConfig","field","join","resolvePlatformConfig","animationDuration","motion","safeZoneOffset","triangleSize","tooltipOffset"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAYA,IAAAC,IAAA,GAAAD,OAAA;AAGA,MAAME,WAAuB,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,MAAM,EAAE,CAAC;EAAEC,IAAI,EAAE,CAAC;EAAEC,KAAK,EAAE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Y,EAAEsH,OAAO,CAAC9F,MAAM,CAACxB,YAAY,CAAC;IAC1CgI,YAAY,EAAEV,OAAO,CAAC9F,MAAM,CAACwG,YAAY,CAAC;IAC1CC,aAAa,EAAEX,OAAO,CAAC9F,MAAM,CAACyG,aAAa;EAC7C,CAAC;AACH,CAAC;AAACrH,OAAA,CAAAgH,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateTour = void 0;
|
|
7
|
+
var _dev = require("./dev.js");
|
|
8
|
+
const VALID_POSITIONS = ['top', 'bottom', 'left', 'right', 'auto'];
|
|
9
|
+
const VALID_MOTIONS = ['morph', 'bounce', 'fade', 'none'];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Does this value look like a React ref object (`{ current: ... }`)?
|
|
13
|
+
* Callback refs and bare component instances are the two things people pass by
|
|
14
|
+
* mistake, and both fail silently at measure time — so we detect them up front.
|
|
15
|
+
*/
|
|
16
|
+
const looksLikeRef = value => typeof value === 'object' && value !== null && 'current' in value;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Validate tour steps and config in development and report actionable warnings.
|
|
20
|
+
*
|
|
21
|
+
* Every check here corresponds to a mistake that otherwise fails *silently* at
|
|
22
|
+
* runtime — the tour simply does nothing, or shows a centered tooltip with no
|
|
23
|
+
* explanation — which is the hardest class of bug to diagnose from the outside.
|
|
24
|
+
* Runs only in dev; it is a no-op in production builds.
|
|
25
|
+
*/
|
|
26
|
+
const validateTour = (steps, config) => {
|
|
27
|
+
if (!(0, _dev.isDev)()) return;
|
|
28
|
+
if (!Array.isArray(steps)) {
|
|
29
|
+
(0, _dev.warn)(`startTour() was called with ${typeof steps} instead of an array of steps.`, 'Pass an array: startTour([{ id, title, description }]).');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (steps.length === 0) {
|
|
33
|
+
(0, _dev.warn)('startTour() was called with an empty steps array, so there is nothing to show.', 'Pass at least one step, and build the array before calling startTour().');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const seenIds = new Set();
|
|
37
|
+
steps.forEach((step, index) => {
|
|
38
|
+
const where = `Step ${index}${step?.id ? ` ("${step.id}")` : ''}`;
|
|
39
|
+
if (!step || typeof step !== 'object') {
|
|
40
|
+
(0, _dev.warn)(`${where} is not an object.`, 'Each step must be an object with id, title and description.');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --- id ---
|
|
45
|
+
if (!step.id) {
|
|
46
|
+
(0, _dev.warn)(`${where} has no "id".`, 'Give every step a unique string id — it is used for React keys and warnings.');
|
|
47
|
+
} else if (seenIds.has(step.id)) {
|
|
48
|
+
(0, _dev.warn)(`${where} reuses the id "${step.id}", which is already used by an earlier step.`, 'Make every step id unique so steps can be told apart.');
|
|
49
|
+
} else {
|
|
50
|
+
seenIds.add(step.id);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// --- content ---
|
|
54
|
+
if (typeof step.title !== 'string' || step.title.length === 0) {
|
|
55
|
+
(0, _dev.warn)(`${where} has no "title".`, 'Provide a non-empty title string; it is the tooltip heading.');
|
|
56
|
+
}
|
|
57
|
+
if (typeof step.description !== 'string' || step.description.length === 0) {
|
|
58
|
+
(0, _dev.warn)(`${where} has no "description".`, 'Provide a non-empty description string; it is the tooltip body.');
|
|
59
|
+
}
|
|
60
|
+
if (step.targetRegion !== undefined) {
|
|
61
|
+
const r = step.targetRegion;
|
|
62
|
+
if (typeof r !== 'object' || r === null || [r.x, r.y, r.width, r.height].some(v => typeof v !== 'number' || Number.isNaN(v)) || r.width <= 0 || r.height <= 0) {
|
|
63
|
+
(0, _dev.warn)(`${where} has an invalid targetRegion — it needs numeric x, y and positive width/height in window px.`, 'Example: targetRegion: { x: 24, y: 120, width: 200, height: 80 }.');
|
|
64
|
+
}
|
|
65
|
+
if (step.targetRef !== undefined || step.targetId !== undefined) {
|
|
66
|
+
(0, _dev.warn)(`${where} sets targetRegion together with targetRef/targetId — targetRegion wins and the others are ignored.`, 'Use one targeting method per step.');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (step.motion !== undefined && !VALID_MOTIONS.includes(step.motion)) {
|
|
70
|
+
(0, _dev.warn)(`${where} has motion "${step.motion}", which is not valid.`, `Use one of: ${VALID_MOTIONS.join(', ')}.`);
|
|
71
|
+
}
|
|
72
|
+
if (step.targetRef !== undefined && step.targetId !== undefined) {
|
|
73
|
+
(0, _dev.warn)(`${where} sets both targetRef and targetId — targetRef wins and targetId is ignored.`, 'Use one or the other.');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// --- targetRef: the single most common wiring mistake ---
|
|
77
|
+
if (step.targetRef !== undefined && !looksLikeRef(step.targetRef)) {
|
|
78
|
+
(0, _dev.warn)(`${where} has a "targetRef" that is not a ref object (received ${typeof step.targetRef}).`, 'Pass the ref itself, not its value: targetRef={myRef} where const myRef = useRef(null). Callback refs are not supported.');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// --- tooltipPosition ---
|
|
82
|
+
if (step.tooltipPosition !== undefined && !VALID_POSITIONS.includes(step.tooltipPosition)) {
|
|
83
|
+
(0, _dev.warn)(`${where} has tooltipPosition "${step.tooltipPosition}", which is not valid.`, `Use one of: ${VALID_POSITIONS.join(', ')}.`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// --- numeric options ---
|
|
87
|
+
if (step.spotlightPadding !== undefined) {
|
|
88
|
+
const pads = typeof step.spotlightPadding === 'number' ? [step.spotlightPadding] : Object.values(step.spotlightPadding);
|
|
89
|
+
if (pads.some(v => typeof v === 'number' && v < 0)) {
|
|
90
|
+
(0, _dev.warn)(`${where} has a negative spotlightPadding, which shrinks the spotlight below the target.`, 'Use values >= 0.');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (step.autoAdvance !== undefined && step.autoAdvance > 0 && step.autoAdvance < 500) {
|
|
94
|
+
(0, _dev.warn)(`${where} sets autoAdvance to ${step.autoAdvance}ms, which is too fast to read.`, 'Use at least 500ms, or 0 to disable auto-advance.');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// --- per-step scroll config ---
|
|
98
|
+
const stepScroll = step.scrollToTarget;
|
|
99
|
+
if (stepScroll && !looksLikeRef(stepScroll.scrollRef)) {
|
|
100
|
+
(0, _dev.warn)(`${where} has scrollToTarget.scrollRef that is not a ref object.`, 'Pass the ScrollView/FlatList ref itself: scrollRef={scrollViewRef}.');
|
|
101
|
+
}
|
|
102
|
+
if (stepScroll?.getCurrentScrollOffset !== undefined && typeof stepScroll.getCurrentScrollOffset !== 'function') {
|
|
103
|
+
(0, _dev.warn)(`${where} has scrollToTarget.getCurrentScrollOffset that is not a function.`, 'Pass a getter function: getCurrentScrollOffset: () => scrollY.');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// --- hiding every control on a step traps the user ---
|
|
107
|
+
if (step.hideNextButton && step.hideSkipButton && !step.autoAdvance) {
|
|
108
|
+
(0, _dev.warn)(`${where} hides both the next and skip buttons with no autoAdvance, leaving no way to continue the tour.`, 'Keep one of them visible, set autoAdvance, or handle advancing yourself via onSpotlightPress / backdropBehavior.');
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (steps.some(st => st?.interactive) && config?.overlayMode !== 'inline') {
|
|
112
|
+
(0, _dev.warn)("A step sets interactive: true but config.overlayMode is not 'inline', so the Modal overlay will swallow the touches anyway.", "Set overlayMode: 'inline' on the tour config to let touches reach the highlighted element.");
|
|
113
|
+
}
|
|
114
|
+
validateConfig(config);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** Validate the tour-level config. Dev only. */
|
|
118
|
+
exports.validateTour = validateTour;
|
|
119
|
+
const validateConfig = config => {
|
|
120
|
+
if (!config) return;
|
|
121
|
+
if (config.scrollRef !== undefined && !looksLikeRef(config.scrollRef)) {
|
|
122
|
+
(0, _dev.warn)(`config.scrollRef is not a ref object (received ${typeof config.scrollRef}).`, 'Pass the ref itself: scrollRef: scrollViewRef, where const scrollViewRef = useRef(null).');
|
|
123
|
+
}
|
|
124
|
+
if (config.getCurrentScrollOffset !== undefined && typeof config.getCurrentScrollOffset !== 'function') {
|
|
125
|
+
(0, _dev.warn)('config.getCurrentScrollOffset is not a function.', 'Pass a getter: getCurrentScrollOffset: () => scrollY.');
|
|
126
|
+
}
|
|
127
|
+
if (config.renderTooltip !== undefined && typeof config.renderTooltip !== 'function') {
|
|
128
|
+
(0, _dev.warn)('config.renderTooltip is not a function.', 'Pass a render function: renderTooltip: (props) => <MyTooltip {...props} />.');
|
|
129
|
+
}
|
|
130
|
+
if (config.animationDuration !== undefined && config.animationDuration < 0) {
|
|
131
|
+
(0, _dev.warn)('config.animationDuration is negative.', 'Use 0 to disable animation, or a positive duration in ms.');
|
|
132
|
+
}
|
|
133
|
+
if (config.motion !== undefined && !VALID_MOTIONS.includes(config.motion)) {
|
|
134
|
+
(0, _dev.warn)(`config.motion "${config.motion}" is not valid.`, `Use one of: ${VALID_MOTIONS.join(', ')}.`);
|
|
135
|
+
}
|
|
136
|
+
if (config.spotlightStyles?.maskPath !== undefined && typeof config.spotlightStyles.maskPath !== 'function') {
|
|
137
|
+
(0, _dev.warn)('config.spotlightStyles.maskPath is not a function.', 'Pass a function returning an SVG subpath: maskPath: ({ bounds }) => `M…Z`.');
|
|
138
|
+
}
|
|
139
|
+
if (config.tooltipWidth !== undefined && config.tooltipWidth <= 0) {
|
|
140
|
+
(0, _dev.warn)('config.tooltipWidth must be greater than 0.', 'Remove it to use the 320px default.');
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dev","require","VALID_POSITIONS","VALID_MOTIONS","looksLikeRef","value","validateTour","steps","config","isDev","Array","isArray","warn","length","seenIds","Set","forEach","step","index","where","id","has","add","title","description","targetRegion","undefined","r","x","y","width","height","some","v","Number","isNaN","targetRef","targetId","motion","includes","join","tooltipPosition","spotlightPadding","pads","Object","values","autoAdvance","stepScroll","scrollToTarget","scrollRef","getCurrentScrollOffset","hideNextButton","hideSkipButton","st","interactive","overlayMode","validateConfig","exports","renderTooltip","animationDuration","spotlightStyles","maskPath","tooltipWidth"],"sourceRoot":"../../src","sources":["validation.ts"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC;AAClE,MAAMC,aAAa,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;;AAEzD;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAIC,KAAc,IAClC,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAI,SAAS,IAAKA,KAAgB;;AAE/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,GAAGA,CAACC,KAAiB,EAAEC,MAAgC,KAAW;EACzF,IAAI,CAAC,IAAAC,UAAK,EAAC,CAAC,EAAE;EAEd,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;IACzB,IAAAK,SAAI,EACF,+BAA+B,OAAOL,KAAK,gCAAgC,EAC3E,yDACF,CAAC;IACD;EACF;EAEA,IAAIA,KAAK,CAACM,MAAM,KAAK,CAAC,EAAE;IACtB,IAAAD,SAAI,EACF,gFAAgF,EAChF,yEACF,CAAC;IACD;EACF;EAEA,MAAME,OAAO,GAAG,IAAIC,GAAG,CAAS,CAAC;EAEjCR,KAAK,CAACS,OAAO,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;IAC7B,MAAMC,KAAK,GAAG,QAAQD,KAAK,GAAG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