panelui-native 0.65.0 → 0.68.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 +21 -1
- package/lib/module/components/area-chart/index.js +18 -1
- package/lib/module/components/area-chart/index.js.map +1 -1
- package/lib/module/components/bar-chart/index.js +18 -1
- package/lib/module/components/bar-chart/index.js.map +1 -1
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/candlestick-chart/index.js +18 -1
- package/lib/module/components/candlestick-chart/index.js.map +1 -1
- package/lib/module/components/carousel/carousel-lifecycle.js +51 -0
- package/lib/module/components/carousel/carousel-lifecycle.js.map +1 -0
- package/lib/module/components/carousel/index.js +61 -24
- package/lib/module/components/carousel/index.js.map +1 -1
- package/lib/module/components/context-menu/context-menu-invocation.js +23 -0
- package/lib/module/components/context-menu/context-menu-invocation.js.map +1 -0
- package/lib/module/components/context-menu/index.js +78 -9
- package/lib/module/components/context-menu/index.js.map +1 -1
- package/lib/module/components/dialog/index.js.map +1 -1
- package/lib/module/components/drawer/index.js.map +1 -1
- package/lib/module/components/flow/flow-accessibility.js +18 -2
- package/lib/module/components/flow/flow-accessibility.js.map +1 -1
- package/lib/module/components/flow/flow-identifiers.js +81 -0
- package/lib/module/components/flow/flow-identifiers.js.map +1 -0
- package/lib/module/components/flow/index.js +12 -18
- package/lib/module/components/flow/index.js.map +1 -1
- package/lib/module/components/form/index.js +7 -5
- package/lib/module/components/form/index.js.map +1 -1
- package/lib/module/components/form/typed-form.js +11 -0
- package/lib/module/components/form/typed-form.js.map +1 -0
- package/lib/module/components/form/use-form.js +4 -0
- package/lib/module/components/form/use-form.js.map +1 -1
- package/lib/module/components/heatmap-chart/index.js +27 -1
- package/lib/module/components/heatmap-chart/index.js.map +1 -1
- package/lib/module/components/line-chart/index.js +18 -1
- package/lib/module/components/line-chart/index.js.map +1 -1
- package/lib/module/components/message-scroller/index.js +187 -17
- package/lib/module/components/message-scroller/index.js.map +1 -1
- package/lib/module/components/message-scroller/message-scroller-math.js +43 -0
- package/lib/module/components/message-scroller/message-scroller-math.js.map +1 -0
- package/lib/module/components/meter/index.js +250 -0
- package/lib/module/components/meter/index.js.map +1 -0
- package/lib/module/components/meter/meter-scale.js +88 -0
- package/lib/module/components/meter/meter-scale.js.map +1 -0
- package/lib/module/components/planner/index.js +714 -0
- package/lib/module/components/planner/index.js.map +1 -0
- package/lib/module/components/planner/planner-entries.js +124 -0
- package/lib/module/components/planner/planner-entries.js.map +1 -0
- package/lib/module/components/popover/index.js.map +1 -1
- package/lib/module/components/radar-chart/index.js +18 -1
- package/lib/module/components/radar-chart/index.js.map +1 -1
- package/lib/module/components/scatter-chart/index.js +18 -1
- package/lib/module/components/scatter-chart/index.js.map +1 -1
- package/lib/module/components/selection-mode/index.js +26 -31
- package/lib/module/components/selection-mode/index.js.map +1 -1
- package/lib/module/components/selection-mode/selection-mode-contracts.js +48 -0
- package/lib/module/components/selection-mode/selection-mode-contracts.js.map +1 -0
- package/lib/module/components/signature/index.js +62 -20
- package/lib/module/components/signature/index.js.map +1 -1
- package/lib/module/components/signature/signature-accessibility.js +58 -0
- package/lib/module/components/signature/signature-accessibility.js.map +1 -0
- package/lib/module/components/skeleton/index.js +45 -7
- package/lib/module/components/skeleton/index.js.map +1 -1
- package/lib/module/components/slider/index.js +22 -18
- package/lib/module/components/slider/index.js.map +1 -1
- package/lib/module/components/spinner/index.js +63 -14
- package/lib/module/components/spinner/index.js.map +1 -1
- package/lib/module/components/time-picker/index.js +46 -21
- package/lib/module/components/time-picker/index.js.map +1 -1
- package/lib/module/components/time-picker/ruler-window.js +25 -0
- package/lib/module/components/time-picker/ruler-window.js.map +1 -0
- package/lib/module/hooks/breakpoint-contract.js +29 -0
- package/lib/module/hooks/breakpoint-contract.js.map +1 -0
- package/lib/module/hooks/index.js +1 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/use-breakpoint.js +46 -1
- package/lib/module/hooks/use-breakpoint.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/primitives/chart-accessibility.js +68 -0
- package/lib/module/primitives/chart-accessibility.js.map +1 -0
- package/lib/module/primitives/scrim.js +94 -3
- package/lib/module/primitives/scrim.js.map +1 -1
- package/lib/typescript/src/components/area-chart/index.d.ts +2 -1
- package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bar-chart/index.d.ts +2 -1
- package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +3 -0
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/candlestick-chart/index.d.ts +2 -1
- package/lib/typescript/src/components/candlestick-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/carousel/carousel-lifecycle.d.ts +23 -0
- package/lib/typescript/src/components/carousel/carousel-lifecycle.d.ts.map +1 -0
- package/lib/typescript/src/components/carousel/index.d.ts +5 -2
- package/lib/typescript/src/components/carousel/index.d.ts.map +1 -1
- package/lib/typescript/src/components/context-menu/context-menu-invocation.d.ts +20 -0
- package/lib/typescript/src/components/context-menu/context-menu-invocation.d.ts.map +1 -0
- package/lib/typescript/src/components/context-menu/index.d.ts +18 -8
- package/lib/typescript/src/components/context-menu/index.d.ts.map +1 -1
- package/lib/typescript/src/components/dialog/index.d.ts +3 -0
- package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
- package/lib/typescript/src/components/drawer/index.d.ts +3 -0
- package/lib/typescript/src/components/drawer/index.d.ts.map +1 -1
- package/lib/typescript/src/components/flow/flow-accessibility.d.ts +8 -0
- package/lib/typescript/src/components/flow/flow-accessibility.d.ts.map +1 -1
- package/lib/typescript/src/components/flow/flow-identifiers.d.ts +24 -0
- package/lib/typescript/src/components/flow/flow-identifiers.d.ts.map +1 -0
- package/lib/typescript/src/components/flow/index.d.ts +6 -5
- package/lib/typescript/src/components/flow/index.d.ts.map +1 -1
- package/lib/typescript/src/components/form/index.d.ts +18 -5
- package/lib/typescript/src/components/form/index.d.ts.map +1 -1
- package/lib/typescript/src/components/form/typed-form.d.ts +7 -0
- package/lib/typescript/src/components/form/typed-form.d.ts.map +1 -0
- package/lib/typescript/src/components/form/use-form.d.ts +4 -0
- package/lib/typescript/src/components/form/use-form.d.ts.map +1 -1
- package/lib/typescript/src/components/heatmap-chart/index.d.ts +2 -1
- package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/line-chart/index.d.ts +2 -1
- package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message-scroller/index.d.ts +30 -2
- package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message-scroller/message-scroller-math.d.ts +18 -0
- package/lib/typescript/src/components/message-scroller/message-scroller-math.d.ts.map +1 -0
- package/lib/typescript/src/components/meter/index.d.ts +270 -0
- package/lib/typescript/src/components/meter/index.d.ts.map +1 -0
- package/lib/typescript/src/components/meter/meter-scale.d.ts +57 -0
- package/lib/typescript/src/components/meter/meter-scale.d.ts.map +1 -0
- package/lib/typescript/src/components/planner/index.d.ts +274 -0
- package/lib/typescript/src/components/planner/index.d.ts.map +1 -0
- package/lib/typescript/src/components/planner/planner-entries.d.ts +75 -0
- package/lib/typescript/src/components/planner/planner-entries.d.ts.map +1 -0
- package/lib/typescript/src/components/popover/index.d.ts +3 -0
- package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
- package/lib/typescript/src/components/radar-chart/index.d.ts +4 -0
- package/lib/typescript/src/components/radar-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/scatter-chart/index.d.ts +2 -1
- package/lib/typescript/src/components/scatter-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/selection-mode/index.d.ts +6 -4
- package/lib/typescript/src/components/selection-mode/index.d.ts.map +1 -1
- package/lib/typescript/src/components/selection-mode/selection-mode-contracts.d.ts +18 -0
- package/lib/typescript/src/components/selection-mode/selection-mode-contracts.d.ts.map +1 -0
- package/lib/typescript/src/components/signature/index.d.ts +6 -0
- package/lib/typescript/src/components/signature/index.d.ts.map +1 -1
- package/lib/typescript/src/components/signature/signature-accessibility.d.ts +27 -0
- package/lib/typescript/src/components/signature/signature-accessibility.d.ts.map +1 -0
- package/lib/typescript/src/components/skeleton/index.d.ts +25 -2
- package/lib/typescript/src/components/skeleton/index.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/index.d.ts +25 -2
- package/lib/typescript/src/components/spinner/index.d.ts.map +1 -1
- package/lib/typescript/src/components/time-picker/index.d.ts +5 -6
- package/lib/typescript/src/components/time-picker/index.d.ts.map +1 -1
- package/lib/typescript/src/components/time-picker/ruler-window.d.ts +12 -0
- package/lib/typescript/src/components/time-picker/ruler-window.d.ts.map +1 -0
- package/lib/typescript/src/hooks/breakpoint-contract.d.ts +6 -0
- package/lib/typescript/src/hooks/breakpoint-contract.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +1 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-breakpoint.d.ts +22 -0
- package/lib/typescript/src/hooks/use-breakpoint.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/chart-accessibility.d.ts +33 -0
- package/lib/typescript/src/primitives/chart-accessibility.d.ts.map +1 -0
- package/lib/typescript/src/primitives/scrim.d.ts +5 -3
- package/lib/typescript/src/primitives/scrim.d.ts.map +1 -1
- package/lib/typescript/types/form-api.type-test.d.ts +2 -0
- package/lib/typescript/types/form-api.type-test.d.ts.map +1 -0
- package/package.json +34 -5
- package/src/components/area-chart/index.tsx +27 -2
- package/src/components/bar-chart/index.tsx +27 -2
- package/src/components/bottom-sheet/index.tsx +3 -0
- package/src/components/candlestick-chart/index.tsx +30 -2
- package/src/components/carousel/carousel-lifecycle.ts +74 -0
- package/src/components/carousel/index.tsx +80 -25
- package/src/components/context-menu/context-menu-invocation.ts +44 -0
- package/src/components/context-menu/index.tsx +113 -13
- package/src/components/dialog/index.tsx +3 -0
- package/src/components/drawer/index.tsx +3 -0
- package/src/components/flow/flow-accessibility.ts +16 -2
- package/src/components/flow/flow-identifiers.ts +98 -0
- package/src/components/flow/index.tsx +29 -19
- package/src/components/form/index.tsx +32 -5
- package/src/components/form/typed-form.ts +13 -0
- package/src/components/form/use-form.ts +9 -0
- package/src/components/heatmap-chart/index.tsx +49 -3
- package/src/components/line-chart/index.tsx +27 -2
- package/src/components/message-scroller/index.tsx +273 -13
- package/src/components/message-scroller/message-scroller-math.ts +62 -0
- package/src/components/meter/index.tsx +318 -0
- package/src/components/meter/meter-scale.ts +109 -0
- package/src/components/planner/index.tsx +886 -0
- package/src/components/planner/planner-entries.ts +146 -0
- package/src/components/popover/index.tsx +3 -0
- package/src/components/radar-chart/index.tsx +24 -0
- package/src/components/scatter-chart/index.tsx +27 -2
- package/src/components/selection-mode/index.tsx +37 -30
- package/src/components/selection-mode/selection-mode-contracts.ts +53 -0
- package/src/components/signature/index.tsx +107 -20
- package/src/components/signature/signature-accessibility.ts +67 -0
- package/src/components/skeleton/index.tsx +59 -5
- package/src/components/slider/index.tsx +28 -18
- package/src/components/spinner/index.tsx +80 -13
- package/src/components/time-picker/index.tsx +57 -29
- package/src/components/time-picker/ruler-window.ts +24 -0
- package/src/hooks/breakpoint-contract.ts +31 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use-breakpoint.ts +61 -10
- package/src/index.ts +32 -0
- package/src/primitives/chart-accessibility.ts +102 -0
- package/src/primitives/scrim.tsx +127 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useEffect","View","Animated","useAnimatedStyle","useReducedMotion","useSharedValue","withSpring","withTiming","tv","Text","clamp","colorFor","fractionOf","formatValue","litSegments","jsx","_jsx","jsxs","_jsxs","SPRING","damping","stiffness","mass","SEGMENT_DURATION","SEGMENT_UNLIT","meterVariants","slots","root","header","track","indicator","segments","segment","variants","color","primary","success","warning","destructive","info","muted","size","sm","md","lg","defaultVariants","Segment","index","lit","className","reducedMotion","style","on","value","opacity","duration","Meter","indicatorClassName","headerClassName","minValue","maxValue","label","showValueLabel","valueLabel","formatOptions","thresholds","accessibilityLabel","props","ref","held","fraction","resolvedColor","trackWidth","progress","litCount","onLayout","event","nativeEvent","layout","width","fillStyle","spoken","showValue","hasHeader","accessibility","accessibilityRole","accessibilityValue","min","max","now","text","bar","children","Array","from","length","_","weight","numberOfLines","displayName"],"sourceRoot":"../../../../src","sources":["components/meter/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,IAAI,QAAgD,cAAc;AAC3E,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QAEL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SACEC,KAAK,EACLC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXC,WAAW,QAGN,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEvB,MAAMC,MAAM,GAAG;EAAEC,OAAO,EAAE,EAAE;EAAEC,SAAS,EAAE,GAAG;EAAEC,IAAI,EAAE;AAAI,CAAU;AAClE;AACA,MAAMC,gBAAgB,GAAG,GAAG;AAC5B;AACA,MAAMC,aAAa,GAAG,IAAI;AAE1B,MAAMC,aAAa,GAAGjB,EAAE,CAAC;EACvBkB,KAAK,EAAE;IACLC,IAAI,EAAE,cAAc;IACpBC,MAAM,EAAE,6CAA6C;IACrDC,KAAK,EAAE,qCAAqC;IAC5CC,SAAS,EAAE,qBAAqB;IAChCC,QAAQ,EAAE,iBAAiB;IAC3BC,OAAO,EA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ACgD,SAAS,EAAEvB,KAAK,CAACE,MAAM,CAAC;QAAEqB,SAAS,EAAES;MAAgB,CAAC,CAAE;MAAAkC,QAAA,GAC3D/B,KAAK,IAAI,IAAI,gBACZ7C,IAAA,CAACP,IAAI;QAACgC,IAAI,EAAC,IAAI;QAACwD,MAAM,EAAC,QAAQ;QAACC,aAAa,EAAE,CAAE;QAAAN,QAAA,EAC9C/B;MAAK,CACF,CAAC,gBAEP7C,IAAA,CAACf,IAAI,IAAE,CACR,EACAiF,SAAS,gBACRlE,IAAA,CAACP,IAAI;QAACgC,IAAI,EAAC,IAAI;QAACD,KAAK;QAAC0D,aAAa,EAAE,CAAE;QAAAN,QAAA,EACpCX;MAAM,CACH,CAAC,GACL,IAAI;IAAA,CACJ,CAAC,EACNU,GAAG;EAAA,CACA,CAAC;AAEX,CACF,CAAC;AAEDnC,KAAK,CAAC2C,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Where a reading sits on a meter's scale, and what colour it has earned.
|
|
5
|
+
*
|
|
6
|
+
* Kept apart from the component because it is the part that can be wrong
|
|
7
|
+
* without looking wrong: a threshold picked in the wrong order, or a segment
|
|
8
|
+
* count that rounds a real reading down to nothing, is a meter that lies
|
|
9
|
+
* quietly. None of it touches React, so it can be tested on its own.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** The token a meter can be painted with. */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A point on the scale, and the colour the meter takes from there upwards.
|
|
16
|
+
*
|
|
17
|
+
* `from` is in the same units as `value` — not a percentage of the range — so
|
|
18
|
+
* a threshold on a 0–8 GB meter is written in gigabytes.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** `value` held inside the scale, so a stray number cannot escape the track. */
|
|
22
|
+
export function clamp(value, min, max) {
|
|
23
|
+
if (!(value > min)) return min;
|
|
24
|
+
if (value > max) return max;
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* How far up the scale the value sits, 0–1. An empty or inverted range has no
|
|
30
|
+
* meaningful position in it, so it reads as empty rather than dividing by zero.
|
|
31
|
+
*/
|
|
32
|
+
export function fractionOf(value, min, max) {
|
|
33
|
+
const span = max - min;
|
|
34
|
+
if (!(span > 0)) return 0;
|
|
35
|
+
return clamp((value - min) / span, 0, 1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The colour the reading has earned: the highest threshold at or below the
|
|
40
|
+
* value, or the base colour when it has reached none of them.
|
|
41
|
+
*
|
|
42
|
+
* Highest-wins rather than first-wins, so the caller can list thresholds in
|
|
43
|
+
* any order and get the same answer. A rule that depended on the order would
|
|
44
|
+
* make a reordered array a silent behaviour change.
|
|
45
|
+
*/
|
|
46
|
+
export function colorFor(value, base, thresholds) {
|
|
47
|
+
if (!thresholds?.length) return base;
|
|
48
|
+
let winner;
|
|
49
|
+
for (const threshold of thresholds) {
|
|
50
|
+
if (value < threshold.from) continue;
|
|
51
|
+
if (!winner || threshold.from > winner.from) winner = threshold;
|
|
52
|
+
}
|
|
53
|
+
return winner?.color ?? base;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* How many blocks of a segmented meter are lit.
|
|
58
|
+
*
|
|
59
|
+
* Rounded up, so any reading above the floor lights at least one. Rounding
|
|
60
|
+
* down would leave the whole first block of a four-block meter dark, and "a
|
|
61
|
+
* little" looking like "none" is the reading a meter can least afford to get
|
|
62
|
+
* wrong.
|
|
63
|
+
*/
|
|
64
|
+
export function litSegments(fraction, segments) {
|
|
65
|
+
if (!(segments > 0)) return 0;
|
|
66
|
+
return Math.min(Math.ceil(fraction * segments), segments);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The value caption: an explicit override, an `Intl` rendering, or a rounded
|
|
71
|
+
* percent.
|
|
72
|
+
*
|
|
73
|
+
* A `percent` style is given the fraction, because that is what a percentage
|
|
74
|
+
* of the scale means; every other style is given the value, because a byte
|
|
75
|
+
* count or a score is a quantity and not a proportion.
|
|
76
|
+
*/
|
|
77
|
+
export function formatValue(value, fraction, valueLabel, formatOptions) {
|
|
78
|
+
if (valueLabel != null) return valueLabel;
|
|
79
|
+
if (formatOptions) {
|
|
80
|
+
try {
|
|
81
|
+
return new Intl.NumberFormat(undefined, formatOptions).format(formatOptions.style === 'percent' ? fraction : value);
|
|
82
|
+
} catch {
|
|
83
|
+
// Some engines ship a partial Intl; fall through to the plain percent.
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return `${Math.round(fraction * 100)}%`;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=meter-scale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["clamp","value","min","max","fractionOf","span","colorFor","base","thresholds","length","winner","threshold","from","color","litSegments","fraction","segments","Math","ceil","formatValue","valueLabel","formatOptions","Intl","NumberFormat","undefined","format","style","round"],"sourceRoot":"../../../../src","sources":["components/meter/meter-scale.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA,OAAO,SAASA,KAAKA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAE;EAC7D,IAAI,EAAEF,KAAK,GAAGC,GAAG,CAAC,EAAE,OAAOA,GAAG;EAC9B,IAAID,KAAK,GAAGE,GAAG,EAAE,OAAOA,GAAG;EAC3B,OAAOF,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,UAAUA,CAACH,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAE;EAClE,MAAME,IAAI,GAAGF,GAAG,GAAGD,GAAG;EACtB,IAAI,EAAEG,IAAI,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC;EACzB,OAAOL,K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