@panphora/clayjs 1.25.0 → 1.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +4432 -3831
- package/dist/m/attrs/{save-freeze-MH3AOD56.js → save-freeze-PUYX32AK.js} +1 -1
- package/dist/m/{c-XHZIKRCV.js → c-2A2ATCIH.js} +1 -1
- package/dist/m/{c-BOMQIQ3V.js → c-2EFMJYGJ.js} +1 -1
- package/dist/m/{c-JD2VFAYG.js → c-2GB34XL4.js} +2 -2
- package/dist/m/{c-CITLTVQ4.js → c-2TJCFPX4.js} +1 -1
- package/dist/m/c-33SS5A4Y.js +1 -0
- package/dist/m/{c-V2FPBRO6.js → c-34J5HC7N.js} +1 -1
- package/dist/m/{c-ZEA3DCG3.js → c-3AAQJAKJ.js} +1 -1
- package/dist/m/c-3F3AADKG.js +1 -0
- package/dist/m/{c-GDNZEOOZ.js → c-3WX5FABT.js} +1 -1
- package/dist/m/{c-QWB53KRW.js → c-3XNTQQEJ.js} +1 -1
- package/dist/m/{c-AI3H6ETU.js → c-3Y234AUB.js} +2 -2
- package/dist/m/{c-GEAG5XAK.js → c-42RLKGEY.js} +1 -1
- package/dist/m/{c-XQTERKQA.js → c-44WITKWQ.js} +1 -1
- package/dist/m/c-47M4QHCK.js +1 -0
- package/dist/m/{c-UOUUI265.js → c-4M2T676V.js} +1 -1
- package/dist/m/{c-3E2IK5HU.js → c-4NAYDOWH.js} +1 -1
- package/dist/m/{c-TLQINES7.js → c-4OZZ7ENT.js} +2 -2
- package/dist/m/{c-QDVG4NAZ.js → c-5IIEOPIV.js} +1 -1
- package/dist/m/{c-4Q6QIODW.js → c-755ZOHOM.js} +1 -1
- package/dist/m/c-7Q4XYDF4.js +1 -0
- package/dist/m/c-7RHOMAMR.js +1 -0
- package/dist/m/{c-BCWYEG6P.js → c-7Z2625LX.js} +1 -1
- package/dist/m/{c-C6YZNU6E.js → c-A3OKSYRI.js} +1 -1
- package/dist/m/{c-RGAALCDU.js → c-A5IYL7JI.js} +1 -1
- package/dist/m/c-A5LASUEZ.js +1 -0
- package/dist/m/c-AQVQKFKB.js +1 -0
- package/dist/m/{c-IESDKFO6.js → c-ASGHHLFX.js} +1 -1
- package/dist/m/c-ASMLERFA.js +7 -0
- package/dist/m/{c-ORLPQFNU.js → c-AZM34SPO.js} +1 -1
- package/dist/m/{c-TCFVG3I4.js → c-BHLYQGTA.js} +1 -1
- package/dist/m/{c-ZORVIXUR.js → c-C27EVUQ6.js} +1 -1
- package/dist/m/{c-SUAC5RSG.js → c-C5UGNOC2.js} +1 -1
- package/dist/m/c-C6DXZIXD.js +1 -0
- package/dist/m/{c-WSTUCBHV.js → c-CPRGR2II.js} +1 -1
- package/dist/m/{c-NFQFV7OP.js → c-D2OPWOWO.js} +1 -1
- package/dist/m/{c-PRZNJUYZ.js → c-D4N4UJCQ.js} +2 -2
- package/dist/m/{c-D62HRSZK.js → c-DAUQ6JZ3.js} +1 -1
- package/dist/m/{c-5PZYDWTW.js → c-DDCYVLGG.js} +1 -1
- package/dist/m/{c-FBOO2UY3.js → c-DVMDYRAE.js} +1 -1
- package/dist/m/{c-WGQVSKKC.js → c-DYTBSJBI.js} +1 -1
- package/dist/m/{c-O2QZDVZ2.js → c-EEWPNUM2.js} +1 -1
- package/dist/m/{c-MFB74XVN.js → c-EHAR4RJJ.js} +2 -2
- package/dist/m/c-EIDZHQHZ.js +1 -0
- package/dist/m/c-ELXMSEN5.js +1 -0
- package/dist/m/c-FC5RUFPR.js +1 -0
- package/dist/m/{c-V4B3RUWB.js → c-GFASNR55.js} +1 -1
- package/dist/m/{c-4AE2A2LK.js → c-GNFDX6SU.js} +1 -1
- package/dist/m/{c-UD4VDBGJ.js → c-H3M6UDNV.js} +1 -1
- package/dist/m/{c-MUM53J5J.js → c-H4M2T4A6.js} +1 -1
- package/dist/m/{c-U7F66I64.js → c-HYNM5U6B.js} +1 -1
- package/dist/m/c-J2YYLEVM.js +1 -0
- package/dist/m/c-J2ZW4HMR.js +1 -0
- package/dist/m/{c-WCG6AKA7.js → c-JC4RZW4E.js} +1 -1
- package/dist/m/c-K2ZHQMPF.js +1 -0
- package/dist/m/{c-Z2OZFX3N.js → c-L6KVXPBO.js} +1 -1
- package/dist/m/{c-JWW6BHWD.js → c-LUBZU4AZ.js} +4 -4
- package/dist/m/{c-SEVOS4UE.js → c-LYNLY3MR.js} +1 -1
- package/dist/m/{c-NADLYVAH.js → c-MHTO3QAD.js} +1 -1
- package/dist/m/{c-SFYTKRU7.js → c-MKAUC6DB.js} +1 -1
- package/dist/m/c-MLMJUNRV.js +1 -0
- package/dist/m/{c-WDFQ7PBU.js → c-MMEVDN6D.js} +1 -1
- package/dist/m/{c-KYTVZT4D.js → c-NW4ZFKCY.js} +1 -1
- package/dist/m/{c-YFO6ZJLQ.js → c-O3DPFZCE.js} +1 -1
- package/dist/m/c-O4YIDULY.js +1 -0
- package/dist/m/c-OZOACVUD.js +1 -0
- package/dist/m/{c-MV7TEUTD.js → c-OZVK3TFI.js} +1 -1
- package/dist/m/c-PP3CUF3U.js +1 -0
- package/dist/m/{c-GY4BREDT.js → c-QL4NYM2L.js} +1 -1
- package/dist/m/c-RES2S5Q3.js +1 -0
- package/dist/m/c-RFGELYEU.js +2 -0
- package/dist/m/c-RGFPLQGV.js +1 -0
- package/dist/m/{c-FKTALXNV.js → c-STAPQ2X6.js} +1 -1
- package/dist/m/c-SYVF6ZMF.js +1 -0
- package/dist/m/{c-X3V4RWMA.js → c-T5IWJOMW.js} +1 -1
- package/dist/m/{c-DT7E76Z2.js → c-T7LOTEWO.js} +1 -1
- package/dist/m/{c-SFZRY6RT.js → c-TWB5ZQU4.js} +1 -1
- package/dist/m/c-U35T5NAY.js +1 -0
- package/dist/m/c-UW6MMZ4V.js +1 -0
- package/dist/m/c-VGG3UR7I.js +1 -0
- package/dist/m/c-VU4WEWPH.js +4 -0
- package/dist/m/{c-5Q5XBN56.js → c-W7LWCJHD.js} +1 -1
- package/dist/m/c-WOJ2RTV4.js +1 -0
- package/dist/m/{c-ZJG6C2WL.js → c-WOWGGNCJ.js} +1 -1
- package/dist/m/{c-SXZYVXD6.js → c-XCOQNISP.js} +1 -1
- package/dist/m/{c-IL5IVTOG.js → c-XS7G6U3Z.js} +1 -1
- package/dist/m/{c-HGG7M2S3.js → c-Y3J5LDKB.js} +1 -1
- package/dist/m/{c-JB5YU57S.js → c-Y3MPVURA.js} +1 -1
- package/dist/m/c-Y6HH7LTM.js +1 -0
- package/dist/m/{c-52OC3OH3.js → c-YRDKVEGR.js} +1 -1
- package/dist/m/{c-WVCT3ITX.js → c-YZGWSCMT.js} +1 -1
- package/dist/m/{c-YX2MC7YL.js → c-ZJ7726FO.js} +1 -1
- package/dist/m/core/{admin-attrs-ZI6K6UGM.js → admin-attrs-43JBA6JB.js} +1 -1
- package/dist/m/core/{autosave-BSM2ABJL.js → autosave-HD7Y7UNV.js} +1 -1
- package/dist/m/core/{conflict-notice-7EQLDYPA.js → conflict-notice-Y2NTMDGJ.js} +1 -1
- package/dist/m/core/{persist-2SZO3PCE.js → persist-MX3VYVBN.js} +1 -1
- package/dist/m/core/{save-K6Q47J2X.js → save-JZ7R4ET2.js} +1 -1
- package/dist/m/core/{save-core-U3Z44XBO.js → save-core-I4N6S4ED.js} +1 -1
- package/dist/m/core/{site-edits-CFMF6GHD.js → site-edits-TIJDPG6H.js} +1 -1
- package/dist/m/core/{snapshot-PWCHYFL6.js → snapshot-N5MKDGNI.js} +1 -1
- package/dist/m/core/{unsaved-warning-2WRZLJH5.js → unsaved-warning-BP6ZY3PG.js} +1 -1
- package/dist/m/internals/{index-FSLC4M7J.js → index-3LAVREAU.js} +1 -1
- package/dist/m/{loader-RC54UV7H.js → loader-7ORQVRCK.js} +1 -1
- package/dist/m/manifest-A27A4278.js +1 -0
- package/dist/m/manifest-edit-E8A61EB4.js +1 -0
- package/dist/m/manifest.json +1099 -1039
- package/dist/m/page/{editor-PKSPJ2XJ.js → editor-HS2CAV3W.js} +5 -5
- package/dist/m/plugins/{ai-edit-3LG6MGS3.js → ai-edit-WDV2GLDU.js} +2 -2
- package/dist/m/plugins/{cms-T2HLI7JG.js → cms-4KET6RZT.js} +9 -9
- package/dist/m/plugins/{derive-7DR5TUDH.js → derive-R4USHZ7P.js} +1 -1
- package/dist/m/plugins/{indicator-CTKX4EY7.js → indicator-OLPZ4WFI.js} +1 -1
- package/dist/m/plugins/{live-IFLL6YN5.js → live-CO4VJS46.js} +1 -1
- package/dist/m/plugins/{menu-YJZ3JWBC.js → menu-ESEFQARM.js} +1 -1
- package/dist/m/plugins/{page-GTDPYGE4.js → page-L3VKIQU2.js} +2 -2
- package/dist/m/plugins/{page-view-NMCCU6MF.js → page-view-6KNTXABH.js} +1 -1
- package/dist/m/plugins/{people-6WIWCZEG.js → people-EBWE337I.js} +1 -1
- package/dist/m/plugins/quickcrop-VNRXGRPC.js +26 -0
- package/dist/m/plugins/{richclay-L3BZMX4I.js → richclay-V6WKJTUF.js} +17 -17
- package/dist/m/plugins/sortable-BAG3MSWS.js +1 -0
- package/dist/m/plugins/{source-7LSGOV46.js → source-OYHDXKTB.js} +1 -1
- package/dist/m/plugins/undo-WUK2NLBA.js +1 -0
- package/dist/m/plugins/{upgrade-MMPZUCDM.js → upgrade-SZQJYEQQ.js} +1 -1
- package/dist/m/plugins/{visitor-drafts-V5YB7XDH.js → visitor-drafts-ZE6PCAFP.js} +2 -2
- package/dist/m/plugins/{visitor-menu-QDV2MYJN.js → visitor-menu-5XY57JQA.js} +1 -1
- package/dist/m/plugins/{wire-3YGUO3GE.js → wire-S5ATC4QI.js} +1 -1
- package/dist/m/reader-core-AHOAP5DH.js +77 -0
- package/dist/m/sync/{live-sync-XMXXZS3G.js → live-sync-DX4K5GDB.js} +1 -1
- package/dist/m/ui/index-G7ZJXNMG.js +1 -0
- package/dist/m/vendor/{sap-core.vendor-JANUQULT.js → sap-core.vendor-5TWOJYVM.js} +4 -4
- package/dist/offline-manifest.json +707 -677
- package/dist/server/core.cjs +4245 -2614
- package/dist/server/markdown.cjs +1 -0
- package/dist/server/markdown.mjs +7 -0
- package/docs/guide.md +26 -37
- package/entries/clay-data.js +1 -1
- package/entries/sap.js +5 -5
- package/package.json +6 -2
- package/packed-contract.json +3 -0
- package/src/attrs/save-freeze.js +1 -1
- package/src/core/admin-contenteditable.js +1 -1
- package/src/core/admin-inputs.js +1 -1
- package/src/core/admin-onclick.js +1 -1
- package/src/core/admin-resources.js +5 -2
- package/src/core/conflict-notice-ui.js +59 -34
- package/src/core/save.js +9 -9
- package/src/core/snapshot.js +56 -43
- package/src/core/stale-host-notice.js +20 -7
- package/src/page/editor.js +10 -4
- package/src/page/import-markdown.js +22 -8
- package/src/page/save-projection.js +1 -1
- package/src/plugins/quickcrop.js +128 -69
- package/src/plugins/sortable.js +25 -9
- package/src/server/markdown/index.js +23 -0
- package/src/sync/conflicts.js +3 -1
- package/src/sync/data-guard-notice.js +137 -18
- package/src/ui/bevel-controls.js +4 -1
- package/src/ui/dialogs.js +11 -7
- package/src/ui/modal.js +9 -7
- package/src/ui/toast.js +67 -32
- package/src/vendor/hyper-html-api-data.vendor.js +1 -1
- package/src/vendor/hyper-html-api-upgrade.vendor.js +2 -2
- package/src/vendor/hyper-undo.vendor.js +1 -1
- package/src/vendor/hypercms.vendor.js +7 -7
- package/src/vendor/richclay.vendor.js +16 -16
- package/src/vendor/sap-core.vendor.js +4 -4
- package/tool-generation/context.md +69 -0
- package/tool-generation/system.md +1 -1
- package/dist/m/c-277QP5ET.js +0 -1
- package/dist/m/c-5SZ6KFR5.js +0 -1
- package/dist/m/c-CU33V6RW.js +0 -4
- package/dist/m/c-CVSWLX3X.js +0 -1
- package/dist/m/c-DXPOFLEJ.js +0 -1
- package/dist/m/c-EODTTNVA.js +0 -1
- package/dist/m/c-ESK4S67I.js +0 -1
- package/dist/m/c-FDWR3FL7.js +0 -1
- package/dist/m/c-FJDTDGDA.js +0 -1
- package/dist/m/c-FYDKYW6E.js +0 -1
- package/dist/m/c-HKSLOVU4.js +0 -1
- package/dist/m/c-IJHF4IO6.js +0 -1
- package/dist/m/c-IUL7PU4P.js +0 -1
- package/dist/m/c-K4M76VPM.js +0 -7
- package/dist/m/c-M7ITYKMF.js +0 -1
- package/dist/m/c-MR75YPRT.js +0 -1
- package/dist/m/c-NHXOBD6A.js +0 -1
- package/dist/m/c-NVU3DORS.js +0 -1
- package/dist/m/c-PNZIJFG7.js +0 -1
- package/dist/m/c-RHPHMTF2.js +0 -2
- package/dist/m/c-RWJ3OSCP.js +0 -1
- package/dist/m/c-SGG6MUXW.js +0 -1
- package/dist/m/c-SXNSSHPP.js +0 -1
- package/dist/m/c-TFLRT5JX.js +0 -1
- package/dist/m/c-U65PREMC.js +0 -1
- package/dist/m/c-VMXCX52Q.js +0 -1
- package/dist/m/c-YYGUHSZR.js +0 -1
- package/dist/m/manifest-3B84C829.js +0 -1
- package/dist/m/manifest-edit-1CB79AD4.js +0 -1
- package/dist/m/plugins/quickcrop-X5MRIBAP.js +0 -26
- package/dist/m/plugins/sortable-365SRRL3.js +0 -1
- package/dist/m/plugins/undo-UES4KS7B.js +0 -1
- package/dist/m/reader-core-VR7EL4WV.js +0 -77
- package/dist/m/ui/index-MGTWOW2C.js +0 -1
- /package/dist/m/{c-QTTJYJMA.js → c-FILLTJA7.js} +0 -0
- /package/dist/m/plugins/{quickcrop-X5MRIBAP.js.LEGAL.txt → quickcrop-VNRXGRPC.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-L3BZMX4I.js.LEGAL.txt → richclay-V6WKJTUF.js.LEGAL.txt} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// GENERATED — do not edit. Vendored from sapjs/dist/sap-core.min.js via sapjs
|
|
2
2
|
// `npm run copy-to-clayjs`. Edit the sapjs source and re-run.
|
|
3
|
-
var SapCoreBundle=(()=>{var Ye=Object.defineProperty;var
|
|
3
|
+
var SapCoreBundle=(()=>{var Ye=Object.defineProperty;var Vn=Object.getOwnPropertyDescriptor;var qn=Object.getOwnPropertyNames;var Gn=Object.prototype.hasOwnProperty;var Yn=(e,t)=>{for(var r in t)Ye(e,r,{get:t[r],enumerable:!0})},Xn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qn(t))!Gn.call(e,o)&&o!==r&&Ye(e,o,{get:()=>t[o],enumerable:!(n=Vn(t,o))||n.enumerable});return e};var Kn=e=>Xn(Ye({},"__esModule",{value:!0}),e);var Vr={};Yn(Vr,{FULL_SAPJS:()=>ke,Sap:()=>Se,default:()=>Ur,mount:()=>Wr,mountAll:()=>Un,needsFullSapjs:()=>At,runtime:()=>Hr});function xt(e){let t=!1,r=new Set,n=[];function o(l){l&&(n.push(l),n.length>8&&n.shift())}function s(l,p,k){if(o(p),k){if(l._broken||l.halted)l._changes=!1;else if(l._changes!==!1){let R=l._changes||(l._changes=[]);for(let L of k)R.push(L)}if(l._inPass)return}if(l._broken){if(p==="mutation")return;m(l)}r.has(l)||(l._trigger=p),r.add(l),!t&&(t=!0,queueMicrotask(i))}function i(){t=!1;for(let l of[...r])r.delete(l)&&g(l,!1,l._trigger)}function g(l,p,k){if(!(l._broken||l.halted)){if(l._passes=(l._passes||0)+1,l._passes>50){l._broken=!0,l._breakerRing=n.slice(),e(l,{breaker:!0});return}l._resetArmed||(l._resetArmed=!0,setTimeout(()=>{l._passes=0,l._resetArmed=!1},0)),e(l,p?{full:!0,cause:k}:{cause:k})}}function b(l,p){o(p),l._broken&&m(l),g(l,!0,p)}function m(l){l._broken=!1,l._passes=0}function d(){let l=t;for(;t;)i();return l}return{schedule:s,runNow:b,flushNow:d}}var Jn={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"}},ee=["disabled","readonly","required","checked","selected","multiple","open","inert","autofocus","novalidate","hidden"],Xe=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"]),Et=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 Qn(e){if(!e||e.nodeType!==1)return"?";if(e.id)return`${e.tagName.toLowerCase()}#${e.id}`;let t=[],r=e,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 s=0,i=0;for(let g=r.parentElement.firstElementChild;g;g=g.nextElementSibling)g.tagName===r.tagName&&(s++,g===r&&(i=s));s>1&&(o+=`:nth-of-type(${i})`)}if(t.unshift(o),r.hasAttribute("sap"))break;r=r.parentElement,n++}return t.join(" > ")}var Ne=class{constructor(t){this.appName=t,this.errors=[],this.warnings=[],this.halted=!1,this.haltReason=null}block(t,r,n={}){let o=(Jn[t]||{}).slug||"error",s={code:t,slug:o,el:Qn(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"},i=[`
|
|
4
4
|
`+(t[0]==="W"?"sap \u26A0 ":"sap \u2717 ")+t+" "+o];return i.push(` at ${s.el}${s.attr?` \u2014 ${s.attr}="${s.expr??""}"`:""}`),s.problem&&i.push(` problem: ${s.problem}`),s.didYouMean&&i.push(` did you mean: ${s.didYouMean}`),s.fix&&i.push(` fix: ${s.fix}`),(t[0]==="W"?console.warn:console.error)(i.join(`
|
|
5
|
-
`)),s}error(t,r,n={}){let o=this.block(t,r,n);return this.errors.push(o),o}warn(t,r,n={}){let o=this.block(t,r,n);return this.warnings.push(o),o}};function D(e,t){e&&e.getAttribute("sap-error")!==t&&e.setAttribute("sap-error",t)}function fe(e){e&&e.hasAttribute("sap-error")&&e.removeAttribute("sap-error")}function Ke(e,t){let r=null,n=3;for(let o of t){let s=
|
|
5
|
+
`)),s}error(t,r,n={}){let o=this.block(t,r,n);return this.errors.push(o),o}warn(t,r,n={}){let o=this.block(t,r,n);return this.warnings.push(o),o}};function D(e,t){e&&e.getAttribute("sap-error")!==t&&e.setAttribute("sap-error",t)}function fe(e){e&&e.hasAttribute("sap-error")&&e.removeAttribute("sap-error")}function Ke(e,t){let r=null,n=3;for(let o of t){let s=Zn(e,o);s<n&&(n=s,r=o)}return r}function Zn(e,t){let r=e.length,n=t.length,o=Array.from({length:r+1},(s,i)=>[i,...new Array(n).fill(0)]);for(let s=0;s<=n;s++)o[0][s]=s;for(let s=1;s<=r;s++)for(let i=1;i<=n;i++)o[s][i]=Math.min(o[s-1][i]+1,o[s][i-1]+1,o[s-1][i-1]+(e[s-1]===t[i-1]?0:1));return o[r][n]}var vt=["sap","item","scope","items","detail","each"],de=new Map,pe=new Map,Te="";function kt(e){for(let[t,r]of Object.entries(e.boundaries||{}))Re(t)&&de.set(t,{name:t,plugin:e.name,opaque:!!r.opaque,on:r.on||null,installed:!1});for(let[t,r]of Object.entries(e.directives||{}))Re(t)&&pe.set(t,{name:t,plugin:e.name,key:r.key,impure:!!r.impure,parse:null});Te=[...de.values()].map(t=>`${t.on||""}[${t.name}]`).join(",")}function Re(e,t){return!vt.includes(e)&&(Nt(e)||t)===t}function St(e,t){for(let r of de.values())r.plugin===e&&(r.installed=!!t);for(let r of pe.values())r.plugin===e&&(r.parse=t&&t[r.name]||null)}function Nt(e){return(de.get(e)||pe.get(e)||{}).plugin}function Tt(e){return pe.get(e)}function Je(e){return!!Nt(e)||pe.has(e.slice(0,e.indexOf(":")+1))}function _e(e){if(!Te)return null;for(let t of de.values())if(!(t.on&&e.localName!==t.on||!e.hasAttribute(t.name)))return vt.some(r=>e.hasAttribute(r))?null:t;return null}function te(e){let t=_e(e);return!!t&&(t.opaque||!t.installed)}function me(e){if(!Te)return null;for(let t=e.parentElement;t;t=t.parentElement)if(t=t.closest(Te),!t||te(t))return t;return null}function ne(e){return te(e)?e:me(e)}function O(e,t){if(!(t(e)===!1||te(e)))for(let r=e.firstElementChild;r;r=r.nextElementSibling)O(r,t)}var er=new Set(ee),tr={readonly:"readOnly",novalidate:"noValidate"},nr=0,Rt=new WeakMap;function _t(e,t="sap"){let r=e.getAttribute("data-id");if(r)return r;if(e.id)return e.id;let n=Rt.get(e);return n||(n=`${t}-${(nr++).toString(36)}`,Rt.set(e,n)),n}function $t(e){let t=[];for(let r=e.firstElementChild;r;r=r.nextElementSibling)r.hasAttribute("item")&&!r.hasAttribute("template")&&!r.hasAttribute("cms-template")&&t.push(r);return t}function Qe(e,t){if(!e||!t)return null;let r=[...e.querySelectorAll(`template[items="${t}"]`)].find(o=>o.closest("[sap]")===e),n=r&&r.content.firstElementChild;return n&&n.hasAttribute("item")?n:null}function Lt(e){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(t.hasAttribute("item")&&t.hasAttribute("template"))return t;return Qe(e.closest("[sap]"),e.getAttribute("items"))}function $e(e){let t=[];if(!e)return t;for(let r of e.trim().split(/\s+/)){if(!r)continue;let n=r,o,s=n.indexOf("=");s>=0&&(o=n.slice(s+1),n=n.slice(0,s));let i=n.split(":"),g=i[0],b="string",m=!1;for(let p of i.slice(1))p==="num"?b="num":p==="bool"?b="bool":p==="presence"?b="presence":p==="transient"&&(m=!0);let d=g,l=d.startsWith("data-")&&d.length>5?d.slice(5).replace(/-([a-z])/g,(p,k)=>k.toUpperCase()):d;t.push({name:l,attr:d,type:b,default:o,transient:m})}return t}function Le(e,t){if(t==="num"){if(e==null||e==="")return 0;let r=Number(e);return Number.isNaN(r)?0:r}return t==="bool"?e==="true"||e===""||e==="1":e??""}function Pt(e,t){return t==="bool"?e?"true":"false":e==null?"":String(e)}function Ze(e,t){return er.has(t)&&typeof e[tr[t]||t]=="boolean"}function et(e,t){return t.type==="presence"||t.type!=="num"&&Ze(e,t.attr||t.name)}function tt(e){return e.default!=null?e.default:e.type==="num"?"0":e.type==="bool"?"false":""}function Ct(e,t){let r=t.attr||t.name,n=e._sapTransient||(e._sapTransient={});if(!(t.name in n)){let o=e.getAttribute(r);o==null&&(o=tt(t)),n[t.name]=Le(o,t.type)}return e.hasAttribute(r)&&e.removeAttribute(r),n[t.name]}function M(e){if(typeof e=="number")return e;if(e==null||e==="")return 0;let t=Number(typeof e=="string"?e.replace(/[$,%\s]/g,""):e);return Number.isNaN(t)?0:t}function Pe(e,t){return Array.isArray(e)?t==null?e:e.map(r=>typeof t=="function"?t(r):r?.[t]):[]}function nt(e,t){return Pe(e,t).reduce((r,n)=>r+M(n),0)}function Mt(e,t){return Array.isArray(e)?t==null?e.length:e.reduce((r,n)=>r+(t(n)?1:0),0):0}function It(e,t){let r=Pe(e,t);return r.length?nt(e,t)/r.length:0}function Dt(e,t){let r=Pe(e,t).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 Ft(e,t){let r=Pe(e,t).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 Bt(e,t,r){let n=M(e)===1?t:r??t+"s";return`${e} ${n}`}function jt(e,t){let r=new Date(e),n=new Date(t);return Number.isNaN(+r)||Number.isNaN(+n)?0:Math.round((n-r)/864e5)}function V(e){return typeof e=="number"?e:Number(e)}function Ot(e,t){let r=V(e),n=Math.abs(r).toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t});return(r<0&&/[1-9]/.test(n)?"-$":"$")+n}var W={usd:e=>Ot(e,0),usd2:e=>Ot(e,2),pct:e=>Math.round(V(e))+"%",pct1:e=>V(e).toFixed(1)+"%",int:e=>Math.round(V(e)).toLocaleString("en-US"),num:e=>V(e).toLocaleString("en-US"),num2:e=>V(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),compact:e=>V(e).toLocaleString("en-US",{notation:"compact"}),date:e=>{let t=new Date(e);return Number.isNaN(+t)?String(e):t.toLocaleDateString("en-US")},clock:e=>{let t=V(e),r=Math.floor(t/100),n=r%10,o=Math.floor(r/10)%60;return`${Math.floor(r/600)}:${String(o).padStart(2,"0")}.${n}`}},rr=new Set(["usd","usd2","pct","pct1","int","num","num2","compact","clock"]);function Wt(e,t){if(!e)return t==null?"":String(t);let r=W[e];if(typeof r!="function"){let n=new Error(`unknown format "${e}"`);throw n.sapCode="E22",n}if(rr.has(e)){let n=typeof t=="number"?t:Number(t);if(!Number.isFinite(n)){let o=new Error(`format "${e}" received ${typeof t=="string"?`"${t}"`:t}`);throw o.sapCode="E22",o}}return r(t)}var rt=["state","item","el","root","fmt","num","sum","count","avg","min","max","plural","days"],he=new Map,ot=[],Ht=[],be=null,zt=null,or=/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[`}](?:\\.|[^`\\])*?(?:`|\$\{)|[{}]/.source;function Ut(e,t){ot=Object.keys(e),Ht=Object.values(e);let r=[...t.keys()].filter(n=>st(n)&&!(n in e));zt=t,be=r.length?new RegExp(`${or}|\\.{3}|(${r.join("|")})\\s*\\(|[\\w$.]+`,"g"):null,he.clear()}function it(e){return e in globalThis&&globalThis[e]?.nodeType!==1}function st(e){return/^[a-z_]\w*$/i.test(e)&&!rt.includes(e)&&!it(e)}function Vt(e){try{return st(e)&&!!new Function(e,'"use strict"')}catch{return!1}}function ge(e){let t=[],r;if(be)for(be.lastIndex=0;r=be.exec(e);){let[n,o]=r;if(o&&st(o))return zt.get(o);n[0]==="}"&&!t.pop()?.[1]?be.lastIndex=r.index+1:n.endsWith("{")&&t.push(n)}return null}var ir=/\bstate\.([a-z][a-z0-9_]*)/g,sr=/\bitem\.([a-z][a-z0-9_]*)/g;function ar(e){let t=r=>new Set([...(e||"").matchAll(r)].map(n=>n[1]));return{state:t(ir),item:t(sr)}}function Ce(e,t=!1){let r=(t?"!":"")+e,n=he.get(r);if(n)return n;he.size>512&&he.clear();try{let o=t?`"use strict";
|
|
6
6
|
${e}`:`"use strict"; return (${e});`;n={fn:ot.length?new Function(...ot,`return function(${rt}){${o}
|
|
7
|
-
}`)(...
|
|
7
|
+
}`)(...Ht):new Function(...rt,o),src:e,statement:t,deps:ar(e),error:null,waits:ge(e)}}catch(o){n={fn:null,src:e,statement:t,deps:{state:new Set,item:new Set},error:o,waits:null}}return n.waits||he.set(r,n),n}function qt(e,t){return ye(e,t.state,t.item,t.el??null,t.root)}function ye(e,t,r,n,o){if(e.error)throw e.error;return e.fn(t,r,n,o,W,M,nt,Mt,It,Dt,Ft,Bt,jt)}var we={},X=null,Kt=!0,Me=!1;function Ie(){we={}}function Jt(e){let t=Me;return X?at(X.takeRecords()):Kt&&ur(),Me=!!X&&e.getRootNode()===document,t}function Qt(e){Me=e}function Zt(){X&&at(X.takeRecords())}function ur(){if(typeof document>"u"||typeof MutationObserver!="function"){Kt=!1;return}X=new MutationObserver(at),X.observe(document,{attributes:!0,childList:!0,subtree:!0})}function at(e){for(let t of e)if(t.type==="attributes")Gt(t.target);else if(t.addedNodes.length&&!(t.target.nodeType===1&&ne(t.target)))for(let r of t.addedNodes)r.nodeType===1&&O(r,Gt)}function Gt(e){e._sapPlan&&(e._sapPlan=null)}function K(e){if(!Me)return Yt(e);let t=e._sapPlan;return t&&t.gen===we?t:e._sapPlan=Yt(e)}function H(e,t,r){let n=Ce(t,r);return n.waits&&(e.waits=n.waits),n}function Yt(e){let t={gen:we,inert:e.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 e.attributes){let o=n.name,s=n.value,i=o.indexOf(":");if(i<0){switch(o){case"sap-ignore":t.inert=!0;break;case"cms-template":t.inert=!0,t.cms=!0;break;case"template":t.inert=!0,t.template=!0;break;case"item":t.item=!0;break;case"scope":t.scope=!0;break;case"items":t.items=!0;break;case"detail":t.detail=!0,t.waits=ge(s)||t.waits;break;case"each":t.each=!0,t.waits=ge(s)||ge(e.getAttribute("key"))||t.waits;break;case"bind":t.bind=s;break;case"transient":t.transient=!0;break;case"state":t.decls=$e(s);break;case"text":(t.paints||(t.paints=[])).push({kind:"text",fmt:null,entry:H(t,s)});break;case"show":(t.paints||(t.paints=[])).push({kind:"show",entry:H(t,s)});break;case"effect":(t.effects||(t.effects=[])).push({entry:H(t,s,!0)});break;case"invalid":(t.invalids||(t.invalids=[])).push({entry:H(t,s)});break;default:Xt(t,o,"",s)}continue}let g=o.slice(0,i),b=o.slice(i+1);switch(g){case"calc":(t.calcs||(t.calcs=[])).push({name:b,entry:H(t,s)});break;case"text":(t.paints||(t.paints=[])).push({kind:"text",fmt:b,entry:H(t,s)});break;case"attr":(t.paints||(t.paints=[])).push({kind:"attr",arg:b,entry:H(t,s)});break;case"class":(t.paints||(t.paints=[])).push({kind:"class",arg:b,entry:H(t,s)});break;case"css":(t.paints||(t.paints=[])).push({kind:"css",arg:b,entry:H(t,s)});break;case"show-when":case"option":(t.paints||(t.paints=[])).push({kind:"when",match:"show",field:b,values:s.split("|")});break;case"hide-when":(t.paints||(t.paints=[])).push({kind:"when",match:"hide",field:b,values:s.split("|")});break;case"option-not":(t.paints||(t.paints=[])).push({kind:"when",match:"show-not",field:b,values:s.split("|")});break;default:Xt(t,g+":",b,s)}}let r=_e(e);return t.boundary=t.scope?"scope":t.items?"items":t.detail?"detail":t.each?"each":r?r.name:null,r&&!r.installed&&(t.wants||=[]).push(r.plugin),lr(t)?cr():t}function Xt(e,t,r,n){let o=Tt(t);if(!o)return;if(!o.parse){(e.wants||=[]).push(o.plugin);return}let s=o.parse(r,n);s!==void 0&&((e[o.key]||(e[o.key]=[])).push(s),e.ext=!0,o.impure&&(e.impure=!0),s&&s.entry&&s.entry.waits&&(e.waits=s.entry.waits))}var Oe=null;function cr(){return(!Oe||Oe.gen!==we)&&(Oe=Object.freeze({gen:we,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})),Oe}function lr(e){return!e.inert&&!e.item&&e.boundary===null&&e.bind===null&&!e.transient&&!e.decls&&!e.calcs&&!e.paints&&!e.effects&&!e.invalids&&!e.wants&&!e.ext}var oe=new WeakMap,ie=new WeakMap,re=null,q=!1;function tn(){oe=new WeakMap,ie=new WeakMap}function en(e){for(let t of e){let r=t.target.nodeType===1?t.target:t.target.parentElement;for(let o=r;o;o=o.parentElement)ie.delete(o);if(t.type==="attributes"){oe.delete(t.target);continue}for(let o=r;o;o=o.parentElement)oe.delete(o);let n=t.addedNodes;if(!(!n||!n.length||r&&ne(r)))for(let o of n)o.nodeType===1&&O(o,fr)}}function fr(e){oe.delete(e),ie.delete(e)}function nn(){return q}function rn(e){return q?ie.get(e):void 0}function on(e,t){q&&ie.set(e,t)}function De(e){ie.delete(e)}function sn(e){let t=q;return!re&&typeof MutationObserver=="function"&&(re=new MutationObserver(en),re.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),re&&en(re.takeRecords()),q=!!re&&e.getRootNode()===document,t}function an(e){q=e}function un(e){let t=oe.get(e);return t||oe.set(e,t={attrs:new Map,hasText:!1,text:""}),t}function cn(e,t){if(!q)return e.getAttribute(t);let r=un(e);return r.attrs.has(t)||r.attrs.set(t,e.getAttribute(t)),r.attrs.get(t)}function ln(e){if(!q)return e.textContent;let t=un(e);return t.hasText||(t.text=e.textContent,t.hasText=!0),t.text}function fn(e){return(e.getAttribute("type")||"text").toLowerCase()}function se(e){let t=e.tagName;if(t==="INPUT"){let r=fn(e);r==="checkbox"||r==="radio"?e.checked?e.setAttribute("checked",""):e.removeAttribute("checked"):e.setAttribute("value",e.value);return}if(t==="TEXTAREA"){e.setAttribute("data-value",e.value);return}if(t==="SELECT"){let r=e.options;for(let n=0;n<r.length;n++)r[n].selected?r[n].setAttribute("selected",""):r[n].removeAttribute("selected")}}function dn(e,t=e){let r=e.tagName;if(r==="INPUT"){let n=fn(e);n==="checkbox"||n==="radio"?t.checked?e.hasAttribute("checked")||e.setAttribute("checked",""):e.removeAttribute("checked"):t.value!==(e.getAttribute("value")??"")&&e.setAttribute("value",t.value);return}if(r==="TEXTAREA"){let n=t.value.startsWith(`
|
|
8
8
|
`)?`
|
|
9
|
-
`+t.value:t.value;e.textContent!==n&&(e.textContent=n),e.removeAttribute("data-value");return}if(r==="SELECT"){let n=e.options,o=t.options;for(let s=0;s<n.length;s++)o[s]&&o[s].selected?n[s].hasAttribute("selected")||n[s].setAttribute("selected",""):n[s].removeAttribute("selected")}}function Fe(e){e.tagName!=="TEXTAREA"||!e.hasAttribute("data-value")||e!==e.ownerDocument.activeElement&&(e.textContent=e.getAttribute("data-value"),e.removeAttribute("data-value"))}function $(e){if(typeof window>"u")return null;let t=window.clay,r=window.hyperclay;return e==="consent"?t?.confirm||r?.consent||null:t?.[e]||r?.[e]||null}function dn(){let e=$("visitorDrafts");return!!(e&&typeof e.restored=="function"&&e.restored()?.restored)}var ut=["clay:mutation-ready","hyperclay:mutation-ready"],fr=["clay:sync-applied","hyperclay:livesync-applied"],dr=["clay:ready","hyperclay:ready"],pr=["clay:route"],mr=["clay:modechange"];function Ae(e,t,r){let n=null,o=s=>{n!==null&&n!==s.type||(n=s.type,queueMicrotask(()=>{n=null}),r(s))};for(let s of t)e.addEventListener(s,o);return()=>{for(let s of t)e.removeEventListener(s,o)}}function pn(e){let t=typeof window<"u"&&window.clay&&window.clay.ready;t&&typeof t.then=="function"?t.then(()=>e(),()=>e()):e()}function Be(e){let t=$("region");return!t||typeof t.resolveRegionPolicy!="function"||typeof t.skipForPolicy!="function"?!1:t.skipForPolicy(t.resolveRegionPolicy(e),void 0,["no-save","freeze"])}function mn(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function ae(e,{transient:t=!1}={}){if(t)return!0;let r=mn();return typeof r?.canWrite!="function"||$("region")?.resolveRegionPolicy?.(e)?.persist==="none"?!0:r.canWrite()}function hn(e,t){if(typeof t!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=$("undo");r&&r.flush&&r.flush();let n=t();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(e),n}function bn(e){if(typeof window>"u"||typeof document>"u")return;let t=()=>{let p=!1;for(let k of e.apps())k.root.isConnected?e.runNow(k,"platform"):p=!0;p&&e.pruneDisconnected(),e.remountIfPresent()},r=$("derived"),n=r&&typeof r.register=="function"?r.register(t):null,o=typeof n=="function"?null:Ae(document,fr,t),s=Ae(document,pr,t),i=null,g=!1,b=()=>{let p=i;i=null,p&&(p[2](),p[3]())},m=()=>{if(g)return!1;let p=$("undo"),k=mn()?.state?.generation;if(i&&i[0]===p&&i[1]===k)return!0;if(b(),!p||typeof p.on!="function")return!1;let R=p.on("undo",t);if(typeof R!="function")return!1;let L=p.on("redo",t);return typeof L!="function"?(R(),!1):(i=[p,k,R,L],!0)};m();let d=[ut,dr,mr].map(p=>Ae(document,p,m)),l=$("ready");return l&&typeof l.then=="function"&&l.then(m,()=>{}),()=>{g=!0,typeof n=="function"&&n(),o&&o(),s();for(let p of d)p();b()}}function ct(e){let t=e.tagName;if(t==="INPUT"){let r=(e.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return t==="TEXTAREA"?"text":t==="SELECT"?e.multiple?"select-multiple":"select-one":"leaf"}function hr(e){if(e.validity&&e.validity.badInput)return e.hasAttribute("value")?Number(e.getAttribute("value"))||0:e._sapLastGood??0;if(e.value==="")return 0;let t=Number(e.value);return Number.isNaN(t)?e._sapLastGood??0:(e._sapLastGood=t,t)}function yn(e,t){switch(t){case"checkbox":return e.checked;case"radio":return e.checked?e.value:void 0;case"number":return hr(e);case"select-one":return e.value;case"select-multiple":return[...e.selectedOptions].map(r=>r.value);case"hidden":case"text":return e.value;case"leaf":return e.textContent;default:return e.value}}function br(e,t,r){switch(t){case"checkbox":e.checked=!!r;break;case"radio":e.checked=String(e.value)===String(r);break;case"number":case"text":case"hidden":e.value=r==null?"":String(r);break;case"select-one":e.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of e.options)o.selected=n.has(o.value);break}case"leaf":e.textContent=r==null?"":String(r);break;default:e.value=r==null?"":String(r)}}function gn(e){if(e.hasAttribute("transient")){e.removeAttribute("value"),e.removeAttribute("checked"),e.removeAttribute("data-value");return}Be(e)||se(e)}function gr(e){e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function wn(e,t){return yn(e,t)}function An(e){let t=ct(e);return{el:e,kind:t,read(){return yn(e,t)},write(r,n={}){br(e,t,r),n.noMirror||gn(e),n.silent||gr(e)},mirror(){gn(e)}}}var yr=[],F=null,je=0,ft=null,We=!1,ue=null;function xn(e){let t=null;return{kind:"hub",flush(){e.pause(),e.resume()},subscribe(r){let n=e.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(t=n)},suppress(r){e.pause();try{return r()}finally{e.resume()}},teardown(){if(t){try{t()}catch{}t=null}}}}function wr(){let e=null,t=null;function r(){let n=e?e.takeRecords():yr;n.length&&t(En(n))}return{kind:"native",flush:r,subscribe(n){t=n,e=new MutationObserver(s=>n(En(s)));let o=document.body||document.documentElement;o&&e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(n,o){let s=$("undo");o&&r(),s&&s.pause&&s.pause();try{return n()}finally{e&&e.takeRecords(),s&&s.resume&&s.resume()}},teardown(){e&&(e.disconnect(),e=null)}}}function En(e){let t=[];for(let r of e)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!xe(n)&&t.push({type:"attribute",element:n,attribute:r.attributeName})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!xe(n)&&t.push({type:"characterData",element:n})}else if(r.type==="childList"){let n=r.target;n.nodeType===1&&[...r.addedNodes,...r.removedNodes].some(s=>s.nodeType===3)&&!xe(n)&&t.push({type:"characterData",element:n});let o=r.addedNodes.length>0&&n.nodeType===1&&ne(n);for(let s of r.addedNodes)s.nodeType!==1||xe(s)||(o?t.push({type:"add",element:s,parent:n}):O(s,i=>{(i===s||!xe(i))&&t.push({type:"add",element:i,parent:n})}));for(let s of r.removedNodes)s.nodeType===1&&t.push({type:"remove",element:s,parent:n})}return t}function xe(e){return!!(e.closest&&e.closest("[sap-ignore],[template],[cms-template]"))}function Ar(e,t){e.pruneDisconnected();let r=new Map,n=!1;for(let o of t){let s=o.type==="remove"?o.parent:o.element,i=s&&e.appFor(s);if(i){let g=r.get(i);g?g.push(o):r.set(i,[o])}o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(e.isRegistered&&e.isRegistered(o.element))&&(n=!0)}n&&(ft=e.remountIfPresent,je?queueMicrotask(dt):dt());for(let[o,s]of r)o.root.isConnected&&e.schedule(o,"mutation",s)}function dt(){let e=ft;ft=null,e?.()}function ce(e){if(F){let r=!je++;try{return F.suppress(e,r)}finally{je--}}let t=$("undo");if(t&&t.pause&&t.resume){t.pause();try{return e()}finally{t.resume()}}return e()}function lt(e,t){We=!0,F=e,e.subscribe(r=>Ar(t,r))}function pt(e){if(We||typeof window>"u"||typeof document>"u")return;let t=$("Mutation");if(t&&typeof t.onAnyChange=="function"){lt(xn(t),e);return}typeof MutationObserver=="function"&&(lt(wr(),e),ue=Ae(document,ut,function(){let n=$("Mutation");n&&(ue(),ue=null,F&&F.teardown(),We=!1,lt(xn(n),e))}))}function mt(){if(F)try{F.teardown()}catch{}ue&&typeof document<"u"&&ue(),F=null,We=!1,ue=null}function vn(){je||(F&&F.flush(),dt())}var xr=new Set(ee),Ee=Object.freeze([]),U=[],Sn={},Nn={},ht=null;function He(e){U.includes(e)||(U.push(e),U.sort((t,r)=>(t.order??100)-(r.order??100)),e.boundary&&Object.assign(Sn,e.boundary),e.paintKinds&&Object.assign(Nn,e.paintKinds))}function Tn(e){ht=e}function ze(e,t={}){if(t.breaker){e.diag.error("E26",e.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(e._breakerRing||[]).join(", ")}),D(e.root,"loop");return}t.full&&(Ie(),en()),e._inPass=!0;let r=Kt(e.root),n=null;try{ce(()=>{n=Er(e,t)})}finally{e._inPass=!1,Jt(r)}ht&&n&&ht(e,n),e._viewsChanged&&(e._viewsChanged=!1,e.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function Er(e,t){let r=e.root,n={},o=[],s=[],i=new Set;e.diag.errors=[];let g=t.full||e._changes===!1?null:e._changes||Ee;e._changes=null;let b=new Set,m=new Map,d=(u,a)=>u.map(c=>m.get(c)?.push(a)??m.set(c,[a])),l={root:n,state:n,item:null,ownerEl:r,projection:!1},p=null;function k(u,a,c=!1){let f=a.attr||a.name,h=c?un(u,f):u.getAttribute(f);return h==null&&(h=tt(a),s.push({el:u,name:a.name,attr:f,value:Pt(Le(h,a.type),a.type)})),Le(h,a.type)}function R(u,a,c,f){let h=a.decls;if(!h)return;let y=!!f.item&&!f.projection&&!f.view;for(let E of h){if(E.transient){p&&(p.pure=!1),c[E.name]=Ct(u,E);continue}if(et(u,E)){c[E.name]=u.hasAttribute(E.attr);continue}c[E.name]=k(u,E,y)}}function L(u,a,c){let f=a.bind,h=c.item||c.state,y=ct(u);p&&(y!=="leaf"||a.transient)&&(p.pure=!1),y==="radio"?(f in h||(h[f]=""),u.checked&&(h[f]=u.value)):y==="leaf"&&c.item&&!c.projection&&!c.view?h[f]=cn(u):h[f]=wn(u,y),a.transient&&(u.removeAttribute("value"),u.removeAttribute("checked"))}function _(u,a,c){let f=!1;if(a.waits&&b.add(a.waits),a.wants&&(d(a.wants,u),f=!0),p&&a.impure&&(p.pure=!1),a.paints){f=!0;for(let h of a.paints)h.kind==="when"&&i.add(h.field),o.push({def:h,el:u,ctx:c})}for(let h of U)h.collect&&h.collect(S,u,a,c)!==!1&&(f=!0);p&&f&&(a.calcs&&(p.pure=!1),p.collects.push(u,a))}function G(u,a,c){Object.defineProperty(u,"$key",{value:_t(a,"row"),enumerable:!1}),Object.defineProperty(u,"$index",{value:c,enumerable:!1,configurable:!0}),Object.defineProperty(u,"$el",{value:a,enumerable:!1})}function B(u,a,c){let f=K(u);R(u,f,a,c),u._sapScope=a,!c.projection&&f.bind!=null&&L(u,f,c),_(u,f,c),f.items?Y(u,a,c):j(u,a,c)}function j(u,a,c){for(let f=u.firstElementChild;f;f=f.nextElementSibling)V(f,a,c)}function V(u,a,c){let f=K(u);if(!f.inert){if(f.boundary){if(p&&(p.pure=!1),f.boundary==="scope")T(u,a,c);else if(f.boundary==="items")_(u,f,c),Y(u,a,c);else if(f.waits)b.add(f.waits);else{let h=Sn[f.boundary];h?h(S,u,f,a,c):f.wants&&d(f.wants,u)}return}!c.projection&&!c.view&&f.bind!=null&&L(u,f,c),_(u,f,c);for(let h=u.firstElementChild;h;h=h.nextElementSibling)V(h,a,c)}}function T(u,a,c){let f=u.getAttribute("scope"),h={};a[f]=h;let y={root:c.root,state:h,item:null,ownerEl:u,projection:c.projection};B(u,h,y)}function Y(u,a,c){p&&(p.pure=!1);let f=u.getAttribute("items"),h=[];a[f]=h,u._sapList=h;let y=!c.projection&&!c.view&&tn(),E=0;for(let N=u.firstElementChild;N;N=N.nextElementSibling){let x=K(N);if(!x.item||x.template||x.cms)continue;let w=y?nn(N):void 0;h.push(w&&w.plan===x&&Object.isExtensible(w.obj)&&A(w,N,E,c)||v(N,x,E,c,y)),E++}}function v(u,a,c,f,h){let y={};G(y,u,c);let E={root:f.root,state:f.state,item:y,ownerEl:u,projection:f.projection};if(!h)return B(u,y,E),y;let N=p,x={plan:a,obj:y,fields:null,presence:Ee,pending:Ee,collects:[],pure:!0},w=s.length,qe=e.diag.errors.length;p=x;try{B(u,y,E)}finally{p=N}if(!x.pure||e.halted||e.diag.errors.length!==qe)return y;let Q=[];for(let Z of Object.keys(y)){let Ge=y[Z];if(Ge!==null&&typeof Ge=="object")return y;Q.push(Z,Ge)}if(a.decls)for(let Z of a.decls)et(u,Z)&&(x.presence===Ee?x.presence=[]:x.presence).push(Z.name,Z.attr);return s.length>w&&(x.pending=s.slice(w)),x.collects.length||(x.collects=Ee),x.fields=Q,rn(u,x),y}function A(u,a,c,f){let h=u.obj;try{h.$index!==c&&Object.defineProperty(h,"$index",{value:c,enumerable:!1,configurable:!0});let N=u.presence;for(let w=0;w<N.length;w+=2)h[N[w]]=a.hasAttribute(N[w+1]);let x=u.fields;for(let w=0;w<x.length;w+=2)h[x[w]]=x[w+1]}catch{return De(a),null}a._sapScope=h;let y=u.pending;for(let N=0;N<y.length;N++)s.push(y[N]);let E=u.collects;if(E.length){let N={root:f.root,state:f.state,item:h,ownerEl:a,projection:f.projection};for(let x=0;x<E.length;x+=2)_(E[x],E[x+1],N)}return h}let S={app:e,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:k,collectEl:_,walkScope:j,changes:g,full:g===null,trigger:t.cause||t.trigger||"refresh",waiting:b,wanted:m};for(let u of U)u.begin&&u.begin(S);let P=t.cacheReads===!1?null:on(r);try{B(r,n,l)}finally{t.cacheReads!==!1&&sn(P)}if(e.halted||b.size)return S;for(let u of U)u.afterIntake&&u.afterIntake(S);if(s.length&&i.size)for(let u of s)i.has(u.attr)&&u.el.getAttribute(u.attr)==null&&u.el.setAttribute(u.attr,u.value);for(let u of U)u.compute&&u.compute(S);let C=0;for(let u of U)u.reconcile&&(C+=u.reconcile(S));let J=0,I=C;for(let u of o){let a=Sr(u,e);u.ctx.view?I+=a:J+=a}for(let u of U)u.afterPaint&&u.afterPaint(S);return e._state=n,e._stats={fields:Object.keys(n).filter(u=>typeof n[u]!="function").length,calcs:S.stats.calcs,paints:o.length,lists:S.stats.lists,writes:J,viewWrites:I},e._viewsChanged=I>0,e._lastPass={trigger:t.trigger||"refresh",writes:J},e._debug&&console.log(`sap pass \xB7 trigger: ${e._lastPass.trigger} \xB7 writes ${J}/${o.length}`),S}function vr(e){let t=e.kind==="text"?e.fmt||null:e.arg;return t==null?e.kind:e.kind+":"+t}function kr(e,t,r,n){let o=e;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(t)){let s=r.includes(o.getAttribute(t));if(n?!s:s)return!0}o=o.parentElement}return!1}function Sr(e,t){let r=e.def,n=e.el,o=Nn[r.kind];if(o)return o(e,t);if(r.kind==="when")return kn(r,n,null);try{let s=ye(r.entry,e.ctx.state,e.ctx.item,n,e.ctx.root),i=kn(r,n,s);return fe(n),i}catch(s){return t.diag.error(s.sapCode==="E22"?"E22":"E24",n,{attr:vr(r),expr:r.entry&&r.entry.src,problem:String(s.message)}),D(n,s.sapCode||"E24"),0}}function kn(e,t,r){switch(e.kind){case"text":{let n=e.fmt!=null?jt(e.fmt,r):r==null?"":String(r);return t.textContent!==n?(t.textContent=n,1):0}case"show":{let n=!r;return t.hidden!==n?(t.hidden=n,1):0}case"when":{let n=$("optionVisibility");if(n&&n._started)return t._sapWhen&&t.hidden?(t.hidden=!1,t._sapWhen=!1,1):0;t._sapWhen=!0;let o=kr(t,e.field,e.values,e.match==="show-not")===(e.match==="hide");return t.hidden!==o?(t.hidden=o,1):0}case"attr":{let n=e.arg;if((n==="checked"||n==="selected")&&typeof t[n]=="boolean"&&!t.hasAttribute("bind")&&!t.closest("select[bind]")){let s=0;return t[n]!==!!r&&(t[n]=!!r,s=1),!!r!==t.hasAttribute(n)&&(r?t.setAttribute(n,""):t.removeAttribute(n),s=1),s}if(xr.has(n)){let s=t.hasAttribute(n);return r&&!s?(t.setAttribute(n,""),1):!r&&s?(t.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return t.getAttribute(n)!==o?(t.setAttribute(n,o),1):0}case"class":{let n=!!r;return t.classList.contains(e.arg)!==n?(t.classList.toggle(e.arg,n),1):0}case"css":{let n=r==null?"":String(r);return t.style.getPropertyValue("--"+e.arg)!==n?(t.style.setProperty("--"+e.arg,n),1):0}default:return 0}}var Nr=new Set(ee),Rn=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),Tr=new Set(["show-when","hide-when","option","option-not"]),Rr=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,_n=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"]),gt=[];function Ue(e){gt.includes(e)||gt.push(e)}function _r(e){return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"}function bt(e){return e.hasAttribute("bind")}function $r(e,t){t(e);for(let n=e.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(t(n),!te(n))for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function $n(e,t){let r=!1,n=(i,g,b)=>{t.error(i,g,b),r=!0},o=e.ownerDocument.createTreeWalker(e,5,{acceptNode:i=>i.nodeType===3?1:te(i)||i.hasAttribute("bind")||i.hasAttribute("sap-ignore")?2:3}),s;for(;s=o.nextNode();)if(/\{\{.*\}\}/.test(s.nodeValue||"")){n("E02",s.parentElement||e,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return $r(e,i=>{let g=new Set;for(let m of gt)m(i,n,d=>g.add(d));let b=i.closest&&i.closest("[detail]");for(let m of[...i.attributes]){let d=m.name;if(g.has(d))continue;if(d.includes(":")){let p=d.slice(0,d.indexOf(":"));if(!Rn.has(p)&&!Je(d)){let k=Ke(p,[...Rn]);t.warn("W03",i,{attr:d,problem:`unknown "${p}:" attribute`,didYouMean:k?`${k}:`:null})}else if(Tr.has(p)&&Rr.test(m.value)){let k=d.slice(d.indexOf(":")+1);t.warn("W04",i,{attr:d,expr:m.value,problem:`${p}: compares the "${k}" attribute against a literal value, not a JS expression`,fix:`use show="${m.value}" for an expression, or a literal like ${p}:${k}="overview"`})}}else if(!_n.has(d)&&!Je(d)&&!Xe.has(d)&&!Nr.has(d)&&!/^(data-|aria-|on)/.test(d)&&!(d in i)){let p=Ke(d,[..._n]);p&&t.warn("W03",i,{attr:d,problem:`unknown "${d}" attribute`,didYouMean:p})}d==="attr:hidden"&&t.warn("W03",i,{attr:d,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let l=bt(i)||d==="attr:selected"&&i.tagName==="OPTION"&&!!i.closest("select[bind]");(d==="attr:value"||d==="attr:checked"||d==="attr:selected")&&l&&n("E30",i,{attr:d,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),d==="effect"&&bt(i)&&/\b(value|checked)\s*=[^=]/.test(m.value)&&n("E30",i,{attr:d,expr:m.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"}),(d==="text"||d.startsWith("text:")||d==="show")&&_r(i)&&(d==="show"||n("E18",i,{attr:d,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(i.hasAttribute("state")){let m=$e(i.getAttribute("state")),d=new Set;for(let l of m){l.name.includes("-")&&n("E08",i,{attr:"state",problem:`field "${l.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${l.name.replace(/-/g,"")}`}),d.has(l.name)&&n("E04",i,{attr:"state",problem:`field "${l.name}" is declared twice in one scope`}),d.add(l.name),Et.has(l.attr)&&n("E05",i,{attr:"state",problem:`"${l.name}" is a reserved Sap word`}),Xe.has(l.attr)&&n("E06",i,{attr:"state",problem:`"${l.name}" is a global HTML attribute name; pick another field name`}),l.name==="open"&&i.tagName==="DIALOG"&&n("E33",i,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let p=Ze(i,l.attr);p&&(l.attr==="checked"||l.attr==="selected")&&n("E35",i,{attr:"state",problem:`"${l.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&&l.type==="num"&&n("E35",i,{attr:"state",problem:`"${l.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${l.attr}"`}),l.transient&&(p||l.type==="presence")&&n("E35",i,{attr:"state",problem:`"${l.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(bt(i)){if(i.hasAttribute("-"),i.tagName==="INPUT"){let m=(i.getAttribute("type")||"text").toLowerCase();m==="file"&&n("E32",i,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),m==="password"&&!i.hasAttribute("transient")&&n("E31",i,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"){let m=i.getAttribute("contenteditable");!(m!=null&&m!=="false")&&i.children.length>0&&n("E20",i,{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(i.hasAttribute("transient")&&i.hasAttribute("persist")&&n("E34",i,{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"}),i.tagName==="DIALOG"&&i.hasAttribute("detail")&&!(i.parentElement&&i.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&t.warn("W31",i,{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'}),i.hasAttribute("item")&&!i.hasAttribute("template")&&i.parentNode&&i.parentNode.nodeType===1){let m=i.parentElement;(!m||!m.hasAttribute("items"))&&n("E10",i,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(i.hasAttribute("items")&&b&&n("E17",i,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),i.hasAttribute("items")){let m=e.querySelector(`[trigger-add="${i.getAttribute("items")}"]`);!Lt(i)&&!Qe(e,i.getAttribute("items"))&&$t(i).length===0&&m&&n("E17",i,{attr:"items",problem:`trigger-add targets items="${i.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(t.halted=!0,t.haltReason=t.errors[0]?t.errors[0].code:"halt",D(e,t.haltReason)),!r}var Ln="sap-styles",Pn="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",yt=new WeakSet;function Lr(e){if(yt.has(e))return;let t=e.defaultView,r=t&&t.CSSStyleSheet;if(r&&"adoptedStyleSheets"in e)try{let n=new r;n.replaceSync(Pn),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],yt.add(e);return}catch{}if(!e.getElementById(Ln)){let n=e.createElement("style");n.id=Ln,n.textContent=Pn,(e.head||e.documentElement).appendChild(n)}yt.add(e)}var Pr=0;function Cn(){return typeof performance<"u"&&performance.now?performance.now():0}function wt(e){let t=e.id||e.getAttribute("sap")||`app-${Pr++}`,r=new Ne(t),n={root:e,name:t,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!$n(e,r))return n.halted=!0,n;Lr(e.ownerDocument);for(let i of e.querySelectorAll("textarea[data-value]"))me(i)||Fe(i);let s=Cn();return ze(n,{trigger:"mount",full:!0}),n._mountMs=Cn()-s,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!dn()&&!$("derived")&&r.warn("W30",e,{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 Cr=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Or(e){return`${e.tagName.toLowerCase()}[sap]`}function Mr(e){let t={actions:0,lists:0,rows:0};return O(e,r=>{r.hasAttribute("items")&&t.lists++,r!==e&&r.hasAttribute("item")&&!r.hasAttribute("template")&&t.rows++,[...r.attributes].some(n=>Cr.test(n.name))&&t.actions++}),t}function On(e){function t(i){let g=i._stats||{},b=i.root;return{root:Or(b),fields:g.fields||0,calcs:g.calcs||0,paints:g.paints||0,...Mr(b),warnings:i.diag.warnings.length,errors:i.diag.errors.length,mountWrites:i._mountWrites||0,ms:Math.round((i._mountMs||0)*10)/10,passes:i._passes||0,lastPass:i._lastPass||null,ok:i.diag.errors.length===0&&!i.halted}}function r(){let i=e.apps().map(t);return{ok:i.every(g=>g.ok),apps:i}}function n(i){let g=t(i);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 i=[],g=[];for(let b of e.apps())i.push(...b.diag.errors),g.push(...b.diag.warnings);return{ok:i.length===0,errors:i,warnings:g,counts:{errors:i.length,warnings:g.length}}}function s(i){let g=i===void 0?!0:!!i;for(let b of e.apps())b._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:s,greenLine:n}}var ve="0.9.0";var Mn={};var Ir=/^(https:\/\/(?:cdn\.jsdelivr\.net\/npm|unpkg\.com)\/@panphora\/sapjs)(?=[@/]|$)/,In=e=>new Promise(t=>setTimeout(t,e)),Dn=e=>e.getAttribute("plugins")?.match(/\S+/g)||[];function Fn(e,t,r){let n=new Map,o=new Map,s=new Map,i=new Map,g=[],b=new Set,m={},d=!1,l,p=globalThis,k=Array.isArray(p.sapPlugins)?p.sapPlugins:p.sapPlugins==null?p.sapPlugins=[]:[],R=p.document?.currentScript?.src||"",L=Ir.exec(R),_=a=>o.get(a)?.api||null,G=a=>Promise.allSettled(a.map(C));function B(){let a=new Map;for(let c of n.values())if(!o.has(c.name))for(let f of c.helpers||[])a.set(f,c.name);zt(m,a),Ie()}function j(a){n.set(a.name,{...n.get(a.name),...a}),kt(a),B()}function V(a){n.has(a.name)||j(a)}function T(a){k.includes(a)||k.push(a),j(a)}function Y(a){for(let c of e.apps())c.root.isConnected&&e.schedule(c,a)}let v=Object.freeze({api:1,version:ve,compile:Ce,run:Vt,runWith:ye,planOf:K,drainPlans:Qt,forgetRow:De,setBeacon:D,clearBeacon:fe,write:ce,schedule(a,c="plugin"){let f=a?.root?a:e.appFor(a);f&&e.schedule(f,c)},appFor:e.appFor,apps:e.apps,capability:$,mayWrite:ae,load:C,plugin:_});function A(a){if(typeof a=="string")return C(a);let{name:c,api:f}=a,h=w=>{throw new Error(`Sap.use: plugin "${c}" ${w}`)};if((typeof c!="string"||f!==1)&&h(`needs a name and plugin API ${1}; it gives API ${f}`),d)return null;if(o.has(c))return _(c);if((a.requires||[]).some(w=>!o.has(w)))return T(a),g.includes(a)||g.push(a),null;let y=a.setup?.(v)||{},E=(w,qe)=>{for(let Q of Array.isArray(a[w])?a[w]:Object.keys(a[w]||{}))(typeof(y[w]||{})[Q]!="function"||qe(Q))&&h(`cannot add "${Q}" to ${w}: the name is taken or not valid, or setup does not supply it`)},N=w=>!Re(w,c);E("helpers",w=>(it(w)&&h(`cannot add "${w}": window.${w} exists; rename the helper`),!Ut(w)||w in m)),E("boundaries",N),E("directives",N);for(let w in y.api)w in t&&h(`cannot add Sap.${w}: the name is taken`);T(a);let x={...y,name:c,order:a.order,boundary:{}};for(let w in a.boundaries)x.boundary[w]=y.boundaries[w];for(let w of a.helpers||[])m[w]=y.helpers[w];for(let w in y.formats)w in H||(H[w]=y.formats[w]);return He(x),y.lint&&Ue(y.lint),Object.assign(t,y.api),o.set(c,x),i.delete(c),St(c,y.directives||!0),B(),ce(()=>b.forEach(fe)),b.clear(),g.splice(0).forEach(S),Y("plugin:"+c),_(c)}function S(a){try{A(a)}catch(c){console.error(c)}}function P(a){if(d||o.has(a))return null;let c=n.get(a)||{},f=I.loader?.(a,c),h=c.url||I.base&&I.base+(c.file||a)+".js";return(f!==void 0?Promise.resolve(f):new Promise((E,N)=>{if(!h)throw new Error(`no address for plugin "${a}": call Sap.use(definition)`);let x=document.createElement("script");x.src=h,x.setAttribute("clay","editor-ui"),x.onload=x.onerror=w=>{x.remove(),w.type==="load"?E():N(new Error("could not load "+h))},document.head.append(x)})).then(E=>{if(d)return;let N=E?.default||E||k.find(x=>x.name===a);if(N?.name&&A(N),!o.has(a))throw new Error(`plugin "${a}" loaded and did not register`)})}function C(a){if(o.has(a))return Promise.resolve(_(a));if(s.has(a))return s.get(a);i.delete(a);let c=Promise.all((n.get(a)?.requires||[]).map(C)).then(()=>P(a));for(let h of I.retryDelays)c=c.catch(()=>In(h).then(()=>P(a)));let f=c.finally(()=>s.delete(a)).then(()=>_(a),h=>{throw i.set(a,h),l||=!p.addEventListener?.("online",()=>I.retry()),Y("plugin-failed:"+a),document.dispatchEvent(new CustomEvent("sap:plugin-failed",{detail:{plugin:a,error:h}})),h});return s.set(a,f),f}function J(a){let c=new Set;for(let f of a.closest?.("[sap]")?[a]:a.querySelectorAll("[sap]")){for(let h of Dn(f.closest("[sap]")))c.add(h);n.size>o.size&&O(f,h=>{let y=K(h);return y.inert?!1:(y.wants?.map(E=>c.add(E)),!!c.add(y.waits))})}return[...c].filter(f=>f&&!o.has(f))}Tn((a,c)=>{for(let f of new Set([...c.wanted.keys(),...c.waiting,...Dn(a.root)])){if(o.has(f))continue;let h=i.get(f);if(!h)C(f).catch(()=>{});else{let y=c.wanted.get(f)?.[0]||a.root;a.diag.error("E52",y,{problem:`the "${f}" plugin did not load: ${h.message}`,fix:"Sap.plugins.retry() tries again"}),b.add(y),ce(()=>D(y,"E52"))}}});let I={api:1,base:L?`${L[1]}@${ve}/dist/sap-plugins/`:/^[^:]+:\//.test(R)?new URL("sap-plugins/",R).href:null,loader:null,retryDelays:[1e3,4e3],declare:V,load:C,ready(a=document,c=3e3){let f=new Set,h=()=>{let E=J(a).filter(N=>!f.has(N)&&f.add(N));return E.length&&G(E).then(h)},y=h();return y?Promise.race([y,In(c)]):null},has:a=>o.has(a),status:()=>({installed:[...o.keys()],loading:[...s.keys()],failed:[...i.keys()]}),retry:a=>G(a?[a]:[...i.keys()])};function u(){let a=[],c=()=>(vn(),r.flushNow()),f=[...o.values()].filter(h=>h.flush);c();for(let h=0;f.length&&h<8;h++){for(let y of f){let E=y.flush();E?.then&&a.push(E)}if(!c())break}return a.length?Promise.all(a).then(u):null}t.use=A,t.plugins=I,t.flush=u;for(let a of Object.values(Mn))V(a);return k.slice().forEach(S),function(){d=!0;for(let c of o.values())c.dispose?.();o.clear(),i.clear()}}function Bn({createAccessor:e,installInput:t,debugExtras:r}){let n=new Map,o=[],s=xt(ze);function i(v){let A=v;for(;A;){if(A.nodeType===1&&A.hasAttribute&&A.hasAttribute("sap"))return n.get(A)||null;A=A.parentNode&&A.parentNode.host?A.parentNode.host:A.parentElement}return null}function g(){for(let v=o.length-1;v>=0;v--){let A=o[v];A.root.isConnected||(n.delete(A.root),o.splice(v,1))}}function b(v,A){if(v.moveBefore)try{v.moveBefore(A,null);return}catch{}v.appendChild(A)}function m(v,A){let S=A.parentElement;if(S){if(S.moveBefore)try{S.moveBefore(v,A);return}catch{}S.insertBefore(v,A)}}let d={apps:()=>o.slice(),appFor:i,isRegistered:v=>n.has(v),pruneDisconnected:g,schedule:s.schedule,runNow:(v,A)=>s.runNow(v,A),moveInto:b,placeBefore:m,remountIfPresent:()=>j()},l=e(d),p=On(d),k=r?r(d,p):{},R=!1,L=!1,_=null;function G(){R||(R=!0,t(d,l,document),_=bn(d))}function B(){let v=$("derived");v&&typeof v.mounted=="function"&&v.mounted()}function j(v=document){if(L)return[];G(),pt(d);let A=v.querySelectorAll("[sap]"),S=[];for(let P of A){if(n.has(P)||me(P))continue;let C=wt(P);n.set(P,C),o.push(C),S.push(C)}for(let P of S){let C=p.greenLine(P);P.diag.errors.length||P.halted?console.error(C):console.log(C)}return B(),S}function V(v){if(L)return null;if(G(),pt(d),!v)return j();let A=typeof v=="string"?document.querySelector(v):v;if(!A)return null;if(n.has(A))return n.get(A);let S=wt(A);n.set(A,S),o.push(S);let P=p.greenLine(S);return S.diag.errors.length||S.halted?console.error(P):console.log(P),S}let T=l.Sap;T.version=ve,T.refresh=function(){for(let A of o.slice())A.root.isConnected&&s.runNow(A,"refresh")},T.batch=hn,T.status=p.status,T.report=p.report,T.why=k.why,T.debug=p.debug,T.doctor=k.doctor,T.greenLine=p.greenLine,T.formats=H,T.serializeControlToAttributes=se,T.finalizeControlForSave=fn,T.rehydrateControlFromAttributes=Fe,T.mount=V,T.config=function(A={}){return A.formats&&Object.assign(H,A.formats),T},T._registry=n,T._reset=function(){n.clear(),o.length=0,mt()},T.unmount=function(){L=!0,n.clear(),o.length=0,mt(),typeof _=="function"&&_(),Y()};let Y=Fn(d,T,s);return{Sap:T,mountAll:j,mount:V,runtime:d}}function jn(e){if(typeof document>"u")return;let t=()=>pn(()=>e());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}function Wn(e){let t=[];function r(b){let m=b.target;if(!m||m.nodeType!==1)return;let d=e.appFor(m);if(d){m.hasAttribute("persist")&&!Be(m)&&ae(m)&&se(m);for(let l of t)if(l(m,d))return;e.schedule(d,b.type+" "+(m.id||m.tagName.toLowerCase()))}}function n(b){let m=b.target,d=e.appFor(m);d&&[...m.querySelectorAll("[bind]")].every(l=>ae(l))&&setTimeout(()=>{m.querySelectorAll("[bind]").forEach(l=>{l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0}))}),e.schedule(d,"reset")},0)}function o(b){let m=e.appFor(b.target);m&&e.schedule(m,"toggle")}function s(b){let m=b.detail||{};for(let d of[m.from,m.to,b.target]){if(!d||d.nodeType!==1)continue;let l=e.appFor(d);l&&e.schedule(l,"sorted")}}function i(b){if(b.key!=="ArrowUp"&&b.key!=="ArrowDown")return;let m=b.target;if(!m||m.nodeType!==1||m.tagName!=="INPUT"||!m.hasAttribute("bind")||!m.hasAttribute("step"))return;let d=(m.getAttribute("type")||"text").toLowerCase();if(d!=="text"&&d!=="tel"&&d!=="search"||!e.appFor(m)||!ae(m))return;b.preventDefault();let p=M(m.getAttribute("step"))||1,k=b.key==="ArrowUp"?1:-1,R=M(m.value)+p*(b.shiftKey?10:1)*k,L=m.getAttribute("min"),_=m.getAttribute("max");L!==null&&L!==""&&R<M(L)&&(R=M(L)),_!==null&&_!==""&&R>M(_)&&(R=M(_)),An(m).write(String(Number(R.toFixed(2))))}function g(b=document){b.addEventListener("reset",n),b.addEventListener("toggle",o,!0),b.addEventListener("input",r),b.addEventListener("change",r),b.addEventListener("clay:sorted",s),b.addEventListener("keydown",i)}return{install:g,addRouter:b=>t.push(b)}}var ke="https://clayjs.com/v1/sap.js",Dr=/^(calc|set|move|sort):/,Fr=new Set(["each","detail","effect","invalid","confirm","trigger-add","trigger-remove","trigger-reset"]);function At(e){return Dr.test(e)||Fr.has(e)}Ue((e,t)=>{for(let r of e.attributes)At(r.name)&&t("E50",e,{attr:r.name,expr:r.value,problem:`${r.name} is full sapjs; the sapjs core only paints declared state`,fix:`load ${ke}; the markup stays as it is`})});function le(e,t,r){e.app.diag.error("E50",t,{attr:r,problem:`${r} is full sapjs; the sapjs core only paints declared state`,fix:`load ${ke}; the markup stays as it is`}),D(t,"E50"),e.app.halted=!0}He({name:"core-only",collect(e,t,r){r.calcs&&le(e,t,"calc:"+r.calcs[0].name),r.effects&&le(e,t,"effect"),r.invalids&&le(e,t,"invalid");for(let n of t.attributes)At(n.name)&&(n.name.startsWith("calc:")&&r.calcs||n.name==="effect"&&r.effects||n.name==="invalid"&&r.invalids||le(e,t,n.name));return!1},boundary:{each(e,t){le(e,t,"each")},detail(e,t){le(e,t,"detail")}}});function Br(){return{Sap:function(){throw new Error(`Sap(el) is full sapjs; load ${ke}`)}}}var Hn=e=>()=>(console.warn(`Sap.${e} is full sapjs; load ${ke}`),null),{Sap:Se,mountAll:zn,mount:jr,runtime:Wr}=Bn({createAccessor:Br,debugExtras:()=>({why:Hn("why"),doctor:Hn("doctor")}),installInput(e,t,r){Wn(e).install(r)}});Se.core=!0;var Hr=typeof window<"u"&&window.Sap&&!window.Sap.core;Hr?Se.unmount():jn(zn);typeof window<"u"&&!window.Sap&&(window.Sap=Se);var zr=Se;return Xn(Ur);})();
|
|
9
|
+
`+t.value:t.value;e.textContent!==n&&(e.textContent=n),e.removeAttribute("data-value");return}if(r==="SELECT"){let n=e.options,o=t.options;for(let s=0;s<n.length;s++)o[s]&&o[s].selected?n[s].hasAttribute("selected")||n[s].setAttribute("selected",""):n[s].removeAttribute("selected")}}function Fe(e){e.tagName!=="TEXTAREA"||!e.hasAttribute("data-value")||e!==e.ownerDocument.activeElement&&(e.textContent=e.getAttribute("data-value"),e.removeAttribute("data-value"))}function $(e){if(typeof window>"u")return null;let t=window.clay,r=window.hyperclay;return e==="consent"?t?.confirm||r?.consent||null:t?.[e]||r?.[e]||null}function pn(){let e=$("visitorDrafts");return!!(e&&typeof e.restored=="function"&&e.restored()?.restored)}var ut=["clay:mutation-ready","hyperclay:mutation-ready"],dr=["clay:sync-applied","hyperclay:livesync-applied"],pr=["clay:ready","hyperclay:ready"],mr=["clay:route"],hr=["clay:modechange"];function Ae(e,t,r){let n=null,o=s=>{n!==null&&n!==s.type||(n=s.type,queueMicrotask(()=>{n=null}),r(s))};for(let s of t)e.addEventListener(s,o);return()=>{for(let s of t)e.removeEventListener(s,o)}}function mn(e){let t=typeof window<"u"&&window.clay&&window.clay.ready;t&&typeof t.then=="function"?t.then(()=>e(),()=>e()):e()}function Be(e){let t=$("region");return!t||typeof t.resolveRegionPolicy!="function"||typeof t.skipForPolicy!="function"?!1:t.skipForPolicy(t.resolveRegionPolicy(e),void 0,["no-save","freeze"])}function hn(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function ae(e,{transient:t=!1}={}){if(t)return!0;let r=hn();return typeof r?.canWrite!="function"||$("region")?.resolveRegionPolicy?.(e)?.persist==="none"?!0:r.canWrite()}function bn(e,t){if(typeof t!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=$("undo");r&&r.flush&&r.flush();let n=t();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(e),n}function gn(e){if(typeof window>"u"||typeof document>"u")return;let t=()=>{let p=!1;for(let k of e.apps())k.root.isConnected?e.runNow(k,"platform"):p=!0;p&&e.pruneDisconnected(),e.remountIfPresent()},r=$("derived"),n=r&&typeof r.register=="function"?r.register(t):null,o=typeof n=="function"?null:Ae(document,dr,t),s=Ae(document,mr,t),i=null,g=!1,b=()=>{let p=i;i=null,p&&(p[2](),p[3]())},m=()=>{if(g)return!1;let p=$("undo"),k=hn()?.state?.generation;if(i&&i[0]===p&&i[1]===k)return!0;if(b(),!p||typeof p.on!="function")return!1;let R=p.on("undo",t);if(typeof R!="function")return!1;let L=p.on("redo",t);return typeof L!="function"?(R(),!1):(i=[p,k,R,L],!0)};m();let d=[ut,pr,hr].map(p=>Ae(document,p,m)),l=$("ready");return l&&typeof l.then=="function"&&l.then(m,()=>{}),()=>{g=!0,typeof n=="function"&&n(),o&&o(),s();for(let p of d)p();b()}}function ct(e){let t=e.tagName;if(t==="INPUT"){let r=(e.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return t==="TEXTAREA"?"text":t==="SELECT"?e.multiple?"select-multiple":"select-one":"leaf"}function br(e){if(e.validity&&e.validity.badInput)return e.hasAttribute("value")?Number(e.getAttribute("value"))||0:e._sapLastGood??0;if(e.value==="")return 0;let t=Number(e.value);return Number.isNaN(t)?e._sapLastGood??0:(e._sapLastGood=t,t)}function wn(e,t){switch(t){case"checkbox":return e.checked;case"radio":return e.checked?e.value:void 0;case"number":return br(e);case"select-one":return e.value;case"select-multiple":return[...e.selectedOptions].map(r=>r.value);case"hidden":case"text":return e.value;case"leaf":return e.textContent;default:return e.value}}function gr(e,t,r){switch(t){case"checkbox":e.checked=!!r;break;case"radio":e.checked=String(e.value)===String(r);break;case"number":case"text":case"hidden":e.value=r==null?"":String(r);break;case"select-one":e.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of e.options)o.selected=n.has(o.value);break}case"leaf":e.textContent=r==null?"":String(r);break;default:e.value=r==null?"":String(r)}}function yn(e){if(e.hasAttribute("transient")){e.removeAttribute("value"),e.removeAttribute("checked"),e.removeAttribute("data-value");return}Be(e)||se(e)}function yr(e){e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function An(e,t){return wn(e,t)}function xn(e){let t=ct(e);return{el:e,kind:t,read(){return wn(e,t)},write(r,n={}){gr(e,t,r),n.noMirror||yn(e),n.silent||yr(e)},mirror(){yn(e)}}}var wr=[],F=null,je=0,ft=null,We=!1,ue=null;function En(e){let t=null;return{kind:"hub",flush(){e.pause(),e.resume()},subscribe(r){let n=e.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(t=n)},suppress(r){e.pause();try{return r()}finally{e.resume()}},teardown(){if(t){try{t()}catch{}t=null}}}}function Ar(){let e=null,t=null;function r(){let n=e?e.takeRecords():wr;n.length&&t(vn(n))}return{kind:"native",flush:r,subscribe(n){t=n,e=new MutationObserver(s=>n(vn(s)));let o=document.body||document.documentElement;o&&e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(n,o){let s=$("undo");o&&r(),s&&s.pause&&s.pause();try{return n()}finally{e&&e.takeRecords(),s&&s.resume&&s.resume()}},teardown(){e&&(e.disconnect(),e=null)}}}function vn(e){let t=[];for(let r of e)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!xe(n)&&t.push({type:"attribute",element:n,attribute:r.attributeName})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!xe(n)&&t.push({type:"characterData",element:n})}else if(r.type==="childList"){let n=r.target;n.nodeType===1&&[...r.addedNodes,...r.removedNodes].some(s=>s.nodeType===3)&&!xe(n)&&t.push({type:"characterData",element:n});let o=r.addedNodes.length>0&&n.nodeType===1&&ne(n);for(let s of r.addedNodes)s.nodeType!==1||xe(s)||(o?t.push({type:"add",element:s,parent:n}):O(s,i=>{(i===s||!xe(i))&&t.push({type:"add",element:i,parent:n})}));for(let s of r.removedNodes)s.nodeType===1&&t.push({type:"remove",element:s,parent:n})}return t}function xe(e){return!!(e.closest&&e.closest("[sap-ignore],[template],[cms-template]"))}function xr(e,t){e.pruneDisconnected();let r=new Map,n=!1;for(let o of t){let s=o.type==="remove"?o.parent:o.element,i=s&&e.appFor(s);if(i){let g=r.get(i);g?g.push(o):r.set(i,[o])}o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(e.isRegistered&&e.isRegistered(o.element))&&(n=!0)}n&&(ft=e.remountIfPresent,je?queueMicrotask(dt):dt());for(let[o,s]of r)o.root.isConnected&&e.schedule(o,"mutation",s)}function dt(){let e=ft;ft=null,e?.()}function ce(e){if(F){let r=!je++;try{return F.suppress(e,r)}finally{je--}}let t=$("undo");if(t&&t.pause&&t.resume){t.pause();try{return e()}finally{t.resume()}}return e()}function lt(e,t){We=!0,F=e,e.subscribe(r=>xr(t,r))}function pt(e){if(We||typeof window>"u"||typeof document>"u")return;let t=$("Mutation");if(t&&typeof t.onAnyChange=="function"){lt(En(t),e);return}typeof MutationObserver=="function"&&(lt(Ar(),e),ue=Ae(document,ut,function(){let n=$("Mutation");n&&(ue(),ue=null,F&&F.teardown(),We=!1,lt(En(n),e))}))}function mt(){if(F)try{F.teardown()}catch{}ue&&typeof document<"u"&&ue(),F=null,We=!1,ue=null}function kn(){je||(F&&F.flush(),dt())}var Er=new Set(ee),Ee=Object.freeze([]),z=[],Nn={},Tn={},ht=null;function He(e){z.includes(e)||(z.push(e),z.sort((t,r)=>(t.order??100)-(r.order??100)),e.boundary&&Object.assign(Nn,e.boundary),e.paintKinds&&Object.assign(Tn,e.paintKinds))}function Rn(e){ht=e}function ze(e,t={}){if(t.breaker){e.diag.error("E26",e.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(e._breakerRing||[]).join(", ")}),D(e.root,"loop");return}t.full&&(Ie(),tn()),e._inPass=!0;let r=Jt(e.root),n=null;try{ce(()=>{n=vr(e,t)})}finally{e._inPass=!1,Qt(r)}ht&&n&&ht(e,n),e._viewsChanged&&(e._viewsChanged=!1,e.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function vr(e,t){let r=e.root,n={},o=[],s=[],i=new Set;e.diag.errors=[];let g=t.full||e._changes===!1?null:e._changes||Ee;e._changes=null;let b=new Set,m=new Map,d=(u,a)=>u.map(c=>m.get(c)?.push(a)??m.set(c,[a])),l={root:n,state:n,item:null,ownerEl:r,projection:!1},p=null;function k(u,a,c=!1){let f=a.attr||a.name,h=c?cn(u,f):u.getAttribute(f);return h==null&&(h=tt(a),s.push({el:u,name:a.name,attr:f,value:Pt(Le(h,a.type),a.type)})),Le(h,a.type)}function R(u,a,c,f){let h=a.decls;if(!h)return;let y=!!f.item&&!f.projection&&!f.view;for(let E of h){if(E.transient){p&&(p.pure=!1),c[E.name]=Ct(u,E);continue}if(et(u,E)){c[E.name]=u.hasAttribute(E.attr);continue}c[E.name]=k(u,E,y)}}function L(u,a,c){let f=a.bind,h=c.item||c.state,y=ct(u);p&&(y!=="leaf"||a.transient)&&(p.pure=!1),y==="radio"?(f in h||(h[f]=""),u.checked&&(h[f]=u.value)):y==="leaf"&&c.item&&!c.projection&&!c.view?h[f]=ln(u):h[f]=An(u,y),a.transient&&(u.removeAttribute("value"),u.removeAttribute("checked"))}function _(u,a,c){let f=!1;if(a.waits&&b.add(a.waits),a.wants&&(d(a.wants,u),f=!0),p&&a.impure&&(p.pure=!1),a.paints){f=!0;for(let h of a.paints)h.kind==="when"&&i.add(h.field),o.push({def:h,el:u,ctx:c})}for(let h of z)h.collect&&h.collect(S,u,a,c)!==!1&&(f=!0);p&&f&&(a.calcs&&(p.pure=!1),p.collects.push(u,a))}function G(u,a,c){Object.defineProperty(u,"$key",{value:_t(a,"row"),enumerable:!1}),Object.defineProperty(u,"$index",{value:c,enumerable:!1,configurable:!0}),Object.defineProperty(u,"$el",{value:a,enumerable:!1})}function B(u,a,c){let f=K(u);R(u,f,a,c),u._sapScope=a,!c.projection&&f.bind!=null&&L(u,f,c),_(u,f,c),f.items?Y(u,a,c):j(u,a,c)}function j(u,a,c){for(let f=u.firstElementChild;f;f=f.nextElementSibling)U(f,a,c)}function U(u,a,c){let f=K(u);if(!f.inert){if(f.boundary){if(p&&(p.pure=!1),f.boundary==="scope")T(u,a,c);else if(f.boundary==="items")_(u,f,c),Y(u,a,c);else if(f.waits)b.add(f.waits);else{let h=Nn[f.boundary];h?h(S,u,f,a,c):f.wants&&d(f.wants,u)}return}!c.projection&&!c.view&&f.bind!=null&&L(u,f,c),_(u,f,c);for(let h=u.firstElementChild;h;h=h.nextElementSibling)U(h,a,c)}}function T(u,a,c){let f=u.getAttribute("scope"),h={};a[f]=h;let y={root:c.root,state:h,item:null,ownerEl:u,projection:c.projection};B(u,h,y)}function Y(u,a,c){p&&(p.pure=!1);let f=u.getAttribute("items"),h=[];a[f]=h,u._sapList=h;let y=!c.projection&&!c.view&&nn(),E=0;for(let N=u.firstElementChild;N;N=N.nextElementSibling){let x=K(N);if(!x.item||x.template||x.cms)continue;let w=y?rn(N):void 0;h.push(w&&w.plan===x&&Object.isExtensible(w.obj)&&A(w,N,E,c)||v(N,x,E,c,y)),E++}}function v(u,a,c,f,h){let y={};G(y,u,c);let E={root:f.root,state:f.state,item:y,ownerEl:u,projection:f.projection};if(!h)return B(u,y,E),y;let N=p,x={plan:a,obj:y,fields:null,presence:Ee,pending:Ee,collects:[],pure:!0},w=s.length,qe=e.diag.errors.length;p=x;try{B(u,y,E)}finally{p=N}if(!x.pure||e.halted||e.diag.errors.length!==qe)return y;let Q=[];for(let Z of Object.keys(y)){let Ge=y[Z];if(Ge!==null&&typeof Ge=="object")return y;Q.push(Z,Ge)}if(a.decls)for(let Z of a.decls)et(u,Z)&&(x.presence===Ee?x.presence=[]:x.presence).push(Z.name,Z.attr);return s.length>w&&(x.pending=s.slice(w)),x.collects.length||(x.collects=Ee),x.fields=Q,on(u,x),y}function A(u,a,c,f){let h=u.obj;try{h.$index!==c&&Object.defineProperty(h,"$index",{value:c,enumerable:!1,configurable:!0});let N=u.presence;for(let w=0;w<N.length;w+=2)h[N[w]]=a.hasAttribute(N[w+1]);let x=u.fields;for(let w=0;w<x.length;w+=2)h[x[w]]=x[w+1]}catch{return De(a),null}a._sapScope=h;let y=u.pending;for(let N=0;N<y.length;N++)s.push(y[N]);let E=u.collects;if(E.length){let N={root:f.root,state:f.state,item:h,ownerEl:a,projection:f.projection};for(let x=0;x<E.length;x+=2)_(E[x],E[x+1],N)}return h}let S={app:e,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:k,collectEl:_,walkScope:j,changes:g,full:g===null,trigger:t.cause||t.trigger||"refresh",waiting:b,wanted:m};for(let u of z)u.begin&&u.begin(S);let P=t.cacheReads===!1?null:sn(r);try{B(r,n,l)}finally{t.cacheReads!==!1&&an(P)}if(e.halted||b.size)return S;for(let u of z)u.afterIntake&&u.afterIntake(S);if(s.length&&i.size)for(let u of s)i.has(u.attr)&&u.el.getAttribute(u.attr)==null&&u.el.setAttribute(u.attr,u.value);for(let u of z)u.compute&&u.compute(S);let C=0;for(let u of z)u.reconcile&&(C+=u.reconcile(S));let J=0,I=C;for(let u of o){let a=Nr(u,e);u.ctx.view?I+=a:J+=a}for(let u of z)u.afterPaint&&u.afterPaint(S);return e._state=n,e._stats={fields:Object.keys(n).filter(u=>typeof n[u]!="function").length,calcs:S.stats.calcs,paints:o.length,lists:S.stats.lists,writes:J,viewWrites:I},e._viewsChanged=I>0,e._lastPass={trigger:t.trigger||"refresh",writes:J},e._debug&&console.log(`sap pass \xB7 trigger: ${e._lastPass.trigger} \xB7 writes ${J}/${o.length}`),S}function kr(e){let t=e.kind==="text"?e.fmt||null:e.arg;return t==null?e.kind:e.kind+":"+t}function Sr(e,t,r,n){let o=e;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(t)){let s=r.includes(o.getAttribute(t));if(n?!s:s)return!0}o=o.parentElement}return!1}function Nr(e,t){let r=e.def,n=e.el,o=Tn[r.kind];if(o)return o(e,t);if(r.kind==="when")return Sn(r,n,null);try{let s=ye(r.entry,e.ctx.state,e.ctx.item,n,e.ctx.root),i=Sn(r,n,s);return fe(n),i}catch(s){return t.diag.error(s.sapCode==="E22"?"E22":"E24",n,{attr:kr(r),expr:r.entry&&r.entry.src,problem:String(s.message)}),D(n,s.sapCode||"E24"),0}}function Sn(e,t,r){switch(e.kind){case"text":{let n=e.fmt!=null?Wt(e.fmt,r):r==null?"":String(r);return t.textContent!==n?(t.textContent=n,1):0}case"show":{let n=!r;return t.hidden!==n?(t.hidden=n,1):0}case"when":{let n=$("optionVisibility");if(n&&n._started)return t._sapWhen&&t.hidden?(t.hidden=!1,t._sapWhen=!1,1):0;t._sapWhen=!0;let o=Sr(t,e.field,e.values,e.match==="show-not")===(e.match==="hide");return t.hidden!==o?(t.hidden=o,1):0}case"attr":{let n=e.arg;if((n==="checked"||n==="selected")&&typeof t[n]=="boolean"&&!t.hasAttribute("bind")&&!t.closest("select[bind]")){let s=0;return t[n]!==!!r&&(t[n]=!!r,s=1),!!r!==t.hasAttribute(n)&&(r?t.setAttribute(n,""):t.removeAttribute(n),s=1),s}if(Er.has(n)){let s=t.hasAttribute(n);return r&&!s?(t.setAttribute(n,""),1):!r&&s?(t.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return t.getAttribute(n)!==o?(t.setAttribute(n,o),1):0}case"class":{let n=!!r;return t.classList.contains(e.arg)!==n?(t.classList.toggle(e.arg,n),1):0}case"css":{let n=r==null?"":String(r);return t.style.getPropertyValue("--"+e.arg)!==n?(t.style.setProperty("--"+e.arg,n),1):0}default:return 0}}var Tr=new Set(ee),_n=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),Rr=new Set(["show-when","hide-when","option","option-not"]),_r=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,$n=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"]),gt=[];function Ue(e){gt.includes(e)||gt.push(e)}function $r(e){return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"}function bt(e){return e.hasAttribute("bind")}function Lr(e,t){t(e);for(let n=e.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(t(n),!te(n))for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function Ln(e,t){let r=!1,n=(i,g,b)=>{t.error(i,g,b),r=!0},o=e.ownerDocument.createTreeWalker(e,5,{acceptNode:i=>i.nodeType===3?1:te(i)||i.hasAttribute("bind")||i.hasAttribute("sap-ignore")?2:3}),s;for(;s=o.nextNode();)if(/\{\{.*\}\}/.test(s.nodeValue||"")){n("E02",s.parentElement||e,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Lr(e,i=>{let g=new Set;for(let m of gt)m(i,n,d=>g.add(d));let b=i.closest&&i.closest("[detail]");for(let m of[...i.attributes]){let d=m.name;if(g.has(d))continue;if(d.includes(":")){let p=d.slice(0,d.indexOf(":"));if(!_n.has(p)&&!Je(d)){let k=Ke(p,[..._n]);t.warn("W03",i,{attr:d,problem:`unknown "${p}:" attribute`,didYouMean:k?`${k}:`:null})}else if(Rr.has(p)&&_r.test(m.value)){let k=d.slice(d.indexOf(":")+1);t.warn("W04",i,{attr:d,expr:m.value,problem:`${p}: compares the "${k}" attribute against a literal value, not a JS expression`,fix:`use show="${m.value}" for an expression, or a literal like ${p}:${k}="overview"`})}}else if(!$n.has(d)&&!Je(d)&&!Xe.has(d)&&!Tr.has(d)&&!/^(data-|aria-|on)/.test(d)&&!(d in i)){let p=Ke(d,[...$n]);p&&t.warn("W03",i,{attr:d,problem:`unknown "${d}" attribute`,didYouMean:p})}d==="attr:hidden"&&t.warn("W03",i,{attr:d,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let l=bt(i)||d==="attr:selected"&&i.tagName==="OPTION"&&!!i.closest("select[bind]");(d==="attr:value"||d==="attr:checked"||d==="attr:selected")&&l&&n("E30",i,{attr:d,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),d==="effect"&&bt(i)&&/\b(value|checked)\s*=[^=]/.test(m.value)&&n("E30",i,{attr:d,expr:m.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"}),(d==="text"||d.startsWith("text:")||d==="show")&&$r(i)&&(d==="show"||n("E18",i,{attr:d,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(i.hasAttribute("state")){let m=$e(i.getAttribute("state")),d=new Set;for(let l of m){l.name.includes("-")&&n("E08",i,{attr:"state",problem:`field "${l.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${l.name.replace(/-/g,"")}`}),d.has(l.name)&&n("E04",i,{attr:"state",problem:`field "${l.name}" is declared twice in one scope`}),d.add(l.name),Et.has(l.attr)&&n("E05",i,{attr:"state",problem:`"${l.name}" is a reserved Sap word`}),Xe.has(l.attr)&&n("E06",i,{attr:"state",problem:`"${l.name}" is a global HTML attribute name; pick another field name`}),l.name==="open"&&i.tagName==="DIALOG"&&n("E33",i,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let p=Ze(i,l.attr);p&&(l.attr==="checked"||l.attr==="selected")&&n("E35",i,{attr:"state",problem:`"${l.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&&l.type==="num"&&n("E35",i,{attr:"state",problem:`"${l.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${l.attr}"`}),l.transient&&(p||l.type==="presence")&&n("E35",i,{attr:"state",problem:`"${l.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(bt(i)){if(i.hasAttribute("-"),i.tagName==="INPUT"){let m=(i.getAttribute("type")||"text").toLowerCase();m==="file"&&n("E32",i,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),m==="password"&&!i.hasAttribute("transient")&&n("E31",i,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"){let m=i.getAttribute("contenteditable");!(m!=null&&m!=="false")&&i.children.length>0&&n("E20",i,{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(i.hasAttribute("transient")&&i.hasAttribute("persist")&&n("E34",i,{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"}),i.tagName==="DIALOG"&&i.hasAttribute("detail")&&!(i.parentElement&&i.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&t.warn("W31",i,{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'}),i.hasAttribute("item")&&!i.hasAttribute("template")&&i.parentNode&&i.parentNode.nodeType===1){let m=i.parentElement;(!m||!m.hasAttribute("items"))&&n("E10",i,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(i.hasAttribute("items")&&b&&n("E17",i,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),i.hasAttribute("items")){let m=e.querySelector(`[trigger-add="${i.getAttribute("items")}"]`);!Lt(i)&&!Qe(e,i.getAttribute("items"))&&$t(i).length===0&&m&&n("E17",i,{attr:"items",problem:`trigger-add targets items="${i.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(t.halted=!0,t.haltReason=t.errors[0]?t.errors[0].code:"halt",D(e,t.haltReason)),!r}var Pn="sap-styles",Cn="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",yt=new WeakSet;function Pr(e){if(yt.has(e))return;let t=e.defaultView,r=t&&t.CSSStyleSheet;if(r&&"adoptedStyleSheets"in e)try{let n=new r;n.replaceSync(Cn),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],yt.add(e);return}catch{}if(!e.getElementById(Pn)){let n=e.createElement("style");n.id=Pn,n.textContent=Cn,(e.head||e.documentElement).appendChild(n)}yt.add(e)}var Cr=0;function On(){return typeof performance<"u"&&performance.now?performance.now():0}function wt(e){let t=e.id||e.getAttribute("sap")||`app-${Cr++}`,r=new Ne(t),n={root:e,name:t,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Ln(e,r))return n.halted=!0,n;Pr(e.ownerDocument);for(let i of e.querySelectorAll("textarea[data-value]"))me(i)||Fe(i);let s=On();return ze(n,{trigger:"mount",full:!0}),n._mountMs=On()-s,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!pn()&&!$("derived")&&r.warn("W30",e,{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 Or=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Mr(e){return`${e.tagName.toLowerCase()}[sap]`}function Ir(e){let t={actions:0,lists:0,rows:0};return O(e,r=>{r.hasAttribute("items")&&t.lists++,r!==e&&r.hasAttribute("item")&&!r.hasAttribute("template")&&t.rows++,[...r.attributes].some(n=>Or.test(n.name))&&t.actions++}),t}function Mn(e){function t(i){let g=i._stats||{},b=i.root;return{root:Mr(b),fields:g.fields||0,calcs:g.calcs||0,paints:g.paints||0,...Ir(b),warnings:i.diag.warnings.length,errors:i.diag.errors.length,mountWrites:i._mountWrites||0,ms:Math.round((i._mountMs||0)*10)/10,passes:i._passes||0,lastPass:i._lastPass||null,ok:i.diag.errors.length===0&&!i.halted}}function r(){let i=e.apps().map(t);return{ok:i.every(g=>g.ok),apps:i}}function n(i){let g=t(i);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 i=[],g=[];for(let b of e.apps())i.push(...b.diag.errors),g.push(...b.diag.warnings);return{ok:i.length===0,errors:i,warnings:g,counts:{errors:i.length,warnings:g.length}}}function s(i){let g=i===void 0?!0:!!i;for(let b of e.apps())b._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:s,greenLine:n}}var ve="0.9.1";var In={};var Dr=/^(https:\/\/(?:cdn\.jsdelivr\.net\/npm|unpkg\.com)\/@panphora\/sapjs)(?=[@/]|$)/,Dn=e=>new Promise(t=>setTimeout(t,e)),Fn=e=>e.getAttribute("plugins")?.match(/\S+/g)||[];function Bn(e,t,r){let n=new Map,o=new Map,s=new Map,i=new Map,g=[],b=new Set,m={},d=!1,l,p=globalThis,k=Array.isArray(p.sapPlugins)?p.sapPlugins:p.sapPlugins==null?p.sapPlugins=[]:[],R=p.document?.currentScript?.src||"",L=Dr.exec(R),_=a=>o.get(a)?.api||null,G=a=>Promise.allSettled(a.map(C));function B(){let a=new Map;for(let c of n.values())if(!o.has(c.name))for(let f of c.helpers||[])a.set(f,c.name);Ut(m,a),Ie()}function j(a){n.set(a.name,{...n.get(a.name),...a}),kt(a),B()}function U(a){n.has(a.name)||j(a)}function T(a){k.includes(a)||k.push(a),j(a)}function Y(a){for(let c of e.apps())c.root.isConnected&&e.schedule(c,a)}let v=Object.freeze({api:1,version:ve,compile:Ce,run:qt,runWith:ye,planOf:K,drainPlans:Zt,forgetRow:De,setBeacon:D,clearBeacon:fe,write:ce,schedule(a,c="plugin"){let f=a?.root?a:e.appFor(a);f&&e.schedule(f,c)},appFor:e.appFor,apps:e.apps,capability:$,mayWrite:ae,load:C,plugin:_});function A(a){if(typeof a=="string")return C(a);let{name:c,api:f}=a,h=w=>{throw new Error(`Sap.use: plugin "${c}" ${w}`)};if((typeof c!="string"||f!==1)&&h(`needs a name and plugin API ${1}; it gives API ${f}`),d)return null;if(o.has(c))return _(c);if((a.requires||[]).some(w=>!o.has(w)))return T(a),g.includes(a)||g.push(a),null;let y=a.setup?.(v)||{},E=(w,qe)=>{for(let Q of Array.isArray(a[w])?a[w]:Object.keys(a[w]||{}))(typeof(y[w]||{})[Q]!="function"||qe(Q))&&h(`cannot add "${Q}" to ${w}: the name is taken or not valid, or setup does not supply it`)},N=w=>!Re(w,c);E("helpers",w=>(it(w)&&h(`cannot add "${w}": window.${w} exists; rename the helper`),!Vt(w)||w in m)),E("boundaries",N),E("directives",N);for(let w in y.api)w in t&&h(`cannot add Sap.${w}: the name is taken`);T(a);let x={...y,name:c,order:a.order,boundary:{}};for(let w in a.boundaries)x.boundary[w]=y.boundaries[w];for(let w of a.helpers||[])m[w]=y.helpers[w];for(let w in y.formats)w in W||(W[w]=y.formats[w]);return He(x),y.lint&&Ue(y.lint),Object.assign(t,y.api),o.set(c,x),i.delete(c),St(c,y.directives||!0),B(),ce(()=>b.forEach(fe)),b.clear(),g.splice(0).forEach(S),Y("plugin:"+c),_(c)}function S(a){try{A(a)}catch(c){console.error(c)}}function P(a){if(d||o.has(a))return null;let c=n.get(a)||{},f=I.loader?.(a,c),h=c.url||I.base&&I.base+(c.file||a)+".js";return(f!==void 0?Promise.resolve(f):new Promise((E,N)=>{if(!h)throw new Error(`no address for plugin "${a}": call Sap.use(definition)`);let x=document.createElement("script");x.src=h,x.setAttribute("clay","editor-ui"),x.onload=x.onerror=w=>{x.remove(),w.type==="load"?E():N(new Error("could not load "+h))},document.head.append(x)})).then(E=>{if(d)return;let N=E?.default||E||k.find(x=>x.name===a);if(N?.name&&A(N),!o.has(a))throw new Error(`plugin "${a}" loaded and did not register`)})}function C(a){if(o.has(a))return Promise.resolve(_(a));if(s.has(a))return s.get(a);i.delete(a);let c=Promise.all((n.get(a)?.requires||[]).map(C)).then(()=>P(a));for(let h of I.retryDelays)c=c.catch(()=>Dn(h).then(()=>P(a)));let f=c.finally(()=>s.delete(a)).then(()=>_(a),h=>{throw i.set(a,h),l||=!p.addEventListener?.("online",()=>I.retry()),Y("plugin-failed:"+a),document.dispatchEvent(new CustomEvent("sap:plugin-failed",{detail:{plugin:a,error:h}})),h});return s.set(a,f),f}function J(a){let c=new Set;for(let f of a.closest?.("[sap]")?[a]:a.querySelectorAll("[sap]")){for(let h of Fn(f.closest("[sap]")))c.add(h);n.size>o.size&&O(f,h=>{let y=K(h);return y.inert?!1:(y.wants?.map(E=>c.add(E)),!!c.add(y.waits))})}return[...c].filter(f=>f&&!o.has(f))}Rn((a,c)=>{for(let f of new Set([...c.wanted.keys(),...c.waiting,...Fn(a.root)])){if(o.has(f))continue;let h=i.get(f);if(!h)C(f).catch(()=>{});else{let y=c.wanted.get(f)?.[0]||a.root;a.diag.error("E52",y,{problem:`the "${f}" plugin did not load: ${h.message}`,fix:"Sap.plugins.retry() tries again"}),b.add(y),ce(()=>D(y,"E52"))}}});let I={api:1,base:L?`${L[1]}@${ve}/dist/sap-plugins/`:/^[^:]+:\//.test(R)?new URL("sap-plugins/",R).href:null,loader:null,retryDelays:[1e3,4e3],declare:U,load:C,ready(a=document,c=3e3){let f=new Set,h=()=>{let E=J(a).filter(N=>!f.has(N)&&f.add(N));return E.length&&G(E).then(h)},y=h();return y?Promise.race([y,Dn(c)]):null},has:a=>o.has(a),status:()=>({installed:[...o.keys()],loading:[...s.keys()],failed:[...i.keys()]}),retry:a=>G(a?[a]:[...i.keys()])};function u(){let a=[],c=()=>(kn(),r.flushNow()),f=[...o.values()].filter(h=>h.flush);c();for(let h=0;f.length&&h<8;h++){for(let y of f){let E=y.flush();E?.then&&a.push(E)}if(!c())break}return a.length?Promise.all(a).then(u):null}t.use=A,t.plugins=I,t.flush=u;for(let a of Object.values(In))U(a);return k.slice().forEach(S),function(){d=!0;for(let c of o.values())c.dispose?.();o.clear(),i.clear()}}function jn({createAccessor:e,installInput:t,debugExtras:r}){let n=new Map,o=[],s=xt(ze);function i(v){let A=v;for(;A;){if(A.nodeType===1&&A.hasAttribute&&A.hasAttribute("sap"))return n.get(A)||null;A=A.parentNode&&A.parentNode.host?A.parentNode.host:A.parentElement}return null}function g(){for(let v=o.length-1;v>=0;v--){let A=o[v];A.root.isConnected||(n.delete(A.root),o.splice(v,1))}}function b(v,A){if(v.moveBefore)try{v.moveBefore(A,null);return}catch{}v.appendChild(A)}function m(v,A){let S=A.parentElement;if(S){if(S.moveBefore)try{S.moveBefore(v,A);return}catch{}S.insertBefore(v,A)}}let d={apps:()=>o.slice(),appFor:i,isRegistered:v=>n.has(v),pruneDisconnected:g,schedule:s.schedule,runNow:(v,A)=>s.runNow(v,A),moveInto:b,placeBefore:m,remountIfPresent:()=>j()},l=e(d),p=Mn(d),k=r?r(d,p):{},R=!1,L=!1,_=null;function G(){R||(R=!0,t(d,l,document),_=gn(d))}function B(){let v=$("derived");v&&typeof v.mounted=="function"&&v.mounted()}function j(v=document){if(L)return[];G(),pt(d);let A=v.querySelectorAll("[sap]"),S=[];for(let P of A){if(n.has(P)||me(P))continue;let C=wt(P);n.set(P,C),o.push(C),S.push(C)}for(let P of S){let C=p.greenLine(P);P.diag.errors.length||P.halted?console.error(C):console.log(C)}return B(),S}function U(v){if(L)return null;if(G(),pt(d),!v)return j();let A=typeof v=="string"?document.querySelector(v):v;if(!A)return null;if(n.has(A))return n.get(A);let S=wt(A);n.set(A,S),o.push(S);let P=p.greenLine(S);return S.diag.errors.length||S.halted?console.error(P):console.log(P),S}let T=l.Sap;T.version=ve,T.refresh=function(){for(let A of o.slice())A.root.isConnected&&s.runNow(A,"refresh")},T.batch=bn,T.status=p.status,T.report=p.report,T.why=k.why,T.debug=p.debug,T.doctor=k.doctor,T.greenLine=p.greenLine,T.formats=W,T.serializeControlToAttributes=se,T.finalizeControlForSave=dn,T.rehydrateControlFromAttributes=Fe,T.mount=U,T.config=function(A={}){return A.formats&&Object.assign(W,A.formats),T},T._registry=n,T._reset=function(){n.clear(),o.length=0,mt()},T.unmount=function(){L=!0,n.clear(),o.length=0,mt(),typeof _=="function"&&_(),Y()};let Y=Bn(d,T,s);return{Sap:T,mountAll:j,mount:U,runtime:d}}function Wn(e){if(typeof document>"u")return;let t=()=>mn(()=>e());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}function Hn(e){let t=[];function r(b){let m=b.target;if(!m||m.nodeType!==1)return;let d=e.appFor(m);if(d){m.hasAttribute("persist")&&!Be(m)&&ae(m)&&se(m);for(let l of t)if(l(m,d))return;e.schedule(d,b.type+" "+(m.id||m.tagName.toLowerCase()))}}function n(b){let m=b.target,d=e.appFor(m);d&&[...m.querySelectorAll("[bind]")].every(l=>ae(l))&&setTimeout(()=>{m.querySelectorAll("[bind]").forEach(l=>{l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0}))}),e.schedule(d,"reset")},0)}function o(b){let m=e.appFor(b.target);m&&e.schedule(m,"toggle")}function s(b){let m=b.detail||{};for(let d of[m.from,m.to,b.target]){if(!d||d.nodeType!==1)continue;let l=e.appFor(d);l&&e.schedule(l,"sorted")}}function i(b){if(b.key!=="ArrowUp"&&b.key!=="ArrowDown")return;let m=b.target;if(!m||m.nodeType!==1||m.tagName!=="INPUT"||!m.hasAttribute("bind")||!m.hasAttribute("step"))return;let d=(m.getAttribute("type")||"text").toLowerCase();if(d!=="text"&&d!=="tel"&&d!=="search"||!e.appFor(m)||!ae(m))return;b.preventDefault();let p=M(m.getAttribute("step"))||1,k=b.key==="ArrowUp"?1:-1,R=M(m.value)+p*(b.shiftKey?10:1)*k,L=m.getAttribute("min"),_=m.getAttribute("max");L!==null&&L!==""&&R<M(L)&&(R=M(L)),_!==null&&_!==""&&R>M(_)&&(R=M(_)),xn(m).write(String(Number(R.toFixed(2))))}function g(b=document){b.addEventListener("reset",n),b.addEventListener("toggle",o,!0),b.addEventListener("input",r),b.addEventListener("change",r),b.addEventListener("clay:sorted",s),b.addEventListener("keydown",i)}return{install:g,addRouter:b=>t.push(b)}}var ke="https://clayjs.com/v1/sap.js",Fr=/^(calc|set|move|sort):/,Br=new Set(["each","detail","effect","invalid","confirm","trigger-add","trigger-remove","trigger-reset"]);function At(e){return Fr.test(e)||Br.has(e)}Ue((e,t)=>{for(let r of e.attributes)At(r.name)&&t("E50",e,{attr:r.name,expr:r.value,problem:`${r.name} is full sapjs; the sapjs core only paints declared state`,fix:`load ${ke}; the markup stays as it is`})});function le(e,t,r){e.app.diag.error("E50",t,{attr:r,problem:`${r} is full sapjs; the sapjs core only paints declared state`,fix:`load ${ke}; the markup stays as it is`}),D(t,"E50"),e.app.halted=!0}He({name:"core-only",collect(e,t,r){r.calcs&&le(e,t,"calc:"+r.calcs[0].name),r.effects&&le(e,t,"effect"),r.invalids&&le(e,t,"invalid");for(let n of t.attributes)At(n.name)&&(n.name.startsWith("calc:")&&r.calcs||n.name==="effect"&&r.effects||n.name==="invalid"&&r.invalids||le(e,t,n.name));return!1},boundary:{each(e,t){le(e,t,"each")},detail(e,t){le(e,t,"detail")}}});function jr(){return{Sap:function(){throw new Error(`Sap(el) is full sapjs; load ${ke}`)}}}var zn=e=>()=>(console.warn(`Sap.${e} is full sapjs; load ${ke}`),null),{Sap:Se,mountAll:Un,mount:Wr,runtime:Hr}=jn({createAccessor:jr,debugExtras:()=>({why:zn("why"),doctor:zn("doctor")}),installInput(e,t,r){Hn(e).install(r)}});Se.core=!0;var zr=typeof window<"u"&&window.Sap&&!window.Sap.core;zr?Se.unmount():Wn(Un);typeof window<"u"&&!window.Sap&&(window.Sap=Se);var Ur=Se;return Kn(Vr);})();
|
|
10
10
|
export default SapCoreBundle.default;
|
|
@@ -42,3 +42,72 @@ The script defines `mount(tool)` and may return a cleanup function. `tool` suppl
|
|
|
42
42
|
"summary": "Shows the sum of the amount column in the revenue table."
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Page tool cookbook: larger examples
|
|
48
|
+
|
|
49
|
+
Four larger worked examples. Each block is a whole reply: the artifact and the state it starts with.
|
|
50
|
+
|
|
51
|
+
## Count from a table
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"artifact": {
|
|
56
|
+
"title": "Nights below freezing",
|
|
57
|
+
"html": "<div class=\"frost\"><p class=\"lead\"><output class=\"big\">0</output> <span class=\"what\">nights below freezing</span></p><p class=\"detail\"></p><p class=\"note\"></p></div>",
|
|
58
|
+
"css": ".frost { max-width: 26rem; display: grid; gap: 0.5rem; } p { margin: 0; } .big { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } .detail, .note { font-size: 0.875em; } .note { opacity: 0.75; } p:empty { display: none; }",
|
|
59
|
+
"javascript": "function mount(tool) { const find = (selector) => tool.root.querySelector(selector); const lead = find('.lead'), big = find('.big'), what = find('.what'), detail = find('.detail'), note = find('.note'); const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many); const show = (n) => (Math.round(n * 10) / 10 || 0).toLocaleString(); const number = (value) => { const text = String(value ?? '').trim(); return text !== '' && Number.isFinite(Number(text)) ? Number(text) : null; }; const draw = () => { const table = tool.table('readings'); const rows = table?.rows ?? []; const key = (name) => table?.cols?.find((col) => String(col.name).trim().toLowerCase() === name)?.id ?? name; const nights = rows.map((row) => ({ night: String(row.cells?.[key('night')] ?? '').trim(), low: number(row.cells?.[key('low')]) })).filter((night) => night.low !== null); const skipped = rows.length - nights.length; const frosty = nights.filter((night) => night.low < 0).length; lead.hidden = !table; big.textContent = String(frosty); what.textContent = frosty === 1 ? 'night below freezing' : 'nights below freezing'; note.textContent = skipped ? plural(skipped, 'row', 'rows') + ' skipped: no number in the low column.' : ''; if (!table) detail.textContent = 'This page has no readings table to count from.'; else if (!rows.length) detail.textContent = 'The readings table has no rows yet.'; else if (!nights.length) detail.textContent = ''; else { const coldest = nights.reduce((a, b) => (b.low < a.low ? b : a)); const average = nights.reduce((sum, night) => sum + night.low, 0) / nights.length; detail.textContent = 'Out of ' + plural(nights.length, 'reading', 'readings') + '. Coldest ' + show(coldest.low) + ' °C' + (coldest.night ? ' on ' + coldest.night : '') + ', average ' + show(average) + ' °C.'; } }; const off = tool.on('tables', draw); draw(); return off; }",
|
|
60
|
+
"fallbackHtml": "<p>Counts the nights below freezing in the readings table. Open this page to see the current count.</p>",
|
|
61
|
+
"summary": "Counts the rows of the readings table whose low is under zero, with the coldest night and the average as detail. Says so when the table is missing, empty, or has rows without a number."
|
|
62
|
+
},
|
|
63
|
+
"state": {}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## List with add, edit, remove and undo
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"artifact": {
|
|
72
|
+
"title": "Meeting agenda",
|
|
73
|
+
"html": "<div class=\"agenda\"><p><output class=\"big\">0</output> <span class=\"unit\">minutes planned</span></p><ol></ol><p class=\"empty\">No topics yet. Add the first one below.</p><p class=\"undo\" hidden><span></span> <button type=\"button\">Undo</button></p><form novalidate><label class=\"wide\"><span>Topic</span><input name=\"topic\" type=\"text\" maxlength=\"80\" autocomplete=\"off\" placeholder=\"Budget review\"></label><label><span>Minutes</span><input name=\"minutes\" type=\"text\" inputmode=\"numeric\" maxlength=\"4\" autocomplete=\"off\" placeholder=\"15\"></label><button type=\"submit\" class=\"primary\">Add topic</button><button type=\"button\" class=\"cancel\" hidden>Cancel</button><p class=\"error\" role=\"alert\"></p></form></div>",
|
|
74
|
+
"css": ".agenda { max-width: 30rem; display: grid; gap: 0.75rem; } p, ol { margin: 0; padding: 0; } .big { font-size: 2.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } li { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem; border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent); } .topic { flex: 1 1 9rem; overflow-wrap: anywhere; } .mins { font-variant-numeric: tabular-nums; } form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem; } label { flex: 0 1 6rem; display: grid; gap: 0.25rem; } label.wide { flex: 1 1 12rem; } label span, .empty, .undo { font-size: 0.875em; } input, button { font: inherit; color: inherit; min-height: 44px; box-sizing: border-box; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 0.375rem; background: transparent; } input { width: 100%; padding: 0 0.625rem; font-size: max(1em, 16px); } input[aria-invalid] { border: 2px solid currentColor; } ::placeholder { color: inherit; opacity: 0.5; } button { min-width: 44px; padding: 0 0.875rem; cursor: pointer; } li button, .undo button { border-color: transparent; padding: 0 0.5rem; text-decoration: underline; } button.primary { background: color-mix(in srgb, currentColor 12%, transparent); border-color: currentColor; font-weight: 600; } :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } .error { flex-basis: 100%; font-weight: 600; } p:empty, ol:empty, [hidden] { display: none; }",
|
|
75
|
+
"javascript": "function mount(tool) { const doc = tool.root.ownerDocument; const find = (selector) => tool.root.querySelector(selector); const big = find('.big'), unit = find('.unit'), list = find('ol'), empty = find('.empty'), undo = find('.undo'); const form = find('form'), topic = form.elements.topic, minutes = form.elements.minutes; const submit = find('.primary'), cancel = find('.cancel'), error = find('.error'); const stop = new AbortController(); const on = (target, type, handler) => target.addEventListener(type, handler, { signal: stop.signal }); const blank = { topic: '', minutes: '', id: '' }; let removed = null; let drawn = ''; let shown = {}; const read = () => { const data = tool.state.data || {}; const items = data.items || {}; const draft = { ...blank, ...data.draft }; const rows = Object.keys(items).map((id) => ({ id, ...items[id] })).sort((a, b) => a.at - b.at); return { items, rows, draft, editing: items[draft.id] ? draft.id : '' }; }; const put = (path, value) => { try { tool.state.set(path, value); return true; } catch (problem) { return false; } }; const el = (tag, className, text) => { const node = doc.createElement(tag); node.className = className; node.textContent = text; return node; }; const draw = () => { const now = read(); const total = now.rows.reduce((sum, row) => sum + row.minutes, 0); const count = now.rows.length; for (const input of [topic, minutes]) { const text = now.draft[input.name]; if (text !== shown[input.name] && input.value !== text) input.value = text; } shown = now.draft; submit.textContent = now.editing ? 'Save topic' : 'Add topic'; cancel.hidden = !now.editing; big.textContent = String(total); unit.textContent = (total === 1 ? 'minute' : 'minutes') + (count ? ' across ' + count + (count === 1 ? ' topic' : ' topics') : ' planned'); empty.hidden = count > 0; undo.hidden = !removed; undo.firstElementChild.textContent = removed ? 'Removed ' + removed.topic + '.' : ''; const signature = JSON.stringify(now.rows); if (signature === drawn) return; drawn = signature; list.textContent = ''; for (const row of now.rows) { const item = el('li', '', ''); const edit = el('button', 'edit', 'Edit'); const remove = el('button', 'remove', 'Remove'); item.dataset.id = row.id; edit.type = remove.type = 'button'; edit.setAttribute('aria-label', 'Edit ' + row.topic); remove.setAttribute('aria-label', 'Remove ' + row.topic); item.append(el('span', 'topic', row.topic), el('span', 'mins', row.minutes + ' min'), edit, remove); list.append(item); } }; const focusRow = (id, name) => (find('li[data-id=\"' + id + '\"] .' + name) || topic).focus(); const fail = (input, message) => { error.textContent = message; input.setAttribute('aria-invalid', 'true'); input.focus(); }; const full = () => fail(topic, 'This agenda is full. Remove a topic to make room.'); const clearError = () => { error.textContent = ''; topic.removeAttribute('aria-invalid'); minutes.removeAttribute('aria-invalid'); }; on(form, 'input', (event) => { clearError(); put(['draft', event.target.name], event.target.value); }); on(form, 'submit', (event) => { event.preventDefault(); clearError(); const now = read(); const name = topic.value.trim(); const length = minutes.value.trim(); if (!name) return fail(topic, 'Give the topic a name.'); if (!/^\\d+$/.test(length) || Number(length) < 1) return fail(minutes, 'Minutes must be a whole number above 0, such as 15.'); const id = now.editing || 't' + Date.now().toString(36) + Math.random().toString(36).slice(2, 5); if (!put(['items', id], { topic: name, minutes: Number(length), at: now.editing ? now.items[id].at : Date.now() })) return full(); removed = null; put(['draft'], blank); if (now.editing) focusRow(id, 'edit'); else topic.focus(); }); on(list, 'click', (event) => { const button = event.target.closest('button'); const id = button?.closest('li').dataset.id; const item = read().items[id]; if (!item) return; clearError(); if (button.className === 'edit') { if (!put(['draft'], { topic: item.topic, minutes: String(item.minutes), id })) return full(); topic.focus(); } else { removed = { id, topic: item.topic, minutes: item.minutes, at: item.at }; tool.state.delete(['items', id]); undo.lastElementChild.focus(); } }); on(undo.lastElementChild, 'click', () => { const { id, ...item } = removed; if (!put(['items', id], item)) return full(); removed = null; draw(); focusRow(id, 'edit'); }); on(cancel, 'click', () => { const id = read().editing; clearError(); put(['draft'], blank); focusRow(id, 'edit'); }); const off = tool.on('change', draw); draw(); return () => { stop.abort(); off(); }; }",
|
|
76
|
+
"fallbackHtml": "<p>Meeting agenda with a time for each topic. Open this page in an editor to add or change topics.</p>",
|
|
77
|
+
"summary": "Add topics with a length in minutes, edit or remove them, and see the total time. An empty name or a length that is not a whole number gets a message. A removed topic can be put back with Undo."
|
|
78
|
+
},
|
|
79
|
+
"state": {"items":{},"draft":{"topic":"","minutes":"","id":""}}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Stopwatch that keeps time across a reload
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"artifact": {
|
|
88
|
+
"title": "Stopwatch",
|
|
89
|
+
"html": "<div class=\"watch\"><p class=\"time\" role=\"timer\">0:00</p><p class=\"status\">Ready</p><div class=\"actions\"><button type=\"button\" class=\"primary\">Start</button><button type=\"button\" class=\"reset\" hidden>Reset</button></div><p class=\"undo\" hidden><span></span> <button type=\"button\">Undo</button></p></div>",
|
|
90
|
+
"css": ".watch { max-width: 20rem; display: grid; gap: 0.5rem; } p { margin: 0; } .time { font-size: 3.5rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } .status, .undo { font-size: 0.875em; } .actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; } button { font: inherit; color: inherit; min-width: 44px; min-height: 44px; padding: 0 1rem; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 0.375rem; background: transparent; cursor: pointer; } button.primary { flex: 1; background: CanvasText; border-color: CanvasText; color: Canvas; font-weight: 600; } .undo button { border-color: transparent; padding: 0 0.5rem; text-decoration: underline; } :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } button.primary:focus-visible { outline-color: CanvasText; } [hidden] { display: none; }",
|
|
91
|
+
"javascript": "function mount(tool) { const find = (selector) => tool.root.querySelector(selector); const time = find('.time'), status = find('.status'), toggle = find('.primary'), reset = find('.reset'), undo = find('.undo'); const stop = new AbortController(); const on = (target, type, handler) => target.addEventListener(type, handler, { signal: stop.signal }); let cleared = null; let waiting = false; const read = () => { const run = (tool.state.data || {}).run || {}; return { since: Number(run.since) || 0, banked: Number(run.banked) || 0 }; }; const elapsed = (run) => run.banked + (run.since ? Math.max(0, Date.now() - run.since) : 0); const clock = (ms) => { const seconds = Math.floor(ms / 1000); const two = (n) => String(n).padStart(2, '0'); const minutes = Math.floor(seconds / 60); return (minutes >= 60 ? Math.floor(minutes / 60) + ':' + two(minutes % 60) : minutes) + ':' + two(seconds % 60); }; const draw = () => { const run = read(); const ms = elapsed(run); time.textContent = clock(ms); toggle.textContent = run.since ? 'Pause' : ms ? 'Resume' : 'Start'; status.textContent = run.since ? 'Running since ' + new Date(run.since).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }) : ms ? 'Paused' : 'Ready'; reset.hidden = !ms && !run.since; undo.hidden = !cleared; undo.firstElementChild.textContent = cleared ? 'Cleared ' + clock(elapsed(cleared)) + '.' : ''; if (run.since && !waiting) { waiting = true; tool.schedule(() => { waiting = false; draw(); }, 1000 - (ms % 1000)); } }; on(toggle, 'click', () => { const run = read(); cleared = null; tool.state.set(['run'], run.since ? { since: 0, banked: elapsed(run) } : { since: Date.now(), banked: run.banked }); }); on(reset, 'click', () => { cleared = read(); tool.state.set(['run'], { since: 0, banked: 0 }); undo.lastElementChild.focus(); }); on(undo.lastElementChild, 'click', () => { const run = cleared; cleared = null; tool.state.set(['run'], run); toggle.focus(); }); const off = tool.on('change', draw); draw(); return () => { stop.abort(); off(); }; }",
|
|
92
|
+
"fallbackHtml": "<p>Stopwatch. Open this page in an editor to start, pause or reset it.</p>",
|
|
93
|
+
"summary": "Start, pause and reset a stopwatch. It saves when it was started, not a ticking number, so the time stays right after a reload. A reset can be undone."
|
|
94
|
+
},
|
|
95
|
+
"state": {"run":{"since":0,"banked":0}}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Calculator with messages for invalid input
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"artifact": {
|
|
104
|
+
"title": "Paint needed",
|
|
105
|
+
"html": "<div class=\"paint\"><div class=\"fields\"><label><span>Wall length (m)</span><input name=\"length\" type=\"text\" inputmode=\"decimal\" maxlength=\"12\" autocomplete=\"off\" placeholder=\"14.5\"><small>Add up every wall you will paint.</small></label><label><span>Wall height (m)</span><input name=\"height\" type=\"text\" inputmode=\"decimal\" maxlength=\"12\" autocomplete=\"off\" placeholder=\"2.4\"><small>From the floor to the ceiling.</small></label><label><span>Coverage (m² per litre)</span><input name=\"cover\" type=\"text\" inputmode=\"decimal\" maxlength=\"12\" autocomplete=\"off\" placeholder=\"10\"><small>Printed on the tin.</small></label><div class=\"coats\" role=\"group\" aria-label=\"Coats\"><span>Coats</span><div><button type=\"button\" value=\"1\">1</button><button type=\"button\" value=\"2\">2</button><button type=\"button\" value=\"3\">3</button></div></div></div><div class=\"result\"><p class=\"main\"><output class=\"big\"></output> <span>litres of paint</span></p><p class=\"detail\"></p></div></div>",
|
|
106
|
+
"css": ".paint { max-width: 28rem; display: grid; gap: 1rem; } .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; } label, .coats { display: grid; gap: 0.25rem; align-content: start; } span, small, .detail { font-size: 0.875em; } small { opacity: 0.75; } small.error { opacity: 1; font-weight: 600; } input, button { font: inherit; color: inherit; min-height: 44px; box-sizing: border-box; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 0.375rem; background: transparent; } input { width: 100%; padding: 0 0.625rem; font-size: max(1em, 16px); } input[aria-invalid] { border: 2px solid currentColor; } ::placeholder { color: inherit; opacity: 0.5; } .coats div { display: flex; gap: 0.25rem; } button { flex: 1; cursor: pointer; } button[aria-pressed=\"true\"] { background: color-mix(in srgb, currentColor 12%, transparent); border-color: currentColor; font-weight: 600; } :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } .result { padding-top: 0.75rem; border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent); } p { margin: 0; } .big { font-size: 2.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } [hidden] { display: none; }",
|
|
107
|
+
"javascript": "function mount(tool) { const find = (selector) => tool.root.querySelector(selector); const inputs = Array.from(tool.root.querySelectorAll('input')); const buttons = Array.from(tool.root.querySelectorAll('button')); const hints = inputs.map((input) => input.nextElementSibling.textContent); const main = find('.main'), big = find('.big'), detail = find('.detail'); const stop = new AbortController(); const on = (target, type, handler) => target.addEventListener(type, handler, { signal: stop.signal }); const show = (n) => (Math.round(n * 10) / 10).toLocaleString(); const check = (input, text) => { if (text === '') return { empty: true }; if (!Number.isFinite(Number(text))) return { error: 'Type a plain number, such as ' + input.placeholder + '.' }; if (Number(text) <= 0) return { error: 'This has to be more than 0.' }; return { value: Number(text) }; }; const draw = () => { const data = tool.state.data || {}; const coats = [1, 2, 3].includes(data.coats) ? data.coats : 2; const got = {}; let empty = 0, wrong = 0; inputs.forEach((input, index) => { const text = String(data[input.name] ?? ''); const result = got[input.name] = check(input, text.trim()); const small = input.nextElementSibling; if (input.value !== text) input.value = text; small.textContent = result.error || hints[index]; small.className = result.error ? 'error' : ''; if (result.error) input.setAttribute('aria-invalid', 'true'); else input.removeAttribute('aria-invalid'); wrong += result.error ? 1 : 0; empty += result.empty ? 1 : 0; }); for (const button of buttons) button.setAttribute('aria-pressed', String(Number(button.value) === coats)); main.hidden = wrong + empty > 0; if (wrong) detail.textContent = 'Fix the marked ' + (wrong === 1 ? 'field' : 'fields') + ' to see the amount.'; else if (empty) detail.textContent = 'Fill in every field to see how much paint to buy.'; else { const area = got.length.value * got.height.value; big.textContent = show(area * coats / got.cover.value); detail.textContent = show(area) + ' m² of wall, ' + coats + (coats === 1 ? ' coat' : ' coats') + ', ' + show(got.cover.value) + ' m² per litre.'; } }; on(tool.root, 'input', (event) => tool.state.set([event.target.name], event.target.value)); for (const button of buttons) on(button, 'click', () => tool.state.set(['coats'], Number(button.value))); const off = tool.on('change', draw); draw(); return () => { stop.abort(); off(); }; }",
|
|
108
|
+
"fallbackHtml": "<p>Works out the litres of paint for a room from the wall length, wall height, number of coats and the paint's coverage.</p>",
|
|
109
|
+
"summary": "Enter the wall length, height and coverage and pick the coats to see the litres of paint needed. A field that is not a number above 0 gets a message and no result is shown."
|
|
110
|
+
},
|
|
111
|
+
"state": {"length":"","height":"","cover":"10","coats":2}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
@@ -15,7 +15,7 @@ The tool sits inside someone else's page, so it fits that page instead of bringi
|
|
|
15
15
|
- Separate parts with whitespace first, then a hairline, then a tinted area. Never a card inside a card, and never a coloured stripe on one side of a box: not left, right or top.
|
|
16
16
|
- No eyebrow text above a heading. Labels use the body face one step smaller, in sentence case, with no letter spacing.
|
|
17
17
|
- One filled primary button at most. Fill it with `CanvasText` and write its label in `Canvas`, or tint it with `color-mix(in srgb, currentColor 12%, transparent)` and keep the inherited text colour. Never fill an element with `currentColor` while changing its `color`: `currentColor` is that element's own text colour, so the label disappears. Fields are flat; buttons are the only raised things. One shadow at most per element.
|
|
18
|
-
- Every control shows a visible focus ring with space around it: `outline: 2px solid currentColor; outline-offset: 2px;` on `:focus-visible`.
|
|
18
|
+
- Every control shows a visible focus ring with space around it: `outline: 2px solid currentColor; outline-offset: 2px;` on `:focus-visible`. On a filled button, set `outline-color: CanvasText`, because its own `currentColor` is the page colour and the ring would vanish.
|
|
19
19
|
- Checkboxes and radios keep their native behaviour, styled with `accent-color`, 1 to 4 px larger than the default.
|
|
20
20
|
- A styled select uses `appearance: none`, places its arrow as far from the right edge as the text is from the left, and pads the right so text never runs under it.
|
|
21
21
|
- Tables use horizontal rules only. No pure white, no pure black, no gradients, no glows.
|
package/dist/m/c-277QP5ET.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d}from"./c-HKSLOVU4.js";import"./c-VHNSBD2M.js";export{c as applyData,d as default,a as engine,b as extractData};
|
package/dist/m/c-5SZ6KFR5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f}from"./c-KYTVZT4D.js";import{g as a}from"./c-JWW6BHWD.js";import"./c-GO635CRU.js";import"./c-V2V5FKXX.js";import"./c-DT7E76Z2.js";import"./c-C6YZNU6E.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import"./c-AI3H6ETU.js";import"./c-OH2FPYSY.js";import"./c-FSQXFG5T.js";import"./c-RETTCOWO.js";import"./c-WCG6AKA7.js";import"./c-57XDY6HC.js";import"./c-I2SCCUEW.js";import"./c-VHNSBD2M.js";export{e as ChartView,d as chartFromSlash,a as chartTables,b as insertChartAfterTable,f as refreshCharts,c as tableLabel};
|
package/dist/m/c-CU33V6RW.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as ee}from"./c-4Q6QIODW.js";import{b as Q}from"./c-3G2DGZUP.js";import{p as K,q as Z}from"./c-MFB74XVN.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import{a as B,h as X}from"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-PNZIJFG7.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var We=Object.defineProperty,Ve=(e,t)=>{for(var r in t)We(e,r,{get:t[r],enumerable:!0})},Fe=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],ze=new Set(Fe),_e=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),he=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),te=new Set(["checked","selected","disabled","readOnly","paused"]);function Je(e,t){return t==null?te.has(e)?!1:"":te.has(e)?t==="false"?!1:!!t:t}var Ye={};Ve(Ye,{CodecRefused:()=>et,EmptyListInsert:()=>R,MAX_RULE_DEPTH:()=>L,MaxRuleDepthExceeded:()=>G,NoRulesTag:()=>Ze,RuleTargetReadOnly:()=>ge,RulesParseError:()=>$,ShapeMismatch:()=>ye,UnknownCodec:()=>we,UnknownRulesVersion:()=>me,WriteNotRoundTripped:()=>Ke,WriteRefused:()=>Ge,WriteRejected:()=>Qe});var $=class extends Error{constructor(e,t){super(e),this.name="RulesParseError",this.cause=t}},me=class extends Error{constructor(e){super(`unknown rules version: ${e}. Library supports "1" and "2".`),this.name="UnknownRulesVersion",this.version=e}},L=20,G=class extends Error{constructor(e){super(`rule depth exceeded ${L} at path: ${e.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=e}},ye=class extends Error{constructor(e){super(`shape mismatch: ${e.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=e}},R=class extends Error{constructor(e,t){super(t?`cannot add items to empty list at "${e.join(".")}" \u2014 ${t}`:`cannot add items to empty list at "${e.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=e}},ge=class extends Error{constructor(e){super(`cannot write to read-only DOM property "${e}"`),this.name="RuleTargetReadOnly",this.target=e}},Ge=class extends Error{constructor(e){super(`write refused: ${e.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=e}};function Xe(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:String(r),"")||"(root)"}var Ke=class extends Error{constructor(e){super(`write did not round-trip at "${Xe(e)}"`),this.name="WriteNotRoundTripped",this.path=e}},Ze=class extends Error{constructor(e){super(`no <script data-rules-name~="${e}"> rules tag in this document`),this.name="NoRulesTag",this.token=e}},Qe=class extends Error{constructor(e,t){super(`write rejected: ${e.length} unknown key(s), ${t.length} rule(s) with no matching element`),this.name="WriteRejected",this.unknownKeys=e,this.unmatched=t}},we=class extends Error{constructor(e){super(`unknown codec "${e}": no codec by that name is given to this call`),this.name="UnknownCodec",this.code="unknown-codec",this.codec=e}},et=class extends Error{constructor(e,t){super(t),this.name="CodecRefused",this.code=e}};function M(e){let t=0,r=null,o=-1;for(let n=0;n<e.length;n++){let l=e[n];l==="\\"?n++:r?l===r&&(r=null):l==='"'||l==="'"?r=l:l==="["||l==="("?t++:l==="]"||l===")"?t>0&&t--:l==="@"&&t===0&&(o=n)}return o}var re="[*]";function j(e){let t=M(e),r=t===-1?e:e.slice(0,t),o=r.endsWith(re),n={selector:o?r.slice(0,-re.length):r,prop:t===-1?null:e.slice(t+1)||null};return o&&(n.all=!0),n}function ve(e){let t=0,r=null,o=-1,n=!1;for(let l=0;l<e.length;l++){let i=e[l];i==="\\"?l++:r?i===r&&(r=null):i==='"'||i==="'"?r=i:i==="["||i==="("?t++:i==="]"||i===")"?t>0&&t--:t===0&&i===">"?o=l:t===0&&i===","&&(n=!0)}return n||o===-1||!tt(e,o+1)?null:e.slice(0,o).trim()||null}function tt(e,t){let r=t,o=e.replace(/\s+$/,"").length;for(;r<o&&/\s/.test(e[r]);)r++;let n=0,l=null;for(;r<o;r++){let i=e[r];if(i==="\\")r++;else if(l)i===l&&(l=null);else if(i==='"'||i==="'")l=i;else if(i==="["||i==="(")n++;else if(i==="]"||i===")")n>0&&n--;else if(n===0&&(i==="+"||i==="~"||/\s/.test(i)))return!1}return!0}var rt=/^codec\(([a-z][a-z0-9-]*)\)$/;function P(e){if(typeof e!="string")return null;let t=M(e);if(t===-1)return null;let r=rt.exec(e.slice(t+1));if(!r)return null;let{selector:o,all:n}=j(e);if(n)throw new $("A @codec(name) rule cannot use [*].");return{selector:o,name:r[1]}}var nt=/^--[A-Za-z0-9_-]+$/;function be(e){return typeof e=="string"&&nt.test(e)}function xe(e){let t=[],r=[],o=null,n=0;for(let l=0;l<e.length;l++){let i=e[l];if(o){i==="\\"?l++:i===o&&(o=null);continue}if(i==="/"&&e[l+1]==="*"){let a=e.indexOf("*/",l+2);l=a===-1?e.length:a+1;continue}i==='"'||i==="'"?o=i:i==="("?r.push(")"):i==="["?r.push("]"):i==="{"?r.push("}"):(i===")"||i==="]"||i==="}")&&r[r.length-1]===i?r.pop():i===";"&&r.length===0&&(t.push(e.slice(n,l)),n=l+1)}return t.push(e.slice(n)),t}function ot(e){let t="",r=null;for(let o=0;o<e.length;o++){let n=e[o];if(r){t+=n,n==="\\"&&o+1<e.length?t+=e[++o]:n===r&&(r=null);continue}if(n==="/"&&e[o+1]==="*"){let l=e.indexOf("*/",o+2);o=l===-1?e.length:l+1,t+=" ";continue}(n==='"'||n==="'")&&(r=n),t+=n}return t}function Ae(e){e=ot(e);let t=e.indexOf(":");if(t===-1)return null;let r=e.slice(0,t).trim(),o=e.slice(t+1).trim(),n=/!\s*important\s*$/i.exec(o);return n&&(o=o.slice(0,n.index).trim()),{name:r,value:o,important:!!n}}function Te(e,t){if(e==null)return null;let r=null;for(let o of xe(String(e))){let n=Ae(o);!n||n.name!==t||(!r||n.important||!r.important)&&(r=n)}return r?r.value:null}function lt(e,t,r){let o=e==null?"":String(e),n=r==null||r==="",l=xe(o),i=l.map(Ae),a=i.some(u=>u&&u.name===t&&u.important),s=[],c=!1;l.forEach((u,d)=>{let m=i[d];if(!m||m.name!==t){s.push(u);return}if(n||c)return;let p=/^\s*/.exec(u)[0];s.push(`${p}${t}: ${r}${a?" !important":""}`),c=!0});let f=s.join(";");if(!n&&!c){let u=f.trimEnd();f=u===""?`${t}: ${r}`:`${u}${u.endsWith(";")?" ":"; "}${t}: ${r}`}return f.trim()===""?null:f}function it(e,t,r,o){let n=e.attr(t,"style");if((Te(n,r)??"")===o)return;let l=lt(n,r,o);l==null?e.removeAttr(t,"style"):e.attr(t,"style",l)}var at='The @codec(name) rule form needs a rules tag with data-rules-version="2".',st="A @codec(name) rule must be the value of a top level key.";function Oe(e,t){let r=P(e);return r?{...r,codec:t.codecs[r.name]}:null}function Ee(e,t={}){let r=t.version??"1",o=t.codecs??{};n(e,0);function n(l,i){if(!(i>L)){if(typeof l=="string"){let a=P(l);if(!a)return;if(r!=="2")throw new $(at);if(i!==1)throw new $(st);if(!Object.prototype.hasOwnProperty.call(o,a.name))throw new we(a.name);return}if(Array.isArray(l)){n(l[1],i+1);return}if(l&&typeof l=="object")for(let a of Object.values(l))n(a,i+1)}}}function ke(e,t,r,o={}){if(Object.prototype.hasOwnProperty.call(o,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return Ee(r,o),V(e,t,r,{depth:0,path:[]},o)}function V(e,t,r,o,n){if(o.depth>L)throw new G(o.path);if(typeof r=="string")return ut(e,t,r,o,n);if(Array.isArray(r)){let[l,i]=r,a=e.find(t,l,n);return Ne(n,o,a),a.map((s,c)=>V(e,s,i,{depth:o.depth+1,path:[...o.path,c]},n))}if(typeof r=="object"&&r!==null){let l={};for(let[i,a]of Object.entries(r))l[i]=V(e,t,a,{depth:o.depth+1,path:[...o.path,i]},n);return l}return null}function ut(e,t,r,o,n){if(r.endsWith("[]")){let f=r.slice(0,-2),u=e.find(t,f,n);return Ne(n,o,u),u.map(d=>e.text(d))}let l=Oe(r,n);if(l)return ct(e,t,l,n);if(r.startsWith("@"))return W(e,t,r.slice(1));let i=M(r);if(i!==-1){let{selector:f,all:u}=j(r),d=r.slice(i+1),m=f?e.find(t,f,n):[t];return u&&n.allMatches?m.map(p=>W(e,p,d)):m.length===0?null:W(e,m[0],d)}if(r===".")return e.text(t);let{selector:a,all:s}=j(r),c=e.find(t,a,n);return s&&n.allMatches?c.map(f=>e.text(f)):c.length===0?null:e.text(c[0])}function ct(e,t,{selector:r,codec:o},n){let l=r?e.find(t,r,n):[t];return l.length===0?null:o.read(e,l[0],{query:n.query,view:n.view,region:n.region})}function Ne(e,t,r){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),r)}catch(o){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,o)}}function W(e,t,r){if(be(r))return Te(e.attr(t,"style"),r);if(ze.has(r)){let n=e.prop(t,r);return n==null?null:String(n)}return e.attr(t,r)??null}function ft(e,t,r,o){let n=e.length,l=t.length,i=new Array(n).fill(-1);if(o){let h=new Set;for(let y=0;y<n;y++){let g=o[y];!(g>=0&&g<l)||h.has(g)||(i[y]=g,h.add(g))}}if(n===0||l===0)return i;let a=e.map(h=>ne(h,r)),s=t.map(h=>ne(h,r)),c=new Array(l).fill(!1);for(let h of i)h>=0&&(c[h]=!0);let f=new Map;s.forEach((h,y)=>{c[y]||f.set(h,f.has(h)?-1:y)});let u=new Map;a.forEach((h,y)=>{i[y]>=0||u.set(h,(u.get(h)||0)+1)}),a.forEach((h,y)=>{if(i[y]>=0||u.get(h)!==1)return;let g=f.get(h);g===void 0||g===-1||c[g]||(i[y]=g,c[g]=!0)});let d=[];for(let h=0;h<n;h++)i[h]<0&&d.push(h);let m=[];for(let h=0;h<l;h++)c[h]||m.push(h);if(d.length===0||m.length===0)return i;let p=n*l+1,w=dt(e,t,r),v=(h,y)=>w(h,y)*p+Math.abs(h-y);for(let[h,y]of pt(d,m,v))i[h]=y;return i}var Se=e=>typeof e=="object"&&e!==null;function ne(e,t){if(!Se(t))return e==null?" null":String(e);let r=Object.keys(t);return JSON.stringify(r.map(o=>{let n=JSON.stringify(e?.[o]);return n===void 0?" undef":n}))}function dt(e,t,r){if(!Se(r))return(a,s)=>e[a]===t[s]?0:1;let o=Object.keys(r),n=a=>o.map(s=>JSON.stringify(a?.[s])),l=e.map(n),i=t.map(n);return(a,s)=>{let c=l[a],f=i[s],u=0;for(let d=0;d<o.length;d++)c[d]!==f[d]&&u++;return u}}function pt(e,t,r){return e.length<=t.length?oe(e,t,r,!1):oe(t,e,(o,n)=>r(n,o),!0)}function oe(e,t,r,o){let n=e.length,l=t.length,i=[];for(let u=0;u<=n;u++)i.push(new Float64Array(l+1).fill(1/0));let a=[];for(let u=0;u<=n;u++)a.push(new Uint8Array(l+1));for(let u=0;u<=l;u++)i[n][u]=0;for(let u=n-1;u>=0;u--)for(let d=l-1;d>=0;d--){let m=r(e[u],t[d])+i[u+1][d+1],p=i[u][d+1];m<=p?(i[u][d]=m,a[u][d]=1):i[u][d]=p}let s=[],c=0,f=0;for(;c<n&&f<l;)a[c][f]&&(s.push(o?[t[f],e[c]]:[e[c],t[f]]),c++),f++;return s}function Re(e,t,r,o,n,l,i,a={}){let s=e.find(t,r,a);if(n.length===0){s.forEach(b=>e.remove(b)),F(a,"onRowsApplied",l.path,[]);return}let c=n.length>s.length,f=s[0]||null;if(c&&!f&&(f=gt(e,t,r,a),!f))throw new R(l.path);let u=s.map(b=>yt(e,b,o,a)),d=null;if(c&&f){d=e.clone(f),a.templateAttr&&e.removeAttr(d,a.templateAttr);let b=e.stripIds(d);b>0&&console.warn(`[hyper-html-api] stripped ${b} id attribute(s) from cloned template at "${l.path.join(".")||"(root)"}"`)}let m=ft(n,u,o,ht(e,s,n,l,a)),p=s.length>0?e.parent(s[0]):xt(e,t,r,f,l,a),w=s.length>0?$e(e,p,s[0]):0,v=Ot(e,s),h=new Set,y=[],g=n.map((b,E)=>{let k=m[E];if(k>=0)return h.add(k),y.push(!1),s[k];y.push(!0);let T=e.clone(d);return e.stripIds(T),T});s.forEach((b,E)=>{h.has(E)||e.remove(b)}),v?Tt(e,p,w,g,y):Et(e,g,y,p,w),mt(e,g,o,n,l,i,a),F(a,"onRowsApplied",l.path,g)}function F(e,t,r,o){if(typeof e[t]=="function")try{return e[t](r.slice(),o)}catch(n){console.warn(`[hyper-html-api] ${t} threw at "${r.join(".")||"(root)"}"`,n);return}}function ht(e,t,r,o,n){let l=F(n,"identifyRows",o.path,r);if(!Array.isArray(l))return null;let i=new Array(r.length).fill(-1),a=new Set,s=new Map(t.map((c,f)=>[e.identity(c),f]));for(let c=0;c<r.length;c++){if(!l[c])continue;let f=s.get(e.identity(l[c]));f===void 0||a.has(f)||(i[c]=f,a.add(f))}return i}function mt(e,t,r,o,n,l,i){t.forEach((a,s)=>{if(r===null){let c=o[s],f=c==null?"":String(c);e.text(a)!==f&&e.text(a,f)}else{let c=l(e,a,r,o[s],{depth:n.depth+1,path:[...n.path,s]},i);c&&c!==a&&(t[s]=c)}})}function yt(e,t,r,o){return r===null?e.text(t):ke(e,t,r,o.onRowsRead?{...o,onRowsRead:void 0}:o)}function $e(e,t,r){let o=e.children(t);for(let n=0;n<o.length;n++)if(e.sameNode(o[n],r))return n;return-1}function gt(e,t,r,o){if(!o.templateAttr)return null;let n=/^\s*:scope\s*>\s*/.test(r),l=new RegExp(":not\\(\\["+o.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),i=r.replace(/^\s*:scope\s*>\s*/,"").replace(l,""),a=n?wt(i):0,s=ve(i),c=t;for(;c;){let f=e.find(c,i,{includeRulesTag:!1,templateAttr:null});for(let u of f)if(e.attr(u,o.templateAttr)!=null&&!(n&&!bt(e,t,u,a))&&!(s&&!e.matches(e.parent(u),s)))return u;c=e.parent(c)}return null}function wt(e){let t=0,r=null,o=1;for(let n=0;n<e.length;n++){let l=e[n];if(l==="\\")n++;else if(r)l===r&&(r=null);else if(l==='"'||l==="'")r=l;else if(l==="["||l==="(")t++;else if(l==="]"||l===")")t>0&&t--;else if(t===0&&l===">")o++;else{if(t===0&&(l==="+"||l==="~"))return null;if(t===0&&/\s/.test(l)){if(!vt(e,n))return null;for(;n+1<e.length&&/\s/.test(e[n+1]);)n++}}}return o}function vt(e,t){let r=t;for(;r<e.length&&/\s/.test(e[r]);)r++;let o=t>0?e[t-1]:"",n=r<e.length?e[r]:"";return le(o)||le(n)}function le(e){return e===">"||e==="+"||e==="~"}function bt(e,t,r,o){if(o===null)return!0;let n=r;for(let s=0;s<o;s++)if(n=e.parent(n),!n)return!1;let l=e.prop(t,"tagName");if(!l)return!0;let i=e.prop(n,"tagName");if(!i||String(i).toLowerCase()!==String(l).toLowerCase())return!1;let a=new Set(ie(e,n));return ie(e,t).every(s=>a.has(s))}function ie(e,t){let r=e.attr(t,"class");return r?String(r).split(/\s+/).filter(Boolean):[]}function xt(e,t,r,o,n,l){let i=e.parent(o);if(i&&At(e,t,i)&&!se(e,i,l))return i;let a=ve(r);if(!a)throw new R(n.path,`the list selector "${r}" names no container to hold the new rows \u2014 write it as "container > row" (for example "ol.comments > li") so the cloned row lands in the list`);let s=(a===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,a,l)).filter(c=>!se(e,c,l));if(s.length===0)throw new R(n.path,`no container matching "${a}" inside this context to hold the new rows`);if(s.length>1)throw new R(n.path,`"${a}" matches ${s.length} containers inside this context, so the new rows have no single destination`);return s[0]}function At(e,t,r){let o=r;for(;o;){if(e.sameNode(o,t))return!0;o=e.parent(o)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(n=>e.sameNode(n,r))}var ae=["no-data","editor-ui"];function se(e,t,r){let o=t;for(;o;){if(r.templateAttr&&e.attr(o,r.templateAttr)!=null||ae.some(l=>e.attr(o,l)!=null))return!0;let n=e.attr(o,"clay");if(n&&n.split(/\s+/).some(l=>ae.includes(l)))return!0;o=e.parent(o)}return!1}function Tt(e,t,r,o,n){let l=e.children(t),i=l.map(s=>e.identity(s)),a=!1;o.forEach((s,c)=>{let f=e.identity(s),u=r+c;if(i[u]===f)return;if(!n[c]){let m=i.indexOf(f);m!==-1&&(i.splice(m,1),l.splice(m,1))}let d=Math.min(u,l.length);d<l.length?e.insertBefore(l[d],s):l.length?a?e.insertAfter(l[l.length-1],s):(e.insertAt(t,s,u),a=!0):e.insertAt(t,s,0),i.splice(d,0,f),l.splice(d,0,s)})}function Ot(e,t){if(t.length<=1)return!0;let r=e.parent(t[0]);if(!r)return!1;let o=new Map(e.children(r).map((l,i)=>[e.identity(l),i])),n=[];for(let l of t){let i=o.get(e.identity(l));if(i===void 0)return!1;n.push(i)}return n.sort((l,i)=>l-i),n[n.length-1]-n[0]===n.length-1}function Et(e,t,r,o,n){let l=null,i=n;for(let a=0;a<t.length;a++){if(!r[a]){l=t[a];continue}let s=l?e.parent(l):o;if(!s)continue;let c=l?$e(e,s,l)+1:i++;e.insertAt(s,t[a],c),l=t[a]}}function kt(e,t,r,o,n={}){if(Object.prototype.hasOwnProperty.call(n,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");Ee(r,n);let l=[];if(z(r,o,[],l),l.length)throw new ye(l);I(e,t,r,o,{depth:0,path:[]},n)}function I(e,t,r,o,n,l={}){if(n.depth>L)throw new G(n.path);if(o===void 0)return t;if(typeof r=="string")return Nt(e,t,r,o,n,l);if(Array.isArray(r)){let[i,a]=r;return Re(e,t,i,a,o,n,I,l),t}if(typeof r=="object"&&r!==null){for(let[i,a]of Object.entries(r)){let s=I(e,t,a,o==null?o:o[i],{depth:n.depth+1,path:[...n.path,i]},l);s&&s!==t&&(t=s)}return t}return t}function Nt(e,t,r,o,n,l){if(r.endsWith("[]")){let u=r.slice(0,-2);return Re(e,t,u,null,o,n,I,l),t}let i=Oe(r,l);if(i){let u=i.selector?e.find(t,i.selector,l):[t];return u.length&&i.codec.write(e,u[0],o,{query:l.query}),t}if(r.startsWith("@"))return ce(e,t,r.slice(1),o);let a=M(r);if(a!==-1){let{selector:u,all:d}=j(r),m=r.slice(a+1),p=u?e.find(t,u,l):[t];for(let w of d?p:p.slice(0,1))ce(e,w,m,o);return t}if(r===".")return ue(e,t,o),t;let{selector:s,all:c}=j(r),f=e.find(t,s,l);for(let u of c?f:f.slice(0,1))ue(e,u,o);return t}function ue(e,t,r){let o=r==null?"":String(r);e.text(t)!==o&&e.text(t,o)}function St(e,t,r,o){if(e.styleVar){e.styleVar(t,r,o);return}it(e,t,r,o)}function ce(e,t,r,o){if(be(r))return St(e,t,r,o==null?"":String(o).trim()),t;if(he.has(r)){let n=e.prop(t,r);if(n===o||n!=null&&o!=null&&String(n)===String(o))return t;throw new ge(r)}if(r==="outerHTML"){let n=o==null?"":String(o);return e.replaceWith(t,n)}if(_e.has(r)){let n=Je(r,o);return e.prop(t,r)!==n&&e.prop(t,r,n),t}if(o==null)e.attr(t,r)!=null&&e.removeAttr(t,r);else{let n=String(o);e.attr(t,r)!==n&&e.attr(t,r,n)}return t}function z(e,t,r,o){if(t!==void 0){if(typeof e=="string"){if(P(e))return;if(e.endsWith("[]")){Array.isArray(t)?t.forEach((n,l)=>{typeof n=="object"&&n!==null&&o.push({path:S([...r,l]),expected:"scalar",got:N(n)})}):o.push({path:S(r),expected:"array",got:N(t)});return}t!==null&&typeof t=="object"&&o.push({path:S(r),expected:"scalar",got:N(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){o.push({path:S(r),expected:"array",got:N(t)});return}let n=e[1];t.forEach((l,i)=>z(n,l,[...r,i],o));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){o.push({path:S(r),expected:"object",got:N(t)});return}for(let[n,l]of Object.entries(e))z(l,t[n],[...r,n],o)}}}function N(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function S(e){return e.join(".")}function Rt(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(n){let l=[],i=0;for(;i<n.length;){let a=n[i];if(/\s/.test(a)){i++;continue}if("{}".includes(a)){l.push({type:a,value:a}),i++;continue}if(a==="["){let u=!1,d=i+1;for(;d<n.length&&/\s/.test(n[d]);)d++;if(d<n.length&&/[a-zA-Z_]/.test(n[d])&&(u=!0),!u){l.push({type:a,value:a}),i++;continue}}if(a==="]"){l.push({type:a,value:a}),i++;continue}if(a===":"){l.push({type:t.COLON,value:a}),i++;continue}if(a===","){l.push({type:t.COMMA,value:a}),i++;continue}if(a==='"'||a==="'"){let u=a,d=i+1;for(;d<n.length&&n[d]!==u;)n[d]==="\\"&&d++,d++;l.push({type:t.STRING,value:n.substring(i+1,d),quoted:!0,sourceQuote:u}),i=d+1;continue}let s=i,c;for(;s<n.length&&!/[{},]/.test(n[s]);)if(n[s]===":"){let u=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],d=!1;for(let m of u){let p=m.substring(1);if(n.substring(s+1,s+1+p.length)===p){d=!0,s+=p.length;break}}if(!d)break}else if(n[s]==="["){for(s++;s<n.length&&n[s]!=="]";){if(n[s]==='"'||n[s]==="'"){let u=n[s];for(s++;s<n.length&&n[s]!==u;)n[s]==="\\"&&s++,s++}s++}s<n.length&&n[s]==="]"&&s++}else s++;c=n.substring(i,s);let f=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(c)?f=t.NUMBER:c==="true"||c==="false"||c==="null"?f=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(c)&&(f=t.SELECTOR),l.push({type:f,value:c,quoted:!1}),i=s}return l}function o(n){let l="";for(let i=0;i<n.length;i++){let a=n[i];if("{}".includes(a.type)||"[]".includes(a.type)){l+=a.value;continue}if(a.type===t.COLON){l+=a.value;continue}if(a.type===t.COMMA){let s=n[i+1];if(s&&(s.type==="}"||s.type==="]"))continue;l+=a.value;continue}if(a.type===t.STRING&&a.quoted){let s=a.value;a.sourceQuote==="'"&&(s=s.replace(/\\'/g,"'"),s=s.replace(/(\\*)"/g,(c,f)=>f.length%2===0?f+'\\"':c)),l+=`"${s}"`;continue}if(a.type===t.NUMBER||a.type===t.BOOLEAN){l+=a.value;continue}if(a.type===t.SELECTOR||a.type===t.IDENTIFIER){l+=`"${a.value}"`;continue}l+=`"${a.value}"`}return l}try{let n=r(e),l=o(n);return JSON.parse(l)}catch(n){throw new $("Invalid extraction rules syntax: "+n.message,n)}}var $t=["1","2"];var Ar=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),Tr=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),jt=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);var Or=Object.freeze({refusedRuleForms:["innerHTML","outerHTML"],refusedTargets:["script","style","template","noscript","iframe","object","embed","xmp","plaintext","noembed","noframes","meta","link","base","animate","set","animatemotion","animatetransform"],refusedAttributes:["style","srcdoc","is","http-equiv","sandbox","allow","nonce","integrity","charset","htmlclaytoken","htmlclayid","data-rules-name","data-rules-version","clay","contenteditable",...jt],refusedAttributePrefixes:["on"],urlAttributes:["href","src","srcset","action","formaction","poster","cite","data","ping","background","longdesc","usemap","xlink:href","manifest","codebase","icon"],refusedSchemes:["javascript","vbscript","data"],customPropertyValues:Object.freeze({maxLength:200,refusedCharacters:[";","{","}","<",">","\\"],refusedFunctions:["url","src","image","image-set","-webkit-image-set","cross-fade","element","expression","paint"]})});function Ct(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function Lt(e){return e?(e.nodeType===9||e.nodeType,e):null}function fe(e,t,r){!e||e.nodeType!==1||(t==="value"&&e.tagName==="INPUT"?e.value=r===null?"":r:t==="checked"&&e.tagName==="INPUT"?e.checked=r!==null:t==="selected"&&e.tagName==="OPTION"&&(e.selected=r!==null))}function Mt(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function Ut(e){if(!e||e.nodeType!==1)return;let t=[e,...e.querySelectorAll?e.querySelectorAll("textarea, input, option"):[]];for(let r of t)if(r.tagName==="TEXTAREA")r.value=r.defaultValue;else if(r.tagName==="INPUT"){let o=r.type;o!=="file"&&o!=="checkbox"&&o!=="radio"&&(r.value=r.defaultValue),r.checked=r.defaultChecked}else r.tagName==="OPTION"&&(r.selected=r.defaultSelected)}var It={semanticExclude:!0,find(e,t,r={}){let o=Lt(e);if(!o||!o.querySelectorAll)return[];let n=Array.from(o.querySelectorAll(t));r.includeRulesTag||(n=n.filter(a=>!Ct(a)));let l=[];r.skip&&l.push(r.skip);let i=r.templateAttr===null?null:r.templateAttr||"cms-template";if(i&&l.push("["+i+"]"),l.length){let a=l.join(", ");n=n.filter(s=>!s.closest||!s.closest(a))}return n},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},matches(e,t){return!!(e&&e.matches)&&e.matches(t)},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t,Mt(e,t)},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r),fe(e,t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),fe(e,t,null)},prop(e,t,r){if(r===void 0){let o=e?e[t]:void 0;return o!==void 0?o:null}e[t]=r},clone(e){let t=e.cloneNode(!0);return Ut(t),t},insertAt(e,t,r){let o=e.children[r]||null;e.insertBefore(t,o)},insertBefore(e,t){e.parentNode.insertBefore(t,e)},insertAfter(e,t){e.parentNode.insertBefore(t,e.nextSibling)},identity(e){return e||null},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let r=e.ownerDocument.createElement("template");r.innerHTML=t;let o=r.content.firstElementChild;if(!o)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(o,e),o},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(r=>{r.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};var U=It;var Pt="hha:upgrade-check:";function x(e,t){let r=e.querySelector(`meta[name="${t}"]`),o=r?r.getAttribute("content"):null;return o&&o.trim()?o.trim():null}function de(e){if(typeof e!="string")return null;let t=e.trim().replace(/^v/,"");return/^\d+(\.\d+)*$/.test(t)?t.split(".").map(Number):null}function Dt(e,t){let r=de(e),o=de(t);if(!r||!o)return!1;let n=Math.max(r.length,o.length);for(let l=0;l<n;l++){let i=r[l]||0,a=o[l]||0;if(i!==a)return i>a}return!1}function qt(e){try{let t=globalThis.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function Ht(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}async function Bt({force:e=!1,doc:t,loc:r,fetchFn:o,now:n,ttlMs:l=864e5}={}){if(t=t||(typeof document<"u"?document:null),r=r||(typeof location<"u"?location:null),o=o||(d=>fetch(d)),n=n??Date.now(),!t)return null;let i=x(t,"hyper-source");if(!i)return null;let a=x(t,"hyper-version"),s;try{s=new URL(i,r?r.href:void 0)}catch{return null}if(r&&s.origin===r.origin&&s.pathname===r.pathname)return null;let c=`${Pt}${s.href}:${a||"none"}`,f,u=e?null:qt(c);if(u&&typeof u.checkedAt=="number"&&n-u.checkedAt<l)f=u.sourceVersion;else{try{let d=await o(s.href);if(!d.ok)throw new Error(`HTTP ${d.status}`);let m=await d.text(),p=new DOMParser().parseFromString(m,"text/html");f=x(p,"hyper-version")}catch{f=null}Ht(c,{checkedAt:n,sourceVersion:f})}return f?{available:Dt(f,a||"0.0.0"),currentVersion:a,sourceVersion:f,sourceUrl:s.href}:null}var Wt="script[data-rules-name]";function Vt(e){return typeof e=="string"?e.trim().replace(/\s+/g," "):""}function je(e,t){let r=e.find(t,Wt,{includeRulesTag:!0}),o=new Set,n=[];for(let l of r){let i=Vt(e.attr(l,"data-rules-name"));if(!i)continue;if(o.has(i)){console.warn(`hyper-html-api: duplicate rules tag name "${i}"; using the first.`);continue}let a=e.attr(l,"data-rules-version");if(!$t.includes(a))throw new me(a);o.add(i),n.push({name:i,rules:Rt(e.text(l)),version:a})}return n}function Ce(e,t){if(t!=="2"||!e||typeof e!="object"||Array.isArray(e))return{rules:e,carried:[]};let r={},o=[];for(let[n,l]of Object.entries(e)){let i=P(l);i?o.push({key:n,selector:i.selector}):r[n]=l}return{rules:r,carried:o}}function Le(e,t,r){return e.find(t,r)[0]||null}function Me(e,t){let r={};for(let{name:o,rules:n,version:l}of je(e,t)){let{rules:i,carried:a}=Ce(n,l),s=ke(e,t,i,{version:l});for(let{key:c,selector:f}of a){let u=Le(e,t,f);s[c]=u?e.prop(u,"innerHTML"):null}r[o]=s}return r}function Ft(e){let t=e||document,r=t.nodeType===9?t:t.ownerDocument||t;return{dataByName:Me(U,t),version:x(r,"hyper-version")}}var pe=class extends Error{constructor(e,t){super(`could not fetch upgrade source: ${e}`),this.name="UpgradeSourceUnreachable",this.sourceUrl=e,this.cause=t}},zt=class extends Error{constructor(e){super(`upgrade source has no rules tags; refusing to drop all existing data: ${e}`),this.name="UpgradeSourceHasNoRules",this.sourceUrl=e}},_=class extends Error{constructor(e,t){super(e),this.name="UpgradeTransformInvalid",this.cause=t}},_t=class extends Error{constructor(e){super(`found ${e} script[type="text/hyper-upgrade"] tags; only one is allowed per document.`),this.name="UpgradeMultipleTransforms",this.count=e}},Jt="text/hyper-upgrade";function Yt(e,t){let r=e.find(t,`script[type="${Jt}"]`);if(r.length===0)return null;if(r.length>1)throw new _t(r.length);return e.text(r[0])||null}var Gt=new Function("url","return import(url)");async function Xt(e){let t=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(t),o;try{o=await Gt(r)}catch(n){throw new _(`transform failed to load: ${n&&n.message?n.message:n}`,n)}finally{URL.revokeObjectURL(r)}if(typeof o.default!="function")throw new _("transform must `export default` a function");return o.default}function Ue(e,t){let r={carriedOver:0,discarded:0,listItems:0},o=J(t,e,r);return Y(t,e,r),{data:o,summary:r}}function J(e,t,r,o=!1){if(typeof e=="string")return e.endsWith("[]")?Array.isArray(t)?(r.listItems+=t.length,r.carriedOver+=t.length,t):o?[]:void 0:t==null||typeof t=="object"?o&&!Kt(e)?null:void 0:(r.carriedOver++,t);if(Array.isArray(e)){let[,n]=e;return Array.isArray(t)?(r.listItems+=t.length,t.map(l=>J(n,l,r,!0))):o?[]:void 0}if(typeof e=="object"&&e!==null){let n={};for(let[l,i]of Object.entries(e)){let a=J(i,t?.[l],r,o);a!==void 0&&(n[l]=a)}return n}}function Kt(e){let t=M(e);return t!==-1&&he.has(e.slice(t+1))}function Y(e,t,r){if(t!=null){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){if(typeof t!="object"||Array.isArray(t))return;let o=new Set(Object.keys(e));for(let n of Object.keys(t))o.has(n)?Y(e[n],t[n],r):r.discarded+=C(t[n]);return}if(Array.isArray(e)&&Array.isArray(t)){let o=e[1];t.forEach(n=>Y(o,n,r));return}typeof e=="string"&&!e.endsWith("[]")&&typeof t=="object"&&t!==null&&(r.discarded+=C(t))}}function C(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+C(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+C(r),0):1}function Zt(e,t,r){let o=je(e,t),n={carriedOver:0,discarded:0,listItems:0},l={},i=new Set;for(let{name:a,rules:s,version:c}of o){if(i.add(a),!Object.prototype.hasOwnProperty.call(r,a)){l[a]={carriedOver:0,discarded:0,listItems:0};continue}let{rules:f,carried:u}=Ce(s,c),d=r[a],{data:m,summary:p}=Ue(Qt(d,u),f);kt(e,t,f,m,{templateAttr:"cms-template"});for(let{key:w,selector:v}of u){let h=Ie(d)?d[w]:void 0;if(h==null)continue;let y=Le(e,t,v);typeof h=="string"&&y?(e.prop(y,"innerHTML",h),p.carriedOver+=1):p.discarded+=1}l[a]=p,n.carriedOver+=p.carriedOver,n.discarded+=p.discarded,n.listItems+=p.listItems}for(let a of Object.keys(r))i.has(a)||(n.discarded+=C(r[a]));return{totals:n,byName:l,rulesTagCount:o.length}}function Ie(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qt(e,t){if(!t.length||!Ie(e))return e;let r={...e};for(let{key:o}of t)delete r[o];return r}async function er({sourceUrl:e,dataByName:t,fromVersion:r,doc:o,loc:n,fetchFn:l}={}){if(o=o||(typeof document<"u"?document:null),n=n||(typeof location<"u"?location:null),l=l||(h=>fetch(h)),!o)throw new Error("upgrade.run requires a document context");if(e=e||x(o,"hyper-source"),!e)throw new Error("upgrade.run: no sourceUrl given and no hyper-source meta tag found");let i=new URL(e,n?n.href:void 0);r=r!==void 0?r:x(o,"hyper-version"),t=t||Me(U,o);let a;try{a=await l(i.href)}catch(h){throw new pe(i.href,h)}if(!a.ok)throw new pe(i.href,new Error(`HTTP ${a.status}`));let s=await a.text(),c=new DOMParser().parseFromString(s,"text/html"),f=x(c,"hyper-version"),u=t,d=!1,m=Yt(U,c);if(m){let h=await(await Xt(m))(u,{fromVersion:r,toVersion:f});if(!h||typeof h!="object"||Array.isArray(h))throw new _("transform must return a plain object map of { rulesName: data }");u=h,d=!0}let{totals:p,byName:w,rulesTagCount:v}=Zt(U,c,u);if(v===0&&Object.keys(u).length>0)throw new zt(i.href);return{html:rr(c),fromVersion:r,toVersion:f,summary:{transformApplied:d,totals:p,byName:w}}}function tr(e){for(let t of e.querySelectorAll("input")){let r=(t.getAttribute("type")||"").toLowerCase();r!=="file"&&(r==="checkbox"||r==="radio"?t.checked!==t.hasAttribute("checked")&&t.toggleAttribute("checked",t.checked):t.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",t.value))}for(let t of e.querySelectorAll("textarea"))t.value!==t.textContent&&(t.textContent=t.value);for(let t of e.querySelectorAll("select")){let r=[...t.options];if(!t.multiple){let o=r.findIndex(n=>n.hasAttribute("selected"));if(t.selectedIndex===o||o===-1&&t.selectedIndex<=0)continue}for(let o of r)o.selected!==o.hasAttribute("selected")&&o.toggleAttribute("selected",o.selected)}}function rr(e){return tr(e),`<!DOCTYPE ${e.doctype&&e.doctype.name?e.doctype.name:"html"}>
|
|
2
|
-
`+e.documentElement.outerHTML}var D={checkForUpdate:Bt,run:er,extractAll:Ft,shapeMatch:Ue};var A="The new version could not be downloaded. Nothing was changed.",q="The upgrade could not be saved. Nothing was changed.",qe="This document changed somewhere else. Reload and try again.",nr="Something else is changing this document. Nothing was changed.",or="This document does not say which parts are its data, so it cannot be upgraded safely. Nothing was changed.",lr="The new version has no place for this page's content. Nothing was changed.";async function ir(e){let t=globalThis.crypto&&globalThis.crypto.subtle;if(!t)return null;let r=await t.digest("SHA-256",e);return[...new Uint8Array(r)].map(o=>o.toString(16).padStart(2,"0")).join("")}async function Pe(e,t){try{let r=await e(t,{credentials:"omit"});return!r||!r.ok?null:r}catch{return null}}function ar(e,t,r){if(e&&typeof e.latestUrl=="string"&&e.latestUrl)return e.latestUrl;let o=x(t,"hyper-source");if(!o)return null;try{let n=new URL(o,r?r.href:void 0);return n.pathname=n.pathname.replace(/\.html$/,".json"),n.href}catch{return null}}function sr(e){let t=x(e,"clay-template");if(!t)return null;let[r,o]=t.split(/\s+/);return r&&o?{id:r,variant:o}:null}function H(e,t="",r=[]){if(Array.isArray(e)){for(let o of e)H(o,`${t}[]`,r);return r}if(e&&typeof e=="object"){for(let[o,n]of Object.entries(e))H(n,t?`${t}.${o}`:o,r);return r}return e!=null&&r.push({path:t,value:e}),r}function ur(e,t){let r=[e];for(let o of String(t).split(".")){let n=o.endsWith("[]"),l=n?o.slice(0,-2):o,i=[];for(let a of r){let s=l?a?.[l]:a;n?Array.isArray(s)&&i.push(...s):i.push(s)}r=i}return r}function cr(e,t,r={}){let o=new Map;for(let{path:l,value:i}of H(t)){let a=`${l}\0${String(i)}`;o.set(a,(o.get(a)||0)+1)}let n=[];for(let{path:l,value:i}of H(e)){let a=`${l}\0${String(i)}`;if(o.get(a)>0){o.set(a,o.get(a)-1);continue}let s=r[l];typeof s=="string"&&ur(t,s).some(c=>c===i)||n.push({path:l,value:i})}return n}async function fr(e){let t=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(t);try{return await new Function("url","return import(url)")(r)}finally{URL.revokeObjectURL(r)}}async function dr(e){let r=new DOMParser().parseFromString(e,"text/html").querySelector('script[type="text/hyper-upgrade"]');if(!r)return{};let o=await fr(r.textContent||"");return o&&o.renames&&typeof o.renames=="object"?o.renames:{}}var De='script[clay~="live"][merge]';function pr(e,t,r){let o=t.querySelector("article[data-blockeditor]");if(!o)return null;o.replaceWith(t.importNode(r,!0));for(let l of e.querySelectorAll(De)){let i=l.getAttribute("merge");if(i!=="blockeditor"&&!i.startsWith("blockeditor."))continue;let a=t.importNode(l,!0),s=[...t.querySelectorAll(De)].find(c=>c.getAttribute("merge")===i);s?s.replaceWith(a):t.querySelector("article[data-blockeditor]").after(a)}return(t.doctype?`<!DOCTYPE ${t.doctype.name}>
|
|
3
|
-
`:"")+t.documentElement.outerHTML}async function He(e,{doc:t=document,loc:r=location,fetchFn:o=(n,l)=>fetch(n,l)}={}){if((typeof window<"u"&&window.clay||{}).isDraftMode)return{ok:!1,code:"draft"};if(!e||typeof e.version!="string")return{ok:!1,code:"unavailable",message:A};let l=ar(e,t,r);if(!l)return{ok:!1,code:"unavailable",message:A};let i=await Pe(o,l);if(!i)return{ok:!1,code:"unavailable",message:A};let a;try{a=await i.json()}catch{return{ok:!1,code:"unavailable",message:A}}if(!a||typeof a!="object")return{ok:!1,code:"unavailable",message:A};let s=sr(t);if(!s||a.id!==s.id||a.variant!==s.variant)return{ok:!1,code:"template",message:"This upgrade is for a different document."};let c=x(t,"hyper-version");if(!c||typeof a.version!="string"||!Q(a.version,c))return{ok:!1,code:"not-newer",message:"There is no newer version to install."};if(typeof a.html!="string"||!a.html)return{ok:!1,code:"unavailable",message:A};let f;try{f=new URL(a.html,l).href}catch{return{ok:!1,code:"unavailable",message:A}}if(!/^https:\/\/hyperclay\.com\/templates\//.test(f))return{ok:!1,code:"source",message:"This upgrade is not from the template host."};let u=await Pe(o,f);if(!u)return{ok:!1,code:"unavailable",message:A};let d;try{d=await u.text()}catch{return{ok:!1,code:"unavailable",message:A}}let m=await ir(new TextEncoder().encode(d));if(!m||m!==String(a.sha256||"").toLowerCase())return{ok:!1,code:"unavailable",message:A};let p,w;try{w=await dr(d),p=await D.run({sourceUrl:f,doc:t,loc:r,fromVersion:c,fetchFn:async()=>({ok:!0,status:200,text:async()=>d})})}catch(T){return{ok:!1,code:"transform",message:T&&T.message?T.message:A}}let v=new DOMParser().parseFromString(p.html,"text/html"),h=D.extractAll(t).dataByName,y=t.querySelector("article[data-blockeditor]");if(!y&&!Object.keys(h||{}).length)return{ok:!1,code:"undeclared",message:or};let g=p.html;if(y){let T=pr(t,v,y);if(!T)return{ok:!1,code:"lost",lost:[],discarded:0,message:lr};g=T}let b=D.extractAll(v).dataByName,E=cr(h,b,w),k=p.summary&&p.summary.totals&&p.summary.totals.discarded||0;return E.length||k>0?{ok:!1,code:"lost",lost:E,discarded:k,message:hr(E,k)}:{ok:!0,html:g,version:p.toVersion||a.version}}function hr(e,t){let r=e.slice(0,5).map(({path:n})=>n),o=e.length>r.length?` and ${e.length-r.length} more`:"";return r.length?`This upgrade would lose data: ${r.join(", ")}${o}. Nothing was changed.`:`This upgrade would lose ${t} value${t===1?"":"s"}. Nothing was changed.`}function mr(e){let t=e&&e.state;if(t==="conflict")return{ok:!1,code:"conflict",message:qe};let r=e&&e.message?e.message:"The document could not be saved.";return{ok:!1,code:"flush",state:t||"failed",message:r}}async function Be(e,{doc:t=document,loc:r=location,fetchFn:o=(s,c)=>fetch(s,c),clay:n=typeof window<"u"?window.clay:null,reload:l=()=>window.location.reload(),replace:i=null,etag:a}={}){if((n||{}).isDraftMode)return{ok:!1,code:"draft"};let c=K("upgrade");if(!c)return{ok:!1,code:"busy",message:nr};try{return await yr(e,{doc:t,loc:r,fetchFn:o,clay:n,reload:l,replace:i,etag:a})}finally{Z(c)}}async function yr(e,{doc:t,loc:r,fetchFn:o,clay:n,reload:l,replace:i,etag:a}){let s=n||{};if(s.isEditMode&&s.save&&typeof s.save.flush=="function"){let p;try{p=await s.save.flush()}catch(w){return mr(w)}if(p&&typeof p.state=="string"&&p.state!=="saved"&&p.state!=="clean"&&p.state!=="view")return{ok:!1,code:"flush",state:p.state,message:"This document has changes that could not be saved. Nothing was changed."}}if(a===void 0&&!B())try{await X()}catch{}let c=a!==void 0?a:B(),f=t;if(s.isEditMode&&typeof s.getHTML=="function")try{f=new DOMParser().parseFromString(await s.getHTML(),"text/html")}catch{return{ok:!1,code:"failed",message:q}}else f=new DOMParser().parseFromString(`<!DOCTYPE html>
|
|
4
|
-
`+t.documentElement.outerHTML,"text/html");let u=await He(e,{doc:f,loc:r,fetchFn:o});if(!u.ok)return u;let d=typeof i=="function"?i:s.save&&typeof s.save.replace=="function"?s.save.replace:ee,m;try{m=await d(u.html,{etag:c})}catch{return{ok:!1,code:"failed",message:q}}if(!m||!m.ok){let p=m&&m.code?m.code:"failed";return p==="conflict"?{ok:!1,code:p,message:qe}:p==="forbidden"?{ok:!1,code:p,message:"You are not allowed to save this document."}:p==="unsupported"?{ok:!1,code:p,message:"This host cannot save the upgrade."}:{ok:!1,code:p,message:q}}return l(),{ok:!0,html:u.html,version:u.version,etag:m.etag}}function O(e,t,r={}){let o=e.createElement(t);o.setAttribute("clay","editor-ui");for(let[n,l]of Object.entries(r))n==="style"?o.setAttribute("style",l):n==="text"?o.textContent=l:o.setAttribute(n,l);return o}function gr(e){let r=(e&&e.pathname?e.pathname:"/").split("/").filter(Boolean).pop()||"page.html";try{r=decodeURIComponent(r)}catch{}return/\.html?$/i.test(r)?r:`${r}.html`}async function wr(e,{loc:t=location,fetchFn:r=(o,n)=>fetch(o,n)}={}){if(typeof e.getHTML=="function")return e.getHTML();let o=await r(t.href,{cache:"no-store",credentials:"same-origin"});if(!o.ok)throw new Error(`copy fetch ${o.status}`);return o.text()}async function vr({clay:e,doc:t=document,loc:r=location,fetchFn:o}={}){if(typeof URL>"u"||typeof URL.createObjectURL!="function")return!1;try{let n=await wr(e,{loc:r,fetchFn:o});if(typeof n=="string"&&/clay|data-paid-only/i.test(n)){let{stripCopyContent:a}=await import("./c-C4IIQZGJ.js");n=a(n)}let l=URL.createObjectURL(new Blob([n],{type:"text/html"})),i=t.createElement("a");return i.setAttribute("clay","editor-ui"),i.href=l,i.download=gr(r),i.style.setProperty("display","none","important"),t.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(l),4e4),!0}catch{return!1}}async function br(e){let t=e&&e.host;if(!t||!t.versions)return!1;try{return await t.versions===!0}catch{return!1}}async function xr(e,t={}){let r=t.doc||document,o=t.clay||(typeof window<"u"?window.clay:null)||{};if(o.isDraftMode||!e||typeof e.version!="string")return null;let n=await br(o),l=O(r,"div",{role:"dialog","aria-modal":"true","data-clay-upgrade":"",style:"position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(15,17,21,.42);font-family:system-ui,-apple-system,'Segoe UI',sans-serif;"}),i=O(r,"div",{style:"width:min(460px,100%);padding:20px;border-radius:14px;background:var(--clay-ui-bg,#fff);color:var(--clay-ui-fg,#1f2328);box-shadow:0 18px 48px -16px rgba(0,0,0,.55);font-size:14px;line-height:1.5;"}),a=O(r,"h2",{text:`Upgrade to version ${e.version}`,style:"margin:0 0 8px;font-size:16px;"}),s=O(r,"p",{text:`Your data moves into version ${e.version}. The page's layout and code are replaced; your current version stays in this document's history.`,style:"margin:0 0 16px;"}),c=O(r,"p",{role:"status",style:"margin:0 0 12px;min-height:1.5em;"}),f=O(r,"div",{style:"display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;"}),u="padding:7px 12px;border-radius:8px;border:1px solid rgba(23,28,36,.2);background:transparent;color:inherit;font:inherit;cursor:pointer;",d=O(r,"button",{type:"button",text:"Cancel",style:u}),m=n?null:O(r,"button",{type:"button",text:"Download a copy first",style:u}),p=O(r,"button",{type:"button",text:"Upgrade",style:`${u}border-color:transparent;background:#2f6fed;color:#fff;font-weight:600;`});n||(p.disabled=!0),m&&f.append(m),f.append(d,p),i.append(a,s,c,f),l.append(i),r.body.appendChild(l);let w=!1,v=()=>{w||(w=!0,l.remove())};m&&m.addEventListener("click",async()=>{await vr({clay:o,doc:r,loc:t.loc,fetchFn:t.fetchFn})?(p.disabled=!1,c.textContent="Your copy was downloaded."):c.textContent="The copy could not be downloaded. Nothing was changed."}),d.addEventListener("click",v);let h,y=new Promise(g=>{h=g});return p.addEventListener("click",async()=>{p.disabled=!0,m&&(m.disabled=!0),c.textContent=`Upgrading to version ${e.version}\u2026`;let g=await Be(e,t);if(g.ok){v(),h(g);return}c.textContent=g.message||q,p.disabled=!1,m&&(m.disabled=!1),h(g)}),{root:l,title:a,body:s,status:c,cancel:d,download:m,upgrade:p,close:v,done:y}}export{Be as apply,He as prepare,xr as start};
|
package/dist/m/c-CVSWLX3X.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as T}from"./c-BPF2NSPV.js";import{b as f}from"./c-CYWLPPUS.js";import"./c-HA6INT6J.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var y="Saved data was overwritten",w="data-guard-done",U=6e3,L=1500,M=5e3,P=3e4,R="Could not reach the server. Try again.",j="That did not go through. Try again.",F="Save your changes first, then try again.",N="Reload the page, then try again.",n=null,l=null,m=(e,s)=>`${e} ${s}${e===1?"":"s"}`,E=e=>!!e&&typeof e.id=="string"&&e.status==="pending",I=(e,s,a,o)=>o===!0&&!e.refused.has(`${s.id}:${a}`),v=(e,s)=>I(e,s,"restore",s.restorable),c=(e,s)=>I(e,s,"revert",s.canRevert),$=()=>T()?"omit":"same-origin",k=(e={})=>({"Document-URL":location.href,...e});function p(){for(let e of document.querySelectorAll("[data-htmlclay-guard]"))e.remove()}function d(e,s){import("./c-NVU3DORS.js").then(a=>{l=a,a.default(e,s)},()=>{})}function S(e,s){let a=s.lossSummary||{},o=a.provenance==="external"?"A change from outside this page":"A save from this page",t=a.removedItems>0?`removed ${m(a.removedItems,"item")}`:a.destroyedAtoms>0?`erased ${m(a.destroyedAtoms,"value")}`:"changed saved data",i=Array.isArray(s.preview)?s.preview[0]:null,r=[`${o} ${t}.`];return i&&r.push(`${i.key}: ${i.yours} before, ${i.now} now.`),v(e,s)?s.droppedAdditions>0&&r.push(`Restoring removes ${m(s.droppedAdditions,"item")} added or changed since.`):c(e,s)?r.push("This data no longer fits the page, but the whole change can be undone."):r.push("It cannot be restored from here."),c(e,s)&&r.push("Undo the change also removes edits made since."),r.join(" ")}function x(e,s){let a=[];return v(e,s)&&a.push({label:"Restore",onClick:()=>g(e,s,"restore")}),c(e,s)&&a.push({label:"Undo the change",onClick:()=>g(e,s,"revert")}),a.push({label:"Keep as is",onClick:()=>g(e,s,"dismiss")}),a}async function b(e,s){let a=[s.id,v(e,s),c(e,s),s.lastWriteAt,S(e,s)].join("|");if(e.drawn===a)return!0;e.drawn=a,e.eventId=s.id;try{l??=await import("./c-NVU3DORS.js")}catch{return e.drawn===a&&(e.drawn=null,e.eventId=null),!1}return n!==e||e.drawn!==a?!1:(l.dismissPersistent(y,{now:!0}),l.toastPersistent(y,"warning",{detail:S(e,s),actions:x(e,s)}),!0)}function u(e){e.drawn=null,e.eventId=null,l?.dismissPersistent(y,{now:!0})}async function h(e){let s=++e.turn;e.lastRead=Date.now();let a=new AbortController,o=setTimeout(()=>a.abort(),U),t;try{let i=await fetch(e.url,{method:"GET",credentials:$(),headers:k(),cache:"no-store",redirect:"manual",signal:a.signal});if(!i.ok)return;t=await i.json()}catch{return}finally{clearTimeout(o)}if(!(n!==e||s!==e.turn)&&!(!t||typeof t!="object"||!("event"in t))){if(E(t.event)){if(e.resolved.has(t.event.id))return;await b(e,t.event)&&p();return}u(e),p()}}function D(e,s){e.resolved.add(s.id),e.eventId===s.id&&u(e)}function O(e,s,a){if(D(e,s),a==="dismiss"){d("Kept the page as it is.","info");return}f.session.set(w,a),e.reload()}function B(e,s,a,o,t){n===e&&(o===200&&t?.ok===!0?O(e,s,a):o===404?(D(e,s),d("This was already taken care of somewhere else. Reload to see the current page.","info")):o===409?(e.drawn=null,d("This page changed after the notice appeared. Check the notice and try again.","warning"),h(e)):o===422?(e.refused.add(`${s.id}:${a}`),e.eventId===s.id&&!e.resolved.has(s.id)&&b(e,s),d(a==="restore"?"That data no longer fits this page, so it could not be restored.":"That earlier version is no longer available.","warning")):d(o===401||o===403?N:o===400?j:R,"error"))}async function G(){let e=window.clay;if(!e?.hasUnsavedChanges?.())return!0;if(typeof e.save?.flush!="function")return!1;try{await e.save.flush()}catch{return!1}return!e.hasUnsavedChanges()}async function g(e,s,a){if(!(e.busy||n!==e)){e.busy=!0;try{if(a!=="dismiss"&&!await G()){n===e&&d(F,"warning");return}if(n!==e)return;let o=await fetch(e.url,{method:"POST",credentials:$(),headers:k({"Content-Type":"application/json"}),redirect:"manual",body:JSON.stringify({id:s.id,choice:a})}),t=await o.json().catch(()=>null);B(e,s,a,o.status,t)}catch{n===e&&d(R,"error")}finally{e.busy=!1}}}function K(e,s){let{msgType:a,action:o,data:t}=s.detail||{};if(a==="data-loss"){if(o==="resolved"){if(typeof t?.id!="string")return;e.turn++,e.resolved.add(t.id),e.eventId===t.id&&u(e);return}o==="raised"&&E(t)&&!e.resolved.has(t.id)&&(e.turn++,b(e,t).then(i=>{i&&p()},()=>{}))}}var A=e=>Math.max(e.lastSave+L,e.lastRead+M);function _(e){e.timer||(e.timer=setTimeout(()=>{e.timer=null,n===e&&(A(e)>Date.now()?_(e):h(e))},Math.max(A(e)-Date.now(),0)))}function q({href:e,reload:s=()=>window.location.reload()}){if(n)return;let a;try{a=new URL(e,location.href)}catch{return}if(a.origin!==location.origin)return;let o=new AbortController,t={url:a.href,reload:s,listeners:o,turn:0,lastRead:0,lastSave:0,timer:null,busy:!1,drawn:null,eventId:null,resolved:new Set,refused:new Set};n=t;let{signal:i}=o;document.addEventListener("clay:notification",C=>K(t,C),{signal:i}),document.addEventListener("clay:save-saved",()=>{t.lastSave=Date.now(),_(t)},{signal:i}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Date.now()-t.lastRead>=P&&h(t)},{signal:i});let r=f.session.get(w);r&&(f.session.remove(w),d(r==="restore"?"Your saved data is back.":"The earlier version is back.","success")),h(t)}function H(){let e=n;e&&(n=null,e.listeners.abort(),clearTimeout(e.timer),u(e))}export{q as start,H as stop};
|
package/dist/m/c-DXPOFLEJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./c-UOUUI265.js";import"./c-QHWJ5ZIJ.js";import"./c-ESK4S67I.js";import"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import"./c-5RZNFTWD.js";import"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{a as SURFACE_THEME,b as default};
|