@luzmo/analytics-components-kit 1.0.1-alpha.94 → 1.0.1-alpha.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular/README.md +1 -1
- package/angular/components/viz-item-menu.component.ts +25 -0
- package/angular/esm/components/viz-item-menu.component.d.ts +13 -0
- package/angular/esm/components/viz-item-menu.component.js +49 -0
- package/angular/esm/index.d.ts +3 -3
- package/angular/esm/index.js +3 -3
- package/angular/esm/types.d.ts +2 -2
- package/angular/index.ts +3 -3
- package/angular/types.ts +2 -2
- package/components/ai-chat-message-assistant/index.cjs +1 -1
- package/components/ai-chat-message-assistant/index.js +0 -1
- package/components/ai-chat-messages-container/index.cjs +1 -1
- package/components/ai-chat-messages-container/index.js +2 -2
- package/components/ai-interaction-textarea/index.cjs +1 -1
- package/components/ai-interaction-textarea/index.js +1 -2
- package/components/area-chart-options.config-Bl8bhhOo.cjs +20 -0
- package/components/{area-chart-options.config-_J0sG4NF.js → area-chart-options.config-u8itidsi.js} +14 -26
- package/components/bar-chart-options.config-CePAqM83.cjs +20 -0
- package/components/{bar-chart-options.config-D1mb5TDl.js → bar-chart-options.config-DIirbAJ0.js} +21 -35
- package/components/box-plot-options.config-BVNrV2eD.cjs +20 -0
- package/components/{box-plot-options.config-xu_i6ms7.js → box-plot-options.config-BWROiguA.js} +52 -88
- package/components/{bubble-chart-options.config-BacgXkJ_.js → bubble-chart-options.config-4QD8VPhU.js} +9 -18
- package/components/bubble-chart-options.config-BDgOe3GQ.cjs +20 -0
- package/components/{bullet-chart-options.config-CDPpX1yc.js → bullet-chart-options.config-3bH7uekx.js} +1 -1
- package/components/{bullet-chart-options.config-DfS4Bwds.cjs → bullet-chart-options.config-tWb6Fio-.cjs} +1 -1
- package/components/calculate-data-item-icon-DMDhKq_m.js +147 -0
- package/components/calculate-data-item-icon-DtVGbet3.cjs +20 -0
- package/components/{choropleth-map-options.config-B_W9-rhe.js → choropleth-map-options.config-CMxx3ORp.js} +63 -84
- package/components/choropleth-map-options.config-CWJACFd0.cjs +20 -0
- package/components/circular-gauge-options.config-BMxgq3zH.cjs +20 -0
- package/components/{circular-gauge-options.config-DAIjz4Rl.js → circular-gauge-options.config-DhIKn44k.js} +23 -36
- package/components/{color-DuJ4-73S.js → color-B7m0j8lX.js} +941 -950
- package/components/color-Czp4Im5q.cjs +20 -0
- package/components/{color-range-utils-Bvo9sm5A.js → color-range-utils-BSfqtB3A.js} +31 -32
- package/components/color-range-utils-DYYR-iwx.cjs +20 -0
- package/components/column-chart-options.config-BV9R3ssH.cjs +20 -0
- package/components/{column-chart-options.config-B5SjBVdy.js → column-chart-options.config-D5-yR7iq.js} +27 -37
- package/components/conditional-number-options.config-Co099Qfm.cjs +20 -0
- package/components/{conditional-number-options.config-BCEpSK9J.js → conditional-number-options.config-DPYsdML5.js} +24 -40
- package/components/dataset-icon/index.cjs +1 -1
- package/components/dataset-icon/index.js +1 -2
- package/components/dataset-selector-list/index.cjs +1 -1
- package/components/dataset-selector-list/index.js +32 -35
- package/components/dataset-selector-row/index.cjs +9 -9
- package/components/dataset-selector-row/index.js +50 -52
- package/components/{date-comparison-filter-options.config-JA_yYpJa.js → date-comparison-filter-options.config-CSwGyuBg.js} +3 -6
- package/components/{date-comparison-filter-options.config-DAVncmi0.cjs → date-comparison-filter-options.config-QaoWaFUn.cjs} +1 -1
- package/components/{date-filter-options.config-DBRxlTWy.js → date-filter-options.config-BTVyHRkp.js} +3 -6
- package/components/{date-filter-options.config-CWPMtA18.cjs → date-filter-options.config-n-zhWaYa.cjs} +1 -1
- package/components/display-settings/index.cjs +1 -1
- package/components/display-settings/index.js +1 -1
- package/components/display-settings-binning/index.cjs +5 -5
- package/components/display-settings-binning/index.js +29 -30
- package/components/display-settings-datetime/index.cjs +29 -29
- package/components/display-settings-datetime/index.js +112 -120
- package/components/display-settings-grand-totals/index.cjs +4 -4
- package/components/display-settings-grand-totals/index.js +23 -24
- package/components/display-settings-numeric/display-settings-numeric.d.ts +1 -2
- package/components/display-settings-numeric/index.cjs +49 -48
- package/components/display-settings-numeric/index.js +193 -218
- package/components/display-settings-period-over-period/index.cjs +16 -16
- package/components/display-settings-period-over-period/index.js +91 -97
- package/components/{donut-chart-options.config-BulUEiaH.js → donut-chart-options.config-3ZqX8Cbb.js} +21 -37
- package/components/donut-chart-options.config-BQyPgnC9.cjs +20 -0
- package/components/draggable-data-item/index.cjs +5 -5
- package/components/draggable-data-item/index.js +45 -46
- package/components/draggable-data-item-level/index.cjs +11 -11
- package/components/draggable-data-item-level/index.js +70 -73
- package/components/{dropdown-filter-options.config-D9dvPypF.js → dropdown-filter-options.config-CGJTtgAX.js} +7 -10
- package/components/{dropdown-filter-options.config-DS-MORmq.cjs → dropdown-filter-options.config-DJvfCTk7.cjs} +1 -1
- package/components/droppable-slot/index.cjs +16 -16
- package/components/droppable-slot/index.js +208 -223
- package/components/edit-item/index.cjs +9 -9
- package/components/edit-item/index.js +116 -119
- package/components/edit-option/index.cjs +1 -1
- package/components/edit-option/index.js +1 -1
- package/components/edit-option-action-button-group/index.cjs +8 -8
- package/components/edit-option-action-button-group/index.js +52 -53
- package/components/{edit-option-base-DIc7iC-b.js → edit-option-base-Bh29-Cak.js} +1 -1
- package/components/{edit-option-base-VhTih9T1.cjs → edit-option-base-tFr8Qg2B.cjs} +1 -1
- package/components/edit-option-color-palette-picker/index.cjs +1 -1
- package/components/edit-option-color-palette-picker/index.js +1 -1
- package/components/edit-option-color-picker/index.cjs +1 -1
- package/components/edit-option-color-picker/index.js +1 -1
- package/components/edit-option-color-range/index.cjs +19 -19
- package/components/edit-option-color-range/index.js +106 -117
- package/components/edit-option-multi-language-field/index.cjs +3 -3
- package/components/edit-option-multi-language-field/index.js +26 -27
- package/components/edit-option-number-field/index.cjs +1 -1
- package/components/edit-option-number-field/index.js +1 -1
- package/components/edit-option-picker/index.cjs +5 -5
- package/components/edit-option-picker/index.js +7 -7
- package/components/edit-option-position-picker/index.cjs +4 -4
- package/components/edit-option-position-picker/index.js +21 -25
- package/components/edit-option-positions-number-field/index.cjs +9 -9
- package/components/edit-option-positions-number-field/index.js +76 -81
- package/components/edit-option-radio-button-group/index.cjs +6 -6
- package/components/edit-option-radio-button-group/index.js +21 -22
- package/components/edit-option-slider/index.cjs +1 -1
- package/components/edit-option-slider/index.js +1 -1
- package/components/edit-option-switch/index.cjs +1 -1
- package/components/edit-option-switch/index.js +1 -1
- package/components/edit-option-text-field/index.cjs +2 -2
- package/components/edit-option-text-field/index.js +22 -23
- package/components/en-D3ihEGXg.js +1483 -0
- package/components/en-DZcn_iz_.cjs +20 -0
- package/components/{en-GB-DG6uS3sM.cjs → en-GB-TqvgIw9B.cjs} +1 -1
- package/components/{en-GB-CEHEs8F2.js → en-GB-ialeqj_z.js} +1 -1
- package/components/{evolution-number-options.config-DzkfeoIN.js → evolution-number-options.config-BIPO_4n3.js} +11 -14
- package/components/{evolution-number-options.config-BgIZY4gQ.cjs → evolution-number-options.config-Bc9eKYnn.cjs} +1 -1
- package/components/{extrapolate-color-0j_AeYkz.cjs → extrapolate-color-C0n1UDs-.cjs} +1 -1
- package/components/{extrapolate-color-CC9CURf6.js → extrapolate-color-v1PimdQr.js} +1 -1
- package/components/filter-data-item-picker/index.cjs +7 -7
- package/components/filter-data-item-picker/index.js +85 -86
- package/components/filter-expression-picker/index.cjs +1 -1
- package/components/filter-expression-picker/index.js +1 -1
- package/components/filter-item/index.cjs +6 -6
- package/components/filter-item/index.js +109 -119
- package/components/filter-value-picker/index.cjs +2 -2
- package/components/filter-value-picker/index.js +34 -36
- package/components/filter-value-picker-datetime/index.cjs +8 -8
- package/components/filter-value-picker-datetime/index.js +56 -71
- package/components/filter-value-picker-hierarchy/index.cjs +12 -12
- package/components/filter-value-picker-hierarchy/index.js +113 -124
- package/components/filter-value-picker-numeric/index.cjs +8 -8
- package/components/filter-value-picker-numeric/index.js +101 -110
- package/components/{focusable-DCIFkpiW.js → focusable-BS2pbY7w.js} +24 -26
- package/components/focusable-QLh-LlNt.cjs +20 -0
- package/components/{funnel-chart-options.config-C_VjTOvD.js → funnel-chart-options.config-CrJy2U7_.js} +5 -20
- package/components/funnel-chart-options.config-DrP4AFgk.cjs +20 -0
- package/components/{get-css-variable-YlLiVgo8.js → get-css-variable-Bb7TxJdX.js} +37 -37
- package/components/get-css-variable-Pzks_rOx.cjs +24 -0
- package/components/grid/index.cjs +43 -49
- package/components/grid/index.js +2610 -1878
- package/components/heat-map-options.config-CIHnPdYE.cjs +20 -0
- package/components/{heat-map-options.config-BnLWe8jS.js → heat-map-options.config-CmL87j1j.js} +35 -41
- package/components/{heat-table-options.config-CUsDdgUr.js → heat-table-options.config-BrCYAgYD.js} +60 -88
- package/components/heat-table-options.config-DTlZRc_i.cjs +20 -0
- package/components/helpers-9I0oLoUB.cjs +20 -0
- package/components/helpers-bR8Ibjqh.js +79 -0
- package/components/{hexbin-map-options.config-F-7uCqxb.js → hexbin-map-options.config-BguV1w8q.js} +20 -38
- package/components/hexbin-map-options.config-CKnn3VAB.cjs +20 -0
- package/components/{index-BPNsFiyq.cjs → index-BNAmjOkm.cjs} +4 -4
- package/components/index-BekTY3Em.cjs +121 -0
- package/components/index-CFL6gmIu.cjs +20 -0
- package/components/{index-Do7O9azB.js → index-CqKpf0B8.js} +112 -123
- package/components/index-DNPULp4A.js +1755 -0
- package/components/{index-D0GBF6tg.js → index-DdyZ2g5L.js} +94 -104
- package/components/index-DvkzMbLt.cjs +249 -0
- package/components/{index-CdIUfo-L.js → index-haa7WNrl.js} +453 -481
- package/components/index.cjs +1 -1
- package/components/index.js +13 -13
- package/components/item-options-configs.cjs +1 -1
- package/components/item-options-configs.js +37 -37
- package/components/{line-chart-options.config-DB3IsXXr.js → line-chart-options.config-BhirTGqD.js} +13 -28
- package/components/line-chart-options.config-Cqwou5u6.cjs +20 -0
- package/components/{localize-r7ALOUy_.cjs → localize-C4zNlrwK.cjs} +1 -1
- package/components/{localize-BX7q0S0M.js → localize-CcDpq940.js} +10 -10
- package/components/{marker-map-options.config-DPJ955tt.js → marker-map-options.config-Bx17jmiq.js} +1 -1
- package/components/{marker-map-options.config-_FYZzRwA.cjs → marker-map-options.config-CvhCylSC.cjs} +1 -1
- package/components/{pivot-table-options.config-DNK_AIG7.js → pivot-table-options.config-CFc7y0IT.js} +15 -24
- package/components/pivot-table-options.config-uZDAertf.cjs +20 -0
- package/components/{pyramid-chart-options.config-CcVMatYx.js → pyramid-chart-options.config-2Waxb11l.js} +29 -43
- package/components/pyramid-chart-options.config-DoGfEvzU.cjs +20 -0
- package/components/{radar-chart-options.config-CUZn_3Fd.js → radar-chart-options.config-CPN5fOl8.js} +11 -23
- package/components/radar-chart-options.config-CtNUMN1l.cjs +20 -0
- package/components/{regular-table-options.config-BoLZsBry.js → regular-table-options.config-CFKCJQK1.js} +17 -23
- package/components/{regular-table-options.config-DTx3RTnS.cjs → regular-table-options.config-YRuoijIk.cjs} +1 -1
- package/components/route-map-options.config-CVTk5RVL.cjs +20 -0
- package/components/{route-map-options.config-CN86T7c0.js → route-map-options.config-CyolTJfK.js} +87 -109
- package/components/{sankey-diagram-options.config-RFB83YLZ.cjs → sankey-diagram-options.config-D7OSvSqm.cjs} +1 -1
- package/components/{sankey-diagram-options.config-tVLKy_Zn.js → sankey-diagram-options.config-Ldjk84ro.js} +7 -10
- package/components/scatter-plot-options.config-5gN7pMTm.cjs +20 -0
- package/components/{scatter-plot-options.config-Corlzno1.js → scatter-plot-options.config-CfxEfkQ1.js} +56 -86
- package/components/{search-filter-options.config-BE3JhR-F.js → search-filter-options.config-C0syQmP4.js} +3 -6
- package/components/{search-filter-options.config-BCaDlYqZ.cjs → search-filter-options.config-Oqco9BKj.cjs} +1 -1
- package/components/{set-locale-Dp3N_gXN.js → set-locale-hKTMz37h.js} +1 -8
- package/components/slicer-filter-options.config-CrusP6a0.cjs +20 -0
- package/components/{slicer-filter-options.config-3JZZcw5C.js → slicer-filter-options.config-DmOe3440.js} +9 -18
- package/components/{slider-filter-options.config-DH4SS8wH.js → slider-filter-options.config-B1M8RcDs.js} +1 -1
- package/components/{slider-filter-options.config-_8Z2zKmU.cjs → slider-filter-options.config-k45I-t6G.cjs} +1 -1
- package/components/slot-contents-picker/index.cjs +33 -33
- package/components/slot-contents-picker/index.js +194 -205
- package/components/slot-menu/index.cjs +12 -12
- package/components/slot-menu/index.js +171 -184
- package/components/slot-menu-list/index.cjs +3 -3
- package/components/slot-menu-list/index.js +97 -103
- package/components/speedometer-chart-options.config-B4ceg_qI.cjs +20 -0
- package/components/{speedometer-chart-options.config-SL581yOa.js → speedometer-chart-options.config-CzOmuEF8.js} +31 -53
- package/components/spike-map-options.config-BkkDqb4g.cjs +20 -0
- package/components/{spike-map-options.config-C5KewecZ.js → spike-map-options.config-Cbt1YUw6.js} +91 -122
- package/components/{sunburst-chart-options.config-AbNjWS6t.cjs → sunburst-chart-options.config-Yrxc2i57.cjs} +1 -1
- package/components/{sunburst-chart-options.config-CNauGQJv.js → sunburst-chart-options.config-_dyLQxPJ.js} +9 -20
- package/components/{symbol-map-options.config-DdDA4aa7.js → symbol-map-options.config-BORL1NSU.js} +11 -20
- package/components/symbol-map-options.config-NpBKm64d.cjs +20 -0
- package/components/{treemap-chart-options.config-D5AJaF_u.js → treemap-chart-options.config-B9i9qIm_.js} +20 -37
- package/components/treemap-chart-options.config-x4J54WSw.cjs +20 -0
- package/components/utils.cjs +1 -1
- package/components/utils.js +94 -97
- package/components/{video-options.config-CGsDTwHc.cjs → video-options.config-B0asgYt8.cjs} +1 -1
- package/components/{video-options.config-Dk36zJ1B.js → video-options.config-UX-9MDfS.js} +7 -10
- package/components/viz-item-menu/index.cjs +51 -0
- package/components/viz-item-menu/index.d.ts +8 -0
- package/components/viz-item-menu/index.js +209 -0
- package/components/viz-item-menu/viz-item-menu.d.ts +77 -0
- package/components/{wordcloud-chart-options.config-vGfCW8kE.cjs → wordcloud-chart-options.config-BKtJT8Va.cjs} +1 -1
- package/components/{wordcloud-chart-options.config-w2NUIWVA.js → wordcloud-chart-options.config-BoB_KuhA.js} +4 -7
- package/custom-elements.json +43 -23
- package/index.d.ts +1 -1
- package/package.json +7 -7
- package/types.d.ts +2 -2
- package/angular/components/widget-menu.component.ts +0 -25
- package/angular/esm/components/widget-menu.component.d.ts +0 -13
- package/angular/esm/components/widget-menu.component.js +0 -49
- package/components/area-chart-options.config-C7sMAHco.cjs +0 -20
- package/components/bar-chart-options.config-DcxEkOT5.cjs +0 -20
- package/components/box-plot-options.config-SrrbDEYW.cjs +0 -20
- package/components/bubble-chart-options.config-Ihn6eVQI.cjs +0 -20
- package/components/calculate-data-item-icon-CEa82-5u.cjs +0 -20
- package/components/calculate-data-item-icon-DjlZwMdO.js +0 -147
- package/components/choropleth-map-options.config-ZW8yoZH2.cjs +0 -20
- package/components/circular-gauge-options.config-msZ4mfpN.cjs +0 -20
- package/components/color-B6LaL8qz.cjs +0 -20
- package/components/color-range-utils-C5yXW7ZC.cjs +0 -20
- package/components/column-chart-options.config-BjDvA7i9.cjs +0 -20
- package/components/conditional-number-options.config-DgzUo0xi.cjs +0 -20
- package/components/donut-chart-options.config-tNpqBZfR.cjs +0 -20
- package/components/en-BKBhKBXY.cjs +0 -20
- package/components/en-BOTjhwEc.js +0 -1488
- package/components/focusable-B3E_hQmm.cjs +0 -20
- package/components/funnel-chart-options.config-D7H7gFcx.cjs +0 -20
- package/components/get-css-variable-BEYG097C.js +0 -1446
- package/components/get-css-variable-BZxY4IOa.cjs +0 -35
- package/components/get-css-variable-DLiZYZEi.cjs +0 -24
- package/components/heat-map-options.config-DVH-Bb5-.cjs +0 -20
- package/components/heat-table-options.config-B12JEYnp.cjs +0 -20
- package/components/helpers-DXQwEH1P.cjs +0 -20
- package/components/helpers-v1bPALRP.js +0 -91
- package/components/hexbin-map-options.config-DZERRhM8.cjs +0 -20
- package/components/index-CDi4fe3N.js +0 -1716
- package/components/index-CQ9ck-BO.cjs +0 -249
- package/components/index-CXn67vdn.cjs +0 -121
- package/components/index-Cz9vSXy6.cjs +0 -20
- package/components/index-Dn0j_pcR.cjs +0 -20
- package/components/index-E239Dotg.js +0 -1735
- package/components/line-chart-options.config-DSugoe0t.cjs +0 -20
- package/components/pivot-table-options.config-BiJXKSFR.cjs +0 -20
- package/components/pyramid-chart-options.config-C4zbFS26.cjs +0 -20
- package/components/radar-chart-options.config-EqQu6PTh.cjs +0 -20
- package/components/route-map-options.config-D7NJePTu.cjs +0 -20
- package/components/scatter-plot-options.config-CFfGJXsV.cjs +0 -20
- package/components/slicer-filter-options.config-DNI-XevE.cjs +0 -20
- package/components/speedometer-chart-options.config-BX9LTQBH.cjs +0 -20
- package/components/spike-map-options.config-DoBFXPmN.cjs +0 -20
- package/components/symbol-map-options.config-m-lwLTtu.cjs +0 -20
- package/components/treemap-chart-options.config-C0Q9aQ1Z.cjs +0 -20
- package/components/widget-menu/index.cjs +0 -51
- package/components/widget-menu/index.d.ts +0 -8
- package/components/widget-menu/index.js +0 -211
- package/components/widget-menu/widget-menu.d.ts +0 -77
|
@@ -1,20 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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;
|