@liquidcars/atlas 0.1.49 → 0.1.51

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.
@@ -11890,7 +11890,7 @@ var $c = class {
11890
11890
  }
11891
11891
  }, el = {
11892
11892
  name: "@liquidcars/atlas",
11893
- version: "0.1.49",
11893
+ version: "0.1.51",
11894
11894
  description: "Reusable 3D conceptual atlas Web Component for LiquidCars-style models",
11895
11895
  type: "module",
11896
11896
  scripts: {
@@ -12353,7 +12353,7 @@ function vl(e, t = {}) {
12353
12353
  return `<path data-relation="${s}" data-mode="${o}" d="M${H(i)} L${H(a)}" fill="none" stroke="${tl(t.connectionColor || "#58788d")}" stroke-width="2"${o === "bidirectional" ? " marker-start=\"url(#atlas-diagram-arrow)\"" : ""} marker-end="url(#atlas-diagram-arrow)"${l}/>`;
12354
12354
  }).join(""), pe = t.canvasColor || "#f5f5f5", W = /* @__PURE__ */ new Map(), G = [...re.values()].sort((e, t) => ne(e.node) - ne(t.node)).map((n) => {
12355
12355
  if (v(n.node.id)) return "";
12356
- let r = n.node.material?.color || new Y("#58788d"), i = `#${r.getHexString()}`, o = `#${r.clone().lerp(new Y("#254253"), .48).getHexString()}`, s = n.node.parent, c = 0;
12356
+ let r = n.node.material?.color || new Y("#58788d"), i = `#${r.getHexString()}`, o = `#${r.clone().lerp(new Y(t.containerInk || "#254253"), t.containerInk ? .65 : .48).getHexString()}`, s = n.node.parent, c = 0;
12357
12357
  for (; s && !W.has(s) && c++ < e.nodes.size;) s = e.nodes.get(s)?.parent;
12358
12358
  let l = W.get(s) || pe, u = al(l, i, .14);
12359
12359
  W.set(n.node.id, u);
@@ -12410,7 +12410,7 @@ var bl = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
12410
12410
  ">": "&gt;",
12411
12411
  "\"": "&quot;",
12412
12412
  "'": "&#39;"
12413
- })[e]), xl = (e, t, n) => Math.min(n, Math.max(t, e)), Sl = "\n .diagram-view{position:absolute;inset:0;overflow:auto;background-color:#f5f5f5;background-image:radial-gradient(circle,#b3b3b3 .8px,transparent 1px);background-size:16px 16px;color:#172c3a;cursor:grab;touch-action:none}\n .diagram-view[hidden],:host(:not([data-view-mode=\"2d\"])) .diagram-view{display:none!important}\n :host([data-view-mode=\"2d\"]) .viewport>canvas,:host([data-view-mode=\"2d\"]) .atlas-jump{visibility:hidden;pointer-events:none}\n :host([data-view-mode=\"2d\"]) .toolbar-group[data-toolbar-group=\"camera\"],\n :host([data-view-mode=\"2d\"]) .toolbar-group[data-toolbar-group=\"copy\"]{display:none}\n :host(:not([data-view-mode=\"2d\"])) .toolbar-group[data-toolbar-group=\"diagram\"]{display:none}\n :host(:not([data-view-mode=\"2d\"])) [data-action=\"diagram-relations-within\"]{display:none!important}\n :host([data-view-mode=\"2d\"]) .toolbar{width:max-content;max-width:calc(100% - 16px);flex-wrap:wrap;justify-content:center}\n :host([data-view-mode=\"2d\"]) .toolbar-group[data-toolbar-group=\"diagram\"]{flex-wrap:wrap;justify-content:center}\n .diagram-content{position:relative;width:max-content;min-width:100%;min-height:100%;display:grid;place-items:center;padding:12px}\n .diagram-content svg{display:block;max-width:none;overflow:visible}\n .diagram-content [data-entity],.diagram-content [data-relation]{cursor:pointer}\n .diagram-content [data-entity]:hover,.diagram-content [data-relation]:hover{filter:drop-shadow(0 0 5px #23a58f)}\n .diagram-content [data-entity].selected,.diagram-content [data-relation].selected{filter:drop-shadow(0 0 7px #008fcb)}\n .diagram-view.dragging{cursor:grabbing}\n .diagram-toolbar select,.diagram-toolbar input{accent-color:#6ad7c0}\n .diagram-toolbar .toolbar-popover{max-height:min(430px,65vh);overflow:auto}\n .diagram-toolbar .toolbar-option.checkbox{display:flex;gap:8px;align-items:center}\n .diagram-toolbar .toolbar-option.checkbox input{pointer-events:none}\n .diagram-toolbar .diagram-spacing{padding:7px 9px;color:#dbe7ec;font-size:12px}\n .diagram-toolbar .diagram-spacing input{width:100%;display:block;margin-top:6px}\n .diagram-toolbar .diagram-items{max-height:220px;overflow:auto}\n .diagram-orientation-cube{position:absolute;z-index:9;top:12px;left:12px;width:110px;height:110px;touch-action:none;cursor:grab}\n .diagram-orientation-cube[hidden],:host(:not([data-view-mode=\"2d\"])) .diagram-orientation-cube{display:none!important}\n .diagram-orientation-cube svg{width:100%;height:100%}\n .diagram-orientation-cube polygon{fill:#476782;stroke:#a8d0df;stroke-width:1.4}\n .diagram-orientation-cube polygon:hover{fill:#4caeaa}\n .diagram-orientation-cube text{fill:#fff;font:bold 10px system-ui;pointer-events:none}\n .diagram-orientation-cube circle{fill:#132b3b;stroke:#50758b}\n .diagram-toolbar .diagram-orbit,.diagram-toolbar .diagram-camera-zoom{display:block;padding:6px 9px;color:#dbe7ec;font-size:12px}\n .diagram-toolbar .diagram-orbit select,.diagram-toolbar .diagram-camera-zoom input{display:block;width:100%;margin-top:4px}\n :host([data-view-mode=\"2d\"]) .hint{color:#527286}\n @media print{:host([data-view-mode=\"2d\"]) .diagram-view{display:block!important;overflow:hidden}.diagram-orientation-cube{display:none!important}}\n", Cl = (e, t, n) => `<details class="toolbar-menu" data-toolbar-menu="diagram-${e}"><summary aria-label="${t}" title="${t}"><span class="toolbar-menu-status">${t}</span><svg class="toolbar-menu-chevron" viewBox="0 0 24 24" aria-hidden="true"><path d="m8 10 4 4 4-4"/></svg></summary><div class="toolbar-popover" role="menu"><div class="toolbar-popover-title">${t}</div>${n}</div></details>`, wl = (e, t) => `<button type="button" class="toolbar-option" data-action="${e}"><span>${t}</span></button>`, Tl = `<div class="toolbar-group diagram-toolbar" data-toolbar-group="diagram">
12413
+ })[e]), xl = (e, t, n) => Math.min(n, Math.max(t, e)), Sl = "\n .toolbar button[hidden],.toolbar-menu[hidden]{display:none!important}\n .diagram-view{position:absolute;inset:0;overflow:auto;background-color:var(--lc-diagram-background,#f5f5f5);background-image:radial-gradient(circle,var(--lc-diagram-dot,#b3b3b3) .8px,transparent 1px);background-size:16px 16px;color:#172c3a;cursor:grab;touch-action:none}\n .diagram-view[hidden],:host(:not([data-view-mode=\"2d\"])) .diagram-view{display:none!important}\n :host([data-view-mode=\"2d\"]) .viewport>canvas{visibility:hidden;pointer-events:none}\n :host([data-view-mode=\"2d\"]) .toolbar-group[data-toolbar-group=\"camera\"],\n :host([data-view-mode=\"2d\"]) .toolbar-group[data-toolbar-group=\"copy\"]{display:none}\n :host(:not([data-view-mode=\"2d\"])) .toolbar-group[data-toolbar-group=\"diagram\"]{display:none}\n :host(:not([data-view-mode=\"2d\"])) [data-action=\"diagram-relations-within\"]{display:none!important}\n :host([data-view-mode=\"2d\"]) .toolbar{width:max-content;max-width:calc(100% - 16px);flex-wrap:wrap;justify-content:center}\n :host([data-view-mode=\"2d\"]) .toolbar-group[data-toolbar-group=\"diagram\"]{flex-wrap:wrap;justify-content:center}\n .diagram-content{position:relative;width:max-content;min-width:100%;min-height:100%;display:grid;place-items:center;padding:12px}\n .diagram-content svg{display:block;max-width:none;overflow:visible}\n .diagram-content [data-entity],.diagram-content [data-relation]{cursor:pointer}\n .diagram-content [data-entity]:hover,.diagram-content [data-relation]:hover{filter:drop-shadow(0 0 5px #23a58f)}\n .diagram-content [data-entity].selected,.diagram-content [data-relation].selected{filter:drop-shadow(0 0 7px #008fcb)}\n .diagram-view.dragging{cursor:grabbing}\n .diagram-toolbar select,.diagram-toolbar input{accent-color:#6ad7c0}\n .diagram-toolbar .toolbar-popover{max-height:min(430px,65vh);overflow:auto}\n .diagram-toolbar .toolbar-option.checkbox{display:flex;gap:8px;align-items:center}\n .diagram-toolbar .toolbar-option.checkbox input{pointer-events:none}\n .diagram-toolbar .diagram-spacing{padding:7px 9px;color:#dbe7ec;font-size:12px}\n .diagram-toolbar .diagram-spacing input{width:100%;display:block;margin-top:6px}\n .diagram-toolbar .diagram-items{max-height:220px;overflow:auto}\n .diagram-orientation-cube{position:absolute;z-index:9;top:12px;left:12px;width:110px;height:110px;touch-action:none;cursor:grab}\n .diagram-orientation-cube[hidden],:host(:not([data-view-mode=\"2d\"])) .diagram-orientation-cube{display:none!important}\n .diagram-orientation-cube svg{width:100%;height:100%}\n .diagram-orientation-cube polygon{fill:#476782;stroke:#a8d0df;stroke-width:1.4}\n .diagram-orientation-cube polygon:hover{fill:#4caeaa}\n .diagram-orientation-cube text{fill:#fff;font:bold 10px system-ui;pointer-events:none}\n .diagram-orientation-cube circle{fill:#132b3b;stroke:#50758b}\n .diagram-toolbar .diagram-orbit,.diagram-toolbar .diagram-camera-zoom{display:block;padding:6px 9px;color:#dbe7ec;font-size:12px}\n .diagram-toolbar .diagram-orbit select,.diagram-toolbar .diagram-camera-zoom input{display:block;width:100%;margin-top:4px}\n :host([data-view-mode=\"2d\"]) .hint{color:var(--lc-diagram-hint,#527286)}\n @media print{:host([data-view-mode=\"2d\"]) .diagram-view{display:block!important;overflow:hidden}.diagram-orientation-cube{display:none!important}}\n", Cl = (e, t, n) => `<details class="toolbar-menu" data-toolbar-menu="diagram-${e}"><summary aria-label="${t}" title="${t}"><span class="toolbar-menu-status">${t}</span><svg class="toolbar-menu-chevron" viewBox="0 0 24 24" aria-hidden="true"><path d="m8 10 4 4 4-4"/></svg></summary><div class="toolbar-popover" role="menu"><div class="toolbar-popover-title">${t}</div>${n}</div></details>`, wl = (e, t) => `<button type="button" class="toolbar-option" data-action="${e}"><span>${t}</span></button>`, Tl = `<div class="toolbar-group diagram-toolbar" data-toolbar-group="diagram">
12414
12414
  <button class="toolbar-icon" data-action="diagram-minus" aria-label="Zoom out" title="Zoom out">−</button>
12415
12415
  <button class="toolbar-icon" data-action="diagram-plus" aria-label="Zoom in" title="Zoom in">+</button>
12416
12416
  <button class="toolbar-icon" data-action="diagram-fit" aria-label="Fit diagram" title="Fit diagram">⛶</button>
@@ -12443,6 +12443,8 @@ var bl = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
12443
12443
  labels: !0,
12444
12444
  relations: "all",
12445
12445
  showOrientationCube: !0,
12446
+ theme: "auto",
12447
+ grid: !0,
12446
12448
  focus: {
12447
12449
  mode: "all",
12448
12450
  effect: "dim",
@@ -12465,6 +12467,12 @@ function Dl(e = {}) {
12465
12467
  cameraZoom: xl(Number(t.cameraZoom) || 1, .5, 5),
12466
12468
  gap: xl(Number(t.gap ?? 20) || 0, 0, 150),
12467
12469
  labels: t.labels !== !1,
12470
+ theme: [
12471
+ "auto",
12472
+ "light",
12473
+ "dark"
12474
+ ].includes(t.theme) ? t.theme : "auto",
12475
+ grid: t.grid !== !1,
12468
12476
  showOrientationCube: t.showOrientationCube !== !1,
12469
12477
  relations: [
12470
12478
  "all",
@@ -12767,7 +12775,7 @@ var Il = class {
12767
12775
  }));
12768
12776
  }
