@panphora/clayjs 1.14.0 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /* clayjs 1.14.0 standalone build: every clayjs module in one file. https://clayjs.com/offline
1
+ /* clayjs 1.15.1 standalone build: every clayjs module in one file. https://clayjs.com/offline
2
2
  Third-party code inside keeps its own license (Sortable MIT, Squire MIT, DOMPurify Apache-2.0 OR MPL-2.0, MicroModal MIT, parse5 MIT, Highlights from Pierre Apache-2.0): https://clayjs.com/THIRD-PARTY-NOTICES.md */
3
3
  (() => {
4
4
  var __create = Object.create;
@@ -753,6 +753,192 @@
753
753
  }
754
754
  });
755
755
 
756
+ // src/vendor/sap-ownership.vendor.js
757
+ function recordOwnsFormState(el11) {
758
+ return el11.hasAttribute("bind") || el11.hasAttribute("persist") || !!el11.closest("select[bind]");
759
+ }
760
+ function inert(el11) {
761
+ return el11.localName === "template" || el11.hasAttribute("template") || el11.hasAttribute("cms-template") || el11.hasAttribute("sap-ignore");
762
+ }
763
+ function appOf(el11) {
764
+ for (let cur = el11; cur && cur.nodeType === 1; cur = cur.parentElement) {
765
+ if (inert(cur)) return null;
766
+ if (cur.hasAttribute("sap")) return cur;
767
+ }
768
+ return null;
769
+ }
770
+ function declares(el11, name) {
771
+ const decl2 = el11.getAttribute("state");
772
+ if (!decl2) return false;
773
+ for (const token2 of decl2.trim().split(/\s+/)) {
774
+ if (token2.split("=")[0].split(":")[0] === name) return true;
775
+ }
776
+ return false;
777
+ }
778
+ function paintsHidden(el11) {
779
+ if (el11.hasAttribute("show")) return true;
780
+ for (const a2 of el11.attributes) if (WHEN.test(a2.name)) return true;
781
+ return false;
782
+ }
783
+ function ownsAttr(el11, name) {
784
+ if (!el11 || el11.nodeType !== 1 || !name) return false;
785
+ if (name === BEACON) return !!appOf(el11);
786
+ if (NEVER2.has(name)) return false;
787
+ if (FORM_STATE.has(name) && recordOwnsFormState(el11)) return false;
788
+ if (name === "hidden") return paintsHidden(el11) && !!appOf(el11);
789
+ return el11.hasAttribute("attr:" + name) && !declares(el11, name) && !!appOf(el11);
790
+ }
791
+ function paintsOf(el11) {
792
+ if (!el11 || el11.nodeType !== 1 || !appOf(el11)) return null;
793
+ let out = null;
794
+ const add2 = (key2, v5) => (out || (out = { attrs: [], classes: [], vars: [], text: false }))[key2].push(v5);
795
+ for (const a2 of el11.attributes) {
796
+ const n3 = a2.name;
797
+ if (n3 === "text" || n3.startsWith("text:")) {
798
+ if (!el11.hasAttribute("bind")) (out || (out = { attrs: [], classes: [], vars: [], text: false })).text = true;
799
+ } else if (n3.startsWith("attr:")) {
800
+ const target = n3.slice(5);
801
+ if (target && !NEVER2.has(target) && !(FORM_STATE.has(target) && recordOwnsFormState(el11)) && !declares(el11, target)) add2("attrs", target);
802
+ } else if (n3.startsWith("class:")) add2("classes", n3.slice(6));
803
+ else if (n3.startsWith("css:")) add2("vars", "--" + n3.slice(4));
804
+ }
805
+ if (paintsHidden(el11)) add2("attrs", "hidden");
806
+ if (el11.hasAttribute(BEACON)) add2("attrs", BEACON);
807
+ return out;
808
+ }
809
+ function eachPainted(root3, visit) {
810
+ if (!root3 || root3.nodeType !== 1 && root3.nodeType !== 9) return;
811
+ const apps = root3.nodeType === 1 && root3.hasAttribute("sap") ? [root3] : [...root3.querySelectorAll("[sap]")].filter((app) => !app.parentElement || !app.parentElement.closest("[sap]"));
812
+ for (const app of apps) {
813
+ for (const el11 of [app, ...app.querySelectorAll("*")]) {
814
+ const p3 = paintsOf(el11);
815
+ if (p3) visit(el11, p3);
816
+ }
817
+ }
818
+ }
819
+ function stripPaints(root3) {
820
+ eachPainted(root3, (el11, p3) => {
821
+ for (const name of p3.attrs) if (el11.hasAttribute(name)) el11.removeAttribute(name);
822
+ for (const token2 of p3.classes) if (el11.classList.contains(token2)) el11.classList.remove(token2);
823
+ if (!el11.getAttribute("class") && el11.hasAttribute("class") && p3.classes.length) el11.removeAttribute("class");
824
+ for (const v5 of p3.vars) if (el11.style.getPropertyValue(v5) !== "") el11.style.removeProperty(v5);
825
+ if (p3.vars.length && el11.hasAttribute("style") && !el11.getAttribute("style").trim()) el11.removeAttribute("style");
826
+ if (p3.text && el11.firstChild) el11.replaceChildren();
827
+ });
828
+ }
829
+ var BEACON, WHEN, NEVER2, FORM_STATE;
830
+ var init_sap_ownership_vendor = __esm({
831
+ "src/vendor/sap-ownership.vendor.js"() {
832
+ BEACON = "sap-error";
833
+ WHEN = /^(show-when|hide-when|option|option-not):/;
834
+ NEVER2 = /* @__PURE__ */ new Set([
835
+ "id",
836
+ "data-id",
837
+ "class",
838
+ "style",
839
+ "sap",
840
+ "scope",
841
+ "items",
842
+ "item",
843
+ "bind",
844
+ "state",
845
+ "template",
846
+ "cms-template",
847
+ "sap-ignore"
848
+ ]);
849
+ FORM_STATE = /* @__PURE__ */ new Set(["value", "checked", "selected"]);
850
+ }
851
+ });
852
+
853
+ // src/core/boot-phase.js
854
+ var bootPhase;
855
+ var init_boot_phase = __esm({
856
+ "src/core/boot-phase.js"() {
857
+ bootPhase = { holdSettle: false };
858
+ }
859
+ });
860
+
861
+ // src/lib/derived.js
862
+ function paintSignature(root3) {
863
+ const parts = [];
864
+ eachPainted(root3, (el11, p3) => {
865
+ parts.push(el11.localName);
866
+ for (const n3 of p3.attrs) if (n3 !== "sap-error") parts.push(n3 + "=" + (el11.getAttribute(n3) ?? "\0"));
867
+ for (const t2 of p3.classes) parts.push("." + t2 + "=" + el11.classList.contains(t2));
868
+ for (const v5 of p3.vars) parts.push(v5 + "=" + el11.style.getPropertyValue(v5));
869
+ if (p3.text) parts.push("#" + el11.textContent);
870
+ });
871
+ return parts.join("");
872
+ }
873
+ function paintSignatureOfHtml(html) {
874
+ return paintSignature(new DOMParser().parseFromString(html, "text/html"));
875
+ }
876
+ function withoutTokens(value, owned2, split, join, nameOf) {
877
+ return split(value || "").map((t2) => t2.trim()).filter((t2) => t2 && !owned2.includes(nameOf(t2))).sort().join(join);
878
+ }
879
+ function onlyPaintedTokens(el11, name, before, after) {
880
+ const p3 = paintsOf(el11);
881
+ if (!p3) return false;
882
+ if (name === "class") {
883
+ if (!p3.classes.length) return false;
884
+ const rest2 = (v5) => withoutTokens(v5, p3.classes, (s2) => s2.split(/\s+/), " ", (t2) => t2);
885
+ return rest2(before) === rest2(after);
886
+ }
887
+ if (!p3.vars.length) return false;
888
+ const rest = (v5) => withoutTokens(v5, p3.vars, (s2) => s2.split(";"), ";", (t2) => t2.split(":")[0].trim());
889
+ return rest(before) === rest(after);
890
+ }
891
+ function isDerivedChange(change) {
892
+ if (change.__derived !== void 0) return change.__derived;
893
+ const el11 = change.element;
894
+ let derived2 = false;
895
+ if (el11 && el11.nodeType === 1) {
896
+ if (change.type === "attribute") {
897
+ const name = change.attribute;
898
+ derived2 = isDerivedAttr(el11, name) || (name === "class" || name === "style") && onlyPaintedTokens(el11, name, change.oldValue, change.newValue);
899
+ } else if (change.type === "characterData") {
900
+ derived2 = ownsDerivedText(el11);
901
+ }
902
+ }
903
+ change.__derived = derived2;
904
+ return derived2;
905
+ }
906
+ function derivedActive() {
907
+ return engines.size > 0 || bootPhase.holdSettle;
908
+ }
909
+ function repaintDerived() {
910
+ for (const repaint of [...engines]) {
911
+ try {
912
+ repaint();
913
+ } catch (err) {
914
+ console.error("clayjs: a derived repaint failed:", err);
915
+ }
916
+ }
917
+ }
918
+ var isDerivedAttr, ownsDerivedText, stripDerived, engines, mountedOnce, mountWaiters, derived;
919
+ var init_derived = __esm({
920
+ "src/lib/derived.js"() {
921
+ init_sap_ownership_vendor();
922
+ init_boot_phase();
923
+ isDerivedAttr = (el11, name) => ownsAttr(el11, name);
924
+ ownsDerivedText = (el11) => !!el11 && el11.nodeType === 1 && !!paintsOf(el11)?.text;
925
+ stripDerived = (root3) => stripPaints(root3);
926
+ engines = /* @__PURE__ */ new Set();
927
+ mountedOnce = false;
928
+ mountWaiters = [];
929
+ derived = {
930
+ register(repaint) {
931
+ engines.add(repaint);
932
+ return () => engines.delete(repaint);
933
+ },
934
+ mounted() {
935
+ mountedOnce = true;
936
+ for (const fn4 of mountWaiters.splice(0)) fn4();
937
+ }
938
+ };
939
+ }
940
+ });
941
+
756
942
  // src/lib/user-gesture.js
