@panphora/clayjs 1.17.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +72474 -62090
- package/dist/m/attrs/{save-freeze-MYNVXREN.js → save-freeze-LWGF6XUN.js} +1 -1
- package/dist/m/c-2GRUM77Q.js +30 -0
- package/dist/m/c-2KIEGNC4.js +1 -0
- package/dist/m/{c-AMSNPOCX.js → c-2KL3BD52.js} +1 -1
- package/dist/m/c-2ZZBC45O.js +1 -0
- package/dist/m/c-372N6H3B.js +1 -0
- package/dist/m/{c-4WKFKEKF.js → c-3G2DGZUP.js} +1 -1
- package/dist/m/c-3LDGIBMN.js +1 -0
- package/dist/m/c-3O7OBDCM.js +1 -0
- package/dist/m/c-4ASQPRQL.js +1 -0
- package/dist/m/c-4TXNLX4K.js +6 -0
- package/dist/m/c-4YU3BR4D.js +6 -0
- package/dist/m/c-5734MF2P.js +1 -0
- package/dist/m/c-57XDY6HC.js +1 -0
- package/dist/m/{c-KAU6E43D.js → c-5B4YBZXC.js} +1 -1
- package/dist/m/c-5ONTYIUI.js +1 -0
- package/dist/m/c-5OOVFCJM.js +1 -0
- package/dist/m/{c-3XIRD4NU.js → c-5T6NZHNM.js} +1 -1
- package/dist/m/{c-74MGYWZF.js → c-5ZQV7KC4.js} +1 -1
- package/dist/m/{c-7OLLJPWP.js → c-6DB2OLRJ.js} +1 -1
- package/dist/m/c-6DNRCPNM.js +1 -0
- package/dist/m/c-6UGWFMQC.js +2 -0
- package/dist/m/c-7K4SCQB7.js +1 -0
- package/dist/m/c-7MG5RU63.js +1 -0
- package/dist/m/c-7PRJCA3E.js +1 -0
- package/dist/m/c-A6L3FMUS.js +1 -0
- package/dist/m/c-AMU3BPPR.js +4 -0
- package/dist/m/{c-Y5HBBIQ4.js → c-AMYEFA2E.js} +1 -1
- package/dist/m/c-AQYCG7QW.js +1 -0
- package/dist/m/c-ATKAOH23.js +1 -0
- package/dist/m/c-B5CS55WR.js +1 -0
- package/dist/m/c-B5UJQT7W.js +1 -0
- package/dist/m/c-B7J4K2AE.js +3 -0
- package/dist/m/c-BHZYSHW4.js +1 -0
- package/dist/m/{c-VHM5XQHK.js → c-BIJALSRD.js} +1 -1
- package/dist/m/c-BJ7YQ5QZ.js +1 -0
- package/dist/m/{c-KIPQJX4B.js → c-BRLCTNMC.js} +1 -1
- package/dist/m/{c-VE6ZMYMC.js → c-BUAYFEV5.js} +1 -1
- package/dist/m/c-C6IPRG34.js +1 -0
- package/dist/m/{c-KU3ZFADW.js → c-CAS3NND4.js} +1 -1
- package/dist/m/{c-PS5ARVWR.js → c-CCQ25GFY.js} +1 -1
- package/dist/m/c-CJFDLD43.js +1 -0
- package/dist/m/c-COPTL5WB.js +1 -0
- package/dist/m/c-D3E4WJ4M.js +166 -0
- package/dist/m/c-D5IKEKXW.js +7 -0
- package/dist/m/c-DHBRA6DL.js +1 -0
- package/dist/m/c-DKLS74XB.js +72 -0
- package/dist/m/c-DVYGFTSK.js +3 -0
- package/dist/m/c-E3ZXARWA.js +1 -0
- package/dist/m/c-EK63G3CG.js +1 -0
- package/dist/m/c-ERQSNR6K.js +13 -0
- package/dist/m/c-EVYAISP3.js +1 -0
- package/dist/m/c-EXKHPOVC.js +3 -0
- package/dist/m/{c-QJ4OM3G6.js → c-FWKHM4E7.js} +1 -1
- package/dist/m/{c-4Q2XTQ2N.js → c-GBKB5WDL.js} +1 -1
- package/dist/m/c-GNDL3TKB.js +1 -0
- package/dist/m/c-GRWMD6O5.js +1 -0
- package/dist/m/c-GRXHHFPO.js +1 -0
- package/dist/m/c-HG2C77BM.js +4 -0
- package/dist/m/c-HHGJBU4D.js +1 -0
- package/dist/m/c-HMV6P4RX.js +1 -0
- package/dist/m/c-HMYWIHFG.js +1 -0
- package/dist/m/c-HT2DKBV2.js +1 -0
- package/dist/m/c-I2SCCUEW.js +1 -0
- package/dist/m/{c-TJ6WOJL3.js → c-ICJYHABF.js} +2 -2
- package/dist/m/c-IMZCWYHR.js +7 -0
- package/dist/m/c-IVMD3FEM.js +1 -0
- package/dist/m/{c-WDC5GVKU.js → c-IVTRVENZ.js} +1 -1
- package/dist/m/c-JKZJIUIP.js +1 -0
- package/dist/m/{c-UDUUJPFZ.js → c-JNLX3RJB.js} +1 -1
- package/dist/m/c-K3ADYNLU.js +1 -0
- package/dist/m/c-KGHVFRR3.js +1 -0
- package/dist/m/{c-5QWQ7A5L.js → c-KJJPV77R.js} +1 -1
- package/dist/m/{c-CZUSOB7V.js → c-KNPDOMDY.js} +1 -1
- package/dist/m/{c-EZU56NQV.js → c-KP64LT2A.js} +2 -2
- package/dist/m/c-KQ7E3PYY.js +1 -0
- package/dist/m/c-L3F5ZLIV.js +1 -0
- package/dist/m/{c-3RUU4TPX.js → c-L42OLXWM.js} +3 -2
- package/dist/m/c-L5VFATT6.js +1 -0
- package/dist/m/c-L7JL5TL3.js +3 -0
- package/dist/m/c-LKSL4AUJ.js +1 -0
- package/dist/m/c-M6FNQCTQ.js +1 -0
- package/dist/m/c-MCOOHCSG.js +1 -0
- package/dist/m/c-MHI3GYKF.js +1 -0
- package/dist/m/c-MWXFLW4J.js +1 -0
- package/dist/m/{c-5RJFTLSF.js → c-NEL7HQW3.js} +1 -1
- package/dist/m/{c-DCXOXBF3.js → c-NQJRVJ56.js} +1 -1
- package/dist/m/c-NWX3MFT4.js +1 -0
- package/dist/m/{c-HPURYVZS.js → c-OJYM642Q.js} +1 -1
- package/dist/m/c-OKXI52N7.js +1 -0
- package/dist/m/{c-R3L7ZJGB.js → c-OPLUZR3A.js} +1 -1
- package/dist/m/{c-GSFIGKOP.js → c-OTMKN2OO.js} +1 -1
- package/dist/m/{c-6NC5I2TV.js → c-OYRZ7XG2.js} +1 -1
- package/dist/m/{c-EVCQ3BKA.js → c-P3OFYUMA.js} +1 -1
- package/dist/m/c-PLN76GF3.js +6 -0
- package/dist/m/c-PLP4JKFC.js +1 -0
- package/dist/m/c-Q26MME6N.js +1 -0
- package/dist/m/{c-S7H2DRCB.js → c-Q3XOWZEV.js} +1 -1
- package/dist/m/{c-FRLHSY7E.js → c-QIKT6SKM.js} +1 -1
- package/dist/m/c-QIXT3Q7C.js +28 -0
- package/dist/m/c-QO4HNGCQ.js +1 -0
- package/dist/m/{c-JU3NK25H.js → c-R27DWQKX.js} +1 -1
- package/dist/m/{c-RSMOODDU.js → c-R2XUODVY.js} +1 -1
- package/dist/m/{c-QNKREOL6.js → c-R7LBFMF5.js} +1 -1
- package/dist/m/c-RND3G2S2.js +1 -0
- package/dist/m/{c-Q622NS2Y.js → c-S2U6NJU4.js} +1 -1
- package/dist/m/c-SPZPGD3R.js +1 -0
- package/dist/m/c-SW4YEG2D.js +8 -0
- package/dist/m/c-T637T7SN.js +1 -0
- package/dist/m/c-TJAXGIRV.js +1 -0
- package/dist/m/{c-RYUXUUBX.js → c-TNEM3RNM.js} +1 -1
- package/dist/m/c-TTB5EK4S.js +32 -0
- package/dist/m/c-U7SHNWDH.js +1 -0
- package/dist/m/c-UDHIVLYH.js +20 -0
- package/dist/m/{c-BBVGTQG7.js → c-UGNV5MFB.js} +1 -1
- package/dist/m/{c-QICP2YR5.js → c-UORXLSD3.js} +1 -1
- package/dist/m/c-UPD33ZPE.js +1 -0
- package/dist/m/c-URSMSFCB.js +1 -0
- package/dist/m/c-UY4QX42B.js +1 -0
- package/dist/m/c-V44KWI2L.js +4 -0
- package/dist/m/c-VILENZTD.js +1 -0
- package/dist/m/{c-HDDEEL77.js → c-VJYEVRYK.js} +1 -1
- package/dist/m/{c-SMBZG5X4.js → c-VR2BJ4AN.js} +1 -1
- package/dist/m/c-W4JCVLAB.js +1 -0
- package/dist/m/c-W6DQSHXI.js +135 -0
- package/dist/m/c-WBGWGOM7.js +1 -0
- package/dist/m/{c-4L3BTFRK.js → c-WCXLG3MV.js} +1 -1
- package/dist/m/c-WGW764WX.js +1 -0
- package/dist/m/c-WMRJKQ2V.js +5 -0
- package/dist/m/c-WNTYKCDG.js +1 -0
- package/dist/m/c-WQWIRWO3.js +72 -0
- package/dist/m/c-X5LNHET5.js +1 -0
- package/dist/m/{c-I2ZATQCD.js → c-X5TSXZYJ.js} +2 -2
- package/dist/m/c-XGH4GS2T.js +1 -0
- package/dist/m/c-Y6F2FORL.js +1 -0
- package/dist/m/c-YBKHUAK7.js +10 -0
- package/dist/m/c-YBSS55KU.js +20 -0
- package/dist/m/c-YCLU4UNT.js +2 -0
- package/dist/m/c-YVZ2L7CE.js +1 -0
- package/dist/m/c-ZK4GIZH2.js +1 -0
- package/dist/m/c-ZRXJD4G6.js +1 -0
- package/dist/m/c-ZWBI4HYK.js +1 -0
- package/dist/m/core/{admin-attrs-QHOKPJ7W.js → admin-attrs-YY7T5FGU.js} +1 -1
- package/dist/m/core/autosave-S6OMNDCK.js +1 -0
- package/dist/m/core/conflict-notice-IWHMHH43.js +1 -0
- package/dist/m/core/{host-permission-FNXVEFNE.js → host-permission-6EVJGNPL.js} +1 -1
- package/dist/m/core/is-edit-mode-GCX6767E.js +1 -0
- package/dist/m/core/{persist-JFYRHMRJ.js → persist-UKXV5KLA.js} +1 -1
- package/dist/m/core/recovery-DRFZRJED.js +1 -0
- package/dist/m/core/save-LYY7K6U7.js +1 -0
- package/dist/m/core/save-core-MKRPSEEO.js +1 -0
- package/dist/m/core/snapshot-NU3YM6GR.js +1 -0
- package/dist/m/core/unsaved-warning-7QTKEN7Z.js +1 -0
- package/dist/m/internals/{index-PVXGPUDA.js → index-TGLQINN3.js} +1 -1
- package/dist/m/loader-3BBNZZGM.js +1 -0
- package/dist/m/manifest-26C55578.js +1 -0
- package/dist/m/manifest-edit-4396A009.js +1 -0
- package/dist/m/manifest.json +2111 -1573
- package/dist/m/page/{editor-NNJA4OKD.js → editor-6LRB3GE4.js} +123 -21
- package/dist/m/plugins/ai-edit-UTV7YO2I.js +6 -0
- package/dist/m/plugins/{cms-HP3LSTPN.js → cms-LRAOZHT7.js} +9 -9
- package/dist/m/plugins/{demo-RM5IR6AO.js → demo-OYO5GCAO.js} +1 -1
- package/dist/m/plugins/{derive-UAAA4V4S.js → derive-FRE5JJQE.js} +1 -1
- package/dist/m/plugins/indicator-4VDXWYTD.js +1 -0
- package/dist/m/plugins/live-AD4H6XSL.js +1 -0
- package/dist/m/plugins/menu-M5WW7DBF.js +1 -0
- package/dist/m/plugins/page-MD3T2ZX3.js +2 -0
- package/dist/m/plugins/page-view-PAWVZNFY.js +1 -0
- package/dist/m/plugins/{people-SGPJKANK.js → people-JCHVPF7P.js} +1 -1
- package/dist/m/plugins/quickcrop-BQ5YYFCH.js +26 -0
- package/dist/m/plugins/{richclay-NRQDSWX6.js → richclay-KLGETK77.js} +2 -2
- package/dist/m/plugins/sortable-4S6SQC3D.js +1 -0
- package/dist/m/plugins/source-TJXOIOYY.js +1 -0
- package/dist/m/plugins/undo-NLPGCJQY.js +1 -0
- package/dist/m/plugins/{unsent-HJFLQJ2O.js → unsent-OA4RGBUT.js} +1 -1
- package/dist/m/plugins/upgrade-HSUNDNJD.js +1 -0
- package/dist/m/plugins/{upload-WLYKK6TL.js → upload-NHGJXZK2.js} +1 -1
- package/dist/m/plugins/visitor-drafts-BW43DGY3.js +20 -0
- package/dist/m/plugins/visitor-drafts-owner-7ODQG7JX.js +1 -0
- package/dist/m/plugins/{wire-4N6GYAF6.js → wire-VBWXEXU2.js} +1 -1
- package/dist/m/reader-core-4W2KYEWQ.js +77 -0
- package/dist/m/route/route-62CHXL5B.js +1 -0
- package/dist/m/sync/live-sync-MO5DH33W.js +1 -0
- package/dist/m/ui/index-IVWN2QC4.js +1 -0
- package/dist/m/vendor/sap-core.vendor-RN4ZVY4X.js +6 -0
- package/dist/offline-manifest.json +1367 -930
- package/dist/page/themes/light-1.css +8 -7
- package/dist/server/core.cjs +1440 -288
- package/dist/server/offline-runtime.cjs +63 -63
- package/dist/server/offline-runtime.mjs +63 -63
- package/dist/server/page-compaction-worker.cjs +3710 -0
- package/dist/server/rooms.mjs +5 -0
- package/docs/guide.md +653 -101
- package/entries/sap.js +5 -5
- package/package.json +1 -1
- package/src/core/admin-contenteditable.js +5 -2
- package/src/core/admin-inputs.js +1 -0
- package/src/core/admin-onclick.js +2 -1
- package/src/core/conflict-notice-ui.js +4 -7
- package/src/core/download.js +2 -2
- package/src/core/host-meta.js +38 -0
- package/src/core/is-edit-mode.js +17 -1
- package/src/core/mode-key.js +125 -19
- package/src/core/mode-support.js +5 -0
- package/src/core/mode-transition.js +20 -6
- package/src/core/preserve-authored.js +4 -4
- package/src/core/recovery.js +121 -33
- package/src/core/save-accepted.js +33 -0
- package/src/core/save-core.js +106 -31
- package/src/core/save-job.js +108 -0
- package/src/core/save-prepare.js +53 -0
- package/src/core/save-size-notice.js +3 -1
- package/src/core/save-slices.js +15 -0
- package/src/core/save.js +557 -127
- package/src/core/serialize-steps.js +109 -0
- package/src/core/snapshot.js +170 -39
- package/src/core/source-map.js +83 -38
- package/src/core/stale-host-notice.js +1 -0
- package/src/core/upgrade-run.js +59 -8
- package/src/dom/active-element.js +5 -0
- package/src/lib/assets.js +1 -0
- package/src/lib/slice.js +65 -0
- package/src/lib/uimotion.js +774 -0
- package/src/lib/unsaved-state.js +2 -2
- package/src/live/fast-lane.js +10 -3
- package/src/live/local-lane.js +202 -11
- package/src/live/ops.js +16 -0
- package/src/live/page-compaction.js +162 -0
- package/src/live/server-lane.js +1 -0
- package/src/live/store.js +11 -3
- package/src/loader-logic.js +3 -1
- package/src/loader.js +14 -4
- package/src/page/adopt-boot.js +2 -1
- package/src/page/awareness.js +33 -2
- package/src/page/blocks.js +89 -27
- package/src/page/boot-pack.js +1 -1
- package/src/page/chart-tables.js +21 -3
- package/src/page/chart.js +406 -63
- package/src/page/checklist.js +10 -135
- package/src/page/checkpoint-proof.js +7 -1
- package/src/page/chrome.js +250 -51
- package/src/page/clipboard-shape.js +126 -0
- package/src/page/drag.js +33 -3
- package/src/page/editor.js +136 -25
- package/src/page/export-assets.js +357 -0
- package/src/page/export-html.js +209 -0
- package/src/page/export-markdown.js +361 -0
- package/src/page/features/checklist.js +428 -0
- package/src/page/features/export-html.js +189 -0
- package/src/page/features/export-markdown.js +169 -0
- package/src/page/features/import-markdown.js +349 -0
- package/src/page/features/media.js +61 -5
- package/src/page/features/registry.js +18 -0
- package/src/page/features/table.js +373 -83
- package/src/page/features/title-cover.js +331 -0
- package/src/page/features/title-icon.js +213 -0
- package/src/page/features/toc.js +87 -0
- package/src/page/format-command.js +25 -1
- package/src/page/format-gate.js +68 -18
- package/src/page/format-host.js +17 -0
- package/src/page/format-native-commands.js +21 -5
- package/src/page/image-actions.js +64 -0
- package/src/page/import-markdown.js +262 -0
- package/src/page/items.js +135 -17
- package/src/page/markdown.js +6 -2
- package/src/page/media.js +35 -119
- package/src/page/placeholder.js +14 -1
- package/src/page/projection.js +98 -10
- package/src/page/recover.js +10 -12
- package/src/page/recovery-ui.js +464 -0
- package/src/page/rich/chart.js +63 -7
- package/src/page/save-projection.js +28 -0
- package/src/page/save-states.js +13 -3
- package/src/page/schema.js +19 -3
- package/src/page/table-paste.js +3 -1
- package/src/page/table-style.js +4 -4
- package/src/page/table.js +44 -2
- package/src/page/themes/light-1.css +8 -7
- package/src/page/themes/light-1.source.css +8 -7
- package/src/page/toc-link.js +31 -0
- package/src/page/toc.js +5 -0
- package/src/page/view-hooks.js +38 -12
- package/src/page/view.js +13 -0
- package/src/page/ybind/binding.js +88 -5
- package/src/page/ybind/bridge.js +187 -20
- package/src/page/ybind/containment.js +162 -0
- package/src/page/ybind/doc.js +17 -9
- package/src/page/ybind/file-debt.js +63 -0
- package/src/page/ybind/layout.js +7 -2
- package/src/page/ybind/marks.js +1 -1
- package/src/page/ybind/moves.js +5 -4
- package/src/page/ybind/origins.js +106 -4
- package/src/page/ybind/parts.js +8 -1
- package/src/page/ybind/provider.js +113 -17
- package/src/page/ybind/recovery-proof.js +32 -9
- package/src/page/ybind/recovery-replay.js +558 -15
- package/src/page/ybind/recovery.js +174 -45
- package/src/page/ybind/table.js +67 -11
- package/src/page/ybind/walk-delta.js +258 -0
- package/src/page/ybind/walk.js +54 -29
- package/src/page/ybind/writer.js +1 -1
- package/src/plugins/ai-edit.js +13 -9
- package/src/plugins/indicator-chip.js +91 -0
- package/src/plugins/indicator.js +13 -80
- package/src/plugins/live.js +89 -14
- package/src/plugins/menu/actions.js +196 -0
- package/src/plugins/menu/people.js +279 -0
- package/src/plugins/menu/placement.js +121 -0
- package/src/plugins/menu/preferences.js +9 -0
- package/src/plugins/menu/seo.js +316 -397
- package/src/plugins/menu/style.js +171 -0
- package/src/plugins/menu/variants.js +296 -0
- package/src/plugins/menu.js +186 -183
- package/src/plugins/page-view.js +3 -2
- package/src/plugins/page.js +249 -44
- package/src/plugins/sortable.js +8 -1
- package/src/plugins/source.js +6 -0
- package/src/plugins/upgrade.js +51 -17
- package/src/plugins/upload-ui.js +12 -17
- package/src/plugins/visitor-drafts/bottom-ui.js +12 -4
- package/src/plugins/visitor-drafts/intro-style.js +7 -2
- package/src/plugins/visitor-drafts/intro.js +5 -3
- package/src/plugins/visitor-drafts/owner-chip.js +8 -12
- package/src/plugins/visitor-drafts/prompt.js +11 -9
- package/src/plugins/visitor-drafts/source.js +4 -3
- package/src/plugins/visitor-drafts/store.js +138 -9
- package/src/plugins/visitor-drafts/ui-memory.js +2 -2
- package/src/plugins/visitor-drafts-owner.js +4 -6
- package/src/plugins/visitor-drafts.js +5 -3
- package/src/recovery/store.js +1 -1
- package/src/route/route.js +4 -0
- package/src/server/rooms/index.js +5 -1
- package/src/server/rooms/live-data-rooms.js +302 -50
- package/src/server/rooms/page-compaction-worker.js +12 -0
- package/src/server/rooms/page-compactor.js +92 -0
- package/src/server/rooms/page-room-conformance.js +461 -0
- package/src/source/parse-steps.js +94 -0
- package/src/source/session.js +233 -57
- package/src/sync/editing-sender.js +12 -0
- package/src/sync/live-sync-edit.js +22 -2
- package/src/sync/live-sync.js +150 -23
- package/src/sync/page-relay.js +52 -0
- package/src/sync/presence-store.js +44 -4
- package/src/sync/presence.js +6 -3
- package/src/sync/saved-stream.js +11 -6
- package/src/ui/bevel-controls.js +1 -0
- package/src/ui/bevel-dialog.js +5 -2
- package/src/ui/editor-ui.js +77 -0
- package/src/ui/page-colour.js +281 -0
- package/src/ui/toast.js +16 -7
- package/src/vendor/hyper-html-api-upgrade.vendor.js +2 -2
- package/src/vendor/hyper-undo.vendor.js +1 -1
- package/src/vendor/hypercms.vendor.js +9 -9
- package/src/vendor/parse5.vendor.js +2 -2
- package/src/vendor/sap-core.vendor.js +5 -5
- package/dist/m/c-2SPVQSHC.js +0 -1
- package/dist/m/c-336SGU5W.js +0 -1
- package/dist/m/c-3H6BZDNJ.js +0 -6
- package/dist/m/c-4DFEJ2PO.js +0 -3
- package/dist/m/c-56QRZTZH.js +0 -1
- package/dist/m/c-5J4E7O4Y.js +0 -4
- package/dist/m/c-5LKDWQTL.js +0 -19
- package/dist/m/c-5V3MOVJT.js +0 -1
- package/dist/m/c-6AZOGAPE.js +0 -1
- package/dist/m/c-6CRUUXOX.js +0 -5
- package/dist/m/c-6HMB24EV.js +0 -1
- package/dist/m/c-6KEVEQ7L.js +0 -1
- package/dist/m/c-A3E3NIMC.js +0 -1
- package/dist/m/c-BQ6LOBEE.js +0 -1
- package/dist/m/c-BTDI4Y23.js +0 -1
- package/dist/m/c-CJ3A7ZKE.js +0 -1
- package/dist/m/c-CQHPGKX2.js +0 -1
- package/dist/m/c-DFS4XZJV.js +0 -2
- package/dist/m/c-DNENWY4O.js +0 -1
- package/dist/m/c-E4LIR5X5.js +0 -1
- package/dist/m/c-FDNHHZY5.js +0 -1
- package/dist/m/c-FROJUZMV.js +0 -1
- package/dist/m/c-G2JPKCTP.js +0 -1
- package/dist/m/c-GB6TU7WV.js +0 -1
- package/dist/m/c-GFJJEBTU.js +0 -1
- package/dist/m/c-GJAEGGXY.js +0 -1
- package/dist/m/c-GOWBDM6J.js +0 -1
- package/dist/m/c-HFKUVACH.js +0 -1
- package/dist/m/c-HHDFCNHV.js +0 -1
- package/dist/m/c-IEM4NTCS.js +0 -1
- package/dist/m/c-JDCX26UP.js +0 -25
- package/dist/m/c-KGVGROZT.js +0 -1
- package/dist/m/c-KQ6TYJAP.js +0 -135
- package/dist/m/c-LFPHCXY3.js +0 -1
- package/dist/m/c-LRPUO2MX.js +0 -1
- package/dist/m/c-LWLBHLVC.js +0 -3
- package/dist/m/c-M2L47S2X.js +0 -7
- package/dist/m/c-MFP2ZWD4.js +0 -1
- package/dist/m/c-MKSQ4Y57.js +0 -1
- package/dist/m/c-NUFFJVVJ.js +0 -1
- package/dist/m/c-NUHSPT5P.js +0 -1
- package/dist/m/c-O72HVYSA.js +0 -1
- package/dist/m/c-OIBUTDXI.js +0 -1
- package/dist/m/c-OW5QIGG3.js +0 -1
- package/dist/m/c-PGRCK73F.js +0 -1
- package/dist/m/c-Q7NQD65V.js +0 -1
- package/dist/m/c-QH63LQOS.js +0 -1
- package/dist/m/c-R7IWVINQ.js +0 -1
- package/dist/m/c-RM7J7BV2.js +0 -1
- package/dist/m/c-S4ZEH46B.js +0 -9
- package/dist/m/c-SDAXDM2D.js +0 -1
- package/dist/m/c-SMGU7RT3.js +0 -235
- package/dist/m/c-SPIORRYS.js +0 -1
- package/dist/m/c-SWLRT66R.js +0 -1
- package/dist/m/c-TCJTVAFN.js +0 -1
- package/dist/m/c-TQEMVJCS.js +0 -1
- package/dist/m/c-TYLXX4NF.js +0 -21
- package/dist/m/c-U62OB4BT.js +0 -1
- package/dist/m/c-U6YWUAR3.js +0 -8
- package/dist/m/c-UDCSU5G5.js +0 -2
- package/dist/m/c-VI5RMSVY.js +0 -1
- package/dist/m/c-VRZN56XY.js +0 -1
- package/dist/m/c-W5MCHEGA.js +0 -1
- package/dist/m/c-WNYBLIOZ.js +0 -1
- package/dist/m/c-WWXIDH4O.js +0 -28
- package/dist/m/c-XCNTK76U.js +0 -1
- package/dist/m/c-XMS6DPBR.js +0 -1
- package/dist/m/c-ZUCOKOHT.js +0 -1
- package/dist/m/c-ZVPVXTJF.js +0 -4
- package/dist/m/c-ZVRKXKM7.js +0 -1
- package/dist/m/core/autosave-HRYGUWV6.js +0 -1
- package/dist/m/core/conflict-notice-6MROJN2L.js +0 -1
- package/dist/m/core/is-edit-mode-KTWA3O5N.js +0 -1
- package/dist/m/core/recovery-FLTCC2OC.js +0 -1
- package/dist/m/core/save-HQZ4S667.js +0 -1
- package/dist/m/core/save-core-KGQWFUNH.js +0 -1
- package/dist/m/core/snapshot-EGQZNT45.js +0 -1
- package/dist/m/core/unsaved-warning-IDJLD66H.js +0 -1
- package/dist/m/loader-S4I7GKXR.js +0 -1
- package/dist/m/manifest-4C419D67.js +0 -1
- package/dist/m/manifest-edit-B077F288.js +0 -1
- package/dist/m/plugins/ai-edit-QN4PMMNL.js +0 -6
- package/dist/m/plugins/indicator-URDBBOQO.js +0 -1
- package/dist/m/plugins/live-HFWD4OIH.js +0 -1
- package/dist/m/plugins/menu-3HIEQSI6.js +0 -138
- package/dist/m/plugins/page-JOKB6XPR.js +0 -2
- package/dist/m/plugins/page-view-NXOJHNW6.js +0 -1
- package/dist/m/plugins/quickcrop-QNY3PKLD.js +0 -26
- package/dist/m/plugins/sortable-GWT4PWDV.js +0 -1
- package/dist/m/plugins/source-4ZRSAIYM.js +0 -1
- package/dist/m/plugins/undo-VDA5P7FH.js +0 -1
- package/dist/m/plugins/upgrade-W7FG5VFG.js +0 -1
- package/dist/m/plugins/visitor-drafts-LIDY7NH6.js +0 -21
- package/dist/m/plugins/visitor-drafts-owner-ZXCKBZE7.js +0 -1
- package/dist/m/reader-core-DXYCURFF.js +0 -68
- package/dist/m/route/route-KOCZSEGN.js +0 -1
- package/dist/m/sync/live-sync-J7VMYTKS.js +0 -1
- package/dist/m/ui/index-3JLVI27O.js +0 -1
- package/dist/m/vendor/sap-core.vendor-A7BMUYZT.js +0 -6
- /package/dist/m/{c-FILLTJA7.js → c-QTTJYJMA.js} +0 -0
- /package/dist/m/plugins/{quickcrop-QNY3PKLD.js.LEGAL.txt → quickcrop-BQ5YYFCH.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-NRQDSWX6.js.LEGAL.txt → richclay-KLGETK77.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as p}from"./c-BJ7YQ5QZ.js";import{a as s}from"./c-4JZDZFF6.js";import{b as l,e as n}from"./c-VAK7SG37.js";import{b as u}from"./c-MHI3GYKF.js";import{a as i}from"./c-2AZDZWCK.js";import{a as d,b as a}from"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";var f={saving:"Saving\u2026",saved:"Saved",error:"Couldn't save",offline:"Offline, not saved",retrying:"Saving\u2026",blocked:"Can't save here",pending:"Saving\u2026",acknowledged:"Saving\u2026",checkpointed:"Saved",unavailable:"Can't store changes: download a copy"},v=new Set(["saving","retrying","blocked","pending","acknowledged","unavailable"]),c=new Set(["error","offline","blocked","unavailable"]),g=[`background:${n.surface}`,`color:${n.ink}`,`border-color:${n["line-2"]}`],b=[`background:${n["ox-soft"]}`,`color:${n.ox}`,`border-color:color-mix(in srgb, ${n.ox} 28%, ${n["ox-soft"]})`],e=null,r=null;function x(){if(e&&e.isConnected)return e;let o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return e=p("div",["position:fixed","right:16px","bottom:16px","z-index:2147483000","padding:4px 12px",`font:500 13px/1.6 ${l}`,"opacity:0",`transition:${o?"none":"opacity .25s"}`,"pointer-events:none",`color-scheme:${s()}`]),e.setAttribute("data-clay-indicator",""),e.setAttribute("role","status"),document.body.appendChild(e),e}function T(o){if(!f[o])return;let m=o!=="blocked"&&(c.has(o)||o==="saved"&&i.savedToast);if(i.toasts&&m){clearTimeout(r),e&&(a(e,"opacity","0"),e.textContent="",delete e.dataset.state);return}let t=x();t.textContent=f[o],t.dataset.state=o,d(t,c.has(o)?b:g),u(t,{background:c.has(o)?null:n.surface}),a(t,"opacity","1"),clearTimeout(r),v.has(o)||(r=setTimeout(()=>{a(t,"opacity","0")},2200))}function $(){clearTimeout(r),r=null,e?.remove(),e=null}export{$ as remove,T as show};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=/^(.+)\.(\d+)\.(\d+)$/,a=/[^A-Za-z0-9+/]/;function y(t){let o=t.endsWith("==")?2:t.endsWith("=")?1:0,r=t.length-o;return a.test(o?t.slice(0,r):t)?!1:o?r%4+o===4:r%4!==1}var d=/^[A-Za-z0-9+/=\t\n\f\r ]*$/;function g(t){let o=[],r=new Map;for(let n of Object.keys(t).sort()){let e=p.exec(n);if(!e){o.push([n,t[n]]);continue}let s=r.get(e[1])??{n:Number(e[3]),got:[]};s.got[Number(e[2])]=t[n],r.set(e[1],s)}for(let[n,e]of r){let s=0;for(let i=0;i<e.n;i++)typeof e.got[i]=="string"&&s++;s===e.n&&o.push([n,e.got.join("")])}return o}function b(t){if(t?.v!==1||!t.y||typeof t.y!="object"||Array.isArray(t.y))return t;let o=new Map;for(let[n,e]of Object.entries(t.y)){let s=p.exec(n);if(!s)continue;let i=s[1],u=Number(s[2]),f=Number(s[3]),c=o.get(i)??{count:f,indices:new Set,keys:[],invalid:!1};(!Number.isSafeInteger(u)||!Number.isSafeInteger(f)||f<1||u>=f||c.count!==f||c.indices.has(u)||typeof e!="string"||!d.test(e))&&(c.invalid=!0),c.indices.add(u),c.keys.push(n),o.set(i,c)}let r=new Set;for(let[n,e]of o)if(!e.invalid&&!Object.hasOwn(t.y,n)&&e.indices.size<e.count)for(let s of e.keys)r.add(s);return r.size?{...t,y:Object.fromEntries(Object.entries(t.y).filter(([n])=>!r.has(n)))}:t}export{p as a,y as b,g as c,b as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R}from"./c-
|
|
1
|
+
import{a as R}from"./c-I2SCCUEW.js";import{a as C,d as P}from"./c-XGH4GS2T.js";import{c as v}from"./c-BPF2NSPV.js";var q="/_/upload",F=12e4,O={document:["document"],local:["local"],"document-or-local":["document","local"]},H=new Set(["network","timeout","error","bad-response","aborted"]);function j(e){return e?e.state==="cancelled"?!0:e.state!=="failed"?!1:H.has(e.result?.code??null):!1}var _=new Set,D=()=>[..._].some(e=>e.state==="uploading");async function B(){let e=[..._].filter(t=>t.state==="uploading").map(t=>t.result);return e.length?(await Promise.allSettled(e),{ok:!D()}):{ok:!0}}var S=R({id:"upload",isPending:D,flush:B}),E=null,M=()=>E?.admitted!==!1,$=0;function z(){return $+=1,`upload-${$}`}function d(e,t,s,g,m=[]){return{ok:e,msg:t,msgType:s,code:g,uploads:m}}function x(e,t){typeof document>"u"||document.dispatchEvent(new CustomEvent(`clay:upload-${e}`,{detail:t}))}function L(e){if(e==null)return null;let t=O[e];if(!t)throw new TypeError(`Unknown requiredAccess: ${String(e)}. Use one of ${Object.keys(O).join(", ")}.`);return t}async function Y(e,{onProgress:t,signal:s,requiredAccess:g,taskId:m=z(),attempt:b=1}={}){let i=L(g);if(!e)return d(!1,"No file to upload","error","bad-request");let l=()=>d(!1,"Upload cancelled","error","aborted");if(!M())return l();let a;try{a=await P(b>1?{fresh:!0}:void 0)}catch{a={extensions:[],document:null}}if(s?.aborted)return l();if(C(a)==="failed")return d(!1,"Couldn't reach the host to upload","error","network");if(!a.extensions.includes("upload"))return d(!1,"This host does not store uploaded files","skipped","unsupported");if(s?.aborted)return l();if(!a.document?.upload)return d(!1,"You can't add files to this document","error","forbidden");if(s?.aborted)return l();if(i){let k=a.document.upload.access;if(!i.includes(k))return d(!1,"This host does not keep uploaded files private to this document","error","privacy-unsupported")}if(s?.aborted)return l();let f=a.document?.upload?.maxBytes;return typeof f=="number"&&f>0&&e.size>f?d(!1,`That file is larger than this host accepts (${f} bytes)`,"error","too-large"):N(e,{onProgress:t,signal:s,taskId:m,attempt:b,requiredAccess:i})}function J(e,t){if(!t||!e.ok)return e;let s=e.uploads||[];return s.every(m=>t.includes(m?.access))?e:d(!1,"The host stored the file without the access it promised","error","privacy-unsupported",s)}function N(e,{onProgress:t,signal:s,taskId:g,attempt:m,requiredAccess:b}={}){let i=Array.isArray(b)?b:L(b);return new Promise(l=>{let a={taskId:g,attempt:m},f=v(),k=f?`${q}/${f}`:q,A=new URL(k,window.location.origin).href,n=null,y=!1,p=null;function w(r,c,o){return y?!1:(y=!0,p!==null&&clearTimeout(p),s&&s.removeEventListener("abort",T),c&&x(c,{...o,...a}),l(r),!0)}function h(r,c,o){return w(d(!1,r,c,o),"error",{msg:r,code:o})}function U(){let r=d(!1,"Upload timed out","unknown","timeout");w(r,"error",{msg:r.msg,code:r.code})&&n.abort()}function T(){w(d(!1,"Upload cancelled","skipped","aborted"))&&n?.abort()}try{n=new XMLHttpRequest}catch{return h("This browser could not start the upload","error","error")}if(p=setTimeout(U,F),s){if(s.aborted)return T();s.addEventListener("abort",T)}n.upload.addEventListener("progress",r=>{if(y||!r.lengthComputable)return;let c={loaded:r.loaded,total:r.total,percent:Math.round(r.loaded/r.total*100)};if(x("progress",{...c,...a}),t)try{t(c)}catch{}}),n.addEventListener("load",()=>{if(y)return;let r={};try{r=JSON.parse(n.responseText||"{}")}catch{r={}}if(n.status>=200&&n.status<300){let o=Array.isArray(r.uploads)?r.uploads:[];if(!o.length||typeof o[0]?.url!="string")return h("The host accepted the file but did not say where it put it","error","bad-response");let u=J(d(!0,r.msg??"Uploaded",r.msgType||"success",r.code??null,o),i);return u.ok?w(u,"done",{uploads:o}):w(u,"error",{msg:u.msg,code:u.code,uploads:o})}let c=r.code||Q[n.status]||"error";return h(r.msg||`Upload failed (${n.status})`,"error",c)}),n.addEventListener("error",()=>h("Upload failed","error","network")),n.addEventListener("abort",()=>w(d(!1,"Upload cancelled","skipped","aborted")));try{n.open("POST",A,!0),n.withCredentials=!1,n.setRequestHeader("Document-URL",window.location.href);let r=new FormData;r.append("file",e,e.name||"upload"),x("start",{name:e.name||null,size:e.size??null,...a}),n.send(r)}catch{h("The upload could not be sent","error","error")}})}function V(e,t={}){if(!e)throw new TypeError("clay.upload.start needs a file");L(t.requiredAccess);let s=z(),g=t.requiredAccess??null,m=t.onProgress||null,b=e,i=0,l="uploading",a=0,f=null,k=null,A=null,n=null,y=null,p=!1,w=0,h=new Set;function U(){return{id:s,attempt:i,state:l,loaded:a,total:f,percent:k,result:A}}function T(){if(!h.size)return;let o=U();for(let u of[...h])try{u(o)}catch{}}function r(){i+=1;let o=i;return n=new AbortController,l="uploading",a=0,f=null,k=null,A=null,y=Y(b,{requiredAccess:g,signal:n.signal,taskId:s,attempt:o,onProgress:u=>{if(!(p||o!==i)&&(a=u.loaded,f=u.total,k=u.percent,T(),m))try{m(u)}catch{}}}).then(u=>(!p&&o===i&&o!==w&&(A=u,l=u.ok?"succeeded":u.code==="aborted"?"cancelled":"failed",T()),S.changed(),u)),T(),S.changed(),y}let c={id:s,get attempt(){return i},get state(){return l},get file(){return b},get result(){return y},snapshot:U,subscribe(o){if(typeof o!="function")throw new TypeError("subscribe needs a function");if(p)return()=>{};h.add(o);try{o(U())}catch{}return()=>h.delete(o)},cancel(){p||(l==="uploading"&&(w=i,l="cancelled",A=d(!1,"Upload cancelled","error","aborted"),T(),S.changed()),n?.abort())},retry(){return p||!M()||!j(U())?y:r()},dispose(){p||(p=!0,n?.abort(),h.clear(),b=null,_.delete(c),S.changed())}};return _.add(c),r(),c}function W(){return{id:"clay:upload",order:340,prepare(e={}){let t={admitted:e.initial===!0};return E=t,{enable(){E===t&&(t.admitted=!0)},quiesce(){E===t&&(t.admitted=!1)},resume(){E===t&&(t.admitted=!0)},dispose(){E===t&&(t.admitted=!1)}}}}}var Q={402:"payment-required",413:"too-large",415:"unsupported-type",401:"unauthorized",403:"forbidden",404:"not-found"};export{j as a,L as b,Y as c,V as d,W as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t,e as o}from"./c-SPZPGD3R.js";import"./c-4TXNLX4K.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-MWXFLW4J.js";import"./c-ZK4GIZH2.js";import{c as e}from"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import"./c-AMU3BPPR.js";import"./c-QIXT3Q7C.js";import"./c-WCXLG3MV.js";import"./c-57XDY6HC.js";import"./c-I2SCCUEW.js";import"./c-VHNSBD2M.js";function c({view:r=null}={}){let a=r?e(r,{update:o}):()=>{};return{id:"chart",nodeViews:{chart:(i,n,d)=>new t(i,n,d)},dispose(){a()}}}export{c as createFeature};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Xe,b as ce,d as de,e as ue,f as et}from"./c-6DB2OLRJ.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-QTTJYJMA.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-FWKHM4E7.js";import{a as q}from"./c-ZWIOJGMT.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-7MG5RU63.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-DCFSEJZG.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-5T6NZHNM.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-RND3G2S2.js")).then(s=>y=s).catch(s=>{throw fe=null,s}),fe}var ye=null,pe=null;function Et(){return pe??=import("./c-VR2BJ4AN.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-BHZYSHW4.js"),import("./c-P3OFYUMA.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-2KIEGNC4.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-OTMKN2OO.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"./c-
|
|
1
|
+
import{a,b,c,d,e,f}from"./c-5ZQV7KC4.js";import"./c-N326R2JD.js";import"./c-I2SCCUEW.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-HA6INT6J.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{c as beginApply,d as completeApply,f as conflicts,e as failApply,a as loadEdit,b as registerContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as k}from"./c-N326R2JD.js";import{a as w}from"./c-
|
|
1
|
+
import{e as k}from"./c-N326R2JD.js";import{a as w}from"./c-I2SCCUEW.js";import{f as v}from"./c-3O7OBDCM.js";var j=new Set(["accepted","reverted","reconciled"]),T=Math.random().toString(36).slice(2,8),z=0,l=new Map,f=new Map,p=new Set,h=new Set,x=null,O=20,y=null,b=null,u=[];function E(){b??=import("./c-IVTRVENZ.js").then(e=>{for(y=e;u.length;)y.keep(u.shift())},e=>{b=null,console.error("clayjs: the conflict recovery module could not be downloaded; conflicts stay in this tab only",e)})}v&&E();function S(e=""){return`${T}:${e}${++z}`}function m(){return x||=w({id:"live-sync-conflicts",isPending:()=>l.size>0||p.size>0}),x}function g(e){m().changed(),document.dispatchEvent(new CustomEvent("clay:sync-conflicts-changed",{detail:{open:[...l.keys()],added:[],removedIds:[],updatedIds:[],...e}}))}function $(e){let t=e.recovery;return t?t.applied===!1&&t.unavailable==="hook-veto"?!1:t.localLost!==!1:!0}var C=["kind","id","label","field"];function I(e){if(!e||typeof e!="object")return null;let t={};for(let n of C){let o=e[n];typeof o=="string"&&o?t[n]=o:typeof o=="number"&&Number.isFinite(o)&&(t[n]=String(o))}return Object.keys(t).length?t:null}function F(e){let t=I(e);return t?(typeof e.open=="function"&&(t.open=e.open),t):null}function A(e,t){for(let n of[...h].reverse()){let o;try{o=n(e,t)}catch(r){console.error("clayjs: a conflict context resolver threw; the conflict stays generic",r);continue}let c=F(o);if(c)return c}return null}function L(e){if(typeof e!="function")throw new TypeError("clay.conflicts.registerContext needs a resolver function");return h.add(e),()=>h.delete(e)}function B(e,t){let n=S(),o=Object.assign(t[0],{id:n,applyId:e.id,source:e.source,ticket:e.ticket,rawReports:t,claimedBy:null});return o.context=A(o,e),l.set(n,o),e.ids.add(n),n}function D({source:e,seq:t=null,etag:n=null,domain:o,root:c,recoveryRoot:r=null}){let i=S("a");return f.set(i,{id:i,source:e,seq:t,etag:n,ticket:0,domain:o,root:c,recoveryRoot:r,ids:new Set}),p.add(i),m().changed(),i}function N(e){if(!e.every(n=>n.kind==="structure"&&n.detail==="insert-collision"&&n.recovery?.applied===!0&&!n.recovery.unavailable&&n.recovery.structure?.localAction==="inserted"&&n.recovery.structure.fragmentKind==="element"))return null;let t=e[0].recovery.subject;return t?.local?.length!==1||t.merged?.length!==1||t.live?.length!==1?null:{local:t.local[0],merged:t.merged[0],live:t.live[0]}}function P(e){let t=new Map(e.map(r=>[r,N(r)])),n=(r,i)=>r.length<i.length&&r.every((s,d)=>s===i[d]),o=(r,i)=>i.reduce((s,d)=>d==="content"?s?.content:s?.childNodes[d],r),c=new Map;for(let r of e){let i=t.get(r),s=r;if(i)for(let d of e){let a=t.get(d);a&&a.local.length<t.get(s).local.length&&n(a.local,i.local)&&n(a.merged,i.merged)&&(a.live.contains(i.live)||o(a.live,i.merged.slice(a.merged.length))===i.live)&&(s=d)}c.has(s)||c.set(s,[...s]),r!==s&&c.get(s).push(...r)}return[...c.values()]}function M(e,t){let n=t.map(c=>l.get(c)).filter(Boolean);if(!n.length)return;let o={apply:e,records:n.map(c=>({rec:c,context:I(c.context)}))};if(y)return y.keep(o);u.push(o),u.length>O&&u.shift(),E()}function Q(e,t,{ticket:n}){let o=f.get(e);if(!o)return[];o.ticket=n;let c=new Map;for(let i of t){if(!$(i))continue;let s=i.recovery?.key??Symbol();c.has(s)||c.set(s,[]),c.get(s).push(i)}let r=P([...c.values()]).map(i=>B(o,i));return r.length&&M(o,r),p.delete(e),r.length||f.delete(e),r.length?g({added:r.map(i=>l.get(i))}):m().changed(),r}function X(e,t,{ticket:n=0}={}){let o=f.get(e);if(!o)return[];o.ticket=n,p.delete(e);let c=B(o,[{kind:"apply-incomplete",detail:null,error:String(t)}]);return l.get(c).rawReports=[],M(o,[c]),g({added:[l.get(c)]}),[c]}var q={get size(){return l.size},list(){return[...l.values()]},get(e){return l.get(e)||null},acknowledge(e,{reason:t}={}){if(!Array.isArray(e))throw new TypeError("clay.conflicts.acknowledge needs an array of ids");if(!j.has(t))throw new TypeError(`clay.conflicts.acknowledge: unknown reason "${t}"`);let n=[];for(let o of e){let c=l.get(o);if(!c)continue;k(c),l.delete(o),n.push(o);let r=f.get(c.applyId);r&&(r.ids.delete(o),r.ids.size||f.delete(c.applyId))}return n.length&&(g({removedIds:n,reason:t}),import("./c-IVTRVENZ.js").then(o=>o.dismiss(n),()=>{})),{removedIds:n,remainingIds:[...l.keys()]}},claim(e,{owner:t}){if(!t)throw new TypeError("clay.conflicts.claim needs an owner");for(let c of e){let r=l.get(c);if(r&&r.claimedBy&&r.claimedBy!==t)throw new Error(`conflict ${c} is already claimed by ${r.claimedBy}`)}let n=[];for(let c of e){let r=l.get(c);r&&!r.claimedBy&&(r.claimedBy=t,n.push(c))}n.length&&g({updatedIds:n,reason:"claimed"});let o=!1;return{release(){if(o)return;o=!0;let c=n.filter(r=>l.get(r)?.claimedBy===t);for(let r of c)l.get(r).claimedBy=null;c.length&&g({updatedIds:c,reason:"released"})}}},registerContext:L,contextFor:A,recoveryOf(e){let t=l.get(e);return t&&f.get(t.applyId)||null},hasPendingApply(){return p.size>0}};export{E as a,L as b,D as c,Q as d,X as e,q as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as p}from"./c-
|
|
1
|
+
import{d as p}from"./c-XGH4GS2T.js";import{f as u}from"./c-3O7OBDCM.js";var d=window.__clayWorkspaceBackground===!0;document.addEventListener("clay:workspace-background",()=>{d=!0});document.addEventListener("clay:workspace-foreground",()=>{d=!1});var a=()=>document.hidden||d,m=class extends EventTarget{constructor(e,{shared:t=!1,sharedData:i=!1,documentURL:n,lane:s,clientId:o,startupCheck:c=!1,keepAliveWhenHidden:v=!1}={}){super(),this.url=e,this.readyState=0,this.onopen=null,this.onmessage=null,this.onerror=null,this._shared=t&&typeof SharedWorker=="function",this._sharedData=i,this._documentURL=n,this._lane=s,this._clientId=o,this._keepAliveWhenHidden=v,this._since=0,this._closed=!1,this._suspended=!1,this._repair=!1,this._startup=c,this._worker=null,this._source=null,this._visibility=()=>{clearTimeout(this._hiddenTimer),a()?(this._worker&&this._postWorker(this._worker,"hidden"),this._keepAliveWhenHidden||(this._hiddenTimer=setTimeout(()=>this._suspend(),5e3))):this._suspended?this._resume():this._worker&&this._postWorker(this._worker,"visible")},this._pagehide=()=>this._suspend(!0),this._pageshow=()=>{(!a()||this._keepAliveWhenHidden)&&this._resume()},document.addEventListener("visibilitychange",this._visibility),document.addEventListener("clay:workspace-background",this._visibility),document.addEventListener("clay:workspace-foreground",this._visibility),window.addEventListener("pagehide",this._pagehide),window.addEventListener("pageshow",this._pageshow),this._open(),a()&&this._visibility()}_emit(e,t){if(this._closed)return;let i=t===void 0?new Event(e):new MessageEvent(e,{data:t});this.dispatchEvent(i),this[`on${e}`]?.(i)}_postWorker(e,t,i={}){e.port.postMessage({v:this._sharedData?2:1,type:t,...i})}_open(){if(!(this._closed||this._suspended)){if(this.readyState=0,!this._shared)return this._openDirect();try{let e=new SharedWorker(new URL(this._sharedData?"/_/sync/data-worker.js":"/_/sync/worker.js",window.location.origin).href,this._sharedData?"clay-sync-data":"clay-sync");this._worker=e;let t=Date.now(),i=!1;e.onerror=()=>{this._worker===e&&(this._shared=!1,this._repair=!0,this._reopen())},this._startTimer=setTimeout(e.onerror,5e3),e.port.onmessage=({data:s})=>{if(!(this._worker!==e||s?.v!==(this._sharedData?2:1))){if(this._sharedData){if(s.type==="unsupported"){e.onerror();return}if(s.type==="gone"){this.readyState=2,this._emit("error"),this.close();return}if(!i){if(s.type!=="hello")return;if(!Array.isArray(s.features)||!s.features.includes("live-data")){e.onerror();return}i=!0,clearTimeout(this._startTimer),t=Date.now();return}if(s.type==="hello")return}if(t=Date.now(),!this._sharedData&&["status","pong","cursor","frame","gone"].includes(s.type)&&clearTimeout(this._startTimer),s.type==="status")s.state==="open"?(!this._sharedData||this.readyState!==1)&&(this.readyState=1,this._emit("open")):s.state==="connecting"&&(this.readyState=0,this._emit("error"));else if(s.type==="cursor"){clearTimeout(this._startTimer),Number.isSafeInteger(s.seq)&&(this._since=Math.max(this._since,s.seq));let o=s.resync===!0||this._repair,c=this._startup;this._repair=!1,this._startup=!1,this._emit("cursor",JSON.stringify({...s,resync:o,startup:c}))}else if(s.type==="frame"&&typeof s.data=="string")this._remember(s.data),this._emit("message",s.data);else if(this._sharedData&&s.type==="event"&&["data","data-state","data-writer"].includes(s.event)&&s.data!==null&&typeof s.data=="object"&&!Array.isArray(s.data))try{this._emit(s.event,JSON.stringify(s.data))}catch{}else s.type==="gone"&&(this.readyState=2,this._emit("error"),this.close())}},e.port.start(),this._postWorker(e,a()?"hidden":"visible");let n={document:this._documentURL,lane:this._lane,since:this._since};this._sharedData&&this._lane==="live"&&(n.clientId=this._clientId),this._postWorker(e,"subscribe",n),this._pingTimer=setInterval(()=>{this._worker===e&&(Date.now()-t>15e3*3?(this._repair=!0,this._reopen()):this._postWorker(e,"ping"))},15e3)}catch{this._shared=!1,this._reopen()}}}_openDirect(){let e=new EventSource(this.url);this._source=e,e.onopen=()=>{if(this._source===e&&(this.readyState=1,this._emit("open"),this._repair||this._startup)){let t=this._repair,i=this._startup;this._repair=!1,this._startup=!1,this._emit("cursor",JSON.stringify({resync:t,startup:i}))}},e.onerror=()=>{this._source===e&&(this.readyState=e.readyState,this._emit("error"))},e.onmessage=t=>{this._source===e&&(this._remember(t.data),this._emit("message",t.data))};for(let t of["cursor","presence","data","data-state","data-writer"])e.addEventListener(t,i=>{this._source===e&&this._emit(t,i.data)})}_remember(e){try{let{seq:t}=JSON.parse(e);Number.isSafeInteger(t)&&(this._since=Math.max(this._since,t))}catch{}}_disconnect(){if(clearTimeout(this._startTimer),clearInterval(this._pingTimer),this._worker){let e=this._worker;this._worker=null,e.onerror=null,e.port.onmessage=null;try{this._postWorker(e,"unsubscribe")}catch{}e.port.close()}this._source&&(this._source.close(),this._source=null)}_reopen(){let e=(this._sharedData||this._keepAliveWhenHidden)&&this.readyState===1;this.readyState=0,e&&this._emit("error"),this._disconnect(),this._open()}_suspend(e=!1){clearTimeout(this._hiddenTimer),!(this._closed||this._suspended)&&(this._suspended=!0,this._repair=!0,this.readyState=0,e&&this._keepAliveWhenHidden&&this._emit("error"),this._disconnect())}_resume(){clearTimeout(this._hiddenTimer),!(this._closed||!this._suspended)&&(this._suspended=!1,this._open())}close(){this._closed=!0,this.readyState=2,clearTimeout(this._hiddenTimer),this._disconnect(),document.removeEventListener("visibilitychange",this._visibility),document.removeEventListener("clay:workspace-background",this._visibility),document.removeEventListener("clay:workspace-foreground",this._visibility),window.removeEventListener("pagehide",this._pagehide),window.removeEventListener("pageshow",this._pageshow)}};var f="This document was upgraded.",h=!1;function l(r,e){let t=r.querySelector(`meta[name="${e}"]`),i=t?t.getAttribute("content"):null;return i&&i.trim()?i.trim():null}function g(r=document){return l(r,"hyper-version")}function w(r){return typeof r!="string"||!r.includes("hyper-version")?null:l(new DOMParser().parseFromString(r,"text/html"),"hyper-version")}function y(r){let e=g();return!!e&&!!r&&r!==e}function T(r){return h?!0:y(w(r))}function D(r){return h?!0:!r||typeof r.querySelector!="function"?!1:y(l(r,"hyper-version"))}function S(){if(h)return Promise.resolve();h=!0;let r=u?import("./core/save-LYY7K6U7.js").then(i=>i.holdAllSaves(f),()=>{}):Promise.resolve(),e=new CustomEvent("clay:document-upgraded",{detail:{message:f}}),t=u?Promise.resolve():import("./c-D5IKEKXW.js").then(i=>i.start(e),()=>{});return document.dispatchEvent(e),Promise.all([r,t]).then(()=>{})}var _={spec:{name:"spec",relayPath:"/_/sync",documentHeader:"Document-URL",snapshotKey:"snapshot",streamPath:(r,e,t,i)=>`/_/sync?document-url=${encodeURIComponent(r)}&lane=${e}&resume-id=${t}&client-id=${encodeURIComponent(i)}`},legacy:{name:"legacy",relayPath:"/_/live-sync/save",documentHeader:"Page-URL",snapshotKey:"html",streamPath:(r,e,t,i)=>`/_/live-sync/stream?page-url=${encodeURIComponent(r)}&lane=${e}&resume-id=${t}&client-id=${encodeURIComponent(i)}`}};function I(){return p().then(r=>{let e=r?.extensions||[],t=e.includes("sync"),i=e.includes("live-data"),n=e.includes("presence"),s=t&&i&&e.includes("sync-worker-data")&&!n,o=t&&!n&&(s||e.includes("sync-worker")&&!i);return{profile:t?_.spec:_.legacy,sharedSync:o,sharedData:s,liveData:i}}).catch(()=>({profile:_.legacy,sharedSync:!1,sharedData:!1,liveData:!1}))}export{m as a,T as b,D as c,S as d,_ as e,I as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function d(e){let n=e.next();for(;!n.done;)n=e.next();return n.value}var i=()=>new Promise(e=>setTimeout(e,0)),l=()=>new Promise(e=>{if(typeof MessageChannel!="function"){i().then(e);return}let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e()},n.port2.postMessage(null)}),c=()=>{let e=globalThis.scheduler;return e?.yield?e.yield():l()},u=()=>globalThis.performance?globalThis.performance.now():Date.now();async function f(e,{budgetMs:n=4,signal:s,now:t=u,yieldTask:a=c}={}){let o=t();for(;;){if(s?.aborted)return e.return(void 0),{aborted:!0};let r=e.next();if(r.done)return r.value;t()-o<n||(await a(),o=t())}}export{d as a,c as b,f as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{w as b}from"./c-4TXNLX4K.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-MWXFLW4J.js";import"./c-ZK4GIZH2.js";import"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import{d as M}from"./c-AMU3BPPR.js";import{e as x,m as f,u as k,w as g}from"./c-QIXT3Q7C.js";import{a as T}from"./c-WCXLG3MV.js";import"./c-57XDY6HC.js";import"./c-VHNSBD2M.js";var $="page-step",l=t=>x.closeHistory(t).setMeta($,!0),y=(t,e)=>!!t&&Object.keys(t.type.attrs).every(r=>t.attrs[r]===e[r]);function C(t,e,r){let o=t.state,{from:n,to:a,empty:u,$from:s}=o.selection,c=o.tr;if(u)y(e.isInSet(o.storedMarks||s.marks()),r)?c.removeStoredMark(e):c.addStoredMark(e.create(r));else{let i=!0;o.doc.nodesBetween(n,a,h=>{i&&h.isText&&!y(e.isInSet(h.marks),r)&&(i=!1)}),i?c.removeMark(n,a,e):c.addMark(n,a,e.create(r))}return t.dispatch(l(c)),!0}function F(t,e){let r=t.state,o=r.tr;return r.selection.empty?o.removeStoredMark(e):o.removeMark(r.selection.from,r.selection.to,e),t.dispatch(l(o)),!0}function p(t,e){let r=t.runFormatCommand;return typeof r!="function"?Promise.resolve({status:"unsupported-host",code:"page-format-unsupported",retry:!1}):r(e)}function A(t,e,r={},{reset:o=!1}={}){let n=f.marks[e];return n?t.editable?g(t.state,n)?p(t,()=>o?F(t,n):C(t,n,r)):Promise.resolve({status:"refused",code:"mark-not-allowed"}):Promise.resolve({status:"refused",code:"not-editable"}):Promise.resolve({status:"refused",code:"unsupported-format"})}function B(t,e,r,o){let n=t.state.doc,a=()=>{if(t.isDestroyed)return!1;let s=t.state;return s.selection.from!==r||s.selection.to!==o?!1:(t.dispatch(s.tr.replaceSelection(e).scrollIntoView()),!0)},u=()=>{let s=e.content.textBetween(0,e.content.size,`
|
|
2
|
+
`," ");return!t.isDestroyed&&s&&t.state.doc===n&&t.dispatch(t.state.tr.insertText(s,r,o)),!1};p(t,a).then(s=>{s?.status!=="applied"&&(m(t,s?.message??"That format isn\u2019t available here."),u())},u)}function H(t,e,{at:r,from:o,to:n},a){let u=()=>{if(e.isDestroyed)return!1;let s=e.state,c=s.doc.nodeAt(r);if(!c||c.type!==f.nodes.paragraph||c.textContent!=='"')return a();let i=s.tr.delete(r+1,r+2).setNodeMarkup(r,f.nodes.quote,c.attrs);return e.dispatch(l(i.setMeta(t,{transform:i,from:o,to:n,text:" "}))),!0};e.runFormatCommand(u).then(s=>{s?.status!=="applied"&&(s&&m(e,S(s)),a())},a)}var N="This text can\u2019t take that format.",S=t=>t.status==="upgrade-required"?t.message:t.code==="mark-not-allowed"?N:"That format isn\u2019t available here.",m=(t,e)=>{t.isDestroyed||(M(t,e),T(e,"error"))},P=(t,e)=>{e?.status!=="applied"&&m(t,S(e??{}))},d=(t,e,r={},o=void 0)=>{A(t,e,r,o).then(n=>P(t,n))},O=(t,e)=>{p(t,e).then(r=>P(t,r))};function j(t,e,r){if(e==="underline")return d(t,e);let o=e==="text_color"?"Text":"Highlight",n=e==="text_color"?"Automatic":"No highlight";return b(t,r,[...k.map(a=>({key:`${e}_${a}`,label:`${o}: ${a[0].toUpperCase()}${a.slice(1)}`,icon:"\u25CF",run:u=>d(u,e,{color:a})})),{key:`${e}_none`,label:n,icon:"\xD7",run:a=>d(a,e,{},{reset:!0})}])}export{A as formatMark,O as gateTurn,j as nativeMenu,B as pasteFormats,H as quoteFromSpace,m as refuse,p as runFormat,d as runNative};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as u,f as a,g as d,q as p,z as g}from"./c-WMRJKQ2V.js";function l(e){for(let[o,s]of e){s.sort((n,t)=>n[0]-t[0]);let r=[];for(let n of s){let t=r[r.length-1];t&&n[0]<=t[1]?n[1]>t[1]&&(t[1]=n[1]):r.push([n[0],n[1]])}e.set(o,r)}return e}var i=(e,o,s,r)=>{if(r<=s)return;let n=e.get(o);n?n.push([s,r]):e.set(o,[[s,r]])};function k(e){let{structs:o,ds:s}=p(e),r=new Map;for(let t of o)t instanceof g||i(r,t.id.client,t.id.clock,t.id.clock+t.length);let n=new Map;for(let[t,c]of s.clients)for(let{clock:f,len:w}of c)i(n,t,f,f+w);return{items:l(r),deletes:l(n)}}function y(e){if(e.length===1)return e[0];let o=new Map,s=new Map;for(let r of e){for(let[n,t]of r.items)for(let[c,f]of t)i(o,n,c,f);for(let[n,t]of r.deletes)for(let[c,f]of t)i(s,n,c,f)}return{items:l(o),deletes:l(s)}}function m(e,o,s){if(!e)return!1;let r=0,n=e.length-1;for(;r<=n;){let t=r+n>>1,c=e[t];if(o<c[0])n=t-1;else if(o>=c[1])r=t+1;else return s<=c[1]}return!1}function M(e,o){if(e.complete===!1)return!1;for(let[s,r]of o.items)for(let[n,t]of r)if(!m(e.items.get(s),n,t))return!1;for(let[s,r]of o.deletes)for(let[n,t]of r)if(!m(e.deletes.get(s),n,t))return!1;return!0}function x(e){if(e.store.pendingStructs||e.store.pendingDs)return{complete:!1};let o=new Map;for(let[r,n]of e.store.clients){let t=n[n.length-1];i(o,r,0,t.id.clock+t.length)}let s=new Map;for(let[r,n]of u(e.store).clients)for(let{clock:t,len:c}of n)i(s,r,t,t+c);return{complete:!0,items:o,deletes:l(s)}}function S(e){let o=new a({gc:!1});try{for(let s of e)d(o,s);return x(o)}finally{o.destroy()}}var h=new WeakMap;function O(e,o=null){let s=h.get(e);return s||(s=o?x(o):S([e]),h.set(e,s)),s}function U(e,o){return e.complete!==!1&&M(e,k(o))}export{k as a,y as b,M as c,x as d,O as e,U as f};
|
|
@@ -0,0 +1 @@
|
|
|
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-DCFSEJZG.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as b,e as m}from"./c-UPD33ZPE.js";import"./c-L3F5ZLIV.js";import"./c-IW6GGOU2.js";import"./c-HAWFNBYG.js";import{e as h,f as d,g as l,h as w}from"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import"./c-QIXT3Q7C.js";import"./c-TCCA5BZN.js";import"./c-57XDY6HC.js";import"./c-OYRZ7XG2.js";import"./c-Q26MME6N.js";import"./c-ZWIOJGMT.js";import"./c-IJUK2GPW.js";import{c as T}from"./c-BPF2NSPV.js";import{e as v}from"./c-7MG5RU63.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";v(b);var x=1,y=class extends Error{constructor(a,n){super(n),this.name="PageCheckpointError",this.code=a}},k=(e,a)=>{throw new y(e,a)},t=(e,a)=>({ok:!1,code:e,message:a}),A=/^[0-9a-f]{64}$/,j=/^[0-9a-f]{32}$/,E=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function I(e){return{v:e.v,g:e.g,y:{...e.y??{}}}}function H(e){let a;try{a=JSON.parse(e)}catch{k("invalid-state","The page state is not JSON")}return(!E(a)||a.v!==1)&&k("invalid-state","Expected a version 1 Yjs page value"),{state:I(a),bytes:d(a)}}var S=e=>e==null?"":String(e);async function N({href:e,etag:a,fetch:n=globalThis.fetch,signal:s=null}={}){if(typeof a!="string"||!a)return t("missing-etag","A conditional read needs the accepted ETag");if(typeof e!="string"||!e)return t("no-page-state","This host names no page-state resource");if(typeof n!="function")return t("unavailable","This tab cannot read the page state");let i=globalThis.location?.href??"http://localhost/",p;try{p=new URL(e,i).href}catch{return t("no-page-state","The page-state resource is not a URL")}let c=T(),o;try{o=await n(p,{method:"GET",credentials:c?"omit":"same-origin",headers:{"If-Match":a,"Document-URL":globalThis.location?.href??i},cache:"no-store",redirect:"manual",signal:s})}catch{return t("unavailable","The page-state request did not complete")}if(!o||typeof o.status!="number")return t("unavailable","The page-state request did not answer");if(o.status===412)return t("etag-mismatch","Another version of this document is stored");if(o.status===428)return t("etag-required","The host needs a condition this read cannot send");if(o.status===404)return t("no-page-state","This host keeps no page state");if(!o.ok)return t("unavailable",`The host answered ${o.status}`);let r;try{r=JSON.parse(await o.text())}catch{return t("invalid-state","The page-state answer is not JSON")}return!E(r)||r.version!==x?t("unsupported-version","Unknown page-state version"):typeof r.tag!="string"||!r.tag?t("invalid-state","The page-state answer carries no page tag"):typeof r.stateHash!="string"||!A.test(r.stateHash)?t("invalid-state","The page-state answer carries no state digest"):typeof r.generation!="string"||!j.test(r.generation)?t("invalid-state","The page-state answer carries no generation"):typeof r.etag!="string"||!r.etag?t("invalid-state","The page-state answer carries no ETag"):Object.hasOwn(r,"documentId")?{ok:!0,version:r.version,documentId:r.documentId,generation:r.generation,etag:r.etag,stateHash:r.stateHash,tag:r.tag}:t("invalid-state","The page-state answer carries no document identity")}async function _(e,{accepted:a,article:n,etag:s}={}){if(!e||e.ok!==!0)return t(e?.code??"unavailable",e?.message??"The page state was not read");let i=a?.authority;if(!(i?.scope==="path"&&e.documentId==null)&&S(e.documentId)!==S(i?.documentId))return t("foreign-document","The page state belongs to another document");if(typeof a?.lineage?.generation!="string"||e.generation!==a.lineage.generation)return t("foreign-generation","The page state belongs to another generation");if(e.etag!==s)return t("etag-mismatch","The page state belongs to another version of this document");let c,o;try{({state:o,bytes:c}=H(e.tag))}catch(u){return t(u?.code??"invalid-state",u?.message??"The page state does not decode")}if(await h(c)!==e.stateHash)return t("state-digest-mismatch","The page state is not the one the host hashed");if(typeof n!="string")return t("missing-article","A proof names the final outgoing article");let r;try{r=m(o)}catch(u){return t("invalid-state",u?.message??"The page state does not project")}return r!==n?t("article-mismatch","The page state does not project to the accepted article"):{ok:!0,state:o,receipt:{file:e.etag,pageState:e.stateHash}}}async function O(e,a){let n=(a||[]).map(({id:s,revision:i})=>({id:s,revision:i}));try{return{ok:!0,proof:e,covered:await w(e,n)}}catch(s){return t(s?.code??"invalid-proof",s?.message??"The proof does not validate")}}async function R({capture:e,records:a=[],accepted:n,article:s,state:i=null,etag:p=null}={}){if(!i)return t("no-capture-state","No page state was pinned to this capture");if(typeof p!="string"||!p)return t("missing-etag","An accepted save with no ETag proves no stored pair");if(typeof s!="string")return t("missing-article","The accepted bytes hold no article");let c,o;try{c=m(i),o=d(i)}catch(u){return t(u?.code??"invalid-state",u?.message??"The pinned page state does not decode")}if(c!==s)return t("article-mismatch","The pinned page state does not project to the accepted article");let r;try{r=await l({capture:e,records:a,accepted:n,article:s,state:i,receipt:{file:p,pageState:await h(o)}})}catch(u){return t(u?.code??"invalid-proof",u?.message??"The proof could not be built")}return O(r,a)}async function B({read:e,capture:a,records:n=[],accepted:s,article:i,etag:p=null}={}){let c=await _(e,{accepted:s,article:i,etag:p});if(!c.ok)return c;let o;try{o=await l({capture:a,records:n,accepted:s,article:i,state:c.state,receipt:c.receipt})}catch(r){return t(r?.code??"invalid-proof",r?.message??"The proof could not be built")}return O(o,n)}async function G({channel:e,records:a=[],capture:n,accepted:s,article:i,state:p=null,etag:c=null,href:o=null,read:r=N,fetch:u}={}){if(!e||typeof e.checkpoint!="function")return{ok:!1,code:"no-channel",retired:[],proof:null};let f=await R({capture:n,records:a,accepted:s,article:i,state:p,etag:c});if(!f.ok){let P=await r({href:o,etag:c,fetch:u});f=await B({read:P,capture:n,records:a,accepted:s,article:i,etag:c})}if(!f.ok)return{ok:!1,code:f.code,retired:[],proof:null};let g=await e.checkpoint({records:f.covered,proof:f.proof});return!g||g.ok!==!0?{ok:!1,code:g?.code??"checkpoint-failed",retired:[],proof:f.proof}:{ok:!0,retired:g.retired??[],proof:f.proof}}export{x as PAGE_STATE_VERSION,y as PageCheckpointError,R as captureProof,G as checkpointAccepted,N as readPageState,B as refetchedProof,_ as verifyPageState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./c-R2XUODVY.js";import"./c-QIXT3Q7C.js";import"./c-VHNSBD2M.js";export{a as tablesFromDoc,b as toolContext};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{A as Kt,B as Ht,C as jt,E as ot,H as lt,I as dt,J as V,a as O,b as D,ba as Ut,ca as ut,d as $,da as Ft,e as Z,f as Vt,g as tt,ga as Wt,ha as Gt,ia as Xt,j as L,k as et,m as T,ma as ft,n as nt,q as Rt,t as qt,ta as Qt,v as ct,z as _t}from"./c-QIXT3Q7C.js";var be=e=>e==="left"||e==="right"?e:null,{Plugin:wt,PluginKey:ke,TextSelection:I,NodeSelection:Yt,Selection:st}=D,M=T.nodes,S=e=>e.type===M.list_item,A=e=>e.type===M.toggle,k=e=>e.attrs.parent??null,Et="page-step",q="page-move",Mt=e=>e&&(n=>e(Z.closeHistory(n).setMeta(Et,!0)));function y(e,n=null){let t=[],o=new Map,r=[];e.forEach((s,a)=>{let i=t.length,l=t[i-1],c=k(s),d=c!==null&&o.has(c)?o.get(c):-1,f=d;if(S(s)){for(l&&S(l.node)&&k(l.node)===c||(r=[]);r.length&&t[r[r.length-1]].node.attrs.indent>=s.attrs.indent;)r.pop();r.length&&(f=r[r.length-1]),r.push(i)}else r=[];let p=A(s)&&(s.attrs.open||!!n?.has(s.attrs.id)),u=d>=0&&(t[d].hidden||!t[d].open);t.push({node:s,at:a,end:a+s.nodeSize,i,up:f,depth:d>=0?t[d].depth+1:0,hidden:u,open:p,subEnd:i}),A(s)&&s.attrs.id&&o.set(s.attrs.id,i)});for(let s=t.length-1;s>=0;s--){let a=t[s].up;a>=0&&t[s].subEnd>t[a].subEnd&&(t[a].subEnd=t[s].subEnd)}return t}var Jn=(e,n)=>({from:e[n].at,to:e[e[n].subEnd].end});function xe(e,n=null){let t=new Map;n?.forEach(c=>{c.attrs.id&&t.set(c.attrs.id,k(c))}),e.forEach(c=>{c.attrs.id&&t.set(c.attrs.id,k(c))});let o=[];e.forEach((c,d)=>o.push({node:c,at:d}));let r=new Array(o.length).fill(null);for(let c=o.length-2;c>=0;c--){let d=k(o[c+1].node);r[c]=d!==k(o[c].node)?d:r[c+1]}let s=[],a=[null],i=null,l=[];return o.forEach(({node:c,at:d},f)=>{let p=k(c),u=new Set;for(;p!==null&&!a.includes(p)&&!u.has(p);)u.add(p),p=t.has(p)?t.get(p):null;a.includes(p)||(p=null);let h=r[f];a.indexOf(h)>a.indexOf(p)&&(p=h);let m=a.slice(0,a.indexOf(p)+1),g=c.attrs.indent;if(S(c)){let E=Number.isInteger(g)&&g>0?g:0,b=i&&S(i.node)&&i.parent===p;for(b||(l=[]);l.length&&l[l.length-1].orig>E;)l.pop();let N=0;if(l.length){let C=l[l.length-1];N=C.shift,C.orig===E&&l.pop()}g=Math.max(0,Math.min(E-N,b?i.indent+1:0)),l.push({orig:E,shift:E-g})}else l=[];(p!==k(c)||S(c)&&g!==c.attrs.indent)&&s.push({at:d,attrs:{...c.attrs,parent:p,...S(c)?{indent:g}:{}}}),i={node:c,parent:p,indent:g},a=A(c)&&c.attrs.id?[...m,c.attrs.id]:m}),s}function Zn(){let e=new WeakSet;return new wt({appendTransaction(n,t,o){if(!n.some(a=>a.docChanged&&!a.getMeta(ot)))return null;if(e.has(t.doc)&&je(t.doc,o.doc))return e.add(o.doc),null;let r=xe(o.doc,t.doc);if(!r.length)return e.add(o.doc),null;let s=o.tr;for(let a of r)s.setNodeMarkup(a.at,null,a.attrs);return s}})}function at(e,n,t){let o=e.resolve(n.from).index(0),r=Math.min(e.resolve(n.to).index(0),t.length-1);return r>o&&n.to<=t[r].at&&r--,[Math.min(o,t.length-1),r]}var ne=at;function z(e,n,t){let o=n;for(;e[o].up>=0&&t>e[e[o].up].subEnd;)o=e[o].up;let r=e[o].up,s=e[o].subEnd;for(;s<t;)s=e[s+1].subEnd;return{lo:o,hi:s,up:r}}var ye=(e,n,t)=>{let o=e.resolve(Math.max(0,Math.min(n,e.content.size)));return o.depth===0?o.pos:t<0?o.before(1):o.after(1)},Jt=e=>({id:e.node.attrs.id,at:e.at,node:e.node}),bt=(e,n)=>n.id?e.node.attrs.id===n.id:e.at===n.at&&e.node.type===n.node.type&&e.node.content.eq(n.node.content);function Ae(e,n,t){let o=[];for(let r=n;r<=t;r=e[r].subEnd+1)o.push(Jt(e[r]));return{roots:o,members:e.slice(n,t+1).map(Jt)}}function Se(e,n){let t=n.roots.map(a=>e.findIndex(i=>bt(i,a))).filter(a=>a>=0);if(!t.length||t.some(a=>e[a].hidden))return null;let o=t[0],r=e[o].up,s=e[o].subEnd;for(let a of t.slice(1)){if(a!==s+1||e[a].up!==r)return null;s=e[a].subEnd}return e.slice(o,s+1).some(a=>!n.members.some(i=>bt(a,i)))?null:{lo:o,hi:s}}var we=(e,n)=>{let t=o=>({...o,at:n.map(o.at,1)});return{roots:e.roots.map(t),members:e.members.map(t)}},x=class e extends st{map(n,t){return this.getBookmark().map(t).resolve(n)}eq(n){return n instanceof e&&n.anchor===this.anchor&&n.head===this.head}toJSON(){return{type:"page-block",anchor:this.anchor,head:this.head}}static fromJSON(n,t){return new e(n.resolve(t.anchor),n.resolve(t.head))}getBookmark(){let{lo:n,hi:t}=this.span();return new kt(this.anchor,this.head,Ae(y(this.$from.doc),n,t))}span(n=this.$from.doc){return{lo:n.resolve(this.from).index(0),hi:n.resolve(this.to).index(0)-1}}};x.prototype.visible=!1;st.jsonID("page-block",x);var kt=class e{constructor(n,t,o){this.anchor=n,this.head=t,this.span=o}map(n){let t=this.anchor<=this.head;return new e(n.map(this.anchor,t?1:-1),n.map(this.head,t?-1:1),we(this.span,n))}resolve(n){let t=y(n),o=Se(t,this.span);if(!o){let a=t.find(i=>bt(i,this.span.roots[0]));return st.near(n.resolve(a?.at??ye(n,Math.min(this.anchor,this.head),-1)))}let r=t[o.lo].at,s=t[o.hi].end;return this.anchor<=this.head?new x(n.resolve(r),n.resolve(s)):new x(n.resolve(s),n.resolve(r))}},oe=(e,n)=>{for(let t=n-1;t>=0;t--)if(e[t].up===e[n].up)return t;return-1};function G(e,n,t,o,r=()=>null){let s=r(e[n])||{},a="parent"in s?s.parent:k(e[n].node),i=null;for(let d=0;d<e.length&&e[d].end<=o;d++)d>=n&&d<=t||k(e[d].node)===a&&(i=e[d].node.attrs.id);let l=[],c={};for(let d=n;d<=t;d++){let f=e[d].node,p=r(e[d]);l.push(f.attrs.id),p&&"indent"in p&&p.indent!==f.attrs.indent&&(c[f.attrs.id]={indent:p.indent})}return{ids:l,afterId:i,parent:a,attrs:c}}function re(e,n,t,o,r,s=()=>null,a=e.selection){let i=n[t].at,l=n[o].end,c=l-i,d=[];for(let h=t;h<=o;h++){let m=n[h].node;d.push(m.type.create({...m.attrs,...s(n[h])||{},pos:null},m.content,m.marks))}let f=e.tr.delete(i,l),p=r>i?r-c:r;f.insert(p,d);let u=p-i;return a instanceof x?f.setSelection(new x(f.doc.resolve(a.anchor+u),f.doc.resolve(a.head+u))):a instanceof Yt?f.setSelection(Yt.create(f.doc,a.from+u)):f.setSelection(I.create(f.doc,a.anchor+u,a.head+u)),f.setMeta(q,G(n,t,o,r,s))}function xt(e,n,t){let o=e[t].node;if(A(o)){let s=o.attrs.id,a=k(o);return i=>k(i.node)===s?{parent:a}:null}let r=o.attrs.indent-e[n].node.attrs.indent;return s=>S(s.node)?{indent:s.node.attrs.indent+r}:null}var Zt=e=>(n,t)=>{t=Mt(t);let o=y(n.doc);if(!o.length)return!1;let[r,s]=at(n.doc,n.selection,o),{lo:a,hi:i,up:l}=z(o,r,s),c,d=()=>null;if(e<0){let f=oe(o,a);if(f>=0)c=o[f].at;else if(l>=0)c=o[l].at,d=xt(o,a,l);else return!0}else{let f=i+1;if(f<o.length&&o[f].up===l)c=o[o[f].subEnd].end;else if(l>=0)c=o[o[l].subEnd].end,d=xt(o,a,l);else return!0}return t&&t(re(n,o,a,i,c,d).scrollIntoView()),!0},Ee=8,rt=(e,n)=>S(e.node)&&S(n.node)&&k(e.node)===k(n.node);function Me(e,n){n=Mt(n);let t=y(e.doc);if(!t.length)return!1;let[o,r]=at(e.doc,e.selection,t),s=t[o];if(S(s.node)&&o>0&&rt(t[o-1],s)){if(s.node.attrs.indent>t[o-1].node.attrs.indent)return!0;for(let i=o;i<=Math.max(r,s.subEnd);i++)if(t[i].node.attrs.indent>=Ee)return!0;if(n){let i=e.tr,l=r;for(let d=o;d<=l;d++)l=Math.max(l,t[d].subEnd);let c=o-1;for(let d=o;d<=l&&rt(t[d],s);d++)i.setNodeMarkup(t[d].at,null,{...t[d].node.attrs,indent:t[d].node.attrs.indent+1}),c=d;i.setMeta(q,G(t,o,c,t[o].at,d=>d.i>=o&&d.i<=c?{indent:d.node.attrs.indent+1}:null)),n(i)}return!0}let a=oe(t,o);if(a<0||!A(t[a].node)||t[a].subEnd!==o-1)return!0;if(n){let{hi:i}=z(t,o,r),l=e.tr,c=k(s.node),d=t[a].node.attrs.id,f=[];for(let u=o;u<=i;u++)k(t[u].node)===c&&(l.setNodeMarkup(t[u].at,null,{...t[u].node.attrs,parent:d}),f.push(t[u].node.attrs.id));t[a].node.attrs.open||l.setNodeMarkup(t[a].at,null,{...t[a].node.attrs,open:!0});let p=G(t,o,i,t[o].at,u=>u.i>=o&&u.i<=i&&k(u.node)===c?{parent:d}:null);l.setMeta(q,{...p,ids:f,attrs:t[a].node.attrs.open?p.attrs:{...p.attrs,[d]:{open:!0}}}),n(l)}return!0}function vt(e,n){n=Mt(n);let t=y(e.doc);if(!t.length)return!1;let[o,r]=at(e.doc,e.selection,t),s=t[o];if(S(s.node)&&s.node.attrs.indent>0){if(n){let{lo:d,hi:f}=z(t,o,r),p=e.tr,u=new Set;for(let h=o;h<=r;){let m=t[h];if(S(m.node)&&m.node.attrs.indent>0)for(let g=h;g<=m.subEnd;g++)S(t[g].node)&&(p.setNodeMarkup(t[g].at,null,{...t[g].node.attrs,indent:t[g].node.attrs.indent-1}),u.add(g));h=m.subEnd+1}p.setMeta(q,G(t,d,f,t[d].at,h=>u.has(h.i)?{indent:h.node.attrs.indent-1}:null)),n(p)}return!0}if(k(s.node)===null)return!0;let{lo:i,hi:l}=z(t,o,r),c=t[i].up;for(;c>=0&&!A(t[c].node);)c=t[c].up;if(c<0)return!0;if(n){let d=xt(t,i,c),f=t[c].subEnd;if(l===f){let p=e.tr;for(let u=i;u<=l;u++){let h=d(t[u]);h&&p.setNodeMarkup(t[u].at,null,{...t[u].node.attrs,...h})}p.setMeta(q,G(t,i,l,t[i].at,d)),n(p)}else n(re(e,t,i,l,t[f].end,d).scrollIntoView())}return!0}function se(e){let n=e.tr;return e.selection.empty||n.deleteSelection(),n}function ve(e,n){let{$from:t,$to:o,empty:r}=e.selection;if(t.depth!==1||!S(t.parent)||!t.sameParent(o))return!1;if(r&&t.parent.content.size===0){let h=t.parent;return h.attrs.indent>0?vt(e,n):(n&&n(e.tr.setNodeMarkup(t.before(),M.paragraph,{id:h.attrs.id,pos:h.attrs.pos,parent:h.attrs.parent})),!0)}let s=se(e),a=s.selection.$from,i=a.parent,l=y(s.doc),c=a.index(0),d=a.parentOffset===0,f=a.parentOffset===i.content.size,p=l[c+1],u=f&&p&&rt(p,l[c])&&p.node.attrs.indent>i.attrs.indent;return d?(s.split(a.pos,1,[{type:M.list_item,attrs:i.attrs}]),s.setNodeMarkup(l[c].at,null,{...i.attrs,checked:!1})):s.split(a.pos,1,[{type:M.list_item,attrs:{...i.attrs,checked:!1,indent:i.attrs.indent+(u?1:0)}}]),n&&n(s.scrollIntoView()),!0}function Te(e,n){let{$from:t,$to:o}=e.selection;if(t.depth!==1||!A(t.parent)||!t.sameParent(o))return!1;let r=se(e),s=r.selection.$from,a=s.parent,i=y(r.doc),l=s.index(0),c=i[l],d=c.subEnd>l;if(a.content.size===0&&!d)return r.setNodeMarkup(c.at,M.paragraph,{id:a.attrs.id,pos:a.attrs.pos,parent:a.attrs.parent}),n&&n(r),!0;if(s.parentOffset===0&&a.content.size>0)return r.insert(c.at,M.paragraph.create({parent:k(a)})),n&&n(r.scrollIntoView()),!0;let f=a.content.cut(s.parentOffset);if(a.attrs.open)r.split(s.pos,1,[{type:M.paragraph,attrs:{parent:a.attrs.id}}]);else{let p=i[c.subEnd].end,u=r.steps.length;r.delete(s.pos,c.end-1);let h=r.mapping.slice(u).map(p);r.insert(h,M.toggle.create({parent:k(a),open:!1},f)),r.setSelection(I.create(r.doc,h+1))}return n&&n(r.scrollIntoView()),!0}function Ne(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1||t.parent.type!==M.paragraph||t.parent.content.size)return!1;let r=k(t.parent);if(r===null)return!1;let s=y(e.doc),a=t.index(0),i=s.findIndex(l=>l.node.attrs.id===r);if(i<0||s[i].subEnd!==a)return!1;if(n){let l=s[a].node.attrs.id,c=k(s[i].node),d=a>0?s[a-1].node:null,f=e.tr.setNodeMarkup(s[a].at,null,{...t.parent.attrs,parent:c});f.setMeta(q,{ids:[l],afterId:d?d.attrs.id:null,parent:k(d??s[a].node),attrs:{[l]:{parent:c}}}),n(f)}return!0}function Ie(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1||!t.parent.isTextblock||t.parent.type.spec.code)return!1;let r=t.parent;if(S(r)||A(r)||k(r)===null||t.parentOffset!==r.content.size)return!1;if(n){let s=e.tr.split(t.pos,1,[{type:M.paragraph,attrs:{parent:k(r)}}]);n(s.scrollIntoView())}return!0}function Ce(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1||!S(t.parent)||t.parentOffset!==0)return!1;if(t.parent.attrs.indent>0)return vt(e,n);let r=t.parent;return n&&n(e.tr.setNodeMarkup(t.before(),M.paragraph,{id:r.attrs.id,pos:r.attrs.pos,parent:r.attrs.parent})),!0}function Oe(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1||!A(t.parent)||t.parentOffset!==0)return!1;let r=t.parent;return n&&n(e.tr.setNodeMarkup(t.before(),M.paragraph,{id:r.attrs.id,pos:r.attrs.pos,parent:r.attrs.parent})),!0}function Tt(e,n){if(n<=0||!e[n-1].hidden)return-1;let t=n-1;for(;t>=0&&e[t].hidden;)t--;return t>=0&&A(e[t].node)&&e[t].subEnd>=n-1?t:-1}function Nt(e,n,t,o){let r=e.tr,s=n[o],a=n[t].end-1;return r.delete(s.at,s.end),s.node.content.size&&r.insert(a,s.node.content),r.setSelection(I.create(r.doc,a))}function De(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1||t.parentOffset!==0||!t.parent.isTextblock)return!1;let r=y(e.doc),s=t.index(0),a=Tt(r,s);return a<0?!1:(n&&n(Nt(e,r,a,s).scrollIntoView()),!0)}function $e(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1||!A(t.parent)||t.parent.attrs.open||t.parentOffset!==t.parent.content.size)return!1;let r=y(e.doc),s=t.index(0),a=r[s].subEnd+1;return a===s+1?!1:(a>=r.length||!r[a].node.isTextblock||n&&n(Nt(e,r,s,a).scrollIntoView()),!0)}function Le(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1)return!1;let r=t.parent,s=t.index(0);if(!r.isTextblock||r.type.spec.code||A(r)||!r.content.size||t.parentOffset!==r.content.size||s+1>=e.doc.childCount||!A(e.doc.child(s+1)))return!1;if(n&&r.type!==M.paragraph)n(e.tr.setSelection(I.create(e.doc,t.after()+1)).scrollIntoView());else if(n){let a=t.before(),i=e.tr.insert(t.after()+1,r.content).delete(a,t.after());n(i.setSelection(I.create(i.doc,a+1+r.content.size)).scrollIntoView())}return!0}var ae=e=>(n,t)=>{let{$from:o,empty:r}=n.selection;if(!r||o.depth!==1||!o.parent.isTextblock)return!1;let s=o.parent,a=o.index(0);if(o.parentOffset!==(e<0?0:s.content.size))return!1;let i=y(n.doc),l=e<0?Tt(i,a):-1,c=l>=0?l:a+e;if(c<0||c>=i.length)return!1;let d=i[c].node;if(!d.isTextblock||!s.type.spec.code&&!d.type.spec.code)return!1;if(!t)return!0;let f=n.tr,p=i[a],u=i[c],h=e<0?u.end-1:u.at+1;return!s.content.size&&!s.type.spec.code?f.delete(p.at,p.end).setSelection(I.create(f.doc,f.mapping.map(h))):!d.content.size&&!d.type.spec.code?f.delete(u.at,u.end):f.setSelection(I.create(f.doc,h)),t(f.scrollIntoView()),!0},Be=ae(-1),Pe=ae(1);function ze(e,n){let{$from:t,empty:o}=e.selection;if(!o||t.depth!==1||t.parentOffset!==0||!t.parent.isTextblock)return!1;let r=t.parent;if(S(r)||A(r)||k(r)===null)return!1;let s=t.index(0);return e.doc.child(s-1).attrs.id!==k(r)?!1:(n&&n(Nt(e,y(e.doc),s-1,s).scrollIntoView()),!0)}var It="page-reveal";function to(e,n){return n.length?e.setMeta(It,{add:n}):e}function ie(e,n,t,o=y(e.doc)){let r=o[n];return e.tr.setNodeMarkup(r.at,null,{...r.node.attrs,open:t}).setMeta("addToHistory",!1).setMeta(It,{clear:[r.node.attrs.id]})}function Ve(e,n){let{$from:t}=e.selection;return t.depth!==1||!A(t.parent)?!1:(n&&n(ie(e,t.index(0),!t.parent.attrs.open)),!0)}function Re(e){let n=[];for(let t of e)!A(t.node)||t.hidden||t.open||t.subEnd===t.i||n.push({line:t.at+1,sumEnd:t.end-1,from:t.end,to:e[t.subEnd].end});return n}var yt=(e,n)=>n>e.from&&n<e.to;function At(e,n,t,o){if(o>0){let r=t.to;for(;;){let s=st.findFrom(e.resolve(r),1,!0);if(!s)break;let a=n.find(i=>yt(i,s.head));if(!a)return s.head;r=a.to}}return t.sumEnd}function te(e,n,t,o=-1,r=!1){if(!t.length)return null;let{anchor:s,head:a}=n;if(!(n instanceof I)){let c=t.find(d=>n.from>=d.from&&n.from<d.to);return c?I.create(e,c.sumEnd):null}let i=t.find(c=>yt(c,a));i&&(a=At(e,t,i,o));let l=t.find(c=>yt(c,s));if(l&&(s=l.sumEnd),!r&&s!==a){let c=Math.min(s,a),d=Math.max(s,a),f=t.find(p=>(c>p.line||c===p.sumEnd)&&c<p.from&&d>=p.to);if(f){let p=c===f.sumEnd?At(e,t,f,1):f.line;s<a?s=p:a=p}}return s===n.anchor&&a===n.head?null:I.create(e,s,a)}var qe=e=>{let n="";for(;e>0;)e--,n=String.fromCharCode(97+e%26)+n,e=Math.floor(e/26);return n},_e=e=>[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]].reduce((n,[t,o])=>{for(;e>=t;)n+=o,e-=t;return n},"");function Ke(e){let n=new Map,t=[];return e.forEach((o,r)=>{if(!S(o.node)){t=[];return}r>0&&!rt(e[r-1],o)&&(t=[]);let s=o.node.attrs.indent;if(t.length=s+1,o.node.attrs.kind!=="ordered"){t[s]=0;return}t[s]=(t[s]||0)+1;let a=t[s];n.set(r,`${s%3===0?a:s%3===1?qe(a):_e(a)}.`)}),n}var F=new ke("page-collapse"),He=["id","parent","indent","kind","open"];function je(e,n){if(e.childCount!==n.childCount)return!1;for(let t=0;t<e.childCount;t++){let o=e.child(t),r=n.child(t);if(o!==r){if(o.type!==r.type)return!1;for(let s of He)if(o.attrs[s]!==r.attrs[s])return!1}}return!0}var Ue=new Set;function pt(e,n=Ue){let t=y(e,n);return{decos:Ge(e,t),ranges:Re(t),reveal:n}}var Fe=null,We=()=>Fe??=class extends $.DecorationSet{forChild(e,n){if(n.isLeaf)return $.DecorationSet.empty;let t=this.children,o=0,r=t.length/3;for(;o<r;){let s=o+r>>1;t[s*3]<e?o=s+1:r=s}return o*3<t.length&&t[o*3]===e?t[o*3+2]:$.DecorationSet.empty}};function Ge(e,n=y(e)){let{Decoration:t,DecorationSet:o}=$,r=Ke(n),s=[],a=[];for(let i of n){let l={};if(i.hidden&&(l.class="page-hidden",l["aria-hidden"]="true"),i.depth&&(l.style=`--page-depth:${i.depth}`),r.has(i.i)&&(l["data-marker"]=r.get(i.i)),A(i.node)&&(l["aria-expanded"]=i.open?"true":"false"),Object.keys(l).length&&s.push(t.node(i.at,i.end,l)),A(i.node)&&!i.hidden){let c=t.widget(0,()=>Xe(i.node,i.open),{side:-1,ignoreSelection:!0,key:`t:${i.node.attrs.id}:${i.open}`});a.push(i.at,i.end,new o([c],[]))}}return!s.length&&!a.length?o.empty:new(We())(s,a)}function Xe(e,n=e.attrs.open){let t=document.createElement("button");return t.type="button",t.className="page-toggle-button",t.contentEditable="false",t.setAttribute("aria-label",n?"Collapse":"Expand"),t.setAttribute("data-toggle",e.attrs.id||""),t}function eo(){let e=!1;return new wt({key:F,state:{init:(n,t)=>pt(t.doc),apply(n,t,o,r){let s=n.getMeta(It);if(s){let a=new Set(t.reveal);for(let i of s.add??[])a.add(i);for(let i of s.clear??[])a.delete(i);return pt(r.doc,a)}return n.docChanged?pt(r.doc,t.reveal):t}},appendTransaction(n,t,o){if(!n.some(i=>i.docChanged||i.selectionSet))return null;let s=n.some(i=>i.selectionSet)&&o.selection.head>=t.selection.head?1:-1,a=te(o.doc,o.selection,F.getState(o).ranges,s,e);return a?o.tr.setSelection(a):null},props:{decorations:n=>F.getState(n).decos,handleDOMEvents:{mousedown:(n,t)=>{let o=t.target.closest?.(".page-toggle-button");if(o){t.preventDefault();let a=y(n.state.doc),i=a.findIndex(l=>l.node.attrs.id===o.dataset.toggle);return i>=0&&n.dispatch(ie(n.state,i,!a[i].node.attrs.open,a)),!0}e=!0;let r=n.dom.ownerDocument.defaultView,s=()=>{e=!1,r.removeEventListener("mouseup",s,!0);let a=te(n.state.doc,n.state.selection,F.getState(n.state).ranges,1,!1);a&&n.dispatch(n.state.tr.setSelection(a))};return r.addEventListener("mouseup",s,!0),!1}},handleKeyDown(n,t){let o={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1}[t.key];if(!o||t.altKey||t.metaKey||t.ctrlKey)return!1;let{head:r}=n.state.selection,a=t.key==="ArrowDown"||t.key==="ArrowUp"?o>0?"down":"up":o>0?"forward":"backward";if(!n.endOfTextblock(a))return!1;let i=y(n.state.doc),{ranges:l}=F.getState(n.state),d=n.state.doc.resolve(r).index(0),f=null;if(o>0){let u=l.find(h=>h.from===i[d].end);u&&(f=At(n.state.doc,l,u,1))}else{let u=Tt(i,d);u>=0&&(f=t.shiftKey?i[u].at+1:i[u].end-1)}if(f===null||f===r)return!1;let p=t.shiftKey?n.state.selection.anchor:f;return n.dispatch(n.state.tr.setSelection(I.create(n.state.doc,p,f)).scrollIntoView()),!0}}})}var ee=/^([ \t]*)(?:([-*+•])|(\d+)[.)])[ \t]+(?:\[([ xX])\][ \t]+)?(.*)$/;function Qe(e){let n=e.replace(/\r\n?/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`);if(!n.some(r=>ee.test(r)))return null;let t=[],o=[];for(let r of n){if(!r.trim())continue;let s=ee.exec(r);if(!s){t.length=0,o.push(M.paragraph.create(null,r.trim()?T.text(r.trim()):null));continue}let a=s[1].replace(/\t/g," ").length;for(;t.length&&t[t.length-1]>a;)t.pop();(!t.length||t[t.length-1]<a)&&t.push(a);let i=Math.min(t.length-1,o.length&&S(o[o.length-1])?o[o.length-1].attrs.indent+1:0),l=s[4]!==void 0?"check":s[3]!==void 0?"ordered":"bullet";o.push(M.list_item.create({kind:l,indent:i,checked:s[4]==="x"||s[4]==="X"},s[5]?T.text(s[5]):null))}return new O.Slice(O.Fragment.from(o),0,0)}var ht=new Set(["UL","OL"]),mt=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","PRE","BLOCKQUOTE","UL","OL","LI","DETAILS","SUMMARY","TABLE","HR","FIGURE"]);function Ye(e){let n=e.querySelector(":scope > input[type=checkbox], :scope > p > input[type=checkbox], :scope > label > input[type=checkbox]");if(n)return{check:!0,checked:n.checked||n.hasAttribute("checked")};if(e.getAttribute("role")==="checkbox"||e.hasAttribute("aria-checked"))return{check:!0,checked:e.getAttribute("aria-checked")==="true"};if(e.hasAttribute("data-checked"))return{check:!0,checked:e.getAttribute("data-checked")==="true"};let o=e.className||"";return/\b(checked|task-list-item|to-do)\b/.test(o)||e.closest?.("ul.to-do-list, ul.contains-task-list")?{check:!0,checked:/\bchecked\b/.test(o)||!!e.querySelector(".checkbox-on")}:{check:!1,checked:!1}}function Je(e){let n=(e.getAttribute("style")||"")+";"+(e.parentElement?.getAttribute("style")||""),t=/list-style-type\s*:\s*([a-z-]+)/i.exec(e.getAttribute("style")||"")?.[1];return t?/decimal|alpha|roman|latin|greek/.test(t)?"ordered":"bullet":e.parentElement?.tagName==="OL"?"ordered":"bullet"}function Ze(e,n=globalThis.document){let t=n.createElement("div");t.innerHTML=e;for(let u of t.querySelectorAll('b[style*="font-weight:normal"], b[style*="font-weight: normal"]'))u.replaceWith(...u.childNodes);let o=0,r=n.createElement("div"),s=u=>{let h=parseInt(u.getAttribute("aria-level"),10);if(h>0)return h-1;let m=-1;for(let g=u.parentElement;g&&g!==t;g=g.parentElement)ht.has(g.tagName)&&m++;return Math.max(0,m)},a=[];function i(u,h,m){let g=n.createElement("div"),{check:E,checked:b}=Ye(u);g.setAttribute("data-page-li",""),g.setAttribute("data-kind",E?"check":Je(u)),g.setAttribute("data-checked",b?"true":"false"),g.dataset.depth=String(s(u)),h&&g.setAttribute("data-page-parent",h);let N=!0,C=[];for(let w of[...u.childNodes]){if(w.nodeType===1&&ht.has(w.tagName)){C.push(w);continue}if(!(w.nodeType===1&&w.tagName==="INPUT")){if(w.nodeType===1&&mt.has(w.tagName)){N||g.appendChild(n.createElement("br"));for(let P of[...w.childNodes])P.nodeType===1&&P.tagName==="INPUT"||g.appendChild(P);N=!1;continue}g.appendChild(w),(w.nodeType!==3||w.textContent.trim())&&(N=!1)}}m.appendChild(g),a.push(g);for(let w of C)l(w,h,m)}function l(u,h,m){let g=null,E=b=>{g||(g=n.createElement("p"),h&&g.setAttribute("data-page-parent",h),m.appendChild(g)),g.appendChild(b)};for(let b of[...u.childNodes])if(!(b.nodeType===1&&(b.tagName==="META"||b.tagName==="STYLE"))){if(b.nodeType===1&&b.tagName==="BR"){g=null;continue}if(b.nodeType!==1){b.nodeType===3&&(g||b.textContent.trim())&&E(b);continue}if(!mt.has(b.tagName)&&b.tagName!=="ASIDE"){E(b);continue}if(g=null,ht.has(b.tagName)){l(b,h,m);continue}if(b.tagName==="LI"){i(b,h,m);continue}if(b.tagName==="DETAILS"){let N=`paste-${++o}`,C=b.querySelector(":scope > summary"),w=n.createElement("div");w.setAttribute("data-page-toggle",N),b.hasAttribute("open")&&w.setAttribute("data-open","true"),h&&w.setAttribute("data-page-parent",h);let P=C?.querySelector(":scope > h1, :scope > h2, :scope > h3");P?(w.setAttribute("data-level",P.tagName[1]),w.append(...P.childNodes)):C&&w.append(...C.childNodes),m.appendChild(w);for(let Pt of[...b.childNodes])if(Pt!==C){let zt=n.createElement("div");zt.appendChild(Pt),l(zt,N,m)}continue}if(b.tagName==="DIV"&&!b.hasAttribute("data-page-li")&&[...b.children].some(N=>mt.has(N.tagName))){l(b,h,m);continue}h&&b.setAttribute("data-page-parent",h),m.appendChild(b)}}l(t,null,r);let c=a.length?Math.min(...a.map(u=>+u.dataset.depth)):0,d=null;for(let u of a){let h=+u.dataset.depth-c,m=d&&u.previousElementSibling===d?+d.getAttribute("data-indent")+1:0;u.setAttribute("data-indent",String(Math.min(h,m))),u.removeAttribute("data-depth"),d=u}let f=u=>{if(u.nodeType!==1||u.tagName==="IMG")return[u.cloneNode(!0)];let h=[],m=u.cloneNode(!1);for(let g of u.childNodes)for(let E of f(g))E.nodeType===1&&E.tagName==="IMG"?(m.hasChildNodes()&&h.push(m),h.push(E),m=u.cloneNode(!1)):m.appendChild(E);return(m.hasChildNodes()||!h.length)&&h.push(m),h};for(let u of[...r.children]){if(!u.matches("p, h1, h2, h3, h4, h5, h6, aside, div[data-page-li], div.page-li")||!u.querySelector("img"))continue;let h=f(u),m=u.getAttribute("data-page-parent");if(m)for(let g of h)g.setAttribute("data-page-parent",m);u.replaceWith(...h)}let p=t.querySelector("[data-pm-slice]");return p&&r.firstElementChild?.setAttribute("data-pm-slice",p.dataset.pmSlice),r.innerHTML}var gt=(e,n=0)=>e!==null&&e!==""&&Number.isInteger(+e)&&+e>=n?+e:null,v=e=>e.getAttribute("data-page-parent")||null,tn=Rt([]).type,en=Object.create(T,{marks:{value:{...T.marks,[nt]:tn}}}),ce=e=>{let n;try{n=Qt(e)}catch{return null}return!n||typeof n.t!="string"||n.t==="opaque_block"||Object.hasOwn(Ft,n.t)?null:n},nn=e=>{let n=ce(e);return n?{raw:n,parent:v(e)}:!1},on=e=>{let n=ce(e);if(!n||typeof n.c!="string"||!n.c)return O.Fragment.empty;let t=Ht(n.m,n.c.length);return O.Fragment.from(jt(T,n.c,t,T.nodes.opaque_block))},rn=e=>{try{return{entries:Wt(e.getAttribute(ut))}}catch{return!1}},X=null,sn=()=>import("./c-IMZCWYHR.js").then(e=>{X=e},()=>{}),an=new O.DOMParser(en,[{tag:"table",node:"table",getAttrs:e=>X?.table(e)??!1,getContent:e=>X.rows(e)},{tag:`div[${Ut}]`,node:"opaque_block",getAttrs:nn,getContent:on},{tag:`span[${ut}]`,mark:nt,getAttrs:rn},{tag:"div[data-page-li]",node:"list_item",getAttrs:e=>({kind:e.getAttribute("data-kind")||"bullet",indent:+e.getAttribute("data-indent")||0,checked:e.getAttribute("data-checked")==="true",parent:v(e)})},{tag:"div.page-li",node:"list_item",getAttrs:e=>({kind:e.getAttribute("data-kind")||"bullet",indent:+e.getAttribute("data-indent")||0,checked:e.getAttribute("data-checked")==="true",parent:v(e)})},{tag:"div[data-page-toggle]",node:"toggle",getAttrs:e=>({id:e.getAttribute("data-page-toggle"),open:e.getAttribute("data-open")==="true",parent:v(e),level:ft(Number(e.getAttribute("data-level")))})},{tag:"div.page-toggle",node:"toggle",getAttrs:e=>({id:e.getAttribute("data-id"),open:e.getAttribute("data-open")==="true",parent:null,level:ft(Number(e.getAttribute("data-level")))})},{tag:"h1",node:"heading",getAttrs:e=>({level:1,parent:v(e)})},{tag:"h2",node:"heading",getAttrs:e=>({level:2,parent:v(e)})},{tag:"h3",node:"heading",getAttrs:e=>({level:3,parent:v(e)})},{tag:"h4",node:"heading",getAttrs:e=>({level:3,parent:v(e)})},{tag:"pre",node:"code_block",preserveWhitespace:"full",getAttrs:e=>({lang:e.getAttribute("data-lang")||"",parent:v(e)})},{tag:"hr",node:"divider",getAttrs:e=>({parent:v(e)})},{tag:"aside.page-callout",node:"callout",getAttrs:e=>({parent:v(e)})},{tag:'figure:not([data-type]), figure[data-type="image"]',node:"image",getAttrs:e=>{let n=e.querySelector("img"),t=et(n?.getAttribute("src"));return t?{src:t,alt:n.getAttribute("alt")||"",caption:e.querySelector("figcaption")?.textContent||"",width:gt(e.getAttribute("data-width")??n.getAttribute("width"),1),align:be(e.getAttribute("data-align")),parent:v(e)}:!1}},{tag:"img[src]",node:"image",getAttrs:e=>{let n=et(e.getAttribute("src"));return n?{src:n,alt:e.getAttribute("alt")||"",width:gt(e.getAttribute("width"),1),parent:v(e)}:!1}},{tag:'div.page-file, div[data-type="file"]',node:"file",getAttrs:e=>{let n=L(e.getAttribute("data-src"));return n?{src:n,name:e.getAttribute("data-name")||"file",size:gt(e.getAttribute("data-size")),mime:e.getAttribute("data-mime")||null,parent:v(e)}:!1}},{tag:"p",node:"paragraph",getAttrs:e=>({parent:v(e)})},{tag:"br",node:"hard_break"},{tag:"strong",mark:"strong"},{tag:"b",mark:"strong",getAttrs:e=>/font-weight\s*:\s*(normal|[1-5]00)\b/.test(e.getAttribute("style")||"")?!1:null},{tag:"span",mark:"strong",getAttrs:e=>/font-weight\s*:\s*(bold|[6-9]00)\b/.test(e.getAttribute("style")||"")?null:!1},{tag:"em",mark:"em"},{tag:"i",mark:"em"},{tag:"span",mark:"em",getAttrs:e=>/font-style\s*:\s*italic/.test(e.getAttribute("style")||"")?null:!1},{tag:"s",mark:"strike"},{tag:"del",mark:"strike"},{tag:"code",mark:"code"},{tag:"a[href]",mark:"link",getAttrs:e=>{let n=L(e.getAttribute("href"));return n?{href:n}:!1}},{tag:"blockquote",node:"quote",getAttrs:e=>({parent:v(e)})},{tag:"u",mark:"underline"},{tag:"mark",mark:"highlight",getAttrs:e=>ct("highlight",{color:e.getAttribute("data-color")})??!1},{tag:"span[data-color]",mark:"text_color",getAttrs:e=>ct("text_color",{color:e.getAttribute("data-color")})??!1}]);function cn(e,n){let t=n.selection.$from,o=n.selection instanceof x,r=o?n.doc.child(n.selection.span().lo):t.depth>=1?t.node(1):null,s=r?k(r):null,a=r&&S(r)?r.attrs.indent:0,i=new Map;e.content.forEach(m=>{A(m)&&m.attrs.id&&i.set(m.attrs.id,V())});let l=[];e.content.forEach(m=>{if(!m.type.spec.group?.includes("block")){l.push(m);return}let g=k(m),E={...m.attrs,pos:null,id:A(m)?i.get(m.attrs.id)??null:null,parent:g!==null&&i.has(g)?i.get(g):s};S(m)&&(E.indent=m.attrs.indent+a),l.push(m.type.create(E,m.content,m.marks))});let c=!r||!(S(r)||A(r)),d=m=>m&&(S(m)||A(m)),f=c&&d(l[0])?0:e.openStart,p=l[l.length-1],u=new Set(i.values()),h=c&&(d(p)||p&&u.has(k(p)))?0:e.openEnd;return new O.Slice(O.Fragment.from(l),o?0:f,o?0:h)}var St=class extends O.DOMSerializer{serializeFragment(n,t,o){let r=super.serializeFragment(n,t,o);if(!n.firstChild?.isBlock)return r;let s=[...r.childNodes];return n.forEach((a,i,l)=>{let c=s[l];!c||c.nodeType!==1||(k(a)!==null&&c.setAttribute("data-page-parent",k(a)),A(a)&&a.attrs.id&&c.setAttribute("data-page-toggle",a.attrs.id),a.type===M.image&&a.attrs.width&&c.setAttribute("data-width",String(a.attrs.width)))}),X?.copy(n,s),r}},le=O.DOMSerializer.fromSchema(T),ln=e=>{let{t:n,...t}=e.attrs.raw??{},{c:o,m:r}=_t(e.content);return o?{t:n,...t,c:o,...r.some(Boolean)?{m:Kt(r)}:{}}:{t:n,...t}},dn=e=>["div",{"data-type":"newer-format",...Gt(ln(e))},0],un=e=>["span",Xt(e.attrs.entries),0],fn={...le.nodes,opaque_block:dn},pn={...le.marks,[nt]:un},hn=new St(fn,pn);function mn(e,n,t){let{$from:o}=e.state.selection,r=o.depth>=1?o.node(1):null;if(!r||!A(r)||r.attrs.open||t.content.childCount<2)return!1;let s=e.state.tr.setNodeMarkup(o.before(1),null,{...r.attrs,open:!0}).replaceSelection(t);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function gn(e){let n=!1;return e?.content?.descendants(t=>n?!1:((t.type===M.quote||t.isText&&t.marks.some(o=>qt.has(o.type.name)))&&(n=!0),!n)),n}function bn(e,n,t){let o=e.state.selection.from,r=e.state.selection.to,s=e.state.doc,a=()=>{let i=t.content.textBetween(0,t.content.size,`
|
|
4
|
+
`," ");return!e.isDestroyed&&i&&e.state.doc===s&&e.dispatch(e.state.tr.insertText(i,o,r)),!1};return import("./c-6UGWFMQC.js").then(({pasteFormats:i})=>i(e,t,o,r),a),!0}function no(){return new wt({view(){return sn(),{}},props:{handlePaste(e,n,t){return gn(t)?bn(e,n,t):mn(e,n,t)},clipboardSerializer:hn,clipboardTextSerializer:e=>X?.text(e),transformPastedHTML:e=>Ze(e),clipboardParser:an,clipboardTextParser:(e,n,t)=>t?null:Qe(e),transformPasted:(e,n)=>cn(e,n.state)}})}var W=tt.chainCommands(Ce,Oe,Be,ze,De),R=tt.chainCommands($e,Le,Pe),oo={Enter:tt.chainCommands(ve,Te,Ne,Ie),Backspace:W,"Shift-Backspace":W,"Mod-Backspace":W,"Alt-Backspace":W,"Ctrl-h":W,Delete:R,"Shift-Delete":R,"Mod-Delete":R,"Alt-Delete":R,"Ctrl-d":R,"Ctrl-Alt-Backspace":R,Tab:Me,"Shift-Tab":vt,"Mod-Shift-ArrowUp":Zt(-1),"Mod-Shift-ArrowDown":Zt(1),"Mod-Enter":Ve};function io(){return new D.Plugin({view(e){let n=e.dom.ownerDocument.createElement("div");return n.className="page-live",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),e.dom.parentElement.appendChild(n),{destroy:()=>n.remove()}}})}function Ct(e,n){let t=e.dom.parentElement?.querySelector(".page-live");t&&(t.textContent="",t.textContent=n)}var de=new D.PluginKey("tableRect");var{Selection:kn,TextSelection:K,NodeSelection:xn,Plugin:yn,PluginKey:An}=D,Q=T.nodes,H=e=>Z.closeHistory(e).setMeta(Et,!0);function Y(e,n,t=n,o=y(e)){let{lo:r,hi:s}=z(o,Math.min(n,t),Math.max(n,t)),a=o[r].at,i=o[s].end;return n<=t?new x(e.resolve(a),e.resolve(i)):new x(e.resolve(i),e.resolve(a))}function Sn(e,n=y(e.doc)){let[t,o]=ne(e.doc,e.selection,n);return z(n,t,o)}var _=(e,n,t)=>{for(let o=n;o>=0&&o<e.length;o+=t)if(!e[o].hidden)return o;return-1};function wn(e,n){if(e.selection instanceof x)return!1;let t=Math.min(e.selection.$head.index(0),e.doc.childCount-1);return n&&n(e.tr.setSelection(Y(e.doc,t))),!0}var ue=e=>(n,t)=>{let o=n.selection;if(!(o instanceof x))return!1;let r=y(n.doc),{lo:s,hi:a}=o.span(n.doc),i=e<0?_(r,s-1,-1):_(r,a+1,1);return i<0||t&&t(n.tr.setSelection(Y(n.doc,i)).scrollIntoView()),!0};function Dt(e,n,t,o){if(o<0)return n;let r=n;for(;e[r].subEnd<t;)r=e[r].subEnd+1;return r}function En(e,n){for(let t=n-1;t>=0;t--)if(e[t].up===e[n].up)return t;return n}var fe=e=>(n,t)=>{let o=n.selection;if(!(o instanceof x))return!1;let r=y(n.doc),{lo:s,hi:a}=o.span(n.doc),i=o.anchor<=o.head,l=i?s:Dt(r,s,a,1),c=i?Dt(r,s,a,1):s;return e>0?i||s===a||c===l?c=_(r,(i?a:c)+1,1):c=_(r,r[c].subEnd+1,1):!i||c===l?c=_(r,(i?c:s)-1,-1):c=En(r,c),c<0||t&&t(n.tr.setSelection(Y(n.doc,l,c,r)).scrollIntoView()),!0};function it(e,n){let t=e.selection;if(!(t instanceof x))return!1;if(n){let o=e.tr.delete(t.from,t.to);o.doc.content.size===0&&o.insert(0,Q.paragraph.create()),o.setSelection(kn.near(o.doc.resolve(Math.min(t.from,o.doc.content.size)),-1)),n(H(o).scrollIntoView())}return!0}function Mn({columns:e={},cards:n={}}){let t=dt(e),o=new Map(t.map(a=>[a,V("c")])),r=lt(null,null,t.length),s={};for(let a of new Set([...t,...Object.values(n).map(i=>i.col)])){let i=dt(Object.fromEntries(Object.entries(n).filter(([,c])=>c.col===a))),l=lt(null,null,i.length);i.forEach((c,d)=>{s[V("k")]={...n[c],col:o.get(a)??a,pos:l[d]}})}return{columns:Object.fromEntries(t.map((a,i)=>[o.get(a),{...e[a],pos:r[i]}])),cards:s}}function vn(e,n){let t=y(e.doc);if(!t.length)return!1;let{lo:o,hi:r}=Sn(e,t);if(n){let s=new Map;for(let f=o;f<=r;f++)t[f].node.type===Q.toggle&&t[f].node.attrs.id&&s.set(t[f].node.attrs.id,V());let a=[];for(let f=o;f<=r;f++){let p=t[f].node,u=p.attrs.parent??null;a.push(p.type.create({...p.attrs,...p.type===Q.board?Mn(p.attrs):{},id:s.get(p.attrs.id)??null,pos:null,parent:s.get(u)??u},p.content,p.marks))}let i=t[r].end,l=i-t[o].at,c=e.tr.insert(i,a),d=e.selection;c.setSelection(d instanceof x?new x(c.doc.resolve(i),c.doc.resolve(i+l)):K.create(c.doc,d.anchor+l,d.head+l)),n(H(c).scrollIntoView())}return!0}var he=(e,n,t,o)=>{for(let r=t;r<=o;r++)if(n[r].node.isTextblock)return n[r].end-1;return-1};function pe(e,n){let t=e.selection;if(!(t instanceof x))return!1;let o=y(e.doc),{lo:r,hi:s}=t.span(e.doc);if(n){let a=he(e.doc,o,r,s);n(e.tr.setSelection(a>=0?K.create(e.doc,a):xn.create(e.doc,o[r].at)))}return!0}var Tn=({$from:e,$to:n})=>{if(e.depth<2||n.depth<2)return null;let t=e.node(1);return t.type.name==="table"&&n.node(1)===t?{from:e.before(1),to:e.after(1)}:null};function Nn(e,n){let t=e.selection,{$from:o,$to:r}=t,s=o.parent.isTextblock&&o.sameParent(r)&&!de.getState(e),a=s&&o.parentOffset===0&&r.parentOffset===r.parent.content.size;if(s&&!a&&o.parent.content.size)return n&&n(e.tr.setSelection(K.create(e.doc,o.start(),o.end()))),!0;let i=Tn(t);return i&&!(t instanceof x&&t.from===i.from&&t.to===i.to)?(n&&n(e.tr.setSelection(new x(e.doc.resolve(i.from),e.doc.resolve(i.to)))),!0):(n&&n(e.tr.setSelection(new x(e.doc.resolve(0),e.doc.resolve(e.doc.content.size)))),!0)}var In=(e,n)=>{let t=e.state,o=t.selection;if(!(o instanceof x))return!1;let r=y(t.doc),{lo:s,hi:a}=o.span(t.doc),i=he(t.doc,r,s,a),l=t.tr;if(i<0){let c=r[a].end;l.insert(c,Q.paragraph.create({parent:r[s].node.attrs.parent??null})),l.setSelection(K.create(l.doc,c+1)),H(l)}else l.setSelection(K.create(l.doc,i));return l.insertText(n),e.dispatch(l.scrollIntoView()),!0},Cn=(e,n,t)=>{let o=e.selection;if(!(o instanceof K)||!t?.endOfTextblock("down"))return!1;let{$anchor:r,$head:s}=o;if(r.depth!==1||r.parent.type!==Q.toggle||r.parent.attrs.open||r.index(0)!==s.index(0))return!1;let a=y(e.doc),i=r.index(0),l=_(a,a[i].subEnd+1,1);return l<0?!1:(n&&n(e.tr.setSelection(Y(e.doc,i,l,a)).scrollIntoView()),!0)},On=e=>(n,t,o)=>n.selection instanceof x&&e(n,t,o),Dn={Escape:(e,n)=>pe(e,n)||wn(e,n),Enter:On(pe),ArrowUp:ue(-1),ArrowDown:ue(1),"Shift-ArrowUp":fe(-1),"Shift-ArrowDown":(e,n,t)=>fe(1)(e,n)||Cn(e,n,t),Backspace:it,"Alt-Backspace":it,"Ctrl-h":it,Delete:it,"Mod-d":vn,"Mod-a":Nn},Ot=new An("page-blocksel"),$n=e=>{let n=e.selection,{lo:t,hi:o}=n.span(e.doc);return y(e.doc).filter(r=>r.i>=t&&r.i<=o&&!r.hidden).length};function ko(){let e=Vt.keymap(Dn);return new yn({key:Ot,state:{init:()=>0,apply:(n,t,o,r)=>n.getMeta(ot)&&o.selection instanceof x&&!(r.selection instanceof x)?t+1:t},props:{handleKeyDown:(n,t)=>e.props.handleKeyDown(n,t),handleTextInput:(n,t,o,r)=>In(n,r),decorations(n){let t=n.selection;if(!(t instanceof x))return null;let o=[];return n.doc.nodesBetween(t.from,t.to,(r,s)=>(o.push($.Decoration.node(s,s+r.nodeSize,{class:"page-block-selected"})),!1)),$.DecorationSet.create(n.doc,o)},createSelectionBetween(n,t,o){let r=n.state.selection;return r instanceof x&&t.pos===r.anchor&&o.pos===r.head?r:null},handleDOMEvents:{mousedown(n,t){let o=n.state.selection;if(!t.shiftKey||!(o instanceof x)||t.button!==0)return!1;let r=n.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return!1;let s=y(n.state.doc),a=Math.min(n.state.doc.resolve(r.inside>=0?r.inside:r.pos).index(0),s.length-1),{lo:i,hi:l}=o.span(n.state.doc),c=o.anchor<=o.head?i:Dt(s,i,l,1);return t.preventDefault(),n.dispatch(n.state.tr.setSelection(Y(n.state.doc,c,a,s))),!0}}},view:()=>({update(n,t){let o=n.state.selection,r=t.selection;if(o instanceof x&&!o.eq(r)){let s=$n(n.state);Ct(n,`${s} ${s===1?"block":"blocks"} selected`)}else r instanceof x&&!(o instanceof x)&&Ct(n,Ot.getState(n.state)!==Ot.getState(t)?"Block selection cleared because the document changed":"Selection cleared")}})})}var{Plugin:Ln,PluginKey:Bn,TextSelection:J}=D,{Decoration:Pn,DecorationSet:zn}=$,U=T.marks.link,Vn=e=>/^(https?:\/\/|mailto:|tel:|www\.)\S+$/i.test(e.trim())&&L(e)!==null;function $t(e,n){let t=e.resolve(n);if(!t.parent.inlineContent)return null;let o=U.isInSet((t.nodeAfter??t.nodeBefore)?.marks??[]);if(!o)return null;let r=[];t.parent.forEach((c,d)=>r.push({n:c,off:d}));let s=r.findIndex(({n:c,off:d})=>d<=t.parentOffset&&t.parentOffset<=d+c.nodeSize&&o.isInSet(c.marks));if(s<0)return null;let a=s,i=s;for(;a>0&&o.isInSet(r[a-1].n.marks);)a--;for(;i<r.length-1&&o.isInSet(r[i+1].n.marks);)i++;let l=t.start();return{from:l+r[a].off,to:l+r[i].off+r[i].n.nodeSize,href:o.attrs.href}}function me(e,n,t,o){let r=e.tr.removeMark(n,t,U);return o&&r.addMark(n,t,U.create({href:o})),H(r)}var B=new Bn("page-link"),Lt=new WeakMap,ge=e=>`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,Rn=ge('<path d="M9 3h4v4M13 3 7.5 8.5M11 9.5V13H3V5h3.5"/>'),qn=ge('<path d="M4 4l8 8M12 4l-8 8"/>');function j(e,n,t,o={}){let r=e.createElement(n);t&&(r.className=t);for(let[s,a]of Object.entries(o))r.setAttribute(s,a);return r}function _n(e,n,t){let o=null;return e.doc.nodesBetween(n,t,r=>{let s=U.isInSet(r.marks);s&&(o=s.attrs.href)}),o}var Bt=class{constructor(n){this.view=n,this.shell=n.dom.parentElement,this.doc=n.dom.ownerDocument,this.mode=null,this.range=null;let t=this.doc;this.dom=j(t,"div","page-link",{role:"dialog","aria-label":"Link",hidden:""}),this.input=j(t,"input","page-link-input",{type:"url","aria-label":"Link address",placeholder:"Paste or type a link",autocomplete:"off",spellcheck:"false"}),this.url=j(t,"a","page-link-url",{target:"_blank",rel:"noopener noreferrer"}),this.open=j(t,"a","page-link-btn",{"data-act":"open",target:"_blank",rel:"noopener noreferrer","aria-label":"Open link in a new tab",title:"Open in a new tab"}),this.open.innerHTML=Rn,this.edit=j(t,"button","page-link-btn",{type:"button","data-act":"edit"}),this.edit.textContent="Edit",this.remove=j(t,"button","page-link-btn",{type:"button","data-act":"remove","aria-label":"Remove link",title:"Remove link"}),this.remove.innerHTML=qn,this.dom.append(this.input,this.url,this.open,this.edit,this.remove),this.shell.append(this.dom),Lt.set(n,this),this.dom.addEventListener("mousedown",o=>{o.target!==this.input&&o.preventDefault()}),this.edit.addEventListener("click",()=>this.openEdit()),this.remove.addEventListener("click",()=>this.apply("")),this.input.addEventListener("keydown",o=>{o.isComposing||o.keyCode===229||(o.key==="Enter"?(o.preventDefault(),this.apply(this.input.value)):o.key==="Escape"&&(o.preventDefault(),this.close()))}),this.onDocDown=o=>{this.mode==="edit"&&!this.dom.contains(o.target)&&this.close(!1)},this.doc.addEventListener("mousedown",this.onDocDown,!0)}openEdit(){let n=this.view.state,t=n.selection;if(!(t instanceof J)||!t.$from.sameParent(t.$to)||!t.$from.parent.inlineContent||t.$from.parent.type.spec.code)return!1;let o=t.empty?$t(n.doc,t.head):null;return this.range=o??{from:t.from,to:t.to,href:t.empty?null:_n(n,t.from,t.to)},this.mode="edit",this.view.dispatch(n.tr.setMeta(B,{from:this.range.from,to:this.range.to})),this.render(),this.input.value=this.range.href??"",this.input.removeAttribute("aria-invalid"),this.input.focus(),this.input.select(),!0}apply(n){let t=String(n).trim(),o=t?L(t):null;if(t&&!o){this.input.setAttribute("aria-invalid","true");return}let r=this.view.state,s=B.getState(r)??(this.mode==="view"?this.range:null);if(!s)return this.close();let a;if(s.from===s.to){if(!o)return this.close();a=r.tr.insert(s.from,T.text(t,[U.create({href:o})])),a.setSelection(J.create(a.doc,s.from+t.length))}else a=me(r,s.from,s.to,o),a.setSelection(J.create(a.doc,s.to));this.view.dispatch(H(a).setMeta(B,null)),this.close()}close(n=!0){this.mode=null,this.range=null,B.getState(this.view.state)&&this.view.dispatch(this.view.state.tr.setMeta(B,null)),this.dom.hidden=!0,this.dom.dataset.mode="",n&&this.view.focus(),this.update(this.view)}render(){let n=this.mode==="edit",t=L(this.range?.href);this.dom.dataset.mode=this.mode??"",this.input.hidden=!n,this.url.hidden=n,this.edit.hidden=n,this.open.hidden=!t,this.remove.hidden=!this.range?.href,t?(this.open.href=t,this.url.href=t,this.url.textContent=t.replace(/^https?:\/\//,"")):(this.open.removeAttribute("href"),this.url.removeAttribute("href"),this.url.textContent=""),this.dom.hidden=!1,this.place()}place(){let n=this.range;if(!n)return;let t=this.shell.getBoundingClientRect(),o=this.view.coordsAtPos(n.from),r=this.view.coordsAtPos(n.to,-1);this.dom.style.setProperty("--page-pop-x",`${Math.min(o.left,r.left)-t.left}px`),this.dom.style.setProperty("--page-pop-y",`${Math.max(o.bottom,r.bottom)-t.top+6}px`)}update(n){if(this.view=n,this.mode==="edit"){let r=B.getState(n.state);if(r)return this.range={...this.range,...r},this.place();this.mode=null,this.range=null,this.dom.hidden=!0,this.dom.dataset.mode="";return}let t=n.state.selection,o=t instanceof J&&t.empty&&n.hasFocus()?$t(n.state.doc,t.head):null;if(!o||t.head===o.from||t.head===o.to){this.mode=null,this.range=null,this.dom.hidden=!0,this.dom.dataset.mode="";return}this.mode="view",this.range=o,this.render()}destroy(){this.doc.removeEventListener("mousedown",this.onDocDown,!0),this.dom.remove(),Lt.delete(this.view)}},Kn=e=>Lt.get(e)?.openEdit()??!1;function Hn(e,n){if(n.clipboardData?.files?.length)return!1;let t=n.clipboardData?.getData("text/plain")??"";if(!Vn(t))return!1;let o=e.state.selection;if(!(o instanceof J)||!o.$from.sameParent(o.$to)||o.$from.parent.type.spec.code)return!1;let r=L(t),s=o.empty?e.state.tr.replaceSelectionWith(T.text(t.trim(),[U.create({href:r})]),!1):me(e.state,o.from,o.to,r);return e.dispatch(s.scrollIntoView().setMeta("uiEvent","paste")),!0}function Eo(){return new Ln({key:B,state:{init:()=>null,apply(e,n){let t=e.getMeta(B);if(t!==void 0)return t;if(!n||!e.docChanged)return n;let o=e.mapping.mapResult(n.from,1),r=e.mapping.mapResult(n.to,n.from===n.to?1:-1);return o.deletedAcross||r.deletedAcross||n.from!==n.to&&o.pos>=r.pos?null:{from:o.pos,to:r.pos}}},view:e=>new Bt(e),props:{decorations(e){let n=B.getState(e);return n&&n.from<n.to?zn.create(e.doc,[Pn.inline(n.from,n.to,{class:"page-link-pending"})]):null},handleKeyDown(e,n){return(n.metaKey||n.ctrlKey)&&!n.altKey&&!n.shiftKey&&n.key.toLowerCase()==="k"?(n.preventDefault(),Kn(e)||!0):!1},handlePaste:Hn,handleClick(e,n,t){if(!(t.metaKey||t.ctrlKey))return!1;let o=$t(e.state.doc,n),r=L(o?.href);return r?(e.dom.ownerDocument.defaultView.open(r,"_blank","noopener,noreferrer"),!0):!1}}})}export{Kn as a,Eo as b,io as c,Ct as d,de as e,Et as f,q as g,y as h,Jn as i,xe as j,Zn as k,z as l,Ae as m,Se as n,x as o,G as p,re as q,Zt as r,Ee as s,Me as t,vt as u,to as v,eo as w,an as x,hn as y,no as z,oo as A,H as B,Y as C,Sn as D,it as E,vn as F,In as G,ko as H};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as A,e as I}from"./c-
|
|
1
|
+
import{d as A,e as I}from"./c-XGH4GS2T.js";import{f as b,j as T}from"./c-3O7OBDCM.js";import{c as M}from"./c-BPF2NSPV.js";var B=15e3,P=12e4,K=15e3,V=4e3,W=5e3,U=50,y=new Set(["sent","acked"]),R=new Set(["done","error","cancelled"]),j="wire",i=new Map,k=new Set,f=null,g=null,D=0,h=null;function Q(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`page-${Date.now()}-${Math.random().toString(16).slice(2)}`}function H(e){return new URL(e,window.location.origin).href}function N(){let e=M();return typeof e=="string"&&e!==""?e:null}function w(e){return{id:e.id,type:e.type,state:e.state,helper:e.helper,text:e.text,result:e.result,error:e.error,errorCode:e.errorCode,errorDetails:e.errorDetails,errorSource:e.errorSource,startedAt:e.startedAt}}function m(e,t){let n=w(e);for(let r of k)try{r(n,t||null)}catch(s){console.error("clay.wire: a listener threw",s)}document.dispatchEvent(new CustomEvent("clay:wire-state",{detail:n}))}function Y(e,t){e.state!==t&&(e.state=t,m(e))}function v(e,t,n,{cancelFirst:r=!1,errorCode:s=null}={}){clearTimeout(e.timer),e.timer=setTimeout(()=>{e.timer=null,r&&z(e),l(e,"error",n,{errorCode:s,errorSource:"client"})},t)}function q(e){clearTimeout(e.timer),e.timer=null}function Z(){if(!(i.size<=U))for(let[e,t]of i){if(i.size<=U)break;!y.has(t.state)&&t.state!=="landing"&&i.delete(e)}}function ee(){if(g)return g;let e=N(),t=`/_/wire/subscribe?page-url=${encodeURIComponent(window.location.href)}`+(e?`&token=${encodeURIComponent(e)}`:"");return f=new EventSource(H(t)),f.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}te(r)},f.onerror=()=>{},g=new Promise(n=>{let r=!1,s=()=>{r||(r=!0,n())};f.onopen=s,setTimeout(s,2e3)}),g}function L(){for(let e of i.values())if(y.has(e.state))return;f&&(f.close(),f=null,g=null)}function te(e){if(!e||typeof e.id!="string")return;let t=i.get(e.id);if(!(!t||!y.has(t.state)))switch(e.type){case"wire/ack":e.payload?.mode==="jsonl"&&Number.isFinite(e.payload.budgetMs)&&e.payload.budgetMs>0?(t.structured=!0,v(t,e.payload.budgetMs+K,"the helper did not finish within its execution budget",{cancelFirst:!0,errorCode:"helper_timeout"})):v(t,P,"the agent stopped responding"),Y(t,"acked");break;case"wire/status":t.structured||v(t,P,"the agent stopped responding"),t.text=typeof e.text=="string"?e.text:"",t.state="acked",ne(t,e),m(t,e);break;case"wire/done":t.result=Object.prototype.hasOwnProperty.call(e,"payload")?e.payload:null,t.document==="edit"?ae(t):l(t,"done",null);break;case"wire/error":re(t,e);break;default:break}}function ne(e,t){if(!e.onStatus||typeof t.text!="string")return;let n={text:t.text};t.payload&&typeof t.payload=="object"&&Object.prototype.hasOwnProperty.call(t.payload,"progress")&&(n.progress=t.payload.progress);try{e.onStatus(n)}catch(r){console.error("clay.wire: an onStatus listener threw",r)}}function re(e,t){let n=t.payload,r=n&&typeof n=="object"&&!Array.isArray(n)&&(n.source==="application"||n.source==="host")&&typeof n.code=="string"&&n.code,s=typeof t.text=="string"&&t.text?t.text:"the handler reported an error";if(!r){l(e,"error",s);return}let a=n.source==="host"&&n.code==="helper_cancelled"?"cancelled":"error";l(e,a,s,{errorCode:n.code,errorDetails:Object.prototype.hasOwnProperty.call(n,"details")?n.details:null,errorSource:n.source})}function oe(){h||(h=e=>{if(e.detail?.source!=="peer"){for(let t of i.values())if(t.state==="landing"){l(t,"done",null);return}}},document.addEventListener("clay:sync-applied",h))}function se(){D>0||!h||(document.removeEventListener("clay:sync-applied",h),h=null)}function ae(e){R.has(e.state)||e.state==="landing"||(q(e),e.state="landing",D++,oe(),e.landingTimer=setTimeout(()=>{l(e,"done",null)},V),m(e),L())}function l(e,t,n,r={}){if(R.has(e.state))return;let s=e.state==="landing";if(q(e),clearTimeout(e.landingTimer),e.landingTimer=null,e.abort?.abort(),s&&(D--,se()),e.error=n,Object.prototype.hasOwnProperty.call(r,"errorCode")&&(e.errorCode=r.errorCode),Object.prototype.hasOwnProperty.call(r,"errorDetails")&&(e.errorDetails=r.errorDetails),Object.prototype.hasOwnProperty.call(r,"errorSource")&&(e.errorSource=r.errorSource),e.state=t,e.signal&&e.signalHandler&&(e.signal.removeEventListener("abort",e.signalHandler),e.signalHandler=null),ue(e),m(e),L(),Z(),e.settle){let a=e.settle;e.settle=null,a(w(e))}}var C=0,$=null,E=null;function ie(){return E||(E=import("./core/save-LYY7K6U7.js")),E}async function le(e){if(!b||e.holdsSave)return;let t=await ie();e.state==="sent"&&($=t,e.holdsSave=!0,!(C++>0)&&t.suspendAutosave())}function ue(e){e.holdsSave&&(e.holdsSave=!1,!(--C>0)&&(C=0,$?.resumeAutosave()))}var c=null,de=()=>!c||c.admitted,ce=(e,t,n)=>Object.assign(new Error(`clay.wire: ${e}`),{code:t,pending:n});function O(e){return e.document!=="edit"||e.generation===T().generation&&de()?!0:(l(e,"error","the page changed mode before this request went out",{errorCode:"stale-document",errorSource:"client"}),!1)}function _e(){return{id:"clay:wire",order:900,prepare(e={}){let t={admitted:e.initial===!0};return c=t,{enable(){c===t&&(t.admitted=!0)},quiesce(){if(c!==t)return;t.admitted=!1;let n=[...i.values()].filter(r=>r.document==="edit"&&(r.holdsSave||y.has(r.state))).map(r=>r.id);if(n.length)throw ce("a request on this page has not settled","pending-input",n)},resume(){c===t&&(t.admitted=!0)},dispose(){c===t&&(c=null)}}}}}function fe(e,t){return new Promise(n=>{let r=!1,s=()=>{r||(r=!0,document.removeEventListener(e,s),n())};document.addEventListener(e,s),setTimeout(s,t)})}async function pe(){if(!b)return;let e=window.clay;if(!e||typeof e.save!="function")return;let{isSaveInProgress:t}=await import("./core/save-core-MKRPSEEO.js"),{savesHeld:n,saveHoldReason:r}=await import("./core/save-LYY7K6U7.js");if(n())throw new Error(r());let s=Date.now()+W;for(let a=0;a<3;a++){t()&&await fe("clay:save-saved",Math.max(0,s-Date.now()));let u=await e.save();if(u?.ok||u?.msgType==="skipped"&&!t())return;if(u?.msgType==="error"||u?.msgType==="unknown")throw new Error(`could not save this page first: ${u.msg||u.msgType}`);if(Date.now()>=s)break}throw new Error("could not save this page before sending")}async function F(e,t){let n={"Content-Type":"application/json","Page-URL":window.location.href},r=N();r&&(n["Save-Token"]=r);let s=await fetch(H("/_/wire/send"),{method:"POST",headers:n,body:JSON.stringify(e),signal:t}),a=null;try{a=await s.json()}catch{a=null}return{ok:s.ok,status:s.status,reply:a}}function he(e,t={}){let n=typeof t.id=="string"&&t.id?t.id:Q(),r=typeof t.type=="string"&&t.type?t.type:"wire/request",s=Object.prototype.hasOwnProperty.call(t,"helper"),a=s&&typeof t.helper=="string"&&t.helper?t.helper:null,u=t.document===void 0?a?"none":"edit":t.document;if(s&&!a)return _(n,r,null,"helper must be a nonempty string","invalid_helper");if(u!=="edit"&&u!=="none")return _(n,r,a,'document must be "edit" or "none"',"invalid_document");if(i.has(n))return _(n,r,a,"a request with this id is already on the wire","duplicate_request");let o={id:n,type:r,state:"sent",helper:a,document:u,structured:!1,onStatus:typeof t.onStatus=="function"?t.onStatus:null,text:"",result:null,error:null,errorCode:null,errorDetails:null,errorSource:null,startedAt:Date.now(),timer:null,landingTimer:null,abort:typeof AbortController=="function"?new AbortController:null,holdsSave:!1,generation:T().generation,settle:null,signal:t.signal&&typeof t.signal.addEventListener=="function"?t.signal:null,signalHandler:null};return o.done=new Promise(d=>{o.settle=d}),i.set(n,o),m(o),o.signal&&(o.signalHandler=()=>x(n),o.signal.addEventListener("abort",o.signalHandler,{once:!0}),o.signal.aborted&&o.signalHandler()),(async()=>{if(o.state!=="sent")return;if(o.helper){let X=await I(j);if(o.state!=="sent")return;if(!X){l(o,"error","this host does not support named wire helpers",{errorCode:"helper_protocol_unsupported",errorSource:"client"});return}}if(!O(o)||o.document==="edit"&&(await le(o),o.state!=="sent"||!O(o)||(await pe(),o.state!=="sent")||!O(o)))return;if(await ee(),o.state!=="sent"){L();return}v(o,B,"the agent never answered",o.helper?{cancelFirst:!0,errorCode:"ack_timeout"}:void 0);let d={type:o.type,id:o.id,text:t.text,payload:e};o.helper&&(d.helper=o.helper),(o.helper||t.document!==void 0)&&(d.document=o.document);let{ok:G,status:J,reply:S}=await F(d,o.abort?.signal);if(o.state!=="sent")return;if(!G){l(o,"error",`the wire refused this request (${J})`);return}let p=S&&S.refused;if(p&&typeof p.code=="string"&&p.code){l(o,"error",p.message||"the handler refused this request",{errorCode:p.code,errorSource:p.source==="application"?"application":"host",errorDetails:null});return}(!S||S.delivered===0)&&l(o,"error","no agent is attached to this file")})().catch(d=>{l(o,"error",d&&d.message?d.message:String(d))}),{id:n,get state(){return o.state},done:o.done,cancel:()=>x(n)}}function _(e,t,n,r,s){let a={id:e,type:t,state:"error",helper:n,text:"",result:null,error:r,errorCode:s,errorDetails:null,errorSource:"client",startedAt:Date.now()};return{id:e,get state(){return a.state},done:Promise.resolve(w(a)),cancel:()=>!1}}function x(e){let t=i.get(e);return!t||!y.has(t.state)?!1:(z(t),l(t,"cancelled",null),!0)}function z(e){F({type:"wire/cancel",id:e.id}).catch(()=>{})}function ye(e){let t=i.get(e);return t?w(t):void 0}function ge(){return[...i.values()].map(w)}function we(){for(let e of i.values())if(y.has(e.state))return!0;return!1}function me(e){return typeof e!="function"?()=>{}:(k.add(e),()=>k.delete(e))}async function Se(){let e=await A({fresh:!0});if(!e.extensions.includes(j))return[];let t=e.document?.helpers;return Array.isArray(t)?t.filter(n=>n&&typeof n.name=="string"&&["ready","denied","unavailable"].includes(n.state)).map(({name:n,state:r})=>({name:n,state:r})):[]}var ve={send:he,cancel:x,get:ye,list:ge,isBusy:we,on:me,helpers:Se},ke=ve;export{_e as a,ve as b,ke as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(t=document){let e=t.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=[];function l(e){n.push(e)}function r(e,c,o=null){for(let p of n)try{p(e,o?{captureId:c??null,artifact:o}:{captureId:c??null})}catch(t){console.error("clayjs: onSaveAccepted hook failed:",t)}}export{l as a,r as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./c-VHNSBD2M.js";var b={standard:[.33,0,.67,1],out:[.17,.17,.4,1],snap:[.87,0,.38,1],in:[.69,0,.83,.83],pop:[.27,0,.73,1],settle:[.17,0,.83,1],linear:[0,0,1,1]},p={rise:{distance:14,duration:270,stagger:125,fade:.2,fadeDuration:210,ease:"standard"},cascade:{dx:27,dy:43,duration:460,stagger:167,fade:.7,fadeDuration:290,ease:"out"},pop:{from:.9,duration:210,ease:"pop",overshoot:!1,peak:1.07,up:275,down:210,fade:0,fadeDuration:100},exit:{distance:57,duration:330,opacity:0,ease:"standard"},slideOff:{dx:150,dy:0,duration:460,stagger:0,ease:"in"},hover:{scale:1.03,lift:4,rotate:1,duration:250,hold:0,back:290,ease:"standard"},press:{scale:1.08,up:125,down:125},click:{settle:160,cursorScale:1.18,up:125,down:167,targetScale:1.08,press:!0},move:{ease:"standard",arc:.12,offset:[.5,.5]},ripple:{from:[.94,.68],duration:500,fade:.3,fadeAt:290,fadeDuration:210,ease:"out"},flip:{deg:180,duration:125,ease:"standard"},grow:{from:0,duration:600,ease:"out",axis:"x",stagger:0},zoom:{scale:1.28,focus:[.5,.5],duration:700,ease:"snap"},zoomOut:{duration:420,ease:"settle"},reset:{duration:420,ease:"standard"}},I={translate:[0,0],scale:[1,1],rotate:[0],opacity:[1]},v=o=>Math.round(o*1e3)/1e3,q={translate:o=>`${v(o[0])}px ${v(o[1])}px`,scale:o=>`${v(o[0])} ${v(o[1])}`,rotate:o=>`${v(o[0])}deg`,opacity:o=>`${v(o[0])}`},F='<svg viewBox="136 60 330 400" width="20" height="24" aria-hidden="true"><path d="M142 118C142 84 180 58 214 84L440 268C472 294 455 338 418 338L335 338C310 338 290 348 274 368L226 432C202 462 158 448 156 412Z" fill="currentColor"/></svg>';function z(o){let s=typeof o=="string"?b[o]:o;if(!Array.isArray(s)||s.length!==4)throw new Error(`uimotion: unknown ease "${o}"`);return s}function B(o){return o[0]===0&&o[1]===0&&o[2]===1&&o[3]===1?"linear":`cubic-bezier(${o.join(", ")})`}function P([o,s,r,t],e){if(e<=0)return 0;if(e>=1)return 1;let n=(u,h,l)=>3*u*l*(1-l)**2+3*h*l*l*(1-l)+l**3,i=0,c=1,a=e;for(let u=0;u<40;u++){let h=n(o,r,a);if(Math.abs(h-e)<1e-6)break;h<e?i=a:c=a,a=(i+c)/2}return n(s,t,a)}function A(o,s){if(Array.isArray(s))return s;if(o==="scale")return[s,s];if(o==="translate")throw new Error("uimotion: translate takes [x, y]");return[s]}var M=(o,s)=>o.every((r,t)=>Math.abs(r-s[t])<1e-9),N=(o,s,r)=>o.map((t,e)=>t+(s[e]-t)*r),V=(o,s,r,t)=>o.map((e,n)=>(1-t)**2*e+2*t*(1-t)*s[n]+t*t*r[n]),D=24,j=1e-6;function $(o){if(o[0].t>0)return o[0].v;let s=0;for(;s<o.length-1&&o[s+1].t===o[0].t;)s++;return o[s].v}function E(o,s=[]){if(!o.length)return[];let r=Math.min(...o.map(a=>a.start)),t=[...o,...s.filter(a=>a.start>=r).map(a=>({...a,toInitial:!0}))].sort((a,u)=>a.start-u.start),e=[],n=I[o[0].prop],i=-1/0,c=null;for(let a of t){if(a.start<i-j)throw new Error(`uimotion: two ${o[0].prop} tweens overlap on the same element at ${Math.round(a.start)} ms (the earlier one ends at ${Math.round(i)} ms, from ${c.source??"a step"})`);let u=Math.max(a.start,i),h=a.from??n,l=a.toInitial?$(e):a.to??h,d=e[e.length-1];e.length&&!M(h,n)&&e.push({t:u,v:n,ease:b.linear}),d&&d.t===u&&M(d.v,h)||e.push({t:u,v:h,ease:b.linear});let m=e[e.length-1];if(a.path)for(let f=1;f<=D;f++){let w=f/D;e.push({t:u+a.dur*w,v:a.path(P(a.ease,w)),ease:b.linear})}else m.ease=a.ease,e.push({t:u+a.dur,v:l,ease:b.linear});n=e[e.length-1].v,i=u+a.dur,c=a}return e}function L(o,s,r){if(!o.length)return I[r];if(s<o[0].t)return o[0].v;let t=0;for(;t<o.length-1&&o[t+1].t<=s;)t++;let e=o[t],n=o[t+1];return n?N(e.v,n.v,P(e.ease,(s-e.t)/(n.t-e.t))):e.v}function W(o,s,r){let t=o.map(e=>({offset:Math.min(1,Math.max(0,e.t/r)),[s]:q[s](e.v),easing:B(e.ease)}));return t[0].offset>0&&t.unshift({...t[0],offset:0,easing:"linear"}),t[t.length-1].offset<1&&t.push({...t[t.length-1],offset:1,easing:"linear"}),t}function H(o,s){return new S(o,s)}var S=class{constructor(s,{loop:r=!0,cursor:t,still:e}={}){if(this.stage=typeof s=="string"?document.querySelector(s):s,!this.stage)throw new Error(`uimotion: no stage "${s}"`);this.loop=r,this.cursorStart=t,this.stillAt=e,this.tweens=[],this.resets=[],this.t=0,this.last={start:0,end:0},this.mode=null,this.rects=new Map,this.animations=null,this.playing=!1,this.rate=1;let n=this.stage.ownerDocument?.defaultView;n&&n.getComputedStyle(this.stage).position==="static"&&(this.stage.style.position="relative")}get duration(){return Math.max(this.t,1)}els(s){if(typeof s=="string"){let r=[...this.stage.querySelectorAll(s)];if(!r.length)throw new Error(`uimotion: nothing matches "${s}"`);return r}return Array.isArray(s)?s:s&&typeof s.length=="number"&&!s.nodeType?[...s]:[s]}el(s){return this.els(s)[0]}nextStart(){return this.mode?.with!=null?this.last.start+this.mode.with:this.mode?.at??this.t}step(s,r){let t=this.animations?{time:this.time,playing:this.playing}:null;this.animations?.forEach(c=>c.cancel()),this.animations=null;let e=this.nextStart();this.mode=null,this.source=`${s} at ${Math.round(e)} ms`;let n=this.tweens.length,i=e+r(e);for(let c of this.tweens.slice(n))i=Math.max(i,c.start+c.dur);return this.last={start:e,end:i},this.t=Math.max(this.t,i),t&&(this.seek(t.time),t.playing&&this.play()),this}add(s,r,t,e,n,{from:i,ease:c="standard",path:a}={}){this.tweens.push({el:s,prop:r,start:t,dur:e,from:i==null?void 0:A(r,i),to:n==null?void 0:A(r,n),ease:z(c),path:a,source:this.source})}current(s,r,t){let e=E(this.tweens.filter(n=>n.el===s&&n.prop===r),this.resets);return L(e,t,r)}rect(s){if(!this.rects.has(s)){let r=this.stage.getBoundingClientRect(),t=s.getBoundingClientRect(),e=this.stageScale(),n=(t.left-r.left)/e-(this.stage.clientLeft||0),i=(t.top-r.top)/e-(this.stage.clientTop||0),c=t.width/e,a=t.height/e,u=this.stage.ownerDocument?.defaultView?.getComputedStyle(s).transformOrigin,[h,l]=(u??"").split(" ").map(parseFloat);this.rects.set(s,{x:n,y:i,w:c,h:a,origin:[n+(Number.isFinite(h)?h:c/2),i+(Number.isFinite(l)?l:a/2)]})}return this.rects.get(s)}stageScale(){let s=this.stage.getBoundingClientRect().width;return this.stage.offsetWidth?s/this.stage.offsetWidth:1}stageSize(){let s=this.stage.getBoundingClientRect(),r=this.stageScale();return[s.width/r,s.height/r]}chain(s,r=this.stage){let t=[];for(let e=s;e&&e!==r&&e!==this.stage;e=e.parentElement)this.tweens.some(n=>n.el===e)&&t.push(e);return t}transformAt(s,r){return{o:this.rect(s).origin,s:this.current(s,"scale",r),r:this.current(s,"rotate",r)[0]*Math.PI/180,d:this.current(s,"translate",r)}}transformPoint(s,r,t){let{o:e,s:n,r:i,d:c}=this.transformAt(s,t),a=(r[0]-e[0])*n[0],u=(r[1]-e[1])*n[1];return[e[0]+a*Math.cos(i)-u*Math.sin(i)+c[0],e[1]+a*Math.sin(i)+u*Math.cos(i)+c[1]]}untransformPoint(s,r,t){let{o:e,s:n,r:i,d:c}=this.transformAt(s,t),a=r[0]-e[0]-c[0],u=r[1]-e[1]-c[1];return[e[0]+(a*Math.cos(i)+u*Math.sin(i))/n[0],e[1]+(-a*Math.sin(i)+u*Math.cos(i))/n[1]]}pointAt(s,r,[t,e]=[.5,.5],n=this.stage){let i=this.rect(s),c=[i.x+i.w*t,i.y+i.h*e];for(let a of this.chain(s,n))c=this.transformPoint(a,c,r);return c}cursorEl(){if(this.cursor)return this.cursor;let r=this.stage.ownerDocument.createElement("div");r.className="uimotion-cursor",r.setAttribute("aria-hidden","true"),r.setAttribute("clay","editor-ui"),r.innerHTML=F,Object.assign(r.style,{position:"absolute",left:"-1px",top:"-2px",width:"20px",height:"24px",pointerEvents:"none",zIndex:"10",transformOrigin:"1px 2px"}),this.stage.append(r),this.cursor=r;let[t,e]=this.stageSize(),n=this.cursorStart??[t*.7,e*.85];return this.tweens.push({el:r,prop:"translate",start:0,dur:0,to:n,from:n,ease:b.linear,source:"cursor start"}),r}with(s=0){return this.mode={with:s},this}at(s){return this.mode={at:s},this}wait(s){return this.step("wait",()=>s)}set(s,r){return this.step("set",t=>{for(let e of this.els(s))for(let[n,i]of Object.entries(r))this.add(e,n,t,0,i,{ease:"linear"});return 0})}tween(s,r,t,{duration:e=300,delay:n=0,stagger:i=0,...c}={}){return this.step("tween",a=>{let u=this.els(s);return u.forEach((h,l)=>this.add(h,r,a+n+l*i,e,t,c)),n+(u.length-1)*i+e})}rise(s,r){let t={...p.rise,...r};return this.step("rise",e=>{let n=this.els(s);return n.forEach((i,c)=>{let a=e+c*t.stagger;this.add(i,"translate",a,t.duration,[0,0],{from:[0,t.distance],ease:t.ease}),this.add(i,"opacity",a,t.fadeDuration,1,{from:t.fade,ease:"linear"})}),(n.length-1)*t.stagger+t.duration})}cascade(s,r){let t={...p.cascade,...r};return this.step("cascade",e=>{let n=this.els(s);return n.forEach((i,c)=>{let a=e+c*t.stagger;this.add(i,"translate",a,t.duration,[0,0],{from:[-t.dx,-t.dy],ease:t.ease}),this.add(i,"opacity",a,t.fadeDuration,1,{from:t.fade,ease:"out"})}),(n.length-1)*t.stagger+t.duration})}pop(s,r){let t={...p.pop,...r};return this.step("pop",e=>{for(let n of this.els(s))t.fade!==!1&&this.add(n,"opacity",e,t.fadeDuration,1,{from:t.fade,ease:"linear"}),t.overshoot?(this.add(n,"scale",e,t.up,t.peak,{from:t.from,ease:"linear"}),this.add(n,"scale",e+t.up,t.down,1,{ease:"linear"})):this.add(n,"scale",e,t.duration,1,{from:t.from,ease:t.ease});return t.overshoot?t.up+t.down:t.duration})}exit(s,r){let t={...p.exit,...r};return this.step("exit",e=>{for(let n of this.els(s)){let i=this.current(n,"translate",e);this.add(n,"translate",e,t.duration,[i[0],i[1]-t.distance],{ease:t.ease}),this.add(n,"opacity",e,t.duration,t.opacity,{ease:"linear"})}return t.duration})}slideOff(s,r){let t={...p.slideOff,...r};return this.step("slideOff",e=>{let n=this.els(s);return n.forEach((i,c)=>{let a=e+c*t.stagger,u=this.current(i,"translate",a);this.add(i,"translate",a,t.duration,[u[0]+t.dx,u[1]+t.dy],{ease:t.ease}),this.add(i,"opacity",a,t.duration,0,{ease:"linear"})}),(n.length-1)*t.stagger+t.duration})}hover(s,r){let t={...p.hover,...r};return this.step("hover",e=>{for(let n of this.els(s)){let i=this.current(n,"translate",e),c=this.current(n,"scale",e),a=this.current(n,"rotate",e),u=e+t.duration+t.hold;this.add(n,"translate",e,t.duration,[i[0],i[1]-t.lift],{ease:t.ease}),this.add(n,"scale",e,t.duration,[c[0]*t.scale,c[1]*t.scale],{ease:t.ease}),this.add(n,"rotate",e,t.duration,[a[0]+t.rotate],{ease:t.ease}),this.add(n,"translate",u,t.back,i,{ease:t.ease}),this.add(n,"scale",u,t.back,c,{ease:t.ease}),this.add(n,"rotate",u,t.back,a,{ease:t.ease})}return t.duration+t.hold+t.back})}pulse(s,r,t,e,n){let i=this.current(s,"scale",r);this.add(s,"scale",r,e,[i[0]*t,i[1]*t],{ease:"linear"}),this.add(s,"scale",r+e,n,i,{ease:"linear"})}press(s,r){let t={...p.press,...r};return this.step("press",e=>{for(let n of this.els(s))this.pulse(n,e,t.scale,t.up,t.down);return t.up+t.down})}move(s,r){let t={...p.move,...r};return this.step("move",e=>{let n=this.cursorEl(),i=this.current(n,"translate",e),c=Array.isArray(s)?null:this.el(s),a=g=>c?this.pointAt(c,g,t.offset):s,u=g=>t.duration??(g<120?290:Math.min(1e3,400+g*1.2)),h=a(e),l=0;for(let g=0;g<3;g++)l=u(Math.hypot(h[0]-i[0],h[1]-i[1])),h=a(e+l);let d=Math.hypot(h[0]-i[0],h[1]-i[1]);if(d<1)return 0;let m=d<120?0:t.arc*d,f=[-(h[1]-i[1])/d,(h[0]-i[0])/d];f[1]<0&&(f=[-f[0],-f[1]]);let w=[(i[0]+h[0])/2+f[0]*m,(i[1]+h[1])/2+f[1]*m];return this.add(n,"translate",e,l,h,{ease:t.ease,path:g=>V(i,w,h,g)}),l})}click(s,r={}){let t={...p.click,...r};if(s!=null){let e=this.nextStart(),n=Array.isArray(s)?s:this.pointAt(this.el(s),e,t.offset),i=this.current(this.cursorEl(),"translate",e);Math.hypot(n[0]-i[0],n[1]-i[1])>2&&(this.move(s,{offset:t.offset,...t.move}),this.mode={at:this.last.end})}return this.step("click",e=>{let n=e+t.settle;return this.pulse(this.cursorEl(),n,t.cursorScale,t.up,t.down),s!=null&&!Array.isArray(s)&&t.press&&this.pulse(this.el(s),n,t.targetScale,t.up,t.up),t.settle+t.up+t.down})}ripple(s,r){let t={...p.ripple,...r};return this.step("ripple",e=>{for(let n of this.els(s))this.add(n,"scale",e,t.duration,1,{from:t.from,ease:t.ease}),this.add(n,"opacity",e,0,t.fade,{from:0,ease:"linear"}),this.add(n,"opacity",e+t.fadeAt,t.fadeDuration,0,{ease:"linear"});return Math.max(t.duration,t.fadeAt+t.fadeDuration)})}flip(s,r){let t={...p.flip,...r};return this.step("flip",e=>{for(let n of this.els(s)){let i=this.current(n,"rotate",e);this.add(n,"rotate",e,t.duration,[i[0]+t.deg],{ease:t.ease})}return t.duration})}grow(s,r){let t={...p.grow,...r};return this.step("grow",e=>{let n=this.els(s),i=t.axis==="x"?[t.from,1]:[1,t.from];return n.forEach((c,a)=>this.add(c,"scale",e+a*t.stagger,t.duration,[1,1],{from:i,ease:t.ease})),(n.length-1)*t.stagger+t.duration})}zoom(s,r){let t={...p.zoom,...r};return this.step("zoom",e=>{let n=this.el(s),i=e+t.duration,c=A("scale",t.scale),a=[0,0];if(t.to){let u=Array.isArray(t.to)?t.to:this.pointAt(this.el(t.to),i,[.5,.5],n),h=this.stageSize(),l=[h[0]*t.focus[0],h[1]*t.focus[1]];for(let g of this.chain(n.parentElement).reverse())l=this.untransformPoint(g,l,i);let d=this.rect(n).origin,m=this.current(n,"rotate",i)[0]*Math.PI/180,f=(u[0]-d[0])*c[0],w=(u[1]-d[1])*c[1];a=[l[0]-d[0]-(f*Math.cos(m)-w*Math.sin(m)),l[1]-d[1]-(f*Math.sin(m)+w*Math.cos(m))]}return this.add(n,"scale",e,t.duration,c,{ease:t.ease}),this.add(n,"translate",e,t.duration,a,{ease:t.ease}),t.duration})}zoomOut(s,r){let t={...p.zoomOut,...r};return this.step("zoomOut",e=>{let n=this.el(s);return this.add(n,"scale",e,t.duration,1,{ease:t.ease}),this.add(n,"translate",e,t.duration,[0,0],{ease:t.ease}),t.duration})}reset(s){let r={...p.reset,...s};return this.step("reset",t=>(this.stillAt==null&&(this.stillAt=t),this.resets.push({start:t,dur:r.duration,ease:z(r.ease),source:`reset at ${Math.round(t)} ms`}),r.duration))}build(){if(this.animations)return this.animations;let s=this.duration,r=new Map;for(let e of this.tweens){let n=r.get(e.el)??new Map;r.set(e.el,n),n.has(e.prop)||n.set(e.prop,[]),n.get(e.prop).push(e)}let t=[];try{for(let[e,n]of r)for(let[i,c]of n){let a=E(c,this.resets);if(this.loop&&this.resets.length&&!M(a[a.length-1].v,$(a))){let h=c.reduce((l,d)=>d.start>l.start?d:l);throw new Error(`uimotion: ${i} on an element still changes after the last reset() (${h.source}), so the loop jumps. Move reset() to the end, or return it to its start value.`)}let u=e.animate(W(a,i,s),{duration:s,iterations:this.loop?1/0:1,fill:"both"});u.pause(),u.playbackRate=this.rate,t.push(u)}}catch(e){throw t.forEach(n=>n.cancel()),e}return this.animations=t,this.stage.dataset&&(this.stage.dataset.uimotion="ready"),t}play(){return this.build(),this.stage.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches?this.seek(this.stillAt??(this.loop?this.duration-.01:this.duration)):(this.animations.forEach(r=>r.play()),this.playing=!0,this)}pause(){return this.build().forEach(s=>s.pause()),this.playing=!1,this}seek(s){return this.build().forEach(r=>{r.pause(),r.currentTime=s}),this.playing=!1,this}speed(s){return this.rate=s,this.build().forEach(r=>{r.playbackRate=s}),this}get time(){let s=this.build()[0]?.currentTime??0;return this.loop?s%this.duration:Math.min(s,this.duration)}debug(){let s=this.stage.ownerDocument,r=s.createElement("div");r.className="uimotion-debug",r.setAttribute("clay","editor-ui"),r.style.cssText="display:flex;gap:8px;align-items:center;margin-top:8px;font:12px/1.4 ui-monospace,monospace",r.innerHTML='<button type="button">Pause</button><input type="range" min="0" step="1" style="flex:1"><select><option>0.25</option><option>0.5</option><option selected>1</option></select><span></span>';let[t,e,n,i]=r.children;e.max=Math.round(this.duration),this.stage.after(r);let c=!0,a=h=>{i.textContent=`${Math.round(h)} / ${Math.round(this.duration)} ms`};t.onclick=()=>{c=!c,c?this.play():this.pause(),t.textContent=c?"Pause":"Play"},e.oninput=()=>{c=!1,t.textContent="Play",this.seek(+e.value),a(+e.value)},n.onchange=()=>this.speed(+n.value);let u=()=>{c&&(e.value=this.time,a(this.time)),s.defaultView.requestAnimationFrame(u)};return u(),this}};function G(o,s=[]){return o.step("rewind",r=>{let t=new Map;for(let e of o.tweens){if(e.prop==="opacity"&&s.includes(e.el))continue;let n=t.get(e.el)??new Map;t.set(e.el,n),n.has(e.prop)||n.set(e.prop,[]),n.get(e.prop).push(e)}for(let[e,n]of t)for(let[i,c]of n){let a=E(c,o.resets),u=$(a);M(L(a,r,i),u)||o.add(e,i,r,0,u,{ease:"linear"})}return 0})}function U(o,s,{watch:r=o,teardown:t,debug:e=!1}={}){let n=o.ownerDocument,i=null,c=0,a=!0,u=!1,h=!1,l=!1,d=()=>a&&n.visibilityState!=="hidden",m=()=>{i&&(d()?i.play():i.pause())},f=()=>{i&&(i.animations?.forEach(y=>y.cancel()),i.cursor?.remove(),o.nextElementSibling?.classList.contains("uimotion-debug")&&o.nextElementSibling.remove(),t?.(o),delete o.dataset.uimotion,delete o.uimotionScene,i=null,c=0)},w=()=>{l||(l=!0,f(),O.disconnect(),C?.disconnect(),n.removeEventListener("visibilitychange",m))},g=y=>{if(l)return;if(!o.isConnected)return w();let x=o.offsetWidth;if(!y&&x===c)return;let T=i?i.time:0;if(f(),!!x)try{i=s(o),c=x,o.uimotionScene=i,i.seek(T),m(),e&&i.debug()}catch(R){console.error(R),f()}},k=y=>{h=h||y,!u&&(u=!0,requestAnimationFrame(()=>{u=!1;let x=h;h=!1,g(x)}))},O=new ResizeObserver(()=>o.isConnected?k(!1):w());O.observe(r);let C=typeof IntersectionObserver=="function"?new IntersectionObserver(y=>{a=y[y.length-1].isIntersecting,m()}):null;return C?.observe(o),n.addEventListener("visibilitychange",m),n.fonts&&n.fonts.status!=="loaded"&&n.fonts.ready.then(()=>k(!0)),g(!1),{stop:w,get scene(){return i}}}export{b as ease,U as mount,G as rewind,H as scene};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./c-LKSL4AUJ.js";import{b as s,d as c,f as p,h as l}from"./c-EK63G3CG.js";import{f as i}from"./c-XGH4GS2T.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-HA6INT6J.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var u="page-format-activation-failed";function d(){let e=document.querySelector(`meta[name="${s}"]`);return e?p(e.outerHTML):0}var F=async e=>(await import("./core/save-LYY7K6U7.js")).savePageForce(()=>{},e),P=4,g=1e4,f=e=>e?.ok===!1&&e?.msgType==="skipped"&&/in progress/i.test(e?.msg??""),w=async()=>{let{isSaveInProgress:e}=await import("./core/save-core-MKRPSEEO.js"),r=Date.now()+g;for(;e()&&Date.now()<r;)await new Promise(n=>setTimeout(n,50))};function v({save:e=F,settles:r=w,supported:n=()=>i().then(a=>a===1)}={}){return{read(){return{floor:Math.max(l(),d()),revision:null}},capabilities(){return[]},supported:n,async activate({floor:a=1}={}){let t;try{t=await e({pageFormatFloor:a});for(let o=1;o<P&&f(t);o+=1)await r(),t=await e({pageFormatFloor:a})}catch(o){return{accepted:!1,code:o?.code??u}}return t?.ok?{accepted:!0,revision:null,receipt:t.receipt??t.etag??null}:t?.code===c?{accepted:!1,code:c}:{accepted:!1,code:t?.code??u}}}}export{v as createFormatHost};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{b as U}from"./c-ATKAOH23.js";import{a as oe,g as ie,h as C}from"./c-EK63G3CG.js";import{a as ne,b as re,c as M}from"./c-NQJRVJ56.js";import{d as w}from"./c-XGH4GS2T.js";import{c as V,e as q,g as Z}from"./c-IJUK2GPW.js";import{b as R,f as N}from"./c-3O7OBDCM.js";import{c as X}from"./c-BPF2NSPV.js";import{g as Y}from"./c-N7JPUPGC.js";import{a as k,g as Q,h as ee,i as te}from"./c-7MG5RU63.js";var D=null,ae=null,A=null;function we(e){let t=e?.document?.maxBytes;return Number.isSafeInteger(t)&&t>0?t:null}function se(e){return D=we(e),ae=e?.document?.maxBytesMeasures==="file"?"file":null,D}var Ae=/<script\b[^>]*\bmerge=(["'])page\1[^>]*>[\s\S]*?<\/script\s*>/i;function F(e,t=ae){if(t!=="file"||typeof e!="string")return e;let n=Ae.exec(e);if(!n)return e;let o=n.index,s=o+n[0].length,r=e.lastIndexOf(`
|
|
2
|
+
`,o-1)+1,l=e.indexOf(`
|
|
3
|
+
`,s),c=l===-1?e.length:l+1;return!/\S/.test(e.slice(r,o))&&!/\S/.test(e.slice(s,c))&&(o=r,s=c),e.slice(0,o)+e.slice(s)}function B(e,t){let n=new TextEncoder().encode(e).byteLength,o=Number.isSafeInteger(t)&&t>0;return{bytes:n,maxBytes:o?t:null,state:o?n>t?"over":n>=Math.ceil(t*.8)?"near":"ok":"unknown"}}function le(){return D}function P({fresh:e=!1}={}){return e?(A=w({fresh:!0}).then(se),A):(A||(A=w().then(se)),A)}function vt({fresh:e=!1}={}){return P({fresh:e}).then(t=>({maxBytes:t}))}async function yt(e){let t=await P();return B(F(e),t)}function ue(e){let t=new CustomEvent("clay:save-size",{detail:e});document.dispatchEvent(t),(e.state==="near"||e.state==="over")&&import("./c-HT2DKBV2.js").then(n=>n.start(t),()=>{})}var L="/_/clayjs/",Te=/[\u0000-\u001F\u007F]/,be=/^[\t\n\f\r ]|[\t\n\f\r ]$/,Oe=/^https:\/\/clayjs\.com\/v(\d+)\/([\s\S]*)$/,Ee=/^https:\/\/clayjs\.com\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,ce=/^\/_\/clayjs\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,$e=/%2e|%2f|%5c/i;function Re(e){if(typeof e!="string")return null;let t=/^(\d+)\.\d+\.\d+$/.exec(e);return t?t[1]:null}function ke(e){if(typeof e!="string"||e==="")return null;try{return new URL(e).origin}catch{return null}}function Me(e){let t=e.indexOf("#"),n=t<0?"":e.slice(t),o=t<0?e:e.slice(0,t),s=o.indexOf("?"),r=s<0?"":o.slice(s);return{head:s<0?o:o.slice(0,s),search:r,hash:n}}function Pe(e){if(e===""||e.includes("\\")||$e.test(e))return null;let t=e.split("/"),n=[];for(let o of t){if(o===""||o==="."||o==="..")return null;let s;try{s=decodeURIComponent(o)}catch{return null}if(s.includes("/")||s.includes("\\")||s==="."||s==="..")return null;n.push(s)}return n.join("/")}function T(e,{documentURL:t}={}){if(typeof e!="string"||e===""||be.test(e)||Te.test(e))return null;let{head:n,search:o,hash:s}=Me(e),r=null,l=null,c=null,u=null,i=Oe.exec(n);if(i&&(r="rolling",c=i[1],u=i[2]),r||(i=Ee.exec(n),i&&(r="exact",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4])),r||(i=ce.exec(n),i&&(r="local",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4])),!r){let d=ke(t);d&&n.startsWith(`${d}/`)&&(i=ce.exec(n.slice(d.length)),i&&(r="local",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4]))}if(!r)return null;let a=Pe(u);return a===null?null:{kind:r,major:c,version:l,rawPath:u,path:a,search:o,hash:s}}function Le(e,t){let n=e&&typeof e=="object"?e[t]:null;return n&&typeof n.files=="object"&&n.files?n.files:null}function je(e){return!e||typeof e!="object"?[]:Array.isArray(e.entries)?e.entries.filter(t=>t&&typeof t=="object"):[]}function Ie(e,t,n){if(!n)return!0;let o=Le(n,t);return!!(o&&Object.hasOwn(o,e.path))}function fe(e,{descriptor:t,releases:n,documentURL:o,aliases:s}={}){let r=T(e,{documentURL:o});if(!r||r.kind!=="local")return e;let l=je(t),c=Re(r.version);for(let u of l){if(u.local!==e||typeof u.original!="string")continue;let i=n?.[r.version]?.aliases??s;if(i&&typeof i=="object"&&!r.search&&!r.hash&&Object.hasOwn(i,u.original)&&i[u.original]===r.path)return u.original;let a=T(u.original);if(a&&!(a.kind!=="rolling"&&a.kind!=="exact")&&a.rawPath===r.rawPath&&a.search===r.search&&a.hash===r.hash&&!(a.kind==="rolling"?a.major!==c:a.version!==r.version)&&Ie(r,r.version,n))return a.kind==="exact"?u.original:`https://clayjs.com/v${a.major}/${r.rawPath}${r.search}${r.hash}`}for(let u of l){if(typeof u.original!="string")continue;let i=T(u.original);if(i&&!(i.kind!=="rolling"&&i.kind!=="exact")&&i.rawPath===r.rawPath&&!(i.kind==="rolling"?i.major!==c:i.version!==r.version))return i.kind==="rolling"?`https://clayjs.com/v${i.major}/${r.rawPath}${r.search}${r.hash}`:`https://clayjs.com/${i.version}/${r.rawPath}${r.search}${r.hash}`}return`https://clayjs.com/${r.version}/${r.rawPath}${r.search}${r.hash}`}var _e=Object.freeze({"https://cdn.jsdelivr.net/npm/overtype@2.6.1/dist/overtype.min.js":"compat/overtype-2.6.1.min.js","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js":"compat/highlight-11.9.0.min.js","https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500&family=IBM+Plex+Sans:wght@400;500;600&display=swap":"fonts/ibm-plex.css"}),J="clay-runtime-map",Ne=new Set(["stylesheet","preload","modulepreload"]),de=null,H=null;function Ue(e){let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||t.schema!==1?null:t}function Ce(){if(typeof document>"u")return null;let e=document.getElementById(J);if(!e)return null;let t=e.textContent??"";return t===de||(de=t,H=Ue(t)),H}var De=`script[src*="${L}"], link[href*="${L}"], #${J}`;function he(e){if(e.querySelector(De))return!0;for(let t of e.querySelectorAll("template"))if(he(t.content))return!0;return!1}function Fe(e){let t=[],n=[e];for(;n.length;){let o=n.pop();for(let s of o.children??[])t.push(s),n.push(s),s.content&&n.push(s.content)}return t}function Be(e){return e.tagName==="SCRIPT"&&e.hasAttribute("src")?"src":e.tagName!=="LINK"||!e.hasAttribute("href")?null:(e.getAttribute("rel")??"").toLowerCase().split(/\s+/).some(n=>Ne.has(n))?"href":null}function He(e){if(!e||!he(e))return;let t=[],n=!1;for(let r of Fe(e)){if(r.getAttribute("id")===J){r.remove();continue}let l=Be(r);l&&(t.push({element:r,name:l}),!n&&(r.getAttribute(l)??"").includes(L)&&(n=!0))}if(!n)return;let o=location.href,s=Ce();for(let{element:r,name:l}of t){let c=r.getAttribute(l),u=T(c,{documentURL:o});!u||u.kind!=="local"||r.setAttribute(l,fe(c,{descriptor:s,documentURL:o,aliases:_e}))}}te(He);var y=!1,E=null,pe="/_/save",ze=12e3,me=6e4,Ge=1024*1024,Se="text/plain;charset=UTF-8",j=null,$=!1,G=new Map;function Ft(e,t){t==null?G.delete(e):G.set(e,String(t))}async function Bt(e,t){$=!!e;try{return await t()}finally{$=!1}}function Ht(){return y}function Jt(){return y?null:(y=!0,E={reserved:!0},E)}function zt(e){!e||E!==e||(E=null,y=!1)}function Gt(){return $}var I=[],_=[];function Kt(e){return I.push(e),()=>{let t=I.indexOf(e);t>=0&&I.splice(t,1)}}function Wt(e){return _.push(e),()=>{let t=_.indexOf(e);t>=0&&_.splice(t,1)}}function Ke(e){for(let t of I)try{t(e)}catch(n){console.error("clayjs: onSaveAttempt hook failed:",n)}}function We(e){for(let t of _)try{t(e)}catch(n){console.error("clayjs: onSaveOutcome hook failed:",n)}}function ge(e){return{ok:!0,msg:e.msg??"Saved",msgType:e.msgType||"success",code:e.code??null,etag:e.etag??null}}var b=[],Xe=8,v=null;function Xt(){return v!==null}function ve(){let e=window.crypto?.randomUUID?.();if(e)return e;if(window.crypto?.getRandomValues){let n=new Uint8Array(16);return window.crypto.getRandomValues(n),Array.from(n,o=>o.toString(16).padStart(2,"0")).join("")}let t=()=>Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${Date.now().toString(36)}-${t()}${t()}${t()}`}function Ye(e){b.push(e),b.length>Xe&&b.shift()}function Ve(e){return typeof e=="string"&&e!==""&&b.includes(e)}function Yt(){b.length=0,v=null}function K(e){let t=e.name==="AbortError",n=!t&&e.status===412,o=!t&&!n&&e.code==="save-already-applied";return{ok:!1,msg:t?"Server not responding":e.message||"Save failed",msgType:t||o?"unknown":n?"conflict":"error",code:t?"timeout":n?"conflict":e.code??null,changedBy:n?e.changedBy??null:null,afterTimeout:n&&v!==null,conflictEtag:n?e.etag??null:null,status:Number.isInteger(e.status)?e.status:null,hadTimeout:t||e.hadTimeout===!0,reason:e.reason??null,retryAfter:e.retryAfter??null,saveOutcome:e.saveOutcome??null,etag:null}}function O(e){return{ok:!1,msg:e,msgType:"skipped",code:null,etag:null}}function qe(e){let t=new Error(`This document is ${e.bytes} bytes; this host saves at most ${e.maxBytes}`);return t.code="save-too-large",{...K(t),sent:!1,size:e}}var S=null;function Ze(e){return S?null:(S={kind:e},S)}function Qe(e){S===e&&(S=null)}function et(){return S?S.kind:null}function tt(){return{ok:!1,msg:"Invalid page conversion metadata",msgType:"error",code:"invalid-header",etag:null}}var nt=3,rt=/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), \d{2}-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2} \d{2}:\d{2}:\d{2} GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?: \d|\d{2}) \d{2}:\d{2}:\d{2} \d{4})$/;function ot(e){if(e==null)return null;let t=String(e).trim();if(!t)return null;if(/^-?\d+$/.test(t))return Math.max(0,Math.min(3600,Number(t)));if(!rt.test(t))return null;let n=Date.parse(t);return Number.isNaN(n)?null:Math.max(0,Math.min(3600,Math.round((n-Date.now())/1e3)))}var it=/^[0-9a-f]{64}$/,st=/^[A-Za-z0-9-]{1,64}$/;function at(e){if(e==null)return{header:null};if(typeof e!="object")return{invalid:!0};let{source:t,base:n,epoch:o}=e;return typeof n!="string"||!it.test(n)?{invalid:!0}:t==="file"?o!=null?{invalid:!0}:{header:`v1; source=file; base=${n}`}:t==="room"?typeof o!="string"||!st.test(o)?{invalid:!0}:{header:`v1; source=room; base=${n}; epoch=${o}`}:{invalid:!0}}function lt(e,t,n,o,s,r=!1,l=null){let c=X(),u=c?`${pe}/${c}`:pe,i={method:"POST",credentials:c?"omit":"same-origin",signal:n,headers:{"Document-URL":window.location.href,"Page-URL":window.location.href,"Save-Trigger":t?"user":"auto","Save-ID":o,[oe]:String(1)},body:ut(e)};for(let[a,d]of G)i.headers[a]=d;return typeof i.body!="string"&&(i.headers["Content-Type"]=Se),l&&(i.headers["Page-Conversion"]=l),s&&(i.headers["If-Match"]=s),r&&e.length<me&&new Blob([e]).size<me&&(i.keepalive=!0),{url:ct(u),options:i}}function ut(e){if(e.length<Ge)return e;if(j&&j.content===e)return j.blob;let t=new Blob([e],{type:Se});return j={content:e,blob:t},t}function ye(){let e=ne();return re()&&e?e:null}function ct(e){let t=window.location.origin;return!t||t==="null"?e:new URL(e,t).href}function z(e,t){let n=JSON.stringify(t);return{ok:e>=200&&e<300,status:e,statusText:e===200?"OK":"Insufficient Storage",text:()=>Promise.resolve(n)}}function ft(e){let t=Y();return t?Promise.resolve().then(()=>{try{return t(e),z(200,{msg:"Saved in this browser",msgType:"success"})}catch(n){return z(507,{msg:"Couldn't save in this browser. Storage is full or turned off.",msgType:"error",code:n.code||"draft-storage"})}}):Promise.resolve(z(503,{msg:"Saving in this browser is not ready yet",msgType:"error",code:"draft-not-ready"}))}function dt(e,t,n,{captureId:o=null,conversionHeader:s=null,attempts:r=[]}={}){let l=new AbortController,c=setTimeout(()=>l.abort(),ze),u=q(),i=Z(),a=u||i,d=$;$=!1;let{url:m,options:x}=lt(e,a,l.signal,t,n,d,s);return Ye(t),R||(r.some(f=>f.saveId===t&&f.etag===(n??null))||r.push({saveId:t,etag:n??null}),Ke({captureId:o,saveId:t,html:e,etag:n??null})),(R?ft(e):fetch(m,x)).then(f=>f.text().then(p=>{let h={};if(p)try{h=JSON.parse(p)}catch{if(f.ok)throw new Error("Server sent a response that was not JSON")}if(!f.ok){let g=new Error(h.msg||h.error||`HTTP ${f.status}: ${f.statusText}`);throw g.code=f.status===413?"save-too-large":h.code??null,g.status=f.status,g.changedBy=h.changedBy??null,g.etag=h.etag??null,g.saveId=h.saveId??null,g.reason=typeof h.reason=="string"?h.reason:null,g.saveOutcome=h.saveOutcome??null,g.retryAfter=ot(f.headers?.get?.("Retry-After")),g}return M(h.etag??null),v=null,h})).catch(f=>{throw console.error("Failed to save page:",f),f.name==="AbortError"&&(v={saveId:t,etag:n}),a&&V(),f}).finally(()=>{clearTimeout(c)})}async function ht(){let e=v;if(!e)return{landed:null,resend:!1};let n=(await w({fresh:!0})).document,o=typeof n?.etag=="string"&&n.etag?n.etag:null;return o?n.saveId&&n.saveId===e.saveId?(M(o),v=null,{landed:{msg:"Saved",msgType:"success",etag:o},resend:!1}):(n.saveId&&(v=null),{landed:null,resend:!!e.etag,etag:e.etag}):{landed:null,resend:!1}}async function pt(e,{captureId:t=null,conversionHeader:n=null,attempts:o=[]}={}){let s=ve(),r=ye(),l=!1,c=!1,u=0,i=t??k();for(;;)try{return await dt(e,s,r,{captureId:t,conversionHeader:n,attempts:o})}catch(a){if(l&&(a.hadTimeout=!0),a.name==="AbortError"){if(l)throw a;let{landed:d,resend:m,etag:x}=await ht();if(d)return d;if(!m)throw a;r=x,l=!0;continue}if(a.status===412&&!c&&Ve(a.saveId)){M(a.etag??null),v=null,s=ve(),r=ye(),c=!0;continue}if(a.code==="page-converting"&&u<nt){if(k()!==i||(u+=1,await new Promise(d=>setTimeout(d,Math.max(0,a.retryAfter??1)*1e3)),k()!==i))throw a;continue}throw a}}function W(e,t,n,o,s=null,r=0,l=null){return e=ie(e,Math.max(C(),r)),new Promise(c=>{let u=[],i=Q(s),a=()=>l!==null&&E===l,d=()=>{a()||(y=!1)},m=(p,h=!1)=>{h&&U(e,t??null,i),ee(s),We({captureId:t??null,result:p,attempts:u,sent:u.length>0}),typeof n=="function"&&n(p),c(p)};if(!N&&!window.clay?.testMode)return m(O("Not in edit mode"));if(y&&!a())return m(O("Save already in progress"));let x=at(o);if(x.invalid)return m(tt());if(y=!0,window.clay?.testMode){setTimeout(()=>{d(),m(ge({msg:"Test mode: save skipped"}))},0);return}P();let f=B(F(e),le());if(ue(f),f.state==="over")return d(),m(qe(f));pt(e,{captureId:t,conversionHeader:x.header,attempts:u}).then(ge,K).then(p=>{d(),p.code==="save-too-large"&&!p.size&&(p.size=f),p.ok&&U(e,t??null,i),m(p)})})}function mt(e,t=()=>{}){return W(e,null,t,null)}function Vt(e,t,n=()=>{},{conversion:o,capture:s=null,pageFormatFloor:r,lane:l=null}={}){return W(e,t,n,o,s,r,l)}function qt({html:e,captureId:t,conversion:n}){return W(e,t??null,void 0,n)}function Zt(e,t=()=>{}){return new Promise(n=>{let o=null,s=r=>{Qe(o),typeof t=="function"&&t(r),n(r)};if(!N)return s(O("Not in edit mode"));if(et())return s(O("Another document operation is in progress"));if(y)return s(O("Save already in progress"));if(R)return s(!1);o=Ze("replace"),fetch(new URL(e,window.location.href).href).then(r=>{if(!r.ok)throw new Error(`Template fetch failed: HTTP ${r.status} ${r.statusText}`);return r.text()}).then(r=>mt(r)).then(s).catch(r=>{console.error("Failed to fetch template:",r),s(K(r))})})}var xe=null;function Qt(e){xe=e}function en(){return xe}export{P as a,vt as b,yt as c,Ft as d,Bt as e,Ht as f,Jt as g,zt as h,Gt as i,Kt as j,Wt as k,Xt as l,ve as m,Yt as n,Ze as o,Qe as p,et as q,lt as r,mt as s,Vt as t,qt as u,Zt as v,Qt as w,en as x};
|