react-semaphor 0.1.526 → 0.1.527

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/DATA_APP_SDK.md +5 -1
  2. package/dist/analytics-protocol/index.js +1179 -296
  3. package/dist/brand-studio/index.js +15 -15
  4. package/dist/briefings/index.js +50 -49
  5. package/dist/chunks/{calculated-field-identity-D1ofR4KJ.js → calculated-field-identity-DEhjPSr-.js} +66 -65
  6. package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BlIbwkuD.js} +68 -65
  7. package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
  8. package/dist/chunks/dashboard-JNHR0_cZ.js +14 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-D9pFByPh.js} +372 -359
  10. package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-CJI5ZWMq.js} +739 -686
  11. package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DLdrFry-.js} +10 -10
  12. package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-D5LjWle1.js} +6603 -6572
  13. package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-G91NQKxU.js} +266 -267
  14. package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-DeVQLIsP.js} +19 -19
  15. package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
  16. package/dist/chunks/{index-CbjuruKe.js → index-BvJOYbNv.js} +755 -745
  17. package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
  18. package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DY45yiUM.js} +7 -6
  19. package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BypfLZsK.js} +11 -11
  20. package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
  21. package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-BoKU3MzZ.js} +655 -511
  22. package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
  23. package/dist/chunks/matrix-operation-contract-BV02rLhu.js +809 -0
  24. package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
  25. package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
  26. package/dist/chunks/pivot-header-presentation-D5v8uyjj.js +618 -0
  27. package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
  28. package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-BWrPhlGT.js} +259 -204
  29. package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
  30. package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
  31. package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
  32. package/dist/chunks/{report-preferences-dialog-BcH-0lR-.js → report-preferences-dialog-D3hxu4sE.js} +131 -132
  33. package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
  34. package/dist/chunks/{selection-reducer-NF5C07yM.js → selection-reducer-C7Um5XN-.js} +47 -26
  35. package/dist/chunks/semantic-format-BjBMOSoo.js +192 -0
  36. package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-D46I_4g7.js} +49895 -46141
  37. package/dist/chunks/{slider-BYIH4icg.js → slider-B6LELqx6.js} +81 -82
  38. package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
  39. package/dist/chunks/switch-_7uBAbYx.js +24003 -0
  40. package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
  41. package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
  42. package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
  43. package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
  44. package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
  45. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  46. package/dist/dashboard/index.js +1 -1
  47. package/dist/dashboard-authoring/index.js +138 -137
  48. package/dist/data-app-sdk/index.js +12 -12
  49. package/dist/data-app-sdk-adapters/index.js +23 -22
  50. package/dist/data-app-sdk-validation/index.js +27 -26
  51. package/dist/format-utils/index.js +247 -329
  52. package/dist/index.js +165 -168
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +1 -1
  56. package/dist/types/briefings/index.d.ts +3 -0
  57. package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
  58. package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
  59. package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
  60. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
  61. package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
  62. package/dist/types/components/surfboard/filter/types.d.ts +8 -29
  63. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
  64. package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
  65. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
  66. package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
  67. package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
  68. package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
  69. package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
  70. package/dist/types/index.js +5 -5
  71. package/dist/types/lib/api/exports-api.d.ts +3 -0
  72. package/dist/types/lib/csv-download.d.ts +9 -0
  73. package/dist/types/lib/csv-encoding-options.d.ts +6 -0
  74. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
  75. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
  76. package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
  77. package/dist/types/lib/export-utils.d.ts +17 -15
  78. package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
  79. package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
  80. package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
  81. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  82. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
  83. package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
  84. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
  85. package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
  86. package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
  87. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
  88. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
  89. package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
  90. package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
  91. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
  92. package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
  93. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
  94. package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
  95. package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
  96. package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
  97. package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
  98. package/dist/types/lib/types/common-types.d.ts +5 -0
  99. package/dist/types/lib/types/explorer-types.d.ts +14 -0
  100. package/dist/types/lib/types/token-types.d.ts +0 -1
  101. package/dist/types/lib/utils/card-definition.d.ts +1 -1
  102. package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
  103. package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
  104. package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
  105. package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
  106. package/dist/types/shared/analytics-protocol/contracts.d.ts +10 -7
  107. package/dist/types/shared/analytics-protocol/index.d.ts +12 -1
  108. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
  109. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
  110. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
  111. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +51 -5
  112. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
  113. package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
  114. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
  115. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
  116. package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
  117. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
  118. package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
  119. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
  120. package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
  121. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
  122. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
  123. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
  124. package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
  125. package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
  126. package/dist/types/shared/temporal/index.d.ts +5 -0
  127. package/dist/types/shared/temporal/relative-date.d.ts +21 -0
  128. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
  129. package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
  130. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
  131. package/package.json +1 -17
  132. package/src/data-app-sdk/README.md +6 -3
  133. package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
  134. package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
  135. package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
  136. package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
  137. package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
  138. package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
  139. package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
  140. package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
  141. package/dist/chunks/search-CJz-QQ0Q.js +0 -24
  142. package/dist/chunks/switch-XaAACBrJ.js +0 -2234
  143. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
  144. package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
  145. package/dist/data-app-builder/index.js +0 -3666
  146. package/dist/data-app-builder-browser-runtime/index.js +0 -8
  147. package/dist/data-app-codegen/index.js +0 -22
  148. package/dist/data-app-codegen-node/index.js +0 -1807
  149. package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
  150. package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
  151. package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
  152. package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
  153. package/dist/types/data-app-builder/constants.d.ts +0 -14
  154. package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
  155. package/dist/types/data-app-builder/index.d.ts +0 -1
  156. package/dist/types/data-app-builder/lib/api.d.ts +0 -36
  157. package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
  158. package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
  159. package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
  160. package/dist/types/data-app-builder/types.d.ts +0 -558
  161. package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
  162. package/dist/types/data-app-builder.d.ts +0 -2
  163. package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
  164. package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
  165. package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
  166. package/dist/types/data-app-codegen/index.d.ts +0 -6
  167. package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
  168. package/dist/types/data-app-codegen/node.d.ts +0 -2
  169. package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
  170. package/dist/types/data-app-codegen/validation.d.ts +0 -8
  171. package/dist/types/data-app-codegen-node.d.ts +0 -2
  172. package/dist/types/data-app-codegen.d.ts +0 -2
  173. package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
  174. package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
  175. package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
