@bquery/bquery 1.2.0 → 1.4.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 (309) hide show
  1. package/README.md +127 -27
  2. package/dist/batch-x7b2eZST.js +13 -0
  3. package/dist/batch-x7b2eZST.js.map +1 -0
  4. package/dist/component/component.d.ts +69 -0
  5. package/dist/component/component.d.ts.map +1 -0
  6. package/dist/component/html.d.ts +35 -0
  7. package/dist/component/html.d.ts.map +1 -0
  8. package/dist/component/index.d.ts +3 -126
  9. package/dist/component/index.d.ts.map +1 -1
  10. package/dist/component/props.d.ts +18 -0
  11. package/dist/component/props.d.ts.map +1 -0
  12. package/dist/component/types.d.ts +77 -0
  13. package/dist/component/types.d.ts.map +1 -0
  14. package/dist/component.es.mjs +90 -59
  15. package/dist/component.es.mjs.map +1 -1
  16. package/dist/core/collection.d.ts +55 -3
  17. package/dist/core/collection.d.ts.map +1 -1
  18. package/dist/core/dom.d.ts +6 -0
  19. package/dist/core/dom.d.ts.map +1 -0
  20. package/dist/core/element.d.ts +31 -4
  21. package/dist/core/element.d.ts.map +1 -1
  22. package/dist/core/index.d.ts +2 -0
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/utils/array.d.ts +74 -0
  25. package/dist/core/utils/array.d.ts.map +1 -0
  26. package/dist/core/utils/function.d.ts +87 -0
  27. package/dist/core/utils/function.d.ts.map +1 -0
  28. package/dist/core/utils/index.d.ts +70 -0
  29. package/dist/core/utils/index.d.ts.map +1 -0
  30. package/dist/core/utils/misc.d.ts +63 -0
  31. package/dist/core/utils/misc.d.ts.map +1 -0
  32. package/dist/core/utils/number.d.ts +65 -0
  33. package/dist/core/utils/number.d.ts.map +1 -0
  34. package/dist/core/utils/object.d.ts +133 -0
  35. package/dist/core/utils/object.d.ts.map +1 -0
  36. package/dist/core/utils/string.d.ts +80 -0
  37. package/dist/core/utils/string.d.ts.map +1 -0
  38. package/dist/core/utils/type-guards.d.ts +79 -0
  39. package/dist/core/utils/type-guards.d.ts.map +1 -0
  40. package/dist/core-BhpuvPhy.js +170 -0
  41. package/dist/core-BhpuvPhy.js.map +1 -0
  42. package/dist/core.es.mjs +495 -489
  43. package/dist/core.es.mjs.map +1 -1
  44. package/dist/full.d.ts +2 -2
  45. package/dist/full.d.ts.map +1 -1
  46. package/dist/full.es.mjs +87 -64
  47. package/dist/full.es.mjs.map +1 -1
  48. package/dist/full.iife.js +2 -2
  49. package/dist/full.iife.js.map +1 -1
  50. package/dist/full.umd.js +2 -2
  51. package/dist/full.umd.js.map +1 -1
  52. package/dist/index.es.mjs +138 -68
  53. package/dist/index.es.mjs.map +1 -1
  54. package/dist/motion/animate.d.ts +25 -0
  55. package/dist/motion/animate.d.ts.map +1 -0
  56. package/dist/motion/easing.d.ts +30 -0
  57. package/dist/motion/easing.d.ts.map +1 -0
  58. package/dist/motion/flip.d.ts +55 -0
  59. package/dist/motion/flip.d.ts.map +1 -0
  60. package/dist/motion/index.d.ts +11 -138
  61. package/dist/motion/index.d.ts.map +1 -1
  62. package/dist/motion/keyframes.d.ts +21 -0
  63. package/dist/motion/keyframes.d.ts.map +1 -0
  64. package/dist/motion/reduced-motion.d.ts +12 -0
  65. package/dist/motion/reduced-motion.d.ts.map +1 -0
  66. package/dist/motion/scroll.d.ts +15 -0
  67. package/dist/motion/scroll.d.ts.map +1 -0
  68. package/dist/motion/spring.d.ts +42 -0
  69. package/dist/motion/spring.d.ts.map +1 -0
  70. package/dist/motion/stagger.d.ts +22 -0
  71. package/dist/motion/stagger.d.ts.map +1 -0
  72. package/dist/motion/timeline.d.ts +21 -0
  73. package/dist/motion/timeline.d.ts.map +1 -0
  74. package/dist/motion/transition.d.ts +22 -0
  75. package/dist/motion/transition.d.ts.map +1 -0
  76. package/dist/motion/types.d.ts +182 -0
  77. package/dist/motion/types.d.ts.map +1 -0
  78. package/dist/motion.es.mjs +320 -61
  79. package/dist/motion.es.mjs.map +1 -1
  80. package/dist/persisted-DHoi3uEs.js +278 -0
  81. package/dist/persisted-DHoi3uEs.js.map +1 -0
  82. package/dist/platform/storage.d.ts.map +1 -1
  83. package/dist/platform.es.mjs +12 -7
  84. package/dist/platform.es.mjs.map +1 -1
  85. package/dist/reactive/batch.d.ts +13 -0
  86. package/dist/reactive/batch.d.ts.map +1 -0
  87. package/dist/reactive/computed.d.ts +50 -0
  88. package/dist/reactive/computed.d.ts.map +1 -0
  89. package/dist/reactive/core.d.ts +72 -0
  90. package/dist/reactive/core.d.ts.map +1 -0
  91. package/dist/reactive/effect.d.ts +15 -0
  92. package/dist/reactive/effect.d.ts.map +1 -0
  93. package/dist/reactive/index.d.ts +2 -2
  94. package/dist/reactive/index.d.ts.map +1 -1
  95. package/dist/reactive/internals.d.ts +42 -0
  96. package/dist/reactive/internals.d.ts.map +1 -0
  97. package/dist/reactive/linked.d.ts +36 -0
  98. package/dist/reactive/linked.d.ts.map +1 -0
  99. package/dist/reactive/persisted.d.ts +14 -0
  100. package/dist/reactive/persisted.d.ts.map +1 -0
  101. package/dist/reactive/readonly.d.ts +26 -0
  102. package/dist/reactive/readonly.d.ts.map +1 -0
  103. package/dist/reactive/signal.d.ts +13 -312
  104. package/dist/reactive/signal.d.ts.map +1 -1
  105. package/dist/reactive/type-guards.d.ts +20 -0
  106. package/dist/reactive/type-guards.d.ts.map +1 -0
  107. package/dist/reactive/untrack.d.ts +29 -0
  108. package/dist/reactive/untrack.d.ts.map +1 -0
  109. package/dist/reactive/watch.d.ts +42 -0
  110. package/dist/reactive/watch.d.ts.map +1 -0
  111. package/dist/reactive.es.mjs +30 -163
  112. package/dist/reactive.es.mjs.map +1 -1
  113. package/dist/router/index.d.ts +6 -252
  114. package/dist/router/index.d.ts.map +1 -1
  115. package/dist/router/links.d.ts +44 -0
  116. package/dist/router/links.d.ts.map +1 -0
  117. package/dist/router/match.d.ts +20 -0
  118. package/dist/router/match.d.ts.map +1 -0
  119. package/dist/router/navigation.d.ts +45 -0
  120. package/dist/router/navigation.d.ts.map +1 -0
  121. package/dist/router/query.d.ts +16 -0
  122. package/dist/router/query.d.ts.map +1 -0
  123. package/dist/router/router.d.ts +34 -0
  124. package/dist/router/router.d.ts.map +1 -0
  125. package/dist/router/state.d.ts +27 -0
  126. package/dist/router/state.d.ts.map +1 -0
  127. package/dist/router/types.d.ts +88 -0
  128. package/dist/router/types.d.ts.map +1 -0
  129. package/dist/router/utils.d.ts +65 -0
  130. package/dist/router/utils.d.ts.map +1 -0
  131. package/dist/router.es.mjs +168 -132
  132. package/dist/router.es.mjs.map +1 -1
  133. package/dist/sanitize-Cxvxa-DX.js +283 -0
  134. package/dist/sanitize-Cxvxa-DX.js.map +1 -0
  135. package/dist/security/constants.d.ts +42 -0
  136. package/dist/security/constants.d.ts.map +1 -0
  137. package/dist/security/csp.d.ts +24 -0
  138. package/dist/security/csp.d.ts.map +1 -0
  139. package/dist/security/index.d.ts +4 -2
  140. package/dist/security/index.d.ts.map +1 -1
  141. package/dist/security/sanitize-core.d.ts +13 -0
  142. package/dist/security/sanitize-core.d.ts.map +1 -0
  143. package/dist/security/sanitize.d.ts +5 -57
  144. package/dist/security/sanitize.d.ts.map +1 -1
  145. package/dist/security/trusted-types.d.ts +25 -0
  146. package/dist/security/trusted-types.d.ts.map +1 -0
  147. package/dist/security/types.d.ts +36 -0
  148. package/dist/security/types.d.ts.map +1 -0
  149. package/dist/security.es.mjs +50 -277
  150. package/dist/security.es.mjs.map +1 -1
  151. package/dist/store/create-store.d.ts +15 -0
  152. package/dist/store/create-store.d.ts.map +1 -0
  153. package/dist/store/define-store.d.ts +28 -0
  154. package/dist/store/define-store.d.ts.map +1 -0
  155. package/dist/store/devtools.d.ts +22 -0
  156. package/dist/store/devtools.d.ts.map +1 -0
  157. package/dist/store/index.d.ts +10 -286
  158. package/dist/store/index.d.ts.map +1 -1
  159. package/dist/store/mapping.d.ts +28 -0
  160. package/dist/store/mapping.d.ts.map +1 -0
  161. package/dist/store/persisted.d.ts +13 -0
  162. package/dist/store/persisted.d.ts.map +1 -0
  163. package/dist/store/plugins.d.ts +13 -0
  164. package/dist/store/plugins.d.ts.map +1 -0
  165. package/dist/store/registry.d.ts +28 -0
  166. package/dist/store/registry.d.ts.map +1 -0
  167. package/dist/store/types.d.ts +71 -0
  168. package/dist/store/types.d.ts.map +1 -0
  169. package/dist/store/utils.d.ts +28 -0
  170. package/dist/store/utils.d.ts.map +1 -0
  171. package/dist/store/watch.d.ts +23 -0
  172. package/dist/store/watch.d.ts.map +1 -0
  173. package/dist/store.es.mjs +22 -224
  174. package/dist/store.es.mjs.map +1 -1
  175. package/dist/type-guards-BdKlYYlS.js +32 -0
  176. package/dist/type-guards-BdKlYYlS.js.map +1 -0
  177. package/dist/untrack-DNnnqdlR.js +6 -0
  178. package/dist/untrack-DNnnqdlR.js.map +1 -0
  179. package/dist/view/directives/bind.d.ts +7 -0
  180. package/dist/view/directives/bind.d.ts.map +1 -0
  181. package/dist/view/directives/class.d.ts +8 -0
  182. package/dist/view/directives/class.d.ts.map +1 -0
  183. package/dist/view/directives/for.d.ts +23 -0
  184. package/dist/view/directives/for.d.ts.map +1 -0
  185. package/dist/view/directives/html.d.ts +7 -0
  186. package/dist/view/directives/html.d.ts.map +1 -0
  187. package/dist/view/directives/if.d.ts +7 -0
  188. package/dist/view/directives/if.d.ts.map +1 -0
  189. package/dist/view/directives/index.d.ts +12 -0
  190. package/dist/view/directives/index.d.ts.map +1 -0
  191. package/dist/view/directives/model.d.ts +7 -0
  192. package/dist/view/directives/model.d.ts.map +1 -0
  193. package/dist/view/directives/on.d.ts +7 -0
  194. package/dist/view/directives/on.d.ts.map +1 -0
  195. package/dist/view/directives/ref.d.ts +7 -0
  196. package/dist/view/directives/ref.d.ts.map +1 -0
  197. package/dist/view/directives/show.d.ts +7 -0
  198. package/dist/view/directives/show.d.ts.map +1 -0
  199. package/dist/view/directives/style.d.ts +7 -0
  200. package/dist/view/directives/style.d.ts.map +1 -0
  201. package/dist/view/directives/text.d.ts +7 -0
  202. package/dist/view/directives/text.d.ts.map +1 -0
  203. package/dist/view/evaluate.d.ts +43 -0
  204. package/dist/view/evaluate.d.ts.map +1 -0
  205. package/dist/view/index.d.ts +3 -93
  206. package/dist/view/index.d.ts.map +1 -1
  207. package/dist/view/mount.d.ts +69 -0
  208. package/dist/view/mount.d.ts.map +1 -0
  209. package/dist/view/process.d.ts +26 -0
  210. package/dist/view/process.d.ts.map +1 -0
  211. package/dist/view/types.d.ts +36 -0
  212. package/dist/view/types.d.ts.map +1 -0
  213. package/dist/view.es.mjs +358 -251
  214. package/dist/view.es.mjs.map +1 -1
  215. package/dist/watch-DXXv3iAI.js +58 -0
  216. package/dist/watch-DXXv3iAI.js.map +1 -0
  217. package/package.json +14 -14
  218. package/src/component/component.ts +289 -0
  219. package/src/component/html.ts +53 -0
  220. package/src/component/index.ts +40 -414
  221. package/src/component/props.ts +116 -0
  222. package/src/component/types.ts +85 -0
  223. package/src/core/collection.ts +181 -7
  224. package/src/core/dom.ts +38 -0
  225. package/src/core/element.ts +59 -25
  226. package/src/core/index.ts +48 -4
  227. package/src/core/utils/array.ts +102 -0
  228. package/src/core/utils/function.ts +151 -0
  229. package/src/core/utils/index.ts +83 -0
  230. package/src/core/utils/misc.ts +82 -0
  231. package/src/core/utils/number.ts +78 -0
  232. package/src/core/utils/object.ts +206 -0
  233. package/src/core/utils/string.ts +112 -0
  234. package/src/core/utils/type-guards.ts +112 -0
  235. package/src/full.ts +187 -150
  236. package/src/index.ts +36 -36
  237. package/src/motion/animate.ts +113 -0
  238. package/src/motion/easing.ts +40 -0
  239. package/src/motion/flip.ts +176 -0
  240. package/src/motion/index.ts +41 -358
  241. package/src/motion/keyframes.ts +46 -0
  242. package/src/motion/reduced-motion.ts +17 -0
  243. package/src/motion/scroll.ts +57 -0
  244. package/src/motion/spring.ts +150 -0
  245. package/src/motion/stagger.ts +43 -0
  246. package/src/motion/timeline.ts +246 -0
  247. package/src/motion/transition.ts +51 -0
  248. package/src/motion/types.ts +198 -0
  249. package/src/platform/storage.ts +215 -208
  250. package/src/reactive/batch.ts +22 -0
  251. package/src/reactive/computed.ts +92 -0
  252. package/src/reactive/core.ts +114 -0
  253. package/src/reactive/effect.ts +54 -0
  254. package/src/reactive/index.ts +23 -22
  255. package/src/reactive/internals.ts +122 -0
  256. package/src/reactive/linked.ts +56 -0
  257. package/src/reactive/persisted.ts +74 -0
  258. package/src/reactive/readonly.ts +35 -0
  259. package/src/reactive/signal.ts +20 -520
  260. package/src/reactive/type-guards.ts +22 -0
  261. package/src/reactive/untrack.ts +31 -0
  262. package/src/reactive/watch.ts +73 -0
  263. package/src/router/index.ts +41 -718
  264. package/src/router/links.ts +130 -0
  265. package/src/router/match.ts +106 -0
  266. package/src/router/navigation.ts +71 -0
  267. package/src/router/query.ts +35 -0
  268. package/src/router/router.ts +211 -0
  269. package/src/router/state.ts +46 -0
  270. package/src/router/types.ts +93 -0
  271. package/src/router/utils.ts +116 -0
  272. package/src/security/constants.ts +209 -0
  273. package/src/security/csp.ts +77 -0
  274. package/src/security/index.ts +4 -12
  275. package/src/security/sanitize-core.ts +364 -0
  276. package/src/security/sanitize.ts +66 -625
  277. package/src/security/trusted-types.ts +69 -0
  278. package/src/security/types.ts +40 -0
  279. package/src/store/create-store.ts +329 -0
  280. package/src/store/define-store.ts +48 -0
  281. package/src/store/devtools.ts +45 -0
  282. package/src/store/index.ts +22 -848
  283. package/src/store/mapping.ts +73 -0
  284. package/src/store/persisted.ts +61 -0
  285. package/src/store/plugins.ts +32 -0
  286. package/src/store/registry.ts +51 -0
  287. package/src/store/types.ts +94 -0
  288. package/src/store/utils.ts +141 -0
  289. package/src/store/watch.ts +52 -0
  290. package/src/view/directives/bind.ts +23 -0
  291. package/src/view/directives/class.ts +70 -0
  292. package/src/view/directives/for.ts +275 -0
  293. package/src/view/directives/html.ts +19 -0
  294. package/src/view/directives/if.ts +30 -0
  295. package/src/view/directives/index.ts +11 -0
  296. package/src/view/directives/model.ts +56 -0
  297. package/src/view/directives/on.ts +41 -0
  298. package/src/view/directives/ref.ts +41 -0
  299. package/src/view/directives/show.ts +26 -0
  300. package/src/view/directives/style.ts +47 -0
  301. package/src/view/directives/text.ts +15 -0
  302. package/src/view/evaluate.ts +290 -0
  303. package/src/view/index.ts +112 -1041
  304. package/src/view/mount.ts +200 -0
  305. package/src/view/process.ts +92 -0
  306. package/src/view/types.ts +44 -0
  307. package/dist/core/utils.d.ts +0 -313
  308. package/dist/core/utils.d.ts.map +0 -1
  309. package/src/core/utils.ts +0 -444
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Function-focused utility helpers.
3
+ *
4
+ * @module bquery/core/utils/function
5
+ */
6
+ /** A debounced function with a cancel method to clear the pending timeout. */
7
+ export interface DebouncedFn<TArgs extends unknown[]> {
8
+ (...args: TArgs): void;
9
+ /** Cancels the pending debounced invocation. */
10
+ cancel(): void;
11
+ }
12
+ /** A throttled function with a cancel method to reset the throttle timer. */
13
+ export interface ThrottledFn<TArgs extends unknown[]> {
14
+ (...args: TArgs): void;
15
+ /** Resets the throttle timer, allowing the next call to execute immediately. */
16
+ cancel(): void;
17
+ }
18
+ /**
19
+ * Creates a debounced function that delays execution until after
20
+ * the specified delay has elapsed since the last call.
21
+ *
22
+ * @template TArgs - The argument types of the function
23
+ * @param fn - The function to debounce
24
+ * @param delayMs - Delay in milliseconds
25
+ * @returns A debounced version of the function with a `cancel()` method
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const search = debounce((query: string) => {
30
+ * console.log('Searching:', query);
31
+ * }, 300);
32
+ *
33
+ * search('h');
34
+ * search('he');
35
+ * search('hello'); // Only this call executes after 300ms
36
+ *
37
+ * search('cancel me');
38
+ * search.cancel(); // Cancels the pending invocation
39
+ * ```
40
+ */
41
+ export declare function debounce<TArgs extends unknown[]>(fn: (...args: TArgs) => void, delayMs: number): DebouncedFn<TArgs>;
42
+ /**
43
+ * Creates a throttled function that runs at most once per interval.
44
+ *
45
+ * @template TArgs - The argument types of the function
46
+ * @param fn - The function to throttle
47
+ * @param intervalMs - Minimum interval between calls in milliseconds
48
+ * @returns A throttled version of the function with a `cancel()` method
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const handleScroll = throttle(() => {
53
+ * console.log('Scroll position:', window.scrollY);
54
+ * }, 100);
55
+ *
56
+ * window.addEventListener('scroll', handleScroll);
57
+ *
58
+ * handleScroll.cancel(); // Resets throttle, next call executes immediately
59
+ * ```
60
+ */
61
+ export declare function throttle<TArgs extends unknown[]>(fn: (...args: TArgs) => void, intervalMs: number): ThrottledFn<TArgs>;
62
+ /**
63
+ * Ensures a function only runs once. Subsequent calls return the first result.
64
+ *
65
+ * @template TArgs - The argument types of the function
66
+ * @template TResult - The return type of the function
67
+ * @param fn - The function to wrap
68
+ * @returns A function that only runs once
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const init = once(() => ({ ready: true }));
73
+ * init();
74
+ * init(); // only runs once
75
+ * ```
76
+ */
77
+ export declare function once<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => TResult): (...args: TArgs) => TResult;
78
+ /**
79
+ * A no-operation function.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * noop();
84
+ * ```
85
+ */
86
+ export declare function noop(): void;
87
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/core/utils/function.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,OAAO,EAAE;IAClD,CAAC,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;IACvB,gDAAgD;IAChD,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,6EAA6E;AAC7E,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,OAAO,EAAE;IAClD,CAAC,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;IACvB,gFAAgF;IAChF,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,SAAS,OAAO,EAAE,EAC9C,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,EAC5B,OAAO,EAAE,MAAM,GACd,WAAW,CAAC,KAAK,CAAC,CAsBpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,SAAS,OAAO,EAAE,EAC9C,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,EAC5B,UAAU,EAAE,MAAM,GACjB,WAAW,CAAC,KAAK,CAAC,CAiBpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EACnD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,GAC9B,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAU7B;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,IAAI,IAAI,CAE3B"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Utility helpers used across the framework.
3
+ * These are intentionally small and framework-agnostic to keep the core tiny.
4
+ *
5
+ * @module bquery/core/utils
6
+ */
7
+ export * from './array';
8
+ export * from './function';
9
+ export * from './misc';
10
+ export * from './number';
11
+ export * from './object';
12
+ export * from './string';
13
+ export * from './type-guards';
14
+ import { chunk, compact, ensureArray, flatten, unique } from './array';
15
+ import { debounce, noop, once, throttle } from './function';
16
+ import { isEmpty, parseJson, sleep, uid } from './misc';
17
+ import { clamp, inRange, randomInt, toNumber } from './number';
18
+ import { clone, hasOwn, isPlainObject, merge, omit, pick } from './object';
19
+ import { capitalize, escapeRegExp, slugify, toCamelCase, toKebabCase, truncate } from './string';
20
+ import { isArray, isBoolean, isCollection, isDate, isElement, isFunction, isNumber, isObject, isPromise, isString } from './type-guards';
21
+ /**
22
+ * Utility object containing common helper functions.
23
+ * All utilities are designed to be tree-shakeable and have zero dependencies.
24
+ *
25
+ * Note: `isPrototypePollutionKey` is intentionally excluded from this namespace
26
+ * as it is an internal security helper. It remains available as a named export
27
+ * for internal framework use.
28
+ */
29
+ export declare const utils: {
30
+ clone: typeof clone;
31
+ merge: typeof merge;
32
+ pick: typeof pick;
33
+ omit: typeof omit;
34
+ hasOwn: typeof hasOwn;
35
+ debounce: typeof debounce;
36
+ throttle: typeof throttle;
37
+ once: typeof once;
38
+ noop: typeof noop;
39
+ uid: typeof uid;
40
+ isElement: typeof isElement;
41
+ isCollection: typeof isCollection;
42
+ isEmpty: typeof isEmpty;
43
+ isPlainObject: typeof isPlainObject;
44
+ isFunction: typeof isFunction;
45
+ isString: typeof isString;
46
+ isNumber: typeof isNumber;
47
+ isBoolean: typeof isBoolean;
48
+ isArray: typeof isArray;
49
+ isDate: typeof isDate;
50
+ isPromise: typeof isPromise;
51
+ isObject: typeof isObject;
52
+ parseJson: typeof parseJson;
53
+ sleep: typeof sleep;
54
+ randomInt: typeof randomInt;
55
+ clamp: typeof clamp;
56
+ inRange: typeof inRange;
57
+ toNumber: typeof toNumber;
58
+ capitalize: typeof capitalize;
59
+ toKebabCase: typeof toKebabCase;
60
+ toCamelCase: typeof toCamelCase;
61
+ truncate: typeof truncate;
62
+ slugify: typeof slugify;
63
+ escapeRegExp: typeof escapeRegExp;
64
+ ensureArray: typeof ensureArray;
65
+ unique: typeof unique;
66
+ chunk: typeof chunk;
67
+ compact: typeof compact;
68
+ flatten: typeof flatten;
69
+ };
70
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACjG,OAAO,EACL,OAAO,EACP,SAAS,EACT,YAAY,EACZ,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCjB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Miscellaneous utility helpers.
3
+ *
4
+ * @module bquery/core/utils/misc
5
+ */
6
+ /**
7
+ * Creates a stable unique ID for DOM usage.
8
+ *
9
+ * @param prefix - Optional prefix for the ID (default: 'bQuery')
10
+ * @returns A unique identifier string
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const id = uid('modal'); // 'modal_x7k2m9p'
15
+ * ```
16
+ */
17
+ export declare function uid(prefix?: string): string;
18
+ /**
19
+ * Delays execution for a specified number of milliseconds.
20
+ *
21
+ * @param ms - Milliseconds to delay
22
+ * @returns A promise that resolves after the delay
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * await sleep(1000); // Wait 1 second
27
+ * console.log('Done!');
28
+ * ```
29
+ */
30
+ export declare function sleep(ms: number): Promise<void>;
31
+ /**
32
+ * Safely parses a JSON string, returning a default value on error.
33
+ *
34
+ * @template T - The expected type of the parsed value
35
+ * @param json - The JSON string to parse
36
+ * @param fallback - The default value if parsing fails
37
+ * @returns The parsed value or the fallback
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * parseJson('{"name":"bQuery"}', {}); // { name: 'bQuery' }
42
+ * parseJson('invalid', {}); // {}
43
+ * ```
44
+ */
45
+ export declare function parseJson<T>(json: string, fallback: T): T;
46
+ /**
47
+ * Checks for emptiness across common value types.
48
+ *
49
+ * @param value - The value to check
50
+ * @returns True if the value is empty (null, undefined, empty string, empty array, or empty object)
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * isEmpty(''); // true
55
+ * isEmpty([]); // true
56
+ * isEmpty({}); // true
57
+ * isEmpty(null); // true
58
+ * isEmpty('hello'); // false
59
+ * isEmpty([1, 2]); // false
60
+ * ```
61
+ */
62
+ export declare function isEmpty(value: unknown): boolean;
63
+ //# sourceMappingURL=misc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/core/utils/misc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,GAAG,CAAC,MAAM,SAAW,GAAG,MAAM,CAE7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAMzD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM/C"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Number-focused utility helpers.
3
+ *
4
+ * @module bquery/core/utils/number
5
+ */
6
+ /**
7
+ * Generates a random integer between min and max (inclusive).
8
+ *
9
+ * @param min - Minimum value
10
+ * @param max - Maximum value
11
+ * @returns A random integer in the range [min, max]
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const roll = randomInt(1, 6); // Random dice roll
16
+ * ```
17
+ */
18
+ export declare function randomInt(min: number, max: number): number;
19
+ /**
20
+ * Clamps a number between a minimum and maximum value.
21
+ *
22
+ * @param value - The value to clamp
23
+ * @param min - Minimum value
24
+ * @param max - Maximum value
25
+ * @returns The clamped value
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * clamp(150, 0, 100); // 100
30
+ * clamp(-10, 0, 100); // 0
31
+ * clamp(50, 0, 100); // 50
32
+ * ```
33
+ */
34
+ export declare function clamp(value: number, min: number, max: number): number;
35
+ /**
36
+ * Checks if a number is within a range.
37
+ *
38
+ * @param value - The value to check
39
+ * @param min - Minimum value
40
+ * @param max - Maximum value
41
+ * @param inclusive - Whether the range is inclusive (default: true)
42
+ * @returns True if the value is within the range
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * inRange(5, 1, 10); // true
47
+ * inRange(10, 1, 10, false); // false
48
+ * ```
49
+ */
50
+ export declare function inRange(value: number, min: number, max: number, inclusive?: boolean): boolean;
51
+ /**
52
+ * Converts a value to a number with a fallback on NaN.
53
+ *
54
+ * @param value - The value to convert
55
+ * @param fallback - The fallback value if conversion fails (default: 0)
56
+ * @returns The parsed number or the fallback
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * toNumber('42'); // 42
61
+ * toNumber('nope', 10); // 10
62
+ * ```
63
+ */
64
+ export declare function toNumber(value: unknown, fallback?: number): number;
65
+ //# sourceMappingURL=number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/core/utils/number.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,OAAO,CAG1F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAI,GAAG,MAAM,CAG7D"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Object-focused utility helpers.
3
+ *
4
+ * @module bquery/core/utils/object
5
+ */
6
+ /**
7
+ * Checks if a value is a plain object (not null, array, or class instance).
8
+ *
9
+ * @param value - The value to check
10
+ * @returns True if the value is a plain object
11
+ */
12
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
13
+ /**
14
+ * Checks if a key could cause prototype pollution.
15
+ * These keys are dangerous when used in object merging operations.
16
+ *
17
+ * @param key - The key to check
18
+ * @returns True if the key is a prototype pollution vector
19
+ *
20
+ * @internal
21
+ */
22
+ export declare function isPrototypePollutionKey(key: string): boolean;
23
+ /**
24
+ * Creates a deep clone using structuredClone if available, otherwise fallback to JSON.
25
+ *
26
+ * @template T - The type of value being cloned
27
+ * @param value - The value to clone
28
+ * @returns A deep copy of the value
29
+ *
30
+ * @remarks
31
+ * When `structuredClone` is available (modern browsers, Node 17+, Bun), this function
32
+ * provides full deep cloning including circular references, Date, Map, Set, ArrayBuffer, etc.
33
+ *
34
+ * **JSON fallback limitations** (older environments without `structuredClone`):
35
+ * - **Throws** on circular references
36
+ * - **Drops** functions, `undefined`, and Symbol properties
37
+ * - **Transforms** Date → ISO string, Map/Set → empty object, BigInt → throws
38
+ * - **Loses** prototype chains and non-enumerable properties
39
+ *
40
+ * For guaranteed safe cloning of arbitrary data, ensure your environment supports
41
+ * `structuredClone` or pre-validate your data structure.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const original = { nested: { value: 1 } };
46
+ * const copy = clone(original);
47
+ * copy.nested.value = 2;
48
+ * console.log(original.nested.value); // 1
49
+ * ```
50
+ */
51
+ export declare function clone<T>(value: T): T;
52
+ /**
53
+ * Deep-merges plain objects into a new object.
54
+ * Later sources override earlier ones for primitive values.
55
+ * Objects are recursively merged.
56
+ *
57
+ * @param sources - Objects to merge
58
+ * @returns A new object with all sources merged as an intersection type
59
+ *
60
+ * @remarks
61
+ * This function uses overloads to provide accurate intersection types for up to 5 sources.
62
+ * For more than 5 sources, the return type falls back to `Record<string, unknown>`.
63
+ *
64
+ * Note that deep merging creates a shallow intersection at the type level. Nested objects
65
+ * are merged at runtime, but TypeScript sees them as intersected types which may not
66
+ * perfectly represent the merged structure for deeply nested conflicting types.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const result = merge(
71
+ * { a: 1, nested: { x: 1 } },
72
+ * { b: 2, nested: { y: 2 } }
73
+ * );
74
+ * // Result: { a: 1, b: 2, nested: { x: 1, y: 2 } }
75
+ * // Type: { a: number; nested: { x: number } } & { b: number; nested: { y: number } }
76
+ * ```
77
+ *
78
+ * @security This method is protected against prototype pollution attacks.
79
+ * Keys like `__proto__`, `constructor`, and `prototype` are ignored.
80
+ */
81
+ export declare function merge<T1 extends Record<string, unknown>>(source1: T1): T1;
82
+ export declare function merge<T1 extends Record<string, unknown>, T2 extends Record<string, unknown>>(source1: T1, source2: T2): T1 & T2;
83
+ export declare function merge<T1 extends Record<string, unknown>, T2 extends Record<string, unknown>, T3 extends Record<string, unknown>>(source1: T1, source2: T2, source3: T3): T1 & T2 & T3;
84
+ export declare function merge<T1 extends Record<string, unknown>, T2 extends Record<string, unknown>, T3 extends Record<string, unknown>, T4 extends Record<string, unknown>>(source1: T1, source2: T2, source3: T3, source4: T4): T1 & T2 & T3 & T4;
85
+ export declare function merge<T1 extends Record<string, unknown>, T2 extends Record<string, unknown>, T3 extends Record<string, unknown>, T4 extends Record<string, unknown>, T5 extends Record<string, unknown>>(source1: T1, source2: T2, source3: T3, source4: T4, source5: T5): T1 & T2 & T3 & T4 & T5;
86
+ export declare function merge(...sources: Record<string, unknown>[]): Record<string, unknown>;
87
+ /**
88
+ * Picks specified keys from an object.
89
+ *
90
+ * @template T - The object type
91
+ * @template K - The key type
92
+ * @param obj - The source object
93
+ * @param keys - Keys to pick
94
+ * @returns A new object with only the specified keys
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const user = { name: 'John', age: 30, email: 'john@example.com' };
99
+ * pick(user, ['name', 'email']); // { name: 'John', email: 'john@example.com' }
100
+ * ```
101
+ */
102
+ export declare function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
103
+ /**
104
+ * Omits specified keys from an object.
105
+ *
106
+ * @template T - The object type
107
+ * @template K - The key type
108
+ * @param obj - The source object
109
+ * @param keys - Keys to omit
110
+ * @returns A new object without the specified keys
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * const user = { name: 'John', age: 30, password: 'secret' };
115
+ * omit(user, ['password']); // { name: 'John', age: 30 }
116
+ * ```
117
+ */
118
+ export declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
119
+ /**
120
+ * Checks if an object has a given own property.
121
+ *
122
+ * @template T - The object type
123
+ * @param obj - The object to check
124
+ * @param key - The property key
125
+ * @returns True if the property exists on the object
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * hasOwn({ a: 1 }, 'a'); // true
130
+ * ```
131
+ */
132
+ export declare function hasOwn<T extends object>(obj: T, key: PropertyKey): key is keyof T;
133
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/core/utils/object.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * String-focused utility helpers.
3
+ *
4
+ * @module bquery/core/utils/string
5
+ */
6
+ /**
7
+ * Capitalizes the first letter of a string.
8
+ *
9
+ * @param str - The string to capitalize
10
+ * @returns The capitalized string
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * capitalize('hello'); // 'Hello'
15
+ * ```
16
+ */
17
+ export declare function capitalize(str: string): string;
18
+ /**
19
+ * Converts a string to kebab-case.
20
+ *
21
+ * @param str - The string to convert
22
+ * @returns The kebab-cased string
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * toKebabCase('myVariableName'); // 'my-variable-name'
27
+ * ```
28
+ */
29
+ export declare function toKebabCase(str: string): string;
30
+ /**
31
+ * Converts a string to camelCase.
32
+ *
33
+ * @param str - The string to convert
34
+ * @returns The camelCased string
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * toCamelCase('my-variable-name'); // 'myVariableName'
39
+ * ```
40
+ */
41
+ export declare function toCamelCase(str: string): string;
42
+ /**
43
+ * Truncates a string to a maximum length.
44
+ *
45
+ * @param str - The string to truncate
46
+ * @param maxLength - The maximum length
47
+ * @param suffix - The suffix to append when truncating (default: '…')
48
+ * @returns The truncated string
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * truncate('Hello world', 8); // 'Hello w…'
53
+ * ```
54
+ */
55
+ export declare function truncate(str: string, maxLength: number, suffix?: string): string;
56
+ /**
57
+ * Converts a string to a URL-friendly slug.
58
+ *
59
+ * @param str - The string to slugify
60
+ * @returns The slugified string
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * slugify('Hello, World!'); // 'hello-world'
65
+ * ```
66
+ */
67
+ export declare function slugify(str: string): string;
68
+ /**
69
+ * Escapes a string for safe usage inside a RegExp.
70
+ *
71
+ * @param str - The string to escape
72
+ * @returns The escaped string
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * escapeRegExp('[a-z]+'); // '\\[a-z\\]+'
77
+ * ```
78
+ */
79
+ export declare function escapeRegExp(str: string): string;
80
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/core/utils/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAM,GAAG,MAAM,CAK7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Type guard helpers.
3
+ *
4
+ * @module bquery/core/utils/type-guards
5
+ */
6
+ /**
7
+ * Checks if a value is a DOM Element.
8
+ *
9
+ * @param value - The value to check
10
+ * @returns True if the value is an Element
11
+ */
12
+ export declare function isElement(value: unknown): value is Element;
13
+ /**
14
+ * Checks if a value is a BQueryCollection-like object.
15
+ *
16
+ * @param value - The value to check
17
+ * @returns True if the value has an elements array property
18
+ */
19
+ export declare function isCollection(value: unknown): value is {
20
+ elements: Element[];
21
+ };
22
+ /**
23
+ * Checks if a value is a function.
24
+ *
25
+ * @param value - The value to check
26
+ * @returns True if the value is a function
27
+ */
28
+ export declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
29
+ /**
30
+ * Checks if a value is a string.
31
+ *
32
+ * @param value - The value to check
33
+ * @returns True if the value is a string
34
+ */
35
+ export declare function isString(value: unknown): value is string;
36
+ /**
37
+ * Checks if a value is a number (excluding NaN).
38
+ *
39
+ * @param value - The value to check
40
+ * @returns True if the value is a valid number
41
+ */
42
+ export declare function isNumber(value: unknown): value is number;
43
+ /**
44
+ * Checks if a value is a boolean.
45
+ *
46
+ * @param value - The value to check
47
+ * @returns True if the value is a boolean
48
+ */
49
+ export declare function isBoolean(value: unknown): value is boolean;
50
+ /**
51
+ * Checks if a value is an array.
52
+ *
53
+ * @template T - The type of array elements
54
+ * @param value - The value to check
55
+ * @returns True if the value is an array
56
+ */
57
+ export declare function isArray<T = unknown>(value: unknown): value is T[];
58
+ /**
59
+ * Checks if a value is a Date instance.
60
+ *
61
+ * @param value - The value to check
62
+ * @returns True if the value is a Date
63
+ */
64
+ export declare function isDate(value: unknown): value is Date;
65
+ /**
66
+ * Checks if a value is a Promise-like object.
67
+ *
68
+ * @param value - The value to check
69
+ * @returns True if the value is a Promise-like object
70
+ */
71
+ export declare function isPromise<T = unknown>(value: unknown): value is Promise<T>;
72
+ /**
73
+ * Checks if a value is a non-null object.
74
+ *
75
+ * @param value - The value to check
76
+ * @returns True if the value is an object
77
+ */
78
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
79
+ //# sourceMappingURL=type-guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../../../src/core/utils/type-guards.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAEnF;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,EAAE,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAQ1E;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}