@panphora/clayjs 1.18.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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 +618 -399
- package/dist/m/{c-6DB2OLRJ.js → c-2RARVIAK.js} +1 -1
- package/dist/m/{c-UORXLSD3.js → c-2Y4DOHSY.js} +1 -1
- package/dist/m/{c-4TXNLX4K.js → c-4FJTBE6I.js} +3 -3
- package/dist/m/{c-6UGWFMQC.js → c-7PYNAULW.js} +1 -1
- package/dist/m/{c-AMU3BPPR.js → c-AIWN4QN4.js} +2 -2
- package/dist/m/{c-COPTL5WB.js → c-AXGY2WTB.js} +1 -1
- package/dist/m/{c-IMZCWYHR.js → c-BAUBNYXK.js} +1 -1
- package/dist/m/{c-MWXFLW4J.js → c-CQQDL6O4.js} +1 -1
- package/dist/m/{c-KP64LT2A.js → c-DHUCEMXE.js} +1 -1
- package/dist/m/{c-VILENZTD.js → c-EXEDYU4H.js} +1 -1
- package/dist/m/{c-2GRUM77Q.js → c-F6G2OGYG.js} +2 -2
- package/dist/m/{c-SPZPGD3R.js → c-FCNAO2MI.js} +1 -1
- package/dist/m/{c-372N6H3B.js → c-FOOE4GML.js} +1 -1
- package/dist/m/{c-AMYEFA2E.js → c-FTQKI7SP.js} +1 -1
- package/dist/m/{c-URSMSFCB.js → c-GWNC3UGL.js} +1 -1
- package/dist/m/{c-BUAYFEV5.js → c-HUISJXHF.js} +1 -1
- package/dist/m/{c-K3ADYNLU.js → c-HXPHZN7Q.js} +1 -1
- package/dist/m/{c-OTMKN2OO.js → c-I4MQHOEY.js} +1 -1
- package/dist/m/{c-HHGJBU4D.js → c-JCP3XDSJ.js} +1 -1
- package/dist/m/{c-JNLX3RJB.js → c-JDARJDOT.js} +1 -1
- package/dist/m/{c-TTB5EK4S.js → c-JK3PHE7J.js} +1 -1
- package/dist/m/{c-B5UJQT7W.js → c-K72SY2TL.js} +1 -1
- package/dist/m/{c-5ONTYIUI.js → c-L6FLIUXP.js} +1 -1
- package/dist/m/{c-5OOVFCJM.js → c-LACAAQFB.js} +1 -1
- package/dist/m/{c-U7SHNWDH.js → c-LPCZOYTX.js} +1 -1
- package/dist/m/{c-X5TSXZYJ.js → c-MIKZEG5I.js} +1 -1
- package/dist/m/{c-EVYAISP3.js → c-MMXKAX2W.js} +1 -1
- package/dist/m/{c-PLN76GF3.js → c-O4JMKN6U.js} +2 -2
- package/dist/m/{c-RND3G2S2.js → c-P3CK66NT.js} +1 -1
- package/dist/m/{c-YBKHUAK7.js → c-QINHDETP.js} +1 -1
- package/dist/m/{c-OPLUZR3A.js → c-RRZJWFLE.js} +1 -1
- package/dist/m/{c-HMV6P4RX.js → c-UXFUJEZO.js} +1 -1
- package/dist/m/{c-SW4YEG2D.js → c-V52FE5FI.js} +1 -1
- package/dist/m/{c-D5IKEKXW.js → c-VE7RKNKZ.js} +1 -1
- package/dist/m/{c-CCQ25GFY.js → c-WKNRJX3C.js} +1 -1
- package/dist/m/{c-C6IPRG34.js → c-XSZKP646.js} +1 -1
- package/dist/m/{c-ZK4GIZH2.js → c-ZGDYHKG3.js} +1 -1
- package/dist/m/{c-T637T7SN.js → c-ZKNBMNN3.js} +1 -1
- package/dist/m/{c-W6DQSHXI.js → c-ZRUQ5FSU.js} +1 -1
- package/dist/m/{c-4YU3BR4D.js → c-ZS4US2XV.js} +1 -1
- package/dist/m/core/{autosave-S6OMNDCK.js → autosave-RVJPYLRT.js} +1 -1
- package/dist/m/core/{conflict-notice-IWHMHH43.js → conflict-notice-2WGT52LH.js} +1 -1
- package/dist/m/core/{recovery-DRFZRJED.js → recovery-ZOUOJVIX.js} +1 -1
- package/dist/m/core/{save-LYY7K6U7.js → save-A5JXV6ME.js} +1 -1
- package/dist/m/core/{unsaved-warning-7QTKEN7Z.js → unsaved-warning-4ZPEV7BF.js} +1 -1
- package/dist/m/loader-34YPFKOH.js +1 -0
- package/dist/m/manifest-0D166F4F.js +1 -0
- package/dist/m/manifest-edit-3877153E.js +1 -0
- package/dist/m/manifest.json +566 -555
- package/dist/m/page/{editor-6LRB3GE4.js → editor-WRQGHDSG.js} +2 -2
- package/dist/m/plugins/{ai-edit-UTV7YO2I.js → ai-edit-X2L2KIEP.js} +1 -1
- package/dist/m/plugins/like-EV7MTZ56.js +1 -0
- package/dist/m/plugins/{live-AD4H6XSL.js → live-7C36XEI2.js} +1 -1
- package/dist/m/plugins/{menu-M5WW7DBF.js → menu-MFC4DI5E.js} +1 -1
- package/dist/m/plugins/{page-MD3T2ZX3.js → page-BSW6MGDO.js} +2 -2
- package/dist/m/plugins/{page-view-PAWVZNFY.js → page-view-WFZVTPQK.js} +1 -1
- package/dist/m/plugins/{wire-VBWXEXU2.js → wire-6OSIL3I7.js} +1 -1
- package/dist/m/{reader-core-4W2KYEWQ.js → reader-core-PLZYLYLT.js} +2 -2
- package/dist/m/sync/{live-sync-MO5DH33W.js → live-sync-UXNI6ZF6.js} +1 -1
- package/dist/offline-manifest.json +312 -300
- package/docs/guide.md +1 -0
- package/package.json +2 -1
- package/src/loader-logic.js +5 -1
- package/src/loader.js +2 -0
- package/src/plugins/like.js +254 -0
- package/dist/m/loader-3BBNZZGM.js +0 -1
- package/dist/m/manifest-26C55578.js +0 -1
- package/dist/m/manifest-edit-4396A009.js +0 -1
- /package/dist/m/{c-X5LNHET5.js → c-5JLFROUB.js} +0 -0
package/dist/clay.standalone.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* clayjs 1.
|
|
1
|
+
/* clayjs 1.19.0 standalone build: every clayjs module in one file. https://clayjs.com/offline
|
|
2
2
|
Third-party code inside keeps its own license (Sortable MIT, Squire MIT, DOMPurify Apache-2.0 OR MPL-2.0, MicroModal MIT, parse5 MIT, Highlights from Pierre Apache-2.0): https://clayjs.com/THIRD-PARTY-NOTICES.md */
|
|
3
3
|
(() => {
|
|
4
4
|
var __create = Object.create;
|
|
@@ -2530,8 +2530,8 @@
|
|
|
2530
2530
|
if (!transform && flushUndo) return captureForSave({ emitForSync: false });
|
|
2531
2531
|
const clone = captureSnapshot({ flushUndo });
|
|
2532
2532
|
if (transform) {
|
|
2533
|
-
const
|
|
2534
|
-
if (
|
|
2533
|
+
const pending8 = transform(clone);
|
|
2534
|
+
if (pending8 && typeof pending8.then === "function") {
|
|
2535
2535
|
throw new TypeError("getHTML: the transform must be synchronous");
|
|
2536
2536
|
}
|
|
2537
2537
|
}
|
|
@@ -2824,7 +2824,7 @@
|
|
|
2824
2824
|
function throttle(callback, delay, executeFirst = true) {
|
|
2825
2825
|
let lastCall = executeFirst ? 0 : Date.now();
|
|
2826
2826
|
let timeoutId = null;
|
|
2827
|
-
let
|
|
2827
|
+
let pending8 = [];
|
|
2828
2828
|
function settle7(ctx, args, waiting) {
|
|
2829
2829
|
let result2;
|
|
2830
2830
|
try {
|
|
@@ -2851,17 +2851,17 @@
|
|
|
2851
2851
|
clearTimeout(timeoutId);
|
|
2852
2852
|
timeoutId = null;
|
|
2853
2853
|
lastCall = now3;
|
|
2854
|
-
const waiting =
|
|
2855
|
-
|
|
2854
|
+
const waiting = pending8.concat({ resolve: resolve2, reject });
|
|
2855
|
+
pending8 = [];
|
|
2856
2856
|
settle7(ctx, args, waiting);
|
|
2857
2857
|
} else {
|
|
2858
|
-
|
|
2858
|
+
pending8.push({ resolve: resolve2, reject });
|
|
2859
2859
|
if (!timeoutId) {
|
|
2860
2860
|
timeoutId = setTimeout(() => {
|
|
2861
2861
|
lastCall = Date.now();
|
|
2862
2862
|
timeoutId = null;
|
|
2863
|
-
const waiting =
|
|
2864
|
-
|
|
2863
|
+
const waiting = pending8;
|
|
2864
|
+
pending8 = [];
|
|
2865
2865
|
settle7(ctx, args, waiting);
|
|
2866
2866
|
}, remaining);
|
|
2867
2867
|
}
|
|
@@ -4244,14 +4244,14 @@
|
|
|
4244
4244
|
}
|
|
4245
4245
|
function followLook(root4, target, base2) {
|
|
4246
4246
|
let timer = 0;
|
|
4247
|
-
const
|
|
4247
|
+
const refresh3 = () => {
|
|
4248
4248
|
timer = 0;
|
|
4249
4249
|
const rect = target.getBoundingClientRect();
|
|
4250
4250
|
if (!document.hidden && root4.isConnected && rect.width && rect.height) lookAt(root4, rect, base2);
|
|
4251
4251
|
};
|
|
4252
4252
|
const soon = () => {
|
|
4253
4253
|
clearTimeout(timer);
|
|
4254
|
-
timer = setTimeout(
|
|
4254
|
+
timer = setTimeout(refresh3, 150);
|
|
4255
4255
|
};
|
|
4256
4256
|
window.addEventListener("scroll", soon, { capture: true, passive: true });
|
|
4257
4257
|
window.addEventListener("resize", soon);
|
|
@@ -4261,7 +4261,7 @@
|
|
|
4261
4261
|
watch2.observe(document.documentElement, { attributes: true });
|
|
4262
4262
|
watch2.observe(document.body, { attributes: true });
|
|
4263
4263
|
watch2.observe(root4, { attributes: true, attributeFilter: ["data-corner", "hidden"] });
|
|
4264
|
-
|
|
4264
|
+
refresh3();
|
|
4265
4265
|
}
|
|
4266
4266
|
var pageScheme2, UI, REPLACED, BAD, TO_LMS, TO_LAB, FROM_LAB, FROM_LMS, clamp, multiply, lin, gamma, oklab, fromOklab, luminance, contrast, darkInk, distance, average, fade, inside, colours, painters, censusAt, censusSize, grid, BEVEL_SURFACE;
|
|
4267
4267
|
var init_page_colour = __esm({
|
|
@@ -4361,7 +4361,7 @@
|
|
|
4361
4361
|
style(el13, rules);
|
|
4362
4362
|
}
|
|
4363
4363
|
}
|
|
4364
|
-
function bevelButton(label, { variant = "default", small = false, onClick:
|
|
4364
|
+
function bevelButton(label, { variant = "default", small = false, onClick: onClick3 = null, extra = [], labelExtra = [], onState = null, theme: theme2 = null, parts = [], labelParts = [] } = {}) {
|
|
4365
4365
|
const v9 = VARIANT[variant] || VARIANT.default;
|
|
4366
4366
|
const size = small ? SIZE.small : SIZE.normal;
|
|
4367
4367
|
const reducedMotion = media("(prefers-reduced-motion: reduce)");
|
|
@@ -4485,7 +4485,7 @@
|
|
|
4485
4485
|
e20.stopImmediatePropagation();
|
|
4486
4486
|
return;
|
|
4487
4487
|
}
|
|
4488
|
-
if (
|
|
4488
|
+
if (onClick3) onClick3(e20);
|
|
4489
4489
|
});
|
|
4490
4490
|
b6.setLabel = (text6) => {
|
|
4491
4491
|
span.textContent = text6;
|
|
@@ -4504,10 +4504,10 @@
|
|
|
4504
4504
|
applyState();
|
|
4505
4505
|
return b6;
|
|
4506
4506
|
}
|
|
4507
|
-
function bevelIconButton(svg4, { label, onClick:
|
|
4507
|
+
function bevelIconButton(svg4, { label, onClick: onClick3 = null }) {
|
|
4508
4508
|
const b6 = bevelButton("", {
|
|
4509
4509
|
small: true,
|
|
4510
|
-
onClick:
|
|
4510
|
+
onClick: onClick3,
|
|
4511
4511
|
extra: ["width:26px", "height:26px", "padding:0", "display:inline-grid", "place-items:center"],
|
|
4512
4512
|
labelExtra: ["display:inline-grid", "width:12px", "height:12px"]
|
|
4513
4513
|
});
|
|
@@ -4517,20 +4517,20 @@
|
|
|
4517
4517
|
b6.title = label;
|
|
4518
4518
|
return b6;
|
|
4519
4519
|
}
|
|
4520
|
-
function bevelCornerClose({ label = "Close", onClick:
|
|
4520
|
+
function bevelCornerClose({ label = "Close", onClick: onClick3 = null } = {}) {
|
|
4521
4521
|
let bg = null;
|
|
4522
4522
|
let x5 = null;
|
|
4523
|
-
const
|
|
4523
|
+
const paint3 = ({ hovered, focusVisible }) => {
|
|
4524
4524
|
if (!bg) return;
|
|
4525
4525
|
set(bg, "fill", focusVisible ? TOKENS2.brass : hovered ? TOKENS2.face : TOKENS2.sunk);
|
|
4526
4526
|
set(x5, "fill", focusVisible ? TOKENS2.face : TOKENS2.ink);
|
|
4527
4527
|
};
|
|
4528
4528
|
const b6 = bevelButton("", {
|
|
4529
4529
|
variant: "quiet",
|
|
4530
|
-
onClick:
|
|
4530
|
+
onClick: onClick3,
|
|
4531
4531
|
extra: CORNER,
|
|
4532
4532
|
labelExtra: ["display:block", "width:100%", "height:100%"],
|
|
4533
|
-
onState:
|
|
4533
|
+
onState: paint3
|
|
4534
4534
|
});
|
|
4535
4535
|
b6.setAttribute("aria-label", label);
|
|
4536
4536
|
b6.firstChild.innerHTML = `<svg viewBox="0 0 134 134" xmlns="http://www.w3.org/2000/svg"><path d="${CORNER_BG}"/><path fill-rule="evenodd" clip-rule="evenodd" d="${CORNER_X}"/></svg>`;
|
|
@@ -4539,7 +4539,7 @@
|
|
|
4539
4539
|
[bg, x5] = svg4.children;
|
|
4540
4540
|
set(x5, "fill-rule", "evenodd");
|
|
4541
4541
|
set(x5, "clip-rule", "evenodd");
|
|
4542
|
-
|
|
4542
|
+
paint3({ hovered: false, focusVisible: false });
|
|
4543
4543
|
return b6;
|
|
4544
4544
|
}
|
|
4545
4545
|
function bevelBox(tag2, rules = [], { theme: theme2 = null, parts = [], role = null } = {}) {
|
|
@@ -4664,7 +4664,7 @@
|
|
|
4664
4664
|
if (typeof document !== "undefined") {
|
|
4665
4665
|
document.addEventListener("keydown", () => {
|
|
4666
4666
|
keyboardModality = true;
|
|
4667
|
-
for (const
|
|
4667
|
+
for (const refresh3 of focusedButtons) refresh3();
|
|
4668
4668
|
}, true);
|
|
4669
4669
|
document.addEventListener("pointerdown", () => {
|
|
4670
4670
|
keyboardModality = false;
|
|
@@ -5241,10 +5241,10 @@
|
|
|
5241
5241
|
if (index >= 0) saveOutcomeHooks.splice(index, 1);
|
|
5242
5242
|
};
|
|
5243
5243
|
}
|
|
5244
|
-
function notifySaveAttempt(
|
|
5244
|
+
function notifySaveAttempt(attempt2) {
|
|
5245
5245
|
for (const hook of saveAttemptHooks) {
|
|
5246
5246
|
try {
|
|
5247
|
-
hook(
|
|
5247
|
+
hook(attempt2);
|
|
5248
5248
|
} catch (err) {
|
|
5249
5249
|
console.error("clayjs: onSaveAttempt hook failed:", err);
|
|
5250
5250
|
}
|
|
@@ -5454,7 +5454,7 @@
|
|
|
5454
5454
|
const { url, options } = buildSaveRequest(content, userDriven, controller2.signal, saveId, etag, keepalive, conversionHeader);
|
|
5455
5455
|
rememberSentId(saveId);
|
|
5456
5456
|
if (!isDraftMode) {
|
|
5457
|
-
if (!attempts.some((
|
|
5457
|
+
if (!attempts.some((attempt2) => attempt2.saveId === saveId && attempt2.etag === (etag ?? null))) {
|
|
5458
5458
|
attempts.push({ saveId, etag: etag ?? null });
|
|
5459
5459
|
}
|
|
5460
5460
|
notifySaveAttempt({ captureId, saveId, html: content, etag: etag ?? null });
|
|
@@ -5493,19 +5493,19 @@
|
|
|
5493
5493
|
});
|
|
5494
5494
|
}
|
|
5495
5495
|
async function recoverUnknownSave() {
|
|
5496
|
-
const
|
|
5497
|
-
if (!
|
|
5496
|
+
const attempt2 = unknownAttempt;
|
|
5497
|
+
if (!attempt2) return { landed: null, resend: false };
|
|
5498
5498
|
const meta = await hostMeta({ fresh: true });
|
|
5499
5499
|
const doc = meta.document;
|
|
5500
5500
|
const stored = typeof doc?.etag === "string" && doc.etag ? doc.etag : null;
|
|
5501
5501
|
if (!stored) return { landed: null, resend: false };
|
|
5502
|
-
if (doc.saveId && doc.saveId ===
|
|
5502
|
+
if (doc.saveId && doc.saveId === attempt2.saveId) {
|
|
5503
5503
|
recordEtag(stored);
|
|
5504
5504
|
unknownAttempt = null;
|
|
5505
5505
|
return { landed: { msg: "Saved", msgType: "success", etag: stored }, resend: false };
|
|
5506
5506
|
}
|
|
5507
5507
|
if (doc.saveId) unknownAttempt = null;
|
|
5508
|
-
return { landed: null, resend: !!
|
|
5508
|
+
return { landed: null, resend: !!attempt2.etag, etag: attempt2.etag };
|
|
5509
5509
|
}
|
|
5510
5510
|
async function sendSave(content, { captureId = null, conversionHeader = null, attempts = [] } = {}) {
|
|
5511
5511
|
let saveId = mintSaveId();
|
|
@@ -6207,13 +6207,13 @@
|
|
|
6207
6207
|
let costMs = 0;
|
|
6208
6208
|
let timer = null;
|
|
6209
6209
|
let timerAt = null;
|
|
6210
|
-
let
|
|
6210
|
+
let pending8 = false;
|
|
6211
6211
|
let running2 = false;
|
|
6212
6212
|
function dueAt() {
|
|
6213
6213
|
return nextAutoAt({ firstDirtyAt, lastActivityAt, finishedAt, costMs });
|
|
6214
6214
|
}
|
|
6215
6215
|
function schedule2() {
|
|
6216
|
-
if (!
|
|
6216
|
+
if (!pending8 || running2) return;
|
|
6217
6217
|
const at8 = dueAt();
|
|
6218
6218
|
if (timer !== null) {
|
|
6219
6219
|
if (timerAt === at8) return;
|
|
@@ -6225,7 +6225,7 @@
|
|
|
6225
6225
|
function fire() {
|
|
6226
6226
|
timer = null;
|
|
6227
6227
|
timerAt = null;
|
|
6228
|
-
if (!
|
|
6228
|
+
if (!pending8 || running2) return;
|
|
6229
6229
|
if (now3() < dueAt()) {
|
|
6230
6230
|
schedule2();
|
|
6231
6231
|
return;
|
|
@@ -6233,32 +6233,32 @@
|
|
|
6233
6233
|
admit();
|
|
6234
6234
|
}
|
|
6235
6235
|
function admit() {
|
|
6236
|
-
|
|
6236
|
+
pending8 = false;
|
|
6237
6237
|
running2 = true;
|
|
6238
6238
|
firstDirtyAt = null;
|
|
6239
6239
|
lastActivityAt = null;
|
|
6240
|
-
let
|
|
6240
|
+
let attempt2;
|
|
6241
6241
|
try {
|
|
6242
|
-
|
|
6242
|
+
attempt2 = run5();
|
|
6243
6243
|
} catch (err) {
|
|
6244
6244
|
finish2();
|
|
6245
6245
|
return;
|
|
6246
6246
|
}
|
|
6247
|
-
Promise.resolve(
|
|
6247
|
+
Promise.resolve(attempt2).then(finish2, finish2);
|
|
6248
6248
|
}
|
|
6249
6249
|
function finish2() {
|
|
6250
6250
|
running2 = false;
|
|
6251
6251
|
finishedAt = now3();
|
|
6252
|
-
if (
|
|
6252
|
+
if (pending8) schedule2();
|
|
6253
6253
|
}
|
|
6254
6254
|
function noteActivity({ at: at8 = now3() } = {}) {
|
|
6255
6255
|
if (firstDirtyAt === null) firstDirtyAt = at8;
|
|
6256
6256
|
lastActivityAt = at8;
|
|
6257
|
-
|
|
6257
|
+
pending8 = true;
|
|
6258
6258
|
schedule2();
|
|
6259
6259
|
}
|
|
6260
|
-
function
|
|
6261
|
-
|
|
6260
|
+
function request4() {
|
|
6261
|
+
pending8 = true;
|
|
6262
6262
|
schedule2();
|
|
6263
6263
|
}
|
|
6264
6264
|
function noteCost(sampleMs) {
|
|
@@ -6267,11 +6267,11 @@
|
|
|
6267
6267
|
}
|
|
6268
6268
|
return {
|
|
6269
6269
|
noteActivity,
|
|
6270
|
-
request:
|
|
6270
|
+
request: request4,
|
|
6271
6271
|
noteCost,
|
|
6272
6272
|
dueAt,
|
|
6273
6273
|
costEstimate: () => costMs,
|
|
6274
|
-
pending: () =>
|
|
6274
|
+
pending: () => pending8 || running2,
|
|
6275
6275
|
running: () => running2
|
|
6276
6276
|
};
|
|
6277
6277
|
}
|
|
@@ -13521,7 +13521,7 @@
|
|
|
13521
13521
|
if (run5.over) return null;
|
|
13522
13522
|
let saved2 = false;
|
|
13523
13523
|
let etag = null;
|
|
13524
|
-
for (let
|
|
13524
|
+
for (let attempt2 = 0; attempt2 < 4; attempt2++) {
|
|
13525
13525
|
if (preparing) {
|
|
13526
13526
|
await preparing;
|
|
13527
13527
|
if (run5.over) return null;
|
|
@@ -13686,9 +13686,9 @@
|
|
|
13686
13686
|
for (const comparison of inFlightComparisons) stored.push(comparison.forComparison, comparison.forDirty);
|
|
13687
13687
|
return stored.some((html) => html && markers.some((marker2) => marker2 && html.includes(marker2)));
|
|
13688
13688
|
}
|
|
13689
|
-
function withoutOwnedStyles(html,
|
|
13689
|
+
function withoutOwnedStyles(html, pending8) {
|
|
13690
13690
|
const spans = [];
|
|
13691
|
-
for (const { markers, tag: tag2 } of
|
|
13691
|
+
for (const { markers, tag: tag2 } of pending8) {
|
|
13692
13692
|
for (const marker2 of markers) {
|
|
13693
13693
|
for (let at8 = html.indexOf(marker2); at8 >= 0; at8 = html.indexOf(marker2, at8 + marker2.length)) {
|
|
13694
13694
|
const start10 = html.lastIndexOf("<", at8);
|
|
@@ -13904,9 +13904,9 @@
|
|
|
13904
13904
|
capabilityPending = false;
|
|
13905
13905
|
learnCapability = () => {
|
|
13906
13906
|
capabilityPending = true;
|
|
13907
|
-
return learnConditionalSaves().catch(() => false).then((
|
|
13907
|
+
return learnConditionalSaves().catch(() => false).then((supported2) => {
|
|
13908
13908
|
capabilityPending = false;
|
|
13909
|
-
return
|
|
13909
|
+
return supported2;
|
|
13910
13910
|
});
|
|
13911
13911
|
};
|
|
13912
13912
|
previewHold = 0;
|
|
@@ -13991,13 +13991,13 @@
|
|
|
13991
13991
|
releaseOperation: () => releaseDocumentOperation,
|
|
13992
13992
|
runSaveBarrier: () => runSaveBarrier
|
|
13993
13993
|
});
|
|
13994
|
-
async function bounded(
|
|
13994
|
+
async function bounded(pending8, deadline) {
|
|
13995
13995
|
let timer = null;
|
|
13996
13996
|
const expired = new Promise((resolve2) => {
|
|
13997
13997
|
timer = setTimeout(() => resolve2(EXPIRED), Math.max(0, deadline - Date.now()));
|
|
13998
13998
|
});
|
|
13999
13999
|
try {
|
|
14000
|
-
return await Promise.race([Promise.resolve(
|
|
14000
|
+
return await Promise.race([Promise.resolve(pending8), expired]);
|
|
14001
14001
|
} finally {
|
|
14002
14002
|
clearTimeout(timer);
|
|
14003
14003
|
}
|
|
@@ -14042,8 +14042,8 @@
|
|
|
14042
14042
|
if (result2.state !== "clean" && result2.state !== "saved") return refusal("save-failed");
|
|
14043
14043
|
if (isSaveConflicted()) return refusal("conflict");
|
|
14044
14044
|
if (saveFateIsUnknown()) return refusal("save-unknown");
|
|
14045
|
-
const
|
|
14046
|
-
if (
|
|
14045
|
+
const pending8 = pendingIds();
|
|
14046
|
+
if (pending8.length) return refusal("pending-input", { pending: pending8 });
|
|
14047
14047
|
if (bytesUnsaved()) {
|
|
14048
14048
|
if (pass + 1 < MAX_PASSES && Date.now() < deadline) continue;
|
|
14049
14049
|
return refusal("pending-input");
|
|
@@ -23986,16 +23986,16 @@
|
|
|
23986
23986
|
});
|
|
23987
23987
|
|
|
23988
23988
|
// src/sync/page-relay.js
|
|
23989
|
-
function pageRelay(
|
|
23990
|
-
if (!
|
|
23989
|
+
function pageRelay(pending8, acceptedHtml, identity) {
|
|
23990
|
+
if (!pending8.html.includes("data-page")) return pending8;
|
|
23991
23991
|
const parse2 = (html) => new DOMParser().parseFromString(html, "text/html");
|
|
23992
|
-
const outgoing = parse2(
|
|
23992
|
+
const outgoing = parse2(pending8.html);
|
|
23993
23993
|
const article = outgoing.querySelector("article[data-page]");
|
|
23994
|
-
if (!article) return
|
|
23994
|
+
if (!article) return pending8;
|
|
23995
23995
|
const accepted2 = parse2(acceptedHtml);
|
|
23996
23996
|
const savedArticle = accepted2.querySelector("article[data-page]");
|
|
23997
23997
|
if (!savedArticle) return null;
|
|
23998
|
-
const oldIds = M2(outgoing.documentElement,
|
|
23998
|
+
const oldIds = M2(outgoing.documentElement, pending8.identityMap);
|
|
23999
23999
|
const replace3 = (old, source3) => {
|
|
24000
24000
|
const next = outgoing.importNode(source3, true);
|
|
24001
24001
|
const id2 = oldIds.get(old);
|
|
@@ -24025,7 +24025,7 @@
|
|
|
24025
24025
|
identity.adopt(node, id2);
|
|
24026
24026
|
return node;
|
|
24027
24027
|
});
|
|
24028
|
-
return { ...
|
|
24028
|
+
return { ...pending8, html: serializeForSync(root4), identityMap };
|
|
24029
24029
|
}
|
|
24030
24030
|
var PAGE, tags;
|
|
24031
24031
|
var init_page_relay = __esm({
|
|
@@ -25008,8 +25008,8 @@
|
|
|
25008
25008
|
};
|
|
25009
25009
|
}
|
|
25010
25010
|
/** What the host advertised, asked of it once by the chrome. */
|
|
25011
|
-
setCapabilities({ supported = false, recordAwareness = false, pageAwareness = false } = {}) {
|
|
25012
|
-
const nextSupported =
|
|
25011
|
+
setCapabilities({ supported: supported2 = false, recordAwareness = false, pageAwareness = false } = {}) {
|
|
25012
|
+
const nextSupported = supported2 === true;
|
|
25013
25013
|
const nextRecord = recordAwareness === true;
|
|
25014
25014
|
const nextPage = pageAwareness === true;
|
|
25015
25015
|
if (nextSupported === this.supported && nextRecord === this.recordAwareness && nextPage === this.pageAwareness) return this.snapshot;
|
|
@@ -25754,9 +25754,9 @@
|
|
|
25754
25754
|
hostSupports("presence"),
|
|
25755
25755
|
hostSupports("record-awareness-v1"),
|
|
25756
25756
|
hostSupports("page-awareness-v1")
|
|
25757
|
-
]).then(([
|
|
25758
|
-
presence.setCapabilities({ supported, recordAwareness, pageAwareness });
|
|
25759
|
-
return
|
|
25757
|
+
]).then(([supported2, recordAwareness, pageAwareness]) => {
|
|
25758
|
+
presence.setCapabilities({ supported: supported2, recordAwareness, pageAwareness });
|
|
25759
|
+
return supported2 === true;
|
|
25760
25760
|
}, () => false);
|
|
25761
25761
|
}
|
|
25762
25762
|
return this._gate;
|
|
@@ -26354,17 +26354,17 @@
|
|
|
26354
26354
|
return doc;
|
|
26355
26355
|
}
|
|
26356
26356
|
function countAuthored(root4) {
|
|
26357
|
-
const
|
|
26357
|
+
const counts2 = /* @__PURE__ */ new Map();
|
|
26358
26358
|
const visit = (el13) => {
|
|
26359
26359
|
if (el13.matches(SYNC_IGNORE_SELECTOR)) return;
|
|
26360
26360
|
const id2 = authoredAttr2(el13);
|
|
26361
|
-
if (id2)
|
|
26361
|
+
if (id2) counts2.set(id2, (counts2.get(id2) || 0) + 1);
|
|
26362
26362
|
const kids = el13.localName === "template" && el13.content ? el13.content.children : el13.children;
|
|
26363
26363
|
for (const kid of kids) visit(kid);
|
|
26364
26364
|
};
|
|
26365
26365
|
const tops = root4.nodeType === 9 ? [root4.documentElement] : root4.nodeType === 11 ? root4.children : [root4];
|
|
26366
26366
|
for (const top of tops) if (top && top.nodeType === 1) visit(top);
|
|
26367
|
-
return
|
|
26367
|
+
return counts2;
|
|
26368
26368
|
}
|
|
26369
26369
|
function readServedStamp(html) {
|
|
26370
26370
|
if (typeof html !== "string" || html === "") return null;
|
|
@@ -26468,9 +26468,9 @@
|
|
|
26468
26468
|
const id2 = authoredAttr2(el13);
|
|
26469
26469
|
if (!id2) return null;
|
|
26470
26470
|
const root4 = el13.getRootNode();
|
|
26471
|
-
let
|
|
26472
|
-
if (!
|
|
26473
|
-
return
|
|
26471
|
+
let counts2 = memo2.get(root4);
|
|
26472
|
+
if (!counts2) memo2.set(root4, counts2 = countAuthored(root4));
|
|
26473
|
+
return counts2.get(id2) === 1 ? id2 : null;
|
|
26474
26474
|
};
|
|
26475
26475
|
isIdMap = (m7) => !!m7 && typeof m7 === "object" && !Array.isArray(m7);
|
|
26476
26476
|
RELAY_BODY_BLOB_MIN_BYTES = 1024 * 1024;
|
|
@@ -27080,18 +27080,18 @@
|
|
|
27080
27080
|
this._log("Skipping send - snapshot belongs to a different capture");
|
|
27081
27081
|
return;
|
|
27082
27082
|
}
|
|
27083
|
-
const
|
|
27083
|
+
const pending8 = held;
|
|
27084
27084
|
this._savedSnapshot = null;
|
|
27085
|
-
if (
|
|
27086
|
-
|
|
27087
|
-
if (
|
|
27088
|
-
else
|
|
27085
|
+
if (pending8?.copy && typeof pending8.html !== "string") {
|
|
27086
|
+
pending8.abort?.abort();
|
|
27087
|
+
if (pending8.steps) for (let step = pending8.steps.next(); !step.done; step = pending8.steps.next()) ;
|
|
27088
|
+
else pending8.html = serializeForSync(pending8.copy);
|
|
27089
27089
|
}
|
|
27090
|
-
if (!
|
|
27091
|
-
let payload =
|
|
27090
|
+
if (!pending8 || typeof pending8.html !== "string") return;
|
|
27091
|
+
let payload = pending8;
|
|
27092
27092
|
if (typeof acceptedHtml === "string") {
|
|
27093
27093
|
try {
|
|
27094
|
-
payload = pageRelay(
|
|
27094
|
+
payload = pageRelay(pending8, acceptedHtml, this.identity);
|
|
27095
27095
|
} catch (err) {
|
|
27096
27096
|
this._log(`Skipping send - page relay failed: ${err && err.message}`);
|
|
27097
27097
|
return;
|
|
@@ -27112,7 +27112,7 @@
|
|
|
27112
27112
|
}
|
|
27113
27113
|
this._enqueueSend(payload.html, payload.identityMap, etag || null);
|
|
27114
27114
|
}
|
|
27115
|
-
_postUpdate(html, identityMap, etag = null,
|
|
27115
|
+
_postUpdate(html, identityMap, etag = null, attempt2 = 0) {
|
|
27116
27116
|
this._log(`Sending update (HTML length: ${html.length})`);
|
|
27117
27117
|
this._sendInFlight = true;
|
|
27118
27118
|
let retry = false;
|
|
@@ -27142,7 +27142,7 @@
|
|
|
27142
27142
|
this._postUpdate(queued3.html, queued3.identityMap, queued3.etag);
|
|
27143
27143
|
return;
|
|
27144
27144
|
}
|
|
27145
|
-
if (!retry || !etag ||
|
|
27145
|
+
if (!retry || !etag || attempt2 >= 3 || this.isDestroyed) return;
|
|
27146
27146
|
this._sendInFlight = true;
|
|
27147
27147
|
setTimeout(() => {
|
|
27148
27148
|
this._sendInFlight = false;
|
|
@@ -27150,8 +27150,8 @@
|
|
|
27150
27150
|
const newer3 = this._queuedSend;
|
|
27151
27151
|
this._queuedSend = null;
|
|
27152
27152
|
if (newer3) this._postUpdate(newer3.html, newer3.identityMap, newer3.etag);
|
|
27153
|
-
else this._postUpdate(html, identityMap, etag,
|
|
27154
|
-
}, 500 * 2 **
|
|
27153
|
+
else this._postUpdate(html, identityMap, etag, attempt2 + 1);
|
|
27154
|
+
}, 500 * 2 ** attempt2);
|
|
27155
27155
|
});
|
|
27156
27156
|
}
|
|
27157
27157
|
/**
|
|
@@ -27169,8 +27169,8 @@
|
|
|
27169
27169
|
}
|
|
27170
27170
|
this._presenceLease = transport2 || null;
|
|
27171
27171
|
return hostSupports("presence-editing");
|
|
27172
|
-
}, () => false).then((
|
|
27173
|
-
if (!
|
|
27172
|
+
}, () => false).then((supported2) => {
|
|
27173
|
+
if (!supported2 || this.isDestroyed || this._startGen !== gen || this._editing) return;
|
|
27174
27174
|
return loadEdit2().then((mod) => {
|
|
27175
27175
|
if (this.isDestroyed || this._startGen !== gen || this._editing) return;
|
|
27176
27176
|
this._editing = new mod.EditingSender({});
|
|
@@ -27278,9 +27278,9 @@
|
|
|
27278
27278
|
* @param {boolean} [options.repair] - The server could not replay everything.
|
|
27279
27279
|
* @param {boolean} [options.startup] - The served page's version check.
|
|
27280
27280
|
*/
|
|
27281
|
-
_fetchServedDocument(seq, { attempt = 0, repair = false, startup = false } = {}) {
|
|
27281
|
+
_fetchServedDocument(seq, { attempt: attempt2 = 0, repair = false, startup = false } = {}) {
|
|
27282
27282
|
if (startup && (this._morphInFlight || this._pendingHtml != null || this._pendingExternal != null)) {
|
|
27283
|
-
this._retryStartup(
|
|
27283
|
+
this._retryStartup(attempt2);
|
|
27284
27284
|
return;
|
|
27285
27285
|
}
|
|
27286
27286
|
const epoch2 = this._saveEpoch;
|
|
@@ -27298,7 +27298,7 @@
|
|
|
27298
27298
|
if (fetchId !== this._servedFetchId) {
|
|
27299
27299
|
if (repair) {
|
|
27300
27300
|
this._retryStartup(
|
|
27301
|
-
|
|
27301
|
+
attempt2 + 1,
|
|
27302
27302
|
{ repair, startup },
|
|
27303
27303
|
typeof seq === "number" ? Math.max(seq, this._lastExternalSeq) : seq
|
|
27304
27304
|
);
|
|
@@ -27306,7 +27306,7 @@
|
|
|
27306
27306
|
return;
|
|
27307
27307
|
}
|
|
27308
27308
|
if (epoch2 !== this._saveEpoch || seenSeq !== this.lastSeenSeq || applyGen !== this._applyGen || this._morphInFlight || this._pendingHtml != null || this._pendingExternal != null) {
|
|
27309
|
-
this._retryStartup(
|
|
27309
|
+
this._retryStartup(attempt2 + 1, { repair, startup }, seq);
|
|
27310
27310
|
return;
|
|
27311
27311
|
}
|
|
27312
27312
|
if (!stamp3) {
|
|
@@ -27318,14 +27318,14 @@
|
|
|
27318
27318
|
return;
|
|
27319
27319
|
}
|
|
27320
27320
|
} else if (typeof seq === "number" && seq < this._lastExternalSeq) {
|
|
27321
|
-
if (repair &&
|
|
27322
|
-
this._fetchServedDocument(this._lastExternalSeq, { attempt:
|
|
27321
|
+
if (repair && attempt2 < 3) {
|
|
27322
|
+
this._fetchServedDocument(this._lastExternalSeq, { attempt: attempt2 + 1, repair, startup });
|
|
27323
27323
|
}
|
|
27324
27324
|
return;
|
|
27325
27325
|
} else if (this._saveEpoch > epoch2) {
|
|
27326
|
-
if (
|
|
27326
|
+
if (attempt2 < 3) {
|
|
27327
27327
|
console.log("[LiveSync] Refetching external change: own save landed mid-fetch");
|
|
27328
|
-
this._fetchServedDocument(seq, { attempt:
|
|
27328
|
+
this._fetchServedDocument(seq, { attempt: attempt2 + 1, repair, startup });
|
|
27329
27329
|
}
|
|
27330
27330
|
return;
|
|
27331
27331
|
}
|
|
@@ -27340,7 +27340,7 @@
|
|
|
27340
27340
|
// named its own version was judged against this tab's version, and the
|
|
27341
27341
|
// drain must go on judging it that way. The epoch refetch below
|
|
27342
27342
|
// re-issues a fetch whose caller may have been a repair.
|
|
27343
|
-
fetchOptions: { repair, startup, attempt, versionCheck },
|
|
27343
|
+
fetchOptions: { repair, startup, attempt: attempt2, versionCheck },
|
|
27344
27344
|
// What the check was made against, so the drain can tell whether the
|
|
27345
27345
|
// answer it holds still describes the page that asked.
|
|
27346
27346
|
startGen,
|
|
@@ -27372,17 +27372,17 @@
|
|
|
27372
27372
|
* @param {Object} [options] - The original fetch options.
|
|
27373
27373
|
* @param {number} [seq]
|
|
27374
27374
|
*/
|
|
27375
|
-
_retryStartup(
|
|
27376
|
-
if (this.isDestroyed ||
|
|
27375
|
+
_retryStartup(attempt2 = 0, options = { startup: true }, seq) {
|
|
27376
|
+
if (this.isDestroyed || attempt2 > 3) return;
|
|
27377
27377
|
clearTimeout(this._startupRetry);
|
|
27378
27378
|
this._startupRetry = setTimeout(() => {
|
|
27379
27379
|
this._startupRetry = null;
|
|
27380
27380
|
if (this.isDestroyed) return;
|
|
27381
27381
|
if (this._morphInFlight || this._pendingHtml != null || this._pendingExternal != null) {
|
|
27382
|
-
this._retryStartup(
|
|
27382
|
+
this._retryStartup(attempt2, options, seq);
|
|
27383
27383
|
return;
|
|
27384
27384
|
}
|
|
27385
|
-
this._fetchServedDocument(seq, { ...options, attempt });
|
|
27385
|
+
this._fetchServedDocument(seq, { ...options, attempt: attempt2 });
|
|
27386
27386
|
}, 16);
|
|
27387
27387
|
}
|
|
27388
27388
|
/**
|
|
@@ -27604,9 +27604,9 @@
|
|
|
27604
27604
|
const mergeDocument = (options) => {
|
|
27605
27605
|
lineageCapture = beginLineageCapture2(conflicts2.list());
|
|
27606
27606
|
try {
|
|
27607
|
-
const
|
|
27607
|
+
const pending9 = loadedEngine().HyperMorph.mergeDocument({ ...options, lineage: lineageCapture.lineage });
|
|
27608
27608
|
lineageCapture.returned();
|
|
27609
|
-
return
|
|
27609
|
+
return pending9;
|
|
27610
27610
|
} catch (error2) {
|
|
27611
27611
|
lineageCapture.invalidate(conflicts2.list());
|
|
27612
27612
|
lineageCapture.finish(conflicts2.list());
|
|
@@ -27650,11 +27650,11 @@
|
|
|
27650
27650
|
};
|
|
27651
27651
|
const dirty = this.lane === "live" && pageMaybeDirty();
|
|
27652
27652
|
const token2 = gateCaptureToken();
|
|
27653
|
-
let
|
|
27653
|
+
let pending8;
|
|
27654
27654
|
let localRoot = null;
|
|
27655
27655
|
let applyId = null;
|
|
27656
27656
|
if (base2 == null) {
|
|
27657
|
-
|
|
27657
|
+
pending8 = mergeDocument({
|
|
27658
27658
|
...common,
|
|
27659
27659
|
base: null,
|
|
27660
27660
|
local: { root: emptyScratchpads(captureLocal()), toLive: originalSnapshotNode },
|
|
@@ -27664,7 +27664,7 @@
|
|
|
27664
27664
|
const localRoot2 = emptyScratchpads(captureLocal());
|
|
27665
27665
|
const baseDoc = localRoot2.ownerDocument;
|
|
27666
27666
|
if (baseDoc.documentElement !== localRoot2) baseDoc.replaceChild(localRoot2, baseDoc.documentElement);
|
|
27667
|
-
|
|
27667
|
+
pending8 = mergeDocument({
|
|
27668
27668
|
...common,
|
|
27669
27669
|
base: baseDoc,
|
|
27670
27670
|
local: { root: localRoot2, toLive: originalSnapshotNode },
|
|
@@ -27688,7 +27688,7 @@
|
|
|
27688
27688
|
domain: source3 === "disk" ? "save" : "sync"
|
|
27689
27689
|
});
|
|
27690
27690
|
try {
|
|
27691
|
-
|
|
27691
|
+
pending8 = mergeDocument({
|
|
27692
27692
|
...common,
|
|
27693
27693
|
base: scratchpadsEmptied(base2),
|
|
27694
27694
|
local: { root: localRoot, toLive: originalSnapshotNode },
|
|
@@ -27707,7 +27707,7 @@
|
|
|
27707
27707
|
this._morphTicket = ticket;
|
|
27708
27708
|
let report2;
|
|
27709
27709
|
try {
|
|
27710
|
-
report2 = await
|
|
27710
|
+
report2 = await pending8;
|
|
27711
27711
|
} catch (err) {
|
|
27712
27712
|
lineageCapture.invalidate(conflicts2.list());
|
|
27713
27713
|
try {
|
|
@@ -29099,10 +29099,10 @@
|
|
|
29099
29099
|
bar2.append(key2(bevelButton("Review", { onClick: openPanel }), "review"));
|
|
29100
29100
|
return bar2;
|
|
29101
29101
|
}
|
|
29102
|
-
function action(label, name, { variant = "default", onClick:
|
|
29102
|
+
function action(label, name, { variant = "default", onClick: onClick3, push = false } = {}) {
|
|
29103
29103
|
const phone = window.innerWidth < 480;
|
|
29104
29104
|
const extra = phone ? ["flex:1 1 100%", ...variant === "primary" ? ["order:-1"] : []] : push ? ["margin-left:auto"] : [];
|
|
29105
|
-
return key2(bevelButton(label, { variant, onClick:
|
|
29105
|
+
return key2(bevelButton(label, { variant, onClick: onClick3, extra }), name);
|
|
29106
29106
|
}
|
|
29107
29107
|
function lede(text6) {
|
|
29108
29108
|
return bevelText("div", ["display:block", "padding:0 16px 12px", `color:${TOKENS2["ink-2"]}`, "font-size:13.5px"], text6);
|
|
@@ -29188,10 +29188,10 @@
|
|
|
29188
29188
|
actions.append(keep3, action(armed ? "Yes, drop my edits" : "Accept theirs", "accept", { variant: "primary", onClick: onRefusedAccept, push: true }));
|
|
29189
29189
|
} else {
|
|
29190
29190
|
if (m7 === "replaced") {
|
|
29191
|
-
const
|
|
29192
|
-
const
|
|
29193
|
-
|
|
29194
|
-
actions.append(
|
|
29191
|
+
const pending8 = ledger2().hasPendingApply();
|
|
29192
|
+
const put4 = action(pending8 ? "Finishing the incoming edit\u2026" : busy === "revert" ? "Putting back\u2026" : "Revert to mine", "revert", { onClick: onRevert });
|
|
29193
|
+
put4.setDisabled(pending8 || busy === "revert");
|
|
29194
|
+
actions.append(put4);
|
|
29195
29195
|
}
|
|
29196
29196
|
actions.append(action("Accept theirs", "accept", { variant: "primary", onClick: onAccept, push: true }));
|
|
29197
29197
|
}
|
|
@@ -29373,17 +29373,17 @@
|
|
|
29373
29373
|
protectIcon(b6.firstElementChild, 16);
|
|
29374
29374
|
b6.setAttribute("aria-label", `Show ${row.name} on page`);
|
|
29375
29375
|
b6.title = "Show on page";
|
|
29376
|
-
const
|
|
29376
|
+
const paint3 = (extra) => {
|
|
29377
29377
|
b6.style.cssText = "";
|
|
29378
29378
|
for (const r45 of [...base2, ...extra]) {
|
|
29379
29379
|
const i2 = r45.indexOf(":");
|
|
29380
29380
|
b6.style.setProperty(r45.slice(0, i2), r45.slice(i2 + 1), "important");
|
|
29381
29381
|
}
|
|
29382
29382
|
};
|
|
29383
|
-
b6.addEventListener("pointerenter", () =>
|
|
29384
|
-
b6.addEventListener("pointerleave", () =>
|
|
29385
|
-
b6.addEventListener("focus", () =>
|
|
29386
|
-
b6.addEventListener("blur", () =>
|
|
29383
|
+
b6.addEventListener("pointerenter", () => paint3([`background:color-mix(in srgb, ${WARN} 16%, transparent)`]));
|
|
29384
|
+
b6.addEventListener("pointerleave", () => paint3([]));
|
|
29385
|
+
b6.addEventListener("focus", () => paint3([`outline:2px solid ${TOKENS2.brass}`, "outline-offset:1px"]));
|
|
29386
|
+
b6.addEventListener("blur", () => paint3([]));
|
|
29387
29387
|
b6.addEventListener("click", () => ring(row.target));
|
|
29388
29388
|
return b6;
|
|
29389
29389
|
}
|
|
@@ -29653,7 +29653,7 @@ ${entry.now}`;
|
|
|
29653
29653
|
}
|
|
29654
29654
|
async function onKeep() {
|
|
29655
29655
|
if (busy) return;
|
|
29656
|
-
const
|
|
29656
|
+
const attempt2 = ++keepAttempt;
|
|
29657
29657
|
busy = "overwrite";
|
|
29658
29658
|
keepFailed = false;
|
|
29659
29659
|
disarm();
|
|
@@ -29664,7 +29664,7 @@ ${entry.now}`;
|
|
|
29664
29664
|
} catch {
|
|
29665
29665
|
result2 = { ok: false };
|
|
29666
29666
|
}
|
|
29667
|
-
if (
|
|
29667
|
+
if (attempt2 !== keepAttempt || busy !== "overwrite") return;
|
|
29668
29668
|
if (!result2?.ok && isSaveConflicted()) {
|
|
29669
29669
|
busy = null;
|
|
29670
29670
|
keepFailed = true;
|
|
@@ -30051,11 +30051,11 @@ ${entry.now}`;
|
|
|
30051
30051
|
if (!notice && !loading3) arm();
|
|
30052
30052
|
},
|
|
30053
30053
|
quiesce() {
|
|
30054
|
-
const
|
|
30055
|
-
if (!
|
|
30054
|
+
const pending8 = unresolved();
|
|
30055
|
+
if (!pending8.length) return;
|
|
30056
30056
|
throw Object.assign(new Error("clay.conflict-notice: a conflict here is still unresolved"), {
|
|
30057
30057
|
code: "conflict",
|
|
30058
|
-
pending:
|
|
30058
|
+
pending: pending8
|
|
30059
30059
|
});
|
|
30060
30060
|
},
|
|
30061
30061
|
resume() {
|
|
@@ -35512,7 +35512,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35512
35512
|
for (let i2 = done.length - 1; i2 >= 0; i2--) root4 = undoTracked(done[i2]);
|
|
35513
35513
|
return root4;
|
|
35514
35514
|
}
|
|
35515
|
-
function slotsOf(done,
|
|
35515
|
+
function slotsOf(done, pending8, state2) {
|
|
35516
35516
|
const slots = [];
|
|
35517
35517
|
for (const rec of done) {
|
|
35518
35518
|
if (rec.at === null || Array.isArray(rec.at)) return null;
|
|
@@ -35531,7 +35531,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35531
35531
|
slot3.into = readPath(state2, slot3.path.slice(0, -1));
|
|
35532
35532
|
if (!isContainer2(slot3.into) || Array.isArray(slot3.into) || has2(slot3.into, slot3.key) !== slot3.had) return null;
|
|
35533
35533
|
const parent = slot3.path.slice(0, -1);
|
|
35534
|
-
for (const entry of
|
|
35534
|
+
for (const entry of pending8) {
|
|
35535
35535
|
const path = entry.op.path;
|
|
35536
35536
|
if (overlaps(slot3.path, path)) return null;
|
|
35537
35537
|
if (entry.op.op === "del" && path.length <= slot3.path.length && overlaps(path.slice(0, -1), slot3.path) && Array.isArray(readPath(state2, path.slice(0, -1)))) return null;
|
|
@@ -35559,7 +35559,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35559
35559
|
let lastRoom = null;
|
|
35560
35560
|
const state2 = cloneJson(value);
|
|
35561
35561
|
let coherent = true;
|
|
35562
|
-
let
|
|
35562
|
+
let pending8 = [];
|
|
35563
35563
|
let nextId3 = 1;
|
|
35564
35564
|
let batch = null;
|
|
35565
35565
|
let mode3 = "file";
|
|
@@ -35582,7 +35582,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35582
35582
|
function rebuild() {
|
|
35583
35583
|
let next = cloneJson(authoritative);
|
|
35584
35584
|
const kept2 = [];
|
|
35585
|
-
for (const entry of
|
|
35585
|
+
for (const entry of pending8) {
|
|
35586
35586
|
try {
|
|
35587
35587
|
checkOp(next, entry.op);
|
|
35588
35588
|
next = applyOp(next, entry.op);
|
|
@@ -35590,7 +35590,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35590
35590
|
} catch {
|
|
35591
35591
|
}
|
|
35592
35592
|
}
|
|
35593
|
-
|
|
35593
|
+
pending8 = kept2;
|
|
35594
35594
|
assignDeep(state2, next);
|
|
35595
35595
|
coherent = true;
|
|
35596
35596
|
}
|
|
@@ -35612,11 +35612,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35612
35612
|
const before = cloneJson(state2);
|
|
35613
35613
|
const prev = authoritative;
|
|
35614
35614
|
authoritative = cloneJson(next);
|
|
35615
|
-
if (drop2)
|
|
35615
|
+
if (drop2) pending8 = pending8.filter((entry) => entry.id < drop2[0] || entry.id > drop2[1]);
|
|
35616
35616
|
else if (dropIds) {
|
|
35617
35617
|
const ids = new Set(dropIds);
|
|
35618
|
-
|
|
35619
|
-
} else
|
|
35618
|
+
pending8 = pending8.filter((entry) => !ids.has(entry.id));
|
|
35619
|
+
} else pending8 = through === void 0 ? pending8.slice(confirmed) : pending8.filter((entry) => entry.id > through);
|
|
35620
35620
|
rebuild();
|
|
35621
35621
|
tell3({ source: source3, frame, room, cause, prev, before: (path) => readPath(prev, path), next: authoritative });
|
|
35622
35622
|
if (!sameLive(before, state2)) emit4(source3, null);
|
|
@@ -35650,7 +35650,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35650
35650
|
if (ops.length === 1) checkOp(state2, ops[0]);
|
|
35651
35651
|
else applyOps(cloneJson(state2), ops);
|
|
35652
35652
|
for (const op of ops) applyInPlace(state2, op);
|
|
35653
|
-
|
|
35653
|
+
pending8.push(...ops.map((op) => ({ id: nextId3++, op })));
|
|
35654
35654
|
if (batch) batch.push(...ops);
|
|
35655
35655
|
else publish2(ops);
|
|
35656
35656
|
}
|
|
@@ -35741,7 +35741,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35741
35741
|
if (typeof fn5 !== "function") throw new TypeError(`clay.live("${name}"): update() takes a function`);
|
|
35742
35742
|
if (batch) return fn5(data);
|
|
35743
35743
|
batch = [];
|
|
35744
|
-
const mark2 =
|
|
35744
|
+
const mark2 = pending8.length;
|
|
35745
35745
|
const markId = nextId3;
|
|
35746
35746
|
let result2;
|
|
35747
35747
|
try {
|
|
@@ -35751,16 +35751,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35751
35751
|
}
|
|
35752
35752
|
} catch (err) {
|
|
35753
35753
|
batch = null;
|
|
35754
|
-
|
|
35754
|
+
pending8.length = mark2;
|
|
35755
35755
|
nextId3 = markId;
|
|
35756
35756
|
rebuild();
|
|
35757
35757
|
throw err;
|
|
35758
35758
|
}
|
|
35759
35759
|
const ops = coalesce(batch);
|
|
35760
35760
|
batch = null;
|
|
35761
|
-
|
|
35761
|
+
pending8.length = mark2;
|
|
35762
35762
|
nextId3 = markId;
|
|
35763
|
-
|
|
35763
|
+
pending8.push(...ops.map((op) => ({ id: nextId3++, op })));
|
|
35764
35764
|
if (ops.length) publish2(ops);
|
|
35765
35765
|
return result2;
|
|
35766
35766
|
},
|
|
@@ -35795,11 +35795,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35795
35795
|
return lastRoom;
|
|
35796
35796
|
},
|
|
35797
35797
|
get pending() {
|
|
35798
|
-
return
|
|
35798
|
+
return pending8.map((entry) => entry.op);
|
|
35799
35799
|
},
|
|
35800
35800
|
// The same ops with their ids, for a transport that resends them.
|
|
35801
35801
|
pendingEntries() {
|
|
35802
|
-
return
|
|
35802
|
+
return pending8.map((entry) => ({ id: entry.id, op: entry.op }));
|
|
35803
35803
|
},
|
|
35804
35804
|
// The id of the newest op this store has committed (0 before the first).
|
|
35805
35805
|
get mark() {
|
|
@@ -35818,7 +35818,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35818
35818
|
// that carried them was accepted) and no newer value arrived since: they
|
|
35819
35819
|
// become part of authoritative. The value page code sees does not change.
|
|
35820
35820
|
confirm(through) {
|
|
35821
|
-
const taken2 =
|
|
35821
|
+
const taken2 = pending8.filter((entry) => entry.id <= through);
|
|
35822
35822
|
if (!taken2.length) return;
|
|
35823
35823
|
try {
|
|
35824
35824
|
authoritative = applyOps(cloneJson(authoritative), taken2.map((entry) => entry.op));
|
|
@@ -35826,7 +35826,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35826
35826
|
authoritative = cloneJson(state2);
|
|
35827
35827
|
coherent = false;
|
|
35828
35828
|
}
|
|
35829
|
-
|
|
35829
|
+
pending8 = pending8.filter((entry) => entry.id > through);
|
|
35830
35830
|
for (const fn5 of [...confirmations]) {
|
|
35831
35831
|
try {
|
|
35832
35832
|
fn5({ through });
|
|
@@ -35868,16 +35868,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
35868
35868
|
rebaseOps(ops, { source: source3 = "remote", confirmed = 0, through, frame = null, room = null, cause = null } = {}) {
|
|
35869
35869
|
const done = track(authoritative, ops);
|
|
35870
35870
|
if (!done) return false;
|
|
35871
|
-
const kept2 = through === void 0 ?
|
|
35872
|
-
const dropped =
|
|
35871
|
+
const kept2 = through === void 0 ? pending8.slice(confirmed) : pending8.filter((entry) => entry.id > through);
|
|
35872
|
+
const dropped = pending8.length - kept2.length;
|
|
35873
35873
|
const whole = done.some((rec) => rec.at === null);
|
|
35874
|
-
const own = coherent && !whole && dropped === ops.length && ops.every((op, i2) => sameOp(op,
|
|
35874
|
+
const own = coherent && !whole && dropped === ops.length && ops.every((op, i2) => sameOp(op, pending8[i2].op));
|
|
35875
35875
|
const slots = coherent && !own && dropped === 0 ? slotsOf(done, kept2, state2) : null;
|
|
35876
35876
|
if (!own && !slots) {
|
|
35877
35877
|
untrack(done);
|
|
35878
35878
|
return rebase2(applyOps(cloneJson(authoritative), ops), { source: source3, confirmed, through, frame, room, cause });
|
|
35879
35879
|
}
|
|
35880
|
-
|
|
35880
|
+
pending8 = kept2;
|
|
35881
35881
|
let changed2 = false;
|
|
35882
35882
|
for (const slot3 of slots ?? []) {
|
|
35883
35883
|
const at8 = slot3.into;
|
|
@@ -36142,8 +36142,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
36142
36142
|
}
|
|
36143
36143
|
function uniqueSaveIds(attempts) {
|
|
36144
36144
|
const ids = [];
|
|
36145
|
-
for (const
|
|
36146
|
-
const saveId =
|
|
36145
|
+
for (const attempt2 of attempts || []) {
|
|
36146
|
+
const saveId = attempt2 && attempt2.saveId;
|
|
36147
36147
|
if (typeof saveId === "string" && saveId && !ids.includes(saveId)) ids.push(saveId);
|
|
36148
36148
|
if (ids.length >= MAX_HISTORY_IDS) break;
|
|
36149
36149
|
}
|
|
@@ -36511,12 +36511,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
36511
36511
|
function unframed(name, lane) {
|
|
36512
36512
|
const store2 = entries3.get(name)?.store;
|
|
36513
36513
|
if (!store2) return [];
|
|
36514
|
-
return store2.pendingEntries().filter((
|
|
36514
|
+
return store2.pendingEntries().filter((pending8) => pending8.id > lane.framed);
|
|
36515
36515
|
}
|
|
36516
36516
|
function prune2(name, lane) {
|
|
36517
36517
|
const store2 = entries3.get(name)?.store;
|
|
36518
36518
|
if (!store2) return;
|
|
36519
|
-
const live3 = new Set(store2.pendingEntries().map((
|
|
36519
|
+
const live3 = new Set(store2.pendingEntries().map((pending8) => pending8.id));
|
|
36520
36520
|
lane.awaiting = lane.awaiting.filter((frame) => frame === flying || !frame.entries || frame.entries.some((e20) => live3.has(e20.id)));
|
|
36521
36521
|
}
|
|
36522
36522
|
const unapplied = (frame) => frame.refused === true && !frame.uncertain;
|
|
@@ -37108,17 +37108,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
37108
37108
|
pendingFrames(name, at8, { reserve = false } = {}) {
|
|
37109
37109
|
const lane = lanes2.get(name);
|
|
37110
37110
|
if (reserve && lane && clientId && epoch2 === at8?.epoch) {
|
|
37111
|
-
const
|
|
37112
|
-
while (
|
|
37111
|
+
const pending8 = unframed(name, lane);
|
|
37112
|
+
while (pending8.length) {
|
|
37113
37113
|
let size = byteSize({ name, n: lane.n + 1, ops: [], epoch: epoch2 });
|
|
37114
37114
|
let count3 = 0;
|
|
37115
|
-
while (count3 <
|
|
37116
|
-
const more = byteSize(
|
|
37115
|
+
while (count3 < pending8.length && count3 < MAX_OPS) {
|
|
37116
|
+
const more = byteSize(pending8[count3].op) + 1;
|
|
37117
37117
|
if (count3 && size + more > frameBytes) break;
|
|
37118
37118
|
size += more;
|
|
37119
37119
|
count3++;
|
|
37120
37120
|
}
|
|
37121
|
-
const take =
|
|
37121
|
+
const take = pending8.splice(0, count3);
|
|
37122
37122
|
const frame = {
|
|
37123
37123
|
n: ++lane.n,
|
|
37124
37124
|
ops: take.map((e20) => e20.op),
|
|
@@ -41865,7 +41865,7 @@ ${n3.toString()}`);
|
|
|
41865
41865
|
if (changed2) announce4();
|
|
41866
41866
|
else tellLanded(moved);
|
|
41867
41867
|
}
|
|
41868
|
-
function
|
|
41868
|
+
function request4(message2) {
|
|
41869
41869
|
return new Promise((resolve2) => {
|
|
41870
41870
|
const id2 = ++rid;
|
|
41871
41871
|
const timer = setTimeout(() => {
|
|
@@ -42000,7 +42000,7 @@ ${n3.toString()}`);
|
|
|
42000
42000
|
},
|
|
42001
42001
|
async send(_clientId, frame) {
|
|
42002
42002
|
if (room) return roomApply(clientId, frame);
|
|
42003
|
-
return await
|
|
42003
|
+
return await request4({ type: "post", frame, epoch: mirror.epoch }) || { status: 0, body: null, retryAfter: 0 };
|
|
42004
42004
|
},
|
|
42005
42005
|
// The sequencer's state, installed into the mirror first. An answer to a
|
|
42006
42006
|
// request made before the mirror changed (another state, or this tab
|
|
@@ -42008,7 +42008,7 @@ ${n3.toString()}`);
|
|
|
42008
42008
|
async fetchState(_clientId, since = null) {
|
|
42009
42009
|
if (room) return roomState(since);
|
|
42010
42010
|
const asked2 = gen;
|
|
42011
|
-
const state2 = await
|
|
42011
|
+
const state2 = await request4({ type: "state-request", since });
|
|
42012
42012
|
if (room) return roomState(since);
|
|
42013
42013
|
if (asked2 !== gen || !install10(state2)) return null;
|
|
42014
42014
|
return state2;
|
|
@@ -42092,9 +42092,9 @@ ${n3.toString()}`);
|
|
|
42092
42092
|
function captureLineage(entry, forSave) {
|
|
42093
42093
|
const base2 = entry.leftAt;
|
|
42094
42094
|
if (!base2 || base2.disk) return null;
|
|
42095
|
-
const
|
|
42096
|
-
if (!
|
|
42097
|
-
const frames = unionRanges(base2.frames ?? [],
|
|
42095
|
+
const pending8 = fast?.pendingFrames(entry.store.name, base2, { reserve: forSave }) ?? { frames: [], complete: true };
|
|
42096
|
+
if (!pending8.complete) return null;
|
|
42097
|
+
const frames = unionRanges(base2.frames ?? [], pending8.frames);
|
|
42098
42098
|
const ancestors2 = base2.ancestors ?? [];
|
|
42099
42099
|
const text6 = serializeLive(entry.store.value);
|
|
42100
42100
|
const key3 = JSON.stringify([base2.epoch, base2.seq, frames, ancestors2, entry.store.mark, text6]);
|
|
@@ -42107,9 +42107,9 @@ ${n3.toString()}`);
|
|
|
42107
42107
|
}
|
|
42108
42108
|
function pruneCaptures(entry) {
|
|
42109
42109
|
if (!entry.captureOps.size) return;
|
|
42110
|
-
const
|
|
42110
|
+
const pending8 = new Set(entry.store.pendingEntries().map((item) => item.id));
|
|
42111
42111
|
for (const [key3, captured] of entry.captureOps) {
|
|
42112
|
-
captured.ids = captured.ids.filter((id2) =>
|
|
42112
|
+
captured.ids = captured.ids.filter((id2) => pending8.has(id2));
|
|
42113
42113
|
if (!captured.ids.length) entry.captureOps.delete(key3);
|
|
42114
42114
|
}
|
|
42115
42115
|
if (![...entry.captureOps.values()].some((captured) => captured.ended)) disarm4(entry);
|
|
@@ -42117,11 +42117,11 @@ ${n3.toString()}`);
|
|
|
42117
42117
|
function heldIds(name) {
|
|
42118
42118
|
const entry = entries.get(name);
|
|
42119
42119
|
if (!entry || !entry.captureOps.size) return [];
|
|
42120
|
-
const
|
|
42120
|
+
const pending8 = new Set(entry.store.pendingEntries().map((item) => item.id));
|
|
42121
42121
|
const ids = /* @__PURE__ */ new Set();
|
|
42122
42122
|
for (const [key3, captured] of entry.captureOps) {
|
|
42123
42123
|
if (!captured.ended && !onWire(name, key3)) continue;
|
|
42124
|
-
for (const id2 of captured.ids) if (
|
|
42124
|
+
for (const id2 of captured.ids) if (pending8.has(id2)) ids.add(id2);
|
|
42125
42125
|
}
|
|
42126
42126
|
return [...ids];
|
|
42127
42127
|
}
|
|
@@ -42194,9 +42194,9 @@ ${n3.toString()}`);
|
|
|
42194
42194
|
return false;
|
|
42195
42195
|
}
|
|
42196
42196
|
function stillPending(entry) {
|
|
42197
|
-
const
|
|
42197
|
+
const pending8 = new Set(entry.store.pendingEntries().map((item) => item.id));
|
|
42198
42198
|
const target = entry.recovery.targets.find(({ name }) => name === entry.store.name);
|
|
42199
|
-
return target?.ids.some((id2) =>
|
|
42199
|
+
return target?.ids.some((id2) => pending8.has(id2)) ?? false;
|
|
42200
42200
|
}
|
|
42201
42201
|
function historyPlan(captureId) {
|
|
42202
42202
|
if (!sending || sending.captureId !== captureId || typeof sending.html !== "string") return null;
|
|
@@ -42262,10 +42262,10 @@ ${n3.toString()}`);
|
|
|
42262
42262
|
entry.recovery = record6;
|
|
42263
42263
|
}
|
|
42264
42264
|
hostSupports("save-history").then(
|
|
42265
|
-
(
|
|
42265
|
+
(supported2) => {
|
|
42266
42266
|
if (recoveries.get(captureId) !== record6) return;
|
|
42267
42267
|
plan.html = null;
|
|
42268
|
-
if (!
|
|
42268
|
+
if (!supported2) return fallBackToRoom(captureId);
|
|
42269
42269
|
record6.run = history2.start({
|
|
42270
42270
|
captureId,
|
|
42271
42271
|
html,
|
|
@@ -42291,8 +42291,8 @@ ${n3.toString()}`);
|
|
|
42291
42291
|
if (!entry || entry.recovery !== record6) continue;
|
|
42292
42292
|
entry.recovery = null;
|
|
42293
42293
|
entry.historicalRefreshPending = true;
|
|
42294
|
-
const
|
|
42295
|
-
const dropIds = target.ids.filter((id2) =>
|
|
42294
|
+
const pending8 = new Set(entry.store.pendingEntries().map((item) => item.id));
|
|
42295
|
+
const dropIds = target.ids.filter((id2) => pending8.has(id2));
|
|
42296
42296
|
entry.store.rebase(JSON.parse(target.saved), { source: "state", dropIds });
|
|
42297
42297
|
if (!fast) {
|
|
42298
42298
|
endRefresh(entry);
|
|
@@ -42601,21 +42601,21 @@ ${n3.toString()}`);
|
|
|
42601
42601
|
laneGates();
|
|
42602
42602
|
if (laneRequested || !(writerSession ? writerSession.admitted || writerSession.wantsLane : isEditMode)) return;
|
|
42603
42603
|
laneRequested = true;
|
|
42604
|
-
const
|
|
42604
|
+
const request4 = ++laneRequest;
|
|
42605
42605
|
hostSupports("live-data").then(
|
|
42606
|
-
async (
|
|
42607
|
-
const provenance =
|
|
42608
|
-
if (
|
|
42609
|
-
serverLane =
|
|
42606
|
+
async (supported2) => {
|
|
42607
|
+
const provenance = supported2 && await hostSupports("live-provenance");
|
|
42608
|
+
if (request4 !== laneRequest) return;
|
|
42609
|
+
serverLane = supported2;
|
|
42610
42610
|
provenanceHost = provenance;
|
|
42611
42611
|
const lane = await lanes().catch(() => null);
|
|
42612
|
-
if (
|
|
42612
|
+
if (request4 !== laneRequest) return;
|
|
42613
42613
|
if (!lane) {
|
|
42614
42614
|
settleLane?.(null);
|
|
42615
42615
|
settleWriter?.(null);
|
|
42616
42616
|
return;
|
|
42617
42617
|
}
|
|
42618
|
-
if (
|
|
42618
|
+
if (supported2) {
|
|
42619
42619
|
fast = lane.createFastLane(laneOptions(serverTransport()));
|
|
42620
42620
|
} else if (lane.localLaneSupported()) {
|
|
42621
42621
|
local = lane.localTransport({ seed: seedLocalRoom, rooms: true, floor: document.querySelector('meta[name="clay-page-format"]')?.getAttribute("content") });
|
|
@@ -42842,9 +42842,9 @@ ${Object.entries(inner).map(([k8, v9]) => `${serializeLive(k8)}:${serializeLive(
|
|
|
42842
42842
|
if (!captured) continue;
|
|
42843
42843
|
if (tag2.element.getAttribute("live-at") !== captured.at) continue;
|
|
42844
42844
|
if (tag2.element.getAttribute("live-by") !== saved2.by) continue;
|
|
42845
|
-
const
|
|
42845
|
+
const pending8 = new Set(entry.store.pendingEntries().map((item) => item.id));
|
|
42846
42846
|
const currentIds = new Set(captured.ids);
|
|
42847
|
-
const ids = saved2.ids.filter((id2) =>
|
|
42847
|
+
const ids = saved2.ids.filter((id2) => pending8.has(id2) && currentIds.has(id2));
|
|
42848
42848
|
if (!ids.length) continue;
|
|
42849
42849
|
saved2.qualifiedIds = ids;
|
|
42850
42850
|
qualified.set(name, ids);
|
|
@@ -43056,7 +43056,7 @@ ${Object.entries(inner).map(([k8, v9]) => `${serializeLive(k8)}:${serializeLive(
|
|
|
43056
43056
|
wireCaptureId = null;
|
|
43057
43057
|
unsentCaptureId = null;
|
|
43058
43058
|
sending = null;
|
|
43059
|
-
history2 = createSaveHistoryRecovery({ query: (
|
|
43059
|
+
history2 = createSaveHistoryRecovery({ query: (request4) => querySaveOutcome?.(request4) ?? null });
|
|
43060
43060
|
recoveries = /* @__PURE__ */ new Map();
|
|
43061
43061
|
onWire = (name, key3) => {
|
|
43062
43062
|
if (wireCaptureId === null || !isSaveInProgress()) return false;
|
|
@@ -43161,8 +43161,8 @@ ${Object.entries(inner).map(([k8, v9]) => `${serializeLive(k8)}:${serializeLive(
|
|
|
43161
43161
|
const lineage = mode3 === "file" ? lineageOf(tag2.element) : null;
|
|
43162
43162
|
const proof = parseBy(tag2.element.getAttribute("live-by"));
|
|
43163
43163
|
const resent = mode3 === "file" ? endedCapture(entry) : null;
|
|
43164
|
-
const
|
|
43165
|
-
const carried = resent ? resent[1].ids.filter((id2) =>
|
|
43164
|
+
const pending8 = entry.store.pendingEntries().map((e20) => e20.id);
|
|
43165
|
+
const carried = resent ? resent[1].ids.filter((id2) => pending8.includes(id2)) : mode3 === "file" ? pending8 : [];
|
|
43166
43166
|
const capture = mode3 === "file" && proof?.v === 2 ? proof.capture : null;
|
|
43167
43167
|
const key3 = !carried.length ? null : resent ? resent[0] : capture ? JSON.stringify(capture) : `anonymous:${++anonymousCaptures}`;
|
|
43168
43168
|
const mark2 = resent ? resent[1].mark : entry.store.mark;
|
|
@@ -51617,7 +51617,7 @@ ${Object.entries(inner).map(([k8, v9]) => `${serializeLive(k8)}:${serializeLive(
|
|
|
51617
51617
|
|
|
51618
51618
|
// src/page/rich/csv.js
|
|
51619
51619
|
function detectedDelimiter(text6) {
|
|
51620
|
-
const
|
|
51620
|
+
const counts2 = /* @__PURE__ */ new Map([[",", 0], [";", 0], [" ", 0]]);
|
|
51621
51621
|
let quoted = false;
|
|
51622
51622
|
for (let i2 = 0; i2 < text6.length; i2++) {
|
|
51623
51623
|
const ch = text6[i2];
|
|
@@ -51625,9 +51625,9 @@ ${Object.entries(inner).map(([k8, v9]) => `${serializeLive(k8)}:${serializeLive(
|
|
|
51625
51625
|
if (quoted && text6[i2 + 1] === '"') i2++;
|
|
51626
51626
|
else quoted = !quoted;
|
|
51627
51627
|
} else if (!quoted && (ch === "\r" || ch === "\n")) break;
|
|
51628
|
-
else if (!quoted &&
|
|
51628
|
+
else if (!quoted && counts2.has(ch)) counts2.set(ch, counts2.get(ch) + 1);
|
|
51629
51629
|
}
|
|
51630
|
-
return [...
|
|
51630
|
+
return [...counts2].sort((a2, b6) => b6[1] - a2[1])[0][0];
|
|
51631
51631
|
}
|
|
51632
51632
|
function parseCsv(text6, { delimiter } = {}) {
|
|
51633
51633
|
text6 = String(text6).replace(/^\uFEFF/, "");
|
|
@@ -52917,11 +52917,11 @@ ${parts.join("\n")}
|
|
|
52917
52917
|
}
|
|
52918
52918
|
if (!entry || entry.live === live3) return;
|
|
52919
52919
|
entry.live = live3;
|
|
52920
|
-
const
|
|
52920
|
+
const counts2 = markerCounts.get(entry.client) ?? markerCounts.set(entry.client, /* @__PURE__ */ new Map()).get(entry.client);
|
|
52921
52921
|
const list3 = markerClocks.get(entry.client) ?? markerClocks.set(entry.client, []).get(entry.client);
|
|
52922
|
-
const n3 = (
|
|
52923
|
-
if (n3)
|
|
52924
|
-
else
|
|
52922
|
+
const n3 = (counts2.get(entry.clock) ?? 0) + (live3 ? 1 : -1);
|
|
52923
|
+
if (n3) counts2.set(entry.clock, n3);
|
|
52924
|
+
else counts2.delete(entry.clock);
|
|
52925
52925
|
const at8 = lowerClock(list3, entry.clock);
|
|
52926
52926
|
if (live3 && n3 === 1) list3.splice(at8, 0, entry.clock);
|
|
52927
52927
|
else if (!live3 && n3 === 0) list3.splice(at8, 1);
|
|
@@ -53571,7 +53571,7 @@ ${parts.join("\n")}
|
|
|
53571
53571
|
const n3 = Math.ceil(s3.length / PART);
|
|
53572
53572
|
return Array.from({ length: n3 }, (_7, i2) => [`${key3}.${i2}.${n3}`, s3.slice(i2 * PART, (i2 + 1) * PART)]);
|
|
53573
53573
|
};
|
|
53574
|
-
const
|
|
53574
|
+
const put4 = (key3, bytes3) => {
|
|
53575
53575
|
canCompact = true;
|
|
53576
53576
|
known2.add(key3);
|
|
53577
53577
|
own.add(key3);
|
|
@@ -53623,7 +53623,7 @@ ${parts.join("\n")}
|
|
|
53623
53623
|
} else if (mode3 === "host") {
|
|
53624
53624
|
outbox.push(u4);
|
|
53625
53625
|
flushOutbox();
|
|
53626
|
-
} else
|
|
53626
|
+
} else put4(nextKey2("u"), u4);
|
|
53627
53627
|
};
|
|
53628
53628
|
ydoc.on("updateV2", onUpdate);
|
|
53629
53629
|
const applyKey = (k8, v9) => {
|
|
@@ -53682,7 +53682,7 @@ ${parts.join("\n")}
|
|
|
53682
53682
|
if (mode3 === "host") {
|
|
53683
53683
|
outbox = [];
|
|
53684
53684
|
putWhole(nextKey2("r"), diff);
|
|
53685
|
-
} else
|
|
53685
|
+
} else put4(nextKey2("r"), diff);
|
|
53686
53686
|
wantReconcile = false;
|
|
53687
53687
|
reconcilePending = false;
|
|
53688
53688
|
return true;
|
|
@@ -53849,7 +53849,7 @@ ${parts.join("\n")}
|
|
|
53849
53849
|
if (stopped2 || mode3 !== "legacy" || !outbox.length) return;
|
|
53850
53850
|
const update2 = outbox.length === 1 ? outbox[0] : Tn(outbox);
|
|
53851
53851
|
outbox = [];
|
|
53852
|
-
|
|
53852
|
+
put4(nextKey2("u"), update2);
|
|
53853
53853
|
}, 0);
|
|
53854
53854
|
}
|
|
53855
53855
|
const ops = ev.source === "remote" && ev.frame ? ev.frame.ops : null;
|
|
@@ -55965,15 +55965,15 @@ ${parts.join("\n")}
|
|
|
55965
55965
|
}
|
|
55966
55966
|
if (actions.length) {
|
|
55967
55967
|
const row = bevelBox("div", ["display:flex", "flex-wrap:wrap", "gap:8px"]);
|
|
55968
|
-
for (const { label, onClick:
|
|
55969
|
-
row.append(bevelButton(label, { small: true, variant: "quiet", onClick:
|
|
55968
|
+
for (const { label, onClick: onClick3 } of actions) {
|
|
55969
|
+
row.append(bevelButton(label, { small: true, variant: "quiet", onClick: onClick3 }));
|
|
55970
55970
|
}
|
|
55971
55971
|
body2.append(row);
|
|
55972
55972
|
}
|
|
55973
55973
|
el13.append(body2);
|
|
55974
55974
|
return el13;
|
|
55975
55975
|
}
|
|
55976
|
-
function closeButton(
|
|
55976
|
+
function closeButton(onClick3) {
|
|
55977
55977
|
const b6 = bevelBox("button", [
|
|
55978
55978
|
"flex:none",
|
|
55979
55979
|
"display:inline-grid",
|
|
@@ -55986,22 +55986,22 @@ ${parts.join("\n")}
|
|
|
55986
55986
|
b6.title = "Dismiss";
|
|
55987
55987
|
b6.innerHTML = CLOSE_ICON;
|
|
55988
55988
|
protectIcon(b6.firstElementChild, 14);
|
|
55989
|
-
const
|
|
55989
|
+
const paint3 = (lit) => {
|
|
55990
55990
|
set(b6, "color", lit ? TOKENS2.ink : TOKENS2.muted);
|
|
55991
55991
|
set(b6, "background", lit ? TOKENS2.sunk : "transparent");
|
|
55992
55992
|
};
|
|
55993
|
-
b6.addEventListener("pointerenter", () =>
|
|
55994
|
-
b6.addEventListener("pointerleave", () =>
|
|
55993
|
+
b6.addEventListener("pointerenter", () => paint3(true));
|
|
55994
|
+
b6.addEventListener("pointerleave", () => paint3(false));
|
|
55995
55995
|
b6.addEventListener("focus", () => {
|
|
55996
|
-
|
|
55996
|
+
paint3(true);
|
|
55997
55997
|
set(b6, "outline", `2px solid ${TOKENS2.brass}`);
|
|
55998
55998
|
set(b6, "outline-offset", "1px");
|
|
55999
55999
|
});
|
|
56000
56000
|
b6.addEventListener("blur", () => {
|
|
56001
|
-
|
|
56001
|
+
paint3(false);
|
|
56002
56002
|
set(b6, "outline", "none");
|
|
56003
56003
|
});
|
|
56004
|
-
b6.addEventListener("click",
|
|
56004
|
+
b6.addEventListener("click", onClick3);
|
|
56005
56005
|
return b6;
|
|
56006
56006
|
}
|
|
56007
56007
|
function reveal(el13) {
|
|
@@ -56266,11 +56266,11 @@ ${parts.join("\n")}
|
|
|
56266
56266
|
MAX_SPEED = 18;
|
|
56267
56267
|
visibles = /* @__PURE__ */ new WeakMap();
|
|
56268
56268
|
BlockDrag = class {
|
|
56269
|
-
constructor(view3, grip, { index, onClick:
|
|
56269
|
+
constructor(view3, grip, { index, onClick: onClick3 }) {
|
|
56270
56270
|
this.view = view3;
|
|
56271
56271
|
this.grip = grip;
|
|
56272
56272
|
this.index = index;
|
|
56273
|
-
this.onClick =
|
|
56273
|
+
this.onClick = onClick3;
|
|
56274
56274
|
this.shell = view3.dom.parentElement;
|
|
56275
56275
|
this.line = document.createElement("div");
|
|
56276
56276
|
this.line.className = "page-drop";
|
|
@@ -56639,7 +56639,7 @@ ${parts.join("\n")}
|
|
|
56639
56639
|
view3.focus();
|
|
56640
56640
|
});
|
|
56641
56641
|
input.addEventListener("cancel", () => view3.dispatch(view3.state.tr.setMeta(mediaKey, { picker: null })));
|
|
56642
|
-
const
|
|
56642
|
+
const onClick3 = (e20) => {
|
|
56643
56643
|
const b6 = e20.target.closest?.(".page-upload-btn");
|
|
56644
56644
|
if (!b6) return;
|
|
56645
56645
|
e20.preventDefault();
|
|
@@ -56649,10 +56649,10 @@ ${parts.join("\n")}
|
|
|
56649
56649
|
else if (b6.dataset.act === "embed") part?.embedUpload(view3, id2);
|
|
56650
56650
|
else part?.cancelUpload(view3, id2);
|
|
56651
56651
|
};
|
|
56652
|
-
view3.dom.addEventListener("click",
|
|
56652
|
+
view3.dom.addEventListener("click", onClick3);
|
|
56653
56653
|
return {
|
|
56654
56654
|
destroy() {
|
|
56655
|
-
view3.dom.removeEventListener("click",
|
|
56655
|
+
view3.dom.removeEventListener("click", onClick3);
|
|
56656
56656
|
const rt10 = mediaRuntime.get(view3);
|
|
56657
56657
|
mediaRuntime.delete(view3);
|
|
56658
56658
|
for (const it8 of mediaKey.getState(view3.state).items) if (it8.preview) URL.revokeObjectURL?.(it8.preview);
|
|
@@ -56825,7 +56825,7 @@ ${parts.join("\n")}
|
|
|
56825
56825
|
markParts(b6, theme2, allNames);
|
|
56826
56826
|
markParts(b6.firstElementChild, theme2, icon2);
|
|
56827
56827
|
const flags = { hover: false, focus: false, pressed: false };
|
|
56828
|
-
const
|
|
56828
|
+
const paint3 = () => {
|
|
56829
56829
|
const act = { hover: flags.hover, active: flags.pressed, focus: flags.focus };
|
|
56830
56830
|
const svg4 = b6.firstElementChild;
|
|
56831
56831
|
svg4.style.cssText = "";
|
|
@@ -56841,32 +56841,32 @@ ${parts.join("\n")}
|
|
|
56841
56841
|
};
|
|
56842
56842
|
b6.addEventListener("pointerenter", () => {
|
|
56843
56843
|
flags.hover = true;
|
|
56844
|
-
|
|
56844
|
+
paint3();
|
|
56845
56845
|
});
|
|
56846
56846
|
b6.addEventListener("pointerleave", () => {
|
|
56847
56847
|
flags.hover = false;
|
|
56848
56848
|
flags.pressed = false;
|
|
56849
|
-
|
|
56849
|
+
paint3();
|
|
56850
56850
|
});
|
|
56851
56851
|
b6.addEventListener("pointerdown", (e20) => {
|
|
56852
56852
|
if (e20.button !== void 0 && e20.button !== 0) return;
|
|
56853
56853
|
flags.pressed = true;
|
|
56854
|
-
|
|
56854
|
+
paint3();
|
|
56855
56855
|
});
|
|
56856
56856
|
b6.addEventListener("pointerup", () => {
|
|
56857
56857
|
flags.pressed = false;
|
|
56858
|
-
|
|
56858
|
+
paint3();
|
|
56859
56859
|
});
|
|
56860
56860
|
b6.addEventListener("focus", () => {
|
|
56861
56861
|
flags.focus = true;
|
|
56862
|
-
|
|
56862
|
+
paint3();
|
|
56863
56863
|
});
|
|
56864
56864
|
b6.addEventListener("blur", () => {
|
|
56865
56865
|
flags.focus = false;
|
|
56866
56866
|
flags.pressed = false;
|
|
56867
|
-
|
|
56867
|
+
paint3();
|
|
56868
56868
|
});
|
|
56869
|
-
|
|
56869
|
+
paint3();
|
|
56870
56870
|
return b6;
|
|
56871
56871
|
}
|
|
56872
56872
|
function bevelDialog({ zIndex = "100", width = "600px", closable = false, titled = false, theme: theme2 = null, surface = "modal" } = {}) {
|
|
@@ -57320,10 +57320,10 @@ ${parts.join("\n")}
|
|
|
57320
57320
|
this.scrollBehaviour("enable");
|
|
57321
57321
|
this.config.onClose(this.modal, this.activeElement, event);
|
|
57322
57322
|
}
|
|
57323
|
-
scrollBehaviour(
|
|
57323
|
+
scrollBehaviour(toggle3) {
|
|
57324
57324
|
if (!this.config.disableScroll) return;
|
|
57325
57325
|
const body2 = document.querySelector("body");
|
|
57326
|
-
switch (
|
|
57326
|
+
switch (toggle3) {
|
|
57327
57327
|
case "enable":
|
|
57328
57328
|
Object.assign(body2.style, { overflow: "" });
|
|
57329
57329
|
break;
|
|
@@ -58922,10 +58922,10 @@ ${parts.join("\n")}
|
|
|
58922
58922
|
const from = start10 + prefix.length;
|
|
58923
58923
|
if (!opensAt(st10, from)) return null;
|
|
58924
58924
|
if (trailingBackslashes(all.slice(0, all.length - close.length)) % 2) return null;
|
|
58925
|
-
const
|
|
58926
|
-
if (
|
|
58925
|
+
const pending8 = all.length - (end2 - start10);
|
|
58926
|
+
if (pending8 < 0) return null;
|
|
58927
58927
|
const tr4 = st10.tr;
|
|
58928
|
-
if (
|
|
58928
|
+
if (pending8) tr4.insertText(all.slice(-pending8), end2, end2);
|
|
58929
58929
|
const bodyStart = from + open4.length;
|
|
58930
58930
|
const bodyEnd = bodyStart + body2.length;
|
|
58931
58931
|
tr4.delete(bodyEnd, start10 + all.length);
|
|
@@ -59151,16 +59151,16 @@ ${parts.join("\n")}
|
|
|
59151
59151
|
return new Oi2.Plugin({
|
|
59152
59152
|
view(editorView) {
|
|
59153
59153
|
let doc = null;
|
|
59154
|
-
const
|
|
59154
|
+
const refresh3 = () => {
|
|
59155
59155
|
doc = editorView.state.doc;
|
|
59156
59156
|
refreshDocumentTitle(editorView);
|
|
59157
59157
|
};
|
|
59158
59158
|
adoptAuthoredTitle(editorView);
|
|
59159
|
-
|
|
59159
|
+
refresh3();
|
|
59160
59160
|
return {
|
|
59161
59161
|
update(next) {
|
|
59162
59162
|
if (next.state.doc === doc) return;
|
|
59163
|
-
|
|
59163
|
+
refresh3();
|
|
59164
59164
|
}
|
|
59165
59165
|
};
|
|
59166
59166
|
}
|
|
@@ -59171,7 +59171,7 @@ ${parts.join("\n")}
|
|
|
59171
59171
|
if (!head) return { refresh: () => refreshDocumentTitle(view3), dispose() {
|
|
59172
59172
|
} };
|
|
59173
59173
|
let queued3 = false;
|
|
59174
|
-
const
|
|
59174
|
+
const refresh3 = () => {
|
|
59175
59175
|
if (queued3) return;
|
|
59176
59176
|
queued3 = true;
|
|
59177
59177
|
queueMicrotask(() => {
|
|
@@ -59179,10 +59179,10 @@ ${parts.join("\n")}
|
|
|
59179
59179
|
refreshDocumentTitle(view3);
|
|
59180
59180
|
});
|
|
59181
59181
|
};
|
|
59182
|
-
const observer3 = new MutationObserver(
|
|
59182
|
+
const observer3 = new MutationObserver(refresh3);
|
|
59183
59183
|
observer3.observe(head, { childList: true, characterData: true, subtree: true, attributeFilter: ["content", "name"] });
|
|
59184
59184
|
refreshDocumentTitle(view3);
|
|
59185
|
-
return { refresh:
|
|
59185
|
+
return { refresh: refresh3, dispose() {
|
|
59186
59186
|
observer3.disconnect();
|
|
59187
59187
|
} };
|
|
59188
59188
|
}
|
|
@@ -59568,13 +59568,13 @@ ${parts.join("\n")}
|
|
|
59568
59568
|
return { kind: "delete", blockId: $from.depth ? $from.node(1).attrs.id : null, direction: mark2.direction, from: step.from, to: step.to, at: mark2.at };
|
|
59569
59569
|
}
|
|
59570
59570
|
function intentOf(transactions, view3 = null) {
|
|
59571
|
-
const
|
|
59571
|
+
const pending8 = view3 ? takePendingDelete(view3) : null;
|
|
59572
59572
|
const primary = transactions.filter((t2) => !t2.getMeta(DERIVED));
|
|
59573
59573
|
if (primary.length !== 1) return null;
|
|
59574
59574
|
const tr4 = primary[0];
|
|
59575
59575
|
const composition = tr4.getMeta("composition");
|
|
59576
59576
|
if (composition != null) return { kind: "compose", id: composition, at: Date.now() };
|
|
59577
|
-
return tr4.getMeta(HISTORY_INTENT) ?? deletionIntent(tr4,
|
|
59577
|
+
return tr4.getMeta(HISTORY_INTENT) ?? deletionIntent(tr4, pending8);
|
|
59578
59578
|
}
|
|
59579
59579
|
function historyIntentPlugin() {
|
|
59580
59580
|
return new Oi2.Plugin({
|
|
@@ -59615,7 +59615,7 @@ ${parts.join("\n")}
|
|
|
59615
59615
|
// src/page/feature-loader.js
|
|
59616
59616
|
function createFeatureLoader({ load: load4, install: install10, reportError = (error2) => console.error("clayjs: an editor feature failed to load", error2) }) {
|
|
59617
59617
|
const installed6 = /* @__PURE__ */ new Map();
|
|
59618
|
-
const
|
|
59618
|
+
const pending8 = /* @__PURE__ */ new Map();
|
|
59619
59619
|
const prepared = /* @__PURE__ */ new Map();
|
|
59620
59620
|
let disposed = false;
|
|
59621
59621
|
function prepare2(id2) {
|
|
@@ -59638,7 +59638,7 @@ ${parts.join("\n")}
|
|
|
59638
59638
|
function ensure2(id2, { signal } = {}) {
|
|
59639
59639
|
if (disposed) return Promise.reject(new Error(`page: feature loader disposed before ${id2}`));
|
|
59640
59640
|
if (installed6.has(id2)) return Promise.resolve(installed6.get(id2));
|
|
59641
|
-
let shared =
|
|
59641
|
+
let shared = pending8.get(id2);
|
|
59642
59642
|
if (!shared) {
|
|
59643
59643
|
shared = loadFor(id2).then((mod) => disposed ? null : Promise.resolve(install10(id2, mod))).then((feature) => {
|
|
59644
59644
|
if (disposed) {
|
|
@@ -59650,8 +59650,8 @@ ${parts.join("\n")}
|
|
|
59650
59650
|
});
|
|
59651
59651
|
shared.catch((error2) => {
|
|
59652
59652
|
if (!disposed) reportError(error2, id2);
|
|
59653
|
-
}).finally(() =>
|
|
59654
|
-
|
|
59653
|
+
}).finally(() => pending8.delete(id2));
|
|
59654
|
+
pending8.set(id2, shared);
|
|
59655
59655
|
}
|
|
59656
59656
|
if (!signal) return shared;
|
|
59657
59657
|
if (signal.aborted) return Promise.reject(signal.reason);
|
|
@@ -59669,7 +59669,7 @@ ${parts.join("\n")}
|
|
|
59669
59669
|
disposed = true;
|
|
59670
59670
|
for (const feature of installed6.values()) feature?.dispose?.();
|
|
59671
59671
|
installed6.clear();
|
|
59672
|
-
|
|
59672
|
+
pending8.clear();
|
|
59673
59673
|
prepared.clear();
|
|
59674
59674
|
}
|
|
59675
59675
|
};
|
|
@@ -62462,21 +62462,21 @@ ${INDENTS.map((n3) => `:where(article[data-page], .page-editor) .page-li[data-in
|
|
|
62462
62462
|
}
|
|
62463
62463
|
function orderedMarkers(ents) {
|
|
62464
62464
|
const out = /* @__PURE__ */ new Map();
|
|
62465
|
-
let
|
|
62465
|
+
let counts2 = [];
|
|
62466
62466
|
ents.forEach((e20, i2) => {
|
|
62467
62467
|
if (!isList2(e20.node)) {
|
|
62468
|
-
|
|
62468
|
+
counts2 = [];
|
|
62469
62469
|
return;
|
|
62470
62470
|
}
|
|
62471
|
-
if (i2 > 0 && !sameRun(ents[i2 - 1], e20))
|
|
62471
|
+
if (i2 > 0 && !sameRun(ents[i2 - 1], e20)) counts2 = [];
|
|
62472
62472
|
const d2 = e20.node.attrs.indent;
|
|
62473
|
-
|
|
62473
|
+
counts2.length = d2 + 1;
|
|
62474
62474
|
if (e20.node.attrs.kind !== "ordered") {
|
|
62475
|
-
|
|
62475
|
+
counts2[d2] = 0;
|
|
62476
62476
|
return;
|
|
62477
62477
|
}
|
|
62478
|
-
|
|
62479
|
-
const n3 =
|
|
62478
|
+
counts2[d2] = (counts2[d2] || 0) + 1;
|
|
62479
|
+
const n3 = counts2[d2];
|
|
62480
62480
|
out.set(i2, `${d2 % 3 === 0 ? n3 : d2 % 3 === 1 ? ALPHA(n3) : ROMAN(n3)}.`);
|
|
62481
62481
|
});
|
|
62482
62482
|
return out;
|
|
@@ -67415,13 +67415,13 @@ ${text6}`;
|
|
|
67415
67415
|
return list3;
|
|
67416
67416
|
}
|
|
67417
67417
|
function emojiLibrary(load4 = () => Promise.resolve().then(() => (init_emoji_data(), emoji_data_exports))) {
|
|
67418
|
-
let
|
|
67418
|
+
let pending8 = null;
|
|
67419
67419
|
return () => {
|
|
67420
|
-
|
|
67421
|
-
|
|
67420
|
+
pending8 ??= Promise.resolve().then(() => load4()).then((mod) => emojiEntries(mod.EMOJI)).catch((error2) => {
|
|
67421
|
+
pending8 = null;
|
|
67422
67422
|
throw error2;
|
|
67423
67423
|
});
|
|
67424
|
-
return
|
|
67424
|
+
return pending8;
|
|
67425
67425
|
};
|
|
67426
67426
|
}
|
|
67427
67427
|
function createFeature7({ view: view3 = null, load: load4 = () => Promise.resolve().then(() => (init_emoji_data(), emoji_data_exports)) } = {}) {
|
|
@@ -68687,7 +68687,7 @@ ${text6}`;
|
|
|
68687
68687
|
if (view3.dom.getAttribute("aria-activedescendant")?.startsWith(`${s3.picker.el.id}-`)) view3.dom.removeAttribute("aria-activedescendant");
|
|
68688
68688
|
s3.picker.destroy();
|
|
68689
68689
|
}
|
|
68690
|
-
function
|
|
68690
|
+
function refresh3() {
|
|
68691
68691
|
const s3 = session10;
|
|
68692
68692
|
if (!s3 || view3.composing) return;
|
|
68693
68693
|
const at8 = bookmark(s3);
|
|
@@ -68763,9 +68763,9 @@ ${text6}`;
|
|
|
68763
68763
|
s3.listen.push([target, type, fn5, options]);
|
|
68764
68764
|
};
|
|
68765
68765
|
listen3(doc, "keydown", (event) => key3(event), true);
|
|
68766
|
-
listen3(view3.dom, "input", () =>
|
|
68767
|
-
listen3(view3.dom, "keyup", () =>
|
|
68768
|
-
listen3(view3.dom, "compositionend", () =>
|
|
68766
|
+
listen3(view3.dom, "input", () => refresh3());
|
|
68767
|
+
listen3(view3.dom, "keyup", () => refresh3());
|
|
68768
|
+
listen3(view3.dom, "compositionend", () => refresh3());
|
|
68769
68769
|
listen3(doc, "mousedown", (event) => {
|
|
68770
68770
|
if (!s3.picker.el.contains(event.target)) close();
|
|
68771
68771
|
}, true);
|
|
@@ -71790,10 +71790,10 @@ Please report this to https://github.com/markedjs/marked.`, r45) {
|
|
|
71790
71790
|
};
|
|
71791
71791
|
parts.push(line("page-menu-title", s3.error ? "Couldn't read that Markdown" : `Import ${s3.name}`));
|
|
71792
71792
|
if (!s3.error) {
|
|
71793
|
-
const
|
|
71794
|
-
if (s3.unsupported.length)
|
|
71795
|
-
if (s3.refused.length)
|
|
71796
|
-
parts.push(line("page-menu-title page-import-summary",
|
|
71793
|
+
const counts2 = [`${s3.count} block${s3.count === 1 ? "" : "s"}`];
|
|
71794
|
+
if (s3.unsupported.length) counts2.push(`${s3.unsupported.length} kept as written`);
|
|
71795
|
+
if (s3.refused.length) counts2.push(`${s3.refused.length} address${s3.refused.length === 1 ? "" : "es"} left out`);
|
|
71796
|
+
parts.push(line("page-menu-title page-import-summary", counts2.join(" \xB7 ")));
|
|
71797
71797
|
}
|
|
71798
71798
|
const rows2 = (className, list3) => {
|
|
71799
71799
|
const box = doc.createElement("div");
|
|
@@ -71838,9 +71838,9 @@ Please report this to https://github.com/markedjs/marked.`, r45) {
|
|
|
71838
71838
|
let at8 = 0;
|
|
71839
71839
|
for (let i2 = 0; i2 < index; i2++) at8 += doc2.child(i2).nodeSize;
|
|
71840
71840
|
const next = doc2.maybeChild(index + 1);
|
|
71841
|
-
const
|
|
71842
|
-
const cut2 = target.textblock && !
|
|
71843
|
-
const replace3 = cut2 || target.textblock && !
|
|
71841
|
+
const toggle3 = node.type.name === "toggle";
|
|
71842
|
+
const cut2 = target.textblock && !toggle3 && node.content.size > 0;
|
|
71843
|
+
const replace3 = cut2 || target.textblock && !toggle3 && node.content.size === 0;
|
|
71844
71844
|
const fromOff = cut2 ? Math.min(target.fromOff, node.content.size) : 0;
|
|
71845
71845
|
const toOff = cut2 ? Math.min(Math.max(fromOff, target.toOff), node.content.size) : 0;
|
|
71846
71846
|
const head = cut2 && fromOff > 0 ? node.type.create({ ...node.attrs }, node.content.cut(0, fromOff)) : null;
|
|
@@ -71848,13 +71848,13 @@ Please report this to https://github.com/markedjs/marked.`, r45) {
|
|
|
71848
71848
|
const tail = tailContent && tailContent.size ? node.type.create({ ...node.attrs, id: newId2(), pos: null }, tailContent) : null;
|
|
71849
71849
|
const lower = cut2 && !head ? index > 0 ? doc2.child(index - 1).attrs.pos : null : node.attrs.pos;
|
|
71850
71850
|
const keys2 = keysBetween(lower, next?.attrs.pos ?? null, nodes.length + (tail ? 1 : 0));
|
|
71851
|
-
const parent =
|
|
71851
|
+
const parent = toggle3 ? node.attrs.id : node.attrs.parent ?? null;
|
|
71852
71852
|
const placed2 = nodes.map((one, i2) => one.type.create({ ...one.attrs, pos: keys2[i2], parent }, one.content, one.marks));
|
|
71853
71853
|
const last = tail ? tail.type.create({ ...tail.attrs, pos: keys2[nodes.length] }, tail.content, tail.marks) : null;
|
|
71854
71854
|
const tr4 = st10.tr;
|
|
71855
71855
|
if (replace3) tr4.replaceWith(at8, at8 + node.nodeSize, [...head ? [head] : [], ...placed2, ...last ? [last] : []]);
|
|
71856
71856
|
else tr4.insert(at8 + node.nodeSize, placed2);
|
|
71857
|
-
if (
|
|
71857
|
+
if (toggle3 && !node.attrs.open && placed2.length > 0) tr4.setNodeMarkup(at8, null, { ...node.attrs, open: true });
|
|
71858
71858
|
let end2 = at8 + (replace3 ? head ? head.nodeSize : 0 : node.nodeSize);
|
|
71859
71859
|
for (const one of placed2) end2 += one.nodeSize;
|
|
71860
71860
|
tr4.setSelection(Oi2.TextSelection.near(tr4.doc.resolve(last ? end2 : Math.max(0, end2 - 1)), last ? 1 : -1));
|
|
@@ -72393,10 +72393,10 @@ ${mark2}`;
|
|
|
72393
72393
|
return el13;
|
|
72394
72394
|
};
|
|
72395
72395
|
parts.push(line("page-menu-title", "Export as Markdown"));
|
|
72396
|
-
const
|
|
72397
|
-
if (s3.report.extensions.length)
|
|
72398
|
-
if (s3.report.losses.length)
|
|
72399
|
-
parts.push(line("page-menu-title page-export-summary",
|
|
72396
|
+
const counts2 = [`${s3.report.blocks} block${s3.report.blocks === 1 ? "" : "s"}`];
|
|
72397
|
+
if (s3.report.extensions.length) counts2.push(`${s3.report.extensions.length} kept as HTML`);
|
|
72398
|
+
if (s3.report.losses.length) counts2.push(`${s3.report.losses.length} lost`);
|
|
72399
|
+
parts.push(line("page-menu-title page-export-summary", counts2.join(" \xB7 ")));
|
|
72400
72400
|
const section = (className, label, list3) => {
|
|
72401
72401
|
if (!list3.length) return;
|
|
72402
72402
|
const box = doc.createElement("div");
|
|
@@ -72623,7 +72623,7 @@ ${mark2}`;
|
|
|
72623
72623
|
"page-full": "blocked",
|
|
72624
72624
|
"compaction-failed": "blocked"
|
|
72625
72625
|
});
|
|
72626
|
-
pageStateFor = ({ unavailable: unavailable2, pending:
|
|
72626
|
+
pageStateFor = ({ unavailable: unavailable2, pending: pending8, journaled, acknowledged, checkpointed } = {}) => unavailable2 ? "unavailable" : pending8 > 0 ? "pending" : journaled > 0 ? "journaled" : acknowledged > 0 ? "acknowledged" : checkpointed ? "checkpointed" : null;
|
|
72627
72627
|
BLOCKED_TEXT = "Can't save here. Your edits are still in this tab.";
|
|
72628
72628
|
RETRY_TEXT2 = "Still trying to save. Your edits are safe in this tab.";
|
|
72629
72629
|
}
|
|
@@ -73614,12 +73614,12 @@ ${mark2}`;
|
|
|
73614
73614
|
if (!tr4) return null;
|
|
73615
73615
|
view3.dispatch(tr4);
|
|
73616
73616
|
view3.dispatch(Ws2.closeHistory(view3.state.tr));
|
|
73617
|
-
const
|
|
73617
|
+
const counts2 = { edited: plan.edited.size, created: plan.created.size, deleted: plan.deleted.length, moved: plan.reordered };
|
|
73618
73618
|
const { displaced: displaced2 } = tr4.getMeta(ADOPT);
|
|
73619
|
-
if (Object.keys(displaced2).length)
|
|
73620
|
-
if (lost.length)
|
|
73621
|
-
if (copy13)
|
|
73622
|
-
return
|
|
73619
|
+
if (Object.keys(displaced2).length) counts2.displaced = displaced2;
|
|
73620
|
+
if (lost.length) counts2.conflicts = lost;
|
|
73621
|
+
if (copy13) counts2.copy = copy13;
|
|
73622
|
+
return counts2;
|
|
73623
73623
|
}
|
|
73624
73624
|
async function adopt7(file) {
|
|
73625
73625
|
if (mergeTagless && !file.tags.length) return adoptTagless(file);
|
|
@@ -73638,10 +73638,10 @@ ${mark2}`;
|
|
|
73638
73638
|
if (waited !== "ready") return TIMED_OUT;
|
|
73639
73639
|
if (!isAdopter()) return REFUSED2;
|
|
73640
73640
|
const blocks = blockMap(view3.state.doc);
|
|
73641
|
-
const
|
|
73642
|
-
if (!
|
|
73641
|
+
const counts2 = land2(blocks, readBack(blocks, doc), found.baseItems, found.parsed);
|
|
73642
|
+
if (!counts2) return UNCHANGED;
|
|
73643
73643
|
adopted(found.A);
|
|
73644
|
-
return landed(
|
|
73644
|
+
return landed(counts2);
|
|
73645
73645
|
} finally {
|
|
73646
73646
|
release3();
|
|
73647
73647
|
}
|
|
@@ -73670,13 +73670,13 @@ ${mark2}`;
|
|
|
73670
73670
|
const current5 = readBack(blocks, doc);
|
|
73671
73671
|
const known2 = new Map(current5.map((item) => [item.id, item]));
|
|
73672
73672
|
const parse2 = (article) => parseModel(article, { seed: article.getAttribute("data-rev") ?? "", known: known2 });
|
|
73673
|
-
const
|
|
73674
|
-
return
|
|
73673
|
+
const counts2 = land2(blocks, current5, parse2(base2), parse2(file.article));
|
|
73674
|
+
return counts2 ? landed(counts2) : UNCHANGED;
|
|
73675
73675
|
} finally {
|
|
73676
73676
|
release3();
|
|
73677
73677
|
}
|
|
73678
73678
|
}
|
|
73679
|
-
async function
|
|
73679
|
+
async function attempt2(file) {
|
|
73680
73680
|
try {
|
|
73681
73681
|
return await adopt7(file);
|
|
73682
73682
|
} catch (error2) {
|
|
@@ -73686,7 +73686,7 @@ ${mark2}`;
|
|
|
73686
73686
|
}
|
|
73687
73687
|
let bootOutcome = null;
|
|
73688
73688
|
function run5(file, boot3 = false) {
|
|
73689
|
-
queue2 = queue2.then(() =>
|
|
73689
|
+
queue2 = queue2.then(() => attempt2(file)).then((outcome2) => {
|
|
73690
73690
|
if (boot3) bootOutcome = outcome2;
|
|
73691
73691
|
if (!outcome2.ok || outcome2.outcome !== "adopted") return outcome2;
|
|
73692
73692
|
requestCheckpoint2();
|
|
@@ -73754,7 +73754,7 @@ ${mark2}`;
|
|
|
73754
73754
|
TIMED_OUT = { ok: false, outcome: "refused", reason: "adoption-timeout" };
|
|
73755
73755
|
FAILED = { ok: false, outcome: "error", reason: "adoption-error" };
|
|
73756
73756
|
AWAITED = { ok: true, outcome: "writer-adopts" };
|
|
73757
|
-
landed = (
|
|
73757
|
+
landed = (counts2) => ({ ok: true, outcome: "adopted", counts: counts2 });
|
|
73758
73758
|
ADOPTION_TIMEOUT_MS = 1e4;
|
|
73759
73759
|
}
|
|
73760
73760
|
});
|
|
@@ -75449,7 +75449,7 @@ ${b6}`);
|
|
|
75449
75449
|
const from = before.resolve(d2.start).index(0), to4 = Math.min(before.childCount - 1, before.resolve(d2.endA).index(0));
|
|
75450
75450
|
for (let i2 = from; i2 <= to4; i2++) nodes.delete(w6.visible[i2]);
|
|
75451
75451
|
};
|
|
75452
|
-
const
|
|
75452
|
+
const refresh3 = () => {
|
|
75453
75453
|
const change = walkNow();
|
|
75454
75454
|
if (!change || change.deleted || change.fields.size || change.remote && w6.hidden.length) bumpRecovery();
|
|
75455
75455
|
else if (stats2.proveWalks) proveRecovery();
|
|
@@ -75463,7 +75463,7 @@ ${b6}`);
|
|
|
75463
75463
|
stats2.renders++;
|
|
75464
75464
|
const keep3 = saved2;
|
|
75465
75465
|
saved2 = null;
|
|
75466
|
-
const derived2 = keepViewPos(fresh ??
|
|
75466
|
+
const derived2 = keepViewPos(fresh ?? refresh3(), view3.state.doc);
|
|
75467
75467
|
const d2 = docDiff(view3.state.doc, derived2);
|
|
75468
75468
|
if (!d2) {
|
|
75469
75469
|
adopt7(view3.state.doc);
|
|
@@ -75589,7 +75589,7 @@ ${b6}`);
|
|
|
75589
75589
|
view3.dispatch(tr4.scrolledIntoView ? reselect.scrollIntoView() : reselect);
|
|
75590
75590
|
return result2;
|
|
75591
75591
|
};
|
|
75592
|
-
const board = createBoardCommands({ pd, um, origins, render: () => view3 ? render4() :
|
|
75592
|
+
const board = createBoardCommands({ pd, um, origins, render: () => view3 ? render4() : refresh3() });
|
|
75593
75593
|
pd.ydoc.on("beforeTransaction", stale4);
|
|
75594
75594
|
pd.ydoc.on("beforeTransaction", onBefore);
|
|
75595
75595
|
pd.ydoc.on("afterTransaction", onTransaction);
|
|
@@ -75675,7 +75675,7 @@ ${b6}`);
|
|
|
75675
75675
|
groupOpen = intent !== null;
|
|
75676
75676
|
const current5 = view3.state.doc;
|
|
75677
75677
|
forget(local3[0].before, current5);
|
|
75678
|
-
const derived2 =
|
|
75678
|
+
const derived2 = refresh3();
|
|
75679
75679
|
if (!sameBareShape(derived2, current5)) {
|
|
75680
75680
|
stats2.mismatch++;
|
|
75681
75681
|
stats2.first ??= { before: bareShape(local3[0].before), pm: bareShape(current5), y: bareShape(derived2) };
|
|
@@ -77471,10 +77471,10 @@ ${b6}`);
|
|
|
77471
77471
|
return { ok: false, code: "error" };
|
|
77472
77472
|
}
|
|
77473
77473
|
}
|
|
77474
|
-
const rowButton = (label,
|
|
77474
|
+
const rowButton = (label, onClick3) => {
|
|
77475
77475
|
const node = el10(doc, "button", "", { type: "button" });
|
|
77476
77476
|
node.textContent = label;
|
|
77477
|
-
node.addEventListener("click",
|
|
77477
|
+
node.addEventListener("click", onClick3);
|
|
77478
77478
|
return node;
|
|
77479
77479
|
};
|
|
77480
77480
|
function draw() {
|
|
@@ -77560,7 +77560,7 @@ ${b6}`);
|
|
|
77560
77560
|
const text6 = found.text || kept2 || "";
|
|
77561
77561
|
const covered2 = journal?.covers ? journal.covers(found.blockId, text6) : false;
|
|
77562
77562
|
holder2.clear({ blockId: found.blockId, text: text6, covered: covered2 }).then((receipt3) => {
|
|
77563
|
-
if (receipt3?.ok)
|
|
77563
|
+
if (receipt3?.ok) refresh3();
|
|
77564
77564
|
}, () => {
|
|
77565
77565
|
});
|
|
77566
77566
|
};
|
|
@@ -77576,7 +77576,7 @@ ${b6}`);
|
|
|
77576
77576
|
root4.removeEventListener("compositionend", onComposed);
|
|
77577
77577
|
};
|
|
77578
77578
|
}
|
|
77579
|
-
async function
|
|
77579
|
+
async function refresh3() {
|
|
77580
77580
|
const holder2 = ensureShadow();
|
|
77581
77581
|
if (!holder2 || destroyed) return journaled;
|
|
77582
77582
|
let listed2 = null;
|
|
@@ -77597,7 +77597,7 @@ ${b6}`);
|
|
|
77597
77597
|
button4.textContent = `Recover work (${count3})`;
|
|
77598
77598
|
if (!count3) close();
|
|
77599
77599
|
else if (!panel2.hidden) draw();
|
|
77600
|
-
if (refreshText)
|
|
77600
|
+
if (refreshText) refresh3();
|
|
77601
77601
|
return rows2;
|
|
77602
77602
|
}
|
|
77603
77603
|
return {
|
|
@@ -77606,7 +77606,7 @@ ${b6}`);
|
|
|
77606
77606
|
download: download2,
|
|
77607
77607
|
recover,
|
|
77608
77608
|
dismiss: dismiss5,
|
|
77609
|
-
refresh:
|
|
77609
|
+
refresh: refresh3,
|
|
77610
77610
|
watch: watch2,
|
|
77611
77611
|
update: update2,
|
|
77612
77612
|
get count() {
|
|
@@ -77685,14 +77685,14 @@ ${b6}`);
|
|
|
77685
77685
|
function createFormatGate({
|
|
77686
77686
|
host: host2,
|
|
77687
77687
|
capability = PAGE_FORMAT,
|
|
77688
|
-
supported = () => true,
|
|
77688
|
+
supported: supported2 = () => true,
|
|
77689
77689
|
installed: installed6 = () => null,
|
|
77690
77690
|
revision = () => null,
|
|
77691
77691
|
lane = null
|
|
77692
77692
|
} = {}) {
|
|
77693
77693
|
if (!host2 || typeof host2.activate !== "function") throw new TypeError("format-gate: a host adapter is required");
|
|
77694
77694
|
let floor = 0;
|
|
77695
|
-
let
|
|
77695
|
+
let pending8 = null;
|
|
77696
77696
|
let lanePending2 = false;
|
|
77697
77697
|
let laneReceipt = null;
|
|
77698
77698
|
let laneAsked = false;
|
|
@@ -77730,7 +77730,7 @@ ${b6}`);
|
|
|
77730
77730
|
}
|
|
77731
77731
|
async function supportedHere() {
|
|
77732
77732
|
try {
|
|
77733
|
-
return await
|
|
77733
|
+
return await supported2() !== false;
|
|
77734
77734
|
} catch {
|
|
77735
77735
|
return false;
|
|
77736
77736
|
}
|
|
@@ -77794,10 +77794,10 @@ ${b6}`);
|
|
|
77794
77794
|
function activate2() {
|
|
77795
77795
|
if (disposed) return Promise.resolve({ status: "disposed", retry: false });
|
|
77796
77796
|
if (floor >= PAGE_FORMAT) return joinLane(null).then(() => ({ status: "active", floor }));
|
|
77797
|
-
if (!
|
|
77798
|
-
|
|
77797
|
+
if (!pending8) pending8 = activateNow().finally(() => {
|
|
77798
|
+
pending8 = null;
|
|
77799
77799
|
});
|
|
77800
|
-
return
|
|
77800
|
+
return pending8;
|
|
77801
77801
|
}
|
|
77802
77802
|
return {
|
|
77803
77803
|
get floor() {
|
|
@@ -77872,7 +77872,7 @@ ${b6}`);
|
|
|
77872
77872
|
function createFormatHost({
|
|
77873
77873
|
save: save2 = savePage2,
|
|
77874
77874
|
settles = saveSettles,
|
|
77875
|
-
supported = () => hostPageFormat().then((floor) => floor === PAGE_FORMAT)
|
|
77875
|
+
supported: supported2 = () => hostPageFormat().then((floor) => floor === PAGE_FORMAT)
|
|
77876
77876
|
} = {}) {
|
|
77877
77877
|
return {
|
|
77878
77878
|
read() {
|
|
@@ -77881,12 +77881,12 @@ ${b6}`);
|
|
|
77881
77881
|
capabilities() {
|
|
77882
77882
|
return [];
|
|
77883
77883
|
},
|
|
77884
|
-
supported,
|
|
77884
|
+
supported: supported2,
|
|
77885
77885
|
async activate({ floor = PAGE_FORMAT } = {}) {
|
|
77886
77886
|
let result2;
|
|
77887
77887
|
try {
|
|
77888
77888
|
result2 = await save2({ pageFormatFloor: floor });
|
|
77889
|
-
for (let
|
|
77889
|
+
for (let attempt2 = 1; attempt2 < SKIPPED_ATTEMPTS && skippedBehindSave(result2); attempt2 += 1) {
|
|
77890
77890
|
await settles();
|
|
77891
77891
|
result2 = await save2({ pageFormatFloor: floor });
|
|
77892
77892
|
}
|
|
@@ -77985,8 +77985,8 @@ ${b6}`);
|
|
|
77985
77985
|
candidate.resolve = resolve2;
|
|
77986
77986
|
});
|
|
77987
77987
|
active4 = candidate;
|
|
77988
|
-
const
|
|
77989
|
-
candidate.request =
|
|
77988
|
+
const request4 = { protocol: "page-tool/1", requestId, prompt, context: trimmed, target };
|
|
77989
|
+
candidate.request = request4;
|
|
77990
77990
|
const finish2 = (reply) => {
|
|
77991
77991
|
if (candidate.discarded || candidate.done || reply?.requestId !== requestId) return;
|
|
77992
77992
|
candidate.done = true;
|
|
@@ -77999,7 +77999,7 @@ ${b6}`);
|
|
|
77999
77999
|
} else candidate.resolve(typeof reply?.code === "string" ? reply : { requestId, code: "invalid-result", message: "invalid-result" });
|
|
78000
78000
|
};
|
|
78001
78001
|
try {
|
|
78002
|
-
Promise.resolve(transport2.request(
|
|
78002
|
+
Promise.resolve(transport2.request(request4)).then(finish2, (error2) => finish2({ requestId, code: "transport-error", message: String(error2?.message ?? error2) }));
|
|
78003
78003
|
} catch (error2) {
|
|
78004
78004
|
finish2({ requestId, code: "transport-error", message: String(error2?.message ?? error2) });
|
|
78005
78005
|
}
|
|
@@ -78436,12 +78436,12 @@ ${b6}`);
|
|
|
78436
78436
|
let disposed = false;
|
|
78437
78437
|
let quiesced = barrier;
|
|
78438
78438
|
let focused = typeof view3.hasFocus === "function" ? view3.hasFocus() === true : view3.dom.contains(doc.activeElement);
|
|
78439
|
-
let
|
|
78439
|
+
let pending8 = null;
|
|
78440
78440
|
const isComposing = () => composing2 ? composing2() === true : view3.composing === true;
|
|
78441
|
-
const
|
|
78441
|
+
const supported2 = () => store2.getSnapshot().pageAwareness !== false;
|
|
78442
78442
|
const publish2 = (state2 = view3.state) => {
|
|
78443
78443
|
if (disposed || quiesced) return;
|
|
78444
|
-
if (!
|
|
78444
|
+
if (!supported2() || !focused || isComposing()) {
|
|
78445
78445
|
store2.setTarget(null);
|
|
78446
78446
|
return;
|
|
78447
78447
|
}
|
|
@@ -78471,15 +78471,15 @@ ${b6}`);
|
|
|
78471
78471
|
}
|
|
78472
78472
|
}
|
|
78473
78473
|
});
|
|
78474
|
-
const
|
|
78474
|
+
const refresh3 = () => {
|
|
78475
78475
|
if (disposed || view3.isDestroyed) return;
|
|
78476
78476
|
view3.dispatch(view3.state.tr.setMeta(awarenessKey, true));
|
|
78477
78477
|
};
|
|
78478
78478
|
const schedule2 = () => {
|
|
78479
|
-
if (disposed ||
|
|
78480
|
-
|
|
78481
|
-
|
|
78482
|
-
|
|
78479
|
+
if (disposed || pending8 !== null || view3.isDestroyed) return;
|
|
78480
|
+
pending8 = frame(() => {
|
|
78481
|
+
pending8 = null;
|
|
78482
|
+
refresh3();
|
|
78483
78483
|
});
|
|
78484
78484
|
};
|
|
78485
78485
|
const unsubscribe = store2.subscribe((snapshot) => {
|
|
@@ -78523,7 +78523,7 @@ ${b6}`);
|
|
|
78523
78523
|
schedule2();
|
|
78524
78524
|
return {
|
|
78525
78525
|
epoch: epoch2,
|
|
78526
|
-
refresh:
|
|
78526
|
+
refresh: refresh3,
|
|
78527
78527
|
plugin,
|
|
78528
78528
|
quiesce,
|
|
78529
78529
|
resume,
|
|
@@ -78536,9 +78536,9 @@ ${b6}`);
|
|
|
78536
78536
|
dispose() {
|
|
78537
78537
|
if (disposed) return;
|
|
78538
78538
|
disposed = true;
|
|
78539
|
-
if (
|
|
78540
|
-
cancel2(
|
|
78541
|
-
|
|
78539
|
+
if (pending8 !== null) {
|
|
78540
|
+
cancel2(pending8);
|
|
78541
|
+
pending8 = null;
|
|
78542
78542
|
}
|
|
78543
78543
|
unsubscribe();
|
|
78544
78544
|
view3.dom.removeEventListener("focus", onFocus2);
|
|
@@ -79696,10 +79696,10 @@ ${doc.documentElement.outerHTML}`);
|
|
|
79696
79696
|
seeded: source3.seeded,
|
|
79697
79697
|
writerReady: awaitWriter,
|
|
79698
79698
|
adopted: (rev) => fastLane()?.adopted?.("page", rev, inst2.store.mark),
|
|
79699
|
-
notice: (
|
|
79700
|
-
if (!
|
|
79699
|
+
notice: (counts2) => {
|
|
79700
|
+
if (!counts2.copy) return;
|
|
79701
79701
|
toastPersistent2(OVERWRITTEN_TEXT, "warning", {
|
|
79702
|
-
actions: [{ label: "Download your copy", onClick: () => downloadSnapshot(
|
|
79702
|
+
actions: [{ label: "Download your copy", onClick: () => downloadSnapshot(counts2.copy) }]
|
|
79703
79703
|
});
|
|
79704
79704
|
}
|
|
79705
79705
|
});
|
|
@@ -80778,7 +80778,7 @@ ${doc.documentElement.outerHTML}`);
|
|
|
80778
80778
|
}
|
|
80779
80779
|
if (status?.state && status.state !== "applied") dispatch("clay:reader-status", status);
|
|
80780
80780
|
};
|
|
80781
|
-
const
|
|
80781
|
+
const paint3 = (prepared) => {
|
|
80782
80782
|
applyPreparedArticle(prepared, { article, readerOpen, savedOpen, keepTool });
|
|
80783
80783
|
if (prepared.rev === null) article.removeAttribute("data-rev");
|
|
80784
80784
|
else article.setAttribute("data-rev", prepared.rev);
|
|
@@ -80793,7 +80793,7 @@ ${doc.documentElement.outerHTML}`);
|
|
|
80793
80793
|
const previous = receipt3.bytes ? prepareSavedArticle(receipt3.bytes, doc) : null;
|
|
80794
80794
|
if (previous?.ok) {
|
|
80795
80795
|
try {
|
|
80796
|
-
|
|
80796
|
+
paint3(previous);
|
|
80797
80797
|
} catch (again) {
|
|
80798
80798
|
console.warn("clayjs: the reader could not restore the previous file", again);
|
|
80799
80799
|
}
|
|
@@ -80814,7 +80814,7 @@ ${doc.documentElement.outerHTML}`);
|
|
|
80814
80814
|
}
|
|
80815
80815
|
pruneTools(prepared.tools);
|
|
80816
80816
|
try {
|
|
80817
|
-
|
|
80817
|
+
paint3(prepared);
|
|
80818
80818
|
} catch (error2) {
|
|
80819
80819
|
restore3(error2);
|
|
80820
80820
|
return false;
|
|
@@ -80851,7 +80851,7 @@ ${doc.documentElement.outerHTML}`);
|
|
|
80851
80851
|
if (represented2) {
|
|
80852
80852
|
const prepared = prepareSavedArticle(represented2.bytes, doc);
|
|
80853
80853
|
if (!prepared.ok) throw new Error(`clayjs: the saved file is not a readable page (${prepared.reason})`);
|
|
80854
|
-
|
|
80854
|
+
paint3(prepared);
|
|
80855
80855
|
mountTools(prepared.tools, prepared.toolState);
|
|
80856
80856
|
} else {
|
|
80857
80857
|
for (const details of article.querySelectorAll("details[data-id]")) savedOpen.set(details.getAttribute("data-id"), details.hasAttribute("open"));
|
|
@@ -80882,7 +80882,7 @@ ${doc.documentElement.outerHTML}`);
|
|
|
80882
80882
|
if (receipt3.bytes !== null) {
|
|
80883
80883
|
const prepared = prepareSavedArticle(receipt3.bytes, doc);
|
|
80884
80884
|
if (prepared.ok) {
|
|
80885
|
-
|
|
80885
|
+
paint3(prepared);
|
|
80886
80886
|
mountTools(prepared.tools, prepared.toolState);
|
|
80887
80887
|
}
|
|
80888
80888
|
}
|
|
@@ -82239,16 +82239,16 @@ ${doc.documentElement.outerHTML}`);
|
|
|
82239
82239
|
releaseMove(start10);
|
|
82240
82240
|
};
|
|
82241
82241
|
const restoreSoon = () => {
|
|
82242
|
-
const
|
|
82242
|
+
const pending8 = recorded;
|
|
82243
82243
|
recorded = null;
|
|
82244
|
-
if (
|
|
82245
|
-
record6.presses.delete(
|
|
82246
|
-
pressed.delete(
|
|
82247
|
-
restoring =
|
|
82244
|
+
if (pending8) {
|
|
82245
|
+
record6.presses.delete(pending8);
|
|
82246
|
+
pressed.delete(pending8);
|
|
82247
|
+
restoring = pending8;
|
|
82248
82248
|
}
|
|
82249
82249
|
ends.forEach((entry) => untrack2(record6, entry));
|
|
82250
82250
|
ends = [];
|
|
82251
|
-
if (
|
|
82251
|
+
if (pending8) later2(record6, () => restoreRuntimeAttrs(pending8));
|
|
82252
82252
|
};
|
|
82253
82253
|
const settleSoon = (event) => {
|
|
82254
82254
|
if (native && event?.type === "pointercancel") return;
|
|
@@ -91598,14 +91598,14 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91598
91598
|
}
|
|
91599
91599
|
return wanted;
|
|
91600
91600
|
}
|
|
91601
|
-
async function runUpload(file, { onProgress, signal, requiredAccess, taskId = nextId2(), attempt = 1 } = {}) {
|
|
91601
|
+
async function runUpload(file, { onProgress, signal, requiredAccess, taskId = nextId2(), attempt: attempt2 = 1 } = {}) {
|
|
91602
91602
|
const wantedAccess = checkRequiredAccess(requiredAccess);
|
|
91603
91603
|
if (!file) return result(false, "No file to upload", "error", "bad-request");
|
|
91604
91604
|
const cancelled3 = () => result(false, "Upload cancelled", "error", "aborted");
|
|
91605
91605
|
if (!admitsAttempts()) return cancelled3();
|
|
91606
91606
|
let meta;
|
|
91607
91607
|
try {
|
|
91608
|
-
meta = await hostMeta(
|
|
91608
|
+
meta = await hostMeta(attempt2 > 1 ? { fresh: true } : void 0);
|
|
91609
91609
|
} catch (_7) {
|
|
91610
91610
|
meta = { extensions: [], document: null };
|
|
91611
91611
|
}
|
|
@@ -91632,7 +91632,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91632
91632
|
if (typeof cap === "number" && cap > 0 && file.size > cap) {
|
|
91633
91633
|
return result(false, `That file is larger than this host accepts (${cap} bytes)`, "error", "too-large");
|
|
91634
91634
|
}
|
|
91635
|
-
return postFile(file, { onProgress, signal, taskId, attempt, requiredAccess: wantedAccess });
|
|
91635
|
+
return postFile(file, { onProgress, signal, taskId, attempt: attempt2, requiredAccess: wantedAccess });
|
|
91636
91636
|
}
|
|
91637
91637
|
function verifyAccess(answer, wantedAccess) {
|
|
91638
91638
|
if (!wantedAccess || !answer.ok) return answer;
|
|
@@ -91641,10 +91641,10 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91641
91641
|
if (kept2) return answer;
|
|
91642
91642
|
return result(false, "The host stored the file without the access it promised", "error", "privacy-unsupported", uploads);
|
|
91643
91643
|
}
|
|
91644
|
-
function postFile(file, { onProgress, signal, taskId, attempt, requiredAccess } = {}) {
|
|
91644
|
+
function postFile(file, { onProgress, signal, taskId, attempt: attempt2, requiredAccess } = {}) {
|
|
91645
91645
|
const wantedAccess = Array.isArray(requiredAccess) ? requiredAccess : checkRequiredAccess(requiredAccess);
|
|
91646
91646
|
return new Promise((resolve2) => {
|
|
91647
|
-
const events = { taskId, attempt };
|
|
91647
|
+
const events = { taskId, attempt: attempt2 };
|
|
91648
91648
|
const token2 = saveToken();
|
|
91649
91649
|
const path = token2 ? `${UPLOAD_PATH}/${token2}` : UPLOAD_PATH;
|
|
91650
91650
|
const url = new URL(path, window.location.origin).href;
|
|
@@ -91741,7 +91741,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91741
91741
|
const requiredAccess = options.requiredAccess ?? null;
|
|
91742
91742
|
const onProgress = options.onProgress || null;
|
|
91743
91743
|
let held = file;
|
|
91744
|
-
let
|
|
91744
|
+
let attempt2 = 0;
|
|
91745
91745
|
let state2 = "uploading";
|
|
91746
91746
|
let loaded2 = 0;
|
|
91747
91747
|
let total = null;
|
|
@@ -91753,7 +91753,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91753
91753
|
let cancelledAttempt = 0;
|
|
91754
91754
|
const listeners7 = /* @__PURE__ */ new Set();
|
|
91755
91755
|
function readSnapshot() {
|
|
91756
|
-
return { id: id2, attempt, state: state2, loaded: loaded2, total, percent, result: outcome2 };
|
|
91756
|
+
return { id: id2, attempt: attempt2, state: state2, loaded: loaded2, total, percent, result: outcome2 };
|
|
91757
91757
|
}
|
|
91758
91758
|
function publish2() {
|
|
91759
91759
|
if (!listeners7.size) return;
|
|
@@ -91766,8 +91766,8 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91766
91766
|
}
|
|
91767
91767
|
}
|
|
91768
91768
|
function runAttempt() {
|
|
91769
|
-
|
|
91770
|
-
const mine =
|
|
91769
|
+
attempt2 += 1;
|
|
91770
|
+
const mine = attempt2;
|
|
91771
91771
|
controller2 = new AbortController();
|
|
91772
91772
|
state2 = "uploading";
|
|
91773
91773
|
loaded2 = 0;
|
|
@@ -91780,7 +91780,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91780
91780
|
taskId: id2,
|
|
91781
91781
|
attempt: mine,
|
|
91782
91782
|
onProgress: (progress) => {
|
|
91783
|
-
if (disposed || mine !==
|
|
91783
|
+
if (disposed || mine !== attempt2) return;
|
|
91784
91784
|
loaded2 = progress.loaded;
|
|
91785
91785
|
total = progress.total;
|
|
91786
91786
|
percent = progress.percent;
|
|
@@ -91793,7 +91793,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91793
91793
|
}
|
|
91794
91794
|
}
|
|
91795
91795
|
}).then((value) => {
|
|
91796
|
-
if (!disposed && mine ===
|
|
91796
|
+
if (!disposed && mine === attempt2 && mine !== cancelledAttempt) {
|
|
91797
91797
|
outcome2 = value;
|
|
91798
91798
|
state2 = value.ok ? "succeeded" : value.code === "aborted" ? "cancelled" : "failed";
|
|
91799
91799
|
publish2();
|
|
@@ -91808,7 +91808,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91808
91808
|
const task = {
|
|
91809
91809
|
id: id2,
|
|
91810
91810
|
get attempt() {
|
|
91811
|
-
return
|
|
91811
|
+
return attempt2;
|
|
91812
91812
|
},
|
|
91813
91813
|
get state() {
|
|
91814
91814
|
return state2;
|
|
@@ -91837,7 +91837,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
91837
91837
|
cancel() {
|
|
91838
91838
|
if (disposed) return;
|
|
91839
91839
|
if (state2 === "uploading") {
|
|
91840
|
-
cancelledAttempt =
|
|
91840
|
+
cancelledAttempt = attempt2;
|
|
91841
91841
|
state2 = "cancelled";
|
|
91842
91842
|
outcome2 = result(false, "Upload cancelled", "error", "aborted");
|
|
91843
91843
|
publish2();
|
|
@@ -93042,10 +93042,10 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93042
93042
|
}).catch(() => {
|
|
93043
93043
|
});
|
|
93044
93044
|
const storage2 = session6();
|
|
93045
|
-
const
|
|
93046
|
-
if (
|
|
93045
|
+
const pending8 = storage2 && storage2.get(RESUME_KEY);
|
|
93046
|
+
if (pending8) {
|
|
93047
93047
|
storage2.remove(RESUME_KEY);
|
|
93048
|
-
const run5 = resumers.get(
|
|
93048
|
+
const run5 = resumers.get(pending8);
|
|
93049
93049
|
if (run5 && currentMode2() === "edit") run5();
|
|
93050
93050
|
}
|
|
93051
93051
|
return { inEditMode, resumable, refresh: renderUndo };
|
|
@@ -93347,14 +93347,14 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93347
93347
|
}
|
|
93348
93348
|
function attachVariants({ root: root4, capsule, addItem, removeItem, note, currentMode: currentMode2 }) {
|
|
93349
93349
|
let previewing = null;
|
|
93350
|
-
let
|
|
93350
|
+
let pending8 = null;
|
|
93351
93351
|
let copy13 = null;
|
|
93352
93352
|
let pill = null;
|
|
93353
93353
|
let drawn = null;
|
|
93354
93354
|
const isEdit = () => currentMode2() === "edit";
|
|
93355
93355
|
const shown3 = () => previewing ?? savedName();
|
|
93356
93356
|
const storage2 = () => window.clay && window.clay.storage && window.clay.storage.session;
|
|
93357
|
-
function
|
|
93357
|
+
function paint3() {
|
|
93358
93358
|
const saved2 = savedName();
|
|
93359
93359
|
if (previewing !== null && previewing === saved2) previewing = null;
|
|
93360
93360
|
copy13?.remove();
|
|
@@ -93368,7 +93368,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93368
93368
|
const source3 = looks().find((style3) => nameOf(style3) === previewing);
|
|
93369
93369
|
if (!source3) {
|
|
93370
93370
|
previewing = null;
|
|
93371
|
-
return
|
|
93371
|
+
return paint3();
|
|
93372
93372
|
}
|
|
93373
93373
|
copy13 = document.createElement("style");
|
|
93374
93374
|
copy13.setAttribute("clay", "editor-ui");
|
|
@@ -93382,24 +93382,24 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93382
93382
|
function choose(name) {
|
|
93383
93383
|
if (!isEdit()) return { ok: false, code: "not-editing" };
|
|
93384
93384
|
if (!names().includes(name)) return { ok: false, code: "unknown-variant" };
|
|
93385
|
-
|
|
93385
|
+
pending8 = previewing = null;
|
|
93386
93386
|
writeHead(CHOOSE_LABEL, () => {
|
|
93387
93387
|
for (const style3 of looks()) {
|
|
93388
93388
|
if (nameOf(style3) === name) style3.removeAttribute("media");
|
|
93389
93389
|
else if (style3.getAttribute("media") !== OFF) style3.setAttribute("media", OFF);
|
|
93390
93390
|
}
|
|
93391
93391
|
});
|
|
93392
|
-
|
|
93392
|
+
refresh3();
|
|
93393
93393
|
return { ok: true };
|
|
93394
93394
|
}
|
|
93395
93395
|
function preview2(name) {
|
|
93396
93396
|
if (name !== null && !names().includes(name)) return { ok: false, code: "unknown-variant" };
|
|
93397
93397
|
previewing = name;
|
|
93398
|
-
|
|
93398
|
+
refresh3();
|
|
93399
93399
|
return { ok: true };
|
|
93400
93400
|
}
|
|
93401
93401
|
function keepNow(name) {
|
|
93402
|
-
|
|
93402
|
+
pending8 = previewing = null;
|
|
93403
93403
|
writeHead(KEEP_LABEL, () => {
|
|
93404
93404
|
for (const style3 of looks()) {
|
|
93405
93405
|
if (nameOf(style3) === name) {
|
|
@@ -93411,7 +93411,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93411
93411
|
}
|
|
93412
93412
|
}
|
|
93413
93413
|
});
|
|
93414
|
-
|
|
93414
|
+
refresh3();
|
|
93415
93415
|
}
|
|
93416
93416
|
function keep3() {
|
|
93417
93417
|
if (!isEdit()) return Promise.resolve({ ok: false, code: "not-editing" });
|
|
@@ -93451,11 +93451,11 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93451
93451
|
if (name == null) return;
|
|
93452
93452
|
store2.remove(RECEIPT);
|
|
93453
93453
|
if (!isEdit() || !names().includes(name)) return;
|
|
93454
|
-
|
|
93455
|
-
|
|
93454
|
+
pending8 = previewing = name;
|
|
93455
|
+
refresh3();
|
|
93456
93456
|
await afterBaseline();
|
|
93457
|
-
if (
|
|
93458
|
-
|
|
93457
|
+
if (pending8 !== name || !current5()) return;
|
|
93458
|
+
pending8 = null;
|
|
93459
93459
|
if (isEdit() && names().includes(name)) choose(name);
|
|
93460
93460
|
}
|
|
93461
93461
|
function step(by) {
|
|
@@ -93499,8 +93499,8 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93499
93499
|
if (isEdit()) addItem({ id: KEEP_ID, label: `Keep Variant ${savedName()}, remove the others\u2026`, run: () => keep3() });
|
|
93500
93500
|
else removeItem(KEEP_ID);
|
|
93501
93501
|
}
|
|
93502
|
-
function
|
|
93503
|
-
|
|
93502
|
+
function refresh3() {
|
|
93503
|
+
paint3();
|
|
93504
93504
|
draw();
|
|
93505
93505
|
announce4();
|
|
93506
93506
|
}
|
|
@@ -93510,18 +93510,18 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93510
93510
|
document.addEventListener("clay:modechange", () => {
|
|
93511
93511
|
if (!current5()) return;
|
|
93512
93512
|
if (isEdit()) {
|
|
93513
|
-
previewing =
|
|
93513
|
+
previewing = pending8;
|
|
93514
93514
|
applyReceipt();
|
|
93515
93515
|
} else {
|
|
93516
|
-
|
|
93516
|
+
pending8 = null;
|
|
93517
93517
|
}
|
|
93518
|
-
|
|
93518
|
+
refresh3();
|
|
93519
93519
|
});
|
|
93520
93520
|
document.addEventListener("clay:sync-applied", () => {
|
|
93521
|
-
if (current5())
|
|
93521
|
+
if (current5()) refresh3();
|
|
93522
93522
|
});
|
|
93523
93523
|
document.addEventListener("clay:undo-change", () => {
|
|
93524
|
-
if (current5() && state2() !== drawn)
|
|
93524
|
+
if (current5() && state2() !== drawn) refresh3();
|
|
93525
93525
|
});
|
|
93526
93526
|
api = window.clay.variants = {
|
|
93527
93527
|
list: () => {
|
|
@@ -93540,7 +93540,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93540
93540
|
};
|
|
93541
93541
|
if (names().length >= 2) {
|
|
93542
93542
|
if (isEdit()) applyReceipt();
|
|
93543
|
-
|
|
93543
|
+
refresh3();
|
|
93544
93544
|
}
|
|
93545
93545
|
}
|
|
93546
93546
|
var OFF, RECEIPT, KEEP_ID, CHOOSE_LABEL, KEEP_LABEL, PREV, NEXT, looks, nameOf, names;
|
|
@@ -93980,7 +93980,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
93980
93980
|
let ui8 = null;
|
|
93981
93981
|
let uploadAvailable = false;
|
|
93982
93982
|
let pendingTitleMode = "";
|
|
93983
|
-
const
|
|
93983
|
+
const pending8 = registerUnsavedState({
|
|
93984
93984
|
id: "seo",
|
|
93985
93985
|
isPending: () => !closed && Object.keys(changes2()).length > 0
|
|
93986
93986
|
});
|
|
@@ -94069,7 +94069,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
94069
94069
|
else input.value = text4(value);
|
|
94070
94070
|
chosen.add(key3);
|
|
94071
94071
|
conflict.hidden = true;
|
|
94072
|
-
|
|
94072
|
+
refresh3();
|
|
94073
94073
|
});
|
|
94074
94074
|
mineButton.addEventListener("click", () => {
|
|
94075
94075
|
chosen.add(key3);
|
|
@@ -94152,7 +94152,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
94152
94152
|
return "";
|
|
94153
94153
|
}
|
|
94154
94154
|
}
|
|
94155
|
-
function
|
|
94155
|
+
function refresh3() {
|
|
94156
94156
|
const titleValue = text4(readField("title")).trim();
|
|
94157
94157
|
const descriptionValue = text4(readField("description")).trim();
|
|
94158
94158
|
inputs2.get("ogTitle").placeholder = titleValue;
|
|
@@ -94300,7 +94300,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
94300
94300
|
function close() {
|
|
94301
94301
|
if (closed) return;
|
|
94302
94302
|
closed = true;
|
|
94303
|
-
|
|
94303
|
+
pending8.dispose();
|
|
94304
94304
|
document.removeEventListener("clay:modechange", followMode);
|
|
94305
94305
|
if (heightObserver) heightObserver.disconnect();
|
|
94306
94306
|
heightVars.remove();
|
|
@@ -94334,8 +94334,8 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
94334
94334
|
layout2();
|
|
94335
94335
|
}
|
|
94336
94336
|
form.addEventListener("input", () => {
|
|
94337
|
-
|
|
94338
|
-
|
|
94337
|
+
refresh3();
|
|
94338
|
+
pending8.changed();
|
|
94339
94339
|
});
|
|
94340
94340
|
inputs2.get("title").addEventListener("input", () => {
|
|
94341
94341
|
pendingTitleMode = "";
|
|
@@ -94343,7 +94343,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
94343
94343
|
derivedButton.addEventListener("click", () => {
|
|
94344
94344
|
pendingTitleMode = "derived";
|
|
94345
94345
|
inputs2.get("title").value = firstHeadingText();
|
|
94346
|
-
|
|
94346
|
+
refresh3();
|
|
94347
94347
|
});
|
|
94348
94348
|
uploadButton.addEventListener("click", () => fileInput.click());
|
|
94349
94349
|
fileInput.addEventListener("change", async () => {
|
|
@@ -94363,7 +94363,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
94363
94363
|
const upload2 = result2 && result2.ok && Array.isArray(result2.uploads) ? result2.uploads[0] : null;
|
|
94364
94364
|
if (!upload2 || !upload2.url) return;
|
|
94365
94365
|
inputs2.get("ogImage").value = upload2.url;
|
|
94366
|
-
|
|
94366
|
+
refresh3();
|
|
94367
94367
|
});
|
|
94368
94368
|
applyButton.addEventListener("click", apply3);
|
|
94369
94369
|
cancelButton.addEventListener("click", close);
|
|
@@ -94407,7 +94407,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
94407
94407
|
heightObserver = new ResizeObserver(writeHeight);
|
|
94408
94408
|
heightObserver.observe(root4);
|
|
94409
94409
|
}
|
|
94410
|
-
|
|
94410
|
+
refresh3();
|
|
94411
94411
|
layout2();
|
|
94412
94412
|
inputs2.get("title").focus();
|
|
94413
94413
|
checkHostedRobots();
|
|
@@ -95177,8 +95177,8 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
95177
95177
|
quiesce() {
|
|
95178
95178
|
if (session7 !== lease) return;
|
|
95179
95179
|
lease.admitted = false;
|
|
95180
|
-
const
|
|
95181
|
-
if (
|
|
95180
|
+
const pending8 = [...records2.values()].filter((rec) => rec.document === "edit" && (rec.holdsSave || OPEN_STATES.has(rec.state))).map((rec) => rec.id);
|
|
95181
|
+
if (pending8.length) throw fault5("a request on this page has not settled", "pending-input", pending8);
|
|
95182
95182
|
},
|
|
95183
95183
|
resume() {
|
|
95184
95184
|
if (session7 === lease) lease.admitted = true;
|
|
@@ -95211,7 +95211,7 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
95211
95211
|
const { savesHeld: savesHeld2, saveHoldReason: saveHoldReason2 } = await Promise.resolve().then(() => (init_save(), save_exports));
|
|
95212
95212
|
if (savesHeld2()) throw new Error(saveHoldReason2());
|
|
95213
95213
|
const deadline = Date.now() + SAVE_FLUSH_TIMEOUT_MS;
|
|
95214
|
-
for (let
|
|
95214
|
+
for (let attempt2 = 0; attempt2 < 3; attempt2++) {
|
|
95215
95215
|
if (isSaveInProgress2()) {
|
|
95216
95216
|
await once("clay:save-saved", Math.max(0, deadline - Date.now()));
|
|
95217
95217
|
}
|
|
@@ -95310,9 +95310,9 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
95310
95310
|
const dispatch = async () => {
|
|
95311
95311
|
if (rec.state !== "sent") return;
|
|
95312
95312
|
if (rec.helper) {
|
|
95313
|
-
const
|
|
95313
|
+
const supported2 = await hostSupports(HELPER_EXTENSION);
|
|
95314
95314
|
if (rec.state !== "sent") return;
|
|
95315
|
-
if (!
|
|
95315
|
+
if (!supported2) {
|
|
95316
95316
|
finish(rec, "error", "this host does not support named wire helpers", {
|
|
95317
95317
|
errorCode: "helper_protocol_unsupported",
|
|
95318
95318
|
errorSource: "client"
|
|
@@ -95462,7 +95462,7 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
95462
95462
|
saveLaneReady = null;
|
|
95463
95463
|
session7 = null;
|
|
95464
95464
|
admits = () => !session7 || session7.admitted;
|
|
95465
|
-
fault5 = (message2, code,
|
|
95465
|
+
fault5 = (message2, code, pending8) => Object.assign(new Error(`clay.wire: ${message2}`), { code, pending: pending8 });
|
|
95466
95466
|
wire = { send, cancel, get: get3, list: list2, isBusy, on: on4, helpers };
|
|
95467
95467
|
wire_default = wire;
|
|
95468
95468
|
}
|
|
@@ -95569,7 +95569,7 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
95569
95569
|
return result2;
|
|
95570
95570
|
}
|
|
95571
95571
|
async function post(data) {
|
|
95572
|
-
const
|
|
95572
|
+
const formToken2 = await takeToken();
|
|
95573
95573
|
let res;
|
|
95574
95574
|
try {
|
|
95575
95575
|
res = await fetch(MESSAGE_PATH, {
|
|
@@ -95578,7 +95578,7 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
95578
95578
|
// guard, and the message never needs the visitor's cookies.
|
|
95579
95579
|
credentials: "omit",
|
|
95580
95580
|
headers: { "Content-Type": "application/json", "Document-URL": window.location.href },
|
|
95581
|
-
body: JSON.stringify({ ...data, formToken, formSignals: signals() })
|
|
95581
|
+
body: JSON.stringify({ ...data, formToken: formToken2, formSignals: signals() })
|
|
95582
95582
|
});
|
|
95583
95583
|
} catch {
|
|
95584
95584
|
return { ok: false, error: "The message couldn't be sent. Check your connection and try again." };
|
|
@@ -95645,6 +95645,219 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
95645
95645
|
}
|
|
95646
95646
|
});
|
|
95647
95647
|
|
|
95648
|
+
// src/plugins/like.js
|
|
95649
|
+
var like_exports = {};
|
|
95650
|
+
__export(like_exports, {
|
|
95651
|
+
default: () => like_default,
|
|
95652
|
+
like: () => like,
|
|
95653
|
+
refresh: () => refresh2,
|
|
95654
|
+
toggle: () => toggle2
|
|
95655
|
+
});
|
|
95656
|
+
function readStore(key3) {
|
|
95657
|
+
try {
|
|
95658
|
+
return localStorage.getItem(key3);
|
|
95659
|
+
} catch {
|
|
95660
|
+
return null;
|
|
95661
|
+
}
|
|
95662
|
+
}
|
|
95663
|
+
function writeStore(key3, value) {
|
|
95664
|
+
try {
|
|
95665
|
+
localStorage.setItem(key3, value);
|
|
95666
|
+
} catch {
|
|
95667
|
+
}
|
|
95668
|
+
}
|
|
95669
|
+
function newVisitorId() {
|
|
95670
|
+
if (typeof crypto.randomUUID === "function") return crypto.randomUUID();
|
|
95671
|
+
return Array.from(crypto.getRandomValues(new Uint8Array(16)), (b6) => b6.toString(16).padStart(2, "0")).join("");
|
|
95672
|
+
}
|
|
95673
|
+
function visitor() {
|
|
95674
|
+
if (visitorId) return visitorId;
|
|
95675
|
+
const stored = readStore(VISITOR_KEY);
|
|
95676
|
+
visitorId = stored && /^[A-Za-z0-9-]{16,64}$/.test(stored) ? stored : newVisitorId();
|
|
95677
|
+
if (visitorId !== stored) writeStore(VISITOR_KEY, visitorId);
|
|
95678
|
+
return visitorId;
|
|
95679
|
+
}
|
|
95680
|
+
function likedItems() {
|
|
95681
|
+
if (!liked) {
|
|
95682
|
+
try {
|
|
95683
|
+
liked = new Set(JSON.parse(readStore(likedKey()) || "[]"));
|
|
95684
|
+
} catch {
|
|
95685
|
+
liked = /* @__PURE__ */ new Set();
|
|
95686
|
+
}
|
|
95687
|
+
}
|
|
95688
|
+
return liked;
|
|
95689
|
+
}
|
|
95690
|
+
function setLiked(item, on6) {
|
|
95691
|
+
const items = likedItems();
|
|
95692
|
+
if (on6) items.add(item);
|
|
95693
|
+
else items.delete(item);
|
|
95694
|
+
writeStore(likedKey(), JSON.stringify([...items]));
|
|
95695
|
+
}
|
|
95696
|
+
async function request3(method, body2) {
|
|
95697
|
+
let res;
|
|
95698
|
+
try {
|
|
95699
|
+
res = await fetch(PATH, {
|
|
95700
|
+
method,
|
|
95701
|
+
credentials: "omit",
|
|
95702
|
+
cache: "no-store",
|
|
95703
|
+
headers: { "Content-Type": "application/json", "Document-URL": location.href },
|
|
95704
|
+
body: body2 ? JSON.stringify(body2) : void 0
|
|
95705
|
+
});
|
|
95706
|
+
} catch {
|
|
95707
|
+
return { ok: false, error: OFFLINE };
|
|
95708
|
+
}
|
|
95709
|
+
const data = await res.json().catch(() => null);
|
|
95710
|
+
if (!data) {
|
|
95711
|
+
if (res.ok || method === "GET" && (res.status === 404 || res.status === 405)) {
|
|
95712
|
+
return { ok: false, unsupported: true, error: null };
|
|
95713
|
+
}
|
|
95714
|
+
return { ok: false, error: `The like couldn't be saved (${res.status}).` };
|
|
95715
|
+
}
|
|
95716
|
+
if (typeof data.formToken === "string") formToken = data.formToken;
|
|
95717
|
+
if (res.ok) return { ok: true, ...data };
|
|
95718
|
+
return { ok: false, code: data.code, error: data.error || data.msg || null };
|
|
95719
|
+
}
|
|
95720
|
+
function countSpan(el13) {
|
|
95721
|
+
for (const child of el13.children) {
|
|
95722
|
+
if (child.classList.contains("like-count") && child.getAttribute("clay") === "editor-ui") return child;
|
|
95723
|
+
}
|
|
95724
|
+
const span = document.createElement("span");
|
|
95725
|
+
span.className = "like-count";
|
|
95726
|
+
span.setAttribute("clay", "editor-ui");
|
|
95727
|
+
el13.append(span);
|
|
95728
|
+
return span;
|
|
95729
|
+
}
|
|
95730
|
+
function paint2() {
|
|
95731
|
+
if (!counts) return;
|
|
95732
|
+
const items = likedItems();
|
|
95733
|
+
for (const el13 of document.querySelectorAll("[like]")) {
|
|
95734
|
+
const item = itemOf(el13);
|
|
95735
|
+
const count3 = counts[item]?.like;
|
|
95736
|
+
if (typeof count3 !== "number") continue;
|
|
95737
|
+
const span = countSpan(el13);
|
|
95738
|
+
if (span.textContent !== String(count3)) span.textContent = String(count3);
|
|
95739
|
+
window.clay?.ephemeral?.toggle(el13, "liked", items.has(item));
|
|
95740
|
+
}
|
|
95741
|
+
}
|
|
95742
|
+
function refresh2() {
|
|
95743
|
+
if (!loading5) {
|
|
95744
|
+
loading5 = request3("GET").then((result2) => {
|
|
95745
|
+
if (result2.unsupported) supported = false;
|
|
95746
|
+
else if (result2.ok && result2.counts) {
|
|
95747
|
+
supported = true;
|
|
95748
|
+
counts = result2.counts;
|
|
95749
|
+
loadedAt = Date.now();
|
|
95750
|
+
}
|
|
95751
|
+
paint2();
|
|
95752
|
+
}).finally(() => {
|
|
95753
|
+
loading5 = null;
|
|
95754
|
+
});
|
|
95755
|
+
}
|
|
95756
|
+
return loading5;
|
|
95757
|
+
}
|
|
95758
|
+
function refreshForMissing() {
|
|
95759
|
+
if (supported === false) return Promise.resolve();
|
|
95760
|
+
if (loading5) return loading5;
|
|
95761
|
+
if (counts && Date.now() - loadedAt < REFRESH_GAP_MS) return Promise.resolve();
|
|
95762
|
+
return refresh2();
|
|
95763
|
+
}
|
|
95764
|
+
async function put3(item, on6) {
|
|
95765
|
+
const token2 = formToken;
|
|
95766
|
+
formToken = null;
|
|
95767
|
+
return request3("PUT", { item, action: "like", visitor: visitor(), on: on6, formToken: token2 });
|
|
95768
|
+
}
|
|
95769
|
+
async function attempt(item) {
|
|
95770
|
+
if (loading5) await loading5;
|
|
95771
|
+
if (!counts?.[item]) await refreshForMissing();
|
|
95772
|
+
if (supported === false || !counts?.[item]) return { ok: false, error: null };
|
|
95773
|
+
const on6 = !likedItems().has(item);
|
|
95774
|
+
let result2 = await put3(item, on6);
|
|
95775
|
+
if (result2.code === "form-token") result2 = await put3(item, on6);
|
|
95776
|
+
if (!result2.ok) return { ok: false, error: result2.error };
|
|
95777
|
+
setLiked(item, on6);
|
|
95778
|
+
if (counts?.[item]) counts[item].like = result2.count;
|
|
95779
|
+
paint2();
|
|
95780
|
+
return { ok: true, on: on6, count: result2.count, error: null };
|
|
95781
|
+
}
|
|
95782
|
+
async function toggle2(item) {
|
|
95783
|
+
if (pending7.has(item)) return { ok: false, error: null };
|
|
95784
|
+
pending7.add(item);
|
|
95785
|
+
try {
|
|
95786
|
+
return await attempt(item);
|
|
95787
|
+
} catch {
|
|
95788
|
+
return { ok: false, error: "The like couldn't be saved. Try again." };
|
|
95789
|
+
} finally {
|
|
95790
|
+
pending7.delete(item);
|
|
95791
|
+
}
|
|
95792
|
+
}
|
|
95793
|
+
async function onClick2(event) {
|
|
95794
|
+
const el13 = event.target?.closest?.("[like]");
|
|
95795
|
+
if (!el13 || event.defaultPrevented || el13.isContentEditable || supported === false) return;
|
|
95796
|
+
const item = itemOf(el13);
|
|
95797
|
+
if (!item) return;
|
|
95798
|
+
event.preventDefault();
|
|
95799
|
+
const result2 = await toggle2(item);
|
|
95800
|
+
if (result2.ok) {
|
|
95801
|
+
el13.dispatchEvent(new CustomEvent("clay:like", { bubbles: true, detail: { item, on: result2.on, count: result2.count } }));
|
|
95802
|
+
return;
|
|
95803
|
+
}
|
|
95804
|
+
if (!result2.error) return;
|
|
95805
|
+
const failed2 = new CustomEvent("clay:like-failed", { bubbles: true, cancelable: true, detail: { item, error: result2.error } });
|
|
95806
|
+
if (el13.dispatchEvent(failed2)) window.clay?.toast?.(result2.error, "error");
|
|
95807
|
+
}
|
|
95808
|
+
function addedLikes(records3) {
|
|
95809
|
+
const found = [];
|
|
95810
|
+
for (const record6 of records3) {
|
|
95811
|
+
for (const node of record6.addedNodes) {
|
|
95812
|
+
if (node.nodeType !== 1) continue;
|
|
95813
|
+
if (node.matches("[like]")) found.push(node);
|
|
95814
|
+
found.push(...node.querySelectorAll("[like]"));
|
|
95815
|
+
}
|
|
95816
|
+
}
|
|
95817
|
+
return found;
|
|
95818
|
+
}
|
|
95819
|
+
var PATH, VISITOR_KEY, OFFLINE, REFRESH_GAP_MS, counts, supported, formToken, loading5, loadedAt, visitorId, liked, pending7, likedKey, itemOf, like, like_default;
|
|
95820
|
+
var init_like = __esm({
|
|
95821
|
+
"src/plugins/like.js"() {
|
|
95822
|
+
PATH = "/_/reactions";
|
|
95823
|
+
VISITOR_KEY = "clay-like-visitor";
|
|
95824
|
+
OFFLINE = "Couldn't reach the server. Check your connection and try again.";
|
|
95825
|
+
REFRESH_GAP_MS = 5e3;
|
|
95826
|
+
counts = null;
|
|
95827
|
+
supported = null;
|
|
95828
|
+
formToken = null;
|
|
95829
|
+
loading5 = null;
|
|
95830
|
+
loadedAt = 0;
|
|
95831
|
+
visitorId = null;
|
|
95832
|
+
liked = null;
|
|
95833
|
+
pending7 = /* @__PURE__ */ new Set();
|
|
95834
|
+
likedKey = () => `clay-liked:${location.pathname}`;
|
|
95835
|
+
itemOf = (el13) => el13.getAttribute("like") || el13.id;
|
|
95836
|
+
if (typeof document !== "undefined") {
|
|
95837
|
+
document.addEventListener("click", onClick2);
|
|
95838
|
+
const start10 = () => {
|
|
95839
|
+
if (document.querySelector("[like]")) refresh2();
|
|
95840
|
+
let queued3 = false;
|
|
95841
|
+
new MutationObserver((records3) => {
|
|
95842
|
+
if (queued3 || supported === false) return;
|
|
95843
|
+
const added2 = addedLikes(records3);
|
|
95844
|
+
if (!added2.length) return;
|
|
95845
|
+
queued3 = true;
|
|
95846
|
+
requestAnimationFrame(() => {
|
|
95847
|
+
queued3 = false;
|
|
95848
|
+
if (added2.some((el13) => !counts?.[itemOf(el13)])) refreshForMissing();
|
|
95849
|
+
else paint2();
|
|
95850
|
+
});
|
|
95851
|
+
}).observe(document.body, { childList: true, subtree: true });
|
|
95852
|
+
};
|
|
95853
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start10);
|
|
95854
|
+
else start10();
|
|
95855
|
+
}
|
|
95856
|
+
like = { toggle: toggle2, refresh: refresh2, counts: () => counts ? structuredClone(counts) : null };
|
|
95857
|
+
like_default = like;
|
|
95858
|
+
}
|
|
95859
|
+
});
|
|
95860
|
+
|
|
95648
95861
|
// src/plugins/ai-edit.js
|
|
95649
95862
|
var ai_edit_exports = {};
|
|
95650
95863
|
__export(ai_edit_exports, {
|
|
@@ -96617,14 +96830,14 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
96617
96830
|
},
|
|
96618
96831
|
quiesce() {
|
|
96619
96832
|
const unsent2 = panel && !panel.hidden && textarea.value.trim() !== "" || [...drafted].some((el13) => el13.isConnected);
|
|
96620
|
-
const
|
|
96621
|
-
if (session8)
|
|
96622
|
-
if (barMode === "saving")
|
|
96623
|
-
if (unsent2)
|
|
96624
|
-
if (!
|
|
96833
|
+
const pending8 = [];
|
|
96834
|
+
if (session8) pending8.push(session8.id);
|
|
96835
|
+
if (barMode === "saving") pending8.push("save");
|
|
96836
|
+
if (unsent2) pending8.push("prompt");
|
|
96837
|
+
if (!pending8.length) return;
|
|
96625
96838
|
throw Object.assign(new Error("clay.aiEdit: an edit here is still unresolved"), {
|
|
96626
96839
|
code: "pending-input",
|
|
96627
|
-
pending:
|
|
96840
|
+
pending: pending8
|
|
96628
96841
|
});
|
|
96629
96842
|
},
|
|
96630
96843
|
resume() {
|
|
@@ -98242,14 +98455,14 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
98242
98455
|
}
|
|
98243
98456
|
return { value: mine, conflict: true };
|
|
98244
98457
|
}
|
|
98245
|
-
function countIds(value,
|
|
98458
|
+
function countIds(value, counts2 = /* @__PURE__ */ new Map()) {
|
|
98246
98459
|
if (Array.isArray(value)) {
|
|
98247
|
-
if (hasIds(value)) for (const row of value)
|
|
98248
|
-
for (const item of value) countIds(item,
|
|
98460
|
+
if (hasIds(value)) for (const row of value) counts2.set(row.id, (counts2.get(row.id) || 0) + 1);
|
|
98461
|
+
for (const item of value) countIds(item, counts2);
|
|
98249
98462
|
} else if (isPlain4(value)) {
|
|
98250
|
-
for (const item of Object.values(value)) countIds(item,
|
|
98463
|
+
for (const item of Object.values(value)) countIds(item, counts2);
|
|
98251
98464
|
}
|
|
98252
|
-
return
|
|
98465
|
+
return counts2;
|
|
98253
98466
|
}
|
|
98254
98467
|
function merge3(base2, mine, theirs) {
|
|
98255
98468
|
const merged2 = mergeValue(base2, mine, theirs, true);
|
|
@@ -98390,7 +98603,7 @@ textarea.clay-seo-input.is-short { min-height: 32px; }
|
|
|
98390
98603
|
function fit(data) {
|
|
98391
98604
|
const wanted = complete(JSON.parse(JSON.stringify(data)), live3(), true);
|
|
98392
98605
|
const dropped = [];
|
|
98393
|
-
for (let
|
|
98606
|
+
for (let attempt2 = 0; attempt2 < 4; attempt2++) {
|
|
98394
98607
|
const trial = doc.cloneNode(true);
|
|
98395
98608
|
try {
|
|
98396
98609
|
it5(trial, wanted, rules);
|
|
@@ -100783,7 +100996,7 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
|
|
|
100783
100996
|
if (!stamp3 || !held || stamp3 === held) return null;
|
|
100784
100997
|
return `source refused: the fetch answered version ${stamp3} while this page holds ${held}`;
|
|
100785
100998
|
}
|
|
100786
|
-
async function install9(sourceUrl, context2 = null,
|
|
100999
|
+
async function install9(sourceUrl, context2 = null, attempt2 = 0, render4 = true, latest = null) {
|
|
100787
101000
|
const session10 = state.session;
|
|
100788
101001
|
const t0 = now2();
|
|
100789
101002
|
const generation5 = state.adoptions;
|
|
@@ -100796,7 +101009,7 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
|
|
|
100796
101009
|
const t1 = now2();
|
|
100797
101010
|
const answer = await runInstallSteps({ src, context: context2, render: render4, session: session10, generation: generation5, t0, t1 });
|
|
100798
101011
|
if (answer !== SUPERSEDED2) return answer;
|
|
100799
|
-
if (
|
|
101012
|
+
if (attempt2 < SUPERSEDED_RETRIES) return install9(sourceUrl, context2, attempt2 + 1, render4, latest);
|
|
100800
101013
|
throw new Error("source refused: a save replaced the file while the fetch was in flight");
|
|
100801
101014
|
} catch (err) {
|
|
100802
101015
|
if (session10 !== state.session) return null;
|
|
@@ -101189,11 +101402,11 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
|
|
|
101189
101402
|
sourceParticipant: () => sourceParticipant
|
|
101190
101403
|
});
|
|
101191
101404
|
function loadSession() {
|
|
101192
|
-
|
|
101193
|
-
|
|
101405
|
+
loading6 ??= Promise.resolve().then(() => (init_session(), session_exports)).catch((error2) => {
|
|
101406
|
+
loading6 = null;
|
|
101194
101407
|
throw error2;
|
|
101195
101408
|
});
|
|
101196
|
-
return
|
|
101409
|
+
return loading6;
|
|
101197
101410
|
}
|
|
101198
101411
|
function retain(bytes3, etag, seq) {
|
|
101199
101412
|
if (typeof bytes3 !== "string") return;
|
|
@@ -101274,7 +101487,7 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
|
|
|
101274
101487
|
}
|
|
101275
101488
|
};
|
|
101276
101489
|
}
|
|
101277
|
-
var UNAVAILABLE2, session9, context, receipt2, admitted2, epoch, installing, answered,
|
|
101490
|
+
var UNAVAILABLE2, session9, context, receipt2, admitted2, epoch, installing, answered, loading6, source2, source_default;
|
|
101278
101491
|
var init_source2 = __esm({
|
|
101279
101492
|
"src/plugins/source.js"() {
|
|
101280
101493
|
init_save_core();
|
|
@@ -101305,7 +101518,7 @@ body:has(> .clay-intro) { height: auto !important; overflow: visible !important;
|
|
|
101305
101518
|
epoch = 0;
|
|
101306
101519
|
installing = null;
|
|
101307
101520
|
answered = false;
|
|
101308
|
-
|
|
101521
|
+
loading6 = null;
|
|
101309
101522
|
onSaveAccepted((bytes3, accepted2) => {
|
|
101310
101523
|
retain(bytes3, receipt2 ? receipt2.etag : null, receipt2 ? receipt2.seq : null);
|
|
101311
101524
|
if (session9 && !session9.installed()) session9.adoptAccepted(bytes3, accepted2);
|
|
@@ -111967,15 +112180,15 @@ ${t2}` : `"use strict"; return (${t2});`;
|
|
|
111967
112180
|
// src/utils/debounce.js
|
|
111968
112181
|
function debounce(callback, delay) {
|
|
111969
112182
|
let timeoutId;
|
|
111970
|
-
let
|
|
112183
|
+
let pending8 = [];
|
|
111971
112184
|
return function(...args) {
|
|
111972
112185
|
const ctx = this;
|
|
111973
112186
|
clearTimeout(timeoutId);
|
|
111974
112187
|
return new Promise((resolve2, reject) => {
|
|
111975
|
-
|
|
112188
|
+
pending8.push({ resolve: resolve2, reject });
|
|
111976
112189
|
timeoutId = setTimeout(() => {
|
|
111977
|
-
const waiting =
|
|
111978
|
-
|
|
112190
|
+
const waiting = pending8;
|
|
112191
|
+
pending8 = [];
|
|
111979
112192
|
settle6(callback, ctx, args, waiting);
|
|
111980
112193
|
}, delay);
|
|
111981
112194
|
});
|
|
@@ -113060,6 +113273,9 @@ ${t2}` : `"use strict"; return (${t2});`;
|
|
|
113060
113273
|
// A visitor's contact form to the document's owner. Not editOnly: visitors are
|
|
113061
113274
|
// who send messages.
|
|
113062
113275
|
message: { path: "plugins/message.js", editOnly: false, default: false },
|
|
113276
|
+
// A like button on any element, counted by the host. Not editOnly: visitors are
|
|
113277
|
+
// who like.
|
|
113278
|
+
like: { path: "plugins/like.js", editOnly: false, default: false },
|
|
113063
113279
|
// Edit mode only: the AI comment box is an editing gesture. Opt in with
|
|
113064
113280
|
// `plugins=ai-edit`; it stays dormant on any host that does not list a ready
|
|
113065
113281
|
// `ai-edit` helper.
|
|
@@ -113127,6 +113343,7 @@ ${t2}` : `"use strict"; return (${t2});`;
|
|
|
113127
113343
|
"plugins/menu.js": () => Promise.resolve().then(() => (init_menu(), menu_exports)),
|
|
113128
113344
|
"plugins/wire.js": () => Promise.resolve().then(() => (init_wire(), wire_exports)),
|
|
113129
113345
|
"plugins/message.js": () => Promise.resolve().then(() => (init_message(), message_exports)),
|
|
113346
|
+
"plugins/like.js": () => Promise.resolve().then(() => (init_like(), like_exports)),
|
|
113130
113347
|
"plugins/ai-edit.js": () => Promise.resolve().then(() => (init_ai_edit(), ai_edit_exports)),
|
|
113131
113348
|
"plugins/demo.js": () => Promise.resolve().then(() => (init_demo(), demo_exports)),
|
|
113132
113349
|
"plugins/visitor-drafts.js": () => Promise.resolve().then(() => (init_visitor_drafts(), visitor_drafts_exports)),
|
|
@@ -113136,7 +113353,7 @@ ${t2}` : `"use strict"; return (${t2});`;
|
|
|
113136
113353
|
"plugins/derive.js": () => Promise.resolve().then(() => (init_derive(), derive_exports)),
|
|
113137
113354
|
"plugins/upgrade.js": () => Promise.resolve().then(() => (init_upgrade(), upgrade_exports))
|
|
113138
113355
|
};
|
|
113139
|
-
var PLUGIN_ORDER = ["visitor-drafts", "richclay", "indicator", "sortable", "undo", "unsent", "quickcrop", "upload", "people", "menu", "upgrade", "cms", "page-view", "sync", "live", "page", "message", "wire", "ai-edit", "demo", "derive", "bind-text", "source"];
|
|
113356
|
+
var PLUGIN_ORDER = ["visitor-drafts", "richclay", "indicator", "sortable", "undo", "unsent", "quickcrop", "upload", "people", "menu", "upgrade", "cms", "page-view", "sync", "live", "page", "message", "like", "wire", "ai-edit", "demo", "derive", "bind-text", "source"];
|
|
113140
113357
|
var IMPLIES = { cms: ["quickcrop", "upload"], "ai-edit": ["wire"], page: ["live", "sync", "upload"] };
|
|
113141
113358
|
var DISPLACES = { page: ["richclay"] };
|
|
113142
113359
|
var LATE = /* @__PURE__ */ new Set(["source", "sortable", "menu", "upgrade"]);
|
|
@@ -113363,16 +113580,16 @@ ${t2}` : `"use strict"; return (${t2});`;
|
|
|
113363
113580
|
uimotion: () => Promise.resolve().then(() => (init_uimotion(), uimotion_exports))
|
|
113364
113581
|
};
|
|
113365
113582
|
function createAssets(table2) {
|
|
113366
|
-
const
|
|
113583
|
+
const loading7 = /* @__PURE__ */ new Map();
|
|
113367
113584
|
function load4(name) {
|
|
113368
113585
|
if (!Object.hasOwn(table2, name)) return Promise.reject(new Error(`clay.assets: no asset named "${name}"`));
|
|
113369
|
-
if (!
|
|
113370
|
-
|
|
113371
|
-
|
|
113586
|
+
if (!loading7.has(name)) {
|
|
113587
|
+
loading7.set(name, table2[name]().catch((error2) => {
|
|
113588
|
+
loading7.delete(name);
|
|
113372
113589
|
throw error2;
|
|
113373
113590
|
}));
|
|
113374
113591
|
}
|
|
113375
|
-
return
|
|
113592
|
+
return loading7.get(name);
|
|
113376
113593
|
}
|
|
113377
113594
|
return { load: load4, names: () => Object.keys(table2) };
|
|
113378
113595
|
}
|
|
@@ -113655,6 +113872,8 @@ ${t2}` : `"use strict"; return (${t2});`;
|
|
|
113655
113872
|
Object.defineProperty(clay6, "me", { get: mod.currentMe, configurable: true, enumerable: true });
|
|
113656
113873
|
} else if (path === "plugins/message.js") {
|
|
113657
113874
|
clay6.message = mod.message;
|
|
113875
|
+
} else if (path === "plugins/like.js") {
|
|
113876
|
+
clay6.like = mod.like;
|
|
113658
113877
|
} else if (path === "plugins/wire.js") {
|
|
113659
113878
|
clay6.wire = mod.wire || mod.default;
|
|
113660
113879
|
} else if (path === "plugins/ai-edit.js") {
|