@@ -1,3987 +0,0 @@
1
- var ms = Object.defineProperty;
2
- var Sn = (t) => {
3
- throw TypeError(t);
4
- };
5
- var vs = (t, e, n) => e in t ? ms(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var At = (t, e, n) => vs(t, typeof e != "symbol" ? e + "" : e, n), Bt = (t, e, n) => e.has(t) || Sn("Cannot " + n);
7
- var c = (t, e, n) => (Bt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), k = (t, e, n) => e.has(t) ? Sn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), P = (t, e, n, r) => (Bt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), V = (t, e, n) => (Bt(t, e, "access private method"), n);
8
- var Et = (t, e, n, r) => ({
9
- set _(s) {
10
- P(t, e, s, n);
11
- },
12
- get _() {
13
- return c(t, e, r);
14
- }
15
- });
16
- import { jsx as p, Fragment as It, jsxs as qe } from "react/jsx-runtime";
17
- import * as w from "react";
18
- import bs, { useId as xs, useState as ve, useContext as ln, createContext as cn, useMemo as St, forwardRef as Zn, createElement as at, useRef as te, useLayoutEffect as ws, useImperativeHandle as er, useEffect as He, useCallback as ee } from "react";
19
- import { E as Ss, aT as Cs, Q as tr, aC as un, aD as Ps, J as Ct, K as We, aU as Ds, U as Pt, aV as As, aW as Es, aX as zs, aF as Rs, aY as Ns, I as Is, aB as Ut, c as se, aL as Cn, aZ as nr, a_ as Ms, B as Pn } from "./code-highlight-994tgM9v.js";
20
- import { j as Os, c as ue } from "./x-CXDkqdur.js";
21
- import { S as Dn } from "./validators-CsdOtZI6.js";
22
- import { a5 as ks, Y as Ts } from "./matrix-operation-contract-D32U2CSw.js";
23
- import { d as _s } from "./card-config-utils-9sv4e-Vb.js";
24
- import "../value-format-preferences/index.js";
25
- var Ft = class {
26
- constructor() {
27
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
28
- }
29
- subscribe(t) {
30
- return this.listeners.add(t), this.onSubscribe(), () => {
31
- this.listeners.delete(t), this.onUnsubscribe();
32
- };
33
- }
34
- hasListeners() {
35
- return this.listeners.size > 0;
36
- }
37
- onSubscribe() {
38
- }
39
- onUnsubscribe() {
40
- }
41
- }, Fs = {
42
- // We need the wrapper function syntax below instead of direct references to
43
- // global setTimeout etc.
44
- //
45
- // BAD: `setTimeout: setTimeout`
46
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
47
- //
48
- // If we use direct references here, then anything that wants to spy on or
49
- // replace the global setTimeout (like tests) won't work since we'll already
50
- // have a hard reference to the original implementation at the time when this
51
- // file was imported.
52
- setTimeout: (t, e) => setTimeout(t, e),
53
- clearTimeout: (t) => clearTimeout(t),
54
- setInterval: (t, e) => setInterval(t, e),
55
- clearInterval: (t) => clearInterval(t)
56
- }, pe, Oe, Gn, Ls = (Gn = class {
57
- constructor() {
58
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
59
- // type at app boot; and if we leave that type, then any new timer provider
60
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
61
- //
62
- // We settle for type safety for the TimeoutProvider type, and accept that
63
- // this class is unsafe internally to allow for extension.
64
- k(this, pe, Fs);
65
- k(this, Oe, !1);
66
- }
67
- setTimeoutProvider(t) {
68
- process.env.NODE_ENV !== "production" && c(this, Oe) && t !== c(this, pe) && console.error(
69
- "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
70
- { previous: c(this, pe), provider: t }
71
- ), P(this, pe, t), process.env.NODE_ENV !== "production" && P(this, Oe, !1);
72
- }
73
- setTimeout(t, e) {
74
- return process.env.NODE_ENV !== "production" && P(this, Oe, !0), c(this, pe).setTimeout(t, e);
75
- }
76
- clearTimeout(t) {
77
- c(this, pe).clearTimeout(t);
78
- }
79
- setInterval(t, e) {
80
- return process.env.NODE_ENV !== "production" && P(this, Oe, !0), c(this, pe).setInterval(t, e);
81
- }
82
- clearInterval(t) {
83
- c(this, pe).clearInterval(t);
84
- }
85
- }, pe = new WeakMap(), Oe = new WeakMap(), Gn), Zt = new Ls();
86
- function $s(t) {
87
- setTimeout(t, 0);
88
- }
89
- var Lt = typeof window > "u" || "Deno" in globalThis;
90
- function ae() {
91
- }
92
- function qs(t, e) {
93
- return typeof t == "function" ? t(e) : t;
94
- }
95
- function Hs(t) {
96
- return typeof t == "number" && t >= 0 && t !== 1 / 0;
97
- }
98
- function Qs(t, e) {
99
- return Math.max(t + (e || 0) - Date.now(), 0);
100
- }
101
- function en(t, e) {
102
- return typeof t == "function" ? t(e) : t;
103
- }
104
- function js(t, e) {
105
- return typeof t == "function" ? t(e) : t;
106
- }
107
- function An(t, e) {
108
- const {
109
- type: n = "all",
110
- exact: r,
111
- fetchStatus: s,
112
- predicate: i,
113
- queryKey: o,
114
- stale: a
115
- } = t;
116
- if (o) {
117
- if (r) {
118
- if (e.queryHash !== dn(o, e.options))
119
- return !1;
120
- } else if (!gt(e.queryKey, o))
121
- return !1;
122
- }
123
- if (n !== "all") {
124
- const l = e.isActive();
125
- if (n === "active" && !l || n === "inactive" && l)
126
- return !1;
127
- }
128
- return !(typeof a == "boolean" && e.isStale() !== a || s && s !== e.state.fetchStatus || i && !i(e));
129
- }
130
- function En(t, e) {
131
- const { exact: n, status: r, predicate: s, mutationKey: i } = t;
132
- if (i) {
133
- if (!e.options.mutationKey)
134
- return !1;
135
- if (n) {
136
- if (yt(e.options.mutationKey) !== yt(i))
137
- return !1;
138
- } else if (!gt(e.options.mutationKey, i))
139
- return !1;
140
- }
141
- return !(r && e.state.status !== r || s && !s(e));
142
- }
143
- function dn(t, e) {
144
- return ((e == null ? void 0 : e.queryKeyHashFn) || yt)(t);
145
- }
146
- function yt(t) {
147
- return JSON.stringify(
148
- t,
149
- (e, n) => nn(n) ? Object.keys(n).sort().reduce((r, s) => (r[s] = n[s], r), {}) : n
150
- );
151
- }
152
- function gt(t, e) {
153
- return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? Object.keys(e).every((n) => gt(t[n], e[n])) : !1;
154
- }
155
- var Gs = Object.prototype.hasOwnProperty;
156
- function tn(t, e) {
157
- if (t === e)
158
- return t;
159
- const n = zn(t) && zn(e);
160
- if (!n && !(nn(t) && nn(e))) return e;
161
- const s = (n ? t : Object.keys(t)).length, i = n ? e : Object.keys(e), o = i.length, a = n ? new Array(o) : {};
162
- let l = 0;
163
- for (let d = 0; d < o; d++) {
164
- const h = n ? d : i[d], f = t[h], u = e[h];
165
- if (f === u) {
166
- a[h] = f, (n ? d < s : Gs.call(t, h)) && l++;
167
- continue;
168
- }
169
- if (f === null || u === null || typeof f != "object" || typeof u != "object") {
170
- a[h] = u;
171
- continue;
172
- }
173
- const v = tn(f, u);
174
- a[h] = v, v === f && l++;
175
- }
176
- return s === o && l === s ? t : a;
177
- }
178
- function eo(t, e) {
179
- if (!e || Object.keys(t).length !== Object.keys(e).length)
180
- return !1;
181
- for (const n in t)
182
- if (t[n] !== e[n])
183
- return !1;
184
- return !0;
185
- }
186
- function zn(t) {
187
- return Array.isArray(t) && t.length === Object.keys(t).length;
188
- }
189
- function nn(t) {
190
- if (!Rn(t))
191
- return !1;
192
- const e = t.constructor;
193
- if (e === void 0)
194
- return !0;
195
- const n = e.prototype;
196
- return !(!Rn(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
197
- }
198
- function Rn(t) {
199
- return Object.prototype.toString.call(t) === "[object Object]";
200
- }
201
- function Ks(t) {
202
- return new Promise((e) => {
203
- Zt.setTimeout(e, t);
204
- });
205
- }
206
- function Bs(t, e, n) {
207
- if (typeof n.structuralSharing == "function")
208
- return n.structuralSharing(t, e);
209
- if (n.structuralSharing !== !1) {
210
- if (process.env.NODE_ENV !== "production")
211
- try {
212
- return tn(t, e);
213
- } catch (r) {
214
- throw console.error(
215
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`
216
- ), r;
217
- }
218
- return tn(t, e);
219
- }
220
- return e;
221
- }
222
- function to(t) {
223
- return t;
224
- }
225
- function Us(t, e, n = 0) {
226
- const r = [...t, e];
227
- return n && r.length > n ? r.slice(1) : r;
228
- }
229
- function Vs(t, e, n = 0) {
230
- const r = [e, ...t];
231
- return n && r.length > n ? r.slice(0, -1) : r;
232
- }
233
- var Mt = Symbol();
234
- function rr(t, e) {
235
- return process.env.NODE_ENV !== "production" && t.queryFn === Mt && console.error(
236
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
237
- ), !t.queryFn && (e != null && e.initialPromise) ? () => e.initialPromise : !t.queryFn || t.queryFn === Mt ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
238
- }
239
- function no(t, e) {
240
- return typeof t == "function" ? t(...e) : !!t;
241
- }
242
- var ke, De, Ye, Kn, Ws = (Kn = class extends Ft {
243
- constructor() {
244
- super();
245
- k(this, ke);
246
- k(this, De);
247
- k(this, Ye);
248
- P(this, Ye, (e) => {
249
- if (!Lt && window.addEventListener) {
250
- const n = () => e();
251
- return window.addEventListener("visibilitychange", n, !1), () => {
252
- window.removeEventListener("visibilitychange", n);
253
- };
254
- }
255
- });
256
- }
257
- onSubscribe() {
258
- c(this, De) || this.setEventListener(c(this, Ye));
259
- }
260
- onUnsubscribe() {
261
- var e;
262
- this.hasListeners() || ((e = c(this, De)) == null || e.call(this), P(this, De, void 0));
263
- }
264
- setEventListener(e) {
265
- var n;
266
- P(this, Ye, e), (n = c(this, De)) == null || n.call(this), P(this, De, e((r) => {
267
- typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
268
- }));
269
- }
270
- setFocused(e) {
271
- c(this, ke) !== e && (P(this, ke, e), this.onFocus());
272
- }
273
- onFocus() {
274
- const e = this.isFocused();
275
- this.listeners.forEach((n) => {
276
- n(e);
277
- });
278
- }
279
- isFocused() {
280
- var e;
281
- return typeof c(this, ke) == "boolean" ? c(this, ke) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
282
- }
283
- }, ke = new WeakMap(), De = new WeakMap(), Ye = new WeakMap(), Kn), sr = new Ws();
284
- function Xs() {
285
- let t, e;
286
- const n = new Promise((s, i) => {
287
- t = s, e = i;
288
- });
289
- n.status = "pending", n.catch(() => {
290
- });
291
- function r(s) {
292
- Object.assign(n, s), delete n.resolve, delete n.reject;
293
- }
294
- return n.resolve = (s) => {
295
- r({
296
- status: "fulfilled",
297
- value: s
298
- }), t(s);
299
- }, n.reject = (s) => {
300
- r({
301
- status: "rejected",
302
- reason: s
303
- }), e(s);
304
- }, n;
305
- }
306
- var Js = $s;
307
- function Ys() {
308
- let t = [], e = 0, n = (a) => {
309
- a();
310
- }, r = (a) => {
311
- a();
312
- }, s = Js;
313
- const i = (a) => {
314
- e ? t.push(a) : s(() => {
315
- n(a);
316
- });
317
- }, o = () => {
318
- const a = t;
319
- t = [], a.length && s(() => {
320
- r(() => {
321
- a.forEach((l) => {
322
- n(l);
323
- });
324
- });
325
- });
326
- };
327
- return {
328
- batch: (a) => {
329
- let l;
330
- e++;
331
- try {
332
- l = a();
333
- } finally {
334
- e--, e || o();
335
- }
336
- return l;
337
- },
338
- /**
339
- * All calls to the wrapped function will be batched.
340
- */
341
- batchCalls: (a) => (...l) => {
342
- i(() => {
343
- a(...l);
344
- });
345
- },
346
- schedule: i,
347
- /**
348
- * Use this method to set a custom notify function.
349
- * This can be used to for example wrap notifications with `React.act` while running tests.
350
- */
351
- setNotifyFunction: (a) => {
352
- n = a;
353
- },
354
- /**
355
- * Use this method to set a custom function to batch notifications together into a single tick.
356
- * By default React Query will use the batch function provided by ReactDOM or React Native.
357
- */
358
- setBatchNotifyFunction: (a) => {
359
- r = a;
360
- },
361
- setScheduler: (a) => {
362
- s = a;
363
- }
364
- };
365
- }
366
- var Y = Ys(), Ze, Ae, et, Bn, Zs = (Bn = class extends Ft {
367
- constructor() {
368
- super();
369
- k(this, Ze, !0);
370
- k(this, Ae);
371
- k(this, et);
372
- P(this, et, (e) => {
373
- if (!Lt && window.addEventListener) {
374
- const n = () => e(!0), r = () => e(!1);
375
- return window.addEventListener("online", n, !1), window.addEventListener("offline", r, !1), () => {
376
- window.removeEventListener("online", n), window.removeEventListener("offline", r);
377
- };
378
- }
379
- });
380
- }
381
- onSubscribe() {
382
- c(this, Ae) || this.setEventListener(c(this, et));
383
- }
384
- onUnsubscribe() {
385
- var e;
386
- this.hasListeners() || ((e = c(this, Ae)) == null || e.call(this), P(this, Ae, void 0));
387
- }
388
- setEventListener(e) {
389
- var n;
390
- P(this, et, e), (n = c(this, Ae)) == null || n.call(this), P(this, Ae, e(this.setOnline.bind(this)));
391
- }
392
- setOnline(e) {
393
- c(this, Ze) !== e && (P(this, Ze, e), this.listeners.forEach((r) => {
394
- r(e);
395
- }));
396
- }
397
- isOnline() {
398
- return c(this, Ze);
399
- }
400
- }, Ze = new WeakMap(), Ae = new WeakMap(), et = new WeakMap(), Bn), Ot = new Zs();
401
- function ei(t) {
402
- return Math.min(1e3 * 2 ** t, 3e4);
403
- }
404
- function ir(t) {
405
- return (t ?? "online") === "online" ? Ot.isOnline() : !0;
406
- }
407
- var rn = class extends Error {
408
- constructor(t) {
409
- super("CancelledError"), this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent;
410
- }
411
- };
412
- function ar(t) {
413
- let e = !1, n = 0, r;
414
- const s = Xs(), i = () => s.status !== "pending", o = (g) => {
415
- var C;
416
- if (!i()) {
417
- const x = new rn(g);
418
- u(x), (C = t.onCancel) == null || C.call(t, x);
419
- }
420
- }, a = () => {
421
- e = !0;
422
- }, l = () => {
423
- e = !1;
424
- }, d = () => sr.isFocused() && (t.networkMode === "always" || Ot.isOnline()) && t.canRun(), h = () => ir(t.networkMode) && t.canRun(), f = (g) => {
425
- i() || (r == null || r(), s.resolve(g));
426
- }, u = (g) => {
427
- i() || (r == null || r(), s.reject(g));
428
- }, v = () => new Promise((g) => {
429
- var C;
430
- r = (x) => {
431
- (i() || d()) && g(x);
432
- }, (C = t.onPause) == null || C.call(t);
433
- }).then(() => {
434
- var g;
435
- r = void 0, i() || (g = t.onContinue) == null || g.call(t);
436
- }), b = () => {
437
- if (i())
438
- return;
439
- let g;
440
- const C = n === 0 ? t.initialPromise : void 0;
441
- try {
442
- g = C ?? t.fn();
443
- } catch (x) {
444
- g = Promise.reject(x);
445
- }
446
- Promise.resolve(g).then(f).catch((x) => {
447
- var O;
448
- if (i())
449
- return;
450
- const I = t.retry ?? (Lt ? 0 : 3), z = t.retryDelay ?? ei, y = typeof z == "function" ? z(n, x) : z, F = I === !0 || typeof I == "number" && n < I || typeof I == "function" && I(n, x);
451
- if (e || !F) {
452
- u(x);
453
- return;
454
- }
455
- n++, (O = t.onFail) == null || O.call(t, n, x), Ks(y).then(() => d() ? void 0 : v()).then(() => {
456
- e ? u(x) : b();
457
- });
458
- });
459
- };
460
- return {
461
- promise: s,
462
- status: () => s.status,
463
- cancel: o,
464
- continue: () => (r == null || r(), s),
465
- cancelRetry: a,
466
- continueRetry: l,
467
- canStart: h,
468
- start: () => (h() ? b() : v().then(b), s)
469
- };
470
- }
471
- var Te, Un, or = (Un = class {
472
- constructor() {
473
- k(this, Te);
474
- }
475
- destroy() {
476
- this.clearGcTimeout();
477
- }
478
- scheduleGc() {
479
- this.clearGcTimeout(), Hs(this.gcTime) && P(this, Te, Zt.setTimeout(() => {
480
- this.optionalRemove();
481
- }, this.gcTime));
482
- }
483
- updateGcTime(t) {
484
- this.gcTime = Math.max(
485
- this.gcTime || 0,
486
- t ?? (Lt ? 1 / 0 : 5 * 60 * 1e3)
487
- );
488
- }
489
- clearGcTimeout() {
490
- c(this, Te) && (Zt.clearTimeout(c(this, Te)), P(this, Te, void 0));
491
- }
492
- }, Te = new WeakMap(), Un), _e, tt, re, Fe, K, bt, Le, oe, be, Vn, ti = (Vn = class extends or {
493
- constructor(e) {
494
- super();
495
- k(this, oe);
496
- k(this, _e);
497
- k(this, tt);
498
- k(this, re);
499
- k(this, Fe);
500
- k(this, K);
501
- k(this, bt);
502
- k(this, Le);
503
- P(this, Le, !1), P(this, bt, e.defaultOptions), this.setOptions(e.options), this.observers = [], P(this, Fe, e.client), P(this, re, c(this, Fe).getQueryCache()), this.queryKey = e.queryKey, this.queryHash = e.queryHash, P(this, _e, In(this.options)), this.state = e.state ?? c(this, _e), this.scheduleGc();
504
- }
505
- get meta() {
506
- return this.options.meta;
507
- }
508
- get promise() {
509
- var e;
510
- return (e = c(this, K)) == null ? void 0 : e.promise;
511
- }
512
- setOptions(e) {
513
- if (this.options = { ...c(this, bt), ...e }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
514
- const n = In(this.options);
515
- n.data !== void 0 && (this.setState(
516
- Nn(n.data, n.dataUpdatedAt)
517
- ), P(this, _e, n));
518
- }
519
- }
520
- optionalRemove() {
521
- !this.observers.length && this.state.fetchStatus === "idle" && c(this, re).remove(this);
522
- }
523
- setData(e, n) {
524
- const r = Bs(this.state.data, e, this.options);
525
- return V(this, oe, be).call(this, {
526
- data: r,
527
- type: "success",
528
- dataUpdatedAt: n == null ? void 0 : n.updatedAt,
529
- manual: n == null ? void 0 : n.manual
530
- }), r;
531
- }
532
- setState(e, n) {
533
- V(this, oe, be).call(this, { type: "setState", state: e, setStateOptions: n });
534
- }
535
- cancel(e) {
536
- var r, s;
537
- const n = (r = c(this, K)) == null ? void 0 : r.promise;
538
- return (s = c(this, K)) == null || s.cancel(e), n ? n.then(ae).catch(ae) : Promise.resolve();
539
- }
540
- destroy() {
541
- super.destroy(), this.cancel({ silent: !0 });
542
- }
543
- reset() {
544
- this.destroy(), this.setState(c(this, _e));
545
- }
546
- isActive() {
547
- return this.observers.some(
548
- (e) => js(e.options.enabled, this) !== !1
549
- );
550
- }
551
- isDisabled() {
552
- return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Mt || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
553
- }
554
- isStatic() {
555
- return this.getObserversCount() > 0 ? this.observers.some(
556
- (e) => en(e.options.staleTime, this) === "static"
557
- ) : !1;
558
- }
559
- isStale() {
560
- return this.getObserversCount() > 0 ? this.observers.some(
561
- (e) => e.getCurrentResult().isStale
562
- ) : this.state.data === void 0 || this.state.isInvalidated;
563
- }
564
- isStaleByTime(e = 0) {
565
- return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !Qs(this.state.dataUpdatedAt, e);
566
- }
567
- onFocus() {
568
- var n;
569
- const e = this.observers.find((r) => r.shouldFetchOnWindowFocus());
570
- e == null || e.refetch({ cancelRefetch: !1 }), (n = c(this, K)) == null || n.continue();
571
- }
572
- onOnline() {
573
- var n;
574
- const e = this.observers.find((r) => r.shouldFetchOnReconnect());
575
- e == null || e.refetch({ cancelRefetch: !1 }), (n = c(this, K)) == null || n.continue();
576
- }
577
- addObserver(e) {
578
- this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), c(this, re).notify({ type: "observerAdded", query: this, observer: e }));
579
- }
580
- removeObserver(e) {
581
- this.observers.includes(e) && (this.observers = this.observers.filter((n) => n !== e), this.observers.length || (c(this, K) && (c(this, Le) ? c(this, K).cancel({ revert: !0 }) : c(this, K).cancelRetry()), this.scheduleGc()), c(this, re).notify({ type: "observerRemoved", query: this, observer: e }));
582
- }
583
- getObserversCount() {
584
- return this.observers.length;
585
- }
586
- invalidate() {
587
- this.state.isInvalidated || V(this, oe, be).call(this, { type: "invalidate" });
588
- }
589
- async fetch(e, n) {
590
- var l, d, h, f, u, v, b, g, C, x, I, z;
591
- if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
592
- // re-start the fetch; there is a chance that the query is still in a
593
- // pending state when that happens
594
- ((l = c(this, K)) == null ? void 0 : l.status()) !== "rejected") {
595
- if (this.state.data !== void 0 && (n != null && n.cancelRefetch))
596
- this.cancel({ silent: !0 });
597
- else if (c(this, K))
598
- return c(this, K).continueRetry(), c(this, K).promise;
599
- }
600
- if (e && this.setOptions(e), !this.options.queryFn) {
601
- const y = this.observers.find((F) => F.options.queryFn);
602
- y && this.setOptions(y.options);
603
- }
604
- process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
605
- "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']"
606
- ));
607
- const r = new AbortController(), s = (y) => {
608
- Object.defineProperty(y, "signal", {
609
- enumerable: !0,
610
- get: () => (P(this, Le, !0), r.signal)
611
- });
612
- }, i = () => {
613
- const y = rr(this.options, n), O = (() => {
614
- const D = {
615
- client: c(this, Fe),
616
- queryKey: this.queryKey,
617
- meta: this.meta
618
- };
619
- return s(D), D;
620
- })();
621
- return P(this, Le, !1), this.options.persister ? this.options.persister(
622
- y,
623
- O,
624
- this
625
- ) : y(O);
626
- }, a = (() => {
627
- const y = {
628
- fetchOptions: n,
629
- options: this.options,
630
- queryKey: this.queryKey,
631
- client: c(this, Fe),
632
- state: this.state,
633
- fetchFn: i
634
- };
635
- return s(y), y;
636
- })();
637
- (d = this.options.behavior) == null || d.onFetch(a, this), P(this, tt, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((h = a.fetchOptions) == null ? void 0 : h.meta)) && V(this, oe, be).call(this, { type: "fetch", meta: (f = a.fetchOptions) == null ? void 0 : f.meta }), P(this, K, ar({
638
- initialPromise: n == null ? void 0 : n.initialPromise,
639
- fn: a.fetchFn,
640
- onCancel: (y) => {
641
- y instanceof rn && y.revert && this.setState({
642
- ...c(this, tt),
643
- fetchStatus: "idle"
644
- }), r.abort();
645
- },
646
- onFail: (y, F) => {
647
- V(this, oe, be).call(this, { type: "failed", failureCount: y, error: F });
648
- },
649
- onPause: () => {
650
- V(this, oe, be).call(this, { type: "pause" });
651
- },
652
- onContinue: () => {
653
- V(this, oe, be).call(this, { type: "continue" });
654
- },
655
- retry: a.options.retry,
656
- retryDelay: a.options.retryDelay,
657
- networkMode: a.options.networkMode,
658
- canRun: () => !0
659
- }));
660
- try {
661
- const y = await c(this, K).start();
662
- if (y === void 0)
663
- throw process.env.NODE_ENV !== "production" && console.error(
664
- `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
665
- ), new Error(`${this.queryHash} data is undefined`);
666
- return this.setData(y), (v = (u = c(this, re).config).onSuccess) == null || v.call(u, y, this), (g = (b = c(this, re).config).onSettled) == null || g.call(
667
- b,
668
- y,
669
- this.state.error,
670
- this
671
- ), y;
672
- } catch (y) {
673
- if (y instanceof rn) {
674
- if (y.silent)
675
- return c(this, K).promise;
676
- if (y.revert) {
677
- if (this.state.data === void 0)
678
- throw y;
679
- return this.state.data;
680
- }
681
- }
682
- throw V(this, oe, be).call(this, {
683
- type: "error",
684
- error: y
685
- }), (x = (C = c(this, re).config).onError) == null || x.call(
686
- C,
687
- y,
688
- this
689
- ), (z = (I = c(this, re).config).onSettled) == null || z.call(
690
- I,
691
- this.state.data,
692
- y,
693
- this
694
- ), y;
695
- } finally {
696
- this.scheduleGc();
697
- }
698
- }
699
- }, _e = new WeakMap(), tt = new WeakMap(), re = new WeakMap(), Fe = new WeakMap(), K = new WeakMap(), bt = new WeakMap(), Le = new WeakMap(), oe = new WeakSet(), be = function(e) {
700
- const n = (r) => {
701
- switch (e.type) {
702
- case "failed":
703
- return {
704
- ...r,
705
- fetchFailureCount: e.failureCount,
706
- fetchFailureReason: e.error
707
- };
708
- case "pause":
709
- return {
710
- ...r,
711
- fetchStatus: "paused"
712
- };
713
- case "continue":
714
- return {
715
- ...r,
716
- fetchStatus: "fetching"
717
- };
718
- case "fetch":
719
- return {
720
- ...r,
721
- ...ni(r.data, this.options),
722
- fetchMeta: e.meta ?? null
723
- };
724
- case "success":
725
- const s = {
726
- ...r,
727
- ...Nn(e.data, e.dataUpdatedAt),
728
- dataUpdateCount: r.dataUpdateCount + 1,
729
- ...!e.manual && {
730
- fetchStatus: "idle",
731
- fetchFailureCount: 0,
732
- fetchFailureReason: null
733
- }
734
- };
735
- return P(this, tt, e.manual ? s : void 0), s;
736
- case "error":
737
- const i = e.error;
738
- return {
739
- ...r,
740
- error: i,
741
- errorUpdateCount: r.errorUpdateCount + 1,
742
- errorUpdatedAt: Date.now(),
743
- fetchFailureCount: r.fetchFailureCount + 1,
744
- fetchFailureReason: i,
745
- fetchStatus: "idle",
746
- status: "error"
747
- };
748
- case "invalidate":
749
- return {
750
- ...r,
751
- isInvalidated: !0
752
- };
753
- case "setState":
754
- return {
755
- ...r,
756
- ...e.state
757
- };
758
- }
759
- };
760
- this.state = n(this.state), Y.batch(() => {
761
- this.observers.forEach((r) => {
762
- r.onQueryUpdate();
763
- }), c(this, re).notify({ query: this, type: "updated", action: e });
764
- });
765
- }, Vn);
766
- function ni(t, e) {
767
- return {
768
- fetchFailureCount: 0,
769
- fetchFailureReason: null,
770
- fetchStatus: ir(e.networkMode) ? "fetching" : "paused",
771
- ...t === void 0 && {
772
- error: null,
773
- status: "pending"
774
- }
775
- };
776
- }
777
- function Nn(t, e) {
778
- return {
779
- data: t,
780
- dataUpdatedAt: e ?? Date.now(),
781
- error: null,
782
- isInvalidated: !1,
783
- status: "success"
784
- };
785
- }
786
- function In(t) {
787
- const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, n = e !== void 0, r = n ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
788
- return {
789
- data: e,
790
- dataUpdateCount: 0,
791
- dataUpdatedAt: n ? r ?? Date.now() : 0,
792
- error: null,
793
- errorUpdateCount: 0,
794
- errorUpdatedAt: 0,
795
- fetchFailureCount: 0,
796
- fetchFailureReason: null,
797
- fetchMeta: null,
798
- isInvalidated: !1,
799
- status: n ? "success" : "pending",
800
- fetchStatus: "idle"
801
- };
802
- }
803
- function Mn(t) {
804
- return {
805
- onFetch: (e, n) => {
806
- var h, f, u, v, b;
807
- const r = e.options, s = (u = (f = (h = e.fetchOptions) == null ? void 0 : h.meta) == null ? void 0 : f.fetchMore) == null ? void 0 : u.direction, i = ((v = e.state.data) == null ? void 0 : v.pages) || [], o = ((b = e.state.data) == null ? void 0 : b.pageParams) || [];
808
- let a = { pages: [], pageParams: [] }, l = 0;
809
- const d = async () => {
810
- let g = !1;
811
- const C = (z) => {
812
- Object.defineProperty(z, "signal", {
813
- enumerable: !0,
814
- get: () => (e.signal.aborted ? g = !0 : e.signal.addEventListener("abort", () => {
815
- g = !0;
816
- }), e.signal)
817
- });
818
- }, x = rr(e.options, e.fetchOptions), I = async (z, y, F) => {
819
- if (g)
820
- return Promise.reject();
821
- if (y == null && z.pages.length)
822
- return Promise.resolve(z);
823
- const D = (() => {
824
- const L = {
825
- client: e.client,
826
- queryKey: e.queryKey,
827
- pageParam: y,
828
- direction: F ? "backward" : "forward",
829
- meta: e.options.meta
830
- };
831
- return C(L), L;
832
- })(), B = await x(D), { maxPages: W } = e.options, T = F ? Vs : Us;
833
- return {
834
- pages: T(z.pages, B, W),
835
- pageParams: T(z.pageParams, y, W)
836
- };
837
- };
838
- if (s && i.length) {
839
- const z = s === "backward", y = z ? lr : sn, F = {
840
- pages: i,
841
- pageParams: o
842
- }, O = y(r, F);
843
- a = await I(F, O, z);
844
- } else {
845
- const z = t ?? i.length;
846
- do {
847
- const y = l === 0 ? o[0] ?? r.initialPageParam : sn(r, a);
848
- if (l > 0 && y == null)
849
- break;
850
- a = await I(a, y), l++;
851
- } while (l < z);
852
- }
853
- return a;
854
- };
855
- e.options.persister ? e.fetchFn = () => {
856
- var g, C;
857
- return (C = (g = e.options).persister) == null ? void 0 : C.call(
858
- g,
859
- d,
860
- {
861
- client: e.client,
862
- queryKey: e.queryKey,
863
- meta: e.options.meta,
864
- signal: e.signal
865
- },
866
- n
867
- );
868
- } : e.fetchFn = d;
869
- }
870
- };
871
- }
872
- function sn(t, { pages: e, pageParams: n }) {
873
- const r = e.length - 1;
874
- return e.length > 0 ? t.getNextPageParam(
875
- e[r],
876
- e,
877
- n[r],
878
- n
879
- ) : void 0;
880
- }
881
- function lr(t, { pages: e, pageParams: n }) {
882
- var r;
883
- return e.length > 0 ? (r = t.getPreviousPageParam) == null ? void 0 : r.call(t, e[0], e, n[0], n) : void 0;
884
- }
885
- function ro(t, e) {
886
- return e ? sn(t, e) != null : !1;
887
- }
888
- function so(t, e) {
889
- return !e || !t.getPreviousPageParam ? !1 : lr(t, e) != null;
890
- }
891
- var xt, ye, J, $e, ge, Ce, Wn, ri = (Wn = class extends or {
892
- constructor(e) {
893
- super();
894
- k(this, ge);
895
- k(this, xt);
896
- k(this, ye);
897
- k(this, J);
898
- k(this, $e);
899
- P(this, xt, e.client), this.mutationId = e.mutationId, P(this, J, e.mutationCache), P(this, ye, []), this.state = e.state || si(), this.setOptions(e.options), this.scheduleGc();
900
- }
901
- setOptions(e) {
902
- this.options = e, this.updateGcTime(this.options.gcTime);
903
- }
904
- get meta() {
905
- return this.options.meta;
906
- }
907
- addObserver(e) {
908
- c(this, ye).includes(e) || (c(this, ye).push(e), this.clearGcTimeout(), c(this, J).notify({
909
- type: "observerAdded",
910
- mutation: this,
911
- observer: e
912
- }));
913
- }
914
- removeObserver(e) {
915
- P(this, ye, c(this, ye).filter((n) => n !== e)), this.scheduleGc(), c(this, J).notify({
916
- type: "observerRemoved",
917
- mutation: this,
918
- observer: e
919
- });
920
- }
921
- optionalRemove() {
922
- c(this, ye).length || (this.state.status === "pending" ? this.scheduleGc() : c(this, J).remove(this));
923
- }
924
- continue() {
925
- var e;
926
- return ((e = c(this, $e)) == null ? void 0 : e.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
927
- this.execute(this.state.variables);
928
- }
929
- async execute(e) {
930
- var o, a, l, d, h, f, u, v, b, g, C, x, I, z, y, F, O, D, B, W;
931
- const n = () => {
932
- V(this, ge, Ce).call(this, { type: "continue" });
933
- }, r = {
934
- client: c(this, xt),
935
- meta: this.options.meta,
936
- mutationKey: this.options.mutationKey
937
- };
938
- P(this, $e, ar({
939
- fn: () => this.options.mutationFn ? this.options.mutationFn(e, r) : Promise.reject(new Error("No mutationFn found")),
940
- onFail: (T, L) => {
941
- V(this, ge, Ce).call(this, { type: "failed", failureCount: T, error: L });
942
- },
943
- onPause: () => {
944
- V(this, ge, Ce).call(this, { type: "pause" });
945
- },
946
- onContinue: n,
947
- retry: this.options.retry ?? 0,
948
- retryDelay: this.options.retryDelay,
949
- networkMode: this.options.networkMode,
950
- canRun: () => c(this, J).canRun(this)
951
- }));
952
- const s = this.state.status === "pending", i = !c(this, $e).canStart();
953
- try {
954
- if (s)
955
- n();
956
- else {
957
- V(this, ge, Ce).call(this, { type: "pending", variables: e, isPaused: i }), await ((a = (o = c(this, J).config).onMutate) == null ? void 0 : a.call(
958
- o,
959
- e,
960
- this,
961
- r
962
- ));
963
- const L = await ((d = (l = this.options).onMutate) == null ? void 0 : d.call(
964
- l,
965
- e,
966
- r
967
- ));
968
- L !== this.state.context && V(this, ge, Ce).call(this, {
969
- type: "pending",
970
- context: L,
971
- variables: e,
972
- isPaused: i
973
- });
974
- }
975
- const T = await c(this, $e).start();
976
- return await ((f = (h = c(this, J).config).onSuccess) == null ? void 0 : f.call(
977
- h,
978
- T,
979
- e,
980
- this.state.context,
981
- this,
982
- r
983
- )), await ((v = (u = this.options).onSuccess) == null ? void 0 : v.call(
984
- u,
985
- T,
986
- e,
987
- this.state.context,
988
- r
989
- )), await ((g = (b = c(this, J).config).onSettled) == null ? void 0 : g.call(
990
- b,
991
- T,
992
- null,
993
- this.state.variables,
994
- this.state.context,
995
- this,
996
- r
997
- )), await ((x = (C = this.options).onSettled) == null ? void 0 : x.call(
998
- C,
999
- T,
1000
- null,
1001
- e,
1002
- this.state.context,
1003
- r
1004
- )), V(this, ge, Ce).call(this, { type: "success", data: T }), T;
1005
- } catch (T) {
1006
- try {
1007
- throw await ((z = (I = c(this, J).config).onError) == null ? void 0 : z.call(
1008
- I,
1009
- T,
1010
- e,
1011
- this.state.context,
1012
- this,
1013
- r
1014
- )), await ((F = (y = this.options).onError) == null ? void 0 : F.call(
1015
- y,
1016
- T,
1017
- e,
1018
- this.state.context,
1019
- r
1020
- )), await ((D = (O = c(this, J).config).onSettled) == null ? void 0 : D.call(
1021
- O,
1022
- void 0,
1023
- T,
1024
- this.state.variables,
1025
- this.state.context,
1026
- this,
1027
- r
1028
- )), await ((W = (B = this.options).onSettled) == null ? void 0 : W.call(
1029
- B,
1030
- void 0,
1031
- T,
1032
- e,
1033
- this.state.context,
1034
- r
1035
- )), T;
1036
- } finally {
1037
- V(this, ge, Ce).call(this, { type: "error", error: T });
1038
- }
1039
- } finally {
1040
- c(this, J).runNext(this);
1041
- }
1042
- }
1043
- }, xt = new WeakMap(), ye = new WeakMap(), J = new WeakMap(), $e = new WeakMap(), ge = new WeakSet(), Ce = function(e) {
1044
- const n = (r) => {
1045
- switch (e.type) {
1046
- case "failed":
1047
- return {
1048
- ...r,
1049
- failureCount: e.failureCount,
1050
- failureReason: e.error
1051
- };
1052
- case "pause":
1053
- return {
1054
- ...r,
1055
- isPaused: !0
1056
- };
1057
- case "continue":
1058
- return {
1059
- ...r,
1060
- isPaused: !1
1061
- };
1062
- case "pending":
1063
- return {
1064
- ...r,
1065
- context: e.context,
1066
- data: void 0,
1067
- failureCount: 0,
1068
- failureReason: null,
1069
- error: null,
1070
- isPaused: e.isPaused,
1071
- status: "pending",
1072
- variables: e.variables,
1073
- submittedAt: Date.now()
1074
- };
1075
- case "success":
1076
- return {
1077
- ...r,
1078
- data: e.data,
1079
- failureCount: 0,
1080
- failureReason: null,
1081
- error: null,
1082
- status: "success",
1083
- isPaused: !1
1084
- };
1085
- case "error":
1086
- return {
1087
- ...r,
1088
- data: void 0,
1089
- error: e.error,
1090
- failureCount: r.failureCount + 1,
1091
- failureReason: e.error,
1092
- isPaused: !1,
1093
- status: "error"
1094
- };
1095
- }
1096
- };
1097
- this.state = n(this.state), Y.batch(() => {
1098
- c(this, ye).forEach((r) => {
1099
- r.onMutationUpdate(e);
1100
- }), c(this, J).notify({
1101
- mutation: this,
1102
- type: "updated",
1103
- action: e
1104
- });
1105
- });
1106
- }, Wn);
1107
- function si() {
1108
- return {
1109
- context: void 0,
1110
- data: void 0,
1111
- error: null,
1112
- failureCount: 0,
1113
- failureReason: null,
1114
- isPaused: !1,
1115
- status: "idle",
1116
- variables: void 0,
1117
- submittedAt: 0
1118
- };
1119
- }
1120
- var xe, le, wt, Xn, ii = (Xn = class extends Ft {
1121
- constructor(e = {}) {
1122
- super();
1123
- k(this, xe);
1124
- k(this, le);
1125
- k(this, wt);
1126
- this.config = e, P(this, xe, /* @__PURE__ */ new Set()), P(this, le, /* @__PURE__ */ new Map()), P(this, wt, 0);
1127
- }
1128
- build(e, n, r) {
1129
- const s = new ri({
1130
- client: e,
1131
- mutationCache: this,
1132
- mutationId: ++Et(this, wt)._,
1133
- options: e.defaultMutationOptions(n),
1134
- state: r
1135
- });
1136
- return this.add(s), s;
1137
- }
1138
- add(e) {
1139
- c(this, xe).add(e);
1140
- const n = zt(e);
1141
- if (typeof n == "string") {
1142
- const r = c(this, le).get(n);
1143
- r ? r.push(e) : c(this, le).set(n, [e]);
1144
- }
1145
- this.notify({ type: "added", mutation: e });
1146
- }
1147
- remove(e) {
1148
- if (c(this, xe).delete(e)) {
1149
- const n = zt(e);
1150
- if (typeof n == "string") {
1151
- const r = c(this, le).get(n);
1152
- if (r)
1153
- if (r.length > 1) {
1154
- const s = r.indexOf(e);
1155
- s !== -1 && r.splice(s, 1);
1156
- } else r[0] === e && c(this, le).delete(n);
1157
- }
1158
- }
1159
- this.notify({ type: "removed", mutation: e });
1160
- }
1161
- canRun(e) {
1162
- const n = zt(e);
1163
- if (typeof n == "string") {
1164
- const r = c(this, le).get(n), s = r == null ? void 0 : r.find(
1165
- (i) => i.state.status === "pending"
1166
- );
1167
- return !s || s === e;
1168
- } else
1169
- return !0;
1170
- }
1171
- runNext(e) {
1172
- var r;
1173
- const n = zt(e);
1174
- if (typeof n == "string") {
1175
- const s = (r = c(this, le).get(n)) == null ? void 0 : r.find((i) => i !== e && i.state.isPaused);
1176
- return (s == null ? void 0 : s.continue()) ?? Promise.resolve();
1177
- } else
1178
- return Promise.resolve();
1179
- }
1180
- clear() {
1181
- Y.batch(() => {
1182
- c(this, xe).forEach((e) => {
1183
- this.notify({ type: "removed", mutation: e });
1184
- }), c(this, xe).clear(), c(this, le).clear();
1185
- });
1186
- }
1187
- getAll() {
1188
- return Array.from(c(this, xe));
1189
- }
1190
- find(e) {
1191
- const n = { exact: !0, ...e };
1192
- return this.getAll().find(
1193
- (r) => En(n, r)
1194
- );
1195
- }
1196
- findAll(e = {}) {
1197
- return this.getAll().filter((n) => En(e, n));
1198
- }
1199
- notify(e) {
1200
- Y.batch(() => {
1201
- this.listeners.forEach((n) => {
1202
- n(e);
1203
- });
1204
- });
1205
- }
1206
- resumePausedMutations() {
1207
- const e = this.getAll().filter((n) => n.state.isPaused);
1208
- return Y.batch(
1209
- () => Promise.all(
1210
- e.map((n) => n.continue().catch(ae))
1211
- )
1212
- );
1213
- }
1214
- }, xe = new WeakMap(), le = new WeakMap(), wt = new WeakMap(), Xn);
1215
- function zt(t) {
1216
- var e;
1217
- return (e = t.options.scope) == null ? void 0 : e.id;
1218
- }
1219
- var me, Jn, cr = (Jn = class extends Ft {
1220
- constructor(e = {}) {
1221
- super();
1222
- k(this, me);
1223
- this.config = e, P(this, me, /* @__PURE__ */ new Map());
1224
- }
1225
- build(e, n, r) {
1226
- const s = n.queryKey, i = n.queryHash ?? dn(s, n);
1227
- let o = this.get(i);
1228
- return o || (o = new ti({
1229
- client: e,
1230
- queryKey: s,
1231
- queryHash: i,
1232
- options: e.defaultQueryOptions(n),
1233
- state: r,
1234
- defaultOptions: e.getQueryDefaults(s)
1235
- }), this.add(o)), o;
1236
- }
1237
- add(e) {
1238
- c(this, me).has(e.queryHash) || (c(this, me).set(e.queryHash, e), this.notify({
1239
- type: "added",
1240
- query: e
1241
- }));
1242
- }
1243
- remove(e) {
1244
- const n = c(this, me).get(e.queryHash);
1245
- n && (e.destroy(), n === e && c(this, me).delete(e.queryHash), this.notify({ type: "removed", query: e }));
1246
- }
1247
- clear() {
1248
- Y.batch(() => {
1249
- this.getAll().forEach((e) => {
1250
- this.remove(e);
1251
- });
1252
- });
1253
- }
1254
- get(e) {
1255
- return c(this, me).get(e);
1256
- }
1257
- getAll() {
1258
- return [...c(this, me).values()];
1259
- }
1260
- find(e) {
1261
- const n = { exact: !0, ...e };
1262
- return this.getAll().find(
1263
- (r) => An(n, r)
1264
- );
1265
- }
1266
- findAll(e = {}) {
1267
- const n = this.getAll();
1268
- return Object.keys(e).length > 0 ? n.filter((r) => An(e, r)) : n;
1269
- }
1270
- notify(e) {
1271
- Y.batch(() => {
1272
- this.listeners.forEach((n) => {
1273
- n(e);
1274
- });
1275
- });
1276
- }
1277
- onFocus() {
1278
- Y.batch(() => {
1279
- this.getAll().forEach((e) => {
1280
- e.onFocus();
1281
- });
1282
- });
1283
- }
1284
- onOnline() {
1285
- Y.batch(() => {
1286
- this.getAll().forEach((e) => {
1287
- e.onOnline();
1288
- });
1289
- });
1290
- }
1291
- }, me = new WeakMap(), Jn), q, Ee, ze, nt, rt, Re, st, it, Yn, ai = (Yn = class {
1292
- constructor(t = {}) {
1293
- k(this, q);
1294
- k(this, Ee);
1295
- k(this, ze);
1296
- k(this, nt);
1297
- k(this, rt);
1298
- k(this, Re);
1299
- k(this, st);
1300
- k(this, it);
1301
- P(this, q, t.queryCache || new cr()), P(this, Ee, t.mutationCache || new ii()), P(this, ze, t.defaultOptions || {}), P(this, nt, /* @__PURE__ */ new Map()), P(this, rt, /* @__PURE__ */ new Map()), P(this, Re, 0);
1302
- }
1303
- mount() {
1304
- Et(this, Re)._++, c(this, Re) === 1 && (P(this, st, sr.subscribe(async (t) => {
1305
- t && (await this.resumePausedMutations(), c(this, q).onFocus());
1306
- })), P(this, it, Ot.subscribe(async (t) => {
1307
- t && (await this.resumePausedMutations(), c(this, q).onOnline());
1308
- })));
1309
- }
1310
- unmount() {
1311
- var t, e;
1312
- Et(this, Re)._--, c(this, Re) === 0 && ((t = c(this, st)) == null || t.call(this), P(this, st, void 0), (e = c(this, it)) == null || e.call(this), P(this, it, void 0));
1313
- }
1314
- isFetching(t) {
1315
- return c(this, q).findAll({ ...t, fetchStatus: "fetching" }).length;
1316
- }
1317
- isMutating(t) {
1318
- return c(this, Ee).findAll({ ...t, status: "pending" }).length;
1319
- }
1320
- /**
1321
- * Imperative (non-reactive) way to retrieve data for a QueryKey.
1322
- * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
1323
- *
1324
- * Hint: Do not use this function inside a component, because it won't receive updates.
1325
- * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
1326
- */
1327
- getQueryData(t) {
1328
- var n;
1329
- const e = this.defaultQueryOptions({ queryKey: t });
1330
- return (n = c(this, q).get(e.queryHash)) == null ? void 0 : n.state.data;
1331
- }
1332
- ensureQueryData(t) {
1333
- const e = this.defaultQueryOptions(t), n = c(this, q).build(this, e), r = n.state.data;
1334
- return r === void 0 ? this.fetchQuery(t) : (t.revalidateIfStale && n.isStaleByTime(en(e.staleTime, n)) && this.prefetchQuery(e), Promise.resolve(r));
1335
- }
1336
- getQueriesData(t) {
1337
- return c(this, q).findAll(t).map(({ queryKey: e, state: n }) => {
1338
- const r = n.data;
1339
- return [e, r];
1340
- });
1341
- }
1342
- setQueryData(t, e, n) {
1343
- const r = this.defaultQueryOptions({ queryKey: t }), s = c(this, q).get(
1344
- r.queryHash
1345
- ), i = s == null ? void 0 : s.state.data, o = qs(e, i);
1346
- if (o !== void 0)
1347
- return c(this, q).build(this, r).setData(o, { ...n, manual: !0 });
1348
- }
1349
- setQueriesData(t, e, n) {
1350
- return Y.batch(
1351
- () => c(this, q).findAll(t).map(({ queryKey: r }) => [
1352
- r,
1353
- this.setQueryData(r, e, n)
1354
- ])
1355
- );
1356
- }
1357
- getQueryState(t) {
1358
- var n;
1359
- const e = this.defaultQueryOptions({ queryKey: t });
1360
- return (n = c(this, q).get(
1361
- e.queryHash
1362
- )) == null ? void 0 : n.state;
1363
- }
1364
- removeQueries(t) {
1365
- const e = c(this, q);
1366
- Y.batch(() => {
1367
- e.findAll(t).forEach((n) => {
1368
- e.remove(n);
1369
- });
1370
- });
1371
- }
1372
- resetQueries(t, e) {
1373
- const n = c(this, q);
1374
- return Y.batch(() => (n.findAll(t).forEach((r) => {
1375
- r.reset();
1376
- }), this.refetchQueries(
1377
- {
1378
- type: "active",
1379
- ...t
1380
- },
1381
- e
1382
- )));
1383
- }
1384
- cancelQueries(t, e = {}) {
1385
- const n = { revert: !0, ...e }, r = Y.batch(
1386
- () => c(this, q).findAll(t).map((s) => s.cancel(n))
1387
- );
1388
- return Promise.all(r).then(ae).catch(ae);
1389
- }
1390
- invalidateQueries(t, e = {}) {
1391
- return Y.batch(() => (c(this, q).findAll(t).forEach((n) => {
1392
- n.invalidate();
1393
- }), (t == null ? void 0 : t.refetchType) === "none" ? Promise.resolve() : this.refetchQueries(
1394
- {
1395
- ...t,
1396
- type: (t == null ? void 0 : t.refetchType) ?? (t == null ? void 0 : t.type) ?? "active"
1397
- },
1398
- e
1399
- )));
1400
- }
1401
- refetchQueries(t, e = {}) {
1402
- const n = {
1403
- ...e,
1404
- cancelRefetch: e.cancelRefetch ?? !0
1405
- }, r = Y.batch(
1406
- () => c(this, q).findAll(t).filter((s) => !s.isDisabled() && !s.isStatic()).map((s) => {
1407
- let i = s.fetch(void 0, n);
1408
- return n.throwOnError || (i = i.catch(ae)), s.state.fetchStatus === "paused" ? Promise.resolve() : i;
1409
- })
1410
- );
1411
- return Promise.all(r).then(ae);
1412
- }
1413
- fetchQuery(t) {
1414
- const e = this.defaultQueryOptions(t);
1415
- e.retry === void 0 && (e.retry = !1);
1416
- const n = c(this, q).build(this, e);
1417
- return n.isStaleByTime(
1418
- en(e.staleTime, n)
1419
- ) ? n.fetch(e) : Promise.resolve(n.state.data);
1420
- }
1421
- prefetchQuery(t) {
1422
- return this.fetchQuery(t).then(ae).catch(ae);
1423
- }
1424
- fetchInfiniteQuery(t) {
1425
- return t.behavior = Mn(t.pages), this.fetchQuery(t);
1426
- }
1427
- prefetchInfiniteQuery(t) {
1428
- return this.fetchInfiniteQuery(t).then(ae).catch(ae);
1429
- }
1430
- ensureInfiniteQueryData(t) {
1431
- return t.behavior = Mn(t.pages), this.ensureQueryData(t);
1432
- }
1433
- resumePausedMutations() {
1434
- return Ot.isOnline() ? c(this, Ee).resumePausedMutations() : Promise.resolve();
1435
- }
1436
- getQueryCache() {
1437
- return c(this, q);
1438
- }
1439
- getMutationCache() {
1440
- return c(this, Ee);
1441
- }
1442
- getDefaultOptions() {
1443
- return c(this, ze);
1444
- }
1445
- setDefaultOptions(t) {
1446
- P(this, ze, t);
1447
- }
1448
- setQueryDefaults(t, e) {
1449
- c(this, nt).set(yt(t), {
1450
- queryKey: t,
1451
- defaultOptions: e
1452
- });
1453
- }
1454
- getQueryDefaults(t) {
1455
- const e = [...c(this, nt).values()], n = {};
1456
- return e.forEach((r) => {
1457
- gt(t, r.queryKey) && Object.assign(n, r.defaultOptions);
1458
- }), n;
1459
- }
1460
- setMutationDefaults(t, e) {
1461
- c(this, rt).set(yt(t), {
1462
- mutationKey: t,
1463
- defaultOptions: e
1464
- });
1465
- }
1466
- getMutationDefaults(t) {
1467
- const e = [...c(this, rt).values()], n = {};
1468
- return e.forEach((r) => {
1469
- gt(t, r.mutationKey) && Object.assign(n, r.defaultOptions);
1470
- }), n;
1471
- }
1472
- defaultQueryOptions(t) {
1473
- if (t._defaulted)
1474
- return t;
1475
- const e = {
1476
- ...c(this, ze).queries,
1477
- ...this.getQueryDefaults(t.queryKey),
1478
- ...t,
1479
- _defaulted: !0
1480
- };
1481
- return e.queryHash || (e.queryHash = dn(
1482
- e.queryKey,
1483
- e
1484
- )), 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 === Mt && (e.enabled = !1), e;
1485
- }
1486
- defaultMutationOptions(t) {
1487
- return t != null && t._defaulted ? t : {
1488
- ...c(this, ze).mutations,
1489
- ...(t == null ? void 0 : t.mutationKey) && this.getMutationDefaults(t.mutationKey),
1490
- ...t,
1491
- _defaulted: !0
1492
- };
1493
- }
1494
- clear() {
1495
- c(this, q).clear(), c(this, Ee).clear();
1496
- }
1497
- }, q = new WeakMap(), Ee = new WeakMap(), ze = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), Re = new WeakMap(), st = new WeakMap(), it = new WeakMap(), Yn), fn = w.createContext(
1498
- void 0
1499
- ), io = (t) => {
1500
- const e = w.useContext(fn);
1501
- if (!e)
1502
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
1503
- return e;
1504
- }, oi = ({
1505
- client: t,
1506
- children: e
1507
- }) => (w.useEffect(() => (t.mount(), () => {
1508
- t.unmount();
1509
- }), [t]), /* @__PURE__ */ p(fn.Provider, { value: t, children: e }));
1510
- function li(t) {
1511
- const e = xs(), [n, r] = ve({ token: t, revision: 0 });
1512
- return n.token !== t && r({ token: t, revision: n.revision + 1 }), `${e}:${n.revision}`;
1513
- }
1514
- function ci() {
1515
- const t = ln(fn);
1516
- if (t && t.isSemaphorClient)
1517
- return t;
1518
- }
1519
- function ui({
1520
- children: t
1521
- }) {
1522
- const { setIsSessionExpired: e } = Ss(), n = ci(), [r] = ve(() => {
1523
- const s = new ai({
1524
- queryCache: new cr({
1525
- onError: (i) => {
1526
- i instanceof Error ? (console.error(`Something went wrong: ${i.message}`), i.message === "invalid token" && e(!0)) : console.error("Something went wrong:", i);
1527
- }
1528
- }),
1529
- defaultOptions: {
1530
- queries: {
1531
- gcTime: 36e5,
1532
- // 1 hour
1533
- staleTime: 3e5,
1534
- // 5 minutes
1535
- refetchOnWindowFocus: !1,
1536
- // retry: 1, // retry once
1537
- retry: !1
1538
- }
1539
- }
1540
- });
1541
- return s.isSemaphorClient = !0, s;
1542
- });
1543
- return n ? /* @__PURE__ */ p(It, { children: t }) : /* @__PURE__ */ p(oi, { client: r, children: t });
1544
- }
1545
- const di = cn(null);
1546
- function ao(t) {
1547
- return fi({
1548
- rowKey: Dn(t.rowPath),
1549
- columnKey: Dn(t.columnPath),
1550
- measureId: t.measureId
1551
- });
1552
- }
1553
- function fi(t) {
1554
- return JSON.stringify([t.rowKey, t.columnKey, t.measureId]);
1555
- }
1556
- const On = Object.freeze({
1557
- rowPageSize: 100,
1558
- columnPageSize: 20,
1559
- operations: 2,
1560
- dashboardOperations: 4,
1561
- pages: 32,
1562
- blocks: 64,
1563
- cells: 1e5,
1564
- bytes: 32 * 1024 * 1024,
1565
- checkpoints: 64,
1566
- overrides: 2e3,
1567
- mountedCells: 5e3
1568
- });
1569
- class hi {
1570
- constructor() {
1571
- At(this, "pending", /* @__PURE__ */ new Map());
1572
- At(this, "activeByCard", /* @__PURE__ */ new Map());
1573
- At(this, "active", 0);
1574
- }
1575
- run(e, n, r) {
1576
- const s = () => new DOMException("Matrix acquisition was cancelled.", "AbortError");
1577
- return n.aborted ? Promise.reject(s()) : new Promise((i, o) => {
1578
- let a = !1;
1579
- const l = () => {
1580
- var f;
1581
- if (!a) {
1582
- const u = (f = this.pending.get(e)) == null ? void 0 : f.filter((v) => v !== d);
1583
- u != null && u.length ? this.pending.set(e, u) : this.pending.delete(e), n.removeEventListener("abort", l);
1584
- }
1585
- o(s());
1586
- }, d = {
1587
- start: () => {
1588
- a = !0, this.active++, this.activeByCard.set(
1589
- e,
1590
- (this.activeByCard.get(e) ?? 0) + 1
1591
- ), Promise.resolve().then(() => {
1592
- if (n.aborted) throw s();
1593
- return r();
1594
- }).then(i, o).finally(() => {
1595
- n.removeEventListener("abort", l), this.active--;
1596
- const f = this.activeByCard.get(e) - 1;
1597
- f ? this.activeByCard.set(e, f) : this.activeByCard.delete(e), this.pump();
1598
- });
1599
- }
1600
- }, h = this.pending.get(e) ?? [];
1601
- h.push(d), this.pending.set(e, h), n.addEventListener("abort", l, { once: !0 }), this.pump();
1602
- });
1603
- }
1604
- pump() {
1605
- for (; this.active < On.dashboardOperations; ) {
1606
- const e = Array.from(this.pending).find(
1607
- ([i]) => (this.activeByCard.get(i) ?? 0) < On.operations
1608
- );
1609
- if (!e) return;
1610
- const [n, r] = e, s = r.shift();
1611
- this.pending.delete(n), r.length && this.pending.set(n, r), s.start();
1612
- }
1613
- }
1614
- }
1615
- function pi({
1616
- value: t,
1617
- children: e
1618
- }) {
1619
- const [n] = ve(() => new hi()), r = St(() => ({ ...t, queue: n }), [t, n]);
1620
- return /* @__PURE__ */ p(di.Provider, { value: r, children: e });
1621
- }
1622
- function yi(t, e) {
1623
- return async (n) => {
1624
- var o;
1625
- const r = await fetch(t, {
1626
- method: "POST",
1627
- signal: n.signal,
1628
- headers: { "Content-Type": "application/json", Authorization: `Bearer ${e}` },
1629
- body: JSON.stringify(_s(n))
1630
- });
1631
- if (r.status === 401 || r.status === 403)
1632
- return { status: "failed", failure: {
1633
- code: "forbidden",
1634
- message: "Matrix query access was denied.",
1635
- retryable: !1,
1636
- scope: { kind: "operation" }
1637
- } };
1638
- const s = await r.json().catch(() => null);
1639
- if (!s || typeof s != "object")
1640
- return { status: "failed", failure: {
1641
- code: "execution_failed",
1642
- message: "Matrix query returned an invalid response.",
1643
- retryable: r.ok || r.status >= 500,
1644
- scope: { kind: "operation" }
1645
- } };
1646
- if (!r.ok || s.error) {
1647
- const a = ks.safeParse(s.executionResult);
1648
- if (a.success && a.data.metadata.matrixFailure)
1649
- return { status: "failed", failure: a.data.metadata.matrixFailure };
1650
- const l = a.success ? a.data.validation.errors[0] : void 0;
1651
- return { status: "failed", failure: {
1652
- code: "execution_failed",
1653
- message: (l == null ? void 0 : l.message) ?? "Matrix query failed.",
1654
- retryable: r.status >= 500,
1655
- scope: { kind: "operation" }
1656
- } };
1657
- }
1658
- const i = Ts.parse((o = s.data) == null ? void 0 : o.matrixWindow);
1659
- return { status: i.failures.length ? "partial" : "success", window: i };
1660
- };
1661
- }
1662
- function gi({ children: t, authToken: e, apiServiceUrl: n, dashboardId: r }) {
1663
- const s = (e == null ? void 0 : e.accessToken) ?? "", i = St(() => ({
1664
- ready: !!(s && n),
1665
- identity: JSON.stringify([r, n]),
1666
- execute: yi(`${n ?? ""}/v1/query`, s)
1667
- }), [r, n, s]);
1668
- return /* @__PURE__ */ p(pi, { value: i, children: t });
1669
- }
1670
- const mi = {
1671
- id: "",
1672
- authToken: void 0,
1673
- tokenProps: {},
1674
- authorizationScope: "unconfigured"
1675
- }, vi = cn(mi), oo = ({
1676
- children: t,
1677
- dashboardProps: e
1678
- }) => {
1679
- var s;
1680
- const n = li((s = e.authToken) == null ? void 0 : s.accessToken), r = St(() => {
1681
- let i = {};
1682
- const o = e.authToken;
1683
- return o && (i = Os(o.accessToken)), {
1684
- ...e,
1685
- tokenProps: i,
1686
- authorizationScope: n
1687
- };
1688
- }, [e, n]);
1689
- return /* @__PURE__ */ p(ui, { children: /* @__PURE__ */ p(vi.Provider, { value: r, children: /* @__PURE__ */ p(gi, { dashboardId: r.id, authToken: r.authToken, apiServiceUrl: r.tokenProps.apiServiceUrl, children: t }) }) });
1690
- };
1691
- /**
1692
- * @license lucide-react v0.453.0 - ISC
1693
- *
1694
- * This source code is licensed under the ISC license.
1695
- * See the LICENSE file in the root directory of this source tree.
1696
- */
1697
- const lo = ue("Circle", [
1698
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
1699
- ]);
1700
- /**
1701
- * @license lucide-react v0.453.0 - ISC
1702
- *
1703
- * This source code is licensed under the ISC license.
1704
- * See the LICENSE file in the root directory of this source tree.
1705
- */
1706
- const co = ue("CodeXml", [
1707
- ["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
1708
- ["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
1709
- ["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
1710
- ]);
1711
- /**
1712
- * @license lucide-react v0.453.0 - ISC
1713
- *
1714
- * This source code is licensed under the ISC license.
1715
- * See the LICENSE file in the root directory of this source tree.
1716
- */
1717
- const uo = ue("Copy", [
1718
- ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
1719
- ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
1720
- ]);
1721
- /**
1722
- * @license lucide-react v0.453.0 - ISC
1723
- *
1724
- * This source code is licensed under the ISC license.
1725
- * See the LICENSE file in the root directory of this source tree.
1726
- */
1727
- const fo = ue("Database", [
1728
- ["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
1729
- ["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
1730
- ["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
1731
- ]);
1732
- /**
1733
- * @license lucide-react v0.453.0 - ISC
1734
- *
1735
- * This source code is licensed under the ISC license.
1736
- * See the LICENSE file in the root directory of this source tree.
1737
- */
1738
- const ho = ue("FileCode", [
1739
- ["path", { d: "M10 12.5 8 15l2 2.5", key: "1tg20x" }],
1740
- ["path", { d: "m14 12.5 2 2.5-2 2.5", key: "yinavb" }],
1741
- ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
1742
- ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z", key: "1mlx9k" }]
1743
- ]);
1744
- /**
1745
- * @license lucide-react v0.453.0 - ISC
1746
- *
1747
- * This source code is licensed under the ISC license.
1748
- * See the LICENSE file in the root directory of this source tree.
1749
- */
1750
- const bi = ue("GripVertical", [
1751
- ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
1752
- ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
1753
- ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
1754
- ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
1755
- ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
1756
- ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
1757
- ]);
1758
- /**
1759
- * @license lucide-react v0.453.0 - ISC
1760
- *
1761
- * This source code is licensed under the ISC license.
1762
- * See the LICENSE file in the root directory of this source tree.
1763
- */
1764
- const po = ue("Plus", [
1765
- ["path", { d: "M5 12h14", key: "1ays0h" }],
1766
- ["path", { d: "M12 5v14", key: "s699le" }]
1767
- ]);
1768
- /**
1769
- * @license lucide-react v0.453.0 - ISC
1770
- *
1771
- * This source code is licensed under the ISC license.
1772
- * See the LICENSE file in the root directory of this source tree.
1773
- */
1774
- const yo = ue("RefreshCw", [
1775
- ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
1776
- ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
1777
- ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
1778
- ["path", { d: "M8 16H3v5", key: "1cv678" }]
1779
- ]);
1780
- /**
1781
- * @license lucide-react v0.453.0 - ISC
1782
- *
1783
- * This source code is licensed under the ISC license.
1784
- * See the LICENSE file in the root directory of this source tree.
1785
- */
1786
- const go = ue("Send", [
1787
- [
1788
- "path",
1789
- {
1790
- d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
1791
- key: "1ffxy3"
1792
- }
1793
- ],
1794
- ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
1795
- ]);
1796
- /**
1797
- * @license lucide-react v0.453.0 - ISC
1798
- *
1799
- * This source code is licensed under the ISC license.
1800
- * See the LICENSE file in the root directory of this source tree.
1801
- */
1802
- const mo = ue("Settings2", [
1803
- ["path", { d: "M20 7h-9", key: "3s1dr2" }],
1804
- ["path", { d: "M14 17H5", key: "gfn3mx" }],
1805
- ["circle", { cx: "17", cy: "17", r: "3", key: "18b49y" }],
1806
- ["circle", { cx: "7", cy: "7", r: "3", key: "dfmy0x" }]
1807
- ]);
1808
- /**
1809
- * @license lucide-react v0.453.0 - ISC
1810
- *
1811
- * This source code is licensed under the ISC license.
1812
- * See the LICENSE file in the root directory of this source tree.
1813
- */
1814
- const vo = ue("SquarePen", [
1815
- ["path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7", key: "1m0v6g" }],
1816
- [
1817
- "path",
1818
- {
1819
- d: "M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",
1820
- key: "ohrbg2"
1821
- }
1822
- ]
1823
- ]);
1824
- // @__NO_SIDE_EFFECTS__
1825
- function xi(t) {
1826
- const e = /* @__PURE__ */ wi(t), n = w.forwardRef((r, s) => {
1827
- const { children: i, ...o } = r, a = w.Children.toArray(i), l = a.find(Ci);
1828
- if (l) {
1829
- const d = l.props.children, h = a.map((f) => f === l ? w.Children.count(d) > 1 ? w.Children.only(null) : w.isValidElement(d) ? d.props.children : null : f);
1830
- return /* @__PURE__ */ p(e, { ...o, ref: s, children: w.isValidElement(d) ? w.cloneElement(d, void 0, h) : null });
1831
- }
1832
- return /* @__PURE__ */ p(e, { ...o, ref: s, children: i });
1833
- });
1834
- return n.displayName = `${t}.Slot`, n;
1835
- }
1836
- // @__NO_SIDE_EFFECTS__
1837
- function wi(t) {
1838
- const e = w.forwardRef((n, r) => {
1839
- const { children: s, ...i } = n;
1840
- if (w.isValidElement(s)) {
1841
- const o = Di(s), a = Pi(i, s.props);
1842
- return s.type !== w.Fragment && (a.ref = r ? Cs(r, o) : o), w.cloneElement(s, a);
1843
- }
1844
- return w.Children.count(s) > 1 ? w.Children.only(null) : null;
1845
- });
1846
- return e.displayName = `${t}.SlotClone`, e;
1847
- }
1848
- var Si = Symbol("radix.slottable");
1849
- function Ci(t) {
1850
- return w.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === Si;
1851
- }
1852
- function Pi(t, e) {
1853
- const n = { ...e };
1854
- for (const r in e) {
1855
- const s = t[r], i = e[r];
1856
- /^on[A-Z]/.test(r) ? s && i ? n[r] = (...a) => {
1857
- const l = i(...a);
1858
- return s(...a), l;
1859
- } : s && (n[r] = s) : r === "style" ? n[r] = { ...s, ...i } : r === "className" && (n[r] = [s, i].filter(Boolean).join(" "));
1860
- }
1861
- return { ...t, ...n };
1862
- }
1863
- function Di(t) {
1864
- var r, s;
1865
- let e = (r = Object.getOwnPropertyDescriptor(t.props, "ref")) == null ? void 0 : r.get, n = e && "isReactWarning" in e && e.isReactWarning;
1866
- return n ? t.ref : (e = (s = Object.getOwnPropertyDescriptor(t, "ref")) == null ? void 0 : s.get, n = e && "isReactWarning" in e && e.isReactWarning, n ? t.props.ref : t.props.ref || t.ref);
1867
- }
1868
- var $t = "Dialog", [ur, dr] = tr($t), [Ai, de] = ur($t), fr = (t) => {
1869
- const {
1870
- __scopeDialog: e,
1871
- children: n,
1872
- open: r,
1873
- defaultOpen: s,
1874
- onOpenChange: i,
1875
- modal: o = !0
1876
- } = t, a = w.useRef(null), l = w.useRef(null), [d, h] = Is({
1877
- prop: r,
1878
- defaultProp: s ?? !1,
1879
- onChange: i,
1880
- caller: $t
1881
- });
1882
- return /* @__PURE__ */ p(
1883
- Ai,
1884
- {
1885
- scope: e,
1886
- triggerRef: a,
1887
- contentRef: l,
1888
- contentId: Ut(),
1889
- titleId: Ut(),
1890
- descriptionId: Ut(),
1891
- open: d,
1892
- onOpenChange: h,
1893
- onOpenToggle: w.useCallback(() => h((f) => !f), [h]),
1894
- modal: o,
1895
- children: n
1896
- }
1897
- );
1898
- };
1899
- fr.displayName = $t;
1900
- var hr = "DialogTrigger", pr = w.forwardRef(
1901
- (t, e) => {
1902
- const { __scopeDialog: n, ...r } = t, s = de(hr, n), i = Pt(e, s.triggerRef);
1903
- return /* @__PURE__ */ p(
1904
- Ct.button,
1905
- {
1906
- type: "button",
1907
- "aria-haspopup": "dialog",
1908
- "aria-expanded": s.open,
1909
- "aria-controls": s.contentId,
1910
- "data-state": yn(s.open),
1911
- ...r,
1912
- ref: i,
1913
- onClick: We(t.onClick, s.onOpenToggle)
1914
- }
1915
- );
1916
- }
1917
- );
1918
- pr.displayName = hr;
1919
- var hn = "DialogPortal", [Ei, yr] = ur(hn, {
1920
- forceMount: void 0
1921
- }), gr = (t) => {
1922
- const { __scopeDialog: e, forceMount: n, children: r, container: s } = t, i = de(hn, e);
1923
- return /* @__PURE__ */ p(Ei, { scope: e, forceMount: n, children: w.Children.map(r, (o) => /* @__PURE__ */ p(un, { present: n || i.open, children: /* @__PURE__ */ p(Ps, { asChild: !0, container: s, children: o }) })) });
1924
- };
1925
- gr.displayName = hn;
1926
- var kt = "DialogOverlay", mr = w.forwardRef(
1927
- (t, e) => {
1928
- const n = yr(kt, t.__scopeDialog), { forceMount: r = n.forceMount, ...s } = t, i = de(kt, t.__scopeDialog);
1929
- return i.modal ? /* @__PURE__ */ p(un, { present: r || i.open, children: /* @__PURE__ */ p(Ri, { ...s, ref: e }) }) : null;
1930
- }
1931
- );
1932
- mr.displayName = kt;
1933
- var zi = /* @__PURE__ */ xi("DialogOverlay.RemoveScroll"), Ri = w.forwardRef(
1934
- (t, e) => {
1935
- const { __scopeDialog: n, ...r } = t, s = de(kt, n);
1936
- return (
1937
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
1938
- // ie. when `Overlay` and `Content` are siblings
1939
- /* @__PURE__ */ p(Ds, { as: zi, allowPinchZoom: !0, shards: [s.contentRef], children: /* @__PURE__ */ p(
1940
- Ct.div,
1941
- {
1942
- "data-state": yn(s.open),
1943
- ...r,
1944
- ref: e,
1945
- style: { pointerEvents: "auto", ...r.style }
1946
- }
1947
- ) })
1948
- );
1949
- }
1950
- ), je = "DialogContent", vr = w.forwardRef(
1951
- (t, e) => {
1952
- const n = yr(je, t.__scopeDialog), { forceMount: r = n.forceMount, ...s } = t, i = de(je, t.__scopeDialog);
1953
- return /* @__PURE__ */ p(un, { present: r || i.open, children: i.modal ? /* @__PURE__ */ p(Ni, { ...s, ref: e }) : /* @__PURE__ */ p(Ii, { ...s, ref: e }) });
1954
- }
1955
- );
1956
- vr.displayName = je;
1957
- var Ni = w.forwardRef(
1958
- (t, e) => {
1959
- const n = de(je, t.__scopeDialog), r = w.useRef(null), s = Pt(e, n.contentRef, r);
1960
- return w.useEffect(() => {
1961
- const i = r.current;
1962
- if (i) return As(i);
1963
- }, []), /* @__PURE__ */ p(
1964
- br,
1965
- {
1966
- ...t,
1967
- ref: s,
1968
- trapFocus: n.open,
1969
- disableOutsidePointerEvents: !0,
1970
- onCloseAutoFocus: We(t.onCloseAutoFocus, (i) => {
1971
- var o;
1972
- i.preventDefault(), (o = n.triggerRef.current) == null || o.focus();
1973
- }),
1974
- onPointerDownOutside: We(t.onPointerDownOutside, (i) => {
1975
- const o = i.detail.originalEvent, a = o.button === 0 && o.ctrlKey === !0;
1976
- (o.button === 2 || a) && i.preventDefault();
1977
- }),
1978
- onFocusOutside: We(
1979
- t.onFocusOutside,
1980
- (i) => i.preventDefault()
1981
- )
1982
- }
1983
- );
1984
- }
1985
- ), Ii = w.forwardRef(
1986
- (t, e) => {
1987
- const n = de(je, t.__scopeDialog), r = w.useRef(!1), s = w.useRef(!1);
1988
- return /* @__PURE__ */ p(
1989
- br,
1990
- {
1991
- ...t,
1992
- ref: e,
1993
- trapFocus: !1,
1994
- disableOutsidePointerEvents: !1,
1995
- onCloseAutoFocus: (i) => {
1996
- var o, a;
1997
- (o = t.onCloseAutoFocus) == null || o.call(t, i), i.defaultPrevented || (r.current || (a = n.triggerRef.current) == null || a.focus(), i.preventDefault()), r.current = !1, s.current = !1;
1998
- },
1999
- onInteractOutside: (i) => {
2000
- var l, d;
2001
- (l = t.onInteractOutside) == null || l.call(t, i), i.defaultPrevented || (r.current = !0, i.detail.originalEvent.type === "pointerdown" && (s.current = !0));
2002
- const o = i.target;
2003
- ((d = n.triggerRef.current) == null ? void 0 : d.contains(o)) && i.preventDefault(), i.detail.originalEvent.type === "focusin" && s.current && i.preventDefault();
2004
- }
2005
- }
2006
- );
2007
- }
2008
- ), br = w.forwardRef(
2009
- (t, e) => {
2010
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: s, onCloseAutoFocus: i, ...o } = t, a = de(je, n), l = w.useRef(null), d = Pt(e, l);
2011
- return Es(), /* @__PURE__ */ qe(It, { children: [
2012
- /* @__PURE__ */ p(
2013
- zs,
2014
- {
2015
- asChild: !0,
2016
- loop: !0,
2017
- trapped: r,
2018
- onMountAutoFocus: s,
2019
- onUnmountAutoFocus: i,
2020
- children: /* @__PURE__ */ p(
2021
- Rs,
2022
- {
2023
- role: "dialog",
2024
- id: a.contentId,
2025
- "aria-describedby": a.descriptionId,
2026
- "aria-labelledby": a.titleId,
2027
- "data-state": yn(a.open),
2028
- ...o,
2029
- ref: d,
2030
- onDismiss: () => a.onOpenChange(!1)
2031
- }
2032
- )
2033
- }
2034
- ),
2035
- /* @__PURE__ */ qe(It, { children: [
2036
- /* @__PURE__ */ p(Oi, { titleId: a.titleId }),
2037
- /* @__PURE__ */ p(Ti, { contentRef: l, descriptionId: a.descriptionId })
2038
- ] })
2039
- ] });
2040
- }
2041
- ), pn = "DialogTitle", xr = w.forwardRef(
2042
- (t, e) => {
2043
- const { __scopeDialog: n, ...r } = t, s = de(pn, n);
2044
- return /* @__PURE__ */ p(Ct.h2, { id: s.titleId, ...r, ref: e });
2045
- }
2046
- );
2047
- xr.displayName = pn;
2048
- var wr = "DialogDescription", Sr = w.forwardRef(
2049
- (t, e) => {
2050
- const { __scopeDialog: n, ...r } = t, s = de(wr, n);
2051
- return /* @__PURE__ */ p(Ct.p, { id: s.descriptionId, ...r, ref: e });
2052
- }
2053
- );
2054
- Sr.displayName = wr;
2055
- var Cr = "DialogClose", Pr = w.forwardRef(
2056
- (t, e) => {
2057
- const { __scopeDialog: n, ...r } = t, s = de(Cr, n);
2058
- return /* @__PURE__ */ p(
2059
- Ct.button,
2060
- {
2061
- type: "button",
2062
- ...r,
2063
- ref: e,
2064
- onClick: We(t.onClick, () => s.onOpenChange(!1))
2065
- }
2066
- );
2067
- }
2068
- );
2069
- Pr.displayName = Cr;
2070
- function yn(t) {
2071
- return t ? "open" : "closed";
2072
- }
2073
- var Dr = "DialogTitleWarning", [Mi, Ar] = Ns(Dr, {
2074
- contentName: je,
2075
- titleName: pn,
2076
- docsSlug: "dialog"
2077
- }), Oi = ({ titleId: t }) => {
2078
- const e = Ar(Dr), n = `\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
2079
-
2080
- If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
2081
-
2082
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;
2083
- return w.useEffect(() => {
2084
- t && (document.getElementById(t) || console.error(n));
2085
- }, [n, t]), null;
2086
- }, ki = "DialogDescriptionWarning", Ti = ({ contentRef: t, descriptionId: e }) => {
2087
- const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ar(ki).contentName}}.`;
2088
- return w.useEffect(() => {
2089
- var i;
2090
- const s = (i = t.current) == null ? void 0 : i.getAttribute("aria-describedby");
2091
- e && s && (document.getElementById(e) || console.warn(r));
2092
- }, [r, t, e]), null;
2093
- }, _i = fr, Fi = pr, Li = gr, $i = mr, qi = vr, Hi = xr, Qi = Sr, Er = Pr, ji = Symbol("radix.slottable");
2094
- // @__NO_SIDE_EFFECTS__
2095
- function Gi(t) {
2096
- const e = ({ children: n }) => /* @__PURE__ */ p(It, { children: n });
2097
- return e.displayName = `${t}.Slottable`, e.__radixId = ji, e;
2098
- }
2099
- var zr = "AlertDialog", [Ki] = tr(zr, [
2100
- dr
2101
- ]), Se = dr(), Rr = (t) => {
2102
- const { __scopeAlertDialog: e, ...n } = t, r = Se(e);
2103
- return /* @__PURE__ */ p(_i, { ...r, ...n, modal: !0 });
2104
- };
2105
- Rr.displayName = zr;
2106
- var Bi = "AlertDialogTrigger", Nr = w.forwardRef(
2107
- (t, e) => {
2108
- const { __scopeAlertDialog: n, ...r } = t, s = Se(n);
2109
- return /* @__PURE__ */ p(Fi, { ...s, ...r, ref: e });
2110
- }
2111
- );
2112
- Nr.displayName = Bi;
2113
- var Ui = "AlertDialogPortal", Ir = (t) => {
2114
- const { __scopeAlertDialog: e, ...n } = t, r = Se(e);
2115
- return /* @__PURE__ */ p(Li, { ...r, ...n });
2116
- };
2117
- Ir.displayName = Ui;
2118
- var Vi = "AlertDialogOverlay", Mr = w.forwardRef(
2119
- (t, e) => {
2120
- const { __scopeAlertDialog: n, ...r } = t, s = Se(n);
2121
- return /* @__PURE__ */ p($i, { ...s, ...r, ref: e });
2122
- }
2123
- );
2124
- Mr.displayName = Vi;
2125
- var Xe = "AlertDialogContent", [Wi, Xi] = Ki(Xe), Ji = /* @__PURE__ */ Gi("AlertDialogContent"), Or = w.forwardRef(
2126
- (t, e) => {
2127
- const { __scopeAlertDialog: n, children: r, ...s } = t, i = Se(n), o = w.useRef(null), a = Pt(e, o), l = w.useRef(null);
2128
- return /* @__PURE__ */ p(
2129
- Mi,
2130
- {
2131
- contentName: Xe,
2132
- titleName: kr,
2133
- docsSlug: "alert-dialog",
2134
- children: /* @__PURE__ */ p(Wi, { scope: n, cancelRef: l, children: /* @__PURE__ */ qe(
2135
- qi,
2136
- {
2137
- role: "alertdialog",
2138
- ...i,
2139
- ...s,
2140
- ref: a,
2141
- onOpenAutoFocus: We(s.onOpenAutoFocus, (d) => {
2142
- var h;
2143
- d.preventDefault(), (h = l.current) == null || h.focus({ preventScroll: !0 });
2144
- }),
2145
- onPointerDownOutside: (d) => d.preventDefault(),
2146
- onInteractOutside: (d) => d.preventDefault(),
2147
- children: [
2148
- /* @__PURE__ */ p(Ji, { children: r }),
2149
- /* @__PURE__ */ p(Zi, { contentRef: o })
2150
- ]
2151
- }
2152
- ) })
2153
- }
2154
- );
2155
- }
2156
- );
2157
- Or.displayName = Xe;
2158
- var kr = "AlertDialogTitle", Tr = w.forwardRef(
2159
- (t, e) => {
2160
- const { __scopeAlertDialog: n, ...r } = t, s = Se(n);
2161
- return /* @__PURE__ */ p(Hi, { ...s, ...r, ref: e });
2162
- }
2163
- );
2164
- Tr.displayName = kr;
2165
- var _r = "AlertDialogDescription", Fr = w.forwardRef((t, e) => {
2166
- const { __scopeAlertDialog: n, ...r } = t, s = Se(n);
2167
- return /* @__PURE__ */ p(Qi, { ...s, ...r, ref: e });
2168
- });
2169
- Fr.displayName = _r;
2170
- var Yi = "AlertDialogAction", Lr = w.forwardRef(
2171
- (t, e) => {
2172
- const { __scopeAlertDialog: n, ...r } = t, s = Se(n);
2173
- return /* @__PURE__ */ p(Er, { ...s, ...r, ref: e });
2174
- }
2175
- );
2176
- Lr.displayName = Yi;
2177
- var $r = "AlertDialogCancel", qr = w.forwardRef(
2178
- (t, e) => {
2179
- const { __scopeAlertDialog: n, ...r } = t, { cancelRef: s } = Xi($r, n), i = Se(n), o = Pt(e, s);
2180
- return /* @__PURE__ */ p(Er, { ...i, ...r, ref: o });
2181
- }
2182
- );
2183
- qr.displayName = $r;
2184
- var Zi = ({ contentRef: t }) => {
2185
- const e = `\`${Xe}\` requires a description for the component to be accessible for screen reader users.
2186
-
2187
- You can add a description to the \`${Xe}\` by passing a \`${_r}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
2188
-
2189
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Xe}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
2190
-
2191
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
2192
- return w.useEffect(() => {
2193
- var r;
2194
- document.getElementById(
2195
- (r = t.current) == null ? void 0 : r.getAttribute("aria-describedby")
2196
- ) || console.warn(e);
2197
- }, [e, t]), null;
2198
- }, ea = Rr, ta = Nr, na = Ir, Hr = Mr, Qr = Or, jr = Lr, Gr = qr, Kr = Tr, Br = Fr;
2199
- const bo = ea, xo = ta, ra = na, Ur = w.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ p(
2200
- Hr,
2201
- {
2202
- className: se(
2203
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
2204
- t
2205
- ),
2206
- ...e,
2207
- ref: n
2208
- }
2209
- ));
2210
- Ur.displayName = Hr.displayName;
2211
- const sa = w.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ qe(ra, { children: [
2212
- /* @__PURE__ */ p(Cn, { children: /* @__PURE__ */ p(Ur, {}) }),
2213
- /* @__PURE__ */ p(Cn, { children: /* @__PURE__ */ p(
2214
- Qr,
2215
- {
2216
- ref: n,
2217
- className: se(
2218
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
2219
- t
2220
- ),
2221
- ...e
2222
- }
2223
- ) })
2224
- ] }));
2225
- sa.displayName = Qr.displayName;
2226
- const ia = ({
2227
- className: t,
2228
- ...e
2229
- }) => /* @__PURE__ */ p(
2230
- "div",
2231
- {
2232
- className: se(
2233
- "flex flex-col space-y-1 text-center sm:text-left",
2234
- t
2235
- ),
2236
- ...e
2237
- }
2238
- );
2239
- ia.displayName = "AlertDialogHeader";
2240
- const aa = ({
2241
- className: t,
2242
- ...e
2243
- }) => /* @__PURE__ */ p(
2244
- "div",
2245
- {
2246
- className: se(
2247
- "flex flex-col-reverse gap-1.5 sm:flex-row sm:justify-end sm:space-x-0",
2248
- t
2249
- ),
2250
- ...e
2251
- }
2252
- );
2253
- aa.displayName = "AlertDialogFooter";
2254
- const oa = w.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ p(
2255
- Kr,
2256
- {
2257
- ref: n,
2258
- className: se("text-[15px] font-semibold", t),
2259
- ...e
2260
- }
2261
- ));
2262
- oa.displayName = Kr.displayName;
2263
- const la = w.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ p(
2264
- Br,
2265
- {
2266
- ref: n,
2267
- className: se("text-[13px] leading-5 text-muted-foreground", t),
2268
- ...e
2269
- }
2270
- ));
2271
- la.displayName = Br.displayName;
2272
- const ca = w.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ p(
2273
- jr,
2274
- {
2275
- ref: n,
2276
- className: se(nr({ size: "xs" }), t),
2277
- ...e
2278
- }
2279
- ));
2280
- ca.displayName = jr.displayName;
2281
- const ua = w.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ p(
2282
- Gr,
2283
- {
2284
- ref: n,
2285
- className: se(
2286
- nr({ variant: "outline", size: "xs" }),
2287
- t
2288
- ),
2289
- ...e
2290
- }
2291
- ));
2292
- ua.displayName = Gr.displayName;
2293
- const qt = cn(null);
2294
- qt.displayName = "PanelGroupContext";
2295
- const H = {
2296
- group: "data-panel-group",
2297
- groupDirection: "data-panel-group-direction",
2298
- groupId: "data-panel-group-id",
2299
- panel: "data-panel",
2300
- panelCollapsible: "data-panel-collapsible",
2301
- panelId: "data-panel-id",
2302
- panelSize: "data-panel-size",
2303
- resizeHandle: "data-resize-handle",
2304
- resizeHandleActive: "data-resize-handle-active",
2305
- resizeHandleEnabled: "data-panel-resize-handle-enabled",
2306
- resizeHandleId: "data-panel-resize-handle-id",
2307
- resizeHandleState: "data-resize-handle-state"
2308
- }, gn = 10, Qe = ws, kn = w.useId, da = typeof kn == "function" ? kn : () => null;
2309
- let fa = 0;
2310
- function mn(t = null) {
2311
- const e = da(), n = te(t || e || null);
2312
- return n.current === null && (n.current = "" + fa++), t ?? n.current;
2313
- }
2314
- function Vr({
2315
- children: t,
2316
- className: e = "",
2317
- collapsedSize: n,
2318
- collapsible: r,
2319
- defaultSize: s,
2320
- forwardedRef: i,
2321
- id: o,
2322
- maxSize: a,
2323
- minSize: l,
2324
- onCollapse: d,
2325
- onExpand: h,
2326
- onResize: f,
2327
- order: u,
2328
- style: v,
2329
- tagName: b = "div",
2330
- ...g
2331
- }) {
2332
- const C = ln(qt);
2333
- if (C === null)
2334
- throw Error("Panel components must be rendered within a PanelGroup container");
2335
- const {
2336
- collapsePanel: x,
2337
- expandPanel: I,
2338
- getPanelSize: z,
2339
- getPanelStyle: y,
2340
- groupId: F,
2341
- isPanelCollapsed: O,
2342
- reevaluatePanelConstraints: D,
2343
- registerPanel: B,
2344
- resizePanel: W,
2345
- unregisterPanel: T
2346
- } = C, L = mn(o), Q = te({
2347
- callbacks: {
2348
- onCollapse: d,
2349
- onExpand: h,
2350
- onResize: f
2351
- },
2352
- constraints: {
2353
- collapsedSize: n,
2354
- collapsible: r,
2355
- defaultSize: s,
2356
- maxSize: a,
2357
- minSize: l
2358
- },
2359
- id: L,
2360
- idIsFromProps: o !== void 0,
2361
- order: u
2362
- });
2363
- te({
2364
- didLogMissingDefaultSizeWarning: !1
2365
- }), Qe(() => {
2366
- const {
2367
- callbacks: U,
2368
- constraints: G
2369
- } = Q.current, X = {
2370
- ...G
2371
- };
2372
- Q.current.id = L, Q.current.idIsFromProps = o !== void 0, Q.current.order = u, U.onCollapse = d, U.onExpand = h, U.onResize = f, G.collapsedSize = n, G.collapsible = r, G.defaultSize = s, G.maxSize = a, G.minSize = l, (X.collapsedSize !== G.collapsedSize || X.collapsible !== G.collapsible || X.maxSize !== G.maxSize || X.minSize !== G.minSize) && D(Q.current, X);
2373
- }), Qe(() => {
2374
- const U = Q.current;
2375
- return B(U), () => {
2376
- T(U);
2377
- };
2378
- }, [u, L, B, T]), er(i, () => ({
2379
- collapse: () => {
2380
- x(Q.current);
2381
- },
2382
- expand: (U) => {
2383
- I(Q.current, U);
2384
- },
2385
- getId() {
2386
- return L;
2387
- },
2388
- getSize() {
2389
- return z(Q.current);
2390
- },
2391
- isCollapsed() {
2392
- return O(Q.current);
2393
- },
2394
- isExpanded() {
2395
- return !O(Q.current);
2396
- },
2397
- resize: (U) => {
2398
- W(Q.current, U);
2399
- }
2400
- }), [x, I, z, O, L, W]);
2401
- const Ne = y(Q.current, s);
2402
- return at(b, {
2403
- ...g,
2404
- children: t,
2405
- className: e,
2406
- id: L,
2407
- style: {
2408
- ...Ne,
2409
- ...v
2410
- },
2411
- // CSS selectors
2412
- [H.groupId]: F,
2413
- [H.panel]: "",
2414
- [H.panelCollapsible]: r || void 0,
2415
- [H.panelId]: L,
2416
- [H.panelSize]: parseFloat("" + Ne.flexGrow).toFixed(1)
2417
- });
2418
- }
2419
- const Wr = Zn((t, e) => at(Vr, {
2420
- ...t,
2421
- forwardedRef: e
2422
- }));
2423
- Vr.displayName = "Panel";
2424
- Wr.displayName = "forwardRef(Panel)";
2425
- let an = null, Nt = -1, Pe = null;
2426
- function ha(t, e) {
2427
- if (e) {
2428
- const n = (e & es) !== 0, r = (e & ts) !== 0, s = (e & ns) !== 0, i = (e & rs) !== 0;
2429
- if (n)
2430
- return s ? "se-resize" : i ? "ne-resize" : "e-resize";
2431
- if (r)
2432
- return s ? "sw-resize" : i ? "nw-resize" : "w-resize";
2433
- if (s)
2434
- return "s-resize";
2435
- if (i)
2436
- return "n-resize";
2437
- }
2438
- switch (t) {
2439
- case "horizontal":
2440
- return "ew-resize";
2441
- case "intersection":
2442
- return "move";
2443
- case "vertical":
2444
- return "ns-resize";
2445
- }
2446
- }
2447
- function pa() {
2448
- Pe !== null && (document.head.removeChild(Pe), an = null, Pe = null, Nt = -1);
2449
- }
2450
- function Vt(t, e) {
2451
- var n, r;
2452
- const s = ha(t, e);
2453
- if (an !== s) {
2454
- if (an = s, Pe === null && (Pe = document.createElement("style"), document.head.appendChild(Pe)), Nt >= 0) {
2455
- var i;
2456
- (i = Pe.sheet) === null || i === void 0 || i.removeRule(Nt);
2457
- }
2458
- Nt = (n = (r = Pe.sheet) === null || r === void 0 ? void 0 : r.insertRule(`*{cursor: ${s} !important;}`)) !== null && n !== void 0 ? n : -1;
2459
- }
2460
- }
2461
- function Xr(t) {
2462
- return t.type === "keydown";
2463
- }
2464
- function Jr(t) {
2465
- return t.type.startsWith("pointer");
2466
- }
2467
- function Yr(t) {
2468
- return t.type.startsWith("mouse");
2469
- }
2470
- function Ht(t) {
2471
- if (Jr(t)) {
2472
- if (t.isPrimary)
2473
- return {
2474
- x: t.clientX,
2475
- y: t.clientY
2476
- };
2477
- } else if (Yr(t))
2478
- return {
2479
- x: t.clientX,
2480
- y: t.clientY
2481
- };
2482
- return {
2483
- x: 1 / 0,
2484
- y: 1 / 0
2485
- };
2486
- }
2487
- function ya() {
2488
- if (typeof matchMedia == "function")
2489
- return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
2490
- }
2491
- function ga(t, e, n) {
2492
- return t.x < e.x + e.width && t.x + t.width > e.x && t.y < e.y + e.height && t.y + t.height > e.y;
2493
- }
2494
- function ma(t, e) {
2495
- if (t === e) throw new Error("Cannot compare node with itself");
2496
- const n = {
2497
- a: Fn(t),
2498
- b: Fn(e)
2499
- };
2500
- let r;
2501
- for (; n.a.at(-1) === n.b.at(-1); )
2502
- t = n.a.pop(), e = n.b.pop(), r = t;
2503
- N(r, "Stacking order can only be calculated for elements with a common ancestor");
2504
- const s = {
2505
- a: _n(Tn(n.a)),
2506
- b: _n(Tn(n.b))
2507
- };
2508
- if (s.a === s.b) {
2509
- const i = r.childNodes, o = {
2510
- a: n.a.at(-1),
2511
- b: n.b.at(-1)
2512
- };
2513
- let a = i.length;
2514
- for (; a--; ) {
2515
- const l = i[a];
2516
- if (l === o.a) return 1;
2517
- if (l === o.b) return -1;
2518
- }
2519
- }
2520
- return Math.sign(s.a - s.b);
2521
- }
2522
- const va = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
2523
- function ba(t) {
2524
- var e;
2525
- const n = getComputedStyle((e = Zr(t)) !== null && e !== void 0 ? e : t).display;
2526
- return n === "flex" || n === "inline-flex";
2527
- }
2528
- function xa(t) {
2529
- const e = getComputedStyle(t);
2530
- return !!(e.position === "fixed" || e.zIndex !== "auto" && (e.position !== "static" || ba(t)) || +e.opacity < 1 || "transform" in e && e.transform !== "none" || "webkitTransform" in e && e.webkitTransform !== "none" || "mixBlendMode" in e && e.mixBlendMode !== "normal" || "filter" in e && e.filter !== "none" || "webkitFilter" in e && e.webkitFilter !== "none" || "isolation" in e && e.isolation === "isolate" || va.test(e.willChange) || e.webkitOverflowScrolling === "touch");
2531
- }
2532
- function Tn(t) {
2533
- let e = t.length;
2534
- for (; e--; ) {
2535
- const n = t[e];
2536
- if (N(n, "Missing node"), xa(n)) return n;
2537
- }
2538
- return null;
2539
- }
2540
- function _n(t) {
2541
- return t && Number(getComputedStyle(t).zIndex) || 0;
2542
- }
2543
- function Fn(t) {
2544
- const e = [];
2545
- for (; t; )
2546
- e.push(t), t = Zr(t);
2547
- return e;
2548
- }
2549
- function Zr(t) {
2550
- const {
2551
- parentNode: e
2552
- } = t;
2553
- return e && e instanceof ShadowRoot ? e.host : e;
2554
- }
2555
- const es = 1, ts = 2, ns = 4, rs = 8, wa = ya() === "coarse";
2556
- let ce = [], Je = !1, Me = /* @__PURE__ */ new Map(), Qt = /* @__PURE__ */ new Map();
2557
- const mt = /* @__PURE__ */ new Set();
2558
- function Sa(t, e, n, r, s) {
2559
- var i;
2560
- const {
2561
- ownerDocument: o
2562
- } = e, a = {
2563
- direction: n,
2564
- element: e,
2565
- hitAreaMargins: r,
2566
- setResizeHandlerState: s
2567
- }, l = (i = Me.get(o)) !== null && i !== void 0 ? i : 0;
2568
- return Me.set(o, l + 1), mt.add(a), Tt(), function() {
2569
- var h;
2570
- Qt.delete(t), mt.delete(a);
2571
- const f = (h = Me.get(o)) !== null && h !== void 0 ? h : 1;
2572
- if (Me.set(o, f - 1), Tt(), f === 1 && Me.delete(o), ce.includes(a)) {
2573
- const u = ce.indexOf(a);
2574
- u >= 0 && ce.splice(u, 1), bn(), s("up", !0, null);
2575
- }
2576
- };
2577
- }
2578
- function Ca(t) {
2579
- const {
2580
- target: e
2581
- } = t, {
2582
- x: n,
2583
- y: r
2584
- } = Ht(t);
2585
- Je = !0, vn({
2586
- target: e,
2587
- x: n,
2588
- y: r
2589
- }), Tt(), ce.length > 0 && (_t("down", t), t.preventDefault(), ss(e) || t.stopImmediatePropagation());
2590
- }
2591
- function Wt(t) {
2592
- const {
2593
- x: e,
2594
- y: n
2595
- } = Ht(t);
2596
- if (Je && t.buttons === 0 && (Je = !1, _t("up", t)), !Je) {
2597
- const {
2598
- target: r
2599
- } = t;
2600
- vn({
2601
- target: r,
2602
- x: e,
2603
- y: n
2604
- });
2605
- }
2606
- _t("move", t), bn(), ce.length > 0 && t.preventDefault();
2607
- }
2608
- function Xt(t) {
2609
- const {
2610
- target: e
2611
- } = t, {
2612
- x: n,
2613
- y: r
2614
- } = Ht(t);
2615
- Qt.clear(), Je = !1, ce.length > 0 && (t.preventDefault(), ss(e) || t.stopImmediatePropagation()), _t("up", t), vn({
2616
- target: e,
2617
- x: n,
2618
- y: r
2619
- }), bn(), Tt();
2620
- }
2621
- function ss(t) {
2622
- let e = t;
2623
- for (; e; ) {
2624
- if (e.hasAttribute(H.resizeHandle))
2625
- return !0;
2626
- e = e.parentElement;
2627
- }
2628
- return !1;
2629
- }
2630
- function vn({
2631
- target: t,
2632
- x: e,
2633
- y: n
2634
- }) {
2635
- ce.splice(0);
2636
- let r = null;
2637
- (t instanceof HTMLElement || t instanceof SVGElement) && (r = t), mt.forEach((s) => {
2638
- const {
2639
- element: i,
2640
- hitAreaMargins: o
2641
- } = s, a = i.getBoundingClientRect(), {
2642
- bottom: l,
2643
- left: d,
2644
- right: h,
2645
- top: f
2646
- } = a, u = wa ? o.coarse : o.fine;
2647
- if (e >= d - u && e <= h + u && n >= f - u && n <= l + u) {
2648
- if (r !== null && document.contains(r) && i !== r && !i.contains(r) && !r.contains(i) && // Calculating stacking order has a cost, so we should avoid it if possible
2649
- // That is why we only check potentially intersecting handles,
2650
- // and why we skip if the event target is within the handle's DOM
2651
- ma(r, i) > 0) {
2652
- let b = r, g = !1;
2653
- for (; b && !b.contains(i); ) {
2654
- if (ga(b.getBoundingClientRect(), a)) {
2655
- g = !0;
2656
- break;
2657
- }
2658
- b = b.parentElement;
2659
- }
2660
- if (g)
2661
- return;
2662
- }
2663
- ce.push(s);
2664
- }
2665
- });
2666
- }
2667
- function Jt(t, e) {
2668
- Qt.set(t, e);
2669
- }
2670
- function bn() {
2671
- let t = !1, e = !1;
2672
- ce.forEach((r) => {
2673
- const {
2674
- direction: s
2675
- } = r;
2676
- s === "horizontal" ? t = !0 : e = !0;
2677
- });
2678
- let n = 0;
2679
- Qt.forEach((r) => {
2680
- n |= r;
2681
- }), t && e ? Vt("intersection", n) : t ? Vt("horizontal", n) : e ? Vt("vertical", n) : pa();
2682
- }
2683
- let Yt = new AbortController();
2684
- function Tt() {
2685
- Yt.abort(), Yt = new AbortController();
2686
- const t = {
2687
- capture: !0,
2688
- signal: Yt.signal
2689
- };
2690
- mt.size && (Je ? (ce.length > 0 && Me.forEach((e, n) => {
2691
- const {
2692
- body: r
2693
- } = n;
2694
- e > 0 && (r.addEventListener("contextmenu", Xt, t), r.addEventListener("pointerleave", Wt, t), r.addEventListener("pointermove", Wt, t));
2695
- }), window.addEventListener("pointerup", Xt, t), window.addEventListener("pointercancel", Xt, t)) : Me.forEach((e, n) => {
2696
- const {
2697
- body: r
2698
- } = n;
2699
- e > 0 && (r.addEventListener("pointerdown", Ca, t), r.addEventListener("pointermove", Wt, t));
2700
- }));
2701
- }
2702
- function _t(t, e) {
2703
- mt.forEach((n) => {
2704
- const {
2705
- setResizeHandlerState: r
2706
- } = n, s = ce.includes(n);
2707
- r(t, s, e);
2708
- });
2709
- }
2710
- function Pa() {
2711
- const [t, e] = ve(0);
2712
- return ee(() => e((n) => n + 1), []);
2713
- }
2714
- function N(t, e) {
2715
- if (!t)
2716
- throw console.error(e), Error(e);
2717
- }
2718
- function Ge(t, e, n = gn) {
2719
- return t.toFixed(n) === e.toFixed(n) ? 0 : t > e ? 1 : -1;
2720
- }
2721
- function we(t, e, n = gn) {
2722
- return Ge(t, e, n) === 0;
2723
- }
2724
- function ne(t, e, n) {
2725
- return Ge(t, e, n) === 0;
2726
- }
2727
- function Da(t, e, n) {
2728
- if (t.length !== e.length)
2729
- return !1;
2730
- for (let r = 0; r < t.length; r++) {
2731
- const s = t[r], i = e[r];
2732
- if (!ne(s, i, n))
2733
- return !1;
2734
- }
2735
- return !0;
2736
- }
2737
- function Ve({
2738
- panelConstraints: t,
2739
- panelIndex: e,
2740
- size: n
2741
- }) {
2742
- const r = t[e];
2743
- N(r != null, `Panel constraints not found for index ${e}`);
2744
- let {
2745
- collapsedSize: s = 0,
2746
- collapsible: i,
2747
- maxSize: o = 100,
2748
- minSize: a = 0
2749
- } = r;
2750
- if (Ge(n, a) < 0)
2751
- if (i) {
2752
- const l = (s + a) / 2;
2753
- Ge(n, l) < 0 ? n = s : n = a;
2754
- } else
2755
- n = a;
2756
- return n = Math.min(o, n), n = parseFloat(n.toFixed(gn)), n;
2757
- }
2758
- function ht({
2759
- delta: t,
2760
- initialLayout: e,
2761
- panelConstraints: n,
2762
- pivotIndices: r,
2763
- prevLayout: s,
2764
- trigger: i
2765
- }) {
2766
- if (ne(t, 0))
2767
- return e;
2768
- const o = [...e], [a, l] = r;
2769
- N(a != null, "Invalid first pivot index"), N(l != null, "Invalid second pivot index");
2770
- let d = 0;
2771
- if (i === "keyboard") {
2772
- {
2773
- const f = t < 0 ? l : a, u = n[f];
2774
- N(u, `Panel constraints not found for index ${f}`);
2775
- const {
2776
- collapsedSize: v = 0,
2777
- collapsible: b,
2778
- minSize: g = 0
2779
- } = u;
2780
- if (b) {
2781
- const C = e[f];
2782
- if (N(C != null, `Previous layout not found for panel index ${f}`), ne(C, v)) {
2783
- const x = g - C;
2784
- Ge(x, Math.abs(t)) > 0 && (t = t < 0 ? 0 - x : x);
2785
- }
2786
- }
2787
- }
2788
- {
2789
- const f = t < 0 ? a : l, u = n[f];
2790
- N(u, `No panel constraints found for index ${f}`);
2791
- const {
2792
- collapsedSize: v = 0,
2793
- collapsible: b,
2794
- minSize: g = 0
2795
- } = u;
2796
- if (b) {
2797
- const C = e[f];
2798
- if (N(C != null, `Previous layout not found for panel index ${f}`), ne(C, g)) {
2799
- const x = C - v;
2800
- Ge(x, Math.abs(t)) > 0 && (t = t < 0 ? 0 - x : x);
2801
- }
2802
- }
2803
- }
2804
- }
2805
- {
2806
- const f = t < 0 ? 1 : -1;
2807
- let u = t < 0 ? l : a, v = 0;
2808
- for (; ; ) {
2809
- const g = e[u];
2810
- N(g != null, `Previous layout not found for panel index ${u}`);
2811
- const x = Ve({
2812
- panelConstraints: n,
2813
- panelIndex: u,
2814
- size: 100
2815
- }) - g;
2816
- if (v += x, u += f, u < 0 || u >= n.length)
2817
- break;
2818
- }
2819
- const b = Math.min(Math.abs(t), Math.abs(v));
2820
- t = t < 0 ? 0 - b : b;
2821
- }
2822
- {
2823
- let u = t < 0 ? a : l;
2824
- for (; u >= 0 && u < n.length; ) {
2825
- const v = Math.abs(t) - Math.abs(d), b = e[u];
2826
- N(b != null, `Previous layout not found for panel index ${u}`);
2827
- const g = b - v, C = Ve({
2828
- panelConstraints: n,
2829
- panelIndex: u,
2830
- size: g
2831
- });
2832
- if (!ne(b, C) && (d += b - C, o[u] = C, d.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3), void 0, {
2833
- numeric: !0
2834
- }) >= 0))
2835
- break;
2836
- t < 0 ? u-- : u++;
2837
- }
2838
- }
2839
- if (Da(s, o))
2840
- return s;
2841
- {
2842
- const f = t < 0 ? l : a, u = e[f];
2843
- N(u != null, `Previous layout not found for panel index ${f}`);
2844
- const v = u + d, b = Ve({
2845
- panelConstraints: n,
2846
- panelIndex: f,
2847
- size: v
2848
- });
2849
- if (o[f] = b, !ne(b, v)) {
2850
- let g = v - b, x = t < 0 ? l : a;
2851
- for (; x >= 0 && x < n.length; ) {
2852
- const I = o[x];
2853
- N(I != null, `Previous layout not found for panel index ${x}`);
2854
- const z = I + g, y = Ve({
2855
- panelConstraints: n,
2856
- panelIndex: x,
2857
- size: z
2858
- });
2859
- if (ne(I, y) || (g -= y - I, o[x] = y), ne(g, 0))
2860
- break;
2861
- t > 0 ? x-- : x++;
2862
- }
2863
- }
2864
- }
2865
- const h = o.reduce((f, u) => u + f, 0);
2866
- return ne(h, 100) ? o : s;
2867
- }
2868
- function Aa({
2869
- layout: t,
2870
- panelsArray: e,
2871
- pivotIndices: n
2872
- }) {
2873
- let r = 0, s = 100, i = 0, o = 0;
2874
- const a = n[0];
2875
- N(a != null, "No pivot index found"), e.forEach((f, u) => {
2876
- const {
2877
- constraints: v
2878
- } = f, {
2879
- maxSize: b = 100,
2880
- minSize: g = 0
2881
- } = v;
2882
- u === a ? (r = g, s = b) : (i += g, o += b);
2883
- });
2884
- const l = Math.min(s, 100 - i), d = Math.max(r, 100 - o), h = t[a];
2885
- return {
2886
- valueMax: l,
2887
- valueMin: d,
2888
- valueNow: h
2889
- };
2890
- }
2891
- function vt(t, e = document) {
2892
- return Array.from(e.querySelectorAll(`[${H.resizeHandleId}][data-panel-group-id="${t}"]`));
2893
- }
2894
- function is(t, e, n = document) {
2895
- const s = vt(t, n).findIndex((i) => i.getAttribute(H.resizeHandleId) === e);
2896
- return s ?? null;
2897
- }
2898
- function as(t, e, n) {
2899
- const r = is(t, e, n);
2900
- return r != null ? [r, r + 1] : [-1, -1];
2901
- }
2902
- function os(t, e = document) {
2903
- var n;
2904
- if (e instanceof HTMLElement && (e == null || (n = e.dataset) === null || n === void 0 ? void 0 : n.panelGroupId) == t)
2905
- return e;
2906
- const r = e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);
2907
- return r || null;
2908
- }
2909
- function jt(t, e = document) {
2910
- const n = e.querySelector(`[${H.resizeHandleId}="${t}"]`);
2911
- return n || null;
2912
- }
2913
- function Ea(t, e, n, r = document) {
2914
- var s, i, o, a;
2915
- const l = jt(e, r), d = vt(t, r), h = l ? d.indexOf(l) : -1, f = (s = (i = n[h]) === null || i === void 0 ? void 0 : i.id) !== null && s !== void 0 ? s : null, u = (o = (a = n[h + 1]) === null || a === void 0 ? void 0 : a.id) !== null && o !== void 0 ? o : null;
2916
- return [f, u];
2917
- }
2918
- function za({
2919
- committedValuesRef: t,
2920
- eagerValuesRef: e,
2921
- groupId: n,
2922
- layout: r,
2923
- panelDataArray: s,
2924
- panelGroupElement: i,
2925
- setLayout: o
2926
- }) {
2927
- te({
2928
- didWarnAboutMissingResizeHandle: !1
2929
- }), Qe(() => {
2930
- if (!i)
2931
- return;
2932
- const a = vt(n, i);
2933
- for (let l = 0; l < s.length - 1; l++) {
2934
- const {
2935
- valueMax: d,
2936
- valueMin: h,
2937
- valueNow: f
2938
- } = Aa({
2939
- layout: r,
2940
- panelsArray: s,
2941
- pivotIndices: [l, l + 1]
2942
- }), u = a[l];
2943
- if (u != null) {
2944
- const v = s[l];
2945
- N(v, `No panel data found for index "${l}"`), u.setAttribute("aria-controls", v.id), u.setAttribute("aria-valuemax", "" + Math.round(d)), u.setAttribute("aria-valuemin", "" + Math.round(h)), u.setAttribute("aria-valuenow", f != null ? "" + Math.round(f) : "");
2946
- }
2947
- }
2948
- return () => {
2949
- a.forEach((l, d) => {
2950
- l.removeAttribute("aria-controls"), l.removeAttribute("aria-valuemax"), l.removeAttribute("aria-valuemin"), l.removeAttribute("aria-valuenow");
2951
- });
2952
- };
2953
- }, [n, r, s, i]), He(() => {
2954
- if (!i)
2955
- return;
2956
- const a = e.current;
2957
- N(a, "Eager values not found");
2958
- const {
2959
- panelDataArray: l
2960
- } = a, d = os(n, i);
2961
- N(d != null, `No group found for id "${n}"`);
2962
- const h = vt(n, i);
2963
- N(h, `No resize handles found for group id "${n}"`);
2964
- const f = h.map((u) => {
2965
- const v = u.getAttribute(H.resizeHandleId);
2966
- N(v, "Resize handle element has no handle id attribute");
2967
- const [b, g] = Ea(n, v, l, i);
2968
- if (b == null || g == null)
2969
- return () => {
2970
- };
2971
- const C = (x) => {
2972
- if (!x.defaultPrevented)
2973
- switch (x.key) {
2974
- case "Enter": {
2975
- x.preventDefault();
2976
- const I = l.findIndex((z) => z.id === b);
2977
- if (I >= 0) {
2978
- const z = l[I];
2979
- N(z, `No panel data found for index ${I}`);
2980
- const y = r[I], {
2981
- collapsedSize: F = 0,
2982
- collapsible: O,
2983
- minSize: D = 0
2984
- } = z.constraints;
2985
- if (y != null && O) {
2986
- const B = ht({
2987
- delta: ne(y, F) ? D - F : F - y,
2988
- initialLayout: r,
2989
- panelConstraints: l.map((W) => W.constraints),
2990
- pivotIndices: as(n, v, i),
2991
- prevLayout: r,
2992
- trigger: "keyboard"
2993
- });
2994
- r !== B && o(B);
2995
- }
2996
- }
2997
- break;
2998
- }
2999
- }
3000
- };
3001
- return u.addEventListener("keydown", C), () => {
3002
- u.removeEventListener("keydown", C);
3003
- };
3004
- });
3005
- return () => {
3006
- f.forEach((u) => u());
3007
- };
3008
- }, [i, t, e, n, r, s, o]);
3009
- }
3010
- function Ln(t, e) {
3011
- if (t.length !== e.length)
3012
- return !1;
3013
- for (let n = 0; n < t.length; n++)
3014
- if (t[n] !== e[n])
3015
- return !1;
3016
- return !0;
3017
- }
3018
- function ls(t, e) {
3019
- const n = t === "horizontal", {
3020
- x: r,
3021
- y: s
3022
- } = Ht(e);
3023
- return n ? r : s;
3024
- }
3025
- function Ra(t, e, n, r, s) {
3026
- const i = n === "horizontal", o = jt(e, s);
3027
- N(o, `No resize handle element found for id "${e}"`);
3028
- const a = o.getAttribute(H.groupId);
3029
- N(a, "Resize handle element has no group id attribute");
3030
- let {
3031
- initialCursorPosition: l
3032
- } = r;
3033
- const d = ls(n, t), h = os(a, s);
3034
- N(h, `No group element found for id "${a}"`);
3035
- const f = h.getBoundingClientRect(), u = i ? f.width : f.height;
3036
- return (d - l) / u * 100;
3037
- }
3038
- function Na(t, e, n, r, s, i) {
3039
- if (Xr(t)) {
3040
- const o = n === "horizontal";
3041
- let a = 0;
3042
- t.shiftKey ? a = 100 : s != null ? a = s : a = 10;
3043
- let l = 0;
3044
- switch (t.key) {
3045
- case "ArrowDown":
3046
- l = o ? 0 : a;
3047
- break;
3048
- case "ArrowLeft":
3049
- l = o ? -a : 0;
3050
- break;
3051
- case "ArrowRight":
3052
- l = o ? a : 0;
3053
- break;
3054
- case "ArrowUp":
3055
- l = o ? 0 : -a;
3056
- break;
3057
- case "End":
3058
- l = 100;
3059
- break;
3060
- case "Home":
3061
- l = -100;
3062
- break;
3063
- }
3064
- return l;
3065
- } else
3066
- return r == null ? 0 : Ra(t, e, n, r, i);
3067
- }
3068
- function Ia({
3069
- panelDataArray: t
3070
- }) {
3071
- const e = Array(t.length), n = t.map((i) => i.constraints);
3072
- let r = 0, s = 100;
3073
- for (let i = 0; i < t.length; i++) {
3074
- const o = n[i];
3075
- N(o, `Panel constraints not found for index ${i}`);
3076
- const {
3077
- defaultSize: a
3078
- } = o;
3079
- a != null && (r++, e[i] = a, s -= a);
3080
- }
3081
- for (let i = 0; i < t.length; i++) {
3082
- const o = n[i];
3083
- N(o, `Panel constraints not found for index ${i}`);
3084
- const {
3085
- defaultSize: a
3086
- } = o;
3087
- if (a != null)
3088
- continue;
3089
- const l = t.length - r, d = s / l;
3090
- r++, e[i] = d, s -= d;
3091
- }
3092
- return e;
3093
- }
3094
- function Be(t, e, n) {
3095
- e.forEach((r, s) => {
3096
- const i = t[s];
3097
- N(i, `Panel data not found for index ${s}`);
3098
- const {
3099
- callbacks: o,
3100
- constraints: a,
3101
- id: l
3102
- } = i, {
3103
- collapsedSize: d = 0,
3104
- collapsible: h
3105
- } = a, f = n[l];
3106
- if (f == null || r !== f) {
3107
- n[l] = r;
3108
- const {
3109
- onCollapse: u,
3110
- onExpand: v,
3111
- onResize: b
3112
- } = o;
3113
- b && b(r, f), h && (u || v) && (v && (f == null || we(f, d)) && !we(r, d) && v(), u && (f == null || !we(f, d)) && we(r, d) && u());
3114
- }
3115
- });
3116
- }
3117
- function Rt(t, e) {
3118
- if (t.length !== e.length)
3119
- return !1;
3120
- for (let n = 0; n < t.length; n++)
3121
- if (t[n] != e[n])
3122
- return !1;
3123
- return !0;
3124
- }
3125
- function Ma({
3126
- defaultSize: t,
3127
- dragState: e,
3128
- layout: n,
3129
- panelData: r,
3130
- panelIndex: s,
3131
- precision: i = 3
3132
- }) {
3133
- const o = n[s];
3134
- let a;
3135
- return o == null ? a = t != null ? t.toPrecision(i) : "1" : r.length === 1 ? a = "1" : a = o.toPrecision(i), {
3136
- flexBasis: 0,
3137
- flexGrow: a,
3138
- flexShrink: 1,
3139
- // Without this, Panel sizes may be unintentionally overridden by their content
3140
- overflow: "hidden",
3141
- // Disable pointer events inside of a panel during resize
3142
- // This avoid edge cases like nested iframes
3143
- pointerEvents: e !== null ? "none" : void 0
3144
- };
3145
- }
3146
- function Oa(t, e = 10) {
3147
- let n = null;
3148
- return (...s) => {
3149
- n !== null && clearTimeout(n), n = setTimeout(() => {
3150
- t(...s);
3151
- }, e);
3152
- };
3153
- }
3154
- function $n(t) {
3155
- try {
3156
- if (typeof localStorage < "u")
3157
- t.getItem = (e) => localStorage.getItem(e), t.setItem = (e, n) => {
3158
- localStorage.setItem(e, n);
3159
- };
3160
- else
3161
- throw new Error("localStorage not supported in this environment");
3162
- } catch (e) {
3163
- console.error(e), t.getItem = () => null, t.setItem = () => {
3164
- };
3165
- }
3166
- }
3167
- function cs(t) {
3168
- return `react-resizable-panels:${t}`;
3169
- }
3170
- function us(t) {
3171
- return t.map((e) => {
3172
- const {
3173
- constraints: n,
3174
- id: r,
3175
- idIsFromProps: s,
3176
- order: i
3177
- } = e;
3178
- return s ? r : i ? `${i}:${JSON.stringify(n)}` : JSON.stringify(n);
3179
- }).sort((e, n) => e.localeCompare(n)).join(",");
3180
- }
3181
- function ds(t, e) {
3182
- try {
3183
- const n = cs(t), r = e.getItem(n);
3184
- if (r) {
3185
- const s = JSON.parse(r);
3186
- if (typeof s == "object" && s != null)
3187
- return s;
3188
- }
3189
- } catch {
3190
- }
3191
- return null;
3192
- }
3193
- function ka(t, e, n) {
3194
- var r, s;
3195
- const i = (r = ds(t, n)) !== null && r !== void 0 ? r : {}, o = us(e);
3196
- return (s = i[o]) !== null && s !== void 0 ? s : null;
3197
- }
3198
- function Ta(t, e, n, r, s) {
3199
- var i;
3200
- const o = cs(t), a = us(e), l = (i = ds(t, s)) !== null && i !== void 0 ? i : {};
3201
- l[a] = {
3202
- expandToSizes: Object.fromEntries(n.entries()),
3203
- layout: r
3204
- };
3205
- try {
3206
- s.setItem(o, JSON.stringify(l));
3207
- } catch (d) {
3208
- console.error(d);
3209
- }
3210
- }
3211
- function qn({
3212
- layout: t,
3213
- panelConstraints: e
3214
- }) {
3215
- const n = [...t], r = n.reduce((i, o) => i + o, 0);
3216
- if (n.length !== e.length)
3217
- throw Error(`Invalid ${e.length} panel layout: ${n.map((i) => `${i}%`).join(", ")}`);
3218
- if (!ne(r, 100) && n.length > 0)
3219
- for (let i = 0; i < e.length; i++) {
3220
- const o = n[i];
3221
- N(o != null, `No layout data found for index ${i}`);
3222
- const a = 100 / r * o;
3223
- n[i] = a;
3224
- }
3225
- let s = 0;
3226
- for (let i = 0; i < e.length; i++) {
3227
- const o = n[i];
3228
- N(o != null, `No layout data found for index ${i}`);
3229
- const a = Ve({
3230
- panelConstraints: e,
3231
- panelIndex: i,
3232
- size: o
3233
- });
3234
- o != a && (s += o - a, n[i] = a);
3235
- }
3236
- if (!ne(s, 0))
3237
- for (let i = 0; i < e.length; i++) {
3238
- const o = n[i];
3239
- N(o != null, `No layout data found for index ${i}`);
3240
- const a = o + s, l = Ve({
3241
- panelConstraints: e,
3242
- panelIndex: i,
3243
- size: a
3244
- });
3245
- if (o !== l && (s -= l - o, n[i] = l, ne(s, 0)))
3246
- break;
3247
- }
3248
- return n;
3249
- }
3250
- const _a = 100, pt = {
3251
- getItem: (t) => ($n(pt), pt.getItem(t)),
3252
- setItem: (t, e) => {
3253
- $n(pt), pt.setItem(t, e);
3254
- }
3255
- }, Hn = {};
3256
- function fs({
3257
- autoSaveId: t = null,
3258
- children: e,
3259
- className: n = "",
3260
- direction: r,
3261
- forwardedRef: s,
3262
- id: i = null,
3263
- onLayout: o = null,
3264
- keyboardResizeBy: a = null,
3265
- storage: l = pt,
3266
- style: d,
3267
- tagName: h = "div",
3268
- ...f
3269
- }) {
3270
- const u = mn(i), v = te(null), [b, g] = ve(null), [C, x] = ve([]), I = Pa(), z = te({}), y = te(/* @__PURE__ */ new Map()), F = te(0), O = te({
3271
- autoSaveId: t,
3272
- direction: r,
3273
- dragState: b,
3274
- id: u,
3275
- keyboardResizeBy: a,
3276
- onLayout: o,
3277
- storage: l
3278
- }), D = te({
3279
- layout: C,
3280
- panelDataArray: [],
3281
- panelDataArrayChanged: !1
3282
- });
3283
- te({
3284
- didLogIdAndOrderWarning: !1,
3285
- didLogPanelConstraintsWarning: !1,
3286
- prevPanelIds: []
3287
- }), er(s, () => ({
3288
- getId: () => O.current.id,
3289
- getLayout: () => {
3290
- const {
3291
- layout: m
3292
- } = D.current;
3293
- return m;
3294
- },
3295
- setLayout: (m) => {
3296
- const {
3297
- onLayout: E
3298
- } = O.current, {
3299
- layout: M,
3300
- panelDataArray: A
3301
- } = D.current, S = qn({
3302
- layout: m,
3303
- panelConstraints: A.map((R) => R.constraints)
3304
- });
3305
- Ln(M, S) || (x(S), D.current.layout = S, E && E(S), Be(A, S, z.current));
3306
- }
3307
- }), []), Qe(() => {
3308
- O.current.autoSaveId = t, O.current.direction = r, O.current.dragState = b, O.current.id = u, O.current.onLayout = o, O.current.storage = l;
3309
- }), za({
3310
- committedValuesRef: O,
3311
- eagerValuesRef: D,
3312
- groupId: u,
3313
- layout: C,
3314
- panelDataArray: D.current.panelDataArray,
3315
- setLayout: x,
3316
- panelGroupElement: v.current
3317
- }), He(() => {
3318
- const {
3319
- panelDataArray: m
3320
- } = D.current;
3321
- if (t) {
3322
- if (C.length === 0 || C.length !== m.length)
3323
- return;
3324
- let E = Hn[t];
3325
- E == null && (E = Oa(Ta, _a), Hn[t] = E);
3326
- const M = [...m], A = new Map(y.current);
3327
- E(t, M, A, C, l);
3328
- }
3329
- }, [t, C, l]), He(() => {
3330
- });
3331
- const B = ee((m) => {
3332
- const {
3333
- onLayout: E
3334
- } = O.current, {
3335
- layout: M,
3336
- panelDataArray: A
3337
- } = D.current;
3338
- if (m.constraints.collapsible) {
3339
- const S = A.map((fe) => fe.constraints), {
3340
- collapsedSize: R = 0,
3341
- panelSize: _,
3342
- pivotIndices: j
3343
- } = Ie(A, m, M);
3344
- if (N(_ != null, `Panel size not found for panel "${m.id}"`), !we(_, R)) {
3345
- y.current.set(m.id, _);
3346
- const he = Ue(A, m) === A.length - 1 ? _ - R : R - _, $ = ht({
3347
- delta: he,
3348
- initialLayout: M,
3349
- panelConstraints: S,
3350
- pivotIndices: j,
3351
- prevLayout: M,
3352
- trigger: "imperative-api"
3353
- });
3354
- Rt(M, $) || (x($), D.current.layout = $, E && E($), Be(A, $, z.current));
3355
- }
3356
- }
3357
- }, []), W = ee((m, E) => {
3358
- const {
3359
- onLayout: M
3360
- } = O.current, {
3361
- layout: A,
3362
- panelDataArray: S
3363
- } = D.current;
3364
- if (m.constraints.collapsible) {
3365
- const R = S.map((ie) => ie.constraints), {
3366
- collapsedSize: _ = 0,
3367
- panelSize: j = 0,
3368
- minSize: fe = 0,
3369
- pivotIndices: he
3370
- } = Ie(S, m, A), $ = E ?? fe;
3371
- if (we(j, _)) {
3372
- const ie = y.current.get(m.id), dt = ie != null && ie >= $ ? ie : $, Kt = Ue(S, m) === S.length - 1 ? j - dt : dt - j, Z = ht({
3373
- delta: Kt,
3374
- initialLayout: A,
3375
- panelConstraints: R,
3376
- pivotIndices: he,
3377
- prevLayout: A,
3378
- trigger: "imperative-api"
3379
- });
3380
- Rt(A, Z) || (x(Z), D.current.layout = Z, M && M(Z), Be(S, Z, z.current));
3381
- }
3382
- }
3383
- }, []), T = ee((m) => {
3384
- const {
3385
- layout: E,
3386
- panelDataArray: M
3387
- } = D.current, {
3388
- panelSize: A
3389
- } = Ie(M, m, E);
3390
- return N(A != null, `Panel size not found for panel "${m.id}"`), A;
3391
- }, []), L = ee((m, E) => {
3392
- const {
3393
- panelDataArray: M
3394
- } = D.current, A = Ue(M, m);
3395
- return Ma({
3396
- defaultSize: E,
3397
- dragState: b,
3398
- layout: C,
3399
- panelData: M,
3400
- panelIndex: A
3401
- });
3402
- }, [b, C]), Q = ee((m) => {
3403
- const {
3404
- layout: E,
3405
- panelDataArray: M
3406
- } = D.current, {
3407
- collapsedSize: A = 0,
3408
- collapsible: S,
3409
- panelSize: R
3410
- } = Ie(M, m, E);
3411
- return N(R != null, `Panel size not found for panel "${m.id}"`), S === !0 && we(R, A);
3412
- }, []), Ne = ee((m) => {
3413
- const {
3414
- layout: E,
3415
- panelDataArray: M
3416
- } = D.current, {
3417
- collapsedSize: A = 0,
3418
- collapsible: S,
3419
- panelSize: R
3420
- } = Ie(M, m, E);
3421
- return N(R != null, `Panel size not found for panel "${m.id}"`), !S || Ge(R, A) > 0;
3422
- }, []), U = ee((m) => {
3423
- const {
3424
- panelDataArray: E
3425
- } = D.current;
3426
- E.push(m), E.sort((M, A) => {
3427
- const S = M.order, R = A.order;
3428
- return S == null && R == null ? 0 : S == null ? -1 : R == null ? 1 : S - R;
3429
- }), D.current.panelDataArrayChanged = !0, I();
3430
- }, [I]);
3431
- Qe(() => {
3432
- if (D.current.panelDataArrayChanged) {
3433
- D.current.panelDataArrayChanged = !1;
3434
- const {
3435
- autoSaveId: m,
3436
- onLayout: E,
3437
- storage: M
3438
- } = O.current, {
3439
- layout: A,
3440
- panelDataArray: S
3441
- } = D.current;
3442
- let R = null;
3443
- if (m) {
3444
- const j = ka(m, S, M);
3445
- j && (y.current = new Map(Object.entries(j.expandToSizes)), R = j.layout);
3446
- }
3447
- R == null && (R = Ia({
3448
- panelDataArray: S
3449
- }));
3450
- const _ = qn({
3451
- layout: R,
3452
- panelConstraints: S.map((j) => j.constraints)
3453
- });
3454
- Ln(A, _) || (x(_), D.current.layout = _, E && E(_), Be(S, _, z.current));
3455
- }
3456
- }), Qe(() => {
3457
- const m = D.current;
3458
- return () => {
3459
- m.layout = [];
3460
- };
3461
- }, []);
3462
- const G = ee((m) => {
3463
- let E = !1;
3464
- const M = v.current;
3465
- return M && window.getComputedStyle(M, null).getPropertyValue("direction") === "rtl" && (E = !0), function(S) {
3466
- S.preventDefault();
3467
- const R = v.current;
3468
- if (!R)
3469
- return () => null;
3470
- const {
3471
- direction: _,
3472
- dragState: j,
3473
- id: fe,
3474
- keyboardResizeBy: he,
3475
- onLayout: $
3476
- } = O.current, {
3477
- layout: ie,
3478
- panelDataArray: dt
3479
- } = D.current, {
3480
- initialLayout: Dt
3481
- } = j ?? {}, Kt = as(fe, m, R);
3482
- let Z = Na(S, m, _, j, he, R);
3483
- const xn = _ === "horizontal";
3484
- xn && E && (Z = -Z);
3485
- const ys = dt.map((gs) => gs.constraints), ft = ht({
3486
- delta: Z,
3487
- initialLayout: Dt ?? ie,
3488
- panelConstraints: ys,
3489
- pivotIndices: Kt,
3490
- prevLayout: ie,
3491
- trigger: Xr(S) ? "keyboard" : "mouse-or-touch"
3492
- }), wn = !Rt(ie, ft);
3493
- (Jr(S) || Yr(S)) && F.current != Z && (F.current = Z, !wn && Z !== 0 ? xn ? Jt(m, Z < 0 ? es : ts) : Jt(m, Z < 0 ? ns : rs) : Jt(m, 0)), wn && (x(ft), D.current.layout = ft, $ && $(ft), Be(dt, ft, z.current));
3494
- };
3495
- }, []), X = ee((m, E) => {
3496
- const {
3497
- onLayout: M
3498
- } = O.current, {
3499
- layout: A,
3500
- panelDataArray: S
3501
- } = D.current, R = S.map((ie) => ie.constraints), {
3502
- panelSize: _,
3503
- pivotIndices: j
3504
- } = Ie(S, m, A);
3505
- N(_ != null, `Panel size not found for panel "${m.id}"`);
3506
- const he = Ue(S, m) === S.length - 1 ? _ - E : E - _, $ = ht({
3507
- delta: he,
3508
- initialLayout: A,
3509
- panelConstraints: R,
3510
- pivotIndices: j,
3511
- prevLayout: A,
3512
- trigger: "imperative-api"
3513
- });
3514
- Rt(A, $) || (x($), D.current.layout = $, M && M($), Be(S, $, z.current));
3515
- }, []), ot = ee((m, E) => {
3516
- const {
3517
- layout: M,
3518
- panelDataArray: A
3519
- } = D.current, {
3520
- collapsedSize: S = 0,
3521
- collapsible: R
3522
- } = E, {
3523
- collapsedSize: _ = 0,
3524
- collapsible: j,
3525
- maxSize: fe = 100,
3526
- minSize: he = 0
3527
- } = m.constraints, {
3528
- panelSize: $
3529
- } = Ie(A, m, M);
3530
- $ != null && (R && j && we($, S) ? we(S, _) || X(m, _) : $ < he ? X(m, he) : $ > fe && X(m, fe));
3531
- }, [X]), lt = ee((m, E) => {
3532
- const {
3533
- direction: M
3534
- } = O.current, {
3535
- layout: A
3536
- } = D.current;
3537
- if (!v.current)
3538
- return;
3539
- const S = jt(m, v.current);
3540
- N(S, `Drag handle element not found for id "${m}"`);
3541
- const R = ls(M, E);
3542
- g({
3543
- dragHandleId: m,
3544
- dragHandleRect: S.getBoundingClientRect(),
3545
- initialCursorPosition: R,
3546
- initialLayout: A
3547
- });
3548
- }, []), ct = ee(() => {
3549
- g(null);
3550
- }, []), Gt = ee((m) => {
3551
- const {
3552
- panelDataArray: E
3553
- } = D.current, M = Ue(E, m);
3554
- M >= 0 && (E.splice(M, 1), delete z.current[m.id], D.current.panelDataArrayChanged = !0, I());
3555
- }, [I]), Ke = St(() => ({
3556
- collapsePanel: B,
3557
- direction: r,
3558
- dragState: b,
3559
- expandPanel: W,
3560
- getPanelSize: T,
3561
- getPanelStyle: L,
3562
- groupId: u,
3563
- isPanelCollapsed: Q,
3564
- isPanelExpanded: Ne,
3565
- reevaluatePanelConstraints: ot,
3566
- registerPanel: U,
3567
- registerResizeHandle: G,
3568
- resizePanel: X,
3569
- startDragging: lt,
3570
- stopDragging: ct,
3571
- unregisterPanel: Gt,
3572
- panelGroupElement: v.current
3573
- }), [B, b, r, W, T, L, u, Q, Ne, ot, U, G, X, lt, ct, Gt]), ut = {
3574
- display: "flex",
3575
- flexDirection: r === "horizontal" ? "row" : "column",
3576
- height: "100%",
3577
- overflow: "hidden",
3578
- width: "100%"
3579
- };
3580
- return at(qt.Provider, {
3581
- value: Ke
3582
- }, at(h, {
3583
- ...f,
3584
- children: e,
3585
- className: n,
3586
- id: i,
3587
- ref: v,
3588
- style: {
3589
- ...ut,
3590
- ...d
3591
- },
3592
- // CSS selectors
3593
- [H.group]: "",
3594
- [H.groupDirection]: r,
3595
- [H.groupId]: u
3596
- }));
3597
- }
3598
- const hs = Zn((t, e) => at(fs, {
3599
- ...t,
3600
- forwardedRef: e
3601
- }));
3602
- fs.displayName = "PanelGroup";
3603
- hs.displayName = "forwardRef(PanelGroup)";
3604
- function Ue(t, e) {
3605
- return t.findIndex((n) => n === e || n.id === e.id);
3606
- }
3607
- function Ie(t, e, n) {
3608
- const r = Ue(t, e), i = r === t.length - 1 ? [r - 1, r] : [r, r + 1], o = n[r];
3609
- return {
3610
- ...e.constraints,
3611
- panelSize: o,
3612
- pivotIndices: i
3613
- };
3614
- }
3615
- function Fa({
3616
- disabled: t,
3617
- handleId: e,
3618
- resizeHandler: n,
3619
- panelGroupElement: r
3620
- }) {
3621
- He(() => {
3622
- if (t || n == null || r == null)
3623
- return;
3624
- const s = jt(e, r);
3625
- if (s == null)
3626
- return;
3627
- const i = (o) => {
3628
- if (!o.defaultPrevented)
3629
- switch (o.key) {
3630
- case "ArrowDown":
3631
- case "ArrowLeft":
3632
- case "ArrowRight":
3633
- case "ArrowUp":
3634
- case "End":
3635
- case "Home": {
3636
- o.preventDefault(), n(o);
3637
- break;
3638
- }
3639
- case "F6": {
3640
- o.preventDefault();
3641
- const a = s.getAttribute(H.groupId);
3642
- N(a, `No group element found for id "${a}"`);
3643
- const l = vt(a, r), d = is(a, e, r);
3644
- N(d !== null, `No resize element found for id "${e}"`);
3645
- const h = o.shiftKey ? d > 0 ? d - 1 : l.length - 1 : d + 1 < l.length ? d + 1 : 0;
3646
- l[h].focus();
3647
- break;
3648
- }
3649
- }
3650
- };
3651
- return s.addEventListener("keydown", i), () => {
3652
- s.removeEventListener("keydown", i);
3653
- };
3654
- }, [r, t, e, n]);
3655
- }
3656
- function ps({
3657
- children: t = null,
3658
- className: e = "",
3659
- disabled: n = !1,
3660
- hitAreaMargins: r,
3661
- id: s,
3662
- onBlur: i,
3663
- onClick: o,
3664
- onDragging: a,
3665
- onFocus: l,
3666
- onPointerDown: d,
3667
- onPointerUp: h,
3668
- style: f = {},
3669
- tabIndex: u = 0,
3670
- tagName: v = "div",
3671
- ...b
3672
- }) {
3673
- var g, C;
3674
- const x = te(null), I = te({
3675
- onClick: o,
3676
- onDragging: a,
3677
- onPointerDown: d,
3678
- onPointerUp: h
3679
- });
3680
- He(() => {
3681
- I.current.onClick = o, I.current.onDragging = a, I.current.onPointerDown = d, I.current.onPointerUp = h;
3682
- });
3683
- const z = ln(qt);
3684
- if (z === null)
3685
- throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");
3686
- const {
3687
- direction: y,
3688
- groupId: F,
3689
- registerResizeHandle: O,
3690
- startDragging: D,
3691
- stopDragging: B,
3692
- panelGroupElement: W
3693
- } = z, T = mn(s), [L, Q] = ve("inactive"), [Ne, U] = ve(!1), [G, X] = ve(null), ot = te({
3694
- state: L
3695
- });
3696
- Qe(() => {
3697
- ot.current.state = L;
3698
- }), He(() => {
3699
- if (n)
3700
- X(null);
3701
- else {
3702
- const Ke = O(T);
3703
- X(() => Ke);
3704
- }
3705
- }, [n, T, O]);
3706
- const lt = (g = r == null ? void 0 : r.coarse) !== null && g !== void 0 ? g : 15, ct = (C = r == null ? void 0 : r.fine) !== null && C !== void 0 ? C : 5;
3707
- return He(() => {
3708
- if (n || G == null)
3709
- return;
3710
- const Ke = x.current;
3711
- N(Ke, "Element ref not attached");
3712
- let ut = !1;
3713
- return Sa(T, Ke, y, {
3714
- coarse: lt,
3715
- fine: ct
3716
- }, (E, M, A) => {
3717
- if (!M) {
3718
- Q("inactive");
3719
- return;
3720
- }
3721
- switch (E) {
3722
- case "down": {
3723
- Q("drag"), ut = !1, N(A, 'Expected event to be defined for "down" action'), D(T, A);
3724
- const {
3725
- onDragging: S,
3726
- onPointerDown: R
3727
- } = I.current;
3728
- S == null || S(!0), R == null || R();
3729
- break;
3730
- }
3731
- case "move": {
3732
- const {
3733
- state: S
3734
- } = ot.current;
3735
- ut = !0, S !== "drag" && Q("hover"), N(A, 'Expected event to be defined for "move" action'), G(A);
3736
- break;
3737
- }
3738
- case "up": {
3739
- Q("hover"), B();
3740
- const {
3741
- onClick: S,
3742
- onDragging: R,
3743
- onPointerUp: _
3744
- } = I.current;
3745
- R == null || R(!1), _ == null || _(), ut || S == null || S();
3746
- break;
3747
- }
3748
- }
3749
- });
3750
- }, [lt, y, n, ct, O, T, G, D, B]), Fa({
3751
- disabled: n,
3752
- handleId: T,
3753
- resizeHandler: G,
3754
- panelGroupElement: W
3755
- }), at(v, {
3756
- ...b,
3757
- children: t,
3758
- className: e,
3759
- id: s,
3760
- onBlur: () => {
3761
- U(!1), i == null || i();
3762
- },
3763
- onFocus: () => {
3764
- U(!0), l == null || l();
3765
- },
3766
- ref: x,
3767
- role: "separator",
3768
- style: {
3769
- ...{
3770
- touchAction: "none",
3771
- userSelect: "none"
3772
- },
3773
- ...f
3774
- },
3775
- tabIndex: u,
3776
- // CSS selectors
3777
- [H.groupDirection]: y,
3778
- [H.groupId]: F,
3779
- [H.resizeHandle]: "",
3780
- [H.resizeHandleActive]: L === "drag" ? "pointer" : Ne ? "keyboard" : void 0,
3781
- [H.resizeHandleEnabled]: !n,
3782
- [H.resizeHandleId]: T,
3783
- [H.resizeHandleState]: L
3784
- });
3785
- }
3786
- ps.displayName = "PanelResizeHandle";
3787
- const wo = ({
3788
- className: t,
3789
- ...e
3790
- }) => /* @__PURE__ */ p(
3791
- hs,
3792
- {
3793
- className: se(
3794
- "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
3795
- t
3796
- ),
3797
- ...e
3798
- }
3799
- ), So = Wr, Co = ({
3800
- withHandle: t,
3801
- className: e,
3802
- ...n
3803
- }) => /* @__PURE__ */ p(
3804
- ps,
3805
- {
3806
- className: se(
3807
- "relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
3808
- e
3809
- ),
3810
- ...n,
3811
- children: t && /* @__PURE__ */ p("div", { className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border", children: /* @__PURE__ */ p(bi, { className: "h-2.5 w-2.5" }) })
3812
- }
3813
- );
3814
- function La({
3815
- code: t,
3816
- language: e,
3817
- wrapLongLines: n = !1,
3818
- className: r,
3819
- ariaLabel: s
3820
- }) {
3821
- const i = St(() => Ms(t, e), [t, e]);
3822
- return (
3823
- // `.code-editor` scopes the token colors — see code-editor.css.
3824
- /* @__PURE__ */ p("div", { className: se("code-editor", r), children: /* @__PURE__ */ p(
3825
- "pre",
3826
- {
3827
- "aria-label": s,
3828
- className: se(
3829
- // Matches CodeEditor exactly (text-[12px] leading-[1.55]) so code
3830
- // reads at one size whether it's in an editor or the assistant.
3831
- "w-full min-w-0 max-w-full bg-transparent px-3 py-2.5 font-mono text-[12px] leading-[1.55] [font-variant-numeric:tabular-nums]",
3832
- n ? "overflow-x-hidden whitespace-pre-wrap break-words" : "overflow-x-auto whitespace-pre"
3833
- ),
3834
- children: i === null ? (
3835
- // `.code-editor` sets a muted base colour that tokens normally lift
3836
- // to foreground. With no tokens at all, every character would stay
3837
- // muted — so an unsupported language would render as one faint grey
3838
- // block. Pin it to foreground instead.
3839
- /* @__PURE__ */ p("code", { className: "text-foreground", children: t })
3840
- ) : (
3841
- // Prism output, not user HTML: the input is escaped by Prism before
3842
- // any tokens are wrapped.
3843
- /* @__PURE__ */ p("code", { dangerouslySetInnerHTML: { __html: i } })
3844
- )
3845
- }
3846
- ) })
3847
- );
3848
- }
3849
- const Qn = "h-6 px-2 text-[11px]", $a = {
3850
- "c++": "cpp",
3851
- "c#": "csharp"
3852
- }, qa = /^(?:select|with|insert|update|delete|create|alter|drop|truncate|explain|show|describe|desc|call|merge|grant|revoke)\b/i, Ha = /^(?:import|from|def|class|async|await|with|for|while|if|try|print|return|yield|raise|assert|del|@)\b/, Qa = /^[A-Za-z_][\w.[\]'"]*\s*(?:\/\/|\*\*|>>|<<|[-+*/@|&^%])?=(?!=)/;
3853
- function ja(t, e) {
3854
- const n = t.trim();
3855
- return n ? e.includes("sql") ? qa.test(n) : e.includes("python") ? n.includes(`
3856
- `) ? !0 : Ha.test(n) || Qa.test(n) : !1 : !1;
3857
- }
3858
- function Ga(t, e) {
3859
- if (e) return !0;
3860
- const n = t.trim();
3861
- return n.includes(`
3862
- `) || n.length > 60;
3863
- }
3864
- function Po({ children: t, handleRun: e }) {
3865
- var g;
3866
- const [n, r] = ve(!1), s = (g = t == null ? void 0 : t.props) == null ? void 0 : g.className, i = typeof s == "string" ? s.split(/\s+/).find((C) => C.startsWith("language-")) : "", o = i ? i.slice(9).trim().toLowerCase() : "", a = $a[o] ?? o, l = a === "" ? "sql" : a, d = (o || l).toUpperCase(), h = on(t), f = ja(h, l), u = !!e && f, v = Ga(h, f), b = () => {
3867
- navigator.clipboard.writeText(h).then(() => {
3868
- r(!0), setTimeout(() => r(!1), 2e3);
3869
- });
3870
- };
3871
- return v ? /* @__PURE__ */ qe("div", { className: "my-4 w-full min-w-0 max-w-full overflow-hidden rounded-md border border-border/70 bg-card/90 shadow-sm", children: [
3872
- /* @__PURE__ */ qe("div", { className: "flex min-h-9 items-center justify-between gap-3 border-b border-border/60 bg-muted/30 px-3 py-1.5", children: [
3873
- /* @__PURE__ */ p("span", { className: "font-mono text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: d }),
3874
- /* @__PURE__ */ qe("div", { className: "flex shrink-0 items-center gap-1.5", children: [
3875
- /* @__PURE__ */ p(
3876
- Pn,
3877
- {
3878
- type: "button",
3879
- variant: "outline",
3880
- size: "xs",
3881
- "aria-label": n ? "Copied code" : "Copy code",
3882
- className: Qn,
3883
- onClick: b,
3884
- children: n ? "Copied" : "Copy"
3885
- }
3886
- ),
3887
- u && /* @__PURE__ */ p(
3888
- Pn,
3889
- {
3890
- type: "button",
3891
- variant: "outline",
3892
- size: "xs",
3893
- "aria-label": `Run ${l} code`,
3894
- className: Qn,
3895
- onClick: () => e == null ? void 0 : e(h, l),
3896
- children: "Run"
3897
- }
3898
- )
3899
- ] })
3900
- ] }),
3901
- /* @__PURE__ */ p(jn, { code: h, language: l })
3902
- ] }) : /* @__PURE__ */ p("div", { className: "my-2 w-full min-w-0 max-w-full overflow-hidden rounded-control border border-border/60 bg-muted/20", children: /* @__PURE__ */ p(jn, { code: h, language: l }) });
3903
- }
3904
- function on(t) {
3905
- if (typeof t == "string")
3906
- return t;
3907
- if (Array.isArray(t))
3908
- return t.map(on).join("");
3909
- if (bs.isValidElement(t)) {
3910
- const e = t.props;
3911
- return on(e.children);
3912
- }
3913
- return "";
3914
- }
3915
- const jn = ({
3916
- code: t,
3917
- language: e = "sql",
3918
- wrapLongLines: n = !1
3919
- }) => /* @__PURE__ */ p(La, { code: t, language: e, wrapLongLines: n });
3920
- export {
3921
- Er as $,
3922
- bo as A,
3923
- ae as B,
3924
- uo as C,
3925
- fo as D,
3926
- Lt as E,
3927
- ho as F,
3928
- bi as G,
3929
- Hs as H,
3930
- Qs as I,
3931
- Zt as J,
3932
- sr as K,
3933
- ni as L,
3934
- Bs as M,
3935
- Y as N,
3936
- Mn as O,
3937
- po as P,
3938
- so as Q,
3939
- yo as R,
3940
- oo as S,
3941
- ro as T,
3942
- yt as U,
3943
- si as V,
3944
- tn as W,
3945
- no as X,
3946
- $i as Y,
3947
- Li as Z,
3948
- qi as _,
3949
- ui as a,
3950
- Hi as a0,
3951
- Qi as a1,
3952
- _i as a2,
3953
- Fi as a3,
3954
- to as a4,
3955
- ao as a5,
3956
- On as a6,
3957
- fi as a7,
3958
- di as a8,
3959
- Ot as a9,
3960
- li as aa,
3961
- Po as ab,
3962
- vi as b,
3963
- wo as c,
3964
- So as d,
3965
- xo as e,
3966
- vo as f,
3967
- sa as g,
3968
- ia as h,
3969
- oa as i,
3970
- la as j,
3971
- aa as k,
3972
- ua as l,
3973
- ca as m,
3974
- go as n,
3975
- Co as o,
3976
- mo as p,
3977
- co as q,
3978
- jn as r,
3979
- lo as s,
3980
- ps as t,
3981
- io as u,
3982
- Ft as v,
3983
- Xs as w,
3984
- js as x,
3985
- eo as y,
3986
- en as z
3987
- };