12769
12777
  renderOptions(e = {}) {
12770
- let t = this.config, n = this._focusedIds();
12778
+ let t = this.config, n = this._focusedIds(), r = new Y(t.background || (t.theme === "dark" ? "#2d2f31" : t.theme === "light" ? "#f5f5f5" : null) || globalThis.getComputedStyle?.(this.root).backgroundColor || "#f5f5f5"), i = r.r * .2126 + r.g * .7152 + r.b * .0722 < .32, a = `#${r.getHexString()}`;
12771
12779
  return {
12772
12780
  cameraView: t.cameraView,
12773
12781
  cameraFrame: {
@@ -12785,7 +12793,11 @@ var Il = class {
12785
12793
  gap: t.gap,
12786
12794
  labels: t.labels,
12787
12795
  placements: t.placements,
12788
- background: "#f5f5f5",
12796
+ background: a,
12797
+ canvasColor: a,
12798
+ labelColor: i ? "#e9f0f5" : "#172c3a",
12799
+ connectionColor: i ? "#b1c7d3" : "#58788d",
12800
+ ...i ? { containerInk: "#e9f0f5" } : {},
12789
12801
  ...e
12790
12802
  };
12791
12803
  }
@@ -12825,7 +12837,7 @@ var Il = class {
12825
12837
  }
12826
12838
  refresh() {
12827
12839
  if (this._refreshQueued = !1, this.atlas.viewMode !== "2d" || !this.atlas.ready || !this.root.clientWidth) return !1;
12828
- this._syncControls();
12840
+ this._syncControls(), this.root.style.backgroundColor = this.config.background || (this.config.theme === "dark" ? "#2d2f31" : this.config.theme === "light" ? "#f5f5f5" : ""), this.root.style.backgroundImage = this.config.grid ? "" : "none", this.config.theme === "auto" ? this.root.style.removeProperty("--lc-diagram-dot") : this.root.style.setProperty("--lc-diagram-dot", this.config.theme === "dark" ? "#73777c" : "#b3b3b3");
12829
12841
  let e = this.renderOptions({
12830
12842
  faceCache: /* @__PURE__ */ new Map(),
12831
12843
  background: null,
@@ -12833,35 +12845,43 @@ var Il = class {
12833
12845
  }), t = {
12834
12846
  width: this.root.clientWidth,
12835
12847
  height: this.root.clientHeight
12836
- }, n = (e) => Math.min(1, (t.width - 32) / e.width, (t.height - 32) / e.height), r = this.atlas.exportDiagramSvg({
12848
+ }, n = this.atlas.toolbar, r = {
12849
+ top: this.atlas.shadowRoot.querySelector(".hint")?.hidden ? 16 : 34,
12850
+ right: 16,
12851
+ bottom: this.atlas.toolbarVisible && !n.hidden ? n.offsetHeight + 44 : 16,
12852
+ left: this.cube.hidden ? 16 : 132
12853
+ };
12854
+ this.content.style.padding = `${r.top}px ${r.right}px ${r.bottom}px ${r.left}px`;
12855
+ let i = (e) => Math.min(1, (t.width - r.left - r.right) / e.width, (t.height - r.top - r.bottom) / e.height), a = this.atlas.exportDiagramSvg({
12837
12856
  ...e,
12838
12857
  measureOnly: !0
12839
- }), i = this.zoom === "fit" ? n(r) : this.zoom;
12858
+ }), o = this.zoom === "fit" ? i(a) : this.zoom;
12840
12859
  for (let t = 0; t < (this.zoom === "fit" ? 8 : 1); t += 1) {
12841
- i = Math.max(.08, i);
12860
+ o = Math.max(.08, o);
12842
12861
  let t = this.atlas.exportDiagramSvg({
12843
12862
  ...e,
12844
- observerScale: i,
12863
+ observerScale: o,
12845
12864
  measureOnly: !0
12846
12865
  });
12847
12866
  if (this.zoom !== "fit") break;
12848
- let r = n(t);
12849
- if (Math.abs(r - i) < .002) break;
12850
- i = r;
12867
+ let n = i(t);
12868
+ if (Math.abs(n - o) < .002) break;
12869
+ o = n;
12851
12870
  }
12852
- let a = this.atlas.exportDiagramSvg({
12871
+ let s = this.atlas.exportDiagramSvg({
12853
12872
  ...e,
12854
- observerScale: i
12873
+ observerScale: o
12855
12874
  });
12856
- this.result = a;
12857
- let o = this.root.scrollLeft, s = this.root.scrollTop;
12858
- this.content.innerHTML = a.svg;
12859
- let c = this.content.querySelector("svg");
12860
- return c.style.width = `${Math.round(a.width * i)}px`, c.style.height = `${Math.round(a.height * i)}px`, this.root.scrollLeft = this.zoom === "fit" ? 0 : o, this.root.scrollTop = this.zoom === "fit" ? 0 : s, this._syncSelection(), !0;
12875
+ this.zoom === "fit" && (this._lastFitZoom = o), this.result = s;
12876
+ let c = this.root.scrollLeft, l = this.root.scrollTop;
12877
+ this.content.innerHTML = s.svg;
12878
+ let u = this.content.querySelector("svg");
12879
+ return u.style.width = `${Math.round(s.width * o)}px`, u.style.height = `${Math.round(s.height * o)}px`, this.root.scrollLeft = this.zoom === "fit" ? 0 : c, this.root.scrollTop = this.zoom === "fit" ? 0 : l, this._syncSelection(), this.atlas._positionJumpButton?.(), !0;
12861
12880
  }
12862
12881
  _syncSelection() {
12863
12882
  if (this.content.querySelectorAll(".selected").forEach((e) => e.classList.remove("selected")), this.atlas.selectedId) for (let e of this.content.querySelectorAll("[data-entity]")) e.dataset.entity === this.atlas.selectedId && e.classList.add("selected");
12864
12883
  if (this.atlas.selectedRelation?.id) for (let e of this.content.querySelectorAll("[data-relation]")) e.dataset.relation === this.atlas.selectedRelation.id && e.classList.add("selected");
12884
+ this.atlas._positionJumpButton?.();
12865
12885
  }
12866
12886
  _syncControls() {
12867
12887
  let e = this.atlas.toolbar;
@@ -12914,7 +12934,7 @@ var Il = class {
12914
12934
  }
12915
12935
  focusSelection() {
12916
12936
  if (this.zoom === "fit" && this.result) {
12917
- let e = Math.min(1, (this.root.clientWidth - 32) / this.result.width, (this.root.clientHeight - 32) / this.result.height);
12937
+ let e = this._lastFitZoom || 1;
12918
12938
  this.zoom = xl(Math.max(.75, e * 1.8), .08, 4), this.refresh();
12919
12939
  }
12920
12940
  let e = [...this.content.querySelectorAll("[data-entity], [data-relation]")].find((e) => e.dataset.entity === this.atlas.selectedId || e.dataset.relation === this.atlas.selectedRelation?.id);
@@ -12926,8 +12946,8 @@ var Il = class {
12926
12946
  if (!e) return !1;
12927
12947
  if (e === "diagram-fit") return this.zoom = "fit", this.refresh(), !0;
12928
12948
  if (e === "diagram-plus" || e === "diagram-minus") {
12929
- let t = this.zoom === "fit" ? Math.min(1, (this.root.clientWidth - 32) / (this.result?.width || 1), (this.root.clientHeight - 32) / (this.result?.height || 1)) : this.zoom;
12930
- return this.zoom = xl(t * (e === "diagram-plus" ? 1.4 : 1 / 1.4), .08, 4), this.refresh(), !0;
12949
+ let t = this.zoom === "fit" ? this._lastFitZoom || 1 : this.zoom;
12950
+ return this.zoom = xl(t * (e === "diagram-plus" ? 1.15 : 1 / 1.15), .08, 4), this.refresh(), !0;
12931
12951
  }
12932
12952
  if (e === "labels") return this.setConfig({ labels: !this.config.labels }, { layout: !0 }), !0;
12933
12953
  if (e === "diagram-cube") return this.setConfig({ showOrientationCube: !this.config.showOrientationCube }), !0;
@@ -12967,7 +12987,7 @@ var Il = class {
12967
12987
  return !1;
12968
12988
  }
12969
12989
  _bind() {
12970
- this.atlas.addEventListener("lc-select", () => {
12990
+ this.root.addEventListener("scroll", () => this.atlas._positionJumpButton?.()), this.atlas.addEventListener("lc-select", () => {
12971
12991
  this.atlas.viewMode === "2d" && ([
12972
12992
  "selected",
12973
12993
  "callers",
@@ -13050,7 +13070,7 @@ var Il = class {
13050
13070
  this.root.scrollLeft -= t, this.root.scrollTop -= n;
13051
13071
  let i = t + this.root.scrollLeft - e, a = n + this.root.scrollTop - r;
13052
13072
  if ((i || a) && this.config.cameraZoom > 1) {
13053
- let e = Ml(this.config.cameraView), t = this.zoom === "fit" ? Math.min(1, this.root.clientWidth / (this.result?.width || 1), this.root.clientHeight / (this.result?.height || 1)) : this.zoom, n = Fl(this.config.cameraView.target, e, i, a, 80 * Math.max(.08, t));
13073
+ let e = Ml(this.config.cameraView), t = this.zoom === "fit" ? this._lastFitZoom || 1 : this.zoom, n = Fl(this.config.cameraView.target, e, i, a, 80 * Math.max(.08, t));
13054
13074
  this.setConfig({ cameraView: jl(n, e.yaw, e.pitch) }, {
13055
13075
  layout: !0,
13056
13076
  defer: !0
@@ -13065,7 +13085,7 @@ var Il = class {
13065
13085
  this.root.addEventListener("pointerup", t), this.root.addEventListener("pointercancel", t), this.root.addEventListener("contextmenu", (e) => e.preventDefault()), this.root.addEventListener("wheel", (e) => {
13066
13086
  if (!e.altKey && !e.ctrlKey) return;
13067
13087
  e.preventDefault();
13068
- let t = this.zoom === "fit" ? Math.min(1, this.root.clientWidth / (this.result?.width || 1), this.root.clientHeight / (this.result?.height || 1)) : this.zoom;
13088
+ let t = this.zoom === "fit" ? this._lastFitZoom || 1 : this.zoom;
13069
13089
  this.zoom = xl(t * (e.deltaY < 0 ? 1.15 : 1 / 1.15), .08, 4), this.scheduleRefresh();
13070
13090
  }, { passive: !1 });
13071
13091
  }
@@ -13075,35 +13095,70 @@ var Il = class {
13075
13095
  function Ll(e, t = null) {
13076
13096
  let n = String(e || "").trim();
13077
13097
  if (!n.startsWith("atlas:")) throw TypeError("Expected an atlas: reference.");
13078
- let r = n.slice(6);
13079
- if (r.startsWith("//")) throw TypeError("Atlas authorities are not supported.");
13080
- let i = r.indexOf("#"), a = i < 0 ? r : r.slice(0, i), o = i < 0 ? "" : decodeURIComponent(r.slice(i + 1)), s = t ? Ll(t).uri.slice(6) : "/";
13081
- if (!a && !t) throw TypeError("An Atlas reference needs a document path.");
13082
- if (!a) return {
13083
- uri: "atlas:" + s,
13084
- fragment: o
13085
- };
13086
- let c = a.startsWith("/") ? [] : s.split("/").slice(0, -1).filter(Boolean);
13087
- for (let e of a.split("/")) if (e && e !== ".") {
13088
- if (e === "..") {
13089
- if (!c.length) throw TypeError("Atlas reference escapes the collection root.");
13090
- c.pop();
13091
- } else c.push(decodeURIComponent(e));
13098
+ let r = n.slice(6), i = r.indexOf("#"), a = i < 0 ? r : r.slice(0, i), o = i < 0 ? "" : decodeURIComponent(r.slice(i + 1)), s = a.indexOf("?"), c = s < 0 ? a : a.slice(0, s), l = new URLSearchParams(s < 0 ? "" : a.slice(s + 1));
13099
+ if ([...l.keys()].some((e) => e !== "model") || l.getAll("model").length > 1) throw TypeError("Atlas references only accept one model selector.");
13100
+ let u = l.get("model");
13101
+ if (u === "") throw TypeError("The Atlas model selector cannot be empty.");
13102
+ let d = u === null ? "" : "?model=" + encodeURIComponent(u), f = t ? Ll(t) : null;
13103
+ if (c.startsWith("//")) {
13104
+ let e = /^\/\/cloud\/([^/@?#]+)@(published|draft|r[1-9]\d*)$/.exec(c);
13105
+ if (!e) throw TypeError("Expected atlas://cloud/<documentId>@published, @draft or @rN.");
13106
+ let t = decodeURIComponent(e[1]);
13107
+ if (!/^[a-zA-Z0-9_-]+$/.test(t)) throw TypeError("Invalid Atlas cloud document ID.");
13108
+ return {
13109
+ uri: "atlas://cloud/" + encodeURIComponent(t) + "@" + e[2] + d,
13110
+ fragment: o
13111
+ };
13112
+ }
13113
+ if (!c) {
13114
+ if (!f) throw TypeError("An Atlas reference needs a document path.");
13115
+ let e = f.uri.split("?")[0];
13116
+ return {
13117
+ uri: s < 0 ? f.uri : e + d,
13118
+ fragment: o
13119
+ };
13120
+ }
13121
+ if (f?.uri.startsWith("atlas://cloud/")) throw TypeError("Cloud documents cannot reference local files.");
13122
+ let p = c.startsWith("/") ? [] : (f?.uri.slice(6).split("?")[0] || "/").split("/").slice(0, -1).filter(Boolean).map(decodeURIComponent);
13123
+ for (let e of c.split("/")) {
13124
+ let t = decodeURIComponent(e);
13125
+ if (t && t !== ".") {
13126
+ if (t === "..") {
13127
+ if (!p.length) throw TypeError("Atlas reference escapes the collection root.");
13128
+ p.pop();
13129
+ } else {
13130
+ if (/[\/\\]/.test(t)) throw TypeError("Invalid Atlas path segment.");
13131
+ p.push(t);
13132
+ }
13133
+ }
13092
13134
  }
13093
13135
  return {
13094
- uri: "atlas:/" + c.map(encodeURIComponent).join("/"),
13136
+ uri: "atlas:/" + p.map(encodeURIComponent).join("/") + d,
13095
13137
  fragment: o
13096
13138
  };
13097
13139
  }
13140
+ function Rl(e, t = null) {
13141
+ let n = Ll(e, t), r = n.uri.split("?")[0], i = new URLSearchParams(n.uri.split("?")[1] || "").get("model"), a = /^atlas:\/\/cloud\/([^/]+)@(published|draft|r[1-9]\d*)$/.exec(r);
13142
+ return {
13143
+ ...n,
13144
+ documentUri: r,
13145
+ modelName: i,
13146
+ kind: a ? "cloud" : "local",
13147
+ ...a ? {
13148
+ documentId: decodeURIComponent(a[1]),
13149
+ version: a[2]
13150
+ } : { path: r.slice(7).split("/").map(decodeURIComponent).join("/") }
13151
+ };
13152
+ }
13098
13153
  //#endregion
13099
13154
  //#region src/panel-content.js
13100
- var Rl = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
13155
+ var zl = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
13101
13156
  "&": "&amp;",
13102
13157
  "<": "&lt;",
13103
13158
  ">": "&gt;",
13104
13159
  "\"": "&quot;",
13105
13160
  "'": "&#39;"
13106
- })[e]), zl = /* @__PURE__ */ new Set([
13161
+ })[e]), Bl = /* @__PURE__ */ new Set([
13107
13162
  "P",
13108
13163
  "BR",
13109
13164
  "H1",
@@ -13127,7 +13182,7 @@ var Rl = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
13127
13182
  "TH",
13128
13183
  "TD"
13129
13184
  ]);
13130
- function Bl(e, { title: t = "" } = {}) {
13185
+ function Vl(e, { title: t = "" } = {}) {
13131
13186
  let n = new DOMParser().parseFromString(String(e || ""), "text/html"), r = n.body.firstElementChild;
13132
13187
  r && /^H[1-4]$/.test(r.tagName) && t && r.textContent.trim().toLocaleLowerCase() === String(t).trim().toLocaleLowerCase() && r.remove();
13133
13188
  for (let e of n.body.querySelectorAll("a")) {
@@ -13138,7 +13193,7 @@ function Bl(e, { title: t = "" } = {}) {
13138
13193
  for (let t of [...e.children]) {
13139
13194
  let n = t.tagName === "A" ? t.dataset.atlasSafeHref : "";
13140
13195
  for (let e of [...t.attributes]) t.removeAttribute(e.name);
13141
- if (!zl.has(t.tagName)) {
13196
+ if (!Bl.has(t.tagName)) {
13142
13197
  t.replaceWith(...t.childNodes), i(e);
13143
13198
  continue;
13144
13199
  }
@@ -13147,17 +13202,17 @@ function Bl(e, { title: t = "" } = {}) {
13147
13202
  };
13148
13203
  return i(n.body), n.body.innerHTML;
13149
13204
  }
13150
- function Vl(e) {
13151
- return Rl(e).replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*]+)\*/g, "<em>$1</em>").replace(/\[([^\]]+)\]\((atlas:[^)]+|https?:\/\/[^)]+)\)/g, "<a href=\"$2\">$1</a>");
13205
+ function Hl(e) {
13206
+ return zl(e).replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*]+)\*/g, "<em>$1</em>").replace(/\[([^\]]+)\]\((atlas:[^)]+|https?:\/\/[^)]+)\)/g, "<a href=\"$2\">$1</a>");
13152
13207
  }
13153
- function Hl(e, t = {}) {
13208
+ function Ul(e, t = {}) {
13154
13209
  if (!e || typeof e != "object") return "";
13155
- if (e.format === "html") return Bl(e.value || "", t);
13210
+ if (e.format === "html") return Vl(e.value || "", t);
13156
13211
  if (e.format !== "markdown") return "";
13157
13212
  let n = [], r = [], i = "ul", a = [], o = !1, s = () => {
13158
- r.length && n.push("<" + i + ">" + r.map((e) => "<li>" + Vl(e) + "</li>").join("") + "</" + i + ">"), r = [];
13213
+ r.length && n.push("<" + i + ">" + r.map((e) => "<li>" + Hl(e) + "</li>").join("") + "</" + i + ">"), r = [];
13159
13214
  };
13160
- for (let t of String(e.value || "").split(/\r?\n/)) if (/^\s*```/.test(t)) s(), o && (n.push("<pre><code>" + Rl(a.join("\n")) + "</code></pre>"), a = []), o = !o;
13215
+ for (let t of String(e.value || "").split(/\r?\n/)) if (/^\s*```/.test(t)) s(), o && (n.push("<pre><code>" + zl(a.join("\n")) + "</code></pre>"), a = []), o = !o;
13161
13216
  else if (o) a.push(t);
13162
13217
  else if (/^\s*([-*]|\d+\.) /.test(t)) {
13163
13218
  let e = /^\s*\d+\./.test(t) ? "ol" : "ul";
@@ -13169,53 +13224,53 @@ function Hl(e, t = {}) {
13169
13224
  continue;
13170
13225
  }
13171
13226
  if (/^>\s?/.test(t)) {
13172
- n.push("<blockquote>" + Vl(t.replace(/^>\s?/, "")) + "</blockquote>");
13227
+ n.push("<blockquote>" + Hl(t.replace(/^>\s?/, "")) + "</blockquote>");
13173
13228
  continue;
13174
13229
  }
13175
13230
  let e = /^(#{1,4})\s+(.+)$/.exec(t);
13176
- n.push(e ? `<h${e[1].length}>${Vl(e[2])}</h${e[1].length}>` : "<p>" + Vl(t) + "</p>");
13231
+ n.push(e ? `<h${e[1].length}>${Hl(e[2])}</h${e[1].length}>` : "<p>" + Hl(t) + "</p>");
13177
13232
  }
13178
- return s(), a.length && n.push("<pre><code>" + Rl(a.join("\n")) + "</code></pre>"), Bl(n.join(""), t);
13233
+ return s(), a.length && n.push("<pre><code>" + zl(a.join("\n")) + "</code></pre>"), Vl(n.join(""), t);
13179
13234
  }
13180
13235
  //#endregion
13181
13236
  //#region src/liquidcars-atlas.js
13182
- var Ul = el.version, Wl = {
13237
+ var Wl = el.version, Gl = {
13183
13238
  component: "#8ae4d0",
13184
13239
  connection: "#f4edba"
13185
- }, Gl = "cone", Kl = Object.freeze([
13240
+ }, Kl = "cone", ql = Object.freeze([
13186
13241
  "all",
13187
13242
  "selected",
13188
13243
  "callers",
13189
13244
  "called",
13190
13245
  "none"
13191
- ]), ql = .05, Jl = 6, Yl = 15, Xl = /* @__PURE__ */ new Map(), Zl = /* @__PURE__ */ new Map(), Ql = /* @__PURE__ */ new Map();
13192
- function $l(e) {
13193
- return Array.isArray(e) ? e.map($l) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).filter(([, e]) => typeof e != "function" && e !== void 0).map(([e, t]) => [e, $l(t)]));
13194
- }
13246
+ ]), Jl = .05, Yl = 6, Xl = 15, Zl = /* @__PURE__ */ new Map(), Ql = /* @__PURE__ */ new Map(), $l = /* @__PURE__ */ new Map();
13195
13247
  function eu(e) {
13196
- return (e == null ? [] : Array.isArray(e) ? e : [e]).map((e) => typeof e == "string" ? { name: e } : $l(e)).filter((e) => e && String(e.name || "").trim()).map((e) => ({
13248
+ return Array.isArray(e) ? e.map(eu) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).filter(([, e]) => typeof e != "function" && e !== void 0).map(([e, t]) => [e, eu(t)]));
13249
+ }
13250
+ function tu(e) {
13251
+ return (e == null ? [] : Array.isArray(e) ? e : [e]).map((e) => typeof e == "string" ? { name: e } : eu(e)).filter((e) => e && String(e.name || "").trim()).map((e) => ({
13197
13252
  ...e,
13198
13253
  name: String(e.name).trim()
13199
13254
  }));
13200
13255
  }
13201
- function tu(e) {
13256
+ function nu(e) {
13202
13257
  return [...new Set((e == null ? [] : Array.isArray(e) ? e : [e]).map((e) => String(e || "").trim()).filter(Boolean))];
13203
13258
  }
13204
- function nu(e) {
13205
- return e ? typeof e == "string" ? { spdx: e } : $l(e) : null;
13259
+ function ru(e) {
13260
+ return e ? typeof e == "string" ? { spdx: e } : eu(e) : null;
13206
13261
  }
13207
- function ru(e, t) {
13208
- let n = $l(e || {}), r = String(n.id || `source-${t + 1}`).trim();
13262
+ function iu(e, t) {
13263
+ let n = eu(e || {}), r = String(n.id || `source-${t + 1}`).trim();
13209
13264
  if (!r) throw TypeError("Geometry pack sources require an id.");
13210
13265
  return {
13211
13266
  ...n,
13212
13267
  id: r,
13213
- authors: eu(n.authors ?? n.author),
13214
- license: nu(n.license)
13268
+ authors: tu(n.authors ?? n.author),
13269
+ license: ru(n.license)
13215
13270
  };
13216
13271
  }
13217
- function iu(e, t, n) {
13218
- let r = $l(e || {}), i = String(r.id || "").trim();
13272
+ function au(e, t, n) {
13273
+ let r = eu(e || {}), i = String(r.id || "").trim();
13219
13274
  if (!i) throw TypeError(`Geometry pack resource at index ${t} requires an id.`);
13220
13275
  let a = r.source == null ? null : String(r.source).trim();
13221
13276
  if (a && !n.has(a)) throw TypeError(`Geometry pack resource '${i}' references unknown source '${a}'.`);
@@ -13224,13 +13279,13 @@ function iu(e, t, n) {
13224
13279
  id: i,
13225
13280
  kind: String(r.kind || r.type || "asset"),
13226
13281
  source: a,
13227
- authors: eu(r.authors ?? r.author),
13228
- license: nu(r.license)
13282
+ authors: tu(r.authors ?? r.author),
13283
+ license: ru(r.license)
13229
13284
  };
13230
13285
  }
13231
- function au(e, t) {
13286
+ function ou(e, t) {
13232
13287
  if (!e.showcase || typeof e.showcase != "object") return null;
13233
- let n = $l(e.showcase), r = Array.isArray(n.groups) ? n.groups : [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = r.map((e, n) => {
13288
+ let n = eu(e.showcase), r = Array.isArray(n.groups) ? n.groups : [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = r.map((e, n) => {
13234
13289
  let r = e && typeof e == "object" ? e : {}, o = String(r.id || `group-${n + 1}`).trim();
13235
13290
  if (!o || i.has(o)) throw TypeError(`Geometry pack '${t}' showcase contains a duplicate or empty group id.`);
13236
13291
  i.add(o);
@@ -13248,8 +13303,8 @@ function au(e, t) {
13248
13303
  ...r,
13249
13304
  id: s,
13250
13305
  geometry: i.includes(".") ? i : `${t}.${i}`,
13251
- geometryOptions: $l(r.geometryOptions || r.options || r.parameters || {}),
13252
- geometryPalette: $l(r.geometryPalette || r.palette || {})
13306
+ geometryOptions: eu(r.geometryOptions || r.options || r.parameters || {}),
13307
+ geometryPalette: eu(r.geometryPalette || r.palette || {})
13253
13308
  };
13254
13309
  })
13255
13310
  };
@@ -13259,11 +13314,11 @@ function au(e, t) {
13259
13314
  title: String(n.title || e.name || t),
13260
13315
  description: String(n.description || ""),
13261
13316
  groups: o,
13262
- relations: $l(Array.isArray(n.relations) ? n.relations : [])
13317
+ relations: eu(Array.isArray(n.relations) ? n.relations : [])
13263
13318
  };
13264
13319
  }
13265
- function ou(e, t) {
13266
- let n = (Array.isArray(e.sources) ? e.sources : []).map(ru), r = new Set(n.map((e) => e.id)), i = (Array.isArray(e.resources) ? e.resources : []).map((e, t) => iu(e, t, r));
13320
+ function su(e, t) {
13321
+ let n = (Array.isArray(e.sources) ? e.sources : []).map(iu), r = new Set(n.map((e) => e.id)), i = (Array.isArray(e.resources) ? e.resources : []).map((e, t) => au(e, t, r));
13267
13322
  if (new Set(i.map((e) => e.id)).size !== i.length) throw TypeError(`Geometry pack '${t}' contains duplicate resource ids.`);
13268
13323
  return {
13269
13324
  namespace: t,
@@ -13272,36 +13327,36 @@ function ou(e, t) {
13272
13327
  description: String(e.description || ""),
13273
13328
  category: String(e.category || e.name || t),
13274
13329
  homepage: e.homepage ? String(e.homepage) : "",
13275
- repository: $l(e.repository || null),
13276
- authors: eu(e.authors ?? e.author),
13277
- license: nu(e.license),
13330
+ repository: eu(e.repository || null),
13331
+ authors: tu(e.authors ?? e.author),
13332
+ license: ru(e.license),
13278
13333
  attribution: String(e.attribution || ""),
13279
- collections: $l(Array.isArray(e.collections) ? e.collections : []),
13280
- showcase: au(e, t),
13334
+ collections: eu(Array.isArray(e.collections) ? e.collections : []),
13335
+ showcase: ou(e, t),
13281
13336
  sources: n,
13282
13337
  resources: i,
13283
13338
  geometries: []
13284
13339
  };
13285
13340
  }
13286
- function su(e) {
13341
+ function cu(e) {
13287
13342
  let { create: t, resourceMap: n, ...r } = e;
13288
13343
  return {
13289
- ...$l(r),
13344
+ ...eu(r),
13290
13345
  canonicalSize: [...e.canonicalSize],
13291
- parameters: $l(e.parameters),
13292
- palette: $l(e.palette),
13293
- anchors: $l(e.anchors)
13346
+ parameters: eu(e.parameters),
13347
+ palette: eu(e.palette),
13348
+ anchors: eu(e.anchors)
13294
13349
  };
13295
13350
  }
13296
- function cu(e) {
13297
- return $l(e);
13298
- }
13299
13351
  function lu(e) {
13352
+ return eu(e);
13353
+ }
13354
+ function uu(e) {
13300
13355
  if (!e || typeof e != "object") throw TypeError("A geometry pack must be an object.");
13301
13356
  let t = String(e.namespace || "").trim();
13302
13357
  if (!/^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*$/i.test(t)) throw TypeError("A geometry pack requires a valid dot-separated namespace.");
13303
13358
  if (!Array.isArray(e.geometries) || !e.geometries.length) throw TypeError("A geometry pack requires at least one geometry.");
13304
- let n = ou(e, t), r = Object.freeze(Object.fromEntries(n.resources.map((e) => [e.id, Object.freeze($l(e))]))), i = [];
13359
+ let n = su(e, t), r = Object.freeze(Object.fromEntries(n.resources.map((e) => [e.id, Object.freeze(eu(e))]))), i = [];
13305
13360
  for (let a of e.geometries) {
13306
13361
  if (!a || typeof a != "object" || !a.id) throw TypeError(`Geometry pack '${t}' contains an invalid geometry.`);
13307
13362
  let o = String(a.id).includes(".") ? String(a.id).split(".").pop() : String(a.id), s = String(a.id).includes(".") ? String(a.id) : `${t}.${o}`;
@@ -13314,8 +13369,8 @@ function lu(e) {
13314
13369
  packVersion: n.version,
13315
13370
  category: a.category || n.category,
13316
13371
  collection: a.collection == null ? "" : String(a.collection).trim(),
13317
- tags: tu(a.tags),
13318
- keywords: tu(a.keywords),
13372
+ tags: nu(a.tags),
13373
+ keywords: nu(a.keywords),
13319
13374
  canonicalSize: Array.isArray(a.canonicalSize) && a.canonicalSize.length === 3 ? a.canonicalSize.map(Number) : [
13320
13375
  2.5,
13321
13376
  1.5,
@@ -13333,41 +13388,41 @@ function lu(e) {
13333
13388
  resourceMap: r
13334
13389
  });
13335
13390
  }
13336
- uu(t);
13391
+ du(t);
13337
13392
  let a = [];
13338
13393
  for (let e of i) {
13339
- Xl.set(e.id, e), Zl.set(e.id, e.id);
13340
- for (let t of e.aliases || []) Zl.set(String(t), e.id);
13394
+ Zl.set(e.id, e), Ql.set(e.id, e.id);
13395
+ for (let t of e.aliases || []) Ql.set(String(t), e.id);
13341
13396
  a.push(e.id);
13342
13397
  }
13343
- n.geometries = [...a], Ql.set(t, n);
13344
- let o = cu(n);
13398
+ n.geometries = [...a], $l.set(t, n);
13399
+ let o = lu(n);
13345
13400
  return typeof globalThis.dispatchEvent == "function" && typeof CustomEvent == "function" && globalThis.dispatchEvent(new CustomEvent("lc-geometry-registry-change", { detail: {
13346
13401
  namespace: t,
13347
13402
  geometries: a,
13348
13403
  pack: o
13349
13404
  } })), o;
13350
13405
  }
13351
- function uu(e) {
13406
+ function du(e) {
13352
13407
  let t = [];
13353
- for (let [n, r] of Xl) r.namespace === e && (Xl.delete(n), t.push(n));
13354
- for (let [e, n] of Zl) t.includes(n) && Zl.delete(e);
13355
- return Ql.delete(e), t;
13356
- }
13357
- function du() {
13358
- return [...Xl.values()].map(su);
13408
+ for (let [n, r] of Zl) r.namespace === e && (Zl.delete(n), t.push(n));
13409
+ for (let [e, n] of Ql) t.includes(n) && Ql.delete(e);
13410
+ return $l.delete(e), t;
13359
13411
  }
13360
13412
  function fu() {
13361
- return [...Ql.values()].map(cu);
13413
+ return [...Zl.values()].map(cu);
13362
13414
  }
13363
- function pu(e) {
13364
- let t = Zl.get(e) || e;
13365
- return Xl.get(t) || null;
13415
+ function pu() {
13416
+ return [...$l.values()].map(lu);
13366
13417
  }
13367
13418
  function mu(e) {
13419
+ let t = Ql.get(e) || e;
13420
+ return Zl.get(t) || null;
13421
+ }
13422
+ function hu(e) {
13368
13423
  return e === "container" || e === "shell";
13369
13424
  }
13370
- function hu(e = {}) {
13425
+ function gu(e = {}) {
13371
13426
  let t = e && typeof e == "object" ? e : {}, n = Number(t.opacity);
13372
13427
  return {
13373
13428
  mode: t.mode === "connected" ? "connected" : "all",
@@ -13376,26 +13431,26 @@ function hu(e = {}) {
13376
13431
  opacity: Number.isFinite(n) ? Math.max(.02, Math.min(.8, n)) : .12
13377
13432
  };
13378
13433
  }
13379
- function gu(e) {
13434
+ function _u(e) {
13380
13435
  return [
13381
13436
  "preserve",
13382
13437
  "center",
13383
13438
  "fit"
13384
13439
  ].includes(e) ? e : "preserve";
13385
13440
  }
13386
- function _u(e) {
13387
- return e === "model" ? "model" : "camera";
13388
- }
13389
13441
  function vu(e) {
13390
- return e === "ring" ? "ring" : Gl;
13442
+ return e === "model" ? "model" : "camera";
13391
13443
  }
13392
13444
  function yu(e) {
13393
- return Kl.includes(e) ? e : "selected";
13445
+ return e === "ring" ? "ring" : Kl;
13446
+ }
13447
+ function bu(e) {
13448
+ return ql.includes(e) ? e : "selected";
13394
13449
  }
13395
- function bu(e, t) {
13450
+ function xu(e, t) {
13396
13451
  e && e.transparent !== t && (e.transparent = t, e.needsUpdate = !0);
13397
13452
  }
13398
- lu({
13453
+ uu({
13399
13454
  namespace: "geo",
13400
13455
  name: "Geometric primitives",
13401
13456
  version: "1",
@@ -13452,7 +13507,7 @@ lu({
13452
13507
  } } : {}
13453
13508
  }))
13454
13509
  });
13455
- var xu = {
13510
+ var Su = {
13456
13511
  background: {
13457
13512
  color: "#0a111a",
13458
13513
  glow: "#1c2b39",
@@ -13497,17 +13552,17 @@ var xu = {
13497
13552
  hint: !0
13498
13553
  }
13499
13554
  };
13500
- function Su(e, t) {
13555
+ function Cu(e, t) {
13501
13556
  let n = { ...e };
13502
13557
  if (!t || typeof t != "object") return n;
13503
- for (let [r, i] of Object.entries(t)) n[r] = i && typeof i == "object" && !Array.isArray(i) ? Su(e?.[r] || {}, i) : i;
13558
+ for (let [r, i] of Object.entries(t)) n[r] = i && typeof i == "object" && !Array.isArray(i) ? Cu(e?.[r] || {}, i) : i;
13504
13559
  return n;
13505
13560
  }
13506
- function Cu(e) {
13561
+ function wu(e) {
13507
13562
  let t = e && typeof e == "object" ? { ...e } : {};
13508
- return typeof e == "string" ? t.background = { color: e } : typeof t.background == "string" && (t.background = { color: t.background }), Su(xu, t);
13563
+ return typeof e == "string" ? t.background = { color: e } : typeof t.background == "string" && (t.background = { color: t.background }), Cu(Su, t);
13509
13564
  }
13510
- function wu(e) {
13565
+ function Tu(e) {
13511
13566
  if (!e || typeof e != "object") return "directed";
13512
13567
  let t = String(e.mode || e.visual || e.render || e.type || e.direction || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
13513
13568
  return e.bidirectional === !0 || [
@@ -13522,7 +13577,7 @@ function wu(e) {
13522
13577
  "failed"
13523
13578
  ].includes(t) ? "broken" : "directed";
13524
13579
  }
13525
- var Tu = [":host{display:block;position:relative;height:var(--lc-height,680px);min-height:420px;color:var(--lc-panel-title,#e9f0f5);font:14px Inter,system-ui,-apple-system,sans-serif;background:var(--lc-bg,#0a111a);border:1px solid #294252;border-radius:12px;overflow:hidden;contain:content}", "*{box-sizing:border-box}.atlas{display:grid;grid-template-columns:minmax(0,1fr) 300px;height:100%}.atlas[data-panel=hidden]{grid-template-columns:1fr}.viewport{position:relative;min-width:0;overflow:hidden;background:radial-gradient(ellipse at 50% 45%,var(--lc-bg-glow,#1c2b39),var(--lc-bg-fade,#0a111a) 82%)}canvas{display:block;width:100%;height:100%;cursor:grab;touch-action:none}.toolbar{position:absolute;z-index:10;bottom:28px;left:50%;transform:translateX(-50%);display:flex;gap:3px;padding:6px;background:var(--lc-toolbar-bg,#15232fe8);border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:8px;white-space:nowrap}.toolbar[data-hidden=true],.toolbar[hidden],.panel[data-hidden=true],.panel[hidden],.crumbs[data-hidden=true],.crumbs[hidden],.hint[data-hidden=true],.hint[hidden]{display:none!important}.toolbar button{height:30px;padding:0 9px;border:0;border-radius:5px;background:none;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer}.toolbar button:hover,.toolbar button.active{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.toolbar i{display:block;width:1px;margin:2px 3px;background:#38515f}.hint{position:absolute;z-index:9;top:8px;bottom:auto;left:0;right:0;text-align:center;padding:2px 8px;font-size:11px;line-height:16px;color:var(--lc-hint,#8da6b8);pointer-events:none}.panel{overflow:auto;padding:24px 20px;background:var(--lc-panel-bg,linear-gradient(140deg,#182633,#0e1925 65%));border-left:1px solid var(--lc-panel-border,#2a3a48)}.panel h2{font-size:26px;line-height:1.12;font-weight:470;margin:12px 0;color:var(--lc-panel-title,#e9f0f5)}.panel h3{font-size:11px;letter-spacing:1.4px;color:#91aabd;margin:24px 0 10px}.panel p{font-size:14px;line-height:1.55;color:var(--lc-panel-text,#b5c6d2)}.panel .eyebrow{font-size:11px;letter-spacing:1.7px;color:#6ad7c0}.panel .sub{font-size:13px;color:#8fa8bd;margin-bottom:16px}.panel .external-link{display:inline-flex;align-items:center;gap:6px;margin:2px 0 12px;color:#6ad7c0;font-size:13px;font-weight:600;text-decoration:none}.panel .external-link:hover{text-decoration:underline}.panel button{display:block;width:100%;padding:10px 0;text-align:left;background:none;border:0;border-bottom:1px solid var(--lc-panel-border,#2a3a48);color:#d9e7eb;cursor:pointer}.panel button:hover{color:#6ad7c0}.panel .relation{padding:10px 0;border-bottom:1px solid var(--lc-panel-border,#2a3a48)}.panel .relation.selected{padding-left:9px;border-left:2px solid #6ad7c0;background:#18343f}.panel .relation strong{display:block;font-weight:550}.panel .relation small{display:block;color:#86a6b9;font-size:12px;margin-top:4px}.panel .back{color:#9db7c8;font-size:13px}.panel .crumbs{display:flex;flex-wrap:wrap;gap:5px;align-items:center;margin:0 0 12px}.panel .crumbs button{display:inline;width:auto;padding:3px 7px;border:0;border-radius:4px;background:var(--lc-crumb-bg,#142733);color:var(--lc-crumb-text,#91b6c7);font-size:12px}.panel .crumbs button.current{background:var(--lc-crumb-active,#1c4a4d);color:var(--lc-crumb-active-text,#c5f2e9)}.panel .note{border-top:1px solid var(--lc-panel-border,#2a3a48);padding-top:16px;margin-top:22px;font-size:12px;color:#7692a6}.error{position:absolute;inset:20%;padding:18px;background:#172b3b;border:1px solid #7896a9;line-height:1.5;z-index:4}@media(max-width:900px){.toolbar{gap:0}.toolbar button{padding:0 6px;font-size:12px}}@media(max-width:760px){:host{height:680px}.atlas{grid-template-columns:1fr;grid-template-rows:minmax(420px,1fr) auto}.panel{max-height:250px;border-left:0;border-top:1px solid var(--lc-panel-border,#2a3a48);padding:18px}.toolbar{bottom:24px}.hint{top:8px;bottom:auto;display:block}}"].join(""), Eu = [
13580
+ var Eu = [":host{display:block;position:relative;height:var(--lc-height,680px);min-height:420px;color:var(--lc-panel-title,#e9f0f5);font:14px Inter,system-ui,-apple-system,sans-serif;background:var(--lc-bg,#0a111a);border:1px solid #294252;border-radius:12px;overflow:hidden;contain:content}", "*{box-sizing:border-box}.atlas{display:grid;grid-template-columns:minmax(0,1fr) 300px;height:100%}.atlas[data-panel=hidden]{grid-template-columns:1fr}.viewport{position:relative;min-width:0;overflow:hidden;background:radial-gradient(ellipse at 50% 45%,var(--lc-bg-glow,#1c2b39),var(--lc-bg-fade,#0a111a) 82%)}canvas{display:block;width:100%;height:100%;cursor:grab;touch-action:none}.toolbar{position:absolute;z-index:10;bottom:28px;left:50%;transform:translateX(-50%);display:flex;gap:3px;padding:6px;background:var(--lc-toolbar-bg,#15232fe8);border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:8px;white-space:nowrap}.toolbar[data-hidden=true],.toolbar[hidden],.panel[data-hidden=true],.panel[hidden],.crumbs[data-hidden=true],.crumbs[hidden],.hint[data-hidden=true],.hint[hidden]{display:none!important}.toolbar button{height:30px;padding:0 9px;border:0;border-radius:5px;background:none;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer}.toolbar button:hover,.toolbar button.active{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.toolbar i{display:block;width:1px;margin:2px 3px;background:#38515f}.hint{position:absolute;z-index:9;top:8px;bottom:auto;left:0;right:0;text-align:center;padding:2px 8px;font-size:11px;line-height:16px;color:var(--lc-hint,#8da6b8);pointer-events:none}.panel{overflow:auto;padding:24px 20px;background:var(--lc-panel-bg,linear-gradient(140deg,#182633,#0e1925 65%));border-left:1px solid var(--lc-panel-border,#2a3a48)}.panel h2{font-size:26px;line-height:1.12;font-weight:470;margin:12px 0;color:var(--lc-panel-title,#e9f0f5)}.panel h3{font-size:11px;letter-spacing:1.4px;color:#91aabd;margin:24px 0 10px}.panel p{font-size:14px;line-height:1.55;color:var(--lc-panel-text,#b5c6d2)}.panel .eyebrow{font-size:11px;letter-spacing:1.7px;color:#6ad7c0}.panel .sub{font-size:13px;color:#8fa8bd;margin-bottom:16px}.panel .external-link{display:inline-flex;align-items:center;gap:6px;margin:2px 0 12px;color:#6ad7c0;font-size:13px;font-weight:600;text-decoration:none}.panel .external-link:hover{text-decoration:underline}.panel button{display:block;width:100%;padding:10px 0;text-align:left;background:none;border:0;border-bottom:1px solid var(--lc-panel-border,#2a3a48);color:#d9e7eb;cursor:pointer}.panel button:hover{color:#6ad7c0}.panel .relation{padding:10px 0;border-bottom:1px solid var(--lc-panel-border,#2a3a48)}.panel .relation.selected{padding-left:9px;border-left:2px solid #6ad7c0;background:#18343f}.panel .relation strong{display:block;font-weight:550}.panel .relation small{display:block;color:#86a6b9;font-size:12px;margin-top:4px}.panel .back{color:#9db7c8;font-size:13px}.panel .crumbs{display:flex;flex-wrap:wrap;gap:5px;align-items:center;margin:0 0 12px}.panel .crumbs button{display:inline;width:auto;padding:3px 7px;border:0;border-radius:4px;background:var(--lc-crumb-bg,#142733);color:var(--lc-crumb-text,#91b6c7);font-size:12px}.panel .crumbs button.current{background:var(--lc-crumb-active,#1c4a4d);color:var(--lc-crumb-active-text,#c5f2e9)}.panel .note{border-top:1px solid var(--lc-panel-border,#2a3a48);padding-top:16px;margin-top:22px;font-size:12px;color:#7692a6}.error{position:absolute;inset:20%;padding:18px;background:#172b3b;border:1px solid #7896a9;line-height:1.5;z-index:4}@media(max-width:900px){.toolbar{gap:0}.toolbar button{padding:0 6px;font-size:12px}}@media(max-width:760px){:host{height:680px}.atlas{grid-template-columns:1fr;grid-template-rows:minmax(420px,1fr) auto}.panel{max-height:250px;border-left:0;border-top:1px solid var(--lc-panel-border,#2a3a48);padding:18px}.toolbar{bottom:24px}.hint{top:8px;bottom:auto;display:block}}"].join(""), Du = [
13526
13581
  ".viewport>.atlas-print-snapshot{display:none!important}",
13527
13582
  "@media print{",
13528
13583
  ":host{-webkit-print-color-adjust:exact;print-color-adjust:exact;break-inside:avoid;page-break-inside:avoid}",
@@ -13531,29 +13586,29 @@ var Tu = [":host{display:block;position:relative;height:var(--lc-height,680px);m
13531
13586
  ":host([data-lc-print-ready]) .viewport>canvas:not(.atlas-print-snapshot){display:none!important}",
13532
13587
  ":host([data-lc-print-ready]) .viewport>.atlas-print-snapshot{display:block!important;width:100%;height:100%}",
13533
13588
  "}"
13534
- ].join(""), Du = (e, t = "0 0 24 24") => `<svg viewBox="${t}" aria-hidden="true">${e}</svg>`, Ou = {
13535
- minus: Du("<path d=\"M6 12h12\"/>"),
13536
- plus: Du("<path d=\"M12 6v12M6 12h12\"/>"),
13537
- fit: Du("<path d=\"M9 4H4v5M15 4h5v5M20 15v5h-5M4 15v5h5\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>"),
13538
- front: Du("<rect x=\"4\" y=\"5\" width=\"16\" height=\"14\" rx=\"1.5\"/><path d=\"M8 16h8\"/>"),
13539
- view: Du("<path d=\"M2.5 12s3.5-5 9.5-5 9.5 5 9.5 5-3.5 5-9.5 5-9.5-5-9.5-5Z\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>"),
13540
- relations: Du("<circle cx=\"5\" cy=\"6\" r=\"2\"/><circle cx=\"19\" cy=\"7\" r=\"2\"/><circle cx=\"12\" cy=\"18\" r=\"2\"/><path d=\"m6.8 6.3 10.2.5M6.2 7.7l4.6 8.6m6.8-7.5-4.4 7.5\"/>"),
13541
- focus: Du("<circle cx=\"12\" cy=\"12\" r=\"7\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/><path d=\"M12 2v3M12 19v3M2 12h3M19 12h3\"/>"),
13542
- copy: Du("<rect x=\"8\" y=\"8\" width=\"11\" height=\"11\" rx=\"2\"/><path d=\"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2\"/>"),
13543
- home: Du("<path d=\"m3 11 9-7 9 7\"/><path d=\"M5 10v10h14V10M10 20v-6h4v6\"/>"),
13544
- back: Du("<path d=\"m15 5-7 7 7 7\"/>"),
13545
- forward: Du("<path d=\"m9 5 7 7-7 7\"/>"),
13546
- chevron: Du("<path d=\"m8 10 4 4 4-4\"/>")
13547
- }, ku = (e, t, n = !1) => `<button class="toolbar-option${n ? " active" : ""}" data-action="${e}" aria-pressed="${n}"><span>${t}</span><span class="toolbar-option-check" aria-hidden="true">✓</span></button>`, Au = (e, t) => `<button class="toolbar-option" data-action="${e}" role="menuitem"><span>${t}</span><span aria-hidden="true"></span></button>`;
13548
- function ju(e, t) {
13589
+ ].join(""), Ou = (e, t = "0 0 24 24") => `<svg viewBox="${t}" aria-hidden="true">${e}</svg>`, ku = {
13590
+ minus: Ou("<path d=\"M6 12h12\"/>"),
13591
+ plus: Ou("<path d=\"M12 6v12M6 12h12\"/>"),
13592
+ fit: Ou("<path d=\"M9 4H4v5M15 4h5v5M20 15v5h-5M4 15v5h5\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>"),
13593
+ front: Ou("<rect x=\"4\" y=\"5\" width=\"16\" height=\"14\" rx=\"1.5\"/><path d=\"M8 16h8\"/>"),
13594
+ view: Ou("<path d=\"M2.5 12s3.5-5 9.5-5 9.5 5 9.5 5-3.5 5-9.5 5-9.5-5-9.5-5Z\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>"),
13595
+ relations: Ou("<circle cx=\"5\" cy=\"6\" r=\"2\"/><circle cx=\"19\" cy=\"7\" r=\"2\"/><circle cx=\"12\" cy=\"18\" r=\"2\"/><path d=\"m6.8 6.3 10.2.5M6.2 7.7l4.6 8.6m6.8-7.5-4.4 7.5\"/>"),
13596
+ focus: Ou("<circle cx=\"12\" cy=\"12\" r=\"7\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/><path d=\"M12 2v3M12 19v3M2 12h3M19 12h3\"/>"),
13597
+ copy: Ou("<rect x=\"8\" y=\"8\" width=\"11\" height=\"11\" rx=\"2\"/><path d=\"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2\"/>"),
13598
+ home: Ou("<path d=\"m3 11 9-7 9 7\"/><path d=\"M5 10v10h14V10M10 20v-6h4v6\"/>"),
13599
+ back: Ou("<path d=\"m15 5-7 7 7 7\"/>"),
13600
+ forward: Ou("<path d=\"m9 5 7 7-7 7\"/>"),
13601
+ chevron: Ou("<path d=\"m8 10 4 4 4-4\"/>")
13602
+ }, Au = (e, t, n = !1) => `<button class="toolbar-option${n ? " active" : ""}" data-action="${e}" aria-pressed="${n}"><span>${t}</span><span class="toolbar-option-check" aria-hidden="true">✓</span></button>`, ju = (e, t) => `<button class="toolbar-option" data-action="${e}" role="menuitem"><span>${t}</span><span aria-hidden="true"></span></button>`;
13603
+ function Mu(e, t) {
13549
13604
  return (e?.target?.nodeType === 1 ? e.target : e?.target?.parentElement)?.closest?.(t) || e?.composedPath?.().find((e) => e?.matches?.(t)) || null;
13550
13605
  }
13551
- function Mu(e, t) {
13606
+ function Nu(e, t) {
13552
13607
  let n = t?.relatedTarget;
13553
13608
  return n ? !e?.contains?.(n) : !1;
13554
13609
  }
13555
- var Nu = (e, t, n, r, i) => `<details class="toolbar-menu" data-toolbar-menu="${e}"><summary aria-label="${n}" title="${n}">${t}<span class="toolbar-menu-status" data-toolbar-status="${e}" aria-live="polite">${r}</span>${Ou.chevron}</summary><div class="toolbar-popover" role="menu"><div class="toolbar-popover-title">${n}</div>${i}</div></details>`, Pu = `<div class="toolbar-group" data-toolbar-group="copy">${Nu("copy", Ou.copy, "Copy image", "PNG", Au("copy-theme", "PNG with background · HD 2×") + Au("copy-transparent", "Transparent PNG · HD 2×"))}</div>`, Fu = `<div class="atlas"><section class="viewport"><canvas tabindex="0" aria-label="Interactive 3D model"></canvas><button class="atlas-jump" data-action="atlas-jump" aria-label="Open linked Atlas" title="Open linked Atlas" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.1 0l2.1-2.1a5 5 0 0 0-7.1-7.1L10 6"/><path d="M14 11a5 5 0 0 0-7.1 0l-2.1 2.1a5 5 0 0 0 7.1 7.1L14 18"/></svg></button><div class="document-navigation" role="toolbar" aria-label="Atlas document navigation" hidden></div><div class="toolbar" role="toolbar" aria-label="View controls"><div class="toolbar-group" data-toolbar-group="navigation"><button class="toolbar-icon" data-action="atlas-home" aria-label="Atlas home" title="First Atlas document" disabled>${Ou.home}</button><button class="toolbar-icon" data-action="atlas-back" aria-label="Atlas back" title="Back · hold for history" disabled>${Ou.back}</button><button class="toolbar-icon" data-action="atlas-forward" aria-label="Atlas forward" title="Forward · hold for history" disabled>${Ou.forward}</button><div class="atlas-history-popover" role="menu" aria-label="Atlas visits" hidden></div></div><div class="toolbar-group" data-toolbar-group="camera"><button class="toolbar-icon" data-action="minus" aria-label="Zoom out" title="Zoom out">${Ou.minus}</button><button class="toolbar-icon" data-action="plus" aria-label="Zoom in" title="Zoom in">${Ou.plus}</button><button class="toolbar-icon" data-action="fit" aria-label="Fit entire model" title="Fit entire model">${Ou.fit}</button><button class="toolbar-icon" data-action="front" aria-label="Front view" title="Front view">${Ou.front}</button></div><div class="toolbar-group" data-toolbar-group="view">${Nu("view", Ou.view, "View", "View", ku("labels", "Labels", !0) + ku("panel", "Information", !0) + ku("item-facing", "Face camera", !0) + "<div class=\"toolbar-option-separator\"></div>" + ku("open-all", "Open all") + ku("close-all", "Close all"))}</div><div class="toolbar-group" data-toolbar-group="relations">${Nu("relations", Ou.relations, "Relations", "Selection", ku("relations-all", "All") + ku("relations-selected", "Selection", !0) + ku("relations-callers", "Upstream") + ku("relations-called", "Downstream") + ku("relations-none", "Hide") + "<div data-relation-groups-section hidden><div class=\"toolbar-option-separator\"></div><div class=\"toolbar-popover-title\">Groups</div><div data-relation-groups></div></div>")}</div><div class="toolbar-group" data-toolbar-group="focus">${Nu("focus", Ou.focus, "Focus", "All", ku("focus-all", "All", !0) + ku("focus-dim", "Connected") + ku("focus-hide", "Isolate") + "<div class=\"toolbar-option-separator\"></div>" + ku("focus-selection", "Focus selection") + ku("focus-layout", "Reflow visible"))}</div></div><div class="hint">Rotate: drag · Pan: right button / ⇧+drag / 2 fingers · Zoom: wheel or pinch · Select: click · Focus: double-click</div></section><aside class="panel" aria-live="polite"></aside></div>`;
13556
- function Iu(e) {
13610
+ var Pu = (e, t, n, r, i) => `<details class="toolbar-menu" data-toolbar-menu="${e}"><summary aria-label="${n}" title="${n}">${t}<span class="toolbar-menu-status" data-toolbar-status="${e}" aria-live="polite">${r}</span>${ku.chevron}</summary><div class="toolbar-popover" role="menu"><div class="toolbar-popover-title">${n}</div>${i}</div></details>`, Fu = `<div class="toolbar-group" data-toolbar-group="copy">${Pu("copy", ku.copy, "Copy image", "PNG", ju("copy-theme", "PNG with background · HD 2×") + ju("copy-transparent", "Transparent PNG · HD 2×"))}</div>`, Iu = `<div class="atlas"><section class="viewport"><canvas tabindex="0" aria-label="Interactive 3D model"></canvas><button class="atlas-jump" data-action="atlas-jump" aria-label="Open linked Atlas" title="Open linked Atlas" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.1 0l2.1-2.1a5 5 0 0 0-7.1-7.1L10 6"/><path d="M14 11a5 5 0 0 0-7.1 0l-2.1 2.1a5 5 0 0 0 7.1 7.1L14 18"/></svg></button><div class="document-navigation" role="toolbar" aria-label="Atlas document navigation" hidden></div><div class="toolbar" role="toolbar" aria-label="View controls"><div class="toolbar-group" data-toolbar-group="navigation"><button class="toolbar-icon" data-action="atlas-home" aria-label="Atlas home" title="First Atlas document" disabled>${ku.home}</button><button class="toolbar-icon" data-action="atlas-back" aria-label="Atlas back" title="Back · hold for history" disabled>${ku.back}</button><button class="toolbar-icon" data-action="atlas-forward" aria-label="Atlas forward" title="Forward · hold for history" disabled>${ku.forward}</button><div class="atlas-history-popover" role="menu" aria-label="Atlas visits" hidden></div></div><div class="toolbar-group" data-toolbar-group="camera"><button class="toolbar-icon" data-action="minus" aria-label="Zoom out" title="Zoom out">${ku.minus}</button><button class="toolbar-icon" data-action="plus" aria-label="Zoom in" title="Zoom in">${ku.plus}</button><button class="toolbar-icon" data-action="fit" aria-label="Fit entire model" title="Fit entire model">${ku.fit}</button><button class="toolbar-icon" data-action="front" aria-label="Front view" title="Front view">${ku.front}</button></div><div class="toolbar-group" data-toolbar-group="view">${Pu("view", ku.view, "View", "View", Au("labels", "Labels", !0) + Au("panel", "Information", !0) + Au("item-facing", "Face camera", !0) + "<div class=\"toolbar-option-separator\"></div>" + Au("open-all", "Open all") + Au("close-all", "Close all"))}</div><div class="toolbar-group" data-toolbar-group="relations">${Pu("relations", ku.relations, "Relations", "Selection", Au("relations-all", "All") + Au("relations-selected", "Selection", !0) + Au("relations-callers", "Upstream") + Au("relations-called", "Downstream") + Au("relations-none", "Hide") + "<div data-relation-groups-section hidden><div class=\"toolbar-option-separator\"></div><div class=\"toolbar-popover-title\">Groups</div><div data-relation-groups></div></div>")}</div><div class="toolbar-group" data-toolbar-group="focus">${Pu("focus", ku.focus, "Focus", "All", Au("focus-all", "All", !0) + Au("focus-dim", "Connected") + Au("focus-hide", "Isolate") + "<div class=\"toolbar-option-separator\"></div>" + Au("focus-selection", "Focus selection") + Au("focus-layout", "Reflow visible"))}</div></div><div class="hint">Rotate: drag · Pan: right button / ⇧+drag / 2 fingers · Zoom: wheel or pinch · Select: click · Focus: double-click</div></section><aside class="panel" aria-live="polite"></aside></div>`;
13611
+ function Lu(e) {
13557
13612
  return String(e ?? "").replace(/[&<>"']/g, (e) => ({
13558
13613
  "&": "&amp;",
13559
13614
  "<": "&lt;",
@@ -13562,20 +13617,20 @@ function Iu(e) {
13562
13617
  "'": "&#39;"
13563
13618
  })[e]);
13564
13619
  }
13565
- function Lu(e) {
13620
+ function Ru(e) {
13566
13621
  let t = String(e ?? "").trim();
13567
13622
  if (!t) return "";
13568
13623
  try {
13569
13624
  let e = new URL(t, globalThis.location?.href);
13570
- return ["http:", "https:"].includes(e.protocol) ? "<a class=\"external-link\" href=\"" + Iu(e.href) + "\" target=\"_blank\" rel=\"noopener noreferrer\">Open documentation ↗</a>" : "";
13625
+ return ["http:", "https:"].includes(e.protocol) ? "<a class=\"external-link\" href=\"" + Lu(e.href) + "\" target=\"_blank\" rel=\"noopener noreferrer\">Open documentation ↗</a>" : "";
13571
13626
  } catch {
13572
13627
  return "";
13573
13628
  }
13574
13629
  }
13575
- function Ru(e, t = "connection") {
13630
+ function zu(e, t = "connection") {
13576
13631
  return String(e || t).normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
13577
13632
  }
13578
- function zu(e) {
13633
+ function Bu(e) {
13579
13634
  let t = Array.isArray(e) ? e : e && typeof e == "object" ? Object.entries(e).map(([e, t]) => typeof t == "string" ? {
13580
13635
  id: e,
13581
13636
  label: t
@@ -13594,7 +13649,7 @@ function zu(e) {
13594
13649
  }]);
13595
13650
  });
13596
13651
  }
13597
- function Bu(e) {
13652
+ function Vu(e) {
13598
13653
  let t = e && typeof e == "object" ? e : {}, n = t.render && typeof t.render == "object" ? t.render : {}, r = Array.isArray(t.entities) ? t.entities.map((e) => ({
13599
13654
  ...e,
13600
13655
  p: Array.isArray(e.p) ? e.p : [
@@ -13610,9 +13665,9 @@ function Bu(e) {
13610
13665
  })) : [], i = /* @__PURE__ */ new Set(), a = (e) => {
13611
13666
  let t = (e.id == null ? "" : String(e.id).trim()) || [
13612
13667
  "relation",
13613
- Ru(e.from, "source"),
13614
- Ru(e.to, "target"),
13615
- e.label ? Ru(e.label) : ""
13668
+ zu(e.from, "source"),
13669
+ zu(e.to, "target"),
13670
+ e.label ? zu(e.label) : ""
13616
13671
  ].filter(Boolean).join("-"), n = t || "relation", r = 2;
13617
13672
  for (; i.has(n);) n = `${t || "relation"}-${r++}`;
13618
13673
  return i.add(n), n;
@@ -13622,7 +13677,7 @@ function Bu(e) {
13622
13677
  from: e[0],
13623
13678
  to: e[1],
13624
13679
  label: e[2] || "",
13625
- mode: wu({ mode: e[3] }),
13680
+ mode: Tu({ mode: e[3] }),
13626
13681
  index: t
13627
13682
  };
13628
13683
  return n.id = a(n), n;
@@ -13632,7 +13687,7 @@ function Bu(e) {
13632
13687
  from: e.from,
13633
13688
  to: e.to,
13634
13689
  label: e.label || "",
13635
- mode: wu(e),
13690
+ mode: Tu(e),
13636
13691
  index: t
13637
13692
  };
13638
13693
  return n.id = a(n), n.group != null && (n.group = String(n.group).trim() || void 0), n;
@@ -13640,20 +13695,20 @@ function Bu(e) {
13640
13695
  return {
13641
13696
  ...t,
13642
13697
  palette: {
13643
- ...Wl,
13698
+ ...Gl,
13644
13699
  ...t.palette || {}
13645
13700
  },
13646
- theme: Cu(t.theme || t.styles),
13701
+ theme: wu(t.theme || t.styles),
13647
13702
  render: {
13648
13703
  ...n,
13649
- relationMarker: vu(n.relationMarker)
13704
+ relationMarker: yu(n.relationMarker)
13650
13705
  },
13651
- relationGroups: zu(t.relationGroups),
13706
+ relationGroups: Bu(t.relationGroups),
13652
13707
  entities: r,
13653
13708
  relations: o
13654
13709
  };
13655
13710
  }
13656
- function Vu(e, t, n = [
13711
+ function Hu(e, t, n = [
13657
13712
  1,
13658
13713
  1,
13659
13714
  1
@@ -13672,7 +13727,7 @@ function Vu(e, t, n = [
13672
13727
  });
13673
13728
  return s.center(), s;
13674
13729
  }
13675
- function Hu(e, t, n) {
13730
+ function Uu(e, t, n) {
13676
13731
  let r = new di();
13677
13732
  for (let t = 0; t < e; t++) {
13678
13733
  let n = Math.PI / 2 + t * Math.PI * 2 / e, i = new V(Math.cos(n) * .5, Math.sin(n) * .5);
@@ -13689,7 +13744,7 @@ function Hu(e, t, n) {
13689
13744
  });
13690
13745
  return i.rotateX(Math.PI / 2), i.center(), i;
13691
13746
  }
13692
- function Uu(e, t, n, r) {
13747
+ function Wu(e, t, n, r) {
13693
13748
  let i = Math.min(.22, Math.max(0, Number(n) || 0));
13694
13749
  if (!i) return new Dr(t, e, 1, 32);
13695
13750
  let a = [new V(0, -.5)];
@@ -13706,7 +13761,7 @@ function Uu(e, t, n, r) {
13706
13761
  }
13707
13762
  return a.push(new V(0, .5)), new $i(a, 32);
13708
13763
  }
13709
- function Wu(e, t) {
13764
+ function Gu(e, t) {
13710
13765
  if (!t) return e;
13711
13766
  let n = Math.min(.72, Math.max(0, Number(t) * 3)), r = e.attributes.position;
13712
13767
  for (let e = 0; e < r.count; e++) {
@@ -13715,36 +13770,36 @@ function Wu(e, t) {
13715
13770
  }
13716
13771
  return r.needsUpdate = !0, e.computeVertexNormals(), e;
13717
13772
  }
13718
- function Gu(e, t = 0, n = 4, r = [
13773
+ function Ku(e, t = 0, n = 4, r = [
13719
13774
  1,
13720
13775
  1,
13721
13776
  1
13722
13777
  ]) {
13723
13778
  let i = Number(t) || 0, a = Math.max(2, Math.round(Number(n) || 4));
13724
13779
  switch (e) {
13725
- case "cylinder": return i ? Uu(.5, .5, i, a) : new Dr(.5, .5, 1, 32);
13726
- case "cone": return i ? Uu(0, .5, i, a) : new Or(.5, 1, 32);
13780
+ case "cylinder": return i ? Wu(.5, .5, i, a) : new Dr(.5, .5, 1, 32);
13781
+ case "cone": return i ? Wu(0, .5, i, a) : new Or(.5, 1, 32);
13727
13782
  case "frustum-cone":
13728
- case "truncated-cone": return i ? Uu(.28, .5, i, a) : new Dr(.28, .5, 1, 32);
13783
+ case "truncated-cone": return i ? Wu(.28, .5, i, a) : new Dr(.28, .5, 1, 32);
13729
13784
  case "frustum-pyramid":
13730
13785
  case "truncated-pyramid": return new Dr(.28, .5, 1, 4);
13731
13786
  case "frustum-triangle": return new Dr(.28, .5, 1, 3);
13732
- case "prism": return i ? Hu(6, i, a) : new Dr(.5, .5, 1, 6);
13733
- case "pyramid-square": return i ? Wu(new Or(.5, 1, 4), i) : new Or(.5, 1, 4);
13734
- case "pyramid-triangle": return i ? Wu(new Or(.5, 1, 3), i) : new Or(.5, 1, 3);
13787
+ case "prism": return i ? Uu(6, i, a) : new Dr(.5, .5, 1, 6);
13788
+ case "pyramid-square": return i ? Gu(new Or(.5, 1, 4), i) : new Or(.5, 1, 4);
13789
+ case "pyramid-triangle": return i ? Gu(new Or(.5, 1, 3), i) : new Or(.5, 1, 3);
13735
13790
  case "sphere": return new na(.5, 24, 16);
13736
- case "octahedron": return Wu(new ea(.5), i);
13737
- case "dodecahedron": return Wu(new Ar(.5), i);
13738
- case "icosahedron": return Wu(new Qi(.5), i);
13739
- default: return i ? Vu(i, a, r) : new Pn(1, 1, 1);
13791
+ case "octahedron": return Gu(new ea(.5), i);
13792
+ case "dodecahedron": return Gu(new Ar(.5), i);
13793
+ case "icosahedron": return Gu(new Qi(.5), i);
13794
+ default: return i ? Hu(i, a, r) : new Pn(1, 1, 1);
13740
13795
  }
13741
13796
  }
13742
- function Ku(e) {
13797
+ function qu(e) {
13743
13798
  e.computeBoundingBox();
13744
13799
  let t = e.boundingBox?.getSize(new U());
13745
13800
  return !t || !t.x || !t.y || !t.z ? e : (e.scale(1 / t.x, 1 / t.y, 1 / t.z), e.computeBoundingBox(), e);
13746
13801
  }
13747
- function qu(e, t) {
13802
+ function Ju(e, t) {
13748
13803
  let n = e.geometryOptions || e.geometry_options || e.parameters || {}, r = {};
13749
13804
  for (let [e, n] of Object.entries(t?.parameters || {})) n && Object.hasOwn(n, "default") && (r[e] = n.default);
13750
13805
  return {
@@ -13752,10 +13807,10 @@ function qu(e, t) {
13752
13807
  ...n && typeof n == "object" ? n : {}
13753
13808
  };
13754
13809
  }
13755
- function Ju(e, t, n) {
13810
+ function Yu(e, t, n) {
13756
13811
  return typeof e != "string" || !e ? n : t[e] || e;
13757
13812
  }
13758
- function Yu(e, t = "#ffffff", n = "transparent") {
13813
+ function Xu(e, t = "#ffffff", n = "transparent") {
13759
13814
  let r = document.createElement("canvas");
13760
13815
  r.width = 256, r.height = 256;
13761
13816
  let i = r.getContext("2d");
@@ -13763,8 +13818,8 @@ function Yu(e, t = "#ffffff", n = "transparent") {
13763
13818
  let a = new wr(r);
13764
13819
  return a.colorSpace = y, a;
13765
13820
  }
13766
- var Xu = /^[AaCcHhLlMmQqSsTtVvZz]$/, Zu = /[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?|[AaCcHhLlMmQqSsTtVvZz]/g;
13767
- function Qu(e, t, n, r, i, a, o, s, c) {
13821
+ var Zu = /^[AaCcHhLlMmQqSsTtVvZz]$/, Qu = /[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?|[AaCcHhLlMmQqSsTtVvZz]/g;
13822
+ function $u(e, t, n, r, i, a, o, s, c) {
13768
13823
  let l = Math.abs(Number(n)), u = Math.abs(Number(r));
13769
13824
  if (!l || !u || e === s && t === c) return [[s, c]];
13770
13825
  let d = Number(i || 0) * Math.PI / 180, f = Math.cos(d), p = Math.sin(d), m = (e - s) / 2, h = (t - c) / 2, g = f * m + p * h, _ = -p * m + f * h, v = Math.sqrt(Math.max(1, g * g / (l * l) + _ * _ / (u * u)));
@@ -13780,12 +13835,12 @@ function Qu(e, t, n, r, i, a, o, s, c) {
13780
13835
  return [w + f * l * r - p * u * i, T + p * l * r + f * u * i];
13781
13836
  });
13782
13837
  }
13783
- function $u(e) {
13784
- let t = String(e || "").match(Zu) || [], n = new Ja(), r = 0, i = "", a = "", o = 0, s = 0, c = 0, l = 0, u = 0, d = 0, f = 0, p = 0, m = () => r < t.length && !Xu.test(t[r]), h = () => Number(t[r++]), g = () => {
13838
+ function ed(e) {
13839
+ let t = String(e || "").match(Qu) || [], n = new Ja(), r = 0, i = "", a = "", o = 0, s = 0, c = 0, l = 0, u = 0, d = 0, f = 0, p = 0, m = () => r < t.length && !Zu.test(t[r]), h = () => Number(t[r++]), g = () => {
13785
13840
  let e = t[r];
13786
13841
  return /^[01].+/.test(e) ? (t[r] = e.slice(1), e[0] === "1") : h() !== 0;
13787
13842
  }, _ = (e, t, n) => [n ? o + e : e, n ? s + t : t];
13788
- for (; r < t.length && (Xu.test(t[r]) && (i = t[r++]), i);) {
13843
+ for (; r < t.length && (Zu.test(t[r]) && (i = t[r++]), i);) {
13789
13844
  let e = i.toLowerCase(), t = i === e;
13790
13845
  if (e === "z") {
13791
13846
  n.currentPath?.closePath(), o = c, s = l, a = i, i = "";
@@ -13825,7 +13880,7 @@ function $u(e) {
13825
13880
  }
13826
13881
  else if (e === "a") for (; m();) {
13827
13882
  let e = h(), r = h(), c = h(), l = g(), u = g(), [d, f] = _(h(), h(), t);
13828
- for (let [t, i] of Qu(o, s, e, r, c, l, u, d, f)) n.lineTo(t, -i);
13883
+ for (let [t, i] of $u(o, s, e, r, c, l, u, d, f)) n.lineTo(t, -i);
13829
13884
  o = d, s = f, a = i;
13830
13885
  }
13831
13886
  else break;
@@ -13833,12 +13888,12 @@ function $u(e) {
13833
13888
  }
13834
13889
  return n;
13835
13890
  }
13836
- function ed(e, t = {}) {
13891
+ function td(e, t = {}) {
13837
13892
  let n = String(e || "").match(/<path\b[^>]*>/gi) || [], r = [];
13838
13893
  for (let e of n) {
13839
13894
  let t = e.match(/\bd\s*=\s*(["'])([\s\S]*?)\1/i);
13840
13895
  if (!t) continue;
13841
- let n = $u(t[2]);
13896
+ let n = ed(t[2]);
13842
13897
  r.push(...n.toShapes(!0, !1));
13843
13898
  }
13844
13899
  if (!r.length) return new Pn(1, 1, .12);
@@ -13853,33 +13908,33 @@ function ed(e, t = {}) {
13853
13908
  });
13854
13909
  return a.center(), a;
13855
13910
  }
13856
- function td(e) {
13857
- return e.shape === "plane" ? new ta(1, 1) : e.shape === "svg-extrude" ? ed(e.svg, e) : Gu(e.shape || e.geometry || "box", e.radius, e.segments, e.size);
13911
+ function nd(e) {
13912
+ return e.shape === "plane" ? new ta(1, 1) : e.shape === "svg-extrude" ? td(e.svg, e) : Ku(e.shape || e.geometry || "box", e.radius, e.segments, e.size);
13858
13913
  }
13859
- var nd = /* @__PURE__ */ new Map(), rd = 12582912, id = 0;
13860
- function ad(e) {
13861
- let t = nd.get(e);
13862
- return t && (nd.delete(e), nd.set(e, t)), t;
13914
+ var rd = /* @__PURE__ */ new Map(), id = 12582912, ad = 0;
13915
+ function od(e) {
13916
+ let t = rd.get(e);
13917
+ return t && (rd.delete(e), rd.set(e, t)), t;
13863
13918
  }
13864
- function od(e, t, n) {
13919
+ function sd(e, t, n) {
13865
13920
  if (!/^https?:\/\//i.test(e)) return;
13866
13921
  let r = t.width * t.height;
13867
- if (r > rd) return;
13868
- let i = nd.get(e);
13869
- for (i && (id -= i.canvas.width * i.canvas.height), nd.delete(e), nd.set(e, {
13922
+ if (r > id) return;
13923
+ let i = rd.get(e);
13924
+ for (i && (ad -= i.canvas.width * i.canvas.height), rd.delete(e), rd.set(e, {
13870
13925
  canvas: t,
13871
13926
  aspect: n
13872
- }), id += r; id > rd;) {
13873
- let e = nd.keys().next().value;
13874
- id -= nd.get(e).canvas.width * nd.get(e).canvas.height, nd.delete(e);
13927
+ }), ad += r; ad > id;) {
13928
+ let e = rd.keys().next().value;
13929
+ ad -= rd.get(e).canvas.width * rd.get(e).canvas.height, rd.delete(e);
13875
13930
  }
13876
13931
  }
13877
- function sd(e, t, n, r) {
13932
+ function cd(e, t, n, r) {
13878
13933
  let i = e.imageFit || e.fit || "stretch", a = Math.abs(Number(e.size?.[0])) || 1, o = Math.abs(Number(e.size?.[1])) || 1, s = a / o;
13879
13934
  i === "cover" ? r > s ? (n.repeat.set(s / r, 1), n.offset.set((1 - n.repeat.x) / 2, 0)) : (n.repeat.set(1, r / s), n.offset.set(0, (1 - n.repeat.y) / 2)) : i === "contain" && t && (r > s ? t.scale.y = a / r : t.scale.x = o * r);
13880
13935
  }
13881
- function cd(e, t, n, r, i) {
13882
- let a = qu(t, e), o = {
13936
+ function ld(e, t, n, r, i) {
13937
+ let a = Ju(t, e), o = {
13883
13938
  ...n,
13884
13939
  ...e.palette || {},
13885
13940
  ...t.geometryPalette || t.geometry_palette || {}
@@ -13894,11 +13949,11 @@ function cd(e, t, n, r, i) {
13894
13949
  if (!c.length) throw Error(`Geometry '${e.id}' did not produce any parts.`);
13895
13950
  let l = new $n(), u = [], d = [];
13896
13951
  for (let a of c) {
13897
- let s = td(a);
13898
- Ku(s);
13899
- let c = a.color || "component", f = Ju(c, o, n.component || Wl.component), p = a.emissive || "#000000", m = new aa({
13952
+ let s = nd(a);
13953
+ qu(s);
13954
+ let c = a.color || "component", f = Yu(c, o, n.component || Gl.component), p = a.emissive || "#000000", m = new aa({
13900
13955
  color: f,
13901
- emissive: Ju(p, o, "#000000"),
13956
+ emissive: Yu(p, o, "#000000"),
13902
13957
  emissiveIntensity: Number.isFinite(Number(a.emissiveIntensity)) ? Math.max(0, Number(a.emissiveIntensity)) : 0,
13903
13958
  roughness: Number.isFinite(Number(a.roughness)) ? Number(a.roughness) : .72,
13904
13959
  metalness: Number.isFinite(Number(a.metalness)) ? Number(a.metalness) : .06,
@@ -13907,8 +13962,8 @@ function cd(e, t, n, r, i) {
13907
13962
  side: a.doubleSided ? 2 : 0
13908
13963
  }), h, g = a.icon, _ = a.image, v = null;
13909
13964
  if (typeof _ == "string" && _) {
13910
- if (v = ad(_), m.map = new Ae(v?.canvas || new Image()), !v) {
13911
- let n = m.map.image;
13965
+ if (v = od(_), m.map = v ? new wr(v.canvas) : a.fallbackIcon ? Xu(a.fallbackIcon) : new Ae(new Image()), !v) {
13966
+ let n = a.fallbackIcon ? new Image() : m.map.image;
13912
13967
  n.crossOrigin = "anonymous";
13913
13968
  let o = !1, s = null, c = /^\s*<svg(?:\s|>)/i.test(_) || /^data:image\/svg\+xml/i.test(_) || /\.svg(?:[?#]|$)/i.test(_), l = new AbortController(), u = () => {
13914
13969
  s &&= (URL.revokeObjectURL(s), null);
@@ -13919,12 +13974,13 @@ function cd(e, t, n, r, i) {
13919
13974
  u();
13920
13975
  return;
13921
13976
  }
13977
+ let s = n;
13922
13978
  if (c) try {
13923
13979
  let e = (n.naturalWidth || 1) / Math.max(1, n.naturalHeight || 1), t = 1024, r = document.createElement("canvas");
13924
13980
  r.width = e >= 1 ? t : Math.max(1, Math.round(t * e)), r.height = e >= 1 ? Math.max(1, Math.round(t / e)) : t;
13925
13981
  let i = r.getContext("2d");
13926
13982
  if (!i) throw Error("Canvas 2D is unavailable");
13927
- i.clearRect(0, 0, r.width, r.height), i.drawImage(n, 0, 0, r.width, r.height), m.map.image = r, od(_, r, n.naturalWidth / Math.max(1, n.naturalHeight));
13983
+ i.clearRect(0, 0, r.width, r.height), i.drawImage(n, 0, 0, r.width, r.height), s = r, sd(_, r, n.naturalWidth / Math.max(1, n.naturalHeight));
13928
13984
  } catch (n) {
13929
13985
  i?.({
13930
13986
  code: "SVG_RASTERIZE_FAILED",
@@ -13932,11 +13988,15 @@ function cd(e, t, n, r, i) {
13932
13988
  entityId: t.id,
13933
13989
  image: _,
13934
13990
  error: n
13935
- });
13991
+ }), a.fallbackIcon && (s = null);
13936
13992
  }
13937
13993
  u();
13938
- let s = n.naturalWidth / Math.max(1, n.naturalHeight);
13939
- sd(a, h, m.map, s), m.map.needsUpdate = !0, r?.();
13994
+ let l = n.naturalWidth / Math.max(1, n.naturalHeight);
13995
+ if (s) {
13996
+ let e = m.map, t = s === n ? new Ae(n) : new wr(s);
13997
+ t.colorSpace = y, cd(a, h, t, l), t.needsUpdate = !0, m.map = t, m.needsUpdate = !0, e.dispose();
13998
+ }
13999
+ r?.();
13940
14000
  }, p = () => {
13941
14001
  d(), u(), o || (i?.({
13942
14002
  code: "IMAGE_LOAD_FAILED",
@@ -13972,7 +14032,7 @@ function cd(e, t, n, r, i) {
13972
14032
  })();
13973
14033
  }
13974
14034
  m.map.colorSpace = y, m.needsUpdate = !0;
13975
- } else g != null && g !== "" && (m.map = Yu(g, Ju(a.iconColor || "#ffffff", o, "#ffffff"), Ju(a.iconBackground || "transparent", o, "transparent")), m.transparent = !0, m.needsUpdate = !0);
14035
+ } else g != null && g !== "" && (m.map = Xu(g, Yu(a.iconColor || "#ffffff", o, "#ffffff"), Yu(a.iconBackground || "transparent", o, "transparent")), m.transparent = !0, m.needsUpdate = !0);
13976
14036
  if (h = new jn(s, m), h.position.fromArray(Array.isArray(a.position) ? a.position : [
13977
14037
  0,
13978
14038
  0,
@@ -13981,7 +14041,7 @@ function cd(e, t, n, r, i) {
13981
14041
  1,
13982
14042
  1,
13983
14043
  1
13984
- ]), v && sd(a, h, m.map, v.aspect), Array.isArray(a.rotation) && h.rotation.set(...a.rotation.map(Number)), l.add(h), d.push(h), u.push({
14044
+ ]), v && cd(a, h, m.map, v.aspect), Array.isArray(a.rotation) && h.rotation.set(...a.rotation.map(Number)), l.add(h), d.push(h), u.push({
13985
14045
  material: m,
13986
14046
  value: c,
13987
14047
  emissiveValue: p,
@@ -14009,23 +14069,23 @@ function cd(e, t, n, r, i) {
14009
14069
  descriptor: s
14010
14070
  };
14011
14071
  }
14012
- var ld = Object.freeze([
14072
+ var ud = Object.freeze([
14013
14073
  "auto",
14014
14074
  "top",
14015
14075
  "bottom",
14016
14076
  "left",
14017
14077
  "right"
14018
14078
  ]);
14019
- function ud(e) {
14079
+ function dd(e) {
14020
14080
  let t = String(e || "auto").trim().toLowerCase();
14021
- return ld.includes(t) ? t : "auto";
14081
+ return ud.includes(t) ? t : "auto";
14022
14082
  }
14023
- function dd(e = {}, t = {}) {
14024
- let n = e.style?.label?.anchor ?? e.labelAnchor ?? e.label_anchor, r = mu(e.type) ? "auto" : t?.label?.anchor ?? "bottom";
14025
- return ud(n ?? r);
14083
+ function fd(e = {}, t = {}) {
14084
+ let n = e.style?.label?.anchor ?? e.labelAnchor ?? e.label_anchor, r = hu(e.type) ? "auto" : t?.label?.anchor ?? "bottom";
14085
+ return dd(n ?? r);
14026
14086
  }
14027
- function fd(e, t, n, r, i = .025) {
14028
- let a = ud(e);
14087
+ function pd(e, t, n, r, i = .025) {
14088
+ let a = dd(e);
14029
14089
  if (a === "auto") return null;
14030
14090
  let o = Math.max(0, Number(t?.x) || 0), s = Math.max(0, Number(t?.y) || 0);
14031
14091
  Math.max(0, Number(n) || 0);
@@ -14052,7 +14112,7 @@ function fd(e, t, n, r, i = .025) {
14052
14112
  backRotation: Math.PI / 2
14053
14113
  };
14054
14114
  }
14055
- function pd(e, t, n = null, r = .08) {
14115
+ function md(e, t, n = null, r = .08) {
14056
14116
  let i = (Number(e?.x) || 0) - (Number(t?.x) || 0), a = (Number(e?.y) || 0) - (Number(t?.y) || 0), o = (Number(e?.z) || 0) - (Number(t?.z) || 0), s = Math.hypot(i, a, o), c = [
14057
14117
  "front",
14058
14118
  "back",
@@ -14068,7 +14128,7 @@ function pd(e, t, n = null, r = .08) {
14068
14128
  let d = Math.max(0, Math.min(.5, Number(r) || 0));
14069
14129
  return c.includes(n) && l[n] > 0 && l[n] + d >= l[u] ? n : l[u] > 0 ? u : c.includes(n) ? n : "front";
14070
14130
  }
14071
- function md(e, t, n, r = "", i = !0) {
14131
+ function hd(e, t, n, r = "", i = !0) {
14072
14132
  let a = document.createElement("canvas"), o = a.getContext("2d"), s = n.x * .88, c = Math.min(.82, n.y * .64);
14073
14133
  a.width = Math.ceil(s * 320), a.height = Math.ceil(c * 320), o.imageSmoothingEnabled = !0, o.imageSmoothingQuality = "high", o.clearRect(0, 0, a.width, a.height);
14074
14134
  let l = a.height * .62;
@@ -14105,7 +14165,7 @@ function md(e, t, n, r = "", i = !0) {
14105
14165
  let C = new jn(b, v);
14106
14166
  C.rotation.y = Math.PI, C.position.set(0, n.y / 2 - .09 - c / 2, -n.z / 2 - .012);
14107
14167
  let w = new jn(b, v.clone());
14108
- w.rotation.x = -Math.PI / 2, w.position.set(0, n.y / 2 + .012, 0), w.visible = mu(r), x.add(S, C, w);
14168
+ w.rotation.x = -Math.PI / 2, w.position.set(0, n.y / 2 + .012, 0), w.visible = hu(r), x.add(S, C, w);
14109
14169
  for (let e of [
14110
14170
  S,
14111
14171
  C,
@@ -14113,7 +14173,7 @@ function md(e, t, n, r = "", i = !0) {
14113
14173
  ]) e.renderOrder = 20, e.frustumCulled = !1, e.material.depthTest = !0, e.material.depthWrite = !1, e.material.transparent = !0;
14114
14174
  return x.renderOrder = 20, x.frustumCulled = !1, x.userData.front = S, x.userData.back = C, x.userData.top = w, x.userData.height = c, x.userData.width = s, x.userData.textOffsetX = h, x.userData.textOffsetY = g, x.userData.nodeLabel = !0, x;
14115
14175
  }
14116
- function hd(e, t, n, r) {
14176
+ function gd(e, t, n, r) {
14117
14177
  if (!r || r === "transparent" || !e?.fillRect) return;
14118
14178
  let i = typeof r == "string" ? { color: r } : r, a = i.fade || i.color || "#0a111a", o = i.glow || a;
14119
14179
  if (e.save?.(), e.globalCompositeOperation = "destination-over", o !== a && e.createRadialGradient && e.scale) {
@@ -14123,7 +14183,7 @@ function hd(e, t, n, r) {
14123
14183
  } else e.fillStyle = a, e.fillRect(0, 0, t, n);
14124
14184
  e.restore?.();
14125
14185
  }
14126
- function gd(e) {
14186
+ function _d(e) {
14127
14187
  for (let t = 0; t < e.length; t += 4) {
14128
14188
  let n = e[t + 3];
14129
14189
  if (!n || n === 255) continue;
@@ -14131,7 +14191,7 @@ function gd(e) {
14131
14191
  e[t] = Math.min(255, Math.round(e[t] * r)), e[t + 1] = Math.min(255, Math.round(e[t + 1] * r)), e[t + 2] = Math.min(255, Math.round(e[t + 2] * r));
14132
14192
  }
14133
14193
  }
14134
- function _d(e, t, n, r = 8192) {
14194
+ function vd(e, t, n, r = 8192) {
14135
14195
  let i = Math.max(1, Math.min(4, Number(n) || 1));
14136
14196
  if (i === 1 || !e?.getPixelRatio || !e?.getSize || !e?.setPixelRatio || !e?.setSize) return null;
14137
14197
  let a = e.getPixelRatio(), o = {
@@ -14147,12 +14207,12 @@ function _d(e, t, n, r = 8192) {
14147
14207
  e.setPixelRatio(a), e.setSize(o.x, o.y, !1);
14148
14208
  });
14149
14209
  }
14150
- function vd(e, t, n, r = globalThis.document, i = {}) {
14210
+ function yd(e, t, n, r = globalThis.document, i = {}) {
14151
14211
  if (!e || !t || !n || !r?.createElement) return null;
14152
14212
  let a = null;
14153
14213
  try {
14154
14214
  let o = e.getContext?.();
14155
- a = _d(e, o, i.scale, i.maximumDimension), e.render(t, n);
14215
+ a = vd(e, o, i.scale, i.maximumDimension), e.render(t, n);
14156
14216
  let s = e.getContext?.(), c = s?.drawingBufferWidth || e.domElement?.width || 0, l = s?.drawingBufferHeight || e.domElement?.height || 0;
14157
14217
  if (!s?.readPixels || !c || !l) return null;
14158
14218
  let u = new Uint8Array(c * l * 4);
@@ -14166,7 +14226,7 @@ function vd(e, t, n, r = globalThis.document, i = {}) {
14166
14226
  let t = l - e - 1;
14167
14227
  p.data.set(u.subarray(t * m, (t + 1) * m), e * m);
14168
14228
  }
14169
- return s.getContextAttributes?.().premultipliedAlpha !== !1 && gd(p.data), f.putImageData(p, 0, 0), hd(f, c, l, i.background), d;
14229
+ return s.getContextAttributes?.().premultipliedAlpha !== !1 && _d(p.data), f.putImageData(p, 0, 0), gd(f, c, l, i.background), d;
14170
14230
  } catch {
14171
14231
  return null;
14172
14232
  } finally {
@@ -14175,14 +14235,14 @@ function vd(e, t, n, r = globalThis.document, i = {}) {
14175
14235
  } catch {}
14176
14236
  }
14177
14237
  }
14178
- function yd(e) {
14238
+ function bd(e) {
14179
14239
  return e?.toBlob ? new Promise((t, n) => {
14180
14240
  e.toBlob((e) => {
14181
14241
  e ? t(e) : n(/* @__PURE__ */ Error("Atlas could not encode the captured view as PNG."));
14182
14242
  }, "image/png");
14183
14243
  }) : Promise.reject(/* @__PURE__ */ Error("PNG capture is unavailable in this browser."));
14184
14244
  }
14185
- function bd(e, t = {}) {
14245
+ function xd(e, t = {}) {
14186
14246
  let n = Object.hasOwn(t, "documentRef") ? t.documentRef : globalThis.document, r = Object.hasOwn(t, "urlRef") ? t.urlRef : globalThis.URL;
14187
14247
  if (!n?.createElement || !r?.createObjectURL) throw Error("PNG download is unavailable in this browser.");
14188
14248
  let i = String(t.filename || "atlas-view.png"), a = r.createObjectURL(e), o = n.createElement("a");
@@ -14196,8 +14256,8 @@ function bd(e, t = {}) {
14196
14256
  }
14197
14257
  return i;
14198
14258
  }
14199
- var xd = class extends HTMLElement {
14200
- static version = Ul;
14259
+ var Sd = class extends HTMLElement {
14260
+ static version = Wl;
14201
14261
  static get observedAttributes() {
14202
14262
  return [
14203
14263
  "height",
@@ -14215,23 +14275,23 @@ var xd = class extends HTMLElement {
14215
14275
  ];
14216
14276
  }
14217
14277
  static registerGeometryPack(e) {
14218
- return lu(e);
14278
+ return uu(e);
14219
14279
  }
14220
14280
  static unregisterGeometryPack(e) {
14221
- return uu(e);
14281
+ return du(e);
14222
14282
  }
14223
14283
  static getGeometryCatalog() {
14224
- return du();
14284
+ return fu();
14225
14285
  }
14226
14286
  static getGeometryPackCatalog() {
14227
- return fu();
14287
+ return pu();
14228
14288
  }
14229
14289
  constructor() {
14230
- super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = "<style>" + Tu + ".toolbar{max-width:calc(100% - 16px);overflow:visible}.toolbar-group{display:flex;align-items:center;gap:2px}.toolbar-group+.toolbar-group{padding-left:6px;border-left:1px solid #38515f}.toolbar .toolbar-icon{display:grid;width:30px;padding:0;place-items:center}.toolbar-icon svg,.toolbar-menu>summary svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.toolbar-menu{position:relative}.toolbar-menu>summary{display:flex;align-items:center;height:30px;padding:0 8px;gap:6px;border-radius:5px;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer;list-style:none;user-select:none}.toolbar-menu>summary::-webkit-details-marker{display:none}.toolbar-menu>summary:hover,.toolbar-menu[open]>summary{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.toolbar-menu-status{max-width:92px;overflow:hidden;font-size:11px;text-overflow:ellipsis;white-space:nowrap}.toolbar-menu-chevron{width:10px;height:10px!important;transition:transform .16s ease}.toolbar-menu[open] .toolbar-menu-chevron{transform:rotate(180deg)}.toolbar-popover{position:absolute;right:0;bottom:calc(100% + 8px);display:grid;min-width:218px;padding:6px;border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:9px;background:var(--lc-toolbar-bg,#15232ff7);box-shadow:0 14px 36px #0009}.toolbar-popover-title{padding:7px 9px 5px;color:var(--lc-hint,#8da6b8);font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.toolbar .toolbar-option{display:grid;grid-template-columns:minmax(0,1fr) 18px;align-items:center;width:100%;height:auto;min-height:34px;padding:7px 9px;text-align:left}.toolbar-option span:first-child{overflow:hidden;text-overflow:ellipsis}.toolbar-option-check{color:var(--lc-toolbar-active-text,#c5f2e9);font-weight:700;text-align:center;visibility:hidden}.toolbar-option.active .toolbar-option-check{visibility:visible}.toolbar-option-separator{height:1px;margin:5px 7px;background:#38515f}.toolbar button[disabled]{opacity:.42;cursor:not-allowed}@media(max-width:620px){.toolbar-menu-status{display:none}.toolbar-menu>summary{width:30px;padding:0;justify-content:center}.toolbar-menu-chevron{display:none}.toolbar-group+.toolbar-group{padding-left:3px}.toolbar-popover{right:-4px}}.toolbar-group[data-toolbar-group=navigation]{position:relative}.toolbar-group[hidden]{display:none}.atlas-history-popover{position:absolute;left:0;bottom:calc(100% + 8px);min-width:250px;max-width:min(360px,80vw);max-height:300px;overflow:auto;padding:6px;border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:9px;background:var(--lc-toolbar-bg,#15232ff7);box-shadow:0 14px 36px #0009;z-index:12}.atlas-history-popover[hidden]{display:none}.atlas-history-popover .history-heading{padding:7px 9px 5px;color:var(--lc-hint,#8da6b8);font-size:10px;text-transform:uppercase;letter-spacing:.1em}.toolbar .atlas-history-popover button{display:block;width:100%;height:auto;padding:8px 9px;text-align:left;white-space:normal;overflow-wrap:anywhere}.atlas-history-popover small{display:block;opacity:.65;font-size:10px}.atlas-jump{position:absolute;z-index:9;display:grid;place-items:center;width:34px;height:34px;border:1px solid #73d9c7;border-radius:50%;background:#173e49;color:#c8fff2;box-shadow:0 4px 16px #0009;cursor:pointer}.atlas-jump[hidden]{display:none}.atlas-jump:hover,.atlas-jump:focus-visible{background:#286776;outline:2px solid #c8fff2}.atlas-jump svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.panel .rich-content{color:var(--lc-panel-text,#b5c6d2);font-size:14px;line-height:1.55}.panel .rich-content h1,.panel .rich-content h2,.panel .rich-content h3{color:var(--lc-panel-title,#e9f0f5);letter-spacing:normal;margin:14px 0 8px}.panel .rich-content a{color:#6ad7c0}.panel .rich-content pre{overflow:auto;padding:8px;background:#091622;border-radius:5px}.panel .rich-content code{font-size:.9em}.panel .rich-content ul,.panel .rich-content ol{padding-left:20px}.document-navigation{position:absolute;top:12px;right:12px;z-index:10;display:flex;padding:5px;border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:8px;background:var(--lc-toolbar-bg,#15232fe8)}.document-navigation[hidden],:host([navigation-controls=external]) .document-navigation{display:none!important}.document-navigation button{display:grid;width:30px;height:30px;place-items:center;padding:0;border:0;border-radius:5px;background:none;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer}.document-navigation button:hover{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.document-navigation button:disabled{opacity:.42;cursor:not-allowed}.document-navigation svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.document-navigation .atlas-history-popover{top:calc(100% + 8px);right:0;bottom:auto;left:auto}.document-navigation .atlas-history-popover button{display:block;width:100%;height:auto;padding:8px 9px;text-align:left;white-space:normal;overflow-wrap:anywhere}@media print{.document-navigation,.atlas-jump{display:none!important}}" + Eu + Sl + "</style>" + Fu, this.shadowRoot.querySelector("[data-toolbar-group=\"focus\"]")?.insertAdjacentHTML?.("afterend", Pu), this.shadowRoot.querySelector("[data-toolbar-group=\"navigation\"]")?.insertAdjacentHTML?.("afterend", "<div class=\"toolbar-group\" data-toolbar-group=\"mode\"><button data-action=\"view-mode\" aria-label=\"Switch to 2D diagram\" title=\"Switch to 2D diagram\">2D</button></div>"), this.shadowRoot.querySelector("[data-toolbar-group=\"camera\"]")?.insertAdjacentHTML?.("beforebegin", Tl), this.shadowRoot.querySelector(".viewport")?.insertAdjacentHTML?.("afterbegin", "<div class=\"diagram-view\" aria-label=\"Interactive 2D diagram\" hidden><div class=\"diagram-content\"></div></div>"), this.canvas = this.shadowRoot.querySelector("canvas"), this.panel = this.shadowRoot.querySelector(".panel"), this.scene = new nr(), this.camera = new qn(30, 1, .1, 2e3), this.cameraPosition = new U(), this.cameraTarget = new U(), this.raycaster = new Ga(), this.pointer = new V(), this.nodes = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Set(), this._initialOpenContainers = /* @__PURE__ */ new Set(), this.selected = null, this.selectedRelationIndex = null, this.modelData = null, this.documentUri = null, this.documentResolver = null, this.contentResolver = null, this._visits = [], this._visitIndex = -1, this._navigationToken = 0, this._contentToken = 0, this._historyPressTimer = null, this._historyLongPress = !1, this._loading = !1, this._pendingSelection = null, this._theme = Cu(), this.relationMode = yu(this.getAttribute("relation-mode")), this.relationMarker = vu(this.getAttribute("relation-marker")), this.visibleRelationGroups = null, this.focusFilter = hu({
14290
+ super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = "<style>" + Eu + ".toolbar{max-width:calc(100% - 16px);overflow:visible}.toolbar-group{display:flex;align-items:center;gap:2px}.toolbar-group+.toolbar-group{padding-left:6px;border-left:1px solid #38515f}.toolbar .toolbar-icon{display:grid;width:30px;padding:0;place-items:center}.toolbar-icon svg,.toolbar-menu>summary svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.toolbar-menu{position:relative}.toolbar-menu>summary{display:flex;align-items:center;height:30px;padding:0 8px;gap:6px;border-radius:5px;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer;list-style:none;user-select:none}.toolbar-menu>summary::-webkit-details-marker{display:none}.toolbar-menu>summary:hover,.toolbar-menu[open]>summary{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.toolbar-menu-status{max-width:92px;overflow:hidden;font-size:11px;text-overflow:ellipsis;white-space:nowrap}.toolbar-menu-chevron{width:10px;height:10px!important;transition:transform .16s ease}.toolbar-menu[open] .toolbar-menu-chevron{transform:rotate(180deg)}.toolbar-popover{position:absolute;right:0;bottom:calc(100% + 8px);display:grid;min-width:218px;padding:6px;border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:9px;background:var(--lc-toolbar-bg,#15232ff7);box-shadow:0 14px 36px #0009}.toolbar-popover-title{padding:7px 9px 5px;color:var(--lc-hint,#8da6b8);font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.toolbar .toolbar-option{display:grid;grid-template-columns:minmax(0,1fr) 18px;align-items:center;width:100%;height:auto;min-height:34px;padding:7px 9px;text-align:left}.toolbar-option span:first-child{overflow:hidden;text-overflow:ellipsis}.toolbar-option-check{color:var(--lc-toolbar-active-text,#c5f2e9);font-weight:700;text-align:center;visibility:hidden}.toolbar-option.active .toolbar-option-check{visibility:visible}.toolbar-option-separator{height:1px;margin:5px 7px;background:#38515f}.toolbar button[disabled]{opacity:.42;cursor:not-allowed}@media(max-width:620px){.toolbar-menu-status{display:none}.toolbar-menu>summary{width:30px;padding:0;justify-content:center}.toolbar-menu-chevron{display:none}.toolbar-group+.toolbar-group{padding-left:3px}.toolbar-popover{right:-4px}}.toolbar-group[data-toolbar-group=navigation]{position:relative}.toolbar-group[hidden]{display:none}.atlas-history-popover{position:absolute;left:0;bottom:calc(100% + 8px);min-width:250px;max-width:min(360px,80vw);max-height:300px;overflow:auto;padding:6px;border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:9px;background:var(--lc-toolbar-bg,#15232ff7);box-shadow:0 14px 36px #0009;z-index:12}.atlas-history-popover[hidden]{display:none}.atlas-history-popover .history-heading{padding:7px 9px 5px;color:var(--lc-hint,#8da6b8);font-size:10px;text-transform:uppercase;letter-spacing:.1em}.toolbar .atlas-history-popover button{display:block;width:100%;height:auto;padding:8px 9px;text-align:left;white-space:normal;overflow-wrap:anywhere}.atlas-history-popover small{display:block;opacity:.65;font-size:10px}.atlas-jump{position:absolute;z-index:9;display:grid;place-items:center;width:34px;height:34px;border:1px solid #73d9c7;border-radius:50%;background:#173e49;color:#c8fff2;box-shadow:0 4px 16px #0009;cursor:pointer}.atlas-jump[hidden]{display:none}.atlas-jump:hover,.atlas-jump:focus-visible{background:#286776;outline:2px solid #c8fff2}.atlas-jump svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.panel .rich-content{color:var(--lc-panel-text,#b5c6d2);font-size:14px;line-height:1.55}.panel .rich-content h1,.panel .rich-content h2,.panel .rich-content h3{color:var(--lc-panel-title,#e9f0f5);letter-spacing:normal;margin:14px 0 8px}.panel .rich-content a{color:#6ad7c0}.panel .rich-content pre{overflow:auto;padding:8px;background:#091622;border-radius:5px}.panel .rich-content code{font-size:.9em}.panel .rich-content ul,.panel .rich-content ol{padding-left:20px}.document-navigation{position:absolute;top:12px;right:12px;z-index:10;display:flex;padding:5px;border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:8px;background:var(--lc-toolbar-bg,#15232fe8)}.document-navigation[hidden],:host([navigation-controls=external]) .document-navigation{display:none!important}.document-navigation button{display:grid;width:30px;height:30px;place-items:center;padding:0;border:0;border-radius:5px;background:none;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer}.document-navigation button:hover{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.document-navigation button:disabled{opacity:.42;cursor:not-allowed}.document-navigation svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.document-navigation .atlas-history-popover{top:calc(100% + 8px);right:0;bottom:auto;left:auto}.document-navigation .atlas-history-popover button{display:block;width:100%;height:auto;padding:8px 9px;text-align:left;white-space:normal;overflow-wrap:anywhere}@media print{.document-navigation,.atlas-jump{display:none!important}}" + Du + Sl + "</style>" + Iu, this.shadowRoot.querySelector("[data-toolbar-group=\"focus\"]")?.insertAdjacentHTML?.("afterend", Fu), this.shadowRoot.querySelector("[data-toolbar-group=\"navigation\"]")?.insertAdjacentHTML?.("afterend", "<div class=\"toolbar-group\" data-toolbar-group=\"mode\"><button data-action=\"view-mode\" aria-label=\"Switch to 2D diagram\" title=\"Switch to 2D diagram\">2D</button></div>"), this.shadowRoot.querySelector("[data-toolbar-group=\"camera\"]")?.insertAdjacentHTML?.("beforebegin", Tl), this.shadowRoot.querySelector(".viewport")?.insertAdjacentHTML?.("afterbegin", "<div class=\"diagram-view\" aria-label=\"Interactive 2D diagram\" hidden><div class=\"diagram-content\"></div></div>"), this.canvas = this.shadowRoot.querySelector("canvas"), this.panel = this.shadowRoot.querySelector(".panel"), this.scene = new nr(), this.camera = new qn(30, 1, .1, 2e3), this.cameraPosition = new U(), this.cameraTarget = new U(), this.raycaster = new Ga(), this.pointer = new V(), this.nodes = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Set(), this._initialOpenContainers = /* @__PURE__ */ new Set(), this.selected = null, this.selectedRelationIndex = null, this.modelData = null, this.documentUri = null, this.documentResolver = null, this.contentResolver = null, this._visits = [], this._visitIndex = -1, this._navigationToken = 0, this._contentToken = 0, this._historyPressTimer = null, this._historyLongPress = !1, this._loading = !1, this._pendingSelection = null, this._theme = wu(), this.relationMode = bu(this.getAttribute("relation-mode")), this.relationMarker = yu(this.getAttribute("relation-marker")), this.visibleRelationGroups = null, this.focusFilter = gu({
14231
14291
  mode: this.getAttribute("focus-mode"),
14232
14292
  effect: this.getAttribute("focus-effect"),
14233
14293
  layout: this.getAttribute("focus-layout")
14234
- }), this.selectionMode = ["internal", "event"].includes(this.getAttribute("selection-mode")) ? this.getAttribute("selection-mode") : "internal", this.selectionNavigation = gu(this.getAttribute("selection-navigation")), this.itemFacing = _u(this.getAttribute("item-facing")), this.showShellLabels = this.getAttribute("shell-labels") !== "false", this.yaw = .37, this.pitch = .22, this.zoom = 1, this.targetZoom = 1, this.focus = new U(), this.targetFocus = new U(), this.drag = null, this.pointers = /* @__PURE__ */ new Map(), this.relationGroup = new $n(), this.scene.add(this.relationGroup), this.relations = [], this.animationFrame = 0, this.ready = !1, this._toolbarVisible = this.getAttribute("toolbar") !== "off", this._panelVisible = this.getAttribute("panel") !== "off", this.toolbar = this.shadowRoot.querySelector(".toolbar"), this.viewMode = "3d", this.diagramView = new Il(this), this.navigationToolbar = this.shadowRoot.querySelector(".document-navigation"), this.navigationToolbar.append(this.toolbar.querySelector("[data-toolbar-group=\"navigation\"]")), this.jumpButton = this.shadowRoot.querySelector(".atlas-jump"), this.historyPopover = this.shadowRoot.querySelector(".atlas-history-popover"), this._outsideHistoryListener = (e) => {
14294
+ }), this.selectionMode = ["internal", "event"].includes(this.getAttribute("selection-mode")) ? this.getAttribute("selection-mode") : "internal", this.selectionNavigation = _u(this.getAttribute("selection-navigation")), this.itemFacing = vu(this.getAttribute("item-facing")), this.showShellLabels = this.getAttribute("shell-labels") !== "false", this.yaw = .37, this.pitch = .22, this.zoom = 1, this.targetZoom = 1, this.focus = new U(), this.targetFocus = new U(), this.drag = null, this.pointers = /* @__PURE__ */ new Map(), this.relationGroup = new $n(), this.scene.add(this.relationGroup), this.relations = [], this.animationFrame = 0, this.ready = !1, this._toolbarVisible = this.getAttribute("toolbar") !== "off", this._panelVisible = this.getAttribute("panel") !== "off", this.toolbar = this.shadowRoot.querySelector(".toolbar"), this.viewMode = "3d", this.diagramView = new Il(this), this.navigationToolbar = this.shadowRoot.querySelector(".document-navigation"), this.navigationToolbar.append(this.toolbar.querySelector("[data-toolbar-group=\"navigation\"]")), this.jumpButton = this.shadowRoot.querySelector(".atlas-jump"), this.historyPopover = this.shadowRoot.querySelector(".atlas-history-popover"), this._outsideHistoryListener = (e) => {
14235
14295
  e.composedPath().includes(this.navigationToolbar) || this._closeHistoryPopover();
14236
14296
  }, this._copyStatusTimer = null, this._printState = null, this._beforePrintListener = () => this.prepareForPrint(), this._afterPrintListener = () => this.restoreAfterPrint(), this._printMedia = globalThis.matchMedia?.("print") || null, this._printMediaListener = (e) => e.matches ? this.prepareForPrint() : this.restoreAfterPrint(), this._geometryRegistryListener = () => {
14237
14297
  this.ready && this.modelData && this._build();
@@ -14248,7 +14308,7 @@ var xd = class extends HTMLElement {
14248
14308
  }
14249
14309
  attributeChangedCallback(e, t, n) {
14250
14310
  if (t !== n) {
14251
- if (e === "height" && this.style.setProperty("--lc-height", n || "680px"), e === "relation-mode" && this.ready && this.setRelationMode(n || "selected"), e === "relation-marker" && vu(n) !== this.relationMarker && this.setRelationMarker(n, { source: "attribute" }), e === "selection-mode" && this.setSelectionMode(n || "internal"), e === "selection-navigation" && this.setSelectionNavigation(n), e === "item-facing" && _u(n) !== this.itemFacing && this.setItemFacing(n, { source: "attribute" }), e === "focus-mode" && n !== this.focusFilter.mode && this.setFocusFilter({ mode: n }), e === "focus-effect" && n !== this.focusFilter.effect && this.setFocusFilter({ effect: n }), e === "focus-layout" && n !== this.focusFilter.layout && this.setFocusFilter({ layout: n }), e === "shell-labels" && this.ready) {
14311
+ if (e === "height" && this.style.setProperty("--lc-height", n || "680px"), e === "relation-mode" && this.ready && this.setRelationMode(n || "selected"), e === "relation-marker" && yu(n) !== this.relationMarker && this.setRelationMarker(n, { source: "attribute" }), e === "selection-mode" && this.setSelectionMode(n || "internal"), e === "selection-navigation" && this.setSelectionNavigation(n), e === "item-facing" && vu(n) !== this.itemFacing && this.setItemFacing(n, { source: "attribute" }), e === "focus-mode" && n !== this.focusFilter.mode && this.setFocusFilter({ mode: n }), e === "focus-effect" && n !== this.focusFilter.effect && this.setFocusFilter({ effect: n }), e === "focus-layout" && n !== this.focusFilter.layout && this.setFocusFilter({ layout: n }), e === "shell-labels" && this.ready) {
14252
14312
  let e = n !== "false";
14253
14313
  e !== this.showShellLabels && (this.showShellLabels = e, this._build({
14254
14314
  preserveSelection: this.selected?.id,
@@ -14272,6 +14332,10 @@ var xd = class extends HTMLElement {
14272
14332
  if (e !== null && typeof e != "function") throw TypeError("Content resolver must be a function.");
14273
14333
  return this.contentResolver = e, this;
14274
14334
  }
14335
+ setNavigationGuard(e) {
14336
+ if (e !== null && typeof e != "function") throw TypeError("Navigation guard must be a function.");
14337
+ return this.navigationGuard = e, this;
14338
+ }
14275
14339
  setDocumentUri(e) {
14276
14340
  return this.documentUri = Ll(e).uri, this._visits = [this._captureVisit()], this._visitIndex = 0, this._syncDocumentToolbar(), this._renderPanel(), this;
14277
14341
  }
@@ -14281,57 +14345,116 @@ var xd = class extends HTMLElement {
14281
14345
  model: this.modelData ? structuredClone(this.modelData) : null,
14282
14346
  camera: this.getCameraView(),
14283
14347
  open: [...this.open],
14284
- selection: this.selection
14348
+ selection: this.selection,
14349
+ context: this._documentContext ? structuredClone(this._documentContext) : null,
14350
+ viewMode: this.viewMode,
14351
+ diagram: this.diagramView ? this.captureDiagramView() : null,
14352
+ diagramViewport: this.diagramView ? {
14353
+ zoom: this.diagramView.zoom,
14354
+ scrollLeft: this.diagramView.root?.scrollLeft,
14355
+ scrollTop: this.diagramView.root?.scrollTop
14356
+ } : null,
14357
+ focusFilter: this.focusFilter ? { ...this.focusFilter } : null,
14358
+ relationMode: this.relationMode,
14359
+ visibleRelationGroups: this.visibleRelationGroups === void 0 ? void 0 : this.visibleRelationGroups ? [...this.visibleRelationGroups] : null
14285
14360
  };
14286
14361
  }
14362
+ _restoreVisitPresentation(e) {
14363
+ this.setOpenContainers(e.open || [], {
14364
+ emit: !1,
14365
+ source: "studio"
14366
+ }), e.selection?.kind === "entity" ? this.select(e.selection.id, {
14367
+ emit: !1,
14368
+ navigation: "preserve"
14369
+ }) : e.selection?.kind === "relation" && this.selectRelation(e.selection.id, {
14370
+ emit: !1,
14371
+ navigation: "preserve"
14372
+ }), e.focusFilter && this.setFocusFilter(e.focusFilter, {
14373
+ emit: !1,
14374
+ source: "studio"
14375
+ }), e.relationMode !== void 0 && this.setRelationMode(e.relationMode), e.visibleRelationGroups !== void 0 && this.setVisibleRelationGroups(e.visibleRelationGroups, {
14376
+ emit: !1,
14377
+ source: "studio"
14378
+ }), e.diagram && this.diagramView && this.setDiagramView(e.diagram), e.viewMode && this.diagramView && this.setViewMode(e.viewMode, {
14379
+ emit: !1,
14380
+ source: "studio"
14381
+ }), e.diagramViewport && this.diagramView?.root && (this.diagramView.zoom = e.diagramViewport.zoom, this.diagramView.refresh(), this.diagramView.root.scrollLeft = e.diagramViewport.scrollLeft || 0, this.diagramView.root.scrollTop = e.diagramViewport.scrollTop || 0, this._positionJumpButton()), this.setCameraView(e.camera, { animate: !1 });
14382
+ }
14287
14383
  async openAtlas(e) {
14288
- let { uri: t, fragment: n } = Ll(e, this.documentUri);
14289
- if (!this.documentResolver) throw Error("No Atlas document resolver is configured.");
14290
- let r = ++this._navigationToken;
14384
+ let t = ++this._navigationToken;
14291
14385
  try {
14292
- let e = t === this.documentUri ? {
14386
+ let { uri: n, fragment: r } = Ll(e, this.documentUri);
14387
+ if (!this.documentResolver) throw Error("No Atlas document resolver is configured.");
14388
+ if (await this.navigationGuard?.({
14389
+ uri: n,
14390
+ from: this.documentUri,
14391
+ history: !1
14392
+ }), t !== this._navigationToken) return this;
14393
+ let i = n === this.documentUri ? {
14293
14394
  model: this.modelData,
14294
- uri: t
14395
+ uri: n,
14396
+ context: this._documentContext
14295
14397
  } : await this.documentResolver({
14296
- uri: t,
14398
+ uri: n,
14297
14399
  from: this.documentUri
14298
14400
  });
14299
- if (r !== this._navigationToken) return this;
14300
- if (!e?.model) throw Error("Resolver did not return a model for " + t);
14301
- let i = Ll(e.uri || t).uri;
14302
- return this._visitIndex >= 0 && (this._visits[this._visitIndex] = this._captureVisit()), await this.load(e.model, {
14401
+ if (t !== this._navigationToken) return this;
14402
+ if (!i?.model) throw Error("Resolver did not return a model for " + n);
14403
+ if (r && !i.model.entities?.some((e) => e.id === r)) throw Error("The linked Atlas element is unavailable: " + r);
14404
+ let a = Ll(i.uri || n).uri;
14405
+ return this._visitIndex >= 0 && (this._visits[this._visitIndex] = this._captureVisit()), await this.load(i.model, {
14303
14406
  navigation: !0,
14304
- uri: i
14305
- }), r === this._navigationToken ? (this._visits = this._visits.slice(0, this._visitIndex + 1), n && this.select(n, { source: "atlas-link" }), this._visits.push(this._captureVisit()), this._visitIndex = this._visits.length - 1, this._syncDocumentToolbar(), this._renderPanel(), this._emit("lc-navigation", {
14306
- uri: i,
14407
+ uri: a,
14408
+ context: i.context
14409
+ }), t === this._navigationToken ? (this._visits = this._visits.slice(0, this._visitIndex + 1), r && this.select(r, { source: "atlas-link" }), this._visits.push(this._captureVisit()), this._visitIndex = this._visits.length - 1, this._syncDocumentToolbar(), this._renderPanel(), this._emit("lc-navigation", {
14410
+ uri: a,
14411
+ context: this._documentContext,
14307
14412
  index: this._visitIndex,
14308
14413
  length: this._visits.length
14309
14414
  }), this) : this;
14310
- } catch (t) {
14415
+ } catch (n) {
14416
+ if (t !== this._navigationToken) return this;
14311
14417
  throw this._emit("lc-navigation-error", {
14312
14418
  reference: e,
14313
- message: t.message
14314
- }), this.panel?.insertAdjacentHTML?.("afterbegin", "<p class=\"navigation-error\" role=\"alert\">" + Iu(t.message) + "</p>"), t;
14419
+ message: n.message
14420
+ }), this.panel?.insertAdjacentHTML?.("afterbegin", "<p class=\"navigation-error\" role=\"alert\">" + Lu(n.message) + "</p>"), n;
14315
14421
  }
14316
14422
  }
14317
14423
  async _restoreVisit(e) {
14318
14424
  if (!Number.isInteger(e) || e < 0 || e >= this._visits.length || (this._closeHistoryPopover(), e === this._visitIndex)) return this;
14319
- ++this._navigationToken, this._visits[this._visitIndex] = this._captureVisit();
14320
- let t = this._visits[e];
14321
- return await this.load(t.model, {
14425
+ let t = ++this._navigationToken, n = this._visits[e], r = {
14426
+ uri: n.uri,
14427
+ model: n.model,
14428
+ context: n.context
14429
+ };
14430
+ try {
14431
+ if (await this.navigationGuard?.({
14432
+ uri: n.uri,
14433
+ from: this.documentUri,
14434
+ history: !0
14435
+ }), Rl(n.uri).kind === "cloud" && (r = await this.documentResolver({
14436
+ uri: n.uri,
14437
+ from: this.documentUri,
14438
+ history: !0
14439
+ })), t !== this._navigationToken) return this;
14440
+ if (!r?.model) throw Error("The linked Atlas model is unavailable.");
14441
+ } catch (e) {
14442
+ return t === this._navigationToken && this._emit("lc-navigation-error", {
14443
+ reference: n.uri,
14444
+ message: e.message
14445
+ }), this;
14446
+ }
14447
+ return this._visits[this._visitIndex] = this._captureVisit(), await this.load(r.model, {
14322
14448
  navigation: !0,
14323
- uri: t.uri
14324
- }), this._visitIndex = e, this._syncDocumentToolbar(), this.setOpenContainers(t.open, { emit: !1 }), t.selection?.kind === "entity" ? this.select(t.selection.id, {
14325
- emit: !1,
14326
- navigation: "preserve"
14327
- }) : t.selection?.kind === "relation" && this.selectRelation(t.selection.id, {
14328
- emit: !1,
14329
- navigation: "preserve"
14330
- }), this.setCameraView(t.camera, { animate: !1 }), this._renderPanel(), this._emit("lc-navigation", {
14331
- uri: t.uri,
14449
+ uri: n.uri,
14450
+ context: r.context
14451
+ }), t === this._navigationToken ? (this._visitIndex = e, this._syncDocumentToolbar(), this._restoreVisitPresentation(n), this._renderPanel(), this._emit("lc-navigation", {
14452
+ uri: n.uri,
14453
+ context: this._documentContext,
14454
+ restored: !0,
14332
14455
  index: e,
14333
14456
  length: this._visits.length
14334
- }), this;
14457
+ }), this) : this;
14335
14458
  }
14336
14459
  goBack() {
14337
14460
  return this._restoreVisit(this._visitIndex - 1);
@@ -14362,12 +14485,12 @@ var xd = class extends HTMLElement {
14362
14485
  index: this._visitIndex
14363
14486
  };
14364
14487
  }
14365
- restoreNavigationState(e) {
14488
+ restoreNavigationState(e, t = {}) {
14366
14489
  if (!e || !Array.isArray(e.visits) || !Number.isInteger(e.index) || e.index < 0 || e.index >= e.visits.length || e.visits[e.index]?.uri !== this.documentUri) throw TypeError("Navigation state does not match the current Atlas document.");
14367
- return this._visits = structuredClone(e.visits), this._visitIndex = e.index, this._visits[this._visitIndex] = this._captureVisit(), this._syncDocumentToolbar(), this;
14490
+ return this._visits = structuredClone(e.visits), this._visitIndex = e.index, this._documentContext = this._visits[e.index].context || null, t.restorePresentation && this._restoreVisitPresentation(this._visits[e.index]), this._visits[this._visitIndex] = this._captureVisit(), this._syncDocumentToolbar(), this;
14368
14491
  }
14369
14492
  _syncDocumentToolbar() {
14370
- let e = !!this.documentResolver && this._visitIndex >= 0, t = this.navigationToolbar?.querySelector("[data-toolbar-group=\"navigation\"]");
14493
+ let e = !!this.documentResolver && this._visitIndex >= 0 && (!this._toolbarControls || this._toolbarControls.has("navigation")), t = this.navigationToolbar?.querySelector("[data-toolbar-group=\"navigation\"]");
14371
14494
  t && (t.hidden = !e), this.navigationToolbar && (this.navigationToolbar.hidden = !e || !this.toolbarVisible);
14372
14495
  for (let [t, n] of [
14373
14496
  ["atlas-home", e && this._visitIndex > 0],
@@ -14388,16 +14511,25 @@ var xd = class extends HTMLElement {
14388
14511
  let n = e === "back" ? "Previous Atlas documents" : "Next Atlas documents";
14389
14512
  this.historyPopover.innerHTML = "<div class=\"history-heading\">" + n + "</div>" + t.map((e) => {
14390
14513
  let t = this._visits[e], n = t.uri || "", r = decodeURIComponent(n.split("/").pop() || "Atlas"), i = t.model?.title || t.model?.name || r;
14391
- return "<button type=\"button\" role=\"menuitem\" data-action=\"atlas-history-visit\" data-visit-index=\"" + e + "\"><span>" + Iu(i) + "</span><small>" + Iu(n) + "</small></button>";
14514
+ return "<button type=\"button\" role=\"menuitem\" data-action=\"atlas-history-visit\" data-visit-index=\"" + e + "\"><span>" + Lu(i) + "</span><small>" + Lu(n) + "</small></button>";
14392
14515
  }).join(""), this.historyPopover.hidden = !1;
14393
14516
  }
14394
14517
  _syncJumpButton() {
14395
14518
  if (!this.jumpButton) return;
14396
14519
  let e = this.selectedRelationIndex == null ? null : this.relations[this.selectedRelationIndex], t = this.selected || e, n = this.documentResolver && String(t?.atlasRef || "").trim();
14397
- this.jumpButton.hidden = !n, n ? (this.jumpButton.dataset.atlasRef = n, this.jumpButton.title = `Open linked Atlas · ${n}`, this.jumpButton.setAttribute("aria-label", `Open linked Atlas for ${t.name || t.label || "selection"}`)) : delete this.jumpButton.dataset.atlasRef;
14520
+ this.jumpButton.hidden = !n, n ? (this.jumpButton.dataset.atlasRef = n, this.jumpButton.title = `Open linked Atlas · ${n}`, this.jumpButton.setAttribute("aria-label", `Open linked Atlas for ${t.name || t.label || "selection"}`)) : delete this.jumpButton.dataset.atlasRef, n && this.ready && this._positionJumpButton();
14398
14521
  }
14399
14522
  _positionJumpButton() {
14400
14523
  if (!this.jumpButton || this.jumpButton.hidden) return;
14524
+ if (this.viewMode === "2d") {
14525
+ let e = this.relations[this.selectedRelationIndex], t = this.selected ? "entity" : "relation", n = this.selected?.id || e?.id, r = [...this.diagramView?.content?.querySelectorAll("[data-" + t + "]") || []].find((e) => e.dataset[t] === n), i = this.shadowRoot.querySelector(".viewport").getBoundingClientRect(), a = r?.getBoundingClientRect();
14526
+ if (!a || !a.width || a.right < i.left || a.left > i.right || a.bottom < i.top || a.top > i.bottom) {
14527
+ this.jumpButton.style.visibility = "hidden";
14528
+ return;
14529
+ }
14530
+ this.jumpButton.style.visibility = "visible", this.jumpButton.style.left = Math.max(20, Math.min(i.width - 40, a.right - i.left + 8)) + "px", this.jumpButton.style.top = Math.max(20, Math.min(i.height - 40, a.top - i.top - 12)) + "px";
14531
+ return;
14532
+ }
14401
14533
  let e;
14402
14534
  if (this.selected) {
14403
14535
  if (!this._isVisible(this.selected)) {
@@ -14434,14 +14566,14 @@ var xd = class extends HTMLElement {
14434
14566
  from: this.documentUri,
14435
14567
  format: e.format
14436
14568
  })).then((i) => {
14437
- r === this._contentToken && (n.innerHTML = Hl({
14569
+ r === this._contentToken && (n.innerHTML = Ul({
14438
14570
  format: e.format,
14439
14571
  value: i
14440
14572
  }, { title: t }));
14441
14573
  }).catch((e) => {
14442
14574
  r === this._contentToken && (n.textContent = "Could not load content: " + e.message);
14443
14575
  });
14444
- } else n.innerHTML = Hl(e, { title: t });
14576
+ } else n.innerHTML = Ul(e, { title: t });
14445
14577
  }
14446
14578
  }
14447
14579
  get selectedId() {
@@ -14465,14 +14597,14 @@ var xd = class extends HTMLElement {
14465
14597
  } : null;
14466
14598
  }
14467
14599
  get palette() {
14468
- return this.modelData?.palette || { ...Wl };
14600
+ return this.modelData?.palette || { ...Gl };
14469
14601
  }
14470
14602
  set palette(e) {
14471
14603
  this.setPalette(e);
14472
14604
  }
14473
14605
  captureFrame(e = {}) {
14474
- let t = e.background === "theme" ? this.theme?.background || xu.background : e.background;
14475
- return vd(this.renderer, this.scene, this.camera, this.ownerDocument, {
14606
+ let t = e.background === "theme" ? this.theme?.background || Su.background : e.background;
14607
+ return yd(this.renderer, this.scene, this.camera, this.ownerDocument, {
14476
14608
  ...e,
14477
14609
  background: t
14478
14610
  });
@@ -14515,7 +14647,7 @@ var xd = class extends HTMLElement {
14515
14647
  let t = e.svg ? { svg: e.svg } : this.exportDiagramSvg(e), n = await yl(t.svg, this.ownerDocument);
14516
14648
  return {
14517
14649
  ...t,
14518
- blob: await yd(n)
14650
+ blob: await bd(n)
14519
14651
  };
14520
14652
  }
14521
14653
  async copyFrame(e = {}) {
@@ -14527,7 +14659,7 @@ var xd = class extends HTMLElement {
14527
14659
  scale: n
14528
14660
  });
14529
14661
  if (!c) throw Error("Atlas could not capture the current WebGL view.");
14530
- let l = yd(c), u = "clipboard";
14662
+ let l = bd(c), u = "clipboard";
14531
14663
  if (o) try {
14532
14664
  await i.clipboard.write([new a({ "image/png": l })]);
14533
14665
  } catch (e) {
@@ -14536,7 +14668,7 @@ var xd = class extends HTMLElement {
14536
14668
  }
14537
14669
  else u = "download";
14538
14670
  let d = await l;
14539
- u === "download" && bd(d, e);
14671
+ u === "download" && xd(d, e);
14540
14672
  let f = {
14541
14673
  blob: d,
14542
14674
  width: c.width,
@@ -14665,13 +14797,13 @@ var xd = class extends HTMLElement {
14665
14797
  if (!e.size) return null;
14666
14798
  for (let t of [...e]) {
14667
14799
  let n = this.nodes.get(t);
14668
- n && mu(n.type) && this._descendantIds(t, e);
14800
+ n && hu(n.type) && this._descendantIds(t, e);
14669
14801
  }
14670
14802
  let t = new Set(e);
14671
14803
  for (let n of this.relations) (t.has(n.from) || t.has(n.to)) && (e.add(n.from), e.add(n.to));
14672
14804
  for (let t of [...e]) {
14673
14805
  let n = this.nodes.get(t);
14674
- n && mu(n.type) && this._descendantIds(t, e);
14806
+ n && hu(n.type) && this._descendantIds(t, e);
14675
14807
  }
14676
14808
  for (let t of [...e]) {
14677
14809
  let n = this.nodes.get(t)?.parent ? this.nodes.get(this.nodes.get(t).parent) : null;
@@ -14714,7 +14846,7 @@ var xd = class extends HTMLElement {
14714
14846
  }
14715
14847
  _syncRelationToolbar() {
14716
14848
  if (!this.shadowRoot) return;
14717
- for (let e of Kl) {
14849
+ for (let e of ql) {
14718
14850
  let t = this.shadowRoot.querySelector(`[data-action="relations-${e}"]`);
14719
14851
  if (!t) continue;
14720
14852
  let n = e === this.relationMode;
@@ -14731,7 +14863,7 @@ var xd = class extends HTMLElement {
14731
14863
  let t = this.modelData?.relationGroups || [], n = this.shadowRoot.querySelector("[data-relation-groups-section]"), r = this.shadowRoot.querySelector("[data-relation-groups]");
14732
14864
  n && (n.hidden = t.length === 0), r && (r.innerHTML = t.map((e) => {
14733
14865
  let t = !this.visibleRelationGroups || this.visibleRelationGroups.has(e.id);
14734
- return ku("relation-group-toggle", Iu(e.label || e.id), t).replace("data-action=\"relation-group-toggle\"", `data-action="relation-group-toggle" data-relation-group="${Iu(e.id)}"`);
14866
+ return Au("relation-group-toggle", Lu(e.label || e.id), t).replace("data-action=\"relation-group-toggle\"", `data-action="relation-group-toggle" data-relation-group="${Lu(e.id)}"`);
14735
14867
  }).join(""));
14736
14868
  }
14737
14869
  _syncPanelToolbar() {
@@ -14756,7 +14888,7 @@ var xd = class extends HTMLElement {
14756
14888
  });
14757
14889
  }
14758
14890
  setFocusFilter(e = {}, t = {}) {
14759
- let n = hu({
14891
+ let n = gu({
14760
14892
  ...this.focusFilter,
14761
14893
  ...e || {}
14762
14894
  }), r = JSON.stringify(n) !== JSON.stringify(this.focusFilter);
@@ -14765,13 +14897,35 @@ var xd = class extends HTMLElement {
14765
14897
  clearFocusFilter(e = {}) {
14766
14898
  return this.setFocusFilter({ mode: "all" }, e);
14767
14899
  }
14900
+ _setToolbarControls(e) {
14901
+ let t = Array.isArray(e) ? new Set(e.map((e) => String(e).trim())) : null;
14902
+ if (this._toolbarControls = t, !this.toolbar) return;
14903
+ let n = (...e) => !t || t.has("all") || e.some((e) => t.has(e)), r = this.toolbar, i = {
14904
+ "view-mode": ["mode", "view-mode"],
14905
+ minus: ["zoom", "minus"],
14906
+ plus: ["zoom", "plus"],
14907
+ fit: ["fit"],
14908
+ front: ["front"],
14909
+ "diagram-minus": ["zoom", "diagram-minus"],
14910
+ "diagram-plus": ["zoom", "diagram-plus"],
14911
+ "diagram-fit": ["fit", "diagram-fit"]
14912
+ };
14913
+ for (let e of r.querySelectorAll(".toolbar-group > button[data-action]")) e.hidden = !n(...i[e.dataset.action] || [e.dataset.action]);
14914
+ for (let e of r.querySelectorAll(".toolbar-group > .toolbar-menu")) {
14915
+ let t = e.dataset.toolbarMenu;
14916
+ e.hidden = !n(t, t?.replace(/^diagram-/, "")), e.hidden && (e.open = !1);
14917
+ }
14918
+ for (let e of r.querySelectorAll(".toolbar-group:not([data-toolbar-group=\"navigation\"])")) e.hidden = !e.querySelector(":scope > button[data-action]:not([hidden]), :scope > .toolbar-menu:not([hidden])");
14919
+ this._syncDocumentToolbar();
14920
+ }
14768
14921
  _applyModelRenderOptions() {
14769
14922
  let e = {
14770
14923
  ...this.modelData?.render,
14771
14924
  ...this.modelData?.render?.views?.["3d"]
14772
14925
  };
14773
14926
  if (!e || typeof e != "object") return this;
14774
- Kl.includes(e.relationMode) && e.relationMode !== this.relationMode && this.setRelationMode(e.relationMode), vu(e.relationMarker) !== this.relationMarker && this.setRelationMarker(e.relationMarker, {
14927
+ let t = this.modelData?.render?.ui?.toolbar ?? e.toolbar;
14928
+ this._setToolbarControls(Array.isArray(t) ? t : this.modelData?.render?.ui?.controls), ql.includes(e.relationMode) && e.relationMode !== this.relationMode && this.setRelationMode(e.relationMode), yu(e.relationMarker) !== this.relationMarker && this.setRelationMarker(e.relationMarker, {
14775
14929
  emit: !1,
14776
14930
  source: "model"
14777
14931
  }), Array.isArray(e.visibleRelationGroups) ? this.setVisibleRelationGroups(e.visibleRelationGroups, {
@@ -14781,8 +14935,8 @@ var xd = class extends HTMLElement {
14781
14935
  emit: !1,
14782
14936
  source: "model"
14783
14937
  }), Object.hasOwn(e, "selectionMode") && e.selectionMode !== this.selectionMode && this.setSelectionMode(e.selectionMode);
14784
- let t = e.navigation?.onSelect ?? e.selectionNavigation;
14785
- return t != null && t !== this.selectionNavigation && this.setSelectionNavigation(t), Object.hasOwn(e, "toolbar") && e.toolbar !== !1 !== this.toolbarVisible && this.setToolbarVisible(e.toolbar !== !1), Object.hasOwn(e, "shellLabels") && e.shellLabels !== !1 !== this.showShellLabels && this.setShellLabels(e.shellLabels !== !1), Object.hasOwn(e, "itemFacing") && _u(e.itemFacing) !== this.itemFacing && this.setItemFacing(e.itemFacing, {
14938
+ let n = e.navigation?.onSelect ?? e.selectionNavigation;
14939
+ return n != null && n !== this.selectionNavigation && this.setSelectionNavigation(n), t !== void 0 && t !== !1 !== this.toolbarVisible && this.setToolbarVisible(t !== !1), Object.hasOwn(e, "shellLabels") && e.shellLabels !== !1 !== this.showShellLabels && this.setShellLabels(e.shellLabels !== !1), Object.hasOwn(e, "itemFacing") && vu(e.itemFacing) !== this.itemFacing && this.setItemFacing(e.itemFacing, {
14786
14940
  emit: !1,
14787
14941
  source: "model"
14788
14942
  }), e.focus && this.setFocusFilter(e.focus, { emit: !1 }), this;
@@ -14795,10 +14949,10 @@ var xd = class extends HTMLElement {
14795
14949
  }));
14796
14950
  }
14797
14951
  _containerEntityIds() {
14798
- return (this.modelData?.entities || []).filter((e) => mu(e.type)).map((e) => e.id);
14952
+ return (this.modelData?.entities || []).filter((e) => hu(e.type)).map((e) => e.id);
14799
14953
  }
14800
14954
  _declaredOpenContainerIds() {
14801
- return (this.modelData?.entities || []).filter((e) => mu(e.type) && e.open === !0).map((e) => e.id);
14955
+ return (this.modelData?.entities || []).filter((e) => hu(e.type) && e.open === !0).map((e) => e.id);
14802
14956
  }
14803
14957
  _emitContainerStateChange(e, t = {}) {
14804
14958
  if (!e?.changed || t.emit === !1) return;
@@ -14860,7 +15014,7 @@ var xd = class extends HTMLElement {
14860
15014
  }
14861
15015
  _commitModelChange(e, t = {}, n = {}) {
14862
15016
  let r = n.preserveSelection === !1 ? null : this.selected?.id, i = n.preserveSelection === !1 ? null : this._publicRelation(this.selectedRelationIndex), a = i?.id ?? i?.index ?? null;
14863
- this.modelData = Bu(this.modelData);
15017
+ this.modelData = Vu(this.modelData);
14864
15018
  let o = this._syncInitialContainerState({
14865
15019
  refresh: !1,
14866
15020
  emit: !1,
@@ -14877,7 +15031,7 @@ var xd = class extends HTMLElement {
14877
15031
  }
14878
15032
  updateModel(e = {}, t = {}) {
14879
15033
  if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("The model patch must be an object.");
14880
- let n = this.modelData || Bu({}), r = JSON.stringify(n.render?.views?.["3d"]?.camera || n.render?.camera || null), i = JSON.stringify(n.render?.views?.["2d"] || null), a = n.render?.initialMode, o = {
15034
+ let n = this.modelData || Vu({}), r = JSON.stringify(n.render?.views?.["3d"]?.camera || n.render?.camera || null), i = JSON.stringify(n.render?.views?.["2d"] || null), a = n.render?.initialMode, o = {
14881
15035
  ...n,
14882
15036
  ...e,
14883
15037
  palette: e.palette ? {
@@ -14888,7 +15042,7 @@ var xd = class extends HTMLElement {
14888
15042
  entities: Array.isArray(e.entities) ? e.entities : n.entities,
14889
15043
  relations: Array.isArray(e.relations) ? e.relations : n.relations
14890
15044
  };
14891
- this.modelData = Bu(o), this.theme = this.modelData.theme, this._commitModelChange("model-update", { patch: e }, t), this._applyModelRenderOptions();
15045
+ this.modelData = Vu(o), this.theme = this.modelData.theme, this._commitModelChange("model-update", { patch: e }, t), this._applyModelRenderOptions();
14892
15046
  let s = this.modelData.render?.views?.["3d"]?.camera || this.modelData.render?.camera;
14893
15047
  return JSON.stringify(s || null) !== r && s && this.setCameraView(s, { animate: t.animateCamera !== !1 }), JSON.stringify(this.modelData.render?.views?.["2d"] || null) !== i && this.diagramView.setState(this.modelData.render?.views?.["2d"] || {}), this.modelData.render?.initialMode === a ? this.diagramView.refresh() : this.setViewMode(this.modelData.render?.initialMode === "2d" ? "2d" : "3d", {
14894
15048
  emit: !1,
@@ -14897,7 +15051,7 @@ var xd = class extends HTMLElement {
14897
15051
  }
14898
15052
  addEntity(e, t = {}) {
14899
15053
  if (!e || typeof e != "object" || !e.id) throw TypeError("The entity must include an id.");
14900
- if (this.modelData ||= Bu({}), this.modelData.entities.some((t) => t.id === e.id)) throw Error(`An entity with id "${e.id}" already exists.`);
15054
+ if (this.modelData ||= Vu({}), this.modelData.entities.some((t) => t.id === e.id)) throw Error(`An entity with id "${e.id}" already exists.`);
14901
15055
  if (e.parent && !this.modelData.entities.some((t) => t.id === e.parent)) throw Error(`Parent container "${e.parent}" does not exist.`);
14902
15056
  return this.modelData.entities = [...this.modelData.entities, { ...e }], this._commitModelChange("entity-add", { entity: this._publicEntity(e.id) }, t);
14903
15057
  }
@@ -14971,13 +15125,13 @@ var xd = class extends HTMLElement {
14971
15125
  }, t);
14972
15126
  }
14973
15127
  zoomIn() {
14974
- return this.targetZoom = Math.min(Jl, this.targetZoom * 1.18), this.invalidate(), this;
15128
+ return this.targetZoom = Math.min(Yl, this.targetZoom * 1.18), this.invalidate(), this;
14975
15129
  }
14976
15130
  zoomOut() {
14977
- return this.targetZoom = Math.max(ql, this.targetZoom / 1.18), this.invalidate(), this;
15131
+ return this.targetZoom = Math.max(Jl, this.targetZoom / 1.18), this.invalidate(), this;
14978
15132
  }
14979
15133
  setSelectionNavigation(e) {
14980
- let t = gu(e);
15134
+ let t = _u(e);
14981
15135
  return this.selectionNavigation = t, this.getAttribute("selection-navigation") !== t && this.setAttribute("selection-navigation", t), this;
14982
15136
  }
14983
15137
  focusSelection(e = {}) {
@@ -14990,7 +15144,7 @@ var xd = class extends HTMLElement {
14990
15144
  return t ? (this.targetFocus.copy(t), this.targetZoom = n, e.animate === !1 && (this.focus.copy(this.targetFocus), this.zoom = this.targetZoom), this.invalidate(), this) : this;
14991
15145
  }
14992
15146
  _applySelectionNavigation(e = this.selectionNavigation) {
14993
- let t = gu(e);
15147
+ let t = _u(e);
14994
15148
  if (t === "preserve") return this;
14995
15149
  let n = this.targetZoom;
14996
15150
  return this.focusSelection(), t === "center" && (this.targetZoom = n), this;
@@ -15015,7 +15169,7 @@ var xd = class extends HTMLElement {
15015
15169
  return Math.max(29, 39.5 / Math.max(this.camera.aspect, .5));
15016
15170
  }
15017
15171
  getCameraView() {
15018
- let e = this.focus.clone(), t = this._baseCameraDistance() / Math.max(ql, this.zoom), n = new U(Math.sin(this.yaw) * Math.cos(this.pitch), Math.sin(this.pitch), Math.cos(this.yaw) * Math.cos(this.pitch)).multiplyScalar(t).add(e), r = (e) => e.map((e) => Number(e.toFixed(3)));
15172
+ let e = this.focus.clone(), t = this._baseCameraDistance() / Math.max(Jl, this.zoom), n = new U(Math.sin(this.yaw) * Math.cos(this.pitch), Math.sin(this.pitch), Math.cos(this.yaw) * Math.cos(this.pitch)).multiplyScalar(t).add(e), r = (e) => e.map((e) => Number(e.toFixed(3)));
15019
15173
  return {
15020
15174
  position: r(n.toArray()),
15021
15175
  target: r(e.toArray()),
@@ -15029,7 +15183,7 @@ var xd = class extends HTMLElement {
15029
15183
  if (!(a > 1e-6)) return this;
15030
15184
  this.yaw = Math.atan2(i.x, i.z), this.pitch = Math.asin(Math.max(-1, Math.min(1, i.y / a)));
15031
15185
  let o = Number(e.zoom), s = Number.isFinite(o) && o > 0 ? o : this._baseCameraDistance() / a;
15032
- return this.targetFocus.copy(r), this.targetZoom = Math.max(ql, Math.min(Jl, s)), t.animate === !1 && (this.focus.copy(this.targetFocus), this.zoom = this.targetZoom), this.invalidate(), this;
15186
+ return this.targetFocus.copy(r), this.targetZoom = Math.max(Jl, Math.min(Yl, s)), t.animate === !1 && (this.focus.copy(this.targetFocus), this.zoom = this.targetZoom), this.invalidate(), this;
15033
15187
  }
15034
15188
  restoreInitialCamera(e = {}) {
15035
15189
  let t = this.modelData?.render?.views?.["3d"]?.camera || this.modelData?.render?.camera;
@@ -15046,7 +15200,7 @@ var xd = class extends HTMLElement {
15046
15200
  t.expandByPoint(n.clone().sub(r)), t.expandByPoint(n.clone().add(r));
15047
15201
  }
15048
15202
  let n = t.isEmpty() ? new U() : t.getCenter(new U()), r = t.isEmpty() ? new U(1, 1, 1) : t.getSize(new U()), i = Math.max(1, r.length() / 2), a = de.degToRad(this.camera.fov), o = i / Math.sin(a / 2) * 1.12, s = this._baseCameraDistance();
15049
- return this.targetZoom = Math.max(ql, Math.min(Jl, s / o)), this.targetFocus.copy(n), e.animate === !1 && (this.zoom = this.targetZoom, this.focus.copy(this.targetFocus)), this.invalidate(), this;
15203
+ return this.targetZoom = Math.max(Jl, Math.min(Yl, s / o)), this.targetFocus.copy(n), e.animate === !1 && (this.zoom = this.targetZoom, this.focus.copy(this.targetFocus)), this.invalidate(), this;
15050
15204
  }
15051
15205
  frontView() {
15052
15206
  return this.yaw = 0, this.pitch = 0, this.invalidate(), this;
@@ -15062,7 +15216,7 @@ var xd = class extends HTMLElement {
15062
15216
  return this.setShellLabels(!this.showShellLabels);
15063
15217
  }
15064
15218
  setItemFacing(e = "camera", t = {}) {
15065
- let n = _u(e), r = n !== this.itemFacing;
15219
+ let n = vu(e), r = n !== this.itemFacing;
15066
15220
  return this.itemFacing = n, this.getAttribute("item-facing") !== n && this.setAttribute("item-facing", n), this._syncItemFacingToolbar(), this._applyItemFacing(), this.invalidate(), r && t.emit !== !1 && this._emit("lc-item-facing-change", {
15067
15221
  mode: n,
15068
15222
  source: t.source || "api"
@@ -15072,7 +15226,7 @@ var xd = class extends HTMLElement {
15072
15226
  return this.setItemFacing(this.itemFacing === "camera" ? "model" : "camera", e);
15073
15227
  }
15074
15228
  _applyItemFacing() {
15075
- if (this.camera) for (let e of this.nodes.values()) e.group && !mu(e.type) && (this.itemFacing === "camera" ? e.group.quaternion.copy(this.camera.quaternion) : e.group.quaternion.identity());
15229
+ if (this.camera) for (let e of this.nodes.values()) e.group && !hu(e.type) && (this.itemFacing === "camera" ? e.group.quaternion.copy(this.camera.quaternion) : e.group.quaternion.identity());
15076
15230
  }
15077
15231
  isContainerOpen(e) {
15078
15232
  return this._containerEntityIds().includes(e) && this.open.has(e);
@@ -15087,14 +15241,14 @@ var xd = class extends HTMLElement {
15087
15241
  setContainerOpen(e, t = !0, n = {}) {
15088
15242
  let r = this.modelData?.entities?.find((t) => t.id === e);
15089
15243
  if (!r) throw Error(`No entity with id "${e}" exists.`);
15090
- if (!mu(r.type)) throw TypeError(`Entity "${e}" is not a container.`);
15244
+ if (!hu(r.type)) throw TypeError(`Entity "${e}" is not a container.`);
15091
15245
  let i = new Set(this.open);
15092
15246
  if (t) i.add(e);
15093
15247
  else if (i.delete(e), n.closeDescendants !== !1) for (let t of this.modelData.entities) {
15094
15248
  let n = t.parent, r = /* @__PURE__ */ new Set();
15095
15249
  for (; n && !r.has(n);) {
15096
15250
  if (r.add(n), n === e) {
15097
- mu(t.type) && i.delete(t.id);
15251
+ hu(t.type) && i.delete(t.id);
15098
15252
  break;
15099
15253
  }
15100
15254
  n = this.modelData.entities.find((e) => e.id === n)?.parent || null;
@@ -15131,20 +15285,20 @@ var xd = class extends HTMLElement {
15131
15285
  this.setTheme(e);
15132
15286
  }
15133
15287
  get theme() {
15134
- return this._theme || Cu();
15288
+ return this._theme || wu();
15135
15289
  }
15136
15290
  set theme(e) {
15137
- this._theme = Cu(e), this.shadowRoot && this._applyTheme();
15291
+ this._theme = wu(e), this.shadowRoot && this._applyTheme();
15138
15292
  }
15139
15293
  setTheme(e = {}) {
15140
- return this.theme = Su(this.theme, e), this.modelData && (this.modelData.theme = this.theme), this._applyLighting(), this.invalidate(), this;
15294
+ return this.theme = Cu(this.theme, e), this.modelData && (this.modelData.theme = this.theme), this._applyLighting(), this.invalidate(), this;
15141
15295
  }
15142
15296
  _applyTheme() {
15143
15297
  let e = this.theme, t = this.style;
15144
15298
  t.setProperty("--lc-bg", e.background.color), t.setProperty("--lc-bg-glow", e.background.glow), t.setProperty("--lc-bg-fade", e.background.fade), t.setProperty("--lc-panel-bg", e.panel.background), t.setProperty("--lc-panel-border", e.panel.border), t.setProperty("--lc-panel-text", e.panel.text), t.setProperty("--lc-panel-title", e.panel.title), t.setProperty("--lc-toolbar-bg", e.toolbar.background), t.setProperty("--lc-toolbar-border", e.toolbar.border), t.setProperty("--lc-toolbar-text", e.toolbar.text), t.setProperty("--lc-toolbar-active", e.toolbar.active), t.setProperty("--lc-toolbar-active-text", e.toolbar.activeText), t.setProperty("--lc-crumb-bg", e.breadcrumbs.background), t.setProperty("--lc-crumb-text", e.breadcrumbs.text), t.setProperty("--lc-crumb-active", e.breadcrumbs.active), t.setProperty("--lc-crumb-active-text", e.breadcrumbs.activeText), t.setProperty("--lc-hint", e.hint);
15145
15299
  let n = this.shadowRoot.querySelector(".atlas"), r = this.shadowRoot.querySelector(".toolbar"), i = this.shadowRoot.querySelector(".panel"), a = this.shadowRoot.querySelector(".hint");
15146
15300
  n && (n.dataset.panel = this.panelVisible ? "visible" : "hidden");
15147
- let o = this.toolbarVisible, s = this.panelVisible, c = e.ui.hint !== !1;
15301
+ let o = this.toolbarVisible, s = this.panelVisible, c = (this.modelData?.render?.ui?.hint ?? e.ui.hint) !== !1;
15148
15302
  r && (r.dataset.hidden = String(!o), r.hidden = !o, r.style.setProperty("display", o ? "flex" : "none", "important")), this._syncDocumentToolbar(), i && (i.dataset.hidden = String(!s), i.hidden = !s), this._syncPanelToolbar(), a && (a.dataset.hidden = String(!c), a.hidden = !c), this.shadowRoot.querySelectorAll(".crumbs").forEach((t) => {
15149
15303
  t.dataset.hidden = String(e.ui.breadcrumbs === !1), t.hidden = e.ui.breadcrumbs === !1;
15150
15304
  });
@@ -15154,7 +15308,7 @@ var xd = class extends HTMLElement {
15154
15308
  if (e) return this.load(e);
15155
15309
  let t = this.querySelector("script[type=\"application/json\"]");
15156
15310
  if (!t) return this.load({
15157
- palette: Wl,
15311
+ palette: Gl,
15158
15312
  entities: [],
15159
15313
  relations: []
15160
15314
  });
@@ -15168,7 +15322,7 @@ var xd = class extends HTMLElement {
15168
15322
  this._loading = !0, this._pendingSelection = null;
15169
15323
  try {
15170
15324
  let n = typeof e == "string" ? await fetch(e).then((e) => e.json()) : e;
15171
- this.modelData = Bu(n), t.navigation ? this.documentUri = t.uri || null : (++this._navigationToken, this.documentUri = t.uri ? Ll(t.uri).uri : null, this._visits = [], this._visitIndex = -1), this._syncDocumentToolbar(), this.selected = null, this.selectedRelationIndex = null, this.open.clear(), this._initialOpenContainers.clear(), this._pendingPalette &&= (this.modelData.palette = {
15325
+ this.modelData = Vu(n), this._documentContext = t.context || null, t.navigation ? this.documentUri = t.uri || null : (++this._navigationToken, this.documentUri = t.uri ? Ll(t.uri).uri : null, this._visits = [], this._visitIndex = -1), this._syncDocumentToolbar(), this.selected = null, this.selectedRelationIndex = null, this.open.clear(), this._initialOpenContainers.clear(), this._pendingPalette &&= (this.modelData.palette = {
15172
15326
  ...this.modelData.palette,
15173
15327
  ...this._pendingPalette
15174
15328
  }, null), this.theme = this.modelData.theme, this._applyTheme(), this._syncInitialContainerState({
@@ -15205,9 +15359,9 @@ var xd = class extends HTMLElement {
15205
15359
  }
15206
15360
  _applyLighting() {
15207
15361
  if (!this.ambientLight || !this.directionalLight) return;
15208
- let e = this.theme?.lighting || xu.lighting;
15362
+ let e = this.theme?.lighting || Su.lighting;
15209
15363
  this.ambientLight.color.set(e.ambientSky), this.ambientLight.groundColor.set(e.ambientGround), this.ambientLight.intensity = Number(e.ambient) || 0, this.directionalLight.color.set(e.directionalColor), this.directionalLight.intensity = Number(e.directional) || 0;
15210
- let t = Array.isArray(e.directionalPosition) ? e.directionalPosition : xu.lighting.directionalPosition;
15364
+ let t = Array.isArray(e.directionalPosition) ? e.directionalPosition : Su.lighting.directionalPosition;
15211
15365
  this.directionalLight.position.fromArray(t);
15212
15366
  }
15213
15367
  _worldPosition(e, t = /* @__PURE__ */ new Set()) {
@@ -15244,7 +15398,7 @@ var xd = class extends HTMLElement {
15244
15398
  ...e.geometryPalette || {},
15245
15399
  ...e.geometryPaletteOverrides || {}
15246
15400
  };
15247
- n.material.color.set(Ju(n.value, r, t)), n.material.emissive && n.emissiveValue && n.material.emissive.set(Ju(n.emissiveValue, r, "#000000"));
15401
+ n.material.color.set(Yu(n.value, r, t)), n.material.emissive && n.emissiveValue && n.material.emissive.set(Yu(n.emissiveValue, r, "#000000"));
15248
15402
  }
15249
15403
  }
15250
15404
  }
@@ -15257,19 +15411,19 @@ var xd = class extends HTMLElement {
15257
15411
  for (let e of this.modelData.entities) {
15258
15412
  let t = this.nodes.get(e.id);
15259
15413
  t.group = new $n(), t.group.position.copy(this._worldPosition(t));
15260
- let n = e.geometry || "box", r = pu(n), i = !r && n.includes("."), a = i ? "#ed8f98" : this.modelData.palette[e.c] || e.c || this.modelData.palette.component;
15414
+ let n = e.geometry || "box", r = mu(n), i = !r && n.includes("."), a = i ? "#ed8f98" : this.modelData.palette[e.c] || e.c || this.modelData.palette.component;
15261
15415
  i && this.dispatchEvent(new CustomEvent("lc-warning", { detail: {
15262
15416
  code: "GEOMETRY_NOT_REGISTERED",
15263
15417
  geometry: n,
15264
15418
  entityId: e.id
15265
15419
  } }));
15266
- let o = r?.primitive || n, s = r && !r.primitive && !mu(e.type);
15420
+ let o = r?.primitive || n, s = r && !r.primitive && !hu(e.type);
15267
15421
  if (t.geometryDefinition = r || null, t.geometryMissing = i, t.geometryPalette = r?.palette || {}, t.geometryPaletteOverrides = e.geometryPalette || e.geometry_palette || {}, t.ports = {
15268
15422
  ...r?.anchors || {},
15269
15423
  ...e.ports || {}
15270
15424
  }, s) {
15271
15425
  try {
15272
- let n = cd(r, e, this.modelData.palette, () => this._geometryContentUpdated(), (e) => this.dispatchEvent(new CustomEvent("lc-warning", { detail: e })));
15426
+ let n = ld(r, e, this.modelData.palette, () => this._geometryContentUpdated(), (e) => this.dispatchEvent(new CustomEvent("lc-warning", { detail: e })));
15273
15427
  n.root.scale.multiply(new U().fromArray(e.s)), t.appearanceMaterials = [], n.root.traverse((e) => {
15274
15428
  if (!(e.isMesh || e.isLine || e.isLineSegments || e.isSprite)) return;
15275
15429
  e.userData.node = t;
@@ -15290,7 +15444,7 @@ var xd = class extends HTMLElement {
15290
15444
  entityId: e.id,
15291
15445
  error: r
15292
15446
  } }));
15293
- let i = Ku(Gu("box"));
15447
+ let i = qu(Ku("box"));
15294
15448
  t.material = new aa({
15295
15449
  color: "#ed8f98",
15296
15450
  roughness: .72,
@@ -15299,13 +15453,13 @@ var xd = class extends HTMLElement {
15299
15453
  }
15300
15454
  t.labelSize = new U().fromArray(e.s);
15301
15455
  } else {
15302
- let n = o === "box" && Number(e.radius) > 0, r = Gu(o, e.radius, e.segments, e.s);
15303
- n || Ku(r), t.material = new aa({
15456
+ let n = o === "box" && Number(e.radius) > 0, r = Ku(o, e.radius, e.segments, e.s);
15457
+ n || qu(r), t.material = new aa({
15304
15458
  color: a,
15305
15459
  roughness: .72,
15306
15460
  metalness: .06,
15307
15461
  transparent: !0,
15308
- opacity: mu(e.type) ? .96 : 1
15462
+ opacity: hu(e.type) ? .96 : 1
15309
15463
  }), t.mesh = new jn(r, t.material), t.mesh.scale.fromArray(n ? [
15310
15464
  1,
15311
15465
  1,
@@ -15320,7 +15474,7 @@ var xd = class extends HTMLElement {
15320
15474
  1
15321
15475
  ] : e.s), t.group.add(t.edge);
15322
15476
  }
15323
- t.label = md(e.name, a, t.labelSize, e.type, this.showShellLabels), t.labelAnchor = dd(e, this.modelData.style), t.label.userData.node = t, t.label.traverse((e) => {
15477
+ t.label = hd(e.name, a, t.labelSize, e.type, this.showShellLabels), t.labelAnchor = fd(e, this.modelData.style), t.label.userData.node = t, t.label.traverse((e) => {
15324
15478
  e.userData.node = t;
15325
15479
  }), t.group.add(t.label), this.scene.add(t.group);
15326
15480
  }
@@ -15372,14 +15526,14 @@ var xd = class extends HTMLElement {
15372
15526
  for (; n.length;) {
15373
15527
  let e = n.shift();
15374
15528
  e && !r.has(e) && (r.add(e), this.relations.forEach((a, o) => {
15375
- let s = wu(a) === "bidirectional", c = null;
15529
+ let s = Tu(a) === "bidirectional", c = null;
15376
15530
  t === "callers" ? a.to === e ? c = a.from : s && a.from === e && (c = a.to) : a.from === e ? c = a.to : s && a.to === e && (c = a.from), c && (i.add(o), r.has(c) || n.push(c));
15377
15531
  }));
15378
15532
  }
15379
15533
  return [...i].sort((e, t) => e - t);
15380
15534
  }
15381
15535
  _createRelationMarker(e, t, n, r = this.relationMarker) {
15382
- let i = vu(r), a = new jn(i === "ring" ? new ra(.068, .018, 8, 20) : new Or(.09, .22, 12), new an({
15536
+ let i = yu(r), a = new jn(i === "ring" ? new ra(.068, .018, 8, 20) : new Or(.09, .22, 12), new an({
15383
15537
  color: e,
15384
15538
  transparent: !0,
15385
15539
  opacity: t,
@@ -15388,8 +15542,8 @@ var xd = class extends HTMLElement {
15388
15542
  return a.quaternion.setFromUnitVectors(o, n), a.userData.relationMarker = i, a.userData.markerAxis = o, a;
15389
15543
  }
15390
15544
  _relationColor(e) {
15391
- let t = this.modelData?.palette || Wl, n = (this.modelData?.relationGroups || []).find((t) => t.id === e.group)?.color;
15392
- return new Y(t[n] || n || t.connection || Wl.connection);
15545
+ let t = this.modelData?.palette || Gl, n = (this.modelData?.relationGroups || []).find((t) => t.id === e.group)?.color;
15546
+ return new Y(t[n] || n || t.connection || Gl.connection);
15393
15547
  }
15394
15548
  _relationBundleIndexes(e = this.selectedRelationIndex) {
15395
15549
  let t = this._relationIndex(e), n = this.relations[t];
@@ -15452,7 +15606,7 @@ var xd = class extends HTMLElement {
15452
15606
  o.userData.relationBundle = e.map((e) => e.index), o.renderOrder = 14, this.relationGroup.add(o);
15453
15607
  }
15454
15608
  e.forEach((n, r) => {
15455
- let { index: i, relation: a, start: o, end: s, delta: c, focusAlpha: l } = n, u = wu(a), d = i === this.selectedRelationIndex, f = this._relationCurve(o, s, r, e.length), p = u === "broken" ? new Y(14965603) : this._relationColor(a), m = (e, n = .055, r = .88) => {
15609
+ let { index: i, relation: a, start: o, end: s, delta: c, focusAlpha: l } = n, u = Tu(a), d = i === this.selectedRelationIndex, f = this._relationCurve(o, s, r, e.length), p = u === "broken" ? new Y(14965603) : this._relationColor(a), m = (e, n = .055, r = .88) => {
15456
15610
  let a = new an({
15457
15611
  color: e,
15458
15612
  transparent: !0,
@@ -15462,7 +15616,7 @@ var xd = class extends HTMLElement {
15462
15616
  });
15463
15617
  d && (a.color.lerp(new Y(16777215), .28), a.opacity = 1);
15464
15618
  let o = new jn(new ia(f, t ? 20 : 10, d ? n * 1.45 : n, 6, !1), a);
15465
- return o.renderOrder = Yl, o.userData.relationIndex = i, o.userData.relationConductor = t, this.relationGroup.add(o), o;
15619
+ return o.renderOrder = Xl, o.userData.relationIndex = i, o.userData.relationConductor = t, this.relationGroup.add(o), o;
15466
15620
  }, h = new jn(new ia(f, t ? 20 : 10, t ? .095 : .16, 6, !1), new an({
15467
15621
  transparent: !0,
15468
15622
  opacity: 0,
@@ -15476,7 +15630,7 @@ var xd = class extends HTMLElement {
15476
15630
  let e = Math.min(.18, Math.max(.07, c.length() * .018)), n = t ? 1 : 3;
15477
15631
  for (let t = 0; t < n; t++) {
15478
15632
  let r = (t + 1) / (n + 1), a = f.getPoint(r), o = f.getTangent(r).normalize(), s = this._createRelationMarker(p, (d ? 1 : .9) * l, o);
15479
- s.userData.relationIndex = i, s.userData.phase = t / n, s.userData.oscillate = !0, s.userData.start = a.clone().sub(o.clone().multiplyScalar(e)), s.userData.end = a.clone().add(o.clone().multiplyScalar(e)), s.renderOrder = Yl, this.relationGroup.add(s);
15633
+ s.userData.relationIndex = i, s.userData.phase = t / n, s.userData.oscillate = !0, s.userData.start = a.clone().sub(o.clone().multiplyScalar(e)), s.userData.end = a.clone().add(o.clone().multiplyScalar(e)), s.renderOrder = Xl, this.relationGroup.add(s);
15480
15634
  }
15481
15635
  return;
15482
15636
  }
@@ -15484,7 +15638,7 @@ var xd = class extends HTMLElement {
15484
15638
  let g = t ? u === "bidirectional" ? 2 : 1 : 4;
15485
15639
  for (let e = 0; e < g; e++) {
15486
15640
  let t = u === "bidirectional" && e % 2 ? -1 : 1, n = (e + 1) / (g + 1), r = f.getTangent(n).normalize(), a = this._createRelationMarker(p, (d ? 1 : .9) * l, r.clone().multiplyScalar(t));
15487
- a.userData.relationIndex = i, a.userData.phase = e / g, a.userData.direction = t, a.userData.start = o.clone(), a.userData.end = s.clone(), a.userData.curve = f, a.renderOrder = Yl, this.relationGroup.add(a);
15641
+ a.userData.relationIndex = i, a.userData.phase = e / g, a.userData.direction = t, a.userData.start = o.clone(), a.userData.end = s.clone(), a.userData.curve = f, a.renderOrder = Xl, this.relationGroup.add(a);
15488
15642
  }
15489
15643
  });
15490
15644
  }
@@ -15494,11 +15648,11 @@ var xd = class extends HTMLElement {
15494
15648
  this._syncJumpButton();
15495
15649
  let e = this.selectedRelationIndex === null ? null : this.relations[this.selectedRelationIndex];
15496
15650
  if (e) {
15497
- let t = wu(e), n = (this.modelData.relationGroups || []).find((t) => t.id === e.group), r = new Map((this.modelData.relationGroups || []).map((e) => [e.id, e])), i = this.getRelationBundle(this.selectedRelationIndex), a = e.content ? "<div class=\"rich-content\" data-rich-content></div>" : e.text ? "<p>" + Iu(e.text) + "</p>" : "", o = Lu(e.url), s = n ? "<h3>GRUPO</h3><p>" + Iu(n.label || n.id) + "</p>" : "", c = i.map(({ index: e, relation: t }) => {
15498
- let n = r.get(t.group), i = [n?.label || n?.id || "Ungrouped", wu(t)].join(" · ");
15499
- return "<button class=\"relation" + (e === this.selectedRelationIndex ? " selected" : "") + "\" data-action=\"relation\" data-relation-index=\"" + e + "\"><strong>" + Iu(t.label || `${t.from} → ${t.to}`) + "</strong><small>" + Iu(i) + "</small></button>";
15651
+ let t = Tu(e), n = (this.modelData.relationGroups || []).find((t) => t.id === e.group), r = new Map((this.modelData.relationGroups || []).map((e) => [e.id, e])), i = this.getRelationBundle(this.selectedRelationIndex), a = e.content ? "<div class=\"rich-content\" data-rich-content></div>" : e.text ? "<p>" + Lu(e.text) + "</p>" : "", o = Ru(e.url), s = n ? "<h3>GRUPO</h3><p>" + Lu(n.label || n.id) + "</p>" : "", c = i.map(({ index: e, relation: t }) => {
15652
+ let n = r.get(t.group), i = [n?.label || n?.id || "Ungrouped", Tu(t)].join(" · ");
15653
+ return "<button class=\"relation" + (e === this.selectedRelationIndex ? " selected" : "") + "\" data-action=\"relation\" data-relation-index=\"" + e + "\"><strong>" + Lu(t.label || `${t.from} → ${t.to}`) + "</strong><small>" + Lu(i) + "</small></button>";
15500
15654
  }).join(""), l = i.length === 1 ? "1 connection" : `${i.length} connections`;
15501
- this.panel.innerHTML = "<button class=\"back\" data-action=\"overview\">← Overview</button><button data-action=\"focus-selection\">◎ Focus selection</button><div class=\"eyebrow\">RELATION</div><h2>" + Iu(e.label || `${e.from} → ${e.to}`) + "</h2><div class=\"sub\">" + Iu(e.from) + " → " + Iu(e.to) + "</div>" + a + o + s + "<h3>MODE</h3><p>" + Iu(t) + "</p><h3>VIRTUAL TUBE</h3><p>" + Iu(`${e.from} ↔ ${e.to} · ${l}`) + "</p>" + c, this._renderRichContent(e.content, e.label || `${e.from} → ${e.to}`), this.panel.querySelector("[data-action=\"overview\"]")?.addEventListener("click", () => this.reset()), this.panel.querySelector("[data-action=\"focus-selection\"]")?.addEventListener("click", () => this.focusSelection()), this.panel.querySelectorAll("[data-action=\"relation\"]").forEach((e) => e.addEventListener("click", () => this.selectRelation(Number(e.dataset.relationIndex), { source: "panel" }))), this._applyTheme();
15655
+ this.panel.innerHTML = "<button class=\"back\" data-action=\"overview\">← Overview</button><button data-action=\"focus-selection\">◎ Focus selection</button><div class=\"eyebrow\">RELATION</div><h2>" + Lu(e.label || `${e.from} → ${e.to}`) + "</h2><div class=\"sub\">" + Lu(e.from) + " → " + Lu(e.to) + "</div>" + a + o + s + "<h3>MODE</h3><p>" + Lu(t) + "</p><h3>VIRTUAL TUBE</h3><p>" + Lu(`${e.from} ↔ ${e.to} · ${l}`) + "</p>" + c, this._renderRichContent(e.content, e.label || `${e.from} → ${e.to}`), this.panel.querySelector("[data-action=\"overview\"]")?.addEventListener("click", () => this.reset()), this.panel.querySelector("[data-action=\"focus-selection\"]")?.addEventListener("click", () => this.focusSelection()), this.panel.querySelectorAll("[data-action=\"relation\"]").forEach((e) => e.addEventListener("click", () => this.selectRelation(Number(e.dataset.relationIndex), { source: "panel" }))), this._applyTheme();
15502
15656
  return;
15503
15657
  }
15504
15658
  let t = this.selected;
@@ -15508,11 +15662,11 @@ var xd = class extends HTMLElement {
15508
15662
  }
15509
15663
  let n = this.relations.filter((e) => e.from === t.id || e.to === t.id), r = this.modelData.entities.filter((e) => e.parent === t.id), i = [], a = /* @__PURE__ */ new Set(), o = t;
15510
15664
  for (; o && !a.has(o.id);) a.add(o.id), i.unshift(o), o = o.parent ? this.nodes.get(o.parent) : null;
15511
- let s = "<nav class=\"crumbs\" aria-label=\"Model path\"><button data-action=\"overview\">Model</button>" + i.map((e, t) => "<span>/</span><button data-action=\"path\" data-id=\"" + Iu(e.id) + "\" class=\"" + (t === i.length - 1 ? "current" : "") + "\">" + Iu(e.name) + "</button>").join("") + "</nav>", c = n.map((e) => {
15512
- let n = this.relations.indexOf(e), r = e.text ? "<small>" + Iu(e.text) + "</small>" : "";
15513
- return "<button class=\"relation\" data-action=\"relation\" data-relation-index=\"" + n + "\"><strong>" + Iu(e.label || (e.from === t.id ? e.to : e.from)) + "</strong><small>" + Iu(e.from) + " → " + Iu(e.to) + "</small>" + r + "</button>";
15665
+ let s = "<nav class=\"crumbs\" aria-label=\"Model path\"><button data-action=\"overview\">Model</button>" + i.map((e, t) => "<span>/</span><button data-action=\"path\" data-id=\"" + Lu(e.id) + "\" class=\"" + (t === i.length - 1 ? "current" : "") + "\">" + Lu(e.name) + "</button>").join("") + "</nav>", c = n.map((e) => {
15666
+ let n = this.relations.indexOf(e), r = e.text ? "<small>" + Lu(e.text) + "</small>" : "";
15667
+ return "<button class=\"relation\" data-action=\"relation\" data-relation-index=\"" + n + "\"><strong>" + Lu(e.label || (e.from === t.id ? e.to : e.from)) + "</strong><small>" + Lu(e.from) + " → " + Lu(e.to) + "</small>" + r + "</button>";
15514
15668
  }).join("");
15515
- this.panel.innerHTML = s + "<button data-action=\"focus-selection\">◎ Focus selection</button><div class=\"eyebrow\">" + Iu(mu(t.type) ? "CONTAINER" : t.type === "actor" ? "EXTERNAL ACTOR" : "COMPONENT") + "</div><h2>" + Iu(t.name) + "</h2><div class=\"sub\">" + Iu(t.sub || "") + "</div>" + (t.content ? "<div class=\"rich-content\" data-rich-content></div>" : "<p>" + Iu(t.text || "") + "</p>") + Lu(t.url) + (mu(t.type) ? "<button data-action=\"toggle-shell\">" + (this.open.has(t.id) ? "Close container" : "Open container") + "</button>" : "") + (r.length ? "<h3>CONTAINS</h3><p>" + r.length + " internal item" + (r.length === 1 ? "" : "s") + ".</p>" : "") + "<h3>RELATIONS</h3>" + (c || "<p>No direct relations.</p>"), this._renderRichContent(t.content, t.name), this.panel.querySelectorAll("[data-action=\"overview\"]").forEach((e) => e.addEventListener("click", () => this.reset())), this.panel.querySelectorAll("[data-action=\"path\"]").forEach((e) => e.addEventListener("click", () => this.select(e.dataset.id))), this.panel.querySelectorAll("[data-action=\"relation\"]").forEach((e) => e.addEventListener("click", () => this.selectRelation(Number(e.dataset.relationIndex), { source: "panel" }))), this.panel.querySelector("[data-action=\"focus-selection\"]")?.addEventListener("click", () => this.focusSelection()), this.panel.querySelector("[data-action=\"toggle-shell\"]")?.addEventListener("click", () => {
15669
+ this.panel.innerHTML = s + "<button data-action=\"focus-selection\">◎ Focus selection</button><div class=\"eyebrow\">" + Lu(hu(t.type) ? "CONTAINER" : t.type === "actor" ? "EXTERNAL ACTOR" : "COMPONENT") + "</div><h2>" + Lu(t.name) + "</h2><div class=\"sub\">" + Lu(t.sub || "") + "</div>" + (t.content ? "<div class=\"rich-content\" data-rich-content></div>" : "<p>" + Lu(t.text || "") + "</p>") + Ru(t.url) + (hu(t.type) ? "<button data-action=\"toggle-shell\">" + (this.open.has(t.id) ? "Close container" : "Open container") + "</button>" : "") + (r.length ? "<h3>CONTAINS</h3><p>" + r.length + " internal item" + (r.length === 1 ? "" : "s") + ".</p>" : "") + "<h3>RELATIONS</h3>" + (c || "<p>No direct relations.</p>"), this._renderRichContent(t.content, t.name), this.panel.querySelectorAll("[data-action=\"overview\"]").forEach((e) => e.addEventListener("click", () => this.reset())), this.panel.querySelectorAll("[data-action=\"path\"]").forEach((e) => e.addEventListener("click", () => this.select(e.dataset.id))), this.panel.querySelectorAll("[data-action=\"relation\"]").forEach((e) => e.addEventListener("click", () => this.selectRelation(Number(e.dataset.relationIndex), { source: "panel" }))), this.panel.querySelector("[data-action=\"focus-selection\"]")?.addEventListener("click", () => this.focusSelection()), this.panel.querySelector("[data-action=\"toggle-shell\"]")?.addEventListener("click", () => {
15516
15670
  this.toggleContainer(t.id, { source: "panel" });
15517
15671
  }), this._applyTheme();
15518
15672
  }
@@ -15521,7 +15675,7 @@ var xd = class extends HTMLElement {
15521
15675
  if (!n) return this;
15522
15676
  let r = new Set(this.open), i = n.parent ? this.nodes.get(n.parent) : null;
15523
15677
  for (; i;) r.add(i.id), i = i.parent ? this.nodes.get(i.parent) : null;
15524
- return this.selected = n, this.selectedRelationIndex = null, mu(n.type) && r.add(n.id), this._replaceOpenContainers(r, {
15678
+ return this.selected = n, this.selectedRelationIndex = null, hu(n.type) && r.add(n.id), this._replaceOpenContainers(r, {
15525
15679
  refresh: !1,
15526
15680
  source: t.source || "api"
15527
15681
  }), this._applySelectionNavigation(t.navigation), this._renderPanel(), this._rebuildRelations(), this._syncRelationToolbar(), this._syncFocusToolbar(), this.invalidate(), t.focusEvent !== !1 && this._emitFocusChange(t.source || "api"), t.emit !== !1 && this._emit("lc-select", {
@@ -15555,7 +15709,7 @@ var xd = class extends HTMLElement {
15555
15709
  }), this;
15556
15710
  }
15557
15711
  setRelationMode(e) {
15558
- this.relationMode = yu(e), this.setAttribute("relation-mode", this.relationMode), this._syncRelationToolbar(), this._syncFocusToolbar(), this._rebuildRelations(), this.invalidate(), this.dispatchEvent(new CustomEvent("lc-relation-mode", { detail: { mode: this.relationMode } }));
15712
+ this.relationMode = bu(e), this.setAttribute("relation-mode", this.relationMode), this._syncRelationToolbar(), this._syncFocusToolbar(), this._rebuildRelations(), this.invalidate(), this.dispatchEvent(new CustomEvent("lc-relation-mode", { detail: { mode: this.relationMode } }));
15559
15713
  }
15560
15714
  setVisibleRelationGroups(e = null, t = {}) {
15561
15715
  let n = new Set((this.modelData?.relationGroups || []).map((e) => e.id)), r = e == null ? null : new Set(Array.from(e).map((e) => String(e)).filter((e) => n.has(e))), i = r && n.size > 0 && r.size === n.size ? null : r, a = this.visibleRelationGroups ? [...this.visibleRelationGroups].sort() : null, o = i ? [...i].sort() : null, s = JSON.stringify(a) !== JSON.stringify(o);
@@ -15571,7 +15725,7 @@ var xd = class extends HTMLElement {
15571
15725
  return r.has(e) ? r.delete(e) : r.add(e), this.setVisibleRelationGroups(r, t);
15572
15726
  }
15573
15727
  setRelationMarker(e, t = {}) {
15574
- let n = vu(e), r = n !== this.relationMarker;
15728
+ let n = yu(e), r = n !== this.relationMarker;
15575
15729
  return this.relationMarker = n, this.getAttribute?.("relation-marker") !== n && this.setAttribute?.("relation-marker", n), r && this.ready && (this._rebuildRelations(), this.invalidate()), r && t.emit !== !1 && this._emit("lc-relation-marker-change", {
15576
15730
  marker: n,
15577
15731
  source: t.source || "api"
@@ -15604,20 +15758,20 @@ var xd = class extends HTMLElement {
15604
15758
  for (let e of this.nodes.values()) {
15605
15759
  let t = this._focusAlpha(e, i), n = this._isVisible(e) && t > 0;
15606
15760
  e.group.visible = n;
15607
- let r = mu(e.type) && this.open.has(e.id), a = (r ? .12 : 1) * t;
15608
- if (e.mesh.renderOrder = r ? 10 - !!e.parent : 0, e.material) bu(e.material, !0), e.material.opacity = a, e.material.depthWrite = !r, e.material.emissive?.set(e === this.selected ? e.material.color : 0), e.material.emissiveIntensity = e === this.selected ? .15 : 0;
15761
+ let r = hu(e.type) && this.open.has(e.id), a = (r ? .12 : 1) * t;
15762
+ if (e.mesh.renderOrder = r ? 10 - !!e.parent : 0, e.material) xu(e.material, !0), e.material.opacity = a, e.material.depthWrite = !r, e.material.emissive?.set(e === this.selected ? e.material.color : 0), e.material.emissiveIntensity = e === this.selected ? .15 : 0;
15609
15763
  else {
15610
- for (let n of e.appearanceMaterials || []) Object.hasOwn(n.userData, "atlasBaseOpacity") || (n.userData.atlasBaseOpacity = n.opacity ?? 1), Object.hasOwn(n.userData, "atlasBaseTransparent") || (n.userData.atlasBaseTransparent = n.transparent), Object.hasOwn(n.userData, "atlasBaseDepthWrite") || (n.userData.atlasBaseDepthWrite = n.depthWrite), bu(n, n.userData.atlasBaseTransparent || t < 1), n.depthWrite = n.userData.atlasBaseDepthWrite, n.opacity = n.userData.atlasBaseOpacity * t, n.emissive?.set(e === this.selected ? n.color : 0), n.emissiveIntensity = e === this.selected ? .15 : 0;
15764
+ for (let n of e.appearanceMaterials || []) Object.hasOwn(n.userData, "atlasBaseOpacity") || (n.userData.atlasBaseOpacity = n.opacity ?? 1), Object.hasOwn(n.userData, "atlasBaseTransparent") || (n.userData.atlasBaseTransparent = n.transparent), Object.hasOwn(n.userData, "atlasBaseDepthWrite") || (n.userData.atlasBaseDepthWrite = n.depthWrite), xu(n, n.userData.atlasBaseTransparent || t < 1), n.depthWrite = n.userData.atlasBaseDepthWrite, n.opacity = n.userData.atlasBaseOpacity * t, n.emissive?.set(e === this.selected ? n.color : 0), n.emissiveIntensity = e === this.selected ? .15 : 0;
15611
15765
  e._appearanceSelected = e === this.selected;
15612
15766
  }
15613
15767
  e.edge?.material && (e.edge.material.opacity = (e === this.selected ? 1 : .65) * t);
15614
- let o = mu(e.type) && r, s = o, c = e.label.userData.front, l = e.label.userData.back, u = e.label.userData.top, d = e.label.userData.height, f = e.label.userData.width, p = e.label.userData.textOffsetX || 0;
15768
+ let o = hu(e.type) && r, s = o, c = e.label.userData.front, l = e.label.userData.back, u = e.label.userData.top, d = e.label.userData.height, f = e.label.userData.width, p = e.label.userData.textOffsetX || 0;
15615
15769
  e.label.userData.textOffsetY;
15616
- let m = e.labelSize || new U().fromArray(e.s), h = fd(e.labelAnchor, m, f, d);
15770
+ let m = e.labelSize || new U().fromArray(e.s), h = pd(e.labelAnchor, m, f, d);
15617
15771
  e.label.visible = n;
15618
- let g = this._worldPosition(e), _ = this.itemFacing === "camera" && !mu(e.type) || this.camera.position.z >= g.z, v = e.label.userData.visibleFace || (_ ? "front" : "back"), y = o ? pd(this.camera.position, g, v) : null;
15772
+ let g = this._worldPosition(e), _ = this.itemFacing === "camera" && !hu(e.type) || this.camera.position.z >= g.z, v = e.label.userData.visibleFace || (_ ? "front" : "back"), y = o ? md(this.camera.position, g, v) : null;
15619
15773
  if (y && (e.label.userData.visibleFace = y), h) c.visible = _, l.visible = !_, u.visible = !1, c.scale.setScalar(1), l.scale.setScalar(1), c.position.set(h.x, h.y, m.z / 2 + .025), l.position.set(h.x, h.y, -m.z / 2 - .025), c.rotation.z = h.frontRotation, l.rotation.z = h.backRotation, c.material.color.set(15923964), l.material.color.set(15923964), c.material.opacity = t, l.material.opacity = t;
15620
- else if (mu(e.type)) {
15774
+ else if (hu(e.type)) {
15621
15775
  c.rotation.z = 0, l.rotation.z = 0, c.visible = o ? y === "front" : _, l.visible = o ? y === "back" : !_, u.visible = s && y === "top";
15622
15776
  let e = s ? .52 : 1;
15623
15777
  c.scale.setScalar(e), c.position.x = s ? -m.x / 2 + .18 + f * e / 2 - p * e : 0;
@@ -15641,7 +15795,7 @@ var xd = class extends HTMLElement {
15641
15795
  let t = this.canvas.getBoundingClientRect();
15642
15796
  this.pointer.set((e.clientX - t.left) / t.width * 2 - 1, -(e.clientY - t.top) / t.height * 2 + 1), this.raycaster.setFromCamera(this.pointer, this.camera);
15643
15797
  let n = [];
15644
- for (let e of this.nodes.values()) e.group.visible && (mu(e.type) && this.open.has(e.id) || n.push(e.pickMesh || e.mesh), e.label?.visible && n.push(...e.label.children.filter((e) => e.visible)));
15798
+ for (let e of this.nodes.values()) e.group.visible && (hu(e.type) && this.open.has(e.id) || n.push(e.pickMesh || e.mesh), e.label?.visible && n.push(...e.label.children.filter((e) => e.visible)));
15645
15799
  let r = this.raycaster.intersectObjects(n, !0)[0] || null, i = this.relationMode === "none" ? [] : this.relationGroup.children.filter((e) => e.userData?.relationPick || e.userData?.relationBundle), a = this.raycaster.intersectObjects(i, !1)[0] || null;
15646
15800
  if (r && (!a || r.distance <= a.distance + .12)) {
15647
15801
  let e = r.object;
@@ -15720,18 +15874,18 @@ var xd = class extends HTMLElement {
15720
15874
  this.toolbar?.querySelectorAll(".toolbar-menu").forEach((e) => e.addEventListener("toggle", () => {
15721
15875
  e.open && this._closeToolbarMenus(e);
15722
15876
  })), this.toolbar?.addEventListener("focusout", (e) => {
15723
- Mu(this.toolbar, e) && (this._closeToolbarMenus(), this._closeHistoryPopover());
15877
+ Nu(this.toolbar, e) && (this._closeToolbarMenus(), this._closeHistoryPopover());
15724
15878
  }), this.navigationToolbar?.addEventListener("focusout", (e) => {
15725
- Mu(this.navigationToolbar, e) && this._closeHistoryPopover();
15879
+ Nu(this.navigationToolbar, e) && this._closeHistoryPopover();
15726
15880
  }), this.shadowRoot.addEventListener("keydown", (e) => {
15727
15881
  e.key === "Escape" && (this._closeHistoryPopover(), this._closeToolbarMenus(), this.canvas.focus({ preventScroll: !0 }));
15728
15882
  }), this.shadowRoot.addEventListener("click", (e) => {
15729
- let t = ju(e, "[data-action]"), n = t?.dataset.action;
15883
+ let t = Mu(e, "[data-action]"), n = t?.dataset.action;
15730
15884
  if (this._historyLongPress === n) {
15731
15885
  this._historyLongPress = null;
15732
15886
  return;
15733
15887
  }
15734
- if (ju(e, ".atlas-history-popover") || this._closeHistoryPopover(), ju(e, ".toolbar-menu") || this._closeToolbarMenus(), n === "atlas-home" && this.goHome(), n === "atlas-back" && this.goBack(), n === "atlas-forward" && this.goForward(), n === "atlas-history-visit" && (this._closeHistoryPopover(), this._restoreVisit(Number(t.dataset.visitIndex))), n === "atlas-jump" && this.openAtlas(t.dataset.atlasRef).catch(() => {}), n === "view-mode" && this.setViewMode(this.viewMode === "2d" ? "3d" : "2d", { source: "toolbar" }), this.viewMode === "2d" && t?.closest?.(".toolbar") && this.diagramView.action(n, t)) {
15888
+ if (Mu(e, ".atlas-history-popover") || this._closeHistoryPopover(), Mu(e, ".toolbar-menu") || this._closeToolbarMenus(), n === "atlas-home" && this.goHome(), n === "atlas-back" && this.goBack(), n === "atlas-forward" && this.goForward(), n === "atlas-history-visit" && (this._closeHistoryPopover(), this._restoreVisit(Number(t.dataset.visitIndex))), n === "atlas-jump" && this.openAtlas(t.dataset.atlasRef).catch(() => {}), n === "view-mode" && this.setViewMode(this.viewMode === "2d" ? "3d" : "2d", { source: "toolbar" }), this.viewMode === "2d" && t?.closest?.(".toolbar") && this.diagramView.action(n, t)) {
15735
15889
  t?.closest?.(".toolbar-popover") && n !== "relation-group-toggle" && this._closeToolbarMenus();
15736
15890
  return;
15737
15891
  }
@@ -15779,7 +15933,7 @@ var xd = class extends HTMLElement {
15779
15933
  y: e.clientY
15780
15934
  }), e.pointerType === "touch" && this.pointers.size >= 2) {
15781
15935
  let [e, t] = [...this.pointers.values()], n = (e.x + t.x) / 2, r = (e.y + t.y) / 2, i = Math.max(1, Math.hypot(e.x - t.x, e.y - t.y));
15782
- this.drag.mode === "touch-pan" ? (this._panByPixels(n - this.drag.x, r - this.drag.y), this.targetZoom = Math.min(Jl, Math.max(ql, this.targetZoom * i / Math.max(1, this.drag.distance))), Object.assign(this.drag, {
15936
+ this.drag.mode === "touch-pan" ? (this._panByPixels(n - this.drag.x, r - this.drag.y), this.targetZoom = Math.min(Yl, Math.max(Jl, this.targetZoom * i / Math.max(1, this.drag.distance))), Object.assign(this.drag, {
15783
15937
  x: n,
15784
15938
  y: r,
15785
15939
  distance: i,
@@ -15850,16 +16004,16 @@ var xd = class extends HTMLElement {
15850
16004
  navigation: "fit"
15851
16005
  });
15852
16006
  }), this.canvas.addEventListener("wheel", (e) => {
15853
- e.preventDefault(), this.targetZoom = Math.min(Jl, Math.max(ql, this.targetZoom * Math.exp(-e.deltaY * .001))), this.invalidate();
16007
+ e.preventDefault(), this.targetZoom = Math.min(Yl, Math.max(Jl, this.targetZoom * Math.exp(-e.deltaY * .001))), this.invalidate();
15854
16008
  }, { passive: !1 });
15855
16009
  }
15856
16010
  _showError(e) {
15857
16011
  let t = this.shadowRoot.querySelector(".viewport"), n = t.querySelector(".error");
15858
- n ? n.textContent = e : t.insertAdjacentHTML("beforeend", "<div class=\"error\" role=\"alert\">" + Iu(e) + "</div>");
16012
+ n ? n.textContent = e : t.insertAdjacentHTML("beforeend", "<div class=\"error\" role=\"alert\">" + Lu(e) + "</div>");
15859
16013
  }
15860
16014
  };
15861
- customElements.get("liquidcars-atlas") || customElements.define("liquidcars-atlas", xd);
16015
+ customElements.get("liquidcars-atlas") || customElements.define("liquidcars-atlas", Sd);
15862
16016
  //#endregion
15863
- export { Ul as ATLAS_VERSION, Gl as DEFAULT_RELATION_MARKER, xd as LiquidCarsAtlas, Kl as RELATION_DISPLAY_MODES, yd as canvasToPngBlob, vd as captureRendererFrame, ju as closestEventElement, ed as createSvgExtrudeGeometry, yl as diagramSvgToPng, bd as downloadPngBlob, Mu as focusMovesOutside, du as getGeometryCatalog, fu as getGeometryPackCatalog, fd as labelPlacementForAnchor, ud as normalizeLabelAnchor, Bu as normalizeModel, pd as preferredContainerLabelFace, lu as registerGeometryPack, vl as renderDiagramSvg, dd as resolveEntityLabelAnchor, uu as unregisterGeometryPack };
16017
+ export { Wl as ATLAS_VERSION, Kl as DEFAULT_RELATION_MARKER, Sd as LiquidCarsAtlas, ql as RELATION_DISPLAY_MODES, Rl as atlasReferenceTarget, bd as canvasToPngBlob, yd as captureRendererFrame, Mu as closestEventElement, td as createSvgExtrudeGeometry, yl as diagramSvgToPng, xd as downloadPngBlob, Nu as focusMovesOutside, fu as getGeometryCatalog, pu as getGeometryPackCatalog, pd as labelPlacementForAnchor, dd as normalizeLabelAnchor, Vu as normalizeModel, md as preferredContainerLabelFace, uu as registerGeometryPack, vl as renderDiagramSvg, Ll as resolveAtlasReference, fd as resolveEntityLabelAnchor, du as unregisterGeometryPack };
15864
16018
 
15865
16019
  //# sourceMappingURL=liquidcars-atlas.js.map