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.
Files changed (209) hide show
  1. package/README.md +21 -1
  2. package/lib/module/components/area-chart/index.js +18 -1
  3. package/lib/module/components/area-chart/index.js.map +1 -1
  4. package/lib/module/components/bar-chart/index.js +18 -1
  5. package/lib/module/components/bar-chart/index.js.map +1 -1
  6. package/lib/module/components/bottom-sheet/index.js.map +1 -1
  7. package/lib/module/components/candlestick-chart/index.js +18 -1
  8. package/lib/module/components/candlestick-chart/index.js.map +1 -1
  9. package/lib/module/components/carousel/carousel-lifecycle.js +51 -0
  10. package/lib/module/components/carousel/carousel-lifecycle.js.map +1 -0
  11. package/lib/module/components/carousel/index.js +61 -24
  12. package/lib/module/components/carousel/index.js.map +1 -1
  13. package/lib/module/components/context-menu/context-menu-invocation.js +23 -0
  14. package/lib/module/components/context-menu/context-menu-invocation.js.map +1 -0
  15. package/lib/module/components/context-menu/index.js +78 -9
  16. package/lib/module/components/context-menu/index.js.map +1 -1
  17. package/lib/module/components/dialog/index.js.map +1 -1
  18. package/lib/module/components/drawer/index.js.map +1 -1
  19. package/lib/module/components/flow/flow-accessibility.js +18 -2
  20. package/lib/module/components/flow/flow-accessibility.js.map +1 -1
  21. package/lib/module/components/flow/flow-identifiers.js +81 -0
  22. package/lib/module/components/flow/flow-identifiers.js.map +1 -0
  23. package/lib/module/components/flow/index.js +12 -18
  24. package/lib/module/components/flow/index.js.map +1 -1
  25. package/lib/module/components/form/index.js +7 -5
  26. package/lib/module/components/form/index.js.map +1 -1
  27. package/lib/module/components/form/typed-form.js +11 -0
  28. package/lib/module/components/form/typed-form.js.map +1 -0
  29. package/lib/module/components/form/use-form.js +4 -0
  30. package/lib/module/components/form/use-form.js.map +1 -1
  31. package/lib/module/components/heatmap-chart/index.js +27 -1
  32. package/lib/module/components/heatmap-chart/index.js.map +1 -1
  33. package/lib/module/components/line-chart/index.js +18 -1
  34. package/lib/module/components/line-chart/index.js.map +1 -1
  35. package/lib/module/components/message-scroller/index.js +187 -17
  36. package/lib/module/components/message-scroller/index.js.map +1 -1
  37. package/lib/module/components/message-scroller/message-scroller-math.js +43 -0
  38. package/lib/module/components/message-scroller/message-scroller-math.js.map +1 -0
  39. package/lib/module/components/meter/index.js +250 -0
  40. package/lib/module/components/meter/index.js.map +1 -0
  41. package/lib/module/components/meter/meter-scale.js +88 -0
  42. package/lib/module/components/meter/meter-scale.js.map +1 -0
  43. package/lib/module/components/planner/index.js +714 -0
  44. package/lib/module/components/planner/index.js.map +1 -0
  45. package/lib/module/components/planner/planner-entries.js +124 -0
  46. package/lib/module/components/planner/planner-entries.js.map +1 -0
  47. package/lib/module/components/popover/index.js.map +1 -1
  48. package/lib/module/components/radar-chart/index.js +18 -1
  49. package/lib/module/components/radar-chart/index.js.map +1 -1
  50. package/lib/module/components/scatter-chart/index.js +18 -1
  51. package/lib/module/components/scatter-chart/index.js.map +1 -1
  52. package/lib/module/components/selection-mode/index.js +26 -31
  53. package/lib/module/components/selection-mode/index.js.map +1 -1
  54. package/lib/module/components/selection-mode/selection-mode-contracts.js +48 -0
  55. package/lib/module/components/selection-mode/selection-mode-contracts.js.map +1 -0
  56. package/lib/module/components/signature/index.js +62 -20
  57. package/lib/module/components/signature/index.js.map +1 -1
  58. package/lib/module/components/signature/signature-accessibility.js +58 -0
  59. package/lib/module/components/signature/signature-accessibility.js.map +1 -0
  60. package/lib/module/components/skeleton/index.js +45 -7
  61. package/lib/module/components/skeleton/index.js.map +1 -1
  62. package/lib/module/components/slider/index.js +22 -18
  63. package/lib/module/components/slider/index.js.map +1 -1
  64. package/lib/module/components/spinner/index.js +63 -14
  65. package/lib/module/components/spinner/index.js.map +1 -1
  66. package/lib/module/components/time-picker/index.js +46 -21
  67. package/lib/module/components/time-picker/index.js.map +1 -1
  68. package/lib/module/components/time-picker/ruler-window.js +25 -0
  69. package/lib/module/components/time-picker/ruler-window.js.map +1 -0
  70. package/lib/module/hooks/breakpoint-contract.js +29 -0
  71. package/lib/module/hooks/breakpoint-contract.js.map +1 -0
  72. package/lib/module/hooks/index.js +1 -1
  73. package/lib/module/hooks/index.js.map +1 -1
  74. package/lib/module/hooks/use-breakpoint.js +46 -1
  75. package/lib/module/hooks/use-breakpoint.js.map +1 -1
  76. package/lib/module/index.js +3 -1
  77. package/lib/module/index.js.map +1 -1
  78. package/lib/module/primitives/chart-accessibility.js +68 -0
  79. package/lib/module/primitives/chart-accessibility.js.map +1 -0
  80. package/lib/module/primitives/scrim.js +94 -3
  81. package/lib/module/primitives/scrim.js.map +1 -1
  82. package/lib/typescript/src/components/area-chart/index.d.ts +2 -1
  83. package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -1
  84. package/lib/typescript/src/components/bar-chart/index.d.ts +2 -1
  85. package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -1
  86. package/lib/typescript/src/components/bottom-sheet/index.d.ts +3 -0
  87. package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
  88. package/lib/typescript/src/components/candlestick-chart/index.d.ts +2 -1
  89. package/lib/typescript/src/components/candlestick-chart/index.d.ts.map +1 -1
  90. package/lib/typescript/src/components/carousel/carousel-lifecycle.d.ts +23 -0
  91. package/lib/typescript/src/components/carousel/carousel-lifecycle.d.ts.map +1 -0
  92. package/lib/typescript/src/components/carousel/index.d.ts +5 -2
  93. package/lib/typescript/src/components/carousel/index.d.ts.map +1 -1
  94. package/lib/typescript/src/components/context-menu/context-menu-invocation.d.ts +20 -0
  95. package/lib/typescript/src/components/context-menu/context-menu-invocation.d.ts.map +1 -0
  96. package/lib/typescript/src/components/context-menu/index.d.ts +18 -8
  97. package/lib/typescript/src/components/context-menu/index.d.ts.map +1 -1
  98. package/lib/typescript/src/components/dialog/index.d.ts +3 -0
  99. package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
  100. package/lib/typescript/src/components/drawer/index.d.ts +3 -0
  101. package/lib/typescript/src/components/drawer/index.d.ts.map +1 -1
  102. package/lib/typescript/src/components/flow/flow-accessibility.d.ts +8 -0
  103. package/lib/typescript/src/components/flow/flow-accessibility.d.ts.map +1 -1
  104. package/lib/typescript/src/components/flow/flow-identifiers.d.ts +24 -0
  105. package/lib/typescript/src/components/flow/flow-identifiers.d.ts.map +1 -0
  106. package/lib/typescript/src/components/flow/index.d.ts +6 -5
  107. package/lib/typescript/src/components/flow/index.d.ts.map +1 -1
  108. package/lib/typescript/src/components/form/index.d.ts +18 -5
  109. package/lib/typescript/src/components/form/index.d.ts.map +1 -1
  110. package/lib/typescript/src/components/form/typed-form.d.ts +7 -0
  111. package/lib/typescript/src/components/form/typed-form.d.ts.map +1 -0
  112. package/lib/typescript/src/components/form/use-form.d.ts +4 -0
  113. package/lib/typescript/src/components/form/use-form.d.ts.map +1 -1
  114. package/lib/typescript/src/components/heatmap-chart/index.d.ts +2 -1
  115. package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
  116. package/lib/typescript/src/components/line-chart/index.d.ts +2 -1
  117. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
  118. package/lib/typescript/src/components/message-scroller/index.d.ts +30 -2
  119. package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -1
  120. package/lib/typescript/src/components/message-scroller/message-scroller-math.d.ts +18 -0
  121. package/lib/typescript/src/components/message-scroller/message-scroller-math.d.ts.map +1 -0
  122. package/lib/typescript/src/components/meter/index.d.ts +270 -0
  123. package/lib/typescript/src/components/meter/index.d.ts.map +1 -0
  124. package/lib/typescript/src/components/meter/meter-scale.d.ts +57 -0
  125. package/lib/typescript/src/components/meter/meter-scale.d.ts.map +1 -0
  126. package/lib/typescript/src/components/planner/index.d.ts +274 -0
  127. package/lib/typescript/src/components/planner/index.d.ts.map +1 -0
  128. package/lib/typescript/src/components/planner/planner-entries.d.ts +75 -0
  129. package/lib/typescript/src/components/planner/planner-entries.d.ts.map +1 -0
  130. package/lib/typescript/src/components/popover/index.d.ts +3 -0
  131. package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
  132. package/lib/typescript/src/components/radar-chart/index.d.ts +4 -0
  133. package/lib/typescript/src/components/radar-chart/index.d.ts.map +1 -1
  134. package/lib/typescript/src/components/scatter-chart/index.d.ts +2 -1
  135. package/lib/typescript/src/components/scatter-chart/index.d.ts.map +1 -1
  136. package/lib/typescript/src/components/selection-mode/index.d.ts +6 -4
  137. package/lib/typescript/src/components/selection-mode/index.d.ts.map +1 -1
  138. package/lib/typescript/src/components/selection-mode/selection-mode-contracts.d.ts +18 -0
  139. package/lib/typescript/src/components/selection-mode/selection-mode-contracts.d.ts.map +1 -0
  140. package/lib/typescript/src/components/signature/index.d.ts +6 -0
  141. package/lib/typescript/src/components/signature/index.d.ts.map +1 -1
  142. package/lib/typescript/src/components/signature/signature-accessibility.d.ts +27 -0
  143. package/lib/typescript/src/components/signature/signature-accessibility.d.ts.map +1 -0
  144. package/lib/typescript/src/components/skeleton/index.d.ts +25 -2
  145. package/lib/typescript/src/components/skeleton/index.d.ts.map +1 -1
  146. package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
  147. package/lib/typescript/src/components/spinner/index.d.ts +25 -2
  148. package/lib/typescript/src/components/spinner/index.d.ts.map +1 -1
  149. package/lib/typescript/src/components/time-picker/index.d.ts +5 -6
  150. package/lib/typescript/src/components/time-picker/index.d.ts.map +1 -1
  151. package/lib/typescript/src/components/time-picker/ruler-window.d.ts +12 -0
  152. package/lib/typescript/src/components/time-picker/ruler-window.d.ts.map +1 -0
  153. package/lib/typescript/src/hooks/breakpoint-contract.d.ts +6 -0
  154. package/lib/typescript/src/hooks/breakpoint-contract.d.ts.map +1 -0
  155. package/lib/typescript/src/hooks/index.d.ts +1 -1
  156. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  157. package/lib/typescript/src/hooks/use-breakpoint.d.ts +22 -0
  158. package/lib/typescript/src/hooks/use-breakpoint.d.ts.map +1 -1
  159. package/lib/typescript/src/index.d.ts +4 -2
  160. package/lib/typescript/src/index.d.ts.map +1 -1
  161. package/lib/typescript/src/primitives/chart-accessibility.d.ts +33 -0
  162. package/lib/typescript/src/primitives/chart-accessibility.d.ts.map +1 -0
  163. package/lib/typescript/src/primitives/scrim.d.ts +5 -3
  164. package/lib/typescript/src/primitives/scrim.d.ts.map +1 -1
  165. package/lib/typescript/types/form-api.type-test.d.ts +2 -0
  166. package/lib/typescript/types/form-api.type-test.d.ts.map +1 -0
  167. package/package.json +34 -5
  168. package/src/components/area-chart/index.tsx +27 -2
  169. package/src/components/bar-chart/index.tsx +27 -2
  170. package/src/components/bottom-sheet/index.tsx +3 -0
  171. package/src/components/candlestick-chart/index.tsx +30 -2
  172. package/src/components/carousel/carousel-lifecycle.ts +74 -0
  173. package/src/components/carousel/index.tsx +80 -25
  174. package/src/components/context-menu/context-menu-invocation.ts +44 -0
  175. package/src/components/context-menu/index.tsx +113 -13
  176. package/src/components/dialog/index.tsx +3 -0
  177. package/src/components/drawer/index.tsx +3 -0
  178. package/src/components/flow/flow-accessibility.ts +16 -2
  179. package/src/components/flow/flow-identifiers.ts +98 -0
  180. package/src/components/flow/index.tsx +29 -19
  181. package/src/components/form/index.tsx +32 -5
  182. package/src/components/form/typed-form.ts +13 -0
  183. package/src/components/form/use-form.ts +9 -0
  184. package/src/components/heatmap-chart/index.tsx +49 -3
  185. package/src/components/line-chart/index.tsx +27 -2
  186. package/src/components/message-scroller/index.tsx +273 -13
  187. package/src/components/message-scroller/message-scroller-math.ts +62 -0
  188. package/src/components/meter/index.tsx +318 -0
  189. package/src/components/meter/meter-scale.ts +109 -0
  190. package/src/components/planner/index.tsx +886 -0
  191. package/src/components/planner/planner-entries.ts +146 -0
  192. package/src/components/popover/index.tsx +3 -0
  193. package/src/components/radar-chart/index.tsx +24 -0
  194. package/src/components/scatter-chart/index.tsx +27 -2
  195. package/src/components/selection-mode/index.tsx +37 -30
  196. package/src/components/selection-mode/selection-mode-contracts.ts +53 -0
  197. package/src/components/signature/index.tsx +107 -20
  198. package/src/components/signature/signature-accessibility.ts +67 -0
  199. package/src/components/skeleton/index.tsx +59 -5
  200. package/src/components/slider/index.tsx +28 -18
  201. package/src/components/spinner/index.tsx +80 -13
  202. package/src/components/time-picker/index.tsx +57 -29
  203. package/src/components/time-picker/ruler-window.ts +24 -0
  204. package/src/hooks/breakpoint-contract.ts +31 -0
  205. package/src/hooks/index.ts +4 -0
  206. package/src/hooks/use-breakpoint.ts +61 -10
  207. package/src/index.ts +32 -0
  208. package/src/primitives/chart-accessibility.ts +102 -0
  209. 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,EACR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LgB,aAAa;IACjBnC,SAAS,EAAEvB,KAAK,CAACG,KAAK,CAAC;MAAEoB;IAAU,CAAC,CAAE;IACtC0B,QAAQ,EAAEA,QAAS;IAAA,GACfR,KAAK;IAAAyB,QAAA,eAET5E,IAAA,CAACd,QAAQ,CAACD,IAAI;MACZkD,KAAK,EAAE6B,SAAU;MACjB/B,SAAS,EAAEvB,KAAK,CAACI,SAAS,CAAC;QAAEmB,SAAS,EAAEQ;MAAmB,CAAC;IAAE,CAC/D;EAAC,CACE,CACP;EAEH,IAAI,CAAC0B,SAAS,EAAE,OAAOQ,GAAG;EAE1B,oBACEzE,KAAA,CAACjB,IAAI;IAACgD,SAAS,EAAEvB,KAAK,CAACC,IAAI,CAAC,CAAE;IAAAiE,QAAA,gBAC5B1E,KAAA,CAACjB,IAAI;MAACgD,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,KAAK,CAAC,CAACC,KAAK,GAAGC,GAAG,IAAIG,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,QAAQA,CACtBL,K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