@panphora/clayjs 1.24.1 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +2044 -1247
- package/dist/m/attrs/{refetch-on-save-DPGJJMGN.js → refetch-on-save-5CBFUJUF.js} +1 -1
- package/dist/m/attrs/save-freeze-MH3AOD56.js +1 -0
- package/dist/m/{c-SXGEWPFC.js → c-3E2IK5HU.js} +1 -1
- package/dist/m/{c-A4L7APIU.js → c-4AE2A2LK.js} +1 -1
- package/dist/m/{c-YDW4VCHP.js → c-4Q6QIODW.js} +1 -1
- package/dist/m/{c-RO73MKKR.js → c-52OC3OH3.js} +1 -1
- package/dist/m/{c-ZGCO4J3H.js → c-5PZYDWTW.js} +1 -1
- package/dist/m/c-5Q5XBN56.js +1 -0
- package/dist/m/c-5SZ6KFR5.js +1 -0
- package/dist/m/{c-ZRGEN6QQ.js → c-AI3H6ETU.js} +2 -2
- package/dist/m/{c-7V6MGMX2.js → c-BCWYEG6P.js} +1 -1
- package/dist/m/{c-C5AKJVRH.js → c-BJ2RRQBQ.js} +1 -1
- package/dist/m/{c-CTGRDT6E.js → c-C6YZNU6E.js} +1 -1
- package/dist/m/{c-EDE45NM7.js → c-C7SUMNMI.js} +1 -1
- package/dist/m/c-CITLTVQ4.js +4 -0
- package/dist/m/{c-STRI73GQ.js → c-CL5LSATX.js} +1 -1
- package/dist/m/{c-Z4G2UK6T.js → c-CU33V6RW.js} +1 -1
- package/dist/m/{c-6LEYVQJK.js → c-D62HRSZK.js} +1 -1
- package/dist/m/{c-DD26VXAP.js → c-DT7E76Z2.js} +1 -1
- package/dist/m/{c-P2HKMJAW.js → c-EAV7A6BT.js} +1 -1
- package/dist/m/{c-QQFHEODI.js → c-EQ5NBOGA.js} +1 -1
- package/dist/m/{c-KQKKIVLW.js → c-FBOO2UY3.js} +1 -1
- package/dist/m/{c-JQF2EUCG.js → c-FJDTDGDA.js} +1 -1
- package/dist/m/{c-MQKSKQHG.js → c-FKTALXNV.js} +1 -1
- package/dist/m/{c-HL6BLJNA.js → c-GDNZEOOZ.js} +1 -1
- package/dist/m/{c-SUXHUL7U.js → c-GEAG5XAK.js} +1 -1
- package/dist/m/{c-LSVN3OLG.js → c-GY4BREDT.js} +1 -1
- package/dist/m/{c-4PO3YGDC.js → c-HGG7M2S3.js} +1 -1
- package/dist/m/{c-DDS23EY6.js → c-HXGNH6GY.js} +1 -1
- package/dist/m/{c-FLEIU6CG.js → c-IESDKFO6.js} +1 -1
- package/dist/m/{c-CJ7QYEWI.js → c-IJHF4IO6.js} +1 -1
- package/dist/m/{c-SGGGCIVD.js → c-IL5IVTOG.js} +1 -1
- package/dist/m/c-JB5YU57S.js +1 -0
- package/dist/m/{c-MP6S4AZU.js → c-JD2VFAYG.js} +2 -2
- package/dist/m/{c-CV4T65JE.js → c-JWW6BHWD.js} +3 -3
- package/dist/m/{c-42ZNV7LI.js → c-K4M76VPM.js} +1 -1
- package/dist/m/{c-6IJEVE6B.js → c-KU3PX7LL.js} +1 -1
- package/dist/m/{c-2PVGJFI5.js → c-KYTVZT4D.js} +1 -1
- package/dist/m/{c-BGN7RCTJ.js → c-M7ITYKMF.js} +1 -1
- package/dist/m/c-MFB74XVN.js +3 -0
- package/dist/m/c-MOP5KBWZ.js +1 -0
- package/dist/m/{c-YLHTD3KX.js → c-MUM53J5J.js} +1 -1
- package/dist/m/{c-YK2L436K.js → c-MV7TEUTD.js} +1 -1
- package/dist/m/{c-LA2BW7UY.js → c-MZCOGNZL.js} +1 -1
- package/dist/m/{c-XW5TIYYB.js → c-N4GEJMXW.js} +1 -1
- package/dist/m/{c-NQAPWM7O.js → c-NADLYVAH.js} +1 -1
- package/dist/m/{c-RS77ODLY.js → c-NL4I4KNG.js} +1 -1
- package/dist/m/{c-X75G43SZ.js → c-O2QZDVZ2.js} +1 -1
- package/dist/m/{c-LTSPHVAK.js → c-OBMZASYQ.js} +1 -1
- package/dist/m/{c-LUXAB2XI.js → c-ORLPQFNU.js} +1 -1
- package/dist/m/c-P73XPAOA.js +1 -0
- package/dist/m/{c-PWJSJEJU.js → c-PNZIJFG7.js} +1 -1
- package/dist/m/{c-ZKKAF4UT.js → c-PRZNJUYZ.js} +2 -2
- package/dist/m/{c-B7GOFGQR.js → c-Q2CB57UG.js} +1 -1
- package/dist/m/{c-TWCXBWS3.js → c-QCDVDZIR.js} +1 -1
- package/dist/m/{c-UOOIF2AL.js → c-QDVG4NAZ.js} +1 -1
- package/dist/m/c-QWB53KRW.js +1 -0
- package/dist/m/{c-GNI7WHKF.js → c-RGAALCDU.js} +1 -1
- package/dist/m/c-RHPHMTF2.js +2 -0
- package/dist/m/{c-3UW5EJ77.js → c-RWJ3OSCP.js} +1 -1
- package/dist/m/{c-5FXEKU4Y.js → c-SEVOS4UE.js} +1 -1
- package/dist/m/{c-HDVH3MVC.js → c-SFYTKRU7.js} +1 -1
- package/dist/m/{c-47IBJGPQ.js → c-SFZRY6RT.js} +1 -1
- package/dist/m/{c-QENKN7QI.js → c-SGG6MUXW.js} +1 -1
- package/dist/m/c-SMLAJASY.js +1 -0
- package/dist/m/{c-DFKBGSN2.js → c-SUAC5RSG.js} +1 -1
- package/dist/m/{c-6RGEQNVV.js → c-SXZYVXD6.js} +1 -1
- package/dist/m/{c-ZFO5RW6G.js → c-TCFVG3I4.js} +1 -1
- package/dist/m/{c-OCYG4NBQ.js → c-TLQINES7.js} +2 -2
- package/dist/m/c-U4TWEIKZ.js +1 -0
- package/dist/m/{c-MQYEDF3Q.js → c-U65PREMC.js} +1 -1
- package/dist/m/{c-PDBNCJCT.js → c-U7F66I64.js} +1 -1
- package/dist/m/{c-LATNQ6Q5.js → c-UD4VDBGJ.js} +1 -1
- package/dist/m/{c-PCNJETUA.js → c-V2FPBRO6.js} +1 -1
- package/dist/m/{c-ND3Q2G2I.js → c-V4B3RUWB.js} +1 -1
- package/dist/m/{c-JWDCQL6J.js → c-V5L6HWVL.js} +1 -1
- package/dist/m/c-VMXCX52Q.js +1 -0
- package/dist/m/{c-CZHTXGJS.js → c-VO6RSFCO.js} +1 -1
- package/dist/m/c-WDFQ7PBU.js +1 -0
- package/dist/m/{c-OG6GFSUX.js → c-WGQVSKKC.js} +1 -1
- package/dist/m/c-WSTUCBHV.js +1 -0
- package/dist/m/{c-FEC6LGFF.js → c-WVCT3ITX.js} +1 -1
- package/dist/m/{c-SE3SIY7Y.js → c-X3V4RWMA.js} +1 -1
- package/dist/m/{c-HIX5H5L7.js → c-XHZIKRCV.js} +1 -1
- package/dist/m/{c-2BLVA6IN.js → c-XQTERKQA.js} +1 -1
- package/dist/m/{c-PYG2NGWU.js → c-YFO6ZJLQ.js} +1 -1
- package/dist/m/{c-7CM4GMTS.js → c-YX2MC7YL.js} +1 -1
- package/dist/m/{c-OYHI67B6.js → c-YYGUHSZR.js} +1 -1
- package/dist/m/{c-YYMZWQLR.js → c-Z2OZFX3N.js} +1 -1
- package/dist/m/{c-AT7GLQGV.js → c-ZEA3DCG3.js} +1 -1
- package/dist/m/{c-T3P3AXEW.js → c-ZJG6C2WL.js} +1 -1
- package/dist/m/{c-FVPNX2GO.js → c-ZORVIXUR.js} +1 -1
- package/dist/m/{c-SKMIR5HQ.js → c-ZPI7M5U5.js} +1 -1
- package/dist/m/core/{admin-attrs-ONRWVXPK.js → admin-attrs-ZI6K6UGM.js} +1 -1
- package/dist/m/core/{autosave-TBKAAAFB.js → autosave-BSM2ABJL.js} +1 -1
- package/dist/m/core/{conflict-notice-FOEE6I7E.js → conflict-notice-7EQLDYPA.js} +1 -1
- package/dist/m/core/draft-mode-M5XNYBMY.js +1 -0
- package/dist/m/core/{host-permission-X4BENZEU.js → host-permission-5BYP24GC.js} +1 -1
- package/dist/m/core/{is-edit-mode-FFHCQ5DR.js → is-edit-mode-73OXKK5H.js} +1 -1
- package/dist/m/core/{persist-6ILUR34S.js → persist-2SZO3PCE.js} +1 -1
- package/dist/m/core/{recovery-APWADU4K.js → recovery-VZF7RJZF.js} +1 -1
- package/dist/m/core/{save-6HT2LABE.js → save-K6Q47J2X.js} +1 -1
- package/dist/m/core/{save-core-EVMNZQ4V.js → save-core-U3Z44XBO.js} +1 -1
- package/dist/m/core/{site-edits-G4BOZMV4.js → site-edits-CFMF6GHD.js} +1 -1
- package/dist/m/core/{snapshot-FJP5IJL3.js → snapshot-PWCHYFL6.js} +1 -1
- package/dist/m/core/unsaved-warning-2WRZLJH5.js +1 -0
- package/dist/m/events/{index-B6TGDYMG.js → index-YKQIBZE5.js} +1 -1
- package/dist/m/internals/index-FSLC4M7J.js +1 -0
- package/dist/m/lib/{cache-bust-NH7VBWHO.js → cache-bust-BL4KUQAJ.js} +1 -1
- package/dist/m/{loader-GLLVDUZA.js → loader-RC54UV7H.js} +1 -1
- package/dist/m/manifest-3B84C829.js +1 -0
- package/dist/m/manifest-edit-1CB79AD4.js +1 -0
- package/dist/m/manifest.json +1165 -1115
- package/dist/m/options/{options-55LQHSJ4.js → options-LKIZ7YTG.js} +1 -1
- package/dist/m/page/{editor-KAZDJNND.js → editor-PKSPJ2XJ.js} +2 -2
- package/dist/m/plugins/{ai-edit-LABECCSN.js → ai-edit-3LG6MGS3.js} +1 -1
- package/dist/m/plugins/{demo-T7B4RIKL.js → demo-LMCMBILC.js} +1 -1
- package/dist/m/plugins/{derive-6LPJOCAV.js → derive-7DR5TUDH.js} +1 -1
- package/dist/m/plugins/{indicator-J4ABFARX.js → indicator-CTKX4EY7.js} +1 -1
- package/dist/m/plugins/{live-PGBIEMGB.js → live-IFLL6YN5.js} +1 -1
- package/dist/m/plugins/{menu-YZL3X2AJ.js → menu-YJZ3JWBC.js} +1 -1
- package/dist/m/plugins/{page-WOCNX2IN.js → page-GTDPYGE4.js} +2 -2
- package/dist/m/plugins/{page-view-SJODOOGE.js → page-view-NMCCU6MF.js} +1 -1
- package/dist/m/plugins/{people-C4TCWFOQ.js → people-6WIWCZEG.js} +1 -1
- package/dist/m/plugins/{richclay-Y2NV44NA.js → richclay-L3BZMX4I.js} +2 -2
- package/dist/m/plugins/{sortable-XCHQG65Z.js → sortable-365SRRL3.js} +1 -1
- package/dist/m/plugins/{source-YK7MO23W.js → source-7LSGOV46.js} +1 -1
- package/dist/m/plugins/{undo-VLRBQNPN.js → undo-UES4KS7B.js} +1 -1
- package/dist/m/plugins/{upgrade-NNTJBSK2.js → upgrade-MMPZUCDM.js} +1 -1
- package/dist/m/plugins/{upload-ZKKJV76X.js → upload-NZET3DNQ.js} +1 -1
- package/dist/m/plugins/visitor-drafts-V5YB7XDH.js +20 -0
- package/dist/m/plugins/{visitor-drafts-owner-LHUHFU3L.js → visitor-drafts-owner-TLECTYWS.js} +1 -1
- package/dist/m/plugins/{visitor-menu-FY4KM2SW.js → visitor-menu-QDV2MYJN.js} +1 -1
- package/dist/m/plugins/wire-3YGUO3GE.js +1 -0
- package/dist/m/{reader-core-T2S3JC4E.js → reader-core-VR7EL4WV.js} +2 -2
- package/dist/m/sync/live-sync-XMXXZS3G.js +1 -0
- package/dist/m/vendor/sap-core.vendor-JANUQULT.js +7 -0
- package/dist/offline-manifest.json +665 -635
- package/docs/guide.md +1 -0
- package/entries/sap.js +6 -5
- package/package.json +1 -1
- package/src/core/draft-mode.js +5 -0
- package/src/core/save-core.js +10 -10
- package/src/core/save.js +1 -1
- package/src/lib/dirty-gate.js +19 -0
- package/src/plugins/menu/visitor.js +33 -1
- package/src/plugins/visitor-drafts/commit.js +50 -3
- package/src/plugins/visitor-drafts/idb.js +8 -2
- package/src/plugins/visitor-drafts/recovery-menu.js +118 -0
- package/src/plugins/visitor-drafts/recovery.js +64 -0
- package/src/plugins/visitor-drafts/session.js +61 -13
- package/src/plugins/visitor-drafts/store.js +44 -8
- package/src/plugins/visitor-drafts.js +34 -5
- package/src/sync/live-sync.js +1 -1
- package/src/sync/wire-profile.js +9 -4
- package/src/vendor/sap-core.vendor.js +6 -5
- package/src/vendor/sap-ownership.vendor.js +181 -11
- package/tool-generation/system.md +1 -1
- package/dist/m/attrs/save-freeze-JZHKRQLR.js +0 -1
- package/dist/m/c-6Q6RGFBF.js +0 -1
- package/dist/m/c-APGHGDZM.js +0 -1
- package/dist/m/c-EILLN2H2.js +0 -1
- package/dist/m/c-HTLYXCUH.js +0 -1
- package/dist/m/c-MFOSMAVM.js +0 -3
- package/dist/m/c-R23UHMXG.js +0 -1
- package/dist/m/c-SGH3UTF3.js +0 -1
- package/dist/m/c-U4NTUVDZ.js +0 -1
- package/dist/m/c-V2U3F4QX.js +0 -1
- package/dist/m/c-VG5XIN4T.js +0 -1
- package/dist/m/c-VHSMPITY.js +0 -1
- package/dist/m/core/draft-mode-4MCL3LYI.js +0 -1
- package/dist/m/core/unsaved-warning-ITZDIZ2I.js +0 -1
- package/dist/m/internals/index-HS3CQDFW.js +0 -1
- package/dist/m/manifest-50FF1C45.js +0 -1
- package/dist/m/manifest-edit-BE1A621D.js +0 -1
- package/dist/m/plugins/visitor-drafts-RTZNONHT.js +0 -20
- package/dist/m/plugins/wire-M2NR354P.js +0 -1
- package/dist/m/sync/live-sync-Z64YREWQ.js +0 -1
- package/dist/m/vendor/sap-core.vendor-QAEPMETX.js +0 -6
- /package/dist/m/plugins/{richclay-Y2NV44NA.js.LEGAL.txt → richclay-L3BZMX4I.js.LEGAL.txt} +0 -0
package/docs/guide.md
CHANGED
|
@@ -2609,6 +2609,7 @@ The rung is where a free document lives, so the details matter:
|
|
|
2609
2609
|
- **The save lane is the browser.** `clay.save()` and autosave both run, `savestatus` moves as usual, and the save answers `msgType: "success"` with `msg: "Saved in this browser"`. A storage failure answers the 507 path with `code: "draft-storage"` and fires `clay:drafts-store-failed`; the next good write clears it.
|
|
2610
2610
|
- **The draft record keeps the block editor state as well as the rules data.** The stored record is `{ v: 1, savedAt, id, ancestry, data, live, blockeditor }`. `data` holds the rules data. `live` holds the values of the document's live stores: `<script type="application/json" merge="blockeditor" clay="live">` and the others such as `blockeditor.tools` and `blockeditor.settings`. The `blockeditor` store's value holds base64 Yjs updates. `blockeditor` is `{ rev, html }`, holding the article's `data-rev` and its HTML. On restore, ClayJS writes the stores and the article into the document before the block editor reads them. When this tab has never edited the article and it still matches the served one, ClayJS does not record it, so a visitor who never wrote in the block editor gets the owner's later article. Once a tab has recorded the article, it keeps recording it, even when the visitor deletes back to the served text. If none of the saved `data` fields fit the current rules, ClayJS still restores the article and live stores and keeps the whole record under the `:unreadable:` key, as for a partial fit.
|
|
2611
2611
|
- **No request reaches the host.** The download link goes to the host's download page, which holds the email sign-up. Hyperclay's download page sends the host only the rules data. In the visitor's browser, it adds the stored page to the file, writing the page's store tags and article into the file the host returns. The prompt's own stylesheet is a Google Fonts link.
|
|
2612
|
+
- **Links that leave the page can wait for the draft.** A link with the `clay-wait-drafts` attribute, followed by a plain click in the same tab, waits until the visitor's last change is stored where the download page reads it, then navigates. The wait is at most 3 seconds; past that, or when the browser refuses to store the change, the link opens anyway and the download page asks the visitor to go back and try again. Hyperclay's trial bar marks its **Download your copy** and **Host and share online** links this way, so a visitor who clicks right after typing gets that typing in the file. A second click while the first waits does nothing more. Links that open a new tab, and clicks with a modifier key, leave the page open and do not wait. The link can sit inside an open shadow root.
|
|
2612
2613
|
- **`clay.readData()` and `clay.writeData()` refuse.** Both reject with `code: "DataUnavailableInDraft"`: the saved file belongs to the owner, and this visitor's work is in their browser, so there is nothing for them to read or write there. A document that calls them in draft mode gets that refusal instead of a request ([Import and export](https://clayjs.com/docs/guide/architecture/#import-and-export)).
|
|
2613
2614
|
- **`clay.visitorDrafts`** is the plugin's whole surface:
|
|
2614
2615
|
|
package/entries/sap.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// GENERATED — do not edit. Vendored from sapjs/dist/sap.min.js via sapjs
|
|
2
2
|
// `npm run copy-to-clayjs`. Edit the sapjs source and re-run.
|
|
3
3
|
(function () {
|
|
4
|
-
var Sap=(()=>{var
|
|
4
|
+
var Sap=(()=>{var xe=Object.defineProperty;var kr=Object.getOwnPropertyDescriptor;var Sr=Object.getOwnPropertyNames;var $r=Object.prototype.hasOwnProperty;var _r=(t,e)=>{for(var r in e)xe(t,r,{get:e[r],enumerable:!0})},Nr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Sr(e))!$r.call(t,o)&&o!==r&&xe(t,o,{get:()=>e[o],enumerable:!(n=kr(e,o))||n.enumerable});return t};var Tr=t=>Nr(xe({},"__esModule",{value:!0}),t);var Po={};_r(Po,{Sap:()=>Ae,default:()=>Oo,mount:()=>Lo,mountAll:()=>xr,runtime:()=>Co});function Ue(t){let e=!1,r=new Set,n=[];function o(d){d&&(n.push(d),n.length>8&&n.shift())}function i(d,p,R){if(o(p),R){if(d._broken||d.halted)d._changes=!1;else if(d._changes!==!1){let D=d._changes||(d._changes=[]);for(let f of R)D.push(f)}if(d._inPass)return}if(d._broken){if(p==="mutation")return;h(d)}r.has(d)||(d._trigger=p),r.add(d),!e&&(e=!0,queueMicrotask(s))}function s(){e=!1;for(let d of[...r])r.delete(d)&&g(d,!1,d._trigger)}function g(d,p,R){if(!(d._broken||d.halted)){if(d._passes=(d._passes||0)+1,d._passes>50){d._broken=!0,d._breakerRing=n.slice(),t(d,{breaker:!0});return}d._resetArmed||(d._resetArmed=!0,setTimeout(()=>{d._passes=0,d._resetArmed=!1},0)),t(d,p?{full:!0,cause:R}:{cause:R})}}function k(d,p){o(p),d._broken&&h(d),g(d,!0,p)}function h(d){d._broken=!1,d._passes=0}function l(){let d=e;for(;e;)s();return d}return{schedule:i,runNow:k,flushNow:l}}var Rr={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"},E52:{slug:"plugin-not-loaded",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"}},ht=["disabled","readonly","required","checked","selected","multiple","open","inert","autofocus","novalidate","hidden"],Tt=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"]),Jt=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"]);function Qt(t){if(!t||t.nodeType!==1)return"?";if(t.id)return`${t.tagName.toLowerCase()}#${t.id}`;let e=[],r=t,n=0;for(;r&&r.nodeType===1&&n<4;){let o=r.tagName.toLowerCase();if(r.hasAttribute("sap"))o+="[sap]";else if(r.parentElement){let i=0,s=0;for(let g=r.parentElement.firstElementChild;g;g=g.nextElementSibling)g.tagName===r.tagName&&(i++,g===r&&(s=i));i>1&&(o+=`:nth-of-type(${s})`)}if(e.unshift(o),r.hasAttribute("sap"))break;r=r.parentElement,n++}return e.join(" > ")}var mt=class{constructor(e){this.appName=e,this.errors=[],this.warnings=[],this.halted=!1,this.haltReason=null}block(e,r,n={}){let o=(Rr[e]||{}).slug||"error",i={code:e,slug:o,el:Qt(r),attr:n.attr||null,expr:n.expr||null,key:n.key||null,problem:n.problem||"",didYouMean:n.didYouMean||null,fix:n.fix||null,phase:n.phase||"runtime"},s=[`
|
|
5
5
|
`+(e[0]==="W"?"sap \u26A0 ":"sap \u2717 ")+e+" "+o];return s.push(` at ${i.el}${i.attr?` \u2014 ${i.attr}="${i.expr??""}"`:""}`),i.problem&&s.push(` problem: ${i.problem}`),i.didYouMean&&s.push(` did you mean: ${i.didYouMean}`),i.fix&&s.push(` fix: ${i.fix}`),(e[0]==="W"?console.warn:console.error)(s.join(`
|
|
6
|
-
`)),i}error(e,r,n={}){let o=this.block(e,r,n);return this.errors.push(o),o}warn(e,r,n={}){let o=this.block(e,r,n);return this.warnings.push(o),o}
|
|
7
|
-
${t}`:`"use strict"; return (${t});`;n={fn:new Function(...
|
|
6
|
+
`)),i}error(e,r,n={}){let o=this.block(e,r,n);return this.errors.push(o),o}warn(e,r,n={}){let o=this.block(e,r,n);return this.warnings.push(o),o}};function z(t,e){t&&t.getAttribute("sap-error")!==e&&t.setAttribute("sap-error",e)}function Z(t){t&&t.hasAttribute("sap-error")&&t.removeAttribute("sap-error")}function Rt(t,e){let r=null,n=3;for(let o of e){let i=Lr(t,o);i<n&&(n=i,r=o)}return r}function Lr(t,e){let r=t.length,n=e.length,o=Array.from({length:r+1},(i,s)=>[s,...new Array(n).fill(0)]);for(let i=0;i<=n;i++)o[0][i]=i;for(let i=1;i<=r;i++)for(let s=1;s<=n;s++)o[i][s]=Math.min(o[i-1][s]+1,o[i][s-1]+1,o[i-1][s-1]+(t[i-1]===e[s-1]?0:1));return o[r][n]}var Ge=["sap","item","scope","items","detail","each"],Lt=new Map,Ct=new Map,Zt="";function Ye(t){for(let[e,r]of Object.entries(t.boundaries||{}))te(e)&&Lt.set(e,{name:e,plugin:t.name,opaque:!!r.opaque,on:r.on||null,installed:!1});for(let[e,r]of Object.entries(t.directives||{}))te(e)&&Ct.set(e,{name:e,plugin:t.name,key:r.key,impure:!!r.impure,parse:null});Zt=[...Lt.values()].map(e=>`${e.on||""}[${e.name}]`).join(",")}function te(t,e){return!Ge.includes(t)&&(Xe(t)||e)===e}function Ke(t,e){for(let r of Lt.values())r.plugin===t&&(r.installed=!!e);for(let r of Ct.values())r.plugin===t&&(r.parse=e&&e[r.name]||null)}function Xe(t){return(Lt.get(t)||Ct.get(t)||{}).plugin}function Je(t){return Ct.get(t)}function ke(t){return!!Xe(t)||Ct.has(t.slice(0,t.indexOf(":")+1))}function Ot(t){if(!Zt)return null;for(let e of Lt.values())if(!(e.on&&t.localName!==e.on||!t.hasAttribute(e.name)))return Ge.some(r=>t.hasAttribute(r))?null:e;return null}function bt(t){let e=Ot(t);return!!e&&(e.opaque||!e.installed)}function Pt(t){if(!Zt)return null;for(let e=t.parentElement;e;e=e.parentElement)if(e=e.closest(Zt),!e||bt(e))return e;return null}function gt(t){return bt(t)?t:Pt(t)}function Y(t,e){if(!(e(t)===!1||bt(t)))for(let r=t.firstElementChild;r;r=r.nextElementSibling)Y(r,e)}var Cr=new Set(ht),Or={readonly:"readOnly",novalidate:"noValidate"},Pr=0,Qe=new WeakMap;function ee(t,e="sap"){let r=t.getAttribute("data-id");if(r)return r;if(t.id)return t.id;let n=Qe.get(t);return n||(n=`${e}-${(Pr++).toString(36)}`,Qe.set(t,n)),n}function Ze(t,e="row"){for(;;){let r=`${e}-${Math.random().toString(36).slice(2,8)}`;if(!t.getElementById(r)&&!t.querySelector(`[data-id="${r}"]`))return r}}function Dr(t){return t.hasAttribute("scope")||t.hasAttribute("items")||t.hasAttribute("detail")||t.hasAttribute("each")||Ot(t)!==null}function Fr(t){return t.tagName==="TEMPLATE"||t.hasAttribute("sap-ignore")||t.hasAttribute("template")||t.hasAttribute("cms-template")}function J(t,e){for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(Fr(n))return;let o=Dr(n);if(e(n,o),!o)for(let i=n.firstElementChild;i;i=i.nextElementSibling)r(i)}}function U(t){let e=t;for(;e;){if(e.hasAttribute("sap")||e.hasAttribute("scope")||e.hasAttribute("item")||e.hasAttribute("detail"))return e;e=e.parentElement}return null}function ct(t){for(let e=t;e&&e.nodeType===1;e=e.parentElement){if(e._sapEachRow)return e;if(e.hasAttribute("item")||e.hasAttribute("sap"))return null}return null}function ne(t){let e=t;for(;e;){if(e.hasAttribute("detail")||e.hasAttribute("item"))return e;e=e.parentElement}return null}function Dt(t){let e=t;for(;e;){if(e.hasAttribute("detail"))return e;e=e.parentElement}return null}function lt(t,e){if(t.hasAttribute("item")&&t.getAttribute("bind")===e)return t;let r=null;return J(t,n=>{!r&&n.getAttribute("bind")===e&&(r=n)}),r}function wt(t,e){let r=null;return J(t,n=>{!r&&n.getAttribute("items")===e&&(r=n)}),r}function yt(t,e){return!t||t.nodeType!==1||!t.hasAttribute("item")?!1:lt(t,e)||wt(t,e)?!0:B(t.getAttribute("state")||"").some(r=>r.name===e)}function tn(t){let e=t&&t.$el;return e&&e.nodeType===1&&e.isConnected&&e.hasAttribute("item")?e:null}function re(t){return!!t.closest("form[trigger-add]")}function it(t){let e=[];for(let r=t.firstElementChild;r;r=r.nextElementSibling)r.hasAttribute("item")&&!r.hasAttribute("template")&&!r.hasAttribute("cms-template")&&e.push(r);return e}function Se(t,e){if(!t||!e)return null;let r=[...t.querySelectorAll(`template[items="${e}"]`)].find(o=>o.closest("[sap]")===t),n=r&&r.content.firstElementChild;return n&&n.hasAttribute("item")?n:null}function oe(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.hasAttribute("item")&&e.hasAttribute("template"))return e;return Se(t.closest("[sap]"),t.getAttribute("items"))}function B(t){let e=[];if(!t)return e;for(let r of t.trim().split(/\s+/)){if(!r)continue;let n=r,o,i=n.indexOf("=");i>=0&&(o=n.slice(i+1),n=n.slice(0,i));let s=n.split(":"),g=s[0],k="string",h=!1;for(let p of s.slice(1))p==="num"?k="num":p==="bool"?k="bool":p==="presence"?k="presence":p==="transient"&&(h=!0);let l=g,d=l.startsWith("data-")&&l.length>5?l.slice(5).replace(/-([a-z])/g,(p,R)=>R.toUpperCase()):l;e.push({name:d,attr:l,type:k,default:o,transient:h})}return e}function ut(t,e){if(e==="num"){if(t==null||t==="")return 0;let r=Number(t);return Number.isNaN(r)?0:r}return e==="bool"?t==="true"||t===""||t==="1":t??""}function $e(t,e){return e==="bool"?t?"true":"false":t==null?"":String(t)}function _e(t,e){return Cr.has(e)&&typeof t[Or[e]||e]=="boolean"}function st(t,e){return e.type==="presence"||e.type!=="num"&&_e(t,e.attr||e.name)}function Ft(t){return t.default!=null?t.default:t.type==="num"?"0":t.type==="bool"?"false":""}function en(t,e){let r=e.attr||e.name;if(st(t,e))return t.hasAttribute(r);let n=t.getAttribute(r);return ut(n??Ft(e),e.type)}function nn(t,e){return st(t,e)?e.default!=null?ut(e.default,"bool"):!1:ut(Ft(e),e.type)}function Mt(t,e,r){let n=e.attr||e.name;if(st(t,e)){r?t.hasAttribute(n)||t.setAttribute(n,""):t.hasAttribute(n)&&t.removeAttribute(n);return}t.setAttribute(n,$e(r,e.type))}function ie(t,e){let r=e.attr||e.name,n=t._sapTransient||(t._sapTransient={});if(!(e.name in n)){let o=t.getAttribute(r);o==null&&(o=Ft(e)),n[e.name]=ut(o,e.type)}return t.hasAttribute(r)&&t.removeAttribute(r),n[e.name]}function It(t,e,r){let n=e.attr||e.name;(t._sapTransient||(t._sapTransient={}))[e.name]=r,t.hasAttribute(n)&&t.removeAttribute(n)}function Wt(t,e,r){let n=String(r).split("."),o=n[n.length-1];if(n.length===1){let g=Mr(e,o);return g||(t.getAttribute("items")===o?t:t.querySelector(`[items="${o}"]:not(template)`))}let i=n[n.length-2],s=[...t.querySelectorAll(`[scope="${i}"]`)].find(g=>wt(g,o));return s?wt(s,o):null}function Mr(t,e){let r=U(t);for(;r;){if(r.getAttribute("items")===e)return r;let n=wt(r,e);if(n)return n;r=U(r.parentElement)}return null}function K(t){if(typeof t=="number")return t;if(t==null||t==="")return 0;let e=Number(typeof t=="string"?t.replace(/[$,%\s]/g,""):t);return Number.isNaN(e)?0:e}function se(t,e){return Array.isArray(t)?e==null?t:t.map(r=>typeof e=="function"?e(r):r?.[e]):[]}function Ne(t,e){return se(t,e).reduce((r,n)=>r+K(n),0)}function rn(t,e){return Array.isArray(t)?e==null?t.length:t.reduce((r,n)=>r+(e(n)?1:0),0):0}function on(t,e){let r=se(t,e);return r.length?Ne(t,e)/r.length:0}function sn(t,e){let r=se(t,e).filter(n=>n!=null&&n!=="");return r.length?r.every(n=>typeof n=="number"||!Number.isNaN(Number(n)))?Math.min(...r.map(Number)):r.reduce((n,o)=>String(n)<=String(o)?n:o):0}function an(t,e){let r=se(t,e).filter(n=>n!=null&&n!=="");return r.length?r.every(n=>typeof n=="number"||!Number.isNaN(Number(n)))?Math.max(...r.map(Number)):r.reduce((n,o)=>String(n)>=String(o)?n:o):0}function un(t,e,r){let n=K(t)===1?e:r??e+"s";return`${t} ${n}`}function cn(t,e){let r=new Date(t),n=new Date(e);return Number.isNaN(+r)||Number.isNaN(+n)?0:Math.round((n-r)/864e5)}function tt(t){return typeof t=="number"?t:Number(t)}var et={usd:t=>"$"+tt(t).toLocaleString("en-US",{maximumFractionDigits:0}),usd2:t=>"$"+tt(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),pct:t=>Math.round(tt(t))+"%",pct1:t=>tt(t).toFixed(1)+"%",int:t=>Math.round(tt(t)).toLocaleString("en-US"),num:t=>tt(t).toLocaleString("en-US"),num2:t=>tt(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),compact:t=>tt(t).toLocaleString("en-US",{notation:"compact"}),date:t=>{let e=new Date(t);return Number.isNaN(+e)?String(t):e.toLocaleDateString("en-US")},clock:t=>{let e=tt(t),r=Math.floor(e/100),n=r%10,o=Math.floor(r/10)%60;return`${Math.floor(r/600)}:${String(o).padStart(2,"0")}.${n}`}},Ir=new Set(["usd","usd2","pct","pct1","int","num","num2","compact","clock"]);function ln(t,e){if(!t)return e==null?"":String(e);let r=et[t];if(typeof r!="function"){let n=new Error(`unknown format "${t}"`);throw n.sapCode="E22",n}if(Ir.has(t)){let n=typeof e=="number"?e:Number(e);if(!Number.isFinite(n)){let o=new Error(`format "${t}" received ${typeof e=="string"?`"${e}"`:e}`);throw o.sapCode="E22",o}}return r(e)}var Te=["state","item","el","root","fmt","num","sum","count","avg","min","max","plural","days"],Bt=new Map,Re=[],fn=[],jt=null,dn=null,Wr=/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[`}](?:\\.|[^`\\])*?(?:`|\$\{)|[{}]/.source;function pn(t,e){Re=Object.keys(t),fn=Object.values(t);let r=[...e.keys()].filter(n=>Ce(n)&&!(n in t));dn=e,jt=r.length?new RegExp(`${Wr}|\\.{3}|(${r.join("|")})\\s*\\(|[\\w$.]+`,"g"):null,Bt.clear()}function Le(t){return t in globalThis&&globalThis[t]?.nodeType!==1}function Ce(t){return/^[a-z_]\w*$/i.test(t)&&!Te.includes(t)&&!Le(t)}function mn(t){try{return Ce(t)&&!!new Function(t,'"use strict"')}catch{return!1}}function Vt(t){let e=[],r;if(jt)for(jt.lastIndex=0;r=jt.exec(t);){let[n,o]=r;if(o&&Ce(o))return dn.get(o);n[0]==="}"&&!e.pop()?.[1]?jt.lastIndex=r.index+1:n.endsWith("{")&&e.push(n)}return null}var Br=/\bstate\.([a-z][a-z0-9_]*)/g,jr=/\bitem\.([a-z][a-z0-9_]*)/g;function Vr(t){let e=r=>new Set([...(t||"").matchAll(r)].map(n=>n[1]));return{state:e(Br),item:e(jr)}}function G(t,e=!1){let r=(e?"!":"")+t,n=Bt.get(r);if(n)return n;Bt.size>512&&Bt.clear();try{let o=e?`"use strict";
|
|
7
|
+
${t}`:`"use strict"; return (${t});`;n={fn:Re.length?new Function(...Re,`return function(${Te}){${o}
|
|
8
|
+
}`)(...fn):new Function(...Te,o),src:t,statement:e,deps:Vr(t),error:null,waits:Vt(t)}}catch(o){n={fn:null,src:t,statement:e,deps:{state:new Set,item:new Set},error:o,waits:null}}return n.waits||Bt.set(r,n),n}function nt(t,e){return H(t,e.state,e.item,e.el??null,e.root)}function H(t,e,r,n,o){if(t.error)throw t.error;return t.fn(e,r,n,o,et,K,Ne,rn,on,sn,an,un,cn)}function hn(t){let e=new Map;for(let s of t)e.set(s.name,s);let r=[],n=new Map,o=[];function i(s){let g=n.get(s.name);if(g!==1){if(g===0){let k=[...o.slice(o.indexOf(s.name)),s.name].join(" -> "),h=new Error(`calc: cycle: ${k}`);throw h.sapCode="E07",h.cycle=k,h}n.set(s.name,0),o.push(s.name);for(let k of s.entry.deps.state){let h=e.get(k);h&&h!==s&&i(h)}for(let k of s.entry.deps.item){let h=e.get(k);h&&h!==s&&i(h)}o.pop(),n.set(s.name,1),r.push(s)}}for(let s of t)i(s);return r}var qt={},ft=null,yn=!0,ue=!1;function ce(){qt={}}function An(t){let e=ue;return ft?Oe(ft.takeRecords()):yn&&qr(),ue=!!ft&&t.getRootNode()===document,e}function vn(t){ue=t}function At(){ft&&Oe(ft.takeRecords())}function qr(){if(typeof document>"u"||typeof MutationObserver!="function"){yn=!1;return}ft=new MutationObserver(Oe),ft.observe(document,{attributes:!0,childList:!0,subtree:!0})}function Oe(t){for(let e of t)if(e.type==="attributes")bn(e.target);else if(e.addedNodes.length&&!(e.target.nodeType===1&>(e.target)))for(let r of e.addedNodes)r.nodeType===1&&Y(r,bn)}function bn(t){t._sapPlan&&(t._sapPlan=null)}function X(t){if(!ue)return gn(t);let e=t._sapPlan;return e&&e.gen===qt?e:t._sapPlan=gn(t)}function rt(t,e,r){let n=G(e,r);return n.waits&&(t.waits=n.waits),n}function gn(t){let e={gen:qt,inert:t.tagName==="TEMPLATE",template:!1,cms:!1,item:!1,scope:!1,items:!1,detail:!1,each:!1,boundary:null,bind:null,transient:!1,decls:null,calcs:null,paints:null,effects:null,invalids:null,waits:null,wants:null,ext:!1,impure:!1};for(let n of t.attributes){let o=n.name,i=n.value,s=o.indexOf(":");if(s<0){switch(o){case"sap-ignore":e.inert=!0;break;case"cms-template":e.inert=!0,e.cms=!0;break;case"template":e.inert=!0,e.template=!0;break;case"item":e.item=!0;break;case"scope":e.scope=!0;break;case"items":e.items=!0;break;case"detail":e.detail=!0,e.waits=Vt(i)||e.waits;break;case"each":e.each=!0,e.waits=Vt(i)||Vt(t.getAttribute("key"))||e.waits;break;case"bind":e.bind=i;break;case"transient":e.transient=!0;break;case"state":e.decls=B(i);break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:null,entry:rt(e,i)});break;case"show":(e.paints||(e.paints=[])).push({kind:"show",entry:rt(e,i)});break;case"effect":(e.effects||(e.effects=[])).push({entry:rt(e,i,!0)});break;case"invalid":(e.invalids||(e.invalids=[])).push({entry:rt(e,i)});break;default:wn(e,o,"",i)}continue}let g=o.slice(0,s),k=o.slice(s+1);switch(g){case"calc":(e.calcs||(e.calcs=[])).push({name:k,entry:rt(e,i)});break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:k,entry:rt(e,i)});break;case"attr":(e.paints||(e.paints=[])).push({kind:"attr",arg:k,entry:rt(e,i)});break;case"class":(e.paints||(e.paints=[])).push({kind:"class",arg:k,entry:rt(e,i)});break;case"css":(e.paints||(e.paints=[])).push({kind:"css",arg:k,entry:rt(e,i)});break;case"show-when":case"option":(e.paints||(e.paints=[])).push({kind:"when",match:"show",field:k,values:i.split("|")});break;case"hide-when":(e.paints||(e.paints=[])).push({kind:"when",match:"hide",field:k,values:i.split("|")});break;case"option-not":(e.paints||(e.paints=[])).push({kind:"when",match:"show-not",field:k,values:i.split("|")});break;default:wn(e,g+":",k,i)}}let r=Ot(t);return e.boundary=e.scope?"scope":e.items?"items":e.detail?"detail":e.each?"each":r?r.name:null,r&&!r.installed&&(e.wants||=[]).push(r.plugin),zr(e)?Hr():e}function wn(t,e,r,n){let o=Je(e);if(!o)return;if(!o.parse){(t.wants||=[]).push(o.plugin);return}let i=o.parse(r,n);i!==void 0&&((t[o.key]||(t[o.key]=[])).push(i),t.ext=!0,o.impure&&(t.impure=!0),i&&i.entry&&i.entry.waits&&(t.waits=i.entry.waits))}var ae=null;function Hr(){return(!ae||ae.gen!==qt)&&(ae=Object.freeze({gen:qt,inert:!1,template:!1,cms:!1,item:!1,scope:!1,items:!1,detail:!1,each:!1,boundary:null,bind:null,transient:!1,decls:null,calcs:null,paints:null,effects:null,invalids:null,waits:null,wants:null,ext:!1,impure:!1})),ae}function zr(t){return!t.inert&&!t.item&&t.boundary===null&&t.bind===null&&!t.transient&&!t.decls&&!t.calcs&&!t.paints&&!t.effects&&!t.invalids&&!t.wants&&!t.ext}var Et=new WeakMap,xt=new WeakMap,vt=null,at=!1;function xn(){Et=new WeakMap,xt=new WeakMap}function En(t){for(let e of t){let r=e.target.nodeType===1?e.target:e.target.parentElement;for(let o=r;o;o=o.parentElement)xt.delete(o);if(e.type==="attributes"){Et.delete(e.target);continue}for(let o=r;o;o=o.parentElement)Et.delete(o);let n=e.addedNodes;if(!(!n||!n.length||r&>(r)))for(let o of n)o.nodeType===1&&Y(o,Ur)}}function Ur(t){Et.delete(t),xt.delete(t)}function kn(){return at}function Sn(t){return at?xt.get(t):void 0}function $n(t,e){at&&xt.set(t,e)}function kt(t){xt.delete(t)}function _n(t){let e=at;return!vt&&typeof MutationObserver=="function"&&(vt=new MutationObserver(En),vt.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),vt&&En(vt.takeRecords()),at=!!vt&&t.getRootNode()===document,e}function Nn(t){at=t}function Tn(t){let e=Et.get(t);return e||Et.set(t,e={attrs:new Map,hasText:!1,text:""}),e}function Rn(t,e){if(!at)return t.getAttribute(e);let r=Tn(t);return r.attrs.has(e)||r.attrs.set(e,t.getAttribute(e)),r.attrs.get(e)}function Ln(t){if(!at)return t.textContent;let e=Tn(t);return e.hasText||(e.text=t.textContent,e.hasText=!0),e.text}function Cn(t){return(t.getAttribute("type")||"text").toLowerCase()}function St(t){let e=t.tagName;if(e==="INPUT"){let r=Cn(t);r==="checkbox"||r==="radio"?t.checked?t.setAttribute("checked",""):t.removeAttribute("checked"):t.setAttribute("value",t.value);return}if(e==="TEXTAREA"){t.setAttribute("data-value",t.value);return}if(e==="SELECT"){let r=t.options;for(let n=0;n<r.length;n++)r[n].selected?r[n].setAttribute("selected",""):r[n].removeAttribute("selected")}}function On(t,e=t){let r=t.tagName;if(r==="INPUT"){let n=Cn(t);n==="checkbox"||n==="radio"?e.checked?t.hasAttribute("checked")||t.setAttribute("checked",""):t.removeAttribute("checked"):e.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",e.value);return}if(r==="TEXTAREA"){let n=e.value.startsWith(`
|
|
8
9
|
`)?`
|
|
9
|
-
`+e.value:e.value;t.textContent!==n&&(t.textContent=n),t.removeAttribute("data-value");return}if(r==="SELECT"){let n=t.options,o=e.options;for(let i=0;i<n.length;i++)o[i]&&o[i].selected?n[i].hasAttribute("selected")||n[i].setAttribute("selected",""):n[i].removeAttribute("selected")}}function qt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function O(t){if(typeof window>"u")return null;let e=window.clay,r=window.hyperclay;return t==="consent"?e?.confirm||r?.consent||null:e?.[t]||r?.[t]||null}function Ke(){let t=O("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var ie=["clay:mutation-ready","hyperclay:mutation-ready"],ir=["clay:sync-applied","hyperclay:livesync-applied"],sr=["clay:ready","hyperclay:ready"],ar=["clay:route"],ur=["clay:modechange"];function kt(t,e,r){let n=null,o=i=>{n!==null&&n!==i.type||(n=i.type,queueMicrotask(()=>{n=null}),r(i))};for(let i of e)t.addEventListener(i,o);return()=>{for(let i of e)t.removeEventListener(i,o)}}function Je(t){let e=typeof window<"u"&&window.clay&&window.clay.ready;e&&typeof e.then=="function"?e.then(()=>t(),()=>t()):t()}function zt(t){let e=O("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function $t(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function F(t,{transient:e=!1}={}){if(e)return!0;let r=$t();return typeof r?.canWrite!="function"||O("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Qe(){let t=O("consent");return typeof t=="function"?t:null}function Ze(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=O("undo");r&&r.flush&&r.flush();let n=e();if(n&&typeof n.then=="function")throw new Error("Sap.batch fn must be synchronous (it returned a promise)");return r&&r.commitCaptured&&r.commitCaptured(t),n}function tn(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let A=!1;for(let N of t.apps())N.root.isConnected?t.runNow(N,"platform"):A=!0;A&&t.pruneDisconnected(),t.remountIfPresent()},r=O("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:kt(document,ir,e),i=kt(document,ar,e),s=null,b=!1,m=()=>{let A=s;s=null,A&&(A[2](),A[3]())},d=()=>{if(b)return!1;let A=O("undo"),N=$t()?.state?.generation;if(s&&s[0]===A&&s[1]===N)return!0;if(m(),!A||typeof A.on!="function")return!1;let R=A.on("undo",e);if(typeof R!="function")return!1;let p=A.on("redo",e);return typeof p!="function"?(R(),!1):(s=[A,N,R,p],!0)};d();let u=[ie,sr,ur].map(A=>kt(document,A,d)),E=O("ready");return E&&typeof E.then=="function"&&E.then(d,()=>{}),()=>{b=!0,typeof n=="function"&&n(),o&&o(),i();for(let A of u)A();m()}}function _t(t){let e=t.tagName;if(e==="INPUT"){let r=(t.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return e==="TEXTAREA"?"text":e==="SELECT"?t.multiple?"select-multiple":"select-one":"leaf"}function cr(t){if(t.validity&&t.validity.badInput)return t.hasAttribute("value")?Number(t.getAttribute("value"))||0:t._sapLastGood??0;if(t.value==="")return 0;let e=Number(t.value);return Number.isNaN(e)?t._sapLastGood??0:(t._sapLastGood=e,e)}function en(t,e){switch(e){case"checkbox":return t.checked;case"radio":return t.checked?t.value:void 0;case"number":return cr(t);case"select-one":return t.value;case"select-multiple":return[...t.selectedOptions].map(r=>r.value);case"hidden":case"text":return t.value;case"leaf":return t.textContent;default:return t.value}}function nn(t,e,r){switch(e){case"checkbox":t.checked=!!r;break;case"radio":t.checked=String(t.value)===String(r);break;case"number":case"text":case"hidden":t.value=r==null?"":String(r);break;case"select-one":t.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of t.options)o.selected=n.has(o.value);break}case"leaf":t.textContent=r==null?"":String(r);break;default:t.value=r==null?"":String(r)}}function se(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}zt(t)||mt(t)}function fr(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function Ht(t,e){return en(t,e)}function rn(t,e,r){nn(t,e,r),se(t)}function B(t){let e=_t(t);return{el:t,kind:e,read(){return en(t,e)},write(r,n={}){nn(t,e,r),n.noMirror||se(t),n.silent||fr(t)},mirror(){se(t)}}}var J=null,Ut=!1,ht=null;function on(t){let e=null;return{kind:"hub",subscribe(r){let n=t.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(e=n)},suppress(r){t.pause();try{return r()}finally{t.resume()}},teardown(){if(e){try{e()}catch{}e=null}}}}function lr(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(dr(n)));let r=typeof document<"u"&&document.body||typeof document<"u"&&document.documentElement;r&&t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(e){let r=O("undo");r&&r.pause&&r.pause();try{return e()}finally{t&&t.takeRecords(),r&&r.resume&&r.resume()}},teardown(){t&&(t.disconnect(),t=null)}}}function dr(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!Vt(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!Vt(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||Vt(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))Vt(o)||e.push({type:"add",element:o});for(let n of r.removedNodes)n.nodeType===1&&e.push({type:"remove",element:n,parent:r.target})}return e}function Vt(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function pr(t,e){t.pruneDisconnected();let r=new Set,n=!1;for(let o of e){let i=o.type==="remove"?o.parent:o.element,s=i&&t.appFor(i);s&&r.add(s),o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(t.isRegistered&&t.isRegistered(o.element))&&(n=!0)}n&&t.remountIfPresent();for(let o of r)o.root.isConnected&&t.schedule(o,"mutation")}function sn(t){if(J)return J.suppress(t);let e=O("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function ae(t,e){Ut=!0,J=t,t.subscribe(r=>pr(e,r))}function ue(t){if(Ut||typeof window>"u"||typeof document>"u")return;let e=O("Mutation");if(e&&typeof e.onAnyChange=="function"){ae(on(e),t);return}typeof MutationObserver=="function"&&(ae(lr(),t),ht=kt(document,ie,function(){let n=O("Mutation");n&&(ht(),ht=null,J&&J.teardown(),Ut=!1,ae(on(n),t))}))}function ce(){if(J)try{J.teardown()}catch{}ht&&typeof document<"u"&&ht(),J=null,Ut=!1,ht=null}var mr=new Set(ut),Gt=Object.freeze([]),Q=[],un={},cn={};function fn(t){Q.includes(t)||(Q.push(t),t.boundary&&Object.assign(un,t.boundary),t.paintKinds&&Object.assign(cn,t.paintKinds))}function bt(t,e={}){if(e.breaker){t.diag.error("E26",t.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(t._breakerRing||[]).join(", ")}),V(t.root,"loop");return}e.full&&(Fe(),We());let r=Me(t.root);try{sn(()=>hr(t,e))}finally{Oe(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function hr(t,e){let r=t.root,n={},o=[],i=[],s=new Set;t.diag.errors=[];let b={root:n,state:n,item:null,ownerEl:r,projection:!1},m=null;function d(f,S,k=!1){let $=S.attr||S.name,_=k?Ue(f,$):f.getAttribute($);return _==null&&(_=At(S),i.push({el:f,name:S.name,attr:$,value:ee(Z(_,S.type),S.type)})),Z(_,S.type)}function u(f,S,k,$){let _=S.decls;if(!_)return;let L=!!$.item&&!$.projection&&!$.view;for(let D of _){if(D.transient){m&&(m.pure=!1),k[D.name]=Mt(f,D);continue}if(Y(f,D)){k[D.name]=f.hasAttribute(D.attr);continue}k[D.name]=d(f,D,L)}}function E(f,S,k){let $=S.bind,_=k.item||k.state,L=_t(f);m&&(L!=="leaf"||S.transient)&&(m.pure=!1),L==="radio"?($ in _||(_[$]=""),f.checked&&(_[$]=f.value)):L==="leaf"&&k.item&&!k.projection&&!k.view?_[$]=Ge(f):_[$]=Ht(f,L),S.transient&&(f.removeAttribute("value"),f.removeAttribute("checked"))}function A(f,S,k){let $=!1;if(S.paints){$=!0;for(let _ of S.paints)_.kind==="when"&&s.add(_.field),o.push({def:_,el:f,ctx:k})}for(let _ of Q)_.collect&&_.collect(a,f,S,k)!==!1&&($=!0);m&&$&&(S.calcs&&(m.pure=!1),m.collects.push(f,S))}function N(f,S,k){Object.defineProperty(f,"$key",{value:Lt(S,"row"),enumerable:!1}),Object.defineProperty(f,"$index",{value:k,enumerable:!1,configurable:!0}),Object.defineProperty(f,"$el",{value:S,enumerable:!1})}function R(f,S,k){let $=X(f);u(f,$,S,k),f._sapScope=S,!k.projection&&$.bind!=null&&E(f,$,k),A(f,$,k),$.items?w(f,S,k):p(f,S,k)}function p(f,S,k){for(let $=f.firstElementChild;$;$=$.nextElementSibling)y($,S,k)}function y(f,S,k){let $=X(f);if(!$.inert){if($.boundary){m&&(m.pure=!1),$.boundary==="scope"?h(f,S,k):$.boundary==="items"?(A(f,$,k),w(f,S,k)):un[$.boundary](a,f,$,S,k);return}!k.projection&&!k.view&&$.bind!=null&&E(f,$,k),A(f,$,k);for(let _=f.firstElementChild;_;_=_.nextElementSibling)y(_,S,k)}}function h(f,S,k){let $=f.getAttribute("scope"),_={};S[$]=_;let L={root:k.root,state:_,item:null,ownerEl:f,projection:k.projection};R(f,_,L)}function w(f,S,k){m&&(m.pure=!1);let $=f.getAttribute("items"),_=[];S[$]=_,f._sapList=_;let L=!k.projection&&!k.view&&Be(),D=0;for(let M=f.firstElementChild;M;M=M.nextElementSibling){let C=X(M);if(!C.item||C.template||C.cms)continue;let I=L?je(M):void 0;_.push(I&&I.plan===C&&Object.isExtensible(I.obj)&&c(I,M,D,k)||x(M,C,D,k,L)),D++}}function x(f,S,k,$,_){let L={};N(L,f,k);let D={root:$.root,state:$.state,item:L,ownerEl:f,projection:$.projection};if(!_)return R(f,L,D),L;let M=m,C={plan:S,obj:L,fields:null,presence:Gt,pending:Gt,collects:[],pure:!0},I=i.length,Wn=t.diag.errors.length;m=C;try{R(f,L,D)}finally{m=M}if(!C.pure||t.halted||t.diag.errors.length!==Wn)return L;let he=[];for(let st of Object.keys(L)){let Jt=L[st];if(Jt!==null&&typeof Jt=="object")return L;he.push(st,Jt)}if(S.decls)for(let st of S.decls)Y(f,st)&&(C.presence===Gt?C.presence=[]:C.presence).push(st.name,st.attr);return i.length>I&&(C.pending=i.slice(I)),C.collects.length||(C.collects=Gt),C.fields=he,qe(f,C),L}function c(f,S,k,$){let _=f.obj;try{_.$index!==k&&Object.defineProperty(_,"$index",{value:k,enumerable:!1,configurable:!0});let M=f.presence;for(let I=0;I<M.length;I+=2)_[M[I]]=S.hasAttribute(M[I+1]);let C=f.fields;for(let I=0;I<C.length;I+=2)_[C[I]]=C[I+1]}catch{return jt(S),null}S._sapScope=_;let L=f.pending;for(let M=0;M<L.length;M++)i.push(L[M]);let D=f.collects;if(D.length){let M={root:$.root,state:$.state,item:_,ownerEl:S,projection:$.projection};for(let C=0;C<D.length;C+=2)A(D[C],D[C+1],M)}return _}let a={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:d,collectEl:A,walkScope:p};for(let f of Q)f.begin&&f.begin(a);let l=e.cacheReads===!1?null:ze(r);try{R(r,n,b)}finally{e.cacheReads!==!1&&He(l)}if(t.halted)return;for(let f of Q)f.afterIntake&&f.afterIntake(a);if(i.length&&s.size)for(let f of i)s.has(f.attr)&&f.el.getAttribute(f.attr)==null&&f.el.setAttribute(f.attr,f.value);for(let f of Q)f.compute&&f.compute(a);let g=0;for(let f of Q)f.reconcile&&(g+=f.reconcile(a));let v=0,T=g;for(let f of o){let S=gr(f,t);f.ctx.view?T+=S:v+=S}for(let f of Q)f.afterPaint&&f.afterPaint(a);t._state=n,t._stats={fields:Object.keys(n).filter(f=>typeof n[f]!="function").length,calcs:a.stats.calcs,paints:o.length,lists:a.stats.lists,writes:v,viewWrites:T},t._viewsChanged=T>0,t._lastPass={trigger:e.trigger||"refresh",writes:v},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${v}/${o.length}`)}function br(t){return t.kind==="text"?t.fmt?"text:"+t.fmt:"text":t.kind==="attr"?"attr:"+t.arg:t.kind==="class"?"class:"+t.arg:t.kind==="css"?"css:"+t.arg:t.kind==="when"?(t.match==="hide"?"hide-when:":t.match==="show-not"?"option-not:":"show-when:")+t.field:t.kind}function fe(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let i=r.includes(o.getAttribute(e));if(n?!i:i)return!0}o=o.parentElement}return!1}function gr(t,e){let r=t.def,n=t.el,o=cn[r.kind];if(o)return o(t,e);if(r.kind==="when")return an(r,n,null);try{let i=z(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),s=an(r,n,i);return ct(n),s}catch(i){return e.diag.error(i.sapCode==="E22"?"E22":"E24",n,{attr:br(r),expr:r.entry&&r.entry.src,problem:String(i.message)}),V(n,i.sapCode||"E24"),0}}function an(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?Te(t.fmt,r):r==null?"":String(r);return e.textContent!==n?(e.textContent=n,1):0}case"show":{let n=!r;return e.hidden!==n?(e.hidden=n,1):0}case"when":{let n=O("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!fe(e,t.field,t.values,!1):t.match==="show-not"?o=fe(e,t.field,t.values,!0):o=fe(e,t.field,t.values,!1),e._sapWhen=!0;let i=!o;return e.hidden!==i?(e.hidden=i,1):0}case"attr":{let n=t.arg;if((n==="checked"||n==="selected")&&typeof e[n]=="boolean"&&!e.hasAttribute("bind")&&!e.closest("select[bind]")){let i=0;return e[n]!==!!r&&(e[n]=!!r,i=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),i=1),i}if(mr.has(n)){let i=e.hasAttribute(n);return r&&!i?(e.setAttribute(n,""),1):!r&&i?(e.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return e.getAttribute(n)!==o?(e.setAttribute(n,o),1):0}case"class":{let n=!!r;return e.classList.contains(t.arg)!==n?(e.classList.toggle(t.arg,n),1):0}case"css":{let n=r==null?"":String(r);return e.style.getPropertyValue("--"+t.arg)!==n?(e.style.setProperty("--"+t.arg,n),1):0}default:return 0}}var wr=new Set(ut),ln=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),yr=new Set(["show-when","hide-when","option","option-not"]),Ar=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,dn=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"]),de=[];function pn(t){de.includes(t)||de.push(t)}function vr(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function le(t){return t.hasAttribute("bind")}function Er(t,e){e(t);for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(!n.hasAttribute("sap-ignore")){if(n.tagName==="TEMPLATE"){if(n.hasAttribute("items"))for(let o=n.content.firstElementChild;o;o=o.nextElementSibling)r(o);return}e(n);for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function Yt(t,e){let r=!1,n=(s,b,m)=>{e.error(s,b,m),r=!0},o=t.ownerDocument.createTreeWalker(t,4),i;for(;i=o.nextNode();)if(/\{\{.*\}\}/.test(i.nodeValue||"")){n("E02",i.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Er(t,s=>{let b=new Set;for(let d of de)d(s,n,u=>b.add(u));let m=s.closest&&s.closest("[detail]");for(let d of[...s.attributes]){let u=d.name;if(b.has(u))continue;if(u.includes(":")){let A=u.slice(0,u.indexOf(":"));if(ln.has(A)){if(yr.has(A)&&Ar.test(d.value)){let N=u.slice(u.indexOf(":")+1);e.warn("W04",s,{attr:u,expr:d.value,problem:`${A}: compares the "${N}" attribute against a literal value, not a JS expression`,fix:`use show="${d.value}" for an expression, or a literal like ${A}:${N}="overview"`})}}else{let N=wt(A,[...ln]);e.warn("W03",s,{attr:u,problem:`unknown "${A}:" attribute`,didYouMean:N?`${N}:`:null})}}else if(!dn.has(u)&&!gt.has(u)&&!wr.has(u)&&!/^(data-|aria-|on)/.test(u)&&!(u in s)){let A=wt(u,[...dn]);A&&e.warn("W03",s,{attr:u,problem:`unknown "${u}" attribute`,didYouMean:A})}u==="attr:hidden"&&e.warn("W03",s,{attr:u,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let E=le(s)||u==="attr:selected"&&s.tagName==="OPTION"&&!!s.closest("select[bind]");(u==="attr:value"||u==="attr:checked"||u==="attr:selected")&&E&&n("E30",s,{attr:u,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),u==="effect"&&le(s)&&/\b(value|checked)\s*=[^=]/.test(d.value)&&n("E30",s,{attr:u,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"}),(u==="text"||u.startsWith("text:")||u==="show")&&vr(s)&&(u==="show"||n("E18",s,{attr:u,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(s.hasAttribute("state")){let d=W(s.getAttribute("state")),u=new Set;for(let E of d){E.name.includes("-")&&n("E08",s,{attr:"state",problem:`field "${E.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${E.name.replace(/-/g,"")}`}),u.has(E.name)&&n("E04",s,{attr:"state",problem:`field "${E.name}" is declared twice in one scope`}),u.add(E.name),Nt.has(E.attr)&&n("E05",s,{attr:"state",problem:`"${E.name}" is a reserved Sap word`}),gt.has(E.attr)&&n("E06",s,{attr:"state",problem:`"${E.name}" is a global HTML attribute name; pick another field name`}),E.name==="open"&&s.tagName==="DIALOG"&&n("E33",s,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let A=ne(s,E.attr);A&&(E.attr==="checked"||E.attr==="selected")&&n("E35",s,{attr:"state",problem:`"${E.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">'}),A&&E.type==="num"&&n("E35",s,{attr:"state",problem:`"${E.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${E.attr}"`}),E.transient&&(A||E.type==="presence")&&n("E35",s,{attr:"state",problem:`"${E.name}" is carried by attribute presence, which transient would strip`,fix:"declare a separate name:bool:transient field and paint the attribute from it"})}}if(le(s)){if(s.hasAttribute("-"),s.tagName==="INPUT"){let d=(s.getAttribute("type")||"text").toLowerCase();d==="file"&&n("E32",s,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),d==="password"&&!s.hasAttribute("transient")&&n("E31",s,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(s.tagName!=="SELECT"&&s.tagName!=="TEXTAREA"){let d=s.getAttribute("contenteditable");!(d!=null&&d!=="false")&&s.children.length>0&&n("E20",s,{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"})}}if(s.hasAttribute("transient")&&s.hasAttribute("persist")&&n("E34",s,{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"}),s.tagName==="DIALOG"&&s.hasAttribute("detail")&&!(s.parentElement&&s.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",s,{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'}),s.hasAttribute("item")&&!s.hasAttribute("template")&&s.parentNode&&s.parentNode.nodeType===1){let d=s.parentElement;(!d||!d.hasAttribute("items"))&&n("E10",s,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(s.hasAttribute("items")&&m&&n("E17",s,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),s.hasAttribute("items")){let d=t.querySelector(`[trigger-add="${s.getAttribute("items")}"]`);!Ft(s)&&!te(t,s.getAttribute("items"))&&G(s).length===0&&d&&n("E17",s,{attr:"items",problem:`trigger-add targets items="${s.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(e.halted=!0,e.haltReason=e.errors[0]?e.errors[0].code:"halt",V(t,e.haltReason)),!r}var mn="sap-styles",hn="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",pe=new WeakSet;function xr(t){if(pe.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(hn),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],pe.add(t);return}catch{}if(!t.getElementById(mn)){let n=t.createElement("style");n.id=mn,n.textContent=hn,(t.head||t.documentElement).appendChild(n)}pe.add(t)}var Sr=0;function bn(){return typeof performance<"u"&&performance.now?performance.now():0}function me(t){let e=t.id||t.getAttribute("sap")||`app-${Sr++}`,r=new at(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Yt(t,r))return n.halted=!0,n;xr(t.ownerDocument);for(let s of t.querySelectorAll("textarea[data-value]"))qt(s);let i=bn();return bt(n,{trigger:"mount",full:!0}),n._mountMs=bn()-i,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ke()&&!O("derived")&&r.warn("W30",t,{problem:`${n._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)"}),n}var gn=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Xt(t){return`${t.tagName.toLowerCase()}[sap]`}function kr(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(gn.test(n.name)){e++;break}for(let r of t.attributes)if(gn.test(r.name)){e++;break}return e}function wn(t){function e(b){let m=b._stats||{},d=b.root;return{root:Xt(d),fields:m.fields||0,calcs:m.calcs||0,paints:m.paints||0,actions:kr(d),lists:(d.hasAttribute("items")?1:0)+d.querySelectorAll("[items]").length,rows:d.querySelectorAll("[item]:not([template])").length,warnings:b.diag.warnings.length,errors:b.diag.errors.length,mountWrites:b._mountWrites||0,ms:Math.round((b._mountMs||0)*10)/10,passes:b._passes||0,lastPass:b._lastPass||null,ok:b.diag.errors.length===0&&!b.halted}}function r(){let b=t.apps().map(e);return{ok:b.every(m=>m.ok),apps:b}}function n(b){let m=e(b);return m.ok?`sap \u2713 ${m.root} \xB7 fields ${m.fields} \xB7 calcs ${m.calcs} \xB7 paints ${m.paints} \xB7 actions ${m.actions} \xB7 lists ${m.lists} \xB7 rows ${m.rows} \xB7 warnings ${m.warnings} \xB7 mount writes ${m.mountWrites} \xB7 ${m.ms}ms`:`sap \u2717 ${m.root} \xB7 errors ${m.errors} \xB7 warnings ${m.warnings} \xB7 ${m.ms}ms`}function o(){for(let b of t.apps()){let m=n(b);b.diag.errors.length||b.halted?console.error(m):console.log(m)}}function i(){let b=[],m=[];for(let d of t.apps())b.push(...d.diag.errors),m.push(...d.diag.warnings);return{ok:b.length===0,errors:b,warnings:m,counts:{errors:b.length,warnings:m.length}}}function s(b){let m=b===void 0?!0:!!b;for(let d of t.apps())d._debug=m;return console.log(`sap debug ${m?"on":"off"} \u2014 per-pass headers will ${m?"":"no longer "}log`),m}return{status:r,report:i,debug:s,greenLine:n,printGreenLines:o,REGISTRY:Zt}}var yn="0.8.0";function An({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],i=be(bt);function s(l){let g=l;for(;g;){if(g.nodeType===1&&g.hasAttribute&&g.hasAttribute("sap"))return n.get(g)||null;g=g.parentNode&&g.parentNode.host?g.parentNode.host:g.parentElement}return null}function b(){for(let l=o.length-1;l>=0;l--){let g=o[l];g.root.isConnected||(n.delete(g.root),o.splice(l,1))}}function m(l,g){if(l.moveBefore)try{l.moveBefore(g,null);return}catch{}l.appendChild(g)}function d(l,g){let v=g.parentElement;if(v){if(v.moveBefore)try{v.moveBefore(l,g);return}catch{}v.insertBefore(l,g)}}let u={apps:()=>o.slice(),appFor:s,isRegistered:l=>n.has(l),pruneDisconnected:b,schedule:(l,g)=>i.schedule(l,g),runNow:(l,g)=>i.runNow(l,g),moveInto:m,placeBefore:d,remountIfPresent:()=>x()},E=t(u),A=wn(u),N=r?r(u,A):{},R=!1,p=!1,y=null;function h(){R||(R=!0,e(u,E,document),y=tn(u))}function w(){let l=O("derived");l&&typeof l.mounted=="function"&&l.mounted()}function x(l=document){if(p)return[];h(),ue(u);let g=l.querySelectorAll("[sap]"),v=[];for(let T of g){if(n.has(T))continue;let f=me(T);n.set(T,f),o.push(f),v.push(f)}for(let T of v){let f=A.greenLine(T);T.diag.errors.length||T.halted?console.error(f):console.log(f)}return w(),v}function c(l){if(p)return null;if(h(),ue(u),!l)return x();let g=typeof l=="string"?document.querySelector(l):l;if(!g)return null;if(n.has(g))return n.get(g);let v=me(g);n.set(g,v),o.push(v);let T=A.greenLine(v);return v.diag.errors.length||v.halted?console.error(T):console.log(T),v}let a=E.Sap;return a.version=yn,a.refresh=function(){for(let g of o)g.root.isConnected&&i.runNow(g,"refresh")},a.batch=Ze,a.status=A.status,a.report=A.report,a.why=N.why,a.debug=A.debug,a.doctor=N.doctor,a.greenLine=A.greenLine,a.formats=dt,a.serializeControlToAttributes=mt,a.finalizeControlForSave=Xe,a.rehydrateControlFromAttributes=qt,a.mount=c,a.config=function(g={}){return g.formats&&Object.assign(dt,g.formats),a},a._registry=n,a._reset=function(){n.clear(),o.length=0,ce()},a.unmount=function(){p=!0,n.clear(),o.length=0,ce(),typeof y=="function"&&y()},{Sap:a,mountAll:x,mount:c,runtime:u}}function vn(t){if(typeof document>"u")return;let e=()=>Je(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}var $r=["for","form","list","headers","popovertarget","commandfor","anchor","aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function _r(t,e){let r=null;return H(t,n=>{!r&&n.getAttribute("scope")===e&&(r=n)}),r}function En(t,e,r){let n=j(t)||e;for(;n;){for(let o of W(n.getAttribute("state")||""))if(o.name===r)return{el:n,decl:o};if(n.hasAttribute("sap"))break;n=j(n.parentElement)}return null}function Tr(t){return typeof t=="number"?"num":typeof t=="boolean"?"bool":"string"}function xn(t){function e(p){let y=t.appFor(p);if(!y)return null;let h=tt(p),w=h&&h._sapEachItem&&h._sapEachItem.$el;if(w&&w.isConnected)return{ctxEl:w,appRec:y,isRow:!0};let x=yt(p);if(x)return x._sapDetailRow?{ctxEl:x._sapDetailRow,appRec:y,isRow:!0}:{ctxEl:j(x.parentElement)||y.root,appRec:y,isRow:!1};let c=Ct(p);if(c&&c.hasAttribute("item"))return{ctxEl:c,appRec:y,isRow:!0};let a=j(p)||y.root;return{ctxEl:a,appRec:y,isRow:a.hasAttribute("item")}}function r(p){let y=typeof p=="string"?document.querySelector(p):p;if(!y||y.nodeType!==1)return null;let h=e(y);return h?R(h.ctxEl,h.appRec,h.isRow):null}function n(p,y){let h=tt(p);if(!h)return r(p);let w=t.appFor(p),x=h._sapEachItem&&h._sapEachItem.$el;if(x&&x.nodeType===1&&x.hasAttribute("item")&<(x,y))return x.isConnected?R(x,w,!0):null;let c=h.parentElement&&h.parentElement._sapDrawnEl;return!c||!c.isConnected?null:R(c,w,c.hasAttribute("item"))}function o(p,y,h){let w=et(p,h);if(w)return B(w).read();let x=ft(p,h);if(x)return G(x).map(g=>R(g,y,!0));let c=_r(p,h);if(c)return R(c,y,!1);let a=En(p,y.root,h);if(a)return a.decl.transient?Mt(a.el,a.decl):Ae(a.el,a.decl);let l=p._sapScope;return l?l[h]:void 0}function i(p,y,h,w,x){w.transient?Et(p,w,h):vt(p,w,h),t.schedule(x,"set:"+y)}function s(p,y){let h=new Set,w=j(p)||y;for(;w;){for(let x of W(w.getAttribute("state")||""))h.add(x.name);if(w.hasAttribute("sap"))break;w=j(w.parentElement)}return H(p,x=>{let c=x.getAttribute("bind");c&&h.add(c)}),h}function b(p,y,h,w){let x=et(p,h);if(x){if(!F(x))return;B(x).write(w);return}let c=p;for(;c;){for(let k of c.attributes)if(k.name==="calc:"+h){y.diag.error("E16",c,{attr:"calc:"+h,problem:`"${h}" is a computed field; computed fields are read-only`});return}if(c.hasAttribute("sap"))break;c=c.parentElement}let a=En(p,y.root,h);if(a){if(!F(a.el,{transient:a.decl.transient}))return;i(a.el,h,w,a.decl,y);return}let l=s(p,y.root);l.delete(h);let g=h.length>=4?wt(h,[...l]):null;if(g){y.diag.error("E12",p,{key:h,problem:`unknown state key "${h}"`,didYouMean:g});return}if(Nt.has(h)||gt.has(h)){y.diag.error("E15",p,{key:h,problem:`cannot write undeclared field "${h}" \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"});return}let v=y.root;if(!F(v))return;let T=Tr(w),f=v.getAttribute("state")||"",S=T==="string"?h:`${h}:${T}`;v.setAttribute("state",f?`${f} ${S}`:S),i(v,h,w,{name:h,attr:h,type:T,transient:!1},y)}function m(p){let y=p.ownerDocument,h=new Map,w=(x,c)=>{let a=we(y),l=x.getAttribute(c);l&&c==="id"&&h.set(l,a),x.setAttribute(c,a)};p.querySelectorAll("[id]").forEach(x=>w(x,"id")),p.querySelectorAll("[data-id]").forEach(x=>w(x,"data-id")),p.querySelectorAll("[sap-error]").forEach(x=>x.removeAttribute("sap-error")),p.removeAttribute("sap-error"),p.hasAttribute("data-id")?(p.removeAttribute("id"),w(p,"data-id")):w(p,"id");for(let x of[p,...p.querySelectorAll("*")])for(let c of $r){let a=x.getAttribute(c);if(a==null)continue;let l=a.split(/\s+/).map(g=>h.get(g)||g).join(" ");l!==a&&x.setAttribute(c,l)}}function d(p,y,h){let w=xt(y.root,p,h);if(!w)return y.diag.error("E17",p,{problem:`cannot resolve a list named "${h}" from here`}),null;if(!F(w))return null;let x=Ft(w);if(!x)return y.diag.error("E17",w,{problem:`items="${h}" has no [item template] to clone`}),null;let c=w.ownerDocument.importNode(x,!0);return c.removeAttribute("template"),m(c),w.appendChild(c),t.schedule(y,"trigger-add:"+h),R(c,y,!0)}function u(p,y){let h=W(p.getAttribute("state")||""),w=!0;H(p,x=>{x.hasAttribute("bind")&&!F(x)&&(w=!1)});for(let x of h)F(p,{transient:x.transient})||(w=!1);if(w){H(p,x=>{if(x.hasAttribute("bind")){let c=B(x),a=x.getAttribute("default");c.kind==="checkbox"||c.kind==="radio"?c.write(a!=null?a===""||a==="true"||x.value===a:x.hasAttribute("checked")):c.write(a??(x.getAttribute("value")||""))}});for(let x of h){let c=ve(p,x);x.transient?Et(p,x,c):vt(p,x,c)}t.schedule(y,"trigger-reset")}}function E(p,y){if(!p.isConnected)throw new Error("stale row handle: $remove() on a removed row");F(p)&&(p.remove(),t.schedule(y,"trigger-remove"))}function A(p,y,h){if(!p.isConnected)throw new Error("stale row handle: $move() on a removed row");let w=null;if(h&&h.nodeType===1?w=h:typeof h=="string"&&(w=xt(y.root,p,h)),!w){y.diag.error("E17",p,{problem:`$move() cannot resolve target "${h}"`});return}!F(p)||!F(w)||(t.moveInto(w,p),t.schedule(y,"trigger-move"))}function N(p){let y=p.parentElement;return y?G(y).indexOf(p):-1}function R(p,y,h){let w={get $el(){return p},get $key(){return Lt(p,h?"row":"scope")},get $index(){return N(p)},$add(c){return d(p,y,c)},$reset(){return u(p,y),x},$remove(){E(p,y)},$move(c){A(p,y,c)},get $appRec(){return y}},x=new Proxy(w,{get(c,a){return typeof a=="symbol"||a[0]==="$"?c[a]:o(p,y,a)},set(c,a,l){return typeof a=="string"&&a[0]==="$"?(c[a]=l,!0):(b(p,y,a,l),!0)},has(c,a){return typeof a=="string"&&a[0]==="$"?a in c:o(p,y,a)!==void 0}});return x}return{Sap:r,contextElFor:e,readField:o,writeField:b,makeProxy:R,writeTargetFor:n}}var Nr=["trigger-add","trigger-remove","trigger-reset"];function Rr(t){if(t.nodeType!==1)return!1;for(let e of t.attributes){let r=e.name;if(r.startsWith("set:")||r.startsWith("move:")||r.startsWith("sort:")||Nr.includes(r))return!0}return!1}function Lr(t,e){let r=t,n=e.parentElement;for(;r&&r!==n;){if(r.nodeType===1&&Rr(r)&&!(r.tagName==="FORM"&&r.hasAttribute("trigger-add")))return r;r=r.parentElement}return null}function Sn(t,e){let{Sap:r}=e;function n(c,a){let l=null,g=tt(c),v=yt(c);if(g)l=g._sapEachItem??null;else if(v&&v._sapDetailRow)l=v._sapDetailRow._sapScope||null;else{let S=Ct(c);S&&S.hasAttribute("item")&&(l=S._sapScope||null)}return{state:(j(c)||a.root)._sapScope||a._state||{},item:l,el:c,root:a._state||{}}}function o(c,a,l){if(!c.hasAttribute("confirm")){l();return}let g=c.getAttribute("confirm"),v=g,T=P(g);if(!T.error)try{let _=nt(T,n(c,a));(typeof _=="string"||typeof _=="number")&&(v=String(_))}catch{}let f=$t(),S=()=>{$t()===f&&l()},k=Qe();if(!k){window.confirm(v)&&S();return}if(c._sapGatePending)return;c._sapGatePending=!0;let $=()=>{c._sapGatePending=!1};k(v,()=>{$(),S()}).catch($)}function i(c,a){for(let l of c.attributes){if(!l.name.startsWith("set:"))continue;let g=l.name.slice(4),v=P(l.value);if(v.error){a.diag.error("E08",c,{attr:l.name,expr:l.value,problem:String(v.error.message)});continue}let T;try{T=nt(v,n(c,a))}catch(S){a.diag.error("E24",c,{attr:l.name,expr:l.value,problem:String(S.message)});continue}let f=e.writeTargetFor(c,g);f&&(f[g]=T)}}function s(c){let a=tt(c);if(!a)return c.closest("[item]");let l=a._sapEachItem&&a._sapEachItem.$el;return l&&l.nodeType===1&&l.hasAttribute("item")?l:null}function b(c,a){let l=s(c);if(!l||!F(l)||!F(l.parentElement))return;let g=G(l.parentElement),v=g.indexOf(l);a==="up"&&v>0?t.placeBefore(l,g[v-1]):a==="down"&&v<g.length-1&&t.placeBefore(g[v+1],l)}function m(c,a,l){if(a)return xt(l.root,c,a);let g=c;for(;g;){if(g.hasAttribute&&g.hasAttribute("items"))return g;g=g.parentElement}let v=j(c)||l.root,T=[];return H(v,f=>{f.hasAttribute("items")&&T.push(f)}),T[0]||null}function d(c,a){let l=c==null||c==="",g=a==null||a==="";if(l&&g)return 0;if(l)return 1;if(g)return-1;let v=Number(c),T=Number(a);return!Number.isNaN(v)&&!Number.isNaN(T)?v-T:String(c)<String(a)?-1:String(c)>String(a)?1:0}function u(c,a,l,g){let v=m(c,l,g);if(!v){g.diag.error("E17",c,{attr:"sort:"+a,problem:`no items list resolvable for sort:${a}`});return}if(!F(v))return;let T=G(v),f=_=>_._sapScope?_._sapScope[a]:void 0,S=[...T].sort((_,L)=>d(f(_),f(L))),$=S.every((_,L)=>_===T[L])?[...S].reverse():S;for(let _ of $)t.moveInto(v,_);t.schedule(g,"sort:"+a)}function E(c){if(!c||c.hidden)return;let a=c.querySelector("[bind]:not([type=hidden]), [contenteditable]");a&&typeof a.focus=="function"&&a.focus()}function A(c,a){o(c,a,()=>{let l=r(c);for(let g of[...c.attributes]){let v=g.name;if(v==="trigger-remove")l&&l.$remove();else if(v==="trigger-reset")l&&l.$reset();else if(v==="trigger-add"){let T=l&&l.$add(g.value);T&&E(T.$el)}else v==="move:up"?(b(c,"up"),t.schedule(a,"move:up")):v==="move:down"?(b(c,"down"),t.schedule(a,"move:down")):v.startsWith("move:to")?l&&l.$move(g.value):v.startsWith("sort:")&&u(c,v.slice(5),g.value,a)}[...c.attributes].some(g=>g.name.startsWith("set:"))&&i(c,a)})}function N(c){let a=c.target;if(!a||a.nodeType!==1)return;let l=t.appFor(a);if(!l)return;let g=Lr(a,l.root);g&&A(g,l)}function R(c){let a=B(c),l=c.getAttribute("default");a.kind==="checkbox"?a.write(l===""||l==="true"):a.write(l??"")}function p(c,a,l){let g=r(c);if(!g)return;let v=g.$add(l);if(!v)return;let T=[];H(c,f=>{f.hasAttribute("bind")&&T.push(f)});for(let f of T){if(f.type==="radio"&&!f.checked)continue;let S=f.getAttribute("bind"),k=et(v.$el,S);k?B(k).write(B(f).read()):lt(v.$el,S)&&(v[S]=B(f).read())}T.forEach(R),T.length?typeof T[0].focus=="function"&&T[0].focus():E(v.$el)}function y(c){let a=c.target;if(!a||!a.hasAttribute||!a.hasAttribute("trigger-add"))return;let l=t.appFor(a);l&&(c.preventDefault(),o(a,l,()=>p(a,l,a.getAttribute("trigger-add"))))}function h(c){let a=c.target;if(!a||a.tagName!=="DIALOG"||!a.hasAttribute("detail"))return;if(a._sapEngineClose){a._sapEngineClose=!1;return}if(a.open)return;let l=/^[\w.]+\s+by\s+state\.(\w+)\s*$/.exec(a.getAttribute("detail")||""),g=t.appFor(a);if(!l||!g)return;let v=W(a.getAttribute("state")||"").find(f=>f.name===l[1]);if(v){if(!F(a,{transient:v.transient}))return;v.transient?Et(a,v,""):vt(a,v,""),t.schedule(g,"close");return}let T=r(a.parentElement);T&&T[l[1]]!==""&&(T[l[1]]="")}function w(c,a){let l=c.hasAttribute("bind")&&Dt(c);if(!l&&c.hasAttribute("bind")&&tt(c)){let v=c.getAttribute("bind"),T=c._sapViewBind?e.writeTargetFor(c,v):null;return T&&(T[v]=B(c).read()),!0}let g=yt(c);if(g&&g._sapDetailRow&&c.hasAttribute("bind")&&!l){let v=g._sapDetailRow,T=c.getAttribute("bind"),f=et(v,T);if(f&&f!==c)return F(f)&&B(f).write(B(c).read()),!0;if(!f&&W(v.getAttribute("state")||"").some(S=>S.name===T))return e.writeField(v,a,T,B(c).read()),!0}return!1}function x(c=document){c.addEventListener("click",N),c.addEventListener("submit",y),c.addEventListener("close",h,!0)}return{install:x,routeInput:w}}function kn(t){let e=[];function r(m){let d=m.target;if(!d||d.nodeType!==1)return;let u=t.appFor(d);if(u){d.hasAttribute("persist")&&!zt(d)&&F(d)&&mt(d);for(let E of e)if(E(d,u))return;t.schedule(u,m.type+" "+(d.id||d.tagName.toLowerCase()))}}function n(m){let d=m.target,u=t.appFor(d);u&&[...d.querySelectorAll("[bind]")].every(E=>F(E))&&setTimeout(()=>{d.querySelectorAll("[bind]").forEach(E=>{E.dispatchEvent(new Event("input",{bubbles:!0})),E.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(u,"reset")},0)}function o(m){let d=t.appFor(m.target);d&&t.schedule(d,"toggle")}function i(m){let d=m.detail||{};for(let u of[d.from,d.to,m.target]){if(!u||u.nodeType!==1)continue;let E=t.appFor(u);E&&t.schedule(E,"sorted")}}function s(m){if(m.key!=="ArrowUp"&&m.key!=="ArrowDown")return;let d=m.target;if(!d||d.nodeType!==1||d.tagName!=="INPUT"||!d.hasAttribute("bind")||!d.hasAttribute("step"))return;let u=(d.getAttribute("type")||"text").toLowerCase();if(u!=="text"&&u!=="tel"&&u!=="search"||!t.appFor(d)||!F(d))return;m.preventDefault();let A=q(d.getAttribute("step"))||1,N=m.key==="ArrowUp"?1:-1,R=q(d.value)+A*(m.shiftKey?10:1)*N,p=d.getAttribute("min"),y=d.getAttribute("max");p!==null&&p!==""&&R<q(p)&&(R=q(p)),y!==null&&y!==""&&R>q(y)&&(R=q(y)),B(d).write(String(Number(R.toFixed(2))))}function b(m=document){m.addEventListener("reset",n),m.addEventListener("toggle",o,!0),m.addEventListener("input",r),m.addEventListener("change",r),m.addEventListener("clay:sorted",i),m.addEventListener("keydown",s)}return{install:b,addRouter:m=>e.push(m)}}function $n(t){let e=t.toLowerCase();return/^x-text$|^x-html$/.test(e)?'use text="state.x" (Sap paints text only)':/^x-show$|^v-show$|^v-if$/.test(e)?'use show="expr" (toggles native hidden)':/^x-model$|^v-model$/.test(e)?'use bind="field"':/^@|^x-on:|^v-on:|^on:/.test(e)?"use native onclick + Sap(this) (no event directive)":/^:|^x-bind:class$|^v-bind:class$/.test(e)?'use class:NAME="expr" or attr:NAME="expr"':/^x-for$|^v-for$/.test(e)?'use items="name" on the container and item template on the row':/^x-data$/.test(e)?"declare state with state= / bind / items (no JS state object)":/^x-init$/.test(e)?"use a <script> or onclick + Sap(this)":/^bind:/.test(e)?'use bind="field"; one-way paint is attr:NAME="expr"':/^x-/.test(e)||/^v-/.test(e)?"this is a foreign-dialect attribute; Sap has no x-/v- attributes":null}function _n(t){let e=[],r=n=>{for(let o of n.attributes){let i=o.name;(i.startsWith("calc:")||i==="text"||i.startsWith("text:")||i==="show"||i.startsWith("attr:")||i.startsWith("class:")||i.startsWith("css:")||i==="effect"||i==="invalid"||i.startsWith("set:")||i==="detail")&&e.push({el:n,attr:i,src:o.value})}};r(t);for(let n of t.querySelectorAll("*"))r(n);return e}function Tn(t){function e(o){return o?typeof o=="string"?document.querySelector(o):o.nodeType===1?o:null:null}function r(o,i){let s=e(o);if(!s)return console.warn("sap why: element not found"),null;let b=[`sap why <${s.tagName.toLowerCase()}> \u2014 ${Rt(s)}`],m=[...s.attributes].filter(u=>/^(bind|text|show|effect|invalid|detail|calc:|text:|attr:|class:|css:|set:|state|items|scope)/.test(u.name));for(let u of m)b.push(` ${u.name}="${u.value}"`);let d=s;for(;d&&!d._sapScope;)d=d.parentElement;if(d&&d._sapScope){let u=d._sapScope,E=i?[i]:Object.keys(u);b.push(" reads:");for(let A of E){let N=u[A];typeof N!="function"&&b.push(` ${A} = ${JSON.stringify(Array.isArray(N)?`[${N.length} rows]`:N)}`)}}return b.push(" serialization: textContent and value/checked attributes save with the file; reads live from properties"),console.log(b.join(`
|
|
10
|
-
`)),null}function n(){let o=[],i=0;for(let
|
|
10
|
+
`+e.value:e.value;t.textContent!==n&&(t.textContent=n),t.removeAttribute("data-value");return}if(r==="SELECT"){let n=t.options,o=e.options;for(let i=0;i<n.length;i++)o[i]&&o[i].selected?n[i].hasAttribute("selected")||n[i].setAttribute("selected",""):n[i].removeAttribute("selected")}}function le(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function W(t){if(typeof window>"u")return null;let e=window.clay,r=window.hyperclay;return t==="consent"?e?.confirm||r?.consent||null:e?.[t]||r?.[t]||null}function Pn(){let t=W("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var Pe=["clay:mutation-ready","hyperclay:mutation-ready"],Gr=["clay:sync-applied","hyperclay:livesync-applied"],Yr=["clay:ready","hyperclay:ready"],Kr=["clay:route"],Xr=["clay:modechange"];function Ht(t,e,r){let n=null,o=i=>{n!==null&&n!==i.type||(n=i.type,queueMicrotask(()=>{n=null}),r(i))};for(let i of e)t.addEventListener(i,o);return()=>{for(let i of e)t.removeEventListener(i,o)}}function Dn(t){let e=typeof window<"u"&&window.clay&&window.clay.ready;e&&typeof e.then=="function"?e.then(()=>t(),()=>t()):t()}function fe(t){let e=W("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function zt(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function I(t,{transient:e=!1}={}){if(e)return!0;let r=zt();return typeof r?.canWrite!="function"||W("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Fn(){let t=W("consent");return typeof t=="function"?t:null}function Mn(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=W("undo");r&&r.flush&&r.flush();let n=e();if(n&&typeof n.then=="function")throw new Error("Sap.batch fn must be synchronous (it returned a promise)");return r&&r.commitCaptured&&r.commitCaptured(t),n}function In(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let p=!1;for(let R of t.apps())R.root.isConnected?t.runNow(R,"platform"):p=!0;p&&t.pruneDisconnected(),t.remountIfPresent()},r=W("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:Ht(document,Gr,e),i=Ht(document,Kr,e),s=null,g=!1,k=()=>{let p=s;s=null,p&&(p[2](),p[3]())},h=()=>{if(g)return!1;let p=W("undo"),R=zt()?.state?.generation;if(s&&s[0]===p&&s[1]===R)return!0;if(k(),!p||typeof p.on!="function")return!1;let D=p.on("undo",e);if(typeof D!="function")return!1;let f=p.on("redo",e);return typeof f!="function"?(D(),!1):(s=[p,R,D,f],!0)};h();let l=[Pe,Yr,Xr].map(p=>Ht(document,p,h)),d=W("ready");return d&&typeof d.then=="function"&&d.then(h,()=>{}),()=>{g=!0,typeof n=="function"&&n(),o&&o(),i();for(let p of l)p();k()}}function Ut(t){let e=t.tagName;if(e==="INPUT"){let r=(t.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return e==="TEXTAREA"?"text":e==="SELECT"?t.multiple?"select-multiple":"select-one":"leaf"}function Jr(t){if(t.validity&&t.validity.badInput)return t.hasAttribute("value")?Number(t.getAttribute("value"))||0:t._sapLastGood??0;if(t.value==="")return 0;let e=Number(t.value);return Number.isNaN(e)?t._sapLastGood??0:(t._sapLastGood=e,e)}function Wn(t,e){switch(e){case"checkbox":return t.checked;case"radio":return t.checked?t.value:void 0;case"number":return Jr(t);case"select-one":return t.value;case"select-multiple":return[...t.selectedOptions].map(r=>r.value);case"hidden":case"text":return t.value;case"leaf":return t.textContent;default:return t.value}}function Bn(t,e,r){switch(e){case"checkbox":t.checked=!!r;break;case"radio":t.checked=String(t.value)===String(r);break;case"number":case"text":case"hidden":t.value=r==null?"":String(r);break;case"select-one":t.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of t.options)o.selected=n.has(o.value);break}case"leaf":t.textContent=r==null?"":String(r);break;default:t.value=r==null?"":String(r)}}function De(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}fe(t)||St(t)}function Qr(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function de(t,e){return Wn(t,e)}function jn(t,e,r){Bn(t,e,r),De(t)}function q(t){let e=Ut(t);return{el:t,kind:e,read(){return Wn(t,e)},write(r,n={}){Bn(t,e,r),n.noMirror||De(t),n.silent||Qr(t)},mirror(){De(t)}}}var Zr=[],Q=null,pe=0,Me=null,me=!1,$t=null;function Vn(t){let e=null;return{kind:"hub",flush(){t.pause(),t.resume()},subscribe(r){let n=t.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(e=n)},suppress(r){t.pause();try{return r()}finally{t.resume()}},teardown(){if(e){try{e()}catch{}e=null}}}}function to(){let t=null,e=null;function r(){let n=t?t.takeRecords():Zr;n.length&&e(qn(n))}return{kind:"native",flush:r,subscribe(n){e=n,t=new MutationObserver(i=>n(qn(i)));let o=document.body||document.documentElement;o&&t.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(n,o){let i=W("undo");o&&r(),i&&i.pause&&i.pause();try{return n()}finally{t&&t.takeRecords(),i&&i.resume&&i.resume()}},teardown(){t&&(t.disconnect(),t=null)}}}function qn(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!Gt(n)&&e.push({type:"attribute",element:n,attribute:r.attributeName})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!Gt(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){let n=r.target;n.nodeType===1&&[...r.addedNodes,...r.removedNodes].some(i=>i.nodeType===3)&&!Gt(n)&&e.push({type:"characterData",element:n});let o=r.addedNodes.length>0&&n.nodeType===1&>(n);for(let i of r.addedNodes)i.nodeType!==1||Gt(i)||(o?e.push({type:"add",element:i,parent:n}):Y(i,s=>{(s===i||!Gt(s))&&e.push({type:"add",element:s,parent:n})}));for(let i of r.removedNodes)i.nodeType===1&&e.push({type:"remove",element:i,parent:n})}return e}function Gt(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function eo(t,e){t.pruneDisconnected();let r=new Map,n=!1;for(let o of e){let i=o.type==="remove"?o.parent:o.element,s=i&&t.appFor(i);if(s){let g=r.get(s);g?g.push(o):r.set(s,[o])}o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(t.isRegistered&&t.isRegistered(o.element))&&(n=!0)}n&&(Me=t.remountIfPresent,pe?queueMicrotask(Ie):Ie());for(let[o,i]of r)o.root.isConnected&&t.schedule(o,"mutation",i)}function Ie(){let t=Me;Me=null,t?.()}function _t(t){if(Q){let r=!pe++;try{return Q.suppress(t,r)}finally{pe--}}let e=W("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function Fe(t,e){me=!0,Q=t,t.subscribe(r=>eo(e,r))}function We(t){if(me||typeof window>"u"||typeof document>"u")return;let e=W("Mutation");if(e&&typeof e.onAnyChange=="function"){Fe(Vn(e),t);return}typeof MutationObserver=="function"&&(Fe(to(),t),$t=Ht(document,Pe,function(){let n=W("Mutation");n&&($t(),$t=null,Q&&Q.teardown(),me=!1,Fe(Vn(n),t))}))}function Be(){if(Q)try{Q.teardown()}catch{}$t&&typeof document<"u"&&$t(),Q=null,me=!1,$t=null}function Hn(){pe||(Q&&Q.flush(),Ie())}var no=new Set(ht),Yt=Object.freeze([]),ot=[],Un={},Gn={},je=null;function he(t){ot.includes(t)||(ot.push(t),ot.sort((e,r)=>(e.order??100)-(r.order??100)),t.boundary&&Object.assign(Un,t.boundary),t.paintKinds&&Object.assign(Gn,t.paintKinds))}function Yn(t){je=t}function Nt(t,e={}){if(e.breaker){t.diag.error("E26",t.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(t._breakerRing||[]).join(", ")}),z(t.root,"loop");return}e.full&&(ce(),xn()),t._inPass=!0;let r=An(t.root),n=null;try{_t(()=>{n=ro(t,e)})}finally{t._inPass=!1,vn(r)}je&&n&&je(t,n),t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function ro(t,e){let r=t.root,n={},o=[],i=[],s=new Set;t.diag.errors=[];let g=e.full||t._changes===!1?null:t._changes||Yt;t._changes=null;let k=new Set,h=new Map,l=(m,a)=>m.map(A=>h.get(A)?.push(a)??h.set(A,[a])),d={root:n,state:n,item:null,ownerEl:r,projection:!1},p=null;function R(m,a,A=!1){let S=a.attr||a.name,_=A?Rn(m,S):m.getAttribute(S);return _==null&&(_=Ft(a),i.push({el:m,name:a.name,attr:S,value:$e(ut(_,a.type),a.type)})),ut(_,a.type)}function D(m,a,A,S){let _=a.decls;if(!_)return;let T=!!S.item&&!S.projection&&!S.view;for(let F of _){if(F.transient){p&&(p.pure=!1),A[F.name]=ie(m,F);continue}if(st(m,F)){A[F.name]=m.hasAttribute(F.attr);continue}A[F.name]=R(m,F,T)}}function f(m,a,A){let S=a.bind,_=A.item||A.state,T=Ut(m);p&&(T!=="leaf"||a.transient)&&(p.pure=!1),T==="radio"?(S in _||(_[S]=""),m.checked&&(_[S]=m.value)):T==="leaf"&&A.item&&!A.projection&&!A.view?_[S]=Ln(m):_[S]=de(m,T),a.transient&&(m.removeAttribute("value"),m.removeAttribute("checked"))}function y(m,a,A){let S=!1;if(a.waits&&k.add(a.waits),a.wants&&(l(a.wants,m),S=!0),p&&a.impure&&(p.pure=!1),a.paints){S=!0;for(let _ of a.paints)_.kind==="when"&&s.add(_.field),o.push({def:_,el:m,ctx:A})}for(let _ of ot)_.collect&&_.collect(N,m,a,A)!==!1&&(S=!0);p&&S&&(a.calcs&&(p.pure=!1),p.collects.push(m,a))}function b(m,a,A){Object.defineProperty(m,"$key",{value:ee(a,"row"),enumerable:!1}),Object.defineProperty(m,"$index",{value:A,enumerable:!1,configurable:!0}),Object.defineProperty(m,"$el",{value:a,enumerable:!1})}function v(m,a,A){let S=X(m);D(m,S,a,A),m._sapScope=a,!A.projection&&S.bind!=null&&f(m,S,A),y(m,S,A),S.items?E(m,a,A):$(m,a,A)}function $(m,a,A){for(let S=m.firstElementChild;S;S=S.nextElementSibling)c(S,a,A)}function c(m,a,A){let S=X(m);if(!S.inert){if(S.boundary){if(p&&(p.pure=!1),S.boundary==="scope")u(m,a,A);else if(S.boundary==="items")y(m,S,A),E(m,a,A);else if(S.waits)k.add(S.waits);else{let _=Un[S.boundary];_?_(N,m,S,a,A):S.wants&&l(S.wants,m)}return}!A.projection&&!A.view&&S.bind!=null&&f(m,S,A),y(m,S,A);for(let _=m.firstElementChild;_;_=_.nextElementSibling)c(_,a,A)}}function u(m,a,A){let S=m.getAttribute("scope"),_={};a[S]=_;let T={root:A.root,state:_,item:null,ownerEl:m,projection:A.projection};v(m,_,T)}function E(m,a,A){p&&(p.pure=!1);let S=m.getAttribute("items"),_=[];a[S]=_,m._sapList=_;let T=!A.projection&&!A.view&&kn(),F=0;for(let M=m.firstElementChild;M;M=M.nextElementSibling){let P=X(M);if(!P.item||P.template||P.cms)continue;let L=T?Sn(M):void 0;_.push(L&&L.plan===P&&Object.isExtensible(L.obj)&&w(L,M,F,A)||x(M,P,F,A,T)),F++}}function x(m,a,A,S,_){let T={};b(T,m,A);let F={root:S.root,state:S.state,item:T,ownerEl:m,projection:S.projection};if(!_)return v(m,T,F),T;let M=p,P={plan:a,obj:T,fields:null,presence:Yt,pending:Yt,collects:[],pure:!0},L=i.length,ve=t.diag.errors.length;p=P;try{v(m,T,F)}finally{p=M}if(!P.pure||t.halted||t.diag.errors.length!==ve)return T;let dt=[];for(let pt of Object.keys(T)){let Ee=T[pt];if(Ee!==null&&typeof Ee=="object")return T;dt.push(pt,Ee)}if(a.decls)for(let pt of a.decls)st(m,pt)&&(P.presence===Yt?P.presence=[]:P.presence).push(pt.name,pt.attr);return i.length>L&&(P.pending=i.slice(L)),P.collects.length||(P.collects=Yt),P.fields=dt,$n(m,P),T}function w(m,a,A,S){let _=m.obj;try{_.$index!==A&&Object.defineProperty(_,"$index",{value:A,enumerable:!1,configurable:!0});let M=m.presence;for(let L=0;L<M.length;L+=2)_[M[L]]=a.hasAttribute(M[L+1]);let P=m.fields;for(let L=0;L<P.length;L+=2)_[P[L]]=P[L+1]}catch{return kt(a),null}a._sapScope=_;let T=m.pending;for(let M=0;M<T.length;M++)i.push(T[M]);let F=m.collects;if(F.length){let M={root:S.root,state:S.state,item:_,ownerEl:a,projection:S.projection};for(let P=0;P<F.length;P+=2)y(F[P],F[P+1],M)}return _}let N={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:R,collectEl:y,walkScope:$,changes:g,full:g===null,trigger:e.cause||e.trigger||"refresh",waiting:k,wanted:h};for(let m of ot)m.begin&&m.begin(N);let C=e.cacheReads===!1?null:_n(r);try{v(r,n,d)}finally{e.cacheReads!==!1&&Nn(C)}if(t.halted||k.size)return N;for(let m of ot)m.afterIntake&&m.afterIntake(N);if(i.length&&s.size)for(let m of i)s.has(m.attr)&&m.el.getAttribute(m.attr)==null&&m.el.setAttribute(m.attr,m.value);for(let m of ot)m.compute&&m.compute(N);let O=0;for(let m of ot)m.reconcile&&(O+=m.reconcile(N));let j=0,V=O;for(let m of o){let a=so(m,t);m.ctx.view?V+=a:j+=a}for(let m of ot)m.afterPaint&&m.afterPaint(N);return t._state=n,t._stats={fields:Object.keys(n).filter(m=>typeof n[m]!="function").length,calcs:N.stats.calcs,paints:o.length,lists:N.stats.lists,writes:j,viewWrites:V},t._viewsChanged=V>0,t._lastPass={trigger:e.trigger||"refresh",writes:j},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${j}/${o.length}`),N}function oo(t){let e=t.kind==="text"?t.fmt||null:t.arg;return e==null?t.kind:t.kind+":"+e}function io(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let i=r.includes(o.getAttribute(e));if(n?!i:i)return!0}o=o.parentElement}return!1}function so(t,e){let r=t.def,n=t.el,o=Gn[r.kind];if(o)return o(t,e);if(r.kind==="when")return zn(r,n,null);try{let i=H(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),s=zn(r,n,i);return Z(n),s}catch(i){return e.diag.error(i.sapCode==="E22"?"E22":"E24",n,{attr:oo(r),expr:r.entry&&r.entry.src,problem:String(i.message)}),z(n,i.sapCode||"E24"),0}}function zn(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?ln(t.fmt,r):r==null?"":String(r);return e.textContent!==n?(e.textContent=n,1):0}case"show":{let n=!r;return e.hidden!==n?(e.hidden=n,1):0}case"when":{let n=W("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;e._sapWhen=!0;let o=io(e,t.field,t.values,t.match==="show-not")===(t.match==="hide");return e.hidden!==o?(e.hidden=o,1):0}case"attr":{let n=t.arg;if((n==="checked"||n==="selected")&&typeof e[n]=="boolean"&&!e.hasAttribute("bind")&&!e.closest("select[bind]")){let i=0;return e[n]!==!!r&&(e[n]=!!r,i=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),i=1),i}if(no.has(n)){let i=e.hasAttribute(n);return r&&!i?(e.setAttribute(n,""),1):!r&&i?(e.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return e.getAttribute(n)!==o?(e.setAttribute(n,o),1):0}case"class":{let n=!!r;return e.classList.contains(t.arg)!==n?(e.classList.toggle(t.arg,n),1):0}case"css":{let n=r==null?"":String(r);return e.style.getPropertyValue("--"+t.arg)!==n?(e.style.setProperty("--"+t.arg,n),1):0}default:return 0}}var ao=new Set(ht),Kn=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),uo=new Set(["show-when","hide-when","option","option-not"]),co=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,Xn=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"]),qe=[];function be(t){qe.includes(t)||qe.push(t)}function lo(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function Ve(t){return t.hasAttribute("bind")}function fo(t,e){e(t);for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(!n.hasAttribute("sap-ignore")){if(n.tagName==="TEMPLATE"){if(n.hasAttribute("items"))for(let o=n.content.firstElementChild;o;o=o.nextElementSibling)r(o);return}if(e(n),!bt(n))for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function ge(t,e){let r=!1,n=(s,g,k)=>{e.error(s,g,k),r=!0},o=t.ownerDocument.createTreeWalker(t,5,{acceptNode:s=>s.nodeType===3?1:bt(s)||s.hasAttribute("bind")||s.hasAttribute("sap-ignore")?2:3}),i;for(;i=o.nextNode();)if(/\{\{.*\}\}/.test(i.nodeValue||"")){n("E02",i.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return fo(t,s=>{let g=new Set;for(let h of qe)h(s,n,l=>g.add(l));let k=s.closest&&s.closest("[detail]");for(let h of[...s.attributes]){let l=h.name;if(g.has(l))continue;if(l.includes(":")){let p=l.slice(0,l.indexOf(":"));if(!Kn.has(p)&&!ke(l)){let R=Rt(p,[...Kn]);e.warn("W03",s,{attr:l,problem:`unknown "${p}:" attribute`,didYouMean:R?`${R}:`:null})}else if(uo.has(p)&&co.test(h.value)){let R=l.slice(l.indexOf(":")+1);e.warn("W04",s,{attr:l,expr:h.value,problem:`${p}: compares the "${R}" attribute against a literal value, not a JS expression`,fix:`use show="${h.value}" for an expression, or a literal like ${p}:${R}="overview"`})}}else if(!Xn.has(l)&&!ke(l)&&!Tt.has(l)&&!ao.has(l)&&!/^(data-|aria-|on)/.test(l)&&!(l in s)){let p=Rt(l,[...Xn]);p&&e.warn("W03",s,{attr:l,problem:`unknown "${l}" attribute`,didYouMean:p})}l==="attr:hidden"&&e.warn("W03",s,{attr:l,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let d=Ve(s)||l==="attr:selected"&&s.tagName==="OPTION"&&!!s.closest("select[bind]");(l==="attr:value"||l==="attr:checked"||l==="attr:selected")&&d&&n("E30",s,{attr:l,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),l==="effect"&&Ve(s)&&/\b(value|checked)\s*=[^=]/.test(h.value)&&n("E30",s,{attr:l,expr:h.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"}),(l==="text"||l.startsWith("text:")||l==="show")&&lo(s)&&(l==="show"||n("E18",s,{attr:l,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(s.hasAttribute("state")){let h=B(s.getAttribute("state")),l=new Set;for(let d of h){d.name.includes("-")&&n("E08",s,{attr:"state",problem:`field "${d.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${d.name.replace(/-/g,"")}`}),l.has(d.name)&&n("E04",s,{attr:"state",problem:`field "${d.name}" is declared twice in one scope`}),l.add(d.name),Jt.has(d.attr)&&n("E05",s,{attr:"state",problem:`"${d.name}" is a reserved Sap word`}),Tt.has(d.attr)&&n("E06",s,{attr:"state",problem:`"${d.name}" is a global HTML attribute name; pick another field name`}),d.name==="open"&&s.tagName==="DIALOG"&&n("E33",s,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let p=_e(s,d.attr);p&&(d.attr==="checked"||d.attr==="selected")&&n("E35",s,{attr:"state",problem:`"${d.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">'}),p&&d.type==="num"&&n("E35",s,{attr:"state",problem:`"${d.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${d.attr}"`}),d.transient&&(p||d.type==="presence")&&n("E35",s,{attr:"state",problem:`"${d.name}" is carried by attribute presence, which transient would strip`,fix:"declare a separate name:bool:transient field and paint the attribute from it"})}}if(Ve(s)){if(s.hasAttribute("-"),s.tagName==="INPUT"){let h=(s.getAttribute("type")||"text").toLowerCase();h==="file"&&n("E32",s,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),h==="password"&&!s.hasAttribute("transient")&&n("E31",s,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(s.tagName!=="SELECT"&&s.tagName!=="TEXTAREA"){let h=s.getAttribute("contenteditable");!(h!=null&&h!=="false")&&s.children.length>0&&n("E20",s,{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"})}}if(s.hasAttribute("transient")&&s.hasAttribute("persist")&&n("E34",s,{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"}),s.tagName==="DIALOG"&&s.hasAttribute("detail")&&!(s.parentElement&&s.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",s,{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'}),s.hasAttribute("item")&&!s.hasAttribute("template")&&s.parentNode&&s.parentNode.nodeType===1){let h=s.parentElement;(!h||!h.hasAttribute("items"))&&n("E10",s,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(s.hasAttribute("items")&&k&&n("E17",s,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),s.hasAttribute("items")){let h=t.querySelector(`[trigger-add="${s.getAttribute("items")}"]`);!oe(s)&&!Se(t,s.getAttribute("items"))&&it(s).length===0&&h&&n("E17",s,{attr:"items",problem:`trigger-add targets items="${s.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(e.halted=!0,e.haltReason=e.errors[0]?e.errors[0].code:"halt",z(t,e.haltReason)),!r}var Jn="sap-styles",Qn="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",He=new WeakSet;function po(t){if(He.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(Qn),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],He.add(t);return}catch{}if(!t.getElementById(Jn)){let n=t.createElement("style");n.id=Jn,n.textContent=Qn,(t.head||t.documentElement).appendChild(n)}He.add(t)}var mo=0;function Zn(){return typeof performance<"u"&&performance.now?performance.now():0}function ze(t){let e=t.id||t.getAttribute("sap")||`app-${mo++}`,r=new mt(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!ge(t,r))return n.halted=!0,n;po(t.ownerDocument);for(let s of t.querySelectorAll("textarea[data-value]"))Pt(s)||le(s);let i=Zn();return Nt(n,{trigger:"mount",full:!0}),n._mountMs=Zn()-i,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Pn()&&!W("derived")&&r.warn("W30",t,{problem:`${n._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)"}),n}var ho=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function we(t){return`${t.tagName.toLowerCase()}[sap]`}function bo(t){let e={actions:0,lists:0,rows:0};return Y(t,r=>{r.hasAttribute("items")&&e.lists++,r!==t&&r.hasAttribute("item")&&!r.hasAttribute("template")&&e.rows++,[...r.attributes].some(n=>ho.test(n.name))&&e.actions++}),e}function tr(t){function e(s){let g=s._stats||{},k=s.root;return{root:we(k),fields:g.fields||0,calcs:g.calcs||0,paints:g.paints||0,...bo(k),warnings:s.diag.warnings.length,errors:s.diag.errors.length,mountWrites:s._mountWrites||0,ms:Math.round((s._mountMs||0)*10)/10,passes:s._passes||0,lastPass:s._lastPass||null,ok:s.diag.errors.length===0&&!s.halted}}function r(){let s=t.apps().map(e);return{ok:s.every(g=>g.ok),apps:s}}function n(s){let g=e(s);return g.ok?`sap \u2713 ${g.root} \xB7 fields ${g.fields} \xB7 calcs ${g.calcs} \xB7 paints ${g.paints} \xB7 actions ${g.actions} \xB7 lists ${g.lists} \xB7 rows ${g.rows} \xB7 warnings ${g.warnings} \xB7 mount writes ${g.mountWrites} \xB7 ${g.ms}ms`:`sap \u2717 ${g.root} \xB7 errors ${g.errors} \xB7 warnings ${g.warnings} \xB7 ${g.ms}ms`}function o(){let s=[],g=[];for(let k of t.apps())s.push(...k.diag.errors),g.push(...k.diag.warnings);return{ok:s.length===0,errors:s,warnings:g,counts:{errors:s.length,warnings:g.length}}}function i(s){let g=s===void 0?!0:!!s;for(let k of t.apps())k._debug=g;return console.log(`sap debug ${g?"on":"off"} \u2014 per-pass headers will ${g?"":"no longer "}log`),g}return{status:r,report:o,debug:i,greenLine:n}}var Kt="0.9.0";var er={};var go=/^(https:\/\/(?:cdn\.jsdelivr\.net\/npm|unpkg\.com)\/@panphora\/sapjs)(?=[@/]|$)/,nr=t=>new Promise(e=>setTimeout(e,t)),rr=t=>t.getAttribute("plugins")?.match(/\S+/g)||[];function or(t,e,r){let n=new Map,o=new Map,i=new Map,s=new Map,g=[],k=new Set,h={},l=!1,d,p=globalThis,R=Array.isArray(p.sapPlugins)?p.sapPlugins:p.sapPlugins==null?p.sapPlugins=[]:[],D=p.document?.currentScript?.src||"",f=go.exec(D),y=a=>o.get(a)?.api||null,b=a=>Promise.allSettled(a.map(O));function v(){let a=new Map;for(let A of n.values())if(!o.has(A.name))for(let S of A.helpers||[])a.set(S,A.name);pn(h,a),ce()}function $(a){n.set(a.name,{...n.get(a.name),...a}),Ye(a),v()}function c(a){n.has(a.name)||$(a)}function u(a){R.includes(a)||R.push(a),$(a)}function E(a){for(let A of t.apps())A.root.isConnected&&t.schedule(A,a)}let x=Object.freeze({api:1,version:Kt,compile:G,run:nt,runWith:H,planOf:X,drainPlans:At,forgetRow:kt,setBeacon:z,clearBeacon:Z,write:_t,schedule(a,A="plugin"){let S=a?.root?a:t.appFor(a);S&&t.schedule(S,A)},appFor:t.appFor,apps:t.apps,capability:W,mayWrite:I,load:O,plugin:y});function w(a){if(typeof a=="string")return O(a);let{name:A,api:S}=a,_=L=>{throw new Error(`Sap.use: plugin "${A}" ${L}`)};if((typeof A!="string"||S!==1)&&_(`needs a name and plugin API ${1}; it gives API ${S}`),l)return null;if(o.has(A))return y(A);if((a.requires||[]).some(L=>!o.has(L)))return u(a),g.includes(a)||g.push(a),null;let T=a.setup?.(x)||{},F=(L,ve)=>{for(let dt of Array.isArray(a[L])?a[L]:Object.keys(a[L]||{}))(typeof(T[L]||{})[dt]!="function"||ve(dt))&&_(`cannot add "${dt}" to ${L}: the name is taken or not valid, or setup does not supply it`)},M=L=>!te(L,A);F("helpers",L=>(Le(L)&&_(`cannot add "${L}": window.${L} exists; rename the helper`),!mn(L)||L in h)),F("boundaries",M),F("directives",M);for(let L in T.api)L in e&&_(`cannot add Sap.${L}: the name is taken`);u(a);let P={...T,name:A,order:a.order,boundary:{}};for(let L in a.boundaries)P.boundary[L]=T.boundaries[L];for(let L of a.helpers||[])h[L]=T.helpers[L];for(let L in T.formats)L in et||(et[L]=T.formats[L]);return he(P),T.lint&&be(T.lint),Object.assign(e,T.api),o.set(A,P),s.delete(A),Ke(A,T.directives||!0),v(),_t(()=>k.forEach(Z)),k.clear(),g.splice(0).forEach(N),E("plugin:"+A),y(A)}function N(a){try{w(a)}catch(A){console.error(A)}}function C(a){if(l||o.has(a))return null;let A=n.get(a)||{},S=V.loader?.(a,A),_=A.url||V.base&&V.base+(A.file||a)+".js";return(S!==void 0?Promise.resolve(S):new Promise((F,M)=>{if(!_)throw new Error(`no address for plugin "${a}": call Sap.use(definition)`);let P=document.createElement("script");P.src=_,P.setAttribute("clay","editor-ui"),P.onload=P.onerror=L=>{P.remove(),L.type==="load"?F():M(new Error("could not load "+_))},document.head.append(P)})).then(F=>{if(l)return;let M=F?.default||F||R.find(P=>P.name===a);if(M?.name&&w(M),!o.has(a))throw new Error(`plugin "${a}" loaded and did not register`)})}function O(a){if(o.has(a))return Promise.resolve(y(a));if(i.has(a))return i.get(a);s.delete(a);let A=Promise.all((n.get(a)?.requires||[]).map(O)).then(()=>C(a));for(let _ of V.retryDelays)A=A.catch(()=>nr(_).then(()=>C(a)));let S=A.finally(()=>i.delete(a)).then(()=>y(a),_=>{throw s.set(a,_),d||=!p.addEventListener?.("online",()=>V.retry()),E("plugin-failed:"+a),document.dispatchEvent(new CustomEvent("sap:plugin-failed",{detail:{plugin:a,error:_}})),_});return i.set(a,S),S}function j(a){let A=new Set;for(let S of a.closest?.("[sap]")?[a]:a.querySelectorAll("[sap]")){for(let _ of rr(S.closest("[sap]")))A.add(_);n.size>o.size&&Y(S,_=>{let T=X(_);return T.inert?!1:(T.wants?.map(F=>A.add(F)),!!A.add(T.waits))})}return[...A].filter(S=>S&&!o.has(S))}Yn((a,A)=>{for(let S of new Set([...A.wanted.keys(),...A.waiting,...rr(a.root)])){if(o.has(S))continue;let _=s.get(S);if(!_)O(S).catch(()=>{});else{let T=A.wanted.get(S)?.[0]||a.root;a.diag.error("E52",T,{problem:`the "${S}" plugin did not load: ${_.message}`,fix:"Sap.plugins.retry() tries again"}),k.add(T),_t(()=>z(T,"E52"))}}});let V={api:1,base:f?`${f[1]}@${Kt}/dist/sap-plugins/`:/^[^:]+:\//.test(D)?new URL("sap-plugins/",D).href:null,loader:null,retryDelays:[1e3,4e3],declare:c,load:O,ready(a=document,A=3e3){let S=new Set,_=()=>{let F=j(a).filter(M=>!S.has(M)&&S.add(M));return F.length&&b(F).then(_)},T=_();return T?Promise.race([T,nr(A)]):null},has:a=>o.has(a),status:()=>({installed:[...o.keys()],loading:[...i.keys()],failed:[...s.keys()]}),retry:a=>b(a?[a]:[...s.keys()])};function m(){let a=[],A=()=>(Hn(),r.flushNow()),S=[...o.values()].filter(_=>_.flush);A();for(let _=0;S.length&&_<8;_++){for(let T of S){let F=T.flush();F?.then&&a.push(F)}if(!A())break}return a.length?Promise.all(a).then(m):null}e.use=w,e.plugins=V,e.flush=m;for(let a of Object.values(er))c(a);return R.slice().forEach(N),function(){l=!0;for(let A of o.values())A.dispose?.();o.clear(),s.clear()}}function ir({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],i=Ue(Nt);function s(x){let w=x;for(;w;){if(w.nodeType===1&&w.hasAttribute&&w.hasAttribute("sap"))return n.get(w)||null;w=w.parentNode&&w.parentNode.host?w.parentNode.host:w.parentElement}return null}function g(){for(let x=o.length-1;x>=0;x--){let w=o[x];w.root.isConnected||(n.delete(w.root),o.splice(x,1))}}function k(x,w){if(x.moveBefore)try{x.moveBefore(w,null);return}catch{}x.appendChild(w)}function h(x,w){let N=w.parentElement;if(N){if(N.moveBefore)try{N.moveBefore(x,w);return}catch{}N.insertBefore(x,w)}}let l={apps:()=>o.slice(),appFor:s,isRegistered:x=>n.has(x),pruneDisconnected:g,schedule:i.schedule,runNow:(x,w)=>i.runNow(x,w),moveInto:k,placeBefore:h,remountIfPresent:()=>$()},d=t(l),p=tr(l),R=r?r(l,p):{},D=!1,f=!1,y=null;function b(){D||(D=!0,e(l,d,document),y=In(l))}function v(){let x=W("derived");x&&typeof x.mounted=="function"&&x.mounted()}function $(x=document){if(f)return[];b(),We(l);let w=x.querySelectorAll("[sap]"),N=[];for(let C of w){if(n.has(C)||Pt(C))continue;let O=ze(C);n.set(C,O),o.push(O),N.push(O)}for(let C of N){let O=p.greenLine(C);C.diag.errors.length||C.halted?console.error(O):console.log(O)}return v(),N}function c(x){if(f)return null;if(b(),We(l),!x)return $();let w=typeof x=="string"?document.querySelector(x):x;if(!w)return null;if(n.has(w))return n.get(w);let N=ze(w);n.set(w,N),o.push(N);let C=p.greenLine(N);return N.diag.errors.length||N.halted?console.error(C):console.log(C),N}let u=d.Sap;u.version=Kt,u.refresh=function(){for(let w of o.slice())w.root.isConnected&&i.runNow(w,"refresh")},u.batch=Mn,u.status=p.status,u.report=p.report,u.why=R.why,u.debug=p.debug,u.doctor=R.doctor,u.greenLine=p.greenLine,u.formats=et,u.serializeControlToAttributes=St,u.finalizeControlForSave=On,u.rehydrateControlFromAttributes=le,u.mount=c,u.config=function(w={}){return w.formats&&Object.assign(et,w.formats),u},u._registry=n,u._reset=function(){n.clear(),o.length=0,Be()},u.unmount=function(){f=!0,n.clear(),o.length=0,Be(),typeof y=="function"&&y(),E()};let E=or(l,u,i);return{Sap:u,mountAll:$,mount:c,runtime:l}}function sr(t){if(typeof document>"u")return;let e=()=>Dn(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}var wo=["for","form","list","headers","popovertarget","commandfor","anchor","aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function yo(t,e){let r=null;return J(t,n=>{!r&&n.getAttribute("scope")===e&&(r=n)}),r}function ar(t,e,r){let n=U(t)||e;for(;n;){for(let o of B(n.getAttribute("state")||""))if(o.name===r)return{el:n,decl:o};if(n.hasAttribute("sap"))break;n=U(n.parentElement)}return null}function Ao(t){return typeof t=="number"?"num":typeof t=="boolean"?"bool":"string"}function ur(t){function e(f){let y=t.appFor(f);if(!y)return null;let b=ct(f),v=b&&b._sapEachItem&&b._sapEachItem.$el;if(v&&v.isConnected)return{ctxEl:v,appRec:y,isRow:!0};let $=Dt(f);if($)return $._sapDetailRow?{ctxEl:$._sapDetailRow,appRec:y,isRow:!0}:{ctxEl:U($.parentElement)||y.root,appRec:y,isRow:!1};let c=ne(f);if(c&&c.hasAttribute("item"))return{ctxEl:c,appRec:y,isRow:!0};let u=U(f)||y.root;return{ctxEl:u,appRec:y,isRow:u.hasAttribute("item")}}function r(f){let y=typeof f=="string"?document.querySelector(f):f;if(!y||y.nodeType!==1)return null;let b=e(y);return b?D(b.ctxEl,b.appRec,b.isRow):null}function n(f,y){let b=ct(f);if(!b)return r(f);let v=t.appFor(f),$=b._sapEachItem&&b._sapEachItem.$el;if($&&$.nodeType===1&&$.hasAttribute("item")&&yt($,y))return $.isConnected?D($,v,!0):null;let c=b.parentElement&&b.parentElement._sapDrawnEl;return!c||!c.isConnected?null:D(c,v,c.hasAttribute("item"))}function o(f,y,b){let v=lt(f,b);if(v)return q(v).read();let $=wt(f,b);if($)return it($).map(x=>D(x,y,!0));let c=yo(f,b);if(c)return D(c,y,!1);let u=ar(f,y.root,b);if(u)return u.decl.transient?ie(u.el,u.decl):en(u.el,u.decl);let E=f._sapScope;return E?E[b]:void 0}function i(f,y,b,v,$){v.transient?It(f,v,b):Mt(f,v,b),t.schedule($,"set:"+y)}function s(f,y){let b=new Set,v=U(f)||y;for(;v;){for(let $ of B(v.getAttribute("state")||""))b.add($.name);if(v.hasAttribute("sap"))break;v=U(v.parentElement)}return J(f,$=>{let c=$.getAttribute("bind");c&&b.add(c)}),b}function g(f,y,b,v){let $=lt(f,b);if($){if(!I($))return;q($).write(v);return}let c=f;for(;c;){for(let j of c.attributes)if(j.name==="calc:"+b){y.diag.error("E16",c,{attr:"calc:"+b,problem:`"${b}" is a computed field; computed fields are read-only`});return}if(c.hasAttribute("sap"))break;c=c.parentElement}let u=ar(f,y.root,b);if(u){if(!I(u.el,{transient:u.decl.transient}))return;i(u.el,b,v,u.decl,y);return}let E=s(f,y.root);E.delete(b);let x=b.length>=4?Rt(b,[...E]):null;if(x){y.diag.error("E12",f,{key:b,problem:`unknown state key "${b}"`,didYouMean:x});return}if(Jt.has(b)||Tt.has(b)){y.diag.error("E15",f,{key:b,problem:`cannot write undeclared field "${b}" \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"});return}let w=y.root;if(!I(w))return;let N=Ao(v),C=w.getAttribute("state")||"",O=N==="string"?b:`${b}:${N}`;w.setAttribute("state",C?`${C} ${O}`:O),i(w,b,v,{name:b,attr:b,type:N,transient:!1},y)}function k(f){let y=f.ownerDocument,b=new Map,v=($,c)=>{let u=Ze(y),E=$.getAttribute(c);E&&c==="id"&&b.set(E,u),$.setAttribute(c,u)};f.querySelectorAll("[id]").forEach($=>v($,"id")),f.querySelectorAll("[data-id]").forEach($=>v($,"data-id")),f.querySelectorAll("[sap-error]").forEach($=>$.removeAttribute("sap-error")),f.removeAttribute("sap-error"),f.hasAttribute("data-id")?(f.removeAttribute("id"),v(f,"data-id")):v(f,"id");for(let $ of[f,...f.querySelectorAll("*")])for(let c of wo){let u=$.getAttribute(c);if(u==null)continue;let E=u.split(/\s+/).map(x=>b.get(x)||x).join(" ");E!==u&&$.setAttribute(c,E)}}function h(f,y,b){let v=Wt(y.root,f,b);if(!v)return y.diag.error("E17",f,{problem:`cannot resolve a list named "${b}" from here`}),null;if(!I(v))return null;let $=oe(v);if(!$)return y.diag.error("E17",v,{problem:`items="${b}" has no [item template] to clone`}),null;let c=v.ownerDocument.importNode($,!0);return c.removeAttribute("template"),k(c),v.appendChild(c),t.schedule(y,"trigger-add:"+b),D(c,y,!0)}function l(f,y){let b=B(f.getAttribute("state")||""),v=!0;J(f,$=>{$.hasAttribute("bind")&&!I($)&&(v=!1)});for(let $ of b)I(f,{transient:$.transient})||(v=!1);if(v){J(f,$=>{if($.hasAttribute("bind")){let c=q($),u=$.getAttribute("default");c.kind==="checkbox"||c.kind==="radio"?c.write(u!=null?u===""||u==="true"||$.value===u:$.hasAttribute("checked")):c.write(u??($.getAttribute("value")||""))}});for(let $ of b){let c=nn(f,$);$.transient?It(f,$,c):Mt(f,$,c)}t.schedule(y,"trigger-reset")}}function d(f,y){if(!f.isConnected)throw new Error("stale row handle: $remove() on a removed row");I(f)&&(f.remove(),t.schedule(y,"trigger-remove"))}function p(f,y,b){if(!f.isConnected)throw new Error("stale row handle: $move() on a removed row");let v=null;if(b&&b.nodeType===1?v=b:typeof b=="string"&&(v=Wt(y.root,f,b)),!v){y.diag.error("E17",f,{problem:`$move() cannot resolve target "${b}"`});return}!I(f)||!I(v)||(t.moveInto(v,f),t.schedule(y,"trigger-move"))}function R(f){let y=f.parentElement;return y?it(y).indexOf(f):-1}function D(f,y,b){let v={get $el(){return f},get $key(){return ee(f,b?"row":"scope")},get $index(){return R(f)},$add(c){return h(f,y,c)},$reset(){return l(f,y),$},$remove(){d(f,y)},$move(c){p(f,y,c)},get $appRec(){return y}},$=new Proxy(v,{get(c,u){return typeof u=="symbol"||u[0]==="$"?c[u]:o(f,y,u)},set(c,u,E){return typeof u=="string"&&u[0]==="$"?(c[u]=E,!0):(g(f,y,u,E),!0)},has(c,u){return typeof u=="string"&&u[0]==="$"?u in c:o(f,y,u)!==void 0}});return $}return{Sap:r,contextElFor:e,readField:o,writeField:g,makeProxy:D,writeTargetFor:n}}var vo=["trigger-add","trigger-remove","trigger-reset"];function Eo(t){if(t.nodeType!==1)return!1;for(let e of t.attributes){let r=e.name;if(r.startsWith("set:")||r.startsWith("move:")||r.startsWith("sort:")||vo.includes(r))return!0}return!1}function xo(t,e){let r=t,n=e.parentElement;for(;r&&r!==n;){if(r.nodeType===1&&Eo(r)&&!(r.tagName==="FORM"&&r.hasAttribute("trigger-add")))return r;r=r.parentElement}return null}function cr(t,e){let{Sap:r}=e;function n(c,u){let E=null,x=ct(c),w=Dt(c);if(x)E=x._sapEachItem??null;else if(w&&w._sapDetailRow)E=w._sapDetailRow._sapScope||null;else{let O=ne(c);O&&O.hasAttribute("item")&&(E=O._sapScope||null)}return{state:(U(c)||u.root)._sapScope||u._state||{},item:E,el:c,root:u._state||{}}}function o(c,u,E){if(!c.hasAttribute("confirm")){E();return}let x=c.getAttribute("confirm"),w=x,N=G(x);if(!N.error)try{let m=nt(N,n(c,u));(typeof m=="string"||typeof m=="number")&&(w=String(m))}catch{}let C=zt(),O=()=>{zt()===C&&E()},j=Fn();if(!j){window.confirm(w)&&O();return}if(c._sapGatePending)return;c._sapGatePending=!0;let V=()=>{c._sapGatePending=!1};j(w,()=>{V(),O()}).catch(V)}function i(c,u){for(let E of c.attributes){if(!E.name.startsWith("set:"))continue;let x=E.name.slice(4),w=G(E.value);if(w.error){u.diag.error("E08",c,{attr:E.name,expr:E.value,problem:String(w.error.message)});continue}let N;try{N=nt(w,n(c,u))}catch(O){u.diag.error("E24",c,{attr:E.name,expr:E.value,problem:String(O.message)});continue}let C=e.writeTargetFor(c,x);C&&(C[x]=N)}}function s(c){let u=ct(c);if(!u)return c.closest("[item]");let E=u._sapEachItem&&u._sapEachItem.$el;return E&&E.nodeType===1&&E.hasAttribute("item")?E:null}function g(c,u){let E=s(c);if(!E||!I(E)||!I(E.parentElement))return;let x=it(E.parentElement),w=x.indexOf(E);u==="up"&&w>0?t.placeBefore(E,x[w-1]):u==="down"&&w<x.length-1&&t.placeBefore(x[w+1],E)}function k(c,u,E){if(u)return Wt(E.root,c,u);let x=c;for(;x;){if(x.hasAttribute&&x.hasAttribute("items"))return x;x=x.parentElement}let w=U(c)||E.root,N=[];return J(w,C=>{C.hasAttribute("items")&&N.push(C)}),N[0]||null}function h(c,u){let E=c==null||c==="",x=u==null||u==="";if(E&&x)return 0;if(E)return 1;if(x)return-1;let w=Number(c),N=Number(u);return!Number.isNaN(w)&&!Number.isNaN(N)?w-N:String(c)<String(u)?-1:String(c)>String(u)?1:0}function l(c,u,E,x){let w=k(c,E,x);if(!w){x.diag.error("E17",c,{attr:"sort:"+u,problem:`no items list resolvable for sort:${u}`});return}if(!I(w))return;let N=it(w),C=m=>m._sapScope?m._sapScope[u]:void 0,O=[...N].sort((m,a)=>h(C(m),C(a))),V=O.every((m,a)=>m===N[a])?[...O].reverse():O;for(let m of V)t.moveInto(w,m);t.schedule(x,"sort:"+u)}function d(c){if(!c||c.hidden)return;let u=c.querySelector("[bind]:not([type=hidden]), [contenteditable]");u&&typeof u.focus=="function"&&u.focus()}function p(c,u){o(c,u,()=>{let E=r(c);for(let x of[...c.attributes]){let w=x.name;if(w==="trigger-remove")E&&E.$remove();else if(w==="trigger-reset")E&&E.$reset();else if(w==="trigger-add"){let N=E&&E.$add(x.value);N&&d(N.$el)}else w==="move:up"?(g(c,"up"),t.schedule(u,"move:up")):w==="move:down"?(g(c,"down"),t.schedule(u,"move:down")):w.startsWith("move:to")?E&&E.$move(x.value):w.startsWith("sort:")&&l(c,w.slice(5),x.value,u)}[...c.attributes].some(x=>x.name.startsWith("set:"))&&i(c,u)})}function R(c){let u=c.target;if(!u||u.nodeType!==1)return;let E=t.appFor(u);if(!E)return;let x=xo(u,E.root);x&&p(x,E)}function D(c){let u=q(c),E=c.getAttribute("default");u.kind==="checkbox"?u.write(E===""||E==="true"):u.write(E??"")}function f(c,u,E){let x=r(c);if(!x)return;let w=x.$add(E);if(!w)return;let N=[];J(c,C=>{C.hasAttribute("bind")&&N.push(C)});for(let C of N){if(C.type==="radio"&&!C.checked)continue;let O=C.getAttribute("bind"),j=lt(w.$el,O);j?q(j).write(q(C).read()):yt(w.$el,O)&&(w[O]=q(C).read())}N.forEach(D),N.length?typeof N[0].focus=="function"&&N[0].focus():d(w.$el)}function y(c){let u=c.target;if(!u||!u.hasAttribute||!u.hasAttribute("trigger-add"))return;let E=t.appFor(u);E&&(c.preventDefault(),o(u,E,()=>f(u,E,u.getAttribute("trigger-add"))))}function b(c){let u=c.target;if(!u||u.tagName!=="DIALOG"||!u.hasAttribute("detail"))return;if(u._sapEngineClose){u._sapEngineClose=!1;return}if(u.open)return;let E=/^[\w.]+\s+by\s+state\.(\w+)\s*$/.exec(u.getAttribute("detail")||""),x=t.appFor(u);if(!E||!x)return;let w=B(u.getAttribute("state")||"").find(C=>C.name===E[1]);if(w){if(!I(u,{transient:w.transient}))return;w.transient?It(u,w,""):Mt(u,w,""),t.schedule(x,"close");return}let N=r(u.parentElement);N&&N[E[1]]!==""&&(N[E[1]]="")}function v(c,u){let E=c.hasAttribute("bind")&&re(c);if(!E&&c.hasAttribute("bind")&&ct(c)){let w=c.getAttribute("bind"),N=c._sapViewBind?e.writeTargetFor(c,w):null;return N&&(N[w]=q(c).read()),!0}let x=Dt(c);if(x&&x._sapDetailRow&&c.hasAttribute("bind")&&!E){let w=x._sapDetailRow,N=c.getAttribute("bind"),C=lt(w,N);if(C&&C!==c)return I(C)&&q(C).write(q(c).read()),!0;if(!C&&B(w.getAttribute("state")||"").some(O=>O.name===N))return e.writeField(w,u,N,q(c).read()),!0}return!1}function $(c=document){c.addEventListener("click",R),c.addEventListener("submit",y),c.addEventListener("close",b,!0)}return{install:$,routeInput:v}}function lr(t){let e=[];function r(k){let h=k.target;if(!h||h.nodeType!==1)return;let l=t.appFor(h);if(l){h.hasAttribute("persist")&&!fe(h)&&I(h)&&St(h);for(let d of e)if(d(h,l))return;t.schedule(l,k.type+" "+(h.id||h.tagName.toLowerCase()))}}function n(k){let h=k.target,l=t.appFor(h);l&&[...h.querySelectorAll("[bind]")].every(d=>I(d))&&setTimeout(()=>{h.querySelectorAll("[bind]").forEach(d=>{d.dispatchEvent(new Event("input",{bubbles:!0})),d.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(l,"reset")},0)}function o(k){let h=t.appFor(k.target);h&&t.schedule(h,"toggle")}function i(k){let h=k.detail||{};for(let l of[h.from,h.to,k.target]){if(!l||l.nodeType!==1)continue;let d=t.appFor(l);d&&t.schedule(d,"sorted")}}function s(k){if(k.key!=="ArrowUp"&&k.key!=="ArrowDown")return;let h=k.target;if(!h||h.nodeType!==1||h.tagName!=="INPUT"||!h.hasAttribute("bind")||!h.hasAttribute("step"))return;let l=(h.getAttribute("type")||"text").toLowerCase();if(l!=="text"&&l!=="tel"&&l!=="search"||!t.appFor(h)||!I(h))return;k.preventDefault();let p=K(h.getAttribute("step"))||1,R=k.key==="ArrowUp"?1:-1,D=K(h.value)+p*(k.shiftKey?10:1)*R,f=h.getAttribute("min"),y=h.getAttribute("max");f!==null&&f!==""&&D<K(f)&&(D=K(f)),y!==null&&y!==""&&D>K(y)&&(D=K(y)),q(h).write(String(Number(D.toFixed(2))))}function g(k=document){k.addEventListener("reset",n),k.addEventListener("toggle",o,!0),k.addEventListener("input",r),k.addEventListener("change",r),k.addEventListener("clay:sorted",i),k.addEventListener("keydown",s)}return{install:g,addRouter:k=>e.push(k)}}function fr(t){let e=t.toLowerCase();return/^x-text$|^x-html$/.test(e)?'use text="state.x" (Sap paints text only)':/^x-show$|^v-show$|^v-if$/.test(e)?'use show="expr" (toggles native hidden)':/^x-model$|^v-model$/.test(e)?'use bind="field"':/^@|^x-on:|^v-on:|^on:/.test(e)?"use native onclick + Sap(this) (no event directive)":/^:|^x-bind:class$|^v-bind:class$/.test(e)?'use class:NAME="expr" or attr:NAME="expr"':/^x-for$|^v-for$/.test(e)?'use items="name" on the container and item template on the row':/^x-data$/.test(e)?"declare state with state= / bind / items (no JS state object)":/^x-init$/.test(e)?"use a <script> or onclick + Sap(this)":/^bind:/.test(e)?'use bind="field"; one-way paint is attr:NAME="expr"':/^x-/.test(e)||/^v-/.test(e)?"this is a foreign-dialect attribute; Sap has no x-/v- attributes":null}function dr(t){let e=[],r=n=>{for(let o of n.attributes){let i=o.name;(i.startsWith("calc:")||i==="text"||i.startsWith("text:")||i==="show"||i.startsWith("attr:")||i.startsWith("class:")||i.startsWith("css:")||i==="effect"||i==="invalid"||i.startsWith("set:")||i==="detail")&&e.push({el:n,attr:i,src:o.value})}};r(t);for(let n of t.querySelectorAll("*"))r(n);return e}function pr(t){function e(o){return o?typeof o=="string"?document.querySelector(o):o.nodeType===1?o:null:null}function r(o,i){let s=e(o);if(!s)return console.warn("sap why: element not found"),null;let g=[`sap why <${s.tagName.toLowerCase()}> \u2014 ${Qt(s)}`],k=[...s.attributes].filter(l=>/^(bind|text|show|effect|invalid|detail|calc:|text:|attr:|class:|css:|set:|state|items|scope)/.test(l.name));for(let l of k)g.push(` ${l.name}="${l.value}"`);let h=s;for(;h&&!h._sapScope;)h=h.parentElement;if(h&&h._sapScope){let l=h._sapScope,d=i?[i]:Object.keys(l);g.push(" reads:");for(let p of d){let R=l[p];typeof R!="function"&&g.push(` ${p} = ${JSON.stringify(Array.isArray(R)?`[${R.length} rows]`:R)}`)}}return g.push(" serialization: textContent and value/checked attributes save with the file; reads live from properties"),console.log(g.join(`
|
|
11
|
+
`)),null}function n(){let o=[],i=0;for(let l of t.apps()){let d=l.root,p=we(d);i++;let R=new mt(l.name);ge(d,R);for(let v of R.errors)o.push({code:v.code,severity:"error",message:`${p}: ${v.code} ${v.slug} at ${v.el}`});for(let v of R.warnings)o.push({code:v.code,severity:"warn",message:`${p}: ${v.code} ${v.slug} at ${v.el}`});i++,Nt(l,{trigger:"doctor-dryrun"});let D=l._stats?l._stats.writes:0;D>0&&o.push({code:"W30",severity:"warn",message:`${p}: dry recompute wrote ${D} cells on a quiet page; an element is stale or non-idempotent`}),i++;let f=dr(d).map(v=>v.src).join(" \0 "),y=[];for(let v of[d,...d.querySelectorAll("[state]")])for(let $ of B(v.getAttribute("state")||""))y.push($.name);for(let v of y)new RegExp(`(state|item)\\.${v}\\b`).test(f)||o.push({code:"I33",severity:"info",message:`${p}: field "${v}" is declared but read nowhere (dead state)`});i++;let b=new Map;for(let v of d.querySelectorAll("[id]"))b.set(v.id,(b.get(v.id)||0)+1);for(let[v,$]of b)$>1&&o.push({code:"W32",severity:"warn",message:`${p}: duplicate id "${v}" (${$} elements) \u2014 clone/edit collision`});i++;for(let v of dr(d))v.src.length>120&&o.push({code:"I33",severity:"info",message:`${p}: ${v.attr} expression is ${v.src.length} chars; consider a calc: field`});i++;for(let v of d.querySelectorAll("[text], [text\\:num]")){let $=v.textContent||"";/\.\d{5,}/.test($)&&o.push({code:"I33",severity:"info",message:`${p}: ${Qt(v)} paints >4 decimals; consider text:FMT`})}}let s=o.filter(l=>l.severity==="error").length,g=o.filter(l=>l.severity==="warn").length,k=o.filter(l=>l.severity==="info").length;console.log(`sap doctor \xB7 ${t.apps().map(l=>we(l.root)).join(", ")} \xB7 errors ${s} \xB7 warnings ${g} \xB7 info ${k} \xB7 ${i} checks \xB7 0ms`);for(let l of o)(l.severity==="error"?console.error:l.severity==="warn"?console.warn:console.info)(` ${l.severity==="error"?"\u2717":l.severity==="warn"?"\u26A0":"\xB7"} ${l.message}`);return o}return{why:r,doctor:n}}function ko(t,e){let r=String(t).split("."),n=i=>{for(let s of r){if(i==null)return;i=Array.isArray(i)?i.flatMap(g=>g&&g[s]!=null?g[s]:[]):i[s]}return i},o=n(e.state);return o===void 0?n(e.root):o}function So(t,e,r,n){e._sapScope=r;let o=e.getAttribute("detail")||"",i=/^([\w.]+)\s+by\s+(.+)$/.exec(o);if(!i){e.hidden=!0,e._sapDetailRow=null;return}let s=i[1],g=i[2].trim(),k=ko(s,n),h;try{h=nt(G(g),{state:r,item:n.item,el:e,root:n.root})}catch{h=void 0}let l=Array.isArray(k)&&h!=null?k.find(p=>p&&typeof p=="object"&&p.$el&&String(p.$key)===String(h)):null;if(e._sapDetailRow=l?l.$el:null,l&&kt(l.$el),e.tagName==="DIALOG"){let p=l?String(l.$key):null;if(p!==e._sapDetailKey&&(e._sapDetailKey=p,e._sapDismissed=!1),!l){e._sapOpenedFor=null,e.open&&typeof e.close=="function"&&(e._sapEngineClose=!0,e.close());return}e.open?e._sapOpenedFor=p:(e._sapOpenedFor===p&&(e._sapDismissed=!0),e._sapOpenedFor=null,!e._sapDismissed&&e.isConnected&&typeof e.showModal=="function"&&(e.hidden&&(e.hidden=!1),e.showModal(),e._sapOpenedFor=p))}else{if(!l){e.hidden||(e.hidden=!0);return}e.hidden&&(e.hidden=!1)}At();let d={root:n.root,state:r,item:l,ownerEl:l.$el,projection:!0};t.collectEl(e,X(e),d),t.walkScope(e,l,d)}var mr={name:"detail",order:10,begin(t){t.deferredDetails=[]},boundary:{detail(t,e,r,n,o){for(let i of B(e.getAttribute("state")||""))i.name in n||(n[i.name]=st(e,i)?e.hasAttribute(i.attr):t.resolveDefault(e,i));t.deferredDetails.push({el:e,parentObj:n,ctx:o})}},afterIntake(t){for(let e=0;e<t.deferredDetails.length;e++){let{el:r,parentObj:n,ctx:o}=t.deferredDetails[e];So(t,r,n,o)}}};function hr(t){let e=0,r=t;for(;r&&!(r.hasAttribute&&r.hasAttribute("sap"));)r=r.parentElement,e++;return e}var br={name:"calc",order:20,begin(t){t.calcs=[]},collect(t,e,r,n){if(!r.calcs)return!1;let o=n.item||n.state;for(let i of r.calcs)t.calcs.push({owner:o,ownerEl:n.ownerEl,name:i.name,entry:i.entry,def:i,el:e,ctx:n})},compute(t){let e=t.app,r=new Map;for(let o of t.calcs){let i=r.get(o.owner);i||(i={ownerEl:o.ownerEl,list:[]},r.set(o.owner,i)),i.list.push(o)}let n=[...r.values()].sort((o,i)=>hr(i.ownerEl)-hr(o.ownerEl));for(let o of n){let i;try{i=hn(o.list)}catch(s){e.diag.error("E07",o.list[0].el,{problem:s.message}),i=o.list}for(let s of i)try{s.owner[s.name]=H(s.entry,s.ctx.state,s.ctx.item,s.el,s.ctx.root),Z(s.el)}catch(g){s.owner[s.name]=void 0,e.diag.error("E24",s.el,{attr:"calc:"+s.name,expr:s.entry.src,problem:String(g.message)}),z(s.el,g.sapCode||"E24")}}t.stats.calcs=t.calcs.length,t.stats.lists=r.size}};function $o(t,e,r){let n=r.nextSibling;if(e.isConnected&&t.moveBefore)try{t.moveBefore(e,n);return}catch{}t.insertBefore(e,n)}function _o(t,e,r){for(let n=e.parentElement;n;n=n.parentElement)if(n._sapScope===r&&!n.hasAttribute("detail")||n.hasAttribute("sap"))return n;return t}function No(t,e,r){let n=t.app;e._sapDrawnEl=_o(t.root,e,r.state);let o=null;for(let f=e.firstElementChild;f;f=f.nextElementSibling)if(f.tagName==="TEMPLATE"){o=f;break}let i=o&&o.content.children.length===1?o.content.firstElementChild:null;if(!i)return n.diag.error("E42",e,{attr:"each",problem:"each needs one <template> child with exactly one element root"}),0;let s=e.getAttribute("each"),g;try{g=nt(G(s),{state:r.state,item:r.item,el:e,root:r.root})}catch(f){return n.diag.error("E24",e,{attr:"each",expr:s,problem:String(f.message)}),0}if(!Array.isArray(g))return n.diag.error("E40",e,{attr:"each",expr:s,problem:"each must evaluate to an array; the list keeps its last good rows"}),0;let k=G(e.getAttribute("key")||"item.$key"),h=[],l=new Set;for(let f of g){let y;try{y=H(k,r.state,f,e,r.root)}catch{y=void 0}let b=y==null?"":String(y);if(b===""||l.has(b))return n.diag.error("E41",e,{attr:"key",expr:k.src,problem:b===""?"an item has no key; the list keeps its last good rows":`duplicate key "${b}"; the list keeps its last good rows`}),0;l.add(b),h.push(b)}let d=e._sapEach||new Map,p=new Map,R=0,D=o;h.forEach((f,y)=>{let b=d.get(f);if(!b||b.parentElement!==e){b=e.ownerDocument.importNode(i,!0);let v=(b.getAttribute("clay")||"").split(/\s+/).filter(Boolean);v.includes("editor-ui")||b.setAttribute("clay",[...v,"editor-ui"].join(" ")),b._sapEachRow=!0,R++}b.getAttribute("data-key")!==f&&b.setAttribute("data-key",f),D.nextElementSibling!==b&&($o(e,b,D),R++),b._sapEachItem=g[y],p.set(f,b),D=b});for(let[f,y]of d)p.get(f)!==y&&y.parentElement===e&&(y.remove(),R++);return e._sapEach=p,At(),h.forEach((f,y)=>{let b=p.get(f),v={root:r.root,state:r.state,item:g[y],ownerEl:b,projection:!1,view:!0};t.collectEl(b,X(b),v),t.walkScope(b,{},v)}),R}var gr={name:"each",order:30,begin(t){t.eachList=[]},boundary:{each(t,e,r,n,o){t.collectEl(e,r,o),t.eachList.push({el:e,ctx:o})}},reconcile(t){let e=0;for(let r=0;r<t.eachList.length;r++)e+=No(t,t.eachList[r].el,t.eachList[r].ctx);return e}};function To(t,e){try{H(t.def.entry,t.ctx.state,t.ctx.item,t.el,t.ctx.root),Z(t.el)}catch(r){e.diag.error("E24",t.el,{attr:"effect",expr:t.def.entry&&t.def.entry.src,problem:String(r.message)}),z(t.el,"E24")}}var wr={name:"effect",order:40,begin(t){t.effects=[]},collect(t,e,r,n){if(!r.effects)return!1;for(let o of r.effects)t.effects.push({def:o,el:e,ctx:n})},afterPaint(t){for(let e of t.effects)To(e,t.app)}};function Ro(t){let e="";try{let r=H(t.def.entry,t.ctx.state,t.ctx.item,t.el,t.ctx.root);e=typeof r=="string"?r:""}catch{e=""}typeof t.el.setCustomValidity=="function"&&t.el.setCustomValidity(e)}var yr={name:"validation",order:50,begin(t){t.invalids=[]},collect(t,e,r,n){if(!r.invalids)return!1;for(let o of r.invalids)t.invalids.push({def:o,el:e,ctx:n})},afterPaint(t){for(let e of t.invalids)Ro(e)}};function Ar(t,e){if(t===t.ownerDocument.activeElement)return 0;if(t.type==="radio"){let i=e!=null&&String(t.value)===String(e);return t.checked===i?0:(t.checked=i,1)}let r=Ut(t),n=de(t,r),o=e??"";return String(n)!==String(o)?(jn(t,r,o),1):0}var vr={name:"projection",order:60,collect(t,e,r,n){if(!(r.bind!=null&&(n.view||n.projection)&&!re(e)))return!1;let o=r.bind,i=t.paints;n.view?yt(tn(n.item),o)?(e._sapViewBind="item",i.push({def:{kind:"projection",field:o,from:"item"},el:e,ctx:n})):o in n.state||o in n.root?(e._sapViewBind="drawn",i.push({def:{kind:"projection",field:o,from:"drawn"},el:e,ctx:n})):(e._sapViewBind=null,t.app.diag.error("E43",e,{attr:"bind",expr:o,problem:`bind="${o}" 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"})):i.push({def:{kind:"projection",field:o,from:null},el:e,ctx:n})},paintKinds:{projection(t){let e=t.def;if(e.from==="drawn"){let r=e.field in t.ctx.state?t.ctx.state:t.ctx.root;return Ar(t.el,r[e.field])}return Ar(t.el,t.ctx.item?t.ctx.item[e.field]:"")}}};function Er(){for(let t of[mr,br,gr,wr,yr,vr])he(t)}Er();be((t,e,r)=>{for(let n of t.attributes){let o=fr(n.name);o&&(e("E01",t,{attr:n.name,expr:n.value,problem:`"${n.name}" is a foreign-dialect attribute; Sap has no ${n.name.split(/[:=]/)[0]} directive`,fix:o+" \u2014 or wrap the subtree in sap-ignore if intentional"}),r(n.name))}});var{Sap:Ae,mountAll:xr,mount:Lo,runtime:Co}=ir({createAccessor:ur,debugExtras:pr,installInput(t,e,r){let n=lr(t),o=cr(t,e);n.addRouter(o.routeInput),n.install(r),o.install(r)}}),Xt=typeof window<"u"?window.Sap:null;Xt&&Xt!==Ae&&Xt.core&&typeof Xt.unmount=="function"&&Xt.unmount();sr(xr);typeof window<"u"&&(window.Sap=Ae);var Oo=Ae;return Tr(Po);})();
|
|
11
12
|
if (typeof window !== 'undefined' && Sap && Sap.default) window.Sap = Sap.default;
|
|
12
13
|
var sapDefault = Sap.default;
|
|
13
14
|
window.clay = window.clay || {};
|
package/package.json
CHANGED
package/src/core/draft-mode.js
CHANGED
|
@@ -45,6 +45,11 @@ export function draftEligible(doc = document, loc = window.location) {
|
|
|
45
45
|
&& rulesReady(doc);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
// The dirty gate once it counts this page's edits: `token()` for the page as it is now,
|
|
49
|
+
// and `unchangedSince(token)`. Null until then, and a store that cannot ask assumes edits.
|
|
50
|
+
let gate = null;
|
|
51
|
+
export function setDraftGate(value) { gate = value; }
|
|
52
|
+
export function draftGate() { return gate; }
|
|
48
53
|
export function setDraftTransport(fn) { transport = fn; }
|
|
49
54
|
export function draftTransport() { return transport; }
|
|
50
55
|
let flushHook = null;
|
package/src/core/save-core.js
CHANGED
|
@@ -665,12 +665,12 @@ function draftResponse(status, body) {
|
|
|
665
665
|
return { ok: status >= 200 && status < 300, status, statusText: status === 200 ? "OK" : "Insufficient Storage", text: () => Promise.resolve(text) };
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
-
function sendToDraftStore(content) {
|
|
668
|
+
function sendToDraftStore(content, gateToken) {
|
|
669
669
|
const send = draftTransport();
|
|
670
670
|
if (!send) return Promise.resolve(draftResponse(503, { msg: "Saving in this browser is not ready yet", msgType: "error", code: "draft-not-ready" }));
|
|
671
671
|
// The transport's promise settles once the draft database holds the save.
|
|
672
672
|
return Promise.resolve()
|
|
673
|
-
.then(() => send(content))
|
|
673
|
+
.then(() => send(content, gateToken))
|
|
674
674
|
.then(
|
|
675
675
|
() => draftResponse(200, { msg: "Saved in this browser", msgType: "success" }),
|
|
676
676
|
(error) => draftResponse(507, { msg: "Couldn't save in this browser. Storage is full or turned off.", msgType: "error", code: error?.code || "draft-storage" }),
|
|
@@ -698,7 +698,7 @@ function sendToDraftStore(content) {
|
|
|
698
698
|
* @param {Array} [context.attempts] - collects each unique actual send
|
|
699
699
|
* @returns {Promise<Object>} The server's response body
|
|
700
700
|
*/
|
|
701
|
-
function sendOnce(content, saveId, etag, { captureId = null, conversionHeader = null, attempts = [] } = {}) {
|
|
701
|
+
function sendOnce(content, saveId, etag, { captureId = null, conversionHeader = null, attempts = [], gateToken = null } = {}) {
|
|
702
702
|
const controller = new AbortController();
|
|
703
703
|
const timeoutId = setTimeout(() => controller.abort(), SAVE_TIMEOUT_MS);
|
|
704
704
|
|
|
@@ -727,7 +727,7 @@ function sendOnce(content, saveId, etag, { captureId = null, conversionHeader =
|
|
|
727
727
|
notifySaveAttempt({ captureId, saveId, html: content, etag: etag ?? null });
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
-
return (isDraftMode ? sendToDraftStore(content) : fetch(url, options))
|
|
730
|
+
return (isDraftMode ? sendToDraftStore(content, gateToken) : fetch(url, options))
|
|
731
731
|
.then(res => res.text().then(text => {
|
|
732
732
|
let data = {};
|
|
733
733
|
if (text) {
|
|
@@ -891,7 +891,7 @@ async function recoverUnknownSave() {
|
|
|
891
891
|
* @param {Array} [context.attempts] - collects each unique actual send
|
|
892
892
|
* @returns {Promise<Object>} The server's response body
|
|
893
893
|
*/
|
|
894
|
-
async function sendSave(content, { captureId = null, conversionHeader = null, attempts = [] } = {}) {
|
|
894
|
+
async function sendSave(content, { captureId = null, conversionHeader = null, attempts = [], gateToken = null } = {}) {
|
|
895
895
|
// The re-send below is a RETRY of this attempt, so it carries this same id:
|
|
896
896
|
// whichever of the two requests the host ends up storing, its receipt then
|
|
897
897
|
// answers for this save. A fresh id on the re-send would leave the first
|
|
@@ -916,7 +916,7 @@ async function sendSave(content, { captureId = null, conversionHeader = null, at
|
|
|
916
916
|
const retryGuard = captureId ?? currentCaptureId();
|
|
917
917
|
for (;;) {
|
|
918
918
|
try {
|
|
919
|
-
return await sendOnce(content, saveId, etag, { captureId, conversionHeader, attempts });
|
|
919
|
+
return await sendOnce(content, saveId, etag, { captureId, conversionHeader, attempts, gateToken });
|
|
920
920
|
} catch (err) {
|
|
921
921
|
if (reSent) err.hadTimeout = true;
|
|
922
922
|
if (err.name === 'AbortError') {
|
|
@@ -971,7 +971,7 @@ async function sendSave(content, { captureId = null, conversionHeader = null, at
|
|
|
971
971
|
// `blockeditorFormatFloor` is internal: one save may carry a floor this tab has not
|
|
972
972
|
// noted yet, which is how the format gate's activation writes the marker. It
|
|
973
973
|
// raises these bytes only, never what the tab knows the document at.
|
|
974
|
-
function runSave(html, captureId, callback, conversion, capture = null, blockeditorFormatFloor = 0, lane = null) {
|
|
974
|
+
function runSave(html, captureId, callback, conversion, capture = null, blockeditorFormatFloor = 0, lane = null, gateToken = null) {
|
|
975
975
|
// A capture taken before the floor rose cannot drop the marker by omitting it:
|
|
976
976
|
// the bytes that go out carry the floor this tab last saw. At floor 0 this is
|
|
977
977
|
// the string itself, unchanged.
|
|
@@ -1039,7 +1039,7 @@ function runSave(html, captureId, callback, conversion, capture = null, blockedi
|
|
|
1039
1039
|
return finished(tooLargeResult(size));
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
|
-
sendSave(html, { captureId, conversionHeader: formatted.header, attempts })
|
|
1042
|
+
sendSave(html, { captureId, conversionHeader: formatted.header, attempts, gateToken })
|
|
1043
1043
|
.then(successResult, errorResult)
|
|
1044
1044
|
// Clear the flag BEFORE handing the result back, so a caller that queues a
|
|
1045
1045
|
// follow-up save can start it immediately rather than being told the lane
|
|
@@ -1088,8 +1088,8 @@ export function saveHtml(html, callback = () => {}) {
|
|
|
1088
1088
|
* @param {Object} [options.conversion] - {source:'file', base} or {source:'room', base, epoch}
|
|
1089
1089
|
* @returns {Promise<Object>}
|
|
1090
1090
|
*/
|
|
1091
|
-
export function saveCapturedHtml(html, captureId, callback = () => {}, { conversion, capture = null, blockeditorFormatFloor, lane = null } = {}) {
|
|
1092
|
-
return runSave(html, captureId, callback, conversion, capture, blockeditorFormatFloor, lane);
|
|
1091
|
+
export function saveCapturedHtml(html, captureId, callback = () => {}, { conversion, capture = null, blockeditorFormatFloor, lane = null, gateToken = null } = {}) {
|
|
1092
|
+
return runSave(html, captureId, callback, conversion, capture, blockeditorFormatFloor, lane, gateToken);
|
|
1093
1093
|
}
|
|
1094
1094
|
|
|
1095
1095
|
/**
|
package/src/core/save.js
CHANGED
|
@@ -1106,7 +1106,7 @@ async function settleCaptured({
|
|
|
1106
1106
|
// lane busy and waits that request out, which is what its 'clean' answer describes.
|
|
1107
1107
|
// A prepared save holds the lane itself, so its caller does the draining instead.
|
|
1108
1108
|
if (!laneHeld) drainPendingSave();
|
|
1109
|
-
}, { capture, blockeditorFormatFloor, lane });
|
|
1109
|
+
}, { capture, blockeditorFormatFloor, lane, gateToken });
|
|
1110
1110
|
});
|
|
1111
1111
|
}
|
|
1112
1112
|
|