@overvis/hmi-workspace-ui 0.1.0 → 0.1.1

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 (115) hide show
  1. package/dist/alarm-list-sheAq-pb.js +414 -0
  2. package/dist/alarm-rule-dialog-D_ml7V0v.js +417 -0
  3. package/dist/{alarm-rule-lists-C5v1Kf7A.js → alarm-rule-lists-DaA4soF4.js} +123 -125
  4. package/dist/{alarm-rules-page-CqFzofPd.js → alarm-rules-page-OFjOQ-dm.js} +15 -18
  5. package/dist/alert-dialog-B60PF7S9.js +891 -0
  6. package/dist/{base-revision-YCO27zR4.js → base-revision-DYCOZS0R.js} +26 -29
  7. package/dist/{breadcrumbs-0cjsV2cq.js → breadcrumbs-D2u8KZQo.js} +6 -7
  8. package/dist/{catalog-list-DjZojYLJ.js → catalog-list-LXuRix0-.js} +2 -4
  9. package/dist/{code-editor-BVimvjDV.js → code-editor-BMSyzAxu.js} +5 -6
  10. package/dist/dashboard-bindings.js +1 -2
  11. package/dist/{dashboards-page-BlrJguNz.js → dashboards-page-wnmmLpVC.js} +335 -359
  12. package/dist/{de-14WdmJxZ.js → de-hkEr2usK.js} +1 -2
  13. package/dist/diagnostic-text-CsbENUNI.js +116 -0
  14. package/dist/{dialogs-B6BRnf3Q.js → dialogs-AtIYlNSy.js} +219 -227
  15. package/dist/{dialogs-D_v1LeH4.js → dialogs-DsHbKgZD.js} +2523 -2590
  16. package/dist/{display-DmOo23mi.js → display-DSyEwQt8.js} +4 -6
  17. package/dist/{editor-language-To9MxloY.js → editor-language-CTfJBXMs.js} +3 -5
  18. package/dist/editor-page-BWbVGJvU.js +1337 -0
  19. package/dist/{en-BgercpT0.js → en-UW_k-Bd6.js} +1 -2
  20. package/dist/entity-controls-BCuRx882.js +71 -0
  21. package/dist/errors-Cawve9yD.js +25 -0
  22. package/dist/{footer-DC-Q0052.js → footer-B9XdpVzq.js} +2404 -2515
  23. package/dist/host.js +8143 -675
  24. package/dist/{i18n-BgzakKoC.js → i18n-Dt6xbSK6.js} +77 -90
  25. package/dist/i18n.js +1 -2
  26. package/dist/index.js +5149 -5345
  27. package/dist/{lat-lng-B12P7QyY.js → lat-lng-Bl77AGSO.js} +1 -2
  28. package/dist/{list-page-CvsdZb86.js → list-page-agHupfNb.js} +116 -123
  29. package/dist/{location-map-renderer-DO5yfdSU.js → location-map-renderer-kxU6cgFl.js} +6 -6
  30. package/dist/{location-picker-renderer-CjCxg6ai.js → location-picker-renderer-B1_-n8lf.js} +3 -4
  31. package/dist/{model-B8gGi4OK.js → model-tpg_xpFB.js} +1 -2
  32. package/dist/{notice-card-DyGywFsW.js → notice-card-CH28rYUt.js} +54 -58
  33. package/dist/{page-v6LCwswN.js → page-CZPHJUmz.js} +92 -100
  34. package/dist/page-DpdkOGGb.js +449 -0
  35. package/dist/page-HCGXXGjy.js +507 -0
  36. package/dist/panel-BCwBlB_h.js +949 -0
  37. package/dist/parameter-values.js +3 -16
  38. package/dist/{pl-lQ9HXV9k.js → pl-BokvsP3J.js} +1 -2
  39. package/dist/presence-code-cT6wxlTg.js +73 -0
  40. package/dist/{query-gate-DVhNIkge.js → query-gate-DqmHsZ07.js} +6 -6
  41. package/dist/{provider-DoEpKcQ-.js → quick-report-DEqqwQxR.js} +9423 -5102
  42. package/dist/{retention-BYXNpYmR.js → retention-DZ0reGGe.js} +4 -6
  43. package/dist/retention-note-nequESpo.js +40 -0
  44. package/dist/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
  45. package/dist/{ru-qTKINoUj.js → ru-DZSlsRHq.js} +1 -2
  46. package/dist/run-text-DneX9rWh.js +112 -0
  47. package/dist/{search-D4rDnE9T.js → search-DP9_alSQ.js} +26 -29
  48. package/dist/{sections-kCOyc4NR.js → sections-BU7NKUOQ.js} +2 -3
  49. package/dist/{select-BKiOWdSr.js → select-Te6Qv1Zu.js} +17 -23
  50. package/dist/{spinner-C-HPNxOc.js → spinner-BRcNKwjH.js} +182 -201
  51. package/dist/src/version.d.ts +1 -1
  52. package/dist/src/workspace/local-workspace-app.d.ts +1 -1
  53. package/dist/src/workspace/routes.d.ts +1 -1
  54. package/dist/{starter-fields-BRLX0z-v.js → starter-fields-yM4B49nd.js} +154 -157
  55. package/dist/{starter-handoff-BA3ucMKL.js → starter-handoff-BaK8Ss8I.js} +1 -2
  56. package/dist/styles.css +1 -1
  57. package/dist/ui.js +334 -374
  58. package/dist/{uk-CwpJAxmx.js → uk-CjXPq9Lk.js} +1 -2
  59. package/dist/{wireguard-docs-AfU6NzTL.js → wireguard-docs-CC8XKBR7.js} +14 -17
  60. package/package.json +15 -9
  61. package/dist/alarm-list-BL3xQ5Lf.js +0 -423
  62. package/dist/alarm-rule-dialog-S1ZUg-74.js +0 -423
  63. package/dist/alert-B8MAoIO8.js +0 -45
  64. package/dist/alert-dialog-CYkuMg5D.js +0 -129
  65. package/dist/api-error-9rQmUN5L.js +0 -93
  66. package/dist/breadcrumb-DzVL1yHa.js +0 -74
  67. package/dist/button-6SxPBYMz.js +0 -44
  68. package/dist/context-u9KJQmdB.js +0 -102
  69. package/dist/copyable-id-DYGiAcnq.js +0 -40
  70. package/dist/dashboard-context-CBfG6DoT.js +0 -191
  71. package/dist/date-time-picker-C3FhMXk6.js +0 -266
  72. package/dist/diagnostic-text-BAkzW0SE.js +0 -111
  73. package/dist/diagnostic-text-DiKd2i1w.js +0 -76
  74. package/dist/dialog-BIhQXcZC.js +0 -237
  75. package/dist/dialog-BqyIxMD-.js +0 -54
  76. package/dist/dropdown-menu-DSzbBq3v.js +0 -136
  77. package/dist/editor-page-BiSZJz5b.js +0 -1353
  78. package/dist/empty-B-QJ-06w.js +0 -59
  79. package/dist/entity-controls-D1K4Ot3O.js +0 -76
  80. package/dist/errors-CcsvDHu8.js +0 -26
  81. package/dist/history-page-sAAhG54V.js +0 -1400
  82. package/dist/icon-D-pR9htW.js +0 -57
  83. package/dist/index-page-DMH82fZe.js +0 -214
  84. package/dist/item-B5SaTFQU.js +0 -120
  85. package/dist/mutation-form-validators-BNz5bsv1.js +0 -2408
  86. package/dist/mutations-THtGG6Ai.js +0 -240
  87. package/dist/page-2KPemaAj.js +0 -328
  88. package/dist/page-6rIoTg2L.js +0 -459
  89. package/dist/page-C6giEoEd.js +0 -1935
  90. package/dist/page-DCbTxKsi.js +0 -313
  91. package/dist/page-DWO427hT.js +0 -208
  92. package/dist/page-LXu_2zm3.js +0 -137
  93. package/dist/page-aaUiVOnk.js +0 -513
  94. package/dist/page-header-RB2YFWlE.js +0 -55
  95. package/dist/page-title-CdCbiLt8.js +0 -14
  96. package/dist/panel-DDy8tUNR.js +0 -338
  97. package/dist/presence-code-BfSXr50g.js +0 -83
  98. package/dist/progress-C7cxNJA1.js +0 -83
  99. package/dist/provider-BOeYHi0n.js +0 -134
  100. package/dist/quick-report-CUVJnbKP.js +0 -416
  101. package/dist/radio-group-CZGqVbkJ.js +0 -26
  102. package/dist/retention-note-CHhA6gjY.js +0 -42
  103. package/dist/run-text-DvaO8LDF.js +0 -113
  104. package/dist/select-eNgZdZ30.js +0 -521
  105. package/dist/skeleton-6yk8Tdh5.js +0 -19
  106. package/dist/slider-DorDsoF8.js +0 -37
  107. package/dist/status-page-DAHiKM9P.js +0 -3286
  108. package/dist/switch-BqD0RH_G.js +0 -18
  109. package/dist/table-Q2-voLuw.js +0 -65
  110. package/dist/tabs-CSIucYFP.js +0 -57
  111. package/dist/theme-provider-BkRohQFU.js +0 -61
  112. package/dist/toggle-group-9Bs0Mm3r.js +0 -82
  113. package/dist/trpc-CvJUuUXp.js +0 -153
  114. package/dist/utils-CX-Pz5p6.js +0 -8
  115. package/dist/writability-BuH-spxv.js +0 -57
