@luzmo/analytics-components-kit 1.0.1-alpha.91 → 1.0.1-alpha.94

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 (252) hide show
  1. package/angular/README.md +1 -0
  2. package/angular/components/widget-menu.component.ts +25 -0
  3. package/angular/esm/components/widget-menu.component.d.ts +13 -0
  4. package/angular/esm/components/widget-menu.component.js +49 -0
  5. package/angular/esm/index.d.ts +3 -1
  6. package/angular/esm/index.js +4 -1
  7. package/angular/esm/types.d.ts +4 -0
  8. package/angular/index.ts +4 -1
  9. package/angular/types.ts +6 -0
  10. package/components/ai-chat-message-assistant/index.cjs +1 -1
  11. package/components/ai-chat-message-assistant/index.js +1 -0
  12. package/components/ai-chat-messages-container/index.cjs +1 -1
  13. package/components/ai-chat-messages-container/index.js +2 -2
  14. package/components/ai-interaction-textarea/index.cjs +1 -1
  15. package/components/ai-interaction-textarea/index.js +2 -1
  16. package/components/area-chart-options.config-C7sMAHco.cjs +20 -0
  17. package/components/{area-chart-options.config-u8itidsi.js → area-chart-options.config-_J0sG4NF.js} +26 -14
  18. package/components/{bar-chart-options.config-DIirbAJ0.js → bar-chart-options.config-D1mb5TDl.js} +35 -21
  19. package/components/bar-chart-options.config-DcxEkOT5.cjs +20 -0
  20. package/components/box-plot-options.config-SrrbDEYW.cjs +20 -0
  21. package/components/{box-plot-options.config-BWROiguA.js → box-plot-options.config-xu_i6ms7.js} +88 -52
  22. package/components/{bubble-chart-options.config-4QD8VPhU.js → bubble-chart-options.config-BacgXkJ_.js} +18 -9
  23. package/components/bubble-chart-options.config-Ihn6eVQI.cjs +20 -0
  24. package/components/{bullet-chart-options.config-3bH7uekx.js → bullet-chart-options.config-CDPpX1yc.js} +1 -1
  25. package/components/{bullet-chart-options.config-tWb6Fio-.cjs → bullet-chart-options.config-DfS4Bwds.cjs} +1 -1
  26. package/components/calculate-data-item-icon-CEa82-5u.cjs +20 -0
  27. package/components/calculate-data-item-icon-DjlZwMdO.js +147 -0
  28. package/components/{choropleth-map-options.config-CMxx3ORp.js → choropleth-map-options.config-B_W9-rhe.js} +84 -63
  29. package/components/choropleth-map-options.config-ZW8yoZH2.cjs +20 -0
  30. package/components/{circular-gauge-options.config-DhIKn44k.js → circular-gauge-options.config-DAIjz4Rl.js} +36 -23
  31. package/components/circular-gauge-options.config-msZ4mfpN.cjs +20 -0
  32. package/components/color-B6LaL8qz.cjs +20 -0
  33. package/components/{color-B7m0j8lX.js → color-DuJ4-73S.js} +950 -941
  34. package/components/{color-range-utils-BSfqtB3A.js → color-range-utils-Bvo9sm5A.js} +32 -31
  35. package/components/color-range-utils-C5yXW7ZC.cjs +20 -0
  36. package/components/{column-chart-options.config-D5-yR7iq.js → column-chart-options.config-B5SjBVdy.js} +37 -27
  37. package/components/column-chart-options.config-BjDvA7i9.cjs +20 -0
  38. package/components/{conditional-number-options.config-DPYsdML5.js → conditional-number-options.config-BCEpSK9J.js} +40 -24
  39. package/components/conditional-number-options.config-DgzUo0xi.cjs +20 -0
  40. package/components/dataset-icon/index.cjs +1 -1
  41. package/components/dataset-icon/index.js +2 -1
  42. package/components/dataset-selector-list/index.cjs +1 -1
  43. package/components/dataset-selector-list/index.js +35 -32
  44. package/components/dataset-selector-row/index.cjs +9 -9
  45. package/components/dataset-selector-row/index.js +53 -51
  46. package/components/{date-comparison-filter-options.config-QaoWaFUn.cjs → date-comparison-filter-options.config-DAVncmi0.cjs} +1 -1
  47. package/components/{date-comparison-filter-options.config-CSwGyuBg.js → date-comparison-filter-options.config-JA_yYpJa.js} +6 -3
  48. package/components/{date-filter-options.config-n-zhWaYa.cjs → date-filter-options.config-CWPMtA18.cjs} +1 -1
  49. package/components/{date-filter-options.config-BTVyHRkp.js → date-filter-options.config-DBRxlTWy.js} +6 -3
  50. package/components/display-settings/index.cjs +1 -1
  51. package/components/display-settings/index.js +1 -1
  52. package/components/display-settings-binning/index.cjs +5 -5
  53. package/components/display-settings-binning/index.js +30 -29
  54. package/components/display-settings-datetime/index.cjs +29 -29
  55. package/components/display-settings-datetime/index.js +120 -112
  56. package/components/display-settings-grand-totals/index.cjs +4 -4
  57. package/components/display-settings-grand-totals/index.js +24 -23
  58. package/components/display-settings-numeric/index.cjs +48 -48
  59. package/components/display-settings-numeric/index.js +211 -194
  60. package/components/display-settings-period-over-period/index.cjs +16 -16
  61. package/components/display-settings-period-over-period/index.js +97 -91
  62. package/components/{donut-chart-options.config-3ZqX8Cbb.js → donut-chart-options.config-BulUEiaH.js} +37 -21
  63. package/components/donut-chart-options.config-tNpqBZfR.cjs +20 -0
  64. package/components/draggable-data-item/index.cjs +5 -5
  65. package/components/draggable-data-item/index.js +46 -45
  66. package/components/draggable-data-item-level/index.cjs +11 -11
  67. package/components/draggable-data-item-level/index.js +73 -70
  68. package/components/{dropdown-filter-options.config-CGJTtgAX.js → dropdown-filter-options.config-D9dvPypF.js} +10 -7
  69. package/components/{dropdown-filter-options.config-DJvfCTk7.cjs → dropdown-filter-options.config-DS-MORmq.cjs} +1 -1
  70. package/components/droppable-slot/index.cjs +16 -16
  71. package/components/droppable-slot/index.js +223 -208
  72. package/components/edit-item/index.cjs +9 -9
  73. package/components/edit-item/index.js +119 -116
  74. package/components/edit-option/index.cjs +1 -1
  75. package/components/edit-option/index.js +1 -1
  76. package/components/edit-option-action-button-group/index.cjs +8 -8
  77. package/components/edit-option-action-button-group/index.js +53 -52
  78. package/components/{edit-option-base-Bh29-Cak.js → edit-option-base-DIc7iC-b.js} +1 -1
  79. package/components/{edit-option-base-tFr8Qg2B.cjs → edit-option-base-VhTih9T1.cjs} +1 -1
  80. package/components/edit-option-color-palette-picker/index.cjs +1 -1
  81. package/components/edit-option-color-palette-picker/index.js +1 -1
  82. package/components/edit-option-color-picker/index.cjs +1 -1
  83. package/components/edit-option-color-picker/index.js +1 -1
  84. package/components/edit-option-color-range/index.cjs +19 -19
  85. package/components/edit-option-color-range/index.js +117 -106
  86. package/components/edit-option-multi-language-field/index.cjs +3 -3
  87. package/components/edit-option-multi-language-field/index.js +27 -26
  88. package/components/edit-option-number-field/index.cjs +1 -1
  89. package/components/edit-option-number-field/index.js +1 -1
  90. package/components/edit-option-picker/index.cjs +5 -5
  91. package/components/edit-option-picker/index.js +7 -7
  92. package/components/edit-option-position-picker/index.cjs +4 -4
  93. package/components/edit-option-position-picker/index.js +25 -21
  94. package/components/edit-option-positions-number-field/index.cjs +9 -9
  95. package/components/edit-option-positions-number-field/index.js +81 -76
  96. package/components/edit-option-radio-button-group/index.cjs +6 -6
  97. package/components/edit-option-radio-button-group/index.js +22 -21
  98. package/components/edit-option-slider/index.cjs +1 -1
  99. package/components/edit-option-slider/index.js +1 -1
  100. package/components/edit-option-switch/index.cjs +1 -1
  101. package/components/edit-option-switch/index.js +1 -1
  102. package/components/edit-option-text-field/index.cjs +2 -2
  103. package/components/edit-option-text-field/index.js +23 -22
  104. package/components/en-BKBhKBXY.cjs +20 -0
  105. package/components/en-BOTjhwEc.js +1488 -0
  106. package/components/{en-GB-ialeqj_z.js → en-GB-CEHEs8F2.js} +1 -1
  107. package/components/{en-GB-TqvgIw9B.cjs → en-GB-DG6uS3sM.cjs} +1 -1
  108. package/components/{evolution-number-options.config-Bc9eKYnn.cjs → evolution-number-options.config-BgIZY4gQ.cjs} +1 -1
  109. package/components/{evolution-number-options.config-BIPO_4n3.js → evolution-number-options.config-DzkfeoIN.js} +14 -11
  110. package/components/{extrapolate-color-C0n1UDs-.cjs → extrapolate-color-0j_AeYkz.cjs} +1 -1
  111. package/components/{extrapolate-color-v1PimdQr.js → extrapolate-color-CC9CURf6.js} +1 -1
  112. package/components/filter-data-item-picker/index.cjs +7 -7
  113. package/components/filter-data-item-picker/index.js +86 -85
  114. package/components/filter-expression-picker/index.cjs +1 -1
  115. package/components/filter-expression-picker/index.js +1 -1
  116. package/components/filter-item/index.cjs +6 -6
  117. package/components/filter-item/index.js +119 -109
  118. package/components/filter-value-picker/index.cjs +2 -2
  119. package/components/filter-value-picker/index.js +36 -34
  120. package/components/filter-value-picker-datetime/index.cjs +8 -8
  121. package/components/filter-value-picker-datetime/index.js +71 -56
  122. package/components/filter-value-picker-hierarchy/index.cjs +12 -12
  123. package/components/filter-value-picker-hierarchy/index.js +124 -113
  124. package/components/filter-value-picker-numeric/index.cjs +8 -8
  125. package/components/filter-value-picker-numeric/index.js +110 -101
  126. package/components/focusable-B3E_hQmm.cjs +20 -0
  127. package/components/{focusable-BS2pbY7w.js → focusable-DCIFkpiW.js} +26 -24
  128. package/components/{funnel-chart-options.config-CrJy2U7_.js → funnel-chart-options.config-C_VjTOvD.js} +20 -5
  129. package/components/funnel-chart-options.config-D7H7gFcx.cjs +20 -0
  130. package/components/get-css-variable-BEYG097C.js +1446 -0
  131. package/components/get-css-variable-BZxY4IOa.cjs +35 -0
  132. package/components/get-css-variable-DLiZYZEi.cjs +24 -0
  133. package/components/{get-css-variable-Bb7TxJdX.js → get-css-variable-YlLiVgo8.js} +37 -37
  134. package/components/grid/index.cjs +49 -43
  135. package/components/grid/index.js +1878 -2610
  136. package/components/{heat-map-options.config-CmL87j1j.js → heat-map-options.config-BnLWe8jS.js} +41 -35
  137. package/components/heat-map-options.config-DVH-Bb5-.cjs +20 -0
  138. package/components/heat-table-options.config-B12JEYnp.cjs +20 -0
  139. package/components/{heat-table-options.config-BrCYAgYD.js → heat-table-options.config-CUsDdgUr.js} +88 -60
  140. package/components/helpers-DXQwEH1P.cjs +20 -0
  141. package/components/helpers-v1bPALRP.js +91 -0
  142. package/components/hexbin-map-options.config-DZERRhM8.cjs +20 -0
  143. package/components/{hexbin-map-options.config-BguV1w8q.js → hexbin-map-options.config-F-7uCqxb.js} +38 -20
  144. package/components/{index-BNAmjOkm.cjs → index-BPNsFiyq.cjs} +4 -4
  145. package/components/index-CDi4fe3N.js +1716 -0
  146. package/components/index-CQ9ck-BO.cjs +249 -0
  147. package/components/index-CXn67vdn.cjs +121 -0
  148. package/components/{index-haa7WNrl.js → index-CdIUfo-L.js} +481 -453
  149. package/components/index-Cz9vSXy6.cjs +20 -0
  150. package/components/{index-DdyZ2g5L.js → index-D0GBF6tg.js} +104 -94
  151. package/components/index-Dn0j_pcR.cjs +20 -0
  152. package/components/{index-CqKpf0B8.js → index-Do7O9azB.js} +123 -112
  153. package/components/index-E239Dotg.js +1735 -0
  154. package/components/index.cjs +1 -1
  155. package/components/index.js +20 -18
  156. package/components/item-options-configs.cjs +1 -1
  157. package/components/item-options-configs.js +37 -37
  158. package/components/{line-chart-options.config-BhirTGqD.js → line-chart-options.config-DB3IsXXr.js} +28 -13
  159. package/components/line-chart-options.config-DSugoe0t.cjs +20 -0
  160. package/components/{localize-CcDpq940.js → localize-BX7q0S0M.js} +10 -10
  161. package/components/{localize-C4zNlrwK.cjs → localize-r7ALOUy_.cjs} +1 -1
  162. package/components/{marker-map-options.config-Bx17jmiq.js → marker-map-options.config-DPJ955tt.js} +1 -1
  163. package/components/{marker-map-options.config-CvhCylSC.cjs → marker-map-options.config-_FYZzRwA.cjs} +1 -1
  164. package/components/pivot-table-options.config-BiJXKSFR.cjs +20 -0
  165. package/components/{pivot-table-options.config-CFc7y0IT.js → pivot-table-options.config-DNK_AIG7.js} +24 -15
  166. package/components/pyramid-chart-options.config-C4zbFS26.cjs +20 -0
  167. package/components/{pyramid-chart-options.config-2Waxb11l.js → pyramid-chart-options.config-CcVMatYx.js} +43 -29
  168. package/components/{radar-chart-options.config-CPN5fOl8.js → radar-chart-options.config-CUZn_3Fd.js} +23 -11
  169. package/components/radar-chart-options.config-EqQu6PTh.cjs +20 -0
  170. package/components/{regular-table-options.config-CFKCJQK1.js → regular-table-options.config-BoLZsBry.js} +23 -17
  171. package/components/{regular-table-options.config-YRuoijIk.cjs → regular-table-options.config-DTx3RTnS.cjs} +1 -1
  172. package/components/{route-map-options.config-CyolTJfK.js → route-map-options.config-CN86T7c0.js} +109 -87
  173. package/components/route-map-options.config-D7NJePTu.cjs +20 -0
  174. package/components/{sankey-diagram-options.config-D7OSvSqm.cjs → sankey-diagram-options.config-RFB83YLZ.cjs} +1 -1
  175. package/components/{sankey-diagram-options.config-Ldjk84ro.js → sankey-diagram-options.config-tVLKy_Zn.js} +10 -7
  176. package/components/scatter-plot-options.config-CFfGJXsV.cjs +20 -0
  177. package/components/{scatter-plot-options.config-CfxEfkQ1.js → scatter-plot-options.config-Corlzno1.js} +86 -56
  178. package/components/{search-filter-options.config-Oqco9BKj.cjs → search-filter-options.config-BCaDlYqZ.cjs} +1 -1
  179. package/components/{search-filter-options.config-C0syQmP4.js → search-filter-options.config-BE3JhR-F.js} +6 -3
  180. package/components/{set-locale-hKTMz37h.js → set-locale-Dp3N_gXN.js} +8 -1
  181. package/components/{slicer-filter-options.config-DmOe3440.js → slicer-filter-options.config-3JZZcw5C.js} +18 -9
  182. package/components/slicer-filter-options.config-DNI-XevE.cjs +20 -0
  183. package/components/{slider-filter-options.config-B1M8RcDs.js → slider-filter-options.config-DH4SS8wH.js} +1 -1
  184. package/components/{slider-filter-options.config-k45I-t6G.cjs → slider-filter-options.config-_8Z2zKmU.cjs} +1 -1
  185. package/components/slot-contents-picker/index.cjs +33 -33
  186. package/components/slot-contents-picker/index.js +205 -194
  187. package/components/slot-menu/index.cjs +12 -12
  188. package/components/slot-menu/index.js +184 -171
  189. package/components/slot-menu-list/index.cjs +3 -3
  190. package/components/slot-menu-list/index.js +103 -97
  191. package/components/speedometer-chart-options.config-BX9LTQBH.cjs +20 -0
  192. package/components/{speedometer-chart-options.config-CzOmuEF8.js → speedometer-chart-options.config-SL581yOa.js} +53 -31
  193. package/components/{spike-map-options.config-Cbt1YUw6.js → spike-map-options.config-C5KewecZ.js} +122 -91
  194. package/components/spike-map-options.config-DoBFXPmN.cjs +20 -0
  195. package/components/{sunburst-chart-options.config-Yrxc2i57.cjs → sunburst-chart-options.config-AbNjWS6t.cjs} +1 -1
  196. package/components/{sunburst-chart-options.config-_dyLQxPJ.js → sunburst-chart-options.config-CNauGQJv.js} +20 -9
  197. package/components/{symbol-map-options.config-BORL1NSU.js → symbol-map-options.config-DdDA4aa7.js} +20 -11
  198. package/components/symbol-map-options.config-m-lwLTtu.cjs +20 -0
  199. package/components/treemap-chart-options.config-C0Q9aQ1Z.cjs +20 -0
  200. package/components/{treemap-chart-options.config-B9i9qIm_.js → treemap-chart-options.config-D5AJaF_u.js} +37 -20
  201. package/components/utils.cjs +1 -1
  202. package/components/utils.js +97 -94
  203. package/components/{video-options.config-B0asgYt8.cjs → video-options.config-CGsDTwHc.cjs} +1 -1
  204. package/components/{video-options.config-UX-9MDfS.js → video-options.config-Dk36zJ1B.js} +10 -7
  205. package/components/widget-menu/index.cjs +51 -0
  206. package/components/widget-menu/index.d.ts +8 -0
  207. package/components/widget-menu/index.js +211 -0
  208. package/components/widget-menu/widget-menu.d.ts +77 -0
  209. package/components/{wordcloud-chart-options.config-BKtJT8Va.cjs → wordcloud-chart-options.config-vGfCW8kE.cjs} +1 -1
  210. package/components/{wordcloud-chart-options.config-BoB_KuhA.js → wordcloud-chart-options.config-w2NUIWVA.js} +7 -4
  211. package/custom-elements.json +133 -20
  212. package/index.d.ts +1 -0
  213. package/package.json +6 -1
  214. package/types.d.ts +4 -0
  215. package/components/area-chart-options.config-Bl8bhhOo.cjs +0 -20
  216. package/components/bar-chart-options.config-CePAqM83.cjs +0 -20
  217. package/components/box-plot-options.config-BVNrV2eD.cjs +0 -20
  218. package/components/bubble-chart-options.config-BDgOe3GQ.cjs +0 -20
  219. package/components/calculate-data-item-icon-DMDhKq_m.js +0 -147
  220. package/components/calculate-data-item-icon-DtVGbet3.cjs +0 -20
  221. package/components/choropleth-map-options.config-CWJACFd0.cjs +0 -20
  222. package/components/circular-gauge-options.config-BMxgq3zH.cjs +0 -20
  223. package/components/color-Czp4Im5q.cjs +0 -20
  224. package/components/color-range-utils-DYYR-iwx.cjs +0 -20
  225. package/components/column-chart-options.config-BV9R3ssH.cjs +0 -20
  226. package/components/conditional-number-options.config-Co099Qfm.cjs +0 -20
  227. package/components/donut-chart-options.config-BQyPgnC9.cjs +0 -20
  228. package/components/en-D3ihEGXg.js +0 -1483
  229. package/components/en-DZcn_iz_.cjs +0 -20
  230. package/components/focusable-QLh-LlNt.cjs +0 -20
  231. package/components/funnel-chart-options.config-DrP4AFgk.cjs +0 -20
  232. package/components/get-css-variable-Pzks_rOx.cjs +0 -24
  233. package/components/heat-map-options.config-CIHnPdYE.cjs +0 -20
  234. package/components/heat-table-options.config-DTlZRc_i.cjs +0 -20
  235. package/components/helpers-9I0oLoUB.cjs +0 -20
  236. package/components/helpers-bR8Ibjqh.js +0 -79
  237. package/components/hexbin-map-options.config-CKnn3VAB.cjs +0 -20
  238. package/components/index-BekTY3Em.cjs +0 -121
  239. package/components/index-CFL6gmIu.cjs +0 -20
  240. package/components/index-DNPULp4A.js +0 -1755
  241. package/components/index-DvkzMbLt.cjs +0 -249
  242. package/components/line-chart-options.config-Cqwou5u6.cjs +0 -20
  243. package/components/pivot-table-options.config-uZDAertf.cjs +0 -20
  244. package/components/pyramid-chart-options.config-DoGfEvzU.cjs +0 -20
  245. package/components/radar-chart-options.config-CtNUMN1l.cjs +0 -20
  246. package/components/route-map-options.config-CVTk5RVL.cjs +0 -20
  247. package/components/scatter-plot-options.config-5gN7pMTm.cjs +0 -20
  248. package/components/slicer-filter-options.config-CrusP6a0.cjs +0 -20
  249. package/components/speedometer-chart-options.config-B4ceg_qI.cjs +0 -20
  250. package/components/spike-map-options.config-BkkDqb4g.cjs +0 -20
  251. package/components/symbol-map-options.config-NpBKm64d.cjs +0 -20
  252. package/components/treemap-chart-options.config-x4J54WSw.cjs +0 -20