757
943
  function now() {
758
944
  return typeof performance !== "undefined" && performance.now ? performance.now() : Date.now();
@@ -853,6 +1039,7 @@
853
1039
  init_region_capabilities();
854
1040
  init_root_attrs();
855
1041
  init_ephemeral();
1042
+ init_derived();
856
1043
  init_user_gesture();
857
1044
  dummyElem = document.createElement("div");
858
1045
  ROOT_LIBRARY_ATTR_SET = new Set(ROOT_LIBRARY_ATTRS);
@@ -939,6 +1126,7 @@
939
1126
  const { fn: fn4, debounce: debounce2 = 0, maxWait = 0, selectorFilter, omitChangeDetails, require: require2, skip } = callback;
940
1127
  let filteredChanges = changes2.filter(
941
1128
  (change) => {
1129
+ if (require2 !== "observed" && isDerivedChange(change)) return false;
942
1130
  const currentSkipped = skipForPolicy(this._policyForChange(change), require2, skip);
943
1131
  if (!change.policyTransition) return !currentSkipped;
944
1132
  const previousSkipped = skipForPolicy(change.previousPolicy, require2, skip);
@@ -1308,7 +1496,7 @@
1308
1496
  });
1309
1497
  if (!onlyNonPausable && isUserDrivenNow()) {
1310
1498
  for (const change of changes2) {
1311
- if (!skipForPolicy(this._policyForChange(change), "dirty")) {
1499
+ if (!isDerivedChange(change) && !skipForPolicy(this._policyForChange(change), "dirty")) {
1312
1500
  markUserDriven();
1313
1501
  break;
1314
1502
  }
@@ -1692,9 +1880,9 @@
1692
1880
  if (!blocks.length) return "<!DOCTYPE html>" + clone.outerHTML;
1693
1881
  const nonce2 = Math.random().toString(36).slice(2);
1694
1882
  const raw = blocks.map(([el11, kids], i2) => {
1695
- const marker = `\uE000clay-noscript-${nonce2}-${i2}\uE000`;
1696
- el11.replaceChildren(el11.ownerDocument.createTextNode(marker));
1697
- return [marker, kids.map((n3) => n3.data).join("")];
1883
+ const marker2 = `\uE000clay-noscript-${nonce2}-${i2}\uE000`;
1884
+ el11.replaceChildren(el11.ownerDocument.createTextNode(marker2));
1885
+ return [marker2, kids.map((n3) => n3.data).join("")];
1698
1886
  });
1699
1887
  let html;
1700
1888
  try {
@@ -1702,7 +1890,7 @@
1702
1890
  } finally {
1703
1891
  for (const [el11, kids] of blocks) el11.replaceChildren(...kids);
1704
1892
  }
1705
- for (const [marker, text2] of raw) html = html.split(marker).join(text2);
1893
+ for (const [marker2, text2] of raw) html = html.split(marker2).join(text2);
1706
1894
  return html;
1707
1895
  }
1708
1896
  function serializeSaveClone(clone) {
@@ -1757,12 +1945,17 @@
1757
1945
  for (const el11 of clone.querySelectorAll(STRIP_FROM_SAVE)) {
1758
1946
  el11.remove();
1759
1947
  }
1948
+ stripDiagnosticBeacons(clone);
1760
1949
  return clone;
1761
1950
  }
1951
+ function stripDiagnosticBeacons(clone) {
1952
+ for (const el11 of clone.querySelectorAll("[sap-error]")) el11.removeAttribute("sap-error");
1953
+ }
1762
1954
  function captureSaveClone({ flushUndo = true, authored: authored3 = true } = {}) {
1763
1955
  return prepareCloneForSave(captureSnapshot({ flushUndo, authored: authored3 }), { authored: authored3 });
1764
1956
  }
1765
1957
  function serializeForCompare(clone) {
1958
+ stripDerived(clone);
1766
1959
  for (const name of EMPTY_INERT_ATTRS) {
1767
1960
  if (clone.getAttribute(name) === "") clone.removeAttribute(name);
1768
1961
  for (const el11 of clone.querySelectorAll(`[${name}=""]`)) el11.removeAttribute(name);
@@ -1842,6 +2035,7 @@
1842
2035
  for (const el11 of clone.querySelectorAll(STRIP_FROM_SAVE)) {
1843
2036
  el11.remove();
1844
2037
  }
2038
+ stripDiagnosticBeacons(clone);
1845
2039
  const forSave = serializeSaveClone(clone);
1846
2040
  for (const el11 of compareClone.querySelectorAll(STRIP_FROM_COMPARISON)) {
1847
2041
  el11.remove();
@@ -1887,6 +2081,7 @@
1887
2081
  for (const el11 of clone.querySelectorAll(STRIP_FROM_SAVE)) {
1888
2082
  el11.remove();
1889
2083
  }
2084
+ stripDiagnosticBeacons(clone);
1890
2085
  for (const el11 of compareClone.querySelectorAll(STRIP_FROM_DIRTY_CHECK)) {
1891
2086
  el11.remove();
1892
2087
  }
@@ -1935,6 +2130,7 @@
1935
2130
  init_region_policy();
1936
2131
  init_root_attrs();
1937
2132
  init_ephemeral();
2133
+ init_derived();
1938
2134
  init_content_dom();
1939
2135
  snapshotHooks = [];
1940
2136
  documentTransforms = [];
@@ -8578,6 +8774,7 @@
8578
8774
  autosaveIsSuspended: () => autosaveIsSuspended,
8579
8775
  baselineSettled: () => baselineSettled,
8580
8776
  conflictResolvedBySync: () => conflictResolvedBySync,
8777
+ currentPaintSignature: () => currentPaintSignature,
8581
8778
  default: () => save_default,
8582
8779
  flushSave: () => flushSave,
8583
8780
  getLastSavedBytes: () => getLastSavedBytes,
@@ -8591,6 +8788,7 @@
8591
8788
  initSaveKeyboardShortcut: () => initSaveKeyboardShortcut,
8592
8789
  isSaveConflicted: () => isSaveConflicted,
8593
8790
  releaseAllSaves: () => releaseAllSaves,
8791
+ releaseBootSettle: () => releaseBootSettle,
8594
8792
  replacePageWith: () => replacePageWith2,
8595
8793
  resumeAutosave: () => resumeAutosave,
8596
8794
  saveHoldReason: () => saveHoldReason,
@@ -8599,6 +8797,7 @@
8599
8797
  savePageForce: () => savePageForce,
8600
8798
  savePageThrottled: () => savePageThrottled,
8601
8799
  savesHeld: () => savesHeld,
8800
+ schedulePaintHeal: () => schedulePaintHeal,
8602
8801
  setLastSavedBaselines: () => setLastSavedBaselines,
8603
8802
  setLastSavedContents: () => setLastSavedContents,
8604
8803
  setUnsavedChanges: () => setUnsavedChanges,
@@ -8710,7 +8909,7 @@
8710
8909
  function skipped_(msg) {
8711
8910
  return { ok: false, msg, msgType: "skipped", code: null, etag: null };
8712
8911
  }
8713
- function applySaveResult(result2, forComparison, forDirty, label, gateToken, forSave = null, captureId = null) {
8912
+ function applySaveResult(result2, forComparison, forDirty, label, gateToken, forSave = null, captureId = null, quietConflict = false) {
8714
8913
  if (result2.ok) {
8715
8914
  setLastSavedBaselines(forComparison, forDirty);
8716
8915
  lastSavedBytes = forSave;
@@ -8720,6 +8919,14 @@
8720
8919
  logBaseline(label, `${lastSavedContents.length} chars`);
8721
8920
  releaseConflictHold();
8722
8921
  } else if (result2.msgType === "conflict") {
8922
+ if (quietConflict) {
8923
+ if (savingTimeout) {
8924
+ clearTimeout(savingTimeout);
8925
+ savingTimeout = null;
8926
+ }
8927
+ document.documentElement.setAttribute("savestatus", "saved");
8928
+ return;
8929
+ }
8723
8930
  holdForConflict(result2.conflictEtag);
8724
8931
  setSaveState("conflict", result2.msg, result2.msgType, {
8725
8932
  hadTimeout: result2.hadTimeout === true,
@@ -8845,7 +9052,7 @@
8845
9052
  });
8846
9053
  }
8847
9054
  function savePageForce(callback = () => {
8848
- }) {
9055
+ }, { quietConflict = false } = {}) {
8849
9056
  return new Promise((resolve) => {
8850
9057
  if (!isEditMode && !window.clay?.testMode) {
8851
9058
  const skipped = skipped_("Not in edit mode");
@@ -8883,7 +9090,7 @@
8883
9090
  saveCapturedHtml(forSave, captureId, (result2) => {
8884
9091
  ownSaveOnWire = false;
8885
9092
  inFlightComparisons.delete(comparison);
8886
- applySaveResult(result2, comparison.forComparison, comparison.forDirty, "updated after force save", gateToken, forSave, captureId);
9093
+ applySaveResult(result2, comparison.forComparison, comparison.forDirty, "updated after force save", gateToken, forSave, captureId, quietConflict);
8887
9094
  if (typeof callback === "function") {
8888
9095
  callback(result2);
8889
9096
  }
@@ -8993,6 +9200,46 @@
8993
9200
  function baselineSettled() {
8994
9201
  return baselineSettledAt;
8995
9202
  }
9203
+ function hashSignature(s2) {
9204
+ let h = 5381;
9205
+ for (let i2 = 0; i2 < s2.length; i2++) h = (h << 5) + h + s2.charCodeAt(i2) | 0;
9206
+ return String(h >>> 0);
9207
+ }
9208
+ function healedFrom(signature) {
9209
+ try {
9210
+ return localStorage.getItem(HEAL_KEY) === hashSignature(signature);
9211
+ } catch {
9212
+ return false;
9213
+ }
9214
+ }
9215
+ function noteHealedFrom(signature) {
9216
+ try {
9217
+ localStorage.setItem(HEAL_KEY, hashSignature(signature));
9218
+ } catch {
9219
+ }
9220
+ }
9221
+ function currentPaintSignature() {
9222
+ return paintSignature(captureSaveClone({ flushUndo: false }));
9223
+ }
9224
+ function schedulePaintHeal(fileSignature) {
9225
+ if (!isEditMode || isDraftMode) return;
9226
+ clearTimeout(paintHealTimer);
9227
+ paintHealTimer = setTimeout(() => {
9228
+ paintHealTimer = null;
9229
+ const onDisk = typeof fileSignature === "function" ? fileSignature() : fileSignature;
9230
+ if (onDisk == null || !autosaveActive() || !baselineSettled() || isSaveConflicted() || autosaveIsSuspended()) return;
9231
+ if (captureForDirtyCheck({ flushUndo: false }) !== lastSavedDirty) return;
9232
+ if (onDisk === currentPaintSignature()) return;
9233
+ if (healedFrom(onDisk)) return;
9234
+ noteHealedFrom(onDisk);
9235
+ savePageForce(() => {
9236
+ }, { quietConflict: true });
9237
+ }, PAINT_HEAL_MIN_MS + Math.random() * PAINT_HEAL_SPREAD_MS);
9238
+ }
9239
+ function releaseBootSettle() {
9240
+ bootPhase.holdSettle = false;
9241
+ if (settleNow) settleNow();
9242
+ }
8996
9243
  function initBaselineCapture() {
8997
9244
  if (!isEditMode) return;
8998
9245
  let userEdited = false;
@@ -9030,13 +9277,20 @@
9030
9277
  baselineSettledAt = true;
9031
9278
  document.dispatchEvent(new CustomEvent("clay:baseline-settled"));
9032
9279
  };
9280
+ settleNow = captureBaseline;
9281
+ const settle6 = () => {
9282
+ if (!bootPhase.holdSettle) captureBaseline();
9283
+ };
9033
9284
  unsubscribeMutation = mutation_default.onAnyChange(
9034
9285
  { debounce: SETTLE_MS, omitChangeDetails: true, require: "autosave" },
9035
- captureBaseline
9286
+ settle6
9036
9287
  );
9037
9288
  setTimeout(() => {
9038
- if (!settled2) captureBaseline();
9289
+ if (!settled2) settle6();
9039
9290
  }, MAX_SETTLE_MS);
9291
+ setTimeout(() => {
9292
+ if (!settled2 && bootPhase.holdSettle) releaseBootSettle();
9293
+ }, MAX_HOLD_MS);
9040
9294
  }
9041
9295
  function savePageThrottled(callback = () => {
9042
9296
  }) {
@@ -9125,7 +9379,7 @@
9125
9379
  initSaveKeyboardShortcut();
9126
9380
  initHyperclaySaveButton();
9127
9381
  }
9128
- var savingTimeout, unsavedChanges, lastSavedContents, lastSavedDirty, baselineRevision, inFlightComparisons, pendingSave, pendingAutosave, ownSaveOnWire, autosaveSuspended, autosaveMissed, previewHold, previewMissed, previewAutosaveMissed, PREVIEW_HOLD_REASON, holdReasons, conflictHold, conflictEtag, lastSavedBytes, throttledSave, baselineContents, baselineActive, baselineSettledAt, SETTLE_MS, MAX_SETTLE_MS, save_default;
9382
+ var savingTimeout, unsavedChanges, lastSavedContents, lastSavedDirty, baselineRevision, inFlightComparisons, pendingSave, pendingAutosave, ownSaveOnWire, autosaveSuspended, autosaveMissed, previewHold, previewMissed, previewAutosaveMissed, PREVIEW_HOLD_REASON, holdReasons, conflictHold, conflictEtag, lastSavedBytes, throttledSave, baselineContents, baselineActive, baselineSettledAt, PAINT_HEAL_MIN_MS, PAINT_HEAL_SPREAD_MS, paintHealTimer, HEAL_KEY, SETTLE_MS, MAX_SETTLE_MS, MAX_HOLD_MS, settleNow, save_default;
9129
9383
  var init_save = __esm({
9130
9384
  "src/core/save.js"() {
9131
9385
  init_throttle();
@@ -9133,6 +9387,7 @@
9133
9387
  init_is_edit_mode();
9134
9388
  init_save_core();
9135
9389
  init_snapshot();
9390
+ init_derived();
9136
9391
  init_region_policy();
9137
9392
  init_etag();
9138
9393
  init_dirty_gate();
@@ -9144,6 +9399,7 @@
9144
9399
  init_autosave_debug();
9145
9400
  init_user_gesture();
9146
9401
  init_unsaved_warning();
9402
+ init_boot_phase();
9147
9403
  addDocumentTransform((clone) => {
9148
9404
  for (const name of ROOT_LIBRARY_ATTRS) clone.removeAttribute(name);
9149
9405
  });
@@ -9184,6 +9440,10 @@
9184
9440
  baselineContents = "";
9185
9441
  baselineActive = true;
9186
9442
  baselineSettledAt = false;
9443
+ PAINT_HEAL_MIN_MS = 250;
9444
+ PAINT_HEAL_SPREAD_MS = 1250;
9445
+ paintHealTimer = null;
9446
+ HEAL_KEY = "clay:paint-heal:" + location.pathname;
9187
9447
  registerStyleAdoption((identity) => {
9188
9448
  const strip = styleComparisonStripper(identity);
9189
9449
  lastSavedContents = strip(lastSavedContents);
@@ -9196,6 +9456,8 @@
9196
9456
  });
9197
9457
  SETTLE_MS = 500;
9198
9458
  MAX_SETTLE_MS = 3e3;
9459
+ MAX_HOLD_MS = 1e4;
9460
+ settleNow = null;
9199
9461
  if (document.readyState === "loading") {
9200
9462
  document.addEventListener("DOMContentLoaded", initBaselineCapture);
9201
9463
  } else {
@@ -9910,7 +10172,7 @@
9910
10172
  }
9911
10173
  }
9912
10174
  applies2.sort((a2, b4) => (a2.ticket || 0) - (b4.ticket || 0));
9913
- const pageOf = (a2) => serializeRecoveryClone(a2.root, { prepared: a2.domain === "save" });
10175
+ const pageOf = (a2) => serializeRecoveryClone(a2.recoveryRoot ?? a2.root, { prepared: a2.domain === "save" });
9914
10176
  let html;
9915
10177
  let older;
9916
10178
  if (refused2 || !applies2.length) {
@@ -17675,9 +17937,9 @@
17675
17937
  apply2.ids.add(id);
17676
17938
  return id;
17677
17939
  }
17678
- function beginApply({ source: source3, seq = null, etag = null, domain, root: root3 }) {
17940
+ function beginApply({ source: source3, seq = null, etag = null, domain, root: root3, recoveryRoot = null }) {
17679
17941
  const id = nextId("a");
17680
- applies.set(id, { id, source: source3, seq, etag, ticket: 0, domain, root: root3, ids: /* @__PURE__ */ new Set() });
17942
+ applies.set(id, { id, source: source3, seq, etag, ticket: 0, domain, root: root3, recoveryRoot, ids: /* @__PURE__ */ new Set() });
17681
17943
  pending2.add(id);
17682
17944
  register().changed();
17683
17945
  return id;
@@ -18885,6 +19147,7 @@
18885
19147
  });
18886
19148
  function emptyScratchpads(root3) {
18887
19149
  for (const el11 of root3.querySelectorAll(FREEZE_SELECTOR2)) el11.replaceChildren();
19150
+ if (derivedActive()) stripDerived(root3);
18888
19151
  return root3;
18889
19152
  }
18890
19153
  function scratchpadsEmptied(input) {
@@ -18949,6 +19212,7 @@
18949
19212
  init_stream_bridge();
18950
19213
  init_conflicts();
18951
19214
  init_conflict_footprints();
19215
+ init_derived();
18952
19216
  init_save();
18953
19217
  ({ createIdentityStore } = HyperMorph);
18954
19218
  SYNC_IGNORE_SELECTOR = [
@@ -20001,9 +20265,9 @@
20001
20265
  live: document,
20002
20266
  remote,
20003
20267
  ignore: (el11) => el11.matches(SYNC_IGNORE_SELECTOR),
20004
- opaque: (el11) => el11.matches(FREEZE_SELECTOR2),
20268
+ opaque: (el11) => el11.matches(FREEZE_SELECTOR2) || derivedActive() && ownsDerivedText(el11),
20005
20269
  remoteWins: (el11) => el11.matches(REMOTE_WINS_SELECTOR),
20006
- ignoreAttribute: isRootLocalAttr,
20270
+ ignoreAttribute: (el11, name, merged) => isRootLocalAttr(el11, name, merged) || derivedActive() && isDerivedAttr(merged || el11, name),
20007
20271
  protectFocusedValue: true,
20008
20272
  keepLiveOnly: source3 === "peer",
20009
20273
  scripts: { mergeTags: mergeTagRecognizers },
@@ -20038,12 +20302,15 @@
20038
20302
  }
20039
20303
  });
20040
20304
  } else {
20041
- localRoot = emptyScratchpads(captureLocal());
20305
+ const captured = captureLocal();
20306
+ const recoveryRoot = captured.cloneNode(true);
20307
+ localRoot = emptyScratchpads(captured);
20042
20308
  applyId = beginApply({
20043
20309
  source: source3,
20044
20310
  seq,
20045
20311
  etag,
20046
20312
  root: localRoot,
20313
+ recoveryRoot,
20047
20314
  domain: source3 === "disk" ? "save" : "sync"
20048
20315
  });
20049
20316
  try {
@@ -20157,6 +20424,7 @@
20157
20424
  });
20158
20425
  diverged = report2.localDiverged;
20159
20426
  typedDuringWait = typed;
20427
+ repaintDerived();
20160
20428
  window.scrollTo(scrollX, scrollY2);
20161
20429
  this._setPeerBase(html, identityMap, ticket);
20162
20430
  this._applyGen++;
@@ -20205,6 +20473,7 @@
20205
20473
  * local edits.
20206
20474
  */
20207
20475
  async _doApplyExternal(html, seq, etag = null, by = null, fetchOptions = null) {
20476
+ const priorDisk = this._diskBase;
20208
20477
  this._log(`applyExternal - external disk change (seq=${seq})`);
20209
20478
  this.isPaused = true;
20210
20479
  const scrollX = window.scrollX;
@@ -20250,6 +20519,7 @@
20250
20519
  });
20251
20520
  diverged = report2.localDiverged;
20252
20521
  typedDuringWait = typed;
20522
+ repaintDerived();
20253
20523
  this._setDiskBase(html, ticket);
20254
20524
  window.scrollTo(scrollX, scrollY2);
20255
20525
  if (!(this._acceptedSaveTicket > ticket)) {
@@ -20290,6 +20560,9 @@
20290
20560
  }
20291
20561
  if (stamped) conflictResolvedBySync(etag);
20292
20562
  this._saveAfterMerge(diverged, typedDuringWait);
20563
+ if (priorDisk != null && paintSignatureOfHtml(priorDisk) === paintSignatureOfHtml(html)) {
20564
+ schedulePaintHeal(() => this._diskBase == null ? null : paintSignatureOfHtml(this._diskBase));
20565
+ }
20293
20566
  }
20294
20567
  /**
20295
20568
  * Handle a notification message from the server
@@ -21209,6 +21482,7 @@
21209
21482
  await Promise.resolve();
21210
21483
  const plan = prepareRevert(ids);
21211
21484
  const revertedIds = applyRevert(plan);
21485
+ repaintDerived();
21212
21486
  let saveResult = null;
21213
21487
  if (revertedIds.length) {
21214
21488
  gateMarkDirty();
@@ -21228,6 +21502,7 @@
21228
21502
  init_live_sync();
21229
21503
  init_save();
21230
21504
  init_dirty_gate();
21505
+ init_derived();
21231
21506
  init_mutation();
21232
21507
  init_user_gesture();
21233
21508
  init_admin_contenteditable();
@@ -27237,13 +27512,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
27237
27512
  }
27238
27513
  const data = view3(state2, []);
27239
27514
  let resolveReady;
27240
- const ready5 = new Promise((resolve) => {
27515
+ const ready6 = new Promise((resolve) => {
27241
27516
  resolveReady = resolve;
27242
27517
  });
27243
27518
  const handle = Object.freeze({
27244
27519
  name,
27245
27520
  ephemeral: ephemeral2,
27246
- ready: ready5,
27521
+ ready: ready6,
27247
27522
  get data() {
27248
27523
  return data;
27249
27524
  },
@@ -38088,7 +38363,7 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
38088
38363
  }
38089
38364
  function identityPlugin() {
38090
38365
  const clean2 = /* @__PURE__ */ new WeakSet();
38091
- const ready5 = (doc) => {
38366
+ const ready6 = (doc) => {
38092
38367
  const ids = /* @__PURE__ */ new Set();
38093
38368
  let previous = null, valid2 = true;
38094
38369
  doc.forEach((node) => {
@@ -38109,7 +38384,7 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
38109
38384
  return new Oi.Plugin({
38110
38385
  state: {
38111
38386
  init(_config, editor) {
38112
- if (ready5(editor.doc)) clean2.add(editor.doc);
38387
+ if (ready6(editor.doc)) clean2.add(editor.doc);
38113
38388
  return null;
38114
38389
  },
38115
38390
  apply() {
@@ -38122,7 +38397,7 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
38122
38397
  return null;
38123
38398
  }
38124
38399
  if (!transactions.some((tr5) => tr5.docChanged && !tr5.getMeta(REMOTE))) {
38125
- if (clean2.has(old.doc) && ready5(next.doc)) clean2.add(next.doc);
38400
+ if (clean2.has(old.doc) && ready6(next.doc)) clean2.add(next.doc);
38126
38401
  return null;
38127
38402
  }
38128
38403
  const tr4 = next.tr;
@@ -39078,12 +39353,29 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
39078
39353
  if (dispatch) dispatch(joinIntoSummary(st6, ents, ti4, ni4).scrollIntoView());
39079
39354
  return true;
39080
39355
  }
39356
+ function deleteBeforeToggle(st6, dispatch) {
39357
+ const { $from, empty } = st6.selection;
39358
+ if (!empty || $from.depth !== 1) return false;
39359
+ const n3 = $from.parent, i2 = $from.index(0);
39360
+ if (!n3.isTextblock || n3.type.spec.code || isToggle(n3) || !n3.content.size || $from.parentOffset !== n3.content.size) return false;
39361
+ if (i2 + 1 >= st6.doc.childCount || !isToggle(st6.doc.child(i2 + 1))) return false;
39362
+ if (dispatch && n3.type !== N3.paragraph) dispatch(st6.tr.setSelection(TextSelection3.create(st6.doc, $from.after() + 1)).scrollIntoView());
39363
+ else if (dispatch) {
39364
+ const at5 = $from.before();
39365
+ const tr4 = st6.tr.insert($from.after() + 1, n3.content).delete(at5, $from.after());
39366
+ dispatch(tr4.setSelection(TextSelection3.create(tr4.doc, at5 + 1 + n3.content.size)).scrollIntoView());
39367
+ }
39368
+ return true;
39369
+ }
39081
39370
  function backspaceBodyBlock(st6, dispatch) {
39082
39371
  const { $from, empty } = st6.selection;
39083
39372
  if (!empty || $from.depth !== 1 || $from.parentOffset !== 0 || !$from.parent.isTextblock) return false;
39084
39373
  const n3 = $from.parent;
39085
39374
  if (isList(n3) || isToggle(n3) || parentOf(n3) === null) return false;
39086
- return outdentBlocks(st6, dispatch);
39375
+ const i2 = $from.index(0);
39376
+ if (st6.doc.child(i2 - 1).attrs.id !== parentOf(n3)) return false;
39377
+ if (dispatch) dispatch(joinIntoSummary(st6, outline(st6.doc), i2 - 1, i2).scrollIntoView());
39378
+ return true;
39087
39379
  }
39088
39380
  function setOpen(st6, ti4, open2, ents = outline(st6.doc)) {
39089
39381
  const e20 = ents[ti4];
@@ -39502,7 +39794,7 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
39502
39794
  }
39503
39795
  });
39504
39796
  }
39505
- var alignOf, Plugin3, PluginKey3, TextSelection3, NodeSelection2, Selection3, N3, isList, isToggle, parentOf, STEP, MOVE, asStep2, subtreeRange, touchedBlocks, boundary, blockRef, matchesRef, mapSpan, BlockSelection, BlockBookmark, prevSibling, moveBlock, MAX_INDENT, sameRun, inside, ALPHA, ROMAN, collapseKey, STRUCTURAL2, LIST_LINE, LIST_TAGS, BLOCK_TAGS2, numberAttr, parentAttr, clipboardParser, ClipboardSerializer, base, clipboardSerializer, backspace, blockKeys;
39797
+ var alignOf, Plugin3, PluginKey3, TextSelection3, NodeSelection2, Selection3, N3, isList, isToggle, parentOf, STEP, MOVE, asStep2, subtreeRange, touchedBlocks, boundary, blockRef, matchesRef, mapSpan, BlockSelection, BlockBookmark, prevSibling, moveBlock, MAX_INDENT, sameRun, codeEdge, backspaceCodeEdge, deleteCodeEdge, inside, ALPHA, ROMAN, collapseKey, STRUCTURAL2, LIST_LINE, LIST_TAGS, BLOCK_TAGS2, numberAttr, parentAttr, clipboardParser, ClipboardSerializer, base, clipboardSerializer, backspace, del, blockKeys;
39506
39798
  var init_blocks = __esm({
39507
39799
  "src/page/blocks.js"() {
39508
39800
  init_prosemirror_vendor();
@@ -39605,6 +39897,28 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
39605
39897
  };
39606
39898
  MAX_INDENT = 8;
39607
39899
  sameRun = (x6, y4) => isList(x6.node) && isList(y4.node) && parentOf(x6.node) === parentOf(y4.node);
39900
+ codeEdge = (dir) => (st6, dispatch) => {
39901
+ const { $from, empty } = st6.selection;
39902
+ if (!empty || $from.depth !== 1 || !$from.parent.isTextblock) return false;
39903
+ const n3 = $from.parent, i2 = $from.index(0);
39904
+ if ($from.parentOffset !== (dir < 0 ? 0 : n3.content.size)) return false;
39905
+ const ents = outline(st6.doc);
39906
+ const ti4 = dir < 0 ? collapsedBefore(ents, i2) : -1;
39907
+ const j6 = ti4 >= 0 ? ti4 : i2 + dir;
39908
+ if (j6 < 0 || j6 >= ents.length) return false;
39909
+ const o3 = ents[j6].node;
39910
+ if (!o3.isTextblock || !n3.type.spec.code && !o3.type.spec.code) return false;
39911
+ if (!dispatch) return true;
39912
+ const tr4 = st6.tr, mine = ents[i2], other = ents[j6];
39913
+ const target = dir < 0 ? other.end - 1 : other.at + 1;
39914
+ if (!n3.content.size && !n3.type.spec.code) tr4.delete(mine.at, mine.end).setSelection(TextSelection3.create(tr4.doc, tr4.mapping.map(target)));
39915
+ else if (!o3.content.size && !o3.type.spec.code) tr4.delete(other.at, other.end);
39916
+ else tr4.setSelection(TextSelection3.create(tr4.doc, target));
39917
+ dispatch(tr4.scrollIntoView());
39918
+ return true;
39919
+ };
39920
+ backspaceCodeEdge = codeEdge(-1);
39921
+ deleteCodeEdge = codeEdge(1);
39608
39922
  inside = (r44, p3) => p3 > r44.from && p3 < r44.to;
39609
39923
  ALPHA = (n3) => {
39610
39924
  let s2 = "";
@@ -39686,7 +40000,8 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
39686
40000
  };
39687
40001
  base = Qr.DOMSerializer.fromSchema(schema);
39688
40002
  clipboardSerializer = new ClipboardSerializer(base.nodes, base.marks);
39689
- backspace = lo.chainCommands(backspaceListItem, backspaceToggle, backspaceBodyBlock, backspaceAfterCollapsed);
40003
+ backspace = lo.chainCommands(backspaceListItem, backspaceToggle, backspaceCodeEdge, backspaceBodyBlock, backspaceAfterCollapsed);
40004
+ del = lo.chainCommands(deleteAtCollapsedEnd, deleteBeforeToggle, deleteCodeEdge);
39690
40005
  blockKeys = {
39691
40006
  Enter: lo.chainCommands(enterListItem, enterToggle, exitToggleOnEmpty, enterBodyBlock),
39692
40007
  Backspace: backspace,
@@ -39694,12 +40009,12 @@ ${Object.entries(inner).map(([k5, v5]) => `${serializeLive(k5)}:${serializeLive(
39694
40009
  "Mod-Backspace": backspace,
39695
40010
  "Alt-Backspace": backspace,
39696
40011
  "Ctrl-h": backspace,
39697
- Delete: deleteAtCollapsedEnd,
39698
- "Shift-Delete": deleteAtCollapsedEnd,
39699
- "Mod-Delete": deleteAtCollapsedEnd,
39700
- "Alt-Delete": deleteAtCollapsedEnd,
39701
- "Ctrl-d": deleteAtCollapsedEnd,
39702
- "Ctrl-Alt-Backspace": deleteAtCollapsedEnd,
40012
+ Delete: del,
40013
+ "Shift-Delete": del,
40014
+ "Mod-Delete": del,
40015
+ "Alt-Delete": del,
40016
+ "Ctrl-d": del,
40017
+ "Ctrl-Alt-Backspace": del,
39703
40018
  Tab: indentBlocks,
39704
40019
  "Shift-Tab": outdentBlocks,
39705
40020
  "Mod-Shift-ArrowUp": moveBlock(-1),
@@ -45604,7 +45919,7 @@ ${n3.toString()}`);
45604
45919
  const records3 = textDeletes(pd.gone);
45605
45920
  Qt3(transaction, um.currStackItem.deletions, (item) => {
45606
45921
  if (!(item instanceof b) || item.parent !== pd.flow || !item.countable || !item.redone) return;
45607
- const marker = item.content instanceof wt3 && item.content.embed?.b !== void 0;
45922
+ const marker2 = item.content instanceof wt3 && item.content.embed?.b !== void 0;
45608
45923
  for (let offset = 0; offset < item.length; offset++) {
45609
45924
  const original = { client: item.id.client, clock: item.id.clock + offset };
45610
45925
  const source3 = index.resolve(original);
@@ -45616,11 +45931,11 @@ ${n3.toString()}`);
45616
45931
  }
45617
45932
  if (!(live3 instanceof b) || live3.deleted) continue;
45618
45933
  if (dest.clock < (transaction.beforeState.get(dest.client) ?? 0)) continue;
45619
- if (!marker && coversOriginal(records3, pd.ydoc.clientID, original)) {
45934
+ if (!marker2 && coversOriginal(records3, pd.ydoc.clientID, original)) {
45620
45935
  repairs.push(dest);
45621
45936
  continue;
45622
45937
  }
45623
- (marker ? aliases : spans).push({ dest, source: source3 });
45938
+ (marker2 ? aliases : spans).push({ dest, source: source3 });
45624
45939
  }
45625
45940
  });
45626
45941
  if (spans.length || aliases.length) pd.ydoc.transact(() => {
@@ -46403,8 +46718,8 @@ ${n3.toString()}`);
46403
46718
  return { type, attrs, key: best.restore.key };
46404
46719
  }
46405
46720
  function sourceRecord(pd, index, sourceKey, removals, hidden, intents, visible, groups) {
46406
- const effective = (blockId2, marker, overrides2 = null) => {
46407
- const boundary3 = index.boundaryOf(marker);
46721
+ const effective = (blockId2, marker2, overrides2 = null) => {
46722
+ const boundary3 = index.boundaryOf(marker2);
46408
46723
  if (!boundary3 || boundary3.blockId !== blockId2 || !boundary3.recoveryOf) return blockOf2(pd, blockId2, overrides2);
46409
46724
  const root4 = recoveredRoot(boundary3.recoveryOf, groups.get(boundary3.recoveryOf) ?? [], intents);
46410
46725
  const type = typeof overrides2?.get("t") === "string" && schema.nodes[overrides2.get("t")] ? overrides2.get("t") : root4?.type ?? "paragraph";
@@ -53438,10 +53753,10 @@ ${text2}`;
53438
53753
  function style2(nameOrHref, css) {
53439
53754
  return writeStyle(nameOrHref, css);
53440
53755
  }
53441
- function styleWithLegacyId(name, css, legacyId) {
53442
- return writeStyle(name, css, legacyId);
53756
+ function styleWithLegacyId(name, css, legacyId, tokens = []) {
53757
+ return writeStyle(name, css, legacyId, tokens);
53443
53758
  }
53444
- function writeStyle(nameOrHref, css, legacyId) {
53759
+ function writeStyle(nameOrHref, css, legacyId, tokens = []) {
53445
53760
  const inline = typeof css === "string";
53446
53761
  const identity = inline ? { name: nameOrHref, legacyId } : { href: getStyleBaseUrl(nameOrHref) };
53447
53762
  const legacy = legacyId === void 0 ? [] : document.querySelectorAll(`style[id="${legacyId}"]:not([data-name])`);
@@ -53450,7 +53765,7 @@ ${text2}`;
53450
53765
  adoptStyleComparisons(identity);
53451
53766
  for (const el11 of legacy) el11.dataset.name = nameOrHref;
53452
53767
  if (inline) {
53453
- const el11 = insertStyles(nameOrHref, css, markNoDirty);
53768
+ const el11 = insertStyles(nameOrHref, css, marker(tokens));
53454
53769
  if (legacyId !== void 0) el11.id = legacyId;
53455
53770
  return el11;
53456
53771
  }
@@ -53462,16 +53777,18 @@ ${text2}`;
53462
53777
  mutation_default.resume();
53463
53778
  }
53464
53779
  }
53465
- var markNoDirty;
53780
+ var marker, markNoDirty;
53466
53781
  var init_style = __esm({
53467
53782
  "src/lib/style.js"() {
53468
53783
  init_insert_style_tag();
53469
53784
  init_mutation();
53470
53785
  init_style_adoption();
53471
- markNoDirty = (el11) => {
53786
+ marker = (extra = []) => (el11) => {
53472
53787
  const tokens = (el11.getAttribute("clay") ?? "").split(/\s+/).filter(Boolean);
53473
- if (!tokens.includes("no-dirty")) el11.setAttribute("clay", [...tokens, "no-dirty"].join(" "));
53788
+ const missing = ["no-dirty", ...extra].filter((token2) => !tokens.includes(token2));
53789
+ if (missing.length) el11.setAttribute("clay", [...tokens, ...missing].join(" "));
53474
53790
  };
53791
+ markNoDirty = marker();
53475
53792
  }
53476
53793
  });
53477
53794
 
@@ -53540,7 +53857,7 @@ ${text2}`;
53540
53857
  function createPageEditor(mount2, { blocks = null, onChange = null, upload: upload2, highlight: highlight2, doc: initialDoc, dispatch, history: useHistory = true, undo: undo2, redo, editable = true, toolHost: providedToolHost = null, onAiTool = null, reviseTool = null, board = null } = {}) {
53541
53858
  const doc = mount2.ownerDocument;
53542
53859
  const toolHost = providedToolHost ?? createToolHost({ mode: "edit" });
53543
- styleWithLegacyId(STYLE_ID, PAGE_EDITOR_CSS, STYLE_ID);
53860
+ styleWithLegacyId(STYLE_ID, PAGE_EDITOR_CSS, STYLE_ID, ["editor-ui"]);
53544
53861
  const shell = doc.createElement("div");
53545
53862
  shell.className = "page-shell";
53546
53863
  shell.setAttribute("clay", "editor-ui");
@@ -54456,7 +54773,7 @@ ${BOARD_CSS}
54456
54773
  function installAdoption({
54457
54774
  view: view3,
54458
54775
  source: source3 = null,
54459
- ready: ready5 = Promise.resolve(),
54776
+ ready: ready6 = Promise.resolve(),
54460
54777
  isAdopter = () => true,
54461
54778
  idle = () => compositionIdle(view3),
54462
54779
  requestCheckpoint: requestCheckpoint2 = () => {
@@ -54497,7 +54814,7 @@ ${BOARD_CSS}
54497
54814
  timer = setTimeout(() => resolve("timeout"), holdMs);
54498
54815
  });
54499
54816
  try {
54500
- return await Promise.race([Promise.resolve(ready5).then(() => idle()).then(() => "ready"), cancelled.then(() => "disposed"), timeout]);
54817
+ return await Promise.race([Promise.resolve(ready6).then(() => idle()).then(() => "ready"), cancelled.then(() => "disposed"), timeout]);
54501
54818
  } finally {
54502
54819
  clearTimeout(timer);
54503
54820
  }
@@ -55731,13 +56048,13 @@ ${BOARD_CSS}
55731
56048
  }
55732
56049
  return { start: start2, endA, endB };
55733
56050
  }
55734
- function keepViewPos(derived, current4 = null) {
56051
+ function keepViewPos(derived2, current4 = null) {
55735
56052
  const previous = /* @__PURE__ */ new Map();
55736
56053
  current4?.forEach((block2) => {
55737
56054
  if (block2.attrs.id) previous.set(block2.attrs.id, block2);
55738
56055
  });
55739
56056
  const blocks = [];
55740
- derived.forEach((block2) => blocks.push(block2));
56057
+ derived2.forEach((block2) => blocks.push(block2));
55741
56058
  const positions = blocks.map((block2) => ({ id: block2.attrs.id, pos: previous.get(block2.attrs.id)?.attrs.pos ?? block2.attrs.pos }));
55742
56059
  const changes2 = repairSiblings(positions, "b");
55743
56060
  let changed2 = false;
@@ -55759,7 +56076,7 @@ ${BOARD_CSS}
55759
56076
  changed2 = true;
55760
56077
  return block2.type.create({ ...block2.attrs, pos }, content, block2.marks);
55761
56078
  });
55762
- return changed2 ? derived.type.create(derived.attrs, placed2) : derived;
56079
+ return changed2 ? derived2.type.create(derived2.attrs, placed2) : derived2;
55763
56080
  }
55764
56081
  function createBridge({ pd, onNotice = () => {
55765
56082
  }, ownedTokens = [], authorToken = null, stats = { groups: 0, mismatch: 0, renders: 0, first: null }, captureTimeout = 500 }) {
@@ -55839,10 +56156,10 @@ ${BOARD_CSS}
55839
56156
  stats.renders++;
55840
56157
  const keep = saved2;
55841
56158
  saved2 = null;
55842
- const derived = keepViewPos(fresh ?? refresh2(), view3.state.doc);
55843
- const d = docDiff(view3.state.doc, derived);
56159
+ const derived2 = keepViewPos(fresh ?? refresh2(), view3.state.doc);
56160
+ const d = docDiff(view3.state.doc, derived2);
55844
56161
  if (!d) return;
55845
- const tr4 = view3.state.tr.replace(d.start, d.endA, derived.slice(d.start, d.endB)).setMeta(REMOTE_META, true).setMeta("addToHistory", false);
56162
+ const tr4 = view3.state.tr.replace(d.start, d.endA, derived2.slice(d.start, d.endB)).setMeta(REMOTE_META, true).setMeta("addToHistory", false);
55846
56163
  if (own) tr4.setMeta("yundo", true);
55847
56164
  if (keep) {
55848
56165
  const hiddenUnit = (y4) => y4 >= 0 && w4.holes.some((hole) => y4 >= yBefore(w4.holes, hole.at) && y4 < yAfter(w4.holes, hole.at));
@@ -55977,12 +56294,12 @@ ${BOARD_CSS}
55977
56294
  const register2 = registerAuthor;
55978
56295
  registerAuthor = null;
55979
56296
  localGroup(pd, local3, w4, stats, um, history3, register2);
55980
- const derived = refresh2();
55981
- if (!sameBareShape(derived, view3.state.doc)) {
56297
+ const derived2 = refresh2();
56298
+ if (!sameBareShape(derived2, view3.state.doc)) {
55982
56299
  stats.mismatch++;
55983
- stats.first ??= { before: bareShape(local3[0].before), pm: bareShape(view3.state.doc), y: bareShape(derived) };
56300
+ stats.first ??= { before: bareShape(local3[0].before), pm: bareShape(view3.state.doc), y: bareShape(derived2) };
55984
56301
  }
55985
- render3(false, derived);
56302
+ render3(false, derived2);
55986
56303
  },
55987
56304
  // Restore inserts the displaced source as a normal block found by its Yjs identity, with no
55988
56305
  // provenance layer. Four edge cases are accepted because they are rare and lose no text
@@ -56007,12 +56324,12 @@ ${BOARD_CSS}
56007
56324
  }
56008
56325
  const blockId = `${RECOVERED_PREFIX}${sourceKey}`;
56009
56326
  um.stopCapturing();
56010
- let marker = null;
56327
+ let marker2 = null;
56011
56328
  pd.ydoc.transact(() => {
56012
56329
  pd.gone.set(restoreKey(sourceKey, mintOp(pd)), { covers: record6.removals.map((removal) => removal.key), baseline: { type: record6.type, attrs: JSON.parse(JSON.stringify(record6.attrs)) } });
56013
56330
  pd.flow.insertEmbed(restoreIndexAt(pd, sourceKey), { b: blockId });
56014
- marker = newestLocalMarker(pd, blockId);
56015
- origins.recordBoundary(marker, { blockId, kind: "restore", recoveryOf: sourceKey });
56331
+ marker2 = newestLocalMarker(pd, blockId);
56332
+ origins.recordBoundary(marker2, { blockId, kind: "restore", recoveryOf: sourceKey });
56016
56333
  }, LOCAL2);
56017
56334
  um.stopCapturing();
56018
56335
  render3();
@@ -57264,11 +57581,11 @@ ${doc.documentElement.outerHTML}`);
57264
57581
  })]);
57265
57582
  clearTimeout(timer);
57266
57583
  };
57267
- const ready5 = needsAdoption ? awaitWriter() : Promise.resolve();
57584
+ const ready6 = needsAdoption ? awaitWriter() : Promise.resolve();
57268
57585
  const adoption = installAdoption({
57269
57586
  view: view3,
57270
57587
  source: source3,
57271
- ready: ready5,
57588
+ ready: ready6,
57272
57589
  isAdopter: () => {
57273
57590
  const lane = fastLane();
57274
57591
  return !lane || lane.status.writer === null ? true : lane.isWriter();
@@ -58891,12 +59208,13 @@ ${doc.documentElement.outerHTML}`);
58891
59208
  init_hyper_undo_vendor();
58892
59209
  init_is_edit_mode();
58893
59210
  init_root_attrs();
59211
+ init_derived();
58894
59212
  init_attr_aliases();
58895
59213
  withTabLocal = (opts = {}) => {
58896
59214
  const own = opts.ignoreAttribute;
58897
59215
  return {
58898
59216
  ...opts,
58899
- ignoreAttribute: (name, target) => isTabLocalAttr(name, target) || (own ? own(name, target) : false)
59217
+ ignoreAttribute: (name, target) => isTabLocalAttr(name, target) || isDerivedAttr(target, name) || (own ? own(name, target) : false)
58900
59218
  };
58901
59219
  };
58902
59220
  createScope = undo.create.bind(undo);
@@ -69613,9 +69931,10 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
69613
69931
  }
69614
69932
  .hcp .hcp-dock .hcp-x:hover { color: var(--hcp-ink); background: var(--hcp-face); }
69615
69933
  .hcp-tab__label { display: inline; }
69934
+ .hcp-tab__mini { display: none; }
69935
+ .hcp[data-hcp-state="mini"] .hcp-tab__mini { display: inline; }
69616
69936
  .hcp[data-hcp-state="mini"] .hcp-tab__label,
69617
69937
  .hcp[data-hcp-state="mini"] .hcp-dock .hcp-x { display: none; }
69618
- .hcp[data-hcp-state="mini"] .hcp-tab { width: 34px; padding: 0; }
69619
69938
  .hcp[data-hcp-state="card"] .hcp-dock { display: none; }
69620
69939
 
69621
69940
  .hcp-card {
@@ -69905,7 +70224,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
69905
70224
  <div class="hcp-foot"><button type="button" class="hcp-quiet" data-hcp="dismiss">Don&rsquo;t show again</button></div>
69906
70225
  </section>
69907
70226
  <div class="hcp-dock">
69908
- <button type="button" class="hcp-btn hcp-tab" data-hcp="open" aria-controls="hcp-card" aria-expanded="false" aria-label="This app is free to keep"><span><svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg><span class="hcp-tab__label">This app is free to keep</span></span></button>
70227
+ <button type="button" class="hcp-btn hcp-tab" data-hcp="open" aria-controls="hcp-card" aria-expanded="false" aria-label="This app is free to keep"><span><svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg><span class="hcp-tab__label">This app is free to keep</span><span class="hcp-tab__mini">Keep</span></span></button>
69909
70228
  <button type="button" class="hcp-x" data-hcp="minimize" aria-label="Minimize download notice"><svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true"><path d="M1.4 0 6 4.6 10.6 0 12 1.4 7.4 6 12 10.6 10.6 12 6 7.4 1.4 12 0 10.6 4.6 6 0 1.4z"/></svg></button>
69910
70229
  </div>
69911
70230
  </aside>`;
@@ -71397,6 +71716,35 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
71397
71716
  }
71398
71717
  });
71399
71718
 
71719
+ // no-sap-core:../vendor/sap-core.vendor.js
71720
+ var sap_core_vendor_exports = {};
71721
+ __export(sap_core_vendor_exports, {
71722
+ default: () => sap_core_vendor_default
71723
+ });
71724
+ var sap_core_vendor_default;
71725
+ var init_sap_core_vendor = __esm({
71726
+ "no-sap-core:../vendor/sap-core.vendor.js"() {
71727
+ sap_core_vendor_default = null;
71728
+ }
71729
+ });
71730
+
71731
+ // src/plugins/derive.js
71732
+ var derive_exports = {};
71733
+ __export(derive_exports, {
71734
+ ready: () => ready5
71735
+ });
71736
+ function fullSapjs() {
71737
+ const sap = window.Sap;
71738
+ return Boolean(sap && !sap.core || window.clay?.loaded?.sap);
71739
+ }
71740
+ var ready5;
71741
+ var init_derive = __esm({
71742
+ "src/plugins/derive.js"() {
71743
+ ready5 = fullSapjs() ? null : Promise.resolve().then(() => (init_sap_core_vendor(), sap_core_vendor_exports)).then(() => {
71744
+ });
71745
+ }
71746
+ });
71747
+
71400
71748
  // entries/clay-data.js
71401
71749
  var clay_data_exports = {};
71402
71750
  var init_clay_data = __esm({
@@ -72610,54 +72958,54 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72610
72958
  "entries/sap.js"() {
72611
72959
  (function() {
72612
72960
  var Sap = (() => {
72613
- var ne6 = Object.defineProperty;
72614
- var xn4 = Object.getOwnPropertyDescriptor;
72615
- var Sn3 = Object.getOwnPropertyNames;
72616
- var kn4 = Object.prototype.hasOwnProperty;
72617
- var $n2 = (t2, e20) => {
72618
- for (var r44 in e20) ne6(t2, r44, { get: e20[r44], enumerable: true });
72619
- }, _n4 = (t2, e20, r44, n3) => {
72620
- if (e20 && typeof e20 == "object" || typeof e20 == "function") for (let o3 of Sn3(e20)) !kn4.call(t2, o3) && o3 !== r44 && ne6(t2, o3, { get: () => e20[o3], enumerable: !(n3 = xn4(e20, o3)) || n3.enumerable });
72961
+ var Ot5 = Object.defineProperty;
72962
+ var mn3 = Object.getOwnPropertyDescriptor;
72963
+ var hn4 = Object.getOwnPropertyNames;
72964
+ var bn4 = Object.prototype.hasOwnProperty;
72965
+ var gn5 = (t2, e20) => {
72966
+ for (var r44 in e20) Ot5(t2, r44, { get: e20[r44], enumerable: true });
72967
+ }, wn4 = (t2, e20, r44, n3) => {
72968
+ if (e20 && typeof e20 == "object" || typeof e20 == "function") for (let o3 of hn4(e20)) !bn4.call(t2, o3) && o3 !== r44 && Ot5(t2, o3, { get: () => e20[o3], enumerable: !(n3 = mn3(e20, o3)) || n3.enumerable });
72621
72969
  return t2;
72622
72970
  };
72623
- var Tn3 = (t2) => _n4(ne6({}, "__esModule", { value: true }), t2);
72624
- var Sr4 = {};
72625
- $n2(Sr4, { Sap: () => O4, default: () => xr4, mount: () => vn4, mountAll: () => te6, runtime: () => mt6 });
72626
- function Ee6(t2) {
72971
+ var yn4 = (t2) => wn4(Ot5({}, "__esModule", { value: true }), t2);
72972
+ var hr4 = {};
72973
+ gn5(hr4, { Sap: () => Mt6, default: () => mr4, mount: () => dr4, mountAll: () => pn4, runtime: () => pr4 });
72974
+ function ee6(t2) {
72627
72975
  let e20 = false, r44 = /* @__PURE__ */ new Set(), n3 = [];
72628
- function o3(l2) {
72629
- l2 && (n3.push(l2), n3.length > 8 && n3.shift());
72976
+ function o3(u3) {
72977
+ u3 && (n3.push(u3), n3.length > 8 && n3.shift());
72630
72978
  }
72631
- function s2(l2, w4) {
72632
- o3(w4), !l2._broken && (r44.add(l2), !e20 && (e20 = true, queueMicrotask(a2)));
72979
+ function s2(u3, E4) {
72980
+ o3(E4), !u3._broken && (r44.add(u3), !e20 && (e20 = true, queueMicrotask(a2)));
72633
72981
  }
72634
72982
  function a2() {
72635
72983
  e20 = false;
72636
- let l2 = [...r44];
72984
+ let u3 = [...r44];
72637
72985
  r44.clear();
72638
- for (let w4 of l2) k5(w4);
72986
+ for (let E4 of u3) g2(E4);
72639
72987
  }
72640
- function k5(l2, w4 = false) {
72641
- if (!l2._broken) {
72642
- if (l2._passes = (l2._passes || 0) + 1, l2._passes > 50) {
72643
- l2._broken = true, l2._breakerRing = n3.slice(), t2(l2, { breaker: true });
72988
+ function g2(u3, E4 = false) {
72989
+ if (!(u3._broken || u3.halted)) {
72990
+ if (u3._passes = (u3._passes || 0) + 1, u3._passes > 50) {
72991
+ u3._broken = true, u3._breakerRing = n3.slice(), t2(u3, { breaker: true });
72644
72992
  return;
72645
72993
  }
72646
- l2._resetArmed || (l2._resetArmed = true, setTimeout(() => {
72647
- l2._passes = 0, l2._resetArmed = false;
72648
- }, 0)), t2(l2, w4 ? { full: true } : {});
72994
+ u3._resetArmed || (u3._resetArmed = true, setTimeout(() => {
72995
+ u3._passes = 0, u3._resetArmed = false;
72996
+ }, 0)), t2(u3, E4 ? { full: true } : {});
72649
72997
  }
72650
72998
  }
72651
- function $6(l2, w4) {
72652
- o3(w4), k5(l2, true);
72999
+ function b4(u3, E4) {
73000
+ o3(E4), g2(u3, true);
72653
73001
  }
72654
- function A4(l2) {
72655
- l2._broken = false, l2._passes = 0;
73002
+ function d(u3) {
73003
+ u3._broken = false, u3._passes = 0;
72656
73004
  }
72657
- return { schedule: s2, runNow: $6, rearm: A4, ring: n3 };
73005
+ return { schedule: s2, runNow: b4, rearm: d, ring: n3 };
72658
73006
  }
72659
- var re5 = { E01: { slug: "foreign-dialect", behavior: "HALT" }, E02: { slug: "moustaches-in-text", behavior: "HALT" }, E04: { slug: "duplicate-declaration", behavior: "HALT" }, E05: { slug: "reserved-name", behavior: "HALT" }, E06: { slug: "global-html-name", behavior: "HALT" }, E07: { slug: "calc-cycle", behavior: "ERR" }, E08: { slug: "expression-syntax", behavior: "HALT" }, E10: { slug: "orphan-item", behavior: "HALT" }, E12: { slug: "unknown-state-key", behavior: "ERR" }, E15: { slug: "write-to-undeclared-key", behavior: "ERR" }, E16: { slug: "write-to-computed-field", behavior: "ERR" }, E17: { slug: "unresolvable-action-target", behavior: "HALT" }, E18: { slug: "paint-on-form-control", behavior: "HALT" }, E20: { slug: "bind-on-non-control", behavior: "HALT" }, E22: { slug: "format-type", behavior: "ERR" }, E24: { slug: "runtime-expression-throw", behavior: "ERR" }, E26: { slug: "circuit-breaker", behavior: "HALT" }, E30: { slug: "attr-on-bound-control", behavior: "HALT" }, E31: { slug: "password-without-transient", behavior: "HALT" }, E32: { slug: "file-bind", behavior: "HALT" }, E33: { slug: "dialog-state-open", behavior: "HALT" }, E34: { slug: "transient-persist-collision", behavior: "HALT" }, E35: { slug: "presence-state-misuse", behavior: "HALT" }, E40: { slug: "each-not-array", behavior: "ERR" }, E41: { slug: "each-bad-key", behavior: "ERR" }, E42: { slug: "each-template", behavior: "ERR" }, E43: { slug: "bind-in-each-row", behavior: "ERR" }, W03: { slug: "unknown-colon-attribute", behavior: "WARN" }, W04: { slug: "expression-in-when", behavior: "WARN" }, W30: { slug: "nonzero-mount-writes", behavior: "WARN" }, W31: { slug: "detail-dialog-saved-open", behavior: "WARN" } }, bt6 = ["disabled", "readonly", "required", "checked", "selected", "multiple", "open", "inert", "autofocus", "novalidate", "hidden"], Tt6 = /* @__PURE__ */ new Set(["title", "style", "hidden", "lang", "dir", "translate", "class", "id", "nonce", "autofocus", "tabindex", "contenteditable", "spellcheck", "draggable", "role", "slot", "part", "name", "value", "type", "itemscope", "itemtype", "itemid", "itemprop", "itemref"]), It6 = /* @__PURE__ */ new Set(["sap", "scope", "items", "item", "template", "bind", "calc", "text", "show", "attr", "set", "trigger", "move", "sort", "detail", "each", "effect", "invalid", "confirm", "transient", "default", "persist", "sortable", "editmode"]);
72660
- function Ot5(t2) {
73007
+ var Bt5 = { E01: { slug: "foreign-dialect", behavior: "HALT" }, E02: { slug: "moustaches-in-text", behavior: "HALT" }, E04: { slug: "duplicate-declaration", behavior: "HALT" }, E05: { slug: "reserved-name", behavior: "HALT" }, E06: { slug: "global-html-name", behavior: "HALT" }, E07: { slug: "calc-cycle", behavior: "ERR" }, E08: { slug: "expression-syntax", behavior: "HALT" }, E10: { slug: "orphan-item", behavior: "HALT" }, E12: { slug: "unknown-state-key", behavior: "ERR" }, E15: { slug: "write-to-undeclared-key", behavior: "ERR" }, E16: { slug: "write-to-computed-field", behavior: "ERR" }, E17: { slug: "unresolvable-action-target", behavior: "HALT" }, E18: { slug: "paint-on-form-control", behavior: "HALT" }, E20: { slug: "bind-on-non-control", behavior: "HALT" }, E22: { slug: "format-type", behavior: "ERR" }, E24: { slug: "runtime-expression-throw", behavior: "ERR" }, E26: { slug: "circuit-breaker", behavior: "HALT" }, E30: { slug: "attr-on-bound-control", behavior: "HALT" }, E31: { slug: "password-without-transient", behavior: "HALT" }, E32: { slug: "file-bind", behavior: "HALT" }, E33: { slug: "dialog-state-open", behavior: "HALT" }, E34: { slug: "transient-persist-collision", behavior: "HALT" }, E35: { slug: "presence-state-misuse", behavior: "HALT" }, E40: { slug: "each-not-array", behavior: "ERR" }, E41: { slug: "each-bad-key", behavior: "ERR" }, E42: { slug: "each-template", behavior: "ERR" }, E43: { slug: "bind-in-each-row", behavior: "ERR" }, E50: { slug: "needs-full-sapjs", behavior: "HALT" }, W03: { slug: "unknown-colon-attribute", behavior: "WARN" }, W04: { slug: "expression-in-when", behavior: "WARN" }, W30: { slug: "nonzero-mount-writes", behavior: "WARN" }, W31: { slug: "detail-dialog-saved-open", behavior: "WARN" } }, J6 = ["disabled", "readonly", "required", "checked", "selected", "multiple", "open", "inert", "autofocus", "novalidate", "hidden"], at5 = /* @__PURE__ */ new Set(["title", "style", "hidden", "lang", "dir", "translate", "class", "id", "nonce", "autofocus", "tabindex", "contenteditable", "spellcheck", "draggable", "role", "slot", "part", "name", "value", "type", "itemscope", "itemtype", "itemid", "itemprop", "itemref"]), wt6 = /* @__PURE__ */ new Set(["sap", "scope", "items", "item", "template", "bind", "calc", "text", "show", "attr", "set", "trigger", "move", "sort", "detail", "each", "effect", "invalid", "confirm", "transient", "default", "persist", "sortable", "editmode"]);
73008
+ function yt6(t2) {
72661
73009
  if (!t2 || t2.nodeType !== 1) return "?";
72662
73010
  if (t2.id) return `${t2.tagName.toLowerCase()}#${t2.id}`;
72663
73011
  let e20 = [], r44 = t2, n3 = 0;
@@ -72666,7 +73014,7 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72666
73014
  if (r44.hasAttribute("sap")) o3 += "[sap]";
72667
73015
  else if (r44.parentElement) {
72668
73016
  let s2 = 0, a2 = 0;
72669
- for (let k5 = r44.parentElement.firstElementChild; k5; k5 = k5.nextElementSibling) k5.tagName === r44.tagName && (s2++, k5 === r44 && (a2 = s2));
73017
+ for (let g2 = r44.parentElement.firstElementChild; g2; g2 = g2.nextElementSibling) g2.tagName === r44.tagName && (s2++, g2 === r44 && (a2 = s2));
72670
73018
  s2 > 1 && (o3 += `:nth-of-type(${a2})`);
72671
73019
  }
72672
73020
  if (e20.unshift(o3), r44.hasAttribute("sap")) break;
@@ -72674,16 +73022,12 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72674
73022
  }
72675
73023
  return e20.join(" > ");
72676
73024
  }
72677
- function ve6(t2) {
72678
- let e20 = t2.toLowerCase();
72679
- return /^x-text$|^x-html$/.test(e20) ? 'use text="state.x" (Sap paints text only)' : /^x-show$|^v-show$|^v-if$/.test(e20) ? 'use show="expr" (toggles native hidden)' : /^x-model$|^v-model$/.test(e20) ? 'use bind="field"' : /^@|^x-on:|^v-on:|^on:/.test(e20) ? "use native onclick + Sap(this) (no event directive)" : /^:|^x-bind:class$|^v-bind:class$/.test(e20) ? 'use class:NAME="expr" or attr:NAME="expr"' : /^x-for$|^v-for$/.test(e20) ? 'use items="name" on the container and item template on the row' : /^x-data$/.test(e20) ? "declare state with state= / bind / items (no JS state object)" : /^x-init$/.test(e20) ? "use a <script> or onclick + Sap(this)" : /^bind:/.test(e20) ? 'use bind="field"; one-way paint is attr:NAME="expr"' : /^x-/.test(e20) || /^v-/.test(e20) ? "this is a foreign-dialect attribute; Sap has no x-/v- attributes" : null;
72680
- }
72681
- var ht6 = class {
73025
+ var K7 = class {
72682
73026
  constructor(e20) {
72683
73027
  this.appName = e20, this.errors = [], this.warnings = [], this.halted = false, this.haltReason = null;
72684
73028
  }
72685
73029
  block(e20, r44, n3 = {}) {
72686
- let o3 = (re5[e20] || {}).slug || "error", s2 = { code: e20, slug: o3, el: Ot5(r44), attr: n3.attr || null, expr: n3.expr || null, key: n3.key || null, problem: n3.problem || "", didYouMean: n3.didYouMean || null, fix: n3.fix || null, phase: n3.phase || "runtime" }, a2 = [`
73030
+ let o3 = (Bt5[e20] || {}).slug || "error", s2 = { code: e20, slug: o3, el: yt6(r44), attr: n3.attr || null, expr: n3.expr || null, key: n3.key || null, problem: n3.problem || "", didYouMean: n3.didYouMean || null, fix: n3.fix || null, phase: n3.phase || "runtime" }, a2 = [`
72687
73031
  ` + (e20[0] === "W" ? "sap \u26A0 " : "sap \u2717 ") + e20 + " " + o3];
72688
73032
  return a2.push(` at ${s2.el}${s2.attr ? ` \u2014 ${s2.attr}="${s2.expr ?? ""}"` : ""}`), s2.problem && a2.push(` problem: ${s2.problem}`), s2.didYouMean && a2.push(` did you mean: ${s2.didYouMean}`), s2.fix && a2.push(` fix: ${s2.fix}`), (e20[0] === "W" ? console.warn : console.error)(a2.join(`
72689
73033
  `)), s2;
@@ -72700,55 +73044,55 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72700
73044
  return { ok: this.errors.length === 0 && !this.halted, app: this.appName, halted: this.halted, haltReason: this.haltReason, errors: this.errors.slice(), warnings: this.warnings.slice() };
72701
73045
  }
72702
73046
  };
72703
- function ut6(t2, e20) {
73047
+ function M6(t2, e20) {
72704
73048
  t2 && t2.getAttribute("sap-error") !== e20 && t2.setAttribute("sap-error", e20);
72705
73049
  }
72706
- function Ft5(t2) {
73050
+ function Q6(t2) {
72707
73051
  t2 && t2.hasAttribute("sap-error") && t2.removeAttribute("sap-error");
72708
73052
  }
72709
- function Nt4(t2, e20) {
73053
+ function ut6(t2, e20) {
72710
73054
  let r44 = null, n3 = 3;
72711
73055
  for (let o3 of e20) {
72712
- let s2 = Nn4(t2, o3);
73056
+ let s2 = An4(t2, o3);
72713
73057
  s2 < n3 && (n3 = s2, r44 = o3);
72714
73058
  }
72715
73059
  return r44;
72716
73060
  }
72717
- function Nn4(t2, e20) {
73061
+ function An4(t2, e20) {
72718
73062
  let r44 = t2.length, n3 = e20.length, o3 = Array.from({ length: r44 + 1 }, (s2, a2) => [a2, ...new Array(n3).fill(0)]);
72719
73063
  for (let s2 = 0; s2 <= n3; s2++) o3[0][s2] = s2;
72720
73064
  for (let s2 = 1; s2 <= r44; s2++) for (let a2 = 1; a2 <= n3; a2++) o3[s2][a2] = Math.min(o3[s2 - 1][a2] + 1, o3[s2][a2 - 1] + 1, o3[s2 - 1][a2 - 1] + (t2[s2 - 1] === e20[a2 - 1] ? 0 : 1));
72721
73065
  return o3[r44][n3];
72722
73066
  }
72723
- var Ln4 = new Set(bt6), Cn3 = { readonly: "readOnly", novalidate: "noValidate" }, Rn4 = 0, xe6 = /* @__PURE__ */ new WeakMap();
72724
- function Bt5(t2, e20 = "sap") {
73067
+ var En4 = new Set(J6), vn4 = { readonly: "readOnly", novalidate: "noValidate" }, xn4 = 0, ne6 = /* @__PURE__ */ new WeakMap();
73068
+ function At5(t2, e20 = "sap") {
72725
73069
  let r44 = t2.getAttribute("data-id");
72726
73070
  if (r44) return r44;
72727
73071
  if (t2.id) return t2.id;
72728
- let n3 = xe6.get(t2);
72729
- return n3 || (n3 = `${e20}-${(Rn4++).toString(36)}`, xe6.set(t2, n3)), n3;
73072
+ let n3 = ne6.get(t2);
73073
+ return n3 || (n3 = `${e20}-${(xn4++).toString(36)}`, ne6.set(t2, n3)), n3;
72730
73074
  }
72731
- function Se6(t2, e20 = "row") {
73075
+ function re5(t2, e20 = "row") {
72732
73076
  for (; ; ) {
72733
73077
  let r44 = `${e20}-${Math.random().toString(36).slice(2, 8)}`;
72734
73078
  if (!t2.getElementById(r44) && !t2.querySelector(`[data-id="${r44}"]`)) return r44;
72735
73079
  }
72736
73080
  }
72737
- function Dn4(t2) {
73081
+ function Sn3(t2) {
72738
73082
  return t2.hasAttribute("scope") || t2.hasAttribute("items") || t2.hasAttribute("detail") || t2.hasAttribute("each");
72739
73083
  }
72740
- function Mn4(t2) {
73084
+ function kn4(t2) {
72741
73085
  return t2.tagName === "TEMPLATE" || t2.hasAttribute("sap-ignore") || t2.hasAttribute("template") || t2.hasAttribute("cms-template");
72742
73086
  }
72743
- function et6(t2, e20) {
73087
+ function O4(t2, e20) {
72744
73088
  for (let n3 = t2.firstElementChild; n3; n3 = n3.nextElementSibling) r44(n3);
72745
73089
  function r44(n3) {
72746
- if (Mn4(n3)) return;
72747
- let o3 = Dn4(n3);
73090
+ if (kn4(n3)) return;
73091
+ let o3 = Sn3(n3);
72748
73092
  if (e20(n3, o3), !o3) for (let s2 = n3.firstElementChild; s2; s2 = s2.nextElementSibling) r44(s2);
72749
73093
  }
72750
73094
  }
72751
- function Q6(t2) {
73095
+ function F5(t2) {
72752
73096
  let e20 = t2;
72753
73097
  for (; e20; ) {
72754
73098
  if (e20.hasAttribute("sap") || e20.hasAttribute("scope") || e20.hasAttribute("item") || e20.hasAttribute("detail")) return e20;
@@ -72756,14 +73100,14 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72756
73100
  }
72757
73101
  return null;
72758
73102
  }
72759
- function lt6(t2) {
73103
+ function H6(t2) {
72760
73104
  for (let e20 = t2; e20 && e20.nodeType === 1; e20 = e20.parentElement) {
72761
73105
  if (e20._sapEachRow) return e20;
72762
73106
  if (e20.hasAttribute("item") || e20.hasAttribute("sap")) return null;
72763
73107
  }
72764
73108
  return null;
72765
73109
  }
72766
- function Wt6(t2) {
73110
+ function Et6(t2) {
72767
73111
  let e20 = t2;
72768
73112
  for (; e20; ) {
72769
73113
  if (e20.hasAttribute("detail") || e20.hasAttribute("item")) return e20;
@@ -72771,7 +73115,7 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72771
73115
  }
72772
73116
  return null;
72773
73117
  }
72774
- function Lt5(t2) {
73118
+ function ct6(t2) {
72775
73119
  let e20 = t2;
72776
73120
  for (; e20; ) {
72777
73121
  if (e20.hasAttribute("detail")) return e20;
@@ -72779,58 +73123,58 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72779
73123
  }
72780
73124
  return null;
72781
73125
  }
72782
- function ft5(t2, e20) {
73126
+ function U6(t2, e20) {
72783
73127
  if (t2.hasAttribute("item") && t2.getAttribute("bind") === e20) return t2;
72784
73128
  let r44 = null;
72785
- return et6(t2, (n3) => {
73129
+ return O4(t2, (n3) => {
72786
73130
  !r44 && n3.getAttribute("bind") === e20 && (r44 = n3);
72787
73131
  }), r44;
72788
73132
  }
72789
- function gt6(t2, e20) {
73133
+ function Z7(t2, e20) {
72790
73134
  let r44 = null;
72791
- return et6(t2, (n3) => {
73135
+ return O4(t2, (n3) => {
72792
73136
  !r44 && n3.getAttribute("items") === e20 && (r44 = n3);
72793
73137
  }), r44;
72794
73138
  }
72795
- function wt6(t2, e20) {
72796
- return !t2 || t2.nodeType !== 1 || !t2.hasAttribute("item") ? false : ft5(t2, e20) || gt6(t2, e20) ? true : V7(t2.getAttribute("state") || "").some((r44) => r44.name === e20);
73139
+ function tt6(t2, e20) {
73140
+ return !t2 || t2.nodeType !== 1 || !t2.hasAttribute("item") ? false : U6(t2, e20) || Z7(t2, e20) ? true : C5(t2.getAttribute("state") || "").some((r44) => r44.name === e20);
72797
73141
  }
72798
- function ke6(t2) {
73142
+ function oe6(t2) {
72799
73143
  let e20 = t2 && t2.$el;
72800
73144
  return e20 && e20.nodeType === 1 && e20.isConnected && e20.hasAttribute("item") ? e20 : null;
72801
73145
  }
72802
- function qt5(t2) {
73146
+ function vt5(t2) {
72803
73147
  return !!t2.closest("form[trigger-add]");
72804
73148
  }
72805
- function rt6(t2) {
73149
+ function W6(t2) {
72806
73150
  let e20 = [];
72807
73151
  for (let r44 = t2.firstElementChild; r44; r44 = r44.nextElementSibling) r44.hasAttribute("item") && !r44.hasAttribute("template") && !r44.hasAttribute("cms-template") && e20.push(r44);
72808
73152
  return e20;
72809
73153
  }
72810
- function oe6(t2, e20) {
73154
+ function Wt6(t2, e20) {
72811
73155
  if (!t2 || !e20) return null;
72812
73156
  let r44 = [...t2.querySelectorAll(`template[items="${e20}"]`)].find((o3) => o3.closest("[sap]") === t2), n3 = r44 && r44.content.firstElementChild;
72813
73157
  return n3 && n3.hasAttribute("item") ? n3 : null;
72814
73158
  }
72815
- function Vt5(t2) {
73159
+ function xt6(t2) {
72816
73160
  for (let e20 = t2.firstElementChild; e20; e20 = e20.nextElementSibling) if (e20.hasAttribute("item") && e20.hasAttribute("template")) return e20;
72817
- return oe6(t2.closest("[sap]"), t2.getAttribute("items"));
73161
+ return Wt6(t2.closest("[sap]"), t2.getAttribute("items"));
72818
73162
  }
72819
- function V7(t2) {
73163
+ function C5(t2) {
72820
73164
  let e20 = [];
72821
73165
  if (!t2) return e20;
72822
73166
  for (let r44 of t2.trim().split(/\s+/)) {
72823
73167
  if (!r44) continue;
72824
73168
  let n3 = r44, o3, s2 = n3.indexOf("=");
72825
73169
  s2 >= 0 && (o3 = n3.slice(s2 + 1), n3 = n3.slice(0, s2));
72826
- let a2 = n3.split(":"), k5 = a2[0], $6 = "string", A4 = false;
72827
- for (let N16 of a2.slice(1)) N16 === "num" ? $6 = "num" : N16 === "bool" ? $6 = "bool" : N16 === "presence" ? $6 = "presence" : N16 === "transient" && (A4 = true);
72828
- let l2 = k5, w4 = l2.startsWith("data-") && l2.length > 5 ? l2.slice(5).replace(/-([a-z])/g, (N16, P7) => P7.toUpperCase()) : l2;
72829
- e20.push({ name: w4, attr: l2, type: $6, default: o3, transient: A4 });
73170
+ let a2 = n3.split(":"), g2 = a2[0], b4 = "string", d = false;
73171
+ for (let S4 of a2.slice(1)) S4 === "num" ? b4 = "num" : S4 === "bool" ? b4 = "bool" : S4 === "presence" ? b4 = "presence" : S4 === "transient" && (d = true);
73172
+ let u3 = g2, E4 = u3.startsWith("data-") && u3.length > 5 ? u3.slice(5).replace(/-([a-z])/g, (S4, k5) => k5.toUpperCase()) : u3;
73173
+ e20.push({ name: E4, attr: u3, type: b4, default: o3, transient: d });
72830
73174
  }
72831
73175
  return e20;
72832
73176
  }
72833
- function ct6(t2, e20) {
73177
+ function z5(t2, e20) {
72834
73178
  if (e20 === "num") {
72835
73179
  if (t2 == null || t2 === "") return 0;
72836
73180
  let r44 = Number(t2);
@@ -72838,119 +73182,119 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72838
73182
  }
72839
73183
  return e20 === "bool" ? t2 === "true" || t2 === "" || t2 === "1" : t2 ?? "";
72840
73184
  }
72841
- function ie6(t2, e20) {
73185
+ function qt5(t2, e20) {
72842
73186
  return e20 === "bool" ? t2 ? "true" : "false" : t2 == null ? "" : String(t2);
72843
73187
  }
72844
- function se6(t2, e20) {
72845
- return Ln4.has(e20) && typeof t2[Cn3[e20] || e20] == "boolean";
73188
+ function jt6(t2, e20) {
73189
+ return En4.has(e20) && typeof t2[vn4[e20] || e20] == "boolean";
72846
73190
  }
72847
- function yt6(t2, e20) {
72848
- return e20.type === "presence" || e20.type !== "num" && se6(t2, e20.attr || e20.name);
73191
+ function G5(t2, e20) {
73192
+ return e20.type === "presence" || e20.type !== "num" && jt6(t2, e20.attr || e20.name);
72849
73193
  }
72850
- function Ct6(t2) {
73194
+ function ft5(t2) {
72851
73195
  return t2.default != null ? t2.default : t2.type === "num" ? "0" : t2.type === "bool" ? "false" : "";
72852
73196
  }
72853
- function $e6(t2, e20) {
73197
+ function ie6(t2, e20) {
72854
73198
  let r44 = e20.attr || e20.name;
72855
- if (yt6(t2, e20)) return t2.hasAttribute(r44);
73199
+ if (G5(t2, e20)) return t2.hasAttribute(r44);
72856
73200
  let n3 = t2.getAttribute(r44);
72857
- return ct6(n3 ?? Ct6(e20), e20.type);
73201
+ return z5(n3 ?? ft5(e20), e20.type);
72858
73202
  }
72859
- function _e6(t2, e20) {
72860
- return yt6(t2, e20) ? e20.default != null ? ct6(e20.default, "bool") : false : ct6(Ct6(e20), e20.type);
73203
+ function se6(t2, e20) {
73204
+ return G5(t2, e20) ? e20.default != null ? z5(e20.default, "bool") : false : z5(ft5(e20), e20.type);
72861
73205
  }
72862
- function Rt6(t2, e20, r44) {
73206
+ function lt6(t2, e20, r44) {
72863
73207
  let n3 = e20.attr || e20.name;
72864
- if (yt6(t2, e20)) {
73208
+ if (G5(t2, e20)) {
72865
73209
  r44 ? t2.hasAttribute(n3) || t2.setAttribute(n3, "") : t2.hasAttribute(n3) && t2.removeAttribute(n3);
72866
73210
  return;
72867
73211
  }
72868
- t2.setAttribute(n3, ie6(r44, e20.type));
73212
+ t2.setAttribute(n3, qt5(r44, e20.type));
72869
73213
  }
72870
- function zt5(t2, e20) {
73214
+ function St6(t2, e20) {
72871
73215
  let r44 = e20.attr || e20.name, n3 = t2._sapTransient || (t2._sapTransient = {});
72872
73216
  if (!(e20.name in n3)) {
72873
73217
  let o3 = t2.getAttribute(r44);
72874
- o3 == null && (o3 = Ct6(e20)), n3[e20.name] = ct6(o3, e20.type);
73218
+ o3 == null && (o3 = ft5(e20)), n3[e20.name] = z5(o3, e20.type);
72875
73219
  }
72876
73220
  return t2.hasAttribute(r44) && t2.removeAttribute(r44), n3[e20.name];
72877
73221
  }
72878
- function Dt6(t2, e20, r44) {
73222
+ function dt6(t2, e20, r44) {
72879
73223
  let n3 = e20.attr || e20.name;
72880
73224
  (t2._sapTransient || (t2._sapTransient = {}))[e20.name] = r44, t2.hasAttribute(n3) && t2.removeAttribute(n3);
72881
73225
  }
72882
- function Mt6(t2, e20, r44) {
73226
+ function pt6(t2, e20, r44) {
72883
73227
  let n3 = String(r44).split("."), o3 = n3[n3.length - 1];
72884
73228
  if (n3.length === 1) {
72885
- let k5 = Pn4(e20, o3);
72886
- return k5 || (t2.getAttribute("items") === o3 ? t2 : t2.querySelector(`[items="${o3}"]:not(template)`));
73229
+ let g2 = $n2(e20, o3);
73230
+ return g2 || (t2.getAttribute("items") === o3 ? t2 : t2.querySelector(`[items="${o3}"]:not(template)`));
72887
73231
  }
72888
- let s2 = n3[n3.length - 2], a2 = [...t2.querySelectorAll(`[scope="${s2}"]`)].find((k5) => gt6(k5, o3));
72889
- return a2 ? gt6(a2, o3) : null;
73232
+ let s2 = n3[n3.length - 2], a2 = [...t2.querySelectorAll(`[scope="${s2}"]`)].find((g2) => Z7(g2, o3));
73233
+ return a2 ? Z7(a2, o3) : null;
72890
73234
  }
72891
- function Pn4(t2, e20) {
72892
- let r44 = Q6(t2);
73235
+ function $n2(t2, e20) {
73236
+ let r44 = F5(t2);
72893
73237
  for (; r44; ) {
72894
73238
  if (r44.getAttribute("items") === e20) return r44;
72895
- let n3 = gt6(r44, e20);
73239
+ let n3 = Z7(r44, e20);
72896
73240
  if (n3) return n3;
72897
- r44 = Q6(r44.parentElement);
73241
+ r44 = F5(r44.parentElement);
72898
73242
  }
72899
73243
  return null;
72900
73244
  }
72901
- function Z7(t2) {
73245
+ function P7(t2) {
72902
73246
  if (typeof t2 == "number") return t2;
72903
73247
  if (t2 == null || t2 === "") return 0;
72904
73248
  let e20 = Number(typeof t2 == "string" ? t2.replace(/[$,%\s]/g, "") : t2);
72905
73249
  return Number.isNaN(e20) ? 0 : e20;
72906
73250
  }
72907
- function Ht5(t2, e20) {
73251
+ function kt6(t2, e20) {
72908
73252
  return Array.isArray(t2) ? e20 == null ? t2 : t2.map((r44) => typeof e20 == "function" ? e20(r44) : r44?.[e20]) : [];
72909
73253
  }
72910
- function ae6(t2, e20) {
72911
- return Ht5(t2, e20).reduce((r44, n3) => r44 + Z7(n3), 0);
73254
+ function Vt5(t2, e20) {
73255
+ return kt6(t2, e20).reduce((r44, n3) => r44 + P7(n3), 0);
72912
73256
  }
72913
- function Te6(t2, e20) {
73257
+ function ae6(t2, e20) {
72914
73258
  return Array.isArray(t2) ? e20 == null ? t2.length : t2.reduce((r44, n3) => r44 + (e20(n3) ? 1 : 0), 0) : 0;
72915
73259
  }
72916
- function Ne6(t2, e20) {
72917
- let r44 = Ht5(t2, e20);
72918
- return r44.length ? ae6(t2, e20) / r44.length : 0;
73260
+ function ue5(t2, e20) {
73261
+ let r44 = kt6(t2, e20);
73262
+ return r44.length ? Vt5(t2, e20) / r44.length : 0;
72919
73263
  }
72920
- function Le6(t2, e20) {
72921
- let r44 = Ht5(t2, e20).filter((n3) => n3 != null && n3 !== "");
73264
+ function ce6(t2, e20) {
73265
+ let r44 = kt6(t2, e20).filter((n3) => n3 != null && n3 !== "");
72922
73266
  return r44.length ? r44.every((n3) => typeof n3 == "number" || !Number.isNaN(Number(n3))) ? Math.min(...r44.map(Number)) : r44.reduce((n3, o3) => String(n3) <= String(o3) ? n3 : o3) : 0;
72923
73267
  }
72924
- function Ce6(t2, e20) {
72925
- let r44 = Ht5(t2, e20).filter((n3) => n3 != null && n3 !== "");
73268
+ function fe5(t2, e20) {
73269
+ let r44 = kt6(t2, e20).filter((n3) => n3 != null && n3 !== "");
72926
73270
  return r44.length ? r44.every((n3) => typeof n3 == "number" || !Number.isNaN(Number(n3))) ? Math.max(...r44.map(Number)) : r44.reduce((n3, o3) => String(n3) >= String(o3) ? n3 : o3) : 0;
72927
73271
  }
72928
- function Re6(t2, e20, r44) {
72929
- let n3 = Z7(t2) === 1 ? e20 : r44 ?? e20 + "s";
73272
+ function le6(t2, e20, r44) {
73273
+ let n3 = P7(t2) === 1 ? e20 : r44 ?? e20 + "s";
72930
73274
  return `${t2} ${n3}`;
72931
73275
  }
72932
- function De5(t2, e20) {
73276
+ function de6(t2, e20) {
72933
73277
  let r44 = new Date(t2), n3 = new Date(e20);
72934
73278
  return Number.isNaN(+r44) || Number.isNaN(+n3) ? 0 : Math.round((n3 - r44) / 864e5);
72935
73279
  }
72936
- function nt6(t2) {
73280
+ function B5(t2) {
72937
73281
  return typeof t2 == "number" ? t2 : Number(t2);
72938
73282
  }
72939
- var At5 = { usd: (t2) => "$" + nt6(t2).toLocaleString("en-US", { maximumFractionDigits: 0 }), usd2: (t2) => "$" + nt6(t2).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }), pct: (t2) => Math.round(nt6(t2)) + "%", pct1: (t2) => nt6(t2).toFixed(1) + "%", int: (t2) => Math.round(nt6(t2)).toLocaleString("en-US"), num: (t2) => nt6(t2).toLocaleString("en-US"), num2: (t2) => nt6(t2).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }), compact: (t2) => nt6(t2).toLocaleString("en-US", { notation: "compact" }), date: (t2) => {
73283
+ var et6 = { usd: (t2) => "$" + B5(t2).toLocaleString("en-US", { maximumFractionDigits: 0 }), usd2: (t2) => "$" + B5(t2).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }), pct: (t2) => Math.round(B5(t2)) + "%", pct1: (t2) => B5(t2).toFixed(1) + "%", int: (t2) => Math.round(B5(t2)).toLocaleString("en-US"), num: (t2) => B5(t2).toLocaleString("en-US"), num2: (t2) => B5(t2).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }), compact: (t2) => B5(t2).toLocaleString("en-US", { notation: "compact" }), date: (t2) => {
72940
73284
  let e20 = new Date(t2);
72941
73285
  return Number.isNaN(+e20) ? String(t2) : e20.toLocaleDateString("en-US");
72942
73286
  }, clock: (t2) => {
72943
- let e20 = nt6(t2), r44 = Math.floor(e20 / 100), n3 = r44 % 10, o3 = Math.floor(r44 / 10) % 60;
73287
+ let e20 = B5(t2), r44 = Math.floor(e20 / 100), n3 = r44 % 10, o3 = Math.floor(r44 / 10) % 60;
72944
73288
  return `${Math.floor(r44 / 600)}:${String(o3).padStart(2, "0")}.${n3}`;
72945
- } }, In4 = /* @__PURE__ */ new Set(["usd", "usd2", "pct", "pct1", "int", "num", "num2", "compact", "clock"]);
72946
- function Me6(t2, e20) {
73289
+ } }, _n4 = /* @__PURE__ */ new Set(["usd", "usd2", "pct", "pct1", "int", "num", "num2", "compact", "clock"]);
73290
+ function pe5(t2, e20) {
72947
73291
  if (!t2) return e20 == null ? "" : String(e20);
72948
- let r44 = At5[t2];
73292
+ let r44 = et6[t2];
72949
73293
  if (typeof r44 != "function") {
72950
73294
  let n3 = new Error(`unknown format "${t2}"`);
72951
73295
  throw n3.sapCode = "E22", n3;
72952
73296
  }
72953
- if (In4.has(t2)) {
73297
+ if (_n4.has(t2)) {
72954
73298
  let n3 = typeof e20 == "number" ? e20 : Number(e20);
72955
73299
  if (!Number.isFinite(n3)) {
72956
73300
  let o3 = new Error(`format "${t2}" received ${typeof e20 == "string" ? `"${e20}"` : e20}`);
@@ -72959,52 +73303,52 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
72959
73303
  }
72960
73304
  return r44(e20);
72961
73305
  }
72962
- var On4 = ["state", "item", "el", "root", "fmt", "num", "sum", "count", "avg", "min", "max", "plural", "days"], jt6 = /* @__PURE__ */ new Map(), Pe6 = /\bstate\.([a-z][a-z0-9_]*)/g, Ie6 = /\bitem\.([a-z][a-z0-9_]*)/g;
72963
- function Fn4(t2) {
73306
+ var Tn3 = ["state", "item", "el", "root", "fmt", "num", "sum", "count", "avg", "min", "max", "plural", "days"], $t6 = /* @__PURE__ */ new Map(), me6 = /\bstate\.([a-z][a-z0-9_]*)/g, he6 = /\bitem\.([a-z][a-z0-9_]*)/g;
73307
+ function Nn4(t2) {
72964
73308
  let e20 = /* @__PURE__ */ new Set(), r44 = /* @__PURE__ */ new Set(), n3;
72965
- for (Pe6.lastIndex = 0; n3 = Pe6.exec(t2); ) e20.add(n3[1]);
72966
- for (Ie6.lastIndex = 0; n3 = Ie6.exec(t2); ) r44.add(n3[1]);
73309
+ for (me6.lastIndex = 0; n3 = me6.exec(t2); ) e20.add(n3[1]);
73310
+ for (he6.lastIndex = 0; n3 = he6.exec(t2); ) r44.add(n3[1]);
72967
73311
  return { state: e20, item: r44 };
72968
73312
  }
72969
- function q7(t2, e20 = false) {
72970
- let r44 = (e20 ? "!" : "") + t2, n3 = jt6.get(r44);
73313
+ function N16(t2, e20 = false) {
73314
+ let r44 = (e20 ? "!" : "") + t2, n3 = $t6.get(r44);
72971
73315
  if (n3) return n3;
72972
- jt6.size > 512 && jt6.clear();
73316
+ $t6.size > 512 && $t6.clear();
72973
73317
  try {
72974
73318
  let o3 = e20 ? `"use strict";
72975
73319
  ${t2}` : `"use strict"; return (${t2});`;
72976
- n3 = { fn: new Function(...On4, o3), src: t2, statement: e20, deps: Fn4(t2), error: null };
73320
+ n3 = { fn: new Function(...Tn3, o3), src: t2, statement: e20, deps: Nn4(t2), error: null };
72977
73321
  } catch (o3) {
72978
73322
  n3 = { fn: null, src: t2, statement: e20, deps: { state: /* @__PURE__ */ new Set(), item: /* @__PURE__ */ new Set() }, error: o3 };
72979
73323
  }
72980
- return jt6.set(r44, n3), n3;
73324
+ return $t6.set(r44, n3), n3;
72981
73325
  }
72982
- function Et6(t2, e20) {
72983
- return dt6(t2, e20.state, e20.item, e20.el ?? null, e20.root);
73326
+ function Y5(t2, e20) {
73327
+ return I5(t2, e20.state, e20.item, e20.el ?? null, e20.root);
72984
73328
  }
72985
- function dt6(t2, e20, r44, n3, o3) {
73329
+ function I5(t2, e20, r44, n3, o3) {
72986
73330
  if (t2.error) throw t2.error;
72987
- return t2.fn(e20, r44, n3, o3, At5, Z7, ae6, Te6, Ne6, Le6, Ce6, Re6, De5);
73331
+ return t2.fn(e20, r44, n3, o3, et6, P7, Vt5, ae6, ue5, ce6, fe5, le6, de6);
72988
73332
  }
72989
- function Oe6(t2) {
73333
+ function be5(t2) {
72990
73334
  let e20 = /* @__PURE__ */ new Map();
72991
73335
  for (let a2 of t2) e20.set(a2.name, a2);
72992
73336
  let r44 = [], n3 = /* @__PURE__ */ new Map(), o3 = [];
72993
73337
  function s2(a2) {
72994
- let k5 = n3.get(a2.name);
72995
- if (k5 !== 1) {
72996
- if (k5 === 0) {
72997
- let $6 = [...o3.slice(o3.indexOf(a2.name)), a2.name].join(" -> "), A4 = new Error(`calc: cycle: ${$6}`);
72998
- throw A4.sapCode = "E07", A4.cycle = $6, A4;
73338
+ let g2 = n3.get(a2.name);
73339
+ if (g2 !== 1) {
73340
+ if (g2 === 0) {
73341
+ let b4 = [...o3.slice(o3.indexOf(a2.name)), a2.name].join(" -> "), d = new Error(`calc: cycle: ${b4}`);
73342
+ throw d.sapCode = "E07", d.cycle = b4, d;
72999
73343
  }
73000
73344
  n3.set(a2.name, 0), o3.push(a2.name);
73001
- for (let $6 of a2.entry.deps.state) {
73002
- let A4 = e20.get($6);
73003
- A4 && A4 !== a2 && s2(A4);
73345
+ for (let b4 of a2.entry.deps.state) {
73346
+ let d = e20.get(b4);
73347
+ d && d !== a2 && s2(d);
73004
73348
  }
73005
- for (let $6 of a2.entry.deps.item) {
73006
- let A4 = e20.get($6);
73007
- A4 && A4 !== a2 && s2(A4);
73349
+ for (let b4 of a2.entry.deps.item) {
73350
+ let d = e20.get(b4);
73351
+ d && d !== a2 && s2(d);
73008
73352
  }
73009
73353
  o3.pop(), n3.set(a2.name, 1), r44.push(a2);
73010
73354
  }
@@ -73012,42 +73356,42 @@ ${t2}` : `"use strict"; return (${t2});`;
73012
73356
  for (let a2 of t2) s2(a2);
73013
73357
  return r44;
73014
73358
  }
73015
- var Pt5 = 0, pt6 = null, Be6 = true, Gt5 = false;
73016
- function We6() {
73017
- Pt5++;
73359
+ var mt6 = {}, X6 = null, we6 = true, Tt6 = false;
73360
+ function ye6() {
73361
+ mt6 = {};
73018
73362
  }
73019
- function qe6(t2) {
73020
- let e20 = Gt5;
73021
- return pt6 ? ce6(pt6.takeRecords()) : Be6 && Bn4(), Gt5 = !!pt6 && t2.getRootNode() === document, e20;
73363
+ function Ae6(t2) {
73364
+ let e20 = Tt6;
73365
+ return X6 ? zt5(X6.takeRecords()) : we6 && Ln4(), Tt6 = !!X6 && t2.getRootNode() === document, e20;
73022
73366
  }
73023
- function Ve5(t2) {
73024
- Gt5 = t2;
73367
+ function Ee6(t2) {
73368
+ Tt6 = t2;
73025
73369
  }
73026
- function ue5() {
73027
- pt6 && ce6(pt6.takeRecords());
73370
+ function Nt4() {
73371
+ X6 && zt5(X6.takeRecords());
73028
73372
  }
73029
- function Bn4() {
73373
+ function Ln4() {
73030
73374
  if (typeof document > "u" || typeof MutationObserver != "function") {
73031
- Be6 = false;
73375
+ we6 = false;
73032
73376
  return;
73033
73377
  }
73034
- pt6 = new MutationObserver(ce6), pt6.observe(document, { attributes: true, childList: true, subtree: true });
73378
+ X6 = new MutationObserver(zt5), X6.observe(document, { attributes: true, childList: true, subtree: true });
73035
73379
  }
73036
- function ce6(t2) {
73380
+ function zt5(t2) {
73037
73381
  for (let e20 of t2) if (e20.type === "attributes") e20.target._sapPlan && (e20.target._sapPlan = null);
73038
- else for (let r44 of e20.addedNodes) r44.nodeType === 1 && ze6(r44);
73382
+ else for (let r44 of e20.addedNodes) r44.nodeType === 1 && ve6(r44);
73039
73383
  }
73040
- function ze6(t2) {
73384
+ function ve6(t2) {
73041
73385
  t2._sapPlan && (t2._sapPlan = null);
73042
- for (let e20 = t2.firstElementChild; e20; e20 = e20.nextElementSibling) ze6(e20);
73386
+ for (let e20 = t2.firstElementChild; e20; e20 = e20.nextElementSibling) ve6(e20);
73043
73387
  }
73044
- function vt5(t2) {
73045
- if (!Gt5) return Fe6(t2);
73388
+ function q7(t2) {
73389
+ if (!Tt6) return ge6(t2);
73046
73390
  let e20 = t2._sapPlan;
73047
- return e20 && e20.gen === Pt5 ? e20 : t2._sapPlan = Fe6(t2);
73391
+ return e20 && e20.gen === mt6 ? e20 : t2._sapPlan = ge6(t2);
73048
73392
  }
73049
- function Fe6(t2) {
73050
- let e20 = { gen: Pt5, inert: t2.tagName === "TEMPLATE", template: false, item: false, scope: false, items: false, detail: false, each: false, boundary: null, bind: null, transient: false, decls: null, calcs: null, paints: null, effects: null, invalids: null };
73393
+ function ge6(t2) {
73394
+ let e20 = { gen: mt6, inert: t2.tagName === "TEMPLATE", template: false, item: false, scope: false, items: false, detail: false, each: false, boundary: null, bind: null, transient: false, decls: null, calcs: null, paints: null, effects: null, invalids: null };
73051
73395
  for (let r44 of t2.attributes) {
73052
73396
  let n3 = r44.name, o3 = r44.value, s2 = n3.indexOf(":");
73053
73397
  if (s2 < 0) {
@@ -73083,68 +73427,68 @@ ${t2}` : `"use strict"; return (${t2});`;
73083
73427
  e20.transient = true;
73084
73428
  break;
73085
73429
  case "state":
73086
- e20.decls = V7(o3);
73430
+ e20.decls = C5(o3);
73087
73431
  break;
73088
73432
  case "text":
73089
- (e20.paints || (e20.paints = [])).push({ kind: "text", fmt: null, entry: q7(o3) });
73433
+ (e20.paints || (e20.paints = [])).push({ kind: "text", fmt: null, entry: N16(o3) });
73090
73434
  break;
73091
73435
  case "show":
73092
- (e20.paints || (e20.paints = [])).push({ kind: "show", entry: q7(o3) });
73436
+ (e20.paints || (e20.paints = [])).push({ kind: "show", entry: N16(o3) });
73093
73437
  break;
73094
73438
  case "effect":
73095
- (e20.effects || (e20.effects = [])).push({ entry: q7(o3, true) });
73439
+ (e20.effects || (e20.effects = [])).push({ entry: N16(o3, true) });
73096
73440
  break;
73097
73441
  case "invalid":
73098
- (e20.invalids || (e20.invalids = [])).push({ entry: q7(o3) });
73442
+ (e20.invalids || (e20.invalids = [])).push({ entry: N16(o3) });
73099
73443
  break;
73100
73444
  }
73101
73445
  continue;
73102
73446
  }
73103
- let a2 = n3.slice(0, s2), k5 = n3.slice(s2 + 1);
73447
+ let a2 = n3.slice(0, s2), g2 = n3.slice(s2 + 1);
73104
73448
  switch (a2) {
73105
73449
  case "calc":
73106
- (e20.calcs || (e20.calcs = [])).push({ name: k5, entry: q7(o3) });
73450
+ (e20.calcs || (e20.calcs = [])).push({ name: g2, entry: N16(o3) });
73107
73451
  break;
73108
73452
  case "text":
73109
- (e20.paints || (e20.paints = [])).push({ kind: "text", fmt: k5, entry: q7(o3) });
73453
+ (e20.paints || (e20.paints = [])).push({ kind: "text", fmt: g2, entry: N16(o3) });
73110
73454
  break;
73111
73455
  case "attr":
73112
- (e20.paints || (e20.paints = [])).push({ kind: "attr", arg: k5, entry: q7(o3) });
73456
+ (e20.paints || (e20.paints = [])).push({ kind: "attr", arg: g2, entry: N16(o3) });
73113
73457
  break;
73114
73458
  case "class":
73115
- (e20.paints || (e20.paints = [])).push({ kind: "class", arg: k5, entry: q7(o3) });
73459
+ (e20.paints || (e20.paints = [])).push({ kind: "class", arg: g2, entry: N16(o3) });
73116
73460
  break;
73117
73461
  case "css":
73118
- (e20.paints || (e20.paints = [])).push({ kind: "css", arg: k5, entry: q7(o3) });
73462
+ (e20.paints || (e20.paints = [])).push({ kind: "css", arg: g2, entry: N16(o3) });
73119
73463
  break;
73120
73464
  case "show-when":
73121
73465
  case "option":
73122
- (e20.paints || (e20.paints = [])).push({ kind: "when", match: "show", field: k5, values: o3.split("|") });
73466
+ (e20.paints || (e20.paints = [])).push({ kind: "when", match: "show", field: g2, values: o3.split("|") });
73123
73467
  break;
73124
73468
  case "hide-when":
73125
- (e20.paints || (e20.paints = [])).push({ kind: "when", match: "hide", field: k5, values: o3.split("|") });
73469
+ (e20.paints || (e20.paints = [])).push({ kind: "when", match: "hide", field: g2, values: o3.split("|") });
73126
73470
  break;
73127
73471
  case "option-not":
73128
- (e20.paints || (e20.paints = [])).push({ kind: "when", match: "show-not", field: k5, values: o3.split("|") });
73472
+ (e20.paints || (e20.paints = [])).push({ kind: "when", match: "show-not", field: g2, values: o3.split("|") });
73129
73473
  break;
73130
73474
  }
73131
73475
  }
73132
- return e20.boundary = e20.scope ? "scope" : e20.items ? "items" : e20.detail ? "detail" : e20.each ? "each" : null, qn4(e20) ? Wn3() : e20;
73476
+ return e20.boundary = e20.scope ? "scope" : e20.items ? "items" : e20.detail ? "detail" : e20.each ? "each" : null, Rn4(e20) ? Cn3() : e20;
73133
73477
  }
73134
- var Ut5 = null;
73135
- function Wn3() {
73136
- return (!Ut5 || Ut5.gen !== Pt5) && (Ut5 = Object.freeze({ gen: Pt5, inert: false, template: false, item: false, scope: false, items: false, detail: false, each: false, boundary: null, bind: null, transient: false, decls: null, calcs: null, paints: null, effects: null, invalids: null })), Ut5;
73478
+ var _t5 = null;
73479
+ function Cn3() {
73480
+ return (!_t5 || _t5.gen !== mt6) && (_t5 = Object.freeze({ gen: mt6, inert: false, template: false, item: false, scope: false, items: false, detail: false, each: false, boundary: null, bind: null, transient: false, decls: null, calcs: null, paints: null, effects: null, invalids: null })), _t5;
73137
73481
  }
73138
- function qn4(t2) {
73482
+ function Rn4(t2) {
73139
73483
  return !t2.inert && !t2.item && t2.boundary === null && t2.bind === null && !t2.transient && !t2.decls && !t2.calcs && !t2.paints && !t2.effects && !t2.invalids;
73140
73484
  }
73141
- function He6(t2) {
73485
+ function xe6(t2) {
73142
73486
  return (t2.getAttribute("type") || "text").toLowerCase();
73143
73487
  }
73144
- function xt6(t2) {
73488
+ function nt6(t2) {
73145
73489
  let e20 = t2.tagName;
73146
73490
  if (e20 === "INPUT") {
73147
- let r44 = He6(t2);
73491
+ let r44 = xe6(t2);
73148
73492
  r44 === "checkbox" || r44 === "radio" ? t2.checked ? t2.setAttribute("checked", "") : t2.removeAttribute("checked") : t2.setAttribute("value", t2.value);
73149
73493
  return;
73150
73494
  }
@@ -73157,10 +73501,10 @@ ${t2}` : `"use strict"; return (${t2});`;
73157
73501
  for (let n3 = 0; n3 < r44.length; n3++) r44[n3].selected ? r44[n3].setAttribute("selected", "") : r44[n3].removeAttribute("selected");
73158
73502
  }
73159
73503
  }
73160
- function je6(t2, e20 = t2) {
73504
+ function Se6(t2, e20 = t2) {
73161
73505
  let r44 = t2.tagName;
73162
73506
  if (r44 === "INPUT") {
73163
- let n3 = He6(t2);
73507
+ let n3 = xe6(t2);
73164
73508
  n3 === "checkbox" || n3 === "radio" ? e20.checked ? t2.hasAttribute("checked") || t2.setAttribute("checked", "") : t2.removeAttribute("checked") : e20.value !== (t2.getAttribute("value") ?? "") && t2.setAttribute("value", e20.value);
73165
73509
  return;
73166
73510
  }
@@ -73176,20 +73520,20 @@ ${t2}` : `"use strict"; return (${t2});`;
73176
73520
  for (let s2 = 0; s2 < n3.length; s2++) o3[s2] && o3[s2].selected ? n3[s2].hasAttribute("selected") || n3[s2].setAttribute("selected", "") : n3[s2].removeAttribute("selected");
73177
73521
  }
73178
73522
  }
73179
- function Yt5(t2) {
73523
+ function Lt5(t2) {
73180
73524
  t2.tagName !== "TEXTAREA" || !t2.hasAttribute("data-value") || t2 !== t2.ownerDocument.activeElement && (t2.textContent = t2.getAttribute("data-value"), t2.removeAttribute("data-value"));
73181
73525
  }
73182
- function X6(t2) {
73526
+ function L7(t2) {
73183
73527
  if (typeof window > "u") return null;
73184
73528
  let e20 = window.clay, r44 = window.hyperclay;
73185
73529
  return t2 === "consent" ? e20?.confirm || r44?.consent || null : e20?.[t2] || r44?.[t2] || null;
73186
73530
  }
73187
- function Ue6() {
73188
- let t2 = X6("visitorDrafts");
73531
+ function ke6() {
73532
+ let t2 = L7("visitorDrafts");
73189
73533
  return !!(t2 && typeof t2.restored == "function" && t2.restored()?.restored);
73190
73534
  }
73191
- var le6 = ["clay:mutation-ready", "hyperclay:mutation-ready"], Vn4 = ["clay:sync-applied", "hyperclay:livesync-applied"], zn4 = ["clay:ready", "hyperclay:ready"], Hn3 = ["clay:route"];
73192
- function St6(t2, e20, r44) {
73535
+ var Ht5 = ["clay:mutation-ready", "hyperclay:mutation-ready"], Dn4 = ["clay:sync-applied", "hyperclay:livesync-applied"], Fn4 = ["clay:ready", "hyperclay:ready"], Pn4 = ["clay:route"];
73536
+ function rt6(t2, e20, r44) {
73193
73537
  let n3 = null, o3 = (s2) => {
73194
73538
  n3 !== null && n3 !== s2.type || (n3 = s2.type, queueMicrotask(() => {
73195
73539
  n3 = null;
@@ -73200,53 +73544,54 @@ ${t2}` : `"use strict"; return (${t2});`;
73200
73544
  for (let s2 of e20) t2.removeEventListener(s2, o3);
73201
73545
  };
73202
73546
  }
73203
- function Ge6(t2) {
73547
+ function $e6(t2) {
73204
73548
  let e20 = typeof window < "u" && window.clay && window.clay.ready;
73205
73549
  e20 && typeof e20.then == "function" ? e20.then(() => t2(), () => t2()) : t2();
73206
73550
  }
73207
- function Xt5(t2) {
73208
- let e20 = X6("region");
73551
+ function Ct6(t2) {
73552
+ let e20 = L7("region");
73209
73553
  return !e20 || typeof e20.resolveRegionPolicy != "function" || typeof e20.skipForPolicy != "function" ? false : e20.skipForPolicy(e20.resolveRegionPolicy(t2), void 0, ["no-save", "freeze"]);
73210
73554
  }
73211
- function Ye6() {
73212
- let t2 = X6("consent");
73555
+ function _e6() {
73556
+ let t2 = L7("consent");
73213
73557
  return typeof t2 == "function" ? t2 : null;
73214
73558
  }
73215
- function Xe6(t2, e20) {
73559
+ function Te6(t2, e20) {
73216
73560
  if (typeof e20 != "function") throw new Error("Sap.batch(label, fn): fn must be a function");
73217
- let r44 = X6("undo");
73561
+ let r44 = L7("undo");
73218
73562
  r44 && r44.flush && r44.flush();
73219
73563
  let n3 = e20();
73220
73564
  if (n3 && typeof n3.then == "function") throw new Error("Sap.batch fn must be synchronous (it returned a promise)");
73221
73565
  return r44 && r44.commitCaptured && r44.commitCaptured(t2), n3;
73222
73566
  }
73223
- function Ke6(t2) {
73567
+ function Ne6(t2) {
73224
73568
  if (typeof window > "u" || typeof document > "u") return;
73225
73569
  let e20 = () => {
73226
- let s2 = false;
73227
- for (let a2 of t2.apps()) a2.root.isConnected ? t2.runNow(a2, "platform") : s2 = true;
73228
- s2 && (t2.pruneDisconnected(), t2.remountIfPresent());
73570
+ let d = false;
73571
+ for (let u3 of t2.apps()) u3.root.isConnected ? t2.runNow(u3, "platform") : d = true;
73572
+ d && t2.pruneDisconnected(), t2.remountIfPresent();
73573
+ }, r44 = L7("derived"), n3 = r44 && typeof r44.register == "function" ? r44.register(e20) : null, o3 = typeof n3 == "function" ? null : rt6(document, Dn4, e20), s2 = rt6(document, Pn4, e20), a2 = false, g2 = () => {
73574
+ }, b4 = () => {
73575
+ if (a2) return true;
73576
+ let d = L7("undo");
73577
+ if (!d || typeof d.on != "function") return false;
73578
+ let u3 = d.on("undo", e20);
73579
+ return typeof u3 != "function" ? false : typeof d.on("redo", e20) != "function" ? (u3(), false) : (a2 = true, g2(), true);
73229
73580
  };
73230
- St6(document, Vn4, e20), St6(document, Hn3, e20);
73231
- let r44 = false, n3 = () => {
73232
- }, o3 = () => {
73233
- if (r44) return true;
73234
- let s2 = X6("undo");
73235
- if (!s2 || typeof s2.on != "function") return false;
73236
- let a2 = s2.on("undo", e20);
73237
- return typeof a2 != "function" ? false : typeof s2.on("redo", e20) != "function" ? (a2(), false) : (r44 = true, n3(), true);
73238
- };
73239
- if (!o3()) {
73240
- let s2 = St6(document, le6, o3), a2 = St6(document, zn4, o3);
73241
- n3 = () => {
73242
- s2(), a2();
73581
+ if (!b4()) {
73582
+ let d = rt6(document, Ht5, b4), u3 = rt6(document, Fn4, b4);
73583
+ g2 = () => {
73584
+ d(), u3();
73243
73585
  };
73244
- let k5 = X6("ready");
73245
- k5 && typeof k5.then == "function" && k5.then(o3, () => {
73586
+ let E4 = L7("ready");
73587
+ E4 && typeof E4.then == "function" && E4.then(b4, () => {
73246
73588
  });
73247
73589
  }
73590
+ return () => {
73591
+ typeof n3 == "function" && n3(), o3 && o3(), s2(), g2();
73592
+ };
73248
73593
  }
73249
- function Kt5(t2) {
73594
+ function ht6(t2) {
73250
73595
  let e20 = t2.tagName;
73251
73596
  if (e20 === "INPUT") {
73252
73597
  let r44 = (t2.getAttribute("type") || "text").toLowerCase();
@@ -73254,20 +73599,20 @@ ${t2}` : `"use strict"; return (${t2});`;
73254
73599
  }
73255
73600
  return e20 === "TEXTAREA" ? "text" : e20 === "SELECT" ? t2.multiple ? "select-multiple" : "select-one" : "leaf";
73256
73601
  }
73257
- function jn3(t2) {
73602
+ function In4(t2) {
73258
73603
  if (t2.validity && t2.validity.badInput) return t2.hasAttribute("value") ? Number(t2.getAttribute("value")) || 0 : t2._sapLastGood ?? 0;
73259
73604
  if (t2.value === "") return 0;
73260
73605
  let e20 = Number(t2.value);
73261
73606
  return Number.isNaN(e20) ? t2._sapLastGood ?? 0 : (t2._sapLastGood = e20, e20);
73262
73607
  }
73263
- function Je6(t2, e20) {
73608
+ function Le6(t2, e20) {
73264
73609
  switch (e20) {
73265
73610
  case "checkbox":
73266
73611
  return t2.checked;
73267
73612
  case "radio":
73268
73613
  return t2.checked ? t2.value : void 0;
73269
73614
  case "number":
73270
- return jn3(t2);
73615
+ return In4(t2);
73271
73616
  case "select-one":
73272
73617
  return t2.value;
73273
73618
  case "select-multiple":
@@ -73281,7 +73626,7 @@ ${t2}` : `"use strict"; return (${t2});`;
73281
73626
  return t2.value;
73282
73627
  }
73283
73628
  }
73284
- function Qe6(t2, e20, r44) {
73629
+ function Ce6(t2, e20, r44) {
73285
73630
  switch (e20) {
73286
73631
  case "checkbox":
73287
73632
  t2.checked = !!r44;
@@ -73309,34 +73654,34 @@ ${t2}` : `"use strict"; return (${t2});`;
73309
73654
  t2.value = r44 == null ? "" : String(r44);
73310
73655
  }
73311
73656
  }
73312
- function fe5(t2) {
73657
+ function Ut5(t2) {
73313
73658
  if (t2.hasAttribute("transient")) {
73314
73659
  t2.removeAttribute("value"), t2.removeAttribute("checked"), t2.removeAttribute("data-value");
73315
73660
  return;
73316
73661
  }
73317
- Xt5(t2) || xt6(t2);
73662
+ Ct6(t2) || nt6(t2);
73318
73663
  }
73319
- function Un3(t2) {
73664
+ function Mn4(t2) {
73320
73665
  t2.dispatchEvent(new Event("input", { bubbles: true })), t2.dispatchEvent(new Event("change", { bubbles: true }));
73321
73666
  }
73322
- function de6(t2, e20) {
73323
- return Je6(t2, e20);
73667
+ function Rt6(t2, e20) {
73668
+ return Le6(t2, e20);
73324
73669
  }
73325
- function Ze5(t2, e20, r44) {
73326
- Qe6(t2, e20, r44), fe5(t2);
73670
+ function Re6(t2, e20, r44) {
73671
+ Ce6(t2, e20, r44), Ut5(t2);
73327
73672
  }
73328
- function G5(t2) {
73329
- let e20 = Kt5(t2);
73673
+ function R5(t2) {
73674
+ let e20 = ht6(t2);
73330
73675
  return { el: t2, kind: e20, read() {
73331
- return Je6(t2, e20);
73676
+ return Le6(t2, e20);
73332
73677
  }, write(r44, n3 = {}) {
73333
- Qe6(t2, e20, r44), n3.noMirror || fe5(t2), n3.silent || Un3(t2);
73678
+ Ce6(t2, e20, r44), n3.noMirror || Ut5(t2), n3.silent || Mn4(t2);
73334
73679
  }, mirror() {
73335
- fe5(t2);
73680
+ Ut5(t2);
73336
73681
  } };
73337
73682
  }
73338
- var ot6 = null, Qt4 = false, kt6 = null;
73339
- function tn3(t2) {
73683
+ var j6 = null, Ft5 = false, ot6 = null;
73684
+ function De5(t2) {
73340
73685
  let e20 = null;
73341
73686
  return { kind: "hub", subscribe(r44) {
73342
73687
  let n3 = t2.onAnyChange({ debounce: 0, require: "observed" }, r44);
@@ -73358,14 +73703,14 @@ ${t2}` : `"use strict"; return (${t2});`;
73358
73703
  }
73359
73704
  } };
73360
73705
  }
73361
- function Gn4() {
73706
+ function On4() {
73362
73707
  let t2 = null;
73363
73708
  return { kind: "native", subscribe(e20) {
73364
- t2 = new MutationObserver((n3) => e20(Yn4(n3)));
73709
+ t2 = new MutationObserver((n3) => e20(Bn4(n3)));
73365
73710
  let r44 = typeof document < "u" && document.body || typeof document < "u" && document.documentElement;
73366
73711
  r44 && t2.observe(r44, { childList: true, subtree: true, attributes: true, characterData: true });
73367
73712
  }, suppress(e20) {
73368
- let r44 = X6("undo");
73713
+ let r44 = L7("undo");
73369
73714
  r44 && r44.pause && r44.pause();
73370
73715
  try {
73371
73716
  return e20();
@@ -73376,24 +73721,24 @@ ${t2}` : `"use strict"; return (${t2});`;
73376
73721
  t2 && (t2.disconnect(), t2 = null);
73377
73722
  } };
73378
73723
  }
73379
- function Yn4(t2) {
73724
+ function Bn4(t2) {
73380
73725
  let e20 = [];
73381
73726
  for (let r44 of t2) if (r44.type === "attributes") {
73382
73727
  let n3 = r44.target;
73383
- n3 && n3.nodeType === 1 && !Jt5(n3) && e20.push({ type: "attribute", element: n3 });
73728
+ n3 && n3.nodeType === 1 && !Dt6(n3) && e20.push({ type: "attribute", element: n3 });
73384
73729
  } else if (r44.type === "characterData") {
73385
73730
  let n3 = r44.target && r44.target.parentElement;
73386
- n3 && !Jt5(n3) && e20.push({ type: "characterData", element: n3 });
73731
+ n3 && !Dt6(n3) && e20.push({ type: "characterData", element: n3 });
73387
73732
  } else if (r44.type === "childList") {
73388
- for (let n3 of r44.addedNodes) if (!(n3.nodeType !== 1 || Jt5(n3)) && (e20.push({ type: "add", element: n3 }), n3.querySelectorAll)) for (let o3 of n3.querySelectorAll("*")) Jt5(o3) || e20.push({ type: "add", element: o3 });
73733
+ for (let n3 of r44.addedNodes) if (!(n3.nodeType !== 1 || Dt6(n3)) && (e20.push({ type: "add", element: n3 }), n3.querySelectorAll)) for (let o3 of n3.querySelectorAll("*")) Dt6(o3) || e20.push({ type: "add", element: o3 });
73389
73734
  for (let n3 of r44.removedNodes) n3.nodeType === 1 && e20.push({ type: "remove", element: n3, parent: r44.target });
73390
73735
  }
73391
73736
  return e20;
73392
73737
  }
73393
- function Jt5(t2) {
73738
+ function Dt6(t2) {
73394
73739
  return !!(t2.closest && t2.closest("[sap-ignore],[template],[cms-template]"));
73395
73740
  }
73396
- function Xn4(t2, e20) {
73741
+ function Wn3(t2, e20) {
73397
73742
  t2.pruneDisconnected();
73398
73743
  let r44 = /* @__PURE__ */ new Set(), n3 = false;
73399
73744
  for (let o3 of e20) {
@@ -73403,9 +73748,9 @@ ${t2}` : `"use strict"; return (${t2});`;
73403
73748
  n3 && t2.remountIfPresent();
73404
73749
  for (let o3 of r44) o3.root.isConnected && t2.schedule(o3, "mutation");
73405
73750
  }
73406
- function en3(t2) {
73407
- if (ot6) return ot6.suppress(t2);
73408
- let e20 = X6("undo");
73751
+ function Fe6(t2) {
73752
+ if (j6) return j6.suppress(t2);
73753
+ let e20 = L7("undo");
73409
73754
  if (e20 && e20.pause && e20.resume) {
73410
73755
  e20.pause();
73411
73756
  try {
@@ -73416,256 +73761,136 @@ ${t2}` : `"use strict"; return (${t2});`;
73416
73761
  }
73417
73762
  return t2();
73418
73763
  }
73419
- function pe5(t2, e20) {
73420
- Qt4 = true, ot6 = t2, t2.subscribe((r44) => Xn4(e20, r44));
73764
+ function Gt5(t2, e20) {
73765
+ Ft5 = true, j6 = t2, t2.subscribe((r44) => Wn3(e20, r44));
73421
73766
  }
73422
- function me6(t2) {
73423
- if (Qt4 || typeof window > "u" || typeof document > "u") return;
73424
- let e20 = X6("Mutation");
73767
+ function Yt5(t2) {
73768
+ if (Ft5 || typeof window > "u" || typeof document > "u") return;
73769
+ let e20 = L7("Mutation");
73425
73770
  if (e20 && typeof e20.onAnyChange == "function") {
73426
- pe5(tn3(e20), t2);
73771
+ Gt5(De5(e20), t2);
73427
73772
  return;
73428
73773
  }
73429
- typeof MutationObserver == "function" && (pe5(Gn4(), t2), kt6 = St6(document, le6, function() {
73430
- let n3 = X6("Mutation");
73431
- n3 && (kt6(), kt6 = null, ot6 && ot6.teardown(), Qt4 = false, pe5(tn3(n3), t2));
73774
+ typeof MutationObserver == "function" && (Gt5(On4(), t2), ot6 = rt6(document, Ht5, function() {
73775
+ let n3 = L7("Mutation");
73776
+ n3 && (ot6(), ot6 = null, j6 && j6.teardown(), Ft5 = false, Gt5(De5(n3), t2));
73432
73777
  }));
73433
73778
  }
73434
- function nn2() {
73435
- if (ot6) try {
73436
- ot6.teardown();
73779
+ function Xt5() {
73780
+ if (j6) try {
73781
+ j6.teardown();
73437
73782
  } catch {
73438
73783
  }
73439
- kt6 && typeof document < "u" && kt6(), ot6 = null, Qt4 = false, kt6 = null;
73784
+ ot6 && typeof document < "u" && ot6(), j6 = null, Ft5 = false, ot6 = null;
73440
73785
  }
73441
- var Kn4 = new Set(bt6);
73442
- function $t6(t2, e20 = {}) {
73786
+ var qn4 = new Set(J6), V7 = [], Ie6 = {}, Me6 = {};
73787
+ function Oe6(t2) {
73788
+ V7.includes(t2) || (V7.push(t2), t2.boundary && Object.assign(Ie6, t2.boundary), t2.paintKinds && Object.assign(Me6, t2.paintKinds));
73789
+ }
73790
+ function it6(t2, e20 = {}) {
73443
73791
  if (e20.breaker) {
73444
- t2.diag.error("E26", t2.root, { problem: "recompute loop halted after 50 passes; recent triggers: " + (t2._breakerRing || []).join(", ") }), ut6(t2.root, "loop");
73792
+ t2.diag.error("E26", t2.root, { problem: "recompute loop halted after 50 passes; recent triggers: " + (t2._breakerRing || []).join(", ") }), M6(t2.root, "loop");
73445
73793
  return;
73446
73794
  }
73447
- e20.full && We6();
73448
- let r44 = qe6(t2.root);
73795
+ e20.full && ye6();
73796
+ let r44 = Ae6(t2.root);
73449
73797
  try {
73450
- en3(() => Jn4(t2, e20));
73798
+ Fe6(() => jn3(t2, e20));
73451
73799
  } finally {
73452
- Ve5(r44);
73800
+ Ee6(r44);
73453
73801
  }
73454
73802
  t2._viewsChanged && (t2._viewsChanged = false, t2.root.dispatchEvent(new CustomEvent("sap:views-updated", { bubbles: true })));
73455
73803
  }
73456
- function Jn4(t2, e20) {
73457
- let r44 = t2.root, n3 = {}, o3 = [], s2 = [], a2 = [], k5 = [], $6 = [], A4 = [], l2 = [], w4 = /* @__PURE__ */ new Set();
73804
+ function jn3(t2, e20) {
73805
+ let r44 = t2.root, n3 = {}, o3 = [], s2 = [], a2 = /* @__PURE__ */ new Set();
73458
73806
  t2.diag.errors = [];
73459
- let N16 = { root: n3, state: n3, item: null, ownerEl: r44, projection: false };
73460
- function P7(i2, h) {
73461
- let f3 = h.attr || h.name, g2 = i2.getAttribute(f3);
73462
- return g2 == null && (g2 = Ct6(h), $6.push({ el: i2, name: h.name, attr: f3, value: ie6(ct6(g2, h.type), h.type) })), ct6(g2, h.type);
73463
- }
73464
- function z5(i2, h, f3) {
73465
- let g2 = h.decls;
73466
- if (g2) for (let T5 of g2) {
73467
- if (T5.transient) {
73468
- f3[T5.name] = zt5(i2, T5);
73807
+ let g2 = { root: n3, state: n3, item: null, ownerEl: r44, projection: false };
73808
+ function b4(i2, l2) {
73809
+ let m4 = l2.attr || l2.name, y4 = i2.getAttribute(m4);
73810
+ return y4 == null && (y4 = ft5(l2), s2.push({ el: i2, name: l2.name, attr: m4, value: qt5(z5(y4, l2.type), l2.type) })), z5(y4, l2.type);
73811
+ }
73812
+ function d(i2, l2, m4) {
73813
+ let y4 = l2.decls;
73814
+ if (y4) for (let x6 of y4) {
73815
+ if (x6.transient) {
73816
+ m4[x6.name] = St6(i2, x6);
73469
73817
  continue;
73470
73818
  }
73471
- if (yt6(i2, T5)) {
73472
- f3[T5.name] = i2.hasAttribute(T5.attr);
73819
+ if (G5(i2, x6)) {
73820
+ m4[x6.name] = i2.hasAttribute(x6.attr);
73473
73821
  continue;
73474
73822
  }
73475
- f3[T5.name] = P7(i2, T5);
73823
+ m4[x6.name] = b4(i2, x6);
73476
73824
  }
73477
73825
  }
73478
- function m4(i2, h, f3) {
73479
- let g2 = h.bind, T5 = f3.item || f3.state, I5 = Kt5(i2);
73480
- I5 === "radio" ? (g2 in T5 || (T5[g2] = ""), i2.checked && (T5[g2] = i2.value)) : T5[g2] = de6(i2, I5), h.transient && (i2.removeAttribute("value"), i2.removeAttribute("checked"));
73826
+ function u3(i2, l2, m4) {
73827
+ let y4 = l2.bind, x6 = m4.item || m4.state, $6 = ht6(i2);
73828
+ $6 === "radio" ? (y4 in x6 || (x6[y4] = ""), i2.checked && (x6[y4] = i2.value)) : x6[y4] = Rt6(i2, $6), l2.transient && (i2.removeAttribute("value"), i2.removeAttribute("checked"));
73481
73829
  }
73482
- function d(i2, h, f3) {
73483
- if (h.calcs) {
73484
- let g2 = f3.item || f3.state;
73485
- for (let T5 of h.calcs) o3.push({ owner: g2, ownerEl: f3.ownerEl, name: T5.name, entry: T5.entry, def: T5, el: i2, ctx: f3 });
73486
- }
73487
- if (h.paints) for (let g2 of h.paints) g2.kind === "when" && w4.add(g2.field), s2.push({ def: g2, el: i2, ctx: f3 });
73488
- if (h.effects) for (let g2 of h.effects) a2.push({ def: g2, el: i2, ctx: f3 });
73489
- if (h.invalids) for (let g2 of h.invalids) k5.push({ def: g2, el: i2, ctx: f3 });
73490
- if (h.bind != null && (f3.view || f3.projection) && !qt5(i2)) {
73491
- let g2 = h.bind;
73492
- f3.view ? wt6(ke6(f3.item), g2) ? (i2._sapViewBind = "item", s2.push({ def: { kind: "projection", field: g2, from: "item" }, el: i2, ctx: f3 })) : g2 in f3.state || g2 in f3.root ? (i2._sapViewBind = "drawn", s2.push({ def: { kind: "projection", field: g2, from: "drawn" }, el: i2, ctx: f3 })) : (i2._sapViewBind = null, t2.diag.error("E43", i2, { attr: "bind", expr: g2, problem: `bind="${g2}" inside an each row matches no field of the row's record or of the scope the row is drawn in`, fix: "bind a field the record owns (bind, state= or items= on the [item]), or declare it with state= where the list is drawn" })) : s2.push({ def: { kind: "projection", field: g2, from: null }, el: i2, ctx: f3 });
73493
- }
73830
+ function E4(i2, l2, m4) {
73831
+ if (l2.paints) for (let y4 of l2.paints) y4.kind === "when" && a2.add(y4.field), o3.push({ def: y4, el: i2, ctx: m4 });
73832
+ for (let y4 of V7) y4.collect && y4.collect(w4, i2, l2, m4);
73494
73833
  }
73495
- function p3(i2, h, f3) {
73496
- Object.defineProperty(i2, "$key", { value: Bt5(h, "row"), enumerable: false }), Object.defineProperty(i2, "$index", { value: f3, enumerable: false }), Object.defineProperty(i2, "$el", { value: h, enumerable: false });
73834
+ function S4(i2, l2, m4) {
73835
+ Object.defineProperty(i2, "$key", { value: At5(l2, "row"), enumerable: false }), Object.defineProperty(i2, "$index", { value: m4, enumerable: false }), Object.defineProperty(i2, "$el", { value: l2, enumerable: false });
73497
73836
  }
73498
- function y4(i2, h, f3) {
73499
- let g2 = vt5(i2);
73500
- z5(i2, g2, h), i2._sapScope = h, !f3.projection && g2.bind != null && m4(i2, g2, f3), d(i2, g2, f3), g2.items ? M6(i2, h, f3) : E4(i2, h, f3);
73837
+ function k5(i2, l2, m4) {
73838
+ let y4 = q7(i2);
73839
+ d(i2, y4, l2), i2._sapScope = l2, !m4.projection && y4.bind != null && u3(i2, y4, m4), E4(i2, y4, m4), y4.items ? p3(i2, l2, m4) : _4(i2, l2, m4);
73501
73840
  }
73502
- function E4(i2, h, f3) {
73503
- for (let g2 = i2.firstElementChild; g2; g2 = g2.nextElementSibling) S4(g2, h, f3);
73841
+ function _4(i2, l2, m4) {
73842
+ for (let y4 = i2.firstElementChild; y4; y4 = y4.nextElementSibling) h(y4, l2, m4);
73504
73843
  }
73505
- function S4(i2, h, f3) {
73506
- let g2 = vt5(i2);
73507
- if (!g2.inert) {
73508
- if (g2.boundary) {
73509
- g2.boundary === "scope" ? _4(i2, h, f3) : g2.boundary === "items" ? (d(i2, g2, f3), M6(i2, h, f3)) : g2.boundary === "detail" ? c3(i2, h, f3) : (d(i2, g2, f3), l2.push({ el: i2, ctx: f3 }));
73844
+ function h(i2, l2, m4) {
73845
+ let y4 = q7(i2);
73846
+ if (!y4.inert) {
73847
+ if (y4.boundary) {
73848
+ y4.boundary === "scope" ? A4(i2, l2, m4) : y4.boundary === "items" ? (E4(i2, y4, m4), p3(i2, l2, m4)) : Ie6[y4.boundary](w4, i2, y4, l2, m4);
73510
73849
  return;
73511
73850
  }
73512
- !f3.projection && !f3.view && g2.bind != null && m4(i2, g2, f3), d(i2, g2, f3);
73513
- for (let T5 = i2.firstElementChild; T5; T5 = T5.nextElementSibling) S4(T5, h, f3);
73851
+ !m4.projection && !m4.view && y4.bind != null && u3(i2, y4, m4), E4(i2, y4, m4);
73852
+ for (let x6 = i2.firstElementChild; x6; x6 = x6.nextElementSibling) h(x6, l2, m4);
73514
73853
  }
73515
73854
  }
73516
- function _4(i2, h, f3) {
73517
- let g2 = i2.getAttribute("scope"), T5 = {};
73518
- h[g2] = T5;
73519
- let I5 = { root: f3.root, state: T5, item: null, ownerEl: i2, projection: f3.projection };
73520
- y4(i2, T5, I5);
73521
- }
73522
- function M6(i2, h, f3) {
73523
- let g2 = i2.getAttribute("items"), T5 = [];
73524
- h[g2] = T5, i2._sapList = T5;
73525
- let I5 = 0;
73526
- for (let W6 = i2.firstElementChild; W6; W6 = W6.nextElementSibling) {
73527
- let Y5 = vt5(W6);
73528
- if (!Y5.item || Y5.template || W6.hasAttribute("cms-template")) continue;
73529
- let K7 = {};
73530
- p3(K7, W6, I5);
73531
- let U6 = { root: f3.root, state: f3.state, item: K7, ownerEl: W6, projection: f3.projection };
73532
- y4(W6, K7, U6), T5.push(K7), I5++;
73855
+ function A4(i2, l2, m4) {
73856
+ let y4 = i2.getAttribute("scope"), x6 = {};
73857
+ l2[y4] = x6;
73858
+ let $6 = { root: m4.root, state: x6, item: null, ownerEl: i2, projection: m4.projection };
73859
+ k5(i2, x6, $6);
73860
+ }
73861
+ function p3(i2, l2, m4) {
73862
+ let y4 = i2.getAttribute("items"), x6 = [];
73863
+ l2[y4] = x6, i2._sapList = x6;
73864
+ let $6 = 0;
73865
+ for (let T5 = i2.firstElementChild; T5; T5 = T5.nextElementSibling) {
73866
+ let gt6 = q7(T5);
73867
+ if (!gt6.item || gt6.template || T5.hasAttribute("cms-template")) continue;
73868
+ let D4 = {};
73869
+ S4(D4, T5, $6);
73870
+ let st6 = { root: m4.root, state: m4.state, item: D4, ownerEl: T5, projection: m4.projection };
73871
+ k5(T5, D4, st6), x6.push(D4), $6++;
73533
73872
  }
73534
73873
  }
73535
- function H6(i2, h) {
73536
- let f3 = String(i2).split("."), g2 = (I5) => {
73537
- for (let W6 of f3) {
73538
- if (I5 == null) return;
73539
- I5 = Array.isArray(I5) ? I5.flatMap((Y5) => Y5 && Y5[W6] != null ? Y5[W6] : []) : I5[W6];
73540
- }
73541
- return I5;
73542
- }, T5 = g2(h.state);
73543
- return T5 === void 0 ? g2(h.root) : T5;
73544
- }
73545
- function c3(i2, h, f3) {
73546
- for (let g2 of V7(i2.getAttribute("state") || "")) g2.name in h || (h[g2.name] = yt6(i2, g2) ? i2.hasAttribute(g2.attr) : P7(i2, g2));
73547
- A4.push({ el: i2, parentObj: h, ctx: f3 });
73548
- }
73549
- function u3(i2, h, f3) {
73550
- i2._sapScope = h;
73551
- let g2 = i2.getAttribute("detail") || "", T5 = /^([\w.]+)\s+by\s+(.+)$/.exec(g2);
73552
- if (!T5) {
73553
- i2.hidden = true, i2._sapDetailRow = null;
73554
- return;
73555
- }
73556
- let I5 = T5[1], W6 = T5[2].trim(), Y5 = H6(I5, f3), K7;
73557
- try {
73558
- K7 = Et6(q7(W6), { state: h, item: f3.item, el: i2, root: f3.root });
73559
- } catch {
73560
- K7 = void 0;
73561
- }
73562
- let U6 = Array.isArray(Y5) && K7 != null ? Y5.find((j6) => j6 && typeof j6 == "object" && j6.$el && String(j6.$key) === String(K7)) : null;
73563
- if (i2._sapDetailRow = U6 ? U6.$el : null, i2.tagName === "DIALOG") {
73564
- let j6 = U6 ? String(U6.$key) : null;
73565
- if (j6 !== i2._sapDetailKey && (i2._sapDetailKey = j6, i2._sapDismissed = false), !U6) {
73566
- i2._sapOpenedFor = null, i2.open && typeof i2.close == "function" && (i2._sapEngineClose = true, i2.close());
73567
- return;
73568
- }
73569
- i2.open ? i2._sapOpenedFor = j6 : (i2._sapOpenedFor === j6 && (i2._sapDismissed = true), i2._sapOpenedFor = null, !i2._sapDismissed && i2.isConnected && typeof i2.showModal == "function" && (i2.hidden && (i2.hidden = false), i2.showModal(), i2._sapOpenedFor = j6));
73570
- } else {
73571
- if (!U6) {
73572
- i2.hidden || (i2.hidden = true);
73573
- return;
73574
- }
73575
- i2.hidden && (i2.hidden = false);
73576
- }
73577
- ue5();
73578
- let at5 = { root: f3.root, state: h, item: U6, ownerEl: U6.$el, projection: true };
73579
- d(i2, vt5(i2), at5), E4(i2, U6, at5);
73580
- }
73581
- function b4(i2, h) {
73582
- for (let f3 = i2.parentElement; f3; f3 = f3.parentElement) if (f3._sapScope === h && !f3.hasAttribute("detail") || f3.hasAttribute("sap")) return f3;
73583
- return r44;
73584
- }
73585
- function v5(i2, h) {
73586
- i2._sapDrawnEl = b4(i2, h.state);
73587
- let f3 = null;
73588
- for (let B5 = i2.firstElementChild; B5; B5 = B5.nextElementSibling) if (B5.tagName === "TEMPLATE") {
73589
- f3 = B5;
73590
- break;
73591
- }
73592
- let g2 = f3 && f3.content.children.length === 1 ? f3.content.firstElementChild : null;
73593
- if (!g2) return t2.diag.error("E42", i2, { attr: "each", problem: "each needs one <template> child with exactly one element root" }), 0;
73594
- let T5 = i2.getAttribute("each"), I5;
73595
- try {
73596
- I5 = Et6(q7(T5), { state: h.state, item: h.item, el: i2, root: h.root });
73597
- } catch (B5) {
73598
- return t2.diag.error("E24", i2, { attr: "each", expr: T5, problem: String(B5.message) }), 0;
73599
- }
73600
- if (!Array.isArray(I5)) return t2.diag.error("E40", i2, { attr: "each", expr: T5, problem: "each must evaluate to an array; the list keeps its last good rows" }), 0;
73601
- let W6 = q7(i2.getAttribute("key") || "item.$key"), Y5 = [], K7 = /* @__PURE__ */ new Set();
73602
- for (let B5 of I5) {
73603
- let J6;
73604
- try {
73605
- J6 = dt6(W6, h.state, B5, i2, h.root);
73606
- } catch {
73607
- J6 = void 0;
73608
- }
73609
- let D4 = J6 == null ? "" : String(J6);
73610
- if (D4 === "" || K7.has(D4)) return t2.diag.error("E41", i2, { attr: "key", expr: W6.src, problem: D4 === "" ? "an item has no key; the list keeps its last good rows" : `duplicate key "${D4}"; the list keeps its last good rows` }), 0;
73611
- K7.add(D4), Y5.push(D4);
73612
- }
73613
- let U6 = i2._sapEach || /* @__PURE__ */ new Map(), at5 = /* @__PURE__ */ new Map(), j6 = 0, ee6 = f3;
73614
- Y5.forEach((B5, J6) => {
73615
- let D4 = U6.get(B5);
73616
- if (!D4 || D4.parentElement !== i2) {
73617
- D4 = i2.ownerDocument.importNode(g2, true);
73618
- let _t5 = (D4.getAttribute("clay") || "").split(/\s+/).filter(Boolean);
73619
- _t5.includes("editor-ui") || D4.setAttribute("clay", [..._t5, "editor-ui"].join(" ")), D4._sapEachRow = true, j6++;
73620
- }
73621
- D4.getAttribute("data-key") !== B5 && D4.setAttribute("data-key", B5), ee6.nextElementSibling !== D4 && (nr4(i2, D4, ee6), j6++), D4._sapEachItem = I5[J6], at5.set(B5, D4), ee6 = D4;
73622
- });
73623
- for (let [B5, J6] of U6) at5.get(B5) !== J6 && J6.parentElement === i2 && (J6.remove(), j6++);
73624
- return i2._sapEach = at5, ue5(), Y5.forEach((B5, J6) => {
73625
- let D4 = at5.get(B5), _t5 = { root: h.root, state: h.state, item: I5[J6], ownerEl: D4, projection: false, view: true };
73626
- d(D4, vt5(D4), _t5), E4(D4, {}, _t5);
73627
- }), j6;
73628
- }
73629
- y4(r44, n3, N16);
73630
- for (let i2 = 0; i2 < A4.length; i2++) {
73631
- let { el: h, parentObj: f3, ctx: g2 } = A4[i2];
73632
- u3(h, f3, g2);
73633
- }
73634
- if ($6.length && w4.size) for (let i2 of $6) w4.has(i2.attr) && i2.el.getAttribute(i2.attr) == null && i2.el.setAttribute(i2.attr, i2.value);
73635
- let x6 = /* @__PURE__ */ new Map();
73874
+ let w4 = { app: t2, root: r44, rootObj: n3, paints: o3, stats: { calcs: 0, lists: 0 }, resolveDefault: b4, collectEl: E4, walkScope: _4 };
73875
+ for (let i2 of V7) i2.begin && i2.begin(w4);
73876
+ if (k5(r44, n3, g2), t2.halted) return;
73877
+ for (let i2 of V7) i2.afterIntake && i2.afterIntake(w4);
73878
+ if (s2.length && a2.size) for (let i2 of s2) a2.has(i2.attr) && i2.el.getAttribute(i2.attr) == null && i2.el.setAttribute(i2.attr, i2.value);
73879
+ for (let i2 of V7) i2.compute && i2.compute(w4);
73880
+ let v5 = 0;
73881
+ for (let i2 of V7) i2.reconcile && (v5 += i2.reconcile(w4));
73882
+ let f3 = 0, c3 = v5;
73636
73883
  for (let i2 of o3) {
73637
- let h = x6.get(i2.owner);
73638
- h || (h = { ownerEl: i2.ownerEl, list: [] }, x6.set(i2.owner, h)), h.list.push(i2);
73639
- }
73640
- let L7 = [...x6.values()].sort((i2, h) => sn3(h.ownerEl) - sn3(i2.ownerEl));
73641
- for (let i2 of L7) {
73642
- let h;
73643
- try {
73644
- h = Oe6(i2.list);
73645
- } catch (f3) {
73646
- t2.diag.error("E07", i2.list[0].el, { problem: f3.message }), h = i2.list;
73647
- }
73648
- for (let f3 of h) try {
73649
- f3.owner[f3.name] = dt6(f3.entry, f3.ctx.state, f3.ctx.item, f3.el, f3.ctx.root), Ft5(f3.el);
73650
- } catch (g2) {
73651
- f3.owner[f3.name] = void 0, t2.diag.error("E24", f3.el, { attr: "calc:" + f3.name, expr: f3.entry.src, problem: String(g2.message) }), ut6(f3.el, g2.sapCode || "E24");
73652
- }
73653
- }
73654
- let C5 = 0;
73655
- for (let i2 = 0; i2 < l2.length; i2++) C5 += v5(l2[i2].el, l2[i2].ctx);
73656
- let R5 = 0, F5 = C5;
73657
- for (let i2 of s2) {
73658
- let h = Zn3(i2, t2);
73659
- i2.ctx.view ? F5 += h : R5 += h;
73884
+ let l2 = zn4(i2, t2);
73885
+ i2.ctx.view ? c3 += l2 : f3 += l2;
73660
73886
  }
73661
- for (let i2 of a2) tr4(i2, t2);
73662
- for (let i2 of k5) er2(i2);
73663
- t2._state = n3, t2._stats = { fields: Object.keys(n3).filter((i2) => typeof n3[i2] != "function").length, calcs: o3.length, paints: s2.length, lists: x6.size, writes: R5, viewWrites: F5 }, t2._viewsChanged = F5 > 0, t2._lastPass = { trigger: e20.trigger || "refresh", writes: R5 }, t2._debug && console.log(`sap pass \xB7 trigger: ${t2._lastPass.trigger} \xB7 writes ${R5}/${s2.length}`);
73887
+ for (let i2 of V7) i2.afterPaint && i2.afterPaint(w4);
73888
+ t2._state = n3, t2._stats = { fields: Object.keys(n3).filter((i2) => typeof n3[i2] != "function").length, calcs: w4.stats.calcs, paints: o3.length, lists: w4.stats.lists, writes: f3, viewWrites: c3 }, t2._viewsChanged = c3 > 0, t2._lastPass = { trigger: e20.trigger || "refresh", writes: f3 }, t2._debug && console.log(`sap pass \xB7 trigger: ${t2._lastPass.trigger} \xB7 writes ${f3}/${o3.length}`);
73664
73889
  }
73665
- function Qn4(t2) {
73890
+ function Vn4(t2) {
73666
73891
  return t2.kind === "text" ? t2.fmt ? "text:" + t2.fmt : "text" : t2.kind === "attr" ? "attr:" + t2.arg : t2.kind === "class" ? "class:" + t2.arg : t2.kind === "css" ? "css:" + t2.arg : t2.kind === "when" ? (t2.match === "hide" ? "hide-when:" : t2.match === "show-not" ? "option-not:" : "show-when:") + t2.field : t2.kind;
73667
73892
  }
73668
- function he6(t2, e20, r44, n3) {
73893
+ function Kt5(t2, e20, r44, n3) {
73669
73894
  let o3 = t2;
73670
73895
  for (; o3 && o3.nodeType === 1; ) {
73671
73896
  if (o3.hasAttribute && o3.hasAttribute(e20)) {
@@ -73676,36 +73901,21 @@ ${t2}` : `"use strict"; return (${t2});`;
73676
73901
  }
73677
73902
  return false;
73678
73903
  }
73679
- function rn3(t2, e20) {
73680
- if (t2 === t2.ownerDocument.activeElement) return 0;
73681
- if (t2.type === "radio") {
73682
- let s2 = e20 != null && String(t2.value) === String(e20);
73683
- return t2.checked === s2 ? 0 : (t2.checked = s2, 1);
73684
- }
73685
- let r44 = Kt5(t2), n3 = de6(t2, r44), o3 = e20 ?? "";
73686
- return String(n3) !== String(o3) ? (Ze5(t2, r44, o3), 1) : 0;
73687
- }
73688
- function Zn3(t2, e20) {
73689
- let r44 = t2.def, n3 = t2.el;
73690
- if (r44.kind === "projection") {
73691
- if (r44.from === "drawn") {
73692
- let o3 = r44.field in t2.ctx.state ? t2.ctx.state : t2.ctx.root;
73693
- return rn3(n3, o3[r44.field]);
73694
- }
73695
- return rn3(n3, t2.ctx.item ? t2.ctx.item[r44.field] : "");
73696
- }
73697
- if (r44.kind === "when") return on4(r44, n3, null);
73904
+ function zn4(t2, e20) {
73905
+ let r44 = t2.def, n3 = t2.el, o3 = Me6[r44.kind];
73906
+ if (o3) return o3(t2, e20);
73907
+ if (r44.kind === "when") return Pe6(r44, n3, null);
73698
73908
  try {
73699
- let o3 = dt6(r44.entry, t2.ctx.state, t2.ctx.item, n3, t2.ctx.root), s2 = on4(r44, n3, o3);
73700
- return Ft5(n3), s2;
73701
- } catch (o3) {
73702
- return e20.diag.error(o3.sapCode === "E22" ? "E22" : "E24", n3, { attr: Qn4(r44), expr: r44.entry && r44.entry.src, problem: String(o3.message) }), ut6(n3, o3.sapCode || "E24"), 0;
73909
+ let s2 = I5(r44.entry, t2.ctx.state, t2.ctx.item, n3, t2.ctx.root), a2 = Pe6(r44, n3, s2);
73910
+ return Q6(n3), a2;
73911
+ } catch (s2) {
73912
+ return e20.diag.error(s2.sapCode === "E22" ? "E22" : "E24", n3, { attr: Vn4(r44), expr: r44.entry && r44.entry.src, problem: String(s2.message) }), M6(n3, s2.sapCode || "E24"), 0;
73703
73913
  }
73704
73914
  }
73705
- function on4(t2, e20, r44) {
73915
+ function Pe6(t2, e20, r44) {
73706
73916
  switch (t2.kind) {
73707
73917
  case "text": {
73708
- let n3 = t2.fmt != null ? Me6(t2.fmt, r44) : r44 == null ? "" : String(r44);
73918
+ let n3 = t2.fmt != null ? pe5(t2.fmt, r44) : r44 == null ? "" : String(r44);
73709
73919
  return e20.textContent !== n3 ? (e20.textContent = n3, 1) : 0;
73710
73920
  }
73711
73921
  case "show": {
@@ -73713,10 +73923,10 @@ ${t2}` : `"use strict"; return (${t2});`;
73713
73923
  return e20.hidden !== n3 ? (e20.hidden = n3, 1) : 0;
73714
73924
  }
73715
73925
  case "when": {
73716
- let n3 = X6("optionVisibility");
73926
+ let n3 = L7("optionVisibility");
73717
73927
  if (n3 && n3._started) return e20._sapWhen && e20.hidden ? (e20.hidden = false, e20._sapWhen = false, 1) : 0;
73718
73928
  let o3;
73719
- t2.match === "hide" ? o3 = !he6(e20, t2.field, t2.values, false) : t2.match === "show-not" ? o3 = he6(e20, t2.field, t2.values, true) : o3 = he6(e20, t2.field, t2.values, false), e20._sapWhen = true;
73929
+ t2.match === "hide" ? o3 = !Kt5(e20, t2.field, t2.values, false) : t2.match === "show-not" ? o3 = Kt5(e20, t2.field, t2.values, true) : o3 = Kt5(e20, t2.field, t2.values, false), e20._sapWhen = true;
73720
73930
  let s2 = !o3;
73721
73931
  return e20.hidden !== s2 ? (e20.hidden = s2, 1) : 0;
73722
73932
  }
@@ -73726,7 +73936,7 @@ ${t2}` : `"use strict"; return (${t2});`;
73726
73936
  let s2 = 0;
73727
73937
  return e20[n3] !== !!r44 && (e20[n3] = !!r44, s2 = 1), !!r44 !== e20.hasAttribute(n3) && (r44 ? e20.setAttribute(n3, "") : e20.removeAttribute(n3), s2 = 1), s2;
73728
73938
  }
73729
- if (Kn4.has(n3)) {
73939
+ if (qn4.has(n3)) {
73730
73940
  let s2 = e20.hasAttribute(n3);
73731
73941
  return r44 && !s2 ? (e20.setAttribute(n3, ""), 1) : !r44 && s2 ? (e20.removeAttribute(n3), 1) : 0;
73732
73942
  }
@@ -73745,45 +73955,17 @@ ${t2}` : `"use strict"; return (${t2});`;
73745
73955
  return 0;
73746
73956
  }
73747
73957
  }
73748
- function tr4(t2, e20) {
73749
- try {
73750
- dt6(t2.def.entry, t2.ctx.state, t2.ctx.item, t2.el, t2.ctx.root), Ft5(t2.el);
73751
- } catch (r44) {
73752
- e20.diag.error("E24", t2.el, { attr: "effect", expr: t2.def.entry && t2.def.entry.src, problem: String(r44.message) }), ut6(t2.el, "E24");
73753
- }
73754
- }
73755
- function er2(t2) {
73756
- let e20 = "";
73757
- try {
73758
- let r44 = dt6(t2.def.entry, t2.ctx.state, t2.ctx.item, t2.el, t2.ctx.root);
73759
- e20 = typeof r44 == "string" ? r44 : "";
73760
- } catch {
73761
- e20 = "";
73762
- }
73763
- typeof t2.el.setCustomValidity == "function" && t2.el.setCustomValidity(e20);
73764
- }
73765
- function sn3(t2) {
73766
- let e20 = 0, r44 = t2;
73767
- for (; r44 && !(r44.hasAttribute && r44.hasAttribute("sap")); ) r44 = r44.parentElement, e20++;
73768
- return e20;
73769
- }
73770
- function nr4(t2, e20, r44) {
73771
- let n3 = r44.nextSibling;
73772
- if (e20.isConnected && t2.moveBefore) try {
73773
- t2.moveBefore(e20, n3);
73774
- return;
73775
- } catch {
73776
- }
73777
- t2.insertBefore(e20, n3);
73958
+ var Hn3 = new Set(J6), Be6 = /* @__PURE__ */ new Set(["calc", "text", "attr", "class", "css", "set", "move", "sort", "option", "option-not", "show-when", "hide-when", "editmode"]), Un3 = /* @__PURE__ */ new Set(["show-when", "hide-when", "option", "option-not"]), Gn4 = /\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/, We6 = /* @__PURE__ */ new Set(["sap", "scope", "items", "item", "template", "bind", "show", "effect", "invalid", "detail", "state", "transient", "confirm", "default", "persist", "sortable", "trigger-add", "trigger-remove", "trigger-reset", "sap-ignore", "sap-error", "no-save", "no-watch", "no-undo", "no-trigger-autosave", "freeze", "mutations-ignore", "save-remove", "save-ignore", "save-freeze"]), Qt4 = [];
73959
+ function qe6(t2) {
73960
+ Qt4.includes(t2) || Qt4.push(t2);
73778
73961
  }
73779
- var rr3 = new Set(bt6), an3 = /* @__PURE__ */ new Set(["calc", "text", "attr", "class", "css", "set", "move", "sort", "option", "option-not", "show-when", "hide-when", "editmode"]), or4 = /* @__PURE__ */ new Set(["show-when", "hide-when", "option", "option-not"]), ir4 = /\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/, un4 = /* @__PURE__ */ new Set(["sap", "scope", "items", "item", "template", "bind", "show", "effect", "invalid", "detail", "state", "transient", "confirm", "default", "persist", "sortable", "trigger-add", "trigger-remove", "trigger-reset", "sap-ignore", "sap-error", "no-save", "no-watch", "no-undo", "no-trigger-autosave", "freeze", "mutations-ignore", "save-remove", "save-ignore", "save-freeze"]);
73780
- function sr4(t2) {
73962
+ function Yn4(t2) {
73781
73963
  return t2.tagName === "INPUT" || t2.tagName === "SELECT" || t2.tagName === "TEXTAREA";
73782
73964
  }
73783
- function be5(t2) {
73965
+ function Jt5(t2) {
73784
73966
  return t2.hasAttribute("bind");
73785
73967
  }
73786
- function ar4(t2, e20) {
73968
+ function Xn4(t2, e20) {
73787
73969
  e20(t2);
73788
73970
  for (let n3 = t2.firstElementChild; n3; n3 = n3.nextElementSibling) r44(n3);
73789
73971
  function r44(n3) {
@@ -73797,547 +73979,672 @@ ${t2}` : `"use strict"; return (${t2});`;
73797
73979
  }
73798
73980
  }
73799
73981
  }
73800
- function Zt5(t2, e20) {
73801
- let r44 = false, n3 = (a2, k5, $6) => {
73802
- e20.error(a2, k5, $6), r44 = true;
73982
+ function Pt5(t2, e20) {
73983
+ let r44 = false, n3 = (a2, g2, b4) => {
73984
+ e20.error(a2, g2, b4), r44 = true;
73803
73985
  }, o3 = t2.ownerDocument.createTreeWalker(t2, 4), s2;
73804
73986
  for (; s2 = o3.nextNode(); ) if (/\{\{.*\}\}/.test(s2.nodeValue || "")) {
73805
73987
  n3("E02", s2.parentElement || t2, { problem: "moustaches in text content are not a Sap feature", fix: 'move the expression onto the element: text="state.x"' });
73806
73988
  break;
73807
73989
  }
73808
- return ar4(t2, (a2) => {
73809
- let k5 = a2.closest && a2.closest("[detail]");
73810
- for (let $6 of [...a2.attributes]) {
73811
- let A4 = $6.name, l2 = ve6(A4);
73812
- if (l2) {
73813
- n3("E01", a2, { attr: A4, expr: $6.value, problem: `"${A4}" is a foreign-dialect attribute; Sap has no ${A4.split(/[:=]/)[0]} directive`, fix: l2 + " \u2014 or wrap the subtree in sap-ignore if intentional" });
73814
- continue;
73815
- }
73816
- if (A4.includes(":")) {
73817
- let N16 = A4.slice(0, A4.indexOf(":"));
73818
- if (an3.has(N16)) {
73819
- if (or4.has(N16) && ir4.test($6.value)) {
73820
- let P7 = A4.slice(A4.indexOf(":") + 1);
73821
- e20.warn("W04", a2, { attr: A4, expr: $6.value, problem: `${N16}: compares the "${P7}" attribute against a literal value, not a JS expression`, fix: `use show="${$6.value}" for an expression, or a literal like ${N16}:${P7}="overview"` });
73990
+ return Xn4(t2, (a2) => {
73991
+ let g2 = /* @__PURE__ */ new Set();
73992
+ for (let d of Qt4) d(a2, n3, (u3) => g2.add(u3));
73993
+ let b4 = a2.closest && a2.closest("[detail]");
73994
+ for (let d of [...a2.attributes]) {
73995
+ let u3 = d.name;
73996
+ if (g2.has(u3)) continue;
73997
+ if (u3.includes(":")) {
73998
+ let S4 = u3.slice(0, u3.indexOf(":"));
73999
+ if (Be6.has(S4)) {
74000
+ if (Un3.has(S4) && Gn4.test(d.value)) {
74001
+ let k5 = u3.slice(u3.indexOf(":") + 1);
74002
+ e20.warn("W04", a2, { attr: u3, expr: d.value, problem: `${S4}: compares the "${k5}" attribute against a literal value, not a JS expression`, fix: `use show="${d.value}" for an expression, or a literal like ${S4}:${k5}="overview"` });
73822
74003
  }
73823
74004
  } else {
73824
- let P7 = Nt4(N16, [...an3]);
73825
- e20.warn("W03", a2, { attr: A4, problem: `unknown "${N16}:" attribute`, didYouMean: P7 ? `${P7}:` : null });
74005
+ let k5 = ut6(S4, [...Be6]);
74006
+ e20.warn("W03", a2, { attr: u3, problem: `unknown "${S4}:" attribute`, didYouMean: k5 ? `${k5}:` : null });
73826
74007
  }
73827
- } else if (!un4.has(A4) && !Tt6.has(A4) && !rr3.has(A4) && !/^(data-|aria-|on)/.test(A4) && !(A4 in a2)) {
73828
- let N16 = Nt4(A4, [...un4]);
73829
- N16 && e20.warn("W03", a2, { attr: A4, problem: `unknown "${A4}" attribute`, didYouMean: N16 });
74008
+ } else if (!We6.has(u3) && !at5.has(u3) && !Hn3.has(u3) && !/^(data-|aria-|on)/.test(u3) && !(u3 in a2)) {
74009
+ let S4 = ut6(u3, [...We6]);
74010
+ S4 && e20.warn("W03", a2, { attr: u3, problem: `unknown "${u3}" attribute`, didYouMean: S4 });
73830
74011
  }
73831
- A4 === "attr:hidden" && e20.warn("W03", a2, { attr: A4, problem: "attr:hidden paints the wrong attribute", fix: 'use show="expr"' });
73832
- let w4 = be5(a2) || A4 === "attr:selected" && a2.tagName === "OPTION" && !!a2.closest("select[bind]");
73833
- (A4 === "attr:value" || A4 === "attr:checked" || A4 === "attr:selected") && w4 && n3("E30", a2, { attr: A4, problem: "attr: on a bound control collides with persist ownership", fix: "remove it; bind owns this attribute" }), A4 === "effect" && be5(a2) && /\b(value|checked)\s*=[^=]/.test($6.value) && n3("E30", a2, { attr: A4, expr: $6.value, problem: "effect writes value/checked on a bound control (writes a stale value with no synthetic event)", fix: "write through onclick + Sap(this) instead" }), (A4 === "text" || A4.startsWith("text:") || A4 === "show") && sr4(a2) && (A4 === "show" || n3("E18", a2, { attr: A4, problem: "paint belongs on output elements, not form controls", fix: "move the paint to an <output> or <span>" }));
74012
+ u3 === "attr:hidden" && e20.warn("W03", a2, { attr: u3, problem: "attr:hidden paints the wrong attribute", fix: 'use show="expr"' });
74013
+ let E4 = Jt5(a2) || u3 === "attr:selected" && a2.tagName === "OPTION" && !!a2.closest("select[bind]");
74014
+ (u3 === "attr:value" || u3 === "attr:checked" || u3 === "attr:selected") && E4 && n3("E30", a2, { attr: u3, problem: "attr: on a bound control collides with persist ownership", fix: "remove it; bind owns this attribute" }), u3 === "effect" && Jt5(a2) && /\b(value|checked)\s*=[^=]/.test(d.value) && n3("E30", a2, { attr: u3, expr: d.value, problem: "effect writes value/checked on a bound control (writes a stale value with no synthetic event)", fix: "write through onclick + Sap(this) instead" }), (u3 === "text" || u3.startsWith("text:") || u3 === "show") && Yn4(a2) && (u3 === "show" || n3("E18", a2, { attr: u3, problem: "paint belongs on output elements, not form controls", fix: "move the paint to an <output> or <span>" }));
73834
74015
  }
73835
74016
  if (a2.hasAttribute("state")) {
73836
- let $6 = V7(a2.getAttribute("state")), A4 = /* @__PURE__ */ new Set();
73837
- for (let l2 of $6) {
73838
- l2.name.includes("-") && n3("E08", a2, { attr: "state", problem: `field "${l2.name}" is not a valid identifier (the hyphen parses as subtraction)`, fix: `rename to ${l2.name.replace(/-/g, "")}` }), A4.has(l2.name) && n3("E04", a2, { attr: "state", problem: `field "${l2.name}" is declared twice in one scope` }), A4.add(l2.name), It6.has(l2.attr) && n3("E05", a2, { attr: "state", problem: `"${l2.name}" is a reserved Sap word` }), Tt6.has(l2.attr) && n3("E06", a2, { attr: "state", problem: `"${l2.name}" is a global HTML attribute name; pick another field name` }), l2.name === "open" && a2.tagName === "DIALOG" && n3("E33", a2, { attr: "state", problem: "dialog open is transient", fix: "use showModal() \u2014 declare state= only on <details> or popovers" });
73839
- let w4 = se6(a2, l2.attr);
73840
- w4 && (l2.attr === "checked" || l2.attr === "selected") && n3("E35", a2, { attr: "state", problem: `"${l2.attr}" on a form control is the control's own state, not a declared field`, fix: 'bind the control instead, e.g. <input type="checkbox" bind="done">' }), w4 && l2.type === "num" && n3("E35", a2, { attr: "state", problem: `"${l2.attr}" is an HTML boolean attribute; it cannot hold a number`, fix: `declare it bare: state="${l2.attr}"` }), l2.transient && (w4 || l2.type === "presence") && n3("E35", a2, { attr: "state", problem: `"${l2.name}" is carried by attribute presence, which transient would strip`, fix: "declare a separate name:bool:transient field and paint the attribute from it" });
74017
+ let d = C5(a2.getAttribute("state")), u3 = /* @__PURE__ */ new Set();
74018
+ for (let E4 of d) {
74019
+ E4.name.includes("-") && n3("E08", a2, { attr: "state", problem: `field "${E4.name}" is not a valid identifier (the hyphen parses as subtraction)`, fix: `rename to ${E4.name.replace(/-/g, "")}` }), u3.has(E4.name) && n3("E04", a2, { attr: "state", problem: `field "${E4.name}" is declared twice in one scope` }), u3.add(E4.name), wt6.has(E4.attr) && n3("E05", a2, { attr: "state", problem: `"${E4.name}" is a reserved Sap word` }), at5.has(E4.attr) && n3("E06", a2, { attr: "state", problem: `"${E4.name}" is a global HTML attribute name; pick another field name` }), E4.name === "open" && a2.tagName === "DIALOG" && n3("E33", a2, { attr: "state", problem: "dialog open is transient", fix: "use showModal() \u2014 declare state= only on <details> or popovers" });
74020
+ let S4 = jt6(a2, E4.attr);
74021
+ S4 && (E4.attr === "checked" || E4.attr === "selected") && n3("E35", a2, { attr: "state", problem: `"${E4.attr}" on a form control is the control's own state, not a declared field`, fix: 'bind the control instead, e.g. <input type="checkbox" bind="done">' }), S4 && E4.type === "num" && n3("E35", a2, { attr: "state", problem: `"${E4.attr}" is an HTML boolean attribute; it cannot hold a number`, fix: `declare it bare: state="${E4.attr}"` }), E4.transient && (S4 || E4.type === "presence") && n3("E35", a2, { attr: "state", problem: `"${E4.name}" is carried by attribute presence, which transient would strip`, fix: "declare a separate name:bool:transient field and paint the attribute from it" });
73841
74022
  }
73842
74023
  }
73843
- if (be5(a2)) {
74024
+ if (Jt5(a2)) {
73844
74025
  if (a2.hasAttribute("-"), a2.tagName === "INPUT") {
73845
- let $6 = (a2.getAttribute("type") || "text").toLowerCase();
73846
- $6 === "file" && n3("E32", a2, { attr: "bind", problem: "files never serialize into an HTML file", fix: "use no-save + effect instead of bind" }), $6 === "password" && !a2.hasAttribute("transient") && n3("E31", a2, { attr: "bind", problem: "a password must never serialize into a world-readable file", fix: "add transient to the password input" });
74026
+ let d = (a2.getAttribute("type") || "text").toLowerCase();
74027
+ d === "file" && n3("E32", a2, { attr: "bind", problem: "files never serialize into an HTML file", fix: "use no-save + effect instead of bind" }), d === "password" && !a2.hasAttribute("transient") && n3("E31", a2, { attr: "bind", problem: "a password must never serialize into a world-readable file", fix: "add transient to the password input" });
73847
74028
  } else if (a2.tagName !== "SELECT" && a2.tagName !== "TEXTAREA") {
73848
- let $6 = a2.getAttribute("contenteditable");
73849
- !($6 != null && $6 !== "false") && a2.children.length > 0 && n3("E20", a2, { attr: "bind", problem: "bind on a container element is not a control; a write would overwrite its children", fix: "bind a control (input/select/textarea), a contenteditable, or an empty text leaf" });
74029
+ let d = a2.getAttribute("contenteditable");
74030
+ !(d != null && d !== "false") && a2.children.length > 0 && n3("E20", a2, { attr: "bind", problem: "bind on a container element is not a control; a write would overwrite its children", fix: "bind a control (input/select/textarea), a contenteditable, or an empty text leaf" });
73850
74031
  }
73851
74032
  }
73852
74033
  if (a2.hasAttribute("transient") && a2.hasAttribute("persist") && n3("E34", a2, { problem: "transient and persist are opposite: persist forces the live value into the saved bytes, leaking exactly what transient drops", fix: "remove one \u2014 transient to keep it out of the file, or persist to save it" }), a2.tagName === "DIALOG" && a2.hasAttribute("detail") && !(a2.parentElement && a2.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]')) && e20.warn("W31", a2, { attr: "detail", problem: "a detail dialog writes open when it opens, and that attribute would be saved into the file", fix: 'wrap the dialog in an element with clay="freeze" (not editor-ui, which removes it from the file), and make its key field transient' }), a2.hasAttribute("item") && !a2.hasAttribute("template") && a2.parentNode && a2.parentNode.nodeType === 1) {
73853
- let $6 = a2.parentElement;
73854
- (!$6 || !$6.hasAttribute("items")) && n3("E10", a2, { problem: "an [item] must be a direct child of an [items] list", fix: 'wrap it in a container with items="name"' });
74034
+ let d = a2.parentElement;
74035
+ (!d || !d.hasAttribute("items")) && n3("E10", a2, { problem: "an [item] must be a direct child of an [items] list", fix: 'wrap it in a container with items="name"' });
73855
74036
  }
73856
- if (a2.hasAttribute("items") && k5 && n3("E17", a2, { attr: "items", problem: "nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)" }), a2.hasAttribute("items")) {
73857
- let $6 = t2.querySelector(`[trigger-add="${a2.getAttribute("items")}"]`);
73858
- !Vt5(a2) && !oe6(t2, a2.getAttribute("items")) && rt6(a2).length === 0 && $6 && n3("E17", a2, { attr: "items", problem: `trigger-add targets items="${a2.getAttribute("items")}" but it has no [item template] to clone` });
74037
+ if (a2.hasAttribute("items") && b4 && n3("E17", a2, { attr: "items", problem: "nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)" }), a2.hasAttribute("items")) {
74038
+ let d = t2.querySelector(`[trigger-add="${a2.getAttribute("items")}"]`);
74039
+ !xt6(a2) && !Wt6(t2, a2.getAttribute("items")) && W6(a2).length === 0 && d && n3("E17", a2, { attr: "items", problem: `trigger-add targets items="${a2.getAttribute("items")}" but it has no [item template] to clone` });
73859
74040
  }
73860
- }), r44 && (e20.halted = true, e20.haltReason = e20.errors[0] ? e20.errors[0].code : "halt", ut6(t2, e20.haltReason)), !r44;
74041
+ }), r44 && (e20.halted = true, e20.haltReason = e20.errors[0] ? e20.errors[0].code : "halt", M6(t2, e20.haltReason)), !r44;
73861
74042
  }
73862
- var cn3 = "sap-styles", ln3 = "[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}", ge6 = /* @__PURE__ */ new WeakSet();
73863
- function ur4(t2) {
73864
- if (ge6.has(t2)) return;
74043
+ var je6 = "sap-styles", Ve5 = "[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}", Zt5 = /* @__PURE__ */ new WeakSet();
74044
+ function Kn4(t2) {
74045
+ if (Zt5.has(t2)) return;
73865
74046
  let e20 = t2.defaultView, r44 = e20 && e20.CSSStyleSheet;
73866
74047
  if (r44 && "adoptedStyleSheets" in t2) try {
73867
74048
  let n3 = new r44();
73868
- n3.replaceSync(ln3), t2.adoptedStyleSheets = [...t2.adoptedStyleSheets, n3], ge6.add(t2);
74049
+ n3.replaceSync(Ve5), t2.adoptedStyleSheets = [...t2.adoptedStyleSheets, n3], Zt5.add(t2);
73869
74050
  return;
73870
74051
  } catch {
73871
74052
  }
73872
- if (!t2.getElementById(cn3)) {
74053
+ if (!t2.getElementById(je6)) {
73873
74054
  let n3 = t2.createElement("style");
73874
- n3.id = cn3, n3.textContent = ln3, (t2.head || t2.documentElement).appendChild(n3);
74055
+ n3.id = je6, n3.textContent = Ve5, (t2.head || t2.documentElement).appendChild(n3);
73875
74056
  }
73876
- ge6.add(t2);
74057
+ Zt5.add(t2);
73877
74058
  }
73878
- var cr4 = 0;
73879
- function fn4() {
74059
+ var Jn4 = 0;
74060
+ function ze6() {
73880
74061
  return typeof performance < "u" && performance.now ? performance.now() : 0;
73881
74062
  }
73882
- function we6(t2) {
73883
- let e20 = t2.id || t2.getAttribute("sap") || `app-${cr4++}`, r44 = new ht6(e20), n3 = { root: t2, name: e20, diag: r44, _state: null, _stats: null, _lastPass: null, _passes: 0, _broken: false, _mountMs: 0, _mountWrites: 0 };
73884
- if (!Zt5(t2, r44)) return n3.halted = true, n3;
73885
- ur4(t2.ownerDocument);
73886
- for (let a2 of t2.querySelectorAll("textarea[data-value]")) Yt5(a2);
73887
- let s2 = fn4();
73888
- return $t6(n3, { trigger: "mount", full: true }), n3._mountMs = fn4() - s2, n3._mountWrites = n3._stats ? n3._stats.writes : 0, n3._mountWrites > 0 && !Ue6() && r44.warn("W30", t2, { problem: `${n3._mountWrites} paint(s) ran at mount; the saved file was out of sync with its declared state`, fix: "re-save once so the file mounts clean (a settled file writes nothing)" }), n3;
74063
+ function te6(t2) {
74064
+ let e20 = t2.id || t2.getAttribute("sap") || `app-${Jn4++}`, r44 = new K7(e20), n3 = { root: t2, name: e20, diag: r44, _state: null, _stats: null, _lastPass: null, _passes: 0, _broken: false, _mountMs: 0, _mountWrites: 0 };
74065
+ if (!Pt5(t2, r44)) return n3.halted = true, n3;
74066
+ Kn4(t2.ownerDocument);
74067
+ for (let a2 of t2.querySelectorAll("textarea[data-value]")) Lt5(a2);
74068
+ let s2 = ze6();
74069
+ return it6(n3, { trigger: "mount", full: true }), n3._mountMs = ze6() - s2, n3._mountWrites = n3._stats ? n3._stats.writes : 0, n3._mountWrites > 0 && !ke6() && !L7("derived") && r44.warn("W30", t2, { problem: `${n3._mountWrites} paint(s) ran at mount; the saved file was out of sync with its declared state`, fix: "re-save once so the file mounts clean (a settled file writes nothing)" }), n3;
73889
74070
  }
73890
- var lr4 = ["for", "form", "list", "headers", "popovertarget", "commandfor", "anchor", "aria-activedescendant", "aria-controls", "aria-describedby", "aria-details", "aria-errormessage", "aria-flowto", "aria-labelledby", "aria-owns"];
73891
- function fr4(t2, e20) {
74071
+ var He6 = /^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;
74072
+ function It6(t2) {
74073
+ return `${t2.tagName.toLowerCase()}[sap]`;
74074
+ }
74075
+ function Qn4(t2) {
74076
+ let e20 = 0;
74077
+ for (let r44 of t2.querySelectorAll("*")) for (let n3 of r44.attributes) if (He6.test(n3.name)) {
74078
+ e20++;
74079
+ break;
74080
+ }
74081
+ for (let r44 of t2.attributes) if (He6.test(r44.name)) {
74082
+ e20++;
74083
+ break;
74084
+ }
74085
+ return e20;
74086
+ }
74087
+ function Ue6(t2) {
74088
+ function e20(g2) {
74089
+ let b4 = g2._stats || {}, d = g2.root;
74090
+ return { root: It6(d), fields: b4.fields || 0, calcs: b4.calcs || 0, paints: b4.paints || 0, actions: Qn4(d), lists: (d.hasAttribute("items") ? 1 : 0) + d.querySelectorAll("[items]").length, rows: d.querySelectorAll("[item]:not([template])").length, warnings: g2.diag.warnings.length, errors: g2.diag.errors.length, mountWrites: g2._mountWrites || 0, ms: Math.round((g2._mountMs || 0) * 10) / 10, passes: g2._passes || 0, lastPass: g2._lastPass || null, ok: g2.diag.errors.length === 0 && !g2.halted };
74091
+ }
74092
+ function r44() {
74093
+ let g2 = t2.apps().map(e20);
74094
+ return { ok: g2.every((b4) => b4.ok), apps: g2 };
74095
+ }
74096
+ function n3(g2) {
74097
+ let b4 = e20(g2);
74098
+ return b4.ok ? `sap \u2713 ${b4.root} \xB7 fields ${b4.fields} \xB7 calcs ${b4.calcs} \xB7 paints ${b4.paints} \xB7 actions ${b4.actions} \xB7 lists ${b4.lists} \xB7 rows ${b4.rows} \xB7 warnings ${b4.warnings} \xB7 mount writes ${b4.mountWrites} \xB7 ${b4.ms}ms` : `sap \u2717 ${b4.root} \xB7 errors ${b4.errors} \xB7 warnings ${b4.warnings} \xB7 ${b4.ms}ms`;
74099
+ }
74100
+ function o3() {
74101
+ for (let g2 of t2.apps()) {
74102
+ let b4 = n3(g2);
74103
+ g2.diag.errors.length || g2.halted ? console.error(b4) : console.log(b4);
74104
+ }
74105
+ }
74106
+ function s2() {
74107
+ let g2 = [], b4 = [];
74108
+ for (let d of t2.apps()) g2.push(...d.diag.errors), b4.push(...d.diag.warnings);
74109
+ return { ok: g2.length === 0, errors: g2, warnings: b4, counts: { errors: g2.length, warnings: b4.length } };
74110
+ }
74111
+ function a2(g2) {
74112
+ let b4 = g2 === void 0 ? true : !!g2;
74113
+ for (let d of t2.apps()) d._debug = b4;
74114
+ return console.log(`sap debug ${b4 ? "on" : "off"} \u2014 per-pass headers will ${b4 ? "" : "no longer "}log`), b4;
74115
+ }
74116
+ return { status: r44, report: s2, debug: a2, greenLine: n3, printGreenLines: o3, REGISTRY: Bt5 };
74117
+ }
74118
+ var Ge6 = "0.6.0";
74119
+ function Ye6({ createAccessor: t2, installInput: e20, debugExtras: r44 }) {
74120
+ let n3 = /* @__PURE__ */ new Map(), o3 = [], s2 = ee6(it6);
74121
+ function a2(i2) {
74122
+ let l2 = i2;
74123
+ for (; l2; ) {
74124
+ if (l2.nodeType === 1 && l2.hasAttribute && l2.hasAttribute("sap")) return n3.get(l2) || null;
74125
+ l2 = l2.parentNode && l2.parentNode.host ? l2.parentNode.host : l2.parentElement;
74126
+ }
74127
+ return null;
74128
+ }
74129
+ function g2() {
74130
+ for (let i2 = o3.length - 1; i2 >= 0; i2--) {
74131
+ let l2 = o3[i2];
74132
+ l2.root.isConnected || (n3.delete(l2.root), o3.splice(i2, 1));
74133
+ }
74134
+ }
74135
+ function b4(i2, l2) {
74136
+ if (i2.moveBefore) try {
74137
+ i2.moveBefore(l2, null);
74138
+ return;
74139
+ } catch {
74140
+ }
74141
+ i2.appendChild(l2);
74142
+ }
74143
+ function d(i2, l2) {
74144
+ let m4 = l2.parentElement;
74145
+ if (m4) {
74146
+ if (m4.moveBefore) try {
74147
+ m4.moveBefore(i2, l2);
74148
+ return;
74149
+ } catch {
74150
+ }
74151
+ m4.insertBefore(i2, l2);
74152
+ }
74153
+ }
74154
+ let u3 = { apps: () => o3.slice(), appFor: a2, isRegistered: (i2) => n3.has(i2), pruneDisconnected: g2, schedule: (i2, l2) => s2.schedule(i2, l2), runNow: (i2, l2) => s2.runNow(i2, l2), moveInto: b4, placeBefore: d, remountIfPresent: () => v5() }, E4 = t2(u3), S4 = Ue6(u3), k5 = r44 ? r44(u3, S4) : {}, _4 = false, h = false, A4 = null;
74155
+ function p3() {
74156
+ _4 || (_4 = true, e20(u3, E4, document), A4 = Ne6(u3));
74157
+ }
74158
+ function w4() {
74159
+ let i2 = L7("derived");
74160
+ i2 && typeof i2.mounted == "function" && i2.mounted();
74161
+ }
74162
+ function v5(i2 = document) {
74163
+ if (h) return [];
74164
+ p3(), Yt5(u3);
74165
+ let l2 = i2.querySelectorAll("[sap]"), m4 = [];
74166
+ for (let y4 of l2) {
74167
+ if (n3.has(y4)) continue;
74168
+ let x6 = te6(y4);
74169
+ n3.set(y4, x6), o3.push(x6), m4.push(x6);
74170
+ }
74171
+ for (let y4 of m4) {
74172
+ let x6 = S4.greenLine(y4);
74173
+ y4.diag.errors.length || y4.halted ? console.error(x6) : console.log(x6);
74174
+ }
74175
+ return w4(), m4;
74176
+ }
74177
+ function f3(i2) {
74178
+ if (h) return null;
74179
+ if (p3(), Yt5(u3), !i2) return v5();
74180
+ let l2 = typeof i2 == "string" ? document.querySelector(i2) : i2;
74181
+ if (!l2) return null;
74182
+ if (n3.has(l2)) return n3.get(l2);
74183
+ let m4 = te6(l2);
74184
+ n3.set(l2, m4), o3.push(m4);
74185
+ let y4 = S4.greenLine(m4);
74186
+ return m4.diag.errors.length || m4.halted ? console.error(y4) : console.log(y4), m4;
74187
+ }
74188
+ let c3 = E4.Sap;
74189
+ return c3.version = Ge6, c3.refresh = function() {
74190
+ for (let l2 of o3) l2.root.isConnected && s2.runNow(l2, "refresh");
74191
+ }, c3.batch = Te6, c3.status = S4.status, c3.report = S4.report, c3.why = k5.why, c3.debug = S4.debug, c3.doctor = k5.doctor, c3.greenLine = S4.greenLine, c3.formats = et6, c3.serializeControlToAttributes = nt6, c3.finalizeControlForSave = Se6, c3.rehydrateControlFromAttributes = Lt5, c3.mount = f3, c3.config = function(l2 = {}) {
74192
+ return l2.formats && Object.assign(et6, l2.formats), c3;
74193
+ }, c3._registry = n3, c3._reset = function() {
74194
+ n3.clear(), o3.length = 0, Xt5();
74195
+ }, c3.unmount = function() {
74196
+ h = true, n3.clear(), o3.length = 0, Xt5(), typeof A4 == "function" && A4();
74197
+ }, { Sap: c3, mountAll: v5, mount: f3, runtime: u3 };
74198
+ }
74199
+ function Xe6(t2) {
74200
+ if (typeof document > "u") return;
74201
+ let e20 = () => $e6(() => t2());
74202
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e20) : e20();
74203
+ }
74204
+ var Zn3 = ["for", "form", "list", "headers", "popovertarget", "commandfor", "anchor", "aria-activedescendant", "aria-controls", "aria-describedby", "aria-details", "aria-errormessage", "aria-flowto", "aria-labelledby", "aria-owns"];
74205
+ function tr4(t2, e20) {
73892
74206
  let r44 = null;
73893
- return et6(t2, (n3) => {
74207
+ return O4(t2, (n3) => {
73894
74208
  !r44 && n3.getAttribute("scope") === e20 && (r44 = n3);
73895
74209
  }), r44;
73896
74210
  }
73897
- function dn3(t2, e20, r44) {
73898
- let n3 = Q6(t2) || e20;
74211
+ function Ke6(t2, e20, r44) {
74212
+ let n3 = F5(t2) || e20;
73899
74213
  for (; n3; ) {
73900
- for (let o3 of V7(n3.getAttribute("state") || "")) if (o3.name === r44) return { el: n3, decl: o3 };
74214
+ for (let o3 of C5(n3.getAttribute("state") || "")) if (o3.name === r44) return { el: n3, decl: o3 };
73901
74215
  if (n3.hasAttribute("sap")) break;
73902
- n3 = Q6(n3.parentElement);
74216
+ n3 = F5(n3.parentElement);
73903
74217
  }
73904
74218
  return null;
73905
74219
  }
73906
- function dr4(t2) {
74220
+ function er2(t2) {
73907
74221
  return typeof t2 == "number" ? "num" : typeof t2 == "boolean" ? "bool" : "string";
73908
74222
  }
73909
- function pn4(t2) {
73910
- function e20(m4) {
73911
- let d = t2.appFor(m4);
73912
- if (!d) return null;
73913
- let p3 = lt6(m4), y4 = p3 && p3._sapEachItem && p3._sapEachItem.$el;
73914
- if (y4 && y4.isConnected) return { ctxEl: y4, appRec: d, isRow: true };
73915
- let E4 = Lt5(m4);
73916
- if (E4) return E4._sapDetailRow ? { ctxEl: E4._sapDetailRow, appRec: d, isRow: true } : { ctxEl: Q6(E4.parentElement) || d.root, appRec: d, isRow: false };
73917
- let S4 = Wt6(m4);
73918
- if (S4 && S4.hasAttribute("item")) return { ctxEl: S4, appRec: d, isRow: true };
73919
- let _4 = Q6(m4) || d.root;
73920
- return { ctxEl: _4, appRec: d, isRow: _4.hasAttribute("item") };
73921
- }
73922
- function r44(m4) {
73923
- let d = typeof m4 == "string" ? document.querySelector(m4) : m4;
73924
- if (!d || d.nodeType !== 1) return null;
73925
- let p3 = e20(d);
73926
- return p3 ? z5(p3.ctxEl, p3.appRec, p3.isRow) : null;
73927
- }
73928
- function n3(m4, d) {
73929
- let p3 = lt6(m4);
73930
- if (!p3) return r44(m4);
73931
- let y4 = t2.appFor(m4), E4 = p3._sapEachItem && p3._sapEachItem.$el;
73932
- if (E4 && E4.nodeType === 1 && E4.hasAttribute("item") && wt6(E4, d)) return E4.isConnected ? z5(E4, y4, true) : null;
73933
- let S4 = p3.parentElement && p3.parentElement._sapDrawnEl;
73934
- return !S4 || !S4.isConnected ? null : z5(S4, y4, S4.hasAttribute("item"));
73935
- }
73936
- function o3(m4, d, p3) {
73937
- let y4 = ft5(m4, p3);
73938
- if (y4) return G5(y4).read();
73939
- let E4 = gt6(m4, p3);
73940
- if (E4) return rt6(E4).map((H6) => z5(H6, d, true));
73941
- let S4 = fr4(m4, p3);
73942
- if (S4) return z5(S4, d, false);
73943
- let _4 = dn3(m4, d.root, p3);
73944
- if (_4) return _4.decl.transient ? zt5(_4.el, _4.decl) : $e6(_4.el, _4.decl);
73945
- let M6 = m4._sapScope;
73946
- return M6 ? M6[p3] : void 0;
73947
- }
73948
- function s2(m4, d, p3, y4, E4) {
73949
- y4.transient ? Dt6(m4, y4, p3) : Rt6(m4, y4, p3), t2.schedule(E4, "set:" + d);
73950
- }
73951
- function a2(m4, d) {
73952
- let p3 = /* @__PURE__ */ new Set(), y4 = Q6(m4) || d;
73953
- for (; y4; ) {
73954
- for (let E4 of V7(y4.getAttribute("state") || "")) p3.add(E4.name);
73955
- if (y4.hasAttribute("sap")) break;
73956
- y4 = Q6(y4.parentElement);
74223
+ function Je6(t2) {
74224
+ function e20(h) {
74225
+ let A4 = t2.appFor(h);
74226
+ if (!A4) return null;
74227
+ let p3 = H6(h), w4 = p3 && p3._sapEachItem && p3._sapEachItem.$el;
74228
+ if (w4 && w4.isConnected) return { ctxEl: w4, appRec: A4, isRow: true };
74229
+ let v5 = ct6(h);
74230
+ if (v5) return v5._sapDetailRow ? { ctxEl: v5._sapDetailRow, appRec: A4, isRow: true } : { ctxEl: F5(v5.parentElement) || A4.root, appRec: A4, isRow: false };
74231
+ let f3 = Et6(h);
74232
+ if (f3 && f3.hasAttribute("item")) return { ctxEl: f3, appRec: A4, isRow: true };
74233
+ let c3 = F5(h) || A4.root;
74234
+ return { ctxEl: c3, appRec: A4, isRow: c3.hasAttribute("item") };
74235
+ }
74236
+ function r44(h) {
74237
+ let A4 = typeof h == "string" ? document.querySelector(h) : h;
74238
+ if (!A4 || A4.nodeType !== 1) return null;
74239
+ let p3 = e20(A4);
74240
+ return p3 ? _4(p3.ctxEl, p3.appRec, p3.isRow) : null;
74241
+ }
74242
+ function n3(h, A4) {
74243
+ let p3 = H6(h);
74244
+ if (!p3) return r44(h);
74245
+ let w4 = t2.appFor(h), v5 = p3._sapEachItem && p3._sapEachItem.$el;
74246
+ if (v5 && v5.nodeType === 1 && v5.hasAttribute("item") && tt6(v5, A4)) return v5.isConnected ? _4(v5, w4, true) : null;
74247
+ let f3 = p3.parentElement && p3.parentElement._sapDrawnEl;
74248
+ return !f3 || !f3.isConnected ? null : _4(f3, w4, f3.hasAttribute("item"));
74249
+ }
74250
+ function o3(h, A4, p3) {
74251
+ let w4 = U6(h, p3);
74252
+ if (w4) return R5(w4).read();
74253
+ let v5 = Z7(h, p3);
74254
+ if (v5) return W6(v5).map((l2) => _4(l2, A4, true));
74255
+ let f3 = tr4(h, p3);
74256
+ if (f3) return _4(f3, A4, false);
74257
+ let c3 = Ke6(h, A4.root, p3);
74258
+ if (c3) return c3.decl.transient ? St6(c3.el, c3.decl) : ie6(c3.el, c3.decl);
74259
+ let i2 = h._sapScope;
74260
+ return i2 ? i2[p3] : void 0;
74261
+ }
74262
+ function s2(h, A4, p3, w4, v5) {
74263
+ w4.transient ? dt6(h, w4, p3) : lt6(h, w4, p3), t2.schedule(v5, "set:" + A4);
74264
+ }
74265
+ function a2(h, A4) {
74266
+ let p3 = /* @__PURE__ */ new Set(), w4 = F5(h) || A4;
74267
+ for (; w4; ) {
74268
+ for (let v5 of C5(w4.getAttribute("state") || "")) p3.add(v5.name);
74269
+ if (w4.hasAttribute("sap")) break;
74270
+ w4 = F5(w4.parentElement);
73957
74271
  }
73958
- return et6(m4, (E4) => {
73959
- let S4 = E4.getAttribute("bind");
73960
- S4 && p3.add(S4);
74272
+ return O4(h, (v5) => {
74273
+ let f3 = v5.getAttribute("bind");
74274
+ f3 && p3.add(f3);
73961
74275
  }), p3;
73962
74276
  }
73963
- function k5(m4, d, p3, y4) {
73964
- let E4 = ft5(m4, p3);
73965
- if (E4) {
73966
- G5(E4).write(y4);
74277
+ function g2(h, A4, p3, w4) {
74278
+ let v5 = U6(h, p3);
74279
+ if (v5) {
74280
+ R5(v5).write(w4);
73967
74281
  return;
73968
74282
  }
73969
- let S4 = m4;
73970
- for (; S4; ) {
73971
- for (let x6 of S4.attributes) if (x6.name === "calc:" + p3) {
73972
- d.diag.error("E16", S4, { attr: "calc:" + p3, problem: `"${p3}" is a computed field; computed fields are read-only` });
74283
+ let f3 = h;
74284
+ for (; f3; ) {
74285
+ for (let T5 of f3.attributes) if (T5.name === "calc:" + p3) {
74286
+ A4.diag.error("E16", f3, { attr: "calc:" + p3, problem: `"${p3}" is a computed field; computed fields are read-only` });
73973
74287
  return;
73974
74288
  }
73975
- if (S4.hasAttribute("sap")) break;
73976
- S4 = S4.parentElement;
74289
+ if (f3.hasAttribute("sap")) break;
74290
+ f3 = f3.parentElement;
73977
74291
  }
73978
- let _4 = dn3(m4, d.root, p3);
73979
- if (_4) {
73980
- s2(_4.el, p3, y4, _4.decl, d);
74292
+ let c3 = Ke6(h, A4.root, p3);
74293
+ if (c3) {
74294
+ s2(c3.el, p3, w4, c3.decl, A4);
73981
74295
  return;
73982
74296
  }
73983
- let M6 = a2(m4, d.root);
73984
- M6.delete(p3);
73985
- let H6 = p3.length >= 4 ? Nt4(p3, [...M6]) : null;
73986
- if (H6) {
73987
- d.diag.error("E12", m4, { key: p3, problem: `unknown state key "${p3}"`, didYouMean: H6 });
74297
+ let i2 = a2(h, A4.root);
74298
+ i2.delete(p3);
74299
+ let l2 = p3.length >= 4 ? ut6(p3, [...i2]) : null;
74300
+ if (l2) {
74301
+ A4.diag.error("E12", h, { key: p3, problem: `unknown state key "${p3}"`, didYouMean: l2 });
73988
74302
  return;
73989
74303
  }
73990
- if (It6.has(p3) || Tt6.has(p3)) {
73991
- d.diag.error("E15", m4, { key: p3, problem: `cannot write undeclared field "${p3}" \u2014 it is a reserved/global name and cannot become state`, fix: "pick a different field name, or declare it explicitly in a state= attribute" });
74304
+ if (wt6.has(p3) || at5.has(p3)) {
74305
+ A4.diag.error("E15", h, { key: p3, problem: `cannot write undeclared field "${p3}" \u2014 it is a reserved/global name and cannot become state`, fix: "pick a different field name, or declare it explicitly in a state= attribute" });
73992
74306
  return;
73993
74307
  }
73994
- let c3 = d.root, u3 = dr4(y4), b4 = c3.getAttribute("state") || "", v5 = u3 === "string" ? p3 : `${p3}:${u3}`;
73995
- c3.setAttribute("state", b4 ? `${b4} ${v5}` : v5), s2(c3, p3, y4, { name: p3, attr: p3, type: u3, transient: false }, d);
74308
+ let m4 = A4.root, y4 = er2(w4), x6 = m4.getAttribute("state") || "", $6 = y4 === "string" ? p3 : `${p3}:${y4}`;
74309
+ m4.setAttribute("state", x6 ? `${x6} ${$6}` : $6), s2(m4, p3, w4, { name: p3, attr: p3, type: y4, transient: false }, A4);
73996
74310
  }
73997
- function $6(m4) {
73998
- let d = m4.ownerDocument, p3 = /* @__PURE__ */ new Map(), y4 = (E4, S4) => {
73999
- let _4 = Se6(d), M6 = E4.getAttribute(S4);
74000
- M6 && S4 === "id" && p3.set(M6, _4), E4.setAttribute(S4, _4);
74311
+ function b4(h) {
74312
+ let A4 = h.ownerDocument, p3 = /* @__PURE__ */ new Map(), w4 = (v5, f3) => {
74313
+ let c3 = re5(A4), i2 = v5.getAttribute(f3);
74314
+ i2 && f3 === "id" && p3.set(i2, c3), v5.setAttribute(f3, c3);
74001
74315
  };
74002
- m4.querySelectorAll("[id]").forEach((E4) => y4(E4, "id")), m4.querySelectorAll("[data-id]").forEach((E4) => y4(E4, "data-id")), m4.querySelectorAll("[sap-error]").forEach((E4) => E4.removeAttribute("sap-error")), m4.removeAttribute("sap-error"), m4.hasAttribute("data-id") ? (m4.removeAttribute("id"), y4(m4, "data-id")) : y4(m4, "id");
74003
- for (let E4 of [m4, ...m4.querySelectorAll("*")]) for (let S4 of lr4) {
74004
- let _4 = E4.getAttribute(S4);
74005
- if (_4 == null) continue;
74006
- let M6 = _4.split(/\s+/).map((H6) => p3.get(H6) || H6).join(" ");
74007
- M6 !== _4 && E4.setAttribute(S4, M6);
74316
+ h.querySelectorAll("[id]").forEach((v5) => w4(v5, "id")), h.querySelectorAll("[data-id]").forEach((v5) => w4(v5, "data-id")), h.querySelectorAll("[sap-error]").forEach((v5) => v5.removeAttribute("sap-error")), h.removeAttribute("sap-error"), h.hasAttribute("data-id") ? (h.removeAttribute("id"), w4(h, "data-id")) : w4(h, "id");
74317
+ for (let v5 of [h, ...h.querySelectorAll("*")]) for (let f3 of Zn3) {
74318
+ let c3 = v5.getAttribute(f3);
74319
+ if (c3 == null) continue;
74320
+ let i2 = c3.split(/\s+/).map((l2) => p3.get(l2) || l2).join(" ");
74321
+ i2 !== c3 && v5.setAttribute(f3, i2);
74008
74322
  }
74009
74323
  }
74010
- function A4(m4, d, p3) {
74011
- let y4 = Mt6(d.root, m4, p3);
74012
- if (!y4) return d.diag.error("E17", m4, { problem: `cannot resolve a list named "${p3}" from here` }), null;
74013
- let E4 = Vt5(y4);
74014
- if (!E4) return d.diag.error("E17", y4, { problem: `items="${p3}" has no [item template] to clone` }), null;
74015
- let S4 = y4.ownerDocument.importNode(E4, true);
74016
- return S4.removeAttribute("template"), $6(S4), y4.appendChild(S4), t2.schedule(d, "trigger-add:" + p3), z5(S4, d, true);
74324
+ function d(h, A4, p3) {
74325
+ let w4 = pt6(A4.root, h, p3);
74326
+ if (!w4) return A4.diag.error("E17", h, { problem: `cannot resolve a list named "${p3}" from here` }), null;
74327
+ let v5 = xt6(w4);
74328
+ if (!v5) return A4.diag.error("E17", w4, { problem: `items="${p3}" has no [item template] to clone` }), null;
74329
+ let f3 = w4.ownerDocument.importNode(v5, true);
74330
+ return f3.removeAttribute("template"), b4(f3), w4.appendChild(f3), t2.schedule(A4, "trigger-add:" + p3), _4(f3, A4, true);
74017
74331
  }
74018
- function l2(m4, d) {
74019
- et6(m4, (p3) => {
74332
+ function u3(h, A4) {
74333
+ O4(h, (p3) => {
74020
74334
  if (p3.hasAttribute("bind")) {
74021
- let y4 = G5(p3), E4 = p3.getAttribute("default");
74022
- y4.kind === "checkbox" || y4.kind === "radio" ? y4.write(E4 != null ? E4 === "" || E4 === "true" || p3.value === E4 : p3.hasAttribute("checked")) : y4.write(E4 ?? (p3.getAttribute("value") || ""));
74335
+ let w4 = R5(p3), v5 = p3.getAttribute("default");
74336
+ w4.kind === "checkbox" || w4.kind === "radio" ? w4.write(v5 != null ? v5 === "" || v5 === "true" || p3.value === v5 : p3.hasAttribute("checked")) : w4.write(v5 ?? (p3.getAttribute("value") || ""));
74023
74337
  }
74024
74338
  });
74025
- for (let p3 of V7(m4.getAttribute("state") || "")) {
74026
- let y4 = _e6(m4, p3);
74027
- p3.transient ? Dt6(m4, p3, y4) : Rt6(m4, p3, y4);
74339
+ for (let p3 of C5(h.getAttribute("state") || "")) {
74340
+ let w4 = se6(h, p3);
74341
+ p3.transient ? dt6(h, p3, w4) : lt6(h, p3, w4);
74028
74342
  }
74029
- t2.schedule(d, "trigger-reset");
74343
+ t2.schedule(A4, "trigger-reset");
74030
74344
  }
74031
- function w4(m4, d) {
74032
- if (!m4.isConnected) throw new Error("stale row handle: $remove() on a removed row");
74033
- m4.remove(), t2.schedule(d, "trigger-remove");
74345
+ function E4(h, A4) {
74346
+ if (!h.isConnected) throw new Error("stale row handle: $remove() on a removed row");
74347
+ h.remove(), t2.schedule(A4, "trigger-remove");
74034
74348
  }
74035
- function N16(m4, d, p3) {
74036
- if (!m4.isConnected) throw new Error("stale row handle: $move() on a removed row");
74037
- let y4 = null;
74038
- if (p3 && p3.nodeType === 1 ? y4 = p3 : typeof p3 == "string" && (y4 = Mt6(d.root, m4, p3)), !y4) {
74039
- d.diag.error("E17", m4, { problem: `$move() cannot resolve target "${p3}"` });
74349
+ function S4(h, A4, p3) {
74350
+ if (!h.isConnected) throw new Error("stale row handle: $move() on a removed row");
74351
+ let w4 = null;
74352
+ if (p3 && p3.nodeType === 1 ? w4 = p3 : typeof p3 == "string" && (w4 = pt6(A4.root, h, p3)), !w4) {
74353
+ A4.diag.error("E17", h, { problem: `$move() cannot resolve target "${p3}"` });
74040
74354
  return;
74041
74355
  }
74042
- t2.moveInto(y4, m4), t2.schedule(d, "trigger-move");
74356
+ t2.moveInto(w4, h), t2.schedule(A4, "trigger-move");
74043
74357
  }
74044
- function P7(m4) {
74045
- let d = m4.parentElement;
74046
- return d ? rt6(d).indexOf(m4) : -1;
74358
+ function k5(h) {
74359
+ let A4 = h.parentElement;
74360
+ return A4 ? W6(A4).indexOf(h) : -1;
74047
74361
  }
74048
- function z5(m4, d, p3) {
74049
- let y4 = { get $el() {
74050
- return m4;
74362
+ function _4(h, A4, p3) {
74363
+ let w4 = { get $el() {
74364
+ return h;
74051
74365
  }, get $key() {
74052
- return Bt5(m4, p3 ? "row" : "scope");
74366
+ return At5(h, p3 ? "row" : "scope");
74053
74367
  }, get $index() {
74054
- return P7(m4);
74055
- }, $add(S4) {
74056
- return A4(m4, d, S4);
74368
+ return k5(h);
74369
+ }, $add(f3) {
74370
+ return d(h, A4, f3);
74057
74371
  }, $reset() {
74058
- return l2(m4, d), E4;
74372
+ return u3(h, A4), v5;
74059
74373
  }, $remove() {
74060
- w4(m4, d);
74061
- }, $move(S4) {
74062
- N16(m4, d, S4);
74374
+ E4(h, A4);
74375
+ }, $move(f3) {
74376
+ S4(h, A4, f3);
74063
74377
  }, get $appRec() {
74064
- return d;
74065
- } }, E4 = new Proxy(y4, { get(S4, _4) {
74066
- return typeof _4 == "symbol" || _4[0] === "$" ? S4[_4] : o3(m4, d, _4);
74067
- }, set(S4, _4, M6) {
74068
- return typeof _4 == "string" && _4[0] === "$" ? (S4[_4] = M6, true) : (k5(m4, d, _4, M6), true);
74069
- }, has(S4, _4) {
74070
- return typeof _4 == "string" && _4[0] === "$" ? _4 in S4 : o3(m4, d, _4) !== void 0;
74378
+ return A4;
74379
+ } }, v5 = new Proxy(w4, { get(f3, c3) {
74380
+ return typeof c3 == "symbol" || c3[0] === "$" ? f3[c3] : o3(h, A4, c3);
74381
+ }, set(f3, c3, i2) {
74382
+ return typeof c3 == "string" && c3[0] === "$" ? (f3[c3] = i2, true) : (g2(h, A4, c3, i2), true);
74383
+ }, has(f3, c3) {
74384
+ return typeof c3 == "string" && c3[0] === "$" ? c3 in f3 : o3(h, A4, c3) !== void 0;
74071
74385
  } });
74072
- return E4;
74386
+ return v5;
74073
74387
  }
74074
- return { Sap: r44, contextElFor: e20, readField: o3, writeField: k5, makeProxy: z5, writeTargetFor: n3 };
74388
+ return { Sap: r44, contextElFor: e20, readField: o3, writeField: g2, makeProxy: _4, writeTargetFor: n3 };
74075
74389
  }
74076
- var pr4 = ["trigger-add", "trigger-remove", "trigger-reset"];
74077
- function mr4(t2) {
74390
+ var nr4 = ["trigger-add", "trigger-remove", "trigger-reset"];
74391
+ function rr3(t2) {
74078
74392
  if (t2.nodeType !== 1) return false;
74079
74393
  for (let e20 of t2.attributes) {
74080
74394
  let r44 = e20.name;
74081
- if (r44.startsWith("set:") || r44.startsWith("move:") || r44.startsWith("sort:") || pr4.includes(r44)) return true;
74395
+ if (r44.startsWith("set:") || r44.startsWith("move:") || r44.startsWith("sort:") || nr4.includes(r44)) return true;
74082
74396
  }
74083
74397
  return false;
74084
74398
  }
74085
- function hr4(t2, e20) {
74399
+ function or4(t2, e20) {
74086
74400
  let r44 = t2, n3 = e20.parentElement;
74087
74401
  for (; r44 && r44 !== n3; ) {
74088
- if (r44.nodeType === 1 && mr4(r44) && !(r44.tagName === "FORM" && r44.hasAttribute("trigger-add"))) return r44;
74402
+ if (r44.nodeType === 1 && rr3(r44) && !(r44.tagName === "FORM" && r44.hasAttribute("trigger-add"))) return r44;
74089
74403
  r44 = r44.parentElement;
74090
74404
  }
74091
74405
  return null;
74092
74406
  }
74093
- function mn3(t2, e20) {
74407
+ function Qe6(t2, e20) {
74094
74408
  let { Sap: r44 } = e20;
74095
- function n3(c3, u3) {
74096
- let b4 = null, v5 = lt6(c3), x6 = Lt5(c3);
74097
- if (v5) b4 = v5._sapEachItem ?? null;
74098
- else if (x6 && x6._sapDetailRow) b4 = x6._sapDetailRow._sapScope || null;
74409
+ function n3(f3, c3) {
74410
+ let i2 = null, l2 = H6(f3), m4 = ct6(f3);
74411
+ if (l2) i2 = l2._sapEachItem ?? null;
74412
+ else if (m4 && m4._sapDetailRow) i2 = m4._sapDetailRow._sapScope || null;
74099
74413
  else {
74100
- let R5 = Wt6(c3);
74101
- R5 && R5.hasAttribute("item") && (b4 = R5._sapScope || null);
74414
+ let $6 = Et6(f3);
74415
+ $6 && $6.hasAttribute("item") && (i2 = $6._sapScope || null);
74102
74416
  }
74103
- return { state: (Q6(c3) || u3.root)._sapScope || u3._state || {}, item: b4, el: c3, root: u3._state || {} };
74417
+ return { state: (F5(f3) || c3.root)._sapScope || c3._state || {}, item: i2, el: f3, root: c3._state || {} };
74104
74418
  }
74105
- function o3(c3, u3, b4) {
74106
- if (!c3.hasAttribute("confirm")) {
74107
- b4();
74419
+ function o3(f3, c3, i2) {
74420
+ if (!f3.hasAttribute("confirm")) {
74421
+ i2();
74108
74422
  return;
74109
74423
  }
74110
- let v5 = c3.getAttribute("confirm"), x6 = v5, L7 = q7(v5);
74111
- if (!L7.error) try {
74112
- let F5 = Et6(L7, n3(c3, u3));
74113
- (typeof F5 == "string" || typeof F5 == "number") && (x6 = String(F5));
74424
+ let l2 = f3.getAttribute("confirm"), m4 = l2, y4 = N16(l2);
74425
+ if (!y4.error) try {
74426
+ let T5 = Y5(y4, n3(f3, c3));
74427
+ (typeof T5 == "string" || typeof T5 == "number") && (m4 = String(T5));
74114
74428
  } catch {
74115
74429
  }
74116
- let C5 = Ye6();
74117
- if (!C5) {
74118
- window.confirm(x6) && b4();
74430
+ let x6 = _e6();
74431
+ if (!x6) {
74432
+ window.confirm(m4) && i2();
74119
74433
  return;
74120
74434
  }
74121
- if (c3._sapGatePending) return;
74122
- c3._sapGatePending = true;
74123
- let R5 = () => {
74124
- c3._sapGatePending = false;
74435
+ if (f3._sapGatePending) return;
74436
+ f3._sapGatePending = true;
74437
+ let $6 = () => {
74438
+ f3._sapGatePending = false;
74125
74439
  };
74126
- C5(x6, () => {
74127
- R5(), b4();
74128
- }).catch(R5);
74129
- }
74130
- function s2(c3, u3) {
74131
- for (let b4 of c3.attributes) {
74132
- if (!b4.name.startsWith("set:")) continue;
74133
- let v5 = b4.name.slice(4), x6 = q7(b4.value);
74134
- if (x6.error) {
74135
- u3.diag.error("E08", c3, { attr: b4.name, expr: b4.value, problem: String(x6.error.message) });
74440
+ x6(m4, () => {
74441
+ $6(), i2();
74442
+ }).catch($6);
74443
+ }
74444
+ function s2(f3, c3) {
74445
+ for (let i2 of f3.attributes) {
74446
+ if (!i2.name.startsWith("set:")) continue;
74447
+ let l2 = i2.name.slice(4), m4 = N16(i2.value);
74448
+ if (m4.error) {
74449
+ c3.diag.error("E08", f3, { attr: i2.name, expr: i2.value, problem: String(m4.error.message) });
74136
74450
  continue;
74137
74451
  }
74138
- let L7;
74452
+ let y4;
74139
74453
  try {
74140
- L7 = Et6(x6, n3(c3, u3));
74141
- } catch (R5) {
74142
- u3.diag.error("E24", c3, { attr: b4.name, expr: b4.value, problem: String(R5.message) });
74454
+ y4 = Y5(m4, n3(f3, c3));
74455
+ } catch ($6) {
74456
+ c3.diag.error("E24", f3, { attr: i2.name, expr: i2.value, problem: String($6.message) });
74143
74457
  continue;
74144
74458
  }
74145
- let C5 = e20.writeTargetFor(c3, v5);
74146
- C5 && (C5[v5] = L7);
74459
+ let x6 = e20.writeTargetFor(f3, l2);
74460
+ x6 && (x6[l2] = y4);
74147
74461
  }
74148
74462
  }
74149
- function a2(c3) {
74150
- let u3 = lt6(c3);
74151
- if (!u3) return c3.closest("[item]");
74152
- let b4 = u3._sapEachItem && u3._sapEachItem.$el;
74153
- return b4 && b4.nodeType === 1 && b4.hasAttribute("item") ? b4 : null;
74154
- }
74155
- function k5(c3, u3) {
74156
- let b4 = a2(c3);
74157
- if (!b4) return;
74158
- let v5 = rt6(b4.parentElement), x6 = v5.indexOf(b4);
74159
- u3 === "up" && x6 > 0 ? t2.placeBefore(b4, v5[x6 - 1]) : u3 === "down" && x6 < v5.length - 1 && t2.placeBefore(v5[x6 + 1], b4);
74160
- }
74161
- function $6(c3, u3, b4) {
74162
- if (u3) return Mt6(b4.root, c3, u3);
74163
- let v5 = c3;
74164
- for (; v5; ) {
74165
- if (v5.hasAttribute && v5.hasAttribute("items")) return v5;
74166
- v5 = v5.parentElement;
74463
+ function a2(f3) {
74464
+ let c3 = H6(f3);
74465
+ if (!c3) return f3.closest("[item]");
74466
+ let i2 = c3._sapEachItem && c3._sapEachItem.$el;
74467
+ return i2 && i2.nodeType === 1 && i2.hasAttribute("item") ? i2 : null;
74468
+ }
74469
+ function g2(f3, c3) {
74470
+ let i2 = a2(f3);
74471
+ if (!i2) return;
74472
+ let l2 = W6(i2.parentElement), m4 = l2.indexOf(i2);
74473
+ c3 === "up" && m4 > 0 ? t2.placeBefore(i2, l2[m4 - 1]) : c3 === "down" && m4 < l2.length - 1 && t2.placeBefore(l2[m4 + 1], i2);
74474
+ }
74475
+ function b4(f3, c3, i2) {
74476
+ if (c3) return pt6(i2.root, f3, c3);
74477
+ let l2 = f3;
74478
+ for (; l2; ) {
74479
+ if (l2.hasAttribute && l2.hasAttribute("items")) return l2;
74480
+ l2 = l2.parentElement;
74167
74481
  }
74168
- let x6 = Q6(c3) || b4.root, L7 = [];
74169
- return et6(x6, (C5) => {
74170
- C5.hasAttribute("items") && L7.push(C5);
74171
- }), L7[0] || null;
74172
- }
74173
- function A4(c3, u3) {
74174
- let b4 = c3 == null || c3 === "", v5 = u3 == null || u3 === "";
74175
- if (b4 && v5) return 0;
74176
- if (b4) return 1;
74177
- if (v5) return -1;
74178
- let x6 = Number(c3), L7 = Number(u3);
74179
- return !Number.isNaN(x6) && !Number.isNaN(L7) ? x6 - L7 : String(c3) < String(u3) ? -1 : String(c3) > String(u3) ? 1 : 0;
74180
- }
74181
- function l2(c3, u3, b4, v5) {
74182
- let x6 = $6(c3, b4, v5);
74183
- if (!x6) {
74184
- v5.diag.error("E17", c3, { attr: "sort:" + u3, problem: `no items list resolvable for sort:${u3}` });
74482
+ let m4 = F5(f3) || i2.root, y4 = [];
74483
+ return O4(m4, (x6) => {
74484
+ x6.hasAttribute("items") && y4.push(x6);
74485
+ }), y4[0] || null;
74486
+ }
74487
+ function d(f3, c3) {
74488
+ let i2 = f3 == null || f3 === "", l2 = c3 == null || c3 === "";
74489
+ if (i2 && l2) return 0;
74490
+ if (i2) return 1;
74491
+ if (l2) return -1;
74492
+ let m4 = Number(f3), y4 = Number(c3);
74493
+ return !Number.isNaN(m4) && !Number.isNaN(y4) ? m4 - y4 : String(f3) < String(c3) ? -1 : String(f3) > String(c3) ? 1 : 0;
74494
+ }
74495
+ function u3(f3, c3, i2, l2) {
74496
+ let m4 = b4(f3, i2, l2);
74497
+ if (!m4) {
74498
+ l2.diag.error("E17", f3, { attr: "sort:" + c3, problem: `no items list resolvable for sort:${c3}` });
74185
74499
  return;
74186
74500
  }
74187
- let L7 = rt6(x6), C5 = (h) => h._sapScope ? h._sapScope[u3] : void 0, R5 = [...L7].sort((h, f3) => A4(C5(h), C5(f3))), i2 = R5.every((h, f3) => h === L7[f3]) ? [...R5].reverse() : R5;
74188
- for (let h of i2) t2.moveInto(x6, h);
74189
- t2.schedule(v5, "sort:" + u3);
74190
- }
74191
- function w4(c3) {
74192
- if (!c3 || c3.hidden) return;
74193
- let u3 = c3.querySelector("[bind]:not([type=hidden]), [contenteditable]");
74194
- u3 && typeof u3.focus == "function" && u3.focus();
74195
- }
74196
- function N16(c3, u3) {
74197
- o3(c3, u3, () => {
74198
- let b4 = r44(c3);
74199
- for (let v5 of [...c3.attributes]) {
74200
- let x6 = v5.name;
74201
- if (x6 === "trigger-remove") b4 && b4.$remove();
74202
- else if (x6 === "trigger-reset") b4 && b4.$reset();
74203
- else if (x6 === "trigger-add") {
74204
- let L7 = b4 && b4.$add(v5.value);
74205
- L7 && w4(L7.$el);
74206
- } else x6 === "move:up" ? (k5(c3, "up"), t2.schedule(u3, "move:up")) : x6 === "move:down" ? (k5(c3, "down"), t2.schedule(u3, "move:down")) : x6.startsWith("move:to") ? b4 && b4.$move(v5.value) : x6.startsWith("sort:") && l2(c3, x6.slice(5), v5.value, u3);
74501
+ let y4 = W6(m4), x6 = (D4) => D4._sapScope ? D4._sapScope[c3] : void 0, $6 = [...y4].sort((D4, st6) => d(x6(D4), x6(st6))), gt6 = $6.every((D4, st6) => D4 === y4[st6]) ? [...$6].reverse() : $6;
74502
+ for (let D4 of gt6) t2.moveInto(m4, D4);
74503
+ t2.schedule(l2, "sort:" + c3);
74504
+ }
74505
+ function E4(f3) {
74506
+ if (!f3 || f3.hidden) return;
74507
+ let c3 = f3.querySelector("[bind]:not([type=hidden]), [contenteditable]");
74508
+ c3 && typeof c3.focus == "function" && c3.focus();
74509
+ }
74510
+ function S4(f3, c3) {
74511
+ o3(f3, c3, () => {
74512
+ let i2 = r44(f3);
74513
+ for (let l2 of [...f3.attributes]) {
74514
+ let m4 = l2.name;
74515
+ if (m4 === "trigger-remove") i2 && i2.$remove();
74516
+ else if (m4 === "trigger-reset") i2 && i2.$reset();
74517
+ else if (m4 === "trigger-add") {
74518
+ let y4 = i2 && i2.$add(l2.value);
74519
+ y4 && E4(y4.$el);
74520
+ } else m4 === "move:up" ? (g2(f3, "up"), t2.schedule(c3, "move:up")) : m4 === "move:down" ? (g2(f3, "down"), t2.schedule(c3, "move:down")) : m4.startsWith("move:to") ? i2 && i2.$move(l2.value) : m4.startsWith("sort:") && u3(f3, m4.slice(5), l2.value, c3);
74207
74521
  }
74208
- [...c3.attributes].some((v5) => v5.name.startsWith("set:")) && s2(c3, u3);
74522
+ [...f3.attributes].some((l2) => l2.name.startsWith("set:")) && s2(f3, c3);
74209
74523
  });
74210
74524
  }
74211
- function P7(c3) {
74212
- let u3 = c3.target;
74213
- if (!u3 || u3.nodeType !== 1) return;
74214
- let b4 = t2.appFor(u3);
74215
- if (!b4) return;
74216
- let v5 = hr4(u3, b4.root);
74217
- v5 && N16(v5, b4);
74218
- }
74219
- function z5(c3) {
74220
- let u3 = G5(c3), b4 = c3.getAttribute("default");
74221
- u3.kind === "checkbox" ? u3.write(b4 === "" || b4 === "true") : u3.write(b4 ?? "");
74222
- }
74223
- function m4(c3, u3, b4) {
74224
- let v5 = r44(c3);
74225
- if (!v5) return;
74226
- let x6 = v5.$add(b4);
74227
- if (!x6) return;
74228
- let L7 = [];
74229
- et6(c3, (C5) => {
74230
- C5.hasAttribute("bind") && L7.push(C5);
74525
+ function k5(f3) {
74526
+ let c3 = f3.target;
74527
+ if (!c3 || c3.nodeType !== 1) return;
74528
+ let i2 = t2.appFor(c3);
74529
+ if (!i2) return;
74530
+ let l2 = or4(c3, i2.root);
74531
+ l2 && S4(l2, i2);
74532
+ }
74533
+ function _4(f3) {
74534
+ let c3 = R5(f3), i2 = f3.getAttribute("default");
74535
+ c3.kind === "checkbox" ? c3.write(i2 === "" || i2 === "true") : c3.write(i2 ?? "");
74536
+ }
74537
+ function h(f3, c3, i2) {
74538
+ let l2 = r44(f3);
74539
+ if (!l2) return;
74540
+ let m4 = l2.$add(i2);
74541
+ if (!m4) return;
74542
+ let y4 = [];
74543
+ O4(f3, (x6) => {
74544
+ x6.hasAttribute("bind") && y4.push(x6);
74231
74545
  });
74232
- for (let C5 of L7) {
74233
- if (C5.type === "radio" && !C5.checked) continue;
74234
- let R5 = C5.getAttribute("bind"), F5 = ft5(x6.$el, R5);
74235
- F5 ? G5(F5).write(G5(C5).read()) : wt6(x6.$el, R5) && (x6[R5] = G5(C5).read());
74546
+ for (let x6 of y4) {
74547
+ if (x6.type === "radio" && !x6.checked) continue;
74548
+ let $6 = x6.getAttribute("bind"), T5 = U6(m4.$el, $6);
74549
+ T5 ? R5(T5).write(R5(x6).read()) : tt6(m4.$el, $6) && (m4[$6] = R5(x6).read());
74236
74550
  }
74237
- L7.forEach(z5), L7.length ? typeof L7[0].focus == "function" && L7[0].focus() : w4(x6.$el);
74238
- }
74239
- function d(c3) {
74240
- let u3 = c3.target;
74241
- if (!u3 || !u3.hasAttribute || !u3.hasAttribute("trigger-add")) return;
74242
- let b4 = t2.appFor(u3);
74243
- b4 && (c3.preventDefault(), o3(u3, b4, () => m4(u3, b4, u3.getAttribute("trigger-add"))));
74244
- }
74245
- function p3(c3) {
74246
- let u3 = c3.target, b4 = t2.appFor(u3);
74247
- b4 && setTimeout(() => {
74248
- u3.querySelectorAll("[bind]").forEach((v5) => {
74249
- v5.dispatchEvent(new Event("input", { bubbles: true })), v5.dispatchEvent(new Event("change", { bubbles: true }));
74250
- }), t2.schedule(b4, "reset");
74251
- }, 0);
74252
- }
74253
- function y4(c3) {
74254
- let u3 = t2.appFor(c3.target);
74255
- u3 && t2.schedule(u3, "toggle");
74256
- }
74257
- function E4(c3) {
74258
- let u3 = c3.target;
74259
- if (!u3 || u3.tagName !== "DIALOG" || !u3.hasAttribute("detail")) return;
74260
- if (u3._sapEngineClose) {
74261
- u3._sapEngineClose = false;
74551
+ y4.forEach(_4), y4.length ? typeof y4[0].focus == "function" && y4[0].focus() : E4(m4.$el);
74552
+ }
74553
+ function A4(f3) {
74554
+ let c3 = f3.target;
74555
+ if (!c3 || !c3.hasAttribute || !c3.hasAttribute("trigger-add")) return;
74556
+ let i2 = t2.appFor(c3);
74557
+ i2 && (f3.preventDefault(), o3(c3, i2, () => h(c3, i2, c3.getAttribute("trigger-add"))));
74558
+ }
74559
+ function p3(f3) {
74560
+ let c3 = f3.target;
74561
+ if (!c3 || c3.tagName !== "DIALOG" || !c3.hasAttribute("detail")) return;
74562
+ if (c3._sapEngineClose) {
74563
+ c3._sapEngineClose = false;
74262
74564
  return;
74263
74565
  }
74264
- if (u3.open) return;
74265
- let b4 = /^[\w.]+\s+by\s+state\.(\w+)\s*$/.exec(u3.getAttribute("detail") || ""), v5 = t2.appFor(u3);
74266
- if (!b4 || !v5) return;
74267
- let x6 = V7(u3.getAttribute("state") || "").find((C5) => C5.name === b4[1]);
74268
- if (x6) {
74269
- x6.transient ? Dt6(u3, x6, "") : Rt6(u3, x6, ""), t2.schedule(v5, "close");
74566
+ if (c3.open) return;
74567
+ let i2 = /^[\w.]+\s+by\s+state\.(\w+)\s*$/.exec(c3.getAttribute("detail") || ""), l2 = t2.appFor(c3);
74568
+ if (!i2 || !l2) return;
74569
+ let m4 = C5(c3.getAttribute("state") || "").find((x6) => x6.name === i2[1]);
74570
+ if (m4) {
74571
+ m4.transient ? dt6(c3, m4, "") : lt6(c3, m4, ""), t2.schedule(l2, "close");
74270
74572
  return;
74271
74573
  }
74272
- let L7 = r44(u3.parentElement);
74273
- L7 && L7[b4[1]] !== "" && (L7[b4[1]] = "");
74274
- }
74275
- function S4(c3) {
74276
- let u3 = c3.target;
74277
- if (!u3 || u3.nodeType !== 1) return;
74278
- let b4 = t2.appFor(u3);
74279
- if (!b4) return;
74280
- u3.hasAttribute("persist") && !Xt5(u3) && xt6(u3);
74281
- let v5 = u3.hasAttribute("bind") && qt5(u3);
74282
- if (!v5 && u3.hasAttribute("bind") && lt6(u3)) {
74283
- let L7 = u3.getAttribute("bind"), C5 = u3._sapViewBind ? e20.writeTargetFor(u3, L7) : null;
74284
- C5 && (C5[L7] = G5(u3).read());
74285
- return;
74574
+ let y4 = r44(c3.parentElement);
74575
+ y4 && y4[i2[1]] !== "" && (y4[i2[1]] = "");
74576
+ }
74577
+ function w4(f3, c3) {
74578
+ let i2 = f3.hasAttribute("bind") && vt5(f3);
74579
+ if (!i2 && f3.hasAttribute("bind") && H6(f3)) {
74580
+ let m4 = f3.getAttribute("bind"), y4 = f3._sapViewBind ? e20.writeTargetFor(f3, m4) : null;
74581
+ return y4 && (y4[m4] = R5(f3).read()), true;
74286
74582
  }
74287
- let x6 = Lt5(u3);
74288
- if (x6 && x6._sapDetailRow && u3.hasAttribute("bind") && !v5) {
74289
- let L7 = x6._sapDetailRow, C5 = u3.getAttribute("bind"), R5 = ft5(L7, C5);
74290
- if (R5 && R5 !== u3) {
74291
- G5(R5).write(G5(u3).read());
74292
- return;
74293
- }
74294
- if (!R5 && V7(L7.getAttribute("state") || "").some((F5) => F5.name === C5)) {
74295
- e20.writeField(L7, b4, C5, G5(u3).read());
74296
- return;
74297
- }
74583
+ let l2 = ct6(f3);
74584
+ if (l2 && l2._sapDetailRow && f3.hasAttribute("bind") && !i2) {
74585
+ let m4 = l2._sapDetailRow, y4 = f3.getAttribute("bind"), x6 = U6(m4, y4);
74586
+ if (x6 && x6 !== f3) return R5(x6).write(R5(f3).read()), true;
74587
+ if (!x6 && C5(m4.getAttribute("state") || "").some(($6) => $6.name === y4)) return e20.writeField(m4, c3, y4, R5(f3).read()), true;
74298
74588
  }
74299
- t2.schedule(b4, c3.type + " " + (u3.id || u3.tagName.toLowerCase()));
74300
- }
74301
- function _4(c3) {
74302
- let u3 = c3.detail || {};
74303
- for (let b4 of [u3.from, u3.to, c3.target]) {
74304
- if (!b4 || b4.nodeType !== 1) continue;
74305
- let v5 = t2.appFor(b4);
74306
- v5 && t2.schedule(v5, "sorted");
74589
+ return false;
74590
+ }
74591
+ function v5(f3 = document) {
74592
+ f3.addEventListener("click", k5), f3.addEventListener("submit", A4), f3.addEventListener("close", p3, true);
74593
+ }
74594
+ return { install: v5, routeInput: w4 };
74595
+ }
74596
+ function Ze5(t2) {
74597
+ let e20 = [];
74598
+ function r44(b4) {
74599
+ let d = b4.target;
74600
+ if (!d || d.nodeType !== 1) return;
74601
+ let u3 = t2.appFor(d);
74602
+ if (u3) {
74603
+ d.hasAttribute("persist") && !Ct6(d) && nt6(d);
74604
+ for (let E4 of e20) if (E4(d, u3)) return;
74605
+ t2.schedule(u3, b4.type + " " + (d.id || d.tagName.toLowerCase()));
74307
74606
  }
74308
74607
  }
74309
- function M6(c3) {
74310
- if (c3.key !== "ArrowUp" && c3.key !== "ArrowDown") return;
74311
- let u3 = c3.target;
74312
- if (!u3 || u3.nodeType !== 1 || u3.tagName !== "INPUT" || !u3.hasAttribute("bind") || !u3.hasAttribute("step")) return;
74313
- let b4 = (u3.getAttribute("type") || "text").toLowerCase();
74314
- if (b4 !== "text" && b4 !== "tel" && b4 !== "search" || !t2.appFor(u3)) return;
74315
- c3.preventDefault();
74316
- let x6 = Z7(u3.getAttribute("step")) || 1, L7 = c3.key === "ArrowUp" ? 1 : -1, C5 = Z7(u3.value) + x6 * (c3.shiftKey ? 10 : 1) * L7, R5 = u3.getAttribute("min"), F5 = u3.getAttribute("max");
74317
- R5 !== null && R5 !== "" && C5 < Z7(R5) && (C5 = Z7(R5)), F5 !== null && F5 !== "" && C5 > Z7(F5) && (C5 = Z7(F5)), G5(u3).write(String(Number(C5.toFixed(2))));
74608
+ function n3(b4) {
74609
+ let d = b4.target, u3 = t2.appFor(d);
74610
+ u3 && setTimeout(() => {
74611
+ d.querySelectorAll("[bind]").forEach((E4) => {
74612
+ E4.dispatchEvent(new Event("input", { bubbles: true })), E4.dispatchEvent(new Event("change", { bubbles: true }));
74613
+ }), t2.schedule(u3, "reset");
74614
+ }, 0);
74318
74615
  }
74319
- function H6(c3 = document) {
74320
- c3.addEventListener("click", P7), c3.addEventListener("submit", d), c3.addEventListener("reset", p3), c3.addEventListener("toggle", y4, true), c3.addEventListener("close", E4, true), c3.addEventListener("input", S4), c3.addEventListener("change", S4), c3.addEventListener("clay:sorted", _4), c3.addEventListener("keydown", M6);
74616
+ function o3(b4) {
74617
+ let d = t2.appFor(b4.target);
74618
+ d && t2.schedule(d, "toggle");
74321
74619
  }
74322
- return { install: H6 };
74323
- }
74324
- var hn4 = /^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;
74325
- function ye6(t2) {
74326
- return `${t2.tagName.toLowerCase()}[sap]`;
74327
- }
74328
- function br4(t2) {
74329
- let e20 = 0;
74330
- for (let r44 of t2.querySelectorAll("*")) for (let n3 of r44.attributes) if (hn4.test(n3.name)) {
74331
- e20++;
74332
- break;
74620
+ function s2(b4) {
74621
+ let d = b4.detail || {};
74622
+ for (let u3 of [d.from, d.to, b4.target]) {
74623
+ if (!u3 || u3.nodeType !== 1) continue;
74624
+ let E4 = t2.appFor(u3);
74625
+ E4 && t2.schedule(E4, "sorted");
74626
+ }
74333
74627
  }
74334
- for (let r44 of t2.attributes) if (hn4.test(r44.name)) {
74335
- e20++;
74336
- break;
74628
+ function a2(b4) {
74629
+ if (b4.key !== "ArrowUp" && b4.key !== "ArrowDown") return;
74630
+ let d = b4.target;
74631
+ if (!d || d.nodeType !== 1 || d.tagName !== "INPUT" || !d.hasAttribute("bind") || !d.hasAttribute("step")) return;
74632
+ let u3 = (d.getAttribute("type") || "text").toLowerCase();
74633
+ if (u3 !== "text" && u3 !== "tel" && u3 !== "search" || !t2.appFor(d)) return;
74634
+ b4.preventDefault();
74635
+ let S4 = P7(d.getAttribute("step")) || 1, k5 = b4.key === "ArrowUp" ? 1 : -1, _4 = P7(d.value) + S4 * (b4.shiftKey ? 10 : 1) * k5, h = d.getAttribute("min"), A4 = d.getAttribute("max");
74636
+ h !== null && h !== "" && _4 < P7(h) && (_4 = P7(h)), A4 !== null && A4 !== "" && _4 > P7(A4) && (_4 = P7(A4)), R5(d).write(String(Number(_4.toFixed(2))));
74337
74637
  }
74338
- return e20;
74638
+ function g2(b4 = document) {
74639
+ b4.addEventListener("reset", n3), b4.addEventListener("toggle", o3, true), b4.addEventListener("input", r44), b4.addEventListener("change", r44), b4.addEventListener("clay:sorted", s2), b4.addEventListener("keydown", a2);
74640
+ }
74641
+ return { install: g2, addRouter: (b4) => e20.push(b4) };
74642
+ }
74643
+ function tn3(t2) {
74644
+ let e20 = t2.toLowerCase();
74645
+ return /^x-text$|^x-html$/.test(e20) ? 'use text="state.x" (Sap paints text only)' : /^x-show$|^v-show$|^v-if$/.test(e20) ? 'use show="expr" (toggles native hidden)' : /^x-model$|^v-model$/.test(e20) ? 'use bind="field"' : /^@|^x-on:|^v-on:|^on:/.test(e20) ? "use native onclick + Sap(this) (no event directive)" : /^:|^x-bind:class$|^v-bind:class$/.test(e20) ? 'use class:NAME="expr" or attr:NAME="expr"' : /^x-for$|^v-for$/.test(e20) ? 'use items="name" on the container and item template on the row' : /^x-data$/.test(e20) ? "declare state with state= / bind / items (no JS state object)" : /^x-init$/.test(e20) ? "use a <script> or onclick + Sap(this)" : /^bind:/.test(e20) ? 'use bind="field"; one-way paint is attr:NAME="expr"' : /^x-/.test(e20) || /^v-/.test(e20) ? "this is a foreign-dialect attribute; Sap has no x-/v- attributes" : null;
74339
74646
  }
74340
- function bn4(t2) {
74647
+ function en3(t2) {
74341
74648
  let e20 = [], r44 = (n3) => {
74342
74649
  for (let o3 of n3.attributes) {
74343
74650
  let s2 = o3.name;
@@ -74348,186 +74655,286 @@ ${t2}` : `"use strict"; return (${t2});`;
74348
74655
  for (let n3 of t2.querySelectorAll("*")) r44(n3);
74349
74656
  return e20;
74350
74657
  }
74351
- function gn5(t2) {
74352
- function e20(l2) {
74353
- let w4 = l2._stats || {}, N16 = l2.root;
74354
- return { root: ye6(N16), fields: w4.fields || 0, calcs: w4.calcs || 0, paints: w4.paints || 0, actions: br4(N16), lists: (N16.hasAttribute("items") ? 1 : 0) + N16.querySelectorAll("[items]").length, rows: N16.querySelectorAll("[item]:not([template])").length, warnings: l2.diag.warnings.length, errors: l2.diag.errors.length, mountWrites: l2._mountWrites || 0, ms: Math.round((l2._mountMs || 0) * 10) / 10, passes: l2._passes || 0, lastPass: l2._lastPass || null, ok: l2.diag.errors.length === 0 && !l2.halted };
74355
- }
74356
- function r44() {
74357
- let l2 = t2.apps().map(e20);
74358
- return { ok: l2.every((w4) => w4.ok), apps: l2 };
74359
- }
74360
- function n3(l2) {
74361
- let w4 = e20(l2);
74362
- return w4.ok ? `sap \u2713 ${w4.root} \xB7 fields ${w4.fields} \xB7 calcs ${w4.calcs} \xB7 paints ${w4.paints} \xB7 actions ${w4.actions} \xB7 lists ${w4.lists} \xB7 rows ${w4.rows} \xB7 warnings ${w4.warnings} \xB7 mount writes ${w4.mountWrites} \xB7 ${w4.ms}ms` : `sap \u2717 ${w4.root} \xB7 errors ${w4.errors} \xB7 warnings ${w4.warnings} \xB7 ${w4.ms}ms`;
74363
- }
74364
- function o3() {
74365
- for (let l2 of t2.apps()) {
74366
- let w4 = n3(l2);
74367
- l2.diag.errors.length || l2.halted ? console.error(w4) : console.log(w4);
74368
- }
74369
- }
74370
- function s2() {
74371
- let l2 = [], w4 = [];
74372
- for (let N16 of t2.apps()) l2.push(...N16.diag.errors), w4.push(...N16.diag.warnings);
74373
- return { ok: l2.length === 0, errors: l2, warnings: w4, counts: { errors: l2.length, warnings: w4.length } };
74374
- }
74375
- function a2(l2) {
74376
- return l2 ? typeof l2 == "string" ? document.querySelector(l2) : l2.nodeType === 1 ? l2 : null : null;
74377
- }
74378
- function k5(l2, w4) {
74379
- let N16 = a2(l2);
74380
- if (!N16) return console.warn("sap why: element not found"), null;
74381
- let P7 = [`sap why <${N16.tagName.toLowerCase()}> \u2014 ${Ot5(N16)}`], z5 = [...N16.attributes].filter((d) => /^(bind|text|show|effect|invalid|detail|calc:|text:|attr:|class:|css:|set:|state|items|scope)/.test(d.name));
74382
- for (let d of z5) P7.push(` ${d.name}="${d.value}"`);
74383
- let m4 = N16;
74384
- for (; m4 && !m4._sapScope; ) m4 = m4.parentElement;
74385
- if (m4 && m4._sapScope) {
74386
- let d = m4._sapScope, p3 = w4 ? [w4] : Object.keys(d);
74387
- P7.push(" reads:");
74388
- for (let y4 of p3) {
74389
- let E4 = d[y4];
74390
- typeof E4 != "function" && P7.push(` ${y4} = ${JSON.stringify(Array.isArray(E4) ? `[${E4.length} rows]` : E4)}`);
74658
+ function nn2(t2) {
74659
+ function e20(o3) {
74660
+ return o3 ? typeof o3 == "string" ? document.querySelector(o3) : o3.nodeType === 1 ? o3 : null : null;
74661
+ }
74662
+ function r44(o3, s2) {
74663
+ let a2 = e20(o3);
74664
+ if (!a2) return console.warn("sap why: element not found"), null;
74665
+ let g2 = [`sap why <${a2.tagName.toLowerCase()}> \u2014 ${yt6(a2)}`], b4 = [...a2.attributes].filter((u3) => /^(bind|text|show|effect|invalid|detail|calc:|text:|attr:|class:|css:|set:|state|items|scope)/.test(u3.name));
74666
+ for (let u3 of b4) g2.push(` ${u3.name}="${u3.value}"`);
74667
+ let d = a2;
74668
+ for (; d && !d._sapScope; ) d = d.parentElement;
74669
+ if (d && d._sapScope) {
74670
+ let u3 = d._sapScope, E4 = s2 ? [s2] : Object.keys(u3);
74671
+ g2.push(" reads:");
74672
+ for (let S4 of E4) {
74673
+ let k5 = u3[S4];
74674
+ typeof k5 != "function" && g2.push(` ${S4} = ${JSON.stringify(Array.isArray(k5) ? `[${k5.length} rows]` : k5)}`);
74391
74675
  }
74392
74676
  }
74393
- return P7.push(" serialization: textContent and value/checked attributes save with the file; reads live from properties"), console.log(P7.join(`
74677
+ return g2.push(" serialization: textContent and value/checked attributes save with the file; reads live from properties"), console.log(g2.join(`
74394
74678
  `)), null;
74395
74679
  }
74396
- function $6(l2) {
74397
- let w4 = l2 === void 0 ? true : !!l2;
74398
- for (let N16 of t2.apps()) N16._debug = w4;
74399
- return console.log(`sap debug ${w4 ? "on" : "off"} \u2014 per-pass headers will ${w4 ? "" : "no longer "}log`), w4;
74400
- }
74401
- function A4() {
74402
- let l2 = [], w4 = 0;
74403
- for (let d of t2.apps()) {
74404
- let p3 = d.root, y4 = ye6(p3);
74405
- w4++;
74406
- let E4 = new ht6(d.name);
74407
- Zt5(p3, E4);
74408
- for (let c3 of E4.errors) l2.push({ code: c3.code, severity: "error", message: `${y4}: ${c3.code} ${c3.slug} at ${c3.el}` });
74409
- for (let c3 of E4.warnings) l2.push({ code: c3.code, severity: "warn", message: `${y4}: ${c3.code} ${c3.slug} at ${c3.el}` });
74410
- w4++, $t6(d, { trigger: "doctor-dryrun" });
74411
- let S4 = d._stats ? d._stats.writes : 0;
74412
- S4 > 0 && l2.push({ code: "W30", severity: "warn", message: `${y4}: dry recompute wrote ${S4} cells on a quiet page; an element is stale or non-idempotent` }), w4++;
74413
- let _4 = bn4(p3).map((c3) => c3.src).join(" \0 "), M6 = [];
74414
- for (let c3 of [p3, ...p3.querySelectorAll("[state]")]) for (let u3 of V7(c3.getAttribute("state") || "")) M6.push(u3.name);
74415
- for (let c3 of M6) new RegExp(`(state|item)\\.${c3}\\b`).test(_4) || l2.push({ code: "I33", severity: "info", message: `${y4}: field "${c3}" is declared but read nowhere (dead state)` });
74416
- w4++;
74417
- let H6 = /* @__PURE__ */ new Map();
74418
- for (let c3 of p3.querySelectorAll("[id]")) H6.set(c3.id, (H6.get(c3.id) || 0) + 1);
74419
- for (let [c3, u3] of H6) u3 > 1 && l2.push({ code: "W32", severity: "warn", message: `${y4}: duplicate id "${c3}" (${u3} elements) \u2014 clone/edit collision` });
74420
- w4++;
74421
- for (let c3 of bn4(p3)) c3.src.length > 120 && l2.push({ code: "I33", severity: "info", message: `${y4}: ${c3.attr} expression is ${c3.src.length} chars; consider a calc: field` });
74422
- w4++;
74423
- for (let c3 of p3.querySelectorAll("[text], [text\\:num]")) {
74424
- let u3 = c3.textContent || "";
74425
- /\.\d{5,}/.test(u3) && l2.push({ code: "I33", severity: "info", message: `${y4}: ${Ot5(c3)} paints >4 decimals; consider text:FMT` });
74680
+ function n3() {
74681
+ let o3 = [], s2 = 0;
74682
+ for (let u3 of t2.apps()) {
74683
+ let E4 = u3.root, S4 = It6(E4);
74684
+ s2++;
74685
+ let k5 = new K7(u3.name);
74686
+ Pt5(E4, k5);
74687
+ for (let w4 of k5.errors) o3.push({ code: w4.code, severity: "error", message: `${S4}: ${w4.code} ${w4.slug} at ${w4.el}` });
74688
+ for (let w4 of k5.warnings) o3.push({ code: w4.code, severity: "warn", message: `${S4}: ${w4.code} ${w4.slug} at ${w4.el}` });
74689
+ s2++, it6(u3, { trigger: "doctor-dryrun" });
74690
+ let _4 = u3._stats ? u3._stats.writes : 0;
74691
+ _4 > 0 && o3.push({ code: "W30", severity: "warn", message: `${S4}: dry recompute wrote ${_4} cells on a quiet page; an element is stale or non-idempotent` }), s2++;
74692
+ let h = en3(E4).map((w4) => w4.src).join(" \0 "), A4 = [];
74693
+ for (let w4 of [E4, ...E4.querySelectorAll("[state]")]) for (let v5 of C5(w4.getAttribute("state") || "")) A4.push(v5.name);
74694
+ for (let w4 of A4) new RegExp(`(state|item)\\.${w4}\\b`).test(h) || o3.push({ code: "I33", severity: "info", message: `${S4}: field "${w4}" is declared but read nowhere (dead state)` });
74695
+ s2++;
74696
+ let p3 = /* @__PURE__ */ new Map();
74697
+ for (let w4 of E4.querySelectorAll("[id]")) p3.set(w4.id, (p3.get(w4.id) || 0) + 1);
74698
+ for (let [w4, v5] of p3) v5 > 1 && o3.push({ code: "W32", severity: "warn", message: `${S4}: duplicate id "${w4}" (${v5} elements) \u2014 clone/edit collision` });
74699
+ s2++;
74700
+ for (let w4 of en3(E4)) w4.src.length > 120 && o3.push({ code: "I33", severity: "info", message: `${S4}: ${w4.attr} expression is ${w4.src.length} chars; consider a calc: field` });
74701
+ s2++;
74702
+ for (let w4 of E4.querySelectorAll("[text], [text\\:num]")) {
74703
+ let v5 = w4.textContent || "";
74704
+ /\.\d{5,}/.test(v5) && o3.push({ code: "I33", severity: "info", message: `${S4}: ${yt6(w4)} paints >4 decimals; consider text:FMT` });
74426
74705
  }
74427
74706
  }
74428
- let N16 = l2.filter((d) => d.severity === "error").length, P7 = l2.filter((d) => d.severity === "warn").length, z5 = l2.filter((d) => d.severity === "info").length;
74429
- console.log(`sap doctor \xB7 ${t2.apps().map((d) => ye6(d.root)).join(", ")} \xB7 errors ${N16} \xB7 warnings ${P7} \xB7 info ${z5} \xB7 ${w4} checks \xB7 0ms`);
74430
- for (let d of l2) (d.severity === "error" ? console.error : d.severity === "warn" ? console.warn : console.info)(` ${d.severity === "error" ? "\u2717" : d.severity === "warn" ? "\u26A0" : "\xB7"} ${d.message}`);
74431
- return l2;
74707
+ let a2 = o3.filter((u3) => u3.severity === "error").length, g2 = o3.filter((u3) => u3.severity === "warn").length, b4 = o3.filter((u3) => u3.severity === "info").length;
74708
+ console.log(`sap doctor \xB7 ${t2.apps().map((u3) => It6(u3.root)).join(", ")} \xB7 errors ${a2} \xB7 warnings ${g2} \xB7 info ${b4} \xB7 ${s2} checks \xB7 0ms`);
74709
+ for (let u3 of o3) (u3.severity === "error" ? console.error : u3.severity === "warn" ? console.warn : console.info)(` ${u3.severity === "error" ? "\u2717" : u3.severity === "warn" ? "\u26A0" : "\xB7"} ${u3.message}`);
74710
+ return o3;
74432
74711
  }
74433
- return { status: r44, report: s2, why: k5, debug: $6, doctor: A4, greenLine: n3, printGreenLines: o3, REGISTRY: re5 };
74712
+ return { why: r44, doctor: n3 };
74434
74713
  }
74435
- var wn4 = "0.5.2";
74436
- var tt6 = /* @__PURE__ */ new Map(), it6 = [], Ae6 = Ee6($t6);
74437
- function gr4(t2) {
74438
- let e20 = t2;
74439
- for (; e20; ) {
74440
- if (e20.nodeType === 1 && e20.hasAttribute && e20.hasAttribute("sap")) return tt6.get(e20) || null;
74441
- e20 = e20.parentNode && e20.parentNode.host ? e20.parentNode.host : e20.parentElement;
74442
- }
74443
- return null;
74714
+ function ir4(t2, e20) {
74715
+ let r44 = String(t2).split("."), n3 = (s2) => {
74716
+ for (let a2 of r44) {
74717
+ if (s2 == null) return;
74718
+ s2 = Array.isArray(s2) ? s2.flatMap((g2) => g2 && g2[a2] != null ? g2[a2] : []) : s2[a2];
74719
+ }
74720
+ return s2;
74721
+ }, o3 = n3(e20.state);
74722
+ return o3 === void 0 ? n3(e20.root) : o3;
74444
74723
  }
74445
- function wr4() {
74446
- for (let t2 = it6.length - 1; t2 >= 0; t2--) {
74447
- let e20 = it6[t2];
74448
- e20.root.isConnected || (tt6.delete(e20.root), it6.splice(t2, 1));
74724
+ function sr4(t2, e20, r44, n3) {
74725
+ e20._sapScope = r44;
74726
+ let o3 = e20.getAttribute("detail") || "", s2 = /^([\w.]+)\s+by\s+(.+)$/.exec(o3);
74727
+ if (!s2) {
74728
+ e20.hidden = true, e20._sapDetailRow = null;
74729
+ return;
74730
+ }
74731
+ let a2 = s2[1], g2 = s2[2].trim(), b4 = ir4(a2, n3), d;
74732
+ try {
74733
+ d = Y5(N16(g2), { state: r44, item: n3.item, el: e20, root: n3.root });
74734
+ } catch {
74735
+ d = void 0;
74449
74736
  }
74737
+ let u3 = Array.isArray(b4) && d != null ? b4.find((S4) => S4 && typeof S4 == "object" && S4.$el && String(S4.$key) === String(d)) : null;
74738
+ if (e20._sapDetailRow = u3 ? u3.$el : null, e20.tagName === "DIALOG") {
74739
+ let S4 = u3 ? String(u3.$key) : null;
74740
+ if (S4 !== e20._sapDetailKey && (e20._sapDetailKey = S4, e20._sapDismissed = false), !u3) {
74741
+ e20._sapOpenedFor = null, e20.open && typeof e20.close == "function" && (e20._sapEngineClose = true, e20.close());
74742
+ return;
74743
+ }
74744
+ e20.open ? e20._sapOpenedFor = S4 : (e20._sapOpenedFor === S4 && (e20._sapDismissed = true), e20._sapOpenedFor = null, !e20._sapDismissed && e20.isConnected && typeof e20.showModal == "function" && (e20.hidden && (e20.hidden = false), e20.showModal(), e20._sapOpenedFor = S4));
74745
+ } else {
74746
+ if (!u3) {
74747
+ e20.hidden || (e20.hidden = true);
74748
+ return;
74749
+ }
74750
+ e20.hidden && (e20.hidden = false);
74751
+ }
74752
+ Nt4();
74753
+ let E4 = { root: n3.root, state: r44, item: u3, ownerEl: u3.$el, projection: true };
74754
+ t2.collectEl(e20, q7(e20), E4), t2.walkScope(e20, u3, E4);
74755
+ }
74756
+ var rn3 = { name: "detail", begin(t2) {
74757
+ t2.deferredDetails = [];
74758
+ }, boundary: { detail(t2, e20, r44, n3, o3) {
74759
+ for (let s2 of C5(e20.getAttribute("state") || "")) s2.name in n3 || (n3[s2.name] = G5(e20, s2) ? e20.hasAttribute(s2.attr) : t2.resolveDefault(e20, s2));
74760
+ t2.deferredDetails.push({ el: e20, parentObj: n3, ctx: o3 });
74761
+ } }, afterIntake(t2) {
74762
+ for (let e20 = 0; e20 < t2.deferredDetails.length; e20++) {
74763
+ let { el: r44, parentObj: n3, ctx: o3 } = t2.deferredDetails[e20];
74764
+ sr4(t2, r44, n3, o3);
74765
+ }
74766
+ } };
74767
+ function on4(t2) {
74768
+ let e20 = 0, r44 = t2;
74769
+ for (; r44 && !(r44.hasAttribute && r44.hasAttribute("sap")); ) r44 = r44.parentElement, e20++;
74770
+ return e20;
74450
74771
  }
74451
- function yr4(t2, e20) {
74452
- if (t2.moveBefore) try {
74453
- t2.moveBefore(e20, null);
74772
+ var sn3 = { name: "calc", begin(t2) {
74773
+ t2.calcs = [];
74774
+ }, collect(t2, e20, r44, n3) {
74775
+ if (!r44.calcs) return;
74776
+ let o3 = n3.item || n3.state;
74777
+ for (let s2 of r44.calcs) t2.calcs.push({ owner: o3, ownerEl: n3.ownerEl, name: s2.name, entry: s2.entry, def: s2, el: e20, ctx: n3 });
74778
+ }, compute(t2) {
74779
+ let e20 = t2.app, r44 = /* @__PURE__ */ new Map();
74780
+ for (let o3 of t2.calcs) {
74781
+ let s2 = r44.get(o3.owner);
74782
+ s2 || (s2 = { ownerEl: o3.ownerEl, list: [] }, r44.set(o3.owner, s2)), s2.list.push(o3);
74783
+ }
74784
+ let n3 = [...r44.values()].sort((o3, s2) => on4(s2.ownerEl) - on4(o3.ownerEl));
74785
+ for (let o3 of n3) {
74786
+ let s2;
74787
+ try {
74788
+ s2 = be5(o3.list);
74789
+ } catch (a2) {
74790
+ e20.diag.error("E07", o3.list[0].el, { problem: a2.message }), s2 = o3.list;
74791
+ }
74792
+ for (let a2 of s2) try {
74793
+ a2.owner[a2.name] = I5(a2.entry, a2.ctx.state, a2.ctx.item, a2.el, a2.ctx.root), Q6(a2.el);
74794
+ } catch (g2) {
74795
+ a2.owner[a2.name] = void 0, e20.diag.error("E24", a2.el, { attr: "calc:" + a2.name, expr: a2.entry.src, problem: String(g2.message) }), M6(a2.el, g2.sapCode || "E24");
74796
+ }
74797
+ }
74798
+ t2.stats.calcs = t2.calcs.length, t2.stats.lists = r44.size;
74799
+ } };
74800
+ function ar4(t2, e20, r44) {
74801
+ let n3 = r44.nextSibling;
74802
+ if (e20.isConnected && t2.moveBefore) try {
74803
+ t2.moveBefore(e20, n3);
74454
74804
  return;
74455
74805
  } catch {
74456
74806
  }
74457
- t2.appendChild(e20);
74807
+ t2.insertBefore(e20, n3);
74458
74808
  }
74459
- function Ar4(t2, e20) {
74460
- let r44 = e20.parentElement;
74461
- if (r44) {
74462
- if (r44.moveBefore) try {
74463
- r44.moveBefore(t2, e20);
74464
- return;
74809
+ function ur4(t2, e20, r44) {
74810
+ for (let n3 = e20.parentElement; n3; n3 = n3.parentElement) if (n3._sapScope === r44 && !n3.hasAttribute("detail") || n3.hasAttribute("sap")) return n3;
74811
+ return t2;
74812
+ }
74813
+ function cr4(t2, e20, r44) {
74814
+ let n3 = t2.app;
74815
+ e20._sapDrawnEl = ur4(t2.root, e20, r44.state);
74816
+ let o3 = null;
74817
+ for (let h = e20.firstElementChild; h; h = h.nextElementSibling) if (h.tagName === "TEMPLATE") {
74818
+ o3 = h;
74819
+ break;
74820
+ }
74821
+ let s2 = o3 && o3.content.children.length === 1 ? o3.content.firstElementChild : null;
74822
+ if (!s2) return n3.diag.error("E42", e20, { attr: "each", problem: "each needs one <template> child with exactly one element root" }), 0;
74823
+ let a2 = e20.getAttribute("each"), g2;
74824
+ try {
74825
+ g2 = Y5(N16(a2), { state: r44.state, item: r44.item, el: e20, root: r44.root });
74826
+ } catch (h) {
74827
+ return n3.diag.error("E24", e20, { attr: "each", expr: a2, problem: String(h.message) }), 0;
74828
+ }
74829
+ if (!Array.isArray(g2)) return n3.diag.error("E40", e20, { attr: "each", expr: a2, problem: "each must evaluate to an array; the list keeps its last good rows" }), 0;
74830
+ let b4 = N16(e20.getAttribute("key") || "item.$key"), d = [], u3 = /* @__PURE__ */ new Set();
74831
+ for (let h of g2) {
74832
+ let A4;
74833
+ try {
74834
+ A4 = I5(b4, r44.state, h, e20, r44.root);
74465
74835
  } catch {
74836
+ A4 = void 0;
74466
74837
  }
74467
- r44.insertBefore(t2, e20);
74838
+ let p3 = A4 == null ? "" : String(A4);
74839
+ if (p3 === "" || u3.has(p3)) return n3.diag.error("E41", e20, { attr: "key", expr: b4.src, problem: p3 === "" ? "an item has no key; the list keeps its last good rows" : `duplicate key "${p3}"; the list keeps its last good rows` }), 0;
74840
+ u3.add(p3), d.push(p3);
74841
+ }
74842
+ let E4 = e20._sapEach || /* @__PURE__ */ new Map(), S4 = /* @__PURE__ */ new Map(), k5 = 0, _4 = o3;
74843
+ d.forEach((h, A4) => {
74844
+ let p3 = E4.get(h);
74845
+ if (!p3 || p3.parentElement !== e20) {
74846
+ p3 = e20.ownerDocument.importNode(s2, true);
74847
+ let w4 = (p3.getAttribute("clay") || "").split(/\s+/).filter(Boolean);
74848
+ w4.includes("editor-ui") || p3.setAttribute("clay", [...w4, "editor-ui"].join(" ")), p3._sapEachRow = true, k5++;
74849
+ }
74850
+ p3.getAttribute("data-key") !== h && p3.setAttribute("data-key", h), _4.nextElementSibling !== p3 && (ar4(e20, p3, _4), k5++), p3._sapEachItem = g2[A4], S4.set(h, p3), _4 = p3;
74851
+ });
74852
+ for (let [h, A4] of E4) S4.get(h) !== A4 && A4.parentElement === e20 && (A4.remove(), k5++);
74853
+ return e20._sapEach = S4, Nt4(), d.forEach((h, A4) => {
74854
+ let p3 = S4.get(h), w4 = { root: r44.root, state: r44.state, item: g2[A4], ownerEl: p3, projection: false, view: true };
74855
+ t2.collectEl(p3, q7(p3), w4), t2.walkScope(p3, {}, w4);
74856
+ }), k5;
74857
+ }
74858
+ var an3 = { name: "each", begin(t2) {
74859
+ t2.eachList = [];
74860
+ }, boundary: { each(t2, e20, r44, n3, o3) {
74861
+ t2.collectEl(e20, r44, o3), t2.eachList.push({ el: e20, ctx: o3 });
74862
+ } }, reconcile(t2) {
74863
+ let e20 = 0;
74864
+ for (let r44 = 0; r44 < t2.eachList.length; r44++) e20 += cr4(t2, t2.eachList[r44].el, t2.eachList[r44].ctx);
74865
+ return e20;
74866
+ } };
74867
+ function fr4(t2, e20) {
74868
+ try {
74869
+ I5(t2.def.entry, t2.ctx.state, t2.ctx.item, t2.el, t2.ctx.root), Q6(t2.el);
74870
+ } catch (r44) {
74871
+ e20.diag.error("E24", t2.el, { attr: "effect", expr: t2.def.entry && t2.def.entry.src, problem: String(r44.message) }), M6(t2.el, "E24");
74468
74872
  }
74469
74873
  }
74470
- var mt6 = { apps: () => it6.slice(), appFor: gr4, isRegistered: (t2) => tt6.has(t2), pruneDisconnected: wr4, schedule: (t2, e20) => Ae6.schedule(t2, e20), runNow: (t2, e20) => Ae6.runNow(t2, e20), moveInto: yr4, placeBefore: Ar4, remountIfPresent: () => te6() }, An4 = pn4(mt6), Er4 = mn3(mt6, An4), st6 = gn5(mt6), yn4 = false;
74471
- function En4() {
74472
- yn4 || (yn4 = true, Er4.install(document), Ke6(mt6));
74473
- }
74474
- function te6(t2 = document) {
74475
- En4(), me6(mt6);
74476
- let e20 = t2.querySelectorAll("[sap]"), r44 = [];
74477
- for (let n3 of e20) {
74478
- if (tt6.has(n3)) continue;
74479
- let o3 = we6(n3);
74480
- tt6.set(n3, o3), it6.push(o3), r44.push(o3);
74874
+ var un4 = { name: "effect", begin(t2) {
74875
+ t2.effects = [];
74876
+ }, collect(t2, e20, r44, n3) {
74877
+ if (r44.effects) for (let o3 of r44.effects) t2.effects.push({ def: o3, el: e20, ctx: n3 });
74878
+ }, afterPaint(t2) {
74879
+ for (let e20 of t2.effects) fr4(e20, t2.app);
74880
+ } };
74881
+ function lr4(t2) {
74882
+ let e20 = "";
74883
+ try {
74884
+ let r44 = I5(t2.def.entry, t2.ctx.state, t2.ctx.item, t2.el, t2.ctx.root);
74885
+ e20 = typeof r44 == "string" ? r44 : "";
74886
+ } catch {
74887
+ e20 = "";
74481
74888
  }
74482
- for (let n3 of r44) {
74483
- let o3 = st6.greenLine(n3);
74484
- n3.diag.errors.length || n3.halted ? console.error(o3) : console.log(o3);
74889
+ typeof t2.el.setCustomValidity == "function" && t2.el.setCustomValidity(e20);
74890
+ }
74891
+ var cn3 = { name: "validation", begin(t2) {
74892
+ t2.invalids = [];
74893
+ }, collect(t2, e20, r44, n3) {
74894
+ if (r44.invalids) for (let o3 of r44.invalids) t2.invalids.push({ def: o3, el: e20, ctx: n3 });
74895
+ }, afterPaint(t2) {
74896
+ for (let e20 of t2.invalids) lr4(e20);
74897
+ } };
74898
+ function fn4(t2, e20) {
74899
+ if (t2 === t2.ownerDocument.activeElement) return 0;
74900
+ if (t2.type === "radio") {
74901
+ let s2 = e20 != null && String(t2.value) === String(e20);
74902
+ return t2.checked === s2 ? 0 : (t2.checked = s2, 1);
74485
74903
  }
74486
- return r44;
74904
+ let r44 = ht6(t2), n3 = Rt6(t2, r44), o3 = e20 ?? "";
74905
+ return String(n3) !== String(o3) ? (Re6(t2, r44, o3), 1) : 0;
74487
74906
  }
74488
- function vn4(t2) {
74489
- if (En4(), me6(mt6), !t2) return te6();
74490
- let e20 = typeof t2 == "string" ? document.querySelector(t2) : t2;
74491
- if (!e20) return null;
74492
- if (tt6.has(e20)) return tt6.get(e20);
74493
- let r44 = we6(e20);
74494
- tt6.set(e20, r44), it6.push(r44);
74495
- let n3 = st6.greenLine(r44);
74496
- return r44.diag.errors.length || r44.halted ? console.error(n3) : console.log(n3), r44;
74497
- }
74498
- var O4 = An4.Sap;
74499
- O4.version = wn4;
74500
- O4.refresh = function() {
74501
- for (let e20 of it6) e20.root.isConnected && Ae6.runNow(e20, "refresh");
74502
- };
74503
- O4.batch = Xe6;
74504
- O4.status = st6.status;
74505
- O4.report = st6.report;
74506
- O4.why = st6.why;
74507
- O4.debug = st6.debug;
74508
- O4.doctor = st6.doctor;
74509
- O4.greenLine = st6.greenLine;
74510
- O4.formats = At5;
74511
- O4.serializeControlToAttributes = xt6;
74512
- O4.finalizeControlForSave = je6;
74513
- O4.rehydrateControlFromAttributes = Yt5;
74514
- O4.mount = vn4;
74515
- O4.config = function(e20 = {}) {
74516
- return e20.formats && Object.assign(At5, e20.formats), O4;
74517
- };
74518
- O4._registry = tt6;
74519
- O4._reset = function() {
74520
- tt6.clear(), it6.length = 0, nn2();
74521
- };
74522
- function vr4() {
74523
- if (typeof document > "u") return;
74524
- let t2 = () => Ge6(() => te6());
74525
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t2) : t2();
74907
+ var ln3 = { name: "projection", collect(t2, e20, r44, n3) {
74908
+ if (!(r44.bind != null && (n3.view || n3.projection) && !vt5(e20))) return;
74909
+ let o3 = r44.bind, s2 = t2.paints;
74910
+ n3.view ? tt6(oe6(n3.item), o3) ? (e20._sapViewBind = "item", s2.push({ def: { kind: "projection", field: o3, from: "item" }, el: e20, ctx: n3 })) : o3 in n3.state || o3 in n3.root ? (e20._sapViewBind = "drawn", s2.push({ def: { kind: "projection", field: o3, from: "drawn" }, el: e20, ctx: n3 })) : (e20._sapViewBind = null, t2.app.diag.error("E43", e20, { attr: "bind", expr: o3, problem: `bind="${o3}" inside an each row matches no field of the row's record or of the scope the row is drawn in`, fix: "bind a field the record owns (bind, state= or items= on the [item]), or declare it with state= where the list is drawn" })) : s2.push({ def: { kind: "projection", field: o3, from: null }, el: e20, ctx: n3 });
74911
+ }, paintKinds: { projection(t2) {
74912
+ let e20 = t2.def;
74913
+ if (e20.from === "drawn") {
74914
+ let r44 = e20.field in t2.ctx.state ? t2.ctx.state : t2.ctx.root;
74915
+ return fn4(t2.el, r44[e20.field]);
74916
+ }
74917
+ return fn4(t2.el, t2.ctx.item ? t2.ctx.item[e20.field] : "");
74918
+ } } };
74919
+ function dn3() {
74920
+ for (let t2 of [rn3, sn3, an3, un4, cn3, ln3]) Oe6(t2);
74526
74921
  }
74527
- vr4();
74528
- typeof window < "u" && (window.Sap = O4);
74529
- var xr4 = O4;
74530
- return Tn3(Sr4);
74922
+ dn3();
74923
+ qe6((t2, e20, r44) => {
74924
+ for (let n3 of t2.attributes) {
74925
+ let o3 = tn3(n3.name);
74926
+ o3 && (e20("E01", t2, { attr: n3.name, expr: n3.value, problem: `"${n3.name}" is a foreign-dialect attribute; Sap has no ${n3.name.split(/[:=]/)[0]} directive`, fix: o3 + " \u2014 or wrap the subtree in sap-ignore if intentional" }), r44(n3.name));
74927
+ }
74928
+ });
74929
+ var { Sap: Mt6, mountAll: pn4, mount: dr4, runtime: pr4 } = Ye6({ createAccessor: Je6, debugExtras: nn2, installInput(t2, e20, r44) {
74930
+ let n3 = Ze5(t2), o3 = Qe6(t2, e20);
74931
+ n3.addRouter(o3.routeInput), n3.install(r44), o3.install(r44);
74932
+ } }), bt6 = typeof window < "u" ? window.Sap : null;
74933
+ bt6 && bt6 !== Mt6 && bt6.core && typeof bt6.unmount == "function" && bt6.unmount();
74934
+ Xe6(pn4);
74935
+ typeof window < "u" && (window.Sap = Mt6);
74936
+ var mr4 = Mt6;
74937
+ return yn4(hr4);
74531
74938
  })();
74532
74939
  if (typeof window !== "undefined" && Sap && Sap.default) window.Sap = Sap.default;
74533
74940
  var sapDefault = Sap.default;
@@ -75852,7 +76259,10 @@ ${t2}` : `"use strict"; return (${t2});`;
75852
76259
  // verify is sent as the ordinary full serialization, so the floor is the behaviour
75853
76260
  // it replaces. `exclude=source` turns it off.
75854
76261
  source: { path: "plugins/source.js", editOnly: true, default: true },
75855
- "visitor-drafts": { path: "plugins/visitor-drafts.js", editOnly: false, default: false }
76262
+ "visitor-drafts": { path: "plugins/visitor-drafts.js", editOnly: false, default: false },
76263
+ // The sapjs core. Loaded for any page with a [sap] root at boot (resolveModules'
76264
+ // hasSap), in view mode too: a reader's tab paints the same totals.
76265
+ derive: { path: "plugins/derive.js", editOnly: false, default: false }
75856
76266
  };
75857
76267
  var MODULES = {
75858
76268
  "core/is-edit-mode.js": () => Promise.resolve().then(() => (init_is_edit_mode(), is_edit_mode_exports)),
@@ -75892,10 +76302,11 @@ ${t2}` : `"use strict"; return (${t2});`;
75892
76302
  "plugins/ai-edit.js": () => Promise.resolve().then(() => (init_ai_edit(), ai_edit_exports)),
75893
76303
  "plugins/demo.js": () => Promise.resolve().then(() => (init_demo(), demo_exports)),
75894
76304
  "plugins/visitor-drafts.js": () => Promise.resolve().then(() => (init_visitor_drafts(), visitor_drafts_exports)),
75895
- "plugins/source.js": () => Promise.resolve().then(() => (init_source2(), source_exports))
76305
+ "plugins/source.js": () => Promise.resolve().then(() => (init_source2(), source_exports)),
76306
+ "plugins/derive.js": () => Promise.resolve().then(() => (init_derive(), derive_exports))
75896
76307
  };
75897
- var PLUGIN_ORDER = ["visitor-drafts", "richclay", "indicator", "sortable", "undo", "quickcrop", "upload", "people", "cms", "sync", "live", "page", "message", "wire", "ai-edit", "demo", "source"];
75898
- var IMPLIES = { cms: ["quickcrop", "upload"], "ai-edit": ["wire"], page: ["live", "sync"] };
76308
+ var PLUGIN_ORDER = ["visitor-drafts", "richclay", "indicator", "sortable", "undo", "quickcrop", "upload", "people", "cms", "sync", "live", "page", "message", "wire", "ai-edit", "demo", "derive", "source"];
76309
+ var IMPLIES = { cms: ["quickcrop", "upload"], "ai-edit": ["wire"], page: ["live", "sync", "upload"] };
75899
76310
  function parseCsv2(params, key2, enabled, apply2) {
75900
76311
  const raw = params.get(key2);
75901
76312
  if (!raw) return;
@@ -75911,7 +76322,7 @@ ${t2}` : `"use strict"; return (${t2});`;
75911
76322
  }
75912
76323
  var DRAFT_DROPS = ["sync", "live", "page", "upload", "quickcrop", "cms", "people", "wire", "ai-edit", "demo", "source"];
75913
76324
  var DRAFT_DROPS_CORE = ["attrs/refetch-on-save.js"];
75914
- function resolveModules(params, isEditMode2, { isDraftMode: isDraftMode2 = false } = {}) {
76325
+ function resolveModules(params, isEditMode2, { isDraftMode: isDraftMode2 = false, hasSap = false } = {}) {
75915
76326
  const core = [...CORE_WAVES.always];
75916
76327
  if (isEditMode2) core.push(...CORE_WAVES.editOnly);
75917
76328
  const explicit = /* @__PURE__ */ new Set();
@@ -75922,6 +76333,7 @@ ${t2}` : `"use strict"; return (${t2});`;
75922
76333
  for (const [name, spec] of Object.entries(PLUGIN_PATHS)) {
75923
76334
  if (spec.default) enabled.add(name);
75924
76335
  }
76336
+ if (hasSap) enabled.add("derive");
75925
76337
  if (excluded2.has("wire")) enabled.delete("ai-edit");
75926
76338
  for (const name of [...enabled]) {
75927
76339
  if (excluded2.has(name)) continue;
@@ -76063,6 +76475,8 @@ ${t2}` : `"use strict"; return (${t2});`;
76063
76475
 
76064
76476
  // src/loader.js
76065
76477
  init_style();
76478
+ init_derived();
76479
+ init_boot_phase();
76066
76480
  function domReady() {
76067
76481
  return new Promise((resolve) => dom_ready_default(resolve));
76068
76482
  }
@@ -76076,7 +76490,9 @@ ${t2}` : `"use strict"; return (${t2});`;
76076
76490
  window.__hyperclayEditMode = isEditMode2;
76077
76491
  const regionPolicy = await MODULES["lib/region-policy.js"]();
76078
76492
  const { isDraftMode: isDraftMode2 } = editMode;
76079
- const plan = resolveModules(params, isEditMode2, { isDraftMode: isDraftMode2 });
76493
+ const hasSap = Boolean(document.querySelector("[sap]"));
76494
+ bootPhase.holdSettle = hasSap && isEditMode2;
76495
+ const plan = resolveModules(params, isEditMode2, { isDraftMode: isDraftMode2, hasSap });
76080
76496
  const loaded = {};
76081
76497
  for (const path of plan.core) {
76082
76498
  loaded[path] = await MODULES[path]();
@@ -76094,10 +76510,28 @@ ${t2}` : `"use strict"; return (${t2});`;
76094
76510
  attachPluginMember(path, mod, loaded);
76095
76511
  }
76096
76512
  await Promise.allSettled(plan.plugins.map((path) => loaded[path]?.ready).filter(Boolean));
76513
+ if (hasSap) mountDerivedEngine(loaded);
76097
76514
  installViewModeNotice(isEditMode2);
76098
76515
  readyResolve(window.clay);
76099
76516
  document.dispatchEvent(new CustomEvent("clay:ready", { detail: { clay: window.clay } }));
76100
76517
  }
76518
+ function mountDerivedEngine(loaded) {
76519
+ const save = loaded["core/save.js"];
76520
+ let fileSignature = null;
76521
+ try {
76522
+ fileSignature = save ? save.currentPaintSignature() : null;
76523
+ } catch (err) {
76524
+ console.error("clayjs: could not read the page's painted values:", err);
76525
+ }
76526
+ try {
76527
+ if (window.Sap && typeof window.Sap.mount === "function") window.Sap.mount();
76528
+ } catch (err) {
76529
+ console.error("clayjs: the derive engine failed to mount:", err);
76530
+ } finally {
76531
+ save?.releaseBootSettle();
76532
+ }
76533
+ if (save && fileSignature != null) save.schedulePaintHeal(fileSignature);
76534
+ }
76101
76535
  function assembleCore(loaded, { isDraftMode: isDraftMode2, isEditMode: isEditMode2, isOwner: isOwner2, siteVisibility: siteVisibility2 }, regionPolicy) {
76102
76536
  const clay5 = window.clay;
76103
76537
  const mutation = loaded["lib/mutation.js"];
@@ -76119,6 +76553,7 @@ ${t2}` : `"use strict"; return (${t2});`;
76119
76553
  clay5.readData = pageData2.readData;
76120
76554
  clay5.writeData = pageData2.writeData;
76121
76555
  clay5.ephemeral = ephemeral;
76556
+ clay5.derived = derived;
76122
76557
  clay5.effect = effect;
76123
76558
  clay5.style = style2;
76124
76559
  if (save) {
@@ -76212,9 +76647,9 @@ ${t2}` : `"use strict"; return (${t2});`;
76212
76647
  if (started3[name]) return;
76213
76648
  started3[name] = true;
76214
76649
  var wait = function() {
76215
- var ready5 = clay5.ready;
76216
- return ready5.then(fn4, function(err) {
76217
- if (clay5.ready === ready5) throw err;
76650
+ var ready6 = clay5.ready;
76651
+ return ready6.then(fn4, function(err) {
76652
+ if (clay5.ready === ready6) throw err;
76218
76653
  return wait();
76219
76654
  });
76220
76655
  };