@@ -1,74 +0,0 @@
1
- import { m as e } from "./i18n-BgzakKoC.js";
2
- import { t } from "./utils-CX-Pz5p6.js";
3
- import "react";
4
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
- import { ChevronRightIcon as i, MoreHorizontalIcon as a } from "lucide-react";
6
- import { mergeProps as o } from "@base-ui/react/merge-props";
7
- import { useRender as s } from "@base-ui/react/use-render";
8
- //#region src/ui/breadcrumb.tsx
9
- function c({ className: r, ...i }) {
10
- return /* @__PURE__ */ n("nav", {
11
- "aria-label": e()("ui_breadcrumb"),
12
- "data-slot": "breadcrumb",
13
- className: t(r),
14
- ...i
15
- });
16
- }
17
- function l({ className: e, ...r }) {
18
- return /* @__PURE__ */ n("ol", {
19
- "data-slot": "breadcrumb-list",
20
- className: t("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground", e),
21
- ...r
22
- });
23
- }
24
- function u({ className: e, ...r }) {
25
- return /* @__PURE__ */ n("li", {
26
- "data-slot": "breadcrumb-item",
27
- className: t("inline-flex items-center gap-1", e),
28
- ...r
29
- });
30
- }
31
- function d({ className: e, render: n, ...r }) {
32
- return s({
33
- defaultTagName: "a",
34
- props: o({ className: t("\n transition-colors\n hover:text-foreground\n ", e) }, r),
35
- render: n,
36
- state: { slot: "breadcrumb-link" }
37
- });
38
- }
39
- function f({ className: e, ...r }) {
40
- return /* @__PURE__ */ n("span", {
41
- "data-slot": "breadcrumb-page",
42
- role: "link",
43
- "aria-disabled": "true",
44
- "aria-current": "page",
45
- className: t("font-normal text-foreground", e),
46
- ...r
47
- });
48
- }
49
- function p({ children: e, className: r, ...a }) {
50
- return /* @__PURE__ */ n("li", {
51
- "data-slot": "breadcrumb-separator",
52
- role: "presentation",
53
- "aria-hidden": "true",
54
- className: t("[&>svg]:size-3.5", r),
55
- ...a,
56
- children: e ?? /* @__PURE__ */ n(i, {})
57
- });
58
- }
59
- function m({ className: i, ...o }) {
60
- let s = e();
61
- return /* @__PURE__ */ r("span", {
62
- "data-slot": "breadcrumb-ellipsis",
63
- role: "presentation",
64
- "aria-hidden": "true",
65
- className: t("\n flex size-5 items-center justify-center\n [&>svg]:size-4\n ", i),
66
- ...o,
67
- children: [/* @__PURE__ */ n(a, {}), /* @__PURE__ */ n("span", {
68
- className: "sr-only",
69
- children: s("ui_more")
70
- })]
71
- });
72
- }
73
- //#endregion
74
- export { l as a, d as i, m as n, f as o, u as r, p as s, c as t };
@@ -1,44 +0,0 @@
1
- import { t as e } from "./utils-CX-Pz5p6.js";
2
- import { jsx as t } from "react/jsx-runtime";
3
- import { cva as n } from "class-variance-authority";
4
- import { Button as r } from "@base-ui/react/button";
5
- //#region src/ui/button.tsx
6
- var i = n("\n group/button inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg border\n border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all\n outline-none select-none\n focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\n active:not-aria-[haspopup]:translate-y-px\n disabled:cursor-not-allowed disabled:opacity-50\n aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20\n dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\n [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4\n ", {
7
- variants: {
8
- variant: {
9
- default: "\n bg-primary text-primary-foreground shadow-xs\n hover:bg-primary/90\n ",
10
- outline: "\n border-input bg-background text-foreground shadow-xs\n hover:bg-muted hover:text-foreground\n aria-expanded:bg-muted aria-expanded:text-foreground\n ",
11
- secondary: "\n bg-secondary text-secondary-foreground\n hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]\n aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\n ",
12
- ghost: "\n hover:bg-muted hover:text-foreground\n aria-expanded:bg-muted aria-expanded:text-foreground\n dark:hover:bg-muted/50\n ",
13
- destructive: "\n bg-destructive/10 text-destructive\n hover:bg-destructive/20\n focus-visible:border-destructive/40 focus-visible:ring-destructive/20\n dark:bg-destructive/20\n dark:hover:bg-destructive/30\n dark:focus-visible:ring-destructive/40\n ",
14
- link: "\n text-primary underline-offset-4\n hover:underline\n "
15
- },
16
- size: {
17
- default: "\n h-8 gap-1.5 px-2.5\n has-data-[icon=inline-end]:pr-2\n has-data-[icon=inline-start]:pl-2\n ",
18
- xs: "\n h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs\n in-data-[slot=button-group]:rounded-lg\n has-data-[icon=inline-end]:pr-1.5\n has-data-[icon=inline-start]:pl-1.5\n [&_svg:not([class*='size-'])]:size-3\n ",
19
- sm: "\n h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem]\n in-data-[slot=button-group]:rounded-lg\n has-data-[icon=inline-end]:pr-1.5\n has-data-[icon=inline-start]:pl-1.5\n [&_svg:not([class*='size-'])]:size-3.5\n ",
20
- lg: "\n h-9 gap-1.5 px-2.5\n has-data-[icon=inline-end]:pr-2\n has-data-[icon=inline-start]:pl-2\n ",
21
- icon: "size-8",
22
- "icon-xs": "\n size-6 rounded-[min(var(--radius-md),10px)]\n in-data-[slot=button-group]:rounded-lg\n [&_svg:not([class*='size-'])]:size-3\n ",
23
- "icon-sm": "\n size-7 rounded-[min(var(--radius-md),12px)]\n in-data-[slot=button-group]:rounded-lg\n ",
24
- "icon-lg": "size-9"
25
- }
26
- },
27
- defaultVariants: {
28
- variant: "default",
29
- size: "default"
30
- }
31
- });
32
- function a({ className: n, variant: a = "default", size: o = "default", ...s }) {
33
- return /* @__PURE__ */ t(r, {
34
- "data-slot": "button",
35
- className: e(i({
36
- variant: a,
37
- size: o,
38
- className: n
39
- })),
40
- ...s
41
- });
42
- }
43
- //#endregion
44
- export { i as n, a as t };
@@ -1,102 +0,0 @@
1
- import { i as e } from "./i18n-BgzakKoC.js";
2
- import { createContext as t, useContext as n, useEffect as r, useState as i } from "react";
3
- import { dashboardEntrypointUrl as a } from "@overvis/hmi-shared/dashboard";
4
- import { jsx as o } from "react/jsx-runtime";
5
- import { canWriteSetup as s } from "@overvis/hmi-shared/workspace";
6
- //#region src/workspace/page-state/context.tsx
7
- var c = t(null);
8
- function l() {
9
- return Promise.resolve(null);
10
- }
11
- function u({ store: e, children: t }) {
12
- return /* @__PURE__ */ o(c.Provider, {
13
- value: e,
14
- children: t
15
- });
16
- }
17
- function d(e, t) {
18
- let i = n(c);
19
- r(() => i?.publish(e, t), [
20
- t,
21
- e,
22
- i
23
- ]);
24
- }
25
- function f() {
26
- return n(c)?.read ?? l;
27
- }
28
- //#endregion
29
- //#region src/workspace/page-state/store.ts
30
- function p() {
31
- let e = /* @__PURE__ */ new Map(), t = ([t, n]) => e.size === 1 && e.get(t) === n;
32
- return {
33
- publish: (t, n) => (e.set(t, n), () => {
34
- e.get(t) === n && e.delete(t);
35
- }),
36
- read: async () => {
37
- let [n] = e;
38
- if (n == null || !t(n)) return null;
39
- let r = await n[1]();
40
- return t(n) ? r : null;
41
- }
42
- };
43
- }
44
- //#endregion
45
- //#region src/workspace/context.tsx
46
- var m = t({
47
- mode: "cloud",
48
- getDashboardEntrypointUrl: a,
49
- apiBaseUrl: "",
50
- credentials: "include"
51
- }), h = t(null);
52
- function g() {
53
- return n(m);
54
- }
55
- function _() {
56
- return n(h);
57
- }
58
- function v() {
59
- let e = _();
60
- if (e == null) throw Error("useWorkspace requires WorkspaceLayout");
61
- return e;
62
- }
63
- function y() {
64
- let e = _();
65
- return e != null && s(e.access);
66
- }
67
- function b({ workspace: t, children: n }) {
68
- return /* @__PURE__ */ o(h.Provider, {
69
- value: t,
70
- children: /* @__PURE__ */ o(e, {
71
- scope: {
72
- workspaceId: t.id,
73
- workspaceName: t.name
74
- },
75
- children: n
76
- })
77
- });
78
- }
79
- function x({ children: e, mode: t = "cloud", userId: n, onWorkspaceLoaded: r, openAssistant: s, getDashboardEntrypointUrl: c = a, apiBaseUrl: l = "", credentials: d = "include", getHeaders: f, mintDeviceUiTicket: h, renderNavFooter: g, renderSuspendedBilling: _ }) {
80
- let [v] = i(p);
81
- return /* @__PURE__ */ o(m.Provider, {
82
- value: {
83
- mode: t,
84
- getDashboardEntrypointUrl: c,
85
- apiBaseUrl: l,
86
- credentials: d,
87
- ...n == null ? {} : { userId: n },
88
- ...r ? { onWorkspaceLoaded: r } : {},
89
- ...s ? { openAssistant: s } : {},
90
- ...f ? { getHeaders: f } : {},
91
- ...h ? { mintDeviceUiTicket: h } : {},
92
- ...g ? { renderNavFooter: g } : {},
93
- ..._ ? { renderSuspendedBilling: _ } : {}
94
- },
95
- children: /* @__PURE__ */ o(u, {
96
- store: v,
97
- children: e
98
- })
99
- });
100
- }
101
- //#endregion
102
- export { v as a, f as c, _ as i, b as n, g as o, y as r, d as s, x as t };
@@ -1,40 +0,0 @@
1
- import { m as e, n as t } from "./i18n-BgzakKoC.js";
2
- import { useEffect as n, useRef as r, useState as i } from "react";
3
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
- import { CheckIcon as s, CopyIcon as c } from "lucide-react";
5
- //#region src/workspace/copyable-id.tsx
6
- function l({ id: l }) {
7
- let u = e(), d = t(), [f, p] = i(!1), m = r(null);
8
- n(() => () => {
9
- m.current != null && clearTimeout(m.current);
10
- }, []);
11
- async function h() {
12
- try {
13
- await navigator.clipboard.writeText(l), p(!0), m.current != null && clearTimeout(m.current), m.current = setTimeout(() => {
14
- p(!1), m.current = null;
15
- }, 2e3);
16
- } catch {
17
- d.error(u("copyable_id_copy_failed"));
18
- }
19
- }
20
- return /* @__PURE__ */ o("div", {
21
- className: "flex h-2.5 w-fit max-w-full items-center gap-0.5 self-start",
22
- children: [/* @__PURE__ */ a("span", {
23
- className: "cursor-text font-mono text-[10px] leading-none text-muted-foreground select-all",
24
- children: l
25
- }), /* @__PURE__ */ a("button", {
26
- type: "button",
27
- className: "\n inline-flex size-2.5 shrink-0 items-center justify-center text-muted-foreground\n hover:text-foreground\n focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none\n ",
28
- "aria-label": u(f ? "copyable_id_copied" : "copyable_id_copy"),
29
- onClick: () => {
30
- h();
31
- },
32
- children: a(f ? s : c, {
33
- className: "size-2",
34
- strokeWidth: 1.75
35
- })
36
- })]
37
- });
38
- }
39
- //#endregion
40
- export { l as t };
@@ -1,191 +0,0 @@
1
- import { s as e } from "./context-u9KJQmdB.js";
2
- import { createContext as t, useCallback as n, useContext as r, useEffect as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
3
- import { dashboardHref as l, dashboardLocationSchema as u } from "@overvis/hmi-shared/dashboard";
4
- import { jsx as d } from "react/jsx-runtime";
5
- import { useRouter as f, useRouterState as p } from "@tanstack/react-router";
6
- //#region src/workspace/page-navigation.ts
7
- var m = /* @__PURE__ */ new WeakSet();
8
- function h(e) {
9
- return { overvisKeepScrollFrom: e };
10
- }
11
- function g(e, t) {
12
- if (e == null) return !1;
13
- let [n, r] = t.state.__TSR_index >= e.state.__TSR_index ? [e, t] : [t, e];
14
- return r.state.overvisKeepScrollFrom === n.pathname;
15
- }
16
- function _(e) {
17
- return m.add(e), e;
18
- }
19
- function v(e) {
20
- return e.status === "pending" && e.location.pathname !== e.resolvedLocation?.pathname;
21
- }
22
- function y(e, t) {
23
- if (e.status !== "pending") return e.matches.find((e) => t(e.routeId))?.id ?? e.resolvedLocation?.pathname;
24
- }
25
- function b(e) {
26
- let t = f(), n = p({ select: (e) => y(e, (e) => {
27
- let n = t.looseRoutesById[e];
28
- return n != null && m.has(n);
29
- }) }), r = p({ select: (e) => e.resolvedLocation?.hash ?? "" }), i = p({ select: (e) => e.resolvedLocation }), o = s({
30
- page: n,
31
- entry: i
32
- });
33
- a(() => {
34
- if (n === void 0) return;
35
- let t = o.current;
36
- o.current = {
37
- page: n,
38
- entry: i
39
- }, !(n === t.page || r !== "") && (i != null && g(t.entry, i) || e.current?.scrollTo({ top: 0 }));
40
- }, [
41
- e,
42
- n,
43
- r,
44
- i
45
- ]);
46
- }
47
- //#endregion
48
- //#region src/workspace/dashboards/navigation.tsx
49
- var x = t(null);
50
- function S({ workspaceId: e, dashboardId: t, children: n }) {
51
- return /* @__PURE__ */ d(x, {
52
- value: {
53
- workspaceId: e,
54
- dashboardId: t
55
- },
56
- children: n
57
- });
58
- }
59
- function C(e, t) {
60
- let n = e.indexOf("#"), r = n === -1 ? e : e.slice(0, n), i = r.indexOf("?"), a = i === -1 ? r : r.slice(0, i);
61
- if (a !== t && !a.startsWith(`${t}/`)) return null;
62
- let o = {
63
- path: a.slice(t.length) || "/",
64
- search: i === -1 ? "" : r.slice(i),
65
- hash: n === -1 ? "" : e.slice(n + 1)
66
- };
67
- return u["~standard"].validate(o).issues == null ? o : null;
68
- }
69
- function w() {
70
- let e = r(x), t = f(), n = p({ select: (e) => e.location.publicHref }), [i, a] = c(n);
71
- if (e === null) throw Error("useDashboardNavigation requires a mounted dashboard");
72
- let { workspaceId: s, dashboardId: u } = e, d = l({
73
- workspaceId: s,
74
- dashboardId: u
75
- }), m = C(n, d);
76
- m !== null && n !== i && a(n);
77
- let { path: g, search: _, hash: v } = m ?? C(i, d) ?? {
78
- path: "/",
79
- search: "",
80
- hash: ""
81
- }, y = o(() => {
82
- let e = l({
83
- workspaceId: s,
84
- dashboardId: u
85
- }), n = (e) => l({
86
- workspaceId: s,
87
- dashboardId: u,
88
- ...e
89
- });
90
- return {
91
- href: n,
92
- navigate: (r, i) => {
93
- let a = n(r), o = t.state.location, s = (C(o.publicHref, e)?.path === C(a, e)?.path ? o.state.overvisKeepScrollFrom : void 0) ?? (i?.keepScroll === !0 ? o.pathname : void 0);
94
- return t.navigate({
95
- href: a,
96
- replace: i?.replace ?? !1,
97
- resetScroll: s === void 0,
98
- ...s === void 0 ? {} : { state: h(s) }
99
- });
100
- }
101
- };
102
- }, [
103
- t,
104
- s,
105
- u
106
- ]);
107
- return o(() => ({
108
- location: {
109
- path: g,
110
- search: _,
111
- hash: v
112
- },
113
- ...y
114
- }), [
115
- g,
116
- _,
117
- v,
118
- y
119
- ]);
120
- }
121
- function T(e) {
122
- return /* @__PURE__ */ d(E, {
123
- ...e,
124
- navigation: w()
125
- });
126
- }
127
- function E({ navigation: e, to: t, replace: n = !1, keepScroll: r = !1, onClick: i, ...a }) {
128
- return /* @__PURE__ */ d("a", {
129
- ...a,
130
- href: e.href(t),
131
- onClick: (o) => {
132
- i?.(o), !(o.defaultPrevented || o.button !== 0 || o.metaKey || o.ctrlKey || o.altKey || o.shiftKey || a.download != null || a.target != null && a.target !== "_self") && (o.preventDefault(), e.navigate(t, {
133
- replace: n,
134
- keepScroll: r
135
- }));
136
- }
137
- });
138
- }
139
- //#endregion
140
- //#region src/workspace/page-state/dashboard-context.tsx
141
- function D() {
142
- let e = /* @__PURE__ */ new Set(), t = (t) => e.size === 1 && e.has(t);
143
- return {
144
- publish: (t) => (e.add(t), () => {
145
- e.delete(t);
146
- }),
147
- read: async () => {
148
- let [n] = e;
149
- if (n == null || !t(n)) return null;
150
- let r = await n();
151
- return t(n) ? r : null;
152
- }
153
- };
154
- }
155
- var O = t(null);
156
- function k(e, t, n) {
157
- let r = t.dashboardId === e.dashboardId && t.path === e.path;
158
- return {
159
- kind: "dashboard",
160
- ...t,
161
- summary: r ? n : null
162
- };
163
- }
164
- function A({ dashboardId: t, title: r, children: i }) {
165
- let [o] = c(D), { path: l } = w().location, u = s({
166
- dashboardId: t,
167
- title: r,
168
- path: l
169
- });
170
- return a(() => {
171
- u.current = {
172
- dashboardId: t,
173
- title: r,
174
- path: l
175
- };
176
- }), e("dashboard", n(async () => {
177
- let e = u.current, t = await o.read();
178
- return k(e, u.current, t);
179
- }, [o])), /* @__PURE__ */ d(O, {
180
- value: o,
181
- children: i
182
- });
183
- }
184
- function j(e) {
185
- let t = r(O), n = s(e);
186
- a(() => {
187
- n.current = e;
188
- }), i(() => t?.publish(() => n.current()), [t]);
189
- }
190
- //#endregion
191
- export { S as a, v as c, E as i, b as l, j as n, w as o, T as r, _ as s, A as t };