@@ -0,0 +1,20 @@
1
+ /*! * A kit of modern Luzmo Web Components for analytics in your web application.
2
+ *
3
+ * Copyright © 2025 Luzmo
4
+ * All rights reserved.
5
+ * Luzmo web components (“Luzmo Web Components”)
6
+ * must be used according to the Luzmo Terms of Service.
7
+ * This license allows users with a current active Luzmo account
8
+ * to use the Luzmo Web Components. This license terminates
9
+ * automatically if a user no longer has an active Luzmo account.
10
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ * SOFTWARE.
19
+ * */
20
+ "use strict";var Fe=s=>{throw TypeError(s)};var we=(s,e,t)=>e.has(s)||Fe("Cannot "+t);var r=(s,e,t)=>(we(s,e,"read from private field"),t?t.call(s):e.get(s)),f=(s,e,t)=>e.has(s)?Fe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),h=(s,e,t,i)=>(we(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),P=(s,e,t)=>(we(s,e,"access private method"),t);var me=(s,e,t,i)=>({set _(n){h(s,e,n,t)},get _(){return r(s,e,i)}});var be=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ge=typeof window>"u"||"Deno"in globalThis;function Q(){}function Je(s,e){return typeof s=="function"?s(e):s}function ze(s){return typeof s=="number"&&s>=0&&s!==1/0}function We(s,e){return Math.max(s+(e||0)-Date.now(),0)}function Se(s,e){return typeof s=="function"?s(e):s}function Xe(s,e){return typeof s=="function"?s(e):s}function Ae(s,e){const{type:t="all",exact:i,fetchStatus:n,predicate:u,queryKey:o,stale:a}=s;if(o){if(i){if(e.queryHash!==qe(o,e.options))return!1}else if(!ce(e.queryKey,o))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||n&&n!==e.state.fetchStatus||u&&!u(e))}function De(s,e){const{exact:t,status:i,predicate:n,mutationKey:u}=s;if(u){if(!e.options.mutationKey)return!1;if(t){if(he(e.options.mutationKey)!==he(u))return!1}else if(!ce(e.options.mutationKey,u))return!1}return!(i&&e.state.status!==i||n&&!n(e))}function qe(s,e){return((e==null?void 0:e.queryKeyHashFn)||he)(s)}function he(s){return JSON.stringify(s,(e,t)=>Ce(t)?Object.keys(t).sort().reduce((i,n)=>(i[n]=t[n],i),{}):t)}function ce(s,e){return s===e?!0:typeof s!=typeof e?!1:s&&e&&typeof s=="object"&&typeof e=="object"?Object.keys(e).every(t=>ce(s[t],e[t])):!1}function He(s,e){if(s===e)return s;const t=Ee(s)&&Ee(e);if(t||Ce(s)&&Ce(e)){const i=t?s:Object.keys(s),n=i.length,u=t?e:Object.keys(e),o=u.length,a=t?[]:{};let l=0;for(let y=0;y<o;y++){const m=t?y:u[y];(!t&&i.includes(m)||t)&&s[m]===void 0&&e[m]===void 0?(a[m]=void 0,l++):(a[m]=He(s[m],e[m]),a[m]===s[m]&&s[m]!==void 0&&l++)}return n===o&&l===n?s:a}return e}function Ee(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function Ce(s){if(!Me(s))return!1;const e=s.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!Me(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(s)!==Object.prototype)}function Me(s){return Object.prototype.toString.call(s)==="[object Object]"}function Ye(s){return new Promise(e=>{setTimeout(e,s)})}function Ze(s,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(s,e):t.structuralSharing!==!1?He(s,e):e}function et(s,e,t=0){const i=[...s,e];return t&&i.length>t?i.slice(1):i}function tt(s,e,t=0){const i=[e,...s];return t&&i.length>t?i.slice(0,-1):i}var Oe=Symbol();function Ge(s,e){return!s.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!s.queryFn||s.queryFn===Oe?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}var J,G,Z,Re,st=(Re=class extends be{constructor(){super();f(this,J);f(this,G);f(this,Z);h(this,Z,e=>{if(!ge&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){r(this,G)||this.setEventListener(r(this,Z))}onUnsubscribe(){var e;this.hasListeners()||((e=r(this,G))==null||e.call(this),h(this,G,void 0))}setEventListener(e){var t;h(this,Z,e),(t=r(this,G))==null||t.call(this),h(this,G,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){r(this,J)!==e&&(h(this,J,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof r(this,J)=="boolean"?r(this,J):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},J=new WeakMap,G=new WeakMap,Z=new WeakMap,Re),Ne=new st,ee,N,te,Ke,it=(Ke=class extends be{constructor(){super();f(this,ee,!0);f(this,N);f(this,te);h(this,te,e=>{if(!ge&&window.addEventListener){const t=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}}})}onSubscribe(){r(this,N)||this.setEventListener(r(this,te))}onUnsubscribe(){var e;this.hasListeners()||((e=r(this,N))==null||e.call(this),h(this,N,void 0))}setEventListener(e){var t;h(this,te,e),(t=r(this,N))==null||t.call(this),h(this,N,e(this.setOnline.bind(this)))}setOnline(e){r(this,ee)!==e&&(h(this,ee,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return r(this,ee)}},ee=new WeakMap,N=new WeakMap,te=new WeakMap,Ke),ve=new it;function rt(){let s,e;const t=new Promise((n,u)=>{s=n,e=u});t.status="pending",t.catch(()=>{});function i(n){Object.assign(t,n),delete t.resolve,delete t.reject}return t.resolve=n=>{i({status:"fulfilled",value:n}),s(n)},t.reject=n=>{i({status:"rejected",reason:n}),e(n)},t}function nt(s){return Math.min(1e3*2**s,3e4)}function Ve(s){return(s??"online")==="online"?ve.isOnline():!0}var _e=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function Pe(s){return s instanceof _e}function $e(s){let e=!1,t=0,i=!1,n;const u=rt(),o=d=>{var v;i||(p(new _e(d)),(v=s.abort)==null||v.call(s))},a=()=>{e=!0},l=()=>{e=!1},y=()=>Ne.isFocused()&&(s.networkMode==="always"||ve.isOnline())&&s.canRun(),m=()=>Ve(s.networkMode)&&s.canRun(),c=d=>{var v;i||(i=!0,(v=s.onSuccess)==null||v.call(s,d),n==null||n(),u.resolve(d))},p=d=>{var v;i||(i=!0,(v=s.onError)==null||v.call(s,d),n==null||n(),u.reject(d))},S=()=>new Promise(d=>{var v;n=A=>{(i||y())&&d(A)},(v=s.onPause)==null||v.call(s)}).then(()=>{var d;n=void 0,i||(d=s.onContinue)==null||d.call(s)}),q=()=>{if(i)return;let d;const v=t===0?s.initialPromise:void 0;try{d=v??s.fn()}catch(A){d=Promise.reject(A)}Promise.resolve(d).then(c).catch(A=>{var j;if(i)return;const M=s.retry??(ge?0:3),g=s.retryDelay??nt,D=typeof g=="function"?g(t,A):g,K=M===!0||typeof M=="number"&&t<M||typeof M=="function"&&M(t,A);if(e||!K){p(A);return}t++,(j=s.onFail)==null||j.call(s,t,A),Ye(D).then(()=>y()?void 0:S()).then(()=>{e?p(A):q()})})};return{promise:u,cancel:o,continue:()=>(n==null||n(),u),cancelRetry:a,continueRetry:l,canStart:m,start:()=>(m()?q():S().then(q),u)}}var at=s=>setTimeout(s,0);function ut(){let s=[],e=0,t=a=>{a()},i=a=>{a()},n=at;const u=a=>{e?s.push(a):n(()=>{t(a)})},o=()=>{const a=s;s=[],a.length&&n(()=>{i(()=>{a.forEach(l=>{t(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{u(()=>{a(...l)})},schedule:u,setNotifyFunction:a=>{t=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{n=a}}}var F=ut(),z,je,Be=(je=class{constructor(){f(this,z)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ze(this.gcTime)&&h(this,z,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(ge?1/0:5*60*1e3))}clearGcTimeout(){r(this,z)&&(clearTimeout(r(this,z)),h(this,z,void 0))}},z=new WeakMap,je),se,ie,E,W,C,le,X,T,L,ke,ot=(ke=class extends Be{constructor(e){super();f(this,T);f(this,se);f(this,ie);f(this,E);f(this,W);f(this,C);f(this,le);f(this,X);h(this,X,!1),h(this,le,e.defaultOptions),this.setOptions(e.options),this.observers=[],h(this,W,e.client),h(this,E,r(this,W).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,h(this,se,ct(this.options)),this.state=e.state??r(this,se),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=r(this,C))==null?void 0:e.promise}setOptions(e){this.options={...r(this,le),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&r(this,E).remove(this)}setData(e,t){const i=Ze(this.state.data,e,this.options);return P(this,T,L).call(this,{data:i,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),i}setState(e,t){P(this,T,L).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var i,n;const t=(i=r(this,C))==null?void 0:i.promise;return(n=r(this,C))==null||n.cancel(e),t?t.then(Q).catch(Q):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(r(this,se))}isActive(){return this.observers.some(e=>Xe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!We(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(i=>i.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=r(this,C))==null||t.continue()}onOnline(){var t;const e=this.observers.find(i=>i.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=r(this,C))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),r(this,E).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(r(this,C)&&(r(this,X)?r(this,C).cancel({revert:!0}):r(this,C).cancelRetry()),this.scheduleGc()),r(this,E).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||P(this,T,L).call(this,{type:"invalidate"})}fetch(e,t){var l,y,m;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(r(this,C))return r(this,C).continueRetry(),r(this,C).promise}if(e&&this.setOptions(e),!this.options.queryFn){const c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.options)}const i=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(h(this,X,!0),i.signal)})},u=()=>{const c=Ge(this.options,t),p={client:r(this,W),queryKey:this.queryKey,meta:this.meta};return n(p),h(this,X,!1),this.options.persister?this.options.persister(c,p,this):c(p)},o={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:r(this,W),state:this.state,fetchFn:u};n(o),(l=this.options.behavior)==null||l.onFetch(o,this),h(this,ie,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=o.fetchOptions)==null?void 0:y.meta))&&P(this,T,L).call(this,{type:"fetch",meta:(m=o.fetchOptions)==null?void 0:m.meta});const a=c=>{var p,S,q,d;Pe(c)&&c.silent||P(this,T,L).call(this,{type:"error",error:c}),Pe(c)||((S=(p=r(this,E).config).onError)==null||S.call(p,c,this),(d=(q=r(this,E).config).onSettled)==null||d.call(q,this.state.data,c,this)),this.scheduleGc()};return h(this,C,$e({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,abort:i.abort.bind(i),onSuccess:c=>{var p,S,q,d;if(c===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(v){a(v);return}(S=(p=r(this,E).config).onSuccess)==null||S.call(p,c,this),(d=(q=r(this,E).config).onSettled)==null||d.call(q,c,this.state.error,this),this.scheduleGc()},onError:a,onFail:(c,p)=>{P(this,T,L).call(this,{type:"failed",failureCount:c,error:p})},onPause:()=>{P(this,T,L).call(this,{type:"pause"})},onContinue:()=>{P(this,T,L).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),r(this,C).start()}},se=new WeakMap,ie=new WeakMap,E=new WeakMap,W=new WeakMap,C=new WeakMap,le=new WeakMap,X=new WeakMap,T=new WeakSet,L=function(e){const t=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...ht(i.data,this.options),fetchMeta:e.meta??null};case"success":return{...i,data:e.data,dataUpdateCount:i.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return Pe(n)&&n.revert&&r(this,ie)?{...r(this,ie),fetchStatus:"idle"}:{...i,error:n,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=t(this.state),F.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),r(this,E).notify({query:this,type:"updated",action:e})})},ke);function ht(s,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ve(e.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function ct(s){const e=typeof s.initialData=="function"?s.initialData():s.initialData,t=e!==void 0,i=t?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var k,Ue,lt=(Ue=class extends be{constructor(e={}){super();f(this,k);this.config=e,h(this,k,new Map)}build(e,t,i){const n=t.queryKey,u=t.queryHash??qe(n,t);let o=this.get(u);return o||(o=new ot({client:e,queryKey:n,queryHash:u,options:e.defaultQueryOptions(t),state:i,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){r(this,k).has(e.queryHash)||(r(this,k).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=r(this,k).get(e.queryHash);t&&(e.destroy(),t===e&&r(this,k).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return r(this,k).get(e)}getAll(){return[...r(this,k).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(i=>Ae(t,i))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(i=>Ae(e,i)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},k=new WeakMap,Ue),U,O,Y,I,H,Ie,dt=(Ie=class extends Be{constructor(e){super();f(this,I);f(this,U);f(this,O);f(this,Y);this.mutationId=e.mutationId,h(this,O,e.mutationCache),h(this,U,[]),this.state=e.state||ft(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){r(this,U).includes(e)||(r(this,U).push(e),this.clearGcTimeout(),r(this,O).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){h(this,U,r(this,U).filter(t=>t!==e)),this.scheduleGc(),r(this,O).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){r(this,U).length||(this.state.status==="pending"?this.scheduleGc():r(this,O).remove(this))}continue(){var e;return((e=r(this,Y))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var u,o,a,l,y,m,c,p,S,q,d,v,A,M,g,D,K,j,fe,oe;const t=()=>{P(this,I,H).call(this,{type:"continue"})};h(this,Y,$e({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(w,ye)=>{P(this,I,H).call(this,{type:"failed",failureCount:w,error:ye})},onPause:()=>{P(this,I,H).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>r(this,O).canRun(this)}));const i=this.state.status==="pending",n=!r(this,Y).canStart();try{if(i)t();else{P(this,I,H).call(this,{type:"pending",variables:e,isPaused:n}),await((o=(u=r(this,O).config).onMutate)==null?void 0:o.call(u,e,this));const ye=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,e));ye!==this.state.context&&P(this,I,H).call(this,{type:"pending",context:ye,variables:e,isPaused:n})}const w=await r(this,Y).start();return await((m=(y=r(this,O).config).onSuccess)==null?void 0:m.call(y,w,e,this.state.context,this)),await((p=(c=this.options).onSuccess)==null?void 0:p.call(c,w,e,this.state.context)),await((q=(S=r(this,O).config).onSettled)==null?void 0:q.call(S,w,null,this.state.variables,this.state.context,this)),await((v=(d=this.options).onSettled)==null?void 0:v.call(d,w,null,e,this.state.context)),P(this,I,H).call(this,{type:"success",data:w}),w}catch(w){try{throw await((M=(A=r(this,O).config).onError)==null?void 0:M.call(A,w,e,this.state.context,this)),await((D=(g=this.options).onError)==null?void 0:D.call(g,w,e,this.state.context)),await((j=(K=r(this,O).config).onSettled)==null?void 0:j.call(K,void 0,w,this.state.variables,this.state.context,this)),await((oe=(fe=this.options).onSettled)==null?void 0:oe.call(fe,void 0,w,e,this.state.context)),w}finally{P(this,I,H).call(this,{type:"error",error:w})}}finally{r(this,O).runNext(this)}}},U=new WeakMap,O=new WeakMap,Y=new WeakMap,I=new WeakSet,H=function(e){const t=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),F.batch(()=>{r(this,U).forEach(i=>{i.onMutationUpdate(e)}),r(this,O).notify({mutation:this,type:"updated",action:e})})},Ie);function ft(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var x,R,de,Le,yt=(Le=class extends be{constructor(e={}){super();f(this,x);f(this,R);f(this,de);this.config=e,h(this,x,new Set),h(this,R,new Map),h(this,de,0)}build(e,t,i){const n=new dt({mutationCache:this,mutationId:++me(this,de)._,options:e.defaultMutationOptions(t),state:i});return this.add(n),n}add(e){r(this,x).add(e);const t=pe(e);if(typeof t=="string"){const i=r(this,R).get(t);i?i.push(e):r(this,R).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(r(this,x).delete(e)){const t=pe(e);if(typeof t=="string"){const i=r(this,R).get(t);if(i)if(i.length>1){const n=i.indexOf(e);n!==-1&&i.splice(n,1)}else i[0]===e&&r(this,R).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=pe(e);if(typeof t=="string"){const i=r(this,R).get(t),n=i==null?void 0:i.find(u=>u.state.status==="pending");return!n||n===e}else return!0}runNext(e){var i;const t=pe(e);if(typeof t=="string"){const n=(i=r(this,R).get(t))==null?void 0:i.find(u=>u!==e&&u.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){F.batch(()=>{r(this,x).forEach(e=>{this.notify({type:"removed",mutation:e})}),r(this,x).clear(),r(this,R).clear()})}getAll(){return Array.from(r(this,x))}find(e){const t={exact:!0,...e};return this.getAll().find(i=>De(t,i))}findAll(e={}){return this.getAll().filter(t=>De(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return F.batch(()=>Promise.all(e.map(t=>t.continue().catch(Q))))}},x=new WeakMap,R=new WeakMap,de=new WeakMap,Le);function pe(s){var e;return(e=s.options.scope)==null?void 0:e.id}function Qe(s){return{onFetch:(e,t)=>{var m,c,p,S,q;const i=e.options,n=(p=(c=(m=e.fetchOptions)==null?void 0:m.meta)==null?void 0:c.fetchMore)==null?void 0:p.direction,u=((S=e.state.data)==null?void 0:S.pages)||[],o=((q=e.state.data)==null?void 0:q.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const y=async()=>{let d=!1;const v=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(e.signal.aborted?d=!0:e.signal.addEventListener("abort",()=>{d=!0}),e.signal)})},A=Ge(e.options,e.fetchOptions),M=async(g,D,K)=>{if(d)return Promise.reject();if(D==null&&g.pages.length)return Promise.resolve(g);const j={client:e.client,queryKey:e.queryKey,pageParam:D,direction:K?"backward":"forward",meta:e.options.meta};v(j);const fe=await A(j),{maxPages:oe}=e.options,w=K?tt:et;return{pages:w(g.pages,fe,oe),pageParams:w(g.pageParams,D,oe)}};if(n&&u.length){const g=n==="backward",D=g?mt:Te,K={pages:u,pageParams:o},j=D(i,K);a=await M(K,j,g)}else{const g=s??u.length;do{const D=l===0?o[0]??i.initialPageParam:Te(i,a);if(l>0&&D==null)break;a=await M(a,D),l++}while(l<g)}return a};e.options.persister?e.fetchFn=()=>{var d,v;return(v=(d=e.options).persister)==null?void 0:v.call(d,y,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=y}}}function Te(s,{pages:e,pageParams:t}){const i=e.length-1;return e.length>0?s.getNextPageParam(e[i],e,t[i],t):void 0}function mt(s,{pages:e,pageParams:t}){var i;return e.length>0?(i=s.getPreviousPageParam)==null?void 0:i.call(s,e[0],e,t[0],t):void 0}var b,V,_,re,ne,$,ae,ue,xe,pt=(xe=class{constructor(s={}){f(this,b);f(this,V);f(this,_);f(this,re);f(this,ne);f(this,$);f(this,ae);f(this,ue);h(this,b,s.queryCache||new lt),h(this,V,s.mutationCache||new yt),h(this,_,s.defaultOptions||{}),h(this,re,new Map),h(this,ne,new Map),h(this,$,0)}mount(){me(this,$)._++,r(this,$)===1&&(h(this,ae,Ne.subscribe(async s=>{s&&(await this.resumePausedMutations(),r(this,b).onFocus())})),h(this,ue,ve.subscribe(async s=>{s&&(await this.resumePausedMutations(),r(this,b).onOnline())})))}unmount(){var s,e;me(this,$)._--,r(this,$)===0&&((s=r(this,ae))==null||s.call(this),h(this,ae,void 0),(e=r(this,ue))==null||e.call(this),h(this,ue,void 0))}isFetching(s){return r(this,b).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return r(this,V).findAll({...s,status:"pending"}).length}getQueryData(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=r(this,b).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(s){const e=this.defaultQueryOptions(s),t=r(this,b).build(this,e),i=t.state.data;return i===void 0?this.fetchQuery(s):(s.revalidateIfStale&&t.isStaleByTime(Se(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(s){return r(this,b).findAll(s).map(({queryKey:e,state:t})=>{const i=t.data;return[e,i]})}setQueryData(s,e,t){const i=this.defaultQueryOptions({queryKey:s}),n=r(this,b).get(i.queryHash),u=n==null?void 0:n.state.data,o=Je(e,u);if(o!==void 0)return r(this,b).build(this,i).setData(o,{...t,manual:!0})}setQueriesData(s,e,t){return F.batch(()=>r(this,b).findAll(s).map(({queryKey:i})=>[i,this.setQueryData(i,e,t)]))}getQueryState(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=r(this,b).get(e.queryHash))==null?void 0:t.state}removeQueries(s){const e=r(this,b);F.batch(()=>{e.findAll(s).forEach(t=>{e.remove(t)})})}resetQueries(s,e){const t=r(this,b);return F.batch(()=>(t.findAll(s).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...s},e)))}cancelQueries(s,e={}){const t={revert:!0,...e},i=F.batch(()=>r(this,b).findAll(s).map(n=>n.cancel(t)));return Promise.all(i).then(Q).catch(Q)}invalidateQueries(s,e={}){return F.batch(()=>(r(this,b).findAll(s).forEach(t=>{t.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},e)))}refetchQueries(s,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},i=F.batch(()=>r(this,b).findAll(s).filter(n=>!n.isDisabled()).map(n=>{let u=n.fetch(void 0,t);return t.throwOnError||(u=u.catch(Q)),n.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(i).then(Q)}fetchQuery(s){const e=this.defaultQueryOptions(s);e.retry===void 0&&(e.retry=!1);const t=r(this,b).build(this,e);return t.isStaleByTime(Se(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(Q).catch(Q)}fetchInfiniteQuery(s){return s.behavior=Qe(s.pages),this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(Q).catch(Q)}ensureInfiniteQueryData(s){return s.behavior=Qe(s.pages),this.ensureQueryData(s)}resumePausedMutations(){return ve.isOnline()?r(this,V).resumePausedMutations():Promise.resolve()}getQueryCache(){return r(this,b)}getMutationCache(){return r(this,V)}getDefaultOptions(){return r(this,_)}setDefaultOptions(s){h(this,_,s)}setQueryDefaults(s,e){r(this,re).set(he(s),{queryKey:s,defaultOptions:e})}getQueryDefaults(s){const e=[...r(this,re).values()],t={};return e.forEach(i=>{ce(s,i.queryKey)&&Object.assign(t,i.defaultOptions)}),t}setMutationDefaults(s,e){r(this,ne).set(he(s),{mutationKey:s,defaultOptions:e})}getMutationDefaults(s){const e=[...r(this,ne).values()],t={};return e.forEach(i=>{ce(s,i.mutationKey)&&Object.assign(t,i.defaultOptions)}),t}defaultQueryOptions(s){if(s._defaulted)return s;const e={...r(this,_).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return e.queryHash||(e.queryHash=qe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Oe&&(e.enabled=!1),e}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...r(this,_).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){r(this,b).clear(),r(this,V).clear()}},b=new WeakMap,V=new WeakMap,_=new WeakMap,re=new WeakMap,ne=new WeakMap,$=new WeakMap,ae=new WeakMap,ue=new WeakMap,xe);class B{constructor(e={}){this.availableDatasets=[],this.apiUrl=e.apiUrl||"https://api.luzmo.com",this.apiVersion=e.apiVersion||"0.1.0",this.authKey=e.authKey||"",this.authToken=e.authToken||"",this.queryClient=new pt({defaultOptions:{queries:{staleTime:e.staleTime||5*60*1e3,gcTime:e.gcTime||10*60*1e3,retry:e.retry||3,retryDelay:e.retryDelay||(t=>Math.min(1e3*2**t,3e4))}}}),this.initNetworkListeners()}configure(e={}){if(e.apiVersion&&(this.apiVersion=e.apiVersion),e.apiUrl&&(this.apiUrl=e.apiUrl),e.authKey&&(this.authKey=e.authKey),e.authToken&&(this.authToken=e.authToken),e.staleTime||e.gcTime||e.retry){const t={};e.staleTime&&(t.staleTime=e.staleTime),e.gcTime&&(t.gcTime=e.gcTime),e.retry&&(t.retry=e.retry),this.queryClient.setDefaultOptions({queries:{...this.queryClient.getDefaultOptions().queries,...t}})}}initNetworkListeners(){typeof window<"u"&&window.addEventListener("online",()=>{console.warn("Network connection restored, refreshing data..."),this.refreshAll()})}getHeaders(e={}){return{"Content-Type":"application/json",...e}}async fetchApi(e,t,i={}){const n=`${this.apiUrl}/${this.apiVersion}${e}`,o={method:i.method||"POST",headers:this.getHeaders(i.headers),mode:"cors",...i};t!==void 0&&(t.key=this.authKey,t.token=this.authToken,o.body=JSON.stringify(t));try{const a=await fetch(n,o);if(!a.ok){const l=await a.json().catch(()=>null);throw a.status===401||a.status===403?new Error("Authentication failed. Please check your API token."):a.status===404?new Error(`Resource not found: ${e}`):a.status===429?new Error("Rate limit exceeded. Please try again later."):new Error((l==null?void 0:l.message)||`API request failed with status ${a.status}`)}return await a.json()}catch(a){throw console.error(`API request to ${e} failed:`,a),a instanceof Error&&(a.endpoint=e,a.timestamp=new Date().toISOString()),a}}async fetchAllDatasets(e={}){const t=e.offset||0,i=e.limit||50,n=["datasets",t,i];return await this.queryClient.fetchQuery({queryKey:n,queryFn:async()=>{const u={action:"get",version:this.apiVersion,find:{where:{type:"dataset"},limit:i,offset:t}},o=await this.fetchApi("/securable",u);return{data:(o==null?void 0:o.rows)??[],pagination:{offset:t,limit:i,total:(o==null?void 0:o.count)??0,pages:Math.ceil(((o==null?void 0:o.count)??0)/i)}}}})}async searchDatasets(e,t){if(!e)return{data:[]};const i=["datasets","search",e,t];return await this.queryClient.fetchQuery({queryKey:i,queryFn:async()=>{const n={action:"get",version:this.apiVersion,find:{where:{type:"dataset"}}};(e==null?void 0:e.length)>0&&(n.find.search={match_types:["name"],keyphrase:e}),t!=null&&t.offset&&(n.find.offset=t==null?void 0:t.offset),t!=null&&t.limit&&(n.find.limit=t==null?void 0:t.limit);const u=await this.fetchApi("/securable",n),o={data:(u==null?void 0:u.rows)??[]};return t!=null&&t.limit&&(o.pagination={offset:(t==null?void 0:t.offset)??0,limit:t==null?void 0:t.limit,total:(u==null?void 0:u.count)??0,pages:Math.ceil(((u==null?void 0:u.count)??0)/(t==null?void 0:t.limit))}),o}})}async fetchDatasetsWithColumnsAndFormulas(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const t=["datasets",e,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:t,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{where:{type:"dataset",id:{in:e}},attributes:["name","id","description"],include:[{model:"Column",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],separate:!0,order:[["order","asc"]],include:[{model:"Column",attributes:["id","securable_id","hierarchy_enabled","currency_id"],as:"Joins"},{model:"HierarchyLevel",attributes:["id","level","name"],as:"HierarchyLevels"},{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]},{model:"Formula",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],include:[{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]}]}},n=await this.fetchApi("/securable",i);return(n==null?void 0:n.rows)??[]}})}async fetchData(e){if(!e)throw new Error("Query is required");const t=["data",e];return await this.queryClient.fetchQuery({queryKey:t,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{queries:[e]}},n=await this.fetchApi("/data",i);return{data:(n==null?void 0:n.data)||[],performance:(n==null?void 0:n.performance)||{}}}})}refreshAll(){this.queryClient.refetchQueries()}invalidateDatasetData(e){e?(this.queryClient.invalidateQueries({queryKey:["dataset",e]}),this.queryClient.invalidateQueries({queryKey:["columns",e]})):this.queryClient.invalidateQueries({queryKey:["datasets"]})}invalidateAll(){this.queryClient.clear()}static getInstance(e={}){return B.instance?Object.keys(e).length>0&&B.instance.configure(e):B.instance=new B(e),B.instance}async fetchDatasetsRecursive(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const t=[...new Set(e)],i=new Set,n=new Map,u=o=>{o&&!i.has(o)&&!t.includes(o)&&t.push(o)};for(;t.length>0;){const o=[];for(;t.length>0&&o.length<50;){const a=t.shift();i.has(a)||o.push(a)}if(o.length!==0)try{(await this.fetchDatasetsWithColumnsAndFormulas(o)).forEach(l=>{const y=this.postProcessDatasetMetadata(l);i.add(y.id),this.queryClient.setQueryData(["dataset",y.id],y),(y.outgoingJoins??[]).map(c=>c.securable_id).filter(c=>!!c&&c!==y.id).forEach(c=>{u(c)}),n.set(y.id,y),this.availableDatasets.some(c=>c.id===y.id)||this.availableDatasets.push({id:y.id,name:y.name,columns:y.columns})})}catch(a){console.error("Error fetching datasets recursively:",a)}}return[...n.values()]}postProcessDatasetMetadata(e){const t=[],i=(e.columns??[]).map(n=>{const u=n.joins??(Array.isArray(n.joins)?n.joins:[]);Array.isArray(u)&&u.length>0&&t.push(...u);const{joins:o,...a}=n;return{...a,joins:u}});return{...e,columns:i,formulas:e.formulas??[],outgoingJoins:t,dateLoaded:new Date}}getAvailableDatasets(){return this.availableDatasets}getLinkedDatasetsIds(e){const t=this.queryClient.getQueryData(["dataset",e]);return t?(t.outgoingJoins??[]).map(i=>i.securable_id).filter(i=>!!i&&i!==e):[]}}const vt=B.getInstance();exports.dataBroker=vt;
@@ -20,12 +20,12 @@
20
20
  import "@luzmo/lucero/field-label";
21
21
  import "@luzmo/lucero/menu";
22
22
  import "@luzmo/lucero/select";
23
- import { unsafeCSS as y, html as f } from "lit";
24
- import { msg as e, localized as b } from "@lit/localize";
25
- import { SizedMixin as g, LuzmoElement as w, ElementSizes as F } from "@luzmo/lucero/utils";
26
- import { property as p, state as x } from "lit/decorators.js";
27
- import { g as _, t as k, s as v } from "./set-locale-hKTMz37h.js";
28
- const h = () => [
23
+ import { unsafeCSS as v, html as _ } from "lit";
24
+ import { msg as e, localized as q } from "@lit/localize";
25
+ import { SizedMixin as E, LuzmoElement as z, ElementSizes as D } from "@luzmo/lucero/utils";
26
+ import { property as d, state as S } from "lit/decorators.js";
27
+ import { g as T, t as $, s as L } from "./set-locale-Dp3N_gXN.js";
28
+ const m = () => [
29
29
  {
30
30
  id: "? = ?",
31
31
  key: "? = ?",
@@ -439,86 +439,96 @@ const h = () => [
439
439
  type: ["numeric", "datetime", "hierarchy", "spatial"],
440
440
  subtype: ["ip_address"]
441
441
  }
442
- ], m = (s, t, r) => {
442
+ ], k = (i, s, r) => {
443
443
  const o = /* @__PURE__ */ new Set(["? in ?", "? not in ?"]);
444
- return !s && !t ? h() : h().filter((a) => (s && a.type.includes(s) || t && a.subtype?.includes(t)) && !(r && o.has(a.key)));
445
- }, S = ":host{font-family:var(--luzmo-font-family)}:host{--var: blue}";
446
- var E = Object.defineProperty, q = Object.getOwnPropertyDescriptor, n = (s, t, r, o) => {
447
- for (var a = o > 1 ? void 0 : o ? q(t, r) : t, d = s.length - 1, l; d >= 0; d--)
448
- (l = s[d]) && (a = (o ? l(t, r, a) : l(a)) || a);
449
- return o && a && E(t, r, a), a;
444
+ return !i && !s ? m() : m().filter((t) => {
445
+ var n;
446
+ return (i && t.type.includes(i) || s && ((n = t.subtype) == null ? void 0 : n.includes(s))) && !(r && o.has(t.key));
447
+ });
448
+ }, C = ":host{font-family:var(--luzmo-font-family)}:host{--var: blue}";
449
+ var B = Object.defineProperty, O = Object.getOwnPropertyDescriptor, p = (i, s, r, o) => {
450
+ for (var t = o > 1 ? void 0 : o ? O(s, r) : s, n = i.length - 1, l; n >= 0; n--)
451
+ (l = i[n]) && (t = (o ? l(s, r, t) : l(t)) || t);
452
+ return o && t && B(s, r, t), t;
450
453
  };
451
- let i = class extends g(w, {
452
- validSizes: Object.values(F)
454
+ let a = class extends E(z, {
455
+ validSizes: Object.values(D)
453
456
  }) {
454
457
  constructor() {
455
- super(...arguments), this.language = "en", this.hasLabel = !1, this.allowEmpty = !1, this.placeholder = "", this.disabled = !1, this.invalid = !1, this.isFormula = !1, this._expressionConfigurations = h();
458
+ super(...arguments), this.language = "en", this.hasLabel = !1, this.allowEmpty = !1, this.placeholder = "", this.disabled = !1, this.invalid = !1, this.isFormula = !1, this._expressionConfigurations = m();
456
459
  }
457
460
  static get styles() {
458
- return [y(S)];
461
+ return [v(C)];
459
462
  }
460
463
  _sendChangeEvent() {
464
+ var s, r, o, t, n, l, c;
461
465
  if (this.disabled) return;
462
- const s = {
463
- expression: this.filter?.expression
466
+ const i = {
467
+ expression: (s = this.filter) == null ? void 0 : s.expression
464
468
  };
465
- this.filter?.parameters?.[1]?.unit && (s.unit = this.filter?.parameters?.[1]?.unit), this.dispatchEvent(
469
+ (t = (o = (r = this.filter) == null ? void 0 : r.parameters) == null ? void 0 : o[1]) != null && t.unit && (i.unit = (c = (l = (n = this.filter) == null ? void 0 : n.parameters) == null ? void 0 : l[1]) == null ? void 0 : c.unit), this.dispatchEvent(
466
470
  new CustomEvent("expression-selected", {
467
471
  bubbles: !0,
468
472
  composed: !0,
469
473
  cancelable: !0,
470
- detail: s
474
+ detail: i
471
475
  })
472
476
  );
473
477
  }
474
- setExpression(s) {
475
- this._richExpression = s?.detail?.value?.[0];
476
- const t = this._expressionConfigurations.find(
477
- (o) => o.id === this._richExpression
478
+ setExpression(i) {
479
+ var o, t;
480
+ this._richExpression = (t = (o = i == null ? void 0 : i.detail) == null ? void 0 : o.value) == null ? void 0 : t[0];
481
+ const s = this._expressionConfigurations.find(
482
+ (n) => n.id === this._richExpression
478
483
  ), r = structuredClone(this.filter);
479
- r.expression = t?.expression, t?.unit && (this._unit = t.unit, r?.parameters[0] && (r.parameters[1] = {
484
+ r.expression = s == null ? void 0 : s.expression, s != null && s.unit && (this._unit = s.unit, r != null && r.parameters[0] && (r.parameters[1] = {
480
485
  unit: this._unit
481
486
  })), this.filter = r, this._sendChangeEvent();
482
487
  }
483
- willUpdate(s) {
484
- const t = s.has("language"), r = s.has("filter"), o = s.has("type"), a = s.has("subtype"), d = s.has("isFormula");
485
- t && this.language !== _() && ([...k].includes(this.language ?? "en") || this.language === "en") && v(this.language);
486
- const l = m(
488
+ willUpdate(i) {
489
+ var f, u, x, y, b, w, F;
490
+ const s = i.has("language"), r = i.has("filter"), o = i.has("type"), t = i.has("subtype"), n = i.has("isFormula");
491
+ s && this.language !== T() && ([...$].includes(this.language ?? "en") || this.language === "en") && L(this.language);
492
+ const l = k(
487
493
  this.type,
488
494
  this.subtype,
489
495
  this.isFormula
490
- ), u = ["YTD", "QTD", "MTD", "WTD"];
491
- if (this.filter?.expression === "to_date") {
492
- const c = this.filter?.parameters[1]?.unit ?? 1;
493
- this._unit = c, this._richExpression = u[c - 1] ?? "YTD";
496
+ ), c = ["YTD", "QTD", "MTD", "WTD"];
497
+ if (((f = this.filter) == null ? void 0 : f.expression) === "to_date") {
498
+ const h = ((x = (u = this.filter) == null ? void 0 : u.parameters[1]) == null ? void 0 : x.unit) ?? 1;
499
+ this._unit = h, this._richExpression = c[h - 1] ?? "YTD";
494
500
  } else
495
- this._richExpression = this.filter?.expression;
496
- (o || a || d || r) && this.filter && !this.disabled && !l?.find(
497
- (c) => c.expression === this.filter?.expression
498
- ) ? (this.invalid = !0, console.warn(
499
- `Warning: ${this.filter?.expression} is not valid given the type: ${this.type} and subtype: ${this.subtype}`
500
- )) : this.invalid = !1, !this.filter?.expression && !this.allowEmpty && (this._richExpression = l?.[0]?.id, this.filter = {
501
+ this._richExpression = (y = this.filter) == null ? void 0 : y.expression;
502
+ (o || t || n || r) && this.filter && !this.disabled && !(l != null && l.find(
503
+ (h) => {
504
+ var g;
505
+ return h.expression === ((g = this.filter) == null ? void 0 : g.expression);
506
+ }
507
+ )) ? (this.invalid = !0, console.warn(
508
+ `Warning: ${(b = this.filter) == null ? void 0 : b.expression} is not valid given the type: ${this.type} and subtype: ${this.subtype}`
509
+ )) : this.invalid = !1, !((w = this.filter) != null && w.expression) && !this.allowEmpty && (this._richExpression = (F = l == null ? void 0 : l[0]) == null ? void 0 : F.id, this.filter = {
501
510
  ...this.filter,
502
511
  expression: this._richExpression
503
512
  }, this._sendChangeEvent());
504
513
  }
505
514
  render() {
506
- const s = m(
515
+ var o, t;
516
+ const i = (o = k(
507
517
  this.type,
508
518
  this.subtype,
509
519
  this.isFormula
510
- )?.map((o) => ({
511
- value: o.id,
512
- label: o.description,
513
- shortLabel: o.tiny
514
- })), t = this.disabled || !this.filter?.expression && !this.allowEmpty, r = f`<luzmo-field-label
520
+ )) == null ? void 0 : o.map((n) => ({
521
+ value: n.id,
522
+ label: n.description,
523
+ shortLabel: n.tiny
524
+ })), s = this.disabled || !((t = this.filter) != null && t.expression) && !this.allowEmpty, r = _`<luzmo-field-label
515
525
  for="expression"
516
526
  size=${this.size}
517
527
  >${this.label ?? e("Select an expression", {
518
528
  desc: "Label for expression picker"
519
529
  })}</luzmo-field-label
520
530
  >`;
521
- return f`${this.hasLabel ? r : ""}
531
+ return _`${this.hasLabel ? r : ""}
522
532
  <luzmo-select
523
533
  label=${this.placeholder ?? e("Select...")}
524
534
  id="expression"
@@ -526,62 +536,62 @@ let i = class extends g(w, {
526
536
  variant="highlight"
527
537
  selects="single"
528
538
  .language=${this.language}
529
- ?disabled=${t}
539
+ ?disabled=${s}
530
540
  ?invalid=${this.invalid}
531
- .options=${s}
541
+ .options=${i}
532
542
  .value=${[this._richExpression]}
533
543
  @change=${this.setExpression}
534
544
  >
535
545
  </luzmo-select>`;
536
546
  }
537
547
  };
538
- n([
539
- p({ type: String, reflect: !0 })
540
- ], i.prototype, "language", 2);
541
- n([
542
- p({ type: String, reflect: !0 })
543
- ], i.prototype, "filter", 2);
544
- n([
545
- p({ type: Boolean, attribute: "has-label", reflect: !0 })
546
- ], i.prototype, "hasLabel", 2);
547
- n([
548
- p({ type: String, reflect: !0 })
549
- ], i.prototype, "label", 2);
550
- n([
551
- p({ type: Boolean, attribute: "allow-empty", reflect: !0 })
552
- ], i.prototype, "allowEmpty", 2);
553
- n([
554
- p({ type: String, attribute: "placeholder", reflect: !0 })
555
- ], i.prototype, "placeholder", 2);
556
- n([
557
- p({ type: Boolean, attribute: "disabled", reflect: !0 })
558
- ], i.prototype, "disabled", 2);
559
- n([
560
- p({ type: String, attribute: "type", reflect: !0 })
561
- ], i.prototype, "type", 2);
562
- n([
563
- p({ type: String, attribute: "subtype", reflect: !0 })
564
- ], i.prototype, "subtype", 2);
565
- n([
566
- p({ type: Boolean, attribute: "invalid", reflect: !0 })
567
- ], i.prototype, "invalid", 2);
568
- n([
569
- p({ type: Boolean, attribute: "is-formula", reflect: !0 })
570
- ], i.prototype, "isFormula", 2);
571
- n([
572
- x()
573
- ], i.prototype, "_richExpression", 2);
574
- n([
575
- x()
576
- ], i.prototype, "_unit", 2);
577
- i = n([
578
- b()
579
- ], i);
548
+ p([
549
+ d({ type: String, reflect: !0 })
550
+ ], a.prototype, "language", 2);
551
+ p([
552
+ d({ type: String, reflect: !0 })
553
+ ], a.prototype, "filter", 2);
554
+ p([
555
+ d({ type: Boolean, attribute: "has-label", reflect: !0 })
556
+ ], a.prototype, "hasLabel", 2);
557
+ p([
558
+ d({ type: String, reflect: !0 })
559
+ ], a.prototype, "label", 2);
560
+ p([
561
+ d({ type: Boolean, attribute: "allow-empty", reflect: !0 })
562
+ ], a.prototype, "allowEmpty", 2);
563
+ p([
564
+ d({ type: String, attribute: "placeholder", reflect: !0 })
565
+ ], a.prototype, "placeholder", 2);
566
+ p([
567
+ d({ type: Boolean, attribute: "disabled", reflect: !0 })
568
+ ], a.prototype, "disabled", 2);
569
+ p([
570
+ d({ type: String, attribute: "type", reflect: !0 })
571
+ ], a.prototype, "type", 2);
572
+ p([
573
+ d({ type: String, attribute: "subtype", reflect: !0 })
574
+ ], a.prototype, "subtype", 2);
575
+ p([
576
+ d({ type: Boolean, attribute: "invalid", reflect: !0 })
577
+ ], a.prototype, "invalid", 2);
578
+ p([
579
+ d({ type: Boolean, attribute: "is-formula", reflect: !0 })
580
+ ], a.prototype, "isFormula", 2);
581
+ p([
582
+ S()
583
+ ], a.prototype, "_richExpression", 2);
584
+ p([
585
+ S()
586
+ ], a.prototype, "_unit", 2);
587
+ a = p([
588
+ q()
589
+ ], a);
580
590
  customElements.get("luzmo-filter-expression-picker") || customElements.define(
581
591
  "luzmo-filter-expression-picker",
582
- i
592
+ a
583
593
  );
584
594
  export {
585
- i as L,
586
- m as g
595
+ a as L,
596
+ k as g
587
597
  };
@@ -0,0 +1,20 @@
1
+ /*! * A kit of modern Luzmo Web Components for analytics in your web application.
2
+ *
3
+ * Copyright © 2025 Luzmo
4
+ * All rights reserved.
5
+ * Luzmo web components (“Luzmo Web Components”)
6
+ * must be used according to the Luzmo Terms of Service.
7
+ * This license allows users with a current active Luzmo account
8
+ * to use the Luzmo Web Components. This license terminates
9
+ * automatically if a user no longer has an active Luzmo account.
10
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ * SOFTWARE.
19
+ * */
20
+ "use strict";var Fe=s=>{throw TypeError(s)};var qe=(s,e,t)=>e.has(s)||Fe("Cannot "+t);var i=(s,e,t)=>(qe(s,e,"read from private field"),t?t.call(s):e.get(s)),f=(s,e,t)=>e.has(s)?Fe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),h=(s,e,t,r)=>(qe(s,e,"write to private field"),r?r.call(s,t):e.set(s,t),t),q=(s,e,t)=>(qe(s,e,"access private method"),t);var me=(s,e,t,r)=>({set _(n){h(s,e,n,t)},get _(){return i(s,e,r)}});var be=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},we=typeof window>"u"||"Deno"in globalThis;function M(){}function ze(s,e){return typeof s=="function"?s(e):s}function Be(s){return typeof s=="number"&&s>=0&&s!==1/0}function We(s,e){return Math.max(s+(e||0)-Date.now(),0)}function Ae(s,e){return typeof s=="function"?s(e):s}function Xe(s,e){return typeof s=="function"?s(e):s}function De(s,e){const{type:t="all",exact:r,fetchStatus:n,predicate:u,queryKey:o,stale:a}=s;if(o){if(r){if(e.queryHash!==Se(o,e.options))return!1}else if(!ce(e.queryKey,o))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||n&&n!==e.state.fetchStatus||u&&!u(e))}function Qe(s,e){const{exact:t,status:r,predicate:n,mutationKey:u}=s;if(u){if(!e.options.mutationKey)return!1;if(t){if(he(e.options.mutationKey)!==he(u))return!1}else if(!ce(e.options.mutationKey,u))return!1}return!(r&&e.state.status!==r||n&&!n(e))}function Se(s,e){return((e==null?void 0:e.queryKeyHashFn)||he)(s)}function he(s){return JSON.stringify(s,(e,t)=>Oe(t)?Object.keys(t).sort().reduce((r,n)=>(r[n]=t[n],r),{}):t)}function ce(s,e){return s===e?!0:typeof s!=typeof e?!1:s&&e&&typeof s=="object"&&typeof e=="object"?Object.keys(e).every(t=>ce(s[t],e[t])):!1}function Ce(s,e){if(s===e)return s;const t=Ee(s)&&Ee(e);if(t||Oe(s)&&Oe(e)){const r=t?s:Object.keys(s),n=r.length,u=t?e:Object.keys(e),o=u.length,a=t?[]:{};let l=0;for(let y=0;y<o;y++){const m=t?y:u[y];(!t&&r.includes(m)||t)&&s[m]===void 0&&e[m]===void 0?(a[m]=void 0,l++):(a[m]=Ce(s[m],e[m]),a[m]===s[m]&&s[m]!==void 0&&l++)}return n===o&&l===n?s:a}return e}function Ee(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function Oe(s){if(!Me(s))return!1;const e=s.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!Me(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(s)!==Object.prototype)}function Me(s){return Object.prototype.toString.call(s)==="[object Object]"}function Ye(s){return new Promise(e=>{setTimeout(e,s)})}function Ze(s,e,t){if(typeof t.structuralSharing=="function")return t.structuralSharing(s,e);if(t.structuralSharing!==!1){try{return Ce(s,e)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${t.queryHash}]: ${r}`),r}return Ce(s,e)}return e}function et(s,e,t=0){const r=[...s,e];return t&&r.length>t?r.slice(1):r}function tt(s,e,t=0){const r=[e,...s];return t&&r.length>t?r.slice(0,-1):r}var ve=Symbol();function Ge(s,e){return s.queryFn===ve&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${s.queryHash}'`),!s.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!s.queryFn||s.queryFn===ve?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}var z,G,Z,ke,st=(ke=class extends be{constructor(){super();f(this,z);f(this,G);f(this,Z);h(this,Z,e=>{if(!we&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){i(this,G)||this.setEventListener(i(this,Z))}onUnsubscribe(){var e;this.hasListeners()||((e=i(this,G))==null||e.call(this),h(this,G,void 0))}setEventListener(e){var t;h(this,Z,e),(t=i(this,G))==null||t.call(this),h(this,G,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){i(this,z)!==e&&(h(this,z,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof i(this,z)=="boolean"?i(this,z):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},z=new WeakMap,G=new WeakMap,Z=new WeakMap,ke),Ne=new st,ee,N,te,Ke,rt=(Ke=class extends be{constructor(){super();f(this,ee,!0);f(this,N);f(this,te);h(this,te,e=>{if(!we&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}onSubscribe(){i(this,N)||this.setEventListener(i(this,te))}onUnsubscribe(){var e;this.hasListeners()||((e=i(this,N))==null||e.call(this),h(this,N,void 0))}setEventListener(e){var t;h(this,te,e),(t=i(this,N))==null||t.call(this),h(this,N,e(this.setOnline.bind(this)))}setOnline(e){i(this,ee)!==e&&(h(this,ee,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return i(this,ee)}},ee=new WeakMap,N=new WeakMap,te=new WeakMap,Ke),ge=new rt;function it(){let s,e;const t=new Promise((n,u)=>{s=n,e=u});t.status="pending",t.catch(()=>{});function r(n){Object.assign(t,n),delete t.resolve,delete t.reject}return t.resolve=n=>{r({status:"fulfilled",value:n}),s(n)},t.reject=n=>{r({status:"rejected",reason:n}),e(n)},t}function nt(s){return Math.min(1e3*2**s,3e4)}function $e(s){return(s??"online")==="online"?ge.isOnline():!0}var Ve=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function Pe(s){return s instanceof Ve}function _e(s){let e=!1,t=0,r=!1,n;const u=it(),o=d=>{var v;r||(p(new Ve(d)),(v=s.abort)==null||v.call(s))},a=()=>{e=!0},l=()=>{e=!1},y=()=>Ne.isFocused()&&(s.networkMode==="always"||ge.isOnline())&&s.canRun(),m=()=>$e(s.networkMode)&&s.canRun(),c=d=>{var v;r||(r=!0,(v=s.onSuccess)==null||v.call(s,d),n==null||n(),u.resolve(d))},p=d=>{var v;r||(r=!0,(v=s.onError)==null||v.call(s,d),n==null||n(),u.reject(d))},F=()=>new Promise(d=>{var v;n=A=>{(r||y())&&d(A)},(v=s.onPause)==null||v.call(s)}).then(()=>{var d;n=void 0,r||(d=s.onContinue)==null||d.call(s)}),C=()=>{if(r)return;let d;const v=t===0?s.initialPromise:void 0;try{d=v??s.fn()}catch(A){d=Promise.reject(A)}Promise.resolve(d).then(c).catch(A=>{var K;if(r)return;const E=s.retry??(we?0:3),b=s.retryDelay??nt,D=typeof b=="function"?b(t,A):b,k=E===!0||typeof E=="number"&&t<E||typeof E=="function"&&E(t,A);if(e||!k){p(A);return}t++,(K=s.onFail)==null||K.call(s,t,A),Ye(D).then(()=>y()?void 0:F()).then(()=>{e?p(A):C()})})};return{promise:u,cancel:o,continue:()=>(n==null||n(),u),cancelRetry:a,continueRetry:l,canStart:m,start:()=>(m()?C():F().then(C),u)}}var at=s=>setTimeout(s,0);function ut(){let s=[],e=0,t=a=>{a()},r=a=>{a()},n=at;const u=a=>{e?s.push(a):n(()=>{t(a)})},o=()=>{const a=s;s=[],a.length&&n(()=>{r(()=>{a.forEach(l=>{t(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{u(()=>{a(...l)})},schedule:u,setNotifyFunction:a=>{t=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{n=a}}}var S=ut(),B,je,Je=(je=class{constructor(){f(this,B)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Be(this.gcTime)&&h(this,B,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(we?1/0:5*60*1e3))}clearGcTimeout(){i(this,B)&&(clearTimeout(i(this,B)),h(this,B,void 0))}},B=new WeakMap,je),se,re,Q,W,P,le,X,T,L,Ue,ot=(Ue=class extends Je{constructor(e){super();f(this,T);f(this,se);f(this,re);f(this,Q);f(this,W);f(this,P);f(this,le);f(this,X);h(this,X,!1),h(this,le,e.defaultOptions),this.setOptions(e.options),this.observers=[],h(this,W,e.client),h(this,Q,i(this,W).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,h(this,se,ct(this.options)),this.state=e.state??i(this,se),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=i(this,P))==null?void 0:e.promise}setOptions(e){this.options={...i(this,le),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&i(this,Q).remove(this)}setData(e,t){const r=Ze(this.state.data,e,this.options);return q(this,T,L).call(this,{data:r,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),r}setState(e,t){q(this,T,L).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var r,n;const t=(r=i(this,P))==null?void 0:r.promise;return(n=i(this,P))==null||n.cancel(e),t?t.then(M).catch(M):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(i(this,se))}isActive(){return this.observers.some(e=>Xe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ve||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!We(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=i(this,P))==null||t.continue()}onOnline(){var t;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=i(this,P))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),i(this,Q).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(i(this,P)&&(i(this,X)?i(this,P).cancel({revert:!0}):i(this,P).cancelRetry()),this.scheduleGc()),i(this,Q).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||q(this,T,L).call(this,{type:"invalidate"})}fetch(e,t){var l,y,m;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(i(this,P))return i(this,P).continueRetry(),i(this,P).promise}if(e&&this.setOptions(e),!this.options.queryFn){const c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.options)}Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");const r=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(h(this,X,!0),r.signal)})},u=()=>{const c=Ge(this.options,t),p={client:i(this,W),queryKey:this.queryKey,meta:this.meta};return n(p),h(this,X,!1),this.options.persister?this.options.persister(c,p,this):c(p)},o={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:i(this,W),state:this.state,fetchFn:u};n(o),(l=this.options.behavior)==null||l.onFetch(o,this),h(this,re,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=o.fetchOptions)==null?void 0:y.meta))&&q(this,T,L).call(this,{type:"fetch",meta:(m=o.fetchOptions)==null?void 0:m.meta});const a=c=>{var p,F,C,d;Pe(c)&&c.silent||q(this,T,L).call(this,{type:"error",error:c}),Pe(c)||((F=(p=i(this,Q).config).onError)==null||F.call(p,c,this),(d=(C=i(this,Q).config).onSettled)==null||d.call(C,this.state.data,c,this)),this.scheduleGc()};return h(this,P,_e({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:c=>{var p,F,C,d;if(c===void 0){console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(v){a(v);return}(F=(p=i(this,Q).config).onSuccess)==null||F.call(p,c,this),(d=(C=i(this,Q).config).onSettled)==null||d.call(C,c,this.state.error,this),this.scheduleGc()},onError:a,onFail:(c,p)=>{q(this,T,L).call(this,{type:"failed",failureCount:c,error:p})},onPause:()=>{q(this,T,L).call(this,{type:"pause"})},onContinue:()=>{q(this,T,L).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),i(this,P).start()}},se=new WeakMap,re=new WeakMap,Q=new WeakMap,W=new WeakMap,P=new WeakMap,le=new WeakMap,X=new WeakMap,T=new WeakSet,L=function(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ht(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return Pe(n)&&n.revert&&i(this,re)?{...i(this,re),fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),S.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),i(this,Q).notify({query:this,type:"updated",action:e})})},Ue);function ht(s,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$e(e.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function ct(s){const e=typeof s.initialData=="function"?s.initialData():s.initialData,t=e!==void 0,r=t?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var j,Ie,lt=(Ie=class extends be{constructor(e={}){super();f(this,j);this.config=e,h(this,j,new Map)}build(e,t,r){const n=t.queryKey,u=t.queryHash??Se(n,t);let o=this.get(u);return o||(o=new ot({client:e,queryKey:n,queryHash:u,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){i(this,j).has(e.queryHash)||(i(this,j).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=i(this,j).get(e.queryHash);t&&(e.destroy(),t===e&&i(this,j).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){S.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return i(this,j).get(e)}getAll(){return[...i(this,j).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>De(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>De(e,r)):t}notify(e){S.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){S.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){S.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},j=new WeakMap,Ie),U,O,Y,I,x,Le,dt=(Le=class extends Je{constructor(e){super();f(this,I);f(this,U);f(this,O);f(this,Y);this.mutationId=e.mutationId,h(this,O,e.mutationCache),h(this,U,[]),this.state=e.state||ft(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){i(this,U).includes(e)||(i(this,U).push(e),this.clearGcTimeout(),i(this,O).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){h(this,U,i(this,U).filter(t=>t!==e)),this.scheduleGc(),i(this,O).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){i(this,U).length||(this.state.status==="pending"?this.scheduleGc():i(this,O).remove(this))}continue(){var e;return((e=i(this,Y))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var u,o,a,l,y,m,c,p,F,C,d,v,A,E,b,D,k,K,fe,oe;const t=()=>{q(this,I,x).call(this,{type:"continue"})};h(this,Y,_e({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(w,ye)=>{q(this,I,x).call(this,{type:"failed",failureCount:w,error:ye})},onPause:()=>{q(this,I,x).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>i(this,O).canRun(this)}));const r=this.state.status==="pending",n=!i(this,Y).canStart();try{if(r)t();else{q(this,I,x).call(this,{type:"pending",variables:e,isPaused:n}),await((o=(u=i(this,O).config).onMutate)==null?void 0:o.call(u,e,this));const ye=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,e));ye!==this.state.context&&q(this,I,x).call(this,{type:"pending",context:ye,variables:e,isPaused:n})}const w=await i(this,Y).start();return await((m=(y=i(this,O).config).onSuccess)==null?void 0:m.call(y,w,e,this.state.context,this)),await((p=(c=this.options).onSuccess)==null?void 0:p.call(c,w,e,this.state.context)),await((C=(F=i(this,O).config).onSettled)==null?void 0:C.call(F,w,null,this.state.variables,this.state.context,this)),await((v=(d=this.options).onSettled)==null?void 0:v.call(d,w,null,e,this.state.context)),q(this,I,x).call(this,{type:"success",data:w}),w}catch(w){try{throw await((E=(A=i(this,O).config).onError)==null?void 0:E.call(A,w,e,this.state.context,this)),await((D=(b=this.options).onError)==null?void 0:D.call(b,w,e,this.state.context)),await((K=(k=i(this,O).config).onSettled)==null?void 0:K.call(k,void 0,w,this.state.variables,this.state.context,this)),await((oe=(fe=this.options).onSettled)==null?void 0:oe.call(fe,void 0,w,e,this.state.context)),w}finally{q(this,I,x).call(this,{type:"error",error:w})}}finally{i(this,O).runNext(this)}}},U=new WeakMap,O=new WeakMap,Y=new WeakMap,I=new WeakSet,x=function(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),S.batch(()=>{i(this,U).forEach(r=>{r.onMutationUpdate(e)}),i(this,O).notify({mutation:this,type:"updated",action:e})})},Le);function ft(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var H,R,de,He,yt=(He=class extends be{constructor(e={}){super();f(this,H);f(this,R);f(this,de);this.config=e,h(this,H,new Set),h(this,R,new Map),h(this,de,0)}build(e,t,r){const n=new dt({mutationCache:this,mutationId:++me(this,de)._,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){i(this,H).add(e);const t=pe(e);if(typeof t=="string"){const r=i(this,R).get(t);r?r.push(e):i(this,R).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(i(this,H).delete(e)){const t=pe(e);if(typeof t=="string"){const r=i(this,R).get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&i(this,R).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=pe(e);if(typeof t=="string"){const r=i(this,R).get(t),n=r==null?void 0:r.find(u=>u.state.status==="pending");return!n||n===e}else return!0}runNext(e){var r;const t=pe(e);if(typeof t=="string"){const n=(r=i(this,R).get(t))==null?void 0:r.find(u=>u!==e&&u.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){S.batch(()=>{i(this,H).forEach(e=>{this.notify({type:"removed",mutation:e})}),i(this,H).clear(),i(this,R).clear()})}getAll(){return Array.from(i(this,H))}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Qe(t,r))}findAll(e={}){return this.getAll().filter(t=>Qe(e,t))}notify(e){S.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return S.batch(()=>Promise.all(e.map(t=>t.continue().catch(M))))}},H=new WeakMap,R=new WeakMap,de=new WeakMap,He);function pe(s){var e;return(e=s.options.scope)==null?void 0:e.id}function Te(s){return{onFetch:(e,t)=>{var m,c,p,F,C;const r=e.options,n=(p=(c=(m=e.fetchOptions)==null?void 0:m.meta)==null?void 0:c.fetchMore)==null?void 0:p.direction,u=((F=e.state.data)==null?void 0:F.pages)||[],o=((C=e.state.data)==null?void 0:C.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const y=async()=>{let d=!1;const v=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?d=!0:e.signal.addEventListener("abort",()=>{d=!0}),e.signal)})},A=Ge(e.options,e.fetchOptions),E=async(b,D,k)=>{if(d)return Promise.reject();if(D==null&&b.pages.length)return Promise.resolve(b);const K={client:e.client,queryKey:e.queryKey,pageParam:D,direction:k?"backward":"forward",meta:e.options.meta};v(K);const fe=await A(K),{maxPages:oe}=e.options,w=k?tt:et;return{pages:w(b.pages,fe,oe),pageParams:w(b.pageParams,D,oe)}};if(n&&u.length){const b=n==="backward",D=b?mt:Re,k={pages:u,pageParams:o},K=D(r,k);a=await E(k,K,b)}else{const b=s??u.length;do{const D=l===0?o[0]??r.initialPageParam:Re(r,a);if(l>0&&D==null)break;a=await E(a,D),l++}while(l<b)}return a};e.options.persister?e.fetchFn=()=>{var d,v;return(v=(d=e.options).persister)==null?void 0:v.call(d,y,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=y}}}function Re(s,{pages:e,pageParams:t}){const r=e.length-1;return e.length>0?s.getNextPageParam(e[r],e,t[r],t):void 0}function mt(s,{pages:e,pageParams:t}){var r;return e.length>0?(r=s.getPreviousPageParam)==null?void 0:r.call(s,e[0],e,t[0],t):void 0}var g,$,V,ie,ne,_,ae,ue,xe,pt=(xe=class{constructor(s={}){f(this,g);f(this,$);f(this,V);f(this,ie);f(this,ne);f(this,_);f(this,ae);f(this,ue);h(this,g,s.queryCache||new lt),h(this,$,s.mutationCache||new yt),h(this,V,s.defaultOptions||{}),h(this,ie,new Map),h(this,ne,new Map),h(this,_,0)}mount(){me(this,_)._++,i(this,_)===1&&(h(this,ae,Ne.subscribe(async s=>{s&&(await this.resumePausedMutations(),i(this,g).onFocus())})),h(this,ue,ge.subscribe(async s=>{s&&(await this.resumePausedMutations(),i(this,g).onOnline())})))}unmount(){var s,e;me(this,_)._--,i(this,_)===0&&((s=i(this,ae))==null||s.call(this),h(this,ae,void 0),(e=i(this,ue))==null||e.call(this),h(this,ue,void 0))}isFetching(s){return i(this,g).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return i(this,$).findAll({...s,status:"pending"}).length}getQueryData(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=i(this,g).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(s){const e=this.defaultQueryOptions(s),t=i(this,g).build(this,e),r=t.state.data;return r===void 0?this.fetchQuery(s):(s.revalidateIfStale&&t.isStaleByTime(Ae(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(s){return i(this,g).findAll(s).map(({queryKey:e,state:t})=>{const r=t.data;return[e,r]})}setQueryData(s,e,t){const r=this.defaultQueryOptions({queryKey:s}),n=i(this,g).get(r.queryHash),u=n==null?void 0:n.state.data,o=ze(e,u);if(o!==void 0)return i(this,g).build(this,r).setData(o,{...t,manual:!0})}setQueriesData(s,e,t){return S.batch(()=>i(this,g).findAll(s).map(({queryKey:r})=>[r,this.setQueryData(r,e,t)]))}getQueryState(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=i(this,g).get(e.queryHash))==null?void 0:t.state}removeQueries(s){const e=i(this,g);S.batch(()=>{e.findAll(s).forEach(t=>{e.remove(t)})})}resetQueries(s,e){const t=i(this,g);return S.batch(()=>(t.findAll(s).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...s},e)))}cancelQueries(s,e={}){const t={revert:!0,...e},r=S.batch(()=>i(this,g).findAll(s).map(n=>n.cancel(t)));return Promise.all(r).then(M).catch(M)}invalidateQueries(s,e={}){return S.batch(()=>(i(this,g).findAll(s).forEach(t=>{t.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},e)))}refetchQueries(s,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},r=S.batch(()=>i(this,g).findAll(s).filter(n=>!n.isDisabled()).map(n=>{let u=n.fetch(void 0,t);return t.throwOnError||(u=u.catch(M)),n.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(r).then(M)}fetchQuery(s){const e=this.defaultQueryOptions(s);e.retry===void 0&&(e.retry=!1);const t=i(this,g).build(this,e);return t.isStaleByTime(Ae(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(M).catch(M)}fetchInfiniteQuery(s){return s.behavior=Te(s.pages),this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(M).catch(M)}ensureInfiniteQueryData(s){return s.behavior=Te(s.pages),this.ensureQueryData(s)}resumePausedMutations(){return ge.isOnline()?i(this,$).resumePausedMutations():Promise.resolve()}getQueryCache(){return i(this,g)}getMutationCache(){return i(this,$)}getDefaultOptions(){return i(this,V)}setDefaultOptions(s){h(this,V,s)}setQueryDefaults(s,e){i(this,ie).set(he(s),{queryKey:s,defaultOptions:e})}getQueryDefaults(s){const e=[...i(this,ie).values()],t={};return e.forEach(r=>{ce(s,r.queryKey)&&Object.assign(t,r.defaultOptions)}),t}setMutationDefaults(s,e){i(this,ne).set(he(s),{mutationKey:s,defaultOptions:e})}getMutationDefaults(s){const e=[...i(this,ne).values()],t={};return e.forEach(r=>{ce(s,r.mutationKey)&&Object.assign(t,r.defaultOptions)}),t}defaultQueryOptions(s){if(s._defaulted)return s;const e={...i(this,V).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return e.queryHash||(e.queryHash=Se(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===ve&&(e.enabled=!1),e}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...i(this,V).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){i(this,g).clear(),i(this,$).clear()}},g=new WeakMap,$=new WeakMap,V=new WeakMap,ie=new WeakMap,ne=new WeakMap,_=new WeakMap,ae=new WeakMap,ue=new WeakMap,xe);class J{constructor(e={}){this.availableDatasets=[],this.apiUrl=e.apiUrl||"https://api.luzmo.com",this.apiVersion=e.apiVersion||"0.1.0",this.authKey=e.authKey||"",this.authToken=e.authToken||"",this.queryClient=new pt({defaultOptions:{queries:{staleTime:e.staleTime||5*60*1e3,gcTime:e.gcTime||10*60*1e3,retry:e.retry||3,retryDelay:e.retryDelay||(t=>Math.min(1e3*2**t,3e4))}}}),this.initNetworkListeners()}configure(e={}){if(e.apiVersion&&(this.apiVersion=e.apiVersion),e.apiUrl&&(this.apiUrl=e.apiUrl),e.authKey&&(this.authKey=e.authKey),e.authToken&&(this.authToken=e.authToken),e.staleTime||e.gcTime||e.retry){const t={};e.staleTime&&(t.staleTime=e.staleTime),e.gcTime&&(t.gcTime=e.gcTime),e.retry&&(t.retry=e.retry),this.queryClient.setDefaultOptions({queries:{...this.queryClient.getDefaultOptions().queries,...t}})}}initNetworkListeners(){typeof window<"u"&&window.addEventListener("online",()=>{console.warn("Network connection restored, refreshing data..."),this.refreshAll()})}getHeaders(e={}){return{"Content-Type":"application/json",...e}}async fetchApi(e,t,r={}){const n=`${this.apiUrl}/${this.apiVersion}${e}`,o={method:r.method||"POST",headers:this.getHeaders(r.headers),mode:"cors",...r};t!==void 0&&(t.key=this.authKey,t.token=this.authToken,o.body=JSON.stringify(t));try{const a=await fetch(n,o);if(!a.ok){const l=await a.json().catch(()=>null);throw a.status===401||a.status===403?new Error("Authentication failed. Please check your API token."):a.status===404?new Error(`Resource not found: ${e}`):a.status===429?new Error("Rate limit exceeded. Please try again later."):new Error((l==null?void 0:l.message)||`API request failed with status ${a.status}`)}return await a.json()}catch(a){throw console.error(`API request to ${e} failed:`,a),a instanceof Error&&(a.endpoint=e,a.timestamp=new Date().toISOString()),a}}async fetchAllDatasets(e={}){const t=e.offset||0,r=e.limit||50,n=["datasets",t,r];return await this.queryClient.fetchQuery({queryKey:n,queryFn:async()=>{const u={action:"get",version:this.apiVersion,find:{where:{type:"dataset"},limit:r,offset:t}},o=await this.fetchApi("/securable",u);return{data:(o==null?void 0:o.rows)??[],pagination:{offset:t,limit:r,total:(o==null?void 0:o.count)??0,pages:Math.ceil(((o==null?void 0:o.count)??0)/r)}}}})}async searchDatasets(e,t){if(!e)return{data:[]};const r=["datasets","search",e,t];return await this.queryClient.fetchQuery({queryKey:r,queryFn:async()=>{const n={action:"get",version:this.apiVersion,find:{where:{type:"dataset"}}};(e==null?void 0:e.length)>0&&(n.find.search={match_types:["name"],keyphrase:e}),t!=null&&t.offset&&(n.find.offset=t==null?void 0:t.offset),t!=null&&t.limit&&(n.find.limit=t==null?void 0:t.limit);const u=await this.fetchApi("/securable",n),o={data:(u==null?void 0:u.rows)??[]};return t!=null&&t.limit&&(o.pagination={offset:(t==null?void 0:t.offset)??0,limit:t==null?void 0:t.limit,total:(u==null?void 0:u.count)??0,pages:Math.ceil(((u==null?void 0:u.count)??0)/(t==null?void 0:t.limit))}),o}})}async fetchDatasetsWithColumnsAndFormulas(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const t=["datasets",e,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:t,queryFn:async()=>{const r={action:"get",version:this.apiVersion,find:{where:{type:"dataset",id:{in:e}},attributes:["name","id","description"],include:[{model:"Column",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],separate:!0,order:[["order","asc"]],include:[{model:"Column",attributes:["id","securable_id","hierarchy_enabled","currency_id"],as:"Joins"},{model:"HierarchyLevel",attributes:["id","level","name"],as:"HierarchyLevels"},{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]},{model:"Formula",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],include:[{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]}]}},n=await this.fetchApi("/securable",r);return(n==null?void 0:n.rows)??[]}})}async fetchData(e){if(!e)throw new Error("Query is required");const t=["data",e];return await this.queryClient.fetchQuery({queryKey:t,queryFn:async()=>{const r={action:"get",version:this.apiVersion,find:{queries:[e]}},n=await this.fetchApi("/data",r);return{data:(n==null?void 0:n.data)||[],performance:(n==null?void 0:n.performance)||{}}}})}refreshAll(){this.queryClient.refetchQueries()}invalidateDatasetData(e){e?(this.queryClient.invalidateQueries({queryKey:["dataset",e]}),this.queryClient.invalidateQueries({queryKey:["columns",e]})):this.queryClient.invalidateQueries({queryKey:["datasets"]})}invalidateAll(){this.queryClient.clear()}static getInstance(e={}){return J.instance?Object.keys(e).length>0&&J.instance.configure(e):J.instance=new J(e),J.instance}async fetchDatasetsRecursive(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const t=[...new Set(e)],r=new Set,n=new Map,u=o=>{o&&!r.has(o)&&!t.includes(o)&&t.push(o)};for(;t.length>0;){const o=[];for(;t.length>0&&o.length<50;){const a=t.shift();r.has(a)||o.push(a)}if(o.length!==0)try{(await this.fetchDatasetsWithColumnsAndFormulas(o)).forEach(l=>{const y=this.postProcessDatasetMetadata(l);r.add(y.id),this.queryClient.setQueryData(["dataset",y.id],y),(y.outgoingJoins??[]).map(c=>c.securable_id).filter(c=>!!c&&c!==y.id).forEach(c=>{u(c)}),n.set(y.id,y),this.availableDatasets.some(c=>c.id===y.id)||this.availableDatasets.push({id:y.id,name:y.name,columns:y.columns})})}catch(a){console.error("Error fetching datasets recursively:",a)}}return[...n.values()]}postProcessDatasetMetadata(e){const t=[],r=(e.columns??[]).map(n=>{const u=n.joins??(Array.isArray(n.joins)?n.joins:[]);Array.isArray(u)&&u.length>0&&t.push(...u);const{joins:o,...a}=n;return{...a,joins:u}});return{...e,columns:r,formulas:e.formulas??[],outgoingJoins:t,dateLoaded:new Date}}getAvailableDatasets(){return this.availableDatasets}getLinkedDatasetsIds(e){const t=this.queryClient.getQueryData(["dataset",e]);return t?(t.outgoingJoins??[]).map(r=>r.securable_id).filter(r=>!!r&&r!==e):[]}}const vt=J.getInstance();exports.dataBroker=vt;