@panphora/clayjs 1.21.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +8871 -8629
- package/dist/m/attrs/{save-freeze-MTFVVYV5.js → save-freeze-JZHKRQLR.js} +1 -1
- package/dist/m/{c-OABVRYOT.js → c-24PMUJIV.js} +1 -1
- package/dist/m/{c-EOCZ2YVL.js → c-2AYVYEI4.js} +1 -1
- package/dist/m/{c-UXEVJ63W.js → c-2L6O5PDS.js} +1 -1
- package/dist/m/{c-VBLFAQD2.js → c-2RYOGUQM.js} +1 -1
- package/dist/m/{c-LDUNOR57.js → c-2Z22FCFK.js} +13 -25
- package/dist/m/{c-NLZ5AN4L.js → c-2ZVOEU4M.js} +1 -1
- package/dist/m/{c-BJPZCWAV.js → c-37NAONZA.js} +1 -1
- package/dist/m/{c-ZE46QDIH.js → c-3TLG3OLG.js} +1 -1
- package/dist/m/{c-CSNE5EIF.js → c-4PO3YGDC.js} +1 -1
- package/dist/m/{c-OJYM642Q.js → c-5FKRZNJV.js} +1 -1
- package/dist/m/{c-SO63UGPQ.js → c-5OJ7YF2N.js} +1 -1
- package/dist/m/{c-CAWNFER6.js → c-5TIZ2I64.js} +1 -1
- package/dist/m/{c-7SXYQCN4.js → c-5WMXEKFH.js} +1 -1
- package/dist/m/{c-XQSXKIKM.js → c-6RDOKLN7.js} +1 -1
- package/dist/m/{c-BRLCTNMC.js → c-6TYGD5AB.js} +1 -1
- package/dist/m/c-A4IP6MBC.js +1 -0
- package/dist/m/{c-I2IFKJX2.js → c-ALDVFPWL.js} +1 -1
- package/dist/m/{c-LV5MABYD.js → c-AYVGD6A6.js} +1 -1
- package/dist/m/{c-LQU7TXIH.js → c-B6O7AJYG.js} +1 -1
- package/dist/m/{c-SBSMJIPC.js → c-BCGWJYXW.js} +1 -1
- package/dist/m/{c-RT3C74GY.js → c-BGKAT2FL.js} +1 -1
- package/dist/m/{c-N7Y52HJH.js → c-BXYSDKAN.js} +1 -1
- package/dist/m/c-CRPIDGXC.js +78 -0
- package/dist/m/c-CUMXGHVD.js +1 -0
- package/dist/m/{c-67ILSNPR.js → c-DTMZ3ZHI.js} +1 -1
- package/dist/m/{c-EZ7B5AZT.js → c-ELYIIYRS.js} +1 -1
- package/dist/m/{c-VAK7SG37.js → c-EUGJVHDD.js} +1 -1
- package/dist/m/{c-67LGZ52V.js → c-FCSZ3DC5.js} +1 -1
- package/dist/m/{c-JUE7B4OX.js → c-FQGHR32O.js} +1 -1
- package/dist/m/{c-ZJLU56DV.js → c-G4PWUDD5.js} +1 -1
- package/dist/m/{c-CJFDLD43.js → c-G6COVIZB.js} +1 -1
- package/dist/m/c-GBTVCJXC.js +1 -0
- package/dist/m/c-GC2HICFJ.js +1 -0
- package/dist/m/{c-44B5ODN7.js → c-HCNWJE4A.js} +2 -2
- package/dist/m/{c-BJ7YQ5QZ.js → c-IHUWUKIU.js} +1 -1
- package/dist/m/{c-LIBE4HPD.js → c-JCOQVZYS.js} +1 -1
- package/dist/m/{c-RG6XUZFA.js → c-JGHEACGK.js} +1 -1
- package/dist/m/{c-3GJ4XARY.js → c-JGLX6TBK.js} +1 -1
- package/dist/m/c-JNRKHYWO.js +1 -0
- package/dist/m/{c-PIVIYLTY.js → c-KDXIJEEF.js} +1 -1
- package/dist/m/{c-NFR673TL.js → c-L4KMT7FO.js} +2 -2
- package/dist/m/{c-E4IBSAQM.js → c-LCYPMULG.js} +1 -1
- package/dist/m/{c-SJPD46ZO.js → c-LIGQYZ7M.js} +4 -4
- package/dist/m/{c-U5X57T4L.js → c-LKIWEPAV.js} +1 -1
- package/dist/m/{c-EDSPKYMA.js → c-LUXAB2XI.js} +1 -1
- package/dist/m/{c-YSB6JKV2.js → c-LWIDDWAR.js} +2 -2
- package/dist/m/c-MPSKIU2I.js +1 -0
- package/dist/m/{c-DHXPDLW6.js → c-NK33MMYF.js} +1 -1
- package/dist/m/{c-GPGYKER7.js → c-NQLWOHLH.js} +1 -1
- package/dist/m/{c-LPUJXRXW.js → c-NTHUTABN.js} +1 -1
- package/dist/m/{c-Y33LUUIQ.js → c-NW54NHKE.js} +1 -1
- package/dist/m/{c-3AXJDL2P.js → c-OG6GFSUX.js} +1 -1
- package/dist/m/{c-MTQHWQC3.js → c-OKEGUICD.js} +1 -1
- package/dist/m/c-OPONJ2UK.js +128 -0
- package/dist/m/{c-3YH6JSIL.js → c-OWQWOGYI.js} +1 -1
- package/dist/m/{c-FDAXZ2PM.js → c-P6Q2ZTFQ.js} +1 -1
- package/dist/m/c-PKCCHJ5X.js +1 -0
- package/dist/m/c-PWJSJEJU.js +1 -0
- package/dist/m/{c-2ZZBC45O.js → c-PXLTUYZC.js} +1 -1
- package/dist/m/c-QEN6HZCA.js +1 -0
- package/dist/m/{c-JOH753EJ.js → c-QGAPG7OM.js} +1 -1
- package/dist/m/{c-W23KVGUO.js → c-QIR5CAKM.js} +1 -1
- package/dist/m/{c-GKEATME6.js → c-QM5LXRDT.js} +1 -1
- package/dist/m/c-QUGCKMWF.js +1 -0
- package/dist/m/{c-FNVQAACK.js → c-QYYUVLVG.js} +1 -1
- package/dist/m/c-RO73MKKR.js +1 -0
- package/dist/m/c-SBCBXKOZ.js +26 -0
- package/dist/m/{c-J3BXFTZS.js → c-SGRIYOAJ.js} +1 -1
- package/dist/m/c-SKF5HL4I.js +4 -0
- package/dist/m/{c-W3K23S72.js → c-SRPC3VBE.js} +1 -1
- package/dist/m/{c-K76AUL4I.js → c-T5NK2TVY.js} +1 -1
- package/dist/m/{c-EFD6QNTE.js → c-TANBH7FI.js} +1 -1
- package/dist/m/{c-5734MF2P.js → c-THGQQDYY.js} +1 -1
- package/dist/m/{c-YQUJ74R3.js → c-TSBVMWAH.js} +1 -1
- package/dist/m/{c-VY6XRBOW.js → c-UD5JZTDL.js} +1 -1
- package/dist/m/{c-M4FSPNQ2.js → c-UDGEFWNU.js} +1 -1
- package/dist/m/{c-ZSCBEB7I.js → c-UHUNXWKN.js} +1 -1
- package/dist/m/{c-BTLFLLML.js → c-VIRFF5HG.js} +1 -1
- package/dist/m/{c-2VB555FG.js → c-VYJ7O4RI.js} +1 -1
- package/dist/m/{c-TUGVINJR.js → c-W5E5P2TZ.js} +1 -1
- package/dist/m/{c-EOCKLMKX.js → c-W7IPVCAA.js} +1 -1
- package/dist/m/{c-5FEU5MMY.js → c-WJ5DRBHT.js} +1 -1
- package/dist/m/{c-V2J5C5MT.js → c-WQZTI5P2.js} +1 -1
- package/dist/m/c-X5WC4PX5.js +1 -0
- package/dist/m/{c-GVPNDIKJ.js → c-XCFQEWW6.js} +2 -2
- package/dist/m/c-XLQ3BDMM.js +1 -0
- package/dist/m/{c-XD5MOROJ.js → c-XX75FFNL.js} +1 -1
- package/dist/m/{c-JHJR5BQX.js → c-YK2L436K.js} +1 -1
- package/dist/m/{c-MEWUGR4D.js → c-YYMZWQLR.js} +1 -1
- package/dist/m/core/{admin-attrs-ZG7R5V3E.js → admin-attrs-U7IJNYBG.js} +1 -1
- package/dist/m/core/{autosave-VPORYJSE.js → autosave-F5YQCKVL.js} +1 -1
- package/dist/m/core/{conflict-notice-JMAZLVRX.js → conflict-notice-42H4ASLA.js} +1 -1
- package/dist/m/core/{persist-3OPWJKZS.js → persist-CJXIL7D4.js} +1 -1
- package/dist/m/core/{save-AOJBDSOK.js → save-ESPSQPLV.js} +1 -1
- package/dist/m/core/{save-core-IOCMXO5L.js → save-core-6SQHOR6W.js} +1 -1
- package/dist/m/core/snapshot-FJP5IJL3.js +1 -0
- package/dist/m/core/{unsaved-warning-U5VUJFOE.js → unsaved-warning-HNQVTA2D.js} +1 -1
- package/dist/m/internals/{index-HDRANDWE.js → index-NRPNDTSA.js} +1 -1
- package/dist/m/loader-FBDE2UAB.js +1 -0
- package/dist/m/manifest-1D2F5CA5.js +1 -0
- package/dist/m/manifest-edit-F7CC5CFD.js +1 -0
- package/dist/m/manifest.json +1139 -1069
- package/dist/m/page/{editor-EY2WAAGB.js → editor-OSKOW6RS.js} +2 -2
- package/dist/m/plugins/ai-edit-VV4QTINH.js +6 -0
- package/dist/m/plugins/cms-H7DTMUQX.js +2235 -0
- package/dist/m/plugins/{indicator-4VDXWYTD.js → indicator-WVPGMOZ7.js} +1 -1
- package/dist/m/plugins/{live-5EZN2EYP.js → live-DCUBKXY4.js} +1 -1
- package/dist/m/plugins/menu-Q4MFFQ6E.js +1 -0
- package/dist/m/plugins/{page-LVW5DWA4.js → page-OAWUJQEL.js} +2 -2
- package/dist/m/plugins/{page-view-5KQ76IJB.js → page-view-DZ26ZDDQ.js} +1 -1
- package/dist/m/plugins/{people-C7TVBBMR.js → people-5XRNRP5U.js} +1 -1
- package/dist/m/plugins/{quickcrop-BQ5YYFCH.js → quickcrop-WWF5I422.js} +2 -2
- package/dist/m/plugins/{richclay-KLGETK77.js → richclay-PGOOJ4OK.js} +2 -2
- package/dist/m/plugins/{sortable-WJZZBM7R.js → sortable-266HY6TR.js} +1 -1
- package/dist/m/plugins/{source-CCEUM3OR.js → source-6BKMK4PO.js} +1 -1
- package/dist/m/plugins/{upgrade-NW556WJD.js → upgrade-BNZVFHMZ.js} +1 -1
- package/dist/m/plugins/visitor-drafts-2AUYKAIJ.js +20 -0
- package/dist/m/plugins/{visitor-drafts-owner-MZP45XSG.js → visitor-drafts-owner-Z5B2OQBR.js} +1 -1
- package/dist/m/plugins/visitor-menu-4LQMKLPP.js +1 -0
- package/dist/m/plugins/{wire-VRYPY6EJ.js → wire-W2EV36KZ.js} +1 -1
- package/dist/m/{reader-core-2GXY7SHY.js → reader-core-POFQCKRV.js} +2 -2
- package/dist/m/sync/{live-sync-SKPMFYOO.js → live-sync-XGUPHI3I.js} +1 -1
- package/dist/m/ui/{index-QNIPDHXQ.js → index-VGYAKAKI.js} +1 -1
- package/dist/offline-manifest.json +666 -606
- package/docs/guide.md +38 -27
- package/package.json +2 -2
- package/src/core/save-replace.js +5 -2
- package/src/core/serialize-steps.js +10 -2
- package/src/core/snapshot.js +37 -1
- package/src/core/upgrade-run.js +16 -2
- package/src/loader-logic.js +10 -3
- package/src/plugins/ai-edit.js +6 -17
- package/src/plugins/cms.js +3 -6
- package/src/plugins/menu/dom-items.js +45 -0
- package/src/plugins/menu/looks.js +32 -0
- package/src/plugins/menu/shell-style.js +143 -0
- package/src/plugins/menu/shell.js +398 -0
- package/src/plugins/menu/style.js +15 -116
- package/src/plugins/menu/variants.js +56 -10
- package/src/plugins/menu/visitor.js +78 -0
- package/src/plugins/menu.js +21 -313
- package/src/plugins/visitor-drafts/inert.js +1 -0
- package/src/plugins/visitor-drafts/intro-style.js +6 -0
- package/src/plugins/visitor-drafts/intro.js +77 -25
- package/src/plugins/visitor-drafts/owner-chip.js +18 -23
- package/src/plugins/visitor-drafts/prompt.js +2 -2
- package/src/plugins/visitor-drafts/store.js +58 -5
- package/src/plugins/visitor-drafts.js +1 -0
- package/src/plugins/visitor-menu.js +13 -0
- package/src/sync/live-sync.js +2 -1
- package/src/sync/page-relay.js +2 -2
- package/src/ui/bevel.js +1 -1
- package/src/ui/page-colour.js +17 -9
- package/src/ui/skins/cms.js +1 -1
- package/src/ui/skins/quickcrop.js +1 -1
- package/src/ui/skins/richclay.js +1 -1
- package/src/vendor/hypercms.vendor.js +16 -69
- package/dist/m/c-AL4RBJF2.js +0 -1
- package/dist/m/c-DDDOKPI6.js +0 -3
- package/dist/m/c-EGTIAL6P.js +0 -1
- package/dist/m/c-FSWRGBVQ.js +0 -1
- package/dist/m/c-HDWZEJHM.js +0 -183
- package/dist/m/c-HMYWIHFG.js +0 -1
- package/dist/m/c-JH5FF4NL.js +0 -20
- package/dist/m/c-M6FNQCTQ.js +0 -1
- package/dist/m/c-MHI3GYKF.js +0 -1
- package/dist/m/c-MIL4B2JQ.js +0 -1
- package/dist/m/c-S5IEIZCN.js +0 -1
- package/dist/m/c-VSPAFOKU.js +0 -1
- package/dist/m/c-WFMRX5RZ.js +0 -1
- package/dist/m/core/snapshot-O7II2AGG.js +0 -1
- package/dist/m/loader-ZVPK4ZN3.js +0 -1
- package/dist/m/manifest-5498AFD3.js +0 -1
- package/dist/m/manifest-edit-62A5A00F.js +0 -1
- package/dist/m/plugins/ai-edit-J5VLSW5I.js +0 -6
- package/dist/m/plugins/cms-LRAOZHT7.js +0 -2293
- package/dist/m/plugins/menu-DM2JHPSR.js +0 -1
- package/dist/m/plugins/visitor-drafts-2AWNT23K.js +0 -20
- package/src/ui/skins/cms-toggle.js +0 -15
- /package/dist/m/plugins/{quickcrop-BQ5YYFCH.js.LEGAL.txt → quickcrop-WWF5I422.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-KLGETK77.js.LEGAL.txt → richclay-PGOOJ4OK.js.LEGAL.txt} +0 -0
package/dist/m/c-AL4RBJF2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Xe,b as ce,d as de,e as ue,f as et}from"./c-DHXPDLW6.js";import{a as Ke,b as Qe,c as he,d as Ze}from"./c-LZJPNR2W.js";import{a as R,b as Y}from"./c-FILLTJA7.js";import{b as Ve}from"./c-5VYOWDTI.js";import{b as le,c as oe,d as x,f as ae,g as Ye,h as Je}from"./c-GSRLXYWL.js";import{a as q}from"./c-LA2BW7UY.js";import{a as Ne}from"./c-ATKAOH23.js";import{a as $e,f as je,g as ze,h as We}from"./c-EK63G3CG.js";import{a as ie,b as Ge,c as M,d as se,e as re,h as Ue}from"./c-NQJRVJ56.js";import{e as Oe}from"./c-XGH4GS2T.js";import{d as qe}from"./c-IJUK2GPW.js";import{f as $,j as ee}from"./c-3O7OBDCM.js";import{a as Ie}from"./c-BPF2NSPV.js";import{D as W,E as Me,G as T,H as Be,b as D,j as ne,s as P,y as Pe}from"./c-EGTIAL6P.js";import{a as Fe,b as Re,c as He,e as j,g as z,h as te}from"./c-VG5XIN4T.js";import{m as be,n as De}from"./c-HA6INT6J.js";import{a as Te,b as Le,l as Ce,m as Ae}from"./c-ICMAOOGK.js";function tt(s){let e=new WeakMap,t=0,i=r=>e.get(r)||null,n=r=>{let l=e.get(r);return l||(l=`${s}:${++t}`,e.set(r,l)),l};return{idOf:i,ensure:n,adopt:(r,l)=>{r&&typeof l=="string"&&l&&e.set(r,l)},exportMap:(r,l)=>{let o={},a=[],h=[],c=(d,_)=>{let g=l(d);g&&(o[_]=n(g));let E=d.children;a.push(E.length),h.push(d.tagName.toLowerCase());for(let f=0;f<E.length;f++)c(E[f],_===""?String(f):`${_}.${f}`)};return c(r,""),o["~"]=a.join(","),o["^"]=h.join(","),o}}}function nt(s,e){let t=new WeakMap;if(!s||!e||typeof e!="object"||Array.isArray(e))return t;let i=e["~"],n=typeof i=="string"?i.split(",").map(Number):null,r=n&&typeof e["^"]=="string"?e["^"].split(","):null,l=d=>Number.isInteger(d)&&d>=0,o=0,a=!1,h=d=>{let _=d;for(;_>0;){let g=n[o++];if(o>n.length||!l(g))return!1;_+=g-1}return!0},c=(d,_)=>{if(a)return;if(n){let f=o++,u=n[f];if(f>=n.length||!l(u)){a=!0;return}let S=!r||r[f]===d.tagName.toLowerCase();if(!S||u!==d.children.length){let w=S&&e[_];typeof w=="string"&&w&&t.set(d,w),h(u)||(a=!0);return}}let g=e[_];typeof g=="string"&&g&&t.set(d,g);let E=d.children;for(let f=0;f<E.length;f++)c(E[f],_===""?String(f):`${_}.${f}`)};return c(s,""),t}function yt(s){return e=>{for(let t of s){let i=t(e);if(typeof i=="string"&&i!=="")return i}return null}}var Pt=yt([s=>s.getAttribute("data-id"),s=>s.getAttribute("id")]);var mt=/^page(\.[0-9]+)?$/,it=s=>[...s.querySelectorAll('script[merge][clay~="live"]')].filter(e=>mt.test(e.getAttribute("merge")));function st(s,e,t){if(!s.html.includes("data-page"))return s;let i=u=>new DOMParser().parseFromString(u,"text/html"),n=i(s.html),r=n.querySelector("article[data-page]");if(!r)return s;let l=i(e),o=l.querySelector("article[data-page]");if(!o)return null;let a=nt(n.documentElement,s.identityMap),h=(u,S)=>{let w=n.importNode(S,!0),b=a.get(u);return b&&a.set(w,b),u.replaceWith(w),w},c=h(r,o),d=new Map(it(n).map(u=>[u.getAttribute("merge"),u]));for(let u of it(l)){let S=u.getAttribute("merge"),w=d.get(S);w?h(w,u):c.before(n.importNode(u,!0)),d.delete(S)}for(let u of d.values())u.remove();let _=n.querySelector("head > title"),g=l.querySelector("head > title");_&&g?h(_,g):g?n.head.append(n.importNode(g,!0)):_?.remove();let E=n.documentElement,f=t.exportMap(E,u=>{let S=a.get(u);return S?(t.adopt(u,S),u):null});return{...s,html:T(E),identityMap:f}}var vt={"merge-tokens":"tokens","merge-max":"max"};function rt(s,e){if(!e.startsWith("data-")||e==="data-id"||!s?.closest)return null;for(let[t,i]of Object.entries(vt)){let n=s.closest(`[${t}]`);if(n&&n.getAttribute(t).split(/\s+/).includes(e))return i}return null}var m=null,lt=null,B=new Map;function J(){return lt??=Promise.all([import("./c-CAWNFER6.js"),import("./c-EJTGYSLN.js")]).then(([s,e])=>{m={...s,beginLineageCapture:e.beginLineageCapture};for(let t of[...B.keys()])B.set(t,s.registerContext(t));return m}),lt}var ot=()=>m,I={get size(){return m?m.conflicts.size:0},list(){return m?m.conflicts.list():[]},get(s){return m?m.conflicts.get(s):null},acknowledge(s,e={}){if(m)return m.conflicts.acknowledge(s,e);if(!Array.isArray(s))throw new TypeError("clay.conflicts.acknowledge needs an array of ids");return{removedIds:[],remainingIds:[]}},claim(s,e={}){if(m)return m.conflicts.claim(s,e);if(!e.owner)throw new TypeError("clay.conflicts.claim needs an owner");return{release(){}}},registerContext(s){if(m)return m.conflicts.registerContext(s);if(typeof s!="function")throw new TypeError("clay.conflicts.registerContext needs a resolver function");return B.set(s,null),()=>{let e=B.get(s);B.delete(s),e&&e()}},contextFor(s,e){return m?m.conflicts.contextFor(s,e):null},recoveryOf(s){return m?m.conflicts.recoveryOf(s):null},hasPendingApply(){return m?m.conflicts.hasPendingApply():!1}};var y=null,fe=null;function H(){return fe??=new Promise(s=>setTimeout(s,0)).then(()=>import("./c-FNVQAACK.js")).then(s=>y=s).catch(s=>{throw fe=null,s}),fe}var ye=null,pe=null;function Et(){return pe??=import("./c-FTWGYI5E.js").then(s=>ye=s.presence).catch(s=>{throw pe=null,s}),pe}var ct=ee().phase==="entering";$&&!ct&&H().catch(()=>{});$&&J().catch(()=>{});var L=null,_e=null,K=[];function dt(s){L.presence.update(s),L.editingMarker.update(s)}function wt(){return _e??=Promise.all([import("./c-ZJLU56DV.js"),import("./c-JUE7B4OX.js")]).then(([s,e])=>{L={presence:s.presence,editingMarker:e.editingMarker};let t=K;K=[];for(let i of t)dt(i);return L}).catch(s=>{throw _e=null,s}),_e}function kt(s){if(L){dt(s);return}K.push(s),wt().catch(()=>{})}var at=Object.freeze({bytes:null,etag:null,seq:null}),xt=()=>({msg:"Not in edit mode",msgType:"skipped",code:null,etag:null}),ut=["[editor-ui]",'[clay~="editor-ui"]',"[save-ignore]","[snapshot-remove]","[no-snapshot]","[no-save]","[save-remove]","[freeze] *","[save-freeze] *",'[clay~="no-save"]','[clay~="no-snapshot"]','[clay~="freeze"] *',Ce,Te].join(","),ft='[clay~="freeze"], [freeze], [save-freeze]';function V(s){for(let e of s.querySelectorAll(ft))e.replaceChildren();return z()&&He(s),s}function ht(s){if(s==null)return s;let e=typeof s=="string"?new DOMParser().parseFromString(s,"text/html"):s;return ne(e),V(e),e}var bt=[Ae,'[clay~="no-watch"]',"[no-watch]","[mutations-ignore]"].join(","),Dt=(s,e,t)=>be(s,e,t)||Le.test(e.toLowerCase()),pt=s=>s.getAttribute("data-id")||s.getAttribute("id")||null;function It(s){let e=new Map,t=n=>{if(n.matches(ut))return;let r=pt(n);r&&e.set(r,(e.get(r)||0)+1);let l=n.localName==="template"&&n.content?n.content.children:n.children;for(let o of l)t(o)},i=s.nodeType===9?[s.documentElement]:s.nodeType===11?s.children:[s];for(let n of i)n&&n.nodeType===1&&t(n);return e}var Tt=s=>e=>{let t=pt(e);if(!t)return null;let i=e.getRootNode(),n=s.get(i);return n||s.set(i,n=It(i)),n.get(t)===1?t:null},ge=s=>!!s&&typeof s=="object"&&!Array.isArray(s);function Lt(s){return typeof s!="string"||s===""?null:new DOMParser().parseFromString(s,"text/html").documentElement?.getAttribute("documentetag")||null}function Ct(s,e){e!=="live"||!s||!y||(y.enableContentEditable(s),y.enableOnClick(s),y.enableAdminInputs(s),y.enableAdminResources(s))}function At(){let{forComparison:s,forDirty:e}=Pe({flushUndo:!1});return[s,e]}var Ft=1024*1024;function Rt(s,e,t,i,n){let r={sender:t,identityMap:i,...n?{etag:n}:{}};return e.length<Ft?JSON.stringify({[s.snapshotKey]:e,...r}):new Blob([`{${JSON.stringify(s.snapshotKey)}:`,JSON.stringify(e),`,${JSON.stringify(r).slice(1)}`],{type:"application/json"})}var me=class{constructor(){this.sse=null,this.currentFile=null,this.lastHtml=null,this._diskBase=null,this._diskBaseTicket=0,this._agreeSeq=0,this._saveTicket=0,this._peerBaseTicket=0,this._acceptedSaveTicket=0,this._morphTicket=0,this.clientId=this.generateClientId(),this.resumeId=null,this._savedSnapshot?.abort?.abort(),this._savedSnapshot=null,this._sendInFlight=!1,this._queuedSend=null,this._profile=null,this._profilePromise=null,this._sharedData=!1,this._sharedSync=!1,this._liveData=!1,this._editing=null,this._presenceLease=null,this._presenceQuiesced=!1,this._ready=null,this._startGen=0,this.isPaused=!1,this.isDestroyed=!1,this.debug=!1,this._lane=$?"live":"saved",this._laneChosen=!1,this._snapshotHandler=null,this.lastSeenSeq=0,this._pendingHtml=null,this._pendingSeq=null,this._pendingIdentityMap=null,this._pendingEtag=null,this._pendingBy=null,this._morphInFlight=!1,this._rafHandle=null,this._represented=at,this._handoff=null,this._handoffHeld=!1,this._pendingExternal=null,this._lastExternalSeq=0,this._saveEpoch=0,this._saveSavedHandler=null,this._saveConflictHandler=null,this._settledHandler=null,this._lastIdentityMap=null,this._applyGen=0,this._holdRetryPeer=null,this._holdRetryExt=null,this._servedFetchId=0,this._startupRetry=null,this._engineRetry=null,this._heldLive=!1,this._heldExt=!1,this.identity=tt(this.clientId),this.onConnect=null,this.onDisconnect=null,this.onUpdate=null,this.onError=null,this.onNotification=null}get unresolvedConflicts(){return I.list().filter(e=>e.kind!=="apply-incomplete")}_log(e,t=null){if(!this.debug)return;let i=`[LiveSync ${new Date().toISOString()}]`;t!==null?console.log(i,e,t):console.log(i,e)}generateClientId(){return Math.random().toString(36).slice(2,11)+Date.now().toString(36)}generateResumeId(){try{let e=new Uint8Array(16);return(globalThis.crypto||window.crypto).getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}catch{return Math.random().toString(36).slice(2)+Date.now().toString(36)}}_seedBases(){if(x())return;let e=P({flushUndo:!1});this._setPeerBase(T(e),this.identity.exportMap(e,D),this._ticket()),this._setDiskBase(W({emitForSync:!1}).forSave,this._ticket())}get lane(){return this._lane}set lane(e){this._lane=e,this._laneChosen=!0}start(e=null,{lane:t,represented:i}={}){if(this.isDestroyed=!1,(this.sse||this._snapshotHandler)&&this.cleanup(),this.currentFile=e||this.detectCurrentFile(),!this.currentFile){console.warn("[LiveSync] No file detected");return}let n=ee().mode==="edit"?"live":"saved",r=this.lane==="live";this._lane=t||(this._laneChosen?this._lane:n),this.lastHtml=null,this._lastIdentityMap=null,this._peerBaseTicket=this._ticket(),this._diskBase=null,this._diskBaseTicket=this._ticket(),this._saveTicket=0,this._savedSnapshot?.abort?.abort(),this._savedSnapshot=null,this._applyGen++,this.lastSeenSeq=0,this._lastExternalSeq=0,this._represented=i?Object.freeze({bytes:i.bytes??null,etag:i.etag??null,seq:i.seq??null}):at,this._acquireEmptySaved=r&&this.lane==="saved"&&this._represented.bytes===null,this._pendingExternal=null,this.resumeId=this.generateResumeId(),this.lane==="live"&&this._seedBases(),this.lane==="live"&&J().catch(()=>{}),console.log(`[LiveSync] Starting for: ${this.currentFile} (lane=${this.lane})`);let l=++this._startGen;if(this.lane==="live"&&!(y&&y.baselineSettled())){let o=this._applyGen,a=this._morphTicket,h=this._saveEpoch,c=this.lastHtml,d=this._diskBaseTicket,_=this._diskBase!==null;this._settledHandler=()=>{if(this._settledHandler=null,!(this.isDestroyed||this._startGen!==l)&&!qe()&&!x()&&this._saveTicket===0&&this._morphTicket===a){if(c!==null&&this._applyGen===o&&this._saveEpoch===h&&this.lastHtml===c){let g=P({flushUndo:!1});this._setPeerBase(T(g),this.identity.exportMap(g,D),this._ticket())}_&&this._diskBaseTicket===d&&this._setDiskBase(W({emitForSync:!1}).forSave,this._ticket())}},document.addEventListener("clay:baseline-settled",this._settledHandler,{once:!0})}this._ready=Promise.all([this.lane==="live"?H():null,this._resolveProfile()]).then(()=>{this.isDestroyed||this._startGen!==l||this.connect()}),this.lane==="live"&&(this.listenForSnapshots(),Et().then(o=>this._startPresence(o,l),()=>{}),this._saveSavedHandler=o=>{this._saveEpoch++;let a=this._saveTicket||this._ticket();this._saveTicket=0,a>this._acceptedSaveTicket&&(this._acceptedSaveTicket=a);let h=y?y.getLastSavedBytes():null;h!=null&&this._setDiskBase(h,a),this._relayCommit(o?.detail?.captureId,h)},document.addEventListener("clay:save-saved",this._saveSavedHandler),this._saveConflictHandler=o=>{let a=o.detail&&o.detail.etag;a&&queueMicrotask(()=>{this.isDestroyed||a===ie()&&(y?.conflictResolvedBySync(a),this._saveAfterMerge(x(),!1))})},document.addEventListener("clay:save-conflict",this._saveConflictHandler))}cleanup(){if(this.sse&&(this.sse.close(),this.sse=null),he(),K=[],L&&(L.presence.clear(),L.editingMarker.clear()),this._editing&&(this._editing.stop(),this._editing=null),this._presenceLease){let e=this._presenceLease;this._presenceLease=null,typeof e.stop=="function"?e.stop():e.detach()}this._lastRoster=null,this._snapshotHandler&&(document.removeEventListener("clay:snapshot-ready",this._snapshotHandler),this._snapshotHandler=null),this._saveSavedHandler&&(document.removeEventListener("clay:save-saved",this._saveSavedHandler),this._saveSavedHandler=null),this._saveConflictHandler&&(document.removeEventListener("clay:save-conflict",this._saveConflictHandler),this._saveConflictHandler=null),this._settledHandler&&(document.removeEventListener("clay:baseline-settled",this._settledHandler),this._settledHandler=null),this._queuedSend=null,this._rafHandle!=null&&(this._cancelFrame(this._rafHandle),this._rafHandle=null),this._pendingHtml=null,this._pendingSeq=null,this._pendingIdentityMap=null,this._pendingBy=null,this._pendingExternal=null,this._handoff=null,this._handoffHeld=!1,clearTimeout(this._holdRetryPeer),clearTimeout(this._holdRetryExt),this._holdRetryPeer=null,this._holdRetryExt=null,clearTimeout(this._startupRetry),this._startupRetry=null,clearTimeout(this._engineRetry),this._engineRetry=null,this._servedFetchId++}detectCurrentFile(){let e=window.location.pathname;if(e==="/")return"index.html";e=e.replace(/^\//,"");let t=e.match(/^(.*?\.html(?:clay)?)/);return t?t[1]:e}_resolveProfile(){return this._profilePromise||(this._profilePromise=et().then(e=>(this._sharedData=e.sharedData,this._sharedSync=e.sharedSync,this._liveData=e.liveData,this._profile=e.profile,this._log(`Wire profile: ${e.profile.name}`),e.profile))),this._profilePromise}_setHeld(e,t,i){let n=e==="live"?"_heldLive":"_heldExt";this[n]!==t&&(this[n]=t,!t&&!this._heldLive&&!this._heldExt&&Ue({fresh:!0,clearIfMissing:!1}),document.dispatchEvent(new CustomEvent(t?"clay:sync-held":"clay:sync-resumed",{detail:{lane:e,el:i||null}})))}_applyEtagFrame(e){return typeof e.etag!="string"||typeof e.html=="string"?!1:(this._log("Dropping a stamp that arrived with no document: nothing proves this tab holds those bytes"),!0)}connect(){if(this.isDestroyed)return;let t=(this._profile||ue.legacy).streamPath(window.location.href,this.lane,this.resumeId,this.clientId);this.sse=new Xe(new URL(t,window.location.origin).href,{shared:this._sharedSync,sharedData:this._sharedData,documentURL:window.location.href,lane:this.lane,clientId:this.clientId,keepAliveWhenHidden:this._liveData&&this.lane==="live",startupCheck:!!Ie}),this._acquireEmptySaved&&(this._acquireEmptySaved=!1,this._fetchServedDocument(void 0,{repair:!0})),this.sse.onopen=()=>{console.log("[LiveSync] Connected"),this._editing&&this._editing.reconnected(),ye&&ye.reconnect(),this.onConnect&&this.onConnect()},this.sse.addEventListener("open",()=>Qe({clientId:this.clientId,lane:this.lane})),this.sse.addEventListener("error",()=>he());for(let i of Ke)this.sse.addEventListener(i,n=>{let r;try{r=JSON.parse(n.data)}catch{return}Ze(i,r)});this.sse.addEventListener("cursor",i=>{let n;try{n=JSON.parse(i.data)}catch{return}if(!n||n.resync!==!0&&n.startup!==!0)return;let r=n.resync===!0,l=n.startup===!0&&!r;console.log(r?"[LiveSync] Server could not replay everything; refetching the document":"[LiveSync] Checking the served document against the version this tab was served"),this._fetchServedDocument(typeof n.seq=="number"?n.seq:void 0,{repair:r,startup:l})}),this.sse.addEventListener("presence",i=>{let n;try{n=JSON.parse(i.data)}catch{return}kt(n),this._lastRoster=n,this._editing&&this._editing.roster(n)}),this.sse.onmessage=i=>{let n=JSON.parse(i.data),{seq:r}=n;if(typeof r=="number"&&r<=this.lastSeenSeq){this._log(`Dropping stale message: seq=${r}, lastSeen=${this.lastSeenSeq}`);return}if(typeof r=="number"&&(this.lastSeenSeq=r),n.type==="notification"){if(this._maybeAcceptExternalChange(n))return;this.handleNotification(n);return}if(n.error){console.error("[LiveSync] Server error:",n.error),this.onError&&this.onError(new Error(n.error));return}if(this._applyEtagFrame(n))return;let{html:l,sender:o,identityMap:a}=n;if(o===this.clientId){this._log("Ignoring own message (sender matches clientId)");return}if(typeof l!="string"){console.error("[LiveSync] Received invalid html, ignoring");return}let h=typeof n.etag=="string"&&n.etag?n.etag:null;if(this.lane==="live"&&!h&&Ge()){this._log(`Dropping an unstamped live frame on a stamping host (seq=${r})`);return}if(this.lane==="saved"&&l===this._represented.bytes){this._represented=Object.freeze({bytes:l,etag:h||null,seq:r??null}),M(h);return}if(h&&l===this.lastHtml){this._log(`Taking the stamp from a peer save of content already applied (seq=${r})`),M(h),y&&y.isSaveConflicted()&&(y.conflictResolvedBySync(h),this._saveAfterMerge(x(),!1));return}this._log(`Received update from: ${o} (my clientId: ${this.clientId}, seq=${r})`),this.applyUpdate(l,r,a,h,n.by),this.onUpdate&&this.onUpdate({html:l,sender:o,seq:r,identityMap:a,etag:h})},this.sse.onerror=()=>{this.sse.readyState===EventSource.CONNECTING?console.log("[LiveSync] Reconnecting..."):this.sse.readyState===EventSource.CLOSED&&(console.log("[LiveSync] Connection closed"),this.onError&&this.onError(new Error("Connection closed"))),this.onDisconnect&&this.onDisconnect()}}listenForSnapshots(){this._snapshotHandler=e=>{if(!e.detail||e.detail.forSave!==!0)return;this._saveTicket=this._ticket();let{documentElement:t}=e.detail;if(!t)return;this._log("snapshot-ready received, preparing to send");let i=this.identity.exportMap(t,D);this._savedSnapshot?.abort?.abort();let n={html:null,steps:null,copy:null,abort:null,identityMap:i,ticket:this._saveTicket,captureId:e.detail.captureId??null};if(e.detail.sliced){n.copy=Be(t),n.abort=new AbortController;let{signal:r}=n.abort;Promise.all([import("./c-MEWUGR4D.js"),import("./c-ZWBI4HYK.js")]).then(([{serializeForSyncSteps:l},{runSliced:o}])=>{if(r.aborted||typeof n.html=="string")return;let a=(function*(){let h=yield*l(n.copy);n.html=h,n.steps=null})();return n.steps=a,o(a,{signal:r})}).catch(()=>{})}else n.html=T(t);this._savedSnapshot=n},document.addEventListener("clay:snapshot-ready",this._snapshotHandler)}_enqueueSend(e,t,i=null){if(!this._profile){this._queuedSend={html:e,identityMap:t,etag:i},this._resolveProfile().then(()=>this._flushQueuedSend());return}if(this._sendInFlight){this._queuedSend={html:e,identityMap:t,etag:i};return}this._postUpdate(e,t,i)}_flushQueuedSend(){if(this.isDestroyed||this._sendInFlight)return;let e=this._queuedSend;e&&(this._queuedSend=null,this._postUpdate(e.html,e.identityMap,e.etag))}_relayCommit(e=null,t=null){if(this.isDestroyed)return;let i=ie(),n=this._savedSnapshot;if(n&&(n.captureId??null)!==(e??null)){this._log("Skipping send - snapshot belongs to a different capture");return}let r=n;if(this._savedSnapshot=null,r?.copy&&typeof r.html!="string")if(r.abort?.abort(),r.steps)for(let c=r.steps.next();!c.done;c=r.steps.next());else r.html=T(r.copy);if(!r||typeof r.html!="string")return;let l=r;if(typeof t=="string"){try{l=st(r,t,this.identity)}catch(c){this._log(`Skipping send - page relay failed: ${c&&c.message}`);return}if(!l){this._log("Skipping send - accepted capture has no page article");return}}let o=Ht(e)??t,a=typeof o=="string"?je(o):0;l={...l,html:qt(ze(l.html,Math.max(We(),a)),o)};let h=!i&&l.html===this.lastHtml;if(this._setPeerBase(l.html,l.identityMap,l.ticket),h){this._log("Skipping send - HTML unchanged");return}this._enqueueSend(l.html,l.identityMap,i||null)}_postUpdate(e,t,i=null,n=0){this._log(`Sending update (HTML length: ${e.length})`),this._sendInFlight=!0;let r=!1,l=this._profile||ue.legacy;fetch(new URL(l.relayPath,window.location.origin).href,{method:"POST",headers:{"Content-Type":"application/json",[l.documentHeader]:window.location.href,[$e]:String(1)},body:Rt(l,e,this.clientId,t,i)}).then(o=>{o.ok||(console.warn("[LiveSync] Save returned status:",o.status),r=o.status>=500||o.status===408||o.status===429)}).catch(o=>{console.error("[LiveSync] Save failed:",o),this.onError&&this.onError(o),r=!0}).finally(()=>{this._sendInFlight=!1;let o=this._queuedSend;if(this._queuedSend=null,o){this._postUpdate(o.html,o.identityMap,o.etag);return}!r||!i||n>=3||this.isDestroyed||(this._sendInFlight=!0,setTimeout(()=>{if(this._sendInFlight=!1,this.isDestroyed)return;let a=this._queuedSend;this._queuedSend=null,a?this._postUpdate(a.html,a.identityMap,a.etag):this._postUpdate(e,t,i,n+1)},500*2**n))})}_startPresence(e,t){return this.isDestroyed||this._startGen!==t||this._presenceLease?null:e.connect({send:i=>this._postPresence(i)}).then(i=>this.isDestroyed||this._startGen!==t?(typeof i?.stop=="function"?i.stop():i?.detach(),null):(this._presenceLease=i||null,Oe("presence-editing")),()=>!1).then(i=>{if(!(!i||this.isDestroyed||this._startGen!==t||this._editing))return H().then(n=>{this.isDestroyed||this._startGen!==t||this._editing||(this._editing=new n.EditingSender({}),this._presenceQuiesced?this._editing.stop():(this._editing.start(),this._editing.roster(this._lastRoster)))})})}_postPresence(e){let t=new URL("/_/presence",window.location.origin);return t.searchParams.set("client-id",this.clientId),fetch(t.href,{method:"POST",headers:{"Content-Type":"application/json","Document-URL":window.location.href},body:JSON.stringify(e)}).then(i=>i.ok,()=>!1)}_maybeAcceptExternalChange(e){if(this.lane!=="live")return!1;let t=e.data;return t&&t.kind==="external-change"?(typeof t.html=="string"?this._enqueueExternal(t.html,e.seq,t.etag,t.by):this._fetchExternalChange(e.seq),!0):typeof e.msg=="string"&&e.msg.endsWith("changed on disk outside this tab")?(this._fetchExternalChange(e.seq),!0):!1}_enqueueExternal(e,t,i,n){if(typeof t=="number"){if(t<=this._lastExternalSeq){this._log(`Dropping replayed external change: seq=${t}`);return}this._lastExternalSeq=t}this._pendingExternal={html:e,seq:t,saveEpoch:this._saveEpoch,etag:typeof i=="string"&&i?i:null,by:n??null},this._scheduleNextFrame()}_fetchExternalChange(e){if(typeof e=="number"){if(e<=this._lastExternalSeq)return;this._lastExternalSeq=e}this._fetchServedDocument(e)}_fetchServedDocument(e,{attempt:t=0,repair:i=!1,startup:n=!1}={}){if(n&&(this._morphInFlight||this._pendingHtml!=null||this._pendingExternal!=null)){this._retryStartup(t);return}let r=this._saveEpoch,l=this._startGen,o=this.lastSeenSeq,a=this._applyGen,h=++this._servedFetchId;i&&typeof e!="number"&&(e=this._lastExternalSeq),fetch(new URL(window.location.href),{cache:"no-store"}).then(c=>c.ok?c.text():null).then(c=>{if(this.isDestroyed||c==null||this._startGen!==l)return;let d=Lt(c),_=n||i&&!!d;if(_){if(h!==this._servedFetchId){i&&this._retryStartup(t+1,{repair:i,startup:n},typeof e=="number"?Math.max(e,this._lastExternalSeq):e);return}if(r!==this._saveEpoch||o!==this.lastSeenSeq||a!==this._applyGen||this._morphInFlight||this._pendingHtml!=null||this._pendingExternal!=null){this._retryStartup(t+1,{repair:i,startup:n},e);return}if(d){if(d===se()){(i||n)&&this.lane==="saved"&&(this._represented=Object.freeze({bytes:c,etag:d,seq:e??null}));return}}else if(!i)return}else if(typeof e=="number"&&e<this._lastExternalSeq){i&&t<3&&this._fetchServedDocument(this._lastExternalSeq,{attempt:t+1,repair:i,startup:n});return}else if(this._saveEpoch>r){t<3&&(console.log("[LiveSync] Refetching external change: own save landed mid-fetch"),this._fetchServedDocument(e,{attempt:t+1,repair:i,startup:n}));return}this._pendingExternal={html:c,seq:e,saveEpoch:r,etag:d,by:null,fetchOptions:{repair:i,startup:n,attempt:t,versionCheck:_},startGen:l,seenSeq:o,applyGen:a,fetchId:h},this._scheduleNextFrame()}).catch(c=>{this._log("External-change fetch failed",c),typeof e=="number"&&this._lastExternalSeq===e&&(this._lastExternalSeq=e-1)})}_retryStartup(e=0,t={startup:!0},i){this.isDestroyed||e>3||(clearTimeout(this._startupRetry),this._startupRetry=setTimeout(()=>{if(this._startupRetry=null,!this.isDestroyed){if(this._morphInFlight||this._pendingHtml!=null||this._pendingExternal!=null){this._retryStartup(e,t,i);return}this._fetchServedDocument(i,{...t,attempt:e})}},16))}applyUpdate(e,t,i,n,r){this.isDestroyed||(this._pendingHtml=e,this._pendingSeq=t,this._pendingIdentityMap=i,this._pendingEtag=n??null,this._pendingBy=r??null,this._scheduleNextFrame())}prepareHandoff(e={}){return this._handoff?Promise.resolve(this._handoff):this.isDestroyed?Promise.reject(new Error("LiveSync: stopped")):(this._handoffHeld=!0,this._rafHandle!=null&&(this._cancelFrame(this._rafHandle),this._rafHandle=null),import("./c-Y33LUUIQ.js").then(({engineHandoff:t})=>t(this,e)).then(t=>this._handoff=t))}_scheduleNextFrame(){this.isDestroyed||this._handoffHeld||this._rafHandle==null&&(this._morphInFlight||(this._rafHandle=this._requestFrame(()=>this._runPending())))}async _runPending(){if(this._rafHandle=null,this.isDestroyed)return;if(!R()){this._morphInFlight=!0;try{await Y()}catch(r){this._log("Merge engine failed to load",r),this._engineRetry=setTimeout(()=>this._scheduleNextFrame(),2e3);return}finally{this._morphInFlight=!1}if(this.isDestroyed)return}let e=this._pendingExternal,t=e?.fetchOptions||null,i=!!(t?.startup||t?.versionCheck),n=!1;if(e!=null&&(i&&this._pendingHtml!=null?n=!1:this._pendingHtml==null?n=!0:n=!(typeof e.seq=="number"&&typeof this._pendingSeq=="number"&&this._pendingSeq<e.seq)),n)if(this._pendingExternal=null,typeof e.seq=="number"&&e.seq<this._lastExternalSeq)i&&t?.repair?this._retryStartup((t.attempt||0)+1,t,this._lastExternalSeq):this._log("Dropping superseded external change at drain");else if(i&&e.startGen!==this._startGen)this._log("Dropping superseded startup check at drain");else if(i&&e.fetchId!==this._servedFetchId)t?.repair?this._retryStartup((t.attempt||0)+1,t,this._lastExternalSeq):this._log("Dropping superseded startup check at drain");else if(i&&(e.saveEpoch!==this._saveEpoch||e.seenSeq!==this.lastSeenSeq||e.applyGen!==this._applyGen))this._retryStartup((t.attempt||0)+1,t,e.seq);else if(i&&e.etag!=null&&e.etag===se())this._log("Startup check found the same version: nothing to apply");else if(!i&&e.saveEpoch!==this._saveEpoch)console.log("[LiveSync] Refetching external change: own save landed after queue"),this._fetchServedDocument(e.seq,t||{});else{this._morphInFlight=!0;try{await this._doApplyExternal(e.html,e.seq,e.etag,e.by,t)}catch(r){console.error("[LiveSync] applyExternal failed:",r)}finally{this._morphInFlight=!1}}else{let r=this._pendingHtml,l=this._pendingSeq,o=this._pendingIdentityMap,a=this._pendingEtag,h=this._pendingBy;if(this._pendingHtml=null,this._pendingSeq=null,this._pendingIdentityMap=null,this._pendingEtag=null,this._pendingBy=null,r==null)return;this._morphInFlight=!0;try{await this._doApplyUpdate(r,l,o,a,h)}catch(c){console.error("[LiveSync] applyUpdate failed:",c)}finally{this._morphInFlight=!1}}!this.isDestroyed&&(this._pendingHtml!=null||this._pendingExternal!=null)&&this._scheduleNextFrame()}_ticket(){return++this._agreeSeq}_setDiskBase(e,t){t<=this._diskBaseTicket||(this._diskBase=e,this._diskBaseTicket=t)}_setPeerBase(e,t,i){return i<this._peerBaseTicket?!1:(this._peerBaseTicket=i,this.lastHtml=e,this._lastIdentityMap=t&&typeof t=="object"&&!Array.isArray(t)?t:null,!0)}_requestFrame(e){return typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(e):setTimeout(e,16)}_cancelFrame(e){if(typeof window<"u"&&typeof window.cancelAnimationFrame=="function"){window.cancelAnimationFrame(e);return}clearTimeout(e)}async _mergeIncoming(e,t,{base:i,baseIdentityMap:n=null,captureLocal:r,synthetic:l,source:o="peer",seq:a=null,etag:h=null,extra:c={}}){R()||await Y();let{beginApply:d,completeApply:_,failApply:g,beginLineageCapture:E}=ot()||await J(),f,u=p=>{f=E(I.list());try{let v=R().HyperMorph.mergeDocument({...p,lineage:f.lineage});return f.returned(),v}catch(v){throw f.invalidate(I.list()),f.finish(I.list()),v}},S=this.identity,w=De,b=Tt(new WeakMap),N=p=>ge(p)?{first:b,map:p,then:b}:b,O=l?p=>b(p)||S.idOf(D(p)||p)||null:b,C=e,Se=new Map;if(ge(t)){C=new DOMParser().parseFromString(e,"text/html"),ne(C);let p=R().HyperMorph.importMap(C.documentElement,t);for(let v of C.querySelectorAll("[data-id], [id]")){let k=b(v),xe=k&&p.get(v);xe&&Se.set(k,xe)}}C=ht(C);let Q={live:document,remote:C,ignore:p=>p.matches(ut),opaque:p=>p.matches(ft)||z()&&Re(p),remoteWins:p=>p.matches(bt),ignoreAttribute:(p,v,k)=>Dt(p,v,k)||z()&&Fe(k||p,v),attributeMerge:rt,protectFocusedValue:!0,restoreFocus:document.activeElement?.localName!=="clay-editor-ui",keepLiveOnly:o==="peer",scripts:{mergeTags:R().mergeTagRecognizers},hooks:{beforeAttributeUpdated:w},...c},Ee=this.lane==="live"&&x(),we=ae(),G,Z=null,F=null;if(i==null)G=u({...Q,base:null,local:{root:V(r()),toLive:D},identity:{local:O,remote:N(t)}});else if(Ee){let p=r(),v=p.cloneNode(!0);Z=V(p),F=d({source:o,seq:a,etag:h,root:Z,recoveryRoot:v,domain:o==="disk"?"save":"sync"});try{G=u({...Q,base:ht(i),local:{root:Z,toLive:D},identity:{base:N(n),local:O,remote:N(t)}})}catch(k){throw g(F,k),k}}else{let p=V(r()),v=p.ownerDocument;v.documentElement!==p&&v.replaceChild(p,v.documentElement),G=u({...Q,base:v,local:{root:p,toLive:D},fastPath:!0,identity:{base:O,local:O,remote:N(t)}})}let U=this._ticket();this._morphTicket=U;let A;try{A=await G}catch(p){f.invalidate(I.list());try{F&&g(F,p,{ticket:U})}finally{f.finish(I.list())}throw p}let _t=ae().gen!==we.gen,ke;try{f.prepareComplete(A,I.list()),ke=F?_(F,A.conflicts,{ticket:U}):[]}finally{f.finish(I.list())}this.lane==="live"&&A.localDiverged?Ye():Ee&&!A.localDiverged&&Je(we);let gt=new Set(ge(t)?Object.values(t):[]);for(let[p,v]of A.identities){let k=gt.has(v)?v:Se.get(v);k&&S.adopt(p,k)}return{report:A,ticket:U,typedDuringWait:_t,conflictIds:ke}}_saveAfterMerge(e,t){(e||t)&&Ve()&&(y?y.savePageThrottled():xt())}async _doApplyUpdate(e,t,i,n,r=null){if(ce(e)){await de();return}this.lane==="live"&&!y&&await H(),this._log("applyUpdate - pausing mutations and morphing"),this.isPaused=!0;let l=window.scrollX,o=window.scrollY;q.pause(),le();let a=!1,h=!1,c=!1;try{if(this.lane==="live"&&x()&&this.lastHtml===null){console.log("[LiveSync] Holding incoming update: unsaved local edits and no baseline to merge against"),this._setHeld("live",!0,null);let f=this._saveEpoch,u=this.lastSeenSeq;clearTimeout(this._holdRetryPeer),this._holdRetryPeer=setTimeout(()=>{this._holdRetryPeer=null,!(this.isDestroyed||this._pendingHtml!=null)&&this._saveEpoch===f&&this.lastSeenSeq===u&&(this._pendingHtml=e,this._pendingSeq=t,this._pendingIdentityMap=i,this._pendingBy=r,this._scheduleNextFrame())},3e3);return}this._setHeld("live",!1);let{report:d,ticket:_,typedDuringWait:g,conflictIds:E}=await this._mergeIncoming(e,i,{base:this.lastHtml,baseIdentityMap:this._lastIdentityMap,captureLocal:()=>P({flushUndo:!1}),synthetic:!0,source:"peer",seq:t,etag:n});if(a=d.localDiverged,h=g,te(),window.scrollTo(l,o),this._setPeerBase(e,i,_),this._applyGen++,this._acceptedSaveTicket>_||(typeof n=="string"&&n?(M(n),c=!0):re()),this.lane==="live"&&!a&&!x()){let{forSave:f,forComparison:u,forDirty:S}=W({emitForSync:!1,flushUndo:!1});y.setLastSavedBaselines(u,S),this._setDiskBase(f,this._ticket())}this.lane==="saved"&&(this._represented=Object.freeze({bytes:e,etag:n||null,seq:t??null})),document.dispatchEvent(new CustomEvent("clay:sync-applied",{detail:{seq:t,source:this.lane==="saved"?"disk":"peer",lane:this.lane,by:r||null,html:e,report:d,unresolved:this.unresolvedConflicts,conflictIds:E}}))}finally{this._log("applyUpdate - morph complete, resuming mutations"),q.resume(),oe(),await new Promise(d=>setTimeout(d,0)),this.isPaused=!1}c&&y?.conflictResolvedBySync(n),this._saveAfterMerge(a,h)}async _doApplyExternal(e,t,i=null,n=null,r=null){if(ce(e)){await de();return}this.lane==="live"&&!y&&await H();let l=this._diskBase;this._log(`applyExternal - external disk change (seq=${t})`),this.isPaused=!0;let o=window.scrollX,a=window.scrollY;q.pause(),le();let h=!1,c=!1,d=!1;try{if(this.lane==="live"&&x()&&this._diskBase===null){if(console.log("[LiveSync] Holding external change: unsaved local edits and no baseline to merge against"),this._setHeld("external",!0,null),r?.startup||r?.versionCheck){clearTimeout(this._holdRetryExt),this._holdRetryExt=setTimeout(()=>{if(this._holdRetryExt=null,this.isDestroyed)return;let S=typeof t=="number"?Math.max(t,this._lastExternalSeq):t;this._retryStartup(0,r,S)},3e3);return}let u=this._saveEpoch;clearTimeout(this._holdRetryExt),this._holdRetryExt=setTimeout(()=>{this._holdRetryExt=null,!(this.isDestroyed||this._pendingExternal!=null)&&(this._pendingExternal={html:e,seq:t,saveEpoch:u,etag:i,by:n},this._scheduleNextFrame())},3e3);return}this._setHeld("external",!1);let{report:_,ticket:g,typedDuringWait:E,conflictIds:f}=await this._mergeIncoming(e,null,{base:this._diskBase,captureLocal:()=>Me().saveClone,synthetic:!1,source:"disk",seq:t,etag:i,extra:{beforeApply:u=>Ct(u.documentElement,this.lane)}});if(h=_.localDiverged,c=E,te(),this._setDiskBase(e,g),window.scrollTo(o,a),this._acceptedSaveTicket>g||(typeof i=="string"&&i?(M(i),d=!0):re()),this.lane==="live"&&!h&&!x()){y.setLastSavedBaselines(...At()),y.setUnsavedChanges(!1);let u=P({flushUndo:!1});this._setPeerBase(T(u),this.identity.exportMap(u,D),g),this._applyGen++}this.lane==="saved"&&(this._represented=Object.freeze({bytes:e,etag:i||null,seq:t??null})),document.dispatchEvent(new CustomEvent("clay:sync-applied",{detail:{seq:t,source:"disk",etag:typeof i=="string"&&i?i:null,by:n||null,html:e,report:_,conflictIds:f,unresolved:this.unresolvedConflicts}}))}finally{this._log("applyExternal - morph complete, resuming mutations"),q.resume(),oe(),await new Promise(_=>setTimeout(_,0)),this.isPaused=!1}d&&y?.conflictResolvedBySync(i),this._saveAfterMerge(h,c),l!=null&&j(l)===j(e)&&y&&y.schedulePaintHeal(()=>this._diskBase==null?null:j(this._diskBase))}handleNotification({msgType:e,msg:t,action:i,persistent:n,data:r}){this._log(`Notification received: ${e} - ${t}`),e==="data-loss"||(n&&window.toastPersistent?window.toastPersistent(t,e):window.toast?window.toast(t,e):console.log(`[LiveSync] Notification: ${t}`)),document.dispatchEvent(new CustomEvent("clay:notification",{detail:{msgType:e,msg:t,action:i,persistent:n,data:r}})),this.onNotification&&this.onNotification({msgType:e,msg:t,action:i,persistent:n,data:r})}stop(){this.cleanup(),this.isDestroyed=!0,console.log("[LiveSync] Stopped")}editParticipant(){return H().then(e=>e.syncParticipant(this))}},X=null;Ne((s,e)=>{X=typeof s=="string"?{html:s,captureId:e?.captureId??null}:null});var Ht=s=>X&&(X.captureId??null)===(s??null)?X.html:null;function qt(s,e){if(typeof e!="string"||e===s)return s;let t=i=>new DOMParser().parseFromString(i,"text/html").documentElement;return t(s).isEqualNode(t(e))?e:s}var ve=new me;typeof window<"u"&&!ct&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>ve.start()):ve.start());var _n=(s,e,t)=>Y().then(({morph:i})=>i(s,e,t));var gn=ve;export{I as a,ut as b,bt as c,me as d,ve as e,_n as f,gn as g};
|
package/dist/m/c-DDDOKPI6.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as G}from"./c-S5IEIZCN.js";import{b as J}from"./c-3G2DGZUP.js";import{o as z,p as _}from"./c-GVPNDIKJ.js";import"./c-ATKAOH23.js";import"./c-EK63G3CG.js";import{a as F}from"./c-NQJRVJ56.js";import"./c-XGH4GS2T.js";import"./c-IJUK2GPW.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-EGTIAL6P.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var Ce=Object.defineProperty,Le=(e,t)=>{for(var r in t)Ce(e,r,{get:t[r],enumerable:!0})},je=["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"],Me=new Set(je),Ue=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),Ie=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),Y=new Set(["checked","selected","disabled","readOnly","paused"]);function Pe(e,t){return t==null?Y.has(e)?!1:"":Y.has(e)?t==="false"?!1:!!t:t}var De={};Le(De,{EmptyListInsert:()=>R,MAX_RULE_DEPTH:()=>j,MaxRuleDepthExceeded:()=>V,NoRulesTag:()=>We,RuleTargetReadOnly:()=>fe,RulesParseError:()=>se,ShapeMismatch:()=>ce,UnknownRulesVersion:()=>ue,WriteNotRoundTripped:()=>He,WriteRefused:()=>Be,WriteRejected:()=>Ve});var se=class extends Error{constructor(e,t){super(e),this.name="RulesParseError",this.cause=t}},ue=class extends Error{constructor(e){super(`unknown rules version: ${e}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=e}},j=20,V=class extends Error{constructor(e){super(`rule depth exceeded ${j} at path: ${e.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=e}},ce=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}},fe=class extends Error{constructor(e){super(`cannot write to read-only DOM property "${e}"`),this.name="RuleTargetReadOnly",this.target=e}},Be=class extends Error{constructor(e){super(`write refused: ${e.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=e}};function qe(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:String(r),"")||"(root)"}var He=class extends Error{constructor(e){super(`write did not round-trip at "${qe(e)}"`),this.name="WriteNotRoundTripped",this.path=e}},We=class extends Error{constructor(e){super(`no <script data-rules-name~="${e}"> rules tag in this document`),this.name="NoRulesTag",this.token=e}},Ve=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}};function de(e){let t=0,r=null,l=-1;for(let n=0;n<e.length;n++){let o=e[n];o==="\\"?n++:r?o===r&&(r=null):o==='"'||o==="'"?r=o:o==="["||o==="("?t++:o==="]"||o===")"?t>0&&t--:o==="@"&&t===0&&(l=n)}return l}function pe(e){let t=0,r=null,l=-1,n=!1;for(let o=0;o<e.length;o++){let i=e[o];i==="\\"?o++:r?i===r&&(r=null):i==='"'||i==="'"?r=i:i==="["||i==="("?t++:i==="]"||i===")"?t>0&&t--:t===0&&i===">"?l=o:t===0&&i===","&&(n=!0)}return n||l===-1||!Fe(e,l+1)?null:e.slice(0,l).trim()||null}function Fe(e,t){let r=t,l=e.replace(/\s+$/,"").length;for(;r<l&&/\s/.test(e[r]);)r++;let n=0,o=null;for(;r<l;r++){let i=e[r];if(i==="\\")r++;else if(o)i===o&&(o=null);else if(i==='"'||i==="'")o=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 ze=/^--[A-Za-z0-9_-]+$/;function he(e){return typeof e=="string"&&ze.test(e)}function me(e){let t=[],r=[],l=null,n=0;for(let o=0;o<e.length;o++){let i=e[o];if(l){i==="\\"?o++:i===l&&(l=null);continue}if(i==="/"&&e[o+1]==="*"){let a=e.indexOf("*/",o+2);o=a===-1?e.length:a+1;continue}i==='"'||i==="'"?l=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,o)),n=o+1)}return t.push(e.slice(n)),t}function _e(e){let t="",r=null;for(let l=0;l<e.length;l++){let n=e[l];if(r){t+=n,n==="\\"&&l+1<e.length?t+=e[++l]:n===r&&(r=null);continue}if(n==="/"&&e[l+1]==="*"){let o=e.indexOf("*/",l+2);l=o===-1?e.length:o+1,t+=" ";continue}(n==='"'||n==="'")&&(r=n),t+=n}return t}function ye(e){e=_e(e);let t=e.indexOf(":");if(t===-1)return null;let r=e.slice(0,t).trim(),l=e.slice(t+1).trim(),n=/!\s*important\s*$/i.exec(l);return n&&(l=l.slice(0,n.index).trim()),{name:r,value:l,important:!!n}}function ge(e,t){if(e==null)return null;let r=null;for(let l of me(String(e))){let n=ye(l);!n||n.name!==t||(!r||n.important||!r.important)&&(r=n)}return r?r.value:null}function Je(e,t,r){let l=e==null?"":String(e),n=r==null||r==="",o=me(l),i=o.map(ye),a=i.some(f=>f&&f.name===t&&f.important),s=[],u=!1;o.forEach((f,d)=>{let h=i[d];if(!h||h.name!==t){s.push(f);return}if(n||u)return;let m=/^\s*/.exec(f)[0];s.push(`${m}${t}: ${r}${a?" !important":""}`),u=!0});let c=s.join(";");if(!n&&!u){let f=c.trimEnd();c=f===""?`${t}: ${r}`:`${f}${f.endsWith(";")?" ":"; "}${t}: ${r}`}return c.trim()===""?null:c}function Ge(e,t,r,l){let n=e.attr(t,"style");if((ge(n,r)??"")===l)return;let o=Je(n,r,l);o==null?e.removeAttr(t,"style"):e.attr(t,"style",o)}function we(e,t,r,l={}){if(Object.prototype.hasOwnProperty.call(l,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return P(e,t,r,{depth:0,path:[]},l)}function P(e,t,r,l,n){if(l.depth>j)throw new V(l.path);if(typeof r=="string")return Ye(e,t,r,l,n);if(Array.isArray(r)){let[o,i]=r,a=e.find(t,o,n);return ve(n,l,a),a.map((s,u)=>P(e,s,i,{depth:l.depth+1,path:[...l.path,u]},n))}if(typeof r=="object"&&r!==null){let o={};for(let[i,a]of Object.entries(r))o[i]=P(e,t,a,{depth:l.depth+1,path:[...l.path,i]},n);return o}return null}function Ye(e,t,r,l,n){if(r.endsWith("[]")){let a=r.slice(0,-2),s=e.find(t,a,n);return ve(n,l,s),s.map(u=>e.text(u))}if(r.startsWith("@"))return X(e,t,r.slice(1));let o=de(r);if(o!==-1){let a=r.slice(0,o),s=r.slice(o+1),u=a?e.find(t,a,n):[t];return u.length===0?null:X(e,u[0],s)}if(r===".")return e.text(t);let i=e.find(t,r,n);return i.length===0?null:e.text(i[0])}function ve(e,t,r){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),r)}catch(l){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,l)}}function X(e,t,r){if(he(r))return ge(e.attr(t,"style"),r);if(Me.has(r)){let n=e.prop(t,r);return n==null?null:String(n)}return e.attr(t,r)??null}function Xe(e,t,r,l){let n=e.length,o=t.length,i=new Array(n).fill(-1);if(l){let p=new Set;for(let y=0;y<n;y++){let g=l[y];!(g>=0&&g<o)||p.has(g)||(i[y]=g,p.add(g))}}if(n===0||o===0)return i;let a=e.map(p=>K(p,r)),s=t.map(p=>K(p,r)),u=new Array(o).fill(!1);for(let p of i)p>=0&&(u[p]=!0);let c=new Map;s.forEach((p,y)=>{u[y]||c.set(p,c.has(p)?-1:y)});let f=new Map;a.forEach((p,y)=>{i[y]>=0||f.set(p,(f.get(p)||0)+1)}),a.forEach((p,y)=>{if(i[y]>=0||f.get(p)!==1)return;let g=c.get(p);g===void 0||g===-1||u[g]||(i[y]=g,u[g]=!0)});let d=[];for(let p=0;p<n;p++)i[p]<0&&d.push(p);let h=[];for(let p=0;p<o;p++)u[p]||h.push(p);if(d.length===0||h.length===0)return i;let m=n*o+1,w=Ke(e,t,r),v=(p,y)=>w(p,y)*m+Math.abs(p-y);for(let[p,y]of Ze(d,h,v))i[p]=y;return i}var be=e=>typeof e=="object"&&e!==null;function K(e,t){if(!be(t))return e==null?" null":String(e);let r=Object.keys(t);return JSON.stringify(r.map(l=>{let n=JSON.stringify(e?.[l]);return n===void 0?" undef":n}))}function Ke(e,t,r){if(!be(r))return(a,s)=>e[a]===t[s]?0:1;let l=Object.keys(r),n=a=>l.map(s=>JSON.stringify(a?.[s])),o=e.map(n),i=t.map(n);return(a,s)=>{let u=o[a],c=i[s],f=0;for(let d=0;d<l.length;d++)u[d]!==c[d]&&f++;return f}}function Ze(e,t,r){return e.length<=t.length?Z(e,t,r,!1):Z(t,e,(l,n)=>r(n,l),!0)}function Z(e,t,r,l){let n=e.length,o=t.length,i=[];for(let f=0;f<=n;f++)i.push(new Float64Array(o+1).fill(1/0));let a=[];for(let f=0;f<=n;f++)a.push(new Uint8Array(o+1));for(let f=0;f<=o;f++)i[n][f]=0;for(let f=n-1;f>=0;f--)for(let d=o-1;d>=0;d--){let h=r(e[f],t[d])+i[f+1][d+1],m=i[f][d+1];h<=m?(i[f][d]=h,a[f][d]=1):i[f][d]=m}let s=[],u=0,c=0;for(;u<n&&c<o;)a[u][c]&&(s.push(l?[t[c],e[u]]:[e[u],t[c]]),u++),c++;return s}function xe(e,t,r,l,n,o,i,a={}){let s=e.find(t,r,a);if(n.length===0){s.forEach(b=>e.remove(b)),D(a,"onRowsApplied",o.path,[]);return}let u=n.length>s.length,c=s[0]||null;if(u&&!c&&(c=rt(e,t,r,a),!c))throw new R(o.path);let f=s.map(b=>tt(e,b,l,a)),d=null;if(u&&c){d=e.clone(c),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 "${o.path.join(".")||"(root)"}"`)}let h=Xe(n,f,l,Qe(e,s,n,o,a)),m=s.length>0?e.parent(s[0]):it(e,t,r,c,o,a),w=s.length>0?Ae(e,m,s[0]):0,v=ut(e,s),p=new Set,y=[],g=n.map((b,E)=>{let N=h[E];if(N>=0)return p.add(N),y.push(!1),s[N];y.push(!0);let T=e.clone(d);return e.stripIds(T),T});s.forEach((b,E)=>{p.has(E)||e.remove(b)}),v?st(e,m,w,g,y):ct(e,g,y,m,w),et(e,g,l,n,o,i,a),D(a,"onRowsApplied",o.path,g)}function D(e,t,r,l){if(typeof e[t]=="function")try{return e[t](r.slice(),l)}catch(n){console.warn(`[hyper-html-api] ${t} threw at "${r.join(".")||"(root)"}"`,n);return}}function Qe(e,t,r,l,n){let o=D(n,"identifyRows",l.path,r);if(!Array.isArray(o))return null;let i=new Array(r.length).fill(-1),a=new Set,s=new Map(t.map((u,c)=>[e.identity(u),c]));for(let u=0;u<r.length;u++){if(!o[u])continue;let c=s.get(e.identity(o[u]));c===void 0||a.has(c)||(i[u]=c,a.add(c))}return i}function et(e,t,r,l,n,o,i){t.forEach((a,s)=>{if(r===null){let u=l[s],c=u==null?"":String(u);e.text(a)!==c&&e.text(a,c)}else{let u=o(e,a,r,l[s],{depth:n.depth+1,path:[...n.path,s]},i);u&&u!==a&&(t[s]=u)}})}function tt(e,t,r,l){return r===null?e.text(t):we(e,t,r,l.onRowsRead?{...l,onRowsRead:void 0}:l)}function Ae(e,t,r){let l=e.children(t);for(let n=0;n<l.length;n++)if(e.sameNode(l[n],r))return n;return-1}function rt(e,t,r,l){if(!l.templateAttr)return null;let n=/^\s*:scope\s*>\s*/.test(r),o=new RegExp(":not\\(\\["+l.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),i=r.replace(/^\s*:scope\s*>\s*/,"").replace(o,""),a=n?nt(i):0,s=pe(i),u=t;for(;u;){let c=e.find(u,i,{includeRulesTag:!1,templateAttr:null});for(let f of c)if(e.attr(f,l.templateAttr)!=null&&!(n&&!ot(e,t,f,a))&&!(s&&!e.matches(e.parent(f),s)))return f;u=e.parent(u)}return null}function nt(e){let t=0,r=null,l=1;for(let n=0;n<e.length;n++){let o=e[n];if(o==="\\")n++;else if(r)o===r&&(r=null);else if(o==='"'||o==="'")r=o;else if(o==="["||o==="(")t++;else if(o==="]"||o===")")t>0&&t--;else if(t===0&&o===">")l++;else{if(t===0&&(o==="+"||o==="~"))return null;if(t===0&&/\s/.test(o)){if(!lt(e,n))return null;for(;n+1<e.length&&/\s/.test(e[n+1]);)n++}}}return l}function lt(e,t){let r=t;for(;r<e.length&&/\s/.test(e[r]);)r++;let l=t>0?e[t-1]:"",n=r<e.length?e[r]:"";return Q(l)||Q(n)}function Q(e){return e===">"||e==="+"||e==="~"}function ot(e,t,r,l){if(l===null)return!0;let n=r;for(let s=0;s<l;s++)if(n=e.parent(n),!n)return!1;let o=e.prop(t,"tagName");if(!o)return!0;let i=e.prop(n,"tagName");if(!i||String(i).toLowerCase()!==String(o).toLowerCase())return!1;let a=new Set(ee(e,n));return ee(e,t).every(s=>a.has(s))}function ee(e,t){let r=e.attr(t,"class");return r?String(r).split(/\s+/).filter(Boolean):[]}function it(e,t,r,l,n,o){let i=e.parent(l);if(i&&at(e,t,i)&&!re(e,i,o))return i;let a=pe(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,o)).filter(u=>!re(e,u,o));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 l=r;for(;l;){if(e.sameNode(l,t))return!0;l=e.parent(l)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(n=>e.sameNode(n,r))}var te=["no-data","editor-ui"];function re(e,t,r){let l=t;for(;l;){if(r.templateAttr&&e.attr(l,r.templateAttr)!=null||te.some(o=>e.attr(l,o)!=null))return!0;let n=e.attr(l,"clay");if(n&&n.split(/\s+/).some(o=>te.includes(o)))return!0;l=e.parent(l)}return!1}function st(e,t,r,l,n){let o=e.children(t),i=o.map(s=>e.identity(s)),a=!1;l.forEach((s,u)=>{let c=e.identity(s),f=r+u;if(i[f]===c)return;if(!n[u]){let h=i.indexOf(c);h!==-1&&(i.splice(h,1),o.splice(h,1))}let d=Math.min(f,o.length);d<o.length?e.insertBefore(o[d],s):o.length?a?e.insertAfter(o[o.length-1],s):(e.insertAt(t,s,f),a=!0):e.insertAt(t,s,0),i.splice(d,0,c),o.splice(d,0,s)})}function ut(e,t){if(t.length<=1)return!0;let r=e.parent(t[0]);if(!r)return!1;let l=new Map(e.children(r).map((o,i)=>[e.identity(o),i])),n=[];for(let o of t){let i=l.get(e.identity(o));if(i===void 0)return!1;n.push(i)}return n.sort((o,i)=>o-i),n[n.length-1]-n[0]===n.length-1}function ct(e,t,r,l,n){let o=null,i=n;for(let a=0;a<t.length;a++){if(!r[a]){o=t[a];continue}let s=o?e.parent(o):l;if(!s)continue;let u=o?Ae(e,s,o)+1:i++;e.insertAt(s,t[a],u),o=t[a]}}function ft(e,t,r,l,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.");let o=[];if(B(r,l,[],o),o.length)throw new ce(o);L(e,t,r,l,{depth:0,path:[]},n)}function L(e,t,r,l,n,o={}){if(n.depth>j)throw new V(n.path);if(l===void 0)return t;if(typeof r=="string")return dt(e,t,r,l,n,o);if(Array.isArray(r)){let[i,a]=r;return xe(e,t,i,a,l,n,L,o),t}if(typeof r=="object"&&r!==null){for(let[i,a]of Object.entries(r)){let s=L(e,t,a,l==null?l:l[i],{depth:n.depth+1,path:[...n.path,i]},o);s&&s!==t&&(t=s)}return t}return t}function dt(e,t,r,l,n,o){if(r.endsWith("[]")){let s=r.slice(0,-2);return xe(e,t,s,null,l,n,L,o),t}if(r.startsWith("@"))return le(e,t,r.slice(1),l);let i=de(r);if(i!==-1){let s=r.slice(0,i),u=r.slice(i+1),c=s?e.find(t,s,o):[t];return c.length===0||le(e,c[0],u,l),t}if(r===".")return ne(e,t,l),t;let a=e.find(t,r,o);return a.length===0||ne(e,a[0],l),t}function ne(e,t,r){let l=r==null?"":String(r);e.text(t)!==l&&e.text(t,l)}function pt(e,t,r,l){if(e.styleVar){e.styleVar(t,r,l);return}Ge(e,t,r,l)}function le(e,t,r,l){if(he(r))return pt(e,t,r,l==null?"":String(l).trim()),t;if(Ie.has(r)){let n=e.prop(t,r);if(n===l||n!=null&&l!=null&&String(n)===String(l))return t;throw new fe(r)}if(r==="outerHTML"){let n=l==null?"":String(l);return e.replaceWith(t,n)}if(Ue.has(r)){let n=Pe(r,l);return e.prop(t,r)!==n&&e.prop(t,r,n),t}if(l==null)e.attr(t,r)!=null&&e.removeAttr(t,r);else{let n=String(l);e.attr(t,r)!==n&&e.attr(t,r,n)}return t}function B(e,t,r,l){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((n,o)=>{typeof n=="object"&&n!==null&&l.push({path:S([...r,o]),expected:"scalar",got:k(n)})}):l.push({path:S(r),expected:"array",got:k(t)});return}t!==null&&typeof t=="object"&&l.push({path:S(r),expected:"scalar",got:k(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){l.push({path:S(r),expected:"array",got:k(t)});return}let n=e[1];t.forEach((o,i)=>B(n,o,[...r,i],l));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){l.push({path:S(r),expected:"object",got:k(t)});return}for(let[n,o]of Object.entries(e))B(o,t[n],[...r,n],l)}}}function k(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function S(e){return e.join(".")}function ht(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 o=[],i=0;for(;i<n.length;){let a=n[i];if(/\s/.test(a)){i++;continue}if("{}".includes(a)){o.push({type:a,value:a}),i++;continue}if(a==="["){let f=!1,d=i+1;for(;d<n.length&&/\s/.test(n[d]);)d++;if(d<n.length&&/[a-zA-Z_]/.test(n[d])&&(f=!0),!f){o.push({type:a,value:a}),i++;continue}}if(a==="]"){o.push({type:a,value:a}),i++;continue}if(a===":"){o.push({type:t.COLON,value:a}),i++;continue}if(a===","){o.push({type:t.COMMA,value:a}),i++;continue}if(a==='"'||a==="'"){let f=a,d=i+1;for(;d<n.length&&n[d]!==f;)n[d]==="\\"&&d++,d++;o.push({type:t.STRING,value:n.substring(i+1,d),quoted:!0,sourceQuote:f}),i=d+1;continue}let s=i,u;for(;s<n.length&&!/[{},]/.test(n[s]);)if(n[s]===":"){let f=[":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 h of f){let m=h.substring(1);if(n.substring(s+1,s+1+m.length)===m){d=!0,s+=m.length;break}}if(!d)break}else if(n[s]==="["){for(s++;s<n.length&&n[s]!=="]";){if(n[s]==='"'||n[s]==="'"){let f=n[s];for(s++;s<n.length&&n[s]!==f;)n[s]==="\\"&&s++,s++}s++}s<n.length&&n[s]==="]"&&s++}else s++;u=n.substring(i,s);let c=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(u)?c=t.NUMBER:u==="true"||u==="false"||u==="null"?c=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(u)&&(c=t.SELECTOR),o.push({type:c,value:u,quoted:!1}),i=s}return o}function l(n){let o="";for(let i=0;i<n.length;i++){let a=n[i];if("{}".includes(a.type)||"[]".includes(a.type)){o+=a.value;continue}if(a.type===t.COLON){o+=a.value;continue}if(a.type===t.COMMA){let s=n[i+1];if(s&&(s.type==="}"||s.type==="]"))continue;o+=a.value;continue}if(a.type===t.STRING&&a.quoted){let s=a.value;a.sourceQuote==="'"&&(s=s.replace(/\\'/g,"'"),s=s.replace(/(\\*)"/g,(u,c)=>c.length%2===0?c+'\\"':u)),o+=`"${s}"`;continue}if(a.type===t.NUMBER||a.type===t.BOOLEAN){o+=a.value;continue}if(a.type===t.SELECTOR||a.type===t.IDENTIFIER){o+=`"${a.value}"`;continue}o+=`"${a.value}"`}return o}try{let n=r(e),o=l(n);return JSON.parse(o)}catch(n){throw new se("Invalid extraction rules syntax: "+n.message,n)}}var mt="1";var or=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"]})}),ir=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),yt=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);var ar=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",...yt],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 gt(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function wt(e){return e?(e.nodeType===9||e.nodeType,e):null}function oe(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 vt(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function bt(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 l=r.type;l!=="file"&&l!=="checkbox"&&l!=="radio"&&(r.value=r.defaultValue),r.checked=r.defaultChecked}else r.tagName==="OPTION"&&(r.selected=r.defaultSelected)}var xt={semanticExclude:!0,find(e,t,r={}){let l=wt(e);if(!l||!l.querySelectorAll)return[];let n=Array.from(l.querySelectorAll(t));r.includeRulesTag||(n=n.filter(a=>!gt(a)));let o=[];r.skip&&o.push(r.skip);let i=r.templateAttr===null?null:r.templateAttr||"cms-template";if(i&&o.push("["+i+"]"),o.length){let a=o.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,vt(e,t)},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r),oe(e,t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),oe(e,t,null)},prop(e,t,r){if(r===void 0){let l=e?e[t]:void 0;return l!==void 0?l:null}e[t]=r},clone(e){let t=e.cloneNode(!0);return bt(t),t},insertAt(e,t,r){let l=e.children[r]||null;e.insertBefore(t,l)},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 l=r.content.firstElementChild;if(!l)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(l,e),l},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 C=xt;var At="hha:upgrade-check:";function x(e,t){let r=e.querySelector(`meta[name="${t}"]`),l=r?r.getAttribute("content"):null;return l&&l.trim()?l.trim():null}function ie(e){if(typeof e!="string")return null;let t=e.trim().replace(/^v/,"");return/^\d+(\.\d+)*$/.test(t)?t.split(".").map(Number):null}function Tt(e,t){let r=ie(e),l=ie(t);if(!r||!l)return!1;let n=Math.max(r.length,l.length);for(let o=0;o<n;o++){let i=r[o]||0,a=l[o]||0;if(i!==a)return i>a}return!1}function Ot(e){try{let t=globalThis.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function Et(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}async function Nt({force:e=!1,doc:t,loc:r,fetchFn:l,now:n,ttlMs:o=864e5}={}){if(t=t||(typeof document<"u"?document:null),r=r||(typeof location<"u"?location:null),l=l||(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 u=`${At}${s.href}:${a||"none"}`,c,f=e?null:Ot(u);if(f&&typeof f.checkedAt=="number"&&n-f.checkedAt<o)c=f.sourceVersion;else{try{let d=await l(s.href);if(!d.ok)throw new Error(`HTTP ${d.status}`);let h=await d.text(),m=new DOMParser().parseFromString(h,"text/html");c=x(m,"hyper-version")}catch{c=null}Et(u,{checkedAt:n,sourceVersion:c})}return c?{available:Tt(c,a||"0.0.0"),currentVersion:a,sourceVersion:c,sourceUrl:s.href}:null}var kt="script[data-rules-name]";function St(e){return typeof e=="string"?e.trim().replace(/\s+/g," "):""}function Te(e,t){let r=e.find(t,kt,{includeRulesTag:!0}),l=new Set,n=[];for(let o of r){let i=St(e.attr(o,"data-rules-name"));if(!i)continue;if(l.has(i)){console.warn(`hyper-html-api: duplicate rules tag name "${i}"; using the first.`);continue}let a=e.attr(o,"data-rules-version");if(a!==mt)throw new ue(a);l.add(i),n.push({name:i,rules:ht(e.text(o))})}return n}function Oe(e,t){let r={};for(let{name:l,rules:n}of Te(e,t))r[l]=we(e,t,n);return r}function Rt(e){let t=e||document,r=t.nodeType===9?t:t.ownerDocument||t;return{dataByName:Oe(C,t),version:x(r,"hyper-version")}}var ae=class extends Error{constructor(e,t){super(`could not fetch upgrade source: ${e}`),this.name="UpgradeSourceUnreachable",this.sourceUrl=e,this.cause=t}},$t=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}},q=class extends Error{constructor(e,t){super(e),this.name="UpgradeTransformInvalid",this.cause=t}},Ct=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}},Lt="text/hyper-upgrade";function jt(e,t){let r=e.find(t,`script[type="${Lt}"]`);if(r.length===0)return null;if(r.length>1)throw new Ct(r.length);return e.text(r[0])||null}var Mt=new Function("url","return import(url)");async function Ut(e){let t=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(t),l;try{l=await Mt(r)}catch(n){throw new q(`transform failed to load: ${n&&n.message?n.message:n}`,n)}finally{URL.revokeObjectURL(r)}if(typeof l.default!="function")throw new q("transform must `export default` a function");return l.default}function Ee(e,t){let r={carriedOver:0,discarded:0,listItems:0},l=H(t,e,r);return W(t,e,r),{data:l,summary:r}}function H(e,t,r){if(typeof e=="string")return e.endsWith("[]")?Array.isArray(t)?(r.listItems+=t.length,r.carriedOver+=t.length,t):void 0:t==null||typeof t=="object"?void 0:(r.carriedOver++,t);if(Array.isArray(e)){let[,l]=e;return Array.isArray(t)?(r.listItems+=t.length,t.map(n=>H(l,n,r))):void 0}if(typeof e=="object"&&e!==null){let l={};for(let[n,o]of Object.entries(e)){let i=H(o,t?.[n],r);i!==void 0&&(l[n]=i)}return l}}function W(e,t,r){if(t!=null){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){if(typeof t!="object"||Array.isArray(t))return;let l=new Set(Object.keys(e));for(let n of Object.keys(t))l.has(n)?W(e[n],t[n],r):r.discarded+=$(t[n]);return}if(Array.isArray(e)&&Array.isArray(t)){let l=e[1];t.forEach(n=>W(l,n,r));return}typeof e=="string"&&!e.endsWith("[]")&&typeof t=="object"&&t!==null&&(r.discarded+=$(t))}}function $(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+$(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+$(r),0):1}function It(e,t,r){let l=Te(e,t),n={carriedOver:0,discarded:0,listItems:0},o={},i=new Set;for(let{name:a,rules:s}of l){if(i.add(a),!Object.prototype.hasOwnProperty.call(r,a)){o[a]={carriedOver:0,discarded:0,listItems:0};continue}let{data:u,summary:c}=Ee(r[a],s);ft(e,t,s,u),o[a]=c,n.carriedOver+=c.carriedOver,n.discarded+=c.discarded,n.listItems+=c.listItems}for(let a of Object.keys(r))i.has(a)||(n.discarded+=$(r[a]));return{totals:n,byName:o,rulesTagCount:l.length}}async function Pt({sourceUrl:e,dataByName:t,fromVersion:r,doc:l,loc:n,fetchFn:o}={}){if(l=l||(typeof document<"u"?document:null),n=n||(typeof location<"u"?location:null),o=o||(p=>fetch(p)),!l)throw new Error("upgrade.run requires a document context");if(e=e||x(l,"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(l,"hyper-version"),t=t||Oe(C,l);let a;try{a=await o(i.href)}catch(p){throw new ae(i.href,p)}if(!a.ok)throw new ae(i.href,new Error(`HTTP ${a.status}`));let s=await a.text(),u=new DOMParser().parseFromString(s,"text/html"),c=x(u,"hyper-version"),f=t,d=!1,h=jt(C,u);if(h){let p=await(await Ut(h))(f,{fromVersion:r,toVersion:c});if(!p||typeof p!="object"||Array.isArray(p))throw new q("transform must return a plain object map of { rulesName: data }");f=p,d=!0}let{totals:m,byName:w,rulesTagCount:v}=It(C,u,f);if(v===0&&Object.keys(f).length>0)throw new $t(i.href);return{html:Bt(u),fromVersion:r,toVersion:c,summary:{transformApplied:d,totals:m,byName:w}}}function Dt(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 l=r.findIndex(n=>n.hasAttribute("selected"));if(t.selectedIndex===l||l===-1&&t.selectedIndex<=0)continue}for(let l of r)l.selected!==l.hasAttribute("selected")&&l.toggleAttribute("selected",l.selected)}}function Bt(e){return Dt(e),`<!DOCTYPE ${e.doctype&&e.doctype.name?e.doctype.name:"html"}>
|
|
2
|
-
`+e.documentElement.outerHTML}var M={checkForUpdate:Nt,run:Pt,extractAll:Rt,shapeMatch:Ee};var A="The new version could not be downloaded. Nothing was changed.",U="The upgrade could not be saved. Nothing was changed.",Se="This document changed somewhere else. Reload and try again.",qt="Something else is changing this document. Nothing was changed.",Ht="This document does not say which parts are its data, so it cannot be upgraded safely. Nothing was changed.",Wt="The new version has no place for this page's content. Nothing was changed.";async function Vt(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(l=>l.toString(16).padStart(2,"0")).join("")}async function Ne(e,t){try{let r=await e(t,{credentials:"omit"});return!r||!r.ok?null:r}catch{return null}}function Ft(e,t,r){if(e&&typeof e.latestUrl=="string"&&e.latestUrl)return e.latestUrl;let l=x(t,"hyper-source");if(!l)return null;try{let n=new URL(l,r?r.href:void 0);return n.pathname=n.pathname.replace(/\.html$/,".json"),n.href}catch{return null}}function zt(e){let t=x(e,"clay-template");if(!t)return null;let[r,l]=t.split(/\s+/);return r&&l?{id:r,variant:l}:null}function I(e,t="",r=[]){if(Array.isArray(e)){for(let l of e)I(l,`${t}[]`,r);return r}if(e&&typeof e=="object"){for(let[l,n]of Object.entries(e))I(n,t?`${t}.${l}`:l,r);return r}return e!=null&&r.push({path:t,value:e}),r}function _t(e,t){let r=[e];for(let l of String(t).split(".")){let n=l.endsWith("[]"),o=n?l.slice(0,-2):l,i=[];for(let a of r){let s=o?a?.[o]:a;n?Array.isArray(s)&&i.push(...s):i.push(s)}r=i}return r}function Jt(e,t,r={}){let l=new Map;for(let{path:o,value:i}of I(t)){let a=`${o}\0${String(i)}`;l.set(a,(l.get(a)||0)+1)}let n=[];for(let{path:o,value:i}of I(e)){let a=`${o}\0${String(i)}`;if(l.get(a)>0){l.set(a,l.get(a)-1);continue}let s=r[o];typeof s=="string"&&_t(t,s).some(u=>u===i)||n.push({path:o,value:i})}return n}async function Gt(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 Yt(e){let r=new DOMParser().parseFromString(e,"text/html").querySelector('script[type="text/hyper-upgrade"]');if(!r)return{};let l=await Gt(r.textContent||"");return l&&l.renames&&typeof l.renames=="object"?l.renames:{}}var ke='script[clay~="live"][merge]';function Xt(e,t,r){let l=t.querySelector("article[data-page]");if(!l)return null;l.replaceWith(t.importNode(r,!0));for(let o of e.querySelectorAll(ke)){let i=o.getAttribute("merge");if(i!=="page"&&!i.startsWith("page."))continue;let a=t.importNode(o,!0),s=[...t.querySelectorAll(ke)].find(u=>u.getAttribute("merge")===i);s?s.replaceWith(a):t.querySelector("article[data-page]").after(a)}return(t.doctype?`<!DOCTYPE ${t.doctype.name}>
|
|
3
|
-
`:"")+t.documentElement.outerHTML}async function Re(e,{doc:t=document,loc:r=location,fetchFn:l=(n,o)=>fetch(n,o)}={}){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 o=Ft(e,t,r);if(!o)return{ok:!1,code:"unavailable",message:A};let i=await Ne(l,o);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=zt(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 u=x(t,"hyper-version");if(!u||typeof a.version!="string"||!J(a.version,u))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 c;try{c=new URL(a.html,o).href}catch{return{ok:!1,code:"unavailable",message:A}}if(!/^https:\/\/hyperclay\.com\/templates\//.test(c))return{ok:!1,code:"source",message:"This upgrade is not from the template host."};let f=await Ne(l,c);if(!f)return{ok:!1,code:"unavailable",message:A};let d;try{d=await f.text()}catch{return{ok:!1,code:"unavailable",message:A}}let h=await Vt(new TextEncoder().encode(d));if(!h||h!==String(a.sha256||"").toLowerCase())return{ok:!1,code:"unavailable",message:A};let m,w;try{w=await Yt(d),m=await M.run({sourceUrl:c,doc:t,loc:r,fromVersion:u,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(m.html,"text/html"),p=M.extractAll(t).dataByName,y=t.querySelector("article[data-page]");if(!y&&!Object.keys(p||{}).length)return{ok:!1,code:"undeclared",message:Ht};let g=m.html;if(y){let T=Xt(t,v,y);if(!T)return{ok:!1,code:"lost",lost:[],discarded:0,message:Wt};g=T}let b=M.extractAll(v).dataByName,E=Jt(p,b,w),N=m.summary&&m.summary.totals&&m.summary.totals.discarded||0;return E.length||N>0?{ok:!1,code:"lost",lost:E,discarded:N,message:Kt(E,N)}:{ok:!0,html:g,version:m.toVersion||a.version}}function Kt(e,t){let r=e.slice(0,5).map(({path:n})=>n),l=e.length>r.length?` and ${e.length-r.length} more`:"";return r.length?`This upgrade would lose data: ${r.join(", ")}${l}. Nothing was changed.`:`This upgrade would lose ${t} value${t===1?"":"s"}. Nothing was changed.`}function Zt(e){let t=e&&e.state;if(t==="conflict")return{ok:!1,code:"conflict",message:Se};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 $e(e,{doc:t=document,loc:r=location,fetchFn:l=(s,u)=>fetch(s,u),clay:n=typeof window<"u"?window.clay:null,reload:o=()=>window.location.reload(),replace:i=null,etag:a}={}){if((n||{}).isDraftMode)return{ok:!1,code:"draft"};let u=z("upgrade");if(!u)return{ok:!1,code:"busy",message:qt};try{return await Qt(e,{doc:t,loc:r,fetchFn:l,clay:n,reload:o,replace:i,etag:a})}finally{_(u)}}async function Qt(e,{doc:t,loc:r,fetchFn:l,clay:n,reload:o,replace:i,etag:a}){let s=n||{};if(s.isEditMode&&s.save&&typeof s.save.flush=="function"){let h;try{h=await s.save.flush()}catch(m){return Zt(m)}if(h&&typeof h.state=="string"&&h.state!=="saved"&&h.state!=="clean"&&h.state!=="view")return{ok:!1,code:"flush",state:h.state,message:"This document has changes that could not be saved. Nothing was changed."}}let u=t;if(s.isEditMode&&typeof s.getHTML=="function")try{u=new DOMParser().parseFromString(await s.getHTML(),"text/html")}catch{return{ok:!1,code:"failed",message:U}}let c=await Re(e,{doc:u,loc:r,fetchFn:l});if(!c.ok)return c;let f=typeof i=="function"?i:s.save&&typeof s.save.replace=="function"?s.save.replace:G,d;try{d=await f(c.html,{etag:a!==void 0?a:F()})}catch{return{ok:!1,code:"failed",message:U}}if(!d||!d.ok){let h=d&&d.code?d.code:"failed";return h==="conflict"?{ok:!1,code:h,message:Se}:h==="forbidden"?{ok:!1,code:h,message:"You are not allowed to save this document."}:h==="unsupported"?{ok:!1,code:h,message:"This host cannot save the upgrade."}:{ok:!1,code:h,message:U}}return o(),{ok:!0,html:c.html,version:c.version,etag:d.etag}}function O(e,t,r={}){let l=e.createElement(t);l.setAttribute("clay","editor-ui");for(let[n,o]of Object.entries(r))n==="style"?l.setAttribute("style",o):n==="text"?l.textContent=o:l.setAttribute(n,o);return l}function er(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 tr(e,{loc:t=location,fetchFn:r=(l,n)=>fetch(l,n)}={}){if(typeof e.getHTML=="function")return e.getHTML();let l=await r(t.href,{cache:"no-store",credentials:"same-origin"});if(!l.ok)throw new Error(`copy fetch ${l.status}`);return l.text()}async function rr({clay:e,doc:t=document,loc:r=location,fetchFn:l}={}){if(typeof URL>"u"||typeof URL.createObjectURL!="function")return!1;try{let n=await tr(e,{loc:r,fetchFn:l});if(typeof n=="string"&&/clay|data-paid-only/i.test(n)){let{stripCopyContent:a}=await import("./c-C4IIQZGJ.js");n=a(n)}let o=URL.createObjectURL(new Blob([n],{type:"text/html"})),i=t.createElement("a");return i.setAttribute("clay","editor-ui"),i.href=o,i.download=er(r),i.style.setProperty("display","none","important"),t.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(o),4e4),!0}catch{return!1}}async function nr(e){let t=e&&e.host;if(!t||!t.versions)return!1;try{return await t.versions===!0}catch{return!1}}async function lr(e,t={}){let r=t.doc||document,l=t.clay||(typeof window<"u"?window.clay:null)||{};if(l.isDraftMode||!e||typeof e.version!="string")return null;let n=await nr(l),o=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;"}),u=O(r,"p",{role:"status",style:"margin:0 0 12px;min-height:1.5em;"}),c=O(r,"div",{style:"display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;"}),f="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:f}),h=n?null:O(r,"button",{type:"button",text:"Download a copy first",style:f}),m=O(r,"button",{type:"button",text:"Upgrade",style:`${f}border-color:transparent;background:#2f6fed;color:#fff;font-weight:600;`});n||(m.disabled=!0),h&&c.append(h),c.append(d,m),i.append(a,s,u,c),o.append(i),r.body.appendChild(o);let w=!1,v=()=>{w||(w=!0,o.remove())};h&&h.addEventListener("click",async()=>{await rr({clay:l,doc:r,loc:t.loc,fetchFn:t.fetchFn})?(m.disabled=!1,u.textContent="Your copy was downloaded."):u.textContent="The copy could not be downloaded. Nothing was changed."}),d.addEventListener("click",v);let p,y=new Promise(g=>{p=g});return m.addEventListener("click",async()=>{m.disabled=!0,h&&(h.disabled=!0),u.textContent=`Upgrading to version ${e.version}\u2026`;let g=await $e(e,t);if(g.ok){v(),p(g);return}u.textContent=g.message||U,m.disabled=!1,h&&(h.disabled=!1),p(g)}),{root:o,title:a,body:s,status:u,cancel:d,download:h,upgrade:m,close:v,done:y}}export{$e as apply,Re as prepare,lr as start};
|
package/dist/m/c-EGTIAL6P.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as $}from"./c-XQXZAO7N.js";import{e as Y}from"./c-S7LK4KUE.js";import{c as z}from"./c-VG5XIN4T.js";import{b as H,i as I,o as N}from"./c-HA6INT6J.js";import{c as D,h as A,j as T,k,n as C,o as L}from"./c-ICMAOOGK.js";var K=[],i=[],g=new WeakMap,w=null,B=null,b=0;function de(){return b}function V(e){return g.get(e)||null}var M=new WeakMap,v=null;function he(){return v}function me(e){v&&e&&(v.artifact=e)}var R=null,x=new Map;function ye(e){R=e}function ve(e){return e==null?null:x.get(e)??null}function Se(e){return e&&M.get(e)||null}function j(e){e&&(M.delete(e),x.delete(e.captureId))}function W(e){let t=o=>{if(o.hasAttribute("onbeforesave")||o.hasAttribute("onbeforesnapshot"))return!0;let r=o.localName==="template"&&o.content?o.content:o;for(let n of r.children)if(t(n))return!0;return!1};return e.nodeType===1?t(e):!1}function l(e){for(let t of e.querySelectorAll(L))t.remove()}function h(e,t){for(let o of e.querySelectorAll(`[${t}]`))if(l(e),!(o!==e&&!e.contains(o)))try{new Function(o.getAttribute(t)).call(o)}catch(r){console.error(`[${t}] handler failed:`,r)}}var O=null;function Ce(e){O=e}function xe(e){return O?.(e),e}function Ae(e){K.push(e)}function Te(e,{steps:t=null}={}){w=e,B=t}var G="http://www.w3.org/1999/xhtml";function P(e){let t=X(e);if(!t.length)return"<!DOCTYPE html>"+e.outerHTML;let o=J(t),r;try{r="<!DOCTYPE html>"+e.outerHTML}finally{for(let[n,c]of t)n.replaceChildren(...c)}for(let[n,c]of o)r=r.split(n).join(c);return r}function X(e){let t=[],o=r=>{for(let n of r.childNodes)if(n.nodeType===1){if(n.localName==="noscript"&&n.namespaceURI===G){let c=Array.from(n.childNodes);c.length&&c.every(a=>a.nodeType===3)&&t.push([n,c]);continue}o(n.localName==="template"&&n.content?n.content:n)}};return o(e),t}function J(e){let t=Math.random().toString(36).slice(2);return e.map(([o,r],n)=>{let c=`\uE000clay-noscript-${t}-${n}\uE000`;return o.replaceChildren(o.ownerDocument.createTextNode(c)),[c,r.map(a=>a.data).join("")]})}function U(e,t){let o=v;v=e;try{return t()}finally{v=o}}function q(e,t=null){if(t&&R){let r=null;try{r=R(e)}catch{}r&&x.set(t.captureId,r)}let o=P(e);if(!w)return o;try{return U(t,()=>w(e,o))}catch(r){return console.error("clayjs: save renderer failed, sending the full serialization",r),o}}function ge(e){i.push(e)}function d(e,t=!0){let o=window.__preventOnclone;window.__preventOnclone=!0;try{return e.cloneNode(t)}finally{window.__preventOnclone=o}}function E(e,t){let o=g.get(e);o&&g.set(t,o);let r=e.children,n=t.children;for(let c=0;c<r.length;c++)E(r[c],n[c])}function f({flushUndo:e=!0,authored:t=!0,forSave:o=!1,requestRefresh:r=!1,context:n=null}={}){e&&typeof window<"u"&&window.clay?.undo?.flush&&window.clay.undo.flush();let a=$(document.documentElement,{capability:"snapshot",provenance:g}).root;for(let m of K)l(a),m(a,{original:V,forSave:o,requestRefresh:r});return Y(a),O?.(a),l(a),n&&(n.authoredHandlers=W(a)),t&&h(a,"onbeforesnapshot"),l(a),D(a),N(a),H(a),a}function _(e,{authored:t=!0}={}){l(e),t&&h(e,"onbeforesave");for(let o of i)l(e),o(e);l(e);for(let o of e.querySelectorAll(A))o.remove();return F(e),e}function F(e){for(let t of e.querySelectorAll("[sap-error]"))t.removeAttribute("sap-error")}function Q({flushUndo:e=!0,authored:t=!0}={}){return _(f({flushUndo:e,authored:t}),{authored:t})}var Z=["style","class"];function ee(e){z(e);for(let t of Z){e.getAttribute(t)===""&&e.removeAttribute(t);for(let o of e.querySelectorAll(`[${t}=""]`))o.removeAttribute(t)}}function S(e){return ee(e),"<!DOCTYPE html>"+e.outerHTML}function we({flushUndo:e=!0}={}){let t=f({flushUndo:e});h(t,"onbeforesave");for(let o of t.querySelectorAll(T))o.remove();for(let o of i)l(t),o(t);return l(t),S(t)}function Re({flushUndo:e=!0}={}){let t=f({flushUndo:e});h(t,"onbeforesave");for(let o of t.querySelectorAll(C))o.remove();for(let o of i)l(t),o(t);return l(t),S(t)}function Ee({flushUndo:e=!0}={}){let t=f({flushUndo:e});h(t,"onbeforesave");let o=t.querySelector(k)?d(t):null;o&&E(t,o);for(let c of t.querySelectorAll(T))c.remove();for(let c of i)l(t),c(t);l(t);let r=S(t),n=r;if(o){for(let c of o.querySelectorAll(C))c.remove();for(let c of i)l(o),c(o);l(o),n=S(o)}return{forComparison:r,forDirty:n}}function te({emitForSync:e=!0,flushUndo:t=!0,requestRefresh:o=!1,forRequest:r=!1,pageFormatMarker:n=null,sliced:c=!1}={}){if(!Number.isSafeInteger(b+1))throw new Error("Save capture identity exhausted");let a=++b,m=r?{captureId:a,authoredHandlers:!1,artifact:null}:null,u=f({flushUndo:t,forSave:e,requestRefresh:o,context:m});e&&document.dispatchEvent(new CustomEvent("clay:snapshot-ready",{detail:{documentElement:u,forSave:!0,captureId:a,sliced:c}})),h(u,"onbeforesave");let y=d(u);E(u,y);let p=u.querySelector(k)?d(u):null;p&&E(u,p);for(let s of i)l(u),s(u);l(u);for(let s of u.querySelectorAll(A))s.remove();F(u);for(let s of y.querySelectorAll(T))s.remove();for(let s of i)l(y),s(y);if(l(y),p){for(let s of p.querySelectorAll(C))s.remove();for(let s of i)l(p),s(p);l(p)}return{captureId:a,context:m,pageFormatMarker:n,clone:u,compareClone:y,dirtyClone:p,renderer:w,rendererSteps:B,pageStateReader:R,result:null}}function oe(e){if(!e.context||!e.pageStateReader)return;let t=null;try{t=e.pageStateReader(e.clone)}catch{}t&&x.set(e.captureId,t)}function re(e,{forSave:t,forComparison:o,forDirty:r}){let n={forSave:t,forComparison:o,forDirty:r,captureId:e.captureId};return e.context&&e.context.artifact&&M.set(n,e.context.artifact),e.result=n,n}function ne(e){j(e.result),x.delete(e.captureId),e.context&&(e.context.artifact=null),e.clone=e.compareClone=e.dirtyClone=null,e.result=null}function _e(e={}){let t=te(e);try{oe(t);let o=P(t.clone),r=t.compareClone?S(t.compareClone):null,n=t.dirtyClone?S(t.dirtyClone):r,c=t.renderer?U(t.context,()=>t.renderer(t.clone,o)):o;return re(t,{forSave:c,forComparison:r,forDirty:n})}catch(o){throw ne(t),o}}function ke(){let e=f({flushUndo:!1});h(e,"onbeforesave");let t=d(e),o=new WeakMap;(function r(n,c){o.set(n,c);let a=n.children,m=c.children;for(let u=0;u<a.length;u++)r(a[u],m[u])})(t,e);for(let r of i)l(e),r(e);l(e);for(let r of e.querySelectorAll(A))r.remove();F(e);for(let r of t.querySelectorAll(C))r.remove();for(let r of i)l(t),r(t);return l(t),{saveClone:e,compareClone:t,pairMap:o}}function ce({emitForSync:e=!0}={}){let t=f();return e&&document.dispatchEvent(new CustomEvent("clay:snapshot-ready",{detail:{documentElement:t}})),q(_(t))}function be(e){let t=d(e,!1);for(let n of I)t.removeAttribute(n);let o=t.outerHTML,r=`</${t.localName}>`;return"<!DOCTYPE html>"+o.slice(0,o.length-r.length)+e.innerHTML+r}function Me(e){return d(e)}function Oe(){return f().querySelector("body").innerHTML}function Pe({transform:e=null,flushUndo:t=!0}={}){if(!e&&t)return ce({emitForSync:!1});let o=f({flushUndo:t});if(e){let r=e(o);if(r&&typeof r.then=="function")throw new TypeError("getHTML: the transform must be synchronous")}return q(_(o))}function qe(e,{prepared:t=!1}={}){let o=d(e);return P(t?o:_(o,{authored:!1}))}function Fe(){return q(Q({flushUndo:!1,authored:!1}))}export{de as a,V as b,he as c,me as d,ye as e,ve as f,Se as g,j as h,Ce as i,xe as j,Ae as k,Te as l,P as m,X as n,J as o,U as p,ge as q,d as r,f as s,Q as t,ee as u,S as v,we as w,Re as x,Ee as y,te as z,oe as A,re as B,ne as C,_e as D,ke as E,ce as F,be as G,Me as H,Oe as I,Pe as J,qe as K,Fe as L};
|
package/dist/m/c-FSWRGBVQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./c-W23KVGUO.js";import"./c-BRLCTNMC.js";import"./c-QHWJ5ZIJ.js";import"./c-RG6XUZFA.js";import"./c-UL2YUY52.js";import"./c-QY7F6EN6.js";import"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VKEDWYDF.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as ask,b as consent,e as init,d as snippet,c as tell};
|
package/dist/m/c-HDWZEJHM.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
var r={light:[255,252,246],dark:[26,29,44],mutedLight:[107,89,66],mutedDark:[163,169,194]},e=`.clay-menu-dock, .clay-menu-spots, .clay-seo {
|
|
2
|
-
--bevel-font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
3
|
-
--bevel-font-serif: Newsreader, Georgia, "Times New Roman", serif;
|
|
4
|
-
--bevel-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
5
|
-
--bevel-ground: light-dark(#FDF8F0, #0B0C13);
|
|
6
|
-
--bevel-surface: light-dark(#FFFCF6, #1A1D2C);
|
|
7
|
-
--bevel-sunk: light-dark(#F4ECDF, #22263A);
|
|
8
|
-
--bevel-ink: light-dark(#2B241B, #ECEAF2);
|
|
9
|
-
--bevel-ink-2: light-dark(#4A4033, #C9CDE0);
|
|
10
|
-
--bevel-muted: light-dark(#6B5942, #A3A9C2);
|
|
11
|
-
--bevel-faint: light-dark(#9A8A70, #6A7090);
|
|
12
|
-
--bevel-line: light-dark(#E8DCC6, #2C3149);
|
|
13
|
-
--bevel-line-2: light-dark(#D8C8AF, #3A4058);
|
|
14
|
-
--bevel-line-3: light-dark(#C4B192, #4A536F);
|
|
15
|
-
--bevel-brass: light-dark(#8F6310, #D9A445);
|
|
16
|
-
--bevel-brass-soft: light-dark(#F0E4CC, #3A2F17);
|
|
17
|
-
--bevel-ox: light-dark(#A83A2C, #FF6B79);
|
|
18
|
-
--bevel-ox-soft: light-dark(#F6DED6, #3A2226);
|
|
19
|
-
--bevel-teal: light-dark(#256056, #4E9C8C);
|
|
20
|
-
--bevel-teal-soft: light-dark(#DCEBE7, #17332E);
|
|
21
|
-
--bevel-face: light-dark(#F1E7D4, #2A2F48);
|
|
22
|
-
--bevel-edge-hi: light-dark(#FFF9ED, #454C6C);
|
|
23
|
-
--bevel-edge-lo: light-dark(#D6C3A5, #171B2C);
|
|
24
|
-
--bevel-face-in: light-dark(#E3D0B3, #20253B);
|
|
25
|
-
--bevel-edge-in: light-dark(#B89F7B, #12152A);
|
|
26
|
-
--bevel-edge-in-hi: light-dark(#F0E1C9, #4D587A);
|
|
27
|
-
--bevel-knob: light-dark(#FCF8F1, #5A6286);
|
|
28
|
-
--bevel-knob-hi: light-dark(#FFF9ED, #7A83A8);
|
|
29
|
-
--clay-shadow: 0 1px 2px light-dark(rgb(43 36 27 / .07), rgb(0 0 0 / .35)), 0 10px 28px -10px light-dark(rgb(43 36 27 / .32), rgb(0 0 0 / .7));
|
|
30
|
-
--clay-sheet-shadow: 0 16px 30px -22px light-dark(rgb(43 36 27 / .45), rgb(0 0 0 / .85));
|
|
31
|
-
color-scheme: inherit;
|
|
32
|
-
font-family: var(--bevel-font-sans);
|
|
33
|
-
color: var(--bevel-ink);
|
|
34
|
-
-webkit-text-size-adjust: 100%;
|
|
35
|
-
text-size-adjust: 100%;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.clay-menu-dock { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.4; }
|
|
39
|
-
.clay-menu-dock[data-embedded] { position: relative; display: inline-flex; }
|
|
40
|
-
.clay-menu-dock[hidden], .clay-menu-spots[hidden], .clay-menu-dock [hidden], .clay-seo [hidden] { display: none !important; }
|
|
41
|
-
|
|
42
|
-
.clay-menu { box-sizing: border-box; display: inline-flex; align-items: center; gap: 2px; user-select: none; -webkit-user-select: none; }
|
|
43
|
-
|
|
44
|
-
.clay-menu-edit { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 28px; margin: 0; padding: 0 8px 0 5px; border: 0; background: none; font: 500 13px/1 var(--bevel-font-sans); color: var(--bevel-ink); cursor: pointer; }
|
|
45
|
-
.clay-menu-edit::before { content: ""; position: absolute; inset: -8px 0; }
|
|
46
|
-
.clay-menu-track { position: relative; display: block; box-sizing: border-box; width: 36px; height: 20px; border: 1px solid var(--bevel-line-2); background: var(--bevel-sunk); transition: background-color .14s, border-color .14s; }
|
|
47
|
-
.clay-menu-thumb { position: absolute; top: 2px; left: 2px; box-sizing: border-box; width: 14px; height: 14px; border: 2px solid; border-color: var(--bevel-knob-hi) var(--bevel-edge-lo) var(--bevel-edge-lo) var(--bevel-knob-hi); background: var(--bevel-knob); transition: translate .15s cubic-bezier(.4, 0, .2, 1); }
|
|
48
|
-
.clay-menu-edit:hover .clay-menu-track { border-color: var(--bevel-faint); }
|
|
49
|
-
.clay-menu-edit[aria-checked="true"] .clay-menu-track { background: #256056; border-color: light-dark(#256056, #3C7E72); }
|
|
50
|
-
.clay-menu-edit[aria-checked="true"] .clay-menu-thumb { translate: 16px 0; background: light-dark(var(--bevel-knob), #8EDCC5); border-color: light-dark(var(--bevel-knob-hi), #C2F0E2) light-dark(var(--bevel-edge-lo), #4F9C86) light-dark(var(--bevel-edge-lo), #4F9C86) light-dark(var(--bevel-knob-hi), #C2F0E2); }
|
|
51
|
-
.clay-menu-edit[aria-busy="true"] { cursor: progress; color: var(--bevel-muted); }
|
|
52
|
-
.clay-menu-edit[aria-busy="true"] .clay-menu-track { background: var(--bevel-line); border-color: var(--bevel-line-2); }
|
|
53
|
-
.clay-menu-edit[aria-busy="true"] .clay-menu-thumb { translate: 8px 0; opacity: .7; }
|
|
54
|
-
.clay-menu-label { white-space: nowrap; }
|
|
55
|
-
|
|
56
|
-
.clay-menu-divider { width: 1px; height: 18px; margin: 0 2px; background: var(--bevel-line-2); }
|
|
57
|
-
|
|
58
|
-
.clay-menu-goo { position: relative; display: inline-grid; place-items: center; box-sizing: border-box; margin: 0; padding: 0; cursor: pointer; }
|
|
59
|
-
.clay-menu-goo svg { display: block; }
|
|
60
|
-
.clay-menu-dot { position: absolute; top: -1px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--bevel-brass); box-shadow: 0 0 0 2px var(--bevel-surface); }
|
|
61
|
-
|
|
62
|
-
.clay-menu :focus-visible, .clay-roster:focus-visible { outline: 2px solid var(--bevel-brass); outline-offset: 2px; }
|
|
63
|
-
.clay-menu-edit:focus-visible { outline: none; }
|
|
64
|
-
.clay-menu-edit:focus-visible .clay-menu-track { outline: 2px solid var(--bevel-brass); outline-offset: 2px; }
|
|
65
|
-
|
|
66
|
-
/* The roster, beside the capsule, only on a page that opts in. Flat, like the capsule. */
|
|
67
|
-
.clay-roster { box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; height: 34px; margin: 0; padding: 0 10px 0 5px; border: 1px solid var(--bevel-line-3); background: var(--bevel-surface); box-shadow: var(--clay-shadow); font: 400 12px/1 var(--bevel-font-mono); color: var(--bevel-muted); cursor: pointer; }
|
|
68
|
-
.clay-roster:hover, .clay-roster[aria-expanded="true"] { background: var(--bevel-sunk); }
|
|
69
|
-
.clay-roster-faces { display: inline-flex; }
|
|
70
|
-
.clay-variants { box-sizing: border-box; display: inline-flex; align-items: center; gap: 2px; height: 34px; margin: 0; padding: 0 4px; border: 1px solid var(--bevel-line-3); background: var(--bevel-surface); box-shadow: var(--clay-shadow); font: 400 12px/1 var(--bevel-font-mono); color: var(--bevel-muted); user-select: none; -webkit-user-select: none; }
|
|
71
|
-
.clay-variants-step { display: inline-grid; place-items: center; width: 22px; height: 28px; margin: 0; padding: 0; border: 0; background: none; color: var(--bevel-faint); cursor: pointer; }
|
|
72
|
-
.clay-variants-step:hover { color: var(--bevel-ink-2); }
|
|
73
|
-
.clay-variants-step svg { display: block; width: 6px; height: 10px; fill: currentColor; }
|
|
74
|
-
.clay-variants-step:focus-visible { outline: 2px solid var(--bevel-brass); outline-offset: 2px; }
|
|
75
|
-
.clay-variants-name { min-width: 72px; text-align: center; color: var(--bevel-ink-2); white-space: nowrap; }
|
|
76
|
-
.clay-variants-name small { color: var(--bevel-faint); font-size: 11px; }
|
|
77
|
-
.clay-variants .clay-menu-btn { margin-left: 4px; }
|
|
78
|
-
.clay-roster-faces .clay-avatar + .clay-avatar { margin-left: -2px; box-shadow: -2px 0 0 var(--bevel-surface); }
|
|
79
|
-
.clay-avatar { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; font: 500 10px/1 var(--bevel-font-mono); letter-spacing: .02em; border: 1px solid var(--bevel-ink); background: var(--bevel-ink); color: var(--bevel-ground); }
|
|
80
|
-
.clay-avatar[data-tone="brass"] { background: var(--bevel-brass-soft); color: var(--bevel-brass); border-color: color-mix(in srgb, var(--bevel-brass) 35%, var(--bevel-brass-soft)); }
|
|
81
|
-
.clay-avatar[data-tone="teal"] { background: var(--bevel-teal-soft); color: var(--bevel-teal); border-color: color-mix(in srgb, var(--bevel-teal) 35%, var(--bevel-teal-soft)); }
|
|
82
|
-
|
|
83
|
-
/* Popovers: the menu, the people panel, the status note. Below the dock, above it in a bottom corner. */
|
|
84
|
-
.clay-menu-list, .clay-people, .clay-menu-note { position: absolute; z-index: 1; top: calc(100% + 8px); right: 0; box-sizing: border-box; margin: 0; color: var(--bevel-ink); text-align: left; }
|
|
85
|
-
.clay-people, .clay-menu-note { border: 1px solid var(--bevel-line-2); background: var(--bevel-surface); box-shadow: var(--clay-shadow); }
|
|
86
|
-
|
|
87
|
-
.clay-menu-list { width: max-content; max-width: calc(100vw - 24px); max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain; }
|
|
88
|
-
.clay-menu-list[popover] { position: fixed; inset: auto; margin: 0; }
|
|
89
|
-
.clay-menu-list [role="menuitem"] { box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin: 0; border: 0; background: none; text-align: left; text-decoration: none; cursor: pointer; }
|
|
90
|
-
.clay-menu-list [role="menuitem"]:hover:not([aria-disabled="true"]), .clay-menu-list [role="menuitem"]:focus-visible { outline: none; background: var(--bevel-sunk); }
|
|
91
|
-
.clay-menu-list [role="menuitem"][aria-disabled="true"] { cursor: default; }
|
|
92
|
-
.clay-menu-pair { display: flex; gap: 12px; padding: 3px 9px; }
|
|
93
|
-
.clay-menu-list .clay-menu-pair [role="menuitem"] { flex: none; width: auto; justify-content: flex-start; gap: 9px; }
|
|
94
|
-
.clay-menu-list kbd { flex: none; white-space: nowrap; }
|
|
95
|
-
.clay-menu-row { display: flex; align-items: center; gap: 2px; }
|
|
96
|
-
.clay-menu-list .clay-menu-row > [part~="item"] { flex: 1; width: auto; min-width: 0; }
|
|
97
|
-
.clay-menu-list .clay-menu-row > [part~="dismiss"] { flex: none; width: 28px; justify-content: center; padding: 0; }
|
|
98
|
-
.clay-menu-row > [part~="dismiss"] svg { display: block; width: 10px; height: 10px; fill: currentColor; }
|
|
99
|
-
.clay-menu-upgrade { display: inline-flex; align-items: center; gap: 8px; }
|
|
100
|
-
.clay-menu-upgrade::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bevel-brass); }
|
|
101
|
-
.clay-menu-version { margin: 0; }
|
|
102
|
-
|
|
103
|
-
.clay-menu-note { z-index: 2; width: max-content; max-width: 264px; padding: 8px 12px; font-size: 13px; line-height: 1.45; }
|
|
104
|
-
|
|
105
|
-
/* The people panel: no lines between people, one line between sections. */
|
|
106
|
-
.clay-people { width: 300px; max-width: calc(100vw - 24px); padding: 0; }
|
|
107
|
-
.clay-people-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--bevel-line); }
|
|
108
|
-
.clay-people-title { flex: 1; margin: 0; font: 500 16px/1.2 var(--bevel-font-serif); }
|
|
109
|
-
.clay-people-sum { font: 400 11px/1 var(--bevel-font-mono); color: var(--bevel-muted); white-space: nowrap; }
|
|
110
|
-
.clay-people-close { display: inline-grid; place-items: center; width: 26px; height: 26px; margin: 0; padding: 0; border: 0; background: none; color: var(--bevel-muted); cursor: pointer; }
|
|
111
|
-
.clay-people-close:hover { color: var(--bevel-ink); background: var(--bevel-sunk); }
|
|
112
|
-
.clay-people-close svg { width: 12px; height: 12px; fill: currentColor; }
|
|
113
|
-
.clay-people-list { list-style: none; margin: 0; padding: 8px 14px; }
|
|
114
|
-
.clay-people-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
|
|
115
|
-
.clay-people-row .clay-avatar { width: 28px; height: 28px; font-size: 11px; }
|
|
116
|
-
.clay-people-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
117
|
-
.clay-people-who strong { font-size: 13px; font-weight: 500; line-height: 1.25; }
|
|
118
|
-
.clay-people-who strong span { font: 400 11px/1 var(--bevel-font-mono); color: var(--bevel-muted); margin-left: 4px; }
|
|
119
|
-
.clay-people-who > span { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.3; color: var(--bevel-muted); }
|
|
120
|
-
.clay-people-live { width: 6px; height: 6px; border-radius: 50%; background: var(--bevel-teal); }
|
|
121
|
-
.clay-people-anon { margin: 0; padding: 10px 14px; border-top: 1px solid var(--bevel-line); font-size: 12px; line-height: 1.4; color: var(--bevel-muted); }
|
|
122
|
-
.clay-people-me { padding: 10px 14px 12px; border-top: 1px solid var(--bevel-line); }
|
|
123
|
-
.clay-people-me-label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--bevel-muted); }
|
|
124
|
-
.clay-people-me-row { display: flex; align-items: center; gap: 8px; min-height: 30px; }
|
|
125
|
-
.clay-people-me-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; }
|
|
126
|
-
.clay-people-input { flex: 1; min-width: 0; box-sizing: border-box; height: 30px; padding: 0 8px; border: 1px solid var(--bevel-line-2); background: var(--bevel-ground); color: var(--bevel-ink); font: 400 13px/1.4 var(--bevel-font-sans); }
|
|
127
|
-
.clay-people-input:focus-visible { outline: 2px solid var(--bevel-brass); outline-offset: 1px; border-color: var(--bevel-brass); }
|
|
128
|
-
|
|
129
|
-
/* Bevel buttons, at the sizes this UI uses. */
|
|
130
|
-
.clay-menu-btn { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; height: 30px; margin: 0; padding: 0 12px; border: 2px solid; border-color: var(--bevel-edge-hi) var(--bevel-edge-lo) var(--bevel-edge-lo) var(--bevel-edge-hi); background: var(--bevel-face); color: var(--bevel-ink); font: 500 13px/1 var(--bevel-font-sans); white-space: nowrap; cursor: pointer; }
|
|
131
|
-
.clay-menu-btn:hover { background: color-mix(in srgb, var(--bevel-face), var(--bevel-edge-hi) 45%); }
|
|
132
|
-
.clay-menu-btn:active { border-color: var(--bevel-edge-lo) var(--bevel-edge-hi) var(--bevel-edge-hi) var(--bevel-edge-lo); }
|
|
133
|
-
.clay-menu-btn:focus-visible { outline: 2px solid var(--bevel-brass); outline-offset: 2px; }
|
|
134
|
-
.clay-menu-btn-small { height: 26px; padding: 0 9px; font-size: 12px; }
|
|
135
|
-
.clay-menu-btn-primary { --bevel-face: var(--bevel-ink); --bevel-edge-hi: color-mix(in srgb, var(--bevel-ink), light-dark(#FFFCF6, #FFFFFF) 22%); --bevel-edge-lo: color-mix(in srgb, var(--bevel-ink), light-dark(#0B0C13, #6A7090) 34%); color: var(--bevel-ground); }
|
|
136
|
-
.clay-menu-btn-primary:hover { background: color-mix(in srgb, var(--bevel-ink), var(--bevel-ground) 12%); }
|
|
137
|
-
`,a=`/* The dock: the roster (when a page opts in) and the capsule, fixed in one corner. */
|
|
138
|
-
.clay-menu-dock { position: fixed; z-index: 2147482000; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
|
|
139
|
-
.clay-menu-dock[data-corner$="left"] { right: auto; left: max(12px, env(safe-area-inset-left)); flex-direction: row-reverse; }
|
|
140
|
-
.clay-menu-dock[data-corner^="bottom"] { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
|
|
141
|
-
.clay-menu-dock[data-corner$="left"] :is(.clay-menu-list, .clay-people, .clay-menu-note) { right: auto; left: 0; }
|
|
142
|
-
.clay-menu-dock[data-corner^="bottom"] :is(.clay-menu-list, .clay-people, .clay-menu-note) { top: auto; bottom: calc(100% + 8px); }
|
|
143
|
-
.clay-menu-dock[data-dragging] .clay-menu { border-color: var(--bevel-brass); cursor: grabbing; }
|
|
144
|
-
.clay-menu-grip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 28px; margin: 0; padding: 0; border: 0; background: none; color: var(--bevel-faint); cursor: grab; touch-action: none; }
|
|
145
|
-
.clay-menu-grip::before { content: ""; position: absolute; inset: -8px -2px -8px -10px; }
|
|
146
|
-
.clay-menu-grip:hover { color: var(--bevel-ink-2); }
|
|
147
|
-
.clay-menu-grip svg { display: block; width: 6px; height: 12px; fill: currentColor; }
|
|
148
|
-
|
|
149
|
-
/* Drop spots while dragging. */
|
|
150
|
-
.clay-menu-spots { position: fixed; inset: 0; z-index: 2147481999; pointer-events: none; }
|
|
151
|
-
.clay-menu-spot { position: absolute; width: 132px; height: 34px; border: 1px dashed var(--bevel-line-3); background: var(--bevel-sunk); }
|
|
152
|
-
.clay-menu-spot[data-to^="top"] { top: 12px; }
|
|
153
|
-
.clay-menu-spot[data-to^="bottom"] { bottom: 12px; }
|
|
154
|
-
.clay-menu-spot[data-to$="left"] { left: 12px; }
|
|
155
|
-
.clay-menu-spot[data-to$="right"] { right: 12px; }
|
|
156
|
-
.clay-menu-spot[data-near] { border: 2px solid var(--bevel-brass); background: var(--bevel-brass-soft); }
|
|
157
|
-
`,l=`.clay-menu { height: 34px; padding: 0 4px 0 2px; border: 1px solid var(--bevel-line-3); background: var(--bevel-surface); box-shadow: var(--clay-shadow); }
|
|
158
|
-
.clay-menu-goo { width: 28px; height: 28px; min-height: 0; border-radius: 0; border: 2px solid transparent; background: none; color: var(--bevel-ink); }
|
|
159
|
-
.clay-menu-goo::before { content: ""; position: absolute; inset: -8px -8px -8px -4px; }
|
|
160
|
-
.clay-menu-goo svg { width: 18px; height: auto; fill: currentColor; }
|
|
161
|
-
.clay-menu-goo:hover svg { translate: 0 -1px; }
|
|
162
|
-
.clay-menu-goo:active, .clay-menu-goo[aria-expanded="true"] { background: var(--bevel-face-in); border-color: var(--bevel-edge-in) var(--bevel-edge-in-hi) var(--bevel-edge-in-hi) var(--bevel-edge-in); }
|
|
163
|
-
.clay-menu-goo:active svg, .clay-menu-goo[aria-expanded="true"] svg { translate: 1px 1px; }
|
|
164
|
-
.clay-menu-list { min-width: 284px; padding: 6px; border: 1px solid var(--bevel-line-2); background: var(--bevel-surface); box-shadow: var(--clay-shadow); }
|
|
165
|
-
.clay-menu-list [role="menuitem"] { min-height: 32px; padding: 5px 9px; font: 400 13px/1.35 var(--bevel-font-sans); color: var(--bevel-ink); }
|
|
166
|
-
.clay-menu-list [role="menuitem"][aria-disabled="true"] { color: var(--bevel-faint); }
|
|
167
|
-
.clay-menu-list [role="menuitem"][aria-disabled="true"] kbd { opacity: .6; }
|
|
168
|
-
.clay-menu-list .clay-menu-pair [role="menuitem"] { min-height: 30px; padding: 4px 6px 4px 9px; border: 1px solid var(--bevel-line); }
|
|
169
|
-
.clay-menu-list kbd { font: 500 11px/1 var(--bevel-font-mono); padding: 3px 5px; border: 1px solid var(--bevel-line-2); background: var(--bevel-sunk); color: var(--bevel-muted); }
|
|
170
|
-
.clay-menu-list [part~="quiet"] { font-size: 12px; color: var(--bevel-muted); }
|
|
171
|
-
.clay-menu-sep { height: 1px; margin: 4px 2px; background: var(--bevel-line); }
|
|
172
|
-
.clay-menu-version { padding: 6px 9px 4px; font: 400 11.5px/1.4 var(--bevel-font-mono); color: var(--bevel-muted); }
|
|
173
|
-
`,o=`@media (pointer: coarse), (max-width: 680px) {
|
|
174
|
-
.clay-menu-list [role="menuitem"] { min-height: 44px; font-size: 15px; }
|
|
175
|
-
.clay-menu-list .clay-menu-pair [role="menuitem"] { min-height: 44px; }
|
|
176
|
-
:is(.clay-menu-dock, .clay-seo) :is(input, textarea, select) { font-size: 16px; }
|
|
177
|
-
.clay-seo-input, .clay-people-input { min-height: 40px; }
|
|
178
|
-
.clay-menu-btn { min-height: 40px; }
|
|
179
|
-
}
|
|
180
|
-
@media (prefers-reduced-motion: reduce) {
|
|
181
|
-
.clay-menu-track, .clay-menu-thumb { transition: none; }
|
|
182
|
-
}
|
|
183
|
-
`,i=e+a+l+o;export{r as a,e as b,a as c,l as d,o as e,i as f};
|
package/dist/m/c-HMYWIHFG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./c-BRLCTNMC.js";import"./c-QHWJ5ZIJ.js";import"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{a as SURFACE_THEME,b as default};
|
package/dist/m/c-JH5FF4NL.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./c-Y6F2FORL.js";import{b as p}from"./c-QY7F6EN6.js";import{a as m}from"./c-2YYDMLNZ.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var h=`html:has(> body > .clay-intro) { height: auto !important; overflow-y: auto !important; }
|
|
2
|
-
body:has(> .clay-intro) { height: auto !important; overflow: visible !important; }
|
|
3
|
-
.clay-intro {
|
|
4
|
-
position: relative;
|
|
5
|
-
display: block;
|
|
6
|
-
}
|
|
7
|
-
@media print { .clay-intro { display: none; } }
|
|
8
|
-
`,f=`:host { color: inherit !important; }
|
|
9
|
-
.clay-intro__close {
|
|
10
|
-
position: absolute; top: 10px; right: 10px; z-index: 1;
|
|
11
|
-
display: inline-flex; align-items: center; justify-content: center;
|
|
12
|
-
width: 28px; height: 28px; min-height: 0; margin: 0; padding: 0;
|
|
13
|
-
border: 0; border-radius: 4px; background: none; box-shadow: none;
|
|
14
|
-
color: inherit; opacity: .55; cursor: pointer; line-height: 1;
|
|
15
|
-
}
|
|
16
|
-
.clay-intro__close:hover { opacity: 1; background: none; color: inherit; }
|
|
17
|
-
.clay-intro__close:focus-visible { opacity: 1; outline: 2px solid currentColor; outline-offset: 2px; }
|
|
18
|
-
.clay-intro__close svg { display: block; width: 12px; height: 12px; fill: currentColor; stroke: none; }
|
|
19
|
-
@media (pointer: coarse) { .clay-intro__close { width: 44px; height: 44px; top: 4px; right: 4px; } }
|
|
20
|
-
`;var y={close:"Hide this introduction",label:t=>`About ${t}`},x="a[href], button, input, select, textarea, [tabindex]:not([tabindex='-1'])",v="textarea, select",w=["checkbox","radio","button","submit","reset","file"];function C(t){return t.isContentEditable||t.closest(v)?!0:t.tagName!=="INPUT"?!1:w.indexOf(t.type)<0}function E(){try{return new URLSearchParams(window.location.search).get("intro")==="1"}catch{return!1}}function S(){if(document.getElementById("clay-intro-style"))return;let t=document.createElement("style");t.id="clay-intro-style",t.setAttribute("clay","editor-ui"),t.textContent=h,document.head.appendChild(t)}function _(){let t=[...document.querySelectorAll(x)].find(o=>!o.disabled&&!C(o)&&!o.closest("[clay~='editor-ui']")&&(typeof o.checkVisibility!="function"||o.checkVisibility()));t?t.focus({preventScroll:!0}):document.body.focus({preventScroll:!0})}function Y({memory:t,template:o,appName:c,hadDraft:e}){return!o||!o.content.textContent.trim()&&!o.content.querySelector("img, svg, video, canvas")||!E()&&(t.get().intro.done||e||m.servedHash||window.matchMedia&&window.matchMedia("print").matches)?null:T({memory:t,template:o,appName:c})}function T({memory:t,template:o,appName:c}){S();let e=document.createElement("section");e.className="clay-intro",e.setAttribute("clay","editor-ui"),e.setAttribute("sap-ignore",""),e.setAttribute("aria-label",y.label(c)),e.appendChild(o.content.cloneNode(!0));let i=document.createElement("button");i.type="button",i.className="clay-intro__close",i.setAttribute("aria-label",y.close),i.innerHTML='<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true"><path d="M1.4 0 6 4.6 10.6 0 12 1.4 7.4 6 12 10.6 10.6 12 6 7.4 1.4 12 0 10.6 4.6 6 0 1.4z"/></svg>',i.addEventListener("click",()=>l("closed")),p({name:"intro-close",content:i,css:[f],parent:e});let d=!1,r=0;function l(n){if(d)return;d=!0,removeEventListener("scroll",u),r&&cancelAnimationFrame(r);let s=e.getBoundingClientRect().height,b=window.scrollY;if(t.get().intro.done=n,t.save(),e.remove(),n==="scrolled"){let g=/hidden|clip/.test(getComputedStyle(document.body).overflowY+getComputedStyle(document.documentElement).overflowY);window.scrollTo(0,g?0:Math.max(0,b-s))}a(),n!=="scrolled"&&_()}function u(){r||(r=requestAnimationFrame(()=>{r=0;let n=e.getBoundingClientRect().bottom,s=scrollY>0&&scrollY+innerHeight>=document.documentElement.scrollHeight-1;(n<1||s&&n<innerHeight)&&l("scrolled")}))}return e.addEventListener("click",n=>{if(n.target.closest("[visitor-intro-dismiss]")){l("closed");return}n.target.closest("[visitor-intro-start]")&&(n.preventDefault(),window.scrollTo({top:window.scrollY+e.getBoundingClientRect().bottom,behavior:"smooth"}))}),document.body.prepend(e),a(),addEventListener("scroll",u,{passive:!0}),e}export{y as COPY,Y as mountIntro};
|
package/dist/m/c-M6FNQCTQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{c as bevelDialog,a as dismissOf,b as keepFocusIn};
|
package/dist/m/c-MHI3GYKF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var W=()=>{let t=getComputedStyle(document.documentElement).colorScheme;return t==="light"||t==="dark"?t:"light dark"},st='[clay~="editor-ui"], [clay~="no-snapshot"], [editor-ui], [no-snapshot], [snapshot-remove]',rt=/^(img|video|canvas|iframe|embed|object|image|use|path|rect|circle|ellipse|line|poly(line|gon))$/,pt=/(invert|brightness|contrast|grayscale|sepia|hue-rotate|opacity|url)\(/,ft=[.4122,.5363,.0514,.2119,.6807,.1074,.0883,.2817,.63],gt=[.2105,.7936,-.0041,1.978,-2.4286,.4506,.0259,.7828,-.8087],bt=[1,.3963,.2158,1,-.1056,-.0639,1,-.0895,-1.2915],kt=[4.0767,-3.3077,.231,-1.2684,2.6098,-.3413,-.0042,-.7034,1.7076],R=t=>t<0?0:t>1?1:t||0,I=(t,e)=>[0,3,6].map(o=>t[o]*e[0]+t[o+1]*e[1]+t[o+2]*e[2]),at=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,yt=t=>R(t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055),G=t=>I(gt,I(ft,t.map(at)).map(Math.cbrt)),O=t=>I(kt,I(bt,t).map(e=>e**3)).map(yt),S=t=>t.map(at).reduce((e,o,c)=>e+o*[.2126,.7152,.0722][c],.05),lt=(t,e)=>Math.max(S(t)/S(e),S(e)/S(t)),j=t=>S(t)>=.2343,H=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),U=t=>[0,1,2].map(e=>t.reduce((o,c)=>o+c[e],0)/t.length),et=(t,e)=>t&&[t[0],t[1],t[2],t[3]*e],J=(t,e,o)=>e>=t.left&&e<=t.right&&o>=t.top&&o<=t.bottom,V=new Map;function K(t){if(!V.has(t)){let[,e,o=""]=/^(rgba?|oklch|oklab|color)\(([^()]*)\)$/.exec(t)||[],c=o.replace(/^srgb /,"").split(/[\s,/]+/).map(r=>parseFloat(r)||0),s=c[2]*Math.PI/180,a=!e||e==="color"&&!o.startsWith("srgb ")?null:e==="color"?c.slice(0,3).map(R):e[0]==="r"?c.slice(0,3).map(r=>R(r/255)):O(e==="oklab"?c:[c[0],c[1]*Math.cos(s),c[1]*Math.sin(s)]);V.set(t,a&&[...a,c.length>3?R(c[3]):1])}return V.get(t)}function P(t){let e=t.backgroundImage,o=K(t.backgroundColor),c=(/url\(/.test(e)?[null]:e.match(/[a-z]+\([^()]*\)/g)||[null]).map(K),s=c.every(r=>r&&Math.abs(r[3]-c[0][3])<.05&&H(G(r),G(c[0]))<.02)&&c[0],a=t.backgroundRepeat==="repeat"||/^(auto|cover|100%)( (auto|100%))?$/.test(t.backgroundSize);return t.backgroundClip.includes("text")?[]:[...e!=="none"&&(!s||s[3]>0)?[{c:s,maybe:s&&!a}]:[],...!o||o[3]>0?[{c:o}]:[]]}var nt=[],ot=-1/0,ct=0;function wt(){let t=document.getElementsByTagName("*"),e=performance.now()-ot;return(e>15e3||e>1e3&&t.length!==ct)&&(ot=performance.now(),ct=t.length,nt=[...t.length>8e3?[]:t].filter(o=>{let c=getComputedStyle(o),s=c.pointerEvents==="none"&&o.getBoundingClientRect();return s?.width>=40&&s.height>=20&&c.visibility==="visible"&&!o.closest(st)&&(rt.test(o.localName)||P(c).some(a=>!a.c||a.c[3]>.03))})),nt}function vt(t,e){let o=document.elementsFromPoint(t,e),c=new Set;for(let s=0;s<o.length;s++){let a=o[s],r=a.shadowRoot;r&&!c.has(r)&&c.add(r)&&o.splice(s--,J(a.getBoundingClientRect(),t,e)?0:1,...r.elementsFromPoint(t,e).filter(u=>u.getRootNode()===r))}return o}var xt=({x:t,y:e,width:o,height:c})=>[0,1,2].flatMap(s=>[0,1,2,3,4].map(a=>[t+(a+.5+(s-1)/4)*o/5,e+(s+.5)*c/3]));function Mt(t){let e=document.documentElement,o=document.body;if(typeof document.elementsFromPoint!="function"||!o||!(t.width>0&&t.height>0))return null;let c=new Map,s=n=>c.get(n)||c.set(n,{el:n,cs:getComputedStyle(n)}).get(n),a=n=>n.rect??=n.el.getBoundingClientRect(),r=getComputedStyle(e),u=!P(r).length&&o.localName==="body",v=u?[e,o]:[e],y=r.colorScheme==="normal"?document.querySelector('meta[name="color-scheme"]')?.content:r.colorScheme,A=/dark/.test(y)&&(!/light/.test(y)||matchMedia("(prefers-color-scheme: dark)").matches);function N(n){let i=s(n),h=i.cs;if(i.k===void 0){let d=n.assignedSlot||n.parentElement||n.parentNode?.host,f=d?N(d):{k:1};i.k=f.k*+h.opacity,i.ui=f.ui||n.matches(st),i.bad=f.bad||pt.test(h.filter+h.backdropFilter)||h.mixBlendMode!=="normal"||/\(/.test(h.maskImage)}return i}let Q=n=>n.own??=[...rt.test(n.el.localName)?[{c:null}]:[],...v.includes(n.el)?[]:P(n.cs)];function ut(n){let i=K(n.cs.webkitTextFillColor||n.cs.color);return n.ink??=i?.[3]>=.5&&[...n.el.childNodes].some(h=>h.nodeType===3&&/\S/.test(h.data))&&i}function X(n,i,h){let d=[0,0,0],f=1;for(let{c:g,k:b=1,maybe:C}of n){let[E,M,L,F]=g||[i,i,i,b],B=C&&!h?0:F;d=d.map((l,k)=>l+f*B*[E,M,L][k]),f*=1-B}return G(d)}function dt(n,i,h){let d=vt(n,i);if(!d.length)return;let f=new Set;for(let l of h){let k=a(s(l));if(d.includes(l)||!J(k,n,i)||!l.isConnected||s(l).cs.visibility!=="visible")continue;let m=d.findLastIndex(w=>l.contains(w))+1;!m&&s(l).cs.zIndex<0&&(m=Math.max(0,d.findIndex(w=>v.includes(w)))),m||f.add(l),d.splice(m,0,l)}let g=[],b=null,C=!1;for(let[l,k]of d.entries()){let m=N(k);if(m.ui||!m.k)continue;let w=d.lastIndexOf(k)===l,$=!v.includes(k)&&!J(a(m),n,i);for(let x of $?[{}]:w?Q(m):[])g.push({c:m.bad?null:et(x.c,m.k),k:m.k,maybe:x.maybe||f.has(k)});w&&!b&&!C&&!$&&(b=ut(m)),C||=$||w&&Q(m).some(x=>!x.maybe&&(!x.c||x.c[3]>=.5))}let E=N(e);for(let l of P(u?getComputedStyle(o):r))g.push({c:E.bad?null:et(l.c,E.k)});g.push({c:A?[.0706,.0706,.0706,1]:[1,1,1,1]});let M=[0,1].flatMap(l=>[X(g,l,!1),X(g,l,!0)]);if(M.some(l=>H(l,M[0])>.06))return null;let L=U(M),F=O(L),B=!!b&<([0,1,2].map(l=>b[l]*b[3]+F[l]*(1-b[3])),F)<1.25;return{lab:L,contra:B,approx:g.some(l=>!l.c||l.maybe)}}let mt=wt(),Y=xt(t).map(([n,i])=>dt(n,i,mt)).filter(n=>n!==void 0),T=Y.length,z=Y.filter(Boolean),Z=n=>z.filter(i=>H(n,i.lab)<=.035),q=z.map(n=>Z(n.lab)).sort((n,i)=>i.length-n.length)[0],p=q?Z(U(q.map(n=>n.lab))):[];if(!p.length||p.length<.6*T)return null;let _=p.filter(n=>n.contra).length,D=O(U(p.map(n=>n.lab))),tt=z.filter(n=>!p.includes(n)&&j(O(n.lab))!==j(D)).length;if(_>=2&&_>=p.length/3||tt>=2&&tt>=.2*T)return null;let ht=p.filter(n=>n.approx).length/p.length;return{colour:D.map(n=>Math.round(n*255)),confidence:+(p.length/T*(1-.3*ht)*(1-_/p.length)).toFixed(3),scheme:j(D)?"light":"dark"}}var St={light:[255,252,246],dark:[17,19,30],mutedLight:[107,89,66],mutedDark:[138,144,171]};function it(t,e=St){let o=null;try{o=Mt(t)}catch{}if(!o||o.confidence<.5)return{scheme:W(),surface:null};let{scheme:c}=o,s=e[c],a=(c==="dark"?e.mutedDark:e.mutedLight).map(u=>u/255),r=null;for(let u=.35;o.confidence>=.75&&!r&&u>.01;u-=.05){let v=s.map((y,A)=>Math.round(y+(o.colour[A]-y)*u));lt(v.map(y=>y/255),a)>=4.5&&(r=`rgb(${v.join(" ")})`)}return{scheme:c,surface:r}}function Et(t,{rect:e=t.getBoundingClientRect(),background:o=null}={}){let c=e.width>0&&e.height>0;if(!c&&W()==="light dark")return null;let s=c?it(e):{scheme:W(),surface:null},a={"color-scheme":s.scheme};if(o!==null&&(a.background=s.surface||o),typeof t.pin=="function")t.pin(a);else for(let[r,u]of Object.entries(a))t.style.setProperty(r,u,"important");return s}function Ct(t,e,o){let c=it(e,o);return t.style.setProperty("color-scheme",c.scheme,"important"),c.surface?t.style.setProperty("--bevel-surface",c.surface,"important"):t.style.removeProperty("--bevel-surface"),c}function Lt(t,e,o){let c=0,s=()=>{c=0;let u=e.getBoundingClientRect();!document.hidden&&t.isConnected&&u.width&&u.height&&Ct(t,u,o)},a=()=>{clearTimeout(c),c=setTimeout(s,150)};window.addEventListener("scroll",a,{capture:!0,passive:!0}),window.addEventListener("resize",a),document.addEventListener("visibilitychange",a),window.matchMedia?.("(prefers-color-scheme: dark)").addEventListener?.("change",a);let r=new MutationObserver(a);r.observe(document.documentElement,{attributes:!0}),r.observe(document.body,{attributes:!0}),r.observe(t,{attributes:!0,attributeFilter:["data-corner","hidden"]}),s()}export{it as a,Et as b,Ct as c,Lt as d};
|
package/dist/m/c-MIL4B2JQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-RG6XUZFA.js";import"./c-QY7F6EN6.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-NUHP2XDB.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{c as default,b as dismissPersistent,a as toastPersistent};
|
package/dist/m/c-S5IEIZCN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as g,r as k}from"./c-GVPNDIKJ.js";import{a as l,b as n,c as d,h as p}from"./c-NQJRVJ56.js";var b=3e4;function a(){return{ok:!1,code:"failed"}}async function T(o,{etag:r}={}){if(typeof o!="string"||o==="")return a();let m=typeof r=="string"&&r?r:null;if(n()||await p(),!n())return{ok:!1,code:"unsupported"};let s=m||l();if(!s)return{ok:!1,code:"conflict"};let i=new AbortController,y=setTimeout(()=>i.abort(),b);try{let{url:c,options:S}=k(o,!0,i.signal,g(),s),t=await fetch(c,S),f=await t.text(),e={};if(f)try{e=JSON.parse(f)}catch{e={}}if(!t.ok)return t.status===412?{ok:!1,code:"conflict"}:t.status===401||t.status===403?{ok:!1,code:"forbidden"}:a();let u=typeof e.etag=="string"&&e.etag?e.etag:null;return d(u),{ok:!0,etag:u}}catch{return a()}finally{clearTimeout(y)}}export{T as a};
|
package/dist/m/c-VSPAFOKU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as a,o as p,r as l,u as f}from"./c-EGTIAL6P.js";import{i as c}from"./c-HA6INT6J.js";var y="http://www.w3.org/1999/xhtml",T=64*1024,u=256;function d(e){return e.namespaceURI===y&&e.localName!=="template"&&e.getElementsByTagName("*").length>=u}function*h(e,t,s,o){for(let n of e.childNodes){if(n.nodeType===1&&d(n)){yield*m(n,s,o);continue}let r;n.nodeType===1?r=n.outerHTML:(t.replaceChildren(n.cloneNode(!1)),r=t.innerHTML),s.push(r),o.bytes+=r.length,o.bytes>=T&&(o.bytes=0,yield)}}function*m(e,t,s){let o=l(e,!1),n=o.outerHTML,r=`</${o.localName}>`;t.push(n.slice(0,n.length-r.length)),yield*h(e,o,t,s),t.push(r)}function*i(e){let t=["<!DOCTYPE html>"];return yield*m(e,t,{bytes:0}),t.join("")}function*g(e){let t=a(e);if(!t.length)return yield*i(e);let s=p(t),o;try{o=yield*i(e)}finally{for(let[n,r]of t)n.replaceChildren(...r)}for(let[n,r]of s)o=o.split(n).join(r);return o}function*E(e){return f(e),yield*i(e)}function*L(e){let t=l(e,!1);for(let r of c)t.removeAttribute(r);let s=t.outerHTML,o=`</${t.localName}>`,n=["<!DOCTYPE html>",s.slice(0,s.length-o.length)];return yield*h(e,l(e,!1),n,{bytes:0}),n.push(o),n.join("")}export{i as a,g as b,E as c,L as d};
|
package/dist/m/c-WFMRX5RZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f}from"./c-EOCKLMKX.js";import{g as a}from"./c-SJPD46ZO.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-XQSXKIKM.js";import"./c-67ILSNPR.js";import"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import"./c-44B5ODN7.js";import"./c-QIXT3Q7C.js";import"./c-E4IBSAQM.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,G,H,I,J,K,L,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{q as addDocumentTransform,d as attachCaptureArtifact,j as canonicalizeReceived,g as captureArtifact,I as captureBodyForSync,w as captureForComparison,y as captureForComparisonAndDirty,x as captureForDirtyCheck,E as captureForMerge,F as captureForSave,D as captureForSaveAndComparison,f as capturePageState,L as captureRecoveryPage,t as captureSaveClone,s as captureSnapshot,r as clonePreventingOnclone,B as completeSaveCapture,H as copyCaptureClone,c as currentCaptureContext,a as currentCaptureId,J as getPageContents,n as noscriptBlocks,k as onSnapshot,b as originalSnapshotNode,u as prepareForCompare,z as prepareSaveCapture,A as readCapturePageState,h as releaseCaptureArtifact,C as releaseSaveCapture,p as runSaveRenderer,m as serializeClone,v as serializeForCompare,G as serializeForSync,K as serializeRecoveryClone,e as setCapturePageState,i as setCloneCanonicalizer,l as setSaveRenderer,o as swapNoscriptMarkers};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as W}from"./c-46XYM55L.js";import{a as J}from"./c-RS77ODLY.js";import"./c-7SWMYKAI.js";import{b as V}from"./c-FILLTJA7.js";import{a as $}from"./c-VKEDWYDF.js";import"./c-UGHH4MB3.js";import"./c-LA2BW7UY.js";import"./c-IJUK2GPW.js";import{b as F}from"./c-CYWLPPUS.js";import{i as H}from"./c-VG5XIN4T.js";import{a as G}from"./c-2YYDMLNZ.js";import{c as B,l as z}from"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var X={always:["lib/mutation.js","core/preserve-authored.js","core/edit-mode.js","core/mode-key.js","core/stale-host-notice.js","core/page-data.js"],editOnly:["core/snapshot.js","core/persist.js","core/admin-attrs.js","core/save-core.js","core/save.js","core/conflict-notice.js","core/recovery.js","core/unsaved-warning.js","core/autosave.js","attrs/save-freeze.js","attrs/onaftersave.js","attrs/refetch-on-save.js","attrs/add-from.js","lib/cache-bust.js"]},w={richclay:{path:"plugins/richclay.js",editOnly:!0,default:!0},indicator:{path:"plugins/indicator.js",editOnly:!0,default:!1},sync:{path:"sync/live-sync.js",editOnly:!1,default:!1},live:{path:"plugins/live.js",editOnly:!1,default:!1},page:{path:"plugins/page.js",editOnly:!0,default:!1},"page-view":{path:"plugins/page-view.js",editOnly:!1,default:!1,internal:!0},sortable:{path:"plugins/sortable.js",editOnly:!0,default:!1},undo:{path:"plugins/undo.js",editOnly:!0,default:!1},unsent:{path:"plugins/unsent.js",editOnly:!0,default:!1},cms:{path:"plugins/cms.js",editOnly:!1,default:!1},quickcrop:{path:"plugins/quickcrop.js",editOnly:!1,default:!1},upload:{path:"plugins/upload.js",editOnly:!0,default:!1},people:{path:"plugins/people.js",editOnly:!1,default:!1},menu:{path:"plugins/menu.js",editOnly:!1,default:!1},wire:{path:"plugins/wire.js",editOnly:!1,default:!1},message:{path:"plugins/message.js",editOnly:!1,default:!1},like:{path:"plugins/like.js",editOnly:!1,default:!1},"ai-edit":{path:"plugins/ai-edit.js",editOnly:!0,default:!1},demo:{path:"plugins/demo.js",editOnly:!1,default:!1},source:{path:"plugins/source.js",editOnly:!0,default:!0},"visitor-drafts":{path:"plugins/visitor-drafts.js",ownerPath:"plugins/visitor-drafts-owner.js",editOnly:!1,default:!1},"bind-text":{path:"plugins/bind-text.js",editOnly:!0,default:!1},derive:{path:"plugins/derive.js",editOnly:!1,default:!1},upgrade:{path:"plugins/upgrade.js",editOnly:!1,default:!1}},b={"core/is-edit-mode.js":()=>import("./core/is-edit-mode-GCX6767E.js"),"core/draft-mode.js":()=>import("./core/draft-mode-WSQAT67S.js"),"lib/region-policy.js":()=>import("./lib/region-policy-KWBPROWF.js"),"lib/mutation.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["lib/mutation.js"]),"core/edit-mode.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/edit-mode.js"]),"core/mode-key.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/mode-key.js"]),"core/stale-host-notice.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/stale-host-notice.js"]),"core/page-data.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/page-data.js"]),"core/preserve-authored.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/preserve-authored.js"]),"core/snapshot.js":()=>import("./core/snapshot-O7II2AGG.js"),"core/save-core.js":()=>import("./core/save-core-IOCMXO5L.js"),"core/save.js":()=>import("./core/save-AOJBDSOK.js"),"core/conflict-notice.js":()=>import("./core/conflict-notice-JMAZLVRX.js"),"core/recovery.js":()=>import("./core/recovery-DRFZRJED.js"),"core/unsaved-warning.js":()=>import("./core/unsaved-warning-U5VUJFOE.js"),"core/persist.js":()=>import("./core/persist-3OPWJKZS.js"),"core/admin-attrs.js":()=>import("./core/admin-attrs-ZG7R5V3E.js"),"core/autosave.js":()=>import("./core/autosave-VPORYJSE.js"),"attrs/save-freeze.js":()=>import("./attrs/save-freeze-MTFVVYV5.js"),"attrs/onaftersave.js":()=>import("./attrs/onaftersave-OKSWEJQF.js"),"attrs/refetch-on-save.js":()=>import("./attrs/refetch-on-save-DPGJJMGN.js"),"attrs/add-from.js":()=>import("./attrs/add-from-T5LJXFFI.js"),"lib/cache-bust.js":()=>import("./lib/cache-bust-NH7VBWHO.js"),"plugins/richclay.js":()=>import("./plugins/richclay-KLGETK77.js"),"plugins/indicator.js":()=>import("./plugins/indicator-4VDXWYTD.js"),"sync/live-sync.js":()=>import("./sync/live-sync-SKPMFYOO.js"),"plugins/live.js":()=>import("./plugins/live-5EZN2EYP.js"),"plugins/page.js":()=>import("./plugins/page-LVW5DWA4.js"),"plugins/page-view.js":()=>import("./plugins/page-view-5KQ76IJB.js"),"plugins/sortable.js":()=>import("./plugins/sortable-WJZZBM7R.js"),"plugins/undo.js":()=>import("./plugins/undo-3JEYK5QY.js"),"plugins/unsent.js":()=>import("./plugins/unsent-OA4RGBUT.js"),"plugins/cms.js":()=>import("./plugins/cms-LRAOZHT7.js"),"plugins/quickcrop.js":()=>import("./plugins/quickcrop-BQ5YYFCH.js"),"plugins/upload.js":()=>import("./plugins/upload-TTCQRIM5.js"),"plugins/people.js":()=>import("./plugins/people-C7TVBBMR.js"),"plugins/menu.js":()=>import("./plugins/menu-DM2JHPSR.js"),"plugins/wire.js":()=>import("./plugins/wire-VRYPY6EJ.js"),"plugins/message.js":()=>import("./plugins/message-LQ6EDH4V.js"),"plugins/like.js":()=>import("./plugins/like-EV7MTZ56.js"),"plugins/ai-edit.js":()=>import("./plugins/ai-edit-J5VLSW5I.js"),"plugins/demo.js":()=>import("./plugins/demo-42BSYQ7T.js"),"plugins/visitor-drafts.js":()=>import("./plugins/visitor-drafts-2AWNT23K.js"),"plugins/visitor-drafts-owner.js":()=>import("./plugins/visitor-drafts-owner-MZP45XSG.js"),"plugins/bind-text.js":()=>import("./plugins/bind-text-NX46N5UV.js"),"plugins/source.js":()=>import("./plugins/source-CCEUM3OR.js"),"plugins/derive.js":()=>import("./plugins/derive-QVI3LI3A.js"),"plugins/upgrade.js":()=>import("./plugins/upgrade-NW556WJD.js")},ie=["visitor-drafts","richclay","indicator","sortable","undo","unsent","quickcrop","upload","people","menu","upgrade","cms","page-view","sync","live","page","message","like","wire","ai-edit","demo","derive","bind-text","source"],re={cms:["quickcrop","upload"],"ai-edit":["wire"],page:["live","sync","upload"]},ae={page:["richclay"]},ce=new Set(["source","sortable","menu","upgrade"]);function K(t,e,o,s){let u=t.get(e);if(u)for(let n of u.split(",")){let r=n.trim();if(r){if(!w[r]||w[r].internal){console.warn(`clayjs: unknown plugin "${r}"`);continue}s(o,r)}}}var le=["sync","live","page","upload","quickcrop","cms","people","menu","upgrade","wire","ai-edit","demo","source"],ue=["attrs/refetch-on-save.js","core/conflict-notice.js"],de="https://hyperclay.com/templates/";function P(t,e,{isDraftMode:o=!1,hasSap:s=!1,hasVariants:u=!1,canEdit:n=!1,templateSource:r=null}={}){let g=[...X.always];e&&g.push(...X.editOnly);let m=new Set;K(t,"plugins",m,(i,l)=>i.add(l));let a=new Set;K(t,"exclude",a,(i,l)=>i.add(l));let d=new Set(m);for(let[i,l]of Object.entries(w))l.default&&d.add(i);s&&d.add("derive"),u&&(e||n)&&d.add("menu"),a.has("wire")&&d.delete("ai-edit"),!e&&!o&&d.has("page")&&d.add("page-view");for(let i of[...d])if(!a.has(i)&&!(w[i].editOnly&&!e))for(let l of re[i]||[])d.add(l);for(let i of a)d.delete(i);if(o){for(let i of le)d.delete(i);for(let i of ue){let l=g.indexOf(i);l>-1&&g.splice(l,1)}d.add("visitor-drafts")}!o&&n&&!a.has("upgrade")&&r&&r.startsWith(de)&&d.add("upgrade");for(let[i,l]of Object.entries(ae))if(d.has(i))for(let v of l)m.has(v)||d.delete(v);let c=[],h=[];for(let i of ie){if(!d.has(i))continue;let l=w[i];l.editOnly&&!e||(ce.has(i)?h:c).push(l.ownerPath&&!o?l.ownerPath:l.path)}return{core:g,plugins:c,late:h}}var C="data-deleted-at",R=(t,e)=>window.clay?.undo?.commit?window.clay.undo.commit(t,e):e(),Q=(t,e)=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0})),I=Object.assign((t,{at:e=new Date().toISOString()}={})=>(R("Move to Trash",()=>t.setAttribute(C,e)),Q(t,"clay:trashed"),{undo:()=>I.restore(t)}),{is:t=>!!t.getAttribute(C),restore(t){R("Restore",()=>t.removeAttribute(C)),Q(t,"clay:restored")},purge(t){R("Delete forever",()=>t.remove())}});var Y=50,pe=1e3,fe='[clay~="no-snapshot"], [no-snapshot], [snapshot-remove]',k=0,ge=t=>{let e=t.nodeType===1?t:t.parentElement;if(!e)return"a detached node";let o=e.localName;return e.id?o+="#"+e.id:e.classList.length&&(o+="."+[...e.classList].slice(0,2).join(".")),"<"+o+">"};function me(t){let e=window.clay?.region?.resolveRegionPolicy;if(!e)return null;let o=s=>!!s&&!s.closest(fe)&&e(s).dirtyTracked;for(let s of t){if(s.type==="attributes"&&z(s.attributeName,s.target))continue;let u=s.target.nodeType===1?s.target:s.target.parentElement;if(o(u)&&!(s.type==="childList"&&![...s.addedNodes,...s.removedNodes].some(n=>n.nodeType!==1||o(n))))return s.target}return null}function _(t){let e=window.clay,o=e.Mutation,s=new Set,u=(y,p)=>{s.has(y)||(s.add(y),console.warn("clay.effect: "+p))},n=!1,r=!1,g=0,m=0;k&&e.isEditMode&&console.warn("clay.effect: an effect was created inside another effect, so a new one starts on every run. Create effects once, in clay.start.");let a=()=>{let y=Date.now();y-g>pe&&(g=y,m=0),++m>Y&&u("loop",`this effect ran more than ${Y} times in a second. Something keeps changing the document, often a timer or async callback the effect started.`)},d=()=>{if(n=!1,r)return;let y=null;o.pause(),k++;try{e.isEditMode===!0&&(a(),s.has("saved")||(y=new MutationObserver(()=>{}),y.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0})));let p=t();p&&typeof p.then=="function"&&(v(),console.error("clay.effect: fn returned a promise. It must be synchronous, so this effect was stopped."))}catch(p){console.error("clay.effect:",p)}finally{k--,o.resume();let p=y?y.takeRecords():[];if(y?.disconnect(),p.length){let O=me(p);O&&u("saved",`this effect changed ${ge(O)}, which is saved with the file. Effect writes never mark the page unsaved, so a merge can leave it dirty with no save scheduled. Draw derived values inside clay="no-dirty" or clay="editor-ui".`)}}},c=()=>{n||r||(n=!0,queueMicrotask(d))},h=["undo","redo"],i=()=>{for(let y of h)e.undo?.on?.(y,c)},l=o.onAnyChange({debounce:0,require:"observed"},c);document.addEventListener("clay:sync-applied",c),document.addEventListener("clay:modechange",i),i();let v=()=>{r=!0,l(),document.removeEventListener("clay:sync-applied",c),document.removeEventListener("clay:modechange",i);for(let y of h)e.undo?.off?.(y,c)};return c(),v}Object.defineProperty(_,"running",{get:()=>k>0});var he={overtype:()=>import("./c-PQ5LK6QE.js"),marked:()=>import("./c-XN6MBKI6.js"),highlight:()=>import("./c-33JJ6CBX.js"),"highlight/bash":()=>import("./c-KI7M4AY3.js"),"highlight/css":()=>import("./c-H4LG442Q.js"),"highlight/javascript":()=>import("./c-VDSS4K3Z.js"),"highlight/json":()=>import("./c-NRPJEVJS.js"),"highlight/python":()=>import("./c-5YIHJ3TJ.js"),"highlight/xml":()=>import("./c-WN5AY3OZ.js"),uimotion:()=>import("./c-B5CS55WR.js")};function ye(t){let e=new Map;function o(s){return Object.hasOwn(t,s)?(e.has(s)||e.set(s,t[s]().catch(u=>{throw e.delete(s),u})),e.get(s)):Promise.reject(new Error(`clay.assets: no asset named "${s}"`))}return{load:o,names:()=>Object.keys(t)}}var Z=ye(he);function L(t,e){if(!t||!e)return t;let o={...e,...t};for(let s of["entries","imports","bootImports"])o[s]={...e[s],...t[s]};return o}var je="plugins/page.js";function M(t,e,{isEditMode:o=!1,isDraftMode:s=!1,hasSapJs:u=!1}={},n=document){if(!t?.entries)return 0;let r=[...e];for(let c of e)for(let h of t.bootImports?.[c]??[])u&&h==="vendor/sap-core.vendor.js"||r.push(h);o&&!s&&r.push(...t.editBootImports??[]),o&&!s&&e.includes(je)&&r.push(...t.editorBootImports??[]);let g=new Set,m=c=>{if(!(!c||g.has(c))){g.add(c);for(let h of t.imports?.[c]??[])m(h)}};for(let c of r)m(t.entries[c]);let a=new Set([...n.querySelectorAll('link[rel="modulepreload"]')].map(c=>c.href)),d=0;for(let c of g){let h=new URL(c,t.base).href;if(a.has(h))continue;let i=n.createElement("link");i.rel="modulepreload",i.href=h,i.setAttribute("clay","no-save"),n.head.append(i),d++}return d}var E=Object.fromEntries(Object.entries(w).flatMap(([t,e])=>e.ownerPath?[[e.path,t],[e.ownerPath,t]]:[[e.path,t]])),j={},ee=new Set;function se(t){ee.has(t)||(ee.add(t),document.dispatchEvent(new CustomEvent("clay:plugin-ready",{detail:{plugin:E[t]}})))}var ve=(t,e,o,s)=>()=>t().then(u=>(M(L(e,u),[...o.core,...o.plugins,...o.late],{isEditMode:!0,hasSapJs:s}),u));function we(){return new Promise(t=>$(t))}function A(){let t=document.querySelector('meta[name="hyper-source"]');return t?t.getAttribute("content"):null}async function He(t,e,o,s=null,u=null,n=null){W(),(await b["core/draft-mode.js"]()).noteBootParams(e),await we();let g=await b["core/is-edit-mode.js"](),{isEditMode:m,isDraftMode:a,isOwner:d,siteVisibility:c,canEdit:h}=g;m&&!a&&import("./core/host-permission-6EVJGNPL.js").then(f=>f.checkHostPermission()).catch(()=>{}),window.__hyperclayEditMode=m;let i=await b["lib/region-policy.js"](),l=!!document.querySelector("[sap]"),v=document.querySelectorAll("head style[clay-variant]").length>=2,y=!!document.querySelector('script[src*="sap.js"]');G.holdSettle=l&&m;let p=P(e,m,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});p.plugins.includes("plugins/demo.js")&&g.commitModeFacts({destination:"demo"}),M(L(s,u),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y}),(m||a)&&!u&&n&&n().then(f=>M(L(s,f),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y})).catch(()=>{});let O,oe=new Promise(f=>{O=f}),ne={sync:p.plugins.includes("sync/live-sync.js")};for(let f of p.core)j[f]=await b[f](),j[f].install?.();if(Se(j,{isDraftMode:a,isOwner:d,siteVisibility:c},i),te(j),document.documentElement.getAttribute("clay-mode-switch")==="live"){let f=P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});j["core/edit-mode.js"].noteLiveSwitch({edit:f,view:P(e,!1,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()}),loaded:j,modules:b,attach:(S,D)=>{N(S,D);let T=E[S],x=window.clay.plugins;T&&Array.isArray(x)&&!x.includes(T)&&(window.clay.plugins=Object.freeze([...x,T]))},attachEditCore:te,announce:se,loadEditHints:n?ve(n,s,f,y):null,late:oe})}await j["core/edit-mode.js"].activateInitialMode(),window.clay.plugins=Object.freeze([...p.plugins,...p.late].map(f=>E[f]));let U=m?p:P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});window.clay.editPlugins=Object.freeze([...U.plugins,...U.late].map(f=>E[f]));for(let f of p.plugins){let S;try{S=await b[f]()}catch(D){console.error(`clayjs: plugin "${f}" failed to load, continuing without it:`,D);continue}j[f]=S,f==="plugins/page-view.js"&&S.start(ne),N(f,S,j)}await Promise.allSettled(p.plugins.map(f=>j[f]?.ready).filter(Boolean)),l&&Oe(j),Ee(g),o(window.clay),document.dispatchEvent(new CustomEvent("clay:ready",{detail:{clay:window.clay}})),p.late.length?be(p.late,g).then(O,O):O()}var q=(t,e)=>w[E[t]]?.editOnly&&!e.startsAtImport();async function be(t,e){try{await window.clay.page?.ready}catch{}for(let o of t)if(!q(o,e))try{let s=await b[o]();if(q(o,e)||(j[o]=s,N(o,s,j),await s.ready,q(o,e)))continue;se(o)}catch(s){console.error(`clayjs: plugin "${o}" failed to load, continuing without it:`,s),document.dispatchEvent(new CustomEvent("clay:plugin-failed",{detail:{plugin:E[o]}}))}}function Oe(t){let e=t["core/save.js"],o=null;try{o=e?e.currentPaintSignature():null}catch(s){console.error("clayjs: could not read the page's painted values:",s)}try{window.Sap&&typeof window.Sap.mount=="function"&&window.Sap.mount()}catch(s){console.error("clayjs: the derive engine failed to mount:",s)}finally{e?.releaseBootSettle()}e&&o!=null&&e.schedulePaintHeal(o)}function Se(t,{isDraftMode:e,isOwner:o,siteVisibility:s},u){let n=window.clay,r=t["lib/mutation.js"],g=t["core/edit-mode.js"];Object.assign(n,{toggleEditMode:g.toggleEditMode,setMode:g.setMode,modeLifecycle:g.modeLifecycle,isDraftMode:e,isOwner:o,siteVisibility:s,Mutation:r.default,region:u.windowRegionShape});for(let a of["mode","isEditMode","canEdit"])Object.defineProperty(n,a,{get:()=>g[a],enumerable:!0,configurable:!0});n.assets=Z;let m=t["core/page-data.js"];n.readData=m.readData,n.writeData=m.writeData,n.ephemeral=B,n.storage=F,n.host={get versions(){return import("./c-ZRXJD4G6.js").then(a=>a.hostVersions())}},n.trash=I,n.derived=H,n.effect=_,n.style=J,n.morph=(a,d,c)=>V().then(({morph:h})=>h(a,d,c))}function te(t){let e=window.clay,o=t["core/save.js"];if(o){let r=o.savePage||o.default;r.force=o.savePageForce,r.overwrite=o.saveOverwritingConflict,r.flush=o.flushSave,r.soon=o.savePageSoon,r.limits=o.saveLimits,r.inspect=o.inspectSaveSize,e.save!==r&&typeof e.save?.replace=="function"&&(r.replace=e.save.replace),e.save!==r&&(e.save=r)}e.hasUnsavedChanges=t["core/unsaved-warning.js"]?.hasUnsavedChanges??e.hasUnsavedChanges??(()=>!1);let s=t["core/snapshot.js"];s&&(e.getHTML||(e.getHTML=s.getPageContents),e.addDocumentTransform||(e.addDocumentTransform=s.addDocumentTransform),e.onSnapshot||(e.onSnapshot=s.onSnapshot));let u=t["lib/cache-bust.js"];u&&!e.cacheBust&&(e.cacheBust=u.default);let n=t["core/recovery.js"];n&&!e.recovery&&(e.recovery=n.recovery)}function N(t,e,o=j){let s=window.clay;t==="plugins/undo.js"?s.undo=e.undo||e.default:t==="plugins/unsent.js"?s.unsent=e.unsent:t==="sync/live-sync.js"?(s.morph=e.morph,s.conflicts=e.conflicts,o["core/page-data.js"].setPageDataLiveSync(e.liveSync)):t==="plugins/live.js"?s.live=e.live:t==="plugins/page.js"?s.page=e.page:t==="plugins/upgrade.js"?(s.save=s.save||{},s.save.replace=e.replace):t==="plugins/cms.js"?s.cms=e.cms||e.default:t==="plugins/upload.js"?s.upload=e.upload||e.default:t==="plugins/people.js"?(s.people=e.people,s.author=e.author,Object.defineProperty(s,"me",{get:e.currentMe,configurable:!0,enumerable:!0})):t==="plugins/message.js"?s.message=e.message:t==="plugins/like.js"?s.like=e.like:t==="plugins/wire.js"?s.wire=e.wire||e.default:t==="plugins/ai-edit.js"?s.aiEdit=e.aiEdit||e.default:t==="plugins/demo.js"?s.demo=e.demo:t==="plugins/richclay.js"?s.RichClay=e.RichClay||e.default:t==="plugins/quickcrop.js"?s.quickcrop=e.quickcrop||e.default:t==="plugins/sortable.js"?s.sortable=e.sortable:t==="plugins/source.js"?s.source=e.source||e.default:t==="plugins/visitor-drafts.js"||t==="plugins/visitor-drafts-owner.js"?s.visitorDrafts=e.visitorDrafts:t==="plugins/bind-text.js"&&(s.bindText=e.bindText)}function Ee(t){t.isEditMode||document.addEventListener("click",e=>{e.target.closest?.("[trigger-save]")&&(t.isEditMode||(console.info("clayjs: you're not the owner of this page; changes stay local"),document.dispatchEvent(new CustomEvent("clay:view-save-attempt"))))})}export{He as boot,Oe as mountDerivedEngine};
|