@draftably/runtime 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/viewer.js CHANGED
@@ -1,177 +1,177 @@
1
- import { i as Ne, F as Ie } from "./geometry-DfUVE8b2.js";
2
- import { f as vt } from "./geometry-DfUVE8b2.js";
3
- import { r as Et } from "./version-CKs2Vl8m.js";
4
- const $e = 0.02, ze = 8, Ze = 32, ye = (o, t = $e, a = ze) => Math.min(Math.max(o, Math.max($e, t)), Math.min(ze, a));
5
- function Oe(o = {}) {
6
- const t = o.padding ?? Ze;
1
+ import { i as Ne, F as Oe } from "./geometry-DfUVE8b2.js";
2
+ import { f as kt } from "./geometry-DfUVE8b2.js";
3
+ import { r as St } from "./version-CO7i33cq.js";
4
+ const $e = 0.02, ze = 8, He = 32, ye = (n, t = $e, i = ze) => Math.min(Math.max(n, Math.max($e, t)), Math.min(ze, i));
5
+ function Re(n = {}) {
6
+ const t = n.padding ?? He;
7
7
  return typeof t == "number" ? { top: t, right: t, bottom: t, left: t } : t;
8
8
  }
9
- function Ge(o) {
10
- if (!o.length) return;
11
- const t = Math.min(...o.map((d) => d.x)), a = Math.min(...o.map((d) => d.y)), r = Math.max(...o.map((d) => d.x + d.width)), c = Math.max(...o.map((d) => d.y + d.height));
12
- return { x: t, y: a, width: r - t, height: c - a };
9
+ function Ge(n) {
10
+ if (!n.length) return;
11
+ const t = Math.min(...n.map((d) => d.x)), i = Math.min(...n.map((d) => d.y)), r = Math.max(...n.map((d) => d.x + d.width)), c = Math.max(...n.map((d) => d.y + d.height));
12
+ return { x: t, y: i, width: r - t, height: c - i };
13
13
  }
14
- function Re(o, t, a = {}) {
15
- const r = Oe(a), c = Math.max(1, t.width - r.left - r.right), d = Math.max(1, t.height - r.top - r.bottom), g = ye(
16
- Math.min(c / Math.max(1, o.width), d / Math.max(1, o.height)),
17
- a.minZoom,
18
- a.maxZoom ?? 1
14
+ function Ie(n, t, i = {}) {
15
+ const r = Re(i), c = Math.max(1, t.width - r.left - r.right), d = Math.max(1, t.height - r.top - r.bottom), m = ye(
16
+ Math.min(c / Math.max(1, n.width), d / Math.max(1, n.height)),
17
+ i.minZoom,
18
+ i.maxZoom ?? 1
19
19
  );
20
20
  return {
21
- centerX: o.x + o.width / 2 - (r.left - r.right) / 2 / g,
22
- centerY: o.y + o.height / 2 - (r.top - r.bottom) / 2 / g,
23
- zoom: g
21
+ centerX: n.x + n.width / 2 - (r.left - r.right) / 2 / m,
22
+ centerY: n.y + n.height / 2 - (r.top - r.bottom) / 2 / m,
23
+ zoom: m
24
24
  };
25
25
  }
26
- function He(o, t, a, r = {}) {
27
- const c = Oe(r), d = { width: a.width - c.left - c.right, height: a.height - c.top - c.bottom };
28
- let { centerX: g, centerY: i, zoom: f } = o;
26
+ function Ue(n, t, i, r = {}) {
27
+ const c = Re(r), d = { width: i.width - c.left - c.right, height: i.height - c.top - c.bottom };
28
+ let { centerX: m, centerY: s, zoom: f } = n;
29
29
  if (t.width * f > d.width || t.height * f > d.height)
30
- return Re(t, a, { ...r, maxZoom: f });
30
+ return Ie(t, i, { ...r, maxZoom: f });
31
31
  f = ye(f, r.minZoom, r.maxZoom);
32
- const p = (t.x - g) * f + a.width / 2, m = (t.y - i) * f + a.height / 2;
33
- return p < c.left ? g -= (c.left - p) / f : p + t.width * f > a.width - c.right && (g += (p + t.width * f - (a.width - c.right)) / f), m < c.top ? i -= (c.top - m) / f : m + t.height * f > a.height - c.bottom && (i += (m + t.height * f - (a.height - c.bottom)) / f), { centerX: g, centerY: i, zoom: f };
32
+ const g = (t.x - m) * f + i.width / 2, x = (t.y - s) * f + i.height / 2;
33
+ return g < c.left ? m -= (c.left - g) / f : g + t.width * f > i.width - c.right && (m += (g + t.width * f - (i.width - c.right)) / f), x < c.top ? s -= (c.top - x) / f : x + t.height * f > i.height - c.bottom && (s += (x + t.height * f - (i.height - c.bottom)) / f), { centerX: m, centerY: s, zoom: f };
34
34
  }
35
- const Ue = (o, t) => Math.abs(o.centerX - t.centerX) < 0.01 && Math.abs(o.centerY - t.centerY) < 0.01 && Math.abs(o.zoom - t.zoom) < 1e-6, Ke = 0.4, Je = (o, t) => o.nodes[t] ? "node" : o.groups[t] ? "group" : o.edges[t] ? "edge" : void 0, Te = (o, t, a) => ({
36
- code: o,
35
+ const Ke = (n, t) => Math.abs(n.centerX - t.centerX) < 0.01 && Math.abs(n.centerY - t.centerY) < 0.01 && Math.abs(n.zoom - t.zoom) < 1e-6, Je = 0.4, Qe = (n, t) => n.nodes[t] ? "node" : n.groups[t] ? "group" : n.edges[t] ? "edge" : void 0, Te = (n, t, i) => ({
36
+ code: n,
37
37
  severity: "warning",
38
38
  message: t,
39
- itemIds: [a]
39
+ itemIds: [i]
40
40
  });
41
- function Qe(o, t = {}) {
42
- const a = o.createElement("div"), r = o.createElement("div"), c = o.createElement("div");
43
- a.className = "draft-anchors", r.className = "draft-anchors__bodies", c.className = "draft-anchors__overlays", a.append(r, c), a.dataset.draftDetail = "full";
41
+ function et(n, t = {}) {
42
+ const i = n.createElement("div"), r = n.createElement("div"), c = n.createElement("div");
43
+ i.className = "draft-anchors", r.className = "draft-anchors__bodies", c.className = "draft-anchors__overlays", i.append(r, c), i.dataset.draftDetail = "full";
44
44
  const d = /* @__PURE__ */ new Map();
45
- let g = [], i = null, f = !1, p = [], m = 1;
46
- const N = /* @__PURE__ */ new Set(), b = o.defaultView, M = () => {
45
+ let m = [], s = null, f = !1, g = [], x = 1;
46
+ const p = /* @__PURE__ */ new Set(), b = n.defaultView, P = () => {
47
47
  let l = !1;
48
- for (const [w, h] of d) {
49
- if (!h.body) continue;
50
- const $ = (Z.get(h) ?? []).some(
51
- (D) => D.offsetWidth > h.box.width + 0.5 || D.offsetHeight > h.box.height + 0.5
48
+ for (const [h, w] of d) {
49
+ if (!w.body) continue;
50
+ const M = (E.get(w) ?? []).some(
51
+ (_) => _.offsetWidth > w.box.width + 0.5 || _.offsetHeight > w.box.height + 0.5
52
52
  );
53
- $ !== N.has(w) && (l = !0, $ ? N.add(w) : N.delete(w));
53
+ M !== p.has(h) && (l = !0, M ? p.add(h) : p.delete(h));
54
54
  }
55
55
  l && t.onOverflow?.();
56
- }, x = b?.ResizeObserver ? new b.ResizeObserver(M) : void 0, Z = /* @__PURE__ */ new Map(), k = (l) => {
57
- if (!x || !l.body) return;
58
- for (const h of Z.get(l) ?? []) x.unobserve(h);
59
- const w = U(l.el);
60
- Z.set(l, w);
61
- for (const h of w) x.observe(h);
62
- }, X = (l) => {
63
- for (const w of Z.get(l) ?? []) x?.unobserve(w);
64
- Z.delete(l);
56
+ }, L = b?.ResizeObserver ? new b.ResizeObserver(P) : void 0, E = /* @__PURE__ */ new Map(), re = (l) => {
57
+ if (!L || !l.body) return;
58
+ for (const w of E.get(l) ?? []) L.unobserve(w);
59
+ const h = U(l.el);
60
+ E.set(l, h);
61
+ for (const w of h) L.observe(w);
62
+ }, k = (l) => {
63
+ for (const h of E.get(l) ?? []) L?.unobserve(h);
64
+ E.delete(l);
65
65
  }, Y = (l) => {
66
- const w = l.closest?.("[data-draft-anchor]")?.getAttribute("data-draft-anchor");
67
- return w ? d.get(w) : void 0;
66
+ const h = l.closest?.("[data-draft-anchor]")?.getAttribute("data-draft-anchor");
67
+ return h ? d.get(h) : void 0;
68
68
  };
69
- a.addEventListener("slotchange", (l) => {
70
- const w = Y(l.target);
71
- w && k(w);
69
+ i.addEventListener("slotchange", (l) => {
70
+ const h = Y(l.target);
71
+ h && re(h);
72
72
  });
73
- const Q = b?.MutationObserver ? new b.MutationObserver((l) => {
74
- const w = /* @__PURE__ */ new Set();
75
- for (const h of l) {
76
- const $ = h.target.dataset?.draftAnchor ? Y(h.target) : void 0;
77
- $ && !w.has($) && (w.add($), k($));
73
+ const W = b?.MutationObserver ? new b.MutationObserver((l) => {
74
+ const h = /* @__PURE__ */ new Set();
75
+ for (const w of l) {
76
+ const M = w.target.dataset?.draftAnchor ? Y(w.target) : void 0;
77
+ M && !h.has(M) && (h.add(M), re(M));
78
78
  }
79
79
  }) : void 0;
80
- Q?.observe(r, { childList: !0, subtree: !0 });
80
+ W?.observe(r, { childList: !0, subtree: !0 });
81
81
  let G = !1;
82
- const j = () => G = !0, H = () => G = !1;
83
- a.addEventListener("pointerdown", j, !0), o.addEventListener("pointerup", H, !0), o.addEventListener("pointercancel", H, !0);
82
+ const J = () => G = !0, F = () => G = !1;
83
+ i.addEventListener("pointerdown", J, !0), n.addEventListener("pointerup", F, !0), n.addEventListener("pointercancel", F, !0);
84
84
  function U(l) {
85
- const w = l.firstElementChild;
86
- return w instanceof HTMLSlotElement ? w.assignedElements().filter((h) => h instanceof HTMLElement) : [...l.children].filter((h) => h instanceof HTMLElement);
85
+ const h = l.firstElementChild;
86
+ return h instanceof HTMLSlotElement ? h.assignedElements().filter((w) => w instanceof HTMLElement) : [...l.children].filter((w) => w instanceof HTMLElement);
87
87
  }
88
- function ae() {
89
- let l = o.activeElement;
88
+ function ne() {
89
+ let l = n.activeElement;
90
90
  for (; l?.shadowRoot?.activeElement; ) l = l.shadowRoot.activeElement;
91
91
  return l;
92
92
  }
93
- function ee() {
94
- let l = !1, w = !1;
95
- const h = /* @__PURE__ */ new Set();
96
- p = [];
97
- let $;
98
- const D = (E) => {
99
- $ ??= new Map(
100
- [i.nodes, i.groups, i.edges].flatMap(Object.keys).map((z, W) => [z, W])
93
+ function se() {
94
+ let l = !1, h = !1;
95
+ const w = /* @__PURE__ */ new Set();
96
+ g = [];
97
+ let M;
98
+ const _ = (S) => {
99
+ M ??= new Map(
100
+ [s.nodes, s.groups, s.edges].flatMap(Object.keys).map((R, N) => [R, N])
101
101
  );
102
- const C = E.dataset.draftAnchor;
103
- return $.get(C.slice(C.indexOf(":") + 1)) ?? 1 / 0;
102
+ const z = S.dataset.draftAnchor;
103
+ return M.get(z.slice(z.indexOf(":") + 1)) ?? 1 / 0;
104
104
  };
105
- for (const E of g) {
106
- const C = E.indexOf(":"), z = E.slice(0, C), W = E.slice(C + 1), F = i ? Je(i, W) : void 0;
107
- if (!i || !F || z === "body" && F !== "node" || h.has(E)) {
108
- f && !h.has(E) && p.push(E);
105
+ for (const S of m) {
106
+ const z = S.indexOf(":"), R = S.slice(0, z), N = S.slice(z + 1), B = s ? Qe(s, N) : void 0;
107
+ if (!s || !B || R !== "body" && R !== "overlay" || R === "body" && B !== "node" || w.has(S)) {
108
+ f && !w.has(S) && g.push(S);
109
109
  continue;
110
110
  }
111
- h.add(E);
112
- const I = Ne(i, W);
113
- let S = d.get(E);
114
- if (!S || S.kind !== F) {
115
- S && (S.el.remove(), X(S));
116
- const T = o.createElement("div");
117
- T.className = `draft-anchor draft-anchor--${z}`, T.dataset.draftAnchor = E, S = { el: T, id: W, kind: F, body: z === "body", box: I }, d.set(E, S);
118
- const K = S.body ? r : c, ne = K.children, ce = D(T);
119
- let B = 0, oe = ne.length;
120
- for (; B < oe; ) {
121
- const se = B + oe >> 1;
122
- D(ne[se]) > ce ? oe = se : B = se + 1;
111
+ w.add(S);
112
+ const D = Ne(s, N);
113
+ let $ = d.get(S);
114
+ if (!$ || $.kind !== B) {
115
+ $ && ($.el.remove(), k($));
116
+ const I = n.createElement("div");
117
+ I.className = `draft-anchor draft-anchor--${R}`, I.dataset.draftAnchor = S, $ = { el: I, id: N, kind: B, body: R === "body", box: D }, d.set(S, $);
118
+ const Q = $.body ? r : c, Z = Q.children, ue = _(I);
119
+ let ee = 0, H = Z.length;
120
+ for (; ee < H; ) {
121
+ const ie = ee + H >> 1;
122
+ _(Z[ie]) > ue ? H = ie : ee = ie + 1;
123
123
  }
124
- K.insertBefore(T, ne[B] ?? null), k(S), l = !0;
125
- } else S.body && (S.box.width !== I.width || S.box.height !== I.height) && (w = !0);
126
- if (S.box = I, S.body) {
127
- const T = S.el.style;
128
- T.left = `${I.x}px`, T.top = `${I.y}px`, T.width = `${I.width}px`, T.height = `${I.height}px`;
124
+ Q.insertBefore(I, Z[ee] ?? null), re($), l = !0;
125
+ } else $.body && ($.box.width !== D.width || $.box.height !== D.height) && (h = !0);
126
+ if ($.box = D, $.body) {
127
+ const I = $.el.style;
128
+ I.left = `${D.x}px`, I.top = `${D.y}px`, I.width = `${D.width}px`, I.height = `${D.height}px`;
129
129
  }
130
130
  }
131
- for (const [E, C] of d) {
132
- if (h.has(E)) continue;
133
- const z = ae(), W = !!z && (C.el.contains(z) || U(C.el).some((F) => F.contains(z)));
134
- C.el.remove(), X(C), d.delete(E), N.delete(E), l = !0, W && a.dispatchEvent(new CustomEvent("draft-anchor-focus-lost"));
131
+ for (const [S, z] of d) {
132
+ if (w.has(S)) continue;
133
+ const R = ne(), N = !!R && (z.el.contains(R) || U(z.el).some((B) => B.contains(R)));
134
+ z.el.remove(), k(z), d.delete(S), p.delete(S), l = !0, N && i.dispatchEvent(new CustomEvent("draft-anchor-focus-lost"));
135
135
  }
136
- return w && x && M(), l;
136
+ return h && L && P(), l;
137
137
  }
138
138
  return {
139
- el: a,
139
+ el: i,
140
140
  setSlots(l) {
141
- return g = [...new Set(l)], ee();
141
+ return m = [...new Set(l)], se();
142
142
  },
143
- hasSlots: () => g.length > 0,
143
+ hasSlots: () => m.length > 0,
144
144
  setGeometry(l) {
145
- return i = l, f = !0, ee();
145
+ return s = l, f = !0, se();
146
146
  },
147
- place(l, w, h) {
148
- if (!g.length) return;
149
- (h !== m || !a.style.getPropertyValue("--draft-zoom")) && a.style.setProperty("--draft-zoom", String(h)), m = h, r.style.transform = `translate(${l}px, ${w}px) scale(${h})`;
150
- for (const D of d.values()) {
151
- if (D.body) continue;
152
- const E = D.el.style;
153
- E.transform = `translate(${l + D.box.x * h}px, ${w + D.box.y * h}px)`, E.width = `${D.box.width * h}px`, E.height = `${D.box.height * h}px`;
147
+ place(l, h, w) {
148
+ if (!m.length) return;
149
+ (w !== x || !i.style.getPropertyValue("--draft-zoom")) && i.style.setProperty("--draft-zoom", String(w)), x = w, r.style.transform = `translate(${l}px, ${h}px) scale(${w})`;
150
+ for (const _ of d.values()) {
151
+ if (_.body) continue;
152
+ const S = _.el.style;
153
+ S.transform = `translate(${l + _.box.x * w}px, ${h + _.box.y * w}px)`, S.width = `${_.box.width * w}px`, S.height = `${_.box.height * w}px`;
154
154
  }
155
- const $ = t.detail !== "full" && h < Ke;
156
- a.dataset.draftDetail === "low" !== $ && (a.dataset.draftDetail = $ ? "low" : "full", r.inert = $);
155
+ const M = t.detail !== "full" && w < Je;
156
+ i.dataset.draftDetail === "low" !== M && (i.dataset.draftDetail = M ? "low" : "full", r.inert = M);
157
157
  },
158
- anchors: () => [...d].map(([l, w]) => ({
158
+ anchors: () => [...d].map(([l, h]) => ({
159
159
  slot: l,
160
- id: w.id,
161
- kind: w.kind,
162
- el: w.el
160
+ id: h.id,
161
+ kind: h.kind,
162
+ el: h.el
163
163
  })),
164
164
  // Every anchored body, at any zoom: CSS shows titles again below LOW_DETAIL_ZOOM.
165
165
  bodyIds: () => [...d.values()].filter((l) => l.body).map((l) => l.id),
166
166
  warnings: () => [
167
- ...p.map(
167
+ ...g.map(
168
168
  (l) => Te(
169
169
  "DRAFT_SLOT_UNKNOWN",
170
- i ? `Slot ${l} names no item that can hold it. A body fills a node; an overlay covers a node, group or edge.` : `Slot ${l} shows nothing: this drawing repeats items (compare or states), so slots are off.`,
170
+ /^(?:body|overlay):/.test(l) ? s ? `Slot ${l} names no item that can hold it. A body fills a node; an overlay covers a node, group or edge.` : `Slot ${l} shows nothing: this drawing repeats items (compare or states), so slots are off.` : `Slot ${l} shows nothing: a slot name starts with body: or overlay:, such as body:api.`,
171
171
  l.slice(l.indexOf(":") + 1)
172
172
  )
173
173
  ),
174
- ...[...N].map(
174
+ ...[...p].map(
175
175
  (l) => Te(
176
176
  "DRAFT_SLOT_OVERFLOW",
177
177
  `The content of ${l} is larger than its node. Declare the room with size … min-height=.`,
@@ -181,597 +181,618 @@ function Qe(o, t = {}) {
181
181
  ],
182
182
  pressed: () => G,
183
183
  idOf(l) {
184
- for (const w of d.values())
185
- if (w.el.contains(l) || U(w.el).some((h) => h.contains(l))) return w.id;
184
+ for (const h of d.values())
185
+ if (h.el.contains(l) || U(h.el).some((w) => w.contains(l))) return h.id;
186
186
  },
187
187
  destroy() {
188
- x?.disconnect(), Q?.disconnect(), o.removeEventListener("pointerup", H, !0), o.removeEventListener("pointercancel", H, !0), Z.clear(), d.clear(), a.remove();
188
+ L?.disconnect(), W?.disconnect(), n.removeEventListener("pointerup", F, !0), n.removeEventListener("pointercancel", F, !0), E.clear(), d.clear(), i.remove();
189
+ }
190
+ };
191
+ }
192
+ const tt = /\bdark\b/, rt = /\blight\b/;
193
+ function nt(n, t) {
194
+ const i = n.ownerDocument, r = i.defaultView, c = r?.matchMedia?.("(prefers-color-scheme: dark)"), d = i.createElement("span");
195
+ d.setAttribute("aria-hidden", "true"), d.setAttribute("data-draft-probe", ""), d.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;pointer-events:none;color:light-dark(rgb(0,0,0),rgb(255,255,255));transition:color 1ms !important", n.append(d);
196
+ let m;
197
+ const s = () => {
198
+ const p = r?.getComputedStyle(d).colorScheme ?? "", b = tt.test(p) && (!rt.test(p) || !!c?.matches);
199
+ b !== m && (m = b, t(b));
200
+ }, f = (p) => {
201
+ p.stopPropagation(), s();
202
+ };
203
+ d.addEventListener("transitionrun", f), c?.addEventListener?.("change", s);
204
+ const g = n.nodeType === 11 ? n.host : n, x = r && "ResizeObserver" in r ? new r.ResizeObserver(s) : void 0;
205
+ return x?.observe(g), s(), {
206
+ check: s,
207
+ stop() {
208
+ x?.disconnect(), c?.removeEventListener?.("change", s), d.removeEventListener("transitionrun", f), d.remove();
189
209
  }
190
210
  };
191
211
  }
192
212
  const De = Math.max(
193
213
  1,
194
214
  Math.min(4, (globalThis.navigator?.hardwareConcurrency || 2) - 1)
195
- ), et = 3e4, Fe = /* @__PURE__ */ new Map();
196
- let tt = 0;
197
- const _e = "The worker is the module next to @draftably/runtime's viewer. With Vite, add optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] } to vite.config.", rt = () => new Worker(new URL("./assets/render.worker-BXjS76Gy.js", import.meta.url), { type: "module" });
198
- function fe(o, t, a) {
199
- o.slots.splice(o.slots.indexOf(t), 1), clearTimeout(t.timer), clearTimeout(t.idle), t.worker.terminate();
215
+ ), ot = 3e4, Fe = /* @__PURE__ */ new Map();
216
+ let st = 0;
217
+ const _e = "The worker is the module next to @draftably/runtime's viewer. With Vite 5–7, add optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] } to vite.config.", it = () => new Worker(new URL("./assets/render.worker-D11vTqoO.js", import.meta.url), { type: "module" });
218
+ function le(n, t, i) {
219
+ n.slots.splice(n.slots.indexOf(t), 1), clearTimeout(t.timer), clearTimeout(t.idle), t.worker.terminate();
200
220
  const r = t.job;
201
- t.job = void 0, r && a && r.reject(a);
221
+ t.job = void 0, r && i && r.reject(i);
202
222
  }
203
- function nt(o, t) {
204
- let a;
223
+ function at(n, t) {
224
+ let i;
205
225
  try {
206
- a = (o ?? rt)();
226
+ i = (n ?? it)();
207
227
  } catch (c) {
208
228
  throw new Error(
209
229
  `Viewer render worker could not start${c instanceof Error ? `: ${c.message}` : ""}. ${_e}`,
210
230
  { cause: c }
211
231
  );
212
232
  }
213
- const r = { worker: a };
214
- return t.slots.push(r), a.addEventListener("message", (c) => {
233
+ const r = { worker: i };
234
+ return t.slots.push(r), i.addEventListener("message", (c) => {
215
235
  const d = r.job;
216
- !d || c.data?.id !== d.id || (clearTimeout(r.timer), r.job = void 0, d.resolve(c.data.result), r.idle = setTimeout(() => fe(t, r), et), ie(o, t));
217
- }), a.addEventListener("error", (c) => {
218
- c.preventDefault(), fe(
236
+ !d || c.data?.id !== d.id || (clearTimeout(r.timer), r.job = void 0, d.resolve(c.data.result), r.idle = setTimeout(() => le(t, r), ot), ae(n, t));
237
+ }), i.addEventListener("error", (c) => {
238
+ c.preventDefault(), le(
219
239
  t,
220
240
  r,
221
241
  new Error(`${c.message || "Viewer render worker failed."} ${_e}`)
222
- ), ie(o, t);
223
- }), a.addEventListener("messageerror", () => {
224
- fe(t, r, new Error("Viewer render worker returned an unreadable result.")), ie(o, t);
242
+ ), ae(n, t);
243
+ }), i.addEventListener("messageerror", () => {
244
+ le(t, r, new Error("Viewer render worker returned an unreadable result.")), ae(n, t);
225
245
  }), r;
226
246
  }
227
- function ie(o, t) {
247
+ function ae(n, t) {
228
248
  for (; t.queue.length; ) {
229
- const a = t.queue[0].options.idPrefix;
230
- let r = t.slots.find((g) => !g.job && g.last === a);
231
- if (!r && t.slots.length >= De && (r = t.slots.find((g) => !g.job)), !r && t.slots.length < De)
249
+ const i = t.queue[0].options.idPrefix;
250
+ let r = t.slots.find((m) => !m.job && m.last === i);
251
+ if (!r && t.slots.length >= De && (r = t.slots.find((m) => !m.job)), !r && t.slots.length < De)
232
252
  try {
233
- r = nt(o, t);
234
- } catch (g) {
235
- for (const i of t.queue.splice(0)) i.reject(g);
253
+ r = at(n, t);
254
+ } catch (m) {
255
+ for (const s of t.queue.splice(0)) s.reject(m);
236
256
  return;
237
257
  }
238
258
  if (!r) return;
239
259
  const c = t.queue.shift();
240
- clearTimeout(r.idle), r.job = c, r.last = a;
260
+ clearTimeout(r.idle), r.job = c, r.last = i;
241
261
  const d = r;
242
262
  r.timer = setTimeout(() => {
243
- fe(t, d, new Error("Viewer render worker timed out.")), ie(o, t);
263
+ le(t, d, new Error("Viewer render worker timed out.")), ae(n, t);
244
264
  }, c.timeoutMs), r.worker.postMessage({ id: c.id, source: c.source, options: c.options });
245
265
  }
246
266
  }
247
- function ot(o, t, {
248
- create: a,
267
+ function ct(n, t, {
268
+ create: i,
249
269
  timeoutMs: r = 5e3,
250
270
  signal: c
251
271
  }) {
252
- return new Promise((d, g) => {
253
- const i = Fe.get(a) ?? { slots: [], queue: [] };
254
- Fe.set(a, i);
272
+ return new Promise((d, m) => {
273
+ const s = Fe.get(i) ?? { slots: [], queue: [] };
274
+ Fe.set(i, s);
255
275
  let f = !1;
256
- const p = () => {
257
- f = !0, c?.removeEventListener("abort", N);
258
- }, m = {
259
- id: ++tt,
260
- source: o,
276
+ const g = () => {
277
+ f = !0, c?.removeEventListener("abort", p);
278
+ }, x = {
279
+ id: ++st,
280
+ source: n,
261
281
  options: t,
262
282
  timeoutMs: r,
263
- resolve: (b) => f || (p(), d(b)),
264
- reject: (b) => f || (p(), g(b))
265
- }, N = () => {
266
- const b = i.queue.indexOf(m);
267
- b >= 0 && i.queue.splice(b, 1), m.reject(new Error("Viewer render was aborted."));
283
+ resolve: (b) => f || (g(), d(b)),
284
+ reject: (b) => f || (g(), m(b))
285
+ }, p = () => {
286
+ const b = s.queue.indexOf(x);
287
+ b >= 0 && s.queue.splice(b, 1), x.reject(new Error("Viewer render was aborted."));
268
288
  };
269
- c?.addEventListener("abort", N, { once: !0 }), i.queue.push(m), ie(a, i);
289
+ c?.addEventListener("abort", p, { once: !0 }), s.queue.push(x), ae(i, s);
270
290
  });
271
291
  }
272
- const ue = /* @__PURE__ */ new WeakMap(), we = (o, t) => ue.get(o)?.get(t)?.face;
273
- function st(o, t, a) {
274
- const r = ue.get(o) ?? /* @__PURE__ */ new Map();
275
- ue.set(o, r);
292
+ const fe = /* @__PURE__ */ new WeakMap(), we = (n, t) => fe.get(n)?.get(t)?.face;
293
+ function dt(n, t, i) {
294
+ const r = fe.get(n) ?? /* @__PURE__ */ new Map();
295
+ fe.set(n, r);
276
296
  const c = r.get(t);
277
297
  if (c) return void c.refs++;
278
- o.fonts.add(a), r.set(t, { face: a, refs: 1 });
298
+ n.fonts.add(i), r.set(t, { face: i, refs: 1 });
279
299
  }
280
- function pe(o, t) {
281
- const a = ue.get(o), r = a?.get(t);
282
- !r || --r.refs > 0 || (o.fonts.delete(r.face), a.delete(t));
300
+ function pe(n, t) {
301
+ const i = fe.get(n), r = i?.get(t);
302
+ !r || --r.refs > 0 || (n.fonts.delete(r.face), i.delete(t));
283
303
  }
284
- const it = "http://www.w3.org/2000/svg", at = new Set(
304
+ const lt = "http://www.w3.org/2000/svg", ft = new Set(
285
305
  "svg title desc metadata defs style marker g a path rect ellipse circle line polyline polygon text tspan".split(
286
306
  " "
287
307
  )
288
- ), ct = new Set(
308
+ ), ut = new Set(
289
309
  "aria-labelledby role id data-id data-phase data-state data-theme xmlns viewBox width height x y x1 y1 x2 y2 cx cy r rx ry d points transform fill fill-rule fill-opacity stroke stroke-opacity stroke-width stroke-linecap stroke-linejoin stroke-dasharray opacity font-family font-size font-weight text-anchor dominant-baseline dy text-decoration marker-start marker-end markerWidth markerHeight markerUnits refX refY orient class clip-path nonce href target rel".split(
290
310
  " "
291
311
  )
292
312
  );
293
- let lt = 0;
294
- function dt(o, t) {
295
- return new o.defaultView.DOMParser().parseFromString(t, "image/svg+xml");
313
+ let mt = 0;
314
+ function ht(n, t) {
315
+ return new n.defaultView.DOMParser().parseFromString(t, "image/svg+xml");
296
316
  }
297
- function ft(o) {
317
+ function gt(n) {
298
318
  const t = /* @__PURE__ */ new Map();
299
- for (const a of Array.from(o.querySelectorAll("text[font-family]"))) {
300
- const r = (a.getAttribute("font-family") ?? "").split(",")[0].trim().replace(/^['"]|['"]$/g, ""), c = a.getAttribute("font-weight") ?? "400";
301
- if (!Object.values(Ie).some((d) => d.family === r && String(d.weight) === c))
319
+ for (const i of Array.from(n.querySelectorAll("text[font-family]"))) {
320
+ const r = (i.getAttribute("font-family") ?? "").split(",")[0].trim().replace(/^['"]|['"]$/g, ""), c = i.getAttribute("font-weight") ?? "400";
321
+ if (!Object.values(Oe).some((d) => d.family === r && String(d.weight) === c))
302
322
  throw new Error("Runtime SVG requested an unknown bundled font face.");
303
323
  t.set(`${r}:${c}`, { family: r, weight: c });
304
324
  }
305
325
  return [...t.values()];
306
326
  }
307
- function ut(o, t) {
308
- const a = /* @__PURE__ */ new Map();
309
- for (const r of Array.from(o.querySelectorAll("style"))) {
327
+ function wt(n, t) {
328
+ const i = /* @__PURE__ */ new Map();
329
+ for (const r of Array.from(n.querySelectorAll("style"))) {
310
330
  const c = r.textContent ?? "";
311
331
  for (const [, d] of c.matchAll(/@font-face\s*\{([^{}]{1,200000})\}/g)) {
312
- const g = /font-family\s*:\s*['"]([^'"]+)['"]/i.exec(d)?.[1], i = /font-weight\s*:\s*(\d{1,4})/i.exec(d)?.[1], f = /src\s*:\s*url\((data:font\/woff2;base64,[A-Za-z0-9+/=]+)\)/i.exec(d)?.[1];
313
- !g || !i || !f || Object.values(Ie).some((p) => p.family === g && String(p.weight) === i) && a.set(`${g}:${i}`, { family: g, weight: i, data: f });
332
+ const m = /font-family\s*:\s*['"]([^'"]+)['"]/i.exec(d)?.[1], s = /font-weight\s*:\s*(\d{1,4})/i.exec(d)?.[1], f = /src\s*:\s*url\((data:font\/woff2;base64,[A-Za-z0-9+/=]+)\)/i.exec(d)?.[1];
333
+ !m || !s || !f || Object.values(Oe).some((g) => g.family === m && String(g.weight) === s) && i.set(`${m}:${s}`, { family: m, weight: s, data: f });
314
334
  }
315
335
  }
316
336
  return t.map((r) => {
317
- const c = a.get(`${r.family}:${r.weight}`);
337
+ const c = i.get(`${r.family}:${r.weight}`);
318
338
  if (!c) throw new Error(`Embedded font ${r.family} ${r.weight} is missing.`);
319
339
  return c;
320
340
  });
321
341
  }
322
- function mt(o, t, a, r = 1e5) {
342
+ function pt(n, t, i, r = 1e5) {
323
343
  if (t.querySelector("parsererror") || t.documentElement.localName !== "svg")
324
344
  throw new Error("Runtime returned invalid SVG.");
325
345
  const c = new Set(
326
- Array.from(t.querySelectorAll("[id]"), (i) => i.getAttribute("id") ?? "")
346
+ Array.from(t.querySelectorAll("[id]"), (s) => s.getAttribute("id") ?? "")
327
347
  );
328
348
  let d = 0;
329
- const g = (i) => {
330
- if (++d > r || !at.has(i.localName))
349
+ const m = (s) => {
350
+ if (++d > r || !ft.has(s.localName))
331
351
  throw new Error("Runtime SVG exceeded the allowed drawing vocabulary.");
332
- const f = o.createElementNS(it, i.localName);
333
- for (const { name: p, value: m } of Array.from(i.attributes)) {
334
- if (/^on/i.test(p)) continue;
335
- if (p === "href") {
336
- if (i.localName !== "a") continue;
352
+ const f = n.createElementNS(lt, s.localName);
353
+ for (const { name: g, value: x } of Array.from(s.attributes)) {
354
+ if (/^on/i.test(g)) continue;
355
+ if (g === "href") {
356
+ if (s.localName !== "a") continue;
337
357
  try {
338
- const b = new URL(m, o.baseURI);
358
+ const b = new URL(x, n.baseURI);
339
359
  (b.protocol === "http:" || b.protocol === "https:") && f.setAttribute("href", b.href);
340
360
  } catch {
341
361
  }
342
362
  continue;
343
363
  }
344
- if (!ct.has(p) && !/^data-[a-z0-9-]+$/.test(p)) continue;
345
- const N = [...m.matchAll(/url\(#([^)]*)\)/g)].map((b) => b[1]);
346
- /url\s*\(/i.test(m) && (N.length === 0 || N.some((b) => !c.has(b))) || p === "aria-labelledby" && m.split(/\s+/).some((b) => !c.has(b)) || f.setAttribute(p, m);
364
+ if (!ut.has(g) && !/^data-[a-z0-9-]+$/.test(g)) continue;
365
+ const p = [...x.matchAll(/url\(#([^)]*)\)/g)].map((b) => b[1]);
366
+ /url\s*\(/i.test(x) && (p.length === 0 || p.some((b) => !c.has(b))) || g === "aria-labelledby" && x.split(/\s+/).some((b) => !c.has(b)) || f.setAttribute(g, x);
347
367
  }
348
- i.localName === "a" && f.getAttribute("target") === "_blank" && f.setAttribute("rel", "noopener noreferrer");
349
- for (const p of Array.from(i.childNodes))
350
- if (p.nodeType === 1) f.append(g(p));
351
- else if (p.nodeType === 3) {
352
- const m = p.nodeValue ?? "";
368
+ s.localName === "a" && f.getAttribute("target") === "_blank" && f.setAttribute("rel", "noopener noreferrer");
369
+ for (const g of Array.from(s.childNodes))
370
+ if (g.nodeType === 1) f.append(m(g));
371
+ else if (g.nodeType === 3) {
372
+ const x = g.nodeValue ?? "";
353
373
  f.append(
354
- o.createTextNode(
355
- i.localName === "style" && a ? m.replace(/@font-face\s*\{[^{}]*\}/g, "") : m
374
+ n.createTextNode(
375
+ s.localName === "style" && i ? x.replace(/@font-face\s*\{[^{}]*\}/g, "") : x
356
376
  )
357
377
  );
358
378
  }
359
379
  return f;
360
380
  };
361
- return g(t.documentElement);
381
+ return m(t.documentElement);
362
382
  }
363
- function de(o, t, a) {
383
+ function de(n, t, i) {
364
384
  return {
365
385
  ok: !1,
366
- reason: o,
367
- diagnostics: [{ code: t, severity: "error", message: a, itemIds: [] }]
386
+ reason: n,
387
+ diagnostics: [{ code: t, severity: "error", message: i, itemIds: [] }]
368
388
  };
369
389
  }
370
- function wt(o, t = {}) {
371
- const a = o?.ownerDocument?.defaultView;
372
- if (!a || !(o instanceof a.HTMLElement))
390
+ function bt(n, t = {}) {
391
+ const i = n?.ownerDocument?.defaultView;
392
+ if (!i || !(n instanceof i.HTMLElement))
373
393
  throw new TypeError("host must be an HTMLElement.");
374
- if (o.childNodes.length) throw new Error("Viewer host must be empty and exclusively owned.");
394
+ if (n.childNodes.length) throw new Error("Viewer host must be empty and exclusively owned.");
375
395
  if ((t.execution ?? { mode: "worker" }).mode === "worker" && t.render?.links?.mode === "safe" && t.render.links.resolve)
376
396
  throw new TypeError('A link resolver requires execution: { mode: "main" }.');
377
- const r = o.ownerDocument, c = a, d = r.createElement("section");
397
+ const r = n.ownerDocument, c = i, d = r.createElement("section");
378
398
  d.className = "draft-viewer", t.outline !== "visible" && d.classList.add("draft-viewer--outline-hidden"), d.setAttribute("aria-label", t.label ?? "Diagram viewer");
379
- const g = r.createElement("div");
380
- g.className = "draft-viewer__toolbar", g.setAttribute("role", "toolbar"), g.setAttribute("aria-label", "Diagram controls");
381
- const i = r.createElement("div");
382
- i.className = "draft-viewer__viewport", i.tabIndex = 0, i.setAttribute("aria-label", t.label ?? "Diagram");
399
+ const m = r.createElement("div");
400
+ m.className = "draft-viewer__toolbar", m.setAttribute("role", "toolbar"), m.setAttribute("aria-label", "Diagram controls");
401
+ const s = r.createElement("div");
402
+ s.className = "draft-viewer__viewport", s.tabIndex = 0, s.setAttribute("aria-label", t.label ?? "Diagram");
383
403
  const f = r.createElement("p");
384
404
  f.className = "draft-viewer__status", f.setAttribute("role", "status"), f.setAttribute("aria-live", "polite");
385
- const p = r.createElement("ol");
386
- p.className = "draft-viewer__outline", p.setAttribute("aria-label", "Diagram outline"), d.append(g, i, f, p);
387
- const m = Qe(r, {
405
+ const g = r.createElement("ol");
406
+ g.className = "draft-viewer__outline", g.setAttribute("aria-label", "Diagram outline"), d.append(m, s, f, g);
407
+ const x = nt(n, (e) => d.style.colorScheme = e ? "dark" : "light"), p = et(r, {
388
408
  detail: t.detail,
389
- onOverflow: () => l()
409
+ onOverflow: () => h()
390
410
  });
391
- i.append(m.el), o.append(d);
392
- const N = `draftViewer${(++lt).toString(36)}${Math.random().toString(36).slice(2, 9)}`;
393
- let b = 0, M = !1, x = { centerX: 0, centerY: 0, zoom: 1 }, Z = !1, k, X = { width: 0, height: 0 };
394
- const Y = /* @__PURE__ */ new Set(), Q = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(), j = (e, s) => {
395
- for (const n of Q.get(e) ?? [])
411
+ s.append(p.el), n.append(d);
412
+ const b = `draftViewer${(++mt).toString(36)}${Math.random().toString(36).slice(2, 9)}`;
413
+ let P = 0, L = !1, E = { centerX: 0, centerY: 0, zoom: 1 }, re = !1, k, Y = { width: 0, height: 0 };
414
+ const W = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), F = (e, a) => {
415
+ for (const o of G.get(e) ?? [])
396
416
  try {
397
- n(s);
417
+ o(a);
398
418
  } catch {
399
419
  }
400
- }, H = (e, s) => {
401
- const n = r.createElement("button");
402
- n.type = "button", n.textContent = e, n.setAttribute("aria-label", e), n.addEventListener("click", s), g.append(n);
403
- }, U = () => {
404
- const e = i.querySelector("svg");
420
+ }, U = (e, a) => {
421
+ const o = r.createElement("button");
422
+ o.type = "button", o.textContent = e, o.setAttribute("aria-label", e), o.addEventListener("click", a), m.append(o);
423
+ }, ne = () => {
424
+ const e = s.querySelector("svg");
405
425
  if (!e || !k) return;
406
- const [s, n] = k.viewBox, v = X, A = x.zoom, O = v.width / 2 - (x.centerX - s) * A, u = v.height / 2 - (x.centerY - n) * A;
407
- e.style.transformOrigin = "0 0", e.style.transform = `translate(${O}px, ${u}px) scale(${A})`, e.style.width = `${k.width}px`, e.style.height = `${k.height}px`, e.style.maxWidth = "none", m.place(O - s * A, u - n * A, A);
408
- const R = m.el.dataset.draftDetail;
409
- i.dataset.draftDetail !== R && (i.dataset.draftDetail = R);
410
- }, ae = () => {
411
- const e = new Set(m.bodyIds());
412
- for (const s of i.querySelectorAll(":scope > svg [data-id]"))
413
- s.toggleAttribute("data-draft-body", e.has(s.getAttribute("data-id")));
414
- j("anchors", { anchors: m.anchors() });
426
+ const [a, o] = k.viewBox, v = Y, A = E.zoom, C = v.width / 2 - (E.centerX - a) * A, u = v.height / 2 - (E.centerY - o) * A;
427
+ e.style.transformOrigin = "0 0", e.style.transform = `translate(${C}px, ${u}px) scale(${A})`, e.style.width = `${k.width}px`, e.style.height = `${k.height}px`, e.style.maxWidth = "none", p.place(C - a * A, u - o * A, A);
428
+ const q = p.el.dataset.draftDetail;
429
+ s.dataset.draftDetail !== q && (s.dataset.draftDetail = q);
430
+ }, se = () => {
431
+ const e = new Set(p.bodyIds());
432
+ for (const a of s.querySelectorAll(":scope > svg [data-id]"))
433
+ a.toggleAttribute("data-draft-body", e.has(a.getAttribute("data-id")));
434
+ F("anchors", { anchors: p.anchors() });
415
435
  };
416
- let ee = {
436
+ let l = {
417
437
  revision: 0,
418
438
  diagnostics: [],
419
439
  stale: !1
420
440
  };
421
- const l = () => j("diagnostics", {
422
- ...ee,
423
- diagnostics: [...ee.diagnostics, ...m.warnings()]
441
+ const h = () => F("diagnostics", {
442
+ ...l,
443
+ diagnostics: [...l.diagnostics, ...p.warnings()]
424
444
  });
425
- let w = "user", h = 0;
426
- const $ = (e) => c.requestAnimationFrame ? c.requestAnimationFrame(e) : c.setTimeout(e, 16), D = (e) => {
427
- w = e, !h && (h = $(() => {
428
- h = 0, M || j("camera", { camera: { ...x }, reason: w });
445
+ let w = "user", M = 0;
446
+ const _ = (e) => c.requestAnimationFrame ? c.requestAnimationFrame(e) : c.setTimeout(e, 16), S = (e) => {
447
+ w = e, !M && (M = _(() => {
448
+ M = 0, L || F("camera", { camera: { ...E }, reason: w });
429
449
  }));
430
- }, E = (e, s, n) => {
450
+ }, z = (e, a, o) => {
431
451
  const v = { ...e, zoom: ye(e.zoom) };
432
- return Z = n, Ue(x, v) ? "unchanged" : (x = v, U(), D(s), "moved");
433
- }, C = () => {
434
- const [e, s, n, v] = k.viewBox;
435
- return { x: e, y: s, width: n, height: v };
452
+ return re = o, Ke(E, v) ? "unchanged" : (E = v, ne(), S(a), "moved");
453
+ }, R = () => {
454
+ const [e, a, o, v] = k.viewBox;
455
+ return { x: e, y: a, width: o, height: v };
436
456
  };
437
- let z = null;
438
- const W = (e) => z ? Ne(z, e) : void 0;
439
- let F;
440
- const I = (e) => M ? "unchanged" : !k || !X.width || !X.height ? (F = e, "pending") : (F = void 0, e()), S = (e, s, n) => I(() => {
441
- const v = e ? Ge(e.flatMap((A) => W(A) ?? [])) : C();
442
- return v ? E(Re(v, X, s), n, !!e) : "missing";
443
- }), T = (e = "fit") => S(void 0, void 0, e), K = (e) => E({ ...x, zoom: x.zoom * e }, "user", !0), ne = () => E({ ...x, zoom: 1 }, "user", !0);
444
- H("Zoom in", () => K(1.2)), H("Zoom out", () => K(1 / 1.2)), H("Fit diagram", () => T()), H("Actual size", ne), g.hidden = t.toolbar === !1;
445
- const ce = new c.ResizeObserver((e) => {
446
- const s = e.at(-1)?.contentRect;
447
- s && (X = { width: s.width, height: s.height }), !(k && !X.width) && (F ? I(F) : Z ? U() : T("resize"));
457
+ let N = null;
458
+ const B = (e) => N ? Ne(N, e) : void 0;
459
+ let D;
460
+ const $ = (e) => L ? "unchanged" : !k || !Y.width || !Y.height ? (D = e, "pending") : (D = void 0, e()), I = (e, a, o) => $(() => {
461
+ const v = e ? Ge(e.flatMap((A) => B(A) ?? [])) : R();
462
+ return v ? z(Ie(v, Y, a), o, !!e) : "missing";
463
+ }), Q = (e = "fit") => I(void 0, void 0, e), Z = (e) => z({ ...E, zoom: E.zoom * e }, "user", !0), ue = () => z({ ...E, zoom: 1 }, "user", !0);
464
+ U("Zoom in", () => Z(1.2)), U("Zoom out", () => Z(1 / 1.2)), U("Fit diagram", () => Q()), U("Actual size", ue), m.hidden = t.toolbar === !1;
465
+ const ee = new c.ResizeObserver((e) => {
466
+ const a = e.at(-1)?.contentRect;
467
+ a && (Y = { width: a.width, height: a.height }), !(k && !Y.width) && (D ? $(D) : re ? ne() : Q("resize"));
448
468
  });
449
- ce.observe(i);
450
- const B = (e, s) => {
451
- f.textContent = s.map((n) => n.message).join(" "), d.classList.add("draft-viewer--stale"), ee = { revision: e, diagnostics: s, stale: !!k }, l();
452
- }, oe = async (e, s) => {
453
- const n = ft(e);
454
- if (!n.length) return [];
469
+ ee.observe(s);
470
+ const H = (e, a) => {
471
+ f.textContent = a.map((o) => o.message).join(" "), d.classList.add("draft-viewer--stale"), l = { revision: e, diagnostics: a, stale: !!k }, h();
472
+ }, ie = async (e, a) => {
473
+ const o = gt(e);
474
+ if (!o.length) return [];
455
475
  if (!r.fonts) throw new Error("The host document cannot load diagram fonts.");
456
- if (s === "host") {
457
- for (const u of n) {
458
- const R = `${u.weight} 12px "${u.family}"`;
459
- if (!(await r.fonts.load(R)).some(
460
- (q) => q.family.replace(/^['"]|['"]$/g, "") === u.family && q.weight === u.weight && q.status === "loaded"
461
- ) || !r.fonts.check(R))
476
+ if (a === "host") {
477
+ for (const u of o) {
478
+ const q = `${u.weight} 12px "${u.family}"`;
479
+ if (!(await r.fonts.load(q)).some(
480
+ (V) => V.family.replace(/^['"]|['"]$/g, "") === u.family && V.weight === u.weight && V.status === "loaded"
481
+ ) || !r.fonts.check(q))
462
482
  throw new Error(`Host font ${u.family} ${u.weight} is unavailable.`);
463
483
  }
464
484
  return [];
465
485
  }
466
- const v = n.map((u) => `${u.family}:${u.weight}`);
486
+ const v = o.map((u) => `${u.family}:${u.weight}`);
467
487
  if (v.every((u) => we(r, u)))
468
488
  return v.map((u) => ({ key: u, face: we(r, u) }));
469
- const A = ut(e, n), O = c.FontFace;
470
- if (!O) throw new Error("The browser cannot load embedded diagram fonts.");
489
+ const A = wt(e, o), C = c.FontFace;
490
+ if (!C) throw new Error("The browser cannot load embedded diagram fonts.");
471
491
  return Promise.all(
472
492
  A.map(async (u) => {
473
- const R = `${u.family}:${u.weight}`, te = we(r, R);
474
- if (te) return { key: R, face: te };
475
- const L = new O(u.family, `url("${u.data}")`, { weight: u.weight });
476
- if (await L.load(), L.status !== "loaded")
493
+ const q = `${u.family}:${u.weight}`, te = we(r, q);
494
+ if (te) return { key: q, face: te };
495
+ const T = new C(u.family, `url("${u.data}")`, { weight: u.weight });
496
+ if (await T.load(), T.status !== "loaded")
477
497
  throw new Error(`Embedded font ${u.family} ${u.weight} did not load.`);
478
- return { key: R, face: L };
498
+ return { key: q, face: T };
479
499
  })
480
500
  );
481
- }, se = async (e, s, n) => {
501
+ }, Ce = async (e, a, o) => {
482
502
  const v = t.execution ?? { mode: "worker" };
483
503
  if (v.mode === "main") {
484
- const { renderSvg: A } = await import("./render-CFWEEKPT.js");
485
- return A(e, { ...s, signal: n });
504
+ const { renderSvg: A } = await import("./render-CsJYFD3o.js");
505
+ return A(e, { ...a, signal: o });
486
506
  }
487
- return ot(e, s, {
507
+ return ct(e, a, {
488
508
  create: v.createWorker,
489
509
  timeoutMs: v.timeoutMs,
490
- signal: n
510
+ signal: o
491
511
  });
492
512
  };
493
- let _;
494
- const Ce = (e) => {
495
- const s = i.querySelector("svg"), n = s?.querySelector(":scope > rect");
496
- return e === i || e === s || e === n;
497
- }, ve = (e) => !(e.target instanceof c.Node) || !i.contains(e.target) || m.el.contains(e.target), qe = (e) => e.composedPath().some((s) => s instanceof c.Element && s.hasAttribute("data-draft-input"));
498
- i.addEventListener(
513
+ let O;
514
+ const qe = (e) => {
515
+ const a = s.querySelector("svg"), o = a?.querySelector(":scope > rect");
516
+ return e === s || e === a || e === o;
517
+ }, ve = (e) => !(e.target instanceof c.Node) || !s.contains(e.target) || p.el.contains(e.target), Ve = (e) => e.composedPath().some((a) => a instanceof c.Element && a.hasAttribute("data-draft-input"));
518
+ s.addEventListener(
499
519
  "wheel",
500
520
  (e) => {
501
- qe(e) || (e.preventDefault(), K(e.deltaY < 0 ? 1.1 : 1 / 1.1));
521
+ Ve(e) || (e.preventDefault(), Z(e.deltaY < 0 ? 1.1 : 1 / 1.1));
502
522
  },
503
523
  { passive: !1 }
504
- ), i.addEventListener("pointerdown", (e) => {
505
- !Ce(e.target) || !k || (_ = {
524
+ ), s.addEventListener("pointerdown", (e) => {
525
+ !qe(e.target) || !k || (O = {
506
526
  pointerId: e.pointerId,
507
527
  x: e.clientX,
508
528
  y: e.clientY,
509
- centerX: x.centerX,
510
- centerY: x.centerY,
511
- scale: x.zoom
512
- }, i.setPointerCapture(e.pointerId));
513
- }), i.addEventListener("pointermove", (e) => {
514
- _ && E(
529
+ centerX: E.centerX,
530
+ centerY: E.centerY,
531
+ scale: E.zoom
532
+ }, s.setPointerCapture(e.pointerId));
533
+ }), s.addEventListener("pointermove", (e) => {
534
+ O && z(
515
535
  {
516
- centerX: _.centerX - (e.clientX - _.x) / _.scale,
517
- centerY: _.centerY - (e.clientY - _.y) / _.scale,
518
- zoom: x.zoom
536
+ centerX: O.centerX - (e.clientX - O.x) / O.scale,
537
+ centerY: O.centerY - (e.clientY - O.y) / O.scale,
538
+ zoom: E.zoom
519
539
  },
520
540
  "user",
521
541
  !0
522
542
  );
523
543
  });
524
544
  const be = () => {
525
- if (_) {
545
+ if (O) {
526
546
  try {
527
- i.releasePointerCapture(_.pointerId);
547
+ s.releasePointerCapture(O.pointerId);
528
548
  } catch {
529
549
  }
530
- _ = void 0;
550
+ O = void 0;
531
551
  }
532
552
  };
533
- i.addEventListener("pointerup", be), i.addEventListener("pointercancel", be), i.addEventListener("click", (e) => {
553
+ s.addEventListener("pointerup", be), s.addEventListener("pointercancel", be), s.addEventListener("click", (e) => {
534
554
  if (ve(e)) return;
535
- const s = e.target instanceof c.Element ? e.target : null, n = s?.closest("a[href]");
536
- if (n && i.contains(n)) {
537
- const O = n.querySelector("[data-id]")?.getAttribute("data-id"), u = n.getAttribute("href");
538
- O && u && j("link", {
539
- itemId: O,
555
+ const a = e.target instanceof c.Element ? e.target : null, o = a?.closest("a[href]");
556
+ if (o && s.contains(o)) {
557
+ const C = o.querySelector("[data-id]")?.getAttribute("data-id"), u = o.getAttribute("href");
558
+ C && u && F("link", {
559
+ itemId: C,
540
560
  href: u,
541
- target: n.getAttribute("target") === "_blank" ? "_blank" : "_self",
561
+ target: o.getAttribute("target") === "_blank" ? "_blank" : "_self",
542
562
  preventDefault: () => e.preventDefault()
543
563
  });
544
564
  return;
545
565
  }
546
- const v = s?.closest("[data-id]")?.getAttribute("data-id"), A = k?.items.find((O) => O.id === v);
547
- A && j("itemactivate", { id: A.id, kind: A.kind, input: "pointer", revision: b });
548
- }), i.addEventListener("contextmenu", (e) => {
566
+ const v = a?.closest("[data-id]")?.getAttribute("data-id"), A = k?.items.find((C) => C.id === v);
567
+ A && F("itemactivate", { id: A.id, kind: A.kind, input: "pointer", revision: P });
568
+ }), s.addEventListener("contextmenu", (e) => {
549
569
  if (ve(e)) return;
550
- const n = (e.target instanceof c.Element ? e.target : null)?.closest("[data-id]")?.getAttribute("data-id") ?? null, v = n ? k?.items.find((A) => A.id === n) : void 0;
551
- j("contextmenu", {
570
+ const o = (e.target instanceof c.Element ? e.target : null)?.closest("[data-id]")?.getAttribute("data-id") ?? null, v = o ? k?.items.find((A) => A.id === o) : void 0;
571
+ F("contextmenu", {
552
572
  id: v?.id ?? null,
553
573
  ...v ? { kind: v.kind } : {},
554
574
  clientX: e.clientX,
555
575
  clientY: e.clientY,
556
576
  preventDefault: () => e.preventDefault()
557
577
  });
558
- }), m.el.addEventListener("focusin", (e) => {
559
- const s = e.target instanceof c.Node ? m.idOf(e.target) : void 0;
560
- s && !m.pressed() && xe.reveal(s);
561
- }), m.el.addEventListener("keydown", (e) => {
562
- e.key === "Escape" && i.focus({ preventScroll: !0 });
563
- }), m.el.addEventListener(
578
+ }), p.el.addEventListener("focusin", (e) => {
579
+ const a = e.target instanceof c.Node ? p.idOf(e.target) : void 0;
580
+ a && !p.pressed() && xe.reveal(a);
581
+ }), p.el.addEventListener("keydown", (e) => {
582
+ e.key === "Escape" && s.focus({ preventScroll: !0 });
583
+ }), p.el.addEventListener(
564
584
  "draft-anchor-focus-lost",
565
- () => i.focus({ preventScroll: !0 })
566
- ), i.addEventListener("keydown", (e) => {
567
- e.target !== i || e.altKey || e.ctrlKey || e.metaKey || (e.key === "+" || e.key === "=" ? K(1.2) : e.key === "-" ? K(1 / 1.2) : e.key.toLowerCase() === "f" && T());
585
+ () => s.focus({ preventScroll: !0 })
586
+ ), s.addEventListener("keydown", (e) => {
587
+ e.target !== s || e.altKey || e.ctrlKey || e.metaKey || (e.key === "+" || e.key === "=" ? Z(1.2) : e.key === "-" ? Z(1 / 1.2) : e.key.toLowerCase() === "f" && Q());
568
588
  });
569
- const Ve = (e, s) => {
570
- for (const [n, v] of G)
571
- n !== e && v.resolve({ status: s, revision: n });
589
+ const je = (e, a) => {
590
+ for (const [o, v] of J)
591
+ o !== e && v.resolve({ status: a, revision: o });
572
592
  };
573
593
  let me = () => {
574
594
  };
575
- const je = (e, s = {}) => {
576
- const n = ++b;
577
- if (M) return Promise.resolve({ status: "destroyed", revision: n });
578
- Ve(n, "superseded"), me();
595
+ const Pe = (e, a = {}) => {
596
+ const o = ++P;
597
+ if (L) return Promise.resolve({ status: "destroyed", revision: o });
598
+ je(o, "superseded"), me();
579
599
  const v = new AbortController();
580
600
  return me = () => v.abort(), new Promise((A) => {
581
- let O = !1;
582
- const u = (L) => {
583
- if (O) return;
584
- O = !0, s.signal?.removeEventListener("abort", R), G.delete(n);
585
- const q = M ? { status: "destroyed", revision: n } : n !== b ? { status: "superseded", revision: n } : s.signal?.aborted ? { status: "aborted", revision: n } : L;
586
- A(q);
587
- }, R = () => {
588
- v.abort(), u({ status: "aborted", revision: n });
601
+ let C = !1;
602
+ const u = (T) => {
603
+ if (C) return;
604
+ C = !0, a.signal?.removeEventListener("abort", q), J.delete(o);
605
+ const V = L ? { status: "destroyed", revision: o } : o !== P ? { status: "superseded", revision: o } : a.signal?.aborted ? { status: "aborted", revision: o } : T;
606
+ A(V);
607
+ }, q = () => {
608
+ v.abort(), u({ status: "aborted", revision: o });
589
609
  };
590
- if (G.set(n, { resolve: u }), s.signal?.aborted) {
591
- R();
610
+ if (J.set(o, { resolve: u }), a.signal?.aborted) {
611
+ q();
592
612
  return;
593
613
  }
594
- s.signal?.addEventListener("abort", R, { once: !0 });
614
+ a.signal?.addEventListener("abort", q, { once: !0 });
595
615
  const te = {
596
616
  ...t.render ?? {},
597
617
  target: "inline",
598
- idPrefix: N,
618
+ idPrefix: b,
599
619
  fonts: t.render?.fonts ?? "embed",
600
- ...s.state !== void 0 ? { state: s.state } : {}
620
+ colorScheme: "auto",
621
+ ...a.state !== void 0 ? { state: a.state } : {}
601
622
  };
602
- se(e, te, v.signal).then(async (L) => {
603
- if (M || n !== b || s.signal?.aborted) {
604
- u({ status: "superseded", revision: n });
623
+ Ce(e, te, v.signal).then(async (T) => {
624
+ if (L || o !== P || a.signal?.aborted) {
625
+ u({ status: "superseded", revision: o });
605
626
  return;
606
627
  }
607
- if (!L.ok) {
608
- B(n, L.diagnostics), u({ status: "error", revision: n, error: L });
628
+ if (!T.ok) {
629
+ H(o, T.diagnostics), u({ status: "error", revision: o, error: T });
609
630
  return;
610
631
  }
611
- let q, he;
632
+ let V, he;
612
633
  try {
613
- he = dt(r, L.value.svg), q = await oe(he, te.fonts ?? "embed");
634
+ he = ht(r, T.value.svg), V = await ie(he, te.fonts ?? "embed");
614
635
  } catch (y) {
615
- if (M || n !== b || s.signal?.aborted) {
636
+ if (L || o !== P || a.signal?.aborted) {
616
637
  u({
617
- status: s.signal?.aborted ? "aborted" : "superseded",
618
- revision: n
638
+ status: a.signal?.aborted ? "aborted" : "superseded",
639
+ revision: o
619
640
  });
620
641
  return;
621
642
  }
622
- const V = de(
643
+ const j = de(
623
644
  "environment",
624
645
  "DRAFT_FONT_UNAVAILABLE",
625
646
  y instanceof Error ? y.message : "Diagram fonts are unavailable."
626
647
  );
627
- B(n, V.diagnostics), u({ status: "error", revision: n, error: V });
648
+ H(o, j.diagnostics), u({ status: "error", revision: o, error: j });
628
649
  return;
629
650
  }
630
- if (M || n !== b || s.signal?.aborted) {
631
- u({ status: "superseded", revision: n });
651
+ if (L || o !== P || a.signal?.aborted) {
652
+ u({ status: "superseded", revision: o });
632
653
  return;
633
654
  }
634
655
  let ge;
635
656
  try {
636
- ge = mt(r, he, te.fonts !== "host");
657
+ ge = pt(r, he, te.fonts !== "host");
637
658
  } catch (y) {
638
- const V = y instanceof Error ? y.message : "Could not build safe SVG.", P = de("internal", "DRAFT_VIEWER_DOM", V);
639
- B(n, P.diagnostics), u({ status: "error", revision: n, error: P });
659
+ const j = y instanceof Error ? y.message : "Could not build safe SVG.", X = de("internal", "DRAFT_VIEWER_DOM", j);
660
+ H(o, X.diagnostics), u({ status: "error", revision: o, error: X });
640
661
  return;
641
662
  }
642
663
  const ke = [];
643
664
  try {
644
- for (const y of q)
645
- Y.has(y.key) || (st(r, y.key, y.face), Y.add(y.key), ke.push(y.key));
665
+ for (const y of V)
666
+ W.has(y.key) || (dt(r, y.key, y.face), W.add(y.key), ke.push(y.key));
646
667
  } catch (y) {
647
- for (const P of ke)
648
- pe(r, P), Y.delete(P);
649
- const V = de(
668
+ for (const X of ke)
669
+ pe(r, X), W.delete(X);
670
+ const j = de(
650
671
  "environment",
651
672
  "DRAFT_FONT_UNAVAILABLE",
652
673
  y instanceof Error ? y.message : "Loaded fonts could not be registered."
653
674
  );
654
- B(n, V.diagnostics), u({ status: "error", revision: n, error: V });
675
+ H(o, j.diagnostics), u({ status: "error", revision: o, error: j });
655
676
  return;
656
677
  }
657
- const Xe = !!k;
658
- k = L.value, z = k.geometry ? { ...k.geometry, revision: n } : null;
659
- const Ae = i.querySelector(":scope > svg");
660
- Ae ? Ae.replaceWith(ge) : i.prepend(ge), m.setGeometry(z);
661
- const Se = p.getRootNode().activeElement, Le = p.contains(Se) ? Se.dataset.itemId : void 0;
662
- p.replaceChildren(
678
+ const Ye = !!k;
679
+ k = T.value, N = k.geometry ? { ...k.geometry, revision: o } : null;
680
+ const Ae = s.querySelector(":scope > svg");
681
+ Ae ? Ae.replaceWith(ge) : s.prepend(ge), p.setGeometry(N);
682
+ const Se = g.getRootNode().activeElement, Le = g.contains(Se) ? Se.dataset.itemId : void 0;
683
+ g.replaceChildren(
663
684
  ...k.items.map((y) => {
664
- const V = r.createElement("li"), P = r.createElement("button");
665
- P.type = "button";
666
- const Be = y.label.trim() || (y.kind === "edge" ? `${y.from ?? "?"} to ${y.to ?? "?"}` : y.id);
667
- return P.textContent = `${y.kind}: ${Be}`, P.dataset.itemId = y.id, P.addEventListener("click", () => {
668
- j("itemactivate", {
685
+ const j = r.createElement("li"), X = r.createElement("button");
686
+ X.type = "button";
687
+ const Ze = y.label.trim() || (y.kind === "edge" ? `${y.from ?? "?"} to ${y.to ?? "?"}` : y.id);
688
+ return X.textContent = `${y.kind}: ${Ze}`, X.dataset.itemId = y.id, X.addEventListener("click", () => {
689
+ F("itemactivate", {
669
690
  id: y.id,
670
691
  kind: y.kind,
671
692
  input: "keyboard",
672
- revision: n
693
+ revision: o
673
694
  });
674
- const Me = Array.from(i.querySelectorAll("[data-id]")).find(
675
- (J) => J.getAttribute("data-id") === y.id
695
+ const Me = Array.from(s.querySelectorAll("[data-id]")).find(
696
+ (K) => K.getAttribute("data-id") === y.id
676
697
  );
677
698
  if (Me) {
678
- const J = Me.getBoundingClientRect(), re = i.getBoundingClientRect();
679
- (J.width || J.height) && re.width && re.height && E(
699
+ const K = Me.getBoundingClientRect(), oe = s.getBoundingClientRect();
700
+ (K.width || K.height) && oe.width && oe.height && z(
680
701
  {
681
- centerX: x.centerX + (J.left + J.width / 2 - (re.left + re.width / 2)) / x.zoom,
682
- centerY: x.centerY + (J.top + J.height / 2 - (re.top + re.height / 2)) / x.zoom,
683
- zoom: Math.max(1, x.zoom)
702
+ centerX: E.centerX + (K.left + K.width / 2 - (oe.left + oe.width / 2)) / E.zoom,
703
+ centerY: E.centerY + (K.top + K.height / 2 - (oe.top + oe.height / 2)) / E.zoom,
704
+ zoom: Math.max(1, E.zoom)
684
705
  },
685
706
  "user",
686
707
  !0
687
708
  );
688
709
  }
689
- }), V.append(P), V;
710
+ }), j.append(X), j;
690
711
  })
691
- ), Le !== void 0 && (Array.from(p.querySelectorAll("button")).find(
692
- (V) => V.dataset.itemId === Le
693
- ) ?? i).focus({ preventScroll: !0 });
694
- const Ye = new Set(q.map((y) => y.key));
695
- for (const y of Y)
696
- Ye.has(y) || (pe(r, y), Y.delete(y));
697
- d.classList.remove("draft-viewer--stale"), f.textContent = L.diagnostics.map((y) => y.message).join(" "), F ? I(F) : !Xe || s.camera === "fit" ? T() : U();
698
- const We = {
712
+ ), Le !== void 0 && (Array.from(g.querySelectorAll("button")).find(
713
+ (j) => j.dataset.itemId === Le
714
+ ) ?? s).focus({ preventScroll: !0 });
715
+ const We = new Set(V.map((y) => y.key));
716
+ for (const y of W)
717
+ We.has(y) || (pe(r, y), W.delete(y));
718
+ d.classList.remove("draft-viewer--stale"), f.textContent = T.diagnostics.map((y) => y.message).join(" "), D ? $(D) : !Ye || a.camera === "fit" ? Q() : ne();
719
+ const Be = {
699
720
  status: "committed",
700
- revision: n,
721
+ revision: o,
701
722
  value: k,
702
- diagnostics: L.diagnostics
723
+ diagnostics: T.diagnostics
703
724
  };
704
- j("render", { revision: n, value: k, geometry: z }), ee = { revision: n, diagnostics: L.diagnostics, stale: !1 }, l(), ae(), u(We);
705
- }).catch((L) => {
706
- if (M || n !== b || s.signal?.aborted) {
725
+ x.check(), F("render", { revision: o, value: k, geometry: N }), l = { revision: o, diagnostics: T.diagnostics, stale: !1 }, h(), se(), u(Be);
726
+ }).catch((T) => {
727
+ if (L || o !== P || a.signal?.aborted) {
707
728
  u({
708
- status: s.signal?.aborted ? "aborted" : "superseded",
709
- revision: n
729
+ status: a.signal?.aborted ? "aborted" : "superseded",
730
+ revision: o
710
731
  });
711
732
  return;
712
733
  }
713
- const q = de(
734
+ const V = de(
714
735
  "environment",
715
736
  "DRAFT_VIEWER_WORKER",
716
- L instanceof Error ? L.message : "Viewer render failed."
737
+ T instanceof Error ? T.message : "Viewer render failed."
717
738
  );
718
- B(n, q.diagnostics), u({ status: "error", revision: n, error: q });
739
+ H(o, V.diagnostics), u({ status: "error", revision: o, error: V });
719
740
  });
720
741
  });
721
742
  };
722
- let le, Ee;
723
- const Pe = new Promise((e) => Ee = e), xe = {
743
+ let ce, Ee;
744
+ const Xe = new Promise((e) => Ee = e), xe = {
724
745
  get ready() {
725
- return le ?? Pe;
746
+ return ce ?? Xe;
726
747
  },
727
- update: (e, s) => {
728
- const n = je(e, s), v = n.then(
729
- (A) => A.status === "superseded" && le !== v ? le : A
748
+ update: (e, a) => {
749
+ const o = Pe(e, a), v = o.then(
750
+ (A) => A.status === "superseded" && ce !== v ? ce : A
730
751
  );
731
- return le = v, v.then(Ee), n;
752
+ return ce = v, v.then(Ee), o;
732
753
  },
733
- geometry: () => z,
754
+ geometry: () => N,
734
755
  anchor(e) {
735
- if (M) return;
736
- const s = m.warnings().length;
737
- m.setSlots(e), U(), ae(), (m.warnings().length || s) && l();
756
+ if (L) return;
757
+ const a = p.warnings().length;
758
+ p.setSlots(e), ne(), se(), (p.warnings().length || a) && h();
738
759
  },
739
- on(e, s) {
740
- if (M) return () => {
760
+ on(e, a) {
761
+ if (L) return () => {
741
762
  };
742
- const n = Q.get(e) ?? /* @__PURE__ */ new Set();
743
- return n.add(s), Q.set(e, n), () => n.delete(s);
763
+ const o = G.get(e) ?? /* @__PURE__ */ new Set();
764
+ return o.add(a), G.set(e, o), () => o.delete(a);
744
765
  },
745
- getCamera: () => ({ ...x }),
766
+ getCamera: () => ({ ...E }),
746
767
  setCamera(e) {
747
- M || !Number.isFinite(e.centerX) || !Number.isFinite(e.centerY) || !Number.isFinite(e.zoom) || e.zoom <= 0 || E({ ...e }, "api", !0);
768
+ L || !Number.isFinite(e.centerX) || !Number.isFinite(e.centerY) || !Number.isFinite(e.zoom) || e.zoom <= 0 || z({ ...e }, "api", !0);
748
769
  },
749
- fit: (e, s) => S(e, s, "api"),
750
- reveal: (e, s) => I(() => {
751
- const n = W(e);
752
- return n ? E(He(x, n, X, s), "api", !0) : "missing";
770
+ fit: (e, a) => I(e, a, "api"),
771
+ reveal: (e, a) => $(() => {
772
+ const o = B(e);
773
+ return o ? z(Ue(E, o, Y, a), "api", !0) : "missing";
753
774
  }),
754
775
  focusItem(e) {
755
- if (!k?.items.some((n) => n.id === e)) return !1;
756
- const s = Array.from(p.querySelectorAll("button")).find(
757
- (n) => n.dataset.itemId === e
776
+ if (!k?.items.some((o) => o.id === e)) return !1;
777
+ const a = Array.from(g.querySelectorAll("button")).find(
778
+ (o) => o.dataset.itemId === e
758
779
  );
759
- return s?.focus(), !!s;
780
+ return a?.focus(), !!a;
760
781
  },
761
782
  destroy() {
762
- if (!M) {
763
- if (M = !0, b++, F = void 0, h && (c.cancelAnimationFrame ?? c.clearTimeout)(h), _) {
783
+ if (!L) {
784
+ if (L = !0, x.stop(), P++, D = void 0, M && (c.cancelAnimationFrame ?? c.clearTimeout)(M), O) {
764
785
  try {
765
- i.releasePointerCapture(_.pointerId);
786
+ s.releasePointerCapture(O.pointerId);
766
787
  } catch {
767
788
  }
768
- _ = void 0;
789
+ O = void 0;
769
790
  }
770
- for (const [e, s] of G)
771
- s.resolve({ status: "destroyed", revision: e });
772
- G.clear(), me();
773
- for (const e of Y) pe(r, e);
774
- Y.clear(), ce.disconnect(), j("anchors", { anchors: [] }), m.destroy(), Q.clear(), o.replaceChildren(), k = void 0;
791
+ for (const [e, a] of J)
792
+ a.resolve({ status: "destroyed", revision: e });
793
+ J.clear(), me();
794
+ for (const e of W) pe(r, e);
795
+ W.clear(), ee.disconnect(), F("anchors", { anchors: [] }), p.destroy(), G.clear(), n.replaceChildren(), k = void 0;
775
796
  }
776
797
  }
777
798
  };
@@ -780,7 +801,7 @@ function wt(o, t = {}) {
780
801
  export {
781
802
  ze as ZOOM_MAX,
782
803
  $e as ZOOM_MIN,
783
- vt as fontMetricsVersion,
784
- wt as mountViewer,
785
- Et as runtimeVersion
804
+ kt as fontMetricsVersion,
805
+ bt as mountViewer,
806
+ St as runtimeVersion
786
807
  };