@luzmo/analytics-components-kit 1.0.1-alpha.90 → 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.
- package/README.md +195 -0
- package/angular/README.md +1 -0
- package/angular/components/widget-menu.component.ts +25 -0
- package/angular/esm/components/widget-menu.component.d.ts +13 -0
- package/angular/esm/components/widget-menu.component.js +49 -0
- package/angular/esm/index.d.ts +3 -1
- package/angular/esm/index.js +4 -1
- package/angular/esm/types.d.ts +4 -0
- package/angular/index.ts +4 -1
- package/angular/types.ts +6 -0
- package/components/ai-chat-message-assistant/index.cjs +1 -1
- package/components/ai-chat-message-assistant/index.js +1 -0
- 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 +2 -1
- package/components/area-chart-options.config-C7sMAHco.cjs +20 -0
- package/components/{area-chart-options.config-u8itidsi.js → area-chart-options.config-_J0sG4NF.js} +26 -14
- package/components/{bar-chart-options.config-DIirbAJ0.js → bar-chart-options.config-D1mb5TDl.js} +35 -21
- package/components/bar-chart-options.config-DcxEkOT5.cjs +20 -0
- package/components/box-plot-options.config-SrrbDEYW.cjs +20 -0
- package/components/{box-plot-options.config-BWROiguA.js → box-plot-options.config-xu_i6ms7.js} +88 -52
- package/components/{bubble-chart-options.config-4QD8VPhU.js → bubble-chart-options.config-BacgXkJ_.js} +18 -9
- package/components/bubble-chart-options.config-Ihn6eVQI.cjs +20 -0
- package/components/{bullet-chart-options.config-3bH7uekx.js → bullet-chart-options.config-CDPpX1yc.js} +1 -1
- package/components/{bullet-chart-options.config-tWb6Fio-.cjs → bullet-chart-options.config-DfS4Bwds.cjs} +1 -1
- package/components/calculate-data-item-icon-CEa82-5u.cjs +20 -0
- package/components/calculate-data-item-icon-DjlZwMdO.js +147 -0
- package/components/{choropleth-map-options.config-CMxx3ORp.js → choropleth-map-options.config-B_W9-rhe.js} +84 -63
- package/components/choropleth-map-options.config-ZW8yoZH2.cjs +20 -0
- package/components/{circular-gauge-options.config-DhIKn44k.js → circular-gauge-options.config-DAIjz4Rl.js} +36 -23
- package/components/circular-gauge-options.config-msZ4mfpN.cjs +20 -0
- package/components/color-B6LaL8qz.cjs +20 -0
- package/components/{color-B7m0j8lX.js → color-DuJ4-73S.js} +950 -941
- package/components/{color-range-utils-BSfqtB3A.js → color-range-utils-Bvo9sm5A.js} +32 -31
- package/components/color-range-utils-C5yXW7ZC.cjs +20 -0
- package/components/{column-chart-options.config-D5-yR7iq.js → column-chart-options.config-B5SjBVdy.js} +37 -27
- package/components/column-chart-options.config-BjDvA7i9.cjs +20 -0
- package/components/{conditional-number-options.config-DPYsdML5.js → conditional-number-options.config-BCEpSK9J.js} +40 -24
- package/components/conditional-number-options.config-DgzUo0xi.cjs +20 -0
- package/components/dataset-icon/index.cjs +1 -1
- package/components/dataset-icon/index.js +2 -1
- package/components/dataset-selector-list/index.cjs +1 -1
- package/components/dataset-selector-list/index.js +35 -32
- package/components/dataset-selector-row/index.cjs +9 -9
- package/components/dataset-selector-row/index.js +53 -51
- package/components/{date-comparison-filter-options.config-QaoWaFUn.cjs → date-comparison-filter-options.config-DAVncmi0.cjs} +1 -1
- package/components/{date-comparison-filter-options.config-CSwGyuBg.js → date-comparison-filter-options.config-JA_yYpJa.js} +6 -3
- package/components/{date-filter-options.config-n-zhWaYa.cjs → date-filter-options.config-CWPMtA18.cjs} +1 -1
- package/components/{date-filter-options.config-BTVyHRkp.js → date-filter-options.config-DBRxlTWy.js} +6 -3
- 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 +30 -29
- package/components/display-settings-datetime/index.cjs +29 -29
- package/components/display-settings-datetime/index.js +120 -112
- package/components/display-settings-grand-totals/index.cjs +4 -4
- package/components/display-settings-grand-totals/index.js +24 -23
- package/components/display-settings-numeric/index.cjs +48 -48
- package/components/display-settings-numeric/index.js +211 -194
- package/components/display-settings-period-over-period/index.cjs +16 -16
- package/components/display-settings-period-over-period/index.js +97 -91
- package/components/{donut-chart-options.config-3ZqX8Cbb.js → donut-chart-options.config-BulUEiaH.js} +37 -21
- package/components/donut-chart-options.config-tNpqBZfR.cjs +20 -0
- package/components/draggable-data-item/index.cjs +5 -5
- package/components/draggable-data-item/index.js +46 -45
- package/components/draggable-data-item-level/index.cjs +11 -11
- package/components/draggable-data-item-level/index.js +73 -70
- package/components/{dropdown-filter-options.config-CGJTtgAX.js → dropdown-filter-options.config-D9dvPypF.js} +10 -7
- package/components/{dropdown-filter-options.config-DJvfCTk7.cjs → dropdown-filter-options.config-DS-MORmq.cjs} +1 -1
- package/components/droppable-slot/index.cjs +16 -16
- package/components/droppable-slot/index.js +223 -208
- package/components/edit-item/index.cjs +9 -9
- package/components/edit-item/index.js +119 -116
- 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 +53 -52
- package/components/{edit-option-base-Bh29-Cak.js → edit-option-base-DIc7iC-b.js} +1 -1
- package/components/{edit-option-base-tFr8Qg2B.cjs → edit-option-base-VhTih9T1.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 +117 -106
- package/components/edit-option-multi-language-field/index.cjs +3 -3
- package/components/edit-option-multi-language-field/index.js +27 -26
- 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 +25 -21
- package/components/edit-option-positions-number-field/index.cjs +9 -9
- package/components/edit-option-positions-number-field/index.js +81 -76
- package/components/edit-option-radio-button-group/index.cjs +6 -6
- package/components/edit-option-radio-button-group/index.js +22 -21
- 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 +23 -22
- package/components/en-BKBhKBXY.cjs +20 -0
- package/components/en-BOTjhwEc.js +1488 -0
- package/components/{en-GB-ialeqj_z.js → en-GB-CEHEs8F2.js} +1 -1
- package/components/{en-GB-TqvgIw9B.cjs → en-GB-DG6uS3sM.cjs} +1 -1
- package/components/{evolution-number-options.config-Bc9eKYnn.cjs → evolution-number-options.config-BgIZY4gQ.cjs} +1 -1
- package/components/{evolution-number-options.config-BIPO_4n3.js → evolution-number-options.config-DzkfeoIN.js} +14 -11
- package/components/{extrapolate-color-C0n1UDs-.cjs → extrapolate-color-0j_AeYkz.cjs} +1 -1
- package/components/{extrapolate-color-v1PimdQr.js → extrapolate-color-CC9CURf6.js} +1 -1
- package/components/filter-data-item-picker/index.cjs +7 -7
- package/components/filter-data-item-picker/index.js +86 -85
- 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 +119 -109
- package/components/filter-value-picker/index.cjs +2 -2
- package/components/filter-value-picker/index.js +36 -34
- package/components/filter-value-picker-datetime/index.cjs +8 -8
- package/components/filter-value-picker-datetime/index.js +71 -56
- package/components/filter-value-picker-hierarchy/index.cjs +12 -12
- package/components/filter-value-picker-hierarchy/index.js +124 -113
- package/components/filter-value-picker-numeric/index.cjs +8 -8
- package/components/filter-value-picker-numeric/index.js +110 -101
- package/components/focusable-B3E_hQmm.cjs +20 -0
- package/components/{focusable-BS2pbY7w.js → focusable-DCIFkpiW.js} +26 -24
- package/components/{funnel-chart-options.config-CrJy2U7_.js → funnel-chart-options.config-C_VjTOvD.js} +20 -5
- package/components/funnel-chart-options.config-D7H7gFcx.cjs +20 -0
- package/components/get-css-variable-BEYG097C.js +1446 -0
- package/components/get-css-variable-BZxY4IOa.cjs +35 -0
- package/components/get-css-variable-DLiZYZEi.cjs +24 -0
- package/components/{get-css-variable-CdwF98oh.js → get-css-variable-YlLiVgo8.js} +35 -35
- package/components/grid/index.cjs +49 -43
- package/components/grid/index.js +1878 -2610
- package/components/{heat-map-options.config-CmL87j1j.js → heat-map-options.config-BnLWe8jS.js} +41 -35
- package/components/heat-map-options.config-DVH-Bb5-.cjs +20 -0
- package/components/heat-table-options.config-B12JEYnp.cjs +20 -0
- package/components/{heat-table-options.config-BrCYAgYD.js → heat-table-options.config-CUsDdgUr.js} +88 -60
- package/components/helpers-DXQwEH1P.cjs +20 -0
- package/components/helpers-v1bPALRP.js +91 -0
- package/components/hexbin-map-options.config-DZERRhM8.cjs +20 -0
- package/components/{hexbin-map-options.config-BguV1w8q.js → hexbin-map-options.config-F-7uCqxb.js} +38 -20
- package/components/{index-BNAmjOkm.cjs → index-BPNsFiyq.cjs} +4 -4
- package/components/index-CDi4fe3N.js +1716 -0
- package/components/index-CQ9ck-BO.cjs +249 -0
- package/components/index-CXn67vdn.cjs +121 -0
- package/components/{index-haa7WNrl.js → index-CdIUfo-L.js} +481 -453
- package/components/index-Cz9vSXy6.cjs +20 -0
- package/components/{index-DdyZ2g5L.js → index-D0GBF6tg.js} +104 -94
- package/components/index-Dn0j_pcR.cjs +20 -0
- package/components/{index-CqKpf0B8.js → index-Do7O9azB.js} +123 -112
- package/components/index-E239Dotg.js +1735 -0
- package/components/index.cjs +1 -1
- package/components/index.js +20 -18
- package/components/item-options-configs.cjs +1 -1
- package/components/item-options-configs.js +37 -37
- package/components/{line-chart-options.config-BhirTGqD.js → line-chart-options.config-DB3IsXXr.js} +28 -13
- package/components/line-chart-options.config-DSugoe0t.cjs +20 -0
- package/components/{localize-CcDpq940.js → localize-BX7q0S0M.js} +10 -10
- package/components/{localize-C4zNlrwK.cjs → localize-r7ALOUy_.cjs} +1 -1
- package/components/{marker-map-options.config-Bx17jmiq.js → marker-map-options.config-DPJ955tt.js} +1 -1
- package/components/{marker-map-options.config-CvhCylSC.cjs → marker-map-options.config-_FYZzRwA.cjs} +1 -1
- package/components/pivot-table-options.config-BiJXKSFR.cjs +20 -0
- package/components/{pivot-table-options.config-CFc7y0IT.js → pivot-table-options.config-DNK_AIG7.js} +24 -15
- package/components/pyramid-chart-options.config-C4zbFS26.cjs +20 -0
- package/components/{pyramid-chart-options.config-2Waxb11l.js → pyramid-chart-options.config-CcVMatYx.js} +43 -29
- package/components/{radar-chart-options.config-CPN5fOl8.js → radar-chart-options.config-CUZn_3Fd.js} +23 -11
- package/components/radar-chart-options.config-EqQu6PTh.cjs +20 -0
- package/components/{regular-table-options.config-CFKCJQK1.js → regular-table-options.config-BoLZsBry.js} +23 -17
- package/components/{regular-table-options.config-YRuoijIk.cjs → regular-table-options.config-DTx3RTnS.cjs} +1 -1
- package/components/{route-map-options.config-CyolTJfK.js → route-map-options.config-CN86T7c0.js} +109 -87
- package/components/route-map-options.config-D7NJePTu.cjs +20 -0
- package/components/{sankey-diagram-options.config-D7OSvSqm.cjs → sankey-diagram-options.config-RFB83YLZ.cjs} +1 -1
- package/components/{sankey-diagram-options.config-Ldjk84ro.js → sankey-diagram-options.config-tVLKy_Zn.js} +10 -7
- package/components/scatter-plot-options.config-CFfGJXsV.cjs +20 -0
- package/components/{scatter-plot-options.config-CfxEfkQ1.js → scatter-plot-options.config-Corlzno1.js} +86 -56
- package/components/{search-filter-options.config-Oqco9BKj.cjs → search-filter-options.config-BCaDlYqZ.cjs} +1 -1
- package/components/{search-filter-options.config-C0syQmP4.js → search-filter-options.config-BE3JhR-F.js} +6 -3
- package/components/{set-locale-hKTMz37h.js → set-locale-Dp3N_gXN.js} +8 -1
- package/components/{slicer-filter-options.config-DmOe3440.js → slicer-filter-options.config-3JZZcw5C.js} +18 -9
- package/components/slicer-filter-options.config-DNI-XevE.cjs +20 -0
- package/components/{slider-filter-options.config-B1M8RcDs.js → slider-filter-options.config-DH4SS8wH.js} +1 -1
- package/components/{slider-filter-options.config-k45I-t6G.cjs → slider-filter-options.config-_8Z2zKmU.cjs} +1 -1
- package/components/slot-contents-picker/index.cjs +33 -33
- package/components/slot-contents-picker/index.js +205 -194
- package/components/slot-menu/index.cjs +12 -12
- package/components/slot-menu/index.js +184 -171
- package/components/slot-menu-list/index.cjs +3 -3
- package/components/slot-menu-list/index.js +103 -97
- package/components/speedometer-chart-options.config-BX9LTQBH.cjs +20 -0
- package/components/{speedometer-chart-options.config-CzOmuEF8.js → speedometer-chart-options.config-SL581yOa.js} +53 -31
- package/components/{spike-map-options.config-Cbt1YUw6.js → spike-map-options.config-C5KewecZ.js} +122 -91
- package/components/spike-map-options.config-DoBFXPmN.cjs +20 -0
- package/components/{sunburst-chart-options.config-Yrxc2i57.cjs → sunburst-chart-options.config-AbNjWS6t.cjs} +1 -1
- package/components/{sunburst-chart-options.config-_dyLQxPJ.js → sunburst-chart-options.config-CNauGQJv.js} +20 -9
- package/components/{symbol-map-options.config-BORL1NSU.js → symbol-map-options.config-DdDA4aa7.js} +20 -11
- package/components/symbol-map-options.config-m-lwLTtu.cjs +20 -0
- package/components/treemap-chart-options.config-C0Q9aQ1Z.cjs +20 -0
- package/components/{treemap-chart-options.config-B9i9qIm_.js → treemap-chart-options.config-D5AJaF_u.js} +37 -20
- package/components/utils.cjs +1 -1
- package/components/utils.js +97 -94
- package/components/{video-options.config-B0asgYt8.cjs → video-options.config-CGsDTwHc.cjs} +1 -1
- package/components/{video-options.config-UX-9MDfS.js → video-options.config-Dk36zJ1B.js} +10 -7
- package/components/widget-menu/index.cjs +51 -0
- package/components/widget-menu/index.d.ts +8 -0
- package/components/widget-menu/index.js +211 -0
- package/components/widget-menu/widget-menu.d.ts +77 -0
- package/components/{wordcloud-chart-options.config-BKtJT8Va.cjs → wordcloud-chart-options.config-vGfCW8kE.cjs} +1 -1
- package/components/{wordcloud-chart-options.config-BoB_KuhA.js → wordcloud-chart-options.config-w2NUIWVA.js} +7 -4
- package/custom-elements.json +133 -20
- package/index.d.ts +1 -0
- package/package.json +6 -1
- package/types.d.ts +4 -0
- package/components/area-chart-options.config-Bl8bhhOo.cjs +0 -20
- package/components/bar-chart-options.config-CePAqM83.cjs +0 -20
- package/components/box-plot-options.config-BVNrV2eD.cjs +0 -20
- package/components/bubble-chart-options.config-BDgOe3GQ.cjs +0 -20
- package/components/calculate-data-item-icon-DMDhKq_m.js +0 -147
- package/components/calculate-data-item-icon-DtVGbet3.cjs +0 -20
- package/components/choropleth-map-options.config-CWJACFd0.cjs +0 -20
- package/components/circular-gauge-options.config-BMxgq3zH.cjs +0 -20
- package/components/color-Czp4Im5q.cjs +0 -20
- package/components/color-range-utils-DYYR-iwx.cjs +0 -20
- package/components/column-chart-options.config-BV9R3ssH.cjs +0 -20
- package/components/conditional-number-options.config-Co099Qfm.cjs +0 -20
- package/components/donut-chart-options.config-BQyPgnC9.cjs +0 -20
- package/components/en-D3ihEGXg.js +0 -1483
- package/components/en-DZcn_iz_.cjs +0 -20
- package/components/focusable-QLh-LlNt.cjs +0 -20
- package/components/funnel-chart-options.config-DrP4AFgk.cjs +0 -20
- package/components/get-css-variable-COd1d84B.cjs +0 -24
- package/components/heat-map-options.config-CIHnPdYE.cjs +0 -20
- package/components/heat-table-options.config-DTlZRc_i.cjs +0 -20
- package/components/helpers-9I0oLoUB.cjs +0 -20
- package/components/helpers-bR8Ibjqh.js +0 -79
- package/components/hexbin-map-options.config-CKnn3VAB.cjs +0 -20
- package/components/index-BekTY3Em.cjs +0 -121
- package/components/index-CFL6gmIu.cjs +0 -20
- package/components/index-DNPULp4A.js +0 -1755
- package/components/index-DvkzMbLt.cjs +0 -249
- package/components/line-chart-options.config-Cqwou5u6.cjs +0 -20
- package/components/pivot-table-options.config-uZDAertf.cjs +0 -20
- package/components/pyramid-chart-options.config-DoGfEvzU.cjs +0 -20
- package/components/radar-chart-options.config-CtNUMN1l.cjs +0 -20
- package/components/route-map-options.config-CVTk5RVL.cjs +0 -20
- package/components/scatter-plot-options.config-5gN7pMTm.cjs +0 -20
- package/components/slicer-filter-options.config-CrusP6a0.cjs +0 -20
- package/components/speedometer-chart-options.config-B4ceg_qI.cjs +0 -20
- package/components/spike-map-options.config-BkkDqb4g.cjs +0 -20
- package/components/symbol-map-options.config-NpBKm64d.cjs +0 -20
- package/components/treemap-chart-options.config-x4J54WSw.cjs +0 -20
|
@@ -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 T=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},X={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Y=class{#t=X;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},Q=new Y;function tt(t){setTimeout(t,0)}var M=typeof window>"u"||"Deno"in globalThis;function v(){}function et(t,e){return typeof t=="function"?t(e):t}function st(t){return typeof t=="number"&&t>=0&&t!==1/0}function it(t,e){return Math.max(t+(e||0)-Date.now(),0)}function E(t,e){return typeof t=="function"?t(e):t}function rt(t,e){return typeof t=="function"?t(e):t}function U(t,e){const{type:s="all",exact:i,fetchStatus:n,predicate:a,queryKey:o,stale:r}=t;if(o){if(i){if(e.queryHash!==j(o,e.options))return!1}else if(!F(e.queryKey,o))return!1}if(s!=="all"){const u=e.isActive();if(s==="active"&&!u||s==="inactive"&&u)return!1}return!(typeof r=="boolean"&&e.isStale()!==r||n&&n!==e.state.fetchStatus||a&&!a(e))}function x(t,e){const{exact:s,status:i,predicate:n,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(P(e.options.mutationKey)!==P(a))return!1}else if(!F(e.options.mutationKey,a))return!1}return!(i&&e.state.status!==i||n&&!n(e))}function j(t,e){return(e?.queryKeyHashFn||P)(t)}function P(t){return JSON.stringify(t,(e,s)=>R(s)?Object.keys(s).sort().reduce((i,n)=>(i[n]=s[n],i),{}):s)}function F(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>F(t[s],e[s])):!1}var nt=Object.prototype.hasOwnProperty;function $(t,e){if(t===e)return t;const s=L(t)&&L(e);if(!s&&!(R(t)&&R(e)))return e;const n=(s?t:Object.keys(t)).length,a=s?e:Object.keys(e),o=a.length,r=s?new Array(o):{};let u=0;for(let h=0;h<o;h++){const d=s?h:a[h],l=t[d],m=e[d];if(l===m){r[d]=l,(s?h<n:nt.call(t,d))&&u++;continue}if(l===null||m===null||typeof l!="object"||typeof m!="object"){r[d]=m;continue}const b=$(l,m);r[d]=b,b===l&&u++}return n===o&&u===n?t:r}function L(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function R(t){if(!H(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!H(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function H(t){return Object.prototype.toString.call(t)==="[object Object]"}function at(t){return new Promise(e=>{Q.setTimeout(e,t)})}function ot(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?$(t,e):e}function ut(t,e,s=0){const i=[...t,e];return s&&i.length>s?i.slice(1):i}function ht(t,e,s=0){const i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var I=Symbol();function B(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===I?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var ct=class extends T{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},J=new ct;function lt(){let t,e;const s=new Promise((n,a)=>{t=n,e=a});s.status="pending",s.catch(()=>{});function i(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{i({status:"fulfilled",value:n}),t(n)},s.reject=n=>{i({status:"rejected",reason:n}),e(n)},s}var dt=tt;function ft(){let t=[],e=0,s=r=>{r()},i=r=>{r()},n=dt;const a=r=>{e?t.push(r):n(()=>{s(r)})},o=()=>{const r=t;t=[],r.length&&n(()=>{i(()=>{r.forEach(u=>{s(u)})})})};return{batch:r=>{let u;e++;try{u=r()}finally{e--,e||o()}return u},batchCalls:r=>(...u)=>{a(()=>{r(...u)})},schedule:a,setNotifyFunction:r=>{s=r},setBatchNotifyFunction:r=>{i=r},setScheduler:r=>{n=r}}}var y=ft(),yt=class extends T{#t=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#t}},D=new yt;function pt(t){return Math.min(1e3*2**t,3e4)}function z(t){return(t??"online")==="online"?D.isOnline():!0}var K=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function W(t){let e=!1,s=0,i;const n=lt(),a=()=>n.status!=="pending",o=c=>{if(!a()){const p=new K(c);m(p),t.onCancel?.(p)}},r=()=>{e=!0},u=()=>{e=!1},h=()=>J.isFocused()&&(t.networkMode==="always"||D.isOnline())&&t.canRun(),d=()=>z(t.networkMode)&&t.canRun(),l=c=>{a()||(i?.(),n.resolve(c))},m=c=>{a()||(i?.(),n.reject(c))},b=()=>new Promise(c=>{i=p=>{(a()||h())&&c(p)},t.onPause?.()}).then(()=>{i=void 0,a()||t.onContinue?.()}),f=()=>{if(a())return;let c;const p=s===0?t.initialPromise:void 0;try{c=p??t.fn()}catch(g){c=Promise.reject(g)}Promise.resolve(c).then(l).catch(g=>{if(a())return;const w=t.retry??(M?0:3),O=t.retryDelay??pt,q=typeof O=="function"?O(s,g):O,S=w===!0||typeof w=="number"&&s<w||typeof w=="function"&&w(s,g);if(e||!S){m(g);return}s++,t.onFail?.(s,g),at(q).then(()=>h()?void 0:b()).then(()=>{e?m(g):f()})})};return{promise:n,status:()=>n.status,cancel:o,continue:()=>(i?.(),n),cancelRetry:r,continueRetry:u,canStart:d,start:()=>(d()?f():b().then(f),n)}}var Z=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),st(this.gcTime)&&(this.#t=Q.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(M?1/0:300*1e3))}clearGcTimeout(){this.#t&&(Q.clearTimeout(this.#t),this.#t=void 0)}},mt=class extends Z{#t;#e;#s;#r;#i;#a;#o;constructor(t){super(),this.#o=!1,this.#a=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#s=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=N(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#a,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=N(this.options);e.data!==void 0&&(this.setState(G(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(t,e){const s=ot(this.state.data,t,this.options);return this.#n({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#n({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(v).catch(v):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>rt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===I||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>E(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!it(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#n({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){const r=this.observers.find(u=>u.options.queryFn);r&&this.setOptions(r.options)}const s=new AbortController,i=r=>{Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(this.#o=!0,s.signal)})},n=()=>{const r=B(this.options,e),h=(()=>{const d={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(d),d})();return this.#o=!1,this.options.persister?this.options.persister(r,h,this):r(h)},o=(()=>{const r={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:n};return i(r),r})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#n({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=W({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:r=>{r instanceof K&&r.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(r,u)=>{this.#n({type:"failed",failureCount:r,error:u})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const r=await this.#i.start();if(r===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(r),this.#s.config.onSuccess?.(r,this),this.#s.config.onSettled?.(r,this.state.error,this),r}catch(r){if(r instanceof K){if(r.silent)return this.#i.promise;if(r.revert){if(this.state.data===void 0)throw r;return this.state.data}}throw this.#n({type:"error",error:r}),this.#s.config.onError?.(r,this),this.#s.config.onSettled?.(this.state.data,r,this),r}finally{this.scheduleGc()}}#n(t){const e=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...vt(s.data,this.options),fetchMeta:t.meta??null};case"success":const i={...s,...G(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?i:void 0,i;case"error":const n=t.error;return{...s,error:n,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=e(this.state),y.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:t})})}};function vt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:z(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function G(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function N(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,i=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}function V(t){return{onFetch:(e,s)=>{const i=e.options,n=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let r={pages:[],pageParams:[]},u=0;const h=async()=>{let d=!1;const l=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(e.signal.aborted?d=!0:e.signal.addEventListener("abort",()=>{d=!0}),e.signal)})},m=B(e.options,e.fetchOptions),b=async(f,c,p)=>{if(d)return Promise.reject();if(c==null&&f.pages.length)return Promise.resolve(f);const w=(()=>{const k={client:e.client,queryKey:e.queryKey,pageParam:c,direction:p?"backward":"forward",meta:e.options.meta};return l(k),k})(),O=await m(w),{maxPages:q}=e.options,S=p?ht:ut;return{pages:S(f.pages,O,q),pageParams:S(f.pageParams,c,q)}};if(n&&a.length){const f=n==="backward",c=f?gt:_,p={pages:a,pageParams:o},g=c(i,p);r=await b(p,g,f)}else{const f=t??a.length;do{const c=u===0?o[0]??i.initialPageParam:_(i,r);if(u>0&&c==null)break;r=await b(r,c),u++}while(u<f)}return r};e.options.persister?e.fetchFn=()=>e.options.persister?.(h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=h}}}function _(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function gt(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var bt=class extends Z{#t;#e;#s;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||wt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=W({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#i({type:"failed",failureCount:a,error:o})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const i=this.state.status==="pending",n=!this.#r.canStart();try{if(i)e();else{this.#i({type:"pending",variables:t,isPaused:n}),await this.#s.config.onMutate?.(t,this,s);const o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#i({type:"pending",context:o,variables:t,isPaused:n})}const a=await this.#r.start();return await this.#s.config.onSuccess?.(a,t,this.state.context,this,s),await this.options.onSuccess?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,t,this.state.context,s),this.#i({type:"success",data:a}),a}catch(a){try{throw await this.#s.config.onError?.(a,t,this.state.context,this,s),await this.options.onError?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(void 0,a,t,this.state.context,s),a}finally{this.#i({type:"error",error:a})}}finally{this.#s.runNext(this)}}#i(t){const e=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),y.batch(()=>{this.#e.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function wt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ct=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#s=0}#t;#e;#s;build(t,e,s){const i=new bt({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#t.add(t);const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);s?s.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);if(s)if(s.length>1){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}else s[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=A(t);if(typeof e=="string"){const i=this.#e.get(e)?.find(n=>n.state.status==="pending");return!i||i===t}else return!0}runNext(t){const e=A(t);return typeof e=="string"?this.#e.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){y.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(s=>x(e,s))}findAll(t={}){return this.getAll().filter(e=>x(t,e))}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return y.batch(()=>Promise.all(t.map(e=>e.continue().catch(v))))}};function A(t){return t.options.scope?.id}var Ot=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,s){const i=e.queryKey,n=e.queryHash??j(i,e);let a=this.get(n);return a||(a=new mt({client:t,queryKey:i,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){y.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(s=>U(e,s))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(s=>U(t,s)):e}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){y.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){y.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=class{#t;#e;#s;#r;#i;#a;#o;#n;constructor(t={}){this.#t=t.queryCache||new Ot,this.#e=t.mutationCache||new Ct,this.#s=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#n=D.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#n?.(),this.#n=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#t.build(this,e),i=s.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(E(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:s})=>{const i=s.data;return[e,i]})}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#t.get(i.queryHash)?.state.data,o=et(e,a);if(o!==void 0)return this.#t.build(this,i).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return y.batch(()=>this.#t.findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;y.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=this.#t;return y.batch(()=>(s.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=y.batch(()=>this.#t.findAll(t).map(n=>n.cancel(s)));return Promise.all(i).then(v).catch(v)}invalidateQueries(t,e={}){return y.batch(()=>(this.#t.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=y.batch(()=>this.#t.findAll(t).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(v)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(v)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=this.#t.build(this,e);return s.isStaleByTime(E(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(v).catch(v)}fetchInfiniteQuery(t){return t.behavior=V(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(v).catch(v)}ensureInfiniteQueryData(t){return t.behavior=V(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return D.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(P(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],s={};return e.forEach(i=>{F(t,i.queryKey)&&Object.assign(s,i.defaultOptions)}),s}setMutationDefaults(t,e){this.#i.set(P(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],s={};return e.forEach(i=>{F(t,i.mutationKey)&&Object.assign(s,i.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=j(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===I&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};class C{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||300*1e3,gcTime:e.gcTime||600*1e3,retry:e.retry||3,retryDelay:e.retryDelay||(s=>Math.min(1e3*2**s,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 s={};e.staleTime&&(s.staleTime=e.staleTime),e.gcTime&&(s.gcTime=e.gcTime),e.retry&&(s.retry=e.retry),this.queryClient.setDefaultOptions({queries:{...this.queryClient.getDefaultOptions().queries,...s}})}}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,s,i={}){const n=`${this.apiUrl}/${this.apiVersion}${e}`,o={method:i.method||"POST",headers:this.getHeaders(i.headers),mode:"cors",...i};s!==void 0&&(s.key=this.authKey,s.token=this.authToken,o.body=JSON.stringify(s));try{const r=await fetch(n,o);if(!r.ok){const u=await r.json().catch(()=>null);throw r.status===401||r.status===403?new Error("Authentication failed. Please check your API token."):r.status===404?new Error(`Resource not found: ${e}`):r.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(u?.message||`API request failed with status ${r.status}`)}return await r.json()}catch(r){throw console.error(`API request to ${e} failed:`,r),r instanceof Error&&(r.endpoint=e,r.timestamp=new Date().toISOString()),r}}async fetchAllDatasets(e={}){const s=e.offset||0,i=e.limit||50,n=["datasets",s,i];return await this.queryClient.fetchQuery({queryKey:n,queryFn:async()=>{const a={action:"get",version:this.apiVersion,find:{where:{type:"dataset"},limit:i,offset:s}},o=await this.fetchApi("/securable",a);return{data:o?.rows??[],pagination:{offset:s,limit:i,total:o?.count??0,pages:Math.ceil((o?.count??0)/i)}}}})}async searchDatasets(e,s){if(!e)return{data:[]};const i=["datasets","search",e,s];return await this.queryClient.fetchQuery({queryKey:i,queryFn:async()=>{const n={action:"get",version:this.apiVersion,find:{where:{type:"dataset"}}};e?.length>0&&(n.find.search={match_types:["name"],keyphrase:e}),s?.offset&&(n.find.offset=s?.offset),s?.limit&&(n.find.limit=s?.limit);const a=await this.fetchApi("/securable",n),o={data:a?.rows??[]};return s?.limit&&(o.pagination={offset:s?.offset??0,limit:s?.limit,total:a?.count??0,pages:Math.ceil((a?.count??0)/s?.limit)}),o}})}async fetchDatasetsWithColumnsAndFormulas(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=["datasets",e,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:s,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"}]}]}};return(await this.fetchApi("/securable",i))?.rows??[]}})}async fetchData(e){if(!e)throw new Error("Query is required");const s=["data",e];return await this.queryClient.fetchQuery({queryKey:s,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{queries:[e]}},n=await this.fetchApi("/data",i);return{data:n?.data||[],performance: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 C.instance?Object.keys(e).length>0&&C.instance.configure(e):C.instance=new C(e),C.instance}async fetchDatasetsRecursive(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=[...new Set(e)],i=new Set,n=new Map,a=o=>{o&&!i.has(o)&&!s.includes(o)&&s.push(o)};for(;s.length>0;){const o=[];for(;s.length>0&&o.length<50;){const r=s.shift();i.has(r)||o.push(r)}if(o.length!==0)try{(await this.fetchDatasetsWithColumnsAndFormulas(o)).forEach(u=>{const h=this.postProcessDatasetMetadata(u);i.add(h.id),this.queryClient.setQueryData(["dataset",h.id],h),(h.outgoingJoins??[]).map(l=>l.securable_id).filter(l=>!!l&&l!==h.id).forEach(l=>{a(l)}),n.set(h.id,h),this.availableDatasets.some(l=>l.id===h.id)||this.availableDatasets.push({id:h.id,name:h.name,columns:h.columns})})}catch(r){console.error("Error fetching datasets recursively:",r)}}return[...n.values()]}postProcessDatasetMetadata(e){const s=[],i=(e.columns??[]).map(n=>{const a=n.joins??(Array.isArray(n.joins)?n.joins:[]);Array.isArray(a)&&a.length>0&&s.push(...a);const{joins:o,...r}=n;return{...r,joins:a}});return{...e,columns:i,formulas:e.formulas??[],outgoingJoins:s,dateLoaded:new Date}}getAvailableDatasets(){return this.availableDatasets}getLinkedDatasetsIds(e){const s=this.queryClient.getQueryData(["dataset",e]);return s?(s.outgoingJoins??[]).map(i=>i.securable_id).filter(i=>!!i&&i!==e):[]}}const Ft=C.getInstance();exports.dataBroker=Ft;
|